ono-react-element 0.0.7 → 0.0.9

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 (79) hide show
  1. package/dist/es/AutoSliderList-Dy-otnYu.js +30 -0
  2. package/dist/es/AvatarCrop-DrA-SARP.js +65 -0
  3. package/dist/es/Button-C89izu2m.js +26 -0
  4. package/dist/es/Card3D-DMvCSUhe.js +18 -0
  5. package/dist/es/Checkbox-daBabj14.js +19 -0
  6. package/dist/es/InjunctiveBox-D0V-K9Pn.js +11 -0
  7. package/dist/es/Input-Z3uL5-nj.js +80 -0
  8. package/dist/es/List-UAKCMuGC.js +19 -0
  9. package/dist/es/MenuButton-DHkU5Bq7.js +17 -0
  10. package/dist/es/Message-GvTC61N0.js +68 -0
  11. package/dist/es/Modal-C-c_S_VM.js +32 -0
  12. package/dist/es/Pagination-m71H2tfS.js +17 -0
  13. package/dist/es/PortalRenderer-CDAzQJgm.js +19 -0
  14. package/dist/es/Radio-D_GKVoOC.js +25 -0
  15. package/dist/es/Select-y-aAIqxg.js +23 -0
  16. package/dist/es/SvgImg-CZwq2D7J.js +14 -0
  17. package/dist/es/Switch-CN3M5pXb.js +34 -0
  18. package/dist/es/TemplateDialog-fX7Ie-xU.js +45 -0
  19. package/dist/es/Toast-BadlA1yD.js +42 -0
  20. package/dist/es/Tooltip-C5OFmxWo.js +29 -0
  21. package/dist/es/VirtualList-BeDq637Z.js +65 -0
  22. package/dist/es/Waterfall-a_c3urjB.js +55 -0
  23. package/dist/es/dependencies-CbQbPZZ-.js +15524 -0
  24. package/dist/es/hooks-Dew3_cmY.js +103 -0
  25. package/dist/es/index.js +102 -233
  26. package/dist/es/style/AutoSliderList.css +1 -0
  27. package/dist/es/style/AvatarCrop.css +1 -0
  28. package/dist/es/style/Button.css +1 -0
  29. package/dist/es/style/Card3D.css +1 -0
  30. package/dist/es/style/Checkbox.css +1 -0
  31. package/dist/es/style/Input.css +1 -0
  32. package/dist/es/style/MenuButton.css +1 -0
  33. package/dist/es/style/Message.css +1 -0
  34. package/dist/es/style/Modal.css +1 -0
  35. package/dist/es/style/Pagination.css +1 -0
  36. package/dist/es/style/Radio.css +1 -0
  37. package/dist/es/style/Select.css +1 -0
  38. package/dist/es/style/SvgImg.css +1 -0
  39. package/dist/es/style/Switch.css +1 -0
  40. package/dist/es/style/TemplateDialog.css +1 -0
  41. package/dist/es/style/Toast.css +1 -0
  42. package/dist/es/style/Tooltip.css +1 -0
  43. package/dist/es/style/Waterfall.css +1 -0
  44. package/dist/es/style/index.css +1 -0
  45. package/dist/es/utils-BxXROOPY.js +394 -0
  46. package/dist/index.css +1 -1
  47. package/dist/types/index.d.ts +2 -2
  48. package/dist/types/utils/common.d.ts +36 -20
  49. package/dist/umd/index.css +1 -1
  50. package/dist/umd/index.css.br +0 -0
  51. package/dist/umd/index.css.gz +0 -0
  52. package/dist/umd/index.umd.cjs +16578 -295
  53. package/dist/umd/index.umd.cjs.br +0 -0
  54. package/dist/umd/index.umd.cjs.gz +0 -0
  55. package/package.json +56 -49
  56. package/dist/es/AutoSliderList-DN4Sec6L.js +0 -106
  57. package/dist/es/AvatarCrop-DzGw2FVQ.js +0 -225
  58. package/dist/es/Button-CdxyXFF4.js +0 -72
  59. package/dist/es/Card3D-sf3zmiHk.js +0 -41
  60. package/dist/es/Checkbox-BN7rT73n.js +0 -62
  61. package/dist/es/InjunctiveBox-CGpy0PxH.js +0 -39
  62. package/dist/es/Input-DoY3kR7J.js +0 -301
  63. package/dist/es/List-B9mP7VjN.js +0 -35
  64. package/dist/es/MenuButton-CuOdVlg0.js +0 -62
  65. package/dist/es/Message-TfweOOpK.js +0 -219
  66. package/dist/es/Modal-CHgTYu-I.js +0 -154
  67. package/dist/es/Pagination-BtmtUkVw.js +0 -110
  68. package/dist/es/PortalRenderer-8Iur-eZp.js +0 -38
  69. package/dist/es/Radio-BmSpqdK8.js +0 -113
  70. package/dist/es/SvgImg-Bcmzdjzl.js +0 -38
  71. package/dist/es/Switch-DwDBR0sG.js +0 -110
  72. package/dist/es/TemplateDialog-SXrElzoR.js +0 -75
  73. package/dist/es/Toast-C7ybVNyd.js +0 -174
  74. package/dist/es/Tooltip-BtzG0TSW.js +0 -94
  75. package/dist/es/VirtualList-OG7kqLe0.js +0 -160
  76. package/dist/es/Waterfall-GHdJxww4.js +0 -131
  77. package/dist/es/dependencies-DWmdjl5u.js +0 -25491
  78. package/dist/es/hooks-CQN6qu4t.js +0 -159
  79. package/dist/es/utils-BLV_TQU3.js +0 -585
@@ -1,154 +0,0 @@
1
- import { j as o } from "./dependencies-DWmdjl5u.js";
2
- import { f as i } from "./utils-BLV_TQU3.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
- };
@@ -1,110 +0,0 @@
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
- };
@@ -1,38 +0,0 @@
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
- };
@@ -1,113 +0,0 @@
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
- };
@@ -1,38 +0,0 @@
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
- };
@@ -1,110 +0,0 @@
1
- import { j as s } from "./dependencies-DWmdjl5u.js";
2
- import { p as j } from "./utils-BLV_TQU3.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
- };
@@ -1,75 +0,0 @@
1
- import { j as u } from "./dependencies-DWmdjl5u.js";
2
- import { C as $ } from "./utils-BLV_TQU3.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, C] = b(!1), s = w(null), m = () => {
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 (C(!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
- m();
40
- }, [s, e]);
41
- const x = 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
- ${x()}
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
- };