@bug-on/m3-expressive 1.2.0 → 1.2.2

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 +12 -0
  2. package/dist/buttons.d.mts +26 -5
  3. package/dist/buttons.d.ts +26 -5
  4. package/dist/buttons.js +1074 -765
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +1066 -765
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/core.js +133 -69
  9. package/dist/core.js.map +1 -1
  10. package/dist/core.mjs +133 -69
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/feedback.js +132 -69
  13. package/dist/feedback.js.map +1 -1
  14. package/dist/feedback.mjs +132 -69
  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 +74 -9
  19. package/dist/forms.js.map +1 -1
  20. package/dist/forms.mjs +74 -9
  21. package/dist/forms.mjs.map +1 -1
  22. package/dist/{icon-button-D-gs0gfj.d.mts → icon-button-CSsDmuQC.d.mts} +19 -0
  23. package/dist/{icon-button-D-gs0gfj.d.ts → icon-button-CSsDmuQC.d.ts} +19 -0
  24. package/dist/index.d.mts +4 -4
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.js +2204 -1464
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +2056 -1324
  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 +80 -15
  33. package/dist/layout.js.map +1 -1
  34. package/dist/layout.mjs +80 -15
  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 +461 -101
  39. package/dist/navigation.js.map +1 -1
  40. package/dist/navigation.mjs +455 -102
  41. package/dist/navigation.mjs.map +1 -1
  42. package/dist/overlays.js +261 -197
  43. package/dist/overlays.js.map +1 -1
  44. package/dist/overlays.mjs +223 -159
  45. package/dist/overlays.mjs.map +1 -1
  46. package/dist/pickers.js +392 -301
  47. package/dist/pickers.js.map +1 -1
  48. package/dist/pickers.mjs +361 -270
  49. package/dist/pickers.mjs.map +1 -1
  50. package/dist/{split-button-trailing-uncheckable-BkPbiBo3.d.ts → split-button-trailing-uncheckable-C-qQlyZx.d.ts} +118 -25
  51. package/dist/{split-button-trailing-uncheckable-D_PLPb-u.d.mts → split-button-trailing-uncheckable-DHJqNeq_.d.mts} +118 -25
  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 +3 -3
package/dist/forms.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as SliderThumbProps } from './text-field-eAIpz9z1.mjs';
2
- export { C as Checkbox, a as CheckboxProps, b as CheckboxState, c as Chip, d as ChipProps, R as RadioButton, e as RadioButtonColors, f as RadioButtonProps, g as RadioGroup, h as RadioGroupProps, i as RangeSlider, j as RangeSliderProps, S as Slider, k as SliderColors, l as SliderOrientation, m as SliderProps, n as SliderTokens, o as SliderTrackSize, p as SliderVariant, q as Switch, r as SwitchColors, s as SwitchProps, t as SwitchTokens, T as TextField, u as TextFieldHandle, v as TextFieldInputType, w as TextFieldProps, x as TextFieldTrailingIconMode, y as TextFieldVariant, z as TriStateCheckbox, A as TriStateCheckboxProps } from './text-field-eAIpz9z1.mjs';
1
+ import { B as SliderThumbProps } from './text-field-T4Rg-9Bw.mjs';
2
+ export { C as Checkbox, a as CheckboxProps, b as CheckboxState, c as Chip, d as ChipProps, R as RadioButton, e as RadioButtonColors, f as RadioButtonProps, g as RadioGroup, h as RadioGroupProps, i as RangeSlider, j as RangeSliderProps, S as Slider, k as SliderColors, l as SliderOrientation, m as SliderProps, n as SliderTokens, o as SliderTrackSize, p as SliderVariant, q as Switch, r as SwitchColors, s as SwitchProps, t as SwitchTokens, T as TextField, u as TextFieldHandle, v as TextFieldInputType, w as TextFieldProps, x as TextFieldTrailingIconMode, y as TextFieldVariant, z as TriStateCheckbox, A as TriStateCheckboxProps } from './text-field-T4Rg-9Bw.mjs';
3
3
  import * as React from 'react';
4
4
  import 'class-variance-authority/types';
5
5
  import 'class-variance-authority';
package/dist/forms.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as SliderThumbProps } from './text-field-eAIpz9z1.js';
2
- export { C as Checkbox, a as CheckboxProps, b as CheckboxState, c as Chip, d as ChipProps, R as RadioButton, e as RadioButtonColors, f as RadioButtonProps, g as RadioGroup, h as RadioGroupProps, i as RangeSlider, j as RangeSliderProps, S as Slider, k as SliderColors, l as SliderOrientation, m as SliderProps, n as SliderTokens, o as SliderTrackSize, p as SliderVariant, q as Switch, r as SwitchColors, s as SwitchProps, t as SwitchTokens, T as TextField, u as TextFieldHandle, v as TextFieldInputType, w as TextFieldProps, x as TextFieldTrailingIconMode, y as TextFieldVariant, z as TriStateCheckbox, A as TriStateCheckboxProps } from './text-field-eAIpz9z1.js';
1
+ import { B as SliderThumbProps } from './text-field-T4Rg-9Bw.js';
2
+ export { C as Checkbox, a as CheckboxProps, b as CheckboxState, c as Chip, d as ChipProps, R as RadioButton, e as RadioButtonColors, f as RadioButtonProps, g as RadioGroup, h as RadioGroupProps, i as RangeSlider, j as RangeSliderProps, S as Slider, k as SliderColors, l as SliderOrientation, m as SliderProps, n as SliderTokens, o as SliderTrackSize, p as SliderVariant, q as Switch, r as SwitchColors, s as SwitchProps, t as SwitchTokens, T as TextField, u as TextFieldHandle, v as TextFieldInputType, w as TextFieldProps, x as TextFieldTrailingIconMode, y as TextFieldVariant, z as TriStateCheckbox, A as TriStateCheckboxProps } from './text-field-T4Rg-9Bw.js';
3
3
  import * as React from 'react';
4
4
  import 'class-variance-authority/types';
5
5
  import 'class-variance-authority';
package/dist/forms.js CHANGED
@@ -6,6 +6,7 @@ var React4 = require('react');
6
6
  var clsx = require('clsx');
7
7
  var tailwindMerge = require('tailwind-merge');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
+ var reactSlot = require('@radix-ui/react-slot');
9
10
  var classVarianceAuthority = require('class-variance-authority');
10
11
  var RadixScrollArea = require('@radix-ui/react-scroll-area');
11
12
 
@@ -115,7 +116,10 @@ function useRippleState(options = {}) {
115
116
  const rect = e.currentTarget.getBoundingClientRect();
116
117
  const x = e.clientX - rect.left;
117
118
  const y = e.clientY - rect.top;
118
- const rippleSize = Math.hypot(rect.width, rect.height) * 2;
119
+ const rippleSize = Math.max(
120
+ Math.hypot(rect.width, rect.height) * 2.5,
121
+ 320
122
+ );
119
123
  setRipples((prev) => [
120
124
  ...prev,
121
125
  { id: Date.now(), x, y, size: rippleSize }
@@ -540,7 +544,9 @@ var ChipImpl = React4__namespace.forwardRef(
540
544
  avatar,
541
545
  onRemove,
542
546
  className,
543
- onClick
547
+ onClick,
548
+ asChild = false,
549
+ children
544
550
  } = _b, props = __objRest(_b, [
545
551
  "variant",
546
552
  "elevated",
@@ -552,7 +558,9 @@ var ChipImpl = React4__namespace.forwardRef(
552
558
  "avatar",
553
559
  "onRemove",
554
560
  "className",
555
- "onClick"
561
+ "onClick",
562
+ "asChild",
563
+ "children"
556
564
  ]);
557
565
  const { ripples, onPointerDown, removeRipple } = useRippleState({
558
566
  disabled
@@ -667,6 +675,63 @@ var ChipImpl = React4__namespace.forwardRef(
667
675
  ) : null }),
668
676
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "whitespace-nowrap", children: label })
669
677
  ] });
678
+ if (asChild) {
679
+ const child = React4__namespace.Children.only(children);
680
+ const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
681
+ /* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
682
+ mainContent,
683
+ hasTrailingContent && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center justify-center shrink-0", children: onRemove ? /* @__PURE__ */ jsxRuntime.jsx(
684
+ "button",
685
+ {
686
+ type: "button",
687
+ tabIndex: disabled ? -1 : 0,
688
+ "aria-label": typeof label === "string" ? `Remove ${label}` : "Remove",
689
+ onClick: (e) => {
690
+ e.stopPropagation();
691
+ onRemove(e);
692
+ },
693
+ onPointerDown: (e) => e.stopPropagation(),
694
+ className: cn(
695
+ "flex items-center justify-center w-8.5 h-full",
696
+ "cursor-pointer focus-visible:outline-none",
697
+ "transition-all duration-150",
698
+ "relative overflow-hidden rounded-r-[7px] rounded-l-none",
699
+ "before:absolute before:-inset-px before:pointer-events-none before:bg-current",
700
+ "before:transition-opacity before:duration-200 before:opacity-0 before:rounded-r-[7px]",
701
+ "hover:before:opacity-[0.08] active:before:opacity-[0.12]",
702
+ selected ? "text-m3-on-secondary-container" : "text-m3-on-surface-variant"
703
+ ),
704
+ children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {})
705
+ }
706
+ ) : trailingIcon ? /* @__PURE__ */ jsxRuntime.jsx(
707
+ "span",
708
+ {
709
+ className: cn(
710
+ "flex items-center justify-center w-4.5 h-4.5 [&_.md-icon]:text-[length:inherit]!",
711
+ selected ? "text-m3-on-secondary-container" : "text-m3-on-surface-variant"
712
+ ),
713
+ style: { fontSize: 18 },
714
+ "aria-hidden": "true",
715
+ children: trailingIcon
716
+ }
717
+ ) : null })
718
+ ] });
719
+ const strippedProps = __spreadValues({}, props);
720
+ delete strippedProps.children;
721
+ return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
722
+ reactSlot.Slot,
723
+ __spreadProps(__spreadValues({
724
+ ref,
725
+ "aria-disabled": disabled || void 0,
726
+ tabIndex: disabled ? -1 : 0,
727
+ onClick,
728
+ onPointerDown,
729
+ className: containerClass
730
+ }, strippedProps), {
731
+ children: React4__namespace.cloneElement(child, { children: innerContent })
732
+ })
733
+ ) });
734
+ }
670
735
  return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
671
736
  Root2,
672
737
  __spreadProps(__spreadValues(__spreadProps(__spreadValues({
@@ -3471,7 +3536,6 @@ var FloatingLabel = React4__namespace.memo(function FloatingLabel2({
3471
3536
  "absolute pointer-events-none select-none origin-[left_center] leading-6 text-base whitespace-nowrap",
3472
3537
  "px-1 -mx-1",
3473
3538
  // Clear the notch gap and keep text aligned
3474
- variant === "outlined" && isFloated && "bg-m3-surface",
3475
3539
  "left-4",
3476
3540
  isDisabled && "opacity-[0.38]"
3477
3541
  ),
@@ -3547,7 +3611,8 @@ var OutlineContainer = React4__namespace.memo(function OutlineContainer2({
3547
3611
  );
3548
3612
  const borderWidth = isFocused || isError ? TF_SIZE.outlineThick : TF_SIZE.outlineThin;
3549
3613
  const leftSegmentWidth = TF_SIZE.paddingStart;
3550
- const notchWidth = isFloated ? labelWidth * TF_TYPOGRAPHY.labelScaleRatio + TF_SIZE.notchPadding * 2 : 0;
3614
+ const isNotched = isFloated && labelWidth > 0;
3615
+ const notchWidth = isNotched ? labelWidth * TF_TYPOGRAPHY.labelScaleRatio + TF_SIZE.notchPadding * 2 : 0;
3551
3616
  const borderTransition = { duration: colorDuration, ease };
3552
3617
  const notchTransition = { duration: notchDuration, ease };
3553
3618
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3585,7 +3650,7 @@ var OutlineContainer = React4__namespace.memo(function OutlineContainer2({
3585
3650
  style: { height: borderWidth },
3586
3651
  animate: {
3587
3652
  borderTopColor: borderColor,
3588
- opacity: isFloated ? 0 : 1,
3653
+ opacity: isNotched ? 0 : 1,
3589
3654
  borderTopWidth: borderWidth,
3590
3655
  borderTopStyle: "solid"
3591
3656
  },
@@ -4037,7 +4102,7 @@ var TextFieldComponent = React4__namespace.forwardRef(
4037
4102
  const computedDescribedby = [hasSupporting ? supportingId : "", ariaDescribedby != null ? ariaDescribedby : ""].filter(Boolean).join(" ") || void 0;
4038
4103
  const inputClass = cn(
4039
4104
  "bg-transparent outline-none w-full",
4040
- isInToolbar ? "self-center" : "self-end",
4105
+ !resolvedLabel || isInToolbar ? "self-center" : "self-end",
4041
4106
  "text-base leading-6 text-m3-on-surface",
4042
4107
  "caret-[var(--color-m3-primary)]",
4043
4108
  "placeholder:text-m3-on-surface-variant/60",
@@ -4048,7 +4113,7 @@ var TextFieldComponent = React4__namespace.forwardRef(
4048
4113
  id: inputId,
4049
4114
  name,
4050
4115
  value: currentValue,
4051
- placeholder: isFloated ? placeholder != null ? placeholder : "" : "",
4116
+ placeholder: !resolvedLabel || isFloated ? placeholder != null ? placeholder : "" : "",
4052
4117
  disabled,
4053
4118
  readOnly,
4054
4119
  required,
@@ -4080,7 +4145,7 @@ var TextFieldComponent = React4__namespace.forwardRef(
4080
4145
  "relative flex flex-col flex-1 min-w-0 h-full",
4081
4146
  paddingStart,
4082
4147
  paddingEnd,
4083
- isInToolbar ? "justify-center" : variant === "filled" ? resolvedDense ? "pt-5 pb-2" : "pt-6 pb-2" : resolvedDense ? "py-3" : "py-4"
4148
+ isInToolbar || !resolvedLabel ? "justify-center" : variant === "filled" ? resolvedDense ? "pt-5 pb-2" : "pt-6 pb-2" : resolvedDense ? "py-3" : "py-4"
4084
4149
  );
4085
4150
  const wrapperClass = cn(
4086
4151
  "group/tf inline-flex flex-col",