@kalink-ui/seedly 0.22.0 → 0.24.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 +14 -0
- package/package.json +3 -3
- package/src/components/alert-dialog/alert-dialog-content.tsx +7 -1
- package/src/components/button/button.css.ts +11 -7
- package/src/components/button/button.tsx +74 -19
- package/src/components/button/index.ts +19 -2
- package/src/components/heading/heading.css.ts +17 -1
- package/src/components/heading/heading.tsx +22 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @kalink-ui/seedly
|
|
2
2
|
|
|
3
|
+
## 0.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9072db5: [Heading] Allow for different pretitle and subtitle spacing
|
|
8
|
+
|
|
9
|
+
## 0.23.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- e77a3af: [AlertDialog] Correctly pass spacing prop to underlying `Box` component
|
|
14
|
+
- 985fd61: [Button] Reexport all style definitions
|
|
15
|
+
- a150fe7: [Button] Expose inner components to enhance composability
|
|
16
|
+
|
|
3
17
|
## 0.22.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalink-ui/seedly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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/
|
|
48
|
-
"@kalink-ui/
|
|
47
|
+
"@kalink-ui/typescript-config": "0.4.0",
|
|
48
|
+
"@kalink-ui/eslint-config": "0.9.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@vanilla-extract/css": "^1.17.1",
|
|
@@ -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
|
|
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 =
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
export const buttonSlotStart = style([buttonSlot]);
|
|
361
|
+
export const buttonSlot = recipe({
|
|
362
|
+
base: {
|
|
363
|
+
flexShrink: 0,
|
|
364
|
+
},
|
|
367
365
|
|
|
368
|
-
|
|
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
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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 {
|
|
2
|
-
|
|
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';
|
|
@@ -40,11 +40,27 @@ export const headingRoot = recipe({
|
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
43
45
|
|
|
46
|
+
export const pretitle = recipe({
|
|
47
|
+
variants: {
|
|
48
|
+
spacing: mapContractVars(sys.spacing, (key) => ({
|
|
49
|
+
'@layer': {
|
|
50
|
+
[components]: {
|
|
51
|
+
marginBlockEnd: sys.spacing[key],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
})),
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const subtitle = recipe({
|
|
59
|
+
variants: {
|
|
44
60
|
spacing: mapContractVars(sys.spacing, (key) => ({
|
|
45
61
|
'@layer': {
|
|
46
62
|
[components]: {
|
|
47
|
-
|
|
63
|
+
marginBlockStart: sys.spacing[key],
|
|
48
64
|
},
|
|
49
65
|
},
|
|
50
66
|
})),
|
|
@@ -5,7 +5,7 @@ import { Spacing, TypographySize, TypographyVariant } from '../../styles';
|
|
|
5
5
|
import { ConditionalWrapper } from '../conditional-wrapper';
|
|
6
6
|
import { Text, TextProps } from '../text';
|
|
7
7
|
|
|
8
|
-
import { headingRoot } from './heading.css';
|
|
8
|
+
import { headingRoot, pretitle, subtitle } from './heading.css';
|
|
9
9
|
|
|
10
10
|
export type HeadingTypes = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
11
11
|
|
|
@@ -32,11 +32,6 @@ export type HeadingProps<TUse extends ElementType = 'h2'> = Omit<
|
|
|
32
32
|
*/
|
|
33
33
|
subtitle?: ReactElement<TextProps<'p'>>;
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* The spacing between the title and the pretitle or subtitle.
|
|
37
|
-
*/
|
|
38
|
-
spacing?: Spacing;
|
|
39
|
-
|
|
40
35
|
/**
|
|
41
36
|
* The text to render.
|
|
42
37
|
*/
|
|
@@ -66,7 +61,6 @@ export function Heading<TUse extends HeadingTypes>({
|
|
|
66
61
|
size,
|
|
67
62
|
variant,
|
|
68
63
|
align,
|
|
69
|
-
spacing,
|
|
70
64
|
pretitle,
|
|
71
65
|
subtitle,
|
|
72
66
|
rootClassName,
|
|
@@ -78,7 +72,7 @@ export function Heading<TUse extends HeadingTypes>({
|
|
|
78
72
|
ref={ref}
|
|
79
73
|
use={'hgroup'}
|
|
80
74
|
condition={!!pretitle || !!subtitle}
|
|
81
|
-
className={clsx(headingRoot({ align
|
|
75
|
+
className={clsx(headingRoot({ align }), rootClassName)}
|
|
82
76
|
>
|
|
83
77
|
{pretitle}
|
|
84
78
|
|
|
@@ -100,17 +94,26 @@ export function Heading<TUse extends HeadingTypes>({
|
|
|
100
94
|
|
|
101
95
|
export type HeadingPretitleProps = Omit<TextProps<'p'>, 'children'> & {
|
|
102
96
|
children?: string | null;
|
|
97
|
+
spacing?: Spacing;
|
|
103
98
|
};
|
|
104
99
|
|
|
105
100
|
Heading.Pretitle = function HeadingPretitle({
|
|
106
101
|
variant = 'title',
|
|
107
102
|
size = 'medium',
|
|
103
|
+
spacing,
|
|
108
104
|
children,
|
|
105
|
+
className,
|
|
109
106
|
...rest
|
|
110
107
|
}: HeadingPretitleProps) {
|
|
111
108
|
return (
|
|
112
109
|
children && (
|
|
113
|
-
<Text
|
|
110
|
+
<Text
|
|
111
|
+
use="p"
|
|
112
|
+
variant={variant}
|
|
113
|
+
size={size}
|
|
114
|
+
className={clsx(pretitle({ spacing }), className)}
|
|
115
|
+
{...rest}
|
|
116
|
+
>
|
|
114
117
|
{children}
|
|
115
118
|
</Text>
|
|
116
119
|
)
|
|
@@ -119,17 +122,26 @@ Heading.Pretitle = function HeadingPretitle({
|
|
|
119
122
|
|
|
120
123
|
export type HeadingSubtitleProps = Omit<TextProps<'p'>, 'children'> & {
|
|
121
124
|
children?: string | null;
|
|
125
|
+
spacing?: Spacing;
|
|
122
126
|
};
|
|
123
127
|
|
|
124
128
|
Heading.Subtitle = function HeadingSubtitle({
|
|
125
129
|
variant = 'title',
|
|
126
130
|
size = 'medium',
|
|
131
|
+
spacing,
|
|
127
132
|
children,
|
|
133
|
+
className,
|
|
128
134
|
...rest
|
|
129
135
|
}: HeadingSubtitleProps) {
|
|
130
136
|
return (
|
|
131
137
|
children && (
|
|
132
|
-
<Text
|
|
138
|
+
<Text
|
|
139
|
+
use="p"
|
|
140
|
+
variant={variant}
|
|
141
|
+
size={size}
|
|
142
|
+
className={clsx(subtitle({ spacing }), className)}
|
|
143
|
+
{...rest}
|
|
144
|
+
>
|
|
133
145
|
{children}
|
|
134
146
|
</Text>
|
|
135
147
|
)
|