jenosize-ui 0.1.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.
- package/LICENSE +28 -0
- package/README.md +100 -0
- package/THIRD-PARTY-NOTICES.md +163 -0
- package/dist/Button-Bt7pzM4R.d.ts +82 -0
- package/dist/PaymentInput-CKPIPNWH.d.ts +141 -0
- package/dist/Select-CVbEQ2Ep.d.ts +118 -0
- package/dist/TagInput-CTJYOB4J.d.ts +90 -0
- package/dist/avatar.d.ts +161 -0
- package/dist/avatar.js +11 -0
- package/dist/badge.d.ts +109 -0
- package/dist/badge.js +10 -0
- package/dist/breadcrumb.d.ts +58 -0
- package/dist/breadcrumb.js +7 -0
- package/dist/button.d.ts +54 -0
- package/dist/button.js +14 -0
- package/dist/calendar.d.ts +368 -0
- package/dist/calendar.js +21 -0
- package/dist/callout.d.ts +70 -0
- package/dist/callout.js +16 -0
- package/dist/card-nWicloNi.d.ts +80 -0
- package/dist/card.d.ts +2 -0
- package/dist/card.js +7 -0
- package/dist/checkbox.d.ts +133 -0
- package/dist/checkbox.js +11 -0
- package/dist/chunk-24TO7E32.js +42 -0
- package/dist/chunk-3Y5X7B5C.js +146 -0
- package/dist/chunk-4OLULPQG.js +202 -0
- package/dist/chunk-4P2NBLBW.js +103 -0
- package/dist/chunk-52IFGFTL.js +11 -0
- package/dist/chunk-5FATN5YD.js +115 -0
- package/dist/chunk-5NOBSXJN.js +297 -0
- package/dist/chunk-5RAPA22E.js +106 -0
- package/dist/chunk-7EUAMHMU.js +16 -0
- package/dist/chunk-7EWQKTNQ.js +1336 -0
- package/dist/chunk-7HOIZ3UO.js +110 -0
- package/dist/chunk-7IU5TMFL.js +452 -0
- package/dist/chunk-7JBNLEJ7.js +29 -0
- package/dist/chunk-7S2TBALK.js +23 -0
- package/dist/chunk-BJUZVYQC.js +188 -0
- package/dist/chunk-BVJWBYIG.js +66 -0
- package/dist/chunk-CME4DIML.js +65 -0
- package/dist/chunk-CYPPEUX5.js +73 -0
- package/dist/chunk-D5BTFSL7.js +71 -0
- package/dist/chunk-D6TPWNRK.js +387 -0
- package/dist/chunk-DJSXIAFH.js +66 -0
- package/dist/chunk-DRZCJCBO.js +46 -0
- package/dist/chunk-DWKILXHE.js +17 -0
- package/dist/chunk-E7ZSWBAK.js +70 -0
- package/dist/chunk-EDSK6FEH.js +8 -0
- package/dist/chunk-F2K7VJUV.js +114 -0
- package/dist/chunk-F6NLE6XJ.js +40 -0
- package/dist/chunk-FHHAPGCR.js +32 -0
- package/dist/chunk-FXIBGTS5.js +14 -0
- package/dist/chunk-GCVA3OIV.js +72 -0
- package/dist/chunk-GFOAJVW5.js +336 -0
- package/dist/chunk-GRLSUQQE.js +136 -0
- package/dist/chunk-GTHJWR3Q.js +77 -0
- package/dist/chunk-HMUZE6EK.js +67 -0
- package/dist/chunk-I7WU4GTY.js +503 -0
- package/dist/chunk-J2BCKBHC.js +151 -0
- package/dist/chunk-J36M3KRX.js +1315 -0
- package/dist/chunk-J7ZQQFPT.js +113 -0
- package/dist/chunk-JP26LPCY.js +234 -0
- package/dist/chunk-JTNFJLIY.js +1046 -0
- package/dist/chunk-JVJRHBTD.js +50 -0
- package/dist/chunk-JYGR44ZC.js +133 -0
- package/dist/chunk-KDLPXXD2.js +173 -0
- package/dist/chunk-KMSYEE23.js +224 -0
- package/dist/chunk-KNYKWUYX.js +52 -0
- package/dist/chunk-LME57Z6J.js +138 -0
- package/dist/chunk-MFJP5FA7.js +20 -0
- package/dist/chunk-MKC5HNA7.js +1692 -0
- package/dist/chunk-MQGD2OUF.js +39 -0
- package/dist/chunk-MUFHLP4S.js +566 -0
- package/dist/chunk-O2LG3PNI.js +74 -0
- package/dist/chunk-O4GRKO3I.js +66 -0
- package/dist/chunk-OHUFNYGN.js +791 -0
- package/dist/chunk-PWKWNDBS.js +243 -0
- package/dist/chunk-QA74ITR4.js +103 -0
- package/dist/chunk-R6RGJF4L.js +170 -0
- package/dist/chunk-S7NNXWIN.js +7 -0
- package/dist/chunk-SV56BSUQ.js +162 -0
- package/dist/chunk-T7FCG7XV.js +435 -0
- package/dist/chunk-THC2ISYP.js +57 -0
- package/dist/chunk-VWC72TR3.js +115 -0
- package/dist/chunk-W46K56XU.js +216 -0
- package/dist/chunk-W5GGOUUI.js +75 -0
- package/dist/chunk-WEUJYDCV.js +269 -0
- package/dist/chunk-WFY7DKQD.js +279 -0
- package/dist/chunk-WZQFC7ZN.js +448 -0
- package/dist/chunk-Z3ETJN5G.js +136 -0
- package/dist/chunk-ZOOX3TUB.js +192 -0
- package/dist/chunk-ZSNJ6UA3.js +42 -0
- package/dist/chunk-ZZA2LUTL.js +130 -0
- package/dist/chunk-ZZT2E5VT.js +24 -0
- package/dist/color-CtSxc1Rh.d.ts +6 -0
- package/dist/combobox.d.ts +184 -0
- package/dist/combobox.js +21 -0
- package/dist/date-input.d.ts +83 -0
- package/dist/date-input.js +16 -0
- package/dist/date-picker.d.ts +249 -0
- package/dist/date-picker.js +29 -0
- package/dist/date-utils-7hTFTXNK.d.ts +34 -0
- package/dist/date-vMJBKAFK.d.ts +22 -0
- package/dist/dialog.d.ts +86 -0
- package/dist/dialog.js +15 -0
- package/dist/drawer.d.ts +77 -0
- package/dist/drawer.js +14 -0
- package/dist/dropdown-menu.d.ts +218 -0
- package/dist/dropdown-menu.js +10 -0
- package/dist/file-trigger.d.ts +42 -0
- package/dist/file-trigger.js +3 -0
- package/dist/form.d.ts +487 -0
- package/dist/form.js +1179 -0
- package/dist/header-navigation.d.ts +74 -0
- package/dist/header-navigation.js +23 -0
- package/dist/icons/app.d.ts +48 -0
- package/dist/icons/app.js +282 -0
- package/dist/icons/flag.d.ts +817 -0
- package/dist/icons/flag.js +58336 -0
- package/dist/icons/integration.d.ts +36 -0
- package/dist/icons/integration.js +531 -0
- package/dist/icons/payment.d.ts +116 -0
- package/dist/icons/payment.js +2418 -0
- package/dist/icons.d.ts +2013 -0
- package/dist/icons.js +2012 -0
- package/dist/illustration.d.ts +48 -0
- package/dist/illustration.js +4 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +73 -0
- package/dist/indicator.d.ts +51 -0
- package/dist/indicator.js +7 -0
- package/dist/input.d.ts +66 -0
- package/dist/input.js +15 -0
- package/dist/multi-value-CJb_tnvi.d.ts +8 -0
- package/dist/nav-Bla0o_-1.d.ts +98 -0
- package/dist/number-input.d.ts +80 -0
- package/dist/number-input.js +15 -0
- package/dist/options-CPEIgjtd.d.ts +68 -0
- package/dist/overflow-Df0h42Oi.d.ts +29 -0
- package/dist/pagination.d.ts +77 -0
- package/dist/pagination.js +17 -0
- package/dist/payment-input.d.ts +7 -0
- package/dist/payment-input.js +15 -0
- package/dist/popover.d.ts +60 -0
- package/dist/popover.js +14 -0
- package/dist/progress.d.ts +87 -0
- package/dist/progress.js +5 -0
- package/dist/radio.d.ts +77 -0
- package/dist/radio.js +12 -0
- package/dist/select.d.ts +68 -0
- package/dist/select.js +24 -0
- package/dist/shared-BNXAdgh2.d.ts +9 -0
- package/dist/shared-BYXJPnsN.d.ts +11 -0
- package/dist/shared-Dc-GgA16.d.ts +42 -0
- package/dist/sidebar-navigation.d.ts +129 -0
- package/dist/sidebar-navigation.js +15 -0
- package/dist/styles.css +2 -0
- package/dist/switch.d.ts +23 -0
- package/dist/switch.js +7 -0
- package/dist/table.d.ts +692 -0
- package/dist/table.js +44 -0
- package/dist/tabs.d.ts +111 -0
- package/dist/tabs.js +8 -0
- package/dist/tag-input.d.ts +12 -0
- package/dist/tag-input.js +19 -0
- package/dist/tag.d.ts +98 -0
- package/dist/tag.js +9 -0
- package/dist/textarea.d.ts +40 -0
- package/dist/textarea.js +12 -0
- package/dist/theme-script.d.ts +29 -0
- package/dist/theme-script.js +15 -0
- package/dist/theme.css +929 -0
- package/dist/theme.d.ts +71 -0
- package/dist/theme.js +15 -0
- package/dist/toast.d.ts +242 -0
- package/dist/toast.js +15 -0
- package/dist/tooltip.d.ts +70 -0
- package/dist/tooltip.js +6 -0
- package/dist/tree.d.ts +308 -0
- package/dist/tree.js +11 -0
- package/package.json +352 -0
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { b as ButtonSize } from './Button-Bt7pzM4R.js';
|
|
3
|
+
import '@base-ui/react/use-render';
|
|
4
|
+
import './color-CtSxc1Rh.js';
|
|
5
|
+
import './overflow-Df0h42Oi.js';
|
|
6
|
+
|
|
7
|
+
type Theme = "light" | "dark" | "system";
|
|
8
|
+
type ResolvedTheme = "light" | "dark";
|
|
9
|
+
interface ThemeContextValue {
|
|
10
|
+
/** The chosen preference (may be "system"). */
|
|
11
|
+
theme: Theme;
|
|
12
|
+
/** The actually-applied theme ("system" resolved against the OS). */
|
|
13
|
+
resolvedTheme: ResolvedTheme;
|
|
14
|
+
/** What the OS currently prefers. */
|
|
15
|
+
systemTheme: ResolvedTheme;
|
|
16
|
+
/** Set the preference (persisted to localStorage). */
|
|
17
|
+
setTheme: (theme: Theme) => void;
|
|
18
|
+
/** Flip the *resolved* theme to the opposite explicit preference. */
|
|
19
|
+
toggle: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface ThemeProviderProps {
|
|
23
|
+
/** Initial preference before any stored value is read. @default "system" */
|
|
24
|
+
defaultTheme?: Theme;
|
|
25
|
+
/** localStorage key. Keep in sync with <ThemeScript>. @default "jz-theme" */
|
|
26
|
+
storageKey?: string;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
declare function ThemeProvider(props: ThemeProviderProps): React.JSX.Element;
|
|
30
|
+
|
|
31
|
+
/** Read the current theme + setters. Must be inside a <ThemeProvider>. */
|
|
32
|
+
declare function useTheme(): ThemeContextValue;
|
|
33
|
+
|
|
34
|
+
interface ThemeScriptOptions {
|
|
35
|
+
/** localStorage key holding the preference. @default "jz-theme" */
|
|
36
|
+
storageKey?: string;
|
|
37
|
+
/** Preference when nothing is stored. @default "system" */
|
|
38
|
+
defaultTheme?: Theme;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A self-contained IIFE that resolves the theme and applies `.dark` +
|
|
42
|
+
* `color-scheme` to <html> BEFORE first paint — eliminating the light/dark flash.
|
|
43
|
+
* Inline it in the document <head> (see <ThemeScript>). No React, no deps.
|
|
44
|
+
*/
|
|
45
|
+
declare function buildThemeScript(options?: ThemeScriptOptions): string;
|
|
46
|
+
|
|
47
|
+
interface ThemeScriptProps extends ThemeScriptOptions {
|
|
48
|
+
/** CSP nonce, if your app uses one. */
|
|
49
|
+
nonce?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Hook-free, server-renderable no-flash script. Place it in the document <head>
|
|
53
|
+
* (Next: in the server root layout) and add `suppressHydrationWarning` to <html>,
|
|
54
|
+
* since this script mutates the class/style before React hydrates.
|
|
55
|
+
*/
|
|
56
|
+
declare function ThemeScript({ storageKey, defaultTheme, nonce }: ThemeScriptProps): React.JSX.Element;
|
|
57
|
+
|
|
58
|
+
interface ThemeToggleProps {
|
|
59
|
+
/** Button size. @default "sm" */
|
|
60
|
+
size?: ButtonSize;
|
|
61
|
+
/** Layout/spacing only, merged via `cn()`. */
|
|
62
|
+
className?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* An Untitled UI icon button that flips light/dark. Renders both icons and swaps
|
|
66
|
+
* them with `dark:` utilities so the correct one shows before hydration (driven
|
|
67
|
+
* by the .dark class the no-flash script sets).
|
|
68
|
+
*/
|
|
69
|
+
declare function ThemeToggle({ size, className }: ThemeToggleProps): React.JSX.Element;
|
|
70
|
+
|
|
71
|
+
export { type ResolvedTheme, type Theme, type ThemeContextValue, ThemeProvider, type ThemeProviderProps, ThemeScript, type ThemeScriptOptions, type ThemeScriptProps, ThemeToggle, type ThemeToggleProps, buildThemeScript, useTheme };
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";export { ThemeProvider, ThemeScript, ThemeToggle, buildThemeScript, useTheme } from './chunk-GRLSUQQE.js';
|
|
2
|
+
import './chunk-W46K56XU.js';
|
|
3
|
+
import './chunk-CME4DIML.js';
|
|
4
|
+
import './chunk-MQGD2OUF.js';
|
|
5
|
+
import './chunk-JVJRHBTD.js';
|
|
6
|
+
import './chunk-DWKILXHE.js';
|
|
7
|
+
import './chunk-KNYKWUYX.js';
|
|
8
|
+
import './chunk-52IFGFTL.js';
|
|
9
|
+
import './chunk-24TO7E32.js';
|
|
10
|
+
import './chunk-ZZA2LUTL.js';
|
|
11
|
+
import './chunk-O4GRKO3I.js';
|
|
12
|
+
import './chunk-GCVA3OIV.js';
|
|
13
|
+
import './chunk-ZSNJ6UA3.js';
|
|
14
|
+
//# sourceMappingURL=theme.js.map
|
|
15
|
+
//# sourceMappingURL=theme.js.map
|
package/dist/toast.d.ts
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The five intents. Drives the leading glyph + icon-circle tint, and the live-region priority.
|
|
5
|
+
*
|
|
6
|
+
* `neutral` is the one with no valence — a release note, a mention, an FYI. It exists because the
|
|
7
|
+
* alternative was spelling those as `info`, which is brand-tinted and therefore reads as "we want
|
|
8
|
+
* you to look at this". Not a `loading` type: a pending operation is `duration: Infinity` plus an
|
|
9
|
+
* `addOn` bar, resolved in place by `toast.update`.
|
|
10
|
+
*/
|
|
11
|
+
type ToastType = "neutral" | "info" | "success" | "warning" | "error";
|
|
12
|
+
/**
|
|
13
|
+
* Where the single viewport sits. App-wide (a `ToastProvider` prop), never
|
|
14
|
+
* per-toast: notifications must always appear in the same predictable place.
|
|
15
|
+
* The value drives everything positional — which edge the cards anchor to,
|
|
16
|
+
* whether the stack grows down or up, the enter/exit slide, and which way you
|
|
17
|
+
* swipe to dismiss.
|
|
18
|
+
*/
|
|
19
|
+
type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
20
|
+
/** The `rel` tokens a toast action link may carry. Deliberately the security/crawler-relevant subset
|
|
21
|
+
* — the ones that mean something on an in-app action link — not the whole HTML link-types registry
|
|
22
|
+
* (`stylesheet`, `preload`, … make no sense here). Combine them: `rel={["noopener", "noreferrer"]}`. */
|
|
23
|
+
type LinkRel = "noopener" | "noreferrer" | "nofollow" | "external";
|
|
24
|
+
/**
|
|
25
|
+
* One action on a toast. Give it `onClick` (a button), `href` (a real `<a>`, so middle/⌘-click and
|
|
26
|
+
* the status bar work), or both — `href` navigates while `onClick` still fires, which is the
|
|
27
|
+
* analytics case. Either way the toast dismisses afterwards.
|
|
28
|
+
*
|
|
29
|
+
* A config with **neither** is a dismiss-only row: the label is all it needs, because every action
|
|
30
|
+
* closes the card. That is what UUI's "Later" / "Dismiss" secondary is, and spelling it as an empty
|
|
31
|
+
* handler would be noise.
|
|
32
|
+
*
|
|
33
|
+
* Same shape as `CalloutAction` on purpose — a card that offers next steps looks the same wherever
|
|
34
|
+
* it appears, so the two should not need separate mental models.
|
|
35
|
+
*/
|
|
36
|
+
interface ToastActionConfig {
|
|
37
|
+
/** Visible label and accessible name of the action. */
|
|
38
|
+
label: string;
|
|
39
|
+
/** Runs when the action is pressed; the toast is dismissed afterwards. */
|
|
40
|
+
onClick?: () => void;
|
|
41
|
+
/** Renders the action as an anchor pointing here instead of a bare button. */
|
|
42
|
+
href?: string;
|
|
43
|
+
/**
|
|
44
|
+
* A node placed before the label — an icon, usually. Handed straight to the action's own slot, so
|
|
45
|
+
* the caller owns its size AND its a11y semantics (a bare `<svg>` has no accessible name; anything
|
|
46
|
+
* that speaks keeps its voice).
|
|
47
|
+
*/
|
|
48
|
+
leading?: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* How much weight the action carries — and, because a toast is a dense card, how it is DRAWN:
|
|
51
|
+
*
|
|
52
|
+
* - `secondary` (the default) is **text**: brand, semibold, no box. This is the toast action
|
|
53
|
+
* recipe that already shipped, so an existing single action looks identical after the move to
|
|
54
|
+
* `actions`.
|
|
55
|
+
* - `primary` is a real `<Button size="sm">`. Reach for it when the toast is asking for a decision
|
|
56
|
+
* ("Install now"), not merely offering an escape hatch ("Undo").
|
|
57
|
+
*
|
|
58
|
+
* `primary` is the one thing you want pressed; everything else is `secondary`. Two `primary`
|
|
59
|
+
* actions in one card means neither is.
|
|
60
|
+
*
|
|
61
|
+
* @default "secondary"
|
|
62
|
+
*/
|
|
63
|
+
variant?: "primary" | "secondary";
|
|
64
|
+
/** Anchor target — only meaningful with `href`. */
|
|
65
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
66
|
+
/** Anchor `rel`, as named tokens — only meaningful with `href`. A NAMED set rather than a raw
|
|
67
|
+
* string: `rel` has a closed vocabulary, so `"noopenner"` (or `"NoReferrer"`) would have
|
|
68
|
+
* type-checked and done nothing. Space-joined internally, and mirrors the token-array shape of
|
|
69
|
+
* `TagInput.separators` so the library has ONE idiom for "a set of named tokens".
|
|
70
|
+
* Defaults to `["noreferrer"]` for `target="_blank"`. See `docs/type-safety-policy.md`. */
|
|
71
|
+
rel?: readonly LinkRel[];
|
|
72
|
+
}
|
|
73
|
+
/** Options accepted by every `toast.*` enqueue method (`title` is positional). */
|
|
74
|
+
interface ToastOptions {
|
|
75
|
+
/** Optional secondary line under the title. */
|
|
76
|
+
description?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Per-toast auto-dismiss in ms. `Infinity` makes it persistent (dismiss via
|
|
79
|
+
* the X, swipe, or `toast.dismiss`). Falls back to `ToastProvider.duration`.
|
|
80
|
+
*
|
|
81
|
+
* It is also what the **countdown bar** on the card's bottom edge runs for. `Infinity` shows no
|
|
82
|
+
* bar — there is nothing to count down.
|
|
83
|
+
*/
|
|
84
|
+
duration?: number;
|
|
85
|
+
/**
|
|
86
|
+
* The action row. Each entry is a label plus a handler and/or an href; pressing any of them
|
|
87
|
+
* dismisses the toast.
|
|
88
|
+
*
|
|
89
|
+
* Unbounded, like `Callout.actions`, and render order is array order — UUI's convention is the
|
|
90
|
+
* secondary first ("Dismiss", then "Changelog"). Two is the shape this is for; a card that needs
|
|
91
|
+
* a third is asking for a decision that belongs in a dialog.
|
|
92
|
+
*/
|
|
93
|
+
actions?: readonly ToastActionConfig[];
|
|
94
|
+
/**
|
|
95
|
+
* Replaces the type glyph — an `<Avatar>` for a mention, a product mark, a custom icon.
|
|
96
|
+
*
|
|
97
|
+
* Node-typed, so the caller owns its size AND its a11y semantics, and it is never `aria-hidden`
|
|
98
|
+
* (see `docs/slot-policy.md`). `type` still applies: it drives the live-region priority and, if
|
|
99
|
+
* this is omitted, the tint.
|
|
100
|
+
*/
|
|
101
|
+
leading?: React.ReactNode;
|
|
102
|
+
/**
|
|
103
|
+
* A node at the far end of the TITLE row, before the dismiss ✕ — a `<Badge>`, an `<Indicator>`, a
|
|
104
|
+
* count. Same ownership rules as `leading`: node-typed, the caller owns its size and its a11y
|
|
105
|
+
* semantics, never `aria-hidden`.
|
|
106
|
+
*
|
|
107
|
+
* It shares the row with `meta` rather than competing with it: `meta` sits next to the title, this
|
|
108
|
+
* is pushed to the right edge.
|
|
109
|
+
*/
|
|
110
|
+
trailing?: React.ReactNode;
|
|
111
|
+
/**
|
|
112
|
+
* A muted status line **next to the title** — a relative timestamp ("2 mins ago"), a channel
|
|
113
|
+
* name. Same role as the `meta` line on `Select`/`Combobox`: supporting text that is not the
|
|
114
|
+
* message.
|
|
115
|
+
*
|
|
116
|
+
* It sits directly after the title rather than pinned to the far edge: pushed right, it read as
|
|
117
|
+
* an unrelated second column, and a wrapping title left it stranded above the text it belongs to.
|
|
118
|
+
* `trailing` is the slot that owns the right edge of that row.
|
|
119
|
+
*/
|
|
120
|
+
meta?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Arbitrary content stacked **after the description** — a thumbnail, a `<Progress>` bar for an
|
|
123
|
+
* upload, a chart, a diff.
|
|
124
|
+
*
|
|
125
|
+
* The one open channel on the card, and it exists because the alternative did not scale: an
|
|
126
|
+
* `image` prop and a `progress` prop were the first two of an unbounded series (a video, a chart,
|
|
127
|
+
* a code block…), each arriving with its own name, its own table row and its own doc. One node
|
|
128
|
+
* slot stops that.
|
|
129
|
+
*
|
|
130
|
+
* It does NOT reopen structural freedom: it stacks in one fixed place, in the text column, under
|
|
131
|
+
* the description and above the action row. The card still owns everything around it.
|
|
132
|
+
*
|
|
133
|
+
* **Two things become yours** because the component no longer authors the element:
|
|
134
|
+
* - **Give media an intrinsic size** (`aspect-video`, or width+height). Base UI measures the card
|
|
135
|
+
* ONCE to publish its height, and an `<img>` with no reserved box contributes zero to that
|
|
136
|
+
* measurement — a bare `<img>` clips its own lower half and everything under it, silently.
|
|
137
|
+
* - **Label it.** An `<img>` needs its own `alt`; a `<Progress>` needs its own `aria-label`.
|
|
138
|
+
*
|
|
139
|
+
* A long-running operation also wants `duration: Infinity` — nothing infers that from a node.
|
|
140
|
+
*/
|
|
141
|
+
addOn?: React.ReactNode;
|
|
142
|
+
/** Supply your own id for `update`/`dismiss` or to dedupe. */
|
|
143
|
+
id?: string;
|
|
144
|
+
/** Fires when the toast is dismissed (timeout, swipe, action, or close). */
|
|
145
|
+
onClose?: () => void;
|
|
146
|
+
/**
|
|
147
|
+
* Place THIS toast somewhere other than `ToastProvider.position`, the same way
|
|
148
|
+
* `duration` overrides the provider's default. The override gets its own
|
|
149
|
+
* viewport region (own stack geometry, own hover/expand state), mounted on
|
|
150
|
+
* first use — so a toast never has to share a corner it doesn't belong in.
|
|
151
|
+
*
|
|
152
|
+
* Use it for the exception, not the rule: a user learns one place to look, and
|
|
153
|
+
* scattering routine notifications across corners costs them that. Falls back
|
|
154
|
+
* to `ToastProvider.position`.
|
|
155
|
+
*/
|
|
156
|
+
position?: ToastPosition;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Options for `toast.update` — also lets you change the `title` and `type`.
|
|
160
|
+
* `position` is deliberately absent: a card lives in one viewport region, so
|
|
161
|
+
* moving it would mean unmounting and re-entering it (losing its timer state and
|
|
162
|
+
* its place in the stack). Dismiss and re-fire instead.
|
|
163
|
+
*/
|
|
164
|
+
interface ToastUpdateOptions extends Omit<ToastOptions, "position"> {
|
|
165
|
+
/** Replace the title in place. */
|
|
166
|
+
title?: string;
|
|
167
|
+
/** Switch the type (recolors the icon and re-maps live-region priority). */
|
|
168
|
+
type?: ToastType;
|
|
169
|
+
}
|
|
170
|
+
/** The imperative facade returned as the module-level `toast` singleton. */
|
|
171
|
+
interface ToastFacade {
|
|
172
|
+
(title: string, options?: ToastOptions): string;
|
|
173
|
+
neutral: (title: string, options?: ToastOptions) => string;
|
|
174
|
+
info: (title: string, options?: ToastOptions) => string;
|
|
175
|
+
success: (title: string, options?: ToastOptions) => string;
|
|
176
|
+
warning: (title: string, options?: ToastOptions) => string;
|
|
177
|
+
error: (title: string, options?: ToastOptions) => string;
|
|
178
|
+
update: (id: string, options: ToastUpdateOptions) => void;
|
|
179
|
+
dismiss: (id?: string) => void;
|
|
180
|
+
}
|
|
181
|
+
/** Imperative entry point. `toast(...)` defaults to the `info` type. */
|
|
182
|
+
declare const toast: ToastFacade;
|
|
183
|
+
interface ToastProviderProps {
|
|
184
|
+
/**
|
|
185
|
+
* Default auto-dismiss time (ms) for every toast. Per-toast `duration`
|
|
186
|
+
* overrides this. @default 5000
|
|
187
|
+
*/
|
|
188
|
+
duration?: number;
|
|
189
|
+
/**
|
|
190
|
+
* Max toasts rendered at once. With `stacked` (the default) the surplus
|
|
191
|
+
* collapses behind the stack and fans out on hover/focus; unstacked, it is
|
|
192
|
+
* simply not shown until a slot frees up. `limit={1}` is "one at a time".
|
|
193
|
+
* @default 3
|
|
194
|
+
*/
|
|
195
|
+
limit?: number;
|
|
196
|
+
/**
|
|
197
|
+
* Which corner/edge the single viewport occupies — app-wide, never per toast.
|
|
198
|
+
* Drives the anchor, whether the stack grows down or up, the enter/exit slide,
|
|
199
|
+
* and the swipe-to-dismiss direction. @default "top-right"
|
|
200
|
+
*/
|
|
201
|
+
position?: ToastPosition;
|
|
202
|
+
/**
|
|
203
|
+
* Collapse the visible toasts into an overlapping stack (newest in front,
|
|
204
|
+
* fanning out on hover/focus). Set `false` for a plain vertical list where
|
|
205
|
+
* every visible card is readable at once — pair it with `limit` to bound how
|
|
206
|
+
* many that is. @default true
|
|
207
|
+
*/
|
|
208
|
+
stacked?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Draw the auto-dismiss countdown — a thin bar on each card's bottom edge that drains over the
|
|
211
|
+
* toast's own `duration`, so a reader can see how long is left rather than being surprised.
|
|
212
|
+
*
|
|
213
|
+
* Derived rather than configured per toast: there is no `countdown` in `ToastOptions`, because the
|
|
214
|
+
* bar is a function of a duration that already exists. A card with `duration: Infinity` shows no
|
|
215
|
+
* bar either way — nothing to count down. It pauses with the timer on hover/focus.
|
|
216
|
+
*
|
|
217
|
+
* App-wide, like `stacked`: it describes how the whole region feels, and two cards disagreeing
|
|
218
|
+
* about it would read as a bug. Set `false` to switch it off everywhere.
|
|
219
|
+
*
|
|
220
|
+
* @default true
|
|
221
|
+
*/
|
|
222
|
+
countdown?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Layout/offset only (e.g. nudge the viewport inset past a fixed app header),
|
|
225
|
+
* merged onto the viewport via `cn()`. Not for restyling cards. Prefer
|
|
226
|
+
* `position` for the anchor itself.
|
|
227
|
+
*/
|
|
228
|
+
className?: string;
|
|
229
|
+
/** Optional content rendered before the viewport. Usually omitted. */
|
|
230
|
+
children?: React.ReactNode;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Configures Base UI's toast machinery and renders the viewport. Mount once; fire
|
|
234
|
+
* toasts from anywhere via the `toast()` facade.
|
|
235
|
+
*
|
|
236
|
+
* Normally that is a single region at `position`. A toast that overrides
|
|
237
|
+
* `position` gets its own region, mounted here on first use — so the common case
|
|
238
|
+
* stays one provider, one viewport, one live region.
|
|
239
|
+
*/
|
|
240
|
+
declare function ToastProvider(props: ToastProviderProps): React.JSX.Element;
|
|
241
|
+
|
|
242
|
+
export { type LinkRel, type ToastActionConfig, type ToastFacade, type ToastOptions, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastType, type ToastUpdateOptions, toast };
|
package/dist/toast.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";export { ToastProvider, toast } from './chunk-I7WU4GTY.js';
|
|
2
|
+
import './chunk-W46K56XU.js';
|
|
3
|
+
import './chunk-CME4DIML.js';
|
|
4
|
+
import './chunk-MQGD2OUF.js';
|
|
5
|
+
import './chunk-JVJRHBTD.js';
|
|
6
|
+
import './chunk-DWKILXHE.js';
|
|
7
|
+
import './chunk-KNYKWUYX.js';
|
|
8
|
+
import './chunk-52IFGFTL.js';
|
|
9
|
+
import './chunk-24TO7E32.js';
|
|
10
|
+
import './chunk-ZZA2LUTL.js';
|
|
11
|
+
import './chunk-O4GRKO3I.js';
|
|
12
|
+
import './chunk-GCVA3OIV.js';
|
|
13
|
+
import './chunk-ZSNJ6UA3.js';
|
|
14
|
+
//# sourceMappingURL=toast.js.map
|
|
15
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface TooltipProviderProps {
|
|
5
|
+
/** Grouped open delay (ms) shared by tooltips in this region. @default 300 */
|
|
6
|
+
delay?: number;
|
|
7
|
+
/** Grouped close delay (ms) shared by tooltips in this region. */
|
|
8
|
+
closeDelay?: number;
|
|
9
|
+
/** Window (ms) during which moving to an adjacent trigger opens it instantly. */
|
|
10
|
+
timeout?: number;
|
|
11
|
+
/** Region whose tooltips share the grouped open delay. */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare function TooltipProvider(props: TooltipProviderProps): React.JSX.Element;
|
|
15
|
+
declare namespace TooltipProvider {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
type TooltipSide = "top" | "right" | "bottom" | "left";
|
|
19
|
+
type TooltipAlign = "start" | "center" | "end";
|
|
20
|
+
/** Two steps, no `sm` — see `SIZE` below for why the ladder stops here. */
|
|
21
|
+
type TooltipSize = "md" | "lg";
|
|
22
|
+
interface TooltipProps {
|
|
23
|
+
/** The tooltip message — the primary line. Text-only by convention. */
|
|
24
|
+
content: React.ReactNode;
|
|
25
|
+
/** Optional supporting second line under `content` — the two-line tooltip. Text-only. */
|
|
26
|
+
description?: React.ReactNode;
|
|
27
|
+
/** The element the tooltip attaches to — a **single** focusable React element (button, link, …). */
|
|
28
|
+
children: React.ReactElement;
|
|
29
|
+
/**
|
|
30
|
+
* Box scale. `md` is the compact default every call site gets; `lg` adds 2px of padding on
|
|
31
|
+
* each axis for a tooltip that carries real weight (a long `description`, a primary
|
|
32
|
+
* affordance). Padding only — the text is `text-xs` at both. There is no `sm`.
|
|
33
|
+
* @default "md"
|
|
34
|
+
*/
|
|
35
|
+
size?: TooltipSize;
|
|
36
|
+
/** Preferred placement; auto-flips on collision. @default "top" */
|
|
37
|
+
side?: TooltipSide;
|
|
38
|
+
/** Cross-axis alignment against the trigger (with `side` → UUI's 8 placements). @default "center" */
|
|
39
|
+
align?: TooltipAlign;
|
|
40
|
+
/** Render the pointer arrow toward the trigger. @default false */
|
|
41
|
+
showArrow?: boolean;
|
|
42
|
+
/** Boundary the popup must stay inside when avoiding collisions. Defaults to the viewport. */
|
|
43
|
+
collisionBoundary?: Tooltip$1.Positioner.Props["collisionBoundary"];
|
|
44
|
+
/** Extra space (px) kept between the popup and the collision boundary's edge. */
|
|
45
|
+
collisionPadding?: Tooltip$1.Positioner.Props["collisionPadding"];
|
|
46
|
+
/** Per-trigger hover/focus open delay (ms). Defaults to 300 (or the `Tooltip.Provider` group). */
|
|
47
|
+
delay?: number;
|
|
48
|
+
/** Per-trigger close delay (ms) before the tooltip hides after the pointer leaves. */
|
|
49
|
+
closeDelay?: number;
|
|
50
|
+
/** Uncontrolled initial open state. @default false */
|
|
51
|
+
defaultOpen?: boolean;
|
|
52
|
+
/** Controlled open state. */
|
|
53
|
+
open?: boolean;
|
|
54
|
+
/** Fires when the open state changes. */
|
|
55
|
+
onOpenChange?: (open: boolean, event: Event) => void;
|
|
56
|
+
/** When `true`, the tooltip never opens (e.g. a disabled trigger). @default false */
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
/** Layout/spacing only (e.g. `max-w-*`), merged onto the popup surface. Never restyles it. */
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
declare function Tooltip(props: TooltipProps): React.JSX.Element;
|
|
62
|
+
declare namespace Tooltip {
|
|
63
|
+
var displayName: string;
|
|
64
|
+
}
|
|
65
|
+
/** `<Tooltip content=… >{trigger}</Tooltip>` — plus `Tooltip.Provider` for an app-level grouped delay. */
|
|
66
|
+
declare const TooltipExport: typeof Tooltip & {
|
|
67
|
+
Provider: typeof TooltipProvider;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { TooltipExport as Tooltip, type TooltipAlign, type TooltipProps, type TooltipProviderProps, type TooltipSide, type TooltipSize };
|
package/dist/tooltip.js
ADDED