@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/feedback.js CHANGED
@@ -1159,7 +1159,10 @@ function useRippleState(options = {}) {
1159
1159
  const rect = e.currentTarget.getBoundingClientRect();
1160
1160
  const x = e.clientX - rect.left;
1161
1161
  const y = e.clientY - rect.top;
1162
- const rippleSize = Math.hypot(rect.width, rect.height) * 2;
1162
+ const rippleSize = Math.max(
1163
+ Math.hypot(rect.width, rect.height) * 2.5,
1164
+ 320
1165
+ );
1163
1166
  setRipples((prev) => [
1164
1167
  ...prev,
1165
1168
  { id: Date.now(), x, y, size: rippleSize }
@@ -1190,12 +1193,39 @@ function TouchTarget() {
1190
1193
  }
1191
1194
  );
1192
1195
  }
1193
- var SIZE_STYLES = {
1194
- xs: "h-8 w-8",
1195
- sm: "h-10 w-10",
1196
- md: "h-14 w-14",
1197
- lg: "h-24 w-24",
1198
- xl: "h-[8.5rem] w-[8.5rem]"
1196
+ var SIZE_HEIGHT_STYLES = {
1197
+ xs: "h-8",
1198
+ sm: "h-10",
1199
+ md: "h-14",
1200
+ lg: "h-24",
1201
+ xl: "h-[8.5rem]"
1202
+ };
1203
+ var WIDTH_SIZE_STYLES = {
1204
+ xs: {
1205
+ default: "w-8",
1206
+ narrow: "w-8",
1207
+ wide: "w-12"
1208
+ },
1209
+ sm: {
1210
+ default: "w-10",
1211
+ narrow: "w-12",
1212
+ wide: "w-[3.25rem]"
1213
+ },
1214
+ md: {
1215
+ default: "w-14",
1216
+ narrow: "w-12",
1217
+ wide: "w-[4.5rem]"
1218
+ },
1219
+ lg: {
1220
+ default: "w-24",
1221
+ narrow: "w-16",
1222
+ wide: "w-32"
1223
+ },
1224
+ xl: {
1225
+ default: "w-[8.5rem]",
1226
+ narrow: "w-[6.5rem]",
1227
+ wide: "w-[11.5rem]"
1228
+ }
1199
1229
  };
1200
1230
  var SIZE_ICON = {
1201
1231
  xs: { cls: "size-5", px: 20 },
@@ -1296,11 +1326,14 @@ var IconButtonComponent = React12__namespace.forwardRef(
1296
1326
  variant = "default",
1297
1327
  colorStyle = "standard",
1298
1328
  size = "sm",
1329
+ widthVariant = "default",
1299
1330
  shape = "round",
1300
1331
  selected,
1332
+ selectedIcon,
1301
1333
  loading = false,
1302
1334
  loadingVariant = "loading-indicator",
1303
1335
  iconSize,
1336
+ asChild = false,
1304
1337
  children,
1305
1338
  onClick,
1306
1339
  onKeyDown,
@@ -1311,17 +1344,20 @@ var IconButtonComponent = React12__namespace.forwardRef(
1311
1344
  "variant",
1312
1345
  "colorStyle",
1313
1346
  "size",
1347
+ "widthVariant",
1314
1348
  "shape",
1315
1349
  "selected",
1350
+ "selectedIcon",
1316
1351
  "loading",
1317
1352
  "loadingVariant",
1318
1353
  "iconSize",
1354
+ "asChild",
1319
1355
  "children",
1320
1356
  "onClick",
1321
1357
  "onKeyDown",
1322
1358
  "aria-label"
1323
1359
  ]);
1324
- var _a2, _b2;
1360
+ var _a2, _b2, _c, _d, _e;
1325
1361
  const isToggle = variant === "toggle";
1326
1362
  const isSelected = isToggle && !!selected;
1327
1363
  const resolvedColorClass = React12__namespace.useMemo(
@@ -1352,6 +1388,8 @@ var IconButtonComponent = React12__namespace.forwardRef(
1352
1388
  const defaultIconPx = sizeIcon.px;
1353
1389
  const iconPx = iconSize != null ? iconSize : defaultIconPx;
1354
1390
  const isCustomSize = iconSize != null && iconSize !== "inherit";
1391
+ const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
1392
+ const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[widthVariant]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
1355
1393
  const needsTouchTarget = size === "xs" || size === "sm";
1356
1394
  const { ripples, onPointerDown, removeRipple } = useRippleState({
1357
1395
  disabled: loading
@@ -1377,7 +1415,90 @@ var IconButtonComponent = React12__namespace.forwardRef(
1377
1415
  },
1378
1416
  [loading, onClick, onKeyDown]
1379
1417
  );
1380
- return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1418
+ const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1419
+ needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
1420
+ /* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
1421
+ /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
1422
+ react.m.span,
1423
+ __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1424
+ transition: SPRING_TRANSITION,
1425
+ className: cn(
1426
+ "flex items-center justify-center shrink-0",
1427
+ iconSize != null ? void 0 : iconClass
1428
+ ),
1429
+ style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
1430
+ children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
1431
+ LoadingIndicator,
1432
+ {
1433
+ size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1434
+ color: "currentColor",
1435
+ "aria-label": "Loading"
1436
+ }
1437
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1438
+ ProgressIndicator,
1439
+ {
1440
+ variant: "circular",
1441
+ size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1442
+ color: "currentColor",
1443
+ trackColor: "transparent",
1444
+ "aria-label": "Loading"
1445
+ }
1446
+ )
1447
+ }),
1448
+ "loading"
1449
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1450
+ react.m.span,
1451
+ __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1452
+ transition: SPRING_TRANSITION,
1453
+ "aria-hidden": "true",
1454
+ className: cn(
1455
+ "flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]",
1456
+ iconSize != null ? void 0 : iconClass
1457
+ ),
1458
+ style: {
1459
+ fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
1460
+ width: isCustomSize ? `${iconSize}px` : void 0,
1461
+ height: isCustomSize ? `${iconSize}px` : void 0
1462
+ },
1463
+ children: isSelected && selectedIcon ? selectedIcon : asChild ? React12__namespace.Children.only(children).props.children : children
1464
+ }),
1465
+ isSelected && selectedIcon ? "selected-content" : "content"
1466
+ ) })
1467
+ ] });
1468
+ const containerClassName = cn(
1469
+ baseIconButtonClasses,
1470
+ resolvedColorClass,
1471
+ outlineWidthClass,
1472
+ disabledBgClass,
1473
+ "overflow-hidden",
1474
+ heightClass,
1475
+ widthClass,
1476
+ loading && "pointer-events-none opacity-75 cursor-not-allowed",
1477
+ className
1478
+ );
1479
+ if (asChild) {
1480
+ const child = React12__namespace.Children.only(children);
1481
+ return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1482
+ reactSlot.Slot,
1483
+ __spreadProps(__spreadValues({
1484
+ ref,
1485
+ "aria-pressed": isToggle ? isSelected : void 0,
1486
+ "aria-label": ariaLabel,
1487
+ "aria-busy": loading || void 0,
1488
+ "aria-disabled": loading || restProps.disabled,
1489
+ onClick: handleClick,
1490
+ onPointerDown,
1491
+ onKeyDown: handleKeyDown,
1492
+ style: __spreadProps(__spreadValues({}, style), {
1493
+ borderRadius: `${animateRadius}px`
1494
+ }),
1495
+ className: containerClassName
1496
+ }, restProps), {
1497
+ children: React12__namespace.cloneElement(child, { children: innerContent })
1498
+ })
1499
+ ) });
1500
+ }
1501
+ return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1381
1502
  react.m.button,
1382
1503
  __spreadProps(__spreadValues({
1383
1504
  ref,
@@ -1393,67 +1514,9 @@ var IconButtonComponent = React12__namespace.forwardRef(
1393
1514
  animate: { borderRadius: animateRadius },
1394
1515
  whileTap: { borderRadius: pressedRadius },
1395
1516
  transition: { borderRadius: SPRING_TRANSITION_FAST },
1396
- className: cn(
1397
- baseIconButtonClasses,
1398
- resolvedColorClass,
1399
- outlineWidthClass,
1400
- disabledBgClass,
1401
- "overflow-hidden",
1402
- SIZE_STYLES[size],
1403
- loading && "pointer-events-none opacity-75 cursor-not-allowed",
1404
- className
1405
- )
1517
+ className: containerClassName
1406
1518
  }, restProps), {
1407
- children: [
1408
- needsTouchTarget && /* @__PURE__ */ jsxRuntime.jsx(TouchTarget, {}),
1409
- /* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
1410
- /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
1411
- react.m.span,
1412
- __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1413
- transition: SPRING_TRANSITION,
1414
- className: cn(
1415
- "flex items-center justify-center shrink-0",
1416
- iconSize != null ? void 0 : iconClass
1417
- ),
1418
- style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
1419
- children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsxRuntime.jsx(
1420
- LoadingIndicator,
1421
- {
1422
- size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1423
- color: "currentColor",
1424
- "aria-label": "Loading"
1425
- }
1426
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1427
- ProgressIndicator,
1428
- {
1429
- variant: "circular",
1430
- size: typeof iconPx === "number" ? iconPx : defaultIconPx,
1431
- color: "currentColor",
1432
- trackColor: "transparent",
1433
- "aria-label": "Loading"
1434
- }
1435
- )
1436
- }),
1437
- "loading"
1438
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1439
- react.m.span,
1440
- __spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
1441
- transition: SPRING_TRANSITION,
1442
- "aria-hidden": "true",
1443
- className: cn(
1444
- "flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
1445
- iconSize != null ? void 0 : iconClass
1446
- ),
1447
- style: {
1448
- fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
1449
- width: isCustomSize ? `${iconSize}px` : void 0,
1450
- height: isCustomSize ? `${iconSize}px` : void 0
1451
- },
1452
- children
1453
- }),
1454
- "content"
1455
- ) })
1456
- ]
1519
+ children: innerContent
1457
1520
  })
1458
1521
  ) });
1459
1522
  }