@basic-ui/material 1.0.0-alpha.6 → 1.0.0-alpha.9
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/build/cjs/index.js +223 -38
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Alert/Alert.d.ts +1 -1
- package/build/esm/AppBar/AppBar.d.ts +1 -1
- package/build/esm/AppBar/AppBar.js +2 -1
- package/build/esm/AppBar/AppBar.js.map +1 -1
- package/build/esm/AppBar/AppBarButton.d.ts +1 -1
- package/build/esm/Badge/Badge.d.ts +1 -1
- package/build/esm/BottomSheet/BottomSheet.d.ts +1 -1
- package/build/esm/BottomSheet/BottomSheetSurface.d.ts +1 -1
- package/build/esm/Button/BaseButton.d.ts +1 -1
- package/build/esm/Button/Button.d.ts +1 -1
- package/build/esm/Button/ButtonGroup.d.ts +1 -1
- package/build/esm/Button/FilledButton.d.ts +1 -1
- package/build/esm/Button/FilledButton.js +6 -8
- package/build/esm/Button/FilledButton.js.map +1 -1
- package/build/esm/Button/OutlinedButton.d.ts +1 -1
- package/build/esm/Button/TransparentButton.d.ts +1 -1
- package/build/esm/CheckBox/CheckBox.d.ts +1 -1
- package/build/esm/CheckBox/CheckBoxIcon.d.ts +1 -1
- package/build/esm/CheckBox/CheckBoxIcon.js +2 -1
- package/build/esm/CheckBox/CheckBoxIcon.js.map +1 -1
- package/build/esm/Chip/ButtonChip.d.ts +1 -1
- package/build/esm/Chip/ChipBase.d.ts +1 -1
- package/build/esm/Chip/ChoiceChip.d.ts +1 -1
- package/build/esm/Combobox/Combobox.d.ts +7 -7
- package/build/esm/Combobox/Combobox.js +2 -1
- package/build/esm/Combobox/Combobox.js.map +1 -1
- package/build/esm/Dialog/Dialog.d.ts +1 -1
- package/build/esm/Dialog/DialogBackdrop.d.ts +1 -1
- package/build/esm/Dialog/DialogContainer.d.ts +1 -1
- package/build/esm/Dialog/DialogSurface.d.ts +1 -1
- package/build/esm/Dialog/Scrim.d.ts +1 -1
- package/build/esm/Dialog/useDialogAnimation.js +3 -2
- package/build/esm/Dialog/useDialogAnimation.js.map +1 -1
- package/build/esm/Divider/Divider.d.ts +1 -1
- package/build/esm/FloatingLabel/FloatingLabel.js +2 -1
- package/build/esm/FloatingLabel/FloatingLabel.js.map +1 -1
- package/build/esm/LineRipple/LineRipple.d.ts +1 -1
- package/build/esm/LineRipple/LineRipple.js +2 -1
- package/build/esm/LineRipple/LineRipple.js.map +1 -1
- package/build/esm/Link/Link.d.ts +1 -1
- package/build/esm/List/List.d.ts +1 -1
- package/build/esm/ListItem/ListItem.d.ts +1 -1
- package/build/esm/Menu/Menu.d.ts +4 -4
- package/build/esm/Menu/Menu.js +4 -1
- package/build/esm/Menu/Menu.js.map +1 -1
- package/build/esm/NavRail/NavRailItem.d.ts +5 -4
- package/build/esm/NavRail/NavRailItem.js +24 -8
- package/build/esm/NavRail/NavRailItem.js.map +1 -1
- package/build/esm/NotchedOutline/styledComponents.d.ts +107 -0
- package/build/esm/NotchedOutline/styledComponents.js +3 -2
- package/build/esm/NotchedOutline/styledComponents.js.map +1 -1
- package/build/esm/Paper/Paper.d.ts +1 -1
- package/build/esm/ProgressSpinner/ProgressSpinner.d.ts +1 -1
- package/build/esm/ProgressSpinner/ProgressSpinner.js +2 -1
- package/build/esm/ProgressSpinner/ProgressSpinner.js.map +1 -1
- package/build/esm/RadioButton/RadioButtonIcon.js +2 -1
- package/build/esm/RadioButton/RadioButtonIcon.js.map +1 -1
- package/build/esm/RadioButton/RadioGroup.d.ts +1 -1
- package/build/esm/Ripple/useRippleSurface.d.ts +1 -1
- package/build/esm/Ripple/useRippleSurface.js +7 -9
- package/build/esm/Ripple/useRippleSurface.js.map +1 -1
- package/build/esm/Select/Select.d.ts +1 -1
- package/build/esm/Select/SelectIcon.d.ts +1 -1
- package/build/esm/Select/SelectIcon.js +2 -1
- package/build/esm/Select/SelectIcon.js.map +1 -1
- package/build/esm/SelectItem/SelectItem.d.ts +1 -1
- package/build/esm/SelectionControl/SelectionControlLabel.d.ts +1 -1
- package/build/esm/SelectionControl/SelectionControlText.d.ts +1 -1
- package/build/esm/Skeleton/DelayAppearance.d.ts +1 -1
- package/build/esm/Skeleton/Skeleton.d.ts +1 -1
- package/build/esm/Snackbar/Snackbar.d.ts +1 -1
- package/build/esm/Snackbar/useSnackbarAnimation.js +2 -1
- package/build/esm/Snackbar/useSnackbarAnimation.js.map +1 -1
- package/build/esm/Switch/Switch.d.ts +1 -1
- package/build/esm/Switch/styledComponents.js +2 -1
- package/build/esm/Switch/styledComponents.js.map +1 -1
- package/build/esm/Tab/Tab.d.ts +1 -1
- package/build/esm/Tab/TabList.d.ts +1 -1
- package/build/esm/Tab/TabPanel.d.ts +1 -1
- package/build/esm/TabIndicator/TabIndicator.d.ts +1 -1
- package/build/esm/TabIndicator/TabIndicator.js +2 -1
- package/build/esm/TabIndicator/TabIndicator.js.map +1 -1
- package/build/esm/Table/Table.d.ts +1 -1
- package/build/esm/Table/TableBody.d.ts +1 -1
- package/build/esm/Table/TableCell.d.ts +1 -1
- package/build/esm/Table/TableHead.d.ts +1 -1
- package/build/esm/Table/TableRow.d.ts +1 -1
- package/build/esm/Text/Text.d.ts +7 -3
- package/build/esm/Text/Text.js +4 -0
- package/build/esm/Text/Text.js.map +1 -1
- package/build/esm/TextField/FilledContainer.d.ts +1 -1
- package/build/esm/TextField/HelperText.d.ts +1 -1
- package/build/esm/TextField/Input.d.ts +1 -1
- package/build/esm/TextField/Input.js +2 -1
- package/build/esm/TextField/Input.js.map +1 -1
- package/build/esm/TextField/OutlinedContainer.d.ts +1 -1
- package/build/esm/TextField/TextField.d.ts +1 -1
- package/build/esm/Tooltip/Tooltip.d.ts +1 -1
- package/build/esm/color.d.ts +2 -0
- package/build/esm/color.js +8 -3
- package/build/esm/color.js.map +1 -1
- package/build/esm/index.d.ts +2 -0
- package/build/esm/index.js +2 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/motion.d.ts +7 -0
- package/build/esm/motion.js +8 -0
- package/build/esm/motion.js.map +1 -0
- package/build/esm/theme/theme.d.ts +107 -0
- package/build/esm/theme/theme.js +34 -5
- package/build/esm/theme/theme.js.map +1 -1
- package/build/esm/theme/useTheme.d.ts +578 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/AppBar/AppBar.tsx +2 -1
- package/src/Button/Button.story.tsx +6 -1
- package/src/Button/FilledButton.tsx +4 -9
- package/src/CheckBox/CheckBox.story.tsx +2 -2
- package/src/CheckBox/CheckBoxIcon.tsx +2 -2
- package/src/Combobox/Combobox.tsx +2 -2
- package/src/Dialog/useDialogAnimation.tsx +3 -4
- package/src/FloatingLabel/FloatingLabel.tsx +2 -1
- package/src/LineRipple/LineRipple.tsx +2 -1
- package/src/Menu/Menu.tsx +2 -1
- package/src/NavRail/NavRail.story.tsx +94 -13
- package/src/NavRail/NavRailItem.tsx +58 -41
- package/src/NotchedOutline/styledComponents.ts +2 -1
- package/src/ProgressSpinner/ProgressSpinner.tsx +2 -2
- package/src/RadioButton/RadioButtonIcon.tsx +2 -2
- package/src/Ripple/useRippleSurface.ts +7 -9
- package/src/Select/SelectIcon.tsx +2 -2
- package/src/Snackbar/useSnackbarAnimation.ts +2 -1
- package/src/Switch/styledComponents.tsx +2 -2
- package/src/TabIndicator/TabIndicator.tsx +2 -1
- package/src/Text/Text.story.tsx +44 -7
- package/src/Text/Text.tsx +22 -2
- package/src/TextField/Input.tsx +2 -1
- package/src/ThemeExplorer/ThemeBuilder.story.tsx +27 -23
- package/src/color.ts +25 -4
- package/src/index.ts +2 -0
- package/src/motion.ts +7 -0
- package/src/theme/theme.ts +39 -4
- package/src/ThemeExplorer/ThemeExplorer.story.tsx +0 -43
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { rem } from 'polished';
|
|
2
|
-
import React, { useState } from 'react';
|
|
2
|
+
import React, { forwardRef, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Box } from '../Box';
|
|
5
5
|
import { NavRailItem, NavRailIndicator, NavRailLabel } from './';
|
|
6
|
+
import type { NavRailLabelProps } from './';
|
|
7
|
+
import { EASING_STANDARD } from '../motion';
|
|
6
8
|
// import './styles.css';
|
|
7
9
|
|
|
8
10
|
export default {
|
|
@@ -54,8 +56,8 @@ const MenuIcon = (props) => (
|
|
|
54
56
|
</svg>
|
|
55
57
|
);
|
|
56
58
|
|
|
57
|
-
const
|
|
58
|
-
const [selectedItem, setSelectedItem] = useState(
|
|
59
|
+
export const Default = () => {
|
|
60
|
+
const [selectedItem, setSelectedItem] = useState('0');
|
|
59
61
|
|
|
60
62
|
return (
|
|
61
63
|
<Box
|
|
@@ -71,9 +73,7 @@ const Example = ({ selectable = true }) => {
|
|
|
71
73
|
>
|
|
72
74
|
<NavRailItem
|
|
73
75
|
selected={selectedItem === '0'}
|
|
74
|
-
onClick={() =>
|
|
75
|
-
selectable && setSelectedItem('0');
|
|
76
|
-
}}
|
|
76
|
+
onClick={() => setSelectedItem('0')}
|
|
77
77
|
>
|
|
78
78
|
<NavRailIndicator>
|
|
79
79
|
<MenuIcon />
|
|
@@ -82,9 +82,7 @@ const Example = ({ selectable = true }) => {
|
|
|
82
82
|
</NavRailItem>
|
|
83
83
|
<NavRailItem
|
|
84
84
|
selected={selectedItem === '1'}
|
|
85
|
-
onClick={() =>
|
|
86
|
-
selectable && setSelectedItem('1');
|
|
87
|
-
}}
|
|
85
|
+
onClick={() => setSelectedItem('1')}
|
|
88
86
|
>
|
|
89
87
|
<NavRailIndicator>
|
|
90
88
|
<KitchenIcon />
|
|
@@ -93,9 +91,7 @@ const Example = ({ selectable = true }) => {
|
|
|
93
91
|
</NavRailItem>
|
|
94
92
|
<NavRailItem
|
|
95
93
|
selected={selectedItem === '2'}
|
|
96
|
-
onClick={() =>
|
|
97
|
-
selectable && setSelectedItem('2');
|
|
98
|
-
}}
|
|
94
|
+
onClick={() => setSelectedItem('2')}
|
|
99
95
|
>
|
|
100
96
|
<NavRailIndicator>
|
|
101
97
|
<ListIcon />
|
|
@@ -106,4 +102,89 @@ const Example = ({ selectable = true }) => {
|
|
|
106
102
|
);
|
|
107
103
|
};
|
|
108
104
|
|
|
109
|
-
|
|
105
|
+
const DisappearingNavRailLabel = forwardRef<
|
|
106
|
+
HTMLDivElement,
|
|
107
|
+
NavRailLabelProps & { selected: boolean }
|
|
108
|
+
>(function AnimatedNavRailLabel({ selected, height = '28px', ...props }, ref) {
|
|
109
|
+
const transitionDuration = '0.2s';
|
|
110
|
+
const transitionTimingFunction = EASING_STANDARD;
|
|
111
|
+
return (
|
|
112
|
+
<Box
|
|
113
|
+
ref={ref}
|
|
114
|
+
style={{
|
|
115
|
+
height: selected ? height : '0px',
|
|
116
|
+
}}
|
|
117
|
+
sx={{
|
|
118
|
+
transition: `height ${transitionDuration} ${transitionTimingFunction}`,
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
<NavRailLabel
|
|
122
|
+
style={{
|
|
123
|
+
transform: selected
|
|
124
|
+
? 'scale(1) translateY(0)'
|
|
125
|
+
: `scale(0.8, 0.64) translateY(calc(${height} * -0.5 * 0.64))`,
|
|
126
|
+
opacity: selected ? '1' : '0',
|
|
127
|
+
}}
|
|
128
|
+
sx={{
|
|
129
|
+
transformOrigin: 'center top',
|
|
130
|
+
transition:
|
|
131
|
+
`transform ${transitionDuration} ${transitionTimingFunction}, ` +
|
|
132
|
+
`opacity ${transitionDuration} ${transitionTimingFunction}`,
|
|
133
|
+
}}
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
</Box>
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export const WithHiddenLabels = () => {
|
|
141
|
+
const [selectedItem, setSelectedItem] = useState('0');
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<Box
|
|
145
|
+
bg="surface"
|
|
146
|
+
width="80px"
|
|
147
|
+
position="fixed"
|
|
148
|
+
top="0"
|
|
149
|
+
bottom="0"
|
|
150
|
+
left="0"
|
|
151
|
+
py={rem(80)}
|
|
152
|
+
display="flex"
|
|
153
|
+
flexDirection="column"
|
|
154
|
+
>
|
|
155
|
+
<NavRailItem
|
|
156
|
+
selected={selectedItem === '0'}
|
|
157
|
+
onClick={() => setSelectedItem('0')}
|
|
158
|
+
>
|
|
159
|
+
<NavRailIndicator>
|
|
160
|
+
<MenuIcon />
|
|
161
|
+
</NavRailIndicator>
|
|
162
|
+
<DisappearingNavRailLabel selected={selectedItem === '0'}>
|
|
163
|
+
Menu
|
|
164
|
+
</DisappearingNavRailLabel>
|
|
165
|
+
</NavRailItem>
|
|
166
|
+
<NavRailItem
|
|
167
|
+
selected={selectedItem === '1'}
|
|
168
|
+
onClick={() => setSelectedItem('1')}
|
|
169
|
+
>
|
|
170
|
+
<NavRailIndicator>
|
|
171
|
+
<KitchenIcon />
|
|
172
|
+
</NavRailIndicator>
|
|
173
|
+
<DisappearingNavRailLabel selected={selectedItem === '1'}>
|
|
174
|
+
Kitchen
|
|
175
|
+
</DisappearingNavRailLabel>
|
|
176
|
+
</NavRailItem>
|
|
177
|
+
<NavRailItem
|
|
178
|
+
selected={selectedItem === '2'}
|
|
179
|
+
onClick={() => setSelectedItem('2')}
|
|
180
|
+
>
|
|
181
|
+
<NavRailIndicator>
|
|
182
|
+
<ListIcon />
|
|
183
|
+
</NavRailIndicator>
|
|
184
|
+
<DisappearingNavRailLabel selected={selectedItem === '2'}>
|
|
185
|
+
Orders
|
|
186
|
+
</DisappearingNavRailLabel>
|
|
187
|
+
</NavRailItem>
|
|
188
|
+
</Box>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
@@ -7,8 +7,8 @@ import { Box } from '../Box';
|
|
|
7
7
|
import { useTheme } from '../theme';
|
|
8
8
|
import { Text } from '../Text';
|
|
9
9
|
import type { TextProps } from '../Text';
|
|
10
|
-
import type { RippleBoxProps } from '../Ripple';
|
|
11
10
|
import { useRippleSurface } from '../Ripple';
|
|
11
|
+
import { EASING_STANDARD } from '../motion';
|
|
12
12
|
|
|
13
13
|
export interface NavRailItemProps extends Omit<BoxProps, 'color'> {
|
|
14
14
|
as?: React.ElementType<any>;
|
|
@@ -18,38 +18,45 @@ export interface NavRailItemProps extends Omit<BoxProps, 'color'> {
|
|
|
18
18
|
color?: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export
|
|
22
|
-
function NavRailIndicator(props, forwardedRef) {
|
|
23
|
-
const { as = 'div', children, __css, ...otherProps } = props;
|
|
21
|
+
export type NavRailIndicatorProps = BoxProps;
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
data-nav-rail-item-indicator=""
|
|
31
|
-
{...otherProps}
|
|
32
|
-
__css={{
|
|
33
|
-
width: '100%',
|
|
34
|
-
height: '100%',
|
|
35
|
-
maxWidth: rem(56),
|
|
36
|
-
maxHeight: rem(56),
|
|
37
|
-
borderRadius: 'full',
|
|
38
|
-
bg: 'var(--indicator-background-color)',
|
|
39
|
-
display: 'flex',
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
justifyContent: 'center',
|
|
42
|
-
minHeight: rem(32),
|
|
43
|
-
...__css,
|
|
44
|
-
}}
|
|
45
|
-
>
|
|
46
|
-
{children}
|
|
47
|
-
</Box>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
);
|
|
23
|
+
export const NavRailIndicator = forwardRef<
|
|
24
|
+
HTMLDivElement,
|
|
25
|
+
NavRailIndicatorProps
|
|
26
|
+
>(function NavRailIndicator(props, forwardedRef) {
|
|
27
|
+
const { as = 'div', children, __css, ...otherProps } = props;
|
|
51
28
|
|
|
52
|
-
|
|
29
|
+
return (
|
|
30
|
+
<Box
|
|
31
|
+
color="currentColor"
|
|
32
|
+
ref={forwardedRef}
|
|
33
|
+
as={as}
|
|
34
|
+
data-nav-rail-item-indicator=""
|
|
35
|
+
{...otherProps}
|
|
36
|
+
__css={{
|
|
37
|
+
width: '100%',
|
|
38
|
+
height: '100%',
|
|
39
|
+
maxWidth: rem(56),
|
|
40
|
+
maxHeight: rem(56),
|
|
41
|
+
borderRadius: 'full',
|
|
42
|
+
bg: 'var(--indicator-background-color)',
|
|
43
|
+
display: 'flex',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
justifyContent: 'center',
|
|
46
|
+
minHeight: rem(32),
|
|
47
|
+
transition: `background-color .2s ${EASING_STANDARD}`,
|
|
48
|
+
pointerEvents: 'none',
|
|
49
|
+
...__css,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</Box>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export type NavRailLabelProps = TextProps;
|
|
58
|
+
|
|
59
|
+
export const NavRailLabel = forwardRef<HTMLDivElement, NavRailLabelProps>(
|
|
53
60
|
function NavRailLabel(props, forwardedRef) {
|
|
54
61
|
const { as = 'div', children, __css, ...otherProps } = props;
|
|
55
62
|
|
|
@@ -58,12 +65,13 @@ export const NavRailLabel = forwardRef<HTMLDivElement, TextProps>(
|
|
|
58
65
|
ref={forwardedRef}
|
|
59
66
|
as={as}
|
|
60
67
|
variant="caption"
|
|
61
|
-
{...otherProps}
|
|
62
68
|
lineHeight={1}
|
|
69
|
+
{...otherProps}
|
|
63
70
|
__css={{
|
|
64
71
|
pt: rem(4),
|
|
65
72
|
pb: rem(12),
|
|
66
73
|
color: 'inherit',
|
|
74
|
+
pointerEvents: 'none',
|
|
67
75
|
...__css,
|
|
68
76
|
}}
|
|
69
77
|
>
|
|
@@ -93,7 +101,7 @@ export const NavRailItem = forwardRef<HTMLDivElement, NavRailItemProps>(
|
|
|
93
101
|
focusOpacity = 0.12,
|
|
94
102
|
pressedOpacity = 0.12;
|
|
95
103
|
const ripple = useRippleSurface({
|
|
96
|
-
rippleColor:
|
|
104
|
+
rippleColor: 'currentColor',
|
|
97
105
|
onKeyDown,
|
|
98
106
|
onPointerDown,
|
|
99
107
|
baseOpacity,
|
|
@@ -107,13 +115,17 @@ export const NavRailItem = forwardRef<HTMLDivElement, NavRailItemProps>(
|
|
|
107
115
|
const ret: SxStyleProp = {};
|
|
108
116
|
const keys = Object.keys(ripple.__css);
|
|
109
117
|
for (const key of keys) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
if (!key.startsWith('&')) {
|
|
119
|
+
ret['& [data-nav-rail-item-indicator]'] =
|
|
120
|
+
ret['& [data-nav-rail-item-indicator]'] || {};
|
|
121
|
+
ret['& [data-nav-rail-item-indicator]'][key] = ripple.__css[key];
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const newKey = key.replace(
|
|
126
|
+
/(.+?)::(before|after)/g,
|
|
127
|
+
'$1 [data-nav-rail-item-indicator]::$2'
|
|
128
|
+
);
|
|
117
129
|
ret[newKey] = ripple.__css[key];
|
|
118
130
|
}
|
|
119
131
|
return ret;
|
|
@@ -129,11 +141,13 @@ export const NavRailItem = forwardRef<HTMLDivElement, NavRailItemProps>(
|
|
|
129
141
|
aria-pressed={selected}
|
|
130
142
|
type="button"
|
|
131
143
|
style={{ ...ripple.style, ...style }}
|
|
144
|
+
disabled={disabled}
|
|
132
145
|
__css={{
|
|
133
146
|
display: 'flex',
|
|
134
147
|
flexDirection: 'column',
|
|
135
148
|
alignItems: 'center',
|
|
136
|
-
|
|
149
|
+
transition: `color .2s ${EASING_STANDARD}`,
|
|
150
|
+
color: selected ? `on.${color}` : 'on.surface-variant',
|
|
137
151
|
'--indicator-background-color': selected
|
|
138
152
|
? get(theme, `colors.${color}`)
|
|
139
153
|
: 'transparent',
|
|
@@ -145,8 +159,11 @@ export const NavRailItem = forwardRef<HTMLDivElement, NavRailItemProps>(
|
|
|
145
159
|
margin: 0,
|
|
146
160
|
padding: 0,
|
|
147
161
|
px: rem(12),
|
|
162
|
+
minHeight: rem(60),
|
|
163
|
+
height: rem(60),
|
|
148
164
|
cursor: 'pointer',
|
|
149
165
|
textDecoration: 'none',
|
|
166
|
+
WebkitTapHighlightColor: 'transparent',
|
|
150
167
|
...rippleCss,
|
|
151
168
|
...__css,
|
|
152
169
|
}}
|
|
@@ -5,6 +5,7 @@ import { css } from '@styled-system/css';
|
|
|
5
5
|
|
|
6
6
|
import { alpha } from '../color';
|
|
7
7
|
import type { Theme } from '../theme';
|
|
8
|
+
import { EASING_STANDARD } from '../motion';
|
|
8
9
|
|
|
9
10
|
export const NOTCH_PADDING = 4;
|
|
10
11
|
|
|
@@ -105,7 +106,7 @@ export const InnerContainer = styled('div', {
|
|
|
105
106
|
['[data-notch-outline-item]']: {
|
|
106
107
|
boxSizing: 'border-box',
|
|
107
108
|
borderStyle,
|
|
108
|
-
transition: `border-color .15s
|
|
109
|
+
transition: `border-color .15s ${EASING_STANDARD}`,
|
|
109
110
|
...(forceActive ? focusStyle : inactiveStyle),
|
|
110
111
|
},
|
|
111
112
|
// notch items styles when input is hovered
|
|
@@ -5,6 +5,7 @@ import { rem } from 'polished';
|
|
|
5
5
|
|
|
6
6
|
import type { BoxProps } from '../Box';
|
|
7
7
|
import { Box } from '../Box';
|
|
8
|
+
import { EASING_STANDARD } from '../motion';
|
|
8
9
|
|
|
9
10
|
export type ProgressSpinnerProps = BoxProps & {
|
|
10
11
|
progress?: number;
|
|
@@ -105,8 +106,7 @@ export const ProgressSpinner = forwardRef<HTMLDivElement, ProgressSpinnerProps>(
|
|
|
105
106
|
strokeDashoffset: '0px',
|
|
106
107
|
}
|
|
107
108
|
: {
|
|
108
|
-
transition:
|
|
109
|
-
'stroke-dashoffset 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
|
109
|
+
transition: `stroke-dashoffset 300ms ${EASING_STANDARD} 0ms`,
|
|
110
110
|
strokeDasharray: circumference.toFixed(3),
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { rem } from 'polished';
|
|
4
4
|
|
|
5
5
|
import { Box } from '../Box';
|
|
6
|
+
import { EASING_STANDARD } from '../motion';
|
|
6
7
|
|
|
7
8
|
export interface RadioButtonIconProps
|
|
8
9
|
extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -34,8 +35,7 @@ export const RadioButtonIcon = forwardRef<HTMLDivElement, RadioButtonIconProps>(
|
|
|
34
35
|
borderRadius: 'full',
|
|
35
36
|
width: '100%',
|
|
36
37
|
height: '100%',
|
|
37
|
-
transition:
|
|
38
|
-
'transform .12s cubic-bezier(0,0,.2,1) 0ms,background-color .12s cubic-bezier(0,0,.2,1) 0ms',
|
|
38
|
+
transition: `transform .12s ${EASING_STANDARD} 0ms,background-color .12s ${EASING_STANDARD} 0ms`,
|
|
39
39
|
transform: checked ? 'scale(1)' : 'scale(0)',
|
|
40
40
|
}}
|
|
41
41
|
/>
|
|
@@ -65,15 +65,13 @@ export function useRippleSurface<T extends HTMLElement>(
|
|
|
65
65
|
|
|
66
66
|
const css: SxStyleProp = useMemo(
|
|
67
67
|
() => ({
|
|
68
|
-
'
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
WebkitTapHighlightColor: 'transparent',
|
|
76
|
-
},
|
|
68
|
+
overflow: 'hidden',
|
|
69
|
+
position: 'relative',
|
|
70
|
+
cursor: 'pointer',
|
|
71
|
+
// fix overflow: hidden + borderRadius in Safari
|
|
72
|
+
// https://gist.github.com/ayamflow/b602ab436ac9f05660d9c15190f4fd7b#gistcomment-2359479
|
|
73
|
+
willChange: 'transform,opacity',
|
|
74
|
+
WebkitTapHighlightColor: 'transparent',
|
|
77
75
|
// ripple overlay
|
|
78
76
|
'&::before': {
|
|
79
77
|
backgroundColor: rippleColor,
|
|
@@ -7,6 +7,7 @@ import type { BoxProps } from '../Box';
|
|
|
7
7
|
import { Box } from '../Box';
|
|
8
8
|
import { alpha } from '../color';
|
|
9
9
|
import { PADDING_RIGHT_WITH_ICON } from '../TextField/consts';
|
|
10
|
+
import { EASING_STANDARD } from '../motion';
|
|
10
11
|
|
|
11
12
|
export type SelectIconProps = BoxProps<
|
|
12
13
|
SVGElement,
|
|
@@ -32,8 +33,7 @@ export const SelectIcon = forwardRef<SVGElement, SelectIconProps>(
|
|
|
32
33
|
color: open ? 'primary' : alpha('on.surface', 0.54),
|
|
33
34
|
pointerEvents: 'none',
|
|
34
35
|
transform: open ? 'rotate(180deg)' : undefined,
|
|
35
|
-
transition:
|
|
36
|
-
'transform .15s cubic-bezier(.4,0,.2,1), color .15s cubic-bezier(.4,0,.2,1)',
|
|
36
|
+
transition: `transform .15s ${EASING_STANDARD}, color .15s ${EASING_STANDARD}`,
|
|
37
37
|
}}
|
|
38
38
|
{...otherProps}
|
|
39
39
|
>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
|
|
4
|
+
import { EASING_STANDARD } from '../motion';
|
|
4
5
|
import { useStackItem } from './Stack';
|
|
5
6
|
|
|
6
7
|
const TRANSITION_TIME = 150;
|
|
@@ -100,7 +101,7 @@ export const placements = {
|
|
|
100
101
|
const commonStyle = { position: 'fixed', zIndex: 'snackbar' };
|
|
101
102
|
|
|
102
103
|
function getTransition(timems: number) {
|
|
103
|
-
return `opacity ${timems}ms
|
|
104
|
+
return `opacity ${timems}ms ${EASING_STANDARD},transform ${timems}ms ${EASING_STANDARD}`;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
const defaultAnimation = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { rem } from 'polished';
|
|
2
2
|
|
|
3
3
|
import { Box } from '../Box';
|
|
4
|
+
import { EASING_STANDARD } from '../motion';
|
|
4
5
|
|
|
5
6
|
const BORDER_WIDTH = 2;
|
|
6
7
|
const TRAIL_WIDTH = 52;
|
|
@@ -48,8 +49,7 @@ export const SwitchThumb = ({ checked = false, ...otherProps }) => (
|
|
|
48
49
|
(TRAIL_WIDTH - CIRCLE_SIZE_INACTIVE_CHECKED - BORDER_WIDTH * 4) / 2
|
|
49
50
|
)})) translateY(-50%)`,
|
|
50
51
|
WebkitTapHighlightColor: 'transparent',
|
|
51
|
-
transition:
|
|
52
|
-
'background-color 90ms cubic-bezier(.4,0,.2,1),border-color 90ms cubic-bezier(.4,0,.2,1),transform 90ms cubic-bezier(.4,0,.2,1),height 90ms cubic-bezier(.4,0,.2,1),width 90ms cubic-bezier(.4,0,.2,1)',
|
|
52
|
+
transition: `background-color 90ms ${EASING_STANDARD},border-color 90ms ${EASING_STANDARD},transform 90ms ${EASING_STANDARD},height 90ms ${EASING_STANDARD},width 90ms ${EASING_STANDARD}`,
|
|
53
53
|
'& > input': {
|
|
54
54
|
width: THUMB_SIZE,
|
|
55
55
|
height: THUMB_SIZE,
|
|
@@ -5,6 +5,7 @@ import { assignMultipleRefs } from '@basic-ui/core';
|
|
|
5
5
|
import type { BoxProps } from '../Box';
|
|
6
6
|
import { Box } from '../Box';
|
|
7
7
|
import { useTabIndicatorContext } from './context';
|
|
8
|
+
import { EASING_STANDARD } from '../motion';
|
|
8
9
|
|
|
9
10
|
export interface TabIndicatorProps extends BoxProps {
|
|
10
11
|
selected?: boolean;
|
|
@@ -59,7 +60,7 @@ export const TabIndicator = forwardRef<HTMLDivElement, TabIndicatorProps>(
|
|
|
59
60
|
transform: `scale(1)`,
|
|
60
61
|
opacity: selected ? 1 : 0,
|
|
61
62
|
transformOrigin: 'left',
|
|
62
|
-
transition:
|
|
63
|
+
transition: `transform .25s ${EASING_STANDARD}`,
|
|
63
64
|
zIndex: 1,
|
|
64
65
|
}}
|
|
65
66
|
{...otherProps}
|
package/src/Text/Text.story.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
1
3
|
import { Text } from './';
|
|
2
4
|
import { Box } from '../Box';
|
|
3
5
|
// import './styles.css';
|
|
@@ -6,7 +8,46 @@ export default {
|
|
|
6
8
|
title: 'components/Text',
|
|
7
9
|
};
|
|
8
10
|
|
|
11
|
+
const loremIpsum =
|
|
12
|
+
'Lorem ipsum dolor sit amet consectetur adipisicing elit.' +
|
|
13
|
+
'Cupiditate aliquid ad quas sunt voluptatum officia dolorum cumque,' +
|
|
14
|
+
'possimus nihil molestias sapiente necessitatibus dolor saepe inventore,' +
|
|
15
|
+
'soluta id accusantium voluptas beatae.';
|
|
16
|
+
|
|
9
17
|
const Example = () => {
|
|
18
|
+
const variantMapping = {
|
|
19
|
+
'display-large': 'Display large',
|
|
20
|
+
'display-medium': 'Display medium',
|
|
21
|
+
'display-small': 'Display small',
|
|
22
|
+
'headline-large': 'Headline large',
|
|
23
|
+
'headline-medium': 'Headline medium',
|
|
24
|
+
'headline-small': 'Headline small',
|
|
25
|
+
'title-large': 'Title large',
|
|
26
|
+
'title-medium': 'Title medium',
|
|
27
|
+
'title-small': 'Title small',
|
|
28
|
+
'label-large': 'Label large',
|
|
29
|
+
'label-medium': 'Label medium',
|
|
30
|
+
'label-small': 'Label small',
|
|
31
|
+
'body-large': `Body large. ${loremIpsum}`,
|
|
32
|
+
'body-medium': `Body medium. ${loremIpsum}`,
|
|
33
|
+
'body-small': `Body small. ${loremIpsum}`,
|
|
34
|
+
};
|
|
35
|
+
const variants = Object.keys(variantMapping).map((v) => (
|
|
36
|
+
<Text key={v} variant={v as keyof typeof variantMapping} mb={2}>
|
|
37
|
+
{variantMapping[v]}
|
|
38
|
+
</Text>
|
|
39
|
+
));
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Box bg="surface" p="2">
|
|
43
|
+
{variants}
|
|
44
|
+
</Box>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const AllVariants = () => <Example />;
|
|
49
|
+
|
|
50
|
+
export const LegacyVariants = () => {
|
|
10
51
|
const variantMapping = {
|
|
11
52
|
h1: 'Heading 1',
|
|
12
53
|
h2: 'Heading 2',
|
|
@@ -16,16 +57,14 @@ const Example = () => {
|
|
|
16
57
|
h6: 'Heading 6',
|
|
17
58
|
subtitle1: 'Subtitle 1',
|
|
18
59
|
subtitle2: 'Subtitle 2',
|
|
19
|
-
body1:
|
|
20
|
-
|
|
21
|
-
body2:
|
|
22
|
-
'Body 2. Lorem ipsum dolor sit amet consectetur adipisicing elit. Cupiditate aliquid ad quas sunt voluptatum officia dolorum cumque, possimus nihil molestias sapiente necessitatibus dolor saepe inventore, soluta id accusantium voluptas beatae.',
|
|
60
|
+
body1: `Body 1. ${loremIpsum}`,
|
|
61
|
+
body2: `Body 2. ${loremIpsum}`,
|
|
23
62
|
button: 'Button text',
|
|
24
63
|
caption: 'Caption text',
|
|
25
64
|
overline: 'Overline text',
|
|
26
65
|
};
|
|
27
66
|
const variants = Object.keys(variantMapping).map((v) => (
|
|
28
|
-
<Text key={v} variant={v} mb={2}>
|
|
67
|
+
<Text key={v} variant={v as keyof typeof variantMapping} mb={2}>
|
|
29
68
|
{variantMapping[v]}
|
|
30
69
|
</Text>
|
|
31
70
|
));
|
|
@@ -36,5 +75,3 @@ const Example = () => {
|
|
|
36
75
|
</Box>
|
|
37
76
|
);
|
|
38
77
|
};
|
|
39
|
-
|
|
40
|
-
export const AllVariants = () => <Example />;
|
package/src/Text/Text.tsx
CHANGED
|
@@ -4,7 +4,10 @@ import * as React from 'react';
|
|
|
4
4
|
import type { BoxProps } from '../Box';
|
|
5
5
|
import { Box } from '../Box';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
export type LegacyTextVariants =
|
|
8
11
|
| 'h1'
|
|
9
12
|
| 'h2'
|
|
10
13
|
| 'h3'
|
|
@@ -19,8 +22,25 @@ export type TextVariants =
|
|
|
19
22
|
| 'overline'
|
|
20
23
|
| 'button';
|
|
21
24
|
|
|
25
|
+
export type TextVariants =
|
|
26
|
+
| 'display-large'
|
|
27
|
+
| 'display-medium'
|
|
28
|
+
| 'display-small'
|
|
29
|
+
| 'headline-large'
|
|
30
|
+
| 'headline-medium'
|
|
31
|
+
| 'headline-small'
|
|
32
|
+
| 'title-large'
|
|
33
|
+
| 'title-medium'
|
|
34
|
+
| 'title-small'
|
|
35
|
+
| 'label-large'
|
|
36
|
+
| 'label-medium'
|
|
37
|
+
| 'label-small'
|
|
38
|
+
| 'body-large'
|
|
39
|
+
| 'body-medium'
|
|
40
|
+
| 'body-small';
|
|
41
|
+
|
|
22
42
|
export interface TextProps extends BoxProps {
|
|
23
|
-
variant?: TextVariants;
|
|
43
|
+
variant?: LegacyTextVariants | TextVariants;
|
|
24
44
|
}
|
|
25
45
|
|
|
26
46
|
const mappings: { [key: string]: React.ElementType<any> } = {
|
package/src/TextField/Input.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { forwardRef } from 'react';
|
|
|
5
5
|
import type { BoxProps } from '../Box';
|
|
6
6
|
import { Box } from '../Box';
|
|
7
7
|
import { alpha } from '../color';
|
|
8
|
+
import { EASING_STANDARD } from '../motion';
|
|
8
9
|
import {
|
|
9
10
|
ICON_WIDTH,
|
|
10
11
|
PADDING_LEFT_WITHOUT_ICON,
|
|
@@ -72,7 +73,7 @@ export const Input = forwardRef<HTMLDivElement, InputProps>(function Input(
|
|
|
72
73
|
variant === 'filled'
|
|
73
74
|
? alpha('on.surface-variant', 0.87)
|
|
74
75
|
: alpha('on.surface-variant', 0.6),
|
|
75
|
-
transition: `opacity .18s
|
|
76
|
+
transition: `opacity .18s ${EASING_STANDARD}`,
|
|
76
77
|
},
|
|
77
78
|
':disabled::placeholder': {
|
|
78
79
|
color: alpha('on.surface', 0.38),
|
|
@@ -68,6 +68,8 @@ const ThemeBuilder = () => {
|
|
|
68
68
|
sx={{ gap: 3 }}
|
|
69
69
|
flexDirection="column"
|
|
70
70
|
width="300px"
|
|
71
|
+
position="fixed"
|
|
72
|
+
top="0"
|
|
71
73
|
>
|
|
72
74
|
<Box display="flex">
|
|
73
75
|
<TextFieldColorPicker
|
|
@@ -131,31 +133,33 @@ const ThemeBuilder = () => {
|
|
|
131
133
|
</Button>
|
|
132
134
|
</Box>
|
|
133
135
|
</Box>
|
|
134
|
-
<Box width="
|
|
135
|
-
<Box
|
|
136
|
-
<Box flex="
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
<Box width="100%" pl="300px">
|
|
137
|
+
<Box width="600px" mx="auto">
|
|
138
|
+
<Box display="flex" flexDirection="column" sx={{ gap: 4 }}>
|
|
139
|
+
<Box flex="1">
|
|
140
|
+
<Text variant="h5" as="h1" pb={'0.3em'}>
|
|
141
|
+
Light theme
|
|
142
|
+
</Text>
|
|
143
|
+
<ThemeColors scheme={scheme} />
|
|
144
|
+
</Box>
|
|
145
|
+
<Box flex="1">
|
|
146
|
+
<Text variant="h5" as="h1" pb={'0.3em'}>
|
|
147
|
+
Dark theme
|
|
148
|
+
</Text>
|
|
149
|
+
<ThemeColors scheme={scheme.modes.dark} />
|
|
150
|
+
</Box>
|
|
141
151
|
</Box>
|
|
142
|
-
<Box flex="
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<
|
|
152
|
+
<Box my={4} display="flex" sx={{ gap: 3 }} flexDirection="column">
|
|
153
|
+
<TonalColors palette={a1} />
|
|
154
|
+
<TonalColors palette={secondaryColorTonal} />
|
|
155
|
+
<TonalColors palette={tertiaryColorTonal} />
|
|
156
|
+
<TonalColors palette={error} />
|
|
157
|
+
<TonalColors palette={neutralColorTonal} />
|
|
158
|
+
<TonalColors palette={n2} />
|
|
159
|
+
</Box>
|
|
160
|
+
<Box as="pre" fontFamily="monospace" fontSize="12px">
|
|
161
|
+
{JSON.stringify({ colors: scheme }, null, 2)}
|
|
147
162
|
</Box>
|
|
148
|
-
</Box>
|
|
149
|
-
<Box my={4} display="flex" sx={{ gap: 3 }} flexDirection="column">
|
|
150
|
-
<TonalColors palette={a1} />
|
|
151
|
-
<TonalColors palette={secondaryColorTonal} />
|
|
152
|
-
<TonalColors palette={tertiaryColorTonal} />
|
|
153
|
-
<TonalColors palette={error} />
|
|
154
|
-
<TonalColors palette={neutralColorTonal} />
|
|
155
|
-
<TonalColors palette={n2} />
|
|
156
|
-
</Box>
|
|
157
|
-
<Box as="pre" fontFamily="monospace" fontSize="12px">
|
|
158
|
-
{JSON.stringify({ colors: scheme }, null, 2)}
|
|
159
163
|
</Box>
|
|
160
164
|
</Box>
|
|
161
165
|
</Box>
|