asterui 0.11.0 → 0.12.1
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/README.md +1 -103
- package/dist/components/Anchor.d.ts +45 -0
- package/dist/components/Diff.d.ts +12 -0
- package/dist/components/Form.d.ts +27 -2
- package/dist/components/Kbd.d.ts +8 -0
- package/dist/components/Radio.d.ts +7 -1
- package/dist/components/Status.d.ts +18 -0
- package/dist/components/TextRotate.d.ts +13 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +210 -200
- package/dist/index.js.map +1 -1
- package/dist/index10.js +92 -30
- package/dist/index10.js.map +1 -1
- package/dist/index100.js +8 -5
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +12 -41
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +31 -2
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +17 -6
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +10788 -147
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +5 -30
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +39 -27
- package/dist/index106.js.map +1 -1
- package/dist/index108.js +6 -71
- package/dist/index108.js.map +1 -1
- package/dist/index109.js +147 -34
- package/dist/index109.js.map +1 -1
- package/dist/index11.js +28 -263
- package/dist/index11.js.map +1 -1
- package/dist/index110.js +28 -24
- package/dist/index110.js.map +1 -1
- package/dist/index111.js +28 -19
- package/dist/index111.js.map +1 -1
- package/dist/index112.js +2 -24
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +71 -19
- package/dist/index113.js.map +1 -1
- package/dist/index114.js +33 -94
- package/dist/index114.js.map +1 -1
- package/dist/index115.js +24 -358
- package/dist/index115.js.map +1 -1
- package/dist/index116.js +19 -23
- package/dist/index116.js.map +1 -1
- package/dist/index117.js +22 -71
- package/dist/index117.js.map +1 -1
- package/dist/index118.js +17 -13
- package/dist/index118.js.map +1 -1
- package/dist/index119.js +91 -57
- package/dist/index119.js.map +1 -1
- package/dist/index12.js +259 -89
- package/dist/index12.js.map +1 -1
- package/dist/index120.js +357 -141
- package/dist/index120.js.map +1 -1
- package/dist/index121.js +25 -2
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +70 -53
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +16 -2
- package/dist/index123.js.map +1 -1
- package/dist/index124.js +66 -2
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +144 -2
- package/dist/index125.js.map +1 -1
- package/dist/index126.js +2 -2
- package/dist/index127.js +56 -2
- package/dist/index127.js.map +1 -1
- package/dist/index13.js +90 -153
- package/dist/index13.js.map +1 -1
- package/dist/index130.js +2 -32
- package/dist/index130.js.map +1 -1
- package/dist/index132.js +2 -8
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +2 -2
- package/dist/index134.js +2 -2
- package/dist/index135.js +2 -21
- package/dist/index135.js.map +1 -1
- package/dist/index136.js +32 -2
- package/dist/index136.js.map +1 -1
- package/dist/index137.js +2 -24
- package/dist/index137.js.map +1 -1
- package/dist/index138.js +7 -70
- package/dist/index138.js.map +1 -1
- package/dist/index139.js +2 -21
- package/dist/index139.js.map +1 -1
- package/dist/index14.js +154 -146
- package/dist/index14.js.map +1 -1
- package/dist/index140.js +2 -34
- package/dist/index140.js.map +1 -1
- package/dist/index141.js +20 -69
- package/dist/index141.js.map +1 -1
- package/dist/index142.js +2 -2
- package/dist/index143.js +24 -2
- package/dist/index143.js.map +1 -1
- package/dist/index144.js +70 -21
- package/dist/index144.js.map +1 -1
- package/dist/index145.js +21 -2
- package/dist/index145.js.map +1 -1
- package/dist/index146.js +34 -2
- package/dist/index146.js.map +1 -1
- package/dist/index147.js +70 -2
- package/dist/index147.js.map +1 -1
- package/dist/index148.js +2 -2
- package/dist/index149.js +21 -3
- package/dist/index149.js.map +1 -1
- package/dist/index15.js +150 -5
- package/dist/index15.js.map +1 -1
- package/dist/index150.js +5 -0
- package/dist/index150.js.map +1 -0
- package/dist/index151.js +5 -0
- package/dist/index151.js.map +1 -0
- package/dist/index152.js +5 -0
- package/dist/index152.js.map +1 -0
- package/dist/index153.js +5 -0
- package/dist/index153.js.map +1 -0
- package/dist/index154.js +7 -0
- package/dist/index154.js.map +1 -0
- package/dist/index16.js +5 -71
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +71 -17
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +15 -96
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +89 -105
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +107 -177
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +181 -107
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +107 -29
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +19 -41
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +31 -11
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +41 -33
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +12 -63
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +33 -80
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +63 -18
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +78 -159
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +96 -27
- package/dist/index3.js.map +1 -1
- package/dist/index30.js +16 -1080
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +218 -16
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +1081 -121
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +17 -39
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +121 -190
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +37 -94
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +186 -157
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +89 -138
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +161 -14
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +146 -21
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +26 -99
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +12 -116
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +18 -13
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +21 -35
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +117 -114
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +13 -176
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +34 -146
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +116 -12
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +176 -22
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +147 -14
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +10 -5
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +100 -60
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +21 -265
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +10 -13
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +7 -122
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +262 -106
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +14 -167
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +121 -31
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +107 -119
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +161 -77
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +31 -19
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +117 -69
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +61 -130
- package/dist/index6.js.map +1 -1
- package/dist/index60.js +82 -53
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +19 -44
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +70 -48
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +55 -60
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +39 -101
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +52 -41
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +58 -64
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +105 -19
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +41 -46
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +63 -129
- package/dist/index69.js.map +1 -1
- package/dist/index7.js +130 -11
- package/dist/index7.js.map +1 -1
- package/dist/index70.js +19 -50
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +46 -22
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +134 -22
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +51 -328
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +19 -53
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +31 -40
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +22 -95
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +311 -112
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +52 -157
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +40 -65
- package/dist/index79.js.map +1 -1
- package/dist/index8.js +11 -70
- package/dist/index8.js.map +1 -1
- package/dist/index80.js +23 -35
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +88 -227
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +130 -34
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +153 -202
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +61 -209
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +34 -294
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +228 -172
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +32 -256
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +208 -12
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +209 -29
- package/dist/index89.js.map +1 -1
- package/dist/index9.js +69 -91
- package/dist/index9.js.map +1 -1
- package/dist/index90.js +294 -5
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +176 -12
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +256 -44
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +13 -12
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +32 -14
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +5 -7
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +13 -12
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +42 -27
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +11 -16
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +12 -10790
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
package/dist/index71.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index71.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index71.js","sources":["../src/components/Space.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface SpaceProps extends React.HTMLAttributes<HTMLDivElement> {\n direction?: 'horizontal' | 'vertical'\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number\n align?: 'start' | 'end' | 'center' | 'baseline' | 'stretch'\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'\n wrap?: boolean\n children: React.ReactNode\n}\n\nconst gapClasses = {\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8',\n} as const\n\nconst alignClasses = {\n start: 'items-start',\n end: 'items-end',\n center: 'items-center',\n baseline: 'items-baseline',\n stretch: 'items-stretch',\n} as const\n\nconst justifyClasses = {\n start: 'justify-start',\n end: 'justify-end',\n center: 'justify-center',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n} as const\n\nexport const Space: React.FC<SpaceProps> = ({\n direction = 'horizontal',\n size = 'md',\n align,\n justify,\n wrap = false,\n className = '',\n style,\n children,\n ...rest\n}) => {\n const isNumericSize = typeof size === 'number'\n const gapClass = isNumericSize ? '' : gapClasses[size]\n const alignClass = align ? alignClasses[align] : ''\n const justifyClass = justify ? justifyClasses[justify] : ''\n const wrapClass = wrap ? 'flex-wrap' : ''\n const directionClass = direction === 'horizontal' ? 'flex-row' : 'flex-col'\n\n const classes = [\n 'flex',\n directionClass,\n gapClass,\n alignClass,\n justifyClass,\n wrapClass,\n className\n ].filter(Boolean).join(' ')\n\n const combinedStyle: React.CSSProperties = {\n ...style,\n ...(isNumericSize ? { gap: `${size}px` } : {}),\n }\n\n return <div className={classes} style={combinedStyle} {...rest}>{children}</div>\n}\n"],"names":["gapClasses","alignClasses","justifyClasses","Space","direction","size","align","justify","wrap","className","style","children","rest","isNumericSize","gapClass","alignClass","justifyClass","classes","combinedStyle","jsx"],"mappings":";AAWA,MAAMA,IAAa;AAAA,EACjB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,IAAe;AAAA,EACnB,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AACX,GAEMC,IAAiB;AAAA,EACrB,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV,GAEaC,IAA8B,CAAC;AAAA,EAC1C,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAgB,OAAOR,KAAS,UAChCS,IAAWD,IAAgB,KAAKb,EAAWK,CAAI,GAC/CU,IAAaT,IAAQL,EAAaK,CAAK,IAAI,IAC3CU,IAAeT,IAAUL,EAAeK,CAAO,IAAI,IAInDU,IAAU;AAAA,IACd;AAAA,IAHqBb,MAAc,eAAe,aAAa;AAAA,IAK/DU;AAAA,IACAC;AAAA,IACAC;AAAA,IARgBR,IAAO,cAAc;AAAA,IAUrCC;AAAA,EAAA,EACA,OAAO,OAAO,EAAE,KAAK,GAAG,GAEpBS,IAAqC;AAAA,IACzC,GAAGR;AAAA,IACH,GAAIG,IAAgB,EAAE,KAAK,GAAGR,CAAI,SAAS,CAAA;AAAA,EAAC;AAG9C,SAAO,gBAAAc,EAAC,SAAI,WAAWF,GAAS,OAAOC,GAAgB,GAAGN,GAAO,UAAAD,GAAS;AAC5E;"}
|
package/dist/index72.js
CHANGED
|
@@ -1,25 +1,137 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { jsx as f, jsxs as B, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import C, { useRef as E, useCallback as x, useState as ee, useEffect as te } from "react";
|
|
3
|
+
const ne = ({ children: N }) => /* @__PURE__ */ f(_, { children: N }), oe = ({
|
|
4
|
+
children: N,
|
|
5
|
+
direction: c = "horizontal",
|
|
6
|
+
sizes: g,
|
|
7
|
+
defaultSizes: y,
|
|
8
|
+
onSizesChange: I,
|
|
9
|
+
gutterSize: z = 8,
|
|
10
|
+
minSize: R = 50,
|
|
11
|
+
className: G = ""
|
|
12
|
+
}) => {
|
|
13
|
+
const $ = E(null), H = E([]), b = E(null), h = C.Children.toArray(N).filter(
|
|
14
|
+
(n) => C.isValidElement(n)
|
|
15
|
+
), l = h.length, k = x(() => {
|
|
16
|
+
if (y && y.length === l)
|
|
17
|
+
return y;
|
|
18
|
+
const n = 100 / l;
|
|
19
|
+
return Array(l).fill(n);
|
|
20
|
+
}, [y, l]), [D, j] = ee(k), p = g || D;
|
|
21
|
+
te(() => {
|
|
22
|
+
!g && D.length !== l && j(k());
|
|
23
|
+
}, [l, g, D.length, k]);
|
|
24
|
+
const S = x(
|
|
25
|
+
(n) => {
|
|
26
|
+
g || j(n), I?.(n);
|
|
27
|
+
},
|
|
28
|
+
[g, I]
|
|
29
|
+
), V = x(
|
|
30
|
+
(n, e) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
const a = c === "horizontal" ? e.clientX : e.clientY;
|
|
33
|
+
b.current = {
|
|
34
|
+
index: n,
|
|
35
|
+
startPos: a,
|
|
36
|
+
startSizes: [...p]
|
|
37
|
+
};
|
|
38
|
+
const r = (w) => {
|
|
39
|
+
if (!b.current || !$.current) return;
|
|
40
|
+
const { index: t, startPos: P, startSizes: s } = b.current, K = $.current.getBoundingClientRect(), O = c === "horizontal" ? K.width : K.height, Q = c === "horizontal" ? w.clientX : w.clientY, T = (l - 1) * z, v = O - T, F = (Q - P) / v * 100, U = h[t]?.props || {}, X = h[t + 1]?.props || {}, W = U.minSize ?? R, Z = X.minSize ?? R, A = W / v * 100, L = Z / v * 100;
|
|
41
|
+
let i = s[t] + F, u = s[t + 1] - F;
|
|
42
|
+
i < A && (i = A, u = s[t] + s[t + 1] - A), u < L && (u = L, i = s[t] + s[t + 1] - L);
|
|
43
|
+
const Y = U.maxSize, q = X.maxSize;
|
|
44
|
+
if (Y) {
|
|
45
|
+
const m = Y / v * 100;
|
|
46
|
+
i > m && (i = m, u = s[t] + s[t + 1] - m);
|
|
47
|
+
}
|
|
48
|
+
if (q) {
|
|
49
|
+
const m = q / v * 100;
|
|
50
|
+
u > m && (u = m, i = s[t] + s[t + 1] - m);
|
|
51
|
+
}
|
|
52
|
+
const M = [...s];
|
|
53
|
+
M[t] = i, M[t + 1] = u, S(M);
|
|
54
|
+
}, o = () => {
|
|
55
|
+
b.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
56
|
+
};
|
|
57
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o), document.body.style.cursor = c === "horizontal" ? "col-resize" : "row-resize", document.body.style.userSelect = "none";
|
|
58
|
+
},
|
|
59
|
+
[c, p, l, z, h, R, S]
|
|
60
|
+
), J = x(
|
|
61
|
+
(n, e) => {
|
|
62
|
+
const a = e.shiftKey ? 10 : 1;
|
|
63
|
+
let r = 0;
|
|
64
|
+
if (c === "horizontal" ? e.key === "ArrowLeft" ? r = -a : e.key === "ArrowRight" && (r = a) : e.key === "ArrowUp" ? r = -a : e.key === "ArrowDown" && (r = a), r !== 0) {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
const o = [...p], w = 5;
|
|
67
|
+
let t = o[n] + r, P = o[n + 1] - r;
|
|
68
|
+
t >= w && P >= w && (o[n] = t, o[n + 1] = P, S(o));
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
[c, p, S]
|
|
72
|
+
), d = c === "horizontal";
|
|
73
|
+
return /* @__PURE__ */ f(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
ref: $,
|
|
77
|
+
className: `flex ${d ? "flex-row" : "flex-col"} h-full w-full ${G}`,
|
|
78
|
+
children: h.map((n, e) => {
|
|
79
|
+
const a = n.props, r = e === h.length - 1;
|
|
80
|
+
return /* @__PURE__ */ B(C.Fragment, { children: [
|
|
81
|
+
/* @__PURE__ */ f(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
ref: (o) => {
|
|
85
|
+
H.current[e] = o;
|
|
86
|
+
},
|
|
87
|
+
className: `overflow-auto ${a.className || ""}`,
|
|
88
|
+
style: {
|
|
89
|
+
[d ? "width" : "height"]: `calc(${p[e]}% - ${(l - 1) * z / l}px)`,
|
|
90
|
+
flexShrink: 0
|
|
91
|
+
},
|
|
92
|
+
children: a.children
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
!r && /* @__PURE__ */ f(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
role: "separator",
|
|
99
|
+
"aria-orientation": d ? "vertical" : "horizontal",
|
|
100
|
+
"aria-valuenow": Math.round(p[e]),
|
|
101
|
+
tabIndex: 0,
|
|
102
|
+
className: `
|
|
103
|
+
flex-shrink-0 bg-base-300 hover:bg-primary/30 active:bg-primary/50
|
|
104
|
+
transition-colors duration-150 relative group
|
|
105
|
+
${d ? "cursor-col-resize" : "cursor-row-resize"}
|
|
106
|
+
`,
|
|
107
|
+
style: {
|
|
108
|
+
[d ? "width" : "height"]: `${z}px`
|
|
109
|
+
},
|
|
110
|
+
onMouseDown: (o) => V(e, o),
|
|
111
|
+
onKeyDown: (o) => J(e, o),
|
|
112
|
+
children: /* @__PURE__ */ B(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
className: `
|
|
116
|
+
absolute inset-0 flex items-center justify-center
|
|
117
|
+
${d ? "flex-col gap-0.5" : "flex-row gap-0.5"}
|
|
118
|
+
`,
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
|
|
121
|
+
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
|
|
122
|
+
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] }, e);
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
oe.Panel = ne;
|
|
22
134
|
export {
|
|
23
|
-
|
|
135
|
+
oe as Splitter
|
|
24
136
|
};
|
|
25
137
|
//# sourceMappingURL=index72.js.map
|
package/dist/index72.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index72.js","sources":["../src/components/Steps.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface StepsProps extends React.HTMLAttributes<HTMLUListElement> {\n children: React.ReactNode\n vertical?: boolean\n}\n\nexport interface StepProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'color'> {\n children: React.ReactNode\n color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'\n dataContent?: string\n}\n\nfunction StepsRoot({ children, vertical = false, className = '', ...rest }: StepsProps) {\n const classes = ['steps', vertical && 'steps-vertical', className].filter(Boolean).join(' ')\n\n return <ul className={classes} {...rest}>{children}</ul>\n}\n\nfunction Step({ children, color, dataContent, className = '', ...rest }: StepProps) {\n const colorClasses = {\n neutral: 'step-neutral',\n primary: 'step-primary',\n secondary: 'step-secondary',\n accent: 'step-accent',\n info: 'step-info',\n success: 'step-success',\n warning: 'step-warning',\n error: 'step-error',\n }\n\n const classes = ['step', color && colorClasses[color], className].filter(Boolean).join(' ')\n\n return (\n <li className={classes} data-content={dataContent} {...rest}>\n {children}\n </li>\n )\n}\n\nexport const Steps = Object.assign(StepsRoot, {\n Step,\n})\n"],"names":["StepsRoot","children","vertical","className","rest","classes","Step","color","dataContent","jsx","Steps"],"mappings":";AAaA,SAASA,EAAU,EAAE,UAAAC,GAAU,UAAAC,IAAW,IAAO,WAAAC,IAAY,IAAI,GAAGC,KAAoB;AACtF,QAAMC,IAAU,CAAC,SAASH,KAAY,kBAAkBC,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAE3F,2BAAQ,MAAA,EAAG,WAAWE,GAAU,GAAGD,GAAO,UAAAH,GAAS;AACrD;AAEA,SAASK,EAAK,EAAE,UAAAL,GAAU,OAAAM,GAAO,aAAAC,GAAa,WAAAL,IAAY,IAAI,GAAGC,KAAmB;AAYlF,QAAMC,IAAU,CAAC,QAAQE,KAXJ;AAAA,IACnB,SAAS;AAAA,IACT,SAAS;AAAA,IACT,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,EAAA,EAGsCA,CAAK,GAAGJ,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAE1F,SACE,gBAAAM,EAAC,QAAG,WAAWJ,GAAS,gBAAcG,GAAc,GAAGJ,GACpD,UAAAH,GACH;AAEJ;AAEO,MAAMS,IAAQ,OAAO,OAAOV,GAAW;AAAA,EAC5C,MAAAM;AACF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index72.js","sources":["../src/components/Splitter.tsx"],"sourcesContent":["import React, { useState, useRef, useCallback, useEffect } from 'react'\n\nexport interface SplitterPanelProps {\n children: React.ReactNode\n defaultSize?: number\n size?: number\n minSize?: number\n maxSize?: number\n collapsible?: boolean\n collapsed?: boolean\n onCollapse?: (collapsed: boolean) => void\n className?: string\n}\n\nexport interface SplitterProps {\n children: React.ReactNode\n direction?: 'horizontal' | 'vertical'\n sizes?: number[]\n defaultSizes?: number[]\n onSizesChange?: (sizes: number[]) => void\n gutterSize?: number\n minSize?: number\n className?: string\n}\n\nconst Panel: React.FC<SplitterPanelProps> = ({ children }) => {\n return <>{children}</>\n}\n\nexport const Splitter: React.FC<SplitterProps> & { Panel: typeof Panel } = ({\n children,\n direction = 'horizontal',\n sizes,\n defaultSizes,\n onSizesChange,\n gutterSize = 8,\n minSize = 50,\n className = '',\n}) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const panelsRef = useRef<(HTMLDivElement | null)[]>([])\n const draggingRef = useRef<{ index: number; startPos: number; startSizes: number[] } | null>(null)\n\n // Extract panel props from children\n const panels = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<SplitterPanelProps> =>\n React.isValidElement(child)\n )\n\n const panelCount = panels.length\n\n // Initialize sizes\n const getInitialSizes = useCallback(() => {\n if (defaultSizes && defaultSizes.length === panelCount) {\n return defaultSizes\n }\n // Equal distribution\n const equalSize = 100 / panelCount\n return Array(panelCount).fill(equalSize)\n }, [defaultSizes, panelCount])\n\n const [internalSizes, setInternalSizes] = useState<number[]>(getInitialSizes)\n const currentSizes = sizes || internalSizes\n\n // Update internal sizes when panel count changes\n useEffect(() => {\n if (!sizes && internalSizes.length !== panelCount) {\n setInternalSizes(getInitialSizes())\n }\n }, [panelCount, sizes, internalSizes.length, getInitialSizes])\n\n const updateSizes = useCallback(\n (newSizes: number[]) => {\n if (!sizes) {\n setInternalSizes(newSizes)\n }\n onSizesChange?.(newSizes)\n },\n [sizes, onSizesChange]\n )\n\n const handleMouseDown = useCallback(\n (index: number, e: React.MouseEvent) => {\n e.preventDefault()\n const startPos = direction === 'horizontal' ? e.clientX : e.clientY\n draggingRef.current = {\n index,\n startPos,\n startSizes: [...currentSizes],\n }\n\n const handleMouseMove = (moveEvent: MouseEvent) => {\n if (!draggingRef.current || !containerRef.current) return\n\n const { index: dragIndex, startPos: dragStartPos, startSizes } = draggingRef.current\n const containerRect = containerRef.current.getBoundingClientRect()\n const containerSize = direction === 'horizontal' ? containerRect.width : containerRect.height\n const currentPos = direction === 'horizontal' ? moveEvent.clientX : moveEvent.clientY\n\n // Calculate delta as percentage\n const gutterCount = panelCount - 1\n const totalGutterSize = gutterCount * gutterSize\n const availableSize = containerSize - totalGutterSize\n const deltaPixels = currentPos - dragStartPos\n const deltaPercent = (deltaPixels / availableSize) * 100\n\n // Get min sizes for panels\n const panel1Props = panels[dragIndex]?.props || {}\n const panel2Props = panels[dragIndex + 1]?.props || {}\n const minSize1 = panel1Props.minSize ?? minSize\n const minSize2 = panel2Props.minSize ?? minSize\n const minPercent1 = (minSize1 / availableSize) * 100\n const minPercent2 = (minSize2 / availableSize) * 100\n\n // Calculate new sizes\n let newSize1 = startSizes[dragIndex] + deltaPercent\n let newSize2 = startSizes[dragIndex + 1] - deltaPercent\n\n // Apply min constraints\n if (newSize1 < minPercent1) {\n newSize1 = minPercent1\n newSize2 = startSizes[dragIndex] + startSizes[dragIndex + 1] - minPercent1\n }\n if (newSize2 < minPercent2) {\n newSize2 = minPercent2\n newSize1 = startSizes[dragIndex] + startSizes[dragIndex + 1] - minPercent2\n }\n\n // Apply max constraints\n const maxSize1 = panel1Props.maxSize\n const maxSize2 = panel2Props.maxSize\n if (maxSize1) {\n const maxPercent1 = (maxSize1 / availableSize) * 100\n if (newSize1 > maxPercent1) {\n newSize1 = maxPercent1\n newSize2 = startSizes[dragIndex] + startSizes[dragIndex + 1] - maxPercent1\n }\n }\n if (maxSize2) {\n const maxPercent2 = (maxSize2 / availableSize) * 100\n if (newSize2 > maxPercent2) {\n newSize2 = maxPercent2\n newSize1 = startSizes[dragIndex] + startSizes[dragIndex + 1] - maxPercent2\n }\n }\n\n const newSizes = [...startSizes]\n newSizes[dragIndex] = newSize1\n newSizes[dragIndex + 1] = newSize2\n updateSizes(newSizes)\n }\n\n const handleMouseUp = () => {\n draggingRef.current = null\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = direction === 'horizontal' ? 'col-resize' : 'row-resize'\n document.body.style.userSelect = 'none'\n },\n [direction, currentSizes, panelCount, gutterSize, panels, minSize, updateSizes]\n )\n\n const handleKeyDown = useCallback(\n (index: number, e: React.KeyboardEvent) => {\n const step = e.shiftKey ? 10 : 1\n let delta = 0\n\n if (direction === 'horizontal') {\n if (e.key === 'ArrowLeft') delta = -step\n else if (e.key === 'ArrowRight') delta = step\n } else {\n if (e.key === 'ArrowUp') delta = -step\n else if (e.key === 'ArrowDown') delta = step\n }\n\n if (delta !== 0) {\n e.preventDefault()\n const newSizes = [...currentSizes]\n const minPercent = 5 // Minimum 5% when using keyboard\n\n let newSize1 = newSizes[index] + delta\n let newSize2 = newSizes[index + 1] - delta\n\n if (newSize1 >= minPercent && newSize2 >= minPercent) {\n newSizes[index] = newSize1\n newSizes[index + 1] = newSize2\n updateSizes(newSizes)\n }\n }\n },\n [direction, currentSizes, updateSizes]\n )\n\n const isHorizontal = direction === 'horizontal'\n\n return (\n <div\n ref={containerRef}\n className={`flex ${isHorizontal ? 'flex-row' : 'flex-col'} h-full w-full ${className}`}\n >\n {panels.map((panel, index) => {\n const panelProps = panel.props\n const isLast = index === panels.length - 1\n\n return (\n <React.Fragment key={index}>\n <div\n ref={(el) => {\n panelsRef.current[index] = el\n }}\n className={`overflow-auto ${panelProps.className || ''}`}\n style={{\n [isHorizontal ? 'width' : 'height']: `calc(${currentSizes[index]}% - ${\n ((panelCount - 1) * gutterSize) / panelCount\n }px)`,\n flexShrink: 0,\n }}\n >\n {panelProps.children}\n </div>\n {!isLast && (\n <div\n role=\"separator\"\n aria-orientation={isHorizontal ? 'vertical' : 'horizontal'}\n aria-valuenow={Math.round(currentSizes[index])}\n tabIndex={0}\n className={`\n flex-shrink-0 bg-base-300 hover:bg-primary/30 active:bg-primary/50\n transition-colors duration-150 relative group\n ${isHorizontal ? 'cursor-col-resize' : 'cursor-row-resize'}\n `}\n style={{\n [isHorizontal ? 'width' : 'height']: `${gutterSize}px`,\n }}\n onMouseDown={(e) => handleMouseDown(index, e)}\n onKeyDown={(e) => handleKeyDown(index, e)}\n >\n {/* Grip indicator */}\n <div\n className={`\n absolute inset-0 flex items-center justify-center\n ${isHorizontal ? 'flex-col gap-0.5' : 'flex-row gap-0.5'}\n `}\n >\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n </div>\n </div>\n )}\n </React.Fragment>\n )\n })}\n </div>\n )\n}\n\nSplitter.Panel = Panel\n"],"names":["Panel","children","Splitter","direction","sizes","defaultSizes","onSizesChange","gutterSize","minSize","className","containerRef","useRef","panelsRef","draggingRef","panels","React","child","panelCount","getInitialSizes","useCallback","equalSize","internalSizes","setInternalSizes","useState","currentSizes","useEffect","updateSizes","newSizes","handleMouseDown","index","startPos","handleMouseMove","moveEvent","dragIndex","dragStartPos","startSizes","containerRect","containerSize","currentPos","totalGutterSize","availableSize","deltaPercent","panel1Props","panel2Props","minSize1","minSize2","minPercent1","minPercent2","newSize1","newSize2","maxSize1","maxSize2","maxPercent1","maxPercent2","handleMouseUp","handleKe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)
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
)
|
|
54
|
-
] });
|
|
55
|
-
}
|
|
56
|
-
function ne({
|
|
57
|
-
columns: l,
|
|
58
|
-
dataSource: p,
|
|
59
|
-
rowKey: k = "id",
|
|
60
|
-
loading: w = !1,
|
|
61
|
-
size: m = "md",
|
|
62
|
-
bordered: I = !1,
|
|
63
|
-
hoverable: P = !0,
|
|
64
|
-
striped: c = !1,
|
|
65
|
-
pinRows: S = !1,
|
|
66
|
-
pinCols: $ = !1,
|
|
67
|
-
pagination: h,
|
|
68
|
-
rowSelection: o,
|
|
69
|
-
className: E = "",
|
|
70
|
-
onRow: W
|
|
71
|
-
}) {
|
|
72
|
-
const [N, K] = v(
|
|
73
|
-
h !== !1 && h?.current ? h.current : 1
|
|
74
|
-
), j = h !== !1 && h?.pageSize ? h.pageSize : 10, [x, T] = v(() => {
|
|
75
|
-
const e = l.find((t) => t.defaultSortOrder);
|
|
76
|
-
return {
|
|
77
|
-
columnKey: e?.key || null,
|
|
78
|
-
order: e?.defaultSortOrder || null
|
|
79
|
-
};
|
|
80
|
-
}), [V, _] = v(() => {
|
|
81
|
-
const e = {};
|
|
82
|
-
return l.forEach((t) => {
|
|
83
|
-
t.defaultFilteredValue && (e[t.key] = t.defaultFilteredValue);
|
|
84
|
-
}), e;
|
|
85
|
-
}), [z, O] = v(
|
|
86
|
-
o?.selectedRowKeys || []
|
|
87
|
-
), R = h !== !1;
|
|
88
|
-
let y = [...p];
|
|
89
|
-
if (Object.entries(V).forEach(([e, t]) => {
|
|
90
|
-
if (t.length > 0) {
|
|
91
|
-
const n = l.find((r) => r.key === e);
|
|
92
|
-
n?.onFilter && (y = y.filter(
|
|
93
|
-
(r) => t.some((i) => n.onFilter(i, r))
|
|
94
|
-
));
|
|
95
|
-
}
|
|
96
|
-
}), x.columnKey && x.order) {
|
|
97
|
-
const e = l.find((t) => t.key === x.columnKey);
|
|
98
|
-
e?.sorter && y.sort((t, n) => {
|
|
99
|
-
let r = 0;
|
|
100
|
-
if (typeof e.sorter == "function")
|
|
101
|
-
r = e.sorter(t, n);
|
|
102
|
-
else if (e.dataIndex) {
|
|
103
|
-
const i = t[e.dataIndex], d = n[e.dataIndex];
|
|
104
|
-
i < d && (r = -1), i > d && (r = 1);
|
|
105
|
-
}
|
|
106
|
-
return x.order === "ascend" ? r : -r;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
const L = Math.ceil(y.length / j), A = (N - 1) * j, q = A + j, C = R ? y.slice(A, q) : y, B = (e) => {
|
|
110
|
-
K(e), h !== !1 && h?.onChange && h.onChange(e, j);
|
|
111
|
-
}, G = (e) => {
|
|
112
|
-
T((t) => {
|
|
113
|
-
if (t.columnKey === e) {
|
|
114
|
-
if (t.order === "ascend") return { columnKey: e, order: "descend" };
|
|
115
|
-
if (t.order === "descend") return { columnKey: null, order: null };
|
|
116
|
-
}
|
|
117
|
-
return { columnKey: e, order: "ascend" };
|
|
118
|
-
}), K(1);
|
|
119
|
-
}, J = (e, t) => {
|
|
120
|
-
_((n) => ({
|
|
121
|
-
...n,
|
|
122
|
-
[e]: t
|
|
123
|
-
})), K(1);
|
|
124
|
-
}, Q = (e) => {
|
|
125
|
-
const t = e ? C.map((n, r) => F(n, r)) : [];
|
|
126
|
-
if (O(t), o?.onChange) {
|
|
127
|
-
const n = e ? C : [];
|
|
128
|
-
o.onChange(t, n);
|
|
129
|
-
}
|
|
130
|
-
}, U = (e, t, n) => {
|
|
131
|
-
const r = F(e, t), i = n ? [...z, r] : z.filter((d) => d !== r);
|
|
132
|
-
if (O(i), o?.onChange) {
|
|
133
|
-
const d = y.filter(
|
|
134
|
-
(u, a) => i.includes(F(u, a))
|
|
135
|
-
);
|
|
136
|
-
o.onChange(i, d);
|
|
137
|
-
}
|
|
138
|
-
}, F = (e, t) => typeof k == "function" ? k(e) : e[k] ?? t.toString(), X = (e, t, n) => e.render ? e.render(
|
|
139
|
-
e.dataIndex ? t[e.dataIndex] : void 0,
|
|
140
|
-
t,
|
|
141
|
-
n
|
|
142
|
-
) : e.dataIndex ? t[e.dataIndex] : "", M = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", D = (e, t = !1) => {
|
|
143
|
-
const n = l[e];
|
|
144
|
-
if (!n.fixed) return { className: "" };
|
|
145
|
-
const r = ["sticky", "bg-base-100"];
|
|
146
|
-
let i = 0;
|
|
147
|
-
const d = {
|
|
148
|
-
boxSizing: "border-box"
|
|
149
|
-
};
|
|
150
|
-
if (n.fixed === "left") {
|
|
151
|
-
for (let a = 0; a < e; a++)
|
|
152
|
-
if (l[a].fixed === "left" && l[a].width) {
|
|
153
|
-
const b = l[a].width, g = typeof b == "number" ? b : parseInt(String(b));
|
|
154
|
-
isNaN(g) || (i += g);
|
|
155
|
-
}
|
|
156
|
-
i === 0 ? r.push("left-0") : d.left = `${i}px`, r.push(t ? "z-30" : "z-20");
|
|
157
|
-
let u = -1;
|
|
158
|
-
for (let a = l.length - 1; a >= 0; a--)
|
|
159
|
-
if (l[a].fixed === "left") {
|
|
160
|
-
u = a;
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
e === u && (d.boxShadow = "2px 0 4px rgba(0, 0, 0, 0.1)");
|
|
164
|
-
}
|
|
165
|
-
if (n.fixed === "right") {
|
|
166
|
-
for (let a = e + 1; a < l.length; a++)
|
|
167
|
-
if (l[a].fixed === "right" && l[a].width) {
|
|
168
|
-
const b = l[a].width, g = typeof b == "number" ? b : parseInt(String(b));
|
|
169
|
-
isNaN(g) || (i += g);
|
|
170
|
-
}
|
|
171
|
-
i === 0 ? r.push("right-0") : d.right = `${i}px`, r.push(t ? "z-30" : "z-20"), e === l.findIndex((a) => a.fixed === "right") && (d.boxShadow = "-2px 0 4px rgba(0, 0, 0, 0.1)");
|
|
172
|
-
}
|
|
173
|
-
return {
|
|
174
|
-
className: r.filter(Boolean).join(" "),
|
|
175
|
-
style: Object.keys(d).length > 0 ? d : void 0
|
|
176
|
-
};
|
|
177
|
-
}, Y = [
|
|
178
|
-
"table",
|
|
179
|
-
"bg-base-100",
|
|
180
|
-
m === "xs" && "table-xs",
|
|
181
|
-
m === "sm" && "table-sm",
|
|
182
|
-
m === "lg" && "table-lg",
|
|
183
|
-
c && "table-zebra",
|
|
184
|
-
S && "table-pin-rows",
|
|
185
|
-
$ && "table-pin-cols",
|
|
186
|
-
E
|
|
187
|
-
].filter(Boolean).join(" "), Z = l.some((e) => e.fixed), H = [
|
|
188
|
-
(!S || Z) && "overflow-x-auto",
|
|
189
|
-
I && "rounded-box border border-base-content/5 bg-base-100"
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
const j = ({
|
|
3
|
+
children: s,
|
|
4
|
+
direction: a = "vertical",
|
|
5
|
+
spacing: n = 4,
|
|
6
|
+
align: e,
|
|
7
|
+
justify: t,
|
|
8
|
+
wrap: r = !1,
|
|
9
|
+
className: c = "",
|
|
10
|
+
...i
|
|
11
|
+
}) => {
|
|
12
|
+
const l = {
|
|
13
|
+
vertical: "flex-col",
|
|
14
|
+
horizontal: "flex-row"
|
|
15
|
+
}, o = {
|
|
16
|
+
0: "gap-0",
|
|
17
|
+
1: "gap-1",
|
|
18
|
+
2: "gap-2",
|
|
19
|
+
3: "gap-3",
|
|
20
|
+
4: "gap-4",
|
|
21
|
+
5: "gap-5",
|
|
22
|
+
6: "gap-6",
|
|
23
|
+
8: "gap-8",
|
|
24
|
+
10: "gap-10",
|
|
25
|
+
12: "gap-12",
|
|
26
|
+
16: "gap-16",
|
|
27
|
+
20: "gap-20",
|
|
28
|
+
24: "gap-24"
|
|
29
|
+
}, p = e && {
|
|
30
|
+
start: "items-start",
|
|
31
|
+
center: "items-center",
|
|
32
|
+
end: "items-end",
|
|
33
|
+
stretch: "items-stretch"
|
|
34
|
+
}[e], g = t && {
|
|
35
|
+
start: "justify-start",
|
|
36
|
+
center: "justify-center",
|
|
37
|
+
end: "justify-end",
|
|
38
|
+
between: "justify-between",
|
|
39
|
+
around: "justify-around",
|
|
40
|
+
evenly: "justify-evenly"
|
|
41
|
+
}[t], f = [
|
|
42
|
+
"flex",
|
|
43
|
+
l[a],
|
|
44
|
+
o[n],
|
|
45
|
+
p,
|
|
46
|
+
g,
|
|
47
|
+
r && "flex-wrap",
|
|
48
|
+
c
|
|
190
49
|
].filter(Boolean).join(" ");
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const ee = C.length > 0 && z.length === C.length;
|
|
194
|
-
return /* @__PURE__ */ f("div", { className: "space-y-4", children: [
|
|
195
|
-
/* @__PURE__ */ s("div", { className: H, children: /* @__PURE__ */ f("table", { className: Y, style: { borderCollapse: "separate", borderSpacing: 0, tableLayout: "fixed" }, children: [
|
|
196
|
-
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ f("tr", { children: [
|
|
197
|
-
o && /* @__PURE__ */ s("th", { style: { width: 50 }, className: "sticky left-0 z-20 bg-base-100", children: o.type !== "radio" && /* @__PURE__ */ s(
|
|
198
|
-
"input",
|
|
199
|
-
{
|
|
200
|
-
type: "checkbox",
|
|
201
|
-
className: "checkbox checkbox-sm",
|
|
202
|
-
checked: ee,
|
|
203
|
-
onChange: (e) => Q(e.target.checked)
|
|
204
|
-
}
|
|
205
|
-
) }),
|
|
206
|
-
l.map((e, t) => {
|
|
207
|
-
const n = D(t, !0);
|
|
208
|
-
return /* @__PURE__ */ s(
|
|
209
|
-
"th",
|
|
210
|
-
{
|
|
211
|
-
className: `${M(e.align)} ${n.className}`,
|
|
212
|
-
style: {
|
|
213
|
-
...e.width ? { width: e.width } : {},
|
|
214
|
-
...n.style
|
|
215
|
-
},
|
|
216
|
-
children: /* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
|
|
217
|
-
/* @__PURE__ */ s(
|
|
218
|
-
"span",
|
|
219
|
-
{
|
|
220
|
-
className: e.sorter ? "cursor-pointer select-none" : "",
|
|
221
|
-
onClick: () => e.sorter && G(e.key),
|
|
222
|
-
children: e.title
|
|
223
|
-
}
|
|
224
|
-
),
|
|
225
|
-
e.sorter && /* @__PURE__ */ f("div", { className: "flex flex-col", children: [
|
|
226
|
-
/* @__PURE__ */ s(
|
|
227
|
-
"svg",
|
|
228
|
-
{
|
|
229
|
-
className: `w-3 h-3 ${x.columnKey === e.key && x.order === "ascend" ? "text-primary" : "text-base-content/30"}`,
|
|
230
|
-
fill: "currentColor",
|
|
231
|
-
viewBox: "0 0 20 20",
|
|
232
|
-
children: /* @__PURE__ */ s("path", { d: "M5.293 9.707a1 1 0 010-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 01-1.414 1.414L11 7.414V15a1 1 0 11-2 0V7.414L6.707 9.707a1 1 0 01-1.414 0z" })
|
|
233
|
-
}
|
|
234
|
-
),
|
|
235
|
-
/* @__PURE__ */ s(
|
|
236
|
-
"svg",
|
|
237
|
-
{
|
|
238
|
-
className: `w-3 h-3 -mt-1 ${x.columnKey === e.key && x.order === "descend" ? "text-primary" : "text-base-content/30"}`,
|
|
239
|
-
fill: "currentColor",
|
|
240
|
-
viewBox: "0 0 20 20",
|
|
241
|
-
children: /* @__PURE__ */ s("path", { d: "M14.707 10.293a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 111.414-1.414L9 12.586V5a1 1 0 012 0v7.586l2.293-2.293a1 1 0 011.414 0z" })
|
|
242
|
-
}
|
|
243
|
-
)
|
|
244
|
-
] }),
|
|
245
|
-
e.filters && /* @__PURE__ */ s(
|
|
246
|
-
te,
|
|
247
|
-
{
|
|
248
|
-
filters: e.filters,
|
|
249
|
-
selectedValues: V[e.key] || [],
|
|
250
|
-
onChange: (r) => J(e.key, r)
|
|
251
|
-
}
|
|
252
|
-
)
|
|
253
|
-
] })
|
|
254
|
-
},
|
|
255
|
-
e.key
|
|
256
|
-
);
|
|
257
|
-
})
|
|
258
|
-
] }) }),
|
|
259
|
-
/* @__PURE__ */ s("tbody", { children: C.map((e, t) => {
|
|
260
|
-
const n = W?.(e, t) || {}, r = F(e, t), i = z.includes(r), d = [
|
|
261
|
-
P && "hover:bg-base-300",
|
|
262
|
-
i && "bg-primary/10"
|
|
263
|
-
].filter(Boolean).join(" "), u = o?.getCheckboxProps?.(e) || {};
|
|
264
|
-
return /* @__PURE__ */ f(
|
|
265
|
-
"tr",
|
|
266
|
-
{
|
|
267
|
-
className: d,
|
|
268
|
-
...n,
|
|
269
|
-
children: [
|
|
270
|
-
o && /* @__PURE__ */ s("td", { className: "sticky left-0 z-10 bg-base-100", children: /* @__PURE__ */ s(
|
|
271
|
-
"input",
|
|
272
|
-
{
|
|
273
|
-
type: o.type === "radio" ? "radio" : "checkbox",
|
|
274
|
-
className: o.type === "radio" ? "radio radio-sm" : "checkbox checkbox-sm",
|
|
275
|
-
checked: i,
|
|
276
|
-
onChange: (a) => U(e, t, a.target.checked),
|
|
277
|
-
...u
|
|
278
|
-
}
|
|
279
|
-
) }),
|
|
280
|
-
l.map((a, b) => {
|
|
281
|
-
const g = D(b, !1);
|
|
282
|
-
return /* @__PURE__ */ s(
|
|
283
|
-
"td",
|
|
284
|
-
{
|
|
285
|
-
className: `${M(a.align)} ${g.className}`,
|
|
286
|
-
style: g.style,
|
|
287
|
-
children: X(a, e, t)
|
|
288
|
-
},
|
|
289
|
-
a.key
|
|
290
|
-
);
|
|
291
|
-
})
|
|
292
|
-
]
|
|
293
|
-
},
|
|
294
|
-
r
|
|
295
|
-
);
|
|
296
|
-
}) })
|
|
297
|
-
] }) }),
|
|
298
|
-
R && L > 1 && /* @__PURE__ */ s("div", { className: "flex justify-end", children: /* @__PURE__ */ f("div", { className: "join", children: [
|
|
299
|
-
/* @__PURE__ */ s(
|
|
300
|
-
"button",
|
|
301
|
-
{
|
|
302
|
-
className: "join-item btn btn-sm",
|
|
303
|
-
onClick: () => B(N - 1),
|
|
304
|
-
disabled: N === 1,
|
|
305
|
-
children: "«"
|
|
306
|
-
}
|
|
307
|
-
),
|
|
308
|
-
Array.from({ length: L }, (e, t) => t + 1).map((e) => /* @__PURE__ */ s(
|
|
309
|
-
"button",
|
|
310
|
-
{
|
|
311
|
-
className: `join-item btn btn-sm ${N === e ? "btn-active" : ""}`,
|
|
312
|
-
onClick: () => B(e),
|
|
313
|
-
children: e
|
|
314
|
-
},
|
|
315
|
-
e
|
|
316
|
-
)),
|
|
317
|
-
/* @__PURE__ */ s(
|
|
318
|
-
"button",
|
|
319
|
-
{
|
|
320
|
-
className: "join-item btn btn-sm",
|
|
321
|
-
onClick: () => B(N + 1),
|
|
322
|
-
disabled: N === L,
|
|
323
|
-
children: "»"
|
|
324
|
-
}
|
|
325
|
-
)
|
|
326
|
-
] }) })
|
|
327
|
-
] });
|
|
328
|
-
}
|
|
50
|
+
return /* @__PURE__ */ u("div", { className: f, ...i, children: s });
|
|
51
|
+
};
|
|
329
52
|
export {
|
|
330
|
-
|
|
53
|
+
j as Stack
|
|
331
54
|
};
|
|
332
55
|
//# sourceMappingURL=index73.js.map
|