@dxc-technology/halstack-react 0.0.0-d3ac293 → 0.0.0-d3df47e
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 +4 -21
- package/HalstackContext.d.ts +24 -139
- package/HalstackContext.js +11 -36
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +26 -83
- package/accordion/Accordion.stories.tsx +2 -114
- package/accordion/Accordion.test.js +18 -33
- package/accordion/types.d.ts +5 -17
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +27 -75
- package/accordion-group/AccordionGroup.stories.tsx +78 -77
- package/accordion-group/AccordionGroup.test.js +43 -71
- 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 +47 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.js +17 -56
- package/alert/Alert.test.js +28 -45
- package/alert/types.d.ts +5 -5
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +142 -42
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- 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 +16 -55
- package/box/Box.stories.tsx +25 -53
- package/box/Box.test.js +1 -6
- 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 +66 -100
- package/button/Button.stories.tsx +9 -90
- package/button/Button.test.js +19 -16
- package/button/types.d.ts +8 -4
- package/card/Card.d.ts +1 -1
- package/card/Card.js +47 -88
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +6 -12
- package/checkbox/Checkbox.js +85 -120
- package/checkbox/Checkbox.stories.tsx +16 -54
- package/checkbox/Checkbox.test.js +107 -63
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.js +34 -68
- package/chip/Chip.stories.tsx +25 -17
- package/chip/Chip.test.js +15 -28
- 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.js +2 -8
- package/common/variables.d.ts +24 -282
- package/common/variables.js +860 -1125
- 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.js +15 -59
- package/date-input/DateInput.js +50 -96
- package/date-input/DateInput.stories.tsx +11 -30
- package/date-input/DateInput.test.js +674 -701
- package/date-input/DatePicker.js +11 -42
- package/date-input/Icons.d.ts +6 -6
- package/date-input/Icons.js +6 -23
- package/date-input/YearPicker.js +8 -34
- package/date-input/types.d.ts +27 -21
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +15 -60
- package/dialog/Dialog.stories.tsx +215 -169
- package/dialog/Dialog.test.js +125 -187
- package/dialog/types.d.ts +18 -26
- package/dropdown/Dropdown.js +39 -93
- package/dropdown/Dropdown.test.js +391 -378
- package/dropdown/DropdownMenu.js +13 -20
- package/dropdown/DropdownMenuItem.js +5 -19
- package/dropdown/types.d.ts +17 -19
- package/file-input/FileInput.js +180 -249
- package/file-input/FileInput.stories.tsx +1 -1
- package/file-input/FileInput.test.js +356 -354
- package/file-input/FileItem.js +14 -41
- package/file-input/types.d.ts +10 -10
- 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 +69 -116
- package/footer/Footer.stories.tsx +38 -95
- package/footer/Footer.test.js +21 -33
- 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/grid/types.js +5 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +33 -116
- package/header/Header.stories.tsx +7 -71
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +5 -20
- package/heading/Heading.js +9 -31
- package/heading/Heading.test.js +70 -87
- 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 +28 -65
- 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 +23 -44
- package/link/Link.test.js +23 -41
- package/link/types.d.ts +14 -14
- package/main.d.ts +7 -4
- package/main.js +32 -58
- package/nav-tabs/NavTabs.d.ts +2 -2
- package/nav-tabs/NavTabs.js +22 -54
- package/nav-tabs/NavTabs.stories.tsx +21 -5
- package/nav-tabs/NavTabs.test.js +38 -44
- package/nav-tabs/Tab.js +40 -72
- package/nav-tabs/types.d.ts +14 -15
- 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 +700 -412
- package/number-input/types.d.ts +11 -5
- package/package.json +30 -28
- package/paginator/Icons.d.ts +5 -5
- package/paginator/Icons.js +5 -19
- package/paginator/Paginator.js +17 -47
- package/paginator/Paginator.test.js +229 -199
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.d.ts +2 -3
- package/paragraph/Paragraph.js +3 -19
- 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 -126
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +157 -140
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +21 -53
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
- package/progress-bar/ProgressBar.test.js +35 -52
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +1 -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 +10 -10
- package/radio-group/RadioGroup.test.js +504 -470
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/{resultsetTable → resultset-table}/Icons.js +1 -5
- package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +1 -1
- package/{resultsetTable → resultset-table}/ResultsetTable.js +33 -63
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +19 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +72 -92
- package/{resultsetTable → resultset-table}/types.d.ts +13 -7
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.js +13 -39
- package/select/Option.js +17 -27
- package/select/Select.js +92 -166
- package/select/Select.stories.tsx +3 -3
- package/select/Select.test.js +1946 -1804
- package/select/types.d.ts +14 -15
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +80 -150
- package/sidenav/Sidenav.stories.tsx +60 -60
- package/sidenav/Sidenav.test.js +3 -10
- package/sidenav/types.d.ts +31 -28
- package/slider/Slider.js +68 -126
- package/slider/Slider.test.js +107 -103
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +28 -72
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +28 -28
- package/spinner/Spinner.test.js +25 -34
- 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.js +49 -97
- package/switch/Switch.stories.tsx +0 -34
- package/switch/Switch.test.js +51 -96
- package/switch/types.d.ts +4 -4
- package/table/Table.d.ts +1 -1
- package/table/Table.js +23 -30
- package/table/{Table.stories.jsx → Table.stories.tsx} +98 -0
- package/table/Table.test.js +1 -6
- package/table/types.d.ts +12 -6
- package/tabs/Tab.js +19 -36
- package/tabs/Tabs.js +61 -144
- package/tabs/Tabs.stories.tsx +1 -1
- package/tabs/Tabs.test.js +65 -121
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.js +26 -58
- package/tag/Tag.test.js +19 -30
- 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 +11 -28
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +15 -65
- package/text-input/TextInput.js +217 -318
- package/text-input/TextInput.stories.tsx +48 -152
- package/text-input/TextInput.test.js +1210 -1194
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.js +68 -111
- package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -100
- package/textarea/Textarea.test.js +151 -182
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +91 -105
- package/toggle-group/ToggleGroup.stories.tsx +7 -4
- package/toggle-group/ToggleGroup.test.js +68 -87
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.js +4 -13
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +21 -136
- package/useTheme.js +1 -8
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +2 -2
- package/utils/BaseTypography.js +16 -30
- package/utils/FocusLock.js +28 -43
- package/wizard/Wizard.js +15 -50
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +8 -9
- package/card/ice-cream.jpg +0 -0
- 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/Icons.d.ts +0 -7
- package/slider/Slider.stories.tsx +0 -240
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → container/types.js} +0 -0
package/table/Table.js
CHANGED
|
@@ -1,53 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
12
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
-
|
|
20
13
|
var _variables = require("../common/variables");
|
|
21
|
-
|
|
22
14
|
var _utils = require("../common/utils");
|
|
23
|
-
|
|
24
15
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
|
-
|
|
26
|
-
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
27
|
-
|
|
16
|
+
var _coreTokens = _interopRequireDefault(require("../common/coreTokens"));
|
|
28
17
|
var _templateObject, _templateObject2;
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
34
20
|
var DxcTable = function DxcTable(_ref) {
|
|
35
21
|
var children = _ref.children,
|
|
36
|
-
|
|
22
|
+
margin = _ref.margin,
|
|
23
|
+
_ref$mode = _ref.mode,
|
|
24
|
+
mode = _ref$mode === void 0 ? "default" : _ref$mode;
|
|
37
25
|
var colorsTheme = (0, _useTheme["default"])();
|
|
38
26
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
39
27
|
theme: colorsTheme.table
|
|
40
28
|
}, /*#__PURE__*/_react["default"].createElement(DxcTableContainer, {
|
|
41
29
|
margin: margin
|
|
42
|
-
}, /*#__PURE__*/_react["default"].createElement(DxcTableContent,
|
|
43
|
-
|
|
44
|
-
}, children)))
|
|
30
|
+
}, /*#__PURE__*/_react["default"].createElement(DxcTableContent, {
|
|
31
|
+
mode: mode
|
|
32
|
+
}, children)));
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
var calculateWidth = function calculateWidth(margin) {
|
|
48
35
|
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
49
36
|
};
|
|
50
|
-
|
|
51
37
|
var DxcTableContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n overflow: auto;\n &::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 6px;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 6px;\n }\n"])), function (props) {
|
|
52
38
|
return calculateWidth(props.margin);
|
|
53
39
|
}, function (props) {
|
|
@@ -65,9 +51,10 @@ var DxcTableContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
65
51
|
}, function (props) {
|
|
66
52
|
return props.theme.scrollBarTrackColor;
|
|
67
53
|
});
|
|
68
|
-
|
|
69
|
-
var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n height: 60px;\n }\n & td {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th:first-child {\n border-top-left-radius: ", ";\n }\n & th:last-child {\n border-top-right-radius: ", ";\n }\n & td:last-child {\n padding-right: 40px;\n }\n"])), function (props) {
|
|
54
|
+
var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n height: ", ";\n }\n & td {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th:first-child {\n border-top-left-radius: ", ";\n padding-left: ", ";\n }\n & th:last-child {\n border-top-right-radius: ", ";\n padding-right: ", ";\n }\n & td:first-child {\n padding-left: ", ";\n }\n & td:last-child {\n padding-right: ", ";\n }\n"])), function (props) {
|
|
70
55
|
return "".concat(props.theme.rowSeparatorThickness, " ").concat(props.theme.rowSeparatorStyle, " ").concat(props.theme.rowSeparatorColor);
|
|
56
|
+
}, function (props) {
|
|
57
|
+
return props.mode === "default" ? "60px" : "36px";
|
|
71
58
|
}, function (props) {
|
|
72
59
|
return props.theme.dataBackgroundColor;
|
|
73
60
|
}, function (props) {
|
|
@@ -87,7 +74,7 @@ var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_t
|
|
|
87
74
|
}, function (props) {
|
|
88
75
|
return props.theme.dataTextLineHeight;
|
|
89
76
|
}, function (props) {
|
|
90
|
-
return "".concat(props.theme.dataPaddingTop, " ").concat(props.theme.dataPaddingRight, " ").concat(props.theme.dataPaddingBottom, " ").concat(props.theme.dataPaddingLeft);
|
|
77
|
+
return props.mode === "default" ? "".concat(props.theme.dataPaddingTop, " ").concat(props.theme.dataPaddingRight, " ").concat(props.theme.dataPaddingBottom, " ").concat(props.theme.dataPaddingLeft) : "".concat(_coreTokens["default"].spacing_8, " ").concat(_coreTokens["default"].spacing_16);
|
|
91
78
|
}, function (props) {
|
|
92
79
|
return props.theme.headerBackgroundColor;
|
|
93
80
|
}, function (props) {
|
|
@@ -107,12 +94,18 @@ var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_t
|
|
|
107
94
|
}, function (props) {
|
|
108
95
|
return props.theme.headerTextLineHeight;
|
|
109
96
|
}, function (props) {
|
|
110
|
-
return "".concat(props.theme.headerPaddingTop, " ").concat(props.theme.headerPaddingRight, " ").concat(props.theme.headerPaddingBottom, " ").concat(props.theme.headerPaddingLeft);
|
|
97
|
+
return props.mode === "default" ? "".concat(props.theme.headerPaddingTop, " ").concat(props.theme.headerPaddingRight, " ").concat(props.theme.headerPaddingBottom, " ").concat(props.theme.headerPaddingLeft) : "".concat(_coreTokens["default"].spacing_8, " ").concat(_coreTokens["default"].spacing_16);
|
|
111
98
|
}, function (props) {
|
|
112
99
|
return props.theme.headerBorderRadius;
|
|
100
|
+
}, function (props) {
|
|
101
|
+
return props.mode === "default" ? _coreTokens["default"].spacing_24 : "20px";
|
|
113
102
|
}, function (props) {
|
|
114
103
|
return props.theme.headerBorderRadius;
|
|
104
|
+
}, function (props) {
|
|
105
|
+
return props.mode === "default" ? _coreTokens["default"].spacing_24 : "20px";
|
|
106
|
+
}, function (props) {
|
|
107
|
+
return props.mode === "default" ? _coreTokens["default"].spacing_24 : "20px";
|
|
108
|
+
}, function (props) {
|
|
109
|
+
return props.mode === "default" ? _coreTokens["default"].spacing_24 : "20px";
|
|
115
110
|
});
|
|
116
|
-
|
|
117
|
-
var _default = DxcTable;
|
|
118
|
-
exports["default"] = _default;
|
|
111
|
+
var _default = exports["default"] = DxcTable;
|
|
@@ -117,6 +117,104 @@ export const Chromatic = () => (
|
|
|
117
117
|
</DxcTable>
|
|
118
118
|
</div>
|
|
119
119
|
</ExampleContainer>
|
|
120
|
+
<ExampleContainer>
|
|
121
|
+
<Title title="Default reduced" theme="light" level={4} />
|
|
122
|
+
<DxcTable mode="reduced">
|
|
123
|
+
<tr>
|
|
124
|
+
<th>header 1</th>
|
|
125
|
+
<th>header 2</th>
|
|
126
|
+
<th>header 3</th>
|
|
127
|
+
</tr>
|
|
128
|
+
<tr>
|
|
129
|
+
<td>cell 1</td>
|
|
130
|
+
<td>cell 2</td>
|
|
131
|
+
<td>cell 3</td>
|
|
132
|
+
</tr>
|
|
133
|
+
<tr>
|
|
134
|
+
<td>cell 4</td>
|
|
135
|
+
<td>cell 5</td>
|
|
136
|
+
<td>cell 6</td>
|
|
137
|
+
</tr>
|
|
138
|
+
<tr>
|
|
139
|
+
<td>cell 7</td>
|
|
140
|
+
<td>cell 8</td>
|
|
141
|
+
<td>Cell 9</td>
|
|
142
|
+
</tr>
|
|
143
|
+
</DxcTable>
|
|
144
|
+
</ExampleContainer>
|
|
145
|
+
<ExampleContainer>
|
|
146
|
+
<Title title="Reduced with scrollbar" theme="light" level={4} />
|
|
147
|
+
<div
|
|
148
|
+
style={{ height: 200 + "px", display: "flex", flexDirection: "row", width: 100 + "%", marginBottom: 50 + "px" }}
|
|
149
|
+
>
|
|
150
|
+
<DxcTable mode="reduced">
|
|
151
|
+
<tr>
|
|
152
|
+
<th>
|
|
153
|
+
header<br></br>subheader
|
|
154
|
+
</th>
|
|
155
|
+
<th>
|
|
156
|
+
header<br></br>subheader
|
|
157
|
+
</th>
|
|
158
|
+
<th>
|
|
159
|
+
header<br></br>subheader
|
|
160
|
+
</th>
|
|
161
|
+
</tr>
|
|
162
|
+
<tr>
|
|
163
|
+
<td>
|
|
164
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
165
|
+
dolore magna aliqua.
|
|
166
|
+
</td>
|
|
167
|
+
<td>
|
|
168
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
169
|
+
consequat.
|
|
170
|
+
</td>
|
|
171
|
+
<td>
|
|
172
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
173
|
+
</td>
|
|
174
|
+
</tr>
|
|
175
|
+
<tr>
|
|
176
|
+
<td>cell data</td>
|
|
177
|
+
<td>cell data</td>
|
|
178
|
+
<td>cell data</td>
|
|
179
|
+
</tr>
|
|
180
|
+
<tr>
|
|
181
|
+
<td>cell data</td>
|
|
182
|
+
<td>cell data</td>
|
|
183
|
+
<td>cell data</td>
|
|
184
|
+
</tr>
|
|
185
|
+
<tr>
|
|
186
|
+
<td>cell data</td>
|
|
187
|
+
<td>cell data</td>
|
|
188
|
+
<td>cell data</td>
|
|
189
|
+
</tr>
|
|
190
|
+
<tr>
|
|
191
|
+
<td>cell data</td>
|
|
192
|
+
<td>cell data</td>
|
|
193
|
+
<td>cell data</td>
|
|
194
|
+
</tr>
|
|
195
|
+
<tr>
|
|
196
|
+
<td>cell data</td>
|
|
197
|
+
<td>cell data</td>
|
|
198
|
+
<td>cell data</td>
|
|
199
|
+
</tr>
|
|
200
|
+
<tr>
|
|
201
|
+
<td>cell data</td>
|
|
202
|
+
<td>cell data</td>
|
|
203
|
+
<td>cell data</td>
|
|
204
|
+
</tr>
|
|
205
|
+
<tr>
|
|
206
|
+
<td>cell data</td>
|
|
207
|
+
<td>cell data</td>
|
|
208
|
+
<td>cell data</td>
|
|
209
|
+
</tr>
|
|
210
|
+
<tr>
|
|
211
|
+
<td>cell data</td>
|
|
212
|
+
<td>cell data</td>
|
|
213
|
+
<td>cell data</td>
|
|
214
|
+
</tr>
|
|
215
|
+
</DxcTable>
|
|
216
|
+
</div>
|
|
217
|
+
</ExampleContainer>
|
|
120
218
|
<Title title="Margins" theme="light" level={2} />
|
|
121
219
|
<ExampleContainer>
|
|
122
220
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
package/table/Table.test.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
5
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
6
|
var _Table = _interopRequireDefault(require("./Table.tsx"));
|
|
10
|
-
|
|
11
7
|
describe("Table component tests", function () {
|
|
12
8
|
test("Table renders with correct content", function () {
|
|
13
9
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Table["default"], null, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, "header-1"), /*#__PURE__*/_react["default"].createElement("th", null, "header-2"), /*#__PURE__*/_react["default"].createElement("th", null, "header-3"))), /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-1"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-2"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-3")), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-4"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-5"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-6"))))),
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
getByText = _render.getByText;
|
|
16
11
|
expect(getByText("header-1")).toBeTruthy();
|
|
17
12
|
expect(getByText("header-2")).toBeTruthy();
|
|
18
13
|
expect(getByText("header-3")).toBeTruthy();
|
package/table/types.d.ts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type Props = {
|
|
10
|
+
/**
|
|
11
|
+
* The center section of the table. Can be used to render custom
|
|
12
|
+
* content in this area.
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
10
15
|
/**
|
|
11
16
|
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
12
17
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
13
18
|
*/
|
|
14
19
|
margin?: Space | Margin;
|
|
15
20
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
21
|
+
* Determines the visual style and layout
|
|
22
|
+
* - "default": Table with big spacing, applicable to most cases.
|
|
23
|
+
* - "reduced": Smaller table with minimal spacing for high density information.
|
|
18
24
|
*/
|
|
19
|
-
|
|
25
|
+
mode?: "default" | "reduced";
|
|
20
26
|
};
|
|
21
27
|
export default Props;
|
package/tabs/Tab.js
CHANGED
|
@@ -1,48 +1,35 @@
|
|
|
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
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
|
-
|
|
18
12
|
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
19
|
-
|
|
20
13
|
var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
|
|
21
|
-
|
|
22
14
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
|
-
|
|
24
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
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; }
|
|
30
18
|
var Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
31
19
|
var active = _ref.active,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
tab = _ref.tab,
|
|
21
|
+
tabIndex = _ref.tabIndex,
|
|
22
|
+
hasLabelAndIcon = _ref.hasLabelAndIcon,
|
|
23
|
+
iconPosition = _ref.iconPosition,
|
|
24
|
+
_onClick = _ref.onClick,
|
|
25
|
+
_onMouseEnter = _ref.onMouseEnter,
|
|
26
|
+
_onMouseLeave = _ref.onMouseLeave;
|
|
39
27
|
var colorsTheme = (0, _useTheme["default"])();
|
|
40
28
|
return /*#__PURE__*/_react["default"].createElement(TabContainer, {
|
|
41
29
|
role: "tab",
|
|
42
30
|
type: "button",
|
|
43
31
|
tabIndex: tabIndex,
|
|
44
32
|
disabled: tab.isDisabled,
|
|
45
|
-
"aria-disabled": tab.isDisabled,
|
|
46
33
|
"aria-selected": active,
|
|
47
34
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
48
35
|
iconPosition: iconPosition,
|
|
@@ -57,9 +44,10 @@ var Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
57
44
|
_onMouseLeave();
|
|
58
45
|
}
|
|
59
46
|
}, /*#__PURE__*/_react["default"].createElement(MainLabelContainer, {
|
|
60
|
-
|
|
47
|
+
notificationNumber: tab.notificationNumber,
|
|
61
48
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
62
|
-
iconPosition: iconPosition
|
|
49
|
+
iconPosition: iconPosition,
|
|
50
|
+
disabled: tab.isDisabled
|
|
63
51
|
}, tab.icon && /*#__PURE__*/_react["default"].createElement(TabIconContainer, {
|
|
64
52
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
65
53
|
iconPosition: iconPosition
|
|
@@ -74,15 +62,16 @@ var Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
74
62
|
textAlign: "center",
|
|
75
63
|
letterSpacing: "0.025em",
|
|
76
64
|
lineHeight: "1.715em"
|
|
77
|
-
}, tab.label)), tab.notificationNumber && tab.
|
|
65
|
+
}, tab.label)), tab.notificationNumber && !tab.isDisabled && /*#__PURE__*/_react["default"].createElement(BadgeContainer, {
|
|
78
66
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
79
67
|
iconPosition: iconPosition
|
|
80
68
|
}, /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
|
|
81
|
-
|
|
69
|
+
mode: "notification",
|
|
70
|
+
size: "small",
|
|
71
|
+
label: typeof tab.notificationNumber === "number" && tab.notificationNumber
|
|
82
72
|
})));
|
|
83
73
|
});
|
|
84
|
-
|
|
85
|
-
var TabContainer = _styledComponents["default"].button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n text-transform: ", ";\n overflow: hidden;\n flex-shrink: 0;\n border: 0;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n user-select: none;\n vertical-align: middle;\n justify-content: center;\n min-width: 90px;\n max-width: 360px;\n padding: ", ";\n height: ", ";\n min-height: ", ";\n background-color: ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n &:focus {\n outline: ", " solid 1px;\n outline-offset: -1px;\n }\n svg {\n color: ", ";\n }\n\n &[aria-selected=\"true\"] {\n background-color: ", ";\n svg {\n color: ", ";\n }\n opacity: 1;\n }\n\n &[aria-disabled=\"true\"] {\n background-color: ", " !important;\n cursor: not-allowed !important;\n pointer-events: all;\n font-style: ", ";\n svg {\n color: ", ";\n }\n outline: none !important;\n > div {\n opacity: 0.5;\n }\n }\n"])), function (props) {
|
|
74
|
+
var TabContainer = _styledComponents["default"].button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n text-transform: ", ";\n overflow: hidden;\n flex-shrink: 0;\n border: 0;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n user-select: none;\n vertical-align: middle;\n justify-content: center;\n min-width: 90px;\n max-width: 360px;\n padding: ", ";\n height: ", ";\n min-height: ", ";\n background-color: ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n &:focus {\n outline: ", " solid 1px;\n outline-offset: -1px;\n }\n svg {\n color: ", ";\n }\n\n &[aria-selected=\"true\"] {\n background-color: ", ";\n svg {\n color: ", ";\n }\n opacity: 1;\n }\n\n &:disabled {\n background-color: ", " !important;\n cursor: not-allowed !important;\n pointer-events: all;\n font-style: ", ";\n outline: none !important;\n\n svg {\n color: ", ";\n }\n > div {\n opacity: 0.5;\n }\n }\n"])), function (props) {
|
|
86
75
|
return props.theme.fontTextTransform;
|
|
87
76
|
}, function (props) {
|
|
88
77
|
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "12px 16px" || "8px 16px";
|
|
@@ -111,23 +100,17 @@ var TabContainer = _styledComponents["default"].button(_templateObject || (_temp
|
|
|
111
100
|
}, function (props) {
|
|
112
101
|
return props.theme.disabledIconColor;
|
|
113
102
|
});
|
|
114
|
-
|
|
115
103
|
var BadgeContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 12px;\n height: 100%;\n display: flex;\n align-items: ", ";\n"])), function (props) {
|
|
116
104
|
return props.hasLabelAndIcon && props.iconPosition === "top" ? "flex-start" : "center";
|
|
117
105
|
});
|
|
118
|
-
|
|
119
106
|
var MainLabelContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n align-items: center;\n margin-left: ", ";\n"])), function (props) {
|
|
120
107
|
return props.hasLabelAndIcon && props.iconPosition === "top" && "column" || "row";
|
|
121
108
|
}, function (props) {
|
|
122
|
-
return props.
|
|
109
|
+
return props.notificationNumber && !props.disabled ? typeof props.notificationNumber === "number" ? "36px" : "18px" : "unset";
|
|
123
110
|
});
|
|
124
|
-
|
|
125
111
|
var TabIconContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-bottom: ", ";\n margin-right: ", ";\n\n img,\n svg {\n height: 22px;\n width: 22px;\n }\n"])), function (props) {
|
|
126
112
|
return props.hasLabelAndIcon && props.iconPosition === "top" && "8px" || "";
|
|
127
113
|
}, function (props) {
|
|
128
114
|
return props.hasLabelAndIcon && props.iconPosition === "left" && "12px" || "";
|
|
129
115
|
});
|
|
130
|
-
|
|
131
|
-
var _default = /*#__PURE__*/_react["default"].memo(Tab);
|
|
132
|
-
|
|
133
|
-
exports["default"] = _default;
|
|
116
|
+
var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(Tab);
|