@dxc-technology/halstack-react 0.0.0-9282b45 → 0.0.0-92fa0e1
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 -10
- package/BackgroundColorContext.js +5 -22
- package/HalstackContext.d.ts +1229 -6
- package/HalstackContext.js +125 -110
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +36 -99
- package/accordion/Accordion.stories.tsx +101 -124
- package/accordion/Accordion.test.js +19 -34
- package/accordion/types.d.ts +5 -17
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +29 -77
- package/accordion-group/AccordionGroup.stories.tsx +78 -77
- package/accordion-group/AccordionGroup.test.js +44 -72
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/types.d.ts +6 -18
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +43 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.js +19 -58
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +29 -46
- package/alert/types.d.ts +5 -5
- package/badge/Badge.js +4 -17
- package/badge/types.d.ts +1 -1
- package/bleed/Bleed.js +13 -21
- package/bleed/Bleed.stories.tsx +1 -0
- package/bleed/types.d.ts +2 -2
- package/box/Box.d.ts +1 -1
- package/box/Box.js +18 -59
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +2 -7
- package/box/types.d.ts +3 -15
- package/bulleted-list/BulletedList.js +19 -53
- package/bulleted-list/BulletedList.stories.tsx +8 -93
- package/bulleted-list/types.d.ts +32 -5
- package/button/Button.d.ts +1 -1
- package/button/Button.js +69 -105
- package/button/Button.stories.tsx +152 -91
- package/button/Button.test.js +18 -17
- package/button/types.d.ts +8 -4
- package/card/Card.d.ts +1 -1
- package/card/Card.js +48 -89
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +11 -22
- package/card/types.d.ts +6 -12
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -126
- package/checkbox/Checkbox.stories.tsx +128 -94
- package/checkbox/Checkbox.test.js +108 -64
- package/checkbox/types.d.ts +11 -3
- package/chip/Chip.js +39 -79
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +16 -31
- package/chip/types.d.ts +4 -4
- 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 +893 -1148
- 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/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.js +150 -299
- package/date-input/DateInput.stories.tsx +203 -56
- package/date-input/DateInput.test.js +700 -371
- 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 +72 -15
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +61 -119
- package/dialog/Dialog.stories.tsx +310 -212
- package/dialog/Dialog.test.js +269 -32
- package/dialog/types.d.ts +18 -26
- package/dropdown/Dropdown.js +66 -120
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +409 -400
- package/dropdown/DropdownMenu.js +20 -37
- package/dropdown/DropdownMenuItem.js +9 -34
- package/dropdown/types.d.ts +17 -19
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +241 -355
- package/file-input/FileInput.stories.tsx +123 -12
- package/file-input/FileInput.test.js +369 -367
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +45 -96
- package/file-input/types.d.ts +25 -8
- package/flex/Flex.js +27 -39
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +74 -9
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +70 -117
- package/footer/Footer.stories.tsx +55 -21
- package/footer/Footer.test.js +33 -57
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +66 -7
- package/footer/types.d.ts +25 -27
- 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/header/Header.d.ts +4 -3
- package/header/Header.js +48 -133
- package/header/Header.stories.tsx +115 -36
- package/header/Header.test.js +13 -26
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +5 -20
- package/heading/Heading.js +10 -32
- package/heading/Heading.test.js +71 -88
- package/heading/types.d.ts +7 -7
- 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.js +13 -21
- package/inset/Inset.stories.tsx +2 -1
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +29 -66
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +8 -5
- package/layout/Icons.js +51 -59
- package/layout/SidenavContext.d.ts +1 -1
- package/layout/SidenavContext.js +3 -9
- package/layout/types.d.ts +5 -6
- package/link/Link.js +25 -46
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +24 -44
- package/link/types.d.ts +14 -14
- package/main.d.ts +7 -4
- package/main.js +32 -58
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +23 -55
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +111 -7
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +37 -44
- package/nav-tabs/Tab.js +117 -0
- package/{tabs-nav → nav-tabs}/types.d.ts +14 -15
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +26 -35
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +701 -377
- package/number-input/types.d.ts +11 -5
- package/package.json +37 -40
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +21 -47
- package/paginator/Paginator.js +23 -59
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +253 -226
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +6 -22
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.js +57 -128
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +158 -141
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +23 -55
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +36 -3
- package/progress-bar/ProgressBar.test.js +36 -53
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +15 -1
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +31 -63
- package/radio-group/RadioGroup.js +45 -93
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/radio-group/RadioGroup.test.js +505 -471
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.js +159 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +50 -25
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +101 -144
- package/{resultsetTable → resultset-table}/types.d.ts +7 -7
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +17 -72
- package/select/Option.js +27 -50
- package/select/Select.js +120 -175
- package/select/Select.stories.tsx +497 -153
- package/select/Select.test.js +1974 -1837
- package/select/types.d.ts +16 -17
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +81 -153
- package/sidenav/Sidenav.stories.tsx +165 -63
- package/sidenav/Sidenav.test.js +3 -10
- package/sidenav/types.d.ts +31 -28
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +77 -134
- package/slider/Slider.test.js +108 -104
- package/slider/types.d.ts +7 -3
- package/spinner/Spinner.js +31 -75
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
- package/spinner/Spinner.test.js +26 -35
- package/spinner/types.d.ts +3 -3
- 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.d.ts +3 -3
- package/switch/Switch.js +56 -103
- package/switch/Switch.stories.tsx +33 -34
- package/switch/Switch.test.js +52 -97
- package/switch/types.d.ts +8 -3
- package/table/Table.js +8 -30
- package/table/{Table.stories.jsx → Table.stories.tsx} +80 -1
- package/table/Table.test.js +3 -8
- package/table/types.d.ts +8 -8
- package/tabs/Tab.js +22 -44
- package/tabs/Tabs.js +62 -145
- package/tabs/Tabs.stories.tsx +45 -5
- package/tabs/Tabs.test.js +66 -123
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.js +28 -60
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +20 -31
- package/tag/types.d.ts +7 -7
- package/text-input/Icons.d.ts +5 -5
- package/text-input/Icons.js +1 -5
- package/text-input/Suggestion.js +35 -25
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +15 -65
- package/text-input/TextInput.js +219 -320
- package/text-input/TextInput.stories.tsx +139 -155
- package/text-input/TextInput.test.js +1372 -1347
- package/text-input/types.d.ts +27 -19
- package/textarea/Textarea.js +70 -113
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.js +152 -183
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +92 -106
- package/toggle-group/ToggleGroup.stories.tsx +49 -4
- package/toggle-group/ToggleGroup.test.js +69 -88
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +15 -123
- package/typography/Typography.stories.tsx +1 -1
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +1133 -1
- package/useTheme.js +2 -9
- package/useTranslatedLabels.d.ts +84 -1
- package/useTranslatedLabels.js +1 -7
- 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.js +16 -51
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +54 -81
- package/wizard/types.d.ts +8 -9
- package/card/ice-cream.jpg +0 -0
- package/common/RequiredComponent.js +0 -32
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/resultsetTable/ResultsetTable.js +0 -254
- package/slider/Slider.stories.tsx +0 -183
- package/tabs-nav/Tab.js +0 -130
- package/textarea/Textarea.stories.jsx +0 -157
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{tabs-nav → container}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → grid/types.js} +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
|
@@ -1,47 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = 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 _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
16
11
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
|
-
|
|
18
12
|
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
19
|
-
|
|
20
13
|
var _Typography = _interopRequireDefault(require("../typography/Typography"));
|
|
21
|
-
|
|
22
14
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
|
-
|
|
24
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
25
|
-
|
|
26
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
|
|
31
|
-
|
|
16
|
+
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); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(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; }
|
|
32
18
|
var BulletedListItem = function BulletedListItem(_ref) {
|
|
33
19
|
var children = _ref.children;
|
|
34
20
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children);
|
|
35
21
|
};
|
|
36
|
-
|
|
37
22
|
var DxcBulletedList = function DxcBulletedList(_ref2) {
|
|
38
23
|
var children = _ref2.children,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
_ref2$type = _ref2.type,
|
|
25
|
+
type = _ref2$type === void 0 ? "disc" : _ref2$type,
|
|
26
|
+
_ref2$icon = _ref2.icon,
|
|
27
|
+
icon = _ref2$icon === void 0 ? "" : _ref2$icon;
|
|
43
28
|
var colorsTheme = (0, _useTheme["default"])();
|
|
44
|
-
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
45
29
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
46
30
|
theme: colorsTheme.bulletedList
|
|
47
31
|
}, /*#__PURE__*/_react["default"].createElement(ListContainer, null, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
@@ -50,45 +34,32 @@ var DxcBulletedList = function DxcBulletedList(_ref2) {
|
|
|
50
34
|
gap: "0.125rem"
|
|
51
35
|
}, _react["default"].Children.map(children, function (child, index) {
|
|
52
36
|
return /*#__PURE__*/_react["default"].createElement(ListItem, null, /*#__PURE__*/_react["default"].createElement(GeneralContent, null, type === "number" ? /*#__PURE__*/_react["default"].createElement(Number, null, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
53
|
-
color:
|
|
54
|
-
}, index + 1, ".")) : type === "square" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Square, {
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
})) : type === "icon" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
59
|
-
backgroundType: backgroundType
|
|
60
|
-
}, icon)) : /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Disc, {
|
|
61
|
-
backgroundType: backgroundType
|
|
62
|
-
})), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
63
|
-
color: backgroundType && backgroundType === "dark" ? colorsTheme.bulletedList.fontColorOnDark : colorsTheme.bulletedList.fontColor
|
|
37
|
+
color: colorsTheme.bulletedList.fontColor
|
|
38
|
+
}, index + 1, ".")) : type === "square" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Square, null)) : type === "circle" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Circle, null)) : type === "icon" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Icon, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
39
|
+
src: icon
|
|
40
|
+
}) : icon)) : /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Disc, null)), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
41
|
+
color: colorsTheme.bulletedList.fontColor
|
|
64
42
|
}, child)));
|
|
65
43
|
}))));
|
|
66
44
|
};
|
|
67
|
-
|
|
68
45
|
DxcBulletedList.Item = BulletedListItem;
|
|
69
|
-
|
|
70
46
|
var ListContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ul,\n ol {\n padding: 0;\n margin: 0;\n }\n"])));
|
|
71
|
-
|
|
72
47
|
var Bullet = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-self: flex-start;\n align-items: center;\n height: 1.5rem;\n"])));
|
|
73
|
-
|
|
74
48
|
var GeneralContent = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n"])));
|
|
75
|
-
|
|
76
|
-
var Icon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n width: auto;\n margin-right: ", ";\n align-content: center;\n color: ", ";\n & > svg {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
|
|
49
|
+
var Icon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n width: auto;\n margin-right: ", ";\n align-content: center;\n color: ", ";\n\n svg,\n img {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
|
|
77
50
|
return props.theme.bulletMarginRight;
|
|
78
51
|
}, function (props) {
|
|
79
|
-
return props.
|
|
52
|
+
return props.theme.fontColor;
|
|
80
53
|
}, function (props) {
|
|
81
54
|
return props.theme.bulletIconHeight;
|
|
82
55
|
}, function (props) {
|
|
83
56
|
return props.theme.bulletIconWidth;
|
|
84
57
|
});
|
|
85
|
-
|
|
86
58
|
var Number = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n user-select: none;\n margin-right: ", ";\n display: flex;\n box-sizing: border-box;\n align-self: flex-start;\n min-width: 0;\n"])), function (props) {
|
|
87
59
|
return props.theme.bulletMarginRight;
|
|
88
60
|
});
|
|
89
|
-
|
|
90
61
|
var Square = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n height: ", ";\n width: ", ";\n margin-right: ", ";\n"])), function (props) {
|
|
91
|
-
return props.
|
|
62
|
+
return props.theme.fontColor;
|
|
92
63
|
}, function (props) {
|
|
93
64
|
return props.theme.bulletHeight;
|
|
94
65
|
}, function (props) {
|
|
@@ -96,19 +67,17 @@ var Square = _styledComponents["default"].div(_templateObject6 || (_templateObje
|
|
|
96
67
|
}, function (props) {
|
|
97
68
|
return props.theme.bulletMarginRight;
|
|
98
69
|
});
|
|
99
|
-
|
|
100
70
|
var Circle = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n border-radius: 50%;\n border: 1px solid;\n border-color: ", ";\n margin-right: ", ";\n"])), function (props) {
|
|
101
71
|
return props.theme.bulletHeight;
|
|
102
72
|
}, function (props) {
|
|
103
73
|
return props.theme.bulletWidth;
|
|
104
74
|
}, function (props) {
|
|
105
|
-
return props.
|
|
75
|
+
return props.theme.fontColor;
|
|
106
76
|
}, function (props) {
|
|
107
77
|
return props.theme.bulletMarginRight;
|
|
108
78
|
});
|
|
109
|
-
|
|
110
79
|
var Disc = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n height: ", ";\n width: ", ";\n border-radius: 50%;\n margin-right: ", ";\n"])), function (props) {
|
|
111
|
-
return props.
|
|
80
|
+
return props.theme.fontColor;
|
|
112
81
|
}, function (props) {
|
|
113
82
|
return props.theme.bulletHeight;
|
|
114
83
|
}, function (props) {
|
|
@@ -116,8 +85,5 @@ var Disc = _styledComponents["default"].div(_templateObject8 || (_templateObject
|
|
|
116
85
|
}, function (props) {
|
|
117
86
|
return props.theme.bulletMarginRight;
|
|
118
87
|
});
|
|
119
|
-
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
var _default = DxcBulletedList;
|
|
123
|
-
exports["default"] = _default;
|
|
88
|
+
var ListItem = _styledComponents["default"].li(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin: 0px;\n padding: 0px;\n list-style: none;\n font-size: 1em;\n"])));
|
|
89
|
+
var _default = exports["default"] = DxcBulletedList;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
|
-
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
5
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
5
|
import DxcBulletedList from "./BulletedList";
|
|
7
6
|
|
|
8
7
|
export default {
|
|
9
|
-
title: "
|
|
8
|
+
title: "Bulleted List",
|
|
10
9
|
component: DxcBulletedList,
|
|
11
10
|
};
|
|
12
11
|
|
|
@@ -20,12 +19,18 @@ const icon = (
|
|
|
20
19
|
export const Chromatic = () => (
|
|
21
20
|
<>
|
|
22
21
|
<ExampleContainer>
|
|
23
|
-
<Title title="Icon list" level={4} />
|
|
22
|
+
<Title title="Icon list (SVG)" level={4} />
|
|
24
23
|
<DxcBulletedList type="icon" icon={icon}>
|
|
25
24
|
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
26
25
|
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
27
26
|
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
28
27
|
</DxcBulletedList>
|
|
28
|
+
<Title title="Icon list (path)" level={4} />
|
|
29
|
+
<DxcBulletedList type="icon" icon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg">
|
|
30
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
31
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
32
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
33
|
+
</DxcBulletedList>
|
|
29
34
|
<Title title="Number list" level={4} />
|
|
30
35
|
<DxcBulletedList type="number">
|
|
31
36
|
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
@@ -102,99 +107,9 @@ export const Chromatic = () => (
|
|
|
102
107
|
</DxcBulletedList>
|
|
103
108
|
</Container>
|
|
104
109
|
</ExampleContainer>
|
|
105
|
-
<BackgroundColorProvider color="#333333">
|
|
106
|
-
<DarkContainerForBulletedList>
|
|
107
|
-
<Title title="Icon list" theme="dark" level={4} />
|
|
108
|
-
<DxcBulletedList type="icon" icon={icon}>
|
|
109
|
-
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
110
|
-
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
111
|
-
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
112
|
-
</DxcBulletedList>
|
|
113
|
-
<Title title="Number list" theme="dark" level={4} />
|
|
114
|
-
<DxcBulletedList type="number">
|
|
115
|
-
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
116
|
-
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
117
|
-
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
118
|
-
</DxcBulletedList>
|
|
119
|
-
<Title title="Square" theme="dark" level={4} />
|
|
120
|
-
<DxcBulletedList type="square">
|
|
121
|
-
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
122
|
-
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
123
|
-
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
124
|
-
</DxcBulletedList>
|
|
125
|
-
<Title title="Circle" theme="dark" level={4} />
|
|
126
|
-
<DxcBulletedList type="circle">
|
|
127
|
-
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
128
|
-
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
129
|
-
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
130
|
-
</DxcBulletedList>
|
|
131
|
-
<Title title="Disc" theme="dark" level={4} />
|
|
132
|
-
<DxcBulletedList>
|
|
133
|
-
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
134
|
-
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
135
|
-
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
136
|
-
</DxcBulletedList>
|
|
137
|
-
<Title title="Multiple lines" theme="dark" level={4} />
|
|
138
|
-
<Container>
|
|
139
|
-
<Title title="Number" theme="dark" level={4} />
|
|
140
|
-
<DxcBulletedList type="number">
|
|
141
|
-
<DxcBulletedList.Item>
|
|
142
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
143
|
-
dolore magna aliqua.
|
|
144
|
-
</DxcBulletedList.Item>
|
|
145
|
-
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
146
|
-
</DxcBulletedList>
|
|
147
|
-
</Container>
|
|
148
|
-
<Container>
|
|
149
|
-
<Title title="Square" theme="dark" level={4} />
|
|
150
|
-
<DxcBulletedList type="square">
|
|
151
|
-
<DxcBulletedList.Item>
|
|
152
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
153
|
-
dolore magna aliqua.
|
|
154
|
-
</DxcBulletedList.Item>
|
|
155
|
-
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
156
|
-
</DxcBulletedList>
|
|
157
|
-
</Container>
|
|
158
|
-
<Container>
|
|
159
|
-
<Title title="Circle" theme="dark" level={4} />
|
|
160
|
-
<DxcBulletedList type="circle">
|
|
161
|
-
<DxcBulletedList.Item>
|
|
162
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
163
|
-
dolore magna aliqua.
|
|
164
|
-
</DxcBulletedList.Item>
|
|
165
|
-
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
166
|
-
</DxcBulletedList>
|
|
167
|
-
</Container>
|
|
168
|
-
<Title title="Disc" theme="dark" level={4} />
|
|
169
|
-
<Container>
|
|
170
|
-
<DxcBulletedList>
|
|
171
|
-
<DxcBulletedList.Item>
|
|
172
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
173
|
-
dolore magna aliqua.
|
|
174
|
-
</DxcBulletedList.Item>
|
|
175
|
-
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
176
|
-
</DxcBulletedList>
|
|
177
|
-
</Container>
|
|
178
|
-
<Container>
|
|
179
|
-
<Title title="Icon" theme="dark" level={4} />
|
|
180
|
-
<DxcBulletedList type="icon" icon={icon}>
|
|
181
|
-
<DxcBulletedList.Item>
|
|
182
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
183
|
-
dolore magna aliqua.
|
|
184
|
-
</DxcBulletedList.Item>
|
|
185
|
-
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
186
|
-
</DxcBulletedList>
|
|
187
|
-
</Container>
|
|
188
|
-
</DarkContainerForBulletedList>
|
|
189
|
-
</BackgroundColorProvider>
|
|
190
110
|
</>
|
|
191
111
|
);
|
|
192
112
|
|
|
193
113
|
const Container = styled.div`
|
|
194
114
|
width: 400px;
|
|
195
115
|
`;
|
|
196
|
-
|
|
197
|
-
const DarkContainerForBulletedList = styled.div`
|
|
198
|
-
background-color: #333333;
|
|
199
|
-
padding: 5px;
|
|
200
|
-
`;
|
package/bulleted-list/types.d.ts
CHANGED
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
3
|
+
type IconProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Defines the style of the bullet point in the list.
|
|
6
|
+
*/
|
|
7
|
+
type: "icon";
|
|
8
|
+
/**
|
|
9
|
+
* Icon to display as bullet.
|
|
10
|
+
*/
|
|
11
|
+
icon: string | SVG;
|
|
12
|
+
/**
|
|
13
|
+
* Text to be shown in the list.
|
|
14
|
+
*/
|
|
4
15
|
children: React.ReactNode;
|
|
5
|
-
type?: "disc" | "circle" | "square" | "number" | "icon";
|
|
6
|
-
icon?: string | SVG;
|
|
7
16
|
};
|
|
17
|
+
type OtherProps = {
|
|
18
|
+
/**
|
|
19
|
+
* Defines the style of the bullet point in the list.
|
|
20
|
+
*/
|
|
21
|
+
type?: "disc" | "circle" | "square" | "number";
|
|
22
|
+
/**
|
|
23
|
+
* Icon to display as bullet.
|
|
24
|
+
*/
|
|
25
|
+
icon?: never;
|
|
26
|
+
/**
|
|
27
|
+
* Text to be shown in the list.
|
|
28
|
+
*/
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
};
|
|
31
|
+
type Props = IconProps | OtherProps;
|
|
8
32
|
export default Props;
|
|
9
|
-
export
|
|
33
|
+
export type BulletedListItemPropsType = {
|
|
34
|
+
/**
|
|
35
|
+
* Text to be shown in the list.
|
|
36
|
+
*/
|
|
10
37
|
children?: React.ReactNode;
|
|
11
38
|
};
|
package/button/Button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import ButtonPropsType from "./types";
|
|
3
|
-
declare const DxcButton: ({ label, mode, disabled, iconPosition, type, icon, onClick, margin, size, tabIndex, }: ButtonPropsType) => JSX.Element;
|
|
3
|
+
declare const DxcButton: ({ label, mode, disabled, iconPosition, title, type, icon, onClick, margin, size, tabIndex, }: ButtonPropsType) => JSX.Element;
|
|
4
4
|
export default DxcButton;
|
package/button/Button.js
CHANGED
|
@@ -1,103 +1,84 @@
|
|
|
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
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
18
12
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
var _utils = require("../common/utils.js");
|
|
23
|
-
|
|
13
|
+
var _variables = require("../common/variables");
|
|
14
|
+
var _utils = require("../common/utils");
|
|
24
15
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
29
|
-
|
|
30
|
-
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); }
|
|
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 sizes = {
|
|
35
|
-
small: "42px",
|
|
36
|
-
medium: "120px",
|
|
37
|
-
large: "240px",
|
|
38
|
-
fillParent: "100%",
|
|
39
|
-
fitContent: "fit-content"
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var calculateWidth = function calculateWidth(margin, size) {
|
|
43
|
-
if (size === "fillParent") {
|
|
44
|
-
return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return sizes[size];
|
|
48
|
-
};
|
|
49
|
-
|
|
16
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
50
19
|
var DxcButton = function DxcButton(_ref) {
|
|
51
20
|
var _ref$label = _ref.label,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
21
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
22
|
+
_ref$mode = _ref.mode,
|
|
23
|
+
mode = _ref$mode === void 0 ? "primary" : _ref$mode,
|
|
24
|
+
_ref$disabled = _ref.disabled,
|
|
25
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
26
|
+
_ref$iconPosition = _ref.iconPosition,
|
|
27
|
+
iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
|
|
28
|
+
title = _ref.title,
|
|
29
|
+
_ref$type = _ref.type,
|
|
30
|
+
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
31
|
+
icon = _ref.icon,
|
|
32
|
+
_ref$onClick = _ref.onClick,
|
|
33
|
+
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
34
|
+
margin = _ref.margin,
|
|
35
|
+
_ref$size = _ref.size,
|
|
36
|
+
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
37
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
38
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
70
39
|
var colorsTheme = (0, _useTheme["default"])();
|
|
71
|
-
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
72
|
-
|
|
73
|
-
var labelComponent = /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
74
|
-
icon: icon,
|
|
75
|
-
iconPosition: iconPosition
|
|
76
|
-
}, label);
|
|
77
|
-
|
|
78
40
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
79
41
|
theme: colorsTheme.button
|
|
80
42
|
}, /*#__PURE__*/_react["default"].createElement(Button, {
|
|
81
|
-
|
|
82
|
-
mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
|
|
43
|
+
"aria-label": title,
|
|
83
44
|
disabled: disabled,
|
|
84
|
-
"aria-disabled": disabled,
|
|
85
|
-
tabIndex: disabled ? -1 : tabIndex,
|
|
86
|
-
backgroundType: backgroundType,
|
|
87
|
-
size: size,
|
|
88
|
-
margin: margin,
|
|
89
45
|
onClick: function onClick() {
|
|
90
46
|
_onClick();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
47
|
+
},
|
|
48
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
49
|
+
title: title,
|
|
50
|
+
type: type,
|
|
51
|
+
$mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
|
|
52
|
+
hasLabel: label ? true : false,
|
|
53
|
+
hasIcon: icon ? true : false,
|
|
54
|
+
iconPosition: iconPosition,
|
|
55
|
+
size: size,
|
|
56
|
+
margin: margin
|
|
57
|
+
}, label && /*#__PURE__*/_react["default"].createElement(LabelContainer, null, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
96
58
|
src: icon
|
|
97
|
-
}) : icon)
|
|
59
|
+
}) : icon)));
|
|
98
60
|
};
|
|
99
|
-
|
|
100
|
-
|
|
61
|
+
var sizes = {
|
|
62
|
+
small: "42px",
|
|
63
|
+
medium: "120px",
|
|
64
|
+
large: "240px",
|
|
65
|
+
fillParent: "100%",
|
|
66
|
+
fitContent: "fit-content"
|
|
67
|
+
};
|
|
68
|
+
var calculateWidth = function calculateWidth(margin, size) {
|
|
69
|
+
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
70
|
+
};
|
|
71
|
+
var getButtonStyles = function getButtonStyles($mode, theme) {
|
|
72
|
+
return "\n border-color: ".concat($mode === "secondary" ? theme.secondaryBorderColor : "", ";\n border-radius: ").concat($mode === "primary" ? theme.primaryBorderRadius : $mode === "secondary" ? theme.secondaryBorderRadius : theme.textBorderRadius, ";\n border-width: ").concat($mode === "primary" ? theme.primaryBorderThickness : $mode === "secondary" ? theme.secondaryBorderThickness : theme.textBorderThickness, ";\n border-style: ").concat($mode === "primary" ? theme.primaryBorderStyle : $mode === "secondary" ? theme.secondaryBorderStyle : theme.textBorderStyle, ";\n font-family: ").concat($mode === "primary" ? theme.primaryFontFamily : $mode === "secondary" ? theme.secondaryFontFamily : theme.textFontFamily, ";\n font-size: ").concat($mode === "primary" ? theme.primaryFontSize : $mode === "secondary" ? theme.secondaryFontSize : theme.textFontSize, ";\n font-weight: ").concat($mode === "primary" ? theme.primaryFontWeight : $mode === "secondary" ? theme.secondaryFontWeight : theme.textFontWeight, ";\n background-color: ").concat($mode === "primary" ? theme.primaryBackgroundColor : $mode === "secondary" ? theme.secondaryBackgroundColor : theme.textBackgroundColor, ";\n color: ").concat($mode === "primary" ? theme.primaryFontColor : $mode === "secondary" ? theme.secondaryFontColor : theme.textFontColor, ";\n ");
|
|
73
|
+
};
|
|
74
|
+
var getButtonStates = function getButtonStates(disabled, $mode, theme) {
|
|
75
|
+
return "\n &:hover {\n background-color: ".concat($mode === "primary" ? theme.primaryHoverBackgroundColor : $mode === "secondary" ? theme.secondaryHoverBackgroundColor : theme.textHoverBackgroundColor, ";\n color: ").concat($mode === "secondary" ? theme.secondaryHoverFontColor : "", ";\n }\n &:focus {\n border-color: ").concat($mode === "secondary" ? "transparent" : "", ";\n }\n &:active {\n background-color: ").concat($mode === "primary" ? theme.primaryActiveBackgroundColor : $mode === "secondary" ? theme.secondaryActiveBackgroundColor : theme.textActiveBackgroundColor, ";\n color: ").concat($mode === "secondary" ? theme.secondaryHoverFontColor : "", ";\n border-color: ").concat($mode === "secondary" ? "transparent" : "", ";\n outline: none;\n box-shadow: ").concat(!disabled ? "0 0 0 2px ".concat(theme.focusBorderColor) : "", ";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ").concat($mode === "primary" ? theme.primaryDisabledBackgroundColor : $mode === "secondary" ? theme.secondaryDisabledBackgroundColor : theme.textDisabledBackgroundColor, ";\n color: ").concat($mode === "primary" ? theme.primaryDisabledFontColor : $mode === "secondary" ? theme.secondaryDisabledFontColor : theme.textDisabledFontColor, ";\n border-color: ").concat($mode === "secondary" ? theme.secondaryDisabledBorderColor : "", ";\n }\n");
|
|
76
|
+
};
|
|
77
|
+
var Button = _styledComponents["default"].button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n flex-direction: ", ";\n gap: 0.5rem;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: 40px;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n cursor: pointer;\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n\n ", "\n ", "\n"])), function (props) {
|
|
78
|
+
return props.iconPosition === "after" ? "row" : "row-reverse";
|
|
79
|
+
}, function (props) {
|
|
80
|
+
return calculateWidth(props.margin, props.size);
|
|
81
|
+
}, function (props) {
|
|
101
82
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
102
83
|
}, function (props) {
|
|
103
84
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -107,16 +88,14 @@ var Button = _styledComponents["default"].button(_templateObject || (_templateOb
|
|
|
107
88
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
108
89
|
}, function (props) {
|
|
109
90
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
110
|
-
}, function (props) {
|
|
111
|
-
return calculateWidth(props.margin, props.size);
|
|
112
|
-
}, function (props) {
|
|
113
|
-
return props.theme.paddingLeft;
|
|
114
|
-
}, function (props) {
|
|
115
|
-
return props.theme.paddingRight;
|
|
116
91
|
}, function (props) {
|
|
117
92
|
return props.theme.paddingTop;
|
|
118
93
|
}, function (props) {
|
|
119
94
|
return props.theme.paddingBottom;
|
|
95
|
+
}, function (props) {
|
|
96
|
+
return props.hasIcon && !props.hasLabel ? props.theme.paddingLeft : "calc(".concat(props.theme.paddingLeft, " + 8px)");
|
|
97
|
+
}, function (props) {
|
|
98
|
+
return props.hasIcon && !props.hasLabel ? props.theme.paddingRight : "calc(".concat(props.theme.paddingRight, " + 8px)");
|
|
120
99
|
}, function (props) {
|
|
121
100
|
return props.theme.fontFamily;
|
|
122
101
|
}, function (props) {
|
|
@@ -126,31 +105,16 @@ var Button = _styledComponents["default"].button(_templateObject || (_templateOb
|
|
|
126
105
|
}, function (props) {
|
|
127
106
|
return props.theme.labelLetterSpacing;
|
|
128
107
|
}, function (props) {
|
|
129
|
-
return props.
|
|
108
|
+
return props.theme.focusBorderColor;
|
|
109
|
+
}, function (props) {
|
|
110
|
+
return getButtonStyles(props.$mode, props.theme);
|
|
130
111
|
}, function (props) {
|
|
131
|
-
|
|
132
|
-
backgroundType = props.backgroundType,
|
|
133
|
-
disabled = props.disabled;
|
|
134
|
-
return "\n border-radius: ".concat(props.mode === "primary" ? props.theme.primaryBorderRadius : props.mode === "secondary" ? props.theme.secondaryBorderRadius : props.theme.textBorderRadius, ";\n border-width: ").concat(props.mode === "primary" ? props.theme.primaryBorderThickness : props.mode === "secondary" ? props.theme.secondaryBorderThickness : props.theme.textBorderThickness, ";\n border-style: ").concat(mode === "primary" ? props.theme.primaryBorderStyle : mode === "secondary" ? props.theme.secondaryBorderStyle : props.theme.textBorderStyle, ";\n font-family: ").concat(mode === "primary" ? props.theme.primaryFontFamily : mode === "secondary" ? props.theme.secondaryFontFamily : props.theme.textFontFamily, ";\n font-size: ").concat(mode === "primary" ? props.theme.primaryFontSize : mode === "secondary" ? props.theme.secondaryFontSize : props.theme.textFontSize, ";\n font-weight: ").concat(mode === "primary" ? props.theme.primaryFontWeight : mode === "secondary" ? props.theme.secondaryFontWeight : props.theme.textFontWeight, ";\n background-color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryBackgroundColorOnDark : props.theme.primaryBackgroundColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryBackgroundColorOnDark : props.theme.secondaryBackgroundColor : backgroundType === "dark" ? props.theme.textBackgroundColorOnDark : props.theme.textBackgroundColor, ";\n color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryFontColorOnDark : props.theme.primaryFontColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryFontColorOnDark : props.theme.secondaryFontColor : backgroundType === "dark" ? props.theme.textFontColorOnDark : props.theme.textFontColor, ";\n border-color: ").concat(mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryBorderColorOnDark : props.theme.secondaryBorderColor : "", ";\n &:hover {\n background-color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryHoverBackgroundColorOnDark : props.theme.primaryHoverBackgroundColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryHoverBackgroundColorOnDark : props.theme.secondaryHoverBackgroundColor : backgroundType === "dark" ? props.theme.textHoverBackgroundColorOnDark : props.theme.textHoverBackgroundColor, ";\n color: ").concat(mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor : "", ";\n }\n &:focus {\n border-color: ").concat(mode === "secondary" ? "transparent" : "", ";\n }\n &:active {\n background-color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryActiveBackgroundColorOnDark : props.theme.primaryActiveBackgroundColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryActiveBackgroundColorOnDark : props.theme.secondaryActiveBackgroundColor : backgroundType === "dark" ? props.theme.textActiveBackgroundColorOnDark : props.theme.textActiveBackgroundColor, ";\n color: ").concat(mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor : "", ";\n border-color: ").concat(mode === "secondary" ? "transparent" : "", ";\n outline: none;\n box-shadow: ").concat(!disabled ? "0 0 0 2px ".concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor) : "", ";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryDisabledBackgroundColorOnDark : props.theme.primaryDisabledBackgroundColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryDisabledBackgroundColorOnDark : props.theme.secondaryDisabledBackgroundColor : backgroundType === "dark" ? props.theme.textDisabledBackgroundColorOnDark : props.theme.textDisabledBackgroundColor, ";\n color: ").concat(mode === "primary" ? backgroundType === "dark" ? props.theme.primaryDisabledFontColorOnDark : props.theme.primaryDisabledFontColor : mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryDisabledFontColorOnDark : props.theme.secondaryDisabledFontColor : backgroundType === "dark" ? props.theme.textDisabledFontColorOnDark : props.theme.textDisabledFontColor, ";\n border-color: ").concat(mode === "secondary" ? backgroundType === "dark" ? props.theme.secondaryDisabledBorderColorOnDark : props.theme.secondaryDisabledBorderColor : "", ";\n }\n ");
|
|
112
|
+
return getButtonStates(props.disabled, props.$mode, props.theme);
|
|
135
113
|
});
|
|
136
|
-
|
|
137
|
-
var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n line-height: ", ";\n font-size: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n text-transform: none;\n white-space: nowrap;\n margin-right: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
114
|
+
var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n line-height: ", ";\n font-size: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n text-transform: none;\n white-space: nowrap;\n"])), function (props) {
|
|
138
115
|
return props.theme.labelFontLineHeight;
|
|
139
116
|
}, function (props) {
|
|
140
117
|
return props.theme.fontSize;
|
|
141
|
-
}, function (props) {
|
|
142
|
-
return !props.icon || props.iconPosition === "before" ? "8px" : "0px";
|
|
143
|
-
}, function (props) {
|
|
144
|
-
return !props.icon || props.iconPosition === "after" ? "8px" : "0px";
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-left: ", ";\n margin-right: ", ";\n overflow: hidden;\n display: flex;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
148
|
-
return !props.label ? "0px" : props.iconPosition === "after" && props.label !== "" && "8px" || "8px";
|
|
149
|
-
}, function (props) {
|
|
150
|
-
return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
|
|
151
118
|
});
|
|
152
|
-
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
var _default = DxcButton;
|
|
156
|
-
exports["default"] = _default;
|
|
119
|
+
var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n\n img,\n svg {\n height: 24px;\n width: 24px;\n }\n"])));
|
|
120
|
+
var _default = exports["default"] = DxcButton;
|