@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.
- package/CHANGELOG.md +12 -0
- package/dist/buttons.d.mts +26 -5
- package/dist/buttons.d.ts +26 -5
- package/dist/buttons.js +1074 -765
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +1066 -765
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +133 -69
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +133 -69
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +132 -69
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +132 -69
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +2 -2
- package/dist/forms.d.ts +2 -2
- package/dist/forms.js +74 -9
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +74 -9
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-CSsDmuQC.d.mts} +19 -0
- package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-CSsDmuQC.d.ts} +19 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2204 -1464
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2056 -1324
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +18 -1
- package/dist/layout.d.ts +18 -1
- package/dist/layout.js +80 -15
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +80 -15
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.d.mts +134 -9
- package/dist/navigation.d.ts +134 -9
- package/dist/navigation.js +461 -101
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +455 -102
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +261 -197
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +223 -159
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +392 -301
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +361 -270
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-C-qQlyZx.d.ts} +118 -25
- package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DHJqNeq_.d.mts} +118 -25
- package/dist/{text-field-eAIpz9z1.d.mts → text-field-T4Rg-9Bw.d.mts} +7 -0
- package/dist/{text-field-eAIpz9z1.d.ts → text-field-T4Rg-9Bw.d.ts} +7 -0
- package/package.json +3 -3
package/dist/feedback.mjs
CHANGED
|
@@ -1138,7 +1138,10 @@ function useRippleState(options = {}) {
|
|
|
1138
1138
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
1139
1139
|
const x = e.clientX - rect.left;
|
|
1140
1140
|
const y = e.clientY - rect.top;
|
|
1141
|
-
const rippleSize = Math.
|
|
1141
|
+
const rippleSize = Math.max(
|
|
1142
|
+
Math.hypot(rect.width, rect.height) * 2.5,
|
|
1143
|
+
320
|
|
1144
|
+
);
|
|
1142
1145
|
setRipples((prev) => [
|
|
1143
1146
|
...prev,
|
|
1144
1147
|
{ id: Date.now(), x, y, size: rippleSize }
|
|
@@ -1169,12 +1172,39 @@ function TouchTarget() {
|
|
|
1169
1172
|
}
|
|
1170
1173
|
);
|
|
1171
1174
|
}
|
|
1172
|
-
var
|
|
1173
|
-
xs: "h-8
|
|
1174
|
-
sm: "h-10
|
|
1175
|
-
md: "h-14
|
|
1176
|
-
lg: "h-24
|
|
1177
|
-
xl: "h-[8.5rem]
|
|
1175
|
+
var SIZE_HEIGHT_STYLES = {
|
|
1176
|
+
xs: "h-8",
|
|
1177
|
+
sm: "h-10",
|
|
1178
|
+
md: "h-14",
|
|
1179
|
+
lg: "h-24",
|
|
1180
|
+
xl: "h-[8.5rem]"
|
|
1181
|
+
};
|
|
1182
|
+
var WIDTH_SIZE_STYLES = {
|
|
1183
|
+
xs: {
|
|
1184
|
+
default: "w-8",
|
|
1185
|
+
narrow: "w-8",
|
|
1186
|
+
wide: "w-12"
|
|
1187
|
+
},
|
|
1188
|
+
sm: {
|
|
1189
|
+
default: "w-10",
|
|
1190
|
+
narrow: "w-12",
|
|
1191
|
+
wide: "w-[3.25rem]"
|
|
1192
|
+
},
|
|
1193
|
+
md: {
|
|
1194
|
+
default: "w-14",
|
|
1195
|
+
narrow: "w-12",
|
|
1196
|
+
wide: "w-[4.5rem]"
|
|
1197
|
+
},
|
|
1198
|
+
lg: {
|
|
1199
|
+
default: "w-24",
|
|
1200
|
+
narrow: "w-16",
|
|
1201
|
+
wide: "w-32"
|
|
1202
|
+
},
|
|
1203
|
+
xl: {
|
|
1204
|
+
default: "w-[8.5rem]",
|
|
1205
|
+
narrow: "w-[6.5rem]",
|
|
1206
|
+
wide: "w-[11.5rem]"
|
|
1207
|
+
}
|
|
1178
1208
|
};
|
|
1179
1209
|
var SIZE_ICON = {
|
|
1180
1210
|
xs: { cls: "size-5", px: 20 },
|
|
@@ -1275,11 +1305,14 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1275
1305
|
variant = "default",
|
|
1276
1306
|
colorStyle = "standard",
|
|
1277
1307
|
size = "sm",
|
|
1308
|
+
widthVariant = "default",
|
|
1278
1309
|
shape = "round",
|
|
1279
1310
|
selected,
|
|
1311
|
+
selectedIcon,
|
|
1280
1312
|
loading = false,
|
|
1281
1313
|
loadingVariant = "loading-indicator",
|
|
1282
1314
|
iconSize,
|
|
1315
|
+
asChild = false,
|
|
1283
1316
|
children,
|
|
1284
1317
|
onClick,
|
|
1285
1318
|
onKeyDown,
|
|
@@ -1290,17 +1323,20 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1290
1323
|
"variant",
|
|
1291
1324
|
"colorStyle",
|
|
1292
1325
|
"size",
|
|
1326
|
+
"widthVariant",
|
|
1293
1327
|
"shape",
|
|
1294
1328
|
"selected",
|
|
1329
|
+
"selectedIcon",
|
|
1295
1330
|
"loading",
|
|
1296
1331
|
"loadingVariant",
|
|
1297
1332
|
"iconSize",
|
|
1333
|
+
"asChild",
|
|
1298
1334
|
"children",
|
|
1299
1335
|
"onClick",
|
|
1300
1336
|
"onKeyDown",
|
|
1301
1337
|
"aria-label"
|
|
1302
1338
|
]);
|
|
1303
|
-
var _a2, _b2;
|
|
1339
|
+
var _a2, _b2, _c, _d, _e;
|
|
1304
1340
|
const isToggle = variant === "toggle";
|
|
1305
1341
|
const isSelected = isToggle && !!selected;
|
|
1306
1342
|
const resolvedColorClass = React12.useMemo(
|
|
@@ -1331,6 +1367,8 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1331
1367
|
const defaultIconPx = sizeIcon.px;
|
|
1332
1368
|
const iconPx = iconSize != null ? iconSize : defaultIconPx;
|
|
1333
1369
|
const isCustomSize = iconSize != null && iconSize !== "inherit";
|
|
1370
|
+
const heightClass = (_c = SIZE_HEIGHT_STYLES[size]) != null ? _c : SIZE_HEIGHT_STYLES.sm;
|
|
1371
|
+
const widthClass = (_e = ((_d = WIDTH_SIZE_STYLES[size]) != null ? _d : WIDTH_SIZE_STYLES.sm)[widthVariant]) != null ? _e : WIDTH_SIZE_STYLES.sm.default;
|
|
1334
1372
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1335
1373
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1336
1374
|
disabled: loading
|
|
@@ -1356,7 +1394,90 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1356
1394
|
},
|
|
1357
1395
|
[loading, onClick, onKeyDown]
|
|
1358
1396
|
);
|
|
1359
|
-
|
|
1397
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1398
|
+
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
1399
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
1400
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
1401
|
+
m.span,
|
|
1402
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1403
|
+
transition: SPRING_TRANSITION,
|
|
1404
|
+
className: cn(
|
|
1405
|
+
"flex items-center justify-center shrink-0",
|
|
1406
|
+
iconSize != null ? void 0 : iconClass
|
|
1407
|
+
),
|
|
1408
|
+
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
1409
|
+
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
1410
|
+
LoadingIndicator,
|
|
1411
|
+
{
|
|
1412
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1413
|
+
color: "currentColor",
|
|
1414
|
+
"aria-label": "Loading"
|
|
1415
|
+
}
|
|
1416
|
+
) : /* @__PURE__ */ jsx(
|
|
1417
|
+
ProgressIndicator,
|
|
1418
|
+
{
|
|
1419
|
+
variant: "circular",
|
|
1420
|
+
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1421
|
+
color: "currentColor",
|
|
1422
|
+
trackColor: "transparent",
|
|
1423
|
+
"aria-label": "Loading"
|
|
1424
|
+
}
|
|
1425
|
+
)
|
|
1426
|
+
}),
|
|
1427
|
+
"loading"
|
|
1428
|
+
) : /* @__PURE__ */ jsx(
|
|
1429
|
+
m.span,
|
|
1430
|
+
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1431
|
+
transition: SPRING_TRANSITION,
|
|
1432
|
+
"aria-hidden": "true",
|
|
1433
|
+
className: cn(
|
|
1434
|
+
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]",
|
|
1435
|
+
iconSize != null ? void 0 : iconClass
|
|
1436
|
+
),
|
|
1437
|
+
style: {
|
|
1438
|
+
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
1439
|
+
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1440
|
+
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1441
|
+
},
|
|
1442
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React12.Children.only(children).props.children : children
|
|
1443
|
+
}),
|
|
1444
|
+
isSelected && selectedIcon ? "selected-content" : "content"
|
|
1445
|
+
) })
|
|
1446
|
+
] });
|
|
1447
|
+
const containerClassName = cn(
|
|
1448
|
+
baseIconButtonClasses,
|
|
1449
|
+
resolvedColorClass,
|
|
1450
|
+
outlineWidthClass,
|
|
1451
|
+
disabledBgClass,
|
|
1452
|
+
"overflow-hidden",
|
|
1453
|
+
heightClass,
|
|
1454
|
+
widthClass,
|
|
1455
|
+
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
1456
|
+
className
|
|
1457
|
+
);
|
|
1458
|
+
if (asChild) {
|
|
1459
|
+
const child = React12.Children.only(children);
|
|
1460
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1461
|
+
Slot,
|
|
1462
|
+
__spreadProps(__spreadValues({
|
|
1463
|
+
ref,
|
|
1464
|
+
"aria-pressed": isToggle ? isSelected : void 0,
|
|
1465
|
+
"aria-label": ariaLabel,
|
|
1466
|
+
"aria-busy": loading || void 0,
|
|
1467
|
+
"aria-disabled": loading || restProps.disabled,
|
|
1468
|
+
onClick: handleClick,
|
|
1469
|
+
onPointerDown,
|
|
1470
|
+
onKeyDown: handleKeyDown,
|
|
1471
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
1472
|
+
borderRadius: `${animateRadius}px`
|
|
1473
|
+
}),
|
|
1474
|
+
className: containerClassName
|
|
1475
|
+
}, restProps), {
|
|
1476
|
+
children: React12.cloneElement(child, { children: innerContent })
|
|
1477
|
+
})
|
|
1478
|
+
) });
|
|
1479
|
+
}
|
|
1480
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
1360
1481
|
m.button,
|
|
1361
1482
|
__spreadProps(__spreadValues({
|
|
1362
1483
|
ref,
|
|
@@ -1372,67 +1493,9 @@ var IconButtonComponent = React12.forwardRef(
|
|
|
1372
1493
|
animate: { borderRadius: animateRadius },
|
|
1373
1494
|
whileTap: { borderRadius: pressedRadius },
|
|
1374
1495
|
transition: { borderRadius: SPRING_TRANSITION_FAST },
|
|
1375
|
-
className:
|
|
1376
|
-
baseIconButtonClasses,
|
|
1377
|
-
resolvedColorClass,
|
|
1378
|
-
outlineWidthClass,
|
|
1379
|
-
disabledBgClass,
|
|
1380
|
-
"overflow-hidden",
|
|
1381
|
-
SIZE_STYLES[size],
|
|
1382
|
-
loading && "pointer-events-none opacity-75 cursor-not-allowed",
|
|
1383
|
-
className
|
|
1384
|
-
)
|
|
1496
|
+
className: containerClassName
|
|
1385
1497
|
}, restProps), {
|
|
1386
|
-
children:
|
|
1387
|
-
needsTouchTarget && /* @__PURE__ */ jsx(TouchTarget, {}),
|
|
1388
|
-
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
1389
|
-
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: loading ? /* @__PURE__ */ jsx(
|
|
1390
|
-
m.span,
|
|
1391
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1392
|
-
transition: SPRING_TRANSITION,
|
|
1393
|
-
className: cn(
|
|
1394
|
-
"flex items-center justify-center shrink-0",
|
|
1395
|
-
iconSize != null ? void 0 : iconClass
|
|
1396
|
-
),
|
|
1397
|
-
style: isCustomSize ? { width: `${iconSize}px`, height: `${iconSize}px` } : void 0,
|
|
1398
|
-
children: loadingVariant === "loading-indicator" ? /* @__PURE__ */ jsx(
|
|
1399
|
-
LoadingIndicator,
|
|
1400
|
-
{
|
|
1401
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1402
|
-
color: "currentColor",
|
|
1403
|
-
"aria-label": "Loading"
|
|
1404
|
-
}
|
|
1405
|
-
) : /* @__PURE__ */ jsx(
|
|
1406
|
-
ProgressIndicator,
|
|
1407
|
-
{
|
|
1408
|
-
variant: "circular",
|
|
1409
|
-
size: typeof iconPx === "number" ? iconPx : defaultIconPx,
|
|
1410
|
-
color: "currentColor",
|
|
1411
|
-
trackColor: "transparent",
|
|
1412
|
-
"aria-label": "Loading"
|
|
1413
|
-
}
|
|
1414
|
-
)
|
|
1415
|
-
}),
|
|
1416
|
-
"loading"
|
|
1417
|
-
) : /* @__PURE__ */ jsx(
|
|
1418
|
-
m.span,
|
|
1419
|
-
__spreadProps(__spreadValues({}, ICON_SPAN_VARIANTS), {
|
|
1420
|
-
transition: SPRING_TRANSITION,
|
|
1421
|
-
"aria-hidden": "true",
|
|
1422
|
-
className: cn(
|
|
1423
|
-
"flex items-center justify-center shrink-0 [&_svg]:w-full [&_svg]:h-full [&_.md-icon]:text-[length:inherit]!",
|
|
1424
|
-
iconSize != null ? void 0 : iconClass
|
|
1425
|
-
),
|
|
1426
|
-
style: {
|
|
1427
|
-
fontSize: typeof iconPx === "number" ? `${iconPx}px` : iconPx,
|
|
1428
|
-
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
1429
|
-
height: isCustomSize ? `${iconSize}px` : void 0
|
|
1430
|
-
},
|
|
1431
|
-
children
|
|
1432
|
-
}),
|
|
1433
|
-
"content"
|
|
1434
|
-
) })
|
|
1435
|
-
]
|
|
1498
|
+
children: innerContent
|
|
1436
1499
|
})
|
|
1437
1500
|
) });
|
|
1438
1501
|
}
|