@kalink-ui/seedly 0.24.0 → 0.25.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 +7 -0
- package/package.json +3 -3
- package/src/components/heading/heading.css.ts +8 -0
- package/src/components/heading/heading.tsx +50 -47
- package/src/components/sheet/sheet-title.tsx +16 -1
- package/src/components/switcher/index.ts +1 -1
- package/src/components/switcher/switcher.tsx +8 -7
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalink-ui/seedly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.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/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",
|
|
@@ -1,47 +1,48 @@
|
|
|
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
9
|
import { headingRoot, pretitle, subtitle } from './heading.css';
|
|
9
10
|
|
|
10
11
|
export type HeadingTypes = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
11
12
|
|
|
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
|
-
};
|
|
13
|
+
export type HeadingProps<TUse extends ElementType = 'h2'> =
|
|
14
|
+
PolymorphicComponentProps<TUse> &
|
|
15
|
+
TextVariants & {
|
|
16
|
+
/**
|
|
17
|
+
* The typography used to render the text.
|
|
18
|
+
*/
|
|
19
|
+
variant: Extract<TypographyVariant, 'display' | 'headline' | 'title'>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The size of the typography used to render the text.
|
|
23
|
+
*/
|
|
24
|
+
size?: TypographySize;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* If provided, the text will be rendered before the title.
|
|
28
|
+
*/
|
|
29
|
+
pretitle?: ReactElement<TextProps<'p'>>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* If provided, the text will be rendered after the title.
|
|
33
|
+
*/
|
|
34
|
+
subtitle?: ReactElement<TextProps<'p'>>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The text to render.
|
|
38
|
+
*/
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The class to pass to the root element.
|
|
43
|
+
*/
|
|
44
|
+
rootClassName?: string;
|
|
45
|
+
};
|
|
45
46
|
|
|
46
47
|
const headingMapping: Record<
|
|
47
48
|
HeadingTypes,
|
|
@@ -55,18 +56,20 @@ const headingMapping: Record<
|
|
|
55
56
|
h6: { variant: 'headline', size: 'small' },
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
export function Heading<TUse extends HeadingTypes>({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
export function Heading<TUse extends HeadingTypes>(props: HeadingProps<TUse>) {
|
|
60
|
+
const {
|
|
61
|
+
children,
|
|
62
|
+
use = 'h2',
|
|
63
|
+
size,
|
|
64
|
+
variant,
|
|
65
|
+
align,
|
|
66
|
+
pretitle,
|
|
67
|
+
subtitle,
|
|
68
|
+
rootClassName,
|
|
69
|
+
ref,
|
|
70
|
+
...rest
|
|
71
|
+
} = props;
|
|
72
|
+
|
|
70
73
|
return (
|
|
71
74
|
<ConditionalWrapper
|
|
72
75
|
ref={ref}
|
|
@@ -78,7 +81,7 @@ export function Heading<TUse extends HeadingTypes>({
|
|
|
78
81
|
|
|
79
82
|
<Text
|
|
80
83
|
{...(!pretitle && !subtitle && { ref })}
|
|
81
|
-
use={use}
|
|
84
|
+
use={use as HeadingProps<TUse>['use']}
|
|
82
85
|
align={align}
|
|
83
86
|
variant={variant ?? headingMapping[use].variant}
|
|
84
87
|
size={size ?? headingMapping[use].size}
|
|
@@ -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,2 +1,2 @@
|
|
|
1
|
-
export { Switcher } from './switcher';
|
|
1
|
+
export { Switcher, type SwitcherProps } from './switcher';
|
|
2
2
|
export { switcherRecipe, type SwitcherVariants } from './switcher.css';
|
|
@@ -7,13 +7,14 @@ import { ElementType } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { switcherRecipe, SwitcherVariants, thresholdVar } from './switcher.css';
|
|
9
9
|
|
|
10
|
-
type SwitcherProps<TUse extends ElementType> =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export type SwitcherProps<TUse extends ElementType> =
|
|
11
|
+
PolymorphicComponentProps<TUse> &
|
|
12
|
+
SwitcherVariants & {
|
|
13
|
+
/**
|
|
14
|
+
* The threshold at which to switch between horizontal and vertical layouts
|
|
15
|
+
*/
|
|
16
|
+
threshold?: string;
|
|
17
|
+
};
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Switch directly between horizontal and vertical layouts
|