@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.
- package/dist/cjs/components/BaseInput/BaseInput.styles.cjs +14 -16
- package/dist/cjs/components/BaseInput/BaseInput.styles.cjs.map +1 -1
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.cjs +14 -19
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.cjs.map +1 -1
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs +7 -38
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs.map +1 -1
- package/dist/cjs/components/Drawer/Drawer.cjs +26 -8
- package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/cjs/components/Dropdown/List/List.cjs +5 -1
- package/dist/cjs/components/Dropdown/List/List.cjs.map +1 -1
- package/dist/cjs/components/ListContainer/ListItem/ListItem.cjs +3 -2
- package/dist/cjs/components/ListContainer/ListItem/ListItem.cjs.map +1 -1
- package/dist/cjs/components/TreeView/TreeItem/DefaultContent.cjs +54 -0
- package/dist/cjs/components/TreeView/TreeItem/DefaultContent.cjs.map +1 -0
- package/dist/cjs/components/TreeView/TreeItem/TreeItem.cjs +124 -0
- package/dist/cjs/components/TreeView/TreeItem/TreeItem.cjs.map +1 -0
- package/dist/cjs/components/TreeView/TreeItem/TreeItem.styles.cjs +74 -0
- package/dist/cjs/components/TreeView/TreeItem/TreeItem.styles.cjs.map +1 -0
- package/dist/cjs/components/TreeView/TreeItem/useHvTreeItem.cjs +62 -0
- package/dist/cjs/components/TreeView/TreeItem/useHvTreeItem.cjs.map +1 -0
- package/dist/cjs/components/TreeView/TreeView.cjs +72 -0
- package/dist/cjs/components/TreeView/TreeView.cjs.map +1 -0
- package/dist/cjs/components/TreeView/TreeView.styles.cjs +18 -0
- package/dist/cjs/components/TreeView/TreeView.styles.cjs.map +1 -0
- package/dist/cjs/components/TreeView/internals.cjs +30 -0
- package/dist/cjs/components/TreeView/internals.cjs.map +1 -0
- package/dist/cjs/index.cjs +10 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/components/BaseInput/BaseInput.styles.js +14 -16
- package/dist/esm/components/BaseInput/BaseInput.styles.js.map +1 -1
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.js +15 -20
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.js.map +1 -1
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js +7 -38
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js.map +1 -1
- package/dist/esm/components/Drawer/Drawer.js +28 -10
- package/dist/esm/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/components/Dropdown/List/List.js +6 -2
- package/dist/esm/components/Dropdown/List/List.js.map +1 -1
- package/dist/esm/components/ListContainer/ListItem/ListItem.js +4 -3
- package/dist/esm/components/ListContainer/ListItem/ListItem.js.map +1 -1
- package/dist/esm/components/TreeView/TreeItem/DefaultContent.js +54 -0
- package/dist/esm/components/TreeView/TreeItem/DefaultContent.js.map +1 -0
- package/dist/esm/components/TreeView/TreeItem/TreeItem.js +125 -0
- package/dist/esm/components/TreeView/TreeItem/TreeItem.js.map +1 -0
- package/dist/esm/components/TreeView/TreeItem/TreeItem.styles.js +74 -0
- package/dist/esm/components/TreeView/TreeItem/TreeItem.styles.js.map +1 -0
- package/dist/esm/components/TreeView/TreeItem/useHvTreeItem.js +62 -0
- package/dist/esm/components/TreeView/TreeItem/useHvTreeItem.js.map +1 -0
- package/dist/esm/components/TreeView/TreeView.js +73 -0
- package/dist/esm/components/TreeView/TreeView.js.map +1 -0
- package/dist/esm/components/TreeView/TreeView.styles.js +18 -0
- package/dist/esm/components/TreeView/TreeView.styles.js.map +1 -0
- package/dist/esm/components/TreeView/internals.js +15 -0
- package/dist/esm/components/TreeView/internals.js.map +1 -0
- package/dist/esm/index.js +12 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +126 -9
- package/package.json +6 -5
|
@@ -19,6 +19,10 @@ const {
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
disabled: {
|
|
22
|
+
"& $inputRoot": {
|
|
23
|
+
backgroundColor: uikitStyles.theme.colors.atmo2,
|
|
24
|
+
borderColor: uikitStyles.theme.colors.secondary_60
|
|
25
|
+
},
|
|
22
26
|
"& $inputBorderContainer": {
|
|
23
27
|
backgroundColor: uikitStyles.theme.colors.atmo4
|
|
24
28
|
},
|
|
@@ -83,19 +87,19 @@ const {
|
|
|
83
87
|
"& $inputRootMultiline": {
|
|
84
88
|
"& $input": {
|
|
85
89
|
border: `1px solid ${uikitStyles.theme.colors.secondary_60}`,
|
|
86
|
-
backgroundColor:
|
|
90
|
+
backgroundColor: uikitStyles.theme.colors.atmo2
|
|
87
91
|
}
|
|
88
92
|
},
|
|
89
93
|
"&:hover $inputRootMultiline": {
|
|
90
94
|
"& $input": {
|
|
91
95
|
border: `1px solid ${uikitStyles.theme.colors.secondary_60}`,
|
|
92
|
-
backgroundColor:
|
|
96
|
+
backgroundColor: uikitStyles.theme.colors.atmo2
|
|
93
97
|
}
|
|
94
98
|
},
|
|
95
99
|
"&:focus-within $inputRootMultiline": {
|
|
96
100
|
"& $input": {
|
|
97
101
|
border: `1px solid ${uikitStyles.theme.colors.secondary_60}`,
|
|
98
|
-
backgroundColor:
|
|
102
|
+
backgroundColor: uikitStyles.theme.colors.atmo2
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
105
|
},
|
|
@@ -112,14 +116,14 @@ const {
|
|
|
112
116
|
},
|
|
113
117
|
inputRootReadOnly: {
|
|
114
118
|
borderColor: uikitStyles.theme.colors.secondary_60,
|
|
115
|
-
backgroundColor:
|
|
119
|
+
backgroundColor: uikitStyles.theme.colors.atmo2
|
|
116
120
|
},
|
|
117
121
|
inputRoot: {
|
|
118
122
|
margin: 0,
|
|
119
123
|
width: "100%",
|
|
120
124
|
borderRadius: uikitStyles.theme.radii.base,
|
|
121
125
|
height: "32px",
|
|
122
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
126
|
+
border: `1px solid ${uikitStyles.theme.colors.secondary}`,
|
|
123
127
|
boxSizing: "border-box",
|
|
124
128
|
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
125
129
|
fontFamily: uikitStyles.theme.fontFamily.body,
|
|
@@ -137,23 +141,17 @@ const {
|
|
|
137
141
|
}
|
|
138
142
|
},
|
|
139
143
|
inputRootFocused: {
|
|
140
|
-
|
|
144
|
+
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
141
145
|
...focusUtils.outlineStyles,
|
|
142
146
|
"&:hover": {
|
|
143
|
-
|
|
147
|
+
backgroundColor: uikitStyles.theme.colors.atmo1
|
|
144
148
|
},
|
|
145
|
-
"
|
|
146
|
-
backgroundColor:
|
|
149
|
+
"&$inputRootReadOnly": {
|
|
150
|
+
backgroundColor: uikitStyles.theme.colors.atmo2
|
|
147
151
|
}
|
|
148
152
|
},
|
|
149
153
|
inputRootDisabled: {
|
|
150
|
-
background: uikitStyles.theme.colors.atmo2,
|
|
151
|
-
borderColor: uikitStyles.theme.colors.secondary_60,
|
|
152
154
|
cursor: "not-allowed",
|
|
153
|
-
"&:hover": {
|
|
154
|
-
background: uikitStyles.theme.colors.atmo2,
|
|
155
|
-
cursor: "not-allowed"
|
|
156
|
-
},
|
|
157
155
|
"&&::before": {
|
|
158
156
|
borderBottomStyle: "none"
|
|
159
157
|
}
|
|
@@ -165,7 +163,7 @@ const {
|
|
|
165
163
|
border: "none",
|
|
166
164
|
height: "auto",
|
|
167
165
|
"& $input": {
|
|
168
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
166
|
+
border: `1px solid ${uikitStyles.theme.colors.secondary}`,
|
|
169
167
|
borderRadius: uikitStyles.theme.radii.base,
|
|
170
168
|
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
171
169
|
height: "auto",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.styles.cjs","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,QAAAA,cAAc,eAAe;AAAA,EACxEC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,OAAO;AAAA,IACPC,UAAU;AAAA,IAEV,iCAAiC;AAAA,MAC/BC,iB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,MACR0B,WAAW;AAAA,MACXF,SAAS;AAAA,MACTC,UAAU;AAAA,MACVE,YAAY;AAAA,MACZC,aAAa;AAAA,MAEb,WAAW;AAAA,QACTlC,QAAS,aAAYT,YAAMC,MAAAA,OAAOC,OAAQ;AAAA,MAC5C;AAAA,IACF;AAAA,EACF;AAAA,EACA0C,OAAO;AAAA,IACL7B,QAAQ;AAAA,IACR2B,YAAY1C,YAAAA,MAAM6C,MAAMC;AAAAA,IACxBH,aAAa3C,YAAAA,MAAM6C,MAAMC;AAAAA,IACzBP,SAAS;AAAA,IACTC,UAAU;AAAA,IACVO,cAAc;AAAA,IACdC,SAAS;AAAA,IACTnD,OAAO;AAAA,IACPoD,UAAU;AAAA,IACV,GAAIjD,YAAAA,MAAMkD,WAAWpB;AAAAA,IAErB,kBAAkB;AAAA,MAChBqB,SAAS;AAAA,MACT9C,OAAOL,YAAAA,MAAMC,OAAOyB;AAAAA,IACtB;AAAA,IAEA,gBAAgB;AAAA,MACd9B,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACAwD,eAAe,CAAC;AAAA,EAChBC,eAAe;AAAA,IACbhD,OAAOL,YAAAA,MAAMC,OAAOyB;AAAAA,EACtB;AAAA,EACA4B,gBAAgB;AAAA,IAAEC,QAAQ;AAAA,IAAQ1D,OAAO;AAAA,EAAO;AAClD,CAAC;;;"}
|
|
1
|
+
{"version":3,"file":"BaseInput.styles.cjs","sources":["../../../../src/components/BaseInput/BaseInput.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,QAAAA,cAAc,eAAe;AAAA,EACxEC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,OAAO;AAAA,IACPC,UAAU;AAAA,IAEV,iCAAiC;AAAA,MAC/BC,iBAAiBC,YAAAA,MAAMC,OAAOC;AAAAA,IAChC;AAAA,IAEA,wCAAwC;AAAA,MACtCH,iBAAiBC,YAAAA,MAAMC,OAAOC;AAAAA,IAChC;AAAA,EACF;AAAA,EACAC,UAAU;AAAA,IACR,gBAAgB;AAAA,MACdJ,iBAAiBC,YAAAA,MAAMC,OAAOG;AAAAA,MAC9BC,aAAaL,YAAAA,MAAMC,OAAOK;AAAAA,IAC5B;AAAA,IAEA,2BAA2B;AAAA,MACzBP,iBAAiBC,YAAAA,MAAMC,OAAOM;AAAAA,IAChC;AAAA,IAEA,iCAAiC;AAAA,MAC/BR,iBAA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MC;AAAAA,IACzBP,SAAS;AAAA,IACTC,UAAU;AAAA,IACVO,cAAc;AAAA,IACdC,SAAS;AAAA,IACTlD,OAAO;AAAA,IACPmD,UAAU;AAAA,IACV,GAAIhD,YAAAA,MAAMiD,WAAWnB;AAAAA,IAErB,kBAAkB;AAAA,MAChBoB,SAAS;AAAA,MACT1C,OAAOR,YAAAA,MAAMC,OAAOkD;AAAAA,IACtB;AAAA,IAEA,gBAAgB;AAAA,MACdvD,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACAwD,eAAe,CAAC;AAAA,EAChBC,eAAe;AAAA,IACb7C,OAAOR,YAAAA,MAAMC,OAAOkD;AAAAA,EACtB;AAAA,EACAG,gBAAgB;AAAA,IAAEC,QAAQ;AAAA,IAAQ1D,OAAO;AAAA,EAAO;AAClD,CAAC;;;"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
6
5
|
const dayjs = require("dayjs");
|
|
7
6
|
const localeData = require("dayjs/plugin/localeData");
|
|
8
7
|
const localizedFormat = require("dayjs/plugin/localizedFormat");
|
|
@@ -16,6 +15,7 @@ const useDefaultProps = require("../../../hooks/useDefaultProps.cjs");
|
|
|
16
15
|
const FormElementContext = require("../../Forms/FormElement/context/FormElementContext.cjs");
|
|
17
16
|
const FormElementDescriptorsContext = require("../../Forms/FormElement/context/FormElementDescriptorsContext.cjs");
|
|
18
17
|
const Typography = require("../../Typography/Typography.cjs");
|
|
18
|
+
const Input = require("../../Input/Input.cjs");
|
|
19
19
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
20
20
|
const dayjs__default = /* @__PURE__ */ _interopDefault(dayjs);
|
|
21
21
|
const localeData__default = /* @__PURE__ */ _interopDefault(localeData);
|
|
@@ -34,8 +34,7 @@ const HvCalendarHeader = (props) => {
|
|
|
34
34
|
showEndDate,
|
|
35
35
|
showDayOfWeek = false,
|
|
36
36
|
onFocus,
|
|
37
|
-
invalidDateLabel = "Invalid Date"
|
|
38
|
-
...others
|
|
37
|
+
invalidDateLabel = "Invalid Date"
|
|
39
38
|
} = useDefaultProps.useDefaultProps("HvCalendarHeader", props);
|
|
40
39
|
const {
|
|
41
40
|
classes,
|
|
@@ -115,23 +114,19 @@ const HvCalendarHeader = (props) => {
|
|
|
115
114
|
setEditedValue(formattedDate);
|
|
116
115
|
onFocus?.(event, formattedDate);
|
|
117
116
|
};
|
|
118
|
-
const onChangeHandler = (event) => {
|
|
119
|
-
setEditedValue(
|
|
117
|
+
const onChangeHandler = (event, val) => {
|
|
118
|
+
setEditedValue(val);
|
|
120
119
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}, children: !isValidValue && inputValue !== "" && /* @__PURE__ */ jsxRuntime.jsxs(Typography.HvTypography, { component: "span", variant: "body", className: classes?.invalidMessageStyling, children: [
|
|
132
|
-
/* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Info, { color: "brand", iconSize: "S" }),
|
|
133
|
-
invalidDateLabel
|
|
134
|
-
] }) })
|
|
120
|
+
const isInvalid = !isValidValue && inputValue !== "";
|
|
121
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { id: localId, className: cx(classes.root, {
|
|
122
|
+
[classes.invalid]: isInvalid
|
|
123
|
+
}), children: [
|
|
124
|
+
showDayOfWeek && /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { className: classes.headerDayOfWeek, children: weekdayDisplay || " " }),
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(Input.HvInput, { type: "text", id: setId.setId(localId, "header-input"), className: classes.headerDate, classes: {
|
|
126
|
+
input: classes.input,
|
|
127
|
+
inputBorderContainer: classes.inputBorderContainer,
|
|
128
|
+
error: classes.invalidMessageStyling
|
|
129
|
+
}, placeholder: localeFormat, value: inputValue, "aria-labelledby": label?.[0]?.id, onBlur: onBlurHandler, onFocus: onFocusHandler, onChange: onChangeHandler, onKeyDown: keyDownHandler, status: isInvalid ? "invalid" : "valid", statusMessage: invalidDateLabel })
|
|
135
130
|
] });
|
|
136
131
|
};
|
|
137
132
|
HvCalendarHeader.formElementType = "HvCalendarHeader";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarHeader.cjs","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","jsxs","Fragment","root","invalid","HvTypography","headerDayOfWeek","headerDate","input","jsx","inputBorderContainer","height","invalidMessageStyling","Info","formElementType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6BAA,eAAAA,QAAMC,OAAOC,oBAAAA,OAAU;AACvBF,eAAAA,QAAMC,OAAOE,yBAAAA,OAAe;AAC5BH,eAAAA,QAAMC,OAAOG,2BAAAA,OAAiB;AAEjBC,MAAAA,mBAAmBA,CAACC,UAAiC;AAC1D,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,SAAS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E,SAAS8E,uBAEpB,UAAA;AAAA,MAAAH,2BAAA,IAACI,gBAAK,MAAA,EAAA,OAAM,SAAQ,UAAS,KAAG;AAAA,MAC/BzE;AAAAA,IAAAA,EAAAA,CACH,EAEJ,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;AAGAX,iBAAiBqF,kBAAkB;;;"}
|
|
1
|
+
{"version":3,"file":"CalendarHeader.cjs","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","HvTypography","headerDayOfWeek","jsx","HvInput","headerDate","input","inputBorderContainer","error","invalidMessageStyling","formElementType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BAA,eAAAA,QAAMC,OAAOC,oBAAAA,OAAU;AACvBF,eAAAA,QAAMC,OAAOE,yBAAAA,OAAe;AAC5BH,eAAAA,QAAMC,OAAOG,2BAAAA,OAAiB;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;AA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B,OAAAA,UAAU,IAC7B3B,eAAAA,QAAM2B,UAAU,EAAElB,OAAOA,MAAM,EAAEgD,OAAO,GAAG,IAC3CvB;AACNC,mBAAesC,aAAa;AAC5B1D,cAAU8C,OAAOY,aAAa;AAAA,EAAA;AAG1BC,QAAAA,kBAA4CA,CAACb,OAAOc,QAAQ;AAChExC,mBAAewC,GAAG;AAAA,EAAA;AAGdC,QAAAA,YAAY,CAAC/B,gBAAgBH,eAAe;AAKlD,yCACG,OACC,EAAA,IAAIF,SACJ,WAAWtB,GAAGR,QAAQmE,MAAM;AAAA,IAC1B,CAACnE,QAAQoE,OAAO,GAAGF;AAAAA,EACpB,CAAA,GAEA9D,UAAAA;AAAAA,IAAAA,gDACEiE,WAAa,cAAA,EAAA,WAAWrE,QAAQsE,iBAC9B1C,4BAAkB,KACrB;AAAA,IAED2C,2BAAAA,IAAAC,MAAAA,SAAA,EACC,MAAK,QACL,IAAIzC,MAAAA,MAAMD,SAAS,cAAc,GACjC,WAAW9B,QAAQyE,YACnB,SAAS;AAAA,MACPC,OAAO1E,QAAQ0E;AAAAA,MACfC,sBAAsB3E,QAAQ2E;AAAAA,MAC9BC,OAAO5E,QAAQ6E;AAAAA,IACjB,GACA,aAAa5C,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,iBAAiBmF,kBAAkB;;;"}
|
|
@@ -2,55 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
4
4
|
const classes = require("../../../utils/classes.cjs");
|
|
5
|
-
const focusUtils = require("../../../utils/focusUtils.cjs");
|
|
6
5
|
const {
|
|
7
6
|
staticClasses,
|
|
8
7
|
useClasses
|
|
9
8
|
} = classes.createClasses("HvCalendarHeader", {
|
|
10
9
|
root: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"&:hover, &:focus": {
|
|
15
|
-
borderBottom: `1px solid ${uikitStyles.theme.colors.secondary}`
|
|
10
|
+
paddingBottom: uikitStyles.theme.space.md,
|
|
11
|
+
"&$invalid": {
|
|
12
|
+
paddingBottom: 0
|
|
16
13
|
}
|
|
17
14
|
},
|
|
18
15
|
invalid: {},
|
|
19
16
|
headerDayOfWeek: {
|
|
20
|
-
color: uikitStyles.theme.colors.secondary_80
|
|
21
|
-
paddingLeft: uikitStyles.theme.spacing("xs")
|
|
17
|
+
color: uikitStyles.theme.colors.secondary_80
|
|
22
18
|
},
|
|
23
19
|
headerDate: {},
|
|
24
|
-
input: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
padding: `5px ${uikitStyles.theme.spacing("xs")}`,
|
|
28
|
-
fontFamily: uikitStyles.theme.fontFamily.body,
|
|
29
|
-
color: uikitStyles.theme.colors.secondary_80,
|
|
30
|
-
fontSize: uikitStyles.theme.fontSizes.base,
|
|
31
|
-
lineHeight: uikitStyles.theme.lineHeights.base,
|
|
32
|
-
fontWeight: uikitStyles.theme.fontWeights.normal,
|
|
33
|
-
width: "100%",
|
|
34
|
-
"&::placeholder": {
|
|
35
|
-
color: uikitStyles.theme.colors.secondary_60
|
|
36
|
-
},
|
|
37
|
-
"&:focus": {
|
|
38
|
-
outline: "none"
|
|
39
|
-
},
|
|
40
|
-
"&:focus-visible": {
|
|
41
|
-
...focusUtils.outlineStyles
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
inputBorderContainer: {
|
|
45
|
-
backgroundColor: uikitStyles.theme.colors.negative,
|
|
46
|
-
height: 1,
|
|
47
|
-
marginTop: -1
|
|
48
|
-
},
|
|
49
|
-
invalidMessageStyling: {
|
|
50
|
-
display: "flex",
|
|
51
|
-
alignItems: "center",
|
|
52
|
-
color: uikitStyles.theme.colors.negative
|
|
53
|
-
}
|
|
20
|
+
input: {},
|
|
21
|
+
inputBorderContainer: {},
|
|
22
|
+
invalidMessageStyling: {}
|
|
54
23
|
});
|
|
55
24
|
exports.staticClasses = staticClasses;
|
|
56
25
|
exports.useClasses = useClasses;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarHeader.styles.cjs","sources":["../../../../../src/components/Calendar/CalendarHeader/CalendarHeader.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\
|
|
1
|
+
{"version":3,"file":"CalendarHeader.styles.cjs","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,QAAAA,cAAc,oBAAoB;AAAA,EAC7EC,MAAM;AAAA,IACJC,eAAeC,YAAAA,MAAMC,MAAMC;AAAAA,IAE3B,aAAa;AAAA,MACXH,eAAe;AAAA,IACjB;AAAA,EACF;AAAA,EACAI,SAAS,CAAC;AAAA,EACVC,iBAAiB;AAAA,IACfC,OAAOL,YAAAA,MAAMM,OAAOC;AAAAA,EACtB;AAAA,EACAC,YAAY,CAAC;AAAA,EACbC,OAAO,CAAC;AAAA,EACRC,sBAAsB,CAAC;AAAA,EACvBC,uBAAuB,CAAC;AAC1B,CAAC;;;"}
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
4
|
const material = require("@mui/material");
|
|
5
5
|
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
6
|
+
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
6
7
|
const useDefaultProps = require("../../hooks/useDefaultProps.cjs");
|
|
7
8
|
const withTooltip = require("../../hocs/withTooltip.cjs");
|
|
8
9
|
const setId = require("../../utils/setId.cjs");
|
|
10
|
+
const useTheme = require("../../hooks/useTheme.cjs");
|
|
11
|
+
const hexToRgbA = require("../../utils/hexToRgbA.cjs");
|
|
9
12
|
const Drawer_styles = require("./Drawer.styles.cjs");
|
|
10
13
|
const Button = require("../Button/Button.cjs");
|
|
11
14
|
const HvDrawer = (props) => {
|
|
@@ -18,21 +21,36 @@ const HvDrawer = (props) => {
|
|
|
18
21
|
onClose,
|
|
19
22
|
anchor = "right",
|
|
20
23
|
buttonTitle = "Close",
|
|
24
|
+
showBackdrop = true,
|
|
25
|
+
disableBackdropClick = false,
|
|
21
26
|
...others
|
|
22
27
|
} = useDefaultProps.useDefaultProps("HvDrawer", props);
|
|
23
28
|
const {
|
|
24
29
|
classes,
|
|
25
|
-
cx
|
|
30
|
+
cx,
|
|
31
|
+
css
|
|
26
32
|
} = Drawer_styles.useClasses(classesProp);
|
|
33
|
+
const {
|
|
34
|
+
colors
|
|
35
|
+
} = useTheme.useTheme();
|
|
27
36
|
const closeButtonDisplay = () => /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Close, { role: "none" });
|
|
28
37
|
const CloseButtonTooltipWrapper = buttonTitle ? withTooltip.withTooltip(closeButtonDisplay, buttonTitle, "top") : closeButtonDisplay;
|
|
29
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
30
|
-
classes: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
39
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Drawer, { className: cx(classes.root, className), id, anchor, open, PaperProps: {
|
|
40
|
+
classes: {
|
|
41
|
+
root: classes.paper
|
|
42
|
+
}
|
|
43
|
+
}, onClose, ...others, children: [
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { id: setId.setId(id, "close"), className: classes.closeButton, variant: "secondaryGhost", onClick: onClose, "aria-label": buttonTitle, children: /* @__PURE__ */ jsxRuntime.jsx(CloseButtonTooltipWrapper, {}) }),
|
|
45
|
+
children
|
|
46
|
+
] }),
|
|
47
|
+
showBackdrop && /* @__PURE__ */ jsxRuntime.jsx(material.Backdrop, { open: !!open, onClick: (event) => {
|
|
48
|
+
if (disableBackdropClick)
|
|
49
|
+
return;
|
|
50
|
+
onClose?.(event, "backdropClick");
|
|
51
|
+
}, className: cx(css({
|
|
52
|
+
background: hexToRgbA.hexToRgbA(colors?.atmo4 || uikitStyles.theme.colors.atmo4)
|
|
53
|
+
}), classes.background) })
|
|
36
54
|
] });
|
|
37
55
|
};
|
|
38
56
|
exports.drawerClasses = Drawer_styles.staticClasses;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.cjs","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
|
|
1
|
+
{"version":3,"file":"Drawer.cjs","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","jsx","Close","CloseButtonTooltipWrapper","withTooltip","jsxs","Fragment","MuiDrawer","root","paper","HvButton","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,gB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
}));
|
|
24
24
|
const valuesExist = (values) => values != null && values?.length > 0;
|
|
25
|
+
const getSelectedIds = (list) => utils.getSelected(list).map((item) => item.id || item.label);
|
|
25
26
|
const HvDropdownList = (props) => {
|
|
26
27
|
const {
|
|
27
28
|
id,
|
|
@@ -53,6 +54,9 @@ const HvDropdownList = (props) => {
|
|
|
53
54
|
width,
|
|
54
55
|
height
|
|
55
56
|
} = React.useContext(BaseDropdownContext.default);
|
|
57
|
+
const hasChanges = React.useMemo(() => {
|
|
58
|
+
return String(getSelectedIds(values)) !== String(getSelectedIds(list));
|
|
59
|
+
}, [list, values]);
|
|
56
60
|
const newLabels = {
|
|
57
61
|
selectAll: labels?.selectAll,
|
|
58
62
|
selectionConjunction: labels?.multiSelectionConjunction
|
|
@@ -140,7 +144,7 @@ const HvDropdownList = (props) => {
|
|
|
140
144
|
const applyLabel = labels?.applyLabel;
|
|
141
145
|
const cancelLabel = labels?.cancelLabel;
|
|
142
146
|
return /* @__PURE__ */ jsxRuntime.jsxs(ActionBar.HvActionBar, { id: setId.setId(id, "actions"), children: [
|
|
143
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { id: setId.setId(id, "actions-apply"), onClick: () => onChange(cleanHidden(list), true, true, true), variant: "primaryGhost", children: applyLabel }),
|
|
147
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { id: setId.setId(id, "actions-apply"), disabled: !hasChanges, onClick: () => onChange(cleanHidden(list), true, true, true), variant: "primaryGhost", children: applyLabel }),
|
|
144
148
|
/* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { id: setId.setId(id, "actions-cancel"), onClick: onCancel, variant: "primaryGhost", children: cancelLabel })
|
|
145
149
|
] });
|
|
146
150
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.cjs","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","jsx","searchContainer","HvInput","setId","searchPlaceholder","event","handleSelectAll","selected","renderSelectAll","defaultLabel","HvTypography","jsxs","Fragment","selectAllContainer","HvCheckBox","container","selection","onSelection","renderActions","applyLabel","cancelLabel","HvActionBar","HvButton","showList","rootList","listBorderDown","listContainer","HvList","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;AAExBC,MAAAA,iBAAiBA,CAACC,UAA+B;AACtD,QAAA;AAAA,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QAAAA,CACT,GACHE,eACEI,IAAI;AAAA,UACFuE,UAAU;AAAA,UACV5E,WAAW;AAAA,UACXiF,UAAU;AAAA,UACVC,SAAS;AAAA,QAAA,CACV,CACL;AAAA,MACF,GACA,QAAQxE,MACR,aACA,aAAapB,aACb,eAAe,OACf,UAAUyE,aACV,QAAQ5C,WACR,aACA,YAAU,MACV,WAAS,MACT,uBACA,QAAQpB,gBACR,aACIG,GAAAA,QAEP;AAAA,IAAA,GACH;AAAA,IACCmE,YAAY/E,cAAc0E,cAAAA,IAAkB;AAAA,EAC/C,EAAA,CAAA;AAEJ;;;"}
|
|
1
|
+
{"version":3,"file":"List.cjs","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","jsx","searchContainer","HvInput","setId","searchPlaceholder","event","handleSelectAll","selected","renderSelectAll","defaultLabel","HvTypography","jsxs","Fragment","selectAllContainer","HvCheckBox","container","selection","onSelection","renderActions","applyLabel","cancelLabel","HvActionBar","HvButton","showList","rootList","listBorderDown","listContainer","HvList","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,MAAYD,YAAAA,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,gBAAA,kBAAkBhB,KAAK;AACrC,QAAA;AAAA,IAAEC;AAAAA,IAASgB;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,YAAAA,WAAWjB,WAA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ACV,QAAQzC,WACR,aACA,YAAU,MACV,WAAS,MACT,uBACA,QAAQtB,gBACR,aACIG,GAAAA,QAEP;AAAA,IAAA,GACH;AAAA,IACCkE,YAAY9E,cAAcyE,cAAAA,IAAkB;AAAA,EAC/C,EAAA,CAAA;AAEJ;;;"}
|
|
@@ -27,7 +27,7 @@ const applyClassNameToElement = (element, className) => {
|
|
|
27
27
|
}
|
|
28
28
|
return null;
|
|
29
29
|
};
|
|
30
|
-
const HvListItem = (props) => {
|
|
30
|
+
const HvListItem = React.forwardRef((props, ref) => {
|
|
31
31
|
const {
|
|
32
32
|
id,
|
|
33
33
|
classes: classesProp,
|
|
@@ -81,6 +81,7 @@ const HvListItem = (props) => {
|
|
|
81
81
|
"li",
|
|
82
82
|
{
|
|
83
83
|
id,
|
|
84
|
+
ref,
|
|
84
85
|
role,
|
|
85
86
|
value,
|
|
86
87
|
className: cx(classes.root, {
|
|
@@ -110,7 +111,7 @@ const HvListItem = (props) => {
|
|
|
110
111
|
}, configuration: {
|
|
111
112
|
tabIndex
|
|
112
113
|
}, children: listItem }) : listItem;
|
|
113
|
-
};
|
|
114
|
+
});
|
|
114
115
|
exports.listItemClasses = ListItem_styles.staticClasses;
|
|
115
116
|
exports.HvListItem = HvListItem;
|
|
116
117
|
//# sourceMappingURL=ListItem.cjs.map
|