@enigmax/primitives 0.21.0 → 0.23.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/dist/chunk-3BQVOOAM.js +388 -0
- package/dist/{chunk-QQFNAKMY.js → chunk-45UHLZYT.js} +1 -1
- package/dist/chunk-4VUHQFAT.js +130 -0
- package/dist/{chunk-D5A2ZMAG.js → chunk-4ZPMP47J.js} +6 -1
- package/dist/chunk-DSBYVA7V.js +713 -0
- package/dist/{chunk-FWVWX67R.js → chunk-FGBIZDV2.js} +3 -3
- package/dist/{chunk-R4ZAEE7V.js → chunk-KEVZ5XQV.js} +1 -1
- package/dist/chunk-N6PDHMAX.js +213 -0
- package/dist/chunk-NONGREXC.js +248 -0
- package/dist/chunk-VKL3DEIQ.js +804 -0
- package/dist/chunk-WPTBURIC.js +1627 -0
- package/dist/chunk-WSQC3PCC.js +466 -0
- package/dist/context-menu-D3FtTn7v.d.ts +174 -0
- package/dist/{index-dTdAbOWl.d.ts → index-DQNnohoo.d.ts} +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +8 -4
- package/dist/keys-D2zJs1uB.d.ts +100 -0
- package/dist/next/index.d.ts +12 -5
- package/dist/next/index.js +21 -14
- package/dist/react/button.d.ts +2 -2
- package/dist/react/context-menu.d.ts +202 -0
- package/dist/react/context-menu.js +6 -0
- package/dist/react/index.d.ts +11 -4
- package/dist/react/index.js +20 -13
- package/dist/react/input.d.ts +2 -2
- package/dist/react/input.js +1 -1
- package/dist/react/palette.d.ts +1 -1
- package/dist/react/palette.js +3 -3
- package/dist/react/search.d.ts +1 -1
- package/dist/react/search.js +2 -2
- package/dist/react/select.d.ts +217 -0
- package/dist/react/select.js +7 -0
- package/dist/react/selection.d.ts +104 -0
- package/dist/react/selection.js +4 -0
- package/dist/react/slot.d.ts +2 -2
- package/dist/react/toast.d.ts +165 -32
- package/dist/react/toast.js +1 -1
- package/dist/react-router/index.d.ts +12 -5
- package/dist/react-router/index.js +21 -14
- package/dist/search/index.d.ts +2 -2
- package/dist/search/index.js +1 -1
- package/dist/{search-DXxY8SEH.d.ts → search-DYgqRp37.d.ts} +20 -3
- package/dist/{search-UQEXAPQB.js → search-PBZORZ7P.js} +1 -1
- package/dist/select-ClSy-J1f.d.ts +100 -0
- package/dist/selection-B_pmzHpy.d.ts +150 -0
- package/package.json +21 -2
- package/recipes/context-menu/styles.css +177 -0
- package/recipes/input/styles.css +9 -0
- package/recipes/palette/styles.css +3 -0
- package/recipes/search/tailwind.tsx +3 -2
- package/recipes/select/styles.css +230 -0
- package/recipes/toast/styles.css +688 -192
- package/registry.json +434 -29
- package/src/core/context-menu.ts +694 -0
- package/src/core/keys.ts +264 -0
- package/src/core/search.ts +25 -1
- package/src/core/select.ts +404 -0
- package/src/core/selection.ts +648 -0
- package/src/index.ts +60 -1
- package/src/react/context-menu/context.ts +57 -0
- package/src/react/context-menu/index.tsx +94 -0
- package/src/react/context-menu/root.tsx +846 -0
- package/src/react/context-menu/styles.ts +186 -0
- package/src/react/index.ts +70 -2
- package/src/react/palette/root.tsx +2 -2
- package/src/react/select/context.ts +56 -0
- package/src/react/select/index.tsx +96 -0
- package/src/react/select/root.tsx +839 -0
- package/src/react/select/styles.ts +238 -0
- package/src/react/selection/index.tsx +115 -0
- package/src/react/selection/use-selection.ts +260 -0
- package/src/react/toast/NOTICE +20 -0
- package/src/react/toast/assets.tsx +85 -0
- package/src/react/toast/cn.ts +10 -0
- package/src/react/toast/hooks.ts +13 -0
- package/src/react/toast/index.tsx +736 -0
- package/src/react/toast/state.ts +207 -0
- package/src/react/toast/styles.ts +738 -0
- package/src/react/toast/types.ts +193 -0
- package/src/react/toaster.tsx +76 -341
- package/dist/chunk-JCCL7XKC.js +0 -465
- package/src/react/toast-styles.ts +0 -247
- /package/dist/{chunk-U3V4EHOB.js → chunk-3HDEZ2E7.js} +0 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { ReactNode, RefObject, CSSProperties, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { c as SelectOption, a as SelectInstance, e as SelectState, d as SelectOptions } from '../select-ClSy-J1f.js';
|
|
3
|
+
export { S as SELECT_SEARCH_KEYS, b as SelectMoveKey, f as createSelect } from '../select-ClSy-J1f.js';
|
|
4
|
+
import '../search-DYgqRp37.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One option, as React draws it. The core carries `icon` as `unknown` because it cannot
|
|
8
|
+
* know what a node is; here it is one.
|
|
9
|
+
*/
|
|
10
|
+
interface SelectItem extends SelectOption {
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
interface SelectContextValue {
|
|
14
|
+
instance: SelectInstance;
|
|
15
|
+
state: SelectState;
|
|
16
|
+
/** Open or close the panel. React owns that flag; the instance follows it. */
|
|
17
|
+
setOpen: (open: boolean) => void;
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
/** Whether the trigger offers a × that empties the selection. */
|
|
20
|
+
clearable: boolean;
|
|
21
|
+
searchable: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* There is nothing to choose from at all - not a filter that matched nothing, an option
|
|
24
|
+
* list that is empty. The trigger says so and refuses to open, because a panel holding one
|
|
25
|
+
* line of apology is worse than a control that reads as unavailable.
|
|
26
|
+
*/
|
|
27
|
+
empty: boolean;
|
|
28
|
+
/** The options have not arrived yet, which is a different thing from there being none. */
|
|
29
|
+
loading: boolean;
|
|
30
|
+
emptyLabel: ReactNode;
|
|
31
|
+
loadingLabel: ReactNode;
|
|
32
|
+
/** ids the parts need to point at each other. */
|
|
33
|
+
ids: {
|
|
34
|
+
trigger: string;
|
|
35
|
+
list: string;
|
|
36
|
+
field: string;
|
|
37
|
+
};
|
|
38
|
+
optionId: (index: number) => string;
|
|
39
|
+
triggerRef: RefObject<HTMLButtonElement | null>;
|
|
40
|
+
fieldRef: RefObject<HTMLInputElement | null>;
|
|
41
|
+
/** Close and put focus back where it came from - the trigger, always. */
|
|
42
|
+
close: () => void;
|
|
43
|
+
/** The keys the list answers to, shared by the trigger and the search field. */
|
|
44
|
+
onListKeyDown: (event: React.KeyboardEvent) => void;
|
|
45
|
+
}
|
|
46
|
+
declare function useSelectContext(part: string): SelectContextValue;
|
|
47
|
+
|
|
48
|
+
interface SelectRootBase extends Omit<SelectOptions, "options" | "value" | "onValueChange" | "onChange" | "multiple" | "searchable"> {
|
|
49
|
+
options: SelectItem[];
|
|
50
|
+
/** `"auto"` (the default) puts a filter on a list of eight or more. */
|
|
51
|
+
searchable?: boolean | "auto";
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Submit with a plain HTML form: a hidden input per chosen value, so the select works
|
|
55
|
+
* in a form that posts, not only in one wired to state.
|
|
56
|
+
*/
|
|
57
|
+
name?: string;
|
|
58
|
+
required?: boolean;
|
|
59
|
+
/** Controlled panel. Omit both for a panel that manages itself. */
|
|
60
|
+
open?: boolean;
|
|
61
|
+
defaultOpen?: boolean;
|
|
62
|
+
onOpenChange?: (open: boolean) => void;
|
|
63
|
+
/**
|
|
64
|
+
* A × that empties the selection. It takes the caret's place while the pointer is on
|
|
65
|
+
* the control - see the trigger below for why it is not a second glyph beside it.
|
|
66
|
+
* Default: on when many values are allowed.
|
|
67
|
+
*/
|
|
68
|
+
clearable?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The options have not arrived yet. Distinct from having none: a select that is still
|
|
71
|
+
* loading and one that will never have anything look identical otherwise, and only one of
|
|
72
|
+
* them is worth waiting for.
|
|
73
|
+
*/
|
|
74
|
+
loading?: boolean;
|
|
75
|
+
/** What the trigger says with no options at all. */
|
|
76
|
+
emptyLabel?: ReactNode;
|
|
77
|
+
loadingLabel?: ReactNode;
|
|
78
|
+
/** Inject the baseline stylesheet. See the note above. */
|
|
79
|
+
styles?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* On the ROOT, which is the element with a size: the trigger fills it, so this is what
|
|
82
|
+
* a `width` belongs on. `triggerProps.className` dresses the button itself.
|
|
83
|
+
*/
|
|
84
|
+
className?: string;
|
|
85
|
+
style?: CSSProperties;
|
|
86
|
+
children?: ReactNode;
|
|
87
|
+
}
|
|
88
|
+
/** One value: `value` is a string, and so is what the change reports. */
|
|
89
|
+
interface SelectSingleProps extends SelectRootBase {
|
|
90
|
+
multiple?: false;
|
|
91
|
+
value?: string | null;
|
|
92
|
+
defaultValue?: string | null;
|
|
93
|
+
onValueChange?: (value: string, option: SelectItem | null) => void;
|
|
94
|
+
}
|
|
95
|
+
/** Many values: everything that was one string is a list, checked by the compiler. */
|
|
96
|
+
interface SelectMultipleProps extends SelectRootBase {
|
|
97
|
+
multiple: true;
|
|
98
|
+
value?: string[] | null;
|
|
99
|
+
defaultValue?: string[] | null;
|
|
100
|
+
onValueChange?: (value: string[], options: SelectItem[]) => void;
|
|
101
|
+
}
|
|
102
|
+
type SelectRootProps = SelectSingleProps | SelectMultipleProps;
|
|
103
|
+
declare function SelectRoot(props: SelectRootProps): ReactNode;
|
|
104
|
+
interface SelectTriggerProps extends Omit<ComponentPropsWithoutRef<"button">, "value"> {
|
|
105
|
+
/** Put the behaviour on your own element instead of ours. */
|
|
106
|
+
asChild?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Draw the caret, and the clear × in its place. On by default, and never through a slot:
|
|
109
|
+
* the child owns its own markup there.
|
|
110
|
+
*/
|
|
111
|
+
indicator?: boolean;
|
|
112
|
+
}
|
|
113
|
+
declare function SelectTrigger({ asChild, indicator, children, onClick, onKeyDown, ...props }: SelectTriggerProps): ReactNode;
|
|
114
|
+
interface SelectValueProps extends Omit<ComponentPropsWithoutRef<"span">, "children"> {
|
|
115
|
+
placeholder?: ReactNode;
|
|
116
|
+
/**
|
|
117
|
+
* Show each chosen option as a removable tag. On by default when many values are
|
|
118
|
+
* allowed, because a comma-separated line of eight labels is not something you can
|
|
119
|
+
* take one item out of.
|
|
120
|
+
*/
|
|
121
|
+
tags?: boolean;
|
|
122
|
+
/** How many tags before the rest collapse into "+N". */
|
|
123
|
+
maxTags?: number;
|
|
124
|
+
/** Draw the value yourself, from what is chosen. */
|
|
125
|
+
children?: ReactNode | ((selected: SelectItem[]) => ReactNode);
|
|
126
|
+
}
|
|
127
|
+
declare function SelectValue({ placeholder, tags, maxTags, children, ...props }: SelectValueProps): ReactNode;
|
|
128
|
+
interface SelectContentProps extends ComponentPropsWithoutRef<"div"> {
|
|
129
|
+
/** Keep the panel mounted while it animates out. ms. */
|
|
130
|
+
closeDuration?: number;
|
|
131
|
+
}
|
|
132
|
+
declare function SelectContent({ closeDuration, children, ...props }: SelectContentProps): ReactNode;
|
|
133
|
+
interface SelectSearchProps extends Omit<ComponentPropsWithoutRef<"input">, "value" | "onChange" | "type"> {
|
|
134
|
+
placeholder?: string;
|
|
135
|
+
}
|
|
136
|
+
declare function SelectSearch({ placeholder, onKeyDown, ...props }: SelectSearchProps): ReactNode;
|
|
137
|
+
interface SelectListProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
138
|
+
/** Render one option. Default: icon, label, description and the check. */
|
|
139
|
+
children?: (option: SelectItem, index: number) => ReactNode;
|
|
140
|
+
/** What to show when the filter matches nothing. */
|
|
141
|
+
empty?: ReactNode;
|
|
142
|
+
/**
|
|
143
|
+
* How many rows to put in the document at once. The rest arrive a chunk at a time as
|
|
144
|
+
* the list is scrolled - see the note below. `Infinity` renders the lot.
|
|
145
|
+
*/
|
|
146
|
+
chunk?: number;
|
|
147
|
+
}
|
|
148
|
+
declare function SelectList({ children, empty, chunk, ...props }: SelectListProps): ReactNode;
|
|
149
|
+
interface SelectOptionProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
150
|
+
option: SelectItem;
|
|
151
|
+
/** Its position in the FLAT list, which is what the keyboard moves through. */
|
|
152
|
+
index: number;
|
|
153
|
+
children?: ReactNode;
|
|
154
|
+
}
|
|
155
|
+
declare function SelectOptionRow({ option, index, children, ...props }: SelectOptionProps): ReactNode;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The select's baseline look.
|
|
159
|
+
*
|
|
160
|
+
* A string rather than a stylesheet because `<Select.Root>` injects it - see the note in
|
|
161
|
+
* root.tsx for why this one component ships a look at all. `scripts/sync-recipes.mjs`
|
|
162
|
+
* generates `recipes/select/styles.css` from here, and CI fails when the two drift, so this
|
|
163
|
+
* module is the source and the `.css` is a copy for anyone who prefers the import.
|
|
164
|
+
*
|
|
165
|
+
* Everything below is either a custom property or an attribute selector: override the
|
|
166
|
+
* properties on `:root` for a different-looking select without writing one selector, and
|
|
167
|
+
* override a selector for the rest. The sheet is PREPENDED to `<head>`, so anything the
|
|
168
|
+
* document already has wins on source order at equal specificity.
|
|
169
|
+
*/
|
|
170
|
+
declare const SELECT_STYLES = "\n:root {\n --enigma-select-bg: #171717;\n --enigma-select-border: #404040;\n --enigma-select-border-focus: #a3a3a3;\n --enigma-select-text: #f5f5f5;\n --enigma-select-muted: #a3a3a3;\n --enigma-select-radius: 0.5rem;\n --enigma-select-font-size: 0.875rem;\n --enigma-select-padding: 0.5rem 0.75rem;\n\n --enigma-select-panel-bg: #1c1c1c;\n --enigma-select-panel-border: #333333;\n --enigma-select-panel-radius: 0.625rem;\n --enigma-select-panel-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);\n --enigma-select-panel-width: 100%;\n --enigma-select-list-height: 15rem;\n\n --enigma-select-active-bg: #2a2a2a;\n --enigma-select-accent: #fbbf24;\n --enigma-select-tag-bg: #2a2a2a;\n}\n\n@media (prefers-color-scheme: light) {\n :root {\n --enigma-select-bg: #ffffff;\n --enigma-select-border: #d4d4d4;\n --enigma-select-border-focus: #737373;\n --enigma-select-text: #171717;\n --enigma-select-muted: #737373;\n --enigma-select-panel-bg: #ffffff;\n --enigma-select-panel-border: #e5e5e5;\n --enigma-select-panel-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);\n --enigma-select-active-bg: #f5f5f5;\n --enigma-select-accent: #b45309;\n --enigma-select-tag-bg: #f0f0f0;\n }\n}\n\n[data-enigma-select-root] { position: relative; display: inline-block; min-width: 0; }\n\n[data-enigma-select-trigger] {\n display: flex; align-items: center; gap: 0.5rem;\n width: 100%; min-width: 0; box-sizing: border-box;\n padding: var(--enigma-select-padding);\n font: inherit; font-size: var(--enigma-select-font-size); text-align: left;\n color: var(--enigma-select-text); background: var(--enigma-select-bg);\n border: 1px solid var(--enigma-select-border); border-radius: var(--enigma-select-radius);\n cursor: pointer;\n}\n[data-enigma-select-trigger]:focus-visible { outline: 2px solid var(--enigma-select-border-focus); outline-offset: 1px; }\n[data-enigma-select-trigger][data-open] { border-color: var(--enigma-select-border-focus); }\n[data-enigma-select-trigger]:disabled,\n[data-enigma-select-trigger][aria-disabled=\"true\"] { opacity: 0.5; cursor: not-allowed; }\n/* Nothing to choose, or nothing yet: the control reads as unavailable and the caret fades,\n because a caret at full strength promises a panel that will never open. Not the disabled\n look, which would say the field is off rather than that the list is empty. */\n[data-enigma-select-trigger][data-empty],\n[data-enigma-select-trigger][data-loading] { opacity: 1; cursor: default; }\n[data-enigma-select-trigger][data-empty] [data-enigma-select-caret],\n[data-enigma-select-trigger][data-loading] [data-enigma-select-caret] { opacity: 0.25; }\n\n/* The indicator: one slot, holding the caret and the \u00D7 stacked in the same cell. Side by\n side they would be two targets a pixel apart - one of which throws away your choice - and\n the pair would change the trigger's width the moment a value appeared. */\n[data-enigma-select-indicator] {\n display: grid; place-items: center; flex: none;\n margin-left: auto; width: 1rem; height: 1rem;\n}\n[data-enigma-select-indicator] > * { grid-area: 1 / 1; }\n\n/* The caret, drawn rather than loaded: an icon font or an SVG file is a request, and this\n is two borders. */\n[data-enigma-select-caret] {\n width: 0.4rem; height: 0.4rem;\n /* Decoration, and it must not be the hit target: the rotation gives it a stacking\n context, which paints it OVER the \u00D7 sharing its cell and swallows the click. */\n pointer-events: none;\n border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;\n transform: translateY(-0.1rem) rotate(45deg);\n opacity: 0.6; transition: transform 120ms ease-out, opacity 120ms ease-out;\n}\n[data-enigma-select-trigger][data-open] [data-enigma-select-caret] { transform: translateY(0.1rem) rotate(225deg); }\n\n[data-enigma-select-value] {\n display: flex; align-items: center; gap: 0.375rem;\n /* min-width: 0 is what lets the ellipsis happen: a flex item's default minimum is its\n content, so without it a long label pushes the caret out of the button. */\n min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;\n}\n[data-enigma-select-value][data-placeholder] { color: var(--enigma-select-muted); }\n[data-enigma-select-value][data-tags] { flex-wrap: wrap; white-space: normal; }\n\n[data-enigma-select-tag] {\n display: inline-flex; align-items: center; gap: 0.25rem;\n padding: 0.125rem 0.25rem 0.125rem 0.5rem;\n font-size: 0.8125rem; line-height: 1.4;\n background: var(--enigma-select-tag-bg); border-radius: 999px;\n}\n[data-enigma-select-tag][data-rest] { padding: 0.125rem 0.5rem; color: var(--enigma-select-muted); }\n\n[data-enigma-select-tag-remove] {\n display: grid; place-items: center;\n width: 1rem; height: 1rem; border-radius: 999px;\n color: var(--enigma-select-muted); font-size: 0.875rem; line-height: 1; cursor: pointer;\n}\n[data-enigma-select-tag-remove]:hover { color: var(--enigma-select-text); background: var(--enigma-select-active-bg); }\n\n/* The \u00D7, in the caret's place and only while the control is under the pointer or holds\n focus. \":focus\" and not \":focus-visible\": a tap focuses the button, and on a touch screen\n there is no hover to reveal it with. */\n[data-enigma-select-clear] {\n display: grid; place-items: center;\n width: 1rem; height: 1rem; border-radius: 999px;\n color: var(--enigma-select-muted); font-size: 0.875rem; line-height: 1; cursor: pointer;\n opacity: 0; pointer-events: none; transition: opacity 120ms ease-out;\n}\n[data-enigma-select-trigger]:hover [data-enigma-select-clear],\n[data-enigma-select-trigger]:focus [data-enigma-select-clear] { opacity: 1; pointer-events: auto; }\n/* Scoped to a trigger that HAS a \u00D7 - otherwise hovering a select with nothing to clear\n would hide its caret and leave an empty slot. */\n[data-enigma-select-trigger][data-clearable]:hover [data-enigma-select-caret],\n[data-enigma-select-trigger][data-clearable]:focus [data-enigma-select-caret] { opacity: 0; }\n[data-enigma-select-clear]:hover { color: var(--enigma-select-text); background: var(--enigma-select-active-bg); }\n\n[data-enigma-select-content] {\n position: absolute; z-index: 50;\n top: calc(100% + 0.25rem); left: 0;\n min-width: var(--enigma-select-panel-width); box-sizing: border-box;\n padding: 0.25rem;\n background: var(--enigma-select-panel-bg);\n border: 1px solid var(--enigma-select-panel-border);\n border-radius: var(--enigma-select-panel-radius);\n box-shadow: var(--enigma-select-panel-shadow);\n animation: enigma-select-in 120ms ease-out;\n /* A bound, because the content is arbitrary: a long option label or a query typed into\n the filter would otherwise widen the panel with it. min-width still wins for a\n trigger wider than this, which is what it is for. */\n max-width: min(28rem, calc(100vw - 2rem));\n}\n/* Opening upwards is not a variant, it is the same panel measured against the window: near\n the bottom of the screen the list would otherwise be unreachable. */\n[data-enigma-select-content][data-side=\"top\"] { top: auto; bottom: calc(100% + 0.25rem); }\n[data-enigma-select-content][data-state=\"closed\"] { animation: enigma-select-out 120ms ease-in forwards; pointer-events: none; }\n\n@keyframes enigma-select-in {\n from { opacity: 0; transform: translateY(-0.25rem); }\n to { opacity: 1; transform: none; }\n}\n@keyframes enigma-select-out {\n from { opacity: 1; }\n to { opacity: 0; transform: translateY(-0.125rem); }\n}\n@media (prefers-reduced-motion: reduce) {\n [data-enigma-select-content],\n [data-enigma-select-content][data-state=\"closed\"] { animation: none; }\n [data-enigma-select-trigger]::after { transition: none; }\n}\n\n[data-enigma-select-search] {\n width: 100%; box-sizing: border-box;\n padding: 0.375rem 0.5rem 0.5rem;\n font: inherit; font-size: var(--enigma-select-font-size);\n color: var(--enigma-select-text); background: transparent;\n border: 0; border-bottom: 1px solid var(--enigma-select-panel-border);\n outline: none;\n}\n/* WebKit's own clear cross, gone: it is drawn on no other engine, so leaving it in gives\n half the visitors a control the other half never sees. */\n[data-enigma-select-search]::-webkit-search-cancel-button,\n[data-enigma-select-search]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }\n\n[data-enigma-select-list] {\n max-height: var(--enigma-select-list-height);\n margin-top: 0.25rem;\n overflow-y: auto; overscroll-behavior: contain;\n}\n\n[data-enigma-select-group-label] {\n margin: 0.375rem 0 0.125rem; padding: 0 0.5rem;\n font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;\n color: var(--enigma-select-muted);\n}\n\n[data-enigma-select-option] {\n display: flex; align-items: center; gap: 0.5rem;\n padding: 0.4375rem 0.5rem; border-radius: 0.375rem;\n font-size: var(--enigma-select-font-size); color: var(--enigma-select-text);\n cursor: pointer;\n}\n[data-enigma-select-option][data-active] { background: var(--enigma-select-active-bg); }\n[data-enigma-select-option][data-disabled] { opacity: 0.45; cursor: not-allowed; }\n\n[data-enigma-select-option-text] { display: grid; min-width: 0; }\n[data-enigma-select-option-label] { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n[data-enigma-select-option-description] {\n font-size: 0.75rem; color: var(--enigma-select-muted);\n overflow: hidden; white-space: nowrap; text-overflow: ellipsis;\n}\n\n[data-enigma-select-icon] { display: inline-flex; align-items: center; flex: none; max-height: 1.25em; line-height: 0; }\n\n/* The check, drawn with two borders and shown only where it belongs. Reserved space either\n way, so choosing a row does not shift the label under the pointer. */\n[data-enigma-select-check] {\n flex: none; margin-left: auto;\n width: 0.35rem; height: 0.6rem;\n border-right: 2px solid var(--enigma-select-accent); border-bottom: 2px solid var(--enigma-select-accent);\n transform: rotate(45deg) translate(-0.05rem, -0.05rem);\n opacity: 0;\n}\n[data-enigma-select-option][data-selected] [data-enigma-select-check] { opacity: 1; }\n\n/* The end-of-window marker: one pixel, so it has a box to be scrolled into. */\n[data-enigma-select-more] { height: 1px; }\n\n[data-enigma-select-empty] {\n margin: 0; padding: 0.75rem 0.5rem;\n font-size: var(--enigma-select-font-size); color: var(--enigma-select-muted);\n /* The quoted query is cut in the text as well, but a pasted string with no spaces has\n no break opportunity at all - so this is what stops it stretching the panel. */\n overflow-wrap: anywhere;\n}\n";
|
|
171
|
+
|
|
172
|
+
type SelectProps = SelectRootProps & {
|
|
173
|
+
/** What the trigger says with nothing chosen. */
|
|
174
|
+
placeholder?: ReactNode;
|
|
175
|
+
searchPlaceholder?: string;
|
|
176
|
+
/** Removable tags instead of a comma-separated line. Default: on when `multiple`. */
|
|
177
|
+
tags?: boolean;
|
|
178
|
+
maxTags?: number;
|
|
179
|
+
/** Shown when the filter matches nothing. */
|
|
180
|
+
empty?: ReactNode;
|
|
181
|
+
/** Draw a row yourself: the icon, label, description and check are the default. */
|
|
182
|
+
renderOption?: SelectListProps["children"];
|
|
183
|
+
/** On the root, which is the element with a size. `triggerProps` dresses the button. */
|
|
184
|
+
className?: string;
|
|
185
|
+
triggerProps?: SelectTriggerProps;
|
|
186
|
+
contentProps?: SelectContentProps;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* The select, assembled.
|
|
190
|
+
*
|
|
191
|
+
* ```tsx
|
|
192
|
+
* <Select
|
|
193
|
+
* options={[{ value: "es", label: "Spain", icon: <Flag code="es" /> }]}
|
|
194
|
+
* value={country}
|
|
195
|
+
* onValueChange={setCountry}
|
|
196
|
+
* />
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* Everything it renders is a part you can render yourself instead - see `Select.Root` for
|
|
200
|
+
* the anatomy. This is those parts in the order they belong in, not a different component.
|
|
201
|
+
*
|
|
202
|
+
* `multiple` changes the types with it: `value` and what the change reports are a list, and
|
|
203
|
+
* the compiler says so at the call site. A filter appears on its own once the list is long
|
|
204
|
+
* enough to need one, fuzzy if you hand over Fuse's constructor and plain otherwise.
|
|
205
|
+
*/
|
|
206
|
+
declare function Select(props: SelectProps): ReactNode;
|
|
207
|
+
declare namespace Select {
|
|
208
|
+
var Root: typeof SelectRoot;
|
|
209
|
+
var Trigger: typeof SelectTrigger;
|
|
210
|
+
var Value: typeof SelectValue;
|
|
211
|
+
var Content: typeof SelectContent;
|
|
212
|
+
var Search: typeof SelectSearch;
|
|
213
|
+
var List: typeof SelectList;
|
|
214
|
+
var Option: typeof SelectOptionRow;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export { SELECT_STYLES, Select, SelectContent, type SelectContentProps, type SelectContextValue, SelectInstance, type SelectItem, SelectList, type SelectListProps, type SelectMultipleProps, SelectOption, type SelectOptionProps, SelectOptionRow, SelectOptions, type SelectProps, SelectRoot, type SelectRootProps, SelectSearch, type SelectSearchProps, type SelectSingleProps, SelectState, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, useSelectContext };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { SELECT_STYLES, Select, SelectContent, SelectList, SelectOptionRow, SelectRoot, SelectSearch, SelectTrigger, SelectValue, useSelectContext } from '../chunk-VKL3DEIQ.js';
|
|
3
|
+
export { SELECT_SEARCH_KEYS, createSelect } from '../chunk-NONGREXC.js';
|
|
4
|
+
import '../chunk-4VUHQFAT.js';
|
|
5
|
+
import '../chunk-HS3X3XCW.js';
|
|
6
|
+
import '../chunk-DTWZDONY.js';
|
|
7
|
+
import '../chunk-4ZPMP47J.js';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { e as SelectionOptions, d as SelectionInstance, g as SelectionState } from '../selection-B_pmzHpy.js';
|
|
3
|
+
export { D as DEFAULT_SELECTION_SHORTCUTS, S as SelectionClickModifiers, a as SelectionCommand, b as SelectionCommandEvent, c as SelectionCommandName, f as SelectionShortcuts, h as createSelection } from '../selection-B_pmzHpy.js';
|
|
4
|
+
export { S as Shortcut, b as ShortcutSpec, m as matchesShortcut, p as parseShortcut, e as shortcutText, f as shortcutTokens } from '../keys-D2zJs1uB.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The selection model as a hook, plus the props that put it on real elements.
|
|
8
|
+
*
|
|
9
|
+
* Prop getters rather than components, because a selectable list is every shape at once - a
|
|
10
|
+
* table, a grid of cards, a tree, a virtualized window - and a component that owned the markup
|
|
11
|
+
* would fit exactly one of them. `<SelectionList>` next door IS this hook with a container and
|
|
12
|
+
* rows around it, for the case where the shape is a plain list.
|
|
13
|
+
*/
|
|
14
|
+
interface UseSelectionOptions<Item> extends Omit<SelectionOptions<Item>, "items"> {
|
|
15
|
+
items: readonly Item[];
|
|
16
|
+
/** Bring the cursor into view when the keyboard moves it. Default: on. */
|
|
17
|
+
scrollIntoView?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface UseSelectionResult<Item> {
|
|
20
|
+
instance: SelectionInstance<Item>;
|
|
21
|
+
state: SelectionState<Item>;
|
|
22
|
+
/** Whether a row is selected, by id. */
|
|
23
|
+
isSelected: (id: string) => boolean;
|
|
24
|
+
/** The container: the keyboard, the roles and the id the rows point at. */
|
|
25
|
+
getListProps: <T extends HTMLElement = HTMLElement>(props?: HTMLAttributes<T>) => HTMLAttributes<T> & {
|
|
26
|
+
ref: (node: T | null) => void;
|
|
27
|
+
};
|
|
28
|
+
/** One row: its state, its id, and the click rule. */
|
|
29
|
+
getItemProps: <T extends HTMLElement = HTMLElement>(index: number, props?: HTMLAttributes<T>) => HTMLAttributes<T> & {
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A press on the empty space of the container, for a rubber band. Composed OVER the list
|
|
34
|
+
* props rather than beside them, so the two handlers do not overwrite each other:
|
|
35
|
+
* `<div {...getMarqueeProps(getListProps())}>`.
|
|
36
|
+
*/
|
|
37
|
+
getMarqueeProps: <T extends HTMLElement = HTMLElement>(props?: HTMLAttributes<T>) => HTMLAttributes<T>;
|
|
38
|
+
/** The rubber band's rectangle while it is being dragged, in container coordinates. */
|
|
39
|
+
marquee: MarqueeRect | null;
|
|
40
|
+
ids: {
|
|
41
|
+
list: string;
|
|
42
|
+
};
|
|
43
|
+
itemId: (index: number) => string;
|
|
44
|
+
}
|
|
45
|
+
/** A rubber band, in coordinates relative to the scrolling container's content. */
|
|
46
|
+
interface MarqueeRect {
|
|
47
|
+
left: number;
|
|
48
|
+
top: number;
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
}
|
|
52
|
+
declare function useSelection<Item>(options: UseSelectionOptions<Item>): UseSelectionResult<Item>;
|
|
53
|
+
/** What a row renderer is handed. Everything it needs to draw one row and nothing else. */
|
|
54
|
+
interface SelectionRowRender<Item> {
|
|
55
|
+
item: Item;
|
|
56
|
+
index: number;
|
|
57
|
+
selected: boolean;
|
|
58
|
+
cursor: boolean;
|
|
59
|
+
disabled: boolean;
|
|
60
|
+
}
|
|
61
|
+
type SelectionRenderer<Item> = (row: SelectionRowRender<Item>) => ReactNode;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* `onChange` is dropped from BOTH sides on purpose: the model's means "the state moved" and a
|
|
65
|
+
* div's means an input inside it changed, and one name cannot be both. The selection is
|
|
66
|
+
* reported through `onSelectionChange`, and the whole state through `useSelection`.
|
|
67
|
+
*/
|
|
68
|
+
interface SelectionListProps<Item> extends Omit<UseSelectionOptions<Item>, "onChange">, Omit<ComponentPropsWithoutRef<"div">, "children" | "onSelect" | "onChange"> {
|
|
69
|
+
/** Draw one row. What it returns goes inside the row element, which this component owns. */
|
|
70
|
+
children: SelectionRenderer<Item>;
|
|
71
|
+
/** Shown instead of the rows when there are none. */
|
|
72
|
+
empty?: ReactNode;
|
|
73
|
+
/** Drag a rubber band over the empty space to select what it covers. Default: on. */
|
|
74
|
+
marquee?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A list whose rows can be selected the way a file manager's are.
|
|
78
|
+
*
|
|
79
|
+
* ```tsx
|
|
80
|
+
* <SelectionList
|
|
81
|
+
* items={files}
|
|
82
|
+
* getId={(file) => file.path}
|
|
83
|
+
* onCommand={(event) => {
|
|
84
|
+
* if (event.command === "delete") remove(event.items);
|
|
85
|
+
* if (event.command === "rename") rename(event.cursor);
|
|
86
|
+
* }}
|
|
87
|
+
* >
|
|
88
|
+
* {({ item }) => <><FileIcon kind={item.kind} />{item.name}</>}
|
|
89
|
+
* </SelectionList>
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* It renders a container and one element per row, with the roles, the ids and the state
|
|
93
|
+
* attributes on them - and nothing else. No borders, no padding, no highlight: `[data-selected]`
|
|
94
|
+
* and `[data-cursor]` are there for the stylesheet, so the list looks like the rest of the
|
|
95
|
+
* product rather than like this package.
|
|
96
|
+
*
|
|
97
|
+
* The shape is the only thing it decides. A table, a grid of cards, a tree or a virtualized
|
|
98
|
+
* window - and anything that needs to reach the model itself, to clear the selection from a
|
|
99
|
+
* toolbar or read it into a header checkbox - uses `useSelection` directly and puts the same
|
|
100
|
+
* props on its own markup. That is the same component with the markup handed back.
|
|
101
|
+
*/
|
|
102
|
+
declare function SelectionList<Item>(props: SelectionListProps<Item>): ReactNode;
|
|
103
|
+
|
|
104
|
+
export { type MarqueeRect, SelectionInstance, SelectionList, type SelectionListProps, SelectionOptions, type SelectionRenderer, type SelectionRowRender, SelectionState, type UseSelectionOptions, type UseSelectionResult, useSelection };
|
package/dist/react/slot.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -42,6 +42,6 @@ interface SlotProps extends Props {
|
|
|
42
42
|
* papering over: `asChild` with two children has no answer to "which one gets the
|
|
43
43
|
* behaviour", and rendering nothing would be a blank space nobody can debug.
|
|
44
44
|
*/
|
|
45
|
-
declare const Slot:
|
|
45
|
+
declare const Slot: React.ForwardRefExoticComponent<Omit<SlotProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
46
46
|
|
|
47
47
|
export { Slot, type SlotProps, mergeSlotProps };
|
package/dist/react/toast.d.ts
CHANGED
|
@@ -1,41 +1,174 @@
|
|
|
1
|
-
import { d as Notifications
|
|
2
|
-
export { a as NotificationAction, b as NotificationInput, c as NotificationTone } from '../notifications-BpVV6sel.js';
|
|
3
|
-
import { ReactNode
|
|
1
|
+
import { d as Notifications } from '../notifications-BpVV6sel.js';
|
|
2
|
+
export { N as Notification, a as NotificationAction, b as NotificationInput, c as NotificationTone } from '../notifications-BpVV6sel.js';
|
|
3
|
+
import React__default, { ReactNode } from 'react';
|
|
4
4
|
export { createNotificationQueue, defaultQueue, useNotifications } from './notifications.js';
|
|
5
5
|
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
type ToastTypes = "normal" | "action" | "success" | "info" | "warning" | "error" | "loading" | "default";
|
|
7
|
+
type PromiseT<Data = any> = Promise<Data> | (() => Promise<Data>);
|
|
8
|
+
type PromiseTResult<Data = any> = string | React__default.ReactNode | ((data: Data) => React__default.ReactNode | string | Promise<React__default.ReactNode | string>);
|
|
9
|
+
type PromiseExternalToast = Omit<ExternalToast, "description">;
|
|
10
|
+
type PromiseData<ToastData = any> = PromiseExternalToast & {
|
|
11
|
+
loading?: string | React__default.ReactNode;
|
|
12
|
+
success?: PromiseTResult<ToastData>;
|
|
13
|
+
error?: PromiseTResult;
|
|
14
|
+
description?: PromiseTResult;
|
|
15
|
+
finally?: () => void | Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
interface ToastClassnames {
|
|
18
|
+
toast?: string;
|
|
19
|
+
title?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
loader?: string;
|
|
22
|
+
closeButton?: string;
|
|
23
|
+
cancelButton?: string;
|
|
24
|
+
actionButton?: string;
|
|
25
|
+
success?: string;
|
|
26
|
+
error?: string;
|
|
27
|
+
info?: string;
|
|
28
|
+
warning?: string;
|
|
29
|
+
loading?: string;
|
|
30
|
+
default?: string;
|
|
31
|
+
content?: string;
|
|
32
|
+
icon?: string;
|
|
33
|
+
}
|
|
34
|
+
interface ToastIcons {
|
|
35
|
+
success?: React__default.ReactNode;
|
|
36
|
+
info?: React__default.ReactNode;
|
|
37
|
+
warning?: React__default.ReactNode;
|
|
38
|
+
error?: React__default.ReactNode;
|
|
39
|
+
loading?: React__default.ReactNode;
|
|
40
|
+
close?: React__default.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
interface Action {
|
|
43
|
+
label: React__default.ReactNode;
|
|
44
|
+
onClick: (event: React__default.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
45
|
+
actionButtonStyle?: React__default.CSSProperties;
|
|
46
|
+
}
|
|
47
|
+
interface ToastT {
|
|
48
|
+
id: number | string;
|
|
49
|
+
title?: (() => React__default.ReactNode) | React__default.ReactNode;
|
|
50
|
+
type?: ToastTypes;
|
|
51
|
+
icon?: React__default.ReactNode;
|
|
52
|
+
jsx?: React__default.ReactNode;
|
|
53
|
+
richColors?: boolean;
|
|
54
|
+
invert?: boolean;
|
|
55
|
+
closeButton?: boolean;
|
|
56
|
+
dismissible?: boolean;
|
|
57
|
+
description?: (() => React__default.ReactNode) | React__default.ReactNode;
|
|
58
|
+
duration?: number;
|
|
59
|
+
delete?: boolean;
|
|
60
|
+
action?: Action | React__default.ReactNode;
|
|
61
|
+
cancel?: Action | React__default.ReactNode;
|
|
62
|
+
onDismiss?: (toast: ToastT) => void;
|
|
63
|
+
onAutoClose?: (toast: ToastT) => void;
|
|
64
|
+
promise?: PromiseT;
|
|
65
|
+
cancelButtonStyle?: React__default.CSSProperties;
|
|
66
|
+
actionButtonStyle?: React__default.CSSProperties;
|
|
67
|
+
style?: React__default.CSSProperties;
|
|
68
|
+
unstyled?: boolean;
|
|
69
|
+
className?: string;
|
|
70
|
+
classNames?: ToastClassnames;
|
|
71
|
+
descriptionClassName?: string;
|
|
72
|
+
position?: Position;
|
|
73
|
+
}
|
|
74
|
+
type Position = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-center" | "bottom-center";
|
|
75
|
+
interface ToastOptions {
|
|
76
|
+
className?: string;
|
|
77
|
+
closeButton?: boolean;
|
|
78
|
+
descriptionClassName?: string;
|
|
79
|
+
style?: React__default.CSSProperties;
|
|
80
|
+
cancelButtonStyle?: React__default.CSSProperties;
|
|
81
|
+
actionButtonStyle?: React__default.CSSProperties;
|
|
82
|
+
duration?: number;
|
|
83
|
+
unstyled?: boolean;
|
|
84
|
+
classNames?: ToastClassnames;
|
|
85
|
+
}
|
|
86
|
+
type Offset = {
|
|
87
|
+
top?: string | number;
|
|
88
|
+
right?: string | number;
|
|
89
|
+
bottom?: string | number;
|
|
90
|
+
left?: string | number;
|
|
91
|
+
} | string | number;
|
|
92
|
+
interface ToasterProps$1 {
|
|
93
|
+
invert?: boolean;
|
|
94
|
+
theme?: "light" | "dark" | "system";
|
|
95
|
+
position?: Position;
|
|
96
|
+
hotkey?: string[];
|
|
97
|
+
richColors?: boolean;
|
|
98
|
+
expand?: boolean;
|
|
99
|
+
duration?: number;
|
|
100
|
+
gap?: number;
|
|
101
|
+
visibleToasts?: number;
|
|
102
|
+
closeButton?: boolean;
|
|
103
|
+
toastOptions?: ToastOptions;
|
|
104
|
+
className?: string;
|
|
105
|
+
style?: React__default.CSSProperties;
|
|
106
|
+
offset?: Offset;
|
|
107
|
+
mobileOffset?: Offset;
|
|
108
|
+
dir?: "rtl" | "ltr" | "auto";
|
|
109
|
+
swipeDirections?: SwipeDirection[];
|
|
11
110
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
111
|
+
* @deprecated Please use the `icons` prop instead:
|
|
112
|
+
* ```jsx
|
|
113
|
+
* <Toaster
|
|
114
|
+
* icons={{ loading: <LoadingIcon /> }}
|
|
115
|
+
* />
|
|
116
|
+
* ```
|
|
15
117
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
118
|
+
loadingIcon?: React__default.ReactNode;
|
|
119
|
+
icons?: ToastIcons;
|
|
120
|
+
containerAriaLabel?: string;
|
|
121
|
+
pauseWhenPageIsHidden?: boolean;
|
|
122
|
+
}
|
|
123
|
+
type SwipeDirection = "top" | "right" | "bottom" | "left";
|
|
124
|
+
interface ToastToDismiss {
|
|
125
|
+
id: number | string;
|
|
126
|
+
dismiss: boolean;
|
|
127
|
+
}
|
|
128
|
+
type ExternalToast = Omit<ToastT, "id" | "type" | "title" | "jsx" | "delete" | "promise"> & {
|
|
129
|
+
id?: number | string;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
type titleT = (() => React__default.ReactNode) | React__default.ReactNode;
|
|
133
|
+
declare const toast: ((message: titleT, data?: ExternalToast) => string | number) & {
|
|
134
|
+
success: (message: titleT | React__default.ReactNode, data?: ExternalToast) => string | number;
|
|
135
|
+
info: (message: titleT | React__default.ReactNode, data?: ExternalToast) => string | number;
|
|
136
|
+
warning: (message: titleT | React__default.ReactNode, data?: ExternalToast) => string | number;
|
|
137
|
+
error: (message: titleT | React__default.ReactNode, data?: ExternalToast) => string | number;
|
|
138
|
+
custom: (jsx: (id: number | string) => React__default.ReactElement, data?: ExternalToast) => string | number;
|
|
139
|
+
message: (message: titleT | React__default.ReactNode, data?: ExternalToast) => string | number;
|
|
140
|
+
promise: <ToastData>(promise: PromiseT<ToastData>, data?: PromiseData<ToastData> | undefined) => (string & {
|
|
141
|
+
unwrap: () => Promise<ToastData>;
|
|
142
|
+
}) | (number & {
|
|
143
|
+
unwrap: () => Promise<ToastData>;
|
|
144
|
+
}) | {
|
|
145
|
+
unwrap: () => Promise<ToastData>;
|
|
146
|
+
} | undefined;
|
|
147
|
+
dismiss: (id?: number | string) => string | number | undefined;
|
|
148
|
+
loading: (message: titleT | React__default.ReactNode, data?: ExternalToast) => string | number;
|
|
149
|
+
} & {
|
|
150
|
+
getHistory: () => (ToastT | ToastToDismiss)[];
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
declare function useSonner(): {
|
|
154
|
+
toasts: ToastT[];
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
interface ToasterProps extends ToasterProps$1 {
|
|
25
158
|
/**
|
|
26
|
-
* Inject the
|
|
27
|
-
*
|
|
28
|
-
* sheet if you would rather import it.
|
|
159
|
+
* Inject the stylesheet. On by default - see the note above. `false` leaves the markup
|
|
160
|
+
* bare for a theme of your own.
|
|
29
161
|
*/
|
|
30
162
|
styles?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
163
|
+
/**
|
|
164
|
+
* A notification QUEUE to render, alongside anything raised with `toast()`.
|
|
165
|
+
*
|
|
166
|
+
* This is the bridge for `useNotifications().notify()`, which predates the vendored
|
|
167
|
+
* component: everything already written against the queue keeps working, and both APIs
|
|
168
|
+
* end up in one stack rather than in two competing ones. `null` unsubscribes.
|
|
169
|
+
*/
|
|
170
|
+
queue?: Notifications | null;
|
|
38
171
|
}
|
|
39
|
-
declare function Toaster({
|
|
172
|
+
declare function Toaster({ styles, queue, ...props }: ToasterProps): ReactNode;
|
|
40
173
|
|
|
41
|
-
export {
|
|
174
|
+
export { type Action, type ExternalToast, Notifications, type ToastClassnames, type ToastT, Toaster, type ToasterProps, toast, useSonner };
|
package/dist/react/toast.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { ButtonProps } from '../react/button.js';
|
|
3
3
|
export { UseMarqueeResult, useMarquee } from '../react/marquee.js';
|
|
4
4
|
export { M as MarqueeHover, a as MarqueeInstance, b as MarqueeOptions } from '../marquee-CJ3Uwy3E.js';
|
|
5
5
|
export { PasswordStrength, PasswordStrengthProps, UseButtonResult, UseInputResult, getLinkComponent, setLinkComponent, useButton, useInput } from '../react/index.js';
|
|
6
6
|
export { UseSearchResult, useSearch } from '../react/search.js';
|
|
7
7
|
export { I as InputAction, b as InputIcon, d as InputOptions } from '../input-BwXjFenq.js';
|
|
8
|
-
export { F as FuseConstructor, a as FuseLike, S as SearchInstance, b as SearchMatch, c as SearchOptions } from '../search-
|
|
8
|
+
export { F as FuseConstructor, a as FuseLike, S as SearchInstance, b as SearchMatch, c as SearchOptions, s as shortenQuery } from '../search-DYgqRp37.js';
|
|
9
9
|
export { c as ButtonOptions, d as ButtonState } from '../button-CaXaqG_K.js';
|
|
10
|
-
export { B as BreachChecker, a as BreachState, b as BreachStatus, F as FieldAction, I as Input, c as InputBaseProps, d as InputProps, e as InputType, P as PasswordOnlyProps, g as PlainOnlyProps, S as SearchOnlyProps } from '../index-
|
|
10
|
+
export { B as BreachChecker, a as BreachState, b as BreachStatus, F as FieldAction, I as Input, c as InputBaseProps, d as InputProps, e as InputType, P as PasswordOnlyProps, g as PlainOnlyProps, S as SearchOnlyProps } from '../index-DQNnohoo.js';
|
|
11
11
|
export { Slot, SlotProps, mergeSlotProps } from '../react/slot.js';
|
|
12
12
|
export { E as EstimateOptions, G as GeneratePasswordOptions, a as PasswordScore, b as PasswordStrengthReport, e as estimatePasswordStrength, g as generatePassword } from '../password-C8lG4Zm9.js';
|
|
13
13
|
export { UseNotificationsResult, createNotificationQueue, defaultQueue, useNotifications } from '../react/notifications.js';
|
|
14
|
-
export {
|
|
14
|
+
export { Action, ExternalToast, ToastClassnames, ToastT, Toaster, ToasterProps, toast, useSonner } from '../react/toast.js';
|
|
15
15
|
export { useNetworkState } from '../react/network.js';
|
|
16
16
|
export { a as NetworkState } from '../network-D2LsBG_k.js';
|
|
17
17
|
export { RelativeTime, RelativeTimeProps } from '../react/relative-time.js';
|
|
@@ -21,7 +21,14 @@ export { Flag, FlagProps } from '../react/flag.js';
|
|
|
21
21
|
export { c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, h as configureFlags, i as flagAttributes, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode } from '../flags-BQU1V9rE.js';
|
|
22
22
|
export { PaletteContent, PaletteContextValue, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteListProps, PaletteRoot, PaletteRootProps, PaletteRow, PaletteSection, PaletteTrigger, SearchPalette, SearchPaletteProps, usePaletteContext } from '../react/palette.js';
|
|
23
23
|
export { R as RecentEntry, b as RecentStore, e as createRecentStore, g as groupRows, i as isPaletteShortcut, m as moveActive, r as recentKey, s as shortcutLabel } from '../palette-D7iuQh_T.js';
|
|
24
|
+
export { Select, SelectContent, SelectContextValue, SelectItem, SelectList, SelectMultipleProps, SelectOptionRow, SelectProps, SelectRoot, SelectRootProps, SelectSearch, SelectSingleProps, SelectTrigger, SelectValue, useSelectContext } from '../react/select.js';
|
|
25
|
+
export { a as SelectInstance, c as SelectOption, d as SelectOptions, e as SelectState, f as createSelect } from '../select-ClSy-J1f.js';
|
|
26
|
+
export { ContextMenu, ContextMenuContent, ContextMenuContentProps, ContextMenuContextValue, ContextMenuItem, ContextMenuList, ContextMenuNode, ContextMenuPanel, ContextMenuProps, ContextMenuRoot, ContextMenuRootProps, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, ContextMenuTriggerProps, useContextMenuContext } from '../react/context-menu.js';
|
|
27
|
+
export { a as ContextMenuAction, b as ContextMenuEntry, c as ContextMenuInstance, g as ContextMenuOptions, j as ContextMenuState, k as createContextMenu, l as isAction } from '../context-menu-D3FtTn7v.js';
|
|
28
|
+
export { MarqueeRect, SelectionList, SelectionListProps, SelectionRenderer, SelectionRowRender, UseSelectionOptions, UseSelectionResult, useSelection } from '../react/selection.js';
|
|
29
|
+
export { D as DEFAULT_SELECTION_SHORTCUTS, a as SelectionCommand, b as SelectionCommandEvent, c as SelectionCommandName, d as SelectionInstance, e as SelectionOptions, f as SelectionShortcuts, g as SelectionState, h as createSelection } from '../selection-B_pmzHpy.js';
|
|
30
|
+
export { S as Shortcut, b as ShortcutSpec, i as isApplePlatform, m as matchesShortcut, p as parseShortcut, e as shortcutText, f as shortcutTokens } from '../keys-D2zJs1uB.js';
|
|
24
31
|
|
|
25
|
-
declare const Button:
|
|
32
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>;
|
|
26
33
|
|
|
27
34
|
export { Button, ButtonProps };
|