@loadsmart/loadsmart-ui 5.10.1 → 5.11.1
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/dist/components/Calendar/Calendar.stories.d.ts +2 -7
- package/dist/components/Calendar/Date.helper.d.ts +47 -12
- package/dist/components/Dropdown/Dropdown.stories.d.ts +4 -1
- package/dist/components/Loaders/LoadingBar.stories.d.ts +1 -1
- package/dist/index.js +445 -295
- package/dist/index.js.map +1 -1
- package/dist/testing/SelectEvent/SelectEvent.d.ts +2 -0
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/tests/generator.d.ts +35 -0
- package/dist/tests/renderer.d.ts +10 -0
- package/package.json +8 -7
- package/src/common/CloseButton/CloseButton.tsx +11 -7
- package/src/common/SelectionWrapper.tsx +7 -7
- package/src/components/Accordion/Accordion.stories.tsx +1 -1
- package/src/components/Accordion/Accordion.test.tsx +2 -2
- package/src/components/Accordion/Accordion.tsx +28 -22
- package/src/components/Banner/Banner.test.tsx +2 -2
- package/src/components/Banner/Banner.tsx +2 -2
- package/src/components/Breadcrumbs/Breadbrumbs.test.tsx +2 -2
- package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -2
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Button/Button.test.tsx +2 -2
- package/src/components/Button/Button.tsx +20 -17
- package/src/components/Calendar/Calendar.stories.tsx +4 -2
- package/src/components/Calendar/Calendar.test.tsx +3 -3
- package/src/components/Calendar/Calendar.tsx +8 -4
- package/src/components/Calendar/Date.helper.test.ts +463 -15
- package/src/components/Calendar/Date.helper.ts +106 -45
- package/src/components/Calendar/PickerModeToggle.tsx +6 -3
- package/src/components/Calendar/Pickers/DayPicker.test.tsx +2 -2
- package/src/components/Calendar/Pickers/DayPicker.tsx +1 -1
- package/src/components/Calendar/Pickers/MonthPicker.test.tsx +2 -2
- package/src/components/Calendar/Pickers/MonthPicker.tsx +1 -1
- package/src/components/Calendar/Pickers/PickerButton.tsx +39 -29
- package/src/components/Calendar/Pickers/YearPicker.test.tsx +9 -7
- package/src/components/Calendar/Pickers/YearPicker.tsx +1 -1
- package/src/components/Card/Card.stories.tsx +1 -1
- package/src/components/Card/Card.test.tsx +2 -2
- package/src/components/Card/Card.tsx +9 -6
- package/src/components/Card/CardTitle.tsx +3 -4
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +26 -14
- package/src/components/DatePicker/DatePicker.test.tsx +2 -2
- package/src/components/DatePicker/DateRangePicker.stories.tsx +6 -1
- package/src/components/DatePicker/DateRangePicker.test.tsx +2 -2
- package/src/components/Dialog/Dialog.test.tsx +2 -2
- package/src/components/Dialog/Dialog.tsx +5 -5
- package/src/components/DragDropFile/components/DropZone.test.tsx +1 -1
- package/src/components/DragDropFile/styles.tsx +11 -6
- package/src/components/Drawer/Drawer.test.tsx +1 -1
- package/src/components/Drawer/Drawer.tsx +6 -6
- package/src/components/Dropdown/Dropdown.stories.tsx +10 -5
- package/src/components/Dropdown/Dropdown.test.tsx +14 -16
- package/src/components/Dropdown/DropdownMenu.tsx +28 -15
- package/src/components/Dropdown/DropdownTrigger.tsx +34 -24
- package/src/components/EmptyState/EmptyState.test.tsx +1 -1
- package/src/components/ErrorMessage/ErrorMessage.test.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.test.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.tsx +1 -2
- package/src/components/IconFactory/IconFactory.test.tsx +2 -2
- package/src/components/Label/Label.test.tsx +2 -2
- package/src/components/Label/Label.tsx +3 -3
- package/src/components/Link/Link.test.tsx +2 -2
- package/src/components/Link/Link.tsx +13 -9
- package/src/components/Loaders/LoadingBar.stories.tsx +2 -2
- package/src/components/Loaders/LoadingBar.test.tsx +1 -1
- package/src/components/Loaders/LoadingBar.tsx +2 -2
- package/src/components/Loaders/LoadingDots.test.tsx +1 -1
- package/src/components/Loaders/Spinner.test.tsx +2 -2
- package/src/components/Modal/Modal.test.tsx +2 -2
- package/src/components/Modal/Modal.tsx +12 -7
- package/src/components/Pagination/Pagination.test.tsx +1 -1
- package/src/components/Popover/Popover.test.tsx +2 -2
- package/src/components/ProgressBar/ProgressBar.test.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.tsx +6 -4
- package/src/components/Radio/Radio.test.tsx +2 -2
- package/src/components/Radio/Radio.tsx +19 -11
- package/src/components/Section/Section.test.tsx +2 -2
- package/src/components/Section/Section.tsx +8 -6
- package/src/components/Section/Sections.stories.tsx +1 -1
- package/src/components/Select/Select.fixtures.ts +1 -1
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Select/Select.test.tsx +162 -155
- package/src/components/Select/SelectEmpty.tsx +5 -4
- package/src/components/Select/SelectTrigger.tsx +11 -6
- package/src/components/Select/useSelect.helpers.test.ts +1 -1
- package/src/components/SideNavigation/Logo/Logo.test.tsx +2 -2
- package/src/components/SideNavigation/Menu/Menu.test.tsx +2 -2
- package/src/components/SideNavigation/Menu/Menu.tsx +3 -3
- package/src/components/SideNavigation/Menu/MenuBaseItem.tsx +5 -4
- package/src/components/SideNavigation/Menu/MenuExpandable.tsx +3 -2
- package/src/components/SideNavigation/Separator/Separator.test.tsx +1 -1
- package/src/components/SideNavigation/SideNavigation.test.tsx +2 -2
- package/src/components/Steps/ProgressSteps/ProgressStep.tsx +39 -31
- package/src/components/Steps/Steps.fixtures.ts +1 -1
- package/src/components/Steps/Steps.test.tsx +2 -2
- package/src/components/Steps/useStep.test.tsx +1 -1
- package/src/components/Switch/Switch.test.tsx +1 -1
- package/src/components/Switch/Switch.tsx +18 -6
- package/src/components/Table/Table.fixtures.ts +1 -1
- package/src/components/Table/Table.test.tsx +1 -1
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/TablePagination/TablePagination.test.tsx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +32 -26
- package/src/components/Tag/Tag.stories.tsx +1 -1
- package/src/components/Tag/Tag.test.tsx +2 -2
- package/src/components/Tag/Tag.tsx +44 -35
- package/src/components/Text/Text.test.tsx +2 -2
- package/src/components/TextField/TextField.test.tsx +1 -1
- package/src/components/TextField/TextField.tsx +22 -15
- package/src/components/Textarea/Textarea.test.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +22 -17
- package/src/components/Toast/Toast.test.tsx +2 -2
- package/src/components/Toast/Toast.tsx +3 -3
- package/src/components/ToggleGroup/Toggle.test.tsx +2 -2
- package/src/components/ToggleGroup/Toggle.tsx +7 -7
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +14 -12
- package/src/components/ToggleGroup/ToggleGroup.test.tsx +2 -2
- package/src/components/Tooltip/Tooltip.test.tsx +2 -2
- package/src/components/Tooltip/Tooltip.tsx +22 -20
- package/src/components/TopNavigation/Logo/Logo.test.tsx +2 -2
- package/src/components/TopNavigation/Menu/Menu.test.tsx +1 -1
- package/src/components/TopNavigation/Menu/MenuItemDropdown.tsx +1 -1
- package/src/components/TopNavigation/OpenSideNavButton/OpenSideNavButton.tsx +1 -1
- package/src/components/VisuallyHidden/VisuallyHidden.test.tsx +1 -1
- package/src/hooks/useClickOutside/useClickOutside.test.tsx +1 -1
- package/src/hooks/useDidMount/useDidMount.test.tsx +1 -1
- package/src/hooks/useFocusTrap/useFocusTrap.test.tsx +1 -1
- package/src/hooks/useFocusWithin/useFocusWithin.test.tsx +1 -1
- package/src/hooks/useHeightExpansionToggler/useHeightExpansionToggler.test.tsx +1 -1
- package/src/hooks/useSelectable/SelectableStrategy.test.ts +1 -1
- package/src/hooks/useSelectable/useSelectable.test.ts +1 -1
- package/src/styles/font.tsx +3 -3
- package/src/testing/SelectEvent/SelectEvent.test.tsx +2 -2
- package/src/testing/SelectEvent/SelectEvent.ts +87 -45
- package/src/tests/generator.ts +127 -0
- package/src/tests/renderer.tsx +39 -0
- package/src/tools/conditional.test.ts +1 -1
- package/src/utils/toolset/interleave.test.ts +1 -1
|
@@ -39,28 +39,44 @@ export interface TagProps extends React.HTMLAttributes<HTMLElement>, WithSizePro
|
|
|
39
39
|
|
|
40
40
|
// styled elements
|
|
41
41
|
const StyledTag = styled.span`
|
|
42
|
-
position: relative;
|
|
43
|
-
z-index: 0;
|
|
44
42
|
display: inline-flex;
|
|
45
43
|
|
|
44
|
+
position: relative;
|
|
45
|
+
|
|
46
46
|
width: auto;
|
|
47
47
|
|
|
48
|
+
z-index: 0;
|
|
49
|
+
|
|
48
50
|
${disableable`
|
|
49
51
|
opacity: ${token('opacity-60')};
|
|
50
52
|
`}
|
|
51
53
|
`
|
|
52
54
|
|
|
53
55
|
const StyledSpan = styled.span<TagProps>`
|
|
54
|
-
|
|
56
|
+
${transition()}
|
|
57
|
+
|
|
55
58
|
display: inline-flex;
|
|
56
59
|
align-items: center;
|
|
57
60
|
justify-content: center;
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
|
|
64
|
+
text-decoration: none;
|
|
65
|
+
|
|
66
|
+
${typography(
|
|
67
|
+
conditional({
|
|
68
|
+
'chips-sm': whenProps({ size: 'small' }),
|
|
69
|
+
'caption-bold': whenProps({ size: 'default' }),
|
|
70
|
+
'body-bold': whenProps({ size: 'large' }),
|
|
71
|
+
})
|
|
72
|
+
)}
|
|
73
|
+
|
|
74
|
+
line-height: initial;
|
|
75
|
+
|
|
76
|
+
text-transform: ${conditional({
|
|
77
|
+
'tag-transform': whenProps({ size: 'default' }),
|
|
78
|
+
'tag-small-transform': whenProps({ size: 'small' }),
|
|
79
|
+
'tag-large-transform': whenProps({ size: 'large' }),
|
|
64
80
|
})};
|
|
65
81
|
|
|
66
82
|
padding: ${conditional({
|
|
@@ -69,7 +85,13 @@ const StyledSpan = styled.span<TagProps>`
|
|
|
69
85
|
'tag-small-spacing-removable': whenProps([{ size: 'small', removable: true }]),
|
|
70
86
|
})};
|
|
71
87
|
|
|
72
|
-
|
|
88
|
+
min-width: ${token('tag-width')};
|
|
89
|
+
height: ${conditional({
|
|
90
|
+
'tag-height': whenProps({ size: 'default' }),
|
|
91
|
+
'tag-small-height': whenProps({ size: 'small' }),
|
|
92
|
+
'tag-large-height': whenProps({ size: 'large' }),
|
|
93
|
+
})};
|
|
94
|
+
|
|
73
95
|
color: ${conditional({
|
|
74
96
|
'tag-default-color': whenProps({ variant: 'default' }),
|
|
75
97
|
'tag-outlined-color': whenProps({ variant: 'outlined' }),
|
|
@@ -79,14 +101,6 @@ const StyledSpan = styled.span<TagProps>`
|
|
|
79
101
|
'tag-danger-color': whenProps({ variant: 'danger' }),
|
|
80
102
|
})};
|
|
81
103
|
|
|
82
|
-
text-decoration: none;
|
|
83
|
-
|
|
84
|
-
text-transform: ${conditional({
|
|
85
|
-
'tag-transform': whenProps({ size: 'default' }),
|
|
86
|
-
'tag-small-transform': whenProps({ size: 'small' }),
|
|
87
|
-
'tag-large-transform': whenProps({ size: 'large' }),
|
|
88
|
-
})};
|
|
89
|
-
|
|
90
104
|
background: ${conditional({
|
|
91
105
|
'tag-default-background': whenProps({ variant: 'default' }),
|
|
92
106
|
'tag-outlined-background': whenProps({ variant: 'outlined' }),
|
|
@@ -96,6 +110,10 @@ const StyledSpan = styled.span<TagProps>`
|
|
|
96
110
|
'tag-danger-background': whenProps({ variant: 'danger' }),
|
|
97
111
|
})};
|
|
98
112
|
|
|
113
|
+
border-radius: ${token('tag-border-radius')};
|
|
114
|
+
border-width: ${token('tag-border-width')};
|
|
115
|
+
border-style: solid;
|
|
116
|
+
|
|
99
117
|
border-color: ${conditional({
|
|
100
118
|
'tag-default-border-color': whenProps({ variant: 'default' }),
|
|
101
119
|
'tag-outlined-border-color': whenProps({ variant: 'outlined' }),
|
|
@@ -104,18 +122,7 @@ const StyledSpan = styled.span<TagProps>`
|
|
|
104
122
|
'tag-warning-border-color': whenProps({ variant: 'warning' }),
|
|
105
123
|
'tag-danger-border-color': whenProps({ variant: 'danger' }),
|
|
106
124
|
})};
|
|
107
|
-
border-style: solid;
|
|
108
|
-
border-width: ${token('tag-border-width')};
|
|
109
|
-
border-radius: ${token('tag-border-radius')};
|
|
110
125
|
|
|
111
|
-
${transition()}
|
|
112
|
-
${typography(
|
|
113
|
-
conditional({
|
|
114
|
-
'chips-sm': whenProps({ size: 'small' }),
|
|
115
|
-
'caption-bold': whenProps({ size: 'default' }),
|
|
116
|
-
'body-bold': whenProps({ size: 'large' }),
|
|
117
|
-
})
|
|
118
|
-
)}
|
|
119
126
|
${hoverable`
|
|
120
127
|
background: ${conditional({
|
|
121
128
|
'tag-default-background--hover': whenProps([
|
|
@@ -198,6 +205,7 @@ const StyledSpan = styled.span<TagProps>`
|
|
|
198
205
|
]),
|
|
199
206
|
})};
|
|
200
207
|
`}
|
|
208
|
+
|
|
201
209
|
${focusable`
|
|
202
210
|
color: ${conditional({
|
|
203
211
|
'tag-default-color--focus': whenProps({ variant: 'default' }),
|
|
@@ -217,6 +225,7 @@ const StyledSpan = styled.span<TagProps>`
|
|
|
217
225
|
})};
|
|
218
226
|
box-shadow: ${token('tag-outline')};
|
|
219
227
|
`}
|
|
228
|
+
|
|
220
229
|
${disableable`
|
|
221
230
|
opacity: ${token('opacity-60')};
|
|
222
231
|
`}
|
|
@@ -239,8 +248,14 @@ const StyledCloseButton = styled.button<WithSizeProps & WithVariantProps>`
|
|
|
239
248
|
z-index: 2;
|
|
240
249
|
|
|
241
250
|
display: inline-flex;
|
|
242
|
-
align-items: center;
|
|
243
251
|
justify-content: center;
|
|
252
|
+
align-items: center;
|
|
253
|
+
|
|
254
|
+
cursor: pointer;
|
|
255
|
+
|
|
256
|
+
background: ${token('tag-remove-button-background')};
|
|
257
|
+
border-radius: ${token('tag-remove-button-border-radius')};
|
|
258
|
+
border: 0;
|
|
244
259
|
|
|
245
260
|
width: ${conditional({
|
|
246
261
|
'tag-remove-button-size': whenProps({ size: 'default' }),
|
|
@@ -256,12 +271,6 @@ const StyledCloseButton = styled.button<WithSizeProps & WithVariantProps>`
|
|
|
256
271
|
|
|
257
272
|
padding: 0;
|
|
258
273
|
|
|
259
|
-
cursor: pointer;
|
|
260
|
-
|
|
261
|
-
background: ${token('tag-remove-button-background')};
|
|
262
|
-
border: 0;
|
|
263
|
-
border-radius: ${token('tag-remove-button-border-radius')};
|
|
264
|
-
|
|
265
274
|
${disableable`
|
|
266
275
|
opacity: ${token('opacity-60')};
|
|
267
276
|
`}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import renderer, { screen } from '
|
|
4
|
-
import generators from '
|
|
3
|
+
import renderer, { screen } from '../../tests/renderer'
|
|
4
|
+
import generators from '../../tests/generator'
|
|
5
5
|
import typography from '../../styles/typography'
|
|
6
6
|
|
|
7
7
|
import { Text } from '.'
|
|
@@ -34,12 +34,12 @@ const InputWrapper = styled.div<WithAdditionalProps>`
|
|
|
34
34
|
display: inline-flex;
|
|
35
35
|
flex-flow: row nowrap;
|
|
36
36
|
|
|
37
|
-
min-width: 0;
|
|
38
37
|
height: ${conditional({
|
|
39
38
|
'text-field-height': whenProps({ scale: 'default' }),
|
|
40
39
|
'text-field-small-height': whenProps({ scale: 'small' }),
|
|
41
40
|
'text-field-large-height': whenProps({ scale: 'large' }),
|
|
42
41
|
})};
|
|
42
|
+
min-width: 0;
|
|
43
43
|
|
|
44
44
|
${font({
|
|
45
45
|
height: 'text-field-font-height',
|
|
@@ -51,10 +51,10 @@ const InputWrapper = styled.div<WithAdditionalProps>`
|
|
|
51
51
|
'text-field-large-font-size': whenProps({ scale: 'large' }),
|
|
52
52
|
})};
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
border-radius: ${token('text-field-border-radius')};
|
|
55
|
+
border-width: 1px;
|
|
56
|
+
border-style: solid;
|
|
57
|
+
|
|
58
58
|
background: ${conditional({
|
|
59
59
|
'text-field-background': whenProps({ scheme: 'light' }),
|
|
60
60
|
'text-field-dark-background': whenProps({ scheme: 'dark' }),
|
|
@@ -66,9 +66,11 @@ const InputWrapper = styled.div<WithAdditionalProps>`
|
|
|
66
66
|
'text-field-danger-border-color': whenProps({ status: Status.Danger }),
|
|
67
67
|
'text-field-success-border-color': whenProps({ status: Status.Success }),
|
|
68
68
|
})};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
|
|
70
|
+
color: ${conditional({
|
|
71
|
+
'text-field-color': whenProps({ scheme: 'light' }),
|
|
72
|
+
'text-field-dark-color': whenProps({ scheme: 'dark' }),
|
|
73
|
+
})};
|
|
72
74
|
|
|
73
75
|
${hoverable`
|
|
74
76
|
background: ${conditional({
|
|
@@ -136,8 +138,14 @@ export const Trailing = styled(StyledSpan)<WithAdditionalProps>`
|
|
|
136
138
|
`
|
|
137
139
|
|
|
138
140
|
const StyledInput = styled.input<WithAdditionalProps>`
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
${transition()}
|
|
142
|
+
|
|
143
|
+
${font({
|
|
144
|
+
height: 'text-field-font-height',
|
|
145
|
+
})}
|
|
146
|
+
|
|
147
|
+
background: transparent;
|
|
148
|
+
|
|
141
149
|
padding: ${conditional({
|
|
142
150
|
'text-field-padding-y': whenProps({ scale: 'default' }),
|
|
143
151
|
'text-field-small-padding-y': whenProps({ scale: 'small' }),
|
|
@@ -151,13 +159,12 @@ const StyledInput = styled.input<WithAdditionalProps>`
|
|
|
151
159
|
'text-field-small-padding-x': whenProps({ scale: 'small' }),
|
|
152
160
|
})};
|
|
153
161
|
|
|
154
|
-
background: transparent;
|
|
155
162
|
border: none;
|
|
156
163
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
flex: 1;
|
|
165
|
+
|
|
166
|
+
min-width: 0;
|
|
167
|
+
|
|
161
168
|
${focusable()}
|
|
162
169
|
${disableable()}
|
|
163
170
|
|
|
@@ -48,10 +48,9 @@ const TextareaWrapper = styled.div<WithAdditionalProps>`
|
|
|
48
48
|
'textarea-large-font-size': whenProps({ scale: 'large' }),
|
|
49
49
|
})};
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
})};
|
|
51
|
+
border-radius: ${token('textarea-border-radius')};
|
|
52
|
+
border-width: 1px;
|
|
53
|
+
border-style: solid;
|
|
55
54
|
|
|
56
55
|
background: ${conditional({
|
|
57
56
|
'textarea-background': whenProps({ scheme: 'light' }),
|
|
@@ -64,9 +63,11 @@ const TextareaWrapper = styled.div<WithAdditionalProps>`
|
|
|
64
63
|
'textarea-danger-border-color': whenProps({ status: Status.Danger }),
|
|
65
64
|
'textarea-success-border-color': whenProps({ status: Status.Success }),
|
|
66
65
|
})};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
|
|
67
|
+
color: ${conditional({
|
|
68
|
+
'textarea-color': whenProps({ scheme: 'light' }),
|
|
69
|
+
'textarea-dark-color': whenProps({ scheme: 'dark' }),
|
|
70
|
+
})};
|
|
70
71
|
|
|
71
72
|
${hoverable`
|
|
72
73
|
background: ${conditional({
|
|
@@ -119,30 +120,36 @@ const StyledSpan = styled.span<WithAdditionalProps>`
|
|
|
119
120
|
const Leading = styled(StyledSpan)<WithAdditionalProps>`
|
|
120
121
|
align-items: flex-start;
|
|
121
122
|
|
|
122
|
-
padding: ${token('space-s')} 0;
|
|
123
|
-
|
|
124
123
|
margin: 0 0 0
|
|
125
124
|
${conditional({
|
|
126
125
|
'text-field-padding-x': whenProps({ scale: ['default', 'large'] }),
|
|
127
126
|
'text-field-small-padding-x': whenProps({ scale: 'small' }),
|
|
128
127
|
})};
|
|
128
|
+
|
|
129
|
+
padding: ${token('space-s')} 0;
|
|
129
130
|
`
|
|
130
131
|
|
|
131
132
|
const Trailing = styled(StyledSpan)<WithAdditionalProps>`
|
|
132
133
|
align-items: flex-start;
|
|
133
134
|
|
|
134
|
-
padding: ${token('space-s')} 0;
|
|
135
|
-
|
|
136
135
|
margin: 0
|
|
137
136
|
${conditional({
|
|
138
137
|
'text-field-padding-x': whenProps({ scale: ['default', 'large'] }),
|
|
139
138
|
'text-field-small-padding-x': whenProps({ scale: 'small' }),
|
|
140
139
|
})}
|
|
141
140
|
0 0;
|
|
141
|
+
|
|
142
|
+
padding: ${token('space-s')} 0;
|
|
142
143
|
`
|
|
143
144
|
|
|
144
145
|
const StyledTextarea = styled.textarea<WithAdditionalProps>`
|
|
145
|
-
|
|
146
|
+
${transition()}
|
|
147
|
+
|
|
148
|
+
${font({
|
|
149
|
+
height: 'textarea-font-height',
|
|
150
|
+
})}
|
|
151
|
+
|
|
152
|
+
background: transparent;
|
|
146
153
|
|
|
147
154
|
padding: ${conditional({
|
|
148
155
|
'textarea-padding-y': whenProps({ scale: 'default' }),
|
|
@@ -150,19 +157,17 @@ const StyledTextarea = styled.textarea<WithAdditionalProps>`
|
|
|
150
157
|
'textarea-large-padding-y': whenProps({ scale: 'large' }),
|
|
151
158
|
})}
|
|
152
159
|
0;
|
|
160
|
+
|
|
153
161
|
margin: 0
|
|
154
162
|
${conditional({
|
|
155
163
|
'textarea-padding-x': whenProps({ scale: ['default', 'large'] }),
|
|
156
164
|
'textarea-small-padding-x': whenProps({ scale: 'small' }),
|
|
157
165
|
})};
|
|
158
166
|
|
|
159
|
-
background: transparent;
|
|
160
167
|
border: none;
|
|
161
168
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
height: 'textarea-font-height',
|
|
165
|
-
})}
|
|
169
|
+
flex: 1 0 auto;
|
|
170
|
+
|
|
166
171
|
${focusable()}
|
|
167
172
|
${disableable()}
|
|
168
173
|
`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { screen } from '@testing-library/react'
|
|
3
3
|
|
|
4
|
-
import renderer from '
|
|
5
|
-
import generator from '
|
|
4
|
+
import renderer from '../../tests/renderer'
|
|
5
|
+
import generator from '../../tests/generator'
|
|
6
6
|
|
|
7
7
|
import Toast from './Toast'
|
|
8
8
|
|
|
@@ -18,11 +18,11 @@ const Container = styled.div<ContainerProps>`
|
|
|
18
18
|
max-width: 100%;
|
|
19
19
|
padding: ${token('toast-padding-y')} ${token('toast-padding-x')};
|
|
20
20
|
overflow: hidden;
|
|
21
|
-
font-size: ${token('toast-font-size')};
|
|
22
|
-
font-weight: ${token('toast-font-weight')};
|
|
23
|
-
line-height: ${token('toast-font-height')};
|
|
24
21
|
|
|
25
22
|
color: ${token('toast-font-color')};
|
|
23
|
+
font-weight: ${token('toast-font-weight')};
|
|
24
|
+
font-size: ${token('toast-font-size')};
|
|
25
|
+
line-height: ${token('toast-font-height')};
|
|
26
26
|
|
|
27
27
|
background: ${conditional({
|
|
28
28
|
'toast-neutral-background': whenProps({ status: Status.Neutral }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import generator from '
|
|
4
|
-
import renderer, { screen, fire } from '
|
|
3
|
+
import generator from '../../tests/generator'
|
|
4
|
+
import renderer, { screen, fire } from '../../tests/renderer'
|
|
5
5
|
import Toggle from './Toggle'
|
|
6
6
|
import ToggleGroupContext, { SelectableContext } from './ToggleGroupContext'
|
|
7
7
|
|
|
@@ -14,13 +14,6 @@ import ToggleGroupContext, { SelectableContext } from './ToggleGroupContext'
|
|
|
14
14
|
import type { ToggleGroupOptionProps, ToggleGroupType } from './ToggleGroup.types'
|
|
15
15
|
|
|
16
16
|
const ToggleButton = styled(BaseButton)<{ $type: ToggleGroupType }>`
|
|
17
|
-
padding: ${token('space-xs')} ${token('space-s')};
|
|
18
|
-
|
|
19
|
-
color: ${conditional({
|
|
20
|
-
'color-neutral-darker': whenProps({ 'aria-checked': false }),
|
|
21
|
-
'color-neutral-white': whenProps({ 'aria-checked': true }),
|
|
22
|
-
})};
|
|
23
|
-
|
|
24
17
|
background: ${conditional({
|
|
25
18
|
'color-transparent': whenProps({ 'aria-checked': false }),
|
|
26
19
|
'color-neutral-darkest': whenProps({ 'aria-checked': true }),
|
|
@@ -34,6 +27,13 @@ const ToggleButton = styled(BaseButton)<{ $type: ToggleGroupType }>`
|
|
|
34
27
|
'color-transparent': whenProps({ $type: 'single', 'aria-checked': false }),
|
|
35
28
|
})};
|
|
36
29
|
|
|
30
|
+
color: ${conditional({
|
|
31
|
+
'color-neutral-darker': whenProps({ 'aria-checked': false }),
|
|
32
|
+
'color-neutral-white': whenProps({ 'aria-checked': true }),
|
|
33
|
+
})};
|
|
34
|
+
|
|
35
|
+
padding: ${token('space-xs')} ${token('space-s')};
|
|
36
|
+
|
|
37
37
|
${hoverable`
|
|
38
38
|
border-color: ${conditional({
|
|
39
39
|
'color-neutral-dark': whenProps({ $type: 'multiple' }),
|
|
@@ -87,6 +87,19 @@ Playground.args = {
|
|
|
87
87
|
scale: 'default',
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
const withIconOptions = [
|
|
91
|
+
{
|
|
92
|
+
label: 'Above',
|
|
93
|
+
value: true,
|
|
94
|
+
leading: <span>♣</span>,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
label: 'Below',
|
|
98
|
+
value: false,
|
|
99
|
+
leading: <span>♠</span>,
|
|
100
|
+
},
|
|
101
|
+
]
|
|
102
|
+
|
|
90
103
|
export const WithIcon: Story<ToggleGroupProps> = (args) => {
|
|
91
104
|
return (
|
|
92
105
|
<div className="flex flex-row">
|
|
@@ -97,18 +110,7 @@ export const WithIcon: Story<ToggleGroupProps> = (args) => {
|
|
|
97
110
|
aria-labelledby="rank_options_label"
|
|
98
111
|
id="rank_options"
|
|
99
112
|
name="rank_options"
|
|
100
|
-
options={
|
|
101
|
-
{
|
|
102
|
-
label: 'Above',
|
|
103
|
-
value: true,
|
|
104
|
-
leading: <span>♣</span>,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
label: 'Below',
|
|
108
|
-
value: false,
|
|
109
|
-
leading: <span>♠</span>,
|
|
110
|
-
},
|
|
111
|
-
]}
|
|
113
|
+
options={withIconOptions}
|
|
112
114
|
/>
|
|
113
115
|
</div>
|
|
114
116
|
|
|
@@ -3,8 +3,8 @@ import { composeStories } from '@storybook/testing-react'
|
|
|
3
3
|
|
|
4
4
|
import { OPTIONS } from './ToggleGroup.constants'
|
|
5
5
|
import * as stories from './ToggleGroup.stories'
|
|
6
|
-
import generator from '
|
|
7
|
-
import renderer, { screen, fire } from '
|
|
6
|
+
import generator from '../../tests/generator'
|
|
7
|
+
import renderer, { screen, fire } from '../../tests/renderer'
|
|
8
8
|
|
|
9
9
|
import type { ToggleGroupProps, ToggleGroupOptionProps } from './ToggleGroup.types'
|
|
10
10
|
|
|
@@ -3,8 +3,8 @@ import { screen } from '@testing-library/react'
|
|
|
3
3
|
import userEvent from '@testing-library/user-event'
|
|
4
4
|
|
|
5
5
|
import Tooltip from './Tooltip'
|
|
6
|
-
import generator from '
|
|
7
|
-
import renderer from '
|
|
6
|
+
import generator from '../../tests/generator'
|
|
7
|
+
import renderer from '../../tests/renderer'
|
|
8
8
|
|
|
9
9
|
const setup = ({ ...overrides }) => renderer(<Tooltip message="" {...overrides} />).render()
|
|
10
10
|
|
|
@@ -32,10 +32,10 @@ export interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
32
32
|
type ContainerProps = Pick<TooltipProps, 'scheme'>
|
|
33
33
|
|
|
34
34
|
const Container = styled.div<ContainerProps>`
|
|
35
|
-
position: relative;
|
|
36
|
-
|
|
37
35
|
display: inline-block;
|
|
38
36
|
|
|
37
|
+
position: relative;
|
|
38
|
+
|
|
39
39
|
cursor: help;
|
|
40
40
|
|
|
41
41
|
${focusable`
|
|
@@ -49,22 +49,31 @@ const Container = styled.div<ContainerProps>`
|
|
|
49
49
|
type BubbleProps = Pick<TooltipProps, 'position' | 'align'>
|
|
50
50
|
|
|
51
51
|
const Bubble = styled.span<BubbleProps>`
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
${font({
|
|
53
|
+
weight: 'font-weight-medium',
|
|
54
|
+
height: 'font-height-3',
|
|
55
|
+
})}
|
|
56
|
+
|
|
57
|
+
${transition()}
|
|
58
|
+
|
|
59
|
+
white-space: initial;
|
|
54
60
|
|
|
55
|
-
width: max-content;
|
|
56
61
|
min-width: ${token('tooltip-min-width')};
|
|
57
62
|
max-width: ${token('tooltip-max-width')};
|
|
63
|
+
width: max-content;
|
|
64
|
+
|
|
65
|
+
position: absolute;
|
|
66
|
+
z-index: ${token('z-index-tooltip')};
|
|
67
|
+
|
|
68
|
+
background: ${token('tooltip-background')};
|
|
69
|
+
box-shadow: ${token('tooltip-shadow')};
|
|
70
|
+
border-radius: ${token('tooltip-border-radius')};
|
|
58
71
|
|
|
59
72
|
padding: ${token('tooltip-padding-y')} ${token('tooltip-padding-x')};
|
|
60
73
|
|
|
74
|
+
color: ${token('tooltip-color')};
|
|
61
75
|
font-size: ${token('tooltip-font-size')};
|
|
62
76
|
line-height: ${token('tooltip-font-height')};
|
|
63
|
-
color: ${token('tooltip-color')};
|
|
64
|
-
white-space: initial;
|
|
65
|
-
background: ${token('tooltip-background')};
|
|
66
|
-
border-radius: ${token('tooltip-border-radius')};
|
|
67
|
-
box-shadow: ${token('tooltip-shadow')};
|
|
68
77
|
|
|
69
78
|
${({ position }) =>
|
|
70
79
|
position === TooltipPosition.Top &&
|
|
@@ -109,26 +118,19 @@ const Bubble = styled.span<BubbleProps>`
|
|
|
109
118
|
|
|
110
119
|
transform: translate(100%, -50%);
|
|
111
120
|
`};
|
|
112
|
-
|
|
113
|
-
${font({
|
|
114
|
-
weight: 'font-weight-medium',
|
|
115
|
-
height: 'font-height-3',
|
|
116
|
-
})}
|
|
117
|
-
|
|
118
|
-
${transition()}
|
|
119
121
|
`
|
|
120
122
|
|
|
121
123
|
type ArrowProps = Pick<TooltipProps, 'position'>
|
|
122
124
|
const Arrow = styled.span<ArrowProps>`
|
|
123
|
-
position: absolute;
|
|
124
|
-
z-index: 1;
|
|
125
|
-
|
|
126
125
|
width: 0;
|
|
127
126
|
height: 0;
|
|
128
127
|
|
|
129
128
|
background: transparent;
|
|
130
129
|
border-style: solid;
|
|
131
130
|
|
|
131
|
+
position: absolute;
|
|
132
|
+
z-index: 1;
|
|
133
|
+
|
|
132
134
|
${({ position }) =>
|
|
133
135
|
position === TooltipPosition.Top &&
|
|
134
136
|
css`
|
|
@@ -2,8 +2,8 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { Logo } from './'
|
|
4
4
|
import type { LogoProps } from './Logo'
|
|
5
|
-
import renderer, { screen } from '
|
|
6
|
-
import generators from '
|
|
5
|
+
import renderer, { screen } from '../../../tests/renderer'
|
|
6
|
+
import generators from '../../../tests/generator'
|
|
7
7
|
|
|
8
8
|
function setup(props: LogoProps) {
|
|
9
9
|
return renderer(<Logo {...props} />).render()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { ThemeProvider } from 'styled-components'
|
|
3
|
-
import renderer, { screen, user } from '
|
|
3
|
+
import renderer, { screen, user } from '../../../tests/renderer'
|
|
4
4
|
import { Menu } from './'
|
|
5
5
|
import type { MenuProps } from './Menu'
|
|
6
6
|
import { Alice } from '../../../theming/themes'
|
|
@@ -27,8 +27,8 @@ const MenuDropdownTrigger = styled(DropdownTrigger.Handle)`
|
|
|
27
27
|
export const MenuDropdownLabel = styled.label`
|
|
28
28
|
${transition()}
|
|
29
29
|
|
|
30
|
-
display: flex;
|
|
31
30
|
align-items: center;
|
|
31
|
+
display: flex;
|
|
32
32
|
|
|
33
33
|
${typography('body-bold', { color: 'top-navigation-item-color' })}
|
|
34
34
|
|
|
@@ -11,10 +11,10 @@ export type OpenSideNavButtonProps = {
|
|
|
11
11
|
|
|
12
12
|
const Container = styled.button`
|
|
13
13
|
margin-right: ${token('space-2xl')};
|
|
14
|
-
cursor: pointer;
|
|
15
14
|
|
|
16
15
|
background: none;
|
|
17
16
|
border: none;
|
|
17
|
+
cursor: pointer;
|
|
18
18
|
`
|
|
19
19
|
|
|
20
20
|
function OpenSideNavButton({ className, onClick }: OpenSideNavButtonProps): JSX.Element {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { screen } from '@testing-library/react'
|
|
3
3
|
|
|
4
|
-
import renderer from '
|
|
4
|
+
import renderer from '../../tests/renderer'
|
|
5
5
|
|
|
6
6
|
import hiddenStyle from 'styles/hidden'
|
|
7
7
|
import { VisuallyHidden } from './VisuallyHidden'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import renderer, { screen, fire, user } from '
|
|
2
|
+
import renderer, { screen, fire, user } from '../../tests/renderer'
|
|
3
3
|
import { composeStories } from '@storybook/testing-react'
|
|
4
4
|
|
|
5
5
|
import * as stories from './useFocusTrap.stories'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { act, waitFor } from '@testing-library/react'
|
|
2
2
|
import React, { useRef, useState } from 'react'
|
|
3
3
|
|
|
4
|
-
import renderer, { screen, fire, user } from '
|
|
4
|
+
import renderer, { screen, fire, user } from '../../tests/renderer'
|
|
5
5
|
|
|
6
6
|
import useHeightExpansionToggler from './useHeightExpansionToggler'
|
|
7
7
|
|