@serendie/ui 1.0.0 → 1.0.1
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.
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
const l = (t) => /* @__PURE__ */ e.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M3.25 6C3.25 4.48122 4.48122 3.25 6 3.25H18C19.5188 3.25 20.75 4.48122 20.75 6V18C20.75 19.5188 19.5188 20.75 18 20.75H6C4.48122 20.75 3.25 19.5188 3.25 18V6Z", fill: "currentColor" }), /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M17 12.75H7V11.25H17V12.75Z", fill: "currentColor", className: "checkmark" }));
|
|
3
|
+
export {
|
|
4
|
+
l as default
|
|
5
|
+
};
|
|
@@ -3,6 +3,8 @@ export declare const ChoiceBoxStyle: import('../../../styled-system/types').Slot
|
|
|
3
3
|
type ChoiceBoxBaseProps = {
|
|
4
4
|
type: "radio" | "checkbox";
|
|
5
5
|
};
|
|
6
|
-
export type ChoiceBoxProps = ChoiceBoxBaseProps & RadioGroupItemProps & CheckboxRootProps
|
|
6
|
+
export type ChoiceBoxProps = ChoiceBoxBaseProps & RadioGroupItemProps & CheckboxRootProps & {
|
|
7
|
+
indeterminate?: boolean;
|
|
8
|
+
};
|
|
7
9
|
export declare const ChoiceBox: React.FC<ChoiceBoxProps>;
|
|
8
10
|
export {};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as k, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import "../../styled-system/css/css.js";
|
|
3
|
-
import { cx as
|
|
3
|
+
import { cx as s } from "../../styled-system/css/cx.js";
|
|
4
4
|
import "../../styled-system/helpers.js";
|
|
5
|
-
import { sva as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import x from "../../assets/
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
5
|
+
import { sva as C } from "../../styled-system/css/sva.js";
|
|
6
|
+
import I from "../../assets/checkboxChecked.svg.js";
|
|
7
|
+
import l from "../../assets/checkboxUnchecked.svg.js";
|
|
8
|
+
import p from "../../assets/checkboxIndeterminate.svg.js";
|
|
9
|
+
import x from "../../assets/radioChecked.svg.js";
|
|
10
|
+
import b from "../../assets/radioUnchecked.svg.js";
|
|
11
|
+
import { checkboxUncheckedIconCss as u, checkboxCheckedIconCss as U, checkboxIconCss as R } from "../CheckBox/CheckBox.js";
|
|
12
|
+
import { radioUncheckedIconCss as N, radioCheckedIconCss as g, radioIconCss as v } from "../RadioButton/RadioButton.js";
|
|
13
|
+
import { useRef as S, useEffect as y } from "react";
|
|
14
|
+
import { RadioGroupItem as G } from "../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js";
|
|
15
|
+
import { RadioGroupItemContext as P } from "../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-context.js";
|
|
16
|
+
import { RadioGroupItemControl as j } from "../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js";
|
|
17
|
+
import { RadioGroupItemHiddenInput as B } from "../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-hidden-input.js";
|
|
18
|
+
import { CheckboxRoot as H } from "../../node_modules/@ark-ui/react/dist/components/checkbox/checkbox-root.js";
|
|
19
|
+
import { CheckboxContext as D } from "../../node_modules/@ark-ui/react/dist/components/checkbox/checkbox-context.js";
|
|
20
|
+
import { CheckboxControl as E } from "../../node_modules/@ark-ui/react/dist/components/checkbox/checkbox-control.js";
|
|
21
|
+
import { CheckboxHiddenInput as V } from "../../node_modules/@ark-ui/react/dist/components/checkbox/checkbox-hidden-input.js";
|
|
22
|
+
const a = C({
|
|
21
23
|
slots: [
|
|
22
24
|
"root",
|
|
23
25
|
"radioItem",
|
|
@@ -31,53 +33,70 @@ const h = a({
|
|
|
31
33
|
root: {
|
|
32
34
|
display: "flex"
|
|
33
35
|
},
|
|
34
|
-
radioItem:
|
|
35
|
-
radioCheckedIcon:
|
|
36
|
-
radioUncheckedIcon:
|
|
37
|
-
checkboxItem:
|
|
38
|
-
checkboxCheckedIcon:
|
|
39
|
-
checkboxUncheckedIcon:
|
|
36
|
+
radioItem: v,
|
|
37
|
+
radioCheckedIcon: g,
|
|
38
|
+
radioUncheckedIcon: N,
|
|
39
|
+
checkboxItem: R,
|
|
40
|
+
checkboxCheckedIcon: U,
|
|
41
|
+
checkboxUncheckedIcon: u
|
|
40
42
|
}
|
|
41
|
-
}),
|
|
42
|
-
type:
|
|
43
|
-
value:
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
}), ro = ({
|
|
44
|
+
type: n,
|
|
45
|
+
value: m,
|
|
46
|
+
indeterminate: i,
|
|
47
|
+
className: d,
|
|
48
|
+
...e
|
|
46
49
|
}) => {
|
|
47
|
-
const [
|
|
48
|
-
if (
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
|
|
50
|
+
const [f, h] = a.splitVariantProps(e), c = a(f);
|
|
51
|
+
if (n === "radio")
|
|
52
|
+
return /* @__PURE__ */ k(
|
|
53
|
+
G,
|
|
51
54
|
{
|
|
52
|
-
value:
|
|
53
|
-
className:
|
|
54
|
-
...
|
|
55
|
+
value: m,
|
|
56
|
+
className: s("group", c.root, d),
|
|
57
|
+
...h,
|
|
55
58
|
children: [
|
|
56
|
-
/* @__PURE__ */ o(
|
|
57
|
-
/* @__PURE__ */ o(
|
|
59
|
+
/* @__PURE__ */ o(P, { children: (r) => /* @__PURE__ */ o(j, { className: c.radioItem, asChild: !0, children: r.checked ? /* @__PURE__ */ o(x, { className: c.radioCheckedIcon }) : /* @__PURE__ */ o(b, { className: c.radioUncheckedIcon }) }) }),
|
|
60
|
+
/* @__PURE__ */ o(B, {})
|
|
58
61
|
]
|
|
59
62
|
}
|
|
60
63
|
);
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
if (n === "checkbox") {
|
|
65
|
+
const r = S(null);
|
|
66
|
+
return y(() => {
|
|
67
|
+
r.current && (r.current.indeterminate = !!i);
|
|
68
|
+
}, [i]), /* @__PURE__ */ k(
|
|
69
|
+
H,
|
|
64
70
|
{
|
|
65
|
-
value:
|
|
66
|
-
className:
|
|
67
|
-
...
|
|
71
|
+
value: m,
|
|
72
|
+
className: s("group", c.root, d),
|
|
73
|
+
...h,
|
|
74
|
+
onClick: (t) => {
|
|
75
|
+
if (i) {
|
|
76
|
+
t.preventDefault(), typeof e.onClick == "function" && e.onClick(t);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
typeof e.onClick == "function" && e.onClick(t);
|
|
80
|
+
},
|
|
68
81
|
children: [
|
|
69
|
-
/* @__PURE__ */ o(
|
|
70
|
-
|
|
82
|
+
/* @__PURE__ */ o(D, { children: (t) => /* @__PURE__ */ o(E, { className: c.checkboxItem, children: t.checked ? /* @__PURE__ */ o(I, { className: c.checkboxCheckedIcon }) : i ? /* @__PURE__ */ o(
|
|
83
|
+
p,
|
|
84
|
+
{
|
|
85
|
+
className: c.checkboxCheckedIcon
|
|
86
|
+
}
|
|
87
|
+
) : /* @__PURE__ */ o(
|
|
88
|
+
l,
|
|
71
89
|
{
|
|
72
90
|
className: c.checkboxUncheckedIcon
|
|
73
91
|
}
|
|
74
92
|
) }) }),
|
|
75
|
-
/* @__PURE__ */ o(
|
|
93
|
+
/* @__PURE__ */ o(V, { ref: r })
|
|
76
94
|
]
|
|
77
95
|
}
|
|
78
96
|
);
|
|
97
|
+
}
|
|
79
98
|
};
|
|
80
99
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
100
|
+
ro as ChoiceBox,
|
|
101
|
+
a as ChoiceBoxStyle
|
|
83
102
|
};
|
package/package.json
CHANGED