@cfx-dev/ui-components 3.0.4 → 4.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.
- package/dist/Select-Ds-fm4CN.js +3245 -0
- package/dist/assets/all_css.css +2 -0
- package/dist/assets/css/DropdownSelect.css +1 -0
- package/dist/assets/css/Input.css +1 -1
- package/dist/assets/css/Modal.css +1 -1
- package/dist/assets/css/Slider.css +1 -0
- package/dist/assets/general/global.css +1 -1
- package/dist/components/Checkbox/Checkbox.js +190 -118
- package/dist/components/DropdownSelect/DropdownSelect.d.ts +16 -0
- package/dist/components/DropdownSelect/DropdownSelect.js +2393 -0
- package/dist/components/DropdownSelect/DropdownSelectShowcase.d.ts +5 -0
- package/dist/components/DropdownSelect/DropdownSelectShowcase.js +52 -0
- package/dist/components/DropdownSelect/index.d.ts +1 -0
- package/dist/components/DropdownSelect/index.js +4 -0
- package/dist/components/Input/Input.js +4 -4
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.js +7 -3092
- package/dist/components/Select/SelectShowcase.js +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.js +3 -2
- package/dist/components/Slider/Slider.d.ts +11 -0
- package/dist/components/Slider/Slider.js +606 -0
- package/dist/components/Slider/SliderShowcase.d.ts +5 -0
- package/dist/components/Slider/SliderShowcase.js +63 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +4 -0
- package/dist/components/Switch/Switch.js +131 -68
- package/dist/components/ui.d.ts +2 -2
- package/dist/components/ui.js +13 -13
- package/dist/index-BCnz73Lm.js +72 -0
- package/dist/index-BW3WdIgK.js +14 -0
- package/dist/index-BlbvKsmN.js +82 -0
- package/dist/index-CjTSD6zB.js +161 -0
- package/dist/main.d.ts +3 -1
- package/dist/main.js +69 -65
- package/dist/styles-scss/_ui.scss +5 -5
- package/package.json +3 -1
- package/dist/index-CjWRnNpt.js +0 -210
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import i from "react";
|
|
3
|
+
import { Flex as l } from "../Layout/Flex/Flex.js";
|
|
4
|
+
import { Text as r } from "../Text/Text.js";
|
|
5
|
+
import { Slider as t } from "./Slider.js";
|
|
6
|
+
function m() {
|
|
7
|
+
return /* @__PURE__ */ a(l, { gap: "large", vertical: !0, children: [
|
|
8
|
+
/* @__PURE__ */ a(l, { gap: "normal", vertical: !0, children: [
|
|
9
|
+
/* @__PURE__ */ e(r, { children: "Default Slider" }),
|
|
10
|
+
/* @__PURE__ */ e(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
style: {
|
|
14
|
+
marginTop: "40px",
|
|
15
|
+
marginLeft: "40px"
|
|
16
|
+
},
|
|
17
|
+
children: /* @__PURE__ */ e(
|
|
18
|
+
t,
|
|
19
|
+
{
|
|
20
|
+
defaultValue: [5],
|
|
21
|
+
max: 5e3,
|
|
22
|
+
step: 1,
|
|
23
|
+
ariaLabel: "Volume",
|
|
24
|
+
className: "",
|
|
25
|
+
minLabel: 0,
|
|
26
|
+
maxLabel: 5e3,
|
|
27
|
+
title: "Upvotes"
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ a(l, { gap: "normal", vertical: !0, children: [
|
|
34
|
+
/* @__PURE__ */ e(r, { children: "Custom Slider" }),
|
|
35
|
+
/* @__PURE__ */ e(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
style: {
|
|
39
|
+
marginTop: "40px",
|
|
40
|
+
marginLeft: "40px"
|
|
41
|
+
},
|
|
42
|
+
children: /* @__PURE__ */ e(
|
|
43
|
+
t,
|
|
44
|
+
{
|
|
45
|
+
defaultValue: [10],
|
|
46
|
+
max: 200,
|
|
47
|
+
step: 5,
|
|
48
|
+
ariaLabel: "Custom Slider",
|
|
49
|
+
className: "custom-slider-class",
|
|
50
|
+
minLabel: 0,
|
|
51
|
+
maxLabel: 1e4,
|
|
52
|
+
title: "Upvotes"
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] })
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
const p = i.memo(m);
|
|
61
|
+
export {
|
|
62
|
+
p as default
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Slider } from './Slider';
|
|
@@ -1,96 +1,159 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { jsx as l, jsxs as $ } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
|
+
import g from "react";
|
|
4
|
+
import { u as B, a as U, b as j } from "../../index-BCnz73Lm.js";
|
|
5
|
+
import { P } from "../../index-BlbvKsmN.js";
|
|
5
6
|
import { clsx as k } from "../../utils/clsx.js";
|
|
6
|
-
|
|
7
|
+
function I(t, o, { checkForDefaultPrevented: e = !0 } = {}) {
|
|
8
|
+
return function(c) {
|
|
9
|
+
if (t == null || t(c), e === !1 || !c.defaultPrevented)
|
|
10
|
+
return o == null ? void 0 : o(c);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function E(t, o) {
|
|
14
|
+
typeof t == "function" ? t(o) : t != null && (t.current = o);
|
|
15
|
+
}
|
|
16
|
+
function O(...t) {
|
|
17
|
+
return (o) => t.forEach((e) => E(e, o));
|
|
18
|
+
}
|
|
19
|
+
function q(...t) {
|
|
20
|
+
return u.useCallback(O(...t), t);
|
|
21
|
+
}
|
|
22
|
+
function z(t, o = []) {
|
|
23
|
+
let e = [];
|
|
24
|
+
function r(h, n) {
|
|
25
|
+
const s = u.createContext(n), i = e.length;
|
|
26
|
+
e = [...e, n];
|
|
27
|
+
function f(a) {
|
|
28
|
+
const { scope: p, children: b, ...d } = a, S = (p == null ? void 0 : p[t][i]) || s, m = u.useMemo(() => d, Object.values(d));
|
|
29
|
+
return /* @__PURE__ */ l(S.Provider, { value: m, children: b });
|
|
30
|
+
}
|
|
31
|
+
function w(a, p) {
|
|
32
|
+
const b = (p == null ? void 0 : p[t][i]) || s, d = u.useContext(b);
|
|
33
|
+
if (d) return d;
|
|
34
|
+
if (n !== void 0) return n;
|
|
35
|
+
throw new Error(`\`${a}\` must be used within \`${h}\``);
|
|
36
|
+
}
|
|
37
|
+
return f.displayName = h + "Provider", [f, w];
|
|
38
|
+
}
|
|
39
|
+
const c = () => {
|
|
40
|
+
const h = e.map((n) => u.createContext(n));
|
|
41
|
+
return function(s) {
|
|
42
|
+
const i = (s == null ? void 0 : s[t]) || h;
|
|
43
|
+
return u.useMemo(
|
|
44
|
+
() => ({ [`__scope${t}`]: { ...s, [t]: i } }),
|
|
45
|
+
[s, i]
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
return c.scopeName = t, [r, A(c, ...o)];
|
|
50
|
+
}
|
|
51
|
+
function A(...t) {
|
|
52
|
+
const o = t[0];
|
|
53
|
+
if (t.length === 1) return o;
|
|
54
|
+
const e = () => {
|
|
55
|
+
const r = t.map((c) => ({
|
|
56
|
+
useScope: c(),
|
|
57
|
+
scopeName: c.scopeName
|
|
58
|
+
}));
|
|
59
|
+
return function(h) {
|
|
60
|
+
const n = r.reduce((s, { useScope: i, scopeName: f }) => {
|
|
61
|
+
const a = i(h)[`__scope${f}`];
|
|
62
|
+
return { ...s, ...a };
|
|
63
|
+
}, {});
|
|
64
|
+
return u.useMemo(() => ({ [`__scope${o.scopeName}`]: n }), [n]);
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
return e.scopeName = o.scopeName, e;
|
|
68
|
+
}
|
|
69
|
+
var x = "Switch", [D, ot] = z(x), [F, L] = D(x), v = u.forwardRef(
|
|
7
70
|
(t, o) => {
|
|
8
71
|
const {
|
|
9
72
|
__scopeSwitch: e,
|
|
10
|
-
name:
|
|
11
|
-
checked:
|
|
12
|
-
defaultChecked:
|
|
13
|
-
required:
|
|
14
|
-
disabled:
|
|
15
|
-
value:
|
|
73
|
+
name: r,
|
|
74
|
+
checked: c,
|
|
75
|
+
defaultChecked: h,
|
|
76
|
+
required: n,
|
|
77
|
+
disabled: s,
|
|
78
|
+
value: i = "on",
|
|
16
79
|
onCheckedChange: f,
|
|
17
|
-
...
|
|
18
|
-
} = t, [
|
|
19
|
-
prop:
|
|
20
|
-
defaultProp:
|
|
80
|
+
...w
|
|
81
|
+
} = t, [a, p] = u.useState(null), b = q(o, (_) => p(_)), d = u.useRef(!1), S = a ? !!a.closest("form") : !0, [m = !1, N] = B({
|
|
82
|
+
prop: c,
|
|
83
|
+
defaultProp: h,
|
|
21
84
|
onChange: f
|
|
22
85
|
});
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
86
|
+
return /* @__PURE__ */ $(F, { scope: e, checked: m, disabled: s, children: [
|
|
87
|
+
/* @__PURE__ */ l(
|
|
88
|
+
P.button,
|
|
26
89
|
{
|
|
27
90
|
type: "button",
|
|
28
91
|
role: "switch",
|
|
29
|
-
"aria-checked":
|
|
30
|
-
"aria-required":
|
|
31
|
-
"data-state":
|
|
32
|
-
"data-disabled":
|
|
33
|
-
disabled:
|
|
34
|
-
value:
|
|
35
|
-
...
|
|
36
|
-
ref:
|
|
37
|
-
onClick:
|
|
38
|
-
|
|
92
|
+
"aria-checked": m,
|
|
93
|
+
"aria-required": n,
|
|
94
|
+
"data-state": T(m),
|
|
95
|
+
"data-disabled": s ? "" : void 0,
|
|
96
|
+
disabled: s,
|
|
97
|
+
value: i,
|
|
98
|
+
...w,
|
|
99
|
+
ref: b,
|
|
100
|
+
onClick: I(t.onClick, (_) => {
|
|
101
|
+
N((M) => !M), S && (d.current = _.isPropagationStopped(), d.current || _.stopPropagation());
|
|
39
102
|
})
|
|
40
103
|
}
|
|
41
104
|
),
|
|
42
|
-
|
|
43
|
-
|
|
105
|
+
S && /* @__PURE__ */ l(
|
|
106
|
+
W,
|
|
44
107
|
{
|
|
45
|
-
control:
|
|
46
|
-
bubbles: !
|
|
47
|
-
name:
|
|
48
|
-
value:
|
|
49
|
-
checked:
|
|
50
|
-
required:
|
|
51
|
-
disabled:
|
|
108
|
+
control: a,
|
|
109
|
+
bubbles: !d.current,
|
|
110
|
+
name: r,
|
|
111
|
+
value: i,
|
|
112
|
+
checked: m,
|
|
113
|
+
required: n,
|
|
114
|
+
disabled: s,
|
|
52
115
|
style: { transform: "translateX(-100%)" }
|
|
53
116
|
}
|
|
54
117
|
)
|
|
55
118
|
] });
|
|
56
119
|
}
|
|
57
120
|
);
|
|
58
|
-
|
|
59
|
-
var R = "SwitchThumb",
|
|
121
|
+
v.displayName = x;
|
|
122
|
+
var R = "SwitchThumb", y = u.forwardRef(
|
|
60
123
|
(t, o) => {
|
|
61
|
-
const { __scopeSwitch: e, ...
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
|
|
124
|
+
const { __scopeSwitch: e, ...r } = t, c = L(R, e);
|
|
125
|
+
return /* @__PURE__ */ l(
|
|
126
|
+
P.span,
|
|
64
127
|
{
|
|
65
|
-
"data-state":
|
|
66
|
-
"data-disabled":
|
|
67
|
-
...
|
|
128
|
+
"data-state": T(c.checked),
|
|
129
|
+
"data-disabled": c.disabled ? "" : void 0,
|
|
130
|
+
...r,
|
|
68
131
|
ref: o
|
|
69
132
|
}
|
|
70
133
|
);
|
|
71
134
|
}
|
|
72
135
|
);
|
|
73
|
-
|
|
74
|
-
var
|
|
75
|
-
const { control: o, checked: e, bubbles:
|
|
76
|
-
return
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
136
|
+
y.displayName = R;
|
|
137
|
+
var W = (t) => {
|
|
138
|
+
const { control: o, checked: e, bubbles: r = !0, ...c } = t, h = u.useRef(null), n = U(e), s = j(o);
|
|
139
|
+
return u.useEffect(() => {
|
|
140
|
+
const i = h.current, f = window.HTMLInputElement.prototype, a = Object.getOwnPropertyDescriptor(f, "checked").set;
|
|
141
|
+
if (n !== e && a) {
|
|
142
|
+
const p = new Event("click", { bubbles: r });
|
|
143
|
+
a.call(i, e), i.dispatchEvent(p);
|
|
81
144
|
}
|
|
82
|
-
}, [
|
|
145
|
+
}, [n, e, r]), /* @__PURE__ */ l(
|
|
83
146
|
"input",
|
|
84
147
|
{
|
|
85
148
|
type: "checkbox",
|
|
86
149
|
"aria-hidden": !0,
|
|
87
150
|
defaultChecked: e,
|
|
88
|
-
...
|
|
151
|
+
...c,
|
|
89
152
|
tabIndex: -1,
|
|
90
|
-
ref:
|
|
153
|
+
ref: h,
|
|
91
154
|
style: {
|
|
92
155
|
...t.style,
|
|
93
|
-
...
|
|
156
|
+
...s,
|
|
94
157
|
position: "absolute",
|
|
95
158
|
pointerEvents: "none",
|
|
96
159
|
opacity: 0,
|
|
@@ -99,24 +162,24 @@ var $ = (t) => {
|
|
|
99
162
|
}
|
|
100
163
|
);
|
|
101
164
|
};
|
|
102
|
-
function
|
|
165
|
+
function T(t) {
|
|
103
166
|
return t ? "checked" : "unchecked";
|
|
104
167
|
}
|
|
105
|
-
var
|
|
106
|
-
const
|
|
107
|
-
switchUnset:
|
|
108
|
-
switchRoot:
|
|
109
|
-
switchThumb:
|
|
168
|
+
var X = v, G = y;
|
|
169
|
+
const J = "cfxui__Switch__switchUnset__c8b03", K = "cfxui__Switch__switchRoot__f2911", Q = "cfxui__Switch__switchThumb__9cbf5", C = {
|
|
170
|
+
switchUnset: J,
|
|
171
|
+
switchRoot: K,
|
|
172
|
+
switchThumb: Q
|
|
110
173
|
};
|
|
111
|
-
function
|
|
174
|
+
function V(t) {
|
|
112
175
|
const {
|
|
113
176
|
classNameRoot: o,
|
|
114
177
|
classNameThumb: e,
|
|
115
|
-
...
|
|
178
|
+
...r
|
|
116
179
|
} = t;
|
|
117
|
-
return /* @__PURE__ */
|
|
180
|
+
return /* @__PURE__ */ l(X, { ...r, className: k(C.switchRoot, C.switchUnset, o), children: /* @__PURE__ */ l(G, { className: k(C.switchThumb, e) }) });
|
|
118
181
|
}
|
|
119
|
-
const
|
|
182
|
+
const ct = g.memo(V);
|
|
120
183
|
export {
|
|
121
|
-
|
|
184
|
+
ct as default
|
|
122
185
|
};
|
package/dist/components/ui.d.ts
CHANGED
|
@@ -16,10 +16,10 @@ export declare enum OffsetEnum {
|
|
|
16
16
|
export type OffesetType = keyof typeof OffsetEnum;
|
|
17
17
|
export declare enum MediaQueryEnum {
|
|
18
18
|
initial = "initial",
|
|
19
|
-
xxsmall = "xxsmall",
|
|
20
|
-
xsmall = "xsmall",
|
|
21
19
|
small = "small",
|
|
20
|
+
'small-medium' = "small-medium",
|
|
22
21
|
medium = "medium",
|
|
22
|
+
'medium-large' = "medium-large",
|
|
23
23
|
large = "large",
|
|
24
24
|
xlarge = "xlarge"
|
|
25
25
|
}
|
package/dist/components/ui.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var z = /* @__PURE__ */ ((t) => (t.none = "none", t.hairthin = "hairthin", t.thin = "thin", t.xxsmall = "xxsmall", t.xsmall = "xsmall", t.small = "small", t.normal = "normal", t.medium = "medium", t.large = "large", t.xlarge = "xlarge", t.safezone = "safezone", t))(z || {}), A = /* @__PURE__ */ ((t) => (t.initial = "initial", t.
|
|
1
|
+
var z = /* @__PURE__ */ ((t) => (t.none = "none", t.hairthin = "hairthin", t.thin = "thin", t.xxsmall = "xxsmall", t.xsmall = "xsmall", t.small = "small", t.normal = "normal", t.medium = "medium", t.large = "large", t.xlarge = "xlarge", t.safezone = "safezone", t))(z || {}), A = /* @__PURE__ */ ((t) => (t.initial = "initial", t.small = "small", t["small-medium"] = "small-medium", t.medium = "medium", t["medium-large"] = "medium-large", t.large = "large", t.xlarge = "xlarge", t))(A || {}), d;
|
|
2
2
|
((t) => {
|
|
3
3
|
function i(r = 1) {
|
|
4
4
|
return `calc(var(--quant) * ${r})`;
|
|
5
5
|
}
|
|
6
6
|
t.q = i;
|
|
7
|
-
function
|
|
7
|
+
function m(r) {
|
|
8
8
|
return `var(--offset-${r})`;
|
|
9
9
|
}
|
|
10
|
-
t.offset =
|
|
10
|
+
t.offset = m;
|
|
11
11
|
function u(r = "normal") {
|
|
12
12
|
return `var(--font-size-${r})`;
|
|
13
13
|
}
|
|
@@ -25,20 +25,20 @@ var z = /* @__PURE__ */ ((t) => (t.none = "none", t.hairthin = "hairthin", t.thi
|
|
|
25
25
|
})(t.cls || (t.cls = {})), t.pc = (r) => `${r}%`, t.px = (r) => `${r}px`, t.ch = (r) => `${r}ch`, t.em = (r) => `${r}em`, t.rem = (r) => `${r}rem`, t.vh = (r) => `${r}vh`, t.vw = (r) => `${r}vw`, t.url = (r) => `url(${r})`, t.getOffsetAttrs = (r, l) => typeof l == "string" || typeof l == "number" ? {
|
|
26
26
|
[`data-${r}-initial`]: l.toString()
|
|
27
27
|
} : Object.entries(l).reduce((n, [e, o]) => (n[`data-${r}-${e}`] = o.toString(), n), {}), t.getOffsetStyles = (r, l) => typeof l == "string" ? {
|
|
28
|
-
[`--${r}-initial`]:
|
|
28
|
+
[`--${r}-initial`]: m(l)
|
|
29
29
|
} : typeof l == "number" ? {
|
|
30
30
|
[`--${r}-initial`]: i(l)
|
|
31
|
-
} : Object.entries(l).reduce((n, [e, o]) => (n[`--${r}-${e}`] = typeof o == "number" ? i(o) :
|
|
32
|
-
function
|
|
31
|
+
} : Object.entries(l).reduce((n, [e, o]) => (n[`--${r}-${e}`] = typeof o == "number" ? i(o) : m(o), n), {});
|
|
32
|
+
function s(r, l) {
|
|
33
33
|
const {
|
|
34
34
|
m: n,
|
|
35
35
|
mt: e,
|
|
36
36
|
mr: o,
|
|
37
37
|
mb: f,
|
|
38
|
-
ml:
|
|
39
|
-
p:
|
|
38
|
+
ml: g,
|
|
39
|
+
p: $,
|
|
40
40
|
pt: p,
|
|
41
|
-
pr:
|
|
41
|
+
pr: x,
|
|
42
42
|
pb: a,
|
|
43
43
|
pl: h
|
|
44
44
|
} = r;
|
|
@@ -47,15 +47,15 @@ var z = /* @__PURE__ */ ((t) => (t.none = "none", t.hairthin = "hairthin", t.thi
|
|
|
47
47
|
...e ? l("mt", e) : null,
|
|
48
48
|
...o ? l("mr", o) : null,
|
|
49
49
|
...f ? l("mb", f) : null,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
...g ? l("ml", g) : null,
|
|
51
|
+
...$ ? l("p", $) : null,
|
|
52
52
|
...p ? l("pt", p) : null,
|
|
53
|
-
...
|
|
53
|
+
...x ? l("pr", x) : null,
|
|
54
54
|
...a ? l("pb", a) : null,
|
|
55
55
|
...h ? l("pl", h) : null
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
t.callAllMPProps =
|
|
58
|
+
t.callAllMPProps = s, t.getAllMPStyles = (r) => s(r, t.getOffsetStyles), t.getAllMPAttrs = (r) => s(r, t.getOffsetAttrs);
|
|
59
59
|
})(d || (d = {}));
|
|
60
60
|
export {
|
|
61
61
|
A as MediaQueryEnum,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
function l(e) {
|
|
3
|
+
const t = s.useRef(e);
|
|
4
|
+
return s.useEffect(() => {
|
|
5
|
+
t.current = e;
|
|
6
|
+
}), s.useMemo(() => (...o) => {
|
|
7
|
+
var r;
|
|
8
|
+
return (r = t.current) == null ? void 0 : r.call(t, ...o);
|
|
9
|
+
}, []);
|
|
10
|
+
}
|
|
11
|
+
function S({
|
|
12
|
+
prop: e,
|
|
13
|
+
defaultProp: t,
|
|
14
|
+
onChange: o = () => {
|
|
15
|
+
}
|
|
16
|
+
}) {
|
|
17
|
+
const [r, n] = b({ defaultProp: t, onChange: o }), u = e !== void 0, f = u ? e : r, c = l(o), a = s.useCallback(
|
|
18
|
+
(i) => {
|
|
19
|
+
if (u) {
|
|
20
|
+
const d = typeof i == "function" ? i(e) : i;
|
|
21
|
+
d !== e && c(d);
|
|
22
|
+
} else
|
|
23
|
+
n(i);
|
|
24
|
+
},
|
|
25
|
+
[u, e, n, c]
|
|
26
|
+
);
|
|
27
|
+
return [f, a];
|
|
28
|
+
}
|
|
29
|
+
function b({
|
|
30
|
+
defaultProp: e,
|
|
31
|
+
onChange: t
|
|
32
|
+
}) {
|
|
33
|
+
const o = s.useState(e), [r] = o, n = s.useRef(r), u = l(t);
|
|
34
|
+
return s.useEffect(() => {
|
|
35
|
+
n.current !== r && (u(r), n.current = r);
|
|
36
|
+
}, [r, n, u]), o;
|
|
37
|
+
}
|
|
38
|
+
function z(e) {
|
|
39
|
+
const t = s.useRef({ value: e, previous: e });
|
|
40
|
+
return s.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
|
|
41
|
+
}
|
|
42
|
+
var h = globalThis != null && globalThis.document ? s.useLayoutEffect : () => {
|
|
43
|
+
};
|
|
44
|
+
function y(e) {
|
|
45
|
+
const [t, o] = s.useState(void 0);
|
|
46
|
+
return h(() => {
|
|
47
|
+
if (e) {
|
|
48
|
+
o({ width: e.offsetWidth, height: e.offsetHeight });
|
|
49
|
+
const r = new ResizeObserver((n) => {
|
|
50
|
+
if (!Array.isArray(n) || !n.length)
|
|
51
|
+
return;
|
|
52
|
+
const u = n[0];
|
|
53
|
+
let f, c;
|
|
54
|
+
if ("borderBoxSize" in u) {
|
|
55
|
+
const a = u.borderBoxSize, i = Array.isArray(a) ? a[0] : a;
|
|
56
|
+
f = i.inlineSize, c = i.blockSize;
|
|
57
|
+
} else
|
|
58
|
+
f = e.offsetWidth, c = e.offsetHeight;
|
|
59
|
+
o({ width: f, height: c });
|
|
60
|
+
});
|
|
61
|
+
return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
|
|
62
|
+
} else
|
|
63
|
+
o(void 0);
|
|
64
|
+
}, [e]), t;
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
z as a,
|
|
68
|
+
y as b,
|
|
69
|
+
h as c,
|
|
70
|
+
l as d,
|
|
71
|
+
S as u
|
|
72
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
function i(t, [o, e]) {
|
|
4
|
+
return Math.min(e, Math.max(o, t));
|
|
5
|
+
}
|
|
6
|
+
var n = r.createContext(void 0);
|
|
7
|
+
function c(t) {
|
|
8
|
+
const o = r.useContext(n);
|
|
9
|
+
return t || o || "ltr";
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
i as c,
|
|
13
|
+
c as u
|
|
14
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { r as d } from "./index-2hJuj4UN.js";
|
|
3
|
+
import { jsx as c, Fragment as m } from "react/jsx-runtime";
|
|
4
|
+
function h(r, e) {
|
|
5
|
+
typeof r == "function" ? r(e) : r != null && (r.current = e);
|
|
6
|
+
}
|
|
7
|
+
function y(...r) {
|
|
8
|
+
return (e) => r.forEach((n) => h(n, e));
|
|
9
|
+
}
|
|
10
|
+
var u = o.forwardRef((r, e) => {
|
|
11
|
+
const { children: n, ...t } = r, i = o.Children.toArray(n), l = i.find(E);
|
|
12
|
+
if (l) {
|
|
13
|
+
const s = l.props.children, a = i.map((p) => p === l ? o.Children.count(s) > 1 ? o.Children.only(null) : o.isValidElement(s) ? s.props.children : null : p);
|
|
14
|
+
return /* @__PURE__ */ c(f, { ...t, ref: e, children: o.isValidElement(s) ? o.cloneElement(s, void 0, a) : null });
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ c(f, { ...t, ref: e, children: n });
|
|
17
|
+
});
|
|
18
|
+
u.displayName = "Slot";
|
|
19
|
+
var f = o.forwardRef((r, e) => {
|
|
20
|
+
const { children: n, ...t } = r;
|
|
21
|
+
if (o.isValidElement(n)) {
|
|
22
|
+
const i = C(n);
|
|
23
|
+
return o.cloneElement(n, {
|
|
24
|
+
...g(t, n.props),
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
ref: e ? y(e, i) : i
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return o.Children.count(n) > 1 ? o.Children.only(null) : null;
|
|
30
|
+
});
|
|
31
|
+
f.displayName = "SlotClone";
|
|
32
|
+
var v = ({ children: r }) => /* @__PURE__ */ c(m, { children: r });
|
|
33
|
+
function E(r) {
|
|
34
|
+
return o.isValidElement(r) && r.type === v;
|
|
35
|
+
}
|
|
36
|
+
function g(r, e) {
|
|
37
|
+
const n = { ...e };
|
|
38
|
+
for (const t in e) {
|
|
39
|
+
const i = r[t], l = e[t];
|
|
40
|
+
/^on[A-Z]/.test(t) ? i && l ? n[t] = (...a) => {
|
|
41
|
+
l(...a), i(...a);
|
|
42
|
+
} : i && (n[t] = i) : t === "style" ? n[t] = { ...i, ...l } : t === "className" && (n[t] = [i, l].filter(Boolean).join(" "));
|
|
43
|
+
}
|
|
44
|
+
return { ...r, ...n };
|
|
45
|
+
}
|
|
46
|
+
function C(r) {
|
|
47
|
+
var t, i;
|
|
48
|
+
let e = (t = Object.getOwnPropertyDescriptor(r.props, "ref")) == null ? void 0 : t.get, n = e && "isReactWarning" in e && e.isReactWarning;
|
|
49
|
+
return n ? r.ref : (e = (i = Object.getOwnPropertyDescriptor(r, "ref")) == null ? void 0 : i.get, n = e && "isReactWarning" in e && e.isReactWarning, n ? r.props.ref : r.props.ref || r.ref);
|
|
50
|
+
}
|
|
51
|
+
var R = [
|
|
52
|
+
"a",
|
|
53
|
+
"button",
|
|
54
|
+
"div",
|
|
55
|
+
"form",
|
|
56
|
+
"h2",
|
|
57
|
+
"h3",
|
|
58
|
+
"img",
|
|
59
|
+
"input",
|
|
60
|
+
"label",
|
|
61
|
+
"li",
|
|
62
|
+
"nav",
|
|
63
|
+
"ol",
|
|
64
|
+
"p",
|
|
65
|
+
"span",
|
|
66
|
+
"svg",
|
|
67
|
+
"ul"
|
|
68
|
+
], P = R.reduce((r, e) => {
|
|
69
|
+
const n = o.forwardRef((t, i) => {
|
|
70
|
+
const { asChild: l, ...s } = t, a = l ? u : e;
|
|
71
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ c(a, { ...s, ref: i });
|
|
72
|
+
});
|
|
73
|
+
return n.displayName = `Primitive.${e}`, { ...r, [e]: n };
|
|
74
|
+
}, {});
|
|
75
|
+
function b(r, e) {
|
|
76
|
+
r && d.flushSync(() => r.dispatchEvent(e));
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
P,
|
|
80
|
+
u as S,
|
|
81
|
+
b as d
|
|
82
|
+
};
|