@pittorica/checkbox-group-react 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.
@@ -1,7 +1,11 @@
1
+ import { type ElementType } from 'react';
1
2
  import { type BoxProps } from '@pittorica/box-react';
2
3
  import { type CheckboxProps } from '@pittorica/checkbox-react';
3
4
  import type { PittoricaColor } from '@pittorica/text-react';
4
- export interface CheckboxGroupRootProps extends Omit<BoxProps, 'onChange'> {
5
+ /**
6
+ * Fix TS2314: Use 'type' for intersection with polymorphic BoxProps<E>.
7
+ */
8
+ export type CheckboxGroupRootProps<E extends ElementType = 'div'> = Omit<BoxProps<E>, 'onChange' | 'value' | 'defaultValue'> & {
5
9
  value?: string[];
6
10
  defaultValue?: string[];
7
11
  onValueChange?: (value: string[]) => void;
@@ -9,11 +13,20 @@ export interface CheckboxGroupRootProps extends Omit<BoxProps, 'onChange'> {
9
13
  color?: PittoricaColor;
10
14
  disabled?: boolean;
11
15
  name?: string;
12
- }
13
- export interface CheckboxGroupItemProps extends Omit<CheckboxProps, 'value'> {
16
+ };
17
+ /**
18
+ * Fix TS2314: Extend CheckboxProps with generic E.
19
+ */
20
+ export type CheckboxGroupItemProps<E extends ElementType = 'label'> = Omit<CheckboxProps<E>, 'value'> & {
14
21
  value: string;
15
- }
16
- export declare const CheckboxGroup: (({ value: controlledValue, defaultValue, onValueChange, orientation, color, disabled, name, children, className, ...props }: CheckboxGroupRootProps) => import("react/jsx-runtime").JSX.Element) & {
17
- Item: ({ value, ...props }: CheckboxGroupItemProps) => import("react/jsx-runtime").JSX.Element;
22
+ };
23
+ export declare const CheckboxGroup: {
24
+ <E extends ElementType = "div">({ value: controlledValue, defaultValue, onValueChange, orientation, color, disabled, name, children, className, as, ...props }: CheckboxGroupRootProps<E>): import("react/jsx-runtime").JSX.Element;
25
+ displayName: string;
26
+ } & {
27
+ Item: {
28
+ <E extends ElementType = "label">({ value, as, ...props }: CheckboxGroupItemProps<E>): import("react/jsx-runtime").JSX.Element;
29
+ displayName: string;
30
+ };
18
31
  };
19
32
  //# sourceMappingURL=CheckboxGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../src/CheckboxGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAc5D,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IACxE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAmDD,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC;IAC1E,KAAK,EAAE,MAAM,CAAC;CACf;AAwBD,eAAO,MAAM,aAAa,gIAhEvB,sBAAsB;gCA0CuB,sBAAsB;CAwBpE,CAAC"}
1
+ {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../src/CheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,WAAW,EAA0B,MAAM,OAAO,CAAC;AAIhF,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAgB5D;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,IAAI,CACtE,QAAQ,CAAC,CAAC,CAAC,EACX,UAAU,GAAG,OAAO,GAAG,cAAc,CACtC,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AA4DF;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,WAAW,GAAG,OAAO,IAAI,IAAI,CACxE,aAAa,CAAC,CAAC,CAAC,EAChB,OAAO,CACR,GAAG;IACF,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA+BF,eAAO,MAAM,aAAa;KAjGC,CAAC,SAAS,WAAW,0IAY7C,sBAAsB,CAAC,CAAC,CAAC;;;;SAwDD,CAAC,SAAS,WAAW,qCAI7C,sBAAsB,CAAC,CAAC,CAAC;;;CA2B1B,CAAC"}
package/dist/index.js CHANGED
@@ -1,96 +1,86 @@
1
- import { jsx as b, jsxs as _ } from "react/jsx-runtime";
2
- import D, { forwardRef as H, createElement as R, createContext as J, useState as K, use as P } from "react";
3
- function L(r) {
4
- var a, e, t = "";
5
- if (typeof r == "string" || typeof r == "number") t += r;
6
- else if (typeof r == "object") if (Array.isArray(r)) {
7
- var o = r.length;
8
- for (a = 0; a < o; a++) r[a] && (e = L(r[a])) && (t && (t += " "), t += e);
9
- } else for (e in r) r[e] && (t && (t += " "), t += e);
1
+ import { jsx as $, jsxs as J } from "react/jsx-runtime";
2
+ import K, { forwardRef as P, createElement as A, createContext as Q, useState as U, useMemo as X, use as Y } from "react";
3
+ function z(a) {
4
+ var i, r, t = "";
5
+ if (typeof a == "string" || typeof a == "number") t += a;
6
+ else if (typeof a == "object") if (Array.isArray(a)) {
7
+ var o = a.length;
8
+ for (i = 0; i < o; i++) a[i] && (r = z(a[i])) && (t && (t += " "), t += r);
9
+ } else for (r in a) a[r] && (t && (t += " "), t += r);
10
10
  return t;
11
11
  }
12
- function Q() {
13
- for (var r, a, e = 0, t = "", o = arguments.length; e < o; e++) (r = arguments[e]) && (a = L(r)) && (t && (t += " "), t += a);
12
+ function Z() {
13
+ for (var a, i, r = 0, t = "", o = arguments.length; r < o; r++) (a = arguments[r]) && (i = z(a)) && (t && (t += " "), t += i);
14
14
  return t;
15
15
  }
16
- function I(r) {
17
- var a, e, t = "";
18
- if (typeof r == "string" || typeof r == "number") t += r;
19
- else if (typeof r == "object") if (Array.isArray(r)) {
20
- var o = r.length;
21
- for (a = 0; a < o; a++) r[a] && (e = I(r[a])) && (t && (t += " "), t += e);
22
- } else for (e in r) r[e] && (t && (t += " "), t += e);
16
+ function L(a) {
17
+ var i, r, t = "";
18
+ if (typeof a == "string" || typeof a == "number") t += a;
19
+ else if (typeof a == "object") if (Array.isArray(a)) {
20
+ var o = a.length;
21
+ for (i = 0; i < o; i++) a[i] && (r = L(a[i])) && (t && (t += " "), t += r);
22
+ } else for (r in a) a[r] && (t && (t += " "), t += r);
23
23
  return t;
24
24
  }
25
- function U() {
26
- for (var r, a, e = 0, t = "", o = arguments.length; e < o; e++) (r = arguments[e]) && (a = I(r)) && (t && (t += " "), t += a);
25
+ function V() {
26
+ for (var a, i, r = 0, t = "", o = arguments.length; r < o; r++) (a = arguments[r]) && (i = L(a)) && (t && (t += " "), t += i);
27
27
  return t;
28
28
  }
29
- const W = ({
30
- ref: r,
31
- as: a = "div",
32
- children: e,
33
- display: t,
34
- m: o,
35
- mt: n,
36
- mr: l,
37
- mb: h,
38
- ml: p,
39
- p: m,
40
- pt: c,
41
- pr: g,
42
- pb: d,
29
+ const j = ({
30
+ as: a,
31
+ children: i,
32
+ display: r,
33
+ m: t,
34
+ mt: o,
35
+ mr: p,
36
+ mb: c,
37
+ ml: h,
38
+ mx: n,
39
+ my: l,
40
+ p: d,
41
+ pt: v,
42
+ pr: u,
43
+ pb: g,
43
44
  pl: s,
44
- width: u,
45
- height: f,
46
- position: v,
47
- style: y,
48
- className: x,
49
- href: $,
50
- target: k,
51
- rel: w,
52
- htmlFor: N,
53
- type: C,
54
- name: A,
55
- disabled: j,
56
- ...B
45
+ px: m,
46
+ py: f,
47
+ width: b,
48
+ height: y,
49
+ position: x,
50
+ style: k,
51
+ className: w,
52
+ disabled: N,
53
+ ...C
57
54
  }) => {
58
- const i = {};
59
- t && (i.display = t), u && (i.width = u), f && (i.height = f), v && (i.position = v), o && (i.margin = `var(--pittorica-space-${o})`), n && (i.marginTop = `var(--pittorica-space-${n})`), l && (i.marginRight = `var(--pittorica-space-${l})`), h && (i.marginBottom = `var(--pittorica-space-${h})`), p && (i.marginLeft = `var(--pittorica-space-${p})`), m && (i.padding = `var(--pittorica-space-${m})`), c && (i.paddingTop = `var(--pittorica-space-${c})`), g && (i.paddingRight = `var(--pittorica-space-${g})`), d && (i.paddingBottom = `var(--pittorica-space-${d})`), s && (i.paddingLeft = `var(--pittorica-space-${s})`);
60
- const F = {
61
- ...y,
62
- ...i
55
+ const T = a || "div", e = {};
56
+ r && (e.display = r), b && (e.width = b), y && (e.height = y), x && (e.position = x), t && (e.margin = `var(--pittorica-space-${t})`), o && (e.marginTop = `var(--pittorica-space-${o})`), p && (e.marginRight = `var(--pittorica-space-${p})`), c && (e.marginBottom = `var(--pittorica-space-${c})`), h && (e.marginLeft = `var(--pittorica-space-${h})`), n && (e.marginLeft = `var(--pittorica-space-${n})`, e.marginRight = `var(--pittorica-space-${n})`), l && (e.marginTop = `var(--pittorica-space-${l})`, e.marginBottom = `var(--pittorica-space-${l})`), d && (e.padding = `var(--pittorica-space-${d})`), v && (e.paddingTop = `var(--pittorica-space-${v})`), u && (e.paddingRight = `var(--pittorica-space-${u})`), g && (e.paddingBottom = `var(--pittorica-space-${g})`), s && (e.paddingLeft = `var(--pittorica-space-${s})`), m && (e.paddingLeft = `var(--pittorica-space-${m})`, e.paddingRight = `var(--pittorica-space-${m})`), f && (e.paddingTop = `var(--pittorica-space-${f})`, e.paddingBottom = `var(--pittorica-space-${f})`);
57
+ const R = {
58
+ ...k,
59
+ ...e
63
60
  };
64
- return /* @__PURE__ */ b(
65
- a,
61
+ return /* @__PURE__ */ $(
62
+ T,
66
63
  {
67
- ref: r,
68
- className: U("pittorica-box", x),
69
- style: F,
70
- href: $,
71
- target: k,
72
- rel: w,
73
- htmlFor: N,
74
- type: C,
75
- name: A,
76
- disabled: j,
77
- ...B,
78
- children: e
64
+ className: V("pittorica-box", w),
65
+ style: R,
66
+ disabled: N,
67
+ ...C,
68
+ children: i
79
69
  }
80
70
  );
81
71
  };
82
- W.displayName = "Box";
83
- function q(r) {
84
- var a, e, t = "";
85
- if (typeof r == "string" || typeof r == "number") t += r;
86
- else if (typeof r == "object") if (Array.isArray(r)) {
87
- var o = r.length;
88
- for (a = 0; a < o; a++) r[a] && (e = q(r[a])) && (t && (t += " "), t += e);
89
- } else for (e in r) r[e] && (t && (t += " "), t += e);
72
+ j.displayName = "Box";
73
+ function G(a) {
74
+ var i, r, t = "";
75
+ if (typeof a == "string" || typeof a == "number") t += a;
76
+ else if (typeof a == "object") if (Array.isArray(a)) {
77
+ var o = a.length;
78
+ for (i = 0; i < o; i++) a[i] && (r = G(a[i])) && (t && (t += " "), t += r);
79
+ } else for (r in a) a[r] && (t && (t += " "), t += r);
90
80
  return t;
91
81
  }
92
- function Z() {
93
- for (var r, a, e = 0, t = "", o = arguments.length; e < o; e++) (r = arguments[e]) && (a = q(r)) && (t && (t += " "), t += a);
82
+ function tt() {
83
+ for (var a, i, r = 0, t = "", o = arguments.length; r < o; r++) (a = arguments[r]) && (i = G(a)) && (t && (t += " "), t += i);
94
84
  return t;
95
85
  }
96
86
  /**
@@ -99,7 +89,7 @@ function Z() {
99
89
  * This source code is licensed under the MIT license.
100
90
  * See the LICENSE file in the root directory of this source tree.
101
91
  */
102
- var X = {
92
+ var at = {
103
93
  outline: {
104
94
  xmlns: "http://www.w3.org/2000/svg",
105
95
  width: 24,
@@ -126,32 +116,32 @@ var X = {
126
116
  * This source code is licensed under the MIT license.
127
117
  * See the LICENSE file in the root directory of this source tree.
128
118
  */
129
- const G = (r, a, e, t) => {
130
- const o = H(
131
- ({ color: n = "currentColor", size: l = 24, stroke: h = 2, title: p, className: m, children: c, ...g }, d) => R(
119
+ const I = (a, i, r, t) => {
120
+ const o = P(
121
+ ({ color: p = "currentColor", size: c = 24, stroke: h = 2, title: n, className: l, children: d, ...v }, u) => A(
132
122
  "svg",
133
123
  {
134
- ref: d,
135
- ...X[r],
136
- width: l,
137
- height: l,
138
- className: ["tabler-icon", `tabler-icon-${a}`, m].join(" "),
139
- ...r === "filled" ? {
140
- fill: n
124
+ ref: u,
125
+ ...at[a],
126
+ width: c,
127
+ height: c,
128
+ className: ["tabler-icon", `tabler-icon-${i}`, l].join(" "),
129
+ ...a === "filled" ? {
130
+ fill: p
141
131
  } : {
142
132
  strokeWidth: h,
143
- stroke: n
133
+ stroke: p
144
134
  },
145
- ...g
135
+ ...v
146
136
  },
147
137
  [
148
- p && R("title", { key: "svg-title" }, p),
149
- ...t.map(([s, u]) => R(s, u)),
150
- ...Array.isArray(c) ? c : [c]
138
+ n && A("title", { key: "svg-title" }, n),
139
+ ...t.map(([g, s]) => A(g, s)),
140
+ ...Array.isArray(d) ? d : [d]
151
141
  ]
152
142
  )
153
143
  );
154
- return o.displayName = `${e}`, o;
144
+ return o.displayName = `${r}`, o;
155
145
  };
156
146
  /**
157
147
  * @license @tabler/icons-react v3.36.1 - MIT
@@ -159,178 +149,154 @@ const G = (r, a, e, t) => {
159
149
  * This source code is licensed under the MIT license.
160
150
  * See the LICENSE file in the root directory of this source tree.
161
151
  */
162
- const Y = [["path", { d: "M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14", key: "svg-0" }]], V = G("outline", "square", "Square", Y);
152
+ const rt = [["path", { d: "M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14", key: "svg-0" }]], et = I("outline", "square", "Square", rt);
163
153
  /**
164
154
  * @license @tabler/icons-react v3.36.1 - MIT
165
155
  *
166
156
  * This source code is licensed under the MIT license.
167
157
  * See the LICENSE file in the root directory of this source tree.
168
158
  */
169
- const tt = [["path", { d: "M18.333 2c1.96 0 3.56 1.537 3.662 3.472l.005 .195v12.666c0 1.96 -1.537 3.56 -3.472 3.662l-.195 .005h-12.666a3.667 3.667 0 0 1 -3.662 -3.472l-.005 -.195v-12.666c0 -1.96 1.537 -3.56 3.472 -3.662l.195 -.005h12.666zm-2.626 7.293a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z", key: "svg-0" }]], rt = G("filled", "square-check-filled", "SquareCheckFilled", tt);
170
- function T(r) {
171
- var a, e, t = "";
172
- if (typeof r == "string" || typeof r == "number") t += r;
173
- else if (typeof r == "object") if (Array.isArray(r)) {
174
- var o = r.length;
175
- for (a = 0; a < o; a++) r[a] && (e = T(r[a])) && (t && (t += " "), t += e);
176
- } else for (e in r) r[e] && (t && (t += " "), t += e);
159
+ const it = [["path", { d: "M18.333 2c1.96 0 3.56 1.537 3.662 3.472l.005 .195v12.666c0 1.96 -1.537 3.56 -3.472 3.662l-.195 .005h-12.666a3.667 3.667 0 0 1 -3.662 -3.472l-.005 -.195v-12.666c0 -1.96 1.537 -3.56 3.472 -3.662l.195 -.005h12.666zm-2.626 7.293a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z", key: "svg-0" }]], ot = I("filled", "square-check-filled", "SquareCheckFilled", it);
160
+ function W(a) {
161
+ var i, r, t = "";
162
+ if (typeof a == "string" || typeof a == "number") t += a;
163
+ else if (typeof a == "object") if (Array.isArray(a)) {
164
+ var o = a.length;
165
+ for (i = 0; i < o; i++) a[i] && (r = W(a[i])) && (t && (t += " "), t += r);
166
+ } else for (r in a) a[r] && (t && (t += " "), t += r);
177
167
  return t;
178
168
  }
179
- function et() {
180
- for (var r, a, e = 0, t = "", o = arguments.length; e < o; e++) (r = arguments[e]) && (a = T(r)) && (t && (t += " "), t += a);
169
+ function ct() {
170
+ for (var a, i, r = 0, t = "", o = arguments.length; r < o; r++) (a = arguments[r]) && (i = W(a)) && (t && (t += " "), t += i);
181
171
  return t;
182
172
  }
183
- const z = ({
184
- ref: r,
185
- as: a = "div",
186
- children: e,
187
- display: t,
188
- m: o,
189
- mt: n,
190
- mr: l,
191
- mb: h,
192
- ml: p,
193
- p: m,
194
- pt: c,
195
- pr: g,
196
- pb: d,
173
+ const S = ({
174
+ as: a,
175
+ children: i,
176
+ display: r,
177
+ m: t,
178
+ mt: o,
179
+ mr: p,
180
+ mb: c,
181
+ ml: h,
182
+ mx: n,
183
+ my: l,
184
+ p: d,
185
+ pt: v,
186
+ pr: u,
187
+ pb: g,
197
188
  pl: s,
198
- width: u,
199
- height: f,
200
- position: v,
201
- style: y,
202
- className: x,
203
- href: $,
204
- target: k,
205
- rel: w,
206
- htmlFor: N,
207
- type: C,
208
- name: A,
209
- disabled: j,
210
- ...B
189
+ px: m,
190
+ py: f,
191
+ width: b,
192
+ height: y,
193
+ position: x,
194
+ style: k,
195
+ className: w,
196
+ disabled: N,
197
+ ...C
211
198
  }) => {
212
- const i = {};
213
- t && (i.display = t), u && (i.width = u), f && (i.height = f), v && (i.position = v), o && (i.margin = `var(--pittorica-space-${o})`), n && (i.marginTop = `var(--pittorica-space-${n})`), l && (i.marginRight = `var(--pittorica-space-${l})`), h && (i.marginBottom = `var(--pittorica-space-${h})`), p && (i.marginLeft = `var(--pittorica-space-${p})`), m && (i.padding = `var(--pittorica-space-${m})`), c && (i.paddingTop = `var(--pittorica-space-${c})`), g && (i.paddingRight = `var(--pittorica-space-${g})`), d && (i.paddingBottom = `var(--pittorica-space-${d})`), s && (i.paddingLeft = `var(--pittorica-space-${s})`);
214
- const F = {
215
- ...y,
216
- ...i
199
+ const T = a || "div", e = {};
200
+ r && (e.display = r), b && (e.width = b), y && (e.height = y), x && (e.position = x), t && (e.margin = `var(--pittorica-space-${t})`), o && (e.marginTop = `var(--pittorica-space-${o})`), p && (e.marginRight = `var(--pittorica-space-${p})`), c && (e.marginBottom = `var(--pittorica-space-${c})`), h && (e.marginLeft = `var(--pittorica-space-${h})`), n && (e.marginLeft = `var(--pittorica-space-${n})`, e.marginRight = `var(--pittorica-space-${n})`), l && (e.marginTop = `var(--pittorica-space-${l})`, e.marginBottom = `var(--pittorica-space-${l})`), d && (e.padding = `var(--pittorica-space-${d})`), v && (e.paddingTop = `var(--pittorica-space-${v})`), u && (e.paddingRight = `var(--pittorica-space-${u})`), g && (e.paddingBottom = `var(--pittorica-space-${g})`), s && (e.paddingLeft = `var(--pittorica-space-${s})`), m && (e.paddingLeft = `var(--pittorica-space-${m})`, e.paddingRight = `var(--pittorica-space-${m})`), f && (e.paddingTop = `var(--pittorica-space-${f})`, e.paddingBottom = `var(--pittorica-space-${f})`);
201
+ const R = {
202
+ ...k,
203
+ ...e
217
204
  };
218
- return /* @__PURE__ */ b(
219
- a,
205
+ return /* @__PURE__ */ $(
206
+ T,
220
207
  {
221
- ref: r,
222
- className: et("pittorica-box", x),
223
- style: F,
224
- href: $,
225
- target: k,
226
- rel: w,
227
- htmlFor: N,
228
- type: C,
229
- name: A,
230
- disabled: j,
231
- ...B,
232
- children: e
208
+ className: ct("pittorica-box", w),
209
+ style: R,
210
+ disabled: N,
211
+ ...C,
212
+ children: i
233
213
  }
234
214
  );
235
215
  };
236
- z.displayName = "Box";
237
- function S(r) {
238
- var a, e, t = "";
239
- if (typeof r == "string" || typeof r == "number") t += r;
240
- else if (typeof r == "object") if (Array.isArray(r)) {
241
- var o = r.length;
242
- for (a = 0; a < o; a++) r[a] && (e = S(r[a])) && (t && (t += " "), t += e);
243
- } else for (e in r) r[e] && (t && (t += " "), t += e);
216
+ S.displayName = "Box";
217
+ function q(a) {
218
+ var i, r, t = "";
219
+ if (typeof a == "string" || typeof a == "number") t += a;
220
+ else if (typeof a == "object") if (Array.isArray(a)) {
221
+ var o = a.length;
222
+ for (i = 0; i < o; i++) a[i] && (r = q(a[i])) && (t && (t += " "), t += r);
223
+ } else for (r in a) a[r] && (t && (t += " "), t += r);
244
224
  return t;
245
225
  }
246
- function at() {
247
- for (var r, a, e = 0, t = "", o = arguments.length; e < o; e++) (r = arguments[e]) && (a = S(r)) && (t && (t += " "), t += a);
226
+ function B() {
227
+ for (var a, i, r = 0, t = "", o = arguments.length; r < o; r++) (a = arguments[r]) && (i = q(a)) && (t && (t += " "), t += i);
248
228
  return t;
249
229
  }
250
- function M(r) {
251
- var a, e, t = "";
252
- if (typeof r == "string" || typeof r == "number") t += r;
253
- else if (typeof r == "object") if (Array.isArray(r)) {
254
- var o = r.length;
255
- for (a = 0; a < o; a++) r[a] && (e = M(r[a])) && (t && (t += " "), t += e);
256
- } else for (e in r) r[e] && (t && (t += " "), t += e);
230
+ function M(a) {
231
+ var i, r, t = "";
232
+ if (typeof a == "string" || typeof a == "number") t += a;
233
+ else if (typeof a == "object") if (Array.isArray(a)) {
234
+ var o = a.length;
235
+ for (i = 0; i < o; i++) a[i] && (r = M(a[i])) && (t && (t += " "), t += r);
236
+ } else for (r in a) a[r] && (t && (t += " "), t += r);
257
237
  return t;
258
238
  }
259
- function it() {
260
- for (var r, a, e = 0, t = "", o = arguments.length; e < o; e++) (r = arguments[e]) && (a = M(r)) && (t && (t += " "), t += a);
239
+ function st() {
240
+ for (var a, i, r = 0, t = "", o = arguments.length; r < o; r++) (a = arguments[r]) && (i = M(a)) && (t && (t += " "), t += i);
261
241
  return t;
262
242
  }
263
243
  const E = ({
264
- ref: r,
265
- as: a = "div",
266
- children: e,
267
- display: t,
268
- m: o,
269
- mt: n,
270
- mr: l,
271
- mb: h,
272
- ml: p,
273
- p: m,
274
- pt: c,
275
- pr: g,
276
- pb: d,
244
+ as: a,
245
+ children: i,
246
+ display: r,
247
+ m: t,
248
+ mt: o,
249
+ mr: p,
250
+ mb: c,
251
+ ml: h,
252
+ mx: n,
253
+ my: l,
254
+ p: d,
255
+ pt: v,
256
+ pr: u,
257
+ pb: g,
277
258
  pl: s,
278
- width: u,
279
- height: f,
280
- position: v,
281
- style: y,
282
- className: x,
283
- href: $,
284
- target: k,
285
- rel: w,
286
- htmlFor: N,
287
- type: C,
288
- name: A,
289
- disabled: j,
290
- ...B
259
+ px: m,
260
+ py: f,
261
+ width: b,
262
+ height: y,
263
+ position: x,
264
+ style: k,
265
+ className: w,
266
+ disabled: N,
267
+ ...C
291
268
  }) => {
292
- const i = {};
293
- t && (i.display = t), u && (i.width = u), f && (i.height = f), v && (i.position = v), o && (i.margin = `var(--pittorica-space-${o})`), n && (i.marginTop = `var(--pittorica-space-${n})`), l && (i.marginRight = `var(--pittorica-space-${l})`), h && (i.marginBottom = `var(--pittorica-space-${h})`), p && (i.marginLeft = `var(--pittorica-space-${p})`), m && (i.padding = `var(--pittorica-space-${m})`), c && (i.paddingTop = `var(--pittorica-space-${c})`), g && (i.paddingRight = `var(--pittorica-space-${g})`), d && (i.paddingBottom = `var(--pittorica-space-${d})`), s && (i.paddingLeft = `var(--pittorica-space-${s})`);
294
- const F = {
295
- ...y,
296
- ...i
269
+ const T = a || "div", e = {};
270
+ r && (e.display = r), b && (e.width = b), y && (e.height = y), x && (e.position = x), t && (e.margin = `var(--pittorica-space-${t})`), o && (e.marginTop = `var(--pittorica-space-${o})`), p && (e.marginRight = `var(--pittorica-space-${p})`), c && (e.marginBottom = `var(--pittorica-space-${c})`), h && (e.marginLeft = `var(--pittorica-space-${h})`), n && (e.marginLeft = `var(--pittorica-space-${n})`, e.marginRight = `var(--pittorica-space-${n})`), l && (e.marginTop = `var(--pittorica-space-${l})`, e.marginBottom = `var(--pittorica-space-${l})`), d && (e.padding = `var(--pittorica-space-${d})`), v && (e.paddingTop = `var(--pittorica-space-${v})`), u && (e.paddingRight = `var(--pittorica-space-${u})`), g && (e.paddingBottom = `var(--pittorica-space-${g})`), s && (e.paddingLeft = `var(--pittorica-space-${s})`), m && (e.paddingLeft = `var(--pittorica-space-${m})`, e.paddingRight = `var(--pittorica-space-${m})`), f && (e.paddingTop = `var(--pittorica-space-${f})`, e.paddingBottom = `var(--pittorica-space-${f})`);
271
+ const R = {
272
+ ...k,
273
+ ...e
297
274
  };
298
- return /* @__PURE__ */ b(
299
- a,
275
+ return /* @__PURE__ */ $(
276
+ T,
300
277
  {
301
- ref: r,
302
- className: it("pittorica-box", x),
303
- style: F,
304
- href: $,
305
- target: k,
306
- rel: w,
307
- htmlFor: N,
308
- type: C,
309
- name: A,
310
- disabled: j,
311
- ...B,
312
- children: e
278
+ className: st("pittorica-box", w),
279
+ style: R,
280
+ disabled: N,
281
+ ...C,
282
+ children: i
313
283
  }
314
284
  );
315
285
  };
316
286
  E.displayName = "Box";
317
- const ot = ({
318
- children: r,
319
- as: a = "span",
320
- weight: e = "regular",
321
- align: t,
322
- truncate: o = !1,
323
- color: n,
324
- className: l,
325
- style: h,
326
- href: p,
327
- target: m,
328
- rel: c,
329
- htmlFor: g,
330
- name: d,
331
- ...s
287
+ const O = ({
288
+ children: a,
289
+ as: i,
290
+ size: r,
291
+ weight: t = "regular",
292
+ align: o,
293
+ truncate: p = !1,
294
+ color: c,
295
+ className: h,
296
+ style: n,
297
+ ...l
332
298
  }) => {
333
- const u = (n == null ? void 0 : n.startsWith("#")) || (n == null ? void 0 : n.startsWith("rgb")) || (n == null ? void 0 : n.startsWith("hsl")), f = /* @__PURE__ */ new Set([
299
+ const d = i || "span", v = (c == null ? void 0 : c.startsWith("#")) || (c == null ? void 0 : c.startsWith("rgb")) || (c == null ? void 0 : c.startsWith("hsl")), u = /* @__PURE__ */ new Set([
334
300
  "danger",
335
301
  "success",
336
302
  "error",
@@ -342,141 +308,155 @@ const ot = ({
342
308
  "slate",
343
309
  "blue",
344
310
  "red"
345
- ]), v = (() => {
346
- if (n)
347
- return n === "inherit" ? "inherit" : u ? n : f.has(n) ? `var(--pittorica-${n}-9)` : n;
348
- })(), y = {
349
- ...h,
350
- textAlign: t,
351
- color: v
311
+ ]), g = (() => {
312
+ if (c)
313
+ return c === "inherit" ? "inherit" : v ? c : u.has(c) ? `var(--pittorica-${c}-9)` : c;
314
+ })(), s = r ? typeof r == "string" ? `pittorica-text--size-${r}` : B({
315
+ [`pittorica-text--size-${r.initial}`]: r.initial,
316
+ [`pittorica-text--xs-size-${r.xs}`]: r.xs,
317
+ [`pittorica-text--sm-size-${r.sm}`]: r.sm,
318
+ [`pittorica-text--md-size-${r.md}`]: r.md,
319
+ [`pittorica-text--lg-size-${r.lg}`]: r.lg,
320
+ [`pittorica-text--xl-size-${r.xl}`]: r.xl
321
+ }) : null, m = {
322
+ ...n,
323
+ textAlign: o,
324
+ color: g
352
325
  };
353
- return /* @__PURE__ */ b(
326
+ return /* @__PURE__ */ $(
354
327
  E,
355
328
  {
356
- as: a,
357
- className: at(
329
+ as: d,
330
+ className: B(
358
331
  "pittorica-text",
359
- { "pittorica-text--truncate": o },
360
- l
332
+ s,
333
+ { "pittorica-text--truncate": p },
334
+ h
361
335
  ),
362
- "data-weight": e,
363
- style: y,
364
- href: p,
365
- target: m,
366
- rel: c,
367
- htmlFor: g,
368
- name: d,
369
- ...s,
370
- children: r
336
+ "data-weight": t,
337
+ style: m,
338
+ ...l,
339
+ children: a
371
340
  }
372
341
  );
373
- }, nt = ({
374
- checked: r,
375
- defaultChecked: a,
376
- onChange: e,
342
+ };
343
+ O.displayName = "Text";
344
+ const _ = ({
345
+ checked: a,
346
+ defaultChecked: i,
347
+ onChange: r,
377
348
  color: t = "indigo",
378
349
  disabled: o = !1,
379
- label: n,
380
- name: l,
350
+ label: p,
351
+ name: c,
381
352
  value: h,
382
- className: p,
383
- style: m,
384
- ...c
353
+ className: n,
354
+ style: l,
355
+ as: d,
356
+ ...v
385
357
  }) => {
386
- const [g, d] = D.useState(
387
- a ?? !1
388
- ), s = r === void 0 ? g : r, u = t !== "inherit" && !(t != null && t.startsWith("#")) && !(t != null && t.startsWith("rgb")) ? `var(--pittorica-${t}-9)` : t, f = (v) => {
358
+ const [u, g] = K.useState(
359
+ i ?? !1
360
+ ), s = a === void 0 ? u : a, m = t !== "inherit" && !(t != null && t.startsWith("#")) && !(t != null && t.startsWith("rgb")) ? `var(--pittorica-${t}-9)` : t, f = (b) => {
389
361
  if (o) return;
390
- const y = v.target.checked;
391
- d(y), e == null || e(y);
362
+ const y = b.target.checked;
363
+ g(y), r == null || r(y);
392
364
  };
393
- return /* @__PURE__ */ _(
394
- z,
365
+ return /* @__PURE__ */ J(
366
+ S,
395
367
  {
396
- as: "label",
397
- className: Z("pittorica-checkbox-root", p),
368
+ as: d || "label",
369
+ className: tt("pittorica-checkbox-root", n),
398
370
  "data-disabled": o,
399
- style: { "--_checkbox-color": u, ...m },
371
+ style: { "--_checkbox-color": m, ...l },
372
+ ...v,
400
373
  children: [
401
- /* @__PURE__ */ b(
374
+ /* @__PURE__ */ $(
402
375
  "input",
403
376
  {
404
377
  type: "checkbox",
405
378
  className: "pittorica-checkbox-input",
406
- name: l,
379
+ name: c,
407
380
  value: h,
408
381
  checked: s,
409
382
  disabled: o,
410
- onChange: f,
411
- ...c
383
+ onChange: f
412
384
  }
413
385
  ),
414
- /* @__PURE__ */ b("div", { className: "pittorica-checkbox-control", children: s ? /* @__PURE__ */ b(rt, { size: 20 }) : /* @__PURE__ */ b(V, { size: 20, stroke: 1.5 }) }),
415
- n && /* @__PURE__ */ b(ot, { weight: "medium", style: { color: "inherit" }, children: n })
386
+ /* @__PURE__ */ $("div", { className: "pittorica-checkbox-control", "aria-hidden": "true", children: s ? /* @__PURE__ */ $(ot, { size: 20 }) : /* @__PURE__ */ $(et, { size: 20, stroke: 1.5 }) }),
387
+ p && /* @__PURE__ */ $(O, { weight: "medium", style: { color: "inherit" }, children: p })
416
388
  ]
417
389
  }
418
390
  );
419
- }, O = J(
391
+ };
392
+ _.displayName = "Checkbox";
393
+ const D = Q(
420
394
  null
421
- ), st = ({
422
- value: r,
423
- defaultValue: a = [],
424
- onValueChange: e,
395
+ ), F = ({
396
+ value: a,
397
+ defaultValue: i = [],
398
+ onValueChange: r,
425
399
  orientation: t = "vertical",
426
400
  color: o,
427
- disabled: n,
428
- name: l,
401
+ disabled: p,
402
+ name: c,
429
403
  children: h,
430
- className: p,
431
- ...m
404
+ className: n,
405
+ as: l,
406
+ ...d
432
407
  }) => {
433
- const [c, g] = K(a), d = r !== void 0, s = d ? r : c;
434
- return /* @__PURE__ */ b(
435
- O,
408
+ const [v, u] = U(i), g = a !== void 0, s = g ? a : v, m = (y) => {
409
+ const x = s.includes(y) ? s.filter((k) => k !== y) : [...s, y];
410
+ g || u(x), r == null || r(x);
411
+ }, f = X(
412
+ () => ({
413
+ value: s,
414
+ onItemChange: m,
415
+ color: o,
416
+ disabled: p,
417
+ name: c
418
+ }),
419
+ [s, o, p, c]
420
+ );
421
+ return /* @__PURE__ */ $(D, { value: f, children: /* @__PURE__ */ $(
422
+ j,
436
423
  {
437
- value: {
438
- value: s,
439
- onItemChange: (f) => {
440
- const v = s.includes(f) ? s.filter((y) => y !== f) : [...s, f];
441
- d || g(v), e == null || e(v);
442
- },
443
- color: o,
444
- disabled: n,
445
- name: l
446
- },
447
- children: /* @__PURE__ */ b(
448
- W,
449
- {
450
- className: Q("pittorica-checkbox-group-root", p),
451
- "data-orientation": t,
452
- role: "group",
453
- ...m,
454
- children: h
455
- }
456
- )
424
+ as: l || "div",
425
+ className: Z("pittorica-checkbox-group-root", n),
426
+ "data-orientation": t,
427
+ role: "group",
428
+ ...d,
429
+ children: h
457
430
  }
458
- );
459
- }, ct = ({ value: r, ...a }) => {
460
- const e = P(O);
461
- if (!e)
431
+ ) });
432
+ }, H = ({
433
+ value: a,
434
+ as: i,
435
+ ...r
436
+ }) => {
437
+ const t = Y(D);
438
+ if (!t)
462
439
  throw new Error(
463
440
  "CheckboxGroup.Item must be used within CheckboxGroup.Root"
464
441
  );
465
- return /* @__PURE__ */ b(
466
- nt,
442
+ return /* @__PURE__ */ $(
443
+ _,
467
444
  {
468
- ...a,
469
- name: e.name,
470
- value: r,
471
- checked: e.value.includes(r),
472
- onChange: () => e.onItemChange(r),
473
- color: a.color || e.color,
474
- disabled: a.disabled || e.disabled
445
+ as: i || "label",
446
+ ...r,
447
+ name: t.name,
448
+ value: a,
449
+ checked: t.value.includes(a),
450
+ onChange: () => t.onItemChange(a),
451
+ color: r.color || t.color,
452
+ disabled: r.disabled || t.disabled
475
453
  }
476
454
  );
477
- }, dt = Object.assign(st, {
478
- Item: ct
455
+ }, lt = Object.assign(F, {
456
+ Item: H
479
457
  });
458
+ F.displayName = "CheckboxGroup.Root";
459
+ H.displayName = "CheckboxGroup.Item";
480
460
  export {
481
- dt as CheckboxGroup
461
+ lt as CheckboxGroup
482
462
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pittorica/checkbox-group-react",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -10,9 +10,9 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "clsx": "^2.1.1",
13
- "@pittorica/text-react": "0.24.0",
14
- "@pittorica/checkbox-react": "0.24.0",
15
- "@pittorica/box-react": "0.24.0"
13
+ "@pittorica/box-react": "0.25.0",
14
+ "@pittorica/text-react": "0.25.0",
15
+ "@pittorica/checkbox-react": "0.25.0"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@testing-library/jest-dom": "^6.9.1",
@@ -24,8 +24,8 @@
24
24
  "typescript": "^5.0.0",
25
25
  "vite": "^5.0.0",
26
26
  "vitest": "^2.1.9",
27
- "@pittorica/theme-react": "0.24.0",
28
- "pittorica": "0.24.0"
27
+ "@pittorica/theme-react": "0.25.0",
28
+ "pittorica": "0.25.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": ">=19",
@@ -36,7 +36,6 @@
36
36
  "build:js": "vite build",
37
37
  "build:types": "tsc -p tsconfig.json",
38
38
  "clean": "rm -rf dist",
39
- "dev": "vite",
40
39
  "test": "vitest run",
41
40
  "test:watch": "vitest"
42
41
  }