@dloizides/design-tokens 1.12.0 → 1.13.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.
package/dist/index.d.mts CHANGED
@@ -376,6 +376,48 @@ interface FinregSurfaceColors {
376
376
 
377
377
  declare const DEFAULT_MOTION: Motion;
378
378
 
379
+ /**
380
+ * The shared overlay stacking scale — one named z-index per layer, ordered low to high.
381
+ *
382
+ * react-native-web mounts `Modal` in a body-level `position: fixed` container at
383
+ * `zIndex: 9999` (react-native-web `Modal/ModalAnimation.js`). We cannot move that number,
384
+ * so the scale is built around it: everything a Modal must cover sits below it, and
385
+ * everything that must stay usable WITH a Modal open (body-portalled menus, toasts, the
386
+ * blocking warm-up overlay) sits above it.
387
+ *
388
+ * Values only — framework-agnostic, usable as an RN `zIndex` or a CSS `z-index`.
389
+ */
390
+ /** react-native-web's fixed Modal layer. A constant of the library, not a design choice. */
391
+ declare const RN_WEB_MODAL_Z_INDEX = 9999;
392
+ /**
393
+ * - `base`: in-flow content.
394
+ * - `sticky`: sticky table headers / columns.
395
+ * - `raised`: in-tree elements lifted over their siblings (cards, row chrome).
396
+ * - `drawer`: the mobile navigation drawer + scrim.
397
+ * - `palette`: the command palette, above the drawer.
398
+ * - `dropdown`: an in-tree (non-portalled) dropdown, or an anchor lifted while its menu is open.
399
+ * - `modal`: react-native-web's Modal container (read-only — RN-web sets it).
400
+ * - `popover`: every body-portalled menu / popover; clears an open Modal so a dropdown inside a
401
+ * dialog paints above it and receives the click.
402
+ * - `toast`: toasts stay readable over an open popover.
403
+ * - `blocking`: the full-screen blocking overlay (service warm-up); covers everything.
404
+ */
405
+ declare const Z_INDEX: {
406
+ readonly base: 0;
407
+ readonly sticky: 2;
408
+ readonly raised: 30;
409
+ readonly drawer: 50;
410
+ readonly palette: 60;
411
+ readonly dropdown: 1000;
412
+ readonly modal: 9999;
413
+ readonly popover: number;
414
+ readonly toast: number;
415
+ readonly blocking: 100000;
416
+ };
417
+ type ZIndexLayer = keyof typeof Z_INDEX;
418
+ /** The layers in stacking order, lowest first. */
419
+ declare const Z_INDEX_ORDER: readonly ZIndexLayer[];
420
+
379
421
  /**
380
422
  * CSS custom-property NAME MAPS — the cross-stack naming contract.
381
423
  *
@@ -1014,4 +1056,4 @@ declare function onBrandRatio(background: string, explicit?: string): number | n
1014
1056
  */
1015
1057
  declare function canCarryAccessibleInk(background: string): boolean;
1016
1058
 
1017
- export { AA_LARGE_TEXT_RATIO, AA_NON_TEXT_RATIO, AA_NORMAL_TEXT_RATIO, AML_CSS_VAR_NAMES, AML_TOKENS, type BrandExtras, type Branding, type ContrastMoreOverrides, type CssVarNames, DEFAULT_CSS_VAR_NAMES, DEFAULT_MOTION, DIGITALKIN_TOKENS, type DesignTokens, EREVNA_TOKENS, FINREG_MODULE_COLORS, FINREG_SURFACE_COLORS, type FinregModuleColor, type FinregModuleColors, type FinregSurfaceColors, INTERVIEWPREP_CSS_VAR_NAMES, INTERVIEWPREP_TOKENS, type InkScale, KATALOGOS_TOKENS, type ModeColors, type Motion, type MotionDurations, type MotionEasing, type MotionEasings, type MotionSpring, type MotionSprings, NEXTGAME_TOKENS, ON_BRAND_DARK_INK, ON_BRAND_LIGHT_INK, PRESETS, type Radii, type RnThemeConfig, type SemanticColors, type Shadows, type ShellColors, type TailwindColors, type TailwindPreset, type ToCssVarsOptions, type TokenExtensions, type Typography, UI_DEEP_STEP, UI_MAIN_STEP, UI_TINT_STEP, type UiColorScale, type UiThemeColors, type UiThemeConfig, type UiThemeMode, type UiThemePalette, type UiThemeSemantic, type VerdictColors, type WorkspaceExtras, canCarryAccessibleInk, contrastRatio, isHexColor, meetsContrast, onBrandRatio, relativeLuminance, resolveOnBrand, toCssVars, toRnTheme, toTailwindPreset, toUiTheme };
1059
+ export { AA_LARGE_TEXT_RATIO, AA_NON_TEXT_RATIO, AA_NORMAL_TEXT_RATIO, AML_CSS_VAR_NAMES, AML_TOKENS, type BrandExtras, type Branding, type ContrastMoreOverrides, type CssVarNames, DEFAULT_CSS_VAR_NAMES, DEFAULT_MOTION, DIGITALKIN_TOKENS, type DesignTokens, EREVNA_TOKENS, FINREG_MODULE_COLORS, FINREG_SURFACE_COLORS, type FinregModuleColor, type FinregModuleColors, type FinregSurfaceColors, INTERVIEWPREP_CSS_VAR_NAMES, INTERVIEWPREP_TOKENS, type InkScale, KATALOGOS_TOKENS, type ModeColors, type Motion, type MotionDurations, type MotionEasing, type MotionEasings, type MotionSpring, type MotionSprings, NEXTGAME_TOKENS, ON_BRAND_DARK_INK, ON_BRAND_LIGHT_INK, PRESETS, RN_WEB_MODAL_Z_INDEX, type Radii, type RnThemeConfig, type SemanticColors, type Shadows, type ShellColors, type TailwindColors, type TailwindPreset, type ToCssVarsOptions, type TokenExtensions, type Typography, UI_DEEP_STEP, UI_MAIN_STEP, UI_TINT_STEP, type UiColorScale, type UiThemeColors, type UiThemeConfig, type UiThemeMode, type UiThemePalette, type UiThemeSemantic, type VerdictColors, type WorkspaceExtras, type ZIndexLayer, Z_INDEX, Z_INDEX_ORDER, canCarryAccessibleInk, contrastRatio, isHexColor, meetsContrast, onBrandRatio, relativeLuminance, resolveOnBrand, toCssVars, toRnTheme, toTailwindPreset, toUiTheme };
package/dist/index.d.ts CHANGED
@@ -376,6 +376,48 @@ interface FinregSurfaceColors {
376
376
 
377
377
  declare const DEFAULT_MOTION: Motion;
378
378
 
379
+ /**
380
+ * The shared overlay stacking scale — one named z-index per layer, ordered low to high.
381
+ *
382
+ * react-native-web mounts `Modal` in a body-level `position: fixed` container at
383
+ * `zIndex: 9999` (react-native-web `Modal/ModalAnimation.js`). We cannot move that number,
384
+ * so the scale is built around it: everything a Modal must cover sits below it, and
385
+ * everything that must stay usable WITH a Modal open (body-portalled menus, toasts, the
386
+ * blocking warm-up overlay) sits above it.
387
+ *
388
+ * Values only — framework-agnostic, usable as an RN `zIndex` or a CSS `z-index`.
389
+ */
390
+ /** react-native-web's fixed Modal layer. A constant of the library, not a design choice. */
391
+ declare const RN_WEB_MODAL_Z_INDEX = 9999;
392
+ /**
393
+ * - `base`: in-flow content.
394
+ * - `sticky`: sticky table headers / columns.
395
+ * - `raised`: in-tree elements lifted over their siblings (cards, row chrome).
396
+ * - `drawer`: the mobile navigation drawer + scrim.
397
+ * - `palette`: the command palette, above the drawer.
398
+ * - `dropdown`: an in-tree (non-portalled) dropdown, or an anchor lifted while its menu is open.
399
+ * - `modal`: react-native-web's Modal container (read-only — RN-web sets it).
400
+ * - `popover`: every body-portalled menu / popover; clears an open Modal so a dropdown inside a
401
+ * dialog paints above it and receives the click.
402
+ * - `toast`: toasts stay readable over an open popover.
403
+ * - `blocking`: the full-screen blocking overlay (service warm-up); covers everything.
404
+ */
405
+ declare const Z_INDEX: {
406
+ readonly base: 0;
407
+ readonly sticky: 2;
408
+ readonly raised: 30;
409
+ readonly drawer: 50;
410
+ readonly palette: 60;
411
+ readonly dropdown: 1000;
412
+ readonly modal: 9999;
413
+ readonly popover: number;
414
+ readonly toast: number;
415
+ readonly blocking: 100000;
416
+ };
417
+ type ZIndexLayer = keyof typeof Z_INDEX;
418
+ /** The layers in stacking order, lowest first. */
419
+ declare const Z_INDEX_ORDER: readonly ZIndexLayer[];
420
+
379
421
  /**
380
422
  * CSS custom-property NAME MAPS — the cross-stack naming contract.
381
423
  *
@@ -1014,4 +1056,4 @@ declare function onBrandRatio(background: string, explicit?: string): number | n
1014
1056
  */
1015
1057
  declare function canCarryAccessibleInk(background: string): boolean;
1016
1058
 
1017
- export { AA_LARGE_TEXT_RATIO, AA_NON_TEXT_RATIO, AA_NORMAL_TEXT_RATIO, AML_CSS_VAR_NAMES, AML_TOKENS, type BrandExtras, type Branding, type ContrastMoreOverrides, type CssVarNames, DEFAULT_CSS_VAR_NAMES, DEFAULT_MOTION, DIGITALKIN_TOKENS, type DesignTokens, EREVNA_TOKENS, FINREG_MODULE_COLORS, FINREG_SURFACE_COLORS, type FinregModuleColor, type FinregModuleColors, type FinregSurfaceColors, INTERVIEWPREP_CSS_VAR_NAMES, INTERVIEWPREP_TOKENS, type InkScale, KATALOGOS_TOKENS, type ModeColors, type Motion, type MotionDurations, type MotionEasing, type MotionEasings, type MotionSpring, type MotionSprings, NEXTGAME_TOKENS, ON_BRAND_DARK_INK, ON_BRAND_LIGHT_INK, PRESETS, type Radii, type RnThemeConfig, type SemanticColors, type Shadows, type ShellColors, type TailwindColors, type TailwindPreset, type ToCssVarsOptions, type TokenExtensions, type Typography, UI_DEEP_STEP, UI_MAIN_STEP, UI_TINT_STEP, type UiColorScale, type UiThemeColors, type UiThemeConfig, type UiThemeMode, type UiThemePalette, type UiThemeSemantic, type VerdictColors, type WorkspaceExtras, canCarryAccessibleInk, contrastRatio, isHexColor, meetsContrast, onBrandRatio, relativeLuminance, resolveOnBrand, toCssVars, toRnTheme, toTailwindPreset, toUiTheme };
1059
+ export { AA_LARGE_TEXT_RATIO, AA_NON_TEXT_RATIO, AA_NORMAL_TEXT_RATIO, AML_CSS_VAR_NAMES, AML_TOKENS, type BrandExtras, type Branding, type ContrastMoreOverrides, type CssVarNames, DEFAULT_CSS_VAR_NAMES, DEFAULT_MOTION, DIGITALKIN_TOKENS, type DesignTokens, EREVNA_TOKENS, FINREG_MODULE_COLORS, FINREG_SURFACE_COLORS, type FinregModuleColor, type FinregModuleColors, type FinregSurfaceColors, INTERVIEWPREP_CSS_VAR_NAMES, INTERVIEWPREP_TOKENS, type InkScale, KATALOGOS_TOKENS, type ModeColors, type Motion, type MotionDurations, type MotionEasing, type MotionEasings, type MotionSpring, type MotionSprings, NEXTGAME_TOKENS, ON_BRAND_DARK_INK, ON_BRAND_LIGHT_INK, PRESETS, RN_WEB_MODAL_Z_INDEX, type Radii, type RnThemeConfig, type SemanticColors, type Shadows, type ShellColors, type TailwindColors, type TailwindPreset, type ToCssVarsOptions, type TokenExtensions, type Typography, UI_DEEP_STEP, UI_MAIN_STEP, UI_TINT_STEP, type UiColorScale, type UiThemeColors, type UiThemeConfig, type UiThemeMode, type UiThemePalette, type UiThemeSemantic, type VerdictColors, type WorkspaceExtras, type ZIndexLayer, Z_INDEX, Z_INDEX_ORDER, canCarryAccessibleInk, contrastRatio, isHexColor, meetsContrast, onBrandRatio, relativeLuminance, resolveOnBrand, toCssVars, toRnTheme, toTailwindPreset, toUiTheme };
package/dist/index.js CHANGED
@@ -31,6 +31,43 @@ var DEFAULT_MOTION = {
31
31
  }
32
32
  };
33
33
 
34
+ // src/zIndex.ts
35
+ var RN_WEB_MODAL_Z_INDEX = 9999;
36
+ var BASE = 0;
37
+ var STICKY = 2;
38
+ var RAISED = 30;
39
+ var DRAWER = 50;
40
+ var PALETTE = 60;
41
+ var DROPDOWN = 1e3;
42
+ var POPOVER = RN_WEB_MODAL_Z_INDEX + 1;
43
+ var TOAST_HEADROOM = 100;
44
+ var TOAST = POPOVER + TOAST_HEADROOM;
45
+ var BLOCKING = 1e5;
46
+ var Z_INDEX = {
47
+ base: BASE,
48
+ sticky: STICKY,
49
+ raised: RAISED,
50
+ drawer: DRAWER,
51
+ palette: PALETTE,
52
+ dropdown: DROPDOWN,
53
+ modal: RN_WEB_MODAL_Z_INDEX,
54
+ popover: POPOVER,
55
+ toast: TOAST,
56
+ blocking: BLOCKING
57
+ };
58
+ var Z_INDEX_ORDER = [
59
+ "base",
60
+ "sticky",
61
+ "raised",
62
+ "drawer",
63
+ "palette",
64
+ "dropdown",
65
+ "modal",
66
+ "popover",
67
+ "toast",
68
+ "blocking"
69
+ ];
70
+
34
71
  // src/varNames.ts
35
72
  var DEFAULT_CSS_VAR_NAMES = {
36
73
  primary: "--primary",
@@ -182,7 +219,7 @@ var CHANNEL_OFFSET_BLUE = 4;
182
219
  function normalizeHexDigits(hex) {
183
220
  const clean = hex.trim().replace("#", "").toLowerCase();
184
221
  if (clean.length === HEX_SHORTHAND_LENGTH) {
185
- return `${clean[0] ?? ""}${clean[0] ?? ""}${clean[1] ?? ""}${clean[1] ?? ""}${clean[2] ?? ""}${clean[2] ?? ""}`;
222
+ return [...clean].map((digit) => digit + digit).join("");
186
223
  }
187
224
  return clean;
188
225
  }
@@ -938,9 +975,12 @@ exports.NEXTGAME_TOKENS = NEXTGAME_TOKENS;
938
975
  exports.ON_BRAND_DARK_INK = ON_BRAND_DARK_INK;
939
976
  exports.ON_BRAND_LIGHT_INK = ON_BRAND_LIGHT_INK;
940
977
  exports.PRESETS = PRESETS;
978
+ exports.RN_WEB_MODAL_Z_INDEX = RN_WEB_MODAL_Z_INDEX;
941
979
  exports.UI_DEEP_STEP = UI_DEEP_STEP;
942
980
  exports.UI_MAIN_STEP = UI_MAIN_STEP;
943
981
  exports.UI_TINT_STEP = UI_TINT_STEP;
982
+ exports.Z_INDEX = Z_INDEX;
983
+ exports.Z_INDEX_ORDER = Z_INDEX_ORDER;
944
984
  exports.canCarryAccessibleInk = canCarryAccessibleInk;
945
985
  exports.contrastRatio = contrastRatio;
946
986
  exports.isHexColor = isHexColor;