@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
@@ -76,7 +76,7 @@ function getMaskGradient(direction) {
76
76
  case "bottom":
77
77
  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%)";
78
78
  case "both":
79
- 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%)";
79
+ 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%)";
80
80
  default:
81
81
  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%)";
82
82
  }
@@ -93,11 +93,16 @@ function FadingBlurMask({
93
93
  const shouldReduceMotion = react.useReducedMotion();
94
94
  const activeBlur = shouldReduceMotion ? 0 : blurIntensity;
95
95
  const maskGradient = getMaskGradient(direction);
96
+ const isFullHeight = direction === "both" || blurHeight === "100%";
97
+ const computedHeight = isFullHeight ? "100%" : typeof blurHeight === "number" ? `${blurHeight}px` : blurHeight;
96
98
  const maskStyle = __spreadValues({
97
99
  position: "absolute",
98
- inset: 0,
100
+ top: direction === "bottom" && !isFullHeight ? "auto" : 0,
101
+ bottom: direction === "top" && !isFullHeight ? "auto" : 0,
102
+ left: 0,
103
+ right: 0,
99
104
  pointerEvents: "none",
100
- height: typeof blurHeight === "number" ? `${blurHeight}px` : blurHeight,
105
+ height: computedHeight,
101
106
  backdropFilter: activeBlur > 0 ? `blur(${activeBlur}px)` : void 0,
102
107
  WebkitBackdropFilter: activeBlur > 0 ? `blur(${activeBlur}px)` : void 0,
103
108
  maskImage: maskGradient,
@@ -109,7 +114,7 @@ function FadingBlurMask({
109
114
  {
110
115
  "aria-hidden": "true",
111
116
  className: cn(
112
- "absolute inset-0 pointer-events-none z-0 rounded-[inherit]",
117
+ "absolute pointer-events-none z-10 rounded-[inherit]",
113
118
  className
114
119
  ),
115
120
  style: maskStyle,
@@ -1157,7 +1162,7 @@ var IconComponent = React39__namespace.forwardRef(
1157
1162
  (_a, ref) => {
1158
1163
  var _b = _a, {
1159
1164
  name,
1160
- variant = "outlined",
1165
+ variant = "rounded",
1161
1166
  fill = 0,
1162
1167
  weight = 400,
1163
1168
  grade = 0,
@@ -2966,6 +2971,13 @@ function transformFeature(feature, fn) {
2966
2971
  }
2967
2972
  return edgeFeature(cubics);
2968
2973
  }
2974
+ function reverseFeature(feature) {
2975
+ const cubics = feature.cubics.slice().reverse().map((c) => c.reverse());
2976
+ if (feature.type === "corner") {
2977
+ return cornerFeature(cubics, feature.convex);
2978
+ }
2979
+ return edgeFeature(cubics);
2980
+ }
2969
2981
 
2970
2982
  // src/shapes/math/corner-rounding.ts
2971
2983
  var UNROUNDED = Object.freeze({
@@ -2998,6 +3010,10 @@ function convex(prevX, prevY, currX, currY, nextX, nextY) {
2998
3010
  const v2y = nextY - currY;
2999
3011
  return v1x * v2y - v1y * v2x > 0;
3000
3012
  }
3013
+ function formatCoordinate(v) {
3014
+ const rounded = Math.round(v * 1e4) / 1e4;
3015
+ return (rounded === 0 ? 0 : rounded).toString();
3016
+ }
3001
3017
 
3002
3018
  // src/shapes/math/point.ts
3003
3019
  function point(x, y) {
@@ -3050,9 +3066,16 @@ var Cubic = class _Cubic {
3050
3066
  */
3051
3067
  pointOnCurve(t) {
3052
3068
  const u = 1 - t;
3069
+ const uu = u * u;
3070
+ const tt = t * t;
3071
+ const uuu = uu * u;
3072
+ const ttt = tt * t;
3073
+ const c0 = 3 * t * uu;
3074
+ const c1 = 3 * tt * u;
3075
+ const p = this.points;
3053
3076
  return point(
3054
- this.anchor0X * (u * u * u) + this.control0X * (3 * t * u * u) + this.control1X * (3 * t * t * u) + this.anchor1X * (t * t * t),
3055
- this.anchor0Y * (u * u * u) + this.control0Y * (3 * t * u * u) + this.control1Y * (3 * t * t * u) + this.anchor1Y * (t * t * t)
3077
+ p[0] * uuu + p[2] * c0 + p[4] * c1 + p[6] * ttt,
3078
+ p[1] * uuu + p[3] * c0 + p[5] * c1 + p[7] * ttt
3056
3079
  );
3057
3080
  }
3058
3081
  /**
@@ -3661,6 +3684,36 @@ var RoundedPolygon = class _RoundedPolygon {
3661
3684
  this.centerY + d
3662
3685
  ];
3663
3686
  }
3687
+ /**
3688
+ * Calculates the approximate signed area of the polygon using anchor points.
3689
+ * Returns > 0 for Clockwise (in screen coords, y down), < 0 for Counter-Clockwise.
3690
+ */
3691
+ calculateSignedArea() {
3692
+ let area = 0;
3693
+ const n = this.cubics.length;
3694
+ for (let i = 0; i < n; i++) {
3695
+ const c = this.cubics[i];
3696
+ area += c.anchor0X * c.anchor1Y - c.anchor1X * c.anchor0Y;
3697
+ }
3698
+ return area / 2;
3699
+ }
3700
+ /**
3701
+ * Returns true if the polygon outline runs in Clockwise order (screen coords).
3702
+ */
3703
+ isClockwise() {
3704
+ return this.calculateSignedArea() > 0;
3705
+ }
3706
+ /**
3707
+ * Returns a reversed copy of the polygon with reversed traversal order.
3708
+ * Flips the winding direction (CW ↔ CCW).
3709
+ */
3710
+ reversed() {
3711
+ const reversedFeatures = this.features.slice().reverse().map((f) => reverseFeature(f));
3712
+ return new _RoundedPolygon(
3713
+ reversedFeatures,
3714
+ point(this.centerX, this.centerY)
3715
+ );
3716
+ }
3664
3717
  };
3665
3718
  function buildCubicsList(features) {
3666
3719
  const result = [];
@@ -3729,10 +3782,21 @@ function validateContiguity(cubics) {
3729
3782
 
3730
3783
  // src/shapes/catalog/md3-expressive-shapes.ts
3731
3784
  function createShape(pts) {
3732
- const cubics = pts.map((p) => new Cubic(p));
3733
- return RoundedPolygon.fromFeatures(
3734
- cubics.map((c) => cornerFeature([c], false))
3735
- );
3785
+ let rawArea = 0;
3786
+ for (const p of pts) {
3787
+ rawArea += p[0] * p[7] - p[6] * p[1];
3788
+ }
3789
+ 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;
3790
+ const cubics = normalizedPts.map((p) => new Cubic(p));
3791
+ const n = cubics.length;
3792
+ const features = cubics.map((c, i) => {
3793
+ const prev = cubics[(i - 1 + n) % n].pointOnCurve(0.5);
3794
+ const curr = c.pointOnCurve(0.5);
3795
+ const next = cubics[(i + 1) % n].pointOnCurve(0.5);
3796
+ const isConvex = convex(prev.x, prev.y, curr.x, curr.y, next.x, next.y);
3797
+ return cornerFeature([c], isConvex);
3798
+ });
3799
+ return RoundedPolygon.fromFeatures(features);
3736
3800
  }
3737
3801
  var archShape = createShape([
3738
3802
  [1, 0.83461, 1, 0.8547, 1, 0.86477, 0.99898, 0.87322],
@@ -4826,30 +4890,24 @@ var MD3Shapes = {
4826
4890
 
4827
4891
  // src/shapes/render/shape-rendering.ts
4828
4892
  function toSvgPath(cubics, width = 1, height = 1) {
4829
- if (cubics.length === 0) return "";
4893
+ const len = cubics.length;
4894
+ if (len === 0) return "";
4830
4895
  const paddingX = width * 0.015;
4831
4896
  const paddingY = height * 0.015;
4832
4897
  const sx = width - 2 * paddingX;
4833
4898
  const sy = height - 2 * paddingY;
4834
- const flipY = (y) => paddingY + sy * (1 - y);
4835
- const parts = [
4836
- `M ${fmt(paddingX + cubics[0].anchor0X * sx)} ${fmt(flipY(cubics[0].anchor0Y))}`
4837
- ];
4838
- for (const c of cubics) {
4839
- parts.push(
4840
- `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))}`
4841
- );
4899
+ const c0 = cubics[0];
4900
+ let d = `M ${formatCoordinate(paddingX + c0.anchor0X * sx)} ${formatCoordinate(paddingY + sy * (1 - c0.anchor0Y))}`;
4901
+ for (let i = 0; i < len; i++) {
4902
+ const c = cubics[i];
4903
+ 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))}`;
4842
4904
  }
4843
- parts.push("Z");
4844
- return parts.join(" ");
4905
+ return `${d} Z`;
4845
4906
  }
4846
4907
  function toClipPath(polygon, width, height) {
4847
4908
  const pathData = toSvgPath(polygon.cubics, width, height);
4848
4909
  return `path('${pathData}')`;
4849
4910
  }
4850
- function fmt(v) {
4851
- return Number(v.toFixed(4)).toString();
4852
- }
4853
4911
 
4854
4912
  // src/ui/navigation/navigation-shape-utils.ts
4855
4913
  function getNavigationShapeStyle(shape, width = 56, height = 56) {
@@ -5971,6 +6029,7 @@ var NavigationRailComponent = React39__namespace.forwardRef(
5971
6029
  react.m.div,
5972
6030
  {
5973
6031
  layout: true,
6032
+ transition: SPRING_TRANSITION,
5974
6033
  className: cn(
5975
6034
  "flex w-full flex-col justify-start shrink-0 empty:hidden",
5976
6035
  isExpanded ? "items-start px-3" : "items-center",
@@ -6305,6 +6364,7 @@ function SearchBar({
6305
6364
  onSearch,
6306
6365
  active,
6307
6366
  onActiveChange,
6367
+ showLeadingIcon = true,
6308
6368
  leadingIcon,
6309
6369
  trailingIcon,
6310
6370
  avatar,
@@ -6367,7 +6427,7 @@ function SearchBar({
6367
6427
  layoutId: shouldReduceMotion ? void 0 : searchId,
6368
6428
  transition: shouldReduceMotion ? void 0 : SEARCH_BAR_EXPAND_SPRING,
6369
6429
  className: cn(
6370
- "relative group select-none",
6430
+ "relative group select-none rounded-full",
6371
6431
  SEARCH_ELEVATION.level3,
6372
6432
  className
6373
6433
  ),
@@ -6407,7 +6467,7 @@ function SearchBar({
6407
6467
  "aria-label": ariaLabel,
6408
6468
  className: "relative flex h-full items-center gap-2 rounded-full px-4",
6409
6469
  children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "contents", onSubmit: handleFormSubmit, children: [
6410
- /* @__PURE__ */ jsxRuntime.jsx(
6470
+ showLeadingIcon && /* @__PURE__ */ jsxRuntime.jsx(
6411
6471
  "span",
6412
6472
  {
6413
6473
  className: "flex shrink-0 items-center justify-center",
@@ -8169,6 +8229,7 @@ function SearchViewDocked({
8169
8229
  onSearch,
8170
8230
  active,
8171
8231
  onActiveChange,
8232
+ showLeadingIcon = true,
8172
8233
  leadingIcon,
8173
8234
  trailingIcon,
8174
8235
  avatar,
@@ -8225,7 +8286,7 @@ function SearchViewDocked({
8225
8286
  className: "flex items-center gap-2 px-4",
8226
8287
  style: { height: SearchTokens.heights.dockedHeader },
8227
8288
  children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "contents", onSubmit: handleFormSubmit, children: [
8228
- /* @__PURE__ */ jsxRuntime.jsx(
8289
+ showLeadingIcon && /* @__PURE__ */ jsxRuntime.jsx(
8229
8290
  "span",
8230
8291
  {
8231
8292
  className: "flex shrink-0 items-center justify-center",
@@ -8320,6 +8381,7 @@ function SearchViewFullScreen({
8320
8381
  onSearch,
8321
8382
  active,
8322
8383
  onActiveChange,
8384
+ showCloseButton = true,
8323
8385
  leadingIcon,
8324
8386
  trailingIcon,
8325
8387
  avatar,
@@ -8386,7 +8448,7 @@ function SearchViewFullScreen({
8386
8448
  className: "flex shrink-0 items-center gap-2 px-4",
8387
8449
  style: { height: SearchTokens.heights.fullScreenHeader },
8388
8450
  children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "contents", onSubmit: handleFormSubmit, children: [
8389
- /* @__PURE__ */ jsxRuntime.jsx(
8451
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
8390
8452
  IconButton,
8391
8453
  {
8392
8454
  size: "sm",
@@ -8487,6 +8549,8 @@ function SearchComponent({
8487
8549
  variant = "docked",
8488
8550
  styleType = "contained",
8489
8551
  hasGap = false,
8552
+ showLeadingIcon = true,
8553
+ showCloseButton = true,
8490
8554
  leadingIcon,
8491
8555
  trailingIcon,
8492
8556
  avatar,
@@ -8515,6 +8579,7 @@ function SearchComponent({
8515
8579
  onSearch,
8516
8580
  active,
8517
8581
  onActiveChange,
8582
+ showLeadingIcon,
8518
8583
  leadingIcon,
8519
8584
  trailingIcon,
8520
8585
  avatar,
@@ -8531,6 +8596,7 @@ function SearchComponent({
8531
8596
  variant === "fullscreen" ? /* @__PURE__ */ jsxRuntime.jsx(
8532
8597
  SearchViewFullScreen,
8533
8598
  __spreadProps(__spreadValues({}, sharedProps), {
8599
+ showCloseButton,
8534
8600
  styleType,
8535
8601
  viewClassName,
8536
8602
  children