@kalink-ui/seedly 0.7.0 → 0.8.1
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 +13 -0
- package/build-storybook.log +67 -0
- package/package.json +7 -18
- package/src/components/box/box.css.ts +13 -2
- package/src/components/box/box.tsx +8 -28
- package/src/components/button/button.css.ts +346 -13
- package/src/components/button/button.tsx +37 -22
- package/src/components/center/center.css.ts +10 -2
- package/src/components/center/center.tsx +6 -20
- package/src/components/cluster/cluster.css.ts +10 -2
- package/src/components/cluster/cluster.tsx +6 -21
- package/src/components/conditional-wrapper/conditional-wrapper.tsx +23 -0
- package/src/components/conditional-wrapper/index.ts +1 -0
- package/src/components/cover/cover.css.ts +4 -13
- package/src/components/cover/cover.tsx +12 -22
- package/src/components/frame/frame.css.ts +3 -0
- package/src/components/frame/frame.tsx +6 -10
- package/src/components/grid/grid.css.ts +4 -2
- package/src/components/grid/grid.tsx +11 -15
- package/src/components/heading/heading.css.ts +5 -0
- package/src/components/heading/heading.tsx +83 -0
- package/src/components/heading/index.ts +1 -0
- package/src/components/index.ts +14 -0
- package/src/{styles → components}/seed/seed.tsx +3 -6
- package/src/components/sidebar/sidebar.css.ts +7 -2
- package/src/components/sidebar/sidebar.tsx +6 -21
- package/src/components/stack/stack.css.ts +7 -2
- package/src/components/stack/stack.tsx +6 -15
- package/src/components/switcher/switcher.css.ts +1 -2
- package/src/components/switcher/switcher.tsx +6 -16
- package/src/components/text/index.ts +1 -1
- package/src/components/text/text.css.ts +12 -2
- package/src/components/text/text.tsx +41 -23
- package/src/index.ts +2 -0
- package/src/styles/index.ts +15 -2
- package/src/styles/reset.css.ts +1 -0
- package/src/styles/system-contract.css.ts +45 -31
- package/src/styles/transition.ts +26 -0
- package/src/styles/typography.css.ts +2 -4
- package/src/utils/arg-types/arg-types-from-recipe.ts +36 -0
- package/src/utils/arg-types/arg-types-from-sprinkles.ts +43 -0
- package/src/utils/arg-types/common/composable.ts +13 -0
- package/src/utils/arg-types/common/index.ts +4 -0
- package/src/utils/arg-types/common/polymorphic.ts +14 -0
- package/src/utils/arg-types/common/referable.ts +10 -0
- package/src/utils/arg-types/common/stylable.ts +14 -0
- package/src/utils/arg-types/common-args.ts +26 -0
- package/src/utils/arg-types/index.ts +3 -0
- package/src/utils/index.ts +6 -2
- /package/src/{styles → components}/seed/index.ts +0 -0
- /package/src/{utils → styles}/extract-sprinkles-props.ts +0 -0
- /package/src/{utils → styles}/map-contract-vars.ts +0 -0
|
@@ -1,31 +1,46 @@
|
|
|
1
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
1
2
|
import { clsx } from 'clsx';
|
|
3
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
4
|
|
|
3
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
buttonEndSlot,
|
|
7
|
+
buttonLabel,
|
|
8
|
+
buttonRecipe,
|
|
9
|
+
buttonStartSlot,
|
|
10
|
+
ButtonVariants,
|
|
11
|
+
} from './button.css';
|
|
4
12
|
|
|
5
|
-
|
|
13
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
14
|
+
type ButtonTypes = 'button' | 'a' | ComponentType<any>;
|
|
6
15
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* The main variation of the button
|
|
13
|
-
*/
|
|
14
|
-
variant?: ButtonVariants['variant'];
|
|
16
|
+
type ButtonProps<TUse extends ButtonTypes> = PolymorphicComponentProps<TUse> &
|
|
17
|
+
ButtonVariants & {
|
|
18
|
+
startSlot?: ReactNode;
|
|
19
|
+
endSlot?: ReactNode;
|
|
20
|
+
children?: string;
|
|
15
21
|
};
|
|
16
22
|
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
export function Button<TUse extends ButtonTypes>(props: ButtonProps<TUse>) {
|
|
24
|
+
const {
|
|
25
|
+
use: Comp = 'button',
|
|
26
|
+
className,
|
|
27
|
+
variant,
|
|
28
|
+
children,
|
|
29
|
+
startSlot,
|
|
30
|
+
endSlot,
|
|
31
|
+
size = 'md',
|
|
32
|
+
...rest
|
|
33
|
+
} = props;
|
|
23
34
|
|
|
24
35
|
return (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{...rest}
|
|
29
|
-
|
|
36
|
+
<Comp
|
|
37
|
+
className={clsx(buttonRecipe({ variant, size }), className)}
|
|
38
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
39
|
+
{...(rest as any)}
|
|
40
|
+
>
|
|
41
|
+
{startSlot && <span className={clsx(buttonStartSlot)}>{startSlot}</span>}
|
|
42
|
+
<span className={clsx(buttonLabel({ size }))}>{children}</span>
|
|
43
|
+
{endSlot && <span className={clsx(buttonEndSlot)}>{endSlot}</span>}
|
|
44
|
+
</Comp>
|
|
30
45
|
);
|
|
31
|
-
}
|
|
46
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
2
|
|
|
3
|
+
import { mapContractVars , sys } from '../../styles';
|
|
3
4
|
import { components } from '../../styles/layers.css';
|
|
4
|
-
import { sys } from '../../styles/system-contract.css';
|
|
5
|
-
import { mapContractVars } from '../../utils/map-contract-vars';
|
|
6
5
|
|
|
7
6
|
export const centerRecipe = recipe({
|
|
8
7
|
base: {
|
|
@@ -17,6 +16,9 @@ export const centerRecipe = recipe({
|
|
|
17
16
|
},
|
|
18
17
|
|
|
19
18
|
variants: {
|
|
19
|
+
/**
|
|
20
|
+
* Center align the text too with `text-align: center`
|
|
21
|
+
*/
|
|
20
22
|
andText: {
|
|
21
23
|
true: {
|
|
22
24
|
'@layer': {
|
|
@@ -27,6 +29,9 @@ export const centerRecipe = recipe({
|
|
|
27
29
|
},
|
|
28
30
|
},
|
|
29
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Center child elements based on their content width
|
|
34
|
+
*/
|
|
30
35
|
intrinsic: {
|
|
31
36
|
true: {
|
|
32
37
|
'@layer': {
|
|
@@ -39,6 +44,9 @@ export const centerRecipe = recipe({
|
|
|
39
44
|
},
|
|
40
45
|
},
|
|
41
46
|
|
|
47
|
+
/**
|
|
48
|
+
* The minimum space on either side of the content
|
|
49
|
+
*/
|
|
42
50
|
gutters: mapContractVars(sys.spacing, (key) => ({
|
|
43
51
|
'@layer': {
|
|
44
52
|
[components]: {
|
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
import { PolymorphicComponentProps } from '@kalink-ui/dibbly
|
|
1
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { ElementType } from 'react';
|
|
4
4
|
|
|
5
5
|
import { centerRecipe, CenterVariants } from './center.css';
|
|
6
6
|
|
|
7
|
-
type CenterProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
8
|
-
|
|
9
|
-
* Center align the text too with `text-align: center`
|
|
10
|
-
*/
|
|
11
|
-
andText?: CenterVariants['andText'];
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Center child elements based on their content width
|
|
15
|
-
*/
|
|
16
|
-
intrinsic?: CenterVariants['intrinsic'];
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The minimum space on either side of the content
|
|
20
|
-
*/
|
|
21
|
-
gutters?: CenterVariants['gutters'];
|
|
22
|
-
};
|
|
7
|
+
type CenterProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
8
|
+
CenterVariants;
|
|
23
9
|
|
|
24
10
|
/**
|
|
25
11
|
* A custom element for centering a block-level element horizontally,
|
|
@@ -27,13 +13,13 @@ type CenterProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> & {
|
|
|
27
13
|
*
|
|
28
14
|
* https://every-layout.dev/layouts/center
|
|
29
15
|
*/
|
|
30
|
-
export
|
|
16
|
+
export function Center<TUse extends ElementType>({
|
|
31
17
|
andText,
|
|
32
18
|
gutters,
|
|
33
19
|
intrinsic,
|
|
34
20
|
className,
|
|
35
21
|
...props
|
|
36
|
-
}: CenterProps<TUse>)
|
|
22
|
+
}: CenterProps<TUse>) {
|
|
37
23
|
const { use: Comp = 'div', ...rest } = props;
|
|
38
24
|
|
|
39
25
|
return (
|
|
@@ -42,4 +28,4 @@ export const Center = <TUse extends ElementType>({
|
|
|
42
28
|
{...rest}
|
|
43
29
|
/>
|
|
44
30
|
);
|
|
45
|
-
}
|
|
31
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
2
|
|
|
3
|
+
import { mapContractVars , sys } from '../../styles';
|
|
3
4
|
import { components } from '../../styles/layers.css';
|
|
4
|
-
import { sys } from '../../styles/system-contract.css';
|
|
5
|
-
import { mapContractVars } from '../../utils/map-contract-vars';
|
|
6
5
|
|
|
7
6
|
export const clusterRecipe = recipe({
|
|
8
7
|
base: {
|
|
@@ -17,6 +16,9 @@ export const clusterRecipe = recipe({
|
|
|
17
16
|
},
|
|
18
17
|
|
|
19
18
|
variants: {
|
|
19
|
+
/**
|
|
20
|
+
* The spacing between items
|
|
21
|
+
*/
|
|
20
22
|
spacing: mapContractVars(sys.spacing, (key) => ({
|
|
21
23
|
'@layer': {
|
|
22
24
|
[components]: {
|
|
@@ -25,6 +27,9 @@ export const clusterRecipe = recipe({
|
|
|
25
27
|
},
|
|
26
28
|
})),
|
|
27
29
|
|
|
30
|
+
/**
|
|
31
|
+
* The alignment of items along the main axis
|
|
32
|
+
*/
|
|
28
33
|
justify: {
|
|
29
34
|
start: {
|
|
30
35
|
'@layer': {
|
|
@@ -70,6 +75,9 @@ export const clusterRecipe = recipe({
|
|
|
70
75
|
},
|
|
71
76
|
},
|
|
72
77
|
|
|
78
|
+
/**
|
|
79
|
+
* The alignment of items along the cross axis
|
|
80
|
+
*/
|
|
73
81
|
align: {
|
|
74
82
|
start: {
|
|
75
83
|
'@layer': {
|
|
@@ -1,39 +1,24 @@
|
|
|
1
|
-
import { PolymorphicComponentProps } from '@kalink-ui/dibbly
|
|
1
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { ElementType } from 'react';
|
|
4
4
|
|
|
5
5
|
import { clusterRecipe, ClusterVariants } from './cluster.css';
|
|
6
6
|
|
|
7
|
-
type ClusterProps<TUse extends ElementType> =
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The spacing between items
|
|
11
|
-
*/
|
|
12
|
-
spacing?: ClusterVariants['spacing'];
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The alignment of items along the main axis
|
|
16
|
-
*/
|
|
17
|
-
justify?: ClusterVariants['justify'];
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The alignment of items along the cross axis
|
|
21
|
-
*/
|
|
22
|
-
align?: ClusterVariants['align'];
|
|
23
|
-
};
|
|
7
|
+
type ClusterProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
8
|
+
ClusterVariants;
|
|
24
9
|
|
|
25
10
|
/**
|
|
26
11
|
* A custom element for grouping items, with control over the margin between them
|
|
27
12
|
*
|
|
28
13
|
* https://every-layout.dev/layouts/cluster
|
|
29
14
|
*/
|
|
30
|
-
export
|
|
15
|
+
export function Cluster<TUse extends ElementType>({
|
|
31
16
|
spacing,
|
|
32
17
|
justify,
|
|
33
18
|
align,
|
|
34
19
|
className,
|
|
35
20
|
...props
|
|
36
|
-
}: ClusterProps<TUse>)
|
|
21
|
+
}: ClusterProps<TUse>) {
|
|
37
22
|
const { use: Comp = 'div', ...rest } = props;
|
|
38
23
|
|
|
39
24
|
return (
|
|
@@ -42,4 +27,4 @@ export const Cluster = <TUse extends ElementType>({
|
|
|
42
27
|
{...rest}
|
|
43
28
|
/>
|
|
44
29
|
);
|
|
45
|
-
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
2
|
+
import { ElementType, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type ConditionalWrapperProps<TUse extends ElementType> =
|
|
5
|
+
PolymorphicComponentProps<TUse> & {
|
|
6
|
+
/**
|
|
7
|
+
* If `true`, the provided `children` prop will be wrapped.
|
|
8
|
+
*/
|
|
9
|
+
condition: boolean;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The component to wrap if `condition` is `true`.
|
|
13
|
+
*/
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function ConditionalWrapper<TUse extends ElementType>(
|
|
18
|
+
props: ConditionalWrapperProps<TUse>,
|
|
19
|
+
) {
|
|
20
|
+
const { use: Comp = 'div', condition, children, ...rest } = props;
|
|
21
|
+
|
|
22
|
+
return condition ? <Comp {...rest}>{children}</Comp> : children;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConditionalWrapper } from './conditional-wrapper';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createVar, globalStyle } from '@vanilla-extract/css';
|
|
2
2
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
3
|
|
|
4
|
+
import { sys , mapContractVars } from '../../styles';
|
|
4
5
|
import { components } from '../../styles/layers.css';
|
|
5
|
-
import { sys } from '../../styles/system-contract.css';
|
|
6
|
-
import { mapContractVars } from '../../utils/map-contract-vars';
|
|
7
6
|
|
|
8
7
|
const spaceVar = createVar();
|
|
9
8
|
export const minSizeVar = createVar();
|
|
@@ -16,7 +15,6 @@ export const coverRecipe = recipe({
|
|
|
16
15
|
flexDirection: 'column',
|
|
17
16
|
|
|
18
17
|
minBlockSize: minSizeVar,
|
|
19
|
-
padding: spaceVar,
|
|
20
18
|
|
|
21
19
|
vars: {
|
|
22
20
|
[minSizeVar]: '100vh',
|
|
@@ -26,6 +24,9 @@ export const coverRecipe = recipe({
|
|
|
26
24
|
},
|
|
27
25
|
|
|
28
26
|
variants: {
|
|
27
|
+
/**
|
|
28
|
+
* The spacing between items
|
|
29
|
+
*/
|
|
29
30
|
spacing: mapContractVars(sys.spacing, (key) => ({
|
|
30
31
|
'@layer': {
|
|
31
32
|
[components]: {
|
|
@@ -35,16 +36,6 @@ export const coverRecipe = recipe({
|
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
})),
|
|
38
|
-
|
|
39
|
-
noPad: {
|
|
40
|
-
true: {
|
|
41
|
-
'@layer': {
|
|
42
|
-
[components]: {
|
|
43
|
-
padding: 0,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
39
|
},
|
|
49
40
|
});
|
|
50
41
|
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { PolymorphicComponentProps } from '@kalink-ui/dibbly
|
|
3
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
4
4
|
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { ElementType } from 'react';
|
|
7
7
|
|
|
8
8
|
import { coverRecipe, CoverVariants, minSizeVar } from './cover.css';
|
|
9
9
|
|
|
10
|
-
type CoverProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* True if the cover should have no padding
|
|
18
|
-
*/
|
|
19
|
-
noPad?: CoverVariants['noPad'];
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The minimum height of the cover
|
|
23
|
-
*/
|
|
24
|
-
minSize?: string;
|
|
25
|
-
};
|
|
10
|
+
type CoverProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
11
|
+
CoverVariants & {
|
|
12
|
+
/**
|
|
13
|
+
* The minimum height of the cover
|
|
14
|
+
*/
|
|
15
|
+
minSize?: string;
|
|
16
|
+
};
|
|
26
17
|
|
|
27
18
|
/**
|
|
28
19
|
* A custom element for covering a block-level element horizontally,
|
|
@@ -33,22 +24,21 @@ type CoverProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> & {
|
|
|
33
24
|
*
|
|
34
25
|
* https://every-layout.dev/layouts/cover
|
|
35
26
|
*/
|
|
36
|
-
export
|
|
27
|
+
export function Cover<TUse extends ElementType>({
|
|
37
28
|
spacing,
|
|
38
|
-
noPad,
|
|
39
29
|
minSize,
|
|
40
30
|
className,
|
|
41
31
|
...props
|
|
42
|
-
}: CoverProps<TUse>)
|
|
32
|
+
}: CoverProps<TUse>) {
|
|
43
33
|
const { use: Comp = 'div', ...rest } = props;
|
|
44
34
|
|
|
45
35
|
return (
|
|
46
36
|
<Comp
|
|
47
|
-
className={clsx(coverRecipe({ spacing
|
|
37
|
+
className={clsx(coverRecipe({ spacing }), className)}
|
|
48
38
|
style={assignInlineVars({
|
|
49
39
|
...(minSize && { [minSizeVar]: minSize }),
|
|
50
40
|
})}
|
|
51
41
|
{...rest}
|
|
52
42
|
/>
|
|
53
43
|
);
|
|
54
|
-
}
|
|
44
|
+
}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import { PolymorphicComponentProps } from '@kalink-ui/dibbly
|
|
1
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { ElementType } from 'react';
|
|
4
4
|
|
|
5
5
|
import { frameRecipe, FrameVariants } from './frame.css';
|
|
6
6
|
|
|
7
|
-
type FrameProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
8
|
-
|
|
9
|
-
* The ratio of the frame
|
|
10
|
-
*/
|
|
11
|
-
ratio?: FrameVariants['ratio'];
|
|
12
|
-
};
|
|
7
|
+
type FrameProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
8
|
+
FrameVariants;
|
|
13
9
|
|
|
14
10
|
/**
|
|
15
11
|
* A custom element for augmenting image ratios
|
|
16
12
|
*
|
|
17
13
|
* https://every-layout.dev/layouts/frame
|
|
18
14
|
*/
|
|
19
|
-
export
|
|
15
|
+
export function Frame<TUse extends ElementType>({
|
|
20
16
|
ratio,
|
|
21
17
|
className,
|
|
22
18
|
...props
|
|
23
|
-
}: FrameProps<TUse>)
|
|
19
|
+
}: FrameProps<TUse>) {
|
|
24
20
|
const { use: Comp = 'div', ...rest } = props;
|
|
25
21
|
|
|
26
22
|
return <Comp className={clsx(frameRecipe({ ratio }), className)} {...rest} />;
|
|
27
|
-
}
|
|
23
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createVar } from '@vanilla-extract/css';
|
|
2
2
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
3
|
|
|
4
|
+
import { sys , mapContractVars } from '../../styles';
|
|
4
5
|
import { components } from '../../styles/layers.css';
|
|
5
|
-
import { sys } from '../../styles/system-contract.css';
|
|
6
|
-
import { mapContractVars } from '../../utils/map-contract-vars';
|
|
7
6
|
|
|
8
7
|
export const minSizeVar = createVar();
|
|
9
8
|
|
|
@@ -22,6 +21,9 @@ export const gridRecipe = recipe({
|
|
|
22
21
|
},
|
|
23
22
|
|
|
24
23
|
variants: {
|
|
24
|
+
/**
|
|
25
|
+
* The spacing between the grid cell
|
|
26
|
+
*/
|
|
25
27
|
spacing: mapContractVars(sys.spacing, (key) => ({
|
|
26
28
|
'@layer': {
|
|
27
29
|
[components]: {
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { PolymorphicComponentProps } from '@kalink-ui/dibbly
|
|
3
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
4
4
|
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { ElementType } from 'react';
|
|
7
7
|
|
|
8
8
|
import { gridRecipe, GridVariants, minSizeVar } from './grid.css';
|
|
9
9
|
|
|
10
|
-
type GridProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* The spacing between the grid cell
|
|
18
|
-
*/
|
|
19
|
-
spacing?: GridVariants['spacing'];
|
|
20
|
-
};
|
|
10
|
+
type GridProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
11
|
+
GridVariants & {
|
|
12
|
+
/**
|
|
13
|
+
* The minimum size of a grid cell
|
|
14
|
+
*/
|
|
15
|
+
minSize?: string;
|
|
16
|
+
};
|
|
21
17
|
|
|
22
18
|
/**
|
|
23
19
|
* The Grid layout provides a flexible, responsive grid system that
|
|
@@ -27,12 +23,12 @@ type GridProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> & {
|
|
|
27
23
|
*
|
|
28
24
|
* https://every-layout.dev/layouts/grid/
|
|
29
25
|
*/
|
|
30
|
-
export
|
|
26
|
+
export function Grid<TUse extends ElementType>({
|
|
31
27
|
spacing,
|
|
32
28
|
minSize,
|
|
33
29
|
className,
|
|
34
30
|
...props
|
|
35
|
-
}: GridProps<TUse>)
|
|
31
|
+
}: GridProps<TUse>) {
|
|
36
32
|
const { use: Comp = 'div', ...rest } = props;
|
|
37
33
|
|
|
38
34
|
return (
|
|
@@ -44,4 +40,4 @@ export const Grid = <TUse extends ElementType>({
|
|
|
44
40
|
{...rest}
|
|
45
41
|
/>
|
|
46
42
|
);
|
|
47
|
-
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { getProp, PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
typography,
|
|
6
|
+
Spacing,
|
|
7
|
+
TypographySize,
|
|
8
|
+
TypographyVariant,
|
|
9
|
+
} from '../../styles';
|
|
10
|
+
import { ConditionalWrapper } from '../conditional-wrapper';
|
|
11
|
+
import { Stack } from '../stack';
|
|
12
|
+
|
|
13
|
+
import { headingRecipe } from './heading.css';
|
|
14
|
+
|
|
15
|
+
type HeadingTypes = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
16
|
+
|
|
17
|
+
type HeadingProps<TUse extends HeadingTypes> =
|
|
18
|
+
PolymorphicComponentProps<TUse> & {
|
|
19
|
+
/**
|
|
20
|
+
* The size of the typography used to render the text.
|
|
21
|
+
*/
|
|
22
|
+
size?: TypographySize;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The typography used to render the text.
|
|
26
|
+
*/
|
|
27
|
+
variant: Extract<TypographyVariant, 'display' | 'headline' | 'title'>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The text to render.
|
|
31
|
+
*/
|
|
32
|
+
children: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* If provided, the text will be rendered before the title.
|
|
36
|
+
*/
|
|
37
|
+
pretitle?: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* If provided, the text will be rendered after the title.
|
|
41
|
+
*/
|
|
42
|
+
subtitle?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The spacing between the title and the pretitle or subtitle.
|
|
46
|
+
*/
|
|
47
|
+
spacing?: Spacing;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export function Heading<TUse extends HeadingTypes>(props: HeadingProps<TUse>) {
|
|
51
|
+
const {
|
|
52
|
+
children,
|
|
53
|
+
className,
|
|
54
|
+
size = 'medium',
|
|
55
|
+
use: Comp = 'h1',
|
|
56
|
+
variant,
|
|
57
|
+
pretitle,
|
|
58
|
+
subtitle,
|
|
59
|
+
spacing,
|
|
60
|
+
...rest
|
|
61
|
+
} = props;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<ConditionalWrapper
|
|
65
|
+
use={Stack}
|
|
66
|
+
spacing={spacing}
|
|
67
|
+
condition={!!pretitle || !!subtitle}
|
|
68
|
+
>
|
|
69
|
+
{pretitle && <span>{pretitle}</span>}
|
|
70
|
+
<Comp
|
|
71
|
+
className={clsx(
|
|
72
|
+
headingRecipe(),
|
|
73
|
+
getProp(typography, `${variant}.${size}`),
|
|
74
|
+
className,
|
|
75
|
+
)}
|
|
76
|
+
{...rest}
|
|
77
|
+
>
|
|
78
|
+
{children}
|
|
79
|
+
</Comp>
|
|
80
|
+
{subtitle && <span>{subtitle}</span>}
|
|
81
|
+
</ConditionalWrapper>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Heading } from './heading';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Box } from './box';
|
|
2
|
+
export { Button } from './button';
|
|
3
|
+
export { Center } from './center';
|
|
4
|
+
export { Cluster } from './cluster';
|
|
5
|
+
export { ConditionalWrapper } from "./conditional-wrapper";
|
|
6
|
+
export { Cover } from './cover';
|
|
7
|
+
export { Frame } from './frame';
|
|
8
|
+
export { Grid } from './grid';
|
|
9
|
+
export { Heading } from "./heading";
|
|
10
|
+
export { plantSeed } from './seed';
|
|
11
|
+
export { Sidebar } from './sidebar';
|
|
12
|
+
export { Stack } from './stack';
|
|
13
|
+
export { Switcher } from './switcher';
|
|
14
|
+
export { Text } from './text';
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
+
import { type PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
1
2
|
import { clsx } from 'clsx';
|
|
3
|
+
import { type ElementType } from 'react';
|
|
2
4
|
|
|
3
5
|
import {
|
|
4
6
|
extractSprinklesProps,
|
|
5
7
|
type GetSprinkles,
|
|
6
8
|
type SprinklesFnBase,
|
|
7
|
-
} from '../../
|
|
8
|
-
|
|
9
|
-
import type { PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
|
|
10
|
-
import type { ElementType } from 'react';
|
|
9
|
+
} from '../../styles';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* When you use `SeedProps` in other components and want to define a default
|
|
14
13
|
* value for that prop in your component (e.g. `const { use = 'span' } = props;`)
|
|
15
14
|
* you will need to cast the `use` prop as `YourComponentProps<TUse>['use]` otherwise
|
|
16
15
|
* it will be considered as `TUse | span` and you will get a type error.
|
|
17
|
-
*
|
|
18
|
-
* You can see an example of this in `frontend/components/text/text.tsx`.
|
|
19
16
|
*/
|
|
20
17
|
export type SeedProps<
|
|
21
18
|
TUse extends ElementType,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createVar, globalStyle } from '@vanilla-extract/css';
|
|
2
2
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
3
|
|
|
4
|
+
import { sys, mapContractVars } from '../../styles';
|
|
4
5
|
import { components } from '../../styles/layers.css';
|
|
5
|
-
import { sys } from '../../styles/system-contract.css';
|
|
6
|
-
import { mapContractVars } from '../../utils/map-contract-vars';
|
|
7
6
|
|
|
8
7
|
export const sideWidthVar = createVar();
|
|
9
8
|
export const contentMinWidthVar = createVar();
|
|
@@ -23,6 +22,9 @@ export const sidebarRecipe = recipe({
|
|
|
23
22
|
},
|
|
24
23
|
|
|
25
24
|
variants: {
|
|
25
|
+
/**
|
|
26
|
+
* The spacing between the sidebar and main content elements
|
|
27
|
+
*/
|
|
26
28
|
spacing: mapContractVars(sys.spacing, (key) => ({
|
|
27
29
|
'@layer': {
|
|
28
30
|
[components]: {
|
|
@@ -31,6 +33,9 @@ export const sidebarRecipe = recipe({
|
|
|
31
33
|
},
|
|
32
34
|
})),
|
|
33
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Whether the sidebar should stretch to fill the available space
|
|
38
|
+
*/
|
|
34
39
|
noStretch: {
|
|
35
40
|
true: {
|
|
36
41
|
'@layer': {
|