react-json-view-lite
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -17,2 +17,3 @@ import * as React from 'react'; | ||
collapsedContent: string; | ||
childFieldsContainer: string; | ||
noQuotesForStringValues?: boolean; | ||
@@ -19,0 +20,0 @@ quotesForFieldNames?: boolean; |
@@ -5,3 +5,3 @@ import * as React from 'react'; | ||
data: Object | Array<any>; | ||
style?: StyleProps; | ||
style?: Partial<StyleProps>; | ||
shouldExpandNode?: (level: number, value: any, field?: string) => boolean; | ||
@@ -8,0 +8,0 @@ clickToExpandNode?: boolean; |
@@ -35,6 +35,3 @@ var React = require('react'); | ||
} | ||
if (!value || quoted) { | ||
return `"${value}"`; | ||
} | ||
return value; | ||
return !value || quoted ? `"${value}"` : value; | ||
} | ||
@@ -134,3 +131,4 @@ function ExpandableObject(_ref) { | ||
id: contentsId, | ||
role: 'group' | ||
role: 'group', | ||
className: style.childFieldsContainer | ||
}, data.map((dataElement, index) => (/*#__PURE__*/React.createElement(DataRender, { | ||
@@ -303,3 +301,3 @@ key: dataElement[0] || index, | ||
var styles = {"container-base":"_GzYRV","punctuation-base":"_3eOF8","pointer":"_1MFti","expander-base":"_f10Tu _1MFti","expand-icon":"_1UmXx","collapse-icon":"_1LId0","collapsed-content-base":"_1pNG9 _1MFti","container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"}; | ||
var styles = {"container-base":"_GzYRV","punctuation-base":"_3eOF8","pointer":"_1MFti","expander-base":"_f10Tu _1MFti","expand-icon":"_1UmXx","collapse-icon":"_1LId0","collapsed-content-base":"_1pNG9 _1MFti","container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","child-fields-container":"_1BXBN","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"}; | ||
@@ -309,2 +307,3 @@ const defaultStyles = { | ||
basicChildStyle: styles['basic-element-style'], | ||
childFieldsContainer: styles['child-fields-container'], | ||
label: styles['label-light'], | ||
@@ -328,2 +327,3 @@ clickableLabel: styles['clickable-label-light'], | ||
basicChildStyle: styles['basic-element-style'], | ||
childFieldsContainer: styles['child-fields-container'], | ||
label: styles['label-dark'], | ||
@@ -363,3 +363,6 @@ clickableLabel: styles['clickable-label-dark'], | ||
value: data, | ||
style: style, | ||
style: { | ||
...defaultStyles, | ||
...style | ||
}, | ||
lastElement: true, | ||
@@ -366,0 +369,0 @@ level: 0, |
@@ -35,6 +35,3 @@ import { useState, createElement, useRef, useEffect, useId } from 'react'; | ||
} | ||
if (!value || quoted) { | ||
return `"${value}"`; | ||
} | ||
return value; | ||
return !value || quoted ? `"${value}"` : value; | ||
} | ||
@@ -134,3 +131,4 @@ function ExpandableObject(_ref) { | ||
id: contentsId, | ||
role: 'group' | ||
role: 'group', | ||
className: style.childFieldsContainer | ||
}, data.map((dataElement, index) => (/*#__PURE__*/createElement(DataRender, { | ||
@@ -303,3 +301,3 @@ key: dataElement[0] || index, | ||
var styles = {"container-base":"_GzYRV","punctuation-base":"_3eOF8","pointer":"_1MFti","expander-base":"_f10Tu _1MFti","expand-icon":"_1UmXx","collapse-icon":"_1LId0","collapsed-content-base":"_1pNG9 _1MFti","container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"}; | ||
var styles = {"container-base":"_GzYRV","punctuation-base":"_3eOF8","pointer":"_1MFti","expander-base":"_f10Tu _1MFti","expand-icon":"_1UmXx","collapse-icon":"_1LId0","collapsed-content-base":"_1pNG9 _1MFti","container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","child-fields-container":"_1BXBN","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"}; | ||
@@ -309,2 +307,3 @@ const defaultStyles = { | ||
basicChildStyle: styles['basic-element-style'], | ||
childFieldsContainer: styles['child-fields-container'], | ||
label: styles['label-light'], | ||
@@ -328,2 +327,3 @@ clickableLabel: styles['clickable-label-light'], | ||
basicChildStyle: styles['basic-element-style'], | ||
childFieldsContainer: styles['child-fields-container'], | ||
label: styles['label-dark'], | ||
@@ -363,3 +363,6 @@ clickableLabel: styles['clickable-label-dark'], | ||
value: data, | ||
style: style, | ||
style: { | ||
...defaultStyles, | ||
...style | ||
}, | ||
lastElement: true, | ||
@@ -366,0 +369,0 @@ level: 0, |
{ | ||
"name": "react-json-view-lite", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "JSON viewer component for React focused on performance for large volume input while still providing few customiziation features", | ||
@@ -43,10 +43,12 @@ "homepage": "https://github.com/AnyRoad/react-json-view-lite", | ||
"@babel/preset-typescript": "^7.24.7", | ||
"@chromatic-com/storybook": "^1.9.0", | ||
"@storybook/addon-essentials": "^8.3.3", | ||
"@storybook/addon-interactions": "^8.3.3", | ||
"@storybook/addon-links": "^8.3.3", | ||
"@storybook/blocks": "^8.3.3", | ||
"@storybook/react": "^8.3.3", | ||
"@storybook/react-vite": "^8.3.3", | ||
"@storybook/test": "^8.3.3", | ||
"@chromatic-com/storybook": "^3.2.3", | ||
"@storybook/addon-essentials": "^8.4.7", | ||
"@storybook/addon-interactions": "^8.4.7", | ||
"@storybook/addon-links": "^8.4.7", | ||
"@storybook/blocks": "^8.4.7", | ||
"@storybook/manager-api": "^8.4.7", | ||
"@storybook/react": "^8.4.7", | ||
"@storybook/react-vite": "^8.4.7", | ||
"@storybook/test": "^8.4.7", | ||
"@storybook/theming": "^8.4.7", | ||
"@testing-library/jest-dom": "^6.5.0", | ||
@@ -75,3 +77,3 @@ "@testing-library/react": "^16.0.1", | ||
"eslint-plugin-standard": "5.0.0", | ||
"eslint-plugin-storybook": "^0.8.0", | ||
"eslint-plugin-storybook": "^0.11.2", | ||
"gh-pages": "6.1.1", | ||
@@ -88,5 +90,5 @@ "identity-obj-proxy": "^3.0.0", | ||
"rollup-jest": "^3.1.0", | ||
"storybook": "^8.3.3", | ||
"storybook": "^8.4.7", | ||
"ts-jest": "29.1.2", | ||
"typescript": "5.5.4" | ||
"typescript": "5.6.3" | ||
}, | ||
@@ -93,0 +95,0 @@ "files": [ |
@@ -118,2 +118,3 @@ <div align="center"> | ||
| container | string | CSS class name for rendering parent block | | ||
| childFieldsContainer | string | CSS class name for rendering parent block of array or object | | ||
| basicChildStyle | string | CSS class name for property block containing property name and value | | ||
@@ -120,0 +121,0 @@ | collapseIcon | string | CSS class name for rendering button collapsing Object and Array nodes. Default content is `▾`. | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
103702
956
169
49