@hitachivantara/uikit-react-core 5.91.1 → 5.91.3

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 (98) hide show
  1. package/dist/cjs/BaseCheckBox/BaseCheckBox.cjs +7 -15
  2. package/dist/cjs/BaseCheckBox/BaseCheckBox.styles.cjs +8 -55
  3. package/dist/cjs/BaseCheckBox/CheckBoxIcon.cjs +74 -0
  4. package/dist/cjs/BaseInput/BaseInput.styles.cjs +3 -4
  5. package/dist/cjs/BaseRadio/BaseRadio.cjs +7 -17
  6. package/dist/cjs/BaseRadio/BaseRadio.styles.cjs +2 -26
  7. package/dist/cjs/BaseRadio/RadioIcon.cjs +49 -0
  8. package/dist/cjs/CheckBox/CheckBox.cjs +1 -1
  9. package/dist/cjs/CheckBox/CheckBox.styles.cjs +13 -39
  10. package/dist/cjs/Dropdown/Dropdown.cjs +1 -1
  11. package/dist/cjs/Dropdown/List/List.cjs +12 -18
  12. package/dist/cjs/Dropdown/List/List.styles.cjs +0 -2
  13. package/dist/cjs/InlineEditor/InlineEditor.cjs +1 -1
  14. package/dist/cjs/Input/Input.cjs +2 -1
  15. package/dist/cjs/Input/Input.styles.cjs +7 -1
  16. package/dist/cjs/Input/icons.cjs +19 -0
  17. package/dist/cjs/Radio/Radio.styles.cjs +8 -5
  18. package/dist/cjs/Tag/Tag.cjs +4 -4
  19. package/dist/cjs/Tag/Tag.styles.cjs +1 -2
  20. package/dist/cjs/TagsInput/TagsInput.cjs +1 -1
  21. package/dist/cjs/TimePicker/Unit/Unit.cjs +1 -2
  22. package/dist/cjs/TimePicker/Unit/Unit.styles.cjs +0 -6
  23. package/dist/cjs/TreeView/internals/hooks/useInstanceEventHandler.cjs +1 -1
  24. package/dist/cjs/VerticalNavigation/VerticalNavigation.styles.cjs +1 -4
  25. package/dist/cjs/icons.cjs +15 -0
  26. package/dist/esm/AppSwitcher/Action/Action.js.map +1 -1
  27. package/dist/esm/BaseCheckBox/BaseCheckBox.js +7 -15
  28. package/dist/esm/BaseCheckBox/BaseCheckBox.js.map +1 -1
  29. package/dist/esm/BaseCheckBox/BaseCheckBox.styles.js +8 -55
  30. package/dist/esm/BaseCheckBox/BaseCheckBox.styles.js.map +1 -1
  31. package/dist/esm/BaseCheckBox/CheckBoxIcon.js +74 -0
  32. package/dist/esm/BaseCheckBox/CheckBoxIcon.js.map +1 -0
  33. package/dist/esm/BaseInput/BaseInput.styles.js +3 -4
  34. package/dist/esm/BaseInput/BaseInput.styles.js.map +1 -1
  35. package/dist/esm/BaseRadio/BaseRadio.js +7 -17
  36. package/dist/esm/BaseRadio/BaseRadio.js.map +1 -1
  37. package/dist/esm/BaseRadio/BaseRadio.styles.js +2 -26
  38. package/dist/esm/BaseRadio/BaseRadio.styles.js.map +1 -1
  39. package/dist/esm/BaseRadio/RadioIcon.js +49 -0
  40. package/dist/esm/BaseRadio/RadioIcon.js.map +1 -0
  41. package/dist/esm/BreadCrumb/PathElement/PathElement.js.map +1 -1
  42. package/dist/esm/CheckBox/CheckBox.js +1 -1
  43. package/dist/esm/CheckBox/CheckBox.js.map +1 -1
  44. package/dist/esm/CheckBox/CheckBox.styles.js +13 -39
  45. package/dist/esm/CheckBox/CheckBox.styles.js.map +1 -1
  46. package/dist/esm/DotPagination/DotPagination.js.map +1 -1
  47. package/dist/esm/DropDownMenu/DropDownMenu.js.map +1 -1
  48. package/dist/esm/Dropdown/Dropdown.js +1 -1
  49. package/dist/esm/Dropdown/Dropdown.js.map +1 -1
  50. package/dist/esm/Dropdown/List/List.js +13 -19
  51. package/dist/esm/Dropdown/List/List.js.map +1 -1
  52. package/dist/esm/Dropdown/List/List.styles.js +0 -2
  53. package/dist/esm/Dropdown/List/List.styles.js.map +1 -1
  54. package/dist/esm/Dropdown/utils.js.map +1 -1
  55. package/dist/esm/FileUploader/Preview/Preview.js.map +1 -1
  56. package/dist/esm/Focus/Focus.js.map +1 -1
  57. package/dist/esm/InlineEditor/InlineEditor.js +1 -1
  58. package/dist/esm/InlineEditor/InlineEditor.js.map +1 -1
  59. package/dist/esm/Input/Input.js +3 -2
  60. package/dist/esm/Input/Input.js.map +1 -1
  61. package/dist/esm/Input/Input.styles.js +7 -1
  62. package/dist/esm/Input/Input.styles.js.map +1 -1
  63. package/dist/esm/Input/icons.js +19 -0
  64. package/dist/esm/Input/icons.js.map +1 -0
  65. package/dist/esm/MultiButton/MultiButton.js.map +1 -1
  66. package/dist/esm/Radio/Radio.styles.js +8 -5
  67. package/dist/esm/Radio/Radio.styles.js.map +1 -1
  68. package/dist/esm/Table/renderers/DateColumnCell.js.map +1 -1
  69. package/dist/esm/Table/renderers/ProgressColumnCell.js.map +1 -1
  70. package/dist/esm/Table/renderers/SwitchColumnCell.js.map +1 -1
  71. package/dist/esm/Tabs/Tab/Tab.js.map +1 -1
  72. package/dist/esm/Tag/Tag.js +5 -5
  73. package/dist/esm/Tag/Tag.js.map +1 -1
  74. package/dist/esm/Tag/Tag.styles.js +1 -2
  75. package/dist/esm/Tag/Tag.styles.js.map +1 -1
  76. package/dist/esm/TagsInput/TagsInput.js +1 -1
  77. package/dist/esm/TagsInput/TagsInput.js.map +1 -1
  78. package/dist/esm/TimePicker/Unit/Unit.js +1 -2
  79. package/dist/esm/TimePicker/Unit/Unit.js.map +1 -1
  80. package/dist/esm/TimePicker/Unit/Unit.styles.js +0 -6
  81. package/dist/esm/TimePicker/Unit/Unit.styles.js.map +1 -1
  82. package/dist/esm/Tooltip/Tooltip.js.map +1 -1
  83. package/dist/esm/TreeView/internals/hooks/useInstanceEventHandler.js +1 -1
  84. package/dist/esm/TreeView/internals/hooks/useInstanceEventHandler.js.map +1 -1
  85. package/dist/esm/VerticalNavigation/VerticalNavigation.styles.js +1 -4
  86. package/dist/esm/VerticalNavigation/VerticalNavigation.styles.js.map +1 -1
  87. package/dist/esm/hooks/useClickOutside.js.map +1 -1
  88. package/dist/esm/icons.js +13 -0
  89. package/dist/esm/icons.js.map +1 -0
  90. package/dist/esm/types/generic.js.map +1 -1
  91. package/dist/types/index.d.ts +34 -36
  92. package/package.json +9 -9
  93. package/dist/cjs/BaseCheckBox/icons.cjs +0 -15
  94. package/dist/cjs/BaseRadio/icons.cjs +0 -17
  95. package/dist/esm/BaseCheckBox/icons.js +0 -15
  96. package/dist/esm/BaseCheckBox/icons.js.map +0 -1
  97. package/dist/esm/BaseRadio/icons.js +0 -17
  98. package/dist/esm/BaseRadio/icons.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BaseRadio.styles.js","sources":["../../../src/BaseRadio/BaseRadio.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvBaseRadio\", {\n root: {\n padding: 0,\n width: 32,\n minWidth: 32,\n height: 32,\n cursor: \"pointer\",\n borderRadius: \"inherit\",\n \"& svg\": {\n width: 16,\n height: 16,\n borderRadius: theme.radii.full,\n border: `1px solid ${theme.colors.borderStrong}`,\n backgroundColor: theme.colors.bgContainer,\n },\n \":hover\": {\n backgroundColor: theme.colors.bgHover,\n },\n },\n disabled: {\n cursor: \"not-allowed\",\n pointerEvents: \"initial\",\n \"& svg\": {\n borderColor: theme.colors.textDisabled,\n backgroundColor: theme.colors.bgDisabled,\n },\n },\n focusVisible: {\n \"& svg\": {\n borderRadius: theme.radii.full,\n ...outlineStyles,\n },\n },\n icon: {},\n checked: {\n \"& svg\": {\n borderColor: \"transparent\",\n backgroundColor: theme.colors.primaryStrong,\n color: theme.colors.bgContainer,\n },\n \"&$disabled\": {\n \"& svg\": {\n borderColor: \"transparent\",\n backgroundColor: theme.colors.borderDisabled,\n color: theme.colors.bgDisabled,\n },\n },\n },\n semantic: {},\n});\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,eAAe;AAAA,EACxE,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,SAAS;AAAA,MACP,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,cAAc,MAAM,MAAM;AAAA,MAC1B,QAAQ,aAAa,MAAM,OAAO,YAAY;AAAA,MAC9C,iBAAiB,MAAM,OAAO;AAAA,IAChC;AAAA,IACA,UAAU;AAAA,MACR,iBAAiB,MAAM,OAAO;AAAA,IAAA;AAAA,EAElC;AAAA,EACA,UAAU;AAAA,IACR,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,SAAS;AAAA,MACP,aAAa,MAAM,OAAO;AAAA,MAC1B,iBAAiB,MAAM,OAAO;AAAA,IAAA;AAAA,EAElC;AAAA,EACA,cAAc;AAAA,IACZ,SAAS;AAAA,MACP,cAAc,MAAM,MAAM;AAAA,MAC1B,GAAG;AAAA,IAAA;AAAA,EAEP;AAAA,EACA,MAAM,CAAC;AAAA,EACP,SAAS;AAAA,IACP,SAAS;AAAA,MACP,aAAa;AAAA,MACb,iBAAiB,MAAM,OAAO;AAAA,MAC9B,OAAO,MAAM,OAAO;AAAA,IACtB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,QACP,aAAa;AAAA,QACb,iBAAiB,MAAM,OAAO;AAAA,QAC9B,OAAO,MAAM,OAAO;AAAA,MAAA;AAAA,IACtB;AAAA,EAEJ;AAAA,EACA,UAAU,CAAA;AACZ,CAAC;"}
1
+ {"version":3,"file":"BaseRadio.styles.js","sources":["../../../src/BaseRadio/BaseRadio.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvBaseRadio\", {\n root: {\n padding: 0,\n width: 32,\n minWidth: 32,\n height: 32,\n cursor: \"pointer\",\n borderRadius: \"inherit\",\n \":hover\": {\n backgroundColor: theme.colors.bgHover,\n },\n },\n disabled: {\n cursor: \"not-allowed\",\n pointerEvents: \"initial\",\n },\n focusVisible: {\n \"& svg\": {\n borderRadius: theme.radii.full,\n ...outlineStyles,\n },\n },\n icon: {},\n checked: {},\n semantic: {},\n});\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,eAAe;AAAA,EACxE,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,UAAU;AAAA,MACR,iBAAiB,MAAM,OAAO;AAAA,IAAA;AAAA,EAElC;AAAA,EACA,UAAU;AAAA,IACR,QAAQ;AAAA,IACR,eAAe;AAAA,EACjB;AAAA,EACA,cAAc;AAAA,IACZ,SAAS;AAAA,MACP,cAAc,MAAM,MAAM;AAAA,MAC1B,GAAG;AAAA,IAAA;AAAA,EAEP;AAAA,EACA,MAAM,CAAC;AAAA,EACP,SAAS,CAAC;AAAA,EACV,UAAU,CAAA;AACZ,CAAC;"}
@@ -0,0 +1,49 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useDefaultProps, createClasses } from "@hitachivantara/uikit-react-utils";
3
+ import { theme } from "@hitachivantara/uikit-styles";
4
+ import { SvgBase } from "../icons.js";
5
+ const { useClasses } = createClasses("HvRadioIcon", {
6
+ root: {
7
+ borderRadius: theme.radii.full,
8
+ border: `1px solid ${theme.colors.borderStrong}`,
9
+ backgroundColor: theme.colors.bgContainer
10
+ },
11
+ checked: {
12
+ borderColor: "transparent",
13
+ backgroundColor: theme.colors.primaryStrong,
14
+ color: theme.colors.bgContainer
15
+ },
16
+ disabled: {
17
+ borderColor: theme.colors.textDisabled,
18
+ backgroundColor: theme.colors.bgDisabled
19
+ },
20
+ checkedDisabled: {
21
+ borderColor: "transparent",
22
+ backgroundColor: theme.colors.borderDisabled,
23
+ color: theme.colors.bgDisabled
24
+ }
25
+ });
26
+ const HvRadioIcon = (props) => {
27
+ const {
28
+ className,
29
+ classes: classesProp,
30
+ checked,
31
+ disabled
32
+ } = useDefaultProps("HvRadioIcon", props);
33
+ const { classes, cx } = useClasses(classesProp, false);
34
+ return /* @__PURE__ */ jsx(
35
+ SvgBase,
36
+ {
37
+ viewBox: "0 0 16 16",
38
+ className: cx(classes.root, className, {
39
+ [classes.checked]: checked,
40
+ [classes.disabled]: disabled,
41
+ [classes.checkedDisabled]: checked && disabled
42
+ }),
43
+ children: checked && /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "4.5" })
44
+ }
45
+ );
46
+ };
47
+ export {
48
+ HvRadioIcon
49
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioIcon.js","sources":["../../../src/BaseRadio/RadioIcon.tsx"],"sourcesContent":["import {\n createClasses,\n ExtractNames,\n useDefaultProps,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { SvgBase } from \"../icons\";\nimport type { HvBaseRadioProps } from \"./BaseRadio\";\n\nconst { useClasses } = createClasses(\"HvRadioIcon\", {\n root: {\n borderRadius: theme.radii.full,\n border: `1px solid ${theme.colors.borderStrong}`,\n backgroundColor: theme.colors.bgContainer,\n },\n checked: {\n borderColor: \"transparent\",\n backgroundColor: theme.colors.primaryStrong,\n color: theme.colors.bgContainer,\n },\n disabled: {\n borderColor: theme.colors.textDisabled,\n backgroundColor: theme.colors.bgDisabled,\n },\n checkedDisabled: {\n borderColor: \"transparent\",\n backgroundColor: theme.colors.borderDisabled,\n color: theme.colors.bgDisabled,\n },\n});\n\nexport type HvRadioIconClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvRadioIconProps\n extends Pick<HvBaseRadioProps, \"checked\" | \"disabled\" | \"className\"> {\n classes?: HvRadioIconClasses;\n}\n\nexport const HvRadioIcon = (props: HvRadioIconProps) => {\n const {\n className,\n classes: classesProp,\n checked,\n disabled,\n } = useDefaultProps(\"HvRadioIcon\", props);\n const { classes, cx } = useClasses(classesProp, false);\n\n return (\n <SvgBase\n viewBox=\"0 0 16 16\"\n className={cx(classes.root, className, {\n [classes.checked]: checked,\n [classes.disabled]: disabled,\n [classes.checkedDisabled]: checked && disabled,\n })}\n >\n {checked && <circle cx=\"8\" cy=\"8\" r=\"4.5\" />}\n </SvgBase>\n );\n};\n"],"names":[],"mappings":";;;;AAUA,MAAM,EAAE,WAAA,IAAe,cAAc,eAAe;AAAA,EAClD,MAAM;AAAA,IACJ,cAAc,MAAM,MAAM;AAAA,IAC1B,QAAQ,aAAa,MAAM,OAAO,YAAY;AAAA,IAC9C,iBAAiB,MAAM,OAAO;AAAA,EAChC;AAAA,EACA,SAAS;AAAA,IACP,aAAa;AAAA,IACb,iBAAiB,MAAM,OAAO;AAAA,IAC9B,OAAO,MAAM,OAAO;AAAA,EACtB;AAAA,EACA,UAAU;AAAA,IACR,aAAa,MAAM,OAAO;AAAA,IAC1B,iBAAiB,MAAM,OAAO;AAAA,EAChC;AAAA,EACA,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB,MAAM,OAAO;AAAA,IAC9B,OAAO,MAAM,OAAO;AAAA,EAAA;AAExB,CAAC;AASY,MAAA,cAAc,CAAC,UAA4B;AAChD,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EAAA,IACE,gBAAgB,eAAe,KAAK;AACxC,QAAM,EAAE,SAAS,GAAA,IAAO,WAAW,aAAa,KAAK;AAGnD,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,WAAW,GAAG,QAAQ,MAAM,WAAW;AAAA,QACrC,CAAC,QAAQ,OAAO,GAAG;AAAA,QACnB,CAAC,QAAQ,QAAQ,GAAG;AAAA,QACpB,CAAC,QAAQ,eAAe,GAAG,WAAW;AAAA,MAAA,CACvC;AAAA,MAEA,UAAA,+BAAY,UAAO,EAAA,IAAG,KAAI,IAAG,KAAI,GAAE,MAAM,CAAA;AAAA,IAAA;AAAA,EAC5C;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PathElement.js","sources":["../../../../src/BreadCrumb/PathElement/PathElement.tsx"],"sourcesContent":["import { DropRightXS } from \"@hitachivantara/uikit-react-icons\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\n\nimport { staticClasses, useClasses } from \"./PathElement.styles\";\n\nexport { staticClasses as pathElementClasses };\n\nexport type HvPathElementClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvPathElementProps {\n last?: boolean;\n classes?: HvPathElementClasses;\n children: React.ReactElement;\n}\n\nexport const HvPathElement = ({\n classes: classesProp,\n last = false,\n children,\n}: HvPathElementProps) => {\n const { classes } = useClasses(classesProp);\n\n return (\n <li className={classes.centerContainer}>\n {children}\n {!last && (\n <DropRightXS\n className={classes.separatorContainer}\n color=\"textDisabled\"\n />\n )}\n </li>\n );\n};\n"],"names":[],"mappings":";;;;AAeO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,SAAS;AAAA,EACT,OAAO;AAAA,EACP;AACF,MAA0B;AACxB,QAAM,EAAE,QAAA,IAAY,WAAW,WAAW;AAE1C,SACG,qBAAA,MAAA,EAAG,WAAW,QAAQ,iBACpB,UAAA;AAAA,IAAA;AAAA,IACA,CAAC,QACA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,QAAQ;AAAA,QACnB,OAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACR,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"PathElement.js","sources":["../../../../src/BreadCrumb/PathElement/PathElement.tsx"],"sourcesContent":["import { DropRightXS } from \"@hitachivantara/uikit-react-icons\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\n\nimport { staticClasses, useClasses } from \"./PathElement.styles\";\n\nexport { staticClasses as pathElementClasses };\n\nexport type HvPathElementClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvPathElementProps {\n last?: boolean;\n classes?: HvPathElementClasses;\n children: React.ReactElement<any>;\n}\n\nexport const HvPathElement = ({\n classes: classesProp,\n last = false,\n children,\n}: HvPathElementProps) => {\n const { classes } = useClasses(classesProp);\n\n return (\n <li className={classes.centerContainer}>\n {children}\n {!last && (\n <DropRightXS\n className={classes.separatorContainer}\n color=\"textDisabled\"\n />\n )}\n </li>\n );\n};\n"],"names":[],"mappings":";;;;AAeO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,SAAS;AAAA,EACT,OAAO;AAAA,EACP;AACF,MAA0B;AACxB,QAAM,EAAE,QAAA,IAAY,WAAW,WAAW;AAE1C,SACG,qBAAA,MAAA,EAAG,WAAW,QAAQ,iBACpB,UAAA;AAAA,IAAA;AAAA,IACA,CAAC,QACA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,QAAQ;AAAA,QACnB,OAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACR,GAEJ;AAEJ;"}
@@ -153,6 +153,7 @@ const HvCheckBox = forwardRef(
153
153
  /* @__PURE__ */ jsx(
154
154
  HvLabel,
155
155
  {
156
+ noWrap: true,
156
157
  id: setId(elementId, "label"),
157
158
  htmlFor: setId(elementId, "input"),
158
159
  label,
@@ -169,7 +170,6 @@ const HvCheckBox = forwardRef(
169
170
  id: setId(elementId, "error"),
170
171
  disableAdornment: !hasLabel,
171
172
  hideText: !hasLabel,
172
- disableBorder: true,
173
173
  children: validationMessage
174
174
  }
175
175
  )
@@ -1 +1 @@
1
- {"version":3,"file":"CheckBox.js","sources":["../../../src/CheckBox/CheckBox.tsx"],"sourcesContent":["import { forwardRef, useCallback, useState } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseCheckBox, HvBaseCheckBoxProps } from \"../BaseCheckBox\";\nimport {\n HvFormElement,\n HvFormStatus,\n HvLabel,\n HvLabelProps,\n HvWarningText,\n isInvalid,\n} from \"../FormElement\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./CheckBox.styles\";\n\nexport { staticClasses as checkBoxClasses };\n\nexport type HvCheckBoxClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvCheckBoxProps extends Omit<HvBaseCheckBoxProps, \"classes\"> {\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 inputted via inputProps.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\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 * A Jss Object used to override or extend the styles applied to the checkbox.\n */\n classes?: HvCheckBoxClasses;\n}\n\n/**\n * A Checkbox is a mechanism that allows the user to select one or more options.\n *\n * Usually used in a Checkbox Group to present the user with a range of options from\n * which the user **may select any number of options** to complete their task.\n *\n * It can also be used individually to represent the toggle of a single option, when\n * the Toggle Switch and Toggle Button aren't more appropriate.\n */\nexport const HvCheckBox = forwardRef<HTMLButtonElement, HvCheckBoxProps>(\n function HvCheckBox(props, ref) {\n const {\n id,\n classes: classesProp,\n className,\n name,\n checked,\n status,\n indeterminate,\n statusMessage,\n label,\n labelProps,\n inputProps,\n value = \"on\",\n required,\n readOnly,\n disabled,\n semantic,\n defaultChecked,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n onChange,\n onFocusVisible,\n onBlur,\n ...others\n } = useDefaultProps(\"HvCheckBox\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id);\n\n const [focusVisible, setFocusVisible] = useState<boolean>(false);\n\n const [validationState, setValidationState] = useControlled<HvFormStatus>(\n status,\n \"standBy\",\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked),\n );\n\n const [isIndeterminate, setIsIndeterminate] = useControlled(\n checked !== undefined ? indeterminate : undefined,\n Boolean(indeterminate),\n );\n\n const isStateInvalid = isInvalid(validationState);\n\n const onChangeCallback = useCallback<\n NonNullable<HvBaseCheckBoxProps[\"onChange\"]>\n >(\n (event, newChecked) => {\n setIsChecked(() => {\n // This will only run if uncontrolled\n setIsIndeterminate(false);\n\n if (required && !newChecked) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newChecked;\n });\n\n onChange?.(event, newChecked, value);\n },\n [\n onChange,\n required,\n setIsChecked,\n setIsIndeterminate,\n setValidationState,\n value,\n ],\n );\n\n const onFocusVisibleCallback: HvBaseCheckBoxProps[\"onBlur\"] = (event) => {\n setFocusVisible(true);\n onFocusVisible?.(event);\n };\n\n const onBlurCallback: HvBaseCheckBoxProps[\"onBlur\"] = (event) => {\n setFocusVisible(false);\n onBlur?.(event);\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 hasLabel = label != null;\n\n let errorMessageId;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n const checkbox = (\n <HvBaseCheckBox\n ref={ref}\n id={hasLabel ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n className={cx(classes.checkbox, {\n [classes.invalidCheckbox]: !label && isStateInvalid,\n [classes.checked]: isChecked,\n [classes.indeterminate]: isIndeterminate,\n [classes.semantic]: semantic,\n })}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n onChange={onChangeCallback}\n value={value}\n checked={isChecked}\n indeterminate={isIndeterminate}\n semantic={semantic}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n onFocusVisible={onFocusVisibleCallback}\n onBlur={onBlurCallback}\n {...others}\n />\n );\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(\n classes.root,\n { [classes.focusVisible]: !!(focusVisible && label) },\n className,\n )}\n >\n {hasLabel ? (\n <div\n className={cx(classes.container, {\n [classes.disabled]: disabled,\n [classes.invalidContainer]: isStateInvalid,\n })}\n >\n {checkbox}\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n </div>\n ) : (\n checkbox\n )}\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableAdornment={!hasLabel}\n hideText={!hasLabel}\n disableBorder\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n },\n);\n"],"names":["HvCheckBox"],"mappings":";;;;;;;;;;;;;AAkEO,MAAM,aAAa;AAAA,EACxB,SAASA,YAAW,OAAO,KAAK;AACxB,UAAA;AAAA,MACJ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,qBAAqB;AAA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AAC;AAAA,kBAAA;AAAA,oBACC,IAAI,MAAM,WAAW,OAAO;AAAA,oBAC5B,SAAS,MAAM,WAAW,OAAO;AAAA,oBACjC;AAAA,oBACA,WAAW,QAAQ;AAAA,oBAClB,GAAG;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACN;AAAA,YAAA;AAAA,UAAA,IAGF;AAAA,UAED,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI,MAAM,WAAW,OAAO;AAAA,cAC5B,kBAAkB,CAAC;AAAA,cACnB,UAAU,CAAC;AAAA,cACX,eAAa;AAAA,cAEZ,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"CheckBox.js","sources":["../../../src/CheckBox/CheckBox.tsx"],"sourcesContent":["import { forwardRef, useCallback, useState } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseCheckBox, HvBaseCheckBoxProps } from \"../BaseCheckBox\";\nimport {\n HvFormElement,\n HvFormStatus,\n HvLabel,\n HvLabelProps,\n HvWarningText,\n isInvalid,\n} from \"../FormElement\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./CheckBox.styles\";\n\nexport { staticClasses as checkBoxClasses };\n\nexport type HvCheckBoxClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvCheckBoxProps extends Omit<HvBaseCheckBoxProps, \"classes\"> {\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 inputted via inputProps.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\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 * A Jss Object used to override or extend the styles applied to the checkbox.\n */\n classes?: HvCheckBoxClasses;\n}\n\n/**\n * A Checkbox is a mechanism that allows the user to select one or more options.\n *\n * Usually used in a Checkbox Group to present the user with a range of options from\n * which the user **may select any number of options** to complete their task.\n *\n * It can also be used individually to represent the toggle of a single option, when\n * the Toggle Switch and Toggle Button aren't more appropriate.\n */\nexport const HvCheckBox = forwardRef<HTMLButtonElement, HvCheckBoxProps>(\n function HvCheckBox(props, ref) {\n const {\n id,\n classes: classesProp,\n className,\n name,\n checked,\n status,\n indeterminate,\n statusMessage,\n label,\n labelProps,\n inputProps,\n value = \"on\",\n required,\n readOnly,\n disabled,\n semantic,\n defaultChecked,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n onChange,\n onFocusVisible,\n onBlur,\n ...others\n } = useDefaultProps(\"HvCheckBox\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id);\n\n const [focusVisible, setFocusVisible] = useState<boolean>(false);\n\n const [validationState, setValidationState] = useControlled<HvFormStatus>(\n status,\n \"standBy\",\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked),\n );\n\n const [isIndeterminate, setIsIndeterminate] = useControlled(\n checked !== undefined ? indeterminate : undefined,\n Boolean(indeterminate),\n );\n\n const isStateInvalid = isInvalid(validationState);\n\n const onChangeCallback = useCallback<\n NonNullable<HvBaseCheckBoxProps[\"onChange\"]>\n >(\n (event, newChecked) => {\n setIsChecked(() => {\n // This will only run if uncontrolled\n setIsIndeterminate(false);\n\n if (required && !newChecked) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newChecked;\n });\n\n onChange?.(event, newChecked, value);\n },\n [\n onChange,\n required,\n setIsChecked,\n setIsIndeterminate,\n setValidationState,\n value,\n ],\n );\n\n const onFocusVisibleCallback: HvBaseCheckBoxProps[\"onBlur\"] = (event) => {\n setFocusVisible(true);\n onFocusVisible?.(event);\n };\n\n const onBlurCallback: HvBaseCheckBoxProps[\"onBlur\"] = (event) => {\n setFocusVisible(false);\n onBlur?.(event);\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 hasLabel = label != null;\n\n let errorMessageId;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n const checkbox = (\n <HvBaseCheckBox\n ref={ref}\n id={hasLabel ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n className={cx(classes.checkbox, {\n [classes.invalidCheckbox]: !label && isStateInvalid,\n [classes.checked]: isChecked,\n [classes.indeterminate]: isIndeterminate,\n [classes.semantic]: semantic,\n })}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n onChange={onChangeCallback}\n value={value}\n checked={isChecked}\n indeterminate={isIndeterminate}\n semantic={semantic}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n onFocusVisible={onFocusVisibleCallback}\n onBlur={onBlurCallback}\n {...others}\n />\n );\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(\n classes.root,\n { [classes.focusVisible]: !!(focusVisible && label) },\n className,\n )}\n >\n {hasLabel ? (\n <div\n className={cx(classes.container, {\n [classes.disabled]: disabled,\n [classes.invalidContainer]: isStateInvalid,\n })}\n >\n {checkbox}\n <HvLabel\n noWrap\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n </div>\n ) : (\n checkbox\n )}\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableAdornment={!hasLabel}\n hideText={!hasLabel}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n },\n);\n"],"names":["HvCheckBox"],"mappings":";;;;;;;;;;;;;AAkEO,MAAM,aAAa;AAAA,EACxB,SAASA,YAAW,OAAO,KAAK;AACxB,UAAA;AAAA,MACJ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,qBAAqB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACD,gBAAgB,cAAc,KAAK;AAEvC,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,YAAY,YAAY,EAAE;AAEhC,UAAM,CAAC,cAAc,eAAe,IAAI,SAAkB,KAAK;AAEzD,UAAA,CAAC,iBAAiB,kBAAkB,IAAI;AAAA,MAC5C;AAAA,MACA;AAAA,IACF;AAEA,UAAM,CAAC,iBAAiB,IAAI,cAAc,eAAe,UAAU;AAE7D,UAAA,CAAC,WAAW,YAAY,IAAI;AAAA,MAChC;AAAA,MACA,QAAQ,cAAc;AAAA,IACxB;AAEM,UAAA,CAAC,iBAAiB,kBAAkB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AGN;"}
@@ -6,58 +6,32 @@ const { staticClasses, useClasses } = createClasses("HvCheckBox", {
6
6
  container: {
7
7
  cursor: "pointer",
8
8
  display: "flex",
9
- height: "32px",
9
+ alignItems: "center",
10
10
  transition: "background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
11
- "&:hover": {
12
- backgroundColor: theme.colors.bgHover,
13
- borderRadius: theme.radii.base
11
+ borderRadius: theme.radii.base,
12
+ "&:hover:not($disabled)": {
13
+ backgroundColor: theme.colors.bgHover
14
+ },
15
+ ":where(:has($label)) $checkbox": {
16
+ borderRadius: "inherit"
14
17
  }
15
18
  },
19
+ invalidContainer: {},
16
20
  disabled: {
17
21
  cursor: "not-allowed",
18
- "& $label": { color: theme.colors.textDisabled, cursor: "not-allowed" },
19
- "&:hover": {
20
- backgroundColor: "transparent"
21
- }
22
+ "& $label": { color: theme.colors.textDisabled, cursor: "not-allowed" }
22
23
  },
23
24
  focusVisible: {
24
- ...outlineStyles,
25
- "& div": {
26
- backgroundColor: theme.colors.bgPageSecondary
27
- },
28
- [`& $checkbox div > svg`]: {
29
- outline: "none",
30
- boxShadow: "none"
31
- }
32
- },
33
- invalidContainer: {
34
- borderBottom: `1px solid ${theme.form.errorColor}`,
35
- "&:hover": {
36
- borderBottomLeftRadius: "0px",
37
- borderBottomRightRadius: "0px"
38
- }
39
- },
40
- checkbox: { height: "32px" },
41
- invalidCheckbox: {
42
- "::after": {
43
- content: '""',
44
- position: "absolute",
45
- bottom: 0,
46
- left: 0,
47
- width: "100%",
48
- height: 1,
49
- backgroundColor: theme.form.errorColor
50
- }
25
+ backgroundColor: theme.colors.bgPageSecondary,
26
+ ...outlineStyles
51
27
  },
28
+ checkbox: {},
29
+ invalidCheckbox: {},
52
30
  label: {
53
- overflow: "hidden",
54
- textOverflow: "ellipsis",
55
31
  verticalAlign: "middle",
56
32
  paddingRight: theme.space.xs,
57
- whiteSpace: "nowrap",
58
33
  ...theme.typography.body,
59
34
  cursor: "pointer",
60
- height: "32px",
61
35
  lineHeight: "32px",
62
36
  width: "100%"
63
37
  },
@@ -1 +1 @@
1
- {"version":3,"file":"CheckBox.styles.js","sources":["../../../src/CheckBox/CheckBox.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvCheckBox\", {\n root: { display: \"inline-block\" },\n container: {\n cursor: \"pointer\",\n display: \"flex\",\n height: \"32px\",\n transition: \"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms\",\n\n \"&:hover\": {\n backgroundColor: theme.colors.bgHover,\n borderRadius: theme.radii.base,\n },\n },\n disabled: {\n cursor: \"not-allowed\",\n \"& $label\": { color: theme.colors.textDisabled, cursor: \"not-allowed\" },\n \"&:hover\": {\n backgroundColor: \"transparent\",\n },\n },\n focusVisible: {\n ...outlineStyles,\n\n \"& div\": {\n backgroundColor: theme.colors.bgPageSecondary,\n },\n\n [`& $checkbox div > svg`]: {\n outline: \"none\",\n boxShadow: \"none\",\n },\n },\n invalidContainer: {\n borderBottom: `1px solid ${theme.form.errorColor}`,\n\n \"&:hover\": {\n borderBottomLeftRadius: \"0px\",\n borderBottomRightRadius: \"0px\",\n },\n },\n checkbox: { height: \"32px\" },\n invalidCheckbox: {\n \"::after\": {\n content: '\"\"',\n position: \"absolute\",\n bottom: 0,\n left: 0,\n width: \"100%\",\n height: 1,\n backgroundColor: theme.form.errorColor,\n },\n },\n label: {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n verticalAlign: \"middle\",\n paddingRight: theme.space.xs,\n whiteSpace: \"nowrap\",\n ...theme.typography.body,\n cursor: \"pointer\",\n height: \"32px\",\n lineHeight: \"32px\",\n width: \"100%\",\n },\n checked: {},\n indeterminate: {},\n semantic: {},\n});\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,cAAc;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AA,EAChB,UAAU,CAAA;AACZ,CAAC;"}
1
+ {"version":3,"file":"CheckBox.styles.js","sources":["../../../src/CheckBox/CheckBox.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvCheckBox\", {\n root: { display: \"inline-block\" },\n container: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n transition: \"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms\",\n borderRadius: theme.radii.base,\n\n \"&:hover:not($disabled)\": {\n backgroundColor: theme.colors.bgHover,\n },\n \":where(:has($label)) $checkbox\": {\n borderRadius: \"inherit\",\n },\n },\n invalidContainer: {},\n disabled: {\n cursor: \"not-allowed\",\n \"& $label\": { color: theme.colors.textDisabled, cursor: \"not-allowed\" },\n },\n focusVisible: {\n backgroundColor: theme.colors.bgPageSecondary,\n ...outlineStyles,\n },\n checkbox: {},\n invalidCheckbox: {},\n label: {\n verticalAlign: \"middle\",\n paddingRight: theme.space.xs,\n ...theme.typography.body,\n cursor: \"pointer\",\n lineHeight: \"32px\",\n width: \"100%\",\n },\n checked: {},\n indeterminate: {},\n semantic: {},\n});\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,cAAc;AAAA,EACvE,MAAM,EAAE,SAAS,eAAe;AAAA,EAChC,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc,MAAM,MAAM;AAAA,IAE1B,0BAA0B;AAAA,MACxB,iBAAiB,MAAM,OAAO;AAAA,IAChC;AAAA,IACA,kCAAkC;AAAA,MAChC,cAAc;AAAA,IAAA;AAAA,EAElB;AAAA,EACA,kBAAkB,CAAC;AAAA,EACnB,UAAU;AAAA,IACR,QAAQ;AAAA,IACR,YAAY,EAAE,OAAO,MAAM,OAAO,cAAc,QAAQ,cAAc;AAAA,EACxE;AAAA,EACA,cAAc;AAAA,IACZ,iBAAiB,MAAM,OAAO;AAAA,IAC9B,GAAG;AAAA,EACL;AAAA,EACA,UAAU,CAAC;AAAA,EACX,iBAAiB,CAAC;AAAA,EAClB,OAAO;AAAA,IACL,eAAe;AAAA,IACf,cAAc,MAAM,MAAM;AAAA,IAC1B,GAAG,MAAM,WAAW;AAAA,IACpB,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,EACT;AAAA,EACA,SAAS,CAAC;AAAA,EACV,eAAe,CAAC;AAAA,EAChB,UAAU,CAAA;AACZ,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DotPagination.js","sources":["../../../src/DotPagination/DotPagination.tsx"],"sourcesContent":["import { cloneElement } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseRadio } from \"../BaseRadio\";\nimport { HvRadioGroup, HvRadioGroupProps } from \"../RadioGroup\";\nimport { range } from \"../utils/helpers\";\nimport { staticClasses, useClasses } from \"./DotPagination.styles\";\n\nconst currentStep = (\n <div style={{ fontSize: 8 }}>\n <div />\n </div>\n);\n\nconst otherStep = (\n <div style={{ fontSize: 4 }}>\n <div />\n </div>\n);\n\nexport { staticClasses as dotPaginationClasses };\n\nexport type HvDotPaginationClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDotPaginationProps\n extends Omit<HvRadioGroupProps, \"classes\"> {\n /**\n * Icon to override the default one used for the unselected state.\n *\n * The default icon is `OtherStep`.\n */\n unselectedIcon?: React.ReactElement;\n /**\n * Icon to override the default one used for the selected state.\n *\n * The default icon is `CurrentStep`.\n */\n selectedIcon?: React.ReactElement;\n /**\n * The number of pages the component has.\n */\n pages?: number;\n /**\n * The currently selected page.\n */\n page?: number;\n /**\n * The callback fired when the page value changes.\n */\n onPageChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n page: number,\n ) => void;\n /**\n * The callback fired to get the page aria label.\n */\n getItemAriaLabel?: (page: number) => string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvDotPaginationClasses;\n}\n\nconst getSelectorIcons = (\n radioIcon?: React.ReactElement,\n radioCheckedIcon?: React.ReactElement,\n classes?: HvDotPaginationClasses,\n) => {\n return {\n radio: cloneElement(radioIcon || otherStep, {\n className: classes?.icon,\n }),\n radioChecked: cloneElement(radioCheckedIcon || currentStep, {\n className: classes?.icon,\n }),\n };\n};\n\n/**\n * Pagination is the process of dividing a document into discrete pages. It relates to how users interact with structured content on a website or application.\n * This component uses Radio Buttons to represent each page.\n */\nexport const HvDotPagination = (props: HvDotPaginationProps) => {\n const {\n className,\n classes: classesProp,\n unselectedIcon,\n selectedIcon,\n pages = 1,\n page = 0,\n onPageChange,\n getItemAriaLabel,\n ...others\n } = useDefaultProps(\"HvDotPagination\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const icons = getSelectorIcons(unselectedIcon, selectedIcon, classes);\n\n return (\n <HvRadioGroup\n className={cx(classes.root, className)}\n classes={{\n horizontal: classes.horizontal,\n }}\n orientation=\"horizontal\"\n {...others}\n >\n {range(pages).map((i) => (\n <HvBaseRadio\n className={cx(classes.radioRoot, classes.radio)}\n key={i}\n value={i}\n checked={page === i}\n onChange={(event) => onPageChange?.(event, i)}\n icon={icons.radio}\n checkedIcon={icons.radioChecked}\n inputProps={{ \"aria-label\": getItemAriaLabel?.(i) }}\n />\n ))}\n </HvRadioGroup>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAWA,MAAM,cACH,oBAAA,OAAA,EAAI,OAAO,EAAE,UAAU,EAAE,GACxB,UAAC,oBAAA,OAAA,CAAA,CAAI,EACP,CAAA;AAGF,MAAM,YACH,oBAAA,OAAA,EAAI,OAAO,EAAE,UAAU,EAAE,GACxB,UAAC,oBAAA,OAAA,CAAA,CAAI,EACP,CAAA;AA8CF,MAAM,mBAAmB,CACvB,WACA,kBACA,YACG;AACI,SAAA;AAAA,IACL,OAAO,aAAa,aAAa,WAAW;AAAA,MAC1C,WAAW,SAAS;AAAA,IAAA,CACrB;AAAA,IACD,cAAc,aAAa,oBAAoB,aAAa;AAAA,MAC1D,WAAW,SAAS;AAAA,IACrB,CAAA;AAAA,EACH;AACF;AAMa,MAAA,kBAAkB,CAAC,UAAgC;AACxD,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,mBAAmB,KAAK;AAE5C,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAE9C,QAAM,QAAQ,iBAAiB,gBAAgB,cAAc,OAAO;AAGlE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,GAAG,QAAQ,MAAM,SAAS;AAAA,MACrC,SAAS;AAAA,QACP,YAAY,QAAQ;AAAA,MACtB;AAAA,MACA,aAAY;AAAA,MACX,GAAG;AAAA,MAEH,UAAM,MAAA,KAAK,EAAE,IAAI,CAAC,MACjB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW,GAAG,QAAQ,WAAW,QAAQ,KAAK;AAAA,UAE9C,OAAO;AAAA,UACP,SAAS,SAAS;AAAA,UAClB,UAAU,CAAC,UAAU,eAAe,OAAO,CAAC;AAAA,UAC5C,MAAM,MAAM;AAAA,UACZ,aAAa,MAAM;AAAA,UACnB,YAAY,EAAE,cAAc,mBAAmB,CAAC,EAAE;AAAA,QAAA;AAAA,QAN7C;AAAA,MAQR,CAAA;AAAA,IAAA;AAAA,EACH;AAEJ;"}
1
+ {"version":3,"file":"DotPagination.js","sources":["../../../src/DotPagination/DotPagination.tsx"],"sourcesContent":["import { cloneElement } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseRadio } from \"../BaseRadio\";\nimport { HvRadioGroup, HvRadioGroupProps } from \"../RadioGroup\";\nimport { range } from \"../utils/helpers\";\nimport { staticClasses, useClasses } from \"./DotPagination.styles\";\n\nconst currentStep = (\n <div style={{ fontSize: 8 }}>\n <div />\n </div>\n);\n\nconst otherStep = (\n <div style={{ fontSize: 4 }}>\n <div />\n </div>\n);\n\nexport { staticClasses as dotPaginationClasses };\n\nexport type HvDotPaginationClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDotPaginationProps\n extends Omit<HvRadioGroupProps, \"classes\"> {\n /**\n * Icon to override the default one used for the unselected state.\n *\n * The default icon is `OtherStep`.\n */\n unselectedIcon?: React.ReactElement<any>;\n /**\n * Icon to override the default one used for the selected state.\n *\n * The default icon is `CurrentStep`.\n */\n selectedIcon?: React.ReactElement<any>;\n /**\n * The number of pages the component has.\n */\n pages?: number;\n /**\n * The currently selected page.\n */\n page?: number;\n /**\n * The callback fired when the page value changes.\n */\n onPageChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n page: number,\n ) => void;\n /**\n * The callback fired to get the page aria label.\n */\n getItemAriaLabel?: (page: number) => string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvDotPaginationClasses;\n}\n\nconst getSelectorIcons = (\n radioIcon?: React.ReactElement<any>,\n radioCheckedIcon?: React.ReactElement<any>,\n classes?: HvDotPaginationClasses,\n) => {\n return {\n radio: cloneElement(radioIcon || otherStep, {\n className: classes?.icon,\n }),\n radioChecked: cloneElement(radioCheckedIcon || currentStep, {\n className: classes?.icon,\n }),\n };\n};\n\n/**\n * Pagination is the process of dividing a document into discrete pages. It relates to how users interact with structured content on a website or application.\n * This component uses Radio Buttons to represent each page.\n */\nexport const HvDotPagination = (props: HvDotPaginationProps) => {\n const {\n className,\n classes: classesProp,\n unselectedIcon,\n selectedIcon,\n pages = 1,\n page = 0,\n onPageChange,\n getItemAriaLabel,\n ...others\n } = useDefaultProps(\"HvDotPagination\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const icons = getSelectorIcons(unselectedIcon, selectedIcon, classes);\n\n return (\n <HvRadioGroup\n className={cx(classes.root, className)}\n classes={{\n horizontal: classes.horizontal,\n }}\n orientation=\"horizontal\"\n {...others}\n >\n {range(pages).map((i) => (\n <HvBaseRadio\n className={cx(classes.radioRoot, classes.radio)}\n key={i}\n value={i}\n checked={page === i}\n onChange={(event) => onPageChange?.(event, i)}\n icon={icons.radio}\n checkedIcon={icons.radioChecked}\n inputProps={{ \"aria-label\": getItemAriaLabel?.(i) }}\n />\n ))}\n </HvRadioGroup>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAWA,MAAM,cACH,oBAAA,OAAA,EAAI,OAAO,EAAE,UAAU,EAAE,GACxB,UAAC,oBAAA,OAAA,CAAA,CAAI,EACP,CAAA;AAGF,MAAM,YACH,oBAAA,OAAA,EAAI,OAAO,EAAE,UAAU,EAAE,GACxB,UAAC,oBAAA,OAAA,CAAA,CAAI,EACP,CAAA;AA8CF,MAAM,mBAAmB,CACvB,WACA,kBACA,YACG;AACI,SAAA;AAAA,IACL,OAAO,aAAa,aAAa,WAAW;AAAA,MAC1C,WAAW,SAAS;AAAA,IAAA,CACrB;AAAA,IACD,cAAc,aAAa,oBAAoB,aAAa;AAAA,MAC1D,WAAW,SAAS;AAAA,IACrB,CAAA;AAAA,EACH;AACF;AAMa,MAAA,kBAAkB,CAAC,UAAgC;AACxD,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,mBAAmB,KAAK;AAE5C,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAE9C,QAAM,QAAQ,iBAAiB,gBAAgB,cAAc,OAAO;AAGlE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,GAAG,QAAQ,MAAM,SAAS;AAAA,MACrC,SAAS;AAAA,QACP,YAAY,QAAQ;AAAA,MACtB;AAAA,MACA,aAAY;AAAA,MACX,GAAG;AAAA,MAEH,UAAM,MAAA,KAAK,EAAE,IAAI,CAAC,MACjB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW,GAAG,QAAQ,WAAW,QAAQ,KAAK;AAAA,UAE9C,OAAO;AAAA,UACP,SAAS,SAAS;AAAA,UAClB,UAAU,CAAC,UAAU,eAAe,OAAO,CAAC;AAAA,UAC5C,MAAM,MAAM;AAAA,UACZ,aAAa,MAAM;AAAA,UACnB,YAAY,EAAE,cAAc,mBAAmB,CAAC,EAAE;AAAA,QAAA;AAAA,QAN7C;AAAA,MAQR,CAAA;AAAA,IAAA;AAAA,EACH;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropDownMenu.js","sources":["../../../src/DropDownMenu/DropDownMenu.tsx"],"sourcesContent":["import { forwardRef, useMemo } from \"react\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { HvSize } from \"@hitachivantara/uikit-styles\";\n\nimport { HvBaseDropdown } from \"../BaseDropdown\";\nimport { useBaseDropdownContext } from \"../BaseDropdown/context\";\nimport { HvButtonVariant } from \"../Button\";\nimport { HvDropdownButton, HvDropdownButtonProps } from \"../DropdownButton\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useLabels } from \"../hooks/useLabels\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { HvList, HvListProps, HvListValue } from \"../List\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { getPrevNextFocus } from \"../utils/focusableElementFinder\";\nimport { isKey } from \"../utils/keyboardUtils\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./DropDownMenu.styles\";\n\nexport { staticClasses as dropDownMenuClasses };\n\nexport type HvDropDownMenuClasses = ExtractNames<typeof useClasses>;\n\nconst DEFAULT_LABELS = {\n dropdownMenu: \"Dropdown menu\",\n};\n\nexport interface HvDropDownMenuProps\n extends HvBaseProps<HTMLDivElement, \"onClick\" | \"onToggle\"> {\n /** Icon. */\n icon?: React.ReactElement;\n /**\n * A list containing the elements to be rendered.\n *\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - icon: The icon node to be rendered on the left.\n * - showNavIcon: If true renders the navigation icon on the right.\n */\n dataList: HvListValue[];\n /** Placement of the dropdown. */\n placement?: \"left\" | \"right\";\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Function executed on toggle of the dropdown. Should receive the open status. */\n onToggle?: (\n event:\n | Event\n | React.KeyboardEvent<HTMLUListElement>\n | React.ChangeEvent<HTMLInputElement>\n | React.MouseEvent<HTMLLIElement>,\n open: boolean,\n ) => void;\n /** Function executed in each onClick. Should received the clicked element. */\n onClick?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.MouseEvent<HTMLLIElement>,\n value: HvListValue,\n ) => void;\n /** Keep the Dropdown Menu opened after clicking one option */\n keepOpened?: boolean;\n /** Defines if the component is disabled. */\n disabled?: boolean;\n /** If true it should be displayed open. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /**\n * The variant to be used in the header.\n * @deprecated Use `variant` instead\n */\n category?: HvButtonVariant;\n /** The variant to be used in the header. */\n variant?: HvButtonVariant;\n /** Button size. */\n size?: HvSize;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDropDownMenuClasses;\n /** An object containing all the labels. */\n labels?: Partial<typeof DEFAULT_LABELS>;\n}\n\nconst HeaderComponent = forwardRef<HTMLButtonElement, HvDropdownButtonProps>(\n function HeaderComponent(props, ref) {\n const { open, icon, disabled, ...others } = props;\n const { popperPlacement } = useBaseDropdownContext();\n\n return (\n <HvDropdownButton\n icon\n ref={ref}\n open={open}\n disabled={disabled}\n aria-expanded={open}\n aria-haspopup=\"menu\"\n placement={popperPlacement}\n {...others}\n >\n {icon || <MoreOptionsVertical role=\"presentation\" />}\n </HvDropdownButton>\n );\n },\n);\n\n/**\n * A dropdown menu is a graphical control element, similar to a list box, that allows the user to choose a value from a list.\n */\nexport const HvDropDownMenu = forwardRef<\n React.ComponentRef<typeof HvBaseDropdown>,\n HvDropDownMenuProps\n>(function HvDropDownMenu(props, ref) {\n const {\n id: idProp,\n classes: classesProp,\n className,\n icon,\n placement = \"right\",\n dataList,\n disablePortal = false,\n onToggle,\n onClick,\n keepOpened = true,\n disabled = false,\n expanded,\n defaultExpanded = false,\n category = \"secondaryGhost\", // TODO - remove and update variant default in v6\n variant,\n size = \"md\",\n labels: labelsProp,\n ...others\n } = useDefaultProps(\"HvDropDownMenu\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const [open, setOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const id = useUniqueId(idProp);\n\n const listId = setId(id, \"list\");\n\n const handleClose = (\n event:\n | React.KeyboardEvent<HTMLUListElement>\n | React.ChangeEvent<HTMLInputElement>\n | React.MouseEvent<HTMLLIElement>,\n ) => {\n // this will only run if uncontrolled\n setOpen(false);\n onToggle?.(event, false);\n };\n\n // If the ESCAPE key is pressed inside the list, the close handler must be called.\n const handleKeyDown: HvListProps[\"onKeyDown\"] = (event) => {\n if (isKey(event, \"Tab\")) {\n const focusNodes = getPrevNextFocus(setId(id, \"icon-button\"));\n const node = event.shiftKey ? focusNodes.prevFocus : focusNodes.nextFocus;\n if (node) setTimeout(() => node.focus(), 0);\n handleClose(event);\n }\n event.preventDefault();\n };\n\n const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);\n\n return (\n <HvBaseDropdown\n ref={ref}\n id={id}\n className={cx(classes.root, classes.container, classes.icon, className, {\n [classes.iconSelected]: open, // TODO: rename to open\n })}\n classes={{\n container: classes.baseContainer,\n panel: classes.menuListRoot,\n }}\n expanded={open && !disabled}\n headerComponent={HeaderComponent}\n // @ts-expect-error infer HeaderComponent typings\n size={size}\n variant={variant ?? category}\n open={open}\n aria-label={labels.dropdownMenu}\n icon={icon}\n placement={placement}\n variableWidth\n disablePortal={disablePortal}\n onToggle={(e, s) => {\n // this will only run if uncontrolled\n setOpen(s);\n onToggle?.(e, s);\n }}\n disabled={disabled}\n onContainerCreation={(containerEl) => {\n containerEl?.getElementsByTagName(\"li\")[0]?.focus();\n }}\n {...others}\n >\n <HvList\n id={listId}\n values={dataList}\n selectable={false}\n condensed={condensed}\n onClick={(event, item) => {\n if (!keepOpened) handleClose(event);\n onClick?.(event, item);\n }}\n onKeyDown={handleKeyDown}\n classes={{\n root: classes.menuList,\n }}\n />\n </HvBaseDropdown>\n );\n});\n"],"names":["HeaderComponent","HvDropDownMenu"],"mappings":";;;;;;;;;;;;;;;;AA0BA,MAAM,iBAAiB;AAAA,EACrB,cAAc;AAChB;AA2DA,MAAM,kBAAkB;AAAA,EACtB,SAASA,iBAAgB,OAAO,KAAK;AACnC,UAAM,EAAE,MAAM,MAAM,UAAU,GAAG,OAAW,IAAA;AACtC,UAAA,EAAE,gBAAgB,IAAI,uBAAuB;AAGjD,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAI;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA,iBAAe;AAAA,QACf,iBAAc;AAAA,QACd,WAAW;AAAA,QACV,GAAG;AAAA,QAEH,UAAQ,QAAA,oBAAC,qBAAoB,EAAA,MAAK,eAAe,CAAA;AAAA,MAAA;AAAA,IACpD;AAAA,EAAA;AAGN;AAKO,MAAM,iBAAiB,WAG5B,SAASC,gBAAe,OAAO,KAAK;AAC9B,QAAA;AAAA,IACJ,IAAI;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,WAAW;AAA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AAA,MACnB;AAAA,MACA;AAAA,MACA,eAAa;AAAA,MACb;AAAA,MACA,UAAU,CAAC,GAAG,MAAM;AAElB,gBAAQ,CAAC;AACT,mBAAW,GAAG,CAAC;AAAA,MACjB;AAAA,MACA;AAAA,MACA,qBAAqB,CAAC,gBAAgB;AACpC,qBAAa,qBAAqB,IAAI,EAAE,CAAC,GAAG,MAAM;AAAA,MACpD;AAAA,MACC,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAI;AAAA,UACJ,QAAQ;AAAA,UACR,YAAY;AAAA,UACZ;AAAA,UACA,SAAS,CAAC,OAAO,SAAS;AACpB,gBAAA,CAAC,WAAY,aAAY,KAAK;AAClC,sBAAU,OAAO,IAAI;AAAA,UACvB;AAAA,UACA,WAAW;AAAA,UACX,SAAS;AAAA,YACP,MAAM,QAAQ;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ,CAAC;"}
1
+ {"version":3,"file":"DropDownMenu.js","sources":["../../../src/DropDownMenu/DropDownMenu.tsx"],"sourcesContent":["import { forwardRef, useMemo } from \"react\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { HvSize } from \"@hitachivantara/uikit-styles\";\n\nimport { HvBaseDropdown } from \"../BaseDropdown\";\nimport { useBaseDropdownContext } from \"../BaseDropdown/context\";\nimport { HvButtonVariant } from \"../Button\";\nimport { HvDropdownButton, HvDropdownButtonProps } from \"../DropdownButton\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useLabels } from \"../hooks/useLabels\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { HvList, HvListProps, HvListValue } from \"../List\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { getPrevNextFocus } from \"../utils/focusableElementFinder\";\nimport { isKey } from \"../utils/keyboardUtils\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./DropDownMenu.styles\";\n\nexport { staticClasses as dropDownMenuClasses };\n\nexport type HvDropDownMenuClasses = ExtractNames<typeof useClasses>;\n\nconst DEFAULT_LABELS = {\n dropdownMenu: \"Dropdown menu\",\n};\n\nexport interface HvDropDownMenuProps\n extends HvBaseProps<HTMLDivElement, \"onClick\" | \"onToggle\"> {\n /** Icon. */\n icon?: React.ReactElement<any>;\n /**\n * A list containing the elements to be rendered.\n *\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - icon: The icon node to be rendered on the left.\n * - showNavIcon: If true renders the navigation icon on the right.\n */\n dataList: HvListValue[];\n /** Placement of the dropdown. */\n placement?: \"left\" | \"right\";\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Function executed on toggle of the dropdown. Should receive the open status. */\n onToggle?: (\n event:\n | Event\n | React.KeyboardEvent<HTMLUListElement>\n | React.ChangeEvent<HTMLInputElement>\n | React.MouseEvent<HTMLLIElement>,\n open: boolean,\n ) => void;\n /** Function executed in each onClick. Should received the clicked element. */\n onClick?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.MouseEvent<HTMLLIElement>,\n value: HvListValue,\n ) => void;\n /** Keep the Dropdown Menu opened after clicking one option */\n keepOpened?: boolean;\n /** Defines if the component is disabled. */\n disabled?: boolean;\n /** If true it should be displayed open. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /**\n * The variant to be used in the header.\n * @deprecated Use `variant` instead\n */\n category?: HvButtonVariant;\n /** The variant to be used in the header. */\n variant?: HvButtonVariant;\n /** Button size. */\n size?: HvSize;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDropDownMenuClasses;\n /** An object containing all the labels. */\n labels?: Partial<typeof DEFAULT_LABELS>;\n}\n\nconst HeaderComponent = forwardRef<HTMLButtonElement, HvDropdownButtonProps>(\n function HeaderComponent(props, ref) {\n const { open, icon, disabled, ...others } = props;\n const { popperPlacement } = useBaseDropdownContext();\n\n return (\n <HvDropdownButton\n icon\n ref={ref}\n open={open}\n disabled={disabled}\n aria-expanded={open}\n aria-haspopup=\"menu\"\n placement={popperPlacement}\n {...others}\n >\n {icon || <MoreOptionsVertical role=\"presentation\" />}\n </HvDropdownButton>\n );\n },\n);\n\n/**\n * A dropdown menu is a graphical control element, similar to a list box, that allows the user to choose a value from a list.\n */\nexport const HvDropDownMenu = forwardRef<\n React.ComponentRef<typeof HvBaseDropdown>,\n HvDropDownMenuProps\n>(function HvDropDownMenu(props, ref) {\n const {\n id: idProp,\n classes: classesProp,\n className,\n icon,\n placement = \"right\",\n dataList,\n disablePortal = false,\n onToggle,\n onClick,\n keepOpened = true,\n disabled = false,\n expanded,\n defaultExpanded = false,\n category = \"secondaryGhost\", // TODO - remove and update variant default in v6\n variant,\n size = \"md\",\n labels: labelsProp,\n ...others\n } = useDefaultProps(\"HvDropDownMenu\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const [open, setOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const id = useUniqueId(idProp);\n\n const listId = setId(id, \"list\");\n\n const handleClose = (\n event:\n | React.KeyboardEvent<HTMLUListElement>\n | React.ChangeEvent<HTMLInputElement>\n | React.MouseEvent<HTMLLIElement>,\n ) => {\n // this will only run if uncontrolled\n setOpen(false);\n onToggle?.(event, false);\n };\n\n // If the ESCAPE key is pressed inside the list, the close handler must be called.\n const handleKeyDown: HvListProps[\"onKeyDown\"] = (event) => {\n if (isKey(event, \"Tab\")) {\n const focusNodes = getPrevNextFocus(setId(id, \"icon-button\"));\n const node = event.shiftKey ? focusNodes.prevFocus : focusNodes.nextFocus;\n if (node) setTimeout(() => node.focus(), 0);\n handleClose(event);\n }\n event.preventDefault();\n };\n\n const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);\n\n return (\n <HvBaseDropdown\n ref={ref}\n id={id}\n className={cx(classes.root, classes.container, classes.icon, className, {\n [classes.iconSelected]: open, // TODO: rename to open\n })}\n classes={{\n container: classes.baseContainer,\n panel: classes.menuListRoot,\n }}\n expanded={open && !disabled}\n headerComponent={HeaderComponent}\n // @ts-expect-error infer HeaderComponent typings\n size={size}\n variant={variant ?? category}\n open={open}\n aria-label={labels.dropdownMenu}\n icon={icon}\n placement={placement}\n variableWidth\n disablePortal={disablePortal}\n onToggle={(e, s) => {\n // this will only run if uncontrolled\n setOpen(s);\n onToggle?.(e, s);\n }}\n disabled={disabled}\n onContainerCreation={(containerEl) => {\n containerEl?.getElementsByTagName(\"li\")[0]?.focus();\n }}\n {...others}\n >\n <HvList\n id={listId}\n values={dataList}\n selectable={false}\n condensed={condensed}\n onClick={(event, item) => {\n if (!keepOpened) handleClose(event);\n onClick?.(event, item);\n }}\n onKeyDown={handleKeyDown}\n classes={{\n root: classes.menuList,\n }}\n />\n </HvBaseDropdown>\n );\n});\n"],"names":["HeaderComponent","HvDropDownMenu"],"mappings":";;;;;;;;;;;;;;;;AA0BA,MAAM,iBAAiB;AAAA,EACrB,cAAc;AAChB;AA2DA,MAAM,kBAAkB;AAAA,EACtB,SAASA,iBAAgB,OAAO,KAAK;AACnC,UAAM,EAAE,MAAM,MAAM,UAAU,GAAG,OAAW,IAAA;AACtC,UAAA,EAAE,gBAAgB,IAAI,uBAAuB;AAGjD,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAI;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA,iBAAe;AAAA,QACf,iBAAc;AAAA,QACd,WAAW;AAAA,QACV,GAAG;AAAA,QAEH,UAAQ,QAAA,oBAAC,qBAAoB,EAAA,MAAK,eAAe,CAAA;AAAA,MAAA;AAAA,IACpD;AAAA,EAAA;AAGN;AAKO,MAAM,iBAAiB,WAG5B,SAASC,gBAAe,OAAO,KAAK;AAC9B,QAAA;AAAA,IACJ,IAAI;AAAA,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QAAQ;AAAA,MACjB;AAAA,MACA,UAAU,QAAQ,CAAC;AAAA,MACnB,iBAAiB;AAAA,MAEjB;AAAA,MACA,SAAS,WAAW;AAAA,MACpB;AAAA,MACA,cAAY,OAAO;AAAA,MACnB;AAAA,MACA;AAAA,MACA,eAAa;AAAA,MACb;AAAA,MACA,UAAU,CAAC,GAAG,MAAM;AAElB,gBAAQ,CAAC;AACT,mBAAW,GAAG,CAAC;AAAA,MACjB;AAAA,MACA;AAAA,MACA,qBAAqB,CAAC,gBAAgB;AACpC,qBAAa,qBAAqB,IAAI,EAAE,CAAC,GAAG,MAAM;AAAA,MACpD;AAAA,MACC,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAI;AAAA,UACJ,QAAQ;AAAA,UACR,YAAY;AAAA,UACZ;AAAA,UACA,SAAS,CAAC,OAAO,SAAS;AACpB,gBAAA,CAAC,WAAY,aAAY,KAAK;AAClC,sBAAU,OAAO,IAAI;AAAA,UACvB;AAAA,UACA,WAAW;AAAA,UACX,SAAS;AAAA,YACP,MAAM,QAAQ;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ,CAAC;"}
@@ -100,7 +100,7 @@ const HvDropdown = fixedForwardRef(function HvDropdown2(props, ref) {
100
100
  getSelectionLabel(labels, placeholder, multiSelect, values)
101
101
  );
102
102
  }, [labels, multiSelect, placeholder, values]);
103
- const dropdownHeaderRef = useRef();
103
+ const dropdownHeaderRef = useRef(void 0);
104
104
  const {
105
105
  ref: refProp,
106
106
  dropdownHeaderRef: dropdownHeaderRefProp,
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sources":["../../../src/Dropdown/Dropdown.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseDropdown, HvBaseDropdownProps } from \"../BaseDropdown\";\nimport {\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n isInvalid,\n} from \"../FormElement\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useLabels } from \"../hooks/useLabels\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { HvListValue } from \"../List\";\nimport { fixedForwardRef } from \"../types/generic\";\nimport { HvTypography } from \"../Typography\";\nimport { CounterLabel } from \"../utils/CounterLabel\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./Dropdown.styles\";\nimport { HvDropdownList, HvDropdownListProps } from \"./List\";\nimport { getSelected, getSelectionLabel } from \"./utils\";\n\nexport { staticClasses as dropdownClasses };\n\nexport type HvDropdownClasses = ExtractNames<typeof useClasses>;\n\nexport type HvDropdownStatus = \"standBy\" | \"valid\" | \"invalid\";\n\nexport interface HvDropdownProps<\n // TODO: make default `false` in v6\n Multiple extends boolean = boolean,\n OptionValue extends HvListValue = HvListValue,\n> extends Omit<HvFormElementProps, \"value\" | \"onChange\">,\n Pick<\n HvBaseDropdownProps,\n | \"placement\"\n | \"popperProps\"\n | \"disablePortal\"\n | \"variableWidth\"\n | \"expanded\"\n | \"defaultExpanded\"\n > {\n /**\n * A Jss Object used to override or extend the component styles applied.\n */\n classes?: HvDropdownClasses;\n /**\n * The placeholder value when nothing is selected.\n */\n placeholder?: string;\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?: HvDropdownStatus;\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?: any;\n /**\n * Identifies the element that provides an error message for the dropdown.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the value changes.\n */\n onChange?: (\n selected: Multiple extends true ? OptionValue[] : OptionValue | undefined,\n ) => void;\n /**\n * The list to be rendered by the dropdown.\n */\n values?: OptionValue[];\n /**\n * If `true` the dropdown is multiSelect, if `false` the dropdown is single select.\n */\n multiSelect?: Multiple;\n /**\n * If `true` the dropdown is rendered with a search bar, if `false` there won't be a search bar.\n */\n showSearch?: boolean;\n /**\n * If 'true' the dropdown will notify on the first render.\n */\n notifyChangesOnFirstRender?: boolean;\n /**\n * An object containing all the labels for the dropdown.\n */\n labels?: HvDropdownLabels;\n /**\n * If `true` the dropdown will show tooltips when user mouseenter text in list\n */\n hasTooltips?: boolean;\n /**\n * If `true`, selection can be toggled when single selection.\n */\n singleSelectionToggle?: boolean;\n /**\n * Callback called when the user cancels the changes.\n *\n * Called when the cancel button is used and when the user clicks outside the open container.\n *\n * @param {object} event The event source of the callback.\n */\n onCancel?: (event: Event) => void;\n /**\n * Callback called when dropdown changes the expanded state.\n *\n * @param {object} event The event source of the callback.\n * @param {boolean} open If the dropdown new state is open (`true`) or closed (`false`).\n */\n onToggle?: (event: Event, open: boolean) => void;\n /**\n * Callback called when the user clicks outside the open container.\n *\n * @param {object} event The event source of the callback.\n */\n onClickOutside?: (event: Event) => void;\n /**\n * @ignore\n */\n onFocus?: React.FocusEventHandler<any>;\n /**\n * @ignore\n */\n onBlur?: React.FocusEventHandler<any>;\n /**\n * Experimental. Height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class. Required in case virtualized is used\n */\n height?: number;\n /**\n * Experimental. Height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class. Required in case virtualized is used\n */\n maxHeight?: number;\n /**\n * Experimental. Uses dropdown in a virtualized form, where not all options are rendered initially. Good for use cases with a lot of options.\n */\n virtualized?: boolean;\n /**\n * Extra props passed to the dropdown.\n */\n baseDropdownProps?: Partial<HvBaseDropdownProps>;\n /**\n * Extra props passed to the list.\n */\n listProps?: Partial<HvDropdownListProps>;\n}\n\nconst DEFAULT_LABELS = {\n /** Label for overwrite the default header behavior. */\n select: undefined as string | undefined,\n /** Label used for the All checkbox action. @deprecated unused */\n selectAll: \"All\",\n /** Cancel button label. */\n cancelLabel: \"Cancel\",\n /** Apply button label. */\n applyLabel: \"Apply\",\n /** The label used in the middle of the multiSelection count. */\n searchPlaceholder: \"Search\",\n /** The label used in search. */\n multiSelectionConjunction: \"/\",\n};\n\nexport type HvDropdownLabels = Partial<typeof DEFAULT_LABELS>;\n/** @deprecated use `HvDropdownLabels` instead */\nexport type HvDropdownLabelsProps = HvDropdownLabels;\n\n/**\n * A dropdown list is a graphical control element, similar to a list box, that allows the user to choose one value from a list.\n */\nexport const HvDropdown = fixedForwardRef(function HvDropdown<\n Multiple extends boolean = false,\n OptionValue extends HvListValue = HvListValue,\n>(\n props: HvDropdownProps<Multiple, OptionValue>,\n ref: React.Ref<HTMLDivElement>,\n) {\n const {\n classes: classesProp,\n className,\n\n id,\n name,\n\n required,\n disabled,\n readOnly,\n\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n\n placeholder = \"Select...\",\n\n onChange,\n\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n onCancel,\n onToggle,\n onClickOutside,\n\n onFocus,\n onBlur,\n\n values,\n multiSelect = false,\n showSearch,\n expanded,\n defaultExpanded,\n notifyChangesOnFirstRender,\n labels: labelsProp,\n hasTooltips,\n disablePortal,\n singleSelectionToggle = true,\n placement,\n variableWidth,\n popperProps = {},\n height,\n maxHeight,\n virtualized,\n baseDropdownProps = {},\n listProps = {},\n ...others\n } = useDefaultProps(\"HvDropdown\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const elementId = useUniqueId(id);\n\n const [validationState, setValidationState] = useControlled<HvFormStatus>(\n status,\n \"standBy\",\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const [isOpen, setIsOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const [selectionLabel, setSelectionLabel] = useState(\n getSelectionLabel(labels, placeholder, multiSelect, values),\n );\n\n const [internalValues, setInternalValues] = useState(values);\n\n // Hack - Keeping track of internal values for validation purposes since useState is async\n const internalValuesRef = useRef(values);\n\n useEffect(() => {\n setInternalValues(values);\n internalValuesRef.current = values;\n }, [values]);\n\n useEffect(() => {\n setSelectionLabel(\n getSelectionLabel(labels, placeholder, multiSelect, values),\n );\n }, [labels, multiSelect, placeholder, values]);\n\n if (import.meta.env.DEV && virtualized && !height) {\n // eslint-disable-next-line no-console\n console.error(\n \"Dropdown/List in virtualized mode requires a height. Please define it.\",\n );\n }\n\n const dropdownHeaderRef = useRef<HTMLDivElement>();\n\n const {\n ref: refProp,\n dropdownHeaderRef: dropdownHeaderRefProp,\n ...otherBaseDropdownProps\n } = baseDropdownProps;\n const headerForkedRef = useForkRef(dropdownHeaderRefProp, dropdownHeaderRef);\n\n const dropdownForkedRef = useForkRef(ref, refProp);\n\n const handleToggle: HvBaseDropdownProps[\"onToggle\"] = (event, open) => {\n onToggle?.(event, open);\n\n setIsOpen(open);\n\n if (!open) {\n // also run built-in validation when closing without changes\n // as the user \"touched\" the input\n setValidationState(() => {\n // this will only run if status is uncontrolled\n if (required) {\n const hasSelection =\n getSelected(internalValuesRef.current).length > 0;\n\n if (!hasSelection) {\n return \"invalid\";\n }\n }\n\n return \"valid\";\n });\n }\n };\n\n /** Applies the selected values to the state */\n const handleSelection: HvDropdownListProps[\"onChange\"] = (\n listValues,\n commitChanges,\n toggle,\n notifyChanges = true,\n ) => {\n const selected = getSelected(listValues);\n\n if (commitChanges) {\n setInternalValues(listValues as any);\n internalValuesRef.current = listValues as any;\n\n setSelectionLabel(\n getSelectionLabel(labels, placeholder, multiSelect, listValues),\n );\n\n setValidationState(() => {\n // this will only run if status is uncontrolled\n if (required && selected.length === 0) {\n return \"invalid\";\n }\n\n return \"valid\";\n });\n }\n if (notifyChanges) {\n onChange?.((multiSelect ? selected : selected[0]) as any);\n }\n if (toggle) {\n handleToggle(undefined as any, false);\n\n // focus-ring won't be visible even if using the keyboard:\n // https://github.com/WICG/focus-visible/issues/88\n dropdownHeaderRef.current?.focus({ preventScroll: true });\n }\n };\n\n /**\n * Handles the `Cancel` action. Both single and ranged modes are handled here.\n */\n const handleCancel: HvDropdownListProps[\"onCancel\"] = (evt) => {\n onCancel?.(evt as any);\n\n handleToggle(evt as any, false);\n\n // focus-ring won't be visible even if using the keyboard:\n // https://github.com/WICG/focus-visible/issues/88\n dropdownHeaderRef.current?.focus({ preventScroll: true });\n };\n\n const handleClickOutside: HvBaseDropdownProps[\"onClickOutside\"] = (evt) => {\n onClickOutside?.(evt);\n onCancel?.(evt);\n };\n\n const setFocusToContent: HvBaseDropdownProps[\"onContainerCreation\"] = (\n containerRef,\n ) => {\n const inputs = containerRef?.getElementsByTagName(\"input\");\n if (inputs && inputs.length > 0) {\n inputs[0].focus();\n return;\n }\n const listItems =\n containerRef != null ? [...containerRef.getElementsByTagName(\"li\")] : [];\n listItems.every((listItem) => {\n if (listItem.tabIndex >= 0) {\n listItem.focus();\n return false;\n }\n return true;\n });\n };\n\n const buildHeaderLabel = () => {\n const hasSelection = getSelected(internalValues).length > 0;\n return labels?.select || !multiSelect ? (\n <HvTypography\n component=\"div\"\n variant=\"body\"\n className={cx(classes.placeholder, {\n [classes.selectionDisabled]: disabled,\n [classes.placeholderClosed]: !(isOpen || hasSelection),\n })}\n >\n {selectionLabel.selected}\n </HvTypography>\n ) : (\n <CounterLabel\n selected={selectionLabel.selected}\n total={selectionLabel.total}\n conjunctionLabel={labels.multiSelectionConjunction}\n className={cx(classes.placeholder, {\n [classes.selectionDisabled]: disabled,\n })}\n />\n );\n };\n\n const hasLabel = label != null;\n const hasDescription = description != null;\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 isStateInvalid = isInvalid(validationState);\n\n let errorMessageId;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n className={cx(\n classes.root,\n {\n [classes.disabled]: disabled,\n },\n className,\n )}\n {...others}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n showGutter\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseDropdown\n ref={dropdownForkedRef}\n id={setId(id, \"dropdown\")}\n classes={{\n root: cx(classes.dropdown, {\n [classes.readOnly]: readOnly,\n }),\n arrow: classes.arrow,\n header: cx(classes.dropdownHeader, {\n [classes.dropdownHeaderInvalid]: isStateInvalid,\n }),\n headerOpen: classes.dropdownHeaderOpen,\n }}\n expanded={isOpen}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n disablePortal={disablePortal}\n placement={placement}\n popperProps={popperProps}\n placeholder={buildHeaderLabel()}\n onToggle={handleToggle}\n onClickOutside={handleClickOutside}\n onContainerCreation={setFocusToContent}\n role=\"combobox\"\n variableWidth={variableWidth}\n aria-label={ariaLabel}\n aria-labelledby={\n [label && setId(elementId, \"label\"), ariaLabelledBy]\n .join(\" \")\n .trim() || undefined\n }\n aria-invalid={isStateInvalid ? true : undefined}\n aria-errormessage={errorMessageId}\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n onFocus={onFocus}\n onBlur={onBlur}\n dropdownHeaderRef={headerForkedRef}\n {...otherBaseDropdownProps}\n >\n <HvDropdownList\n id={setId(elementId, \"values\")}\n classes={{\n rootList: classes.rootList,\n dropdownListContainer: classes.dropdownListContainer,\n }}\n values={internalValues}\n multiSelect={multiSelect}\n showSearch={showSearch}\n onChange={handleSelection}\n onCancel={handleCancel}\n labels={labels}\n notifyChangesOnFirstRender={notifyChangesOnFirstRender}\n hasTooltips={hasTooltips}\n singleSelectionToggle={singleSelectionToggle}\n aria-label={ariaLabel}\n aria-labelledby={hasLabel ? setId(elementId, \"label\") : undefined}\n height={height}\n maxHeight={maxHeight}\n virtualized={virtualized}\n {...listProps}\n />\n </HvBaseDropdown>\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"],"names":["HvDropdown"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmKA,MAAM,iBAAiB;AAAA;AAAA,EAErB,QAAQ;AAAA;AAAA,EAER,WAAW;AAAA;AAAA,EAEX,aAAa;AAAA;AAAA,EAEb,YAAY;AAAA;AAAA,EAEZ,mBAAmB;AAAA;AAAA,EAEnB,2BAA2B;AAC7B;AASO,MAAM,aAAa,gBAAgB,SAASA,YAIjD,OACA,KACA;AACM,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,IACA,oBAAoB;AAAA,IAEpB,cAAc;AAAA,IAEd;AAAA,IAEA;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA,IAErB;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,wBAAwB;AAAA,IACxB;AAAA,IACA;AAAA,IACA,cAA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MAAM,WAAW,QAAQ;AAAA,gBAC7B,SAAS;AAAA,kBACP,UAAU,QAAQ;AAAA,kBAClB,uBAAuB,QAAQ;AAAA,gBACjC;AAAA,gBACA,QAAQ;AAAA,gBACR;AAAA,gBACA;AAAA,gBACA,UAAU;AAAA,gBACV,UAAU;AAAA,gBACV;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,cAAY;AAAA,gBACZ,mBAAiB,WAAW,MAAM,WAAW,OAAO,IAAI;AAAA,gBACxD;AAAA,gBACA;AAAA,gBACA;AAAA,gBACC,GAAG;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QACF;AAAA,QACC,gBACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI,MAAM,WAAW,OAAO;AAAA,YAC5B,eAAa;AAAA,YACb,WAAW,QAAQ;AAAA,YAElB,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAEJ;AAEJ,CAAC;"}
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../src/Dropdown/Dropdown.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseDropdown, HvBaseDropdownProps } from \"../BaseDropdown\";\nimport {\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n isInvalid,\n} from \"../FormElement\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useLabels } from \"../hooks/useLabels\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { HvListValue } from \"../List\";\nimport { fixedForwardRef } from \"../types/generic\";\nimport { HvTypography } from \"../Typography\";\nimport { CounterLabel } from \"../utils/CounterLabel\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./Dropdown.styles\";\nimport { HvDropdownList, HvDropdownListProps } from \"./List\";\nimport { getSelected, getSelectionLabel } from \"./utils\";\n\nexport { staticClasses as dropdownClasses };\n\nexport type HvDropdownClasses = ExtractNames<typeof useClasses>;\n\nexport type HvDropdownStatus = \"standBy\" | \"valid\" | \"invalid\";\n\nexport interface HvDropdownProps<\n // TODO: make default `false` in v6\n Multiple extends boolean = boolean,\n OptionValue extends HvListValue = HvListValue,\n> extends Omit<HvFormElementProps, \"value\" | \"onChange\">,\n Pick<\n HvBaseDropdownProps,\n | \"placement\"\n | \"popperProps\"\n | \"disablePortal\"\n | \"variableWidth\"\n | \"expanded\"\n | \"defaultExpanded\"\n > {\n /**\n * A Jss Object used to override or extend the component styles applied.\n */\n classes?: HvDropdownClasses;\n /**\n * The placeholder value when nothing is selected.\n */\n placeholder?: string;\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?: HvDropdownStatus;\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?: any;\n /**\n * Identifies the element that provides an error message for the dropdown.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the value changes.\n */\n onChange?: (\n selected: Multiple extends true ? OptionValue[] : OptionValue | undefined,\n ) => void;\n /**\n * The list to be rendered by the dropdown.\n */\n values?: OptionValue[];\n /**\n * If `true` the dropdown is multiSelect, if `false` the dropdown is single select.\n */\n multiSelect?: Multiple;\n /**\n * If `true` the dropdown is rendered with a search bar, if `false` there won't be a search bar.\n */\n showSearch?: boolean;\n /**\n * If 'true' the dropdown will notify on the first render.\n */\n notifyChangesOnFirstRender?: boolean;\n /**\n * An object containing all the labels for the dropdown.\n */\n labels?: HvDropdownLabels;\n /**\n * If `true` the dropdown will show tooltips when user mouseenter text in list\n */\n hasTooltips?: boolean;\n /**\n * If `true`, selection can be toggled when single selection.\n */\n singleSelectionToggle?: boolean;\n /**\n * Callback called when the user cancels the changes.\n *\n * Called when the cancel button is used and when the user clicks outside the open container.\n *\n * @param {object} event The event source of the callback.\n */\n onCancel?: (event: Event) => void;\n /**\n * Callback called when dropdown changes the expanded state.\n *\n * @param {object} event The event source of the callback.\n * @param {boolean} open If the dropdown new state is open (`true`) or closed (`false`).\n */\n onToggle?: (event: Event, open: boolean) => void;\n /**\n * Callback called when the user clicks outside the open container.\n *\n * @param {object} event The event source of the callback.\n */\n onClickOutside?: (event: Event) => void;\n /**\n * @ignore\n */\n onFocus?: React.FocusEventHandler<any>;\n /**\n * @ignore\n */\n onBlur?: React.FocusEventHandler<any>;\n /**\n * Experimental. Height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class. Required in case virtualized is used\n */\n height?: number;\n /**\n * Experimental. Height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class. Required in case virtualized is used\n */\n maxHeight?: number;\n /**\n * Experimental. Uses dropdown in a virtualized form, where not all options are rendered initially. Good for use cases with a lot of options.\n */\n virtualized?: boolean;\n /**\n * Extra props passed to the dropdown.\n */\n baseDropdownProps?: Partial<HvBaseDropdownProps>;\n /**\n * Extra props passed to the list.\n */\n listProps?: Partial<HvDropdownListProps>;\n}\n\nconst DEFAULT_LABELS = {\n /** Label for overwrite the default header behavior. */\n select: undefined as string | undefined,\n /** Label used for the All checkbox action. @deprecated unused */\n selectAll: \"All\",\n /** Cancel button label. */\n cancelLabel: \"Cancel\",\n /** Apply button label. */\n applyLabel: \"Apply\",\n /** The label used in the middle of the multiSelection count. */\n searchPlaceholder: \"Search\",\n /** The label used in search. */\n multiSelectionConjunction: \"/\",\n};\n\nexport type HvDropdownLabels = Partial<typeof DEFAULT_LABELS>;\n/** @deprecated use `HvDropdownLabels` instead */\nexport type HvDropdownLabelsProps = HvDropdownLabels;\n\n/**\n * A dropdown list is a graphical control element, similar to a list box, that allows the user to choose one value from a list.\n */\nexport const HvDropdown = fixedForwardRef(function HvDropdown<\n Multiple extends boolean = false,\n OptionValue extends HvListValue = HvListValue,\n>(\n props: HvDropdownProps<Multiple, OptionValue>,\n ref: React.Ref<HTMLDivElement>,\n) {\n const {\n classes: classesProp,\n className,\n\n id,\n name,\n\n required,\n disabled,\n readOnly,\n\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n\n placeholder = \"Select...\",\n\n onChange,\n\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n onCancel,\n onToggle,\n onClickOutside,\n\n onFocus,\n onBlur,\n\n values,\n multiSelect = false,\n showSearch,\n expanded,\n defaultExpanded,\n notifyChangesOnFirstRender,\n labels: labelsProp,\n hasTooltips,\n disablePortal,\n singleSelectionToggle = true,\n placement,\n variableWidth,\n popperProps = {},\n height,\n maxHeight,\n virtualized,\n baseDropdownProps = {},\n listProps = {},\n ...others\n } = useDefaultProps(\"HvDropdown\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const elementId = useUniqueId(id);\n\n const [validationState, setValidationState] = useControlled<HvFormStatus>(\n status,\n \"standBy\",\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const [isOpen, setIsOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const [selectionLabel, setSelectionLabel] = useState(\n getSelectionLabel(labels, placeholder, multiSelect, values),\n );\n\n const [internalValues, setInternalValues] = useState(values);\n\n // Hack - Keeping track of internal values for validation purposes since useState is async\n const internalValuesRef = useRef(values);\n\n useEffect(() => {\n setInternalValues(values);\n internalValuesRef.current = values;\n }, [values]);\n\n useEffect(() => {\n setSelectionLabel(\n getSelectionLabel(labels, placeholder, multiSelect, values),\n );\n }, [labels, multiSelect, placeholder, values]);\n\n if (import.meta.env.DEV && virtualized && !height) {\n // eslint-disable-next-line no-console\n console.error(\n \"Dropdown/List in virtualized mode requires a height. Please define it.\",\n );\n }\n\n const dropdownHeaderRef = useRef<HTMLDivElement | undefined>(undefined);\n\n const {\n ref: refProp,\n dropdownHeaderRef: dropdownHeaderRefProp,\n ...otherBaseDropdownProps\n } = baseDropdownProps;\n const headerForkedRef = useForkRef(dropdownHeaderRefProp, dropdownHeaderRef);\n\n const dropdownForkedRef = useForkRef(ref, refProp);\n\n const handleToggle: HvBaseDropdownProps[\"onToggle\"] = (event, open) => {\n onToggle?.(event, open);\n\n setIsOpen(open);\n\n if (!open) {\n // also run built-in validation when closing without changes\n // as the user \"touched\" the input\n setValidationState(() => {\n // this will only run if status is uncontrolled\n if (required) {\n const hasSelection =\n getSelected(internalValuesRef.current).length > 0;\n\n if (!hasSelection) {\n return \"invalid\";\n }\n }\n\n return \"valid\";\n });\n }\n };\n\n /** Applies the selected values to the state */\n const handleSelection: HvDropdownListProps[\"onChange\"] = (\n listValues,\n commitChanges,\n toggle,\n notifyChanges = true,\n ) => {\n const selected = getSelected(listValues);\n\n if (commitChanges) {\n setInternalValues(listValues as any);\n internalValuesRef.current = listValues as any;\n\n setSelectionLabel(\n getSelectionLabel(labels, placeholder, multiSelect, listValues),\n );\n\n setValidationState(() => {\n // this will only run if status is uncontrolled\n if (required && selected.length === 0) {\n return \"invalid\";\n }\n\n return \"valid\";\n });\n }\n if (notifyChanges) {\n onChange?.((multiSelect ? selected : selected[0]) as any);\n }\n if (toggle) {\n handleToggle(undefined as any, false);\n\n // focus-ring won't be visible even if using the keyboard:\n // https://github.com/WICG/focus-visible/issues/88\n dropdownHeaderRef.current?.focus({ preventScroll: true });\n }\n };\n\n /**\n * Handles the `Cancel` action. Both single and ranged modes are handled here.\n */\n const handleCancel: HvDropdownListProps[\"onCancel\"] = (evt) => {\n onCancel?.(evt as any);\n\n handleToggle(evt as any, false);\n\n // focus-ring won't be visible even if using the keyboard:\n // https://github.com/WICG/focus-visible/issues/88\n dropdownHeaderRef.current?.focus({ preventScroll: true });\n };\n\n const handleClickOutside: HvBaseDropdownProps[\"onClickOutside\"] = (evt) => {\n onClickOutside?.(evt);\n onCancel?.(evt);\n };\n\n const setFocusToContent: HvBaseDropdownProps[\"onContainerCreation\"] = (\n containerRef,\n ) => {\n const inputs = containerRef?.getElementsByTagName(\"input\");\n if (inputs && inputs.length > 0) {\n inputs[0].focus();\n return;\n }\n const listItems =\n containerRef != null ? [...containerRef.getElementsByTagName(\"li\")] : [];\n listItems.every((listItem) => {\n if (listItem.tabIndex >= 0) {\n listItem.focus();\n return false;\n }\n return true;\n });\n };\n\n const buildHeaderLabel = () => {\n const hasSelection = getSelected(internalValues).length > 0;\n return labels?.select || !multiSelect ? (\n <HvTypography\n component=\"div\"\n variant=\"body\"\n className={cx(classes.placeholder, {\n [classes.selectionDisabled]: disabled,\n [classes.placeholderClosed]: !(isOpen || hasSelection),\n })}\n >\n {selectionLabel.selected}\n </HvTypography>\n ) : (\n <CounterLabel\n selected={selectionLabel.selected}\n total={selectionLabel.total}\n conjunctionLabel={labels.multiSelectionConjunction}\n className={cx(classes.placeholder, {\n [classes.selectionDisabled]: disabled,\n })}\n />\n );\n };\n\n const hasLabel = label != null;\n const hasDescription = description != null;\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 isStateInvalid = isInvalid(validationState);\n\n let errorMessageId;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n className={cx(\n classes.root,\n {\n [classes.disabled]: disabled,\n },\n className,\n )}\n {...others}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n showGutter\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseDropdown\n ref={dropdownForkedRef}\n id={setId(id, \"dropdown\")}\n classes={{\n root: cx(classes.dropdown, {\n [classes.readOnly]: readOnly,\n }),\n arrow: classes.arrow,\n header: cx(classes.dropdownHeader, {\n [classes.dropdownHeaderInvalid]: isStateInvalid,\n }),\n headerOpen: classes.dropdownHeaderOpen,\n }}\n expanded={isOpen}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n disablePortal={disablePortal}\n placement={placement}\n popperProps={popperProps}\n placeholder={buildHeaderLabel()}\n onToggle={handleToggle}\n onClickOutside={handleClickOutside}\n onContainerCreation={setFocusToContent}\n role=\"combobox\"\n variableWidth={variableWidth}\n aria-label={ariaLabel}\n aria-labelledby={\n [label && setId(elementId, \"label\"), ariaLabelledBy]\n .join(\" \")\n .trim() || undefined\n }\n aria-invalid={isStateInvalid ? true : undefined}\n aria-errormessage={errorMessageId}\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n onFocus={onFocus}\n onBlur={onBlur}\n dropdownHeaderRef={headerForkedRef}\n {...otherBaseDropdownProps}\n >\n <HvDropdownList\n id={setId(elementId, \"values\")}\n classes={{\n rootList: classes.rootList,\n dropdownListContainer: classes.dropdownListContainer,\n }}\n values={internalValues}\n multiSelect={multiSelect}\n showSearch={showSearch}\n onChange={handleSelection}\n onCancel={handleCancel}\n labels={labels}\n notifyChangesOnFirstRender={notifyChangesOnFirstRender}\n hasTooltips={hasTooltips}\n singleSelectionToggle={singleSelectionToggle}\n aria-label={ariaLabel}\n aria-labelledby={hasLabel ? setId(elementId, \"label\") : undefined}\n height={height}\n maxHeight={maxHeight}\n virtualized={virtualized}\n {...listProps}\n />\n </HvBaseDropdown>\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"],"names":["HvDropdown"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmKA,MAAM,iBAAiB;AAAA;AAAA,EAErB,QAAQ;AAAA;AAAA,EAER,WAAW;AAAA;AAAA,EAEX,aAAa;AAAA;AAAA,EAEb,YAAY;AAAA;AAAA,EAEZ,mBAAmB;AAAA;AAAA,EAEnB,2BAA2B;AAC7B;AASO,MAAM,aAAa,gBAAgB,SAASA,YAIjD,OACA,KACA;AACM,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,IACA,oBAAoB;AAAA,IAEpB,cAAc;AAAA,IAEd;AAAA,IAEA;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA,IAErB;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,wBAAwB;AAAA,IACxB;AAAA,IACA;AAAA,IACA,cAAc,CAAC;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB,CAAC;AAAA,IACrB,YAAY,CAAC;AAAA,IACb,GAAG;AAAA,EAAA,IACD,gBAAgB,cAAc,KAAK;AAEvC,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,QAAA,SAAS,UAAU,gBAAgB,UAAU;AAE7C,QAAA,YAAY,YAAY,EAAE;AAE1B,QAAA,CAAC,iBAAiB,kBAAkB,IAAI;AAAA,IAC5C;AAAA,IACA;AAAA,EACF;AAEA,QAAM,CAAC,iBAAiB,IAAI,cAAc,eAAe,UAAU;AAE7D,Q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,UACN;AAAA,QACF;AAAA,QACC,gBACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI,MAAM,WAAW,OAAO;AAAA,YAC5B,eAAa;AAAA,YACb,WAAW,QAAQ;AAAA,YAElB,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAEJ;AAEJ,CAAC;"}
@@ -1,8 +1,9 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useState, useMemo, useEffect } from "react";
3
3
  import { useDefaultProps, mergeStyles } from "@hitachivantara/uikit-react-utils";
4
4
  import { theme } from "@hitachivantara/uikit-styles";
5
5
  import { useBaseDropdownContext } from "../../BaseDropdown/context.js";
6
+ import { CounterLabel } from "../../utils/CounterLabel.js";
6
7
  import { setId } from "../../utils/setId.js";
7
8
  import { getSelected } from "../utils.js";
8
9
  import { useClasses } from "./List.styles.js";
@@ -11,7 +12,6 @@ import { HvActionBar } from "../../ActionBar/ActionBar.js";
11
12
  import { HvButton } from "../../Button/Button.js";
12
13
  import { HvList } from "../../List/List.js";
13
14
  import { HvInput } from "../../Input/Input.js";
14
- import { HvTypography } from "../../Typography/Typography.js";
15
15
  import { HvCheckBox } from "../../CheckBox/CheckBox.js";
16
16
  const clone = (values) => values.map((value) => ({ ...value }));
17
17
  const cleanHidden = (lst) => lst.map((item) => ({ ...item, isHidden: false }));
@@ -110,30 +110,24 @@ const HvDropdownList = (props) => {
110
110
  updateSelectAll(newList);
111
111
  };
112
112
  const renderSelectAll = () => {
113
- const selectAll = labels?.selectAll;
114
- const multiSelectionConjunction = labels?.multiSelectionConjunction;
115
- const nbrSelected = getSelected(list).length;
116
- const defaultLabel = /* @__PURE__ */ jsx(HvTypography, { component: "span", children: nbrSelected > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
117
- /* @__PURE__ */ jsx("b", { children: nbrSelected }),
118
- ` ${multiSelectionConjunction} ${list.length}`
119
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
120
- /* @__PURE__ */ jsx("b", { children: selectAll }),
121
- ` (${list.length})`
122
- ] }) });
123
- return /* @__PURE__ */ jsx("div", { className: classes.selectAllContainer, children: /* @__PURE__ */ jsx(
113
+ return /* @__PURE__ */ jsx(
124
114
  HvCheckBox,
125
115
  {
126
116
  id: setId(id, "select-all"),
127
- label: defaultLabel,
128
- onChange: () => handleSelectAll(),
129
- classes: {
130
- container: classes.selection
131
- },
117
+ label: /* @__PURE__ */ jsx(
118
+ CounterLabel,
119
+ {
120
+ selected: getSelected(list).length,
121
+ total: list.length,
122
+ conjunctionLabel: labels?.multiSelectionConjunction
123
+ }
124
+ ),
125
+ onChange: handleSelectAll,
132
126
  className: classes.selectAll,
133
127
  indeterminate: anySelected && !allSelected,
134
128
  checked: allSelected
135
129
  }
136
- ) });
130
+ );
137
131
  };
138
132
  const onSelection = (listValues) => {
139
133
  if (!multiSelect) {
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../src/Dropdown/List/List.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport {\n mergeStyles,\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvActionBar } from \"../../ActionBar\";\nimport { useBaseDropdownContext } from \"../../BaseDropdown/context\";\nimport { HvButton } from \"../../Button\";\nimport { HvCheckBox } from \"../../CheckBox\";\nimport { HvInput } from \"../../Input\";\nimport { HvList, HvListProps, HvListValue } from \"../../List\";\nimport { HvTypography } from \"../../Typography\";\nimport { setId } from \"../../utils/setId\";\nimport type { HvDropdownLabels } from \"../Dropdown\";\nimport { getSelected } from \"../utils\";\nimport { staticClasses, useClasses } from \"./List.styles\";\n\nexport { staticClasses as dropdownListClasses };\n\nexport type HvDropdownListClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDropdownListProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * A Jss Object used to override or extend the component styles.\n */\n classes?: HvDropdownListClasses;\n /**\n * The list to be rendered.\n */\n values?: HvListValue[];\n /**\n * If true renders a multi select list.\n */\n multiSelect?: boolean;\n /**\n * If true renders the search component.\n */\n showSearch?: boolean;\n /**\n * A function to be executed whenever a item is selected in the list\n * or the Apply button is activated (when `multiSelect` is `true`).\n */\n onChange: (\n /** An array containing the selected values */\n listValues: HvListValue[],\n /** If `true` the selection if finally committed the dropdown header text should reflect the new selection */\n commitChanges: boolean,\n /** If `true` the dropdown should toggle it's current state */\n toggle: boolean,\n /** If `true` the dropdown will call onChange */\n notifyChanges: boolean,\n ) => void;\n /**\n * A function to be executed whenever the Cancel button is activated.\n */\n onCancel: (event: React.MouseEvent) => void;\n /**\n * An object containing all the labels for the dropdown.\n */\n labels?: HvDropdownLabels;\n /**\n * If 'true' the dropdown will notify on the first render.\n */\n notifyChangesOnFirstRender?: boolean;\n /**\n * If `true` the dropdown will show tooltips when user mouseenter text in list\n */\n hasTooltips?: boolean;\n /**\n * If `true`, selection can be toggled when single selection.\n */\n singleSelectionToggle?: boolean;\n /**\n * Experimental. Height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class. Required in case virtualized is used\n */\n height?: number;\n /**\n * Experimental. Max height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class.\n */\n maxHeight?: number;\n /**\n * Experimental. Uses dropdown in a virtualized form, where not all options are rendered initially. Good for use cases with a lot of options.\n */\n virtualized?: boolean;\n}\n\n/**\n * The values property was being deeply cloned. That created a significant performance\n * hit when the values contained complex properties' values, like React Nodes.\n *\n * For minimizing the impact of removing the clone, a shallow clone of the array and its\n * objects is performed instead. That should have the same effect in the majority of the\n * cases, where the properties' values are primitive.\n */\nconst clone = (values: HvListValue[]) => values.map((value) => ({ ...value }));\n\n/**\n * Set all hidden's to false.\n */\nconst cleanHidden = (lst: HvListValue[]) =>\n lst.map((item) => ({ ...item, isHidden: false }));\n\nconst valuesExist = (values: HvListValue[]) =>\n values != null && values?.length > 0;\n\n/** Filter selected ordered element `id`s (or `label`) */\nconst getSelectedIds = (list: HvListValue[]) =>\n getSelected(list).map((item) => item.id || item.label);\n\nexport const HvDropdownList = (props: HvDropdownListProps) => {\n const {\n id,\n classes: classesProp,\n values = [],\n multiSelect = false,\n showSearch = false,\n onChange,\n onCancel,\n labels,\n notifyChangesOnFirstRender = false,\n hasTooltips = false,\n singleSelectionToggle,\n height: heightProp,\n maxHeight: maxHeightProp,\n virtualized = false,\n ...others\n } = useDefaultProps(\"HvDropdownList\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const [searchStr, setSearchStr] = useState<string>(\"\");\n const [list, setList] = useState<HvListValue[]>(clone(values));\n const [allSelected, setAllSelected] = useState<boolean>(false);\n const [anySelected, setAnySelected] = useState<boolean>(false);\n const { popper } = useBaseDropdownContext();\n const { maxWidth, maxHeight } = popper?.styles.popper || {};\n\n const hasChanges = useMemo(() => {\n return String(getSelectedIds(values)) !== String(getSelectedIds(list));\n }, [list, values]);\n\n const newLabels = {\n selectAll: labels?.selectAll,\n selectionConjunction: labels?.multiSelectionConjunction,\n };\n\n /**\n * Update states associated with select all.\n */\n const updateSelectAll = (listValues: HvListValue[]) => {\n if (!listValues) return;\n const nbrSelected = getSelected(listValues).length;\n const hasSelection = nbrSelected > 0;\n const allSelect = nbrSelected === listValues.length;\n\n setAnySelected(hasSelection);\n setAllSelected(hasSelection && allSelect);\n };\n\n /**\n * After the first render, call onChange if notifyChangesOnFirstRender.\n */\n useEffect(() => {\n if (!valuesExist(values)) return;\n setList(clone(values));\n updateSelectAll(values);\n if (notifyChangesOnFirstRender) {\n onChange?.(values, false, false, true);\n }\n }, [values, notifyChangesOnFirstRender, onChange]);\n\n /**\n * Sets the filtered values to the state.\n *\n * @param {String} str - The value that is being looked.\n */\n const handleSearch = (str: string) => {\n const results = list\n ? list.filter(\n ({\n searchValue,\n label,\n value,\n }: {\n searchValue?: any;\n label?: any;\n value?: any;\n }) => {\n let stringValue = \"\";\n if (\n typeof searchValue === \"string\" ||\n searchValue instanceof String\n ) {\n stringValue = searchValue.toLowerCase();\n } else if (typeof label === \"string\" || label instanceof String) {\n stringValue = label.toLowerCase();\n } else if (typeof value === \"string\" || value instanceof String) {\n stringValue = value.toLowerCase();\n }\n\n return stringValue.indexOf(str.toLowerCase()) >= 0;\n },\n )\n : null;\n\n if (results != null) {\n const newList = list.map((elem) => {\n const isResult = results.find((result) => result.label === elem.label);\n return { ...elem, isHidden: !isResult };\n });\n\n setList(newList);\n setSearchStr(str);\n }\n return str;\n };\n\n /**\n * Create search element.\n *\n * @returns {*}\n */\n const renderSearch = () => (\n <div className={classes.searchContainer}>\n <HvInput\n id={setId(id, \"search\")}\n type=\"search\"\n value={searchStr}\n placeholder={labels?.searchPlaceholder}\n aria-label={labels?.searchPlaceholder}\n onChange={(event, str) => handleSearch(str)}\n />\n </div>\n );\n\n /**\n * Select all the values inside the dropdown.\n *\n */\n const handleSelectAll = () => {\n const newList = list.map((elem) => ({ ...elem, selected: !anySelected }));\n setList(newList);\n updateSelectAll(newList);\n };\n\n /**\n * Create selecteAll component.\n *\n * @returns {*}\n */\n const renderSelectAll = () => {\n const selectAll = labels?.selectAll;\n const multiSelectionConjunction = labels?.multiSelectionConjunction;\n const nbrSelected = getSelected(list).length;\n\n const defaultLabel = (\n <HvTypography component=\"span\">\n {nbrSelected > 0 ? (\n <>\n <b>{nbrSelected}</b>\n {` ${multiSelectionConjunction} ${list.length}`}\n </>\n ) : (\n <>\n <b>{selectAll}</b>\n {` (${list.length})`}\n </>\n )}\n </HvTypography>\n );\n\n return (\n <div className={classes.selectAllContainer}>\n <HvCheckBox\n id={setId(id, \"select-all\")}\n label={defaultLabel}\n onChange={() => handleSelectAll()}\n classes={{\n container: classes.selection,\n }}\n className={classes.selectAll}\n indeterminate={anySelected && !allSelected}\n checked={allSelected}\n />\n </div>\n );\n };\n\n /**\n * When selecting the state list is updated with the corresponding selection.\n *\n * @param listValues - elements selected.\n */\n const onSelection: HvListProps[\"onChange\"] = (listValues) => {\n if (!multiSelect) {\n onChange(cleanHidden(listValues), true, true, true);\n } else {\n updateSelectAll(listValues);\n setList(clone(listValues));\n }\n };\n\n /**\n * Render action buttons.\n */\n const renderActions = () => {\n const applyLabel = labels?.applyLabel;\n const cancelLabel = labels?.cancelLabel;\n return (\n <HvActionBar id={setId(id, \"actions\")}>\n <HvButton\n id={setId(id, \"actions-apply\")}\n disabled={!hasChanges}\n onClick={() => onChange(cleanHidden(list), true, true, true)}\n variant=\"primaryGhost\"\n >\n {applyLabel}\n </HvButton>\n <HvButton\n id={setId(id, \"actions-cancel\")}\n onClick={onCancel}\n variant=\"primaryGhost\"\n >\n {cancelLabel}\n </HvButton>\n </HvActionBar>\n );\n };\n\n const showList = valuesExist(values);\n /** bottom margin + Panel padding + Search size + SelectAll + ActionBar size */\n const elementsSize = theme.spacing(\n 5 + 2 + (showSearch ? 5 : 0) + (showList && multiSelect ? 4 + 6 : 0),\n );\n\n return (\n <div className={classes.rootList}>\n <div className={classes.listBorderDown} />\n <div className={classes.listContainer}>\n {showSearch && renderSearch()}\n {showList && multiSelect && renderSelectAll()}\n {showList && (\n <HvList\n id={setId(id, \"list\")}\n style={mergeStyles(undefined, {\n height: heightProp,\n \"--maxW\": maxWidth,\n \"--maxH\": maxHeightProp ?? `calc(${maxHeight} - ${elementsSize})`,\n })}\n classes={{\n root: cx(classes.dropdownListContainer, {\n [classes.virtualized]: virtualized,\n }),\n }}\n values={list}\n multiSelect={multiSelect}\n useSelector={multiSelect}\n showSelectAll={false}\n onChange={onSelection}\n labels={newLabels}\n hasTooltips={hasTooltips}\n selectable\n condensed\n singleSelectionToggle={singleSelectionToggle}\n height={heightProp}\n virtualized={virtualized}\n {...others}\n />\n )}\n </div>\n {showList && multiSelect ? renderActions() : null}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAqGA,MAAM,QAAQ,CAAC,WAA0B,OAAO,IAAI,CAAC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AA,CAC/D;AAAA,UACD,SAAS;AAAA,YACP,MAAM,GAAG,QAAQ,uBAAuB;AAAA,cACtC,CAAC,QAAQ,WAAW,GAAG;AAAA,YACxB,CAAA;AAAA,UACH;AAAA,UACA,QAAQ;AAAA,UACR;AAAA,UACA,aAAa;AAAA,UACb,eAAe;AAAA,UACf,UAAU;AAAA,UACV,QAAQ;AAAA,UACR;AAAA,UACA,YAAU;AAAA,UACV,WAAS;AAAA,UACT;AAAA,UACA,QAAQ;AAAA,UACR;AAAA,UACC,GAAG;AAAA,QAAA;AAAA,MAAA;AAAA,IACN,GAEJ;AAAA,IACC,YAAY,cAAc,kBAAkB;AAAA,EAAA,GAC/C;AAEJ;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../src/Dropdown/List/List.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport {\n mergeStyles,\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvActionBar } from \"../../ActionBar\";\nimport { useBaseDropdownContext } from \"../../BaseDropdown/context\";\nimport { HvButton } from \"../../Button\";\nimport { HvCheckBox } from \"../../CheckBox\";\nimport { HvInput } from \"../../Input\";\nimport { HvList, HvListProps, HvListValue } from \"../../List\";\nimport { CounterLabel } from \"../../utils/CounterLabel\";\nimport { setId } from \"../../utils/setId\";\nimport type { HvDropdownLabels } from \"../Dropdown\";\nimport { getSelected } from \"../utils\";\nimport { staticClasses, useClasses } from \"./List.styles\";\n\nexport { staticClasses as dropdownListClasses };\n\nexport type HvDropdownListClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDropdownListProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * A Jss Object used to override or extend the component styles.\n */\n classes?: HvDropdownListClasses;\n /**\n * The list to be rendered.\n */\n values?: HvListValue[];\n /**\n * If true renders a multi select list.\n */\n multiSelect?: boolean;\n /**\n * If true renders the search component.\n */\n showSearch?: boolean;\n /**\n * A function to be executed whenever a item is selected in the list\n * or the Apply button is activated (when `multiSelect` is `true`).\n */\n onChange: (\n /** An array containing the selected values */\n listValues: HvListValue[],\n /** If `true` the selection if finally committed the dropdown header text should reflect the new selection */\n commitChanges: boolean,\n /** If `true` the dropdown should toggle it's current state */\n toggle: boolean,\n /** If `true` the dropdown will call onChange */\n notifyChanges: boolean,\n ) => void;\n /**\n * A function to be executed whenever the Cancel button is activated.\n */\n onCancel: (event: React.MouseEvent) => void;\n /**\n * An object containing all the labels for the dropdown.\n */\n labels?: HvDropdownLabels;\n /**\n * If 'true' the dropdown will notify on the first render.\n */\n notifyChangesOnFirstRender?: boolean;\n /**\n * If `true` the dropdown will show tooltips when user mouseenter text in list\n */\n hasTooltips?: boolean;\n /**\n * If `true`, selection can be toggled when single selection.\n */\n singleSelectionToggle?: boolean;\n /**\n * Experimental. Height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class. Required in case virtualized is used\n */\n height?: number;\n /**\n * Experimental. Max height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class.\n */\n maxHeight?: number;\n /**\n * Experimental. Uses dropdown in a virtualized form, where not all options are rendered initially. Good for use cases with a lot of options.\n */\n virtualized?: boolean;\n}\n\n/**\n * The values property was being deeply cloned. That created a significant performance\n * hit when the values contained complex properties' values, like React Nodes.\n *\n * For minimizing the impact of removing the clone, a shallow clone of the array and its\n * objects is performed instead. That should have the same effect in the majority of the\n * cases, where the properties' values are primitive.\n */\nconst clone = (values: HvListValue[]) => values.map((value) => ({ ...value }));\n\n/**\n * Set all hidden's to false.\n */\nconst cleanHidden = (lst: HvListValue[]) =>\n lst.map((item) => ({ ...item, isHidden: false }));\n\nconst valuesExist = (values: HvListValue[]) =>\n values != null && values?.length > 0;\n\n/** Filter selected ordered element `id`s (or `label`) */\nconst getSelectedIds = (list: HvListValue[]) =>\n getSelected(list).map((item) => item.id || item.label);\n\nexport const HvDropdownList = (props: HvDropdownListProps) => {\n const {\n id,\n classes: classesProp,\n values = [],\n multiSelect = false,\n showSearch = false,\n onChange,\n onCancel,\n labels,\n notifyChangesOnFirstRender = false,\n hasTooltips = false,\n singleSelectionToggle,\n height: heightProp,\n maxHeight: maxHeightProp,\n virtualized = false,\n ...others\n } = useDefaultProps(\"HvDropdownList\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const [searchStr, setSearchStr] = useState<string>(\"\");\n const [list, setList] = useState<HvListValue[]>(clone(values));\n const [allSelected, setAllSelected] = useState<boolean>(false);\n const [anySelected, setAnySelected] = useState<boolean>(false);\n const { popper } = useBaseDropdownContext();\n const { maxWidth, maxHeight } = popper?.styles.popper || {};\n\n const hasChanges = useMemo(() => {\n return String(getSelectedIds(values)) !== String(getSelectedIds(list));\n }, [list, values]);\n\n const newLabels = {\n selectAll: labels?.selectAll,\n selectionConjunction: labels?.multiSelectionConjunction,\n };\n\n /**\n * Update states associated with select all.\n */\n const updateSelectAll = (listValues: HvListValue[]) => {\n if (!listValues) return;\n const nbrSelected = getSelected(listValues).length;\n const hasSelection = nbrSelected > 0;\n const allSelect = nbrSelected === listValues.length;\n\n setAnySelected(hasSelection);\n setAllSelected(hasSelection && allSelect);\n };\n\n /**\n * After the first render, call onChange if notifyChangesOnFirstRender.\n */\n useEffect(() => {\n if (!valuesExist(values)) return;\n setList(clone(values));\n updateSelectAll(values);\n if (notifyChangesOnFirstRender) {\n onChange?.(values, false, false, true);\n }\n }, [values, notifyChangesOnFirstRender, onChange]);\n\n /**\n * Sets the filtered values to the state.\n *\n * @param {String} str - The value that is being looked.\n */\n const handleSearch = (str: string) => {\n const results = list\n ? list.filter(\n ({\n searchValue,\n label,\n value,\n }: {\n searchValue?: any;\n label?: any;\n value?: any;\n }) => {\n let stringValue = \"\";\n if (\n typeof searchValue === \"string\" ||\n searchValue instanceof String\n ) {\n stringValue = searchValue.toLowerCase();\n } else if (typeof label === \"string\" || label instanceof String) {\n stringValue = label.toLowerCase();\n } else if (typeof value === \"string\" || value instanceof String) {\n stringValue = value.toLowerCase();\n }\n\n return stringValue.indexOf(str.toLowerCase()) >= 0;\n },\n )\n : null;\n\n if (results != null) {\n const newList = list.map((elem) => {\n const isResult = results.find((result) => result.label === elem.label);\n return { ...elem, isHidden: !isResult };\n });\n\n setList(newList);\n setSearchStr(str);\n }\n return str;\n };\n\n /**\n * Create search element.\n *\n * @returns {*}\n */\n const renderSearch = () => (\n <div className={classes.searchContainer}>\n <HvInput\n id={setId(id, \"search\")}\n type=\"search\"\n value={searchStr}\n placeholder={labels?.searchPlaceholder}\n aria-label={labels?.searchPlaceholder}\n onChange={(event, str) => handleSearch(str)}\n />\n </div>\n );\n\n /**\n * Select all the values inside the dropdown.\n *\n */\n const handleSelectAll = () => {\n const newList = list.map((elem) => ({ ...elem, selected: !anySelected }));\n setList(newList);\n updateSelectAll(newList);\n };\n\n const renderSelectAll = () => {\n return (\n <HvCheckBox\n id={setId(id, \"select-all\")}\n label={\n <CounterLabel\n selected={getSelected(list).length}\n total={list.length}\n conjunctionLabel={labels?.multiSelectionConjunction}\n />\n }\n onChange={handleSelectAll}\n className={classes.selectAll}\n indeterminate={anySelected && !allSelected}\n checked={allSelected}\n />\n );\n };\n\n /**\n * When selecting the state list is updated with the corresponding selection.\n *\n * @param listValues - elements selected.\n */\n const onSelection: HvListProps[\"onChange\"] = (listValues) => {\n if (!multiSelect) {\n onChange(cleanHidden(listValues), true, true, true);\n } else {\n updateSelectAll(listValues);\n setList(clone(listValues));\n }\n };\n\n /**\n * Render action buttons.\n */\n const renderActions = () => {\n const applyLabel = labels?.applyLabel;\n const cancelLabel = labels?.cancelLabel;\n return (\n <HvActionBar id={setId(id, \"actions\")}>\n <HvButton\n id={setId(id, \"actions-apply\")}\n disabled={!hasChanges}\n onClick={() => onChange(cleanHidden(list), true, true, true)}\n variant=\"primaryGhost\"\n >\n {applyLabel}\n </HvButton>\n <HvButton\n id={setId(id, \"actions-cancel\")}\n onClick={onCancel}\n variant=\"primaryGhost\"\n >\n {cancelLabel}\n </HvButton>\n </HvActionBar>\n );\n };\n\n const showList = valuesExist(values);\n /** bottom margin + Panel padding + Search size + SelectAll + ActionBar size */\n const elementsSize = theme.spacing(\n 5 + 2 + (showSearch ? 5 : 0) + (showList && multiSelect ? 4 + 6 : 0),\n );\n\n return (\n <div className={classes.rootList}>\n <div className={classes.listBorderDown} />\n <div className={classes.listContainer}>\n {showSearch && renderSearch()}\n {showList && multiSelect && renderSelectAll()}\n {showList && (\n <HvList\n id={setId(id, \"list\")}\n style={mergeStyles(undefined, {\n height: heightProp,\n \"--maxW\": maxWidth,\n \"--maxH\": maxHeightProp ?? `calc(${maxHeight} - ${elementsSize})`,\n })}\n classes={{\n root: cx(classes.dropdownListContainer, {\n [classes.virtualized]: virtualized,\n }),\n }}\n values={list}\n multiSelect={multiSelect}\n useSelector={multiSelect}\n showSelectAll={false}\n onChange={onSelection}\n labels={newLabels}\n hasTooltips={hasTooltips}\n selectable\n condensed\n singleSelectionToggle={singleSelectionToggle}\n height={heightProp}\n virtualized={virtualized}\n {...others}\n />\n )}\n </div>\n {showList && multiSelect ? renderActions() : null}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAqGA,MAAM,QAAQ,CAAC,WAA0B,OAAO,IAAI,CAAC,WAAW,EAAE,GAAG,MAAA,EAAQ;AAK7E,MAAM,cAAc,CAAC,QACnB,IAAI,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,UAAU,MAAQ,EAAA;AAElD,MAAM,cAAc,CAAC,WACnB,UAAU,QAAQ,QAAQ,SAAS;AAGrC,MAAM,iBAAiB,CAAC,SACtB,YAAY,IAAI,EAAE,IAAI,CAAC,SAAS,KAAK,MAAM,KAAK,KAAK;AAE1C,MAAA,iBAAiB,CAAC,UAA+B;AACtD,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT,SAAS,CAAC;AAAA,IACV,cAAc;AAAA,IACd,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA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oBAAA,OAAA,EAAI,WAAW,QAAQ,eAAgB,CAAA;AAAA,IACvC,qBAAA,OAAA,EAAI,WAAW,QAAQ,eACrB,UAAA;AAAA,MAAA,cAAc,aAAa;AAAA,MAC3B,YAAY,eAAe,gBAAgB;AAAA,MAC3C,YACC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAI,MAAM,IAAI,MAAM;AAAA,UACpB,OAAO,YAAY,QAAW;AAAA,YAC5B,QAAQ;AAAA,YACR,UAAU;AAAA,YACV,UAAU,iBAAiB,QAAQ,SAAS,MAAM,YAAY;AAAA,UAAA,CAC/D;AAAA,UACD,SAAS;AAAA,YACP,MAAM,GAAG,QAAQ,uBAAuB;AAAA,cACtC,CAAC,QAAQ,WAAW,GAAG;AAAA,YACxB,CAAA;AAAA,UACH;AAAA,UACA,QAAQ;AAAA,UACR;AAAA,UACA,aAAa;AAAA,UACb,eAAe;AAAA,UACf,UAAU;AAAA,UACV,QAAQ;AAAA,UACR;AAAA,UACA,YAAU;AAAA,UACV,WAAS;AAAA,UACT;AAAA,UACA,QAAQ;AAAA,UACR;AAAA,UACC,GAAG;AAAA,QAAA;AAAA,MAAA;AAAA,IACN,GAEJ;AAAA,IACC,YAAY,cAAc,kBAAkB;AAAA,EAAA,GAC/C;AAEJ;"}
@@ -18,8 +18,6 @@ const { staticClasses, useClasses } = createClasses("HvDropdownList", {
18
18
  searchContainer: { marginBottom: theme.space.xs },
19
19
  listBorderDown: {},
20
20
  listContainer: { padding: theme.space.sm },
21
- selectAllContainer: {},
22
- selection: {},
23
21
  selectAll: {}
24
22
  });
25
23
  export {