@dxc-technology/halstack-react 0.0.0-da224ae → 0.0.0-da4b2be
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +2 -5
- package/HalstackContext.d.ts +1336 -0
- package/HalstackContext.js +335 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +118 -142
- package/accordion/Accordion.stories.tsx +395 -0
- package/accordion/Accordion.test.js +71 -0
- package/accordion/types.d.ts +9 -8
- package/accordion-group/AccordionGroup.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +34 -76
- package/accordion-group/AccordionGroup.stories.tsx +251 -0
- package/accordion-group/AccordionGroup.test.js +126 -0
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +15 -8
- package/alert/Alert.js +11 -12
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +92 -0
- package/alert/types.d.ts +1 -1
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +6 -4
- package/badge/types.d.ts +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +51 -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 +1 -1
- package/box/Box.js +23 -55
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +18 -0
- package/box/types.d.ts +0 -15
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +125 -0
- package/bulleted-list/BulletedList.stories.tsx +206 -0
- package/bulleted-list/types.d.ts +38 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +61 -85
- package/button/Button.stories.tsx +163 -14
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +8 -12
- package/card/Card.js +35 -40
- package/card/Card.stories.tsx +200 -0
- package/card/Card.test.js +50 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +5 -6
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +108 -111
- package/checkbox/Checkbox.stories.tsx +198 -130
- package/checkbox/Checkbox.test.js +155 -0
- package/checkbox/types.d.ts +13 -5
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +37 -118
- package/chip/Chip.stories.tsx +123 -30
- package/chip/Chip.test.js +54 -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 +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1482 -0
- package/common/variables.js +1100 -1316
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +174 -266
- package/date-input/DateInput.stories.tsx +199 -33
- package/date-input/DateInput.test.js +835 -0
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +67 -9
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +69 -103
- package/dialog/Dialog.stories.tsx +154 -171
- package/dialog/Dialog.test.js +369 -0
- package/dialog/types.d.ts +0 -12
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +248 -277
- package/dropdown/Dropdown.stories.tsx +438 -0
- package/dropdown/Dropdown.test.js +586 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +74 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +79 -0
- package/dropdown/types.d.ts +28 -17
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +183 -168
- package/file-input/FileInput.stories.tsx +618 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.d.ts +4 -0
- package/file-input/FileItem.js +50 -81
- 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 +71 -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 +1 -1
- package/footer/Footer.js +34 -117
- package/footer/Footer.stories.tsx +228 -0
- package/footer/Footer.test.js +97 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +4 -4
- package/footer/types.d.ts +23 -18
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -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 +3 -2
- package/header/Header.js +110 -131
- package/header/Header.stories.tsx +315 -0
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +2 -2
- package/header/types.d.ts +5 -2
- package/heading/Heading.js +2 -2
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +186 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +51 -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 +72 -136
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +41 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -2
- package/link/Link.js +64 -89
- package/link/Link.stories.tsx +199 -16
- package/link/Link.test.js +81 -0
- package/link/types.d.ts +7 -27
- package/main.d.ts +13 -12
- package/main.js +68 -54
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +122 -0
- package/nav-tabs/NavTabs.stories.tsx +274 -0
- package/nav-tabs/NavTabs.test.js +82 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +146 -0
- package/nav-tabs/types.d.ts +52 -0
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.js +14 -24
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +542 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +22 -23
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +22 -57
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +318 -0
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.js +23 -19
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/PasswordInput.test.js +181 -0
- package/password-input/types.d.ts +29 -19
- package/progress-bar/ProgressBar.js +63 -57
- package/progress-bar/ProgressBar.stories.jsx +47 -12
- package/progress-bar/ProgressBar.test.js +110 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +117 -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 +156 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +281 -0
- package/radio-group/RadioGroup.stories.tsx +214 -0
- package/radio-group/RadioGroup.test.js +722 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +54 -133
- package/resultsetTable/ResultsetTable.stories.tsx +300 -0
- package/resultsetTable/ResultsetTable.test.js +325 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +169 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +97 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +202 -401
- package/select/Select.stories.tsx +600 -201
- package/select/Select.test.js +2228 -0
- package/select/types.d.ts +210 -0
- package/select/types.js +5 -0
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +148 -46
- package/sidenav/Sidenav.stories.tsx +282 -0
- package/sidenav/Sidenav.test.js +44 -0
- package/sidenav/types.d.ts +52 -26
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +124 -99
- package/slider/Slider.stories.tsx +72 -9
- package/slider/Slider.test.js +250 -0
- package/slider/types.d.ts +8 -0
- package/spinner/Spinner.js +20 -26
- package/spinner/Spinner.stories.jsx +53 -26
- package/spinner/Spinner.test.js +64 -0
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +153 -70
- package/switch/Switch.stories.tsx +54 -43
- package/switch/Switch.test.js +225 -0
- package/switch/types.d.ts +10 -2
- package/table/Table.js +6 -6
- package/table/Table.stories.jsx +81 -1
- package/table/Table.test.js +26 -0
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +132 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +362 -112
- package/tabs/Tabs.stories.tsx +226 -0
- package/tabs/Tabs.test.js +350 -0
- package/tabs/types.d.ts +39 -18
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +25 -37
- package/tag/Tag.stories.tsx +38 -28
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +23 -14
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +84 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +236 -388
- package/text-input/TextInput.stories.tsx +569 -0
- package/text-input/TextInput.test.js +1723 -0
- package/text-input/types.d.ts +197 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +41 -82
- package/textarea/Textarea.stories.jsx +96 -15
- package/textarea/Textarea.test.js +435 -0
- package/textarea/types.d.ts +137 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +24 -49
- package/toggle-group/ToggleGroup.stories.tsx +69 -32
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +105 -0
- package/toggle-group/types.js +5 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +32 -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 +1235 -0
- package/useTheme.js +3 -3
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +20 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +138 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +113 -59
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +48 -19
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +10 -10
- 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/RequiredComponent.js +0 -32
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/file-input/index.d.ts +0 -81
- package/footer/Footer.stories.jsx +0 -151
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- 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/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
- package/wizard/Icons.js +0 -65
- /package/{radio → badge}/types.js +0 -0
package/checkbox/Checkbox.js
CHANGED
|
@@ -19,26 +19,37 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _variables = require("../common/variables");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _utils = require("../common/utils");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _uuid = require("uuid");
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
31
31
|
|
|
32
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
32
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
33
33
|
|
|
34
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
34
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
35
35
|
|
|
36
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
37
|
|
|
38
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var checkedIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
41
|
+
fill: "currentColor",
|
|
42
|
+
focusable: "false",
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
viewBox: "0 0 24 24"
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
46
|
+
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
var DxcCheckbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
41
50
|
var checked = _ref.checked,
|
|
51
|
+
_ref$defaultChecked = _ref.defaultChecked,
|
|
52
|
+
defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
|
|
42
53
|
value = _ref.value,
|
|
43
54
|
_ref$label = _ref.label,
|
|
44
55
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
@@ -48,95 +59,95 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
48
59
|
name = _ref$name === void 0 ? "" : _ref$name,
|
|
49
60
|
_ref$disabled = _ref.disabled,
|
|
50
61
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
62
|
+
_ref$optional = _ref.optional,
|
|
63
|
+
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
51
64
|
onChange = _ref.onChange,
|
|
52
|
-
_ref$required = _ref.required,
|
|
53
|
-
required = _ref$required === void 0 ? false : _ref$required,
|
|
54
65
|
margin = _ref.margin,
|
|
55
66
|
_ref$size = _ref.size,
|
|
56
67
|
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
57
68
|
_ref$tabIndex = _ref.tabIndex,
|
|
58
69
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
59
70
|
|
|
60
|
-
var _useState = (0, _react.useState)(
|
|
61
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState,
|
|
62
|
-
|
|
63
|
-
setInnerChecked = _useState2[1];
|
|
71
|
+
var _useState = (0, _react.useState)("label-checkbox-".concat((0, _uuid.v4)())),
|
|
72
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
73
|
+
labelId = _useState2[0];
|
|
64
74
|
|
|
65
|
-
var _useState3 = (0, _react.useState)(
|
|
75
|
+
var _useState3 = (0, _react.useState)(defaultChecked),
|
|
66
76
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
innerChecked = _useState4[0],
|
|
78
|
+
setInnerChecked = _useState4[1];
|
|
69
79
|
|
|
80
|
+
var checkboxRef = (0, _react.useRef)(null);
|
|
70
81
|
var colorsTheme = (0, _useTheme["default"])();
|
|
71
82
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
83
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
72
84
|
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (typeof onChange === "function") {
|
|
83
|
-
onChange(!checked);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
85
|
+
var handleCheckboxChange = function handleCheckboxChange() {
|
|
86
|
+
var _checkboxRef$current;
|
|
87
|
+
|
|
88
|
+
document.activeElement !== (checkboxRef === null || checkboxRef === void 0 ? void 0 : checkboxRef.current) && (checkboxRef === null || checkboxRef === void 0 ? void 0 : (_checkboxRef$current = checkboxRef.current) === null || _checkboxRef$current === void 0 ? void 0 : _checkboxRef$current.focus());
|
|
89
|
+
var newChecked = checked !== null && checked !== void 0 ? checked : innerChecked;
|
|
90
|
+
checked !== null && checked !== void 0 ? checked : setInnerChecked(function (innerChecked) {
|
|
91
|
+
return !innerChecked;
|
|
92
|
+
});
|
|
93
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(!newChecked);
|
|
86
94
|
};
|
|
87
95
|
|
|
88
|
-
var
|
|
89
|
-
|
|
96
|
+
var handleKeyboard = function handleKeyboard(event) {
|
|
97
|
+
switch (event.key) {
|
|
98
|
+
case " ":
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
handleCheckboxChange();
|
|
101
|
+
}
|
|
90
102
|
};
|
|
91
103
|
|
|
92
104
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
93
105
|
theme: colorsTheme.checkbox
|
|
94
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
95
|
-
id: name,
|
|
96
|
-
brightness: _variables.componentTokens,
|
|
97
|
-
label: label,
|
|
98
|
-
labelPosition: labelPosition,
|
|
106
|
+
}, /*#__PURE__*/_react["default"].createElement(MainContainer, {
|
|
99
107
|
disabled: disabled,
|
|
108
|
+
onClick: disabled ? undefined : handleCheckboxChange,
|
|
100
109
|
margin: margin,
|
|
101
110
|
size: size,
|
|
111
|
+
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
102
112
|
backgroundType: backgroundType,
|
|
103
|
-
|
|
104
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
105
|
-
|
|
106
|
-
inputProps: {
|
|
107
|
-
name: name,
|
|
108
|
-
"aria-label": label,
|
|
109
|
-
role: "checkbox",
|
|
110
|
-
"aria-checked": checked != undefined ? checked : innerChecked
|
|
111
|
-
},
|
|
112
|
-
onChange: handlerCheckboxChange,
|
|
113
|
-
value: value,
|
|
114
|
-
disabled: disabled,
|
|
115
|
-
disableRipple: true,
|
|
116
|
-
className: "test",
|
|
117
|
-
tabIndex: tabIndex
|
|
118
|
-
}), /*#__PURE__*/_react["default"].createElement(CheckboxBlackBack, {
|
|
119
|
-
labelPosition: labelPosition,
|
|
113
|
+
ref: ref
|
|
114
|
+
}, label && labelPosition === "before" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
115
|
+
id: labelId,
|
|
120
116
|
disabled: disabled,
|
|
121
|
-
checked: checked != undefined ? checked : innerChecked,
|
|
122
117
|
backgroundType: backgroundType
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
}, label, optional && " ".concat(translatedLabels.formFields.optionalLabel)), /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
119
|
+
type: "checkbox",
|
|
120
|
+
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
121
|
+
name: name,
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
value: value,
|
|
126
124
|
disabled: disabled,
|
|
127
|
-
|
|
125
|
+
readOnly: true
|
|
126
|
+
}), /*#__PURE__*/_react["default"].createElement(CheckboxContainer, null, /*#__PURE__*/_react["default"].createElement(Checkbox, {
|
|
127
|
+
onKeyDown: handleKeyboard,
|
|
128
|
+
role: "checkbox",
|
|
129
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
130
|
+
"aria-checked": checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
131
|
+
"aria-disabled": disabled,
|
|
132
|
+
"aria-required": !disabled && !optional,
|
|
133
|
+
"aria-labelledby": labelId,
|
|
128
134
|
backgroundType: backgroundType,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
135
|
+
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
136
|
+
disabled: disabled,
|
|
137
|
+
ref: checkboxRef
|
|
138
|
+
}, (checked !== null && checked !== void 0 ? checked : innerChecked) && checkedIcon)), label && labelPosition === "after" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
139
|
+
id: labelId,
|
|
140
|
+
disabled: disabled,
|
|
141
|
+
backgroundType: backgroundType
|
|
142
|
+
}, optional && "".concat(translatedLabels.formFields.optionalLabel, " "), label)));
|
|
143
|
+
});
|
|
133
144
|
|
|
134
145
|
var sizes = {
|
|
135
146
|
small: "120px",
|
|
136
147
|
medium: "240px",
|
|
137
148
|
large: "480px",
|
|
138
149
|
fillParent: "100%",
|
|
139
|
-
fitContent: "
|
|
150
|
+
fitContent: "fit-content"
|
|
140
151
|
};
|
|
141
152
|
|
|
142
153
|
var calculateWidth = function calculateWidth(margin, size) {
|
|
@@ -151,46 +162,42 @@ var getDisabledColor = function getDisabledColor(props, element) {
|
|
|
151
162
|
switch (element) {
|
|
152
163
|
case "check":
|
|
153
164
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.disabledCheckColorOnDark : props.theme.disabledCheckColor;
|
|
154
|
-
break;
|
|
155
165
|
|
|
156
166
|
case "background":
|
|
157
167
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.disabledBackgroundColorCheckedOnDark : props.theme.disabledBackgroundColorChecked;
|
|
158
|
-
break;
|
|
159
168
|
|
|
160
169
|
case "border":
|
|
161
170
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;
|
|
162
|
-
break;
|
|
163
171
|
|
|
164
172
|
case "label":
|
|
165
173
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.disabledFontColorOnDark : props.theme.disabledFontColor;
|
|
166
|
-
break;
|
|
167
174
|
}
|
|
168
175
|
};
|
|
169
176
|
|
|
170
|
-
var
|
|
177
|
+
var getEnabledColor = function getEnabledColor(props, element) {
|
|
171
178
|
switch (element) {
|
|
172
179
|
case "check":
|
|
173
180
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.checkColorOnDark : props.theme.checkColor;
|
|
174
|
-
break;
|
|
175
181
|
|
|
176
182
|
case "background":
|
|
177
183
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.backgroundColorCheckedOnDark : props.theme.backgroundColorChecked;
|
|
178
|
-
|
|
184
|
+
|
|
185
|
+
case "hoverBackground":
|
|
186
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.hoverBackgroundColorCheckedOnDark : props.theme.hoverBackgroundColorChecked;
|
|
179
187
|
|
|
180
188
|
case "border":
|
|
181
189
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.borderColorOnDark : props.theme.borderColor;
|
|
182
|
-
|
|
190
|
+
|
|
191
|
+
case "hoverBorder":
|
|
192
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor;
|
|
183
193
|
|
|
184
194
|
case "label":
|
|
185
195
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
|
|
186
|
-
break;
|
|
187
196
|
}
|
|
188
197
|
};
|
|
189
198
|
|
|
190
|
-
var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n
|
|
191
|
-
return props.disabled ? getDisabledColor(props, "label") :
|
|
192
|
-
}, function (props) {
|
|
193
|
-
return props.disabled ? "not-allowed" : "pointer";
|
|
199
|
+
var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
200
|
+
return props.disabled ? getDisabledColor(props, "label") : getEnabledColor(props, "label");
|
|
194
201
|
}, function (props) {
|
|
195
202
|
return props.theme.fontFamily;
|
|
196
203
|
}, function (props) {
|
|
@@ -199,54 +206,44 @@ var LabelContainer = _styledComponents["default"].span(_templateObject || (_temp
|
|
|
199
206
|
return props.theme.fontWeight;
|
|
200
207
|
});
|
|
201
208
|
|
|
202
|
-
var
|
|
203
|
-
|
|
209
|
+
var ValueInput = _styledComponents["default"].input(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: none;\n"])));
|
|
210
|
+
|
|
211
|
+
var CheckboxContainer = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
|
|
212
|
+
|
|
213
|
+
var Checkbox = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 18px;\n width: 18px;\n border: 2px solid\n ", ";\n border-radius: 2px;\n background-color: ", ";\n color: ", ";\n\n &:focus {\n outline: 2px solid\n ", ";\n outline-offset: 2px;\n }\n svg {\n position: absolute;\n width: 22px;\n height: 22px;\n }\n ", "\n"])), function (props) {
|
|
214
|
+
return props.disabled ? getDisabledColor(props, "border") : getEnabledColor(props, "border");
|
|
204
215
|
}, function (props) {
|
|
205
|
-
return props.
|
|
216
|
+
return props.checked ? props.disabled ? getDisabledColor(props, "check") : getEnabledColor(props, "check") : "transparent";
|
|
206
217
|
}, function (props) {
|
|
207
|
-
return props.
|
|
218
|
+
return props.disabled ? getDisabledColor(props, "background") : getEnabledColor(props, "background");
|
|
208
219
|
}, function (props) {
|
|
209
|
-
return props.
|
|
220
|
+
return props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor;
|
|
210
221
|
}, function (props) {
|
|
211
|
-
return props.
|
|
222
|
+
return props.disabled && "pointer-events: none;";
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
var MainContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n gap: ", ";\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n\n &:hover ", " {\n border: 2px solid\n ", ";\n background-color: ", ";\n color: ", ";\n }\n"])), function (props) {
|
|
226
|
+
return props.theme.checkLabelSpacing;
|
|
212
227
|
}, function (props) {
|
|
213
228
|
return calculateWidth(props.margin, props.size);
|
|
214
229
|
}, function (props) {
|
|
215
|
-
return props.
|
|
216
|
-
}, function (props) {
|
|
217
|
-
return props.labelPosition === "before" ? "row-reverse" : "row";
|
|
218
|
-
}, function (props) {
|
|
219
|
-
return props.isLabelHovered ? props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor : getNotDisabledColor(props, "border");
|
|
220
|
-
}, function (props) {
|
|
221
|
-
return getDisabledColor(props, "border");
|
|
222
|
-
}, function (props) {
|
|
223
|
-
return props.disabled ? getDisabledColor(props, "background") : getNotDisabledColor(props, "background");
|
|
224
|
-
}, function (props) {
|
|
225
|
-
return props.backgroundType === "dark" ? props.theme.hoverBackgroundColorCheckedOnDark : props.theme.hoverBackgroundColorChecked;
|
|
226
|
-
}, function (props) {
|
|
227
|
-
return props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor;
|
|
228
|
-
}, function (props) {
|
|
229
|
-
return props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor;
|
|
230
|
-
}, function (props) {
|
|
231
|
-
return props.labelPosition === "before" && props.label ? props.theme.checkLabelSpacing : "0";
|
|
230
|
+
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
232
231
|
}, function (props) {
|
|
233
|
-
return props.
|
|
232
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
234
233
|
}, function (props) {
|
|
235
|
-
return props.
|
|
234
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
236
235
|
}, function (props) {
|
|
237
|
-
return props.
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
var CheckboxBlackBack = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n width: 16px;\n height: 16px;\n position: absolute;\n left: ", ";\n right: ", ";\n z-index: 0;\n margin-left: ", ";\n margin-right: ", ";\n"])), function (props) {
|
|
241
|
-
return !props.checked ? "transparent" : props.disabled ? getDisabledColor(props, "check") : getNotDisabledColor(props, "check");
|
|
236
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
242
237
|
}, function (props) {
|
|
243
|
-
return props.
|
|
238
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
244
239
|
}, function (props) {
|
|
245
|
-
return props.
|
|
240
|
+
return props.disabled ? "not-allowed" : "pointer";
|
|
241
|
+
}, Checkbox, function (props) {
|
|
242
|
+
return props.disabled ? getDisabledColor(props, "border") : getEnabledColor(props, "hoverBorder");
|
|
246
243
|
}, function (props) {
|
|
247
|
-
return props.
|
|
244
|
+
return props.checked ? props.disabled ? getDisabledColor(props, "check") : getEnabledColor(props, "check") : "transparent";
|
|
248
245
|
}, function (props) {
|
|
249
|
-
return props.
|
|
246
|
+
return props.disabled ? getDisabledColor(props, "background") : getEnabledColor(props, "hoverBackground");
|
|
250
247
|
});
|
|
251
248
|
|
|
252
249
|
var _default = DxcCheckbox;
|