@bug-on/m3-expressive 1.2.0 → 1.2.2

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 +12 -0
  2. package/dist/buttons.d.mts +26 -5
  3. package/dist/buttons.d.ts +26 -5
  4. package/dist/buttons.js +1074 -765
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +1066 -765
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/core.js +133 -69
  9. package/dist/core.js.map +1 -1
  10. package/dist/core.mjs +133 -69
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/feedback.js +132 -69
  13. package/dist/feedback.js.map +1 -1
  14. package/dist/feedback.mjs +132 -69
  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 +74 -9
  19. package/dist/forms.js.map +1 -1
  20. package/dist/forms.mjs +74 -9
  21. package/dist/forms.mjs.map +1 -1
  22. package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-CSsDmuQC.d.mts} +19 -0
  23. package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-CSsDmuQC.d.ts} +19 -0
  24. package/dist/index.d.mts +4 -4
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.js +2204 -1464
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +2056 -1324
  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 +80 -15
  33. package/dist/layout.js.map +1 -1
  34. package/dist/layout.mjs +80 -15
  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 +461 -101
  39. package/dist/navigation.js.map +1 -1
  40. package/dist/navigation.mjs +455 -102
  41. package/dist/navigation.mjs.map +1 -1
  42. package/dist/overlays.js +261 -197
  43. package/dist/overlays.js.map +1 -1
  44. package/dist/overlays.mjs +223 -159
  45. package/dist/overlays.mjs.map +1 -1
  46. package/dist/pickers.js +392 -301
  47. package/dist/pickers.js.map +1 -1
  48. package/dist/pickers.mjs +361 -270
  49. package/dist/pickers.mjs.map +1 -1
  50. package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-C-qQlyZx.d.ts} +118 -25
  51. package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DHJqNeq_.d.mts} +118 -25
  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 +3 -3
package/dist/core.js CHANGED
@@ -7,6 +7,7 @@ var materialColorUtilities = require('@material/material-color-utilities');
7
7
  var clsx = require('clsx');
8
8
  var tailwindMerge = require('tailwind-merge');
9
9
  var react = require('motion/react');
10
+ var reactSlot = require('@radix-ui/react-slot');
10
11
 
11
12
  function _interopNamespace(e) {
12
13
  if (e && e.__esModule) return e;
@@ -435,7 +436,10 @@ function useRippleState(options = {}) {
435
436
  const rect = e.currentTarget.getBoundingClientRect();
436
437
  const x = e.clientX - rect.left;
437
438
  const y = e.clientY - rect.top;
438
- const rippleSize = Math.hypot(rect.width, rect.height) * 2;
439
+ const rippleSize = Math.max(
440
+ Math.hypot(rect.width, rect.height) * 2.5,
441
+ 320
442
+ );
439
443
  setRipples((prev) => [
440
444
  ...prev,
441
445
  { id: Date.now(), x, y, size: rippleSize }
@@ -1390,12 +1394,39 @@ function TouchTarget() {
1390
1394
  }
1391
1395
  );
1392
1396
  }
1393
- var SIZE_STYLES = {
1394
- xs: "h-8 w-8",
1395
- sm: "h-10 w-10",
1396
- md: "h-14 w-14",
1397
- lg: "h-24 w-24",
1398
- xl: "h-[8.5rem] w-[8.5rem]"
1397
+ var SIZE_HEIGHT_STYLES = {
1398
+ xs: "h-8",
1399
+ sm: "h-10",
1400
+ md: "h-14",
1401
+ lg: "h-24",
1402
+ xl: "h-[8.5rem]"
1403
+ };
1404
+ var WIDTH_SIZE_STYLES = {
1405
+ xs: {
1406
+ default: "w-8",
1407
+ narrow: "w-8",
1408
+ wide: "w-12"
1409
+ },
1410
+ sm: {
1411
+ default: "w-10",
1412
+ narrow: "w-12",
1413
+ wide: "w-[3.25rem]"
1414
+ },
1415
+ md: {
1416
+ default: "w-14",
1417
+ narrow: "w-12",
1418
+ wide: "w-[4.5rem]"
1419
+ },
1420
+ lg: {
1421
+ default: "w-24",
1422
+ narrow: "w-16",
1423
+ wide: "w-32"
1424
+ },
1425
+ xl: {
1426
+ default: "w-[8.5rem]",
1427
+ narrow: "w-[6.5rem]",
1428
+ wide: "w-[11.5rem]"
1429
+ }
1399
1430
  };
1400
1431
  var SIZE_ICON = {
1401
1432
  xs: { cls: "size-5", px: 20 },
@@ -1496,11 +1527,14 @@ var IconButtonComponent = React11__namespace.forwardRef(
1496
1527
  variant = "default",
1497
1528
  colorStyle = "standard",
1498
1529
  size = "sm",
1530
+ widthVariant = "default",
1499
1531
  shape = "round",
1500
1532
  selected,
1533
+ selectedIcon,
1501
1534
  loading = false,
1502
1535
  loadingVariant = "loading-indicator",
1503
1536
  iconSize,
1537
+ asChild = false,
1504
1538
  children,
1505
1539
  onClick,
1506
1540
  onKeyDown,
@@ -1511,17 +1545,20 @@ var IconButtonComponent = React11__namespace.forwardRef(
1511
1545
  "variant",
1512
1546
  "colorStyle",
1513
1547
  "size",
1548
+ "widthVariant",
1514
1549
  "shape",
1515
1550
  "selected",
1551
+ "selectedIcon",
1516
1552
  "loading",
1517
1553
  "loadingVariant",
1518
1554
  "iconSize",
1555
+ "asChild",
1519
1556
  "children",
1520
1557
  "onClick",
1521
1558
  "onKeyDown",
1522
1559
  "aria-label"
1523
1560
  ]);
1524
- var _a2, _b2;
1561
+ var _a2, _b2, _c, _d, _e;
1525
1562
  const isToggle = variant === "toggle";
1526
1563
  const isSelected = isToggle && !!selected;
1527
1564
  const resolvedColorClass = React11__namespace.useMemo(
@@ -1552,6 +1589,8 @@ var IconButtonComponent = React11__namespace.forwardRef(
1552
1589
  const defaultIconPx = sizeIcon.px;
1553
1590
  const iconPx = iconSize != null ? iconSize : defaultIconPx;
1554
1591
  const isCustomSize = iconSize != null && iconSize !== "inherit";
1592
+ const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
1593
+ const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[widthVariant]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
1555
1594
  const needsTouchTarget = size === "xs" || size === "sm";
1556
1595
  const { ripples, onPointerDown, removeRipple } = useRippleState({
1557
1596
  disabled: loading
@@ -1577,7 +1616,90 @@ var IconButtonComponent = React11__namespace.forwardRef(
1577
1616
  },
1578
1617
  [loading, onClick, onKeyDown]
1579
1618
  );
1580
- return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1619
+ const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1620
+ needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
1621
+ /* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
1622
+ /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
1623
+ react.m.span,
1624
+ __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1625
+ transition: SPRING_TRANSITION,
1626
+ className: cn(
1627
+ "flex items-center justify-center shrink-0",
1628
+ iconSize != null ? void 0 : iconClass
1629
+ ),
1630
+ style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
1631
+ children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
1632
+ LoadingIndicator,
1633
+ {
1634
+ size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1635
+ color: "currentColor",
1636
+ "aria-label": "Loading"
1637
+ }
1638
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1639
+ ProgressIndicator,
1640
+ {
1641
+ variant: "circular",
1642
+ size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1643
+ color: "currentColor",
1644
+ trackColor: "transparent",
1645
+ "aria-label": "Loading"
1646
+ }
1647
+ )
1648
+ }),
1649
+ "loading"
1650
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1651
+ react.m.span,
1652
+ __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1653
+ transition: SPRING_TRANSITION,
1654
+ "aria-hidden": "true",
1655
+ className: cn(
1656
+ "flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]",
1657
+ iconSize != null ? void 0 : iconClass
1658
+ ),
1659
+ style: {
1660
+ fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
1661
+ width: isCustomSize ? `${iconSize}px` : void 0,
1662
+ height: isCustomSize ? `${iconSize}px` : void 0
1663
+ },
1664
+ children: isSelected && selectedIcon ? selectedIcon : asChild ? React11__namespace.Children.only(children).props.children : children
1665
+ }),
1666
+ isSelected && selectedIcon ? "selected-content" : "content"
1667
+ ) })
1668
+ ] });
1669
+ const containerClassName = cn(
1670
+ baseIconButtonClasses,
1671
+ resolvedColorClass,
1672
+ outlineWidthClass,
1673
+ disabledBgClass,
1674
+ "overflow-hidden",
1675
+ heightClass,
1676
+ widthClass,
1677
+ loading && "pointer-events-none opacity-75 cursor-not-allowed",
1678
+ className
1679
+ );
1680
+ if (asChild) {
1681
+ const child = React11__namespace.Children.only(children);
1682
+ return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1683
+ reactSlot.Slot,
1684
+ __spreadProps(__spreadValues({
1685
+ ref,
1686
+ "aria-pressed": isToggle ? isSelected : void 0,
1687
+ "aria-label": ariaLabel,
1688
+ "aria-busy": loading || void 0,
1689
+ "aria-disabled": loading || restProps.disabled,
1690
+ onClick: handleClick,
1691
+ onPointerDown,
1692
+ onKeyDown: handleKeyDown,
1693
+ style: __spreadProps(__spreadValues({}, style), {
1694
+ borderRadius: `${animateRadius}px`
1695
+ }),
1696
+ className: containerClassName
1697
+ }, restProps), {
1698
+ children: React11__namespace.cloneElement(child, { children: innerContent })
1699
+ })
1700
+ ) });
1701
+ }
1702
+ return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1581
1703
  react.m.button,
1582
1704
  __spreadProps(__spreadValues({
1583
1705
  ref,
@@ -1593,67 +1715,9 @@ var IconButtonComponent = React11__namespace.forwardRef(
1593
1715
  animate: { borderRadius: animateRadius },
1594
1716
  whileTap: { borderRadius: pressedRadius },
1595
1717
  transition: { borderRadius: SPRING_TRANSITION_FAST },
1596
- className: cn(
1597
- baseIconButtonClasses,
1598
- resolvedColorClass,
1599
- outlineWidthClass,
1600
- disabledBgClass,
1601
- "overflow-hidden",
1602
- SIZE_STYLES[size],
1603
- loading && "pointer-events-none opacity-75 cursor-not-allowed",
1604
- className
1605
- )
1718
+ className: containerClassName
1606
1719
  }, restProps), {
1607
- children: [
1608
- needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
1609
- /* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
1610
- /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
1611
- react.m.span,
1612
- __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1613
- transition: SPRING_TRANSITION,
1614
- className: cn(
1615
- "flex items-center justify-center shrink-0",
1616
- iconSize != null ? void 0 : iconClass
1617
- ),
1618
- style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
1619
- children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
1620
- LoadingIndicator,
1621
- {
1622
- size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1623
- color: "currentColor",
1624
- "aria-label": "Loading"
1625
- }
1626
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1627
- ProgressIndicator,
1628
- {
1629
- variant: "circular",
1630
- size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1631
- color: "currentColor",
1632
- trackColor: "transparent",
1633
- "aria-label": "Loading"
1634
- }
1635
- )
1636
- }),
1637
- "loading"
1638
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1639
- react.m.span,
1640
- __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1641
- transition: SPRING_TRANSITION,
1642
- "aria-hidden": "true",
1643
- className: cn(
1644
- "flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
1645
- iconSize != null ? void 0 : iconClass
1646
- ),
1647
- style: {
1648
- fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
1649
- width: isCustomSize ? `${iconSize}px` : void 0,
1650
- height: isCustomSize ? `${iconSize}px` : void 0
1651
- },
1652
- children
1653
- }),
1654
- "content"
1655
- ) })
1656
- ]
1720
+ children: innerContent
1657
1721
  })
1658
1722
  ) });
1659
1723
  }