@xsolla/xui-core 0.185.6 → 0.186.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/index.d.mts CHANGED
@@ -8132,6 +8132,7 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
8132
8132
  maxWidth: number;
8133
8133
  overlayColor: string;
8134
8134
  portalPadding: number;
8135
+ /** @deprecated Layering is contextual now; see OVERLAY_LAYER_BASE / useOverlayLayer. */
8135
8136
  zIndex: number;
8136
8137
  };
8137
8138
  drawer: () => {
@@ -8154,6 +8155,7 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
8154
8155
  stepperContentGap: number;
8155
8156
  scrimColor: string;
8156
8157
  animationDuration: number;
8158
+ /** @deprecated Layering is contextual now; see MODAL_LAYER_STEP / useOverlayLayer. */
8157
8159
  zIndex: number;
8158
8160
  };
8159
8161
  sidebar: () => {
@@ -8177,6 +8179,7 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
8177
8179
  popoverMinWidth: number;
8178
8180
  popoverMaxWidth: number;
8179
8181
  popoverShadow: string;
8182
+ /** @deprecated Layering is contextual now; see useOverlayLayer / LAYER_OFFSET. */
8180
8183
  popoverZIndex: number;
8181
8184
  transitionWidth: string;
8182
8185
  transitionFadeIn: string;
@@ -8407,5 +8410,72 @@ declare const ModalIdContext: React.Context<string | null>;
8407
8410
  * Returns null if not inside a modal.
8408
8411
  */
8409
8412
  declare const useModalId: () => string | null;
8413
+ /**
8414
+ * Shared layering contract for every overlay primitive (modal, drawer,
8415
+ * dropdown, select, context-menu, status-dropdown, tooltip, toggletip, …).
8416
+ *
8417
+ * The problem this solves: each overlay used to hardcode its own z-index and
8418
+ * portal to `document.body`, so a transient overlay (tooltip at 2000) could
8419
+ * render on top of a modal (1000) that opened over it, while an overlay opened
8420
+ * *inside* a modal had no reliable way to sit above it. A single global scale
8421
+ * cannot satisfy both — so layering is **contextual**.
8422
+ *
8423
+ * How it works:
8424
+ * - Overlays compute their z-index as `useOverlayLayer() + LAYER_OFFSET.<band>`.
8425
+ * - The default (root) base is {@link OVERLAY_LAYER_BASE}; stray overlays sit
8426
+ * just above app chrome but below any modal.
8427
+ * - A modal/drawer raises the base by {@link MODAL_LAYER_STEP} for its whole
8428
+ * subtree via {@link OverlayLayerProvider}. React context flows through
8429
+ * portals, so a tooltip declared inside a modal reads the raised base even
8430
+ * though it portals to `document.body`, and therefore renders above the modal
8431
+ * — while a tooltip opened elsewhere keeps the low base and is covered by it.
8432
+ *
8433
+ * Resulting order (low → high): app content < popover/menu/tooltip (stray) <
8434
+ * modal/drawer < popover/menu/tooltip (in-modal) < … < toasts.
8435
+ */
8436
+ declare const OVERLAY_LAYER_BASE = 1000;
8437
+ /**
8438
+ * Rank of each overlay kind *within a single layer* (a stray context, or one
8439
+ * modal's subtree). Values are small relative to {@link MODAL_LAYER_STEP} so a
8440
+ * modal always clears every transient overlay of the layer beneath it.
8441
+ *
8442
+ * `popover` (dropdown/select) sits above `menu` (context-menu) — matching the
8443
+ * intended order and keeping a Select opened inside a ContextMenu above it.
8444
+ * `tooltip` is highest so it annotates whatever is currently on top.
8445
+ */
8446
+ declare const LAYER_OFFSET: {
8447
+ /** Trigger-anchored value lists: dropdown, select, multi-select, autocomplete. */
8448
+ readonly popover: 200;
8449
+ /** context-menu and its consumers (status-dropdown). */
8450
+ readonly menu: 100;
8451
+ /** tooltip, toggletip. */
8452
+ readonly tooltip: 300;
8453
+ };
8454
+ /**
8455
+ * Amount a modal/drawer raises the layer base for everything in its subtree.
8456
+ * Must exceed every {@link LAYER_OFFSET} so a modal covers stray transients yet
8457
+ * stays below overlays opened within it.
8458
+ */
8459
+ declare const MODAL_LAYER_STEP = 1000;
8460
+ /**
8461
+ * Fixed, non-contextual top-most layer for toasts / notifications — always above
8462
+ * modals regardless of nesting depth.
8463
+ */
8464
+ declare const TOAST_LAYER = 9999;
8465
+ /**
8466
+ * Raises the overlay layer base for a subtree. Applied by modal/drawer roots so
8467
+ * overlays opened within them stack above them. Consumers rarely need this
8468
+ * directly.
8469
+ */
8470
+ declare const OverlayLayerProvider: React.Provider<number>;
8471
+ /**
8472
+ * Returns the current overlay layer base. Add a {@link LAYER_OFFSET} band to get
8473
+ * an overlay's z-index, e.g. `useOverlayLayer() + LAYER_OFFSET.tooltip`.
8474
+ */
8475
+ declare const useOverlayLayer: () => number;
8476
+ /** Publishes the open-modal count. Applied by `ModalProvider`. */
8477
+ declare const ModalStackProvider: React.Provider<number>;
8478
+ /** Returns the number of currently-open modals. */
8479
+ declare const useModalStackDepth: () => number;
8410
8480
 
8411
- export { type BreakpointKey, type ComponentSize, DISPLAY_SCALE_STEPS, type DesignSystemContextType, type DisplayScaleStep, FontLoader, MOBILE_MAX_WIDTH, ModalIdContext, type ProductContext, type ResponsiveValue, SCALE_STEPS, type ScaleStep, type Theme, type ThemeColorScheme, type ThemeColors, type ThemeFonts, type ThemeMode, type ThemeOverrideProps, type ThemeShadow, type ThemeShape, type ThemeSizing, type ThemeSpacing, type ThemeTypographyRoles, type TypographyBodyVariant, TypographyStyleLoader, type TypographyTokens, type TypographyVariant, XUIProvider, breakpoints, colors, cssVar, defaultProductContext, fontFacesCSS, fontSize, fonts, generateTypographyCSS, getFonts, getTypographyTokens, getTypographyVariant, isAndroid, isIOS, isNative, isWeb, lineHeightCompact, lineHeightDisplay, lineHeightText, radius, radiusScale, responsiveTypographyScale, shadow, shape, spacing, stroke, themeConfig, typography, typographyTokens, useDesignSystem, useId, useModalId, useResolvedTheme };
8481
+ export { type BreakpointKey, type ComponentSize, DISPLAY_SCALE_STEPS, type DesignSystemContextType, type DisplayScaleStep, FontLoader, LAYER_OFFSET, MOBILE_MAX_WIDTH, MODAL_LAYER_STEP, ModalIdContext, ModalStackProvider, OVERLAY_LAYER_BASE, OverlayLayerProvider, type ProductContext, type ResponsiveValue, SCALE_STEPS, type ScaleStep, TOAST_LAYER, type Theme, type ThemeColorScheme, type ThemeColors, type ThemeFonts, type ThemeMode, type ThemeOverrideProps, type ThemeShadow, type ThemeShape, type ThemeSizing, type ThemeSpacing, type ThemeTypographyRoles, type TypographyBodyVariant, TypographyStyleLoader, type TypographyTokens, type TypographyVariant, XUIProvider, breakpoints, colors, cssVar, defaultProductContext, fontFacesCSS, fontSize, fonts, generateTypographyCSS, getFonts, getTypographyTokens, getTypographyVariant, isAndroid, isIOS, isNative, isWeb, lineHeightCompact, lineHeightDisplay, lineHeightText, radius, radiusScale, responsiveTypographyScale, shadow, shape, spacing, stroke, themeConfig, typography, typographyTokens, useDesignSystem, useId, useModalId, useModalStackDepth, useOverlayLayer, useResolvedTheme };
package/index.d.ts CHANGED
@@ -8132,6 +8132,7 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
8132
8132
  maxWidth: number;
8133
8133
  overlayColor: string;
8134
8134
  portalPadding: number;
8135
+ /** @deprecated Layering is contextual now; see OVERLAY_LAYER_BASE / useOverlayLayer. */
8135
8136
  zIndex: number;
8136
8137
  };
8137
8138
  drawer: () => {
@@ -8154,6 +8155,7 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
8154
8155
  stepperContentGap: number;
8155
8156
  scrimColor: string;
8156
8157
  animationDuration: number;
8158
+ /** @deprecated Layering is contextual now; see MODAL_LAYER_STEP / useOverlayLayer. */
8157
8159
  zIndex: number;
8158
8160
  };
8159
8161
  sidebar: () => {
@@ -8177,6 +8179,7 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
8177
8179
  popoverMinWidth: number;
8178
8180
  popoverMaxWidth: number;
8179
8181
  popoverShadow: string;
8182
+ /** @deprecated Layering is contextual now; see useOverlayLayer / LAYER_OFFSET. */
8180
8183
  popoverZIndex: number;
8181
8184
  transitionWidth: string;
8182
8185
  transitionFadeIn: string;
@@ -8407,5 +8410,72 @@ declare const ModalIdContext: React.Context<string | null>;
8407
8410
  * Returns null if not inside a modal.
8408
8411
  */
8409
8412
  declare const useModalId: () => string | null;
8413
+ /**
8414
+ * Shared layering contract for every overlay primitive (modal, drawer,
8415
+ * dropdown, select, context-menu, status-dropdown, tooltip, toggletip, …).
8416
+ *
8417
+ * The problem this solves: each overlay used to hardcode its own z-index and
8418
+ * portal to `document.body`, so a transient overlay (tooltip at 2000) could
8419
+ * render on top of a modal (1000) that opened over it, while an overlay opened
8420
+ * *inside* a modal had no reliable way to sit above it. A single global scale
8421
+ * cannot satisfy both — so layering is **contextual**.
8422
+ *
8423
+ * How it works:
8424
+ * - Overlays compute their z-index as `useOverlayLayer() + LAYER_OFFSET.<band>`.
8425
+ * - The default (root) base is {@link OVERLAY_LAYER_BASE}; stray overlays sit
8426
+ * just above app chrome but below any modal.
8427
+ * - A modal/drawer raises the base by {@link MODAL_LAYER_STEP} for its whole
8428
+ * subtree via {@link OverlayLayerProvider}. React context flows through
8429
+ * portals, so a tooltip declared inside a modal reads the raised base even
8430
+ * though it portals to `document.body`, and therefore renders above the modal
8431
+ * — while a tooltip opened elsewhere keeps the low base and is covered by it.
8432
+ *
8433
+ * Resulting order (low → high): app content < popover/menu/tooltip (stray) <
8434
+ * modal/drawer < popover/menu/tooltip (in-modal) < … < toasts.
8435
+ */
8436
+ declare const OVERLAY_LAYER_BASE = 1000;
8437
+ /**
8438
+ * Rank of each overlay kind *within a single layer* (a stray context, or one
8439
+ * modal's subtree). Values are small relative to {@link MODAL_LAYER_STEP} so a
8440
+ * modal always clears every transient overlay of the layer beneath it.
8441
+ *
8442
+ * `popover` (dropdown/select) sits above `menu` (context-menu) — matching the
8443
+ * intended order and keeping a Select opened inside a ContextMenu above it.
8444
+ * `tooltip` is highest so it annotates whatever is currently on top.
8445
+ */
8446
+ declare const LAYER_OFFSET: {
8447
+ /** Trigger-anchored value lists: dropdown, select, multi-select, autocomplete. */
8448
+ readonly popover: 200;
8449
+ /** context-menu and its consumers (status-dropdown). */
8450
+ readonly menu: 100;
8451
+ /** tooltip, toggletip. */
8452
+ readonly tooltip: 300;
8453
+ };
8454
+ /**
8455
+ * Amount a modal/drawer raises the layer base for everything in its subtree.
8456
+ * Must exceed every {@link LAYER_OFFSET} so a modal covers stray transients yet
8457
+ * stays below overlays opened within it.
8458
+ */
8459
+ declare const MODAL_LAYER_STEP = 1000;
8460
+ /**
8461
+ * Fixed, non-contextual top-most layer for toasts / notifications — always above
8462
+ * modals regardless of nesting depth.
8463
+ */
8464
+ declare const TOAST_LAYER = 9999;
8465
+ /**
8466
+ * Raises the overlay layer base for a subtree. Applied by modal/drawer roots so
8467
+ * overlays opened within them stack above them. Consumers rarely need this
8468
+ * directly.
8469
+ */
8470
+ declare const OverlayLayerProvider: React.Provider<number>;
8471
+ /**
8472
+ * Returns the current overlay layer base. Add a {@link LAYER_OFFSET} band to get
8473
+ * an overlay's z-index, e.g. `useOverlayLayer() + LAYER_OFFSET.tooltip`.
8474
+ */
8475
+ declare const useOverlayLayer: () => number;
8476
+ /** Publishes the open-modal count. Applied by `ModalProvider`. */
8477
+ declare const ModalStackProvider: React.Provider<number>;
8478
+ /** Returns the number of currently-open modals. */
8479
+ declare const useModalStackDepth: () => number;
8410
8480
 
8411
- export { type BreakpointKey, type ComponentSize, DISPLAY_SCALE_STEPS, type DesignSystemContextType, type DisplayScaleStep, FontLoader, MOBILE_MAX_WIDTH, ModalIdContext, type ProductContext, type ResponsiveValue, SCALE_STEPS, type ScaleStep, type Theme, type ThemeColorScheme, type ThemeColors, type ThemeFonts, type ThemeMode, type ThemeOverrideProps, type ThemeShadow, type ThemeShape, type ThemeSizing, type ThemeSpacing, type ThemeTypographyRoles, type TypographyBodyVariant, TypographyStyleLoader, type TypographyTokens, type TypographyVariant, XUIProvider, breakpoints, colors, cssVar, defaultProductContext, fontFacesCSS, fontSize, fonts, generateTypographyCSS, getFonts, getTypographyTokens, getTypographyVariant, isAndroid, isIOS, isNative, isWeb, lineHeightCompact, lineHeightDisplay, lineHeightText, radius, radiusScale, responsiveTypographyScale, shadow, shape, spacing, stroke, themeConfig, typography, typographyTokens, useDesignSystem, useId, useModalId, useResolvedTheme };
8481
+ export { type BreakpointKey, type ComponentSize, DISPLAY_SCALE_STEPS, type DesignSystemContextType, type DisplayScaleStep, FontLoader, LAYER_OFFSET, MOBILE_MAX_WIDTH, MODAL_LAYER_STEP, ModalIdContext, ModalStackProvider, OVERLAY_LAYER_BASE, OverlayLayerProvider, type ProductContext, type ResponsiveValue, SCALE_STEPS, type ScaleStep, TOAST_LAYER, type Theme, type ThemeColorScheme, type ThemeColors, type ThemeFonts, type ThemeMode, type ThemeOverrideProps, type ThemeShadow, type ThemeShape, type ThemeSizing, type ThemeSpacing, type ThemeTypographyRoles, type TypographyBodyVariant, TypographyStyleLoader, type TypographyTokens, type TypographyVariant, XUIProvider, breakpoints, colors, cssVar, defaultProductContext, fontFacesCSS, fontSize, fonts, generateTypographyCSS, getFonts, getTypographyTokens, getTypographyVariant, isAndroid, isIOS, isNative, isWeb, lineHeightCompact, lineHeightDisplay, lineHeightText, radius, radiusScale, responsiveTypographyScale, shadow, shape, spacing, stroke, themeConfig, typography, typographyTokens, useDesignSystem, useId, useModalId, useModalStackDepth, useOverlayLayer, useResolvedTheme };
package/index.js CHANGED
@@ -32,9 +32,15 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  DISPLAY_SCALE_STEPS: () => DISPLAY_SCALE_STEPS,
34
34
  FontLoader: () => FontLoader,
35
+ LAYER_OFFSET: () => LAYER_OFFSET,
35
36
  MOBILE_MAX_WIDTH: () => MOBILE_MAX_WIDTH,
37
+ MODAL_LAYER_STEP: () => MODAL_LAYER_STEP,
36
38
  ModalIdContext: () => ModalIdContext,
39
+ ModalStackProvider: () => ModalStackProvider,
40
+ OVERLAY_LAYER_BASE: () => OVERLAY_LAYER_BASE,
41
+ OverlayLayerProvider: () => OverlayLayerProvider,
37
42
  SCALE_STEPS: () => SCALE_STEPS,
43
+ TOAST_LAYER: () => TOAST_LAYER,
38
44
  TypographyStyleLoader: () => TypographyStyleLoader,
39
45
  XUIProvider: () => XUIProvider,
40
46
  breakpoints: () => breakpoints,
@@ -68,6 +74,8 @@ __export(index_exports, {
68
74
  useDesignSystem: () => useDesignSystem,
69
75
  useId: () => useId,
70
76
  useModalId: () => useModalId,
77
+ useModalStackDepth: () => useModalStackDepth,
78
+ useOverlayLayer: () => useOverlayLayer,
71
79
  useResolvedTheme: () => useResolvedTheme
72
80
  });
73
81
  module.exports = __toCommonJS(index_exports);
@@ -4651,6 +4659,7 @@ var themeConfig = (mode = "dark", productContext = defaultProductContext) => {
4651
4659
  maxWidth: 680,
4652
4660
  overlayColor: "rgba(0, 0, 0, 0.75)",
4653
4661
  portalPadding: 20,
4662
+ /** @deprecated Layering is contextual now; see OVERLAY_LAYER_BASE / useOverlayLayer. */
4654
4663
  zIndex: 1e3
4655
4664
  };
4656
4665
  },
@@ -4675,6 +4684,7 @@ var themeConfig = (mode = "dark", productContext = defaultProductContext) => {
4675
4684
  stepperContentGap: 8,
4676
4685
  scrimColor: "rgba(0, 0, 0, 0.75)",
4677
4686
  animationDuration: 300,
4687
+ /** @deprecated Layering is contextual now; see MODAL_LAYER_STEP / useOverlayLayer. */
4678
4688
  zIndex: 1e3
4679
4689
  }),
4680
4690
  sidebar: () => ({
@@ -4701,6 +4711,7 @@ var themeConfig = (mode = "dark", productContext = defaultProductContext) => {
4701
4711
  popoverMinWidth: 180,
4702
4712
  popoverMaxWidth: 240,
4703
4713
  popoverShadow: "0 2px 25px rgba(7, 7, 8, 0.15)",
4714
+ /** @deprecated Layering is contextual now; see useOverlayLayer / LAYER_OFFSET. */
4704
4715
  popoverZIndex: 1e3,
4705
4716
  transitionWidth: "0.25s ease-in-out",
4706
4717
  transitionFadeIn: "opacity 0.15s ease-in-out 0.1s",
@@ -4952,13 +4963,36 @@ var useIdFallback = () => {
4952
4963
  var useId = hasReactUseId ? import_react3.default.useId : useIdFallback;
4953
4964
  var ModalIdContext = (0, import_react3.createContext)(null);
4954
4965
  var useModalId = () => (0, import_react3.useContext)(ModalIdContext);
4966
+ var OVERLAY_LAYER_BASE = 1e3;
4967
+ var LAYER_OFFSET = {
4968
+ /** Trigger-anchored value lists: dropdown, select, multi-select, autocomplete. */
4969
+ popover: 200,
4970
+ /** context-menu and its consumers (status-dropdown). */
4971
+ menu: 100,
4972
+ /** tooltip, toggletip. */
4973
+ tooltip: 300
4974
+ };
4975
+ var MODAL_LAYER_STEP = 1e3;
4976
+ var TOAST_LAYER = 9999;
4977
+ var OverlayLayerContext = (0, import_react3.createContext)(OVERLAY_LAYER_BASE);
4978
+ var OverlayLayerProvider = OverlayLayerContext.Provider;
4979
+ var useOverlayLayer = () => (0, import_react3.useContext)(OverlayLayerContext);
4980
+ var ModalStackContext = (0, import_react3.createContext)(0);
4981
+ var ModalStackProvider = ModalStackContext.Provider;
4982
+ var useModalStackDepth = () => (0, import_react3.useContext)(ModalStackContext);
4955
4983
  // Annotate the CommonJS export names for ESM import in node:
4956
4984
  0 && (module.exports = {
4957
4985
  DISPLAY_SCALE_STEPS,
4958
4986
  FontLoader,
4987
+ LAYER_OFFSET,
4959
4988
  MOBILE_MAX_WIDTH,
4989
+ MODAL_LAYER_STEP,
4960
4990
  ModalIdContext,
4991
+ ModalStackProvider,
4992
+ OVERLAY_LAYER_BASE,
4993
+ OverlayLayerProvider,
4961
4994
  SCALE_STEPS,
4995
+ TOAST_LAYER,
4962
4996
  TypographyStyleLoader,
4963
4997
  XUIProvider,
4964
4998
  breakpoints,
@@ -4992,6 +5026,8 @@ var useModalId = () => (0, import_react3.useContext)(ModalIdContext);
4992
5026
  useDesignSystem,
4993
5027
  useId,
4994
5028
  useModalId,
5029
+ useModalStackDepth,
5030
+ useOverlayLayer,
4995
5031
  useResolvedTheme
4996
5032
  });
4997
5033
  //# sourceMappingURL=index.js.map