@solibo/solibo-ui 0.5.12 → 0.5.14
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/assets/index11.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/components/_card/index.cjs +1 -1
- package/dist/components/_card/index.cjs.map +1 -1
- package/dist/components/_card/index.js +10 -10
- package/dist/components/_card/index.js.map +1 -1
- package/dist/components/_collapsible/index.cjs +1 -1
- package/dist/components/_collapsible/index.js +1 -1
- package/dist/components/_dropdown/index.cjs +1 -1
- package/dist/components/_dropdown/index.js +2 -2
- package/dist/components/_menu/index.cjs +1 -1
- package/dist/components/_menu/index.cjs.map +1 -1
- package/dist/components/_menu/index.js +25 -25
- package/dist/components/_menu/index.js.map +1 -1
- package/dist/components/_sortable/index.cjs +1 -1
- package/dist/components/_sortable/index.cjs.map +1 -1
- package/dist/components/_sortable/index.js +175 -50
- package/dist/components/_sortable/index.js.map +1 -1
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.cjs.map +1 -1
- package/dist/components/dialog/index.js +18 -7
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +7 -7
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +1 -1
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +2 -2
- package/dist/{icons-w0wnkdpo.js → icons-D6XjzxSX.js} +24 -13
- package/dist/icons-D6XjzxSX.js.map +1 -0
- package/dist/icons-s-lGsxio.cjs +2 -0
- package/dist/icons-s-lGsxio.cjs.map +1 -0
- package/dist/{index-DvABhnD0.js → index-BMYV_5ZN.js} +2 -2
- package/dist/{index-DvABhnD0.js.map → index-BMYV_5ZN.js.map} +1 -1
- package/dist/{index-C9DOzjKO.cjs → index-FM_lJcIM.cjs} +2 -2
- package/dist/{index-C9DOzjKO.cjs.map → index-FM_lJcIM.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +40 -32
- package/dist/index.js +56 -55
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
- package/dist/icons-Ckl56kYF.cjs +0 -2
- package/dist/icons-Ckl56kYF.cjs.map +0 -1
- package/dist/icons-w0wnkdpo.js.map +0 -1
|
@@ -1,65 +1,190 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { t as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"target-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { jsx as H } from "react/jsx-runtime";
|
|
2
|
+
import { t as O } from "../../classix-DG18itHa.js";
|
|
3
|
+
import A, { createContext as tt, useMemo as V, useRef as a, useState as M, useEffect as B, useContext as et } from "react";
|
|
4
|
+
import { List as nt } from "../list/index.js";
|
|
5
|
+
import '../../assets/index25.css';const rt = "_sortable_n5r0c_5", ot = "_dragging_n5r0c_15", ct = "_dropping_n5r0c_30", lt = "_columns_n5r0c_44", ut = "_pseudo_n5r0c_53", f = {
|
|
6
|
+
sortable: rt,
|
|
7
|
+
dragging: ot,
|
|
8
|
+
dropping: ct,
|
|
9
|
+
columns: lt,
|
|
10
|
+
pseudo: ut,
|
|
11
|
+
"target-above": "_target-above_n5r0c_68",
|
|
12
|
+
"target-below": "_target-below_n5r0c_69"
|
|
13
|
+
}, W = tt(null);
|
|
14
|
+
function ft() {
|
|
15
|
+
return et(W);
|
|
16
|
+
}
|
|
17
|
+
function mt({
|
|
18
|
+
children: F,
|
|
19
|
+
className: U,
|
|
20
|
+
columns: E = 1,
|
|
21
|
+
isRearranging: x = !1,
|
|
22
|
+
onChangeOrder: j,
|
|
23
|
+
...Y
|
|
22
24
|
}) {
|
|
23
|
-
const
|
|
25
|
+
const N = Number.isFinite(E) ? Math.max(1, Math.floor(E)) : 1, D = V(() => A.Children.toArray(F), [F]), l = a(-1), P = V(() => typeof window < "u" && (navigator.maxTouchPoints > 0 || window.matchMedia("(pointer: coarse)").matches), []), i = a(!1), T = a(null), v = a(null), b = a(null), _ = a(!1), S = a(null), d = a(null), [w, X] = M({
|
|
24
26
|
height: 0,
|
|
25
27
|
width: 0
|
|
26
|
-
}), [
|
|
27
|
-
...
|
|
28
|
-
"--
|
|
29
|
-
"--
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
}), [m, p] = M(null), [R, $] = M(null), Z = {
|
|
29
|
+
...Y.style,
|
|
30
|
+
"--height": `calc(${w.height}px - var(--scale-16))`,
|
|
31
|
+
"--width": N > 1 ? `calc(${w.width}px - var(--scale-16))` : `${w.width}px`
|
|
32
|
+
}, G = (o) => {
|
|
33
|
+
j(o.map((t, c) => ({
|
|
34
|
+
id: String(A.isValidElement(t) ? t.props["data-id"] ?? `idx-${c}` : `idx-${c}`),
|
|
35
|
+
weight: o.length - 1 - c
|
|
36
|
+
})));
|
|
37
|
+
}, y = (o, t) => {
|
|
38
|
+
if (t < 0 || t >= D.length || o === t) return;
|
|
39
|
+
const c = D.slice(), [e] = c.splice(o, 1);
|
|
40
|
+
c.splice(t, 0, e), $(t), G(c);
|
|
41
|
+
}, h = () => {
|
|
42
|
+
v.current !== null && (clearTimeout(v.current), v.current = null);
|
|
43
|
+
}, C = () => {
|
|
44
|
+
d.current !== null && (cancelAnimationFrame(d.current), d.current = null);
|
|
45
|
+
}, J = (o) => {
|
|
46
|
+
let t = (o == null ? void 0 : o.parentElement) ?? null;
|
|
47
|
+
for (; t; ) {
|
|
48
|
+
const {
|
|
49
|
+
overflowY: c
|
|
50
|
+
} = window.getComputedStyle(t);
|
|
51
|
+
if (/(auto|scroll|overlay)/.test(c) && t.scrollHeight > t.clientHeight) return t;
|
|
52
|
+
t = t.parentElement;
|
|
53
|
+
}
|
|
54
|
+
return document.scrollingElement instanceof HTMLElement ? document.scrollingElement : null;
|
|
55
|
+
}, k = () => {
|
|
56
|
+
h(), C(), S.current = null, i.current = !1, T.current = null, b.current = null, _.current = !1, l.current = -1, p(null);
|
|
57
|
+
}, K = (o) => o instanceof Element && !!o.closest('button, a, input, textarea, select, option, [role="button"], [contenteditable="true"]'), z = (o, t) => {
|
|
58
|
+
var q;
|
|
59
|
+
const c = (q = document.elementFromPoint(o, t)) == null ? void 0 : q.closest("[data-sortable-index]");
|
|
60
|
+
if (!c) return;
|
|
61
|
+
const e = Number(c.dataset.sortableIndex), n = l.current;
|
|
62
|
+
if (!Number.isInteger(e) || n < 0 || e === n) return;
|
|
63
|
+
const r = c.getBoundingClientRect(), s = e === n + 1 ? w.height : r.height, u = t > r.top + s / 2 ? e + 1 : e, I = u > n ? u - 1 : u;
|
|
64
|
+
T.current = I, p(I);
|
|
65
|
+
}, Q = (o) => {
|
|
66
|
+
const t = J(o);
|
|
67
|
+
if (!t) return;
|
|
68
|
+
const c = 72, e = 18, n = () => {
|
|
69
|
+
if (!i.current) {
|
|
70
|
+
d.current = null;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const r = S.current;
|
|
74
|
+
if (!r) {
|
|
75
|
+
d.current = requestAnimationFrame(n);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const s = t === document.scrollingElement ? {
|
|
79
|
+
top: 0,
|
|
80
|
+
bottom: window.innerHeight
|
|
81
|
+
} : t.getBoundingClientRect();
|
|
82
|
+
let g = 0;
|
|
83
|
+
if (r.y < s.top + c) {
|
|
84
|
+
const u = Math.max(0, r.y - s.top);
|
|
85
|
+
g = -e * (1 - u / c);
|
|
86
|
+
} else if (r.y > s.bottom - c) {
|
|
87
|
+
const u = Math.max(0, s.bottom - r.y);
|
|
88
|
+
g = e * (1 - u / c);
|
|
89
|
+
}
|
|
90
|
+
g !== 0 && (t.scrollBy({
|
|
91
|
+
top: g,
|
|
92
|
+
behavior: "auto"
|
|
93
|
+
}), z(r.x, r.y)), d.current = requestAnimationFrame(n);
|
|
94
|
+
};
|
|
95
|
+
C(), d.current = requestAnimationFrame(n);
|
|
96
|
+
}, L = () => {
|
|
97
|
+
l.current = -1, p(null);
|
|
33
98
|
};
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
|
|
38
|
-
|
|
99
|
+
return B(() => {
|
|
100
|
+
x || $(null);
|
|
101
|
+
}, [x]), B(() => () => {
|
|
102
|
+
h(), C();
|
|
103
|
+
}, []), B(() => {
|
|
104
|
+
const o = (t) => {
|
|
105
|
+
i.current && t.preventDefault();
|
|
106
|
+
};
|
|
107
|
+
return window.addEventListener("touchmove", o, {
|
|
108
|
+
passive: !1
|
|
109
|
+
}), () => {
|
|
110
|
+
h(), window.removeEventListener("touchmove", o);
|
|
111
|
+
};
|
|
112
|
+
}, []), /* @__PURE__ */ H(nt, { className: O(U, f.sortable, N > 1 && f.columns), columns: E, ordered: !0, style: Z, ...Y, "data-component": "sortable", children: D.map((o, t) => {
|
|
113
|
+
const c = A.isValidElement(o) ? o.key : null;
|
|
114
|
+
return /* @__PURE__ */ H("li", { "data-sortable-index": t, onClickCapture: (e) => {
|
|
115
|
+
_.current && (e.preventDefault(), e.stopPropagation(), _.current = !1);
|
|
116
|
+
}, className: O(m !== null && m > t - 10 && m < t + 10 && f.pseudo, m === t && l.current < t && f["target-below"], m === t && l.current > t && f["target-above"], l.current === t && f.dragging, R === t && x && f.dropping), onContextMenu: (e) => {
|
|
117
|
+
(i.current || v.current !== null) && e.preventDefault();
|
|
118
|
+
}, onTouchStart: (e) => {
|
|
119
|
+
if (x || K(e.target)) return;
|
|
120
|
+
const n = e.touches[0];
|
|
121
|
+
if (!n) return;
|
|
122
|
+
const r = e.currentTarget;
|
|
123
|
+
b.current = {
|
|
124
|
+
index: t,
|
|
125
|
+
x: n.clientX,
|
|
126
|
+
y: n.clientY
|
|
127
|
+
}, h(), v.current = setTimeout(() => {
|
|
128
|
+
l.current = t, i.current = !0, T.current = t, _.current = !0, X({
|
|
129
|
+
height: r.offsetHeight,
|
|
130
|
+
width: r.offsetWidth
|
|
131
|
+
}), p(t), S.current = {
|
|
132
|
+
x: n.clientX,
|
|
133
|
+
y: n.clientY
|
|
134
|
+
}, Q(r);
|
|
135
|
+
}, 350);
|
|
136
|
+
}, onTouchMove: (e) => {
|
|
137
|
+
const n = e.touches[0];
|
|
138
|
+
if (n) {
|
|
139
|
+
if (S.current = {
|
|
140
|
+
x: n.clientX,
|
|
141
|
+
y: n.clientY
|
|
142
|
+
}, !i.current) {
|
|
143
|
+
const r = b.current;
|
|
144
|
+
if (!r) return;
|
|
145
|
+
Math.hypot(n.clientX - r.x, n.clientY - r.y) > 8 && (h(), b.current = null);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
z(n.clientX, n.clientY);
|
|
149
|
+
}
|
|
150
|
+
}, onTouchEnd: (e) => {
|
|
151
|
+
if (h(), !i.current) {
|
|
152
|
+
b.current = null;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
const n = l.current, r = T.current;
|
|
157
|
+
n >= 0 && r !== null && n !== r && y(n, r), k();
|
|
158
|
+
}, onTouchCancel: () => k(), draggable: !x && !P, onDragEnd: () => L(), onDragOver: (e) => {
|
|
39
159
|
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
const
|
|
43
|
-
|
|
160
|
+
const n = l.current;
|
|
161
|
+
if (n < 0 || n === t) return;
|
|
162
|
+
const r = e.currentTarget.getBoundingClientRect(), s = t === n + 1 ? w.height : r.height, u = e.clientY > r.top + s / 2 ? t + 1 : t, I = u > n ? u - 1 : u;
|
|
163
|
+
p(I);
|
|
44
164
|
}, onDragStart: (e) => {
|
|
45
|
-
|
|
165
|
+
if (P) {
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
l.current = t, X({
|
|
46
170
|
height: e.currentTarget.offsetHeight,
|
|
47
171
|
width: e.currentTarget.offsetWidth
|
|
48
|
-
}), e.dataTransfer.setData("text/plain", ""), e.dataTransfer.effectAllowed = "move",
|
|
172
|
+
}), e.dataTransfer.setData("text/plain", ""), e.dataTransfer.effectAllowed = "move", p(t);
|
|
49
173
|
}, onDrop: (e) => {
|
|
50
174
|
e.preventDefault();
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
175
|
+
const n = l.current, r = m;
|
|
176
|
+
n < 0 || r === null || n === r || (y(n, r), L());
|
|
177
|
+
}, "data-component": "sortable", children: /* @__PURE__ */ H(W.Provider, { value: {
|
|
178
|
+
canMoveDown: t < D.length - 1,
|
|
179
|
+
canMoveUp: t > 0,
|
|
180
|
+
index: t,
|
|
181
|
+
moveDown: () => y(t, t + 1),
|
|
182
|
+
moveUp: () => y(t, t - 1)
|
|
183
|
+
}, children: o }) }, c ?? t);
|
|
60
184
|
}) });
|
|
61
185
|
}
|
|
62
186
|
export {
|
|
63
|
-
|
|
187
|
+
mt as Sortable,
|
|
188
|
+
ft as useOptionalSortableItem
|
|
64
189
|
};
|
|
65
190
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/_sortable/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { List } from '@/components/list';\n\nimport styles from './styles.module.css';\n\ntype SortItem = { id: string; weight: number };\n\ntype SortableProps = React.ComponentPropsWithoutRef<'ol'> & {\n columns?: number;\n isRearranging?: boolean;\n onChangeOrder: (order: SortItem[]) => void;\n};\n\ntype withVars = React.CSSProperties & {\n '--height'?: string;\n '--width'?: string;\n '--icon-svg'?: string;\n};\n\n/**\n * Children must provide a stable `data-id` for emits `{ id, weight }` and `key` (reconciliation).\n */\n\nexport function Sortable({\n children,\n className,\n columns = 1,\n isRearranging = false,\n onChangeOrder,\n ...props\n}: SortableProps) {\n const cols = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;\n const arr = useMemo(() => React.Children.toArray(children), [children]);\n const drag = useRef(-1);\n const [zoneSize, setZoneSize] = useState({\n height: 0,\n width: 0,\n });\n const [dropIndex, setDropIndex] = useState<number | null>(null);\n const [droppedAtIndex, setDroppedAtIndex] = useState<number | null>(null);\n const withVars: withVars = {\n ...props.style,\n '--icon-svg': iconSVG('sort', true),\n '--height': `calc(${zoneSize.height}px - var(--scale-16))`,\n '--width': cols > 1 ? `calc(${zoneSize.width}px - var(--scale-16))` : `${zoneSize.width}px`,\n };\n\n const resetDragState = () => {\n drag.current = -1;\n setDropIndex(null);\n };\n\n useEffect(() => {\n if (!isRearranging) {\n setDroppedAtIndex(null);\n }\n }, [isRearranging]);\n\n return (\n <List\n className={cx(className, styles.sortable, cols > 1 && styles.columns)}\n columns={columns}\n ordered\n style={withVars}\n {...props}\n >\n {arr.map((child, i) => {\n const key = React.isValidElement(child) ? child.key : null;\n\n return (\n <li\n key={key ?? i}\n className={cx(\n dropIndex !== null && dropIndex > i - 10 && dropIndex < i + 10 && styles.pseudo,\n dropIndex === i && drag.current < i && styles['target-below'],\n dropIndex === i && drag.current > i && styles['target-above'],\n drag.current === i && styles.dragging,\n droppedAtIndex === i && isRearranging && styles.dropping\n )}\n draggable={!isRearranging}\n onDragEnd={() => resetDragState()}\n onDragOver={(e) => {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n const from = drag.current;\n if (from < 0 || from === i) return;\n\n const rect = e.currentTarget.getBoundingClientRect();\n const itemHeight = i === from + 1 ? zoneSize.height : rect.height;\n const isBottomHalf = e.clientY > rect.top + itemHeight / 2;\n const rawIndex = isBottomHalf ? i + 1 : i;\n const nextDropIndex = rawIndex > from ? rawIndex - 1 : rawIndex;\n\n setDropIndex(nextDropIndex);\n }}\n onDragStart={(e) => {\n drag.current = i;\n setZoneSize({\n height: e.currentTarget.offsetHeight,\n width: e.currentTarget.offsetWidth,\n });\n e.dataTransfer.setData('text/plain', '');\n e.dataTransfer.effectAllowed = 'move';\n setDropIndex(i);\n }}\n onDrop={(e) => {\n e.preventDefault();\n const from = drag.current;\n const to = dropIndex;\n if (from < 0 || to === null || from === to) return;\n\n setDroppedAtIndex(to);\n const next = arr.slice();\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n\n onChangeOrder?.(\n next.map((c, idx) => ({\n id: String(\n React.isValidElement(c)\n ? ((c.props as { 'data-id'?: string })['data-id'] ?? `idx-${idx}`)\n : `idx-${idx}`\n ),\n\n weight: next.length - 1 - idx,\n }))\n );\n\n resetDragState();\n }}\n >\n {child}\n </li>\n );\n })}\n </List>\n );\n}\n"],"names":["Sortable","children","className","columns","isRearranging","onChangeOrder","props","cols","Number","isFinite","Math","max","floor","arr","useMemo","React","Children","toArray","drag","useRef","zoneSize","setZoneSize","useState","height","width","dropIndex","setDropIndex","droppedAtIndex","setDroppedAtIndex","withVars","style","iconSVG","resetDragState","current","useEffect","jsx","List","cx","styles","sortable","map","child","i","key","isValidElement","pseudo","dragging","dropping","e","preventDefault","dataTransfer","dropEffect","from","rect","currentTarget","getBoundingClientRect","itemHeight","rawIndex","clientY","top","nextDropIndex","offsetHeight","offsetWidth","setData","effectAllowed","to","next","slice","moved","splice","c","idx","id","String","weight","length"],"mappings":";;;;;;;;;;;;;;AA0BO,SAASA,EAAS;AAAA,EACvBC,UAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,SAAAA,IAAU;A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AKG,OAAOJ,GAAI,GAAGG,CAAK,GAExB/D,KAAAA,QAAAA,EACE6D,EAAK1B,IAAI,CAAC8B,GAAGC,OAAS;AAAA,QACpBC,IAAIC,OACF1D,EAAM6B,eAAe0B,CAAC,IAChBA,EAAEhE,MAAiC,SAAS,KAAK,OAAOiE,CAAG,KAC7D,OAAOA,CAAG,EAChB;AAAA,QAEAG,QAAQR,EAAKS,SAAS,IAAIJ;AAAAA,MAAAA,EAC1B,IAGJvC,EAAAA;AAAAA,IACF,GAAE,kBAAA,YAEDS,UAAAA,EAAAA,GA5DIE,KAAOD,CA6Dd;AAAA,EAEJ,CAAC,EAAA,CACH;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/_sortable/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport React, { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { List } from '@/components/list';\n\nimport styles from './styles.module.css';\n\ntype SortItem = { id: string; weight: number };\n\ntype SortableItemContextValue = {\n canMoveDown: boolean;\n canMoveUp: boolean;\n index: number;\n moveDown: () => void;\n moveUp: () => void;\n};\n\nconst SortableItemContext = createContext<SortableItemContextValue | null>(null);\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useOptionalSortableItem() {\n return useContext(SortableItemContext);\n}\n\ntype SortableProps = React.ComponentPropsWithoutRef<'ol'> & {\n columns?: number;\n isRearranging?: boolean;\n onChangeOrder: (order: SortItem[]) => void;\n};\n\ntype withVars = React.CSSProperties & {\n '--height'?: string;\n '--width'?: string;\n '--icon-svg'?: string;\n};\n\n/**\n * Children must provide a stable `data-id` for emits `{ id, weight }` and `key` (reconciliation).\n */\n\nexport function Sortable({\n children,\n className,\n columns = 1,\n isRearranging = false,\n onChangeOrder,\n ...props\n}: SortableProps) {\n const cols = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;\n const arr = useMemo(() => React.Children.toArray(children), [children]);\n const drag = useRef(-1);\n const usesTouchInput = useMemo(\n () =>\n typeof window !== 'undefined' &&\n (navigator.maxTouchPoints > 0 || window.matchMedia('(pointer: coarse)').matches),\n []\n );\n const touchDragActive = useRef(false);\n const touchDropIndex = useRef<number | null>(null);\n const touchHoldTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const touchStart = useRef<{ index: number; x: number; y: number } | null>(null);\n const suppressClick = useRef(false);\n const touchPosition = useRef<{ x: number; y: number } | null>(null);\n const autoScrollFrame = useRef<number | null>(null);\n const [zoneSize, setZoneSize] = useState({\n height: 0,\n width: 0,\n });\n const [dropIndex, setDropIndex] = useState<number | null>(null);\n const [droppedAtIndex, setDroppedAtIndex] = useState<number | null>(null);\n const withVars: withVars = {\n ...props.style,\n '--height': `calc(${zoneSize.height}px - var(--scale-16))`,\n '--width': cols > 1 ? `calc(${zoneSize.width}px - var(--scale-16))` : `${zoneSize.width}px`,\n };\n\n const emitOrder = (items: React.ReactNode[]) => {\n onChangeOrder(\n items.map((item, index) => ({\n id: String(\n React.isValidElement(item)\n ? ((item.props as { 'data-id'?: string })['data-id'] ?? `idx-${index}`)\n : `idx-${index}`\n ),\n weight: items.length - 1 - index,\n }))\n );\n };\n\n const moveItem = (from: number, to: number) => {\n if (to < 0 || to >= arr.length || from === to) return;\n\n const next = arr.slice();\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n\n setDroppedAtIndex(to);\n emitOrder(next);\n };\n\n const clearTouchHoldTimer = () => {\n if (touchHoldTimer.current !== null) {\n clearTimeout(touchHoldTimer.current);\n touchHoldTimer.current = null;\n }\n };\n\n const clearAutoScrollFrame = () => {\n if (autoScrollFrame.current !== null) {\n cancelAnimationFrame(autoScrollFrame.current);\n autoScrollFrame.current = null;\n }\n };\n\n const getScrollableAncestor = (element: HTMLElement | null) => {\n let current = element?.parentElement ?? null;\n\n while (current) {\n const { overflowY } = window.getComputedStyle(current);\n const canScroll =\n /(auto|scroll|overlay)/.test(overflowY) && current.scrollHeight > current.clientHeight;\n\n if (canScroll) return current;\n current = current.parentElement;\n }\n\n return document.scrollingElement instanceof HTMLElement ? document.scrollingElement : null;\n };\n\n const resetTouchDragState = () => {\n clearTouchHoldTimer();\n clearAutoScrollFrame();\n touchPosition.current = null;\n touchDragActive.current = false;\n touchDropIndex.current = null;\n touchStart.current = null;\n suppressClick.current = false;\n drag.current = -1;\n setDropIndex(null);\n };\n\n const isInteractiveTarget = (target: EventTarget | null) =>\n target instanceof Element &&\n Boolean(\n target.closest(\n 'button, a, input, textarea, select, option, [role=\"button\"], [contenteditable=\"true\"]'\n )\n );\n\n const updateTouchDropIndex = (clientX: number, clientY: number) => {\n const target = document\n .elementFromPoint(clientX, clientY)\n ?.closest<HTMLElement>('[data-sortable-index]');\n if (!target) return;\n\n const index = Number(target.dataset.sortableIndex);\n const from = drag.current;\n if (!Number.isInteger(index) || from < 0 || index === from) return;\n\n const rect = target.getBoundingClientRect();\n const itemHeight = index === from + 1 ? zoneSize.height : rect.height;\n const isBottomHalf = clientY > rect.top + itemHeight / 2;\n const rawIndex = isBottomHalf ? index + 1 : index;\n const nextDropIndex = rawIndex > from ? rawIndex - 1 : rawIndex;\n\n touchDropIndex.current = nextDropIndex;\n setDropIndex(nextDropIndex);\n };\n\n const startTouchAutoScroll = (item: HTMLElement) => {\n const scrollContainer = getScrollableAncestor(item);\n if (!scrollContainer) return;\n\n const edgeSize = 72;\n const maxSpeed = 18;\n\n const step = () => {\n if (!touchDragActive.current) {\n autoScrollFrame.current = null;\n return;\n }\n\n const position = touchPosition.current;\n if (!position) {\n autoScrollFrame.current = requestAnimationFrame(step);\n return;\n }\n\n const rect =\n scrollContainer === document.scrollingElement\n ? { top: 0, bottom: window.innerHeight }\n : scrollContainer.getBoundingClientRect();\n\n let speed = 0;\n\n if (position.y < rect.top + edgeSize) {\n const distance = Math.max(0, position.y - rect.top);\n speed = -maxSpeed * (1 - distance / edgeSize);\n } else if (position.y > rect.bottom - edgeSize) {\n const distance = Math.max(0, rect.bottom - position.y);\n speed = maxSpeed * (1 - distance / edgeSize);\n }\n\n if (speed !== 0) {\n scrollContainer.scrollBy({ top: speed, behavior: 'auto' });\n updateTouchDropIndex(position.x, position.y);\n }\n\n autoScrollFrame.current = requestAnimationFrame(step);\n };\n\n clearAutoScrollFrame();\n autoScrollFrame.current = requestAnimationFrame(step);\n };\n\n const resetDragState = () => {\n drag.current = -1;\n setDropIndex(null);\n };\n\n useEffect(() => {\n if (!isRearranging) {\n setDroppedAtIndex(null);\n }\n }, [isRearranging]);\n\n useEffect(\n () => () => {\n clearTouchHoldTimer();\n clearAutoScrollFrame();\n },\n []\n );\n\n useEffect(() => {\n const preventScrollWhileDragging = (event: TouchEvent) => {\n if (touchDragActive.current) {\n event.preventDefault();\n }\n };\n\n window.addEventListener('touchmove', preventScrollWhileDragging, {\n passive: false,\n });\n\n return () => {\n clearTouchHoldTimer();\n window.removeEventListener('touchmove', preventScrollWhileDragging);\n };\n }, []);\n\n return (\n <List\n className={cx(className, styles.sortable, cols > 1 && styles.columns)}\n columns={columns}\n ordered\n style={withVars}\n {...props}\n >\n {arr.map((child, i) => {\n const key = React.isValidElement(child) ? child.key : null;\n\n return (\n <li\n key={key ?? i}\n data-sortable-index={i}\n onClickCapture={(e) => {\n if (!suppressClick.current) return;\n e.preventDefault();\n e.stopPropagation();\n suppressClick.current = false;\n }}\n className={cx(\n dropIndex !== null && dropIndex > i - 10 && dropIndex < i + 10 && styles.pseudo,\n dropIndex === i && drag.current < i && styles['target-below'],\n dropIndex === i && drag.current > i && styles['target-above'],\n drag.current === i && styles.dragging,\n droppedAtIndex === i && isRearranging && styles.dropping\n )}\n onContextMenu={(e) => {\n if (touchDragActive.current || touchHoldTimer.current !== null) {\n e.preventDefault();\n }\n }}\n onTouchStart={(e) => {\n if (isRearranging || isInteractiveTarget(e.target)) return;\n\n const touch = e.touches[0];\n if (!touch) return;\n\n const item = e.currentTarget;\n touchStart.current = {\n index: i,\n x: touch.clientX,\n y: touch.clientY,\n };\n\n clearTouchHoldTimer();\n touchHoldTimer.current = setTimeout(() => {\n drag.current = i;\n touchDragActive.current = true;\n touchDropIndex.current = i;\n suppressClick.current = true;\n setZoneSize({\n height: item.offsetHeight,\n width: item.offsetWidth,\n });\n setDropIndex(i);\n touchPosition.current = {\n x: touch.clientX,\n y: touch.clientY,\n };\n startTouchAutoScroll(item);\n }, 350);\n }}\n onTouchMove={(e) => {\n const touch = e.touches[0];\n if (!touch) return;\n\n touchPosition.current = {\n x: touch.clientX,\n y: touch.clientY,\n };\n\n if (!touchDragActive.current) {\n const start = touchStart.current;\n if (!start) return;\n\n const distance = Math.hypot(touch.clientX - start.x, touch.clientY - start.y);\n if (distance > 8) {\n clearTouchHoldTimer();\n touchStart.current = null;\n }\n return;\n }\n updateTouchDropIndex(touch.clientX, touch.clientY);\n }}\n onTouchEnd={(e) => {\n clearTouchHoldTimer();\n\n if (!touchDragActive.current) {\n touchStart.current = null;\n return;\n }\n\n e.preventDefault();\n const from = drag.current;\n const to = touchDropIndex.current;\n\n if (from >= 0 && to !== null && from !== to) {\n moveItem(from, to);\n }\n\n resetTouchDragState();\n }}\n onTouchCancel={() => resetTouchDragState()}\n draggable={!isRearranging && !usesTouchInput}\n onDragEnd={() => resetDragState()}\n onDragOver={(e) => {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n const from = drag.current;\n if (from < 0 || from === i) return;\n\n const rect = e.currentTarget.getBoundingClientRect();\n const itemHeight = i === from + 1 ? zoneSize.height : rect.height;\n const isBottomHalf = e.clientY > rect.top + itemHeight / 2;\n const rawIndex = isBottomHalf ? i + 1 : i;\n const nextDropIndex = rawIndex > from ? rawIndex - 1 : rawIndex;\n\n setDropIndex(nextDropIndex);\n }}\n onDragStart={(e) => {\n if (usesTouchInput) {\n e.preventDefault();\n return;\n }\n drag.current = i;\n setZoneSize({\n height: e.currentTarget.offsetHeight,\n width: e.currentTarget.offsetWidth,\n });\n e.dataTransfer.setData('text/plain', '');\n e.dataTransfer.effectAllowed = 'move';\n setDropIndex(i);\n }}\n onDrop={(e) => {\n e.preventDefault();\n const from = drag.current;\n const to = dropIndex;\n if (from < 0 || to === null || from === to) return;\n moveItem(from, to);\n resetDragState();\n }}\n >\n <SortableItemContext.Provider\n value={{\n canMoveDown: i < arr.length - 1,\n canMoveUp: i > 0,\n index: i,\n moveDown: () => moveItem(i, i + 1),\n moveUp: () => moveItem(i, i - 1),\n }}\n >\n {child}\n </SortableItemContext.Provider>\n </li>\n );\n })}\n </List>\n );\n}\n"],"names":["SortableItemContext","createContext","useOptionalSortableItem","useContext","Sortable","children","className","columns","isRearranging","onChangeOrder","props","cols","Number","isFinite","Math","max","floor","arr","useMemo","React","Children","toArray","drag","useRef","usesTouchInput","window","navigator","maxTouchPoints","matchMedia","matches","touchDragActive","touchDropIndex","touchHoldTimer","touchStart","suppressClick","touchPosition","autoScrollFrame","zoneSize","setZoneSize","useState","height","width","dropIndex","setDropIndex","droppedAtIndex","setDroppedAtIndex","withVars","style","emitOrder","items","map","item","index","id","String","isValidElement","weight","length","moveItem","from","to","next","slice","moved","splice","clearTouchHoldTimer","current","clearTimeout","clearAutoScrollFrame","cancelAnimationFrame","getScrollableAncestor","element","parentElement","overflowY","getComputedStyle","test","scrollHeight","clientHeight","document","scrollingElement","HTMLElement","resetTouchDragState","isInteractiveTarget","target","Element","Boolean","closest","updateTouchDropIndex","clientX","clientY","elementFromPoint","dataset","sortableIndex","isInteger","rect","getBoundingClientRect","itemHeight","rawIndex","top","nextDropIndex","startTouchAutoScroll","scrollContainer","edgeSize","maxSpeed","step","position","requestAnimationFrame","bottom","innerHeight","speed","y","distance","scrollBy","behavior","x","resetDragState","useEffect","preventScrollWhileDragging","event","preventDefault","addEventListener","passive","removeEventListener","jsx","List","cx","styles","sortable","child","i","key","e","stopPropagation","pseudo","dragging","dropping","touch","touches","currentTarget","setTimeout","offsetHeight","offsetWidth","start","hypot","dataTransfer","dropEffect","setData","effectAllowed","canMoveDown","canMoveUp","moveDown","moveUp"],"mappings":";;;;;;;;;;;;GAiBMA,IAAsBC,GA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AAAA,CACH,EAAA,GA7IKE,KAAOD,CA8Id;AAAA,EAEJ,CAAC,EAAA,CACH;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index34.css');const e=require("react/jsx-runtime"),x=require("../../icons-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index34.css');const e=require("react/jsx-runtime"),x=require("../../icons-s-lGsxio.cjs"),b=require("../loading/index.cjs"),h="_checkbox_1e5vl_1",k={checkbox:h},l=({checked:s,disabled:t,isLoading:c,label:o,onChange:n,...i})=>{const r={"--icon-svg":x.iconSVG("check")};return e.jsxs("label",{className:k.checkbox,"data-component":"checkbox",children:[c&&e.jsx(b.Loading,{size:24,sticky:!0}),e.jsx("input",{checked:s,disabled:t||c,onChange:n,type:"checkbox",style:r,...i}),o&&o]})};exports.Checkbox=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { i as x } from "../../icons-
|
|
2
|
+
import { i as x } from "../../icons-D6XjzxSX.js";
|
|
3
3
|
import { Loading as k } from "../loading/index.js";
|
|
4
4
|
import '../../assets/index34.css';const b = "_checkbox_1e5vl_1", m = {
|
|
5
5
|
checkbox: b
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index11.css');const o=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index11.css');const o=require("react/jsx-runtime"),s=require("react"),l=require("../button/index.cjs"),c=require("../icon/index.cjs"),d="_dialog_mvo05_1",p="_wrapper_mvo05_38",t={dialog:d,wrapper:p},u=({children:r,setOpen:n,...i})=>(s.useEffect(()=>{const e=a=>{a.key==="Escape"&&(a.preventDefault(),n(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),o.jsx("div",{className:t.wrapper,"data-wrapper":!0,onClick:()=>n(!1),"data-component":"dialog",children:o.jsxs("dialog",{className:t.dialog,onClick:e=>e.stopPropagation(),...i,children:[o.jsx(l.Button,{"aria-label":"Close dialog","data-tag":"close-dialog",onClick:()=>n(!1),type:"button",variant:"minimal",children:o.jsx(c.Icon,{name:"x"})}),r]})}));exports.Dialog=u;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport styles from './styles.module.css';\n\nexport type DialogProps = React.DialogHTMLAttributes<HTMLDialogElement> & {\n children: React.ReactNode;\n setOpen
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\n\nimport { Button } from '@/components/button';\nimport { Icon } from '@/components/icon';\n\nimport styles from './styles.module.css';\n\nexport type DialogProps = React.DialogHTMLAttributes<HTMLDialogElement> & {\n children: React.ReactNode;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Dialog = ({ children, setOpen, ...props }: DialogProps) => {\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return;\n\n event.preventDefault();\n setOpen(false);\n };\n\n window.addEventListener('keydown', handleKeyDown);\n\n return () => window.removeEventListener('keydown', handleKeyDown);\n });\n\n return (\n <div\n className={styles.wrapper}\n data-wrapper\n onClick={() => setOpen(false)}\n >\n <dialog\n className={styles.dialog}\n onClick={(e) => e.stopPropagation()}\n {...props}\n >\n <Button\n aria-label={'Close dialog'} /* 🌝 */\n data-tag={'close-dialog'}\n onClick={() => setOpen(false)}\n type={'button'}\n variant='minimal'\n >\n <Icon name={'x'} />\n </Button>\n {children}\n </dialog>\n </div>\n );\n};\n"],"names":["Dialog","children","setOpen","props","useEffect","handleKeyDown","event","key","preventDefault","window","addEventListener","removeEventListener","jsx","styles","wrapper","jsxs","dialog","e","stopPropagation","Button","Icon"],"mappings":"yQAYaA,EAASA,CAAC,CAAEC,SAAAA,EAAUC,QAAAA,EAAS,GAAGC,CAAmB,KAChEC,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAiBC,GAAyB,CAC1CA,EAAMC,MAAQ,WAElBD,EAAME,eAAAA,EACNN,EAAQ,EAAK,EACf,EAEAO,cAAOC,iBAAiB,UAAWL,CAAa,EAEzC,IAAMI,OAAOE,oBAAoB,UAAWN,CAAa,CAClE,CAAC,EAGCO,EAAAA,IAAC,MAAA,CACC,UAAWC,EAAOC,QAClB,eAAY,GACZ,QAAS,IAAMZ,EAAQ,EAAK,EAAE,iBAAA,SAE9B,SAAAa,EAAAA,KAAC,SAAA,CACC,UAAWF,EAAOG,OAClB,QAAUC,GAAMA,EAAEC,gBAAAA,EAClB,GAAIf,EAEJ,SAAA,CAAAS,MAACO,EAAAA,QACC,aAAY,eACZ,WAAU,eACV,QAAS,IAAMjB,EAAQ,EAAK,EAC5B,KAAM,SACN,QAAQ,UAER,eAACkB,EAAAA,KAAA,CAAK,KAAM,IAAI,EAClB,EACCnB,CAAAA,CAAAA,CACH,CAAA,CACF"}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as d } from "react";
|
|
3
|
+
import { Button as s } from "../button/index.js";
|
|
4
|
+
import { Icon as p } from "../icon/index.js";
|
|
5
|
+
import '../../assets/index11.css';const c = "_dialog_mvo05_1", m = "_wrapper_mvo05_38", t = {
|
|
3
6
|
dialog: c,
|
|
4
|
-
wrapper:
|
|
5
|
-
},
|
|
6
|
-
children:
|
|
7
|
+
wrapper: m
|
|
8
|
+
}, v = ({
|
|
9
|
+
children: n,
|
|
7
10
|
setOpen: a,
|
|
8
11
|
...i
|
|
9
|
-
}) =>
|
|
12
|
+
}) => (d(() => {
|
|
13
|
+
const o = (r) => {
|
|
14
|
+
r.key === "Escape" && (r.preventDefault(), a(!1));
|
|
15
|
+
};
|
|
16
|
+
return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
|
|
17
|
+
}), /* @__PURE__ */ e("div", { className: t.wrapper, "data-wrapper": !0, onClick: () => a(!1), "data-component": "dialog", children: /* @__PURE__ */ l("dialog", { className: t.dialog, onClick: (o) => o.stopPropagation(), ...i, children: [
|
|
18
|
+
/* @__PURE__ */ e(s, { "aria-label": "Close dialog", "data-tag": "close-dialog", onClick: () => a(!1), type: "button", variant: "minimal", children: /* @__PURE__ */ e(p, { name: "x" }) }),
|
|
19
|
+
n
|
|
20
|
+
] }) }));
|
|
10
21
|
export {
|
|
11
|
-
|
|
22
|
+
v as Dialog
|
|
12
23
|
};
|
|
13
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport styles from './styles.module.css';\n\nexport type DialogProps = React.DialogHTMLAttributes<HTMLDialogElement> & {\n children: React.ReactNode;\n setOpen
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\n\nimport { Button } from '@/components/button';\nimport { Icon } from '@/components/icon';\n\nimport styles from './styles.module.css';\n\nexport type DialogProps = React.DialogHTMLAttributes<HTMLDialogElement> & {\n children: React.ReactNode;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Dialog = ({ children, setOpen, ...props }: DialogProps) => {\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return;\n\n event.preventDefault();\n setOpen(false);\n };\n\n window.addEventListener('keydown', handleKeyDown);\n\n return () => window.removeEventListener('keydown', handleKeyDown);\n });\n\n return (\n <div\n className={styles.wrapper}\n data-wrapper\n onClick={() => setOpen(false)}\n >\n <dialog\n className={styles.dialog}\n onClick={(e) => e.stopPropagation()}\n {...props}\n >\n <Button\n aria-label={'Close dialog'} /* 🌝 */\n data-tag={'close-dialog'}\n onClick={() => setOpen(false)}\n type={'button'}\n variant='minimal'\n >\n <Icon name={'x'} />\n </Button>\n {children}\n </dialog>\n </div>\n );\n};\n"],"names":["Dialog","children","setOpen","props","useEffect","handleKeyDown","event","key","preventDefault","window","addEventListener","removeEventListener","jsx","styles","wrapper","jsxs","dialog","e","stopPropagation","Button","Icon"],"mappings":";;;;;;;GAYaA,IAASA,CAAC;AAAA,EAAEC,UAAAA;AAAAA,EAAUC,SAAAA;AAAAA,EAAS,GAAGC;AAAmB,OAChEC,EAAU,MAAM;AACd,QAAMC,IAAgBA,CAACC,MAAyB;AAC9C,IAAIA,EAAMC,QAAQ,aAElBD,EAAME,eAAAA,GACNN,EAAQ,EAAK;AAAA,EACf;AAEAO,gBAAOC,iBAAiB,WAAWL,CAAa,GAEzC,MAAMI,OAAOE,oBAAoB,WAAWN,CAAa;AAClE,CAAC,GAGC,gBAAAO,EAAC,OAAA,EACC,WAAWC,EAAOC,SAClB,gBAAY,IACZ,SAAS,MAAMZ,EAAQ,EAAK,GAAE,kBAAA,UAE9B,UAAA,gBAAAa,EAAC,UAAA,EACC,WAAWF,EAAOG,QAClB,SAAUC,CAAAA,MAAMA,EAAEC,gBAAAA,GAClB,GAAIf,GAEJ,UAAA;AAAA,EAAA,gBAAAS,EAACO,KACC,cAAY,gBACZ,YAAU,gBACV,SAAS,MAAMjB,EAAQ,EAAK,GAC5B,MAAM,UACN,SAAQ,WAER,4BAACkB,GAAA,EAAK,MAAM,KAAI,GAClB;AAAA,EACCnB;AAAAA,EAAAA,CACH,EAAA,CACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index36.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index36.css');const s=require("react/jsx-runtime"),m=require("../../classix-5H4IWnMA.cjs"),a="_form_1xyuy_1",c="_inline_1xyuy_25",e={form:a,inline:c},l=({animation:o,children:n,className:t,inline:r=!1,...i})=>s.jsx("form",{className:m.t(t,r&&e.inline,e.form),"data-animation":o,...i,"data-component":"form",children:n&&n});exports.Form=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { t as s } from "../../classix-DG18itHa.js";
|
|
3
|
-
import '../../assets/index36.css';const a = "
|
|
3
|
+
import '../../assets/index36.css';const a = "_form_1xyuy_1", f = "_inline_1xyuy_25", n = {
|
|
4
4
|
form: a,
|
|
5
5
|
inline: f
|
|
6
6
|
}, _ = ({
|
|
7
|
-
animation:
|
|
8
|
-
children:
|
|
9
|
-
className:
|
|
10
|
-
inline:
|
|
11
|
-
...
|
|
12
|
-
}) => /* @__PURE__ */ e("form", { className: s(
|
|
7
|
+
animation: m,
|
|
8
|
+
children: o,
|
|
9
|
+
className: r,
|
|
10
|
+
inline: t = !1,
|
|
11
|
+
...i
|
|
12
|
+
}) => /* @__PURE__ */ e("form", { className: s(r, t && n.inline, n.form), "data-animation": m, ...i, "data-component": "form", children: o && o });
|
|
13
13
|
export {
|
|
14
14
|
_ as Form
|
|
15
15
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const r=require("react/jsx-runtime"),o=require("../../classix-5H4IWnMA.cjs"),n=require("../../icons-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const r=require("react/jsx-runtime"),o=require("../../classix-5H4IWnMA.cjs"),n=require("../../icons-s-lGsxio.cjs"),l="_icon_1uucz_1",_="_small_1uucz_9",m="_medium_1uucz_14",d="_large_1uucz_19",g="_danger_1uucz_24",p="_primary_1uucz_32",y="_white_1uucz_36",e={icon:l,small:_,medium:m,large:d,danger:g,default:"_default_1uucz_28",primary:p,white:y,"gap-right":"_gap-right_1uucz_40","gap-left":"_gap-left_1uucz_44"},z={large:e.large,medium:e.medium,small:e.small},f={danger:e.danger,default:e.default,primary:e.primary,white:e.white},h=({fill:a,gap:t="none",name:c,size:s="medium",variant:u="default"})=>{const i={maskImage:n.iconSVG(c,a??!1)};return r.jsx("span",{"aria-hidden":"true",className:o.t(t!=="none"&&e[`gap-${t}`],z[s],e.icon,f[u]),style:i,"data-component":"icon"})},w=()=>Object.keys(n.iconPaths);exports.Icon=h;exports.Icons=w;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { t as o } from "../../classix-DG18itHa.js";
|
|
3
|
-
import { i as u, a as m } from "../../icons-
|
|
3
|
+
import { i as u, a as m } from "../../icons-D6XjzxSX.js";
|
|
4
4
|
import '../../assets/index37.css';const _ = "_icon_1uucz_1", l = "_small_1uucz_9", d = "_medium_1uucz_14", g = "_large_1uucz_19", p = "_danger_1uucz_24", f = "_primary_1uucz_32", z = "_white_1uucz_36", a = {
|
|
5
5
|
icon: _,
|
|
6
6
|
small: l,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),y=require("../../classix-5H4IWnMA.cjs"),l=require("react"),P=require("../../icons-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),y=require("../../classix-5H4IWnMA.cjs"),l=require("react"),P=require("../../icons-s-lGsxio.cjs"),T=require("../../utils-DBzf7CFq.cjs"),s=require("../../styles.module-CitJm17A.cjs");function b({className:C,defaultCountryCode:h="+47",disabled:a=!1,icon:i,label:d,placeholder:m,ref:v,required:c,type:t="text",...e}){const[r,g]=l.useState(""),[o,x]=l.useState(""),{onChange:N,value:j,...q}=e,{touched:S,onBlur:p}=T.useTouched(j===""),f=i&&t!=="radio"&&t!=="datetime-local"?{"--icon-svg":P.iconSVG(i,!0)}:void 0;l.useEffect(()=>{if(typeof e.onChange=="function"&&t==="tel"){const u={name:e.name,value:o?(r||h).split(" ").join("")+o.split(" ").join(""):void 0};e.onChange({target:u,currentTarget:u})}},[r,o]),l.useEffect(()=>{t==="tel"&&!e.value&&(x(""),g(""))},[e.value,t]);const I=n.jsxs(n.Fragment,{children:[n.jsx("input",{disabled:a,hidden:!0,onChange:N,pattern:void 0,placeholder:m,ref:v,type:t,value:j}),n.jsx("input",{type:"text",className:s.inputStyles.input,disabled:a,maxLength:5,onChange:u=>g(u.target.value),placeholder:h,value:r}),n.jsx("input",{type:"tel",className:y.t(s.inputStyles.input,S&&s.inputStyles.touched),"data-icon":i?"true":void 0,disabled:a,maxLength:14,name:void 0,onChange:u=>x(u.target.value),onBlur:p,pattern:e.pattern,required:c,style:f,value:o,...q})]});return n.jsxs("label",{className:s.inputStyles.label,"data-component":"input",children:[d&&n.jsx("span",{"data-required":c||void 0,children:d}),t==="tel"?I:n.jsx("input",{ref:v,className:y.t(s.inputStyles.input,C,S&&s.inputStyles.touched),"data-icon":i?"true":void 0,disabled:a,onBlur:p,placeholder:m,required:c,style:f,type:t,...e})]})}exports.Input=b;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as N, Fragment as w, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { t as j } from "../../classix-DG18itHa.js";
|
|
3
3
|
import { useState as S, useEffect as I } from "react";
|
|
4
|
-
import { i as B } from "../../icons-
|
|
4
|
+
import { i as B } from "../../icons-D6XjzxSX.js";
|
|
5
5
|
import { u as E } from "../../utils--n2yqjCy.js";
|
|
6
6
|
import { i as a } from "../../styles.module-Ioe0wPWW.js";
|
|
7
7
|
function A({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const p=require("react/jsx-runtime"),_=require("../../classix-5H4IWnMA.cjs"),f=require("react"),v=require("../../icons-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const p=require("react/jsx-runtime"),_=require("../../classix-5H4IWnMA.cjs"),f=require("react"),v=require("../../icons-s-lGsxio.cjs"),h="_nav_15tsi_1",b="_horizontal_15tsi_7",g="_tabs_15tsi_17",m="_pills_15tsi_38",t={nav:h,horizontal:b,tabs:g,pills:m},w={default:t.default,pills:t.pills,tabs:t.tabs},q=({animation:i,children:o,className:l,horizontal:e=!1,variant:s="default",...r})=>{const[c,a]=f.useState(!1),u={"--icon-svg":v.iconSVG("chevron")};return p.jsx("nav",{className:_.t(l,e&&t.horizontal,t.nav,w[s]),"data-animation":i,"data-open":c?"true":"false","data-orientation":e?"horizontal":"vertical",onBlurCapture:n=>{if(s!=="pills"||window.innerWidth>960)return;const d=n.relatedTarget;n.currentTarget.contains(d)||a(!1)},onClick:()=>{s!=="pills"||window.innerWidth>960||a(n=>!n)},style:u,...r,"data-component":"nav",children:o})};exports.Nav=q;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import { t as _ } from "../../classix-DG18itHa.js";
|
|
3
3
|
import { useState as m } from "react";
|
|
4
|
-
import { i as u } from "../../icons-
|
|
4
|
+
import { i as u } from "../../icons-D6XjzxSX.js";
|
|
5
5
|
import '../../assets/index42.css';const v = "_nav_15tsi_1", h = "_horizontal_15tsi_7", b = "_tabs_15tsi_17", w = "_pills_15tsi_38", t = {
|
|
6
6
|
nav: v,
|
|
7
7
|
horizontal: h,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("../../icons-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("../../icons-s-lGsxio.cjs");require("../../utils-DBzf7CFq.cjs");const e=require("../../index-FM_lJcIM.cjs");exports.Select=e.Select;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../classix-DG18itHa.js";
|
|
3
|
-
import "../../icons-
|
|
3
|
+
import "../../icons-D6XjzxSX.js";
|
|
4
4
|
import "../../utils--n2yqjCy.js";
|
|
5
|
-
import { S as e } from "../../index-
|
|
5
|
+
import { S as e } from "../../index-BMYV_5ZN.js";
|
|
6
6
|
export {
|
|
7
7
|
e as Select
|
|
8
8
|
};
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const c = {
|
|
2
|
+
arrowDown: {
|
|
3
|
+
filled: "M12 2.25a.75.75 0 0 1 .75.75v16.19l6.22-6.22a.75.75 0 1 1 1.06 1.06l-7.5 7.5a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 1 1 1.06-1.06l6.22 6.22V3a.75.75 0 0 1 .75-.75Z",
|
|
4
|
+
outline: "M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"
|
|
5
|
+
},
|
|
6
|
+
arrowUp: {
|
|
7
|
+
filled: "M11.47 2.47a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06l-6.22-6.22V21a.75.75 0 0 1-1.5 0V4.81l-6.22 6.22a.75.75 0 1 1-1.06-1.06l7.5-7.5Z",
|
|
8
|
+
outline: "M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"
|
|
9
|
+
},
|
|
2
10
|
bold: "M6.75 3.744h-.753v8.25h7.125a4.125 4.125 0 0 0 0-8.25H6.75Zm0 0v.38m0 16.122h6.747a4.5 4.5 0 0 0 0-9.001h-7.5v9h.753Zm0 0v-.37m0-15.751h6a3.75 3.75 0 1 1 0 7.5h-6m0-7.5v7.5m0 0v8.25m0-8.25h6.375a4.125 4.125 0 0 1 0 8.25H6.75m.747-15.38h4.875a3.375 3.375 0 0 1 0 6.75H7.497v-6.75Zm0 7.5h5.25a3.75 3.75 0 0 1 0 7.5h-5.25v-7.5Z",
|
|
3
11
|
bookmark: {
|
|
4
12
|
filled: "M6.32 2.577a49.255 49.255 0 0 1 11.36 0c1.497.174 2.57 1.46 2.57 2.93V21a.75.75 0 0 1-1.085.67L12 18.089l-7.165 3.583A.75.75 0 0 1 3.75 21V5.507c0-1.47 1.073-2.756 2.57-2.93Z",
|
|
@@ -22,7 +30,10 @@ const l = {
|
|
|
22
30
|
goTo: "M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25",
|
|
23
31
|
home: "m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25",
|
|
24
32
|
image: "m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z",
|
|
25
|
-
info:
|
|
33
|
+
info: {
|
|
34
|
+
filled: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",
|
|
35
|
+
outline: "m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"
|
|
36
|
+
},
|
|
26
37
|
italic: "M5.248 20.246H9.05m0 0h3.696m-3.696 0 5.893-16.502m0 0h-3.697m3.697 0h3.803",
|
|
27
38
|
link: "M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244",
|
|
28
39
|
list: "M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z",
|
|
@@ -33,6 +44,10 @@ const l = {
|
|
|
33
44
|
menu: "M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5",
|
|
34
45
|
mobile: "M10.5 1.5H8.25A2.25 2.25 0 0 0 6 3.75v16.5a2.25 2.25 0 0 0 2.25 2.25h7.5A2.25 2.25 0 0 0 18 20.25V3.75a2.25 2.25 0 0 0-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3",
|
|
35
46
|
pencil: "M21.731 2.269a2.625 2.625 0 0 0-3.712 0l-1.157 1.157 3.712 3.712 1.157-1.157a2.625 2.625 0 0 0 0-3.712ZM19.513 8.199l-3.712-3.712-12.15 12.15a5.25 5.25 0 0 0-1.32 2.214l-.8 2.685a.75.75 0 0 0 .933.933l2.685-.8a5.25 5.25 0 0 0 2.214-1.32L19.513 8.2Z",
|
|
47
|
+
pencilSquare: {
|
|
48
|
+
filled: "M21.731 2.269a2.625 2.625 0 0 0-3.712 0l-1.157 1.157 3.712 3.712 1.157-1.157a2.625 2.625 0 0 0 0-3.712ZM19.513 8.199l-3.712-3.712-8.4 8.4a5.25 5.25 0 0 0-1.32 2.214l-.8 2.685a.75.75 0 0 0 .933.933l2.685-.8a5.25 5.25 0 0 0 2.214-1.32l8.4-8.4Z M5.25 5.25a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h10.5a3 3 0 0 0 3-3V13.5a.75.75 0 0 0-1.5 0v5.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5V8.25a1.5 1.5 0 0 1 1.5-1.5h5.25a.75.75 0 0 0 0-1.5H5.25Z",
|
|
49
|
+
outline: "m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"
|
|
50
|
+
},
|
|
36
51
|
people: "M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z",
|
|
37
52
|
phone: "M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 0 0 2.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 0 1-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 0 0-1.091-.852H4.5A2.25 2.25 0 0 0 2.25 4.5v2.25Z",
|
|
38
53
|
plane: {
|
|
@@ -41,10 +56,6 @@ const l = {
|
|
|
41
56
|
},
|
|
42
57
|
plus: "M12 4.5v15m7.5-7.5h-15",
|
|
43
58
|
search: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",
|
|
44
|
-
sort: {
|
|
45
|
-
filled: "M5.625 3.75a2.625 2.625 0 1 0 0 5.25h12.75a2.625 2.625 0 0 0 0-5.25H5.625ZM3.75 11.25a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75ZM3 15.75a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75ZM3.75 18.75a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75Z",
|
|
46
|
-
outline: ""
|
|
47
|
-
},
|
|
48
59
|
success: "M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z",
|
|
49
60
|
trash: "m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0",
|
|
50
61
|
updown: "M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9",
|
|
@@ -56,15 +67,15 @@ const l = {
|
|
|
56
67
|
user: "M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z",
|
|
57
68
|
x: "M6 18 18 6M6 6l12 12"
|
|
58
69
|
};
|
|
59
|
-
function e(
|
|
60
|
-
return `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='${
|
|
70
|
+
function e(m, l) {
|
|
71
|
+
return `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='${l ? "currentColor" : "none"}' fill-rule='evenodd' viewBox='0 0 24 24' stroke-width='1.5' stroke='${l ? "none" : "currentColor"}'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='${m}' /%3E%3C/svg%3E%0A")`;
|
|
61
72
|
}
|
|
62
|
-
const o = (
|
|
63
|
-
const a =
|
|
64
|
-
return e(M,
|
|
73
|
+
const o = (m, l = !1) => {
|
|
74
|
+
const a = c[m], M = typeof a == "string" ? a : l ? a.filled : a.outline, h = l && typeof a == "object" && !!a.filled;
|
|
75
|
+
return e(M, h);
|
|
65
76
|
};
|
|
66
77
|
export {
|
|
67
|
-
|
|
78
|
+
c as a,
|
|
68
79
|
o as i
|
|
69
80
|
};
|
|
70
|
-
//# sourceMappingURL=icons-
|
|
81
|
+
//# sourceMappingURL=icons-D6XjzxSX.js.map
|