anvilui 0.2.0 → 0.4.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 (58) hide show
  1. package/AGENTS.md +34 -33
  2. package/README.md +42 -89
  3. package/dist/components/AnvilRoot/AnvilRoot.d.ts +2 -2
  4. package/dist/components/Combobox/Combobox.d.ts +8 -2
  5. package/dist/components/DateInput/DateInput.d.ts +5 -3
  6. package/dist/components/FABMenu/FABMenu.d.ts +4 -1
  7. package/dist/components/IconButton/IconButton.d.ts +5 -3
  8. package/dist/components/Input/Input.d.ts +5 -3
  9. package/dist/components/NavigationBar/NavigationBar.d.ts +1 -1
  10. package/dist/components/NavigationList/NavigationList.d.ts +1 -1
  11. package/dist/components/NavigationRail/NavigationRail.d.ts +1 -1
  12. package/dist/components/PinInput/PinInput.d.ts +5 -3
  13. package/dist/components/Progress/Progress.d.ts +4 -1
  14. package/dist/components/RadioGroup/RadioGroup.d.ts +3 -3
  15. package/dist/components/Search/Search.d.ts +22 -6
  16. package/dist/components/Select/Select.d.ts +6 -2
  17. package/dist/components/Skeleton/Skeleton.d.ts +3 -3
  18. package/dist/components/Slider/Slider.d.ts +9 -2
  19. package/dist/components/SquigglyWave/SquigglyWave.d.ts +26 -4
  20. package/dist/components/Textarea/Textarea.d.ts +6 -3
  21. package/dist/components/TimePicker/TimePicker.d.ts +7 -5
  22. package/dist/components/Toggle/Toggle.d.ts +2 -1
  23. package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -2
  24. package/dist/dev.d.ts +7 -2
  25. package/dist/index.cjs +528 -155
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.css +55 -26
  28. package/dist/index.css.map +1 -1
  29. package/dist/index.js +533 -141
  30. package/dist/index.js.map +1 -1
  31. package/dist/themes/types.d.ts +0 -4
  32. package/dist/utils.d.ts +5 -1
  33. package/docs/avatar.md +1 -1
  34. package/docs/badge.md +41 -41
  35. package/docs/calendar.md +1 -1
  36. package/docs/combobox.md +2 -1
  37. package/docs/composition.md +1 -1
  38. package/docs/date-input.md +4 -3
  39. package/docs/fab-menu.md +1 -0
  40. package/docs/forms.md +2 -2
  41. package/docs/icon-button.md +3 -2
  42. package/docs/input.md +1 -0
  43. package/docs/morph.md +4 -1
  44. package/docs/navigation-bar.md +1 -1
  45. package/docs/navigation-rail.md +1 -1
  46. package/docs/pin-input.md +1 -1
  47. package/docs/progress.md +37 -37
  48. package/docs/radio-group.md +18 -1
  49. package/docs/search.md +7 -7
  50. package/docs/select.md +3 -2
  51. package/docs/skeleton.md +33 -33
  52. package/docs/slider.md +51 -49
  53. package/docs/textarea.md +1 -1
  54. package/docs/theming.md +3 -2
  55. package/docs/time-picker.md +4 -3
  56. package/docs/toggle-group.md +1 -1
  57. package/docs/toggle.md +2 -2
  58. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -10,7 +10,20 @@ function cx(...parts) {
10
10
  return parts.filter(Boolean).join(" ");
11
11
  }
12
12
  function withClass(base, className) {
13
- return (state) => cx(base, typeof className === "function" ? className(state) : className);
13
+ return (state) => cx(
14
+ typeof base === "function" ? base(state) : base,
15
+ typeof className === "function" ? className(state) : className
16
+ );
17
+ }
18
+ function splitControlProps(props) {
19
+ const control = {};
20
+ const rest = {};
21
+ for (const [key, value] of Object.entries(props)) {
22
+ if (key.startsWith("aria-") || key.startsWith("data-"))
23
+ control[key] = value;
24
+ else rest[key] = value;
25
+ }
26
+ return { control, rest };
14
27
  }
15
28
  function mergeRefs(...refs) {
16
29
  return (value) => {
@@ -167,13 +180,15 @@ import 'anvilui/styles.css'
167
180
  "setup.md"
168
181
  );
169
182
  }
170
- function checkName(props, component, example, doc) {
183
+ var NO_TEXT = "It shows no text, so screen readers need an `aria-label`.";
184
+ var UNNAMED_GROUP = "Screen readers announce the group without saying what it's for: give it an `aria-label`.";
185
+ var UNNAMED_NAV = 'Screen readers list it as just "navigation": give it an `aria-label` to tell it apart from other navigation.';
186
+ function inNamedFieldset(el) {
187
+ return !!el?.closest("fieldset")?.querySelector(":scope > legend");
188
+ }
189
+ function checkName(props, component, example, doc, reason = NO_TEXT) {
171
190
  if (props["aria-label"] || props["aria-labelledby"]) return;
172
- devError(
173
- `<${component}> has no accessible name. It shows no text, so screen readers need an \`aria-label\`.`,
174
- example,
175
- doc
176
- );
191
+ devError(`<${component}> has no accessible name. ${reason}`, example, doc);
177
192
  }
178
193
 
179
194
  // src/components/Typography/Typography.tsx
@@ -309,12 +324,13 @@ function Avatar({
309
324
  const groupSize = useContext3(AvatarGroupContext);
310
325
  const size = sizeProp ?? groupSize ?? "normal";
311
326
  const letters = name ? initials(name) : "";
327
+ const named = !!(name || props["aria-label"] || props["aria-labelledby"]);
312
328
  return /* @__PURE__ */ jsxs3(
313
329
  BaseAvatar.Root,
314
330
  {
315
- role: name ? "img" : void 0,
331
+ role: named ? "img" : void 0,
316
332
  "aria-label": name,
317
- "aria-hidden": name ? void 0 : true,
333
+ "aria-hidden": named ? void 0 : true,
318
334
  ...props,
319
335
  className: withClass(
320
336
  cx(
@@ -358,6 +374,15 @@ function AvatarGroup({
358
374
  children,
359
375
  ...props
360
376
  }) {
377
+ if (process.env.NODE_ENV !== "production") {
378
+ checkName(
379
+ props,
380
+ "AvatarGroup",
381
+ '<AvatarGroup aria-label="Project members">...</AvatarGroup>',
382
+ "avatar-group.md",
383
+ UNNAMED_GROUP
384
+ );
385
+ }
361
386
  const avatars = Children.toArray(children);
362
387
  const overflow = max !== void 0 && avatars.length > max;
363
388
  const shown = overflow ? avatars.slice(0, Math.max(0, max - 1)) : avatars;
@@ -670,10 +695,9 @@ function HoldButton({
670
695
  "aria-description": "Press and hold to confirm",
671
696
  "data-hold": state === "idle" ? void 0 : state,
672
697
  "data-nudge": nudges % 2 === 0 ? "even" : "odd",
673
- className: (buttonState) => cx(
674
- "avl-hold-button",
675
- nudges > 0 && "avl-hold-button-nudged",
676
- typeof className === "function" ? className(buttonState) : className
698
+ className: withClass(
699
+ cx("avl-hold-button", nudges > 0 && "avl-hold-button-nudged"),
700
+ className
677
701
  ),
678
702
  style: (buttonState) => ({
679
703
  "--avl-hold-duration": `${holdDuration}ms`,
@@ -845,6 +869,7 @@ function IconButton({
845
869
  icon,
846
870
  color,
847
871
  fillType,
872
+ size = "normal",
848
873
  className,
849
874
  ...props
850
875
  }) {
@@ -877,7 +902,7 @@ function IconButton({
877
902
  {
878
903
  ...props,
879
904
  className: withClass(
880
- `avl-icon-button ${colorClass(color, fillType)}`,
905
+ `avl-icon-button ${colorClass(color, fillType)} avl-icon-button-size-${size}`,
881
906
  className
882
907
  ),
883
908
  children: /* @__PURE__ */ jsx13(Icon, { name: icon })
@@ -941,6 +966,12 @@ function Calendar({
941
966
  const now = /* @__PURE__ */ new Date();
942
967
  return selected ?? new Date(now.getFullYear(), now.getMonth(), now.getDate());
943
968
  });
969
+ const selectedIso = selected && toIso(selected);
970
+ const [shownSelection, setShownSelection] = useState3(selectedIso);
971
+ if (selectedIso !== shownSelection) {
972
+ setShownSelection(selectedIso);
973
+ if (selected) setFocused(selected);
974
+ }
944
975
  const [weekStart] = useState3(localeWeekStart);
945
976
  const dayRef = useRef4(null);
946
977
  const moveFocus = useRef4(false);
@@ -973,7 +1004,6 @@ function Calendar({
973
1004
  onValueChange?.(iso);
974
1005
  };
975
1006
  const today = toIso(/* @__PURE__ */ new Date());
976
- const selectedIso = selected && toIso(selected);
977
1007
  const focusedIso = toIso(focused);
978
1008
  const offset = (new Date(year, month, 1).getDay() - weekStart + 7) % 7;
979
1009
  const daysInMonth = new Date(year, month + 1, 0).getDate();
@@ -1789,51 +1819,150 @@ import { useId } from "react";
1789
1819
  import { Separator } from "@base-ui/react/separator";
1790
1820
 
1791
1821
  // src/components/SquigglyWave/SquigglyWave.tsx
1792
- import { useEffect as useEffect4, useRef as useRef8 } from "react";
1822
+ import { useEffect as useEffect4, useRef as useRef8, useState as useState6 } from "react";
1793
1823
  import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
1794
1824
  var WAVE_LENGTH = 40;
1795
1825
  var WAVE_AMPLITUDE = 3;
1796
- var WAVE_MIDDLE = 6;
1797
- var STROKE_CAP = 2;
1826
+ var WAVE_STROKE = 4;
1798
1827
  var WAVE_PERIOD = 1500;
1799
- function wavePath(from, to, phase) {
1800
- const start = from + STROKE_CAP;
1801
- const end = to - STROKE_CAP;
1828
+ var K = 2 * Math.PI / WAVE_LENGTH;
1829
+ var waveY = (x, phase, shape) => (
1830
+ // + phase: the ripple travels from the leading end back to the start
1831
+ shape.middle + shape.amplitude * Math.sin(K * x + phase)
1832
+ );
1833
+ var waveSlope = (x, phase, shape) => shape.amplitude * K * Math.cos(K * x + phase);
1834
+ function wavePath(from, to, phase, shape) {
1835
+ const start = from + shape.cap;
1836
+ const end = to - shape.cap;
1802
1837
  if (end < start) return "";
1803
- const y = (x) => WAVE_MIDDLE + // + phase: the ripple travels from the leading end back to the start
1804
- WAVE_AMPLITUDE * Math.sin(2 * Math.PI * x / WAVE_LENGTH + phase);
1838
+ const y = (x) => waveY(x, phase, shape);
1805
1839
  let d = `M${start} ${y(start)}`;
1806
1840
  for (let x = start + 2; x < end; x += 2) d += `L${x} ${y(x)}`;
1807
1841
  return d + `L${end} ${y(end)}`;
1808
1842
  }
1809
- function linePath(from, to) {
1810
- const start = from + STROKE_CAP;
1811
- const end = to - STROKE_CAP;
1812
- return end < start ? "" : `M${start} ${WAVE_MIDDLE}L${end} ${WAVE_MIDDLE}`;
1843
+ function linePath(from, to, shape) {
1844
+ const start = from + shape.cap;
1845
+ const end = to - shape.cap;
1846
+ return end < start ? "" : `M${start} ${shape.middle}L${end} ${shape.middle}`;
1847
+ }
1848
+ function smoothEasing(style) {
1849
+ const match = style.getPropertyValue("--avl-ease-smooth").match(/cubic-bezier\(([^)]+)\)/);
1850
+ const parts = match?.[1].split(",").map(Number);
1851
+ const [x1, y1, x2, y2] = parts?.length === 4 && parts.every((n) => !Number.isNaN(n)) ? parts : [0.2, 0, 0, 1];
1852
+ const bezier = (a, b, t) => 3 * a * t * (1 - t) ** 2 + 3 * b * t ** 2 * (1 - t) + t ** 3;
1853
+ return (x) => {
1854
+ if (x <= 0 || x >= 1) return x;
1855
+ let lo = 0;
1856
+ let hi = 1;
1857
+ for (let i = 0; i < 20; i++) {
1858
+ const mid = (lo + hi) / 2;
1859
+ if (bezier(x1, x2, mid) < x) lo = mid;
1860
+ else hi = mid;
1861
+ }
1862
+ return bezier(y1, y2, (lo + hi) / 2);
1863
+ };
1864
+ }
1865
+ function cssNumber(style, name, fallback) {
1866
+ const raw = style.getPropertyValue(name).trim();
1867
+ const n = parseFloat(raw);
1868
+ if (Number.isNaN(n)) return fallback;
1869
+ return raw.endsWith("ms") ? n : raw.endsWith("s") ? n * 1e3 : n;
1870
+ }
1871
+ function cssLength(el, name, fallback) {
1872
+ const host = el.parentElement;
1873
+ if (!host || !getComputedStyle(el).getPropertyValue(name).trim())
1874
+ return fallback;
1875
+ const probe = document.createElement("div");
1876
+ probe.style.cssText = `position:absolute;visibility:hidden;width:var(${name})`;
1877
+ host.append(probe);
1878
+ const px = probe.getBoundingClientRect().width;
1879
+ probe.remove();
1880
+ return px;
1881
+ }
1882
+ function capPath(x, y, slope, dir, half, length, radius) {
1883
+ const norm = Math.hypot(1, slope);
1884
+ const tx = dir / norm;
1885
+ const ty = dir * slope / norm;
1886
+ const p = (u, v) => `${x + u * tx - v * ty} ${y + u * ty + v * tx}`;
1887
+ const r = Math.max(0, Math.min(radius, length, half));
1888
+ return `M${p(-0.5, -half)}L${p(length - r, -half)}A${r} ${r} 0 0 1 ${p(length, r - half)}L${p(length, half - r)}A${r} ${r} 0 0 1 ${p(length - r, half)}L${p(-0.5, half)}Z`;
1889
+ }
1890
+ function useWaveMorph(squiggly) {
1891
+ const [previous, setPrevious] = useState6(squiggly);
1892
+ const [leaving, setLeaving] = useState6(false);
1893
+ const [changed, setChanged] = useState6(false);
1894
+ if (squiggly !== previous) {
1895
+ setPrevious(squiggly);
1896
+ setLeaving(!squiggly);
1897
+ setChanged(true);
1898
+ }
1899
+ return {
1900
+ show: squiggly || leaving,
1901
+ wave: {
1902
+ flat: !squiggly,
1903
+ startFlat: changed,
1904
+ onFlat: () => setLeaving(false)
1905
+ }
1906
+ };
1813
1907
  }
1814
1908
  function SquigglyWave(props) {
1815
1909
  const svgRef = useRef8(null);
1816
1910
  const waveRef = useRef8(null);
1817
1911
  const restRef = useRef8(null);
1818
- const dotRef = useRef8(null);
1912
+ const waveCapsRef = useRef8(null);
1913
+ const restCapsRef = useRef8(null);
1819
1914
  const span = useRef8(props.span);
1820
1915
  span.current = props.span;
1916
+ const flat = useRef8(props.flat ?? false);
1917
+ flat.current = props.flat ?? false;
1918
+ const onFlat = useRef8(props.onFlat);
1919
+ onFlat.current = props.onFlat;
1920
+ const startFlat = useRef8(props.startFlat ?? false);
1821
1921
  const still = props.still ?? false;
1822
1922
  const vertical = props.vertical ?? false;
1823
1923
  useEffect4(() => {
1824
1924
  const svg = svgRef.current;
1825
1925
  const wave = waveRef.current;
1826
1926
  const rest = restRef.current;
1827
- const dot = dotRef.current;
1828
- if (!svg || !wave || !rest || !dot) return;
1927
+ const waveCaps = waveCapsRef.current;
1928
+ const restCaps = restCapsRef.current;
1929
+ if (!svg || !wave || !rest || !waveCaps || !restCaps) return;
1829
1930
  const reduced = still || matchMedia("(prefers-reduced-motion: reduce)").matches;
1830
- const gap = parseFloat(
1831
- getComputedStyle(svg).getPropertyValue("--avl-wave-gap")
1832
- ) || 0;
1931
+ const style = getComputedStyle(svg);
1932
+ const gap = cssLength(svg, "--avl-wave-gap", 0);
1933
+ const flatStroke = cssLength(svg, "--avl-wave-flat-stroke", WAVE_STROKE);
1934
+ const flatRadius = cssLength(svg, "--avl-wave-flat-radius", -1);
1935
+ const flatRestRadius = cssLength(svg, "--avl-wave-flat-rest-radius", -1);
1936
+ const shapedCaps = flatRadius >= 0 || flatRestRadius >= 0;
1937
+ const linecap = shapedCaps ? "butt" : "";
1938
+ wave.style.strokeLinecap = linecap;
1939
+ rest.style.strokeLinecap = linecap;
1940
+ const duration = cssNumber(style, "--avl-ease-length-slow", 300);
1941
+ const ease = smoothEasing(style);
1833
1942
  let current = null;
1834
1943
  let frame = 0;
1944
+ let flatness = startFlat.current ? 1 : 0;
1945
+ let notified = false;
1946
+ let last = null;
1835
1947
  const draw = (now) => {
1948
+ const target = flat.current ? 1 : 0;
1949
+ const step = reduced || last === null || duration <= 0 ? 1 : (now - last) / duration;
1950
+ if (last === null && !reduced) {
1951
+ last = now;
1952
+ } else {
1953
+ last = now;
1954
+ flatness = target > flatness ? Math.min(target, flatness + step) : Math.max(target, flatness - step);
1955
+ }
1956
+ if (flatness < 1) notified = false;
1957
+ const eased = target === 1 ? ease(flatness) : 1 - ease(1 - flatness);
1958
+ const stroke = WAVE_STROKE + (flatStroke - WAVE_STROKE) * eased;
1959
+ svg.style.setProperty("--avl-wave-stroke", `${stroke}px`);
1836
1960
  const width = vertical ? svg.clientHeight : svg.clientWidth;
1961
+ const shape = {
1962
+ middle: (vertical ? svg.clientWidth : svg.clientHeight) / 2,
1963
+ amplitude: WAVE_AMPLITUDE * (1 - eased),
1964
+ cap: stroke / 2
1965
+ };
1837
1966
  const next = span.current(width, gap, svg, now);
1838
1967
  if (!current || next.snap || reduced) {
1839
1968
  current = { from: next.from, to: next.to };
@@ -1842,17 +1971,61 @@ function SquigglyWave(props) {
1842
1971
  current.to += (next.to - current.to) * 0.15;
1843
1972
  }
1844
1973
  const phase = reduced ? 0 : now / WAVE_PERIOD * 2 * Math.PI;
1845
- wave.setAttribute("d", wavePath(current.from, current.to, phase));
1974
+ wave.setAttribute(
1975
+ "d",
1976
+ wavePath(current.from, current.to, phase, shape)
1977
+ );
1846
1978
  rest.setAttribute(
1847
1979
  "d",
1848
1980
  (next.rest ?? []).map(
1849
- ([a, b]) => next.restWave ? wavePath(a, b, phase) : linePath(a, b)
1981
+ ([a, b]) => next.restWave ? wavePath(a, b, phase, shape) : linePath(a, b, shape)
1850
1982
  ).join("")
1851
1983
  );
1852
- dot.setAttribute(
1853
- "d",
1854
- next.dot ? linePath(width - 2 * STROKE_CAP, width) : ""
1855
- );
1984
+ if (shapedCaps) {
1985
+ const half = stroke / 2;
1986
+ const caps = (a, b, wavy, insideRadius) => {
1987
+ if (b - a <= 0) return "";
1988
+ const length = Math.min(half, (b - a) / 2);
1989
+ const radius = (inside) => inside && insideRadius >= 0 ? half + (insideRadius - half) * eased : half;
1990
+ const at = (x) => wavy ? [
1991
+ waveY(x, phase, shape),
1992
+ waveSlope(x, phase, shape)
1993
+ ] : [shape.middle, 0];
1994
+ const [y0, s0] = at(a + length);
1995
+ const [y1, s1] = at(b - length);
1996
+ return capPath(
1997
+ a + length,
1998
+ y0,
1999
+ s0,
2000
+ -1,
2001
+ half,
2002
+ length,
2003
+ radius(a > 0.5)
2004
+ ) + capPath(
2005
+ b - length,
2006
+ y1,
2007
+ s1,
2008
+ 1,
2009
+ half,
2010
+ length,
2011
+ radius(b < width - 0.5)
2012
+ );
2013
+ };
2014
+ waveCaps.setAttribute(
2015
+ "d",
2016
+ caps(current.from, current.to, true, flatRadius)
2017
+ );
2018
+ restCaps.setAttribute(
2019
+ "d",
2020
+ (next.rest ?? []).map(
2021
+ ([a, b]) => caps(a, b, next.restWave ?? false, flatRestRadius)
2022
+ ).join("")
2023
+ );
2024
+ }
2025
+ if (flatness === 1 && target === 1 && !notified) {
2026
+ notified = true;
2027
+ onFlat.current?.();
2028
+ }
1856
2029
  if (!still) frame = requestAnimationFrame(draw);
1857
2030
  };
1858
2031
  if (still) {
@@ -1865,8 +2038,15 @@ function SquigglyWave(props) {
1865
2038
  }, [still, vertical]);
1866
2039
  return /* @__PURE__ */ jsx19("svg", { ref: svgRef, className: "avl-squiggly-wave", "aria-hidden": true, children: /* @__PURE__ */ jsxs11("g", { transform: vertical ? "matrix(0 1 1 0 0 0)" : void 0, children: [
1867
2040
  /* @__PURE__ */ jsx19("path", { ref: restRef, className: "avl-squiggly-wave-rest" }),
2041
+ /* @__PURE__ */ jsx19(
2042
+ "path",
2043
+ {
2044
+ ref: restCapsRef,
2045
+ className: "avl-squiggly-wave-cap avl-squiggly-wave-rest"
2046
+ }
2047
+ ),
1868
2048
  /* @__PURE__ */ jsx19("path", { ref: waveRef }),
1869
- /* @__PURE__ */ jsx19("path", { ref: dotRef })
2049
+ /* @__PURE__ */ jsx19("path", { ref: waveCapsRef, className: "avl-squiggly-wave-cap" })
1870
2050
  ] }) });
1871
2051
  }
1872
2052
 
@@ -2025,7 +2205,7 @@ function FAB({
2025
2205
  }
2026
2206
 
2027
2207
  // src/components/FABMenu/FABMenu.tsx
2028
- import { createContext as createContext4, useContext as useContext10, useRef as useRef10, useState as useState6 } from "react";
2208
+ import { createContext as createContext4, useContext as useContext10, useRef as useRef10, useState as useState7 } from "react";
2029
2209
  import { Menu as BaseMenu } from "@base-ui/react/menu";
2030
2210
  import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
2031
2211
  var FABMenuColorContext = createContext4("primary");
@@ -2039,6 +2219,7 @@ function FABMenu({
2039
2219
  align = "end",
2040
2220
  sticky = true,
2041
2221
  className,
2222
+ ref,
2042
2223
  children,
2043
2224
  ...props
2044
2225
  }) {
@@ -2046,7 +2227,7 @@ function FABMenu({
2046
2227
  if (process.env.NODE_ENV !== "production") {
2047
2228
  checkRoot(avl !== null, "FABMenu");
2048
2229
  }
2049
- const [localOpen, setLocalOpen] = useState6(props.defaultOpen ?? false);
2230
+ const [localOpen, setLocalOpen] = useState7(props.defaultOpen ?? false);
2050
2231
  const open = props.open ?? localOpen;
2051
2232
  const trigger = useRef10(null);
2052
2233
  useMagnet(trigger, sticky && !open && !props.disabled);
@@ -2062,7 +2243,7 @@ function FABMenu({
2062
2243
  /* @__PURE__ */ jsxs14(
2063
2244
  BaseMenu.Trigger,
2064
2245
  {
2065
- ref: trigger,
2246
+ ref: mergeRefs(trigger, ref),
2066
2247
  "aria-label": ariaLabel,
2067
2248
  className: cx(
2068
2249
  "avl-fab avl-fab-size-normal avl-fab-menu-trigger",
@@ -2159,6 +2340,7 @@ function Input({
2159
2340
  label,
2160
2341
  size = "normal",
2161
2342
  className,
2343
+ style,
2162
2344
  placeholder,
2163
2345
  ...props
2164
2346
  }) {
@@ -2169,6 +2351,7 @@ function Input({
2169
2351
  return /* @__PURE__ */ jsxs15(
2170
2352
  "label",
2171
2353
  {
2354
+ style,
2172
2355
  className: cx(
2173
2356
  "avl-input",
2174
2357
  `avl-input-size-${size}`,
@@ -2192,7 +2375,7 @@ function Input({
2192
2375
  }
2193
2376
 
2194
2377
  // src/components/Kbd/Kbd.tsx
2195
- import { useEffect as useEffect6, useState as useState7 } from "react";
2378
+ import { useEffect as useEffect6, useState as useState8 } from "react";
2196
2379
  import { jsx as jsx25 } from "react/jsx-runtime";
2197
2380
  function Kbd({
2198
2381
  listen = true,
@@ -2246,7 +2429,7 @@ function keyFromText(children) {
2246
2429
  return aliases[text] ?? (text || null);
2247
2430
  }
2248
2431
  function useKeyHeld(key) {
2249
- const [held, setHeld] = useState7(false);
2432
+ const [held, setHeld] = useState8(false);
2250
2433
  useEffect6(() => {
2251
2434
  if (!key) return;
2252
2435
  const target = key.toLowerCase();
@@ -2729,6 +2912,8 @@ function Progress({
2729
2912
  );
2730
2913
  }
2731
2914
  const { value, min = 0, max = 100 } = props;
2915
+ const wavy = squiggly && type === "linear";
2916
+ const morph2 = useWaveMorph(wavy);
2732
2917
  const fraction = value == null ? 0 : Math.min(1, Math.max(0, (value - min) / (max - min)));
2733
2918
  const pct = fraction * 100;
2734
2919
  const ring = type === "inline" ? INLINE_RING : RING;
@@ -2743,7 +2928,9 @@ function Progress({
2743
2928
  `avl-progress-${type}`,
2744
2929
  // Inline is a smaller ring, so it shares the circular styles
2745
2930
  type === "inline" && "avl-progress-circular",
2746
- squiggly && type === "linear" && "avl-progress-squiggly"
2931
+ wavy && "avl-progress-squiggly",
2932
+ // Also while flattening into the plain bar
2933
+ morph2.show && "avl-progress-wave"
2747
2934
  ),
2748
2935
  className
2749
2936
  ),
@@ -2754,9 +2941,10 @@ function Progress({
2754
2941
  children: [
2755
2942
  label != null && /* @__PURE__ */ jsx33(BaseProgress.Label, { className: "avl-progress-label", children: label }),
2756
2943
  type === "linear" ? /* @__PURE__ */ jsxs19(BaseProgress.Track, { className: "avl-progress-track", children: [
2757
- squiggly ? /* @__PURE__ */ jsx33(
2944
+ morph2.show ? /* @__PURE__ */ jsx33(
2758
2945
  SquigglyWave,
2759
2946
  {
2947
+ ...morph2.wave,
2760
2948
  span: (width, gap, _svg, now) => value == null ? loadingSpan(width, gap, now) : (
2761
2949
  // Fill up to the value; .avl-progress-rest
2762
2950
  // draws the track one gap after it
@@ -2823,7 +3011,13 @@ function loadingSpan(width, gap, now) {
2823
3011
  }
2824
3012
 
2825
3013
  // src/components/ToggleGroup/ToggleGroup.tsx
2826
- import { createContext as createContext6, useContext as useContext15, useLayoutEffect as useLayoutEffect3, useRef as useRef11 } from "react";
3014
+ import {
3015
+ createContext as createContext6,
3016
+ useContext as useContext15,
3017
+ useEffect as useEffect7,
3018
+ useLayoutEffect as useLayoutEffect3,
3019
+ useRef as useRef11
3020
+ } from "react";
2827
3021
  import { Radio as BaseRadio } from "@base-ui/react/radio";
2828
3022
  import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
2829
3023
  import { Toggle as BaseToggle } from "@base-ui/react/toggle";
@@ -2842,6 +3036,17 @@ function ToggleGroup({
2842
3036
  }) {
2843
3037
  const groupRef = useRef11(null);
2844
3038
  const indicatorRef = useRef11(null);
3039
+ useEffect7(() => {
3040
+ if (process.env.NODE_ENV === "production") return;
3041
+ if (inNamedFieldset(groupRef.current)) return;
3042
+ checkName(
3043
+ props,
3044
+ "ToggleGroup",
3045
+ '<ToggleGroup aria-label="View" defaultValue="list">...</ToggleGroup>',
3046
+ "toggle-group.md",
3047
+ UNNAMED_GROUP
3048
+ );
3049
+ }, []);
2845
3050
  useLayoutEffect3(() => {
2846
3051
  const group = groupRef.current;
2847
3052
  const indicator = indicatorRef.current;
@@ -2889,7 +3094,7 @@ function ToggleGroup({
2889
3094
  {
2890
3095
  ...props,
2891
3096
  multiple: true,
2892
- ref,
3097
+ ref: mergeRefs(groupRef, ref),
2893
3098
  className: classes,
2894
3099
  children
2895
3100
  }
@@ -2969,15 +3174,30 @@ function ToggleGroupItem({
2969
3174
  // src/components/RadioGroup/RadioGroup.tsx
2970
3175
  import { Radio as BaseRadio2 } from "@base-ui/react/radio";
2971
3176
  import { RadioGroup as BaseRadioGroup2 } from "@base-ui/react/radio-group";
3177
+ import { useEffect as useEffect8, useRef as useRef12 } from "react";
2972
3178
  import { jsx as jsx35 } from "react/jsx-runtime";
2973
3179
  function RadioGroup({
2974
3180
  className,
3181
+ ref,
2975
3182
  ...props
2976
3183
  }) {
3184
+ const local = useRef12(null);
3185
+ useEffect8(() => {
3186
+ if (process.env.NODE_ENV === "production") return;
3187
+ if (inNamedFieldset(local.current)) return;
3188
+ checkName(
3189
+ props,
3190
+ "RadioGroup",
3191
+ '<RadioGroup aria-label="Plan" defaultValue="free">...</RadioGroup>\n// or inside <fieldset><legend>Plan</legend>...</fieldset>',
3192
+ "radio-group.md",
3193
+ UNNAMED_GROUP
3194
+ );
3195
+ }, []);
2977
3196
  return /* @__PURE__ */ jsx35(
2978
3197
  BaseRadioGroup2,
2979
3198
  {
2980
3199
  ...props,
3200
+ ref: mergeRefs(local, ref),
2981
3201
  className: withClass("avl-radio-group", className)
2982
3202
  }
2983
3203
  );
@@ -3012,9 +3232,12 @@ function Select({
3012
3232
  placeholder,
3013
3233
  size = "normal",
3014
3234
  className,
3235
+ style,
3236
+ ref,
3015
3237
  children,
3016
- ...props
3238
+ ...allProps
3017
3239
  }) {
3240
+ const { control, rest: props } = splitControlProps(allProps);
3018
3241
  const avl = useContext16(AnvilContext);
3019
3242
  if (process.env.NODE_ENV !== "production") {
3020
3243
  checkRoot(avl !== null, "Select");
@@ -3023,6 +3246,7 @@ function Select({
3023
3246
  /* @__PURE__ */ jsxs21(
3024
3247
  "div",
3025
3248
  {
3249
+ style,
3026
3250
  className: cx(
3027
3251
  "avl-input",
3028
3252
  "avl-select",
@@ -3031,16 +3255,24 @@ function Select({
3031
3255
  className
3032
3256
  ),
3033
3257
  children: [
3034
- /* @__PURE__ */ jsxs21(BaseSelect.Trigger, { className: "avl-input-field avl-select-trigger", children: [
3035
- /* @__PURE__ */ jsx36(
3036
- BaseSelect.Value,
3037
- {
3038
- className: "avl-select-value",
3039
- placeholder
3040
- }
3041
- ),
3042
- /* @__PURE__ */ jsx36(BaseSelect.Icon, { className: "avl-select-icon", children: /* @__PURE__ */ jsx36(Icon, { name: "arrow_drop_down" }) })
3043
- ] }),
3258
+ /* @__PURE__ */ jsxs21(
3259
+ BaseSelect.Trigger,
3260
+ {
3261
+ ...control,
3262
+ ref,
3263
+ className: "avl-input-field avl-select-trigger",
3264
+ children: [
3265
+ /* @__PURE__ */ jsx36(
3266
+ BaseSelect.Value,
3267
+ {
3268
+ className: "avl-select-value",
3269
+ placeholder
3270
+ }
3271
+ ),
3272
+ /* @__PURE__ */ jsx36(BaseSelect.Icon, { className: "avl-select-icon", children: /* @__PURE__ */ jsx36(Icon, { name: "arrow_drop_down" }) })
3273
+ ]
3274
+ }
3275
+ ),
3044
3276
  label != null && /* @__PURE__ */ jsx36(BaseSelect.Label, { className: "avl-input-label", children: label }),
3045
3277
  /* @__PURE__ */ jsx36("fieldset", { "aria-hidden": true, className: "avl-input-outline", children: /* @__PURE__ */ jsx36("legend", { children: label != null && size === "normal" && /* @__PURE__ */ jsx36("span", { children: label }) }) })
3046
3278
  ]
@@ -3072,7 +3304,12 @@ function SelectItem({ className, children, ...props }) {
3072
3304
  }
3073
3305
 
3074
3306
  // src/components/TimePicker/TimePicker.tsx
3075
- import { useId as useId2, useRef as useRef12, useState as useState8 } from "react";
3307
+ import {
3308
+ useEffect as useEffect9,
3309
+ useId as useId2,
3310
+ useRef as useRef13,
3311
+ useState as useState9
3312
+ } from "react";
3076
3313
  import { Fragment as Fragment4, jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
3077
3314
  var pad2 = (n) => String(n).padStart(2, "0");
3078
3315
  function localeHourCycle() {
@@ -3097,16 +3334,29 @@ function TimePicker({
3097
3334
  defaultOpen,
3098
3335
  onOpenChange,
3099
3336
  className,
3100
- ...props
3337
+ ref,
3338
+ id,
3339
+ ...allProps
3101
3340
  }) {
3102
- const [internal, setInternal] = useState8(defaultValue);
3341
+ const { control, rest: props } = splitControlProps(allProps);
3342
+ const [internal, setInternal] = useState9(defaultValue);
3103
3343
  const value = valueProp !== void 0 ? valueProp : internal;
3104
3344
  const time = parseTime(value);
3105
3345
  const cycle = hourCycle ?? localeHourCycle();
3106
3346
  const labelId = useId2();
3107
3347
  const valueId = useId2();
3348
+ const trigger = useRef13(null);
3349
+ useEffect9(() => {
3350
+ if (process.env.NODE_ENV === "production") return;
3351
+ if (trigger.current?.closest(".avl-field"))
3352
+ devError(
3353
+ "<TimePicker> is inside a <Field>, but it doesn't take the Field's `name`, `disabled` or validation.",
3354
+ '<TimePicker label="Alarm" name="alarm" disabled={locked} /> // outside any Field',
3355
+ "time-picker.md"
3356
+ );
3357
+ }, []);
3108
3358
  const setTime = (t) => {
3109
- const next = `${pad2(t.h)}:${pad2(t.m)}`;
3359
+ const next = t && `${pad2(t.h)}:${pad2(t.m)}`;
3110
3360
  setInternal(next);
3111
3361
  onValueChange?.(next);
3112
3362
  };
@@ -3138,6 +3388,9 @@ function TimePicker({
3138
3388
  /* @__PURE__ */ jsxs22(
3139
3389
  PopoverTrigger,
3140
3390
  {
3391
+ ...control,
3392
+ ref: mergeRefs(trigger, ref),
3393
+ id,
3141
3394
  disabled,
3142
3395
  className: "avl-input-field avl-select-trigger",
3143
3396
  "data-placeholder": time ? void 0 : "",
@@ -3160,7 +3413,8 @@ function TimePicker({
3160
3413
  type,
3161
3414
  time,
3162
3415
  cycle,
3163
- onChange: setTime
3416
+ onChange: setTime,
3417
+ onClear: () => setTime(null)
3164
3418
  }
3165
3419
  ) })
3166
3420
  ]
@@ -3168,8 +3422,8 @@ function TimePicker({
3168
3422
  );
3169
3423
  }
3170
3424
  function TimePanel(props) {
3171
- const { type, time, cycle, onChange } = props;
3172
- const [mode, setMode] = useState8("hour");
3425
+ const { type, time, cycle, onChange, onClear } = props;
3426
+ const [mode, setMode] = useState9("hour");
3173
3427
  const pm = time ? time.h >= 12 : false;
3174
3428
  const hourText = time ? pad2(displayHour(time.h, cycle)) : "--";
3175
3429
  const minuteText = time ? pad2(time.m) : "--";
@@ -3257,12 +3511,20 @@ function TimePanel(props) {
3257
3511
  onChange,
3258
3512
  onHourDone: () => setMode("minute")
3259
3513
  }
3260
- )
3514
+ ),
3515
+ time && /* @__PURE__ */ jsx37("div", { className: "avl-time-picker-actions", children: /* @__PURE__ */ jsx37(
3516
+ PopoverClose,
3517
+ {
3518
+ render: /* @__PURE__ */ jsx37(Button, { fillType: "text", size: "small" }),
3519
+ onClick: onClear,
3520
+ children: "Clear"
3521
+ }
3522
+ ) })
3261
3523
  ] });
3262
3524
  }
3263
3525
  function SpinInput(props) {
3264
3526
  const { label, value, min, max, onChange } = props;
3265
- const [draft, setDraft] = useState8(null);
3527
+ const [draft, setDraft] = useState9(null);
3266
3528
  const range = max - min + 1;
3267
3529
  return /* @__PURE__ */ jsx37(
3268
3530
  "input",
@@ -3311,7 +3573,7 @@ function Dial(props) {
3311
3573
  const h = time?.h ?? 0;
3312
3574
  const m = time?.m ?? 0;
3313
3575
  const isHour = mode === "hour";
3314
- const [dragging, setDragging] = useState8(false);
3576
+ const [dragging, setDragging] = useState9(false);
3315
3577
  const labels = Array.from(
3316
3578
  { length: 12 },
3317
3579
  (_, i) => !isHour ? [{ value: i * 5, text: pad2(i * 5), inner: false }] : cycle === 12 ? [{ value: i, text: String(i || 12), inner: false }] : [
@@ -3321,7 +3583,7 @@ function Dial(props) {
3321
3583
  ).flat();
3322
3584
  const radius = isHour && cycle === 24 && h >= 12 ? INNER : OUTER;
3323
3585
  const target = isHour ? h % 12 * 30 : m * 6;
3324
- const angleRef = useRef12(null);
3586
+ const angleRef = useRef13(null);
3325
3587
  const prev = angleRef.current;
3326
3588
  const angle = prev == null ? target : prev + ((target - prev) % 360 + 540) % 360 - 180;
3327
3589
  angleRef.current = angle;
@@ -3470,7 +3732,12 @@ function Dial(props) {
3470
3732
  }
3471
3733
 
3472
3734
  // src/components/DateInput/DateInput.tsx
3473
- import { useId as useId3, useRef as useRef13, useState as useState9 } from "react";
3735
+ import {
3736
+ useEffect as useEffect10,
3737
+ useId as useId3,
3738
+ useRef as useRef14,
3739
+ useState as useState10
3740
+ } from "react";
3474
3741
  import { Input as BaseInput2 } from "@base-ui/react/input";
3475
3742
  import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
3476
3743
  var numericFormat = () => new Intl.DateTimeFormat(void 0, {
@@ -3486,19 +3753,36 @@ function DateInput({
3486
3753
  size = "normal",
3487
3754
  disabled,
3488
3755
  id,
3756
+ onChange,
3489
3757
  onBlur,
3490
3758
  className,
3759
+ style,
3760
+ ref,
3491
3761
  ...props
3492
3762
  }) {
3493
- const [internal, setInternal] = useState9(defaultValue);
3763
+ const [internal, setInternal] = useState10(defaultValue);
3494
3764
  const value = valueProp !== void 0 ? valueProp : internal;
3495
3765
  const date = fromIso(value);
3496
- const [draft, setDraft] = useState9(null);
3497
- const [open, setOpen] = useState9(false);
3498
- const fieldRef = useRef13(null);
3499
- const popupRef = useRef13(null);
3766
+ const [draft, setDraft] = useState10(null);
3767
+ const [open, setOpen] = useState10(false);
3768
+ const fieldRef = useRef14(null);
3769
+ const popupRef = useRef14(null);
3500
3770
  const generatedId = useId3();
3501
3771
  const inputId = id ?? generatedId;
3772
+ const inputRef = useRef14(null);
3773
+ const iso = useRef14("");
3774
+ iso.current = date ? toIso(date) : "";
3775
+ useEffect10(() => {
3776
+ const form = inputRef.current?.form;
3777
+ if (!form) return;
3778
+ const onFormData = (event) => {
3779
+ const input = inputRef.current;
3780
+ if (input?.name && !input.disabled)
3781
+ event.formData.set(input.name, iso.current);
3782
+ };
3783
+ form.addEventListener("formdata", onFormData);
3784
+ return () => form.removeEventListener("formdata", onFormData);
3785
+ }, []);
3502
3786
  const fmt = numericFormat();
3503
3787
  const order = fieldOrder(fmt);
3504
3788
  const invalid = draft != null && draft.trim() !== "" && !parseTyped(draft, order);
@@ -3512,6 +3796,7 @@ function DateInput({
3512
3796
  "div",
3513
3797
  {
3514
3798
  ref: fieldRef,
3799
+ style,
3515
3800
  className: cx(
3516
3801
  "avl-input",
3517
3802
  "avl-date-input",
@@ -3524,6 +3809,7 @@ function DateInput({
3524
3809
  BaseInput2,
3525
3810
  {
3526
3811
  ...props,
3812
+ ref: mergeRefs(inputRef, ref),
3527
3813
  id: inputId,
3528
3814
  disabled,
3529
3815
  className: "avl-input-field",
@@ -3540,6 +3826,7 @@ function DateInput({
3540
3826
  const typed = parseTyped(text, order);
3541
3827
  if (typed) commit(typed);
3542
3828
  }
3829
+ onChange?.(e);
3543
3830
  },
3544
3831
  onBlur: (e) => {
3545
3832
  if (!invalid) setDraft(null);
@@ -3581,8 +3868,8 @@ function DateInput({
3581
3868
  Calendar,
3582
3869
  {
3583
3870
  value: date && toIso(date),
3584
- onValueChange: (iso) => {
3585
- commit(fromIso(iso));
3871
+ onValueChange: (iso2) => {
3872
+ commit(fromIso(iso2));
3586
3873
  setDraft(null);
3587
3874
  setOpen(false);
3588
3875
  }
@@ -3594,7 +3881,10 @@ function DateInput({
3594
3881
  }
3595
3882
 
3596
3883
  // src/components/Combobox/Combobox.tsx
3597
- import { useContext as useContext17, useId as useId4 } from "react";
3884
+ import {
3885
+ useContext as useContext17,
3886
+ useId as useId4
3887
+ } from "react";
3598
3888
  import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
3599
3889
  import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
3600
3890
  function Combobox({
@@ -3604,8 +3894,12 @@ function Combobox({
3604
3894
  empty,
3605
3895
  size = "normal",
3606
3896
  className,
3607
- ...props
3897
+ style,
3898
+ ref,
3899
+ id,
3900
+ ...allProps
3608
3901
  }) {
3902
+ const { control, rest: props } = splitControlProps(allProps);
3609
3903
  const avl = useContext17(AnvilContext);
3610
3904
  if (process.env.NODE_ENV !== "production") {
3611
3905
  checkRoot(avl !== null, "Combobox");
@@ -3616,12 +3910,14 @@ function Combobox({
3616
3910
  "combobox.md"
3617
3911
  );
3618
3912
  }
3619
- const inputId = useId4();
3913
+ const generatedId = useId4();
3914
+ const inputId = id ?? generatedId;
3620
3915
  const labelId = useId4();
3621
3916
  return /* @__PURE__ */ jsxs24(BaseCombobox.Root, { ...props, children: [
3622
3917
  /* @__PURE__ */ jsxs24(
3623
3918
  BaseCombobox.InputGroup,
3624
3919
  {
3920
+ style,
3625
3921
  className: cx(
3626
3922
  "avl-input",
3627
3923
  "avl-combobox",
@@ -3633,6 +3929,8 @@ function Combobox({
3633
3929
  /* @__PURE__ */ jsx39(
3634
3930
  BaseCombobox.Input,
3635
3931
  {
3932
+ ...control,
3933
+ ref,
3636
3934
  id: inputId,
3637
3935
  className: "avl-input-field",
3638
3936
  placeholder: placeholder ?? " "
@@ -3702,6 +4000,7 @@ function PinInput({
3702
4000
  size = "normal",
3703
4001
  slotLabel = defaultSlotLabel,
3704
4002
  className,
4003
+ style,
3705
4004
  id,
3706
4005
  length,
3707
4006
  ...props
@@ -3712,6 +4011,7 @@ function PinInput({
3712
4011
  return /* @__PURE__ */ jsxs25(
3713
4012
  "div",
3714
4013
  {
4014
+ style,
3715
4015
  className: cx(
3716
4016
  "avl-pin-input",
3717
4017
  `avl-pin-input-size-${size}`,
@@ -3782,11 +4082,13 @@ function Toggle2({
3782
4082
  BaseToggle2,
3783
4083
  {
3784
4084
  ...props,
3785
- className: (state) => cx(
3786
- "avl-toggle",
3787
- icon ? "avl-icon-button" : `avl-button avl-button-size-${size}`,
3788
- state.pressed ? colorClass(color, "filled") : colorClass("container", fillType),
3789
- typeof className === "function" ? className(state) : className
4085
+ className: withClass(
4086
+ (state) => cx(
4087
+ "avl-toggle",
4088
+ icon ? `avl-icon-button avl-icon-button-size-${size}` : `avl-button avl-button-size-${size}`,
4089
+ state.pressed ? colorClass(color, "filled") : colorClass("container", fillType)
4090
+ ),
4091
+ className
3790
4092
  ),
3791
4093
  children: icon ? /* @__PURE__ */ jsx41(Icon, { name: icon }) : /* @__PURE__ */ jsxs26(Fragment5, { children: [
3792
4094
  startIcon && /* @__PURE__ */ jsx41(Icon, { name: startIcon }),
@@ -3806,11 +4108,17 @@ function Search({
3806
4108
  placeholder,
3807
4109
  "aria-label": ariaLabel,
3808
4110
  empty,
4111
+ color = "surface",
3809
4112
  clearLabel = "Clear",
3810
4113
  className,
3811
- ...props
4114
+ style,
4115
+ ref,
4116
+ id,
4117
+ ...allProps
3812
4118
  }) {
4119
+ const { control, rest: props } = splitControlProps(allProps);
3813
4120
  const avl = useContext18(AnvilContext);
4121
+ const suggests = children !== void 0;
3814
4122
  if (process.env.NODE_ENV !== "production") {
3815
4123
  checkRoot(avl !== null, "Search");
3816
4124
  checkName(
@@ -3819,23 +4127,37 @@ function Search({
3819
4127
  '<Search aria-label="Search mail" items={items}>{(item) => ...}</Search>',
3820
4128
  "search.md"
3821
4129
  );
3822
- if (typeof children !== "function")
4130
+ if (children !== void 0 && typeof children !== "function")
3823
4131
  devError(
3824
4132
  "<Search> children must be a function that renders one suggestion, plus an `items` array to filter.",
3825
4133
  '<Search aria-label="Search" items={items}>\n {(item: string) => <SearchItem key={item} value={item}>{item}</SearchItem>}\n</Search>',
3826
4134
  "search.md"
3827
4135
  );
4136
+ if (children === void 0 && props.items?.length)
4137
+ devError(
4138
+ "<Search> has `items` but no children, so the suggestions never show.",
4139
+ '<Search aria-label="Search" items={items}>\n {(item: string) => <SearchItem key={item} value={item}>{item}</SearchItem>}\n</Search>',
4140
+ "search.md"
4141
+ );
3828
4142
  }
3829
- return /* @__PURE__ */ jsxs27(BaseAutocomplete.Root, { ...props, children: [
4143
+ return /* @__PURE__ */ jsxs27(BaseAutocomplete.Root, { ...props, ...!suggests && { open: false }, children: [
3830
4144
  /* @__PURE__ */ jsxs27(
3831
4145
  BaseAutocomplete.InputGroup,
3832
4146
  {
3833
- className: cx("avl-search", className),
4147
+ style,
4148
+ className: cx(
4149
+ "avl-search",
4150
+ colorClass(color, "filled"),
4151
+ className
4152
+ ),
3834
4153
  children: [
3835
4154
  /* @__PURE__ */ jsx42(Icon, { name: "search" }),
3836
4155
  /* @__PURE__ */ jsx42(
3837
4156
  BaseAutocomplete.Input,
3838
4157
  {
4158
+ ...control,
4159
+ ref,
4160
+ id,
3839
4161
  className: "avl-search-input",
3840
4162
  placeholder,
3841
4163
  "aria-label": ariaLabel
@@ -3849,7 +4171,7 @@ function Search({
3849
4171
  {
3850
4172
  icon: "close",
3851
4173
  fillType: "text",
3852
- color: "container",
4174
+ color,
3853
4175
  "aria-label": clearLabel
3854
4176
  }
3855
4177
  )
@@ -3858,7 +4180,7 @@ function Search({
3858
4180
  ]
3859
4181
  }
3860
4182
  ),
3861
- /* @__PURE__ */ jsx42(BaseAutocomplete.Portal, { container: avl?.rootRef, children: /* @__PURE__ */ jsx42(
4183
+ suggests && /* @__PURE__ */ jsx42(BaseAutocomplete.Portal, { container: avl?.rootRef, children: /* @__PURE__ */ jsx42(
3862
4184
  BaseAutocomplete.Positioner,
3863
4185
  {
3864
4186
  className: "avl-menu-positioner",
@@ -3893,11 +4215,21 @@ function SearchItem({
3893
4215
  // src/components/Skeleton/Skeleton.tsx
3894
4216
  import { jsx as jsx43 } from "react/jsx-runtime";
3895
4217
  function Skeleton({
3896
- variant = "text",
4218
+ type = "text",
3897
4219
  animation = "pulse",
3898
4220
  className,
3899
4221
  ...props
3900
4222
  }) {
4223
+ if (process.env.NODE_ENV !== "production") {
4224
+ checkProp(
4225
+ props,
4226
+ "variant",
4227
+ "Skeleton",
4228
+ "The shape is `type`, as on Progress and Typography.",
4229
+ '<Skeleton type="circular" style={{ width: 40, height: 40 }} />\n// type: text | circular | rectangular',
4230
+ "skeleton.md"
4231
+ );
4232
+ }
3901
4233
  return /* @__PURE__ */ jsx43(
3902
4234
  "span",
3903
4235
  {
@@ -3905,7 +4237,7 @@ function Skeleton({
3905
4237
  ...props,
3906
4238
  className: cx(
3907
4239
  "avl-skeleton",
3908
- `avl-skeleton-${variant}`,
4240
+ `avl-skeleton-${type}`,
3909
4241
  animation === "pulse" && "avl-skeleton-pulse",
3910
4242
  className
3911
4243
  )
@@ -3921,20 +4253,33 @@ function Slider({
3921
4253
  "aria-label": ariaLabel,
3922
4254
  showValue = true,
3923
4255
  squiggly = false,
4256
+ getAriaLabel,
3924
4257
  className,
3925
4258
  ...props
3926
4259
  }) {
3927
- if (process.env.NODE_ENV !== "production" && label == null) {
3928
- checkName(
3929
- { "aria-label": ariaLabel, ...props },
3930
- "Slider",
3931
- '<Slider label="Volume" /> // or <Slider aria-label="Volume" />',
3932
- "slider.md"
3933
- );
3934
- }
3935
4260
  const initial = props.value ?? props.defaultValue;
3936
4261
  const thumbCount = Array.isArray(initial) ? initial.length : 1;
4262
+ if (process.env.NODE_ENV !== "production") {
4263
+ if (label == null)
4264
+ checkName(
4265
+ { "aria-label": ariaLabel, ...props },
4266
+ "Slider",
4267
+ '<Slider label="Volume" /> // or <Slider aria-label="Volume" />',
4268
+ "slider.md"
4269
+ );
4270
+ if (thumbCount > 1 && !getAriaLabel)
4271
+ devError(
4272
+ "<Slider> has several handles but no `getAriaLabel`, so screen readers give every handle the same name.",
4273
+ `<Slider
4274
+ label="Price"
4275
+ defaultValue={[20, 80]}
4276
+ getAriaLabel={(i) => (i === 0 ? 'Minimum price' : 'Maximum price')}
4277
+ />`,
4278
+ "slider.md"
4279
+ );
4280
+ }
3937
4281
  const wavy = squiggly && props.orientation !== "vertical";
4282
+ const morph2 = useWaveMorph(wavy);
3938
4283
  return /* @__PURE__ */ jsxs28(
3939
4284
  BaseSlider.Root,
3940
4285
  {
@@ -3950,7 +4295,7 @@ function Slider({
3950
4295
  children: [
3951
4296
  label != null && /* @__PURE__ */ jsx44(BaseSlider.Label, { className: "avl-slider-label", children: label }),
3952
4297
  /* @__PURE__ */ jsx44(BaseSlider.Control, { className: "avl-slider-control", children: /* @__PURE__ */ jsxs28(BaseSlider.Track, { className: "avl-slider-track", children: [
3953
- wavy ? /* @__PURE__ */ jsx44(SquigglyWave, { span: handleSpan }) : (
4298
+ morph2.show ? /* @__PURE__ */ jsx44(SquigglyWave, { span: handleSpan, ...morph2.wave }) : (
3954
4299
  // Clips the track pieces to the rounded track, without
3955
4300
  // also clipping the handles, which are taller
3956
4301
  /* @__PURE__ */ jsxs28("div", { className: "avl-slider-rail", children: [
@@ -3963,6 +4308,7 @@ function Slider({
3963
4308
  {
3964
4309
  index: i,
3965
4310
  "aria-label": ariaLabel,
4311
+ getAriaLabel,
3966
4312
  className: "avl-slider-thumb",
3967
4313
  render: (thumbProps, state) => /* @__PURE__ */ jsx44(
3968
4314
  "div",
@@ -4000,13 +4346,12 @@ function handleSpan(width, gap, svg) {
4000
4346
  [0, first - gap],
4001
4347
  [last + gap, width]
4002
4348
  ] : [[last + gap, width]],
4003
- dot: last + gap < width - gap,
4004
4349
  snap: true
4005
4350
  };
4006
4351
  }
4007
4352
 
4008
4353
  // src/components/Snackbar/Snackbar.tsx
4009
- import { useContext as useContext19, useEffect as useEffect7, useRef as useRef14, useState as useState10 } from "react";
4354
+ import { useContext as useContext19, useEffect as useEffect11, useRef as useRef15, useState as useState11 } from "react";
4010
4355
  import { Toast } from "@base-ui/react/toast";
4011
4356
  import { jsx as jsx45, jsxs as jsxs29 } from "react/jsx-runtime";
4012
4357
  function useSnackbar() {
@@ -4033,17 +4378,17 @@ function useSnackbar() {
4033
4378
  }
4034
4379
  function SnackbarViewport() {
4035
4380
  const { toasts } = Toast.useToastManager();
4036
- const viewportRef = useRef14(null);
4037
- const [expanded, setExpanded] = useState10(false);
4038
- const [hovered, setHovered] = useState10(false);
4381
+ const viewportRef = useRef15(null);
4382
+ const [expanded, setExpanded] = useState11(false);
4383
+ const [hovered, setHovered] = useState11(false);
4039
4384
  const visibleCount = toasts.filter(
4040
4385
  (toast) => toast.transitionStatus !== "ending"
4041
4386
  ).length;
4042
4387
  const collapsed = visibleCount > 1 && !expanded && !hovered;
4043
- useEffect7(() => {
4388
+ useEffect11(() => {
4044
4389
  if (visibleCount <= 1) setExpanded(false);
4045
4390
  }, [visibleCount]);
4046
- useEffect7(() => {
4391
+ useEffect11(() => {
4047
4392
  if (!expanded) return;
4048
4393
  const viewport = viewportRef.current;
4049
4394
  const close = (event) => {
@@ -4249,12 +4594,14 @@ function Textarea({
4249
4594
  label,
4250
4595
  size = "normal",
4251
4596
  className,
4597
+ style,
4252
4598
  placeholder,
4253
4599
  ...props
4254
4600
  }) {
4255
4601
  return /* @__PURE__ */ jsxs32(
4256
4602
  "label",
4257
4603
  {
4604
+ style,
4258
4605
  className: cx(
4259
4606
  "avl-input",
4260
4607
  "avl-textarea",
@@ -4287,6 +4634,15 @@ function FloatingToolbar({
4287
4634
  className,
4288
4635
  ...props
4289
4636
  }) {
4637
+ if (process.env.NODE_ENV !== "production") {
4638
+ checkName(
4639
+ props,
4640
+ "FloatingToolbar",
4641
+ '<FloatingToolbar aria-label="Formatting">...</FloatingToolbar>',
4642
+ "floating-toolbar.md",
4643
+ UNNAMED_GROUP
4644
+ );
4645
+ }
4290
4646
  return /* @__PURE__ */ jsx51(
4291
4647
  BaseToolbar.Root,
4292
4648
  {
@@ -4411,6 +4767,15 @@ import { useRender as useRender2 } from "@base-ui/react/use-render";
4411
4767
  import { mergeProps as mergeProps2 } from "@base-ui/react/merge-props";
4412
4768
  import { Fragment as Fragment6, jsx as jsx53, jsxs as jsxs34 } from "react/jsx-runtime";
4413
4769
  function NavigationBar({ className, ...props }) {
4770
+ if (process.env.NODE_ENV !== "production") {
4771
+ checkName(
4772
+ props,
4773
+ "NavigationBar",
4774
+ '<NavigationBar aria-label="Main">...</NavigationBar>',
4775
+ "navigation-bar.md",
4776
+ UNNAMED_NAV
4777
+ );
4778
+ }
4414
4779
  return /* @__PURE__ */ jsx53("nav", { ...props, className: cx("avl-navigation-bar", className) });
4415
4780
  }
4416
4781
  function NavigationBarItem({
@@ -4443,7 +4808,7 @@ function NavigationBarItem({
4443
4808
  import {
4444
4809
  createContext as createContext7,
4445
4810
  useContext as useContext21,
4446
- useState as useState11
4811
+ useState as useState12
4447
4812
  } from "react";
4448
4813
  import { useRender as useRender3 } from "@base-ui/react/use-render";
4449
4814
  import { mergeProps as mergeProps3 } from "@base-ui/react/merge-props";
@@ -4456,7 +4821,16 @@ function NavigationRail({
4456
4821
  className,
4457
4822
  ...props
4458
4823
  }) {
4459
- const [internal, setInternal] = useState11(defaultExpanded);
4824
+ if (process.env.NODE_ENV !== "production") {
4825
+ checkName(
4826
+ props,
4827
+ "NavigationRail",
4828
+ '<NavigationRail aria-label="Main">...</NavigationRail>',
4829
+ "navigation-rail.md",
4830
+ UNNAMED_NAV
4831
+ );
4832
+ }
4833
+ const [internal, setInternal] = useState12(defaultExpanded);
4460
4834
  const expanded = expandedProp ?? internal;
4461
4835
  const setExpanded = (next) => {
4462
4836
  setInternal(next);
@@ -4535,6 +4909,15 @@ import { useRender as useRender4 } from "@base-ui/react/use-render";
4535
4909
  import { mergeProps as mergeProps4 } from "@base-ui/react/merge-props";
4536
4910
  import { jsx as jsx55 } from "react/jsx-runtime";
4537
4911
  function NavigationList({ className, ...props }) {
4912
+ if (process.env.NODE_ENV !== "production") {
4913
+ checkName(
4914
+ props,
4915
+ "NavigationList",
4916
+ '<NavigationList aria-label="Settings">...</NavigationList>',
4917
+ "navigation-list.md",
4918
+ UNNAMED_NAV
4919
+ );
4920
+ }
4538
4921
  return /* @__PURE__ */ jsx55("nav", { ...props, className: cx("avl-navigation-list", className) });
4539
4922
  }
4540
4923
  function NavigationListItem({
@@ -4993,11 +5376,11 @@ var monochromeDarkTheme = {
4993
5376
 
4994
5377
  // src/components/AnvilRoot/AnvilRoot.tsx
4995
5378
  import {
4996
- useEffect as useEffect8,
5379
+ useEffect as useEffect12,
4997
5380
  useId as useId6,
4998
5381
  useLayoutEffect as useLayoutEffect4,
4999
- useRef as useRef15,
5000
- useState as useState12,
5382
+ useRef as useRef16,
5383
+ useState as useState13,
5001
5384
  useSyncExternalStore
5002
5385
  } from "react";
5003
5386
  import { Toast as Toast2 } from "@base-ui/react/toast";
@@ -5006,24 +5389,19 @@ import { Tooltip as Tooltip2 } from "@base-ui/react/tooltip";
5006
5389
  // src/themes/toCssVariables.ts
5007
5390
  function themeToCssVariables(theme) {
5008
5391
  const cssVars = {};
5009
- const { surfaceVariant, onSurfaceVariant, ...rest } = theme;
5010
5392
  const filled = {
5011
5393
  inverseSurface: theme.onBackground,
5012
5394
  inverseOnSurface: theme.background,
5013
5395
  inversePrimary: `color-mix(in srgb, ${theme.primary} 55%, ${theme.background})`,
5014
5396
  shadow: "rgb(0 0 0 / 0.3)",
5015
5397
  scrim: "rgb(0 0 0 / 0.4)",
5016
- ...rest,
5017
- surface: rest.surface ?? surfaceVariant,
5018
- onSurface: rest.onSurface ?? onSurfaceVariant
5398
+ ...theme
5019
5399
  };
5020
5400
  for (const [key, value] of Object.entries(filled)) {
5021
5401
  if (value === void 0) continue;
5022
5402
  const kebabKey = key.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
5023
5403
  cssVars[`--avl-color-${kebabKey}`] = value;
5024
5404
  }
5025
- cssVars["--avl-color-surface-variant"] = "var(--avl-color-surface)";
5026
- cssVars["--avl-color-on-surface-variant"] = "var(--avl-color-on-surface)";
5027
5405
  return cssVars;
5028
5406
  }
5029
5407
 
@@ -5067,43 +5445,56 @@ function subscribeToOs(onChange) {
5067
5445
  var getOsMode = () => matchMedia(darkQuery).matches ? "dark" : "light";
5068
5446
  var declarations = (vars) => Object.entries(vars).map(([name, value]) => `${name}:${value};`).join("");
5069
5447
  function AnvilRoot(props) {
5070
- const [internalSetting, setInternalSetting] = useState12(
5071
- props.defaultColorMode ?? "system"
5448
+ const {
5449
+ children,
5450
+ className,
5451
+ colorMode: colorModeProp,
5452
+ defaultColorMode,
5453
+ onColorModeChange,
5454
+ storageKey,
5455
+ lightTheme: lightThemeProp,
5456
+ darkTheme: darkThemeProp,
5457
+ tokens: tokensProp,
5458
+ ref,
5459
+ ...divProps
5460
+ } = props;
5461
+ const [internalSetting, setInternalSetting] = useState13(
5462
+ defaultColorMode ?? "system"
5072
5463
  );
5073
- const setting = props.colorMode ?? internalSetting;
5464
+ const setting = colorModeProp ?? internalSetting;
5074
5465
  const osMode = useSyncExternalStore(
5075
5466
  subscribeToOs,
5076
5467
  getOsMode,
5077
5468
  () => "light"
5078
5469
  );
5079
5470
  const colorMode = setting === "system" ? osMode : setting;
5080
- const latestSetting = useRef15(setting);
5471
+ const latestSetting = useRef16(setting);
5081
5472
  latestSetting.current = setting;
5082
5473
  useLayoutEffect4(() => {
5083
- if (!props.storageKey) return;
5084
- const stored = readStored(props.storageKey);
5474
+ if (!storageKey) return;
5475
+ const stored = readStored(storageKey);
5085
5476
  if (stored) {
5086
5477
  latestSetting.current = stored;
5087
5478
  setInternalSetting(stored);
5088
5479
  }
5089
- }, [props.storageKey]);
5480
+ }, [storageKey]);
5090
5481
  const setColorMode = (next) => {
5091
5482
  const value = typeof next === "function" ? next(latestSetting.current) : next;
5092
5483
  latestSetting.current = value;
5093
5484
  setInternalSetting(value);
5094
- props.onColorModeChange?.(value);
5095
- if (props.storageKey) {
5485
+ onColorModeChange?.(value);
5486
+ if (storageKey) {
5096
5487
  try {
5097
- localStorage.setItem(props.storageKey, value);
5488
+ localStorage.setItem(storageKey, value);
5098
5489
  } catch {
5099
5490
  }
5100
5491
  }
5101
5492
  };
5102
- const tokens = { ...baseDesignTokens, ...props.tokens };
5103
- const lightTheme = props.lightTheme || baseLightTheme;
5104
- const darkTheme = props.darkTheme || baseDarkTheme;
5105
- const rootRef = useRef15(null);
5106
- useEffect8(() => {
5493
+ const tokens = { ...baseDesignTokens, ...tokensProp };
5494
+ const lightTheme = lightThemeProp || baseLightTheme;
5495
+ const darkTheme = darkThemeProp || baseDarkTheme;
5496
+ const rootRef = useRef16(null);
5497
+ useEffect12(() => {
5107
5498
  if (process.env.NODE_ENV === "production") return;
5108
5499
  const timer = setTimeout(() => {
5109
5500
  const root2 = rootRef.current;
@@ -5123,7 +5514,7 @@ function AnvilRoot(props) {
5123
5514
  const light = `color-scheme:light;${declarations(themeToCssVariables(lightTheme))}`;
5124
5515
  const dark = `color-scheme:dark;${declarations(themeToCssVariables(darkTheme))}`;
5125
5516
  const css = `${root}{${declarations(tokensToCssVariables(tokens))}${light}}${root}[data-color-mode="dark"]{${dark}}@media ${darkQuery}{${root}[data-color-mode="system"]{${dark}}}`;
5126
- const restoreScript = props.storageKey && props.colorMode === void 0 ? `try{var m=localStorage.getItem(${JSON.stringify(props.storageKey)});if(m==='light'||m==='dark'||m==='system')document.currentScript.parentElement.dataset.colorMode=m}catch(e){}` : void 0;
5517
+ const restoreScript = storageKey && colorModeProp === void 0 ? `try{var m=localStorage.getItem(${JSON.stringify(storageKey)});if(m==='light'||m==='dark'||m==='system')document.currentScript.parentElement.dataset.colorMode=m}catch(e){}` : void 0;
5127
5518
  return /* @__PURE__ */ jsx57(
5128
5519
  AnvilContext,
5129
5520
  {
@@ -5139,8 +5530,9 @@ function AnvilRoot(props) {
5139
5530
  children: /* @__PURE__ */ jsxs37(
5140
5531
  "div",
5141
5532
  {
5142
- ref: rootRef,
5143
- className: cx("avl-root", props.className),
5533
+ ...divProps,
5534
+ ref: mergeRefs(rootRef, ref),
5535
+ className: cx("avl-root", className),
5144
5536
  "data-avl-root": id,
5145
5537
  "data-color-mode": setting,
5146
5538
  suppressHydrationWarning: true,
@@ -5155,7 +5547,7 @@ function AnvilRoot(props) {
5155
5547
  ),
5156
5548
  /* @__PURE__ */ jsx57("style", { children: css }),
5157
5549
  /* @__PURE__ */ jsx57(Tooltip2.Provider, { children: /* @__PURE__ */ jsxs37(Toast2.Provider, { limit: 3, children: [
5158
- props.children,
5550
+ children,
5159
5551
  /* @__PURE__ */ jsx57(SnackbarViewport, {})
5160
5552
  ] }) })
5161
5553
  ]