@hitachivantara/uikit-react-core 5.36.10 → 5.37.0

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.
Files changed (75) hide show
  1. package/dist/cjs/components/CheckBoxGroup/CheckBoxGroup.cjs +3 -1
  2. package/dist/cjs/components/CheckBoxGroup/CheckBoxGroup.cjs.map +1 -1
  3. package/dist/cjs/components/Dropdown/Dropdown.cjs +4 -1
  4. package/dist/cjs/components/Dropdown/Dropdown.cjs.map +1 -1
  5. package/dist/cjs/components/QueryBuilder/ConfirmationDialog/ConfirmationDialog.cjs.map +1 -1
  6. package/dist/cjs/components/QueryBuilder/Context.cjs +15 -2
  7. package/dist/cjs/components/QueryBuilder/Context.cjs.map +1 -1
  8. package/dist/cjs/components/QueryBuilder/QueryBuilder.cjs +35 -25
  9. package/dist/cjs/components/QueryBuilder/QueryBuilder.cjs.map +1 -1
  10. package/dist/cjs/components/QueryBuilder/QueryBuilder.styles.cjs +10 -0
  11. package/dist/cjs/components/QueryBuilder/QueryBuilder.styles.cjs.map +1 -1
  12. package/dist/cjs/components/QueryBuilder/Rule/Attribute/Attribute.cjs +2 -3
  13. package/dist/cjs/components/QueryBuilder/Rule/Attribute/Attribute.cjs.map +1 -1
  14. package/dist/cjs/components/QueryBuilder/Rule/Operator/Operator.cjs +2 -3
  15. package/dist/cjs/components/QueryBuilder/Rule/Operator/Operator.cjs.map +1 -1
  16. package/dist/cjs/components/QueryBuilder/Rule/Rule.cjs +16 -14
  17. package/dist/cjs/components/QueryBuilder/Rule/Rule.cjs.map +1 -1
  18. package/dist/cjs/components/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.cjs +1 -2
  19. package/dist/cjs/components/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.cjs.map +1 -1
  20. package/dist/cjs/components/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.cjs +1 -2
  21. package/dist/cjs/components/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.cjs.map +1 -1
  22. package/dist/cjs/components/QueryBuilder/Rule/Value/DateTimeValue/utils.cjs.map +1 -1
  23. package/dist/cjs/components/QueryBuilder/Rule/Value/NumericValue/NumericValue.cjs +4 -5
  24. package/dist/cjs/components/QueryBuilder/Rule/Value/NumericValue/NumericValue.cjs.map +1 -1
  25. package/dist/cjs/components/QueryBuilder/Rule/Value/TextValue/TextValue.cjs +1 -2
  26. package/dist/cjs/components/QueryBuilder/Rule/Value/TextValue/TextValue.cjs.map +1 -1
  27. package/dist/cjs/components/QueryBuilder/Rule/Value/Value.cjs +8 -3
  28. package/dist/cjs/components/QueryBuilder/Rule/Value/Value.cjs.map +1 -1
  29. package/dist/cjs/components/QueryBuilder/RuleGroup/RuleGroup.cjs +19 -24
  30. package/dist/cjs/components/QueryBuilder/RuleGroup/RuleGroup.cjs.map +1 -1
  31. package/dist/cjs/components/QueryBuilder/utils/index.cjs.map +1 -1
  32. package/dist/cjs/components/QueryBuilder/utils/reducer.cjs +1 -1
  33. package/dist/cjs/components/QueryBuilder/utils/reducer.cjs.map +1 -1
  34. package/dist/cjs/index.cjs +1 -0
  35. package/dist/cjs/index.cjs.map +1 -1
  36. package/dist/cjs/providers/Provider.cjs +11 -3
  37. package/dist/cjs/providers/Provider.cjs.map +1 -1
  38. package/dist/esm/components/CheckBoxGroup/CheckBoxGroup.js +3 -1
  39. package/dist/esm/components/CheckBoxGroup/CheckBoxGroup.js.map +1 -1
  40. package/dist/esm/components/Dropdown/Dropdown.js +5 -2
  41. package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
  42. package/dist/esm/components/QueryBuilder/ConfirmationDialog/ConfirmationDialog.js.map +1 -1
  43. package/dist/esm/components/QueryBuilder/Context.js +17 -4
  44. package/dist/esm/components/QueryBuilder/Context.js.map +1 -1
  45. package/dist/esm/components/QueryBuilder/QueryBuilder.js +37 -27
  46. package/dist/esm/components/QueryBuilder/QueryBuilder.js.map +1 -1
  47. package/dist/esm/components/QueryBuilder/QueryBuilder.styles.js +10 -0
  48. package/dist/esm/components/QueryBuilder/QueryBuilder.styles.js.map +1 -1
  49. package/dist/esm/components/QueryBuilder/Rule/Attribute/Attribute.js +3 -4
  50. package/dist/esm/components/QueryBuilder/Rule/Attribute/Attribute.js.map +1 -1
  51. package/dist/esm/components/QueryBuilder/Rule/Operator/Operator.js +4 -5
  52. package/dist/esm/components/QueryBuilder/Rule/Operator/Operator.js.map +1 -1
  53. package/dist/esm/components/QueryBuilder/Rule/Rule.js +18 -16
  54. package/dist/esm/components/QueryBuilder/Rule/Rule.js.map +1 -1
  55. package/dist/esm/components/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.js +3 -4
  56. package/dist/esm/components/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.js.map +1 -1
  57. package/dist/esm/components/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.js +3 -4
  58. package/dist/esm/components/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.js.map +1 -1
  59. package/dist/esm/components/QueryBuilder/Rule/Value/DateTimeValue/utils.js.map +1 -1
  60. package/dist/esm/components/QueryBuilder/Rule/Value/NumericValue/NumericValue.js +6 -7
  61. package/dist/esm/components/QueryBuilder/Rule/Value/NumericValue/NumericValue.js.map +1 -1
  62. package/dist/esm/components/QueryBuilder/Rule/Value/TextValue/TextValue.js +3 -4
  63. package/dist/esm/components/QueryBuilder/Rule/Value/TextValue/TextValue.js.map +1 -1
  64. package/dist/esm/components/QueryBuilder/Rule/Value/Value.js +10 -5
  65. package/dist/esm/components/QueryBuilder/Rule/Value/Value.js.map +1 -1
  66. package/dist/esm/components/QueryBuilder/RuleGroup/RuleGroup.js +21 -26
  67. package/dist/esm/components/QueryBuilder/RuleGroup/RuleGroup.js.map +1 -1
  68. package/dist/esm/components/QueryBuilder/utils/index.js.map +1 -1
  69. package/dist/esm/components/QueryBuilder/utils/reducer.js +1 -1
  70. package/dist/esm/components/QueryBuilder/utils/reducer.js.map +1 -1
  71. package/dist/esm/index.js +2 -1
  72. package/dist/esm/providers/Provider.js +11 -3
  73. package/dist/esm/providers/Provider.js.map +1 -1
  74. package/dist/types/index.d.ts +93 -37
  75. package/package.json +5 -5
@@ -23,15 +23,15 @@ const RuleGroup = ({
23
23
  classes,
24
24
  cx
25
25
  } = QueryBuilder_styles.useClasses(classesProp);
26
- const context = React.useContext(Context.QueryBuilderContext);
27
26
  const {
28
27
  dispatchAction,
29
28
  askAction,
30
29
  maxDepth,
31
30
  combinators,
32
31
  labels,
33
- readOnly
34
- } = context;
32
+ readOnly,
33
+ disableConfirmation
34
+ } = Context.useQueryBuilderContext();
35
35
  const normalizedMaxDepth = maxDepth - 1;
36
36
  const actionButtons = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
37
37
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.buttonBackground, children: /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { variant: "secondarySubtle", onClick: () => {
@@ -63,22 +63,23 @@ const RuleGroup = ({
63
63
  }), children: [
64
64
  /* @__PURE__ */ jsxRuntime.jsxs(Grid.HvGrid, { container: true, children: [
65
65
  /* @__PURE__ */ jsxRuntime.jsx(Grid.HvGrid, { item: true, children: /* @__PURE__ */ jsxRuntime.jsx(MultiButton.HvMultiButton, { className: cx(classes.combinator, classes.topCombinator), disabled: readOnly, children: combinators && combinators.map((item) => /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { className: classes.combinatorButton, selected: item.operand === combinator, onClick: () => item.operand && onClickCombinator(item), disabled: readOnly, size: "xs", children: item.label }, item.operand)) }) }),
66
- /* @__PURE__ */ jsxRuntime.jsx(Grid.HvGrid, { item: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx(classes.buttonBackground, classes.topRemoveButton), children: /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { icon: true, className: classes.removeButton, onClick: () => {
67
- askAction({
68
- actions: [{
69
- type: "remove-node",
70
- id
71
- }],
72
- dialog: level === 0 && labels.query?.delete != null ? labels.query.delete : labels.group.delete
73
- });
74
- }, "aria-label": level === 0 && labels.query?.delete?.ariaLabel ? labels.query?.delete?.ariaLabel : labels.group.delete.ariaLabel, disabled: readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(DeleteIcon, {}) }) }) })
66
+ /* @__PURE__ */ jsxRuntime.jsx(Grid.HvGrid, { item: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx(classes.buttonBackground, classes.topRemoveButton), children: /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { icon: true, className: classes.removeButton, onClick: () => disableConfirmation ? dispatchAction({
67
+ type: "remove-node",
68
+ id
69
+ }) : askAction({
70
+ actions: [{
71
+ type: "remove-node",
72
+ id
73
+ }],
74
+ dialog: level === 0 && labels.query?.delete != null ? labels.query.delete : labels.group.delete
75
+ }), "aria-label": level === 0 && labels.query?.delete?.ariaLabel ? labels.query?.delete?.ariaLabel : labels.group.delete.ariaLabel, disabled: readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(DeleteIcon, {}) }) }) })
75
76
  ] }),
76
77
  rules?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx(classes.rulesContainer, {
77
78
  [classes.subRulesContainer]: level > 0,
78
79
  [classes.topRulesContainer]: level === 0
79
80
  }), children: rules.map((rule, index) => {
80
81
  if ("combinator" in rule) {
81
- return /* @__PURE__ */ jsxRuntime.jsx(RuleGroup, { level: level + 1, ...rule, id: rule.id, classes }, rule.id ?? index);
82
+ return /* @__PURE__ */ jsxRuntime.jsx(RuleGroup, { level: level + 1, ...rule, id: rule.id, classes }, rule.id);
82
83
  }
83
84
  const isInvalid = combinator === "and" && rules.some((r, i) => {
84
85
  if ("attribute" in r) {
@@ -88,29 +89,23 @@ const RuleGroup = ({
88
89
  }
89
90
  return false;
90
91
  });
91
- return /* @__PURE__ */ jsxRuntime.jsx(Rule.Rule, { ...rule, isInvalid, id: rule.id, combinator }, rule.id ?? index);
92
+ return /* @__PURE__ */ jsxRuntime.jsx(Rule.Rule, { ...rule, isInvalid, id: rule.id, combinator }, rule.id);
92
93
  }) }),
93
94
  rules?.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState.HvEmptyState, { title: labels.empty?.title, message: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
94
- /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { variant: "link", component: "a", onClick: () => {
95
+ /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { link: true, component: "button", onClick: () => {
95
96
  dispatchAction({
96
97
  type: "add-rule",
97
98
  id
98
99
  });
99
- }, style: {
100
- cursor: "pointer",
101
- textDecoration: "underline"
102
- }, children: `${labels.empty?.createCondition}` }),
100
+ }, className: classes.createConditionButton, children: `${labels.empty?.createCondition}` }),
103
101
  level <= normalizedMaxDepth && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
104
102
  `${labels.empty?.spacer}`,
105
- /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { variant: "link", component: "a", onClick: () => {
103
+ /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { link: true, component: "button", onClick: () => {
106
104
  dispatchAction({
107
105
  type: "add-group",
108
106
  id
109
107
  });
110
- }, style: {
111
- cursor: "pointer",
112
- textDecoration: "underline"
113
- }, children: `${labels.empty?.createGroup}` })
108
+ }, className: classes.createGroupButton, children: `${labels.empty?.createGroup}` })
114
109
  ] })
115
110
  ] }), icon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Info, {}) }),
116
111
  /* @__PURE__ */ jsxRuntime.jsx(Grid.HvGrid, { container: true, children: /* @__PURE__ */ jsxRuntime.jsx(Grid.HvGrid, { item: true, className: cx(classes.actionButtonContainer, classes.topActionButtonContainer), children: actionButtons }) })
@@ -1 +1 @@
1
- {"version":3,"file":"RuleGroup.cjs","sources":["../../../../../src/components/QueryBuilder/RuleGroup/RuleGroup.tsx"],"sourcesContent":["import { useCallback, useContext } from \"react\";\n\nimport { Add, Delete, Info } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvButton } from \"@core/components/Button\";\nimport { HvEmptyState } from \"@core/components/EmptyState\";\nimport { HvGrid } from \"@core/components/Grid\";\nimport { HvMultiButton } from \"@core/components/MultiButton\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { withTooltip } from \"@core/hocs/withTooltip\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { Rule } from \"../Rule\";\nimport { QueryBuilderContext } from \"../Context\";\nimport { useClasses } from \"../QueryBuilder.styles\";\n\nexport interface RuleGroupProps {\n /**\n * Override or extend the styles applied to the component.\n * See CSS API tab for more details.\n */\n classes?: ExtractNames<typeof useClasses>;\n id?: number;\n level?: number;\n combinator?: string;\n rules?: any[];\n}\n\nexport const RuleGroup = ({\n level = 0,\n id,\n combinator = \"and\",\n rules = [],\n classes: classesProp,\n}: RuleGroupProps) => {\n const { classes, cx } = useClasses(classesProp);\n\n const context = useContext(QueryBuilderContext);\n\n const { dispatchAction, askAction, maxDepth, combinators, labels, readOnly } =\n context;\n const normalizedMaxDepth = maxDepth - 1;\n\n const actionButtons = (\n <>\n <div className={classes.buttonBackground}>\n <HvButton\n variant=\"secondarySubtle\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n disabled={readOnly}\n startIcon={<Add />}\n >\n {level === 0 && labels.query?.addRule?.label != null\n ? labels.query?.addRule?.label\n : labels.group.addRule.label}\n </HvButton>\n </div>\n {level <= normalizedMaxDepth && (\n <div className={classes.buttonBackground}>\n <HvButton\n variant=\"secondarySubtle\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n disabled={readOnly}\n startIcon={<Add />}\n >\n {level === 0 && labels.query?.addGroup?.label != null\n ? labels.query?.addGroup?.label\n : labels.group.addGroup.label}\n </HvButton>\n </div>\n )}\n </>\n );\n\n const DeleteIcon = withTooltip(\n () => (\n <Delete className={cx({ [classes.topRemoveButtonDisabled]: readOnly })} />\n ),\n level === 0 && labels.query?.delete?.tooltip\n ? labels.query?.delete?.tooltip\n : labels.group.delete.tooltip,\n \"top\"\n );\n\n const onClickCombinator = useCallback(\n (item) => {\n dispatchAction({\n type: \"set-combinator\",\n id,\n combinator: item.operand,\n });\n },\n [dispatchAction, id]\n );\n\n return (\n <div\n className={cx(classes.root, {\n [classes.topGroup]: level === 0,\n [classes.subGroup]: level > 0,\n })}\n >\n <HvGrid container>\n <HvGrid item>\n <HvMultiButton\n className={cx(classes.combinator, classes.topCombinator)}\n disabled={readOnly}\n >\n {combinators &&\n combinators.map((item) => (\n <HvButton\n key={item.operand}\n className={classes.combinatorButton}\n selected={item.operand === combinator}\n onClick={() => item.operand && onClickCombinator(item)}\n disabled={readOnly}\n size=\"xs\"\n >\n {item.label}\n </HvButton>\n ))}\n </HvMultiButton>\n </HvGrid>\n <HvGrid item>\n <div\n className={cx(classes.buttonBackground, classes.topRemoveButton)}\n >\n <HvButton\n icon\n className={classes.removeButton}\n onClick={() => {\n askAction({\n actions: [{ type: \"remove-node\", id }],\n dialog:\n level === 0 && labels.query?.delete != null\n ? labels.query.delete\n : labels.group.delete,\n });\n }}\n aria-label={\n level === 0 && labels.query?.delete?.ariaLabel\n ? labels.query?.delete?.ariaLabel\n : labels.group.delete.ariaLabel\n }\n disabled={readOnly}\n >\n <DeleteIcon />\n </HvButton>\n </div>\n </HvGrid>\n </HvGrid>\n {rules?.length > 0 && (\n <div\n className={cx(classes.rulesContainer, {\n [classes.subRulesContainer]: level > 0,\n [classes.topRulesContainer]: level === 0,\n })}\n >\n {rules.map((rule, index) => {\n if (\"combinator\" in rule) {\n return (\n <RuleGroup\n key={rule.id ?? index}\n level={level + 1}\n {...rule}\n id={rule.id}\n classes={classes}\n />\n );\n }\n\n const isInvalid =\n combinator === \"and\" &&\n rules.some((r, i) => {\n if (\"attribute\" in r) {\n if (\n r.attribute === rule.attribute &&\n r.id !== rule.id &&\n i < index\n ) {\n return true;\n }\n }\n return false;\n });\n\n return (\n <Rule\n key={rule.id ?? index}\n {...rule}\n isInvalid={isInvalid}\n id={rule.id}\n combinator={combinator}\n />\n );\n })}\n </div>\n )}\n {rules?.length === 0 && (\n <HvEmptyState\n title={labels.empty?.title}\n message={\n <>\n <HvTypography\n variant=\"link\"\n component=\"a\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n style={{ cursor: \"pointer\", textDecoration: \"underline\" }}\n >\n {`${labels.empty?.createCondition}`}\n </HvTypography>\n {level <= normalizedMaxDepth && (\n <>\n {`${labels.empty?.spacer}`}\n <HvTypography\n variant=\"link\"\n component=\"a\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n style={{\n cursor: \"pointer\",\n textDecoration: \"underline\",\n }}\n >\n {`${labels.empty?.createGroup}`}\n </HvTypography>\n </>\n )}\n </>\n }\n icon={<Info />}\n />\n )}\n <HvGrid container>\n <HvGrid\n item\n className={cx(\n classes.actionButtonContainer,\n classes.topActionButtonContainer\n )}\n >\n {actionButtons}\n </HvGrid>\n </HvGrid>\n </div>\n );\n};\n"],"names":["RuleGroup","level","id","combinator","rules","classes","classesProp","cx","useClasses","context","useContext","QueryBuilderContext","dispatchAction","askAction","maxDepth","combinators","labels","readOnly","normalizedMaxDepth","actionButtons","jsxs","Fragment","jsx","buttonBackground","HvButton","type","Add","query","addRule","label","group","addGroup","DeleteIcon","withTooltip","Delete","topRemoveButtonDisabled","delete","tooltip","onClickCombinator","useCallback","item","operand","root","topGroup","subGroup","HvGrid","HvMultiButton","topCombinator","map","combinatorButton","topRemoveButton","removeButton","actions","dialog","ariaLabel","length","rulesContainer","subRulesContainer","topRulesContainer","rule","index","isInvalid","some","r","i","attribute","Rule","HvEmptyState","empty","title","HvTypography","cursor","textDecoration","createCondition","spacer","createGroup","Info","actionButtonContainer","topActionButtonContainer"],"mappings":";;;;;;;;;;;;;;AA4BO,MAAMA,YAAYA,CAAC;AAAA,EACxBC,QAAQ;AAAA,EACRC;AAAAA,EACAC,aAAa;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AAKzD,MAAM0D,KAKhB;AAAA,IAEL,CAAA,GACH;AAAA,IAEDxD,OAAOmD,WAAW,KAChBjC,2BAAAA,IAAA6C,WAAAA,cAAA,EACC,OAAOnD,OAAOoD,OAAOC,OACrB,SAEIjD,2BAAA,KAAAC,WAAA,UAAA,EAAA,UAAA;AAAA,MAAAC,2BAAA,IAACgD,2BACC,SAAQ,QACR,WAAU,KACV,SAAS,MAAM;AACE,uBAAA;AAAA,UAAE7C,MAAM;AAAA,UAAYvB;AAAAA,QAAAA,CAAI;AAAA,SAEzC,OAAO;AAAA,QAAEqE,QAAQ;AAAA,QAAWC,gBAAgB;AAAA,MAAA,GAE1C,UAAA,GAAExD,OAAOoD,OAAOK,eAAgB,IACpC;AAAA,MACCxE,SAASiB,sBAEJE,2BAAAA,KAAAC,WAAA,UAAA,EAAA,UAAA;AAAA,QAAEL,GAAAA,OAAOoD,OAAOM,MAAO;AAAA,uCACxBJ,WACC,cAAA,EAAA,SAAQ,QACR,WAAU,KACV,SAAS,MAAM;AACE,yBAAA;AAAA,YAAE7C,MAAM;AAAA,YAAavB;AAAAA,UAAAA,CAAI;AAAA,WAE1C,OAAO;AAAA,UACLqE,QAAQ;AAAA,UACRC,gBAAgB;AAAA,QAAA,GAGhB,UAAA,GAAExD,OAAOoD,OAAOO,WAAY,IAChC;AAAA,MAAA,GACF;AAAA,IAAA,EAEJ,CAAA,GAEF,MAAOrD,2BAAAA,IAAAsD,gBAAAA,MAAA,CAAA,CAAO,EAEjB,CAAA;AAAA,mCACA/B,KAAAA,QAAO,EAAA,WAAS,MACf,UAAAvB,2BAAA,IAACuB,eACC,MAAI,MACJ,WAAWtC,GACTF,QAAQwE,uBACRxE,QAAQyE,wBACV,GAEC3D,wBACH,CAAA,GACF;AAAA,EACF,EAAA,CAAA;AAEJ;;"}
1
+ {"version":3,"file":"RuleGroup.cjs","sources":["../../../../../src/components/QueryBuilder/RuleGroup/RuleGroup.tsx"],"sourcesContent":["import { useCallback } from \"react\";\nimport { Add, Delete, Info } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvButton } from \"@core/components/Button\";\nimport { HvEmptyState } from \"@core/components/EmptyState\";\nimport { HvGrid } from \"@core/components/Grid\";\nimport { HvMultiButton } from \"@core/components/MultiButton\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { withTooltip } from \"@core/hocs/withTooltip\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { Rule } from \"../Rule\";\nimport { useQueryBuilderContext } from \"../Context\";\nimport { useClasses } from \"../QueryBuilder.styles\";\nimport { HvQueryBuilderQuery, HvQueryBuilderQueryCombinator } from \"../types\";\n\nexport interface RuleGroupProps {\n id: React.Key;\n level?: number;\n combinator?: string;\n rules?: HvQueryBuilderQuery[\"rules\"];\n classes?: ExtractNames<typeof useClasses>;\n}\n\nexport const RuleGroup = ({\n level = 0,\n id,\n combinator = \"and\",\n rules = [],\n classes: classesProp,\n}: RuleGroupProps) => {\n const { classes, cx } = useClasses(classesProp);\n\n const {\n dispatchAction,\n askAction,\n maxDepth,\n combinators,\n labels,\n readOnly,\n disableConfirmation,\n } = useQueryBuilderContext();\n\n const normalizedMaxDepth = maxDepth - 1;\n\n const actionButtons = (\n <>\n <div className={classes.buttonBackground}>\n <HvButton\n variant=\"secondarySubtle\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n disabled={readOnly}\n startIcon={<Add />}\n >\n {level === 0 && labels.query?.addRule?.label != null\n ? labels.query?.addRule?.label\n : labels.group.addRule.label}\n </HvButton>\n </div>\n {level <= normalizedMaxDepth && (\n <div className={classes.buttonBackground}>\n <HvButton\n variant=\"secondarySubtle\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n disabled={readOnly}\n startIcon={<Add />}\n >\n {level === 0 && labels.query?.addGroup?.label != null\n ? labels.query?.addGroup?.label\n : labels.group.addGroup.label}\n </HvButton>\n </div>\n )}\n </>\n );\n\n const DeleteIcon = withTooltip(\n () => (\n <Delete className={cx({ [classes.topRemoveButtonDisabled]: readOnly })} />\n ),\n level === 0 && labels.query?.delete?.tooltip\n ? labels.query?.delete?.tooltip\n : labels.group.delete.tooltip,\n \"top\"\n );\n\n const onClickCombinator = useCallback(\n (item: HvQueryBuilderQueryCombinator) => {\n dispatchAction({\n type: \"set-combinator\",\n id,\n combinator: item.operand,\n });\n },\n [dispatchAction, id]\n );\n\n return (\n <div\n className={cx(classes.root, {\n [classes.topGroup]: level === 0,\n [classes.subGroup]: level > 0,\n })}\n >\n <HvGrid container>\n <HvGrid item>\n <HvMultiButton\n className={cx(classes.combinator, classes.topCombinator)}\n disabled={readOnly}\n >\n {combinators &&\n combinators.map((item) => (\n <HvButton\n key={item.operand}\n className={classes.combinatorButton}\n selected={item.operand === combinator}\n onClick={() => item.operand && onClickCombinator(item)}\n disabled={readOnly}\n size=\"xs\"\n >\n {item.label}\n </HvButton>\n ))}\n </HvMultiButton>\n </HvGrid>\n <HvGrid item>\n <div\n className={cx(classes.buttonBackground, classes.topRemoveButton)}\n >\n <HvButton\n icon\n className={classes.removeButton}\n onClick={() =>\n disableConfirmation\n ? dispatchAction({ type: \"remove-node\", id })\n : askAction({\n actions: [{ type: \"remove-node\", id }],\n dialog:\n level === 0 && labels.query?.delete != null\n ? labels.query.delete\n : labels.group.delete,\n })\n }\n aria-label={\n level === 0 && labels.query?.delete?.ariaLabel\n ? labels.query?.delete?.ariaLabel\n : labels.group.delete.ariaLabel\n }\n disabled={readOnly}\n >\n <DeleteIcon />\n </HvButton>\n </div>\n </HvGrid>\n </HvGrid>\n {rules?.length > 0 && (\n <div\n className={cx(classes.rulesContainer, {\n [classes.subRulesContainer]: level > 0,\n [classes.topRulesContainer]: level === 0,\n })}\n >\n {rules.map((rule, index) => {\n if (\"combinator\" in rule) {\n return (\n <RuleGroup\n key={rule.id}\n level={level + 1}\n {...rule}\n id={rule.id}\n classes={classes}\n />\n );\n }\n\n const isInvalid =\n combinator === \"and\" &&\n rules.some((r, i) => {\n if (\"attribute\" in r) {\n if (\n r.attribute === rule.attribute &&\n r.id !== rule.id &&\n i < index\n ) {\n return true;\n }\n }\n return false;\n });\n\n return (\n <Rule\n key={rule.id}\n {...rule}\n isInvalid={isInvalid}\n id={rule.id}\n combinator={combinator}\n />\n );\n })}\n </div>\n )}\n {rules?.length === 0 && (\n <HvEmptyState\n title={labels.empty?.title}\n message={\n <>\n <HvTypography\n link\n component=\"button\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n className={classes.createConditionButton}\n >\n {`${labels.empty?.createCondition}`}\n </HvTypography>\n {level <= normalizedMaxDepth && (\n <>\n {`${labels.empty?.spacer}`}\n <HvTypography\n link\n component=\"button\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n className={classes.createGroupButton}\n >\n {`${labels.empty?.createGroup}`}\n </HvTypography>\n </>\n )}\n </>\n }\n icon={<Info />}\n />\n )}\n <HvGrid container>\n <HvGrid\n item\n className={cx(\n classes.actionButtonContainer,\n classes.topActionButtonContainer\n )}\n >\n {actionButtons}\n </HvGrid>\n </HvGrid>\n </div>\n );\n};\n"],"names":["RuleGroup","level","id","combinator","rules","classes","classesProp","cx","useClasses","dispatchAction","askAction","maxDepth","combinators","labels","readOnly","disableConfirmation","useQueryBuilderContext","normalizedMaxDepth","actionButtons","jsxs","Fragment","jsx","buttonBackground","HvButton","type","Add","query","addRule","label","group","addGroup","DeleteIcon","withTooltip","Delete","topRemoveButtonDisabled","delete","tooltip","onClickCombinator","useCallback","item","operand","root","topGroup","subGroup","HvGrid","HvMultiButton","topCombinator","map","combinatorButton","topRemoveButton","removeButton","actions","dialog","ariaLabel","length","rulesContainer","subRulesContainer","topRulesContainer","rule","index","isInvalid","some","r","i","attribute","Rule","HvEmptyState","empty","title","HvTypography","createConditionButton","createCondition","spacer","createGroupButton","createGroup","Info","actionButtonContainer","topActionButtonContainer"],"mappings":";;;;;;;;;;;;;;AAwBO,MAAMA,YAAYA,CAAC;AAAA,EACxBC,QAAQ;AAAA,E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AEC,MAAA,EAAA,GAAIP,MACJ,WACA,IAAIA,KAAKxD,IACT,WAJKwD,GAAAA,KAAKxD,EAKV;AAAA,IAEL,CAAA,GACH;AAAA,IAEDE,OAAOkD,WAAW,KAChBjC,2BAAAA,IAAA6C,WAAAA,cAAA,EACC,OAAOrD,OAAOsD,OAAOC,OACrB,SAEIjD,2BAAA,KAAAC,WAAA,UAAA,EAAA,UAAA;AAAA,MAAAC,2BAAA,IAACgD,2BACC,MAAI,MACJ,WAAU,UACV,SAAS,MAAM;AACE,uBAAA;AAAA,UAAE7C,MAAM;AAAA,UAAYtB;AAAAA,QAAAA,CAAI;AAAA,MAAA,GAEzC,WAAWG,QAAQiE,uBAEjB,aAAEzD,OAAOsD,OAAOI,eAAgB,IACpC;AAAA,MACCtE,SAASgB,sBAEJE,2BAAAA,KAAAC,WAAA,UAAA,EAAA,UAAA;AAAA,QAAEP,GAAAA,OAAOsD,OAAOK,MAAO;AAAA,uCACxBH,WACC,cAAA,EAAA,MAAI,MACJ,WAAU,UACV,SAAS,MAAM;AACE,yBAAA;AAAA,YAAE7C,MAAM;AAAA,YAAatB;AAAAA,UAAAA,CAAI;AAAA,QAAA,GAE1C,WAAWG,QAAQoE,mBAEjB,aAAE5D,OAAOsD,OAAOO,WAAY,IAChC;AAAA,MAAA,GACF;AAAA,IAAA,EAEJ,CAAA,GAEF,MAAOrD,2BAAAA,IAAAsD,gBAAAA,MAAA,CAAA,CAAO,EAEjB,CAAA;AAAA,mCACA/B,KAAAA,QAAO,EAAA,WAAS,MACf,UAAAvB,2BAAA,IAACuB,eACC,MAAI,MACJ,WAAWrC,GACTF,QAAQuE,uBACRvE,QAAQwE,wBACV,GAEC3D,wBACH,CAAA,GACF;AAAA,EACF,EAAA,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../../src/components/QueryBuilder/utils/index.tsx"],"sourcesContent":["export const isBigList = (values) => values != null && values?.length > 10;\n\nexport const emptyRule = () => ({\n id: Math.random(),\n});\n\nexport const emptyGroup = (createEmptyRule = false) => ({\n id: Math.random(),\n combinator: \"and\",\n rules: createEmptyRule ? [emptyRule()] : [],\n});\n\nexport const clearNodeIds = (original) => {\n const rule = { ...original };\n\n delete rule.id;\n\n if (\"rules\" in rule) {\n rule.rules = rule.rules.map((r) => clearNodeIds(r));\n }\n\n return rule;\n};\n\nexport const findNodeById = (id, node) => {\n if (node.id === id) {\n return node;\n }\n if (\"rules\" in node) {\n for (let i = 0; i < node.rules.length; ++i) {\n const rule = node.rules[i];\n\n const found = findNodeById(id, rule);\n if (found) {\n return found;\n }\n }\n }\n\n return null;\n};\n\nexport const findParentById = (id, node, parent?) => {\n if (node.id === id) {\n return parent ?? null;\n }\n\n if (\"rules\" in node) {\n const group = node;\n\n for (let i = 0; i < group.rules.length; ++i) {\n const rule = group.rules[i];\n\n const found = findParentById(id, rule, group);\n if (found) {\n return found;\n }\n }\n }\n\n return null;\n};\n"],"names":["isBigList","values","length","emptyRule","id","Math","random","emptyGroup","createEmptyRule","combinator","rules","clearNodeIds","original","rule","map","r","findNodeById","node","i","found","findParentById","parent","group"],"mappings":";;AAAO,MAAMA,YAAaC,CAAAA,WAAWA,UAAU,QAAQA,QAAQC,SAAS;AAEjE,MAAMC,YAAYA,OAAO;AAAA,EAC9BC,IAAIC,KAAKC,OAAO;AAClB;AAEaC,MAAAA,aAAaA,CAACC,kBAAkB,WAAW;AAAA,EACtDJ,IAAIC,KAAKC,OAAO;AAAA,EAChBG,YAAY;AAAA,EACZC,OAAOF,kBAAkB,CAACL,UAAU,CAAC,IAAI,CAAA;AAC3C;AAEO,MAAMQ,eAAgBC,CAAa,aAAA;AACxC,QAAMC,OAAO;AAAA,IAAE,GAAGD;AAAAA,EAAAA;AAElB,SAAOC,KAAKT;AAEZ,MAAI,WAAWS,MAAM;AACnBA,SAAKH,QAAQG,KAAKH,MAAMI,IAAKC,CAAMJ,MAAAA,aAAaI,CAAC,CAAC;AAAA,EACpD;AAEOF,SAAAA;AACT;AAEaG,MAAAA,eAAeA,CAACZ,IAAIa,SAAS;AACpCA,MAAAA,KAAKb,OAAOA,IAAI;AACXa,WAAAA;AAAAA,EACT;AACA,MAAI,WAAWA,MAAM;AACnB,aAASC,IAAI,GAAGA,IAAID,KAAKP,MAAMR,QAAQ,EAAEgB,GAAG;AACpCL,YAAAA,OAAOI,KAAKP,MAAMQ,CAAC;AAEnBC,YAAAA,QAAQH,aAAaZ,IAAIS,IAAI;AACnC,UAAIM,OAAO;AACFA,eAAAA;AAAAA,MACT;AAAA,IACF;AAAA,EACF;AAEO,SAAA;AACT;AAEO,MAAMC,iBAAiBA,CAAChB,IAAIa,MAAMI,WAAY;AAC/CJ,MAAAA,KAAKb,OAAOA,IAAI;AAClB,WAAOiB,UAAU;AAAA,EACnB;AAEA,MAAI,WAAWJ,MAAM;AACnB,UAAMK,QAAQL;AAEd,aAASC,IAAI,GAAGA,IAAII,MAAMZ,MAAMR,QAAQ,EAAEgB,GAAG;AACrCL,YAAAA,OAAOS,MAAMZ,MAAMQ,CAAC;AAE1B,YAAMC,QAAQC,eAAehB,IAAIS,MAAMS,KAAK;AAC5C,UAAIH,OAAO;AACFA,eAAAA;AAAAA,MACT;AAAA,IACF;AAAA,EACF;AAEO,SAAA;AACT;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../src/components/QueryBuilder/utils/index.tsx"],"sourcesContent":["import { HvQueryBuilderQueryGroup, HvQueryBuilderQueryRule } from \"../types\";\n\nexport const isBigList = (values: unknown[]) =>\n values != null && values?.length > 10;\n\nexport const emptyRule = () => ({\n id: Math.random(),\n});\n\nexport const emptyGroup = (createEmptyRule = false) => ({\n id: Math.random(),\n combinator: \"and\",\n rules: createEmptyRule ? [emptyRule()] : [],\n});\n\nexport const clearNodeIds = (\n original: HvQueryBuilderQueryGroup | HvQueryBuilderQueryRule\n) => {\n const rule = { ...original };\n\n // @ts-ignore\n delete rule.id;\n\n if (\"rules\" in rule) {\n rule.rules = rule.rules.map((r) => clearNodeIds(r));\n }\n\n return rule;\n};\n\nexport const findNodeById = (\n id: React.Key,\n node: HvQueryBuilderQueryGroup | HvQueryBuilderQueryRule\n) => {\n if (node.id === id) {\n return node;\n }\n if (\"rules\" in node) {\n for (let i = 0; i < node.rules.length; ++i) {\n const rule = node.rules[i];\n\n const found = findNodeById(id, rule);\n if (found) {\n return found;\n }\n }\n }\n\n return null;\n};\n\nexport const findParentById = (\n id: React.Key,\n node: HvQueryBuilderQueryGroup | HvQueryBuilderQueryRule,\n parent?: HvQueryBuilderQueryGroup\n) => {\n if (node.id === id) {\n return parent ?? null;\n }\n\n if (\"rules\" in node) {\n const group = node;\n\n for (let i = 0; i < group.rules.length; ++i) {\n const rule = group.rules[i];\n\n const found = findParentById(id, rule, group);\n if (found) {\n return found;\n }\n }\n }\n\n return null;\n};\n"],"names":["isBigList","values","length","emptyRule","id","Math","random","emptyGroup","createEmptyRule","combinator","rules","clearNodeIds","original","rule","map","r","findNodeById","node","i","found","findParentById","parent","group"],"mappings":";;AAEO,MAAMA,YAAYA,CAACC,WACxBA,UAAU,QAAQA,QAAQC,SAAS;AAE9B,MAAMC,YAAYA,OAAO;AAAA,EAC9BC,IAAIC,KAAKC,OAAO;AAClB;AAEaC,MAAAA,aAAaA,CAACC,kBAAkB,WAAW;AAAA,EACtDJ,IAAIC,KAAKC,OAAO;AAAA,EAChBG,YAAY;AAAA,EACZC,OAAOF,kBAAkB,CAACL,UAAU,CAAC,IAAI,CAAA;AAC3C;AAEaQ,MAAAA,eAAeA,CAC1BC,aACG;AACH,QAAMC,OAAO;AAAA,IAAE,GAAGD;AAAAA,EAAAA;AAGlB,SAAOC,KAAKT;AAEZ,MAAI,WAAWS,MAAM;AACnBA,SAAKH,QAAQG,KAAKH,MAAMI,IAAKC,CAAMJ,MAAAA,aAAaI,CAAC,CAAC;AAAA,EACpD;AAEOF,SAAAA;AACT;AAEaG,MAAAA,eAAeA,CAC1BZ,IACAa,SACG;AACCA,MAAAA,KAAKb,OAAOA,IAAI;AACXa,WAAAA;AAAAA,EACT;AACA,MAAI,WAAWA,MAAM;AACnB,aAASC,IAAI,GAAGA,IAAID,KAAKP,MAAMR,QAAQ,EAAEgB,GAAG;AACpCL,YAAAA,OAAOI,KAAKP,MAAMQ,CAAC;AAEnBC,YAAAA,QAAQH,aAAaZ,IAAIS,IAAI;AACnC,UAAIM,OAAO;AACFA,eAAAA;AAAAA,MACT;AAAA,IACF;AAAA,EACF;AAEO,SAAA;AACT;AAEO,MAAMC,iBAAiBA,CAC5BhB,IACAa,MACAI,WACG;AACCJ,MAAAA,KAAKb,OAAOA,IAAI;AAClB,WAAOiB,UAAU;AAAA,EACnB;AAEA,MAAI,WAAWJ,MAAM;AACnB,UAAMK,QAAQL;AAEd,aAASC,IAAI,GAAGA,IAAII,MAAMZ,MAAMR,QAAQ,EAAEgB,GAAG;AACrCL,YAAAA,OAAOS,MAAMZ,MAAMQ,CAAC;AAE1B,YAAMC,QAAQC,eAAehB,IAAIS,MAAMS,KAAK;AAC5C,UAAIH,OAAO;AACFA,eAAAA;AAAAA,MACT;AAAA,IACF;AAAA,EACF;AAEO,SAAA;AACT;;;;;;;"}
@@ -86,7 +86,7 @@ const reducer = (state, action) => {
86
86
  break;
87
87
  }
88
88
  }
89
- return state;
89
+ return query;
90
90
  };
91
91
  const reducer$1 = reducer;
92
92
  exports.default = reducer$1;
@@ -1 +1 @@
1
- {"version":3,"file":"reducer.cjs","sources":["../../../../../src/components/QueryBuilder/utils/reducer.tsx"],"sourcesContent":["import { emptyRule, emptyGroup, findNodeById, findParentById } from \"./index\";\n\nconst reducer = (state, action) => {\n const query = { ...state };\n\n switch (action.type) {\n case \"reset-query\": {\n return emptyGroup();\n }\n case \"reset-group\": {\n const group = findNodeById(action.id, query);\n if (group && \"rules\" in group) {\n group.rules = [emptyRule()];\n\n return query;\n }\n break;\n }\n case \"add-rule\": {\n const group = findNodeById(action.id, query);\n if (group && \"rules\" in group) {\n const rule = emptyRule();\n\n group.rules.push(rule);\n\n return query;\n }\n break;\n }\n case \"add-group\": {\n const group = findNodeById(action.id, query);\n if (group && \"rules\" in group) {\n group.rules.push(emptyGroup(true));\n\n return query;\n }\n break;\n }\n case \"remove-node\": {\n const parent = findParentById(action.id, query);\n if (parent) {\n parent.rules = parent.rules.filter((rule) => rule.id !== action.id);\n\n return query;\n }\n\n // reset query if deleting top node\n return emptyGroup();\n }\n case \"set-combinator\": {\n const node = findNodeById(action.id, query);\n if (node && \"combinator\" in node) {\n if (node.combinator !== action.combinator) {\n node.combinator = action.combinator;\n\n return query;\n }\n }\n break;\n }\n case \"set-attribute\": {\n const node = findNodeById(action.id, query);\n if (node && node.attribute !== action.attribute) {\n node.attribute = action.attribute ?? undefined;\n\n // we keep the operator and value unless the operator is explicitly null (or set)\n if (action.operator !== undefined) {\n node.operator = action.operator ?? undefined;\n node.value = action.value ?? undefined;\n }\n\n return query;\n }\n break;\n }\n case \"set-operator\": {\n const node = findNodeById(action.id, query);\n if (node && \"attribute\" in node) {\n if (node.operator !== action.operator) {\n node.operator = action.operator;\n if (action.value !== undefined) {\n node.value = action.value ?? undefined;\n }\n\n return query;\n }\n }\n break;\n }\n case \"set-value\": {\n const node = findNodeById(action.id, query);\n if (node && \"operator\" in node) {\n node.value = action.value ?? undefined;\n\n return query;\n }\n break;\n }\n\n default:\n }\n\n // just return existing state if nothing changed\n return state;\n};\n\nexport default reducer;\n"],"names":["reducer","state","action","query","type","emptyGroup","group","findNodeById","id","rules","emptyRule","rule","push","parent","findParentById","filter","node","combinator","attribute","undefined","operator","value"],"mappings":";;;AAEA,MAAMA,UAAUA,CAACC,OAAOC,WAAW;AACjC,QAAMC,QAAQ;AAAA,IAAE,GAAGF;AAAAA,EAAAA;AAEnB,UAAQC,OAAOE,MAAI;AAAA,IACjB,KAAK,eAAe;AAClB,aAAOC,MAAW,WAAA;AAAA,IACpB;AAAA,IACA,KAAK,eAAe;AAClB,YAAMC,QAAQC,MAAAA,aAAaL,OAAOM,IAAI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A,OAAOkB,aAAaD,QAAW;AAC5BC,eAAAA,WAAWlB,OAAOkB,YAAYD;AAC9BE,eAAAA,QAAQnB,OAAOmB,SAASF;AAAAA,QAC/B;AAEOhB,eAAAA;AAAAA,MACT;AACA;AAAA,IACF;AAAA,IACA,KAAK,gBAAgB;AACnB,YAAMa,OAAOT,MAAAA,aAAaL,OAAOM,IAAIL,KAAK;AACtCa,UAAAA,QAAQ,eAAeA,MAAM;AAC3BA,YAAAA,KAAKI,aAAalB,OAAOkB,UAAU;AACrCJ,eAAKI,WAAWlB,OAAOkB;AACnBlB,cAAAA,OAAOmB,UAAUF,QAAW;AACzBE,iBAAAA,QAAQnB,OAAOmB,SAASF;AAAAA,UAC/B;AAEOhB,iBAAAA;AAAAA,QACT;AAAA,MACF;AACA;AAAA,IACF;AAAA,IACA,KAAK,aAAa;AAChB,YAAMa,OAAOT,MAAAA,aAAaL,OAAOM,IAAIL,KAAK;AACtCa,UAAAA,QAAQ,cAAcA,MAAM;AACzBK,aAAAA,QAAQnB,OAAOmB,SAASF;AAEtBhB,eAAAA;AAAAA,MACT;AACA;AAAA,IACF;AAAA,EAGF;AAGOF,SAAAA;AACT;AAEA,MAAA,YAAeD;;"}
1
+ {"version":3,"file":"reducer.cjs","sources":["../../../../../src/components/QueryBuilder/utils/reducer.tsx"],"sourcesContent":["import { Reducer } from \"react\";\n\nimport { emptyRule, emptyGroup, findNodeById, findParentById } from \"./index\";\nimport { HvQueryBuilderQuery, QueryAction } from \"../types\";\n\nconst reducer: Reducer<HvQueryBuilderQuery, QueryAction> = (state, action) => {\n const query = { ...state };\n\n switch (action.type) {\n case \"reset-query\": {\n return emptyGroup();\n }\n case \"reset-group\": {\n const group = findNodeById(action.id, query);\n if (group && \"rules\" in group) {\n group.rules = [emptyRule()];\n\n return query;\n }\n break;\n }\n case \"add-rule\": {\n const group = findNodeById(action.id, query);\n if (group && \"rules\" in group) {\n const rule = emptyRule();\n\n group.rules.push(rule);\n\n return query;\n }\n break;\n }\n case \"add-group\": {\n const group = findNodeById(action.id, query);\n if (group && \"rules\" in group) {\n group.rules.push(emptyGroup(true));\n\n return query;\n }\n break;\n }\n case \"remove-node\": {\n const parent = findParentById(action.id, query);\n if (parent) {\n parent.rules = parent.rules.filter((rule) => rule.id !== action.id);\n\n return query;\n }\n\n // reset query if deleting top node\n return emptyGroup();\n }\n case \"set-combinator\": {\n const node = findNodeById(action.id, query);\n if (node && \"combinator\" in node) {\n if (node.combinator !== action.combinator) {\n node.combinator = action.combinator;\n\n return query;\n }\n }\n break;\n }\n case \"set-attribute\": {\n const node = findNodeById(action.id, query);\n if (node && node.attribute !== action.attribute) {\n node.attribute = action.attribute ?? undefined;\n\n // we keep the operator and value unless the operator is explicitly null (or set)\n if (action.operator !== undefined) {\n node.operator = action.operator ?? undefined;\n node.value = action.value ?? undefined;\n }\n\n return query;\n }\n break;\n }\n case \"set-operator\": {\n const node = findNodeById(action.id, query);\n if (node && \"attribute\" in node) {\n if (node.operator !== action.operator) {\n node.operator = action.operator;\n if (action.value !== undefined) {\n node.value = action.value ?? undefined;\n }\n\n return query;\n }\n }\n break;\n }\n case \"set-value\": {\n const node = findNodeById(action.id, query);\n if (node && \"operator\" in node) {\n node.value = action.value ?? undefined;\n\n return query;\n }\n break;\n }\n\n default:\n }\n\n // Return existing state if nothing changed\n return query;\n};\n\nexport default reducer;\n"],"names":["reducer","state","action","query","type","emptyGroup","group","findNodeById","id","rules","emptyRule","rule","push","parent","findParentById","filter","node","combinator","attribute","undefined","operator","value"],"mappings":";;;AAKA,MAAMA,UAAqDA,CAACC,OAAOC,WAAW;AAC5E,QAAMC,QAAQ;AAAA,IAAE,GAAGF;AAAAA,EAAAA;AAEnB,UAAQC,OAAOE,MAAI;AAAA,IACjB,KAAK,eAAe;AAClB,aAAOC,MAAW,WAAA;AAAA,IACpB;AAAA,IACA,KAAK,eAAe;AAClB,YAAMC,QAAQC,MAAAA,aAAaL,OAAOM,IAAIL,KAAK;AACvCG,UAAAA,SAAS,WA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,eAAAA,WAAWlB,OAAOkB,YAAYD;AAC9BE,eAAAA,QAAQnB,OAAOmB,SAASF;AAAAA,QAC/B;AAEOhB,eAAAA;AAAAA,MACT;AACA;AAAA,IACF;AAAA,IACA,KAAK,gBAAgB;AACnB,YAAMa,OAAOT,MAAAA,aAAaL,OAAOM,IAAIL,KAAK;AACtCa,UAAAA,QAAQ,eAAeA,MAAM;AAC3BA,YAAAA,KAAKI,aAAalB,OAAOkB,UAAU;AACrCJ,eAAKI,WAAWlB,OAAOkB;AACnBlB,cAAAA,OAAOmB,UAAUF,QAAW;AACzBE,iBAAAA,QAAQnB,OAAOmB,SAASF;AAAAA,UAC/B;AAEOhB,iBAAAA;AAAAA,QACT;AAAA,MACF;AACA;AAAA,IACF;AAAA,IACA,KAAK,aAAa;AAChB,YAAMa,OAAOT,MAAAA,aAAaL,OAAOM,IAAIL,KAAK;AACtCa,UAAAA,QAAQ,cAAcA,MAAM;AACzBK,aAAAA,QAAQnB,OAAOmB,SAASF;AAEtBhB,eAAAA;AAAAA,MACT;AACA;AAAA,IACF;AAAA,EAGF;AAGOA,SAAAA;AACT;AAEA,MAAA,YAAeH;;"}
@@ -618,6 +618,7 @@ exports.HvTimeAgo = TimeAgo.HvTimeAgo;
618
618
  exports.hvQueryBuilderDefaultCombinators = Context.defaultCombinators;
619
619
  exports.hvQueryBuilderDefaultLabels = Context.defaultLabels;
620
620
  exports.hvQueryBuilderDefaultOperators = Context.defaultOperators;
621
+ exports.useQueryBuilderContext = Context.useQueryBuilderContext;
621
622
  exports.queryBuilderClasses = QueryBuilder_styles.staticClasses;
622
623
  exports.HvQueryBuilder = QueryBuilder.HvQueryBuilder;
623
624
  exports.colorPickerClasses = ColorPicker_styles.staticClasses;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -30,7 +30,11 @@ const HvProvider = ({
30
30
  prepend: true
31
31
  }), [classNameKey]);
32
32
  return /* @__PURE__ */ jsxRuntime.jsxs(react.CacheProvider, { value: emotionCache, children: [
33
- /* @__PURE__ */ jsxRuntime.jsx(react.Global, { styles: /* @__PURE__ */ react.css(cssBaseline === "global" && uikitStyles.CssBaseline, " ", uikitStyles.getThemesVars(themesList), ";" + (process.env.NODE_ENV === "production" ? "" : ";label:HvProvider;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL3Byb3ZpZGVycy9Qcm92aWRlci50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0h3QiIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay9odi11aWtpdC1yZWFjdC9odi11aWtpdC1yZWFjdC9wYWNrYWdlcy9jb3JlL3NyYy9wcm92aWRlcnMvUHJvdmlkZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IHVzZU1lbW8gfSBmcm9tIFwicmVhY3RcIjtcblx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gICAgICAgICAgICAgICAgLi4uQ3NzU2NvcGVkQmFzZWxpbmUsXG4gICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIChjc3NUaGVtZSA9PT0gXCJzY29wZWRcIiB8fCBjc3NCYXNlbGluZSA9PT0gXCJzY29wZWRcIikgJiZcbiAgICAgICAgICAgICAgIXJvb3RFbGVtZW50SWQgPyAoXG4gICAgICAgICAgICAgIDxkaXZcbiAgICAgICAgICAgICAgICBpZD17c2NvcGVkUm9vdElkfVxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZT17XG4gICAgICAgICAgICAgICAgICBjc3NCYXNlbGluZSA9PT0gXCJzY29wZWRcIlxuICAgICAgICAgICAgICAgICAgICA/IGNzcyh7IC4uLkNzc1Njb3BlZEJhc2VsaW5lIH0pXG4gICAgICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICA+XG4gICAgICAgICAgICAgICAge2NoaWxkcmVufVxuICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICkgOiAoXG4gICAgICAgICAgICAgIGNoaWxkcmVuXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH19XG4gICAgICAgIDwvQ2xhc3NOYW1lcz5cbiAgICAgIDwvSHZUaGVtZVByb3ZpZGVyPlxuICAgIDwvQ2FjaGVQcm92aWRlcj5cbiAgKTtcbn07XG4iXX0= */") }),
33
+ /* @__PURE__ */ jsxRuntime.jsx(react.Global, { styles: /* @__PURE__ */ react.css(cssBaseline === "global" && {
34
+ [`@layer hv-uikit-baseline`]: {
35
+ ...uikitStyles.CssBaseline
36
+ }
37
+ }, " ", uikitStyles.getThemesVars(themesList), ";" + (process.env.NODE_ENV === "production" ? "" : ";label:HvProvider;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=ut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GU9e2NvbG9yTW9kZSB8fCBPYmplY3Qua2V5cyh0aGVtZXNMaXN0WzBdLmNvbG9ycy5tb2RlcylbMF19XG4gICAgICAgIHRoZW1lUm9vdElkPXtcbiAgICAgICAgICBjc3NUaGVtZSA9PT0gXCJzY29wZWRcIiA/IHJvb3RFbGVtZW50SWQgfHwgc2NvcGVkUm9vdElkIDogdW5kZWZpbmVkXG4gICAgICAgIH1cbiAgICAgID5cbiAgICAgICAgPENsYXNzTmFtZXM+XG4gICAgICAgICAgeyh7IGNzcyB9KSA9PiB7XG4gICAgICAgICAgICBpZiAoY3NzQmFzZWxpbmUgPT09IFwic2NvcGVkXCIpIHtcbiAgICAgICAgICAgICAgY29uc3Qgcm9vdEVsZW1lbnQgPSBnZXRFbGVtZW50QnlJZChyb290RWxlbWVudElkKTtcblxuICAgICAgICAgICAgICBpZiAocm9vdEVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICByb290RWxlbWVudC5jbGFzc0xpc3QuYWRkKFxuICAgICAgICAgICAgICAgICAgY3NzKHtcbiAgICAgICAgICAgICAgICAgICAgW2BAbGF5ZXIgJHtyb290RWxlbWVudElkfS1iYXNlbGluZWBdOiB7XG4gICAgICAgICAgICAgICAgICAgICAgLi4uQ3NzU2NvcGVkQmFzZWxpbmUsXG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIChjc3NUaGVtZSA9PT0gXCJzY29wZWRcIiB8fCBjc3NCYXNlbGluZSA9PT0gXCJzY29wZWRcIikgJiZcbiAgICAgICAgICAgICAgIXJvb3RFbGVtZW50SWQgPyAoXG4gICAgICAgICAgICAgIDxkaXZcbiAgICAgICAgICAgICAgICBpZD17c2NvcGVkUm9vdElkfVxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZT17XG4gICAgICAgICAgICAgICAgICBjc3NCYXNlbGluZSA9PT0gXCJzY29wZWRcIlxuICAgICAgICAgICAgICAgICAgICA/IGNzcyh7XG4gICAgICAgICAgICAgICAgICAgICAgICBbYEBsYXllciAke3Jvb3RFbGVtZW50SWR9LWJhc2VsaW5lYF06IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgLi4uQ3NzU2NvcGVkQmFzZWxpbmUsXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICA+XG4gICAgICAgICAgICAgICAge2NoaWxkcmVufVxuICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICkgOiAoXG4gICAgICAgICAgICAgIGNoaWxkcmVuXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH19XG4gICAgICAgIDwvQ2xhc3NOYW1lcz5cbiAgICAgIDwvSHZUaGVtZVByb3ZpZGVyPlxuICAgIDwvQ2FjaGVQcm92aWRlcj5cbiAgKTtcbn07XG4iXX0= */") }),
34
38
  /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider.HvThemeProvider, { themes: themesList, theme: theme$1 || themesList[0].name, emotionCache, colorMode: colorMode || Object.keys(themesList[0].colors.modes)[0], themeRootId: cssTheme === "scoped" ? rootElementId || scopedRootId : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(react.ClassNames, { children: ({
35
39
  css
36
40
  }) => {
@@ -38,12 +42,16 @@ const HvProvider = ({
38
42
  const rootElement = document.getElementById(rootElementId);
39
43
  if (rootElement) {
40
44
  rootElement.classList.add(css({
41
- ...uikitStyles.CssScopedBaseline
45
+ [`@layer ${rootElementId}-baseline`]: {
46
+ ...uikitStyles.CssScopedBaseline
47
+ }
42
48
  }));
43
49
  }
44
50
  }
45
51
  return (cssTheme === "scoped" || cssBaseline === "scoped") && !rootElementId ? /* @__PURE__ */ jsxRuntime.jsx("div", { id: scopedRootId, className: cssBaseline === "scoped" ? css({
46
- ...uikitStyles.CssScopedBaseline
52
+ [`@layer ${rootElementId}-baseline`]: {
53
+ ...uikitStyles.CssScopedBaseline
54
+ }
47
55
  }) : void 0, children }) : children;
48
56
  } }) })
49
57
  ] });
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.cjs","sources":["../../../src/providers/Provider.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\n\nimport createCache from \"@emotion/cache\";\nimport {\n css as cssReact,\n Global,\n CacheProvider,\n ClassNames,\n} from \"@emotion/react\";\n\nimport {\n CssBaseline,\n CssScopedBaseline,\n getThemesVars,\n HvThemeStructure,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { getElementById } from \"@core/utils/document\";\nimport { processThemes } from \"@core/utils/theme\";\nimport { HvTheme } from \"@core/types/theme\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\n\nimport {\n HvThemeProvider,\n defaultCacheKey,\n defaultEmotionCache,\n} from \"./ThemeProvider\";\n\n// Provider props\nexport interface HvProviderProps {\n /**\n * Your component tree.\n */\n children?: React.ReactNode;\n /**\n * Id of your root element.\n */\n rootElementId?: string;\n /**\n * By default the baseline styles are applied globally, `global`, to the application for the UI Kit components to work properly.\n * If you need to scope the baseline styles to avoid styling conflicts, you can set this property to `scoped`.\n * To scope the baseline to your root, you need to add the `rootElementId` property.\n * If the `rootElementId` property is not set, the baseline will be scoped to a new container, `hv-uikit-scoped-root*`, created around your content.\n * If you are providing your own baseline styles, you can set this property to `none` to disable the baseline styles.\n */\n cssBaseline?: \"global\" | \"scoped\" | \"none\";\n /**\n * By default the theme styles are applied globally, `global`, to the application.\n * If you need to scope the theme styles to avoid styling conflicts, you can set this property to `scoped`.\n * To scope the theme to your root, you need to add the `rootElementId` property.\n * If the `rootElementId` property is not set, the theme will be scoped to a new container, `hv-uikit-scoped-root*`, created around your content.\n */\n cssTheme?: \"global\" | \"scoped\";\n /**\n * The string used to prefix the class names and uniquely identify them. The key can only contain lower case alphabetical characters.\n * This is useful to avoid class name collisions.\n *\n * If no value is provided, the default is `hv`.\n */\n classNameKey?: string;\n /**\n * List of themes to be used by UI Kit.\n * You can provide your own themes created with the `createTheme` utility and/or the default themes `ds3` and `ds5` provided by UI Kit.\n *\n * If no value is provided, the `ds5` theme will be used.\n */\n themes?: (HvTheme | HvThemeStructure)[];\n /**\n * The active theme. It must be one of the themes passed to `themes`.\n *\n * If no value is provided, the first theme from the `themes` list is used. If no `themes` list is provided, the `ds5` theme will be used.\n */\n theme?: string;\n /**\n * The active color mode. It must be one of the color modes of the active theme.\n *\n * If no value is provided, the first color mode defined in the active theme is used.\n * For the default themes `ds3` and `ds5`, the `dawn` color mode is the one used.\n */\n colorMode?: string;\n}\n\nconst scopedRootPrefix = \"hv-uikit-scoped-root\" as const;\n\n/**\n * Enables theming capabilities and makes cross-component theme properties available down the tree.\n */\nexport const HvProvider = ({\n children,\n rootElementId,\n cssBaseline = \"global\",\n cssTheme = \"global\",\n themes,\n theme,\n colorMode,\n classNameKey = defaultCacheKey,\n}: HvProviderProps) => {\n const scopedRootId = useUniqueId(undefined, scopedRootPrefix);\n\n // Themes\n const themesList: (HvTheme | HvThemeStructure)[] = processThemes(themes);\n\n // Emotion cache\n // Moves UI Kit styles to the top of the <head> so they're loaded first\n // This enables users to override the UI Kit styles if necessary\n const emotionCache = useMemo(\n () =>\n classNameKey === defaultCacheKey\n ? defaultEmotionCache\n : createCache({ key: classNameKey, prepend: true }),\n [classNameKey]\n );\n\n return (\n <CacheProvider value={emotionCache}>\n <Global\n styles={cssReact`\n ${cssBaseline === \"global\" && CssBaseline}\n ${getThemesVars(themesList)}\n `}\n />\n <HvThemeProvider\n themes={themesList}\n theme={theme || themesList[0].name}\n emotionCache={emotionCache}\n colorMode={colorMode || Object.keys(themesList[0].colors.modes)[0]}\n themeRootId={\n cssTheme === \"scoped\" ? rootElementId || scopedRootId : undefined\n }\n >\n <ClassNames>\n {({ css }) => {\n if (cssBaseline === \"scoped\") {\n const rootElement = getElementById(rootElementId);\n\n if (rootElement) {\n rootElement.classList.add(\n css({\n ...CssScopedBaseline,\n })\n );\n }\n }\n\n return (cssTheme === \"scoped\" || cssBaseline === \"scoped\") &&\n !rootElementId ? (\n <div\n id={scopedRootId}\n className={\n cssBaseline === \"scoped\"\n ? css({ ...CssScopedBaseline })\n : undefined\n }\n >\n {children}\n </div>\n ) : (\n children\n );\n }}\n </ClassNames>\n </HvThemeProvider>\n </CacheProvider>\n );\n};\n"],"names":["scopedRootPrefix","HvProvider","children","rootElementId","cssBaseline","cssTheme","themes","theme","colorMode","classNameKey","defaultCacheKey","scopedRootId","useUniqueId","undefined","themesList","processThemes","emotionCache","useMemo","defaultEmotionCache","createCache","key","prepend","jsxs","CacheProvider","jsx","Global","CssBaseline","getThemesVars","process","env","NODE_ENV","HvThemeProvider","name","Object","keys","colors","modes","ClassNames","css","rootElement","getElementById","classList","add","CssScopedBaseline"],"mappings":";;;;;;;;;;;;;;AAkFA,MAAMA,mBAAmB;AAKlB,MAAMC,aAAaA,CAAC;AAAA,EACzBC;AAAAA,EACAC;AAAAA,EACAC,cAAc;AAAA,EACdC,WAAW;AAAA,EACXC;AAAAA,EAAAA,OACAC;AAAAA,EACAC;AAAAA,EACAC,eAAeC,iBAAAA;AACA,MAAM;AACfC,QAAAA,eAAeC,YAAYC,YAAAA,QAAWb,gBAAgB;AAGtDc,QAAAA,aAA6CC,oBAAcT,MAAM;AAKvE,QAAMU,eAAeC,MAAAA,QACnB,MACER,iBAAiBC,iBAAAA,kBACbQ,uCACAC,6BAAY;AAAA,IAAEC,KAAKX;AAAAA,IAAcY,SAAS;AAAA,EAAA,CAAM,GACtD,CAACZ,YAAY,CACf;AAGE,SAAAa,2BAAA,KAACC,MAAc,eAAA,EAAA,OAAOP,cACpB,UAAA;AAAA,IAACQ,2BAAAA,IAAAC,MAAA,QAAA,EACC,QACIrB,sBAAAA,IAAAA,gBAAgB,YAAYsB,YAAAA,aAC5BC,KAAAA,YAAAA,cAAcb,UAAU,GAAC,OAAAc,QAAAC,IAAAC,aAAA,eAAA,KAAA,uBAAAF,QAAAC,IAAAC,aAC3B,eAAA,KAAA,yrPAAA,EAAA,CAAA;AAAA,IAEHN,2BAAA,IAAAO,cAAA,iBAAA,EACC,QAAQjB,YACR,OAAOP,WAASO,WAAW,CAAC,EAAEkB,MAC9B,cACA,WAAWxB,aAAayB,OAAOC,KAAKpB,WAAW,CAAC,EAAEqB,OAAOC,KAAK,EAAE,CAAC,GACjE,aACE/B,aAAa,WAAWF,iBAAiBQ,eAAeE,QAG1D,UAAAW,2BAAA,IAACa,oBACE,UAAC,CAAA;AAAA,MAAEC;AAAAA,IAAAA,MAAU;AACZ,UAAIlC,gBAAgB,UAAU;AACtBmC,cAAAA,cAAcC,wBAAerC,aAAa;AAEhD,YAAIoC,aAAa;AACHE,sBAAAA,UAAUC,IACpBJ,IAAI;AAAA,YACF,GAAGK,YAAAA;AAAAA,UACJ,CAAA,CACH;AAAA,QACF;AAAA,MACF;AAEA,cAAQtC,aAAa,YAAYD,gBAAgB,aAC/C,CAACD,gBACAqB,2BAAAA,IAAA,OAAA,EACC,IAAIb,cACJ,WACEP,gBAAgB,WACZkC,IAAI;AAAA,QAAE,GAAGK,YAAAA;AAAAA,MAAmB,CAAA,IAC5B9B,QAGLX,SACH,CAAA,IAEAA;AAAAA,OAGN,EACF,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;;"}
1
+ {"version":3,"file":"Provider.cjs","sources":["../../../src/providers/Provider.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\n\nimport createCache from \"@emotion/cache\";\nimport {\n css as cssReact,\n Global,\n CacheProvider,\n ClassNames,\n} from \"@emotion/react\";\n\nimport {\n CssBaseline,\n CssScopedBaseline,\n getThemesVars,\n HvThemeStructure,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { getElementById } from \"@core/utils/document\";\nimport { processThemes } from \"@core/utils/theme\";\nimport { HvTheme } from \"@core/types/theme\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\n\nimport {\n HvThemeProvider,\n defaultCacheKey,\n defaultEmotionCache,\n} from \"./ThemeProvider\";\n\n// Provider props\nexport interface HvProviderProps {\n /**\n * Your component tree.\n */\n children?: React.ReactNode;\n /**\n * Id of your root element.\n */\n rootElementId?: string;\n /**\n * By default the baseline styles are applied globally, `global`, to the application for the UI Kit components to work properly.\n * If you need to scope the baseline styles to avoid styling conflicts, you can set this property to `scoped`.\n * To scope the baseline to your root, you need to add the `rootElementId` property.\n * If the `rootElementId` property is not set, the baseline will be scoped to a new container, `hv-uikit-scoped-root*`, created around your content.\n * If you are providing your own baseline styles, you can set this property to `none` to disable the baseline styles.\n */\n cssBaseline?: \"global\" | \"scoped\" | \"none\";\n /**\n * By default the theme styles are applied globally, `global`, to the application.\n * If you need to scope the theme styles to avoid styling conflicts, you can set this property to `scoped`.\n * To scope the theme to your root, you need to add the `rootElementId` property.\n * If the `rootElementId` property is not set, the theme will be scoped to a new container, `hv-uikit-scoped-root*`, created around your content.\n */\n cssTheme?: \"global\" | \"scoped\";\n /**\n * The string used to prefix the class names and uniquely identify them. The key can only contain lower case alphabetical characters.\n * This is useful to avoid class name collisions.\n *\n * If no value is provided, the default is `hv`.\n */\n classNameKey?: string;\n /**\n * List of themes to be used by UI Kit.\n * You can provide your own themes created with the `createTheme` utility and/or the default themes `ds3` and `ds5` provided by UI Kit.\n *\n * If no value is provided, the `ds5` theme will be used.\n */\n themes?: (HvTheme | HvThemeStructure)[];\n /**\n * The active theme. It must be one of the themes passed to `themes`.\n *\n * If no value is provided, the first theme from the `themes` list is used. If no `themes` list is provided, the `ds5` theme will be used.\n */\n theme?: string;\n /**\n * The active color mode. It must be one of the color modes of the active theme.\n *\n * If no value is provided, the first color mode defined in the active theme is used.\n * For the default themes `ds3` and `ds5`, the `dawn` color mode is the one used.\n */\n colorMode?: string;\n}\n\nconst scopedRootPrefix = \"hv-uikit-scoped-root\" as const;\n\n/**\n * Enables theming capabilities and makes cross-component theme properties available down the tree.\n */\nexport const HvProvider = ({\n children,\n rootElementId,\n cssBaseline = \"global\",\n cssTheme = \"global\",\n themes,\n theme,\n colorMode,\n classNameKey = defaultCacheKey,\n}: HvProviderProps) => {\n const scopedRootId = useUniqueId(undefined, scopedRootPrefix);\n\n // Themes\n const themesList: (HvTheme | HvThemeStructure)[] = processThemes(themes);\n\n // Emotion cache\n // Moves UI Kit styles to the top of the <head> so they're loaded first\n // This enables users to override the UI Kit styles if necessary\n const emotionCache = useMemo(\n () =>\n classNameKey === defaultCacheKey\n ? defaultEmotionCache\n : createCache({ key: classNameKey, prepend: true }),\n [classNameKey]\n );\n\n return (\n <CacheProvider value={emotionCache}>\n <Global\n styles={cssReact`\n ${\n cssBaseline === \"global\" && {\n [`@layer hv-uikit-baseline`]: {\n ...CssBaseline,\n },\n }\n }\n ${getThemesVars(themesList)}\n `}\n />\n <HvThemeProvider\n themes={themesList}\n theme={theme || themesList[0].name}\n emotionCache={emotionCache}\n colorMode={colorMode || Object.keys(themesList[0].colors.modes)[0]}\n themeRootId={\n cssTheme === \"scoped\" ? rootElementId || scopedRootId : undefined\n }\n >\n <ClassNames>\n {({ css }) => {\n if (cssBaseline === \"scoped\") {\n const rootElement = getElementById(rootElementId);\n\n if (rootElement) {\n rootElement.classList.add(\n css({\n [`@layer ${rootElementId}-baseline`]: {\n ...CssScopedBaseline,\n },\n })\n );\n }\n }\n\n return (cssTheme === \"scoped\" || cssBaseline === \"scoped\") &&\n !rootElementId ? (\n <div\n id={scopedRootId}\n className={\n cssBaseline === \"scoped\"\n ? css({\n [`@layer ${rootElementId}-baseline`]: {\n ...CssScopedBaseline,\n },\n })\n : undefined\n }\n >\n {children}\n </div>\n ) : (\n children\n );\n }}\n </ClassNames>\n </HvThemeProvider>\n </CacheProvider>\n );\n};\n"],"names":["scopedRootPrefix","HvProvider","children","rootElementId","cssBaseline","cssTheme","themes","theme","colorMode","classNameKey","defaultCacheKey","scopedRootId","useUniqueId","undefined","themesList","processThemes","emotionCache","useMemo","defaultEmotionCache","createCache","key","prepend","jsxs","CacheProvider","jsx","Global","CssBaseline","getThemesVars","process","env","NODE_ENV","HvThemeProvider","name","Object","keys","colors","modes","ClassNames","css","rootElement","getElementById","classList","add","CssScopedBaseline"],"mappings":";;;;;;;;;;;;;;AAkFA,MAAMA,mBAAmB;AAKlB,MAAMC,aAAaA,CAAC;AAAA,EACzBC;AAAAA,EACAC;AAAAA,EACAC,cAAc;AAAA,EACdC,WAAW;AAAA,EACXC;AAAAA,EAAAA,OACAC;AAAAA,EACAC;AAAAA,EACAC,eAAeC,iBAAAA;AACA,MAAM;AACfC,QAAAA,eAAeC,YAAYC,YAAAA,QAAWb,gBAAgB;AAGtDc,QAAAA,aAA6CC,oBAAcT,MAAM;AAKvE,QAAMU,eAAeC,MAAAA,QACnB,MACER,iBAAiBC,iBAAAA,kBACbQ,uCACAC,6BAAY;AAAA,IAAEC,KAAKX;AAAAA,IAAcY,SAAS;AAAA,EAAA,CAAM,GACtD,CAACZ,YAAY,CACf;AAGE,SAAAa,2BAAA,KAACC,MAAc,eAAA,EAAA,OAAOP,cACpB,UAAA;AAAA,IAAAQ,2BAAA,IAACC,MACC,QAAA,EAAA,QAEIrB,sBAAAA,IAAAA,gBAAgB,YAAY;AAAA,MAC1B,CAAE,0BAAyB,GAAG;AAAA,QAC5B,GAAGsB,YAAAA;AAAAA,MACL;AAAA,IAAA,QAGFC,YAAAA,cAAcb,UAAU,UAACc,QAAAC,IAAAC,aAAAF,eAAAA,KAAAA,uBAAAA,QAAAC,IAAAC,aAC3B,eAAA,KAAA,ypQAAA,GAAA;AAAA,IAEHN,2BAAA,IAAAO,cAAA,iBAAA,EACC,QAAQjB,YACR,OAAOP,WAASO,WAAW,CAAC,EAAEkB,MAC9B,cACA,WAAWxB,aAAayB,OAAOC,KAAKpB,WAAW,CAAC,EAAEqB,OAAOC,KAAK,EAAE,CAAC,GACjE,aACE/B,aAAa,WAAWF,iBAAiBQ,eAAeE,QAG1D,UAAAW,2BAAA,IAACa,oBACE,UAAC,CAAA;AAAA,MAAEC;AAAAA,IAAAA,MAAU;AACZ,UAAIlC,gBAAgB,UAAU;AACtBmC,cAAAA,cAAcC,wBAAerC,aAAa;AAEhD,YAAIoC,aAAa;AACHE,sBAAAA,UAAUC,IACpBJ,IAAI;AAAA,YACF,CAAE,UAASnC,aAAc,WAAU,GAAG;AAAA,cACpC,GAAGwC,YAAAA;AAAAA,YACL;AAAA,UACD,CAAA,CACH;AAAA,QACF;AAAA,MACF;AAEA,cAAQtC,aAAa,YAAYD,gBAAgB,aAC/C,CAACD,gBACAqB,2BAAAA,IAAA,OAAA,EACC,IAAIb,cACJ,WACEP,gBAAgB,WACZkC,IAAI;AAAA,QACF,CAAE,UAASnC,aAAc,WAAU,GAAG;AAAA,UACpC,GAAGwC,YAAAA;AAAAA,QACL;AAAA,MACD,CAAA,IACD9B,QAGLX,SACH,CAAA,IAEAA;AAAAA,OAGN,EACF,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;;"}
@@ -112,7 +112,9 @@ const HvCheckBoxGroup = forwardRef((props, ref) => {
112
112
  }, [children, disabled, name, onChildChangeInterceptor, readOnly, selectedState]);
113
113
  const handleSelectAll = (event, selectAllChecked) => {
114
114
  let newValue;
115
- if (selectAllChecked) {
115
+ if (selectAllState === "some") {
116
+ newValue = [];
117
+ } else if (selectAllChecked) {
116
118
  newValue = [...allValues];
117
119
  } else {
118
120
  newValue = [];
@@ -1 +1 @@
1
- {"version":3,"file":"CheckBoxGroup.js","sources":["../../../../src/components/CheckBoxGroup/CheckBoxGroup.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport { multiSelectionEventHandler } from \"@core/utils/multiSelectionEventHandler\";\nimport { HvCheckBox } from \"@core/components/CheckBox\";\nimport {\n HvFormElement,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n} from \"@core/components/Forms\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./CheckBoxGroup.styles\";\n\nconst computeSelectAllState = (selected: number, total: number) => {\n if (selected === 0) {\n return \"none\";\n }\n\n if (selected === total) {\n return \"all\";\n }\n\n return \"some\";\n};\n\nconst getValueFromSelectedChildren = (children: React.ReactNode) => {\n const selectedValues = Children.toArray(children)\n .map((child: any) => {\n const childIsControlled = child?.props?.checked !== undefined;\n const childIsSelected = childIsControlled\n ? child?.props?.checked\n : child?.props?.defaultChecked;\n\n return childIsSelected ? child?.props?.value : undefined;\n })\n .filter((v) => v !== undefined);\n\n return selectedValues;\n};\n\nexport { staticClasses as checkBoxGroupClasses };\n\nexport type HvCheckBoxGroupClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvCheckBoxGroupProps\n extends HvBaseProps<HTMLDivElement, \"onChange\"> {\n /**\n * The form element name.\n *\n * It is propagated to the children checkboxes, unless they already have one.\n */\n name?: string;\n /**\n * The value of the form element. An array of values represented in the child checkboxes.\n *\n * When defined the checkbox group state becomes controlled.\n */\n value?: any[];\n /**\n * When uncontrolled, defines the initial value.\n */\n defaultValue?: any[];\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /**\n * Provide additional descriptive text for the form element.\n */\n description?: React.ReactNode;\n /**\n * Indicates that the form element is disabled.\n * If `true` the state is propagated to the children checkboxes.\n */\n disabled?: boolean;\n /**\n * Indicates that the form element is not editable.\n * If `true` the state is propagated to the children checkboxes.\n */\n readOnly?: boolean;\n /**\n * Indicates that user input is required on the form element.\n */\n required?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to the state.\n */\n status?: HvFormStatus;\n /**\n * The error message to show when the validation status is \"invalid\".\n *\n * Defaults to \"Required\" when the status is uncontrolled and no `aria-errormessage` is provided.\n */\n statusMessage?: React.ReactNode;\n /**\n * The callback fired when the value changes.\n */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: any[]) => void;\n /**\n * Indicates whether the checkbox group's orientation is horizontal or vertical.\n *\n * Defaults to vertical.\n */\n orientation?: \"vertical\" | \"horizontal\";\n /**\n * Indicates if an additional select all checkbox should be shown.\n */\n showSelectAll?: boolean;\n /**\n * The label of the select all checkbox. Defaults to \"All\".\n */\n selectAllLabel?: string;\n /**\n * Custom label for select all checkbox conjunction\n */\n selectAllConjunctionLabel?: string;\n /**\n * A Jss Object used to override or extend the component styles applied.\n */\n classes?: HvCheckBoxGroupClasses;\n}\n\n/**\n * A checkbox group is a type of selection list that allows the user to select multiple options through the use of checkboxes.\n */\nexport const HvCheckBoxGroup = forwardRef<HTMLDivElement, HvCheckBoxGroupProps>(\n (props, ref) => {\n const {\n id,\n classes: classesProp,\n className,\n children,\n name,\n label,\n description,\n status,\n statusMessage,\n defaultValue,\n value: valueProp,\n required = false,\n readOnly = false,\n disabled = false,\n showSelectAll = false,\n orientation = \"vertical\",\n selectAllLabel = \"All\",\n selectAllConjunctionLabel = \"/\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n onChange,\n ...others\n } = useDefaultProps(\"HvCheckBoxGroup\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [value, setValue] = useControlled(\n valueProp,\n defaultValue !== undefined\n ? defaultValue\n : // When uncontrolled and no default value is given,\n // extract the initial selected values from the children own state\n () => getValueFromSelectedChildren(children)\n );\n\n const [validationState, setValidationState] = useControlled(\n status,\n \"standBy\"\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const elementId = useUniqueId(id, \"hvcheckboxgroup\");\n\n const selectionAnchor = useRef(undefined);\n\n const [allValues, selectedState, selectedCount] = useMemo(() => {\n const childValues: any[] = [];\n const childSelectedState: boolean[] = [];\n let childSelectedCounter = 0;\n\n Children.toArray(children).forEach((child: any, i: number) => {\n const childValue = child?.props?.value;\n const childIsSelected = value.indexOf(childValue) !== -1;\n\n childValues[i] = childValue;\n childSelectedState[i] = childIsSelected;\n\n if (childIsSelected) {\n childSelectedCounter += 1;\n }\n });\n\n return [childValues, childSelectedState, childSelectedCounter];\n }, [children, value]);\n\n const selectAllState = computeSelectAllState(\n value.length,\n selectedState.length\n );\n\n const onChildChangeInterceptor = useCallback(\n (\n index: number,\n childOnChange: (\n event: React.ChangeEvent<HTMLInputElement>,\n isChecked: boolean\n ) => void,\n event: React.ChangeEvent<HTMLInputElement>,\n isChecked: boolean\n ) => {\n const newValue = multiSelectionEventHandler(\n event,\n index,\n selectionAnchor,\n allValues,\n selectedState,\n isChecked\n );\n\n childOnChange?.(event, isChecked);\n\n onChange?.(event, newValue);\n\n setValue(() => {\n // This will only run if uncontrolled\n\n if (required && newValue.length === 0) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newValue;\n });\n },\n [\n allValues,\n onChange,\n required,\n selectedState,\n setValidationState,\n setValue,\n ]\n );\n\n const modifiedChildren = useMemo(() => {\n return Children.map(children, (child: any, i: number) => {\n const childIsSelected = selectedState[i];\n\n return cloneElement(child, {\n checked: childIsSelected,\n name: child?.props?.name || name,\n onChange: (\n event: React.ChangeEvent<HTMLInputElement>,\n isChecked: boolean\n ) =>\n onChildChangeInterceptor(\n i,\n child?.props?.onChange,\n event,\n isChecked\n ),\n disabled: disabled || child?.props?.disabled,\n readOnly: readOnly || child?.props?.readOnly,\n });\n });\n }, [\n children,\n disabled,\n name,\n onChildChangeInterceptor,\n readOnly,\n selectedState,\n ]);\n\n const handleSelectAll = (\n event: React.ChangeEvent<HTMLInputElement>,\n selectAllChecked: boolean\n ) => {\n let newValue: any[];\n if (selectAllChecked) {\n newValue = [...allValues];\n } else {\n newValue = [];\n }\n\n onChange?.(event, newValue);\n\n setValue(() => {\n // This will only run if uncontrolled\n if (required && newValue.length === 0) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newValue;\n });\n };\n\n const selectAllLabelComponent =\n selectedCount === 0 ? (\n <>\n <b>{selectAllLabel}</b>\n {` (${Children.toArray(children).length})`}\n </>\n ) : (\n <>\n <b>{selectedCount}</b>\n {` ${selectAllConjunctionLabel} ${Children.toArray(children).length}`}\n </>\n );\n\n // The error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and required is true\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined && required));\n\n const errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {label && (\n <HvLabel\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {description && (\n <HvInfoMessage id={setId(elementId, \"description\")}>\n {description}\n </HvInfoMessage>\n )}\n\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel}\n aria-labelledby={\n ariaLabelledBy || (label && setId(elementId, \"label\")) || undefined\n }\n aria-disabled={disabled ? true : undefined}\n aria-invalid={validationState === \"invalid\" ? true : undefined}\n aria-errormessage={\n validationState === \"invalid\" ? errorMessageId : undefined\n }\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n className={cx(classes.group, {\n [classes.vertical]: orientation === \"vertical\",\n [classes.horizontal]: orientation === \"horizontal\",\n [classes.invalid]: validationState === \"invalid\",\n })}\n {...others}\n >\n {showSelectAll && (\n <HvCheckBox\n checked={selectAllState === \"all\"}\n indeterminate={selectAllState === \"some\"}\n label={selectAllLabelComponent}\n disabled={disabled}\n readOnly={readOnly}\n className={classes.selectAll}\n onChange={handleSelectAll}\n />\n )}\n {modifiedChildren}\n </div>\n\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["computeSelectAllState","selected","total","getValueFromSelectedChildren","children","selectedValues","Children","toArray","map","child","childIsControlled","props","checked","undefined","childIsSelected","defaultChecked","value","filter","v","HvCheckBoxGroup","forwardRef","ref","id","classes","classesProp","className","name","label","description","status","statusMessage","defaultValue","valueProp","required","readOnly","disabled","showSelectAll","orientation","selectAllLabel","selectAllConjunctionLabel","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaErrorMessage","onChange","others","useDefaultProps","cx","useClasses","setValue","useControlled","validationState","setValidationState","validationMessage","elementId","useUniqueId","selectionAnchor","useRef","allValues","selectedState","selectedCount","useMemo","childValues","childSelectedState","childSelectedCounter","forEach","i","childValue","indexOf","selectAllState","length","onChildChangeInterceptor","useCallback","index","childOnChange","event","isChecked","newValue","multiSelectionEventHandler","modifiedChildren","cloneElement","handleSelectAll","selectAllChecked","selectAllLabelComponent","canShowError","errorMessageId","setId","root","join","trim","group","vertical","horizontal","invalid","selectAll","error"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAMA,wBAAwBA,CAACC,UAAkBC,UAAkB;AACjE,MAAID,aAAa,GAAG;AACX,WAAA;AAAA,EACT;AAEA,MAAIA,aAAaC,OAAO;AACf,WAAA;AAAA,EACT;AAEO,SAAA;AACT;AAEA,MAAMC,+BAA+BA,CAACC,aAA8B;AAClE,QAAMC,iBAAiBC,SAASC,QAAQH,QAAQ,EAC7CI,IAAI,CAACC,UAAe;AACbC,UAAAA,oBAAoBD,OAAO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AAA,IACC,SAAA,oBAAC,SACC,EAAA,IAAI2D,MAAMhC,WAAW,OAAO,GAC5B,OACA,WAAW/B,QAAQI,MAEtB,CAAA;AAAA,IAEAC,mCACE,eAAc,EAAA,IAAI0D,MAAMhC,WAAW,aAAa,GAC9C1B,UACH,aAAA;AAAA,IAGF,qBAAC,SACC,KACA,MAAK,SACL,cAAYY,WACZ,mBACEC,kBAAmBd,SAAS2D,MAAMhC,WAAW,OAAO,KAAMzC,QAE5D,iBAAesB,WAAW,OAAOtB,QACjC,gBAAcsC,oBAAoB,YAAY,OAAOtC,QACrD,qBACEsC,oBAAoB,YAAYkC,iBAAiBxE,QAEnD,oBACE,CAACe,eAAe0D,MAAMhC,WAAW,aAAa,GAAGZ,eAAe,EAC7D8C,KAAK,GAAG,EACRC,KAAAA,KAAU5E,QAEf,WAAWkC,GAAGxB,QAAQmE,OAAO;AAAA,MAC3B,CAACnE,QAAQoE,QAAQ,GAAGtD,gBAAgB;AAAA,MACpC,CAACd,QAAQqE,UAAU,GAAGvD,gBAAgB;AAAA,MACtC,CAACd,QAAQsE,OAAO,GAAG1C,oBAAoB;AAAA,IAAA,CACxC,GACD,GAAIN,QAEHT,UAAAA;AAAAA,MAAAA,qCACE,YACC,EAAA,SAASiC,mBAAmB,OAC5B,eAAeA,mBAAmB,QAClC,OAAOc,yBACP,UACA,UACA,WAAW5D,QAAQuE,WACnB,UAAUb,iBAEb;AAAA,MACAF;AAAAA,IAAAA,GACH;AAAA,IAECK,gBACC,oBAAC,eACC,EAAA,IAAIE,MAAMhC,WAAW,OAAO,GAC5B,eAAa,MACb,WAAW/B,QAAQwE,OAElB1C,UACH,mBAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CACF;"}
1
+ {"version":3,"file":"CheckBoxGroup.js","sources":["../../../../src/components/CheckBoxGroup/CheckBoxGroup.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport { multiSelectionEventHandler } from \"@core/utils/multiSelectionEventHandler\";\nimport { HvCheckBox } from \"@core/components/CheckBox\";\nimport {\n HvFormElement,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n} from \"@core/components/Forms\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./CheckBoxGroup.styles\";\n\nconst computeSelectAllState = (selected: number, total: number) => {\n if (selected === 0) {\n return \"none\";\n }\n\n if (selected === total) {\n return \"all\";\n }\n\n return \"some\";\n};\n\nconst getValueFromSelectedChildren = (children: React.ReactNode) => {\n const selectedValues = Children.toArray(children)\n .map((child: any) => {\n const childIsControlled = child?.props?.checked !== undefined;\n const childIsSelected = childIsControlled\n ? child?.props?.checked\n : child?.props?.defaultChecked;\n\n return childIsSelected ? child?.props?.value : undefined;\n })\n .filter((v) => v !== undefined);\n\n return selectedValues;\n};\n\nexport { staticClasses as checkBoxGroupClasses };\n\nexport type HvCheckBoxGroupClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvCheckBoxGroupProps\n extends HvBaseProps<HTMLDivElement, \"onChange\"> {\n /**\n * The form element name.\n *\n * It is propagated to the children checkboxes, unless they already have one.\n */\n name?: string;\n /**\n * The value of the form element. An array of values represented in the child checkboxes.\n *\n * When defined the checkbox group state becomes controlled.\n */\n value?: any[];\n /**\n * When uncontrolled, defines the initial value.\n */\n defaultValue?: any[];\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /**\n * Provide additional descriptive text for the form element.\n */\n description?: React.ReactNode;\n /**\n * Indicates that the form element is disabled.\n * If `true` the state is propagated to the children checkboxes.\n */\n disabled?: boolean;\n /**\n * Indicates that the form element is not editable.\n * If `true` the state is propagated to the children checkboxes.\n */\n readOnly?: boolean;\n /**\n * Indicates that user input is required on the form element.\n */\n required?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to the state.\n */\n status?: HvFormStatus;\n /**\n * The error message to show when the validation status is \"invalid\".\n *\n * Defaults to \"Required\" when the status is uncontrolled and no `aria-errormessage` is provided.\n */\n statusMessage?: React.ReactNode;\n /**\n * The callback fired when the value changes.\n */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: any[]) => void;\n /**\n * Indicates whether the checkbox group's orientation is horizontal or vertical.\n *\n * Defaults to vertical.\n */\n orientation?: \"vertical\" | \"horizontal\";\n /**\n * Indicates if an additional select all checkbox should be shown.\n */\n showSelectAll?: boolean;\n /**\n * The label of the select all checkbox. Defaults to \"All\".\n */\n selectAllLabel?: string;\n /**\n * Custom label for select all checkbox conjunction\n */\n selectAllConjunctionLabel?: string;\n /**\n * A Jss Object used to override or extend the component styles applied.\n */\n classes?: HvCheckBoxGroupClasses;\n}\n\n/**\n * A checkbox group is a type of selection list that allows the user to select multiple options through the use of checkboxes.\n */\nexport const HvCheckBoxGroup = forwardRef<HTMLDivElement, HvCheckBoxGroupProps>(\n (props, ref) => {\n const {\n id,\n classes: classesProp,\n className,\n children,\n name,\n label,\n description,\n status,\n statusMessage,\n defaultValue,\n value: valueProp,\n required = false,\n readOnly = false,\n disabled = false,\n showSelectAll = false,\n orientation = \"vertical\",\n selectAllLabel = \"All\",\n selectAllConjunctionLabel = \"/\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n onChange,\n ...others\n } = useDefaultProps(\"HvCheckBoxGroup\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [value, setValue] = useControlled(\n valueProp,\n defaultValue !== undefined\n ? defaultValue\n : // When uncontrolled and no default value is given,\n // extract the initial selected values from the children own state\n () => getValueFromSelectedChildren(children)\n );\n\n const [validationState, setValidationState] = useControlled(\n status,\n \"standBy\"\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const elementId = useUniqueId(id, \"hvcheckboxgroup\");\n\n const selectionAnchor = useRef(undefined);\n\n const [allValues, selectedState, selectedCount] = useMemo(() => {\n const childValues: any[] = [];\n const childSelectedState: boolean[] = [];\n let childSelectedCounter = 0;\n\n Children.toArray(children).forEach((child: any, i: number) => {\n const childValue = child?.props?.value;\n const childIsSelected = value.indexOf(childValue) !== -1;\n\n childValues[i] = childValue;\n childSelectedState[i] = childIsSelected;\n\n if (childIsSelected) {\n childSelectedCounter += 1;\n }\n });\n\n return [childValues, childSelectedState, childSelectedCounter];\n }, [children, value]);\n\n const selectAllState = computeSelectAllState(\n value.length,\n selectedState.length\n );\n\n const onChildChangeInterceptor = useCallback(\n (\n index: number,\n childOnChange: (\n event: React.ChangeEvent<HTMLInputElement>,\n isChecked: boolean\n ) => void,\n event: React.ChangeEvent<HTMLInputElement>,\n isChecked: boolean\n ) => {\n const newValue = multiSelectionEventHandler(\n event,\n index,\n selectionAnchor,\n allValues,\n selectedState,\n isChecked\n );\n\n childOnChange?.(event, isChecked);\n\n onChange?.(event, newValue);\n\n setValue(() => {\n // This will only run if uncontrolled\n\n if (required && newValue.length === 0) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newValue;\n });\n },\n [\n allValues,\n onChange,\n required,\n selectedState,\n setValidationState,\n setValue,\n ]\n );\n\n const modifiedChildren = useMemo(() => {\n return Children.map(children, (child: any, i: number) => {\n const childIsSelected = selectedState[i];\n\n return cloneElement(child, {\n checked: childIsSelected,\n name: child?.props?.name || name,\n onChange: (\n event: React.ChangeEvent<HTMLInputElement>,\n isChecked: boolean\n ) =>\n onChildChangeInterceptor(\n i,\n child?.props?.onChange,\n event,\n isChecked\n ),\n disabled: disabled || child?.props?.disabled,\n readOnly: readOnly || child?.props?.readOnly,\n });\n });\n }, [\n children,\n disabled,\n name,\n onChildChangeInterceptor,\n readOnly,\n selectedState,\n ]);\n\n const handleSelectAll = (\n event: React.ChangeEvent<HTMLInputElement>,\n selectAllChecked: boolean\n ) => {\n let newValue: any[];\n if (selectAllState === \"some\") {\n newValue = [];\n } else if (selectAllChecked) {\n newValue = [...allValues];\n } else {\n newValue = [];\n }\n\n onChange?.(event, newValue);\n\n setValue(() => {\n // This will only run if uncontrolled\n if (required && newValue.length === 0) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newValue;\n });\n };\n\n const selectAllLabelComponent =\n selectedCount === 0 ? (\n <>\n <b>{selectAllLabel}</b>\n {` (${Children.toArray(children).length})`}\n </>\n ) : (\n <>\n <b>{selectedCount}</b>\n {` ${selectAllConjunctionLabel} ${Children.toArray(children).length}`}\n </>\n );\n\n // The error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and required is true\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined && required));\n\n const errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {label && (\n <HvLabel\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {description && (\n <HvInfoMessage id={setId(elementId, \"description\")}>\n {description}\n </HvInfoMessage>\n )}\n\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel}\n aria-labelledby={\n ariaLabelledBy || (label && setId(elementId, \"label\")) || undefined\n }\n aria-disabled={disabled ? true : undefined}\n aria-invalid={validationState === \"invalid\" ? true : undefined}\n aria-errormessage={\n validationState === \"invalid\" ? errorMessageId : undefined\n }\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n className={cx(classes.group, {\n [classes.vertical]: orientation === \"vertical\",\n [classes.horizontal]: orientation === \"horizontal\",\n [classes.invalid]: validationState === \"invalid\",\n })}\n {...others}\n >\n {showSelectAll && (\n <HvCheckBox\n checked={selectAllState === \"all\"}\n indeterminate={selectAllState === \"some\"}\n label={selectAllLabelComponent}\n disabled={disabled}\n readOnly={readOnly}\n className={classes.selectAll}\n onChange={handleSelectAll}\n />\n )}\n {modifiedChildren}\n </div>\n\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["computeSelectAllState","selected","total","getValueFromSelectedChildren","children","selectedValues","Children","toArray","map","child","childIsControlled","props","checked","undefined","childIsSelected","defaultChecked","value","filter","v","HvCheckBoxGroup","forwardRef","ref","id","classes","classesProp","className","name","label","description","status","statusMessage","defaultValue","valueProp","required","readOnly","disabled","showSelectAll","orientation","selectAllLabel","selectAllConjunctionLabel","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaErrorMessage","onChange","others","useDefaultProps","cx","useClasses","setValue","useControlled","validationState","setValidationState","validationMessage","elementId","useUniqueId","selectionAnchor","useRef","allValues","selectedState","selectedCount","useMemo","childValues","childSelectedState","childSelectedCounter","forEach","i","childValue","indexOf","selectAllState","length","onChildChangeInterceptor","useCallback","index","childOnChange","event","isChecked","newValue","multiSelectionEventHandler","modifiedChildren","cloneElement","handleSelectAll","selectAllChecked","selectAllLabelComponent","canShowError","errorMessageId","setId","root","join","trim","group","vertical","horizontal","invalid","selectAll","error"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAMA,wBAAwBA,CAACC,UAAkBC,UAAkB;AACjE,MAAID,aAAa,GAAG;AACX,WAAA;AAAA,EACT;AAEA,MAAIA,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/B,QAAQwE,OAElB1C,UACH,mBAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CACF;"}
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from "@emotion/react/jsx-runtime";
2
- import { forwardRef, useState, useEffect, useRef } from "react";
2
+ import { forwardRef, useState, useRef, useEffect } from "react";
3
3
  import { useForkRef } from "@mui/material";
4
4
  import { useDefaultProps } from "../../hooks/useDefaultProps.js";
5
5
  import { setId } from "../../utils/setId.js";
@@ -80,8 +80,10 @@ const HvDropdown = forwardRef((props, ref) => {
80
80
  const [isOpen, setIsOpen] = useControlled(expanded, Boolean(defaultExpanded));
81
81
  const [selectionLabel, setSelectionLabel] = useState(getSelectionLabel(labels, placeholder, multiSelect, values));
82
82
  const [internalValues, setInternalValues] = useState(values);
83
+ const internalValuesRef = useRef(values);
83
84
  useEffect(() => {
84
85
  setInternalValues(values);
86
+ internalValuesRef.current = values;
85
87
  }, [values]);
86
88
  useEffect(() => {
87
89
  setSelectionLabel(getSelectionLabel(labels, placeholder, multiSelect, values));
@@ -100,7 +102,7 @@ const HvDropdown = forwardRef((props, ref) => {
100
102
  if (!open) {
101
103
  setValidationState(() => {
102
104
  if (required) {
103
- const hasSelection = getSelected(internalValues).length > 0;
105
+ const hasSelection = getSelected(internalValuesRef.current).length > 0;
104
106
  if (!hasSelection) {
105
107
  return "invalid";
106
108
  }
@@ -113,6 +115,7 @@ const HvDropdown = forwardRef((props, ref) => {
113
115
  const selected = getSelected(listValues);
114
116
  if (commitChanges) {
115
117
  setInternalValues(listValues);
118
+ internalValuesRef.current = listValues;
116
119
  setSelectionLabel(getSelectionLabel(labels, placeholder, multiSelect, listValues));
117
120
  setValidationState(() => {
118
121
  if (required && selected.length === 0) {