@dxc-technology/halstack-react 0.0.0-b50ba80 → 0.0.0-b5ec444
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 +1245 -6
- package/HalstackContext.js +181 -114
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +116 -160
- package/accordion/Accordion.stories.tsx +102 -126
- package/accordion/Accordion.test.js +25 -41
- package/accordion/types.d.ts +5 -16
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +31 -98
- package/accordion-group/AccordionGroup.stories.tsx +94 -67
- package/accordion-group/AccordionGroup.test.js +52 -105
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/types.d.ts +11 -16
- 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 +23 -59
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +29 -46
- package/alert/types.d.ts +5 -5
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +141 -41
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -2
- package/bleed/Bleed.js +14 -55
- package/bleed/Bleed.stories.tsx +95 -95
- package/bleed/types.d.ts +2 -2
- package/box/Box.d.ts +1 -1
- package/box/Box.js +30 -81
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +2 -7
- package/box/types.d.ts +3 -14
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +89 -0
- package/bulleted-list/BulletedList.stories.tsx +115 -0
- package/bulleted-list/types.d.ts +38 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +63 -117
- package/button/Button.stories.tsx +160 -90
- package/button/Button.test.js +20 -17
- package/button/types.d.ts +12 -8
- package/card/Card.d.ts +1 -1
- package/card/Card.js +64 -107
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +11 -22
- package/card/types.d.ts +6 -11
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +142 -181
- package/checkbox/Checkbox.stories.tsx +128 -94
- package/checkbox/Checkbox.test.js +160 -39
- 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 +1395 -0
- package/common/variables.js +1025 -1134
- 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 +152 -298
- 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 +73 -107
- package/dialog/Dialog.stories.tsx +320 -167
- package/dialog/Dialog.test.js +287 -20
- package/dialog/types.d.ts +18 -25
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +248 -303
- package/dropdown/Dropdown.stories.tsx +245 -56
- package/dropdown/Dropdown.test.js +575 -165
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +63 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +67 -0
- package/dropdown/types.d.ts +32 -14
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +246 -357
- 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.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +112 -0
- package/flex/types.d.ts +97 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +72 -117
- package/footer/Footer.stories.tsx +60 -19
- package/footer/Footer.test.js +33 -57
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +67 -8
- package/footer/types.d.ts +25 -26
- 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 +90 -170
- package/header/Header.stories.tsx +118 -39
- package/header/Header.test.js +13 -26
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +4 -9
- package/header/types.d.ts +5 -19
- 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/inset/Inset.js +14 -55
- package/inset/Inset.stories.tsx +37 -36
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +82 -166
- package/layout/ApplicationLayout.stories.tsx +85 -94
- package/layout/Icons.d.ts +8 -0
- package/layout/Icons.js +51 -48
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +13 -0
- package/layout/types.d.ts +19 -35
- package/link/Link.d.ts +2 -2
- package/link/Link.js +42 -89
- package/link/Link.stories.tsx +73 -6
- package/link/Link.test.js +24 -44
- package/link/types.d.ts +14 -15
- package/main.d.ts +13 -13
- package/main.js +57 -101
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +93 -0
- package/nav-tabs/NavTabs.stories.tsx +276 -0
- package/nav-tabs/NavTabs.test.js +76 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +118 -0
- package/nav-tabs/types.d.ts +52 -0
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +47 -37
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +860 -377
- package/number-input/types.d.ts +11 -5
- package/package.json +43 -45
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +21 -47
- package/paginator/Paginator.js +34 -91
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +280 -211
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +22 -0
- package/paragraph/Paragraph.stories.tsx +27 -0
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.js +57 -123
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +160 -143
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.js +65 -91
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.js +72 -44
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.js +71 -44
- package/quick-nav/QuickNav.stories.tsx +146 -27
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +59 -76
- package/radio-group/RadioGroup.js +71 -116
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +518 -457
- package/radio-group/types.d.ts +10 -10
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/resultset-table/ResultsetTable.js +167 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +152 -30
- package/resultset-table/ResultsetTable.test.js +371 -0
- 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.d.ts +1 -1
- package/select/Listbox.js +45 -51
- package/select/Option.js +27 -50
- package/select/Select.js +181 -246
- package/select/Select.stories.tsx +525 -136
- package/select/Select.test.js +2009 -1696
- package/select/types.d.ts +16 -20
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +131 -71
- package/sidenav/Sidenav.stories.tsx +251 -151
- package/sidenav/Sidenav.test.js +26 -45
- package/sidenav/types.d.ts +52 -26
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +148 -181
- package/slider/Slider.test.js +185 -81
- 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 +2 -2
- package/switch/Switch.js +147 -125
- package/switch/Switch.stories.tsx +37 -60
- package/switch/Switch.test.js +138 -56
- package/switch/types.d.ts +7 -3
- package/table/ActionsCell.d.ts +4 -0
- package/table/ActionsCell.js +68 -0
- package/table/DropdownTheme.js +62 -0
- package/table/Table.d.ts +4 -1
- package/table/Table.js +26 -32
- package/table/Table.stories.tsx +658 -0
- package/table/Table.test.js +95 -8
- package/table/types.d.ts +45 -6
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +116 -0
- package/tabs/Tabs.js +314 -141
- package/tabs/Tabs.stories.tsx +120 -6
- package/tabs/Tabs.test.js +223 -69
- package/tabs/types.d.ts +28 -18
- package/tag/Tag.js +29 -61
- 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 +8 -0
- package/text-input/Icons.js +56 -0
- package/text-input/Suggestion.js +40 -28
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +84 -0
- package/text-input/TextInput.js +318 -524
- package/text-input/TextInput.stories.tsx +266 -275
- package/text-input/TextInput.test.js +1419 -1375
- package/text-input/types.d.ts +43 -16
- package/textarea/Textarea.js +79 -131
- 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 +4 -0
- package/typography/Typography.js +23 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1147 -1
- package/useTheme.js +2 -9
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +14 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +124 -0
- package/wizard/Wizard.js +51 -91
- package/wizard/Wizard.stories.tsx +40 -1
- package/wizard/Wizard.test.js +54 -81
- package/wizard/types.d.ts +7 -7
- package/card/ice-cream.jpg +0 -0
- package/common/RequiredComponent.js +0 -32
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/progress-bar/ProgressBar.stories.jsx +0 -58
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/resultsetTable/ResultsetTable.js +0 -254
- package/resultsetTable/ResultsetTable.test.js +0 -306
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/slider/Slider.stories.tsx +0 -177
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/table/Table.stories.jsx +0 -277
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- package/textarea/Textarea.stories.jsx +0 -157
- /package/{list → action-icon}/types.js +0 -0
- /package/{radio → bulleted-list}/types.js +0 -0
- /package/{resultsetTable → container}/types.js +0 -0
- /package/{row → flex}/types.js +0 -0
- /package/{stack → grid}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
package/switch/Switch.test.js
CHANGED
|
@@ -1,98 +1,180 @@
|
|
|
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
|
-
var _Switch = _interopRequireDefault(require("./Switch"));
|
|
10
|
-
|
|
6
|
+
var _Switch = _interopRequireDefault(require("./Switch.tsx"));
|
|
11
7
|
describe("Switch component tests", function () {
|
|
12
8
|
test("Switch renders with correct text", function () {
|
|
13
9
|
var onChange = jest.fn(function (returnedValue) {
|
|
14
10
|
expect(returnedValue).toBe(true);
|
|
15
11
|
});
|
|
16
|
-
|
|
17
12
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
label: "SwitchComponent",
|
|
14
|
+
checked: false,
|
|
15
|
+
onChange: onChange
|
|
16
|
+
})),
|
|
17
|
+
getByText = _render.getByText;
|
|
24
18
|
expect(getByText("SwitchComponent")).toBeTruthy();
|
|
25
19
|
});
|
|
26
20
|
test("Calls correct function on click", function () {
|
|
27
21
|
var onChange = jest.fn();
|
|
28
|
-
|
|
29
22
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
label: "SwitchComponent",
|
|
24
|
+
checked: false,
|
|
25
|
+
onChange: onChange
|
|
26
|
+
})),
|
|
27
|
+
getByText = _render2.getByText;
|
|
36
28
|
_react2.fireEvent.click(getByText("SwitchComponent"));
|
|
37
|
-
|
|
38
29
|
expect(onChange).toHaveBeenCalled();
|
|
39
30
|
});
|
|
40
|
-
test("
|
|
31
|
+
test("Calls correct function on key down", function () {
|
|
41
32
|
var onChange = jest.fn();
|
|
42
|
-
|
|
43
33
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
label: "SwitchComponent",
|
|
35
|
+
checked: false,
|
|
36
|
+
onChange: onChange
|
|
37
|
+
})),
|
|
38
|
+
getByText = _render3.getByText;
|
|
39
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
40
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
41
|
+
key: "Enter"
|
|
42
|
+
});
|
|
43
|
+
expect(onChange).toHaveBeenCalled();
|
|
44
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
45
|
+
key: " "
|
|
46
|
+
});
|
|
47
|
+
expect(onChange).toHaveBeenCalled();
|
|
48
|
+
});
|
|
49
|
+
test("Everytime the user clicks the component the onchange function is called with the correct value CONTROLLED COMPONENT", function () {
|
|
50
|
+
var onChange = jest.fn();
|
|
51
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
52
|
+
label: "SwitchComponent",
|
|
53
|
+
checked: false,
|
|
54
|
+
onChange: onChange
|
|
55
|
+
})),
|
|
56
|
+
getByText = _render4.getByText;
|
|
50
57
|
_react2.fireEvent.click(getByText("SwitchComponent"));
|
|
51
|
-
|
|
52
58
|
_react2.fireEvent.click(getByText("SwitchComponent"));
|
|
53
|
-
|
|
59
|
+
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
60
|
+
expect(onChange.mock.calls[1][0]).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
test("Everytime the user use enter in the component, the onchange function is called with the correct value CONTROLLED COMPONENT", function () {
|
|
63
|
+
var onChange = jest.fn();
|
|
64
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
65
|
+
label: "SwitchComponent",
|
|
66
|
+
checked: false,
|
|
67
|
+
onChange: onChange
|
|
68
|
+
})),
|
|
69
|
+
getByText = _render5.getByText;
|
|
70
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
71
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
72
|
+
key: "Enter"
|
|
73
|
+
});
|
|
74
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
75
|
+
key: "Enter"
|
|
76
|
+
});
|
|
77
|
+
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
78
|
+
expect(onChange.mock.calls[1][0]).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
test("Everytime the user use space in the component, the onchange function is called with the correct value CONTROLLED COMPONENT", function () {
|
|
81
|
+
var onChange = jest.fn();
|
|
82
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
83
|
+
label: "SwitchComponent",
|
|
84
|
+
checked: false,
|
|
85
|
+
onChange: onChange
|
|
86
|
+
})),
|
|
87
|
+
getByText = _render6.getByText;
|
|
88
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
89
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
90
|
+
key: " "
|
|
91
|
+
});
|
|
92
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
93
|
+
key: " "
|
|
94
|
+
});
|
|
54
95
|
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
55
96
|
expect(onChange.mock.calls[1][0]).toBe(true);
|
|
56
97
|
});
|
|
57
98
|
test("Everytime the user clicks the component the onchange function is called with the correct value UNCONTROLLED COMPONENT", function () {
|
|
58
99
|
var onChange = jest.fn();
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
getByText = _render4.getByText;
|
|
65
|
-
|
|
100
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
101
|
+
label: "SwitchComponent",
|
|
102
|
+
onChange: onChange
|
|
103
|
+
})),
|
|
104
|
+
getByText = _render7.getByText;
|
|
66
105
|
_react2.fireEvent.click(getByText("SwitchComponent"));
|
|
67
|
-
|
|
68
106
|
_react2.fireEvent.click(getByText("SwitchComponent"));
|
|
69
|
-
|
|
107
|
+
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
108
|
+
expect(onChange.mock.calls[1][0]).toBe(false);
|
|
109
|
+
});
|
|
110
|
+
test("Everytime the user use enter in the component, the onchange function is called with the correct value UNCONTROLLED COMPONENT", function () {
|
|
111
|
+
var onChange = jest.fn();
|
|
112
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
113
|
+
label: "SwitchComponent",
|
|
114
|
+
onChange: onChange
|
|
115
|
+
})),
|
|
116
|
+
getByText = _render8.getByText;
|
|
117
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
118
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
119
|
+
key: "Enter"
|
|
120
|
+
});
|
|
121
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
122
|
+
key: "Enter"
|
|
123
|
+
});
|
|
124
|
+
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
125
|
+
expect(onChange.mock.calls[1][0]).toBe(false);
|
|
126
|
+
});
|
|
127
|
+
test("Everytime the user use space in the component, the onchange function is called with the correct value UNCONTROLLED COMPONENT", function () {
|
|
128
|
+
var onChange = jest.fn();
|
|
129
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
130
|
+
label: "SwitchComponent",
|
|
131
|
+
onChange: onChange
|
|
132
|
+
})),
|
|
133
|
+
getByText = _render9.getByText;
|
|
134
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
135
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
136
|
+
key: " "
|
|
137
|
+
});
|
|
138
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
139
|
+
key: " "
|
|
140
|
+
});
|
|
70
141
|
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
71
142
|
expect(onChange.mock.calls[1][0]).toBe(false);
|
|
72
143
|
});
|
|
73
144
|
test("Renders with correct initial value and initial state when it is uncontrolled", function () {
|
|
74
|
-
var
|
|
145
|
+
var component = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
75
146
|
label: "Default label",
|
|
76
147
|
defaultChecked: true,
|
|
77
|
-
value: "test-defaultChecked"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var inputEl =
|
|
82
|
-
expect(inputEl.checked).toBe(true);
|
|
148
|
+
value: "test-defaultChecked",
|
|
149
|
+
name: "test"
|
|
150
|
+
}));
|
|
151
|
+
var switchEl = component.getByRole("switch");
|
|
152
|
+
var inputEl = component.container.querySelector("input[name=\"test\"]");
|
|
83
153
|
expect(inputEl.value).toBe("test-defaultChecked");
|
|
84
|
-
expect(
|
|
154
|
+
expect(switchEl.getAttribute("aria-checked")).toBe("true");
|
|
85
155
|
});
|
|
86
156
|
test("Renders with correct aria attributes", function () {
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var
|
|
157
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
158
|
+
label: "Default label"
|
|
159
|
+
})),
|
|
160
|
+
getByText = _render10.getByText,
|
|
161
|
+
getByRole = _render10.getByRole;
|
|
162
|
+
var switchEl = getByRole("switch");
|
|
163
|
+
var label = getByText("Default label");
|
|
164
|
+
expect(switchEl.getAttribute("aria-labelledby")).toBe(label.id);
|
|
165
|
+
expect(switchEl.getAttribute("aria-checked")).toBe("false");
|
|
166
|
+
});
|
|
167
|
+
test("Renders disabled switch correctly", function () {
|
|
168
|
+
var _render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
169
|
+
label: "Default label",
|
|
170
|
+
disabled: true
|
|
171
|
+
})),
|
|
172
|
+
getByText = _render11.getByText,
|
|
173
|
+
getByRole = _render11.getByRole;
|
|
174
|
+
var switchEl = getByRole("switch");
|
|
94
175
|
var label = getByText("Default label");
|
|
95
|
-
expect(
|
|
96
|
-
expect(
|
|
176
|
+
expect(switchEl.getAttribute("aria-labelledby")).toBe(label.id);
|
|
177
|
+
expect(switchEl.getAttribute("aria-checked")).toBe("false");
|
|
178
|
+
expect(switchEl.getAttribute("aria-disabled")).toBe("true");
|
|
97
179
|
});
|
|
98
180
|
});
|
package/switch/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
type Margin = {
|
|
3
3
|
top?: Space;
|
|
4
4
|
bottom?: Space;
|
|
5
5
|
left?: Space;
|
|
6
6
|
right?: Space;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type Props = {
|
|
9
9
|
/**
|
|
10
10
|
* Initial state of the switch, only when it is uncontrolled.
|
|
11
11
|
*/
|
|
@@ -59,4 +59,8 @@ declare type Props = {
|
|
|
59
59
|
*/
|
|
60
60
|
tabIndex?: number;
|
|
61
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Reference to the component.
|
|
64
|
+
*/
|
|
65
|
+
export type RefType = HTMLDivElement;
|
|
62
66
|
export default Props;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _ActionIcon = _interopRequireDefault(require("../action-icon/ActionIcon"));
|
|
10
|
+
var _main = require("../main");
|
|
11
|
+
var _DropdownTheme = _interopRequireDefault(require("./DropdownTheme"));
|
|
12
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
13
|
+
var moreVertIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
height: "24",
|
|
16
|
+
viewBox: "0 -960 960 960",
|
|
17
|
+
width: "24",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
20
|
+
d: "M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"
|
|
21
|
+
}));
|
|
22
|
+
var overwriteTheme = function overwriteTheme(theme) {
|
|
23
|
+
var newTheme = _DropdownTheme["default"];
|
|
24
|
+
newTheme.dropdown.buttonBackgroundColor = theme.table.actionBackgroundColor;
|
|
25
|
+
newTheme.dropdown.hoverButtonBackgroundColor = theme.table.hoverActionBackgroundColor;
|
|
26
|
+
newTheme.dropdown.activeButtonBackgroundColor = theme.table.activeActionBackgroundColor;
|
|
27
|
+
newTheme.dropdown.buttonIconColor = theme.table.actionIconColor;
|
|
28
|
+
newTheme.dropdown.disabledColor = theme.table.disabledActionIconColor;
|
|
29
|
+
newTheme.dropdown.disabledButtonBackgroundColor = theme.table.disabledActionBackgroundColor;
|
|
30
|
+
console.log(newTheme);
|
|
31
|
+
return newTheme;
|
|
32
|
+
};
|
|
33
|
+
var DxcActionsCell = function DxcActionsCell(_ref) {
|
|
34
|
+
var actions = _ref.actions;
|
|
35
|
+
var actionIcons = actions.filter(function (action) {
|
|
36
|
+
return !action.options;
|
|
37
|
+
});
|
|
38
|
+
var actionDropdown = actions.find(function (action) {
|
|
39
|
+
return action.options;
|
|
40
|
+
});
|
|
41
|
+
var maxNumberOfActions = actionDropdown ? 2 : 3;
|
|
42
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(_main.DxcFlex, {
|
|
44
|
+
gap: "0.5rem",
|
|
45
|
+
alignItems: "center"
|
|
46
|
+
}, actionIcons.map(function (action, index) {
|
|
47
|
+
var _action$disabled, _action$tabIndex;
|
|
48
|
+
return index < maxNumberOfActions && /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
49
|
+
icon: action.icon,
|
|
50
|
+
title: action.title,
|
|
51
|
+
onClick: action.onClick,
|
|
52
|
+
disabled: (_action$disabled = action.disabled) !== null && _action$disabled !== void 0 ? _action$disabled : false,
|
|
53
|
+
tabIndex: (_action$tabIndex = action.tabIndex) !== null && _action$tabIndex !== void 0 ? _action$tabIndex : 0,
|
|
54
|
+
key: "action-".concat(index)
|
|
55
|
+
});
|
|
56
|
+
}), actionDropdown && /*#__PURE__*/_react["default"].createElement(_main.HalstackProvider, {
|
|
57
|
+
advancedTheme: overwriteTheme(colorsTheme),
|
|
58
|
+
key: "provider-dropdown"
|
|
59
|
+
}, /*#__PURE__*/_react["default"].createElement(_main.DxcDropdown, {
|
|
60
|
+
options: actionDropdown.options,
|
|
61
|
+
onSelectOption: actionDropdown.onClick,
|
|
62
|
+
disabled: actionDropdown.disabled,
|
|
63
|
+
icon: moreVertIcon,
|
|
64
|
+
tabIndex: actionDropdown.tabIndex,
|
|
65
|
+
caretHidden: true
|
|
66
|
+
})));
|
|
67
|
+
};
|
|
68
|
+
var _default = exports["default"] = DxcActionsCell;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _variables = require("../common/variables");
|
|
8
|
+
var _default = exports["default"] = {
|
|
9
|
+
dropdown: {
|
|
10
|
+
// ActionIcon size tokens
|
|
11
|
+
buttonIconSize: "16px",
|
|
12
|
+
buttonPaddingTop: "4px",
|
|
13
|
+
buttonPaddingBottom: "4px",
|
|
14
|
+
buttonPaddingLeft: "4px",
|
|
15
|
+
buttonPaddingRight: "4px",
|
|
16
|
+
buttonHeight: "24px",
|
|
17
|
+
buttonBorderRadius: "2px",
|
|
18
|
+
buttonBorderStyle: "none",
|
|
19
|
+
buttonBorderThickness: "0px",
|
|
20
|
+
buttonBorderColor: "transparent",
|
|
21
|
+
optionFontSize: "14px",
|
|
22
|
+
optionPaddingTop: "0px",
|
|
23
|
+
optionPaddingBottom: "0px",
|
|
24
|
+
optionPaddingLeft: "16px",
|
|
25
|
+
optionPaddingRight: "16px",
|
|
26
|
+
// Dropdown tokens
|
|
27
|
+
buttonBackgroundColor: _variables.componentTokens.table.actionBackgroundColor,
|
|
28
|
+
hoverButtonBackgroundColor: _variables.componentTokens.table.hoverActionBackgroundColor,
|
|
29
|
+
activeButtonBackgroundColor: _variables.componentTokens.table.activeActionBackgroundColor,
|
|
30
|
+
buttonFontFamily: _variables.componentTokens.dropdown.buttonFontFamily,
|
|
31
|
+
buttonFontSize: _variables.componentTokens.dropdown.buttonFontSize,
|
|
32
|
+
buttonFontStyle: _variables.componentTokens.dropdown.buttonFontStyle,
|
|
33
|
+
buttonFontWeight: _variables.componentTokens.dropdown.buttonFontWeight,
|
|
34
|
+
buttonFontColor: _variables.componentTokens.dropdown.buttonFontColor,
|
|
35
|
+
buttonIconSpacing: _variables.componentTokens.dropdown.buttonIconSpacing,
|
|
36
|
+
buttonIconColor: _variables.componentTokens.table.actionIconColor,
|
|
37
|
+
disabledColor: _variables.componentTokens.table.disabledActionIconColor,
|
|
38
|
+
disabledButtonBorderColor: _variables.componentTokens.dropdown.disabledButtonBorderColor,
|
|
39
|
+
disabledButtonBackgroundColor: _variables.componentTokens.table.disabledActionBackgroundColor,
|
|
40
|
+
disabledBorderColor: _variables.componentTokens.dropdown.disabledBorderColor,
|
|
41
|
+
optionBackgroundColor: _variables.componentTokens.dropdown.optionBackgroundColor,
|
|
42
|
+
hoverOptionBackgroundColor: _variables.componentTokens.dropdown.hoverOptionBackgroundColor,
|
|
43
|
+
activeOptionBackgroundColor: _variables.componentTokens.dropdown.activeOptionBackgroundColor,
|
|
44
|
+
optionFontFamily: _variables.componentTokens.dropdown.optionFontFamily,
|
|
45
|
+
optionFontStyle: _variables.componentTokens.dropdown.optionFontStyle,
|
|
46
|
+
optionFontWeight: _variables.componentTokens.dropdown.optionFontWeight,
|
|
47
|
+
optionFontColor: _variables.componentTokens.dropdown.optionFontColor,
|
|
48
|
+
optionIconSize: _variables.componentTokens.dropdown.optionIconSize,
|
|
49
|
+
optionIconSpacing: _variables.componentTokens.dropdown.optionIconSpacing,
|
|
50
|
+
optionIconColor: _variables.componentTokens.dropdown.optionIconColor,
|
|
51
|
+
caretIconSize: _variables.componentTokens.dropdown.caretIconSize,
|
|
52
|
+
caretIconColor: _variables.componentTokens.dropdown.caretIconColor,
|
|
53
|
+
caretIconSpacing: _variables.componentTokens.dropdown.caretIconSpacing,
|
|
54
|
+
borderRadius: _variables.componentTokens.dropdown.borderRadius,
|
|
55
|
+
borderStyle: _variables.componentTokens.dropdown.borderStyle,
|
|
56
|
+
borderThickness: _variables.componentTokens.dropdown.borderThickness,
|
|
57
|
+
borderColor: _variables.componentTokens.dropdown.borderColor,
|
|
58
|
+
scrollBarThumbColor: _variables.componentTokens.dropdown.scrollBarThumbColor,
|
|
59
|
+
scrollBarTrackColor: _variables.componentTokens.dropdown.scrollBarTrackColor,
|
|
60
|
+
focusColor: _variables.componentTokens.table.focusActionBorderColor
|
|
61
|
+
}
|
|
62
|
+
};
|
package/table/Table.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import TablePropsType from "./types";
|
|
3
|
-
declare const DxcTable:
|
|
3
|
+
declare const DxcTable: {
|
|
4
|
+
({ children, margin, mode }: TablePropsType): JSX.Element;
|
|
5
|
+
ActionsCell: ({ actions }: import("./types").ActionCellsPropsType) => JSX.Element;
|
|
6
|
+
};
|
|
4
7
|
export default DxcTable;
|
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
|
-
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 _BackgroundColorContext = require("../BackgroundColorContext");
|
|
27
|
-
|
|
16
|
+
var _ActionsCell = _interopRequireDefault(require("./ActionsCell"));
|
|
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 }\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"])), 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(props.theme.dataPaddingTopReduced, " ").concat(props.theme.dataPaddingRightReduced, " ").concat(props.theme.dataPaddingBottomReduced, " ").concat(props.theme.dataPaddingLeftReduced);
|
|
91
78
|
}, function (props) {
|
|
92
79
|
return props.theme.headerBackgroundColor;
|
|
93
80
|
}, function (props) {
|
|
@@ -107,12 +94,19 @@ 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(props.theme.headerPaddingTopReduced, " ").concat(props.theme.headerPaddingRightReduced, " ").concat(props.theme.headerPaddingBottomReduced, " ").concat(props.theme.headerPaddingLeftReduced);
|
|
111
98
|
}, function (props) {
|
|
112
99
|
return props.theme.headerBorderRadius;
|
|
100
|
+
}, function (props) {
|
|
101
|
+
return props.mode === "default" ? props.theme.firstChildPaddingLeft : props.theme.firstChildPaddingLeftReduced;
|
|
113
102
|
}, function (props) {
|
|
114
103
|
return props.theme.headerBorderRadius;
|
|
104
|
+
}, function (props) {
|
|
105
|
+
return props.mode === "default" ? props.theme.lastChildPaddingRight : props.theme.lastChildPaddingRightReduced;
|
|
106
|
+
}, function (props) {
|
|
107
|
+
return props.mode === "default" ? props.theme.firstChildPaddingLeft : props.theme.firstChildPaddingLeftReduced;
|
|
108
|
+
}, function (props) {
|
|
109
|
+
return props.mode === "default" ? props.theme.lastChildPaddingRight : props.theme.lastChildPaddingRightReduced;
|
|
115
110
|
});
|
|
116
|
-
|
|
117
|
-
var _default = DxcTable;
|
|
118
|
-
exports["default"] = _default;
|
|
111
|
+
DxcTable.ActionsCell = _ActionsCell["default"];
|
|
112
|
+
var _default = exports["default"] = DxcTable;
|