@dxc-technology/halstack-react 0.0.0-0bd2807 → 0.0.0-0d50ab3
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 +1 -4
- package/ThemeContext.d.ts +10 -0
- package/ThemeContext.js +26 -29
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +11 -22
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/Accordion.test.js +57 -0
- package/accordion/types.d.ts +4 -8
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/AccordionGroup.test.js +133 -0
- package/accordion-group/types.d.ts +4 -8
- package/alert/Alert.js +2 -2
- package/alert/Alert.test.js +92 -0
- package/alert/types.d.ts +1 -1
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +1 -1
- package/badge/types.d.ts +4 -0
- package/badge/types.js +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +84 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +13 -0
- package/bleed/types.js +5 -0
- package/box/Box.js +2 -2
- package/box/Box.test.js +18 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +13 -19
- package/button/Button.stories.tsx +6 -8
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +5 -9
- package/card/Card.js +5 -6
- 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 +4 -6
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/Checkbox.test.js +65 -0
- package/checkbox/types.d.ts +2 -2
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +16 -76
- package/chip/Chip.stories.tsx +6 -8
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/variables.js +56 -260
- package/date-input/DateInput.js +10 -13
- package/date-input/DateInput.test.js +469 -0
- package/dialog/Dialog.js +4 -3
- package/dialog/Dialog.test.js +40 -0
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +13 -35
- package/dropdown/Dropdown.stories.tsx +249 -0
- package/dropdown/Dropdown.test.js +189 -0
- package/dropdown/types.d.ts +6 -15
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +167 -109
- 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 +12 -21
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +28 -36
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +21 -17
- package/header/Header.js +2 -2
- package/header/Header.stories.tsx +162 -0
- package/header/Header.test.js +63 -0
- package/header/Icons.d.ts +2 -0
- package/header/types.d.ts +4 -2
- package/heading/Heading.js +1 -1
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +186 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +84 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +13 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +17 -21
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.js +10 -18
- package/link/Link.stories.tsx +82 -1
- package/link/Link.test.js +91 -0
- package/link/types.d.ts +5 -9
- package/list/List.d.ts +4 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +10 -8
- package/main.js +54 -38
- package/number-input/NumberInput.js +3 -6
- package/number-input/NumberInput.test.js +508 -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/package.json +4 -2
- package/paginator/Paginator.js +2 -8
- package/paginator/Paginator.test.js +266 -0
- package/password-input/PasswordInput.js +19 -18
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/PasswordInput.test.js +183 -0
- package/password-input/types.d.ts +17 -10
- package/progress-bar/ProgressBar.js +4 -4
- package/progress-bar/ProgressBar.test.js +65 -0
- package/radio/Radio.js +2 -2
- package/radio/Radio.test.js +71 -0
- package/radio/types.d.ts +2 -2
- 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 +280 -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 +9 -29
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/ResultsetTable.test.js +306 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +10 -0
- package/row/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -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 +69 -194
- package/select/Select.stories.tsx +72 -62
- package/select/Select.test.js +1900 -0
- package/select/types.d.ts +183 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.js +2 -2
- package/sidenav/Sidenav.stories.tsx +182 -0
- package/sidenav/Sidenav.test.js +56 -0
- package/slider/Slider.js +4 -4
- package/slider/Slider.test.js +129 -0
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +1 -0
- package/spinner/Spinner.test.js +64 -0
- package/stack/Stack.d.ts +3 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +164 -0
- package/stack/types.d.ts +9 -0
- package/stack/types.js +5 -0
- package/switch/Switch.js +2 -2
- package/switch/Switch.stories.tsx +1 -1
- package/switch/Switch.test.js +73 -0
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +2 -1
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.js +11 -9
- package/tabs/Tabs.stories.tsx +120 -0
- package/tabs/Tabs.test.js +123 -0
- package/tabs/types.d.ts +25 -18
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +7 -12
- package/tag/Tag.stories.tsx +15 -22
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +23 -14
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +62 -89
- package/text-input/TextInput.stories.tsx +474 -0
- package/text-input/TextInput.test.js +1725 -0
- package/text-input/types.d.ts +163 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +32 -63
- package/textarea/Textarea.stories.jsx +34 -12
- package/textarea/Textarea.test.js +436 -0
- package/textarea/types.d.ts +130 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +16 -45
- package/toggle-group/ToggleGroup.stories.tsx +23 -28
- package/toggle-group/ToggleGroup.test.js +125 -0
- package/toggle-group/types.d.ts +97 -0
- package/toggle-group/types.js +5 -0
- package/useTheme.d.ts +2 -0
- package/useTheme.js +1 -1
- package/wizard/Wizard.js +59 -9
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +0 -0
- package/wizard/Wizard.test.js +128 -0
- package/wizard/types.d.ts +3 -7
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/chip/index.d.ts +0 -22
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/file-input/index.d.ts +0 -81
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
- package/wizard/Icons.js +0 -65
package/select/Select.js
CHANGED
|
@@ -21,7 +21,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
21
21
|
|
|
22
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
23
|
|
|
24
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
26
|
var _variables = require("../common/variables.js");
|
|
27
27
|
|
|
@@ -29,95 +29,16 @@ var _uuid = require("uuid");
|
|
|
29
29
|
|
|
30
30
|
var _utils = require("../common/utils.js");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _Option = _interopRequireDefault(require("../select/Option"));
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
35
|
+
|
|
36
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22;
|
|
35
37
|
|
|
36
38
|
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); }
|
|
37
39
|
|
|
38
40
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
|
39
41
|
|
|
40
|
-
var selectIcons = {
|
|
41
|
-
error: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
42
|
-
role: "img",
|
|
43
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
-
height: "24px",
|
|
45
|
-
viewBox: "0 0 24 24",
|
|
46
|
-
width: "24px",
|
|
47
|
-
fill: "currentColor"
|
|
48
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
49
|
-
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"
|
|
50
|
-
})),
|
|
51
|
-
arrowUp: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
52
|
-
role: "img",
|
|
53
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
54
|
-
height: "24px",
|
|
55
|
-
viewBox: "0 0 24 24",
|
|
56
|
-
width: "24px",
|
|
57
|
-
fill: "currentColor"
|
|
58
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
59
|
-
d: "M0 0h24v24H0V0z",
|
|
60
|
-
fill: "none"
|
|
61
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
62
|
-
d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6 1.41 1.41z"
|
|
63
|
-
})),
|
|
64
|
-
arrowDown: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
65
|
-
role: "img",
|
|
66
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
67
|
-
height: "24px",
|
|
68
|
-
viewBox: "0 0 24 24",
|
|
69
|
-
width: "24px",
|
|
70
|
-
fill: "currentColor"
|
|
71
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
72
|
-
d: "M0 0h24v24H0V0z",
|
|
73
|
-
fill: "none"
|
|
74
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
75
|
-
d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
|
|
76
|
-
})),
|
|
77
|
-
clear: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
78
|
-
role: "img",
|
|
79
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
80
|
-
width: "24",
|
|
81
|
-
height: "24",
|
|
82
|
-
viewBox: "0 0 24 24",
|
|
83
|
-
fill: "currentColor"
|
|
84
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
85
|
-
d: "M0 0h24v24H0V0z",
|
|
86
|
-
fill: "none"
|
|
87
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
88
|
-
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"
|
|
89
|
-
})),
|
|
90
|
-
selected: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
91
|
-
role: "img",
|
|
92
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
93
|
-
height: "24px",
|
|
94
|
-
viewBox: "0 0 24 24",
|
|
95
|
-
width: "24px",
|
|
96
|
-
fill: "currentColor"
|
|
97
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
98
|
-
d: "M0 0h24v24H0z",
|
|
99
|
-
fill: "none"
|
|
100
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
101
|
-
d: "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
|
|
102
|
-
})),
|
|
103
|
-
searchOff: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
104
|
-
role: "img",
|
|
105
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
106
|
-
height: "24px",
|
|
107
|
-
viewBox: "0 0 24 24",
|
|
108
|
-
width: "24px",
|
|
109
|
-
fill: "currentColor"
|
|
110
|
-
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
111
|
-
fill: "none",
|
|
112
|
-
height: "24",
|
|
113
|
-
width: "24"
|
|
114
|
-
})), /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
115
|
-
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"
|
|
116
|
-
}), /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
117
|
-
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"
|
|
118
|
-
}))))
|
|
119
|
-
};
|
|
120
|
-
|
|
121
42
|
var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
|
|
122
43
|
return "This field is required. Please, enter a value.";
|
|
123
44
|
};
|
|
@@ -153,7 +74,7 @@ var getLastOptionIndex = function getLastOptionIndex(options, filteredOptions, s
|
|
|
153
74
|
|
|
154
75
|
var getSelectedOption = function getSelectedOption(options, multiple, optional, optionalEmptyOption, value, innerValue) {
|
|
155
76
|
var val = value !== null && value !== void 0 ? value : innerValue;
|
|
156
|
-
var selectedOption = multiple ? [] :
|
|
77
|
+
var selectedOption = multiple ? [] : {};
|
|
157
78
|
var singleSelectionIndex;
|
|
158
79
|
|
|
159
80
|
if (multiple) {
|
|
@@ -201,14 +122,12 @@ var getSelectedOption = function getSelectedOption(options, multiple, optional,
|
|
|
201
122
|
var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
202
123
|
var _selectedOption$label;
|
|
203
124
|
|
|
204
|
-
var
|
|
205
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
125
|
+
var label = _ref.label,
|
|
206
126
|
_ref$name = _ref.name,
|
|
207
127
|
name = _ref$name === void 0 ? "" : _ref$name,
|
|
208
128
|
value = _ref.value,
|
|
209
129
|
options = _ref.options,
|
|
210
|
-
|
|
211
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
130
|
+
helperText = _ref.helperText,
|
|
212
131
|
_ref$placeholder = _ref.placeholder,
|
|
213
132
|
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
214
133
|
_ref$disabled = _ref.disabled,
|
|
@@ -221,8 +140,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
221
140
|
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
222
141
|
onChange = _ref.onChange,
|
|
223
142
|
onBlur = _ref.onBlur,
|
|
224
|
-
|
|
225
|
-
error = _ref$error === void 0 ? "" : _ref$error,
|
|
143
|
+
error = _ref.error,
|
|
226
144
|
margin = _ref.margin,
|
|
227
145
|
_ref$size = _ref.size,
|
|
228
146
|
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
@@ -234,6 +152,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
234
152
|
selectId = _useState2[0];
|
|
235
153
|
|
|
236
154
|
var selectLabelId = "label-".concat(selectId);
|
|
155
|
+
var errorId = "error-".concat(selectId);
|
|
237
156
|
var optionsListId = "".concat(selectId, "-listbox");
|
|
238
157
|
|
|
239
158
|
var _useState3 = (0, _react.useState)(multiple ? [] : ""),
|
|
@@ -453,6 +372,11 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
453
372
|
setSearchValue("");
|
|
454
373
|
};
|
|
455
374
|
|
|
375
|
+
var handleOptionOnClick = (0, _react.useCallback)(function (option) {
|
|
376
|
+
handleSelectChangeValue(option);
|
|
377
|
+
!multiple && closeOptions();
|
|
378
|
+
setSearchValue("");
|
|
379
|
+
}, [handleSelectChangeValue, closeOptions, multiple]);
|
|
456
380
|
(0, _react.useLayoutEffect)(function () {
|
|
457
381
|
if (isOpen && singleSelectionIndex) {
|
|
458
382
|
var _listEl$scrollTo;
|
|
@@ -473,47 +397,6 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
473
397
|
inline: "start"
|
|
474
398
|
});
|
|
475
399
|
}, [visualFocusIndex]);
|
|
476
|
-
|
|
477
|
-
var Option = function Option(_ref2) {
|
|
478
|
-
var option = _ref2.option,
|
|
479
|
-
index = _ref2.index,
|
|
480
|
-
_ref2$isGroupedOption = _ref2.isGroupedOption,
|
|
481
|
-
isGroupedOption = _ref2$isGroupedOption === void 0 ? false : _ref2$isGroupedOption;
|
|
482
|
-
var isSelected = multiple ? (value !== null && value !== void 0 ? value : innerValue).includes(option.value) : (value !== null && value !== void 0 ? value : innerValue) === option.value;
|
|
483
|
-
var isLastOption = index === lastOptionIndex;
|
|
484
|
-
return /*#__PURE__*/_react["default"].createElement(OptionItem, {
|
|
485
|
-
id: "option-".concat(index),
|
|
486
|
-
onClick: function onClick() {
|
|
487
|
-
handleSelectChangeValue(option);
|
|
488
|
-
!multiple && closeOptions();
|
|
489
|
-
setSearchValue("");
|
|
490
|
-
},
|
|
491
|
-
visualFocused: visualFocusIndex === index,
|
|
492
|
-
selected: isSelected,
|
|
493
|
-
role: "option",
|
|
494
|
-
"aria-selected": isSelected
|
|
495
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledOption, {
|
|
496
|
-
visualFocused: visualFocusIndex === index,
|
|
497
|
-
selected: isSelected,
|
|
498
|
-
last: isLastOption,
|
|
499
|
-
grouped: isGroupedOption,
|
|
500
|
-
multiple: multiple
|
|
501
|
-
}, multiple && /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
502
|
-
tabIndex: -1,
|
|
503
|
-
checked: isSelected
|
|
504
|
-
}), option.icon && /*#__PURE__*/_react["default"].createElement(OptionIcon, {
|
|
505
|
-
grouped: isGroupedOption,
|
|
506
|
-
multiple: multiple,
|
|
507
|
-
role: !(typeof option.icon === "string") && "img"
|
|
508
|
-
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement(OptionIconImg, {
|
|
509
|
-
src: option.icon
|
|
510
|
-
}) : option.icon), /*#__PURE__*/_react["default"].createElement(OptionContent, {
|
|
511
|
-
grouped: isGroupedOption,
|
|
512
|
-
hasIcon: option.icon,
|
|
513
|
-
multiple: multiple
|
|
514
|
-
}, /*#__PURE__*/_react["default"].createElement(OptionLabel, null, option.label), !multiple && isSelected && /*#__PURE__*/_react["default"].createElement(OptionSelectedIndicator, null, selectIcons.selected))));
|
|
515
|
-
};
|
|
516
|
-
|
|
517
400
|
var globalIndex = optional && !multiple ? 0 : -1; // index for options, starting from 0 to options.length -1
|
|
518
401
|
|
|
519
402
|
var mapOptionFunc = function mapOptionFunc(option, mapIndex) {
|
|
@@ -527,18 +410,29 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
527
410
|
id: groupId
|
|
528
411
|
}, option.label), option.options.map(function (singleOption) {
|
|
529
412
|
globalIndex++;
|
|
530
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
413
|
+
return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
414
|
+
id: "option-".concat(globalIndex),
|
|
531
415
|
option: singleOption,
|
|
532
|
-
|
|
533
|
-
|
|
416
|
+
onClick: handleOptionOnClick,
|
|
417
|
+
multiple: multiple,
|
|
418
|
+
visualFocused: visualFocusIndex === globalIndex,
|
|
419
|
+
isGroupedOption: true,
|
|
420
|
+
isLastOption: lastOptionIndex === globalIndex,
|
|
421
|
+
isSelected: multiple ? (value !== null && value !== void 0 ? value : innerValue).includes(singleOption.value) : (value !== null && value !== void 0 ? value : innerValue) === singleOption.value
|
|
534
422
|
});
|
|
535
423
|
})));
|
|
536
424
|
} else {
|
|
537
425
|
globalIndex++;
|
|
538
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
426
|
+
return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
539
427
|
key: "option-".concat(option.value),
|
|
428
|
+
id: "option-".concat(globalIndex),
|
|
540
429
|
option: option,
|
|
541
|
-
|
|
430
|
+
onClick: handleOptionOnClick,
|
|
431
|
+
multiple: multiple,
|
|
432
|
+
visualFocused: visualFocusIndex === globalIndex,
|
|
433
|
+
isGroupedOption: false,
|
|
434
|
+
isLastOption: lastOptionIndex === globalIndex,
|
|
435
|
+
isSelected: multiple ? (value !== null && value !== void 0 ? value : innerValue).includes(option.value) : (value !== null && value !== void 0 ? value : innerValue) === option.value
|
|
542
436
|
});
|
|
543
437
|
}
|
|
544
438
|
};
|
|
@@ -549,13 +443,14 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
549
443
|
margin: margin,
|
|
550
444
|
size: size,
|
|
551
445
|
ref: ref
|
|
552
|
-
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
446
|
+
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
553
447
|
id: selectLabelId,
|
|
554
448
|
disabled: disabled,
|
|
555
449
|
onClick: function onClick() {
|
|
556
450
|
selectContainerRef.current.focus();
|
|
557
|
-
}
|
|
558
|
-
|
|
451
|
+
},
|
|
452
|
+
helperText: helperText
|
|
453
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
559
454
|
disabled: disabled
|
|
560
455
|
}, helperText), /*#__PURE__*/_react["default"].createElement(Select, {
|
|
561
456
|
id: selectId,
|
|
@@ -569,12 +464,14 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
569
464
|
tabIndex: tabIndex,
|
|
570
465
|
role: "combobox",
|
|
571
466
|
"aria-controls": optionsListId,
|
|
467
|
+
"aria-disabled": disabled,
|
|
572
468
|
"aria-expanded": isOpen,
|
|
573
469
|
"aria-haspopup": "listbox",
|
|
574
470
|
"aria-labelledby": selectLabelId,
|
|
575
471
|
"aria-activedescendant": visualFocusIndex >= 0 ? "option-".concat(visualFocusIndex) : undefined,
|
|
576
472
|
"aria-invalid": error ? "true" : "false",
|
|
577
|
-
"aria-
|
|
473
|
+
"aria-errormessage": error ? errorId : undefined,
|
|
474
|
+
"aria-required": !disabled && !optional
|
|
578
475
|
}, multiple && selectedOption.length > 0 && /*#__PURE__*/_react["default"].createElement(SelectionIndicator, null, /*#__PURE__*/_react["default"].createElement(SelectionNumber, {
|
|
579
476
|
disabled: disabled
|
|
580
477
|
}, selectedOption.length), /*#__PURE__*/_react["default"].createElement(ClearOptionsAction, {
|
|
@@ -585,9 +482,9 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
585
482
|
},
|
|
586
483
|
onClick: handleClearOptionsActionOnClick,
|
|
587
484
|
tabIndex: -1,
|
|
588
|
-
title: "Clear
|
|
589
|
-
"aria-label": "Clear
|
|
590
|
-
},
|
|
485
|
+
title: "Clear selection",
|
|
486
|
+
"aria-label": "Clear selection"
|
|
487
|
+
}, _Icons["default"].clear)), /*#__PURE__*/_react["default"].createElement(SearchableValueContainer, null, /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
591
488
|
name: name,
|
|
592
489
|
value: multiple ? (value !== null && value !== void 0 ? value : innerValue).join(", ") : value !== null && value !== void 0 ? value : innerValue,
|
|
593
490
|
readOnly: true,
|
|
@@ -597,8 +494,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
597
494
|
disabled: disabled,
|
|
598
495
|
onChange: handleSearchIOnChange,
|
|
599
496
|
ref: selectSearchInputRef,
|
|
600
|
-
autoComplete: "
|
|
601
|
-
autoCorrect: "
|
|
497
|
+
autoComplete: "nope",
|
|
498
|
+
autoCorrect: "nope",
|
|
602
499
|
size: "1"
|
|
603
500
|
}), (!searchable || searchValue === "") && (multiple ? /*#__PURE__*/_react["default"].createElement(SelectedOption, {
|
|
604
501
|
disabled: disabled,
|
|
@@ -608,18 +505,18 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
608
505
|
}).join(", ")), selectedOption.length === 0 && placeholder) : /*#__PURE__*/_react["default"].createElement(SelectedOption, {
|
|
609
506
|
disabled: disabled,
|
|
610
507
|
atBackground: !(value !== null && value !== void 0 ? value : innerValue) || searchable && isOpen
|
|
611
|
-
}, /*#__PURE__*/_react["default"].createElement(OptionLabel, null, (_selectedOption$label = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) !== null && _selectedOption$label !== void 0 ? _selectedOption$label : placeholder)))), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, null,
|
|
508
|
+
}, /*#__PURE__*/_react["default"].createElement(OptionLabel, null, (_selectedOption$label = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) !== null && _selectedOption$label !== void 0 ? _selectedOption$label : placeholder)))), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, null, _Icons["default"].error), searchable && searchValue.length > 0 && /*#__PURE__*/_react["default"].createElement(ClearSearchAction, {
|
|
612
509
|
onMouseDown: function onMouseDown(event) {
|
|
613
510
|
// Avoid input to lose focus
|
|
614
511
|
event.preventDefault();
|
|
615
512
|
},
|
|
616
513
|
onClick: handleClearSearchActionOnClick,
|
|
617
514
|
tabIndex: -1,
|
|
618
|
-
title: "Clear search
|
|
619
|
-
"aria-label": "Clear search
|
|
620
|
-
},
|
|
515
|
+
title: "Clear search",
|
|
516
|
+
"aria-label": "Clear search"
|
|
517
|
+
}, _Icons["default"].clear), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
|
|
621
518
|
disabled: disabled
|
|
622
|
-
}, isOpen ?
|
|
519
|
+
}, isOpen ? _Icons["default"].arrowUp : _Icons["default"].arrowDown), isOpen && /*#__PURE__*/_react["default"].createElement(OptionsList, {
|
|
623
520
|
id: optionsListId,
|
|
624
521
|
onClick: function onClick(event) {
|
|
625
522
|
event.stopPropagation();
|
|
@@ -629,11 +526,21 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
629
526
|
},
|
|
630
527
|
ref: selectOptionsListRef,
|
|
631
528
|
role: "listbox",
|
|
632
|
-
"aria-multiselectable": multiple
|
|
633
|
-
|
|
529
|
+
"aria-multiselectable": multiple,
|
|
530
|
+
"aria-orientation": "vertical"
|
|
531
|
+
}, searchable && (filteredOptions.length === 0 || !filteredGroupsHaveOptions()) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, _Icons["default"].searchOff), "No matches found") : optional && !multiple && /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
532
|
+
id: "option-".concat(0),
|
|
634
533
|
option: optionalEmptyOption,
|
|
635
|
-
|
|
636
|
-
|
|
534
|
+
onClick: handleOptionOnClick,
|
|
535
|
+
multiple: multiple,
|
|
536
|
+
visualFocused: visualFocusIndex === 0,
|
|
537
|
+
isGroupedOption: false,
|
|
538
|
+
isLastOption: lastOptionIndex === 0,
|
|
539
|
+
isSelected: multiple ? (value !== null && value !== void 0 ? value : innerValue).includes(optionalEmptyOption.value) : (value !== null && value !== void 0 ? value : innerValue) === optionalEmptyOption.value
|
|
540
|
+
}), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
541
|
+
id: errorId,
|
|
542
|
+
"aria-live": error ? "assertive" : "off"
|
|
543
|
+
}, error)));
|
|
637
544
|
});
|
|
638
545
|
|
|
639
546
|
var sizes = {
|
|
@@ -661,7 +568,7 @@ var SelectContainer = _styledComponents["default"].div(_templateObject || (_temp
|
|
|
661
568
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
662
569
|
});
|
|
663
570
|
|
|
664
|
-
var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n"])), function (props) {
|
|
571
|
+
var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n ", "\n"])), function (props) {
|
|
665
572
|
return props.disabled ? props.theme.disabledColor : props.theme.labelFontColor;
|
|
666
573
|
}, function (props) {
|
|
667
574
|
return props.theme.fontFamily;
|
|
@@ -673,13 +580,15 @@ var Label = _styledComponents["default"].span(_templateObject2 || (_templateObje
|
|
|
673
580
|
return props.theme.labelFontWeight;
|
|
674
581
|
}, function (props) {
|
|
675
582
|
return props.theme.labelLineHeight;
|
|
583
|
+
}, function (props) {
|
|
584
|
+
return !props.helperText && "margin-bottom: 0.25rem";
|
|
676
585
|
});
|
|
677
586
|
|
|
678
587
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
679
588
|
return props.theme.optionalLabelFontWeight;
|
|
680
589
|
});
|
|
681
590
|
|
|
682
|
-
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
591
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
683
592
|
return props.disabled ? props.theme.disabledColor : props.theme.helperTextFontColor;
|
|
684
593
|
}, function (props) {
|
|
685
594
|
return props.theme.fontFamily;
|
|
@@ -693,9 +602,7 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
693
602
|
return props.theme.helperTextLineHeight;
|
|
694
603
|
});
|
|
695
604
|
|
|
696
|
-
var Select = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n
|
|
697
|
-
return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
|
|
698
|
-
}, function (props) {
|
|
605
|
+
var Select = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n outline: none;\n ", ";\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"])), function (props) {
|
|
699
606
|
return props.disabled && "background-color: ".concat(props.theme.disabledInputBackgroundColor);
|
|
700
607
|
}, function (props) {
|
|
701
608
|
return props.disabled ? props.theme.disabledInputBorderColor : props.theme.enabledInputBorderColor;
|
|
@@ -773,7 +680,7 @@ var ErrorIcon = _styledComponents["default"].span(_templateObject13 || (_templat
|
|
|
773
680
|
return props.theme.errorIconColor;
|
|
774
681
|
});
|
|
775
682
|
|
|
776
|
-
var Error = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n"])), function (props) {
|
|
683
|
+
var Error = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
777
684
|
return props.theme.errorMessageColor;
|
|
778
685
|
}, function (props) {
|
|
779
686
|
return props.theme.fontFamily;
|
|
@@ -827,39 +734,7 @@ var GroupLabel = _styledComponents["default"].li(_templateObject21 || (_template
|
|
|
827
734
|
return props.theme.listGroupLabelFontWeight;
|
|
828
735
|
});
|
|
829
736
|
|
|
830
|
-
var
|
|
831
|
-
return props.visualFocused && "box-shadow: inset 0 0 0 2px ".concat(props.theme.focusListOptionBorderColor, ";");
|
|
832
|
-
}, function (props) {
|
|
833
|
-
return props.selected && "background-color: ".concat(props.theme.selectedListOptionBackgroundColor);
|
|
834
|
-
}, function (props) {
|
|
835
|
-
return props.selected ? "background-color: ".concat(props.theme.selectedHoverListOptionBackgroundColor, ";") : "background-color: ".concat(props.theme.unselectedHoverListOptionBackgroundColor, ";");
|
|
836
|
-
}, function (props) {
|
|
837
|
-
return props.selected ? "background-color: ".concat(props.theme.selectedActiveListOptionBackgroundColor, ";") : "background-color: ".concat(props.theme.unselectedActiveListOptionBackgroundColor, ";");
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
var StyledOption = _styledComponents["default"].span(_templateObject23 || (_templateObject23 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 0.5rem 0.188rem 0;\n min-height: 24px;\n ", "\n ", ";\n"])), function (props) {
|
|
841
|
-
return props.grouped && props.multiple && "padding-left: 16px;";
|
|
842
|
-
}, function (props) {
|
|
843
|
-
return props.last || props.visualFocused || props.selected ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
|
|
844
|
-
});
|
|
845
|
-
|
|
846
|
-
var OptionContent = _styledComponents["default"].span(_templateObject24 || (_templateObject24 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n overflow: hidden;\n ", "\n"])), function (props) {
|
|
847
|
-
return props.grouped && !props.multiple && !props.hasIcon ? "padding-left: 16px;" : "padding-left: 8px;";
|
|
848
|
-
});
|
|
849
|
-
|
|
850
|
-
var OptionIcon = _styledComponents["default"].span(_templateObject25 || (_templateObject25 = (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) {
|
|
851
|
-
return props.grouped && !props.multiple ? "padding-left: 16px;" : "padding-left: 8px;";
|
|
852
|
-
}, function (props) {
|
|
853
|
-
return props.theme.listOptionIconColor;
|
|
854
|
-
});
|
|
855
|
-
|
|
856
|
-
var OptionIconImg = _styledComponents["default"].img(_templateObject26 || (_templateObject26 = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"])));
|
|
857
|
-
|
|
858
|
-
var OptionLabel = _styledComponents["default"].span(_templateObject27 || (_templateObject27 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
|
|
859
|
-
|
|
860
|
-
var OptionSelectedIndicator = _styledComponents["default"].span(_templateObject28 || (_templateObject28 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 16px;\n width: 16px;\n margin-left: 4px;\n color: ", ";\n"])), function (props) {
|
|
861
|
-
return props.theme.selectedListOptionIconColor;
|
|
862
|
-
});
|
|
737
|
+
var OptionLabel = _styledComponents["default"].span(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
|
|
863
738
|
|
|
864
739
|
var _default = DxcSelect;
|
|
865
740
|
exports["default"] = _default;
|
|
@@ -12,8 +12,8 @@ export default {
|
|
|
12
12
|
title: "Select",
|
|
13
13
|
component: DxcSelect,
|
|
14
14
|
};
|
|
15
|
-
const one_option = [{ label: "Option 01", value: "1" }];
|
|
16
15
|
|
|
16
|
+
const one_option = [{ label: "Option 01", value: "1" }];
|
|
17
17
|
const single_options = [
|
|
18
18
|
{ label: "Option 01", value: "1" },
|
|
19
19
|
{ label: "Option 02", value: "2" },
|
|
@@ -224,10 +224,12 @@ const optionsWithEllipsisMedium = [
|
|
|
224
224
|
{ label: "Optiond1234567890123456789012345678901234", value: "1" },
|
|
225
225
|
{ label: "Optiond12345678901234567890123456789012345", value: "2" },
|
|
226
226
|
{ label: "Option 031111111111111111111111111111222", value: "3" },
|
|
227
|
-
{ label: "Option
|
|
227
|
+
{ label: "Option 03111111111111111111111111111222", value: "4" },
|
|
228
228
|
];
|
|
229
|
+
|
|
229
230
|
const Select = () => (
|
|
230
231
|
<>
|
|
232
|
+
<Title title="States" theme="light" level={2} />
|
|
231
233
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
232
234
|
<Title title="Hovered" theme="light" level={4} />
|
|
233
235
|
<DxcSelect label="Hovered" options={single_options} />
|
|
@@ -245,85 +247,93 @@ const Select = () => (
|
|
|
245
247
|
<DxcSelect label="Disabled with value" disabled options={single_options} value="1" />
|
|
246
248
|
</ExampleContainer>
|
|
247
249
|
<ExampleContainer>
|
|
248
|
-
<Title title="With label" theme="light" level={4} />
|
|
249
|
-
<DxcSelect label="Label" options={single_options} />
|
|
250
|
-
<Title title="Label and placeholder" theme="light" level={4} />
|
|
251
|
-
<DxcSelect label="Label" options={single_options} placeholder="Placeholder" />
|
|
252
|
-
<Title title="Label, placeholder and helper text" theme="light" level={4} />
|
|
253
|
-
<DxcSelect label="Label" options={single_options} helperText="Helper text" placeholder="Placeholder" />
|
|
254
250
|
<Title title="Error" theme="light" level={4} />
|
|
255
251
|
<DxcSelect
|
|
256
252
|
label="Label"
|
|
257
253
|
options={single_options}
|
|
258
|
-
error="Error message"
|
|
254
|
+
error="Error message."
|
|
259
255
|
helperText="Helper text"
|
|
260
256
|
placeholder="Placeholder"
|
|
261
257
|
/>
|
|
258
|
+
</ExampleContainer>
|
|
259
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
260
|
+
<Title title="Hovered error" theme="light" level={4} />
|
|
261
|
+
<DxcSelect
|
|
262
|
+
label="Label"
|
|
263
|
+
options={single_options}
|
|
264
|
+
error="Error message."
|
|
265
|
+
helperText="Helper text"
|
|
266
|
+
placeholder="Placeholder"
|
|
267
|
+
/>
|
|
268
|
+
</ExampleContainer>
|
|
269
|
+
<Title title="Anatomy" theme="light" level={2} />
|
|
270
|
+
<ExampleContainer>
|
|
271
|
+
<Title title="Label, placeholder and helper text" theme="light" level={4} />
|
|
272
|
+
<DxcSelect label="Label" options={single_options} helperText="Helper text" placeholder="Placeholder" />
|
|
273
|
+
</ExampleContainer>
|
|
274
|
+
<Title title="Variants" theme="light" level={2} />
|
|
275
|
+
<ExampleContainer>
|
|
262
276
|
<Title title="Simple selection" theme="light" level={4} />
|
|
263
277
|
<DxcSelect label="Simple selection" searchable options={single_options} value="2" />
|
|
278
|
+
</ExampleContainer>
|
|
279
|
+
<ExampleContainer>
|
|
264
280
|
<Title title="Multiple selection" theme="light" level={4} />
|
|
265
281
|
<DxcSelect label="Multiple select" searchable options={single_options} multiple value={["1", "2"]} />
|
|
266
282
|
</ExampleContainer>
|
|
267
|
-
|
|
268
283
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
269
284
|
<Title title="Multiple clear hovered" theme="light" level={4} />
|
|
270
285
|
<DxcSelect label="Multiple select" options={single_options} multiple value={["1", "2"]} />
|
|
271
286
|
</ExampleContainer>
|
|
272
|
-
|
|
273
287
|
<ExampleContainer pseudoState="pseudo-active">
|
|
274
288
|
<Title title="Multiple clear actived" theme="light" level={4} />
|
|
275
289
|
<DxcSelect label="Multiple select" options={single_options} multiple value={["1", "2"]} />
|
|
276
290
|
</ExampleContainer>
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
<
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
<
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
<
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
<
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
<Title title="xxlarge margin" theme="light" level={4} />
|
|
324
|
-
<DxcSelect label="xxLarge" options={single_options} margin="xxlarge" />
|
|
325
|
-
</ExampleContainer>
|
|
326
|
-
</>
|
|
291
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
292
|
+
<ExampleContainer>
|
|
293
|
+
<Title title="Small size" theme="light" level={4} />
|
|
294
|
+
<DxcSelect label="Small" options={single_options} size="small" />
|
|
295
|
+
</ExampleContainer>
|
|
296
|
+
<ExampleContainer>
|
|
297
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
298
|
+
<DxcSelect label="Medium" options={single_options} size="medium" />
|
|
299
|
+
</ExampleContainer>
|
|
300
|
+
<ExampleContainer>
|
|
301
|
+
<Title title="Large size" theme="light" level={4} />
|
|
302
|
+
<DxcSelect label="Large" options={single_options} size="large" />
|
|
303
|
+
</ExampleContainer>
|
|
304
|
+
<ExampleContainer>
|
|
305
|
+
<Title title="Fillparent size" theme="light" level={4} />
|
|
306
|
+
<DxcSelect label="Fillparent" options={single_options} size="fillParent" />
|
|
307
|
+
</ExampleContainer>
|
|
308
|
+
<Title title="Margins" theme="light" level={2} />
|
|
309
|
+
<ExampleContainer>
|
|
310
|
+
<Title title="xxsmall margin" theme="light" level={4} />
|
|
311
|
+
<DxcSelect label="xxSmall" options={single_options} margin="xxsmall" />
|
|
312
|
+
</ExampleContainer>
|
|
313
|
+
<ExampleContainer>
|
|
314
|
+
<Title title="xsmall margin" theme="light" level={4} />
|
|
315
|
+
<DxcSelect label="xSmall" options={single_options} margin="xsmall" />
|
|
316
|
+
</ExampleContainer>
|
|
317
|
+
<ExampleContainer>
|
|
318
|
+
<Title title="small margin" theme="light" level={4} />
|
|
319
|
+
<DxcSelect label="Small" options={single_options} margin="small" />
|
|
320
|
+
</ExampleContainer>
|
|
321
|
+
<ExampleContainer>
|
|
322
|
+
<Title title="medium margin" theme="light" level={4} />
|
|
323
|
+
<DxcSelect label="Medium" options={single_options} margin="medium" />
|
|
324
|
+
</ExampleContainer>
|
|
325
|
+
<ExampleContainer>
|
|
326
|
+
<Title title="large margin" theme="light" level={4} />
|
|
327
|
+
<DxcSelect label="Large" options={single_options} margin="large" />
|
|
328
|
+
</ExampleContainer>
|
|
329
|
+
<ExampleContainer>
|
|
330
|
+
<Title title="xlarge margin" theme="light" level={4} />
|
|
331
|
+
<DxcSelect label="xLarge" options={single_options} margin="xlarge" />
|
|
332
|
+
</ExampleContainer>
|
|
333
|
+
<ExampleContainer>
|
|
334
|
+
<Title title="xxlarge margin" theme="light" level={4} />
|
|
335
|
+
<DxcSelect label="xxLarge" options={single_options} margin="xxlarge" />
|
|
336
|
+
</ExampleContainer>
|
|
327
337
|
<ExampleContainer expanded>
|
|
328
338
|
<Title title="Ellipsis" theme="light" level={2} />
|
|
329
339
|
<Title title="Multiple selection with ellipsis" theme="light" level={4} />
|
|
@@ -344,7 +354,7 @@ const Select = () => (
|
|
|
344
354
|
export const Chromatic = Select.bind({});
|
|
345
355
|
Chromatic.play = async ({ canvasElement }) => {
|
|
346
356
|
const canvas = within(canvasElement);
|
|
347
|
-
await userEvent.click(canvas.getAllByRole("combobox")[
|
|
357
|
+
await userEvent.click(canvas.getAllByRole("combobox")[24]);
|
|
348
358
|
};
|
|
349
359
|
const DefaultSelect = () => (
|
|
350
360
|
<ExampleContainer expanded>
|