@kalink-ui/seedly 0.24.0 → 0.26.0
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/CHANGELOG.md +24 -1
- package/package.json +2 -2
- package/src/components/box/box.css.ts +21 -8
- package/src/components/box/box.responsive.ts +9 -0
- package/src/components/box/box.tsx +9 -3
- package/src/components/button/button.css.ts +199 -177
- package/src/components/button/button.responsive.ts +11 -0
- package/src/components/button/button.tsx +31 -10
- package/src/components/card/card.tsx +3 -1
- package/src/components/center/center.css.ts +23 -10
- package/src/components/center/center.responsive.ts +9 -0
- package/src/components/center/center.tsx +12 -3
- package/src/components/cluster/cluster.css.ts +116 -89
- package/src/components/cluster/cluster.responsive.ts +9 -0
- package/src/components/cluster/cluster.tsx +14 -3
- package/src/components/command/command-list.css.ts +24 -10
- package/src/components/command/command-list.responsive.ts +9 -0
- package/src/components/command/command-list.tsx +2 -2
- package/src/components/command/command.tsx +2 -2
- package/src/components/cover/cover.css.ts +23 -10
- package/src/components/cover/cover.responsive.ts +9 -0
- package/src/components/cover/cover.tsx +7 -3
- package/src/components/grid/grid.css.ts +21 -8
- package/src/components/grid/grid.responsive.ts +9 -0
- package/src/components/grid/grid.tsx +7 -3
- package/src/components/heading/heading.css.ts +75 -41
- package/src/components/heading/heading.responsive.ts +28 -0
- package/src/components/heading/heading.tsx +65 -53
- package/src/components/loader/loader.css.ts +31 -18
- package/src/components/loader/moon-loader.responsive.ts +9 -0
- package/src/components/loader/moon-loader.tsx +12 -3
- package/src/components/menu/menu-separator.css.ts +26 -10
- package/src/components/menu/menu-separator.responsive.ts +9 -0
- package/src/components/sheet/sheet-title.tsx +16 -1
- package/src/components/sidebar/sidebar.css.ts +21 -8
- package/src/components/sidebar/sidebar.responsive.ts +9 -0
- package/src/components/sidebar/sidebar.tsx +6 -3
- package/src/components/stack/stack.css.ts +61 -39
- package/src/components/stack/stack.responsive.ts +9 -0
- package/src/components/stack/stack.tsx +10 -3
- package/src/components/switcher/index.ts +1 -1
- package/src/components/switcher/switcher.css.ts +21 -8
- package/src/components/switcher/switcher.responsive.ts +9 -0
- package/src/components/switcher/switcher.tsx +14 -9
- package/src/components/text/text.css.ts +78 -39
- package/src/components/text/text.responsive.ts +62 -0
- package/src/components/text/text.tsx +35 -8
- package/src/styles/breakpoints.ts +25 -0
- package/src/styles/index.ts +12 -0
- package/src/styles/responsive.ts +180 -0
|
@@ -1,8 +1,48 @@
|
|
|
1
1
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createResponsiveVariants,
|
|
5
|
+
defaultMedia,
|
|
6
|
+
mapContractVars,
|
|
7
|
+
sys,
|
|
8
|
+
} from '../../styles';
|
|
4
9
|
import { components } from '../../styles/layers.css';
|
|
5
10
|
|
|
11
|
+
export const headingAlignStyles = {
|
|
12
|
+
start: {
|
|
13
|
+
'@layer': {
|
|
14
|
+
[components]: {
|
|
15
|
+
alignItems: 'flex-start',
|
|
16
|
+
textAlign: 'start',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
center: {
|
|
21
|
+
'@layer': {
|
|
22
|
+
[components]: {
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
textAlign: 'center',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
end: {
|
|
29
|
+
'@layer': {
|
|
30
|
+
[components]: {
|
|
31
|
+
alignItems: 'flex-end',
|
|
32
|
+
textAlign: 'end',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
justify: {
|
|
37
|
+
'@layer': {
|
|
38
|
+
[components]: {
|
|
39
|
+
alignItems: 'stretch',
|
|
40
|
+
textAlign: 'justify',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
6
46
|
export const headingRoot = recipe({
|
|
7
47
|
base: {
|
|
8
48
|
'@layer': {
|
|
@@ -14,59 +54,53 @@ export const headingRoot = recipe({
|
|
|
14
54
|
},
|
|
15
55
|
|
|
16
56
|
variants: {
|
|
17
|
-
align:
|
|
18
|
-
start: {
|
|
19
|
-
'@layer': {
|
|
20
|
-
[components]: {
|
|
21
|
-
alignItems: 'flex-start',
|
|
22
|
-
textAlign: 'start',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
center: {
|
|
27
|
-
'@layer': {
|
|
28
|
-
[components]: {
|
|
29
|
-
alignItems: 'center',
|
|
30
|
-
textAlign: 'center',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
end: {
|
|
35
|
-
'@layer': {
|
|
36
|
-
[components]: {
|
|
37
|
-
alignItems: 'flex-end',
|
|
38
|
-
textAlign: 'end',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
57
|
+
align: headingAlignStyles,
|
|
43
58
|
},
|
|
44
59
|
});
|
|
45
60
|
|
|
61
|
+
export const pretitleSpacingStyles = mapContractVars(sys.spacing, (key) => ({
|
|
62
|
+
'@layer': {
|
|
63
|
+
[components]: {
|
|
64
|
+
marginBlockEnd: sys.spacing[key],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
}));
|
|
68
|
+
|
|
46
69
|
export const pretitle = recipe({
|
|
47
70
|
variants: {
|
|
48
|
-
spacing:
|
|
49
|
-
'@layer': {
|
|
50
|
-
[components]: {
|
|
51
|
-
marginBlockEnd: sys.spacing[key],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
})),
|
|
71
|
+
spacing: pretitleSpacingStyles,
|
|
55
72
|
},
|
|
56
73
|
});
|
|
57
74
|
|
|
75
|
+
export const subtitleSpacingStyles = mapContractVars(sys.spacing, (key) => ({
|
|
76
|
+
'@layer': {
|
|
77
|
+
[components]: {
|
|
78
|
+
marginBlockStart: sys.spacing[key],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
}));
|
|
82
|
+
|
|
58
83
|
export const subtitle = recipe({
|
|
59
84
|
variants: {
|
|
60
|
-
spacing:
|
|
61
|
-
'@layer': {
|
|
62
|
-
[components]: {
|
|
63
|
-
marginBlockStart: sys.spacing[key],
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
})),
|
|
85
|
+
spacing: subtitleSpacingStyles,
|
|
67
86
|
},
|
|
68
87
|
});
|
|
69
88
|
|
|
70
89
|
export type HeadingRootVariants = NonNullable<
|
|
71
90
|
RecipeVariants<typeof headingRoot>
|
|
72
91
|
>;
|
|
92
|
+
|
|
93
|
+
export const alignAt = createResponsiveVariants({
|
|
94
|
+
styles: headingAlignStyles,
|
|
95
|
+
media: defaultMedia,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export const pretitleSpacingAt = createResponsiveVariants({
|
|
99
|
+
styles: pretitleSpacingStyles,
|
|
100
|
+
media: defaultMedia,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export const subtitleSpacingAt = createResponsiveVariants({
|
|
104
|
+
styles: subtitleSpacingStyles,
|
|
105
|
+
media: defaultMedia,
|
|
106
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
alignAt,
|
|
5
|
+
headingRoot,
|
|
6
|
+
pretitle,
|
|
7
|
+
pretitleSpacingAt,
|
|
8
|
+
subtitle,
|
|
9
|
+
subtitleSpacingAt,
|
|
10
|
+
} from './heading.css';
|
|
11
|
+
|
|
12
|
+
export const headingRootResponsive = responsiveRecipe({
|
|
13
|
+
recipe: headingRoot,
|
|
14
|
+
at: { align: alignAt },
|
|
15
|
+
order: defaultOrder,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const pretitleResponsive = responsiveRecipe({
|
|
19
|
+
recipe: pretitle,
|
|
20
|
+
at: { spacing: pretitleSpacingAt },
|
|
21
|
+
order: defaultOrder,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const subtitleResponsive = responsiveRecipe({
|
|
25
|
+
recipe: subtitle,
|
|
26
|
+
at: { spacing: subtitleSpacingAt },
|
|
27
|
+
order: defaultOrder,
|
|
28
|
+
});
|
|
@@ -1,47 +1,57 @@
|
|
|
1
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
1
2
|
import { clsx } from 'clsx';
|
|
2
3
|
import { ElementType, ReactElement, ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
import { Spacing, TypographySize, TypographyVariant } from '../../styles';
|
|
5
6
|
import { ConditionalWrapper } from '../conditional-wrapper';
|
|
6
|
-
import { Text, TextProps } from '../text';
|
|
7
|
+
import { Text, TextProps, TextVariants } from '../text';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
headingRootResponsive,
|
|
11
|
+
pretitleResponsive,
|
|
12
|
+
subtitleResponsive,
|
|
13
|
+
} from './heading.responsive';
|
|
14
|
+
|
|
15
|
+
import type { Responsive } from '../../styles/responsive';
|
|
9
16
|
|
|
10
17
|
export type HeadingTypes = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
11
18
|
|
|
12
|
-
export type HeadingProps<TUse extends ElementType = 'h2'> =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
19
|
+
export type HeadingProps<TUse extends ElementType = 'h2'> =
|
|
20
|
+
PolymorphicComponentProps<TUse> &
|
|
21
|
+
Omit<TextVariants, 'align'> & {
|
|
22
|
+
/**
|
|
23
|
+
* The typography used to render the text.
|
|
24
|
+
*/
|
|
25
|
+
variant?: Responsive<
|
|
26
|
+
Extract<TypographyVariant, 'display' | 'headline' | 'title'>
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The size of the typography used to render the text.
|
|
31
|
+
*/
|
|
32
|
+
size?: Responsive<TypographySize>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* If provided, the text will be rendered before the title.
|
|
36
|
+
*/
|
|
37
|
+
pretitle?: ReactElement<TextProps<'p'>>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* If provided, the text will be rendered after the title.
|
|
41
|
+
*/
|
|
42
|
+
subtitle?: ReactElement<TextProps<'p'>>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The text to render.
|
|
46
|
+
*/
|
|
47
|
+
children: ReactNode;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The class to pass to the root element.
|
|
51
|
+
*/
|
|
52
|
+
rootClassName?: string;
|
|
53
|
+
align?: Responsive<NonNullable<TextVariants['align']>>;
|
|
54
|
+
};
|
|
45
55
|
|
|
46
56
|
const headingMapping: Record<
|
|
47
57
|
HeadingTypes,
|
|
@@ -55,30 +65,32 @@ const headingMapping: Record<
|
|
|
55
65
|
h6: { variant: 'headline', size: 'small' },
|
|
56
66
|
};
|
|
57
67
|
|
|
58
|
-
export function Heading<TUse extends HeadingTypes>({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
export function Heading<TUse extends HeadingTypes>(props: HeadingProps<TUse>) {
|
|
69
|
+
const {
|
|
70
|
+
children,
|
|
71
|
+
use = 'h2',
|
|
72
|
+
size,
|
|
73
|
+
variant,
|
|
74
|
+
align,
|
|
75
|
+
pretitle,
|
|
76
|
+
subtitle,
|
|
77
|
+
rootClassName,
|
|
78
|
+
ref,
|
|
79
|
+
...rest
|
|
80
|
+
} = props;
|
|
81
|
+
|
|
70
82
|
return (
|
|
71
83
|
<ConditionalWrapper
|
|
72
84
|
ref={ref}
|
|
73
85
|
use={'hgroup'}
|
|
74
86
|
condition={!!pretitle || !!subtitle}
|
|
75
|
-
className={clsx(
|
|
87
|
+
className={clsx(headingRootResponsive({ align }), rootClassName)}
|
|
76
88
|
>
|
|
77
89
|
{pretitle}
|
|
78
90
|
|
|
79
91
|
<Text
|
|
80
92
|
{...(!pretitle && !subtitle && { ref })}
|
|
81
|
-
use={use}
|
|
93
|
+
use={use as HeadingProps<TUse>['use']}
|
|
82
94
|
align={align}
|
|
83
95
|
variant={variant ?? headingMapping[use].variant}
|
|
84
96
|
size={size ?? headingMapping[use].size}
|
|
@@ -94,7 +106,7 @@ export function Heading<TUse extends HeadingTypes>({
|
|
|
94
106
|
|
|
95
107
|
export type HeadingPretitleProps = Omit<TextProps<'p'>, 'children'> & {
|
|
96
108
|
children?: string | null;
|
|
97
|
-
spacing?: Spacing
|
|
109
|
+
spacing?: Responsive<Spacing>;
|
|
98
110
|
};
|
|
99
111
|
|
|
100
112
|
Heading.Pretitle = function HeadingPretitle({
|
|
@@ -111,7 +123,7 @@ Heading.Pretitle = function HeadingPretitle({
|
|
|
111
123
|
use="p"
|
|
112
124
|
variant={variant}
|
|
113
125
|
size={size}
|
|
114
|
-
className={clsx(
|
|
126
|
+
className={clsx(pretitleResponsive({ spacing }), className)}
|
|
115
127
|
{...rest}
|
|
116
128
|
>
|
|
117
129
|
{children}
|
|
@@ -122,7 +134,7 @@ Heading.Pretitle = function HeadingPretitle({
|
|
|
122
134
|
|
|
123
135
|
export type HeadingSubtitleProps = Omit<TextProps<'p'>, 'children'> & {
|
|
124
136
|
children?: string | null;
|
|
125
|
-
spacing?: Spacing
|
|
137
|
+
spacing?: Responsive<Spacing>;
|
|
126
138
|
};
|
|
127
139
|
|
|
128
140
|
Heading.Subtitle = function HeadingSubtitle({
|
|
@@ -139,7 +151,7 @@ Heading.Subtitle = function HeadingSubtitle({
|
|
|
139
151
|
use="p"
|
|
140
152
|
variant={variant}
|
|
141
153
|
size={size}
|
|
142
|
-
className={clsx(
|
|
154
|
+
className={clsx(subtitleResponsive({ spacing }), className)}
|
|
143
155
|
{...rest}
|
|
144
156
|
>
|
|
145
157
|
{children}
|
|
@@ -2,7 +2,12 @@ import { createVar, keyframes, style } from '@vanilla-extract/css';
|
|
|
2
2
|
import { calc } from '@vanilla-extract/css-utils';
|
|
3
3
|
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
createResponsiveVariants,
|
|
7
|
+
defaultMedia,
|
|
8
|
+
sys,
|
|
9
|
+
transition,
|
|
10
|
+
} from '../../styles';
|
|
6
11
|
|
|
7
12
|
export const loader = recipe({
|
|
8
13
|
variants: {
|
|
@@ -32,6 +37,25 @@ const loaderAnimation = keyframes({
|
|
|
32
37
|
},
|
|
33
38
|
});
|
|
34
39
|
|
|
40
|
+
// Shared size variant styles for responsive overrides
|
|
41
|
+
const loaderWrapperSizeStyles = {
|
|
42
|
+
sm: {
|
|
43
|
+
vars: {
|
|
44
|
+
[size]: sys.spacing[4],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
md: {
|
|
48
|
+
vars: {
|
|
49
|
+
[size]: sys.spacing[5],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
lg: {
|
|
53
|
+
vars: {
|
|
54
|
+
[size]: sys.spacing[6],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
35
59
|
export const loaderWrapper = recipe({
|
|
36
60
|
base: {
|
|
37
61
|
overflow: 'hidden',
|
|
@@ -53,23 +77,7 @@ export const loaderWrapper = recipe({
|
|
|
53
77
|
},
|
|
54
78
|
|
|
55
79
|
variants: {
|
|
56
|
-
size:
|
|
57
|
-
sm: {
|
|
58
|
-
vars: {
|
|
59
|
-
[size]: sys.spacing[4],
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
md: {
|
|
63
|
-
vars: {
|
|
64
|
-
[size]: sys.spacing[5],
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
lg: {
|
|
68
|
-
vars: {
|
|
69
|
-
[size]: sys.spacing[6],
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
80
|
+
size: loaderWrapperSizeStyles,
|
|
73
81
|
},
|
|
74
82
|
});
|
|
75
83
|
|
|
@@ -107,3 +115,8 @@ export type LoaderVariants = NonNullable<RecipeVariants<typeof loader>>;
|
|
|
107
115
|
export type MoonLoaderVariants = NonNullable<
|
|
108
116
|
RecipeVariants<typeof loaderWrapper>
|
|
109
117
|
>;
|
|
118
|
+
|
|
119
|
+
export const sizeAt = createResponsiveVariants({
|
|
120
|
+
styles: loaderWrapperSizeStyles,
|
|
121
|
+
media: defaultMedia,
|
|
122
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
|
|
2
|
+
|
|
3
|
+
import { loaderWrapper, sizeAt } from './loader.css';
|
|
4
|
+
|
|
5
|
+
export const moonLoaderResponsive = responsiveRecipe({
|
|
6
|
+
recipe: loaderWrapper,
|
|
7
|
+
at: { size: sizeAt },
|
|
8
|
+
order: defaultOrder,
|
|
9
|
+
});
|
|
@@ -6,11 +6,13 @@ import { Box, BoxProps } from '../box';
|
|
|
6
6
|
import {
|
|
7
7
|
ellipse,
|
|
8
8
|
moon,
|
|
9
|
-
loaderWrapper,
|
|
10
9
|
loader,
|
|
11
10
|
LoaderVariants,
|
|
12
11
|
MoonLoaderVariants,
|
|
13
12
|
} from './loader.css';
|
|
13
|
+
import { moonLoaderResponsive } from './moon-loader.responsive';
|
|
14
|
+
|
|
15
|
+
import type { Responsive } from '../../styles/responsive';
|
|
14
16
|
|
|
15
17
|
export type LoaderProps<TUse extends ElementType> = BoxProps<TUse> & {
|
|
16
18
|
forceMount?: boolean;
|
|
@@ -26,14 +28,21 @@ export function MoonLoader<TUse extends ElementType>({
|
|
|
26
28
|
forceMount = false,
|
|
27
29
|
className,
|
|
28
30
|
...props
|
|
29
|
-
}: LoaderProps<TUse> &
|
|
31
|
+
}: LoaderProps<TUse> &
|
|
32
|
+
Omit<MoonLoaderVariants, 'size'> & {
|
|
33
|
+
size?: Responsive<NonNullable<MoonLoaderVariants['size']>>;
|
|
34
|
+
}) {
|
|
30
35
|
if (!active && !forceMount) {
|
|
31
36
|
return null;
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
return (
|
|
35
40
|
<Box
|
|
36
|
-
className={clsx(
|
|
41
|
+
className={clsx(
|
|
42
|
+
moonLoaderResponsive({ size }),
|
|
43
|
+
loader({ active }),
|
|
44
|
+
className,
|
|
45
|
+
)}
|
|
37
46
|
{...props}
|
|
38
47
|
>
|
|
39
48
|
<span className={ellipse} />
|
|
@@ -2,11 +2,30 @@ import { createVar } from '@vanilla-extract/css';
|
|
|
2
2
|
import { calc } from '@vanilla-extract/css-utils';
|
|
3
3
|
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
createResponsiveVariants,
|
|
7
|
+
defaultMedia,
|
|
8
|
+
mapContractVars,
|
|
9
|
+
sys,
|
|
10
|
+
} from '../../styles';
|
|
6
11
|
import { components } from '../../styles/layers.css';
|
|
7
12
|
|
|
8
13
|
const spaceVar = createVar();
|
|
9
14
|
|
|
15
|
+
// Shared spacing styles for responsive overrides
|
|
16
|
+
export const menuSeparatorSpacingStyles = mapContractVars(
|
|
17
|
+
sys.spacing,
|
|
18
|
+
(key) => ({
|
|
19
|
+
'@layer': {
|
|
20
|
+
[components]: {
|
|
21
|
+
vars: {
|
|
22
|
+
[spaceVar]: sys.spacing[key],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
|
|
10
29
|
export const menuSeparator = recipe({
|
|
11
30
|
base: {
|
|
12
31
|
paddingBlock: spaceVar,
|
|
@@ -37,18 +56,15 @@ export const menuSeparator = recipe({
|
|
|
37
56
|
},
|
|
38
57
|
},
|
|
39
58
|
|
|
40
|
-
spacing:
|
|
41
|
-
'@layer': {
|
|
42
|
-
[components]: {
|
|
43
|
-
vars: {
|
|
44
|
-
[spaceVar]: sys.spacing[key],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
})),
|
|
59
|
+
spacing: menuSeparatorSpacingStyles,
|
|
49
60
|
},
|
|
50
61
|
});
|
|
51
62
|
|
|
52
63
|
export type MenuSeparatorVariants = NonNullable<
|
|
53
64
|
RecipeVariants<typeof menuSeparator>
|
|
54
65
|
>;
|
|
66
|
+
|
|
67
|
+
export const spacingAt = createResponsiveVariants({
|
|
68
|
+
styles: menuSeparatorSpacingStyles,
|
|
69
|
+
media: defaultMedia,
|
|
70
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
|
|
2
|
+
|
|
3
|
+
import { menuSeparator, spacingAt } from './menu-separator.css';
|
|
4
|
+
|
|
5
|
+
export const menuSeparatorResponsive = responsiveRecipe({
|
|
6
|
+
recipe: menuSeparator,
|
|
7
|
+
at: { spacing: spacingAt },
|
|
8
|
+
order: defaultOrder,
|
|
9
|
+
});
|
|
@@ -13,7 +13,18 @@ type SheetTitleProps<TUse extends HeadingTypes> = ComponentPropsWithRef<
|
|
|
13
13
|
export function SheetTitle<TUse extends HeadingTypes>(
|
|
14
14
|
props: SheetTitleProps<TUse>,
|
|
15
15
|
) {
|
|
16
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
use = 'h2',
|
|
18
|
+
className,
|
|
19
|
+
children,
|
|
20
|
+
variant,
|
|
21
|
+
size,
|
|
22
|
+
align,
|
|
23
|
+
subtitle,
|
|
24
|
+
pretitle,
|
|
25
|
+
rootClassName,
|
|
26
|
+
...rest
|
|
27
|
+
} = props;
|
|
17
28
|
|
|
18
29
|
return (
|
|
19
30
|
<Title asChild {...rest}>
|
|
@@ -22,6 +33,10 @@ export function SheetTitle<TUse extends HeadingTypes>(
|
|
|
22
33
|
variant={variant}
|
|
23
34
|
size={size}
|
|
24
35
|
className={className}
|
|
36
|
+
align={align}
|
|
37
|
+
pretitle={pretitle}
|
|
38
|
+
subtitle={subtitle}
|
|
39
|
+
rootClassName={rootClassName}
|
|
25
40
|
>
|
|
26
41
|
{children}
|
|
27
42
|
</Heading>
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { createVar, globalStyle } from '@vanilla-extract/css';
|
|
2
2
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
createResponsiveVariants,
|
|
6
|
+
defaultMedia,
|
|
7
|
+
sys,
|
|
8
|
+
mapContractVars,
|
|
9
|
+
} from '../../styles';
|
|
5
10
|
import { components } from '../../styles/layers.css';
|
|
6
11
|
|
|
7
12
|
export const sideWidthVar = createVar();
|
|
8
13
|
export const contentMinWidthVar = createVar();
|
|
9
14
|
|
|
15
|
+
// Shared variant styles to support responsive overrides
|
|
16
|
+
export const sidebarSpacingStyles = mapContractVars(sys.spacing, (key) => ({
|
|
17
|
+
'@layer': {
|
|
18
|
+
[components]: {
|
|
19
|
+
gap: sys.spacing[key],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
|
|
10
24
|
export const sidebarRecipe = recipe({
|
|
11
25
|
base: {
|
|
12
26
|
'@layer': {
|
|
@@ -25,13 +39,7 @@ export const sidebarRecipe = recipe({
|
|
|
25
39
|
/**
|
|
26
40
|
* The spacing between the sidebar and main content elements
|
|
27
41
|
*/
|
|
28
|
-
spacing:
|
|
29
|
-
'@layer': {
|
|
30
|
-
[components]: {
|
|
31
|
-
gap: sys.spacing[key],
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
})),
|
|
42
|
+
spacing: sidebarSpacingStyles,
|
|
35
43
|
|
|
36
44
|
/**
|
|
37
45
|
* Whether the sidebar should stretch to fill the available space
|
|
@@ -100,3 +108,8 @@ globalStyle(`${sidebarRecipe.classNames.variants.side.right} > :first-child`, {
|
|
|
100
108
|
});
|
|
101
109
|
|
|
102
110
|
export type SidebarVariants = NonNullable<RecipeVariants<typeof sidebarRecipe>>;
|
|
111
|
+
|
|
112
|
+
export const spacingAt = createResponsiveVariants({
|
|
113
|
+
styles: sidebarSpacingStyles,
|
|
114
|
+
media: defaultMedia,
|
|
115
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
|
|
2
|
+
|
|
3
|
+
import { sidebarRecipe, spacingAt } from './sidebar.css';
|
|
4
|
+
|
|
5
|
+
export const sidebarResponsive = responsiveRecipe({
|
|
6
|
+
recipe: sidebarRecipe,
|
|
7
|
+
at: { spacing: spacingAt },
|
|
8
|
+
order: defaultOrder,
|
|
9
|
+
});
|
|
@@ -7,13 +7,15 @@ import { ElementType } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
contentMinWidthVar,
|
|
10
|
-
sidebarRecipe,
|
|
11
10
|
SidebarVariants,
|
|
12
11
|
sideWidthVar,
|
|
13
12
|
} from './sidebar.css';
|
|
13
|
+
import { sidebarResponsive } from './sidebar.responsive';
|
|
14
|
+
|
|
15
|
+
import type { Responsive } from '../../styles/responsive';
|
|
14
16
|
|
|
15
17
|
type SidebarProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
16
|
-
Omit<SidebarVariants, 'sideWidth'> & {
|
|
18
|
+
Omit<SidebarVariants, 'sideWidth' | 'spacing'> & {
|
|
17
19
|
/**
|
|
18
20
|
* The size of the side element
|
|
19
21
|
*/
|
|
@@ -24,6 +26,7 @@ type SidebarProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
|
24
26
|
* Should be a percentage.
|
|
25
27
|
*/
|
|
26
28
|
contentMinWidth?: string;
|
|
29
|
+
spacing?: Responsive<NonNullable<SidebarVariants['spacing']>>;
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
/**
|
|
@@ -48,7 +51,7 @@ export function Sidebar<TUse extends ElementType>({
|
|
|
48
51
|
return (
|
|
49
52
|
<Comp
|
|
50
53
|
className={clsx(
|
|
51
|
-
|
|
54
|
+
sidebarResponsive({ side, sideWidth: !!sideWidth, spacing, noStretch }),
|
|
52
55
|
className,
|
|
53
56
|
)}
|
|
54
57
|
style={assignInlineVars({
|