@loadsmart/loadsmart-ui 5.9.0 → 5.10.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/common/SelectionWrapper.d.ts +1 -1
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Accordion/Accordion.stories.d.ts +1 -1
- package/dist/components/Banner/Banner.stories.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +4 -1
- package/dist/components/Button/Button.stories.d.ts +2 -1
- package/dist/components/Card/Card.stories.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -1
- package/dist/components/Dialog/Dialog.stories.d.ts +1 -1
- package/dist/components/DragDropFile/DragDropFile.stories.d.ts +1 -1
- package/dist/components/Drawer/Drawer.stories.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.stories.d.ts +1 -1
- package/dist/components/EmptyState/EmptyState.stories.d.ts +1 -1
- package/dist/components/ErrorMessage/ErrorMessage.stories.d.ts +1 -1
- package/dist/components/HighlightMatch/HighlightMatch.stories.d.ts +1 -1
- package/dist/components/IconFactory/IconFactory.stories.d.ts +1 -1
- package/dist/components/Label/Label.d.ts +2 -2
- package/dist/components/Label/Label.stories.d.ts +1 -1
- package/dist/components/Layout/Box.d.ts +1 -1
- package/dist/components/Layout/Grid.d.ts +1 -1
- package/dist/components/Layout/Layout.stories.d.ts +1 -1
- package/dist/components/Layout/Sidebar.d.ts +1 -1
- package/dist/components/Layout/Switcher.d.ts +1 -1
- package/dist/components/Link/Link.stories.d.ts +1 -1
- package/dist/components/Link/useSafeLink.d.ts +1 -1
- package/dist/components/Loaders/LoadingBar.stories.d.ts +1 -1
- package/dist/components/Loaders/LoadingDots.stories.d.ts +1 -1
- package/dist/components/Loaders/Spinner.stories.d.ts +1 -1
- package/dist/components/Modal/Modal.stories.d.ts +1 -1
- package/dist/components/Pagination/Pagination.stories.d.ts +1 -1
- package/dist/components/Pagination/Pagination.types.d.ts +2 -2
- package/dist/components/Popover/Popover.stories.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Radio/Radio.stories.d.ts +1 -1
- package/dist/components/Section/Sections.stories.d.ts +1 -1
- package/dist/components/Select/Select.fixtures.d.ts +2 -2
- package/dist/components/Select/Select.stories.d.ts +1 -1
- package/dist/components/Select/Select.types.d.ts +2 -2
- package/dist/components/Select/SelectCreatableOption.d.ts +1 -1
- package/dist/components/Select/SelectEmpty.d.ts +1 -1
- package/dist/components/Select/components.d.ts +1 -1
- package/dist/components/Select/useSelectExternal.d.ts +1 -1
- package/dist/components/SideNavigation/SideNavigation.stories.d.ts +1 -1
- package/dist/components/Steps/Steps.d.ts +1 -1
- package/dist/components/Steps/Steps.stories.d.ts +1 -1
- package/dist/components/Steps/StepsStep.d.ts +1 -1
- package/dist/components/Switch/Switch.stories.d.ts +1 -1
- package/dist/components/Table/Table.stories.d.ts +1 -1
- package/dist/components/Table/Table.types.d.ts +3 -4
- package/dist/components/Table/TableSortHandle.d.ts +1 -1
- package/dist/components/TablePagination/RowsPerPage.d.ts +1 -1
- package/dist/components/TablePagination/TablePagination.stories.d.ts +1 -1
- package/dist/components/TablePagination/TablePagination.types.d.ts +1 -1
- package/dist/components/TablePagination/TablePaginationActions.d.ts +1 -1
- package/dist/components/Tag/Tag.stories.d.ts +1 -1
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/Text/Text.stories.d.ts +1 -1
- package/dist/components/TextField/TextField.d.ts +1 -1
- package/dist/components/TextField/TextField.stories.d.ts +1 -1
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/Textarea/Textarea.stories.d.ts +1 -1
- package/dist/components/Toast/Toast.stories.d.ts +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/components/Tooltip/Tooltip.stories.d.ts +1 -1
- package/dist/hooks/useFocusTrap/useFocusTrap.stories.d.ts +1 -1
- package/dist/hooks/useHeightExpansionToggler/useHeightExpansionToggler.d.ts +1 -1
- package/dist/index.js +769 -909
- package/dist/index.js.map +1 -1
- package/dist/styles/activatable.d.ts +1 -1
- package/dist/styles/disableable.d.ts +1 -1
- package/dist/styles/focusable.d.ts +1 -1
- package/dist/styles/hoverable.d.ts +1 -1
- package/dist/testing/getInterpolatedStyles/getInterpolatedStyles.d.ts +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/theming/index.d.ts +2 -2
- package/dist/theming/index.js.map +1 -1
- package/package.json +9 -10
- package/src/common/CloseButton/CloseButton.tsx +7 -11
- package/src/common/SelectionWrapper.tsx +8 -8
- package/src/components/Accordion/Accordion.stories.tsx +1 -1
- package/src/components/Accordion/Accordion.tsx +24 -29
- package/src/components/Banner/Banner.stories.tsx +1 -1
- package/src/components/Banner/Banner.tsx +2 -2
- package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -4
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Button/Button.stories.tsx +33 -13
- package/src/components/Button/Button.test.tsx +24 -8
- package/src/components/Button/Button.tsx +139 -46
- package/src/components/Calendar/Calendar.tsx +4 -8
- package/src/components/Calendar/PickerModeToggle.tsx +3 -6
- package/src/components/Calendar/Pickers/DayPicker.tsx +1 -1
- package/src/components/Calendar/Pickers/MonthPicker.tsx +1 -1
- package/src/components/Calendar/Pickers/PickerButton.tsx +29 -39
- package/src/components/Calendar/Pickers/YearPicker.tsx +1 -1
- package/src/components/Card/Card.stories.tsx +1 -1
- package/src/components/Card/Card.tsx +6 -9
- package/src/components/Card/CardTitle.tsx +3 -3
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +15 -27
- package/src/components/Dialog/Dialog.stories.tsx +1 -1
- package/src/components/Dialog/Dialog.tsx +5 -5
- package/src/components/DragDropFile/DragDropFile.stories.tsx +1 -1
- package/src/components/DragDropFile/styles.tsx +6 -11
- package/src/components/Drawer/Drawer.stories.tsx +1 -1
- package/src/components/Drawer/Drawer.tsx +6 -6
- package/src/components/Dropdown/Dropdown.stories.tsx +1 -1
- package/src/components/Dropdown/DropdownMenu.tsx +15 -28
- package/src/components/Dropdown/DropdownTrigger.tsx +24 -34
- package/src/components/EmptyState/EmptyState.stories.tsx +1 -1
- package/src/components/ErrorMessage/ErrorMessage.stories.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.stories.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.test.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.tsx +1 -1
- package/src/components/IconFactory/IconFactory.stories.tsx +1 -1
- package/src/components/Label/Label.stories.tsx +1 -1
- package/src/components/Label/Label.tsx +5 -5
- package/src/components/Layout/Box.tsx +1 -1
- package/src/components/Layout/Grid.tsx +1 -1
- package/src/components/Layout/Layout.stories.tsx +1 -1
- package/src/components/Layout/Sidebar.tsx +1 -1
- package/src/components/Layout/Switcher.tsx +1 -1
- package/src/components/Link/Link.stories.tsx +1 -1
- package/src/components/Link/Link.tsx +9 -13
- package/src/components/Link/useSafeLink.ts +1 -1
- package/src/components/Loaders/LoadingBar.stories.tsx +1 -1
- package/src/components/Loaders/LoadingBar.tsx +2 -2
- package/src/components/Loaders/LoadingDots.stories.tsx +1 -1
- package/src/components/Loaders/Spinner.stories.tsx +1 -1
- package/src/components/Modal/Modal.stories.tsx +1 -1
- package/src/components/Modal/Modal.tsx +7 -12
- package/src/components/Pagination/Pagination.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.test.tsx +1 -1
- package/src/components/Pagination/Pagination.types.ts +2 -2
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.stories.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.tsx +4 -6
- package/src/components/Radio/Radio.stories.tsx +1 -1
- package/src/components/Radio/Radio.tsx +12 -20
- package/src/components/Section/Section.tsx +6 -8
- package/src/components/Section/Sections.stories.tsx +1 -1
- package/src/components/Select/Select.fixtures.ts +3 -3
- package/src/components/Select/Select.stories.tsx +7 -5
- package/src/components/Select/Select.test.tsx +20 -40
- package/src/components/Select/Select.types.ts +2 -2
- package/src/components/Select/SelectCreatableOption.tsx +1 -1
- package/src/components/Select/SelectEmpty.tsx +5 -6
- package/src/components/Select/SelectOption.test.tsx +1 -1
- package/src/components/Select/SelectTrigger.tsx +6 -11
- package/src/components/Select/components.tsx +1 -1
- package/src/components/Select/useSelect.ts +1 -1
- package/src/components/Select/useSelectExternal.ts +1 -1
- package/src/components/SideNavigation/Menu/Menu.test.tsx +1 -1
- package/src/components/SideNavigation/Menu/Menu.tsx +3 -3
- package/src/components/SideNavigation/Menu/MenuBaseItem.tsx +4 -5
- package/src/components/SideNavigation/Menu/MenuExpandable.tsx +2 -3
- package/src/components/SideNavigation/SideNavigation.stories.tsx +1 -1
- package/src/components/Steps/ProgressSteps/ProgressStep.tsx +31 -39
- package/src/components/Steps/Steps.stories.tsx +1 -1
- package/src/components/Steps/Steps.tsx +2 -1
- package/src/components/Steps/StepsStep.tsx +2 -1
- package/src/components/Switch/Switch.stories.tsx +1 -1
- package/src/components/Switch/Switch.tsx +6 -18
- package/src/components/Table/Table.stories.tsx +1 -1
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/Table/Table.types.ts +9 -4
- package/src/components/Table/TableSortHandle.tsx +1 -1
- package/src/components/TablePagination/RowsPerPage.tsx +2 -2
- package/src/components/TablePagination/TablePagination.stories.tsx +1 -1
- package/src/components/TablePagination/TablePagination.test.tsx +1 -1
- package/src/components/TablePagination/TablePagination.types.ts +1 -1
- package/src/components/TablePagination/TablePaginationActions.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +26 -32
- package/src/components/Tag/Tag.stories.tsx +1 -1
- package/src/components/Tag/Tag.tsx +35 -44
- package/src/components/Text/Text.stories.tsx +1 -1
- package/src/components/Text/Text.tsx +1 -1
- package/src/components/TextField/TextField.stories.tsx +1 -1
- package/src/components/TextField/TextField.tsx +16 -23
- package/src/components/Textarea/Textarea.stories.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +18 -23
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.tsx +3 -3
- package/src/components/ToggleGroup/Toggle.tsx +7 -7
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +1 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +23 -24
- package/src/components/TopNavigation/Menu/MenuItemDropdown.tsx +1 -1
- package/src/components/TopNavigation/OpenSideNavButton/OpenSideNavButton.tsx +1 -1
- package/src/hooks/useFocusTrap/useFocusTrap.stories.tsx +1 -1
- package/src/hooks/useHeightExpansionToggler/useHeightExpansionToggler.ts +1 -1
- package/src/styles/activatable.tsx +1 -1
- package/src/styles/disableable.tsx +1 -1
- package/src/styles/focusable.tsx +1 -1
- package/src/styles/font.tsx +3 -3
- package/src/styles/hoverable.tsx +1 -1
- package/src/testing/getInterpolatedStyles/getInterpolatedStyles.ts +1 -1
- package/src/theming/index.ts +3 -2
package/dist/theming/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ThemeProps } from 'styled-components';
|
|
2
|
-
import ThemeAlice from './themes/alice.theme';
|
|
1
|
+
import type { ThemeProps } from 'styled-components';
|
|
2
|
+
import type ThemeAlice from './themes/alice.theme';
|
|
3
3
|
export declare type ThemeToken = keyof typeof ThemeAlice;
|
|
4
4
|
export declare type ThemeTokenValue = string | number;
|
|
5
5
|
export declare type CustomTheme = Record<ThemeToken, ThemeTokenValue>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/theming/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/theming/index.ts"],"sourcesContent":["import { isFunction } from '@loadsmart/utils-function'\n\nimport type { ThemeProps } from 'styled-components'\nimport type ThemeAlice from './themes/alice.theme'\n\nexport type ThemeToken = keyof typeof ThemeAlice\nexport type ThemeTokenValue = string | number\n\nexport type CustomTheme = Record<ThemeToken, ThemeTokenValue>\nexport type ThemedProps = ThemeProps<CustomTheme>\n\ntype TokenLike<P extends ThemedProps = ThemedProps> = ThemeToken | ((props: P) => ThemeToken)\n\nfunction getTokenFromTheme<P extends ThemedProps>(token: TokenLike<P>, props: P): ThemeTokenValue {\n const tokenName = isFunction(token) ? token(props) : token\n return props.theme[tokenName]\n}\n\n/**\n * Return a design token value for the current theme.\n * @param {string} token - Token whose value should be returned.\n * @param {[ThemedStyledProps]} props - Component props.\n * @returns {ThemeTokenValue} Token value or `undefined` if the token was not found for the current theme.\n */\nexport function getToken<TProps extends ThemedProps>(\n token: TokenLike<TProps>\n): (props: TProps) => ThemeTokenValue\n\nexport function getToken<TProps extends ThemedProps>(\n token: TokenLike<TProps>,\n props: TProps\n): ThemeTokenValue\n\nexport function getToken<TProps extends ThemedProps>(token: any, props?: any): any {\n if (props === undefined) {\n return (props: TProps) => getTokenFromTheme(token, props)\n }\n\n return getTokenFromTheme(token, props)\n}\n\nexport * as Themes from './themes'\n"],"names":["getTokenFromTheme","token","props","tokenName","isFunction","theme","undefined"],"mappings":"0LAaA,SAASA,EAAyCC,EAAqBC,GACrE,MAAMC,EAAYC,aAAWH,GAASA,EAAMC,GAASD,EACrD,OAAOC,EAAMG,MAAMF,8CAkBgCF,EAAYC,GAC/D,YAAcI,IAAVJ,EACMA,GAAkBF,EAAkBC,EAAOC,GAG9CF,EAAkBC,EAAOC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadsmart/loadsmart-ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.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": "^1.2.1-beta.1",
|
|
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,12 +158,7 @@
|
|
|
158
158
|
"rollup-plugin-visualizer": "^5.5.2",
|
|
159
159
|
"semantic-release": "17.4.2",
|
|
160
160
|
"styled-components": "5.3.0",
|
|
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",
|
|
161
|
+
"stylelint": "^13.13.1",
|
|
167
162
|
"tailwindcss": "npm:@tailwindcss/postcss7-compat",
|
|
168
163
|
"ts-jest": "26.5.6",
|
|
169
164
|
"ts-toolbelt": "^9.6.0",
|
|
@@ -175,8 +170,8 @@
|
|
|
175
170
|
"@testing-library/dom": ">=5.12.0",
|
|
176
171
|
"@testing-library/react": ">=11.2.6",
|
|
177
172
|
"prop-types": ">=15.7.2",
|
|
178
|
-
"react": ">=
|
|
179
|
-
"react-dom": ">=
|
|
173
|
+
"react": ">=16.8.0",
|
|
174
|
+
"react-dom": ">=16.8.0",
|
|
180
175
|
"styled-components": ">=5.3.0"
|
|
181
176
|
},
|
|
182
177
|
"dependencies": {
|
|
@@ -191,6 +186,10 @@
|
|
|
191
186
|
"lodash.omit": "4.5.0",
|
|
192
187
|
"lodash.range": "3.2.0"
|
|
193
188
|
},
|
|
189
|
+
"browserslist": [
|
|
190
|
+
"last 1 chrome version",
|
|
191
|
+
"last 1 firefox version"
|
|
192
|
+
],
|
|
194
193
|
"repository": {
|
|
195
194
|
"type": "git",
|
|
196
195
|
"url": "https://github.com/loadsmart/miranda.git"
|
|
@@ -14,17 +14,6 @@ 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
|
-
|
|
28
17
|
/*
|
|
29
18
|
* button height is set in the BaseButton component
|
|
30
19
|
* we set width here to ensure a perfectly rounded button
|
|
@@ -34,6 +23,13 @@ const Button = styled(BaseButton)`
|
|
|
34
23
|
'button-small-height': whenProps({ scale: 'small' }),
|
|
35
24
|
'button-large-height': whenProps({ scale: 'large' }),
|
|
36
25
|
})};
|
|
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')};
|
|
37
33
|
|
|
38
34
|
${focusable`
|
|
39
35
|
box-shadow: ${token('button-icon-outline')};
|
|
@@ -2,7 +2,7 @@ import React, { LabelHTMLAttributes, ReactNode } from 'react'
|
|
|
2
2
|
import clsx from 'clsx'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
|
|
5
|
-
import ColorScheme from 'utils/types/ColorScheme'
|
|
5
|
+
import type ColorScheme from 'utils/types/ColorScheme'
|
|
6
6
|
import conditional, { whenProps } from 'tools/conditional'
|
|
7
7
|
import disableable from 'styles/disableable'
|
|
8
8
|
import font from 'styles/font'
|
|
@@ -54,18 +54,11 @@ 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
|
-
|
|
62
57
|
display: inline-flex;
|
|
63
58
|
flex-flow: row nowrap;
|
|
64
59
|
align-items: center;
|
|
65
60
|
justify-content: flex-start;
|
|
66
61
|
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
|
|
69
62
|
font-size: ${conditional({
|
|
70
63
|
'checkbox-font-size': whenProps({ scale: 'default' }),
|
|
71
64
|
'checkbox-small-font-size': whenProps({ scale: 'small' }),
|
|
@@ -76,6 +69,13 @@ const StyledLabel = styled.label<SelectionStyleProps>`
|
|
|
76
69
|
'checkbox-dark-color': whenProps({ scheme: 'dark' }),
|
|
77
70
|
})};
|
|
78
71
|
|
|
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,4 +1,5 @@
|
|
|
1
|
-
import React, { Fragment
|
|
1
|
+
import React, { Fragment } from 'react'
|
|
2
|
+
import type { PropsWithChildren, HTMLAttributes, ReactNode } from 'react'
|
|
2
3
|
import clsx from 'clsx'
|
|
3
4
|
import styled from 'styled-components'
|
|
4
5
|
import { identity, isFunction } from '@loadsmart/utils-function'
|
|
@@ -30,70 +31,64 @@ const StyledWrapper = styled.article<{ open: boolean }>`
|
|
|
30
31
|
`
|
|
31
32
|
|
|
32
33
|
const StyledToggle = styled.button<{ open: boolean }>`
|
|
33
|
-
${font({
|
|
34
|
-
height: 'font-height-2',
|
|
35
|
-
})}
|
|
36
|
-
|
|
37
|
-
${transition()}
|
|
38
|
-
|
|
39
34
|
display: flex;
|
|
40
35
|
flex-direction: row;
|
|
41
|
-
justify-content: flex-start;
|
|
42
36
|
align-items: center;
|
|
37
|
+
justify-content: flex-start;
|
|
38
|
+
|
|
39
|
+
width: 100%;
|
|
40
|
+
padding: ${token('space-s')} ${token('space-m')};
|
|
43
41
|
|
|
44
42
|
font-size: ${token('font-size-3')};
|
|
45
43
|
font-weight: ${conditional({
|
|
46
44
|
'font-weight-regular': whenProps({ open: false }),
|
|
47
45
|
'font-weight-bold': whenProps({ open: true }),
|
|
48
46
|
})};
|
|
49
|
-
text-align: left;
|
|
50
|
-
|
|
51
|
-
cursor: pointer;
|
|
52
47
|
|
|
53
48
|
color: ${token('color-neutral-darker')};
|
|
54
|
-
|
|
49
|
+
text-align: left;
|
|
50
|
+
cursor: pointer;
|
|
55
51
|
background-color: ${token('color-transparent')};
|
|
56
|
-
border-radius: ${token('border-radius-s')};
|
|
57
52
|
border: none;
|
|
53
|
+
border-radius: ${token('border-radius-s')};
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
${font({
|
|
56
|
+
height: 'font-height-2',
|
|
57
|
+
})}
|
|
58
|
+
${transition()}
|
|
63
59
|
${hoverable`
|
|
64
60
|
background: ${token('color-neutral-lighter')};
|
|
65
61
|
`}
|
|
66
|
-
|
|
67
62
|
${focusable`
|
|
68
63
|
box-shadow: ${token('shadow-glow-primary')};
|
|
69
64
|
`}
|
|
70
65
|
`
|
|
71
66
|
|
|
72
67
|
const StyledContent = styled.section<{ open: boolean }>`
|
|
73
|
-
${
|
|
74
|
-
height: 'font-height-2',
|
|
75
|
-
weight: 'font-weight-medium',
|
|
76
|
-
})}
|
|
77
|
-
|
|
78
|
-
padding-left: ${conditional({
|
|
68
|
+
padding-top: ${conditional({
|
|
79
69
|
'0': whenProps({ open: false }),
|
|
80
|
-
'space-
|
|
70
|
+
'space-xl': whenProps({ open: true }),
|
|
81
71
|
})};
|
|
82
72
|
padding-right: ${conditional({
|
|
83
73
|
'0': whenProps({ open: false }),
|
|
84
74
|
'space-m': whenProps({ open: true }),
|
|
85
75
|
})};
|
|
86
|
-
padding-top: ${conditional({
|
|
87
|
-
'0': whenProps({ open: false }),
|
|
88
|
-
'space-xl': whenProps({ open: true }),
|
|
89
|
-
})};
|
|
90
76
|
padding-bottom: ${conditional({
|
|
91
77
|
'0': whenProps({ open: false }),
|
|
92
78
|
'space-s': whenProps({ open: true }),
|
|
93
79
|
})};
|
|
80
|
+
padding-left: ${conditional({
|
|
81
|
+
'0': whenProps({ open: false }),
|
|
82
|
+
'space-m': whenProps({ open: true }),
|
|
83
|
+
})};
|
|
94
84
|
|
|
95
85
|
overflow-x: hidden;
|
|
96
86
|
overflow-y: auto;
|
|
87
|
+
|
|
88
|
+
${font({
|
|
89
|
+
height: 'font-height-2',
|
|
90
|
+
weight: 'font-weight-medium',
|
|
91
|
+
})}
|
|
97
92
|
`
|
|
98
93
|
|
|
99
94
|
const HiddenInput = styled.input`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
2
|
+
import type { Meta } from '@storybook/react/types-6-0'
|
|
3
3
|
import Banner, { BannerLarge, BannerAction, BannerActionLarge } from './Banner'
|
|
4
4
|
import type { BannerProps, BannerActionProps } from './Banner'
|
|
5
5
|
import { Icon } from 'components/Icon'
|
|
@@ -32,15 +32,15 @@ interface VariantProps {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const Description = styled.div`
|
|
35
|
-
color: ${token('banner-description-color')};
|
|
36
35
|
font-size: ${token('banner-font-size')};
|
|
37
36
|
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-weight: ${token('banner-title-font-weight')};
|
|
43
42
|
font-size: ${token('banner-font-size')};
|
|
43
|
+
font-weight: ${token('banner-title-font-weight')};
|
|
44
44
|
line-height: ${token('banner-font-height')};
|
|
45
45
|
text-align: left;
|
|
46
46
|
`
|
|
@@ -31,12 +31,11 @@ const StyledLi = styled.li<BreadcrumbProps>`
|
|
|
31
31
|
display: inline-flex;
|
|
32
32
|
align-items: center;
|
|
33
33
|
|
|
34
|
+
font-size: ${token('breadcrumbs-font-size')};
|
|
34
35
|
font-weight: ${conditional({
|
|
35
36
|
'breadcrumbs-font-weight': whenProps({ active: false }),
|
|
36
37
|
'breadcrumbs-font-weight--active': whenProps({ active: true }),
|
|
37
38
|
})};
|
|
38
|
-
|
|
39
|
-
font-size: ${token('breadcrumbs-font-size')};
|
|
40
39
|
line-height: ${token('breadcrumbs-font-height')};
|
|
41
40
|
|
|
42
41
|
& + & {
|
|
@@ -46,9 +45,9 @@ const StyledLi = styled.li<BreadcrumbProps>`
|
|
|
46
45
|
&:not(:only-child):not(:last-child)::after {
|
|
47
46
|
position: absolute;
|
|
48
47
|
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')};
|
|
52
51
|
|
|
53
52
|
line-height: ${token('breadcrumbs-font-height')};
|
|
54
53
|
|
|
@@ -68,7 +67,7 @@ function getWrappedLabel(props: Partial<BreadcrumbProps>) {
|
|
|
68
67
|
href={url}
|
|
69
68
|
target="_self"
|
|
70
69
|
onClick={onClick}
|
|
71
|
-
{...(active && {'aria-current': 'page'})}
|
|
70
|
+
{...(active && { 'aria-current': 'page' })}
|
|
72
71
|
{...rest}
|
|
73
72
|
>
|
|
74
73
|
{label}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import Breadcrumbs, { BreadcrumbsProps } from './Breadcrumbs'
|
|
3
|
-
import { Story, Meta } from '@storybook/react/types-6-0'
|
|
3
|
+
import type { Story, Meta } from '@storybook/react/types-6-0'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Components/Breadcrumbs',
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
2
|
+
import type { Meta } from '@storybook/react/types-6-0'
|
|
3
3
|
import BackButton from '../../common/BackButton'
|
|
4
4
|
import Button, { SelectorButton, IconButton, Caret, BaseButton } from './Button'
|
|
5
5
|
import CloseButton from '../../common/CloseButton'
|
|
6
|
+
import type { ReactNode } from 'react'
|
|
6
7
|
|
|
7
8
|
import type { BackButtonProps } from '../../common/BackButton'
|
|
8
9
|
import type { ButtonProps } from './Button'
|
|
9
10
|
import type { CloseButtonProps } from '../../common/CloseButton'
|
|
10
11
|
|
|
12
|
+
const Container = ({ children }: { children?: ReactNode }) => {
|
|
13
|
+
return <div className="flex flex-col space-y-2 items-center">{children}</div>
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
export default {
|
|
12
17
|
title: 'Components/Button',
|
|
13
18
|
component: Button,
|
|
@@ -34,6 +39,11 @@ export default {
|
|
|
34
39
|
type: 'boolean',
|
|
35
40
|
},
|
|
36
41
|
},
|
|
42
|
+
loading: {
|
|
43
|
+
control: {
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
37
47
|
className: {
|
|
38
48
|
table: {
|
|
39
49
|
disable: true,
|
|
@@ -78,9 +88,9 @@ export default {
|
|
|
78
88
|
|
|
79
89
|
export function Playground(args: ButtonProps): JSX.Element {
|
|
80
90
|
return (
|
|
81
|
-
<
|
|
91
|
+
<Container>
|
|
82
92
|
<Button {...args}>Button</Button>
|
|
83
|
-
</
|
|
93
|
+
</Container>
|
|
84
94
|
)
|
|
85
95
|
}
|
|
86
96
|
|
|
@@ -93,7 +103,7 @@ Playground.args = {
|
|
|
93
103
|
|
|
94
104
|
export function Base(args: ButtonProps): JSX.Element {
|
|
95
105
|
return (
|
|
96
|
-
<
|
|
106
|
+
<Container>
|
|
97
107
|
<BaseButton {...args}>Click me</BaseButton>
|
|
98
108
|
<BaseButton {...args} leading={<span>♣</span>}>
|
|
99
109
|
Click me
|
|
@@ -104,17 +114,17 @@ export function Base(args: ButtonProps): JSX.Element {
|
|
|
104
114
|
<BaseButton {...args} leading={<span>♣</span>} trailing={<span>♠</span>}>
|
|
105
115
|
Click me
|
|
106
116
|
</BaseButton>
|
|
107
|
-
</
|
|
117
|
+
</Container>
|
|
108
118
|
)
|
|
109
119
|
}
|
|
110
120
|
|
|
111
121
|
export function Selector(args: ButtonProps): JSX.Element {
|
|
112
122
|
return (
|
|
113
|
-
<
|
|
123
|
+
<Container>
|
|
114
124
|
<SelectorButton {...args} trailing={<Caret />}>
|
|
115
125
|
Button
|
|
116
126
|
</SelectorButton>
|
|
117
|
-
</
|
|
127
|
+
</Container>
|
|
118
128
|
)
|
|
119
129
|
}
|
|
120
130
|
|
|
@@ -125,11 +135,11 @@ Selector.args = {
|
|
|
125
135
|
|
|
126
136
|
export function Icon(args: ButtonProps): JSX.Element {
|
|
127
137
|
return (
|
|
128
|
-
<
|
|
138
|
+
<Container>
|
|
129
139
|
<IconButton {...args} variant="icon">
|
|
130
140
|
<span>♣</span>
|
|
131
141
|
</IconButton>
|
|
132
|
-
</
|
|
142
|
+
</Container>
|
|
133
143
|
)
|
|
134
144
|
}
|
|
135
145
|
|
|
@@ -139,16 +149,26 @@ Icon.args = {
|
|
|
139
149
|
|
|
140
150
|
export function Back(args: BackButtonProps): JSX.Element {
|
|
141
151
|
return (
|
|
142
|
-
<
|
|
152
|
+
<Container>
|
|
143
153
|
<BackButton {...args} />
|
|
144
|
-
</
|
|
154
|
+
</Container>
|
|
145
155
|
)
|
|
146
156
|
}
|
|
147
157
|
|
|
148
158
|
export function Close(args: CloseButtonProps): JSX.Element {
|
|
149
159
|
return (
|
|
150
|
-
<
|
|
160
|
+
<Container>
|
|
151
161
|
<CloseButton {...args} />
|
|
152
|
-
</
|
|
162
|
+
</Container>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function Loading(args: ButtonProps): JSX.Element {
|
|
167
|
+
return (
|
|
168
|
+
<Container>
|
|
169
|
+
<Button loading {...args}>
|
|
170
|
+
Accessible Text
|
|
171
|
+
</Button>
|
|
172
|
+
</Container>
|
|
153
173
|
)
|
|
154
174
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import { screen } from '@testing-library/react'
|
|
2
3
|
|
|
3
4
|
import generator from '../../../tests/generator'
|
|
4
5
|
import renderer from '../../../tests/renderer'
|
|
@@ -13,8 +14,9 @@ describe('<Button />', () => {
|
|
|
13
14
|
children: generator.word(),
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
setup(props)
|
|
18
|
+
|
|
19
|
+
screen.getByRole('button', { name: props.children })
|
|
18
20
|
})
|
|
19
21
|
|
|
20
22
|
it('renders trailing correctly', () => {
|
|
@@ -23,9 +25,9 @@ describe('<Button />', () => {
|
|
|
23
25
|
trailing: generator.word(),
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
setup(props)
|
|
29
|
+
|
|
30
|
+
screen.getByRole('button', { name: `${props.children} ${props.trailing}` })
|
|
29
31
|
})
|
|
30
32
|
|
|
31
33
|
it('renders leading correctly', () => {
|
|
@@ -34,8 +36,22 @@ describe('<Button />', () => {
|
|
|
34
36
|
leading: generator.word(),
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
setup(props)
|
|
40
|
+
|
|
41
|
+
screen.getByRole('button', { name: `${props.leading} ${props.children}` })
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('renders loading state', () => {
|
|
45
|
+
const props = {
|
|
46
|
+
children: generator.word(),
|
|
47
|
+
loading: true,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
setup(props)
|
|
51
|
+
|
|
52
|
+
const button = screen.getByRole('button')
|
|
53
|
+
|
|
54
|
+
expect(button).toHaveAttribute('aria-disabled', 'true')
|
|
55
|
+
expect(button).toHaveAccessibleName(props.children)
|
|
40
56
|
})
|
|
41
57
|
})
|