@dxc-technology/halstack-react 4.0.0 → 6.0.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/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +7 -6
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +35 -162
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +68 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +68 -85
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/alert/Alert.js +43 -153
- package/alert/Alert.stories.tsx +170 -0
- package/alert/Alert.test.js +92 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +15 -17
- package/badge/types.d.ts +5 -0
- package/badge/types.js +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +51 -0
- package/bleed/Bleed.stories.tsx +341 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.d.ts +4 -0
- package/box/Box.js +36 -76
- package/box/Box.stories.tsx +132 -0
- package/box/Box.test.js +18 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/button/Button.js +33 -97
- package/button/Button.stories.tsx +274 -0
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +53 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +44 -137
- package/card/Card.stories.tsx +201 -0
- package/card/Card.test.js +50 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +67 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/checkbox/Checkbox.js +52 -94
- package/checkbox/Checkbox.stories.tsx +188 -0
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +64 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +26 -130
- package/chip/Chip.stories.tsx +119 -0
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/RequiredComponent.js +3 -11
- package/common/variables.js +301 -373
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +80 -108
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +107 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +25 -105
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/Dialog.test.js +40 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +54 -207
- package/dropdown/Dropdown.stories.tsx +249 -0
- package/dropdown/Dropdown.test.js +189 -0
- package/dropdown/types.d.ts +80 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +200 -251
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +44 -145
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +21 -0
- package/flex/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +50 -286
- package/footer/Footer.stories.tsx +130 -0
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +16 -16
- package/footer/types.d.ts +65 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +82 -249
- package/header/Header.stories.tsx +172 -0
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +7 -32
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +25 -96
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +186 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +51 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +37 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +20 -0
- package/layout/ApplicationLayout.js +76 -232
- package/layout/ApplicationLayout.stories.tsx +161 -0
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +19 -8
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +42 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +4 -0
- package/link/Link.js +64 -165
- package/link/Link.stories.tsx +186 -0
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +54 -0
- package/link/types.js +5 -0
- package/main.d.ts +44 -40
- package/main.js +114 -104
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +21 -81
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +124 -0
- package/number-input/types.js +5 -0
- package/package.json +23 -16
- package/paginator/Icons.js +9 -9
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +32 -166
- package/paginator/Paginator.stories.tsx +63 -0
- package/paginator/Paginator.test.js +308 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +40 -77
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +110 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +23 -95
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/ProgressBar.test.js +65 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +118 -0
- package/quick-nav/QuickNav.stories.tsx +264 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +141 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +283 -0
- package/radio-group/RadioGroup.stories.tsx +100 -0
- package/radio-group/RadioGroup.test.js +695 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +43 -147
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/ResultsetTable.test.js +348 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +175 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +231 -709
- package/select/Select.stories.tsx +626 -0
- package/select/Select.test.js +2162 -0
- package/select/types.d.ts +212 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +182 -105
- package/sidenav/Sidenav.stories.tsx +180 -0
- package/sidenav/Sidenav.test.js +44 -0
- package/sidenav/types.d.ts +73 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +76 -162
- package/slider/Slider.stories.tsx +177 -0
- package/slider/Slider.test.js +150 -0
- package/slider/types.d.ts +82 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +46 -177
- package/spinner/Spinner.stories.jsx +103 -0
- package/spinner/Spinner.test.js +64 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/switch/Switch.js +55 -82
- package/switch/Switch.stories.tsx +160 -0
- package/switch/Switch.test.js +98 -0
- package/switch/types.d.ts +62 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +12 -26
- package/table/Table.stories.jsx +277 -0
- package/table/Table.test.js +26 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +43 -175
- package/tabs/Tabs.stories.tsx +112 -0
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +82 -0
- package/tabs/types.js +5 -0
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +44 -143
- package/tag/Tag.stories.tsx +142 -0
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +69 -0
- package/tag/types.js +5 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +169 -391
- package/text-input/TextInput.stories.tsx +474 -0
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +178 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +50 -142
- package/textarea/Textarea.stories.jsx +157 -0
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +137 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +36 -148
- package/toggle-group/ToggleGroup.stories.tsx +173 -0
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +105 -0
- package/toggle-group/types.js +5 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +2 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +132 -252
- package/wizard/Wizard.stories.tsx +233 -0
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +65 -0
- package/wizard/types.js +5 -0
- package/ThemeContext.js +0 -250
- package/V3Select/V3Select.js +0 -549
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -264
- package/V3Textarea/index.d.ts +0 -27
- package/accordion/index.d.ts +0 -28
- package/accordion-group/index.d.ts +0 -16
- package/alert/index.d.ts +0 -51
- package/box/index.d.ts +0 -25
- package/button/Button.stories.js +0 -27
- package/button/index.d.ts +0 -24
- package/card/index.d.ts +0 -22
- package/checkbox/index.d.ts +0 -24
- package/chip/index.d.ts +0 -22
- package/date/Date.js +0 -379
- package/date/index.d.ts +0 -27
- package/date-input/index.d.ts +0 -95
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/file-input/index.d.ts +0 -81
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/heading/index.d.ts +0 -17
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -705
- package/input-text/index.d.ts +0 -36
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/paginator/index.d.ts +0 -20
- package/password-input/index.d.ts +0 -94
- package/progress-bar/index.d.ts +0 -18
- package/radio/Radio.js +0 -209
- package/radio/index.d.ts +0 -23
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/switch/index.d.ts +0 -24
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -220
- package/toggle/index.d.ts +0 -21
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -205
- package/upload/buttons-upload/ButtonsUpload.js +0 -135
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -189
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -123
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -148
- package/upload/transactions/Transactions.js +0 -138
- package/wizard/Icons.js +0 -65
- package/wizard/index.d.ts +0 -18
package/select/Icons.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var selectIcons = {
|
|
13
|
+
error: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
|
+
role: "img",
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
height: "24px",
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
width: "24px",
|
|
19
|
+
fill: "currentColor"
|
|
20
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
21
|
+
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
|
|
22
|
+
})),
|
|
23
|
+
arrowUp: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
24
|
+
role: "img",
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26
|
+
height: "24px",
|
|
27
|
+
viewBox: "0 0 24 24",
|
|
28
|
+
width: "24px",
|
|
29
|
+
fill: "currentColor"
|
|
30
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
31
|
+
d: "M0 0h24v24H0V0z",
|
|
32
|
+
fill: "none"
|
|
33
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
34
|
+
d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6 1.41 1.41z"
|
|
35
|
+
})),
|
|
36
|
+
arrowDown: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
37
|
+
role: "img",
|
|
38
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
+
height: "24px",
|
|
40
|
+
viewBox: "0 0 24 24",
|
|
41
|
+
width: "24px",
|
|
42
|
+
fill: "currentColor"
|
|
43
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
+
d: "M0 0h24v24H0V0z",
|
|
45
|
+
fill: "none"
|
|
46
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
47
|
+
d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
|
|
48
|
+
})),
|
|
49
|
+
clear: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
50
|
+
role: "img",
|
|
51
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
52
|
+
width: "24",
|
|
53
|
+
height: "24",
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
fill: "currentColor"
|
|
56
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
57
|
+
d: "M0 0h24v24H0V0z",
|
|
58
|
+
fill: "none"
|
|
59
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
60
|
+
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
61
|
+
})),
|
|
62
|
+
selected: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
63
|
+
role: "img",
|
|
64
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
65
|
+
height: "24px",
|
|
66
|
+
viewBox: "0 0 24 24",
|
|
67
|
+
width: "24px",
|
|
68
|
+
fill: "currentColor"
|
|
69
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
70
|
+
d: "M0 0h24v24H0z",
|
|
71
|
+
fill: "none"
|
|
72
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
73
|
+
d: "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
|
|
74
|
+
})),
|
|
75
|
+
searchOff: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
76
|
+
role: "img",
|
|
77
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78
|
+
height: "24px",
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
width: "24px",
|
|
81
|
+
fill: "currentColor"
|
|
82
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
83
|
+
fill: "none",
|
|
84
|
+
height: "24",
|
|
85
|
+
width: "24"
|
|
86
|
+
})), /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
87
|
+
d: "M15.5,14h-0.79l-0.28-0.27C15.41,12.59,16,11.11,16,9.5C16,5.91,13.09,3,9.5,3C6.08,3,3.28,5.64,3.03,9h2.02 C5.3,6.75,7.18,5,9.5,5C11.99,5,14,7.01,14,9.5S11.99,14,9.5,14c-0.17,0-0.33-0.03-0.5-0.05v2.02C9.17,15.99,9.33,16,9.5,16 c1.61,0,3.09-0.59,4.23-1.57L14,14.71v0.79l5,4.99L20.49,19L15.5,14z"
|
|
88
|
+
}), /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
89
|
+
points: "6.47,10.82 4,13.29 1.53,10.82 0.82,11.53 3.29,14 0.82,16.47 1.53,17.18 4,14.71 6.47,17.18 7.18,16.47 4.71,14 7.18,11.53"
|
|
90
|
+
}))))
|
|
91
|
+
};
|
|
92
|
+
var _default = selectIcons;
|
|
93
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ListboxProps } from "./types";
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ id, currentValue, options, visualFocusIndex, lastOptionIndex, multiple, optional, optionalItem, searchable, handleOptionOnClick, styles, }: ListboxProps) => JSX.Element>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
|
+
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
19
|
+
|
|
20
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
21
|
+
|
|
22
|
+
var _Option = _interopRequireDefault(require("./Option"));
|
|
23
|
+
|
|
24
|
+
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
25
|
+
|
|
26
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
var groupsHaveOptions = function groupsHaveOptions(options) {
|
|
33
|
+
return options !== null && options !== void 0 && options[0].options ? options.some(function (groupOption) {
|
|
34
|
+
var _groupOption$options;
|
|
35
|
+
|
|
36
|
+
return ((_groupOption$options = groupOption.options) === null || _groupOption$options === void 0 ? void 0 : _groupOption$options.length) > 0;
|
|
37
|
+
}) : true;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var Listbox = function Listbox(_ref) {
|
|
41
|
+
var id = _ref.id,
|
|
42
|
+
currentValue = _ref.currentValue,
|
|
43
|
+
options = _ref.options,
|
|
44
|
+
visualFocusIndex = _ref.visualFocusIndex,
|
|
45
|
+
lastOptionIndex = _ref.lastOptionIndex,
|
|
46
|
+
multiple = _ref.multiple,
|
|
47
|
+
optional = _ref.optional,
|
|
48
|
+
optionalItem = _ref.optionalItem,
|
|
49
|
+
searchable = _ref.searchable,
|
|
50
|
+
handleOptionOnClick = _ref.handleOptionOnClick,
|
|
51
|
+
styles = _ref.styles;
|
|
52
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
53
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
54
|
+
var listboxRef = (0, _react.useRef)(null);
|
|
55
|
+
var globalIndex = optional && !multiple ? 0 : -1; // index for options, starting from 0 to options.length -1
|
|
56
|
+
|
|
57
|
+
var mapOptionFunc = function mapOptionFunc(option, mapIndex) {
|
|
58
|
+
if (option.options) {
|
|
59
|
+
var groupId = "group-".concat(mapIndex);
|
|
60
|
+
return option.options.length > 0 && /*#__PURE__*/_react["default"].createElement("li", {
|
|
61
|
+
key: "group-".concat(mapIndex)
|
|
62
|
+
}, /*#__PURE__*/_react["default"].createElement(GroupList, {
|
|
63
|
+
role: "group",
|
|
64
|
+
"aria-labelledby": groupId
|
|
65
|
+
}, /*#__PURE__*/_react["default"].createElement(GroupLabel, {
|
|
66
|
+
role: "presentation",
|
|
67
|
+
id: groupId
|
|
68
|
+
}, option.label), option.options.map(function (singleOption) {
|
|
69
|
+
globalIndex++;
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
71
|
+
key: "option-".concat(singleOption.value),
|
|
72
|
+
id: "option-".concat(globalIndex),
|
|
73
|
+
option: singleOption,
|
|
74
|
+
onClick: handleOptionOnClick,
|
|
75
|
+
multiple: multiple,
|
|
76
|
+
visualFocused: visualFocusIndex === globalIndex,
|
|
77
|
+
isGroupedOption: true,
|
|
78
|
+
isLastOption: lastOptionIndex === globalIndex,
|
|
79
|
+
isSelected: multiple ? currentValue.includes(singleOption.value) : currentValue === singleOption.value
|
|
80
|
+
});
|
|
81
|
+
})));
|
|
82
|
+
} else {
|
|
83
|
+
globalIndex++;
|
|
84
|
+
return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
85
|
+
key: "option-".concat(option.value),
|
|
86
|
+
id: "option-".concat(globalIndex),
|
|
87
|
+
option: option,
|
|
88
|
+
onClick: handleOptionOnClick,
|
|
89
|
+
multiple: multiple,
|
|
90
|
+
visualFocused: visualFocusIndex === globalIndex,
|
|
91
|
+
isLastOption: lastOptionIndex === globalIndex,
|
|
92
|
+
isSelected: multiple ? currentValue.includes(option.value) : currentValue === option.value
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
(0, _react.useLayoutEffect)(function () {
|
|
98
|
+
if (currentValue && !multiple) {
|
|
99
|
+
var _listEl$scrollTo;
|
|
100
|
+
|
|
101
|
+
var listEl = listboxRef === null || listboxRef === void 0 ? void 0 : listboxRef.current;
|
|
102
|
+
var selectedListOptionEl = listEl === null || listEl === void 0 ? void 0 : listEl.querySelector("[aria-selected='true']");
|
|
103
|
+
listEl === null || listEl === void 0 ? void 0 : (_listEl$scrollTo = listEl.scrollTo) === null || _listEl$scrollTo === void 0 ? void 0 : _listEl$scrollTo.call(listEl, {
|
|
104
|
+
top: (selectedListOptionEl === null || selectedListOptionEl === void 0 ? void 0 : selectedListOptionEl.offsetTop) - (listEl === null || listEl === void 0 ? void 0 : listEl.clientHeight) / 2
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}, [currentValue, multiple]);
|
|
108
|
+
(0, _react.useLayoutEffect)(function () {
|
|
109
|
+
var _listboxRef$current, _visualFocusedOptionE;
|
|
110
|
+
|
|
111
|
+
var visualFocusedOptionEl = listboxRef === null || listboxRef === void 0 ? void 0 : (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
112
|
+
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
113
|
+
block: "nearest",
|
|
114
|
+
inline: "start"
|
|
115
|
+
});
|
|
116
|
+
}, [visualFocusIndex]);
|
|
117
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
118
|
+
theme: colorsTheme.select
|
|
119
|
+
}, /*#__PURE__*/_react["default"].createElement(ListboxContainer, {
|
|
120
|
+
id: id,
|
|
121
|
+
onClick: function onClick(event) {
|
|
122
|
+
event.stopPropagation();
|
|
123
|
+
},
|
|
124
|
+
onMouseDown: function onMouseDown(event) {
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
},
|
|
127
|
+
ref: listboxRef,
|
|
128
|
+
role: "listbox",
|
|
129
|
+
"aria-multiselectable": multiple,
|
|
130
|
+
"aria-orientation": "vertical",
|
|
131
|
+
style: styles
|
|
132
|
+
}, searchable && (options.length === 0 || !groupsHaveOptions(options)) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, _Icons["default"].searchOff), translatedLabels.select.noMatchesErrorMessage) : optional && !multiple && /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
133
|
+
key: "option-".concat(optionalItem.value),
|
|
134
|
+
id: "option-".concat(0),
|
|
135
|
+
option: optionalItem,
|
|
136
|
+
onClick: handleOptionOnClick,
|
|
137
|
+
multiple: multiple,
|
|
138
|
+
visualFocused: visualFocusIndex === 0,
|
|
139
|
+
isGroupedOption: false,
|
|
140
|
+
isLastOption: lastOptionIndex === 0,
|
|
141
|
+
isSelected: multiple ? currentValue.includes(optionalItem.value) : currentValue === optionalItem.value
|
|
142
|
+
}), options.map(mapOptionFunc)));
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 304px;\n overflow-y: auto;\n margin: 0;\n padding: 0.25rem 0;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
146
|
+
return props.theme.listDialogBackgroundColor;
|
|
147
|
+
}, function (props) {
|
|
148
|
+
return props.theme.listDialogBorderColor;
|
|
149
|
+
}, function (props) {
|
|
150
|
+
return props.theme.listOptionFontColor;
|
|
151
|
+
}, function (props) {
|
|
152
|
+
return props.theme.fontFamily;
|
|
153
|
+
}, function (props) {
|
|
154
|
+
return props.theme.listOptionFontSize;
|
|
155
|
+
}, function (props) {
|
|
156
|
+
return props.theme.listOptionFontStyle;
|
|
157
|
+
}, function (props) {
|
|
158
|
+
return props.theme.listOptionFontWeight;
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
var OptionsSystemMessage = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 4px 16px;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.715em;\n"])), function (props) {
|
|
162
|
+
return props.theme.systemMessageFontColor;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
var NoMatchesFoundIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-right: 0.25rem;\n"])));
|
|
166
|
+
|
|
167
|
+
var GroupList = _styledComponents["default"].ul(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0;\n"])));
|
|
168
|
+
|
|
169
|
+
var GroupLabel = _styledComponents["default"].li(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n padding: 4px 16px;\n font-weight: ", ";\n line-height: 1.715em;\n"])), function (props) {
|
|
170
|
+
return props.theme.listGroupLabelFontWeight;
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
var _default = /*#__PURE__*/_react["default"].memo(Listbox);
|
|
174
|
+
|
|
175
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OptionProps } from "../select/types";
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ id, option, onClick, multiple, visualFocused, isGroupedOption, isLastOption, isSelected, }: OptionProps) => JSX.Element>;
|
|
4
|
+
export default _default;
|
package/select/Option.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
|
+
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
19
|
+
|
|
20
|
+
var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox"));
|
|
21
|
+
|
|
22
|
+
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
23
|
+
|
|
24
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
var Option = function Option(_ref) {
|
|
31
|
+
var id = _ref.id,
|
|
32
|
+
option = _ref.option,
|
|
33
|
+
_onClick = _ref.onClick,
|
|
34
|
+
multiple = _ref.multiple,
|
|
35
|
+
visualFocused = _ref.visualFocused,
|
|
36
|
+
_ref$isGroupedOption = _ref.isGroupedOption,
|
|
37
|
+
isGroupedOption = _ref$isGroupedOption === void 0 ? false : _ref$isGroupedOption,
|
|
38
|
+
isLastOption = _ref.isLastOption,
|
|
39
|
+
isSelected = _ref.isSelected;
|
|
40
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
41
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
42
|
+
theme: colorsTheme.select
|
|
43
|
+
}, /*#__PURE__*/_react["default"].createElement(OptionItem, {
|
|
44
|
+
id: id,
|
|
45
|
+
onClick: function onClick() {
|
|
46
|
+
_onClick(option);
|
|
47
|
+
},
|
|
48
|
+
visualFocused: visualFocused,
|
|
49
|
+
selected: isSelected,
|
|
50
|
+
role: "option",
|
|
51
|
+
"aria-selected": isSelected
|
|
52
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledOption, {
|
|
53
|
+
visualFocused: visualFocused,
|
|
54
|
+
selected: isSelected,
|
|
55
|
+
last: isLastOption,
|
|
56
|
+
grouped: isGroupedOption,
|
|
57
|
+
multiple: multiple
|
|
58
|
+
}, multiple && /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
59
|
+
checked: isSelected,
|
|
60
|
+
tabIndex: -1
|
|
61
|
+
}), option.icon && /*#__PURE__*/_react["default"].createElement(OptionIcon, {
|
|
62
|
+
grouped: isGroupedOption,
|
|
63
|
+
multiple: multiple,
|
|
64
|
+
role: !(typeof option.icon === "string") ? "img" : undefined
|
|
65
|
+
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement(OptionIconImg, {
|
|
66
|
+
src: option.icon
|
|
67
|
+
}) : option.icon), /*#__PURE__*/_react["default"].createElement(OptionContent, {
|
|
68
|
+
grouped: isGroupedOption,
|
|
69
|
+
hasIcon: option.icon ? true : false,
|
|
70
|
+
multiple: multiple
|
|
71
|
+
}, /*#__PURE__*/_react["default"].createElement(OptionLabel, null, option.label), !multiple && isSelected && /*#__PURE__*/_react["default"].createElement(OptionSelectedIndicator, null, _Icons["default"].selected)))));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var OptionItem = _styledComponents["default"].li(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0 0.5rem;\n box-shadow: inset 0 0 0 2px transparent;\n ", "\n ", ";\n line-height: 1.715em;\n cursor: pointer;\n\n &:hover {\n ", ";\n }\n &:active {\n ", ";\n }\n"])), function (props) {
|
|
75
|
+
return props.visualFocused && "box-shadow: inset 0 0 0 2px ".concat(props.theme.focusListOptionBorderColor, ";");
|
|
76
|
+
}, function (props) {
|
|
77
|
+
return props.selected && "background-color: ".concat(props.theme.selectedListOptionBackgroundColor);
|
|
78
|
+
}, function (props) {
|
|
79
|
+
return props.selected ? "background-color: ".concat(props.theme.selectedHoverListOptionBackgroundColor, ";") : "background-color: ".concat(props.theme.unselectedHoverListOptionBackgroundColor, ";");
|
|
80
|
+
}, function (props) {
|
|
81
|
+
return props.selected ? "background-color: ".concat(props.theme.selectedActiveListOptionBackgroundColor, ";") : "background-color: ".concat(props.theme.unselectedActiveListOptionBackgroundColor, ";");
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
var StyledOption = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 0.5rem 0.188rem 0;\n min-height: 24px;\n ", "\n ", ";\n"])), function (props) {
|
|
85
|
+
return props.grouped && props.multiple && "padding-left: 16px;";
|
|
86
|
+
}, function (props) {
|
|
87
|
+
return props.last || props.visualFocused || props.selected ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
var OptionIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n ", "\n color: ", ";\n"])), function (props) {
|
|
91
|
+
return props.grouped && !props.multiple ? "padding-left: 16px;" : "padding-left: 8px;";
|
|
92
|
+
}, function (props) {
|
|
93
|
+
return props.theme.listOptionIconColor;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
var OptionContent = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n overflow: hidden;\n ", "\n"])), function (props) {
|
|
97
|
+
return props.grouped && !props.multiple && !props.hasIcon ? "padding-left: 16px;" : "padding-left: 8px;";
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
var OptionIconImg = _styledComponents["default"].img(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"])));
|
|
101
|
+
|
|
102
|
+
var OptionLabel = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
|
|
103
|
+
|
|
104
|
+
var OptionSelectedIndicator = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 16px;\n width: 16px;\n margin-left: 4px;\n color: ", ";\n"])), function (props) {
|
|
105
|
+
return props.theme.selectedListOptionIconColor;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
var _default = /*#__PURE__*/_react["default"].memo(Option);
|
|
109
|
+
|
|
110
|
+
exports["default"] = _default;
|