twico-ui 1.6.0 → 1.8.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/index.d.cts CHANGED
@@ -1,5 +1,141 @@
1
1
  import * as React from 'react';
2
2
 
3
+ interface TwicoProviderProps {
4
+ /** CSP nonce stamped on every injected `<style>` (for `style-src 'nonce-…'` without `unsafe-inline`). */
5
+ nonce?: string;
6
+ children?: React.ReactNode;
7
+ }
8
+
9
+ declare function TwicoProvider(props: TwicoProviderProps): React.JSX.Element;
10
+
11
+ /** A friendly, partial token surface. Each entry maps to a `--<group>-<key>` CSS variable. */
12
+ interface ThemeTokens {
13
+ /** `--color-*` (e.g. `{ primary: "#5b5bd6" }`). */
14
+ colors?: Record<string, string>;
15
+ /** `--space-*`. */
16
+ space?: Record<string, string>;
17
+ /** `--radius-*`. */
18
+ radius?: Record<string, string>;
19
+ /** `--font-*`. */
20
+ font?: Record<string, string>;
21
+ /** `--shadow-*`. */
22
+ shadow?: Record<string, string>;
23
+ /** Motion vars (e.g. `{ "ease-out": "…", "duration-base": "…" }`) — keyed by the full var suffix. */
24
+ motion?: Record<string, string>;
25
+ }
26
+
27
+ /** A CSS custom-property style object (`{ "--color-primary": "…" }`). */
28
+ type Theme = Record<`--${string}`, string>;
29
+
30
+ /** Map a partial token object onto a `--*` CSS-variable style object. */
31
+ declare function createTheme(partial: ThemeTokens): Theme;
32
+
33
+ interface ThemeProviderProps extends React.HTMLAttributes<HTMLDivElement> {
34
+ /** A `createTheme()` result, or a raw partial token object. */
35
+ theme?: Theme | ThemeTokens;
36
+ /** `"inline"` sets the vars inline (SSR-safe); `"stylesheet"` injects a scoped, nonce-aware rule. @default "inline" */
37
+ mode?: "inline" | "stylesheet";
38
+ }
39
+
40
+ declare function ThemeProvider(props: ThemeProviderProps): React.JSX.Element;
41
+
42
+ interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
43
+ /** Submit handler — runs after `preventDefault()` (unless `preventDefault={false}`). */
44
+ onSubmit?: (e: React.FormEvent<HTMLFormElement>) => void;
45
+ /** Call `event.preventDefault()` before `onSubmit`. @default true */
46
+ preventDefault?: boolean;
47
+ /** Disable every control (via a `<fieldset disabled>`) and set `aria-busy`. @default false */
48
+ loading?: boolean;
49
+ /** Disable every control (via a `<fieldset disabled>`). @default false */
50
+ disabled?: boolean;
51
+ /** Vertical gap between children as a spacing-scale step (e.g. 4 → var(--space-4)). */
52
+ gap?: number;
53
+ }
54
+
55
+ declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
56
+
57
+ interface VisuallyHiddenProps extends React.HTMLAttributes<HTMLElement> {
58
+ /** Element to render. @default "span" */
59
+ as?: React.ElementType;
60
+ }
61
+
62
+ declare const VisuallyHidden: React.ForwardRefExoticComponent<
63
+ VisuallyHiddenProps & React.RefAttributes<HTMLElement>
64
+ >;
65
+
66
+ interface PortalProps {
67
+ children?: React.ReactNode;
68
+ }
69
+
70
+ declare function Portal(props: PortalProps): React.ReactPortal | React.ReactNode | null;
71
+
72
+ interface ColorSchemeScriptOptions {
73
+ /** localStorage key holding the theme (matches useColorScheme). @default "twico-theme" */
74
+ storageKey?: string;
75
+ /** How the scheme is applied: the `dark` class, or a `[data-…]` attribute value. @default "class" */
76
+ attribute?: string;
77
+ /** Scheme to use when nothing is stored (skips the prefers-color-scheme probe). */
78
+ defaultScheme?: "light" | "dark";
79
+ }
80
+
81
+ interface ColorSchemeScriptProps extends ColorSchemeScriptOptions {
82
+ /** CSP nonce for the inline `<script>`. */
83
+ nonce?: string;
84
+ }
85
+
86
+ /** The theme-init IIFE as a string, for consumers who inject the script themselves. */
87
+ declare function getColorSchemeScript(options?: ColorSchemeScriptOptions): string;
88
+
89
+ /** A `<script>` for the SSR `<head>` that applies the persisted color scheme before first paint. */
90
+ declare function ColorSchemeScript(props: ColorSchemeScriptProps): React.JSX.Element;
91
+
92
+ type KbdProps = React.HTMLAttributes<HTMLElement>;
93
+
94
+ declare const Kbd: React.ForwardRefExoticComponent<KbdProps & React.RefAttributes<HTMLElement>>;
95
+
96
+ type PreProps = React.HTMLAttributes<HTMLPreElement>;
97
+
98
+ declare const Pre: React.ForwardRefExoticComponent<PreProps & React.RefAttributes<HTMLPreElement>>;
99
+
100
+ interface AnchorProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
101
+ /** Element to render (e.g. a router Link). @default "a" */
102
+ as?: React.ElementType;
103
+ /** Open in a new tab with rel="noopener noreferrer" and a ↗ affix. @default false */
104
+ external?: boolean;
105
+ }
106
+
107
+ declare const Anchor: React.ForwardRefExoticComponent<AnchorProps & React.RefAttributes<HTMLAnchorElement>>;
108
+
109
+ interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
110
+ /** Id of the control this labels. */
111
+ htmlFor?: string;
112
+ /** Append a danger-colored asterisk. @default false */
113
+ required?: boolean;
114
+ /** @default "md" */
115
+ size?: "sm" | "md" | "lg";
116
+ }
117
+
118
+ declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
119
+
120
+ interface ImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, "alt"> {
121
+ /** Image source URL. */
122
+ src?: string;
123
+ /** Alternative text (required for accessibility; pass "" for decorative images). */
124
+ alt: string;
125
+ /** object-fit value. */
126
+ fit?: "cover" | "contain" | "fill" | "none" | "scale-down";
127
+ /** Border radius token (e.g. "md", "lg", "full"). */
128
+ radius?: string;
129
+ /** CSS aspect-ratio (e.g. "16/9"). */
130
+ aspectRatio?: string;
131
+ /** Source swapped in if the image fails to load. */
132
+ fallback?: string;
133
+ /** @default "lazy" */
134
+ loading?: "lazy" | "eager";
135
+ }
136
+
137
+ declare const Image: React.ForwardRefExoticComponent<ImageProps & React.RefAttributes<HTMLImageElement>>;
138
+
3
139
  /**
4
140
  * Vertically stacked, expandable disclosure panels with smooth height animation.
5
141
  *
@@ -57,6 +193,58 @@ type BarTone = Exclude<Tone, "neutral">;
57
193
  */
58
194
  type PolymorphicAs = React.ElementType;
59
195
 
196
+ /**
197
+ * The `sx` style-prop escape hatch (#53). Top-level CSS properties are applied as inline
198
+ * style (and win over the component's base style, MUI-style); any nested object — a
199
+ * selector key (`"&:hover"`, `":focus-visible"`, `"& > .child"`) or an at-rule
200
+ * (`"@media (min-width: 600px)"`, `"@supports …"`, `"@container …"`) — is compiled to a
201
+ * scoped stylesheet. Use design tokens for values, e.g. `color: "var(--color-primary)"`.
202
+ * See docs/sx.md.
203
+ */
204
+ type Sx = React.CSSProperties & {
205
+ [selector: string]: React.CSSProperties[keyof React.CSSProperties] | string | number | Sx | undefined;
206
+ };
207
+
208
+ // ── Polymorphic component type kit ────────────────────────────────────────────
209
+ // Powers the `as`-driven primitives (Box, Stack, Grid, Container, Text, Heading).
210
+ // Passing `as="a"` narrows the accepted props to that element's attributes (href,
211
+ // target, …) and types `ref` as the matching element (HTMLAnchorElement); the
212
+ // component's own style props always merge on top. `as={RouterLink}` accepts that
213
+ // component's props instead. See docs/polymorphic-types.md and docs/prop-conventions.md.
214
+
215
+ /** The `ref` type for a given `as` element `C` (e.g. `HTMLAnchorElement` for `"a"`). */
216
+ type PolymorphicRef<C extends React.ElementType> = React.ComponentPropsWithRef<C>["ref"];
217
+
218
+ /** Own props merged over `E`'s props — the component's own props win on a name clash. */
219
+ type Merge<E, Own> = Own & Omit<E, keyof Own>;
220
+
221
+ /** Own props + `as={C}`, merged with `C`'s intrinsic props (own props win on a name clash). */
222
+ type PolymorphicProps<C extends React.ElementType, Own = {}> =
223
+ Merge<React.ComponentPropsWithoutRef<C>, Own> & { as?: C };
224
+
225
+ /** {@link PolymorphicProps} plus a correctly-typed `ref` for the resolved element. */
226
+ type PolymorphicPropsWithRef<C extends React.ElementType, Own = {}> =
227
+ PolymorphicProps<C, Own> & { ref?: PolymorphicRef<C> };
228
+
229
+ /**
230
+ * The callable type of a polymorphic `forwardRef` component whose default element is `D`.
231
+ *
232
+ * Two overloads keep prop-checking strict in both directions: when `as` is omitted the
233
+ * default element `D` is used and its props (plus the own props) are enforced; when
234
+ * `as={C}` is given, `C`'s props and a matching `ref` are enforced instead. A single
235
+ * generic signature would let JSX fall back to the `ElementType` constraint and silently
236
+ * accept anything, so the overloads are deliberate.
237
+ */
238
+ interface PolymorphicComponent<Own, D extends React.ElementType> {
239
+ (
240
+ props: Merge<React.ComponentPropsWithoutRef<D>, Own> & { as?: never; ref?: PolymorphicRef<D> },
241
+ ): React.ReactElement | null;
242
+ <C extends React.ElementType>(
243
+ props: Merge<React.ComponentPropsWithoutRef<C>, Own> & { as: C; ref?: PolymorphicRef<C> },
244
+ ): React.ReactElement | null;
245
+ displayName?: string;
246
+ }
247
+
60
248
  /**
61
249
  * Inline message banner with semantic tones, optional title, icon, and dismiss.
62
250
  */
@@ -300,6 +488,8 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">
300
488
  interactive?: boolean;
301
489
  /** Stretch to fill the parent cell (`height: 100%`) — equal-height cards in a grid/flex row. */
302
490
  fullHeight?: boolean;
491
+ /** Style escape hatch: flat CSS goes inline; nested selectors/at-rules (`"&:hover"`, `"@media …"`) compile to a scoped stylesheet. */
492
+ sx?: Sx;
303
493
  children?: React.ReactNode;
304
494
  }
305
495
 
@@ -432,6 +622,8 @@ interface ColorPickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "o
432
622
  presets?: string[];
433
623
  /** Disable all interaction (the popover cannot be opened). @default false */
434
624
  disabled?: boolean;
625
+ /** Show an alpha slider and emit 8-digit `#RRGGBBAA`; the hex input then accepts 3/6/8-digit hex. @default false */
626
+ alpha?: boolean;
435
627
  /** Color intent for the focus/open accent. @default "primary" */
436
628
  tone?: Tone;
437
629
  onChange?: (hex: string) => void;
@@ -508,6 +700,10 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
508
700
  emptyText?: string;
509
701
  /** Name for a hidden form field so the selected value participates in native form submission. */
510
702
  name?: string;
703
+ /** Virtualize the option list — render only the visible slice (plus `overscan`) for long lists. @default false */
704
+ virtualized?: boolean;
705
+ /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
706
+ overscan?: number;
511
707
  /** Composed with the field's open-on-focus behavior — your handler runs first. */
512
708
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
513
709
  /** Composed with the field's keyboard navigation (Arrows/Enter/Escape) — your handler runs first; call `event.preventDefault()` to suppress it. */
@@ -683,10 +879,20 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
683
879
  batchActions?: DatatableBatchAction<T>[];
684
880
  /** Row height preset. With `showDensity`, the toolbar density button cycles it locally; changing this prop re-applies it. @default "comfortable" */
685
881
  density?: "compact" | "standard" | "comfortable";
686
- /** Initial rows per page. 0 disables pagination. @default 10 */
882
+ /**
883
+ * Rows per page. 0 disables pagination. Uncontrolled by default (changing the prop
884
+ * re-applies it and resets to the first page); becomes **controlled** when
885
+ * `onPageSizeChange` is supplied. @default 10
886
+ */
687
887
  pageSize?: number;
688
888
  /** Options shown in the rows-per-page selector. @default [5, 10, 25, 50] */
689
889
  pageSizeOptions?: number[];
890
+ /** Controlled current page (0-based). When set, the table renders this page and reports changes via `onPageChange` instead of managing its own. */
891
+ page?: number;
892
+ /** Fires with the next 0-based page on user pagination (and when a page-size/query change resets to page 0). Required to control `page`. */
893
+ onPageChange?: (page: number) => void;
894
+ /** Fires with the next rows-per-page when the user picks one; supplying it makes `pageSize` controlled. */
895
+ onPageSizeChange?: (pageSize: number) => void;
690
896
  /** Max height of the scroll area in px (header/footer stay fixed). @default 440 */
691
897
  height?: number;
692
898
  /**
@@ -949,6 +1155,10 @@ interface DatePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "on
949
1155
  tone?: Tone;
950
1156
  /** Show a clear (×) button when a date is set. @default true */
951
1157
  clearable?: boolean;
1158
+ /** Render the trigger as a typeable text input with a trailing calendar toggle; typed text commits via `parse` on Enter/blur. @default false */
1159
+ editable?: boolean;
1160
+ /** Parse typed text into a Date (used when `editable`). Return a `Date` to commit, `null`/invalid to revert. Defaults to a lenient `Date.parse`. */
1161
+ parse?: (text: string) => Date | null;
952
1162
  /** Custom display formatter (defaults to a localized medium date). */
953
1163
  format?: (date: Date) => string;
954
1164
  /** BCP-47 locale for month/weekday names + date formatting (Intl). Omit for the runtime default. @default undefined */
@@ -1001,6 +1211,10 @@ interface DateRangePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>
1001
1211
  disabled?: boolean;
1002
1212
  /** Color intent for the focus/open accent. @default "primary" */
1003
1213
  tone?: Tone;
1214
+ /** Render the trigger as a typeable input accepting "start – end"; typed text commits via `parse` on Enter/blur. @default false */
1215
+ editable?: boolean;
1216
+ /** Parse one side of the typed range into a Date (used when `editable`). Return a `Date` to accept, `null`/invalid to reject. Defaults to a lenient `Date.parse`. */
1217
+ parse?: (text: string) => Date | null;
1004
1218
  onChange?: (range: DateRange) => void;
1005
1219
  }
1006
1220
 
@@ -1357,6 +1571,10 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
1357
1571
  max?: number;
1358
1572
  /** Collapse chips after N into a "+K more" pill. */
1359
1573
  maxTagCount?: number;
1574
+ /** Virtualize the option list — render only the visible slice (plus `overscan`) for long lists. @default false */
1575
+ virtualized?: boolean;
1576
+ /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
1577
+ overscan?: number;
1360
1578
  /** Composed with the field's open-on-focus behavior — your handler runs first. */
1361
1579
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
1362
1580
  /** Composed with the field's keyboard navigation (Arrows/Enter/Escape/Backspace) — your handler runs first; call `event.preventDefault()` to suppress it. */
@@ -1651,6 +1869,10 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onC
1651
1869
  emptyText?: string;
1652
1870
  /** Name for a hidden form field so the selected value participates in native form submission. */
1653
1871
  name?: string;
1872
+ /** Virtualize the option list — render only the visible slice (plus `overscan`) for long lists. @default false */
1873
+ virtualized?: boolean;
1874
+ /** Extra option rows rendered above/below the viewport when `virtualized`, to smooth fast scrolling. @default 8 */
1875
+ overscan?: number;
1654
1876
  }
1655
1877
 
1656
1878
  /** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
@@ -2229,16 +2451,12 @@ interface AppShellProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "chil
2229
2451
 
2230
2452
  declare function AppShell(props: AppShellProps): React.JSX.Element;
2231
2453
 
2232
- /** Generic, token-styled element — the building block for non-flex layout. */
2233
- interface BoxProps extends React.HTMLAttributes<HTMLElement> {
2234
- /** Element/tag to render. @default "div" */
2235
- as?: PolymorphicAs;
2236
- /** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
2237
- href?: string;
2238
- /** Anchor target — only used with as="a" (e.g. "_blank"). */
2239
- target?: React.HTMLAttributeAnchorTarget;
2240
- /** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
2241
- rel?: string;
2454
+ /**
2455
+ * Box's own (non-polymorphic) props. The rendered element's intrinsic attributes —
2456
+ * and `ref` — are added by the polymorphic wrapper based on `as` (e.g. `as="a"`
2457
+ * contributes `href`/`target`/`rel` and a `Ref<HTMLAnchorElement>`).
2458
+ */
2459
+ interface BoxOwnProps {
2242
2460
  /** Padding (all / x / y / individual) — spacing step (number) or CSS length. */
2243
2461
  p?: number | string;
2244
2462
  px?: number | string;
@@ -2263,41 +2481,47 @@ interface BoxProps extends React.HTMLAttributes<HTMLElement> {
2263
2481
  radius?: string;
2264
2482
  /** Box-shadow token suffix (e.g. "sm", "lg", "xl"). */
2265
2483
  shadow?: string;
2484
+ /** Style escape hatch: flat CSS goes inline (wins over base); nested selectors/at-rules (`"&:hover"`, `"@media …"`) compile to a scoped stylesheet. */
2485
+ sx?: Sx;
2266
2486
  }
2267
2487
 
2268
- declare function Box(props: BoxProps): React.JSX.Element;
2488
+ /**
2489
+ * Box props for a given element `C` (defaults to `"div"`) — Box's own props plus
2490
+ * `C`'s intrinsic attributes and a matching `ref`. Name it directly when wrapping
2491
+ * Box in your own typed component.
2492
+ */
2493
+ type BoxProps<C extends React.ElementType = "div"> = PolymorphicPropsWithRef<C, BoxOwnProps>;
2269
2494
 
2270
- /** Centered, max-width content wrapper with responsive horizontal padding. */
2271
- interface ContainerProps extends React.HTMLAttributes<HTMLElement> {
2272
- /** Element/tag to render. @default "div" */
2273
- as?: PolymorphicAs;
2274
- /** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
2275
- href?: string;
2276
- /** Anchor target — only used with as="a" (e.g. "_blank"). */
2277
- target?: React.HTMLAttributeAnchorTarget;
2278
- /** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
2279
- rel?: string;
2495
+ /** Generic, token-styled element — the building block for non-flex layout. Polymorphic via `as`. */
2496
+ declare const Box: PolymorphicComponent<BoxOwnProps, "div">;
2497
+
2498
+ /**
2499
+ * Container's own props. Intrinsic attributes of the rendered element (and `ref`)
2500
+ * are added by the polymorphic wrapper based on `as`.
2501
+ */
2502
+ interface ContainerOwnProps {
2280
2503
  /** Max width: a named size (sm 640 / md 768 / lg 1024 / xl 1280 / full) or any CSS length. @default "lg" */
2281
2504
  size?: "sm" | "md" | "lg" | "xl" | "full" | string;
2282
2505
  /** Apply horizontal padding. @default true */
2283
2506
  padded?: boolean;
2507
+ /** Style escape hatch: flat CSS goes inline (wins over base); nested selectors/at-rules (`"&:hover"`, `"@media …"`) compile to a scoped stylesheet. */
2508
+ sx?: Sx;
2284
2509
  }
2285
2510
 
2286
- declare function Container(props: ContainerProps): React.JSX.Element;
2511
+ /** Container props for a given element `C` (defaults to `"div"`). */
2512
+ type ContainerProps<C extends React.ElementType = "div"> = PolymorphicPropsWithRef<C, ContainerOwnProps>;
2513
+
2514
+ /** Centered, max-width content wrapper with responsive horizontal padding. Polymorphic via `as`. */
2515
+ declare const Container: PolymorphicComponent<ContainerOwnProps, "div">;
2287
2516
 
2288
2517
  /** Responsive column counts per breakpoint (base + sm/md/lg/xl at 640/768/1024/1280px). */
2289
2518
  type ResponsiveColumns = { base?: number; sm?: number; md?: number; lg?: number; xl?: number };
2290
2519
 
2291
- /** CSS grid primitive — fixed columns or a responsive auto-fill grid. */
2292
- interface GridProps extends React.HTMLAttributes<HTMLElement> {
2293
- /** Element/tag to render. @default "div" */
2294
- as?: PolymorphicAs;
2295
- /** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
2296
- href?: string;
2297
- /** Anchor target — only used with as="a" (e.g. "_blank"). */
2298
- target?: React.HTMLAttributeAnchorTarget;
2299
- /** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
2300
- rel?: string;
2520
+ /**
2521
+ * Grid's own props. Intrinsic attributes of the rendered element (and `ref`) are
2522
+ * added by the polymorphic wrapper based on `as`.
2523
+ */
2524
+ interface GridOwnProps {
2301
2525
  /** Fixed column count, or a responsive object `{ base, sm, md, lg, xl }` (ignored when `minChildWidth` is set). */
2302
2526
  columns?: number | ResponsiveColumns;
2303
2527
  /** Responsive auto-fill: minimum child width (number = px, or any CSS length). */
@@ -2314,20 +2538,21 @@ interface GridProps extends React.HTMLAttributes<HTMLElement> {
2314
2538
  alignContent?: React.CSSProperties["alignContent"];
2315
2539
  /** Distribute the grid's columns within extra inline space. */
2316
2540
  justifyContent?: React.CSSProperties["justifyContent"];
2541
+ /** Style escape hatch: flat CSS goes inline (wins over base); nested selectors/at-rules (`"&:hover"`, `"@media …"`) compile to a scoped stylesheet. */
2542
+ sx?: Sx;
2317
2543
  }
2318
2544
 
2319
- declare function Grid(props: GridProps): React.JSX.Element;
2545
+ /** Grid props for a given element `C` (defaults to `"div"`). */
2546
+ type GridProps<C extends React.ElementType = "div"> = PolymorphicPropsWithRef<C, GridOwnProps>;
2320
2547
 
2321
- /** Flex layout primitive — rows or columns with token-based gaps. */
2322
- interface StackProps extends React.HTMLAttributes<HTMLElement> {
2323
- /** Element/tag to render. @default "div" */
2324
- as?: PolymorphicAs;
2325
- /** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
2326
- href?: string;
2327
- /** Anchor target — only used with as="a" (e.g. "_blank"). */
2328
- target?: React.HTMLAttributeAnchorTarget;
2329
- /** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
2330
- rel?: string;
2548
+ /** CSS grid primitive — fixed columns or a responsive auto-fill grid. Polymorphic via `as`. */
2549
+ declare const Grid: PolymorphicComponent<GridOwnProps, "div">;
2550
+
2551
+ /**
2552
+ * Stack's own props. Intrinsic attributes of the rendered element (and `ref`) are
2553
+ * added by the polymorphic wrapper based on `as` (e.g. `as="a"` adds `href`).
2554
+ */
2555
+ interface StackOwnProps {
2331
2556
  /** @default "column" */
2332
2557
  direction?: "row" | "column" | "row-reverse" | "column-reverse";
2333
2558
  /** Gap as a spacing-scale step (number) or any CSS length. @default 4 */
@@ -2354,9 +2579,15 @@ interface StackProps extends React.HTMLAttributes<HTMLElement> {
2354
2579
  pl?: number | string;
2355
2580
  /** Node rendered between each child (not before the first or after the last). Pass an orientation-appropriate `Divider`. */
2356
2581
  divider?: React.ReactNode;
2582
+ /** Style escape hatch: flat CSS goes inline (wins over base); nested selectors/at-rules (`"&:hover"`, `"@media …"`) compile to a scoped stylesheet. */
2583
+ sx?: Sx;
2357
2584
  }
2358
2585
 
2359
- declare function Stack(props: StackProps): React.JSX.Element;
2586
+ /** Stack props for a given element `C` (defaults to `"div"`). */
2587
+ type StackProps<C extends React.ElementType = "div"> = PolymorphicPropsWithRef<C, StackOwnProps>;
2588
+
2589
+ /** Flex layout primitive — rows or columns with token-based gaps. Polymorphic via `as`. */
2590
+ declare const Stack: PolymorphicComponent<StackOwnProps, "div">;
2360
2591
 
2361
2592
  /** Inline code, or a scrollable multi-line block with an optional copy button. */
2362
2593
  interface CodeProps extends React.HTMLAttributes<HTMLElement> {
@@ -2385,18 +2616,12 @@ type HeadingSize =
2385
2616
  | "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "display";
2386
2617
 
2387
2618
  /**
2388
- * Heading (h1–h6) with token typography. `level` sets the tag/semantics; `size` sets the visual
2389
- * scale — the two are intentionally independent (e.g. a semantic `<h1>` at a small size).
2619
+ * Heading's own props. `level` sets the tag/semantics; `size` sets the visual scale —
2620
+ * the two are intentionally independent (e.g. a semantic `<h1>` at a small size). The
2621
+ * rendered element's intrinsic attributes (and `ref`) are added by the polymorphic
2622
+ * wrapper based on `as`, which overrides the tag chosen by `level`.
2390
2623
  */
2391
- interface HeadingProps extends React.HTMLAttributes<HTMLElement> {
2392
- /** Override the rendered tag (e.g. render a visual h2 as an h1). */
2393
- as?: PolymorphicAs;
2394
- /** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
2395
- href?: string;
2396
- /** Anchor target — only used with as="a" (e.g. "_blank"). */
2397
- target?: React.HTMLAttributeAnchorTarget;
2398
- /** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
2399
- rel?: string;
2624
+ interface HeadingOwnProps {
2400
2625
  /** Heading level 1–6 — sets the tag and the default size. @default 2 */
2401
2626
  level?: 1 | 2 | 3 | 4 | 5 | 6;
2402
2627
  /** Font-size token (xs…7xl or display), independent of `level`. */
@@ -2408,20 +2633,21 @@ interface HeadingProps extends React.HTMLAttributes<HTMLElement> {
2408
2633
  truncate?: boolean;
2409
2634
  /** Clamp to N lines with an ellipsis (multi-line, -webkit-line-clamp). Overrides `truncate`. */
2410
2635
  lineClamp?: number;
2636
+ /** Style escape hatch: flat CSS goes inline (wins over base); nested selectors/at-rules (`"&:hover"`, `"@media …"`) compile to a scoped stylesheet. */
2637
+ sx?: Sx;
2411
2638
  }
2412
2639
 
2413
- declare function Heading(props: HeadingProps): React.JSX.Element;
2640
+ /** Heading props for a given element `C` (defaults to `"h2"`). */
2641
+ type HeadingProps<C extends React.ElementType = "h2"> = PolymorphicPropsWithRef<C, HeadingOwnProps>;
2414
2642
 
2415
- /** Body text with token sizes and semantic color tones. Renders <p> by default. */
2416
- interface TextProps extends React.HTMLAttributes<HTMLElement> {
2417
- /** Element/tag to render (e.g. "span", "p"). @default "p" */
2418
- as?: PolymorphicAs;
2419
- /** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
2420
- href?: string;
2421
- /** Anchor target — only used with as="a" (e.g. "_blank"). */
2422
- target?: React.HTMLAttributeAnchorTarget;
2423
- /** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
2424
- rel?: string;
2643
+ /** Heading (h1–h6) with token typography. Polymorphic via `as` (overrides the `level` tag). */
2644
+ declare const Heading: PolymorphicComponent<HeadingOwnProps, "h2">;
2645
+
2646
+ /**
2647
+ * Text's own props. Intrinsic attributes of the rendered element (and `ref`) are
2648
+ * added by the polymorphic wrapper based on `as` (e.g. `as="a"` adds `href`).
2649
+ */
2650
+ interface TextOwnProps {
2425
2651
  /** Font-size token suffix. @default "base" */
2426
2652
  size?: "xs" | "sm" | "base" | "lg" | "xl" | string;
2427
2653
  /** Semantic color tone — text roles (default/muted/subtle), the color intents, or `"inherit"` to adopt the parent color. @default "default" */
@@ -2433,9 +2659,15 @@ interface TextProps extends React.HTMLAttributes<HTMLElement> {
2433
2659
  truncate?: boolean;
2434
2660
  /** Clamp to N lines with an ellipsis (multi-line, -webkit-line-clamp). Overrides `truncate`. */
2435
2661
  lineClamp?: number;
2662
+ /** Style escape hatch: flat CSS goes inline (wins over base); nested selectors/at-rules (`"&:hover"`, `"@media …"`) compile to a scoped stylesheet. */
2663
+ sx?: Sx;
2436
2664
  }
2437
2665
 
2438
- declare function Text(props: TextProps): React.JSX.Element;
2666
+ /** Text props for a given element `C` (defaults to `"p"`). */
2667
+ type TextProps<C extends React.ElementType = "p"> = PolymorphicPropsWithRef<C, TextOwnProps>;
2668
+
2669
+ /** Body text with token sizes and semantic color tones. Renders `<p>` by default; polymorphic via `as`. */
2670
+ declare const Text: PolymorphicComponent<TextOwnProps, "p">;
2439
2671
 
2440
2672
  /** SSR-safe `useLayoutEffect` (falls back to `useEffect` on the server). */
2441
2673
  declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
@@ -2586,6 +2818,8 @@ declare function useId(prefix?: string): string;
2586
2818
  interface UseFocusTrapOptions {
2587
2819
  /** Restore focus to the previously-focused element when the trap deactivates. @default true */
2588
2820
  restoreFocus?: boolean;
2821
+ /** Element to focus on activate instead of the first focusable — a ref or a `() => Element | null`. */
2822
+ initialFocus?: React.RefObject<HTMLElement | null> | (() => HTMLElement | null | undefined);
2589
2823
  }
2590
2824
 
2591
2825
  /**
@@ -2606,4 +2840,4 @@ declare function useFocusTrap<T extends HTMLElement = HTMLElement>(
2606
2840
  */
2607
2841
  declare function usePortal(): (node: React.ReactNode) => React.ReactPortal | React.ReactNode | null;
2608
2842
 
2609
- export { Accordion, type AccordionItem, type AccordionProps, type ActionTone, Alert, type AlertProps, AppShell, type AppShellProps, Avatar, AvatarMenu, type AvatarMenuProps, type AvatarProps, Badge, type BadgeProps, type BarTone, Box, type BoxProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Carousel, type CarouselProps, Chart, type ChartDatum, type ChartProps, Checkbox, type CheckboxProps, Code, type CodeProps, ColorPicker, type ColorPickerProps, Combobox, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type Command, CommandPalette, type CommandPaletteProps, Container, type ContainerProps, Currency, CurrencyField, type CurrencyFieldProps, type CurrencyOption, type CurrencyProps, Datatable, type DatatableBatchAction, type DatatableColumn, type DatatableFilter, type DatatableFilterOp, type DatatableNumberOp, type DatatableProps, type DatatableQuery, type DatatableRowAction, type DatatableStringOp, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, Dialog, type DialogProps, Divider, type DividerProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, Field, type FieldProps, FileUpload, type FileUploadProps, Grid, type GridProps, Heading, type HeadingProps, type HeadingSize, IconButton, type IconButtonProps, Input, type InputProps, Kanban, type KanbanCard, type KanbanColumn, type KanbanProps, List, type ListItemData, type ListProps, Menu, type MenuItemDef, type MenuProps, MultiSelect, type MultiSelectGroup, type MultiSelectOption, type MultiSelectProps, Navbar, type NavbarLink, type NavbarProps, type Option, type OptionGroup, Pagination, type PaginationProps, type PolymorphicAs, Popover, type PopoverProps, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupOption, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type ResponsiveColumns, Select, type SelectGroup, type SelectOption, type SelectProps, Sidebar, type SidebarItem, type SidebarProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, Stack, type StackProps, Stat, type StatProps, type Step, Stepper, type StepperProps, Switch, type SwitchProps, type TabItem, Table, type TableColumn, type TableProps, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, type TextTone, Textarea, type TextareaProps, Timeline, type TimelineItem, type TimelineProps, Toast, type ToastApi, type ToastOptions, type ToastProps, ToastProvider, type ToastProviderProps, type ToastTone, ToastViewport, type ToastViewportProps, type Tone, Tooltip, type TooltipProps, type TreeNode, TreeView, type TreeViewProps, type UseColorSchemeOptions, type UseFocusTrapOptions, type UseKeyPressOptions, type UseMediaQueryOptions, runDatatableQuery, useClickOutside, useColorScheme, useControllableState, useCopyToClipboard, useDebouncedCallback, useDebouncedValue, useDisclosure, useEventListener, useFocusTrap, useHover, useId, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyPress, useLocalStorage, useMediaQuery, useMounted, usePortal, usePrefersReducedMotion, usePrevious, useScrollLock, useTimeout, useToast, useToggle, useWindowSize };
2843
+ export { Accordion, type AccordionItem, type AccordionProps, type ActionTone, Alert, type AlertProps, Anchor, type AnchorProps, AppShell, type AppShellProps, Avatar, AvatarMenu, type AvatarMenuProps, type AvatarProps, Badge, type BadgeProps, type BarTone, Box, type BoxOwnProps, type BoxProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Carousel, type CarouselProps, Chart, type ChartDatum, type ChartProps, Checkbox, type CheckboxProps, Code, type CodeProps, ColorPicker, type ColorPickerProps, ColorSchemeScript, type ColorSchemeScriptOptions, type ColorSchemeScriptProps, Combobox, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type Command, CommandPalette, type CommandPaletteProps, Container, type ContainerOwnProps, type ContainerProps, Currency, CurrencyField, type CurrencyFieldProps, type CurrencyOption, type CurrencyProps, Datatable, type DatatableBatchAction, type DatatableColumn, type DatatableFilter, type DatatableFilterOp, type DatatableNumberOp, type DatatableProps, type DatatableQuery, type DatatableRowAction, type DatatableStringOp, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, Dialog, type DialogProps, Divider, type DividerProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, Field, type FieldProps, FileUpload, type FileUploadProps, Form, type FormProps, Grid, type GridOwnProps, type GridProps, Heading, type HeadingOwnProps, type HeadingProps, type HeadingSize, IconButton, type IconButtonProps, Image, type ImageProps, Input, type InputProps, Kanban, type KanbanCard, type KanbanColumn, type KanbanProps, Kbd, type KbdProps, Label, type LabelProps, List, type ListItemData, type ListProps, Menu, type MenuItemDef, type MenuProps, MultiSelect, type MultiSelectGroup, type MultiSelectOption, type MultiSelectProps, Navbar, type NavbarLink, type NavbarProps, type Option, type OptionGroup, Pagination, type PaginationProps, type PolymorphicAs, type PolymorphicComponent, type PolymorphicProps, type PolymorphicPropsWithRef, type PolymorphicRef, Popover, type PopoverProps, Portal, type PortalProps, Pre, type PreProps, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupOption, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type ResponsiveColumns, Select, type SelectGroup, type SelectOption, type SelectProps, Sidebar, type SidebarItem, type SidebarProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, Stack, type StackOwnProps, type StackProps, Stat, type StatProps, type Step, Stepper, type StepperProps, Switch, type SwitchProps, type Sx, type TabItem, Table, type TableColumn, type TableProps, Tabs, type TabsProps, Tag, type TagProps, Text, type TextOwnProps, type TextProps, type TextTone, Textarea, type TextareaProps, type Theme, ThemeProvider, type ThemeProviderProps, type ThemeTokens, Timeline, type TimelineItem, type TimelineProps, Toast, type ToastApi, type ToastOptions, type ToastProps, ToastProvider, type ToastProviderProps, type ToastTone, ToastViewport, type ToastViewportProps, type Tone, Tooltip, type TooltipProps, type TreeNode, TreeView, type TreeViewProps, TwicoProvider, type TwicoProviderProps, type UseColorSchemeOptions, type UseFocusTrapOptions, type UseKeyPressOptions, type UseMediaQueryOptions, VisuallyHidden, type VisuallyHiddenProps, createTheme, getColorSchemeScript, runDatatableQuery, useClickOutside, useColorScheme, useControllableState, useCopyToClipboard, useDebouncedCallback, useDebouncedValue, useDisclosure, useEventListener, useFocusTrap, useHover, useId, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyPress, useLocalStorage, useMediaQuery, useMounted, usePortal, usePrefersReducedMotion, usePrevious, useScrollLock, useTimeout, useToast, useToggle, useWindowSize };