@sanity/ui 5.0.0-alpha.7 → 5.0.0-alpha.9

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 (48) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/install.js +2 -1
  3. package/dist/index.d.ts +273 -79
  4. package/dist/index.js +51 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/styles.css +1 -1
  7. package/package.json +2 -2
  8. package/src/cli/install.ts +2 -1
  9. package/src/components/badge/Badge.tsx +53 -0
  10. package/src/components/badge/badge.css +6 -0
  11. package/src/components/badge/badge.props.ts +31 -0
  12. package/src/components/box/box.props.ts +7 -2
  13. package/src/components/button/button.props.ts +27 -9
  14. package/src/components/card/card.props.ts +6 -2
  15. package/src/components/checkbox/Checkbox.tsx +2 -1
  16. package/src/components/checkbox/checkbox.props.ts +11 -3
  17. package/src/components/code/code.props.ts +10 -3
  18. package/src/components/container/container.props.ts +6 -2
  19. package/src/components/dialog/Dialog.tsx +1 -1
  20. package/src/components/dialog/dialog.props.ts +13 -4
  21. package/src/components/eyebrow/eyebrow.props.ts +6 -2
  22. package/src/components/flex/flex.props.ts +6 -2
  23. package/src/components/grid/grid.props.ts +6 -2
  24. package/src/components/h-stack/hStack.props.ts +3 -1
  25. package/src/components/heading/heading.props.ts +8 -2
  26. package/src/components/icon/icon.props.ts +6 -2
  27. package/src/components/icon-button/iconButton.props.ts +7 -2
  28. package/src/components/index.css +1 -0
  29. package/src/components/indicator/indicator.props.ts +6 -2
  30. package/src/components/indicator-stack/indicatorStack.props.ts +3 -1
  31. package/src/components/inline/inline.props.ts +6 -2
  32. package/src/components/label/label.props.ts +7 -1
  33. package/src/components/link/link.props.ts +4 -4
  34. package/src/components/list/list.props.ts +27 -9
  35. package/src/components/popover/popover.props.ts +14 -4
  36. package/src/components/press-area/pressArea.props.ts +3 -1
  37. package/src/components/radio/radio.props.ts +7 -2
  38. package/src/components/skip-to-content/skipToContent.props.ts +9 -3
  39. package/src/components/spinner/Spinner.tsx +1 -1
  40. package/src/components/spinner/spinner.props.ts +3 -0
  41. package/src/components/switch/switch.props.ts +7 -2
  42. package/src/components/text/text.props.ts +6 -2
  43. package/src/components/tooltip/tooltip.props.ts +12 -4
  44. package/src/components/tooltip-group/tooltipGroup.props.ts +3 -1
  45. package/src/components/v-stack/vStack.props.ts +3 -1
  46. package/src/components/visually-hidden/visuallyHidden.props.ts +6 -2
  47. package/src/index.ts +1 -0
  48. package/src/version.ts +2 -2
package/dist/index.js CHANGED
@@ -3,7 +3,10 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import { c } from "react/compiler-runtime";
4
4
  import clsx from "clsx";
5
5
  import { isValidElement, useRef, useEffect, lazy, Suspense, useId, Children, useSyncExternalStore, useState, cloneElement, Activity } from "react";
6
- import { SpinnerIcon, RemoveIcon, CheckmarkIcon, CloseIcon } from "@sanity/icons";
6
+ import { SpinnerIcon } from "@sanity/icons/Spinner";
7
+ import { CheckmarkIcon } from "@sanity/icons/Checkmark";
8
+ import { RemoveIcon } from "@sanity/icons/Remove";
9
+ import { CloseIcon } from "@sanity/icons/Close";
7
10
  import { createPortal } from "react-dom";
8
11
  const PREFIX = "sui", BREAKPOINTS_LENGTH = 6;
9
12
  function getProps(componentProps, propDefs) {
@@ -96,7 +99,7 @@ function getCompositeValue(propValue, propDef, key) {
96
99
  compositeValue = mapping?.[propValue];
97
100
  return compositeValue;
98
101
  }
99
- const HASH = "47d232";
102
+ const HASH = "fd663f";
100
103
  function suffixClassName(className) {
101
104
  return `${className}-${HASH}`;
102
105
  }
@@ -2042,7 +2045,53 @@ function TooltipGroup(props) {
2042
2045
  let t6;
2043
2046
  return $[8] !== Component || $[9] !== children || $[10] !== handleBlur || $[11] !== handleMouseLeave || $[12] !== handleTransitionEnd || $[13] !== rest || $[14] !== t3 || $[15] !== t5 ? (t6 = /* @__PURE__ */ jsx(Component, { className: t3, style: t5, "data-ui": "TooltipGroup", ref, onTransitionEnd: handleTransitionEnd, onMouseLeave: handleMouseLeave, onBlur: handleBlur, ...rest, children }), $[8] = Component, $[9] = children, $[10] = handleBlur, $[11] = handleMouseLeave, $[12] = handleTransitionEnd, $[13] = rest, $[14] = t3, $[15] = t5, $[16] = t6) : t6 = $[16], t6;
2044
2047
  }
2048
+ const badgeProps = {
2049
+ as: {
2050
+ type: "string"
2051
+ },
2052
+ iconStart: {
2053
+ type: "string"
2054
+ },
2055
+ text: {
2056
+ type: "string"
2057
+ },
2058
+ ...toneProps
2059
+ }, badgeClassName = suffixClassName("sui-Badge");
2060
+ function Badge(t0) {
2061
+ const $ = c(20);
2062
+ let T0, children, t1, t2, t3, t4, t5, text;
2063
+ if ($[0] !== t0) {
2064
+ const {
2065
+ tone: t62,
2066
+ ...props
2067
+ } = t0, tone = t62 === void 0 ? "neutral" : t62, {
2068
+ as,
2069
+ children: t72,
2070
+ className,
2071
+ style,
2072
+ iconStart: IconStart,
2073
+ text: t8,
2074
+ ...rest
2075
+ } = getProps({
2076
+ tone,
2077
+ ...props
2078
+ }, badgeProps);
2079
+ children = t72, text = t8;
2080
+ const Component = as || "span", badgeClasses = clsx(badgeClassName, `${IconStart ? "sui-p1" : "sui-px2 sui-py1"} sui-radius-full sui-display-inline-flex sui-align-items-center sui-gap1`);
2081
+ T0 = Component, t1 = clsx(badgeClasses, className), t2 = style, t3 = "Badge", t4 = rest, t5 = IconStart && (isValidElement(IconStart) ? IconStart : /* @__PURE__ */ jsx(Icon, { icon: IconStart, marginX: -1, marginY: -2, size: 0 })), $[0] = t0, $[1] = T0, $[2] = children, $[3] = t1, $[4] = t2, $[5] = t3, $[6] = t4, $[7] = t5, $[8] = text;
2082
+ } else
2083
+ T0 = $[1], children = $[2], t1 = $[3], t2 = $[4], t3 = $[5], t4 = $[6], t5 = $[7], text = $[8];
2084
+ let t6;
2085
+ $[9] !== text ? (t6 = text && /* @__PURE__ */ jsx(Text, { size: 1, trim: !0, children: text }), $[9] = text, $[10] = t6) : t6 = $[10];
2086
+ let t7;
2087
+ return $[11] !== T0 || $[12] !== children || $[13] !== t1 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4 || $[17] !== t5 || $[18] !== t6 ? (t7 = /* @__PURE__ */ jsxs(T0, { className: t1, style: t2, "data-ui": t3, ...t4, children: [
2088
+ t5,
2089
+ t6,
2090
+ children
2091
+ ] }), $[11] = T0, $[12] = children, $[13] = t1, $[14] = t2, $[15] = t3, $[16] = t4, $[17] = t5, $[18] = t6, $[19] = t7) : t7 = $[19], t7;
2092
+ }
2045
2093
  export {
2094
+ Badge,
2046
2095
  Box,
2047
2096
  Button,
2048
2097
  Card,