@omer-x/tailwind-ui-kit 1.0.0-alpha.42 → 1.0.0-alpha.44

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 (37) hide show
  1. package/README.md +181 -1
  2. package/dist/components/feedback/BaseToast.d.ts +72 -0
  3. package/dist/components/feedback/BaseToast.js +49 -0
  4. package/dist/components/feedback/BaseToastAction.d.ts +14 -0
  5. package/dist/components/feedback/BaseToastAction.js +10 -0
  6. package/dist/components/feedback/BaseToastArrow.d.ts +18 -0
  7. package/dist/components/feedback/BaseToastArrow.js +10 -0
  8. package/dist/components/feedback/BaseToastClose.d.ts +14 -0
  9. package/dist/components/feedback/BaseToastClose.js +10 -0
  10. package/dist/components/feedback/BaseToastContent.d.ts +17 -0
  11. package/dist/components/feedback/BaseToastContent.js +14 -0
  12. package/dist/components/feedback/BaseToastDescription.d.ts +12 -0
  13. package/dist/components/feedback/BaseToastDescription.js +10 -0
  14. package/dist/components/feedback/BaseToastTitle.d.ts +15 -0
  15. package/dist/components/feedback/BaseToastTitle.js +10 -0
  16. package/dist/components/feedback/BaseToastViewport.d.ts +21 -0
  17. package/dist/components/feedback/BaseToastViewport.js +24 -0
  18. package/dist/components/feedback/createToastManager.d.ts +6 -0
  19. package/dist/components/feedback/createToastManager.js +10 -0
  20. package/dist/components/feedback/index.d.ts +9 -0
  21. package/dist/components/feedback/index.js +4 -0
  22. package/dist/components/feedback/toastStyles.d.ts +2 -0
  23. package/dist/components/feedback/toastStyles.js +47 -0
  24. package/dist/components/feedback/toastTypes.d.ts +81 -0
  25. package/dist/components/feedback/toastTypes.js +1 -0
  26. package/dist/components/feedback/useToast.d.ts +7 -0
  27. package/dist/components/feedback/useToast.js +8 -0
  28. package/dist/components/layout/BaseSeparator.d.ts +16 -0
  29. package/dist/components/layout/BaseSeparator.js +18 -0
  30. package/dist/components/layout/index.d.ts +2 -1
  31. package/dist/components/layout/index.js +3 -1
  32. package/dist/components/menu/menuTypes.d.ts +1 -1
  33. package/dist/components/providers/ToastProvider.d.ts +23 -0
  34. package/dist/components/providers/ToastProvider.js +13 -0
  35. package/dist/components/providers/index.d.ts +2 -1
  36. package/dist/components/providers/index.js +3 -1
  37. package/package.json +5 -1
package/README.md CHANGED
@@ -459,8 +459,9 @@ const FormAlerts = () => {
459
459
  // Toasts: fire once per submission, not on every re-render
460
460
  const FormToasts = () => {
461
461
  const { messages, submissionId } = useFormMessages();
462
+ const { add } = useToast();
462
463
  useEffect(() => {
463
- messages.forEach(m => toast(m.type, m.text));
464
+ messages.forEach(m => add({ type: m.type, description: m.text }));
464
465
  }, [submissionId]);
465
466
  return null;
466
467
  };
@@ -1252,6 +1253,16 @@ import { TooltipProvider } from "@omer-x/tailwind-ui-kit/providers";
1252
1253
  | `closeDelay` | `number` | `0` | The wait before closing a tooltip, in ms. A trigger's own `closeDelay` wins |
1253
1254
  | `timeout` | `number` | `400` | A tooltip opened within this time after another one closed opens without a delay, in ms |
1254
1255
 
1256
+ #### `ToastProvider`
1257
+
1258
+ Holds the toasts of the app (or a part of it). [`useToast`](#usetoast) and [`BaseToast.Viewport`](#basetoast) work inside it. Renders no element and is also available as `BaseToast.Provider`.
1259
+
1260
+ | Prop | Type | Default | Description |
1261
+ |------|------|---------|-------------|
1262
+ | `timeout` | `number` | `5000` | Milliseconds before a toast closes by itself. `0` keeps toasts open until they are closed |
1263
+ | `limit` | `number` | `3` | The most toasts shown at once. Older ones get `data-limited`, and the kit hides them |
1264
+ | `manager` | `ToastManager` | | Shows the toasts of a [`createToastManager`](#createtoastmanager) manager |
1265
+
1255
1266
  ### `@omer-x/tailwind-ui-kit/disclosure`
1256
1267
 
1257
1268
  #### `BaseAccordion`
@@ -1485,8 +1496,177 @@ To place the parts yourself, e.g. the value inside the track, pass them as child
1485
1496
 
1486
1497
  Render functions get `MeterState`, which is empty for now. The meter sets no data attributes: style value ranges in your wrapper (e.g. pick the indicator color from `value`).
1487
1498
 
1499
+ ### `@omer-x/tailwind-ui-kit/feedback`
1500
+
1501
+ #### `BaseToast`
1502
+
1503
+ A Base UI [`Toast`](https://base-ui.com/react/components/toast): short notifications that stack in a corner of the screen and close by themselves. Toasts live in a [`ToastProvider`](#toastprovider), are created with [`useToast`](#usetoast) (or a [`createToastManager`](#createtoastmanager) manager outside React) and are shown by one `BaseToast.Viewport`, which renders each toast with your parts.
1504
+
1505
+ Theme it once, next to the provider:
1506
+
1507
+ ```tsx
1508
+ // src/components/Toasts.tsx
1509
+ "use client";
1510
+ import { BaseToast } from "@omer-x/tailwind-ui-kit/feedback";
1511
+ import { ToastProvider } from "@omer-x/tailwind-ui-kit/providers";
1512
+ import type { ReactNode } from "react";
1513
+
1514
+ const Toasts = ({ children }: { children: ReactNode }) => (
1515
+ <ToastProvider>
1516
+ {children}
1517
+ <BaseToast.Viewport>
1518
+ {toast => (
1519
+ <BaseToast
1520
+ toast={toast}
1521
+ className="rounded-md border bg-white p-4 shadow-lg data-[type=error]:border-red-300 data-[type=error]:bg-red-50"
1522
+ >
1523
+ <BaseToast.Content className="pr-6">
1524
+ <BaseToast.Title className="font-semibold" />
1525
+ <BaseToast.Description className="text-neutral-600" />
1526
+ <BaseToast.Action className="mt-2 rounded border px-2 py-1 text-xs" />
1527
+ <BaseToast.Close aria-label="Close" className="absolute top-2 right-2"><XIcon /></BaseToast.Close>
1528
+ </BaseToast.Content>
1529
+ </BaseToast>
1530
+ )}
1531
+ </BaseToast.Viewport>
1532
+ </ToastProvider>
1533
+ );
1534
+
1535
+ export default Toasts;
1536
+ ```
1537
+
1538
+ Then show toasts from any client component inside it:
1539
+
1540
+ ```tsx
1541
+ const { add } = useToast();
1542
+
1543
+ add({ title: "Saved", description: "Your changes were saved.", type: "success" });
1544
+ ```
1545
+
1546
+ | Part | Renders | Description |
1547
+ |------|---------|-------------|
1548
+ | `BaseToast.Viewport` | `<div>` | The region the toasts are shown in (`role="region"`, `aria-label="Notifications"`: pass your own `aria-label` to translate it), with its portal. Fixed to the bottom right corner (`fixed right-4 bottom-4 w-80`); move it with `className`. F6 moves focus into it. `data-expanded` while hovered or focused |
1549
+ | `BaseToast` | `<div>` | One toast (`role="dialog"`, or `"alertdialog"` for `priority: "high"`), named by its title and described by its description. In the viewport, toasts stack from the bottom: the newest in front, older ones peeking behind it, all of them spread out while the viewport is expanded. It can be swiped away. An anchored toast is placed next to its anchor instead (see below) |
1550
+ | `BaseToast.Content` | `<div>` | The toast's content. Hidden (`data-behind`) while the toast is behind another one in a collapsed stack |
1551
+ | `BaseToast.Title` | `<h2>` | Shows the toast's `title` unless it has children. Renders nothing when both are empty |
1552
+ | `BaseToast.Description` | `<p>` | Shows the toast's `description` unless it has children. Renders nothing when both are empty |
1553
+ | `BaseToast.Action` | `<button>` | Gets the toast's `actionProps` (`children`, `onClick`, …). Renders nothing without children |
1554
+ | `BaseToast.Close` | `<button>` | Closes the toast. Give it an `aria-label` when its content is an icon. It is `aria-hidden` until the viewport is expanded or focus is inside the toast |
1555
+ | `BaseToast.Arrow` | `<div>` | Points at an anchored toast's anchor. Size and draw it with `className` or `children`. `data-side`, `data-align`, `data-uncentered` |
1556
+
1557
+ Every part takes `className` and `render`.
1558
+
1559
+ `BaseToast.Viewport` props:
1560
+
1561
+ | Prop | Type | Default | Description |
1562
+ |------|------|---------|-------------|
1563
+ | `children` | `(toast: ToastObject<Data>) => ReactNode` | | Renders one toast, usually a `BaseToast` (no `key` needed) |
1564
+ | `container` | `HTMLElement \| ShadowRoot \| RefObject \| null` | `<body>` | Where the viewport is portaled to |
1565
+ | `render` | `RenderProp<"div", ToastViewportState>` | | The state is `{ expanded }` |
1566
+
1567
+ `BaseToast` props:
1568
+
1569
+ | Prop | Type | Default | Description |
1570
+ |------|------|---------|-------------|
1571
+ | `toast` | `ToastObject` | | The toast to show, from the viewport's children function |
1572
+ | `swipeDirection` | `ToastSwipeDirection \| ToastSwipeDirection[]` | `["down", "right"]` | The directions (`"up"`, `"down"`, `"left"`, `"right"`) it can be swiped to close it. Anchored toasts can't be swiped |
1573
+ | `positionerClassName` | `string` | | Classes for an anchored toast's positioner, the `<div>` that places it (`z-50`) |
1574
+ | `renderPositioner` | `RenderProp<"div", ToastPositionerState>` | | The state is `{ side, align, anchorHidden }` |
1575
+ | `render` | `RenderProp<"div", ToastState>` | | The state is `{ transitionStatus, expanded, limited, type, swiping, swipeDirection }` |
1576
+
1577
+ `Title`, `Description`, `Action` and `Close` render functions get `{ type }`. `Action` and `Close` take `nativeButton={false}` when `render` isn't a `<button>`.
1578
+
1579
+ Data attributes: every part except the viewport and the arrow has `data-type` (the toast's `type`). `BaseToast` also has `data-expanded`, `data-limited` (over the provider's `limit`; the kit hides it), `data-swiping`, `data-swipe-direction` and `data-starting-style` / `data-ending-style` during its transitions. `BaseToast.Content` has `data-expanded` and `data-behind`.
1580
+
1581
+ **Types.** `type` is any string, set as `data-type`. The kit defines no type names: style yours with `data-[type=…]:` variants. Form messages fit as they are: `add({ type: m.type, description: m.text })` for each message of [`useFormMessages`](#useformmessages) (`"error"` or `"warning"`).
1582
+
1583
+ **Anchored toasts.** A toast created with `positionerProps.anchor` is wrapped in a positioner and placed against that element, like a tooltip that closes by itself (e.g. "Copied" next to a copy button). It fades and scales in instead of stacking. Put a `BaseToast.Arrow` in it to point at the anchor:
1584
+
1585
+ ```tsx
1586
+ add({ title: "Copied", positionerProps: { anchor: buttonRef.current, side: "top", sideOffset: 8 } });
1587
+ ```
1588
+
1589
+ `positionerProps` (`ToastPositionerOptions`) takes `anchor`, `side` (`"top"`), `align` (`"center"`), `sideOffset` (`0`), `alignOffset` (`0`), `collisionPadding` (`5`), `arrowPadding` (`5`), `sticky`, `positionMethod` (`"absolute"`) and `disableAnchorTracking`. Anchored and stacked toasts usually get separate providers (and viewports) so they don't share a stack and a `limit`.
1590
+
1591
+ #### `useToast`
1592
+
1593
+ Shows, updates and closes the toasts of the surrounding `ToastProvider`. Pass a type for your toasts' custom `data`: `useToast<{ icon: string }>()`.
1594
+
1595
+ ```ts
1596
+ const { toasts, add, update, close, promise } = useToast();
1597
+
1598
+ const id = add({ title: "Uploading…", timeout: 0 });
1599
+ update(id, { title: "Uploaded", type: "success", timeout: 5000 });
1600
+ close(id); // or close() for every toast
1601
+
1602
+ await promise(upload(file), {
1603
+ loading: "Uploading…", // a string is a shortcut for { description }
1604
+ success: result => ({ title: "Uploaded", description: result.name, type: "success" }),
1605
+ error: error => ({ title: "Upload failed", type: "error" }),
1606
+ });
1607
+ ```
1608
+
1609
+ `add` options (`ToastOptions`):
1610
+
1611
+ | Option | Type | Default | Description |
1612
+ |--------|------|---------|-------------|
1613
+ | `title` | `ReactNode` | | |
1614
+ | `description` | `ReactNode` | | |
1615
+ | `type` | `string` | | Set as `data-type` |
1616
+ | `timeout` | `number` | the provider's | Milliseconds before it closes by itself. `0` keeps it open. Timers pause while the viewport is hovered or focused, or the window loses focus |
1617
+ | `priority` | `"low" \| "high"` | `"low"` | Announced politely, or urgently (`role="alertdialog"`) |
1618
+ | `id` | `string` | generated | Adding a toast with an existing `id` updates it in place and restarts its timer |
1619
+ | `actionProps` | `ComponentProps<"button">` | | Props of `BaseToast.Action` |
1620
+ | `data` | `Data` | | Your own data, e.g. to pick an icon in the viewport |
1621
+ | `onClose` | `() => void` | | Called when it starts closing |
1622
+ | `onRemove` | `() => void` | | Called when it is removed, after its exit transition |
1623
+ | `positionerProps` | `ToastPositionerOptions` | | Anchors the toast to an element |
1624
+
1625
+ `toasts` (`ToastObject[]`, newest first) are the shown toasts, with their `id`. `BaseToast.Viewport` already renders them; use it to show a count, for example.
1626
+
1627
+ #### `createToastManager`
1628
+
1629
+ Creates a toast manager (`ToastManager`, with `add`, `update`, `close` and `promise` as in `useToast`) for code outside React, such as a fetch wrapper. Give it to a provider, which shows its toasts. Calls are ignored while no provider uses it.
1630
+
1631
+ ```ts
1632
+ // src/toasts.ts
1633
+ export const toastManager = createToastManager();
1634
+
1635
+ // anywhere
1636
+ toastManager.add({ title: "Session expired", type: "error" });
1637
+ ```
1638
+
1639
+ ```tsx
1640
+ <ToastProvider manager={toastManager}>…</ToastProvider>
1641
+ ```
1642
+
1643
+ `useToast` inside that provider manages the same toasts.
1644
+
1488
1645
  ### `@omer-x/tailwind-ui-kit/layout`
1489
1646
 
1647
+ #### `BaseSeparator`
1648
+
1649
+ A Base UI [`Separator`](https://base-ui.com/react/components/separator): a `1px` line between blocks that screen readers announce. Renders a `<div>` with `role="separator"`, `aria-orientation` and `data-orientation`. It has no color: give it one with `className`.
1650
+
1651
+ ```tsx
1652
+ import { BaseSeparator } from "@omer-x/tailwind-ui-kit/layout";
1653
+
1654
+ <BaseSeparator className="bg-neutral-300" />
1655
+
1656
+ <nav className="flex items-center gap-3">
1657
+ <a href="/">Home</a>
1658
+ <BaseSeparator orientation="vertical" className="h-4 bg-neutral-300" />
1659
+ <a href="/pricing">Pricing</a>
1660
+ </nav>
1661
+ ```
1662
+
1663
+ | Prop | Type | Default | Description |
1664
+ |------|------|---------|-------------|
1665
+ | `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Horizontal: `h-px w-full`. Vertical: `w-px self-stretch` (the height of its flex row; set a height with `className` otherwise) |
1666
+ | `render` | `RenderProp<"div", SeparatorState>` | | The state is `{ orientation }`. E.g. `render={<hr />}` (add `border-0`: Tailwind's preflight gives `<hr>` a top border) |
1667
+
1668
+ Style each orientation with `data-[orientation=vertical]:…`.
1669
+
1490
1670
  #### `Container`
1491
1671
 
1492
1672
  Tailwind's `container`, centered with horizontal padding (`container mx-auto px-3`). Accepts all `<div>` props.
@@ -0,0 +1,72 @@
1
+ import { ToastAlign, ToastManager, ToastObject, ToastSide, ToastSwipeDirection } from "./toastTypes.js";
2
+ import { ToastViewportState } from "./BaseToastViewport.js";
3
+ import { ToastContentState } from "./BaseToastContent.js";
4
+ import { ToastPartState } from "./BaseToastTitle.js";
5
+ import { ToastArrowState } from "./BaseToastArrow.js";
6
+ import { RenderProp } from "../../utils/render.js";
7
+ import { ComponentProps } from "react";
8
+ export type ToastState = {
9
+ /** `"starting"` while it enters, `"ending"` while it leaves. */
10
+ transitionStatus: "starting" | "ending" | "idle" | undefined;
11
+ /** Whether the viewport's stack is expanded (hovered or focused). */
12
+ expanded: boolean;
13
+ /** Whether it is hidden because more than `limit` toasts are shown. */
14
+ limited: boolean;
15
+ type: string | undefined;
16
+ swiping: boolean;
17
+ swipeDirection: ToastSwipeDirection | undefined;
18
+ };
19
+ export type ToastPositionerState = {
20
+ side: ToastSide;
21
+ align: ToastAlign;
22
+ /** Whether the anchor is scrolled out of view. */
23
+ anchorHidden: boolean;
24
+ };
25
+ type BaseToastProps = ComponentProps<"div"> & {
26
+ /** The toast to show, from `BaseToast.Viewport`'s children function (or `useToast().toasts`). */
27
+ toast: ToastObject<object>;
28
+ render?: RenderProp<"div", ToastState>;
29
+ /**
30
+ * The directions it can be swiped to close it. Anchored toasts can't be swiped.
31
+ * @default ["down", "right"]
32
+ */
33
+ swipeDirection?: ToastSwipeDirection | ToastSwipeDirection[];
34
+ /** Classes for the positioner, the `<div>` that places an anchored toast. */
35
+ positionerClassName?: string;
36
+ /** Style or replace an anchored toast's positioner. A `className` on the element wins over the kit's conflicting classes. */
37
+ renderPositioner?: RenderProp<"div", ToastPositionerState>;
38
+ };
39
+ declare const _default: (({ toast, swipeDirection, positionerClassName, renderPositioner, className, ...otherProps }: BaseToastProps) => import("react").JSX.Element) & {
40
+ Provider: <Data extends object = object>({ manager, ...otherProps }: {
41
+ children?: import("react").ReactNode;
42
+ timeout?: number;
43
+ limit?: number;
44
+ manager?: ToastManager<Data> | undefined;
45
+ }) => import("react").JSX.Element;
46
+ Viewport: <Data extends object = object>({ container, children, className, ...otherProps }: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "children"> & {
47
+ render?: RenderProp<"div", ToastViewportState>;
48
+ container?: HTMLElement | ShadowRoot | import("react").RefObject<HTMLElement | ShadowRoot | null> | null;
49
+ children: (toast: ToastObject<Data>) => import("react").ReactNode;
50
+ }) => import("react").JSX.Element;
51
+ Content: ({ className, ...otherProps }: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
52
+ render?: RenderProp<"div", ToastContentState>;
53
+ }) => import("react").JSX.Element;
54
+ Title: (props: import("react").ClassAttributes<HTMLHeadingElement> & import("react").HTMLAttributes<HTMLHeadingElement> & {
55
+ render?: RenderProp<"h2", ToastPartState>;
56
+ }) => import("react").JSX.Element;
57
+ Description: (props: import("react").ClassAttributes<HTMLParagraphElement> & import("react").HTMLAttributes<HTMLParagraphElement> & {
58
+ render?: RenderProp<"p", ToastPartState>;
59
+ }) => import("react").JSX.Element;
60
+ Action: (props: import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
61
+ render?: RenderProp<"button", ToastPartState>;
62
+ nativeButton?: boolean;
63
+ }) => import("react").JSX.Element;
64
+ Close: (props: import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
65
+ render?: RenderProp<"button", ToastPartState>;
66
+ nativeButton?: boolean;
67
+ }) => import("react").JSX.Element;
68
+ Arrow: (props: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
69
+ render?: RenderProp<"div", ToastArrowState>;
70
+ }) => import("react").JSX.Element;
71
+ };
72
+ export { _default as default };
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ import { cn } from "cn";
4
+ import { splitClassName } from "../../utils/split-class-name.js";
5
+ import ToastProvider from "../providers/ToastProvider.js";
6
+ import BaseToastAction from "./BaseToastAction.js";
7
+ import BaseToastArrow from "./BaseToastArrow.js";
8
+ import BaseToastClose from "./BaseToastClose.js";
9
+ import BaseToastContent from "./BaseToastContent.js";
10
+ import BaseToastDescription from "./BaseToastDescription.js";
11
+ import BaseToastTitle from "./BaseToastTitle.js";
12
+ import BaseToastViewport from "./BaseToastViewport.js";
13
+ import { anchoredToastClassName, stackedToastClassName } from "./toastStyles.js";
14
+ import { jsx } from "react/jsx-runtime";
15
+ // src/components/feedback/BaseToast.tsx
16
+ /**
17
+ * One toast. Renders a `<div>` (`role="dialog"`, or `"alertdialog"` for `priority: "high"`)
18
+ * with `data-type`, `data-expanded`, `data-limited`, `data-swiping`, `data-swipe-direction` and transition attributes.
19
+ * In the viewport, toasts stack; a toast with `positionerProps.anchor` is placed against its anchor instead.
20
+ */
21
+ const BaseToast = ({ toast, swipeDirection, positionerClassName, renderPositioner, className, ...otherProps }) => {
22
+ const baseUIToast = toast;
23
+ const anchored = toast.positionerProps?.anchor !== void 0;
24
+ const root = /* @__PURE__ */ jsx(Toast.Root, {
25
+ ...otherProps,
26
+ toast: baseUIToast,
27
+ swipeDirection,
28
+ className: cn(anchored ? anchoredToastClassName : stackedToastClassName, className)
29
+ });
30
+ if (!anchored) return root;
31
+ const positionerElement = splitClassName(renderPositioner);
32
+ return /* @__PURE__ */ jsx(Toast.Positioner, {
33
+ toast: baseUIToast,
34
+ render: positionerElement.render,
35
+ className: cn("z-50", positionerClassName, positionerElement.className),
36
+ children: root
37
+ });
38
+ };
39
+ var BaseToast_default = Object.assign(BaseToast, {
40
+ Provider: ToastProvider,
41
+ Viewport: BaseToastViewport,
42
+ Content: BaseToastContent,
43
+ Title: BaseToastTitle,
44
+ Description: BaseToastDescription,
45
+ Action: BaseToastAction,
46
+ Close: BaseToastClose,
47
+ Arrow: BaseToastArrow
48
+ });
49
+ export { BaseToast_default as default };
@@ -0,0 +1,14 @@
1
+ import { ToastPartState } from "./BaseToastTitle.js";
2
+ import { RenderProp } from "../../utils/render.js";
3
+ import { ComponentProps } from "react";
4
+ type BaseToastActionProps = ComponentProps<"button"> & {
5
+ render?: RenderProp<"button", ToastPartState>;
6
+ /** Set to `false` when `render` doesn't render a `<button>`. */
7
+ nativeButton?: boolean;
8
+ };
9
+ /**
10
+ * A button for the toast's action. The toast's `actionProps` are merged into it, and it renders nothing without children.
11
+ * Renders a `<button>` with `data-type`.
12
+ */
13
+ declare const BaseToastAction: (props: BaseToastActionProps) => import("react").JSX.Element;
14
+ export { BaseToastAction as default };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/feedback/BaseToastAction.tsx
5
+ /**
6
+ * A button for the toast's action. The toast's `actionProps` are merged into it, and it renders nothing without children.
7
+ * Renders a `<button>` with `data-type`.
8
+ */
9
+ const BaseToastAction = (props) => /* @__PURE__ */ jsx(Toast.Action, { ...props });
10
+ export { BaseToastAction as default };
@@ -0,0 +1,18 @@
1
+ import { ToastAlign, ToastSide } from "./toastTypes.js";
2
+ import { RenderProp } from "../../utils/render.js";
3
+ import { ComponentProps } from "react";
4
+ export type ToastArrowState = {
5
+ side: ToastSide;
6
+ align: ToastAlign;
7
+ /** Whether the arrow can't point at the center of the anchor. */
8
+ uncentered: boolean;
9
+ };
10
+ type BaseToastArrowProps = ComponentProps<"div"> & {
11
+ render?: RenderProp<"div", ToastArrowState>;
12
+ };
13
+ /**
14
+ * An arrow that points at an anchored toast's anchor. Put it inside `BaseToast`.
15
+ * Renders a `<div>` with `data-side` and `data-align`. Size and draw it with `className` or `children`.
16
+ */
17
+ declare const BaseToastArrow: (props: BaseToastArrowProps) => import("react").JSX.Element;
18
+ export { BaseToastArrow as default };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/feedback/BaseToastArrow.tsx
5
+ /**
6
+ * An arrow that points at an anchored toast's anchor. Put it inside `BaseToast`.
7
+ * Renders a `<div>` with `data-side` and `data-align`. Size and draw it with `className` or `children`.
8
+ */
9
+ const BaseToastArrow = (props) => /* @__PURE__ */ jsx(Toast.Arrow, { ...props });
10
+ export { BaseToastArrow as default };
@@ -0,0 +1,14 @@
1
+ import { ToastPartState } from "./BaseToastTitle.js";
2
+ import { RenderProp } from "../../utils/render.js";
3
+ import { ComponentProps } from "react";
4
+ type BaseToastCloseProps = ComponentProps<"button"> & {
5
+ render?: RenderProp<"button", ToastPartState>;
6
+ /** Set to `false` when `render` doesn't render a `<button>`. */
7
+ nativeButton?: boolean;
8
+ };
9
+ /**
10
+ * A button that closes the toast. Give it an `aria-label` when its content is an icon.
11
+ * Renders a `<button>` with `data-type`.
12
+ */
13
+ declare const BaseToastClose: (props: BaseToastCloseProps) => import("react").JSX.Element;
14
+ export { BaseToastClose as default };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/feedback/BaseToastClose.tsx
5
+ /**
6
+ * A button that closes the toast. Give it an `aria-label` when its content is an icon.
7
+ * Renders a `<button>` with `data-type`.
8
+ */
9
+ const BaseToastClose = (props) => /* @__PURE__ */ jsx(Toast.Close, { ...props });
10
+ export { BaseToastClose as default };
@@ -0,0 +1,17 @@
1
+ import { RenderProp } from "../../utils/render.js";
2
+ import { ComponentProps } from "react";
3
+ export type ToastContentState = {
4
+ /** Whether the viewport's stack is expanded. */
5
+ expanded: boolean;
6
+ /** Whether the toast is behind the frontmost one in a collapsed stack. */
7
+ behind: boolean;
8
+ };
9
+ type BaseToastContentProps = ComponentProps<"div"> & {
10
+ render?: RenderProp<"div", ToastContentState>;
11
+ };
12
+ /**
13
+ * The toast's content. Hidden while the toast is behind another one in a collapsed stack.
14
+ * Renders a `<div>` with `data-behind` and `data-expanded`.
15
+ */
16
+ declare const BaseToastContent: ({ className, ...otherProps }: BaseToastContentProps) => import("react").JSX.Element;
17
+ export { BaseToastContent as default };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ import { cn } from "cn";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/components/feedback/BaseToastContent.tsx
6
+ /**
7
+ * The toast's content. Hidden while the toast is behind another one in a collapsed stack.
8
+ * Renders a `<div>` with `data-behind` and `data-expanded`.
9
+ */
10
+ const BaseToastContent = ({ className, ...otherProps }) => /* @__PURE__ */ jsx(Toast.Content, {
11
+ ...otherProps,
12
+ className: cn("overflow-hidden", "transition-opacity", "duration-250", "data-behind:pointer-events-none", "data-behind:opacity-0", "data-expanded:pointer-events-auto", "data-expanded:opacity-100", className)
13
+ });
14
+ export { BaseToastContent as default };
@@ -0,0 +1,12 @@
1
+ import { ToastPartState } from "./BaseToastTitle.js";
2
+ import { RenderProp } from "../../utils/render.js";
3
+ import { ComponentProps } from "react";
4
+ type BaseToastDescriptionProps = ComponentProps<"p"> & {
5
+ render?: RenderProp<"p", ToastPartState>;
6
+ };
7
+ /**
8
+ * The toast's message, which also describes the toast. Shows the toast's `description` unless it has children,
9
+ * and renders nothing when both are empty. Renders a `<p>` with `data-type`.
10
+ */
11
+ declare const BaseToastDescription: (props: BaseToastDescriptionProps) => import("react").JSX.Element;
12
+ export { BaseToastDescription as default };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/feedback/BaseToastDescription.tsx
5
+ /**
6
+ * The toast's message, which also describes the toast. Shows the toast's `description` unless it has children,
7
+ * and renders nothing when both are empty. Renders a `<p>` with `data-type`.
8
+ */
9
+ const BaseToastDescription = (props) => /* @__PURE__ */ jsx(Toast.Description, { ...props });
10
+ export { BaseToastDescription as default };
@@ -0,0 +1,15 @@
1
+ import { RenderProp } from "../../utils/render.js";
2
+ import { ComponentProps } from "react";
3
+ /** The state of the toast's title, description, action and close button. */
4
+ export type ToastPartState = {
5
+ type: string | undefined;
6
+ };
7
+ type BaseToastTitleProps = ComponentProps<"h2"> & {
8
+ render?: RenderProp<"h2", ToastPartState>;
9
+ };
10
+ /**
11
+ * The toast's heading, which also names the toast. Shows the toast's `title` unless it has children,
12
+ * and renders nothing when both are empty. Renders an `<h2>` with `data-type`.
13
+ */
14
+ declare const BaseToastTitle: (props: BaseToastTitleProps) => import("react").JSX.Element;
15
+ export { BaseToastTitle as default };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/feedback/BaseToastTitle.tsx
5
+ /**
6
+ * The toast's heading, which also names the toast. Shows the toast's `title` unless it has children,
7
+ * and renders nothing when both are empty. Renders an `<h2>` with `data-type`.
8
+ */
9
+ const BaseToastTitle = (props) => /* @__PURE__ */ jsx(Toast.Title, { ...props });
10
+ export { BaseToastTitle as default };
@@ -0,0 +1,21 @@
1
+ import { ComponentProps, ReactNode, RefObject } from "react";
2
+ import { ToastObject } from "./toastTypes.js";
3
+ import { RenderProp } from "../../utils/render.js";
4
+ export type ToastViewportState = {
5
+ /** Whether the stack is expanded (hovered or focused). */
6
+ expanded: boolean;
7
+ };
8
+ type BaseToastViewportProps<Data extends object> = Omit<ComponentProps<"div">, "children"> & {
9
+ render?: RenderProp<"div", ToastViewportState>;
10
+ /** Where the viewport is portaled to. Defaults to `<body>`. */
11
+ container?: HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null;
12
+ /** Renders one toast, usually a `BaseToast`. Called for every toast of the provider. */
13
+ children: (toast: ToastObject<Data>) => ReactNode;
14
+ };
15
+ /**
16
+ * The region the toasts are shown in, with its portal. Put it once inside `ToastProvider`.
17
+ * Renders a `<div>` fixed to the bottom right corner (move it with `className`) with `data-expanded`.
18
+ * F6 moves focus into it.
19
+ */
20
+ declare const BaseToastViewport: <Data extends object = object>({ container, children, className, ...otherProps }: BaseToastViewportProps<Data>) => import("react").JSX.Element;
21
+ export { BaseToastViewport as default };
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ import { cn } from "cn";
4
+ import { Fragment } from "react";
5
+ import useToast from "./useToast.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+ // src/components/feedback/BaseToastViewport.tsx
8
+ /**
9
+ * The region the toasts are shown in, with its portal. Put it once inside `ToastProvider`.
10
+ * Renders a `<div>` fixed to the bottom right corner (move it with `className`) with `data-expanded`.
11
+ * F6 moves focus into it.
12
+ */
13
+ const BaseToastViewport = ({ container, children, className, ...otherProps }) => {
14
+ const { toasts } = useToast();
15
+ return /* @__PURE__ */ jsx(Toast.Portal, {
16
+ container,
17
+ children: /* @__PURE__ */ jsx(Toast.Viewport, {
18
+ ...otherProps,
19
+ className: cn("fixed", "right-4", "bottom-4", "z-50", "w-80", "max-w-[calc(100vw-2rem)]", "outline-hidden", className),
20
+ children: toasts.map((toast) => /* @__PURE__ */ jsx(Fragment, { children: children(toast) }, toast.id))
21
+ })
22
+ });
23
+ };
24
+ export { BaseToastViewport as default };
@@ -0,0 +1,6 @@
1
+ import { ToastManager } from "./toastTypes.js";
2
+ /**
3
+ * Creates a toast manager to show toasts from outside React (e.g. a fetch wrapper).
4
+ * Pass it to `ToastProvider`'s `manager`. Calls are ignored while no provider uses it.
5
+ */
6
+ export default function createToastManager<Data extends object = object>(): ToastManager<Data>;
@@ -0,0 +1,10 @@
1
+ import { Toast } from "@base-ui/react/toast";
2
+ // src/components/feedback/createToastManager.ts
3
+ /**
4
+ * Creates a toast manager to show toasts from outside React (e.g. a fetch wrapper).
5
+ * Pass it to `ToastProvider`'s `manager`. Calls are ignored while no provider uses it.
6
+ */
7
+ function createToastManager() {
8
+ return Toast.createToastManager();
9
+ }
10
+ export { createToastManager as default };
@@ -0,0 +1,9 @@
1
+ import _default, { ToastPositionerState, ToastState } from "./BaseToast.js";
2
+ import createToastManager from "./createToastManager.js";
3
+ import useToast, { UseToastReturn } from "./useToast.js";
4
+ import { ToastArrowState } from "./BaseToastArrow.js";
5
+ import { ToastContentState } from "./BaseToastContent.js";
6
+ import { ToastPartState } from "./BaseToastTitle.js";
7
+ import { ToastViewportState } from "./BaseToastViewport.js";
8
+ import { ToastAlign, ToastManager, ToastObject, ToastOptions, ToastPositionerOptions, ToastPromiseOptions, ToastSide, ToastSwipeDirection, ToastUpdate } from "./toastTypes.js";
9
+ export { _default as BaseToast, type ToastAlign, type ToastArrowState, type ToastContentState, type ToastManager, type ToastObject, type ToastOptions, type ToastPartState, type ToastPositionerOptions, type ToastPositionerState, type ToastPromiseOptions, type ToastSide, type ToastState, type ToastSwipeDirection, type ToastUpdate, type ToastViewportState, type UseToastReturn, createToastManager, useToast };
@@ -0,0 +1,4 @@
1
+ import BaseToast_default from "./BaseToast.js";
2
+ import createToastManager from "./createToastManager.js";
3
+ import useToast from "./useToast.js";
4
+ export { BaseToast_default as BaseToast, createToastManager, useToast };
@@ -0,0 +1,2 @@
1
+ export declare const stackedToastClassName: string[];
2
+ export declare const anchoredToastClassName: string[];
@@ -0,0 +1,47 @@
1
+ // src/components/feedback/toastStyles.ts
2
+ const stackedToastClassName = [
3
+ "absolute",
4
+ "right-0",
5
+ "bottom-0",
6
+ "w-full",
7
+ "origin-bottom",
8
+ "select-none",
9
+ "[--gap:0.75rem]",
10
+ "[--peek:0.75rem]",
11
+ "[--scale:max(0,1-var(--toast-index)*0.1)]",
12
+ "[--shrink:calc(1-var(--scale))]",
13
+ "[--height:var(--toast-frontmost-height,var(--toast-height))]",
14
+ "[--offset-y:calc(var(--toast-offset-y)*-1-var(--toast-index)*var(--gap)+var(--toast-swipe-movement-y))]",
15
+ "z-[calc(1000-var(--toast-index))]",
16
+ "h-(--height)",
17
+ "data-expanded:h-(--toast-height)",
18
+ "[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-var(--toast-index)*var(--peek)-var(--shrink)*var(--height)))_scale(var(--scale))]",
19
+ "data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]",
20
+ "after:absolute",
21
+ "after:top-full",
22
+ "after:left-0",
23
+ "after:h-[calc(var(--gap)+1px)]",
24
+ "after:w-full",
25
+ "after:content-['']",
26
+ "transition-[transform,opacity,height]",
27
+ "duration-500",
28
+ "ease-[cubic-bezier(0.22,1,0.36,1)]",
29
+ "data-limited:opacity-0",
30
+ "data-starting-style:[transform:translateY(150%)]",
31
+ "data-ending-style:opacity-0",
32
+ "[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",
33
+ "data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
34
+ "data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
35
+ "data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
36
+ "data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]"
37
+ ];
38
+ const anchoredToastClassName = [
39
+ "origin-(--transform-origin)",
40
+ "transition-[scale,opacity]",
41
+ "duration-150",
42
+ "data-ending-style:scale-90",
43
+ "data-ending-style:opacity-0",
44
+ "data-starting-style:scale-90",
45
+ "data-starting-style:opacity-0"
46
+ ];
47
+ export { anchoredToastClassName, stackedToastClassName };
@@ -0,0 +1,81 @@
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ export type ToastSide = "top" | "bottom" | "left" | "right" | "inline-start" | "inline-end";
3
+ export type ToastAlign = "start" | "center" | "end";
4
+ export type ToastSwipeDirection = "up" | "down" | "left" | "right";
5
+ /** Places a toast against an element instead of stacking it in the viewport. */
6
+ export type ToastPositionerOptions = {
7
+ /** The element the toast is placed against. Setting it makes the toast anchored. */
8
+ anchor?: Element | null;
9
+ /** The side of the anchor the toast is placed on. It flips when there's no room. @default "top" */
10
+ side?: ToastSide;
11
+ /** How the toast is aligned to that side. @default "center" */
12
+ align?: ToastAlign;
13
+ /** The gap between the anchor and the toast, in pixels. @default 0 */
14
+ sideOffset?: number;
15
+ /** Moves the toast along the anchor's side, in pixels. @default 0 */
16
+ alignOffset?: number;
17
+ /** The space kept between the toast and the edges of the viewport, in pixels. @default 5 */
18
+ collisionPadding?: number | {
19
+ top?: number;
20
+ right?: number;
21
+ bottom?: number;
22
+ left?: number;
23
+ };
24
+ /** The minimum distance between an `Arrow` and the toast's corners, in pixels. @default 5 */
25
+ arrowPadding?: number;
26
+ /** Keeps the toast in view while its anchor scrolls out of view. */
27
+ sticky?: boolean;
28
+ /** The CSS `position` of the positioner. @default "absolute" */
29
+ positionMethod?: "absolute" | "fixed";
30
+ /** Stops following the anchor when it moves (e.g. on scroll). */
31
+ disableAnchorTracking?: boolean;
32
+ };
33
+ /** What a toast is created with. */
34
+ export type ToastOptions<Data extends object = object> = {
35
+ /** Adding a toast with an existing `id` updates it in place and restarts its timer. */
36
+ id?: string;
37
+ title?: ReactNode;
38
+ description?: ReactNode;
39
+ /** Any string. It is set as `data-type` on the toast and its parts, e.g. `"success"` or a form message's type. */
40
+ type?: string;
41
+ /** Milliseconds before the toast closes by itself. `0` keeps it open. Defaults to the provider's `timeout`. */
42
+ timeout?: number;
43
+ /**
44
+ * How screen readers announce it: `"low"` politely, `"high"` urgently.
45
+ * @default "low"
46
+ */
47
+ priority?: "low" | "high";
48
+ /** Your own data, e.g. to pick an icon. */
49
+ data?: Data;
50
+ /** Props of `BaseToast.Action`. It renders only when this has `children`. */
51
+ actionProps?: ComponentPropsWithoutRef<"button">;
52
+ /** Called when the toast starts closing. */
53
+ onClose?: () => void;
54
+ /** Called when the toast is removed, after its exit transition. */
55
+ onRemove?: () => void;
56
+ /** Anchors the toast to an element. Only `anchor` is required. */
57
+ positionerProps?: ToastPositionerOptions;
58
+ };
59
+ /** A toast in the provider's list. `BaseToast.Viewport` passes each one to its children. */
60
+ export type ToastObject<Data extends object = object> = Omit<ToastOptions<Data>, "id"> & {
61
+ id: string;
62
+ };
63
+ /** The fields to change on an existing toast. */
64
+ export type ToastUpdate<Data extends object = object> = Omit<ToastOptions<Data>, "id">;
65
+ /** A string is a shortcut for `{ description }`. */
66
+ export type ToastPromiseOptions<Value, Data extends object = object> = {
67
+ loading: string | ToastUpdate<Data>;
68
+ success: string | ToastUpdate<Data> | ((result: Value) => string | ToastUpdate<Data>);
69
+ error: string | ToastUpdate<Data> | ((error: unknown) => string | ToastUpdate<Data>);
70
+ };
71
+ /** Creates, updates and closes toasts. */
72
+ export type ToastManager<Data extends object = object> = {
73
+ /** Shows a toast and returns its `id`. */
74
+ add: (options: ToastOptions<Data>) => string;
75
+ /** Closes the toast with this `id`, or every toast without one. */
76
+ close: (id?: string) => void;
77
+ /** Changes an existing toast. */
78
+ update: (id: string, updates: ToastUpdate<Data> | ((toast: ToastObject<Data>) => ToastUpdate<Data>)) => void;
79
+ /** Shows a loading toast that turns into a success or error toast when the promise settles. Returns the promise. */
80
+ promise: <Value>(promise: Promise<Value>, options: ToastPromiseOptions<Value, Data>) => Promise<Value>;
81
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { ToastManager, ToastObject } from "./toastTypes.js";
2
+ export type UseToastReturn<Data extends object = object> = ToastManager<Data> & {
3
+ /** The toasts that are shown (or still transitioning out), newest first. */
4
+ toasts: ToastObject<Data>[];
5
+ };
6
+ /** Shows, updates and closes toasts. Call it inside `ToastProvider`. */
7
+ export default function useToast<Data extends object = object>(): UseToastReturn<Data>;
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ // src/components/feedback/useToast.ts
4
+ /** Shows, updates and closes toasts. Call it inside `ToastProvider`. */
5
+ function useToast() {
6
+ return Toast.useToastManager();
7
+ }
8
+ export { useToast as default };
@@ -0,0 +1,16 @@
1
+ import { RenderProp } from "../../utils/render.js";
2
+ import { ComponentProps } from "react";
3
+ export type SeparatorState = {
4
+ orientation: "horizontal" | "vertical";
5
+ };
6
+ type BaseSeparatorProps = ComponentProps<"div"> & {
7
+ render?: RenderProp<"div", SeparatorState>;
8
+ /** @default "horizontal" */
9
+ orientation?: "horizontal" | "vertical";
10
+ };
11
+ /**
12
+ * A `1px` line that screen readers announce. Renders a `<div>` with `role="separator"`,
13
+ * `aria-orientation` and `data-orientation`. Give it a color with `className`.
14
+ */
15
+ declare const BaseSeparator: ({ orientation, className, ...otherProps }: BaseSeparatorProps) => import("react").JSX.Element;
16
+ export { BaseSeparator as default };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { Separator } from "@base-ui/react/separator";
3
+ import { cn } from "cn";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/components/layout/BaseSeparator.tsx
6
+ /**
7
+ * A `1px` line that screen readers announce. Renders a `<div>` with `role="separator"`,
8
+ * `aria-orientation` and `data-orientation`. Give it a color with `className`.
9
+ */
10
+ const BaseSeparator = ({ orientation = "horizontal", className, ...otherProps }) => /* @__PURE__ */ jsx(Separator, {
11
+ ...otherProps,
12
+ orientation,
13
+ className: cn("shrink-0", {
14
+ "h-px w-full": orientation === "horizontal",
15
+ "w-px self-stretch": orientation === "vertical"
16
+ }, className)
17
+ });
18
+ export { BaseSeparator as default };
@@ -1,2 +1,3 @@
1
+ import BaseSeparator, { SeparatorState } from "./BaseSeparator.js";
1
2
  import Container from "./Container.js";
2
- export { Container };
3
+ export { BaseSeparator, Container, type SeparatorState };
@@ -1 +1,3 @@
1
- export { default as Container } from "./Container.js";
1
+ import BaseSeparator from "./BaseSeparator.js";
2
+ import Container from "./Container.js";
3
+ export { BaseSeparator, Container };
@@ -65,5 +65,5 @@ export declare function splitFilterProps<Props extends MenuRootSharedProps>({ fi
65
65
  event: Event | undefined;
66
66
  }) => void) | undefined;
67
67
  } | null;
68
- rootProps: Omit<Props, "filter" | "locale" | "autoHighlight" | "filterable" | "query" | "defaultQuery" | "onQueryChange">;
68
+ rootProps: Omit<Props, "filter" | "locale" | "filterable" | "autoHighlight" | "query" | "defaultQuery" | "onQueryChange">;
69
69
  };
@@ -0,0 +1,23 @@
1
+ import { ToastManager } from "../feedback/toastTypes.js";
2
+ import { ReactNode } from "react";
3
+ type ToastProviderProps<Data extends object> = {
4
+ children?: ReactNode;
5
+ /**
6
+ * Milliseconds before a toast closes by itself. `0` keeps toasts open until they are closed.
7
+ * @default 5000
8
+ */
9
+ timeout?: number;
10
+ /**
11
+ * The most toasts shown at once. Older ones get `data-limited` (the kit hides them).
12
+ * @default 3
13
+ */
14
+ limit?: number;
15
+ /** Shows the toasts of a manager made with `createToastManager()`, e.g. to add toasts from outside React. */
16
+ manager?: ToastManager<Data>;
17
+ };
18
+ /**
19
+ * Holds the toasts of an app (or a part of it). `useToast` and `BaseToast.Viewport` work inside it.
20
+ * Renders no element.
21
+ */
22
+ declare const ToastProvider: <Data extends object = object>({ manager, ...otherProps }: ToastProviderProps<Data>) => import("react").JSX.Element;
23
+ export { ToastProvider as default };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { Toast } from "@base-ui/react/toast";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/providers/ToastProvider.tsx
5
+ /**
6
+ * Holds the toasts of an app (or a part of it). `useToast` and `BaseToast.Viewport` work inside it.
7
+ * Renders no element.
8
+ */
9
+ const ToastProvider = ({ manager, ...otherProps }) => /* @__PURE__ */ jsx(Toast.Provider, {
10
+ ...otherProps,
11
+ toastManager: manager
12
+ });
13
+ export { ToastProvider as default };
@@ -1,2 +1,3 @@
1
+ import ToastProvider from "./ToastProvider.js";
1
2
  import TooltipProvider from "./TooltipProvider.js";
2
- export { TooltipProvider };
3
+ export { ToastProvider, TooltipProvider };
@@ -1 +1,3 @@
1
- export { default as TooltipProvider } from "./TooltipProvider.js";
1
+ import ToastProvider from "./ToastProvider.js";
2
+ import TooltipProvider from "./TooltipProvider.js";
3
+ export { ToastProvider, TooltipProvider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omer-x/tailwind-ui-kit",
3
- "version": "1.0.0-alpha.42",
3
+ "version": "1.0.0-alpha.44",
4
4
  "description": "Tailwind CSS-based React component library for building user interfaces",
5
5
  "keywords": [
6
6
  "tailwind",
@@ -82,6 +82,10 @@
82
82
  "types": "./dist/components/elements/index.d.ts",
83
83
  "import": "./dist/components/elements/index.js"
84
84
  },
85
+ "./feedback": {
86
+ "types": "./dist/components/feedback/index.d.ts",
87
+ "import": "./dist/components/feedback/index.js"
88
+ },
85
89
  "./hooks": {
86
90
  "types": "./dist/hooks/index.d.ts",
87
91
  "import": "./dist/hooks/index.js"