@kalink-ui/seedly 0.23.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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 0.23.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalink-ui/seedly",
3
- "version": "0.23.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/eslint-config": "0.9.0",
48
- "@kalink-ui/typescript-config": "0.4.0"
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",
@@ -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
- gap: sys.spacing[key],
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, spacing }), rootClassName)}
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 use="p" variant={variant} size={size} {...rest}>
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 use="p" variant={variant} size={size} {...rest}>
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
  )