@dxc-technology/halstack-react 0.0.0-28a98e5 → 0.0.0-290c489
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/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +18 -81
- 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 +61 -76
- 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 +7 -23
- 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 +6 -4
- 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 +28 -64
- 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 +1 -1
- package/button/Button.js +24 -32
- package/button/Button.stories.tsx +250 -282
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +9 -13
- package/card/Card.d.ts +4 -0
- package/card/Card.js +38 -77
- 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 +45 -63
- 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 +16 -76
- 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/variables.js +301 -373
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +62 -86
- 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 +10 -56
- 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 +28 -87
- 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 +172 -111
- 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 +16 -23
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/flex/Flex.d.ts +3 -0
- package/flex/Flex.js +74 -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 +36 -148
- 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 +4 -4
- package/footer/types.d.ts +65 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +55 -78
- 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 +2 -27
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +7 -24
- 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 +71 -135
- package/layout/ApplicationLayout.stories.tsx +161 -0
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- 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 +60 -107
- 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 +14 -12
- package/main.js +78 -56
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +16 -68
- 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 +11 -7
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +19 -69
- 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 +24 -57
- 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 +6 -24
- 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 +9 -29
- 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/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +28 -0
- package/row/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 +214 -418
- 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 +174 -63
- 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 +63 -85
- 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 +9 -26
- 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/stack/Stack.d.ts +4 -0
- package/stack/Stack.js +56 -0
- package/stack/Stack.stories.tsx +263 -0
- package/stack/types.d.ts +32 -0
- package/stack/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/switch/Switch.js +49 -62
- 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 +3 -3
- 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 +24 -72
- 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 +34 -59
- 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 +137 -185
- 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 +39 -77
- 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 +18 -46
- 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 +118 -104
- 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 -246
- 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/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/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 -373
- 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 -611
- 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 -195
- 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 -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/wizard/index.d.ts +0 -18
package/dropdown/Dropdown.js
CHANGED
|
@@ -9,20 +9,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
-
|
|
18
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
17
|
|
|
20
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
19
|
|
|
22
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
21
|
|
|
24
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
-
|
|
26
22
|
var _Popper = _interopRequireDefault(require("@material-ui/core/Popper"));
|
|
27
23
|
|
|
28
24
|
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
@@ -39,7 +35,7 @@ var _variables = require("../common/variables.js");
|
|
|
39
35
|
|
|
40
36
|
var _utils = require("../common/utils.js");
|
|
41
37
|
|
|
42
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
38
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
43
39
|
|
|
44
40
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
45
41
|
|
|
@@ -48,29 +44,26 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
48
44
|
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; }
|
|
49
45
|
|
|
50
46
|
var DxcDropdown = function DxcDropdown(_ref) {
|
|
51
|
-
var
|
|
52
|
-
options = _ref$options === void 0 ? [] : _ref$options,
|
|
47
|
+
var options = _ref.options,
|
|
53
48
|
_ref$optionsIconPosit = _ref.optionsIconPosition,
|
|
54
49
|
optionsIconPosition = _ref$optionsIconPosit === void 0 ? "before" : _ref$optionsIconPosit,
|
|
55
50
|
icon = _ref.icon,
|
|
56
|
-
_ref$iconSrc = _ref.iconSrc,
|
|
57
|
-
iconSrc = _ref$iconSrc === void 0 ? "" : _ref$iconSrc,
|
|
58
51
|
_ref$iconPosition = _ref.iconPosition,
|
|
59
52
|
iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
|
|
60
53
|
_ref$label = _ref.label,
|
|
61
54
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
62
|
-
_ref$disabled = _ref.disabled,
|
|
63
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
64
55
|
_ref$caretHidden = _ref.caretHidden,
|
|
65
56
|
caretHidden = _ref$caretHidden === void 0 ? false : _ref$caretHidden,
|
|
66
57
|
onSelectOption = _ref.onSelectOption,
|
|
58
|
+
_ref$expandOnHover = _ref.expandOnHover,
|
|
59
|
+
expandOnHover = _ref$expandOnHover === void 0 ? false : _ref$expandOnHover,
|
|
67
60
|
margin = _ref.margin,
|
|
68
61
|
_ref$size = _ref.size,
|
|
69
62
|
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
70
|
-
_ref$expandOnHover = _ref.expandOnHover,
|
|
71
|
-
expandOnHover = _ref$expandOnHover === void 0 ? false : _ref$expandOnHover,
|
|
72
63
|
_ref$tabIndex = _ref.tabIndex,
|
|
73
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex
|
|
64
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
|
|
65
|
+
_ref$disabled = _ref.disabled,
|
|
66
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
74
67
|
|
|
75
68
|
var _useState = (0, _react.useState)(),
|
|
76
69
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
@@ -106,10 +99,7 @@ var DxcDropdown = function DxcDropdown(_ref) {
|
|
|
106
99
|
|
|
107
100
|
function handleMenuItemClick(option) {
|
|
108
101
|
setAnchorEl(null);
|
|
109
|
-
|
|
110
|
-
if (typeof onSelectOption === "function") {
|
|
111
|
-
onSelectOption(option.value);
|
|
112
|
-
}
|
|
102
|
+
onSelectOption(option.value);
|
|
113
103
|
}
|
|
114
104
|
|
|
115
105
|
function handleClose() {
|
|
@@ -148,6 +138,11 @@ var DxcDropdown = function DxcDropdown(_ref) {
|
|
|
148
138
|
}));
|
|
149
139
|
};
|
|
150
140
|
|
|
141
|
+
var labelComponent = /*#__PURE__*/_react["default"].createElement(DropdownTriggerLabel, {
|
|
142
|
+
iconPosition: iconPosition,
|
|
143
|
+
label: label
|
|
144
|
+
}, label);
|
|
145
|
+
|
|
151
146
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
152
147
|
theme: colorsTheme.dropdown
|
|
153
148
|
}, /*#__PURE__*/_react["default"].createElement(DXCDropdownContainer, {
|
|
@@ -170,20 +165,14 @@ var DxcDropdown = function DxcDropdown(_ref) {
|
|
|
170
165
|
ref: ref,
|
|
171
166
|
tabIndex: tabIndex
|
|
172
167
|
}, /*#__PURE__*/_react["default"].createElement(DropdownTriggerContainer, {
|
|
173
|
-
iconPosition: iconPosition,
|
|
174
168
|
caretHidden: caretHidden
|
|
175
|
-
}, icon
|
|
169
|
+
}, iconPosition === "after" && labelComponent, icon && /*#__PURE__*/_react["default"].createElement(ButtonIconContainer, {
|
|
176
170
|
label: label,
|
|
177
171
|
iconPosition: iconPosition,
|
|
178
172
|
disabled: disabled
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
iconPosition: iconPosition
|
|
183
|
-
}), /*#__PURE__*/_react["default"].createElement(DropdownTriggerLabel, {
|
|
184
|
-
iconPosition: iconPosition,
|
|
185
|
-
label: label
|
|
186
|
-
}, label)), /*#__PURE__*/_react["default"].createElement(CaretIconContainer, {
|
|
173
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
|
|
174
|
+
src: icon
|
|
175
|
+
}) : icon), iconPosition === "before" && labelComponent), /*#__PURE__*/_react["default"].createElement(CaretIconContainer, {
|
|
187
176
|
caretHidden: caretHidden,
|
|
188
177
|
disabled: disabled
|
|
189
178
|
}, !caretHidden && (anchorEl === null ? /*#__PURE__*/_react["default"].createElement(DownArrowIcon, null) : /*#__PURE__*/_react["default"].createElement(UpArrowIcon, null)))), /*#__PURE__*/_react["default"].createElement(DXCMenu, {
|
|
@@ -199,7 +188,6 @@ var DxcDropdown = function DxcDropdown(_ref) {
|
|
|
199
188
|
vertical: "top",
|
|
200
189
|
horizontal: "left"
|
|
201
190
|
},
|
|
202
|
-
optionsIconPosition: optionsIconPosition,
|
|
203
191
|
size: size,
|
|
204
192
|
width: width,
|
|
205
193
|
role: undefined,
|
|
@@ -221,14 +209,14 @@ var DxcDropdown = function DxcDropdown(_ref) {
|
|
|
221
209
|
onClick: function onClick(event) {
|
|
222
210
|
return handleMenuItemClick(option);
|
|
223
211
|
}
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}, (0, _typeof2["default"])(option.icon) === "object" ? option.icon : /*#__PURE__*/_react["default"].createElement(option.icon)) : option.iconSrc && /*#__PURE__*/_react["default"].createElement(ListIcon, {
|
|
212
|
+
}, optionsIconPosition === "after" && /*#__PURE__*/_react["default"].createElement("span", {
|
|
213
|
+
className: "optionLabel"
|
|
214
|
+
}, option.label), option.icon && /*#__PURE__*/_react["default"].createElement(ListIconContainer, {
|
|
228
215
|
label: option.label,
|
|
229
|
-
src: option.iconSrc,
|
|
230
216
|
iconPosition: optionsIconPosition
|
|
231
|
-
}
|
|
217
|
+
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ListIcon, {
|
|
218
|
+
src: option.icon
|
|
219
|
+
}) : option.icon), optionsIconPosition === "before" && /*#__PURE__*/_react["default"].createElement("span", {
|
|
232
220
|
className: "optionLabel"
|
|
233
221
|
}, option.label));
|
|
234
222
|
})))));
|
|
@@ -265,7 +253,7 @@ var DXCDropdownContainer = _styledComponents["default"].div(_templateObject || (
|
|
|
265
253
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
266
254
|
});
|
|
267
255
|
|
|
268
|
-
var DXCMenu = (0, _styledComponents["default"])(_Popper["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n z-index: 1;\n\n .MuiMenuItem-gutters {\n width: ", ";\n }\n .MuiMenuItem-root {\n min-height: 36px;\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n height: auto;\n }\n .MuiPaper-root {\n min-width: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0px;\n border-top-right-radius: 0px;\n max-height: 230px;\n overflow-y: auto;\n\n ::-webkit-scrollbar {\n width: 3px;\n }\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n\n .MuiList-padding {\n padding-top: 0px;\n padding-bottom: 0px;\n }\n .MuiListItem-button {\n display: flex;\n
|
|
256
|
+
var DXCMenu = (0, _styledComponents["default"])(_Popper["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n z-index: 1;\n\n .MuiMenuItem-gutters {\n width: ", ";\n }\n .MuiMenuItem-root {\n min-height: 36px;\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n height: auto;\n }\n .MuiPaper-root {\n min-width: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0px;\n border-top-right-radius: 0px;\n max-height: 230px;\n overflow-y: auto;\n\n ::-webkit-scrollbar {\n width: 3px;\n }\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n\n .MuiList-padding {\n padding-top: 0px;\n padding-bottom: 0px;\n }\n .MuiListItem-button {\n display: flex;\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n cursor: pointer;\n }\n .MuiListItem-button:focus {\n outline: ", " solid 2px;\n outline-offset: -2px;\n }\n .MuiListItem-button:hover {\n background-color: ", ";\n }\n .MuiListItem-button:active {\n background-color: ", ";\n outline: ", " solid 2px;\n outline-offset: -2px;\n }\n }\n"])), function (props) {
|
|
269
257
|
return calculateWidth(props.margin, props.size);
|
|
270
258
|
}, function (props) {
|
|
271
259
|
return props.theme.optionPaddingTop;
|
|
@@ -291,10 +279,6 @@ var DXCMenu = (0, _styledComponents["default"])(_Popper["default"])(_templateObj
|
|
|
291
279
|
return props.theme.scrollBarTrackColor;
|
|
292
280
|
}, function (props) {
|
|
293
281
|
return props.theme.scrollBarThumbColor;
|
|
294
|
-
}, function (props) {
|
|
295
|
-
return props.optionsIconPosition === "after" && "row-reverse" || "row";
|
|
296
|
-
}, function (props) {
|
|
297
|
-
return props.optionsIconPosition === "after" && "flex-end" || "";
|
|
298
282
|
}, function (props) {
|
|
299
283
|
return props.theme.optionBackgroundColor;
|
|
300
284
|
}, function (props) {
|
|
@@ -359,21 +343,11 @@ var DropdownTrigger = _styledComponents["default"].button(_templateObject3 || (_
|
|
|
359
343
|
|
|
360
344
|
var DropdownTriggerLabel = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: left;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
361
345
|
|
|
362
|
-
var DropdownTriggerContainer = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n
|
|
363
|
-
return props.iconPosition === "after" && "row-reverse" || "row";
|
|
364
|
-
}, function (props) {
|
|
346
|
+
var DropdownTriggerContainer = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n margin-left: 0px;\n margin-right: 0px;\n width: ", ";\n white-space: nowrap;\n"])), function (props) {
|
|
365
347
|
return props.caretHidden ? "100%" : "calc(100% - 36px)";
|
|
366
348
|
});
|
|
367
349
|
|
|
368
|
-
var ButtonIcon = _styledComponents["default"].img(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["
|
|
369
|
-
return props.theme.buttonIconSize;
|
|
370
|
-
}, function (props) {
|
|
371
|
-
return props.theme.buttonIconSize;
|
|
372
|
-
}, function (props) {
|
|
373
|
-
return props.iconPosition === "after" && props.label !== "" && props.theme.buttonIconSpacing || "0px";
|
|
374
|
-
}, function (props) {
|
|
375
|
-
return props.iconPosition === "before" && props.label !== "" && props.theme.buttonIconSpacing || "0px";
|
|
376
|
-
});
|
|
350
|
+
var ButtonIcon = _styledComponents["default"].img(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
377
351
|
|
|
378
352
|
var ButtonIconContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n width: ", ";\n height: ", ";\n margin-left: ", ";\n margin-right: ", ";\n color: ", ";\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
379
353
|
return props.theme.buttonIconSize;
|
|
@@ -387,15 +361,7 @@ var ButtonIconContainer = _styledComponents["default"].div(_templateObject7 || (
|
|
|
387
361
|
return props.disabled ? props.theme.disabledColor : props.theme.buttonIconColor;
|
|
388
362
|
});
|
|
389
363
|
|
|
390
|
-
var ListIcon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["
|
|
391
|
-
return props.theme.optionIconSize;
|
|
392
|
-
}, function (props) {
|
|
393
|
-
return props.theme.optionIconSize;
|
|
394
|
-
}, function (props) {
|
|
395
|
-
return props.iconPosition === "after" && props.label !== "" && props.theme.optionIconSpacing || "0px";
|
|
396
|
-
}, function (props) {
|
|
397
|
-
return props.iconPosition === "before" && props.label !== "" && props.theme.optionIconSpacing || "0px";
|
|
398
|
-
});
|
|
364
|
+
var ListIcon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
399
365
|
|
|
400
366
|
var ListIconContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n width: ", ";\n height: ", ";\n margin-left: ", ";\n margin-right: ", ";\n color: ", ";\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
401
367
|
return props.theme.optionIconSize;
|
|
@@ -421,30 +387,5 @@ var CaretIconContainer = _styledComponents["default"].div(_templateObject10 || (
|
|
|
421
387
|
return props.theme.caretIconSize;
|
|
422
388
|
});
|
|
423
389
|
|
|
424
|
-
DxcDropdown.propTypes = {
|
|
425
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
426
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
427
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
428
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
429
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
430
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
431
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
432
|
-
optionsIconPosition: _propTypes["default"].oneOf(["after", "before", ""]),
|
|
433
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
434
|
-
iconSrc: _propTypes["default"].string,
|
|
435
|
-
iconPosition: _propTypes["default"].oneOf(["after", "before", ""]),
|
|
436
|
-
label: _propTypes["default"].string,
|
|
437
|
-
caretHidden: _propTypes["default"].bool,
|
|
438
|
-
disabled: _propTypes["default"].bool,
|
|
439
|
-
expandOnHover: _propTypes["default"].bool,
|
|
440
|
-
onSelectOption: _propTypes["default"].func,
|
|
441
|
-
options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
442
|
-
value: _propTypes["default"].any.isRequired,
|
|
443
|
-
label: _propTypes["default"].any.isRequired,
|
|
444
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
445
|
-
iconSrc: _propTypes["default"].string
|
|
446
|
-
})),
|
|
447
|
-
tabIndex: _propTypes["default"].number
|
|
448
|
-
};
|
|
449
390
|
var _default = DxcDropdown;
|
|
450
391
|
exports["default"] = _default;
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
|
+
import DxcDropdown from "./Dropdown";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Dropdown",
|
|
9
|
+
component: DxcDropdown,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const iconSVG = (
|
|
13
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
14
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
15
|
+
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const iconSVGLarge = (
|
|
20
|
+
<svg enableBackground="new 0 0 24 24" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
21
|
+
<g>
|
|
22
|
+
<path d="M0,0h24v24H0V0z" fill="none" />
|
|
23
|
+
<path d="M0,0h24v24H0V0z" fill="none" />
|
|
24
|
+
</g>
|
|
25
|
+
<g>
|
|
26
|
+
<path d="M12,17.27L18.18,21l-1.64-7.03L22,9.24l-7.19-0.61L12,2L9.19,8.63L2,9.24l5.46,4.73L5.82,21L12,17.27z" />
|
|
27
|
+
</g>
|
|
28
|
+
</svg>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const options: any = [
|
|
32
|
+
{
|
|
33
|
+
value: "1",
|
|
34
|
+
label: "Amazon with a very long text",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: "2",
|
|
38
|
+
label: "Ebay",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: "3",
|
|
42
|
+
label: "Apple",
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const option: any = [
|
|
47
|
+
{
|
|
48
|
+
value: "1",
|
|
49
|
+
label: "Ebay",
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const icons = [
|
|
54
|
+
iconSVG,
|
|
55
|
+
iconSVGLarge,
|
|
56
|
+
"https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
const optionsIcon: any = options.map((op, i) => ({ ...op, icon: icons[i] }));
|
|
60
|
+
|
|
61
|
+
export const Chromatic = () => (
|
|
62
|
+
<>
|
|
63
|
+
<ExampleContainer>
|
|
64
|
+
<Title title="Default" theme="light" level={4} />
|
|
65
|
+
<DxcDropdown label="Default" options={options} onSelectOption={(value) => {}} />
|
|
66
|
+
</ExampleContainer>
|
|
67
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
68
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
69
|
+
<DxcDropdown label="Hovered" options={options} onSelectOption={(value) => {}} />
|
|
70
|
+
</ExampleContainer>
|
|
71
|
+
<ExampleContainer pseudoState="pseudo-focus-visible">
|
|
72
|
+
<Title title="Focused" theme="light" level={4} />
|
|
73
|
+
<DxcDropdown label="Focused" options={options} onSelectOption={(value) => {}} />
|
|
74
|
+
</ExampleContainer>
|
|
75
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
76
|
+
<Title title="Actived" theme="light" level={4} />
|
|
77
|
+
<DxcDropdown label="Actived" options={options} onSelectOption={(value) => {}} />
|
|
78
|
+
</ExampleContainer>
|
|
79
|
+
<ExampleContainer>
|
|
80
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
81
|
+
<DxcDropdown label="Disabled" options={options} onSelectOption={(value) => {}} disabled />
|
|
82
|
+
</ExampleContainer>
|
|
83
|
+
<ExampleContainer>
|
|
84
|
+
<Title title="Caret hidden" theme="light" level={4} />
|
|
85
|
+
<DxcDropdown label="Caret hidden" options={options} onSelectOption={(value) => {}} caretHidden />
|
|
86
|
+
</ExampleContainer>
|
|
87
|
+
<ExampleContainer>
|
|
88
|
+
<Title title="With icon before" theme="light" level={4} />
|
|
89
|
+
<DxcDropdown label="Icon before" options={options} onSelectOption={(value) => {}} icon={iconSVG} />
|
|
90
|
+
</ExampleContainer>
|
|
91
|
+
<ExampleContainer>
|
|
92
|
+
<Title title="With icon after" theme="light" level={4} />
|
|
93
|
+
<DxcDropdown
|
|
94
|
+
label="Icon after"
|
|
95
|
+
options={options}
|
|
96
|
+
onSelectOption={(value) => {}}
|
|
97
|
+
icon="https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png"
|
|
98
|
+
iconPosition="after"
|
|
99
|
+
/>
|
|
100
|
+
</ExampleContainer>
|
|
101
|
+
<ExampleContainer>
|
|
102
|
+
<Title title="Only icon" theme="light" level={4} />
|
|
103
|
+
<DxcDropdown options={options} onSelectOption={(value) => {}} icon={iconSVG} />
|
|
104
|
+
</ExampleContainer>
|
|
105
|
+
<ExampleContainer>
|
|
106
|
+
<Title title="Large icon" theme="light" level={4} />
|
|
107
|
+
<DxcDropdown label="Large icon" options={options} onSelectOption={(value) => {}} icon={iconSVGLarge} />
|
|
108
|
+
</ExampleContainer>
|
|
109
|
+
<ExampleContainer>
|
|
110
|
+
<Title title="Disabled with icon" theme="light" level={4} />
|
|
111
|
+
<DxcDropdown
|
|
112
|
+
label="Disabled with icon"
|
|
113
|
+
options={options}
|
|
114
|
+
onSelectOption={(value) => {}}
|
|
115
|
+
icon={iconSVG}
|
|
116
|
+
disabled
|
|
117
|
+
/>
|
|
118
|
+
</ExampleContainer>
|
|
119
|
+
<ExampleContainer>
|
|
120
|
+
<Title title="Ellipsis" theme="light" level={4} />
|
|
121
|
+
<DxcDropdown
|
|
122
|
+
label="Very long text in dropdown button"
|
|
123
|
+
options={options}
|
|
124
|
+
onSelectOption={(value) => {}}
|
|
125
|
+
icon={iconSVG}
|
|
126
|
+
size="medium"
|
|
127
|
+
/>
|
|
128
|
+
</ExampleContainer>
|
|
129
|
+
<Title title="Margins" theme="light" level={2} />
|
|
130
|
+
<ExampleContainer>
|
|
131
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
132
|
+
<DxcDropdown label="Xxsmall" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xxsmall" />
|
|
133
|
+
</ExampleContainer>
|
|
134
|
+
<ExampleContainer>
|
|
135
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
136
|
+
<DxcDropdown label="Xsmall" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xsmall" />
|
|
137
|
+
</ExampleContainer>
|
|
138
|
+
<ExampleContainer>
|
|
139
|
+
<Title title="Small" theme="light" level={4} />
|
|
140
|
+
<DxcDropdown label="Small" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="small" />
|
|
141
|
+
</ExampleContainer>
|
|
142
|
+
<ExampleContainer>
|
|
143
|
+
<Title title="Medium" theme="light" level={4} />
|
|
144
|
+
<DxcDropdown label="Medium" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="medium" />
|
|
145
|
+
</ExampleContainer>
|
|
146
|
+
<ExampleContainer>
|
|
147
|
+
<Title title="Large" theme="light" level={4} />
|
|
148
|
+
<DxcDropdown label="Large" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="large" />
|
|
149
|
+
</ExampleContainer>
|
|
150
|
+
<ExampleContainer>
|
|
151
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
152
|
+
<DxcDropdown label="Xlarge" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xlarge" />
|
|
153
|
+
</ExampleContainer>
|
|
154
|
+
<ExampleContainer>
|
|
155
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
156
|
+
<DxcDropdown label="Xxlarge" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xxlarge" />
|
|
157
|
+
</ExampleContainer>
|
|
158
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
159
|
+
<ExampleContainer>
|
|
160
|
+
<Title title="Small" theme="light" level={4} />
|
|
161
|
+
<DxcDropdown label="Small" options={options} onSelectOption={(value) => {}} icon={iconSVG} size="small" />
|
|
162
|
+
</ExampleContainer>
|
|
163
|
+
<ExampleContainer>
|
|
164
|
+
<Title title="Medium" theme="light" level={4} />
|
|
165
|
+
<DxcDropdown label="Medium" options={options} onSelectOption={(value) => {}} icon={iconSVG} size="medium" />
|
|
166
|
+
</ExampleContainer>
|
|
167
|
+
<ExampleContainer>
|
|
168
|
+
<Title title="Large" theme="light" level={4} />
|
|
169
|
+
<DxcDropdown label="Large" options={options} onSelectOption={(value) => {}} icon={iconSVG} size="large" />
|
|
170
|
+
</ExampleContainer>
|
|
171
|
+
<ExampleContainer>
|
|
172
|
+
<Title title="FitContent" theme="light" level={4} />
|
|
173
|
+
<DxcDropdown
|
|
174
|
+
label="FitContent"
|
|
175
|
+
options={options}
|
|
176
|
+
onSelectOption={(value) => {}}
|
|
177
|
+
icon={iconSVG}
|
|
178
|
+
size="fitContent"
|
|
179
|
+
/>
|
|
180
|
+
</ExampleContainer>
|
|
181
|
+
<ExampleContainer>
|
|
182
|
+
<Title title="FillParent" theme="light" level={4} />
|
|
183
|
+
<DxcDropdown
|
|
184
|
+
label="FillParent"
|
|
185
|
+
options={options}
|
|
186
|
+
onSelectOption={(value) => {}}
|
|
187
|
+
icon={iconSVG}
|
|
188
|
+
size="fillParent"
|
|
189
|
+
/>
|
|
190
|
+
</ExampleContainer>
|
|
191
|
+
</>
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const DropdownWithOptions = () => (
|
|
195
|
+
<ExampleContainer expanded>
|
|
196
|
+
<Title title="Options" theme="light" level={4} />
|
|
197
|
+
<DxcDropdown label="Options with icon" options={optionsIcon} onSelectOption={(value) => {}} />
|
|
198
|
+
</ExampleContainer>
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
const DropdownHoverOption = () => (
|
|
202
|
+
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
203
|
+
<Title title="Hovered option" theme="light" level={4} />
|
|
204
|
+
<DxcDropdown label="Hovered options" options={option} onSelectOption={(value) => {}} />
|
|
205
|
+
</ExampleContainer>
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
const DropdownActiveOption = () => (
|
|
209
|
+
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
210
|
+
<Title title="Actived option" theme="light" level={4} />
|
|
211
|
+
<DxcDropdown label="Actived options" options={option} onSelectOption={(value) => {}} />
|
|
212
|
+
</ExampleContainer>
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
const DropdownWithOptionsIconAfter = () => (
|
|
216
|
+
<ExampleContainer expanded>
|
|
217
|
+
<Title title="Icon after options" theme="light" level={4} />
|
|
218
|
+
<DxcDropdown
|
|
219
|
+
label="Icon after options"
|
|
220
|
+
options={optionsIcon}
|
|
221
|
+
onSelectOption={(value) => {}}
|
|
222
|
+
optionsIconPosition="after"
|
|
223
|
+
/>
|
|
224
|
+
</ExampleContainer>
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
export const DropdownOptions = DropdownWithOptions.bind({});
|
|
228
|
+
DropdownOptions.play = async ({ canvasElement }) => {
|
|
229
|
+
const canvas = within(canvasElement);
|
|
230
|
+
await userEvent.click(canvas.getByRole("button"));
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export const DropdownHoveredOption = DropdownHoverOption.bind({});
|
|
234
|
+
DropdownHoveredOption.play = async ({ canvasElement }) => {
|
|
235
|
+
const canvas = within(canvasElement);
|
|
236
|
+
await userEvent.click(canvas.getByRole("button"));
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export const DropdownActivedOption = DropdownActiveOption.bind({});
|
|
240
|
+
DropdownActivedOption.play = async ({ canvasElement }) => {
|
|
241
|
+
const canvas = within(canvasElement);
|
|
242
|
+
await userEvent.click(canvas.getByRole("button"));
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export const DropdownOptionsIconAfter = DropdownWithOptionsIconAfter.bind({});
|
|
246
|
+
DropdownOptionsIconAfter.play = async ({ canvasElement }) => {
|
|
247
|
+
const canvas = within(canvasElement);
|
|
248
|
+
await userEvent.click(canvas.getByRole("button"));
|
|
249
|
+
};
|