@alea-design/ui 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +2 -2
  2. package/dist/components/accordion/Accordion.js +29 -0
  3. package/dist/components/ai/AI.d.ts +5 -1
  4. package/dist/components/ai/AI.js +187 -0
  5. package/dist/components/app/AppParts.d.ts +16 -4
  6. package/dist/components/app/AppParts.js +134 -0
  7. package/dist/components/button/Button.d.ts +1 -1
  8. package/dist/components/button/Button.js +137 -0
  9. package/dist/components/button/Groups.d.ts +1 -1
  10. package/dist/components/button/Groups.js +112 -0
  11. package/dist/components/card/Card.d.ts +3 -2
  12. package/dist/components/card/Card.js +47 -0
  13. package/dist/components/chat/Chat.d.ts +4 -2
  14. package/dist/components/chat/Chat.js +275 -0
  15. package/dist/components/choice/Choice.js +69 -0
  16. package/dist/components/color/Color.d.ts +3 -3
  17. package/dist/components/color/Color.js +98 -0
  18. package/dist/components/combobox/Autocomplete.d.ts +5 -5
  19. package/dist/components/combobox/Autocomplete.js +126 -0
  20. package/dist/components/combobox/ComboBox.d.ts +4 -4
  21. package/dist/components/combobox/ComboBox.js +112 -0
  22. package/dist/components/combobox/Highlight.js +50 -0
  23. package/dist/components/command/CommandPalette.d.ts +10 -3
  24. package/dist/components/command/CommandPalette.js +56 -0
  25. package/dist/components/content/Content.d.ts +1 -1
  26. package/dist/components/content/Content.js +125 -0
  27. package/dist/components/data/Data.js +79 -0
  28. package/dist/components/date/Date.js +109 -0
  29. package/dist/components/display/Display.d.ts +5 -3
  30. package/dist/components/display/Display.js +89 -0
  31. package/dist/components/display/Display2.d.ts +3 -1
  32. package/dist/components/display/Display2.js +75 -0
  33. package/dist/components/emoji/EmojiPicker.js +52 -0
  34. package/dist/components/emoji/emoji-data.js +27 -0
  35. package/dist/components/extras/CodeSteps.d.ts +1 -0
  36. package/dist/components/extras/CodeSteps.js +19 -0
  37. package/dist/components/extras/Extras.d.ts +1 -1
  38. package/dist/components/extras/Extras.js +116 -0
  39. package/dist/components/feedback/Feedback.d.ts +11 -8
  40. package/dist/components/feedback/Feedback.js +185 -0
  41. package/dist/components/feedback/Spinner.js +18 -0
  42. package/dist/components/feedback/Status.d.ts +6 -2
  43. package/dist/components/feedback/Status.js +48 -0
  44. package/dist/components/field/Field.d.ts +1 -1
  45. package/dist/components/field/Field.js +187 -0
  46. package/dist/components/field/FieldLoading.d.ts +1 -1
  47. package/dist/components/field/FieldLoading.js +18 -0
  48. package/dist/components/filter/FilterBar.js +96 -0
  49. package/dist/components/form/Form.d.ts +5 -5
  50. package/dist/components/form/Form.js +53 -0
  51. package/dist/components/icon/Icon.d.ts +2 -2
  52. package/dist/components/icon/Icon.js +66 -0
  53. package/dist/components/icon/icon-cells.js +39 -0
  54. package/dist/components/icon/icon-contexts.d.ts +1 -1
  55. package/dist/components/icon/icon-contexts.js +38 -0
  56. package/dist/components/icon/icon-names.d.ts +1 -1
  57. package/dist/components/icon/icon-names.js +376 -0
  58. package/dist/components/layout/Bento.d.ts +1 -1
  59. package/dist/components/layout/Bento.js +38 -0
  60. package/dist/components/layout/Layout.d.ts +1 -1
  61. package/dist/components/layout/Layout.js +54 -0
  62. package/dist/components/layout/Layout2.d.ts +36 -6
  63. package/dist/components/layout/Layout2.js +105 -0
  64. package/dist/components/layout/Layout3.js +35 -0
  65. package/dist/components/layout/Responsive.d.ts +1 -1
  66. package/dist/components/layout/Responsive.js +32 -0
  67. package/dist/components/list/List.d.ts +3 -2
  68. package/dist/components/list/List.js +82 -0
  69. package/dist/components/list/Lists2.d.ts +6 -4
  70. package/dist/components/list/Lists2.js +60 -0
  71. package/dist/components/media/Media.d.ts +8 -4
  72. package/dist/components/media/Media.js +188 -0
  73. package/dist/components/menu/Menu.d.ts +23 -12
  74. package/dist/components/menu/Menu.js +68 -0
  75. package/dist/components/more/More.d.ts +7 -7
  76. package/dist/components/more/More.js +182 -0
  77. package/dist/components/navigation/Navbar.d.ts +1 -1
  78. package/dist/components/navigation/Navbar.js +27 -0
  79. package/dist/components/navigation/Navigation.js +121 -0
  80. package/dist/components/navigation/Navigation2.d.ts +6 -2
  81. package/dist/components/navigation/Navigation2.js +355 -0
  82. package/dist/components/overlay/Drawer.d.ts +11 -6
  83. package/dist/components/overlay/Drawer.js +39 -0
  84. package/dist/components/overlay/Modal.d.ts +6 -3
  85. package/dist/components/overlay/Modal.js +27 -0
  86. package/dist/components/overlay/Overlay.d.ts +14 -9
  87. package/dist/components/overlay/Overlay.js +76 -0
  88. package/dist/components/overlay/Sheet.d.ts +11 -5
  89. package/dist/components/overlay/Sheet.js +52 -0
  90. package/dist/components/page/Page.d.ts +5 -5
  91. package/dist/components/page/Page.js +132 -0
  92. package/dist/components/page/PageParts.d.ts +5 -5
  93. package/dist/components/page/PageParts.js +109 -0
  94. package/dist/components/picker/Picker.d.ts +11 -11
  95. package/dist/components/picker/Picker.js +294 -0
  96. package/dist/components/picker/Wheel.js +132 -0
  97. package/dist/components/rating/Rating.d.ts +2 -1
  98. package/dist/components/rating/Rating.js +66 -0
  99. package/dist/components/select/Select.d.ts +8 -6
  100. package/dist/components/select/Select.js +146 -0
  101. package/dist/components/shell/AppShell.d.ts +3 -3
  102. package/dist/components/shell/AppShell.js +56 -0
  103. package/dist/components/shell/AppSidebar.d.ts +5 -5
  104. package/dist/components/shell/AppSidebar.js +62 -0
  105. package/dist/components/slider/Slider.d.ts +2 -1
  106. package/dist/components/slider/Slider.js +36 -0
  107. package/dist/components/surface/Surface.d.ts +16 -0
  108. package/dist/components/surface/Surface.js +7 -0
  109. package/dist/components/table/Table.d.ts +4 -3
  110. package/dist/components/table/Table.js +58 -0
  111. package/dist/components/tabs/Tabs.d.ts +1 -0
  112. package/dist/components/tabs/Tabs.js +120 -0
  113. package/dist/components/theme/Theme.d.ts +11 -6
  114. package/dist/components/theme/Theme.js +186 -0
  115. package/dist/components/theme/lens.js +104 -0
  116. package/dist/components/tree/Tree.js +303 -0
  117. package/dist/components/typography/Typography.js +43 -0
  118. package/dist/components/upload/Upload.js +71 -0
  119. package/dist/components/work/Ops.js +24 -0
  120. package/dist/components/work/Work.d.ts +4 -2
  121. package/dist/components/work/Work.js +241 -0
  122. package/dist/css/accordion.css +1 -0
  123. package/dist/css/ai.css +1 -0
  124. package/dist/css/app.css +1 -0
  125. package/dist/css/base.css +1 -0
  126. package/dist/css/button.css +1 -0
  127. package/dist/css/card.css +1 -0
  128. package/dist/css/chat.css +1 -0
  129. package/dist/css/choice.css +1 -0
  130. package/dist/css/color.css +1 -0
  131. package/dist/css/combobox.css +1 -0
  132. package/dist/css/command.css +1 -0
  133. package/dist/css/content.css +1 -0
  134. package/dist/css/data.css +1 -0
  135. package/dist/css/date.css +1 -0
  136. package/dist/css/display.css +1 -0
  137. package/dist/css/emoji.css +1 -0
  138. package/dist/css/extras.css +1 -0
  139. package/dist/css/feedback.css +1 -0
  140. package/dist/css/field.css +1 -0
  141. package/dist/css/filter.css +1 -0
  142. package/dist/css/form.css +1 -0
  143. package/dist/css/groups.json +346 -0
  144. package/dist/css/icon.css +1 -0
  145. package/dist/css/layout.css +1 -0
  146. package/dist/css/list.css +1 -0
  147. package/dist/css/media.css +1 -0
  148. package/dist/css/menu.css +1 -0
  149. package/dist/css/more.css +1 -0
  150. package/dist/css/navigation.css +1 -0
  151. package/dist/css/overlay.css +1 -0
  152. package/dist/css/page.css +1 -0
  153. package/dist/css/picker.css +1 -0
  154. package/dist/css/rating.css +1 -0
  155. package/dist/css/select.css +1 -0
  156. package/dist/css/shell.css +1 -0
  157. package/dist/css/slider.css +1 -0
  158. package/dist/css/surface.css +1 -0
  159. package/dist/css/table.css +1 -0
  160. package/dist/css/tabs.css +1 -0
  161. package/dist/css/tree.css +1 -0
  162. package/dist/css/typography.css +1 -0
  163. package/dist/css/upload.css +1 -0
  164. package/dist/css/work.css +1 -0
  165. package/dist/i18n/strings.js +842 -0
  166. package/dist/index.d.ts +71 -70
  167. package/dist/index.js +398 -7436
  168. package/dist/styles.css +1 -1
  169. package/dist/utils/Blueprint.js +131 -0
  170. package/dist/utils/DotField.js +32 -0
  171. package/dist/utils/attr.d.ts +1 -1
  172. package/dist/utils/attr.js +18 -0
  173. package/dist/utils/blueprintScene.js +161 -0
  174. package/dist/utils/controlled.js +11 -0
  175. package/dist/utils/cx.js +11 -0
  176. package/dist/utils/inert.js +9 -0
  177. package/dist/utils/refs.d.ts +3 -0
  178. package/dist/utils/refs.js +11 -0
  179. package/dist/utils/responsive.js +12 -0
  180. package/dist/utils/scrollEdges.js +31 -0
  181. package/dist/utils/space.js +10 -0
  182. package/dist/utils/vocabulary.d.ts +6 -0
  183. package/dist/utils/vocabulary.js +17 -0
  184. package/package.json +12 -8
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type CSSProperties } from 'react';
2
2
  import { type SheetTriggerProps } from 'react-aria-components';
3
3
  export interface SheetProps {
4
4
  /** Where the sheet comes from: bottom (default, phones), top, start, end or center. */
@@ -21,9 +21,11 @@ export interface SheetProps {
21
21
  children?: ReactNode;
22
22
  /** Extra class names for the sheet. */
23
23
  className?: string;
24
+ /** Inline style for the sheet. */
25
+ style?: CSSProperties;
24
26
  }
25
27
  /** A panel that slides in from an edge and follows the finger: swipe it away, or drag it between snap points. Built for phones; on desktop it works like a drawer. */
26
- export declare function Sheet({ position, snapPoints, preventDismissal, title, description, footer, hideHandle, children, className, 'aria-label': label }: SheetProps): import("react").JSX.Element;
28
+ export declare const Sheet: import("react").ForwardRefExoticComponent<SheetProps & import("react").RefAttributes<HTMLDivElement>>;
27
29
  /** Opens a Sheet: put the trigger (a Button) first, then the Sheet. */
28
30
  export declare function SheetTrigger(props: SheetTriggerProps): import("react").JSX.Element;
29
31
  export interface ActionSheetAction {
@@ -31,7 +33,7 @@ export interface ActionSheetAction {
31
33
  label: ReactNode;
32
34
  icon?: ReactNode;
33
35
  description?: ReactNode;
34
- tone?: 'default' | 'danger';
36
+ tone?: 'neutral' | 'danger' | /** @deprecated Use neutral. */ 'default';
35
37
  isDisabled?: boolean;
36
38
  onAction?: () => void;
37
39
  }
@@ -42,7 +44,7 @@ export interface ActionSheetProps {
42
44
  title?: ReactNode;
43
45
  /** A line under the title. */
44
46
  description?: ReactNode;
45
- /** The actions, top to bottom: each has an id, a label and an optional icon, description, tone (default or danger), isDisabled and onAction. Each one closes the sheet. */
47
+ /** The actions, top to bottom: each has an id, a label and an optional icon, description, tone (neutral or danger), isDisabled and onAction. Each one closes the sheet. */
46
48
  actions: ActionSheetAction[];
47
49
  /** The text of the cancel button. Default "Cancel". */
48
50
  cancelLabel?: ReactNode;
@@ -50,6 +52,10 @@ export interface ActionSheetProps {
50
52
  isOpen?: boolean;
51
53
  /** Called when it opens or closes. */
52
54
  onOpenChange?: (open: boolean) => void;
55
+ /** Extra class names for the sheet. */
56
+ className?: string;
57
+ /** Inline style for the sheet. */
58
+ style?: CSSProperties;
53
59
  }
54
60
  /** A list of actions in a bottom sheet, with Cancel apart: Share, Duplicate, Delete. The phone way to show a short menu. */
55
- export declare function ActionSheet({ trigger, title, description, actions, cancelLabel, isOpen, onOpenChange }: ActionSheetProps): import("react").JSX.Element;
61
+ export declare const ActionSheet: import("react").ForwardRefExoticComponent<ActionSheetProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import { jsxs as l, jsx as a } from "react/jsx-runtime";
3
+ import { forwardRef as p, useContext as x } from "react";
4
+ import { SheetTrigger as f, SheetOverlay as y, SheetBackdrop as A, Sheet as T, SheetContent as C, Heading as j, OverlayTriggerStateContext as k, Button as u } from "react-aria-components";
5
+ import { useStrings as S } from "../../i18n/strings.js";
6
+ import { cx as g } from "../../utils/cx.js";
7
+ const B = p(function({ position: s = "bottom", snapPoints: c, preventDismissal: t, title: e, description: n, footer: o, hideHandle: r, children: h, className: d, style: m, "aria-label": N }, b) {
8
+ const v = !r && (s === "bottom" || s === "top");
9
+ return /* @__PURE__ */ l(y, { position: s, snapPoints: c, preventDismissal: t, className: "alea-sheet-overlay", "data-position": s, children: [
10
+ /* @__PURE__ */ a(A, { className: "alea-sheet-backdrop" }),
11
+ /* @__PURE__ */ a(T, { ref: b, className: g("alea-sheet", d), style: m, "data-position": s, children: /* @__PURE__ */ l(C, { className: "alea-sheet-content", "aria-label": e ? void 0 : N, children: [
12
+ v && /* @__PURE__ */ a("span", { className: "alea-sheet-handle", "aria-hidden": "true" }),
13
+ (e || n) && /* @__PURE__ */ l("header", { className: "alea-sheet-head", children: [
14
+ e && /* @__PURE__ */ a(j, { slot: "title", className: "alea-sheet-title", children: e }),
15
+ n && /* @__PURE__ */ a("p", { className: "alea-sheet-desc", children: n })
16
+ ] }),
17
+ /* @__PURE__ */ a("div", { className: "alea-sheet-body", children: h }),
18
+ o && /* @__PURE__ */ a("footer", { className: "alea-sheet-foot", children: o })
19
+ ] }) })
20
+ ] });
21
+ });
22
+ function L(i) {
23
+ return /* @__PURE__ */ a(f, { ...i });
24
+ }
25
+ function D({ actions: i, cancelLabel: s }) {
26
+ const c = S(), t = x(k);
27
+ return /* @__PURE__ */ l("div", { className: "alea-action-sheet-body", children: [
28
+ /* @__PURE__ */ a("ul", { className: "alea-action-sheet-list", children: i.map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ l(u, { className: "alea-action-sheet-item alea-focus-ring", "data-tone": e.tone, isDisabled: e.isDisabled, onPress: () => {
29
+ var n;
30
+ t == null || t.close(), (n = e.onAction) == null || n.call(e);
31
+ }, children: [
32
+ e.icon && /* @__PURE__ */ a("span", { className: "alea-action-sheet-icon", "aria-hidden": "true", children: e.icon }),
33
+ /* @__PURE__ */ l("span", { className: "alea-action-sheet-text", children: [
34
+ /* @__PURE__ */ a("span", { children: e.label }),
35
+ e.description && /* @__PURE__ */ a("span", { className: "alea-action-sheet-desc", children: e.description })
36
+ ] })
37
+ ] }) }, e.id)) }),
38
+ /* @__PURE__ */ a(u, { className: "alea-action-sheet-item alea-action-sheet-cancel alea-focus-ring", onPress: () => t == null ? void 0 : t.close(), children: s ?? c.cancel })
39
+ ] });
40
+ }
41
+ const R = p(function({ trigger: s, title: c, description: t, actions: e, cancelLabel: n, isOpen: o, onOpenChange: r, className: h, style: d }, m) {
42
+ const N = S();
43
+ return /* @__PURE__ */ l(f, { isOpen: o, onOpenChange: r, children: [
44
+ s,
45
+ /* @__PURE__ */ a(B, { ref: m, style: d, title: c, description: t, "aria-label": typeof c == "string" ? void 0 : N.options, className: g("alea-action-sheet", h), children: /* @__PURE__ */ a(D, { actions: e, cancelLabel: n }) })
46
+ ] });
47
+ });
48
+ export {
49
+ R as ActionSheet,
50
+ B as Sheet,
51
+ L as SheetTrigger
52
+ };
@@ -1,4 +1,4 @@
1
- import { type CSSProperties, type ReactNode } from 'react';
1
+ import { type CSSProperties, type HTMLAttributes, type ReactNode } from 'react';
2
2
  export interface SplitterProps {
3
3
  /** The two panes. */
4
4
  children: [ReactNode, ReactNode];
@@ -34,7 +34,7 @@ export interface AffixProps {
34
34
  }
35
35
  /** Sticks to the top once it scrolls there, and tells you when (data-stuck for styling). */
36
36
  export declare function Affix({ children, offsetTop, onChange, className }: AffixProps): import("react").JSX.Element;
37
- export interface FloatButtonProps {
37
+ export interface FloatButtonProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
38
38
  /** The icon. */
39
39
  icon: ReactNode;
40
40
  /** What it does; also the tooltip. */
@@ -63,16 +63,16 @@ export interface FloatButtonProps {
63
63
  size?: 'sm' | 'md';
64
64
  }
65
65
  /** A round button floating over the page for one frequent action, or a few. */
66
- export declare function FloatButton({ icon, onPress, placement, variant, position, actions, label: text, collapseOnScroll, shape, size, 'aria-label': label }: FloatButtonProps): import("react").JSX.Element;
66
+ export declare const FloatButton: import("react").ForwardRefExoticComponent<FloatButtonProps & import("react").RefAttributes<HTMLDivElement>>;
67
67
  /** A FloatButton that appears after scrolling down and takes you back to the top. */
68
- export interface BackToTopProps {
68
+ export interface BackToTopProps extends Omit<FloatButtonProps, 'icon' | 'aria-label' | 'onPress' | 'position' | 'variant' | 'actions' | 'label'> {
69
69
  /** Scroll distance before it shows, in px. Default 400. */
70
70
  threshold?: number;
71
71
  /** fixed to the window (default) or absolute inside a positioned parent. */
72
72
  position?: 'fixed' | 'absolute';
73
73
  }
74
74
  /** A button that appears after scrolling down and takes people back to the top. */
75
- export declare function BackToTop({ threshold, position }: BackToTopProps): import("react").JSX.Element | null;
75
+ export declare const BackToTop: import("react").ForwardRefExoticComponent<BackToTopProps & import("react").RefAttributes<HTMLDivElement>>;
76
76
  export interface AnchorProps {
77
77
  /** The sections: id of the heading or section, and the link text. Nest with level 2 or 3. */
78
78
  items: Array<{
@@ -0,0 +1,132 @@
1
+ "use client";
2
+ import { jsxs as b, Fragment as $, jsx as n } from "react/jsx-runtime";
3
+ import { useRef as O, useState as g, useEffect as B, forwardRef as P, useCallback as j } from "react";
4
+ import { ArrowUp as K } from "lucide-react";
5
+ import { cx as T } from "../../utils/cx.js";
6
+ import { TooltipTrigger as M, Tooltip as Y } from "../overlay/Overlay.js";
7
+ import { Button as F } from "../button/Button.js";
8
+ import { useStrings as I } from "../../i18n/strings.js";
9
+ function V({ children: u, orientation: o = "horizontal", size: t, defaultSize: v = 50, onSizeChange: i, min: p = 15, max: a = 85, className: l, style: e, "aria-label": c }) {
10
+ const m = I();
11
+ c ?? (c = m.resize);
12
+ const [h, y] = g(v), E = t ?? h, L = O(null), f = j((s) => {
13
+ const r = Math.round(Math.min(a, Math.max(p, s)) * 10) / 10;
14
+ t === void 0 && y(r), i == null || i(r);
15
+ }, [t, p, a, i]), w = o === "horizontal", k = () => w && !!L.current && getComputedStyle(L.current).direction === "rtl", R = (s) => {
16
+ s.preventDefault();
17
+ const r = L.current.getBoundingClientRect(), D = k(), A = (x) => f(w ? (D ? r.right - x.clientX : x.clientX - r.left) / r.width * 100 : (x.clientY - r.top) / r.height * 100), N = () => {
18
+ window.removeEventListener("pointermove", A), window.removeEventListener("pointerup", N), window.removeEventListener("pointercancel", N), document.body.style.cursor = "";
19
+ };
20
+ window.addEventListener("pointermove", A), window.addEventListener("pointerup", N), window.addEventListener("pointercancel", N), document.body.style.cursor = w ? "col-resize" : "row-resize";
21
+ }, d = (s) => {
22
+ const r = s.shiftKey ? 10 : 2, D = k() ? "ArrowRight" : "ArrowLeft", A = k() ? "ArrowLeft" : "ArrowRight", N = w ? D : "ArrowUp", x = w ? A : "ArrowDown";
23
+ if (s.key === N) f(E - r);
24
+ else if (s.key === x) f(E + r);
25
+ else if (s.key === "Home") f(p);
26
+ else if (s.key === "End") f(a);
27
+ else if (s.key === "Enter") f(v);
28
+ else return;
29
+ s.preventDefault();
30
+ };
31
+ return /* @__PURE__ */ b("div", { ref: L, className: T("alea-splitter", l), "data-orientation": o, style: { ...e, "--alea-split": `${E}%` }, children: [
32
+ /* @__PURE__ */ n("div", { className: "alea-split-pane", children: u[0] }),
33
+ /* @__PURE__ */ n(
34
+ "div",
35
+ {
36
+ role: "separator",
37
+ tabIndex: 0,
38
+ "aria-label": c,
39
+ "aria-orientation": w ? "vertical" : "horizontal",
40
+ "aria-valuenow": E,
41
+ "aria-valuemin": p,
42
+ "aria-valuemax": a,
43
+ className: "alea-split-handle alea-focus-ring",
44
+ onPointerDown: R,
45
+ onKeyDown: d,
46
+ onDoubleClick: () => f(v),
47
+ children: /* @__PURE__ */ n("span", { className: "alea-split-grip", "aria-hidden": "true" })
48
+ }
49
+ ),
50
+ /* @__PURE__ */ n("div", { className: "alea-split-pane", children: u[1] })
51
+ ] });
52
+ }
53
+ function W({ children: u, offsetTop: o = 0, onChange: t, className: v }) {
54
+ const i = O(null), [p, a] = g(!1);
55
+ return B(() => {
56
+ const l = i.current;
57
+ if (!l || typeof IntersectionObserver > "u") return;
58
+ const e = new IntersectionObserver(([c]) => {
59
+ const m = !c.isIntersecting && c.boundingClientRect.top < o + 1;
60
+ a(m), t == null || t(m);
61
+ }, { rootMargin: `-${o + 1}px 0px 0px 0px`, threshold: 0 });
62
+ return e.observe(l), () => e.disconnect();
63
+ }, [o, t]), /* @__PURE__ */ b($, { children: [
64
+ /* @__PURE__ */ n("div", { ref: i, "aria-hidden": "true", style: { height: 1, marginBottom: "calc(var(--alea-space-0-25) * -1)" } }),
65
+ /* @__PURE__ */ n("div", { className: T("alea-affix", v), "data-stuck": p || void 0, style: { top: o }, children: u })
66
+ ] });
67
+ }
68
+ const U = P(function({ icon: o, onPress: t, placement: v = "bottom-end", variant: i = "primary", position: p = "fixed", actions: a, label: l, collapseOnScroll: e, shape: c, size: m, "aria-label": h, className: y, ...E }, L) {
69
+ const [f, w] = g(!1), [k, R] = g(!1);
70
+ return B(() => {
71
+ if (!e || !l) return;
72
+ let d = window.scrollY;
73
+ const s = () => {
74
+ const r = window.scrollY;
75
+ Math.abs(r - d) > 8 && (R(r > d && r > 80), d = r);
76
+ };
77
+ return window.addEventListener("scroll", s, { passive: !0 }), () => window.removeEventListener("scroll", s);
78
+ }, [e, l]), /* @__PURE__ */ b("div", { ref: L, ...E, className: T("alea-float", y), "data-placement": v, "data-position": p, "data-open": f || void 0, "data-extended": l ? !0 : void 0, "data-collapsed": k || void 0, "data-shape": c, "data-size": m, children: [
79
+ a && /* @__PURE__ */ n("ul", { className: "alea-float-actions", hidden: !f, children: a.map((d) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ b(M, { children: [
80
+ /* @__PURE__ */ n(F, { variant: "secondary", className: "alea-float-btn alea-float-small", "aria-label": d.label, onPress: () => {
81
+ w(!1), d.onPress();
82
+ }, children: /* @__PURE__ */ n("span", { className: "alea-button-icon", "aria-hidden": "true", children: d.icon }) }),
83
+ /* @__PURE__ */ n(Y, { placement: "start", children: d.label })
84
+ ] }) }, d.label)) }),
85
+ /* @__PURE__ */ b(M, { children: [
86
+ /* @__PURE__ */ b(F, { variant: i, className: "alea-float-btn", "aria-label": h, "aria-expanded": a ? f : void 0, onPress: () => a ? w((d) => !d) : t == null ? void 0 : t(), children: [
87
+ /* @__PURE__ */ n("span", { className: "alea-button-icon alea-float-icon", "aria-hidden": "true", children: o }),
88
+ l && /* @__PURE__ */ n("span", { className: "alea-float-label", "aria-hidden": "true", children: l })
89
+ ] }),
90
+ /* @__PURE__ */ n(Y, { placement: "start", children: h })
91
+ ] })
92
+ ] });
93
+ }), Z = P(function({ threshold: o = 400, position: t = "fixed", ...v }, i) {
94
+ const p = I(), [a, l] = g(!1);
95
+ return B(() => {
96
+ const e = () => l(window.scrollY > o);
97
+ return e(), window.addEventListener("scroll", e, { passive: !0 }), () => window.removeEventListener("scroll", e);
98
+ }, [o]), !a && t === "fixed" ? null : /* @__PURE__ */ n(U, { ref: i, ...v, icon: /* @__PURE__ */ n(K, {}), "aria-label": p.backToTop, variant: "secondary", position: t, onPress: () => {
99
+ var e, c;
100
+ window.scrollTo({ top: 0, behavior: "smooth" }), (c = (e = document.querySelector("main")) == null ? void 0 : e.focus) == null || c.call(e);
101
+ } });
102
+ });
103
+ function _({ items: u, offset: o = 80, title: t, className: v }) {
104
+ var l;
105
+ const i = I();
106
+ t ?? (t = i.onThisPage);
107
+ const [p, a] = g(((l = u[0]) == null ? void 0 : l.id) ?? null);
108
+ return B(() => {
109
+ const e = () => {
110
+ var m;
111
+ let c = ((m = u[0]) == null ? void 0 : m.id) ?? null;
112
+ for (const h of u) {
113
+ const y = document.getElementById(h.id);
114
+ y && y.getBoundingClientRect().top - o <= 1 && (c = h.id);
115
+ }
116
+ a(c);
117
+ };
118
+ return e(), window.addEventListener("scroll", e, { passive: !0 }), window.addEventListener("resize", e), () => {
119
+ window.removeEventListener("scroll", e), window.removeEventListener("resize", e);
120
+ };
121
+ }, [u, o]), /* @__PURE__ */ b("nav", { "aria-label": typeof t == "string" ? t : i.onThisPage, className: T("alea-anchor", v), children: [
122
+ t && /* @__PURE__ */ n("p", { className: "alea-anchor-title", children: t }),
123
+ /* @__PURE__ */ n("ul", { children: u.map((e) => /* @__PURE__ */ n("li", { "data-level": e.level || 2, children: /* @__PURE__ */ n("a", { href: `#${e.id}`, className: "alea-anchor-link alea-focus-ring", "aria-current": p === e.id ? "location" : void 0, onClick: () => a(e.id), children: e.label }) }, e.id)) })
124
+ ] });
125
+ }
126
+ export {
127
+ W as Affix,
128
+ _ as Anchor,
129
+ Z as BackToTop,
130
+ U as FloatButton,
131
+ V as Splitter
132
+ };
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type HTMLAttributes } from 'react';
2
2
  import type { Key } from 'react-aria-components';
3
3
  /** An action for a page header, a save bar or page actions. */
4
4
  export interface PageAction {
@@ -45,7 +45,7 @@ export interface PageHeaderProps {
45
45
  }
46
46
  /** The top of a page: breadcrumbs or back, title, subtitle, meta, actions and tabs. Secondary actions fold into a menu on phones. */
47
47
  export declare function PageHeader({ title, subtitle, back, backLabel, breadcrumbs, media, meta, actions, secondaryActions, tabs, headingLevel, sticky, compact, className }: PageHeaderProps): import("react").JSX.Element;
48
- export interface SaveBarProps {
48
+ export interface SaveBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
49
49
  /** Show it while there are unsaved changes. */
50
50
  isVisible: boolean;
51
51
  /** The message. Default "Unsaved changes". */
@@ -66,8 +66,8 @@ export interface SaveBarProps {
66
66
  saveShortcut?: boolean;
67
67
  }
68
68
  /** A bar that appears while a form has unsaved changes, with Save and Discard. Announced to screen readers when it appears; ⌘S saves. */
69
- export declare function SaveBar({ isVisible, message, onSave, onDiscard, isSaving, saveLabel, discardLabel, position, saveShortcut }: SaveBarProps): import("react").JSX.Element;
70
- export interface TopLoadingBarProps {
69
+ export declare const SaveBar: import("react").ForwardRefExoticComponent<SaveBarProps & import("react").RefAttributes<HTMLDivElement>>;
70
+ export interface TopLoadingBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
71
71
  /** Shows the bar while a page or a big request loads. */
72
72
  isLoading: boolean;
73
73
  /** A known progress from 0 to 100; without it the bar creeps forward on its own. */
@@ -76,7 +76,7 @@ export interface TopLoadingBarProps {
76
76
  'aria-label'?: string;
77
77
  }
78
78
  /** A thin bar at the very top of the window while a page loads: it creeps forward, then completes and fades. */
79
- export declare function TopLoadingBar({ isLoading, value, 'aria-label': label }: TopLoadingBarProps): import("react").JSX.Element | null;
79
+ export declare const TopLoadingBar: import("react").ForwardRefExoticComponent<TopLoadingBarProps & import("react").RefAttributes<HTMLDivElement>>;
80
80
  /** A quiet line at the end of a page that points to help: "Learn more about payouts". */
81
81
  export declare function FooterHelp({ children, className }: {
82
82
  children: ReactNode;
@@ -0,0 +1,109 @@
1
+ "use client";
2
+ import { jsxs as o, jsx as e, Fragment as H } from "react/jsx-runtime";
3
+ import { useRef as L, useState as I, useEffect as x, createElement as M, forwardRef as T } from "react";
4
+ import { Info as j, MoreHorizontal as F, ArrowLeft as S } from "lucide-react";
5
+ import { cx as B } from "../../utils/cx.js";
6
+ import { Button as k, IconButton as D } from "../button/Button.js";
7
+ import { Breadcrumbs as K, Breadcrumb as O } from "../navigation/Navigation.js";
8
+ import { DropdownMenu as R, MenuItem as $ } from "../menu/Menu.js";
9
+ import { useStrings as y } from "../../i18n/strings.js";
10
+ import { inertProps as q } from "../../utils/inert.js";
11
+ function _({ title: p, subtitle: r, back: i, backLabel: c, breadcrumbs: l, media: u, meta: f, actions: g, secondaryActions: n, tabs: d, headingLevel: N = 1, sticky: s, compact: m, className: h }) {
12
+ const v = y(), b = L(null), [w, C] = I(!1);
13
+ x(() => {
14
+ const a = b.current;
15
+ if (!s || !a || typeof IntersectionObserver > "u") return;
16
+ const t = document.createElement("div");
17
+ a.before(t);
18
+ const z = new IntersectionObserver(([P]) => C(!P.isIntersecting));
19
+ return z.observe(t), () => {
20
+ z.disconnect(), t.remove();
21
+ };
22
+ }, [s]);
23
+ const E = n != null && n.length ? /* @__PURE__ */ o(H, { children: [
24
+ /* @__PURE__ */ e("div", { className: "alea-page-header-secondary", children: n.map((a) => /* @__PURE__ */ e(k, { variant: "ghost", size: "sm", iconStart: a.icon, href: a.href, onPress: a.onAction, isDisabled: a.isDisabled, tone: a.tone === "danger" ? "danger" : void 0, children: a.label }, String(a.id))) }),
25
+ /* @__PURE__ */ e("div", { className: "alea-page-header-more", children: /* @__PURE__ */ e(
26
+ R,
27
+ {
28
+ "aria-label": v.moreActions,
29
+ placement: "bottom end",
30
+ trigger: /* @__PURE__ */ e(D, { "aria-label": v.moreActions, size: "sm", children: /* @__PURE__ */ e(F, {}) }),
31
+ menuProps: { onAction: (a) => {
32
+ var t, z;
33
+ return (z = (t = n.find((P) => P.id === a)) == null ? void 0 : t.onAction) == null ? void 0 : z.call(t);
34
+ } },
35
+ children: n.map((a) => /* @__PURE__ */ e($, { id: a.id, icon: a.icon, href: a.href, isDisabled: a.isDisabled, tone: a.tone, children: a.label }, String(a.id)))
36
+ }
37
+ ) })
38
+ ] }) : null;
39
+ return /* @__PURE__ */ o("header", { ref: b, className: B("alea-page-header", h), "data-sticky": s || void 0, "data-stuck": w || void 0, "data-compact": m || void 0, children: [
40
+ l != null && l.length ? /* @__PURE__ */ e(K, { className: "alea-page-header-crumbs", children: l.map((a, t) => /* @__PURE__ */ e(O, { href: t === l.length - 1 ? void 0 : a.href, children: a.label }, t)) }) : null,
41
+ /* @__PURE__ */ o("div", { className: "alea-page-header-main", children: [
42
+ i && (typeof i == "string" ? /* @__PURE__ */ e(D, { "aria-label": c ?? v.back, variant: "ghost", size: "sm", href: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(S, {}) }) : /* @__PURE__ */ e(D, { "aria-label": c ?? v.back, variant: "ghost", size: "sm", onPress: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(S, {}) })),
43
+ u && /* @__PURE__ */ e("span", { className: "alea-page-header-media", children: u }),
44
+ /* @__PURE__ */ o("div", { className: "alea-page-header-titles", children: [
45
+ /* @__PURE__ */ o("div", { className: "alea-page-header-title-row", children: [
46
+ M(`h${N}`, { className: "alea-page-header-title" }, p),
47
+ f && /* @__PURE__ */ e("div", { className: "alea-page-header-meta", children: f })
48
+ ] }),
49
+ r && /* @__PURE__ */ e("p", { className: "alea-page-header-subtitle", children: r })
50
+ ] }),
51
+ (g || E) && /* @__PURE__ */ o("div", { className: "alea-page-header-actions", children: [
52
+ E,
53
+ g
54
+ ] })
55
+ ] }),
56
+ d && /* @__PURE__ */ e("div", { className: "alea-page-header-tabs", children: d })
57
+ ] });
58
+ }
59
+ const V = T(function({ isVisible: r, message: i, onSave: c, onDiscard: l, isSaving: u, saveLabel: f, discardLabel: g, position: n = "top", saveShortcut: d = !0, className: N, ...s }, m) {
60
+ const h = y(), v = L(c);
61
+ return v.current = c, x(() => {
62
+ if (!r || !d) return;
63
+ const b = (w) => {
64
+ (w.metaKey || w.ctrlKey) && w.key.toLowerCase() === "s" && (w.preventDefault(), v.current());
65
+ };
66
+ return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
67
+ }, [r, d]), /* @__PURE__ */ o("div", { ref: m, ...s, className: B("alea-savebar", N), "data-visible": r || void 0, "data-position": n, role: "region", "aria-label": s["aria-label"] ?? h.unsavedChanges, "aria-hidden": !r || void 0, ...q(!r), children: [
68
+ /* @__PURE__ */ e("p", { className: "alea-savebar-message", "aria-live": "polite", children: r ? i ?? h.unsavedChanges : "" }),
69
+ /* @__PURE__ */ o("div", { className: "alea-savebar-actions", children: [
70
+ l && /* @__PURE__ */ e(k, { variant: "ghost", size: "sm", onPress: l, isDisabled: u, children: g ?? h.discard }),
71
+ /* @__PURE__ */ e(k, { size: "sm", variant: "secondary", onPress: c, isLoading: u, shortcut: d ? "⌘S" : void 0, children: f ?? h.save })
72
+ ] })
73
+ ] });
74
+ }), ee = T(function({ isLoading: r, value: i, "aria-label": c, className: l, ...u }, f) {
75
+ const g = y(), [n, d] = I(r), [N, s] = I(!1);
76
+ if (x(() => {
77
+ if (r) {
78
+ d(!0), s(!1);
79
+ return;
80
+ }
81
+ if (!n) return;
82
+ s(!0);
83
+ const h = setTimeout(() => {
84
+ d(!1), s(!1);
85
+ }, 500);
86
+ return () => clearTimeout(h);
87
+ }, [r]), !n) return null;
88
+ const m = N ? 100 : i;
89
+ return /* @__PURE__ */ e("div", { ref: f, ...u, className: B("alea-top-loading", l), role: "progressbar", "aria-label": c ?? g.loading, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": m, "data-done": N || void 0, "data-indeterminate": m == null || void 0, children: /* @__PURE__ */ e("span", { className: "alea-top-loading-bar", style: m != null ? { width: `${m}%` } : void 0 }) });
90
+ });
91
+ function ae({ children: p, className: r }) {
92
+ return /* @__PURE__ */ o("p", { className: B("alea-footer-help", r), children: [
93
+ /* @__PURE__ */ e(j, { size: 16, "aria-hidden": "true" }),
94
+ /* @__PURE__ */ e("span", { children: p })
95
+ ] });
96
+ }
97
+ function re({ primary: p, secondary: r, className: i }) {
98
+ return /* @__PURE__ */ o("div", { className: B("alea-page-actions", i), children: [
99
+ /* @__PURE__ */ e("div", { className: "alea-page-actions-secondary", children: r }),
100
+ /* @__PURE__ */ e("div", { className: "alea-page-actions-primary", children: p })
101
+ ] });
102
+ }
103
+ export {
104
+ ae as FooterHelp,
105
+ re as PageActions,
106
+ _ as PageHeader,
107
+ V as SaveBar,
108
+ ee as TopLoadingBar
109
+ };
@@ -1,7 +1,7 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type HTMLAttributes } from 'react';
2
2
  import { type Key } from 'react-aria-components';
3
3
  import type { MotionProp } from '@alea-design/motion';
4
- export interface OTPFieldProps {
4
+ export interface OTPFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
5
5
  /** Number of characters. Default 6. */
6
6
  length?: number;
7
7
  /** The visible label ("Verification code"). */
@@ -28,14 +28,14 @@ export interface OTPFieldProps {
28
28
  name?: string;
29
29
  }
30
30
  /** One-time codes in separate boxes: paste the whole code, arrows and Backspace move between boxes. */
31
- export declare function OTPField({ length, label, value, defaultValue, onChange, onComplete, type, mask, isInvalid, errorMessage, isDisabled, name }: OTPFieldProps): import("react").JSX.Element;
31
+ export declare const OTPField: import("react").ForwardRefExoticComponent<OTPFieldProps & import("react").RefAttributes<HTMLDivElement>>;
32
32
  export interface CascaderOption {
33
33
  id: Key;
34
34
  label: string;
35
35
  children?: CascaderOption[];
36
36
  isDisabled?: boolean;
37
37
  }
38
- export interface CascaderProps {
38
+ export interface CascaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
39
39
  /** The visible label. */
40
40
  label?: ReactNode;
41
41
  /** The tree of options: id, label, children. */
@@ -58,13 +58,13 @@ export interface CascaderProps {
58
58
  motion?: MotionProp;
59
59
  }
60
60
  /** Pick from nested options column by column: country, then city. */
61
- export declare function Cascader({ motion, label, options, value, defaultValue, onChange, placeholder, allowsParentSelection, description, isDisabled }: CascaderProps): import("react").JSX.Element;
61
+ export declare const Cascader: import("react").ForwardRefExoticComponent<CascaderProps & import("react").RefAttributes<HTMLDivElement>>;
62
62
  export interface TreeSelectNode {
63
63
  id: Key;
64
64
  label: string;
65
65
  children?: TreeSelectNode[];
66
66
  }
67
- export interface TreeSelectProps {
67
+ export interface TreeSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
68
68
  /** The visible label. */
69
69
  label?: ReactNode;
70
70
  /** The tree: id, label, children. */
@@ -85,14 +85,14 @@ export interface TreeSelectProps {
85
85
  motion?: MotionProp;
86
86
  }
87
87
  /** A select whose options are a tree: categories, folders, org charts. */
88
- export declare function TreeSelect({ motion, label, nodes, selectionMode, value, defaultValue, onChange, placeholder, isDisabled }: TreeSelectProps): import("react").JSX.Element;
88
+ export declare const TreeSelect: import("react").ForwardRefExoticComponent<TreeSelectProps & import("react").RefAttributes<HTMLDivElement>>;
89
89
  export interface TransferItem {
90
90
  id: Key;
91
91
  label: string;
92
92
  description?: string;
93
93
  isDisabled?: boolean;
94
94
  }
95
- export interface TransferProps {
95
+ export interface TransferProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
96
96
  /** All the items: id and label. */
97
97
  items: TransferItem[];
98
98
  /** Ids on the right side (controlled). */
@@ -107,8 +107,8 @@ export interface TransferProps {
107
107
  searchable?: boolean;
108
108
  }
109
109
  /** Move items between two lists: available and chosen. */
110
- export declare function Transfer({ items, value, defaultValue, onChange, titles, searchable }: TransferProps): import("react").JSX.Element;
111
- export interface MentionsProps {
110
+ export declare const Transfer: import("react").ForwardRefExoticComponent<TransferProps & import("react").RefAttributes<HTMLDivElement>>;
111
+ export interface MentionsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
112
112
  /** The visible label. */
113
113
  label?: ReactNode;
114
114
  /** People or things to mention. */
@@ -133,4 +133,4 @@ export interface MentionsProps {
133
133
  description?: ReactNode;
134
134
  }
135
135
  /** A text area where @ suggests people to mention; arrows pick, Enter inserts. */
136
- export declare function Mentions({ label, options, value, defaultValue, onChange, trigger, placeholder, rows, description }: MentionsProps): import("react").JSX.Element;
136
+ export declare const Mentions: import("react").ForwardRefExoticComponent<MentionsProps & import("react").RefAttributes<HTMLDivElement>>;