@azmr/ui 0.1.0 → 0.2.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 (91) hide show
  1. package/README.md +171 -0
  2. package/dist/avatar.d.ts +58 -0
  3. package/dist/avatar.js +84 -0
  4. package/dist/breadcrumb.d.ts +47 -0
  5. package/dist/breadcrumb.js +120 -0
  6. package/dist/button-CYt2Zw3D.d.ts +64 -0
  7. package/dist/button.d.ts +54 -0
  8. package/dist/button.js +19 -0
  9. package/dist/chunk-2RIWL363.js +27 -0
  10. package/dist/chunk-2TQSHVXA.js +12 -0
  11. package/dist/chunk-7EOSDFS3.js +10 -0
  12. package/dist/chunk-C2HKIPLQ.js +118 -0
  13. package/dist/chunk-CAJLW6K2.js +16 -0
  14. package/dist/chunk-CZJZYN54.js +36 -0
  15. package/dist/chunk-EE4V6XMB.js +35 -0
  16. package/dist/chunk-EFHRRLAW.js +211 -0
  17. package/dist/chunk-GLB75NT3.js +21 -0
  18. package/dist/chunk-GX2YEJ43.js +36 -0
  19. package/dist/chunk-LTOLV67A.js +19 -0
  20. package/dist/chunk-LZMX27IZ.js +10 -0
  21. package/dist/chunk-NIIDYIZA.js +1 -0
  22. package/dist/chunk-Q4PPM2SU.js +97 -0
  23. package/dist/chunk-WVE2E37B.js +20 -0
  24. package/dist/chunk-XRZHP6BD.js +92 -0
  25. package/dist/disclosure.d.ts +72 -0
  26. package/dist/disclosure.js +221 -0
  27. package/dist/display.d.ts +111 -0
  28. package/dist/display.js +237 -0
  29. package/dist/floating.d.ts +81 -0
  30. package/dist/floating.js +231 -0
  31. package/dist/hooks.d.ts +33 -0
  32. package/dist/hooks.js +55 -0
  33. package/dist/icons/lucide.d.ts +77 -0
  34. package/dist/icons/lucide.js +135 -0
  35. package/dist/icons/mui-map.d.ts +1268 -0
  36. package/dist/icons/mui-map.js +352 -0
  37. package/dist/icons.d.ts +48 -0
  38. package/dist/icons.js +19 -0
  39. package/dist/index.d.ts +238 -3
  40. package/dist/index.js +242 -15
  41. package/dist/input.d.ts +14 -0
  42. package/dist/input.js +8 -0
  43. package/dist/layout/mui-map.d.ts +80 -0
  44. package/dist/layout/mui-map.js +104 -0
  45. package/dist/layout.d.ts +89 -0
  46. package/dist/layout.js +455 -0
  47. package/dist/lib.d.ts +11 -0
  48. package/dist/lib.js +6 -0
  49. package/dist/menu.d.ts +105 -0
  50. package/dist/menu.js +56 -0
  51. package/dist/modal.d.ts +105 -0
  52. package/dist/modal.js +273 -0
  53. package/dist/motion.css +295 -0
  54. package/dist/pagination.d.ts +82 -0
  55. package/dist/pagination.js +211 -0
  56. package/dist/presets.d.ts +97 -0
  57. package/dist/presets.js +94 -0
  58. package/dist/progress.d.ts +70 -0
  59. package/dist/progress.js +138 -0
  60. package/dist/react.d.ts +81 -0
  61. package/dist/react.js +281 -0
  62. package/dist/responsive-YJBnvsjt.d.ts +69 -0
  63. package/dist/scroll-area.d.ts +30 -0
  64. package/dist/scroll-area.js +80 -0
  65. package/dist/shared-Fkx-sjPt.d.ts +15 -0
  66. package/dist/spinner.d.ts +18 -0
  67. package/dist/spinner.js +39 -0
  68. package/dist/split-button.d.ts +32 -0
  69. package/dist/split-button.js +54 -0
  70. package/dist/stepper.d.ts +27 -0
  71. package/dist/stepper.js +104 -0
  72. package/dist/styles.css +24 -0
  73. package/dist/table.d.ts +52 -0
  74. package/dist/table.js +124 -0
  75. package/dist/theme.d.ts +111 -0
  76. package/dist/theme.js +414 -0
  77. package/dist/toast.d.ts +77 -0
  78. package/dist/toast.js +203 -0
  79. package/dist/toggle.d.ts +55 -0
  80. package/dist/toggle.js +88 -0
  81. package/dist/tokens.css +337 -0
  82. package/dist/transition.d.ts +51 -0
  83. package/dist/transition.js +79 -0
  84. package/dist/types-BBudf463.d.ts +39 -0
  85. package/dist/typography/mui-map.d.ts +91 -0
  86. package/dist/typography/mui-map.js +62 -0
  87. package/dist/typography.d.ts +90 -0
  88. package/dist/typography.js +193 -0
  89. package/dist/useSignal-C-3ZGURN.d.ts +21 -0
  90. package/dist/variants-De0c0ucO.d.ts +60 -0
  91. package/package.json +167 -12
package/dist/menu.d.ts ADDED
@@ -0,0 +1,105 @@
1
+ import * as _base_ui_react_menu from '@base-ui/react/menu';
2
+ import { Menu } from '@base-ui/react/menu';
3
+ import * as react from 'react';
4
+ import { ComponentPropsWithoutRef, HTMLAttributes } from 'react';
5
+ import * as _base_ui_react_context_menu from '@base-ui/react/context-menu';
6
+ import { ContextMenu as ContextMenu$1 } from '@base-ui/react/context-menu';
7
+ import { P as PositionProps } from './shared-Fkx-sjPt.js';
8
+ import { BaseUIComponentProps, Orientation } from '../internals/types.mjs';
9
+
10
+ interface SeparatorProps extends BaseUIComponentProps<'div', SeparatorState> {
11
+ /**
12
+ * The orientation of the separator.
13
+ * @default 'horizontal'
14
+ */
15
+ orientation?: Orientation | undefined;
16
+ }
17
+ interface SeparatorState {
18
+ /**
19
+ * The orientation of the separator.
20
+ */
21
+ orientation: Orientation;
22
+ }
23
+
24
+ type WithClassName<T> = Omit<T, "className"> & {
25
+ className?: string;
26
+ };
27
+ interface MenuItemProps extends WithClassName<ComponentPropsWithoutRef<typeof Menu.Item>> {
28
+ /** `destructive` for an item that deletes or discards something. */
29
+ variant?: "default" | "destructive";
30
+ }
31
+ /** An action. Arrow keys move between items; Enter or Space runs it and closes the menu. */
32
+ declare const MenuItem: react.ForwardRefExoticComponent<MenuItemProps & react.RefAttributes<HTMLDivElement>>;
33
+ /** A link in a menu. Renders an `<a>`, so it works with middle click and "open in new tab". */
34
+ declare const MenuLinkItem: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react_menu.MenuLinkItemProps, "ref"> & react.RefAttributes<Element>, "ref">, "className"> & {
35
+ className?: string;
36
+ } & react.RefAttributes<HTMLAnchorElement>>;
37
+ /** An item that toggles on and off. It stays open when toggled; set `closeOnClick` to change that. */
38
+ declare const MenuCheckboxItem: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react_menu.MenuCheckboxItemProps, "ref"> & react.RefAttributes<HTMLElement>, "ref">, "className"> & {
39
+ className?: string;
40
+ } & react.RefAttributes<HTMLDivElement>>;
41
+ /** A group of radio items: exactly one is selected. */
42
+ declare const MenuRadioGroup: react.NamedExoticComponent<Omit<_base_ui_react_menu.MenuRadioGroupProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
43
+ declare const MenuRadioItem: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react_menu.MenuRadioItemProps, "ref"> & react.RefAttributes<HTMLElement>, "ref">, "className"> & {
44
+ className?: string;
45
+ } & react.RefAttributes<HTMLDivElement>>;
46
+ /** Groups items under a label, announced as a named group. */
47
+ declare const MenuGroup: react.ForwardRefExoticComponent<Omit<_base_ui_react_menu.MenuGroupProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
48
+ declare const MenuLabel: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react_menu.MenuGroupLabelProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
49
+ className?: string;
50
+ } & react.RefAttributes<HTMLDivElement>>;
51
+ declare const MenuSeparator: react.ForwardRefExoticComponent<Omit<Omit<Omit<SeparatorProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
52
+ className?: string;
53
+ } & react.RefAttributes<HTMLDivElement>>;
54
+ /**
55
+ * A keyboard shortcut shown at the end of an item. It is a hint only: wiring the shortcut up is
56
+ * the app's job. Add `aria-keyshortcuts` to the item if it is real.
57
+ */
58
+ declare function MenuShortcut({ className, ...props }: HTMLAttributes<HTMLSpanElement>): react.JSX.Element;
59
+ /** Wraps a nested menu: a `MenuSubTrigger` and its `MenuSubContent`. */
60
+ declare const MenuSub: typeof Menu.SubmenuRoot;
61
+ declare const MenuSubTrigger: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react_menu.MenuSubmenuTriggerProps, "ref"> & react.RefAttributes<HTMLElement>, "ref">, "className"> & {
62
+ className?: string;
63
+ } & react.RefAttributes<HTMLDivElement>>;
64
+ type MenuSubContentProps = WithClassName<ComponentPropsWithoutRef<typeof Menu.Popup>> & PositionProps;
65
+ declare const MenuSubContent: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react_menu.MenuPopupProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
66
+ className?: string;
67
+ } & PositionProps & react.RefAttributes<HTMLDivElement>>;
68
+
69
+ /**
70
+ * A menu that opens at the pointer on right click (or long press on touch). It supports the same
71
+ * keys as `DropdownMenu` once it is open.
72
+ *
73
+ * Use it as an enhancement only. The trigger area is not focusable and a long press is easy to
74
+ * miss, so every action in it must also be reachable another way, for example a visible actions
75
+ * button that opens a `DropdownMenu` with the same items.
76
+ */
77
+ declare const ContextMenu: typeof ContextMenu$1.Root;
78
+ /** The area that responds to right click. Give it a size with `className`. */
79
+ declare const ContextMenuTrigger: react.ForwardRefExoticComponent<Omit<_base_ui_react_context_menu.ContextMenuTriggerProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
80
+ type ContextMenuContentProps = Omit<ComponentPropsWithoutRef<typeof ContextMenu$1.Popup>, "className"> & PositionProps & {
81
+ className?: string;
82
+ };
83
+ declare const ContextMenuContent: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react_menu.MenuPopupProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref">, "className"> & PositionProps & {
84
+ className?: string;
85
+ } & react.RefAttributes<HTMLDivElement>>;
86
+
87
+ /**
88
+ * A menu of actions opened from a button.
89
+ *
90
+ * Keyboard: Enter, Space or ArrowDown on the trigger opens it on the first item (ArrowUp, on the
91
+ * last). Inside, ArrowDown and ArrowUp move between items and wrap, Home and End jump, typing
92
+ * letters jumps to the item that starts with them, Enter or Space runs the item, ArrowRight opens
93
+ * a submenu and ArrowLeft closes it, Escape closes (one level at a time) and returns focus to the
94
+ * trigger, and Tab closes it. Disabled items stay focusable (so they can be found) but cannot be run.
95
+ */
96
+ declare const DropdownMenu: typeof Menu.Root;
97
+ declare const DropdownMenuTrigger: Menu.Trigger;
98
+ type DropdownMenuContentProps = Omit<ComponentPropsWithoutRef<typeof Menu.Popup>, "className"> & PositionProps & {
99
+ className?: string;
100
+ };
101
+ declare const DropdownMenuContent: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react_menu.MenuPopupProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref">, "className"> & PositionProps & {
102
+ className?: string;
103
+ } & react.RefAttributes<HTMLDivElement>>;
104
+
105
+ export { ContextMenu, MenuCheckboxItem as ContextMenuCheckboxItem, ContextMenuContent, type ContextMenuContentProps, MenuGroup as ContextMenuGroup, MenuItem as ContextMenuItem, MenuLabel as ContextMenuLabel, MenuLinkItem as ContextMenuLinkItem, MenuRadioGroup as ContextMenuRadioGroup, MenuRadioItem as ContextMenuRadioItem, MenuSeparator as ContextMenuSeparator, MenuShortcut as ContextMenuShortcut, MenuSub as ContextMenuSub, MenuSubContent as ContextMenuSubContent, MenuSubTrigger as ContextMenuSubTrigger, ContextMenuTrigger, DropdownMenu, MenuCheckboxItem as DropdownMenuCheckboxItem, DropdownMenuContent, type DropdownMenuContentProps, MenuGroup as DropdownMenuGroup, MenuItem as DropdownMenuItem, MenuLabel as DropdownMenuLabel, MenuLinkItem as DropdownMenuLinkItem, MenuRadioGroup as DropdownMenuRadioGroup, MenuRadioItem as DropdownMenuRadioItem, MenuSeparator as DropdownMenuSeparator, MenuShortcut as DropdownMenuShortcut, MenuSub as DropdownMenuSub, MenuSubContent as DropdownMenuSubContent, MenuSubTrigger as DropdownMenuSubTrigger, DropdownMenuTrigger, type MenuItemProps, type MenuSubContentProps };
package/dist/menu.js ADDED
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import {
3
+ ContextMenu,
4
+ ContextMenuContent,
5
+ ContextMenuTrigger,
6
+ DropdownMenu,
7
+ DropdownMenuContent,
8
+ DropdownMenuTrigger,
9
+ MenuCheckboxItem,
10
+ MenuGroup,
11
+ MenuItem,
12
+ MenuLabel,
13
+ MenuLinkItem,
14
+ MenuRadioGroup,
15
+ MenuRadioItem,
16
+ MenuSeparator,
17
+ MenuShortcut,
18
+ MenuSub,
19
+ MenuSubContent,
20
+ MenuSubTrigger
21
+ } from "./chunk-EFHRRLAW.js";
22
+ import "./chunk-LZMX27IZ.js";
23
+ import "./chunk-XRZHP6BD.js";
24
+ import "./chunk-2TQSHVXA.js";
25
+ export {
26
+ ContextMenu,
27
+ MenuCheckboxItem as ContextMenuCheckboxItem,
28
+ ContextMenuContent,
29
+ MenuGroup as ContextMenuGroup,
30
+ MenuItem as ContextMenuItem,
31
+ MenuLabel as ContextMenuLabel,
32
+ MenuLinkItem as ContextMenuLinkItem,
33
+ MenuRadioGroup as ContextMenuRadioGroup,
34
+ MenuRadioItem as ContextMenuRadioItem,
35
+ MenuSeparator as ContextMenuSeparator,
36
+ MenuShortcut as ContextMenuShortcut,
37
+ MenuSub as ContextMenuSub,
38
+ MenuSubContent as ContextMenuSubContent,
39
+ MenuSubTrigger as ContextMenuSubTrigger,
40
+ ContextMenuTrigger,
41
+ DropdownMenu,
42
+ MenuCheckboxItem as DropdownMenuCheckboxItem,
43
+ DropdownMenuContent,
44
+ MenuGroup as DropdownMenuGroup,
45
+ MenuItem as DropdownMenuItem,
46
+ MenuLabel as DropdownMenuLabel,
47
+ MenuLinkItem as DropdownMenuLinkItem,
48
+ MenuRadioGroup as DropdownMenuRadioGroup,
49
+ MenuRadioItem as DropdownMenuRadioItem,
50
+ MenuSeparator as DropdownMenuSeparator,
51
+ MenuShortcut as DropdownMenuShortcut,
52
+ MenuSub as DropdownMenuSub,
53
+ MenuSubContent as DropdownMenuSubContent,
54
+ MenuSubTrigger as DropdownMenuSubTrigger,
55
+ DropdownMenuTrigger
56
+ };
@@ -0,0 +1,105 @@
1
+ import * as react from 'react';
2
+ import { ComponentPropsWithoutRef } from 'react';
3
+ import * as _base_ui_react from '@base-ui/react';
4
+ import { AlertDialog as AlertDialog$1 } from '@base-ui/react/alert-dialog';
5
+ import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
6
+ import { Drawer as Drawer$1 } from '@base-ui/react/drawer';
7
+
8
+ /**
9
+ * A dialog that interrupts to ask for a decision, usually before something destructive. It is
10
+ * announced as an alert dialog, it is **not** closed by a click outside (the person must choose),
11
+ * and focus starts on `AlertDialogCancel`, the least destructive choice, so pressing Enter by
12
+ * reflex cannot delete anything. Escape still cancels.
13
+ */
14
+ declare const AlertDialog: typeof AlertDialog$1.Root;
15
+ declare const AlertDialogTrigger: AlertDialog$1.Trigger;
16
+ type AlertDialogContentProps = Omit<ComponentPropsWithoutRef<typeof AlertDialog$1.Popup>, "className"> & {
17
+ className?: string;
18
+ };
19
+ declare const AlertDialogContent: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.AlertDialogPopupProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
20
+ className?: string;
21
+ } & react.RefAttributes<HTMLDivElement>>;
22
+ declare const AlertDialogHeader: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
23
+ declare const AlertDialogFooter: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
24
+ declare const AlertDialogTitle: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.AlertDialogTitleProps, "ref"> & react.RefAttributes<HTMLHeadingElement>, "ref">, "className"> & {
25
+ className?: string;
26
+ } & react.RefAttributes<HTMLHeadingElement>>;
27
+ declare const AlertDialogDescription: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.AlertDialogDescriptionProps, "ref"> & react.RefAttributes<HTMLParagraphElement>, "ref">, "className"> & {
28
+ className?: string;
29
+ } & react.RefAttributes<HTMLParagraphElement>>;
30
+ /** The safe choice. It closes the dialog and receives focus first. */
31
+ declare const AlertDialogCancel: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.AlertDialogCloseProps, "ref"> & react.RefAttributes<HTMLButtonElement>, "ref">, "className"> & {
32
+ className?: string;
33
+ } & react.RefAttributes<HTMLButtonElement>>;
34
+ interface AlertDialogActionProps extends Omit<ComponentPropsWithoutRef<typeof AlertDialog$1.Close>, "className"> {
35
+ className?: string;
36
+ /** `destructive` (default) for an irreversible action; `default` for a plain confirmation. */
37
+ tone?: "default" | "destructive";
38
+ }
39
+ /** The confirming choice. It runs `onClick`, then closes the dialog. */
40
+ declare const AlertDialogAction: react.ForwardRefExoticComponent<AlertDialogActionProps & react.RefAttributes<HTMLButtonElement>>;
41
+
42
+ /**
43
+ * A modal dialog. While it is open focus is trapped inside it, the page behind is inert and
44
+ * does not scroll, and Escape or a click on the scrim closes it and returns focus to the trigger.
45
+ * Dialogs can be stacked: Escape closes only the top one.
46
+ *
47
+ * Name it with `DialogTitle` (required for accessibility) and describe it with
48
+ * `DialogDescription`.
49
+ */
50
+ declare function Dialog(props: ComponentPropsWithoutRef<typeof Dialog$1.Root>): react.JSX.Element;
51
+ declare const DialogTrigger: Dialog$1.Trigger;
52
+ /** Closes the dialog. Put it inside `DialogContent`; use `render` to style it as a `Button`. */
53
+ declare const DialogClose: react.ForwardRefExoticComponent<Omit<_base_ui_react.AlertDialogCloseProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
54
+ declare const sizes: {
55
+ readonly sm: "max-w-sm";
56
+ readonly md: "max-w-lg";
57
+ readonly lg: "max-w-2xl";
58
+ readonly xl: "max-w-4xl";
59
+ readonly full: "max-w-[calc(100vw-2rem)]";
60
+ };
61
+ interface DialogContentProps extends Omit<ComponentPropsWithoutRef<typeof Dialog$1.Popup>, "className"> {
62
+ className?: string;
63
+ /** Maximum width. Default `md`. All sizes stay inside the viewport on small screens. */
64
+ size?: keyof typeof sizes;
65
+ /** Show the corner close button (labelled "Close"). Default true. */
66
+ showClose?: boolean;
67
+ }
68
+ declare const DialogContent: react.ForwardRefExoticComponent<DialogContentProps & react.RefAttributes<HTMLDivElement>>;
69
+ declare const DialogHeader: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
70
+ declare const DialogFooter: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
71
+ declare const DialogTitle: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.AlertDialogTitleProps, "ref"> & react.RefAttributes<HTMLHeadingElement>, "ref">, "className"> & {
72
+ className?: string;
73
+ } & react.RefAttributes<HTMLHeadingElement>>;
74
+ declare const DialogDescription: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.AlertDialogDescriptionProps, "ref"> & react.RefAttributes<HTMLParagraphElement>, "ref">, "className"> & {
75
+ className?: string;
76
+ } & react.RefAttributes<HTMLParagraphElement>>;
77
+
78
+ type DrawerSide = "top" | "right" | "bottom" | "left";
79
+ interface DrawerProps extends Omit<ComponentPropsWithoutRef<typeof Drawer$1.Root>, "swipeDirection"> {
80
+ /** The edge it slides in from. Default `right`. It is dismissed by swiping back toward that edge. */
81
+ side?: DrawerSide;
82
+ }
83
+ /**
84
+ * A panel that slides in from an edge: a modal, like `Dialog` (focus trap, inert and scroll-locked
85
+ * page, Escape, return focus), plus swipe to dismiss on touch.
86
+ */
87
+ declare function Drawer({ side, ...props }: DrawerProps): react.JSX.Element;
88
+ declare const DrawerTrigger: Drawer$1.Trigger;
89
+ declare const DrawerClose: Drawer$1.Close;
90
+ interface DrawerContentProps extends Omit<ComponentPropsWithoutRef<typeof Drawer$1.Popup>, "className"> {
91
+ className?: string;
92
+ /** Show the corner close button (labelled "Close"). Default true. */
93
+ showClose?: boolean;
94
+ }
95
+ declare const DrawerContent: react.ForwardRefExoticComponent<DrawerContentProps & react.RefAttributes<HTMLDivElement>>;
96
+ declare const DrawerHeader: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
97
+ declare const DrawerFooter: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
98
+ declare const DrawerTitle: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.DrawerTitleProps, "ref">, "className"> & {
99
+ className?: string;
100
+ } & react.RefAttributes<HTMLHeadingElement>>;
101
+ declare const DrawerDescription: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react.DrawerDescriptionProps, "ref">, "className"> & {
102
+ className?: string;
103
+ } & react.RefAttributes<HTMLParagraphElement>>;
104
+
105
+ export { AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, type DrawerProps, type DrawerSide, DrawerTitle, DrawerTrigger };
package/dist/modal.js ADDED
@@ -0,0 +1,273 @@
1
+ "use client";
2
+ import {
3
+ Icon
4
+ } from "./chunk-XRZHP6BD.js";
5
+ import {
6
+ buttonVariants
7
+ } from "./chunk-C2HKIPLQ.js";
8
+ import {
9
+ cn
10
+ } from "./chunk-2TQSHVXA.js";
11
+
12
+ // src/components/modal/alert-dialog.tsx
13
+ import { forwardRef as forwardRef2, useCallback, useRef } from "react";
14
+
15
+ // src/primitives/alert-dialog.ts
16
+ import { AlertDialog } from "@base-ui/react/alert-dialog";
17
+
18
+ // src/components/modal/shared.tsx
19
+ import { X } from "lucide-react";
20
+ import {
21
+ createContext,
22
+ forwardRef,
23
+ useContext
24
+ } from "react";
25
+ import { jsx } from "react/jsx-runtime";
26
+ var BACKDROP = "fixed inset-0 z-(--z-overlay) bg-scrim transition-opacity duration-(--motion-duration-base) ease-standard data-[starting-style]:opacity-0 data-[ending-style]:opacity-0";
27
+ var HEADER = "flex flex-col gap-1.5 pr-8 text-left";
28
+ var FOOTER = "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end";
29
+ var TITLE = "text-lg font-semibold leading-none tracking-tight";
30
+ var DESCRIPTION = "text-sm text-muted-foreground";
31
+ var ModalHeader = forwardRef(
32
+ function ModalHeader2({ className, ...props }, ref) {
33
+ return /* @__PURE__ */ jsx("div", { ref, className: cn(HEADER, className), ...props });
34
+ }
35
+ );
36
+ var ModalFooter = forwardRef(
37
+ function ModalFooter2({ className, ...props }, ref) {
38
+ return /* @__PURE__ */ jsx("div", { ref, className: cn(FOOTER, className), ...props });
39
+ }
40
+ );
41
+ var CLOSE_BUTTON = cn(
42
+ buttonVariants({ variant: "ghost", size: "icon" }),
43
+ "absolute right-2 top-2 size-8"
44
+ );
45
+ function CornerClose({
46
+ as: Close
47
+ }) {
48
+ return /* @__PURE__ */ jsx(Close, { "aria-label": "Close", className: CLOSE_BUTTON, children: /* @__PURE__ */ jsx(Icon, { icon: X }) });
49
+ }
50
+ var ModalFlag = createContext(true);
51
+ function ModalScope({
52
+ modal,
53
+ children
54
+ }) {
55
+ return /* @__PURE__ */ jsx(ModalFlag.Provider, { value: modal !== false, children });
56
+ }
57
+ function useAriaModal() {
58
+ return useContext(ModalFlag) ? { "aria-modal": true } : {};
59
+ }
60
+
61
+ // src/components/modal/alert-dialog.tsx
62
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
63
+ var AlertDialog2 = AlertDialog.Root;
64
+ var AlertDialogTrigger = AlertDialog.Trigger;
65
+ var AlertDialogContent = forwardRef2(
66
+ function AlertDialogContent2({ className, initialFocus, children, ...props }, ref) {
67
+ const popup = useRef(null);
68
+ const setRef = useCallback(
69
+ (node) => {
70
+ popup.current = node;
71
+ if (typeof ref === "function") ref(node);
72
+ else if (ref) ref.current = node;
73
+ },
74
+ [ref]
75
+ );
76
+ return /* @__PURE__ */ jsxs(AlertDialog.Portal, { children: [
77
+ /* @__PURE__ */ jsx2(AlertDialog.Backdrop, { "data-azmr-backdrop": "", className: BACKDROP }),
78
+ /* @__PURE__ */ jsx2(AlertDialog.Viewport, { className: "fixed inset-0 z-(--z-modal) flex overflow-y-auto overscroll-contain p-4", children: /* @__PURE__ */ jsx2(
79
+ AlertDialog.Popup,
80
+ {
81
+ ref: setRef,
82
+ "aria-modal": true,
83
+ initialFocus: initialFocus ?? (() => popup.current?.querySelector("[data-azmr-cancel]") ?? true),
84
+ className: cn(
85
+ "relative mx-auto my-auto grid w-full max-w-md gap-4 rounded-lg border border-border bg-background p-6 text-foreground shadow-elevation-4 outline-none",
86
+ "transition-[opacity,scale] duration-(--motion-duration-base) ease-standard data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
87
+ className
88
+ ),
89
+ ...props,
90
+ children
91
+ }
92
+ ) })
93
+ ] });
94
+ }
95
+ );
96
+ var AlertDialogHeader = ModalHeader;
97
+ var AlertDialogFooter = ModalFooter;
98
+ var AlertDialogTitle = forwardRef2(function AlertDialogTitle2({ className, ...props }, ref) {
99
+ return /* @__PURE__ */ jsx2(AlertDialog.Title, { ref, className: cn(TITLE, className), ...props });
100
+ });
101
+ var AlertDialogDescription = forwardRef2(function AlertDialogDescription2({ className, ...props }, ref) {
102
+ return /* @__PURE__ */ jsx2(AlertDialog.Description, { ref, className: cn(DESCRIPTION, className), ...props });
103
+ });
104
+ var AlertDialogCancel = forwardRef2(function AlertDialogCancel2({ className, ...props }, ref) {
105
+ return /* @__PURE__ */ jsx2(
106
+ AlertDialog.Close,
107
+ {
108
+ ref,
109
+ "data-azmr-cancel": "",
110
+ className: cn(buttonVariants({ variant: "outline" }), className),
111
+ ...props
112
+ }
113
+ );
114
+ });
115
+ var AlertDialogAction = forwardRef2(
116
+ function AlertDialogAction2({ tone = "destructive", className, ...props }, ref) {
117
+ return /* @__PURE__ */ jsx2(
118
+ AlertDialog.Close,
119
+ {
120
+ ref,
121
+ className: cn(
122
+ buttonVariants({ variant: tone === "destructive" ? "destructive" : "default" }),
123
+ className
124
+ ),
125
+ ...props
126
+ }
127
+ );
128
+ }
129
+ );
130
+
131
+ // src/components/modal/dialog.tsx
132
+ import { forwardRef as forwardRef3 } from "react";
133
+
134
+ // src/primitives/dialog.ts
135
+ import { Dialog } from "@base-ui/react/dialog";
136
+
137
+ // src/components/modal/dialog.tsx
138
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
139
+ function Dialog2(props) {
140
+ return /* @__PURE__ */ jsx3(ModalScope, { modal: props.modal, children: /* @__PURE__ */ jsx3(Dialog.Root, { ...props }) });
141
+ }
142
+ var DialogTrigger = Dialog.Trigger;
143
+ var DialogClose = Dialog.Close;
144
+ var sizes = {
145
+ sm: "max-w-sm",
146
+ md: "max-w-lg",
147
+ lg: "max-w-2xl",
148
+ xl: "max-w-4xl",
149
+ full: "max-w-[calc(100vw-2rem)]"
150
+ };
151
+ var DialogContent = forwardRef3(function DialogContent2({ size = "md", showClose = true, className, children, ...props }, ref) {
152
+ return /* @__PURE__ */ jsxs2(Dialog.Portal, { children: [
153
+ /* @__PURE__ */ jsx3(Dialog.Backdrop, { "data-azmr-backdrop": "", className: BACKDROP }),
154
+ /* @__PURE__ */ jsx3(Dialog.Viewport, { className: "fixed inset-0 z-(--z-modal) flex overflow-y-auto overscroll-contain p-4", children: /* @__PURE__ */ jsxs2(
155
+ Dialog.Popup,
156
+ {
157
+ ref,
158
+ ...useAriaModal(),
159
+ className: cn(
160
+ "relative mx-auto my-auto grid w-full gap-4 rounded-lg border border-border bg-background p-6 text-foreground shadow-elevation-4 outline-none",
161
+ "transition-[opacity,scale] duration-(--motion-duration-base) ease-standard data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
162
+ sizes[size],
163
+ className
164
+ ),
165
+ ...props,
166
+ children: [
167
+ children,
168
+ showClose && /* @__PURE__ */ jsx3(CornerClose, { as: Dialog.Close })
169
+ ]
170
+ }
171
+ ) })
172
+ ] });
173
+ });
174
+ var DialogHeader = ModalHeader;
175
+ var DialogFooter = ModalFooter;
176
+ var DialogTitle = forwardRef3(function DialogTitle2({ className, ...props }, ref) {
177
+ return /* @__PURE__ */ jsx3(Dialog.Title, { ref, className: cn(TITLE, className), ...props });
178
+ });
179
+ var DialogDescription = forwardRef3(function DialogDescription2({ className, ...props }, ref) {
180
+ return /* @__PURE__ */ jsx3(Dialog.Description, { ref, className: cn(DESCRIPTION, className), ...props });
181
+ });
182
+
183
+ // src/components/modal/drawer.tsx
184
+ import { createContext as createContext2, forwardRef as forwardRef4, useContext as useContext2 } from "react";
185
+
186
+ // src/primitives/drawer.ts
187
+ import { Drawer } from "@base-ui/react/drawer";
188
+
189
+ // src/components/modal/drawer.tsx
190
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
191
+ var SWIPE = { right: "right", left: "left", top: "up", bottom: "down" };
192
+ var SideContext = createContext2("right");
193
+ function Drawer2({ side = "right", ...props }) {
194
+ return /* @__PURE__ */ jsx4(SideContext.Provider, { value: side, children: /* @__PURE__ */ jsx4(ModalScope, { modal: props.modal, children: /* @__PURE__ */ jsx4(Drawer.Root, { swipeDirection: SWIPE[side], ...props }) }) });
195
+ }
196
+ var DrawerTrigger = Drawer.Trigger;
197
+ var DrawerClose = Drawer.Close;
198
+ var edges = {
199
+ right: "inset-y-0 right-0 h-full w-80 max-w-[calc(100vw-3rem)] border-l translate-x-(--drawer-swipe-movement-x) data-[starting-style]:translate-x-full data-[ending-style]:translate-x-full",
200
+ left: "inset-y-0 left-0 h-full w-80 max-w-[calc(100vw-3rem)] border-r translate-x-(--drawer-swipe-movement-x) data-[starting-style]:-translate-x-full data-[ending-style]:-translate-x-full",
201
+ top: "inset-x-0 top-0 max-h-[85dvh] w-full rounded-b-xl border-b translate-y-(--drawer-swipe-movement-y) data-[starting-style]:-translate-y-full data-[ending-style]:-translate-y-full",
202
+ bottom: "inset-x-0 bottom-0 max-h-[85dvh] w-full rounded-t-xl border-t translate-y-(--drawer-swipe-movement-y) data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full"
203
+ };
204
+ var DrawerContent = forwardRef4(function DrawerContent2({ showClose = true, className, children, ...props }, ref) {
205
+ const side = useContext2(SideContext);
206
+ return /* @__PURE__ */ jsxs3(Drawer.Portal, { children: [
207
+ /* @__PURE__ */ jsx4(
208
+ Drawer.Backdrop,
209
+ {
210
+ "data-azmr-backdrop": "",
211
+ className: cn(
212
+ BACKDROP,
213
+ // The scrim fades out as the drawer is swiped away; no easing while the finger is down.
214
+ "opacity-[calc(1-var(--drawer-swipe-progress,0))] duration-(--motion-duration-slow) data-[swiping]:transition-none"
215
+ )
216
+ }
217
+ ),
218
+ /* @__PURE__ */ jsx4(Drawer.Viewport, { className: "fixed inset-0 z-(--z-modal)", children: /* @__PURE__ */ jsxs3(
219
+ Drawer.Popup,
220
+ {
221
+ ref,
222
+ ...useAriaModal(),
223
+ className: cn(
224
+ "fixed flex flex-col overflow-y-auto overscroll-contain border-border bg-background p-6 text-foreground shadow-elevation-4 outline-none",
225
+ // Follows the finger exactly while swiping, then finishes on the motion tokens.
226
+ "transition-[translate] duration-(--motion-duration-slow) ease-standard data-[swiping]:transition-none",
227
+ edges[side],
228
+ className
229
+ ),
230
+ ...props,
231
+ children: [
232
+ /* @__PURE__ */ jsx4(Drawer.Content, { className: "grid gap-4", children }),
233
+ showClose && /* @__PURE__ */ jsx4(CornerClose, { as: Drawer.Close })
234
+ ]
235
+ }
236
+ ) })
237
+ ] });
238
+ });
239
+ var DrawerHeader = ModalHeader;
240
+ var DrawerFooter = ModalFooter;
241
+ var DrawerTitle = forwardRef4(function DrawerTitle2({ className, ...props }, ref) {
242
+ return /* @__PURE__ */ jsx4(Drawer.Title, { ref, className: cn(TITLE, className), ...props });
243
+ });
244
+ var DrawerDescription = forwardRef4(function DrawerDescription2({ className, ...props }, ref) {
245
+ return /* @__PURE__ */ jsx4(Drawer.Description, { ref, className: cn(DESCRIPTION, className), ...props });
246
+ });
247
+ export {
248
+ AlertDialog2 as AlertDialog,
249
+ AlertDialogAction,
250
+ AlertDialogCancel,
251
+ AlertDialogContent,
252
+ AlertDialogDescription,
253
+ AlertDialogFooter,
254
+ AlertDialogHeader,
255
+ AlertDialogTitle,
256
+ AlertDialogTrigger,
257
+ Dialog2 as Dialog,
258
+ DialogClose,
259
+ DialogContent,
260
+ DialogDescription,
261
+ DialogFooter,
262
+ DialogHeader,
263
+ DialogTitle,
264
+ DialogTrigger,
265
+ Drawer2 as Drawer,
266
+ DrawerClose,
267
+ DrawerContent,
268
+ DrawerDescription,
269
+ DrawerFooter,
270
+ DrawerHeader,
271
+ DrawerTitle,
272
+ DrawerTrigger
273
+ };