@kalink-ui/seedly 0.27.0 → 0.28.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,14 @@
1
1
  # @kalink-ui/seedly
2
2
 
3
+ ## 0.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d38d956: feat(seedly/button-icon): add responsive variants for `size` and `variant`
8
+ - Introduce `buttonIconResponsive` with `sizeAt` and `variantAt`.
9
+ - Accept responsive values (object/array) for `size` and `variant` props.
10
+ - Keeps icon-only spacing consistent across breakpoints.
11
+
3
12
  ## 0.27.0
4
13
 
5
14
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalink-ui/seedly",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "A set of components for building UIs with React and TypeScript",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -43,8 +43,8 @@
43
43
  "vite": "^6.3.5",
44
44
  "vite-tsconfig-paths": "^5.1.4",
45
45
  "vitest": "^3.2.3",
46
- "@kalink-ui/typescript-config": "0.4.0",
47
- "@kalink-ui/eslint-config": "0.10.0"
46
+ "@kalink-ui/eslint-config": "0.10.0",
47
+ "@kalink-ui/typescript-config": "0.4.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@vanilla-extract/css": "^1.17.1",
@@ -1,9 +1,13 @@
1
1
  import { assignVars } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
- import { sys } from '../../styles';
4
+ import { createResponsiveVariants, defaultMedia, sys } from '../../styles';
5
5
  import { components } from '../../styles/layers.css';
6
- import { buttonRecipe, buttonVars } from '../button/button.css';
6
+ import {
7
+ buttonRecipe,
8
+ buttonVars,
9
+ buttonVariantStyles,
10
+ } from '../button/button.css';
7
11
 
8
12
  export const buttonIcon = recipe({
9
13
  base: [buttonRecipe.classNames.base],
@@ -63,3 +67,50 @@ export const buttonIcon = recipe({
63
67
  });
64
68
 
65
69
  export type ButtonIconVariants = NonNullable<RecipeVariants<typeof buttonIcon>>;
70
+
71
+ // Responsive variants
72
+ const buttonIconSizeStyles = {
73
+ sm: {
74
+ '@layer': {
75
+ [components]: {
76
+ vars: assignVars(buttonVars.spacing, {
77
+ block: sys.spacing[2],
78
+ inline: sys.spacing[2],
79
+ inner: sys.spacing[2],
80
+ }),
81
+ },
82
+ },
83
+ },
84
+ md: {
85
+ '@layer': {
86
+ [components]: {
87
+ vars: assignVars(buttonVars.spacing, {
88
+ block: sys.spacing[2],
89
+ inline: sys.spacing[2],
90
+ inner: sys.spacing[2],
91
+ }),
92
+ },
93
+ },
94
+ },
95
+ lg: {
96
+ '@layer': {
97
+ [components]: {
98
+ vars: assignVars(buttonVars.spacing, {
99
+ block: sys.spacing[3],
100
+ inline: sys.spacing[3],
101
+ inner: sys.spacing[3],
102
+ }),
103
+ },
104
+ },
105
+ },
106
+ } as const;
107
+
108
+ export const sizeAt = createResponsiveVariants({
109
+ styles: buttonIconSizeStyles,
110
+ media: defaultMedia,
111
+ });
112
+
113
+ export const variantAt = createResponsiveVariants({
114
+ styles: buttonVariantStyles,
115
+ media: defaultMedia,
116
+ });
@@ -0,0 +1,9 @@
1
+ import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
2
+
3
+ import { buttonIcon, sizeAt, variantAt } from './button-icon.css';
4
+
5
+ export const buttonIconResponsive = responsiveRecipe({
6
+ recipe: buttonIcon,
7
+ at: { size: sizeAt, variant: variantAt },
8
+ order: defaultOrder,
9
+ });
@@ -3,10 +3,19 @@ import { clsx } from 'clsx';
3
3
 
4
4
  import { ButtonTypes } from '../button/button';
5
5
 
6
- import { buttonIcon, ButtonIconVariants } from './button-icon.css';
6
+ import { ButtonIconVariants } from './button-icon.css';
7
+ import { buttonIconResponsive } from './button-icon.responsive';
8
+
9
+ import type { Responsive } from '../../styles/responsive';
10
+
11
+ type ButtonIconVariantResponsive = {
12
+ [K in keyof ButtonIconVariants]?: Responsive<
13
+ NonNullable<ButtonIconVariants[K]>
14
+ >;
15
+ };
7
16
 
8
17
  export type ButtonIconProps<TUse extends ButtonTypes> =
9
- PolymorphicComponentProps<TUse> & ButtonIconVariants;
18
+ PolymorphicComponentProps<TUse> & ButtonIconVariantResponsive;
10
19
 
11
20
  export function ButtonIcon<TUse extends ButtonTypes>(
12
21
  props: ButtonIconProps<TUse>,
@@ -15,9 +24,8 @@ export function ButtonIcon<TUse extends ButtonTypes>(
15
24
 
16
25
  return (
17
26
  <Comp
18
- className={clsx(buttonIcon({ variant, size }), className)}
19
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
20
- {...(rest as any)}
27
+ className={clsx(buttonIconResponsive({ variant, size }), className)}
28
+ {...(rest as Record<string, unknown>)}
21
29
  />
22
30
  );
23
31
  }