@tryghost/shade 0.1.0-alpha.47 → 0.1.0-alpha.49

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 (73) hide show
  1. package/README.md +7 -2
  2. package/es/app.js +2 -1
  3. package/es/components/page-templates/list-page.js +1 -1
  4. package/es/components/page-templates/list-page.js.map +1 -1
  5. package/es/components/patterns/color-picker.js +79 -56
  6. package/es/components/patterns/color-picker.js.map +1 -1
  7. package/es/components/patterns/page-header.js +1 -1
  8. package/es/components/patterns/page-header.js.map +1 -1
  9. package/es/components/ui/alert-dialog.js +22 -10
  10. package/es/components/ui/alert-dialog.js.map +1 -1
  11. package/es/components/ui/context-menu.js +18 -8
  12. package/es/components/ui/context-menu.js.map +1 -1
  13. package/es/components/ui/dialog.js +39 -23
  14. package/es/components/ui/dialog.js.map +1 -1
  15. package/es/components/ui/dropdown-menu.js +20 -10
  16. package/es/components/ui/dropdown-menu.js.map +1 -1
  17. package/es/components/ui/floating-sidebar.js +20 -2
  18. package/es/components/ui/floating-sidebar.js.map +1 -1
  19. package/es/components/ui/hover-card.js +13 -7
  20. package/es/components/ui/hover-card.js.map +1 -1
  21. package/es/components/ui/popover.js +14 -8
  22. package/es/components/ui/popover.js.map +1 -1
  23. package/es/components/ui/select.js +25 -15
  24. package/es/components/ui/select.js.map +1 -1
  25. package/es/components/ui/sheet.js +29 -18
  26. package/es/components/ui/sheet.js.map +1 -1
  27. package/es/components/ui/sortable-list.js +105 -10
  28. package/es/components/ui/sortable-list.js.map +1 -1
  29. package/es/components/ui/sticky-footer.js +7 -4
  30. package/es/components/ui/sticky-footer.js.map +1 -1
  31. package/es/components/ui/tooltip.js +81 -31
  32. package/es/components/ui/tooltip.js.map +1 -1
  33. package/es/components.js +1 -1
  34. package/es/index.js +1 -1
  35. package/es/lib/app-overlay.js +151 -0
  36. package/es/lib/app-overlay.js.map +1 -0
  37. package/es/lib/safe-area.js +168 -0
  38. package/es/lib/safe-area.js.map +1 -0
  39. package/es/providers/shade-provider.js +9 -1
  40. package/es/providers/shade-provider.js.map +1 -1
  41. package/es/shade-app.js +16 -4
  42. package/es/shade-app.js.map +1 -1
  43. package/package.json +1 -1
  44. package/styles.css +17 -0
  45. package/types/app.d.ts +2 -0
  46. package/types/app.d.ts.map +1 -1
  47. package/types/components/patterns/color-picker.d.ts +5 -0
  48. package/types/components/patterns/color-picker.d.ts.map +1 -1
  49. package/types/components/ui/alert-dialog.d.ts +1 -1
  50. package/types/components/ui/alert-dialog.d.ts.map +1 -1
  51. package/types/components/ui/context-menu.d.ts +1 -1
  52. package/types/components/ui/context-menu.d.ts.map +1 -1
  53. package/types/components/ui/dialog.d.ts +1 -1
  54. package/types/components/ui/dialog.d.ts.map +1 -1
  55. package/types/components/ui/dropdown-menu.d.ts +1 -1
  56. package/types/components/ui/dropdown-menu.d.ts.map +1 -1
  57. package/types/components/ui/floating-sidebar.d.ts.map +1 -1
  58. package/types/components/ui/hover-card.d.ts.map +1 -1
  59. package/types/components/ui/popover.d.ts.map +1 -1
  60. package/types/components/ui/select.d.ts.map +1 -1
  61. package/types/components/ui/sheet.d.ts +1 -1
  62. package/types/components/ui/sheet.d.ts.map +1 -1
  63. package/types/components/ui/sortable-list.d.ts +4 -1
  64. package/types/components/ui/sortable-list.d.ts.map +1 -1
  65. package/types/components/ui/sticky-footer.d.ts.map +1 -1
  66. package/types/components/ui/tooltip.d.ts.map +1 -1
  67. package/types/lib/app-overlay.d.ts +58 -0
  68. package/types/lib/app-overlay.d.ts.map +1 -0
  69. package/types/lib/safe-area.d.ts +27 -0
  70. package/types/lib/safe-area.d.ts.map +1 -0
  71. package/types/providers/shade-provider.d.ts.map +1 -1
  72. package/types/shade-app.d.ts +3 -0
  73. package/types/shade-app.d.ts.map +1 -1
@@ -0,0 +1,151 @@
1
+ import { hasSafeArea } from "./safe-area.js";
2
+ import * as React$1 from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/lib/app-overlay.tsx
5
+ var OVERLAY_TINTS = {
6
+ dialog: "bg-black/30 dark:bg-black/60",
7
+ sheet: "bg-black/10"
8
+ };
9
+ /** A modal's tint classes. Admin draws the same tint behind an app's dialogs and sheets. */
10
+ var overlayTint = (tint) => OVERLAY_TINTS[tint];
11
+ /**
12
+ * Centres a dialog on the window, moved only as far as it must to stay inside the safe area.
13
+ * One wider than the safe area is centred on it instead.
14
+ */
15
+ var SAFE_AREA_DIALOG_X = "w-[calc(100%_-_var(--ghost-safe-area-inset-left,0px)_-_var(--ghost-safe-area-inset-right,0px))] translate-x-[calc(-50%_+_clamp(min(var(--ghost-safe-area-inset-left,0px)_-_50vw_+_50%,(var(--ghost-safe-area-inset-left,0px)_-_var(--ghost-safe-area-inset-right,0px))/2),0px,max(50vw_-_var(--ghost-safe-area-inset-right,0px)_-_50%,(var(--ghost-safe-area-inset-left,0px)_-_var(--ghost-safe-area-inset-right,0px))/2)))]";
16
+ var SAFE_AREA_DIALOG_HEIGHT = "max-h-[calc(100dvh_-_var(--ghost-safe-area-inset-top,0px)_-_var(--ghost-safe-area-inset-bottom,0px)_-_1rem)] overflow-y-auto";
17
+ var AppOverlayContext = React$1.createContext(void 0);
18
+ /** Content portalled from a hosted dialog renders in the overlay too, above the dialog. */
19
+ var PortalContainerContext = React$1.createContext(void 0);
20
+ var ModalStateContext = React$1.createContext(void 0);
21
+ /**
22
+ * Wraps a Radix dialog `Root`'s props so its content re-renders when it opens, even from its own
23
+ * trigger, and can then decide whether to render in the overlay. Radix re-renders only its
24
+ * portal, and doesn't expose `modal` to the content.
25
+ */
26
+ function useModalOpen(props) {
27
+ const { open, defaultOpen, onOpenChange, modal = true } = props;
28
+ const [uncontrolled, setUncontrolled] = React$1.useState(defaultOpen ?? false);
29
+ const isOpen = open ?? uncontrolled;
30
+ const handleOpenChange = React$1.useCallback((next) => {
31
+ setUncontrolled(next);
32
+ onOpenChange?.(next);
33
+ }, [onOpenChange]);
34
+ const state = React$1.useMemo(() => ({
35
+ open: isOpen,
36
+ modal
37
+ }), [isOpen, modal]);
38
+ const provide = React$1.useCallback((children) => /* @__PURE__ */ jsx(ModalStateContext.Provider, {
39
+ value: state,
40
+ children
41
+ }), [state]);
42
+ return [{
43
+ ...props,
44
+ onOpenChange: handleOpenChange
45
+ }, provide];
46
+ }
47
+ /** The container for a Radix `Portal`: the overlay inside a hosted dialog, else the default. */
48
+ var usePortalContainer = () => React$1.useContext(PortalContainerContext);
49
+ function setRef(ref, value) {
50
+ if (typeof ref === "function") ref(value);
51
+ else if (ref) ref.current = value;
52
+ }
53
+ /**
54
+ * Transparent so Admin's tint shows through, but still there so a press beside the dialog closes
55
+ * it. A style rather than a class, to override the overlay's colour in either theme.
56
+ */
57
+ var HOSTED_OVERLAY_STYLE = { background: "transparent" };
58
+ /**
59
+ * Renders a dialog, alert dialog or sheet in the app's overlay when there is one, holding the
60
+ * overlay while its content is mounted.
61
+ */
62
+ function useHostedModal(tint, forwardedRef) {
63
+ const overlay = React$1.useContext(AppOverlayContext);
64
+ const inherited = usePortalContainer();
65
+ const state = React$1.useContext(ModalStateContext);
66
+ const open = state?.open;
67
+ const modal = state?.modal ?? true;
68
+ const place = () => modal ? overlay?.container() : void 0;
69
+ const [placed, setPlaced] = React$1.useState(() => ({
70
+ open,
71
+ container: open === false ? void 0 : place()
72
+ }));
73
+ let placement = placed;
74
+ if (open === void 0) placement = {
75
+ ...placed,
76
+ container: place()
77
+ };
78
+ else if (open !== placed.open) {
79
+ placement = open && !placed.open ? {
80
+ open,
81
+ container: place()
82
+ } : {
83
+ ...placed,
84
+ open
85
+ };
86
+ setPlaced(placement);
87
+ }
88
+ const { container } = placement;
89
+ const hosted = modal && container !== void 0;
90
+ const latest = React$1.useRef({
91
+ overlay,
92
+ hosted,
93
+ tint
94
+ });
95
+ React$1.useInsertionEffect(() => {
96
+ latest.current = {
97
+ overlay,
98
+ hosted,
99
+ tint
100
+ };
101
+ });
102
+ const content = React$1.useRef(null);
103
+ const attached = React$1.useRef(forwardedRef);
104
+ React$1.useLayoutEffect(() => {
105
+ if (attached.current !== forwardedRef) {
106
+ if (content.current) {
107
+ setRef(attached.current, null);
108
+ setRef(forwardedRef, content.current);
109
+ }
110
+ attached.current = forwardedRef;
111
+ }
112
+ }, [forwardedRef]);
113
+ const cleanup = React$1.useRef(void 0);
114
+ const ref = React$1.useCallback((element) => {
115
+ const current = latest.current;
116
+ content.current = element;
117
+ setRef(attached.current, element);
118
+ cleanup.current?.();
119
+ cleanup.current = void 0;
120
+ if (!element || !current.overlay || !current.hosted) return;
121
+ const hold = current.overlay.hold(current.tint, element);
122
+ const sync = () => hold.setOpen(element.getAttribute("data-state") === "open");
123
+ sync();
124
+ const observer = new ((element.ownerDocument.defaultView?.MutationObserver) ?? MutationObserver)(sync);
125
+ observer.observe(element, {
126
+ attributes: true,
127
+ attributeFilter: ["data-state"]
128
+ });
129
+ cleanup.current = () => {
130
+ observer.disconnect();
131
+ hold.release();
132
+ };
133
+ }, []);
134
+ const wrap = React$1.useCallback((children) => hosted ? /* @__PURE__ */ jsx(PortalContainerContext.Provider, {
135
+ value: container,
136
+ children
137
+ }) : children, [hosted, container]);
138
+ const portal = modal ? container : inherited;
139
+ return {
140
+ container: portal,
141
+ inApp: hasSafeArea(portal),
142
+ modal,
143
+ overlayStyle: hosted ? HOSTED_OVERLAY_STYLE : void 0,
144
+ ref,
145
+ wrap
146
+ };
147
+ }
148
+ //#endregion
149
+ export { AppOverlayContext, SAFE_AREA_DIALOG_HEIGHT, SAFE_AREA_DIALOG_X, overlayTint, useHostedModal, useModalOpen, usePortalContainer };
150
+
151
+ //# sourceMappingURL=app-overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-overlay.js","names":[],"sources":["../../src/lib/app-overlay.tsx"],"sourcesContent":["import * as React from 'react';\nimport { hasSafeArea } from '@/lib/safe-area';\n\nexport type AppOverlayTint = 'dialog' | 'sheet';\n\nconst OVERLAY_TINTS: Record<AppOverlayTint, string> = {\n dialog: 'bg-black/30 dark:bg-black/60',\n sheet: 'bg-black/10',\n};\n\n/** A modal's tint classes. Admin draws the same tint behind an app's dialogs and sheets. */\nexport const overlayTint = (tint: AppOverlayTint) => OVERLAY_TINTS[tint];\n\n/**\n * Centres a dialog on the window, moved only as far as it must to stay inside the safe area.\n * One wider than the safe area is centred on it instead.\n */\nexport const SAFE_AREA_DIALOG_X =\n 'w-[calc(100%_-_var(--ghost-safe-area-inset-left,0px)_-_var(--ghost-safe-area-inset-right,0px))] translate-x-[calc(-50%_+_clamp(min(var(--ghost-safe-area-inset-left,0px)_-_50vw_+_50%,(var(--ghost-safe-area-inset-left,0px)_-_var(--ghost-safe-area-inset-right,0px))/2),0px,max(50vw_-_var(--ghost-safe-area-inset-right,0px)_-_50%,(var(--ghost-safe-area-inset-left,0px)_-_var(--ghost-safe-area-inset-right,0px))/2)))]';\n\nexport const SAFE_AREA_DIALOG_HEIGHT =\n 'max-h-[calc(100dvh_-_var(--ghost-safe-area-inset-top,0px)_-_var(--ghost-safe-area-inset-bottom,0px)_-_1rem)] overflow-y-auto';\n\n/** A dialog or sheet's hold on the overlay, from when it mounts until it unmounts. */\nexport interface AppOverlayHold {\n /** True once the dialog opens, false as soon as it starts to close. */\n setOpen(open: boolean): void;\n /** Called after the dialog's closing animation, once it has unmounted. */\n release(): void;\n}\n\n/**\n * Where an app's dialogs and sheets render, so they cover all of Admin rather than only the\n * app's frame. Pass the app SDK's `ghost.overlay` to `ShadeApp` as `overlay`.\n */\nexport interface AppOverlay {\n /** The element to render into, or undefined to render in the page. */\n container(): HTMLElement | undefined;\n /** Called with the dialog's content element as it mounts. */\n hold(tint: AppOverlayTint, element: HTMLElement): AppOverlayHold;\n}\n\nexport const AppOverlayContext = React.createContext<AppOverlay | undefined>(undefined);\n\n/** Content portalled from a hosted dialog renders in the overlay too, above the dialog. */\nconst PortalContainerContext = React.createContext<HTMLElement | undefined>(undefined);\n\nconst ModalStateContext = React.createContext<{ open: boolean; modal: boolean } | undefined>(\n undefined,\n);\n\ninterface OpenProps {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n modal?: boolean;\n}\n\n/**\n * Wraps a Radix dialog `Root`'s props so its content re-renders when it opens, even from its own\n * trigger, and can then decide whether to render in the overlay. Radix re-renders only its\n * portal, and doesn't expose `modal` to the content.\n */\nexport function useModalOpen<P extends OpenProps>(\n props: P,\n): [P, (children: React.ReactNode) => React.ReactNode] {\n const { open, defaultOpen, onOpenChange, modal = true } = props;\n const [uncontrolled, setUncontrolled] = React.useState(defaultOpen ?? false);\n const isOpen = open ?? uncontrolled;\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolled(next);\n onOpenChange?.(next);\n },\n [onOpenChange],\n );\n const state = React.useMemo(() => ({ open: isOpen, modal }), [isOpen, modal]);\n const provide = React.useCallback(\n (children: React.ReactNode) => (\n <ModalStateContext.Provider value={state}>{children}</ModalStateContext.Provider>\n ),\n [state],\n );\n return [{ ...props, onOpenChange: handleOpenChange }, provide];\n}\n\n/** The container for a Radix `Portal`: the overlay inside a hosted dialog, else the default. */\nexport const usePortalContainer = () => React.useContext(PortalContainerContext);\n\nfunction setRef<T>(ref: React.Ref<T> | undefined, value: T | null) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n}\n\n/**\n * Transparent so Admin's tint shows through, but still there so a press beside the dialog closes\n * it. A style rather than a class, to override the overlay's colour in either theme.\n */\nconst HOSTED_OVERLAY_STYLE: React.CSSProperties = { background: 'transparent' };\n\ninterface Placement {\n open: boolean | undefined;\n container: HTMLElement | undefined;\n}\n\ninterface HostedModal<T extends HTMLElement> {\n /** The overlay when the dialog renders there, or a non-modal one opens from a dialog there. */\n container: HTMLElement | undefined;\n inApp: boolean;\n modal: boolean;\n overlayStyle: React.CSSProperties | undefined;\n ref: React.RefCallback<T>;\n wrap: (children: React.ReactNode) => React.ReactNode;\n}\n\n/**\n * Renders a dialog, alert dialog or sheet in the app's overlay when there is one, holding the\n * overlay while its content is mounted.\n */\nexport function useHostedModal<T extends HTMLElement>(\n tint: AppOverlayTint,\n forwardedRef: React.Ref<T>,\n): HostedModal<T> {\n const overlay = React.useContext(AppOverlayContext);\n const inherited = usePortalContainer();\n const state = React.useContext(ModalStateContext);\n const open = state?.open;\n const modal = state?.modal ?? true;\n // Decided as the dialog opens and kept while it closes: moving it would remount the content.\n // Outside Shade's dialog roots `open` is undefined, so it decides on each render.\n const place = () => (modal ? overlay?.container() : undefined);\n const [placed, setPlaced] = React.useState<Placement>(() => ({\n open,\n container: open === false ? undefined : place(),\n }));\n let placement = placed;\n if (open === undefined) {\n placement = { ...placed, container: place() };\n } else if (open !== placed.open) {\n placement = open && !placed.open ? { open, container: place() } : { ...placed, open };\n setPlaced(placement);\n }\n const { container } = placement;\n const hosted = modal && container !== undefined;\n\n // The ref must stay stable: a new one makes React reattach the content, releasing the hold.\n // The insertion effect stores this render's decision before React attaches the content.\n const latest = React.useRef({ overlay, hosted, tint });\n React.useInsertionEffect(() => {\n latest.current = { overlay, hosted, tint };\n });\n // Hands the element over when the caller's ref changes, as React would.\n const content = React.useRef<T | null>(null);\n const attached = React.useRef(forwardedRef);\n React.useLayoutEffect(() => {\n if (attached.current !== forwardedRef) {\n if (content.current) {\n setRef(attached.current, null);\n setRef(forwardedRef, content.current);\n }\n attached.current = forwardedRef;\n }\n }, [forwardedRef]);\n const cleanup = React.useRef<() => void>(undefined);\n const ref = React.useCallback((element: T | null) => {\n const current = latest.current;\n content.current = element;\n setRef(attached.current, element);\n cleanup.current?.();\n cleanup.current = undefined;\n if (!element || !current.overlay || !current.hosted) {\n return;\n }\n const hold = current.overlay.hold(current.tint, element);\n const sync = () => hold.setOpen(element.getAttribute('data-state') === 'open');\n sync();\n // The element lives in the overlay's document, so use that window's constructor.\n const Observer = element.ownerDocument.defaultView?.MutationObserver ?? MutationObserver;\n const observer = new Observer(sync);\n observer.observe(element, { attributes: true, attributeFilter: ['data-state'] });\n cleanup.current = () => {\n observer.disconnect();\n hold.release();\n };\n }, []);\n\n const wrap = React.useCallback(\n (children: React.ReactNode) =>\n hosted ? (\n <PortalContainerContext.Provider value={container}>\n {children}\n </PortalContainerContext.Provider>\n ) : (\n children\n ),\n [hosted, container],\n );\n\n const portal = modal ? container : inherited;\n return {\n container: portal,\n inApp: hasSafeArea(portal),\n modal,\n overlayStyle: hosted ? HOSTED_OVERLAY_STYLE : undefined,\n ref,\n wrap,\n };\n}\n"],"mappings":";;;;AAKA,IAAM,gBAAgD;CACpD,QAAQ;CACR,OAAO;AACT;;AAGA,IAAa,eAAe,SAAyB,cAAc;;;;;AAMnE,IAAa,qBACX;AAEF,IAAa,0BACX;AAqBF,IAAa,oBAAoB,QAAM,cAAsC,KAAA,CAAS;;AAGtF,IAAM,yBAAyB,QAAM,cAAuC,KAAA,CAAS;AAErF,IAAM,oBAAoB,QAAM,cAC9B,KAAA,CACF;;;;;;AAcA,SAAgB,aACd,OACqD;CACrD,MAAM,EAAE,MAAM,aAAa,cAAc,QAAQ,SAAS;CAC1D,MAAM,CAAC,cAAc,mBAAmB,QAAM,SAAS,eAAe,KAAK;CAC3E,MAAM,SAAS,QAAQ;CACvB,MAAM,mBAAmB,QAAM,aAC5B,SAAkB;EACjB,gBAAgB,IAAI;EACpB,eAAe,IAAI;CACrB,GACA,CAAC,YAAY,CACf;CACA,MAAM,QAAQ,QAAM,eAAe;EAAE,MAAM;EAAQ;CAAM,IAAI,CAAC,QAAQ,KAAK,CAAC;CAC5E,MAAM,UAAU,QAAM,aACnB,aACC,oBAAC,kBAAkB,UAAnB;EAA4B,OAAO;EAAQ;CAAqC,CAAA,GAElF,CAAC,KAAK,CACR;CACA,OAAO,CAAC;EAAE,GAAG;EAAO,cAAc;CAAiB,GAAG,OAAO;AAC/D;;AAGA,IAAa,2BAA2B,QAAM,WAAW,sBAAsB;AAE/E,SAAS,OAAU,KAA+B,OAAiB;CACjE,IAAI,OAAO,QAAQ,YACjB,IAAI,KAAK;MACJ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AM,UAAU,OAAO;EACvB,QAAQ,UAAU;EAClB,OAAO,SAAS,SAAS,OAAO;EAChC,QAAQ,UAAU;EAClB,QAAQ,UAAU,KAAA;EAClB,IAAI,CAAC,WAAW,CAAC,QAAQ,WAAW,CAAC,QAAQ,QAC3C;EAEF,MAAM,OAAO,QAAQ,QAAQ,KAAK,QAAQ,MAAM,OAAO;EACvD,MAAM,aAAa,KAAK,QAAQ,QAAQ,aAAa,YAAY,MAAM,MAAM;EAC7E,KAAK;EAGL,MAAM,WAAW,MADA,QAAQ,cAAc,aAAa,qBAAoB,kBAC1C,IAAI;EAClC,SAAS,QAAQ,SAAS;GAAE,YAAY;GAAM,iBAAiB,CAAC,YAAY;EAAE,CAAC;EAC/E,QAAQ,gBAAgB;GACtB,SAAS,WAAW;GACpB,KAAK,QAAQ;EACf;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,OAAO,QAAM,aAChB,aACC,SACE,oBAAC,uBAAuB,UAAxB;EAAiC,OAAO;EACrC;CAC8B,CAAA,IAEjC,UAEJ,CAAC,QAAQ,SAAS,CACpB;CAEA,MAAM,SAAS,QAAQ,YAAY;CACnC,OAAO;EACL,WAAW;EACX,OAAO,YAAY,MAAM;EACzB;EACA,cAAc,SAAS,uBAAuB,KAAA;EAC9C;EACA;CACF;AACF"}
@@ -0,0 +1,168 @@
1
+ import { getFloatingSidebarTiming } from "../components/ui/floating-sidebar-metrics.js";
2
+ import * as React$1 from "react";
3
+ //#region src/lib/safe-area.ts
4
+ var SIDES = [
5
+ "top",
6
+ "right",
7
+ "bottom",
8
+ "left"
9
+ ];
10
+ var BOUNDARY_ATTRIBUTE = "data-ghost-safe-area";
11
+ /**
12
+ * Whether the app SDK has set `--ghost-safe-area-inset-*` on the `<html>` of `container`'s
13
+ * document, or this one. It sets them inline, so reading them needs no style recalculation.
14
+ */
15
+ function hasSafeArea(container) {
16
+ if (!container && typeof globalThis.document === "undefined") return false;
17
+ const root = (container?.ownerDocument ?? globalThis.document).documentElement;
18
+ return SIDES.some((side) => root.style.getPropertyValue(`--ghost-safe-area-inset-${side}`) !== "");
19
+ }
20
+ function subscribeToRootStyle(onChange) {
21
+ const observer = new MutationObserver(onChange);
22
+ observer.observe(document.documentElement, {
23
+ attributes: true,
24
+ attributeFilter: ["style"]
25
+ });
26
+ return () => observer.disconnect();
27
+ }
28
+ function useHasSafeArea() {
29
+ return React$1.useSyncExternalStore(subscribeToRootStyle, () => hasSafeArea(), () => false);
30
+ }
31
+ var following = /* @__PURE__ */ new WeakSet();
32
+ /**
33
+ * Radix repositions popups on window scroll or resize, not when their boundary changes, so this
34
+ * fires a synthetic scroll whenever the insets change. Not a resize: that closes an open Select.
35
+ */
36
+ function followSafeArea(document) {
37
+ const view = document.defaultView;
38
+ if (!view || following.has(document)) return;
39
+ following.add(document);
40
+ new view.MutationObserver(() => view.dispatchEvent(new view.Event("scroll"))).observe(document.documentElement, {
41
+ attributes: true,
42
+ attributeFilter: ["style"]
43
+ });
44
+ }
45
+ /**
46
+ * An invisible element covering the safe area in `container`'s document, for popups to use as
47
+ * their collision boundary. Undefined where the safe area isn't set.
48
+ */
49
+ function safeAreaBoundary(container) {
50
+ if (!hasSafeArea(container)) return;
51
+ const document = container?.ownerDocument ?? globalThis.document;
52
+ followSafeArea(document);
53
+ const parent = container ?? document.body;
54
+ let boundary = parent.querySelector(`:scope > [${BOUNDARY_ATTRIBUTE}]`);
55
+ if (!boundary) {
56
+ boundary = document.createElement("div");
57
+ boundary.setAttribute(BOUNDARY_ATTRIBUTE, "");
58
+ boundary.setAttribute("aria-hidden", "true");
59
+ boundary.style.cssText = [
60
+ "position: fixed",
61
+ ...SIDES.map((side) => `${side}: var(--ghost-safe-area-inset-${side}, 0px)`),
62
+ "visibility: hidden",
63
+ "pointer-events: none"
64
+ ].join("; ");
65
+ parent.append(boundary);
66
+ }
67
+ return boundary;
68
+ }
69
+ /**
70
+ * Props that keep a Radix popup inside the safe area: its collision boundary, unless the caller
71
+ * gave one, and `data-safe-area` for styles that size it to fit.
72
+ */
73
+ function safeAreaCollision(collisionBoundary, container) {
74
+ const boundary = safeAreaBoundary(container);
75
+ return {
76
+ collisionBoundary: collisionBoundary ?? boundary,
77
+ "data-safe-area": boundary ? "" : void 0
78
+ };
79
+ }
80
+ var SLIDING_ATTRIBUTE = "data-ghost-safe-area-sliding";
81
+ var PAGE_COLUMN_SELECTOR = ".max-w-page, [data-list-page=list-page], [data-detail-page=detail-page]";
82
+ var HORIZONTAL = ["left", "right"];
83
+ function horizontalInsets(document, style) {
84
+ const probe = document.createElement("div");
85
+ probe.setAttribute("style", style ?? "");
86
+ const [left, right] = HORIZONTAL.map((side) => probe.style.getPropertyValue(`--ghost-safe-area-inset-${side}`));
87
+ return left === "" && right === "" ? void 0 : {
88
+ left,
89
+ right
90
+ };
91
+ }
92
+ function pageStart(app) {
93
+ const column = app.querySelector(PAGE_COLUMN_SELECTOR);
94
+ if (column) return column.getBoundingClientRect().left;
95
+ const view = app.ownerDocument.defaultView;
96
+ const padding = view ? parseFloat(view.getComputedStyle(app).paddingLeft) || 0 : 0;
97
+ return app.getBoundingClientRect().left + padding;
98
+ }
99
+ /**
100
+ * When the safe area's left and right insets jump, as Admin's navigation pins and unpins, slides
101
+ * `app` from where it showed to its new place with the navigation's timing. Not with reduced
102
+ * motion, nor the first time the insets are set.
103
+ */
104
+ function useSafeAreaSlide(app) {
105
+ React$1.useEffect(() => {
106
+ const element = app.current;
107
+ const document = element?.ownerDocument;
108
+ const view = document?.defaultView;
109
+ if (!element || !document || !view || typeof element.animate !== "function") return;
110
+ const root = document.documentElement;
111
+ let slide;
112
+ const stop = () => {
113
+ slide?.cancel();
114
+ slide = void 0;
115
+ root.removeAttribute(SLIDING_ATTRIBUTE);
116
+ };
117
+ const observer = new view.MutationObserver((records) => {
118
+ const was = horizontalInsets(document, records[0].oldValue);
119
+ const now = horizontalInsets(document, root.getAttribute("style"));
120
+ if (!was || !now || was.left === now.left && was.right === now.right) return;
121
+ if (view.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
122
+ stop();
123
+ return;
124
+ }
125
+ for (const side of HORIZONTAL) element.style.setProperty(`--ghost-safe-area-inset-${side}`, was[side]);
126
+ const before = pageStart(element);
127
+ for (const side of HORIZONTAL) element.style.removeProperty(`--ghost-safe-area-inset-${side}`);
128
+ stop();
129
+ const from = before - pageStart(element);
130
+ if (Math.abs(from) < .5) return;
131
+ if (root.scrollWidth <= root.clientWidth) root.setAttribute(SLIDING_ATTRIBUTE, "");
132
+ const style = view.getComputedStyle(element);
133
+ const [left, right] = [parseFloat(style.marginLeft), parseFloat(style.marginRight)];
134
+ const { duration, easing } = getFloatingSidebarTiming();
135
+ const animation = element.animate([{
136
+ marginLeft: `${left + from}px`,
137
+ marginRight: `${right - from}px`
138
+ }, {
139
+ marginLeft: `${left}px`,
140
+ marginRight: `${right}px`
141
+ }], {
142
+ duration,
143
+ easing
144
+ });
145
+ animation.startTime = document.timeline.currentTime;
146
+ animation.onfinish = () => {
147
+ if (slide === animation) {
148
+ slide = void 0;
149
+ root.removeAttribute(SLIDING_ATTRIBUTE);
150
+ }
151
+ };
152
+ slide = animation;
153
+ });
154
+ observer.observe(root, {
155
+ attributes: true,
156
+ attributeFilter: ["style"],
157
+ attributeOldValue: true
158
+ });
159
+ return () => {
160
+ observer.disconnect();
161
+ stop();
162
+ };
163
+ }, [app]);
164
+ }
165
+ //#endregion
166
+ export { hasSafeArea, safeAreaBoundary, safeAreaCollision, useHasSafeArea, useSafeAreaSlide };
167
+
168
+ //# sourceMappingURL=safe-area.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe-area.js","names":[],"sources":["../../src/lib/safe-area.ts"],"sourcesContent":["import * as React from 'react';\nimport { getFloatingSidebarTiming } from '@/components/ui/floating-sidebar-metrics';\n\nconst SIDES = ['top', 'right', 'bottom', 'left'] as const;\n\nconst BOUNDARY_ATTRIBUTE = 'data-ghost-safe-area';\n\n/**\n * Whether the app SDK has set `--ghost-safe-area-inset-*` on the `<html>` of `container`'s\n * document, or this one. It sets them inline, so reading them needs no style recalculation.\n */\nexport function hasSafeArea(container?: HTMLElement): boolean {\n if (!container && typeof globalThis.document === 'undefined') {\n return false;\n }\n const root = (container?.ownerDocument ?? globalThis.document).documentElement;\n return SIDES.some(\n (side) => root.style.getPropertyValue(`--ghost-safe-area-inset-${side}`) !== '',\n );\n}\n\nfunction subscribeToRootStyle(onChange: () => void) {\n const observer = new MutationObserver(onChange);\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['style'] });\n return () => observer.disconnect();\n}\n\nexport function useHasSafeArea(): boolean {\n return React.useSyncExternalStore(\n subscribeToRootStyle,\n () => hasSafeArea(),\n () => false,\n );\n}\n\nconst following = new WeakSet<Document>();\n\n/**\n * Radix repositions popups on window scroll or resize, not when their boundary changes, so this\n * fires a synthetic scroll whenever the insets change. Not a resize: that closes an open Select.\n */\nfunction followSafeArea(document: Document) {\n const view = document.defaultView;\n if (!view || following.has(document)) {\n return;\n }\n following.add(document);\n new view.MutationObserver(() => view.dispatchEvent(new view.Event('scroll'))).observe(\n document.documentElement,\n { attributes: true, attributeFilter: ['style'] },\n );\n}\n\n/**\n * An invisible element covering the safe area in `container`'s document, for popups to use as\n * their collision boundary. Undefined where the safe area isn't set.\n */\nexport function safeAreaBoundary(container?: HTMLElement): HTMLElement | undefined {\n if (!hasSafeArea(container)) {\n return undefined;\n }\n const document = container?.ownerDocument ?? globalThis.document;\n followSafeArea(document);\n const parent = container ?? document.body;\n let boundary = parent.querySelector<HTMLElement>(`:scope > [${BOUNDARY_ATTRIBUTE}]`);\n if (!boundary) {\n boundary = document.createElement('div');\n boundary.setAttribute(BOUNDARY_ATTRIBUTE, '');\n boundary.setAttribute('aria-hidden', 'true');\n boundary.style.cssText = [\n 'position: fixed',\n ...SIDES.map((side) => `${side}: var(--ghost-safe-area-inset-${side}, 0px)`),\n 'visibility: hidden',\n 'pointer-events: none',\n ].join('; ');\n parent.append(boundary);\n }\n return boundary;\n}\n\n/**\n * Props that keep a Radix popup inside the safe area: its collision boundary, unless the caller\n * gave one, and `data-safe-area` for styles that size it to fit.\n */\nexport function safeAreaCollision(\n collisionBoundary: Element | null | Array<Element | null> | undefined,\n container?: HTMLElement,\n) {\n const boundary = safeAreaBoundary(container);\n return {\n collisionBoundary: collisionBoundary ?? boundary,\n 'data-safe-area': boundary ? '' : undefined,\n };\n}\n\nconst SLIDING_ATTRIBUTE = 'data-ghost-safe-area-sliding';\n\nconst PAGE_COLUMN_SELECTOR =\n '.max-w-page, [data-list-page=list-page], [data-detail-page=detail-page]';\n\nconst HORIZONTAL = ['left', 'right'] as const;\n\nfunction horizontalInsets(document: Document, style: string | null) {\n const probe = document.createElement('div');\n probe.setAttribute('style', style ?? '');\n const [left, right] = HORIZONTAL.map((side) =>\n probe.style.getPropertyValue(`--ghost-safe-area-inset-${side}`),\n );\n return left === '' && right === '' ? undefined : { left, right };\n}\n\nfunction pageStart(app: HTMLElement) {\n const column = app.querySelector(PAGE_COLUMN_SELECTOR);\n if (column) {\n return column.getBoundingClientRect().left;\n }\n const view = app.ownerDocument.defaultView;\n const padding = view ? parseFloat(view.getComputedStyle(app).paddingLeft) || 0 : 0;\n return app.getBoundingClientRect().left + padding;\n}\n\n/**\n * When the safe area's left and right insets jump, as Admin's navigation pins and unpins, slides\n * `app` from where it showed to its new place with the navigation's timing. Not with reduced\n * motion, nor the first time the insets are set.\n */\nexport function useSafeAreaSlide(app: React.RefObject<HTMLElement | null>) {\n React.useEffect(() => {\n const element = app.current;\n const document = element?.ownerDocument;\n const view = document?.defaultView;\n if (!element || !document || !view || typeof element.animate !== 'function') {\n return undefined;\n }\n const root = document.documentElement;\n let slide: Animation | undefined;\n const stop = () => {\n slide?.cancel();\n slide = undefined;\n root.removeAttribute(SLIDING_ATTRIBUTE);\n };\n const observer = new view.MutationObserver((records) => {\n const was = horizontalInsets(document, records[0].oldValue);\n const now = horizontalInsets(document, root.getAttribute('style'));\n if (!was || !now || (was.left === now.left && was.right === now.right)) {\n return;\n }\n if (view.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {\n stop();\n return;\n }\n // Measured at the old insets before stopping a slide in flight, so it starts from mid-slide\n for (const side of HORIZONTAL) {\n element.style.setProperty(`--ghost-safe-area-inset-${side}`, was[side]);\n }\n const before = pageStart(element);\n for (const side of HORIZONTAL) {\n element.style.removeProperty(`--ghost-safe-area-inset-${side}`);\n }\n stop();\n const from = before - pageStart(element);\n if (Math.abs(from) < 0.5) {\n return;\n }\n if (root.scrollWidth <= root.clientWidth) {\n root.setAttribute(SLIDING_ATTRIBUTE, '');\n }\n // Margins, not a transform: a transform makes a containing block, which would move what's\n // fixed to the window along with the app.\n const style = view.getComputedStyle(element);\n const [left, right] = [parseFloat(style.marginLeft), parseFloat(style.marginRight)];\n const { duration, easing } = getFloatingSidebarTiming();\n const animation = element.animate(\n [\n { marginLeft: `${left + from}px`, marginRight: `${right - from}px` },\n { marginLeft: `${left}px`, marginRight: `${right}px` },\n ],\n { duration, easing },\n );\n // Starts in this frame, in step with the navigation, rather than the next.\n animation.startTime = document.timeline.currentTime;\n animation.onfinish = () => {\n if (slide === animation) {\n slide = undefined;\n root.removeAttribute(SLIDING_ATTRIBUTE);\n }\n };\n slide = animation;\n });\n observer.observe(root, {\n attributes: true,\n attributeFilter: ['style'],\n attributeOldValue: true,\n });\n return () => {\n observer.disconnect();\n stop();\n };\n }, [app]);\n}\n"],"mappings":";;;AAGA,IAAM,QAAQ;CAAC;CAAO;CAAS;CAAU;AAAM;AAE/C,IAAM,qBAAqB;;;;;AAM3B,SAAgB,YAAY,WAAkC;CAC5D,IAAI,CAAC,aAAa,OAAO,WAAW,aAAa,aAC/C,OAAO;CAET,MAAM,QAAQ,WAAW,iBAAiB,WAAW,SAAA,CAAU;CAC/D,OAAO,MAAM,MACV,SAAS,KAAK,MAAM,iBAAiB,2BAA2B,MAAM,MAAM,EAC/E;AACF;AAEA,SAAS,qBAAqB,UAAsB;CAClD,MAAM,WAAW,IAAI,iBAAiB,QAAQ;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,YACjB,QAAQ,MAAM,YAAY,2BAA2B,QAAQ,IAAI,KAAK;GAExE,MAAM,SAAS,UAAU,OAAO;GAChC,KAAK,MAAM,QAAQ,YACjB,QAAQ,MAAM,eAAe,2BAA2B,MAAM;GAEhE,KAAK;GACL,MAAM,OAAO,SAAS,UAAU,OAAO;GACvC,IAAI,KAAK,IAAI,IAAI,IAAI,IACnB;GAEF,IAAI,KAAK,eAAe,KAAK,aAC3B,KAAK,aAAa,mBAAmB,EAAE;GAIzC,MAAM,QAAQ,KAAK,iBAAiB,OAAO;GAC3C,MAAM,CAAC,MAAM,SAAS,CAAC,WAAW,MAAM,UAAU,GAAG,WAAW,MAAM,WAAW,CAAC;GAClF,MAAM,EAAE,UAAU,WAAW,yBAAyB;GACtD,MAAM,YAAY,QAAQ,QACxB,CACE;IAAE,YAAY,GAAG,OAAO,KAAK;IAAK,aAAa,GAAG,QAAQ,KAAK;GAAI,GACnE;IAAE,YAAY,GAAG,KAAK;IAAK,aAAa,GAAG,MAAM;GAAI,CACvD,GACA;IAAE;IAAU;GAAO,CACrB;GAEA,UAAU,YAAY,SAAS,SAAS;GACxC,UAAU,iBAAiB;IACzB,IAAI,UAAU,WAAW;KACvB,QAAQ,KAAA;KACR,KAAK,gBAAgB,iBAAiB;IACxC;GACF;GACA,QAAQ;EACV,CAAC;EACD,SAAS,QAAQ,MAAM;GACrB,YAAY;GACZ,iBAAiB,CAAC,OAAO;GACzB,mBAAmB;EACrB,CAAC;EACD,aAAa;GACX,SAAS,WAAW;GACpB,KAAK;EACP;CACF,GAAG,CAAC,GAAG,CAAC;AACV"}
@@ -8,6 +8,12 @@ import { useEffect, useState } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { createPortal } from "react-dom";
10
10
  //#region src/providers/shade-provider.tsx
11
+ var safeAreaOffset = (offset) => ({
12
+ top: `calc(${offset}px + var(--ghost-safe-area-inset-top, 0px))`,
13
+ right: `calc(${offset}px + var(--ghost-safe-area-inset-right, 0px))`,
14
+ bottom: `calc(${offset}px + var(--ghost-safe-area-inset-bottom, 0px))`,
15
+ left: `calc(${offset}px + var(--ghost-safe-area-inset-left, 0px))`
16
+ });
11
17
  var ToasterPortal = () => {
12
18
  const [mounted, setMounted] = useState(false);
13
19
  useEffect(() => {
@@ -26,6 +32,8 @@ var ToasterPortal = () => {
26
32
  success: /* @__PURE__ */ jsx(Icon.SuccessFill, { className: "text-green" }),
27
33
  info: /* @__PURE__ */ jsx(Icon.InfoFill, { className: "text-text-tertiary" })
28
34
  },
35
+ mobileOffset: safeAreaOffset(16),
36
+ offset: safeAreaOffset(24),
29
37
  position: "bottom-left",
30
38
  toastOptions: {
31
39
  classNames: {
@@ -35,7 +43,7 @@ var ToasterPortal = () => {
35
43
  },
36
44
  style: {
37
45
  alignItems: "flex-start",
38
- maxWidth: "290px"
46
+ maxWidth: "min(290px, calc(100vw - 32px - var(--ghost-safe-area-inset-left, 0px) - var(--ghost-safe-area-inset-right, 0px)))"
39
47
  }
40
48
  },
41
49
  closeButton: true
@@ -1 +1 @@
1
- {"version":3,"file":"shade-provider.js","names":[],"sources":["../../src/providers/shade-provider.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Toaster } from '../components/ui/sonner';\nimport { createPortal } from 'react-dom';\nimport { GlobalDirtyStateProvider } from '@/providers/global-dirty-state-provider';\nimport Icon from '../components/ui/icon';\nimport { TooltipProvider } from '@/components/ui/tooltip';\nimport { ShadeScope } from '@/shade-scope';\nimport { ShadeContext, type ControlShape } from '@/providers/shade-context';\n\nconst ToasterPortal = () => {\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => {\n setMounted(true);\n return () => setMounted(false);\n }, []);\n\n return mounted\n ? createPortal(\n <ShadeScope style={{ width: 'unset', height: 'unset' }}>\n <Toaster\n duration={5000}\n icons={{\n error: <Icon.ErrorFill className=\"text-red\" />,\n success: <Icon.SuccessFill className=\"text-green\" />,\n info: <Icon.InfoFill className=\"text-text-tertiary\" />,\n }}\n position=\"bottom-left\"\n toastOptions={{\n classNames: {\n title: 'mt-[-1px]! text-md! font-semibold! leading-tighter! tracking-[0.1px]!',\n description: 'text-text-primary! text-sm! mt-px!',\n icon: 'ml-0!',\n },\n style: {\n alignItems: 'flex-start',\n maxWidth: '290px',\n },\n }}\n closeButton\n />\n </ShadeScope>,\n document.body,\n )\n : null;\n};\n\ninterface ShadeProviderProps {\n darkMode: boolean;\n admin7Design?: boolean;\n admin7Mobile?: boolean;\n controlShape?: ControlShape;\n children: React.ReactNode;\n}\n\nconst ShadeProvider: React.FC<ShadeProviderProps> = ({\n darkMode,\n admin7Design = true,\n admin7Mobile = false,\n controlShape,\n children,\n}) => {\n const [isAnyTextFieldFocused, setIsAnyTextFieldFocused] = useState(false);\n\n const setFocusState = (value: boolean) => {\n setIsAnyTextFieldFocused(value);\n };\n\n return (\n <ShadeContext.Provider\n value={{\n isAnyTextFieldFocused,\n setFocusState,\n darkMode,\n admin7Design,\n admin7Mobile,\n controlShape: controlShape ?? 'pill',\n }}\n >\n <GlobalDirtyStateProvider>\n {/* Default Radix tooltip timing for any Tooltip without a nearer\n provider; inner providers still win via nearest-provider scoping. */}\n <TooltipProvider>\n {children}\n <ToasterPortal />\n </TooltipProvider>\n </GlobalDirtyStateProvider>\n </ShadeContext.Provider>\n );\n};\n\nexport default ShadeProvider;\n"],"mappings":";;;;;;;;;;AASA,IAAM,sBAAsB;CAC1B,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,gBAAgB;EACd,WAAW,IAAI;EACf,aAAa,WAAW,KAAK;CAC/B,GAAG,CAAC,CAAC;CAEL,OAAO,UACH,aACE,oBAAC,YAAD;EAAY,OAAO;GAAE,OAAO;GAAS,QAAQ;EAAQ;YACnD,oBAAC,SAAD;GACE,UAAU;GACV,OAAO;IACL,OAAO,oBAAC,KAAK,WAAN,EAAgB,WAAU,WAAY,CAAA;IAC7C,SAAS,oBAAC,KAAK,aAAN,EAAkB,WAAU,aAAc,CAAA;IACnD,MAAM,oBAAC,KAAK,UAAN,EAAe,WAAU,qBAAsB,CAAA;GACvD;GACA,UAAS;GACT,cAAc;IACZ,YAAY;KACV,OAAO;KACP,aAAa;KACb,MAAM;IACR;IACA,OAAO;KACL,YAAY;KACZ,UAAU;IACZ;GACF;GACA,aAAA;EACD,CAAA;CACS,CAAA,GACZ,SAAS,IACX,IACA;AACN;AAUA,IAAM,iBAA+C,EACnD,UACA,eAAe,MACf,eAAe,OACf,cACA,eACI;CACJ,MAAM,CAAC,uBAAuB,4BAA4B,SAAS,KAAK;CAExE,MAAM,iBAAiB,UAAmB;EACxC,yBAAyB,KAAK;CAChC;CAEA,OACE,oBAAC,aAAa,UAAd;EACE,OAAO;GACL;GACA;GACA;GACA;GACA;GACA,cAAc,gBAAgB;EAChC;YAEA,oBAAC,0BAAD,EAAA,UAGE,qBAAC,iBAAD,EAAA,UAAA,CACG,UACD,oBAAC,eAAD,CAAgB,CAAA,CACD,EAAA,CAAA,EACO,CAAA;CACL,CAAA;AAE3B"}
1
+ {"version":3,"file":"shade-provider.js","names":[],"sources":["../../src/providers/shade-provider.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Toaster } from '../components/ui/sonner';\nimport { createPortal } from 'react-dom';\nimport { GlobalDirtyStateProvider } from '@/providers/global-dirty-state-provider';\nimport Icon from '../components/ui/icon';\nimport { TooltipProvider } from '@/components/ui/tooltip';\nimport { ShadeScope } from '@/shade-scope';\nimport { ShadeContext, type ControlShape } from '@/providers/shade-context';\n\nconst safeAreaOffset = (offset: number) => ({\n top: `calc(${offset}px + var(--ghost-safe-area-inset-top, 0px))`,\n right: `calc(${offset}px + var(--ghost-safe-area-inset-right, 0px))`,\n bottom: `calc(${offset}px + var(--ghost-safe-area-inset-bottom, 0px))`,\n left: `calc(${offset}px + var(--ghost-safe-area-inset-left, 0px))`,\n});\n\nconst ToasterPortal = () => {\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => {\n setMounted(true);\n return () => setMounted(false);\n }, []);\n\n return mounted\n ? createPortal(\n <ShadeScope style={{ width: 'unset', height: 'unset' }}>\n <Toaster\n duration={5000}\n icons={{\n error: <Icon.ErrorFill className=\"text-red\" />,\n success: <Icon.SuccessFill className=\"text-green\" />,\n info: <Icon.InfoFill className=\"text-text-tertiary\" />,\n }}\n mobileOffset={safeAreaOffset(16)}\n offset={safeAreaOffset(24)}\n position=\"bottom-left\"\n toastOptions={{\n classNames: {\n title: 'mt-[-1px]! text-md! font-semibold! leading-tighter! tracking-[0.1px]!',\n description: 'text-text-primary! text-sm! mt-px!',\n icon: 'ml-0!',\n },\n style: {\n alignItems: 'flex-start',\n maxWidth:\n 'min(290px, calc(100vw - 32px - var(--ghost-safe-area-inset-left, 0px) - var(--ghost-safe-area-inset-right, 0px)))',\n },\n }}\n closeButton\n />\n </ShadeScope>,\n document.body,\n )\n : null;\n};\n\ninterface ShadeProviderProps {\n darkMode: boolean;\n admin7Design?: boolean;\n admin7Mobile?: boolean;\n controlShape?: ControlShape;\n children: React.ReactNode;\n}\n\nconst ShadeProvider: React.FC<ShadeProviderProps> = ({\n darkMode,\n admin7Design = true,\n admin7Mobile = false,\n controlShape,\n children,\n}) => {\n const [isAnyTextFieldFocused, setIsAnyTextFieldFocused] = useState(false);\n\n const setFocusState = (value: boolean) => {\n setIsAnyTextFieldFocused(value);\n };\n\n return (\n <ShadeContext.Provider\n value={{\n isAnyTextFieldFocused,\n setFocusState,\n darkMode,\n admin7Design,\n admin7Mobile,\n controlShape: controlShape ?? 'pill',\n }}\n >\n <GlobalDirtyStateProvider>\n {/* Default Radix tooltip timing for any Tooltip without a nearer\n provider; inner providers still win via nearest-provider scoping. */}\n <TooltipProvider>\n {children}\n <ToasterPortal />\n </TooltipProvider>\n </GlobalDirtyStateProvider>\n </ShadeContext.Provider>\n );\n};\n\nexport default ShadeProvider;\n"],"mappings":";;;;;;;;;;AASA,IAAM,kBAAkB,YAAoB;CAC1C,KAAK,QAAQ,OAAO;CACpB,OAAO,QAAQ,OAAO;CACtB,QAAQ,QAAQ,OAAO;CACvB,MAAM,QAAQ,OAAO;AACvB;AAEA,IAAM,sBAAsB;CAC1B,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,gBAAgB;EACd,WAAW,IAAI;EACf,aAAa,WAAW,KAAK;CAC/B,GAAG,CAAC,CAAC;CAEL,OAAO,UACH,aACE,oBAAC,YAAD;EAAY,OAAO;GAAE,OAAO;GAAS,QAAQ;EAAQ;YACnD,oBAAC,SAAD;GACE,UAAU;GACV,OAAO;IACL,OAAO,oBAAC,KAAK,WAAN,EAAgB,WAAU,WAAY,CAAA;IAC7C,SAAS,oBAAC,KAAK,aAAN,EAAkB,WAAU,aAAc,CAAA;IACnD,MAAM,oBAAC,KAAK,UAAN,EAAe,WAAU,qBAAsB,CAAA;GACvD;GACA,cAAc,eAAe,EAAE;GAC/B,QAAQ,eAAe,EAAE;GACzB,UAAS;GACT,cAAc;IACZ,YAAY;KACV,OAAO;KACP,aAAa;KACb,MAAM;IACR;IACA,OAAO;KACL,YAAY;KACZ,UACE;IACJ;GACF;GACA,aAAA;EACD,CAAA;CACS,CAAA,GACZ,SAAS,IACX,IACA;AACN;AAUA,IAAM,iBAA+C,EACnD,UACA,eAAe,MACf,eAAe,OACf,cACA,eACI;CACJ,MAAM,CAAC,uBAAuB,4BAA4B,SAAS,KAAK;CAExE,MAAM,iBAAiB,UAAmB;EACxC,yBAAyB,KAAK;CAChC;CAEA,OACE,oBAAC,aAAa,UAAd;EACE,OAAO;GACL;GACA;GACA;GACA;GACA;GACA,cAAc,gBAAgB;EAChC;YAEA,oBAAC,0BAAD,EAAA,UAGE,qBAAC,iBAAD,EAAA,UAAA,CACG,UACD,oBAAC,eAAD,CAAgB,CAAA,CACD,EAAA,CAAA,EACO,CAAA;CACL,CAAA;AAE3B"}
package/es/shade-app.js CHANGED
@@ -1,5 +1,8 @@
1
+ import { cn } from "./lib/ds-utils.js";
2
+ import { useHasSafeArea, useSafeAreaSlide } from "./lib/safe-area.js";
3
+ import { AppOverlayContext } from "./lib/app-overlay.js";
1
4
  import ShadeProvider from "./providers/shade-provider.js";
2
- import "react";
5
+ import React from "react";
3
6
  import clsx$1 from "clsx";
4
7
  import { jsx } from "react/jsx-runtime";
5
8
  //#region src/shade-app.tsx
@@ -9,9 +12,15 @@ import { jsx } from "react/jsx-runtime";
9
12
  * in order to work correctly.
10
13
  */
11
14
  var SHADE_APP_NAMESPACES = "shade shade-admin shade-activitypub";
12
- var ShadeApp = ({ darkMode, controlShape, admin7Design = true, admin7Mobile = false, className, children, ...props }) => {
15
+ var SAFE_AREA_PADDING = cn("pt-[var(--ghost-safe-area-inset-top,0px)] pr-[var(--ghost-safe-area-inset-right,0px)]", "pb-[var(--ghost-safe-area-inset-bottom,0px)] pl-[var(--ghost-safe-area-inset-left,0px)]");
16
+ var ShadeApp = ({ darkMode, controlShape, admin7Design = true, admin7Mobile = false, overlay, className, children, ...props }) => {
17
+ const root = React.useRef(null);
18
+ const inApp = useHasSafeArea();
19
+ useSafeAreaSlide(root);
20
+ const appClassName = cn("shade", SAFE_AREA_PADDING, className);
13
21
  return /* @__PURE__ */ jsx("div", {
14
- className: clsx$1("shade", className),
22
+ ref: root,
23
+ className: inApp ? appClassName : clsx$1("shade", className),
15
24
  ...props,
16
25
  "data-admin7-design": admin7Design,
17
26
  "data-admin7-mobile": admin7Mobile,
@@ -20,7 +29,10 @@ var ShadeApp = ({ darkMode, controlShape, admin7Design = true, admin7Mobile = fa
20
29
  admin7Mobile,
21
30
  controlShape,
22
31
  darkMode,
23
- children
32
+ children: /* @__PURE__ */ jsx(AppOverlayContext.Provider, {
33
+ value: overlay,
34
+ children
35
+ })
24
36
  })
25
37
  });
26
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"shade-app.js","names":[],"sources":["../src/shade-app.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React from 'react';\nimport ShadeProvider from '@/providers/shade-provider';\nimport type { ControlShape } from '@/providers/shade-context';\n\n/**\n * The className is used to scope the styles of the app to the app's namespace.\n * Some components in radixUI/ShadCN need to be wrapped in a div with the className\n * in order to work correctly.\n */\nexport const SHADE_APP_NAMESPACES = 'shade shade-admin shade-activitypub';\n\nexport interface ShadeAppProps extends React.HTMLProps<HTMLDivElement> {\n darkMode: boolean;\n controlShape?: ControlShape;\n /**\n * Admin's `admin7Design` Labs flag. Admin passes the flag's value; isolated Shade\n * previews and standalone apps default to the Admin 7 design. Removed with the flag.\n */\n admin7Design?: boolean;\n /** Temporary Admin mobile-hardening flag. Standalone surfaces stay off by default. */\n admin7Mobile?: boolean;\n}\n\nconst ShadeApp: React.FC<ShadeAppProps> = ({\n darkMode,\n controlShape,\n admin7Design = true,\n admin7Mobile = false,\n className,\n children,\n ...props\n}) => {\n const appClassName = clsx('shade', className);\n\n return (\n <div\n className={appClassName}\n {...props}\n data-admin7-design={admin7Design}\n data-admin7-mobile={admin7Mobile}\n >\n <ShadeProvider\n admin7Design={admin7Design}\n admin7Mobile={admin7Mobile}\n controlShape={controlShape}\n darkMode={darkMode}\n >\n {children}\n </ShadeProvider>\n </div>\n );\n};\n\nexport default ShadeApp;\n"],"mappings":";;;;;;;;;;AAUA,IAAa,uBAAuB;AAcpC,IAAM,YAAqC,EACzC,UACA,cACA,eAAe,MACf,eAAe,OACf,WACA,UACA,GAAG,YACC;CAGJ,OACE,oBAAC,OAAD;EACE,WAJiB,OAAK,SAAS,SAIpB;EACX,GAAI;EACJ,sBAAoB;EACpB,sBAAoB;YAEpB,oBAAC,eAAD;GACgB;GACA;GACA;GACJ;GAET;EACY,CAAA;CACZ,CAAA;AAET"}
1
+ {"version":3,"file":"shade-app.js","names":[],"sources":["../src/shade-app.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React from 'react';\nimport { type AppOverlay, AppOverlayContext } from '@/lib/app-overlay';\nimport ShadeProvider from '@/providers/shade-provider';\nimport type { ControlShape } from '@/providers/shade-context';\nimport { useHasSafeArea, useSafeAreaSlide } from '@/lib/safe-area';\nimport { cn } from '@/lib/utils';\n\n/**\n * The className is used to scope the styles of the app to the app's namespace.\n * Some components in radixUI/ShadCN need to be wrapped in a div with the className\n * in order to work correctly.\n */\nexport const SHADE_APP_NAMESPACES = 'shade shade-admin shade-activitypub';\n\nconst SAFE_AREA_PADDING = cn(\n 'pt-[var(--ghost-safe-area-inset-top,0px)] pr-[var(--ghost-safe-area-inset-right,0px)]',\n 'pb-[var(--ghost-safe-area-inset-bottom,0px)] pl-[var(--ghost-safe-area-inset-left,0px)]',\n);\n\nexport interface ShadeAppProps extends React.HTMLProps<HTMLDivElement> {\n darkMode: boolean;\n controlShape?: ControlShape;\n /**\n * Admin's `admin7Design` Labs flag. Admin passes the flag's value; isolated Shade\n * previews and standalone apps default to the Admin 7 design. Removed with the flag.\n */\n admin7Design?: boolean;\n /** Temporary Admin mobile-hardening flag. Standalone surfaces stay off by default. */\n admin7Mobile?: boolean;\n /** In a Ghost app, where dialogs and sheets render. Pass the app SDK's `ghost.overlay`. */\n overlay?: AppOverlay;\n}\n\nconst ShadeApp: React.FC<ShadeAppProps> = ({\n darkMode,\n controlShape,\n admin7Design = true,\n admin7Mobile = false,\n overlay,\n className,\n children,\n ...props\n}) => {\n const root = React.useRef<HTMLDivElement>(null);\n const inApp = useHasSafeArea();\n useSafeAreaSlide(root);\n // Last, so a className's own padding wins.\n const appClassName = cn('shade', SAFE_AREA_PADDING, className);\n\n return (\n <div\n ref={root}\n className={inApp ? appClassName : clsx('shade', className)}\n {...props}\n data-admin7-design={admin7Design}\n data-admin7-mobile={admin7Mobile}\n >\n <ShadeProvider\n admin7Design={admin7Design}\n admin7Mobile={admin7Mobile}\n controlShape={controlShape}\n darkMode={darkMode}\n >\n <AppOverlayContext.Provider value={overlay}>{children}</AppOverlayContext.Provider>\n </ShadeProvider>\n </div>\n );\n};\n\nexport default ShadeApp;\n"],"mappings":";;;;;;;;;;;;;AAaA,IAAa,uBAAuB;AAEpC,IAAM,oBAAoB,GACxB,yFACA,yFACF;AAgBA,IAAM,YAAqC,EACzC,UACA,cACA,eAAe,MACf,eAAe,OACf,SACA,WACA,UACA,GAAG,YACC;CACJ,MAAM,OAAO,MAAM,OAAuB,IAAI;CAC9C,MAAM,QAAQ,eAAe;CAC7B,iBAAiB,IAAI;CAErB,MAAM,eAAe,GAAG,SAAS,mBAAmB,SAAS;CAE7D,OACE,oBAAC,OAAD;EACE,KAAK;EACL,WAAW,QAAQ,eAAe,OAAK,SAAS,SAAS;EACzD,GAAI;EACJ,sBAAoB;EACpB,sBAAoB;YAEpB,oBAAC,eAAD;GACgB;GACA;GACA;GACJ;aAEV,oBAAC,kBAAkB,UAAnB;IAA4B,OAAO;IAAU;GAAqC,CAAA;EACrE,CAAA;CACZ,CAAA;AAET"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/shade",
3
- "version": "0.1.0-alpha.47",
3
+ "version": "0.1.0-alpha.49",
4
4
  "description": "Ghost design system for React apps",
5
5
  "license": "MIT",
6
6
  "author": "Ghost Foundation",
package/styles.css CHANGED
@@ -181,6 +181,23 @@ html.theme-switching *::after {
181
181
  scrollbar-width: none; /* Firefox */
182
182
  }
183
183
 
184
+ /* In a Ghost app the document scrolls. Radix's scroll lock hides its scrollbar and pads body,
185
+ shifting what's fixed to the window; keep the scrollbar, as the lock still blocks scrolling. */
186
+ :root[style*='--ghost-safe-area-inset-'] > body[data-scroll-locked] {
187
+ overflow: visible !important;
188
+ margin-right: 0 !important;
189
+ }
190
+
191
+ /* Set by useSafeAreaSlide */
192
+ :root[data-ghost-safe-area-sliding] {
193
+ overflow-x: clip;
194
+ }
195
+
196
+ /* Set by FloatingSidebar: over a cross-origin frame, pointer events go to the frame alone. */
197
+ [data-floating-sidebar-frame-guard] ~ * iframe {
198
+ pointer-events: none !important;
199
+ }
200
+
184
201
  /* CodeEditor autocomplete is portalled to a viewport-sized body child so it
185
202
  can escape form-control and accordion overflow boundaries. CodeMirror adds
186
203
  an intermediate container carrying the editor theme classes; collapse and
package/types/app.d.ts CHANGED
@@ -3,4 +3,6 @@ export type { ShadeAppProps } from './shade-app.js';
3
3
  export { ShadeScope } from './shade-scope.js';
4
4
  export { useFocusContext, useShade } from './providers/shade-context.js';
5
5
  export type { ControlShape } from './providers/shade-context.js';
6
+ export { overlayTint } from './lib/app-overlay.js';
7
+ export type { AppOverlay, AppOverlayHold, AppOverlayTint } from './lib/app-overlay.js';
6
8
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -28,6 +28,11 @@ export declare const ColorPickerTrigger: import("react").ForwardRefExoticCompone
28
28
  export type ColorPickerProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> & {
29
29
  value?: Parameters<typeof Color>[0];
30
30
  defaultValue?: Parameters<typeof Color>[0];
31
+ /**
32
+ * Called with the new colour as upper-case `#RRGGBB` when someone changes it in the picker,
33
+ * never on mount or when `value` changes. It can run twice before your component
34
+ * re-renders, so compare with the last colour you stored, not with `value`.
35
+ */
31
36
  onChange?: (value: string) => void;
32
37
  };
33
38
  export declare const ColorPickerRoot: ({ value, defaultValue, onChange, className, ...props }: ColorPickerProps) => import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../../../src/components/patterns/color-picker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACjD,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EAEnB,KAAK,cAAc,EASpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAIL,aAAa,EAEd,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,OAAO,GAAG,UAAU,CACrB;IACC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAWD,eAAO,MAAM,WAAW,0DAOrB,gBAAgB,gCAqBlB,CAAC;AAEF,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC3F,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM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vE,eAAO,MAAM,gBAAgB,4BAA6B,qBAAqB,gCAmB9E,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEvE,eAAO,MAAM,qBAAqB,4BAA6B,0BAA0B,uCAmDxF,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;AAI1E,eAAO,MAAM,iBAAiB,iBAAkB,sBAAsB,gCAiBrE,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEpE,eAAO,MAAM,iBAAiB,4BAA6B,sBAAsB,uCAuFhF,CAAC;AAEF,QAAA,MAAM,WAAW,UAAW,gBAAgB,gCAY3C,CAAC;eAEa,WAAW"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
3
3
  import type { ButtonProps } from './button.js';
4
- declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
4
+ declare const AlertDialog: (props: React.ComponentProps<typeof AlertDialogPrimitive.Root>) => React.ReactNode;
5
5
  declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
6
  declare const AlertDialogPortal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
7
7
  declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/alert-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAC;AAGrE,OAAO,KAAK,EAAE,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AAC;AASH,QAAA,MAAM,kBAAkB;uBAHH,MAAM;wCAoCzB,CAAC;mCAGwB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;;;mCAK7D,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;;;AAQxF,QAAA,MAAM,gBAAgB,8KASpB,CAAC;AAGH,QAAA,MAAM,sBAAsB,wLAK1B,CAAC;AAGH,QAAA,MAAM,iBAAiB,4MAcrB,CAAC;AAGH,QAAA,MAAM,iBAAiB,6KAkBrB,CAAC;AAGH,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,GAClB,CAAC"}
@@ -3,7 +3,7 @@ import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
3
3
  declare const ContextMenu: React.FC<ContextMenuPrimitive.ContextMenuProps>;
4
4
  declare const ContextMenuTrigger: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuTriggerProps & React.RefAttributes<HTMLSpanElement>>;
5
5
  declare const ContextMenuGroup: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
6
- declare const ContextMenuPortal: React.FC<ContextMenuPrimitive.ContextMenuPortalProps>;
6
+ declare const ContextMenuPortal: (props: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) => React.JSX.Element;
7
7
  declare const ContextMenuSub: React.FC<ContextMenuPrimitive.ContextMenuSubProps>;
8
8
  declare const ContextMenuRadioGroup: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
9
9
  declare const ContextMenuSubTrigger: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
@@ -1 +1 @@
1
- {"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAC;AAMrE,QAAA,MAAM,WAAW,iDAA4B,CAAC;AAE9C,QAAA,MAAM,kBAAkB,sHAA+B,CAAC;AAExD,QAAA,MAAM,gBAAgB,mHAA6B,CAAC;AAEpD,QAAA,MAAM,iBAAiB,uDAA8B,CAAC;AAEtD,QAAA,MAAM,cAAc,oDAA2B,CAAC;AAEhD,QAAA,MAAM,qBAAqB,wHAAkC,CAAC;AAE9D,QAAA,MAAM,qBAAqB;YAGf,OAAO;wCAejB,CAAC;AAGH,QAAA,MAAM,qBAAqB,2KAczB,CAAC;AAGH,QAAA,MAAM,kBAAkB,wKAiBtB,CAAC;AAGH,QAAA,MAAM,eAAe;YAGT,OAAO;cACL,SAAS,GAAG,aAAa;wCAcrC,CAAC;AAGH,QAAA,MAAM,uBAAuB,6KAoB3B,CAAC;AAGH,QAAA,MAAM,oBAAoB,0KAmBxB,CAAC;AAGH,QAAA,MAAM,gBAAgB;YAGV,OAAO;wCAQjB,CAAC;AAGH,QAAA,MAAM,oBAAoB,0KASxB,CAAC;qCAG0B,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;;;;AAK3F,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,CAAC"}
1
+ {"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAC;AAQrE,QAAA,MAAM,WAAW,iDAA4B,CAAC;AAE9C,QAAA,MAAM,kBAAkB,sHAA+B,CAAC;AAExD,QAAA,MAAM,gBAAgB,mHAA6B,CAAC;AAEpD,QAAA,MAAM,iBAAiB,UAAW,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,sBAEzF,CAAC;AAEF,QAAA,MAAM,cAAc,oDAA2B,CAAC;AAEhD,QAAA,MAAM,qBAAqB,wHAAkC,CAAC;AAE9D,QAAA,MAAM,qBAAqB;YAGf,OAAO;wCAejB,CAAC;AAGH,QAAA,MAAM,qBAAqB,2KAgBzB,CAAC;AAGH,QAAA,MAAM,kBAAkB,wKAmBtB,CAAC;AAGH,QAAA,MAAM,eAAe;YAGT,OAAO;cACL,SAAS,GAAG,aAAa;wCAcrC,CAAC;AAGH,QAAA,MAAM,uBAAuB,6KAoB3B,CAAC;AAGH,QAAA,MAAM,oBAAoB,0KAmBxB,CAAC;AAGH,QAAA,MAAM,gBAAgB;YAGV,OAAO;wCAQjB,CAAC;AAGH,QAAA,MAAM,oBAAoB,0KASxB,CAAC;qCAG0B,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;;;;AAK3F,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import * as DialogPrimitive from '@radix-ui/react-dialog';
3
- declare const Dialog: ({ modal, ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) => React.JSX.Element;
3
+ declare const Dialog: (props: React.ComponentProps<typeof DialogPrimitive.Root>) => React.ReactNode;
4
4
  declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
5
  declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
6
6
  declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAQ1D,QAAA,MAAM,MAAM,wBAAgC,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,sBAI5F,CAAC;AAEF,QAAA,MAAM,aAAa,8GAA0B,CAAC;AAE9C,QAAA,MAAM,YAAY,6CAAyB,CAAC;AAE5C,QAAA,MAAM,WAAW,4GAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa,8JAajB,CAAC;AAOH,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,wBAAwB,CACxE,OAAO,eAAe,CAAC,OAAO,CAC/B;IACC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B;AAED,QAAA,MAAM,aAAa,2FAwDjB,CAAC;8BAGmB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;;;8BAK7D,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;;;AAWnF,QAAA,MAAM,WAAW,oKAYf,CAAC;AAGH,QAAA,MAAM,iBAAiB,8KASrB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAY1D,QAAA,MAAM,MAAM,UAAW,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,oBAGvE,CAAC;AAEF,QAAA,MAAM,aAAa,8GAA0B,CAAC;AAE9C,QAAA,MAAM,YAAY,6CAAyB,CAAC;AAE5C,QAAA,MAAM,WAAW,4GAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa,8JAcjB,CAAC;AA6BH,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,wBAAwB,CACxE,OAAO,eAAe,CAAC,OAAO,CAC/B;IACC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B;AAED,QAAA,MAAM,aAAa,2FAiFjB,CAAC;8BAGmB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;;;8BAK7D,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;;;AAWnF,QAAA,MAAM,WAAW,oKAYf,CAAC;AAGH,QAAA,MAAM,iBAAiB,8KASrB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAC"}
@@ -3,7 +3,7 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
3
  declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
4
4
  declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
5
  declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
6
- declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
6
+ declare const DropdownMenuPortal: (props: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) => React.JSX.Element;
7
7
  declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
8
8
  declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
9
9
  declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dropdown-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AAMvE,QAAA,MAAM,YAAY,mDAA6B,CAAC;AAEhD,QAAA,MAAM,mBAAmB,0HAAgC,CAAC;AAE1D,QAAA,MAAM,iBAAiB,qHAA8B,CAAC;AAEtD,QAAA,MAAM,kBAAkB,yDAA+B,CAAC;AAExD,QAAA,MAAM,eAAe,sDAA4B,CAAC;AAElD,QAAA,MAAM,sBAAsB,0HAAmC,CAAC;AAEhE,QAAA,MAAM,sBAAsB;YAGhB,OAAO;wCAejB,CAAC;AAGH,QAAA,MAAM,sBAAsB,6KAe1B,CAAC;AAGH,QAAA,MAAM,mBAAmB,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