@aic-kits/react 0.28.7 → 0.29.2

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.
@@ -32,5 +32,6 @@ export * from './shadows';
32
32
  export * from './sizes';
33
33
  export * from './spaces';
34
34
  export * from './text';
35
+ export * from './zIndex';
35
36
  export type GlobalTheme = ReturnType<typeof getGlobalTheme>;
36
37
  export type { Scale, ColorPalette, GradientColorPalette };
@@ -0,0 +1,22 @@
1
+ import { ZIndexRegistry } from '../../utils/zIndexRegistry';
2
+ /**
3
+ * A singleton instance of ZIndexRegistry to manage z-index across the entire application.
4
+ * Using a single instance ensures that all components reference the same stacking system.
5
+ */
6
+ export declare const zIndexRegistry: ZIndexRegistry;
7
+ /**
8
+ * A constant object defining the stacking layers for the application.
9
+ * Each layer is assigned a unique identifier that can be used to reference it in the z-index registry.
10
+ */
11
+ export declare const StackingLayers: {
12
+ readonly PageContent: "PageContent";
13
+ readonly Carousel: "Carousel";
14
+ readonly Restrict: "Restrict";
15
+ readonly Floating: "Floating";
16
+ readonly Tooltip: "Tooltip";
17
+ readonly AppFooter: "AppFooter";
18
+ readonly AppHeader: "AppHeader";
19
+ readonly Dropdown: "Dropdown";
20
+ readonly Modal: "Modal";
21
+ readonly Notification: "Notification";
22
+ };
@@ -1,4 +1,4 @@
1
- import { BorderWidths, Radii, ColorPalette, Spaces, Fonts, Sizes, getFontSizes, getLineHeights, getFontWeights } from './common';
1
+ import { BorderWidths, Radii, ColorPalette, Spaces, Fonts, Sizes, getFontSizes, getLineHeights, getFontWeights, zIndexRegistry } from './common';
2
2
  import { ComponentsTheme } from './components';
3
3
  export interface Theme {
4
4
  spaces: Spaces;
@@ -7,6 +7,7 @@ export interface Theme {
7
7
  radii: Radii;
8
8
  borderWidths: BorderWidths;
9
9
  fonts: Fonts;
10
+ zIndex: typeof zIndexRegistry;
10
11
  __hd__: {
11
12
  text: {
12
13
  fontSizes: ReturnType<typeof getFontSizes>;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * A class to manage z-index relationships between different components.
3
+ * It uses a topological sort algorithm to calculate the correct z-index values.
4
+ */
5
+ export declare class ZIndexRegistry {
6
+ private dependencies;
7
+ private zIndexes;
8
+ private nodes;
9
+ private baseZIndex;
10
+ private step;
11
+ /**
12
+ * @param baseZIndex The starting z-index value. Default is 10.
13
+ * @param step The distance between z-index values. Default is 10.
14
+ */
15
+ constructor({ baseZIndex, step }?: {
16
+ baseZIndex?: number | undefined;
17
+ step?: number | undefined;
18
+ });
19
+ /**
20
+ * Register a stacking relationship between two components.
21
+ * @param belowId The ID of the component below.
22
+ * @param aboveId The ID of the component above.
23
+ */
24
+ register(belowId: string, aboveId: string): void;
25
+ /**
26
+ * Deregister a stacking relationship that already exists.
27
+ * This is useful when you need to override or insert a layer between two default layers.
28
+ * @param belowId The ID of the component below in the relationship to delete.
29
+ * @param aboveId The ID of the component above in the relationship to delete.
30
+ * @example
31
+ * // Assume the default is: registry.register('Tooltip', 'Modal');
32
+ * // Now we want to insert 'MyLayer' in between.
33
+ *
34
+ * // 1. Delete the old relationship
35
+ * registry.deregister('Tooltip', 'Modal');
36
+ *
37
+ * // 2. Add new relationships
38
+ * registry.register('Tooltip', 'MyLayer');
39
+ * registry.register('MyLayer', 'Modal');
40
+ */
41
+ deregister(belowId: string, aboveId: string): void;
42
+ /**
43
+ * Get the z-index for a registered component.
44
+ * If the z-index has not been calculated, it will perform a topological sort.
45
+ * @param id The ID of the component.
46
+ * @returns The calculated z-index.
47
+ */
48
+ getZIndex(id: string): number;
49
+ /**
50
+ * Perform a topological sort and calculate all the z-index values.
51
+ * @private
52
+ */
53
+ private _calculateZIndexes;
54
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aic-kits/react",
3
- "version": "0.28.7",
3
+ "version": "0.29.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -28,8 +28,10 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@phosphor-icons/react": "^2.1.7",
31
+ "@types/ua-parser-js": "^0.7.39",
31
32
  "@vimeo/player": "^2.27.1",
32
- "lodash": "^4.17.21"
33
+ "lodash": "^4.17.21",
34
+ "ua-parser-js": "^2.0.3"
33
35
  },
34
36
  "peerDependencies": {
35
37
  "react": "^19.0.0",
@@ -53,5 +55,5 @@
53
55
  "vite-plugin-dts": "^4.3.0",
54
56
  "vitest": "^2.1.8"
55
57
  },
56
- "gitHead": "851c22aea09486d3f0a2ded184a5a635b66e576a"
58
+ "gitHead": "671061b5b8a901f3b9e55036721bfc0e81df33fa"
57
59
  }