@mortenbrudvik/waveui 0.16.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +66 -17
  2. package/dist/components/input/Label.cjs +1 -1
  3. package/dist/components/input/Label.cjs.map +1 -1
  4. package/dist/components/input/Label.mjs +1 -0
  5. package/dist/components/input/Label.mjs.map +1 -1
  6. package/dist/components/portal/Portal.cjs +1 -1
  7. package/dist/components/portal/Portal.cjs.map +1 -1
  8. package/dist/components/portal/Portal.mjs +12 -11
  9. package/dist/components/portal/Portal.mjs.map +1 -1
  10. package/dist/components/provider/WaveProvider.cjs +1 -1
  11. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  12. package/dist/components/provider/WaveProvider.mjs +61 -35
  13. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  14. package/dist/components/typography/Text.cjs +1 -1
  15. package/dist/components/typography/Text.cjs.map +1 -1
  16. package/dist/components/typography/Text.mjs +11 -7
  17. package/dist/components/typography/Text.mjs.map +1 -1
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.cts +271 -10
  20. package/dist/index.d.ts +271 -10
  21. package/dist/index.mjs +143 -140
  22. package/dist/lib/brand.cjs +2 -0
  23. package/dist/lib/brand.cjs.map +1 -0
  24. package/dist/lib/brand.mjs +358 -0
  25. package/dist/lib/brand.mjs.map +1 -0
  26. package/dist/lib/cn.cjs +1 -1
  27. package/dist/lib/cn.cjs.map +1 -1
  28. package/dist/lib/cn.mjs +5 -1
  29. package/dist/lib/cn.mjs.map +1 -1
  30. package/dist/lib/tokens.cjs +3 -0
  31. package/dist/lib/tokens.cjs.map +1 -0
  32. package/dist/lib/tokens.mjs +55 -0
  33. package/dist/lib/tokens.mjs.map +1 -0
  34. package/dist/lib/waveTokens.cjs +2 -0
  35. package/dist/lib/waveTokens.cjs.map +1 -0
  36. package/dist/lib/waveTokens.mjs +24 -0
  37. package/dist/lib/waveTokens.mjs.map +1 -0
  38. package/dist/styles.css +1 -1
  39. package/package.json +3 -1
  40. package/src/styles/tokens.css +210 -10
package/dist/index.d.cts CHANGED
@@ -714,6 +714,33 @@ export declare interface BadgeProps extends React_2.HTMLAttributes<HTMLSpanEleme
714
714
  ref?: React_2.Ref<HTMLSpanElement>;
715
715
  }
716
716
 
717
+ /**
718
+ * A full brand ramp: a hex colour (`#rgb` or `#rrggbb`) for each of the 16 stops, darkest first.
719
+ * The shape of Fluent's `BrandVariants`, which `createLightTheme(brand)` and
720
+ * `createDarkTheme(brand)` take. The themes read the light primary from stop 80 (hover 70, pressed
721
+ * 40, focus ring 80), the light selection from stops 160, 150 and 140 with its text at 60, the
722
+ * dark primary from stop 110 (hover 120, pressed 90, focus ring 100) and the dark selection from
723
+ * stops 20, 40 and 10 with its text at 110. A ramp whose stops have the luminance of the default
724
+ * ramp's keeps the contrast of the light and dark themes; the high-contrast theme reads no stop.
725
+ */
726
+ export declare type BrandRamp = Readonly<Record<BrandStop, string>>;
727
+
728
+ /**
729
+ * A stop of the brand ramp, from 10 (the darkest) to 160 (the lightest) in steps of 10: the stops
730
+ * of Fluent's `BrandVariants` and of the `--wave-brand-N` tokens.
731
+ */
732
+ export declare type BrandStop = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 | 110 | 120 | 130 | 140 | 150 | 160;
733
+
734
+ /**
735
+ * The 16 brand tokens, `brand10` to `brand160`: the overrides of `--wave-brand-10` to
736
+ * `--wave-brand-160`, in the shape `WaveProvider tokens` and `getTokenStyle` take. Where Fluent's
737
+ * `createLightTheme(brand)` builds a whole theme from a `BrandVariants` ramp, Wave applies the
738
+ * ramp as these tokens over its named themes; the high-contrast theme reads none of them.
739
+ */
740
+ export declare type BrandTokens = {
741
+ [K in `brand${BrandStop}`]: string;
742
+ };
743
+
717
744
  /**
718
745
  * A breadcrumb trail: a `<nav aria-label="Breadcrumb">` landmark with an ordered list. Each child
719
746
  * is placed in its own list item (Fragments are opened, so each of their items gets one too); from
@@ -1887,6 +1914,25 @@ export declare interface CarouselProps extends React_2.HTMLAttributes<HTMLDivEle
1887
1914
  ref?: React_2.Ref<HTMLDivElement>;
1888
1915
  }
1889
1916
 
1917
+ /**
1918
+ * The 12 palette fills as token names, in the order a categorical chart gives them to its series.
1919
+ * The order keeps neighbouring series as far apart as the palette allows, for colour vision and
1920
+ * for hue: in the light and dark themes, every two neighbours (the first and second, the second
1921
+ * and third, up to the eleventh and twelfth) differ by at least 6.3 (OKLab ΔE ×100) under
1922
+ * simulated protanopia, deuteranopia and tritanopia and by at least 15.7 for full colour vision,
1923
+ * and their hues are at least 49° apart. The first six are the six fills that stay furthest apart
1924
+ * as a set, yet no six fills of the palette keep every pair apart for colour-vision deficiencies:
1925
+ * two series that are not neighbours can differ by only about 3.2 among the first six, and by
1926
+ * less further on. So colour never identifies a series on its own: every chart needs a second
1927
+ * encoding (a pattern, a marker shape or a direct label), whatever its number of series, and in
1928
+ * high contrast every palette fill is white. Read each colour through `waveTokens`
1929
+ * (`waveTokens[chartPalette[index]]`), so the series follow the theme. Frozen and server-safe.
1930
+ *
1931
+ * @example
1932
+ * const color = waveTokens[chartPalette[index % chartPalette.length]];
1933
+ */
1934
+ export declare const chartPalette: readonly WaveTokenName[];
1935
+
1890
1936
  /**
1891
1937
  * A checkbox for a boolean (or mixed) choice, drawn as a `role="checkbox"` button inside a
1892
1938
  * `<label>`.
@@ -3240,6 +3286,48 @@ export declare interface CounterBadgeProps extends React_2.HTMLAttributes<HTMLSp
3240
3286
  ref?: React_2.Ref<HTMLSpanElement>;
3241
3287
  }
3242
3288
 
3289
+ /**
3290
+ * The brand tokens of a brand colour or of a full ramp, to pass as `WaveProvider tokens` (alone or
3291
+ * spread with other overrides) or to `getTokenStyle`. Wave's counterpart of Fluent's
3292
+ * `createLightTheme(brand)` and `createDarkTheme(brand)`, which take a full `BrandVariants` ramp;
3293
+ * Wave also builds the ramp from one colour. The high-contrast theme ignores the brand: its colours
3294
+ * are fixed.
3295
+ *
3296
+ * From a seed (`#rgb` or `#rrggbb`, any case, with the `#`), each stop keeps the **luminance of the
3297
+ * default ramp's stop** and takes its hue and colourfulness from the seed: the seed's OKLCH chroma
3298
+ * and hue, shaped per stop like the default ramp (less colourful toward both ends, the hue
3299
+ * drifting a few degrees as the default's does), reduced where the colour would leave sRGB, and
3300
+ * rounded to a neighbouring 8-bit colour on the side that keeps its contrast. Contrast depends
3301
+ * only on luminance, so every text, fill, stroke and focus-ring pair of the light and dark themes
3302
+ * keeps, to within 8-bit rounding, the contrast it has with the default ramp, and stays above the
3303
+ * floor the themes are held to (4.5:1 for text, 3:1 for strokes, graphics and focus rings, 1.15:1
3304
+ * between the states of a fill), whatever the seed. The cost: the seed sets hue and
3305
+ * colourfulness, not lightness, so the primary fill (stop 80) is the seed's hue at the default's
3306
+ * lightness, and a light seed gives a darker button than itself. For a brand whose exact colours
3307
+ * matter, pass a full `BrandRamp`. The default seed `#0f6cbd` gives the default ramp, and a grey
3308
+ * seed (black, white or any grey) a grey ramp.
3309
+ *
3310
+ * A full `BrandRamp` is returned as tokens with its colours unchanged; a stop that is missing or
3311
+ * not a hex colour takes the default ramp's colour, with a development warning. In development the
3312
+ * ramp is also checked against the pairs the light and dark themes read from it (the primary
3313
+ * colour as text and as a fill under its text, the hover and pressed fills, the selection fills
3314
+ * and their text, the focus ring): each pair below its minimum (4.5:1 for text, 3:1 for the focus
3315
+ * ring, 1.15:1 between the states of a fill) logs one warning naming the theme, the tokens, the
3316
+ * stops and the ratio. The check is advisory: the ramp applies as given. Any other seed returns
3317
+ * the default ramp, with a development warning.
3318
+ *
3319
+ * Pure and server-safe; it returns a new object on each call, so compute it once (at module scope,
3320
+ * or memoised) rather than on every render.
3321
+ *
3322
+ * @example
3323
+ * const brand = createBrandTokens('#c43e00');
3324
+ * <WaveProvider tokens={brand}>…</WaveProvider>
3325
+ *
3326
+ * @example
3327
+ * <WaveProvider tokens={{ ...createBrandTokens('#c43e00'), fontFamily: 'Inter, sans-serif' }}>
3328
+ */
3329
+ export declare function createBrandTokens(seed: string | BrandRamp): BrandTokens;
3330
+
3243
3331
  /**
3244
3332
  * Creates a column for DataGrid's `columns`, typed by the grid's items, with `sortable` resolved
3245
3333
  * (`true` when the column has `compare`, unless `sortable` says otherwise). Returns a new object
@@ -6750,6 +6838,33 @@ export declare function getTabbableElements(container: Element, options?: {
6750
6838
  */
6751
6839
  export declare function getThemeClassName(theme: WaveTheme): string;
6752
6840
 
6841
+ /**
6842
+ * The inline style that applies token overrides: one `--wave-*` custom property per entry, the
6843
+ * object `WaveProvider` puts on its root and its portals. Use it where no provider renders, such
6844
+ * as a Server Component's document element. Server-safe.
6845
+ *
6846
+ * Returns `undefined` for `null`, `undefined` or a map with nothing to set. An `undefined` value is
6847
+ * skipped, a number is written as its string, a string is trimmed as React's server renderer trims
6848
+ * it, and the properties keep the order of the input. A key that is not a camelCase identifier is
6849
+ * skipped with a development warning (once per key), and so is a value unless it is a finite
6850
+ * number or CSS text without `;`, `{`, `}` or `url(` whose quotes, parentheses, square brackets and
6851
+ * comments are balanced, with no `!` or backslash outside strings and comments. In a
6852
+ * server-rendered `style` attribute such a character could add a declaration of its own, an open
6853
+ * string, comment or bracket (or an escape that spells `url(` or takes the semicolon after the
6854
+ * value) would swallow the declarations after it, and `!important` would set a priority the client
6855
+ * refuses; the trimmed values that pass are read alike by the attribute and by the client. Names
6856
+ * are not checked against the list of tokens: TypeScript refuses a misspelled one, and in
6857
+ * JavaScript it sets a property nothing reads.
6858
+ *
6859
+ * @example
6860
+ * // app/layout.tsx (a Server Component)
6861
+ * <html style={getTokenStyle({ brand80: '#c43e00' })}>
6862
+ *
6863
+ * @example
6864
+ * <div style={{ ...getTokenStyle(overrides), padding: 16 }} />
6865
+ */
6866
+ export declare function getTokenStyle(overrides: WaveTokenOverrides | null | undefined): TokenStyle | undefined;
6867
+
6753
6868
  /**
6754
6869
  * The week number (1–53) of `date`'s calendar day (time of day ignored): days before a year's week
6755
6870
  * 1 belong to the previous year's last week, and days in the next year's week 1 are week 1. ISO 8601
@@ -11956,7 +12071,8 @@ export declare type PopupTargetInput = PopupTarget | {
11956
12071
 
11957
12072
  /**
11958
12073
  * Renders its children into `document.body` (or the WaveProvider `portalContainer`), wrapped in a
11959
- * `<div class="wave-portal …">` that carries the provider's theme classes, direction and font, so
12074
+ * `<div class="wave-portal …">` that carries the provider's theme classes, direction and font, and
12075
+ * its token overrides (WaveProvider `tokens`, unless its `applyStylesToPortals` is `false`), so
11960
12076
  * portaled overlays look like the rest of the themed tree. The wrapper paints no background.
11961
12077
  *
11962
12078
  * - **Client only, first commit**: nothing is rendered on the server or during hydration (no
@@ -16993,13 +17109,20 @@ export declare interface TextOwnProps {
16993
17109
  */
16994
17110
  variant?: TypographyVariant;
16995
17111
  /**
16996
- * Font weight: `'regular'`, `'semibold'` or `'bold'`. Unset, the variant's own weight applies:
16997
- * semibold for `'subtitle-2'` and every larger variant (`'subtitle-1'`, the titles,
16998
- * `'large-title'`, `'display'`), inherited for the caption and body variants. Pass `'regular'`
16999
- * for a title at regular weight. The numeric 0.4 values `400`, `600` and `700` still work but
17000
- * are deprecated.
17112
+ * Font weight: `'regular'`, `'medium'`, `'semibold'` or `'bold'`. Unset, the variant's own
17113
+ * weight applies: semibold for `'subtitle-2'` and every larger variant (`'subtitle-1'`, the
17114
+ * titles, `'large-title'`, `'display'`), inherited for the caption and body variants. Pass
17115
+ * `'regular'` for a title at regular weight. The numeric 0.4 values `400`, `600` and `700` still
17116
+ * work but are deprecated.
17001
17117
  */
17002
17118
  weight?: TextWeight | 400 | 600 | 700;
17119
+ /**
17120
+ * Font family: `'base'` keeps the inherited family (the Wave sans-serif), `'monospace'` sets the
17121
+ * Wave monospace stack for code and identifiers, `'numeric'` the stack for figures that should
17122
+ * align in columns. Fluent's `font` prop. A `className` that sets a font family replaces it.
17123
+ * @default 'base'
17124
+ */
17125
+ font?: 'base' | 'monospace' | 'numeric';
17003
17126
  }
17004
17127
 
17005
17128
  /**
@@ -17008,8 +17131,8 @@ export declare interface TextOwnProps {
17008
17131
  */
17009
17132
  export declare type TextProps<C extends React_2.ElementType = 'span'> = PolymorphicProps<C, TextOwnProps>;
17010
17133
 
17011
- /** Font weight vocabulary shared by Text and Label (400 / 600 / 700). */
17012
- export declare type TextWeight = 'regular' | 'semibold' | 'bold';
17134
+ /** Font weight vocabulary shared by Text and Label (400 / 500 / 600 / 700). */
17135
+ export declare type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold';
17013
17136
 
17014
17137
  /**
17015
17138
  * A time input with a filterable list of times (APG editable combobox with list autocomplete).
@@ -17786,6 +17909,23 @@ export declare interface ToggleButtonProps extends Omit<React_2.ButtonHTMLAttrib
17786
17909
  ref?: React_2.Ref<HTMLButtonElement>;
17787
17910
  }
17788
17911
 
17912
+ /**
17913
+ * The inline style that applies token overrides: a React style object whose `--wave-*` custom
17914
+ * properties set the tokens, so it can be merged with other style properties.
17915
+ */
17916
+ export declare type TokenStyle = React_2.CSSProperties & {
17917
+ [K in `--wave-${string}`]?: string;
17918
+ };
17919
+
17920
+ /**
17921
+ * The CSS custom property of a token name at the type level: `TokenVariable<'brand80'>` is
17922
+ * `'--wave-brand-80'`, by the rule of {@link tokenVariable}. It spells out the literal values of
17923
+ * `waveTokens`. It walks the name one character at a time (tail-recursive, so long names stay
17924
+ * within the compiler's depth limit): `AfterLetter` says whether the previous character was a
17925
+ * letter, `Done` holds the converted text so far.
17926
+ */
17927
+ declare type TokenVariable<Name extends string, AfterLetter extends boolean = false, Done extends string = ''> = Name extends `${infer Char}${infer Rest}` ? Char extends '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ? TokenVariable<Rest, false, `${Done}${AfterLetter extends true ? '-' : ''}${Char}`> : Char extends Lowercase<Char> ? TokenVariable<Rest, true, `${Done}${Char}`> : TokenVariable<Rest, true, `${Done}-${Lowercase<Char>}`> : `--wave-${Done}`;
17928
+
17789
17929
  /**
17790
17930
  * A container for a set of controls (APG Toolbar pattern): `role="toolbar"`, one Tab stop, and
17791
17931
  * arrow-key navigation between its controls.
@@ -20532,7 +20672,7 @@ export declare interface UseVirtualWindowOptions {
20532
20672
  }
20533
20673
 
20534
20674
  /**
20535
- * Reads the theme, direction, theme classes and portal container of the nearest
20675
+ * Reads the theme, direction, theme classes, portal container and token overrides of the nearest
20536
20676
  * {@link WaveProvider}. Outside a provider it returns light/ltr defaults with `hasProvider: false`.
20537
20677
  *
20538
20678
  * @returns The {@link WaveContextValue} of the nearest provider.
@@ -20635,6 +20775,12 @@ export declare interface VisibleFlatItem {
20635
20775
  index: number;
20636
20776
  }
20637
20777
 
20778
+ /**
20779
+ * The name of every `--wave-*` variable of `tokens.css`, in camelCase, in the file's groups and
20780
+ * order. A test parses `tokens.css` and fails when a variable is missing here or a name has none.
20781
+ */
20782
+ declare const WAVE_TOKEN_NAMES: readonly ["fontFamily", "fontFamilyMonospace", "fontFamilyNumeric", "zOverlay", "zToast", "zTooltip", "durationUltraFast", "durationFaster", "durationFast", "durationNormal", "durationGentle", "durationSlow", "durationSlower", "durationUltraSlow", "curveAccelerateMax", "curveAccelerateMid", "curveAccelerateMin", "curveDecelerateMax", "curveDecelerateMid", "curveDecelerateMin", "curveEasyEaseMax", "curveEasyEase", "curveLinear", "brand10", "brand20", "brand30", "brand40", "brand50", "brand60", "brand70", "brand80", "brand90", "brand100", "brand110", "brand120", "brand130", "brand140", "brand150", "brand160", "grey2", "grey4", "grey6", "grey8", "grey10", "grey12", "grey14", "grey16", "grey20", "grey24", "grey26", "grey30", "grey34", "grey38", "grey40", "grey44", "grey50", "grey60", "grey68", "grey74", "grey78", "grey82", "grey86", "grey88", "grey90", "grey92", "grey94", "grey96", "grey98", "background", "foreground", "card", "secondary", "muted", "mutedForeground", "mutedHover", "mutedPressed", "primary", "primaryForeground", "primaryHover", "primaryPressed", "destructive", "destructiveForeground", "error", "errorForeground", "subtle", "subtleHover", "subtlePressed", "subtleSelected", "selected", "selectedForeground", "selectedHover", "selectedPressed", "border", "stroke", "strokeHover", "strokeAccessible", "input", "inputFilledDarker", "inputFilledStroke", "ring", "success", "successForeground", "successTint", "successTintForeground", "warning", "warningForeground", "warningTint", "warningTintForeground", "errorTint", "errorTintForeground", "severe", "severeForeground", "severeTint", "severeTintForeground", "info", "infoForeground", "infoTint", "infoTintForeground", "inverted", "invertedForeground", "invertedBorder", "track", "skeleton", "rating", "presenceAvailable", "presenceBusy", "presenceAway", "presenceOffline", "presenceOof", "presenceGlyph", "backdrop", "paletteRed", "paletteRedForeground", "paletteRedTint", "paletteRedTintForeground", "paletteRedBorder", "palettePumpkin", "palettePumpkinForeground", "palettePumpkinTint", "palettePumpkinTintForeground", "palettePumpkinBorder", "paletteGold", "paletteGoldForeground", "paletteGoldTint", "paletteGoldTintForeground", "paletteGoldBorder", "paletteForest", "paletteForestForeground", "paletteForestTint", "paletteForestTintForeground", "paletteForestBorder", "paletteTeal", "paletteTealForeground", "paletteTealTint", "paletteTealTintForeground", "paletteTealBorder", "paletteBlue", "paletteBlueForeground", "paletteBlueTint", "paletteBlueTintForeground", "paletteBlueBorder", "paletteNavy", "paletteNavyForeground", "paletteNavyTint", "paletteNavyTintForeground", "paletteNavyBorder", "paletteLavender", "paletteLavenderForeground", "paletteLavenderTint", "paletteLavenderTintForeground", "paletteLavenderBorder", "palettePurple", "palettePurpleForeground", "palettePurpleTint", "palettePurpleTintForeground", "palettePurpleBorder", "paletteMagenta", "paletteMagentaForeground", "paletteMagentaTint", "paletteMagentaTintForeground", "paletteMagentaBorder", "paletteBrown", "paletteBrownForeground", "paletteBrownTint", "paletteBrownTintForeground", "paletteBrownBorder", "paletteSteel", "paletteSteelForeground", "paletteSteelTint", "paletteSteelTintForeground", "paletteSteelBorder", "shadow2", "shadow4", "shadow8", "shadow16", "shadow28", "shadow64", "cardForeground", "secondaryForeground", "accent", "accentForeground", "inputFilledLighter"];
20783
+
20638
20784
  /** Value provided by {@link WaveProvider} and returned by {@link useWaveTheme}. */
20639
20785
  export declare interface WaveContextValue {
20640
20786
  /** The active theme. */
@@ -20652,6 +20798,19 @@ export declare interface WaveContextValue {
20652
20798
  inputDefaults: InputDefaults;
20653
20799
  /** The motion preference of the providers above (`'default'` outside a provider). */
20654
20800
  motion: MotionPreference;
20801
+ /**
20802
+ * The merged token overrides of the providers above (`{}` outside a provider), as given: an
20803
+ * entry skipped for a malformed key or value stays in it, and only `tokenStyle` leaves it out.
20804
+ */
20805
+ tokens: WaveTokenOverrides;
20806
+ /**
20807
+ * The inline style that applies `tokens`, as the provider's root and, unless
20808
+ * `applyStylesToPortals` is `false`, its portals carry it; `undefined` when there is nothing to
20809
+ * set (also outside a provider).
20810
+ */
20811
+ tokenStyle: TokenStyle | undefined;
20812
+ /** Whether portals carry `tokenStyle` (`true` outside a provider). */
20813
+ applyStylesToPortals: boolean;
20655
20814
  /** `false` when no {@link WaveProvider} is above the caller (the defaults are returned). */
20656
20815
  hasProvider: boolean;
20657
20816
  }
@@ -20682,9 +20841,21 @@ export declare type WaveDir = 'ltr' | 'rtl';
20682
20841
  * slots, Carousel's slide, TabList's sliding line, the reveal of Nav item actions; a part's own
20683
20842
  * `motion` still wins), while transitions without a slot keep running (Accordion's and Tree's
20684
20843
  * chevron turns, colour changes); a nested provider inherits an omitted `motion` like `theme`.
20844
+ * - `tokens` overrides design tokens in the subtree with inline custom properties on the root
20845
+ * (rendered on the server too) and on every portal of the subtree, unless
20846
+ * `applyStylesToPortals` is `false`. A nested provider merges its overrides over the enclosing
20847
+ * provider's key by key, also when it sets another `theme`; `tokens={null}` clears them for the
20848
+ * tokens the theme declares and for the overlays, while the theme-independent ones of an
20849
+ * enclosing provider still reach the subtree through the CSS cascade. An override whose key is
20850
+ * not a camelCase identifier is skipped with a development warning, and so is a value unless it
20851
+ * is a finite number or CSS text without `;`, `{`, `}` or `url(` with balanced quotes,
20852
+ * parentheses, square brackets and comments and no `!` or backslash outside strings and
20853
+ * comments; a value is trimmed as React's server renderer trims it, so the server and the client
20854
+ * write the same overrides. Without overrides the root renders no `style` attribute unless you
20855
+ * pass `style`.
20685
20856
  */
20686
20857
  export declare const WaveProvider: {
20687
- ({ theme: themeProp, dir: dirProp, portalContainer: portalContainerProp, inputDefaults: inputDefaultsProp, motion: motionProp, children, className, ref, ...rest }: WaveProviderProps): React_2.JSX.Element;
20858
+ ({ theme: themeProp, dir: dirProp, portalContainer: portalContainerProp, inputDefaults: inputDefaultsProp, motion: motionProp, tokens: tokensProp, applyStylesToPortals: applyStylesToPortalsProp, children, className, style, ref, ...rest }: WaveProviderProps): React_2.JSX.Element;
20688
20859
  displayName: string;
20689
20860
  };
20690
20861
 
@@ -20732,6 +20903,58 @@ export declare interface WaveProviderProps extends React_2.HTMLAttributes<HTMLDi
20732
20903
  * @default the enclosing WaveProvider's motion, else 'default'
20733
20904
  */
20734
20905
  motion?: MotionPreference;
20906
+ /**
20907
+ * Design token overrides for the subtree: CSS values by token name, the CSS variable in camelCase
20908
+ * without its `--wave-` prefix (`brand80` for `--wave-brand-80`, `primaryForeground` for
20909
+ * `--wave-primary-foreground`; a number is written as its string). `theme` still names one of
20910
+ * the three themes, and the overrides apply over it as inline custom properties on the root and
20911
+ * on every portal of the subtree (see `applyStylesToPortals`), so its dialogs, menus, popovers,
20912
+ * tooltips and toasts take them too. Fluent's `theme` prop with a partial theme is the
20913
+ * counterpart.
20914
+ *
20915
+ * A nested provider merges its overrides over the enclosing provider's, key by key: an omitted
20916
+ * `tokens` inherits them all, and a key whose value is `undefined` inherits that key. `null`
20917
+ * clears the inherited overrides of the tokens the theme declares (the semantic colours, shadows,
20918
+ * palette) and of the subtree's overlays; theme-independent tokens (the brand and grey ramps,
20919
+ * font families, stacking order, motion durations and curves) of an enclosing provider still
20920
+ * reach the subtree's own elements through the CSS cascade, and the theme's colours built on the
20921
+ * brand ramp follow them there. A nested provider that sets another `theme` inherits the
20922
+ * overrides too, so set an override of a semantic colour (`primary`) in the provider that sets
20923
+ * the theme it was chosen for. A whole brand ramp is better made with `createBrandTokens` than
20924
+ * written by hand.
20925
+ * A key that is not a camelCase identifier is skipped with a development warning, and so is a
20926
+ * value unless it is a finite number or CSS text without `;`, `{`, `}` or `url(` whose quotes,
20927
+ * parentheses, square brackets and comments are balanced, with no `!` or backslash outside
20928
+ * strings and comments; a well-formed name is not checked against the list of tokens
20929
+ * (TypeScript refuses a misspelled one). In the server-rendered `style` attribute a refused
20930
+ * character could add a declaration of its own, and an open string, comment or bracket, or an
20931
+ * escape that spells `url(` or takes the semicolon after the value, would swallow the
20932
+ * declarations after it (though not in the client), while `!important` would be a priority the
20933
+ * client refuses. A value is trimmed as React's server renderer trims it, so the values that pass
20934
+ * are written and read alike by the server and the client.
20935
+ *
20936
+ * The overrides are rendered on the server too. Under a Content Security Policy that blocks
20937
+ * inline style attributes (`style-src` without `'unsafe-inline'`), the server-rendered overrides
20938
+ * do not apply and hydration does not apply them again: ship them in a stylesheet there, and pass
20939
+ * no `tokens` (nor `getTokenStyle`), since the overlays and the subtrees rendered in the client
20940
+ * would still take them and leave the page half branded.
20941
+ *
20942
+ * @example
20943
+ * <WaveProvider tokens={{ fontFamily: 'Inter, sans-serif', zOverlay: 2000 }}>
20944
+ * @default the enclosing WaveProvider's overrides, else none
20945
+ */
20946
+ tokens?: WaveTokenOverrides | null;
20947
+ /**
20948
+ * Whether the portals of the subtree (dialogs, popovers, menus, tooltips, toasts) carry the
20949
+ * overrides of `tokens`. `false` leaves them out: an overlay then shows its theme's own values
20950
+ * for the tokens the theme declares, and keeps the surrounding cascade (that of the element it
20951
+ * renders into) for the theme-independent ones. The theme classes and the direction are set on
20952
+ * every portal either way, so an overlay of a dark provider is still dark. Fluent's
20953
+ * `applyStylesToPortals` is the counterpart; unlike Fluent's, a nested provider inherits an
20954
+ * omitted value, like `theme`.
20955
+ * @default the enclosing WaveProvider's value, else true
20956
+ */
20957
+ applyStylesToPortals?: boolean;
20735
20958
  /** Content rendered inside the themed container. */
20736
20959
  children: React_2.ReactNode;
20737
20960
  /** Ref to the themed root `<div>`. */
@@ -20747,4 +20970,42 @@ export declare interface WaveProviderProps extends React_2.HTMLAttributes<HTMLDi
20747
20970
  /** Supported visual themes for the Wave design system. */
20748
20971
  export declare type WaveTheme = 'light' | 'dark' | 'high-contrast';
20749
20972
 
20973
+ /**
20974
+ * The name of a design token: its CSS custom property without the `--wave-` prefix, in camelCase.
20975
+ * `--wave-primary-foreground` is `primaryForeground`, `--wave-brand-80` is `brand80` and
20976
+ * `--wave-palette-red-tint` is `paletteRedTint`.
20977
+ */
20978
+ export declare type WaveTokenName = (typeof WAVE_TOKEN_NAMES)[number];
20979
+
20980
+ /**
20981
+ * Token overrides: CSS values by token name, as `WaveProvider tokens` and `getTokenStyle` take
20982
+ * them. A number is written as its string (`zOverlay: 2000`); a key whose value is `undefined`
20983
+ * sets nothing.
20984
+ */
20985
+ export declare type WaveTokenOverrides = {
20986
+ [K in WaveTokenName]?: string | number;
20987
+ };
20988
+
20989
+ /** The shape of `waveTokens`: every token name mapped to the CSS value that reads the token. */
20990
+ export declare type WaveTokens = {
20991
+ readonly [K in WaveTokenName]: string;
20992
+ };
20993
+
20994
+ /**
20995
+ * Every design token as the CSS value that reads it: `waveTokens.primary` is
20996
+ * `'var(--wave-primary)'`, typed as that literal. Use it where a style is written in JavaScript
20997
+ * (an inline style, a CSS-in-JS rule, the colours of an SVG chart), so the value follows the theme
20998
+ * and the provider's token overrides. The counterpart of Fluent's `tokens` object
20999
+ * (`tokens.colorBrandBackground`), with Wave's names: the CSS variable in camelCase without its
21000
+ * `--wave-` prefix. A canvas library cannot read a CSS variable: resolve the value with
21001
+ * `getComputedStyle` on an element inside the provider, and again when the theme changes.
21002
+ * Frozen and server-safe; no component imports it.
21003
+ *
21004
+ * @example
21005
+ * <span style={{ color: waveTokens.primary, boxShadow: waveTokens.shadow8 }} />
21006
+ */
21007
+ export declare const waveTokens: {
21008
+ readonly [K in WaveTokenName]: `var(${TokenVariable<K>})`;
21009
+ };
21010
+
20750
21011
  export { }