@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,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import DxcButton from "./Button";
|
|
3
2
|
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
3
|
+
import DxcButton from "./Button";
|
|
4
|
+
import DxcFlex from "./../flex/Flex";
|
|
4
5
|
import Title from "../../.storybook/components/Title";
|
|
5
6
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
7
|
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
8
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
7
9
|
|
|
8
10
|
export default {
|
|
9
11
|
title: "Button",
|
|
@@ -11,11 +13,50 @@ export default {
|
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
const iconSVG = (
|
|
14
|
-
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
16
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" fill="currentColor">
|
|
15
17
|
<path d="M0 0h24v24H0z" fill="none" />
|
|
16
18
|
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
|
|
17
19
|
</svg>
|
|
18
20
|
);
|
|
21
|
+
|
|
22
|
+
const facebookIcon = (
|
|
23
|
+
<svg
|
|
24
|
+
version="1.1"
|
|
25
|
+
id="Capa_1"
|
|
26
|
+
x="0px"
|
|
27
|
+
y="0px"
|
|
28
|
+
width="438.536px"
|
|
29
|
+
height="438.536px"
|
|
30
|
+
viewBox="0 0 438.536 438.536"
|
|
31
|
+
fill="currentColor"
|
|
32
|
+
>
|
|
33
|
+
<g>
|
|
34
|
+
<path
|
|
35
|
+
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
36
|
+
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
37
|
+
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
38
|
+
C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
|
|
39
|
+
c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
|
|
40
|
+
c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
|
|
41
|
+
/>
|
|
42
|
+
</g>
|
|
43
|
+
</svg>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const smallIcon = (
|
|
47
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20" fill="currentColor">
|
|
48
|
+
<path d="m7.646 18.333-.313-2.625q-.208-.125-.458-.27-.25-.146-.458-.271l-2.438 1.021-2.354-4.063 2.083-1.583V9.458L1.625 7.875l2.354-4.063 2.438 1.021q.208-.125.458-.27.25-.146.458-.271l.313-2.625h4.708l.313 2.625q.208.125.458.271.25.145.458.27l2.438-1.021 2.354 4.063-2.063 1.583v1.084l2.063 1.583-2.354 4.063-2.438-1.021q-.208.125-.458.271-.25.145-.458.27l-.313 2.625ZM10 12.979q1.229 0 2.104-.875T12.979 10q0-1.229-.875-2.104T10 7.021q-1.229 0-2.104.875T7.021 10q0 1.229.875 2.104t2.104.875Zm0-1.75q-.5 0-.865-.364-.364-.365-.364-.865t.364-.865q.365-.364.865-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.166q.605-.167 1.167-.5.562-.334 1.021-.792l2.021.854.833-1.375-1.771-1.354q.104-.292.146-.604.042-.313.042-.646 0-.292-.042-.594t-.125-.635l1.771-1.375-.834-1.375-2.02.875q-.48-.479-1.032-.802-.552-.323-1.156-.49l-.271-2.187H9.167l-.271 2.187q-.604.167-1.156.49-.552.323-1.011.781l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.459.458 1.011.781.552.323 1.156.49Z" />
|
|
49
|
+
</svg>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const opinionatedTheme = {
|
|
53
|
+
button: {
|
|
54
|
+
baseColor: "#5f249f",
|
|
55
|
+
primaryFontColor: "#ffffff",
|
|
56
|
+
secondaryHoverFontColor: "#ffffff",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
19
60
|
export const Chromatic = () => (
|
|
20
61
|
<>
|
|
21
62
|
<Title title="Primary" theme="light" level={2} />
|
|
@@ -37,7 +78,7 @@ export const Chromatic = () => (
|
|
|
37
78
|
</ExampleContainer>
|
|
38
79
|
<ExampleContainer>
|
|
39
80
|
<Title title="Disabled" theme="light" level={4} />
|
|
40
|
-
<DxcButton label="Primary disabled" disabled />
|
|
81
|
+
<DxcButton label="Primary disabled" disabled icon={iconSVG} />
|
|
41
82
|
</ExampleContainer>
|
|
42
83
|
<ExampleContainer>
|
|
43
84
|
<Title title="With left icon" theme="light" level={4} />
|
|
@@ -51,6 +92,18 @@ export const Chromatic = () => (
|
|
|
51
92
|
<Title title="Only icon" theme="light" level={4} />
|
|
52
93
|
<DxcButton icon={iconSVG} />
|
|
53
94
|
</ExampleContainer>
|
|
95
|
+
<ExampleContainer>
|
|
96
|
+
<Title title="Big icon (SVG)" theme="light" level={4} />
|
|
97
|
+
<DxcButton icon={facebookIcon} />
|
|
98
|
+
</ExampleContainer>
|
|
99
|
+
<ExampleContainer>
|
|
100
|
+
<Title title="Big icon (image)" theme="light" level={4} />
|
|
101
|
+
<DxcButton icon="https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png" />
|
|
102
|
+
</ExampleContainer>
|
|
103
|
+
<ExampleContainer>
|
|
104
|
+
<Title title="Small icon" theme="light" level={4} />
|
|
105
|
+
<DxcButton icon={smallIcon} />
|
|
106
|
+
</ExampleContainer>
|
|
54
107
|
<Title title="Secondary" theme="light" level={2} />
|
|
55
108
|
<ExampleContainer>
|
|
56
109
|
<Title title="Enabled" theme="light" level={4} />
|
|
@@ -70,12 +123,19 @@ export const Chromatic = () => (
|
|
|
70
123
|
</ExampleContainer>
|
|
71
124
|
<ExampleContainer>
|
|
72
125
|
<Title title="Disabled" theme="light" level={4} />
|
|
73
|
-
<DxcButton mode="secondary" disabled label="Secondary disabled" />
|
|
126
|
+
<DxcButton mode="secondary" disabled label="Secondary disabled" icon={iconSVG} />
|
|
74
127
|
</ExampleContainer>
|
|
75
128
|
<ExampleContainer>
|
|
76
129
|
<Title title="With icon" theme="light" level={4} />
|
|
77
130
|
<DxcButton mode="secondary" label="Secondary" icon={iconSVG} />
|
|
78
131
|
</ExampleContainer>
|
|
132
|
+
<ExampleContainer>
|
|
133
|
+
<Title title="Only icon (image)" theme="light" level={4} />
|
|
134
|
+
<DxcButton
|
|
135
|
+
mode="secondary"
|
|
136
|
+
icon="https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png"
|
|
137
|
+
/>
|
|
138
|
+
</ExampleContainer>
|
|
79
139
|
<Title title="Text" theme="light" level={2} />
|
|
80
140
|
<ExampleContainer>
|
|
81
141
|
<Title title="Enabled" theme="light" level={4} />
|
|
@@ -95,12 +155,19 @@ export const Chromatic = () => (
|
|
|
95
155
|
</ExampleContainer>
|
|
96
156
|
<ExampleContainer>
|
|
97
157
|
<Title title="Disabled" theme="light" level={4} />
|
|
98
|
-
<DxcButton mode="text" label="Text disabled" disabled />
|
|
158
|
+
<DxcButton mode="text" label="Text disabled" disabled icon={iconSVG} />
|
|
99
159
|
</ExampleContainer>
|
|
100
160
|
<ExampleContainer>
|
|
101
161
|
<Title title="With icon" theme="light" level={4} />
|
|
102
162
|
<DxcButton label="Text" mode="text" icon={iconSVG} />
|
|
103
163
|
</ExampleContainer>
|
|
164
|
+
<ExampleContainer>
|
|
165
|
+
<Title title="Only icon (image)" theme="light" level={4} />
|
|
166
|
+
<DxcButton
|
|
167
|
+
mode="text"
|
|
168
|
+
icon="https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png"
|
|
169
|
+
/>
|
|
170
|
+
</ExampleContainer>
|
|
104
171
|
<BackgroundColorProvider color="#333333">
|
|
105
172
|
<DarkContainer>
|
|
106
173
|
<Title title="Primary" theme="dark" level={2} />
|
|
@@ -122,7 +189,7 @@ export const Chromatic = () => (
|
|
|
122
189
|
</ExampleContainer>
|
|
123
190
|
<ExampleContainer>
|
|
124
191
|
<Title title="Disabled" theme="dark" level={4} />
|
|
125
|
-
<DxcButton label="Primary disabled" disabled />
|
|
192
|
+
<DxcButton label="Primary disabled" disabled icon={iconSVG} />
|
|
126
193
|
</ExampleContainer>
|
|
127
194
|
<ExampleContainer>
|
|
128
195
|
<Title title="With icon" theme="dark" level={4} />
|
|
@@ -147,7 +214,7 @@ export const Chromatic = () => (
|
|
|
147
214
|
</ExampleContainer>
|
|
148
215
|
<ExampleContainer>
|
|
149
216
|
<Title title="Disabled" theme="dark" level={4} />
|
|
150
|
-
<DxcButton mode="secondary" disabled label="Secondary disabled" />
|
|
217
|
+
<DxcButton mode="secondary" disabled label="Secondary disabled" icon={iconSVG} />
|
|
151
218
|
</ExampleContainer>
|
|
152
219
|
<ExampleContainer>
|
|
153
220
|
<Title title="With icon" theme="dark" level={4} />
|
|
@@ -172,7 +239,7 @@ export const Chromatic = () => (
|
|
|
172
239
|
</ExampleContainer>
|
|
173
240
|
<ExampleContainer>
|
|
174
241
|
<Title title="Disabled" theme="dark" level={4} />
|
|
175
|
-
<DxcButton mode="text" label="Text disabled" disabled />
|
|
242
|
+
<DxcButton mode="text" label="Text disabled" disabled icon={iconSVG} />
|
|
176
243
|
</ExampleContainer>
|
|
177
244
|
<ExampleContainer>
|
|
178
245
|
<Title title="With icon" theme="dark" level={4} />
|
|
@@ -270,5 +337,89 @@ export const Chromatic = () => (
|
|
|
270
337
|
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
271
338
|
<DxcButton label="Xxlarge margin" margin="xxlarge" />
|
|
272
339
|
</ExampleContainer>
|
|
340
|
+
<Title title="Inside a flex" theme="light" level={2} />
|
|
341
|
+
<ExampleContainer>
|
|
342
|
+
<DxcFlex direction="column" gap="0.75rem">
|
|
343
|
+
<DxcButton label="Button" />
|
|
344
|
+
<DxcButton label="Button" />
|
|
345
|
+
<DxcButton label="Button" />
|
|
346
|
+
</DxcFlex>
|
|
347
|
+
</ExampleContainer>
|
|
348
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
349
|
+
<Title title="Primary" theme="light" level={3} />
|
|
350
|
+
<ExampleContainer>
|
|
351
|
+
<Title title="Enabled" theme="light" level={4} />
|
|
352
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
353
|
+
<DxcButton label="Primary" icon={iconSVG} />
|
|
354
|
+
</HalstackProvider>
|
|
355
|
+
</ExampleContainer>
|
|
356
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
357
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
358
|
+
<DxcButton label="Primary hovered" icon={iconSVG} />
|
|
359
|
+
</ExampleContainer>
|
|
360
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
361
|
+
<Title title="Focused" theme="light" level={4} />
|
|
362
|
+
<DxcButton label="Primary focused" icon={iconSVG} />
|
|
363
|
+
</ExampleContainer>
|
|
364
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
365
|
+
<Title title="Actived" theme="light" level={4} />
|
|
366
|
+
<DxcButton label="Primary actived" icon={iconSVG} />
|
|
367
|
+
</ExampleContainer>
|
|
368
|
+
<ExampleContainer>
|
|
369
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
370
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
371
|
+
<DxcButton label="Primary" icon={iconSVG} disabled />
|
|
372
|
+
</HalstackProvider>
|
|
373
|
+
</ExampleContainer>
|
|
374
|
+
<Title title="Secondary" theme="light" level={3} />
|
|
375
|
+
<ExampleContainer>
|
|
376
|
+
<Title title="Enabled" theme="light" level={4} />
|
|
377
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
378
|
+
<DxcButton mode="secondary" label="Secondary" icon={iconSVG} />
|
|
379
|
+
</HalstackProvider>
|
|
380
|
+
</ExampleContainer>
|
|
381
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
382
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
383
|
+
<DxcButton mode="secondary" label="Secondary hovered" icon={iconSVG} />
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
386
|
+
<Title title="Focused" theme="light" level={4} />
|
|
387
|
+
<DxcButton mode="secondary" label="Secondary focused" icon={iconSVG} />
|
|
388
|
+
</ExampleContainer>
|
|
389
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
390
|
+
<Title title="Actived" theme="light" level={4} />
|
|
391
|
+
<DxcButton mode="secondary" label="Secondary actived" icon={iconSVG} />
|
|
392
|
+
</ExampleContainer>
|
|
393
|
+
<ExampleContainer>
|
|
394
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
395
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
396
|
+
<DxcButton mode="secondary" label="Secondary" icon={iconSVG} disabled />
|
|
397
|
+
</HalstackProvider>
|
|
398
|
+
</ExampleContainer>
|
|
399
|
+
<Title title="Text" theme="light" level={3} />
|
|
400
|
+
<ExampleContainer>
|
|
401
|
+
<Title title="Enabled" theme="light" level={4} />
|
|
402
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
403
|
+
<DxcButton mode="text" label="Text" icon={iconSVG} />
|
|
404
|
+
</HalstackProvider>
|
|
405
|
+
</ExampleContainer>
|
|
406
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
407
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
408
|
+
<DxcButton mode="text" label="Text hovered" icon={iconSVG} />
|
|
409
|
+
</ExampleContainer>
|
|
410
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
411
|
+
<Title title="Focused" theme="light" level={4} />
|
|
412
|
+
<DxcButton mode="text" label="Text focused" icon={iconSVG} />
|
|
413
|
+
</ExampleContainer>
|
|
414
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
415
|
+
<Title title="Actived" theme="light" level={4} />
|
|
416
|
+
<DxcButton mode="text" label="Text actived" icon={iconSVG} />
|
|
417
|
+
</ExampleContainer>
|
|
418
|
+
<ExampleContainer>
|
|
419
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
420
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
421
|
+
<DxcButton mode="text" label="Text disabled" icon={iconSVG} disabled />
|
|
422
|
+
</HalstackProvider>
|
|
423
|
+
</ExampleContainer>
|
|
273
424
|
</>
|
|
274
425
|
);
|
package/button/types.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
-
declare type Margin = {
|
|
2
|
+
export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
export declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
9
|
+
export declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
10
|
declare type Props = {
|
|
11
11
|
/**
|
|
12
|
-
* Text to be placed
|
|
12
|
+
* Text to be placed in the button.
|
|
13
13
|
*/
|
|
14
14
|
label?: string;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* The available button modes.
|
|
17
17
|
*/
|
|
18
18
|
mode?: "primary" | "secondary" | "text";
|
|
19
19
|
/**
|
|
@@ -25,11 +25,11 @@ declare type Props = {
|
|
|
25
25
|
*/
|
|
26
26
|
iconPosition?: "before" | "after";
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* 'type' html prop of the button.
|
|
29
29
|
*/
|
|
30
30
|
type?: "button" | "reset" | "submit";
|
|
31
31
|
/**
|
|
32
|
-
* Element or path used as the icon that will be placed next to the
|
|
32
|
+
* Element or path used as the icon that will be placed next to the label.
|
|
33
33
|
*/
|
|
34
34
|
icon?: string | SVG;
|
|
35
35
|
/**
|
package/card/types.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare type Props = {
|
|
|
47
47
|
*/
|
|
48
48
|
margin?: Space | Size;
|
|
49
49
|
/**
|
|
50
|
+
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
50
51
|
* Size of the padding to be applied to the content area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
51
52
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
52
53
|
*/
|
package/checkbox/Checkbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import CheckboxPropsType from "./types";
|
|
3
|
-
declare const DxcCheckbox:
|
|
3
|
+
declare const DxcCheckbox: React.ForwardRefExoticComponent<CheckboxPropsType & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export default DxcCheckbox;
|
package/checkbox/Checkbox.js
CHANGED
|
@@ -19,8 +19,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
23
|
-
|
|
24
22
|
var _variables = require("../common/variables.js");
|
|
25
23
|
|
|
26
24
|
var _utils = require("../common/utils.js");
|
|
@@ -33,13 +31,22 @@ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabel
|
|
|
33
31
|
|
|
34
32
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
35
33
|
|
|
36
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
34
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
37
35
|
|
|
38
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
37
|
|
|
40
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
39
|
|
|
42
|
-
var
|
|
40
|
+
var checkedIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
41
|
+
fill: "currentColor",
|
|
42
|
+
focusable: "false",
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
viewBox: "0 0 24 24"
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
46
|
+
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
var DxcCheckbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
43
50
|
var checked = _ref.checked,
|
|
44
51
|
_ref$defaultChecked = _ref.defaultChecked,
|
|
45
52
|
defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
|
|
@@ -61,96 +68,86 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
61
68
|
_ref$tabIndex = _ref.tabIndex,
|
|
62
69
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
63
70
|
|
|
64
|
-
var _useState = (0, _react.useState)("checkbox-".concat((0, _uuid.v4)())),
|
|
71
|
+
var _useState = (0, _react.useState)("label-checkbox-".concat((0, _uuid.v4)())),
|
|
65
72
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var labelId = "label-".concat(switchId);
|
|
73
|
+
labelId = _useState2[0];
|
|
69
74
|
|
|
70
75
|
var _useState3 = (0, _react.useState)(defaultChecked),
|
|
71
76
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
72
77
|
innerChecked = _useState4[0],
|
|
73
78
|
setInnerChecked = _useState4[1];
|
|
74
79
|
|
|
75
|
-
var
|
|
76
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
77
|
-
isLabelHovered = _useState6[0],
|
|
78
|
-
setIsLabelHovered = _useState6[1];
|
|
79
|
-
|
|
80
|
+
var checkboxRef = (0, _react.useRef)(null);
|
|
80
81
|
var colorsTheme = (0, _useTheme["default"])();
|
|
81
82
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
82
83
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
83
84
|
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
var isChecked = checkboxValue.target.checked === undefined ? !innerChecked : checkboxValue.target.checked;
|
|
87
|
-
setInnerChecked(isChecked);
|
|
88
|
-
|
|
89
|
-
if (typeof onChange === "function") {
|
|
90
|
-
onChange(isChecked);
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
if (typeof onChange === "function") {
|
|
94
|
-
onChange(!checked);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
85
|
+
var handleCheckboxChange = function handleCheckboxChange() {
|
|
86
|
+
var _checkboxRef$current;
|
|
98
87
|
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
document.activeElement !== (checkboxRef === null || checkboxRef === void 0 ? void 0 : checkboxRef.current) && (checkboxRef === null || checkboxRef === void 0 ? void 0 : (_checkboxRef$current = checkboxRef.current) === null || _checkboxRef$current === void 0 ? void 0 : _checkboxRef$current.focus());
|
|
89
|
+
var newChecked = checked !== null && checked !== void 0 ? checked : innerChecked;
|
|
90
|
+
checked !== null && checked !== void 0 ? checked : setInnerChecked(function (innerChecked) {
|
|
91
|
+
return !innerChecked;
|
|
92
|
+
});
|
|
93
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(!newChecked);
|
|
101
94
|
};
|
|
102
95
|
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
onMouseOver: handleLabelHover,
|
|
111
|
-
onMouseOut: handleLabelHover
|
|
112
|
-
}, labelPosition === "before" ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, label, " ", optional && /*#__PURE__*/_react["default"].createElement("span", null, translatedLabels.formFields.optionalLabel)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, optional && /*#__PURE__*/_react["default"].createElement("span", null, "(Optional)"), " ", label));
|
|
96
|
+
var handleKeyboard = function handleKeyboard(event) {
|
|
97
|
+
switch (event.key) {
|
|
98
|
+
case " ":
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
handleCheckboxChange();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
113
103
|
|
|
114
104
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
115
105
|
theme: colorsTheme.checkbox
|
|
116
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
117
|
-
id: name,
|
|
118
|
-
brightness: _variables.componentTokens,
|
|
119
|
-
label: label,
|
|
120
|
-
labelPosition: labelPosition,
|
|
106
|
+
}, /*#__PURE__*/_react["default"].createElement(MainContainer, {
|
|
121
107
|
disabled: disabled,
|
|
108
|
+
onClick: disabled ? undefined : handleCheckboxChange,
|
|
122
109
|
margin: margin,
|
|
123
110
|
size: size,
|
|
111
|
+
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
124
112
|
backgroundType: backgroundType,
|
|
125
|
-
|
|
126
|
-
}, label && labelPosition === "before" &&
|
|
113
|
+
ref: ref
|
|
114
|
+
}, label && labelPosition === "before" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
115
|
+
id: labelId,
|
|
116
|
+
disabled: disabled,
|
|
117
|
+
backgroundType: backgroundType
|
|
118
|
+
}, label, optional && " ".concat(translatedLabels.formFields.optionalLabel)), /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
119
|
+
type: "checkbox",
|
|
127
120
|
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"aria-labelledby": labelId,
|
|
131
|
-
role: "checkbox",
|
|
132
|
-
"aria-checked": checked !== null && checked !== void 0 ? checked : innerChecked
|
|
133
|
-
},
|
|
134
|
-
onChange: handlerCheckboxChange,
|
|
121
|
+
name: name,
|
|
122
|
+
"aria-hidden": "true",
|
|
135
123
|
value: value,
|
|
136
124
|
disabled: disabled,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
125
|
+
readOnly: true
|
|
126
|
+
}), /*#__PURE__*/_react["default"].createElement(CheckboxContainer, null, /*#__PURE__*/_react["default"].createElement(Checkbox, {
|
|
127
|
+
onKeyDown: handleKeyboard,
|
|
128
|
+
role: "checkbox",
|
|
129
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
130
|
+
"aria-checked": checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
131
|
+
"aria-disabled": disabled,
|
|
132
|
+
"aria-required": !disabled && !optional,
|
|
133
|
+
"aria-labelledby": labelId,
|
|
134
|
+
backgroundType: backgroundType,
|
|
143
135
|
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
136
|
+
disabled: disabled,
|
|
137
|
+
ref: checkboxRef
|
|
138
|
+
}, (checked !== null && checked !== void 0 ? checked : innerChecked) && checkedIcon)), label && labelPosition === "after" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
139
|
+
id: labelId,
|
|
140
|
+
disabled: disabled,
|
|
144
141
|
backgroundType: backgroundType
|
|
145
|
-
}
|
|
146
|
-
};
|
|
142
|
+
}, optional && "".concat(translatedLabels.formFields.optionalLabel, " "), label)));
|
|
143
|
+
});
|
|
147
144
|
|
|
148
145
|
var sizes = {
|
|
149
146
|
small: "120px",
|
|
150
147
|
medium: "240px",
|
|
151
148
|
large: "480px",
|
|
152
149
|
fillParent: "100%",
|
|
153
|
-
fitContent: "
|
|
150
|
+
fitContent: "fit-content"
|
|
154
151
|
};
|
|
155
152
|
|
|
156
153
|
var calculateWidth = function calculateWidth(margin, size) {
|
|
@@ -177,7 +174,7 @@ var getDisabledColor = function getDisabledColor(props, element) {
|
|
|
177
174
|
}
|
|
178
175
|
};
|
|
179
176
|
|
|
180
|
-
var
|
|
177
|
+
var getEnabledColor = function getEnabledColor(props, element) {
|
|
181
178
|
switch (element) {
|
|
182
179
|
case "check":
|
|
183
180
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.checkColorOnDark : props.theme.checkColor;
|
|
@@ -185,72 +182,68 @@ var getNotDisabledColor = function getNotDisabledColor(props, element) {
|
|
|
185
182
|
case "background":
|
|
186
183
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.backgroundColorCheckedOnDark : props.theme.backgroundColorChecked;
|
|
187
184
|
|
|
185
|
+
case "hoverBackground":
|
|
186
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.hoverBackgroundColorCheckedOnDark : props.theme.hoverBackgroundColorChecked;
|
|
187
|
+
|
|
188
188
|
case "border":
|
|
189
189
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.borderColorOnDark : props.theme.borderColor;
|
|
190
190
|
|
|
191
|
+
case "hoverBorder":
|
|
192
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor;
|
|
193
|
+
|
|
191
194
|
case "label":
|
|
192
195
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
|
|
193
196
|
}
|
|
194
197
|
};
|
|
195
198
|
|
|
196
|
-
var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n
|
|
197
|
-
return props.disabled ? getDisabledColor(props, "label") :
|
|
199
|
+
var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
200
|
+
return props.disabled ? getDisabledColor(props, "label") : getEnabledColor(props, "label");
|
|
198
201
|
}, function (props) {
|
|
199
202
|
return props.theme.fontFamily;
|
|
200
203
|
}, function (props) {
|
|
201
204
|
return props.theme.fontSize;
|
|
202
205
|
}, function (props) {
|
|
203
206
|
return props.theme.fontWeight;
|
|
204
|
-
}, function (props) {
|
|
205
|
-
return props.disabled ? "not-allowed" : "pointer";
|
|
206
207
|
});
|
|
207
208
|
|
|
208
|
-
var
|
|
209
|
-
|
|
209
|
+
var ValueInput = _styledComponents["default"].input(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: none;\n"])));
|
|
210
|
+
|
|
211
|
+
var CheckboxContainer = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
|
|
212
|
+
|
|
213
|
+
var Checkbox = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 18px;\n width: 18px;\n border: 2px solid\n ", ";\n border-radius: 2px;\n background-color: ", ";\n color: ", ";\n\n &:focus {\n outline: 2px solid\n ", ";\n outline-offset: 2px;\n }\n svg {\n position: absolute;\n width: 22px;\n height: 22px;\n }\n ", "\n"])), function (props) {
|
|
214
|
+
return props.disabled ? getDisabledColor(props, "border") : getEnabledColor(props, "border");
|
|
210
215
|
}, function (props) {
|
|
211
|
-
return props.
|
|
216
|
+
return props.checked ? props.disabled ? getDisabledColor(props, "check") : getEnabledColor(props, "check") : "transparent";
|
|
212
217
|
}, function (props) {
|
|
213
|
-
return props.
|
|
218
|
+
return props.disabled ? getDisabledColor(props, "background") : getEnabledColor(props, "background");
|
|
214
219
|
}, function (props) {
|
|
215
|
-
return props.
|
|
220
|
+
return props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor;
|
|
216
221
|
}, function (props) {
|
|
217
|
-
return props.
|
|
222
|
+
return props.disabled && "pointer-events: none;";
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
var MainContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n gap: ", ";\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n cursor: ", ";\n\n &:hover ", " {\n border: 2px solid\n ", ";\n background-color: ", ";\n color: ", ";\n }\n"])), function (props) {
|
|
226
|
+
return props.theme.checkLabelSpacing;
|
|
218
227
|
}, function (props) {
|
|
219
228
|
return calculateWidth(props.margin, props.size);
|
|
220
229
|
}, function (props) {
|
|
221
|
-
return props.
|
|
222
|
-
}, function (props) {
|
|
223
|
-
return props.isLabelHovered ? props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor : getNotDisabledColor(props, "border");
|
|
224
|
-
}, function (props) {
|
|
225
|
-
return getDisabledColor(props, "border");
|
|
226
|
-
}, function (props) {
|
|
227
|
-
return props.disabled ? getDisabledColor(props, "background") : getNotDisabledColor(props, "background");
|
|
228
|
-
}, function (props) {
|
|
229
|
-
return props.backgroundType === "dark" ? props.theme.hoverBackgroundColorCheckedOnDark : props.theme.hoverBackgroundColorChecked;
|
|
230
|
-
}, function (props) {
|
|
231
|
-
return props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor;
|
|
232
|
-
}, function (props) {
|
|
233
|
-
return props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor;
|
|
234
|
-
}, function (props) {
|
|
235
|
-
return props.labelPosition === "before" && props.label ? props.theme.checkLabelSpacing : "0";
|
|
230
|
+
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
236
231
|
}, function (props) {
|
|
237
|
-
return props.
|
|
232
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
238
233
|
}, function (props) {
|
|
239
|
-
return props.
|
|
234
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
240
235
|
}, function (props) {
|
|
241
|
-
return props.
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
var CheckboxBlackBack = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n width: 16px;\n height: 16px;\n position: absolute;\n left: ", ";\n right: ", ";\n z-index: 0;\n margin-left: ", ";\n margin-right: ", ";\n"])), function (props) {
|
|
245
|
-
return !props.checked ? "transparent" : props.disabled ? getDisabledColor(props, "check") : getNotDisabledColor(props, "check");
|
|
236
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
246
237
|
}, function (props) {
|
|
247
|
-
return props.
|
|
238
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
248
239
|
}, function (props) {
|
|
249
|
-
return props.
|
|
240
|
+
return props.disabled ? "not-allowed" : "pointer";
|
|
241
|
+
}, Checkbox, function (props) {
|
|
242
|
+
return props.disabled ? getDisabledColor(props, "border") : getEnabledColor(props, "hoverBorder");
|
|
250
243
|
}, function (props) {
|
|
251
|
-
return props.
|
|
244
|
+
return props.checked ? props.disabled ? getDisabledColor(props, "check") : getEnabledColor(props, "check") : "transparent";
|
|
252
245
|
}, function (props) {
|
|
253
|
-
return props.
|
|
246
|
+
return props.disabled ? getDisabledColor(props, "background") : getEnabledColor(props, "hoverBackground");
|
|
254
247
|
});
|
|
255
248
|
|
|
256
249
|
var _default = DxcCheckbox;
|