@dxc-technology/halstack-react 0.0.0-fed0950 → 0.0.0-ff43881
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 +47 -0
- package/ThemeContext.d.ts +15 -0
- package/ThemeContext.js +243 -0
- package/V3Select/V3Select.js +455 -0
- package/V3Select/index.d.ts +27 -0
- package/V3Textarea/V3Textarea.js +260 -0
- package/V3Textarea/index.d.ts +27 -0
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +247 -0
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/types.d.ts +64 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +170 -0
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +68 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/alert/Alert.js +290 -0
- package/alert/Alert.stories.tsx +170 -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 +59 -0
- 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.d.ts +4 -0
- package/box/Box.js +126 -0
- package/box/Box.stories.tsx +132 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/button/Button.js +171 -0
- package/button/Button.stories.tsx +274 -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 +164 -0
- package/card/Card.stories.tsx +201 -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 +253 -0
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +60 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +161 -0
- package/chip/Chip.stories.tsx +119 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/{dist/common → common}/OpenSans.css +0 -0
- package/common/RequiredComponent.js +32 -0
- package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/{dist/common → common}/utils.js +0 -0
- package/common/variables.js +1611 -0
- package/{dist/date → date}/Date.js +121 -90
- package/date/index.d.ts +27 -0
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +358 -0
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/types.d.ts +100 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +166 -0
- package/dialog/Dialog.stories.tsx +212 -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 +395 -0
- package/dropdown/Dropdown.stories.tsx +249 -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 +590 -0
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +184 -0
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +258 -0
- package/footer/Footer.stories.tsx +130 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +77 -0
- package/footer/types.d.ts +65 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +324 -0
- package/header/Header.stories.tsx +162 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +34 -0
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +159 -0
- package/heading/Heading.stories.tsx +54 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/input-text/Icons.js +22 -0
- package/input-text/InputText.js +611 -0
- package/input-text/index.d.ts +36 -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 +231 -0
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/Icons.js +55 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +153 -0
- package/link/Link.stories.tsx +151 -0
- package/link/types.d.ts +70 -0
- package/link/types.js +5 -0
- 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 +51 -0
- package/{dist/main.js → main.js} +197 -41
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +83 -0
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/{dist/ThemeContext.js → number-input/NumberInputContext.js} +6 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +44 -24
- package/paginator/Icons.js +66 -0
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +192 -0
- package/paginator/Paginator.stories.tsx +63 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +163 -0
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/types.d.ts +107 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +170 -0
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.d.ts +4 -0
- package/radio/Radio.js +174 -0
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +54 -0
- package/radio/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +140 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +273 -0
- package/radio-group/RadioGroup.stories.tsx +79 -0
- package/radio-group/RadioGroup.test.js +248 -0
- package/radio-group/types.d.ts +36 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +254 -0
- package/resultsetTable/ResultsetTable.stories.tsx +275 -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/Select.d.ts +4 -0
- package/select/Select.js +863 -0
- package/select/Select.stories.tsx +572 -0
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +136 -0
- package/sidenav/Sidenav.stories.tsx +182 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +317 -0
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +250 -0
- package/spinner/Spinner.stories.jsx +103 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -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.d.ts +4 -0
- package/switch/Switch.js +179 -0
- package/switch/Switch.stories.tsx +160 -0
- package/switch/types.d.ts +58 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +118 -0
- package/table/Table.stories.jsx +277 -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 +213 -0
- package/tabs/Tabs.stories.tsx +120 -0
- package/tabs/types.d.ts +78 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +188 -0
- package/tag/Tag.stories.tsx +138 -0
- package/tag/types.d.ts +69 -0
- package/tag/types.js +5 -0
- 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 +794 -0
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +159 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +284 -0
- package/textarea/Textarea.stories.jsx +136 -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 +214 -0
- package/toggle-group/ToggleGroup.stories.tsx +173 -0
- package/toggle-group/types.d.ts +97 -0
- package/toggle-group/types.js +5 -0
- package/{dist/upload → upload}/Upload.js +23 -22
- package/upload/buttons-upload/ButtonsUpload.js +111 -0
- package/upload/buttons-upload/Icons.js +40 -0
- package/upload/dragAndDropArea/DragAndDropArea.js +225 -0
- package/upload/dragAndDropArea/Icons.js +39 -0
- package/upload/file-upload/FileToUpload.js +115 -0
- package/upload/file-upload/Icons.js +66 -0
- package/upload/files-upload/FilesToUpload.js +109 -0
- package/upload/index.d.ts +15 -0
- package/upload/transaction/Icons.js +160 -0
- package/upload/transaction/Transaction.js +104 -0
- package/upload/transactions/Transactions.js +94 -0
- package/useTheme.d.ts +2 -0
- package/useTheme.js +22 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +281 -0
- package/wizard/Wizard.stories.tsx +224 -0
- package/wizard/types.d.ts +60 -0
- package/wizard/types.js +5 -0
- package/babel.config.js +0 -4
- package/dist/accordion/Accordion.js +0 -264
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/alert/Alert.js +0 -302
- package/dist/alert/Alert.stories.js +0 -158
- package/dist/alert/close.svg +0 -4
- package/dist/alert/error.svg +0 -4
- package/dist/alert/info.svg +0 -4
- package/dist/alert/readme.md +0 -43
- package/dist/alert/success.svg +0 -4
- package/dist/alert/warning.svg +0 -4
- package/dist/box/Box.js +0 -136
- package/dist/button/Button.js +0 -187
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/card/Card.js +0 -246
- package/dist/checkbox/Checkbox.js +0 -221
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/chip/Chip.js +0 -170
- package/dist/common/RequiredComponent.js +0 -50
- package/dist/common/services/example-service.js +0 -10
- package/dist/common/services/example-service.test.js +0 -12
- package/dist/common/variables.js +0 -77
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/calendar.svg +0 -1
- package/dist/date/calendar_dark.svg +0 -1
- package/dist/date/readme.md +0 -73
- package/dist/dialog/Dialog.js +0 -164
- package/dist/dialog/Dialog.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- package/dist/dropdown/Dropdown.js +0 -412
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- package/dist/footer/Footer.js +0 -341
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo_wht.png +0 -0
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.js +0 -343
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.png +0 -0
- package/dist/header/dxc_logo_white.png +0 -0
- package/dist/header/hamb_menu_black.svg +0 -1
- package/dist/header/hamb_menu_white.svg +0 -1
- package/dist/header/readme.md +0 -33
- package/dist/heading/Heading.js +0 -159
- package/dist/input-text/InputText.js +0 -510
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/input-text/error.svg +0 -1
- package/dist/input-text/readme.md +0 -91
- package/dist/link/Link.js +0 -129
- package/dist/link/readme.md +0 -51
- package/dist/paginator/Paginator.js +0 -178
- package/dist/paginator/images/next.svg +0 -3
- package/dist/paginator/images/nextPage.svg +0 -3
- package/dist/paginator/images/previous.svg +0 -3
- package/dist/paginator/images/previousPage.svg +0 -3
- package/dist/paginator/readme.md +0 -50
- package/dist/progress-bar/ProgressBar.js +0 -189
- package/dist/progress-bar/ProgressBar.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.js +0 -204
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- package/dist/resultsetTable/ResultsetTable.js +0 -334
- package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
- package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
- package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
- package/dist/select/Select.js +0 -425
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/sidenav/Sidenav.js +0 -217
- package/dist/sidenav/arrow_icon.svg +0 -3
- package/dist/slider/Slider.js +0 -268
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.js +0 -196
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.js +0 -219
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/table/Table.js +0 -84
- package/dist/tabs/Tabs.js +0 -183
- package/dist/tabs/Tabs.stories.js +0 -130
- package/dist/tabs/readme.md +0 -78
- package/dist/tabs-for-sections/TabsForSections.js +0 -107
- package/dist/tabs-for-sections/readme.md +0 -78
- package/dist/tag/Tag.js +0 -217
- package/dist/textarea/Textarea.js +0 -226
- package/dist/toggle/Toggle.js +0 -223
- package/dist/toggle/Toggle.stories.js +0 -297
- package/dist/toggle/readme.md +0 -80
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/buttons-upload/ButtonsUpload.js +0 -125
- package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
- package/dist/upload/buttons-upload/upload-button.svg +0 -1
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -282
- package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
- package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
- package/dist/upload/file-upload/FileToUpload.js +0 -158
- package/dist/upload/file-upload/audio-icon.svg +0 -4
- package/dist/upload/file-upload/close.svg +0 -4
- package/dist/upload/file-upload/file-icon.svg +0 -4
- package/dist/upload/file-upload/video-icon.svg +0 -4
- package/dist/upload/files-upload/FilesToUpload.js +0 -123
- package/dist/upload/readme.md +0 -37
- package/dist/upload/transaction/Transaction.js +0 -155
- package/dist/upload/transaction/audio-icon-err.svg +0 -4
- package/dist/upload/transaction/audio-icon.svg +0 -4
- package/dist/upload/transaction/error-icon.svg +0 -4
- package/dist/upload/transaction/file-icon-err.svg +0 -4
- package/dist/upload/transaction/file-icon.svg +0 -4
- package/dist/upload/transaction/image-icon-err.svg +0 -4
- package/dist/upload/transaction/image-icon.svg +0 -4
- package/dist/upload/transaction/success-icon.svg +0 -4
- package/dist/upload/transaction/video-icon-err.svg +0 -4
- package/dist/upload/transaction/video-icon.svg +0 -4
- package/dist/upload/transactions/Transactions.js +0 -120
- package/dist/wizard/Wizard.js +0 -310
- package/dist/wizard/invalid_icon.svg +0 -6
- package/dist/wizard/valid_icon.svg +0 -6
- package/dist/wizard/validation-wrong.svg +0 -6
- package/test/Accordion.test.js +0 -33
- package/test/Alert.test.js +0 -53
- package/test/Box.test.js +0 -10
- package/test/Button.test.js +0 -18
- package/test/Card.test.js +0 -30
- package/test/Checkbox.test.js +0 -45
- package/test/Chip.test.js +0 -25
- package/test/Date.test.js +0 -393
- package/test/Dialog.test.js +0 -23
- package/test/Dropdown.test.js +0 -130
- package/test/Footer.test.js +0 -99
- package/test/Header.test.js +0 -39
- package/test/Heading.test.js +0 -35
- package/test/InputText.test.js +0 -236
- package/test/Link.test.js +0 -25
- package/test/Paginator.test.js +0 -165
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -282
- package/test/Select.test.js +0 -191
- package/test/Sidenav.test.js +0 -87
- package/test/Slider.test.js +0 -65
- package/test/Spinner.test.js +0 -27
- package/test/Switch.test.js +0 -45
- package/test/Table.test.js +0 -36
- package/test/Tabs.test.js +0 -88
- package/test/TabsForSections.test.js +0 -34
- package/test/Tag.test.js +0 -32
- package/test/TextArea.test.js +0 -52
- package/test/Toggle.test.js +0 -43
- package/test/Upload.test.js +0 -60
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
+
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
|
+
|
|
22
|
+
var _Popper = _interopRequireDefault(require("@material-ui/core/Popper"));
|
|
23
|
+
|
|
24
|
+
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
25
|
+
|
|
26
|
+
var _core = require("@material-ui/core");
|
|
27
|
+
|
|
28
|
+
var _Grow = _interopRequireDefault(require("@material-ui/core/Grow"));
|
|
29
|
+
|
|
30
|
+
var _Paper = _interopRequireDefault(require("@material-ui/core/Paper"));
|
|
31
|
+
|
|
32
|
+
var _MenuList = _interopRequireDefault(require("@material-ui/core/MenuList"));
|
|
33
|
+
|
|
34
|
+
var _variables = require("../common/variables.js");
|
|
35
|
+
|
|
36
|
+
var _utils = require("../common/utils.js");
|
|
37
|
+
|
|
38
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
39
|
+
|
|
40
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
41
|
+
|
|
42
|
+
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); }
|
|
43
|
+
|
|
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; }
|
|
45
|
+
|
|
46
|
+
var DxcDropdown = function DxcDropdown(_ref) {
|
|
47
|
+
var options = _ref.options,
|
|
48
|
+
_ref$optionsIconPosit = _ref.optionsIconPosition,
|
|
49
|
+
optionsIconPosition = _ref$optionsIconPosit === void 0 ? "before" : _ref$optionsIconPosit,
|
|
50
|
+
icon = _ref.icon,
|
|
51
|
+
_ref$iconPosition = _ref.iconPosition,
|
|
52
|
+
iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
|
|
53
|
+
_ref$label = _ref.label,
|
|
54
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
55
|
+
_ref$caretHidden = _ref.caretHidden,
|
|
56
|
+
caretHidden = _ref$caretHidden === void 0 ? false : _ref$caretHidden,
|
|
57
|
+
onSelectOption = _ref.onSelectOption,
|
|
58
|
+
_ref$expandOnHover = _ref.expandOnHover,
|
|
59
|
+
expandOnHover = _ref$expandOnHover === void 0 ? false : _ref$expandOnHover,
|
|
60
|
+
margin = _ref.margin,
|
|
61
|
+
_ref$size = _ref.size,
|
|
62
|
+
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
63
|
+
_ref$tabIndex = _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;
|
|
67
|
+
|
|
68
|
+
var _useState = (0, _react.useState)(),
|
|
69
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
70
|
+
width = _useState2[0],
|
|
71
|
+
setWidth = _useState2[1];
|
|
72
|
+
|
|
73
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
74
|
+
var ref = (0, _react.useRef)(null);
|
|
75
|
+
|
|
76
|
+
var handleResize = function handleResize() {
|
|
77
|
+
if (ref.current) setWidth(ref.current.offsetWidth);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
(0, _react.useEffect)(function () {
|
|
81
|
+
if (ref.current) {
|
|
82
|
+
ref.current.addEventListener("resize", handleResize);
|
|
83
|
+
handleResize();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return function () {
|
|
87
|
+
if (ref.current) ref.current.removeEventListener("resize", handleResize);
|
|
88
|
+
};
|
|
89
|
+
}, []);
|
|
90
|
+
|
|
91
|
+
var _useState3 = (0, _react.useState)(null),
|
|
92
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
93
|
+
anchorEl = _useState4[0],
|
|
94
|
+
setAnchorEl = _useState4[1];
|
|
95
|
+
|
|
96
|
+
function handleClickListItem(event) {
|
|
97
|
+
setAnchorEl(event.currentTarget);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function handleMenuItemClick(option) {
|
|
101
|
+
setAnchorEl(null);
|
|
102
|
+
onSelectOption(option.value);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function handleClose() {
|
|
106
|
+
setAnchorEl(null);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var handleCloseOver = expandOnHover ? handleClose : undefined;
|
|
110
|
+
|
|
111
|
+
var UpArrowIcon = function UpArrowIcon() {
|
|
112
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
113
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
114
|
+
width: "24",
|
|
115
|
+
height: "24",
|
|
116
|
+
viewBox: "0 0 24 24",
|
|
117
|
+
fill: "currentColor"
|
|
118
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
119
|
+
d: "M7 14l5-5 5 5z"
|
|
120
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
121
|
+
d: "M0 0h24v24H0z",
|
|
122
|
+
fill: "none"
|
|
123
|
+
}));
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var DownArrowIcon = function DownArrowIcon() {
|
|
127
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
128
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
129
|
+
width: "24",
|
|
130
|
+
height: "24",
|
|
131
|
+
viewBox: "0 0 24 24",
|
|
132
|
+
fill: "currentColor"
|
|
133
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
134
|
+
d: "M7 10l5 5 5-5z"
|
|
135
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
136
|
+
d: "M0 0h24v24H0z",
|
|
137
|
+
fill: "none"
|
|
138
|
+
}));
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
142
|
+
theme: colorsTheme.dropdown
|
|
143
|
+
}, /*#__PURE__*/_react["default"].createElement(DXCDropdownContainer, {
|
|
144
|
+
margin: margin,
|
|
145
|
+
size: size,
|
|
146
|
+
disabled: disabled
|
|
147
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
148
|
+
onMouseOver: expandOnHover && !disabled ? handleClickListItem : undefined,
|
|
149
|
+
onMouseOut: handleCloseOver,
|
|
150
|
+
onFocus: handleCloseOver,
|
|
151
|
+
onBlur: handleCloseOver
|
|
152
|
+
}, /*#__PURE__*/_react["default"].createElement(DropdownTrigger, {
|
|
153
|
+
opened: anchorEl === null ? false : true,
|
|
154
|
+
onClick: handleClickListItem,
|
|
155
|
+
disabled: disabled,
|
|
156
|
+
label: label,
|
|
157
|
+
caretHidden: caretHidden,
|
|
158
|
+
margin: margin,
|
|
159
|
+
size: size,
|
|
160
|
+
ref: ref,
|
|
161
|
+
tabIndex: tabIndex
|
|
162
|
+
}, /*#__PURE__*/_react["default"].createElement(DropdownTriggerContainer, {
|
|
163
|
+
iconPosition: iconPosition,
|
|
164
|
+
caretHidden: caretHidden
|
|
165
|
+
}, icon && /*#__PURE__*/_react["default"].createElement(ButtonIconContainer, {
|
|
166
|
+
label: label,
|
|
167
|
+
iconPosition: iconPosition,
|
|
168
|
+
disabled: disabled
|
|
169
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
|
|
170
|
+
src: icon
|
|
171
|
+
}) : icon), /*#__PURE__*/_react["default"].createElement(DropdownTriggerLabel, {
|
|
172
|
+
iconPosition: iconPosition,
|
|
173
|
+
label: label
|
|
174
|
+
}, label)), /*#__PURE__*/_react["default"].createElement(CaretIconContainer, {
|
|
175
|
+
caretHidden: caretHidden,
|
|
176
|
+
disabled: disabled
|
|
177
|
+
}, !caretHidden && (anchorEl === null ? /*#__PURE__*/_react["default"].createElement(DownArrowIcon, null) : /*#__PURE__*/_react["default"].createElement(UpArrowIcon, null)))), /*#__PURE__*/_react["default"].createElement(DXCMenu, {
|
|
178
|
+
anchorEl: anchorEl,
|
|
179
|
+
open: Boolean(anchorEl),
|
|
180
|
+
onClose: handleClose,
|
|
181
|
+
getContentAnchorEl: null,
|
|
182
|
+
anchorOrigin: {
|
|
183
|
+
vertical: "bottom",
|
|
184
|
+
horizontal: "left"
|
|
185
|
+
},
|
|
186
|
+
transformOrigin: {
|
|
187
|
+
vertical: "top",
|
|
188
|
+
horizontal: "left"
|
|
189
|
+
},
|
|
190
|
+
optionsIconPosition: optionsIconPosition,
|
|
191
|
+
size: size,
|
|
192
|
+
width: width,
|
|
193
|
+
role: undefined,
|
|
194
|
+
transition: true,
|
|
195
|
+
disablePortal: true,
|
|
196
|
+
placement: "bottom-start"
|
|
197
|
+
}, function (_ref2) {
|
|
198
|
+
var TransitionProps = _ref2.TransitionProps;
|
|
199
|
+
return /*#__PURE__*/_react["default"].createElement(_Grow["default"], TransitionProps, /*#__PURE__*/_react["default"].createElement(_Paper["default"], null, /*#__PURE__*/_react["default"].createElement(_core.ClickAwayListener, {
|
|
200
|
+
onClickAway: handleClose
|
|
201
|
+
}, /*#__PURE__*/_react["default"].createElement(_MenuList["default"], {
|
|
202
|
+
autoFocusItem: Boolean(anchorEl),
|
|
203
|
+
id: "menu-list-grow"
|
|
204
|
+
}, options.map(function (option) {
|
|
205
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
206
|
+
key: option.value,
|
|
207
|
+
value: option.value,
|
|
208
|
+
disableRipple: true,
|
|
209
|
+
onClick: function onClick(event) {
|
|
210
|
+
return handleMenuItemClick(option);
|
|
211
|
+
}
|
|
212
|
+
}, option.icon && /*#__PURE__*/_react["default"].createElement(ListIconContainer, {
|
|
213
|
+
label: option.label,
|
|
214
|
+
iconPosition: optionsIconPosition
|
|
215
|
+
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ListIcon, {
|
|
216
|
+
src: option.icon
|
|
217
|
+
}) : option.icon), /*#__PURE__*/_react["default"].createElement("span", {
|
|
218
|
+
className: "optionLabel"
|
|
219
|
+
}, option.label));
|
|
220
|
+
})))));
|
|
221
|
+
}))));
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
var sizes = {
|
|
225
|
+
small: "60px",
|
|
226
|
+
medium: "240px",
|
|
227
|
+
large: "480px",
|
|
228
|
+
fillParent: "100%",
|
|
229
|
+
fitContent: "unset"
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
var calculateWidth = function calculateWidth(margin, size) {
|
|
233
|
+
if (size === "fillParent") {
|
|
234
|
+
return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return sizes[size];
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
var DXCDropdownContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n display: inline-block;\n"])), function (props) {
|
|
241
|
+
return calculateWidth(props.margin, props.size);
|
|
242
|
+
}, function (props) {
|
|
243
|
+
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
244
|
+
}, function (props) {
|
|
245
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
246
|
+
}, function (props) {
|
|
247
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
248
|
+
}, function (props) {
|
|
249
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
250
|
+
}, function (props) {
|
|
251
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
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 flex-direction: ", ";\n justify-content: ", ";\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) {
|
|
255
|
+
return calculateWidth(props.margin, props.size);
|
|
256
|
+
}, function (props) {
|
|
257
|
+
return props.theme.optionPaddingTop;
|
|
258
|
+
}, function (props) {
|
|
259
|
+
return props.theme.optionPaddingBottom;
|
|
260
|
+
}, function (props) {
|
|
261
|
+
return props.theme.optionPaddingLeft;
|
|
262
|
+
}, function (props) {
|
|
263
|
+
return props.theme.optionPaddingRight;
|
|
264
|
+
}, function (props) {
|
|
265
|
+
return "".concat(props.width, "px");
|
|
266
|
+
}, function (props) {
|
|
267
|
+
return props.theme.borderThickness;
|
|
268
|
+
}, function (props) {
|
|
269
|
+
return props.theme.borderStyle;
|
|
270
|
+
}, function (props) {
|
|
271
|
+
return props.theme.borderColor;
|
|
272
|
+
}, function (props) {
|
|
273
|
+
return props.theme.borderRadius;
|
|
274
|
+
}, function (props) {
|
|
275
|
+
return props.theme.borderRadius;
|
|
276
|
+
}, function (props) {
|
|
277
|
+
return props.theme.scrollBarTrackColor;
|
|
278
|
+
}, function (props) {
|
|
279
|
+
return props.theme.scrollBarThumbColor;
|
|
280
|
+
}, function (props) {
|
|
281
|
+
return props.optionsIconPosition === "after" && "row-reverse" || "row";
|
|
282
|
+
}, function (props) {
|
|
283
|
+
return props.optionsIconPosition === "after" && "flex-end" || "";
|
|
284
|
+
}, function (props) {
|
|
285
|
+
return props.theme.optionBackgroundColor;
|
|
286
|
+
}, function (props) {
|
|
287
|
+
return props.theme.optionFontFamily;
|
|
288
|
+
}, function (props) {
|
|
289
|
+
return props.theme.optionFontSize;
|
|
290
|
+
}, function (props) {
|
|
291
|
+
return props.theme.optionFontStyle;
|
|
292
|
+
}, function (props) {
|
|
293
|
+
return props.theme.optionFontWeight;
|
|
294
|
+
}, function (props) {
|
|
295
|
+
return props.theme.optionFontColor;
|
|
296
|
+
}, function (props) {
|
|
297
|
+
return props.theme.focusColor;
|
|
298
|
+
}, function (props) {
|
|
299
|
+
return props.theme.hoverOptionBackgroundColor;
|
|
300
|
+
}, function (props) {
|
|
301
|
+
return props.theme.activeOptionBackgroundColor;
|
|
302
|
+
}, function (props) {
|
|
303
|
+
return props.theme.focusColor;
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
var DropdownTrigger = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n height: auto;\n min-height: 40px;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n min-width: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n background-color: ", ";\n color: ", ";\n border-bottom-right-radius: ", ";\n border-bottom-left-radius: ", ";\n\n ", ";\n"])), function (props) {
|
|
307
|
+
return props.disabled ? "not-allowed" : "pointer";
|
|
308
|
+
}, function (props) {
|
|
309
|
+
return props.theme.buttonFontFamily;
|
|
310
|
+
}, function (props) {
|
|
311
|
+
return props.theme.buttonFontSize;
|
|
312
|
+
}, function (props) {
|
|
313
|
+
return props.theme.buttonFontStyle;
|
|
314
|
+
}, function (props) {
|
|
315
|
+
return props.theme.buttonFontWeight;
|
|
316
|
+
}, function (props) {
|
|
317
|
+
return props.theme.borderRadius;
|
|
318
|
+
}, function (props) {
|
|
319
|
+
return props.theme.borderThickness;
|
|
320
|
+
}, function (props) {
|
|
321
|
+
return props.theme.borderStyle;
|
|
322
|
+
}, function (props) {
|
|
323
|
+
return props.disabled ? props.theme.disabledBorderColor : props.theme.borderColor;
|
|
324
|
+
}, function (props) {
|
|
325
|
+
return props.label === "" ? "0px" : calculateWidth(props.margin, props.size);
|
|
326
|
+
}, function (props) {
|
|
327
|
+
return props.theme.buttonPaddingTop;
|
|
328
|
+
}, function (props) {
|
|
329
|
+
return props.theme.buttonPaddingBottom;
|
|
330
|
+
}, function (props) {
|
|
331
|
+
return props.theme.buttonPaddingLeft;
|
|
332
|
+
}, function (props) {
|
|
333
|
+
return props.theme.buttonPaddingRight;
|
|
334
|
+
}, function (props) {
|
|
335
|
+
return props.disabled ? props.theme.disabledButtonBackgroundColor : props.theme.buttonBackgroundColor;
|
|
336
|
+
}, function (props) {
|
|
337
|
+
return props.disabled ? props.theme.disabledColor : props.theme.buttonFontColor;
|
|
338
|
+
}, function (props) {
|
|
339
|
+
return props.opened ? "0px" : props.theme.borderRadius;
|
|
340
|
+
}, function (props) {
|
|
341
|
+
return props.opened ? "0px" : props.theme.borderRadius;
|
|
342
|
+
}, function (props) {
|
|
343
|
+
return !props.disabled && " \n &:focus {\n outline: none;\n }\n &:focus-visible {\n outline: ".concat(props.theme.focusColor, " solid 2px;\n outline-offset: -2px;\n }\n &:hover {\n background-color: ").concat(props.theme.hoverButtonBackgroundColor, ";\n }\n &:active {\n background-color: ").concat(props.theme.activeButtonBackgroundColor, ";\n }\n ");
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
var DropdownTriggerLabel = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: left;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
347
|
+
|
|
348
|
+
var DropdownTriggerContainer = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n flex-direction: ", ";\n margin-left: 0px;\n margin-right: 0px;\n width: ", ";\n white-space: nowrap;\n"])), function (props) {
|
|
349
|
+
return props.iconPosition === "after" && "row-reverse" || "row";
|
|
350
|
+
}, function (props) {
|
|
351
|
+
return props.caretHidden ? "100%" : "calc(100% - 36px)";
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
var ButtonIcon = _styledComponents["default"].img(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
355
|
+
|
|
356
|
+
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) {
|
|
357
|
+
return props.theme.buttonIconSize;
|
|
358
|
+
}, function (props) {
|
|
359
|
+
return props.theme.buttonIconSize;
|
|
360
|
+
}, function (props) {
|
|
361
|
+
return props.iconPosition === "after" && props.label !== "" && props.theme.buttonIconSpacing || "0px";
|
|
362
|
+
}, function (props) {
|
|
363
|
+
return props.iconPosition === "before" && props.label !== "" && props.theme.buttonIconSpacing || "0px";
|
|
364
|
+
}, function (props) {
|
|
365
|
+
return props.disabled ? props.theme.disabledColor : props.theme.buttonIconColor;
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
var ListIcon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
369
|
+
|
|
370
|
+
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) {
|
|
371
|
+
return props.theme.optionIconSize;
|
|
372
|
+
}, function (props) {
|
|
373
|
+
return props.theme.optionIconSize;
|
|
374
|
+
}, function (props) {
|
|
375
|
+
return props.iconPosition === "after" && props.label !== "" && props.theme.optionIconSpacing || "0px";
|
|
376
|
+
}, function (props) {
|
|
377
|
+
return props.iconPosition === "before" && props.label !== "" && props.theme.optionIconSpacing || "0px";
|
|
378
|
+
}, function (props) {
|
|
379
|
+
return props.theme.optionIconColor;
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
var CaretIconContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n margin-left: ", ";\n color: ", ";\n\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
|
|
383
|
+
return props.caretHidden ? "none" : "inline-flex";
|
|
384
|
+
}, function (props) {
|
|
385
|
+
return props.theme.caretIconSpacing;
|
|
386
|
+
}, function (props) {
|
|
387
|
+
return props.disabled ? props.theme.disabledColor : props.theme.caretIconColor;
|
|
388
|
+
}, function (props) {
|
|
389
|
+
return props.theme.caretIconSize;
|
|
390
|
+
}, function (props) {
|
|
391
|
+
return props.theme.caretIconSize;
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
var _default = DxcDropdown;
|
|
395
|
+
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 enable-background="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
|
+
};
|