@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.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",
@@ -1374,6 +1396,35 @@ var BUTTON_COLOR_TOKENS = {
1374
1396
  default: "bg-transparent text-m3-primary",
1375
1397
  selected: "bg-transparent text-m3-primary",
1376
1398
  unselected: "bg-transparent text-m3-primary"
1399
+ },
1400
+ // ── MD3 Expressive accent variants ──────────────────────────────────────
1401
+ /**
1402
+ * High-chroma tertiary tone. Use for hero CTAs and expressive moments where
1403
+ * a distinct accent beyond primary is needed (e.g., hero chip, highlight fab).
1404
+ */
1405
+ tertiary: {
1406
+ default: "bg-m3-tertiary text-m3-on-tertiary",
1407
+ selected: "bg-m3-tertiary text-m3-on-tertiary",
1408
+ unselected: "bg-m3-tertiary-container text-m3-on-tertiary-container"
1409
+ },
1410
+ /**
1411
+ * Brand-stable primary fixed. Hue stays consistent across light and dark modes.
1412
+ * Ideal for badges, pill chips, and elements that must carry the brand color
1413
+ * regardless of the active theme.
1414
+ */
1415
+ "primary-fixed": {
1416
+ default: "bg-m3-primary-fixed text-m3-on-primary-fixed",
1417
+ selected: "bg-m3-primary-fixed text-m3-on-primary-fixed",
1418
+ unselected: "bg-m3-primary-fixed text-m3-on-primary-fixed-variant"
1419
+ },
1420
+ /**
1421
+ * Brand-stable tertiary fixed. Use for special-state indicators, achievement
1422
+ * badges, or accent pills that need a fixed tertiary hue across themes.
1423
+ */
1424
+ "tertiary-fixed": {
1425
+ default: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed",
1426
+ selected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed",
1427
+ unselected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed-variant"
1377
1428
  }
1378
1429
  };
1379
1430
  var MOTION_PROP_KEYS = [
@@ -4196,6 +4247,7 @@ var ListItem = React18.memo(ListItemImpl);
4196
4247
  var typographyVariants = cva("m-0 p-0 text-m3-on-surface", {
4197
4248
  variants: {
4198
4249
  variant: {
4250
+ // Short hyphenated
4199
4251
  "display-lg": "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
4200
4252
  "display-md": "text-[45px] leading-[52px] font-normal tracking-[0px]",
4201
4253
  "display-sm": "text-[36px] leading-[44px] font-normal tracking-[0px]",
@@ -4210,7 +4262,39 @@ var typographyVariants = cva("m-0 p-0 text-m3-on-surface", {
4210
4262
  "label-sm": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
4211
4263
  "body-lg": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
4212
4264
  "body-md": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
4213
- "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]"
4214
4298
  }
4215
4299
  },
4216
4300
  defaultVariants: {
@@ -4219,19 +4303,21 @@ var typographyVariants = cva("m-0 p-0 text-m3-on-surface", {
4219
4303
  });
4220
4304
  var Text = React18.forwardRef(
4221
4305
  (_a, ref) => {
4222
- 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"]);
4223
4307
  const defaultComponent = React18.useMemo(() => {
4224
- if ((variant == null ? void 0 : variant.startsWith("display")) || (variant == null ? void 0 : variant.startsWith("headline")))
4225
- return "h1";
4226
- if (variant == null ? void 0 : variant.startsWith("title")) return "h2";
4308
+ const v = variant ? String(variant).toLowerCase() : "";
4309
+ if (v.startsWith("display") || v.startsWith("headline")) return "h1";
4310
+ if (v.startsWith("title")) return "h2";
4227
4311
  return "p";
4228
4312
  }, [variant]);
4229
4313
  const Tag = Component || defaultComponent;
4314
+ const customStyle = __spreadValues(__spreadValues(__spreadValues({}, style), color ? { color } : {}), weight ? { fontWeight: weight } : {});
4230
4315
  return /* @__PURE__ */ jsx(
4231
4316
  Tag,
4232
4317
  __spreadValues({
4233
4318
  ref,
4234
- className: cn(typographyVariants({ variant, className }))
4319
+ className: cn(typographyVariants({ variant, className })),
4320
+ style: customStyle
4235
4321
  }, props)
4236
4322
  );
4237
4323
  }