@hanzo/ui 8.27.4 → 8.27.5

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.
@@ -1,5 +1,5 @@
1
1
  'use client';"use strict";
2
- 'use client';
2
+ "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.SelectScrollDownButton = exports.SelectScrollUpButton = exports.SelectSeparator = exports.SelectItem = exports.SelectLabel = exports.SelectContent = exports.SelectTrigger = exports.SelectValue = exports.SelectGroup = exports.Select = void 0;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
@@ -12,38 +12,47 @@ const jsx_runtime_1 = require("react/jsx-runtime");
12
12
  * `SelectGroup`. An item is written `<SelectItem value="x">Label</SelectItem>`
13
13
  * and the numbering always matches render order.
14
14
  */
15
+ const react_1 = require("react");
15
16
  const gui_1 = require("@hanzo/gui");
16
17
  const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
17
- const react_1 = require("react");
18
+ const control_1 = require("./control.cjs");
19
+ const gesture_1 = require("./gesture.cjs");
18
20
  const ink_1 = require("./ink.cjs");
19
21
  const slot_1 = require("./slot.cjs");
20
- const gesture_1 = require("./gesture.cjs");
21
- const control_1 = require("./control.cjs");
22
22
  const ROW_H = 32;
23
23
  const TRIGGER_H = control_1.CONTROL_H;
24
- const Select = gui_1.Select;
24
+ /**
25
+ * Disabling the control is one fact with two spellings: gui puts `disabled` on
26
+ * the Trigger, the compound API puts it on the root. The root declares it and
27
+ * the trigger honours it, so a call site can say either and mean the same thing.
28
+ */
29
+ const Disabled = /* @__PURE__ */ (0, react_1.createContext)(false);
30
+ const Select = /* @__PURE__ */ Object.assign(({ disabled = false, ...props }) => ((0, jsx_runtime_1.jsx)(Disabled.Provider, { value: disabled, children: (0, jsx_runtime_1.jsx)(gui_1.Select, { ...props }) })), gui_1.Select);
25
31
  exports.Select = Select;
26
32
  const SelectGroup = gui_1.Select.Group;
27
33
  exports.SelectGroup = SelectGroup;
28
34
  const SelectValue = gui_1.Select.Value;
29
35
  exports.SelectValue = SelectValue;
30
- const SelectTrigger = ({ children, ...props }) => ((0, jsx_runtime_1.jsxs)(gui_1.Select.Trigger, { ...(0, slot_1.slot)('select-trigger'), unstyled: true, ...control_1.FIELD, items: "center", justify: "space-between", gap: "$2",
31
- // A FLOOR, not a pin. `height` alone clips a child taller than the box, and
32
- // the build stays green while it does — that is why 01ac46dce moved Button
33
- // off a pinned height. Select and Input kept theirs, so the same trap was
34
- // still armed in the two controls that sit in every form.
35
- height: "auto", minHeight: TRIGGER_H,
36
- // The trigger states its own vertical padding because otherwise something
37
- // else states it. `unstyled` does not survive gui's ListItem (it is
38
- // destructured into a local and never reaches the frame), so the frame
39
- // styles itself at `size: '$true'` and writes `paddingVertical: $3.5` — and
40
- // under `height: auto` that padding, not the floor, is what decides the box:
41
- // 14 + a 20px line + 14 + 2px of border rendered a 50px Select beside a 36px
42
- // Input. At 0 the floor decides again and `items="center"` does the
43
- // centring, which is exactly how the Input already behaves.
44
- py: 0, cursor: "pointer", ...(0, gesture_1.touch)(TRIGGER_H, 44, 'y'), ...props, children: [(0, ink_1.ink)(children, undefined, { size: '$3' }), (0, jsx_runtime_1.jsx)(gui_1.Select.Icon, { children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronDown, { size: 16, opacity: 0.5 }) })] }));
36
+ const SelectTrigger = ({ children, disabled, ...props }) => {
37
+ const inherited = (0, react_1.useContext)(Disabled);
38
+ return ((0, jsx_runtime_1.jsxs)(gui_1.Select.Trigger, { ...(0, slot_1.slot)("select-trigger"), unstyled: true, disabled: disabled ?? inherited, ...control_1.FIELD, items: "center", justify: "space-between", gap: "$2",
39
+ // A FLOOR, not a pin. `height` alone clips a child taller than the box, and
40
+ // the build stays green while it does — that is why 01ac46dce moved Button
41
+ // off a pinned height. Select and Input kept theirs, so the same trap was
42
+ // still armed in the two controls that sit in every form.
43
+ height: "auto", minHeight: TRIGGER_H,
44
+ // The trigger states its own vertical padding because otherwise something
45
+ // else states it. `unstyled` does not survive gui's ListItem (it is
46
+ // destructured into a local and never reaches the frame), so the frame
47
+ // styles itself at `size: '$true'` and writes `paddingVertical: $3.5` — and
48
+ // under `height: auto` that padding, not the floor, is what decides the box:
49
+ // 14 + a 20px line + 14 + 2px of border rendered a 50px Select beside a 36px
50
+ // Input. At 0 the floor decides again and `items="center"` does the
51
+ // centring, which is exactly how the Input already behaves.
52
+ py: 0, cursor: "pointer", ...(0, gesture_1.touch)(TRIGGER_H, 44, "y"), ...props, children: [(0, ink_1.ink)(children, undefined, { size: "$3" }), (0, jsx_runtime_1.jsx)(gui_1.Select.Icon, { children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronDown, { size: 16, opacity: 0.5 }) })] }));
53
+ };
45
54
  exports.SelectTrigger = SelectTrigger;
46
- const SelectItem = ({ children, ...props }) => ((0, jsx_runtime_1.jsxs)(gui_1.Select.Item, { ...(0, slot_1.slot)('select-item'), unstyled: true, index: props.index ?? 0, items: "center", gap: "$2", minH: ROW_H, pl: "$2", pr: "$7", rounded: "$2", cursor: "pointer", ...(0, gesture_1.touch)(ROW_H, 44, 'y'), hoverStyle: { bg: '$raised' }, focusStyle: { bg: '$raised' }, ...props, children: [(0, jsx_runtime_1.jsx)(gui_1.Select.ItemText, { children: children }), (0, jsx_runtime_1.jsx)(gui_1.XStack, { position: "absolute", r: "$2", items: "center", justify: "center", pointerEvents: "none", children: (0, jsx_runtime_1.jsx)(gui_1.Select.ItemIndicator, { children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Check, { size: 16 }) }) })] }));
55
+ const SelectItem = ({ children, ...props }) => ((0, jsx_runtime_1.jsxs)(gui_1.Select.Item, { ...(0, slot_1.slot)("select-item"), unstyled: true, index: props.index ?? 0, items: "center", gap: "$2", minH: ROW_H, pl: "$2", pr: "$7", rounded: "$2", cursor: "pointer", ...(0, gesture_1.touch)(ROW_H, 44, "y"), hoverStyle: { bg: "$raised" }, focusStyle: { bg: "$raised" }, ...props, children: [(0, jsx_runtime_1.jsx)(gui_1.Select.ItemText, { children: children }), (0, jsx_runtime_1.jsx)(gui_1.XStack, { position: "absolute", r: "$2", items: "center", justify: "center", pointerEvents: "none", children: (0, jsx_runtime_1.jsx)(gui_1.Select.ItemIndicator, { children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Check, { size: 16 }) }) })] }));
47
56
  exports.SelectItem = SelectItem;
48
57
  /** Depth-first stamp of `index` onto every `SelectItem` in render order. */
49
58
  const stampIndices = (children, next) => react_1.Children.map(children, (child) => {
@@ -52,18 +61,20 @@ const stampIndices = (children, next) => react_1.Children.map(children, (child)
52
61
  if (child.type === SelectItem)
53
62
  return (0, react_1.cloneElement)(child, { index: next() });
54
63
  const kids = child.props.children;
55
- return kids === undefined ? child : (0, react_1.cloneElement)(child, undefined, stampIndices(kids, next));
64
+ return kids === undefined
65
+ ? child
66
+ : (0, react_1.cloneElement)(child, undefined, stampIndices(kids, next));
56
67
  });
57
- const SelectScrollUpButton = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Select.ScrollUpButton, { ...(0, slot_1.slot)('select-scroll-up-button'), items: "center", justify: "center", py: "$1", ...props, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronUp, { size: 16 }) }));
68
+ const SelectScrollUpButton = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Select.ScrollUpButton, { ...(0, slot_1.slot)("select-scroll-up-button"), items: "center", justify: "center", py: "$1", ...props, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronUp, { size: 16 }) }));
58
69
  exports.SelectScrollUpButton = SelectScrollUpButton;
59
- const SelectScrollDownButton = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Select.ScrollDownButton, { ...(0, slot_1.slot)('select-scroll-down-button'), items: "center", justify: "center", py: "$1", ...props, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronDown, { size: 16 }) }));
70
+ const SelectScrollDownButton = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Select.ScrollDownButton, { ...(0, slot_1.slot)("select-scroll-down-button"), items: "center", justify: "center", py: "$1", ...props, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronDown, { size: 16 }) }));
60
71
  exports.SelectScrollDownButton = SelectScrollDownButton;
61
72
  const SelectContent = ({ children, ...props }) => {
62
73
  let n = 0;
63
- return ((0, jsx_runtime_1.jsxs)(gui_1.Select.Content, { ...(0, slot_1.slot)('select-content'), ...props, children: [(0, jsx_runtime_1.jsx)(SelectScrollUpButton, {}), (0, jsx_runtime_1.jsx)(gui_1.Select.Viewport, { minW: 128, p: "$1", bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: "$4", children: stampIndices(children, () => n++) }), (0, jsx_runtime_1.jsx)(SelectScrollDownButton, {})] }));
74
+ return ((0, jsx_runtime_1.jsxs)(gui_1.Select.Content, { ...(0, slot_1.slot)("select-content"), ...props, children: [(0, jsx_runtime_1.jsx)(SelectScrollUpButton, {}), (0, jsx_runtime_1.jsx)(gui_1.Select.Viewport, { minW: 128, p: "$1", bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: "$4", children: stampIndices(children, () => n++) }), (0, jsx_runtime_1.jsx)(SelectScrollDownButton, {})] }));
64
75
  };
65
76
  exports.SelectContent = SelectContent;
66
- const SelectLabel = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Select.Label, { ...(0, slot_1.slot)('select-label'), px: "$2", py: "$1.5", fontSize: "$1", color: "$quiet", ...props }));
77
+ const SelectLabel = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Select.Label, { ...(0, slot_1.slot)("select-label"), px: "$2", py: "$1.5", fontSize: "$1", color: "$quiet", ...props }));
67
78
  exports.SelectLabel = SelectLabel;
68
- const SelectSeparator = (props) => ((0, jsx_runtime_1.jsx)(gui_1.SelectSeparator, { ...(0, slot_1.slot)('select-separator'), my: "$1", borderColor: "$borderColor", ...props }));
79
+ const SelectSeparator = (props) => ((0, jsx_runtime_1.jsx)(gui_1.SelectSeparator, { ...(0, slot_1.slot)("select-separator"), my: "$1", borderColor: "$borderColor", ...props }));
69
80
  exports.SelectSeparator = SelectSeparator;
@@ -7,20 +7,29 @@
7
7
  * `SelectGroup`. An item is written `<SelectItem value="x">Label</SelectItem>`
8
8
  * and the numbering always matches render order.
9
9
  */
10
- import { Select as GuiSelect, SelectSeparator as GuiSelectSeparator } from '@hanzo/gui';
11
- import { type ComponentProps } from 'react';
12
- declare const Select: typeof GuiSelect;
10
+ import { type ComponentProps, type ReactNode } from "react";
11
+ import { Select as GuiSelect, SelectSeparator as GuiSelectSeparator } from "@hanzo/gui";
12
+ export type SelectProps = ComponentProps<typeof GuiSelect> & {
13
+ disabled?: boolean;
14
+ };
15
+ /**
16
+ * The root's own signature, then the compound statics gui hangs off it. Written
17
+ * out because the inferred type of an `Object.assign` cannot be named in a
18
+ * declaration file, and this package emits one.
19
+ */
20
+ type SelectRoot = ((props: SelectProps) => ReactNode) & typeof GuiSelect;
21
+ declare const Select: SelectRoot;
13
22
  declare const SelectGroup: typeof GuiSelect.Group;
14
23
  declare const SelectValue: typeof GuiSelect.Value;
15
24
  export type SelectTriggerProps = ComponentProps<typeof GuiSelect.Trigger>;
16
25
  export type SelectContentProps = ComponentProps<typeof GuiSelect.Content>;
17
- export type SelectItemProps = Omit<ComponentProps<typeof GuiSelect.Item>, 'index'> & {
26
+ export type SelectItemProps = Omit<ComponentProps<typeof GuiSelect.Item>, "index"> & {
18
27
  index?: number;
19
28
  };
20
29
  export type SelectLabelProps = ComponentProps<typeof GuiSelect.Label>;
21
30
  export type SelectSeparatorProps = ComponentProps<typeof GuiSelectSeparator>;
22
31
  export type SelectScrollButtonProps = ComponentProps<typeof GuiSelect.ScrollUpButton>;
23
- declare const SelectTrigger: ({ children, ...props }: SelectTriggerProps) => import("react").JSX.Element;
32
+ declare const SelectTrigger: ({ children, disabled, ...props }: SelectTriggerProps) => import("react").JSX.Element;
24
33
  declare const SelectItem: ({ children, ...props }: SelectItemProps) => import("react").JSX.Element;
25
34
  declare const SelectScrollUpButton: (props: SelectScrollButtonProps) => import("react").JSX.Element;
26
35
  declare const SelectScrollDownButton: (props: SelectScrollButtonProps) => import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/select.tsx"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,eAAe,IAAI,kBAAkB,EAAU,MAAM,YAAY,CAAA;AAE/F,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAA;AASd,QAAA,MAAM,MAAM,EAAE,OAAO,SAAqB,CAAA;AAC1C,QAAA,MAAM,WAAW,EAAE,OAAO,SAAS,CAAC,KAAuB,CAAA;AAC3D,QAAA,MAAM,WAAW,EAAE,OAAO,SAAS,CAAC,KAAuB,CAAA;AAE3D,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAA;AACzE,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAA;AACzE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG;IACnF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,KAAK,CAAC,CAAA;AACrE,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC5E,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,cAAc,CAAC,CAAA;AAErF,QAAA,MAAM,aAAa,2BAA4B,kBAAkB,gCAoChE,CAAA;AAED,QAAA,MAAM,UAAU,2BAA4B,eAAe,gCAwB1D,CAAA;AAWD,QAAA,MAAM,o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AChC,cAAc,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,EACrC,OAAO,CACR,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,KAAK,CAAC,CAAA;AACrE,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC5E,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAClD,OAAO,SAAS,CAAC,cAAc,CAChC,CAAA;AAED,QAAA,MAAM,aAAa,qCAIhB,kBAAkB,gCAwCpB,CAAA;AAED,QAAA,MAAM,UAAU,2BAA4B,eAAe,gCA8B1D,CAAA;AAcD,QAAA,MAAM,oBAAoB,UAAW,uBAAuB,gCAU3D,CAAA;AAED,QAAA,MAAM,sBAAsB,UAAW,uBAAuB,gCAU7D,CAAA;AAED,QAAA,MAAM,aAAa,2BAA4B,kBAAkB,gCAkBhE,CAAA;AAED,QAAA,MAAM,WAAW,UAAW,gBAAgB,gCAS3C,CAAA;AAED,QAAA,MAAM,eAAe,UAAW,oBAAoB,gCAOnD,CAAA;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAA"}
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  /**
4
4
  * Select — the compound picker on @hanzogui/select.
@@ -9,34 +9,43 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  * `SelectGroup`. An item is written `<SelectItem value="x">Label</SelectItem>`
10
10
  * and the numbering always matches render order.
11
11
  */
12
- import { Select as GuiSelect, SelectSeparator as GuiSelectSeparator, XStack } from '@hanzo/gui';
13
- import { Check, ChevronDown, ChevronUp } from '@hanzogui/lucide-icons-2';
14
- import { Children, cloneElement, isValidElement, } from 'react';
15
- import { ink } from './ink.js';
16
- import { slot } from './slot.js';
17
- import { touch } from './gesture.js';
18
- import { CONTROL_H, FIELD } from './control.js';
12
+ import { Children, cloneElement, createContext, isValidElement, useContext, } from "react";
13
+ import { Select as GuiSelect, SelectSeparator as GuiSelectSeparator, XStack, } from "@hanzo/gui";
14
+ import { Check, ChevronDown, ChevronUp } from "@hanzogui/lucide-icons-2";
15
+ import { CONTROL_H, FIELD } from "./control.js";
16
+ import { touch } from "./gesture.js";
17
+ import { ink } from "./ink.js";
18
+ import { slot } from "./slot.js";
19
19
  const ROW_H = 32;
20
20
  const TRIGGER_H = CONTROL_H;
21
- const Select = GuiSelect;
21
+ /**
22
+ * Disabling the control is one fact with two spellings: gui puts `disabled` on
23
+ * the Trigger, the compound API puts it on the root. The root declares it and
24
+ * the trigger honours it, so a call site can say either and mean the same thing.
25
+ */
26
+ const Disabled = /* @__PURE__ */ createContext(false);
27
+ const Select = /* @__PURE__ */ Object.assign(({ disabled = false, ...props }) => (_jsx(Disabled.Provider, { value: disabled, children: _jsx(GuiSelect, { ...props }) })), GuiSelect);
22
28
  const SelectGroup = GuiSelect.Group;
23
29
  const SelectValue = GuiSelect.Value;
24
- const SelectTrigger = ({ children, ...props }) => (_jsxs(GuiSelect.Trigger, { ...slot('select-trigger'), unstyled: true, ...FIELD, items: "center", justify: "space-between", gap: "$2",
25
- // A FLOOR, not a pin. `height` alone clips a child taller than the box, and
26
- // the build stays green while it does — that is why 01ac46dce moved Button
27
- // off a pinned height. Select and Input kept theirs, so the same trap was
28
- // still armed in the two controls that sit in every form.
29
- height: "auto", minHeight: TRIGGER_H,
30
- // The trigger states its own vertical padding because otherwise something
31
- // else states it. `unstyled` does not survive gui's ListItem (it is
32
- // destructured into a local and never reaches the frame), so the frame
33
- // styles itself at `size: '$true'` and writes `paddingVertical: $3.5` — and
34
- // under `height: auto` that padding, not the floor, is what decides the box:
35
- // 14 + a 20px line + 14 + 2px of border rendered a 50px Select beside a 36px
36
- // Input. At 0 the floor decides again and `items="center"` does the
37
- // centring, which is exactly how the Input already behaves.
38
- py: 0, cursor: "pointer", ...touch(TRIGGER_H, 44, 'y'), ...props, children: [ink(children, undefined, { size: '$3' }), _jsx(GuiSelect.Icon, { children: _jsx(ChevronDown, { size: 16, opacity: 0.5 }) })] }));
39
- const SelectItem = ({ children, ...props }) => (_jsxs(GuiSelect.Item, { ...slot('select-item'), unstyled: true, index: props.index ?? 0, items: "center", gap: "$2", minH: ROW_H, pl: "$2", pr: "$7", rounded: "$2", cursor: "pointer", ...touch(ROW_H, 44, 'y'), hoverStyle: { bg: '$raised' }, focusStyle: { bg: '$raised' }, ...props, children: [_jsx(GuiSelect.ItemText, { children: children }), _jsx(XStack, { position: "absolute", r: "$2", items: "center", justify: "center", pointerEvents: "none", children: _jsx(GuiSelect.ItemIndicator, { children: _jsx(Check, { size: 16 }) }) })] }));
30
+ const SelectTrigger = ({ children, disabled, ...props }) => {
31
+ const inherited = useContext(Disabled);
32
+ return (_jsxs(GuiSelect.Trigger, { ...slot("select-trigger"), unstyled: true, disabled: disabled ?? inherited, ...FIELD, items: "center", justify: "space-between", gap: "$2",
33
+ // A FLOOR, not a pin. `height` alone clips a child taller than the box, and
34
+ // the build stays green while it does — that is why 01ac46dce moved Button
35
+ // off a pinned height. Select and Input kept theirs, so the same trap was
36
+ // still armed in the two controls that sit in every form.
37
+ height: "auto", minHeight: TRIGGER_H,
38
+ // The trigger states its own vertical padding because otherwise something
39
+ // else states it. `unstyled` does not survive gui's ListItem (it is
40
+ // destructured into a local and never reaches the frame), so the frame
41
+ // styles itself at `size: '$true'` and writes `paddingVertical: $3.5` — and
42
+ // under `height: auto` that padding, not the floor, is what decides the box:
43
+ // 14 + a 20px line + 14 + 2px of border rendered a 50px Select beside a 36px
44
+ // Input. At 0 the floor decides again and `items="center"` does the
45
+ // centring, which is exactly how the Input already behaves.
46
+ py: 0, cursor: "pointer", ...touch(TRIGGER_H, 44, "y"), ...props, children: [ink(children, undefined, { size: "$3" }), _jsx(GuiSelect.Icon, { children: _jsx(ChevronDown, { size: 16, opacity: 0.5 }) })] }));
47
+ };
48
+ const SelectItem = ({ children, ...props }) => (_jsxs(GuiSelect.Item, { ...slot("select-item"), unstyled: true, index: props.index ?? 0, items: "center", gap: "$2", minH: ROW_H, pl: "$2", pr: "$7", rounded: "$2", cursor: "pointer", ...touch(ROW_H, 44, "y"), hoverStyle: { bg: "$raised" }, focusStyle: { bg: "$raised" }, ...props, children: [_jsx(GuiSelect.ItemText, { children: children }), _jsx(XStack, { position: "absolute", r: "$2", items: "center", justify: "center", pointerEvents: "none", children: _jsx(GuiSelect.ItemIndicator, { children: _jsx(Check, { size: 16 }) }) })] }));
40
49
  /** Depth-first stamp of `index` onto every `SelectItem` in render order. */
41
50
  const stampIndices = (children, next) => Children.map(children, (child) => {
42
51
  if (!isValidElement(child))
@@ -44,15 +53,17 @@ const stampIndices = (children, next) => Children.map(children, (child) => {
44
53
  if (child.type === SelectItem)
45
54
  return cloneElement(child, { index: next() });
46
55
  const kids = child.props.children;
47
- return kids === undefined ? child : cloneElement(child, undefined, stampIndices(kids, next));
56
+ return kids === undefined
57
+ ? child
58
+ : cloneElement(child, undefined, stampIndices(kids, next));
48
59
  });
49
- const SelectScrollUpButton = (props) => (_jsx(GuiSelect.ScrollUpButton, { ...slot('select-scroll-up-button'), items: "center", justify: "center", py: "$1", ...props, children: _jsx(ChevronUp, { size: 16 }) }));
50
- const SelectScrollDownButton = (props) => (_jsx(GuiSelect.ScrollDownButton, { ...slot('select-scroll-down-button'), items: "center", justify: "center", py: "$1", ...props, children: _jsx(ChevronDown, { size: 16 }) }));
60
+ const SelectScrollUpButton = (props) => (_jsx(GuiSelect.ScrollUpButton, { ...slot("select-scroll-up-button"), items: "center", justify: "center", py: "$1", ...props, children: _jsx(ChevronUp, { size: 16 }) }));
61
+ const SelectScrollDownButton = (props) => (_jsx(GuiSelect.ScrollDownButton, { ...slot("select-scroll-down-button"), items: "center", justify: "center", py: "$1", ...props, children: _jsx(ChevronDown, { size: 16 }) }));
51
62
  const SelectContent = ({ children, ...props }) => {
52
63
  let n = 0;
53
- return (_jsxs(GuiSelect.Content, { ...slot('select-content'), ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(GuiSelect.Viewport, { minW: 128, p: "$1", bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: "$4", children: stampIndices(children, () => n++) }), _jsx(SelectScrollDownButton, {})] }));
64
+ return (_jsxs(GuiSelect.Content, { ...slot("select-content"), ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(GuiSelect.Viewport, { minW: 128, p: "$1", bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: "$4", children: stampIndices(children, () => n++) }), _jsx(SelectScrollDownButton, {})] }));
54
65
  };
55
- const SelectLabel = (props) => (_jsx(GuiSelect.Label, { ...slot('select-label'), px: "$2", py: "$1.5", fontSize: "$1", color: "$quiet", ...props }));
56
- const SelectSeparator = (props) => (_jsx(GuiSelectSeparator, { ...slot('select-separator'), my: "$1", borderColor: "$borderColor", ...props }));
66
+ const SelectLabel = (props) => (_jsx(GuiSelect.Label, { ...slot("select-label"), px: "$2", py: "$1.5", fontSize: "$1", color: "$quiet", ...props }));
67
+ const SelectSeparator = (props) => (_jsx(GuiSelectSeparator, { ...slot("select-separator"), my: "$1", borderColor: "$borderColor", ...props }));
57
68
  export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
58
69
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/backends/gui/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,eAAe,IAAI,kBAAkB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC/F,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EACxB,KAAC,SAAS,CAAC,QAAQ,IACjB,IAAI,EAAE,GAAG,EACT,CAAC,EAAC,IAAI,EACN,EAAE,EAAC,QAAQ,EACX,WAAW,EAAE,CAAC,EACd,WAAW,EAAC,cAAc,EAC1B,OAAO,EAAC,IAAI,YAEX,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,GACf,EACrB,KAAC,sBAAsB,KAAG,IACR,CACrB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE,CAAC,CAC/C,KAAC,SAAS,CAAC,KAAK,OACV,IAAI,CAAC,cAAc,CAAC,EACxB,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,MAAM,EACT,QAAQ,EAAC,IAAI,EACb,KAAK,EAAC,QAAQ,KACV,KAAK,GACT,CACH,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE,CAAC,CACvD,KAAC,kBAAkB,OACb,IAAI,CAAC,kBAAkB,CAAC,EAC5B,EAAE,EAAC,IAAI,EACP,WAAW,EAAC,cAAc,KACtB,KAAK,GACT,CACH,CAAA;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAA"}
@@ -3,20 +3,39 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.TooltipProvider = exports.TooltipContent = exports.TooltipTrigger = exports.Tooltip = void 0;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
- /** Tooltip — hover/focus hint. `TooltipProvider` is gui's `TooltipGroup`. */
6
+ /**
7
+ * Tooltip — hover/focus hint. `TooltipProvider` is gui's `TooltipGroup`.
8
+ *
9
+ * gui keeps the offset on the tooltip ROOT while the compound API spells it on
10
+ * Content, as `sideOffset`. One value, one owner: the root holds it, Content
11
+ * publishes into it — the same split `popover` resolves, for the same reason.
12
+ */
7
13
  const gui_1 = require("@hanzo/gui");
14
+ const react_1 = require("react");
8
15
  const portal_theme_1 = require("../../product/menu/portal-theme.cjs");
9
16
  const ink_1 = require("./ink.cjs");
10
17
  const slot_1 = require("./slot.cjs");
11
18
  const DEFAULT_OFFSET = 4;
12
- const Tooltip = (props) => (0, jsx_runtime_1.jsx)(gui_1.Tooltip, { offset: DEFAULT_OFFSET, ...props });
19
+ const Publish = /* @__PURE__ */ (0, react_1.createContext)(null);
20
+ const Tooltip = ({ offset = DEFAULT_OFFSET, ...props }) => {
21
+ const [placed, setPlaced] = (0, react_1.useState)({});
22
+ const publish = (0, react_1.useCallback)((p) => setPlaced((prev) => ({ ...prev, ...p })), []);
23
+ return ((0, jsx_runtime_1.jsx)(Publish.Provider, { value: publish, children: (0, jsx_runtime_1.jsx)(gui_1.Tooltip, { offset: placed.offset ?? offset, ...props }) }));
24
+ };
13
25
  exports.Tooltip = Tooltip;
14
26
  const TooltipTrigger = gui_1.Tooltip.Trigger;
15
27
  exports.TooltipTrigger = TooltipTrigger;
16
28
  const TooltipProvider = gui_1.TooltipGroup;
17
29
  exports.TooltipProvider = TooltipProvider;
18
- const TooltipContent = ({ sideOffset: _sideOffset, children, ...props }) => {
30
+ const TooltipContent = ({ sideOffset, children, ...props }) => {
19
31
  const themeName = (0, portal_theme_1.useThemeName)();
32
+ const publish = (0, react_1.useContext)(Publish);
33
+ // Only a Content that names an offset has anything to say about it; an absent
34
+ // one leaves whatever the root was given standing.
35
+ (0, react_1.useEffect)(() => {
36
+ if (sideOffset !== undefined)
37
+ publish?.({ offset: sideOffset });
38
+ }, [publish, sideOffset]);
20
39
  return ((0, jsx_runtime_1.jsx)(portal_theme_1.PortalTheme, { name: themeName, children: (0, jsx_runtime_1.jsx)(gui_1.Tooltip.Content, { ...(0, slot_1.slot)('tooltip-content'), bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", px: "$3", py: "$1.5", ...props, children: (0, ink_1.ink)(children, undefined, { size: '$1' }) }) }));
21
40
  };
22
41
  exports.TooltipContent = TooltipContent;
@@ -1,13 +1,21 @@
1
- /** Tooltip — hover/focus hint. `TooltipProvider` is gui's `TooltipGroup`. */
1
+ /**
2
+ * Tooltip — hover/focus hint. `TooltipProvider` is gui's `TooltipGroup`.
3
+ *
4
+ * gui keeps the offset on the tooltip ROOT while the compound API spells it on
5
+ * Content, as `sideOffset`. One value, one owner: the root holds it, Content
6
+ * publishes into it — the same split `popover` resolves, for the same reason.
7
+ */
2
8
  import { Tooltip as GuiTooltip, TooltipGroup } from '@hanzo/gui';
3
9
  import { type ComponentProps } from 'react';
4
- export type TooltipProps = ComponentProps<typeof GuiTooltip>;
10
+ export type TooltipProps = Omit<ComponentProps<typeof GuiTooltip>, 'offset'> & {
11
+ offset?: number;
12
+ };
5
13
  export type TooltipContentProps = ComponentProps<typeof GuiTooltip.Content> & {
6
14
  sideOffset?: number;
7
15
  };
8
- declare const Tooltip: (props: TooltipProps) => import("react").JSX.Element;
16
+ declare const Tooltip: ({ offset, ...props }: TooltipProps) => import("react").JSX.Element;
9
17
  declare const TooltipTrigger: typeof GuiTooltip.Trigger;
10
18
  declare const TooltipProvider: typeof TooltipGroup;
11
- declare const TooltipContent: ({ sideOffset: _sideOffset, children, ...props }: TooltipContentProps) => import("react").JSX.Element;
19
+ declare const TooltipContent: ({ sideOffset, children, ...props }: TooltipContentProps) => import("react").JSX.Element;
12
20
  export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
13
21
  //# sourceMappingURL=tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/tooltip.tsx"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,OAAO,CAAA;AAOtD,MAAM,MAAM,Y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AAc,EAAE,eAAe,EAAE,CAAA"}
@@ -1,16 +1,35 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- /** Tooltip — hover/focus hint. `TooltipProvider` is gui's `TooltipGroup`. */
3
+ /**
4
+ * Tooltip — hover/focus hint. `TooltipProvider` is gui's `TooltipGroup`.
5
+ *
6
+ * gui keeps the offset on the tooltip ROOT while the compound API spells it on
7
+ * Content, as `sideOffset`. One value, one owner: the root holds it, Content
8
+ * publishes into it — the same split `popover` resolves, for the same reason.
9
+ */
4
10
  import { Tooltip as GuiTooltip, TooltipGroup } from '@hanzo/gui';
11
+ import { createContext, useCallback, useContext, useEffect, useState, } from 'react';
5
12
  import { PortalTheme, useThemeName } from '../../product/menu/portal-theme.js';
6
13
  import { ink } from './ink.js';
7
14
  import { slot } from './slot.js';
8
15
  const DEFAULT_OFFSET = 4;
9
- const Tooltip = (props) => _jsx(GuiTooltip, { offset: DEFAULT_OFFSET, ...props });
16
+ const Publish = /* @__PURE__ */ createContext(null);
17
+ const Tooltip = ({ offset = DEFAULT_OFFSET, ...props }) => {
18
+ const [placed, setPlaced] = useState({});
19
+ const publish = useCallback((p) => setPlaced((prev) => ({ ...prev, ...p })), []);
20
+ return (_jsx(Publish.Provider, { value: publish, children: _jsx(GuiTooltip, { offset: placed.offset ?? offset, ...props }) }));
21
+ };
10
22
  const TooltipTrigger = GuiTooltip.Trigger;
11
23
  const TooltipProvider = TooltipGroup;
12
- const TooltipContent = ({ sideOffset: _sideOffset, children, ...props }) => {
24
+ const TooltipContent = ({ sideOffset, children, ...props }) => {
13
25
  const themeName = useThemeName();
26
+ const publish = useContext(Publish);
27
+ // Only a Content that names an offset has anything to say about it; an absent
28
+ // one leaves whatever the root was given standing.
29
+ useEffect(() => {
30
+ if (sideOffset !== undefined)
31
+ publish?.({ offset: sideOffset });
32
+ }, [publish, sideOffset]);
14
33
  return (_jsx(PortalTheme, { name: themeName, children: _jsx(GuiTooltip.Content, { ...slot('tooltip-content'), bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", px: "$3", py: "$1.5", ...props, children: ink(children, undefined, { size: '$1' }) }) }));
15
34
  };
16
35
  export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/backends/gui/tooltip.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,6EAA6E;AAC7E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEhE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,MAAM,cAAc,GAAG,CAAC,CAAA;AAKxB,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,EAAE,CAAC,KAAC,UAAU,IAAC,MAAM,EAAE,cAAc,KAAM,KAAK,GAAI,CAAA;AAC1F,MAAM,cAAc,GAA8B,UAAU,CAAC,OAAO,CAAA;AACpE,MAAM,eAAe,GAAwB,YAAY,CAAA;AAEzD,MAAM,cAAc,GAAG,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAuB,EAAE,EAAE;IAC9F,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,OAAO,CACL,KAAC,WAAW,IAAC,IAAI,EAAE,SAAS,YAC1B,KAAC,UAAU,CAAC,OAAO,OACb,IAAI,CAAC,iBAAiB,CAAC,EAC3B,EAAE,EAAC,QAAQ,EACX,WAAW,EAAE,CAAC,EACd,WAAW,EAAC,cAAc,EAC1B,OAAO,EAAC,IAAI,EACZ,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,MAAM,KACL,KAAK,YAER,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,IA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AAA;AACD,MAAM,cAAc,GAA8B,UAAU,CAAC,OAAO,CAAA;AACpE,MAAM,eAAe,GAAwB,YAAY,CAAA;AAEzD,MAAM,cAAc,GAAG,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAuB,EAAE,EAAE;IACjF,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IACnC,8EAA8E;IAC9E,mDAAmD;IACnD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,UAAU,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAA;IACjE,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAA;IACzB,OAAO,CACL,KAAC,WAAW,IAAC,IAAI,EAAE,SAAS,YAC1B,KAAC,UAAU,CAAC,OAAO,OACb,IAAI,CAAC,iBAAiB,CAAC,EAC3B,EAAE,EAAC,QAAQ,EACX,WAAW,EAAE,CAAC,EACd,WAAW,EAAC,cAAc,EAC1B,OAAO,EAAC,IAAI,EACZ,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,MAAM,KACL,KAAK,YAER,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GACtB,GACT,CACf,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAA"}
package/dist/gallery.html CHANGED
@@ -1,4 +1,4 @@
1
- <!doctype html><html lang="en" class="t_dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>@hanzo/ui 8.27.4</title><style>/* @hanzo/ui — generated by scripts/gen-css.mjs. Do not edit. */
1
+ <!doctype html><html lang="en" class="t_dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>@hanzo/ui 8.27.5</title><style>/* @hanzo/ui — generated by scripts/gen-css.mjs. Do not edit. */
2
2
  :root { --hanzo-ui-styles: 1; }
3
3
  /* Hanzo Design System — the entry point. Import THIS one file.
4
4
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "8.27.4",
3
+ "version": "8.27.5",
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": {