@dxc-technology/halstack-react 0.0.0-dcd93c4 → 0.0.0-dcee34a
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/HalstackContext.js +98 -50
- package/accordion/Accordion.js +117 -104
- package/accordion/Accordion.stories.tsx +103 -15
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +1 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/alert/Alert.stories.tsx +28 -0
- package/bleed/Bleed.stories.tsx +63 -63
- package/box/Box.js +1 -1
- package/box/Box.stories.tsx +15 -0
- package/box/types.d.ts +1 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/button/Button.js +50 -70
- package/button/Button.stories.tsx +159 -8
- package/button/types.d.ts +7 -7
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -99
- package/checkbox/Checkbox.stories.tsx +131 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/Chip.js +16 -22
- package/chip/Chip.stories.tsx +96 -9
- package/chip/types.d.ts +1 -1
- package/common/variables.js +328 -260
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +134 -237
- package/date-input/DateInput.stories.tsx +199 -33
- package/date-input/DateInput.test.js +494 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +51 -0
- package/dialog/Dialog.js +50 -28
- package/dialog/Dialog.stories.tsx +99 -22
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +246 -249
- package/dropdown/Dropdown.stories.tsx +245 -56
- package/dropdown/Dropdown.test.js +504 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +70 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +81 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +177 -219
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/footer/Footer.stories.tsx +99 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +87 -87
- package/header/Header.stories.tsx +152 -9
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/inset/Inset.stories.tsx +4 -4
- package/layout/ApplicationLayout.d.ts +15 -6
- package/layout/ApplicationLayout.js +36 -64
- package/layout/ApplicationLayout.stories.tsx +80 -44
- package/layout/types.d.ts +17 -27
- package/link/Link.js +2 -2
- package/link/Link.stories.tsx +72 -5
- package/link/types.d.ts +1 -1
- package/main.d.ts +6 -10
- package/main.js +28 -60
- package/{tabs-nav → nav-tabs}/NavTabs.js +6 -6
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
- package/{tabs-nav → nav-tabs}/Tab.js +37 -20
- package/{tabs-nav → nav-tabs}/types.d.ts +1 -1
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +16 -21
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +6 -12
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +18 -11
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.test.js +13 -12
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +59 -53
- package/progress-bar/ProgressBar.stories.jsx +38 -3
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +18 -17
- package/quick-nav/QuickNav.stories.tsx +145 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +24 -24
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -107
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +40 -63
- package/resultsetTable/types.d.ts +2 -2
- package/select/Listbox.js +4 -10
- package/select/Option.js +11 -24
- package/select/Select.js +54 -50
- package/select/Select.stories.tsx +494 -149
- package/select/Select.test.js +338 -272
- package/select/types.d.ts +3 -5
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +174 -55
- package/sidenav/Sidenav.stories.tsx +249 -149
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +120 -95
- package/slider/Slider.stories.tsx +64 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +27 -1
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +41 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +133 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +119 -5
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tag/Tag.js +1 -1
- package/tag/Tag.stories.tsx +14 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +38 -9
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +195 -292
- package/text-input/TextInput.stories.tsx +280 -185
- package/text-input/TextInput.test.js +737 -725
- package/text-input/types.d.ts +22 -3
- package/textarea/Textarea.stories.jsx +60 -1
- package/toggle-group/ToggleGroup.stories.tsx +42 -0
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +40 -1
- package/wizard/types.d.ts +5 -4
- package/common/RequiredComponent.js +0 -32
- package/inline/Inline.d.ts +0 -4
- package/inline/Inline.js +0 -60
- package/inline/Inline.stories.tsx +0 -319
- package/inline/types.d.ts +0 -36
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -89
- package/list/types.d.ts +0 -7
- 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/stack/Stack.d.ts +0 -4
- package/stack/Stack.js +0 -56
- package/stack/Stack.stories.tsx +0 -263
- package/stack/types.d.ts +0 -32
- package/tabs-nav/types.js +0 -5
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- /package/{inline → bulleted-list}/types.js +0 -0
- /package/{list → flex}/types.js +0 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.test.js +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{row → nav-tabs}/types.js +0 -0
- /package/{stack → typography}/types.js +0 -0
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/testing-library";
|
|
3
2
|
import DxcSwitch from "./Switch";
|
|
4
3
|
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
5
4
|
import Title from "../../.storybook/components/Title";
|
|
6
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
7
6
|
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
7
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
title: "Switch",
|
|
11
11
|
component: DxcSwitch,
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
const opinionatedTheme = {
|
|
15
|
+
switch: {
|
|
16
|
+
checkedBaseColor: "#5f249f",
|
|
17
|
+
fontColor: "#000000",
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
14
21
|
export const Chromatic = () => (
|
|
15
22
|
<>
|
|
16
23
|
<ExampleContainer>
|
|
@@ -21,6 +28,10 @@ export const Chromatic = () => (
|
|
|
21
28
|
<Title title="Without label" theme="light" level={4} />
|
|
22
29
|
<DxcSwitch />
|
|
23
30
|
</ExampleContainer>
|
|
31
|
+
<ExampleContainer pseudoState="pseudo-focus-visible">
|
|
32
|
+
<Title title="Focused" theme="light" level={4} />
|
|
33
|
+
<DxcSwitch label="Switch" labelPosition="after" />
|
|
34
|
+
</ExampleContainer>
|
|
24
35
|
<ExampleContainer>
|
|
25
36
|
<Title title="Checked" theme="light" level={4} />
|
|
26
37
|
<DxcSwitch label="Switch" defaultChecked />
|
|
@@ -47,6 +58,10 @@ export const Chromatic = () => (
|
|
|
47
58
|
<Title title="With label" theme="dark" level={4} />
|
|
48
59
|
<DxcSwitch label="Switch" />
|
|
49
60
|
</ExampleContainer>
|
|
61
|
+
<ExampleContainer pseudoState="pseudo-focus-visible">
|
|
62
|
+
<Title title="Focused" theme="dark" level={4} />
|
|
63
|
+
<DxcSwitch label="Switch" labelPosition="after" />
|
|
64
|
+
</ExampleContainer>
|
|
50
65
|
<ExampleContainer>
|
|
51
66
|
<Title title="Checked" theme="dark" level={4} />
|
|
52
67
|
<DxcSwitch label="Switch" defaultChecked />
|
|
@@ -127,34 +142,30 @@ export const Chromatic = () => (
|
|
|
127
142
|
<Title title="FitContent size" theme="light" level={4} />
|
|
128
143
|
<DxcSwitch label="FitContent" size="fitContent" />
|
|
129
144
|
</ExampleContainer>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
FocusedSwitch.play = async ({ canvasElement }) => {
|
|
141
|
-
const canvas = within(canvasElement);
|
|
142
|
-
canvas.getByRole("switch").focus();
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const DarkSwitch = () => (
|
|
146
|
-
<BackgroundColorProvider color="#333333">
|
|
147
|
-
<DarkContainer>
|
|
148
|
-
<ExampleContainer>
|
|
149
|
-
<Title title="Focused" theme="dark" level={4} />
|
|
145
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
146
|
+
<ExampleContainer>
|
|
147
|
+
<Title title="Checked" theme="light" level={4} />
|
|
148
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
149
|
+
<DxcSwitch label="Switch" defaultChecked />
|
|
150
|
+
</HalstackProvider>
|
|
151
|
+
</ExampleContainer>
|
|
152
|
+
<ExampleContainer>
|
|
153
|
+
<Title title="Default" theme="light" level={4} />
|
|
154
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
150
155
|
<DxcSwitch label="Switch" />
|
|
151
|
-
</
|
|
152
|
-
</
|
|
153
|
-
|
|
156
|
+
</HalstackProvider>
|
|
157
|
+
</ExampleContainer>
|
|
158
|
+
<ExampleContainer>
|
|
159
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
160
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
161
|
+
<DxcSwitch label="Switch" disabled />
|
|
162
|
+
</HalstackProvider>
|
|
163
|
+
</ExampleContainer>
|
|
164
|
+
<ExampleContainer>
|
|
165
|
+
<Title title="Disabled checked" theme="light" level={4} />
|
|
166
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
167
|
+
<DxcSwitch label="Switch" disabled defaultChecked />
|
|
168
|
+
</HalstackProvider>
|
|
169
|
+
</ExampleContainer>
|
|
170
|
+
</>
|
|
154
171
|
);
|
|
155
|
-
|
|
156
|
-
export const FocusedSwitchOnDark = DarkSwitch.bind({});
|
|
157
|
-
FocusedSwitchOnDark.play = async ({ canvasElement }) => {
|
|
158
|
-
const canvas = within(canvasElement);
|
|
159
|
-
canvas.getByRole("switch").focus();
|
|
160
|
-
};
|
package/switch/Switch.test.js
CHANGED
|
@@ -37,7 +37,7 @@ describe("Switch component tests", function () {
|
|
|
37
37
|
|
|
38
38
|
expect(onChange).toHaveBeenCalled();
|
|
39
39
|
});
|
|
40
|
-
test("
|
|
40
|
+
test("Calls correct function on key down", function () {
|
|
41
41
|
var onChange = jest.fn();
|
|
42
42
|
|
|
43
43
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
@@ -47,6 +47,30 @@ describe("Switch component tests", function () {
|
|
|
47
47
|
})),
|
|
48
48
|
getByText = _render3.getByText;
|
|
49
49
|
|
|
50
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
51
|
+
|
|
52
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
53
|
+
key: "Enter"
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
expect(onChange).toHaveBeenCalled();
|
|
57
|
+
|
|
58
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
59
|
+
key: " "
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
expect(onChange).toHaveBeenCalled();
|
|
63
|
+
});
|
|
64
|
+
test("Everytime the user clicks the component the onchange function is called with the correct value CONTROLLED COMPONENT", function () {
|
|
65
|
+
var onChange = jest.fn();
|
|
66
|
+
|
|
67
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
68
|
+
label: "SwitchComponent",
|
|
69
|
+
checked: false,
|
|
70
|
+
onChange: onChange
|
|
71
|
+
})),
|
|
72
|
+
getByText = _render4.getByText;
|
|
73
|
+
|
|
50
74
|
_react2.fireEvent.click(getByText("SwitchComponent"));
|
|
51
75
|
|
|
52
76
|
_react2.fireEvent.click(getByText("SwitchComponent"));
|
|
@@ -54,14 +78,60 @@ describe("Switch component tests", function () {
|
|
|
54
78
|
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
55
79
|
expect(onChange.mock.calls[1][0]).toBe(true);
|
|
56
80
|
});
|
|
81
|
+
test("Everytime the user use enter in the component, the onchange function is called with the correct value CONTROLLED COMPONENT", function () {
|
|
82
|
+
var onChange = jest.fn();
|
|
83
|
+
|
|
84
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
85
|
+
label: "SwitchComponent",
|
|
86
|
+
checked: false,
|
|
87
|
+
onChange: onChange
|
|
88
|
+
})),
|
|
89
|
+
getByText = _render5.getByText;
|
|
90
|
+
|
|
91
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
92
|
+
|
|
93
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
94
|
+
key: "Enter"
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
98
|
+
key: "Enter"
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
102
|
+
expect(onChange.mock.calls[1][0]).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
test("Everytime the user use space in the component, the onchange function is called with the correct value CONTROLLED COMPONENT", function () {
|
|
105
|
+
var onChange = jest.fn();
|
|
106
|
+
|
|
107
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
108
|
+
label: "SwitchComponent",
|
|
109
|
+
checked: false,
|
|
110
|
+
onChange: onChange
|
|
111
|
+
})),
|
|
112
|
+
getByText = _render6.getByText;
|
|
113
|
+
|
|
114
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
115
|
+
|
|
116
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
117
|
+
key: " "
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
121
|
+
key: " "
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
125
|
+
expect(onChange.mock.calls[1][0]).toBe(true);
|
|
126
|
+
});
|
|
57
127
|
test("Everytime the user clicks the component the onchange function is called with the correct value UNCONTROLLED COMPONENT", function () {
|
|
58
128
|
var onChange = jest.fn();
|
|
59
129
|
|
|
60
|
-
var
|
|
130
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
61
131
|
label: "SwitchComponent",
|
|
62
132
|
onChange: onChange
|
|
63
133
|
})),
|
|
64
|
-
getByText =
|
|
134
|
+
getByText = _render7.getByText;
|
|
65
135
|
|
|
66
136
|
_react2.fireEvent.click(getByText("SwitchComponent"));
|
|
67
137
|
|
|
@@ -70,29 +140,86 @@ describe("Switch component tests", function () {
|
|
|
70
140
|
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
71
141
|
expect(onChange.mock.calls[1][0]).toBe(false);
|
|
72
142
|
});
|
|
143
|
+
test("Everytime the user use enter in the component, the onchange function is called with the correct value UNCONTROLLED COMPONENT", function () {
|
|
144
|
+
var onChange = jest.fn();
|
|
145
|
+
|
|
146
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
147
|
+
label: "SwitchComponent",
|
|
148
|
+
onChange: onChange
|
|
149
|
+
})),
|
|
150
|
+
getByText = _render8.getByText;
|
|
151
|
+
|
|
152
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
153
|
+
|
|
154
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
155
|
+
key: "Enter"
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
159
|
+
key: "Enter"
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
163
|
+
expect(onChange.mock.calls[1][0]).toBe(false);
|
|
164
|
+
});
|
|
165
|
+
test("Everytime the user use space in the component, the onchange function is called with the correct value UNCONTROLLED COMPONENT", function () {
|
|
166
|
+
var onChange = jest.fn();
|
|
167
|
+
|
|
168
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
169
|
+
label: "SwitchComponent",
|
|
170
|
+
onChange: onChange
|
|
171
|
+
})),
|
|
172
|
+
getByText = _render9.getByText;
|
|
173
|
+
|
|
174
|
+
_react2.fireEvent.focus(getByText("SwitchComponent"));
|
|
175
|
+
|
|
176
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
177
|
+
key: " "
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
_react2.fireEvent.keyDown(getByText("SwitchComponent"), {
|
|
181
|
+
key: " "
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
expect(onChange.mock.calls[0][0]).toBe(true);
|
|
185
|
+
expect(onChange.mock.calls[1][0]).toBe(false);
|
|
186
|
+
});
|
|
73
187
|
test("Renders with correct initial value and initial state when it is uncontrolled", function () {
|
|
74
|
-
var
|
|
188
|
+
var component = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
75
189
|
label: "Default label",
|
|
76
190
|
defaultChecked: true,
|
|
77
|
-
value: "test-defaultChecked"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var inputEl =
|
|
82
|
-
expect(inputEl.checked).toBe(true);
|
|
191
|
+
value: "test-defaultChecked",
|
|
192
|
+
name: "test"
|
|
193
|
+
}));
|
|
194
|
+
var switchEl = component.getByRole("switch");
|
|
195
|
+
var inputEl = component.container.querySelector("input[name=\"test\"]");
|
|
83
196
|
expect(inputEl.value).toBe("test-defaultChecked");
|
|
84
|
-
expect(
|
|
197
|
+
expect(switchEl.getAttribute("aria-checked")).toBe("true");
|
|
85
198
|
});
|
|
86
199
|
test("Renders with correct aria attributes", function () {
|
|
87
|
-
var
|
|
200
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
88
201
|
label: "Default label"
|
|
89
202
|
})),
|
|
90
|
-
|
|
91
|
-
|
|
203
|
+
getByText = _render10.getByText,
|
|
204
|
+
getByRole = _render10.getByRole;
|
|
205
|
+
|
|
206
|
+
var switchEl = getByRole("switch");
|
|
207
|
+
var label = getByText("Default label");
|
|
208
|
+
expect(switchEl.getAttribute("aria-labelledby")).toBe(label.id);
|
|
209
|
+
expect(switchEl.getAttribute("aria-checked")).toBe("false");
|
|
210
|
+
});
|
|
211
|
+
test("Renders disabled switch correctly", function () {
|
|
212
|
+
var _render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
213
|
+
label: "Default label",
|
|
214
|
+
disabled: true
|
|
215
|
+
})),
|
|
216
|
+
getByText = _render11.getByText,
|
|
217
|
+
getByRole = _render11.getByRole;
|
|
92
218
|
|
|
93
|
-
var
|
|
219
|
+
var switchEl = getByRole("switch");
|
|
94
220
|
var label = getByText("Default label");
|
|
95
|
-
expect(
|
|
96
|
-
expect(
|
|
221
|
+
expect(switchEl.getAttribute("aria-labelledby")).toBe(label.id);
|
|
222
|
+
expect(switchEl.getAttribute("aria-checked")).toBe("false");
|
|
223
|
+
expect(switchEl.getAttribute("aria-disabled")).toBe("true");
|
|
97
224
|
});
|
|
98
225
|
});
|
package/switch/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
declare type Margin = {
|
|
1
|
+
export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
export declare type Margin = {
|
|
3
3
|
top?: Space;
|
|
4
4
|
bottom?: Space;
|
|
5
5
|
left?: Space;
|
|
@@ -59,4 +59,8 @@ declare type Props = {
|
|
|
59
59
|
*/
|
|
60
60
|
tabIndex?: number;
|
|
61
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Reference to the component.
|
|
64
|
+
*/
|
|
65
|
+
export declare type RefType = HTMLDivElement;
|
|
62
66
|
export default Props;
|
package/table/Table.js
CHANGED
|
@@ -66,7 +66,7 @@ var DxcTableContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
66
66
|
return props.theme.scrollBarTrackColor;
|
|
67
67
|
});
|
|
68
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) {
|
|
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) {
|
|
70
70
|
return "".concat(props.theme.rowSeparatorThickness, " ").concat(props.theme.rowSeparatorStyle, " ").concat(props.theme.rowSeparatorColor);
|
|
71
71
|
}, function (props) {
|
|
72
72
|
return props.theme.dataBackgroundColor;
|
package/table/Table.stories.jsx
CHANGED
|
@@ -2,12 +2,21 @@ import React from "react";
|
|
|
2
2
|
import DxcTable from "./Table";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Table",
|
|
8
9
|
component: DxcTable,
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const opinionatedTheme = {
|
|
13
|
+
table: {
|
|
14
|
+
baseColor: "#5f249f",
|
|
15
|
+
headerFontColor: "#ffffff",
|
|
16
|
+
cellFontColor: "#000000",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
11
20
|
export const Chromatic = () => (
|
|
12
21
|
<>
|
|
13
22
|
<ExampleContainer>
|
|
@@ -271,7 +280,77 @@ export const Chromatic = () => (
|
|
|
271
280
|
<td>Cell 9</td>
|
|
272
281
|
</tr>
|
|
273
282
|
</DxcTable>
|
|
274
|
-
|
|
283
|
+
</ExampleContainer>
|
|
284
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
285
|
+
<ExampleContainer>
|
|
286
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
287
|
+
<DxcTable>
|
|
288
|
+
<tr>
|
|
289
|
+
<th>
|
|
290
|
+
header<br></br>subheader
|
|
291
|
+
</th>
|
|
292
|
+
<th>
|
|
293
|
+
header<br></br>subheader
|
|
294
|
+
</th>
|
|
295
|
+
<th>
|
|
296
|
+
header<br></br>subheader
|
|
297
|
+
</th>
|
|
298
|
+
</tr>
|
|
299
|
+
<tr>
|
|
300
|
+
<td>
|
|
301
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
302
|
+
dolore magna aliqua.
|
|
303
|
+
</td>
|
|
304
|
+
<td>
|
|
305
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
306
|
+
consequat.
|
|
307
|
+
</td>
|
|
308
|
+
<td>
|
|
309
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
310
|
+
</td>
|
|
311
|
+
</tr>
|
|
312
|
+
<tr>
|
|
313
|
+
<td>cell data</td>
|
|
314
|
+
<td>cell data</td>
|
|
315
|
+
<td>cell data</td>
|
|
316
|
+
</tr>
|
|
317
|
+
<tr>
|
|
318
|
+
<td>cell data</td>
|
|
319
|
+
<td>cell data</td>
|
|
320
|
+
<td>cell data</td>
|
|
321
|
+
</tr>
|
|
322
|
+
<tr>
|
|
323
|
+
<td>cell data</td>
|
|
324
|
+
<td>cell data</td>
|
|
325
|
+
<td>cell data</td>
|
|
326
|
+
</tr>
|
|
327
|
+
<tr>
|
|
328
|
+
<td>cell data</td>
|
|
329
|
+
<td>cell data</td>
|
|
330
|
+
<td>cell data</td>
|
|
331
|
+
</tr>
|
|
332
|
+
<tr>
|
|
333
|
+
<td>cell data</td>
|
|
334
|
+
<td>cell data</td>
|
|
335
|
+
<td>cell data</td>
|
|
336
|
+
</tr>
|
|
337
|
+
<tr>
|
|
338
|
+
<td>cell data</td>
|
|
339
|
+
<td>cell data</td>
|
|
340
|
+
<td>cell data</td>
|
|
341
|
+
</tr>
|
|
342
|
+
<tr>
|
|
343
|
+
<td>cell data</td>
|
|
344
|
+
<td>cell data</td>
|
|
345
|
+
<td>cell data</td>
|
|
346
|
+
</tr>
|
|
347
|
+
<tr>
|
|
348
|
+
<td>cell data</td>
|
|
349
|
+
<td>cell data</td>
|
|
350
|
+
<td>cell data</td>
|
|
351
|
+
</tr>
|
|
352
|
+
</DxcTable>
|
|
353
|
+
</HalstackProvider>
|
|
275
354
|
</ExampleContainer>
|
|
276
355
|
</>
|
|
277
356
|
);
|
package/table/Table.test.js
CHANGED
|
@@ -10,7 +10,7 @@ var _Table = _interopRequireDefault(require("./Table"));
|
|
|
10
10
|
|
|
11
11
|
describe("Table component tests", function () {
|
|
12
12
|
test("Table renders with correct content", function () {
|
|
13
|
-
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Table["default"], 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("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")))),
|
|
13
|
+
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
14
|
getByText = _render.getByText;
|
|
15
15
|
|
|
16
16
|
expect(getByText("header-1")).toBeTruthy();
|
package/tabs/Tab.d.ts
ADDED
package/tabs/Tab.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
|
+
|
|
18
|
+
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
19
|
+
|
|
20
|
+
var _Typography = _interopRequireDefault(require("../typography/Typography"));
|
|
21
|
+
|
|
22
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
|
+
|
|
24
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
|
+
|
|
26
|
+
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); }
|
|
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
|
+
|
|
30
|
+
var Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
31
|
+
var active = _ref.active,
|
|
32
|
+
tab = _ref.tab,
|
|
33
|
+
tabIndex = _ref.tabIndex,
|
|
34
|
+
hasLabelAndIcon = _ref.hasLabelAndIcon,
|
|
35
|
+
iconPosition = _ref.iconPosition,
|
|
36
|
+
_onClick = _ref.onClick,
|
|
37
|
+
_onMouseEnter = _ref.onMouseEnter,
|
|
38
|
+
_onMouseLeave = _ref.onMouseLeave;
|
|
39
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
40
|
+
return /*#__PURE__*/_react["default"].createElement(TabContainer, {
|
|
41
|
+
role: "tab",
|
|
42
|
+
type: "button",
|
|
43
|
+
tabIndex: tabIndex,
|
|
44
|
+
disabled: tab.isDisabled,
|
|
45
|
+
"aria-disabled": tab.isDisabled,
|
|
46
|
+
"aria-selected": active,
|
|
47
|
+
hasLabelAndIcon: hasLabelAndIcon,
|
|
48
|
+
iconPosition: iconPosition,
|
|
49
|
+
ref: ref,
|
|
50
|
+
onClick: function onClick() {
|
|
51
|
+
_onClick();
|
|
52
|
+
},
|
|
53
|
+
onMouseEnter: function onMouseEnter() {
|
|
54
|
+
_onMouseEnter();
|
|
55
|
+
},
|
|
56
|
+
onMouseLeave: function onMouseLeave() {
|
|
57
|
+
_onMouseLeave();
|
|
58
|
+
}
|
|
59
|
+
}, /*#__PURE__*/_react["default"].createElement(MainLabelContainer, {
|
|
60
|
+
hasBadge: tab.notificationNumber,
|
|
61
|
+
hasLabelAndIcon: hasLabelAndIcon,
|
|
62
|
+
iconPosition: iconPosition
|
|
63
|
+
}, tab.icon && /*#__PURE__*/_react["default"].createElement(TabIconContainer, {
|
|
64
|
+
hasLabelAndIcon: hasLabelAndIcon,
|
|
65
|
+
iconPosition: iconPosition
|
|
66
|
+
}, typeof tab.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
67
|
+
src: tab.icon
|
|
68
|
+
}) : tab.icon), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
69
|
+
color: tab.isDisabled ? colorsTheme.tabs.disabledFontColor : active ? colorsTheme.tabs.selectedFontColor : colorsTheme.tabs.unselectedFontColor,
|
|
70
|
+
fontFamily: colorsTheme.tabs.fontFamily,
|
|
71
|
+
fontSize: colorsTheme.tabs.fontSize,
|
|
72
|
+
fontStyle: tab.isDisabled ? colorsTheme.tabs.disabledFontStyle : colorsTheme.tabs.fontStyle,
|
|
73
|
+
fontWeight: active ? colorsTheme.tabs.pressedFontWeight : colorsTheme.tabs.fontWeight,
|
|
74
|
+
textAlign: "center",
|
|
75
|
+
letterSpacing: "0.025em",
|
|
76
|
+
lineHeight: "1.715em"
|
|
77
|
+
}, tab.label)), tab.notificationNumber && tab.notificationNumber && /*#__PURE__*/_react["default"].createElement(BadgeContainer, {
|
|
78
|
+
hasLabelAndIcon: hasLabelAndIcon,
|
|
79
|
+
iconPosition: iconPosition
|
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
|
|
81
|
+
notificationText: tab.notificationNumber > 99 ? "+99" : tab.notificationNumber
|
|
82
|
+
})));
|
|
83
|
+
});
|
|
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 svg {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n\n &:focus {\n outline: ", " solid 1px;\n outline-offset: -1px;\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) {
|
|
86
|
+
return props.theme.fontTextTransform;
|
|
87
|
+
}, function (props) {
|
|
88
|
+
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "12px 16px" || "8px 16px";
|
|
89
|
+
}, function (props) {
|
|
90
|
+
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "47px" || "71px";
|
|
91
|
+
}, function (props) {
|
|
92
|
+
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "47px" || "71px";
|
|
93
|
+
}, function (props) {
|
|
94
|
+
return props.theme.unselectedBackgroundColor;
|
|
95
|
+
}, function (props) {
|
|
96
|
+
return props.theme.unselectedIconColor;
|
|
97
|
+
}, function (props) {
|
|
98
|
+
return "".concat(props.theme.hoverBackgroundColor, " !important");
|
|
99
|
+
}, function (props) {
|
|
100
|
+
return "".concat(props.theme.pressedBackgroundColor, " !important");
|
|
101
|
+
}, function (props) {
|
|
102
|
+
return props.theme.focusOutline;
|
|
103
|
+
}, function (props) {
|
|
104
|
+
return props.theme.selectedBackgroundColor;
|
|
105
|
+
}, function (props) {
|
|
106
|
+
return props.theme.selectedIconColor;
|
|
107
|
+
}, function (props) {
|
|
108
|
+
return props.theme.unselectedBackgroundColor;
|
|
109
|
+
}, function (props) {
|
|
110
|
+
return props.theme.disabledFontStyle;
|
|
111
|
+
}, function (props) {
|
|
112
|
+
return props.theme.disabledIconColor;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
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
|
+
return props.hasLabelAndIcon && props.iconPosition === "top" ? "flex-start" : "center";
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
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
|
+
return props.hasLabelAndIcon && props.iconPosition === "top" && "column" || "row";
|
|
121
|
+
}, function (props) {
|
|
122
|
+
return props.hasBadge ? typeof props.hasBadge === "number" ? "calc(".concat(props.theme.badgeWidthWithNotificationNumber, " + 12px)") : "calc(".concat(props.theme.badgeWidth, " + 12px)") : "unset";
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
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
|
+
return props.hasLabelAndIcon && props.iconPosition === "top" && "8px" || "";
|
|
127
|
+
}, function (props) {
|
|
128
|
+
return props.hasLabelAndIcon && props.iconPosition === "left" && "12px" || "";
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
var _default = /*#__PURE__*/_react["default"].memo(Tab);
|
|
132
|
+
|
|
133
|
+
exports["default"] = _default;
|