ono-react-element 0.0.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.
Files changed (112) hide show
  1. package/dist/es/AutoSliderList-DqaQhmce.js +106 -0
  2. package/dist/es/AvatarCrop-DzGw2FVQ.js +225 -0
  3. package/dist/es/Button-CdxyXFF4.js +72 -0
  4. package/dist/es/Card3D-sf3zmiHk.js +41 -0
  5. package/dist/es/Checkbox-BN7rT73n.js +62 -0
  6. package/dist/es/InjunctiveBox-CmZg4sIq.js +39 -0
  7. package/dist/es/Input-wORRaL9-.js +301 -0
  8. package/dist/es/List-B9mP7VjN.js +35 -0
  9. package/dist/es/MenuButton-CuOdVlg0.js +62 -0
  10. package/dist/es/Message-BMimz-k2.js +219 -0
  11. package/dist/es/Modal-BAJOEXRd.js +154 -0
  12. package/dist/es/Pagination-BtmtUkVw.js +110 -0
  13. package/dist/es/PortalRenderer-8Iur-eZp.js +38 -0
  14. package/dist/es/Radio-BmSpqdK8.js +113 -0
  15. package/dist/es/SvgImg-Bcmzdjzl.js +38 -0
  16. package/dist/es/Switch-hGQGZVO2.js +110 -0
  17. package/dist/es/TemplateDialog-DuURiDPX.js +75 -0
  18. package/dist/es/Toast-CkC8zQdq.js +174 -0
  19. package/dist/es/Tooltip-C_gPojr9.js +94 -0
  20. package/dist/es/VirtualList-D8M5JJ-W.js +160 -0
  21. package/dist/es/Waterfall-BXE2_5Sj.js +131 -0
  22. package/dist/es/dependencies-DWmdjl5u.js +25491 -0
  23. package/dist/es/hooks-Bj-aT2k8.js +159 -0
  24. package/dist/es/index.js +227 -0
  25. package/dist/es/utils-ziqvBIOU.js +567 -0
  26. package/dist/index.css +1 -0
  27. package/dist/types/components/AutoSliderList/AutoSliderList.d.ts +2 -0
  28. package/dist/types/components/AutoSliderList/index.d.ts +2 -0
  29. package/dist/types/components/AutoSliderList/types.d.ts +23 -0
  30. package/dist/types/components/AvatarCrop/AvatarCanvas.d.ts +2 -0
  31. package/dist/types/components/AvatarCrop/AvatarCrop.d.ts +13 -0
  32. package/dist/types/components/AvatarCrop/index.d.ts +1 -0
  33. package/dist/types/components/AvatarCrop/types.d.ts +42 -0
  34. package/dist/types/components/Button/Button.d.ts +2 -0
  35. package/dist/types/components/Button/index.d.ts +2 -0
  36. package/dist/types/components/Button/types.d.ts +20 -0
  37. package/dist/types/components/Card3D/Card3D.d.ts +12 -0
  38. package/dist/types/components/Card3D/index.d.ts +1 -0
  39. package/dist/types/components/Checkbox/Checkbox.d.ts +2 -0
  40. package/dist/types/components/Checkbox/index.d.ts +2 -0
  41. package/dist/types/components/Checkbox/types.d.ts +12 -0
  42. package/dist/types/components/InjunctiveBox/InjunctiveBox.d.ts +18 -0
  43. package/dist/types/components/InjunctiveBox/index.d.ts +1 -0
  44. package/dist/types/components/Input/Input.d.ts +2 -0
  45. package/dist/types/components/Input/Textarea.d.ts +2 -0
  46. package/dist/types/components/Input/index.d.ts +2 -0
  47. package/dist/types/components/Input/types.d.ts +46 -0
  48. package/dist/types/components/List/AwaitList.d.ts +3 -0
  49. package/dist/types/components/List/List.d.ts +3 -0
  50. package/dist/types/components/List/index.d.ts +2 -0
  51. package/dist/types/components/List/types.d.ts +11 -0
  52. package/dist/types/components/MenuButton/MenuButton.d.ts +2 -0
  53. package/dist/types/components/MenuButton/index.d.ts +1 -0
  54. package/dist/types/components/MenuButton/types.d.ts +8 -0
  55. package/dist/types/components/Message/Message.d.ts +8 -0
  56. package/dist/types/components/Message/index.d.ts +1 -0
  57. package/dist/types/components/Message/types.d.ts +20 -0
  58. package/dist/types/components/Message/utils.d.ts +23 -0
  59. package/dist/types/components/Modal/Modal.d.ts +2 -0
  60. package/dist/types/components/Modal/index.d.ts +1 -0
  61. package/dist/types/components/Modal/types.d.ts +27 -0
  62. package/dist/types/components/Pagination/Pagination.d.ts +2 -0
  63. package/dist/types/components/Pagination/index.d.ts +1 -0
  64. package/dist/types/components/Pagination/types.d.ts +20 -0
  65. package/dist/types/components/PortalRenderer/PortalRenderer.d.ts +2 -0
  66. package/dist/types/components/PortalRenderer/index.d.ts +1 -0
  67. package/dist/types/components/Radio/Radio.d.ts +2 -0
  68. package/dist/types/components/Radio/RadioGroup.d.ts +2 -0
  69. package/dist/types/components/Radio/index.d.ts +2 -0
  70. package/dist/types/components/Radio/types.d.ts +26 -0
  71. package/dist/types/components/Select/Option.d.ts +2 -0
  72. package/dist/types/components/Select/Select.d.ts +2 -0
  73. package/dist/types/components/Select/index.d.ts +1 -0
  74. package/dist/types/components/Select/types.d.ts +30 -0
  75. package/dist/types/components/SvgImg/SvgImg.d.ts +10 -0
  76. package/dist/types/components/SvgImg/index.d.ts +1 -0
  77. package/dist/types/components/Switch/Switch.d.ts +2 -0
  78. package/dist/types/components/Switch/index.d.ts +1 -0
  79. package/dist/types/components/Switch/types.d.ts +18 -0
  80. package/dist/types/components/TemplateDialog/TemplateDialog.d.ts +2 -0
  81. package/dist/types/components/TemplateDialog/index.d.ts +1 -0
  82. package/dist/types/components/TemplateDialog/types.d.ts +19 -0
  83. package/dist/types/components/Toast/Toast.d.ts +7 -0
  84. package/dist/types/components/Toast/index.d.ts +1 -0
  85. package/dist/types/components/Toast/types.d.ts +19 -0
  86. package/dist/types/components/Tooltip/Tooltip.d.ts +2 -0
  87. package/dist/types/components/Tooltip/index.d.ts +1 -0
  88. package/dist/types/components/Tooltip/types.d.ts +15 -0
  89. package/dist/types/components/VirtualList/EstimatedVirtualList.d.ts +2 -0
  90. package/dist/types/components/VirtualList/index.d.ts +2 -0
  91. package/dist/types/components/VirtualList/types.d.ts +35 -0
  92. package/dist/types/components/Waterfall/Waterfall.d.ts +2 -0
  93. package/dist/types/components/Waterfall/index.d.ts +2 -0
  94. package/dist/types/components/Waterfall/types.d.ts +23 -0
  95. package/dist/types/components/index.d.ts +21 -0
  96. package/dist/types/hooks/index.d.ts +7 -0
  97. package/dist/types/hooks/useClickOutSide.d.ts +9 -0
  98. package/dist/types/hooks/useCountdown.d.ts +1 -0
  99. package/dist/types/hooks/useEventListener.d.ts +8 -0
  100. package/dist/types/hooks/useGetElementSize.d.ts +5 -0
  101. package/dist/types/hooks/useKeyPress.d.ts +12 -0
  102. package/dist/types/hooks/useTheme.d.ts +8 -0
  103. package/dist/types/hooks/useThemePro.d.ts +11 -0
  104. package/dist/types/index.d.ts +8 -0
  105. package/dist/types/utils/colorUtils.d.ts +33 -0
  106. package/dist/types/utils/common.d.ts +96 -0
  107. package/dist/types/utils/fileFormatConversion.d.ts +10 -0
  108. package/dist/types/utils/formatTimeUtils.d.ts +6 -0
  109. package/dist/types/utils/viewTransitionUtils.d.ts +9 -0
  110. package/dist/umd/index.css +1 -0
  111. package/dist/umd/index.umd.cjs +298 -0
  112. package/package.json +49 -0
@@ -0,0 +1,154 @@
1
+ import { j as o } from "./dependencies-DWmdjl5u.js";
2
+ import { f as i } from "./utils-ziqvBIOU.js";
3
+ import { useRef as b, useEffect as j } from "react";
4
+ import { p as R } from "./PortalRenderer-8Iur-eZp.js";
5
+ const z = ({
6
+ title: s = "This is a modal title",
7
+ icon: v,
8
+ content: p = "This is a modal content",
9
+ okText: y = "confirm",
10
+ cancelText: g = "cancel",
11
+ isLoading: c,
12
+ confirmDisabled: C,
13
+ cancelDisabled: B,
14
+ position: r,
15
+ onConfirm: N = () => {
16
+ },
17
+ onCancel: w = () => {
18
+ },
19
+ mask: d = !0,
20
+ maskClosable: M = !1,
21
+ width: m,
22
+ btnClr: a,
23
+ footer: x = ({ OkBtn: e, CancelBtn: l }) => /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
24
+ /* @__PURE__ */ o.jsx(l, {}),
25
+ /* @__PURE__ */ o.jsx(e, {})
26
+ ] }),
27
+ modalBody: h,
28
+ destroy: f
29
+ }) => {
30
+ const e = b(null), l = b(null), k = [
31
+ {
32
+ label: "themeColor",
33
+ value: a || ""
34
+ },
35
+ {
36
+ label: "themeHoverColor",
37
+ value: a && i(a, "light", 10) || ""
38
+ },
39
+ {
40
+ label: "themeActiveColor",
41
+ value: a && i(a, "dark", 20) || ""
42
+ },
43
+ {
44
+ label: "themeDisabledClr",
45
+ value: a && i(a, "light", 20) || ""
46
+ }
47
+ ], P = () => {
48
+ if (!l.current) return;
49
+ const n = l.current.style;
50
+ m && n.setProperty("--width", m + "px"), r && (n.setProperty(
51
+ "--left",
52
+ (r.x / window.innerWidth * 100).toFixed(2) + "%"
53
+ ), n.setProperty(
54
+ "--top",
55
+ (r.y / window.innerHeight * 100).toFixed(2) + "%"
56
+ )), a && k.forEach(
57
+ (u) => n.setProperty(`--${u.label}`, u.value)
58
+ );
59
+ }, t = () => {
60
+ if (r) {
61
+ if (!l.current) return;
62
+ l.current.classList.remove("ono-modal-enter"), l.current.classList.add("ono-modal-leave"), setTimeout(() => {
63
+ f();
64
+ }, 300);
65
+ } else f();
66
+ };
67
+ return j(() => (e.current && (d ? e.current.showModal() : e.current.show()), () => {
68
+ e.current && e.current.close();
69
+ }), [e.current, d]), j(() => {
70
+ P();
71
+ }, [l]), /* @__PURE__ */ o.jsx(
72
+ "dialog",
73
+ {
74
+ ref: e,
75
+ className: "ono-modal",
76
+ onClick: () => M && t(),
77
+ children: h ? h(t) : /* @__PURE__ */ o.jsxs(
78
+ "div",
79
+ {
80
+ ref: l,
81
+ className: ["ono-modal-box", r ? "ono-modal-enter" : ""].join(
82
+ " "
83
+ ),
84
+ onClick: (n) => n.stopPropagation(),
85
+ children: [
86
+ /* @__PURE__ */ o.jsxs("div", { className: "ono-modal-box-body", children: [
87
+ v ?? /* @__PURE__ */ o.jsx("div", { className: "ono-modal-box-body-icon", children: /* @__PURE__ */ o.jsx(
88
+ "svg",
89
+ {
90
+ color: "#faad14",
91
+ viewBox: "64 64 896 896",
92
+ focusable: "false",
93
+ "data-icon": "exclamation-circle",
94
+ width: "22px",
95
+ height: "22px",
96
+ fill: "currentColor",
97
+ "aria-hidden": "true",
98
+ style: { marginInlineEnd: "12px" },
99
+ children: /* @__PURE__ */ o.jsx("path", { d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" })
100
+ }
101
+ ) }),
102
+ /* @__PURE__ */ o.jsxs("div", { className: "ono-modal-box-body-contentBar", children: [
103
+ /* @__PURE__ */ o.jsx("h1", { className: "ono-modal-box-body-contentBar-title", children: s }),
104
+ /* @__PURE__ */ o.jsx("p", { className: "ono-modal-box-body-contentBar-content", children: p })
105
+ ] })
106
+ ] }),
107
+ x && /* @__PURE__ */ o.jsx("div", { className: "ono-modal-box-footer", children: x({
108
+ OkBtn: () => /* @__PURE__ */ o.jsxs(
109
+ "button",
110
+ {
111
+ className: "ono-modal-box-footer-confirmBtn",
112
+ disabled: C || c,
113
+ onClick: () => {
114
+ N(), t();
115
+ },
116
+ children: [
117
+ c && /* @__PURE__ */ o.jsx(
118
+ "svg",
119
+ {
120
+ className: "ono-modal-box-footer-confirmBtn-loading",
121
+ viewBox: "0 0 1024 1024",
122
+ focusable: "false",
123
+ "data-icon": "loading",
124
+ fill: "currentColor",
125
+ "aria-hidden": "true",
126
+ children: /* @__PURE__ */ o.jsx("path", { d: "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" })
127
+ }
128
+ ),
129
+ y ?? "Confirm"
130
+ ]
131
+ }
132
+ ),
133
+ CancelBtn: () => /* @__PURE__ */ o.jsx(
134
+ "button",
135
+ {
136
+ className: "ono-modal-box-footer-cancelBtn",
137
+ disabled: B || c,
138
+ onClick: () => {
139
+ w(), t();
140
+ },
141
+ children: g ?? "Cancel"
142
+ }
143
+ ),
144
+ handleClose: () => t()
145
+ }) })
146
+ ]
147
+ }
148
+ )
149
+ }
150
+ );
151
+ }, D = (s) => R(z, s, "ono-modal");
152
+ export {
153
+ D as M
154
+ };
@@ -0,0 +1,110 @@
1
+ import { j as a } from "./dependencies-DWmdjl5u.js";
2
+ const $ = ({
3
+ firstBtn: t,
4
+ lastBtn: r,
5
+ currentPage: n,
6
+ total: i,
7
+ prevBtn: c,
8
+ nextBtn: p,
9
+ styles: m,
10
+ className: x,
11
+ children: d,
12
+ onChange: e,
13
+ pageBtnClassName: j,
14
+ pageBtnActiveClassName: f,
15
+ hiddenNextBtnOnLastPage: N,
16
+ hiddenPrevBtnOnFirstPage: g
17
+ }) => {
18
+ const b = Math.max(1, Math.min(n, i)), h = () => Array.from({ length: i }, (o, s) => /* @__PURE__ */ a.jsx(
19
+ "li",
20
+ {
21
+ className: "ono-pagination-base",
22
+ onClick: () => e(s + 1),
23
+ children: d ? d({ page: s + 1, isActive: n === s + 1 }) : /* @__PURE__ */ a.jsx(
24
+ "div",
25
+ {
26
+ className: `ono-pagination-base ${j ?? "ono-pagination-btn"} ${b === s + 1 ? f ?? "ono-pagination-btn-active" : ""}`,
27
+ children: s + 1
28
+ }
29
+ )
30
+ },
31
+ s + 1
32
+ )), u = () => {
33
+ const o = h();
34
+ if (o.length <= 7) return o;
35
+ const s = i - 1, l = b, y = l <= 3, k = l >= i - 2;
36
+ return y ? [
37
+ ...o.slice(0, l === 3 ? 4 : 3),
38
+ "...",
39
+ o[s]
40
+ ] : k ? [
41
+ o[0],
42
+ "...",
43
+ ...o.slice(l === i - 2 ? -4 : -3)
44
+ ] : [
45
+ o[0],
46
+ "...",
47
+ ...o.slice(l - 2, l + 1),
48
+ "...",
49
+ o[s]
50
+ ];
51
+ };
52
+ return /* @__PURE__ */ a.jsxs("ul", { className: `ono-pagination ${x}`, style: m, children: [
53
+ t && /* @__PURE__ */ a.jsx(
54
+ "li",
55
+ {
56
+ className: t ? "ono-pagination-base" : "ono-pagination-btn",
57
+ onClick: () => e(1),
58
+ children: t
59
+ }
60
+ ),
61
+ g && n === 1 ? null : /* @__PURE__ */ a.jsx(
62
+ "li",
63
+ {
64
+ className: "ono-pagination-base",
65
+ style: { cursor: n !== 1 ? "pointer" : "no-drop" },
66
+ onClick: () => {
67
+ n <= 1 || e(n - 1);
68
+ },
69
+ children: c ? typeof c == "function" ? c(n !== 1) : c : /* @__PURE__ */ a.jsx(
70
+ "div",
71
+ {
72
+ className: c ? "ono-pagination-base" : "ono-pagination-btn",
73
+ children: "prevBtn"
74
+ }
75
+ )
76
+ }
77
+ ),
78
+ u(),
79
+ N && n === i ? null : /* @__PURE__ */ a.jsx(
80
+ "li",
81
+ {
82
+ className: "ono-pagination-base",
83
+ style: {
84
+ cursor: n !== i ? "pointer" : "no-drop"
85
+ },
86
+ onClick: () => {
87
+ n >= i ? e(i) : e(n + 1);
88
+ },
89
+ children: p ? typeof p == "function" ? p(n !== i) : p : /* @__PURE__ */ a.jsx(
90
+ "div",
91
+ {
92
+ className: p ? "ono-pagination-base" : "ono-pagination-btn",
93
+ children: "nextBtn"
94
+ }
95
+ )
96
+ }
97
+ ),
98
+ r && /* @__PURE__ */ a.jsx(
99
+ "li",
100
+ {
101
+ className: r ? "ono-pagination-base" : "ono-pagination-btn",
102
+ onClick: () => e(i),
103
+ children: r
104
+ }
105
+ )
106
+ ] });
107
+ };
108
+ export {
109
+ $ as P
110
+ };
@@ -0,0 +1,38 @@
1
+ import { j as m, R as i } from "./dependencies-DWmdjl5u.js";
2
+ const u = (n, r) => {
3
+ let e = null, t = null;
4
+ return r && (e = document.getElementById(r), e || (e = document.createElement("div"), e.id = r, document.body.appendChild(e))), n ? (t = document.getElementById(n), t || (t = document.createElement("div"), t.id = n, e ? e.appendChild(t) : document.body.appendChild(t))) : (t = document.createElement("div"), e ? e.appendChild(t) : document.body.appendChild(t)), { target: t, root: e };
5
+ }, p = (n, r, e, t) => {
6
+ const { target: o, root: a } = u(e, t), c = (d) => {
7
+ var l;
8
+ typeof d == "function" && d(), e ? (l = document.getElementById(e)) == null || l.remove() : o.remove(), requestAnimationFrame(
9
+ () => a && a.children.length === 0 && a.remove()
10
+ );
11
+ };
12
+ if (o.__reactContainer$ !== void 0)
13
+ o.__reactContainer$.render(
14
+ /* @__PURE__ */ m.jsx(
15
+ n,
16
+ {
17
+ ...r,
18
+ destroy: c
19
+ }
20
+ )
21
+ );
22
+ else {
23
+ const d = i.createRoot(o);
24
+ o.__reactContainer$ = d, d.render(
25
+ /* @__PURE__ */ m.jsx(
26
+ n,
27
+ {
28
+ ...r,
29
+ destroy: c
30
+ }
31
+ )
32
+ );
33
+ }
34
+ return c;
35
+ };
36
+ export {
37
+ p
38
+ };
@@ -0,0 +1,113 @@
1
+ import { j as n } from "./dependencies-DWmdjl5u.js";
2
+ import { useState as E, useRef as b, useEffect as S } from "react";
3
+ const k = ({
4
+ name: m,
5
+ value: s,
6
+ style: d,
7
+ checked: a,
8
+ onChange: y,
9
+ children: o,
10
+ className: x,
11
+ radioW: j = 16,
12
+ radioGap: C = 4,
13
+ checkedColor: l = "#532ce1",
14
+ unCheckedColor: c = "transparent",
15
+ disabled: u = !1
16
+ }) => {
17
+ const [e, i] = E(""), g = b(null), f = b(null), t = b(null), h = [
18
+ { value: j, name: "w" },
19
+ { value: C, name: "gap" },
20
+ {
21
+ value: l,
22
+ name: "checkedColor"
23
+ },
24
+ {
25
+ value: c,
26
+ name: "unCheckedColor"
27
+ }
28
+ ], v = (r, p, R) => {
29
+ const w = typeof r == "number";
30
+ R.style.setProperty(
31
+ `--${p}`,
32
+ w ? `${r}px` : r
33
+ );
34
+ }, N = () => {
35
+ if (!t.current || !f.current) return;
36
+ h.forEach(({ value: p, name: R }) => {
37
+ p && v(p, R, f.current);
38
+ });
39
+ const r = getComputedStyle(t.current);
40
+ e || i(r.borderColor), a ? t.current.style.borderColor = l : t.current.style.borderColor = e;
41
+ };
42
+ return S(() => {
43
+ N();
44
+ }, [f, t, a, e]), /* @__PURE__ */ n.jsxs(
45
+ "div",
46
+ {
47
+ ref: f,
48
+ className: ["ono-radio-box", x].join(" "),
49
+ style: d,
50
+ children: [
51
+ /* @__PURE__ */ n.jsx(
52
+ "div",
53
+ {
54
+ ref: t,
55
+ className: "ono-radio",
56
+ onClick: () => {
57
+ var r;
58
+ return (r = g.current) == null ? void 0 : r.click();
59
+ },
60
+ children: /* @__PURE__ */ n.jsx(
61
+ "input",
62
+ {
63
+ type: "radio",
64
+ name: m,
65
+ ref: g,
66
+ value: s + "",
67
+ checked: a,
68
+ disabled: u,
69
+ id: s + "" + o,
70
+ onChange: y
71
+ }
72
+ )
73
+ }
74
+ ),
75
+ o && /* @__PURE__ */ n.jsx("label", { htmlFor: s + "" + o || "", children: o })
76
+ ]
77
+ }
78
+ );
79
+ }, _ = ({
80
+ name: m,
81
+ style: s,
82
+ options: d,
83
+ onChange: a,
84
+ className: y,
85
+ radioW: o = 16,
86
+ radioGap: x = 4,
87
+ labelPosition: j = "right",
88
+ checkedColor: C = "#532ce1",
89
+ unCheckedColor: l = "transparent",
90
+ value: c
91
+ }) => /* @__PURE__ */ n.jsx("div", { className: ["ono-radio-group", y].join(" "), style: s, children: d.map(({ label: u, value: e, disabled: i }) => /* @__PURE__ */ n.jsx(
92
+ k,
93
+ {
94
+ name: m,
95
+ value: e,
96
+ radioW: o,
97
+ radioGap: x,
98
+ style: {
99
+ flexDirection: j === "left" ? "row-reverse" : "row"
100
+ },
101
+ checkedColor: C,
102
+ unCheckedColor: l,
103
+ onChange: () => a(e),
104
+ checked: c + "" == e + "",
105
+ disabled: typeof i == "function" ? i(c) : i || !1,
106
+ children: u
107
+ },
108
+ u
109
+ )) });
110
+ export {
111
+ k as R,
112
+ _ as a
113
+ };
@@ -0,0 +1,38 @@
1
+ import { j as i } from "./dependencies-DWmdjl5u.js";
2
+ import { useRef as m, useEffect as l } from "react";
3
+ const g = (e, t, s) => {
4
+ typeof e == "string" ? s.style.setProperty(`--${t}`, e) : s.style.setProperty(`--${t}`, `${e}px`);
5
+ }, j = ({ w: e, h: t, src: s, clr: o, className: a, onClick: f }) => {
6
+ const n = m(null), u = [
7
+ {
8
+ value: e,
9
+ name: "w"
10
+ },
11
+ {
12
+ value: t,
13
+ name: "h"
14
+ },
15
+ {
16
+ value: o,
17
+ name: "clr"
18
+ }
19
+ ], c = () => {
20
+ n.current && u.forEach((r) => {
21
+ r.value && g(r.value, r.name, n.current);
22
+ });
23
+ };
24
+ return l(() => {
25
+ c();
26
+ }, [n, o]), /* @__PURE__ */ i.jsx(
27
+ "div",
28
+ {
29
+ ref: n,
30
+ className: ["ono-svg-img", a].join(" "),
31
+ onClick: f,
32
+ children: /* @__PURE__ */ i.jsx("img", { src: s, alt: "" })
33
+ }
34
+ );
35
+ };
36
+ export {
37
+ j as S
38
+ };
@@ -0,0 +1,110 @@
1
+ import { j as s } from "./dependencies-DWmdjl5u.js";
2
+ import { p as j } from "./utils-ziqvBIOU.js";
3
+ import { useRef as c, useEffect as R } from "react";
4
+ const _ = ({
5
+ id: S,
6
+ text: e,
7
+ style: o,
8
+ color: n,
9
+ checked: h,
10
+ onChange: m,
11
+ name: N = "",
12
+ className: d,
13
+ disabled: v = !1
14
+ }) => {
15
+ const u = c(null), a = c(null), t = c(null), l = c(null), w = c(null), y = c(null), b = [
16
+ {
17
+ value: typeof n == "string" ? n : n == null ? void 0 : n.active,
18
+ name: "checkedClr"
19
+ },
20
+ {
21
+ value: typeof n == "string" || n == null ? void 0 : n.inactive,
22
+ name: "uncheckedClr"
23
+ }
24
+ ], g = (i, f, r) => {
25
+ const p = typeof i == "number";
26
+ r.style.setProperty(
27
+ `--${f}`,
28
+ p ? `${i}px` : i
29
+ );
30
+ }, k = () => {
31
+ if (!a.current || !u.current) return;
32
+ let i = 60, f = 32;
33
+ if (d || o) {
34
+ const r = getComputedStyle(a.current);
35
+ i = j(r.width), f = j(r.height);
36
+ }
37
+ [
38
+ ...b,
39
+ {
40
+ value: i,
41
+ name: "w"
42
+ },
43
+ {
44
+ value: f,
45
+ name: "h"
46
+ }
47
+ ].forEach(({ value: r, name: p }) => {
48
+ r && g(r, p, u.current);
49
+ }), requestAnimationFrame(() => {
50
+ l.current && (l.current.style.transition = "transform 0.3s");
51
+ });
52
+ }, B = (i) => {
53
+ v || m == null || m(i.currentTarget.checked, i);
54
+ };
55
+ return R(() => {
56
+ k();
57
+ }, [
58
+ a,
59
+ u,
60
+ l,
61
+ d,
62
+ o,
63
+ n,
64
+ e,
65
+ w,
66
+ y
67
+ ]), R(() => {
68
+ t.current && (t.current.checked = h);
69
+ }, [t, h]), /* @__PURE__ */ s.jsxs(
70
+ "div",
71
+ {
72
+ ref: u,
73
+ className: ["ono-switch", v ? "ono-switch-is-disabled" : ""].filter(Boolean).join(" "),
74
+ children: [
75
+ /* @__PURE__ */ s.jsx(
76
+ "input",
77
+ {
78
+ id: S,
79
+ name: N,
80
+ role: "switch",
81
+ ref: t,
82
+ type: "checkbox",
83
+ checked: h,
84
+ onChange: B
85
+ }
86
+ ),
87
+ /* @__PURE__ */ s.jsx(
88
+ "div",
89
+ {
90
+ ref: a,
91
+ className: ["ono-switch-box", d || ""].filter(Boolean).join(" "),
92
+ style: o,
93
+ onClick: () => {
94
+ var i;
95
+ return (i = t.current) == null ? void 0 : i.click();
96
+ },
97
+ children: /* @__PURE__ */ s.jsxs("div", { ref: l, className: "ono-switch-children-bar", children: [
98
+ (e == null ? void 0 : e.active) && /* @__PURE__ */ s.jsx("div", { ref: w, className: "ono-switch-children", children: e == null ? void 0 : e.active }),
99
+ /* @__PURE__ */ s.jsx("div", { className: "ono-switch-slider" }),
100
+ (e == null ? void 0 : e.inactive) && /* @__PURE__ */ s.jsx("div", { ref: y, className: "ono-switch-children", children: e == null ? void 0 : e.inactive })
101
+ ] })
102
+ }
103
+ )
104
+ ]
105
+ }
106
+ );
107
+ };
108
+ export {
109
+ _ as S
110
+ };
@@ -0,0 +1,75 @@
1
+ import { j as u } from "./dependencies-DWmdjl5u.js";
2
+ import { Q as $ } from "./utils-ziqvBIOU.js";
3
+ import { useState as b, useRef as w, useEffect as h, useCallback as j } from "react";
4
+ const N = ({
5
+ children: r,
6
+ animation: e,
7
+ className: i,
8
+ duration: c = 300,
9
+ style: f,
10
+ maskColor: y = "rgba(0, 0, 0, 0.5)",
11
+ disableContextMenu: d,
12
+ clickMaskClose: g = !0,
13
+ dialogClose: a
14
+ }) => {
15
+ const [n, m] = b(!1), s = w(null), x = () => {
16
+ if (!e || !s.current) return;
17
+ const t = s.current.parentElement.style, o = s.current.style;
18
+ switch (t.setProperty("--duration", `${c / 1e3}s`), e.type) {
19
+ case "zoom": {
20
+ const { x: l, y: P } = $(e.element), k = (l / window.innerWidth * 100).toFixed(2) + "%", v = (P / window.innerHeight * 100).toFixed(2) + "%";
21
+ o.setProperty("--left", k), o.setProperty("--top", v);
22
+ break;
23
+ }
24
+ case "fade": {
25
+ const l = e.direction === "left-center" ? "--left" : "--top";
26
+ o.setProperty(l, e.startPosition);
27
+ break;
28
+ }
29
+ }
30
+ }, p = () => {
31
+ if (s.current)
32
+ if (m(!0), e) {
33
+ const t = s.current;
34
+ t.classList.remove(`ono-${e.type}-enter`), t.classList.add(`ono-${e.type}-leave`), setTimeout(a, c);
35
+ } else
36
+ a();
37
+ };
38
+ h(() => {
39
+ x();
40
+ }, [s, e]);
41
+ const C = j(() => {
42
+ if (!e) return "";
43
+ const t = `ono-${e.type}-enter`, o = `ono-${e.type}-leave`;
44
+ return n ? o : t;
45
+ }, [e, n]);
46
+ return /* @__PURE__ */ u.jsx(
47
+ "div",
48
+ {
49
+ className: `
50
+ ono-mask
51
+ ono-mask-${n ? "leave" : "enter"}
52
+ `,
53
+ style: { background: y },
54
+ onClick: () => g && p(),
55
+ onContextMenu: (t) => d && t.preventDefault(),
56
+ children: /* @__PURE__ */ u.jsx(
57
+ "div",
58
+ {
59
+ ref: s,
60
+ className: `
61
+ ono-dialog
62
+ ${i || ""}
63
+ ${C()}
64
+ `,
65
+ style: f,
66
+ onClick: (t) => t.stopPropagation(),
67
+ children: typeof r == "function" ? r(p) : r
68
+ }
69
+ )
70
+ }
71
+ );
72
+ };
73
+ export {
74
+ N as T
75
+ };