@dxc-technology/halstack-react 0.0.0-da90bf9 → 0.0.0-da9270d
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 +8 -24
- package/HalstackContext.d.ts +1235 -0
- package/HalstackContext.js +310 -0
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +120 -291
- package/accordion/Accordion.stories.tsx +283 -0
- package/accordion/Accordion.test.js +56 -0
- package/accordion/types.d.ts +57 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +8 -0
- package/accordion-group/AccordionGroup.js +57 -142
- 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/types.d.ts +67 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/alert/Alert.js +55 -204
- package/alert/Alert.stories.tsx +198 -0
- package/alert/Alert.test.js +75 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +15 -30
- package/badge/types.d.ts +5 -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.d.ts +4 -0
- package/box/Box.js +35 -116
- package/box/Box.stories.tsx +119 -0
- package/box/Box.test.js +13 -0
- package/box/types.d.ts +32 -0
- package/box/types.js +5 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +89 -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.d.ts +4 -0
- package/button/Button.js +67 -185
- package/button/Button.stories.tsx +344 -0
- package/button/Button.test.js +36 -0
- package/button/types.d.ts +57 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +60 -194
- package/card/Card.stories.tsx +171 -0
- package/card/Card.test.js +39 -0
- package/card/types.d.ts +62 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/checkbox/Checkbox.js +147 -231
- package/checkbox/Checkbox.stories.tsx +222 -0
- package/checkbox/Checkbox.test.js +199 -0
- package/checkbox/types.d.ts +72 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +50 -194
- package/chip/Chip.stories.tsx +214 -0
- package/chip/Chip.test.js +41 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/OpenSans.css +68 -80
- 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 +1381 -0
- package/common/variables.js +1006 -1319
- 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/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +179 -356
- package/date-input/DateInput.stories.tsx +285 -0
- package/date-input/DateInput.test.js +808 -0
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +115 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +58 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +164 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +70 -184
- package/dialog/Dialog.stories.tsx +365 -0
- package/dialog/Dialog.test.js +307 -0
- package/dialog/types.d.ts +36 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +247 -457
- package/dropdown/Dropdown.stories.tsx +438 -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 +67 -0
- package/dropdown/types.d.ts +98 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +297 -462
- package/file-input/FileInput.stories.tsx +618 -0
- package/file-input/FileInput.test.js +459 -0
- package/file-input/FileItem.d.ts +4 -0
- package/file-input/FileItem.js +61 -213
- 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.d.ts +4 -0
- package/footer/Footer.js +64 -360
- package/footer/Footer.stories.tsx +152 -0
- package/footer/Footer.test.js +85 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +16 -21
- package/footer/types.d.ts +58 -0
- package/footer/types.js +5 -0
- 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.d.ts +8 -0
- package/header/Header.js +122 -372
- package/header/Header.stories.tsx +251 -0
- package/header/Header.test.js +66 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +9 -39
- package/header/types.d.ts +33 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +31 -124
- 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/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +127 -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 +85 -278
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +8 -0
- package/layout/Icons.js +51 -48
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +13 -0
- package/layout/types.d.ts +41 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +4 -0
- package/link/Link.js +67 -189
- package/link/Link.stories.tsx +253 -0
- package/link/Link.test.js +63 -0
- package/link/types.d.ts +54 -0
- package/link/types.js +5 -0
- package/main.d.ts +46 -40
- package/main.js +117 -140
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +90 -0
- package/nav-tabs/NavTabs.stories.tsx +274 -0
- package/nav-tabs/NavTabs.test.js +75 -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.d.ts +11 -0
- package/number-input/NumberInput.js +32 -101
- package/number-input/NumberInput.stories.tsx +131 -0
- package/number-input/NumberInput.test.js +830 -0
- package/number-input/types.d.ts +130 -0
- package/number-input/types.js +5 -0
- package/package.json +53 -49
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +26 -52
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +41 -211
- package/paginator/Paginator.stories.tsx +87 -0
- package/paginator/Paginator.test.js +335 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +22 -0
- package/paragraph/Paragraph.stories.tsx +27 -0
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +66 -172
- package/password-input/PasswordInput.stories.tsx +99 -0
- package/password-input/PasswordInput.test.js +198 -0
- package/password-input/types.d.ts +111 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +76 -174
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.js +93 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +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.d.ts +4 -0
- package/radio-group/RadioGroup.js +235 -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.d.ts +4 -0
- package/resultset-table/ResultsetTable.js +159 -0
- package/resultset-table/ResultsetTable.stories.tsx +300 -0
- package/resultset-table/ResultsetTable.test.js +305 -0
- package/resultset-table/types.d.ts +67 -0
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +89 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +143 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +80 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +294 -849
- package/select/Select.stories.tsx +971 -0
- package/select/Select.test.js +2370 -0
- package/select/types.d.ts +209 -0
- package/select/types.js +5 -0
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +134 -117
- package/sidenav/Sidenav.stories.tsx +282 -0
- package/sidenav/Sidenav.test.js +37 -0
- package/sidenav/types.d.ts +76 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +172 -291
- package/slider/Slider.test.js +254 -0
- package/slider/types.d.ts +86 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +66 -241
- package/spinner/Spinner.stories.tsx +129 -0
- package/spinner/Spinner.test.js +55 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/switch/Switch.js +153 -161
- package/switch/Switch.stories.tsx +137 -0
- package/switch/Switch.test.js +180 -0
- package/switch/types.d.ts +66 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +14 -50
- package/table/Table.stories.tsx +356 -0
- package/table/Table.test.js +21 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +113 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +322 -281
- package/tabs/Tabs.stories.tsx +226 -0
- package/tabs/Tabs.test.js +294 -0
- package/tabs/types.d.ts +92 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +61 -192
- package/tag/Tag.stories.tsx +155 -0
- package/tag/Tag.test.js +49 -0
- package/tag/types.d.ts +69 -0
- package/tag/types.js +5 -0
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +56 -0
- 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 +84 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +360 -757
- package/text-input/TextInput.stories.tsx +465 -0
- package/text-input/TextInput.test.js +1739 -0
- package/text-input/types.d.ts +205 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +105 -240
- 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.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +107 -233
- 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.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 +1134 -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 +121 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +138 -293
- package/wizard/Wizard.stories.tsx +253 -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 -250
- package/V3Select/V3Select.js +0 -549
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -264
- package/V3Textarea/index.d.ts +0 -27
- package/accordion/index.d.ts +0 -28
- package/accordion-group/index.d.ts +0 -16
- package/alert/index.d.ts +0 -51
- package/box/index.d.ts +0 -25
- package/button/Button.stories.js +0 -27
- package/button/index.d.ts +0 -24
- package/card/index.d.ts +0 -22
- package/checkbox/index.d.ts +0 -24
- package/chip/index.d.ts +0 -22
- package/common/RequiredComponent.js +0 -40
- package/date/Date.js +0 -379
- package/date/index.d.ts +0 -27
- package/date-input/index.d.ts +0 -95
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/file-input/index.d.ts +0 -81
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/heading/index.d.ts +0 -17
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -705
- package/input-text/index.d.ts +0 -36
- package/link/index.d.ts +0 -23
- package/number-input/NumberInputContext.js +0 -16
- package/number-input/index.d.ts +0 -113
- package/paginator/index.d.ts +0 -20
- package/password-input/index.d.ts +0 -94
- package/progress-bar/index.d.ts +0 -18
- package/radio/Radio.js +0 -209
- package/radio/index.d.ts +0 -23
- package/resultsetTable/ResultsetTable.js +0 -358
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/switch/index.d.ts +0 -24
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -220
- package/toggle/index.d.ts +0 -21
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -205
- package/upload/buttons-upload/ButtonsUpload.js +0 -135
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -189
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -123
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -148
- package/upload/transactions/Transactions.js +0 -138
- package/wizard/Icons.js +0 -65
- package/wizard/index.d.ts +0 -18
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
type Margin = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
type Props = {
|
|
9
|
+
/**
|
|
10
|
+
* Text to be placed inside the spinner.
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The value of the progress indicator. If it's received the
|
|
15
|
+
* component is determinate, otherwise is indeterminate.
|
|
16
|
+
*/
|
|
17
|
+
value?: number;
|
|
18
|
+
/**
|
|
19
|
+
* If true, the value is displayed inside the spinner..
|
|
20
|
+
*/
|
|
21
|
+
showValue?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Available modes of the spinner.
|
|
24
|
+
*/
|
|
25
|
+
mode?: "large" | "small" | "overlay";
|
|
26
|
+
/**
|
|
27
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
28
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
29
|
+
*/
|
|
30
|
+
margin?: Space | Margin;
|
|
31
|
+
};
|
|
32
|
+
export default Props;
|
package/spinner/types.js
ADDED
package/switch/Switch.js
CHANGED
|
@@ -1,147 +1,165 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
4
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
-
|
|
16
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
-
|
|
18
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
-
|
|
20
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
|
|
22
13
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var checked = _ref.checked,
|
|
60
|
-
value = _ref.value,
|
|
61
|
-
label = _ref.label,
|
|
62
|
-
_ref$labelPosition = _ref.labelPosition,
|
|
63
|
-
labelPosition = _ref$labelPosition === void 0 ? "before" : _ref$labelPosition,
|
|
64
|
-
name = _ref.name,
|
|
65
|
-
_ref$disabled = _ref.disabled,
|
|
66
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
67
|
-
onChange = _ref.onChange,
|
|
68
|
-
_ref$required = _ref.required,
|
|
69
|
-
required = _ref$required === void 0 ? false : _ref$required,
|
|
70
|
-
margin = _ref.margin,
|
|
71
|
-
_ref$size = _ref.size,
|
|
72
|
-
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
73
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
74
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
75
|
-
|
|
76
|
-
var _useState = (0, _react.useState)(0),
|
|
77
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
78
|
-
innerChecked = _useState2[0],
|
|
79
|
-
setInnerChecked = _useState2[1];
|
|
80
|
-
|
|
14
|
+
var _uuid = require("uuid");
|
|
15
|
+
var _variables = require("../common/variables");
|
|
16
|
+
var _utils = require("../common/utils");
|
|
17
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
18
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
19
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
20
|
+
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); }
|
|
21
|
+
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 && Object.prototype.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; }
|
|
22
|
+
var DxcSwitch = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
23
|
+
var defaultChecked = _ref.defaultChecked,
|
|
24
|
+
checked = _ref.checked,
|
|
25
|
+
value = _ref.value,
|
|
26
|
+
_ref$label = _ref.label,
|
|
27
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
28
|
+
_ref$labelPosition = _ref.labelPosition,
|
|
29
|
+
labelPosition = _ref$labelPosition === void 0 ? "before" : _ref$labelPosition,
|
|
30
|
+
_ref$name = _ref.name,
|
|
31
|
+
name = _ref$name === void 0 ? "" : _ref$name,
|
|
32
|
+
_ref$disabled = _ref.disabled,
|
|
33
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
34
|
+
_ref$optional = _ref.optional,
|
|
35
|
+
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
36
|
+
onChange = _ref.onChange,
|
|
37
|
+
margin = _ref.margin,
|
|
38
|
+
_ref$size = _ref.size,
|
|
39
|
+
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
40
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
41
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
42
|
+
var _useState = (0, _react.useState)("switch-".concat((0, _uuid.v4)())),
|
|
43
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
44
|
+
switchId = _useState2[0];
|
|
45
|
+
var labelId = "label-".concat(switchId);
|
|
46
|
+
var _useState3 = (0, _react.useState)(defaultChecked !== null && defaultChecked !== void 0 ? defaultChecked : false),
|
|
47
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
48
|
+
innerChecked = _useState4[0],
|
|
49
|
+
setInnerChecked = _useState4[1];
|
|
81
50
|
var colorsTheme = (0, _useTheme["default"])();
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
51
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
52
|
+
var refTrack = (0, _react.useRef)(null);
|
|
53
|
+
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
54
|
+
switch (event.key) {
|
|
55
|
+
case "Enter":
|
|
56
|
+
case " ":
|
|
57
|
+
// Space
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
refTrack.current.focus();
|
|
60
|
+
var isChecked = !(checked !== null && checked !== void 0 ? checked : innerChecked);
|
|
61
|
+
setInnerChecked(isChecked);
|
|
62
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(isChecked);
|
|
63
|
+
break;
|
|
96
64
|
}
|
|
97
65
|
};
|
|
98
|
-
|
|
99
|
-
|
|
66
|
+
var handlerSwitchChange = function handlerSwitchChange(event) {
|
|
67
|
+
checked !== null && checked !== void 0 ? checked : setInnerChecked(function (innerChecked) {
|
|
68
|
+
return !innerChecked;
|
|
69
|
+
});
|
|
70
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(checked ? !checked : !innerChecked);
|
|
71
|
+
};
|
|
72
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
100
73
|
theme: colorsTheme["switch"]
|
|
101
|
-
}, _react["default"].createElement(SwitchContainer, {
|
|
74
|
+
}, /*#__PURE__*/_react["default"].createElement(SwitchContainer, {
|
|
102
75
|
margin: margin,
|
|
76
|
+
size: size,
|
|
77
|
+
onKeyDown: handleOnKeyDown,
|
|
103
78
|
disabled: disabled,
|
|
79
|
+
onClick: !disabled ? handlerSwitchChange : undefined,
|
|
80
|
+
ref: ref
|
|
81
|
+
}, labelPosition === "before" && label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
82
|
+
id: labelId,
|
|
104
83
|
labelPosition: labelPosition,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}, _react["default"].createElement(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
tabIndex: tabIndex
|
|
112
|
-
},
|
|
113
|
-
onChange: handlerSwitchChange,
|
|
84
|
+
disabled: disabled,
|
|
85
|
+
label: label
|
|
86
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, translatedLabels.formFields.optionalLabel)), /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
87
|
+
type: "checkbox",
|
|
88
|
+
name: name,
|
|
89
|
+
"aria-hidden": true,
|
|
114
90
|
value: value,
|
|
115
91
|
disabled: disabled,
|
|
116
|
-
|
|
117
|
-
|
|
92
|
+
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
93
|
+
readOnly: true
|
|
94
|
+
}), /*#__PURE__*/_react["default"].createElement(SwitchBase, null, /*#__PURE__*/_react["default"].createElement(SwitchTrack, {
|
|
95
|
+
role: "switch",
|
|
96
|
+
"aria-checked": checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
97
|
+
"aria-disabled": disabled,
|
|
98
|
+
disabled: disabled,
|
|
99
|
+
"aria-labelledby": labelId,
|
|
100
|
+
tabIndex: !disabled ? tabIndex : -1,
|
|
101
|
+
ref: refTrack
|
|
102
|
+
})), labelPosition === "after" && label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
103
|
+
id: labelId,
|
|
118
104
|
labelPosition: labelPosition,
|
|
119
|
-
onClick: disabled === true ? function () {} : handlerSwitchChange,
|
|
120
105
|
disabled: disabled,
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
|
|
106
|
+
label: label
|
|
107
|
+
}, optional && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, translatedLabels.formFields.optionalLabel), " ", label)));
|
|
108
|
+
});
|
|
125
109
|
var sizes = {
|
|
126
110
|
small: "60px",
|
|
127
111
|
medium: "240px",
|
|
128
112
|
large: "480px",
|
|
129
113
|
fillParent: "100%",
|
|
130
|
-
fitContent: "
|
|
114
|
+
fitContent: "fit-content"
|
|
131
115
|
};
|
|
132
|
-
|
|
133
116
|
var calculateWidth = function calculateWidth(margin, size) {
|
|
134
|
-
|
|
135
|
-
|
|
117
|
+
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
118
|
+
};
|
|
119
|
+
var getDisabledColor = function getDisabledColor(theme, element, subElement) {
|
|
120
|
+
switch (element) {
|
|
121
|
+
case "track":
|
|
122
|
+
switch (subElement) {
|
|
123
|
+
case "check":
|
|
124
|
+
return theme.disabledCheckedTrackBackgroundColor;
|
|
125
|
+
case "uncheck":
|
|
126
|
+
return theme.disabledUncheckedTrackBackgroundColor;
|
|
127
|
+
}
|
|
128
|
+
case "thumb":
|
|
129
|
+
switch (subElement) {
|
|
130
|
+
case "check":
|
|
131
|
+
return theme.disabledCheckedThumbBackgroundColor;
|
|
132
|
+
case "uncheck":
|
|
133
|
+
return theme.disabledUncheckedThumbBackgroundColor;
|
|
134
|
+
}
|
|
135
|
+
case "label":
|
|
136
|
+
return theme.disabledLabelFontColor;
|
|
136
137
|
}
|
|
137
|
-
|
|
138
|
-
return sizes[size];
|
|
139
138
|
};
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
var getNotDisabledColor = function getNotDisabledColor(theme, element, subElement) {
|
|
140
|
+
switch (element) {
|
|
141
|
+
case "track":
|
|
142
|
+
switch (subElement) {
|
|
143
|
+
case "check":
|
|
144
|
+
return theme.checkedTrackBackgroundColor;
|
|
145
|
+
case "uncheck":
|
|
146
|
+
return theme.uncheckedTrackBackgroundColor;
|
|
147
|
+
}
|
|
148
|
+
case "thumb":
|
|
149
|
+
switch (subElement) {
|
|
150
|
+
case "check":
|
|
151
|
+
return theme.checkedThumbBackgroundColor;
|
|
152
|
+
case "uncheck":
|
|
153
|
+
return theme.uncheckedThumbBackgroundColor;
|
|
154
|
+
}
|
|
155
|
+
case "label":
|
|
156
|
+
return theme.labelFontColor;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var SwitchContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n width: ", ";\n height: 40px;\n cursor: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
142
160
|
return calculateWidth(props.margin, props.size);
|
|
143
161
|
}, function (props) {
|
|
144
|
-
return props.
|
|
162
|
+
return props.disabled === true ? "not-allowed" : "pointer";
|
|
145
163
|
}, function (props) {
|
|
146
164
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
147
165
|
}, function (props) {
|
|
@@ -152,71 +170,45 @@ var SwitchContainer = _styledComponents["default"].div(_templateObject(), functi
|
|
|
152
170
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
153
171
|
}, function (props) {
|
|
154
172
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
173
|
+
});
|
|
174
|
+
var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: ", ";\n opacity: 1;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n\n ", ";\n\n ", "\n"])), function (props) {
|
|
175
|
+
return props.disabled ? getDisabledColor(props.theme, "label") : getNotDisabledColor(props.theme, "label");
|
|
155
176
|
}, function (props) {
|
|
156
|
-
return props.
|
|
157
|
-
}, function (props) {
|
|
158
|
-
return props.theme.trackWidth;
|
|
159
|
-
}, function (props) {
|
|
160
|
-
return "".concat(props.backgroundType === "dark" ? props.theme.thumbFocusColorOnDark : props.theme.thumbFocusColor, " solid 2px");
|
|
161
|
-
}, function (props) {
|
|
162
|
-
return props.backgroundType === "dark" ? props.theme.uncheckedTrackBackgroundColorOnDark : props.theme.uncheckedTrackBackgroundColor;
|
|
163
|
-
}, function (props) {
|
|
164
|
-
return props.theme.trackHeight;
|
|
165
|
-
}, function (props) {
|
|
166
|
-
return props.theme.thumbWidth;
|
|
177
|
+
return props.theme.labelFontFamily;
|
|
167
178
|
}, function (props) {
|
|
168
|
-
return props.theme.
|
|
179
|
+
return props.theme.labelFontSize;
|
|
169
180
|
}, function (props) {
|
|
170
|
-
return props.
|
|
181
|
+
return props.disabled ? props.theme.disabledLabelFontStyle : props.theme.labelFontStyle;
|
|
171
182
|
}, function (props) {
|
|
172
|
-
return props.
|
|
183
|
+
return props.theme.labelFontWeight;
|
|
173
184
|
}, function (props) {
|
|
174
|
-
return props.
|
|
185
|
+
return !props.label ? "margin: 0px;" : props.labelPosition === "after" ? "margin-left: ".concat(props.theme.spaceBetweenLabelSwitch, ";") : "margin-right: ".concat(props.theme.spaceBetweenLabelSwitch, ";");
|
|
175
186
|
}, function (props) {
|
|
176
|
-
return props.
|
|
187
|
+
return props.labelPosition === "before" && "order: -1";
|
|
188
|
+
});
|
|
189
|
+
var SwitchBase = _styledComponents["default"].label(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n margin: 0px 12px;\n"])));
|
|
190
|
+
var ValueInput = _styledComponents["default"].input(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: none;\n"])));
|
|
191
|
+
var SwitchTrack = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n border-radius: 15px;\n width: ", ";\n height: ", ";\n position: relative;\n cursor: ", ";\n\n &:focus-visible {\n outline: none;\n ::before {\n outline: ", ";\n outline-offset: 6px;\n }\n }\n\n /* Thumb element */\n ::before {\n content: \"\";\n transform: initial;\n position: absolute;\n width: ", ";\n height: ", ";\n border-radius: 50%;\n box-shadow: 0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%);\n bottom: -6px;\n left: -4px;\n transform: translateX(0px);\n background-color: ", ";\n }\n\n /* Unchecked */\n background-color: ", ";\n\n /* Checked */\n &[aria-checked=\"true\"] {\n background-color: ", ";\n ::before {\n transform: translateX(", ");\n background-color: ", ";\n }\n }\n"])), function (props) {
|
|
192
|
+
return props.theme.trackWidth;
|
|
177
193
|
}, function (props) {
|
|
178
|
-
return props.
|
|
194
|
+
return props.theme.trackHeight;
|
|
179
195
|
}, function (props) {
|
|
180
|
-
return props.
|
|
196
|
+
return props.disabled ? "not-allowed" : "pointer";
|
|
181
197
|
}, function (props) {
|
|
182
|
-
return props.theme.
|
|
198
|
+
return "".concat(props.theme.thumbFocusColor, " solid 2px");
|
|
183
199
|
}, function (props) {
|
|
184
|
-
return props.
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
var LabelContainer = _styledComponents["default"].span(_templateObject2(), function (props) {
|
|
188
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
200
|
+
return props.theme.thumbWidth;
|
|
189
201
|
}, function (props) {
|
|
190
|
-
return props.theme.
|
|
202
|
+
return props.theme.thumbHeight;
|
|
191
203
|
}, function (props) {
|
|
192
|
-
return props.theme.
|
|
204
|
+
return props.disabled ? getDisabledColor(props.theme, "thumb", "uncheck") : getNotDisabledColor(props.theme, "thumb", "uncheck");
|
|
193
205
|
}, function (props) {
|
|
194
|
-
return props.disabled ? props.theme
|
|
206
|
+
return props.disabled ? getDisabledColor(props.theme, "track", "uncheck") : getNotDisabledColor(props.theme, "track", "uncheck");
|
|
195
207
|
}, function (props) {
|
|
196
|
-
return props.theme.
|
|
208
|
+
return props.disabled ? getDisabledColor(props.theme, "track", "check") : getNotDisabledColor(props.theme, "track", "check");
|
|
197
209
|
}, function (props) {
|
|
198
|
-
return props.
|
|
210
|
+
return props.theme.thumbShift;
|
|
199
211
|
}, function (props) {
|
|
200
|
-
return props.
|
|
212
|
+
return props.disabled ? getDisabledColor(props.theme, "thumb", "check") : getNotDisabledColor(props.theme, "thumb", "check");
|
|
201
213
|
});
|
|
202
|
-
|
|
203
|
-
DxcSwitch.propTypes = {
|
|
204
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
205
|
-
checked: _propTypes["default"].bool,
|
|
206
|
-
value: _propTypes["default"].any,
|
|
207
|
-
label: _propTypes["default"].string,
|
|
208
|
-
labelPosition: _propTypes["default"].oneOf(["after", "before", ""]),
|
|
209
|
-
name: _propTypes["default"].string,
|
|
210
|
-
disabled: _propTypes["default"].bool,
|
|
211
|
-
onChange: _propTypes["default"].func,
|
|
212
|
-
required: _propTypes["default"].bool,
|
|
213
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
214
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
215
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
216
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
217
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
218
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
219
|
-
tabIndex: _propTypes["default"].number
|
|
220
|
-
};
|
|
221
|
-
var _default = DxcSwitch;
|
|
222
|
-
exports["default"] = _default;
|
|
214
|
+
var _default = exports["default"] = DxcSwitch;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcSwitch from "./Switch";
|
|
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: "Switch",
|
|
9
|
+
component: DxcSwitch,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const opinionatedTheme = {
|
|
13
|
+
switch: {
|
|
14
|
+
checkedBaseColor: "#5f249f",
|
|
15
|
+
fontColor: "#000000",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Chromatic = () => (
|
|
20
|
+
<>
|
|
21
|
+
<ExampleContainer>
|
|
22
|
+
<Title title="With label after" theme="light" level={4} />
|
|
23
|
+
<DxcSwitch label="Switch" labelPosition="after" />
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Without label" theme="light" level={4} />
|
|
27
|
+
<DxcSwitch />
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer pseudoState="pseudo-focus-visible">
|
|
30
|
+
<Title title="Focused" theme="light" level={4} />
|
|
31
|
+
<DxcSwitch label="Switch" labelPosition="after" />
|
|
32
|
+
</ExampleContainer>
|
|
33
|
+
<ExampleContainer>
|
|
34
|
+
<Title title="Checked" theme="light" level={4} />
|
|
35
|
+
<DxcSwitch label="Switch" defaultChecked />
|
|
36
|
+
</ExampleContainer>
|
|
37
|
+
<ExampleContainer>
|
|
38
|
+
<Title title="Optional" theme="light" level={4} />
|
|
39
|
+
<DxcSwitch label="Switch" optional />
|
|
40
|
+
</ExampleContainer>
|
|
41
|
+
<ExampleContainer>
|
|
42
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
43
|
+
<DxcSwitch label="Switch" disabled />
|
|
44
|
+
</ExampleContainer>
|
|
45
|
+
<ExampleContainer>
|
|
46
|
+
<Title title="Disabled optional" theme="light" level={4} />
|
|
47
|
+
<DxcSwitch label="Switch" disabled optional labelPosition="after" />
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<ExampleContainer>
|
|
50
|
+
<Title title="Disabled checked" theme="light" level={4} />
|
|
51
|
+
<DxcSwitch label="Switch" disabled defaultChecked labelPosition="after" />
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
<Title title="Margins" theme="light" level={2} />
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
56
|
+
<DxcSwitch label="Xxsmall" margin="xxsmall" />
|
|
57
|
+
</ExampleContainer>
|
|
58
|
+
<ExampleContainer>
|
|
59
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
60
|
+
<DxcSwitch label="Xsmall" margin="xsmall" />
|
|
61
|
+
</ExampleContainer>
|
|
62
|
+
<ExampleContainer>
|
|
63
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
64
|
+
<DxcSwitch label="Small" margin="small" />
|
|
65
|
+
</ExampleContainer>
|
|
66
|
+
<ExampleContainer>
|
|
67
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
68
|
+
<DxcSwitch label="Medium" margin="medium" />
|
|
69
|
+
</ExampleContainer>
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
72
|
+
<DxcSwitch label="Large" margin="large" />
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
76
|
+
<DxcSwitch label="Xlarge" margin="xlarge" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer>
|
|
79
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
80
|
+
<DxcSwitch label="Xxlarge" margin="xxlarge" />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
83
|
+
<ExampleContainer>
|
|
84
|
+
<Title title="Small size" theme="light" level={4} />
|
|
85
|
+
<DxcSwitch label="Small" size="small" />
|
|
86
|
+
</ExampleContainer>
|
|
87
|
+
<ExampleContainer>
|
|
88
|
+
<Title title="Medium size (with large label)" theme="light" level={4} />
|
|
89
|
+
<DxcSwitch label="Very very very large label or even huge" size="medium" />
|
|
90
|
+
</ExampleContainer>
|
|
91
|
+
<ExampleContainer>
|
|
92
|
+
<Title title="Medium size (with long label)" theme="light" level={4} />
|
|
93
|
+
<DxcSwitch
|
|
94
|
+
label="Large texttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"
|
|
95
|
+
labelPosition="after"
|
|
96
|
+
size="medium"
|
|
97
|
+
/>
|
|
98
|
+
</ExampleContainer>
|
|
99
|
+
<ExampleContainer>
|
|
100
|
+
<Title title="Large size" theme="light" level={4} />
|
|
101
|
+
<DxcSwitch label="Large" size="large" />
|
|
102
|
+
</ExampleContainer>
|
|
103
|
+
<ExampleContainer>
|
|
104
|
+
<Title title="FillParent size" theme="light" level={4} />
|
|
105
|
+
<DxcSwitch label="FillParent" size="fillParent" />
|
|
106
|
+
</ExampleContainer>
|
|
107
|
+
<ExampleContainer>
|
|
108
|
+
<Title title="FitContent size" theme="light" level={4} />
|
|
109
|
+
<DxcSwitch label="FitContent" size="fitContent" />
|
|
110
|
+
</ExampleContainer>
|
|
111
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
112
|
+
<ExampleContainer>
|
|
113
|
+
<Title title="Checked" theme="light" level={4} />
|
|
114
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
115
|
+
<DxcSwitch label="Switch" defaultChecked />
|
|
116
|
+
</HalstackProvider>
|
|
117
|
+
</ExampleContainer>
|
|
118
|
+
<ExampleContainer>
|
|
119
|
+
<Title title="Default" theme="light" level={4} />
|
|
120
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
121
|
+
<DxcSwitch label="Switch" />
|
|
122
|
+
</HalstackProvider>
|
|
123
|
+
</ExampleContainer>
|
|
124
|
+
<ExampleContainer>
|
|
125
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
126
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
127
|
+
<DxcSwitch label="Switch" disabled />
|
|
128
|
+
</HalstackProvider>
|
|
129
|
+
</ExampleContainer>
|
|
130
|
+
<ExampleContainer>
|
|
131
|
+
<Title title="Disabled checked" theme="light" level={4} />
|
|
132
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
133
|
+
<DxcSwitch label="Switch" disabled defaultChecked />
|
|
134
|
+
</HalstackProvider>
|
|
135
|
+
</ExampleContainer>
|
|
136
|
+
</>
|
|
137
|
+
);
|