@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.
- package/CHANGELOG.md +6 -0
- package/dist/buttons.d.mts +2 -2
- package/dist/buttons.d.ts +2 -2
- package/dist/buttons.js +678 -605
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +677 -604
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +86 -61
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +86 -61
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +85 -61
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +85 -61
- 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 +70 -8
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +70 -8
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-sSt6PPLg.d.mts} +6 -0
- package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-sSt6PPLg.d.ts} +6 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +973 -496
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +967 -497
- 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 +65 -8
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +65 -8
- 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 +403 -93
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +397 -94
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +214 -189
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +176 -151
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +222 -197
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +189 -164
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-BcPD_7uK.d.ts} +44 -6
- package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DtFJkTFr.d.mts} +44 -6
- 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 +1 -1
package/dist/layout.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
2
3
|
import { cva } from 'class-variance-authority';
|
|
3
4
|
import { m, LazyMotion, domMax, useMotionValue, animate, useAnimationFrame, AnimatePresence, useReducedMotion } from 'motion/react';
|
|
4
5
|
import * as React18 from 'react';
|
|
@@ -6,7 +7,6 @@ import { createContext, useState, useCallback, useMemo, useEffect, useContext, c
|
|
|
6
7
|
import { clsx } from 'clsx';
|
|
7
8
|
import { twMerge } from 'tailwind-merge';
|
|
8
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
10
10
|
import { cornerRadius } from '@bug-on/m3-tokens';
|
|
11
11
|
import * as RadixScrollArea from '@radix-ui/react-scroll-area';
|
|
12
12
|
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
@@ -188,6 +188,7 @@ var CardImpl = React18.forwardRef(
|
|
|
188
188
|
target,
|
|
189
189
|
rel: relProp,
|
|
190
190
|
onClick,
|
|
191
|
+
asChild = false,
|
|
191
192
|
children
|
|
192
193
|
} = _b, props = __objRest(_b, [
|
|
193
194
|
"className",
|
|
@@ -198,10 +199,11 @@ var CardImpl = React18.forwardRef(
|
|
|
198
199
|
"target",
|
|
199
200
|
"rel",
|
|
200
201
|
"onClick",
|
|
202
|
+
"asChild",
|
|
201
203
|
"children"
|
|
202
204
|
]);
|
|
203
205
|
const safeVariant = variant;
|
|
204
|
-
const isInteractive = !!onClick || !!href || interactive;
|
|
206
|
+
const isInteractive = !!onClick || !!href || interactive || asChild;
|
|
205
207
|
const elevationProps = useCardElevation(safeVariant, disabled);
|
|
206
208
|
const { ripples, onPointerDown, removeRipple } = useRippleState();
|
|
207
209
|
const baseClass = cn(
|
|
@@ -222,6 +224,26 @@ var CardImpl = React18.forwardRef(
|
|
|
222
224
|
// Outlined interactive card: change border color to m3-outline on focus/press/hover
|
|
223
225
|
variant === "outlined" && "hover:border-m3-outline focus-visible:border-m3-outline active:border-m3-outline"
|
|
224
226
|
);
|
|
227
|
+
if (asChild) {
|
|
228
|
+
const child = React18.Children.only(children);
|
|
229
|
+
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
230
|
+
/* @__PURE__ */ jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
231
|
+
child.props.children
|
|
232
|
+
] });
|
|
233
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
234
|
+
Slot,
|
|
235
|
+
__spreadProps(__spreadValues({
|
|
236
|
+
ref,
|
|
237
|
+
className: cn(baseClass, interactiveClass),
|
|
238
|
+
"aria-disabled": disabled ? true : void 0,
|
|
239
|
+
tabIndex: disabled ? -1 : 0,
|
|
240
|
+
onPointerDown,
|
|
241
|
+
onClick
|
|
242
|
+
}, props), {
|
|
243
|
+
children: React18.cloneElement(child, { children: innerContent })
|
|
244
|
+
})
|
|
245
|
+
) });
|
|
246
|
+
}
|
|
225
247
|
if (!isInteractive) {
|
|
226
248
|
return /* @__PURE__ */ jsx(
|
|
227
249
|
"div",
|
|
@@ -4225,6 +4247,7 @@ var ListItem = React18.memo(ListItemImpl);
|
|
|
4225
4247
|
var typographyVariants = cva("m-0 p-0 text-m3-on-surface", {
|
|
4226
4248
|
variants: {
|
|
4227
4249
|
variant: {
|
|
4250
|
+
// Short hyphenated
|
|
4228
4251
|
"display-lg": "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
|
|
4229
4252
|
"display-md": "text-[45px] leading-[52px] font-normal tracking-[0px]",
|
|
4230
4253
|
"display-sm": "text-[36px] leading-[44px] font-normal tracking-[0px]",
|
|
@@ -4239,7 +4262,39 @@ var typographyVariants = cva("m-0 p-0 text-m3-on-surface", {
|
|
|
4239
4262
|
"label-sm": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
|
|
4240
4263
|
"body-lg": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
|
|
4241
4264
|
"body-md": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
|
|
4242
|
-
"body-sm": "text-[12px] leading-[16px] font-normal tracking-[0.4px]"
|
|
4265
|
+
"body-sm": "text-[12px] leading-[16px] font-normal tracking-[0.4px]",
|
|
4266
|
+
// Full hyphenated aliases
|
|
4267
|
+
"display-large": "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
|
|
4268
|
+
"display-medium": "text-[45px] leading-[52px] font-normal tracking-[0px]",
|
|
4269
|
+
"display-small": "text-[36px] leading-[44px] font-normal tracking-[0px]",
|
|
4270
|
+
"headline-large": "text-[32px] leading-[40px] font-normal tracking-[0px]",
|
|
4271
|
+
"headline-medium": "text-[28px] leading-[36px] font-normal tracking-[0px]",
|
|
4272
|
+
"headline-small": "text-[24px] leading-[32px] font-normal tracking-[0px]",
|
|
4273
|
+
"title-large": "text-[22px] leading-[28px] font-normal tracking-[0px]",
|
|
4274
|
+
"title-medium": "text-[16px] leading-[24px] font-medium tracking-[0.15px]",
|
|
4275
|
+
"title-small": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
|
|
4276
|
+
"label-large": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
|
|
4277
|
+
"label-medium": "text-[12px] leading-[16px] font-medium tracking-[0.5px]",
|
|
4278
|
+
"label-small": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
|
|
4279
|
+
"body-large": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
|
|
4280
|
+
"body-medium": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
|
|
4281
|
+
"body-small": "text-[12px] leading-[16px] font-normal tracking-[0.4px]",
|
|
4282
|
+
// CamelCase aliases
|
|
4283
|
+
displayLarge: "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
|
|
4284
|
+
displayMedium: "text-[45px] leading-[52px] font-normal tracking-[0px]",
|
|
4285
|
+
displaySmall: "text-[36px] leading-[44px] font-normal tracking-[0px]",
|
|
4286
|
+
headlineLarge: "text-[32px] leading-[40px] font-normal tracking-[0px]",
|
|
4287
|
+
headlineMedium: "text-[28px] leading-[36px] font-normal tracking-[0px]",
|
|
4288
|
+
headlineSmall: "text-[24px] leading-[32px] font-normal tracking-[0px]",
|
|
4289
|
+
titleLarge: "text-[22px] leading-[28px] font-normal tracking-[0px]",
|
|
4290
|
+
titleMedium: "text-[16px] leading-[24px] font-medium tracking-[0.15px]",
|
|
4291
|
+
titleSmall: "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
|
|
4292
|
+
labelLarge: "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
|
|
4293
|
+
labelMedium: "text-[12px] leading-[16px] font-medium tracking-[0.5px]",
|
|
4294
|
+
labelSmall: "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
|
|
4295
|
+
bodyLarge: "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
|
|
4296
|
+
bodyMedium: "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
|
|
4297
|
+
bodySmall: "text-[12px] leading-[16px] font-normal tracking-[0.4px]"
|
|
4243
4298
|
}
|
|
4244
4299
|
},
|
|
4245
4300
|
defaultVariants: {
|
|
@@ -4248,19 +4303,21 @@ var typographyVariants = cva("m-0 p-0 text-m3-on-surface", {
|
|
|
4248
4303
|
});
|
|
4249
4304
|
var Text = React18.forwardRef(
|
|
4250
4305
|
(_a, ref) => {
|
|
4251
|
-
var _b = _a, { className, variant, as: Component } = _b, props = __objRest(_b, ["className", "variant", "as"]);
|
|
4306
|
+
var _b = _a, { className, variant, as: Component, color, weight, style } = _b, props = __objRest(_b, ["className", "variant", "as", "color", "weight", "style"]);
|
|
4252
4307
|
const defaultComponent = React18.useMemo(() => {
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
if (
|
|
4308
|
+
const v = variant ? String(variant).toLowerCase() : "";
|
|
4309
|
+
if (v.startsWith("display") || v.startsWith("headline")) return "h1";
|
|
4310
|
+
if (v.startsWith("title")) return "h2";
|
|
4256
4311
|
return "p";
|
|
4257
4312
|
}, [variant]);
|
|
4258
4313
|
const Tag = Component || defaultComponent;
|
|
4314
|
+
const customStyle = __spreadValues(__spreadValues(__spreadValues({}, style), color ? { color } : {}), weight ? { fontWeight: weight } : {});
|
|
4259
4315
|
return /* @__PURE__ */ jsx(
|
|
4260
4316
|
Tag,
|
|
4261
4317
|
__spreadValues({
|
|
4262
4318
|
ref,
|
|
4263
|
-
className: cn(typographyVariants({ variant, className }))
|
|
4319
|
+
className: cn(typographyVariants({ variant, className })),
|
|
4320
|
+
style: customStyle
|
|
4264
4321
|
}, props)
|
|
4265
4322
|
);
|
|
4266
4323
|
}
|