@dxc-technology/halstack-react 0.0.0-ff43881 → 0.0.0-ff5083e
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.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +7 -28
- package/accordion/Accordion.stories.tsx +11 -11
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +4 -0
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +13 -15
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +4 -0
- package/alert/Alert.js +4 -1
- package/alert/Alert.test.js +92 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +31 -32
- package/bleed/types.d.ts +25 -1
- package/box/Box.js +22 -32
- package/box/Box.test.js +18 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +120 -0
- package/bulleted-list/BulletedList.stories.tsx +203 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +14 -11
- package/button/Button.test.js +35 -0
- package/card/Card.js +24 -27
- package/card/Card.test.js +50 -0
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +43 -39
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +7 -3
- package/chip/Chip.test.js +56 -0
- package/common/variables.js +197 -322
- package/date-input/DateInput.js +53 -39
- package/date-input/DateInput.stories.tsx +7 -7
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +4 -32
- package/dialog/Dialog.test.js +40 -0
- package/dropdown/Dropdown.js +13 -17
- package/dropdown/Dropdown.test.js +189 -0
- package/file-input/FileInput.js +9 -6
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.js +7 -5
- package/footer/Footer.js +15 -88
- package/footer/Footer.test.js +109 -0
- package/header/Header.js +27 -48
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +79 -0
- package/heading/Heading.test.js +186 -0
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +32 -32
- package/inset/types.d.ts +25 -1
- package/layout/ApplicationLayout.d.ts +4 -3
- package/layout/ApplicationLayout.js +82 -114
- package/layout/ApplicationLayout.stories.tsx +14 -59
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +5 -10
- package/link/Link.d.ts +3 -2
- package/link/Link.js +57 -74
- package/link/Link.stories.tsx +87 -52
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +7 -23
- package/main.d.ts +7 -10
- package/main.js +33 -51
- package/number-input/NumberInput.js +11 -18
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +6 -5
- package/paginator/Paginator.js +17 -38
- package/paginator/Paginator.test.js +266 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.js +1 -1
- package/progress-bar/ProgressBar.stories.jsx +11 -11
- package/progress-bar/ProgressBar.test.js +65 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +112 -0
- package/quick-nav/QuickNav.stories.tsx +237 -0
- package/quick-nav/types.d.ts +21 -0
- package/{radio → quick-nav}/types.js +0 -0
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +25 -24
- package/radio-group/RadioGroup.js +46 -37
- package/radio-group/RadioGroup.stories.tsx +60 -39
- package/radio-group/RadioGroup.test.js +530 -83
- package/radio-group/types.d.ts +80 -2
- package/resultsetTable/ResultsetTable.test.js +306 -0
- package/row/types.d.ts +18 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +152 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.js +109 -327
- package/select/Select.stories.tsx +103 -81
- package/select/Select.test.js +2120 -0
- package/select/types.d.ts +54 -11
- package/sidenav/Sidenav.d.ts +1 -1
- package/sidenav/Sidenav.js +20 -9
- package/sidenav/Sidenav.test.js +56 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +2 -1
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +150 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +1 -1
- package/spinner/Spinner.test.js +64 -0
- package/stack/types.d.ts +15 -0
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +35 -19
- package/switch/Switch.stories.tsx +14 -14
- package/switch/Switch.test.js +98 -0
- package/switch/types.d.ts +6 -2
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +9 -11
- package/tabs/Tabs.stories.tsx +0 -8
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +4 -0
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.js +14 -19
- package/tag/Tag.stories.tsx +12 -8
- package/tag/Tag.test.js +60 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +56 -80
- package/text-input/TextInput.stories.tsx +30 -12
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +31 -12
- package/textarea/Textarea.js +20 -27
- package/textarea/Textarea.stories.jsx +33 -12
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +18 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +5 -4
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +8 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +175 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/typography/typographyContextTypes.d.ts +16 -0
- package/typography/typographyContextTypes.js +5 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +55 -44
- package/wizard/Wizard.stories.tsx +13 -23
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +6 -2
- package/ThemeContext.d.ts +0 -15
- package/ThemeContext.js +0 -243
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- 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/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
|
|
7
|
+
import DxcBulletedList from "./BulletedList";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "BulletedList",
|
|
11
|
+
component: DxcBulletedList,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const icon = (
|
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
|
|
16
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
17
|
+
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" />
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const Chromatic = () => (
|
|
22
|
+
<>
|
|
23
|
+
<ExampleContainer>
|
|
24
|
+
<Title title="Icon list" theme="light" level={4} />
|
|
25
|
+
<DxcBulletedList type="icon" icon={icon}>
|
|
26
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
27
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
28
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
29
|
+
</DxcBulletedList>
|
|
30
|
+
<Title title="Number list" theme="light" level={4} />
|
|
31
|
+
<DxcBulletedList type="number">
|
|
32
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
33
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
34
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
35
|
+
</DxcBulletedList>
|
|
36
|
+
<Title title="Square" theme="light" level={4} />
|
|
37
|
+
<DxcBulletedList type="square">
|
|
38
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
39
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
40
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
41
|
+
</DxcBulletedList>
|
|
42
|
+
<Title title="Circle" theme="light" level={4} />
|
|
43
|
+
<DxcBulletedList type="circle">
|
|
44
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
45
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
46
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
47
|
+
</DxcBulletedList>
|
|
48
|
+
<Title title="Disc" theme="light" level={4} />
|
|
49
|
+
<DxcBulletedList>
|
|
50
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
51
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
52
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
53
|
+
</DxcBulletedList>
|
|
54
|
+
|
|
55
|
+
<Title title="Multiple lines" theme="light" level={4} />
|
|
56
|
+
<Container>
|
|
57
|
+
<Title title="Number" theme="light" level={4} />
|
|
58
|
+
<DxcBulletedList type="number">
|
|
59
|
+
<DxcBulletedList.Item>
|
|
60
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
61
|
+
dolore magna aliqua.
|
|
62
|
+
</DxcBulletedList.Item>
|
|
63
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
64
|
+
</DxcBulletedList>
|
|
65
|
+
</Container>
|
|
66
|
+
<Container>
|
|
67
|
+
<Title title="Square" theme="light" level={4} />
|
|
68
|
+
<DxcBulletedList type="square">
|
|
69
|
+
<DxcBulletedList.Item>
|
|
70
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
71
|
+
dolore magna aliqua.
|
|
72
|
+
</DxcBulletedList.Item>
|
|
73
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
74
|
+
</DxcBulletedList>
|
|
75
|
+
</Container>
|
|
76
|
+
<Container>
|
|
77
|
+
<Title title="Circle" theme="light" level={4} />
|
|
78
|
+
<DxcBulletedList type="circle">
|
|
79
|
+
<DxcBulletedList.Item>
|
|
80
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
81
|
+
dolore magna aliqua.
|
|
82
|
+
</DxcBulletedList.Item>
|
|
83
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
84
|
+
</DxcBulletedList>
|
|
85
|
+
</Container>
|
|
86
|
+
<Title title="Disc" theme="light" level={4} />
|
|
87
|
+
<Container>
|
|
88
|
+
<DxcBulletedList>
|
|
89
|
+
<DxcBulletedList.Item>
|
|
90
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
91
|
+
dolore magna aliqua.
|
|
92
|
+
</DxcBulletedList.Item>
|
|
93
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
94
|
+
</DxcBulletedList>
|
|
95
|
+
</Container>
|
|
96
|
+
<Container>
|
|
97
|
+
<Title title="Icon" theme="light" level={4} />
|
|
98
|
+
<DxcBulletedList type="icon" icon={icon}>
|
|
99
|
+
<DxcBulletedList.Item>
|
|
100
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
101
|
+
dolore magna aliqua.
|
|
102
|
+
</DxcBulletedList.Item>
|
|
103
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
104
|
+
</DxcBulletedList>
|
|
105
|
+
</Container>
|
|
106
|
+
</ExampleContainer>
|
|
107
|
+
<BackgroundColorProvider color="#333333">
|
|
108
|
+
<DarkContainerForBulletedList>
|
|
109
|
+
<Title title="Icon list" theme="dark" level={4} />
|
|
110
|
+
<DxcBulletedList type="icon" icon={icon}>
|
|
111
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
112
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
113
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
114
|
+
</DxcBulletedList>
|
|
115
|
+
<Title title="Number list" theme="dark" level={4} />
|
|
116
|
+
<DxcBulletedList type="number">
|
|
117
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
118
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
119
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
120
|
+
</DxcBulletedList>
|
|
121
|
+
<Title title="Square" theme="dark" level={4} />
|
|
122
|
+
<DxcBulletedList type="square">
|
|
123
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
124
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
125
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
126
|
+
</DxcBulletedList>
|
|
127
|
+
<Title title="Circle" theme="dark" level={4} />
|
|
128
|
+
<DxcBulletedList type="circle">
|
|
129
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
130
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
131
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
132
|
+
</DxcBulletedList>
|
|
133
|
+
<Title title="Disc" theme="dark" level={4} />
|
|
134
|
+
<DxcBulletedList>
|
|
135
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
136
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
137
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
138
|
+
</DxcBulletedList>
|
|
139
|
+
|
|
140
|
+
<Title title="Multiple lines" theme="dark" level={4} />
|
|
141
|
+
<Container>
|
|
142
|
+
<Title title="Number" theme="dark" level={4} />
|
|
143
|
+
<DxcBulletedList type="number">
|
|
144
|
+
<DxcBulletedList.Item>
|
|
145
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
146
|
+
dolore magna aliqua.
|
|
147
|
+
</DxcBulletedList.Item>
|
|
148
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
149
|
+
</DxcBulletedList>
|
|
150
|
+
</Container>
|
|
151
|
+
<Container>
|
|
152
|
+
<Title title="Square" theme="dark" level={4} />
|
|
153
|
+
<DxcBulletedList type="square">
|
|
154
|
+
<DxcBulletedList.Item>
|
|
155
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
156
|
+
dolore magna aliqua.
|
|
157
|
+
</DxcBulletedList.Item>
|
|
158
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
159
|
+
</DxcBulletedList>
|
|
160
|
+
</Container>
|
|
161
|
+
<Container>
|
|
162
|
+
<Title title="Circle" theme="dark" level={4} />
|
|
163
|
+
<DxcBulletedList type="circle">
|
|
164
|
+
<DxcBulletedList.Item>
|
|
165
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
166
|
+
dolore magna aliqua.
|
|
167
|
+
</DxcBulletedList.Item>
|
|
168
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
169
|
+
</DxcBulletedList>
|
|
170
|
+
</Container>
|
|
171
|
+
<Title title="Disc" theme="dark" level={4} />
|
|
172
|
+
<Container>
|
|
173
|
+
<DxcBulletedList>
|
|
174
|
+
<DxcBulletedList.Item>
|
|
175
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
176
|
+
dolore magna aliqua.
|
|
177
|
+
</DxcBulletedList.Item>
|
|
178
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
179
|
+
</DxcBulletedList>
|
|
180
|
+
</Container>
|
|
181
|
+
<Container>
|
|
182
|
+
<Title title="Icon" theme="dark" level={4} />
|
|
183
|
+
<DxcBulletedList type="icon" icon={icon}>
|
|
184
|
+
<DxcBulletedList.Item>
|
|
185
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
186
|
+
dolore magna aliqua.
|
|
187
|
+
</DxcBulletedList.Item>
|
|
188
|
+
<DxcBulletedList.Item>Text 2.</DxcBulletedList.Item>
|
|
189
|
+
</DxcBulletedList>
|
|
190
|
+
</Container>
|
|
191
|
+
</DarkContainerForBulletedList>
|
|
192
|
+
</BackgroundColorProvider>
|
|
193
|
+
</>
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
const Container = styled.div`
|
|
197
|
+
width: 400px;
|
|
198
|
+
`;
|
|
199
|
+
|
|
200
|
+
const DarkContainerForBulletedList = styled.div`
|
|
201
|
+
background-color: #333333;
|
|
202
|
+
padding: 5px;
|
|
203
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
3
|
+
declare type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
type?: "disc" | "circle" | "square" | "number" | "icon";
|
|
6
|
+
icon?: string | SVG;
|
|
7
|
+
};
|
|
8
|
+
export default Props;
|
|
9
|
+
export declare type BulletedListItemPropsType = {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
};
|
|
File without changes
|
package/button/Button.js
CHANGED
|
@@ -45,14 +45,22 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
45
45
|
_ref$type = _ref.type,
|
|
46
46
|
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
47
47
|
icon = _ref.icon,
|
|
48
|
-
|
|
48
|
+
_ref$onClick = _ref.onClick,
|
|
49
|
+
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
49
50
|
margin = _ref.margin,
|
|
50
51
|
_ref$size = _ref.size,
|
|
51
52
|
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
52
53
|
_ref$tabIndex = _ref.tabIndex,
|
|
53
54
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
55
|
+
|
|
54
56
|
var colorsTheme = (0, _useTheme["default"])();
|
|
55
57
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
58
|
+
|
|
59
|
+
var labelComponent = /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
60
|
+
icon: icon,
|
|
61
|
+
iconPosition: iconPosition
|
|
62
|
+
}, label);
|
|
63
|
+
|
|
56
64
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
57
65
|
theme: colorsTheme.button
|
|
58
66
|
}, /*#__PURE__*/_react["default"].createElement(DxCButton, {
|
|
@@ -73,15 +81,12 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
73
81
|
onClick: function onClick() {
|
|
74
82
|
_onClick();
|
|
75
83
|
}
|
|
76
|
-
}, label && /*#__PURE__*/_react["default"].createElement(
|
|
77
|
-
icon: icon,
|
|
78
|
-
iconPosition: iconPosition
|
|
79
|
-
}, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
84
|
+
}, label && iconPosition === "after" && labelComponent, icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
80
85
|
label: label,
|
|
81
86
|
iconPosition: iconPosition
|
|
82
87
|
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
|
|
83
88
|
src: icon
|
|
84
|
-
}) : icon))));
|
|
89
|
+
}) : icon), label && iconPosition === "before" && labelComponent)));
|
|
85
90
|
};
|
|
86
91
|
|
|
87
92
|
var sizes = {
|
|
@@ -118,7 +123,7 @@ var IconContainer = _styledComponents["default"].div(_templateObject2 || (_templ
|
|
|
118
123
|
|
|
119
124
|
var ButtonIcon = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
120
125
|
|
|
121
|
-
var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n display: inline-block;\n width: ", ";\n cursor: ", ";\n\n .MuiButtonBase-root {\n padding-left: ", ";\n padding-right: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n\n .MuiButton-label {\n display: flex;\n
|
|
126
|
+
var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n display: inline-block;\n width: ", ";\n cursor: ", ";\n\n .MuiButtonBase-root {\n padding-left: ", ";\n padding-right: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n\n .MuiButton-label {\n display: flex;\n align-items: center;\n }\n\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n min-width: ", ";\n width: 100%;\n height: 40px;\n transition: none !important;\n\n &:focus {\n border-color: transparent;\n box-shadow: 0 0 0 2px\n ", ";\n }\n\n ", "\n }\n"])), function (props) {
|
|
122
127
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
123
128
|
}, function (props) {
|
|
124
129
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -140,8 +145,6 @@ var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateO
|
|
|
140
145
|
return props.theme.paddingTop;
|
|
141
146
|
}, function (props) {
|
|
142
147
|
return props.theme.paddingBottom;
|
|
143
|
-
}, function (props) {
|
|
144
|
-
return props.iconPosition === "after" && "row" || "row-reverse";
|
|
145
148
|
}, function (props) {
|
|
146
149
|
return props.theme.fontFamily;
|
|
147
150
|
}, function (props) {
|
|
@@ -159,9 +162,9 @@ var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateO
|
|
|
159
162
|
backgroundType = props.backgroundType;
|
|
160
163
|
|
|
161
164
|
if (mode === "primary") {
|
|
162
|
-
return "\n border-radius: ".concat(props.theme.primaryBorderRadius, ";\n border-width: ").concat(props.theme.primaryBorderThickness, ";\n border-style: ").concat(props.theme.primaryBorderStyle, ";\n font-family: ").concat(props.theme.primaryFontFamily, ";\n font-size: ").concat(props.theme.primaryFontSize, ";\n font-weight: ").concat(props.theme.primaryFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryBackgroundColorOnDark : props.theme.primaryBackgroundColor, ";\n color: ").concat(backgroundType && backgroundType === "dark" ? props.theme.primaryFontColorOnDark : props.theme.primaryFontColor, " !important;\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryHoverBackgroundColorOnDark : props.theme.primaryHoverBackgroundColor, ";\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryActiveBackgroundColorOnDark : props.theme.primaryActiveBackgroundColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled { \n cursor: not-allowed;\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryDisabledBackgroundColorOnDark : props.theme.primaryDisabledBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.primaryDisabledFontColorOnDark : props.theme.primaryDisabledFontColor, "!important; \n }\n
|
|
165
|
+
return "\n border-radius: ".concat(props.theme.primaryBorderRadius, ";\n border-width: ").concat(props.theme.primaryBorderThickness, ";\n border-style: ").concat(props.theme.primaryBorderStyle, ";\n font-family: ").concat(props.theme.primaryFontFamily, ";\n font-size: ").concat(props.theme.primaryFontSize, ";\n font-weight: ").concat(props.theme.primaryFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryBackgroundColorOnDark : props.theme.primaryBackgroundColor, ";\n color: ").concat(backgroundType && backgroundType === "dark" ? props.theme.primaryFontColorOnDark : props.theme.primaryFontColor, " !important;\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryHoverBackgroundColorOnDark : props.theme.primaryHoverBackgroundColor, ";\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryActiveBackgroundColorOnDark : props.theme.primaryActiveBackgroundColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled { \n cursor: not-allowed;\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryDisabledBackgroundColorOnDark : props.theme.primaryDisabledBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.primaryDisabledFontColorOnDark : props.theme.primaryDisabledFontColor, " !important; \n }\n ");
|
|
163
166
|
} else if (mode === "secondary") {
|
|
164
|
-
return "\n border-radius: ".concat(props.theme.secondaryBorderRadius, ";\n border-width: ").concat(props.theme.secondaryBorderThickness, ";\n border-style: ").concat(props.theme.secondaryBorderStyle, ";\n font-family: ").concat(props.theme.secondaryFontFamily, ";\n font-size: ").concat(props.theme.secondaryFontSize, ";\n font-weight: ").concat(props.theme.secondaryFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryBackgroundColorOnDark : props.theme.secondaryBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryFontColorOnDark : props.theme.secondaryFontColor, " !important;\n border-color: ").concat(backgroundType === "dark" ? props.theme.secondaryBorderColorOnDark : props.theme.secondaryBorderColor, ";\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverBackgroundColorOnDark : props.theme.secondaryHoverBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor, " !important;\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryActiveBackgroundColorOnDark : props.theme.secondaryActiveBackgroundColor, " !important;\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledBackgroundColorOnDark : props.theme.secondaryDisabledBackgroundColor, " !important;\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledFontColorOnDark : props.theme.secondaryDisabledFontColor, " !important;\n border-color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledBorderColorOnDark : props.theme.secondaryDisabledBorderColor, ";\n }\n
|
|
167
|
+
return "\n border-radius: ".concat(props.theme.secondaryBorderRadius, ";\n border-width: ").concat(props.theme.secondaryBorderThickness, ";\n border-style: ").concat(props.theme.secondaryBorderStyle, ";\n font-family: ").concat(props.theme.secondaryFontFamily, ";\n font-size: ").concat(props.theme.secondaryFontSize, ";\n font-weight: ").concat(props.theme.secondaryFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryBackgroundColorOnDark : props.theme.secondaryBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryFontColorOnDark : props.theme.secondaryFontColor, " !important;\n border-color: ").concat(backgroundType === "dark" ? props.theme.secondaryBorderColorOnDark : props.theme.secondaryBorderColor, ";\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverBackgroundColorOnDark : props.theme.secondaryHoverBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor, " !important;\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryActiveBackgroundColorOnDark : props.theme.secondaryActiveBackgroundColor, " !important;\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledBackgroundColorOnDark : props.theme.secondaryDisabledBackgroundColor, " !important;\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledFontColorOnDark : props.theme.secondaryDisabledFontColor, " !important;\n border-color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledBorderColorOnDark : props.theme.secondaryDisabledBorderColor, ";\n }\n ");
|
|
165
168
|
} else if (mode === "text") {
|
|
166
169
|
return "\n border-radius: ".concat(props.theme.textBorderRadius, ";\n border-width: ").concat(props.theme.textBorderThickness, ";\n border-style: ").concat(props.theme.textBorderStyle, ";\n font-family: ").concat(props.theme.textFontFamily, ";\n font-size: ").concat(props.theme.textFontSize, ";\n font-weight: ").concat(props.theme.textFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.textBackgroundColorOnDark : props.theme.textBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.textFontColorOnDark : props.theme.textFontColor, " !important;\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.textHoverBackgroundColorOnDark : props.theme.textHoverBackgroundColor, ";\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.textActiveBackgroundColorOnDark : props.theme.textActiveBackgroundColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled {\n cursor:not-allowed;\n color: ").concat(backgroundType === "dark" ? props.theme.textDisabledFontColorOnDark : props.theme.textDisabledFontColor, " !important;\n background-color: ").concat(backgroundType === "dark" ? props.theme.textDisabledBackgroundColorOnDark : props.theme.textDisabledBackgroundColor, ";\n }\n ");
|
|
167
170
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _Button = _interopRequireDefault(require("./Button"));
|
|
10
|
+
|
|
11
|
+
describe("Button component tests", function () {
|
|
12
|
+
test("Button renders with correct text", function () {
|
|
13
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
14
|
+
label: "Button"
|
|
15
|
+
})),
|
|
16
|
+
getByText = _render.getByText;
|
|
17
|
+
|
|
18
|
+
expect(getByText("Button")).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
test("Calls correct function on click", function () {
|
|
21
|
+
var onClick = jest.fn();
|
|
22
|
+
|
|
23
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
24
|
+
label: "Button",
|
|
25
|
+
onClick: onClick
|
|
26
|
+
})),
|
|
27
|
+
getByText = _render2.getByText;
|
|
28
|
+
|
|
29
|
+
var button = getByText("Button");
|
|
30
|
+
|
|
31
|
+
_react2.fireEvent.click(button);
|
|
32
|
+
|
|
33
|
+
expect(onClick).toHaveBeenCalled();
|
|
34
|
+
});
|
|
35
|
+
});
|
package/card/Card.js
CHANGED
|
@@ -25,7 +25,7 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
25
25
|
|
|
26
26
|
var _Box = _interopRequireDefault(require("../box/Box"));
|
|
27
27
|
|
|
28
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5
|
|
28
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
29
29
|
|
|
30
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
31
|
|
|
@@ -56,22 +56,13 @@ var DxcCard = function DxcCard(_ref) {
|
|
|
56
56
|
isHovered = _useState2[0],
|
|
57
57
|
changeIsHovered = _useState2[1];
|
|
58
58
|
|
|
59
|
-
var
|
|
60
|
-
shadowDepth: !outlined ? 0 : isHovered && (onClick || linkHref) ? 2 : 1
|
|
61
|
-
}, /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
62
|
-
theme: colorsTheme.card
|
|
63
|
-
}, /*#__PURE__*/_react["default"].createElement(CardContainer, {
|
|
64
|
-
hasAction: onClick || linkHref,
|
|
65
|
-
imagePosition: imagePosition
|
|
66
|
-
}, imageSrc && /*#__PURE__*/_react["default"].createElement(ImageContainer, {
|
|
59
|
+
var imageComponent = /*#__PURE__*/_react["default"].createElement(ImageContainer, {
|
|
67
60
|
imageBgColor: imageBgColor
|
|
68
61
|
}, /*#__PURE__*/_react["default"].createElement(TagImage, {
|
|
69
62
|
imagePadding: imagePadding,
|
|
70
63
|
cover: imageCover,
|
|
71
64
|
src: imageSrc
|
|
72
|
-
}))
|
|
73
|
-
contentPadding: contentPadding
|
|
74
|
-
}, children))));
|
|
65
|
+
}));
|
|
75
66
|
|
|
76
67
|
return /*#__PURE__*/_react["default"].createElement(StyledDxcCard, {
|
|
77
68
|
margin: margin,
|
|
@@ -82,15 +73,23 @@ var DxcCard = function DxcCard(_ref) {
|
|
|
82
73
|
return changeIsHovered(false);
|
|
83
74
|
},
|
|
84
75
|
onClick: onClick,
|
|
85
|
-
hasAction: onClick,
|
|
86
|
-
tabIndex:
|
|
87
|
-
|
|
88
|
-
tabIndex: tabIndex,
|
|
76
|
+
hasAction: onClick || linkHref,
|
|
77
|
+
tabIndex: onClick || linkHref ? tabIndex : -1,
|
|
78
|
+
as: linkHref && "a",
|
|
89
79
|
href: linkHref
|
|
90
|
-
},
|
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
81
|
+
shadowDepth: !outlined ? 0 : isHovered && (onClick || linkHref) ? 2 : 1
|
|
82
|
+
}, /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
83
|
+
theme: colorsTheme.card
|
|
84
|
+
}, /*#__PURE__*/_react["default"].createElement(CardContainer, {
|
|
85
|
+
hasAction: onClick || linkHref,
|
|
86
|
+
imagePosition: imagePosition
|
|
87
|
+
}, imageSrc && imagePosition === "before" && imageComponent, /*#__PURE__*/_react["default"].createElement(CardContent, {
|
|
88
|
+
contentPadding: contentPadding
|
|
89
|
+
}, children), imageSrc && imagePosition === "after" && imageComponent))));
|
|
91
90
|
};
|
|
92
91
|
|
|
93
|
-
var StyledDxcCard = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n cursor: ", ";\n outline: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n
|
|
92
|
+
var StyledDxcCard = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n cursor: ", ";\n outline: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n text-decoration: none;\n\n ", "\n"])), function (_ref2) {
|
|
94
93
|
var hasAction = _ref2.hasAction;
|
|
95
94
|
return hasAction && "pointer" || "unset";
|
|
96
95
|
}, function (_ref3) {
|
|
@@ -111,12 +110,12 @@ var StyledDxcCard = _styledComponents["default"].div(_templateObject || (_templa
|
|
|
111
110
|
}, function (_ref8) {
|
|
112
111
|
var margin = _ref8.margin;
|
|
113
112
|
return margin && margin.left ? _variables.spaces[margin.left] : "";
|
|
113
|
+
}, function (_ref9) {
|
|
114
|
+
var hasAction = _ref9.hasAction;
|
|
115
|
+
return hasAction && ":focus {\n outline: #0095ff auto 1px;\n }";
|
|
114
116
|
});
|
|
115
117
|
|
|
116
|
-
var CardContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n
|
|
117
|
-
var imagePosition = _ref9.imagePosition;
|
|
118
|
-
return imagePosition === "before" && "row" || "row-reverse";
|
|
119
|
-
}, function (props) {
|
|
118
|
+
var CardContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n height: ", ";\n width: ", ";\n &:hover {\n border-color: ", ";\n }\n"])), function (props) {
|
|
120
119
|
return props.theme.height;
|
|
121
120
|
}, function (props) {
|
|
122
121
|
return props.theme.width;
|
|
@@ -125,9 +124,7 @@ var CardContainer = _styledComponents["default"].div(_templateObject2 || (_templ
|
|
|
125
124
|
return hasAction ? "" : "unset";
|
|
126
125
|
});
|
|
127
126
|
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
var TagImage = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n object-fit: ", ";\n"])), function (_ref11) {
|
|
127
|
+
var TagImage = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n object-fit: ", ";\n"])), function (_ref11) {
|
|
131
128
|
var imagePadding = _ref11.imagePadding;
|
|
132
129
|
return !imagePadding ? "100%" : "calc(100% - ".concat(_variables.spaces[imagePadding], " - ").concat(_variables.spaces[imagePadding], ")");
|
|
133
130
|
}, function (_ref12) {
|
|
@@ -138,12 +135,12 @@ var TagImage = _styledComponents["default"].img(_templateObject4 || (_templateOb
|
|
|
138
135
|
return cover ? "cover" : "contain";
|
|
139
136
|
});
|
|
140
137
|
|
|
141
|
-
var ImageContainer = _styledComponents["default"].div(
|
|
138
|
+
var ImageContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 35%;\n height: 100%;\n flex-shrink: 0;\n background: ", ";\n justify-content: center;\n align-items: center;\n display: inline-flex;\n"])), function (_ref14) {
|
|
142
139
|
var imageBgColor = _ref14.imageBgColor;
|
|
143
140
|
return imageBgColor;
|
|
144
141
|
});
|
|
145
142
|
|
|
146
|
-
var CardContent = _styledComponents["default"].div(
|
|
143
|
+
var CardContent = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n flex-grow: 1;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n overflow: hidden;\n"])), function (_ref15) {
|
|
147
144
|
var contentPadding = _ref15.contentPadding;
|
|
148
145
|
return contentPadding && (0, _typeof2["default"])(contentPadding) !== "object" ? _variables.spaces[contentPadding] : "0px";
|
|
149
146
|
}, function (_ref16) {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _Card = _interopRequireDefault(require("./Card"));
|
|
10
|
+
|
|
11
|
+
describe("Card component tests", function () {
|
|
12
|
+
test("Card renders with correct content", function () {
|
|
13
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], null, "test-card")),
|
|
14
|
+
getByText = _render.getByText;
|
|
15
|
+
|
|
16
|
+
expect(getByText("test-card")).toBeTruthy();
|
|
17
|
+
});
|
|
18
|
+
test("Card renders with correct href", function () {
|
|
19
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
20
|
+
linkHref: "/testPage"
|
|
21
|
+
}, "test-card")),
|
|
22
|
+
getByRole = _render2.getByRole;
|
|
23
|
+
|
|
24
|
+
var card = getByRole("link");
|
|
25
|
+
expect(card.getAttribute("href")).toEqual("/testPage");
|
|
26
|
+
});
|
|
27
|
+
test("Card renders with correct image", function () {
|
|
28
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
29
|
+
imageSrc: "/testImage"
|
|
30
|
+
}, "test-card")),
|
|
31
|
+
getByRole = _render3.getByRole;
|
|
32
|
+
|
|
33
|
+
var card = getByRole("img");
|
|
34
|
+
expect(card.getAttribute("src")).toEqual("/testImage");
|
|
35
|
+
});
|
|
36
|
+
test("OnClick function is called", function () {
|
|
37
|
+
var onClick = jest.fn();
|
|
38
|
+
|
|
39
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
40
|
+
onClick: onClick
|
|
41
|
+
}, "test-card")),
|
|
42
|
+
getByText = _render4.getByText;
|
|
43
|
+
|
|
44
|
+
var card = getByText("test-card");
|
|
45
|
+
|
|
46
|
+
_react2.fireEvent.click(card);
|
|
47
|
+
|
|
48
|
+
expect(onClick).toHaveBeenCalled();
|
|
49
|
+
});
|
|
50
|
+
});
|
package/checkbox/Checkbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import CheckboxPropsType from "./types";
|
|
3
|
-
declare const DxcCheckbox: ({ checked, value, label, labelPosition, name, disabled,
|
|
3
|
+
declare const DxcCheckbox: ({ checked, defaultChecked, value, label, labelPosition, name, disabled, optional, onChange, margin, size, tabIndex, }: CheckboxPropsType) => JSX.Element;
|
|
4
4
|
export default DxcCheckbox;
|