@dxc-technology/halstack-react 0.0.0-bd47c58 → 0.0.0-bd89f9e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +2 -2
- package/BackgroundColorContext.js +5 -17
- package/HalstackContext.d.ts +14 -5
- package/HalstackContext.js +9 -34
- package/accordion/Accordion.js +21 -58
- package/accordion/Accordion.stories.tsx +1 -15
- package/accordion/Accordion.test.js +18 -33
- package/accordion/types.d.ts +5 -5
- package/accordion-group/AccordionGroup.js +15 -42
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +42 -60
- package/accordion-group/AccordionGroupAccordion.js +9 -21
- package/accordion-group/types.d.ts +6 -6
- package/alert/Alert.js +14 -46
- package/alert/Alert.test.js +28 -45
- package/alert/types.d.ts +5 -5
- package/badge/Badge.js +4 -17
- package/badge/types.d.ts +1 -1
- package/bleed/Bleed.js +13 -21
- package/bleed/types.d.ts +2 -2
- package/box/Box.js +10 -29
- package/box/Box.test.js +1 -6
- package/box/types.d.ts +3 -3
- package/bulleted-list/BulletedList.js +7 -33
- package/bulleted-list/BulletedList.stories.tsx +1 -91
- package/bulleted-list/types.d.ts +5 -5
- package/button/Button.js +23 -46
- package/button/Button.stories.tsx +5 -86
- package/button/Button.test.js +11 -21
- package/button/types.d.ts +4 -4
- package/card/Card.js +21 -44
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +5 -5
- package/checkbox/Checkbox.js +81 -111
- package/checkbox/Checkbox.stories.tsx +16 -54
- package/checkbox/Checkbox.test.js +107 -63
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.js +12 -31
- package/chip/Chip.stories.tsx +1 -1
- package/chip/Chip.test.js +15 -28
- package/chip/types.d.ts +4 -4
- package/common/coreTokens.d.ts +105 -14
- package/common/coreTokens.js +40 -23
- package/common/utils.js +2 -8
- package/common/variables.d.ts +15 -6
- package/common/variables.js +17 -15
- package/container/Container.d.ts +4 -0
- package/container/Container.js +198 -0
- package/container/Container.stories.tsx +229 -0
- package/container/types.d.ts +74 -0
- package/date-input/Calendar.js +13 -57
- package/date-input/DateInput.js +50 -96
- package/date-input/DateInput.stories.tsx +11 -30
- package/date-input/DateInput.test.js +674 -701
- package/date-input/DatePicker.js +11 -42
- package/date-input/Icons.d.ts +6 -6
- package/date-input/Icons.js +6 -23
- package/date-input/YearPicker.js +8 -34
- package/date-input/types.d.ts +27 -21
- package/dialog/Dialog.js +11 -35
- package/dialog/Dialog.test.js +125 -187
- package/dialog/types.d.ts +18 -13
- package/dropdown/Dropdown.js +39 -93
- package/dropdown/Dropdown.test.js +391 -378
- package/dropdown/DropdownMenu.js +8 -19
- package/dropdown/DropdownMenuItem.js +5 -17
- package/dropdown/types.d.ts +17 -19
- package/file-input/FileInput.js +180 -248
- package/file-input/FileInput.stories.tsx +1 -1
- package/file-input/FileInput.test.js +356 -354
- package/file-input/FileItem.js +12 -39
- package/file-input/types.d.ts +9 -9
- package/flex/Flex.js +25 -39
- package/flex/types.d.ts +6 -6
- package/footer/Footer.js +9 -39
- package/footer/Footer.stories.tsx +8 -7
- package/footer/Footer.test.js +18 -32
- package/footer/Icons.d.ts +2 -2
- package/footer/Icons.js +2 -7
- package/footer/types.d.ts +13 -13
- package/grid/Grid.js +1 -16
- package/grid/types.d.ts +10 -10
- package/header/Header.d.ts +1 -1
- package/header/Header.js +19 -64
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +5 -7
- package/heading/Heading.js +9 -31
- package/heading/Heading.test.js +70 -87
- package/heading/types.d.ts +7 -7
- package/image/Image.d.ts +2 -2
- package/image/Image.js +17 -32
- package/image/types.d.ts +2 -2
- package/inset/Inset.js +13 -21
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +1 -1
- package/layout/ApplicationLayout.js +25 -65
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +8 -5
- package/layout/Icons.js +51 -59
- package/layout/SidenavContext.d.ts +1 -1
- package/layout/SidenavContext.js +3 -9
- package/layout/types.d.ts +3 -3
- package/link/Link.js +21 -42
- package/link/Link.test.js +23 -41
- package/link/types.d.ts +14 -14
- package/main.d.ts +3 -2
- package/main.js +10 -52
- package/nav-tabs/NavTabs.js +11 -43
- package/nav-tabs/NavTabs.stories.tsx +1 -1
- package/nav-tabs/NavTabs.test.js +36 -43
- package/nav-tabs/Tab.js +16 -45
- package/nav-tabs/types.d.ts +9 -9
- package/number-input/NumberInput.d.ts +1 -1
- package/number-input/NumberInput.js +24 -35
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +682 -577
- package/number-input/types.d.ts +11 -5
- package/package.json +29 -27
- package/paginator/Icons.d.ts +5 -5
- package/paginator/Icons.js +5 -19
- package/paginator/Paginator.js +14 -39
- package/paginator/Paginator.test.js +224 -207
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.js +3 -14
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/Icons.d.ts +3 -3
- package/password-input/Icons.js +1 -5
- package/password-input/PasswordInput.js +26 -48
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +153 -129
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.js +16 -42
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
- package/progress-bar/ProgressBar.test.js +35 -52
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +1 -1
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +22 -54
- package/radio-group/RadioGroup.js +37 -83
- package/radio-group/RadioGroup.stories.tsx +10 -10
- package/radio-group/RadioGroup.test.js +504 -470
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/{resultsetTable → resultset-table}/Icons.js +1 -5
- package/{resultsetTable → resultset-table}/ResultsetTable.js +23 -59
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +72 -92
- package/{resultsetTable → resultset-table}/types.d.ts +7 -7
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.js +13 -39
- package/select/Option.js +9 -26
- package/select/Select.js +54 -138
- package/select/Select.stories.tsx +3 -3
- package/select/Select.test.js +1906 -1800
- package/select/types.d.ts +14 -15
- package/sidenav/Icons.d.ts +4 -4
- package/sidenav/Icons.js +1 -5
- package/sidenav/Sidenav.js +24 -63
- package/sidenav/Sidenav.test.js +3 -10
- package/sidenav/types.d.ts +18 -18
- package/slider/Slider.js +38 -86
- package/slider/Slider.test.js +107 -103
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +10 -40
- package/spinner/Spinner.test.js +25 -34
- package/spinner/types.d.ts +3 -3
- package/switch/Switch.js +26 -69
- package/switch/Switch.stories.tsx +0 -34
- package/switch/Switch.test.js +51 -96
- package/switch/types.d.ts +4 -4
- package/table/Table.js +4 -23
- package/table/Table.test.js +1 -6
- package/table/types.d.ts +8 -8
- package/tabs/Tab.js +10 -29
- package/tabs/Tabs.js +48 -124
- package/tabs/Tabs.test.js +62 -118
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.js +21 -51
- package/tag/Tag.test.js +19 -30
- package/tag/types.d.ts +7 -7
- package/text-input/Icons.d.ts +5 -5
- package/text-input/Icons.js +1 -5
- package/text-input/Suggestion.js +9 -26
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +12 -57
- package/text-input/TextInput.js +128 -193
- package/text-input/TextInput.stories.tsx +48 -152
- package/text-input/TextInput.test.js +1210 -1194
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.js +60 -96
- package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -99
- package/textarea/Textarea.test.js +150 -179
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.js +20 -57
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +48 -81
- package/toggle-group/types.d.ts +10 -10
- package/typography/Typography.js +4 -13
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +12 -3
- package/useTheme.js +1 -8
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +2 -2
- package/utils/BaseTypography.js +16 -30
- package/utils/FocusLock.js +12 -36
- package/wizard/Wizard.js +14 -49
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +6 -6
- package/resultsetTable/Icons.d.ts +0 -7
- package/slider/Slider.stories.tsx +0 -240
- /package/{resultsetTable → container}/types.js +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +0 -0
- /package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
- /package/table/{Table.stories.jsx → Table.stories.tsx} +0 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
|
+
import DxcContainer from "./Container";
|
|
5
|
+
import DxcParagraph from "../paragraph/Paragraph";
|
|
6
|
+
import DxcTypography from "../typography/Typography";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Container",
|
|
10
|
+
component: DxcContainer,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Chromatic = () => (
|
|
14
|
+
<>
|
|
15
|
+
<Title title="Box sizing border box" level={4} />
|
|
16
|
+
<ExampleContainer>
|
|
17
|
+
<DxcContainer
|
|
18
|
+
boxSizing="border-box"
|
|
19
|
+
width="200px"
|
|
20
|
+
height="200px"
|
|
21
|
+
background={{ color: "color_purple_400" }}
|
|
22
|
+
border={{
|
|
23
|
+
top: {
|
|
24
|
+
width: "2px",
|
|
25
|
+
color: "color_blue_600",
|
|
26
|
+
style: "solid",
|
|
27
|
+
},
|
|
28
|
+
bottom: {
|
|
29
|
+
width: "thick",
|
|
30
|
+
color: "color_purple_600",
|
|
31
|
+
style: "solid",
|
|
32
|
+
},
|
|
33
|
+
}}
|
|
34
|
+
borderRadius="0 0 0.25rem 0.25rem"
|
|
35
|
+
padding="medium"
|
|
36
|
+
margin="large"
|
|
37
|
+
>
|
|
38
|
+
<b>Example text</b>
|
|
39
|
+
</DxcContainer>
|
|
40
|
+
</ExampleContainer>
|
|
41
|
+
<Title title="Background image" level={4} />
|
|
42
|
+
<ExampleContainer>
|
|
43
|
+
<DxcContainer
|
|
44
|
+
background={{
|
|
45
|
+
image: "url(https://www.laecuaciondigital.com/wp-content/uploads/2023/10/DXC-Technology.png)",
|
|
46
|
+
position: "50%",
|
|
47
|
+
}}
|
|
48
|
+
width="500px"
|
|
49
|
+
height="500px"
|
|
50
|
+
>
|
|
51
|
+
<p>Example text</p>
|
|
52
|
+
</DxcContainer>
|
|
53
|
+
</ExampleContainer>
|
|
54
|
+
<Title title="Positioning of boxes" level={4} />
|
|
55
|
+
<ExampleContainer>
|
|
56
|
+
<DxcContainer
|
|
57
|
+
position="relative"
|
|
58
|
+
width="fit-content"
|
|
59
|
+
border={{ color: "color_purple_400", width: "2px", style: "dashed" }}
|
|
60
|
+
borderRadius="0.25rem"
|
|
61
|
+
margin={{ bottom: "xxlarge" }}
|
|
62
|
+
>
|
|
63
|
+
<DxcContainer display="inline-block" background={{ color: "color_purple_400" }} width="50px" height="50px">
|
|
64
|
+
<b>1</b>
|
|
65
|
+
</DxcContainer>
|
|
66
|
+
<DxcContainer display="inline-block" background={{ color: "color_purple_400" }} width="50px" height="50px">
|
|
67
|
+
<b>2</b>
|
|
68
|
+
</DxcContainer>
|
|
69
|
+
<DxcContainer
|
|
70
|
+
display="inline-block"
|
|
71
|
+
position="absolute"
|
|
72
|
+
inset={{ top: "25px", left: "0" }}
|
|
73
|
+
background={{ color: "color_blue_500" }}
|
|
74
|
+
width="50px"
|
|
75
|
+
height="50px"
|
|
76
|
+
zIndex={1}
|
|
77
|
+
>
|
|
78
|
+
<b>3</b>
|
|
79
|
+
</DxcContainer>
|
|
80
|
+
</DxcContainer>
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<Title title="Margin collapse" level={4} />
|
|
83
|
+
<ExampleContainer>
|
|
84
|
+
<DxcContainer
|
|
85
|
+
width="fit-content"
|
|
86
|
+
border={{ color: "color_purple_400", width: "2px", style: "dashed" }}
|
|
87
|
+
borderRadius="0.25rem"
|
|
88
|
+
>
|
|
89
|
+
<DxcContainer
|
|
90
|
+
background={{ color: "color_purple_400" }}
|
|
91
|
+
width="50px"
|
|
92
|
+
height="50px"
|
|
93
|
+
margin={{ bottom: "medium" }}
|
|
94
|
+
>
|
|
95
|
+
<b>1</b>
|
|
96
|
+
</DxcContainer>
|
|
97
|
+
<DxcContainer background={{ color: "color_purple_400" }} width="50px" height="50px" margin={{ top: "large" }}>
|
|
98
|
+
<b>2</b>
|
|
99
|
+
</DxcContainer>
|
|
100
|
+
</DxcContainer>
|
|
101
|
+
</ExampleContainer>
|
|
102
|
+
<Title title="Overflow" level={4} />
|
|
103
|
+
<ExampleContainer>
|
|
104
|
+
<DxcContainer overflow={{ x: "auto" }} maxHeight="100px" width="fit-content">
|
|
105
|
+
<DxcContainer
|
|
106
|
+
border={{ width: "1px", style: "solid", color: "color_black" }}
|
|
107
|
+
background={{ color: "color_purple_400" }}
|
|
108
|
+
width="50px"
|
|
109
|
+
height="50px"
|
|
110
|
+
>
|
|
111
|
+
<b>1</b>
|
|
112
|
+
</DxcContainer>
|
|
113
|
+
<DxcContainer
|
|
114
|
+
border={{ width: "1px", style: "solid", color: "color_black" }}
|
|
115
|
+
background={{ color: "color_purple_400" }}
|
|
116
|
+
width="50px"
|
|
117
|
+
height="50px"
|
|
118
|
+
>
|
|
119
|
+
<b>2</b>
|
|
120
|
+
</DxcContainer>
|
|
121
|
+
<DxcContainer
|
|
122
|
+
border={{ width: "1px", style: "solid", color: "color_black" }}
|
|
123
|
+
background={{ color: "color_purple_400" }}
|
|
124
|
+
width="50px"
|
|
125
|
+
height="50px"
|
|
126
|
+
>
|
|
127
|
+
<b>3</b>
|
|
128
|
+
</DxcContainer>
|
|
129
|
+
</DxcContainer>
|
|
130
|
+
</ExampleContainer>
|
|
131
|
+
<Title title="Float" level={4} />
|
|
132
|
+
<ExampleContainer>
|
|
133
|
+
<DxcContainer padding="medium" border={{ width: "1px", style: "solid", color: "color_black" }}>
|
|
134
|
+
<DxcContainer float="right" background={{ color: "color_purple_400" }} width="100px" height="100px">
|
|
135
|
+
<b>Floating text</b>
|
|
136
|
+
</DxcContainer>
|
|
137
|
+
<p style={{ margin: 0 }}>
|
|
138
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla facilisis, sapien vitae aliquam lacinia, nisl
|
|
139
|
+
quam tincidunt ligula, eget aliquam eros quam quis nunc. Donec euismod, nisl eget ultricies aliquam, nisl
|
|
140
|
+
velit aliquam nunc, quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit
|
|
141
|
+
aliquam nunc, quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam
|
|
142
|
+
nunc, quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc,
|
|
143
|
+
quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc, quis
|
|
144
|
+
aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc, quis aliquam
|
|
145
|
+
nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc, quis aliquam nisl.
|
|
146
|
+
</p>
|
|
147
|
+
</DxcContainer>
|
|
148
|
+
</ExampleContainer>
|
|
149
|
+
<Title title="Box shadow and opacity" level={4} />
|
|
150
|
+
<ExampleContainer>
|
|
151
|
+
<DxcContainer
|
|
152
|
+
padding="medium"
|
|
153
|
+
outline={{ width: "1px", style: "solid", color: "color_black" }}
|
|
154
|
+
boxShadow="10px 5px 5px #fe0123"
|
|
155
|
+
>
|
|
156
|
+
<p style={{ margin: 0 }}>
|
|
157
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla facilisis, sapien vitae aliquam lacinia, nisl
|
|
158
|
+
quam tincidunt ligula, eget aliquam eros quam quis nunc. Donec euismod, nisl eget ultricies aliquam, nisl
|
|
159
|
+
velit aliquam nunc, quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit
|
|
160
|
+
aliquam nunc, quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam
|
|
161
|
+
nunc, quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc,
|
|
162
|
+
quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc, quis
|
|
163
|
+
aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc, quis aliquam
|
|
164
|
+
nisl.
|
|
165
|
+
</p>
|
|
166
|
+
</DxcContainer>
|
|
167
|
+
</ExampleContainer>
|
|
168
|
+
<Title title="Background color provider" level={4} />
|
|
169
|
+
<ExampleContainer>
|
|
170
|
+
<DxcContainer padding="medium" background={{ color: "color_black" }}>
|
|
171
|
+
<DxcParagraph>
|
|
172
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla facilisis, sapien vitae aliquam lacinia, nisl
|
|
173
|
+
quam tincidunt ligula, eget aliquam eros quam quis nunc. Donec euismod, nisl eget ultricies aliquam, nisl
|
|
174
|
+
velit aliquam nunc, quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit
|
|
175
|
+
aliquam nunc, quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam
|
|
176
|
+
nunc, quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc,
|
|
177
|
+
quis aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc, quis
|
|
178
|
+
aliquam nisl nunc vel nisl. Donec euismod, nisl eget ultricies aliquam, nisl velit aliquam nunc, quis aliquam
|
|
179
|
+
nisl.
|
|
180
|
+
</DxcParagraph>
|
|
181
|
+
</DxcContainer>
|
|
182
|
+
<Title title="Building a listbox component" level={4} />
|
|
183
|
+
<ExampleContainer>
|
|
184
|
+
<Listbox suggestions={["Option 1", "Option 2", "Option 3", "Option 4", "Option 5"]} />
|
|
185
|
+
</ExampleContainer>
|
|
186
|
+
<Title title="Border and outline" level={4} />
|
|
187
|
+
<ExampleContainer>
|
|
188
|
+
<DxcContainer
|
|
189
|
+
outline={{ color: "color_blue_400", style: "solid", offset: "2px" }}
|
|
190
|
+
border={{ top: { style: "solid" } }}
|
|
191
|
+
>
|
|
192
|
+
Example text
|
|
193
|
+
</DxcContainer>
|
|
194
|
+
</ExampleContainer>
|
|
195
|
+
</ExampleContainer>
|
|
196
|
+
</>
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
const Listbox = ({ suggestions = [] }: { suggestions: string[] }): JSX.Element => (
|
|
200
|
+
<DxcContainer
|
|
201
|
+
boxSizing="border-box"
|
|
202
|
+
boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1)"
|
|
203
|
+
border={{ width: "1px", style: "solid", color: "color_grey_400" }}
|
|
204
|
+
borderRadius="0.25rem"
|
|
205
|
+
background={{ color: "color_white" }}
|
|
206
|
+
padding={{ top: "xxsmall", bottom: "xxsmall" }}
|
|
207
|
+
maxHeight="304px"
|
|
208
|
+
width="250px"
|
|
209
|
+
overflow={{ x: "hidden", y: "auto" }}
|
|
210
|
+
>
|
|
211
|
+
{suggestions.map((suggestion, index) => (
|
|
212
|
+
<DxcContainer padding={{ left: "xsmall", right: "xsmall" }}>
|
|
213
|
+
<DxcContainer
|
|
214
|
+
border={
|
|
215
|
+
index !== suggestions.length - 1
|
|
216
|
+
? { bottom: { width: "1px", style: "solid", color: "color_grey_200" } }
|
|
217
|
+
: undefined
|
|
218
|
+
}
|
|
219
|
+
padding={{ top: "xxsmall", bottom: "xxsmall", left: "xxsmall", right: "xxsmall" }}
|
|
220
|
+
overflow="hidden"
|
|
221
|
+
>
|
|
222
|
+
<DxcTypography whiteSpace="nowrap" textOverflow="ellipsis" lineHeight="1.715em">
|
|
223
|
+
{suggestion}
|
|
224
|
+
</DxcTypography>
|
|
225
|
+
</DxcContainer>
|
|
226
|
+
</DxcContainer>
|
|
227
|
+
))}
|
|
228
|
+
</DxcContainer>
|
|
229
|
+
);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CoreColorTokens } from "../common/coreTokens";
|
|
3
|
+
type SpacingValues = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
4
|
+
type Space = SpacingValues | {
|
|
5
|
+
top?: SpacingValues;
|
|
6
|
+
right?: SpacingValues;
|
|
7
|
+
bottom?: SpacingValues;
|
|
8
|
+
left?: SpacingValues;
|
|
9
|
+
};
|
|
10
|
+
type Inset = {
|
|
11
|
+
top?: string;
|
|
12
|
+
right?: string;
|
|
13
|
+
bottom?: string;
|
|
14
|
+
left?: string;
|
|
15
|
+
};
|
|
16
|
+
type Background = {
|
|
17
|
+
attachment?: string;
|
|
18
|
+
clip?: string;
|
|
19
|
+
color?: CoreColorTokens;
|
|
20
|
+
image?: string;
|
|
21
|
+
origin?: string;
|
|
22
|
+
position?: string;
|
|
23
|
+
repeat?: string;
|
|
24
|
+
size?: string;
|
|
25
|
+
};
|
|
26
|
+
export type BorderProperties = {
|
|
27
|
+
width?: string;
|
|
28
|
+
style?: "none" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset";
|
|
29
|
+
color?: CoreColorTokens;
|
|
30
|
+
};
|
|
31
|
+
type Border = BorderProperties | {
|
|
32
|
+
top?: BorderProperties;
|
|
33
|
+
right?: BorderProperties;
|
|
34
|
+
bottom?: BorderProperties;
|
|
35
|
+
left?: BorderProperties;
|
|
36
|
+
};
|
|
37
|
+
type Outline = BorderProperties & {
|
|
38
|
+
offset?: string;
|
|
39
|
+
};
|
|
40
|
+
type OverflowValues = "visible" | "hidden" | "clip" | "scroll" | "auto";
|
|
41
|
+
type Overflow = OverflowValues | {
|
|
42
|
+
x?: OverflowValues;
|
|
43
|
+
y?: OverflowValues;
|
|
44
|
+
};
|
|
45
|
+
type Props = {
|
|
46
|
+
boxSizing?: "border-box" | "content-box";
|
|
47
|
+
display?: "block" | "inline-block" | "inline" | "none";
|
|
48
|
+
width?: string;
|
|
49
|
+
height?: string;
|
|
50
|
+
maxWidth?: string;
|
|
51
|
+
maxHeight?: string;
|
|
52
|
+
minWidth?: string;
|
|
53
|
+
minHeight?: string;
|
|
54
|
+
padding?: Space;
|
|
55
|
+
border?: Border;
|
|
56
|
+
borderRadius?: string;
|
|
57
|
+
margin?: Space;
|
|
58
|
+
overflow?: Overflow;
|
|
59
|
+
position?: "static" | "relative" | "absolute" | "fixed" | "sticky";
|
|
60
|
+
inset?: Inset;
|
|
61
|
+
float?: "left" | "right" | "none";
|
|
62
|
+
zIndex?: "auto" | number;
|
|
63
|
+
background?: Background;
|
|
64
|
+
boxShadow?: string;
|
|
65
|
+
outline?: Outline;
|
|
66
|
+
children: React.ReactNode;
|
|
67
|
+
};
|
|
68
|
+
export type StyledProps = Omit<Props, "display" | "width" | "height" | "opacity" | "overflow"> & {
|
|
69
|
+
$display?: "block" | "inline-block" | "inline" | "none";
|
|
70
|
+
$width?: string;
|
|
71
|
+
$height?: string;
|
|
72
|
+
$overflow?: Overflow;
|
|
73
|
+
};
|
|
74
|
+
export default Props;
|
package/date-input/Calendar.js
CHANGED
|
@@ -1,38 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
12
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
-
|
|
20
13
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
21
|
-
|
|
22
14
|
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
23
|
-
|
|
24
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
30
18
|
var getDays = function getDays(innerDate) {
|
|
31
19
|
var monthDayCells = [];
|
|
32
20
|
var lastMonthNumberOfDays = innerDate.set("month", innerDate.get("month") - 1).endOf("month");
|
|
33
21
|
var firstDayOfMonth = innerDate.startOf("month").day() === 0 ? 6 : innerDate.startOf("month").day() - 1;
|
|
34
22
|
var daysInMonth = firstDayOfMonth + innerDate.daysInMonth();
|
|
35
|
-
|
|
36
23
|
for (var i = 0; i < 42; i++) {
|
|
37
24
|
if (i < firstDayOfMonth) {
|
|
38
25
|
monthDayCells.push({
|
|
@@ -54,66 +41,53 @@ var getDays = function getDays(innerDate) {
|
|
|
54
41
|
});
|
|
55
42
|
}
|
|
56
43
|
}
|
|
57
|
-
|
|
58
44
|
return monthDayCells;
|
|
59
45
|
};
|
|
60
|
-
|
|
61
46
|
var getDateToFocus = function getDateToFocus(selectedDate, innerDate, today) {
|
|
62
47
|
return (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("month")) === innerDate.get("month") && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("year")) === innerDate.get("year") ? selectedDate : today.get("month") === innerDate.get("month") && today.get("year") === innerDate.get("year") ? today : innerDate.set("date", 1);
|
|
63
48
|
};
|
|
64
|
-
|
|
65
49
|
var isDaySelected = function isDaySelected(date, selectedDate) {
|
|
66
50
|
return (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("month")) === date.month && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("year")) === date.year && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("date")) === date.day;
|
|
67
51
|
};
|
|
68
|
-
|
|
69
52
|
var Calendar = function Calendar(_ref) {
|
|
70
53
|
var selectedDate = _ref.selectedDate,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
innerDate = _ref.innerDate,
|
|
55
|
+
onInnerDateChange = _ref.onInnerDateChange,
|
|
56
|
+
onDaySelect = _ref.onDaySelect,
|
|
57
|
+
today = _ref.today;
|
|
76
58
|
var _useState = (0, _react.useState)(getDateToFocus(selectedDate, innerDate, today)),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
59
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
60
|
+
dateToFocus = _useState2[0],
|
|
61
|
+
setDateToFocus = _useState2[1];
|
|
81
62
|
var _useState3 = (0, _react.useState)(false),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
63
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
64
|
+
isFocusable = _useState4[0],
|
|
65
|
+
setIsFocusable = _useState4[1];
|
|
86
66
|
var dayCells = (0, _react.useMemo)(function () {
|
|
87
67
|
return getDays(innerDate);
|
|
88
68
|
}, [innerDate]);
|
|
89
69
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
90
70
|
var weekDays = translatedLabels.calendar.daysShort;
|
|
91
|
-
|
|
92
71
|
var onDateClickHandler = function onDateClickHandler(date) {
|
|
93
72
|
var newDate = innerDate.set("month", date.month).set("date", date.day);
|
|
94
73
|
onDaySelect(newDate);
|
|
95
74
|
setDateToFocus(newDate);
|
|
96
75
|
};
|
|
97
|
-
|
|
98
76
|
var handleOnBlur = function handleOnBlur(event) {
|
|
99
77
|
if (!(event !== null && event !== void 0 && event.currentTarget.contains(event.relatedTarget))) {
|
|
100
78
|
setDateToFocus(getDateToFocus(selectedDate, innerDate, today));
|
|
101
79
|
}
|
|
102
80
|
};
|
|
103
|
-
|
|
104
81
|
var focusDate = function focusDate(date) {
|
|
105
82
|
if (innerDate.get("month") !== date.get("month") || innerDate.get("year") !== date.get("year")) {
|
|
106
83
|
onInnerDateChange(date);
|
|
107
84
|
}
|
|
108
|
-
|
|
109
85
|
setDateToFocus(date);
|
|
110
86
|
setIsFocusable(true);
|
|
111
87
|
};
|
|
112
|
-
|
|
113
88
|
(0, _react.useEffect)(function () {
|
|
114
89
|
if (isFocusable) {
|
|
115
90
|
var _document$getElementB;
|
|
116
|
-
|
|
117
91
|
(_document$getElementB = document.getElementById("day_".concat(dateToFocus.get("date"), "_month").concat(dateToFocus.get("month")))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.focus();
|
|
118
92
|
setIsFocusable(false);
|
|
119
93
|
}
|
|
@@ -123,66 +97,55 @@ var Calendar = function Calendar(_ref) {
|
|
|
123
97
|
setDateToFocus(getDateToFocus(selectedDate, innerDate, today));
|
|
124
98
|
}
|
|
125
99
|
}, [innerDate, dateToFocus, selectedDate, today]);
|
|
126
|
-
|
|
127
100
|
var handleDayKeyboardEvent = function handleDayKeyboardEvent(event, date) {
|
|
128
101
|
var dateToFocusTemp = date.month === innerDate.get("month") ? innerDate.set("date", date.day) : innerDate.set("date", date.day).set("month", date.month);
|
|
129
|
-
|
|
130
102
|
switch (event.key) {
|
|
131
103
|
case "PageUp":
|
|
132
104
|
event.preventDefault();
|
|
133
105
|
event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") - 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") - 1);
|
|
134
106
|
focusDate(dateToFocusTemp);
|
|
135
107
|
break;
|
|
136
|
-
|
|
137
108
|
case "PageDown":
|
|
138
109
|
event.preventDefault();
|
|
139
110
|
event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") + 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") + 1);
|
|
140
111
|
focusDate(dateToFocusTemp);
|
|
141
112
|
break;
|
|
142
|
-
|
|
143
113
|
case "ArrowLeft":
|
|
144
114
|
event.preventDefault();
|
|
145
115
|
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 1);
|
|
146
116
|
focusDate(dateToFocusTemp);
|
|
147
117
|
break;
|
|
148
|
-
|
|
149
118
|
case "ArrowRight":
|
|
150
119
|
event.preventDefault();
|
|
151
120
|
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 1);
|
|
152
121
|
focusDate(dateToFocusTemp);
|
|
153
122
|
break;
|
|
154
|
-
|
|
155
123
|
case "ArrowUp":
|
|
156
124
|
event.preventDefault();
|
|
157
125
|
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 7);
|
|
158
126
|
focusDate(dateToFocusTemp);
|
|
159
127
|
break;
|
|
160
|
-
|
|
161
128
|
case "ArrowDown":
|
|
162
129
|
event.preventDefault();
|
|
163
130
|
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 7);
|
|
164
131
|
focusDate(dateToFocusTemp);
|
|
165
132
|
break;
|
|
166
|
-
|
|
167
133
|
case "Home":
|
|
168
134
|
event.preventDefault();
|
|
169
135
|
dateToFocus.get("day") !== 0 ? dateToFocusTemp = dateToFocusTemp.day(1) : dateToFocusTemp = innerDate.date(date.day - 1).day(1);
|
|
170
136
|
focusDate(dateToFocusTemp);
|
|
171
137
|
break;
|
|
172
|
-
|
|
173
138
|
case "End":
|
|
174
139
|
event.preventDefault();
|
|
175
140
|
dateToFocusTemp.get("day") !== 0 && (dateToFocusTemp = dateToFocusTemp.day(7));
|
|
176
141
|
focusDate(dateToFocusTemp);
|
|
177
142
|
break;
|
|
178
|
-
|
|
179
143
|
case " ":
|
|
180
144
|
event.preventDefault();
|
|
181
145
|
onDaySelect(dateToFocusTemp);
|
|
182
146
|
break;
|
|
183
147
|
}
|
|
184
148
|
};
|
|
185
|
-
|
|
186
149
|
return /*#__PURE__*/_react["default"].createElement(CalendarContainer, null, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
187
150
|
alignItems: "center",
|
|
188
151
|
justifyContent: "space-between"
|
|
@@ -212,7 +175,6 @@ var Calendar = function Calendar(_ref) {
|
|
|
212
175
|
}, date.day);
|
|
213
176
|
})));
|
|
214
177
|
};
|
|
215
|
-
|
|
216
178
|
var CalendarContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0px 8px 8px 8px;\n width: 292px;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
217
179
|
return props.theme.dateInput.pickerFontFamily;
|
|
218
180
|
}, function (props) {
|
|
@@ -222,11 +184,8 @@ var CalendarContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
222
184
|
}, function (props) {
|
|
223
185
|
return props.theme.dateInput.pickerFontWeight;
|
|
224
186
|
});
|
|
225
|
-
|
|
226
187
|
var WeekHeaderCell = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n"])));
|
|
227
|
-
|
|
228
188
|
var DayCellsContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n gap: 4px;\n flex-wrap: wrap;\n justify-content: space-between;\n"])));
|
|
229
|
-
|
|
230
189
|
var DayCell = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n width: 36px;\n height: 36px;\n padding: 0;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n font-weight: ", ";\n\n &:focus {\n outline: ", " solid 2px;\n }\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n &:active {\n background-color: ", ";\n color: ", ";\n }\n\n ", "\n background-color: ", ";\n color: ", ";\n"])), function (props) {
|
|
231
190
|
return props.theme.dateInput.pickerFontFamily;
|
|
232
191
|
}, function (props) {
|
|
@@ -252,7 +211,4 @@ var DayCell = _styledComponents["default"].button(_templateObject4 || (_template
|
|
|
252
211
|
}, function (props) {
|
|
253
212
|
return props.selected ? props.theme.dateInput.pickerSelectedFontColor : props.isCurrentDay ? props.theme.dateInput.pickerCurrentDateFontColor : !props.actualMonth ? props.theme.dateInput.pickerNonCurrentMonthFontColor : props.theme.dateInput.pickerFontColor;
|
|
254
213
|
});
|
|
255
|
-
|
|
256
|
-
var _default = /*#__PURE__*/_react["default"].memo(Calendar);
|
|
257
|
-
|
|
258
|
-
exports["default"] = _default;
|
|
214
|
+
var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(Calendar);
|