@kalink-ui/seedly 0.18.0 → 0.20.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +4 -3
  3. package/src/components/alert-dialog/alert-dialog-action.tsx +22 -0
  4. package/src/components/alert-dialog/alert-dialog-cancel.tsx +19 -0
  5. package/src/components/alert-dialog/alert-dialog-content.css.ts +78 -0
  6. package/src/components/alert-dialog/alert-dialog-content.tsx +47 -0
  7. package/src/components/alert-dialog/alert-dialog-description.tsx +24 -0
  8. package/src/components/alert-dialog/alert-dialog-footer.css.ts +34 -0
  9. package/src/components/alert-dialog/alert-dialog-footer.tsx +26 -0
  10. package/src/components/alert-dialog/alert-dialog-header.tsx +11 -0
  11. package/src/components/alert-dialog/alert-dialog-overlay.tsx +15 -0
  12. package/src/components/alert-dialog/alert-dialog-portal.tsx +3 -0
  13. package/src/components/alert-dialog/alert-dialog-title.tsx +24 -0
  14. package/src/components/alert-dialog/alert-dialog-trigger.tsx +3 -0
  15. package/src/components/alert-dialog/alert-dialog.tsx +5 -0
  16. package/src/components/alert-dialog/index.ts +11 -0
  17. package/src/components/center/center.css.ts +7 -1
  18. package/src/components/center/index.ts +1 -1
  19. package/src/components/heading/heading.css.ts +6 -2
  20. package/src/components/heading/heading.tsx +2 -2
  21. package/src/components/heading/index.ts +7 -1
  22. package/src/components/overlay/index.ts +1 -0
  23. package/src/components/overlay/overlay.css.ts +48 -0
  24. package/src/components/scroll-area/index.ts +1 -1
  25. package/src/components/scroll-area/scroll-area.css.ts +54 -29
  26. package/src/components/sheet/sheet-content.css.ts +97 -60
  27. package/src/components/sheet/sheet-content.tsx +2 -2
  28. package/src/components/sheet/sheet-header.css.ts +30 -9
  29. package/src/components/sheet/sheet-overlay.tsx +4 -4
  30. package/src/components/sheet/sheet-title.tsx +1 -2
  31. package/src/components/sheet/sheet-overlay.css.ts +0 -43
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @kalink-ui/seedly
2
2
 
3
+ ## 0.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d902023: [AlertDialog] Create new AlertDialog component
8
+
9
+ ## 0.19.0
10
+
11
+ ### Minor Changes
12
+
13
+ - e73d11a: [Center] Use a custom property to define gutters value
14
+
3
15
  ## 0.18.0
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalink-ui/seedly",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "A set of components for building UIs with React and TypeScript",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -44,8 +44,8 @@
44
44
  "vite-tsconfig-paths": "^5.1.4",
45
45
  "vitest": "^3.2.3",
46
46
  "@kalink-ui/dibbly": "0.5.0",
47
- "@kalink-ui/typescript-config": "0.4.0",
48
- "@kalink-ui/eslint-config": "0.9.0"
47
+ "@kalink-ui/eslint-config": "0.9.0",
48
+ "@kalink-ui/typescript-config": "0.4.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@vanilla-extract/css": "^1.17.1",
@@ -58,6 +58,7 @@
58
58
  "typescript": "^5.8.2"
59
59
  },
60
60
  "dependencies": {
61
+ "@radix-ui/react-alert-dialog": "^1.1.14",
61
62
  "@radix-ui/react-dialog": "^1.1.14",
62
63
  "@radix-ui/react-popover": "^1.1.14",
63
64
  "@radix-ui/react-scroll-area": "^1.2.9",
@@ -0,0 +1,22 @@
1
+ import { Action } from '@radix-ui/react-alert-dialog';
2
+ import { ComponentPropsWithRef } from 'react';
3
+
4
+ import { Button, ButtonProps } from '../button';
5
+
6
+ export type AlertDialogActionProps = ComponentPropsWithRef<typeof Action> &
7
+ ButtonProps<'button'> & {
8
+ loading?: boolean;
9
+ };
10
+
11
+ export function AlertDialogAction({
12
+ className,
13
+ children,
14
+ loading,
15
+ ...props
16
+ }: AlertDialogActionProps) {
17
+ return (
18
+ <Action asChild {...props}>
19
+ <Button>{children}</Button>
20
+ </Action>
21
+ );
22
+ }
@@ -0,0 +1,19 @@
1
+ import { Cancel } from '@radix-ui/react-alert-dialog';
2
+ import { ComponentPropsWithRef } from 'react';
3
+
4
+ import { Button, ButtonProps } from '../button';
5
+
6
+ export type AlertDialogCancelProps = ComponentPropsWithRef<typeof Cancel> &
7
+ ButtonProps<'button'>;
8
+
9
+ export function AlertDialogCancel({
10
+ className,
11
+ children,
12
+ ...props
13
+ }: AlertDialogCancelProps) {
14
+ return (
15
+ <Cancel asChild {...props}>
16
+ <Button>{children}</Button>
17
+ </Cancel>
18
+ );
19
+ }
@@ -0,0 +1,78 @@
1
+ import { keyframes } from '@vanilla-extract/css';
2
+ import { recipe } from '@vanilla-extract/recipes';
3
+
4
+ import { sys } from '../../styles';
5
+ import { components } from '../../styles/layers.css';
6
+
7
+ const enterAnimation = keyframes({
8
+ '0%': {
9
+ opacity: 0,
10
+ transform: 'translate(-50%, -50%) scale(0.95)',
11
+ },
12
+ '100%': {
13
+ opacity: 1,
14
+ transform: 'translate(-50%, -50%) scale(1)',
15
+ },
16
+ });
17
+
18
+ const exitAnimation = keyframes({
19
+ '0%': {
20
+ opacity: 1,
21
+ transform: 'translate(-50%, -50%) scale(1)',
22
+ },
23
+ '100%': {
24
+ opacity: 0,
25
+ transform: 'translate(-50%, -50%) scale(0.95)',
26
+ },
27
+ });
28
+
29
+ export const alertDialogContent = recipe({
30
+ base: {
31
+ '@layer': {
32
+ [components]: {
33
+ zIndex: 50,
34
+ width: '100%',
35
+
36
+ position: 'fixed',
37
+ left: '50%',
38
+ top: '50%',
39
+
40
+ transform: 'translate(-50%, -50%)',
41
+ animationDuration: sys.motion.duration.medium[1],
42
+ animationTimingFunction: sys.motion.easing.standard,
43
+
44
+ selectors: {
45
+ '&[data-state="open"]': {
46
+ animationName: enterAnimation,
47
+ },
48
+ '&[data-state="closed"]': {
49
+ animationName: exitAnimation,
50
+ },
51
+ },
52
+ },
53
+ },
54
+ },
55
+
56
+ variants: {
57
+ variant: {
58
+ dialog: {
59
+ '@layer': {
60
+ [components]: {
61
+ maxWidth: '30rem',
62
+ },
63
+ },
64
+ },
65
+ modal: {
66
+ '@layer': {
67
+ [components]: {
68
+ maxInlineSize: 'max-content',
69
+ },
70
+ },
71
+ },
72
+ },
73
+ },
74
+
75
+ defaultVariants: {
76
+ variant: 'dialog',
77
+ },
78
+ });
@@ -0,0 +1,47 @@
1
+ import { AlertDialogPortal, Content } from '@radix-ui/react-alert-dialog';
2
+ import { RecipeVariants } from '@vanilla-extract/recipes';
3
+ import { clsx } from 'clsx';
4
+ import { ComponentPropsWithoutRef } from 'react';
5
+
6
+ import { Box, BoxProps } from '../box';
7
+ import { ScrollArea, ScrollAreaProps } from '../scroll-area';
8
+
9
+ import { alertDialogContent } from './alert-dialog-content.css';
10
+ import { AlertDialogOverlay } from './alert-dialog-overlay';
11
+
12
+ export type AlertDialogContentVariants = NonNullable<
13
+ RecipeVariants<typeof alertDialogContent>
14
+ >;
15
+
16
+ export type AlertDialogContentProps = ComponentPropsWithoutRef<typeof Content> &
17
+ AlertDialogContentVariants &
18
+ Pick<ScrollAreaProps, 'maxHeight'> &
19
+ ComponentPropsWithoutRef<typeof AlertDialogPortal> &
20
+ BoxProps<'div'>;
21
+
22
+ export function AlertDialogContent({
23
+ className,
24
+ children,
25
+ container,
26
+ forceMount,
27
+ variant,
28
+ maxHeight = '50vh',
29
+ elevation = 'high',
30
+ radius,
31
+ ...props
32
+ }: AlertDialogContentProps) {
33
+ return (
34
+ <AlertDialogPortal container={container} forceMount={forceMount}>
35
+ <AlertDialogOverlay />
36
+ <Content
37
+ className={clsx(alertDialogContent({ variant }), className)}
38
+ asChild
39
+ {...props}
40
+ >
41
+ <Box spacing={2} variant="solid" elevation={elevation} radius={radius}>
42
+ <ScrollArea maxHeight={maxHeight}>{children}</ScrollArea>
43
+ </Box>
44
+ </Content>
45
+ </AlertDialogPortal>
46
+ );
47
+ }
@@ -0,0 +1,24 @@
1
+ import { Description } from '@radix-ui/react-alert-dialog';
2
+ import { ComponentPropsWithRef } from 'react';
3
+
4
+ import { Heading, HeadingSubtitleProps } from '../heading';
5
+
6
+ export type AlertDialogDescriptionProps = ComponentPropsWithRef<
7
+ typeof Description
8
+ > &
9
+ HeadingSubtitleProps;
10
+
11
+ export function AlertDialogDescription({
12
+ children,
13
+ variant = 'body',
14
+ size = 'medium',
15
+ ...props
16
+ }: AlertDialogDescriptionProps) {
17
+ return (
18
+ <Description asChild {...props}>
19
+ <Heading.Subtitle variant={variant} size={size}>
20
+ {children}
21
+ </Heading.Subtitle>
22
+ </Description>
23
+ );
24
+ }
@@ -0,0 +1,34 @@
1
+ import { calc } from '@vanilla-extract/css-utils';
2
+ import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
+
4
+ import { sys } from '../../styles';
5
+ import { components } from '../../styles/layers.css';
6
+
7
+ export const alertDialogFooter = recipe({
8
+ variants: {
9
+ position: {
10
+ sticky: {
11
+ '@layer': {
12
+ [components]: {
13
+ '::before': {
14
+ content: '""',
15
+
16
+ display: 'block',
17
+ width: '100%',
18
+ height: sys.spacing[2],
19
+
20
+ position: 'absolute',
21
+ insetBlockStart: calc.negate(sys.spacing[2]),
22
+
23
+ backgroundImage: `linear-gradient(to bottom, transparent, ${sys.color.background})`,
24
+ },
25
+ },
26
+ },
27
+ },
28
+ },
29
+ },
30
+ });
31
+
32
+ export type AlertDialogFooterVariants = NonNullable<
33
+ RecipeVariants<typeof alertDialogFooter>
34
+ >;
@@ -0,0 +1,26 @@
1
+ import { clsx } from 'clsx';
2
+
3
+ import { Cluster, ClusterProps } from '../cluster';
4
+
5
+ import {
6
+ alertDialogFooter,
7
+ AlertDialogFooterVariants,
8
+ } from './alert-dialog-footer.css';
9
+
10
+ export type AlertDialogFooterProps = ClusterProps<'div'> &
11
+ AlertDialogFooterVariants;
12
+
13
+ export function AlertDialogFooter({
14
+ className,
15
+ justify = 'end',
16
+ position,
17
+ ...props
18
+ }: AlertDialogFooterProps) {
19
+ return (
20
+ <Cluster
21
+ justify={justify}
22
+ className={clsx(alertDialogFooter({ position }), className)}
23
+ {...props}
24
+ />
25
+ );
26
+ }
@@ -0,0 +1,11 @@
1
+ import { Stack, StackProps } from '../stack';
2
+
3
+ export type AlertDialogHeaderProps = StackProps<'div'>;
4
+
5
+ export const AlertDialogHeader = ({
6
+ className,
7
+ spacing = 2,
8
+ ...props
9
+ }: AlertDialogHeaderProps) => {
10
+ return <Stack spacing={spacing} {...props} />;
11
+ };
@@ -0,0 +1,15 @@
1
+ import { Overlay } from '@radix-ui/react-alert-dialog';
2
+ import { clsx } from 'clsx';
3
+ import { ComponentPropsWithRef } from 'react';
4
+
5
+ import { overlay } from '../overlay';
6
+
7
+ export type AlertDialogOverlayProps = ComponentPropsWithRef<typeof Overlay>;
8
+
9
+ export function AlertDialogOverlay({
10
+ className,
11
+ children,
12
+ ...props
13
+ }: AlertDialogOverlayProps) {
14
+ return <Overlay className={clsx(overlay, className)} {...props} />;
15
+ }
@@ -0,0 +1,3 @@
1
+ import { Portal } from '@radix-ui/react-alert-dialog';
2
+
3
+ export const AlertDialogPortal = Portal;
@@ -0,0 +1,24 @@
1
+ import { Title } from '@radix-ui/react-alert-dialog';
2
+ import { ComponentPropsWithRef } from 'react';
3
+
4
+ import { Heading, HeadingProps } from '../heading';
5
+
6
+ export type AlertDialogTitleProps = ComponentPropsWithRef<typeof Title> &
7
+ Omit<HeadingProps, 'variant'> & {
8
+ variant?: HeadingProps['variant'];
9
+ };
10
+
11
+ export function AlertDialogTitle({
12
+ children,
13
+ variant = 'headline',
14
+ size = 'small',
15
+ ...props
16
+ }: AlertDialogTitleProps) {
17
+ return (
18
+ <Title asChild>
19
+ <Heading use="h2" variant={variant} size={size} {...props}>
20
+ {children}
21
+ </Heading>
22
+ </Title>
23
+ );
24
+ }
@@ -0,0 +1,3 @@
1
+ import { Trigger } from '@radix-ui/react-alert-dialog';
2
+
3
+ export const AlertDialogTrigger = Trigger;
@@ -0,0 +1,5 @@
1
+ 'use client';
2
+
3
+ import { Root } from '@radix-ui/react-alert-dialog';
4
+
5
+ export const AlertDialog = Root;
@@ -0,0 +1,11 @@
1
+ export { AlertDialog } from './alert-dialog';
2
+ export { AlertDialogAction } from './alert-dialog-action';
3
+ export { AlertDialogContent } from './alert-dialog-content';
4
+ export { AlertDialogDescription } from './alert-dialog-description';
5
+ export { AlertDialogHeader } from './alert-dialog-header';
6
+ export { AlertDialogTitle } from './alert-dialog-title';
7
+ export { AlertDialogCancel } from './alert-dialog-cancel';
8
+ export { AlertDialogOverlay } from './alert-dialog-overlay';
9
+ export { AlertDialogFooter } from './alert-dialog-footer';
10
+ export { AlertDialogPortal } from './alert-dialog-portal';
11
+ export { AlertDialogTrigger } from './alert-dialog-trigger';
@@ -1,8 +1,11 @@
1
+ import { createVar } from '@vanilla-extract/css';
1
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
2
3
 
3
4
  import { mapContractVars, sys } from '../../styles';
4
5
  import { components } from '../../styles/layers.css';
5
6
 
7
+ export const gutterSize = createVar();
8
+
6
9
  export const centerRecipe = recipe({
7
10
  base: {
8
11
  '@layer': {
@@ -11,6 +14,7 @@ export const centerRecipe = recipe({
11
14
  boxSizing: 'content-box',
12
15
  marginInline: 'auto',
13
16
  maxInlineSize: sys.layout.measure,
17
+ paddingInline: gutterSize,
14
18
  },
15
19
  },
16
20
  },
@@ -50,7 +54,9 @@ export const centerRecipe = recipe({
50
54
  gutters: mapContractVars(sys.spacing, (key) => ({
51
55
  '@layer': {
52
56
  [components]: {
53
- paddingInline: sys.spacing[key],
57
+ vars: {
58
+ [gutterSize]: sys.spacing[key],
59
+ },
54
60
  },
55
61
  },
56
62
  })),
@@ -1,2 +1,2 @@
1
1
  export { Center, type CenterProps } from './center';
2
- export { centerRecipe, type CenterVariants } from './center.css';
2
+ export { centerRecipe, gutterSize, type CenterVariants } from './center.css';
@@ -5,8 +5,12 @@ import { components } from '../../styles/layers.css';
5
5
 
6
6
  export const headingRoot = recipe({
7
7
  base: {
8
- display: 'flex',
9
- flexDirection: 'column',
8
+ '@layer': {
9
+ [components]: {
10
+ display: 'flex',
11
+ flexDirection: 'column',
12
+ },
13
+ },
10
14
  },
11
15
 
12
16
  variants: {
@@ -98,7 +98,7 @@ export function Heading<TUse extends HeadingTypes>({
98
98
  );
99
99
  }
100
100
 
101
- type HeadingPretitleProps = Omit<TextProps<'p'>, 'children'> & {
101
+ export type HeadingPretitleProps = Omit<TextProps<'p'>, 'children'> & {
102
102
  children?: string | null;
103
103
  };
104
104
 
@@ -117,7 +117,7 @@ Heading.Pretitle = function HeadingPretitle({
117
117
  );
118
118
  };
119
119
 
120
- type HeadingSubtitleProps = Omit<TextProps<'p'>, 'children'> & {
120
+ export type HeadingSubtitleProps = Omit<TextProps<'p'>, 'children'> & {
121
121
  children?: string | null;
122
122
  };
123
123
 
@@ -1,2 +1,8 @@
1
- export { Heading, type HeadingTypes, type HeadingProps } from './heading';
1
+ export {
2
+ Heading,
3
+ type HeadingTypes,
4
+ type HeadingProps,
5
+ type HeadingSubtitleProps,
6
+ type HeadingPretitleProps,
7
+ } from './heading';
2
8
  export { headingRoot, type HeadingRootVariants } from './heading.css';
@@ -0,0 +1 @@
1
+ export { overlay } from './overlay.css';
@@ -0,0 +1,48 @@
1
+ import { keyframes, style } from '@vanilla-extract/css';
2
+
3
+ import { sys } from '../../styles';
4
+ import { components } from '../../styles/layers.css';
5
+
6
+ const enterAnimation = keyframes({
7
+ '0%': {
8
+ opacity: 0,
9
+ },
10
+ '100%': {
11
+ opacity: 1,
12
+ },
13
+ });
14
+
15
+ const exitAnimation = keyframes({
16
+ '0%': {
17
+ opacity: 1,
18
+ },
19
+ '100%': {
20
+ opacity: 0,
21
+ },
22
+ });
23
+
24
+ export const overlay = style({
25
+ '@layer': {
26
+ [components]: {
27
+ zIndex: 50,
28
+
29
+ position: 'fixed',
30
+ inset: 0,
31
+
32
+ backgroundColor: `color(from ${sys.color.background} srgb r g b / 0.5)`,
33
+
34
+ animationDuration: sys.motion.duration.medium[2],
35
+ animationTimingFunction: sys.motion.easing.standard,
36
+ backdropFilter: 'blur(4px)',
37
+
38
+ selectors: {
39
+ '&[data-state="open"]': {
40
+ animationName: enterAnimation,
41
+ },
42
+ '&[data-state="closed"]': {
43
+ animationName: exitAnimation,
44
+ },
45
+ },
46
+ },
47
+ },
48
+ });
@@ -1 +1 @@
1
- export { ScrollArea } from './scroll-area';
1
+ export { ScrollArea, type ScrollAreaProps } from './scroll-area';
@@ -2,69 +2,94 @@ import { createVar, style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
4
  import { sys, transition } from '../../styles';
5
+ import { components } from '../../styles/layers.css';
5
6
 
6
7
  export const viewportMaxHeight = createVar();
7
8
 
8
9
  export const scrollArea = style({
9
- overflow: 'hidden',
10
- height: '100%',
10
+ '@layer': {
11
+ [components]: {
12
+ overflow: 'hidden',
13
+ height: '100%',
11
14
 
12
- position: 'relative',
15
+ position: 'relative',
16
+ },
17
+ },
13
18
  });
14
19
 
15
20
  export const scrollAreaViewport = style({
16
- height: '100%',
17
- maxHeight: viewportMaxHeight,
18
- width: '100%',
21
+ '@layer': {
22
+ [components]: {
23
+ height: '100%',
24
+ maxHeight: viewportMaxHeight,
25
+ width: '100%',
19
26
 
20
- borderRadius: 'inherit',
27
+ borderRadius: 'inherit',
21
28
 
22
- vars: {
23
- [viewportMaxHeight]: 'initial',
29
+ vars: {
30
+ [viewportMaxHeight]: 'initial',
31
+ },
32
+ },
24
33
  },
25
34
  });
26
35
 
27
36
  export const scrollAreaScrollbar = recipe({
28
37
  base: {
29
- display: 'flex',
38
+ '@layer': {
39
+ [components]: {
40
+ display: 'flex',
30
41
 
31
- padding: 1,
42
+ padding: 1,
32
43
 
33
- transition: transition(['color', 'background-color', 'border-color'], {
34
- duration: 'medium.2',
35
- }),
36
- userSelect: 'none',
44
+ transition: transition(['color', 'background-color', 'border-color'], {
45
+ duration: 'medium.2',
46
+ }),
47
+ userSelect: 'none',
48
+ },
49
+ },
37
50
  },
38
51
 
39
52
  variants: {
40
53
  orientation: {
41
54
  vertical: {
42
- height: '100%',
43
- width: 10,
44
-
45
- borderInlineStartWidth: 1,
46
- borderInlineStartColor: 'transparent',
55
+ '@layer': {
56
+ [components]: {
57
+ height: '100%',
58
+ width: 10,
59
+
60
+ borderInlineStartWidth: 1,
61
+ borderInlineStartColor: 'transparent',
62
+ },
63
+ },
47
64
  },
48
65
 
49
66
  horizontal: {
50
- height: 10,
51
- width: '100%',
52
-
53
- borderBlockStartWidth: 1,
54
- borderBlockStartColor: 'transparent',
67
+ '@layer': {
68
+ [components]: {
69
+ height: 10,
70
+ width: '100%',
71
+
72
+ borderBlockStartWidth: 1,
73
+ borderBlockStartColor: 'transparent',
74
+ },
75
+ },
55
76
  },
56
77
  },
57
78
  },
58
79
  });
59
80
 
60
81
  export const scrollAreaThumb = style({
61
- flexGrow: 1,
82
+ '@layer': {
83
+ [components]: {
84
+ flexGrow: 1,
62
85
 
63
- position: 'relative',
86
+ position: 'relative',
64
87
 
65
- borderRadius: sys.shape.corner.small,
88
+ borderRadius: sys.shape.corner.small,
66
89
 
67
- backgroundColor: sys.color.foreground,
90
+ backgroundColor: sys.color.foreground,
91
+ },
92
+ },
68
93
  });
69
94
 
70
95
  export type ScrollAreaScrollbarVariants = NonNullable<
@@ -2,6 +2,7 @@ import { createVar, keyframes } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
4
  import { sys } from '../../styles';
5
+ import { components } from '../../styles/layers.css';
5
6
 
6
7
  const from = createVar();
7
8
  const to = createVar();
@@ -29,29 +30,33 @@ const leave = keyframes({
29
30
 
30
31
  export const sheetContent = recipe({
31
32
  base: {
32
- zIndex: 50,
33
- maxWidth: '100vw',
34
- maxHeight: '100vh',
33
+ '@layer': {
34
+ [components]: {
35
+ zIndex: 50,
36
+ maxWidth: '100vw',
37
+ maxHeight: '100vh',
35
38
 
36
- position: 'fixed',
39
+ position: 'fixed',
37
40
 
38
- boxShadow: sys.elevation.high,
41
+ boxShadow: sys.elevation.high,
39
42
 
40
- animationDuration: sys.motion.duration.medium[2],
41
- animationTimingFunction: sys.motion.easing.standard,
42
- animationFillMode: 'both',
43
+ animationDuration: sys.motion.duration.medium[2],
44
+ animationTimingFunction: sys.motion.easing.standard,
45
+ animationFillMode: 'both',
43
46
 
44
- selectors: {
45
- '&[data-state="open"]': {
46
- animationName: enter,
47
+ selectors: {
48
+ '&[data-state="open"]': {
49
+ animationName: enter,
47
50
 
48
- pointerEvents: 'auto',
49
- },
51
+ pointerEvents: 'auto',
52
+ },
50
53
 
51
- '&[data-state="closed"]': {
52
- animationName: leave,
54
+ '&[data-state="closed"]': {
55
+ animationName: leave,
53
56
 
54
- pointerEvents: 'none',
57
+ pointerEvents: 'none',
58
+ },
59
+ },
55
60
  },
56
61
  },
57
62
  },
@@ -59,74 +64,106 @@ export const sheetContent = recipe({
59
64
  variants: {
60
65
  side: {
61
66
  top: {
62
- height: size,
63
- width: '100vw',
64
-
65
- insetBlockStart: 0,
66
- insetInline: 0,
67
-
68
- vars: {
69
- [from]: 'translateY(-100%)',
70
- [to]: 'translateY(0)',
67
+ '@layer': {
68
+ [components]: {
69
+ height: size,
70
+ width: '100vw',
71
+
72
+ insetBlockStart: 0,
73
+ insetInline: 0,
74
+
75
+ vars: {
76
+ [from]: 'translateY(-100%)',
77
+ [to]: 'translateY(0)',
78
+ },
79
+ },
71
80
  },
72
81
  },
73
82
  right: {
74
- height: '100vh',
75
- width: size,
76
-
77
- insetBlock: 0,
78
- insetInlineEnd: 0,
79
-
80
- vars: {
81
- [from]: 'translateX(100%)',
82
- [to]: 'translateX(0)',
83
+ '@layer': {
84
+ [components]: {
85
+ height: '100vh',
86
+ width: size,
87
+
88
+ insetBlock: 0,
89
+ insetInlineEnd: 0,
90
+
91
+ vars: {
92
+ [from]: 'translateX(100%)',
93
+ [to]: 'translateX(0)',
94
+ },
95
+ },
83
96
  },
84
97
  },
85
98
  bottom: {
86
- height: size,
87
- width: '100vw',
88
-
89
- insetBlockEnd: 0,
90
- insetInline: 0,
91
-
92
- vars: {
93
- [from]: 'translateY(100%)',
94
- [to]: 'translateY(0)',
99
+ '@layer': {
100
+ [components]: {
101
+ height: size,
102
+ width: '100vw',
103
+
104
+ insetBlockEnd: 0,
105
+ insetInline: 0,
106
+
107
+ vars: {
108
+ [from]: 'translateY(100%)',
109
+ [to]: 'translateY(0)',
110
+ },
111
+ },
95
112
  },
96
113
  },
97
114
  left: {
98
- height: '100vh',
99
- width: size,
100
-
101
- insetBlock: 0,
102
- insetInlineStart: 0,
103
-
104
- vars: {
105
- [from]: 'translateX(-100%)',
106
- [to]: 'translateX(0)',
115
+ '@layer': {
116
+ [components]: {
117
+ height: '100vh',
118
+ width: size,
119
+
120
+ insetBlock: 0,
121
+ insetInlineStart: 0,
122
+
123
+ vars: {
124
+ [from]: 'translateX(-100%)',
125
+ [to]: 'translateX(0)',
126
+ },
127
+ },
107
128
  },
108
129
  },
109
130
  },
110
131
 
111
132
  size: {
112
133
  sm: {
113
- vars: {
114
- [size]: '300px',
134
+ '@layer': {
135
+ [components]: {
136
+ vars: {
137
+ [size]: '300px',
138
+ },
139
+ },
115
140
  },
116
141
  },
117
142
  base: {
118
- vars: {
119
- [size]: '400px',
143
+ '@layer': {
144
+ [components]: {
145
+ vars: {
146
+ [size]: '400px',
147
+ },
148
+ },
120
149
  },
121
150
  },
122
151
  md: {
123
- vars: {
124
- [size]: '500px',
152
+ '@layer': {
153
+ [components]: {
154
+ vars: {
155
+ [size]: '500px',
156
+ },
157
+ },
125
158
  },
126
159
  },
127
160
  lg: {
128
- vars: {
129
- [size]: '600px',
161
+ '@layer': {
162
+ [components]: {
163
+ vars: {
164
+ [size]: '600px',
165
+ },
166
+ },
130
167
  },
131
168
  },
132
169
  },
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Content, Portal } from '@radix-ui/react-dialog';
4
4
  import { clsx } from 'clsx';
5
- import { ComponentPropsWithoutRef, ElementType } from 'react';
5
+ import { ComponentPropsWithRef, ElementType } from 'react';
6
6
 
7
7
  import { Box, BoxProps } from '../box';
8
8
  import { ScrollArea } from '../scroll-area';
@@ -12,7 +12,7 @@ import { sheetContent, SheetContentVariants } from './sheet-content.css';
12
12
  import { SheetOverlay } from './sheet-overlay';
13
13
 
14
14
  export type SheetContentProps<TUse extends ElementType> = BoxProps<TUse> &
15
- ComponentPropsWithoutRef<typeof Portal> &
15
+ ComponentPropsWithRef<typeof Portal> &
16
16
  SheetContentVariants;
17
17
 
18
18
  export function SheetContent<TUse extends ElementType>({
@@ -2,29 +2,50 @@ import { style } from '@vanilla-extract/css';
2
2
  import { recipe } from '@vanilla-extract/recipes';
3
3
 
4
4
  import { sys } from '../../styles';
5
+ import { components } from '../../styles/layers.css';
5
6
 
6
7
  export const sheetHeader = recipe({
7
8
  base: {
8
- display: 'flex',
9
- alignItems: 'flex-start',
10
- justifyContent: 'space-between',
11
- flexWrap: 'nowrap',
12
- gap: sys.spacing[4],
9
+ '@layer': {
10
+ [components]: {
11
+ display: 'flex',
12
+ alignItems: 'flex-start',
13
+ justifyContent: 'space-between',
14
+ flexWrap: 'nowrap',
15
+ gap: sys.spacing[4],
16
+ },
17
+ },
13
18
  },
14
19
 
15
20
  variants: {
16
21
  side: {
17
22
  top: {
18
- flexDirection: 'row',
23
+ '@layer': {
24
+ [components]: {
25
+ flexDirection: 'row',
26
+ },
27
+ },
19
28
  },
20
29
  right: {
21
- flexDirection: 'row-reverse',
30
+ '@layer': {
31
+ [components]: {
32
+ flexDirection: 'row-reverse',
33
+ },
34
+ },
22
35
  },
23
36
  bottom: {
24
- flexDirection: 'row',
37
+ '@layer': {
38
+ [components]: {
39
+ flexDirection: 'row',
40
+ },
41
+ },
25
42
  },
26
43
  left: {
27
- flexDirection: 'row',
44
+ '@layer': {
45
+ [components]: {
46
+ flexDirection: 'row',
47
+ },
48
+ },
28
49
  },
29
50
  },
30
51
  },
@@ -2,13 +2,13 @@
2
2
 
3
3
  import { Overlay } from '@radix-ui/react-dialog';
4
4
  import { clsx } from 'clsx';
5
- import { ComponentPropsWithoutRef } from 'react';
5
+ import { ComponentPropsWithRef } from 'react';
6
6
 
7
- import { sheetOverlay } from './sheet-overlay.css';
7
+ import { overlay } from '../overlay';
8
8
 
9
9
  export function SheetOverlay({
10
10
  className,
11
11
  ...props
12
- }: ComponentPropsWithoutRef<typeof Overlay>) {
13
- return <Overlay className={clsx(sheetOverlay, className)} {...props} />;
12
+ }: ComponentPropsWithRef<typeof Overlay>) {
13
+ return <Overlay className={clsx(overlay, className)} {...props} />;
14
14
  }
@@ -16,13 +16,12 @@ export function SheetTitle<TUse extends HeadingTypes>(
16
16
  const { use = 'h2', className, children, variant, size, ...rest } = props;
17
17
 
18
18
  return (
19
- <Title asChild>
19
+ <Title asChild {...rest}>
20
20
  <Heading
21
21
  use={use as HeadingProps<TUse>['use']}
22
22
  variant={variant}
23
23
  size={size}
24
24
  className={className}
25
- {...rest}
26
25
  >
27
26
  {children}
28
27
  </Heading>
@@ -1,43 +0,0 @@
1
- import { keyframes, style } from '@vanilla-extract/css';
2
-
3
- import { sys } from '../../styles';
4
-
5
- const enterAnimation = keyframes({
6
- '0%': {
7
- opacity: 0,
8
- },
9
- '100%': {
10
- opacity: 1,
11
- },
12
- });
13
-
14
- const exitAnimation = keyframes({
15
- '0%': {
16
- opacity: 1,
17
- },
18
- '100%': {
19
- opacity: 0,
20
- },
21
- });
22
-
23
- export const sheetOverlay = style({
24
- zIndex: 50,
25
-
26
- position: 'fixed',
27
- inset: 0,
28
-
29
- backgroundColor: `color(from ${sys.color.background} srgb r g b / 0.5)`,
30
-
31
- animationDuration: sys.motion.duration.medium[2],
32
- animationTimingFunction: sys.motion.easing.standard,
33
- backdropFilter: 'blur(4px)',
34
-
35
- selectors: {
36
- '&[data-state="open"]': {
37
- animationName: enterAnimation,
38
- },
39
- '&[data-state="closed"]': {
40
- animationName: exitAnimation,
41
- },
42
- },
43
- });