@hitachivantara/uikit-react-core 5.34.0 → 5.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/cjs/components/BaseInput/BaseInput.styles.cjs +14 -16
  2. package/dist/cjs/components/BaseInput/BaseInput.styles.cjs.map +1 -1
  3. package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.cjs +14 -19
  4. package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.cjs.map +1 -1
  5. package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs +7 -38
  6. package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs.map +1 -1
  7. package/dist/cjs/components/Drawer/Drawer.cjs +26 -8
  8. package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
  9. package/dist/cjs/components/Dropdown/List/List.cjs +5 -1
  10. package/dist/cjs/components/Dropdown/List/List.cjs.map +1 -1
  11. package/dist/cjs/components/ListContainer/ListItem/ListItem.cjs +3 -2
  12. package/dist/cjs/components/ListContainer/ListItem/ListItem.cjs.map +1 -1
  13. package/dist/cjs/components/TreeView/TreeItem/DefaultContent.cjs +54 -0
  14. package/dist/cjs/components/TreeView/TreeItem/DefaultContent.cjs.map +1 -0
  15. package/dist/cjs/components/TreeView/TreeItem/TreeItem.cjs +124 -0
  16. package/dist/cjs/components/TreeView/TreeItem/TreeItem.cjs.map +1 -0
  17. package/dist/cjs/components/TreeView/TreeItem/TreeItem.styles.cjs +74 -0
  18. package/dist/cjs/components/TreeView/TreeItem/TreeItem.styles.cjs.map +1 -0
  19. package/dist/cjs/components/TreeView/TreeItem/useHvTreeItem.cjs +62 -0
  20. package/dist/cjs/components/TreeView/TreeItem/useHvTreeItem.cjs.map +1 -0
  21. package/dist/cjs/components/TreeView/TreeView.cjs +72 -0
  22. package/dist/cjs/components/TreeView/TreeView.cjs.map +1 -0
  23. package/dist/cjs/components/TreeView/TreeView.styles.cjs +18 -0
  24. package/dist/cjs/components/TreeView/TreeView.styles.cjs.map +1 -0
  25. package/dist/cjs/components/TreeView/internals.cjs +30 -0
  26. package/dist/cjs/components/TreeView/internals.cjs.map +1 -0
  27. package/dist/cjs/index.cjs +10 -0
  28. package/dist/cjs/index.cjs.map +1 -1
  29. package/dist/esm/components/BaseInput/BaseInput.styles.js +14 -16
  30. package/dist/esm/components/BaseInput/BaseInput.styles.js.map +1 -1
  31. package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.js +15 -20
  32. package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.js.map +1 -1
  33. package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js +7 -38
  34. package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js.map +1 -1
  35. package/dist/esm/components/Drawer/Drawer.js +28 -10
  36. package/dist/esm/components/Drawer/Drawer.js.map +1 -1
  37. package/dist/esm/components/Dropdown/List/List.js +6 -2
  38. package/dist/esm/components/Dropdown/List/List.js.map +1 -1
  39. package/dist/esm/components/ListContainer/ListItem/ListItem.js +4 -3
  40. package/dist/esm/components/ListContainer/ListItem/ListItem.js.map +1 -1
  41. package/dist/esm/components/TreeView/TreeItem/DefaultContent.js +54 -0
  42. package/dist/esm/components/TreeView/TreeItem/DefaultContent.js.map +1 -0
  43. package/dist/esm/components/TreeView/TreeItem/TreeItem.js +125 -0
  44. package/dist/esm/components/TreeView/TreeItem/TreeItem.js.map +1 -0
  45. package/dist/esm/components/TreeView/TreeItem/TreeItem.styles.js +74 -0
  46. package/dist/esm/components/TreeView/TreeItem/TreeItem.styles.js.map +1 -0
  47. package/dist/esm/components/TreeView/TreeItem/useHvTreeItem.js +62 -0
  48. package/dist/esm/components/TreeView/TreeItem/useHvTreeItem.js.map +1 -0
  49. package/dist/esm/components/TreeView/TreeView.js +73 -0
  50. package/dist/esm/components/TreeView/TreeView.js.map +1 -0
  51. package/dist/esm/components/TreeView/TreeView.styles.js +18 -0
  52. package/dist/esm/components/TreeView/TreeView.styles.js.map +1 -0
  53. package/dist/esm/components/TreeView/internals.js +15 -0
  54. package/dist/esm/components/TreeView/internals.js.map +1 -0
  55. package/dist/esm/index.js +12 -2
  56. package/dist/esm/index.js.map +1 -1
  57. package/dist/types/index.d.ts +126 -9
  58. package/package.json +6 -5
@@ -17,6 +17,10 @@ const {
17
17
  }
18
18
  },
19
19
  disabled: {
20
+ "& $inputRoot": {
21
+ backgroundColor: theme.colors.atmo2,
22
+ borderColor: theme.colors.secondary_60
23
+ },
20
24
  "& $inputBorderContainer": {
21
25
  backgroundColor: theme.colors.atmo4
22
26
  },
@@ -81,19 +85,19 @@ const {
81
85
  "& $inputRootMultiline": {
82
86
  "& $input": {
83
87
  border: `1px solid ${theme.colors.secondary_60}`,
84
- backgroundColor: "transparent"
88
+ backgroundColor: theme.colors.atmo2
85
89
  }
86
90
  },
87
91
  "&:hover $inputRootMultiline": {
88
92
  "& $input": {
89
93
  border: `1px solid ${theme.colors.secondary_60}`,
90
- backgroundColor: "transparent"
94
+ backgroundColor: theme.colors.atmo2
91
95
  }
92
96
  },
93
97
  "&:focus-within $inputRootMultiline": {
94
98
  "& $input": {
95
99
  border: `1px solid ${theme.colors.secondary_60}`,
96
- backgroundColor: "transparent"
100
+ backgroundColor: theme.colors.atmo2
97
101
  }
98
102
  }
99
103
  },
@@ -110,14 +114,14 @@ const {
110
114
  },
111
115
  inputRootReadOnly: {
112
116
  borderColor: theme.colors.secondary_60,
113
- backgroundColor: "transparent"
117
+ backgroundColor: theme.colors.atmo2
114
118
  },
115
119
  inputRoot: {
116
120
  margin: 0,
117
121
  width: "100%",
118
122
  borderRadius: theme.radii.base,
119
123
  height: "32px",
120
- border: `1px solid ${theme.colors.secondary_80}`,
124
+ border: `1px solid ${theme.colors.secondary}`,
121
125
  boxSizing: "border-box",
122
126
  backgroundColor: theme.colors.atmo1,
123
127
  fontFamily: theme.fontFamily.body,
@@ -135,23 +139,17 @@ const {
135
139
  }
136
140
  },
137
141
  inputRootFocused: {
138
- background: theme.colors.atmo1,
142
+ backgroundColor: theme.colors.atmo1,
139
143
  ...outlineStyles,
140
144
  "&:hover": {
141
- background: theme.colors.atmo1
145
+ backgroundColor: theme.colors.atmo1
142
146
  },
143
- "& $inputRootReadOnly": {
144
- backgroundColor: "transparent"
147
+ "&$inputRootReadOnly": {
148
+ backgroundColor: theme.colors.atmo2
145
149
  }
146
150
  },
147
151
  inputRootDisabled: {
148
- background: theme.colors.atmo2,
149
- borderColor: theme.colors.secondary_60,
150
152
  cursor: "not-allowed",
151
- "&:hover": {
152
- background: theme.colors.atmo2,
153
- cursor: "not-allowed"
154
- },
155
153
  "&&::before": {
156
154
  borderBottomStyle: "none"
157
155
  }
@@ -163,7 +161,7 @@ const {
163
161
  border: "none",
164
162
  height: "auto",
165
163
  "& $input": {
166
- border: `1px solid ${theme.colors.secondary_80}`,
164
+ border: `1px solid ${theme.colors.secondary}`,
167
165
  borderRadius: theme.radii.base,
168
166
  backgroundColor: theme.colors.atmo1,
169
167
  height: "auto",
@@ -1 +1 @@
1
- {"version":3,"file":"BaseInput.styles.js","sources":["../../../../src/components/BaseInput/BaseInput.styles.tsx"],"sourcesContent":["import { CSSProperties } from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"@core/utils/focusUtils\";\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvBaseInput\", {\n root: {\n display: \"inline-block\",\n width: \"100%\",\n position: \"relative\",\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.primary,\n },\n\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: theme.colors.primary,\n },\n },\n disabled: {\n \"& $inputBorderContainer\": {\n backgroundColor: theme.colors.atmo4,\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.atmo4,\n },\n\n \"&& $input\": {\n color: theme.colors.secondary_60,\n WebkitTextFillColor: theme.colors.secondary_60,\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.colors.atmo2,\n border: `1px solid ${theme.colors.secondary_60}`,\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.colors.atmo2,\n border: `1px solid ${theme.colors.secondary_60}`,\n },\n },\n },\n invalid: {\n \"&:not(.disabled)\": {\n \"& $inputBorderContainer\": {\n backgroundColor: theme.colors.negative,\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.negative,\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.negative}`,\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.negative}`,\n },\n },\n\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.negative}`,\n },\n },\n },\n },\n resizable: { width: \"auto\" },\n readOnly: {\n \"& $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_60}`,\n backgroundColor: \"transparent\",\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_60}`,\n backgroundColor: \"transparent\",\n },\n },\n\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_60}`,\n backgroundColor: \"transparent\",\n },\n },\n },\n inputBorderContainer: {\n position: \"absolute\",\n width: \"calc(100% - 4px)\",\n height: \"0px\",\n top: \"31px\",\n left: \"2px\",\n backgroundColor: theme.colors.atmo4,\n },\n inputRootInvalid: { borderColor: theme.colors.negative },\n inputRootReadOnly: {\n borderColor: theme.colors.secondary_60,\n backgroundColor: \"transparent\",\n },\n inputRoot: {\n margin: 0,\n width: \"100%\",\n borderRadius: theme.radii.base,\n height: \"32px\",\n border: `1px solid ${theme.colors.secondary_80}`,\n boxSizing: \"border-box\",\n backgroundColor: theme.colors.atmo1,\n fontFamily: theme.fontFamily.body,\n\n \"&:hover:not($inputRootDisabled):not($inputRootInvalid):not($inputRootReadOnly)\":\n {\n borderColor: theme.colors.primary,\n },\n\n \"&:hover:not($inputRootDisabled)::before\": {\n borderBottom: \"none\",\n },\n\n \"&::before\": {\n borderBottom: \"none\",\n },\n\n \"&::after\": {\n borderBottom: \"none\",\n },\n },\n inputRootFocused: {\n background: theme.colors.atmo1,\n ...outlineStyles,\n\n \"&:hover\": {\n background: theme.colors.atmo1,\n },\n\n \"& $inputRootReadOnly\": {\n backgroundColor: \"transparent\",\n },\n },\n inputRootDisabled: {\n background: theme.colors.atmo2,\n borderColor: theme.colors.secondary_60,\n cursor: \"not-allowed\",\n\n \"&:hover\": {\n background: theme.colors.atmo2,\n cursor: \"not-allowed\",\n },\n\n \"&&::before\": {\n borderBottomStyle: \"none\",\n },\n },\n inputRootMultiline: {\n padding: 0,\n backgroundColor: \"transparent\",\n overflow: \"auto\",\n border: \"none\",\n height: \"auto\",\n\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_80}`,\n borderRadius: theme.radii.base,\n backgroundColor: theme.colors.atmo1,\n height: \"auto\",\n minHeight: \"21px\",\n padding: \"5px 10px\",\n overflow: \"auto\",\n marginLeft: \"0px\",\n marginRight: \"0px\",\n\n \"&:hover\": {\n border: `1px solid ${theme.colors.primary}`,\n },\n },\n },\n input: {\n height: \"19px\",\n marginLeft: theme.space.xs,\n marginRight: theme.space.xs,\n padding: \"6px 0 5px\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n outline: \"none\",\n width: \"initial\",\n flexGrow: 1,\n ...(theme.typography.body as CSSProperties),\n\n \"&::placeholder\": {\n opacity: 1,\n color: theme.colors.secondary_80,\n },\n\n \"&::-ms-clear\": {\n display: \"none\",\n },\n },\n inputDisabled: {},\n inputReadOnly: {\n color: theme.colors.secondary_80,\n },\n inputResizable: { resize: \"both\", width: \"100%\" },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","display","width","position","backgroundColor","theme","colors","primary","disabled","atmo4","color","secondary_60","WebkitTextFillColor","atmo2","border","invalid","negative","resizable","readOnly","inputBorderContainer","height","top","left","inputRootInvalid","borderColor","inputRootReadOnly","inputRoot","margin","borderRadius","radii","base","secondary_80","boxSizing","atmo1","fontFamily","body","borderBottom","inputRootFocused","background","outlineStyles","inputRootDisabled","cursor","borderBottomStyle","inputRootMultiline","padding","overflow","minHeight","marginLeft","marginRight","input","space","xs","textOverflow","outline","flexGrow","typography","opacity","inputDisabled","inputReadOnly","inputResizable","resize"],"mappings":";;;AAOa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,eAAe;AAAA,EACxEC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,OAAO;AAAA,IACPC,UAAU;AAAA,IAEV,iCAAiC;AAAA,MAC/BC,iBAAiBC,MAAMC,OAAOC;AAAAA,IAChC;AAAA,IAEA,wCAAwC;AAAA,MACtCH,iBAAiBC,MAAMC,OAAOC;AAAAA,IAChC;AAAA,EACF;AAAA,EACAC,UAAU;AAAA,IACR,2BAA2B;AAAA,MACzBJ,iBAAiBC,MAAMC,OAAOG;AAAAA,IAChC;AAAA,IAEA,iCAAiC;AAAA,MAC/BL,iBAAiBC,MAAMC,OAAOG;AAAAA,IAChC;AAAA,IAEA,aAAa;AAAA,MACXC,OAAOL,MAAMC,OAAOK;AAAAA,MACpBC,qBAAqBP,MAAMC,OAAOK;AAAAA,IACpC;AAAA,IAEA,yBAAyB;AAAA,MACvB,YAAY;AAAA,QACVP,iBAAiBC,MAAMC,OAAOO;AAAAA,QAC9BC,QAAS,aAAYT,MAAMC,OAAOK,YAAa;AAAA,MACjD;AAAA,IACF;AAAA,IAEA,+BAA+B;AAAA,MAC7B,YAAY;AAAA,QACVP,iBAAiBC,M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aseInput.styles.tsx"],"sourcesContent":["import { CSSProperties } from \"react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"@core/utils/focusUtils\";\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvBaseInput\", {\n root: {\n display: \"inline-block\",\n width: \"100%\",\n position: \"relative\",\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.primary,\n },\n\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: theme.colors.primary,\n },\n },\n disabled: {\n \"& $inputRoot\": {\n backgroundColor: theme.colors.atmo2,\n borderColor: theme.colors.secondary_60,\n },\n\n \"& $inputBorderContainer\": {\n backgroundColor: theme.colors.atmo4,\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.atmo4,\n },\n\n \"&& $input\": {\n color: theme.colors.secondary_60,\n WebkitTextFillColor: theme.colors.secondary_60,\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.colors.atmo2,\n border: `1px solid ${theme.colors.secondary_60}`,\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.colors.atmo2,\n border: `1px solid ${theme.colors.secondary_60}`,\n },\n },\n },\n invalid: {\n \"&:not(.disabled)\": {\n \"& $inputBorderContainer\": {\n backgroundColor: theme.colors.negative,\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.negative,\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.negative}`,\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.negative}`,\n },\n },\n\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.negative}`,\n },\n },\n },\n },\n resizable: { width: \"auto\" },\n readOnly: {\n \"& $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_60}`,\n backgroundColor: theme.colors.atmo2,\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_60}`,\n backgroundColor: theme.colors.atmo2,\n },\n },\n\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_60}`,\n backgroundColor: theme.colors.atmo2,\n },\n },\n },\n inputBorderContainer: {\n position: \"absolute\",\n width: \"calc(100% - 4px)\",\n height: \"0px\",\n top: \"31px\",\n left: \"2px\",\n backgroundColor: theme.colors.atmo4,\n },\n inputRootInvalid: { borderColor: theme.colors.negative },\n inputRootReadOnly: {\n borderColor: theme.colors.secondary_60,\n backgroundColor: theme.colors.atmo2,\n },\n inputRoot: {\n margin: 0,\n width: \"100%\",\n borderRadius: theme.radii.base,\n height: \"32px\",\n border: `1px solid ${theme.colors.secondary}`,\n boxSizing: \"border-box\",\n backgroundColor: theme.colors.atmo1,\n fontFamily: theme.fontFamily.body,\n\n \"&:hover:not($inputRootDisabled):not($inputRootInvalid):not($inputRootReadOnly)\":\n {\n borderColor: theme.colors.primary,\n },\n\n \"&:hover:not($inputRootDisabled)::before\": {\n borderBottom: \"none\",\n },\n\n \"&::before\": {\n borderBottom: \"none\",\n },\n\n \"&::after\": {\n borderBottom: \"none\",\n },\n },\n inputRootFocused: {\n backgroundColor: theme.colors.atmo1,\n ...outlineStyles,\n\n \"&:hover\": {\n backgroundColor: theme.colors.atmo1,\n },\n\n \"&$inputRootReadOnly\": {\n backgroundColor: theme.colors.atmo2,\n },\n },\n inputRootDisabled: {\n cursor: \"not-allowed\",\n\n \"&&::before\": {\n borderBottomStyle: \"none\",\n },\n },\n inputRootMultiline: {\n padding: 0,\n backgroundColor: \"transparent\",\n overflow: \"auto\",\n border: \"none\",\n height: \"auto\",\n\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary}`,\n borderRadius: theme.radii.base,\n backgroundColor: theme.colors.atmo1,\n height: \"auto\",\n minHeight: \"21px\",\n padding: \"5px 10px\",\n overflow: \"auto\",\n marginLeft: \"0px\",\n marginRight: \"0px\",\n\n \"&:hover\": {\n border: `1px solid ${theme.colors.primary}`,\n },\n },\n },\n input: {\n height: \"19px\",\n marginLeft: theme.space.xs,\n marginRight: theme.space.xs,\n padding: \"6px 0 5px\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n outline: \"none\",\n width: \"initial\",\n flexGrow: 1,\n ...(theme.typography.body as CSSProperties),\n\n \"&::placeholder\": {\n opacity: 1,\n color: theme.colors.secondary_80,\n },\n\n \"&::-ms-clear\": {\n display: \"none\",\n },\n },\n inputDisabled: {},\n inputReadOnly: {\n color: theme.colors.secondary_80,\n },\n inputResizable: { resize: \"both\", width: \"100%\" },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","display","width","position","backgroundColor","theme","colors","primary","disabled","atmo2","borderColor","secondary_60","atmo4","color","WebkitTextFillColor","border","invalid","negative","resizable","readOnly","inputBorderContainer","height","top","left","inputRootInvalid","inputRootReadOnly","inputRoot","margin","borderRadius","radii","base","secondary","boxSizing","atmo1","fontFamily","body","borderBottom","inputRootFocused","outlineStyles","inputRootDisabled","cursor","borderBottomStyle","inputRootMultiline","padding","overflow","minHeight","marginLeft","marginRight","input","space","xs","textOverflow","outline","flexGrow","typography","opacity","secondary_80","inputDisabled","inputReadOnly","inputResizable","resize"],"mappings":";;;AAMa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,eAAe;AAAA,EACxEC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,OAAO;AAAA,IACPC,UAAU;AAAA,IAEV,iCAAiC;AAAA,MAC/BC,iBAAiBC,MAAMC,OAAOC;AAAAA,IAChC;AAAA,IAEA,wCAAwC;AAAA,MACtC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aAAa1C,MAAM4C,MAAMC;AAAAA,IACzBP,SAAS;AAAA,IACTC,UAAU;AAAA,IACVO,cAAc;AAAA,IACdC,SAAS;AAAA,IACTlD,OAAO;AAAA,IACPmD,UAAU;AAAA,IACV,GAAIhD,MAAMiD,WAAWnB;AAAAA,IAErB,kBAAkB;AAAA,MAChBoB,SAAS;AAAA,MACT1C,OAAOR,MAAMC,OAAOkD;AAAAA,IACtB;AAAA,IAEA,gBAAgB;AAAA,MACdvD,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACAwD,eAAe,CAAC;AAAA,EAChBC,eAAe;AAAA,IACb7C,OAAOR,MAAMC,OAAOkD;AAAAA,EACtB;AAAA,EACAG,gBAAgB;AAAA,IAAEC,QAAQ;AAAA,IAAQ1D,OAAO;AAAA,EAAO;AAClD,CAAC;"}
@@ -1,6 +1,5 @@
1
- import { jsxs, Fragment, jsx } from "@emotion/react/jsx-runtime";
1
+ import { jsxs, jsx } from "@emotion/react/jsx-runtime";
2
2
  import { useContext, useState, useEffect } from "react";
3
- import { Info } from "@hitachivantara/uikit-react-icons";
4
3
  import dayjs from "dayjs";
5
4
  import localeData from "dayjs/plugin/localeData";
6
5
  import localizedFormat from "dayjs/plugin/localizedFormat";
@@ -15,6 +14,7 @@ import { useDefaultProps } from "../../../hooks/useDefaultProps.js";
15
14
  import { HvFormElementContext } from "../../Forms/FormElement/context/FormElementContext.js";
16
15
  import { HvFormElementDescriptorsContext } from "../../Forms/FormElement/context/FormElementDescriptorsContext.js";
17
16
  import { HvTypography } from "../../Typography/Typography.js";
17
+ import { HvInput } from "../../Input/Input.js";
18
18
  dayjs.extend(localeData);
19
19
  dayjs.extend(localizedFormat);
20
20
  dayjs.extend(customParseFormat);
@@ -28,8 +28,7 @@ const HvCalendarHeader = (props) => {
28
28
  showEndDate,
29
29
  showDayOfWeek = false,
30
30
  onFocus,
31
- invalidDateLabel = "Invalid Date",
32
- ...others
31
+ invalidDateLabel = "Invalid Date"
33
32
  } = useDefaultProps("HvCalendarHeader", props);
34
33
  const {
35
34
  classes,
@@ -109,23 +108,19 @@ const HvCalendarHeader = (props) => {
109
108
  setEditedValue(formattedDate);
110
109
  onFocus?.(event, formattedDate);
111
110
  };
112
- const onChangeHandler = (event) => {
113
- setEditedValue(event.target.value);
111
+ const onChangeHandler = (event, val) => {
112
+ setEditedValue(val);
114
113
  };
115
- return /* @__PURE__ */ jsxs(Fragment, { children: [
116
- /* @__PURE__ */ jsxs("div", { id: localId, className: cx(classes.root, {
117
- [classes.invalid]: !isValidValue && inputValue !== ""
118
- }), children: [
119
- showDayOfWeek && /* @__PURE__ */ jsx(HvTypography, { className: classes.headerDayOfWeek, children: weekdayDisplay || " " }),
120
- /* @__PURE__ */ jsx("div", { className: classes.headerDate, children: /* @__PURE__ */ jsx("input", { type: "text", id: setId(localId, "header-input"), placeholder: localeFormat, value: inputValue, className: classes.input, onBlur: onBlurHandler, onFocus: onFocusHandler, onChange: onChangeHandler, onKeyDown: keyDownHandler, "aria-labelledby": label?.[0]?.id, ...others }) })
121
- ] }),
122
- !isValidValue && inputValue !== "" && /* @__PURE__ */ jsx("div", { role: "presentation", className: classes.inputBorderContainer }),
123
- /* @__PURE__ */ jsx("div", { style: {
124
- height: 32
125
- }, children: !isValidValue && inputValue !== "" && /* @__PURE__ */ jsxs(HvTypography, { component: "span", variant: "body", className: classes?.invalidMessageStyling, children: [
126
- /* @__PURE__ */ jsx(Info, { color: "brand", iconSize: "S" }),
127
- invalidDateLabel
128
- ] }) })
114
+ const isInvalid = !isValidValue && inputValue !== "";
115
+ return /* @__PURE__ */ jsxs("div", { id: localId, className: cx(classes.root, {
116
+ [classes.invalid]: isInvalid
117
+ }), children: [
118
+ showDayOfWeek && /* @__PURE__ */ jsx(HvTypography, { className: classes.headerDayOfWeek, children: weekdayDisplay || " " }),
119
+ /* @__PURE__ */ jsx(HvInput, { type: "text", id: setId(localId, "header-input"), className: classes.headerDate, classes: {
120
+ input: classes.input,
121
+ inputBorderContainer: classes.inputBorderContainer,
122
+ error: classes.invalidMessageStyling
123
+ }, placeholder: localeFormat, value: inputValue, "aria-labelledby": label?.[0]?.id, onBlur: onBlurHandler, onFocus: onFocusHandler, onChange: onChangeHandler, onKeyDown: keyDownHandler, status: isInvalid ? "invalid" : "valid", statusMessage: invalidDateLabel })
129
124
  ] });
130
125
  };
131
126
  HvCalendarHeader.formElementType = "HvCalendarHeader";
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarHeader.js","sources":["../../../../../src/components/Calendar/CalendarHeader/CalendarHeader.tsx"],"sourcesContent":["import { useState, useEffect, useContext } from \"react\";\n\nimport { Info } from \"@hitachivantara/uikit-react-icons\";\n\nimport dayjs from \"dayjs\";\nimport localeData from \"dayjs/plugin/localeData\";\nimport localizedFormat from \"dayjs/plugin/localizedFormat\";\nimport customParseFormat from \"dayjs/plugin/customParseFormat\";\n\nimport {\n HvFormElementContext,\n HvFormElementValueContext,\n HvFormElementDescriptorsContext,\n} from \"@core/components/Forms\";\nimport { isKey } from \"@core/utils/keyboardUtils\";\nimport { setId } from \"@core/utils/setId\";\n\nimport { HvTypography } from \"@core/components/Typography\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport { isRange, isSameDay, formatToLocale, isDate } from \"../utils\";\nimport { DateRangeProp } from \"../types\";\nimport { staticClasses, useClasses } from \"./CalendarHeader.styles\";\n\nexport { staticClasses as calendarHeaderClasses };\n\nexport type HvCalendarHeaderClasses = ExtractNames<typeof useClasses>;\n\ndayjs.extend(localeData);\ndayjs.extend(localizedFormat);\ndayjs.extend(customParseFormat);\n\nexport const HvCalendarHeader = (props: HvCalendarHeaderProps) => {\n const {\n id,\n value,\n locale = \"en-US\",\n classes: classesProp,\n onChange,\n showEndDate,\n showDayOfWeek = false,\n onFocus,\n invalidDateLabel = \"Invalid Date\",\n ...others\n } = useDefaultProps(\"HvCalendarHeader\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { elementId } = useContext(HvFormElementContext);\n const elementValue = useContext(HvFormElementValueContext);\n const { label } = useContext(HvFormElementDescriptorsContext);\n\n let localValue: string | Date | DateRangeProp | undefined =\n value ?? elementValue ?? \"\";\n if (isRange(localValue)) {\n localValue = showEndDate ? localValue.endDate : localValue.startDate;\n }\n const [dateValue, setDateValue] = useState<\n string | Date | DateRangeProp | undefined\n >(localValue);\n const [editedValue, setEditedValue] = useState<string | null>(null);\n const [displayValue, setDisplayValue] = useState(\"\");\n const [weekdayDisplay, setWeekdayDisplay] = useState(\"\");\n\n const localId = id ?? setId(elementId, \"calendarHeader\");\n\n const inputValue = editedValue ?? displayValue;\n const localeFormat = dayjs().locale(locale).localeData().longDateFormat(\"L\");\n\n const [isValidValue, setIsValidValue] = useState(\n inputValue.length === 0 || (!!inputValue && dayjs(localValue).isValid())\n );\n\n const validateInput = (incomingValid) =>\n incomingValid === undefined || dayjs(incomingValid).isValid();\n useEffect(() => {\n const valid = validateInput(localValue);\n setIsValidValue(valid);\n if (valid) {\n if (!localValue) {\n setDisplayValue(\"\");\n setEditedValue(null);\n setWeekdayDisplay(\"\");\n return;\n }\n const weekday = new Intl.DateTimeFormat(locale, {\n weekday: \"short\",\n }).format(isDate(localValue) ? localValue : 0);\n setDisplayValue(formatToLocale(localValue, locale));\n setEditedValue(null);\n setWeekdayDisplay(weekday);\n }\n }, [localValue, locale]);\n\n const handleNewDate = (event, date) => {\n // attempt to format in locale data, or fallback to default\n const localeParsedDate = dayjs(date, localeFormat);\n\n const isValidInput = localeParsedDate.isValid();\n const dateParsed = isValidInput\n ? localeParsedDate.toDate()\n : dayjs(date).toDate();\n // prevent extra updates\n if (!isSameDay(dateParsed, dateValue)) {\n setDateValue(dateParsed);\n onChange?.(event, dateParsed);\n }\n\n setIsValidValue(isValidInput);\n if (isValidInput) {\n setEditedValue(null);\n }\n };\n\n const onBlurHandler = (event) => {\n if (editedValue == null) return;\n if (editedValue === \"\") {\n setIsValidValue(true);\n setEditedValue(null);\n return;\n }\n handleNewDate(event, editedValue);\n };\n\n const keyDownHandler = (event) => {\n if (!isKey(event, \"Enter\") || editedValue == null || editedValue === \"\")\n return;\n event.preventDefault();\n\n handleNewDate(event, editedValue);\n };\n\n const onFocusHandler = (event) => {\n if (!localValue) return;\n const formattedDate =\n isValidValue && isDate(localValue)\n ? dayjs(localValue).locale(locale).format(\"L\")\n : editedValue;\n setEditedValue(formattedDate);\n onFocus?.(event, formattedDate);\n };\n\n const onChangeHandler = (event) => {\n setEditedValue(event.target.value);\n };\n return (\n <>\n <div\n id={localId}\n className={cx(classes.root, {\n [classes.invalid]: !isValidValue && inputValue !== \"\",\n })}\n >\n {showDayOfWeek && (\n <HvTypography className={classes.headerDayOfWeek}>\n {weekdayDisplay || \"\\u00A0\"}\n </HvTypography>\n )}\n\n <div className={classes.headerDate}>\n <input\n type=\"text\"\n id={setId(localId, \"header-input\")}\n placeholder={localeFormat}\n value={inputValue}\n className={classes.input}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n onChange={onChangeHandler}\n onKeyDown={keyDownHandler}\n aria-labelledby={label?.[0]?.id}\n {...others}\n />\n </div>\n </div>\n {!isValidValue && inputValue !== \"\" && (\n <div role=\"presentation\" className={classes.inputBorderContainer} />\n )}\n <div style={{ height: 32 }}>\n {!isValidValue && inputValue !== \"\" && (\n <HvTypography\n component=\"span\"\n variant=\"body\"\n className={classes?.invalidMessageStyling}\n >\n <Info color=\"brand\" iconSize=\"S\" />\n {invalidDateLabel}\n </HvTypography>\n )}\n </div>\n </>\n );\n};\n\n// TODO: refactor this out\nHvCalendarHeader.formElementType = \"HvCalendarHeader\";\n\nexport interface HvCalendarHeaderProps {\n /**\n * A Jss Object used to override or extend the component styles.\n */\n classes?: HvCalendarHeaderClasses;\n /**\n * Identifier.\n */\n id?: string;\n /**\n * The text to be shown on the main part of the header.\n */\n value?: string | Date | DateRangeProp;\n /**\n * Locale to be used by the calendar.\n */\n locale?: string;\n /**\n * Callback to define the input date.\n */\n onChange?: (\n event:\n | React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>\n | undefined,\n value: Date | DateRangeProp\n ) => void;\n /**\n * Callback to handle input onFocus.\n */\n onFocus?: (\n event: React.FocusEventHandler<any>,\n formattedDate: string | null\n ) => void;\n /**\n * Indicates if header should display end date in a date range.\n */\n showEndDate?: boolean;\n /**\n * Indicates if header should display the day of week.\n */\n showDayOfWeek?: boolean;\n /**\n * Label shown when date is invalid.\n */\n invalidDateLabel?: string;\n}\n"],"names":["dayjs","extend","localeData","localizedFormat","customParseFormat","HvCalendarHeader","props","id","value","locale","classes","classesProp","onChange","showEndDate","showDayOfWeek","onFocus","invalidDateLabel","others","useDefaultProps","cx","useClasses","elementId","useContext","HvFormElementContext","elementValue","HvFormElementValueContext","label","HvFormElementDescriptorsContext","localValue","isRange","endDate","startDate","dateValue","setDateValue","useState","editedValue","setEditedValue","displayValue","setDisplayValue","weekdayDisplay","setWeekdayDisplay","localId","setId","inputValue","localeFormat","longDateFormat","isValidValue","setIsValidValue","length","isValid","validateInput","incomingValid","undefined","useEffect","valid","weekday","Intl","DateTimeFormat","format","isDate","formatToLocale","handleNewDate","event","date","localeParsedDate","isValidInput","dateParsed","toDate","isSameDay","onBlurHandler","keyDownHandler","isKey","preventDefault","onFocusHandler","formattedDate","onChangeHandler","target","root","invalid","headerDayOfWeek","headerDate","input","inputBorderContainer","height","invalidMessageStyling","formElementType"],"mappings":";;;;;;;;;;;;;;;;;AA6BAA,MAAMC,OAAOC,UAAU;AACvBF,MAAMC,OAAOE,eAAe;AAC5BH,MAAMC,OAAOG,iBAAiB;AAEjBC,MAAAA,mBAAmBA,CAACC,UAAiC;AAC1D,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,SAAS;AAAA,IACTC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC,gBAAgB;AAAA,IAChBC;AAAAA,IACAC,mBAAmB;AAAA,IACnB,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,oBAAoBZ,KAA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,kBAAmBb,CAAU,UAAA;AAClBA,mBAAAA,MAAMc,OAAOpE,KAAK;AAAA,EAAA;AAEnC,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAA,qBAAC,SACC,IAAIiC,SACJ,WAAWtB,GAAGT,QAAQmE,MAAM;AAAA,MAC1B,CAACnE,QAAQoE,OAAO,GAAG,CAAChC,gBAAgBH,eAAe;AAAA,IACpD,CAAA,GAEA7B,UAAAA;AAAAA,MAAAA,qCACE,cAAa,EAAA,WAAWJ,QAAQqE,iBAC9BxC,4BAAkB,KACrB;AAAA,0BAGD,OAAI,EAAA,WAAW7B,QAAQsE,YACtB,8BAAC,SACC,EAAA,MAAK,QACL,IAAItC,MAAMD,SAAS,cAAc,GACjC,aAAaG,cACb,OAAOD,YACP,WAAWjC,QAAQuE,OACnB,QAAQZ,eACR,SAASI,gBACT,UAAUE,iBACV,WAAWL,gBACX,mBAAiB5C,QAAQ,CAAC,GAAGnB,IAC7B,GAAIU,OAAO,CAAA,GAEf;AAAA,IAAA,GACF;AAAA,IACC,CAAC6B,gBAAgBH,eAAe,MAC/B,oBAAC,SAAI,MAAK,gBAAe,WAAWjC,QAAQwE,qBAC7C,CAAA;AAAA,IACD,oBAAC,SAAI,OAAO;AAAA,MAAEC,QAAQ;AAAA,IAAA,GACnB,UAAA,CAACrC,gBAAgBH,eAAe,MAC/B,qBAAC,cACC,EAAA,WAAU,QACV,SAAQ,QACR,WAAWjC,SAAS0E,uBAEpB,UAAA;AAAA,MAAA,oBAAC,MAAK,EAAA,OAAM,SAAQ,UAAS,KAAG;AAAA,MAC/BpE;AAAAA,IAAAA,EAAAA,CACH,EAEJ,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;AAGAX,iBAAiBgF,kBAAkB;"}
1
+ {"version":3,"file":"CalendarHeader.js","sources":["../../../../../src/components/Calendar/CalendarHeader/CalendarHeader.tsx"],"sourcesContent":["import { useState, useEffect, useContext } from \"react\";\nimport dayjs from \"dayjs\";\nimport localeData from \"dayjs/plugin/localeData\";\nimport localizedFormat from \"dayjs/plugin/localizedFormat\";\nimport customParseFormat from \"dayjs/plugin/customParseFormat\";\n\nimport {\n HvFormElementContext,\n HvFormElementValueContext,\n HvFormElementDescriptorsContext,\n} from \"@core/components/Forms\";\nimport { isKey } from \"@core/utils/keyboardUtils\";\nimport { setId } from \"@core/utils/setId\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { useDefaultProps } from \"@core/hooks\";\nimport { HvInput, HvInputProps } from \"@core/components/Input\";\n\nimport { isRange, isSameDay, formatToLocale, isDate } from \"../utils\";\nimport { DateRangeProp } from \"../types\";\nimport { staticClasses, useClasses } from \"./CalendarHeader.styles\";\n\nexport { staticClasses as calendarHeaderClasses };\n\nexport type HvCalendarHeaderClasses = ExtractNames<typeof useClasses>;\n\ndayjs.extend(localeData);\ndayjs.extend(localizedFormat);\ndayjs.extend(customParseFormat);\n\nexport const HvCalendarHeader = (props: HvCalendarHeaderProps) => {\n const {\n id,\n value,\n locale = \"en-US\",\n classes: classesProp,\n onChange,\n showEndDate,\n showDayOfWeek = false,\n onFocus,\n invalidDateLabel = \"Invalid Date\",\n } = useDefaultProps(\"HvCalendarHeader\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const { elementId } = useContext(HvFormElementContext);\n const elementValue = useContext(HvFormElementValueContext);\n const { label } = useContext(HvFormElementDescriptorsContext);\n\n let localValue: string | Date | DateRangeProp | undefined =\n value ?? elementValue ?? \"\";\n if (isRange(localValue)) {\n localValue = showEndDate ? localValue.endDate : localValue.startDate;\n }\n\n const [dateValue, setDateValue] = useState<\n string | Date | DateRangeProp | undefined\n >(localValue);\n const [editedValue, setEditedValue] = useState<string | null>(null);\n const [displayValue, setDisplayValue] = useState(\"\");\n const [weekdayDisplay, setWeekdayDisplay] = useState(\"\");\n\n const localId = id ?? setId(elementId, \"calendarHeader\");\n\n const inputValue = editedValue ?? displayValue;\n const localeFormat = dayjs().locale(locale).localeData().longDateFormat(\"L\");\n\n const [isValidValue, setIsValidValue] = useState(\n inputValue.length === 0 || (!!inputValue && dayjs(localValue).isValid())\n );\n\n const validateInput = (incomingValid) =>\n incomingValid === undefined || dayjs(incomingValid).isValid();\n\n useEffect(() => {\n const valid = validateInput(localValue);\n setIsValidValue(valid);\n if (valid) {\n if (!localValue) {\n setDisplayValue(\"\");\n setEditedValue(null);\n setWeekdayDisplay(\"\");\n return;\n }\n const weekday = new Intl.DateTimeFormat(locale, {\n weekday: \"short\",\n }).format(isDate(localValue) ? localValue : 0);\n setDisplayValue(formatToLocale(localValue, locale));\n setEditedValue(null);\n setWeekdayDisplay(weekday);\n }\n }, [localValue, locale]);\n\n const handleNewDate = (event, date) => {\n // attempt to format in locale data, or fallback to default\n const localeParsedDate = dayjs(date, localeFormat);\n\n const isValidInput = localeParsedDate.isValid();\n const dateParsed = isValidInput\n ? localeParsedDate.toDate()\n : dayjs(date).toDate();\n // prevent extra updates\n if (!isSameDay(dateParsed, dateValue)) {\n setDateValue(dateParsed);\n onChange?.(event, dateParsed);\n }\n\n setIsValidValue(isValidInput);\n if (isValidInput) {\n setEditedValue(null);\n }\n };\n\n const onBlurHandler: HvInputProps[\"onBlur\"] = (event) => {\n if (editedValue == null) return;\n if (editedValue === \"\") {\n setIsValidValue(true);\n setEditedValue(null);\n return;\n }\n handleNewDate(event, editedValue);\n };\n\n const keyDownHandler: HvInputProps[\"onKeyDown\"] = (event) => {\n if (!isKey(event, \"Enter\") || editedValue == null || editedValue === \"\")\n return;\n event.preventDefault();\n\n handleNewDate(event, editedValue);\n };\n\n const onFocusHandler: HvInputProps[\"onFocus\"] = (event) => {\n if (!localValue) return;\n const formattedDate =\n isValidValue && isDate(localValue)\n ? dayjs(localValue).locale(locale).format(\"L\")\n : editedValue;\n setEditedValue(formattedDate);\n onFocus?.(event, formattedDate);\n };\n\n const onChangeHandler: HvInputProps[\"onChange\"] = (event, val) => {\n setEditedValue(val);\n };\n\n const isInvalid = !isValidValue && inputValue !== \"\";\n\n // This component needs to be further refactored\n // It's not possible to clear the date\n // In a new major there's no need for all these classes\n return (\n <div\n id={localId}\n className={cx(classes.root, {\n [classes.invalid]: isInvalid,\n })}\n >\n {showDayOfWeek && (\n <HvTypography className={classes.headerDayOfWeek}>\n {weekdayDisplay || \"\\u00A0\"}\n </HvTypography>\n )}\n <HvInput\n type=\"text\"\n id={setId(localId, \"header-input\")}\n className={classes.headerDate}\n classes={{\n input: classes.input,\n inputBorderContainer: classes.inputBorderContainer,\n error: classes.invalidMessageStyling,\n }}\n placeholder={localeFormat}\n value={inputValue}\n aria-labelledby={label?.[0]?.id}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n onChange={onChangeHandler}\n onKeyDown={keyDownHandler}\n status={isInvalid ? \"invalid\" : \"valid\"}\n statusMessage={invalidDateLabel}\n />\n </div>\n );\n};\n\n// TODO: refactor this out\nHvCalendarHeader.formElementType = \"HvCalendarHeader\";\n\nexport interface HvCalendarHeaderProps {\n /**\n * A Jss Object used to override or extend the component styles.\n */\n classes?: HvCalendarHeaderClasses;\n /**\n * Identifier.\n */\n id?: string;\n /**\n * The text to be shown on the main part of the header.\n */\n value?: string | Date | DateRangeProp;\n /**\n * Locale to be used by the calendar.\n */\n locale?: string;\n /**\n * Callback to define the input date.\n */\n onChange?: (\n event:\n | React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>\n | undefined,\n value: Date | DateRangeProp\n ) => void;\n /**\n * Callback to handle input onFocus.\n */\n onFocus?: (\n event: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>,\n formattedDate: string | null\n ) => void;\n /**\n * Indicates if header should display end date in a date range.\n */\n showEndDate?: boolean;\n /**\n * Indicates if header should display the day of week.\n */\n showDayOfWeek?: boolean;\n /**\n * Label shown when date is invalid.\n */\n invalidDateLabel?: string;\n}\n"],"names":["dayjs","extend","localeData","localizedFormat","customParseFormat","HvCalendarHeader","props","id","value","locale","classes","classesProp","onChange","showEndDate","showDayOfWeek","onFocus","invalidDateLabel","useDefaultProps","cx","useClasses","elementId","useContext","HvFormElementContext","elementValue","HvFormElementValueContext","label","HvFormElementDescriptorsContext","localValue","isRange","endDate","startDate","dateValue","setDateValue","useState","editedValue","setEditedValue","displayValue","setDisplayValue","weekdayDisplay","setWeekdayDisplay","localId","setId","inputValue","localeFormat","longDateFormat","isValidValue","setIsValidValue","length","isValid","validateInput","incomingValid","undefined","useEffect","valid","weekday","Intl","DateTimeFormat","format","isDate","formatToLocale","handleNewDate","event","date","localeParsedDate","isValidInput","dateParsed","toDate","isSameDay","onBlurHandler","keyDownHandler","isKey","preventDefault","onFocusHandler","formattedDate","onChangeHandler","val","isInvalid","root","invalid","headerDayOfWeek","headerDate","input","inputBorderContainer","error","invalidMessageStyling","formElementType"],"mappings":";;;;;;;;;;;;;;;;;AA0BAA,MAAMC,OAAOC,UAAU;AACvBF,MAAMC,OAAOE,eAAe;AAC5BH,MAAMC,OAAOG,iBAAiB;AAEjBC,MAAAA,mBAAmBA,CAACC,UAAiC;AAC1D,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,SAAS;AAAA,IACTC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC,gBAAgB;AAAA,IAChBC;AAAAA,IACAC,mBAAmB;AAAA,EAAA,IACjBC,gBAAgB,oBAAoBX,KAAK;AAEvC,QAAA;AAAA,IAAEI;AAAAA,IAASQ;AAAAA,EAAAA,IAAOC,WAAWR,WAAW;AAExC,QAAA;AAAA,IAAES;AAAAA,EAAAA,IAAcC,WAAWC,oBAAoB;AAC/CC,QAAAA,eAAeF,WAAWG,yBAAyB;AACnD,QAAA;AAAA,IAAEC;AAAAA,EAAAA,IAAUJ,WAAWK,+BAA+B;AAExDC,MAAAA,aACFnB,SAASe,gBAAgB;AACvBK,MAAAA,QAAQD,UAAU,GAAG;AACVd,iBAAAA,cAAcc,WAAWE,UAAUF,WAAWG;AAAAA,EAC7D;AAEA,QAAM,CAACC,WAAWC,YAA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,GACjC,WAAW9B,QAAQsE,YACnB,SAAS;AAAA,MACPC,OAAOvE,QAAQuE;AAAAA,MACfC,sBAAsBxE,QAAQwE;AAAAA,MAC9BC,OAAOzE,QAAQ0E;AAAAA,IACjB,GACA,aAAazC,cACb,OAAOD,YACP,mBAAiBjB,QAAQ,CAAC,GAAGlB,IAC7B,QAAQ6D,eACR,SAASI,gBACT,UAAUE,iBACV,WAAWL,gBACX,QAAQO,YAAY,YAAY,SAChC,eAAe5D,iBAAiB,CAAA;AAAA,EAEpC,EAAA,CAAA;AAEJ;AAGAX,iBAAiBgF,kBAAkB;"}
@@ -1,54 +1,23 @@
1
1
  import { theme } from "@hitachivantara/uikit-styles";
2
2
  import { createClasses } from "../../../utils/classes.js";
3
- import { outlineStyles } from "../../../utils/focusUtils.js";
4
3
  const {
5
4
  staticClasses,
6
5
  useClasses
7
6
  } = createClasses("HvCalendarHeader", {
8
7
  root: {
9
- marginTop: theme.spacing("xs"),
10
- backgroundColor: theme.colors.atmo1,
11
- border: `1px solid ${theme.colors.secondary_80}`,
12
- "&:hover, &:focus": {
13
- borderBottom: `1px solid ${theme.colors.secondary}`
8
+ paddingBottom: theme.space.md,
9
+ "&$invalid": {
10
+ paddingBottom: 0
14
11
  }
15
12
  },
16
13
  invalid: {},
17
14
  headerDayOfWeek: {
18
- color: theme.colors.secondary_80,
19
- paddingLeft: theme.spacing("xs")
15
+ color: theme.colors.secondary_80
20
16
  },
21
17
  headerDate: {},
22
- input: {
23
- border: "none",
24
- backgroundColor: "transparent",
25
- padding: `5px ${theme.spacing("xs")}`,
26
- fontFamily: theme.fontFamily.body,
27
- color: theme.colors.secondary_80,
28
- fontSize: theme.fontSizes.base,
29
- lineHeight: theme.lineHeights.base,
30
- fontWeight: theme.fontWeights.normal,
31
- width: "100%",
32
- "&::placeholder": {
33
- color: theme.colors.secondary_60
34
- },
35
- "&:focus": {
36
- outline: "none"
37
- },
38
- "&:focus-visible": {
39
- ...outlineStyles
40
- }
41
- },
42
- inputBorderContainer: {
43
- backgroundColor: theme.colors.negative,
44
- height: 1,
45
- marginTop: -1
46
- },
47
- invalidMessageStyling: {
48
- display: "flex",
49
- alignItems: "center",
50
- color: theme.colors.negative
51
- }
18
+ input: {},
19
+ inputBorderContainer: {},
20
+ invalidMessageStyling: {}
52
21
  });
53
22
  export {
54
23
  staticClasses,
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarHeader.styles.js","sources":["../../../../../src/components/Calendar/CalendarHeader/CalendarHeader.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\nimport { outlineStyles } from \"@core/utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvCalendarHeader\", {\n root: {\n marginTop: theme.spacing(\"xs\"),\n backgroundColor: theme.colors.atmo1,\n border: `1px solid ${theme.colors.secondary_80}`,\n \"&:hover, &:focus\": {\n borderBottom: `1px solid ${theme.colors.secondary}`,\n },\n },\n invalid: {},\n headerDayOfWeek: {\n color: theme.colors.secondary_80,\n paddingLeft: theme.spacing(\"xs\"),\n },\n headerDate: {},\n input: {\n border: \"none\",\n backgroundColor: \"transparent\",\n padding: `5px ${theme.spacing(\"xs\")}`,\n fontFamily: theme.fontFamily.body,\n\n color: theme.colors.secondary_80,\n fontSize: theme.fontSizes.base,\n lineHeight: theme.lineHeights.base,\n fontWeight: theme.fontWeights.normal,\n width: \"100%\",\n \"&::placeholder\": {\n color: theme.colors.secondary_60,\n },\n \"&:focus\": {\n outline: \"none\",\n },\n \"&:focus-visible\": {\n ...outlineStyles,\n },\n },\n inputBorderContainer: {\n backgroundColor: theme.colors.negative,\n height: 1,\n marginTop: -1,\n },\n invalidMessageStyling: {\n display: \"flex\",\n alignItems: \"center\",\n color: theme.colors.negative,\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","marginTop","theme","spacing","backgroundColor","colors","atmo1","border","secondary_80","borderBottom","secondary","invalid","headerDayOfWeek","color","paddingLeft","headerDate","input","padding","fontFamily","body","fontSize","fontSizes","base","lineHeight","lineHeights","fontWeight","fontWeights","normal","width","secondary_60","outline","outlineStyles","inputBorderContainer","negative","height","invalidMessageStyling","display","alignItems"],"mappings":";;;AAKa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,oBAAoB;AAAA,EAC7EC,MAAM;AAAA,IACJC,WAAWC,MAAMC,QAAQ,IAAI;AAAA,IAC7BC,iBAAiBF,MAAMG,OAAOC;AAAAA,IAC9BC,QAAS,aAAYL,MAAMG,OAAOG,YAAa;AAAA,IAC/C,oBAAoB;AAAA,MAClBC,cAAe,aAAYP,MAAMG,OAAOK,SAAU;AAAA,IACpD;AAAA,EACF;AAAA,EACAC,SAAS,CAAC;AAAA,EACVC,iBAAiB;AAAA,IACfC,OAAOX,MAAMG,OAAOG;AAAAA,IACpBM,aAAaZ,MAAMC,QAAQ,IAAI;AAAA,EACjC;AAAA,EACAY,YAAY,CAAC;AAAA,EACbC,OAAO;AAAA,IACLT,QAAQ;AAAA,IACRH,iBAAiB;AAAA,IACjBa,SAAU,OAAMf,MAAMC,QAAQ,IAAI,CAAE;AAAA,IACpCe,YAAYhB,MAAMgB,WAAWC;AAAAA,IAE7BN,OAAOX,MAAMG,OAAOG;AAAAA,IACpBY,UAAUlB,MAAMmB,UAAUC;AAAAA,IAC1BC,YAAYrB,MAAMsB,YAAYF;AAAAA,IAC9BG,YAAYvB,MAAMwB,YAAYC;AAAAA,IAC9BC,OAAO;AAAA,IACP,kBAAkB;AAAA,MAChBf,OAAOX,MAAMG,OAAOwB;AAAAA,IACtB;AAAA,IACA,WAAW;AAAA,MACTC,SAAS;AAAA,IACX;AAAA,IACA,mBAAmB;AAAA,MACjB,GAAGC;AAAAA,IACL;AAAA,EACF;AAAA,EACAC,sBAAsB;AAAA,IACpB5B,iBAAiBF,MAAMG,OAAO4B;AAAAA,IAC9BC,QAAQ;AAAA,IACRjC,WAAW;AAAA,EACb;AAAA,EACAkC,uBAAuB;AAAA,IACrBC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZxB,OAAOX,MAAMG,OAAO4B;AAAAA,EACtB;AACF,CAAC;"}
1
+ {"version":3,"file":"CalendarHeader.styles.js","sources":["../../../../../src/components/Calendar/CalendarHeader/CalendarHeader.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvCalendarHeader\", {\n root: {\n paddingBottom: theme.space.md,\n\n \"&$invalid\": {\n paddingBottom: 0,\n },\n },\n invalid: {},\n headerDayOfWeek: {\n color: theme.colors.secondary_80,\n },\n headerDate: {},\n input: {},\n inputBorderContainer: {},\n invalidMessageStyling: {},\n});\n"],"names":["staticClasses","useClasses","createClasses","root","paddingBottom","theme","space","md","invalid","headerDayOfWeek","color","colors","secondary_80","headerDate","input","inputBorderContainer","invalidMessageStyling"],"mappings":";;AAIa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,oBAAoB;AAAA,EAC7EC,MAAM;AAAA,IACJC,eAAeC,MAAMC,MAAMC;AAAAA,IAE3B,aAAa;AAAA,MACXH,eAAe;AAAA,IACjB;AAAA,EACF;AAAA,EACAI,SAAS,CAAC;AAAA,EACVC,iBAAiB;AAAA,IACfC,OAAOL,MAAMM,OAAOC;AAAAA,EACtB;AAAA,EACAC,YAAY,CAAC;AAAA,EACbC,OAAO,CAAC;AAAA,EACRC,sBAAsB,CAAC;AAAA,EACvBC,uBAAuB,CAAC;AAC1B,CAAC;"}
@@ -1,9 +1,12 @@
1
- import { jsxs, jsx } from "@emotion/react/jsx-runtime";
2
- import { Drawer } from "@mui/material";
1
+ import { jsxs, Fragment, jsx } from "@emotion/react/jsx-runtime";
2
+ import { Drawer, Backdrop } from "@mui/material";
3
3
  import { Close } from "@hitachivantara/uikit-react-icons";
4
+ import { theme } from "@hitachivantara/uikit-styles";
4
5
  import { useDefaultProps } from "../../hooks/useDefaultProps.js";
5
6
  import { withTooltip } from "../../hocs/withTooltip.js";
6
7
  import { setId } from "../../utils/setId.js";
8
+ import { useTheme } from "../../hooks/useTheme.js";
9
+ import { hexToRgbA } from "../../utils/hexToRgbA.js";
7
10
  import { useClasses } from "./Drawer.styles.js";
8
11
  import { staticClasses } from "./Drawer.styles.js";
9
12
  import { HvButton } from "../Button/Button.js";
@@ -17,21 +20,36 @@ const HvDrawer = (props) => {
17
20
  onClose,
18
21
  anchor = "right",
19
22
  buttonTitle = "Close",
23
+ showBackdrop = true,
24
+ disableBackdropClick = false,
20
25
  ...others
21
26
  } = useDefaultProps("HvDrawer", props);
22
27
  const {
23
28
  classes,
24
- cx
29
+ cx,
30
+ css
25
31
  } = useClasses(classesProp);
32
+ const {
33
+ colors
34
+ } = useTheme();
26
35
  const closeButtonDisplay = () => /* @__PURE__ */ jsx(Close, { role: "none" });
27
36
  const CloseButtonTooltipWrapper = buttonTitle ? withTooltip(closeButtonDisplay, buttonTitle, "top") : closeButtonDisplay;
28
- return /* @__PURE__ */ jsxs(Drawer, { className: cx(classes.root, className), id, anchor, open, PaperProps: {
29
- classes: {
30
- root: classes.paper
31
- }
32
- }, onClose, ...others, children: [
33
- /* @__PURE__ */ jsx(HvButton, { id: setId(id, "close"), className: classes.closeButton, variant: "secondaryGhost", onClick: onClose, "aria-label": buttonTitle, children: /* @__PURE__ */ jsx(CloseButtonTooltipWrapper, {}) }),
34
- children
37
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
38
+ /* @__PURE__ */ jsxs(Drawer, { className: cx(classes.root, className), id, anchor, open, PaperProps: {
39
+ classes: {
40
+ root: classes.paper
41
+ }
42
+ }, onClose, ...others, children: [
43
+ /* @__PURE__ */ jsx(HvButton, { id: setId(id, "close"), className: classes.closeButton, variant: "secondaryGhost", onClick: onClose, "aria-label": buttonTitle, children: /* @__PURE__ */ jsx(CloseButtonTooltipWrapper, {}) }),
44
+ children
45
+ ] }),
46
+ showBackdrop && /* @__PURE__ */ jsx(Backdrop, { open: !!open, onClick: (event) => {
47
+ if (disableBackdropClick)
48
+ return;
49
+ onClose?.(event, "backdropClick");
50
+ }, className: cx(css({
51
+ background: hexToRgbA(colors?.atmo4 || theme.colors.atmo4)
52
+ }), classes.background) })
35
53
  ] });
36
54
  };
37
55
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import {\n Drawer as MuiDrawer,\n DrawerProps as MuiDrawerProps,\n} from \"@mui/material\";\n\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { withTooltip } from \"@core/hocs/withTooltip\";\nimport { setId } from \"@core/utils/setId\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { HvButton } from \"@core/components/Button\";\n\nimport { staticClasses, useClasses } from \"./Drawer.styles\";\n\nexport { staticClasses as drawerClasses };\n\nexport type HvDrawerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDrawerProps\n extends MuiDrawerProps,\n Omit<MuiDrawerProps, \"classes\">,\n HvBaseProps<HTMLDivElement> {\n /**\n * Class names to be applied.\n */\n className?: string;\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 styles applied.\n */\n classes?: HvDrawerClasses;\n /**\n * Components of the Drawer.\n */\n children?: React.ReactNode;\n /**\n * Current state of the Drawer.\n */\n open?: boolean;\n /**\n * Function executed on close.\n * Extended from Modal from material-ui\n *\n */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /**\n * The side the drawer opens from.\n */\n anchor?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Title for the button close.\n */\n buttonTitle?: string;\n /** @ignore */\n ref?: MuiDrawerProps[\"ref\"];\n /** @ignore */\n component?: MuiDrawerProps[\"component\"];\n}\n\n/**\n * The Drawer component provides a foundation to create a sliding pane.\n * It only provides the pane with a close button, the rest of the\n * content can be customized.\n */\nexport const HvDrawer = (props: HvDrawerProps) => {\n const {\n className,\n classes: classesProp,\n id,\n children,\n open,\n onClose,\n anchor = \"right\",\n buttonTitle = \"Close\",\n ...others\n } = useDefaultProps(\"HvDrawer\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const closeButtonDisplay = () => <Close role=\"none\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n return (\n <MuiDrawer\n className={cx(classes.root, className)}\n id={id}\n anchor={anchor}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n onClose={onClose}\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"secondaryGhost\"\n onClick={onClose}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["HvDrawer","props","className","classes","classesProp","id","children","open","onClose","anchor","buttonTitle","others","useDefaultProps","cx","useClasses","closeButtonDisplay","CloseButtonTooltipWrapper","withTooltip","MuiDrawer","root","paper","setId","closeButton"],"mappings":";;;;;;;;;AAyEaA,MAAAA,WAAWA,CAACC,UAAyB;AAC1C,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAAS;AAAA,IACTC,cAAc;AAAA,IACd,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,YAAYX,KAAK;AAE/B,QAAA;AAAA,IAAEE;AAAAA,IAASU;AAAAA,EAAAA,IAAOC,WAAWV,WAAW;AAE9C,QAAMW,qBAAqBA,MAAO,oBAAA,OAAA,EAAM,MAAK,OAAS,CAAA;AAEtD,QAAMC,4BAA4BN,cAC9BO,YAAYF,oBAAoBL,aAAa,KAAK,IAClDK;AAGF,SAAA,qBAACG,QACC,EAAA,WAAWL,GAAGV,QAAQgB,MAAMjB,SAAS,GACrC,IACA,QACA,MACA,YAAY;AAAA,IACVC,SAAS;AAAA,MACPgB,MAAMhB,QAAQiB;AAAAA,IAChB;AAAA,EAAA,GAEF,SACIT,GAAAA,QAEJ,UAAA;AAAA,IAAA,oBAAC,YACC,IAAIU,MAAMhB,IAAI,OAAO,GACrB,WAAWF,QAAQmB,aACnB,SAAQ,kBACR,SAASd,SACT,cAAYE,aAEZ,UAAA,oBAAC,4BAAyB,CAAA,GAC5B;AAAA,IACCJ;AAAAA,EACH,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"Drawer.js","sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import {\n Drawer as MuiDrawer,\n DrawerProps as MuiDrawerProps,\n Backdrop as MuiBackdrop,\n} from \"@mui/material\";\n\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { withTooltip } from \"@core/hocs/withTooltip\";\nimport { setId } from \"@core/utils/setId\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { HvButton } from \"@core/components/Button\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\n\nimport { staticClasses, useClasses } from \"./Drawer.styles\";\n\nexport { staticClasses as drawerClasses };\n\nexport type HvDrawerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDrawerProps\n extends MuiDrawerProps,\n Omit<MuiDrawerProps, \"classes\">,\n HvBaseProps<HTMLDivElement> {\n /**\n * Class names to be applied.\n */\n className?: string;\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 styles applied.\n */\n classes?: HvDrawerClasses;\n /**\n * Components of the Drawer.\n */\n children?: React.ReactNode;\n /**\n * Current state of the Drawer.\n */\n open?: boolean;\n /**\n * Function executed on close.\n * Extended from Modal from material-ui\n *\n */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /**\n * The side the drawer opens from.\n */\n anchor?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Title for the button close.\n */\n buttonTitle?: string;\n /**\n * Show backdrop when drawer ix open.\n */\n showBackdrop?: boolean;\n /**\n * Prevent closing the dialog when clicking on the backdrop.\n */\n disableBackdropClick?: boolean;\n /** @ignore */\n ref?: MuiDrawerProps[\"ref\"];\n /** @ignore */\n component?: MuiDrawerProps[\"component\"];\n}\n\n/**\n * The Drawer component provides a foundation to create a sliding pane.\n * It only provides the pane with a close button, the rest of the\n * content can be customized.\n */\nexport const HvDrawer = (props: HvDrawerProps) => {\n const {\n className,\n classes: classesProp,\n id,\n children,\n open,\n onClose,\n anchor = \"right\",\n buttonTitle = \"Close\",\n showBackdrop = true,\n disableBackdropClick = false,\n ...others\n } = useDefaultProps(\"HvDrawer\", props);\n\n const { classes, cx, css } = useClasses(classesProp);\n const { colors } = useTheme();\n\n const closeButtonDisplay = () => <Close role=\"none\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n return (\n <>\n <MuiDrawer\n className={cx(classes.root, className)}\n id={id}\n anchor={anchor}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n onClose={onClose}\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"secondaryGhost\"\n onClick={onClose}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children}\n </MuiDrawer>\n {showBackdrop && (\n <MuiBackdrop\n open={!!open}\n onClick={(event: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (disableBackdropClick) return;\n onClose?.(event, \"backdropClick\");\n }}\n className={cx(\n css({\n background: hexToRgbA(colors?.atmo4 || theme.colors.atmo4),\n }),\n classes.background\n )}\n />\n )}\n </>\n );\n};\n"],"names":["HvDrawer","props","className","classes","classesProp","id","children","open","onClose","anchor","buttonTitle","showBackdrop","disableBackdropClick","others","useDefaultProps","cx","css","useClasses","colors","useTheme","closeButtonDisplay","CloseButtonTooltipWrapper","withTooltip","MuiDrawer","root","paper","setId","closeButton","MuiBackdrop","event","background","hexToRgbA","atmo4","theme"],"mappings":";;;;;;;;;;;;AAsFaA,MAAAA,WAAWA,CAACC,UAAyB;AAC1C,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAAS;AAAA,IACTC,cAAc;AAAA,IACdC,eAAe;AAAA,IACfC,uBAAuB;AAAA,IACvB,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,YAAYb,KAAK;AAE/B,QAAA;AAAA,IAAEE;AAAAA,IAASY;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,WAAWb,WAAW;AAC7C,QAAA;AAAA,IAAEc;AAAAA,MAAWC,SAAS;AAE5B,QAAMC,qBAAqBA,MAAO,oBAAA,OAAA,EAAM,MAAK,OAAS,CAAA;AAEtD,QAAMC,4BAA4BX,cAC9BY,YAAYF,oBAAoBV,aAAa,KAAK,IAClDU;AAEJ,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAC,qBAAAG,QAAA,EACC,WAAWR,GAAGZ,QAAQqB,MAAMtB,SAAS,GACrC,IACA,QACA,MACA,YAAY;AAAA,MACVC,SAAS;AAAA,QACPqB,MAAMrB,QAAQsB;AAAAA,MAChB;AAAA,IAAA,GAEF,SACIZ,GAAAA,QAEJ,UAAA;AAAA,MAAA,oBAAC,YACC,IAAIa,MAAMrB,IAAI,OAAO,GACrB,WAAWF,QAAQwB,aACnB,SAAQ,kBACR,SAASnB,SACT,cAAYE,aAEZ,UAAA,oBAAC,4BAAyB,CAAA,GAC5B;AAAA,MACCJ;AAAAA,IAAAA,GACH;AAAA,IACCK,oCACEiB,UACC,EAAA,MAAM,CAAC,CAACrB,MACR,SAAS,CAACsB,UAAqD;AACzDjB,UAAAA;AAAsB;AAC1BJ,gBAAUqB,OAAO,eAAe;AAAA,IAAA,GAElC,WAAWd,GACTC,IAAI;AAAA,MACFc,YAAYC,UAAUb,QAAQc,SAASC,MAAMf,OAAOc,KAAK;AAAA,IAAA,CAC1D,GACD7B,QAAQ2B,UACV,GAEH;AAAA,EACH,EAAA,CAAA;AAEJ;"}
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from "@emotion/react/jsx-runtime";
2
- import { useState, useContext, useEffect } from "react";
2
+ import { useState, useContext, useMemo, useEffect } from "react";
3
3
  import { theme } from "@hitachivantara/uikit-styles";
4
4
  import { setId } from "../../../utils/setId.js";
5
5
  import { useClasses } from "./List.styles.js";
@@ -21,6 +21,7 @@ const cleanHidden = (lst) => lst.map((item) => ({
21
21
  isHidden: false
22
22
  }));
23
23
  const valuesExist = (values) => values != null && values?.length > 0;
24
+ const getSelectedIds = (list) => getSelected(list).map((item) => item.id || item.label);
24
25
  const HvDropdownList = (props) => {
25
26
  const {
26
27
  id,
@@ -52,6 +53,9 @@ const HvDropdownList = (props) => {
52
53
  width,
53
54
  height
54
55
  } = useContext(BaseDropdownContext);
56
+ const hasChanges = useMemo(() => {
57
+ return String(getSelectedIds(values)) !== String(getSelectedIds(list));
58
+ }, [list, values]);
55
59
  const newLabels = {
56
60
  selectAll: labels?.selectAll,
57
61
  selectionConjunction: labels?.multiSelectionConjunction
@@ -139,7 +143,7 @@ const HvDropdownList = (props) => {
139
143
  const applyLabel = labels?.applyLabel;
140
144
  const cancelLabel = labels?.cancelLabel;
141
145
  return /* @__PURE__ */ jsxs(HvActionBar, { id: setId(id, "actions"), children: [
142
- /* @__PURE__ */ jsx(HvButton, { id: setId(id, "actions-apply"), onClick: () => onChange(cleanHidden(list), true, true, true), variant: "primaryGhost", children: applyLabel }),
146
+ /* @__PURE__ */ jsx(HvButton, { id: setId(id, "actions-apply"), disabled: !hasChanges, onClick: () => onChange(cleanHidden(list), true, true, true), variant: "primaryGhost", children: applyLabel }),
143
147
  /* @__PURE__ */ jsx(HvButton, { id: setId(id, "actions-cancel"), onClick: onCancel, variant: "primaryGhost", children: cancelLabel })
144
148
  ] });
145
149
  };
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../../src/components/Dropdown/List/List.tsx"],"sourcesContent":["import { MouseEvent, useContext, useEffect, useState } from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { setId } from \"@core/utils/setId\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { HvButton } from \"@core/components/Button\";\nimport { HvCheckBox } from \"@core/components/CheckBox\";\nimport { HvInput } from \"@core/components/Input\";\nimport { HvList, HvListProps, HvListValue } from \"@core/components/List\";\nimport { HvActionBar } from \"@core/components/ActionBar\";\nimport BaseDropdownContext from \"@core/components/BaseDropdown/BaseDropdownContext\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport { staticClasses, useClasses } from \"./List.styles\";\nimport { getSelected } from \"../utils\";\nimport { HvDropdownLabelsProps } from \"../types\";\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: MouseEvent) => void;\n /**\n * An object containing all the labels for the dropdown.\n */\n labels?: HvDropdownLabelsProps;\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\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: dropdownHeight,\n maxHeight,\n virtualized = false,\n ...others\n } = useDefaultProps(\"HvDropdownList\", props);\n const { classes, cx, css } = 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 { width, height } = useContext(BaseDropdownContext);\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 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\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 classes={{\n root: cx(\n classes.dropdownListContainer,\n css({\n maxWidth: width,\n maxHeight:\n maxHeight ??\n `calc(${height}px - 32px - ${theme.space.xs} - ${theme.space.sm})`,\n overflow: \"auto\",\n padding: 4,\n margin: -4,\n }),\n dropdownHeight &&\n css({\n height: dropdownHeight,\n }),\n virtualized &&\n css({\n maxWidth: \"inherit\",\n maxHeight: \"inherit\",\n overflow: \"inherit\",\n padding: 0,\n })\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={dropdownHeight}\n virtualized={virtualized}\n {...others}\n />\n )}\n </div>\n {showList && multiSelect ? renderActions() : null}\n </div>\n );\n};\n"],"names":["clone","values","map","value","cleanHidden","lst","item","isHidden","valuesExist","length","HvDropdownList","props","id","classes","classesProp","multiSelect","showSearch","onChange","onCancel","labels","notifyChangesOnFirstRender","hasTooltips","singleSelectionToggle","height","dropdownHeight","maxHeight","virtualized","others","useDefaultProps","cx","css","useClasses","searchStr","setSearchStr","useState","list","setList","allSelected","setAllSelected","anySelected","setAnySelected","width","useContext","BaseDropdownContext","newLabels","selectAll","selectionConjunction","multiSelectionConjunction","updateSelectAll","listValues","nbrSelected","getSelected","hasSelection","allSelect","useEffect","handleSearch","str","results","filter","searchValue","label","stringValue","String","toLowerCase","indexOf","newList","elem","isResult","find","result","renderSearch","searchContainer","setId","searchPlaceholder","event","handleSelectAll","selected","renderSelectAll","defaultLabel","selectAllContainer","container","selection","onSelection","renderActions","applyLabel","cancelLabel","showList","rootList","listBorderDown","listContainer","root","dropdownListContainer","maxWidth","theme","space","xs","sm","overflow","padding","margin"],"mappings":";;;;;;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AAA,QAAA,CACT,GACD3E,kBACEM,IAAI;AAAA,UACFP,QAAQC;AAAAA,QAAAA,CACT,GACHE,eACEI,IAAI;AAAA,UACF8D,UAAU;AAAA,UACVnE,WAAW;AAAA,UACXwE,UAAU;AAAA,UACVC,SAAS;AAAA,QAAA,CACV,CACL;AAAA,MACF,GACA,QAAQ/D,MACR,aACA,aAAapB,aACb,eAAe,OACf,UAAUmE,aACV,QAAQtC,WACR,aACA,YAAU,MACV,WAAS,MACT,uBACA,QAAQpB,gBACR,aACIG,GAAAA,QAEP;AAAA,IAAA,GACH;AAAA,IACC2D,YAAYvE,cAAcoE,cAAAA,IAAkB;AAAA,EAC/C,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../../src/components/Dropdown/List/List.tsx"],"sourcesContent":["import { MouseEvent, useContext, useEffect, useMemo, useState } from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { setId } from \"@core/utils/setId\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { HvButton } from \"@core/components/Button\";\nimport { HvCheckBox } from \"@core/components/CheckBox\";\nimport { HvInput } from \"@core/components/Input\";\nimport { HvList, HvListProps, HvListValue } from \"@core/components/List\";\nimport { HvActionBar } from \"@core/components/ActionBar\";\nimport BaseDropdownContext from \"@core/components/BaseDropdown/BaseDropdownContext\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport { staticClasses, useClasses } from \"./List.styles\";\nimport { getSelected } from \"../utils\";\nimport { HvDropdownLabelsProps } from \"../types\";\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: MouseEvent) => void;\n /**\n * An object containing all the labels for the dropdown.\n */\n labels?: HvDropdownLabelsProps;\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: dropdownHeight,\n maxHeight,\n virtualized = false,\n ...others\n } = useDefaultProps(\"HvDropdownList\", props);\n const { classes, cx, css } = 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 { width, height } = useContext(BaseDropdownContext);\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\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 classes={{\n root: cx(\n classes.dropdownListContainer,\n css({\n maxWidth: width,\n maxHeight:\n maxHeight ??\n `calc(${height}px - 32px - ${theme.space.xs} - ${theme.space.sm})`,\n overflow: \"auto\",\n padding: 4,\n margin: -4,\n }),\n dropdownHeight &&\n css({\n height: dropdownHeight,\n }),\n virtualized &&\n css({\n maxWidth: \"inherit\",\n maxHeight: \"inherit\",\n overflow: \"inherit\",\n padding: 0,\n })\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={dropdownHeight}\n virtualized={virtualized}\n {...others}\n />\n )}\n </div>\n {showList && multiSelect ? renderActions() : null}\n </div>\n );\n};\n"],"names":["clone","values","map","value","cleanHidden","lst","item","isHidden","valuesExist","length","getSelectedIds","list","getSelected","id","label","HvDropdownList","props","classes","classesProp","multiSelect","showSearch","onChange","onCancel","labels","notifyChangesOnFirstRender","hasTooltips","singleSelectionToggle","height","dropdownHeight","maxHeight","virtualized","others","useDefaultProps","cx","css","useClasses","searchStr","setSearchStr","useState","setList","allSelected","setAllSelected","anySelected","setAnySelected","width","useContext","BaseDropdownContext","hasChanges","useMemo","String","newLabels","selectAll","selectionConjunction","multiSelectionConjunction","updateSelectAll","listValues","nbrSelected","hasSelection","allSelect","useEffect","handleSearch","str","results","filter","searchValue","stringValue","toLowerCase","indexOf","newList","elem","isResult","find","result","renderSearch","searchContainer","setId","searchPlaceholder","event","handleSelectAll","selected","renderSelectAll","defaultLabel","selectAllContainer","container","selection","onSelection","renderActions","applyLabel","cancelLabel","showList","rootList","listBorderDown","listContainer","root","dropdownListContainer","maxWidth","theme","space","xs","sm","overflow","padding","margin"],"mappings":";;;;;;;;;;;;;;;AAqGA,MAAMA,QAAQA,CAACC,WAA0BA,OAAOC,IAAKC,CAAW,WAAA;AAAA,EAAE,GAAGA;AAAM,EAAE;AAK7E,MAAMC,cAAcA,CAACC,QACnBA,IAAIH,IAAKI,CAAU,UAAA;AAAA,EAAE,GAAGA;AAAAA,EAAMC,UAAU;AAAM,EAAE;AAElD,MAAMC,cAAcA,CAACP,WACnBA,UAAU,QAAQA,QAAQQ,SAAS;AAGrC,MAAMC,iBAAiBA,CAACC,SACtBC,YAAYD,IAAI,EAAET,IAAKI,CAASA,SAAAA,KAAKO,MAAMP,KAAKQ,KAAK;AAE1CC,MAAAA,iBAAiBA,CAACC,UAA+B;AACtD,QAAA;AAAA,IACJH;AAAAA,IACAI,SAASC;AAAAA,IACTjB,SAAS,CAAE;AAAA,IACXkB,cAAc;AAAA,IACdC,aAAa;AAAA,IACbC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,6BAA6B;AAAA,IAC7BC,cAAc;AAAA,IACdC;AAAAA,IACAC,QAAQC;AAAAA,IACRC;AAAAA,IACAC,cAAc;AAAA,IACd,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,kBAAkBhB,KAAK;AACrC,QAAA;AAAA,IAAEC;AAAAA,IAASgB;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,WAAWjB,WAAW;AAEnD,QAAM,CAACkB,WAAWC,Y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AgB,GAC9B,SAASS,UACT,SAAQ,gBAEPkE,UACH,YAAA,CAAA;AAAA,IACF,EAAA,CAAA;AAAA,EAAA;AAIEC,QAAAA,WAAWjF,YAAYP,MAAM;AAEnC,SACG,qBAAA,OAAA,EAAI,WAAWgB,QAAQyE,UACtB,UAAA;AAAA,IAAC,oBAAA,OAAA,EAAI,WAAWzE,QAAQ0E,eAAe,CAAA;AAAA,IACtC,qBAAA,OAAA,EAAI,WAAW1E,QAAQ2E,eACrBxE,UAAAA;AAAAA,MAAAA,cAAcqD,aAAa;AAAA,MAC3BgB,YAAYtE,eAAe6D,gBAAgB;AAAA,MAC3CS,gCACE,QACC,EAAA,IAAId,MAAM9D,IAAI,MAAM,GACpB,SAAS;AAAA,QACPgF,MAAM5D,GACJhB,QAAQ6E,uBACR5D,IAAI;AAAA,UACF6D,UAAUnD;AAAAA,UACVf,WACEA,aACC,QAAOF,MAAO,eAAcqE,MAAMC,MAAMC,EAAG,MAAKF,MAAMC,MAAME,EAAG;AAAA,UAClEC,UAAU;AAAA,UACVC,SAAS;AAAA,UACTC,QAAQ;AAAA,QAAA,CACT,GACD1E,kBACEM,IAAI;AAAA,UACFP,QAAQC;AAAAA,QAAAA,CACT,GACHE,eACEI,IAAI;AAAA,UACF6D,UAAU;AAAA,UACVlE,WAAW;AAAA,UACXuE,UAAU;AAAA,UACVC,SAAS;AAAA,QAAA,CACV,CACL;AAAA,MACF,GACA,QAAQ1F,MACR,aACA,aAAaQ,aACb,eAAe,OACf,UAAUkE,aACV,QAAQnC,WACR,aACA,YAAU,MACV,WAAS,MACT,uBACA,QAAQtB,gBACR,aACIG,GAAAA,QAEP;AAAA,IAAA,GACH;AAAA,IACC0D,YAAYtE,cAAcmE,cAAAA,IAAkB;AAAA,EAC/C,EAAA,CAAA;AAEJ;"}
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from "@emotion/react/jsx-runtime";
2
- import React__default, { useContext, useCallback, useMemo } from "react";
2
+ import React__default, { forwardRef, useContext, useCallback, useMemo } from "react";
3
3
  import { useDefaultProps } from "../../../hooks/useDefaultProps.js";
4
4
  import { useClasses } from "./ListItem.styles.js";
5
5
  import { staticClasses } from "./ListItem.styles.js";
@@ -24,7 +24,7 @@ const applyClassNameToElement = (element, className) => {
24
24
  }
25
25
  return null;
26
26
  };
27
- const HvListItem = (props) => {
27
+ const HvListItem = forwardRef((props, ref) => {
28
28
  const {
29
29
  id,
30
30
  classes: classesProp,
@@ -78,6 +78,7 @@ const HvListItem = (props) => {
78
78
  "li",
79
79
  {
80
80
  id,
81
+ ref,
81
82
  role,
82
83
  value,
83
84
  className: cx(classes.root, {
@@ -107,7 +108,7 @@ const HvListItem = (props) => {
107
108
  }, configuration: {
108
109
  tabIndex
109
110
  }, children: listItem }) : listItem;
110
- };
111
+ });
111
112
  export {
112
113
  HvListItem,
113
114
  staticClasses as listItemClasses