@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
package/src/color.ts
CHANGED
|
@@ -17,17 +17,38 @@ export const alpha =
|
|
|
17
17
|
return `rgba(${rgb.red},${rgb.green},${rgb.blue},${alphaValue})`;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
export function mixColor(
|
|
21
|
+
baseColor: string,
|
|
22
|
+
overlayColor: string
|
|
23
|
+
): (theme: any) => string;
|
|
24
|
+
export function mixColor(
|
|
25
|
+
baseColor: string,
|
|
26
|
+
overlayColor: string,
|
|
27
|
+
overlayOpacity: number
|
|
28
|
+
): (theme: any) => string;
|
|
29
|
+
export function mixColor(
|
|
30
|
+
baseColor: string,
|
|
31
|
+
overlayColor: string,
|
|
32
|
+
overlayOpacity?: number
|
|
33
|
+
): (theme: any) => string {
|
|
34
|
+
return (theme) => {
|
|
35
|
+
baseColor = get(theme, `colors.${baseColor}`, baseColor);
|
|
36
|
+
overlayColor = overlayOpacity
|
|
37
|
+
? alpha(overlayColor, overlayOpacity)(theme)
|
|
38
|
+
: get(theme, `colors.${overlayColor}`, overlayColor);
|
|
39
|
+
|
|
40
|
+
return `linear-gradient(${overlayColor}, ${overlayColor}), ${baseColor}`;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
20
44
|
export function getColorOverlay(
|
|
21
45
|
theme: Theme,
|
|
22
46
|
baseColor: string,
|
|
23
47
|
overlayColor: string,
|
|
24
48
|
overlayOpacity: number
|
|
25
49
|
): SystemStyleObject {
|
|
26
|
-
baseColor = get(theme, `colors.${baseColor}`) || baseColor;
|
|
27
|
-
overlayColor = alpha(overlayColor, overlayOpacity)(theme);
|
|
28
|
-
|
|
29
50
|
return {
|
|
30
|
-
background:
|
|
51
|
+
background: mixColor(baseColor, overlayColor, overlayOpacity)(theme),
|
|
31
52
|
};
|
|
32
53
|
}
|
|
33
54
|
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './Link';
|
|
|
17
17
|
export * from './List';
|
|
18
18
|
export * from './ListItem';
|
|
19
19
|
export * from './Menu';
|
|
20
|
+
export * from './NavRail';
|
|
20
21
|
export * from './NotchedOutline';
|
|
21
22
|
export * from './Paper';
|
|
22
23
|
export * from './ProgressSpinner';
|
|
@@ -33,5 +34,6 @@ export * from './Table';
|
|
|
33
34
|
export * from './Text';
|
|
34
35
|
export * from './TextField';
|
|
35
36
|
export * from './Tooltip';
|
|
37
|
+
export * from './motion';
|
|
36
38
|
export * from './theme';
|
|
37
39
|
export * from './color';
|
package/src/motion.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const EASING_EMPHASIZED = 'cubic-bezier(0.2, 0, 0, 1)';
|
|
2
|
+
export const EASING_EMPHASIZED_ACCELERATE = 'cubic-bezier(0.3, 0, 0.8, 0.15)';
|
|
3
|
+
export const EASING_EMPHASIZED_DECELERATE = 'cubic-bezier(0.05, 0.7, 0.1, 1)';
|
|
4
|
+
export const EASING_LINEAR = 'cubic-bezier(0, 0, 1, 1)';
|
|
5
|
+
export const EASING_STANDARD = 'cubic-bezier(0.2, 0, 0, 1)';
|
|
6
|
+
export const EASING_STANDARD_ACCELERATE = 'cubic-bezier(0.3, 0, 1, 1)';
|
|
7
|
+
export const EASING_STANDARD_DECELERATE = 'cubic-bezier(0, 0, 0, 1)';
|
package/src/theme/theme.ts
CHANGED
|
@@ -5,6 +5,24 @@
|
|
|
5
5
|
// - https://material.io/design/typography/the-type-system.html#type-scale
|
|
6
6
|
import { rem, em } from 'polished';
|
|
7
7
|
|
|
8
|
+
import { EASING_STANDARD } from '../motion';
|
|
9
|
+
|
|
10
|
+
function font(
|
|
11
|
+
fontFamily: 'plain' | 'brand',
|
|
12
|
+
lineHeight: number,
|
|
13
|
+
fontSize: number,
|
|
14
|
+
letterSpacing: number,
|
|
15
|
+
weight: number
|
|
16
|
+
) {
|
|
17
|
+
return {
|
|
18
|
+
fontFamily,
|
|
19
|
+
lineHeight: rem(lineHeight),
|
|
20
|
+
fontSize: rem(fontSize),
|
|
21
|
+
letterSpacing: rem(letterSpacing),
|
|
22
|
+
weight,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
8
26
|
export const theme = {
|
|
9
27
|
googleFonts:
|
|
10
28
|
'https://fonts.googleapis.com/css?family=Roboto+Mono|Roboto:300,400,500,600,700&display=swap',
|
|
@@ -123,6 +141,8 @@ export const theme = {
|
|
|
123
141
|
fonts: {
|
|
124
142
|
body: 'Roboto, sans-serif',
|
|
125
143
|
heading: 'Roboto, sans-serif',
|
|
144
|
+
brand: 'Roboto, sans-serif',
|
|
145
|
+
plain: 'Roboto, sans-serif',
|
|
126
146
|
monospace: '"Roboto Mono", monospace',
|
|
127
147
|
},
|
|
128
148
|
fontSizes: {
|
|
@@ -172,6 +192,21 @@ export const theme = {
|
|
|
172
192
|
fontFamily: 'body',
|
|
173
193
|
lineHeight: 'body',
|
|
174
194
|
},
|
|
195
|
+
'display-large': font('brand', 64, 57, 0, 400),
|
|
196
|
+
'display-medium': font('brand', 52, 45, 0, 400),
|
|
197
|
+
'display-small': font('brand', 44, 36, 0, 400),
|
|
198
|
+
'headline-large': font('brand', 40, 32, 0, 400),
|
|
199
|
+
'headline-medium': font('brand', 36, 28, 0, 400),
|
|
200
|
+
'headline-small': font('brand', 32, 24, 0, 400),
|
|
201
|
+
'title-large': font('plain', 28, 22, 0, 400),
|
|
202
|
+
'title-medium': font('plain', 24, 16, 0.15, 500),
|
|
203
|
+
'title-small': font('plain', 20, 14, 0.1, 500),
|
|
204
|
+
'label-large': font('plain', 20, 14, 0.1, 500),
|
|
205
|
+
'label-medium': font('plain', 16, 12, 0.5, 500),
|
|
206
|
+
'label-small': font('plain', 16, 11, 0.5, 500),
|
|
207
|
+
'body-large': font('plain', 24, 16, 0.5, 400),
|
|
208
|
+
'body-medium': font('plain', 20, 14, 0.25, 400),
|
|
209
|
+
'body-small': font('plain', 16, 12, 0.4, 400),
|
|
175
210
|
h1: {
|
|
176
211
|
variant: 'text.heading',
|
|
177
212
|
fontWeight: 'light',
|
|
@@ -362,7 +397,7 @@ export const theme = {
|
|
|
362
397
|
elevations: {
|
|
363
398
|
none: {},
|
|
364
399
|
default: {
|
|
365
|
-
transition:
|
|
400
|
+
transition: `box-shadow .28s ${EASING_STANDARD}`,
|
|
366
401
|
'&:hover': {
|
|
367
402
|
boxShadow: 1,
|
|
368
403
|
},
|
|
@@ -371,7 +406,7 @@ export const theme = {
|
|
|
371
406
|
},
|
|
372
407
|
},
|
|
373
408
|
elevated: {
|
|
374
|
-
transition:
|
|
409
|
+
transition: `box-shadow .28s ${EASING_STANDARD}`,
|
|
375
410
|
boxShadow: 1,
|
|
376
411
|
'&:hover': {
|
|
377
412
|
boxShadow: 2,
|
|
@@ -381,7 +416,7 @@ export const theme = {
|
|
|
381
416
|
},
|
|
382
417
|
},
|
|
383
418
|
floating: {
|
|
384
|
-
transition:
|
|
419
|
+
transition: `box-shadow .28s ${EASING_STANDARD}`,
|
|
385
420
|
boxShadow: 3,
|
|
386
421
|
':hover': {
|
|
387
422
|
boxShadow: 4,
|
|
@@ -426,7 +461,7 @@ export const theme = {
|
|
|
426
461
|
height: rem(32),
|
|
427
462
|
borderRadius: 'small',
|
|
428
463
|
outline: 'none',
|
|
429
|
-
transition:
|
|
464
|
+
transition: `box-shadow .28s ${EASING_STANDARD}`,
|
|
430
465
|
},
|
|
431
466
|
filled: {
|
|
432
467
|
variant: 'chips.variants.base',
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useTheme } from '@emotion/react';
|
|
3
|
-
|
|
4
|
-
import { ThemeColors } from './ThemeColors';
|
|
5
|
-
import { DARK_THEME_CLASS, DEFAULT_THEME_CLASS, Box } from '../';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'components/ThemeExplorer',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const ThemeExplorer = () => {
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
<Box
|
|
16
|
-
flex="1"
|
|
17
|
-
p={3}
|
|
18
|
-
borderRadius="extra-large"
|
|
19
|
-
overflow="hidden"
|
|
20
|
-
border="1px solid #fff"
|
|
21
|
-
borderColor="outline"
|
|
22
|
-
bg="surface"
|
|
23
|
-
className={DEFAULT_THEME_CLASS}
|
|
24
|
-
>
|
|
25
|
-
<ThemeColors scheme={theme.colors as any} />
|
|
26
|
-
</Box>
|
|
27
|
-
<Box
|
|
28
|
-
flex="1"
|
|
29
|
-
p={3}
|
|
30
|
-
borderRadius="extra-large"
|
|
31
|
-
overflow="hidden"
|
|
32
|
-
border="1px solid #fff"
|
|
33
|
-
borderColor="outline"
|
|
34
|
-
bg="surface"
|
|
35
|
-
className={DARK_THEME_CLASS}
|
|
36
|
-
>
|
|
37
|
-
<ThemeColors scheme={theme.colors.modes.dark as any} />
|
|
38
|
-
</Box>
|
|
39
|
-
</>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const Explorer = () => <ThemeExplorer />;
|