@bug-on/m3-expressive 1.3.4 → 1.3.6

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 (76) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +31 -7
  3. package/dist/assets/material-symbols-cdn.css +17 -23
  4. package/dist/buttons.js +129 -35
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +129 -35
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/{core-COvZHQ_k.d.ts → core-Cckt8qEm.d.ts} +10 -4
  9. package/dist/{core-CRkixy1y.d.mts → core-DDfG4pym.d.mts} +10 -4
  10. package/dist/core.d.mts +2 -2
  11. package/dist/core.d.ts +2 -2
  12. package/dist/core.js +6 -5
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.mjs +6 -5
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/fading-blur-mask--uZbBKLj.d.mts +77 -0
  17. package/dist/fading-blur-mask--uZbBKLj.d.ts +77 -0
  18. package/dist/feedback.js +1 -1
  19. package/dist/feedback.js.map +1 -1
  20. package/dist/feedback.mjs +1 -1
  21. package/dist/feedback.mjs.map +1 -1
  22. package/dist/forms.d.mts +2 -2
  23. package/dist/forms.d.ts +2 -2
  24. package/dist/forms.js +17 -7
  25. package/dist/forms.js.map +1 -1
  26. package/dist/forms.mjs +17 -7
  27. package/dist/forms.mjs.map +1 -1
  28. package/dist/index.d.mts +9 -8
  29. package/dist/index.d.ts +9 -8
  30. package/dist/index.js +988 -309
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +984 -310
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/layout.d.mts +5 -3
  35. package/dist/layout.d.ts +5 -3
  36. package/dist/layout.js +61 -6
  37. package/dist/layout.js.map +1 -1
  38. package/dist/layout.mjs +61 -7
  39. package/dist/layout.mjs.map +1 -1
  40. package/dist/material-symbols-cdn.css +17 -23
  41. package/dist/{md3-expressive-shapes-CPcfl_Hf.d.mts → md3-expressive-shapes-wk_98LJh.d.mts} +20 -1
  42. package/dist/{md3-expressive-shapes-CPcfl_Hf.d.ts → md3-expressive-shapes-wk_98LJh.d.ts} +20 -1
  43. package/dist/navigation.d.mts +26 -84
  44. package/dist/navigation.d.ts +26 -84
  45. package/dist/navigation.js +95 -29
  46. package/dist/navigation.js.map +1 -1
  47. package/dist/navigation.mjs +95 -29
  48. package/dist/navigation.mjs.map +1 -1
  49. package/dist/overlays.d.mts +4 -2
  50. package/dist/overlays.d.ts +4 -2
  51. package/dist/overlays.js +85 -44
  52. package/dist/overlays.js.map +1 -1
  53. package/dist/overlays.mjs +85 -44
  54. package/dist/overlays.mjs.map +1 -1
  55. package/dist/pickers.d.mts +12 -0
  56. package/dist/pickers.d.ts +12 -0
  57. package/dist/pickers.js +186 -120
  58. package/dist/pickers.js.map +1 -1
  59. package/dist/pickers.mjs +186 -120
  60. package/dist/pickers.mjs.map +1 -1
  61. package/dist/shapes.d.mts +141 -15
  62. package/dist/shapes.d.ts +141 -15
  63. package/dist/shapes.js +618 -126
  64. package/dist/shapes.js.map +1 -1
  65. package/dist/shapes.mjs +614 -127
  66. package/dist/shapes.mjs.map +1 -1
  67. package/dist/{side-sheet-modal-64FGhDxL.d.mts → side-sheet-modal-BycxrabB.d.mts} +70 -0
  68. package/dist/{side-sheet-modal-Bd5Qqvp9.d.ts → side-sheet-modal-Cw4vemKx.d.ts} +70 -0
  69. package/dist/{text-field-4OlT9o8s.d.mts → text-field-B1fLh5Sh.d.mts} +22 -3
  70. package/dist/{text-field-DARNdj14.d.ts → text-field-C0VQLp8Y.d.ts} +22 -3
  71. package/dist/{typography-339RV6v7.d.mts → typography-CKTjvlZ4.d.mts} +25 -0
  72. package/dist/{typography-339RV6v7.d.ts → typography-CKTjvlZ4.d.ts} +25 -0
  73. package/dist/typography.css +1 -1
  74. package/llms-full.txt +24 -13
  75. package/llms.txt +11 -6
  76. package/package.json +3 -3
@@ -52,7 +52,7 @@ function getMaskGradient(direction) {
52
52
  case "bottom":
53
53
  return "linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 45%, rgba(0, 0, 0, 0.7) 75%, rgba(0, 0, 0, 0) 100%)";
54
54
  case "both":
55
- return "linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 20%, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 1) 60%, rgba(0, 0, 0, 0.7) 80%, rgba(0, 0, 0, 0) 100%)";
55
+ return "linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.7) 15%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.7) 85%, rgba(0, 0, 0, 1) 100%)";
56
56
  default:
57
57
  return "linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 45%, rgba(0, 0, 0, 0.7) 75%, rgba(0, 0, 0, 0) 100%)";
58
58
  }
@@ -69,11 +69,16 @@ function FadingBlurMask({
69
69
  const shouldReduceMotion = useReducedMotion();
70
70
  const activeBlur = shouldReduceMotion ? 0 : blurIntensity;
71
71
  const maskGradient = getMaskGradient(direction);
72
+ const isFullHeight = direction === "both" || blurHeight === "100%";
73
+ const computedHeight = isFullHeight ? "100%" : typeof blurHeight === "number" ? `${blurHeight}px` : blurHeight;
72
74
  const maskStyle = __spreadValues({
73
75
  position: "absolute",
74
- inset: 0,
76
+ top: direction === "bottom" && !isFullHeight ? "auto" : 0,
77
+ bottom: direction === "top" && !isFullHeight ? "auto" : 0,
78
+ left: 0,
79
+ right: 0,
75
80
  pointerEvents: "none",
76
- height: typeof blurHeight === "number" ? `${blurHeight}px` : blurHeight,
81
+ height: computedHeight,
77
82
  backdropFilter: activeBlur > 0 ? `blur(${activeBlur}px)` : void 0,
78
83
  WebkitBackdropFilter: activeBlur > 0 ? `blur(${activeBlur}px)` : void 0,
79
84
  maskImage: maskGradient,
@@ -85,7 +90,7 @@ function FadingBlurMask({
85
90
  {
86
91
  "aria-hidden": "true",
87
92
  className: cn(
88
- "absolute inset-0 pointer-events-none z-0 rounded-[inherit]",
93
+ "absolute pointer-events-none z-10 rounded-[inherit]",
89
94
  className
90
95
  ),
91
96
  style: maskStyle,
@@ -1133,7 +1138,7 @@ var IconComponent = React39.forwardRef(
1133
1138
  (_a, ref) => {
1134
1139
  var _b = _a, {
1135
1140
  name,
1136
- variant = "outlined",
1141
+ variant = "rounded",
1137
1142
  fill = 0,
1138
1143
  weight = 400,
1139
1144
  grade = 0,
@@ -2942,6 +2947,13 @@ function transformFeature(feature, fn) {
2942
2947
  }
2943
2948
  return edgeFeature(cubics);
2944
2949
  }
2950
+ function reverseFeature(feature) {
2951
+ const cubics = feature.cubics.slice().reverse().map((c) => c.reverse());
2952
+ if (feature.type === "corner") {
2953
+ return cornerFeature(cubics, feature.convex);
2954
+ }
2955
+ return edgeFeature(cubics);
2956
+ }
2945
2957
 
2946
2958
  // src/shapes/math/corner-rounding.ts
2947
2959
  var UNROUNDED = Object.freeze({
@@ -2974,6 +2986,10 @@ function convex(prevX, prevY, currX, currY, nextX, nextY) {
2974
2986
  const v2y = nextY - currY;
2975
2987
  return v1x * v2y - v1y * v2x > 0;
2976
2988
  }
2989
+ function formatCoordinate(v) {
2990
+ const rounded = Math.round(v * 1e4) / 1e4;
2991
+ return (rounded === 0 ? 0 : rounded).toString();
2992
+ }
2977
2993
 
2978
2994
  // src/shapes/math/point.ts
2979
2995
  function point(x, y) {
@@ -3026,9 +3042,16 @@ var Cubic = class _Cubic {
3026
3042
  */
3027
3043
  pointOnCurve(t) {
3028
3044
  const u = 1 - t;
3045
+ const uu = u * u;
3046
+ const tt = t * t;
3047
+ const uuu = uu * u;
3048
+ const ttt = tt * t;
3049
+ const c0 = 3 * t * uu;
3050
+ const c1 = 3 * tt * u;
3051
+ const p = this.points;
3029
3052
  return point(
3030
- this.anchor0X * (u * u * u) + this.control0X * (3 * t * u * u) + this.control1X * (3 * t * t * u) + this.anchor1X * (t * t * t),
3031
- this.anchor0Y * (u * u * u) + this.control0Y * (3 * t * u * u) + this.control1Y * (3 * t * t * u) + this.anchor1Y * (t * t * t)
3053
+ p[0] * uuu + p[2] * c0 + p[4] * c1 + p[6] * ttt,
3054
+ p[1] * uuu + p[3] * c0 + p[5] * c1 + p[7] * ttt
3032
3055
  );
3033
3056
  }
3034
3057
  /**
@@ -3637,6 +3660,36 @@ var RoundedPolygon = class _RoundedPolygon {
3637
3660
  this.centerY + d
3638
3661
  ];
3639
3662
  }
3663
+ /**
3664
+ * Calculates the approximate signed area of the polygon using anchor points.
3665
+ * Returns > 0 for Clockwise (in screen coords, y down), < 0 for Counter-Clockwise.
3666
+ */
3667
+ calculateSignedArea() {
3668
+ let area = 0;
3669
+ const n = this.cubics.length;
3670
+ for (let i = 0; i < n; i++) {
3671
+ const c = this.cubics[i];
3672
+ area += c.anchor0X * c.anchor1Y - c.anchor1X * c.anchor0Y;
3673
+ }
3674
+ return area / 2;
3675
+ }
3676
+ /**
3677
+ * Returns true if the polygon outline runs in Clockwise order (screen coords).
3678
+ */
3679
+ isClockwise() {
3680
+ return this.calculateSignedArea() > 0;
3681
+ }
3682
+ /**
3683
+ * Returns a reversed copy of the polygon with reversed traversal order.
3684
+ * Flips the winding direction (CW ↔ CCW).
3685
+ */
3686
+ reversed() {
3687
+ const reversedFeatures = this.features.slice().reverse().map((f) => reverseFeature(f));
3688
+ return new _RoundedPolygon(
3689
+ reversedFeatures,
3690
+ point(this.centerX, this.centerY)
3691
+ );
3692
+ }
3640
3693
  };
3641
3694
  function buildCubicsList(features) {
3642
3695
  const result = [];
@@ -3705,10 +3758,21 @@ function validateContiguity(cubics) {
3705
3758
 
3706
3759
  // src/shapes/catalog/md3-expressive-shapes.ts
3707
3760
  function createShape(pts) {
3708
- const cubics = pts.map((p) => new Cubic(p));
3709
- return RoundedPolygon.fromFeatures(
3710
- cubics.map((c) => cornerFeature([c], false))
3711
- );
3761
+ let rawArea = 0;
3762
+ for (const p of pts) {
3763
+ rawArea += p[0] * p[7] - p[6] * p[1];
3764
+ }
3765
+ const normalizedPts = rawArea < 0 ? pts.slice().reverse().map((p) => [p[6], p[7], p[4], p[5], p[2], p[3], p[0], p[1]]) : pts;
3766
+ const cubics = normalizedPts.map((p) => new Cubic(p));
3767
+ const n = cubics.length;
3768
+ const features = cubics.map((c, i) => {
3769
+ const prev = cubics[(i - 1 + n) % n].pointOnCurve(0.5);
3770
+ const curr = c.pointOnCurve(0.5);
3771
+ const next = cubics[(i + 1) % n].pointOnCurve(0.5);
3772
+ const isConvex = convex(prev.x, prev.y, curr.x, curr.y, next.x, next.y);
3773
+ return cornerFeature([c], isConvex);
3774
+ });
3775
+ return RoundedPolygon.fromFeatures(features);
3712
3776
  }
3713
3777
  var archShape = createShape([
3714
3778
  [1, 0.83461, 1, 0.8547, 1, 0.86477, 0.99898, 0.87322],
@@ -4802,30 +4866,24 @@ var MD3Shapes = {
4802
4866
 
4803
4867
  // src/shapes/render/shape-rendering.ts
4804
4868
  function toSvgPath(cubics, width = 1, height = 1) {
4805
- if (cubics.length === 0) return "";
4869
+ const len = cubics.length;
4870
+ if (len === 0) return "";
4806
4871
  const paddingX = width * 0.015;
4807
4872
  const paddingY = height * 0.015;
4808
4873
  const sx = width - 2 * paddingX;
4809
4874
  const sy = height - 2 * paddingY;
4810
- const flipY = (y) => paddingY + sy * (1 - y);
4811
- const parts = [
4812
- `M ${fmt(paddingX + cubics[0].anchor0X * sx)} ${fmt(flipY(cubics[0].anchor0Y))}`
4813
- ];
4814
- for (const c of cubics) {
4815
- parts.push(
4816
- `C ${fmt(paddingX + c.control0X * sx)} ${fmt(flipY(c.control0Y))},${fmt(paddingX + c.control1X * sx)} ${fmt(flipY(c.control1Y))},${fmt(paddingX + c.anchor1X * sx)} ${fmt(flipY(c.anchor1Y))}`
4817
- );
4875
+ const c0 = cubics[0];
4876
+ let d = `M ${formatCoordinate(paddingX + c0.anchor0X * sx)} ${formatCoordinate(paddingY + sy * (1 - c0.anchor0Y))}`;
4877
+ for (let i = 0; i < len; i++) {
4878
+ const c = cubics[i];
4879
+ d += ` C ${formatCoordinate(paddingX + c.control0X * sx)} ${formatCoordinate(paddingY + sy * (1 - c.control0Y))},${formatCoordinate(paddingX + c.control1X * sx)} ${formatCoordinate(paddingY + sy * (1 - c.control1Y))},${formatCoordinate(paddingX + c.anchor1X * sx)} ${formatCoordinate(paddingY + sy * (1 - c.anchor1Y))}`;
4818
4880
  }
4819
- parts.push("Z");
4820
- return parts.join(" ");
4881
+ return `${d} Z`;
4821
4882
  }
4822
4883
  function toClipPath(polygon, width, height) {
4823
4884
  const pathData = toSvgPath(polygon.cubics, width, height);
4824
4885
  return `path('${pathData}')`;
4825
4886
  }
4826
- function fmt(v) {
4827
- return Number(v.toFixed(4)).toString();
4828
- }
4829
4887
 
4830
4888
  // src/ui/navigation/navigation-shape-utils.ts
4831
4889
  function getNavigationShapeStyle(shape, width = 56, height = 56) {
@@ -5947,6 +6005,7 @@ var NavigationRailComponent = React39.forwardRef(
5947
6005
  m.div,
5948
6006
  {
5949
6007
  layout: true,
6008
+ transition: SPRING_TRANSITION,
5950
6009
  className: cn(
5951
6010
  "flex w-full flex-col justify-start shrink-0 empty:hidden",
5952
6011
  isExpanded ? "items-start px-3" : "items-center",
@@ -6281,6 +6340,7 @@ function SearchBar({
6281
6340
  onSearch,
6282
6341
  active,
6283
6342
  onActiveChange,
6343
+ showLeadingIcon = true,
6284
6344
  leadingIcon,
6285
6345
  trailingIcon,
6286
6346
  avatar,
@@ -6343,7 +6403,7 @@ function SearchBar({
6343
6403
  layoutId: shouldReduceMotion ? void 0 : searchId,
6344
6404
  transition: shouldReduceMotion ? void 0 : SEARCH_BAR_EXPAND_SPRING,
6345
6405
  className: cn(
6346
- "relative group select-none",
6406
+ "relative group select-none rounded-full",
6347
6407
  SEARCH_ELEVATION.level3,
6348
6408
  className
6349
6409
  ),
@@ -6383,7 +6443,7 @@ function SearchBar({
6383
6443
  "aria-label": ariaLabel,
6384
6444
  className: "relative flex h-full items-center gap-2 rounded-full px-4",
6385
6445
  children: /* @__PURE__ */ jsxs("form", { className: "contents", onSubmit: handleFormSubmit, children: [
6386
- /* @__PURE__ */ jsx(
6446
+ showLeadingIcon && /* @__PURE__ */ jsx(
6387
6447
  "span",
6388
6448
  {
6389
6449
  className: "flex shrink-0 items-center justify-center",
@@ -8145,6 +8205,7 @@ function SearchViewDocked({
8145
8205
  onSearch,
8146
8206
  active,
8147
8207
  onActiveChange,
8208
+ showLeadingIcon = true,
8148
8209
  leadingIcon,
8149
8210
  trailingIcon,
8150
8211
  avatar,
@@ -8201,7 +8262,7 @@ function SearchViewDocked({
8201
8262
  className: "flex items-center gap-2 px-4",
8202
8263
  style: { height: SearchTokens.heights.dockedHeader },
8203
8264
  children: /* @__PURE__ */ jsxs("form", { className: "contents", onSubmit: handleFormSubmit, children: [
8204
- /* @__PURE__ */ jsx(
8265
+ showLeadingIcon && /* @__PURE__ */ jsx(
8205
8266
  "span",
8206
8267
  {
8207
8268
  className: "flex shrink-0 items-center justify-center",
@@ -8296,6 +8357,7 @@ function SearchViewFullScreen({
8296
8357
  onSearch,
8297
8358
  active,
8298
8359
  onActiveChange,
8360
+ showCloseButton = true,
8299
8361
  leadingIcon,
8300
8362
  trailingIcon,
8301
8363
  avatar,
@@ -8362,7 +8424,7 @@ function SearchViewFullScreen({
8362
8424
  className: "flex shrink-0 items-center gap-2 px-4",
8363
8425
  style: { height: SearchTokens.heights.fullScreenHeader },
8364
8426
  children: /* @__PURE__ */ jsxs("form", { className: "contents", onSubmit: handleFormSubmit, children: [
8365
- /* @__PURE__ */ jsx(
8427
+ showCloseButton && /* @__PURE__ */ jsx(
8366
8428
  IconButton,
8367
8429
  {
8368
8430
  size: "sm",
@@ -8463,6 +8525,8 @@ function SearchComponent({
8463
8525
  variant = "docked",
8464
8526
  styleType = "contained",
8465
8527
  hasGap = false,
8528
+ showLeadingIcon = true,
8529
+ showCloseButton = true,
8466
8530
  leadingIcon,
8467
8531
  trailingIcon,
8468
8532
  avatar,
@@ -8491,6 +8555,7 @@ function SearchComponent({
8491
8555
  onSearch,
8492
8556
  active,
8493
8557
  onActiveChange,
8558
+ showLeadingIcon,
8494
8559
  leadingIcon,
8495
8560
  trailingIcon,
8496
8561
  avatar,
@@ -8507,6 +8572,7 @@ function SearchComponent({
8507
8572
  variant === "fullscreen" ? /* @__PURE__ */ jsx(
8508
8573
  SearchViewFullScreen,
8509
8574
  __spreadProps(__spreadValues({}, sharedProps), {
8575
+ showCloseButton,
8510
8576
  styleType,
8511
8577
  viewClassName,
8512
8578
  children