@hanzo/ui 8.0.114 → 8.0.116

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.
@@ -26,9 +26,9 @@ const DialogClose = gui_1.Dialog.Close;
26
26
  exports.DialogClose = DialogClose;
27
27
  const DialogOverlay = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Dialog.Overlay, { ...(0, slot_1.slot)('dialog-overlay'), bg: "rgba(0,0,0,0.5)", opacity: 0.5, ...props }));
28
28
  exports.DialogOverlay = DialogOverlay;
29
- const DialogContent = ({ showCloseButton = true, children, ...props }) => {
29
+ const DialogContent = ({ showCloseButton = true, overlay, children, ...props }) => {
30
30
  const themeName = (0, portal_theme_1.useThemeName)();
31
- return ((0, jsx_runtime_1.jsx)(gui_1.Dialog.Portal, { children: (0, jsx_runtime_1.jsxs)(portal_theme_1.PortalTheme, { name: themeName, children: [(0, jsx_runtime_1.jsx)(DialogOverlay, {}), (0, jsx_runtime_1.jsxs)(gui_1.Dialog.Content, { ...(0, slot_1.slot)('dialog-content'), bg: "$background", borderWidth: 1, borderColor: "$borderColor", rounded: "$5", p: PAD, gap: "$4", width: "100%", maxW: 512, ...props, children: [children, showCloseButton ? ((0, jsx_runtime_1.jsx)(gui_1.Dialog.Close, { asChild: true, children: (0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('dialog-close'), position: "absolute", t: 16, r: 16, cursor: "pointer", opacity: 0.7, hoverStyle: { opacity: 1 }, ...(0, gesture_1.touch)(16), "aria-label": "Close", children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.X, { size: 16 }) }) })) : null] })] }) }));
31
+ return ((0, jsx_runtime_1.jsx)(gui_1.Dialog.Portal, { children: (0, jsx_runtime_1.jsxs)(portal_theme_1.PortalTheme, { name: themeName, children: [(0, jsx_runtime_1.jsx)(DialogOverlay, { ...overlay }), (0, jsx_runtime_1.jsxs)(gui_1.Dialog.Content, { ...(0, slot_1.slot)('dialog-content'), bg: "$background", borderWidth: 1, borderColor: "$borderColor", rounded: "$5", p: PAD, gap: "$4", width: "100%", maxW: 512, ...props, children: [children, showCloseButton ? ((0, jsx_runtime_1.jsx)(gui_1.Dialog.Close, { asChild: true, children: (0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('dialog-close'), position: "absolute", t: 16, r: 16, cursor: "pointer", opacity: 0.7, hoverStyle: { opacity: 1 }, ...(0, gesture_1.touch)(16), "aria-label": "Close", children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.X, { size: 16 }) }) })) : null] })] }) }));
32
32
  };
33
33
  exports.DialogContent = DialogContent;
34
34
  const DialogHeader = (props) => ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('dialog-header'), gap: "$2", ...props }));
@@ -15,8 +15,18 @@ export type DialogOverlayProps = ComponentProps<typeof GuiDialog.Overlay>;
15
15
  declare const DialogOverlay: (props: DialogOverlayProps) => import("react/jsx-runtime").JSX.Element;
16
16
  export type DialogContentProps = ComponentProps<typeof GuiDialog.Content> & {
17
17
  showCloseButton?: boolean;
18
+ /**
19
+ * The overlay's own props. Content owns the overlay — that is what lets a
20
+ * caller mount Content alone — but owning it is not the same as hiding it,
21
+ * and with no way through, the dim, the stacking and the click target were
22
+ * unreachable from outside. A consumer stacking dialogs (a preview opened
23
+ * from a dialog) has no way to say which one dims which.
24
+ *
25
+ * Absent, nothing changes: the default overlay renders exactly as before.
26
+ */
27
+ overlay?: DialogOverlayProps;
18
28
  };
19
- declare const DialogContent: ({ showCloseButton, children, ...props }: DialogContentProps) => import("react/jsx-runtime").JSX.Element;
29
+ declare const DialogContent: ({ showCloseButton, overlay, children, ...props }: DialogContentProps) => import("react/jsx-runtime").JSX.Element;
20
30
  export type DialogSectionProps = ComponentProps<typeof YStack> & {
21
31
  children?: ReactNode;
22
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/dialog.tsx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M,YAAY,GAAI,OAAO,cAAc,CAAC,OAAO,MAAM,CAAC,4CAEzD,CAAA;AAED,QAAA,MAAM,WAAW,GAAI,OAAO,cAAc,CAAC,OAAO,SAAS,CAAC,KAAK,CAAC,4CAEjE,CAAA;AAED,QAAA,MAAM,iBAAiB,GAAI,OAAO,cAAc,CAAC,OAAO,SAAS,CAAC,WAAW,CAAC,4CAE7E,CAAA;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAA"}
@@ -18,9 +18,9 @@ const DialogTrigger = GuiDialog.Trigger;
18
18
  const DialogPortal = GuiDialog.Portal;
19
19
  const DialogClose = GuiDialog.Close;
20
20
  const DialogOverlay = (props) => (_jsx(GuiDialog.Overlay, { ...slot('dialog-overlay'), bg: "rgba(0,0,0,0.5)", opacity: 0.5, ...props }));
21
- const DialogContent = ({ showCloseButton = true, children, ...props }) => {
21
+ const DialogContent = ({ showCloseButton = true, overlay, children, ...props }) => {
22
22
  const themeName = useThemeName();
23
- return (_jsx(GuiDialog.Portal, { children: _jsxs(PortalTheme, { name: themeName, children: [_jsx(DialogOverlay, {}), _jsxs(GuiDialog.Content, { ...slot('dialog-content'), bg: "$background", borderWidth: 1, borderColor: "$borderColor", rounded: "$5", p: PAD, gap: "$4", width: "100%", maxW: 512, ...props, children: [children, showCloseButton ? (_jsx(GuiDialog.Close, { asChild: true, children: _jsx(XStack, { ...slot('dialog-close'), position: "absolute", t: 16, r: 16, cursor: "pointer", opacity: 0.7, hoverStyle: { opacity: 1 }, ...touch(16), "aria-label": "Close", children: _jsx(X, { size: 16 }) }) })) : null] })] }) }));
23
+ return (_jsx(GuiDialog.Portal, { children: _jsxs(PortalTheme, { name: themeName, children: [_jsx(DialogOverlay, { ...overlay }), _jsxs(GuiDialog.Content, { ...slot('dialog-content'), bg: "$background", borderWidth: 1, borderColor: "$borderColor", rounded: "$5", p: PAD, gap: "$4", width: "100%", maxW: 512, ...props, children: [children, showCloseButton ? (_jsx(GuiDialog.Close, { asChild: true, children: _jsx(XStack, { ...slot('dialog-close'), position: "absolute", t: 16, r: 16, cursor: "pointer", opacity: 0.7, hoverStyle: { opacity: 1 }, ...touch(16), "aria-label": "Close", children: _jsx(X, { size: 16 }) }) })) : null] })] }) }));
24
24
  };
25
25
  const DialogHeader = (props) => (_jsx(YStack, { ...slot('dialog-header'), gap: "$2", ...props }));
26
26
  const DialogFooter = (props) => (_jsx(XStack, { ...slot('dialog-footer'), gap: "$2", justify: "flex-end", items: "center", ...props }));
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/backends/gui/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,0BAA0B,CAAA;AAE5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEjC,MAAM,GAAG,GAAG,EAAE,CAAA;AAEd,MAAM,MAAM,GAAG,CAAC,CAAmC,EAAE,EAAE,CAAC,KAAC,SAAS,IAAC,KAAK,WAAK,CAAC,GAAI,CAAA;AAClF,MAAM,aAAa,GAA6B,SAAS,CAAC,OAAO,CAAA;AACjE,MAAM,YAAY,GAA4B,SAAS,CAAC,MAAM,CAAA;AAC9D,MAAM,WAAW,GAA2B,SAAS,CAAC,KAAK,CAAA;AAI3D,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAE,EAAE,CAAC,CACnD,KAAC,SAAS,CAAC,OAAO,OACZ,IAAI,CAAC,gBAAgB,CAAC,EAC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AE,KACtB,KAAK,CAAC,EAAE,CAAC,gBACF,OAAO,YAElB,KAAC,CAAC,IAAC,IAAI,EAAE,EAAE,GAAI,GACR,GACO,CACnB,CAAC,CAAC,CAAC,IAAI,IACU,IACR,GACG,CACpB,CAAA;AACH,CAAC,CAAA;AAID,MAAM,YAAY,GAAG,CAAC,KAAyB,EAAE,EAAE,CAAC,CAClD,KAAC,MAAM,OAAK,IAAI,CAAC,eAAe,CAAC,EAAE,GAAG,EAAC,IAAI,KAAK,KAAK,GAAI,CAC1D,CAAA;AAED,MAAM,YAAY,GAAG,CAAC,KAAoC,EAAE,EAAE,CAAC,CAC7D,KAAC,MAAM,OAAK,IAAI,CAAC,eAAe,CAAC,EAAE,GAAG,EAAC,IAAI,EAAC,OAAO,EAAC,UAAU,EAAC,KAAK,EAAC,QAAQ,KAAK,KAAK,GAAI,CAC5F,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,KAA6C,EAAE,EAAE,CAAC,CACrE,KAAC,SAAS,CAAC,KAAK,OAAK,IAAI,CAAC,cAAc,CAAC,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,KAAK,KAAK,GAAI,CACpF,CAAA;AAED,MAAM,iBAAiB,GAAG,CAAC,KAAmD,EAAE,EAAE,CAAC,CACjF,KAAC,SAAS,CAAC,WAAW,OAAK,IAAI,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,UAAU,KAAK,KAAK,GAAI,CAChG,CAAA;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAA"}
package/dist/root.cjs CHANGED
@@ -47,12 +47,18 @@ require("./styles.css");
47
47
  * production. `styles.css` declares `--hanzo-ui-styles`, so the check is one
48
48
  * lookup, it runs once, and it names the fix. Development only.
49
49
  *
50
- * A document with NO stylesheets at all is jsdom, where nothing loads CSS and
51
- * there is nothing to be wrong about — throwing there would break every
52
- * consumer's unit tests to report a condition that cannot exist. */
50
+ * Only a sheet with an OWNER ELEMENT counts. A bundler that processed the CSS
51
+ * emits a `<link>` or a `<style>`; jsdom loads no CSS at all, so a document
52
+ * with no such element cannot answer the question and must not be asked —
53
+ * throwing there breaks every consumer's unit tests to report a condition that
54
+ * cannot exist. Counting SHEETS instead of elements is what made that happen:
55
+ * the gui runtime inserts its own ownerless sheet while this module is being
56
+ * imported, so by first render jsdom was never empty and every jest consumer
57
+ * rendering `<Hanzo>` threw. */
53
58
  let checked = false;
59
+ const styled = () => [...document.styleSheets].some((s) => s.ownerNode);
54
60
  const assertStylesheet = () => {
55
- if (checked || typeof document === 'undefined' || document.styleSheets.length === 0)
61
+ if (checked || typeof document === 'undefined' || !styled())
56
62
  return;
57
63
  checked = true;
58
64
  if (getComputedStyle(document.documentElement).getPropertyValue('--hanzo-ui-styles').trim())
@@ -1 +1 @@
1
- {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../src/root.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKjD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,eAAe,CAAA;CACtC,CAAA;AAqBD,eAAO,MAAM,KAAK,GAAI,gCAAyC,UAAU,4CA+BxE,CAAA;AAED,eAAe,KAAK,CAAA"}
1
+ {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../src/root.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKjD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,eAAe,CAAA;CACtC,CAAA;AA2BD,eAAO,MAAM,KAAK,GAAI,gCAAyC,UAAU,4CA+BxE,CAAA;AAED,eAAe,KAAK,CAAA"}
package/dist/root.js CHANGED
@@ -44,12 +44,18 @@ import './styles.css';
44
44
  * production. `styles.css` declares `--hanzo-ui-styles`, so the check is one
45
45
  * lookup, it runs once, and it names the fix. Development only.
46
46
  *
47
- * A document with NO stylesheets at all is jsdom, where nothing loads CSS and
48
- * there is nothing to be wrong about — throwing there would break every
49
- * consumer's unit tests to report a condition that cannot exist. */
47
+ * Only a sheet with an OWNER ELEMENT counts. A bundler that processed the CSS
48
+ * emits a `<link>` or a `<style>`; jsdom loads no CSS at all, so a document
49
+ * with no such element cannot answer the question and must not be asked —
50
+ * throwing there breaks every consumer's unit tests to report a condition that
51
+ * cannot exist. Counting SHEETS instead of elements is what made that happen:
52
+ * the gui runtime inserts its own ownerless sheet while this module is being
53
+ * imported, so by first render jsdom was never empty and every jest consumer
54
+ * rendering `<Hanzo>` threw. */
50
55
  let checked = false;
56
+ const styled = () => [...document.styleSheets].some((s) => s.ownerNode);
51
57
  const assertStylesheet = () => {
52
- if (checked || typeof document === 'undefined' || document.styleSheets.length === 0)
58
+ if (checked || typeof document === 'undefined' || !styled())
53
59
  return;
54
60
  checked = true;
55
61
  if (getComputedStyle(document.documentElement).getPropertyValue('--hanzo-ui-styles').trim())
package/dist/root.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"root.js","sourceRoot":"","sources":["../src/root.ts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AAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "8.0.114",
3
+ "version": "8.0.116",
4
4
  "type": "module",
5
5
  "description": "Hanzo UI — the one canonical Hanzo component library, on @hanzo/gui + @hanzo/design. ONE substrate: every component renders through @hanzo/gui primitives, so the same import works on web, native (expo) and desktop (Tauri). Self-contained (theme.css), presentational, host-agnostic, clean-room.",
6
6
  "exports": {
@@ -193,7 +193,7 @@
193
193
  "dist"
194
194
  ],
195
195
  "dependencies": {
196
- "@hanzo/appearance": "^0.1.4",
196
+ "@hanzo/appearance": "^0.2.2",
197
197
  "@hanzo/brand": "^1.4.5",
198
198
  "@hanzo/design": "^0.5.16",
199
199
  "@hanzo/logo": "^1.0.13",