@kalink-ui/seedly 0.22.0 → 0.23.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @kalink-ui/seedly
2
2
 
3
+ ## 0.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e77a3af: [AlertDialog] Correctly pass spacing prop to underlying `Box` component
8
+ - 985fd61: [Button] Reexport all style definitions
9
+ - a150fe7: [Button] Expose inner components to enhance composability
10
+
3
11
  ## 0.22.0
4
12
 
5
13
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalink-ui/seedly",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "A set of components for building UIs with React and TypeScript",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -28,6 +28,7 @@ export function AlertDialogContent({
28
28
  maxHeight = '50vh',
29
29
  elevation = 'high',
30
30
  radius,
31
+ spacing = 2,
31
32
  ...props
32
33
  }: AlertDialogContentProps) {
33
34
  return (
@@ -38,7 +39,12 @@ export function AlertDialogContent({
38
39
  asChild
39
40
  {...props}
40
41
  >
41
- <Box spacing={2} variant="solid" elevation={elevation} radius={radius}>
42
+ <Box
43
+ variant="solid"
44
+ spacing={spacing}
45
+ elevation={elevation}
46
+ radius={radius}
47
+ >
42
48
  <ScrollArea maxHeight={maxHeight}>{children}</ScrollArea>
43
49
  </Box>
44
50
  </Content>
@@ -3,7 +3,6 @@ import {
3
3
  createThemeContract,
4
4
  fallbackVar,
5
5
  globalStyle,
6
- style,
7
6
  } from '@vanilla-extract/css';
8
7
  import { calc } from '@vanilla-extract/css-utils';
9
8
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
@@ -359,13 +358,18 @@ export const buttonLabel = recipe({
359
358
  },
360
359
  });
361
360
 
362
- const buttonSlot = style({
363
- flexShrink: 0,
364
- });
365
-
366
- export const buttonSlotStart = style([buttonSlot]);
361
+ export const buttonSlot = recipe({
362
+ base: {
363
+ flexShrink: 0,
364
+ },
367
365
 
368
- export const buttonSlotEnd = style([buttonSlot]);
366
+ variants: {
367
+ position: {
368
+ start: {},
369
+ end: {},
370
+ },
371
+ },
372
+ });
369
373
 
370
374
  globalStyle(`${buttonRecipe.classNames.variants.size.sm} svg`, {
371
375
  '@layer': {
@@ -1,12 +1,11 @@
1
1
  import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
2
2
  import { clsx } from 'clsx';
3
- import { ComponentType, ReactNode } from 'react';
3
+ import { ComponentType, ElementType, ReactNode } from 'react';
4
4
 
5
5
  import {
6
6
  buttonLabel,
7
7
  buttonRecipe,
8
- buttonSlotEnd,
9
- buttonSlotStart,
8
+ buttonSlot,
10
9
  ButtonVariants,
11
10
  } from './button.css';
12
11
 
@@ -22,28 +21,84 @@ export type ButtonProps<TUse extends ButtonTypes> =
22
21
  };
23
22
 
24
23
  export function Button<TUse extends ButtonTypes>(props: ButtonProps<TUse>) {
25
- const {
26
- use: Comp = 'button',
27
- className,
28
- variant,
29
- children,
30
- startSlot,
31
- endSlot,
32
- size = 'md',
33
- ...rest
34
- } = props;
24
+ const { children, startSlot, endSlot, size = 'md', ...rest } = props;
25
+
26
+ return (
27
+ <ButtonRoot {...rest} size={size}>
28
+ {startSlot && (
29
+ <ButtonSlot use="span" position="start">
30
+ {startSlot}
31
+ </ButtonSlot>
32
+ )}
33
+ {children && (
34
+ <ButtonLabel use="span" size={size}>
35
+ {children}
36
+ </ButtonLabel>
37
+ )}
38
+ {endSlot && (
39
+ <ButtonSlot use="span" position="end">
40
+ {endSlot}
41
+ </ButtonSlot>
42
+ )}
43
+ </ButtonRoot>
44
+ );
45
+ }
46
+
47
+ export type ButtonRootProps<TUse extends ButtonTypes> =
48
+ PolymorphicComponentProps<TUse> & ButtonVariants;
49
+
50
+ export function ButtonRoot<TUse extends ButtonTypes>(
51
+ props: ButtonRootProps<TUse>,
52
+ ) {
53
+ const { use: Comp = 'button', className, variant, size, ...rest } = props;
35
54
 
36
55
  return (
37
56
  <Comp
38
57
  className={clsx(buttonRecipe({ variant, size }), className)}
39
58
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
40
59
  {...(rest as any)}
41
- >
42
- {startSlot && <span className={clsx(buttonSlotStart)}>{startSlot}</span>}
43
- {children && (
44
- <span className={clsx(buttonLabel({ size }))}>{children}</span>
45
- )}
46
- {endSlot && <span className={clsx(buttonSlotEnd)}>{endSlot}</span>}
60
+ />
61
+ );
62
+ }
63
+
64
+ export type ButtonLabelProps<TUse extends ElementType> =
65
+ PolymorphicComponentProps<TUse> & {
66
+ children?: ReactNode;
67
+ size?: ButtonVariants['size'];
68
+ };
69
+
70
+ export function ButtonLabel<TUse extends ElementType>(
71
+ props: ButtonLabelProps<TUse>,
72
+ ) {
73
+ const { use: Comp = 'span', children, className, size, ...rest } = props;
74
+
75
+ return (
76
+ <Comp className={clsx(buttonLabel({ size }), className)} {...rest}>
77
+ {children}
78
+ </Comp>
79
+ );
80
+ }
81
+
82
+ export type ButtonSlotProps<TUse extends ElementType> =
83
+ PolymorphicComponentProps<TUse> & {
84
+ children?: ReactNode;
85
+ position?: 'start' | 'end';
86
+ };
87
+
88
+ export function ButtonSlot<TUse extends ElementType>(
89
+ props: ButtonSlotProps<TUse>,
90
+ ) {
91
+ const {
92
+ use: Comp = 'span',
93
+ children,
94
+ position = 'start',
95
+ className,
96
+ ...rest
97
+ } = props;
98
+
99
+ return (
100
+ <Comp className={clsx(buttonSlot({ position }), className)} {...rest}>
101
+ {children}
47
102
  </Comp>
48
103
  );
49
104
  }
@@ -1,2 +1,19 @@
1
- export { Button, type ButtonProps, type ButtonTypes } from './button';
2
- export { buttonRecipe, type ButtonVariants } from './button.css';
1
+ export {
2
+ Button,
3
+ ButtonRoot,
4
+ ButtonLabel,
5
+ ButtonSlot,
6
+ type ButtonProps,
7
+ type ButtonTypes,
8
+ type ButtonRootProps,
9
+ type ButtonLabelProps,
10
+ type ButtonSlotProps,
11
+ } from './button';
12
+
13
+ export {
14
+ buttonRecipe,
15
+ buttonVars,
16
+ buttonSlot,
17
+ buttonLabel,
18
+ type ButtonVariants,
19
+ } from './button.css';