asterui 0.12.9 → 0.12.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/components/Hero.d.ts +6 -13
  2. package/dist/components/Space.d.ts +1 -0
  3. package/dist/components/Splitter.d.ts +2 -0
  4. package/dist/index.d.ts +0 -2
  5. package/dist/index.js +63 -65
  6. package/dist/index.js.map +1 -1
  7. package/dist/index100.js +11 -44
  8. package/dist/index100.js.map +1 -1
  9. package/dist/index101.js +12 -10
  10. package/dist/index101.js.map +1 -1
  11. package/dist/index102.js +7 -14
  12. package/dist/index102.js.map +1 -1
  13. package/dist/index103.js +12 -7
  14. package/dist/index103.js.map +1 -1
  15. package/dist/index104.js +29 -11
  16. package/dist/index104.js.map +1 -1
  17. package/dist/index105.js +16 -29
  18. package/dist/index105.js.map +1 -1
  19. package/dist/index35.js +13 -26
  20. package/dist/index35.js.map +1 -1
  21. package/dist/index74.js +37 -25
  22. package/dist/index74.js.map +1 -1
  23. package/dist/index75.js +223 -103
  24. package/dist/index75.js.map +1 -1
  25. package/dist/index76.js +21 -51
  26. package/dist/index76.js.map +1 -1
  27. package/dist/index77.js +31 -22
  28. package/dist/index77.js.map +1 -1
  29. package/dist/index78.js +22 -31
  30. package/dist/index78.js.map +1 -1
  31. package/dist/index79.js +327 -20
  32. package/dist/index79.js.map +1 -1
  33. package/dist/index80.js +50 -323
  34. package/dist/index80.js.map +1 -1
  35. package/dist/index81.js +40 -56
  36. package/dist/index81.js.map +1 -1
  37. package/dist/index82.js +23 -40
  38. package/dist/index82.js.map +1 -1
  39. package/dist/index83.js +93 -21
  40. package/dist/index83.js.map +1 -1
  41. package/dist/index84.js +148 -87
  42. package/dist/index84.js.map +1 -1
  43. package/dist/index85.js +152 -147
  44. package/dist/index85.js.map +1 -1
  45. package/dist/index86.js +63 -159
  46. package/dist/index86.js.map +1 -1
  47. package/dist/index87.js +35 -65
  48. package/dist/index87.js.map +1 -1
  49. package/dist/index88.js +234 -35
  50. package/dist/index88.js.map +1 -1
  51. package/dist/index89.js +31 -231
  52. package/dist/index89.js.map +1 -1
  53. package/dist/index90.js +210 -34
  54. package/dist/index90.js.map +1 -1
  55. package/dist/index91.js +198 -195
  56. package/dist/index91.js.map +1 -1
  57. package/dist/index92.js +241 -159
  58. package/dist/index92.js.map +1 -1
  59. package/dist/index93.js +166 -283
  60. package/dist/index93.js.map +1 -1
  61. package/dist/index94.js +253 -173
  62. package/dist/index94.js.map +1 -1
  63. package/dist/index95.js +14 -258
  64. package/dist/index95.js.map +1 -1
  65. package/dist/index96.js +31 -12
  66. package/dist/index96.js.map +1 -1
  67. package/dist/index97.js +5 -32
  68. package/dist/index97.js.map +1 -1
  69. package/dist/index98.js +13 -5
  70. package/dist/index98.js.map +1 -1
  71. package/dist/index99.js +43 -11
  72. package/dist/index99.js.map +1 -1
  73. package/package.json +1 -1
  74. package/dist/components/Stack.d.ts +0 -10
  75. package/dist/index106.js +0 -21
  76. package/dist/index106.js.map +0 -1
package/dist/index35.js CHANGED
@@ -1,33 +1,20 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- function s({
3
- children: o,
4
- className: e = "",
5
- ...n
6
- }) {
7
- const t = ["hero", e].filter(Boolean).join(" ");
8
- return /* @__PURE__ */ r("div", { className: t, ...n, children: o });
9
- }
10
- function a({
11
- children: o,
12
- className: e = "",
13
- ...n
14
- }) {
15
- const t = ["hero-content", e].filter(Boolean).join(" ");
16
- return /* @__PURE__ */ r("div", { className: t, ...n, children: o });
17
- }
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
18
2
  function c({
19
3
  children: o,
20
- className: e = "",
21
- ...n
4
+ overlay: s = !1,
5
+ contentClassName: a = "",
6
+ className: r = "",
7
+ ...l
22
8
  }) {
23
- const t = ["hero-overlay", "bg-opacity-60", e].filter(Boolean).join(" ");
24
- return /* @__PURE__ */ r("div", { className: t, ...n, children: o });
9
+ const n = ["hero", r].filter(Boolean).join(" "), t = ["hero-content", a].filter(Boolean).join(" ");
10
+ return /* @__PURE__ */ i("div", { className: n, ...l, children: [
11
+ s && /* @__PURE__ */ e("div", { className: "hero-overlay bg-opacity-60" }),
12
+ /* @__PURE__ */ e("div", { className: t, children: o })
13
+ ] });
25
14
  }
26
- const l = Object.assign(s, {
27
- Content: a,
28
- Overlay: c
29
- });
15
+ c.displayName = "Hero";
30
16
  export {
31
- l as Hero
17
+ c as Hero,
18
+ c as default
32
19
  };
33
20
  //# sourceMappingURL=index35.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index35.js","sources":["../src/components/Hero.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface HeroProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n}\n\nexport interface HeroContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n}\n\nexport interface HeroOverlayProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode\n}\n\nfunction HeroRoot({\n children,\n className = '',\n ...rest\n}: HeroProps) {\n const classes = ['hero', className].filter(Boolean).join(' ')\n\n return (\n <div className={classes} {...rest}>\n {children}\n </div>\n )\n}\n\nfunction HeroContent({\n children,\n className = '',\n ...rest\n}: HeroContentProps) {\n const classes = ['hero-content', className].filter(Boolean).join(' ')\n\n return (\n <div className={classes} {...rest}>\n {children}\n </div>\n )\n}\n\nfunction HeroOverlay({\n children,\n className = '',\n ...rest\n}: HeroOverlayProps) {\n const classes = ['hero-overlay', 'bg-opacity-60', className].filter(Boolean).join(' ')\n\n return (\n <div className={classes} {...rest}>\n {children}\n </div>\n )\n}\n\nexport const Hero = Object.assign(HeroRoot, {\n Content: HeroContent,\n Overlay: HeroOverlay,\n})\n"],"names":["HeroRoot","children","className","rest","classes","HeroContent","HeroOverlay","Hero"],"mappings":";AAcA,SAASA,EAAS;AAAA,EAChB,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GAAc;AACZ,QAAMC,IAAU,CAAC,QAAQF,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAE5D,2BACG,OAAA,EAAI,WAAWE,GAAU,GAAGD,GAC1B,UAAAF,GACH;AAEJ;AAEA,SAASI,EAAY;AAAA,EACnB,UAAAJ;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GAAqB;AACnB,QAAMC,IAAU,CAAC,gBAAgBF,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAEpE,2BACG,OAAA,EAAI,WAAWE,GAAU,GAAGD,GAC1B,UAAAF,GACH;AAEJ;AAEA,SAASK,EAAY;AAAA,EACnB,UAAAL;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GAAqB;AACnB,QAAMC,IAAU,CAAC,gBAAgB,iBAAiBF,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAErF,2BACG,OAAA,EAAI,WAAWE,GAAU,GAAGD,GAC1B,UAAAF,GACH;AAEJ;AAEO,MAAMM,IAAO,OAAO,OAAOP,GAAU;AAAA,EAC1C,SAASK;AAAA,EACT,SAASC;AACX,CAAC;"}
1
+ {"version":3,"file":"index35.js","sources":["../src/components/Hero.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface HeroProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n overlay?: boolean\n contentClassName?: string\n}\n\nexport function Hero({\n children,\n overlay = false,\n contentClassName = '',\n className = '',\n ...rest\n}: HeroProps) {\n const heroClasses = ['hero', className].filter(Boolean).join(' ')\n const contentClasses = ['hero-content', contentClassName].filter(Boolean).join(' ')\n\n return (\n <div className={heroClasses} {...rest}>\n {overlay && <div className=\"hero-overlay bg-opacity-60\" />}\n <div className={contentClasses}>{children}</div>\n </div>\n )\n}\n\nHero.displayName = 'Hero'\n\nexport default Hero\n"],"names":["Hero","children","overlay","contentClassName","className","rest","heroClasses","contentClasses","jsxs","jsx"],"mappings":";AAQO,SAASA,EAAK;AAAA,EACnB,UAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,kBAAAC,IAAmB;AAAA,EACnB,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GAAc;AACZ,QAAMC,IAAc,CAAC,QAAQF,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAC1DG,IAAiB,CAAC,gBAAgBJ,CAAgB,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAElF,SACE,gBAAAK,EAAC,OAAA,EAAI,WAAWF,GAAc,GAAGD,GAC9B,UAAA;AAAA,IAAAH,KAAW,gBAAAO,EAAC,OAAA,EAAI,WAAU,6BAAA,CAA6B;AAAA,IACxD,gBAAAA,EAAC,OAAA,EAAI,WAAWF,GAAiB,UAAAN,EAAA,CAAS;AAAA,EAAA,GAC5C;AAEJ;AAEAD,EAAK,cAAc;"}
package/dist/index74.js CHANGED
@@ -1,49 +1,61 @@
1
- import { jsx as y } from "react/jsx-runtime";
2
- const g = {
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import b from "react";
3
+ const w = {
3
4
  xs: "gap-1",
4
5
  sm: "gap-2",
5
6
  md: "gap-4",
6
7
  lg: "gap-6",
7
8
  xl: "gap-8"
8
- }, C = {
9
+ }, v = {
9
10
  start: "items-start",
10
11
  end: "items-end",
11
12
  center: "items-center",
12
13
  baseline: "items-baseline",
13
14
  stretch: "items-stretch"
14
- }, j = {
15
+ }, N = {
15
16
  start: "justify-start",
16
17
  end: "justify-end",
17
18
  center: "justify-center",
18
19
  between: "justify-between",
19
20
  around: "justify-around",
20
21
  evenly: "justify-evenly"
21
- }, h = ({
22
- direction: n = "horizontal",
22
+ }, z = ({
23
+ direction: f = "horizontal",
23
24
  size: s = "md",
24
- align: e,
25
- justify: t,
26
- wrap: l = !1,
27
- className: o = "",
28
- style: r,
29
- children: i,
30
- ...c
25
+ align: r,
26
+ justify: a,
27
+ wrap: p = !1,
28
+ split: l,
29
+ className: u = "",
30
+ style: d,
31
+ children: e,
32
+ ...m
31
33
  }) => {
32
- const a = typeof s == "number", p = a ? "" : g[s], f = e ? C[e] : "", m = t ? j[t] : "", d = [
34
+ const o = typeof s == "number", h = o ? "" : w[s], y = r ? v[r] : "", C = a ? N[a] : "", g = [
33
35
  "flex",
34
- n === "horizontal" ? "flex-row" : "flex-col",
35
- p,
36
- f,
37
- m,
38
- l ? "flex-wrap" : "",
39
- o
40
- ].filter(Boolean).join(" "), u = {
41
- ...r,
42
- ...a ? { gap: `${s}px` } : {}
36
+ f === "horizontal" ? "flex-row" : "flex-col",
37
+ h,
38
+ y,
39
+ C,
40
+ p ? "flex-wrap" : "",
41
+ u
42
+ ].filter(Boolean).join(" "), j = {
43
+ ...d,
44
+ ...o ? { gap: `${s}px` } : {}
43
45
  };
44
- return /* @__PURE__ */ y("div", { className: d, style: u, ...c, children: i });
46
+ return /* @__PURE__ */ c("div", { className: g, style: j, ...m, children: (() => {
47
+ if (!l) return e;
48
+ const t = b.Children.toArray(e).filter(Boolean);
49
+ if (t.length <= 1) return e;
50
+ const n = [];
51
+ return t.forEach((x, i) => {
52
+ n.push(x), i < t.length - 1 && n.push(
53
+ /* @__PURE__ */ c("span", { className: "flex-shrink-0", children: l }, `split-${i}`)
54
+ );
55
+ }), n;
56
+ })() });
45
57
  };
46
58
  export {
47
- h as Space
59
+ z as Space
48
60
  };
49
61
  //# sourceMappingURL=index74.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index74.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;"}
1
+ {"version":3,"file":"index74.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 split?: React.ReactNode\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 split,\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 // If split is provided, interleave separator between children\n const renderChildren = () => {\n if (!split) return children\n\n const childArray = React.Children.toArray(children).filter(Boolean)\n if (childArray.length <= 1) return children\n\n const result: React.ReactNode[] = []\n childArray.forEach((child, index) => {\n result.push(child)\n if (index < childArray.length - 1) {\n result.push(\n <span key={`split-${index}`} className=\"flex-shrink-0\">\n {split}\n </span>\n )\n }\n })\n return result\n }\n\n return <div className={classes} style={combinedStyle} {...rest}>{renderChildren()}</div>\n}\n"],"names":["gapClasses","alignClasses","justifyClasses","Space","direction","size","align","justify","wrap","split","className","style","children","rest","isNumericSize","gapClass","alignClass","justifyClass","classes","combinedStyle","jsx","childArray","React","result","child","index"],"mappings":";;AAYA,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,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAgB,OAAOT,KAAS,UAChCU,IAAWD,IAAgB,KAAKd,EAAWK,CAAI,GAC/CW,IAAaV,IAAQL,EAAaK,CAAK,IAAI,IAC3CW,IAAeV,IAAUL,EAAeK,CAAO,IAAI,IAInDW,IAAU;AAAA,IACd;AAAA,IAHqBd,MAAc,eAAe,aAAa;AAAA,IAK/DW;AAAA,IACAC;AAAA,IACAC;AAAA,IARgBT,IAAO,cAAc;AAAA,IAUrCE;AAAA,EAAA,EACA,OAAO,OAAO,EAAE,KAAK,GAAG,GAEpBS,IAAqC;AAAA,IACzC,GAAGR;AAAA,IACH,GAAIG,IAAgB,EAAE,KAAK,GAAGT,CAAI,SAAS,CAAA;AAAA,EAAC;AAwB9C,SAAO,gBAAAe,EAAC,SAAI,WAAWF,GAAS,OAAOC,GAAgB,GAAGN,GAAO,WApB1C,MAAM;AAC3B,QAAI,CAACJ,EAAO,QAAOG;AAEnB,UAAMS,IAAaC,EAAM,SAAS,QAAQV,CAAQ,EAAE,OAAO,OAAO;AAClE,QAAIS,EAAW,UAAU,EAAG,QAAOT;AAEnC,UAAMW,IAA4B,CAAA;AAClC,WAAAF,EAAW,QAAQ,CAACG,GAAOC,MAAU;AACnC,MAAAF,EAAO,KAAKC,CAAK,GACbC,IAAQJ,EAAW,SAAS,KAC9BE,EAAO;AAAA,0BACJ,QAAA,EAA4B,WAAU,iBACpC,UAAAd,KADQ,SAASgB,CAAK,EAEzB;AAAA,MAAA;AAAA,IAGN,CAAC,GACMF;AAAA,EACT,GAEiE,EAAe,CAAE;AACpF;"}
package/dist/index75.js CHANGED
@@ -1,137 +1,257 @@
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 = ""
1
+ import { jsx as h, jsxs as K, Fragment as ie } from "react/jsx-runtime";
2
+ import T, { useRef as L, useState as J, useCallback as y, useEffect as Q } from "react";
3
+ const pe = ({ children: M }) => /* @__PURE__ */ h(ie, { children: M }), ue = ({
4
+ children: M,
5
+ direction: z = "horizontal",
6
+ sizes: P,
7
+ defaultSizes: $,
8
+ onSizesChange: F,
9
+ gutterSize: R = 8,
10
+ minSize: E = 50,
11
+ className: Z = ""
12
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);
13
+ const D = L(null), I = L([]), x = L(null), u = T.Children.toArray(M).filter(
14
+ (e) => T.isValidElement(e)
15
+ ), m = u.length, [f, W] = J(
16
+ () => u.map((e) => e.props.defaultCollapsed ?? e.props.collapsed ?? !1)
17
+ ), X = L([]), j = y(() => {
18
+ const e = u.map((s) => s.props.defaultSize), o = e.some((s) => s !== void 0);
19
+ if ($ && $.length === m)
20
+ return $;
21
+ if (o) {
22
+ const s = e.reduce((l, n) => l + (n ?? 0), 0), r = e.filter((l) => l === void 0).length, a = Math.max(0, 100 - s), t = r > 0 ? a / r : 0;
23
+ return e.map((l) => l ?? t);
24
+ }
25
+ const i = 100 / m;
26
+ return Array(m).fill(i);
27
+ }, [$, m, u]), [k, Y] = J(j), ee = y(() => {
28
+ const e = u.map((t) => t.props.size);
29
+ if (!e.some((t) => t !== void 0)) return null;
30
+ const i = e.reduce((t, l) => t + (l ?? 0), 0), s = e.filter((t) => t === void 0).length, r = Math.max(0, 100 - i), a = s > 0 ? r / s : 0;
31
+ return e.map((t, l) => t ?? k[l] ?? a);
32
+ }, [u, k]), d = P || ee() || k;
33
+ Q(() => {
34
+ !P && k.length !== m && Y(j());
35
+ }, [m, P, k.length, j]), Q(() => {
36
+ const e = u.map(
37
+ (i, s) => i.props.collapsed ?? f[s] ?? !1
38
+ );
39
+ e.some((i, s) => i !== f[s]) && W(e);
40
+ }, [u.map((e) => e.props.collapsed).join(",")]);
41
+ const b = y(
42
+ (e) => {
43
+ P || Y(e), F?.(e);
44
+ },
45
+ [P, F]
46
+ ), _ = y(
47
+ (e) => {
48
+ const o = u[e];
49
+ if (!o?.props.collapsible) return;
50
+ const s = !f[e], r = [...f];
51
+ if (r[e] = s, W(r), o.props.onCollapse?.(s), s) {
52
+ X.current = [...d];
53
+ const a = 0, t = d[e] - a, l = d.map((n, c) => ({ size: n, index: c })).filter((n, c) => c !== e && !r[c]);
54
+ if (l.length > 0) {
55
+ const n = t / l.length, c = d.map((p, w) => w === e ? a : r[w] ? p : p + n);
56
+ b(c);
57
+ }
58
+ } else {
59
+ const a = X.current[e] || 100 / m, l = d.map((n, c) => ({ size: n, index: c })).filter((n, c) => c !== e && !r[c]).reduce((n, c) => n + c.size, 0);
60
+ if (l > 0) {
61
+ const n = d.map((c, p) => {
62
+ if (p === e) return a;
63
+ if (!r[p]) {
64
+ const w = c / l;
65
+ return c - a * w;
66
+ }
67
+ return c;
68
+ });
69
+ b(n);
70
+ }
71
+ }
27
72
  },
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]
73
+ [u, f, d, m, b]
74
+ ), te = y(
75
+ (e, o) => {
76
+ const i = u[e]?.props || {}, s = u[e + 1]?.props || {};
77
+ if (i.resizable === !1 || s.resizable === !1 || f[e] || f[e + 1])
78
+ return;
79
+ o.preventDefault();
80
+ const r = z === "horizontal" ? o.clientX : o.clientY;
81
+ x.current = {
82
+ index: e,
83
+ startPos: r,
84
+ startSizes: [...d]
37
85
  };
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);
86
+ const a = (l) => {
87
+ if (!x.current || !D.current) return;
88
+ const { index: n, startPos: c, startSizes: p } = x.current, w = D.current.getBoundingClientRect(), se = z === "horizontal" ? w.width : w.height, re = z === "horizontal" ? l.clientX : l.clientY, le = (m - 1) * R, N = se - le, q = (re - c) / N * 100, G = u[n]?.props || {}, H = u[n + 1]?.props || {}, ae = G.minSize ?? E, ce = H.minSize ?? E, A = ae / N * 100, B = ce / N * 100;
89
+ let v = p[n] + q, C = p[n + 1] - q;
90
+ v < A && (v = A, C = p[n] + p[n + 1] - A), C < B && (C = B, v = p[n] + p[n + 1] - B);
91
+ const O = G.maxSize, V = H.maxSize;
92
+ if (O) {
93
+ const S = O / N * 100;
94
+ v > S && (v = S, C = p[n] + p[n + 1] - S);
47
95
  }
48
- if (q) {
49
- const m = q / v * 100;
50
- u > m && (u = m, i = s[t] + s[t + 1] - m);
96
+ if (V) {
97
+ const S = V / N * 100;
98
+ C > S && (C = S, v = p[n] + p[n + 1] - S);
51
99
  }
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 = "";
100
+ const U = [...p];
101
+ U[n] = v, U[n + 1] = C, b(U);
102
+ }, t = () => {
103
+ x.current = null, document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", t), document.body.style.cursor = "", document.body.style.userSelect = "";
56
104
  };
57
- document.addEventListener("mousemove", r), document.addEventListener("mouseup", o), document.body.style.cursor = c === "horizontal" ? "col-resize" : "row-resize", document.body.style.userSelect = "none";
105
+ document.addEventListener("mousemove", a), document.addEventListener("mouseup", t), document.body.style.cursor = z === "horizontal" ? "col-resize" : "row-resize", document.body.style.userSelect = "none";
58
106
  },
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));
107
+ [z, d, m, R, u, E, b, f]
108
+ ), oe = y(
109
+ (e, o) => {
110
+ if (f[e] || f[e + 1])
111
+ return;
112
+ const i = o.shiftKey ? 10 : 1;
113
+ let s = 0;
114
+ if (z === "horizontal" ? o.key === "ArrowLeft" ? s = -i : o.key === "ArrowRight" && (s = i) : o.key === "ArrowUp" ? s = -i : o.key === "ArrowDown" && (s = i), s !== 0) {
115
+ o.preventDefault();
116
+ const r = [...d], a = 5;
117
+ let t = r[e] + s, l = r[e + 1] - s;
118
+ t >= a && l >= a && (r[e] = t, r[e + 1] = l, b(r));
69
119
  }
70
120
  },
71
- [c, p, S]
72
- ), d = c === "horizontal";
73
- return /* @__PURE__ */ f(
121
+ [z, d, b, f]
122
+ ), g = z === "horizontal", ne = (e) => {
123
+ const o = u[e], i = u[e + 1], s = o?.props.collapsible, r = i?.props.collapsible, a = f[e], t = f[e + 1];
124
+ return {
125
+ showStart: s && !t,
126
+ showEnd: r && !a,
127
+ panel1Collapsed: a,
128
+ panel2Collapsed: t
129
+ };
130
+ };
131
+ return /* @__PURE__ */ h(
74
132
  "div",
75
133
  {
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(
134
+ ref: D,
135
+ className: `flex ${g ? "flex-row" : "flex-col"} h-full w-full ${Z}`,
136
+ children: u.map((e, o) => {
137
+ const i = e.props, s = o === u.length - 1, r = f[o], a = i.resizable !== !1 && !r;
138
+ return /* @__PURE__ */ K(T.Fragment, { children: [
139
+ /* @__PURE__ */ h(
82
140
  "div",
83
141
  {
84
- ref: (o) => {
85
- H.current[e] = o;
142
+ ref: (t) => {
143
+ I.current[o] = t;
86
144
  },
87
- className: `overflow-auto ${a.className || ""}`,
145
+ className: `overflow-auto ${i.className || ""}`,
88
146
  style: {
89
- [d ? "width" : "height"]: `calc(${p[e]}% - ${(l - 1) * z / l}px)`,
90
- flexShrink: 0
147
+ [g ? "width" : "height"]: r ? "0px" : `calc(${d[o]}% - ${(m - 1) * R / m}px)`,
148
+ flexShrink: 0,
149
+ overflow: r ? "hidden" : "auto"
91
150
  },
92
- children: a.children
151
+ "data-collapsed": r,
152
+ children: i.children
93
153
  }
94
154
  ),
95
- !r && /* @__PURE__ */ f(
155
+ !s && /* @__PURE__ */ h(
96
156
  "div",
97
157
  {
98
158
  role: "separator",
99
- "aria-orientation": d ? "vertical" : "horizontal",
100
- "aria-valuenow": Math.round(p[e]),
101
- tabIndex: 0,
159
+ "aria-orientation": g ? "vertical" : "horizontal",
160
+ "aria-valuenow": Math.round(d[o]),
161
+ tabIndex: a ? 0 : -1,
102
162
  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"}
163
+ flex-shrink-0 bg-base-300 transition-colors duration-150 relative group
164
+ ${a ? "hover:bg-primary/30 active:bg-primary/50" : ""}
165
+ ${a ? g ? "cursor-col-resize" : "cursor-row-resize" : "cursor-default"}
106
166
  `,
107
167
  style: {
108
- [d ? "width" : "height"]: `${z}px`
168
+ [g ? "width" : "height"]: `${R}px`
109
169
  },
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
- )
170
+ onMouseDown: (t) => te(o, t),
171
+ onKeyDown: (t) => oe(o, t),
172
+ children: (() => {
173
+ const { showStart: t, showEnd: l, panel1Collapsed: n, panel2Collapsed: c } = ne(o);
174
+ return !t && !l ? /* @__PURE__ */ K(
175
+ "div",
176
+ {
177
+ className: `
178
+ absolute inset-0 flex items-center justify-center
179
+ ${g ? "flex-col gap-0.5" : "flex-row gap-0.5"}
180
+ `,
181
+ children: [
182
+ /* @__PURE__ */ h("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
183
+ /* @__PURE__ */ h("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
184
+ /* @__PURE__ */ h("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" })
185
+ ]
186
+ }
187
+ ) : /* @__PURE__ */ K(
188
+ "div",
189
+ {
190
+ className: `
191
+ absolute inset-0 flex items-center justify-center
192
+ ${g ? "flex-col" : "flex-row"}
193
+ `,
194
+ children: [
195
+ t && /* @__PURE__ */ h(
196
+ "button",
197
+ {
198
+ type: "button",
199
+ onClick: (p) => {
200
+ p.stopPropagation(), _(o);
201
+ },
202
+ className: `
203
+ p-0.5 rounded hover:bg-base-content/20 transition-colors
204
+
205
+ `,
206
+ "aria-label": n ? "Expand panel" : "Collapse panel",
207
+ children: /* @__PURE__ */ h(
208
+ "svg",
209
+ {
210
+ className: `w-3 h-3 text-base-content/50 hover:text-base-content transition-transform ${n ? g ? "rotate-180" : "-rotate-90" : g ? "rotate-0" : "rotate-90"}`,
211
+ fill: "none",
212
+ viewBox: "0 0 24 24",
213
+ stroke: "currentColor",
214
+ children: /* @__PURE__ */ h("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" })
215
+ }
216
+ )
217
+ }
218
+ ),
219
+ l && /* @__PURE__ */ h(
220
+ "button",
221
+ {
222
+ type: "button",
223
+ onClick: (p) => {
224
+ p.stopPropagation(), _(o + 1);
225
+ },
226
+ className: `
227
+ p-0.5 rounded hover:bg-base-content/20 transition-colors
228
+ `,
229
+ "aria-label": c ? "Expand panel" : "Collapse panel",
230
+ children: /* @__PURE__ */ h(
231
+ "svg",
232
+ {
233
+ className: `w-3 h-3 text-base-content/50 hover:text-base-content transition-transform ${c ? g ? "rotate-0" : "rotate-90" : g ? "rotate-180" : "-rotate-90"}`,
234
+ fill: "none",
235
+ viewBox: "0 0 24 24",
236
+ stroke: "currentColor",
237
+ children: /* @__PURE__ */ h("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" })
238
+ }
239
+ )
240
+ }
241
+ )
242
+ ]
243
+ }
244
+ );
245
+ })()
126
246
  }
127
247
  )
128
- ] }, e);
248
+ ] }, o);
129
249
  })
130
250
  }
131
251
  );
132
252
  };
133
- oe.Panel = ne;
253
+ ue.Panel = pe;
134
254
  export {
135
- oe as Splitter
255
+ ue as Splitter
136
256
  };
137
257
  //# sourceMappingURL=index75.js.map