@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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @kalink-ui/seedly
2
2
 
3
+ ## 0.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f41d4a0: [Switcher] Correctly export types
8
+ - 810fdce: [Heading] Fix prop types definition
9
+
3
10
  ## 0.24.0
4
11
 
5
12
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalink-ui/seedly",
3
- "version": "0.24.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/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",
@@ -39,6 +39,14 @@ export const headingRoot = recipe({
39
39
  },
40
40
  },
41
41
  },
42
+ justify: {
43
+ '@layer': {
44
+ [components]: {
45
+ alignItems: 'stretch',
46
+ textAlign: 'justify',
47
+ },
48
+ },
49
+ },
42
50
  },
43
51
  },
44
52
  });
@@ -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'> = Omit<
13
- TextProps<TUse>,
14
- 'variant' | 'children' | 'align'
15
- > & {
16
- align?: Extract<
17
- Pick<TextProps<TUse>, 'align'>['align'],
18
- 'start' | 'center' | 'end'
19
- >;
20
- /**
21
- * The typography used to render the text.
22
- */
23
- variant: Extract<TypographyVariant, 'display' | 'headline' | 'title'>;
24
-
25
- /**
26
- * If provided, the text will be rendered before the title.
27
- */
28
- pretitle?: ReactElement<TextProps<'p'>>;
29
-
30
- /**
31
- * If provided, the text will be rendered after the title.
32
- */
33
- subtitle?: ReactElement<TextProps<'p'>>;
34
-
35
- /**
36
- * The text to render.
37
- */
38
- children: ReactNode;
39
-
40
- /**
41
- * The class to pass to the root element.
42
- */
43
- rootClassName?: string;
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
- children,
60
- use = 'h2',
61
- size,
62
- variant,
63
- align,
64
- pretitle,
65
- subtitle,
66
- rootClassName,
67
- ref,
68
- ...rest
69
- }: HeadingProps<TUse>) {
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 { use = 'h2', className, children, variant, size, ...rest } = props;
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> = PolymorphicComponentProps<TUse> &
11
- SwitcherVariants & {
12
- /**
13
- * The threshold at which to switch between horizontal and vertical layouts
14
- */
15
- threshold?: string;
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