@sanity/ui 5.0.0-alpha.24 → 5.0.0-alpha.26

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 (86) hide show
  1. package/dist/index.d.ts +145 -147
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +256 -179
  4. package/dist/index.js.map +1 -1
  5. package/dist/styles.css +1 -1
  6. package/package.json +1 -1
  7. package/src/components/avatar/avatar.props.ts +4 -2
  8. package/src/components/avatar-counter/avatarCounter.props.ts +4 -2
  9. package/src/components/avatar-stack/avatarStack.props.ts +4 -2
  10. package/src/components/badge/Badge.tsx +2 -5
  11. package/src/components/badge/badge.props.ts +15 -15
  12. package/src/components/box/Box.tsx +2 -5
  13. package/src/components/box/box.props.ts +18 -12
  14. package/src/components/button/Button.tsx +2 -2
  15. package/src/components/button/button.props.ts +49 -43
  16. package/src/components/card/Card.tsx +2 -2
  17. package/src/components/card/card.props.ts +19 -13
  18. package/src/components/checkbox/Checkbox.tsx +3 -2
  19. package/src/components/checkbox/checkbox.props.ts +4 -2
  20. package/src/components/code/code.props.ts +5 -3
  21. package/src/components/container/Container.tsx +2 -2
  22. package/src/components/container/container.props.ts +17 -11
  23. package/src/components/dialog/Dialog.tsx +13 -7
  24. package/src/components/dialog/dialog.props.ts +11 -3
  25. package/src/components/divider/divider.props.ts +4 -2
  26. package/src/components/eyebrow/Eyebrow.tsx +2 -5
  27. package/src/components/eyebrow/eyebrow.props.ts +19 -12
  28. package/src/components/flex/Flex.tsx +2 -5
  29. package/src/components/flex/flex.props.ts +19 -12
  30. package/src/components/grid/Grid.tsx +2 -5
  31. package/src/components/grid/grid.props.ts +20 -16
  32. package/src/components/h-stack/HStack.tsx +2 -5
  33. package/src/components/h-stack/hStack.props.ts +7 -4
  34. package/src/components/heading/Heading.tsx +2 -5
  35. package/src/components/heading/heading.props.ts +18 -13
  36. package/src/components/hotkeys/hotkeys.props.ts +4 -2
  37. package/src/components/icon/icon.props.ts +3 -3
  38. package/src/components/icon-button/IconButton.tsx +2 -4
  39. package/src/components/icon-button/iconButton.props.ts +17 -17
  40. package/src/components/index.css +1 -0
  41. package/src/components/indicator/Indicator.tsx +2 -2
  42. package/src/components/indicator/indicator.props.ts +17 -11
  43. package/src/components/indicator-stack/IndicatorStack.tsx +2 -4
  44. package/src/components/indicator-stack/indicatorStack.props.ts +13 -7
  45. package/src/components/inline/Inline.tsx +2 -2
  46. package/src/components/inline/inline.props.ts +17 -11
  47. package/src/components/kbd/kbd.props.ts +4 -2
  48. package/src/components/link/link.props.ts +4 -2
  49. package/src/components/list/List.tsx +47 -97
  50. package/src/components/list/list.css +28 -9
  51. package/src/components/list/list.props.ts +59 -68
  52. package/src/components/popover/popover.props.ts +7 -5
  53. package/src/components/press-area/PressArea.tsx +2 -4
  54. package/src/components/press-area/press-area.css +9 -3
  55. package/src/components/press-area/pressArea.props.ts +13 -7
  56. package/src/components/radio/radio.props.ts +2 -1
  57. package/src/components/search-input/SearchInput.tsx +90 -0
  58. package/src/components/search-input/search-input.css +125 -0
  59. package/src/components/search-input/searchInput.props.ts +18 -0
  60. package/src/components/select/Select.tsx +6 -1
  61. package/src/components/select/select.css +10 -12
  62. package/src/components/select/select.props.ts +4 -2
  63. package/src/components/skip-to-content/skipToContent.props.ts +4 -2
  64. package/src/components/spinner/spinner.props.ts +4 -2
  65. package/src/components/switch/switch.props.ts +4 -2
  66. package/src/components/tabs/tabs.props.ts +8 -9
  67. package/src/components/text/Text.tsx +2 -5
  68. package/src/components/text/text.props.ts +19 -12
  69. package/src/components/text-area/textArea.props.ts +4 -5
  70. package/src/components/text-input/textInput.props.ts +5 -3
  71. package/src/components/tooltip/tooltip.props.ts +7 -5
  72. package/src/components/tooltip-group/TooltipGroup.tsx +8 -9
  73. package/src/components/tooltip-group/tooltipGroup.props.ts +13 -7
  74. package/src/components/v-stack/VStack.tsx +2 -5
  75. package/src/components/v-stack/vStack.props.ts +7 -4
  76. package/src/components/visually-hidden/VisuallyHidden.tsx +2 -4
  77. package/src/components/visually-hidden/visuallyHidden.props.ts +18 -12
  78. package/src/index.ts +1 -0
  79. package/src/types/Interactive.ts +3 -1
  80. package/src/types/Polymorphic.ts +9 -0
  81. package/src/types/Tone.ts +1 -1
  82. package/src/utils/composeRefs.test.ts +130 -0
  83. package/src/utils/composeRefs.ts +52 -0
  84. package/src/utils/getProps.test.ts +18 -0
  85. package/src/utils/getProps.ts +31 -16
  86. package/src/version.ts +2 -2
package/dist/index.js CHANGED
@@ -6,11 +6,12 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { SpinnerIcon } from "@sanity/icons/Spinner";
7
7
  import { CheckmarkIcon } from "@sanity/icons/Checkmark";
8
8
  import { RemoveIcon } from "@sanity/icons/Remove";
9
- import { CloseIcon } from "@sanity/icons/Close";
9
+ import CloseIcon$1, { CloseIcon } from "@sanity/icons/Close";
10
10
  import { createPortal } from "react-dom";
11
11
  import SelectIcon from "@sanity/icons/Select";
12
+ import SearchIcon from "@sanity/icons/Search";
12
13
  function getProps(componentProps, propDefs) {
13
- let { allComponentProps, allPropDefs } = flattenCompositeProps(componentProps, propDefs), restProps = {}, className = componentProps?.className || "", style = componentProps?.style || {};
14
+ let { allComponentProps, allPropDefs } = flattenCompositeProps(componentProps, propDefs), restProps = {}, classNames = [], style = componentProps?.style ? { ...componentProps.style } : {};
14
15
  for (let key in allComponentProps) {
15
16
  let propDef = allPropDefs?.[key], propValue = allComponentProps[key];
16
17
  if (!(propDef && "className" in propDef && propDef.className || propDef?.type === "conditional")) {
@@ -19,26 +20,27 @@ function getProps(componentProps, propDefs) {
19
20
  }
20
21
  if (Array.isArray(propValue)) for (let i = 0, len = Math.min(propValue.length, 6); i < len; i++) {
21
22
  let resolvedPropDef = getResolvedPropDef(propValue[i], propDef);
22
- resolvedPropDef && (className = clsx(className, getClassName(propValue[i], resolvedPropDef, i)), style = {
23
- ...style,
24
- ...getStyle(propValue[i], resolvedPropDef, i)
25
- });
23
+ if (!resolvedPropDef || propValue[i] === null || propValue[i] === void 0) continue;
24
+ let className = getClassName(propValue[i], resolvedPropDef, i);
25
+ className && classNames.push(className);
26
+ let styleKey = getStyleKey(resolvedPropDef, i);
27
+ styleKey && (style[styleKey] = propValue[i]);
26
28
  }
27
29
  else {
28
30
  let resolvedPropDef = getResolvedPropDef(propValue, propDef);
29
- if (!resolvedPropDef) {
31
+ if (!resolvedPropDef || propValue == null) {
30
32
  restProps[key] = propValue;
31
33
  continue;
32
34
  }
33
- className = clsx(className, getClassName(propValue, resolvedPropDef)), style = {
34
- ...style,
35
- ...getStyle(propValue, resolvedPropDef)
36
- };
35
+ let className = getClassName(propValue, resolvedPropDef);
36
+ className && classNames.push(className);
37
+ let styleKey = getStyleKey(resolvedPropDef);
38
+ styleKey && (style[styleKey] = propValue);
37
39
  }
38
40
  }
39
41
  return {
40
42
  ...restProps,
41
- className,
43
+ className: clsx(componentProps?.className, ...classNames),
42
44
  style
43
45
  };
44
46
  }
@@ -56,8 +58,8 @@ function getClassName(propValue, propDef, bp) {
56
58
  }
57
59
  return "";
58
60
  }
59
- function getStyle(propValue, propDef, bp) {
60
- return (propDef.type === "string" || propDef.type === "number") && propDef.variable ? { [`${propDef.variable}${bp ? `-bp-${bp}` : ""}`]: propValue } : {};
61
+ function getStyleKey(propDef, bp) {
62
+ if ((propDef.type === "string" || propDef.type === "number") && propDef.variable) return `${propDef.variable}${bp ? `-bp-${bp}` : ""}`;
61
63
  }
62
64
  function flattenCompositeProps(componentProps, propDefs) {
63
65
  let props = {
@@ -81,7 +83,7 @@ function getCompositeValue(propValue, propDef, key) {
81
83
  return compositeValue;
82
84
  }
83
85
  function suffixClassName(className) {
84
- return `${className}-6f91fe`;
86
+ return `${className}-f11fdc`;
85
87
  }
86
88
  const SPACE = [
87
89
  0,
@@ -1069,38 +1071,64 @@ function Card(t0) {
1069
1071
  children
1070
1072
  }), $[6] = T0, $[7] = children, $[8] = rest, $[9] = style, $[10] = t1, $[11] = t2) : t2 = $[11], t2;
1071
1073
  }
1074
+ /**
1075
+ * Sets a ref to a value. Returns the cleanup function of a callback ref, if it returns one.
1076
+ */
1077
+ function setRef(ref, value) {
1078
+ if (typeof ref == "function") return ref(value);
1079
+ ref != null && (ref.current = value);
1080
+ }
1081
+ /**
1082
+ * Composes multiple refs (callback refs and ref objects) into one callback ref.
1083
+ *
1084
+ * On detach, the composed ref calls the cleanup function of each callback ref that returned one.
1085
+ * It sets all other refs to `null`.
1086
+ */
1087
+ function composeRefs(...refs) {
1088
+ return (node) => {
1089
+ let cleanups = refs.map((ref) => setRef(ref, node));
1090
+ return () => {
1091
+ for (let i = 0; i < refs.length; i++) {
1092
+ let cleanup = cleanups[i];
1093
+ typeof cleanup == "function" ? cleanup() : setRef(refs[i], null);
1094
+ }
1095
+ };
1096
+ };
1097
+ }
1072
1098
  const checkboxProps = {
1073
1099
  hasError: { type: "boolean" },
1074
1100
  indeterminate: { type: "boolean" }
1075
1101
  }, checkboxClassName = suffixClassName("sui-Checkbox"), checkboxInputClassName = suffixClassName("sui-CheckboxInput");
1076
1102
  /** @beta */
1077
- function Checkbox(props) {
1078
- let $ = c(12), inputRef = useRef(null), { className, style, hasError, indeterminate, ...rest } = getProps(props, checkboxProps);
1103
+ function Checkbox(t0) {
1104
+ let $ = c(15), { ref, ...props } = t0, inputRef = useRef(null), { className, style, hasError, indeterminate, ...rest } = getProps(props, checkboxProps);
1079
1105
  useEffect(() => {
1080
1106
  inputRef.current && (inputRef.current.indeterminate = indeterminate);
1081
1107
  }, [indeterminate, inputRef]);
1082
- let T0 = Box, t1 = clsx(checkboxClassName, className), t2;
1083
- $[0] === indeterminate ? t2 = $[1] : (t2 = jsx(indeterminate ? RemoveIcon : CheckmarkIcon, { "aria-hidden": "true" }), $[0] = indeterminate, $[1] = t2);
1084
- let t3 = hasError || void 0, t4;
1085
- $[2] !== inputRef || $[3] !== rest || $[4] !== t3 ? (t4 = /* @__PURE__ */ jsx("input", {
1108
+ let T0 = Box, t2 = clsx(checkboxClassName, className), t3;
1109
+ $[0] === indeterminate ? t3 = $[1] : (t3 = jsx(indeterminate ? RemoveIcon : CheckmarkIcon, { "aria-hidden": "true" }), $[0] = indeterminate, $[1] = t3);
1110
+ let t4;
1111
+ $[2] !== inputRef || $[3] !== ref ? (t4 = composeRefs(inputRef, ref), $[2] = inputRef, $[3] = ref, $[4] = t4) : t4 = $[4];
1112
+ let t5 = hasError || void 0, t6;
1113
+ $[5] !== rest || $[6] !== t4 || $[7] !== t5 ? (t6 = /* @__PURE__ */ jsx("input", {
1086
1114
  type: "checkbox",
1087
1115
  className: checkboxInputClassName,
1088
- ref: inputRef,
1089
- "aria-invalid": t3,
1116
+ ref: t4,
1117
+ "aria-invalid": t5,
1090
1118
  ...rest
1091
- }), $[2] = inputRef, $[3] = rest, $[4] = t3, $[5] = t4) : t4 = $[5];
1092
- let t5;
1093
- return $[6] !== T0 || $[7] !== style || $[8] !== t1 || $[9] !== t2 || $[10] !== t4 ? (t5 = /* @__PURE__ */ jsxs(T0, {
1119
+ }), $[5] = rest, $[6] = t4, $[7] = t5, $[8] = t6) : t6 = $[8];
1120
+ let t7;
1121
+ return $[9] !== T0 || $[10] !== style || $[11] !== t2 || $[12] !== t3 || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsxs(T0, {
1094
1122
  as: "span",
1095
- className: t1,
1123
+ className: t2,
1096
1124
  style,
1097
1125
  "data-ui": "Checkbox",
1098
1126
  position: "relative",
1099
1127
  radius: 2,
1100
1128
  width: "17px",
1101
1129
  height: "17px",
1102
- children: [t2, t4]
1103
- }), $[6] = T0, $[7] = style, $[8] = t1, $[9] = t2, $[10] = t4, $[11] = t5) : t5 = $[11], t5;
1130
+ children: [t3, t6]
1131
+ }), $[9] = T0, $[10] = style, $[11] = t2, $[12] = t3, $[13] = t6, $[14] = t7) : t7 = $[14], t7;
1104
1132
  }
1105
1133
  const codeProps = {
1106
1134
  inline: { type: "boolean" },
@@ -1298,7 +1326,7 @@ const dialogProps = {
1298
1326
  }
1299
1327
  }, dialogClassName = suffixClassName("sui-Dialog"), dialogContentClassName = suffixClassName("sui-DialogContent"), dialogFooterClassName = suffixClassName("sui-DialogFooter");
1300
1328
  function DialogRoot(t0) {
1301
- let $ = c(17), { open: t1, size: t2, ...props } = t0, open = t1 !== void 0 && t1, { children, className, style, header, onClose, ...rest } = getProps({
1329
+ let $ = c(20), { open: t1, size: t2, ref, ...props } = t0, open = t1 !== void 0 && t1, { children, className, style, header, onClose, ...rest } = getProps({
1302
1330
  size: t2 === void 0 ? 0 : t2,
1303
1331
  ...props
1304
1332
  }, dialogProps), dialogRef = useRef(null), headerId = useId(), dialogClasses = clsx(dialogClassName, `${props.topAnchor ? "sui-mx-auto" : "sui-m-auto"} sui-radius5 sui-shadow3 sui-p4 sui-flex-direction-column sui-gap4 sui-overflow-y-auto`), t3, t4;
@@ -1308,40 +1336,42 @@ function DialogRoot(t0) {
1308
1336
  dialogElement.close();
1309
1337
  };
1310
1338
  }, t4 = [open], $[0] = open, $[1] = t3, $[2] = t4), useEffect(t3, t4);
1311
- let t6 = header ? headerId : void 0, t7 = clsx(dialogClasses, className), t8;
1312
- $[3] !== header || $[4] !== headerId ? (t8 = header ? /* @__PURE__ */ jsx(Heading, {
1339
+ let t5;
1340
+ $[3] === ref ? t5 = $[4] : (t5 = composeRefs(dialogRef, ref), $[3] = ref, $[4] = t5);
1341
+ let t7 = header ? headerId : void 0, t8 = clsx(dialogClasses, className), t9;
1342
+ $[5] !== header || $[6] !== headerId ? (t9 = header ? /* @__PURE__ */ jsx(Heading, {
1313
1343
  as: "h2",
1314
1344
  trim: !0,
1315
1345
  size: 1,
1316
1346
  id: headerId,
1317
1347
  children: header
1318
- }) : /* @__PURE__ */ jsx("div", {}), $[3] = header, $[4] = headerId, $[5] = t8) : t8 = $[5];
1319
- let t9;
1320
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(IconButton, {
1348
+ }) : /* @__PURE__ */ jsx("div", {}), $[5] = header, $[6] = headerId, $[7] = t9) : t9 = $[7];
1349
+ let t10;
1350
+ $[8] === Symbol.for("react.memo_cache_sentinel") ? (t10 = /* @__PURE__ */ jsx(IconButton, {
1321
1351
  "aria-label": "Close",
1322
1352
  level: "tertiary",
1323
1353
  icon: CloseIcon,
1324
1354
  onClick: () => dialogRef.current?.close()
1325
- }), $[6] = t9) : t9 = $[6];
1326
- let t10;
1327
- $[7] === t8 ? t10 = $[8] : (t10 = /* @__PURE__ */ jsxs(Flex, {
1355
+ }), $[8] = t10) : t10 = $[8];
1356
+ let t11;
1357
+ $[9] === t9 ? t11 = $[10] : (t11 = /* @__PURE__ */ jsxs(Flex, {
1328
1358
  flexShrink: 0,
1329
1359
  justifyContent: "space-between",
1330
1360
  alignItems: "center",
1331
- children: [t8, t9]
1332
- }), $[7] = t8, $[8] = t10);
1333
- let t11;
1334
- return $[9] !== children || $[10] !== onClose || $[11] !== rest || $[12] !== style || $[13] !== t10 || $[14] !== t6 || $[15] !== t7 ? (t11 = /* @__PURE__ */ jsxs("dialog", {
1361
+ children: [t9, t10]
1362
+ }), $[9] = t9, $[10] = t11);
1363
+ let t12;
1364
+ return $[11] !== children || $[12] !== onClose || $[13] !== rest || $[14] !== style || $[15] !== t11 || $[16] !== t5 || $[17] !== t7 || $[18] !== t8 ? (t12 = /* @__PURE__ */ jsxs("dialog", {
1335
1365
  ...rest,
1336
- ref: dialogRef,
1366
+ ref: t5,
1337
1367
  closedby: "any",
1338
- "aria-labelledby": t6,
1368
+ "aria-labelledby": t7,
1339
1369
  onClose,
1340
- className: t7,
1370
+ className: t8,
1341
1371
  style,
1342
1372
  "data-ui": "Dialog",
1343
- children: [t10, children]
1344
- }), $[9] = children, $[10] = onClose, $[11] = rest, $[12] = style, $[13] = t10, $[14] = t6, $[15] = t7, $[16] = t11) : t11 = $[16], t11;
1373
+ children: [t11, children]
1374
+ }), $[11] = children, $[12] = onClose, $[13] = rest, $[14] = style, $[15] = t11, $[16] = t5, $[17] = t7, $[18] = t8, $[19] = t12) : t12 = $[19], t12;
1345
1375
  }
1346
1376
  function DialogContent(props) {
1347
1377
  let $ = c(12), T0, children, style, t0, t1;
@@ -1822,7 +1852,9 @@ function VStack(t0) {
1822
1852
  const listProps = {
1823
1853
  as: { type: "string" },
1824
1854
  gap: gapProps.gap
1825
- }, listItemProps = {
1855
+ }, listButtonProps = {
1856
+ as: { type: "string" },
1857
+ current: { type: "boolean" },
1826
1858
  density: {
1827
1859
  type: "composite",
1828
1860
  values: DENSITY,
@@ -1854,16 +1886,10 @@ const listProps = {
1854
1886
  }
1855
1887
  },
1856
1888
  end: { type: "string" },
1857
- start: { type: "string" }
1858
- }, listButtonItemProps = {
1859
- as: { type: "string" },
1860
- selected: { type: "boolean" },
1861
- ...listItemProps
1862
- }, listItemTextProps = {
1863
- as: { type: "string" },
1864
- title: { type: "string" },
1865
- subtitle: { type: "string" }
1866
- }, listClassName = suffixClassName("sui-List"), listItemClassName = suffixClassName("sui-ListItem"), listButtonItemClassName = suffixClassName("sui-ListButtonItem"), listItemTextClassName = suffixClassName("sui-ListItemText"), listItemImageClassName = suffixClassName("sui-ListItemImage");
1889
+ start: { type: "string" },
1890
+ text: { type: "string" },
1891
+ subtext: { type: "string" }
1892
+ }, listClassName = suffixClassName("sui-List"), listItemClassName = suffixClassName("sui-ListItem"), listButtonClassName = suffixClassName("sui-ListItemButton"), listItemImageClassName = suffixClassName("sui-ListItemImage");
1867
1893
  function ListRoot(props) {
1868
1894
  let $ = c(14), T0, children, rest, style, t0, t1;
1869
1895
  if ($[0] !== props) {
@@ -1883,121 +1909,90 @@ function ListRoot(props) {
1883
1909
  }), $[7] = T0, $[8] = children, $[9] = rest, $[10] = style, $[11] = t0, $[12] = t1, $[13] = t2) : t2 = $[13], t2;
1884
1910
  }
1885
1911
  function ListItem(t0) {
1886
- let $ = c(16), children, end, rest, start, style, t1;
1887
- if ($[0] !== t0) {
1888
- let { density: t2, ...props } = t0, { children: t3, className, style: t4, end: t5, start: t6, ...t7 } = getProps({
1889
- density: t2 === void 0 ? "regular" : t2,
1890
- ...props
1891
- }, listItemProps);
1892
- children = t3, style = t4, end = t5, start = t6, rest = t7, t1 = clsx(listItemClassName, "sui-width-full sui-display-flex sui-align-items-center", className), $[0] = t0, $[1] = children, $[2] = end, $[3] = rest, $[4] = start, $[5] = style, $[6] = t1;
1893
- } else children = $[1], end = $[2], rest = $[3], start = $[4], style = $[5], t1 = $[6];
1912
+ let $ = c(8), className, rest;
1913
+ $[0] === t0 ? (className = $[1], rest = $[2]) : ({className, ...rest} = t0, $[0] = t0, $[1] = className, $[2] = rest);
1914
+ let t1;
1915
+ $[3] === className ? t1 = $[4] : (t1 = clsx(listItemClassName, "sui-text-body1", className), $[3] = className, $[4] = t1);
1894
1916
  let t2;
1895
- $[7] === children ? t2 = $[8] : (t2 = /* @__PURE__ */ jsx(Flex, {
1896
- flexGrow: 1,
1897
- gap: "inherit",
1898
- children
1899
- }), $[7] = children, $[8] = t2);
1900
- let t3;
1901
- return $[9] !== end || $[10] !== rest || $[11] !== start || $[12] !== style || $[13] !== t1 || $[14] !== t2 ? (t3 = /* @__PURE__ */ jsxs("li", {
1902
- className: t1,
1903
- style,
1917
+ return $[5] !== rest || $[6] !== t1 ? (t2 = /* @__PURE__ */ jsx("li", {
1904
1918
  "data-ui": "ListItem",
1905
- ...rest,
1906
- children: [
1907
- start,
1908
- t2,
1909
- end
1910
- ]
1911
- }), $[9] = end, $[10] = rest, $[11] = start, $[12] = style, $[13] = t1, $[14] = t2, $[15] = t3) : t3 = $[15], t3;
1919
+ className: t1,
1920
+ ...rest
1921
+ }), $[5] = rest, $[6] = t1, $[7] = t2) : t2 = $[7], t2;
1912
1922
  }
1913
- function ListButtonItem(t0) {
1914
- let $ = c(22), T0, children, end, rest, selected, start, style, t1, t2;
1923
+ function ListItemButton(t0) {
1924
+ let $ = c(30), T0, children, current, end, rest, start, style, subtext, t1, t2, text;
1915
1925
  if ($[0] !== t0) {
1916
- let { density: t3, ...props } = t0, { as, children: t4, className, style: t5, end: t6, start: t7, selected: t8, ...t9 } = getProps({
1926
+ let { density: t3, ...props } = t0, { as, children: t4, className, style: t5, text: t6, subtext: t7, end: t8, start: t9, current: t10, ...t11 } = getProps({
1917
1927
  density: t3 === void 0 ? "regular" : t3,
1918
1928
  ...props
1919
- }, listButtonItemProps);
1920
- children = t4, style = t5, end = t6, start = t7, selected = t8, rest = t9;
1929
+ }, listButtonProps);
1930
+ children = t4, style = t5, text = t6, subtext = t7, end = t8, start = t9, current = t10, rest = t11;
1921
1931
  let Component = as || "button";
1922
- T0 = PressArea, t1 = Component, t2 = clsx(listButtonItemClassName, "sui-width-full sui-display-flex sui-align-items-center sui-radius2", className), $[0] = t0, $[1] = T0, $[2] = children, $[3] = end, $[4] = rest, $[5] = selected, $[6] = start, $[7] = style, $[8] = t1, $[9] = t2;
1923
- } else T0 = $[1], children = $[2], end = $[3], rest = $[4], selected = $[5], start = $[6], style = $[7], t1 = $[8], t2 = $[9];
1932
+ T0 = PressArea, t1 = Component, t2 = clsx(listButtonClassName, "sui-width-full sui-display-flex sui-align-items-center sui-radius2", className), $[0] = t0, $[1] = T0, $[2] = children, $[3] = current, $[4] = end, $[5] = rest, $[6] = start, $[7] = style, $[8] = subtext, $[9] = t1, $[10] = t2, $[11] = text;
1933
+ } else T0 = $[1], children = $[2], current = $[3], end = $[4], rest = $[5], start = $[6], style = $[7], subtext = $[8], t1 = $[9], t2 = $[10], text = $[11];
1924
1934
  let t3;
1925
- $[10] === children ? t3 = $[11] : (t3 = /* @__PURE__ */ jsx(Flex, {
1926
- flexGrow: 1,
1927
- gap: "inherit",
1928
- children
1929
- }), $[10] = children, $[11] = t3);
1930
- let t4;
1931
- return $[12] !== T0 || $[13] !== end || $[14] !== rest || $[15] !== selected || $[16] !== start || $[17] !== style || $[18] !== t1 || $[19] !== t2 || $[20] !== t3 ? (t4 = /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(T0, {
1932
- as: t1,
1933
- className: t2,
1934
- style,
1935
- "data-ui": "ListButtonItem",
1936
- "data-selected": selected,
1937
- ...rest,
1938
- children: [
1939
- start,
1940
- t3,
1941
- end
1942
- ]
1943
- }) }), $[12] = T0, $[13] = end, $[14] = rest, $[15] = selected, $[16] = start, $[17] = style, $[18] = t1, $[19] = t2, $[20] = t3, $[21] = t4) : t4 = $[21], t4;
1944
- }
1945
- function ListItemText(props) {
1946
- let $ = c(20), T0, rest, style, subtitle, t0, t1, title;
1947
- if ($[0] !== props) {
1948
- let { as, className, style: t2, title: t3, subtitle: t4, ...t5 } = getProps(props, listItemTextProps);
1949
- style = t2, title = t3, subtitle = t4, rest = t5;
1950
- let Component = as || "div";
1951
- T0 = Flex, t0 = Component, t1 = clsx(listItemTextClassName, className), $[0] = props, $[1] = T0, $[2] = rest, $[3] = style, $[4] = subtitle, $[5] = t0, $[6] = t1, $[7] = title;
1952
- } else T0 = $[1], rest = $[2], style = $[3], subtitle = $[4], t0 = $[5], t1 = $[6], title = $[7];
1953
- let t2;
1954
- $[8] === title ? t2 = $[9] : (t2 = title && /* @__PURE__ */ jsx(Text, {
1935
+ $[12] === text ? t3 = $[13] : (t3 = text && /* @__PURE__ */ jsx(Text, {
1955
1936
  size: 1,
1956
1937
  weight: "medium",
1957
1938
  trim: !0,
1958
1939
  truncate: 1,
1959
- children: title
1960
- }), $[8] = title, $[9] = t2);
1961
- let t3;
1962
- $[10] === subtitle ? t3 = $[11] : (t3 = subtitle && /* @__PURE__ */ jsx(Text, {
1940
+ children: text
1941
+ }), $[12] = text, $[13] = t3);
1942
+ let t4;
1943
+ $[14] === subtext ? t4 = $[15] : (t4 = subtext && /* @__PURE__ */ jsx(Text, {
1963
1944
  size: 1,
1964
1945
  muted: !0,
1965
1946
  trim: !0,
1966
1947
  truncate: 1,
1967
- children: subtitle
1968
- }), $[10] = subtitle, $[11] = t3);
1969
- let t4;
1970
- return $[12] !== T0 || $[13] !== rest || $[14] !== style || $[15] !== t0 || $[16] !== t1 || $[17] !== t2 || $[18] !== t3 ? (t4 = /* @__PURE__ */ jsxs(T0, {
1971
- as: t0,
1972
- className: t1,
1973
- style,
1974
- "data-ui": "ListItemText",
1948
+ children: subtext
1949
+ }), $[14] = subtext, $[15] = t4);
1950
+ let t5;
1951
+ $[16] !== children || $[17] !== t3 || $[18] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Flex, {
1975
1952
  flexDirection: "column",
1976
1953
  justifyContent: "center",
1977
1954
  gap: 2,
1978
1955
  flexGrow: 1,
1956
+ children: [
1957
+ t3,
1958
+ t4,
1959
+ children
1960
+ ]
1961
+ }), $[16] = children, $[17] = t3, $[18] = t4, $[19] = t5) : t5 = $[19];
1962
+ let t6;
1963
+ return $[20] !== T0 || $[21] !== current || $[22] !== end || $[23] !== rest || $[24] !== start || $[25] !== style || $[26] !== t1 || $[27] !== t2 || $[28] !== t5 ? (t6 = /* @__PURE__ */ jsxs(T0, {
1964
+ as: t1,
1965
+ className: t2,
1966
+ style,
1967
+ "data-ui": "ListItemButton",
1968
+ "aria-current": current,
1979
1969
  ...rest,
1980
- children: [t2, t3]
1981
- }), $[12] = T0, $[13] = rest, $[14] = style, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4) : t4 = $[19], t4;
1970
+ children: [
1971
+ start,
1972
+ t5,
1973
+ end
1974
+ ]
1975
+ }), $[20] = T0, $[21] = current, $[22] = end, $[23] = rest, $[24] = start, $[25] = style, $[26] = t1, $[27] = t2, $[28] = t5, $[29] = t6) : t6 = $[29], t6;
1982
1976
  }
1983
- function ListItemImage(props) {
1984
- let $ = c(8), rest, style, t0;
1985
- if ($[0] !== props) {
1986
- let { className, style: t1, ...t2 } = getProps(props, {});
1987
- style = t1, rest = t2, t0 = clsx(listItemImageClassName, "sui-radius2", className), $[0] = props, $[1] = rest, $[2] = style, $[3] = t0;
1988
- } else rest = $[1], style = $[2], t0 = $[3];
1977
+ function ListItemImage(t0) {
1978
+ let $ = c(8), className, rest;
1979
+ $[0] === t0 ? (className = $[1], rest = $[2]) : ({className, ...rest} = t0, $[0] = t0, $[1] = className, $[2] = rest);
1989
1980
  let t1;
1990
- return $[4] !== rest || $[5] !== style || $[6] !== t0 ? (t1 = /* @__PURE__ */ jsx("img", {
1991
- className: t0,
1992
- style,
1981
+ $[3] === className ? t1 = $[4] : (t1 = clsx(listItemImageClassName, "sui-radius2", className), $[3] = className, $[4] = t1);
1982
+ let t2;
1983
+ return $[5] !== rest || $[6] !== t1 ? (t2 = /* @__PURE__ */ jsx("img", {
1984
+ className: t1,
1993
1985
  "data-ui": "ListItemImage",
1994
1986
  ...rest
1995
- }), $[4] = rest, $[5] = style, $[6] = t0, $[7] = t1) : t1 = $[7], t1;
1987
+ }), $[5] = rest, $[6] = t1, $[7] = t2) : t2 = $[7], t2;
1996
1988
  }
1997
1989
  ListRoot.displayName = "List";
1998
1990
  /** @beta */
1999
- const List = ListRoot;
2000
- ListRoot.Item = ListItem, ListRoot.ButtonItem = ListButtonItem, ListRoot.ItemText = ListItemText, ListRoot.ItemImage = ListItemImage;
1991
+ const List = Object.assign(ListRoot, {
1992
+ Item: ListItem,
1993
+ ItemButton: ListItemButton,
1994
+ ItemImage: ListItemImage
1995
+ });
2001
1996
  /** @public */
2002
1997
  function useIsClient() {
2003
1998
  return useSyncExternalStore(_temp2, _temp3, _temp4);
@@ -2150,10 +2145,10 @@ const formElementDensityProps = { density: {
2150
2145
  } }, selectProps = {
2151
2146
  hasError: { type: "boolean" },
2152
2147
  ...formElementDensityProps
2153
- }, selectClassName = suffixClassName("sui-Select");
2148
+ }, selectClassName = suffixClassName("sui-Select"), selectIconClassName = suffixClassName("sui-Select-Icon");
2154
2149
  /** @public */
2155
2150
  function Select(t0) {
2156
- let $ = c(17), { density: t1, hasError: t2, ...props } = t0, density = t1 === void 0 ? "regular" : t1, hasError = t2 !== void 0 && t2, { children, className, style, ...rest } = getProps({
2151
+ let $ = c(18), { density: t1, hasError: t2, ...props } = t0, density = t1 === void 0 ? "regular" : t1, hasError = t2 !== void 0 && t2, { children, className, style, ...rest } = getProps({
2157
2152
  density,
2158
2153
  ...props
2159
2154
  }, selectProps), anchorName = `--anchor-${useId()}`, selectClasses = clsx(selectClassName, "sui-radius2", "sui-width-full", className), t3;
@@ -2171,27 +2166,29 @@ function Select(t0) {
2171
2166
  children
2172
2167
  }), $[3] = children, $[4] = rest, $[5] = selectClasses, $[6] = t3, $[7] = t4, $[8] = t5) : t5 = $[8];
2173
2168
  let t6;
2174
- $[9] === anchorName ? t6 = $[10] : (t6 = { positionAnchor: anchorName }, $[9] = anchorName, $[10] = t6);
2169
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t6 = clsx(selectIconClassName, "sui-position-absolute sui-display-flex sui-align-items-center sui-px1"), $[9] = t6) : t6 = $[9];
2175
2170
  let t7;
2176
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t7 = /* @__PURE__ */ jsx(Icon, {
2171
+ $[10] === anchorName ? t7 = $[11] : (t7 = { positionAnchor: anchorName }, $[10] = anchorName, $[11] = t7);
2172
+ let t8;
2173
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t8 = /* @__PURE__ */ jsx(Icon, {
2177
2174
  icon: SelectIcon,
2178
2175
  size: 1
2179
- }), $[11] = t7) : t7 = $[11];
2180
- let t8;
2181
- $[12] === t6 ? t8 = $[13] : (t8 = /* @__PURE__ */ jsx("div", {
2182
- className: "sui-position-absolute sui-display-flex sui-align-items-center sui-px1",
2183
- "data-ui": "Select-icon",
2184
- style: t6,
2185
- children: t7
2186
- }), $[12] = t6, $[13] = t8);
2176
+ }), $[12] = t8) : t8 = $[12];
2187
2177
  let t9;
2188
- return $[14] !== t5 || $[15] !== t8 ? (t9 = /* @__PURE__ */ jsxs(Fragment, { children: [t5, t8] }), $[14] = t5, $[15] = t8, $[16] = t9) : t9 = $[16], t9;
2178
+ $[13] === t7 ? t9 = $[14] : (t9 = /* @__PURE__ */ jsx("div", {
2179
+ className: t6,
2180
+ "data-ui": "Select-Icon",
2181
+ style: t7,
2182
+ children: t8
2183
+ }), $[13] = t7, $[14] = t9);
2184
+ let t10;
2185
+ return $[15] !== t5 || $[16] !== t9 ? (t10 = /* @__PURE__ */ jsxs(Fragment, { children: [t5, t9] }), $[15] = t5, $[16] = t9, $[17] = t10) : t10 = $[17], t10;
2189
2186
  }
2190
2187
  const visuallyHiddenProps = {
2191
2188
  as: { type: "string" },
2192
2189
  visibleOnFocus: {
2193
2190
  type: "boolean",
2194
- className: "sui-visually-hidden-visible"
2191
+ className: "visually-hidden-visible"
2195
2192
  }
2196
2193
  }, visuallyHiddenClassName = suffixClassName("sui-VisuallyHidden");
2197
2194
  /** @public */
@@ -2494,7 +2491,7 @@ function TooltipRoot(t0) {
2494
2491
  const Tooltip = Object.assign(TooltipRoot, { forwardsTriggerProps: !0 }), tooltipGroupProps = { as: { type: "string" } }, tooltipGroupClassName = suffixClassName("sui-TooltipGroup");
2495
2492
  /** @public */
2496
2493
  function TooltipGroup(props) {
2497
- let $ = c(17), { as, children, className, style, ...rest } = getProps(props, tooltipGroupProps), Component = as || "div", ref = useRef(null), [isActive, setIsActive] = useState(!1), t0;
2494
+ let $ = c(4), { as, children, className, style, ref, ...rest } = getProps(props, tooltipGroupProps), Component = as || "div", tooltipGroupRef = useRef(null), [isActive, setIsActive] = useState(!1), t0;
2498
2495
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (e) => {
2499
2496
  let tooltip = e.target.closest("[data-ui=\"Tooltip\"]");
2500
2497
  tooltip && e.propertyName === "opacity" && window.getComputedStyle(tooltip).opacity !== "0" && setIsActive(!0);
@@ -2503,30 +2500,110 @@ function TooltipGroup(props) {
2503
2500
  $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => {
2504
2501
  setIsActive(!1);
2505
2502
  }, $[1] = t1) : t1 = $[1];
2506
- let handleMouseLeave = t1, t2;
2507
- $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = (e_0) => {
2508
- ref.current && ref.current.contains(e_0.relatedTarget) || setIsActive(!1);
2509
- }, $[2] = t2) : t2 = $[2];
2510
- let handleBlur = t2, t3 = clsx(tooltipGroupClassName, className), t4;
2511
- $[3] === isActive ? t4 = $[4] : (t4 = isActive && { "--tooltip-delay-group": "0ms" }, $[3] = isActive, $[4] = t4);
2512
- let t5;
2513
- $[5] !== style || $[6] !== t4 ? (t5 = {
2514
- ...style,
2515
- ...t4
2516
- }, $[5] = style, $[6] = t4, $[7] = t5) : t5 = $[7];
2517
- let t6;
2518
- return $[8] !== Component || $[9] !== children || $[10] !== handleBlur || $[11] !== handleMouseLeave || $[12] !== handleTransitionEnd || $[13] !== rest || $[14] !== t3 || $[15] !== t5 ? (t6 = /* @__PURE__ */ jsx(Component, {
2519
- className: t3,
2520
- style: t5,
2503
+ let handleMouseLeave = t1, handleBlur = (e_0) => {
2504
+ tooltipGroupRef.current && tooltipGroupRef.current.contains(e_0.relatedTarget) || setIsActive(!1);
2505
+ }, t2;
2506
+ return $[2] === isActive ? t2 = $[3] : (t2 = isActive && { "--tooltip-delay-group": "0ms" }, $[2] = isActive, $[3] = t2), /* @__PURE__ */ jsx(Component, {
2507
+ className: clsx(tooltipGroupClassName, className),
2508
+ style: {
2509
+ ...style,
2510
+ ...t2
2511
+ },
2512
+ ...rest,
2521
2513
  "data-ui": "TooltipGroup",
2522
- ref,
2514
+ ref: composeRefs(tooltipGroupRef, ref),
2523
2515
  onTransitionEnd: handleTransitionEnd,
2524
2516
  onMouseLeave: handleMouseLeave,
2525
2517
  onBlur: handleBlur,
2526
- ...rest,
2527
2518
  children
2528
- }), $[8] = Component, $[9] = children, $[10] = handleBlur, $[11] = handleMouseLeave, $[12] = handleTransitionEnd, $[13] = rest, $[14] = t3, $[15] = t5, $[16] = t6) : t6 = $[16], t6;
2519
+ });
2529
2520
  }
2530
- export { Avatar, AvatarCounter, AvatarStack, Badge, Box, Button, Card, Checkbox, Code, Container, Dialog, Divider, Eyebrow, Flex, Grid, HStack, Heading, Hotkeys, Icon, IconButton, Indicator, IndicatorStack, Inline, KBD, Link, List, Popover, PressArea, Radio, Select, SkipToContent, Spinner, Switch, Tabs, Text, TextArea, TextInput, Tooltip, TooltipGroup, VStack, VisuallyHidden, useIsClient };
2521
+ const searchInputProps = {
2522
+ loading: { type: "boolean" },
2523
+ ...formElementDensityProps
2524
+ }, searchInputClassName = suffixClassName("sui-SearchInput"), searchInputClearClassName = suffixClassName("sui-SearchInput-Clear"), searchInputIconClassName = suffixClassName("sui-SearchInput-Icon");
2525
+ /** @public */
2526
+ function SearchInput(t0) {
2527
+ let $ = c(38), loading, placeholder, ref, rest, style, t1;
2528
+ if ($[0] !== t0) {
2529
+ let { density: t2, loading: t3, placeholder: t4, ref: t5, ...props } = t0;
2530
+ loading = t3, ref = t5;
2531
+ let density = t2 === void 0 ? "regular" : t2;
2532
+ placeholder = t4 === void 0 ? " " : t4;
2533
+ let { className, style: t6, ...t7 } = getProps({
2534
+ density,
2535
+ ...props
2536
+ }, searchInputProps);
2537
+ style = t6, rest = t7, t1 = clsx(searchInputClassName, "sui-radius2", "sui-width-full", className), $[0] = t0, $[1] = loading, $[2] = placeholder, $[3] = ref, $[4] = rest, $[5] = style, $[6] = t1;
2538
+ } else loading = $[1], placeholder = $[2], ref = $[3], rest = $[4], style = $[5], t1 = $[6];
2539
+ let searchInputClasses = t1, anchorName = `--anchor-${useId()}`, inputRef = useRef(null), t2;
2540
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t2 = function handleClear() {
2541
+ let input = inputRef.current;
2542
+ input && ((Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), "value")?.set)?.call(input, ""), input.dispatchEvent(new Event("input", { bubbles: !0 })), input.focus());
2543
+ }, $[7] = t2) : t2 = $[7];
2544
+ let handleClear = t2, t3;
2545
+ $[8] !== anchorName || $[9] !== style ? (t3 = {
2546
+ anchorName,
2547
+ ...style
2548
+ }, $[8] = anchorName, $[9] = style, $[10] = t3) : t3 = $[10];
2549
+ let t4;
2550
+ $[11] === ref ? t4 = $[12] : (t4 = composeRefs(inputRef, ref), $[11] = ref, $[12] = t4);
2551
+ let t5;
2552
+ $[13] !== loading || $[14] !== placeholder || $[15] !== rest || $[16] !== searchInputClasses || $[17] !== t3 || $[18] !== t4 ? (t5 = /* @__PURE__ */ jsx("input", {
2553
+ className: searchInputClasses,
2554
+ style: t3,
2555
+ ...rest,
2556
+ "aria-busy": loading,
2557
+ "data-ui": "SearchInput",
2558
+ type: "search",
2559
+ placeholder,
2560
+ ref: t4
2561
+ }), $[13] = loading, $[14] = placeholder, $[15] = rest, $[16] = searchInputClasses, $[17] = t3, $[18] = t4, $[19] = t5) : t5 = $[19];
2562
+ let t6;
2563
+ $[20] === Symbol.for("react.memo_cache_sentinel") ? (t6 = clsx(searchInputIconClassName, "sui-position-absolute sui-display-flex sui-align-items-center sui-px1"), $[20] = t6) : t6 = $[20];
2564
+ let t7;
2565
+ $[21] === anchorName ? t7 = $[22] : (t7 = { positionAnchor: anchorName }, $[21] = anchorName, $[22] = t7);
2566
+ let t8;
2567
+ $[23] === loading ? t8 = $[24] : (t8 = loading ? /* @__PURE__ */ jsx(Spinner, { size: 1 }) : /* @__PURE__ */ jsx(Icon, {
2568
+ icon: SearchIcon,
2569
+ size: 1
2570
+ }), $[23] = loading, $[24] = t8);
2571
+ let t9;
2572
+ $[25] !== t7 || $[26] !== t8 ? (t9 = /* @__PURE__ */ jsx("div", {
2573
+ className: t6,
2574
+ "data-ui": "Search-Icon",
2575
+ style: t7,
2576
+ children: t8
2577
+ }), $[25] = t7, $[26] = t8, $[27] = t9) : t9 = $[27];
2578
+ let t10;
2579
+ $[28] === Symbol.for("react.memo_cache_sentinel") ? (t10 = clsx(searchInputClearClassName, "sui-position-absolute sui-display-flex sui-align-items-center sui-px1"), $[28] = t10) : t10 = $[28];
2580
+ let t11;
2581
+ $[29] === anchorName ? t11 = $[30] : (t11 = { positionAnchor: anchorName }, $[29] = anchorName, $[30] = t11);
2582
+ let t12;
2583
+ $[31] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx(PressArea, {
2584
+ type: "button",
2585
+ onClick: handleClear,
2586
+ "aria-label": "Clear search query",
2587
+ className: "sui-display-inline-flex sui-align-items-center sui-justify-content-center",
2588
+ children: /* @__PURE__ */ jsx(Icon, {
2589
+ icon: CloseIcon$1,
2590
+ size: 0
2591
+ })
2592
+ }), $[31] = t12) : t12 = $[31];
2593
+ let t13;
2594
+ $[32] === t11 ? t13 = $[33] : (t13 = /* @__PURE__ */ jsx("div", {
2595
+ className: t10,
2596
+ "data-ui": "Search-Clear",
2597
+ style: t11,
2598
+ children: t12
2599
+ }), $[32] = t11, $[33] = t13);
2600
+ let t14;
2601
+ return $[34] !== t13 || $[35] !== t5 || $[36] !== t9 ? (t14 = /* @__PURE__ */ jsxs(Fragment, { children: [
2602
+ t5,
2603
+ t9,
2604
+ t13
2605
+ ] }), $[34] = t13, $[35] = t5, $[36] = t9, $[37] = t14) : t14 = $[37], t14;
2606
+ }
2607
+ export { Avatar, AvatarCounter, AvatarStack, Badge, Box, Button, Card, Checkbox, Code, Container, Dialog, Divider, Eyebrow, Flex, Grid, HStack, Heading, Hotkeys, Icon, IconButton, Indicator, IndicatorStack, Inline, KBD, Link, List, Popover, PressArea, Radio, SearchInput, Select, SkipToContent, Spinner, Switch, Tabs, Text, TextArea, TextInput, Tooltip, TooltipGroup, VStack, VisuallyHidden, useIsClient };
2531
2608
 
2532
2609
  //# sourceMappingURL=index.js.map