@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.
Files changed (54) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/buttons.d.mts +2 -2
  3. package/dist/buttons.d.ts +2 -2
  4. package/dist/buttons.js +678 -605
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +677 -604
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/core.js +86 -61
  9. package/dist/core.js.map +1 -1
  10. package/dist/core.mjs +86 -61
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/feedback.js +85 -61
  13. package/dist/feedback.js.map +1 -1
  14. package/dist/feedback.mjs +85 -61
  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 +70 -8
  19. package/dist/forms.js.map +1 -1
  20. package/dist/forms.mjs +70 -8
  21. package/dist/forms.mjs.map +1 -1
  22. package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-sSt6PPLg.d.mts} +6 -0
  23. package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-sSt6PPLg.d.ts} +6 -0
  24. package/dist/index.d.mts +4 -4
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.js +973 -496
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +967 -497
  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 +65 -8
  33. package/dist/layout.js.map +1 -1
  34. package/dist/layout.mjs +65 -8
  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 +403 -93
  39. package/dist/navigation.js.map +1 -1
  40. package/dist/navigation.mjs +397 -94
  41. package/dist/navigation.mjs.map +1 -1
  42. package/dist/overlays.js +214 -189
  43. package/dist/overlays.js.map +1 -1
  44. package/dist/overlays.mjs +176 -151
  45. package/dist/overlays.mjs.map +1 -1
  46. package/dist/pickers.js +222 -197
  47. package/dist/pickers.js.map +1 -1
  48. package/dist/pickers.mjs +189 -164
  49. package/dist/pickers.mjs.map +1 -1
  50. package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-BcPD_7uK.d.ts} +44 -6
  51. package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DtFJkTFr.d.mts} +44 -6
  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 +1 -1
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",
@@ -4247,6 +4269,7 @@ var ListItem = React18__namespace.memo(ListItemImpl);
4247
4269
  var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface", {
4248
4270
  variants: {
4249
4271
  variant: {
4272
+ // Short hyphenated
4250
4273
  "display-lg": "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
4251
4274
  "display-md": "text-[45px] leading-[52px] font-normal tracking-[0px]",
4252
4275
  "display-sm": "text-[36px] leading-[44px] font-normal tracking-[0px]",
@@ -4261,7 +4284,39 @@ var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface"
4261
4284
  "label-sm": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
4262
4285
  "body-lg": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
4263
4286
  "body-md": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
4264
- "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]"
4265
4320
  }
4266
4321
  },
4267
4322
  defaultVariants: {
@@ -4270,19 +4325,21 @@ var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface"
4270
4325
  });
4271
4326
  var Text = React18__namespace.forwardRef(
4272
4327
  (_a, ref) => {
4273
- 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"]);
4274
4329
  const defaultComponent = React18__namespace.useMemo(() => {
4275
- if ((variant == null ? void 0 : variant.startsWith("display")) || (variant == null ? void 0 : variant.startsWith("headline")))
4276
- return "h1";
4277
- 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";
4278
4333
  return "p";
4279
4334
  }, [variant]);
4280
4335
  const Tag = Component || defaultComponent;
4336
+ const customStyle = __spreadValues(__spreadValues(__spreadValues({}, style), color ? { color } : {}), weight ? { fontWeight: weight } : {});
4281
4337
  return /* @__PURE__ */ jsxRuntime.jsx(
4282
4338
  Tag,
4283
4339
  __spreadValues({
4284
4340
  ref,
4285
- className: cn(typographyVariants({ variant, className }))
4341
+ className: cn(typographyVariants({ variant, className })),
4342
+ style: customStyle
4286
4343
  }, props)
4287
4344
  );
4288
4345
  }