@hanzo/ui 8.0.72 → 8.0.73

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,7 +1,7 @@
1
1
  'use client';"use strict";
2
2
  'use client';
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.PopoverClose = exports.PopoverAnchor = exports.PopoverContent = exports.PopoverTrigger = void 0;
4
+ exports.PopoverClose = exports.PopoverAnchor = exports.PopoverContent = exports.PopoverTrigger = exports.place = void 0;
5
5
  exports.Popover = Popover;
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  /**
@@ -9,20 +9,36 @@ const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  *
10
10
  * `PopoverContent` mounts its own portal and re-applies the trigger's resolved
11
11
  * theme inside it (gui portals re-root the subtree, so theme context does not
12
- * flow). `sideOffset` lands on the popper root, which is where gui keeps it.
12
+ * flow).
13
+ *
14
+ * gui keeps BOTH placement facts on the popper ROOT — `offset` and `placement`
15
+ * — while the compound API spells them on Content, as `sideOffset` and `align`.
16
+ * One value, one owner: the root holds them, Content publishes into it.
13
17
  */
14
18
  const gui_1 = require("@hanzo/gui");
15
19
  const react_1 = require("react");
16
20
  const portal_theme_1 = require("../../product/menu/portal-theme.cjs");
17
21
  const slot_1 = require("./slot.cjs");
18
22
  const DEFAULT_OFFSET = 4;
19
- /** gui puts `offset` on the popper ROOT; the compound API puts `sideOffset` on
20
- * Content. One value, one owner: the root holds it, Content publishes into it. */
21
- const OffsetContext = /* @__PURE__ */ (0, react_1.createContext)(null);
22
- function Popover({ offset = DEFAULT_OFFSET, ...props }) {
23
- const [current, setOffset] = (0, react_1.useState)(offset);
24
- (0, react_1.useEffect)(() => setOffset(offset), [offset]);
25
- return ((0, jsx_runtime_1.jsx)(OffsetContext.Provider, { value: setOffset, children: (0, jsx_runtime_1.jsx)(gui_1.Popover, { offset: current, ...props }) }));
23
+ const DEFAULT_SIDE = 'bottom';
24
+ /**
25
+ * The placement a SIDE and an ALIGN name together. gui speaks floating-ui's
26
+ * one string; the compound API splits the same fact in two, so this rejoins
27
+ * them. `center` is the ABSENCE of a suffix rather than a suffix of its own,
28
+ * and a side that already carries one is re-aligned rather than appended to.
29
+ *
30
+ * Example: place('bottom', 'start') === 'bottom-start'
31
+ */
32
+ const place = (side, align = 'center') => {
33
+ const base = side.split('-')[0];
34
+ return align === 'center' ? base : `${base}-${align}`;
35
+ };
36
+ exports.place = place;
37
+ const Publish = /* @__PURE__ */ (0, react_1.createContext)(null);
38
+ function Popover({ offset = DEFAULT_OFFSET, placement, ...props }) {
39
+ const [placed, setPlaced] = (0, react_1.useState)({});
40
+ const publish = (0, react_1.useCallback)((p) => setPlaced((prev) => ({ ...prev, ...p })), []);
41
+ return ((0, jsx_runtime_1.jsx)(Publish.Provider, { value: publish, children: (0, jsx_runtime_1.jsx)(gui_1.Popover, { offset: placed.offset ?? offset, placement: (0, exports.place)(placement ?? DEFAULT_SIDE, placed.align), ...props }) }));
26
42
  }
27
43
  const PopoverTrigger = gui_1.Popover.Trigger;
28
44
  exports.PopoverTrigger = PopoverTrigger;
@@ -30,10 +46,10 @@ const PopoverAnchor = gui_1.Popover.Anchor;
30
46
  exports.PopoverAnchor = PopoverAnchor;
31
47
  const PopoverClose = gui_1.Popover.Close;
32
48
  exports.PopoverClose = PopoverClose;
33
- const PopoverContent = ({ sideOffset = DEFAULT_OFFSET, align: _align, ...props }) => {
49
+ const PopoverContent = ({ sideOffset = DEFAULT_OFFSET, align, ...props }) => {
34
50
  const themeName = (0, portal_theme_1.useThemeName)();
35
- const setOffset = (0, react_1.useContext)(OffsetContext);
36
- (0, react_1.useEffect)(() => setOffset?.(sideOffset), [setOffset, sideOffset]);
51
+ const publish = (0, react_1.useContext)(Publish);
52
+ (0, react_1.useEffect)(() => publish?.({ offset: sideOffset, align }), [publish, sideOffset, align]);
37
53
  return ((0, jsx_runtime_1.jsx)(portal_theme_1.PortalTheme, { name: themeName, children: (0, jsx_runtime_1.jsx)(gui_1.Popover.Content, { ...(0, slot_1.slot)('popover-content'), bg: "$color2", borderWidth: 1, borderColor: "$borderColor", rounded: "$4", p: "$4", width: 288, ...props }) }));
38
54
  };
39
55
  exports.PopoverContent = PopoverContent;
@@ -3,21 +3,35 @@
3
3
  *
4
4
  * `PopoverContent` mounts its own portal and re-applies the trigger's resolved
5
5
  * theme inside it (gui portals re-root the subtree, so theme context does not
6
- * flow). `sideOffset` lands on the popper root, which is where gui keeps it.
6
+ * flow).
7
+ *
8
+ * gui keeps BOTH placement facts on the popper ROOT — `offset` and `placement`
9
+ * — while the compound API spells them on Content, as `sideOffset` and `align`.
10
+ * One value, one owner: the root holds them, Content publishes into it.
7
11
  */
8
12
  import { Popover as GuiPopover } from '@hanzo/gui';
9
13
  import { type ComponentProps } from 'react';
14
+ export type Align = 'start' | 'center' | 'end';
15
+ /**
16
+ * The placement a SIDE and an ALIGN name together. gui speaks floating-ui's
17
+ * one string; the compound API splits the same fact in two, so this rejoins
18
+ * them. `center` is the ABSENCE of a suffix rather than a suffix of its own,
19
+ * and a side that already carries one is re-aligned rather than appended to.
20
+ *
21
+ * Example: place('bottom', 'start') === 'bottom-start'
22
+ */
23
+ export declare const place: (side: string, align?: Align) => string;
10
24
  export type PopoverProps = Omit<ComponentProps<typeof GuiPopover>, 'offset'> & {
11
25
  offset?: number;
12
26
  };
13
- declare function Popover({ offset, ...props }: PopoverProps): import("react/jsx-runtime").JSX.Element;
27
+ declare function Popover({ offset, placement, ...props }: PopoverProps): import("react/jsx-runtime").JSX.Element;
14
28
  declare const PopoverTrigger: typeof GuiPopover.Trigger;
15
29
  declare const PopoverAnchor: typeof GuiPopover.Anchor;
16
30
  declare const PopoverClose: typeof GuiPopover.Close;
17
31
  export type PopoverContentProps = ComponentProps<typeof GuiPopover.Content> & {
18
32
  sideOffset?: number;
19
- align?: 'start' | 'center' | 'end';
33
+ align?: Align;
20
34
  };
21
- declare const PopoverContent: ({ sideOffset, align: _align, ...props }: PopoverContentProps) => import("react/jsx-runtime").JSX.Element;
35
+ declare const PopoverContent: ({ sideOffset, align, ...props }: PopoverContentProps) => import("react/jsx-runtime").JSX.Element;
22
36
  export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverClose };
23
37
  //# sourceMappingURL=popover.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/popover.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAkD,KAAK,cAAc,EAAE,MAAM,OAAO,CAAA;AAU3F,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAElG,iBAAS,OAAO,CAAC,EAAE,MAAuB,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,2CAQnE;AAED,QAAA,MAAM,cAAc,EAAE,OAAO,UAAU,CAAC,OAA4B,CAAA;AACpE,QAAA,MAAM,aAAa,EAAE,OAAO,UAAU,CAAC,MAA0B,CAAA;AACjE,QAAA,MAAM,YAAY,EAAE,OAAO,UAAU,CAAC,KAAwB,CAAA;AAE9D,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;CACnC,CAAA;AAED,QAAA,MAAM,cAAc,GAAI,yCAA0D,mBAAmB,4CAkBpG,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/popover.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,OAAO,CAAA;AAOd,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,EAAE,QAAO,KAAgB,KAAG,MAG7D,CAAA;AAOD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAElG,iBAAS,OAAO,CAAC,EAAE,MAAuB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,2CAY9E;AAED,QAAA,MAAM,cAAc,EAAE,OAAO,UAAU,CAAC,OAA4B,CAAA;AACpE,QAAA,MAAM,aAAa,EAAE,OAAO,UAAU,CAAC,MAA0B,CAAA;AACjE,QAAA,MAAM,YAAY,EAAE,OAAO,UAAU,CAAC,KAAwB,CAAA;AAE9D,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,QAAA,MAAM,cAAc,GAAI,iCAAkD,mBAAmB,4CAkB5F,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA"}
@@ -5,28 +5,43 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  *
6
6
  * `PopoverContent` mounts its own portal and re-applies the trigger's resolved
7
7
  * theme inside it (gui portals re-root the subtree, so theme context does not
8
- * flow). `sideOffset` lands on the popper root, which is where gui keeps it.
8
+ * flow).
9
+ *
10
+ * gui keeps BOTH placement facts on the popper ROOT — `offset` and `placement`
11
+ * — while the compound API spells them on Content, as `sideOffset` and `align`.
12
+ * One value, one owner: the root holds them, Content publishes into it.
9
13
  */
10
14
  import { Popover as GuiPopover } from '@hanzo/gui';
11
- import { createContext, useContext, useEffect, useState } from 'react';
15
+ import { createContext, useCallback, useContext, useEffect, useState, } from 'react';
12
16
  import { PortalTheme, useThemeName } from '../../product/menu/portal-theme.js';
13
17
  import { slot } from './slot.js';
14
18
  const DEFAULT_OFFSET = 4;
15
- /** gui puts `offset` on the popper ROOT; the compound API puts `sideOffset` on
16
- * Content. One value, one owner: the root holds it, Content publishes into it. */
17
- const OffsetContext = /* @__PURE__ */ createContext(null);
18
- function Popover({ offset = DEFAULT_OFFSET, ...props }) {
19
- const [current, setOffset] = useState(offset);
20
- useEffect(() => setOffset(offset), [offset]);
21
- return (_jsx(OffsetContext.Provider, { value: setOffset, children: _jsx(GuiPopover, { offset: current, ...props }) }));
19
+ const DEFAULT_SIDE = 'bottom';
20
+ /**
21
+ * The placement a SIDE and an ALIGN name together. gui speaks floating-ui's
22
+ * one string; the compound API splits the same fact in two, so this rejoins
23
+ * them. `center` is the ABSENCE of a suffix rather than a suffix of its own,
24
+ * and a side that already carries one is re-aligned rather than appended to.
25
+ *
26
+ * Example: place('bottom', 'start') === 'bottom-start'
27
+ */
28
+ export const place = (side, align = 'center') => {
29
+ const base = side.split('-')[0];
30
+ return align === 'center' ? base : `${base}-${align}`;
31
+ };
32
+ const Publish = /* @__PURE__ */ createContext(null);
33
+ function Popover({ offset = DEFAULT_OFFSET, placement, ...props }) {
34
+ const [placed, setPlaced] = useState({});
35
+ const publish = useCallback((p) => setPlaced((prev) => ({ ...prev, ...p })), []);
36
+ return (_jsx(Publish.Provider, { value: publish, children: _jsx(GuiPopover, { offset: placed.offset ?? offset, placement: place(placement ?? DEFAULT_SIDE, placed.align), ...props }) }));
22
37
  }
23
38
  const PopoverTrigger = GuiPopover.Trigger;
24
39
  const PopoverAnchor = GuiPopover.Anchor;
25
40
  const PopoverClose = GuiPopover.Close;
26
- const PopoverContent = ({ sideOffset = DEFAULT_OFFSET, align: _align, ...props }) => {
41
+ const PopoverContent = ({ sideOffset = DEFAULT_OFFSET, align, ...props }) => {
27
42
  const themeName = useThemeName();
28
- const setOffset = useContext(OffsetContext);
29
- useEffect(() => setOffset?.(sideOffset), [setOffset, sideOffset]);
43
+ const publish = useContext(Publish);
44
+ useEffect(() => publish?.({ offset: sideOffset, align }), [publish, sideOffset, align]);
30
45
  return (_jsx(PortalTheme, { name: themeName, children: _jsx(GuiPopover.Content, { ...slot('popover-content'), bg: "$color2", borderWidth: 1, borderColor: "$borderColor", rounded: "$4", p: "$4", width: 288, ...props }) }));
31
46
  };
32
47
  export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverClose };
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","sourceRoot":"","sources":["../../../src/backends/gui/popover.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAA;AAC3F,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,MAAM,cAAc,GAAG,CAAC,CAAA;AAExB;mFACmF;AACnF,MAAM,aAAa,GAAG,eAAe,CAAC,aAAa,CAA+B,IAAI,CAAC,CAAA;AAIvF,SAAS,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,GAAG,KAAK,EAAgB;IAClE,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC7C,SAAS,CAAC,GAAG,EAAE,CAAC,SA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MAAM,CAAC,KAAK,CAAqB,KACzE,KAAK,GACT,GACe,CACpB,CAAA;AACH,CAAC;AAED,MAAM,cAAc,GAA8B,UAAU,CAAC,OAAO,CAAA;AACpE,MAAM,aAAa,GAA6B,UAAU,CAAC,MAAM,CAAA;AACjE,MAAM,YAAY,GAA4B,UAAU,CAAC,KAAK,CAAA;AAO9D,MAAM,cAAc,GAAG,CAAC,EAAE,UAAU,GAAG,cAAc,EAAE,KAAK,EAAE,GAAG,KAAK,EAAuB,EAAE,EAAE;IAC/F,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IACnC,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAA;IACvF,OAAO,CACL,KAAC,WAAW,IAAC,IAAI,EAAE,SAAS,YAC1B,KAAC,UAAU,CAAC,OAAO,OACb,IAAI,CAAC,iBAAiB,CAAC,EAC3B,EAAE,EAAC,SAAS,EACZ,WAAW,EAAE,CAAC,EACd,WAAW,EAAC,cAAc,EAC1B,OAAO,EAAC,IAAI,EACZ,CAAC,EAAC,IAAI,EACN,KAAK,EAAE,GAAG,KACN,KAAK,GACT,GACU,CACf,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA"}
@@ -1,7 +1,7 @@
1
1
  'use client';"use strict";
2
2
  'use client';
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Slider = void 0;
4
+ exports.Slider = exports.named = void 0;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  /** Slider — 6px track, 16px thumb, `touch()` to the 44px floor on every target. */
7
7
  const gui_1 = require("@hanzo/gui");
@@ -9,12 +9,36 @@ const slot_1 = require("./slot.cjs");
9
9
  const gesture_1 = require("./gesture.cjs");
10
10
  const TRACK = 6;
11
11
  const THUMB = 16;
12
- const Slider = (props) => ((0, jsx_runtime_1.jsxs)(gui_1.Slider, { ...(0, slot_1.slot)('slider'), width: "100%", ...props, children: [(0, jsx_runtime_1.jsx)(gui_1.Slider.Track, { ...(0, slot_1.slot)('slider-track'), height: TRACK, bg: "$color4", rounded: "$10", children: (0, jsx_runtime_1.jsx)(gui_1.Slider.TrackActive, { ...(0, slot_1.slot)('slider-range'), bg: "$color12" }) }), (0, jsx_runtime_1.jsx)(gui_1.Slider.Thumb, { ...(0, slot_1.slot)('slider-thumb'), index: 0, circular: true, size: THUMB,
13
- // A FILLED knob, no ring. It used to be a dark knob ringed in `$color12`,
14
- // which is #fff on dark the one border value the identity does not
15
- // allow. `$borderColor` is not the fix either: gui gives the thumb its own
16
- // `SliderThumb` sub-theme, where that token is white as well. A filled
17
- // knob needs no border, and `$color12` reads on both themes (white on
18
- // dark, near-black on light).
19
- bg: "$color12", borderWidth: 0, ...(0, gesture_1.touch)(THUMB) })] }));
12
+ /**
13
+ * The name belongs where the ROLE is. gui puts `role="slider"` on the Thumb,
14
+ * so a name spread onto the root lands on a plain container that no screen
15
+ * reader announces the control reads as an unlabelled slider. These are the
16
+ * naming and description properties an ARIA slider must carry; everything else
17
+ * (value, range, step, orientation, disabled) is the root's and stays there.
18
+ */
19
+ const NAMES = ['aria-label', 'aria-labelledby', 'aria-describedby', 'aria-valuetext'];
20
+ /** Splits a caller's props into what the thumb must carry and what the root keeps. */
21
+ const named = (props) => {
22
+ const name = {};
23
+ const rest = {};
24
+ for (const [k, v] of Object.entries(props)) {
25
+ if (NAMES.includes(k))
26
+ name[k] = v;
27
+ else
28
+ rest[k] = v;
29
+ }
30
+ return { name, rest };
31
+ };
32
+ exports.named = named;
33
+ const Slider = (props) => {
34
+ const { name, rest } = (0, exports.named)(props);
35
+ return ((0, jsx_runtime_1.jsxs)(gui_1.Slider, { ...(0, slot_1.slot)('slider'), width: "100%", ...rest, children: [(0, jsx_runtime_1.jsx)(gui_1.Slider.Track, { ...(0, slot_1.slot)('slider-track'), height: TRACK, bg: "$color4", rounded: "$10", children: (0, jsx_runtime_1.jsx)(gui_1.Slider.TrackActive, { ...(0, slot_1.slot)('slider-range'), bg: "$color12" }) }), (0, jsx_runtime_1.jsx)(gui_1.Slider.Thumb, { ...(0, slot_1.slot)('slider-thumb'), index: 0, circular: true, size: THUMB,
36
+ // A FILLED knob, no ring. It used to be a dark knob ringed in `$color12`,
37
+ // which is #fff on dark — the one border value the identity does not
38
+ // allow. `$borderColor` is not the fix either: gui gives the thumb its own
39
+ // `SliderThumb` sub-theme, where that token is white as well. A filled
40
+ // knob needs no border, and `$color12` reads on both themes (white on
41
+ // dark, near-black on light).
42
+ bg: "$color12", borderWidth: 0, ...(0, gesture_1.touch)(THUMB), ...name })] }));
43
+ };
20
44
  exports.Slider = Slider;
@@ -1,6 +1,22 @@
1
1
  /** Slider — 6px track, 16px thumb, `touch()` to the 44px floor on every target. */
2
2
  import { Slider as GuiSlider } from '@hanzo/gui';
3
3
  import type { ComponentProps } from 'react';
4
+ /**
5
+ * The name belongs where the ROLE is. gui puts `role="slider"` on the Thumb,
6
+ * so a name spread onto the root lands on a plain container that no screen
7
+ * reader announces — the control reads as an unlabelled slider. These are the
8
+ * naming and description properties an ARIA slider must carry; everything else
9
+ * (value, range, step, orientation, disabled) is the root's and stays there.
10
+ */
11
+ declare const NAMES: readonly ["aria-label", "aria-labelledby", "aria-describedby", "aria-valuetext"];
12
+ type Name = (typeof NAMES)[number];
13
+ /** An ARIA naming property is a string by contract, so the split says so. */
14
+ type Names = Partial<Record<Name, string>>;
15
+ /** Splits a caller's props into what the thumb must carry and what the root keeps. */
16
+ export declare const named: (props: Record<string, unknown>) => {
17
+ name: Names;
18
+ rest: Record<string, unknown>;
19
+ };
4
20
  export type SliderProps = ComponentProps<typeof GuiSlider>;
5
21
  declare const Slider: (props: SliderProps) => import("react/jsx-runtime").JSX.Element;
6
22
  export { Slider };
@@ -1 +1 @@
1
- {"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/slider.tsx"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAO3C,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAA;AAE1D,QAAA,MAAM,MAAM,GAAI,OAAO,WAAW,4CAqBjC,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/slider.tsx"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAO3C;;;;;;GAMG;AACH,QAAA,MAAM,KAAK,kFAAmF,CAAA;AAE9F,KAAK,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAA;AAElC,6EAA6E;AAC7E,KAAK,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;AAE1C,sFAAsF;AACtF,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAQlG,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAA;AAE1D,QAAA,MAAM,MAAM,GAAI,OAAO,WAAW,4CAyBjC,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -6,13 +6,36 @@ import { slot } from './slot.js';
6
6
  import { touch } from './gesture.js';
7
7
  const TRACK = 6;
8
8
  const THUMB = 16;
9
- const Slider = (props) => (_jsxs(GuiSlider, { ...slot('slider'), width: "100%", ...props, children: [_jsx(GuiSlider.Track, { ...slot('slider-track'), height: TRACK, bg: "$color4", rounded: "$10", children: _jsx(GuiSlider.TrackActive, { ...slot('slider-range'), bg: "$color12" }) }), _jsx(GuiSlider.Thumb, { ...slot('slider-thumb'), index: 0, circular: true, size: THUMB,
10
- // A FILLED knob, no ring. It used to be a dark knob ringed in `$color12`,
11
- // which is #fff on dark the one border value the identity does not
12
- // allow. `$borderColor` is not the fix either: gui gives the thumb its own
13
- // `SliderThumb` sub-theme, where that token is white as well. A filled
14
- // knob needs no border, and `$color12` reads on both themes (white on
15
- // dark, near-black on light).
16
- bg: "$color12", borderWidth: 0, ...touch(THUMB) })] }));
9
+ /**
10
+ * The name belongs where the ROLE is. gui puts `role="slider"` on the Thumb,
11
+ * so a name spread onto the root lands on a plain container that no screen
12
+ * reader announces the control reads as an unlabelled slider. These are the
13
+ * naming and description properties an ARIA slider must carry; everything else
14
+ * (value, range, step, orientation, disabled) is the root's and stays there.
15
+ */
16
+ const NAMES = ['aria-label', 'aria-labelledby', 'aria-describedby', 'aria-valuetext'];
17
+ /** Splits a caller's props into what the thumb must carry and what the root keeps. */
18
+ export const named = (props) => {
19
+ const name = {};
20
+ const rest = {};
21
+ for (const [k, v] of Object.entries(props)) {
22
+ if (NAMES.includes(k))
23
+ name[k] = v;
24
+ else
25
+ rest[k] = v;
26
+ }
27
+ return { name, rest };
28
+ };
29
+ const Slider = (props) => {
30
+ const { name, rest } = named(props);
31
+ return (_jsxs(GuiSlider, { ...slot('slider'), width: "100%", ...rest, children: [_jsx(GuiSlider.Track, { ...slot('slider-track'), height: TRACK, bg: "$color4", rounded: "$10", children: _jsx(GuiSlider.TrackActive, { ...slot('slider-range'), bg: "$color12" }) }), _jsx(GuiSlider.Thumb, { ...slot('slider-thumb'), index: 0, circular: true, size: THUMB,
32
+ // A FILLED knob, no ring. It used to be a dark knob ringed in `$color12`,
33
+ // which is #fff on dark — the one border value the identity does not
34
+ // allow. `$borderColor` is not the fix either: gui gives the thumb its own
35
+ // `SliderThumb` sub-theme, where that token is white as well. A filled
36
+ // knob needs no border, and `$color12` reads on both themes (white on
37
+ // dark, near-black on light).
38
+ bg: "$color12", borderWidth: 0, ...touch(THUMB), ...name })] }));
39
+ };
17
40
  export { Slider };
18
41
  //# sourceMappingURL=slider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../src/backends/gui/slider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,mFAAmF;AACnF,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEjC,MAAM,KAAK,GAAG,CAAC,CAAA;AACf,MAAM,KAAK,GAAG,EAAE,CAAA;AAIhB,MAAM,MAAM,GAAG,CAAC,KAAkB,EAAE,EAAE,CAAC,CACrC,MAAC,SAAS,OAAK,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAC,MAAM,KAAK,KAAK,aACnD,KAAC,SAAS,CAAC,KAAK,OAAK,IAAI,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAC,SAAS,EAAC,OAAO,EAAC,KAAK,YAClF,KAAC,SAAS,CAAC,WAAW,OAAK,IAAI,CAAC,cAAc,CAAC,EAAE,EAAE,EAAC,UAAU,GAAG,GACjD,EAClB,KAAC,SAAS,CAAC,KAAK,OACV,IAAI,CAAC,cAAc,CAAC,EACxB,KAAK,EAAE,CAAC,EACR,QAAQ,QACR,IAAI,EAAE,KAAK;YACX,0EAA0E;YAC1E,qEAAqE;YACrE,2EAA2E;YAC3E,uEAAuE;YACvE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,CACL,MAAC,SAAS,OAAK,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAC,MAAM,KAAK,IAAI,aAClD,KAAC,SAAS,CAAC,KAAK,OAAK,IAAI,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAC,SAAS,EAAC,OAAO,EAAC,KAAK,YAClF,KAAC,SAAS,CAAC,WAAW,OAAK,IAAI,CAAC,cAAc,CAAC,EAAE,EAAE,EAAC,UAAU,GAAG,GACjD,EAClB,KAAC,SAAS,CAAC,KAAK,OACV,IAAI,CAAC,cAAc,CAAC,EACxB,KAAK,EAAE,CAAC,EACR,QAAQ,QACR,IAAI,EAAE,KAAK;gBACX,0EAA0E;gBAC1E,qEAAqE;gBACrE,2EAA2E;gBAC3E,uEAAuE;gBACvE,sEAAsE;gBACtE,8BAA8B;gBAC9B,EAAE,EAAC,UAAU,EACb,WAAW,EAAE,CAAC,KACV,KAAK,CAAC,KAAK,CAAC,KACZ,IAAI,GACR,IACQ,CACb,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "8.0.72",
3
+ "version": "8.0.73",
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": {