@hanzo/ui 8.27.87 → 8.27.88

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.
@@ -9,14 +9,31 @@ const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  */
10
10
  const gui_1 = require("@hanzo/gui");
11
11
  const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
12
+ const react_1 = require("react");
12
13
  const slot_1 = require("./slot.cjs");
13
14
  const gesture_1 = require("./gesture.cjs");
14
15
  const BOX = 16;
15
- const Checkbox = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Checkbox, { ...(0, slot_1.slot)('checkbox'), width: BOX, height: BOX, flexShrink: 0, borderRadius: "$2", borderWidth: 1,
16
+ /**
17
+ * The mark: a tick when checked, a dash when indeterminate. `$ink` on the
18
+ * transparent well, as the RadioGroup dot, so it reads on either theme's ground.
19
+ * Stroke 3 of lucide's 24-unit box is 1.6px at 13px.
20
+ */
21
+ const Mark = () => {
22
+ const Icon = (0, react_1.useContext)(gui_1.CheckboxContext).checked === 'indeterminate' ? lucide_icons_2_1.Minus : lucide_icons_2_1.Check;
23
+ return (0, jsx_runtime_1.jsx)(Icon, { size: BOX - 3, color: "$ink", strokeWidth: 3 });
24
+ };
25
+ const Checkbox = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Checkbox, { ...(0, slot_1.slot)('checkbox'), width: BOX, height: BOX, flexShrink: 0,
26
+ // The frame is a <button>, which the user agent pads 1px 6px: on a 16px
27
+ // border box that leaves a 2px-wide content box and squeezes the 13px mark
28
+ // to 2px. Zero padding gives the mark the whole 14px inside the border.
29
+ padding: 0, borderRadius: "$2", borderWidth: 1,
16
30
  // A CONTROL boundary, not a surface hairline. `$borderColor` is 10% white —
17
31
  // right for a card edge sitting on its own fill, and 1.26:1 against the
18
32
  // ground, where WCAG 1.4.11 asks 3:1 for the visible boundary of a control.
19
33
  // An unchecked box was therefore not quiet, it was absent. `$bound` is
20
34
  // 3.45:1. The two jobs shared one token and only one of them was satisfied.
21
- borderColor: "$bound", backgroundColor: "transparent", ...(0, gesture_1.touch)(BOX), ...props, children: (0, jsx_runtime_1.jsx)(gui_1.Checkbox.Indicator, { ...(0, slot_1.slot)('checkbox-indicator'), alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Check, { size: BOX - 3 }) }) }));
35
+ borderColor: "$bound", backgroundColor: "transparent",
36
+ // gui fills a checked box with `$backgroundActive` unless `activeStyle` is
37
+ // given; the well stays transparent so the `$ink` mark keeps its contrast.
38
+ activeStyle: { bg: 'transparent' }, ...(0, gesture_1.touch)(BOX), ...props, children: (0, jsx_runtime_1.jsx)(gui_1.Checkbox.Indicator, { ...(0, slot_1.slot)('checkbox-indicator'), alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(Mark, {}) }) }));
22
39
  exports.Checkbox = Checkbox;
@@ -3,7 +3,7 @@
3
3
  * @hanzogui/checkbox owns the checked/indeterminate state and a11y.
4
4
  */
5
5
  import { Checkbox as GuiCheckbox } from '@hanzo/gui';
6
- import type { ComponentProps } from 'react';
6
+ import { type ComponentProps } from 'react';
7
7
  export type CheckboxProps = ComponentProps<typeof GuiCheckbox>;
8
8
  declare const Checkbox: (props: CheckboxProps) => import("react").JSX.Element;
9
9
  export { Checkbox };
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/checkbox.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AACH,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,YAAY,CAAA;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAM3C,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAA;AAE9D,QAAA,MAAM,QAAQ,UAAW,aAAa,gCAsBrC,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/checkbox.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AACH,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAmB,MAAM,YAAY,CAAA;AAErE,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAA;AAMvD,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAA;AAY9D,QAAA,MAAM,QAAQ,UAAW,aAAa,gCA6BrC,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
@@ -4,17 +4,34 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  * Checkbox — 16px box, `touch()` to the 44px floor on web and native alike.
5
5
  * @hanzogui/checkbox owns the checked/indeterminate state and a11y.
6
6
  */
7
- import { Checkbox as GuiCheckbox } from '@hanzo/gui';
8
- import { Check } from '@hanzogui/lucide-icons-2';
7
+ import { Checkbox as GuiCheckbox, CheckboxContext } from '@hanzo/gui';
8
+ import { Check, Minus } from '@hanzogui/lucide-icons-2';
9
+ import { useContext } from 'react';
9
10
  import { slot } from './slot.js';
10
11
  import { touch } from './gesture.js';
11
12
  const BOX = 16;
12
- const Checkbox = (props) => (_jsx(GuiCheckbox, { ...slot('checkbox'), width: BOX, height: BOX, flexShrink: 0, borderRadius: "$2", borderWidth: 1,
13
+ /**
14
+ * The mark: a tick when checked, a dash when indeterminate. `$ink` on the
15
+ * transparent well, as the RadioGroup dot, so it reads on either theme's ground.
16
+ * Stroke 3 of lucide's 24-unit box is 1.6px at 13px.
17
+ */
18
+ const Mark = () => {
19
+ const Icon = useContext(CheckboxContext).checked === 'indeterminate' ? Minus : Check;
20
+ return _jsx(Icon, { size: BOX - 3, color: "$ink", strokeWidth: 3 });
21
+ };
22
+ const Checkbox = (props) => (_jsx(GuiCheckbox, { ...slot('checkbox'), width: BOX, height: BOX, flexShrink: 0,
23
+ // The frame is a <button>, which the user agent pads 1px 6px: on a 16px
24
+ // border box that leaves a 2px-wide content box and squeezes the 13px mark
25
+ // to 2px. Zero padding gives the mark the whole 14px inside the border.
26
+ padding: 0, borderRadius: "$2", borderWidth: 1,
13
27
  // A CONTROL boundary, not a surface hairline. `$borderColor` is 10% white —
14
28
  // right for a card edge sitting on its own fill, and 1.26:1 against the
15
29
  // ground, where WCAG 1.4.11 asks 3:1 for the visible boundary of a control.
16
30
  // An unchecked box was therefore not quiet, it was absent. `$bound` is
17
31
  // 3.45:1. The two jobs shared one token and only one of them was satisfied.
18
- borderColor: "$bound", backgroundColor: "transparent", ...touch(BOX), ...props, children: _jsx(GuiCheckbox.Indicator, { ...slot('checkbox-indicator'), alignItems: "center", justifyContent: "center", children: _jsx(Check, { size: BOX - 3 }) }) }));
32
+ borderColor: "$bound", backgroundColor: "transparent",
33
+ // gui fills a checked box with `$backgroundActive` unless `activeStyle` is
34
+ // given; the well stays transparent so the `$ink` mark keeps its contrast.
35
+ activeStyle: { bg: 'transparent' }, ...touch(BOX), ...props, children: _jsx(GuiCheckbox.Indicator, { ...slot('checkbox-indicator'), alignItems: "center", justifyContent: "center", children: _jsx(Mark, {}) }) }));
19
36
  export { Checkbox };
20
37
  //# sourceMappingURL=checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/backends/gui/checkbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;GAGG;AACH,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEjC,MAAM,GAAG,GAAG,EAAE,CAAA;AAId,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE,CAAC,CACzC,KAAC,WAAW,OACN,IAAI,CAAC,UAAU,CAAC,EACpB,KAAK,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