@ramme-io/ui 4.0.1 → 4.1.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.
Files changed (83) hide show
  1. package/README.md +159 -7
  2. package/dist/blocks/ai/Actions.js +2 -2
  3. package/dist/blocks/ai/PromptInput.js +6 -6
  4. package/dist/component-registry.js +389 -359
  5. package/dist/components/ai/AIChatThread/AIChatThread.js +81 -73
  6. package/dist/components/ai/ArchitectureReferenceCard/ArchitectureReferenceCard.d.ts +28 -0
  7. package/dist/components/ai/ArchitectureReferenceCard/ArchitectureReferenceCard.js +70 -0
  8. package/dist/components/ai/ArchitectureReferenceCard/index.d.ts +2 -0
  9. package/dist/components/ai/CounterpartyGraphCard/CounterpartyGraphCard.d.ts +30 -0
  10. package/dist/components/ai/CounterpartyGraphCard/CounterpartyGraphCard.js +82 -0
  11. package/dist/components/ai/CounterpartyGraphCard/index.d.ts +2 -0
  12. package/dist/components/ai/DivergenceMetricsCard/DivergenceMetricsCard.d.ts +29 -0
  13. package/dist/components/ai/DivergenceMetricsCard/DivergenceMetricsCard.js +69 -0
  14. package/dist/components/ai/DivergenceMetricsCard/index.d.ts +2 -0
  15. package/dist/components/ai/KeyInjectionOverlay.d.ts +10 -0
  16. package/dist/components/ai/KeyInjectionOverlay.js +11 -11
  17. package/dist/components/ai/NewsSummaryCard/NewsSummaryCard.js +17 -17
  18. package/dist/components/ai/StockChart/StockChart.js +4 -4
  19. package/dist/components/auth/AuthLayout.js +4 -4
  20. package/dist/components/auth/LoginPage.d.ts +22 -0
  21. package/dist/components/auth/LoginPage.js +50 -42
  22. package/dist/components/data-display/CodeBlock.d.ts +33 -7
  23. package/dist/components/data-display/CodeBlock.js +134 -41
  24. package/dist/components/data-display/Table.js +8 -8
  25. package/dist/components/feedback/EmptyState.js +9 -9
  26. package/dist/components/feedback/ToastProvider.js +4 -4
  27. package/dist/components/forms/Checkbox.js +5 -5
  28. package/dist/components/forms/ComboBox.js +2 -2
  29. package/dist/components/forms/DatePicker.js +37 -32
  30. package/dist/components/forms/FileUpload.js +39 -37
  31. package/dist/components/forms/Input.js +19 -18
  32. package/dist/components/forms/MultiSelect.js +9 -8
  33. package/dist/components/forms/Radio.js +6 -6
  34. package/dist/components/forms/SegmentedControl.d.ts +1 -1
  35. package/dist/components/forms/SegmentedControl.js +28 -11
  36. package/dist/components/forms/Select.js +9 -8
  37. package/dist/components/forms/Textarea.d.ts +13 -11
  38. package/dist/components/forms/Textarea.js +36 -16
  39. package/dist/components/forms/ToggleSwitch.js +9 -9
  40. package/dist/components/layout/AboutRamme.d.ts +8 -0
  41. package/dist/components/layout/Accordion.js +25 -32
  42. package/dist/components/layout/AppShell.js +7 -7
  43. package/dist/components/layout/Card.js +38 -21
  44. package/dist/components/layout/DetailDrawer.js +37 -38
  45. package/dist/components/layout/Drawer.js +50 -51
  46. package/dist/components/layout/List.js +9 -9
  47. package/dist/components/layout/Modal.js +5 -5
  48. package/dist/components/layout/PageHeader.js +7 -7
  49. package/dist/components/layout/SectionHeader.js +4 -4
  50. package/dist/components/layout/SettingsContainer.d.ts +12 -0
  51. package/dist/components/layout/SettingsContainer.js +30 -18
  52. package/dist/components/layout/Sheet.d.ts +58 -0
  53. package/dist/components/layout/Sheet.js +144 -0
  54. package/dist/components/layout/Sidebar.js +1 -1
  55. package/dist/components/layout/UserNav.d.ts +13 -0
  56. package/dist/components/layout/UserNav.js +17 -17
  57. package/dist/components/molecular/ConnectorOverlay.d.ts +12 -0
  58. package/dist/components/navigation/Breadcrumbs.js +8 -8
  59. package/dist/components/navigation/Menu.js +6 -6
  60. package/dist/components/navigation/MobileNav.d.ts +44 -1
  61. package/dist/components/navigation/MobileNav.js +97 -71
  62. package/dist/components/navigation/Pagination.js +46 -41
  63. package/dist/components/navigation/Stepper.js +17 -17
  64. package/dist/components/navigation/Tabs.js +18 -11
  65. package/dist/components/theme/ThemeLab.d.ts +7 -1
  66. package/dist/components/theme/ThemeLab.js +175 -154
  67. package/dist/components/ui/icon-loader.d.ts +1 -1
  68. package/dist/contexts/ThemeContext.js +111 -82
  69. package/dist/data/mockData.d.ts +0 -3
  70. package/dist/index.css +1 -1
  71. package/dist/index.d.ts +10 -0
  72. package/dist/index.js +222 -197
  73. package/dist/lib/hooks/useBodyScrollLock.d.ts +27 -0
  74. package/dist/lib/hooks/useBodyScrollLock.js +18 -0
  75. package/dist/lib/hooks/useSheetGesture.d.ts +81 -0
  76. package/dist/lib/hooks/useSheetGesture.js +70 -0
  77. package/dist/lib/theme/themeUtils.d.ts +21 -0
  78. package/dist/lib/theme/themeUtils.js +31 -17
  79. package/dist/setupTests.d.ts +1 -0
  80. package/dist/wizardManifest.js +364 -19
  81. package/package.json +10 -4
  82. package/src/wizardManifest.ts +364 -19
  83. package/tailwind.preset.js +98 -10
@@ -1,19 +1,39 @@
1
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import l from "react";
3
- const n = l.forwardRef(
4
- ({ label: r, className: a, containerClassName: o, ...e }, s) => /* @__PURE__ */ i("div", { className: `w-full ${o || ""}`, children: [
5
- r && /* @__PURE__ */ t("label", { htmlFor: e.id || e.name, className: "block text-sm font-medium text-text-light mb-1", children: r }),
6
- /* @__PURE__ */ t(
7
- "textarea",
8
- {
9
- ref: s,
10
- className: `w-full px-3 py-2 rounded-md bg-card border border-border transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary ${a || ""}`,
11
- ...e
12
- }
13
- )
14
- ] })
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import i from "react";
3
+ import { cn as o } from "../../utils/cn.js";
4
+ const p = i.forwardRef(
5
+ ({
6
+ label: r,
7
+ helperText: a,
8
+ error: d = !1,
9
+ required: t = !1,
10
+ showOptionalLabel: c = !1,
11
+ className: m,
12
+ containerClassName: f,
13
+ ...s
14
+ }, u) => {
15
+ const x = "w-full rounded-md border bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", b = d ? "border-destructive" : "border-input", g = i.useId(), l = s.id || s.name || g;
16
+ return /* @__PURE__ */ n("div", { className: o("w-full", f), children: [
17
+ r && /* @__PURE__ */ n("label", { htmlFor: l, className: "block text-sm font-medium text-foreground mb-1", children: [
18
+ r,
19
+ t && /* @__PURE__ */ e("span", { className: "text-destructive ml-1", children: "*" }),
20
+ !t && c && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground ml-1", children: "(optional)" })
21
+ ] }),
22
+ /* @__PURE__ */ e(
23
+ "textarea",
24
+ {
25
+ ref: u,
26
+ id: l,
27
+ className: o(x, b, m),
28
+ required: t,
29
+ ...s
30
+ }
31
+ ),
32
+ a && /* @__PURE__ */ e("p", { className: o("mt-1.5 text-xs", d ? "text-destructive" : "text-muted-foreground"), children: a })
33
+ ] });
34
+ }
15
35
  );
16
- n.displayName = "Textarea";
36
+ p.displayName = "Textarea";
17
37
  export {
18
- n as Textarea
38
+ p as Textarea
19
39
  };
@@ -1,16 +1,16 @@
1
1
  import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
2
  import m from "react";
3
3
  const d = ({
4
- checked: t,
4
+ checked: o,
5
5
  onChange: n,
6
6
  label: a,
7
7
  className: l,
8
- disabled: o = !1
8
+ disabled: t = !1
9
9
  }) => {
10
10
  const i = () => {
11
- o || n(!t);
11
+ t || n(!o);
12
12
  }, r = m.useId();
13
- return /* @__PURE__ */ s("label", { htmlFor: r, className: `flex items-center cursor-pointer ${l || ""} ${o ? "opacity-50 cursor-not-allowed" : ""}`, children: [
13
+ return /* @__PURE__ */ s("label", { htmlFor: r, className: `flex items-center cursor-pointer ${l || ""} ${t ? "opacity-50 cursor-not-allowed" : ""}`, children: [
14
14
  /* @__PURE__ */ s("div", { className: "relative", children: [
15
15
  /* @__PURE__ */ e(
16
16
  "input",
@@ -18,20 +18,20 @@ const d = ({
18
18
  id: r,
19
19
  type: "checkbox",
20
20
  className: "sr-only",
21
- checked: t,
21
+ checked: o,
22
22
  onChange: i,
23
- disabled: o
23
+ disabled: t
24
24
  }
25
25
  ),
26
- /* @__PURE__ */ e("div", { className: `block w-12 h-6 rounded-full transition-colors duration-200 ease-in-out ${t ? "bg-primary" : "bg-border"}` }),
26
+ /* @__PURE__ */ e("div", { className: `block w-12 h-6 rounded-full transition-colors duration-200 ease-in-out ${o ? "bg-primary" : "bg-border"}` }),
27
27
  /* @__PURE__ */ e(
28
28
  "div",
29
29
  {
30
- className: `dot absolute left-1 top-1 bg-white w-4 h-4 rounded-full shadow-sm transition-transform duration-200 ease-in-out ${t ? "translate-x-6" : ""}`
30
+ className: `dot absolute left-1 top-1 bg-white w-4 h-4 rounded-full shadow-sm transition-transform duration-200 ease-in-out ${o ? "translate-x-6" : ""}`
31
31
  }
32
32
  )
33
33
  ] }),
34
- /* @__PURE__ */ e("div", { className: "ml-3 text-text font-medium select-none", children: a })
34
+ /* @__PURE__ */ e("div", { className: "ml-3 text-foreground font-medium select-none", children: a })
35
35
  ] });
36
36
  };
37
37
  export {
@@ -1,4 +1,12 @@
1
1
  import React from 'react';
2
+ /**
3
+ * @wizard
4
+ * @name AboutRamme
5
+ * @description The "About" panel for a Settings Console — what the framework is, which packages make it up, and why it is built this way. Strategic purpose: ships the explanation with the framework so every product's about screen stays accurate as the architecture moves, instead of each one carrying a copy that goes stale. Takes no props; drop it into a settings tab.
6
+ * @tags layout, settings, about, documentation, panel
7
+ * @category layout
8
+ * @id about-ramme
9
+ */
2
10
  /**
3
11
  * AboutRamme — static informational panel for the Settings Console's "About" tab.
4
12
  * Describes the framework architecture, core packages, and business rationale.
@@ -1,52 +1,45 @@
1
- import { jsx as n, jsxs as m } from "react/jsx-runtime";
2
- import d, { useState as u, useCallback as f } from "react";
3
- const g = ({ id: e, header: r, children: i, isOpen: t, onToggle: a }) => {
4
- const [c, o] = u(t !== void 0 ? t : !1), s = t !== void 0, l = s ? t : c, h = f(() => {
5
- s && a ? a(e, !l) : o((v) => !v);
6
- }, [e, l, s, a]), p = `transform transition-transform duration-300 ${l ? "rotate-180" : "rotate-0"}`;
1
+ import { jsx as o, jsxs as m } from "react/jsx-runtime";
2
+ import c, { useState as f, useCallback as u } from "react";
3
+ const w = ({ id: e, header: n, children: l, isOpen: t, onToggle: s }) => {
4
+ const [d, r] = f(t !== void 0 ? t : !1), a = t !== void 0, i = a ? t : d, h = u(() => {
5
+ a && s ? s(e, !i) : r((g) => !g);
6
+ }, [e, i, a, s]), p = `transform transition-transform duration-300 ${i ? "rotate-180" : "rotate-0"}`;
7
7
  return /* @__PURE__ */ m("div", { className: "border border-border rounded-md overflow-hidden", children: [
8
- /* @__PURE__ */ m(
8
+ /* @__PURE__ */ o("h3", { className: "m-0", children: /* @__PURE__ */ m(
9
9
  "button",
10
10
  {
11
11
  id: `accordion-header-${e}`,
12
- "aria-expanded": l,
12
+ "aria-expanded": i,
13
13
  "aria-controls": `accordion-panel-${e}`,
14
14
  onClick: h,
15
- className: "flex items-center justify-between w-full p-4 text-text bg-background hover:bg-background/80 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",
16
- role: "heading",
17
- "aria-level": 3,
15
+ className: "flex items-center justify-between w-full p-4 text-left text-foreground bg-background hover:bg-background/80 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",
18
16
  children: [
19
- /* @__PURE__ */ n("span", { className: "text-xl font-semibold", children: r }),
20
- /* @__PURE__ */ n("svg", { className: `w-6 h-6 text-text ${p}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M19 9l-7 7-7-7" }) })
17
+ /* @__PURE__ */ o("span", { className: "text-xl font-semibold", children: n }),
18
+ /* @__PURE__ */ o("svg", { className: `w-6 h-6 text-foreground shrink-0 ${p}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ o("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M19 9l-7 7-7-7" }) })
21
19
  ]
22
20
  }
23
- ),
24
- /* @__PURE__ */ n(
21
+ ) }),
22
+ /* @__PURE__ */ o(
25
23
  "div",
26
24
  {
27
25
  id: `accordion-panel-${e}`,
28
26
  role: "region",
29
27
  "aria-labelledby": `accordion-header-${e}`,
30
- style: {
31
- maxHeight: l ? "1000px" : "0",
32
- // Arbitrary large height for transition
33
- overflow: "hidden",
34
- transition: "max-height 0.3s ease-in-out"
35
- },
36
- children: /* @__PURE__ */ n("div", { className: "p-4 bg-card", children: i })
28
+ className: `grid transition-[grid-template-rows] duration-300 ease-in-out ${i ? "grid-rows-[1fr]" : "grid-rows-[0fr]"}`,
29
+ children: /* @__PURE__ */ o("div", { className: "overflow-hidden min-h-0", children: /* @__PURE__ */ o("div", { className: "p-4 bg-card", children: l }) })
37
30
  }
38
31
  )
39
32
  ] });
40
- }, w = ({ children: e, singleOpen: r = !1, className: i }) => {
41
- const [t, a] = u(null), c = f((o, s) => {
42
- r && a(s ? o : null);
43
- }, [r]);
44
- return /* @__PURE__ */ n("div", { className: `space-y-4 ${i || ""}`, children: d.Children.map(e, (o) => d.isValidElement(o) ? d.cloneElement(o, {
45
- isOpen: r ? o.props.id === t : void 0,
46
- onToggle: r ? c : void 0
47
- }) : o) });
33
+ }, x = ({ children: e, singleOpen: n = !1, className: l }) => {
34
+ const [t, s] = f(null), d = u((r, a) => {
35
+ n && s(a ? r : null);
36
+ }, [n]);
37
+ return /* @__PURE__ */ o("div", { className: `space-y-4 ${l || ""}`, children: c.Children.map(e, (r) => c.isValidElement(r) ? c.cloneElement(r, {
38
+ isOpen: n ? r.props.id === t : void 0,
39
+ onToggle: n ? d : void 0
40
+ }) : r) });
48
41
  };
49
42
  export {
50
- w as Accordion,
51
- g as AccordionItem
43
+ x as Accordion,
44
+ w as AccordionItem
52
45
  };
@@ -6,9 +6,9 @@ import { useIsMobile as A } from "../../lib/hooks/useMediaQuery.js";
6
6
  const M = D.forwardRef(({
7
7
  className: p,
8
8
  layoutPreset: s = "dashboard",
9
- sidebarSlot: c,
10
- headerSlot: a,
11
- toolbarSlot: i,
9
+ sidebarSlot: a,
10
+ headerSlot: i,
11
+ toolbarSlot: c,
12
12
  statusbarSlot: d,
13
13
  inspectorSlot: w,
14
14
  onLogoTrigger: o,
@@ -36,15 +36,15 @@ const M = D.forwardRef(({
36
36
  {
37
37
  ref: C,
38
38
  className: x(
39
- "flex h-screen w-screen overflow-hidden bg-background text-foreground text-sm font-sans transition-colors duration-300",
39
+ "flex h-dvh w-full overflow-hidden bg-background text-foreground text-sm font-sans transition-colors duration-300",
40
40
  p
41
41
  ),
42
42
  ...z,
43
43
  children: [
44
- !l && c && /* @__PURE__ */ e("aside", { className: "w-sidebar flex-shrink-0 flex flex-col border-r border-border bg-card shadow-sm z-20", children: c }),
44
+ !l && a && /* @__PURE__ */ e("aside", { className: "w-sidebar flex-shrink-0 flex flex-col border-r border-border bg-card shadow-sm z-20", children: a }),
45
45
  /* @__PURE__ */ b("div", { className: "flex flex-col flex-1 min-w-0 h-full relative z-10", children: [
46
- !l && a && /* @__PURE__ */ e("header", { className: "h-header flex-shrink-0 w-full border-b border-border bg-background/80 backdrop-blur-md sticky top-0 z-30 flex items-center px-4", children: a }),
47
- !l && i && /* @__PURE__ */ e("div", { className: "h-toolbar flex-shrink-0 w-full border-b border-border bg-muted/30 flex items-center px-4 shadow-sm z-20", children: i }),
46
+ !l && i && /* @__PURE__ */ e("header", { className: "h-header flex-shrink-0 w-full border-b border-border bg-background/80 backdrop-blur-md sticky top-0 z-30 flex items-center px-4", children: i }),
47
+ !l && c && /* @__PURE__ */ e("div", { className: "h-toolbar flex-shrink-0 w-full border-b border-border bg-muted/30 flex items-center px-4 shadow-sm z-20", children: c }),
48
48
  /* @__PURE__ */ e("main", { className: x(
49
49
  "flex-1 overflow-y-auto custom-scrollbar relative @container",
50
50
  E ? "p-0" : "p-fluid-md @md:p-fluid-lg"
@@ -1,59 +1,76 @@
1
- import { jsx as d } from "react/jsx-runtime";
1
+ import { jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as t } from "react";
3
3
  import { cn as s } from "../../utils/cn.js";
4
4
  const l = t(
5
- ({ className: e, children: a, ...r }, o) => /* @__PURE__ */ d(
5
+ ({ className: e, children: a, ...d }, o) => /* @__PURE__ */ r(
6
6
  "div",
7
7
  {
8
8
  ref: o,
9
9
  className: s(
10
- "@container bg-card text-card-foreground rounded-lg border border-border shadow-sm",
10
+ "@container bg-card text-card-foreground",
11
+ /* A card in a narrow container is chrome restating chrome: its border
12
+ sits a few pixels inside the panel's own edge, and its radius and
13
+ shadow buy nothing at 390px while its inset costs real width. So
14
+ below a 28rem container the card keeps its surface and drops the
15
+ frame — the rule above it still groups, the box no longer taxes.
16
+
17
+ A CONTAINER query, not a breakpoint: this asks how much room the
18
+ card actually has, so the same card is framed in a wide dashboard
19
+ column and flush inside a sheet or a narrow sidebar on that very
20
+ same screen. A `sm:` breakpoint would get the narrow-panel-on-a-
21
+ big-monitor case exactly backwards.
22
+
23
+ 28rem, not 24rem: inside a sheet a 390px phone gives the card a
24
+ ~358px container, but a 430px phone gives ~398px — over 24rem, so
25
+ the frame would come back on the LARGER phone. 28rem clears every
26
+ handset while leaving real desktop columns framed. */
27
+ "border-y border-border @md:rounded-lg @md:border @md:shadow-sm",
11
28
  e
12
29
  ),
13
- ...r,
30
+ ...d,
14
31
  children: a
15
32
  }
16
33
  )
17
34
  );
18
35
  l.displayName = "Card";
19
36
  const i = t(
20
- ({ className: e, ...a }, r) => /* @__PURE__ */ d(
37
+ ({ className: e, ...a }, d) => /* @__PURE__ */ r(
21
38
  "div",
22
39
  {
23
- ref: r,
40
+ ref: d,
24
41
  className: s("flex flex-col space-y-fluid-xs p-fluid-lg", e),
25
42
  ...a
26
43
  }
27
44
  )
28
45
  );
29
46
  i.displayName = "CardHeader";
30
- const n = t(
31
- ({ className: e, ...a }, r) => /* @__PURE__ */ d(
47
+ const m = t(
48
+ ({ className: e, ...a }, d) => /* @__PURE__ */ r(
32
49
  "h3",
33
50
  {
34
- ref: r,
51
+ ref: d,
35
52
  className: s("text-fluid-lg font-semibold leading-none tracking-tight", e),
36
53
  ...a
37
54
  }
38
55
  )
39
56
  );
40
- n.displayName = "CardTitle";
41
- const m = t(
42
- ({ className: e, ...a }, r) => /* @__PURE__ */ d(
57
+ m.displayName = "CardTitle";
58
+ const n = t(
59
+ ({ className: e, ...a }, d) => /* @__PURE__ */ r(
43
60
  "p",
44
61
  {
45
- ref: r,
62
+ ref: d,
46
63
  className: s("text-fluid-sm text-muted-foreground", e),
47
64
  ...a
48
65
  }
49
66
  )
50
67
  );
51
- m.displayName = "CardDescription";
68
+ n.displayName = "CardDescription";
52
69
  const c = t(
53
- ({ className: e, ...a }, r) => /* @__PURE__ */ d(
70
+ ({ className: e, ...a }, d) => /* @__PURE__ */ r(
54
71
  "h2",
55
72
  {
56
- ref: r,
73
+ ref: d,
57
74
  className: s(
58
75
  "text-xs font-semibold uppercase tracking-widest text-muted-foreground flex items-center gap-1.5",
59
76
  e
@@ -64,14 +81,14 @@ const c = t(
64
81
  );
65
82
  c.displayName = "CardLabel";
66
83
  const p = t(
67
- ({ className: e, ...a }, r) => /* @__PURE__ */ d("div", { ref: r, className: s("p-fluid-lg pt-0", e), ...a })
84
+ ({ className: e, ...a }, d) => /* @__PURE__ */ r("div", { ref: d, className: s("p-fluid-lg pt-0", e), ...a })
68
85
  );
69
86
  p.displayName = "CardContent";
70
87
  const f = t(
71
- ({ className: e, ...a }, r) => /* @__PURE__ */ d(
88
+ ({ className: e, ...a }, d) => /* @__PURE__ */ r(
72
89
  "div",
73
90
  {
74
- ref: r,
91
+ ref: d,
75
92
  className: s("flex items-center p-fluid-lg pt-0", e),
76
93
  ...a
77
94
  }
@@ -81,9 +98,9 @@ f.displayName = "CardFooter";
81
98
  export {
82
99
  l as Card,
83
100
  p as CardContent,
84
- m as CardDescription,
101
+ n as CardDescription,
85
102
  f as CardFooter,
86
103
  i as CardHeader,
87
104
  c as CardLabel,
88
- n as CardTitle
105
+ m as CardTitle
89
106
  };
@@ -1,56 +1,55 @@
1
1
  import { jsxs as b, jsx as r, Fragment as k } from "react/jsx-runtime";
2
- import { useRef as E, useEffect as c } from "react";
3
- import { createPortal as D } from "react-dom";
4
- import { Icon as L } from "../ui/Icon.js";
2
+ import { useRef as E, useEffect as y } from "react";
3
+ import { createPortal as L } from "react-dom";
4
+ import { Icon as D } from "../ui/Icon.js";
5
5
  import { cn as h } from "../../utils/cn.js";
6
- const S = ({
7
- isOpen: o,
6
+ import { useBodyScrollLock as M } from "../../lib/hooks/useBodyScrollLock.js";
7
+ const B = ({
8
+ isOpen: t,
8
9
  onClose: n,
9
- children: g,
10
- variant: s = "overlay",
11
- resizable: u = !1,
12
- width: p = 420,
10
+ children: p,
11
+ variant: u = "overlay",
12
+ resizable: d = !1,
13
+ width: g = 420,
13
14
  onWidthChange: a,
14
- minWidth: m = 320,
15
- maxWidth: f = typeof window < "u" ? window.innerWidth * 0.6 : 800,
16
- side: t = "right"
15
+ minWidth: c = 320,
16
+ maxWidth: m = typeof window < "u" ? window.innerWidth * 0.6 : 800,
17
+ side: o = "right"
17
18
  }) => {
18
19
  const i = E(!1);
19
- if (c(() => {
20
- if (!u || !a) return;
21
- const e = (y) => {
20
+ if (y(() => {
21
+ if (!d || !a) return;
22
+ const e = (v) => {
22
23
  if (!i.current) return;
23
- const x = t === "right" ? window.innerWidth - y.clientX : y.clientX;
24
- a(Math.max(m, Math.min(f, x)));
25
- }, d = () => {
24
+ const x = o === "right" ? window.innerWidth - v.clientX : v.clientX;
25
+ a(Math.max(c, Math.min(m, x)));
26
+ }, s = () => {
26
27
  i.current && (i.current = !1, document.body.style.userSelect = "", document.body.style.cursor = "");
27
28
  };
28
- return window.addEventListener("mousemove", e), window.addEventListener("mouseup", d), () => {
29
- window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", d);
29
+ return window.addEventListener("mousemove", e), window.addEventListener("mouseup", s), () => {
30
+ window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", s);
30
31
  };
31
- }, [u, a, m, f, t]), c(() => {
32
- const e = (d) => {
33
- d.key === "Escape" && o && n();
32
+ }, [d, a, c, m, o]), y(() => {
33
+ const e = (s) => {
34
+ s.key === "Escape" && t && n();
34
35
  };
35
36
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
36
- }, [o, n]), c(() => (o && s === "overlay" ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
37
- document.body.style.overflow = "";
38
- }), [o, s]), !o) return null;
39
- const l = s === "overlay", w = t === "right" ? "right-0 border-l" : "left-0 border-r", v = /* @__PURE__ */ b(
37
+ }, [t, n]), M(t && u === "overlay"), !t) return null;
38
+ const l = u === "overlay", f = o === "right" ? "right-0 border-l" : "left-0 border-r", w = /* @__PURE__ */ b(
40
39
  "div",
41
40
  {
42
41
  className: h(
43
42
  "flex flex-col border-border bg-card shadow-2xl transition-transform duration-300",
44
- l ? `fixed inset-y-0 ${w} z-50 w-full sm:w-[420px] animate-in ${t === "right" ? "slide-in-from-right" : "slide-in-from-left"}` : `relative h-full flex-shrink-0 ${w}`
43
+ l ? `fixed inset-y-0 ${f} z-drawer w-full sm:w-[420px] animate-in ${o === "right" ? "slide-in-from-right" : "slide-in-from-left"}` : `relative h-full flex-shrink-0 ${f}`
45
44
  ),
46
- style: l ? void 0 : { width: `min(100vw, ${p}px)` },
45
+ style: l ? void 0 : { width: `min(100vw, ${g}px)` },
47
46
  children: [
48
- u && !l && /* @__PURE__ */ r(
47
+ d && !l && /* @__PURE__ */ r(
49
48
  "div",
50
49
  {
51
50
  className: h(
52
51
  "absolute top-0 bottom-0 w-1.5 cursor-col-resize hover:bg-primary/50 active:bg-primary z-10",
53
- t === "right" ? "left-0 -ml-0.5" : "right-0 -mr-0.5"
52
+ o === "right" ? "left-0 -ml-0.5" : "right-0 -mr-0.5"
54
53
  ),
55
54
  onMouseDown: (e) => {
56
55
  e.preventDefault(), i.current = !0, document.body.style.userSelect = "none", document.body.style.cursor = "col-resize";
@@ -63,27 +62,27 @@ const S = ({
63
62
  onClick: n,
64
63
  className: "rounded-full p-1.5 bg-background/50 backdrop-blur hover:bg-muted text-muted-foreground hover:text-foreground transition-all shadow-sm border border-border",
65
64
  "aria-label": "Close",
66
- children: /* @__PURE__ */ r(L, { name: "x", size: 16 })
65
+ children: /* @__PURE__ */ r(D, { name: "x", size: 16 })
67
66
  }
68
67
  ) }),
69
- /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto custom-scrollbar relative h-full", children: g })
68
+ /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto custom-scrollbar relative h-full", children: p })
70
69
  ]
71
70
  }
72
71
  );
73
- return l ? typeof document > "u" ? null : D(
72
+ return l ? typeof document > "u" ? null : L(
74
73
  /* @__PURE__ */ b(k, { children: [
75
74
  /* @__PURE__ */ r(
76
75
  "div",
77
76
  {
78
- className: "fixed inset-0 z-40 bg-background/80 backdrop-blur-sm transition-opacity",
77
+ className: "fixed inset-0 z-scrim bg-background/80 backdrop-blur-sm transition-opacity",
79
78
  onClick: n
80
79
  }
81
80
  ),
82
- v
81
+ w
83
82
  ] }),
84
83
  document.body
85
- ) : v;
84
+ ) : w;
86
85
  };
87
86
  export {
88
- S as DetailDrawer
87
+ B as DetailDrawer
89
88
  };
@@ -1,27 +1,28 @@
1
- import { jsx as o, jsxs as b } from "react/jsx-runtime";
2
- import { useState as g, useRef as z, useCallback as s, useEffect as c } from "react";
3
- import { createPortal as F } from "react-dom";
4
- import { Icon as L } from "../ui/Icon.js";
5
- import { cn as p } from "../../utils/cn.js";
6
- const A = {
1
+ import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
+ import { useState as p, useRef as L, useCallback as s, useEffect as y } from "react";
3
+ import { createPortal as z } from "react-dom";
4
+ import { Icon as F } from "../ui/Icon.js";
5
+ import { cn as g } from "../../utils/cn.js";
6
+ import { useBodyScrollLock as A } from "../../lib/hooks/useBodyScrollLock.js";
7
+ const P = {
7
8
  sm: "320px",
8
9
  md: "480px",
9
10
  lg: "640px",
10
11
  xl: "80vw",
11
12
  full: "100vw"
12
- }, V = ({
13
- isOpen: t,
14
- onClose: l,
13
+ }, W = ({
14
+ isOpen: o,
15
+ onClose: n,
15
16
  children: v,
16
- footer: f,
17
- position: n = "right",
18
- size: u = "md",
17
+ footer: d,
18
+ position: l = "right",
19
+ size: f = "md",
19
20
  title: m,
20
21
  className: k,
21
- overlayDismiss: h = !0
22
+ overlayDismiss: u = !0
22
23
  }) => {
23
- const [i, x] = g(!1), [w, y] = g(!1), d = z(null), C = (e) => A[e] || e, E = s(() => {
24
- switch (n) {
24
+ const [i, x] = p(!1), [h, w] = p(!1), c = L(null), S = (e) => P[e] || e, C = s(() => {
25
+ switch (l) {
25
26
  case "left":
26
27
  return { from: "-translate-x-full", to: "translate-x-0", positionClass: "left-0 top-0 h-full" };
27
28
  case "right":
@@ -33,62 +34,60 @@ const A = {
33
34
  default:
34
35
  return { from: "translate-x-full", to: "translate-x-0", positionClass: "right-0 top-0 h-full" };
35
36
  }
36
- }, [n]), S = s(() => {
37
- const e = {}, r = C(u);
38
- return n === "left" || n === "right" ? (e.width = r, e.maxWidth = "100dvw") : (e.height = r, e.maxHeight = "100dvh"), e;
39
- }, [n, u]), { from: N, to: T, positionClass: R } = E(), I = S();
40
- c(() => (t ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
41
- document.body.style.overflow = "";
42
- }), [t]), c(() => {
43
- let e, r;
44
- return t ? (x(!0), e = requestAnimationFrame(() => {
45
- r = window.setTimeout(() => y(!0), 10);
46
- })) : (y(!1), r = window.setTimeout(() => x(!1), 500)), () => {
47
- cancelAnimationFrame(e), clearTimeout(r);
37
+ }, [l]), E = s(() => {
38
+ const e = {}, t = S(f);
39
+ return l === "left" || l === "right" ? (e.width = t, e.maxWidth = "100dvw") : (e.height = t, e.maxHeight = "100dvh"), e;
40
+ }, [l, f]), { from: N, to: T, positionClass: R } = C(), j = E();
41
+ A(o), y(() => {
42
+ let e, t;
43
+ return o ? (x(!0), e = requestAnimationFrame(() => {
44
+ t = window.setTimeout(() => w(!0), 10);
45
+ })) : (w(!1), t = window.setTimeout(() => x(!1), 500)), () => {
46
+ cancelAnimationFrame(e), clearTimeout(t);
48
47
  };
49
- }, [t]);
50
- const j = s((e) => {
51
- h && d.current && !d.current.contains(e.target) && l();
52
- }, [l, h]), a = s((e) => {
53
- e.key === "Escape" && t && l();
54
- }, [t, l]);
55
- return c(() => (i ? document.addEventListener("keydown", a) : document.removeEventListener("keydown", a), () => document.removeEventListener("keydown", a)), [i, a]), i ? F(
56
- /* @__PURE__ */ o(
48
+ }, [o]);
49
+ const I = s((e) => {
50
+ u && c.current && !c.current.contains(e.target) && n();
51
+ }, [n, u]), a = s((e) => {
52
+ e.key === "Escape" && o && n();
53
+ }, [o, n]);
54
+ return y(() => (i ? document.addEventListener("keydown", a) : document.removeEventListener("keydown", a), () => document.removeEventListener("keydown", a)), [i, a]), i ? z(
55
+ /* @__PURE__ */ r(
57
56
  "div",
58
57
  {
59
- className: p(
60
- "fixed inset-0 z-50 flex transition-opacity duration-500 ease-in-out",
61
- w ? "opacity-100" : "opacity-0",
58
+ className: g(
59
+ "fixed inset-0 z-drawer flex transition-opacity duration-500 ease-in-out",
60
+ h ? "opacity-100" : "opacity-0",
62
61
  "bg-black/50"
63
62
  ),
64
- onClick: j,
63
+ onClick: I,
65
64
  children: /* @__PURE__ */ b(
66
65
  "div",
67
66
  {
68
- ref: d,
69
- style: I,
70
- className: p(
67
+ ref: c,
68
+ style: j,
69
+ className: g(
71
70
  "fixed bg-card border-border text-foreground shadow-xl flex flex-col",
72
71
  "transform transition-transform duration-500 ease-out",
73
72
  R,
74
- w ? T : N,
73
+ h ? T : N,
75
74
  k
76
75
  ),
77
76
  children: [
78
77
  /* @__PURE__ */ b("div", { className: "flex justify-between items-center p-4 border-b border-border flex-shrink-0", children: [
79
- m && /* @__PURE__ */ o("h3", { className: "text-xl font-semibold", children: m }),
80
- /* @__PURE__ */ o(
78
+ m && /* @__PURE__ */ r("h3", { className: "text-xl font-semibold", children: m }),
79
+ /* @__PURE__ */ r(
81
80
  "button",
82
81
  {
83
- onClick: l,
84
- className: "text-muted-foreground hover:text-foreground transition-colors",
82
+ onClick: n,
83
+ className: "-mr-2 inline-flex min-h-11 min-w-11 items-center justify-center text-muted-foreground hover:text-foreground transition-colors",
85
84
  "aria-label": "Close drawer",
86
- children: /* @__PURE__ */ o(L, { name: "x", size: 24 })
85
+ children: /* @__PURE__ */ r(F, { name: "x", size: 24 })
87
86
  }
88
87
  )
89
88
  ] }),
90
- /* @__PURE__ */ o("div", { className: "flex-grow p-4 overflow-y-auto", children: v }),
91
- f && /* @__PURE__ */ o("div", { className: "p-4 border-t border-border flex-shrink-0 bg-card", children: f })
89
+ /* @__PURE__ */ r("div", { className: "flex-grow p-4 overflow-y-auto overscroll-contain", children: v }),
90
+ d && /* @__PURE__ */ r("div", { className: "p-4 border-t border-border flex-shrink-0 bg-card", children: d })
92
91
  ]
93
92
  }
94
93
  )
@@ -98,5 +97,5 @@ const A = {
98
97
  ) : null;
99
98
  };
100
99
  export {
101
- V as Drawer
100
+ W as Drawer
102
101
  };