@gridui/overlay 1.0.0 → 1.1.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.
package/README.md CHANGED
@@ -1,8 +1,22 @@
1
1
  # @gridui/overlay
2
2
 
3
- Core family. Public API: `OverlayOpen`, `RetainedLayer`, `RetainedLayerProps`, `useOverlayState`.
3
+ Core family. Public API: `OverlayOpen`, `RetainedLayer`, `RetainedLayerProps`, `useOverlayState`, `overlaySurfaceStyles`, `overlayBackdropStyles`.
4
4
 
5
5
  Import components from `@gridui/overlay` and load `@gridui/overlay/styles.css` after Theme.
6
6
  Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
7
7
 
8
- See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
8
+ See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/overlay/.changeset/history).
9
+
10
+ ## Surface presentation
11
+
12
+ `overlaySurfaceStyles({ kind })` shares the surface border, colors, motion, and
13
+ reduced-motion behavior. `kind` is `popup` (default), `tooltip`, or `dialog`.
14
+ `overlayBackdropStyles({ pace })` shares backdrop fades at `normal` (default)
15
+ or `deliberate` pace. Load this stylesheet before the consuming family.
16
+
17
+ Each family maps its own positioning origin to `--gridui-overlay-origin`.
18
+ Popup motion follows `data-side`; `data-side="none"` disables surface motion for
19
+ item-aligned Select. Open/closed and Tooltip's instant/delayed open states are
20
+ supported. Families keep dimensions, stacking, positioning, portals, focus,
21
+ and dismissal. Drawer retains its directional panel motion and uses only the
22
+ shared backdrop. Theme continues to own motion tokens and keyframes.
package/dist/index.d.ts CHANGED
@@ -7,4 +7,5 @@
7
7
  export type { RetainedLayerProps } from "./retained-layer/retained-layer";
8
8
  export { OverlayOpen } from "./retained-layer/retained-layer";
9
9
  export { RetainedLayer } from "./retained-layer/retained-layer";
10
+ export { overlayBackdropStyles, overlaySurfaceStyles } from "./shared/style";
10
11
  export { useOverlayState } from "./shared/use-overlay-state";
package/dist/index.js CHANGED
@@ -14,6 +14,28 @@ var RetainedLayer = (props) => {
14
14
  );
15
15
  };
16
16
 
17
+ // src/shared/style.ts
18
+ import { cva } from "class-variance-authority";
19
+ var overlaySurfaceStyles = cva("gridui-overlay-surface gridui-u-border gridui-u-border-solid gridui-u-border-border gridui-u-bg-background gridui-u-text-foreground", {
20
+ variants: {
21
+ kind: {
22
+ popup: "gridui-overlay-floating gridui-u-rounded-control",
23
+ tooltip: "gridui-overlay-tooltip gridui-u-rounded-control",
24
+ dialog: "gridui-overlay-dialog"
25
+ }
26
+ },
27
+ defaultVariants: { kind: "popup" }
28
+ });
29
+ var overlayBackdropStyles = cva("gridui-overlay-backdrop", {
30
+ variants: {
31
+ pace: {
32
+ normal: null,
33
+ deliberate: "gridui-overlay-backdrop-deliberate"
34
+ }
35
+ },
36
+ defaultVariants: { pace: "normal" }
37
+ });
38
+
17
39
  // src/shared/use-overlay-state.ts
18
40
  import { useState } from "react";
19
41
  var useOverlayState = (options) => {
@@ -34,6 +56,8 @@ var useOverlayState = (options) => {
34
56
  export {
35
57
  OverlayOpen,
36
58
  RetainedLayer,
59
+ overlayBackdropStyles,
60
+ overlaySurfaceStyles,
37
61
  useOverlayState
38
62
  };
39
63
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/retained-layer/retained-layer.tsx", "../src/shared/use-overlay-state.ts"],
4
- "sourcesContent": ["/**\n * @author WMXPY\n * @package Overlay\n * @namespace RetainedLayer\n * @description Retained Layer\n */\n\nimport { Activity, createContext, type FC, type ReactNode, useContext } from \"react\";\n\nexport const OverlayOpen = createContext(false);\n\nexport type RetainedLayerProps = {\n readonly children: ReactNode;\n};\n\nexport const RetainedLayer: FC<RetainedLayerProps> = (props: RetainedLayerProps) => {\n const { children } = props;\n const open = useContext(OverlayOpen);\n return (<Activity\n mode={!open ? \"hidden\" : \"visible\"}\n >\n {children}\n </Activity>);\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Use Overlay State\n */\n\nimport { useState } from \"react\";\n\ntype OverlayStateOptions = {\n readonly open?: boolean | undefined;\n readonly defaultOpen?: boolean | undefined;\n readonly onOpenChange?: ((open: boolean) => void) | undefined;\n};\n\nexport const useOverlayState = (options: OverlayStateOptions) => {\n const [\n localOpen,\n setLocalOpen,\n ] = useState(options.defaultOpen ?? false);\n return {\n open: options.open ?? localOpen,\n onOpenChange: (open: boolean): void => {\n if (options.open === undefined) {\n setLocalOpen(open);\n }\n options.onOpenChange?.(open);\n },\n };\n};\n"],
5
- "mappings": ";AAOA,SAAS,UAAU,eAAwC,kBAAkB;AAWjE;AATL,IAAM,cAAc,cAAc,KAAK;AAMvC,IAAM,gBAAwC,CAAC,UAA8B;AAChF,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,OAAO,WAAW,WAAW;AACnC,SAAQ;AAAA,IAAC;AAAA;AAAA,MACL,MAAM,CAAC,OAAO,WAAW;AAAA,MAExB;AAAA;AAAA,EACL;AACJ;;;AChBA,SAAS,gBAAgB;AAQlB,IAAM,kBAAkB,CAAC,YAAiC;AAC7D,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,QAAQ,eAAe,KAAK;AACzC,SAAO;AAAA,IACH,MAAM,QAAQ,QAAQ;AAAA,IACtB,cAAc,CAAC,SAAwB;AACnC,UAAI,QAAQ,SAAS,QAAW;AAC5B,qBAAa,IAAI;AAAA,MACrB;AACA,cAAQ,eAAe,IAAI;AAAA,IAC/B;AAAA,EACJ;AACJ;",
3
+ "sources": ["../src/retained-layer/retained-layer.tsx", "../src/shared/style.ts", "../src/shared/use-overlay-state.ts"],
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package Overlay\n * @namespace RetainedLayer\n * @description Retained Layer\n */\n\nimport { Activity, createContext, type FC, type ReactNode, useContext } from \"react\";\n\nexport const OverlayOpen = createContext(false);\n\nexport type RetainedLayerProps = {\n readonly children: ReactNode;\n};\n\nexport const RetainedLayer: FC<RetainedLayerProps> = (props: RetainedLayerProps) => {\n const { children } = props;\n const open = useContext(OverlayOpen);\n return (<Activity\n mode={!open ? \"hidden\" : \"visible\"}\n >\n {children}\n </Activity>);\n};\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const overlaySurfaceStyles = cva(\"gridui-overlay-surface gridui-u-border gridui-u-border-solid gridui-u-border-border gridui-u-bg-background gridui-u-text-foreground\", {\n variants: {\n kind: {\n popup: \"gridui-overlay-floating gridui-u-rounded-control\",\n tooltip: \"gridui-overlay-tooltip gridui-u-rounded-control\",\n dialog: \"gridui-overlay-dialog\",\n },\n },\n defaultVariants: { kind: \"popup\" },\n});\n\nexport const overlayBackdropStyles = cva(\"gridui-overlay-backdrop\", {\n variants: {\n pace: {\n normal: null,\n deliberate: \"gridui-overlay-backdrop-deliberate\",\n },\n },\n defaultVariants: { pace: \"normal\" },\n});\n", "/**\n * @author WMXPY\n * @package Overlay\n * @namespace Shared\n * @description Use Overlay State\n */\n\nimport { useState } from \"react\";\n\ntype OverlayStateOptions = {\n readonly open?: boolean | undefined;\n readonly defaultOpen?: boolean | undefined;\n readonly onOpenChange?: ((open: boolean) => void) | undefined;\n};\n\nexport const useOverlayState = (options: OverlayStateOptions) => {\n const [\n localOpen,\n setLocalOpen,\n ] = useState(options.defaultOpen ?? false);\n return {\n open: options.open ?? localOpen,\n onOpenChange: (open: boolean): void => {\n if (options.open === undefined) {\n setLocalOpen(open);\n }\n options.onOpenChange?.(open);\n },\n };\n};\n"],
5
+ "mappings": ";AAOA,SAAS,UAAU,eAAwC,kBAAkB;AAWjE;AATL,IAAM,cAAc,cAAc,KAAK;AAMvC,IAAM,gBAAwC,CAAC,UAA8B;AAChF,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,OAAO,WAAW,WAAW;AACnC,SAAQ;AAAA,IAAC;AAAA;AAAA,MACL,MAAM,CAAC,OAAO,WAAW;AAAA,MAExB;AAAA;AAAA,EACL;AACJ;;;AChBA,SAAS,WAAW;AAEb,IAAM,uBAAuB,IAAI,uIAAuI;AAAA,EAC3K,UAAU;AAAA,IACN,MAAM;AAAA,MACF,OAAO;AAAA,MACP,SAAS;AAAA,MACT,QAAQ;AAAA,IACZ;AAAA,EACJ;AAAA,EACA,iBAAiB,EAAE,MAAM,QAAQ;AACrC,CAAC;AAEM,IAAM,wBAAwB,IAAI,2BAA2B;AAAA,EAChE,UAAU;AAAA,IACN,MAAM;AAAA,MACF,QAAQ;AAAA,MACR,YAAY;AAAA,IAChB;AAAA,EACJ;AAAA,EACA,iBAAiB,EAAE,MAAM,SAAS;AACtC,CAAC;;;ACrBD,SAAS,gBAAgB;AAQlB,IAAM,kBAAkB,CAAC,YAAiC;AAC7D,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,QAAQ,eAAe,KAAK;AACzC,SAAO;AAAA,IACH,MAAM,QAAQ,QAAQ;AAAA,IACtB,cAAc,CAAC,SAAwB;AACnC,UAAI,QAAQ,SAAS,QAAW;AAC5B,qBAAa,IAAI;AAAA,MACrB;AACA,cAAQ,eAAe,IAAI;AAAA,IAC/B;AAAA,EACJ;AACJ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Overlay
4
+ * @namespace Shared
5
+ * @description Style
6
+ */
7
+ export declare const overlaySurfaceStyles: (props?: ({
8
+ kind?: "popup" | "tooltip" | "dialog" | null | undefined;
9
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
+ export declare const overlayBackdropStyles: (props?: ({
11
+ pace?: "normal" | "deliberate" | null | undefined;
12
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
package/dist/styles.css CHANGED
@@ -1,10 +1,95 @@
1
1
  /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
2
3
  @layer theme, base, components, utilities;
3
4
  @layer utilities {
4
- .visible {
5
- visibility: visible;
5
+ .gridui-u-rounded-control {
6
+ border-radius: var(--gridui-control-radius);
6
7
  }
7
- .hidden {
8
- display: none;
8
+ .gridui-u-border {
9
+ border-style: var(--tw-border-style);
10
+ border-width: 1px;
11
+ }
12
+ .gridui-u-border-solid {
13
+ --tw-border-style: solid;
14
+ border-style: solid;
15
+ }
16
+ .gridui-u-border-border {
17
+ border-color: var(--gridui-border);
18
+ }
19
+ .gridui-u-bg-background {
20
+ background-color: var(--gridui-background);
21
+ }
22
+ .gridui-u-text-foreground {
23
+ color: var(--gridui-foreground);
24
+ }
25
+ }
26
+ @layer components {
27
+ .gridui-overlay-surface {
28
+ --gridui-surface-offset-x: 0px;
29
+ --gridui-surface-offset-y: 0px;
30
+ --gridui-overlay-enter-duration: var(--gridui-motion-duration-normal);
31
+ --gridui-overlay-fill-mode: both;
32
+ transform-origin: var(--gridui-overlay-origin, center);
33
+ }
34
+ .gridui-overlay-dialog {
35
+ --gridui-overlay-fill-mode: none;
36
+ transform-origin: center;
37
+ }
38
+ .gridui-overlay-tooltip {
39
+ --gridui-overlay-enter-duration: var(--gridui-motion-duration-quick);
40
+ }
41
+ .gridui-overlay-floating[data-side="bottom"] {
42
+ --gridui-surface-offset-y: calc(-1 * var(--gridui-motion-distance));
43
+ }
44
+ .gridui-overlay-floating[data-side="top"] {
45
+ --gridui-surface-offset-y: var(--gridui-motion-distance);
46
+ }
47
+ .gridui-overlay-floating[data-side="left"] {
48
+ --gridui-surface-offset-x: var(--gridui-motion-distance);
49
+ }
50
+ .gridui-overlay-floating[data-side="right"] {
51
+ --gridui-surface-offset-x: calc(-1 * var(--gridui-motion-distance));
52
+ }
53
+ .gridui-overlay-surface[data-state="closed"] {
54
+ pointer-events: none;
55
+ }
56
+ .gridui-overlay-surface:not([data-side="none"]):is([data-state="open"], [data-state="delayed-open"], [data-state="instant-open"]) {
57
+ animation: gridui-surface-enter var(--gridui-overlay-enter-duration) var(--gridui-motion-ease-out) var(--gridui-overlay-fill-mode);
58
+ }
59
+ .gridui-overlay-surface:not([data-side="none"])[data-state="closed"] {
60
+ animation: gridui-surface-exit var(--gridui-motion-duration-quick) var(--gridui-motion-ease-in) var(--gridui-overlay-fill-mode);
61
+ }
62
+ .gridui-overlay-backdrop {
63
+ --gridui-overlay-enter-duration: var(--gridui-motion-duration-normal);
64
+ --gridui-overlay-exit-duration: var(--gridui-motion-duration-quick);
65
+ --gridui-overlay-fill-mode: none;
66
+ }
67
+ .gridui-overlay-backdrop-deliberate {
68
+ --gridui-overlay-enter-duration: var(--gridui-motion-duration-deliberate);
69
+ --gridui-overlay-exit-duration: var(--gridui-motion-duration-normal);
70
+ --gridui-overlay-fill-mode: both;
71
+ }
72
+ .gridui-overlay-backdrop[data-state="open"] {
73
+ animation: gridui-fade-enter var(--gridui-overlay-enter-duration) var(--gridui-motion-ease-out) var(--gridui-overlay-fill-mode);
74
+ }
75
+ .gridui-overlay-backdrop[data-state="closed"] {
76
+ animation: gridui-fade-exit var(--gridui-overlay-exit-duration) var(--gridui-motion-ease-in) var(--gridui-overlay-fill-mode);
77
+ }
78
+ @media (prefers-reduced-motion: reduce) {
79
+ .gridui-overlay-surface:not([data-side="none"])[data-state], .gridui-overlay-backdrop[data-state] {
80
+ animation: none;
81
+ }
82
+ }
83
+ }
84
+ @property --tw-border-style {
85
+ syntax: "*";
86
+ inherits: false;
87
+ initial-value: solid;
88
+ }
89
+ @layer properties {
90
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
91
+ *, ::before, ::after, ::backdrop {
92
+ --tw-border-style: solid;
93
+ }
9
94
  }
10
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridui/overlay",
3
- "version": "1.0.0",
3
+ "version": "1.1.2",
4
4
  "description": "GridUI React overlay",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -26,13 +26,14 @@
26
26
  "react-dom": "^19.2.0"
27
27
  },
28
28
  "dependencies": {
29
- "@gridui/theme": "^2.1.2"
29
+ "@gridui/theme": "^2.3.2",
30
+ "class-variance-authority": "0.7.1"
30
31
  },
31
32
  "devDependencies": {
32
- "@gridui-internal/configuration": "0.0.0",
33
+ "@gridui-internal/configuration": "0.0.0-internal",
33
34
  "@jest/globals": "30.5.2",
34
35
  "@types/jest": "30.0.0",
35
- "@types/node": "26.6.5",
36
+ "@types/node": "26.6.6",
36
37
  "@types/react": "19.3.0",
37
38
  "@types/react-dom": "19.3.0",
38
39
  "jest": "30.5.2",