@pittorica/radio-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/Radio.d.ts +8 -5
- package/dist/Radio.d.ts.map +1 -1
- package/dist/index.js +99 -108
- package/package.json +6 -7
package/dist/Radio.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ElementType } from 'react';
|
|
2
2
|
import { type BoxProps } from '@pittorica/box-react';
|
|
3
3
|
import type { PittoricaColor } from '@pittorica/text-react';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Fix TS2314 & TS2312: Use 'type' alias for intersection with polymorphic BoxProps<E>.
|
|
6
|
+
*/
|
|
7
|
+
export type RadioProps<E extends ElementType = 'button'> = Omit<BoxProps<E>, 'onChange'> & {
|
|
5
8
|
checked?: boolean;
|
|
6
9
|
defaultChecked?: boolean;
|
|
7
10
|
disabled?: boolean;
|
|
@@ -10,13 +13,13 @@ export interface RadioProps extends Omit<BoxProps, 'onChange'> {
|
|
|
10
13
|
value?: string;
|
|
11
14
|
name?: string;
|
|
12
15
|
onCheckedChange?: (checked: boolean) => void;
|
|
13
|
-
|
|
14
|
-
}
|
|
16
|
+
};
|
|
15
17
|
/**
|
|
16
18
|
* Primitive Radio component.
|
|
19
|
+
* Fully polymorphic and agnostic foundation.
|
|
17
20
|
*/
|
|
18
21
|
export declare const Radio: {
|
|
19
|
-
({ checked, disabled, color, className, style, onCheckedChange, name,
|
|
22
|
+
<E extends ElementType = "button">({ checked, disabled, color, className, style, onCheckedChange, name, as, ...props }: RadioProps<E>): import("react/jsx-runtime").JSX.Element;
|
|
20
23
|
displayName: string;
|
|
21
24
|
};
|
|
22
25
|
//# sourceMappingURL=Radio.d.ts.map
|
package/dist/Radio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../src/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../src/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,WAAW,EAAmB,MAAM,OAAO,CAAC;AAM9E,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,IAAI,IAAI,CAC7D,QAAQ,CAAC,CAAC,CAAC,EACX,UAAU,CACX,GAAG;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wBAAwB;IACxB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,KAAK;KAAI,CAAC,SAAS,WAAW,kGAUxC,UAAU,CAAC,CAAC,CAAC;;CA0Cf,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
function
|
|
4
|
-
var
|
|
5
|
-
if (typeof t == "string" || typeof t == "number")
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as _, createElement as $ } from "react";
|
|
3
|
+
function x(t) {
|
|
4
|
+
var r, i, a = "";
|
|
5
|
+
if (typeof t == "string" || typeof t == "number") a += t;
|
|
6
6
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
7
|
-
var
|
|
8
|
-
for (
|
|
9
|
-
} else for (i in t) t[i] && (
|
|
10
|
-
return
|
|
7
|
+
var o = t.length;
|
|
8
|
+
for (r = 0; r < o; r++) t[r] && (i = x(t[r])) && (a && (a += " "), a += i);
|
|
9
|
+
} else for (i in t) t[i] && (a && (a += " "), a += i);
|
|
10
|
+
return a;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
for (var t,
|
|
14
|
-
return
|
|
12
|
+
function z() {
|
|
13
|
+
for (var t, r, i = 0, a = "", o = arguments.length; i < o; i++) (t = arguments[i]) && (r = x(t)) && (a && (a += " "), a += r);
|
|
14
|
+
return a;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* @license @tabler/icons-react v3.36.1 - MIT
|
|
@@ -19,7 +19,7 @@ function M() {
|
|
|
19
19
|
* This source code is licensed under the MIT license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
21
|
*/
|
|
22
|
-
var
|
|
22
|
+
var F = {
|
|
23
23
|
outline: {
|
|
24
24
|
xmlns: "http://www.w3.org/2000/svg",
|
|
25
25
|
width: 24,
|
|
@@ -46,32 +46,32 @@ var S = {
|
|
|
46
46
|
* This source code is licensed under the MIT license.
|
|
47
47
|
* See the LICENSE file in the root directory of this source tree.
|
|
48
48
|
*/
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
({ color: s = "currentColor", size:
|
|
49
|
+
const N = (t, r, i, a) => {
|
|
50
|
+
const o = _(
|
|
51
|
+
({ color: s = "currentColor", size: p = 24, stroke: d = 2, title: n, className: m, children: c, ...l }, g) => $(
|
|
52
52
|
"svg",
|
|
53
53
|
{
|
|
54
|
-
ref:
|
|
55
|
-
...
|
|
56
|
-
width:
|
|
57
|
-
height:
|
|
58
|
-
className: ["tabler-icon", `tabler-icon-${
|
|
54
|
+
ref: g,
|
|
55
|
+
...F[t],
|
|
56
|
+
width: p,
|
|
57
|
+
height: p,
|
|
58
|
+
className: ["tabler-icon", `tabler-icon-${r}`, m].join(" "),
|
|
59
59
|
...t === "filled" ? {
|
|
60
60
|
fill: s
|
|
61
61
|
} : {
|
|
62
|
-
strokeWidth:
|
|
62
|
+
strokeWidth: d,
|
|
63
63
|
stroke: s
|
|
64
64
|
},
|
|
65
|
-
...
|
|
65
|
+
...l
|
|
66
66
|
},
|
|
67
67
|
[
|
|
68
|
-
|
|
69
|
-
...
|
|
70
|
-
...Array.isArray(
|
|
68
|
+
n && $("title", { key: "svg-title" }, n),
|
|
69
|
+
...a.map(([f, v]) => $(f, v)),
|
|
70
|
+
...Array.isArray(c) ? c : [c]
|
|
71
71
|
]
|
|
72
72
|
)
|
|
73
73
|
);
|
|
74
|
-
return
|
|
74
|
+
return o.displayName = `${i}`, o;
|
|
75
75
|
};
|
|
76
76
|
/**
|
|
77
77
|
* @license @tabler/icons-react v3.36.1 - MIT
|
|
@@ -79,116 +79,107 @@ const $ = (t, e, i, r) => {
|
|
|
79
79
|
* This source code is licensed under the MIT license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
81
|
*/
|
|
82
|
-
const
|
|
82
|
+
const I = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0", key: "svg-0" }]], M = N("outline", "circle", "Circle", I);
|
|
83
83
|
/**
|
|
84
84
|
* @license @tabler/icons-react v3.36.1 - MIT
|
|
85
85
|
*
|
|
86
86
|
* This source code is licensed under the MIT license.
|
|
87
87
|
* See the LICENSE file in the root directory of this source tree.
|
|
88
88
|
*/
|
|
89
|
-
const
|
|
90
|
-
function
|
|
91
|
-
var
|
|
92
|
-
if (typeof t == "string" || typeof t == "number")
|
|
89
|
+
const S = [["path", { d: "M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z", key: "svg-0" }]], E = N("filled", "circle-check-filled", "CircleCheckFilled", S);
|
|
90
|
+
function A(t) {
|
|
91
|
+
var r, i, a = "";
|
|
92
|
+
if (typeof t == "string" || typeof t == "number") a += t;
|
|
93
93
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
94
|
-
var
|
|
95
|
-
for (
|
|
96
|
-
} else for (i in t) t[i] && (
|
|
97
|
-
return
|
|
94
|
+
var o = t.length;
|
|
95
|
+
for (r = 0; r < o; r++) t[r] && (i = A(t[r])) && (a && (a += " "), a += i);
|
|
96
|
+
} else for (i in t) t[i] && (a && (a += " "), a += i);
|
|
97
|
+
return a;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
for (var t,
|
|
101
|
-
return
|
|
99
|
+
function q() {
|
|
100
|
+
for (var t, r, i = 0, a = "", o = arguments.length; i < o; i++) (t = arguments[i]) && (r = A(t)) && (a && (a += " "), a += r);
|
|
101
|
+
return a;
|
|
102
102
|
}
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
display: r,
|
|
103
|
+
const C = ({
|
|
104
|
+
as: t,
|
|
105
|
+
children: r,
|
|
106
|
+
display: i,
|
|
108
107
|
m: a,
|
|
109
|
-
mt:
|
|
110
|
-
mr:
|
|
111
|
-
mb:
|
|
112
|
-
ml:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
mt: o,
|
|
109
|
+
mr: s,
|
|
110
|
+
mb: p,
|
|
111
|
+
ml: d,
|
|
112
|
+
mx: n,
|
|
113
|
+
my: m,
|
|
114
|
+
p: c,
|
|
115
|
+
pt: l,
|
|
116
|
+
pr: g,
|
|
116
117
|
pb: f,
|
|
117
|
-
pl:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
type: F,
|
|
128
|
-
name: L,
|
|
129
|
-
disabled: W,
|
|
130
|
-
..._
|
|
118
|
+
pl: v,
|
|
119
|
+
px: h,
|
|
120
|
+
py: y,
|
|
121
|
+
width: b,
|
|
122
|
+
height: w,
|
|
123
|
+
position: k,
|
|
124
|
+
style: R,
|
|
125
|
+
className: B,
|
|
126
|
+
disabled: L,
|
|
127
|
+
...T
|
|
131
128
|
}) => {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
...
|
|
136
|
-
...
|
|
129
|
+
const j = t || "div", e = {};
|
|
130
|
+
i && (e.display = i), b && (e.width = b), w && (e.height = w), k && (e.position = k), a && (e.margin = `var(--pittorica-space-${a})`), o && (e.marginTop = `var(--pittorica-space-${o})`), s && (e.marginRight = `var(--pittorica-space-${s})`), p && (e.marginBottom = `var(--pittorica-space-${p})`), d && (e.marginLeft = `var(--pittorica-space-${d})`), n && (e.marginLeft = `var(--pittorica-space-${n})`, e.marginRight = `var(--pittorica-space-${n})`), m && (e.marginTop = `var(--pittorica-space-${m})`, e.marginBottom = `var(--pittorica-space-${m})`), c && (e.padding = `var(--pittorica-space-${c})`), l && (e.paddingTop = `var(--pittorica-space-${l})`), g && (e.paddingRight = `var(--pittorica-space-${g})`), f && (e.paddingBottom = `var(--pittorica-space-${f})`), v && (e.paddingLeft = `var(--pittorica-space-${v})`), h && (e.paddingLeft = `var(--pittorica-space-${h})`, e.paddingRight = `var(--pittorica-space-${h})`), y && (e.paddingTop = `var(--pittorica-space-${y})`, e.paddingBottom = `var(--pittorica-space-${y})`);
|
|
131
|
+
const W = {
|
|
132
|
+
...R,
|
|
133
|
+
...e
|
|
137
134
|
};
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
|
|
135
|
+
return /* @__PURE__ */ u(
|
|
136
|
+
j,
|
|
140
137
|
{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
rel: B,
|
|
147
|
-
htmlFor: C,
|
|
148
|
-
type: F,
|
|
149
|
-
name: L,
|
|
150
|
-
disabled: W,
|
|
151
|
-
..._,
|
|
152
|
-
children: i
|
|
138
|
+
className: q("pittorica-box", B),
|
|
139
|
+
style: W,
|
|
140
|
+
disabled: L,
|
|
141
|
+
...T,
|
|
142
|
+
children: r
|
|
153
143
|
}
|
|
154
144
|
);
|
|
155
145
|
};
|
|
156
|
-
|
|
157
|
-
const
|
|
146
|
+
C.displayName = "Box";
|
|
147
|
+
const D = ({
|
|
158
148
|
checked: t,
|
|
159
|
-
disabled:
|
|
149
|
+
disabled: r,
|
|
160
150
|
color: i = "indigo",
|
|
161
|
-
className:
|
|
162
|
-
style:
|
|
151
|
+
className: a,
|
|
152
|
+
style: o,
|
|
163
153
|
onCheckedChange: s,
|
|
164
|
-
name:
|
|
165
|
-
|
|
166
|
-
...
|
|
154
|
+
name: p,
|
|
155
|
+
as: d,
|
|
156
|
+
...n
|
|
167
157
|
}) => {
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
158
|
+
const c = i !== "inherit" && !(i != null && i.startsWith("#")) && !(i != null && i.startsWith("rgb")) ? `var(--pittorica-${i}-9)` : i, l = d || "button", g = (f) => {
|
|
159
|
+
r || (s == null || s(!t), typeof n.onClick == "function" && n.onClick(f));
|
|
160
|
+
};
|
|
161
|
+
return /* @__PURE__ */ u(
|
|
162
|
+
C,
|
|
171
163
|
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
type: "button",
|
|
164
|
+
as: l,
|
|
165
|
+
type: l === "button" ? "button" : void 0,
|
|
175
166
|
role: "radio",
|
|
176
|
-
name:
|
|
167
|
+
name: p,
|
|
177
168
|
"aria-checked": t,
|
|
178
169
|
"data-state": t ? "checked" : "unchecked",
|
|
179
|
-
disabled:
|
|
180
|
-
className:
|
|
181
|
-
onClick:
|
|
182
|
-
ref: c,
|
|
170
|
+
disabled: r,
|
|
171
|
+
className: z("pittorica-radio-root", a),
|
|
172
|
+
onClick: g,
|
|
183
173
|
style: {
|
|
184
|
-
"--pittorica-source-color":
|
|
185
|
-
...
|
|
174
|
+
"--pittorica-source-color": c,
|
|
175
|
+
...o
|
|
186
176
|
},
|
|
187
|
-
|
|
177
|
+
...n,
|
|
178
|
+
children: t ? /* @__PURE__ */ u(E, { size: 14 }) : /* @__PURE__ */ u(M, { size: 14, opacity: 0.5 })
|
|
188
179
|
}
|
|
189
180
|
);
|
|
190
181
|
};
|
|
191
|
-
|
|
182
|
+
D.displayName = "Radio";
|
|
192
183
|
export {
|
|
193
|
-
|
|
184
|
+
D as Radio
|
|
194
185
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pittorica/radio-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",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@tabler/icons-react": "^3.36.1",
|
|
13
13
|
"clsx": "^2.1.1",
|
|
14
|
-
"@pittorica/box-react": "0.
|
|
15
|
-
"@pittorica/text-react": "0.
|
|
14
|
+
"@pittorica/box-react": "0.25.0",
|
|
15
|
+
"@pittorica/text-react": "0.25.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"typescript": "^5.0.0",
|
|
25
25
|
"vite": "^5.0.0",
|
|
26
26
|
"vitest": "^2.1.9",
|
|
27
|
-
"@pittorica/
|
|
28
|
-
"@pittorica/
|
|
29
|
-
"pittorica": "0.
|
|
27
|
+
"@pittorica/flex-react": "0.25.0",
|
|
28
|
+
"@pittorica/theme-react": "0.25.0",
|
|
29
|
+
"pittorica": "0.25.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=19",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"build:js": "vite build",
|
|
38
38
|
"build:types": "tsc -p tsconfig.json",
|
|
39
39
|
"clean": "rm -rf dist",
|
|
40
|
-
"dev": "vite",
|
|
41
40
|
"test": "vitest run",
|
|
42
41
|
"test:watch": "vitest"
|
|
43
42
|
}
|