@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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="chance" />
|
|
2
|
+
interface DataGenerator {
|
|
3
|
+
animal: () => string;
|
|
4
|
+
array: <T>(template: ({ index }: {
|
|
5
|
+
index: number;
|
|
6
|
+
}) => T, amount?: number) => Array<T>;
|
|
7
|
+
boolean: () => boolean;
|
|
8
|
+
company: () => string;
|
|
9
|
+
date: () => string;
|
|
10
|
+
float: (opts?: Chance.Options) => number;
|
|
11
|
+
id: () => string;
|
|
12
|
+
name: (opts?: Chance.Options) => string;
|
|
13
|
+
natural: (opts?: Chance.Options) => number;
|
|
14
|
+
paragraph: (opts?: Chance.Options) => string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use pickone or pickset
|
|
17
|
+
*/
|
|
18
|
+
pick: <T>(array: Array<T>, options?: {
|
|
19
|
+
amount: number;
|
|
20
|
+
allowRepeat?: boolean;
|
|
21
|
+
}) => T | Array<T>;
|
|
22
|
+
pickone<T>(arr: T[]): T;
|
|
23
|
+
pickset<T>(arr: T[], count?: number): T[];
|
|
24
|
+
profession: () => string;
|
|
25
|
+
sentence: (opts?: Chance.Options) => string;
|
|
26
|
+
state: (opts?: Chance.Options) => string;
|
|
27
|
+
time: (opts?: Chance.Options) => string;
|
|
28
|
+
token: () => string;
|
|
29
|
+
url: () => string;
|
|
30
|
+
username: () => string;
|
|
31
|
+
word: (opts?: Chance.Options) => string;
|
|
32
|
+
dollar: () => string;
|
|
33
|
+
}
|
|
34
|
+
declare const generators: DataGenerator;
|
|
35
|
+
export default generators;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { fireEvent, RenderOptions, within, waitFor, waitForElementToBeRemoved, act, screen, queries } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
declare class Renderer {
|
|
5
|
+
result: React.ReactElement;
|
|
6
|
+
constructor(children: React.ReactElement);
|
|
7
|
+
render(options?: Omit<RenderOptions, 'queries'>): import("@testing-library/react").RenderResult<typeof queries, HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
export default function customRenderer(children: React.ReactElement): Renderer;
|
|
10
|
+
export { act, fireEvent as fire, queries, screen, userEvent as user, waitFor, waitForElementToBeRemoved, within, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadsmart/loadsmart-ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.1",
|
|
4
4
|
"description": "Miranda UI, a React UI library",
|
|
5
5
|
"main": "dist",
|
|
6
6
|
"files": [
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@babel/preset-typescript": "7.13.0",
|
|
79
79
|
"@commitlint/cli": "16.0.2",
|
|
80
80
|
"@commitlint/config-conventional": "16.0.0",
|
|
81
|
-
"@loadsmart/stylelint-config": "
|
|
81
|
+
"@loadsmart/stylelint-config": "0.0.3",
|
|
82
82
|
"@rollup/plugin-babel": "5.3.0",
|
|
83
83
|
"@rollup/plugin-commonjs": "19.0.0",
|
|
84
84
|
"@rollup/plugin-json": "4.1.0",
|
|
@@ -158,7 +158,12 @@
|
|
|
158
158
|
"rollup-plugin-visualizer": "^5.5.2",
|
|
159
159
|
"semantic-release": "17.4.2",
|
|
160
160
|
"styled-components": "5.3.0",
|
|
161
|
-
"stylelint": "
|
|
161
|
+
"stylelint": "13.13.1",
|
|
162
|
+
"stylelint-config-prettier": "8.0.2",
|
|
163
|
+
"stylelint-config-rational-order": "0.1.2",
|
|
164
|
+
"stylelint-config-recommended": "5.0.0",
|
|
165
|
+
"stylelint-no-unsupported-browser-features": "5.0.1",
|
|
166
|
+
"stylelint-order": "4.1.0",
|
|
162
167
|
"tailwindcss": "npm:@tailwindcss/postcss7-compat",
|
|
163
168
|
"ts-jest": "26.5.6",
|
|
164
169
|
"ts-toolbelt": "^9.6.0",
|
|
@@ -186,10 +191,6 @@
|
|
|
186
191
|
"lodash.omit": "4.5.0",
|
|
187
192
|
"lodash.range": "3.2.0"
|
|
188
193
|
},
|
|
189
|
-
"browserslist": [
|
|
190
|
-
"last 1 chrome version",
|
|
191
|
-
"last 1 firefox version"
|
|
192
|
-
],
|
|
193
194
|
"repository": {
|
|
194
195
|
"type": "git",
|
|
195
196
|
"url": "https://github.com/loadsmart/miranda.git"
|
|
@@ -14,6 +14,17 @@ export interface CloseButtonProps extends ButtonProps {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const Button = styled(BaseButton)`
|
|
17
|
+
border: none;
|
|
18
|
+
border-radius: ${token('border-radius-circle')};
|
|
19
|
+
|
|
20
|
+
color: ${token('color-neutral-darker')};
|
|
21
|
+
|
|
22
|
+
background: ${token('color-transparent')};
|
|
23
|
+
|
|
24
|
+
padding: ${token('space-xs')};
|
|
25
|
+
|
|
26
|
+
font-size: ${token('font-size-3')};
|
|
27
|
+
|
|
17
28
|
/*
|
|
18
29
|
* button height is set in the BaseButton component
|
|
19
30
|
* we set width here to ensure a perfectly rounded button
|
|
@@ -23,13 +34,6 @@ const Button = styled(BaseButton)`
|
|
|
23
34
|
'button-small-height': whenProps({ scale: 'small' }),
|
|
24
35
|
'button-large-height': whenProps({ scale: 'large' }),
|
|
25
36
|
})};
|
|
26
|
-
padding: ${token('space-xs')};
|
|
27
|
-
font-size: ${token('font-size-3')};
|
|
28
|
-
color: ${token('color-neutral-darker')};
|
|
29
|
-
background: ${token('color-transparent')};
|
|
30
|
-
|
|
31
|
-
border: none;
|
|
32
|
-
border-radius: ${token('border-radius-circle')};
|
|
33
37
|
|
|
34
38
|
${focusable`
|
|
35
39
|
box-shadow: ${token('button-icon-outline')};
|
|
@@ -54,11 +54,18 @@ const Children = styled.span`
|
|
|
54
54
|
const StyledLabel = styled.label<SelectionStyleProps>`
|
|
55
55
|
box-sizing: border-box;
|
|
56
56
|
|
|
57
|
+
${transition()}
|
|
58
|
+
${font({
|
|
59
|
+
weight: 'checkbox-font-weight',
|
|
60
|
+
})}
|
|
61
|
+
|
|
57
62
|
display: inline-flex;
|
|
58
63
|
flex-flow: row nowrap;
|
|
59
64
|
align-items: center;
|
|
60
65
|
justify-content: flex-start;
|
|
61
66
|
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
|
|
62
69
|
font-size: ${conditional({
|
|
63
70
|
'checkbox-font-size': whenProps({ scale: 'default' }),
|
|
64
71
|
'checkbox-small-font-size': whenProps({ scale: 'small' }),
|
|
@@ -69,13 +76,6 @@ const StyledLabel = styled.label<SelectionStyleProps>`
|
|
|
69
76
|
'checkbox-dark-color': whenProps({ scheme: 'dark' }),
|
|
70
77
|
})};
|
|
71
78
|
|
|
72
|
-
cursor: pointer;
|
|
73
|
-
|
|
74
|
-
${transition()}
|
|
75
|
-
${font({
|
|
76
|
-
weight: 'checkbox-font-weight',
|
|
77
|
-
})}
|
|
78
|
-
|
|
79
79
|
${Children} {
|
|
80
80
|
margin: 0 ${token('space-xs')};
|
|
81
81
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import userEvent from '@testing-library/user-event'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
-
import generator from '
|
|
5
|
-
import renderer, { fire, screen } from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
|
+
import renderer, { fire, screen } from '../../tests/renderer'
|
|
6
6
|
|
|
7
7
|
import Accordion from './Accordion'
|
|
8
8
|
|
|
@@ -31,64 +31,70 @@ const StyledWrapper = styled.article<{ open: boolean }>`
|
|
|
31
31
|
`
|
|
32
32
|
|
|
33
33
|
const StyledToggle = styled.button<{ open: boolean }>`
|
|
34
|
+
${font({
|
|
35
|
+
height: 'font-height-2',
|
|
36
|
+
})}
|
|
37
|
+
|
|
38
|
+
${transition()}
|
|
39
|
+
|
|
34
40
|
display: flex;
|
|
35
41
|
flex-direction: row;
|
|
36
|
-
align-items: center;
|
|
37
42
|
justify-content: flex-start;
|
|
38
|
-
|
|
39
|
-
width: 100%;
|
|
40
|
-
padding: ${token('space-s')} ${token('space-m')};
|
|
43
|
+
align-items: center;
|
|
41
44
|
|
|
42
45
|
font-size: ${token('font-size-3')};
|
|
43
46
|
font-weight: ${conditional({
|
|
44
47
|
'font-weight-regular': whenProps({ open: false }),
|
|
45
48
|
'font-weight-bold': whenProps({ open: true }),
|
|
46
49
|
})};
|
|
47
|
-
|
|
48
|
-
color: ${token('color-neutral-darker')};
|
|
49
50
|
text-align: left;
|
|
51
|
+
|
|
50
52
|
cursor: pointer;
|
|
53
|
+
|
|
54
|
+
color: ${token('color-neutral-darker')};
|
|
55
|
+
|
|
51
56
|
background-color: ${token('color-transparent')};
|
|
52
|
-
border: none;
|
|
53
57
|
border-radius: ${token('border-radius-s')};
|
|
58
|
+
border: none;
|
|
59
|
+
|
|
60
|
+
padding: ${token('space-s')} ${token('space-m')};
|
|
61
|
+
|
|
62
|
+
width: 100%;
|
|
54
63
|
|
|
55
|
-
${font({
|
|
56
|
-
height: 'font-height-2',
|
|
57
|
-
})}
|
|
58
|
-
${transition()}
|
|
59
64
|
${hoverable`
|
|
60
65
|
background: ${token('color-neutral-lighter')};
|
|
61
66
|
`}
|
|
67
|
+
|
|
62
68
|
${focusable`
|
|
63
69
|
box-shadow: ${token('shadow-glow-primary')};
|
|
64
70
|
`}
|
|
65
71
|
`
|
|
66
72
|
|
|
67
73
|
const StyledContent = styled.section<{ open: boolean }>`
|
|
68
|
-
|
|
74
|
+
${font({
|
|
75
|
+
height: 'font-height-2',
|
|
76
|
+
weight: 'font-weight-medium',
|
|
77
|
+
})}
|
|
78
|
+
|
|
79
|
+
padding-left: ${conditional({
|
|
69
80
|
'0': whenProps({ open: false }),
|
|
70
|
-
'space-
|
|
81
|
+
'space-m': whenProps({ open: true }),
|
|
71
82
|
})};
|
|
72
83
|
padding-right: ${conditional({
|
|
73
84
|
'0': whenProps({ open: false }),
|
|
74
85
|
'space-m': whenProps({ open: true }),
|
|
75
86
|
})};
|
|
76
|
-
padding-
|
|
87
|
+
padding-top: ${conditional({
|
|
77
88
|
'0': whenProps({ open: false }),
|
|
78
|
-
'space-
|
|
89
|
+
'space-xl': whenProps({ open: true }),
|
|
79
90
|
})};
|
|
80
|
-
padding-
|
|
91
|
+
padding-bottom: ${conditional({
|
|
81
92
|
'0': whenProps({ open: false }),
|
|
82
|
-
'space-
|
|
93
|
+
'space-s': whenProps({ open: true }),
|
|
83
94
|
})};
|
|
84
95
|
|
|
85
96
|
overflow-x: hidden;
|
|
86
97
|
overflow-y: auto;
|
|
87
|
-
|
|
88
|
-
${font({
|
|
89
|
-
height: 'font-height-2',
|
|
90
|
-
weight: 'font-weight-medium',
|
|
91
|
-
})}
|
|
92
98
|
`
|
|
93
99
|
|
|
94
100
|
const HiddenInput = styled.input`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import userEvent from '@testing-library/user-event'
|
|
3
3
|
|
|
4
|
-
import generator from '
|
|
5
|
-
import renderer, { screen } from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
|
+
import renderer, { screen } from '../../tests/renderer'
|
|
6
6
|
|
|
7
7
|
import Banner from './Banner'
|
|
8
8
|
import { BannerAction } from './Banner'
|
|
@@ -32,15 +32,15 @@ interface VariantProps {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const Description = styled.div`
|
|
35
|
+
color: ${token('banner-description-color')};
|
|
35
36
|
font-size: ${token('banner-font-size')};
|
|
36
37
|
line-height: ${token('banner-font-height')};
|
|
37
|
-
color: ${token('banner-description-color')};
|
|
38
38
|
text-align: left;
|
|
39
39
|
`
|
|
40
40
|
|
|
41
41
|
const Title = styled.div<VariantProps>`
|
|
42
|
-
font-size: ${token('banner-font-size')};
|
|
43
42
|
font-weight: ${token('banner-title-font-weight')};
|
|
43
|
+
font-size: ${token('banner-font-size')};
|
|
44
44
|
line-height: ${token('banner-font-height')};
|
|
45
45
|
text-align: left;
|
|
46
46
|
`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import Breadcrumbs from './Breadcrumbs'
|
|
3
3
|
import { fireEvent, screen } from '@testing-library/react'
|
|
4
|
-
import generator from '
|
|
5
|
-
import renderer from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
|
+
import renderer from '../../tests/renderer'
|
|
6
6
|
|
|
7
7
|
const setup = ({ ...overrides }) => renderer(<Breadcrumbs entries={[]} {...overrides} />).render()
|
|
8
8
|
|
|
@@ -31,11 +31,12 @@ const StyledLi = styled.li<BreadcrumbProps>`
|
|
|
31
31
|
display: inline-flex;
|
|
32
32
|
align-items: center;
|
|
33
33
|
|
|
34
|
-
font-size: ${token('breadcrumbs-font-size')};
|
|
35
34
|
font-weight: ${conditional({
|
|
36
35
|
'breadcrumbs-font-weight': whenProps({ active: false }),
|
|
37
36
|
'breadcrumbs-font-weight--active': whenProps({ active: true }),
|
|
38
37
|
})};
|
|
38
|
+
|
|
39
|
+
font-size: ${token('breadcrumbs-font-size')};
|
|
39
40
|
line-height: ${token('breadcrumbs-font-height')};
|
|
40
41
|
|
|
41
42
|
& + & {
|
|
@@ -45,9 +46,9 @@ const StyledLi = styled.li<BreadcrumbProps>`
|
|
|
45
46
|
&:not(:only-child):not(:last-child)::after {
|
|
46
47
|
position: absolute;
|
|
47
48
|
left: calc(100% + 14px);
|
|
48
|
-
font-size: ${token('breadcrumbs-font-size')};
|
|
49
49
|
|
|
50
50
|
font-weight: ${token('font-weight-bold')};
|
|
51
|
+
font-size: ${token('breadcrumbs-font-size')};
|
|
51
52
|
|
|
52
53
|
line-height: ${token('breadcrumbs-font-height')};
|
|
53
54
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { screen } from '@testing-library/react'
|
|
3
3
|
|
|
4
|
-
import generator from '
|
|
5
|
-
import renderer from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
|
+
import renderer from '../../tests/renderer'
|
|
6
6
|
|
|
7
7
|
import Button from './Button'
|
|
8
8
|
|
|
@@ -68,6 +68,16 @@ const BaseStyledButton = styled.button<{
|
|
|
68
68
|
$scale: ButtonProps['scale']
|
|
69
69
|
$loading?: ButtonProps['loading']
|
|
70
70
|
}>`
|
|
71
|
+
${transition()}
|
|
72
|
+
|
|
73
|
+
${typography(
|
|
74
|
+
conditional({
|
|
75
|
+
'button-md': whenProps({ $scale: 'default' }),
|
|
76
|
+
'button-sm': whenProps({ $scale: 'small' }),
|
|
77
|
+
'button-lg': whenProps({ $scale: 'large' }),
|
|
78
|
+
})
|
|
79
|
+
)}
|
|
80
|
+
|
|
71
81
|
box-sizing: border-box;
|
|
72
82
|
|
|
73
83
|
display: inline-flex;
|
|
@@ -75,6 +85,16 @@ const BaseStyledButton = styled.button<{
|
|
|
75
85
|
align-items: center;
|
|
76
86
|
justify-content: center;
|
|
77
87
|
|
|
88
|
+
text-transform: uppercase;
|
|
89
|
+
text-align: center;
|
|
90
|
+
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
|
|
93
|
+
border-radius: ${token('border-radius-s')};
|
|
94
|
+
border-width: ${token('border-width-thin')};
|
|
95
|
+
border-style: solid;
|
|
96
|
+
border-color: ${token('color-neutral-darker')};
|
|
97
|
+
|
|
78
98
|
height: ${conditional({
|
|
79
99
|
'button-height': whenProps({ $scale: 'default' }),
|
|
80
100
|
'button-small-height': whenProps({ $scale: 'small' }),
|
|
@@ -82,25 +102,8 @@ const BaseStyledButton = styled.button<{
|
|
|
82
102
|
})};
|
|
83
103
|
|
|
84
104
|
padding: 0 8px;
|
|
85
|
-
text-align: center;
|
|
86
|
-
text-transform: uppercase;
|
|
87
|
-
|
|
88
|
-
cursor: pointer;
|
|
89
|
-
|
|
90
|
-
border-color: ${token('color-neutral-darker')};
|
|
91
|
-
border-style: solid;
|
|
92
|
-
border-width: ${token('border-width-thin')};
|
|
93
|
-
border-radius: ${token('border-radius-s')};
|
|
94
105
|
|
|
95
106
|
${disableable()}
|
|
96
|
-
${transition()}
|
|
97
|
-
${typography(
|
|
98
|
-
conditional({
|
|
99
|
-
'button-md': whenProps({ $scale: 'default' }),
|
|
100
|
-
'button-sm': whenProps({ $scale: 'small' }),
|
|
101
|
-
'button-lg': whenProps({ $scale: 'large' }),
|
|
102
|
-
})
|
|
103
|
-
)}
|
|
104
107
|
|
|
105
108
|
${({ $loading }) => $loading && 'pointer-events: none;'}
|
|
106
109
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type { Meta } from '@storybook/react/types-6-0'
|
|
2
|
+
import type { Story, Meta } from '@storybook/react/types-6-0'
|
|
3
3
|
|
|
4
4
|
import { TODAY } from './Date.helper'
|
|
5
5
|
import Calendar from './Calendar'
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
},
|
|
42
42
|
} as Meta
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
const Template: Story<CalendarProps> = (args): JSX.Element => {
|
|
45
45
|
return (
|
|
46
46
|
<div className="flex flex-col">
|
|
47
47
|
<Calendar {...args} />
|
|
@@ -49,6 +49,8 @@ export function Playground(args: CalendarProps): JSX.Element {
|
|
|
49
49
|
)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
export const Playground = Template.bind({})
|
|
53
|
+
|
|
52
54
|
Playground.args = {
|
|
53
55
|
mode: 'single',
|
|
54
56
|
}
|
|
@@ -7,9 +7,9 @@ import { TODAY } from './Date.helper'
|
|
|
7
7
|
import * as stories from './Calendar.stories'
|
|
8
8
|
import DateFormatHelper from './DateFormat.helper'
|
|
9
9
|
import DateHelper from './Date.helper'
|
|
10
|
-
import generator from '
|
|
10
|
+
import generator from '../../tests/generator'
|
|
11
11
|
import MonthHelper, { MONTH_BY_NAME } from './Month.helper'
|
|
12
|
-
import renderer, { screen, fire } from '
|
|
12
|
+
import renderer, { screen, fire } from '../../tests/renderer'
|
|
13
13
|
|
|
14
14
|
import type { CalendarConstraint } from './Date.helper'
|
|
15
15
|
import type { CalendarMonthAlias } from './Month.helper'
|
|
@@ -209,7 +209,7 @@ describe('Calendar', () => {
|
|
|
209
209
|
const startDate = DateHelper(Date.UTC(year, startMonth, startDay))
|
|
210
210
|
const endDate = DateHelper(Date.UTC(year, endMonth, endDay))
|
|
211
211
|
|
|
212
|
-
const props = {
|
|
212
|
+
const props: Partial<CalendarProps> = {
|
|
213
213
|
mode: 'range',
|
|
214
214
|
month: startMonth,
|
|
215
215
|
year,
|
|
@@ -23,19 +23,23 @@ const Container = styled(Stack)`
|
|
|
23
23
|
`
|
|
24
24
|
|
|
25
25
|
const BorderlessButton = styled(BaseButton)`
|
|
26
|
+
${typography('body-bold')}
|
|
27
|
+
border-color: transparent;
|
|
28
|
+
background-color: transparent;
|
|
29
|
+
|
|
26
30
|
color: ${token('color-neutral')};
|
|
31
|
+
|
|
32
|
+
inline-size: 40px;
|
|
33
|
+
|
|
27
34
|
visibility: ${conditional({
|
|
28
35
|
visible: whenProps({ 'aria-hidden': false }),
|
|
29
36
|
hidden: whenProps({ 'aria-hidden': true }),
|
|
30
37
|
})};
|
|
31
|
-
background-color: transparent;
|
|
32
|
-
border-color: transparent;
|
|
33
|
-
inline-size: 40px;
|
|
34
38
|
|
|
35
|
-
${typography('body-bold')}
|
|
36
39
|
${hoverable`
|
|
37
40
|
color: ${token('color-neutral-dark')};
|
|
38
41
|
`}
|
|
42
|
+
|
|
39
43
|
${focusable`
|
|
40
44
|
box-shadow: ${token('button-primary-outline')};
|
|
41
45
|
`}
|