@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 d, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as k, jsx as o } from "react/jsx-runtime";
2
2
  import "../../styled-system/css/css.js";
3
- import { cx as n } from "../../styled-system/css/cx.js";
3
+ import { cx as s } from "../../styled-system/css/cx.js";
4
4
  import "../../styled-system/helpers.js";
5
- import { sva as a } from "../../styled-system/css/sva.js";
6
- import p from "../../assets/checkboxChecked.svg.js";
7
- import I from "../../assets/checkboxUnchecked.svg.js";
8
- import C from "../../assets/radioChecked.svg.js";
9
- import x from "../../assets/radioUnchecked.svg.js";
10
- import { checkboxUncheckedIconCss as l, checkboxCheckedIconCss as b, checkboxIconCss as f } from "../CheckBox/CheckBox.js";
11
- import { radioUncheckedIconCss as u, radioCheckedIconCss as U, radioIconCss as N } from "../RadioButton/RadioButton.js";
12
- import { RadioGroupItem as R } from "../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js";
13
- import { RadioGroupItemContext as g } from "../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-context.js";
14
- import { RadioGroupItemControl as v } from "../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js";
15
- import { RadioGroupItemHiddenInput as S } from "../../node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-hidden-input.js";
16
- import { CheckboxRoot as G } from "../../node_modules/@ark-ui/react/dist/components/checkbox/checkbox-root.js";
17
- import { CheckboxContext as P } from "../../node_modules/@ark-ui/react/dist/components/checkbox/checkbox-context.js";
18
- import { CheckboxControl as j } from "../../node_modules/@ark-ui/react/dist/components/checkbox/checkbox-control.js";
19
- import { CheckboxHiddenInput as y } from "../../node_modules/@ark-ui/react/dist/components/checkbox/checkbox-hidden-input.js";
20
- const h = a({
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: N,
35
- radioCheckedIcon: U,
36
- radioUncheckedIcon: u,
37
- checkboxItem: f,
38
- checkboxCheckedIcon: b,
39
- checkboxUncheckedIcon: l
36
+ radioItem: v,
37
+ radioCheckedIcon: g,
38
+ radioUncheckedIcon: N,
39
+ checkboxItem: R,
40
+ checkboxCheckedIcon: U,
41
+ checkboxUncheckedIcon: u
40
42
  }
41
- }), Y = ({
42
- type: r,
43
- value: t,
44
- className: i,
45
- ...s
43
+ }), ro = ({
44
+ type: n,
45
+ value: m,
46
+ indeterminate: i,
47
+ className: d,
48
+ ...e
46
49
  }) => {
47
- const [k, m] = h.splitVariantProps(s), c = h(k);
48
- if (r === "radio")
49
- return /* @__PURE__ */ d(
50
- R,
50
+ const [f, h] = a.splitVariantProps(e), c = a(f);
51
+ if (n === "radio")
52
+ return /* @__PURE__ */ k(
53
+ G,
51
54
  {
52
- value: t,
53
- className: n("group", c.root, i),
54
- ...m,
55
+ value: m,
56
+ className: s("group", c.root, d),
57
+ ...h,
55
58
  children: [
56
- /* @__PURE__ */ o(g, { children: (e) => /* @__PURE__ */ o(v, { className: c.radioItem, asChild: !0, children: e.checked ? /* @__PURE__ */ o(C, { className: c.radioCheckedIcon }) : /* @__PURE__ */ o(x, { className: c.radioUncheckedIcon }) }) }),
57
- /* @__PURE__ */ o(S, {})
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 (r === "checkbox")
62
- return /* @__PURE__ */ d(
63
- G,
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: t,
66
- className: n("group", c.root, i),
67
- ...m,
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(P, { children: (e) => /* @__PURE__ */ o(j, { className: c.checkboxItem, children: e.checked ? /* @__PURE__ */ o(p, { className: c.checkboxCheckedIcon }) : /* @__PURE__ */ o(
70
- I,
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(y, {})
93
+ /* @__PURE__ */ o(V, { ref: r })
76
94
  ]
77
95
  }
78
96
  );
97
+ }
79
98
  };
80
99
  export {
81
- Y as ChoiceBox,
82
- h as ChoiceBoxStyle
100
+ ro as ChoiceBox,
101
+ a as ChoiceBoxStyle
83
102
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@serendie/ui",
3
3
  "description": "Adaptive UI component library as part of Serendie Design System by Mitsubishi Electric",
4
4
  "license": "MIT",
5
- "version": "1.0.0",
5
+ "version": "1.0.1",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
8
8
  "scripts": {