@bug-on/m3-expressive 1.1.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 (61) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/buttons.d.mts +3 -3
  3. package/dist/buttons.d.ts +3 -3
  4. package/dist/buttons.js +708 -606
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +707 -605
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/core-Bc5Wj_pc.d.ts +497 -0
  9. package/dist/core-D4048_K5.d.mts +497 -0
  10. package/dist/core.d.mts +6 -422
  11. package/dist/core.d.ts +6 -422
  12. package/dist/core.js +223 -129
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.mjs +224 -130
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/feedback.js +85 -61
  17. package/dist/feedback.js.map +1 -1
  18. package/dist/feedback.mjs +85 -61
  19. package/dist/feedback.mjs.map +1 -1
  20. package/dist/forms.d.mts +2 -2
  21. package/dist/forms.d.ts +2 -2
  22. package/dist/forms.js +70 -8
  23. package/dist/forms.js.map +1 -1
  24. package/dist/forms.mjs +70 -8
  25. package/dist/forms.mjs.map +1 -1
  26. package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-sSt6PPLg.d.mts} +6 -0
  27. package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-sSt6PPLg.d.ts} +6 -0
  28. package/dist/index.css +6 -1
  29. package/dist/index.d.mts +68 -6
  30. package/dist/index.d.ts +68 -6
  31. package/dist/index.js +1177 -580
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +1172 -583
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/layout.d.mts +18 -1
  36. package/dist/layout.d.ts +18 -1
  37. package/dist/layout.js +94 -8
  38. package/dist/layout.js.map +1 -1
  39. package/dist/layout.mjs +94 -8
  40. package/dist/layout.mjs.map +1 -1
  41. package/dist/{md3-DFhj-NZj.d.mts → md3-Dty-Qcad.d.mts} +7 -1
  42. package/dist/{md3-DFhj-NZj.d.ts → md3-Dty-Qcad.d.ts} +7 -1
  43. package/dist/navigation.d.mts +134 -9
  44. package/dist/navigation.d.ts +134 -9
  45. package/dist/navigation.js +403 -93
  46. package/dist/navigation.js.map +1 -1
  47. package/dist/navigation.mjs +397 -94
  48. package/dist/navigation.mjs.map +1 -1
  49. package/dist/overlays.js +214 -189
  50. package/dist/overlays.js.map +1 -1
  51. package/dist/overlays.mjs +176 -151
  52. package/dist/overlays.mjs.map +1 -1
  53. package/dist/pickers.js +222 -197
  54. package/dist/pickers.js.map +1 -1
  55. package/dist/pickers.mjs +189 -164
  56. package/dist/pickers.mjs.map +1 -1
  57. package/dist/{split-button-trailing-uncheckable-BRPuTqi1.d.mts → split-button-trailing-uncheckable-BcPD_7uK.d.ts} +73 -7
  58. package/dist/{split-button-trailing-uncheckable-CjOFCoyW.d.ts → split-button-trailing-uncheckable-DtFJkTFr.d.mts} +73 -7
  59. package/dist/{text-field-eAIpz9z1.d.mts → text-field-T4Rg-9Bw.d.mts} +7 -0
  60. package/dist/{text-field-eAIpz9z1.d.ts → text-field-T4Rg-9Bw.d.ts} +7 -0
  61. package/package.json +4 -4
package/dist/layout.d.mts CHANGED
@@ -30,6 +30,12 @@ interface CardProps extends MotionDivProps, VariantProps<typeof cardVariants> {
30
30
  /** rel for `<a>` element (automatically adds `noreferrer` when `target="_blank"`). */
31
31
  rel?: string;
32
32
  children?: React.ReactNode;
33
+ /**
34
+ * Change the component to the underlying child element and merge props/behavior.
35
+ * Useful when wrapping in Next.js `<Link>` or custom anchor tags.
36
+ * @default false
37
+ */
38
+ asChild?: boolean;
33
39
  }
34
40
  declare const Card: React.NamedExoticComponent<Omit<CardProps, "ref"> & React.RefAttributes<HTMLElement>>;
35
41
 
@@ -373,10 +379,21 @@ declare function shouldTopAlign(height: number): boolean;
373
379
  declare function getExpressiveShape(state: "resting" | "hovered" | "focused" | "pressed" | "selected" | "dragged" | "disabled"): number;
374
380
 
375
381
  declare const typographyVariants: (props?: ({
376
- variant?: "display-lg" | "display-md" | "display-sm" | "headline-lg" | "headline-md" | "headline-sm" | "title-lg" | "title-md" | "title-sm" | "label-lg" | "label-md" | "label-sm" | "body-lg" | "body-md" | "body-sm" | null | undefined;
382
+ variant?: "display-lg" | "display-md" | "display-sm" | "headline-lg" | "headline-md" | "headline-sm" | "title-lg" | "title-md" | "title-sm" | "label-lg" | "label-md" | "label-sm" | "body-lg" | "body-md" | "body-sm" | "display-large" | "display-medium" | "display-small" | "headline-large" | "headline-medium" | "headline-small" | "title-large" | "title-medium" | "title-small" | "label-large" | "label-medium" | "label-small" | "body-large" | "body-medium" | "body-small" | "displayLarge" | "displayMedium" | "displaySmall" | "headlineLarge" | "headlineMedium" | "headlineSmall" | "titleLarge" | "titleMedium" | "titleSmall" | "labelLarge" | "labelMedium" | "labelSmall" | "bodyLarge" | "bodyMedium" | "bodySmall" | null | undefined;
377
383
  } & class_variance_authority_types.ClassProp) | undefined) => string;
378
384
  interface TextProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof typographyVariants> {
385
+ /**
386
+ * Custom HTML element tag override.
387
+ */
379
388
  as?: React.ElementType;
389
+ /**
390
+ * Text color override (CSS color value or Tailwind color class).
391
+ */
392
+ color?: string;
393
+ /**
394
+ * Font weight override.
395
+ */
396
+ weight?: string | number;
380
397
  }
381
398
  declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLElement>>;
382
399
 
package/dist/layout.d.ts CHANGED
@@ -30,6 +30,12 @@ interface CardProps extends MotionDivProps, VariantProps<typeof cardVariants> {
30
30
  /** rel for `<a>` element (automatically adds `noreferrer` when `target="_blank"`). */
31
31
  rel?: string;
32
32
  children?: React.ReactNode;
33
+ /**
34
+ * Change the component to the underlying child element and merge props/behavior.
35
+ * Useful when wrapping in Next.js `<Link>` or custom anchor tags.
36
+ * @default false
37
+ */
38
+ asChild?: boolean;
33
39
  }
34
40
  declare const Card: React.NamedExoticComponent<Omit<CardProps, "ref"> & React.RefAttributes<HTMLElement>>;
35
41
 
@@ -373,10 +379,21 @@ declare function shouldTopAlign(height: number): boolean;
373
379
  declare function getExpressiveShape(state: "resting" | "hovered" | "focused" | "pressed" | "selected" | "dragged" | "disabled"): number;
374
380
 
375
381
  declare const typographyVariants: (props?: ({
376
- variant?: "display-lg" | "display-md" | "display-sm" | "headline-lg" | "headline-md" | "headline-sm" | "title-lg" | "title-md" | "title-sm" | "label-lg" | "label-md" | "label-sm" | "body-lg" | "body-md" | "body-sm" | null | undefined;
382
+ variant?: "display-lg" | "display-md" | "display-sm" | "headline-lg" | "headline-md" | "headline-sm" | "title-lg" | "title-md" | "title-sm" | "label-lg" | "label-md" | "label-sm" | "body-lg" | "body-md" | "body-sm" | "display-large" | "display-medium" | "display-small" | "headline-large" | "headline-medium" | "headline-small" | "title-large" | "title-medium" | "title-small" | "label-large" | "label-medium" | "label-small" | "body-large" | "body-medium" | "body-small" | "displayLarge" | "displayMedium" | "displaySmall" | "headlineLarge" | "headlineMedium" | "headlineSmall" | "titleLarge" | "titleMedium" | "titleSmall" | "labelLarge" | "labelMedium" | "labelSmall" | "bodyLarge" | "bodyMedium" | "bodySmall" | null | undefined;
377
383
  } & class_variance_authority_types.ClassProp) | undefined) => string;
378
384
  interface TextProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof typographyVariants> {
385
+ /**
386
+ * Custom HTML element tag override.
387
+ */
379
388
  as?: React.ElementType;
389
+ /**
390
+ * Text color override (CSS color value or Tailwind color class).
391
+ */
392
+ color?: string;
393
+ /**
394
+ * Font weight override.
395
+ */
396
+ weight?: string | number;
380
397
  }
381
398
  declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLElement>>;
382
399
 
package/dist/layout.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
+ var reactSlot = require('@radix-ui/react-slot');
4
5
  var classVarianceAuthority = require('class-variance-authority');
5
6
  var react = require('motion/react');
6
7
  var React18 = require('react');
7
8
  var clsx = require('clsx');
8
9
  var tailwindMerge = require('tailwind-merge');
9
10
  var jsxRuntime = require('react/jsx-runtime');
10
- var reactSlot = require('@radix-ui/react-slot');
11
11
  var m3Tokens = require('@bug-on/m3-tokens');
12
12
  var RadixScrollArea = require('@radix-ui/react-scroll-area');
13
13
  var core = require('@dnd-kit/core');
@@ -210,6 +210,7 @@ var CardImpl = React18__namespace.forwardRef(
210
210
  target,
211
211
  rel: relProp,
212
212
  onClick,
213
+ asChild = false,
213
214
  children
214
215
  } = _b, props = __objRest(_b, [
215
216
  "className",
@@ -220,10 +221,11 @@ var CardImpl = React18__namespace.forwardRef(
220
221
  "target",
221
222
  "rel",
222
223
  "onClick",
224
+ "asChild",
223
225
  "children"
224
226
  ]);
225
227
  const safeVariant = variant;
226
- const isInteractive = !!onClick || !!href || interactive;
228
+ const isInteractive = !!onClick || !!href || interactive || asChild;
227
229
  const elevationProps = useCardElevation(safeVariant, disabled);
228
230
  const { ripples, onPointerDown, removeRipple } = useRippleState();
229
231
  const baseClass = cn(
@@ -244,6 +246,26 @@ var CardImpl = React18__namespace.forwardRef(
244
246
  // Outlined interactive card: change border color to m3-outline on focus/press/hover
245
247
  variant === "outlined" && "hover:border-m3-outline focus-visible:border-m3-outline active:border-m3-outline"
246
248
  );
249
+ if (asChild) {
250
+ const child = React18__namespace.Children.only(children);
251
+ const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
252
+ /* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
253
+ child.props.children
254
+ ] });
255
+ return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
256
+ reactSlot.Slot,
257
+ __spreadProps(__spreadValues({
258
+ ref,
259
+ className: cn(baseClass, interactiveClass),
260
+ "aria-disabled": disabled ? true : void 0,
261
+ tabIndex: disabled ? -1 : 0,
262
+ onPointerDown,
263
+ onClick
264
+ }, props), {
265
+ children: React18__namespace.cloneElement(child, { children: innerContent })
266
+ })
267
+ ) });
268
+ }
247
269
  if (!isInteractive) {
248
270
  return /* @__PURE__ */ jsxRuntime.jsx(
249
271
  "div",
@@ -1396,6 +1418,35 @@ var BUTTON_COLOR_TOKENS = {
1396
1418
  default: "bg-transparent text-m3-primary",
1397
1419
  selected: "bg-transparent text-m3-primary",
1398
1420
  unselected: "bg-transparent text-m3-primary"
1421
+ },
1422
+ // ── MD3 Expressive accent variants ──────────────────────────────────────
1423
+ /**
1424
+ * High-chroma tertiary tone. Use for hero CTAs and expressive moments where
1425
+ * a distinct accent beyond primary is needed (e.g., hero chip, highlight fab).
1426
+ */
1427
+ tertiary: {
1428
+ default: "bg-m3-tertiary text-m3-on-tertiary",
1429
+ selected: "bg-m3-tertiary text-m3-on-tertiary",
1430
+ unselected: "bg-m3-tertiary-container text-m3-on-tertiary-container"
1431
+ },
1432
+ /**
1433
+ * Brand-stable primary fixed. Hue stays consistent across light and dark modes.
1434
+ * Ideal for badges, pill chips, and elements that must carry the brand color
1435
+ * regardless of the active theme.
1436
+ */
1437
+ "primary-fixed": {
1438
+ default: "bg-m3-primary-fixed text-m3-on-primary-fixed",
1439
+ selected: "bg-m3-primary-fixed text-m3-on-primary-fixed",
1440
+ unselected: "bg-m3-primary-fixed text-m3-on-primary-fixed-variant"
1441
+ },
1442
+ /**
1443
+ * Brand-stable tertiary fixed. Use for special-state indicators, achievement
1444
+ * badges, or accent pills that need a fixed tertiary hue across themes.
1445
+ */
1446
+ "tertiary-fixed": {
1447
+ default: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed",
1448
+ selected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed",
1449
+ unselected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed-variant"
1399
1450
  }
1400
1451
  };
1401
1452
  var MOTION_PROP_KEYS = [
@@ -4218,6 +4269,7 @@ var ListItem = React18__namespace.memo(ListItemImpl);
4218
4269
  var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface", {
4219
4270
  variants: {
4220
4271
  variant: {
4272
+ // Short hyphenated
4221
4273
  "display-lg": "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
4222
4274
  "display-md": "text-[45px] leading-[52px] font-normal tracking-[0px]",
4223
4275
  "display-sm": "text-[36px] leading-[44px] font-normal tracking-[0px]",
@@ -4232,7 +4284,39 @@ var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface"
4232
4284
  "label-sm": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
4233
4285
  "body-lg": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
4234
4286
  "body-md": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
4235
- "body-sm": "text-[12px] leading-[16px] font-normal tracking-[0.4px]"
4287
+ "body-sm": "text-[12px] leading-[16px] font-normal tracking-[0.4px]",
4288
+ // Full hyphenated aliases
4289
+ "display-large": "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
4290
+ "display-medium": "text-[45px] leading-[52px] font-normal tracking-[0px]",
4291
+ "display-small": "text-[36px] leading-[44px] font-normal tracking-[0px]",
4292
+ "headline-large": "text-[32px] leading-[40px] font-normal tracking-[0px]",
4293
+ "headline-medium": "text-[28px] leading-[36px] font-normal tracking-[0px]",
4294
+ "headline-small": "text-[24px] leading-[32px] font-normal tracking-[0px]",
4295
+ "title-large": "text-[22px] leading-[28px] font-normal tracking-[0px]",
4296
+ "title-medium": "text-[16px] leading-[24px] font-medium tracking-[0.15px]",
4297
+ "title-small": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
4298
+ "label-large": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
4299
+ "label-medium": "text-[12px] leading-[16px] font-medium tracking-[0.5px]",
4300
+ "label-small": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
4301
+ "body-large": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
4302
+ "body-medium": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
4303
+ "body-small": "text-[12px] leading-[16px] font-normal tracking-[0.4px]",
4304
+ // CamelCase aliases
4305
+ displayLarge: "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
4306
+ displayMedium: "text-[45px] leading-[52px] font-normal tracking-[0px]",
4307
+ displaySmall: "text-[36px] leading-[44px] font-normal tracking-[0px]",
4308
+ headlineLarge: "text-[32px] leading-[40px] font-normal tracking-[0px]",
4309
+ headlineMedium: "text-[28px] leading-[36px] font-normal tracking-[0px]",
4310
+ headlineSmall: "text-[24px] leading-[32px] font-normal tracking-[0px]",
4311
+ titleLarge: "text-[22px] leading-[28px] font-normal tracking-[0px]",
4312
+ titleMedium: "text-[16px] leading-[24px] font-medium tracking-[0.15px]",
4313
+ titleSmall: "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
4314
+ labelLarge: "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
4315
+ labelMedium: "text-[12px] leading-[16px] font-medium tracking-[0.5px]",
4316
+ labelSmall: "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
4317
+ bodyLarge: "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
4318
+ bodyMedium: "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
4319
+ bodySmall: "text-[12px] leading-[16px] font-normal tracking-[0.4px]"
4236
4320
  }
4237
4321
  },
4238
4322
  defaultVariants: {
@@ -4241,19 +4325,21 @@ var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface"
4241
4325
  });
4242
4326
  var Text = React18__namespace.forwardRef(
4243
4327
  (_a, ref) => {
4244
- var _b = _a, { className, variant, as: Component } = _b, props = __objRest(_b, ["className", "variant", "as"]);
4328
+ var _b = _a, { className, variant, as: Component, color, weight, style } = _b, props = __objRest(_b, ["className", "variant", "as", "color", "weight", "style"]);
4245
4329
  const defaultComponent = React18__namespace.useMemo(() => {
4246
- if ((variant == null ? void 0 : variant.startsWith("display")) || (variant == null ? void 0 : variant.startsWith("headline")))
4247
- return "h1";
4248
- if (variant == null ? void 0 : variant.startsWith("title")) return "h2";
4330
+ const v = variant ? String(variant).toLowerCase() : "";
4331
+ if (v.startsWith("display") || v.startsWith("headline")) return "h1";
4332
+ if (v.startsWith("title")) return "h2";
4249
4333
  return "p";
4250
4334
  }, [variant]);
4251
4335
  const Tag = Component || defaultComponent;
4336
+ const customStyle = __spreadValues(__spreadValues(__spreadValues({}, style), color ? { color } : {}), weight ? { fontWeight: weight } : {});
4252
4337
  return /* @__PURE__ */ jsxRuntime.jsx(
4253
4338
  Tag,
4254
4339
  __spreadValues({
4255
4340
  ref,
4256
- className: cn(typographyVariants({ variant, className }))
4341
+ className: cn(typographyVariants({ variant, className })),
4342
+ style: customStyle
4257
4343
  }, props)
4258
4344
  );
4259
4345
  }