@bug-on/m3-expressive 1.2.0 → 1.2.1

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 (54) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/buttons.d.mts +2 -2
  3. package/dist/buttons.d.ts +2 -2
  4. package/dist/buttons.js +678 -605
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +677 -604
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/core.js +86 -61
  9. package/dist/core.js.map +1 -1
  10. package/dist/core.mjs +86 -61
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/feedback.js +85 -61
  13. package/dist/feedback.js.map +1 -1
  14. package/dist/feedback.mjs +85 -61
  15. package/dist/feedback.mjs.map +1 -1
  16. package/dist/forms.d.mts +2 -2
  17. package/dist/forms.d.ts +2 -2
  18. package/dist/forms.js +70 -8
  19. package/dist/forms.js.map +1 -1
  20. package/dist/forms.mjs +70 -8
  21. package/dist/forms.mjs.map +1 -1
  22. package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-sSt6PPLg.d.mts} +6 -0
  23. package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-sSt6PPLg.d.ts} +6 -0
  24. package/dist/index.d.mts +4 -4
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.js +973 -496
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +967 -497
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/layout.d.mts +18 -1
  31. package/dist/layout.d.ts +18 -1
  32. package/dist/layout.js +65 -8
  33. package/dist/layout.js.map +1 -1
  34. package/dist/layout.mjs +65 -8
  35. package/dist/layout.mjs.map +1 -1
  36. package/dist/navigation.d.mts +134 -9
  37. package/dist/navigation.d.ts +134 -9
  38. package/dist/navigation.js +403 -93
  39. package/dist/navigation.js.map +1 -1
  40. package/dist/navigation.mjs +397 -94
  41. package/dist/navigation.mjs.map +1 -1
  42. package/dist/overlays.js +214 -189
  43. package/dist/overlays.js.map +1 -1
  44. package/dist/overlays.mjs +176 -151
  45. package/dist/overlays.mjs.map +1 -1
  46. package/dist/pickers.js +222 -197
  47. package/dist/pickers.js.map +1 -1
  48. package/dist/pickers.mjs +189 -164
  49. package/dist/pickers.mjs.map +1 -1
  50. package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-BcPD_7uK.d.ts} +44 -6
  51. package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DtFJkTFr.d.mts} +44 -6
  52. package/dist/{text-field-eAIpz9z1.d.mts → text-field-T4Rg-9Bw.d.mts} +7 -0
  53. package/dist/{text-field-eAIpz9z1.d.ts → text-field-T4Rg-9Bw.d.ts} +7 -0
  54. package/package.json +1 -1
package/dist/core.mjs CHANGED
@@ -6,6 +6,7 @@ import { hexFromArgb, Hct, SchemeExpressive, SchemeNeutral, SchemeMonochrome, Sc
6
6
  import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
8
8
  import { LazyMotion, domMax, m, useMotionValue, animate, useAnimationFrame, AnimatePresence, useReducedMotion } from 'motion/react';
9
+ import { Slot } from '@radix-ui/react-slot';
9
10
 
10
11
  var __defProp = Object.defineProperty;
11
12
  var __defProps = Object.defineProperties;
@@ -1480,6 +1481,7 @@ var IconButtonComponent = React11.forwardRef(
1480
1481
  loading = false,
1481
1482
  loadingVariant = "loading-indicator",
1482
1483
  iconSize,
1484
+ asChild = false,
1483
1485
  children,
1484
1486
  onClick,
1485
1487
  onKeyDown,
@@ -1495,6 +1497,7 @@ var IconButtonComponent = React11.forwardRef(
1495
1497
  "loading",
1496
1498
  "loadingVariant",
1497
1499
  "iconSize",
1500
+ "asChild",
1498
1501
  "children",
1499
1502
  "onClick",
1500
1503
  "onKeyDown",
@@ -1556,7 +1559,87 @@ var IconButtonComponent = React11.forwardRef(
1556
1559
  },
1557
1560
  [loading, onClick, onKeyDown]
1558
1561
  );
1559
- return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
1562
+ const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
1563
+ needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
1564
+ /* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
1565
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
1566
+ m.span,
1567
+ __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1568
+ transition: SPRING_TRANSITION,
1569
+ className: cn(
1570
+ "flex items-center justify-center shrink-0",
1571
+ iconSize != null ? void 0 : iconClass
1572
+ ),
1573
+ style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
1574
+ children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
1575
+ LoadingIndicator,
1576
+ {
1577
+ size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1578
+ color: "currentColor",
1579
+ "aria-label": "Loading"
1580
+ }
1581
+ ) : /* @__PURE__ */ jsx(
1582
+ ProgressIndicator,
1583
+ {
1584
+ variant: "circular",
1585
+ size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1586
+ color: "currentColor",
1587
+ trackColor: "transparent",
1588
+ "aria-label": "Loading"
1589
+ }
1590
+ )
1591
+ }),
1592
+ "loading"
1593
+ ) : /* @__PURE__ */ jsx(
1594
+ m.span,
1595
+ __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1596
+ transition: SPRING_TRANSITION,
1597
+ "aria-hidden": "true",
1598
+ className: cn(
1599
+ "flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
1600
+ iconSize != null ? void 0 : iconClass
1601
+ ),
1602
+ style: {
1603
+ fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
1604
+ width: isCustomSize ? `${iconSize}px` : void 0,
1605
+ height: isCustomSize ? `${iconSize}px` : void 0
1606
+ },
1607
+ children: asChild ? React11.Children.only(children).props.children : children
1608
+ }),
1609
+ "content"
1610
+ ) })
1611
+ ] });
1612
+ const containerClassName = cn(
1613
+ baseIconButtonClasses,
1614
+ resolvedColorClass,
1615
+ outlineWidthClass,
1616
+ disabledBgClass,
1617
+ "overflow-hidden",
1618
+ SIZE_STYLES[size],
1619
+ loading && "pointer-events-none opacity-75 cursor-not-allowed",
1620
+ className
1621
+ );
1622
+ if (asChild) {
1623
+ const child = React11.Children.only(children);
1624
+ return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
1625
+ Slot,
1626
+ __spreadProps(__spreadValues({
1627
+ ref,
1628
+ "aria-pressed": isToggle ? isSelected : void 0,
1629
+ "aria-label": ariaLabel,
1630
+ "aria-busy": loading || void 0,
1631
+ "aria-disabled": loading || restProps.disabled,
1632
+ onClick: handleClick,
1633
+ onPointerDown,
1634
+ onKeyDown: handleKeyDown,
1635
+ style: __spreadProps(__spreadValues({}, style), { borderRadius: `${animateRadius}px` }),
1636
+ className: containerClassName
1637
+ }, restProps), {
1638
+ children: React11.cloneElement(child, { children: innerContent })
1639
+ })
1640
+ ) });
1641
+ }
1642
+ return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
1560
1643
  m.button,
1561
1644
  __spreadProps(__spreadValues({
1562
1645
  ref,
@@ -1572,67 +1655,9 @@ var IconButtonComponent = React11.forwardRef(
1572
1655
  animate: { borderRadius: animateRadius },
1573
1656
  whileTap: { borderRadius: pressedRadius },
1574
1657
  transition: { borderRadius: SPRING_TRANSITION_FAST },
1575
- className: cn(
1576
- baseIconButtonClasses,
1577
- resolvedColorClass,
1578
- outlineWidthClass,
1579
- disabledBgClass,
1580
- "overflow-hidden",
1581
- SIZE_STYLES[size],
1582
- loading && "pointer-events-none opacity-75 cursor-not-allowed",
1583
- className
1584
- )
1658
+ className: containerClassName
1585
1659
  }, restProps), {
1586
- children: [
1587
- needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
1588
- /* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
1589
- /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
1590
- m.span,
1591
- __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1592
- transition: SPRING_TRANSITION,
1593
- className: cn(
1594
- "flex items-center justify-center shrink-0",
1595
- iconSize != null ? void 0 : iconClass
1596
- ),
1597
- style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
1598
- children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
1599
- LoadingIndicator,
1600
- {
1601
- size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1602
- color: "currentColor",
1603
- "aria-label": "Loading"
1604
- }
1605
- ) : /* @__PURE__ */ jsx(
1606
- ProgressIndicator,
1607
- {
1608
- variant: "circular",
1609
- size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1610
- color: "currentColor",
1611
- trackColor: "transparent",
1612
- "aria-label": "Loading"
1613
- }
1614
- )
1615
- }),
1616
- "loading"
1617
- ) : /* @__PURE__ */ jsx(
1618
- m.span,
1619
- __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1620
- transition: SPRING_TRANSITION,
1621
- "aria-hidden": "true",
1622
- className: cn(
1623
- "flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
1624
- iconSize != null ? void 0 : iconClass
1625
- ),
1626
- style: {
1627
- fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
1628
- width: isCustomSize ? `${iconSize}px` : void 0,
1629
- height: isCustomSize ? `${iconSize}px` : void 0
1630
- },
1631
- children
1632
- }),
1633
- "content"
1634
- ) })
1635
- ]
1660
+ children: innerContent
1636
1661
  })
1637
1662
  ) });
1638
1663
  }