@edvisor/product-language 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -9529,7 +9529,7 @@ const getNode = (nodes, value) => {
9529
9529
  };
9530
9530
 
9531
9531
  const nodeHasChildren = node => {
9532
- return isDefined(node.children) && Array.isArray(node.children);
9532
+ return isDefined(node.children) && Array.isArray(node.children) && !isEmpty(node.children);
9533
9533
  };
9534
9534
 
9535
9535
  const getDisabledState = (node, parent) => {
@@ -9654,7 +9654,9 @@ const ParentNode = /*#__PURE__*/styled.ol.withConfig({
9654
9654
  const Container$1 = /*#__PURE__*/styled.div.withConfig({
9655
9655
  displayName: "tree-view__Container",
9656
9656
  componentId: "sc-4bkb59-1"
9657
- })(["display:block;margin:", ";padding:", ";"], Margin.none, Padding.none);
9657
+ })(["display:block;margin:", ";padding:", ";"], Margin.none, ({
9658
+ useCardContainer
9659
+ }) => useCardContainer ? Padding.none : Padding.xs);
9658
9660
  const TreeView = props => {
9659
9661
  const {
9660
9662
  checkedList = [],
@@ -9662,7 +9664,8 @@ const TreeView = props => {
9662
9664
  title,
9663
9665
  nodes,
9664
9666
  className,
9665
- showChildCount = false
9667
+ showChildCount = false,
9668
+ useCardContainer = true
9666
9669
  } = props;
9667
9670
  const [expandedList, setExpandedList] = useState(expanded);
9668
9671
  const treeId = new Date().getTime().toString();
@@ -9760,18 +9763,29 @@ const TreeView = props => {
9760
9763
  }));
9761
9764
  };
9762
9765
 
9763
- return maybeRender(!isEmpty(nodes), jsx(Card, Object.assign({
9764
- heading: title
9765
- }, {
9766
- children: jsx(Card.Section, {
9767
- children: jsx(Container$1, Object.assign({
9768
- className: className,
9769
- id: treeId
9770
- }, {
9771
- children: renderTreeNodes(nodes)
9772
- }))
9773
- })
9774
- })));
9766
+ const renderTree = () => {
9767
+ return useCardContainer ? jsx(Card, Object.assign({
9768
+ heading: title
9769
+ }, {
9770
+ children: jsx(Card.Section, {
9771
+ children: jsx(Container$1, Object.assign({
9772
+ className: className,
9773
+ id: treeId,
9774
+ useCardContainer: true
9775
+ }, {
9776
+ children: renderTreeNodes(nodes)
9777
+ }))
9778
+ })
9779
+ })) : jsx(Container$1, Object.assign({
9780
+ className: className,
9781
+ id: treeId,
9782
+ useCardContainer: false
9783
+ }, {
9784
+ children: renderTreeNodes(nodes)
9785
+ }));
9786
+ };
9787
+
9788
+ return maybeRender(!isEmpty(nodes), renderTree());
9775
9789
  };
9776
9790
 
9777
9791
  // this file was generated, but it is safe to modify
@@ -9908,7 +9922,8 @@ const Wrapper = /*#__PURE__*/styled.label.withConfig({
9908
9922
  })(["display:flex;width:100%;align-items:center;"]);
9909
9923
  const InputCheckbox = props => {
9910
9924
  const {
9911
- label = ''
9925
+ label = '',
9926
+ onChange
9912
9927
  } = props;
9913
9928
 
9914
9929
  if (isEmpty(label)) {
@@ -9917,7 +9932,12 @@ const InputCheckbox = props => {
9917
9932
 
9918
9933
  return jsxs(Wrapper, {
9919
9934
  children: [jsx(Checkbox, Object.assign({}, props, {
9920
- name: isDefined(props.name) ? props.name : label
9935
+ name: isDefined(props.name) ? props.name : label,
9936
+ onChange: e => {
9937
+ if (isDefined(onChange)) {
9938
+ onChange(e.target.checked);
9939
+ }
9940
+ }
9921
9941
  })), jsx(Text, {
9922
9942
  children: label
9923
9943
  })]
@@ -3,5 +3,6 @@ import { FC } from '@helpers';
3
3
  export declare type IInputCheckboxProps = InputHTMLAttributes<HTMLInputElement> & {
4
4
  label: string;
5
5
  error?: boolean;
6
+ onChange?: (change: boolean) => void;
6
7
  };
7
8
  export declare const InputCheckbox: FC<IInputCheckboxProps>;
@@ -24,6 +24,7 @@ export interface ITreeViewProps {
24
24
  expanded?: string[];
25
25
  className?: string;
26
26
  title?: string;
27
+ useCardContainer?: boolean;
27
28
  showChildCount?: boolean;
28
29
  expandDisabled?: boolean;
29
30
  onCheck: (checked: string[], node?: ICheckNode) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edvisor/product-language",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "license": "MIT",
5
5
  "description": "Edvisor.io product-language components",
6
6
  "repository": "https://github.com/edvisor-io/front-end/",