@ac-kit/ui-common 0.2.0 → 0.3.0

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 (190) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +59 -3
  3. package/dist/adapter/_anchor.d.ts.map +1 -0
  4. package/dist/adapter/_anchor.js.map +1 -0
  5. package/dist/adapter/_dom.d.ts.map +1 -0
  6. package/dist/adapter/_dom.js.map +1 -0
  7. package/dist/{preact → adapter}/_live-announcer.d.ts +1 -1
  8. package/dist/adapter/_live-announcer.d.ts.map +1 -0
  9. package/dist/{preact → adapter}/_live-announcer.js +1 -1
  10. package/dist/adapter/_live-announcer.js.map +1 -0
  11. package/dist/adapter/join-classes.d.ts.map +1 -0
  12. package/dist/adapter/join-classes.js.map +1 -0
  13. package/dist/bit-grid/bit-grid.d.ts +151 -0
  14. package/dist/bit-grid/bit-grid.d.ts.map +1 -0
  15. package/dist/bit-grid/bit-grid.js +201 -0
  16. package/dist/bit-grid/bit-grid.js.map +1 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +2 -0
  20. package/dist/index.js.map +1 -1
  21. package/dist/preact/bit-grid.d.ts +39 -0
  22. package/dist/preact/bit-grid.d.ts.map +1 -0
  23. package/dist/preact/bit-grid.js +72 -0
  24. package/dist/preact/bit-grid.js.map +1 -0
  25. package/dist/preact/button.d.ts.map +1 -1
  26. package/dist/preact/button.js +1 -1
  27. package/dist/preact/button.js.map +1 -1
  28. package/dist/preact/dialog.d.ts.map +1 -1
  29. package/dist/preact/dialog.js +1 -1
  30. package/dist/preact/dialog.js.map +1 -1
  31. package/dist/preact/index.d.ts +3 -1
  32. package/dist/preact/index.d.ts.map +1 -1
  33. package/dist/preact/index.js +3 -1
  34. package/dist/preact/index.js.map +1 -1
  35. package/dist/preact/knob.d.ts.map +1 -1
  36. package/dist/preact/knob.js +1 -1
  37. package/dist/preact/knob.js.map +1 -1
  38. package/dist/preact/menu-button.d.ts.map +1 -1
  39. package/dist/preact/menu-button.js +3 -3
  40. package/dist/preact/menu-button.js.map +1 -1
  41. package/dist/preact/meter.d.ts.map +1 -1
  42. package/dist/preact/meter.js +1 -1
  43. package/dist/preact/meter.js.map +1 -1
  44. package/dist/preact/progress-ring.d.ts.map +1 -1
  45. package/dist/preact/progress-ring.js +1 -1
  46. package/dist/preact/progress-ring.js.map +1 -1
  47. package/dist/preact/radio-group.d.ts.map +1 -1
  48. package/dist/preact/radio-group.js +1 -1
  49. package/dist/preact/radio-group.js.map +1 -1
  50. package/dist/preact/readout.d.ts.map +1 -1
  51. package/dist/preact/readout.js +1 -1
  52. package/dist/preact/readout.js.map +1 -1
  53. package/dist/preact/slider.d.ts.map +1 -1
  54. package/dist/preact/slider.js +1 -1
  55. package/dist/preact/slider.js.map +1 -1
  56. package/dist/preact/spin-button.d.ts.map +1 -1
  57. package/dist/preact/spin-button.js +2 -2
  58. package/dist/preact/spin-button.js.map +1 -1
  59. package/dist/preact/swatch-strip.d.ts +30 -0
  60. package/dist/preact/swatch-strip.d.ts.map +1 -0
  61. package/dist/preact/swatch-strip.js +17 -0
  62. package/dist/preact/swatch-strip.js.map +1 -0
  63. package/dist/preact/switch.js +1 -1
  64. package/dist/preact/switch.js.map +1 -1
  65. package/dist/preact/tabs.d.ts.map +1 -1
  66. package/dist/preact/tabs.js +2 -2
  67. package/dist/preact/tabs.js.map +1 -1
  68. package/dist/preact/toaster.d.ts.map +1 -1
  69. package/dist/preact/toaster.js +2 -2
  70. package/dist/preact/toaster.js.map +1 -1
  71. package/dist/preact/toggle-button.d.ts.map +1 -1
  72. package/dist/preact/toggle-button.js +1 -1
  73. package/dist/preact/toggle-button.js.map +1 -1
  74. package/dist/preact/toolbar.d.ts.map +1 -1
  75. package/dist/preact/toolbar.js +2 -2
  76. package/dist/preact/toolbar.js.map +1 -1
  77. package/dist/preact/tooltip.d.ts.map +1 -1
  78. package/dist/preact/tooltip.js +2 -2
  79. package/dist/preact/tooltip.js.map +1 -1
  80. package/dist/preact/tree.d.ts.map +1 -1
  81. package/dist/preact/tree.js +2 -2
  82. package/dist/preact/tree.js.map +1 -1
  83. package/dist/react/_props.d.ts +22 -0
  84. package/dist/react/_props.d.ts.map +1 -0
  85. package/dist/react/_props.js +14 -0
  86. package/dist/react/_props.js.map +1 -0
  87. package/dist/react/bit-grid.d.ts +40 -0
  88. package/dist/react/bit-grid.d.ts.map +1 -0
  89. package/dist/react/bit-grid.js +71 -0
  90. package/dist/react/bit-grid.js.map +1 -0
  91. package/dist/react/button.d.ts +60 -0
  92. package/dist/react/button.d.ts.map +1 -0
  93. package/dist/react/button.js +34 -0
  94. package/dist/react/button.js.map +1 -0
  95. package/dist/react/dialog.d.ts +44 -0
  96. package/dist/react/dialog.d.ts.map +1 -0
  97. package/dist/react/dialog.js +91 -0
  98. package/dist/react/dialog.js.map +1 -0
  99. package/dist/react/index.d.ts +22 -0
  100. package/dist/react/index.d.ts.map +1 -0
  101. package/dist/react/index.js +22 -0
  102. package/dist/react/index.js.map +1 -0
  103. package/dist/react/knob.d.ts +55 -0
  104. package/dist/react/knob.d.ts.map +1 -0
  105. package/dist/react/knob.js +144 -0
  106. package/dist/react/knob.js.map +1 -0
  107. package/dist/react/menu-button.d.ts +147 -0
  108. package/dist/react/menu-button.d.ts.map +1 -0
  109. package/dist/react/menu-button.js +342 -0
  110. package/dist/react/menu-button.js.map +1 -0
  111. package/dist/react/meter.d.ts +34 -0
  112. package/dist/react/meter.d.ts.map +1 -0
  113. package/dist/react/meter.js +23 -0
  114. package/dist/react/meter.js.map +1 -0
  115. package/dist/react/progress-ring.d.ts +42 -0
  116. package/dist/react/progress-ring.d.ts.map +1 -0
  117. package/dist/react/progress-ring.js +28 -0
  118. package/dist/react/progress-ring.js.map +1 -0
  119. package/dist/react/radio-group.d.ts +52 -0
  120. package/dist/react/radio-group.d.ts.map +1 -0
  121. package/dist/react/radio-group.js +30 -0
  122. package/dist/react/radio-group.js.map +1 -0
  123. package/dist/react/readout.d.ts +23 -0
  124. package/dist/react/readout.d.ts.map +1 -0
  125. package/dist/react/readout.js +13 -0
  126. package/dist/react/readout.js.map +1 -0
  127. package/dist/react/slider.d.ts +44 -0
  128. package/dist/react/slider.d.ts.map +1 -0
  129. package/dist/react/slider.js +167 -0
  130. package/dist/react/slider.js.map +1 -0
  131. package/dist/react/spin-button.d.ts +71 -0
  132. package/dist/react/spin-button.d.ts.map +1 -0
  133. package/dist/react/spin-button.js +132 -0
  134. package/dist/react/spin-button.js.map +1 -0
  135. package/dist/react/swatch-strip.d.ts +31 -0
  136. package/dist/react/swatch-strip.d.ts.map +1 -0
  137. package/dist/react/swatch-strip.js +17 -0
  138. package/dist/react/swatch-strip.js.map +1 -0
  139. package/dist/react/switch.d.ts +26 -0
  140. package/dist/react/switch.d.ts.map +1 -0
  141. package/dist/react/switch.js +19 -0
  142. package/dist/react/switch.js.map +1 -0
  143. package/dist/react/tabs.d.ts +95 -0
  144. package/dist/react/tabs.d.ts.map +1 -0
  145. package/dist/react/tabs.js +274 -0
  146. package/dist/react/tabs.js.map +1 -0
  147. package/dist/react/toaster.d.ts +43 -0
  148. package/dist/react/toaster.d.ts.map +1 -0
  149. package/dist/react/toaster.js +368 -0
  150. package/dist/react/toaster.js.map +1 -0
  151. package/dist/react/toggle-button.d.ts +37 -0
  152. package/dist/react/toggle-button.d.ts.map +1 -0
  153. package/dist/react/toggle-button.js +22 -0
  154. package/dist/react/toggle-button.js.map +1 -0
  155. package/dist/react/toolbar.d.ts +25 -0
  156. package/dist/react/toolbar.d.ts.map +1 -0
  157. package/dist/react/toolbar.js +143 -0
  158. package/dist/react/toolbar.js.map +1 -0
  159. package/dist/react/tooltip.d.ts +68 -0
  160. package/dist/react/tooltip.d.ts.map +1 -0
  161. package/dist/react/tooltip.js +165 -0
  162. package/dist/react/tooltip.js.map +1 -0
  163. package/dist/react/tree.d.ts +94 -0
  164. package/dist/react/tree.d.ts.map +1 -0
  165. package/dist/react/tree.js +422 -0
  166. package/dist/react/tree.js.map +1 -0
  167. package/dist/react/use-element-binding.d.ts +35 -0
  168. package/dist/react/use-element-binding.d.ts.map +1 -0
  169. package/dist/react/use-element-binding.js +51 -0
  170. package/dist/react/use-element-binding.js.map +1 -0
  171. package/dist/swatch-strip/swatch-strip.d.ts +60 -0
  172. package/dist/swatch-strip/swatch-strip.d.ts.map +1 -0
  173. package/dist/swatch-strip/swatch-strip.js +60 -0
  174. package/dist/swatch-strip/swatch-strip.js.map +1 -0
  175. package/package.json +38 -15
  176. package/styles.css +191 -1
  177. package/dist/preact/_anchor.d.ts.map +0 -1
  178. package/dist/preact/_anchor.js.map +0 -1
  179. package/dist/preact/_dom.d.ts.map +0 -1
  180. package/dist/preact/_dom.js.map +0 -1
  181. package/dist/preact/_live-announcer.d.ts.map +0 -1
  182. package/dist/preact/_live-announcer.js.map +0 -1
  183. package/dist/preact/join-classes.d.ts.map +0 -1
  184. package/dist/preact/join-classes.js.map +0 -1
  185. /package/dist/{preact → adapter}/_anchor.d.ts +0 -0
  186. /package/dist/{preact → adapter}/_anchor.js +0 -0
  187. /package/dist/{preact → adapter}/_dom.d.ts +0 -0
  188. /package/dist/{preact → adapter}/_dom.js +0 -0
  189. /package/dist/{preact → adapter}/join-classes.d.ts +0 -0
  190. /package/dist/{preact → adapter}/join-classes.js +0 -0
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** @jsxImportSource react */
3
+ import { inverseLerp } from "@ac-kit/math-scalar";
4
+ import { progressAttributes } from "../progress/progress.js";
5
+ import { classOf_ } from "./_props.js";
6
+ /**
7
+ * A circular progress indicator: an arc filling clockwise from twelve o'clock
8
+ * as `value` goes from `min` to `max`, or a turning arc while the progress
9
+ * cannot be told (`value` undefined), held still under `prefers-reduced-motion:
10
+ * reduce`. The `progressbar` role, so it is announced with its value, not as a
11
+ * control. Tie it to the region it reports on with `aria-busy` and
12
+ * `aria-describedby` there.
13
+ *
14
+ * @throws {RangeError} When `min` or `max` is not finite, or `max` is not above
15
+ * `min`.
16
+ */
17
+ export function ProgressRing(props) {
18
+ const { label, labelledBy, value, min, max, valueText, isValueShown = false, tone, id, } = props;
19
+ const attributes = progressAttributes({ label, value, min, max, valueText });
20
+ const now = attributes["aria-valuenow"];
21
+ const style = now === undefined
22
+ ? undefined
23
+ : {
24
+ "--ack-progress-fraction": inverseLerp(attributes["aria-valuemin"], attributes["aria-valuemax"], now),
25
+ };
26
+ return (_jsxs("div", { ...attributes, "aria-labelledby": labelledBy, id: id, className: classOf_("ack-control ack-progress-ring", props), "data-state": now === undefined ? "indeterminate" : "determinate", "data-tone": tone, style: style, children: [_jsxs("svg", { className: "ack-progress-ring-dial", viewBox: "0 0 48 48", "aria-hidden": "true", focusable: "false", children: [_jsx("circle", { className: "ack-progress-ring-track", cx: "24", cy: "24", r: "20", pathLength: 1 }), _jsx("circle", { className: "ack-progress-ring-indicator", cx: "24", cy: "24", r: "20", pathLength: 1 })] }), isValueShown && valueText !== undefined && (_jsx("span", { className: "ack-progress-ring-value", "aria-hidden": "true", children: valueText }))] }));
27
+ }
28
+ //# sourceMappingURL=progress-ring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-ring.js","sourceRoot":"","sources":["../../src/react/progress-ring.tsx"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAoB,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAiC5E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACpD,MAAM,EACL,KAAK,EACL,UAAU,EACV,KAAK,EACL,GAAG,EACH,GAAG,EACH,SAAS,EACT,YAAY,GAAG,KAAK,EACpB,IAAI,EACJ,EAAE,GACF,GAAG,KAAK,CAAC;IACV,MAAM,UAAU,GAAG,kBAAkB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7E,MAAM,GAAG,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IACxC,MAAM,KAAK,GACV,GAAG,KAAK,SAAS;QAChB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC;YACA,yBAAyB,EAAE,WAAW,CACrC,UAAU,CAAC,eAAe,CAAC,EAC3B,UAAU,CAAC,eAAe,CAAC,EAC3B,GAAG,CACH;SACD,CAAC;IAEL,OAAO,CACN,kBACK,UAAU,qBACG,UAAU,EAC3B,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,QAAQ,CAAC,+BAA+B,EAAE,KAAK,CAAC,gBAC/C,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,eACpD,IAAI,EACf,KAAK,EAAE,KAAK,aAEZ,eACC,SAAS,EAAC,wBAAwB,EAClC,OAAO,EAAC,WAAW,iBACP,MAAM,EAClB,SAAS,EAAC,OAAO,aAEjB,iBACC,SAAS,EAAC,yBAAyB,EACnC,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,CAAC,EAAC,IAAI,EACN,UAAU,EAAE,CAAC,GACZ,EACF,iBACC,SAAS,EAAC,6BAA6B,EACvC,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,CAAC,EAAC,IAAI,EACN,UAAU,EAAE,CAAC,GACZ,IACG,EACL,YAAY,IAAI,SAAS,KAAK,SAAS,IAAI,CAC3C,eAAM,SAAS,EAAC,yBAAyB,iBAAa,MAAM,YAC1D,SAAS,GACJ,CACP,IACI,CACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,52 @@
1
+ /** @jsxImportSource react */
2
+ import type { Callable } from "@ac-kit/core";
3
+ import { type JSX, type ReactNode } from "react";
4
+ import type { ControlTone } from "../tone.js";
5
+ import { type ClassProps_ } from "./_props.js";
6
+ /** One choice of a {@link RadioGroup}. */
7
+ export type RadioOption<Value extends string> = {
8
+ value: Value;
9
+ /** Its accessible name, drawn on it. */
10
+ label: string;
11
+ /**
12
+ * A sentence under the label, linked by `aria-describedby`; drawn by the
13
+ * `cards` appearance.
14
+ */
15
+ description?: string;
16
+ /** Drawn before the label, hidden from assistive technology. */
17
+ icon?: ReactNode;
18
+ disabled?: boolean;
19
+ /** The colour it lights in while chosen. */
20
+ tone?: ControlTone;
21
+ };
22
+ /** Props of {@link RadioGroup}. */
23
+ export type RadioGroupProps<Value extends string> = ClassProps_ & {
24
+ /** The `<legend>`; visually hidden unless `isLabelShown`. */
25
+ label: string;
26
+ isLabelShown?: boolean;
27
+ options: readonly RadioOption<Value>[];
28
+ /** The chosen option; `undefined` for none yet. */
29
+ value: Value | undefined;
30
+ /** The option chosen: by a pointer, or an arrow key. */
31
+ onChange: Callable<[value: Value]>;
32
+ /** Side-by-side segments, or cards with descriptions. Defaults to `segmented`. */
33
+ appearance?: "segmented" | "cards";
34
+ /** Defaults to `horizontal`. */
35
+ orientation?: "horizontal" | "vertical";
36
+ disabled?: boolean;
37
+ /** The radios' `name`. Defaults to a generated id. */
38
+ name?: string;
39
+ id?: string;
40
+ };
41
+ /**
42
+ * One choice among a few, all shown at once: a segmented control, or a list of
43
+ * cards with descriptions. Native radios in a `<fieldset>`, so the browser
44
+ * provides the arrow keys (they move and choose), Tab leaving the group, and
45
+ * form participation. The radios are controlled: until the caller passes the
46
+ * chosen option back as `value`, React keeps the previous one checked.
47
+ *
48
+ * For more than about six options, use a select; for independent settings,
49
+ * switches.
50
+ */
51
+ export declare function RadioGroup<Value extends string>(props: RadioGroupProps<Value>): JSX.Element;
52
+ //# sourceMappingURL=radio-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/react/radio-group.tsx"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,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AAM,EAC9C,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,GAC3B,GAAG,CAAC,OAAO,CAiFb"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { classOf_ } from "./_props.js";
4
+ /**
5
+ * One choice among a few, all shown at once: a segmented control, or a list of
6
+ * cards with descriptions. Native radios in a `<fieldset>`, so the browser
7
+ * provides the arrow keys (they move and choose), Tab leaving the group, and
8
+ * form participation. The radios are controlled: until the caller passes the
9
+ * chosen option back as `value`, React keeps the previous one checked.
10
+ *
11
+ * For more than about six options, use a select; for independent settings,
12
+ * switches.
13
+ */
14
+ export function RadioGroup(props) {
15
+ const { label, isLabelShown = false, options, value, onChange, appearance = "segmented", orientation = "horizontal", disabled = false, id, } = props;
16
+ const generatedName = useId();
17
+ const idPrefix = useId();
18
+ const name = props.name ?? generatedName;
19
+ return (_jsxs("fieldset", { id: id, disabled: disabled, "data-appearance": appearance, "data-orientation": orientation, className: classOf_("ack-control ack-radio-group", props), children: [_jsx("legend", { className: isLabelShown
20
+ ? "ack-radio-group-legend"
21
+ : "ack-radio-group-legend ack-visually-hidden", children: label }), options.map((option, index) => {
22
+ const labelId = `${idPrefix}-${index}-label`;
23
+ const descriptionId = `${idPrefix}-${index}`;
24
+ const isChosen = option.value === value;
25
+ return (_jsxs("label", { className: "ack-control ack-radio", "data-state": isChosen ? "on" : "off", "data-tone": option.tone, "data-disabled": option.disabled === true ? "" : undefined, children: [_jsx("input", { type: "radio", className: "ack-radio-input", name: name, value: option.value, checked: isChosen, disabled: option.disabled, "aria-labelledby": labelId, "aria-describedby": option.description === undefined ? undefined : descriptionId, onChange: () => {
26
+ onChange(option.value);
27
+ } }), option.icon !== undefined && (_jsx("span", { className: "ack-radio-icon", "aria-hidden": "true", children: option.icon })), _jsxs("span", { className: "ack-radio-text", children: [_jsx("span", { id: labelId, className: "ack-radio-label", children: option.label }), option.description !== undefined && (_jsx("span", { id: descriptionId, className: "ack-radio-description", children: option.description }))] })] }, option.value));
28
+ })] }));
29
+ }
30
+ //# sourceMappingURL=radio-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../src/react/radio-group.tsx"],"names":[],"mappings":";AAEA,OAAO,EAA4B,KAAK,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAoB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAuCzD;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CACzB,KAA6B;IAE7B,MAAM,EACL,KAAK,EACL,YAAY,GAAG,KAAK,EACpB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,UAAU,GAAG,WAAW,EACxB,WAAW,GAAG,YAAY,EAC1B,QAAQ,GAAG,KAAK,EAChB,EAAE,GACF,GAAG,KAAK,CAAC;IACV,MAAM,aAAa,GAAG,KAAK,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,KAAK,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,aAAa,CAAC;IAEzC,OAAO,CACN,oBACC,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,qBACD,UAAU,sBACT,WAAW,EAC7B,SAAS,EAAE,QAAQ,CAAC,6BAA6B,EAAE,KAAK,CAAC,aAEzD,iBACC,SAAS,EACR,YAAY;oBACX,CAAC,CAAC,wBAAwB;oBAC1B,CAAC,CAAC,4CAA4C,YAG/C,KAAK,GACE,EACR,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBAC9B,MAAM,OAAO,GAAG,GAAG,QAAQ,IAAI,KAAK,QAAQ,CAAC;gBAC7C,MAAM,aAAa,GAAG,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC;gBAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC;gBAExC,OAAO,CACN,iBAEC,SAAS,EAAC,uBAAuB,gBACrB,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,eACxB,MAAM,CAAC,IAAI,mBACP,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,aAExD,gBACC,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,iBAAiB,EAC3B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ,qBACR,OAAO,sBAEvB,MAAM,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EAE7D,QAAQ,EAAE,GAAG,EAAE;gCACd,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;4BACxB,CAAC,GACA,EACD,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,CAC7B,eAAM,SAAS,EAAC,gBAAgB,iBAAa,MAAM,YACjD,MAAM,CAAC,IAAI,GACN,CACP,EACD,gBAAM,SAAS,EAAC,gBAAgB,aAC/B,eAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,iBAAiB,YAC5C,MAAM,CAAC,KAAK,GACP,EACN,MAAM,CAAC,WAAW,KAAK,SAAS,IAAI,CACpC,eAAM,EAAE,EAAE,aAAa,EAAE,SAAS,EAAC,uBAAuB,YACxD,MAAM,CAAC,WAAW,GACb,CACP,IACK,KAnCF,MAAM,CAAC,KAAK,CAoCV,CACR,CAAC;YACH,CAAC,CAAC,IACQ,CACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ /** @jsxImportSource react */
2
+ import type { JSX, ReactNode } from "react";
3
+ import { type ReadoutLive } from "../readout/readout.js";
4
+ import type { ControlTone } from "../tone.js";
5
+ import { type ClassProps_ } from "./_props.js";
6
+ /** Props of {@link Readout}. */
7
+ export type ReadoutProps = ClassProps_ & {
8
+ /** What the value is, drawn as its caption and naming it. */
9
+ label: string;
10
+ tone?: ControlTone;
11
+ /** Defaults to `off`: changes are not announced. */
12
+ live?: ReadoutLive;
13
+ /** The value, as text. */
14
+ children: ReactNode;
15
+ id?: string;
16
+ };
17
+ /**
18
+ * A lit value under a small caption, like a hardware display's: a tempo, a bar
19
+ * number, a program. Read-only; for a value the person sets, use a `Knob` or a
20
+ * `Slider`.
21
+ */
22
+ export declare function Readout(props: ReadoutProps): JSX.Element;
23
+ //# sourceMappingURL=readout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readout.d.ts","sourceRoot":"","sources":["../../src/react/readout.tsx"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,aAAa,CAAC;AAEzD,gCAAgC;AAChC,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACxC,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,oDAAoD;IACpD,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,0BAA0B;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAexD"}
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { readoutAttributes } from "../readout/readout.js";
3
+ import { classOf_ } from "./_props.js";
4
+ /**
5
+ * A lit value under a small caption, like a hardware display's: a tempo, a bar
6
+ * number, a program. Read-only; for a value the person sets, use a `Knob` or a
7
+ * `Slider`.
8
+ */
9
+ export function Readout(props) {
10
+ const { label, tone, live, children, id } = props;
11
+ return (_jsxs("div", { ...readoutAttributes({ label, tone, live }), id: id, className: classOf_("ack-control ack-readout", props), children: [_jsx("span", { className: "ack-readout-label", "aria-hidden": "true", children: label }), _jsx("span", { className: "ack-readout-value", children: children })] }));
12
+ }
13
+ //# sourceMappingURL=readout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readout.js","sourceRoot":"","sources":["../../src/react/readout.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,EAAoB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAczD;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAAmB;IAC1C,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;IAElD,OAAO,CACN,kBACK,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAC5C,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,QAAQ,CAAC,yBAAyB,EAAE,KAAK,CAAC,aAErD,eAAM,SAAS,EAAC,mBAAmB,iBAAa,MAAM,YACpD,KAAK,GACA,EACP,eAAM,SAAS,EAAC,mBAAmB,YAAE,QAAQ,GAAQ,IAChD,CACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** @jsxImportSource react */
2
+ import type { Callable } from "@ac-kit/core";
3
+ import { type JSX } from "react";
4
+ import { type SliderOrientation } from "../slider/slider-track.js";
5
+ import type { ControlTone } from "../tone.js";
6
+ import { type ClassProps_ } from "./_props.js";
7
+ /** Props of {@link Slider}. */
8
+ export type SliderProps = ClassProps_ & {
9
+ /** Its accessible name, also drawn above it. */
10
+ label: string;
11
+ value: number;
12
+ min: number;
13
+ max: number;
14
+ /** Defaults to 1. */
15
+ step?: number;
16
+ /** Defaults to `horizontal`. */
17
+ orientation?: SliderOrientation;
18
+ tone?: ControlTone;
19
+ disabled?: boolean;
20
+ /** The value as a person reads it, shown and announced. Defaults to `String`. */
21
+ format?: Callable<[value: number], string>;
22
+ /**
23
+ * A new value, once per gesture: at a drag's end, or a key. Not React's
24
+ * `onChange` of a form field, which fires at every input.
25
+ */
26
+ onChange: Callable<[value: number]>;
27
+ /** The value following a drag, before it is committed through `onChange`. */
28
+ onInput?: Callable<[value: number]>;
29
+ id?: string;
30
+ };
31
+ /**
32
+ * A linear slider, horizontal or vertical as on a mixing desk, its value shown
33
+ * beside its label. Pressing anywhere on the track jumps the thumb there; it
34
+ * follows the pointer and reports a value once let go, at the point it was let
35
+ * go. A drag never ends in a click. Focused, the arrow keys step it, Page Up
36
+ * and Page Down by ten steps, Home and End to the ends. The page still scrolls
37
+ * across it: a press that turns into a scroll is cancelled and reports
38
+ * nothing.
39
+ *
40
+ * For a setting with room to spare, or the large entry surface a `Knob` opens;
41
+ * where space is short, prefer a `Knob`.
42
+ */
43
+ export declare function Slider(props: SliderProps): JSX.Element;
44
+ //# sourceMappingURL=slider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../src/react/slider.tsx"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EACN,KAAK,GAAG,EAMR,MAAM,OAAO,CAAC;AAKf,OAAO,EACN,KAAK,iBAAiB,EAGtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAA+B,MAAM,aAAa,CAAC;AAG5E,+BAA+B;AAC/B,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACvC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3C;;;OAGG;IACH,QAAQ,EAAE,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACpC,6EAA6E;IAC7E,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;AAUF;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAwNtD"}
@@ -0,0 +1,167 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { bindPointers } from "@ac-kit/ui-gesture/dom";
3
+ import { useEffect, useId, useRef, useState, } from "react";
4
+ import { clampedSliderValue_ } from "../slider/_clamped-value.js";
5
+ import { sliderAttributes } from "../slider/slider-attributes.js";
6
+ import { sliderFraction } from "../slider/slider-range.js";
7
+ import { sliderTrackValueAt, } from "../slider/slider-track.js";
8
+ import { steppedValue } from "../slider/stepped-value.js";
9
+ import { classOf_ } from "./_props.js";
10
+ import { useElementBinding, useLatest } from "./use-element-binding.js";
11
+ /**
12
+ * A linear slider, horizontal or vertical as on a mixing desk, its value shown
13
+ * beside its label. Pressing anywhere on the track jumps the thumb there; it
14
+ * follows the pointer and reports a value once let go, at the point it was let
15
+ * go. A drag never ends in a click. Focused, the arrow keys step it, Page Up
16
+ * and Page Down by ten steps, Home and End to the ends. The page still scrolls
17
+ * across it: a press that turns into a scroll is cancelled and reports
18
+ * nothing.
19
+ *
20
+ * For a setting with room to spare, or the large entry surface a `Knob` opens;
21
+ * where space is short, prefer a `Knob`.
22
+ */
23
+ export function Slider(props) {
24
+ const { label, value, min, max, step = 1, orientation = "horizontal", tone, disabled = false, format = String, onChange, onInput, id, } = props;
25
+ const range = { min, max, step };
26
+ const labelId = useId();
27
+ const [dragged, setDragged] = useState(undefined);
28
+ const drag = useRef(undefined);
29
+ const binding = useRef(undefined);
30
+ const isClickSuppressed = useRef(false);
31
+ const thumb = useRef(null);
32
+ const latest = useLatest({ range, value, disabled, onChange, onInput });
33
+ const shown = clampedSliderValue_(dragged ?? value, range);
34
+ const isVertical = orientation === "vertical";
35
+ const endDrag = () => {
36
+ drag.current = undefined;
37
+ setDragged(undefined);
38
+ };
39
+ const control = useElementBinding((element, signal) => {
40
+ const valueAt = (current, point) => sliderTrackValueAt(isVertical ? point.y : point.x, current.track, latest.current.range, orientation);
41
+ const follow = (current, next) => {
42
+ if (next !== current.value) {
43
+ latest.current.onInput?.(next);
44
+ }
45
+ current.value = next;
46
+ setDragged(next);
47
+ };
48
+ const bound = bindPointers(element, {
49
+ onDown: (down) => {
50
+ const box = bound.box ?? element.getBoundingClientRect();
51
+ const thumbBox = thumb.current?.getBoundingClientRect();
52
+ // The pointer's coordinates are the control's own, so the track
53
+ // starts at 0.
54
+ const track = isVertical
55
+ ? {
56
+ start: 0,
57
+ length: box.height,
58
+ thumbLength: thumbBox?.height ?? 0,
59
+ }
60
+ : {
61
+ start: 0,
62
+ length: box.width,
63
+ thumbLength: thumbBox?.width ?? 0,
64
+ };
65
+ const current = {
66
+ pointerId: down.pointerId,
67
+ track,
68
+ value: latest.current.value,
69
+ pressX: down.x,
70
+ pressY: down.y,
71
+ };
72
+ drag.current = current;
73
+ isClickSuppressed.current = false;
74
+ thumb.current?.focus();
75
+ follow(current, valueAt(current, down));
76
+ },
77
+ onMove: (sample) => {
78
+ const current = drag.current;
79
+ if (current?.pointerId === sample.pointerId) {
80
+ follow(current, valueAt(current, sample));
81
+ }
82
+ },
83
+ onUp: (sample) => {
84
+ const current = drag.current;
85
+ if (current?.pointerId !== sample.pointerId) {
86
+ return;
87
+ }
88
+ endDrag();
89
+ if (latest.current.disabled) {
90
+ return;
91
+ }
92
+ // The release point decides, not the last move.
93
+ const next = valueAt(current, sample);
94
+ if (next !== current.value) {
95
+ latest.current.onInput?.(next);
96
+ }
97
+ // A drag is a release away from the press, whatever moves came between.
98
+ isClickSuppressed.current =
99
+ sample.x !== current.pressX || sample.y !== current.pressY;
100
+ if (next !== latest.current.value) {
101
+ latest.current.onChange(next);
102
+ }
103
+ },
104
+ onCancel: (pointerId) => {
105
+ if (drag.current?.pointerId === pointerId) {
106
+ endDrag();
107
+ }
108
+ },
109
+ }, {
110
+ // One pointer at a time: a second one is never tracked, so it cannot
111
+ // keep the first's box for the next drag.
112
+ accept: (event) => event.button === 0 &&
113
+ !latest.current.disabled &&
114
+ drag.current === undefined,
115
+ // The page still scrolls across the slider; the browser's take-over
116
+ // cancels the press.
117
+ touchAction: isVertical ? "pan-x pinch-zoom" : "pan-y pinch-zoom",
118
+ signal,
119
+ });
120
+ binding.current = bound;
121
+ // The click that follows a drag is not a press of anything under it.
122
+ element.addEventListener("click", (event) => {
123
+ if (isClickSuppressed.current && event.detail !== 0) {
124
+ isClickSuppressed.current = false;
125
+ event.preventDefault();
126
+ event.stopImmediatePropagation();
127
+ }
128
+ }, { capture: true, signal });
129
+ return {
130
+ [Symbol.dispose]() {
131
+ bound[Symbol.dispose]();
132
+ binding.current = undefined;
133
+ endDrag();
134
+ },
135
+ };
136
+ }, [isVertical]);
137
+ useEffect(() => {
138
+ if (disabled) {
139
+ binding.current?.cancel();
140
+ endDrag();
141
+ }
142
+ }, [disabled]);
143
+ const onKeyDown = (event) => {
144
+ if (disabled) {
145
+ return;
146
+ }
147
+ const next = steppedValue(clampedSliderValue_(value, range), event.key, range);
148
+ if (next === undefined) {
149
+ return;
150
+ }
151
+ event.preventDefault();
152
+ if (next !== value) {
153
+ onChange(next);
154
+ }
155
+ };
156
+ const style = {
157
+ "--ack-slider-fraction": sliderFraction(shown, range),
158
+ };
159
+ return (_jsxs("div", { id: id, className: classOf_("ack-control ack-slider", props), "data-orientation": orientation, "data-tone": tone, "data-dragging": dragged === undefined ? undefined : "", "data-disabled": disabled ? "" : undefined, style: style, children: [_jsxs("div", { className: "ack-slider-header", children: [_jsx("span", { className: "ack-slider-label", id: labelId, children: label }), _jsx("span", { className: "ack-slider-value", "aria-hidden": "true", children: format(shown) })] }), _jsxs("div", { ref: control, className: "ack-slider-control", children: [_jsx("div", { className: "ack-slider-track", children: _jsx("div", { className: "ack-slider-range" }) }), _jsx("div", { ...sliderAttributes({
160
+ value: shown,
161
+ range,
162
+ valueText: format(shown),
163
+ orientation,
164
+ disabled,
165
+ }), ref: thumb, className: "ack-slider-thumb", "aria-labelledby": labelId, tabIndex: disabled ? -1 : 0, onKeyDown: onKeyDown })] })] }));
166
+ }
167
+ //# sourceMappingURL=slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../src/react/slider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAuB,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAGN,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAoB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAGN,kBAAkB,GAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAoB,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAC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AC,GACR,IACF,EACN,eAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,oBAAoB,aAChD,cAAK,SAAS,EAAC,kBAAkB,YAChC,cAAK,SAAS,EAAC,kBAAkB,GAAG,GAC/B,EACN,iBACK,gBAAgB,CAAC;4BACpB,KAAK,EAAE,KAAK;4BACZ,KAAK;4BACL,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC;4BACxB,WAAW;4BACX,QAAQ;yBACR,CAAC,EACF,GAAG,EAAE,KAAK,EACV,SAAS,EAAC,kBAAkB,qBACX,OAAO,EACxB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3B,SAAS,EAAE,SAAS,GACnB,IACG,IACD,CACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,71 @@
1
+ /** @jsxImportSource react */
2
+ import type { Callable } from "@ac-kit/core";
3
+ import { type JSX, type ReactNode } from "react";
4
+ import type { ControlTone } from "../tone.js";
5
+ import { type ClassProps_ } from "./_props.js";
6
+ /** Props of {@link SpinButton}. */
7
+ export type SpinButtonProps = ClassProps_ & {
8
+ /** Its accessible name, drawn above it unless `isLabelHidden`. */
9
+ label: string;
10
+ /** Name it without drawing `label`. Defaults to false. */
11
+ isLabelHidden?: boolean;
12
+ value: number;
13
+ /** Omit for no minimum. */
14
+ min?: number;
15
+ /** Omit for no maximum. */
16
+ max?: number;
17
+ /** Defaults to 1. */
18
+ step?: number;
19
+ /** What Page Up and Page Down move by. Defaults to ten steps. */
20
+ largeStep?: number;
21
+ /** The value as a person reads it, shown and announced. Defaults to `String`. */
22
+ format?: Callable<[value: number], string>;
23
+ /**
24
+ * Reads what a person typed: a number, or `undefined` when the text is not
25
+ * one. Giving it makes the value editable as text; without it, only the keys
26
+ * and the buttons change the value.
27
+ */
28
+ parse?: Callable<[text: string], number | undefined>;
29
+ /**
30
+ * A new value, once per key, button press or entry typed. Not React's
31
+ * `onChange` of a form field, which fires at every input.
32
+ */
33
+ onChange: Callable<[value: number]>;
34
+ /** The decrement button's accessible name: `"Decrease"`. */
35
+ decrementLabel: string;
36
+ /** The increment button's accessible name: `"Increase"`. */
37
+ incrementLabel: string;
38
+ /** Defaults to a minus sign. */
39
+ decrementIcon?: ReactNode;
40
+ /** Defaults to a plus sign. */
41
+ incrementIcon?: ReactNode;
42
+ /**
43
+ * The virtual keyboard of an editable one. Defaults to `numeric` for whole
44
+ * steps from a minimum of zero or more, `decimal` for other steps from such a
45
+ * minimum, and `text` when the value may be negative, which the numeric and
46
+ * decimal keyboards of some phones cannot type.
47
+ */
48
+ inputMode?: "numeric" | "decimal" | "text";
49
+ tone?: ControlTone;
50
+ disabled?: boolean;
51
+ id?: string;
52
+ };
53
+ /**
54
+ * A number stepped by keys and buttons (WAI-ARIA spinbutton pattern): Arrow Up
55
+ * and Down step it, Page Up and Down by ten steps, Home and End go to its
56
+ * minimum and maximum when it has them. With `parse`, the value is also typed:
57
+ * Enter or leaving the field commits it, snapped to the steps and the bounds,
58
+ * and Escape goes back to the value; text that is not a number is marked
59
+ * invalid and reverts. The − and + buttons are out of the tab order and never
60
+ * take focus (the field keeps it, and no phone keyboard opens), stop at the
61
+ * bounds, and announce the new value politely when focus is elsewhere, so a
62
+ * screen reader user pressing them hears it.
63
+ *
64
+ * For a count, a duration, a number of beats: a value whose steps people count.
65
+ * For a continuous setting, a `Slider` or a `Knob`.
66
+ *
67
+ * @throws {RangeError} When `step` or `largeStep` is not above zero, a bound is
68
+ * not finite, or `max` is not above `min`.
69
+ */
70
+ export declare function SpinButton(props: SpinButtonProps): JSX.Element;
71
+ //# sourceMappingURL=spin-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spin-button.d.ts","sourceRoot":"","sources":["../../src/react/spin-button.tsx"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACN,KAAK,GAAG,EAER,KAAK,SA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F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAuN9D"}
@@ -0,0 +1,132 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, useLayoutEffect, useRef, useState, } from "react";
3
+ import { LiveAnnouncer_ } from "../adapter/_live-announcer.js";
4
+ import { snapSpinButtonValue, spinButtonAttributes, spinButtonValue, } from "../spin-button/spin-button.js";
5
+ import { classOf_ } from "./_props.js";
6
+ function defaultInputMode_(range) {
7
+ const { min, step } = range;
8
+ if (min === undefined || min < 0) {
9
+ return "text";
10
+ }
11
+ return Number.isInteger(step) && Number.isInteger(min)
12
+ ? "numeric"
13
+ : "decimal";
14
+ }
15
+ function minusIcon_() {
16
+ return (_jsx("svg", { viewBox: "0 0 16 16", focusable: "false", children: _jsx("path", { d: "M3 8h10" }) }));
17
+ }
18
+ function plusIcon_() {
19
+ return (_jsx("svg", { viewBox: "0 0 16 16", focusable: "false", children: _jsx("path", { d: "M3 8h10M8 3v10" }) }));
20
+ }
21
+ /**
22
+ * A number stepped by keys and buttons (WAI-ARIA spinbutton pattern): Arrow Up
23
+ * and Down step it, Page Up and Down by ten steps, Home and End go to its
24
+ * minimum and maximum when it has them. With `parse`, the value is also typed:
25
+ * Enter or leaving the field commits it, snapped to the steps and the bounds,
26
+ * and Escape goes back to the value; text that is not a number is marked
27
+ * invalid and reverts. The − and + buttons are out of the tab order and never
28
+ * take focus (the field keeps it, and no phone keyboard opens), stop at the
29
+ * bounds, and announce the new value politely when focus is elsewhere, so a
30
+ * screen reader user pressing them hears it.
31
+ *
32
+ * For a count, a duration, a number of beats: a value whose steps people count.
33
+ * For a continuous setting, a `Slider` or a `Knob`.
34
+ *
35
+ * @throws {RangeError} When `step` or `largeStep` is not above zero, a bound is
36
+ * not finite, or `max` is not above `min`.
37
+ */
38
+ export function SpinButton(props) {
39
+ const { label, isLabelHidden = false, value, min, max, step = 1, largeStep, format = String, parse, onChange, decrementLabel, incrementLabel, decrementIcon, incrementIcon, inputMode, tone, disabled = false, id, } = props;
40
+ const range = { min, max, step };
41
+ const labelId = useId();
42
+ const fieldId = useId();
43
+ const [draft, setDraft] = useState(undefined);
44
+ const field = useRef(null);
45
+ const announcer = useRef(undefined);
46
+ const pendingAnnouncement = useRef(undefined);
47
+ const base = spinButtonAttributes({
48
+ value,
49
+ range,
50
+ valueText: "",
51
+ disabled,
52
+ });
53
+ const shown = base["aria-valuenow"];
54
+ const attributes = { ...base, "aria-valuetext": format(shown) };
55
+ const parsed = draft === undefined ? undefined : parse?.(draft);
56
+ const isDraftValid = parsed !== undefined && Number.isFinite(parsed);
57
+ // Keys and buttons step from what was typed, when it is a number.
58
+ const from = isDraftValid ? snapSpinButtonValue(parsed, range) : shown;
59
+ useLayoutEffect(() => {
60
+ const pending = pendingAnnouncement.current;
61
+ pendingAnnouncement.current = undefined;
62
+ if (pending !== undefined && pending === value) {
63
+ announcer.current ??= new LiveAnnouncer_(document);
64
+ announcer.current.announce([format(value)], "polite");
65
+ }
66
+ }, [value]);
67
+ useLayoutEffect(() => () => {
68
+ announcer.current?.[Symbol.dispose]();
69
+ announcer.current = undefined;
70
+ }, []);
71
+ const commitValue = (next) => {
72
+ if (next !== value) {
73
+ onChange(next);
74
+ }
75
+ };
76
+ const commitDraft = () => {
77
+ if (draft === undefined) {
78
+ return;
79
+ }
80
+ setDraft(undefined);
81
+ if (isDraftValid) {
82
+ commitValue(from);
83
+ }
84
+ };
85
+ const onKeyDown = (event) => {
86
+ if (disabled || event.altKey || event.ctrlKey || event.metaKey) {
87
+ return;
88
+ }
89
+ if (event.key === "Enter") {
90
+ commitDraft();
91
+ return;
92
+ }
93
+ if (event.key === "Escape") {
94
+ if (draft !== undefined) {
95
+ event.preventDefault();
96
+ setDraft(undefined);
97
+ }
98
+ return;
99
+ }
100
+ const next = spinButtonValue(from, event.key, range, { largeStep });
101
+ if (next === undefined) {
102
+ return;
103
+ }
104
+ event.preventDefault();
105
+ setDraft(undefined);
106
+ commitValue(next);
107
+ };
108
+ const name = isLabelHidden
109
+ ? { "aria-label": label }
110
+ : { "aria-labelledby": labelId };
111
+ const text = draft ?? attributes["aria-valuetext"];
112
+ const stepButton = (key, buttonLabel, icon, isAtBound) => (_jsx("button", { type: "button", className: `ack-spin-button-step ack-spin-button-${key === "ArrowUp" ? "increment" : "decrement"}`, tabIndex: -1, "aria-label": buttonLabel, "aria-controls": fieldId, disabled: disabled || isAtBound, onMouseDown: (event) => {
113
+ // The field keeps focus, and a phone opens no keyboard.
114
+ event.preventDefault();
115
+ }, onClick: () => {
116
+ const next = spinButtonValue(from, key, range, { largeStep }) ?? from;
117
+ setDraft(undefined);
118
+ if (next !== value && field.current !== document.activeElement) {
119
+ pendingAnnouncement.current = next;
120
+ }
121
+ commitValue(next);
122
+ }, children: _jsx("span", { className: "ack-spin-button-icon", "aria-hidden": "true", children: icon }) }));
123
+ return (_jsxs("div", { id: id, className: classOf_("ack-control ack-spin-button", props), "data-tone": tone, "data-disabled": disabled ? "" : undefined, children: [!isLabelHidden &&
124
+ (parse === undefined ? (_jsx("span", { className: "ack-spin-button-label", id: labelId, children: label })) : (_jsx("label", { className: "ack-spin-button-label", id: labelId, htmlFor: fieldId, children: label }))), _jsxs("div", { className: "ack-spin-button-body", children: [stepButton("ArrowDown", decrementLabel, decrementIcon ?? minusIcon_(), min !== undefined && shown <= min), parse === undefined ? (_jsx("div", { ...attributes, ...name, id: fieldId, ref: (node) => {
125
+ field.current = node;
126
+ }, className: "ack-spin-button-field", tabIndex: disabled ? -1 : 0, onKeyDown: onKeyDown, children: text })) : (_jsx("input", { ...attributes, ...name, id: fieldId, ref: (node) => {
127
+ field.current = node;
128
+ }, className: "ack-spin-button-field", type: "text", inputMode: inputMode ?? defaultInputMode_(range), autoComplete: "off", spellCheck: false, readOnly: disabled, tabIndex: disabled ? -1 : 0, "aria-invalid": draft !== undefined && !isDraftValid ? "true" : undefined, value: text, onChange: (event) => {
129
+ setDraft(event.currentTarget.value);
130
+ }, onBlur: commitDraft, onKeyDown: onKeyDown })), stepButton("ArrowUp", incrementLabel, incrementIcon ?? plusIcon_(), max !== undefined && shown >= max)] })] }));
131
+ }
132
+ //# sourceMappingURL=spin-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spin-button.js","sourceRoot":"","sources":["../../src/react/spin-button.tsx"],"names":[],"mappings":";AAEA,OAAO,EAIN,KAAK,EACL,eAAe,EACf,MAAM,EACN,QAAQ,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAEN,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,GACf,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAoB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAkDzD,SAAS,iBAAiB,CACzB,KAAsB;IAEtB,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAC5B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC;IACf,CAAC;IAED,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC;QACrD,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,SAAS,CAAC;AACd,CAAC;AAED,SAAS,UAAU;IAClB,OAAO,CACN,cAAK,OAAO,EAAC,WAAW,EAAC,SAAS,EAAC,OAAO,YACzC,eAAM,CAAC,EAAC,SAAS,GAAG,GACf,CACN,CAAC;AACH,CAAC;AAED,SAAS,SAAS;IACjB,OAAO,CACN,cAAK,OAAO,EAAC,WAAW,EAAC,SAAS,EAAC,OAAO,YACzC,eAAM,CAAC,EAAC,gBAAgB,GAAG,GACtB,CACN,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CAA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