@companix/uikit 0.0.33 → 0.0.35

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.
Files changed (90) hide show
  1. package/dist/Avatar/Avatar.scss +64 -0
  2. package/dist/Avatar/helpers.d.ts +10 -0
  3. package/dist/Avatar/index.d.ts +8 -0
  4. package/dist/Avatar/types.d.ts +2 -0
  5. package/dist/Icon/index.d.ts +2 -3
  6. package/dist/Segments/Segments.scss +57 -0
  7. package/dist/Segments/index.d.ts +11 -0
  8. package/dist/bundle.es.js +86 -80
  9. package/dist/bundle.es10.js +78 -39
  10. package/dist/bundle.es11.js +26 -36
  11. package/dist/bundle.es12.js +75 -56
  12. package/dist/bundle.es13.js +39 -19
  13. package/dist/bundle.es14.js +36 -33
  14. package/dist/bundle.es15.js +54 -23
  15. package/dist/bundle.es16.js +21 -45
  16. package/dist/bundle.es17.js +29 -19
  17. package/dist/bundle.es18.js +21 -25
  18. package/dist/bundle.es19.js +45 -38
  19. package/dist/bundle.es2.js +42 -45
  20. package/dist/bundle.es20.js +21 -14
  21. package/dist/bundle.es21.js +28 -33
  22. package/dist/bundle.es22.js +38 -21
  23. package/dist/bundle.es23.js +12 -38
  24. package/dist/bundle.es24.js +32 -114
  25. package/dist/bundle.es25.js +20 -120
  26. package/dist/bundle.es26.js +40 -72
  27. package/dist/bundle.es27.js +115 -32
  28. package/dist/bundle.es28.js +120 -11
  29. package/dist/bundle.es29.js +71 -83
  30. package/dist/bundle.es3.js +2 -8
  31. package/dist/bundle.es30.js +31 -20
  32. package/dist/bundle.es31.js +11 -6
  33. package/dist/bundle.es32.js +83 -32
  34. package/dist/bundle.es33.js +21 -21
  35. package/dist/bundle.es34.js +6 -10
  36. package/dist/bundle.es35.js +33 -23
  37. package/dist/bundle.es36.js +20 -37
  38. package/dist/bundle.es37.js +10 -50
  39. package/dist/bundle.es38.js +22 -40
  40. package/dist/bundle.es39.js +38 -8
  41. package/dist/bundle.es4.js +44 -10
  42. package/dist/bundle.es40.js +48 -21
  43. package/dist/bundle.es41.js +42 -86
  44. package/dist/bundle.es42.js +8 -17
  45. package/dist/bundle.es43.js +24 -19
  46. package/dist/bundle.es44.js +24 -24
  47. package/dist/bundle.es45.js +77 -29
  48. package/dist/bundle.es46.js +18 -3
  49. package/dist/bundle.es47.js +20 -5
  50. package/dist/bundle.es48.js +24 -14
  51. package/dist/bundle.es49.js +39 -14
  52. package/dist/bundle.es5.js +8 -85
  53. package/dist/bundle.es50.js +3 -3
  54. package/dist/bundle.es51.js +5 -3
  55. package/dist/bundle.es52.js +13 -69
  56. package/dist/bundle.es53.js +13 -67
  57. package/dist/bundle.es54.js +3 -70
  58. package/dist/bundle.es55.js +3 -12
  59. package/dist/bundle.es56.js +68 -41
  60. package/dist/bundle.es57.js +67 -14
  61. package/dist/bundle.es58.js +69 -31
  62. package/dist/bundle.es59.js +12 -70
  63. package/dist/bundle.es6.js +11 -85
  64. package/dist/bundle.es60.js +43 -20
  65. package/dist/bundle.es61.js +15 -2
  66. package/dist/bundle.es62.js +32 -14
  67. package/dist/bundle.es63.js +69 -19
  68. package/dist/bundle.es64.js +14 -2
  69. package/dist/bundle.es65.js +17 -18
  70. package/dist/bundle.es67.js +76 -20
  71. package/dist/bundle.es68.js +45 -72
  72. package/dist/bundle.es69.js +20 -49
  73. package/dist/bundle.es7.js +84 -79
  74. package/dist/bundle.es70.js +2 -2
  75. package/dist/bundle.es71.js +21 -14
  76. package/dist/bundle.es72.js +2 -3
  77. package/dist/bundle.es73.js +20 -3
  78. package/dist/bundle.es74.js +14 -20
  79. package/dist/bundle.es75.js +2 -2
  80. package/dist/bundle.es76.js +3 -20
  81. package/dist/bundle.es77.js +3 -2
  82. package/dist/bundle.es78.js +22 -0
  83. package/dist/bundle.es79.js +4 -0
  84. package/dist/bundle.es8.js +83 -24
  85. package/dist/bundle.es80.js +22 -0
  86. package/dist/bundle.es81.js +4 -0
  87. package/dist/bundle.es9.js +20 -73
  88. package/dist/index.d.ts +6 -0
  89. package/dist/index.scss +2 -0
  90. package/package.json +2 -1
@@ -1,58 +1,77 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import C from "classnames";
3
- import { forwardRef as j, useRef as w } from "react";
4
- import { mergeRefs as y } from "react-merge-refs";
5
- import { InputContainer as F } from "./bundle.es45.js";
6
- import { NumericFormat as V } from "react-number-format";
7
- const D = j(
8
- ({
9
- onChange: m,
10
- onValueChange: o,
11
- readOnly: f,
12
- inputClassName: i,
13
- value: n,
14
- placeholder: u,
15
- thousandSeparator: a,
16
- decimalSeparator: p,
17
- allowedDecimalSeparators: l,
18
- thousandsGroupStyle: s,
19
- decimalScale: d,
20
- fixedDecimalScale: b,
21
- allowNegative: R = !1,
22
- allowLeadingZeros: c,
23
- suffix: g,
24
- prefix: x,
25
- inputRef: I,
26
- ...e
27
- }, N) => {
28
- const r = w(null);
29
- return /* @__PURE__ */ t(F, { ref: N, inputRef: r, ...e, children: /* @__PURE__ */ t(
30
- V,
31
- {
32
- type: "text",
33
- getInputRef: y([r, I]),
34
- className: C("form-input form-input-base", i),
35
- "aria-disabled": e.disabled,
36
- onChange: m,
37
- onValueChange: ({ floatValue: h }) => o?.(h ?? null),
38
- value: n,
39
- placeholder: u,
40
- disabled: e.disabled,
41
- readOnly: f,
42
- thousandSeparator: a,
43
- decimalSeparator: p,
44
- allowedDecimalSeparators: l,
45
- thousandsGroupStyle: s,
46
- decimalScale: d,
47
- fixedDecimalScale: b,
48
- allowNegative: R,
49
- allowLeadingZeros: c,
50
- suffix: g,
51
- prefix: x
52
- }
53
- ) });
54
- }
55
- );
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { useMemo as F, useImperativeHandle as I } from "react";
3
+ import { Popover as T } from "./bundle.es10.js";
4
+ import { useFroozeClosing as b } from "./bundle.es44.js";
5
+ import { SelectInput as z } from "./bundle.es45.js";
6
+ import { useScrollListController as B } from "./bundle.es46.js";
7
+ import { SelectOptions as D } from "./bundle.es47.js";
8
+ import { mergeRefs as j } from "react-merge-refs";
9
+ const G = (a) => {
10
+ const {
11
+ options: n,
12
+ onChange: i,
13
+ value: r,
14
+ minimalOptions: m,
15
+ matchTarget: f = "width",
16
+ children: u,
17
+ disabled: p,
18
+ scrollRef: d,
19
+ popoverRef: v,
20
+ clearButton: s,
21
+ ...h
22
+ } = a, t = F(() => {
23
+ const o = r === null ? -1 : n.findIndex((e) => e.value === r);
24
+ return {
25
+ index: o,
26
+ option: n[o]
27
+ };
28
+ }, [n, r]), x = t.option?.value ?? null, { popoverRef: R, froozePopoverPosition: C, handleAnimationEnd: g } = b(), { scrollToElement: c, optionsWrapperRef: O, scrollBoxRef: P } = B();
29
+ I(d, () => ({
30
+ scrollTo: (o) => c(o, "top")
31
+ }));
32
+ const S = (o, e) => {
33
+ C(), i(o), e();
34
+ }, A = (o) => {
35
+ o.stopPropagation(), s && i(null);
36
+ }, E = () => {
37
+ t.index !== -1 && c(t.index, "center");
38
+ };
39
+ return /* @__PURE__ */ l(
40
+ T,
41
+ {
42
+ minimal: !0,
43
+ ref: j([R, v]),
44
+ sideOffset: 0,
45
+ matchTarget: f,
46
+ onAnimationEnd: g,
47
+ onOpenAutoFocus: (o) => o.preventDefault(),
48
+ onCloseAutoFocus: (o) => o.preventDefault(),
49
+ disabled: p,
50
+ content: ({ close: o }) => /* @__PURE__ */ l(
51
+ D,
52
+ {
53
+ options: n,
54
+ active: x,
55
+ scrollboxRef: P,
56
+ optionsWrapperRef: O,
57
+ minimalOptions: m,
58
+ onOpened: E,
59
+ onSelect: (e) => S(e, o)
60
+ }
61
+ ),
62
+ children: u ?? /* @__PURE__ */ l(
63
+ z,
64
+ {
65
+ ...h,
66
+ disabled: p,
67
+ clearButton: s,
68
+ value: t.option?.title ?? "",
69
+ onClear: A
70
+ }
71
+ )
72
+ }
73
+ );
74
+ };
56
75
  export {
57
- D as NumberInput
76
+ G as Select
58
77
  };
@@ -1,23 +1,43 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { Scrollable as n } from "./bundle.es5.js";
3
- const s = ({
4
- children: o,
5
- maxHeight: t,
6
- scrollboxRef: i,
7
- optionsWrapperRef: e
8
- }) => /* @__PURE__ */ r(
9
- n,
10
- {
11
- ref: i,
12
- implementation: "inner",
13
- padding: 10,
14
- thumbPadding: 3,
15
- thumbColor: "#0000002b",
16
- maxHeight: t,
17
- scrollY: !0,
18
- children: /* @__PURE__ */ r("div", { className: "option-list", ref: e, children: o })
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as b, useRef as R } from "react";
3
+ import { mergeRefs as c } from "react-merge-refs";
4
+ import { InputElement as x } from "./bundle.es48.js";
5
+ import { InputContainer as I } from "./bundle.es49.js";
6
+ import g from "classnames";
7
+ const N = b(
8
+ ({
9
+ onChange: m,
10
+ onValueChange: f,
11
+ readOnly: i,
12
+ inputClassName: o,
13
+ value: p,
14
+ placeholder: n,
15
+ mask: d,
16
+ inputType: s = "text",
17
+ maskChar: u,
18
+ inputRef: a,
19
+ ...e
20
+ }, l) => {
21
+ const r = R(null);
22
+ return /* @__PURE__ */ t(I, { ref: l, inputRef: r, ...e, children: /* @__PURE__ */ t(
23
+ x,
24
+ {
25
+ type: s,
26
+ ref: c([r, a]),
27
+ className: g("form-input form-input-base", o),
28
+ "aria-disabled": e.disabled,
29
+ onChange: m,
30
+ onValueChange: f,
31
+ value: p,
32
+ placeholder: n,
33
+ disabled: e.disabled,
34
+ readOnly: i,
35
+ maskChar: u,
36
+ mask: d
37
+ }
38
+ ) });
19
39
  }
20
40
  );
21
41
  export {
22
- s as OptionsList
42
+ N as Input
23
43
  };
@@ -1,35 +1,38 @@
1
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
- import * as t from "@radix-ui/react-checkbox";
3
- import { Icon as h } from "./bundle.es30.js";
4
- import { f as l } from "./bundle.es46.js";
5
- import { useId as n } from "react";
6
- import { attr as c } from "@companix/utils-browser";
7
- const N = ({ checked: a, required: s, disabled: r, onCheckedChange: m, size: x, label: e }) => {
8
- const i = n();
9
- return /* @__PURE__ */ d(
10
- "div",
11
- {
12
- className: "checkbox",
13
- "data-size": x ?? "md",
14
- "data-required": c(s && !a),
15
- "data-disabled": c(r),
16
- children: [
17
- /* @__PURE__ */ o(
18
- t.Root,
19
- {
20
- className: "checkbox-box",
21
- checked: a,
22
- onCheckedChange: m,
23
- disabled: r,
24
- id: i,
25
- children: /* @__PURE__ */ o(t.Indicator, { className: "checkbox-icon", children: /* @__PURE__ */ o(h, { icon: l.faCheck, size: "xxxs" }) })
26
- }
27
- ),
28
- e && /* @__PURE__ */ o("label", { className: "checkbox-label", htmlFor: i, "data-disabled": c(r), children: e })
29
- ]
30
- }
31
- );
32
- };
1
+ import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
+ import N from "classnames";
3
+ import { Icon as v } from "./bundle.es33.js";
4
+ import { attr as t } from "@companix/utils-browser";
5
+ import { forwardRef as k } from "react";
6
+ import { f as x } from "./bundle.es50.js";
7
+ const E = k(
8
+ ({ title: s, icon: c, active: e, label: n, disabled: a, minimal: r, onClick: d, className: l, ...m }, p) => {
9
+ const f = (h) => {
10
+ a || d?.(h);
11
+ };
12
+ return /* @__PURE__ */ i(
13
+ "div",
14
+ {
15
+ ref: p,
16
+ ...m,
17
+ className: N("option", l),
18
+ "data-selected": t(e),
19
+ "data-disabled": t(a),
20
+ "data-minimal": t(r),
21
+ onClick: f,
22
+ children: [
23
+ /* @__PURE__ */ i("div", { className: "option-content", children: [
24
+ c && /* @__PURE__ */ o("div", { className: "option-icon", children: c }),
25
+ /* @__PURE__ */ i("div", { className: "option-content-layout", children: [
26
+ /* @__PURE__ */ o("div", { className: "option-title", children: s }),
27
+ n && /* @__PURE__ */ o("div", { className: "option-label", children: n })
28
+ ] })
29
+ ] }),
30
+ e && !r && /* @__PURE__ */ o("div", { className: "option-check", children: /* @__PURE__ */ o(v, { icon: x.faCheck }) })
31
+ ]
32
+ }
33
+ );
34
+ }
35
+ );
33
36
  export {
34
- N as Checkbox
37
+ E as OptionItem
35
38
  };
@@ -1,27 +1,58 @@
1
- import { jsxs as d, jsx as c } from "react/jsx-runtime";
2
- import * as r from "@radix-ui/react-switch";
3
- import { attr as a } from "@companix/utils-browser";
4
- import { useId as n } from "react";
5
- const u = (m) => {
6
- const { checked: e, disabled: s, onCheckedChange: o, uncheckedIcon: i, checkedIcon: t, label: h } = m, l = n();
7
- return /* @__PURE__ */ d("div", { className: "switch", "data-disabled": a(s), children: [
8
- /* @__PURE__ */ c(
9
- r.Root,
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import C from "classnames";
3
+ import { forwardRef as j, useRef as w } from "react";
4
+ import { mergeRefs as y } from "react-merge-refs";
5
+ import { InputContainer as F } from "./bundle.es49.js";
6
+ import { NumericFormat as V } from "react-number-format";
7
+ const D = j(
8
+ ({
9
+ onChange: m,
10
+ onValueChange: o,
11
+ readOnly: f,
12
+ inputClassName: i,
13
+ value: n,
14
+ placeholder: u,
15
+ thousandSeparator: a,
16
+ decimalSeparator: p,
17
+ allowedDecimalSeparators: l,
18
+ thousandsGroupStyle: s,
19
+ decimalScale: d,
20
+ fixedDecimalScale: b,
21
+ allowNegative: R = !1,
22
+ allowLeadingZeros: c,
23
+ suffix: g,
24
+ prefix: x,
25
+ inputRef: I,
26
+ ...e
27
+ }, N) => {
28
+ const r = w(null);
29
+ return /* @__PURE__ */ t(F, { ref: N, inputRef: r, ...e, children: /* @__PURE__ */ t(
30
+ V,
10
31
  {
11
- className: "switch-track",
12
- checked: e,
13
- onCheckedChange: o,
14
- disabled: s,
15
- id: l,
16
- children: /* @__PURE__ */ d(r.Thumb, { className: "switch-thumb", children: [
17
- i && /* @__PURE__ */ c("span", { className: "switch-thumb-icon", "data-visible": a(!e), children: i }),
18
- t && /* @__PURE__ */ c("span", { className: "switch-thumb-icon", "data-visible": a(e), children: t })
19
- ] })
32
+ type: "text",
33
+ getInputRef: y([r, I]),
34
+ className: C("form-input form-input-base", i),
35
+ "aria-disabled": e.disabled,
36
+ onChange: m,
37
+ onValueChange: ({ floatValue: h }) => o?.(h ?? null),
38
+ value: n,
39
+ placeholder: u,
40
+ disabled: e.disabled,
41
+ readOnly: f,
42
+ thousandSeparator: a,
43
+ decimalSeparator: p,
44
+ allowedDecimalSeparators: l,
45
+ thousandsGroupStyle: s,
46
+ decimalScale: d,
47
+ fixedDecimalScale: b,
48
+ allowNegative: R,
49
+ allowLeadingZeros: c,
50
+ suffix: g,
51
+ prefix: x
20
52
  }
21
- ),
22
- h && /* @__PURE__ */ c("label", { className: "switch-label", htmlFor: l, "data-disabled": s, children: h })
23
- ] });
24
- };
53
+ ) });
54
+ }
55
+ );
25
56
  export {
26
- u as Switch
57
+ D as NumberInput
27
58
  };
@@ -1,47 +1,23 @@
1
- import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
- import { useId as p } from "react";
3
- import * as l from "@radix-ui/react-radio-group";
4
- import { attr as s } from "@companix/utils-browser";
5
- const q = (t) => {
6
- const { options: m, value: a, onChange: r, disabled: d, required: e, size: n } = t;
7
- return /* @__PURE__ */ o(
8
- l.Root,
9
- {
10
- className: "radio-group",
11
- disabled: d,
12
- "data-required": s(e && !a),
13
- "data-v": a,
14
- value: a,
15
- onValueChange: (i) => r(i),
16
- children: m.map((i, c) => /* @__PURE__ */ o(
17
- h,
18
- {
19
- ...i,
20
- size: n,
21
- disabled: d,
22
- required: e && !a
23
- },
24
- `radio-${i.value}-${c}`
25
- ))
26
- }
27
- );
28
- }, h = ({ value: t, label: m, size: a = "md", disabled: r, required: d }) => {
29
- const e = p();
30
- return /* @__PURE__ */ u(
31
- "span",
32
- {
33
- className: "radio",
34
- "data-disabled": s(r),
35
- "data-size": a,
36
- "data-required": s(d),
37
- children: [
38
- /* @__PURE__ */ o(l.Item, { className: "radio-box", value: t, disabled: r, id: e, children: /* @__PURE__ */ o(l.Indicator, { className: "radio-mark" }) }),
39
- /* @__PURE__ */ o("label", { className: "radio-label", htmlFor: e, "data-disabled": s(r), children: m })
40
- ]
41
- }
42
- );
43
- };
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { Scrollable as n } from "./bundle.es7.js";
3
+ const s = ({
4
+ children: o,
5
+ maxHeight: t,
6
+ scrollboxRef: i,
7
+ optionsWrapperRef: e
8
+ }) => /* @__PURE__ */ r(
9
+ n,
10
+ {
11
+ ref: i,
12
+ implementation: "inner",
13
+ padding: 10,
14
+ thumbPadding: 3,
15
+ thumbColor: "#0000002b",
16
+ maxHeight: t,
17
+ scrollY: !0,
18
+ children: /* @__PURE__ */ r("div", { className: "option-list", ref: e, children: o })
19
+ }
20
+ );
44
21
  export {
45
- h as Radio,
46
- q as RadioGroup
22
+ s as OptionsList
47
23
  };
@@ -1,25 +1,35 @@
1
- import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import d from "classnames";
3
- import * as r from "@radix-ui/react-dialog";
4
- import { VisuallyHidden as i } from "@radix-ui/react-visually-hidden";
5
- import { varToStyle as c } from "@companix/utils-browser";
6
- const p = ({ open: t, onOpenChange: l, children: a, size: s, direction: m, className: n }) => /* @__PURE__ */ e(r.Root, { open: t, onOpenChange: l, children: /* @__PURE__ */ o(r.Portal, { children: [
7
- /* @__PURE__ */ e(r.Overlay, { className: "drawer-overlay" }),
8
- /* @__PURE__ */ o(
9
- r.Content,
1
+ import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
+ import * as t from "@radix-ui/react-checkbox";
3
+ import { Icon as h } from "./bundle.es33.js";
4
+ import { f as l } from "./bundle.es50.js";
5
+ import { useId as n } from "react";
6
+ import { attr as c } from "@companix/utils-browser";
7
+ const N = ({ checked: a, required: s, disabled: r, onCheckedChange: m, size: x, label: e }) => {
8
+ const i = n();
9
+ return /* @__PURE__ */ d(
10
+ "div",
10
11
  {
11
- style: c({ "--drawer-size": s ?? "50%" }),
12
- className: d("drawer", n),
13
- "data-direction": m,
12
+ className: "checkbox",
13
+ "data-size": x ?? "md",
14
+ "data-required": c(s && !a),
15
+ "data-disabled": c(r),
14
16
  children: [
15
- /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(r.Title, {}) }),
16
- /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(r.Description, {}) }),
17
- a
17
+ /* @__PURE__ */ o(
18
+ t.Root,
19
+ {
20
+ className: "checkbox-box",
21
+ checked: a,
22
+ onCheckedChange: m,
23
+ disabled: r,
24
+ id: i,
25
+ children: /* @__PURE__ */ o(t.Indicator, { className: "checkbox-icon", children: /* @__PURE__ */ o(h, { icon: l.faCheck, size: "xxxs" }) })
26
+ }
27
+ ),
28
+ e && /* @__PURE__ */ o("label", { className: "checkbox-label", htmlFor: i, "data-disabled": c(r), children: e })
18
29
  ]
19
30
  }
20
- )
21
- ] }) });
22
- p.Close = r.Close;
31
+ );
32
+ };
23
33
  export {
24
- p as Drawer
34
+ N as Checkbox
25
35
  };
@@ -1,31 +1,27 @@
1
- import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
- import f from "classnames";
3
- import * as o from "@radix-ui/react-dialog";
4
- import { VisuallyHidden as a } from "@radix-ui/react-visually-hidden";
5
- import { RemoveListener as v } from "./bundle.es47.js";
6
- const g = (l) => {
7
- const { size: n = "s", open: r, onOpenChange: s, children: c, onClosed: t, disableEsc: p, className: d } = l, m = (h) => {
8
- p && h.preventDefault();
9
- };
10
- return /* @__PURE__ */ e(o.Root, { open: r, onOpenChange: s, children: /* @__PURE__ */ i(o.Portal, { children: [
11
- /* @__PURE__ */ e(o.Overlay, { className: "popup-overlay dialog-overlay" }),
12
- /* @__PURE__ */ e(
13
- o.Content,
1
+ import { jsxs as d, jsx as c } from "react/jsx-runtime";
2
+ import * as r from "@radix-ui/react-switch";
3
+ import { attr as a } from "@companix/utils-browser";
4
+ import { useId as n } from "react";
5
+ const u = (m) => {
6
+ const { checked: e, disabled: s, onCheckedChange: o, uncheckedIcon: i, checkedIcon: t, label: h } = m, l = n();
7
+ return /* @__PURE__ */ d("div", { className: "switch", "data-disabled": a(s), children: [
8
+ /* @__PURE__ */ c(
9
+ r.Root,
14
10
  {
15
- className: "popup-container dialog-container",
16
- "data-size": n,
17
- onEscapeKeyDown: m,
18
- children: /* @__PURE__ */ i("div", { className: f("popup dialog", d), children: [
19
- /* @__PURE__ */ e(v, { callback: t }),
20
- /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(o.Title, {}) }),
21
- /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(o.Description, {}) }),
22
- c
11
+ className: "switch-track",
12
+ checked: e,
13
+ onCheckedChange: o,
14
+ disabled: s,
15
+ id: l,
16
+ children: /* @__PURE__ */ d(r.Thumb, { className: "switch-thumb", children: [
17
+ i && /* @__PURE__ */ c("span", { className: "switch-thumb-icon", "data-visible": a(!e), children: i }),
18
+ t && /* @__PURE__ */ c("span", { className: "switch-thumb-icon", "data-visible": a(e), children: t })
23
19
  ] })
24
20
  }
25
- )
26
- ] }) });
21
+ ),
22
+ h && /* @__PURE__ */ c("label", { className: "switch-label", htmlFor: l, "data-disabled": s, children: h })
23
+ ] });
27
24
  };
28
- g.Close = o.Close;
29
25
  export {
30
- g as Dialog
26
+ u as Switch
31
27
  };
@@ -1,40 +1,47 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
- import * as r from "@radix-ui/react-alert-dialog";
3
- import { Button as c } from "./bundle.es2.js";
4
- import { RemoveListener as N } from "./bundle.es47.js";
5
- import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
6
- const C = ({
7
- open: d,
8
- defaultOpen: p,
9
- onOpenChange: m,
10
- onUnMounted: h,
11
- icon: i,
12
- title: l,
13
- description: o,
14
- cancelDefaultText: n,
15
- cancel: t,
16
- disableCancel: v,
17
- confirm: s
18
- }) => /* @__PURE__ */ a(r.Root, { open: d, defaultOpen: p, onOpenChange: m, children: [
19
- /* @__PURE__ */ e(N, { callback: h }),
20
- /* @__PURE__ */ a(r.Portal, { children: [
21
- /* @__PURE__ */ e(r.Overlay, { className: "popup-overlay dialog-overlay" }),
22
- /* @__PURE__ */ e(r.Content, { className: "popup-container dialog-container", children: /* @__PURE__ */ a("div", { className: "popup alert", children: [
23
- /* @__PURE__ */ a("div", { className: "alert-body", children: [
24
- i && /* @__PURE__ */ e("span", { className: "alert-icon", children: i }),
25
- /* @__PURE__ */ a("div", { className: "alert-content", children: [
26
- l && /* @__PURE__ */ e(r.Title, { className: "alert-title", children: l }),
27
- !l && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(r.Title, {}) }),
28
- o && /* @__PURE__ */ e(r.Description, { className: "alert-description", children: o })
29
- ] })
30
- ] }),
31
- /* @__PURE__ */ a("div", { className: "alert-footer", children: [
32
- !v && (t?.text || n) && /* @__PURE__ */ e(r.Cancel, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "neutral", ...t, text: t?.text ?? n }) }),
33
- s?.text && /* @__PURE__ */ e(r.Action, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "negative", ...s }) })
34
- ] })
35
- ] }) })
36
- ] })
37
- ] });
1
+ import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
+ import { useId as p } from "react";
3
+ import * as l from "@radix-ui/react-radio-group";
4
+ import { attr as s } from "@companix/utils-browser";
5
+ const q = (t) => {
6
+ const { options: m, value: a, onChange: r, disabled: d, required: e, size: n } = t;
7
+ return /* @__PURE__ */ o(
8
+ l.Root,
9
+ {
10
+ className: "radio-group",
11
+ disabled: d,
12
+ "data-required": s(e && !a),
13
+ "data-v": a,
14
+ value: a,
15
+ onValueChange: (i) => r(i),
16
+ children: m.map((i, c) => /* @__PURE__ */ o(
17
+ h,
18
+ {
19
+ ...i,
20
+ size: n,
21
+ disabled: d,
22
+ required: e && !a
23
+ },
24
+ `radio-${i.value}-${c}`
25
+ ))
26
+ }
27
+ );
28
+ }, h = ({ value: t, label: m, size: a = "md", disabled: r, required: d }) => {
29
+ const e = p();
30
+ return /* @__PURE__ */ u(
31
+ "span",
32
+ {
33
+ className: "radio",
34
+ "data-disabled": s(r),
35
+ "data-size": a,
36
+ "data-required": s(d),
37
+ children: [
38
+ /* @__PURE__ */ o(l.Item, { className: "radio-box", value: t, disabled: r, id: e, children: /* @__PURE__ */ o(l.Indicator, { className: "radio-mark" }) }),
39
+ /* @__PURE__ */ o("label", { className: "radio-label", htmlFor: e, "data-disabled": s(r), children: m })
40
+ ]
41
+ }
42
+ );
43
+ };
38
44
  export {
39
- C as AlertDialog
45
+ h as Radio,
46
+ q as RadioGroup
40
47
  };