@tinybigui/react 0.18.0 → 0.20.0

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.
package/dist/index.cjs CHANGED
@@ -6560,7 +6560,6 @@ var snackbarBaseVariants = classVarianceAuthority.cva(
6560
6560
  "min-w-72",
6561
6561
  "max-w-snackbar-max",
6562
6562
  "w-max",
6563
- "min-h-12",
6564
6563
  // Restore pointer events so hover/focus timer pause works
6565
6564
  "pointer-events-auto",
6566
6565
  // Surface
@@ -6571,25 +6570,27 @@ var snackbarBaseVariants = classVarianceAuthority.cva(
6571
6570
  "shadow-elevation-3",
6572
6571
  // Layout
6573
6572
  "flex",
6574
- "items-center",
6575
6573
  "gap-x-1",
6576
- "pl-4 pr-2",
6577
- // Typography
6574
+ "pl-4",
6575
+ // Typography base (inherited by message/supporting-text slots)
6578
6576
  "text-body-medium",
6579
6577
  "text-inverse-on-surface",
6580
- // Transition (properties used by both entry and exit)
6578
+ // Slide + fade transition spring-standard effects tokens (no overshoot).
6579
+ // The translate offset is small (12px), so using the effects token pair for
6580
+ // BOTH opacity AND transform is safe: no visible overshoot at this scale.
6581
6581
  "transition-[opacity,transform]",
6582
6582
  "will-change-[opacity,transform]"
6583
6583
  ],
6584
6584
  {
6585
6585
  variants: {
6586
6586
  /**
6587
- * Whether the Snackbar has supporting text (two-line layout).
6588
- * Adjusts vertical padding to MD3 spec for two-line configuration.
6587
+ * Two-line density mode.
6588
+ * false 48dp, items centered (single-line message)
6589
+ * true — 68dp, items top-aligned (message + supporting text)
6589
6590
  */
6590
6591
  twoLine: {
6591
- true: "py-1",
6592
- false: "py-1"
6592
+ false: ["min-h-12", "items-center", "pr-1"],
6593
+ true: ["min-h-[4.25rem]", "items-start", "pr-1"]
6593
6594
  }
6594
6595
  },
6595
6596
  defaultVariants: {
@@ -6615,53 +6616,211 @@ classVarianceAuthority.cva("", {
6615
6616
  var snackbarAnimationVariants = classVarianceAuthority.cva("", {
6616
6617
  variants: {
6617
6618
  animationState: {
6618
- entering: ["opacity-0", "scale-75"],
6619
- visible: ["scale-100", "opacity-100", "duration-medium1", "ease-emphasized-decelerate"],
6620
- exiting: ["scale-75", "opacity-0", "duration-short4", "ease-standard-accelerate"],
6621
- exited: ["scale-75", "opacity-0", "duration-short4", "ease-standard-accelerate"]
6619
+ entering: [],
6620
+ visible: [],
6621
+ exiting: [],
6622
+ exited: []
6622
6623
  },
6623
6624
  enterDirection: {
6624
- up: ["origin-bottom"],
6625
- down: ["origin-top"]
6625
+ up: [],
6626
+ down: []
6626
6627
  }
6627
6628
  },
6628
- defaultVariants: {
6629
- animationState: "entering",
6630
- enterDirection: "up"
6631
- }
6632
- });
6633
- classVarianceAuthority.cva([...snackbarBaseVariants()], {
6634
- variants: {
6635
- animationState: {
6636
- entering: ["opacity-0", "scale-75"],
6637
- visible: ["scale-100", "opacity-100", "duration-medium1", "ease-emphasized-decelerate"],
6638
- exiting: ["scale-75", "opacity-0", "duration-short4", "ease-standard-accelerate"],
6639
- exited: ["scale-75", "opacity-0", "duration-short4", "ease-standard-accelerate"]
6629
+ compoundVariants: [
6630
+ // ── entering ──────────────────────────────────────────────────────────────
6631
+ // No transition duration — instant jump to offset state before first paint.
6632
+ {
6633
+ animationState: "entering",
6634
+ enterDirection: "up",
6635
+ className: ["opacity-0", "translate-y-3"]
6640
6636
  },
6641
- enterDirection: {
6642
- up: ["origin-bottom"],
6643
- down: ["origin-top"]
6637
+ {
6638
+ animationState: "entering",
6639
+ enterDirection: "down",
6640
+ className: ["opacity-0", "-translate-y-3"]
6644
6641
  },
6645
- position: {
6646
- "bottom-center": ["bottom-4", "left-1/2", "-translate-x-1/2"],
6647
- "bottom-left": ["bottom-4", "left-4"],
6648
- "bottom-right": ["bottom-4", "right-4"],
6649
- "top-center": ["top-4", "left-1/2", "-translate-x-1/2"],
6650
- "top-left": ["top-4", "left-4"],
6651
- "top-right": ["top-4", "right-4"]
6642
+ // ── visible ───────────────────────────────────────────────────────────────
6643
+ // spring-standard default effects = 200ms, no overshoot.
6644
+ {
6645
+ animationState: "visible",
6646
+ enterDirection: "up",
6647
+ className: [
6648
+ "opacity-100",
6649
+ "translate-y-0",
6650
+ "duration-spring-standard-default-effects",
6651
+ "ease-spring-standard-default-effects"
6652
+ ]
6653
+ },
6654
+ {
6655
+ animationState: "visible",
6656
+ enterDirection: "down",
6657
+ className: [
6658
+ "opacity-100",
6659
+ "translate-y-0",
6660
+ "duration-spring-standard-default-effects",
6661
+ "ease-spring-standard-default-effects"
6662
+ ]
6663
+ },
6664
+ // ── exiting ───────────────────────────────────────────────────────────────
6665
+ // spring-standard fast effects = 150ms (quicker exit).
6666
+ {
6667
+ animationState: "exiting",
6668
+ enterDirection: "up",
6669
+ className: [
6670
+ "opacity-0",
6671
+ "translate-y-3",
6672
+ "duration-spring-standard-fast-effects",
6673
+ "ease-spring-standard-fast-effects"
6674
+ ]
6675
+ },
6676
+ {
6677
+ animationState: "exiting",
6678
+ enterDirection: "down",
6679
+ className: [
6680
+ "opacity-0",
6681
+ "-translate-y-3",
6682
+ "duration-spring-standard-fast-effects",
6683
+ "ease-spring-standard-fast-effects"
6684
+ ]
6685
+ },
6686
+ // ── exited ────────────────────────────────────────────────────────────────
6687
+ // Hold final position — element is removed from DOM shortly after.
6688
+ {
6689
+ animationState: "exited",
6690
+ enterDirection: "up",
6691
+ className: ["opacity-0", "translate-y-3"]
6652
6692
  },
6653
- twoLine: {
6654
- true: "py-1",
6655
- false: "py-1"
6693
+ {
6694
+ animationState: "exited",
6695
+ enterDirection: "down",
6696
+ className: ["opacity-0", "-translate-y-3"]
6656
6697
  }
6657
- },
6698
+ ],
6658
6699
  defaultVariants: {
6659
6700
  animationState: "entering",
6660
- enterDirection: "up",
6661
- position: "bottom-center",
6662
- twoLine: false
6701
+ enterDirection: "up"
6663
6702
  }
6664
6703
  });
6704
+ classVarianceAuthority.cva(
6705
+ [
6706
+ "min-w-72",
6707
+ "max-w-snackbar-max",
6708
+ "w-max",
6709
+ "pointer-events-auto",
6710
+ "bg-inverse-surface",
6711
+ "rounded-xs",
6712
+ "shadow-elevation-3",
6713
+ "flex",
6714
+ "gap-x-1",
6715
+ "pl-4",
6716
+ "text-body-medium",
6717
+ "text-inverse-on-surface",
6718
+ "transition-[opacity,transform]",
6719
+ "will-change-[opacity,transform]"
6720
+ ],
6721
+ {
6722
+ variants: {
6723
+ twoLine: {
6724
+ false: ["min-h-12", "items-center", "pr-1"],
6725
+ true: ["min-h-[4.25rem]", "items-start", "pr-1"]
6726
+ },
6727
+ animationState: {
6728
+ entering: [],
6729
+ visible: [],
6730
+ exiting: [],
6731
+ exited: []
6732
+ },
6733
+ enterDirection: {
6734
+ up: [],
6735
+ down: []
6736
+ },
6737
+ position: {
6738
+ "bottom-center": ["bottom-4", "left-1/2", "-translate-x-1/2"],
6739
+ "bottom-left": ["bottom-4", "left-4"],
6740
+ "bottom-right": ["bottom-4", "right-4"],
6741
+ "top-center": ["top-4", "left-1/2", "-translate-x-1/2"],
6742
+ "top-left": ["top-4", "left-4"],
6743
+ "top-right": ["top-4", "right-4"]
6744
+ }
6745
+ },
6746
+ compoundVariants: [
6747
+ {
6748
+ animationState: "entering",
6749
+ enterDirection: "up",
6750
+ className: ["opacity-0", "translate-y-3"]
6751
+ },
6752
+ {
6753
+ animationState: "entering",
6754
+ enterDirection: "down",
6755
+ className: ["opacity-0", "-translate-y-3"]
6756
+ },
6757
+ {
6758
+ animationState: "visible",
6759
+ enterDirection: "up",
6760
+ className: [
6761
+ "opacity-100",
6762
+ "translate-y-0",
6763
+ "duration-spring-standard-default-effects",
6764
+ "ease-spring-standard-default-effects"
6765
+ ]
6766
+ },
6767
+ {
6768
+ animationState: "visible",
6769
+ enterDirection: "down",
6770
+ className: [
6771
+ "opacity-100",
6772
+ "translate-y-0",
6773
+ "duration-spring-standard-default-effects",
6774
+ "ease-spring-standard-default-effects"
6775
+ ]
6776
+ },
6777
+ {
6778
+ animationState: "exiting",
6779
+ enterDirection: "up",
6780
+ className: [
6781
+ "opacity-0",
6782
+ "translate-y-3",
6783
+ "duration-spring-standard-fast-effects",
6784
+ "ease-spring-standard-fast-effects"
6785
+ ]
6786
+ },
6787
+ {
6788
+ animationState: "exiting",
6789
+ enterDirection: "down",
6790
+ className: [
6791
+ "opacity-0",
6792
+ "-translate-y-3",
6793
+ "duration-spring-standard-fast-effects",
6794
+ "ease-spring-standard-fast-effects"
6795
+ ]
6796
+ },
6797
+ {
6798
+ animationState: "exited",
6799
+ enterDirection: "up",
6800
+ className: ["opacity-0", "translate-y-3"]
6801
+ },
6802
+ {
6803
+ animationState: "exited",
6804
+ enterDirection: "down",
6805
+ className: ["opacity-0", "-translate-y-3"]
6806
+ }
6807
+ ],
6808
+ defaultVariants: {
6809
+ animationState: "entering",
6810
+ enterDirection: "up",
6811
+ position: "bottom-center",
6812
+ twoLine: false
6813
+ }
6814
+ }
6815
+ );
6816
+ var snackbarContentVariants = classVarianceAuthority.cva([
6817
+ "flex",
6818
+ "flex-col",
6819
+ "flex-1",
6820
+ "min-w-0",
6821
+ "py-3",
6822
+ "pr-2"
6823
+ ]);
6665
6824
  var snackbarMessageVariants = classVarianceAuthority.cva([
6666
6825
  "flex-1",
6667
6826
  "text-body-medium",
@@ -6670,15 +6829,83 @@ var snackbarMessageVariants = classVarianceAuthority.cva([
6670
6829
  var snackbarSupportingTextVariants = classVarianceAuthority.cva([
6671
6830
  "text-body-medium",
6672
6831
  "text-inverse-on-surface",
6673
- "opacity-80"
6832
+ "mt-1"
6674
6833
  ]);
6675
- var snackbarActionVariants = classVarianceAuthority.cva(["shrink-0", "text-inverse-primary"]);
6676
- var snackbarCloseVariants = classVarianceAuthority.cva(["shrink-0", "text-inverse-on-surface"]);
6677
- var snackbarContentVariants = classVarianceAuthority.cva(["flex", "flex-col", "flex-1", "min-w-0 py-2 pr-2"]);
6678
- classVarianceAuthority.cva(["scale-75", "opacity-0"]);
6834
+ classVarianceAuthority.cva(["opacity-0"]);
6679
6835
  function getEnterDirection(position) {
6680
6836
  return position.startsWith("top") ? "down" : "up";
6681
6837
  }
6838
+ var snackbarActionVariants = classVarianceAuthority.cva([
6839
+ // Layout
6840
+ "relative inline-flex items-center justify-center shrink-0",
6841
+ "h-9 px-3",
6842
+ "rounded-full cursor-pointer select-none",
6843
+ // Typography (MD3 text button: label-large)
6844
+ "text-label-large",
6845
+ "text-inverse-primary",
6846
+ // Effects transition (color)
6847
+ "transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
6848
+ // Disabled
6849
+ "data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none",
6850
+ "data-[disabled]:text-on-surface/38"
6851
+ ]);
6852
+ var snackbarActionStateLayerVariants = classVarianceAuthority.cva([
6853
+ "absolute inset-0 rounded-[inherit] overflow-hidden pointer-events-none opacity-0",
6854
+ "bg-inverse-primary",
6855
+ "transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
6856
+ // Hover: 8%
6857
+ "group-data-[hovered]/snackbar-action:opacity-8",
6858
+ // Focus: 10%
6859
+ "group-data-[focus-visible]/snackbar-action:opacity-10",
6860
+ // Pressed: 10%, doubled selector wins over hover
6861
+ "group-data-[pressed]/snackbar-action:group-data-[pressed]/snackbar-action:opacity-10",
6862
+ // No state layer when disabled
6863
+ "group-data-[disabled]/snackbar-action:hidden"
6864
+ ]);
6865
+ var snackbarActionFocusRingVariants = classVarianceAuthority.cva([
6866
+ "pointer-events-none absolute inset-[-3px] rounded-full",
6867
+ "outline outline-2 outline-offset-0 outline-inverse-primary",
6868
+ "transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
6869
+ "opacity-0",
6870
+ "group-data-[focus-visible]/snackbar-action:opacity-100"
6871
+ ]);
6872
+ var snackbarCloseVariants = classVarianceAuthority.cva([
6873
+ // Layout
6874
+ "relative inline-flex items-center justify-center shrink-0",
6875
+ "size-8",
6876
+ "rounded-full cursor-pointer select-none",
6877
+ // Color
6878
+ "text-inverse-on-surface",
6879
+ // Effects transition (color)
6880
+ "transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
6881
+ // Disabled
6882
+ "data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none",
6883
+ "data-[disabled]:text-on-surface/38"
6884
+ ]);
6885
+ var snackbarCloseStateLayerVariants = classVarianceAuthority.cva([
6886
+ "absolute inset-0 rounded-[inherit] overflow-hidden pointer-events-none opacity-0",
6887
+ "bg-inverse-on-surface",
6888
+ "transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
6889
+ // Hover: 8%
6890
+ "group-data-[hovered]/snackbar-close:opacity-8",
6891
+ // Focus: 10%
6892
+ "group-data-[focus-visible]/snackbar-close:opacity-10",
6893
+ // Pressed: 10%, doubled selector wins over hover
6894
+ "group-data-[pressed]/snackbar-close:group-data-[pressed]/snackbar-close:opacity-10",
6895
+ // No state layer when disabled
6896
+ "group-data-[disabled]/snackbar-close:hidden"
6897
+ ]);
6898
+ var snackbarCloseFocusRingVariants = classVarianceAuthority.cva([
6899
+ "pointer-events-none absolute inset-[-3px] rounded-full",
6900
+ "outline outline-2 outline-offset-0 outline-inverse-on-surface",
6901
+ "transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
6902
+ "opacity-0",
6903
+ "group-data-[focus-visible]/snackbar-close:opacity-100"
6904
+ ]);
6905
+ var snackbarCloseIconVariants = classVarianceAuthority.cva([
6906
+ "relative z-10 inline-flex shrink-0 items-center justify-center",
6907
+ "size-6"
6908
+ ]);
6682
6909
  function CloseIcon() {
6683
6910
  return /* @__PURE__ */ jsxRuntime.jsx(
6684
6911
  "svg",
@@ -6693,6 +6920,52 @@ function CloseIcon() {
6693
6920
  }
6694
6921
  );
6695
6922
  }
6923
+ function SnackbarActionButton({ label, onAction }) {
6924
+ const ref = React.useRef(null);
6925
+ const { buttonProps, isPressed } = reactAria.useButton({ onPress: onAction }, ref);
6926
+ const { isHovered, hoverProps } = reactAria.useHover({});
6927
+ const { isFocusVisible, focusProps } = reactAria.useFocusRing();
6928
+ const { onMouseDown, ripples } = useRipple();
6929
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6930
+ "button",
6931
+ {
6932
+ type: "button",
6933
+ ...reactAria.mergeProps(buttonProps, hoverProps, focusProps, { onMouseDown }),
6934
+ ref,
6935
+ className: cn(snackbarActionVariants(), "group/snackbar-action"),
6936
+ ...getInteractionDataAttributes({ isHovered, isFocusVisible, isPressed }),
6937
+ children: [
6938
+ ripples,
6939
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarActionStateLayerVariants(), "aria-hidden": "true" }),
6940
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarActionFocusRingVariants(), "aria-hidden": "true" }),
6941
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10", children: label })
6942
+ ]
6943
+ }
6944
+ );
6945
+ }
6946
+ function SnackbarCloseButton({ onPress }) {
6947
+ const ref = React.useRef(null);
6948
+ const { buttonProps, isPressed } = reactAria.useButton({ onPress, "aria-label": "Close" }, ref);
6949
+ const { isHovered, hoverProps } = reactAria.useHover({});
6950
+ const { isFocusVisible, focusProps } = reactAria.useFocusRing();
6951
+ const { onMouseDown, ripples } = useRipple();
6952
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6953
+ "button",
6954
+ {
6955
+ type: "button",
6956
+ ...reactAria.mergeProps(buttonProps, hoverProps, focusProps, { onMouseDown }),
6957
+ ref,
6958
+ className: cn(snackbarCloseVariants(), "group/snackbar-close"),
6959
+ ...getInteractionDataAttributes({ isHovered, isFocusVisible, isPressed }),
6960
+ children: [
6961
+ ripples,
6962
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarCloseStateLayerVariants(), "aria-hidden": "true" }),
6963
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarCloseFocusRingVariants(), "aria-hidden": "true" }),
6964
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarCloseIconVariants(), "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) })
6965
+ ]
6966
+ }
6967
+ );
6968
+ }
6696
6969
  var Snackbar = React.forwardRef(function Snackbar2({
6697
6970
  message,
6698
6971
  supportingText,
@@ -6705,6 +6978,7 @@ var Snackbar = React.forwardRef(function Snackbar2({
6705
6978
  className
6706
6979
  }, ref) {
6707
6980
  const isTwoLine = Boolean(supportingText);
6981
+ const reducedMotion = useReducedMotion();
6708
6982
  const baseClassName = cn(snackbarBaseVariants({ twoLine: isTwoLine }), className);
6709
6983
  return /* @__PURE__ */ jsxRuntime.jsx(
6710
6984
  SnackbarHeadless,
@@ -6719,31 +6993,22 @@ var Snackbar = React.forwardRef(function Snackbar2({
6719
6993
  position,
6720
6994
  ...onClose !== void 0 && { onClose },
6721
6995
  className: baseClassName,
6722
- getAnimationClassName: (state, pos) => snackbarAnimationVariants({ animationState: state, enterDirection: getEnterDirection(pos) }),
6996
+ getAnimationClassName: (state, pos) => {
6997
+ if (reducedMotion) {
6998
+ return state === "visible" ? "opacity-100 duration-spring-standard-default-effects ease-spring-standard-default-effects" : "opacity-0";
6999
+ }
7000
+ return snackbarAnimationVariants({
7001
+ animationState: state,
7002
+ enterDirection: getEnterDirection(pos)
7003
+ });
7004
+ },
6723
7005
  children: ({ onClose: triggerClose }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6724
7006
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: snackbarContentVariants(), children: [
6725
7007
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarMessageVariants(), children: message }),
6726
7008
  supportingText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarSupportingTextVariants(), children: supportingText })
6727
7009
  ] }),
6728
- action && /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarActionVariants(), children: /* @__PURE__ */ jsxRuntime.jsx(
6729
- Button,
6730
- {
6731
- variant: "text",
6732
- onPress: action.onAction,
6733
- className: "text-inverse-primary hover:text-inverse-primary px-3",
6734
- children: action.label
6735
- }
6736
- ) }),
6737
- showClose && /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarCloseVariants(), children: /* @__PURE__ */ jsxRuntime.jsx(
6738
- IconButton,
6739
- {
6740
- variant: "standard",
6741
- "aria-label": "Close",
6742
- onPress: triggerClose,
6743
- className: "text-inverse-on-surface hover:text-inverse-on-surface",
6744
- children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {})
6745
- }
6746
- ) })
7010
+ action && /* @__PURE__ */ jsxRuntime.jsx(SnackbarActionButton, { label: action.label, onAction: action.onAction }),
7011
+ showClose && /* @__PURE__ */ jsxRuntime.jsx(SnackbarCloseButton, { onPress: triggerClose })
6747
7012
  ] })
6748
7013
  }
6749
7014
  );
@@ -10414,9 +10679,12 @@ function SliderThumbInternal({
10414
10679
  state,
10415
10680
  trackRef,
10416
10681
  isDisabled,
10682
+ orientation,
10417
10683
  formatValue: formatValue2,
10418
10684
  className,
10419
10685
  "data-direction": dataDirection,
10686
+ renderContent,
10687
+ onDraggingChange,
10420
10688
  ...ariaProps
10421
10689
  }) {
10422
10690
  const inputRef = React.useRef(null);
@@ -10431,33 +10699,70 @@ function SliderThumbInternal({
10431
10699
  state
10432
10700
  );
10433
10701
  const { isFocusVisible, focusProps } = reactAria.useFocusRing();
10702
+ const { isHovered, hoverProps } = reactAria.useHover({ isDisabled });
10703
+ React.useEffect(() => {
10704
+ onDraggingChange?.(isDragging);
10705
+ }, [isDragging, onDraggingChange]);
10434
10706
  const currentValue = state.getThumbValue(index);
10435
10707
  const ariaValueText = formatValue2 ? formatValue2(currentValue) : void 0;
10436
- return /* @__PURE__ */ jsxRuntime.jsx(
10708
+ const thumbPercent = state.getThumbPercent(index);
10709
+ const positionStyle = orientation === "horizontal" ? {
10710
+ position: "absolute",
10711
+ left: `${thumbPercent * 100}%`,
10712
+ top: "50%",
10713
+ transform: "translate(-50%, -50%)",
10714
+ zIndex: 10
10715
+ } : {
10716
+ position: "absolute",
10717
+ bottom: `${thumbPercent * 100}%`,
10718
+ left: "50%",
10719
+ transform: "translate(-50%, 50%)",
10720
+ zIndex: 10
10721
+ };
10722
+ const renderState = {
10723
+ index,
10724
+ value: currentValue,
10725
+ isDragging,
10726
+ isFocusVisible,
10727
+ isHovered,
10728
+ isDisabled
10729
+ };
10730
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10437
10731
  "div",
10438
10732
  {
10439
- ...thumbProps,
10733
+ ...reactAria.mergeProps(thumbProps, hoverProps, { style: positionStyle }),
10734
+ "data-slot": "slider-thumb",
10440
10735
  "data-dragging": isDragging || void 0,
10441
10736
  "data-focused": isFocused || void 0,
10442
- "data-focus-visible": isFocusVisible || void 0,
10443
- "data-disabled": isDisabled || void 0,
10444
10737
  ...dataDirection !== void 0 ? { "data-direction": dataDirection } : {},
10738
+ ...getInteractionDataAttributes({
10739
+ isHovered,
10740
+ isFocusVisible,
10741
+ isPressed: isDragging,
10742
+ isDisabled
10743
+ }),
10445
10744
  className: cn(
10745
+ // Group scope: interaction selectors on children target this element
10746
+ "group/slider-thumb",
10747
+ // Accessibility: remove default outline (custom focus ring via data-[focus-visible])
10446
10748
  "outline-none",
10447
- // Focus ring visible only on keyboard focus — matches project pattern (md3-design.mdc §Accessibility)
10749
+ // Focus ring visible only on keyboard focus — matches project pattern
10448
10750
  "data-[focus-visible]:ring-3",
10449
10751
  "data-[focus-visible]:ring-secondary",
10450
10752
  "data-[focus-visible]:ring-offset-2",
10451
10753
  className
10452
10754
  ),
10453
- children: /* @__PURE__ */ jsxRuntime.jsx(reactAria.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
10454
- "input",
10455
- {
10456
- ref: inputRef,
10457
- ...reactAria.mergeProps(inputProps, focusProps),
10458
- ...ariaValueText !== void 0 ? { "aria-valuetext": ariaValueText } : {}
10459
- }
10460
- ) })
10755
+ children: [
10756
+ /* @__PURE__ */ jsxRuntime.jsx(reactAria.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
10757
+ "input",
10758
+ {
10759
+ ref: inputRef,
10760
+ ...reactAria.mergeProps(inputProps, focusProps),
10761
+ ...ariaValueText !== void 0 ? { "aria-valuetext": ariaValueText } : {}
10762
+ }
10763
+ ) }),
10764
+ renderContent?.(renderState)
10765
+ ]
10461
10766
  }
10462
10767
  );
10463
10768
  }
@@ -10480,6 +10785,9 @@ var SliderHeadless = React.forwardRef(
10480
10785
  className,
10481
10786
  style,
10482
10787
  children,
10788
+ trackClassName,
10789
+ renderThumbContent,
10790
+ onThumbDraggingChange,
10483
10791
  ...ariaProps
10484
10792
  } = props;
10485
10793
  const trackRef = React.useRef(null);
@@ -10541,7 +10849,18 @@ var SliderHeadless = React.forwardRef(
10541
10849
  "data-variant": variant,
10542
10850
  ...zeroPercent !== void 0 ? { "data-zero-percent": zeroPercent } : {},
10543
10851
  children: [
10544
- label && /* @__PURE__ */ jsxRuntime.jsx("label", { ...labelProps, children: label }),
10852
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { ...labelProps, className: cn(orientation === "vertical" && "sr-only"), children: label }),
10853
+ /* @__PURE__ */ jsxRuntime.jsx(
10854
+ "output",
10855
+ {
10856
+ ...outputProps,
10857
+ className: cn(
10858
+ orientation === "horizontal" && "justify-self-end",
10859
+ orientation === "vertical" && "sr-only"
10860
+ ),
10861
+ children: isRange ? formatValue2 ? `${formatValue2(state.getThumbValue(0))} \u2013 ${formatValue2(state.getThumbValue(1))}` : `${state.getThumbValueLabel(0)} \u2013 ${state.getThumbValueLabel(1)}` : formatValue2 ? formatValue2(state.getThumbValue(0)) : state.getThumbValueLabel(0)
10862
+ }
10863
+ ),
10545
10864
  /* @__PURE__ */ jsxRuntime.jsxs(
10546
10865
  "div",
10547
10866
  {
@@ -10550,6 +10869,10 @@ var SliderHeadless = React.forwardRef(
10550
10869
  "data-orientation": orientation,
10551
10870
  "data-track": true,
10552
10871
  ...zeroPercent !== void 0 ? { "data-zero-percent": zeroPercent } : {},
10872
+ className: cn(
10873
+ trackClassName ?? "relative w-full",
10874
+ orientation === "vertical" && !trackClassName && "h-full"
10875
+ ),
10553
10876
  children: [
10554
10877
  children,
10555
10878
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -10559,9 +10882,12 @@ var SliderHeadless = React.forwardRef(
10559
10882
  state,
10560
10883
  trackRef,
10561
10884
  isDisabled,
10885
+ orientation,
10562
10886
  ...formatValue2 !== void 0 ? { formatValue: formatValue2 } : {},
10563
10887
  ...thumb0Label !== void 0 ? { "aria-label": thumb0Label } : {},
10564
- ...direction !== void 0 ? { "data-direction": direction } : {}
10888
+ ...direction !== void 0 ? { "data-direction": direction } : {},
10889
+ ...renderThumbContent !== void 0 ? { renderContent: renderThumbContent } : {},
10890
+ ...onThumbDraggingChange !== void 0 ? { onDraggingChange: (d) => onThumbDraggingChange(0, d) } : {}
10565
10891
  }
10566
10892
  ),
10567
10893
  isRange && /* @__PURE__ */ jsxRuntime.jsx(
@@ -10571,144 +10897,174 @@ var SliderHeadless = React.forwardRef(
10571
10897
  state,
10572
10898
  trackRef,
10573
10899
  isDisabled,
10900
+ orientation,
10574
10901
  ...formatValue2 !== void 0 ? { formatValue: formatValue2 } : {},
10575
- "aria-label": thumbLabels?.[1] ?? "Maximum"
10902
+ "aria-label": thumbLabels?.[1] ?? "Maximum",
10903
+ ...renderThumbContent !== void 0 ? { renderContent: renderThumbContent } : {},
10904
+ ...onThumbDraggingChange !== void 0 ? { onDraggingChange: (d) => onThumbDraggingChange(1, d) } : {}
10576
10905
  }
10577
10906
  )
10578
10907
  ]
10579
10908
  }
10580
- ),
10581
- /* @__PURE__ */ jsxRuntime.jsx("output", { ...outputProps, children: isRange ? formatValue2 ? `${formatValue2(state.getThumbValue(0))} \u2013 ${formatValue2(state.getThumbValue(1))}` : `${state.getThumbValueLabel(0)} \u2013 ${state.getThumbValueLabel(1)}` : formatValue2 ? formatValue2(state.getThumbValue(0)) : state.getThumbValueLabel(0) })
10909
+ )
10582
10910
  ]
10583
10911
  }
10584
10912
  );
10585
10913
  }
10586
10914
  );
10587
10915
  SliderHeadless.displayName = "SliderHeadless";
10588
- var sliderContainerVariants = classVarianceAuthority.cva(
10589
- [
10590
- "relative",
10591
- "flex",
10592
- "items-center",
10593
- "w-full",
10594
- "touch-none",
10595
- // NOTE: measurement-derived value from MD3 spec; permitted exception — prevents browser scroll on drag
10596
- "select-none"
10597
- ],
10598
- {
10599
- variants: {
10600
- size: {
10601
- // NOTE: measurement-derived values from MD3 spec §4.2; permitted exception
10602
- xsmall: "h-[44px]",
10603
- small: "h-[44px]",
10604
- medium: "h-[52px]",
10605
- large: "h-[68px]",
10606
- xlarge: "h-[108px]"
10607
- },
10608
- orientation: {
10609
- // Horizontal: w-full already in base; flex-row is default flex direction
10610
- horizontal: "",
10611
- // Vertical: transposed — container height fills parent, width = handle height (per size)
10612
- // flex-col stacks label → track → output vertically
10613
- // NOTE: h-full requires a parent with defined height; w-[...] set via compound variants
10614
- vertical: "h-full flex-col"
10615
- },
10616
- disabled: {
10617
- true: "cursor-not-allowed pointer-events-none",
10618
- false: "cursor-pointer"
10619
- }
10916
+ var sliderContainerVariants = classVarianceAuthority.cva(["group/slider", "relative", "select-none"], {
10917
+ variants: {
10918
+ orientation: {
10919
+ // Grid: 1fr for label, auto for output value; gap-x for label↔output spacing
10920
+ horizontal: "grid grid-cols-[1fr_auto] items-center gap-x-2 w-full",
10921
+ // Flex column: label → track → output stacked; width = handle height (per size)
10922
+ vertical: "flex flex-col items-center h-full"
10620
10923
  },
10621
- compoundVariants: [
10622
- // Vertical: container WIDTH = handle height (MD3 §10.9 — dimensions transposed)
10623
- // Overrides w-full from base via tailwind-merge in cn()
10924
+ size: {
10925
+ // Vertical orientation: container width = handle height (dimensions transposed)
10926
+ // Applied only for vertical via compoundVariants below
10624
10927
  // NOTE: measurement-derived values from MD3 spec §4.2; permitted exception
10625
- { orientation: "vertical", size: "xsmall", className: "w-[44px]" },
10626
- { orientation: "vertical", size: "small", className: "w-[44px]" },
10627
- { orientation: "vertical", size: "medium", className: "w-[52px]" },
10628
- { orientation: "vertical", size: "large", className: "w-[68px]" },
10629
- { orientation: "vertical", size: "xlarge", className: "w-[108px]" }
10630
- ],
10631
- defaultVariants: {
10632
- size: "xsmall",
10633
- orientation: "horizontal",
10634
- disabled: false
10928
+ xsmall: "",
10929
+ small: "",
10930
+ medium: "",
10931
+ large: "",
10932
+ xlarge: ""
10635
10933
  }
10934
+ },
10935
+ compoundVariants: [
10936
+ // Vertical: container WIDTH = handle height (MD3 §10.9 — dimensions transposed)
10937
+ // NOTE: measurement-derived values from MD3 spec §4.2; permitted exception
10938
+ { orientation: "vertical", size: "xsmall", class: "w-[44px]" },
10939
+ { orientation: "vertical", size: "small", class: "w-[44px]" },
10940
+ { orientation: "vertical", size: "medium", class: "w-[52px]" },
10941
+ { orientation: "vertical", size: "large", class: "w-[68px]" },
10942
+ { orientation: "vertical", size: "xlarge", class: "w-[108px]" }
10943
+ ],
10944
+ defaultVariants: {
10945
+ orientation: "horizontal",
10946
+ size: "xsmall"
10636
10947
  }
10637
- );
10948
+ });
10949
+ var sliderTrackRegionVariants = classVarianceAuthority.cva(["relative", "touch-none"], {
10950
+ variants: {
10951
+ orientation: {
10952
+ horizontal: "col-span-2 w-full",
10953
+ // flex-1 fills the vertical container reliably; h-full collapses when the
10954
+ // container itself is a flex item without an explicit pixel height (CSS spec).
10955
+ // min-h-0 allows the flex child to shrink below its natural size if needed.
10956
+ vertical: "flex-1 min-h-0"
10957
+ },
10958
+ size: {
10959
+ // Horizontal: size controls track region HEIGHT (= handle height)
10960
+ // Vertical: size controls track region WIDTH (= handle height, dimensions transposed)
10961
+ // Applied as compound variants below to avoid cross-orientation conflicts
10962
+ xsmall: "",
10963
+ small: "",
10964
+ medium: "",
10965
+ large: "",
10966
+ xlarge: ""
10967
+ }
10968
+ },
10969
+ compoundVariants: [
10970
+ // Horizontal: height = handle height per MD3 §4.2
10971
+ { orientation: "horizontal", size: "xsmall", class: "h-[44px]" },
10972
+ { orientation: "horizontal", size: "small", class: "h-[44px]" },
10973
+ { orientation: "horizontal", size: "medium", class: "h-[52px]" },
10974
+ { orientation: "horizontal", size: "large", class: "h-[68px]" },
10975
+ { orientation: "horizontal", size: "xlarge", class: "h-[108px]" },
10976
+ // Vertical: width = handle height (transposed per MD3 §10.9)
10977
+ { orientation: "vertical", size: "xsmall", class: "w-[44px]" },
10978
+ { orientation: "vertical", size: "small", class: "w-[44px]" },
10979
+ { orientation: "vertical", size: "medium", class: "w-[52px]" },
10980
+ { orientation: "vertical", size: "large", class: "w-[68px]" },
10981
+ { orientation: "vertical", size: "xlarge", class: "w-[108px]" }
10982
+ ],
10983
+ defaultVariants: {
10984
+ orientation: "horizontal",
10985
+ size: "xsmall"
10986
+ }
10987
+ });
10988
+ var sliderTrackLayoutVariants = classVarianceAuthority.cva(["absolute", "inset-0", "pointer-events-none"]);
10638
10989
  var sliderActiveTrackVariants = classVarianceAuthority.cva(
10639
- ["bg-primary", "flex-shrink-0", "overflow-hidden", "relative"],
10990
+ [
10991
+ // Color
10992
+ "bg-primary",
10993
+ // Disabled — driven by root group/slider data-disabled attr
10994
+ "group-data-[disabled]/slider:bg-on-surface",
10995
+ "group-data-[disabled]/slider:opacity-38",
10996
+ // Layout — absolute fill within the track region
10997
+ "absolute",
10998
+ "overflow-hidden"
10999
+ ],
10640
11000
  {
10641
11001
  variants: {
10642
11002
  size: {
10643
- // NOTE: measurement-derived values from MD3 spec §4.2, §6 Corner tokens; permitted exception
10644
- // Corner classes are in compound variants to avoid conflicts with vertical orientation corners
11003
+ // Horizontal: left (start) = outer corner, right (near handle) = 2dp inner
11004
+ // NOTE: measurement-derived values from MD3 spec §4.2, §6; permitted exception
10645
11005
  xsmall: "h-[16px] rounded-l-[16px] rounded-r-[2px]",
10646
- // corner.large outer (16dp), 2dp inner
10647
11006
  small: "h-[16px] rounded-l-[16px] rounded-r-[2px]",
10648
11007
  medium: "h-[40px] rounded-l-[12px] rounded-r-[2px]",
10649
- // corner.medium outer (12dp), 2dp inner
10650
11008
  large: "h-[56px] rounded-l-[16px] rounded-r-[2px]",
10651
- // corner.large outer (16dp), 2dp inner
10652
11009
  xlarge: "h-[96px] rounded-l-[28px] rounded-r-[2px]"
10653
- // corner.extra-large outer (28dp), 2dp inner
10654
11010
  },
10655
11011
  orientation: {
10656
- horizontal: "",
10657
- // Vertical: track thickness is now width; flex-basis (inline style) controls height.
10658
- // h-[...] from size variant is overridden by flex-basis in a flex-col container.
10659
- // Individual corner classes (rounded-tl/tr/bl/br) override the horizontal rounded-l/r
10660
- // via tailwind-merge conflict resolution in cn().
10661
- vertical: ""
10662
- },
10663
- disabled: {
10664
- true: "bg-on-surface opacity-38",
10665
- false: ""
11012
+ // Horizontal: center vertically within track region
11013
+ horizontal: "top-1/2 -translate-y-1/2",
11014
+ // Vertical: center horizontally; length controlled by inline top/height styles
11015
+ vertical: "left-1/2 -translate-x-1/2"
10666
11016
  }
10667
11017
  },
10668
11018
  compoundVariants: [
10669
- // Vertical: width = track thickness, corners transposed (bottom = outer, top = inner near handle)
10670
- // Using individual corner utilities so tailwind-merge correctly resolves conflicts with
10671
- // the horizontal rounded-l/rounded-r classes from size variants.
10672
- // NOTE: measurement-derived values from MD3 spec §4.2, §6 Corner tokens; permitted exception
11019
+ // Vertical: width = track thickness; bottom = outer corner, top = 2dp inner (near handle)
11020
+ // NOTE: measurement-derived values from MD3 spec §4.2, §6; permitted exception
10673
11021
  {
10674
11022
  orientation: "vertical",
10675
11023
  size: "xsmall",
10676
- className: "w-[16px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[16px] rounded-br-[16px]"
11024
+ class: "w-[16px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[16px] rounded-br-[16px]"
10677
11025
  },
10678
11026
  {
10679
11027
  orientation: "vertical",
10680
11028
  size: "small",
10681
- className: "w-[16px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[16px] rounded-br-[16px]"
11029
+ class: "w-[16px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[16px] rounded-br-[16px]"
10682
11030
  },
10683
11031
  {
10684
11032
  orientation: "vertical",
10685
11033
  size: "medium",
10686
- className: "w-[40px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[12px] rounded-br-[12px]"
11034
+ class: "w-[40px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[12px] rounded-br-[12px]"
10687
11035
  },
10688
11036
  {
10689
11037
  orientation: "vertical",
10690
11038
  size: "large",
10691
- className: "w-[56px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[16px] rounded-br-[16px]"
11039
+ class: "w-[56px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[16px] rounded-br-[16px]"
10692
11040
  },
10693
11041
  {
10694
11042
  orientation: "vertical",
10695
11043
  size: "xlarge",
10696
- className: "w-[96px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[28px] rounded-br-[28px]"
11044
+ class: "w-[96px] rounded-tl-[2px] rounded-tr-[2px] rounded-bl-[28px] rounded-br-[28px]"
10697
11045
  }
10698
11046
  ],
10699
11047
  defaultVariants: {
10700
11048
  size: "xsmall",
10701
- orientation: "horizontal",
10702
- disabled: false
11049
+ orientation: "horizontal"
10703
11050
  }
10704
11051
  }
10705
11052
  );
10706
11053
  var sliderInactiveTrackVariants = classVarianceAuthority.cva(
10707
- ["bg-secondary-container", "flex-1", "overflow-hidden", "relative"],
11054
+ [
11055
+ // Color
11056
+ "bg-secondary-container",
11057
+ // Disabled — driven by root group/slider data-disabled attr
11058
+ "group-data-[disabled]/slider:bg-on-surface/10",
11059
+ // Layout — absolute fill within the track region
11060
+ "absolute",
11061
+ "overflow-hidden"
11062
+ ],
10708
11063
  {
10709
11064
  variants: {
10710
11065
  size: {
10711
- // NOTE: measurement-derived values from MD3 spec §4.2, §6 Corner tokens; permitted exception
11066
+ // Horizontal: left (near handle) = 2dp inner, right (end) = outer corner
11067
+ // NOTE: measurement-derived values from MD3 spec §4.2, §6; permitted exception
10712
11068
  xsmall: "h-[16px] rounded-l-[2px] rounded-r-[16px]",
10713
11069
  small: "h-[16px] rounded-l-[2px] rounded-r-[16px]",
10714
11070
  medium: "h-[40px] rounded-l-[2px] rounded-r-[12px]",
@@ -10716,68 +11072,65 @@ var sliderInactiveTrackVariants = classVarianceAuthority.cva(
10716
11072
  xlarge: "h-[96px] rounded-l-[2px] rounded-r-[28px]"
10717
11073
  },
10718
11074
  orientation: {
10719
- horizontal: "",
10720
- // Vertical: track thickness is width; flex-1 controls height growth.
10721
- // Individual corner classes override horizontal rounded-l/r via tailwind-merge.
10722
- vertical: ""
10723
- },
10724
- disabled: {
10725
- true: "bg-on-surface/10",
10726
- // MD3 §8.2: 10% opacity via background alpha
10727
- false: ""
11075
+ // Horizontal: center vertically within track region
11076
+ horizontal: "top-1/2 -translate-y-1/2",
11077
+ // Vertical: center horizontally; length controlled by inline top/height styles
11078
+ vertical: "left-1/2 -translate-x-1/2"
10728
11079
  }
10729
11080
  },
10730
11081
  compoundVariants: [
10731
- // Vertical: width = track thickness, corners transposed (top = outer, bottom = inner near handle)
10732
- // NOTE: measurement-derived values from MD3 spec §4.2, §6 Corner tokens; permitted exception
11082
+ // Vertical: width = track thickness; top = outer corner, bottom = 2dp inner (near handle)
11083
+ // NOTE: measurement-derived values from MD3 spec §4.2, §6; permitted exception
10733
11084
  {
10734
11085
  orientation: "vertical",
10735
11086
  size: "xsmall",
10736
- className: "w-[16px] rounded-tl-[16px] rounded-tr-[16px] rounded-bl-[2px] rounded-br-[2px]"
11087
+ class: "w-[16px] rounded-tl-[16px] rounded-tr-[16px] rounded-bl-[2px] rounded-br-[2px]"
10737
11088
  },
10738
11089
  {
10739
11090
  orientation: "vertical",
10740
11091
  size: "small",
10741
- className: "w-[16px] rounded-tl-[16px] rounded-tr-[16px] rounded-bl-[2px] rounded-br-[2px]"
11092
+ class: "w-[16px] rounded-tl-[16px] rounded-tr-[16px] rounded-bl-[2px] rounded-br-[2px]"
10742
11093
  },
10743
11094
  {
10744
11095
  orientation: "vertical",
10745
11096
  size: "medium",
10746
- className: "w-[40px] rounded-tl-[12px] rounded-tr-[12px] rounded-bl-[2px] rounded-br-[2px]"
11097
+ class: "w-[40px] rounded-tl-[12px] rounded-tr-[12px] rounded-bl-[2px] rounded-br-[2px]"
10747
11098
  },
10748
11099
  {
10749
11100
  orientation: "vertical",
10750
11101
  size: "large",
10751
- className: "w-[56px] rounded-tl-[16px] rounded-tr-[16px] rounded-bl-[2px] rounded-br-[2px]"
11102
+ class: "w-[56px] rounded-tl-[16px] rounded-tr-[16px] rounded-bl-[2px] rounded-br-[2px]"
10752
11103
  },
10753
11104
  {
10754
11105
  orientation: "vertical",
10755
11106
  size: "xlarge",
10756
- className: "w-[96px] rounded-tl-[28px] rounded-tr-[28px] rounded-bl-[2px] rounded-br-[2px]"
11107
+ class: "w-[96px] rounded-tl-[28px] rounded-tr-[28px] rounded-bl-[2px] rounded-br-[2px]"
10757
11108
  }
10758
11109
  ],
10759
11110
  defaultVariants: {
10760
11111
  size: "xsmall",
10761
- orientation: "horizontal",
10762
- disabled: false
11112
+ orientation: "horizontal"
10763
11113
  }
10764
11114
  }
10765
11115
  );
10766
11116
  var sliderHandleVariants = classVarianceAuthority.cva(
10767
11117
  [
11118
+ // Color
10768
11119
  "bg-primary",
11120
+ // Disabled — driven by thumb group/slider-thumb data-disabled attr
11121
+ "group-data-[disabled]/slider-thumb:bg-on-surface",
11122
+ "group-data-[disabled]/slider-thumb:opacity-38",
11123
+ // Pressed width (MD3: 4dp → 2dp on press, spatial spring)
11124
+ "group-data-[pressed]/slider-thumb:w-[2px]",
11125
+ // Shape
10769
11126
  "rounded-[2px]",
10770
- // NOTE: measurement-derived value from MD3 spec §10.3 (2dp handle border-radius); permitted exception
11127
+ // Layout
10771
11128
  "flex-shrink-0",
10772
- "relative",
10773
- "z-10",
10774
- "outline-none"
10775
- // Motion classes applied conditionally in Slider.tsx via useReducedMotion guard
11129
+ "pointer-events-none"
10776
11130
  ],
10777
11131
  {
10778
11132
  variants: {
10779
11133
  size: {
10780
- // NOTE: measurement-derived values from MD3 spec §4.2, §10.3; permitted exception
10781
11134
  xsmall: "w-[4px] h-[44px]",
10782
11135
  small: "w-[4px] h-[44px]",
10783
11136
  medium: "w-[4px] h-[52px]",
@@ -10786,79 +11139,99 @@ var sliderHandleVariants = classVarianceAuthority.cva(
10786
11139
  },
10787
11140
  orientation: {
10788
11141
  horizontal: "",
10789
- // Vertical: dimensions transposed. h-[4px] overrides size-variant h-[...] via tailwind-merge;
10790
- // w-full overrides size-variant w-[4px] via tailwind-merge (both in cn() call at styled layer).
10791
- // NOTE: measurement-derived value from MD3 spec §10.3 (4dp handle width); permitted exception
10792
- vertical: "h-[4px] w-full"
10793
- },
10794
- pressed: {
10795
- true: "w-[2px]",
10796
- // NOTE: measurement-derived value from MD3 spec §10.3 (2dp pressed width); permitted exception
10797
- false: ""
10798
- },
10799
- disabled: {
10800
- true: "bg-on-surface opacity-38",
10801
- false: ""
11142
+ // Vertical: handle is a thin horizontal bar. h-[4px] overrides the base
11143
+ // h-[44px..108px]. Width is explicitly set per size below so the RA thumb
11144
+ // (which is shrink-to-fit) assumes the correct measured width this also
11145
+ // fixes the hit-area (w-full) and state-layer (inset-0) widths.
11146
+ vertical: "h-[4px]"
10802
11147
  }
10803
11148
  },
11149
+ compoundVariants: [
11150
+ // Vertical: override to height-based narrowing on press
11151
+ {
11152
+ orientation: "vertical",
11153
+ class: "group-data-[pressed]/slider-thumb:h-[2px]"
11154
+ },
11155
+ // Vertical per-size widths (transposed handle length = track region width per MD3 §10.9)
11156
+ // NOTE: measurement-derived values from MD3 spec §4.2; permitted exception
11157
+ { orientation: "vertical", size: "xsmall", class: "w-[44px]" },
11158
+ { orientation: "vertical", size: "small", class: "w-[44px]" },
11159
+ { orientation: "vertical", size: "medium", class: "w-[52px]" },
11160
+ { orientation: "vertical", size: "large", class: "w-[68px]" },
11161
+ { orientation: "vertical", size: "xlarge", class: "w-[108px]" }
11162
+ ],
10804
11163
  defaultVariants: {
10805
11164
  size: "xsmall",
10806
- orientation: "horizontal",
10807
- pressed: false,
10808
- disabled: false
10809
- }
10810
- }
10811
- );
10812
- var sliderHandleStateLayerVariants = classVarianceAuthority.cva(
10813
- [
10814
- "absolute",
10815
- "inset-0",
10816
- "rounded-[4px]",
10817
- // NOTE: measurement-derived value from MD3 spec §10.3 (4dp state layer border-radius); permitted exception
10818
- "bg-on-primary",
10819
- "pointer-events-none"
10820
- // Motion classes applied conditionally in Slider.tsx via useReducedMotion guard
10821
- ],
10822
- {
10823
- variants: {
10824
- state: {
10825
- enabled: "opacity-0",
10826
- hovered: "opacity-8",
10827
- // MD3 §8.3: 8% hover
10828
- pressed: "opacity-10",
10829
- // MD3 §8.3: 10% pressed
10830
- focused: "opacity-10",
10831
- // MD3 §8.3: 10% focus
10832
- disabled: "opacity-0"
10833
- }
10834
- },
10835
- defaultVariants: {
10836
- state: "enabled"
11165
+ orientation: "horizontal"
10837
11166
  }
10838
11167
  }
10839
11168
  );
10840
- var sliderTrackLayoutVariants = classVarianceAuthority.cva(
10841
- [
10842
- "relative",
10843
- "flex",
10844
- "items-center",
10845
- "gap-[6px]"
10846
- // NOTE: measurement-derived value from MD3 spec §2, §6 (thumbTrackGapSize: 6dp); permitted exception
10847
- ],
10848
- {
10849
- variants: {
10850
- orientation: {
10851
- // Horizontal: full width, left-to-right fill
10852
- horizontal: "flex-row w-full",
10853
- // Vertical: full height, bottom-to-top fill (flex-col-reverse places active track at bottom)
10854
- vertical: "flex-col-reverse h-full"
10855
- }
11169
+ var sliderHandleStateLayerVariants = classVarianceAuthority.cva([
11170
+ // Color
11171
+ "bg-primary",
11172
+ // Positioning — covers the handle
11173
+ "absolute",
11174
+ "inset-0",
11175
+ "rounded-[2px]",
11176
+ // Interaction: hidden by default
11177
+ "opacity-0",
11178
+ "pointer-events-none",
11179
+ // State opacities — driven by group/slider-thumb data attrs
11180
+ "group-data-[hovered]/slider-thumb:opacity-8",
11181
+ "group-data-[focus-visible]/slider-thumb:opacity-10",
11182
+ "group-data-[pressed]/slider-thumb:opacity-10",
11183
+ // Disabled: hide state layer (no interaction feedback)
11184
+ "group-data-[disabled]/slider-thumb:hidden",
11185
+ // Motion: effects spring (opacity transition only)
11186
+ "transition-opacity",
11187
+ "duration-spring-standard-fast-effects",
11188
+ "ease-spring-standard-fast-effects"
11189
+ ]);
11190
+ var sliderValueIndicatorVariants = classVarianceAuthority.cva([
11191
+ // Positioning: float above handle center
11192
+ "absolute",
11193
+ "left-1/2",
11194
+ "-translate-x-1/2",
11195
+ "bottom-[calc(100%+4px)]",
11196
+ // Shape & color
11197
+ "bg-inverse-surface",
11198
+ "rounded-full",
11199
+ "px-[12px]",
11200
+ "py-[6px]",
11201
+ "min-w-[48px]",
11202
+ "text-center",
11203
+ // Hidden by default; revealed when thumb group has data-pressed
11204
+ "opacity-0",
11205
+ "scale-0",
11206
+ "group-data-[pressed]/slider-thumb:opacity-100",
11207
+ "group-data-[pressed]/slider-thumb:scale-100",
11208
+ // Prevent interaction (value display only)
11209
+ "pointer-events-none",
11210
+ // Z-index above track overlays
11211
+ "z-10",
11212
+ // In Tailwind v4, scale-* maps to the CSS `scale` property (not `transform`),
11213
+ // so we must list `scale` here — not `transform` — to animate the reveal.
11214
+ "will-change-[scale,opacity]"
11215
+ ]);
11216
+ var sliderStopDotVariants = classVarianceAuthority.cva(["rounded-full", "flex-shrink-0", "pointer-events-none"], {
11217
+ variants: {
11218
+ region: {
11219
+ active: "bg-on-primary",
11220
+ inactive: "bg-on-secondary-container"
10856
11221
  },
10857
- defaultVariants: {
10858
- orientation: "horizontal"
11222
+ size: {
11223
+ xsmall: "w-[4px] h-[4px]",
11224
+ small: "w-[4px] h-[4px]",
11225
+ medium: "w-[6px] h-[6px]",
11226
+ large: "w-[6px] h-[6px]",
11227
+ xlarge: "w-[8px] h-[8px]"
10859
11228
  }
11229
+ },
11230
+ defaultVariants: {
11231
+ region: "inactive",
11232
+ size: "xsmall"
10860
11233
  }
10861
- );
11234
+ });
10862
11235
  var sliderStopsContainerVariants = classVarianceAuthority.cva([
10863
11236
  "absolute",
10864
11237
  "inset-0",
@@ -10866,58 +11239,22 @@ var sliderStopsContainerVariants = classVarianceAuthority.cva([
10866
11239
  "items-center",
10867
11240
  "justify-between",
10868
11241
  "px-[4px]",
10869
- // NOTE: measurement-derived value from MD3 spec §10.5 (stopPadding: 4dp); permitted exception
10870
11242
  "pointer-events-none",
10871
- "z-0"
11243
+ "z-10"
10872
11244
  ]);
10873
- var sliderStopDotVariants = classVarianceAuthority.cva(
10874
- [
10875
- "rounded-full",
10876
- "flex-shrink-0",
10877
- "w-[4px]",
10878
- // NOTE: measurement-derived value from MD3 spec §10.5 (stopIndicatorSize: 4dp); permitted exception
10879
- "h-[4px]"
10880
- ],
10881
- {
10882
- variants: {
10883
- /**
10884
- * Whether this dot is positioned on the active track portion.
10885
- * Determines the dot color per MD3 spec §5.2.
10886
- */
10887
- onActiveTrack: {
10888
- true: "bg-on-primary",
10889
- // Light dots on primary background
10890
- false: "bg-on-secondary-container"
10891
- // Dark dots on secondary-container background
10892
- },
10893
- disabled: {
10894
- true: "opacity-38",
10895
- false: ""
10896
- }
10897
- },
10898
- defaultVariants: {
10899
- onActiveTrack: false,
10900
- disabled: false
10901
- }
10902
- }
10903
- );
10904
11245
  var sliderTrackStopVariants = classVarianceAuthority.cva(
10905
11246
  [
10906
11247
  "absolute",
10907
- "top-1/2",
10908
- "-translate-y-1/2",
10909
- "w-[4px]",
10910
- // NOTE: measurement-derived value from MD3 spec §10.6 (trackStopDiameter: 4dp); permitted exception
10911
- "h-[4px]",
10912
11248
  "rounded-full",
10913
11249
  "bg-on-secondary-container",
10914
- "pointer-events-none"
11250
+ "pointer-events-none",
11251
+ "w-[4px]",
11252
+ "h-[4px]"
10915
11253
  ],
10916
11254
  {
10917
11255
  variants: {
10918
11256
  position: {
10919
11257
  start: "left-[4px]",
10920
- // NOTE: measurement-derived (trackStopOffset: 4dp); permitted exception
10921
11258
  end: "right-[4px]"
10922
11259
  }
10923
11260
  },
@@ -10926,64 +11263,23 @@ var sliderTrackStopVariants = classVarianceAuthority.cva(
10926
11263
  }
10927
11264
  }
10928
11265
  );
10929
- var sliderValueIndicatorVariants = classVarianceAuthority.cva(
10930
- [
10931
- "absolute",
10932
- "left-1/2",
10933
- "-translate-x-1/2",
10934
- "bottom-[calc(100%+4px)]",
10935
- // NOTE: measurement-derived (4dp gap above handle); permitted exception
10936
- "bg-inverse-surface",
10937
- "rounded-full",
10938
- // pill shape (1000dp radius)
10939
- "px-[16px]",
10940
- // NOTE: measurement-derived (valueIndicatorPaddingH: 16dp); permitted exception
10941
- "py-[12px]",
10942
- // NOTE: measurement-derived (valueIndicatorPaddingV: 12dp); permitted exception
10943
- "min-w-[48px]",
10944
- // NOTE: measurement-derived (valueIndicatorWidth: 48dp); permitted exception
10945
- "flex",
10946
- "items-center",
10947
- "justify-center",
10948
- "pointer-events-none",
10949
- "z-20"
10950
- // Motion classes (transition-[transform,opacity] with directional easing) applied
10951
- // conditionally in SliderValueIndicator.tsx via useReducedMotion guard.
10952
- ],
10953
- {
10954
- variants: {
10955
- visible: {
10956
- true: "opacity-100 scale-100",
10957
- false: "opacity-0 scale-0"
10958
- }
10959
- },
10960
- defaultVariants: {
10961
- visible: false
10962
- }
10963
- }
10964
- );
10965
11266
  var sliderValueIndicatorTextVariants = classVarianceAuthority.cva([
10966
11267
  "text-inverse-on-surface",
10967
11268
  "text-label-large",
10968
- // MD3 Label Large typescale token
10969
- "whitespace-nowrap",
10970
- "text-center"
11269
+ "select-none",
11270
+ "whitespace-nowrap"
10971
11271
  ]);
10972
11272
  var sliderInsetIconVariants = classVarianceAuthority.cva(
10973
11273
  ["absolute", "text-on-primary", "pointer-events-none", "flex", "items-center", "justify-center"],
10974
11274
  {
10975
11275
  variants: {
10976
11276
  size: {
10977
- // NOTE: measurement-derived values from MD3 spec §10.7 (icon sizes); permitted exception
10978
11277
  medium: "w-[24px] h-[24px]",
10979
11278
  large: "w-[24px] h-[24px]",
10980
11279
  xlarge: "w-[32px] h-[32px]"
10981
11280
  },
10982
11281
  orientation: {
10983
- // Horizontal: 8dp from active track left edge, vertically centered
10984
- // NOTE: measurement-derived value from MD3 spec §10.7 (iconOffset: 8dp); permitted exception
10985
11282
  horizontal: "left-[8px] top-1/2 -translate-y-1/2",
10986
- // Vertical: 8dp from active track bottom edge (outer end), horizontally centered
10987
11283
  vertical: "bottom-[8px] left-1/2 -translate-x-1/2"
10988
11284
  }
10989
11285
  },
@@ -11014,7 +11310,7 @@ function SliderStops({
11014
11310
  step,
11015
11311
  values,
11016
11312
  variant,
11017
- isDisabled,
11313
+ size = "xsmall",
11018
11314
  className
11019
11315
  }) {
11020
11316
  const stopCount = Math.floor((maxValue - minValue) / step) + 1;
@@ -11032,7 +11328,10 @@ function SliderStops({
11032
11328
  {
11033
11329
  "data-slot": "stop-dot",
11034
11330
  className: cn(
11035
- sliderStopDotVariants({ onActiveTrack: isOnActive, disabled: isDisabled })
11331
+ sliderStopDotVariants({
11332
+ region: isOnActive ? "active" : "inactive",
11333
+ size
11334
+ })
11036
11335
  )
11037
11336
  },
11038
11337
  i
@@ -11043,27 +11342,19 @@ function SliderStops({
11043
11342
  }
11044
11343
  function SliderValueIndicator({
11045
11344
  value,
11046
- isVisible,
11047
11345
  formatValue: formatValue2,
11048
11346
  className
11049
11347
  }) {
11050
11348
  const displayValue = formatValue2 ? formatValue2(value) : `${Math.round(value)}`;
11051
11349
  const reducedMotion = useReducedMotion();
11052
- const transitionClasses = reducedMotion ? "" : cn(
11053
- "transition-[transform,opacity]",
11054
- isVisible ? "duration-short3 ease-standard-decelerate" : "duration-short2 ease-standard-accelerate"
11055
- );
11350
+ const transitionClasses = reducedMotion ? "" : "transition-[scale,opacity] duration-spring-standard-fast-spatial ease-spring-standard-fast-spatial";
11056
11351
  return /* @__PURE__ */ jsxRuntime.jsx(
11057
11352
  "div",
11058
11353
  {
11059
11354
  "data-slot": "value-indicator",
11060
- className: cn(
11061
- sliderValueIndicatorVariants({ visible: isVisible }),
11062
- transitionClasses,
11063
- className
11064
- ),
11355
+ className: cn(sliderValueIndicatorVariants(), transitionClasses, className),
11065
11356
  role: "tooltip",
11066
- "aria-hidden": !isVisible,
11357
+ "aria-hidden": "true",
11067
11358
  children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: sliderValueIndicatorTextVariants(), children: displayValue })
11068
11359
  }
11069
11360
  );
@@ -11076,6 +11367,16 @@ function resolveDefaultValue(variant, minValue) {
11076
11367
  if (variant === "centered") return [0];
11077
11368
  return [minValue];
11078
11369
  }
11370
+ var GAP_PX = 3;
11371
+ function segmentStyle(orientation, opts) {
11372
+ const { start, end, startGap = 0, endGap = 0 } = opts;
11373
+ const startVal = start !== null ? `calc(${start}% + ${startGap}px)` : `${startGap}px`;
11374
+ const endVal = end !== null ? `calc(${100 - end}% + ${endGap}px)` : `${endGap}px`;
11375
+ if (orientation === "horizontal") {
11376
+ return { left: startVal, right: endVal };
11377
+ }
11378
+ return { bottom: startVal, top: endVal };
11379
+ }
11079
11380
  var Slider = React.forwardRef(
11080
11381
  ({
11081
11382
  size = "xsmall",
@@ -11109,103 +11410,75 @@ var Slider = React.forwardRef(
11109
11410
  },
11110
11411
  [value, onChange]
11111
11412
  );
11112
- const thumbCount = variant === "range" ? 2 : 1;
11113
- const [thumbStates, setThumbStates] = React.useState(
11114
- () => Array(thumbCount).fill("enabled")
11115
- );
11116
- const isDragging = thumbStates.some((s) => s === "pressed");
11117
- const trackTransition = reducedMotion || isDragging ? "" : "transition-[flex-basis] duration-spring-standard-fast-spatial ease-spring-standard-fast-spatial";
11118
- const handleMotion = reducedMotion ? "" : "transition-[width] duration-short2 ease-standard";
11119
- const stateLayerMotion = reducedMotion ? "" : "transition-opacity duration-short1 ease-standard";
11413
+ const [anyThumbDragging, setAnyThumbDragging] = React.useState(false);
11414
+ const handleThumbDraggingChange = React.useCallback((_index, isDragging) => {
11415
+ setAnyThumbDragging(isDragging);
11416
+ }, []);
11417
+ const springTokens = "duration-spring-standard-fast-spatial ease-spring-standard-fast-spatial";
11418
+ const trackTransition = reducedMotion || anyThumbDragging ? "" : orientation === "vertical" ? `transition-[top,bottom,height] ${springTokens}` : `transition-[left,width,right] ${springTokens}`;
11419
+ const handleMotion = reducedMotion ? "" : "transition-[width] duration-spring-standard-fast-spatial ease-spring-standard-fast-spatial";
11120
11420
  const isRange = variant === "range";
11121
11421
  const isCentered = variant === "centered";
11122
11422
  const showIcon = icon !== void 0 && variant === "standard" && (size === "medium" || size === "large" || size === "xlarge");
11423
+ const renderThumbContent = React.useCallback(
11424
+ ({ value: thumbValue }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11425
+ /* @__PURE__ */ jsxRuntime.jsx(
11426
+ "div",
11427
+ {
11428
+ "aria-hidden": "true",
11429
+ className: cn(
11430
+ "absolute",
11431
+ "left-1/2",
11432
+ "top-1/2",
11433
+ "-translate-x-1/2",
11434
+ "-translate-y-1/2",
11435
+ orientation === "vertical" ? "h-[20px] w-full" : "h-full w-[20px]"
11436
+ )
11437
+ }
11438
+ ),
11439
+ /* @__PURE__ */ jsxRuntime.jsx(
11440
+ "div",
11441
+ {
11442
+ "data-slot": "handle",
11443
+ className: cn(sliderHandleVariants({ size, orientation }), handleMotion)
11444
+ }
11445
+ ),
11446
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "state-layer", className: cn(sliderHandleStateLayerVariants()) }),
11447
+ showValueIndicator && /* @__PURE__ */ jsxRuntime.jsx(
11448
+ SliderValueIndicator,
11449
+ {
11450
+ value: thumbValue,
11451
+ ...formatValue2 !== void 0 ? { formatValue: formatValue2 } : {}
11452
+ }
11453
+ )
11454
+ ] }),
11455
+ [size, orientation, showValueIndicator, formatValue2, handleMotion]
11456
+ );
11123
11457
  const renderStandardTrack = () => {
11124
11458
  const pct = clampPercent(currentValues[0] ?? minValue, minValue, maxValue);
11125
- const thumb0State = isDisabled ? "disabled" : thumbStates[0] ?? "enabled";
11126
11459
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11127
11460
  /* @__PURE__ */ jsxRuntime.jsx(
11128
11461
  "div",
11129
11462
  {
11130
11463
  "data-slot": "active-track",
11131
- className: cn(
11132
- sliderActiveTrackVariants({ size, disabled: isDisabled, orientation }),
11133
- trackTransition
11134
- ),
11135
- style: { flexBasis: `${pct}%` },
11464
+ className: cn(sliderActiveTrackVariants({ size, orientation }), trackTransition),
11465
+ style: segmentStyle(orientation, { start: null, end: pct, endGap: GAP_PX }),
11136
11466
  children: showIcon && /* @__PURE__ */ jsxRuntime.jsx(
11137
11467
  "span",
11138
11468
  {
11139
11469
  "data-slot": "inset-icon",
11140
- className: cn(
11141
- sliderInsetIconVariants({
11142
- size,
11143
- orientation
11144
- })
11145
- ),
11470
+ className: cn(sliderInsetIconVariants({ size, orientation })),
11146
11471
  children: icon
11147
11472
  }
11148
11473
  )
11149
11474
  }
11150
11475
  ),
11151
- /* @__PURE__ */ jsxRuntime.jsxs(
11152
- "div",
11153
- {
11154
- "data-slot": "handle",
11155
- className: cn(
11156
- sliderHandleVariants({
11157
- size,
11158
- disabled: isDisabled,
11159
- pressed: thumb0State === "pressed",
11160
- orientation
11161
- }),
11162
- handleMotion
11163
- ),
11164
- onPointerEnter: () => {
11165
- if (!isDisabled) setThumbStates(["hovered"]);
11166
- },
11167
- onPointerLeave: () => {
11168
- if (!isDisabled) setThumbStates(["enabled"]);
11169
- },
11170
- onPointerDown: (e) => {
11171
- e.stopPropagation();
11172
- if (!isDisabled) setThumbStates(["pressed"]);
11173
- },
11174
- onPointerUp: (e) => {
11175
- e.stopPropagation();
11176
- if (!isDisabled) setThumbStates(["enabled"]);
11177
- },
11178
- children: [
11179
- /* @__PURE__ */ jsxRuntime.jsx(
11180
- "div",
11181
- {
11182
- "data-slot": "state-layer",
11183
- className: cn(
11184
- sliderHandleStateLayerVariants({ state: thumb0State }),
11185
- stateLayerMotion
11186
- )
11187
- }
11188
- ),
11189
- showValueIndicator && /* @__PURE__ */ jsxRuntime.jsx(
11190
- SliderValueIndicator,
11191
- {
11192
- value: currentValues[0] ?? minValue,
11193
- isVisible: thumb0State === "pressed",
11194
- ...formatValue2 !== void 0 ? { formatValue: formatValue2 } : {}
11195
- }
11196
- )
11197
- ]
11198
- }
11199
- ),
11200
11476
  /* @__PURE__ */ jsxRuntime.jsx(
11201
11477
  "div",
11202
11478
  {
11203
11479
  "data-slot": "inactive-track",
11204
- className: cn(
11205
- sliderInactiveTrackVariants({ size, disabled: isDisabled, orientation }),
11206
- trackTransition
11207
- ),
11208
- style: { flexBasis: `${100 - pct}%` },
11480
+ className: cn(sliderInactiveTrackVariants({ size, orientation }), trackTransition),
11481
+ style: segmentStyle(orientation, { start: pct, startGap: GAP_PX, end: null }),
11209
11482
  children: showStops && /* @__PURE__ */ jsxRuntime.jsx(
11210
11483
  "span",
11211
11484
  {
@@ -11220,20 +11493,13 @@ var Slider = React.forwardRef(
11220
11493
  const renderRangeTrack = () => {
11221
11494
  const leftPct = clampPercent(currentValues[0] ?? minValue, minValue, maxValue);
11222
11495
  const rightPct = clampPercent(currentValues[1] ?? maxValue, minValue, maxValue);
11223
- const thumb0State = isDisabled ? "disabled" : thumbStates[0] ?? "enabled";
11224
- const thumb1State = isDisabled ? "disabled" : thumbStates[1] ?? "enabled";
11225
- const setThumb0 = (next) => setThumbStates((s) => [next, s[1] ?? "enabled"]);
11226
- const setThumb1 = (next) => setThumbStates((s) => [s[0] ?? "enabled", next]);
11227
11496
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11228
11497
  /* @__PURE__ */ jsxRuntime.jsx(
11229
11498
  "div",
11230
11499
  {
11231
11500
  "data-slot": "inactive-track-left",
11232
- className: cn(
11233
- sliderInactiveTrackVariants({ size, disabled: isDisabled, orientation }),
11234
- trackTransition
11235
- ),
11236
- style: { flexBasis: `${leftPct}%` },
11501
+ className: cn(sliderInactiveTrackVariants({ size, orientation }), trackTransition),
11502
+ style: segmentStyle(orientation, { start: null, end: leftPct, endGap: GAP_PX }),
11237
11503
  children: showStops && /* @__PURE__ */ jsxRuntime.jsx(
11238
11504
  "span",
11239
11505
  {
@@ -11243,128 +11509,30 @@ var Slider = React.forwardRef(
11243
11509
  )
11244
11510
  }
11245
11511
  ),
11246
- /* @__PURE__ */ jsxRuntime.jsxs(
11247
- "div",
11248
- {
11249
- "data-slot": "handle",
11250
- "data-index": "0",
11251
- className: cn(
11252
- sliderHandleVariants({
11253
- size,
11254
- disabled: isDisabled,
11255
- pressed: thumb0State === "pressed",
11256
- orientation
11257
- }),
11258
- handleMotion
11259
- ),
11260
- onPointerEnter: () => {
11261
- if (!isDisabled) setThumb0("hovered");
11262
- },
11263
- onPointerLeave: () => {
11264
- if (!isDisabled) setThumb0("enabled");
11265
- },
11266
- onPointerDown: (e) => {
11267
- e.stopPropagation();
11268
- if (!isDisabled) setThumb0("pressed");
11269
- },
11270
- onPointerUp: (e) => {
11271
- e.stopPropagation();
11272
- if (!isDisabled) setThumb0("enabled");
11273
- },
11274
- children: [
11275
- /* @__PURE__ */ jsxRuntime.jsx(
11276
- "div",
11277
- {
11278
- "data-slot": "state-layer",
11279
- className: cn(
11280
- sliderHandleStateLayerVariants({ state: thumb0State }),
11281
- stateLayerMotion
11282
- )
11283
- }
11284
- ),
11285
- showValueIndicator && /* @__PURE__ */ jsxRuntime.jsx(
11286
- SliderValueIndicator,
11287
- {
11288
- value: currentValues[0] ?? minValue,
11289
- isVisible: thumb0State === "pressed",
11290
- ...formatValue2 !== void 0 ? { formatValue: formatValue2 } : {}
11291
- }
11292
- )
11293
- ]
11294
- }
11295
- ),
11296
11512
  /* @__PURE__ */ jsxRuntime.jsx(
11297
11513
  "div",
11298
11514
  {
11299
11515
  "data-slot": "active-track",
11300
11516
  className: cn(
11301
- sliderActiveTrackVariants({ size, disabled: isDisabled, orientation }),
11517
+ sliderActiveTrackVariants({ size, orientation }),
11302
11518
  "rounded-[2px]",
11303
- // Both ends near handles: 2dp (MD3 §10.2)
11519
+ // Both ends near handles: 2dp inner (MD3 §10.2)
11304
11520
  trackTransition
11305
11521
  ),
11306
- style: { flexBasis: `${rightPct - leftPct}%` }
11307
- }
11308
- ),
11309
- /* @__PURE__ */ jsxRuntime.jsxs(
11310
- "div",
11311
- {
11312
- "data-slot": "handle",
11313
- "data-index": "1",
11314
- className: cn(
11315
- sliderHandleVariants({
11316
- size,
11317
- disabled: isDisabled,
11318
- pressed: thumb1State === "pressed",
11319
- orientation
11320
- }),
11321
- handleMotion
11322
- ),
11323
- onPointerEnter: () => {
11324
- if (!isDisabled) setThumb1("hovered");
11325
- },
11326
- onPointerLeave: () => {
11327
- if (!isDisabled) setThumb1("enabled");
11328
- },
11329
- onPointerDown: (e) => {
11330
- e.stopPropagation();
11331
- if (!isDisabled) setThumb1("pressed");
11332
- },
11333
- onPointerUp: (e) => {
11334
- e.stopPropagation();
11335
- if (!isDisabled) setThumb1("enabled");
11336
- },
11337
- children: [
11338
- /* @__PURE__ */ jsxRuntime.jsx(
11339
- "div",
11340
- {
11341
- "data-slot": "state-layer",
11342
- className: cn(
11343
- sliderHandleStateLayerVariants({ state: thumb1State }),
11344
- stateLayerMotion
11345
- )
11346
- }
11347
- ),
11348
- showValueIndicator && /* @__PURE__ */ jsxRuntime.jsx(
11349
- SliderValueIndicator,
11350
- {
11351
- value: currentValues[1] ?? maxValue,
11352
- isVisible: thumb1State === "pressed",
11353
- ...formatValue2 !== void 0 ? { formatValue: formatValue2 } : {}
11354
- }
11355
- )
11356
- ]
11522
+ style: segmentStyle(orientation, {
11523
+ start: leftPct,
11524
+ startGap: GAP_PX,
11525
+ end: rightPct,
11526
+ endGap: GAP_PX
11527
+ })
11357
11528
  }
11358
11529
  ),
11359
11530
  /* @__PURE__ */ jsxRuntime.jsx(
11360
11531
  "div",
11361
11532
  {
11362
11533
  "data-slot": "inactive-track-right",
11363
- className: cn(
11364
- sliderInactiveTrackVariants({ size, disabled: isDisabled, orientation }),
11365
- trackTransition
11366
- ),
11367
- style: { flexBasis: `${100 - rightPct}%` },
11534
+ className: cn(sliderInactiveTrackVariants({ size, orientation }), trackTransition),
11535
+ style: segmentStyle(orientation, { start: rightPct, startGap: GAP_PX, end: null }),
11368
11536
  children: showStops && /* @__PURE__ */ jsxRuntime.jsx(
11369
11537
  "span",
11370
11538
  {
@@ -11379,126 +11547,65 @@ var Slider = React.forwardRef(
11379
11547
  const renderCenteredTrack = () => {
11380
11548
  const thumbPct = clampPercent(currentValues[0] ?? minValue, minValue, maxValue);
11381
11549
  const zeroPct = minValue >= 0 ? 0 : maxValue <= 0 ? 100 : (0 - minValue) / (maxValue - minValue) * 100;
11382
- const thumb0State = isDisabled ? "disabled" : thumbStates[0] ?? "enabled";
11383
- const handleEl = /* @__PURE__ */ jsxRuntime.jsxs(
11384
- "div",
11385
- {
11386
- "data-slot": "handle",
11387
- className: cn(
11388
- sliderHandleVariants({
11389
- size,
11390
- disabled: isDisabled,
11391
- pressed: thumb0State === "pressed",
11392
- orientation
11393
- }),
11394
- handleMotion
11395
- ),
11396
- onPointerEnter: () => {
11397
- if (!isDisabled) setThumbStates(["hovered"]);
11398
- },
11399
- onPointerLeave: () => {
11400
- if (!isDisabled) setThumbStates(["enabled"]);
11401
- },
11402
- onPointerDown: (e) => {
11403
- e.stopPropagation();
11404
- if (!isDisabled) setThumbStates(["pressed"]);
11405
- },
11406
- onPointerUp: (e) => {
11407
- e.stopPropagation();
11408
- if (!isDisabled) setThumbStates(["enabled"]);
11409
- },
11410
- children: [
11411
- /* @__PURE__ */ jsxRuntime.jsx(
11412
- "div",
11413
- {
11414
- "data-slot": "state-layer",
11415
- className: cn(sliderHandleStateLayerVariants({ state: thumb0State }), stateLayerMotion)
11416
- }
11417
- ),
11418
- showValueIndicator && /* @__PURE__ */ jsxRuntime.jsx(
11419
- SliderValueIndicator,
11420
- {
11421
- value: currentValues[0] ?? minValue,
11422
- isVisible: thumb0State === "pressed",
11423
- ...formatValue2 !== void 0 ? { formatValue: formatValue2 } : {}
11424
- }
11425
- )
11426
- ]
11427
- }
11428
- );
11429
11550
  if (thumbPct >= zeroPct) {
11430
- const activePct = thumbPct - zeroPct;
11431
11551
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11432
11552
  /* @__PURE__ */ jsxRuntime.jsx(
11433
11553
  "div",
11434
11554
  {
11435
11555
  "data-slot": "inactive-track-left",
11436
- className: cn(
11437
- sliderInactiveTrackVariants({ size, disabled: isDisabled, orientation }),
11438
- trackTransition
11439
- ),
11440
- style: { flexBasis: `${zeroPct}%` }
11556
+ className: cn(sliderInactiveTrackVariants({ size, orientation }), trackTransition),
11557
+ style: segmentStyle(orientation, { start: null, end: zeroPct })
11441
11558
  }
11442
11559
  ),
11443
- handleEl,
11444
11560
  /* @__PURE__ */ jsxRuntime.jsx(
11445
11561
  "div",
11446
11562
  {
11447
11563
  "data-slot": "active-track",
11448
- className: cn(
11449
- sliderActiveTrackVariants({ size, disabled: isDisabled, orientation }),
11450
- trackTransition
11451
- ),
11452
- style: { flexBasis: `${activePct}%` }
11564
+ className: cn(sliderActiveTrackVariants({ size, orientation }), trackTransition),
11565
+ style: segmentStyle(orientation, {
11566
+ start: zeroPct,
11567
+ end: thumbPct,
11568
+ endGap: GAP_PX
11569
+ })
11453
11570
  }
11454
11571
  ),
11455
11572
  /* @__PURE__ */ jsxRuntime.jsx(
11456
11573
  "div",
11457
11574
  {
11458
11575
  "data-slot": "inactive-track-right",
11459
- className: cn(
11460
- sliderInactiveTrackVariants({ size, disabled: isDisabled, orientation }),
11461
- trackTransition
11462
- ),
11463
- style: { flexBasis: `${100 - zeroPct - activePct}%` }
11576
+ className: cn(sliderInactiveTrackVariants({ size, orientation }), trackTransition),
11577
+ style: segmentStyle(orientation, { start: thumbPct, startGap: GAP_PX, end: null })
11464
11578
  }
11465
11579
  )
11466
11580
  ] });
11467
11581
  } else {
11468
- const activePct = zeroPct - thumbPct;
11469
11582
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11470
11583
  /* @__PURE__ */ jsxRuntime.jsx(
11471
11584
  "div",
11472
11585
  {
11473
11586
  "data-slot": "inactive-track-left",
11474
- className: cn(
11475
- sliderInactiveTrackVariants({ size, disabled: isDisabled, orientation }),
11476
- trackTransition
11477
- ),
11478
- style: { flexBasis: `${thumbPct}%` }
11587
+ className: cn(sliderInactiveTrackVariants({ size, orientation }), trackTransition),
11588
+ style: segmentStyle(orientation, { start: null, end: thumbPct, endGap: GAP_PX })
11479
11589
  }
11480
11590
  ),
11481
11591
  /* @__PURE__ */ jsxRuntime.jsx(
11482
11592
  "div",
11483
11593
  {
11484
11594
  "data-slot": "active-track",
11485
- className: cn(
11486
- sliderActiveTrackVariants({ size, disabled: isDisabled, orientation }),
11487
- trackTransition
11488
- ),
11489
- style: { flexBasis: `${activePct}%` }
11595
+ className: cn(sliderActiveTrackVariants({ size, orientation }), trackTransition),
11596
+ style: segmentStyle(orientation, {
11597
+ start: thumbPct,
11598
+ startGap: GAP_PX,
11599
+ end: zeroPct
11600
+ })
11490
11601
  }
11491
11602
  ),
11492
- handleEl,
11493
11603
  /* @__PURE__ */ jsxRuntime.jsx(
11494
11604
  "div",
11495
11605
  {
11496
11606
  "data-slot": "inactive-track-right",
11497
- className: cn(
11498
- sliderInactiveTrackVariants({ size, disabled: isDisabled, orientation }),
11499
- trackTransition
11500
- ),
11501
- style: { flexBasis: `${100 - zeroPct}%` }
11607
+ className: cn(sliderInactiveTrackVariants({ size, orientation }), trackTransition),
11608
+ style: segmentStyle(orientation, { start: zeroPct, end: null })
11502
11609
  }
11503
11610
  )
11504
11611
  ] });
@@ -11521,11 +11628,11 @@ var Slider = React.forwardRef(
11521
11628
  ...value !== void 0 ? { value } : {},
11522
11629
  ...defaultValue !== void 0 ? { defaultValue } : {},
11523
11630
  ...onChangeEnd !== void 0 ? { onChangeEnd } : {},
11524
- className: cn(
11525
- sliderContainerVariants({ size, disabled: isDisabled, orientation }),
11526
- className
11527
- ),
11528
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "track-layout", className: cn(sliderTrackLayoutVariants({ orientation })), children: [
11631
+ renderThumbContent,
11632
+ onThumbDraggingChange: handleThumbDraggingChange,
11633
+ className: cn(sliderContainerVariants({ size, orientation }), className),
11634
+ trackClassName: sliderTrackRegionVariants({ size, orientation }),
11635
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "track-layout", className: cn(sliderTrackLayoutVariants()), children: [
11529
11636
  isRange ? renderRangeTrack() : isCentered ? renderCenteredTrack() : renderStandardTrack(),
11530
11637
  canShowStops && /* @__PURE__ */ jsxRuntime.jsx(
11531
11638
  SliderStops,
@@ -11535,7 +11642,7 @@ var Slider = React.forwardRef(
11535
11642
  step,
11536
11643
  values: currentValues,
11537
11644
  variant,
11538
- isDisabled
11645
+ size
11539
11646
  }
11540
11647
  )
11541
11648
  ] })