@assure-one/design-system 1.41.2 → 1.43.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/brand-scope-BOKu4iOc.d.ts +262 -0
- package/dist/{chunk-UAPQ7VTS.js → chunk-LUWPEBXZ.js} +283 -178
- package/dist/chunk-LUWPEBXZ.js.map +1 -0
- package/dist/{chunk-AF3QYJ24.js → chunk-TBDTXAFH.js} +6 -4
- package/dist/chunk-TBDTXAFH.js.map +1 -0
- package/dist/{chunk-JKNHNNNY.js → chunk-TYXT5C2B.js} +95 -11
- package/dist/chunk-TYXT5C2B.js.map +1 -0
- package/dist/{chunk-XN7OBLQR.js → chunk-XJKCKBHI.js} +20 -16
- package/dist/chunk-XJKCKBHI.js.map +1 -0
- package/dist/css/components.css +1 -1
- package/dist/css/tokens.css +4 -4
- package/dist/{data-table-view-ep8al7P9.d.ts → data-table-view-BWhKeUiw.d.ts} +186 -2
- package/dist/{design-system-provider-CfD2g2lY.d.ts → design-system-provider-Coe2S3Lh.d.ts} +1 -1
- package/dist/icons/index.d.ts +5 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +290 -455
- package/dist/index.js +636 -250
- package/dist/index.js.map +1 -1
- package/dist/legacy/index.d.ts +11 -4
- package/dist/legacy/index.js +3 -3
- package/dist/next/index.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/dist/suite/index.d.ts +14 -3
- package/dist/suite/index.js +3 -3
- package/dist/{types-Coqw8iaS.d.ts → types-DlqmlVyZ.d.ts} +11 -1
- package/docs/components.md +11 -8
- package/docs/components.registry.json +89 -22
- package/package.json +1 -1
- package/dist/brand-scope-BOHId6BY.d.ts +0 -58
- package/dist/chunk-AF3QYJ24.js.map +0 -1
- package/dist/chunk-JKNHNNNY.js.map +0 -1
- package/dist/chunk-UAPQ7VTS.js.map +0 -1
- package/dist/chunk-XN7OBLQR.js.map +0 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { C as ComboboxMessages } from './types-DlqmlVyZ.js';
|
|
5
|
+
import { C as ControlSize } from './vocab-DornLJbW.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* L1a behaviour primitive (private). Not exported from the package.
|
|
9
|
+
*
|
|
10
|
+
* The canonical option model of every list-shaped control (W4-09; target
|
|
11
|
+
* architecture §32): `Select`, the coming `Combobox` (W4-10) and its
|
|
12
|
+
* `MultiSelect` preset (W4-11), the `SearchSelect` adapter (W4-12) and the
|
|
13
|
+
* `PeoplePicker` pattern all read one shape, in place of the six that ship
|
|
14
|
+
* today (`{value,label}`, `{id,label,group…}`, `{id,label,email}`,
|
|
15
|
+
* `{id,fullName}`, `{key,label,dot}`, `string[]`).
|
|
16
|
+
*
|
|
17
|
+
* Two halves:
|
|
18
|
+
*
|
|
19
|
+
* - {@link Option} and its accessors: what a row *is*. Consumers with domain
|
|
20
|
+
* objects pass {@link OptionAccessors} (`getOptionValue`/`getOptionLabel`)
|
|
21
|
+
* instead of remapping, and {@link toOptions} normalises everything — a
|
|
22
|
+
* `string[]`, domain objects, `Option`s — into one array the list renders.
|
|
23
|
+
* - The selection helpers: what a control's *value* is, discriminated by
|
|
24
|
+
* `multiple` (single `TValue | null`, multi `TValue[]`; §32 "Value"). `""`
|
|
25
|
+
* keeps meaning empty in 2.x (§32 "Compat"), so {@link normalizeSingleValue}
|
|
26
|
+
* folds it to `null` at the boundary.
|
|
27
|
+
*
|
|
28
|
+
* No React, no client directive, no DOM: plain functions over plain data, so
|
|
29
|
+
* the same module serves a Server Component, a test and the keyboard helper.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* One row of a list-shaped control.
|
|
33
|
+
*
|
|
34
|
+
* `value` is never `""`: emptiness is `value === null` on the control, not a
|
|
35
|
+
* sentinel row (§32). `label` is the string typeahead, filtering and the
|
|
36
|
+
* accessible name read; `description` and `icon` are rendered, never searched.
|
|
37
|
+
* `keywords` widen the match without showing. `meta` carries consumer data
|
|
38
|
+
* through to `renderOption` / `onValueChange` details untouched.
|
|
39
|
+
*
|
|
40
|
+
* @experimental
|
|
41
|
+
*/
|
|
42
|
+
interface Option<TValue extends string = string, TMeta = unknown> {
|
|
43
|
+
value: TValue;
|
|
44
|
+
label: string;
|
|
45
|
+
description?: ReactNode;
|
|
46
|
+
/** Leading visual: icon, avatar, flag, colour swatch. */
|
|
47
|
+
icon?: ReactNode;
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
group?: string | undefined;
|
|
50
|
+
keywords?: readonly string[] | undefined;
|
|
51
|
+
meta?: TMeta;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* How a list reads a consumer's own item type. Only `getOptionValue` and
|
|
55
|
+
* `getOptionLabel` are required: an item with no `disabled`/`group`/`keywords`
|
|
56
|
+
* accessor is enabled, ungrouped and matched on its label alone.
|
|
57
|
+
*
|
|
58
|
+
* @experimental
|
|
59
|
+
*/
|
|
60
|
+
interface OptionAccessors<TItem, TValue extends string = string> {
|
|
61
|
+
getOptionValue: (item: TItem) => TValue;
|
|
62
|
+
getOptionLabel: (item: TItem) => string;
|
|
63
|
+
getOptionDisabled?: ((item: TItem) => boolean) | undefined;
|
|
64
|
+
getOptionGroup?: ((item: TItem) => string | undefined) | undefined;
|
|
65
|
+
getOptionKeywords?: ((item: TItem) => readonly string[] | undefined) | undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The English defaults (the `combobox` namespace of the catalogue). */
|
|
69
|
+
declare const DEFAULT_COMBOBOX_MESSAGES: ComboboxMessages;
|
|
70
|
+
/** The sizes a combobox offers: the shared control scale (A1). @experimental */
|
|
71
|
+
type ComboboxSize = ControlSize;
|
|
72
|
+
/** What `renderOption` is told about the row it renders. @experimental */
|
|
73
|
+
interface ComboboxOptionState {
|
|
74
|
+
selected: boolean;
|
|
75
|
+
highlighted: boolean;
|
|
76
|
+
disabled: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Class overrides per part, for the consumer who must restyle one slot
|
|
80
|
+
* without reaching into the DOM.
|
|
81
|
+
*
|
|
82
|
+
* @experimental
|
|
83
|
+
*/
|
|
84
|
+
interface ComboboxClassNames {
|
|
85
|
+
root?: string;
|
|
86
|
+
control?: string;
|
|
87
|
+
input?: string;
|
|
88
|
+
chip?: string;
|
|
89
|
+
content?: string;
|
|
90
|
+
list?: string;
|
|
91
|
+
item?: string;
|
|
92
|
+
}
|
|
93
|
+
/** @experimental */
|
|
94
|
+
interface ComboboxBaseProps<TItem, TValue extends string> extends Partial<OptionAccessors<TItem, TValue>> {
|
|
95
|
+
/** The rows: `Option`s, strings, or domain objects read through the accessors. */
|
|
96
|
+
options: readonly TItem[];
|
|
97
|
+
id?: string | undefined;
|
|
98
|
+
/** The form field name. Without it nothing is submitted. */
|
|
99
|
+
name?: string | undefined;
|
|
100
|
+
/** The `id` of the form to submit with when the control is rendered outside it. */
|
|
101
|
+
form?: string | undefined;
|
|
102
|
+
required?: boolean | undefined;
|
|
103
|
+
disabled?: boolean | undefined;
|
|
104
|
+
readOnly?: boolean | undefined;
|
|
105
|
+
invalid?: boolean | undefined;
|
|
106
|
+
/** The accessible name of a combobox outside a `Field`. */
|
|
107
|
+
"aria-label"?: string | undefined;
|
|
108
|
+
"aria-labelledby"?: string | undefined;
|
|
109
|
+
"aria-describedby"?: string | undefined;
|
|
110
|
+
placeholder?: string | undefined;
|
|
111
|
+
/** Outer height from the shared control scale. Default `md` (36px). */
|
|
112
|
+
size?: ComboboxSize | undefined;
|
|
113
|
+
/** A leading glyph inside the control, decorative. */
|
|
114
|
+
icon?: ReactNode | undefined;
|
|
115
|
+
/** Show a clear button while a value is set. Default `true`. */
|
|
116
|
+
clearable?: boolean | undefined;
|
|
117
|
+
/** Open the list when the input receives focus. Default `false`. */
|
|
118
|
+
openOnFocus?: boolean | undefined;
|
|
119
|
+
/** Whether the list surface flips to stay in the viewport. Default `true`. */
|
|
120
|
+
avoidCollisions?: boolean | undefined;
|
|
121
|
+
open?: boolean | undefined;
|
|
122
|
+
defaultOpen?: boolean | undefined;
|
|
123
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
124
|
+
/** The typed query (controlled). */
|
|
125
|
+
search?: string | undefined;
|
|
126
|
+
defaultSearch?: string | undefined;
|
|
127
|
+
/** Called with every query the user types (an async source fetches here). */
|
|
128
|
+
onSearchChange?: ((query: string) => void) | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Filter `options` by the query (`true`, the default). `false` when the
|
|
131
|
+
* consumer filters — the options are already the answer to the query.
|
|
132
|
+
*/
|
|
133
|
+
shouldFilter?: boolean | undefined;
|
|
134
|
+
/** An async source is fetching: a spinner in the control, `loadingState` in the list. */
|
|
135
|
+
loading?: boolean | undefined;
|
|
136
|
+
emptyState?: ReactNode | undefined;
|
|
137
|
+
loadingState?: ReactNode | undefined;
|
|
138
|
+
/** Rendered above the list, inside the popover. */
|
|
139
|
+
header?: ReactNode | undefined;
|
|
140
|
+
/** Rendered below the list, inside the popover. */
|
|
141
|
+
footer?: ReactNode | undefined;
|
|
142
|
+
/** Offer a "Create …" row for a query that matches no option exactly. */
|
|
143
|
+
onCreate?: ((query: string) => void) | undefined;
|
|
144
|
+
/** Replaces the content of a row. */
|
|
145
|
+
renderOption?: ((option: Option<TValue, unknown>, state: ComboboxOptionState) => ReactNode) | undefined;
|
|
146
|
+
messages?: Partial<ComboboxMessages> | undefined;
|
|
147
|
+
className?: string | undefined;
|
|
148
|
+
classNames?: ComboboxClassNames | undefined;
|
|
149
|
+
/** The input element. */
|
|
150
|
+
ref?: React$1.Ref<HTMLInputElement> | undefined;
|
|
151
|
+
}
|
|
152
|
+
/** @experimental */
|
|
153
|
+
interface ComboboxSingleProps<TItem, TValue extends string> extends ComboboxBaseProps<TItem, TValue> {
|
|
154
|
+
multiple?: false | undefined;
|
|
155
|
+
/** The picked value, or `null`. `""` means empty (2.x compat). */
|
|
156
|
+
value?: TValue | "" | null | undefined;
|
|
157
|
+
defaultValue?: TValue | "" | null | undefined;
|
|
158
|
+
onValueChange?: ((value: TValue | null, details: {
|
|
159
|
+
option: Option<TValue, unknown> | null;
|
|
160
|
+
}) => void) | undefined;
|
|
161
|
+
/** Replaces the closed control's text for the picked option. */
|
|
162
|
+
renderValue?: ((option: Option<TValue, unknown>) => ReactNode) | undefined;
|
|
163
|
+
/** Close the list after a pick. Default `true`. */
|
|
164
|
+
closeOnSelect?: boolean | undefined;
|
|
165
|
+
}
|
|
166
|
+
/** What `renderValue` receives in `multiple` mode besides the picked options. @experimental */
|
|
167
|
+
interface ComboboxSelectionControls<TValue extends string> {
|
|
168
|
+
/** Removes one value from the selection. */
|
|
169
|
+
remove: (value: TValue) => void;
|
|
170
|
+
}
|
|
171
|
+
/** @experimental */
|
|
172
|
+
interface ComboboxMultipleProps<TItem, TValue extends string> extends ComboboxBaseProps<TItem, TValue> {
|
|
173
|
+
multiple: true;
|
|
174
|
+
/** The picked values, in pick order. Empty strings are dropped. */
|
|
175
|
+
value?: readonly (TValue | "")[] | undefined;
|
|
176
|
+
defaultValue?: readonly (TValue | "")[] | undefined;
|
|
177
|
+
onValueChange?: ((value: TValue[], details: {
|
|
178
|
+
option: Option<TValue, unknown> | null;
|
|
179
|
+
}) => void) | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Replaces the chips inside the control: called with the picked options
|
|
182
|
+
* and `remove`. Return `null` to render nothing there.
|
|
183
|
+
*/
|
|
184
|
+
renderValue?: ((options: Option<TValue, unknown>[], controls: ComboboxSelectionControls<TValue>) => ReactNode) | undefined;
|
|
185
|
+
/** Close the list after a pick. Default `false`: keep picking. */
|
|
186
|
+
closeOnSelect?: boolean | undefined;
|
|
187
|
+
/** Drop picked rows from the list (the chips already show them). Default `false`. */
|
|
188
|
+
hideSelected?: boolean | undefined;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The props, discriminated by `multiple` (target architecture §32 "Value"):
|
|
192
|
+
* a single pick is `TValue | null`, a multi pick is `TValue[]`.
|
|
193
|
+
*
|
|
194
|
+
* @experimental
|
|
195
|
+
*/
|
|
196
|
+
type ComboboxProps<TItem = Option, TValue extends string = string> = ComboboxSingleProps<TItem, TValue> | ComboboxMultipleProps<TItem, TValue>;
|
|
197
|
+
/**
|
|
198
|
+
* The searchable pick: one input, a portalled listbox, the option model.
|
|
199
|
+
* See the module comment.
|
|
200
|
+
*
|
|
201
|
+
* @experimental
|
|
202
|
+
*/
|
|
203
|
+
declare function Combobox<TItem = Option, TValue extends string = string>(props: ComboboxProps<TItem, TValue>): react_jsx_runtime.JSX.Element;
|
|
204
|
+
declare namespace Combobox {
|
|
205
|
+
var displayName: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Brand scope — ambient product theming.
|
|
210
|
+
*
|
|
211
|
+
* The `brand` color family (bg-brand, hover:bg-brand-hover, bg-brand-bg,
|
|
212
|
+
* border-brand-line, text-fg-on-brand, plus the accent/focus/primary
|
|
213
|
+
* interaction tokens) follows the nearest `[data-brand]` scope and defaults to
|
|
214
|
+
* Pro. Authors type the STATE only; the product comes from the scope. Set it
|
|
215
|
+
* once high in the tree — ideally on the same root as the `.dark` class
|
|
216
|
+
* (`<html>`/`<body>`) — so Radix-portalled surfaces inherit it through the DOM.
|
|
217
|
+
*
|
|
218
|
+
* <html data-brand="tax"> // whole shell renders teal
|
|
219
|
+
* <div {...brandScope("audit")}> // a subtree renders blue
|
|
220
|
+
*
|
|
221
|
+
* For the rarer case of multiple scopes on one page WITH portalled content
|
|
222
|
+
* (a Dialog/Popover that escapes its scoped subtree to document.body), wrap the
|
|
223
|
+
* region in <BrandScope> / <BrandScopeProvider> and have the portalled
|
|
224
|
+
* `*Content` re-stamp `data-brand={useBrandScope()}` on its own element.
|
|
225
|
+
*/
|
|
226
|
+
type BrandProduct = "pro" | "audit" | "books" | "tax";
|
|
227
|
+
/**
|
|
228
|
+
* `data-brand` attribute object to spread on any element (mirrors
|
|
229
|
+
* `serviceToneStyle`). This is the primary API for opting a subtree into a
|
|
230
|
+
* product without naming the product in a utility class.
|
|
231
|
+
*/
|
|
232
|
+
declare function brandScope(product: BrandProduct): {
|
|
233
|
+
"data-brand": BrandProduct;
|
|
234
|
+
};
|
|
235
|
+
/** Every product, in suite order — for switchers and story matrices. */
|
|
236
|
+
declare const BRAND_PRODUCTS: BrandProduct[];
|
|
237
|
+
/** Human label for a product, for switchers and headings. */
|
|
238
|
+
declare const brandLabel: Record<BrandProduct, string>;
|
|
239
|
+
/**
|
|
240
|
+
* Provides the active product to descendants so portalled surfaces can
|
|
241
|
+
* re-stamp `data-brand` on themselves via {@link useBrandScope}. Purely a
|
|
242
|
+
* structural carrier — the visual theming still comes from the `[data-brand]`
|
|
243
|
+
* attribute in the DOM, not from this context.
|
|
244
|
+
*/
|
|
245
|
+
declare function BrandScopeProvider({ product, children, }: {
|
|
246
|
+
product: BrandProduct;
|
|
247
|
+
children: React.ReactNode;
|
|
248
|
+
}): react_jsx_runtime.JSX.Element;
|
|
249
|
+
/** Read the ambient product from the nearest provider (defaults to Pro). */
|
|
250
|
+
declare function useBrandScope(): BrandProduct;
|
|
251
|
+
interface BrandScopeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
252
|
+
/** The product this subtree renders as. */
|
|
253
|
+
product: BrandProduct;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Convenience wrapper that stamps `data-brand` on a `<div>` AND provides the
|
|
257
|
+
* product via context, so a portalled descendant can re-stamp itself. Use
|
|
258
|
+
* `brandScope()` directly when you want the attribute on your own element.
|
|
259
|
+
*/
|
|
260
|
+
declare const BrandScope: React$1.ForwardRefExoticComponent<BrandScopeProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
261
|
+
|
|
262
|
+
export { BRAND_PRODUCTS as B, type ComboboxSize as C, DEFAULT_COMBOBOX_MESSAGES as D, type Option as O, type BrandProduct as a, brandLabel as b, type ComboboxMultipleProps as c, type ComboboxProps as d, BrandScope as e, type BrandScopeProps as f, BrandScopeProvider as g, Combobox as h, type ComboboxBaseProps as i, type ComboboxClassNames as j, type ComboboxOptionState as k, type ComboboxSelectionControls as l, type ComboboxSingleProps as m, type OptionAccessors as n, brandScope as o, useBrandScope as u };
|