@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.
- package/dist/CheckboxGroup.d.ts +19 -6
- package/dist/CheckboxGroup.d.ts.map +1 -1
- package/dist/index.js +304 -324
- package/package.json +6 -7
package/dist/CheckboxGroup.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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:
|
|
17
|
-
|
|
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":"
|
|
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
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
var
|
|
5
|
-
if (typeof
|
|
6
|
-
else if (typeof
|
|
7
|
-
var o =
|
|
8
|
-
for (
|
|
9
|
-
} else for (
|
|
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
|
|
13
|
-
for (var
|
|
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
|
|
17
|
-
var
|
|
18
|
-
if (typeof
|
|
19
|
-
else if (typeof
|
|
20
|
-
var o =
|
|
21
|
-
for (
|
|
22
|
-
} else for (
|
|
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
|
|
26
|
-
for (var
|
|
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
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
...
|
|
62
|
-
...
|
|
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__ */
|
|
65
|
-
|
|
61
|
+
return /* @__PURE__ */ $(
|
|
62
|
+
T,
|
|
66
63
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
83
|
-
function
|
|
84
|
-
var
|
|
85
|
-
if (typeof
|
|
86
|
-
else if (typeof
|
|
87
|
-
var o =
|
|
88
|
-
for (
|
|
89
|
-
} else for (
|
|
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
|
|
93
|
-
for (var
|
|
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
|
|
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
|
|
130
|
-
const o =
|
|
131
|
-
({ color:
|
|
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:
|
|
135
|
-
...
|
|
136
|
-
width:
|
|
137
|
-
height:
|
|
138
|
-
className: ["tabler-icon", `tabler-icon-${
|
|
139
|
-
...
|
|
140
|
-
fill:
|
|
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:
|
|
133
|
+
stroke: p
|
|
144
134
|
},
|
|
145
|
-
...
|
|
135
|
+
...v
|
|
146
136
|
},
|
|
147
137
|
[
|
|
148
|
-
|
|
149
|
-
...t.map(([
|
|
150
|
-
...Array.isArray(
|
|
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 = `${
|
|
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
|
|
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
|
|
170
|
-
function
|
|
171
|
-
var
|
|
172
|
-
if (typeof
|
|
173
|
-
else if (typeof
|
|
174
|
-
var o =
|
|
175
|
-
for (
|
|
176
|
-
} else for (
|
|
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
|
|
180
|
-
for (var
|
|
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
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
...
|
|
216
|
-
...
|
|
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__ */
|
|
219
|
-
|
|
205
|
+
return /* @__PURE__ */ $(
|
|
206
|
+
T,
|
|
220
207
|
{
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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
|
-
|
|
237
|
-
function
|
|
238
|
-
var
|
|
239
|
-
if (typeof
|
|
240
|
-
else if (typeof
|
|
241
|
-
var o =
|
|
242
|
-
for (
|
|
243
|
-
} else for (
|
|
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
|
|
247
|
-
for (var
|
|
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(
|
|
251
|
-
var
|
|
252
|
-
if (typeof
|
|
253
|
-
else if (typeof
|
|
254
|
-
var o =
|
|
255
|
-
for (
|
|
256
|
-
} else for (
|
|
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
|
|
260
|
-
for (var
|
|
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
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
...
|
|
296
|
-
...
|
|
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__ */
|
|
299
|
-
|
|
275
|
+
return /* @__PURE__ */ $(
|
|
276
|
+
T,
|
|
300
277
|
{
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
|
318
|
-
children:
|
|
319
|
-
as:
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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
|
|
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
|
-
]),
|
|
346
|
-
if (
|
|
347
|
-
return
|
|
348
|
-
})(),
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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__ */
|
|
326
|
+
return /* @__PURE__ */ $(
|
|
354
327
|
E,
|
|
355
328
|
{
|
|
356
|
-
as:
|
|
357
|
-
className:
|
|
329
|
+
as: d,
|
|
330
|
+
className: B(
|
|
358
331
|
"pittorica-text",
|
|
359
|
-
|
|
360
|
-
|
|
332
|
+
s,
|
|
333
|
+
{ "pittorica-text--truncate": p },
|
|
334
|
+
h
|
|
361
335
|
),
|
|
362
|
-
"data-weight":
|
|
363
|
-
style:
|
|
364
|
-
|
|
365
|
-
|
|
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
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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:
|
|
380
|
-
name:
|
|
350
|
+
label: p,
|
|
351
|
+
name: c,
|
|
381
352
|
value: h,
|
|
382
|
-
className:
|
|
383
|
-
style:
|
|
384
|
-
|
|
353
|
+
className: n,
|
|
354
|
+
style: l,
|
|
355
|
+
as: d,
|
|
356
|
+
...v
|
|
385
357
|
}) => {
|
|
386
|
-
const [
|
|
387
|
-
|
|
388
|
-
), s =
|
|
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 =
|
|
391
|
-
|
|
362
|
+
const y = b.target.checked;
|
|
363
|
+
g(y), r == null || r(y);
|
|
392
364
|
};
|
|
393
|
-
return /* @__PURE__ */
|
|
394
|
-
|
|
365
|
+
return /* @__PURE__ */ J(
|
|
366
|
+
S,
|
|
395
367
|
{
|
|
396
|
-
as: "label",
|
|
397
|
-
className:
|
|
368
|
+
as: d || "label",
|
|
369
|
+
className: tt("pittorica-checkbox-root", n),
|
|
398
370
|
"data-disabled": o,
|
|
399
|
-
style: { "--_checkbox-color":
|
|
371
|
+
style: { "--_checkbox-color": m, ...l },
|
|
372
|
+
...v,
|
|
400
373
|
children: [
|
|
401
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ $(
|
|
402
375
|
"input",
|
|
403
376
|
{
|
|
404
377
|
type: "checkbox",
|
|
405
378
|
className: "pittorica-checkbox-input",
|
|
406
|
-
name:
|
|
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__ */
|
|
415
|
-
|
|
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
|
-
}
|
|
391
|
+
};
|
|
392
|
+
_.displayName = "Checkbox";
|
|
393
|
+
const D = Q(
|
|
420
394
|
null
|
|
421
|
-
),
|
|
422
|
-
value:
|
|
423
|
-
defaultValue:
|
|
424
|
-
onValueChange:
|
|
395
|
+
), F = ({
|
|
396
|
+
value: a,
|
|
397
|
+
defaultValue: i = [],
|
|
398
|
+
onValueChange: r,
|
|
425
399
|
orientation: t = "vertical",
|
|
426
400
|
color: o,
|
|
427
|
-
disabled:
|
|
428
|
-
name:
|
|
401
|
+
disabled: p,
|
|
402
|
+
name: c,
|
|
429
403
|
children: h,
|
|
430
|
-
className:
|
|
431
|
-
|
|
404
|
+
className: n,
|
|
405
|
+
as: l,
|
|
406
|
+
...d
|
|
432
407
|
}) => {
|
|
433
|
-
const [
|
|
434
|
-
|
|
435
|
-
|
|
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
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
-
},
|
|
460
|
-
|
|
461
|
-
|
|
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__ */
|
|
466
|
-
|
|
442
|
+
return /* @__PURE__ */ $(
|
|
443
|
+
_,
|
|
467
444
|
{
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
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
|
-
},
|
|
478
|
-
Item:
|
|
455
|
+
}, lt = Object.assign(F, {
|
|
456
|
+
Item: H
|
|
479
457
|
});
|
|
458
|
+
F.displayName = "CheckboxGroup.Root";
|
|
459
|
+
H.displayName = "CheckboxGroup.Item";
|
|
480
460
|
export {
|
|
481
|
-
|
|
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.
|
|
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/
|
|
14
|
-
"@pittorica/
|
|
15
|
-
"@pittorica/
|
|
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.
|
|
28
|
-
"pittorica": "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
|
}
|