@mortenbrudvik/waveui 0.16.0 → 0.17.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.
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 +59 -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 +257 -10
  20. package/dist/index.d.ts +257 -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 +2 -0
  31. package/dist/lib/tokens.cjs.map +1 -0
  32. package/dist/lib/tokens.mjs +43 -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,28 @@ 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, and the properties keep the order of the input. A
6848
+ * key that is not a camelCase identifier, or a value that is neither a finite number nor a string
6849
+ * without `;`, `{` or `}` (which could add a declaration of its own to a server-rendered `style`
6850
+ * attribute), is skipped with a development warning (once per key). Names are not checked against
6851
+ * the list of tokens: TypeScript refuses a misspelled one, and in JavaScript it sets a property
6852
+ * nothing reads.
6853
+ *
6854
+ * @example
6855
+ * // app/layout.tsx (a Server Component)
6856
+ * <html style={getTokenStyle({ brand80: '#c43e00' })}>
6857
+ *
6858
+ * @example
6859
+ * <div style={{ ...getTokenStyle(overrides), padding: 16 }} />
6860
+ */
6861
+ export declare function getTokenStyle(overrides: WaveTokenOverrides | null | undefined): TokenStyle | undefined;
6862
+
6753
6863
  /**
6754
6864
  * The week number (1–53) of `date`'s calendar day (time of day ignored): days before a year's week
6755
6865
  * 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 +12066,8 @@ export declare type PopupTargetInput = PopupTarget | {
11956
12066
 
11957
12067
  /**
11958
12068
  * 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
12069
+ * `<div class="wave-portal …">` that carries the provider's theme classes, direction and font, and
12070
+ * its token overrides (WaveProvider `tokens`, unless its `applyStylesToPortals` is `false`), so
11960
12071
  * portaled overlays look like the rest of the themed tree. The wrapper paints no background.
11961
12072
  *
11962
12073
  * - **Client only, first commit**: nothing is rendered on the server or during hydration (no
@@ -16993,13 +17104,20 @@ export declare interface TextOwnProps {
16993
17104
  */
16994
17105
  variant?: TypographyVariant;
16995
17106
  /**
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.
17107
+ * Font weight: `'regular'`, `'medium'`, `'semibold'` or `'bold'`. Unset, the variant's own
17108
+ * weight applies: semibold for `'subtitle-2'` and every larger variant (`'subtitle-1'`, the
17109
+ * titles, `'large-title'`, `'display'`), inherited for the caption and body variants. Pass
17110
+ * `'regular'` for a title at regular weight. The numeric 0.4 values `400`, `600` and `700` still
17111
+ * work but are deprecated.
17001
17112
  */
17002
17113
  weight?: TextWeight | 400 | 600 | 700;
17114
+ /**
17115
+ * Font family: `'base'` keeps the inherited family (the Wave sans-serif), `'monospace'` sets the
17116
+ * Wave monospace stack for code and identifiers, `'numeric'` the stack for figures that should
17117
+ * align in columns. Fluent's `font` prop. A `className` that sets a font family replaces it.
17118
+ * @default 'base'
17119
+ */
17120
+ font?: 'base' | 'monospace' | 'numeric';
17003
17121
  }
17004
17122
 
17005
17123
  /**
@@ -17008,8 +17126,8 @@ export declare interface TextOwnProps {
17008
17126
  */
17009
17127
  export declare type TextProps<C extends React_2.ElementType = 'span'> = PolymorphicProps<C, TextOwnProps>;
17010
17128
 
17011
- /** Font weight vocabulary shared by Text and Label (400 / 600 / 700). */
17012
- export declare type TextWeight = 'regular' | 'semibold' | 'bold';
17129
+ /** Font weight vocabulary shared by Text and Label (400 / 500 / 600 / 700). */
17130
+ export declare type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold';
17013
17131
 
17014
17132
  /**
17015
17133
  * A time input with a filterable list of times (APG editable combobox with list autocomplete).
@@ -17786,6 +17904,23 @@ export declare interface ToggleButtonProps extends Omit<React_2.ButtonHTMLAttrib
17786
17904
  ref?: React_2.Ref<HTMLButtonElement>;
17787
17905
  }
17788
17906
 
17907
+ /**
17908
+ * The inline style that applies token overrides: a React style object whose `--wave-*` custom
17909
+ * properties set the tokens, so it can be merged with other style properties.
17910
+ */
17911
+ export declare type TokenStyle = React_2.CSSProperties & {
17912
+ [K in `--wave-${string}`]?: string;
17913
+ };
17914
+
17915
+ /**
17916
+ * The CSS custom property of a token name at the type level: `TokenVariable<'brand80'>` is
17917
+ * `'--wave-brand-80'`, by the rule of {@link tokenVariable}. It spells out the literal values of
17918
+ * `waveTokens`. It walks the name one character at a time (tail-recursive, so long names stay
17919
+ * within the compiler's depth limit): `AfterLetter` says whether the previous character was a
17920
+ * letter, `Done` holds the converted text so far.
17921
+ */
17922
+ 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}`;
17923
+
17789
17924
  /**
17790
17925
  * A container for a set of controls (APG Toolbar pattern): `role="toolbar"`, one Tab stop, and
17791
17926
  * arrow-key navigation between its controls.
@@ -20532,7 +20667,7 @@ export declare interface UseVirtualWindowOptions {
20532
20667
  }
20533
20668
 
20534
20669
  /**
20535
- * Reads the theme, direction, theme classes and portal container of the nearest
20670
+ * Reads the theme, direction, theme classes, portal container and token overrides of the nearest
20536
20671
  * {@link WaveProvider}. Outside a provider it returns light/ltr defaults with `hasProvider: false`.
20537
20672
  *
20538
20673
  * @returns The {@link WaveContextValue} of the nearest provider.
@@ -20635,6 +20770,12 @@ export declare interface VisibleFlatItem {
20635
20770
  index: number;
20636
20771
  }
20637
20772
 
20773
+ /**
20774
+ * The name of every `--wave-*` variable of `tokens.css`, in camelCase, in the file's groups and
20775
+ * order. A test parses `tokens.css` and fails when a variable is missing here or a name has none.
20776
+ */
20777
+ 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"];
20778
+
20638
20779
  /** Value provided by {@link WaveProvider} and returned by {@link useWaveTheme}. */
20639
20780
  export declare interface WaveContextValue {
20640
20781
  /** The active theme. */
@@ -20652,6 +20793,19 @@ export declare interface WaveContextValue {
20652
20793
  inputDefaults: InputDefaults;
20653
20794
  /** The motion preference of the providers above (`'default'` outside a provider). */
20654
20795
  motion: MotionPreference;
20796
+ /**
20797
+ * The merged token overrides of the providers above (`{}` outside a provider), as given: an
20798
+ * entry skipped for a malformed key or value stays in it, and only `tokenStyle` leaves it out.
20799
+ */
20800
+ tokens: WaveTokenOverrides;
20801
+ /**
20802
+ * The inline style that applies `tokens`, as the provider's root and, unless
20803
+ * `applyStylesToPortals` is `false`, its portals carry it; `undefined` when there is nothing to
20804
+ * set (also outside a provider).
20805
+ */
20806
+ tokenStyle: TokenStyle | undefined;
20807
+ /** Whether portals carry `tokenStyle` (`true` outside a provider). */
20808
+ applyStylesToPortals: boolean;
20655
20809
  /** `false` when no {@link WaveProvider} is above the caller (the defaults are returned). */
20656
20810
  hasProvider: boolean;
20657
20811
  }
@@ -20682,9 +20836,18 @@ export declare type WaveDir = 'ltr' | 'rtl';
20682
20836
  * slots, Carousel's slide, TabList's sliding line, the reveal of Nav item actions; a part's own
20683
20837
  * `motion` still wins), while transitions without a slot keep running (Accordion's and Tree's
20684
20838
  * chevron turns, colour changes); a nested provider inherits an omitted `motion` like `theme`.
20839
+ * - `tokens` overrides design tokens in the subtree with inline custom properties on the root
20840
+ * (rendered on the server too) and on every portal of the subtree, unless
20841
+ * `applyStylesToPortals` is `false`. A nested provider merges its overrides over the enclosing
20842
+ * provider's key by key, also when it sets another `theme`; `tokens={null}` clears them for the
20843
+ * tokens the theme declares and for the overlays, while the theme-independent ones of an
20844
+ * enclosing provider still reach the subtree through the CSS cascade. An override whose key is
20845
+ * not a camelCase identifier, or whose value is neither a finite number nor a string without
20846
+ * `;`, `{` or `}`, is skipped with a development warning. Without overrides the root renders no
20847
+ * `style` attribute unless you pass `style`.
20685
20848
  */
20686
20849
  export declare const WaveProvider: {
20687
- ({ theme: themeProp, dir: dirProp, portalContainer: portalContainerProp, inputDefaults: inputDefaultsProp, motion: motionProp, children, className, ref, ...rest }: WaveProviderProps): React_2.JSX.Element;
20850
+ ({ 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
20851
  displayName: string;
20689
20852
  };
20690
20853
 
@@ -20732,6 +20895,52 @@ export declare interface WaveProviderProps extends React_2.HTMLAttributes<HTMLDi
20732
20895
  * @default the enclosing WaveProvider's motion, else 'default'
20733
20896
  */
20734
20897
  motion?: MotionPreference;
20898
+ /**
20899
+ * Design token overrides for the subtree: CSS values by token name, the CSS variable in camelCase
20900
+ * without its `--wave-` prefix (`brand80` for `--wave-brand-80`, `primaryForeground` for
20901
+ * `--wave-primary-foreground`; a number is written as its string). `theme` still names one of
20902
+ * the three themes, and the overrides apply over it as inline custom properties on the root and
20903
+ * on every portal of the subtree (see `applyStylesToPortals`), so its dialogs, menus, popovers,
20904
+ * tooltips and toasts take them too. Fluent's `theme` prop with a partial theme is the
20905
+ * counterpart.
20906
+ *
20907
+ * A nested provider merges its overrides over the enclosing provider's, key by key: an omitted
20908
+ * `tokens` inherits them all, and a key whose value is `undefined` inherits that key. `null`
20909
+ * clears the inherited overrides of the tokens the theme declares (the semantic colours, shadows,
20910
+ * palette) and of the subtree's overlays; theme-independent tokens (the brand and grey ramps,
20911
+ * font families, stacking order, motion durations and curves) of an enclosing provider still
20912
+ * reach the subtree's own elements through the CSS cascade, and the theme's colours built on the
20913
+ * brand ramp follow them there. A nested provider that sets another `theme` inherits the
20914
+ * overrides too, so set an override of a semantic colour (`primary`) in the provider that sets
20915
+ * the theme it was chosen for. A whole brand ramp is better made with `createBrandTokens` than
20916
+ * written by hand.
20917
+ * A key that is not a camelCase identifier, or a value that is neither a finite number nor a
20918
+ * string without `;`, `{` or `}` (such a value could add a declaration of its own to the
20919
+ * server-rendered `style` attribute), is skipped with a development warning; a well-formed name
20920
+ * is not checked against the list of tokens (TypeScript refuses a misspelled one).
20921
+ *
20922
+ * The overrides are rendered on the server too. Under a Content Security Policy that blocks
20923
+ * inline style attributes (`style-src` without `'unsafe-inline'`), the server-rendered overrides
20924
+ * do not apply and hydration does not apply them again: ship them in a stylesheet there, and pass
20925
+ * no `tokens` (nor `getTokenStyle`), since the overlays and the subtrees rendered in the client
20926
+ * would still take them and leave the page half branded.
20927
+ *
20928
+ * @example
20929
+ * <WaveProvider tokens={{ fontFamily: 'Inter, sans-serif', zOverlay: 2000 }}>
20930
+ * @default the enclosing WaveProvider's overrides, else none
20931
+ */
20932
+ tokens?: WaveTokenOverrides | null;
20933
+ /**
20934
+ * Whether the portals of the subtree (dialogs, popovers, menus, tooltips, toasts) carry the
20935
+ * overrides of `tokens`. `false` leaves them out: an overlay then shows its theme's own values
20936
+ * for the tokens the theme declares, and keeps the surrounding cascade (that of the element it
20937
+ * renders into) for the theme-independent ones. The theme classes and the direction are set on
20938
+ * every portal either way, so an overlay of a dark provider is still dark. Fluent's
20939
+ * `applyStylesToPortals` is the counterpart; unlike Fluent's, a nested provider inherits an
20940
+ * omitted value, like `theme`.
20941
+ * @default the enclosing WaveProvider's value, else true
20942
+ */
20943
+ applyStylesToPortals?: boolean;
20735
20944
  /** Content rendered inside the themed container. */
20736
20945
  children: React_2.ReactNode;
20737
20946
  /** Ref to the themed root `<div>`. */
@@ -20747,4 +20956,42 @@ export declare interface WaveProviderProps extends React_2.HTMLAttributes<HTMLDi
20747
20956
  /** Supported visual themes for the Wave design system. */
20748
20957
  export declare type WaveTheme = 'light' | 'dark' | 'high-contrast';
20749
20958
 
20959
+ /**
20960
+ * The name of a design token: its CSS custom property without the `--wave-` prefix, in camelCase.
20961
+ * `--wave-primary-foreground` is `primaryForeground`, `--wave-brand-80` is `brand80` and
20962
+ * `--wave-palette-red-tint` is `paletteRedTint`.
20963
+ */
20964
+ export declare type WaveTokenName = (typeof WAVE_TOKEN_NAMES)[number];
20965
+
20966
+ /**
20967
+ * Token overrides: CSS values by token name, as `WaveProvider tokens` and `getTokenStyle` take
20968
+ * them. A number is written as its string (`zOverlay: 2000`); a key whose value is `undefined`
20969
+ * sets nothing.
20970
+ */
20971
+ export declare type WaveTokenOverrides = {
20972
+ [K in WaveTokenName]?: string | number;
20973
+ };
20974
+
20975
+ /** The shape of `waveTokens`: every token name mapped to the CSS value that reads the token. */
20976
+ export declare type WaveTokens = {
20977
+ readonly [K in WaveTokenName]: string;
20978
+ };
20979
+
20980
+ /**
20981
+ * Every design token as the CSS value that reads it: `waveTokens.primary` is
20982
+ * `'var(--wave-primary)'`, typed as that literal. Use it where a style is written in JavaScript
20983
+ * (an inline style, a CSS-in-JS rule, the colours of an SVG chart), so the value follows the theme
20984
+ * and the provider's token overrides. The counterpart of Fluent's `tokens` object
20985
+ * (`tokens.colorBrandBackground`), with Wave's names: the CSS variable in camelCase without its
20986
+ * `--wave-` prefix. A canvas library cannot read a CSS variable: resolve the value with
20987
+ * `getComputedStyle` on an element inside the provider, and again when the theme changes.
20988
+ * Frozen and server-safe; no component imports it.
20989
+ *
20990
+ * @example
20991
+ * <span style={{ color: waveTokens.primary, boxShadow: waveTokens.shadow8 }} />
20992
+ */
20993
+ export declare const waveTokens: {
20994
+ readonly [K in WaveTokenName]: `var(${TokenVariable<K>})`;
20995
+ };
20996
+
20750
20997
  export { }