@dxc-technology/halstack-react 0.0.0-80ae676 → 0.0.0-816f33d
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 +1 -0
- package/BackgroundColorContext.js +6 -26
- package/HalstackContext.d.ts +1248 -0
- package/HalstackContext.js +310 -0
- package/README.md +47 -0
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +106 -193
- package/accordion/Accordion.stories.tsx +241 -0
- package/accordion/Accordion.test.js +56 -0
- package/accordion/types.d.ts +12 -23
- package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
- package/accordion-group/AccordionGroup.d.ts +3 -3
- package/accordion-group/AccordionGroup.js +39 -108
- package/accordion-group/AccordionGroup.stories.tsx +252 -0
- package/accordion-group/AccordionGroup.test.js +98 -0
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +18 -23
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +48 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +41 -128
- package/alert/Alert.stories.tsx +198 -0
- package/alert/Alert.test.js +75 -0
- package/alert/types.d.ts +6 -6
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +142 -40
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +54 -0
- package/badge/types.js +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +43 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +32 -86
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +13 -0
- package/box/types.d.ts +3 -18
- package/bulleted-list/BulletedList.accessibility.test.js +119 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +92 -0
- package/bulleted-list/BulletedList.stories.tsx +115 -0
- package/bulleted-list/types.d.ts +38 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +65 -121
- package/button/Button.stories.tsx +310 -278
- package/button/Button.test.js +38 -0
- package/button/types.d.ts +14 -14
- package/card/Card.accessibility.test.js +36 -0
- package/card/Card.d.ts +1 -1
- package/card/Card.js +60 -104
- package/card/Card.stories.tsx +171 -0
- package/card/Card.test.js +39 -0
- package/card/types.d.ts +8 -15
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +144 -182
- package/checkbox/Checkbox.stories.tsx +166 -136
- package/checkbox/Checkbox.test.js +199 -0
- package/checkbox/types.d.ts +20 -8
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +51 -146
- package/chip/Chip.stories.tsx +199 -0
- package/chip/Chip.test.js +41 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1394 -0
- package/common/variables.js +1035 -1346
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/container/types.js +5 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +97 -0
- package/contextual-menu/ContextualMenu.d.ts +5 -0
- package/contextual-menu/ContextualMenu.js +88 -0
- package/contextual-menu/ContextualMenu.stories.tsx +232 -0
- package/contextual-menu/ContextualMenu.test.js +205 -0
- package/contextual-menu/GroupItem.d.ts +4 -0
- package/contextual-menu/GroupItem.js +67 -0
- package/contextual-menu/ItemAction.d.ts +4 -0
- package/contextual-menu/ItemAction.js +52 -0
- package/contextual-menu/MenuItem.d.ts +4 -0
- package/contextual-menu/MenuItem.js +29 -0
- package/contextual-menu/SingleItem.d.ts +4 -0
- package/contextual-menu/SingleItem.js +38 -0
- package/contextual-menu/types.d.ts +58 -0
- package/contextual-menu/types.js +5 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.accessibility.test.js +228 -0
- package/date-input/DateInput.js +174 -313
- package/date-input/DateInput.stories.tsx +210 -56
- package/date-input/DateInput.test.js +808 -0
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +121 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +86 -22
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +57 -129
- package/dialog/Dialog.stories.tsx +371 -0
- package/dialog/Dialog.test.js +307 -0
- package/dialog/types.d.ts +18 -25
- package/divider/Divider.accessibility.test.js +33 -0
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +223 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/divider/types.js +5 -0
- package/dropdown/Dropdown.accessibility.test.js +180 -0
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +234 -330
- package/dropdown/Dropdown.stories.tsx +427 -0
- package/dropdown/Dropdown.test.js +599 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +63 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +71 -0
- package/dropdown/types.d.ts +38 -31
- package/file-input/FileInput.accessibility.test.js +160 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +274 -363
- package/file-input/FileInput.stories.tsx +618 -0
- package/file-input/FileInput.test.js +382 -0
- package/file-input/FileItem.d.ts +4 -0
- package/file-input/FileItem.js +65 -133
- package/file-input/types.d.ts +129 -0
- package/file-input/types.js +5 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +112 -0
- package/flex/types.d.ts +97 -0
- package/flex/types.js +5 -0
- package/footer/Footer.accessibility.test.js +125 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +74 -200
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +96 -39
- package/footer/Footer.test.js +85 -0
- package/footer/Icons.d.ts +3 -0
- package/footer/Icons.js +54 -23
- package/footer/types.d.ts +41 -38
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/header/Header.accessibility.test.js +93 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +105 -219
- package/header/Header.stories.tsx +267 -0
- package/header/Header.test.js +66 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +5 -15
- package/header/types.d.ts +6 -18
- package/heading/Heading.accessibility.test.js +33 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +16 -55
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +169 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/icon/Icon.accessibility.test.js +30 -0
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.accessibility.test.js +56 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +129 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +43 -0
- package/inset/Inset.stories.tsx +230 -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 +88 -186
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +7 -0
- package/layout/Icons.js +41 -48
- package/layout/types.d.ts +41 -0
- package/layout/types.js +5 -0
- package/link/Link.accessibility.test.js +108 -0
- package/link/Link.d.ts +3 -2
- package/link/Link.js +65 -109
- package/link/Link.stories.tsx +201 -18
- package/link/Link.test.js +63 -0
- package/link/types.d.ts +15 -35
- package/main.d.ts +19 -14
- package/main.js +92 -98
- package/nav-tabs/NavTabs.accessibility.test.js +44 -0
- package/nav-tabs/NavTabs.d.ts +7 -0
- package/nav-tabs/NavTabs.js +93 -0
- package/nav-tabs/NavTabs.stories.tsx +279 -0
- package/nav-tabs/NavTabs.test.js +77 -0
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +117 -0
- package/nav-tabs/types.d.ts +52 -0
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +48 -90
- package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +44 -28
- package/number-input/NumberInput.test.js +989 -0
- package/number-input/NumberInputContext.d.ts +3 -0
- package/number-input/NumberInputContext.js +3 -11
- package/number-input/types.d.ts +136 -0
- package/number-input/types.js +5 -0
- package/package.json +52 -51
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.js +47 -107
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +335 -0
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +22 -0
- package/paragraph/Paragraph.stories.tsx +27 -0
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/password-input/PasswordInput.js +61 -126
- package/password-input/PasswordInput.stories.tsx +3 -35
- package/password-input/PasswordInput.test.js +198 -0
- package/password-input/types.d.ts +35 -24
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +69 -93
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.js +93 -0
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +94 -0
- package/quick-nav/QuickNav.stories.tsx +356 -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 +124 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +236 -0
- package/radio-group/RadioGroup.stories.tsx +214 -0
- package/radio-group/RadioGroup.test.js +756 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +285 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/resultset-table/ResultsetTable.js +171 -0
- package/resultset-table/ResultsetTable.stories.tsx +413 -0
- package/resultset-table/ResultsetTable.test.js +381 -0
- package/resultset-table/types.d.ts +100 -0
- package/resultset-table/types.js +5 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +155 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +89 -0
- package/select/Select.accessibility.test.js +228 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +252 -515
- package/select/Select.stories.tsx +919 -0
- package/select/Select.test.js +2265 -0
- package/select/types.d.ts +209 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +137 -81
- package/sidenav/Sidenav.stories.tsx +277 -0
- package/sidenav/Sidenav.test.js +37 -0
- package/sidenav/SidenavContext.d.ts +5 -0
- package/sidenav/SidenavContext.js +13 -0
- package/sidenav/types.d.ts +76 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.accessibility.test.js +104 -0
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +152 -183
- package/slider/Slider.test.js +254 -0
- package/slider/types.d.ts +11 -3
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.js +35 -75
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -26
- package/spinner/Spinner.test.js +55 -0
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.accessibility.test.js +157 -0
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.accessibility.test.js +98 -0
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +150 -115
- package/switch/Switch.stories.tsx +57 -68
- package/switch/Switch.test.js +180 -0
- package/switch/types.d.ts +13 -5
- package/table/DropdownTheme.js +62 -0
- package/table/Table.accessibility.test.js +93 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +80 -37
- package/table/Table.stories.tsx +663 -0
- package/table/Table.test.js +113 -0
- package/table/types.d.ts +34 -6
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +117 -0
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +307 -145
- package/tabs/Tabs.stories.tsx +230 -0
- package/tabs/Tabs.test.js +276 -0
- package/tabs/types.d.ts +48 -27
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +44 -86
- package/tag/Tag.stories.tsx +37 -30
- package/tag/Tag.test.js +41 -0
- package/tag/types.d.ts +25 -16
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +67 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +94 -0
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +340 -594
- package/text-input/TextInput.stories.tsx +474 -0
- package/text-input/TextInput.test.js +1756 -0
- package/text-input/types.d.ts +205 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +99 -181
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.js +406 -0
- package/textarea/types.d.ts +141 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +101 -142
- package/toggle-group/ToggleGroup.stories.tsx +218 -0
- package/toggle-group/ToggleGroup.test.js +137 -0
- package/toggle-group/types.d.ts +114 -0
- package/toggle-group/types.js +5 -0
- package/typography/Typography.accessibility.test.js +339 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +23 -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 +1147 -0
- package/useTheme.js +4 -11
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +14 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +124 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +122 -154
- package/wizard/Wizard.stories.tsx +272 -0
- package/wizard/Wizard.test.js +114 -0
- package/wizard/types.d.ts +64 -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/chip/index.d.ts +0 -22
- package/common/OpenSans.css +0 -81
- package/common/RequiredComponent.js +0 -32
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/file-input/index.d.ts +0 -81
- 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/number-input/index.d.ts +0 -113
- package/paginator/Icons.js +0 -66
- package/progress-bar/ProgressBar.stories.jsx +0 -58
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- package/resultsetTable/ResultsetTable.js +0 -274
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/sidenav/index.d.ts +0 -13
- package/slider/Slider.stories.tsx +0 -172
- package/table/Table.stories.jsx +0 -276
- package/text-input/index.d.ts +0 -135
- package/textarea/Textarea.stories.jsx +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/{radio → action-icon}/types.js +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
var _ActionIcon = _interopRequireDefault(require("./ActionIcon.tsx"));
|
|
7
|
+
var iconSVG = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
8
|
+
width: "24px",
|
|
9
|
+
height: "24px",
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "currentColor"
|
|
12
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
13
|
+
d: "M0 0h24v24H0z",
|
|
14
|
+
fill: "none"
|
|
15
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
16
|
+
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"
|
|
17
|
+
}));
|
|
18
|
+
describe("Action icon component tests", function () {
|
|
19
|
+
test("Action icon renders with correct text", function () {
|
|
20
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
21
|
+
icon: iconSVG,
|
|
22
|
+
title: "favourite"
|
|
23
|
+
})),
|
|
24
|
+
getByTitle = _render.getByTitle;
|
|
25
|
+
expect(getByTitle("favourite")).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
test("Calls correct function on click", function () {
|
|
28
|
+
var onClick = jest.fn();
|
|
29
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
30
|
+
icon: iconSVG,
|
|
31
|
+
title: "favourite",
|
|
32
|
+
onClick: onClick
|
|
33
|
+
})),
|
|
34
|
+
getByTitle = _render2.getByTitle;
|
|
35
|
+
var action = getByTitle("favourite");
|
|
36
|
+
_react2.fireEvent.click(action);
|
|
37
|
+
expect(onClick).toHaveBeenCalled();
|
|
38
|
+
});
|
|
39
|
+
test("On click is not called when disabled", function () {
|
|
40
|
+
var onClick = jest.fn();
|
|
41
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
42
|
+
disabled: true,
|
|
43
|
+
icon: iconSVG,
|
|
44
|
+
title: "favourite",
|
|
45
|
+
onClick: onClick
|
|
46
|
+
})),
|
|
47
|
+
getByTitle = _render3.getByTitle;
|
|
48
|
+
var action = getByTitle("favourite");
|
|
49
|
+
_react2.fireEvent.click(action);
|
|
50
|
+
expect(onClick).toHaveBeenCalledTimes(0);
|
|
51
|
+
});
|
|
52
|
+
test("Renders with correct accessibility attributes", function () {
|
|
53
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
54
|
+
icon: iconSVG,
|
|
55
|
+
title: "favourite",
|
|
56
|
+
tabIndex: 1
|
|
57
|
+
})),
|
|
58
|
+
getByRole = _render4.getByRole;
|
|
59
|
+
var button = getByRole("button");
|
|
60
|
+
expect(button.getAttribute("aria-label")).toBe("favourite");
|
|
61
|
+
expect(button.getAttribute("title")).toBe("favourite");
|
|
62
|
+
expect(button.getAttribute("tabindex")).toBe("1");
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
3
|
+
type Props = {
|
|
4
|
+
/**
|
|
5
|
+
* If true, the component will be disabled.
|
|
6
|
+
*/
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Value for the HTML properties title and aria-label.
|
|
10
|
+
*/
|
|
11
|
+
title: string;
|
|
12
|
+
/**
|
|
13
|
+
* Material Symbol name or SVG element as the icon that will be placed next to the label.
|
|
14
|
+
*/
|
|
15
|
+
icon: string | SVG;
|
|
16
|
+
/**
|
|
17
|
+
* This function will be called when the user clicks the button.
|
|
18
|
+
*/
|
|
19
|
+
onClick?: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Value of the tabindex attribute.
|
|
22
|
+
*/
|
|
23
|
+
tabIndex?: number;
|
|
24
|
+
};
|
|
25
|
+
export type RefType = HTMLButtonElement;
|
|
26
|
+
export default Props;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
|
+
var _Alert = _interopRequireDefault(require("./Alert.tsx"));
|
|
10
|
+
describe("Alert component accessibility tests", function () {
|
|
11
|
+
it("Should not have basic accessibility issues for confirm mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
12
|
+
var _render, container, results;
|
|
13
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
14
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15
|
+
case 0:
|
|
16
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Alert["default"], {
|
|
17
|
+
type: "confirm",
|
|
18
|
+
inlineText: "info-alert-text",
|
|
19
|
+
margin: "small"
|
|
20
|
+
})), container = _render.container;
|
|
21
|
+
_context.next = 3;
|
|
22
|
+
return (0, _axeHelper.axe)(container);
|
|
23
|
+
case 3:
|
|
24
|
+
results = _context.sent;
|
|
25
|
+
expect(results).toHaveNoViolations();
|
|
26
|
+
case 5:
|
|
27
|
+
case "end":
|
|
28
|
+
return _context.stop();
|
|
29
|
+
}
|
|
30
|
+
}, _callee);
|
|
31
|
+
})));
|
|
32
|
+
it("Should not have basic accessibility issues for error mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
33
|
+
var _render2, container, results;
|
|
34
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
35
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Alert["default"], {
|
|
38
|
+
type: "error",
|
|
39
|
+
inlineText: "info-alert-text",
|
|
40
|
+
margin: "small"
|
|
41
|
+
})), container = _render2.container;
|
|
42
|
+
_context2.next = 3;
|
|
43
|
+
return (0, _axeHelper.axe)(container);
|
|
44
|
+
case 3:
|
|
45
|
+
results = _context2.sent;
|
|
46
|
+
expect(results).toHaveNoViolations();
|
|
47
|
+
case 5:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context2.stop();
|
|
50
|
+
}
|
|
51
|
+
}, _callee2);
|
|
52
|
+
})));
|
|
53
|
+
it("Should not have basic accessibility issues for info mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
54
|
+
var _render3, container, results;
|
|
55
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
56
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
57
|
+
case 0:
|
|
58
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Alert["default"], {
|
|
59
|
+
type: "info",
|
|
60
|
+
inlineText: "info-alert-text",
|
|
61
|
+
margin: "small"
|
|
62
|
+
})), container = _render3.container;
|
|
63
|
+
_context3.next = 3;
|
|
64
|
+
return (0, _axeHelper.axe)(container);
|
|
65
|
+
case 3:
|
|
66
|
+
results = _context3.sent;
|
|
67
|
+
expect(results).toHaveNoViolations();
|
|
68
|
+
case 5:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context3.stop();
|
|
71
|
+
}
|
|
72
|
+
}, _callee3);
|
|
73
|
+
})));
|
|
74
|
+
it("Should not have basic accessibility issues for warning mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
75
|
+
var _render4, container, results;
|
|
76
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
77
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
_render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Alert["default"], {
|
|
80
|
+
type: "warning",
|
|
81
|
+
inlineText: "info-alert-text",
|
|
82
|
+
margin: "small"
|
|
83
|
+
})), container = _render4.container;
|
|
84
|
+
_context4.next = 3;
|
|
85
|
+
return (0, _axeHelper.axe)(container);
|
|
86
|
+
case 3:
|
|
87
|
+
results = _context4.sent;
|
|
88
|
+
expect(results).toHaveNoViolations();
|
|
89
|
+
case 5:
|
|
90
|
+
case "end":
|
|
91
|
+
return _context4.stop();
|
|
92
|
+
}
|
|
93
|
+
}, _callee4);
|
|
94
|
+
})));
|
|
95
|
+
});
|
package/alert/Alert.js
CHANGED
|
@@ -1,119 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
12
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
25
|
-
|
|
26
|
-
var _BackgroundColorContext = require("../BackgroundColorContext.js");
|
|
27
|
-
|
|
13
|
+
var _variables = require("../common/variables");
|
|
14
|
+
var _utils = require("../common/utils");
|
|
15
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
16
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
17
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
28
18
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
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; }
|
|
33
|
-
|
|
34
|
-
var alertIcons = {
|
|
35
|
-
close: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
36
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
37
|
-
width: "20",
|
|
38
|
-
height: "20",
|
|
39
|
-
viewBox: "0 0 24 24",
|
|
40
|
-
fill: "currentColor"
|
|
41
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
42
|
-
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
43
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
-
d: "M0 0h24v24H0z",
|
|
45
|
-
fill: "none"
|
|
46
|
-
})),
|
|
47
|
-
info: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
48
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
49
|
-
width: "23",
|
|
50
|
-
height: "23",
|
|
51
|
-
viewBox: "0 0 24 24",
|
|
52
|
-
fill: "currentColor"
|
|
53
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
54
|
-
d: "M0 0h24v24H0z",
|
|
55
|
-
fill: "none"
|
|
56
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
57
|
-
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"
|
|
58
|
-
})),
|
|
59
|
-
success: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
60
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
61
|
-
width: "23",
|
|
62
|
-
height: "23",
|
|
63
|
-
viewBox: "0 0 24 24",
|
|
64
|
-
fill: "currentColor"
|
|
65
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
66
|
-
d: "M0 0h24v24H0z",
|
|
67
|
-
fill: "none"
|
|
68
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
69
|
-
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
70
|
-
})),
|
|
71
|
-
warning: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
72
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
73
|
-
width: "23",
|
|
74
|
-
height: "23",
|
|
75
|
-
viewBox: "0 0 24 24",
|
|
76
|
-
fill: "currentColor"
|
|
77
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
78
|
-
d: "M0 0h24v24H0z",
|
|
79
|
-
fill: "none"
|
|
80
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
81
|
-
d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"
|
|
82
|
-
})),
|
|
83
|
-
error: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
84
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
85
|
-
width: "23",
|
|
86
|
-
height: "23",
|
|
87
|
-
viewBox: "0 0 24 24",
|
|
88
|
-
fill: "currentColor"
|
|
89
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
90
|
-
d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",
|
|
91
|
-
fill: "currentColor"
|
|
92
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
93
|
-
d: "M0 0h24v24H0z",
|
|
94
|
-
fill: "none"
|
|
95
|
-
}))
|
|
96
|
-
};
|
|
97
|
-
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
98
21
|
var DxcAlert = function DxcAlert(_ref) {
|
|
99
22
|
var _ref$type = _ref.type,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
23
|
+
type = _ref$type === void 0 ? "info" : _ref$type,
|
|
24
|
+
_ref$mode = _ref.mode,
|
|
25
|
+
mode = _ref$mode === void 0 ? "inline" : _ref$mode,
|
|
26
|
+
_ref$inlineText = _ref.inlineText,
|
|
27
|
+
inlineText = _ref$inlineText === void 0 ? "" : _ref$inlineText,
|
|
28
|
+
onClose = _ref.onClose,
|
|
29
|
+
children = _ref.children,
|
|
30
|
+
margin = _ref.margin,
|
|
31
|
+
_ref$size = _ref.size,
|
|
32
|
+
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
33
|
+
tabIndex = _ref.tabIndex;
|
|
111
34
|
var colorsTheme = (0, _useTheme["default"])();
|
|
112
|
-
|
|
35
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
113
36
|
var getTypeText = function getTypeText() {
|
|
114
|
-
return type === "info" ?
|
|
37
|
+
return type === "info" ? translatedLabels.alert.infoTitleText : type === "confirm" ? translatedLabels.alert.successTitleText : type === "warning" ? translatedLabels.alert.warningTitleText : translatedLabels.alert.errorTitleText;
|
|
115
38
|
};
|
|
116
|
-
|
|
117
39
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
118
40
|
theme: colorsTheme.alert
|
|
119
41
|
}, /*#__PURE__*/_react["default"].createElement(AlertModal, {
|
|
@@ -125,31 +47,37 @@ var DxcAlert = function DxcAlert(_ref) {
|
|
|
125
47
|
mode: mode,
|
|
126
48
|
type: type,
|
|
127
49
|
margin: margin,
|
|
128
|
-
size: size
|
|
50
|
+
size: size,
|
|
51
|
+
role: type === "error" ? "alert" : "status",
|
|
52
|
+
"aria-live": type === "error" ? "assertive" : "off"
|
|
129
53
|
}, /*#__PURE__*/_react["default"].createElement(AlertInfo, null, /*#__PURE__*/_react["default"].createElement(AlertIcon, {
|
|
130
54
|
type: type
|
|
131
|
-
}, type === "info" &&
|
|
132
|
-
|
|
133
|
-
}
|
|
55
|
+
}, type === "info" && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
56
|
+
icon: "filled_info"
|
|
57
|
+
}) || type === "confirm" && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
58
|
+
icon: "filled_check_circle"
|
|
59
|
+
}) || type === "warning" && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
60
|
+
icon: "filled_warning"
|
|
61
|
+
}) || type === "error" && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
62
|
+
icon: "filled_cancel"
|
|
63
|
+
})), /*#__PURE__*/_react["default"].createElement(AlertText, null, /*#__PURE__*/_react["default"].createElement(AlertTitle, null, getTypeText()), inlineText && inlineText !== "" && "-", /*#__PURE__*/_react["default"].createElement(AlertInlineText, null, inlineText)), onClose && /*#__PURE__*/_react["default"].createElement(AlertCloseAction, {
|
|
134
64
|
onClick: onClose,
|
|
135
|
-
tabIndex: tabIndex
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
65
|
+
tabIndex: tabIndex,
|
|
66
|
+
"aria-label": "Close alert"
|
|
67
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
68
|
+
icon: "close"
|
|
69
|
+
}))), children && /*#__PURE__*/_react["default"].createElement(AlertContent, null, children))));
|
|
139
70
|
};
|
|
140
|
-
|
|
141
71
|
var sizes = {
|
|
142
72
|
small: "280px",
|
|
143
73
|
medium: "480px",
|
|
144
74
|
large: "820px",
|
|
145
75
|
fillParent: "100%",
|
|
146
|
-
fitContent: "
|
|
76
|
+
fitContent: "fit-content"
|
|
147
77
|
};
|
|
148
|
-
|
|
149
78
|
var calculateWidth = function calculateWidth(margin, size) {
|
|
150
79
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
151
80
|
};
|
|
152
|
-
|
|
153
81
|
var AlertModal = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n width: ", ";\n height: ", ";\n justify-content: ", ";\n align-items: ", ";\n top: ", ";\n left: ", ";\n position: ", ";\n display: ", ";\n z-index: ", ";\n"])), function (props) {
|
|
154
82
|
return props.theme.fontSizeBase;
|
|
155
83
|
}, function (props) {
|
|
@@ -171,7 +99,6 @@ var AlertModal = _styledComponents["default"].div(_templateObject || (_templateO
|
|
|
171
99
|
}, function (props) {
|
|
172
100
|
return props.mode === "modal" ? "1200" : "";
|
|
173
101
|
});
|
|
174
|
-
|
|
175
102
|
var OverlayContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n position: ", ";\n top: ", ";\n bottom: ", ";\n left: ", ";\n right: ", ";\n"])), function (props) {
|
|
176
103
|
return props.mode === "modal" ? "".concat(props.theme.overlayColor) : "transparent";
|
|
177
104
|
}, function (props) {
|
|
@@ -185,7 +112,6 @@ var OverlayContainer = _styledComponents["default"].div(_templateObject2 || (_te
|
|
|
185
112
|
}, function (props) {
|
|
186
113
|
return props.mode === "modal" ? "0" : "";
|
|
187
114
|
});
|
|
188
|
-
|
|
189
115
|
var AlertContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n display: ", ";\n overflow: hidden;\n box-sizing: border-box;\n\n background-color: ", ";\n\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n\n padding-left: 12px;\n padding-right: 12px;\n justify-content: ", ";\n align-items: ", ";\n max-width: ", ";\n width: ", ";\n z-index: ", ";\n"])), function (props) {
|
|
190
116
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
191
117
|
}, function (props) {
|
|
@@ -219,11 +145,9 @@ var AlertContainer = _styledComponents["default"].div(_templateObject3 || (_temp
|
|
|
219
145
|
}, function (props) {
|
|
220
146
|
return props.mode === "modal" ? "1300" : "";
|
|
221
147
|
});
|
|
222
|
-
|
|
223
148
|
var AlertInfo = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n height: calc(48px - calc(", " * 2));\n align-items: center;\n width: 100%;\n"])), function (props) {
|
|
224
149
|
return props.theme.borderThickness;
|
|
225
150
|
});
|
|
226
|
-
|
|
227
151
|
var AlertTitle = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 8px;\n padding-right: ", ";\n padding-left: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n"])), function (props) {
|
|
228
152
|
return props.theme.titlePaddingRight;
|
|
229
153
|
}, function (props) {
|
|
@@ -241,7 +165,6 @@ var AlertTitle = _styledComponents["default"].div(_templateObject5 || (_template
|
|
|
241
165
|
}, function (props) {
|
|
242
166
|
return props.theme.titleTextTransform;
|
|
243
167
|
});
|
|
244
|
-
|
|
245
168
|
var AlertInlineText = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 8px;\n padding-right: ", ";\n padding-left: ", ";\n flex-grow: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n"])), function (props) {
|
|
246
169
|
return props.theme.inlineTextPaddingRight;
|
|
247
170
|
}, function (props) {
|
|
@@ -257,8 +180,7 @@ var AlertInlineText = _styledComponents["default"].div(_templateObject6 || (_tem
|
|
|
257
180
|
}, function (props) {
|
|
258
181
|
return props.theme.inlineTextFontColor;
|
|
259
182
|
});
|
|
260
|
-
|
|
261
|
-
var AlertIcon = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n margin-right: 12px;\n padding-right: ", ";\n padding-left: ", ";\n\n color: ", ";\n\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
|
|
183
|
+
var AlertIcon = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n margin-right: 12px;\n padding-right: ", ";\n padding-left: ", ";\n\n color: ", ";\n\n font-size: ", ";\n"])), function (props) {
|
|
262
184
|
return props.theme.iconPaddingRight;
|
|
263
185
|
}, function (props) {
|
|
264
186
|
return props.theme.iconPaddingLeft;
|
|
@@ -266,25 +188,16 @@ var AlertIcon = _styledComponents["default"].span(_templateObject7 || (_template
|
|
|
266
188
|
return props.type === "info" && props.theme.infoIconColor || props.type === "confirm" && props.theme.successIconColor || props.type === "warning" && props.theme.warningIconColor || props.type === "error" && props.theme.errorIconColor;
|
|
267
189
|
}, function (props) {
|
|
268
190
|
return props.theme.iconSize;
|
|
269
|
-
}, function (props) {
|
|
270
|
-
return props.theme.iconSize;
|
|
271
191
|
});
|
|
272
|
-
|
|
273
192
|
var AlertText = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n flex-grow: 1;\n align-items: center;\n overflow: hidden;\n"])));
|
|
274
|
-
|
|
275
193
|
var AlertContent = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n flex: 1 1 auto;\n padding: ", ";\n overflow-y: auto;\n"])), function (props) {
|
|
276
194
|
return "".concat(props.theme.contentPaddingTop, " ").concat(props.theme.contentPaddingRight, " ").concat(props.theme.contentPaddingBottom, " ").concat(props.theme.contentPaddingLeft);
|
|
277
195
|
});
|
|
278
|
-
|
|
279
|
-
var AlertCloseAction = _styledComponents["default"].button(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n border: 1px solid transparent;\n border-radius: 2px;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n margin-left: 12px;\n background-color: transparent;\n color: #000000;\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n }\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
196
|
+
var AlertCloseAction = _styledComponents["default"].button(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n font-size: 20px;\n border: 1px solid transparent;\n border-radius: 2px;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n margin-left: 12px;\n background-color: transparent;\n color: #000000;\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n }\n &:focus,\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
280
197
|
return props.theme.hoverActionBackgroundColor;
|
|
281
198
|
}, function (props) {
|
|
282
199
|
return props.theme.focusActionBorderColor;
|
|
283
|
-
}, function (props) {
|
|
284
|
-
return props.theme.focusActionBorderColor;
|
|
285
200
|
}, function (props) {
|
|
286
201
|
return props.theme.activeActionBackgroundColor;
|
|
287
202
|
});
|
|
288
|
-
|
|
289
|
-
var _default = DxcAlert;
|
|
290
|
-
exports["default"] = _default;
|
|
203
|
+
var _default = exports["default"] = DxcAlert;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcAlert from "./Alert";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Alert",
|
|
9
|
+
component: DxcAlert,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const opinionatedTheme = {
|
|
13
|
+
alert: {
|
|
14
|
+
baseColor: "#e6f4ff",
|
|
15
|
+
accentColor: "#0067b3",
|
|
16
|
+
overlayColor: "#000000b3",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const Chromatic = () => (
|
|
21
|
+
<>
|
|
22
|
+
<ExampleContainer>
|
|
23
|
+
<Title title="Info" theme="light" level={4} />
|
|
24
|
+
<DxcAlert inlineText="Info type alert with inline text." />
|
|
25
|
+
</ExampleContainer>
|
|
26
|
+
<ExampleContainer>
|
|
27
|
+
<Title title="Confirm" theme="light" level={4} />
|
|
28
|
+
<DxcAlert type="confirm" inlineText="Confirm type alert with inline text." />
|
|
29
|
+
</ExampleContainer>
|
|
30
|
+
<ExampleContainer>
|
|
31
|
+
<Title title="Warning" theme="light" level={4} />
|
|
32
|
+
<DxcAlert type="warning" inlineText="Warning type alert with inline text." />
|
|
33
|
+
</ExampleContainer>
|
|
34
|
+
<ExampleContainer>
|
|
35
|
+
<Title title="Error" theme="light" level={4} />
|
|
36
|
+
<DxcAlert type="error" inlineText="Error type alert with inline text." />
|
|
37
|
+
</ExampleContainer>
|
|
38
|
+
<ExampleContainer>
|
|
39
|
+
<Title title="With close button" theme="light" level={4} />
|
|
40
|
+
<DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
|
|
41
|
+
</ExampleContainer>
|
|
42
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
43
|
+
<Title title="With hovered close button" theme="light" level={4} />
|
|
44
|
+
<DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
|
|
45
|
+
</ExampleContainer>
|
|
46
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
47
|
+
<Title title="With focused close button" theme="light" level={4} />
|
|
48
|
+
<DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
|
|
49
|
+
</ExampleContainer>
|
|
50
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
51
|
+
<Title title="With actived close button" theme="light" level={4} />
|
|
52
|
+
<DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
|
|
53
|
+
</ExampleContainer>
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="With children" theme="light" level={4} />
|
|
56
|
+
<DxcAlert>
|
|
57
|
+
<div>
|
|
58
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
59
|
+
lobortis eget.
|
|
60
|
+
</div>
|
|
61
|
+
</DxcAlert>
|
|
62
|
+
</ExampleContainer>
|
|
63
|
+
<ExampleContainer>
|
|
64
|
+
<Title title="With inline text and children" theme="light" level={4} />
|
|
65
|
+
<DxcAlert inlineText="Info type alert with inline text.">
|
|
66
|
+
<div>
|
|
67
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
68
|
+
lobortis eget.
|
|
69
|
+
</div>
|
|
70
|
+
</DxcAlert>
|
|
71
|
+
</ExampleContainer>
|
|
72
|
+
<Title title="Margins" theme="light" level={2} />
|
|
73
|
+
<ExampleContainer>
|
|
74
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
75
|
+
<DxcAlert margin="xxsmall" inlineText="Info type alert with inline text and xxsmall margin." />
|
|
76
|
+
</ExampleContainer>
|
|
77
|
+
<ExampleContainer>
|
|
78
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
79
|
+
<DxcAlert margin="xsmall" inlineText="Info type alert with inline text and xsmall margin." />
|
|
80
|
+
</ExampleContainer>
|
|
81
|
+
<ExampleContainer>
|
|
82
|
+
<Title title="Small" theme="light" level={4} />
|
|
83
|
+
<DxcAlert margin="small" inlineText="Info type alert with inline text and small margin." />
|
|
84
|
+
</ExampleContainer>
|
|
85
|
+
<ExampleContainer>
|
|
86
|
+
<Title title="Medium" theme="light" level={4} />
|
|
87
|
+
<DxcAlert margin="medium" inlineText="Info type alert with inline text and medium margin." />
|
|
88
|
+
</ExampleContainer>
|
|
89
|
+
<ExampleContainer>
|
|
90
|
+
<Title title="Large" theme="light" level={4} />
|
|
91
|
+
<DxcAlert margin="large" inlineText="Info type alert with inline text and large margin." />
|
|
92
|
+
</ExampleContainer>
|
|
93
|
+
<ExampleContainer>
|
|
94
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
95
|
+
<DxcAlert margin="xlarge" inlineText="Info type alert with inline text and xlarge margin." />
|
|
96
|
+
</ExampleContainer>
|
|
97
|
+
<ExampleContainer>
|
|
98
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
99
|
+
<DxcAlert margin="xxlarge" inlineText="Info type alert with inline text and xxlarge margin." />
|
|
100
|
+
</ExampleContainer>
|
|
101
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
102
|
+
<ExampleContainer>
|
|
103
|
+
<Title title="FitContent" theme="light" level={4} />
|
|
104
|
+
<DxcAlert
|
|
105
|
+
size="fitContent"
|
|
106
|
+
inlineText="Info type alert with inline text, children, close button and fitContent size."
|
|
107
|
+
onClose={() => {}}
|
|
108
|
+
>
|
|
109
|
+
<div>
|
|
110
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
111
|
+
lobortis eget.
|
|
112
|
+
</div>
|
|
113
|
+
</DxcAlert>
|
|
114
|
+
</ExampleContainer>
|
|
115
|
+
<ExampleContainer>
|
|
116
|
+
<Title title="Small" theme="light" level={4} />
|
|
117
|
+
<DxcAlert
|
|
118
|
+
size="small"
|
|
119
|
+
inlineText="Info type alert with inline text, children, close button and small size."
|
|
120
|
+
onClose={() => {}}
|
|
121
|
+
>
|
|
122
|
+
<div>
|
|
123
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
124
|
+
lobortis eget.
|
|
125
|
+
</div>
|
|
126
|
+
</DxcAlert>
|
|
127
|
+
</ExampleContainer>
|
|
128
|
+
<ExampleContainer>
|
|
129
|
+
<Title title="Medium" theme="light" level={4} />
|
|
130
|
+
<DxcAlert
|
|
131
|
+
size="medium"
|
|
132
|
+
inlineText="Info type alert with inline text, children, close button and medium size."
|
|
133
|
+
onClose={() => {}}
|
|
134
|
+
>
|
|
135
|
+
<div>
|
|
136
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
137
|
+
lobortis eget.
|
|
138
|
+
</div>
|
|
139
|
+
</DxcAlert>
|
|
140
|
+
</ExampleContainer>
|
|
141
|
+
<ExampleContainer>
|
|
142
|
+
<Title title="Large" theme="light" level={4} />
|
|
143
|
+
<DxcAlert
|
|
144
|
+
size="large"
|
|
145
|
+
inlineText="Info type alert with inline text, children, close button and large size."
|
|
146
|
+
onClose={() => {}}
|
|
147
|
+
>
|
|
148
|
+
<div>
|
|
149
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
150
|
+
lobortis eget.
|
|
151
|
+
</div>
|
|
152
|
+
</DxcAlert>
|
|
153
|
+
</ExampleContainer>
|
|
154
|
+
<ExampleContainer>
|
|
155
|
+
<Title title="FillParent" theme="light" level={4} />
|
|
156
|
+
<DxcAlert
|
|
157
|
+
size="fillParent"
|
|
158
|
+
inlineText="Info type alert with inline text, children, close button and fillParent size."
|
|
159
|
+
onClose={() => {}}
|
|
160
|
+
>
|
|
161
|
+
<div>
|
|
162
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
163
|
+
lobortis eget.
|
|
164
|
+
</div>
|
|
165
|
+
</DxcAlert>
|
|
166
|
+
</ExampleContainer>
|
|
167
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
168
|
+
<ExampleContainer>
|
|
169
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
170
|
+
<DxcAlert inlineText="Info type alert with inline text." />
|
|
171
|
+
</HalstackProvider>
|
|
172
|
+
</ExampleContainer>
|
|
173
|
+
</>
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
export const ModalAlert = () => (
|
|
177
|
+
<ExampleContainer>
|
|
178
|
+
<DxcAlert inlineText="Modal alert." mode="modal" onClose={() => {}}>
|
|
179
|
+
<div>
|
|
180
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
181
|
+
lobortis eget.
|
|
182
|
+
</div>
|
|
183
|
+
</DxcAlert>
|
|
184
|
+
</ExampleContainer>
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
export const ModalAlertOpinionated = () => (
|
|
188
|
+
<ExampleContainer>
|
|
189
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
190
|
+
<DxcAlert inlineText="Modal alert." mode="modal" onClose={() => {}}>
|
|
191
|
+
<div>
|
|
192
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
193
|
+
lobortis eget.
|
|
194
|
+
</div>
|
|
195
|
+
</DxcAlert>
|
|
196
|
+
</HalstackProvider>
|
|
197
|
+
</ExampleContainer>
|
|
198
|
+
);
|