@tinybigui/react 0.17.0 → 0.18.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
@@ -8616,6 +8616,30 @@ var InteractiveStyledListItem = React.forwardRef(
8616
8616
  }
8617
8617
  );
8618
8618
  InteractiveStyledListItem.displayName = "InteractiveStyledListItem";
8619
+ var ArrowBackIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
8620
+ "svg",
8621
+ {
8622
+ width: "24",
8623
+ height: "24",
8624
+ viewBox: "0 0 24 24",
8625
+ fill: "currentColor",
8626
+ "aria-hidden": "true",
8627
+ focusable: "false",
8628
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" })
8629
+ }
8630
+ );
8631
+ var CloseIcon3 = () => /* @__PURE__ */ jsxRuntime.jsx(
8632
+ "svg",
8633
+ {
8634
+ width: "24",
8635
+ height: "24",
8636
+ viewBox: "0 0 24 24",
8637
+ fill: "currentColor",
8638
+ "aria-hidden": "true",
8639
+ focusable: "false",
8640
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })
8641
+ }
8642
+ );
8619
8643
  var SearchBarHeadless = React.forwardRef(
8620
8644
  ({
8621
8645
  value,
@@ -8631,7 +8655,9 @@ var SearchBarHeadless = React.forwardRef(
8631
8655
  "aria-label": ariaLabel,
8632
8656
  className,
8633
8657
  onFocus,
8634
- onBlur
8658
+ onBlur,
8659
+ inputClassName,
8660
+ trailingActionsClassName
8635
8661
  }, forwardedRef) => {
8636
8662
  const inputRef = React.useRef(null);
8637
8663
  const internalFormRef = React.useRef(null);
@@ -8665,8 +8691,17 @@ var SearchBarHeadless = React.forwardRef(
8665
8691
  );
8666
8692
  return /* @__PURE__ */ jsxRuntime.jsxs("form", { ref: formRef, role: "search", className, onSubmit: handleFormSubmit, children: [
8667
8693
  leadingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "leading-icon", children: leadingIcon }),
8668
- /* @__PURE__ */ jsxRuntime.jsx("input", { ...inputProps, ref: inputRef, role: "searchbox" }),
8669
- trailingActions && trailingActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "trailing-actions", children: trailingActions.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "trailing-action", children: action }, index)) }),
8694
+ /* @__PURE__ */ jsxRuntime.jsx(
8695
+ "input",
8696
+ {
8697
+ ...inputProps,
8698
+ ref: inputRef,
8699
+ role: "searchbox",
8700
+ "data-slot": "input",
8701
+ className: inputClassName
8702
+ }
8703
+ ),
8704
+ trailingActions && trailingActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "trailing-actions", className: trailingActionsClassName, children: trailingActions }),
8670
8705
  avatar && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "avatar", children: avatar })
8671
8706
  ] });
8672
8707
  }
@@ -8686,32 +8721,45 @@ var SearchViewHeadless = React.forwardRef(
8686
8721
  children,
8687
8722
  leadingIcon,
8688
8723
  trailingActions,
8689
- showDivider
8724
+ showDivider,
8725
+ layout = "fullscreen",
8726
+ headerClassName,
8727
+ backButtonClassName,
8728
+ clearButtonClassName,
8729
+ inputClassName,
8730
+ trailingActionsClassName,
8731
+ dividerClassName,
8732
+ contentClassName
8690
8733
  }, forwardedRef) => {
8691
8734
  if (!isOpen) {
8692
8735
  return null;
8693
8736
  }
8694
- return reactDom.createPortal(
8695
- /* @__PURE__ */ jsxRuntime.jsx(
8696
- SearchViewPanel,
8697
- {
8698
- ref: forwardedRef,
8699
- onClose,
8700
- ariaLabel,
8701
- ...className !== void 0 ? { className } : {},
8702
- ...leadingIcon !== void 0 ? { leadingIcon } : {},
8703
- ...trailingActions !== void 0 ? { trailingActions } : {},
8704
- ...showDivider !== void 0 ? { showDivider } : {},
8705
- ...value !== void 0 ? { value } : {},
8706
- ...defaultValue !== void 0 ? { defaultValue } : {},
8707
- ...onChange !== void 0 ? { onChange } : {},
8708
- ...onSubmit !== void 0 ? { onSubmit } : {},
8709
- ...placeholder !== void 0 ? { placeholder } : {},
8710
- children
8711
- }
8712
- ),
8713
- document.body
8714
- );
8737
+ const panelProps = {
8738
+ onClose,
8739
+ ariaLabel,
8740
+ layout,
8741
+ children,
8742
+ ...className !== void 0 ? { className } : {},
8743
+ ...leadingIcon !== void 0 ? { leadingIcon } : {},
8744
+ ...trailingActions !== void 0 ? { trailingActions } : {},
8745
+ ...showDivider !== void 0 ? { showDivider } : {},
8746
+ ...value !== void 0 ? { value } : {},
8747
+ ...defaultValue !== void 0 ? { defaultValue } : {},
8748
+ ...onChange !== void 0 ? { onChange } : {},
8749
+ ...onSubmit !== void 0 ? { onSubmit } : {},
8750
+ ...placeholder !== void 0 ? { placeholder } : {},
8751
+ headerClassName,
8752
+ backButtonClassName,
8753
+ clearButtonClassName,
8754
+ inputClassName,
8755
+ trailingActionsClassName,
8756
+ dividerClassName,
8757
+ contentClassName
8758
+ };
8759
+ if (layout === "docked") {
8760
+ return /* @__PURE__ */ jsxRuntime.jsx(SearchViewPanel, { ref: forwardedRef, ...panelProps });
8761
+ }
8762
+ return reactDom.createPortal(/* @__PURE__ */ jsxRuntime.jsx(SearchViewPanel, { ref: forwardedRef, ...panelProps }), document.body);
8715
8763
  }
8716
8764
  );
8717
8765
  SearchViewHeadless.displayName = "SearchViewHeadless";
@@ -8728,12 +8776,21 @@ var SearchViewPanel = React.forwardRef(
8728
8776
  children,
8729
8777
  leadingIcon,
8730
8778
  trailingActions,
8731
- showDivider
8779
+ showDivider,
8780
+ layout,
8781
+ headerClassName,
8782
+ backButtonClassName,
8783
+ clearButtonClassName,
8784
+ inputClassName,
8785
+ trailingActionsClassName,
8786
+ dividerClassName,
8787
+ contentClassName
8732
8788
  }, forwardedRef) => {
8733
8789
  const panelRef = React.useRef(null);
8734
8790
  const inputRef = React.useRef(null);
8735
8791
  const ref = forwardedRef ?? panelRef;
8736
- reactAria.usePreventScroll();
8792
+ const isFullscreen = layout === "fullscreen";
8793
+ reactAria.usePreventScroll({ isDisabled: !isFullscreen });
8737
8794
  const { overlayProps } = reactAria.useOverlay(
8738
8795
  {
8739
8796
  isOpen: true,
@@ -8766,7 +8823,17 @@ var SearchViewPanel = React.forwardRef(
8766
8823
  const handleBackClick = React.useCallback(() => {
8767
8824
  onClose();
8768
8825
  }, [onClose]);
8769
- const defaultBackArrow = /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Back", onClick: handleBackClick, "data-slot": "back-button", children: "\u2190" });
8826
+ const defaultBackButton = /* @__PURE__ */ jsxRuntime.jsx(
8827
+ "button",
8828
+ {
8829
+ type: "button",
8830
+ "aria-label": "Back",
8831
+ onClick: handleBackClick,
8832
+ "data-slot": "back-button",
8833
+ className: backButtonClassName,
8834
+ children: /* @__PURE__ */ jsxRuntime.jsx(ArrowBackIcon, {})
8835
+ }
8836
+ );
8770
8837
  const clearButton = state.value ? /* @__PURE__ */ jsxRuntime.jsx(
8771
8838
  "button",
8772
8839
  {
@@ -8775,66 +8842,109 @@ var SearchViewPanel = React.forwardRef(
8775
8842
  type: "button",
8776
8843
  "aria-label": "Clear search",
8777
8844
  "data-slot": "clear-button",
8778
- children: "\u2715"
8845
+ className: clearButtonClassName,
8846
+ children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon3, {})
8779
8847
  }
8780
8848
  ) : null;
8781
- return /* @__PURE__ */ jsxRuntime.jsx(reactAria.FocusScope, { contain: true, restoreFocus: true, autoFocus: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ...overlayProps, ref, role: "search", "aria-label": ariaLabel, className, children: [
8782
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "header", children: [
8783
- /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "leading-icon", children: leadingIcon ?? defaultBackArrow }),
8784
- /* @__PURE__ */ jsxRuntime.jsx("input", { ...inputProps, ref: inputRef, role: "searchbox" }),
8785
- clearButton,
8786
- trailingActions && trailingActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "trailing-actions", children: trailingActions.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "trailing-action", children: action }, index)) })
8787
- ] }),
8788
- showDivider && /* @__PURE__ */ jsxRuntime.jsx("hr", { "data-slot": "divider" }),
8789
- /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "content", "aria-live": "polite", children })
8790
- ] }) });
8849
+ return (
8850
+ // Focus containment only for fullscreen docked uses restoreFocus + autoFocus only
8851
+ // so tabbing can naturally leave the widget.
8852
+ /* @__PURE__ */ jsxRuntime.jsx(reactAria.FocusScope, { contain: isFullscreen, restoreFocus: true, autoFocus: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ...overlayProps, ref, role: "search", "aria-label": ariaLabel, className, children: [
8853
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "header", className: headerClassName, children: [
8854
+ leadingIcon ?? defaultBackButton,
8855
+ /* @__PURE__ */ jsxRuntime.jsx(
8856
+ "input",
8857
+ {
8858
+ ...inputProps,
8859
+ ref: inputRef,
8860
+ role: "searchbox",
8861
+ "data-slot": "input",
8862
+ className: inputClassName
8863
+ }
8864
+ ),
8865
+ clearButton,
8866
+ trailingActions && trailingActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "trailing-actions", className: trailingActionsClassName, children: trailingActions })
8867
+ ] }),
8868
+ showDivider && /* @__PURE__ */ jsxRuntime.jsx("hr", { "data-slot": "divider", className: dividerClassName }),
8869
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "content", "aria-live": "polite", className: contentClassName, children })
8870
+ ] }) })
8871
+ );
8791
8872
  }
8792
8873
  );
8793
8874
  SearchViewPanel.displayName = "SearchViewPanel";
8794
- var searchBarVariants = classVarianceAuthority.cva(
8875
+ var searchBarRootVariants = classVarianceAuthority.cva(
8795
8876
  [
8796
- "relative flex items-center h-14 rounded-full bg-surface-container-high",
8797
- "shadow-elevation-3 w-full text-body-large cursor-text"
8877
+ "relative flex items-center h-14 rounded-full",
8878
+ "bg-surface-container-high shadow-elevation-3",
8879
+ "w-full text-body-large cursor-text",
8880
+ // Disabled — self-targeting; pointer-events lets ripple/hover stop cleanly
8881
+ "data-[disabled]:opacity-38 data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed"
8798
8882
  ],
8799
8883
  {
8800
8884
  variants: {
8885
+ /**
8886
+ * Visual style of the search bar.
8887
+ * - contained: M3 Expressive — fills container, expressive motion, adjustable spacing
8888
+ * - divided: Baseline — 16dp fixed spacing, no expressive motion
8889
+ */
8801
8890
  style: {
8802
- contained: "",
8891
+ /**
8892
+ * Contained (Expressive): spacing governed by data-[with-actions] content flag.
8893
+ * With actions: px-1 gap-1 (4dp each)
8894
+ * Without actions: px-4 (16dp each)
8895
+ */
8896
+ contained: [
8897
+ "px-4",
8898
+ // default: no-actions 16dp
8899
+ "data-[with-actions]:px-1 data-[with-actions]:gap-1"
8900
+ // with-actions: 4dp
8901
+ ],
8902
+ /**
8903
+ * Divided (Baseline): fixed 16dp side padding, 16dp icon-label gap.
8904
+ */
8803
8905
  divided: "px-4 gap-4"
8804
- },
8805
- noActions: {
8806
- true: "",
8807
- false: ""
8808
- },
8809
- focused: {
8810
- true: "",
8811
- false: ""
8812
- },
8813
- disabled: {
8814
- true: "opacity-38 pointer-events-none",
8815
- false: ""
8816
8906
  }
8817
8907
  },
8818
- compoundVariants: [
8819
- {
8820
- style: "contained",
8821
- noActions: false,
8822
- class: "px-1 gap-1"
8823
- },
8824
- {
8825
- style: "contained",
8826
- noActions: true,
8827
- class: "px-4"
8828
- }
8829
- ],
8830
- defaultVariants: {
8831
- style: "contained",
8832
- noActions: false,
8833
- focused: false,
8834
- disabled: false
8835
- }
8908
+ defaultVariants: { style: "contained" }
8836
8909
  }
8837
8910
  );
8911
+ var searchBarStateLayerVariants = classVarianceAuthority.cva([
8912
+ "absolute inset-0 rounded-full pointer-events-none opacity-0",
8913
+ "bg-on-surface",
8914
+ // Effects transition — no overshoot on opacity
8915
+ "transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
8916
+ // Hover: 8%
8917
+ "group-data-[hovered]/search:opacity-8",
8918
+ // Pressed: 10%, doubled selector wins over hover at equal cascade position
8919
+ "group-data-[pressed]/search:group-data-[pressed]/search:opacity-10",
8920
+ // No state layer when disabled
8921
+ "group-data-[disabled]/search:hidden"
8922
+ ]);
8923
+ var searchBarFocusRingVariants = classVarianceAuthority.cva([
8924
+ "pointer-events-none absolute inset-[-3px] rounded-full",
8925
+ "outline outline-[3px] outline-offset-0 outline-secondary",
8926
+ // Effects transition
8927
+ "transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
8928
+ "opacity-0",
8929
+ "group-data-[focus-visible]/search:opacity-100"
8930
+ ]);
8931
+ var searchBarLeadingIconVariants = classVarianceAuthority.cva([
8932
+ "flex size-12 shrink-0 items-center justify-center text-on-surface"
8933
+ ]);
8934
+ var searchBarTrailingActionVariants = classVarianceAuthority.cva([
8935
+ "flex size-12 shrink-0 items-center justify-center text-on-surface-variant"
8936
+ ]);
8937
+ var searchBarAvatarVariants = classVarianceAuthority.cva(["flex size-12 shrink-0 items-center justify-center"]);
8938
+ var searchBarTrailingActionsVariants = classVarianceAuthority.cva(["flex items-center"]);
8939
+ var searchBarInputVariants = classVarianceAuthority.cva([
8940
+ "flex-1 min-w-0 bg-transparent outline-none",
8941
+ "text-body-large text-on-surface",
8942
+ "placeholder:text-on-surface-variant",
8943
+ "focus-visible:outline-none",
8944
+ // Hide native browser search affordances — our MD3 clear button handles clearing
8945
+ "[&::-webkit-search-cancel-button]:appearance-none",
8946
+ "[&::-webkit-search-decoration]:appearance-none"
8947
+ ]);
8838
8948
  var searchViewVariants = classVarianceAuthority.cva(["flex flex-col shadow-elevation-3 z-50 overflow-hidden"], {
8839
8949
  variants: {
8840
8950
  style: {
@@ -8847,31 +8957,32 @@ var searchViewVariants = classVarianceAuthority.cva(["flex flex-col shadow-eleva
8847
8957
  }
8848
8958
  },
8849
8959
  compoundVariants: [
8960
+ // Contained + fullscreen: surface-container-low, square corners
8850
8961
  {
8851
8962
  style: "contained",
8852
8963
  layout: "fullscreen",
8853
8964
  class: "bg-surface-container-low rounded-none"
8854
8965
  },
8966
+ // Contained + docked: surface-container-high, 12dp results rounding, 2dp gap
8855
8967
  {
8856
8968
  style: "contained",
8857
8969
  layout: "docked",
8858
8970
  class: "bg-surface-container-high rounded-xl gap-0.5"
8859
8971
  },
8972
+ // Divided + fullscreen: surface-container-high, square corners
8860
8973
  {
8861
8974
  style: "divided",
8862
8975
  layout: "fullscreen",
8863
8976
  class: "bg-surface-container-high rounded-none"
8864
8977
  },
8978
+ // Divided + docked: surface-container-high, extra-large rounding (28dp)
8865
8979
  {
8866
8980
  style: "divided",
8867
8981
  layout: "docked",
8868
8982
  class: "bg-surface-container-high rounded-[28px]"
8869
8983
  }
8870
8984
  ],
8871
- defaultVariants: {
8872
- style: "contained",
8873
- layout: "fullscreen"
8874
- }
8985
+ defaultVariants: { style: "contained", layout: "fullscreen" }
8875
8986
  });
8876
8987
  var searchViewHeaderVariants = classVarianceAuthority.cva(
8877
8988
  ["flex items-center w-full bg-surface-container-high gap-1"],
@@ -8882,14 +8993,50 @@ var searchViewHeaderVariants = classVarianceAuthority.cva(
8882
8993
  divided: "h-[72px] px-4"
8883
8994
  },
8884
8995
  layout: {
8996
+ // Docked overrides height to 56dp regardless of style
8885
8997
  docked: "h-14",
8886
8998
  fullscreen: ""
8887
8999
  }
8888
9000
  },
8889
- defaultVariants: {
8890
- style: "contained",
8891
- layout: "fullscreen"
8892
- }
9001
+ defaultVariants: { style: "contained", layout: "fullscreen" }
9002
+ }
9003
+ );
9004
+ var searchViewBackButtonVariants = classVarianceAuthority.cva([
9005
+ "flex size-12 shrink-0 items-center justify-center",
9006
+ "text-on-surface rounded-full",
9007
+ "cursor-pointer"
9008
+ ]);
9009
+ var searchViewClearButtonVariants = classVarianceAuthority.cva([
9010
+ "flex size-12 shrink-0 items-center justify-center",
9011
+ "text-on-surface-variant rounded-full",
9012
+ "cursor-pointer",
9013
+ "transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects"
9014
+ ]);
9015
+ var searchViewTrailingActionVariants = classVarianceAuthority.cva([
9016
+ "flex size-12 shrink-0 items-center justify-center text-on-surface-variant"
9017
+ ]);
9018
+ var searchViewTrailingActionsVariants = classVarianceAuthority.cva(["flex items-center"]);
9019
+ var searchViewInputVariants = classVarianceAuthority.cva([
9020
+ "flex-1 min-w-0 bg-transparent outline-none",
9021
+ "text-body-large text-on-surface",
9022
+ "placeholder:text-on-surface-variant",
9023
+ "focus-visible:outline-none",
9024
+ // Hide native browser search affordances
9025
+ "[&::-webkit-search-cancel-button]:appearance-none",
9026
+ "[&::-webkit-search-decoration]:appearance-none"
9027
+ ]);
9028
+ var searchViewDividerVariants = classVarianceAuthority.cva(["border-t border-outline w-full"]);
9029
+ var searchViewContentVariants = classVarianceAuthority.cva(["flex-1 overflow-y-auto"]);
9030
+ var DefaultSearchIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
9031
+ "svg",
9032
+ {
9033
+ width: "24",
9034
+ height: "24",
9035
+ viewBox: "0 0 24 24",
9036
+ fill: "currentColor",
9037
+ "aria-hidden": "true",
9038
+ focusable: "false",
9039
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" })
8893
9040
  }
8894
9041
  );
8895
9042
  var SearchBar = React.forwardRef(
@@ -8910,7 +9057,7 @@ var SearchBar = React.forwardRef(
8910
9057
  onFocus,
8911
9058
  onBlur
8912
9059
  }, ref) => {
8913
- const hasNoActions = (!trailingActions || trailingActions.length === 0) && !avatar;
9060
+ const hasActions = trailingActions != null && trailingActions.length > 0 || !!avatar;
8914
9061
  const reducedMotion = useReducedMotion();
8915
9062
  const [isFocused, setIsFocused] = React.useState(false);
8916
9063
  const handleFocusInternal = React.useCallback(() => {
@@ -8921,83 +9068,85 @@ var SearchBar = React.forwardRef(
8921
9068
  setIsFocused(false);
8922
9069
  onBlur?.();
8923
9070
  }, [onBlur]);
8924
- const { onMouseDown: handleRipple, ripples } = useRipple({
8925
- disabled: isDisabled
8926
- });
8927
- const styledLeadingIcon = leadingIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-on-surface flex size-12 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-6", children: leadingIcon }) }) : void 0;
8928
- const styledTrailingActions = trailingActions?.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx(
8929
- "span",
8930
- {
8931
- className: "text-on-surface-variant flex size-12 shrink-0 items-center justify-center",
8932
- children: action
9071
+ const { isHovered, hoverProps } = reactAria.useHover({ isDisabled });
9072
+ const { isFocusVisible, focusProps } = reactAria.useFocusRing({ within: true });
9073
+ const [isPressed, setIsPressed] = React.useState(false);
9074
+ const { onMouseDown: handleRipple, ripples } = useRipple({ disabled: isDisabled });
9075
+ const handleMouseDown = React.useCallback(
9076
+ (e) => {
9077
+ setIsPressed(true);
9078
+ handleRipple(e);
8933
9079
  },
8934
- index
8935
- ));
8936
- const styledAvatar = avatar ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-12 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-[30px] overflow-hidden rounded-full", children: avatar }) }) : void 0;
9080
+ [handleRipple]
9081
+ );
9082
+ const handleMouseUp = React.useCallback(() => setIsPressed(false), []);
9083
+ const styledLeadingIcon = /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(searchBarLeadingIconVariants()), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-6", children: leadingIcon ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultSearchIcon, {}) }) });
9084
+ const styledTrailingActions = trailingActions?.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(searchBarTrailingActionVariants()), children: action }, index));
9085
+ const styledAvatar = avatar ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(searchBarAvatarVariants()), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-[30px] overflow-hidden rounded-full", children: avatar }) }) : void 0;
9086
+ const paneMarginClass = searchStyle === "contained" ? isFocused ? "mx-3" : "mx-6" : "";
9087
+ const paneTransitionClass = searchStyle === "contained" && !reducedMotion ? "transition-[margin] duration-expressive-fast-spatial ease-expressive-fast-spatial" : "";
8937
9088
  return /* @__PURE__ */ jsxRuntime.jsx(
8938
9089
  "div",
8939
9090
  {
8940
- className: cn(
8941
- reducedMotion ? "" : "duration-short4 ease-standard transition-[margin]",
8942
- isFocused ? "mx-3" : "mx-6"
8943
- ),
8944
- children: /* @__PURE__ */ jsxRuntime.jsxs(
8945
- "div",
8946
- {
8947
- role: "presentation",
8948
- className: cn(
8949
- "group relative overflow-hidden rounded-full",
8950
- "has-[:focus-visible]:ring-secondary has-[:focus-visible]:ring-3",
8951
- searchBarVariants({
8952
- style: searchStyle,
8953
- noActions: hasNoActions,
8954
- disabled: isDisabled
9091
+ role: "presentation",
9092
+ ...reactAria.mergeProps(hoverProps, focusProps),
9093
+ className: cn(paneTransitionClass, paneMarginClass),
9094
+ onMouseUp: handleMouseUp,
9095
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "presentation", className: "relative", children: [
9096
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(searchBarFocusRingVariants()), "aria-hidden": "true" }),
9097
+ /* @__PURE__ */ jsxRuntime.jsxs(
9098
+ "div",
9099
+ {
9100
+ role: "presentation",
9101
+ ...getInteractionDataAttributes({
9102
+ isHovered,
9103
+ isFocusVisible,
9104
+ isPressed,
9105
+ isDisabled
8955
9106
  }),
8956
- className
8957
- ),
8958
- onMouseDown: handleRipple,
8959
- children: [
8960
- /* @__PURE__ */ jsxRuntime.jsx(
8961
- "span",
8962
- {
8963
- "data-slot": "state-layer",
8964
- className: cn(
8965
- "bg-on-surface pointer-events-none absolute inset-0 rounded-full opacity-0",
8966
- "group-hover:opacity-8 group-active:opacity-10",
8967
- "duration-spring-standard-fast-effects ease-spring-standard-fast-effects transition-opacity"
8968
- )
8969
- }
8970
- ),
8971
- /* @__PURE__ */ jsxRuntime.jsx(
8972
- SearchBarHeadless,
8973
- {
8974
- ref,
8975
- ...value !== void 0 ? { value } : {},
8976
- ...defaultValue !== void 0 ? { defaultValue } : {},
8977
- ...onChange !== void 0 ? { onChange } : {},
8978
- ...onSubmit !== void 0 ? { onSubmit } : {},
8979
- ...onClear !== void 0 ? { onClear } : {},
8980
- ...placeholder !== void 0 ? { placeholder } : {},
8981
- ...styledLeadingIcon !== void 0 ? { leadingIcon: styledLeadingIcon } : {},
8982
- ...styledTrailingActions !== void 0 ? { trailingActions: styledTrailingActions } : {},
8983
- ...styledAvatar !== void 0 ? { avatar: styledAvatar } : {},
8984
- ...isDisabled !== void 0 ? { isDisabled } : {},
8985
- ...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : {},
8986
- onFocus: handleFocusInternal,
8987
- onBlur: handleBlurInternal,
8988
- className: cn(
8989
- "relative z-0 flex h-full w-full items-center",
8990
- "[&_input]:flex-1 [&_input]:bg-transparent [&_input]:outline-none",
8991
- "[&_input]:text-body-large [&_input]:text-on-surface",
8992
- "[&_input]:placeholder:text-on-surface-variant",
8993
- "[&_input]:focus-visible:outline-none"
8994
- )
8995
- }
9107
+ "data-with-actions": hasActions ? "" : void 0,
9108
+ className: cn(
9109
+ "group/search overflow-hidden",
9110
+ searchBarRootVariants({ style: searchStyle }),
9111
+ className
8996
9112
  ),
8997
- ripples
8998
- ]
8999
- }
9000
- )
9113
+ onMouseDown: (e) => handleMouseDown(e),
9114
+ children: [
9115
+ /* @__PURE__ */ jsxRuntime.jsx(
9116
+ "span",
9117
+ {
9118
+ "data-slot": "state-layer",
9119
+ className: cn(searchBarStateLayerVariants()),
9120
+ "aria-hidden": "true"
9121
+ }
9122
+ ),
9123
+ ripples,
9124
+ /* @__PURE__ */ jsxRuntime.jsx(
9125
+ SearchBarHeadless,
9126
+ {
9127
+ ref,
9128
+ ...value !== void 0 ? { value } : {},
9129
+ ...defaultValue !== void 0 ? { defaultValue } : {},
9130
+ ...onChange !== void 0 ? { onChange } : {},
9131
+ ...onSubmit !== void 0 ? { onSubmit } : {},
9132
+ ...onClear !== void 0 ? { onClear } : {},
9133
+ ...placeholder !== void 0 ? { placeholder } : {},
9134
+ leadingIcon: styledLeadingIcon,
9135
+ ...styledTrailingActions !== void 0 ? { trailingActions: styledTrailingActions } : {},
9136
+ ...styledAvatar !== void 0 ? { avatar: styledAvatar } : {},
9137
+ isDisabled,
9138
+ ...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : {},
9139
+ onFocus: handleFocusInternal,
9140
+ onBlur: handleBlurInternal,
9141
+ className: "relative z-0 flex h-full w-full items-center",
9142
+ inputClassName: cn(searchBarInputVariants()),
9143
+ trailingActionsClassName: cn(searchBarTrailingActionsVariants())
9144
+ }
9145
+ )
9146
+ ]
9147
+ }
9148
+ )
9149
+ ] })
9001
9150
  }
9002
9151
  );
9003
9152
  }
@@ -9022,21 +9171,29 @@ var SearchView = React.forwardRef(
9022
9171
  showDivider
9023
9172
  }, ref) => {
9024
9173
  const resolvedShowDivider = showDivider ?? searchStyle === "divided";
9174
+ const enterMotionClass = layout === "docked" ? "animate-md-scale-in" : "animate-md-fade-in";
9175
+ const containerClass = cn(
9176
+ searchViewVariants({ style: searchStyle, layout }),
9177
+ enterMotionClass,
9178
+ className
9179
+ );
9180
+ const headerClass = cn(searchViewHeaderVariants({ style: searchStyle, layout }));
9181
+ const backButtonClass = cn(searchViewBackButtonVariants());
9182
+ const clearButtonClass = cn(searchViewClearButtonVariants());
9183
+ const trailingActionClass = cn(searchViewTrailingActionVariants());
9184
+ const trailingActionsGroupClass = cn(searchViewTrailingActionsVariants());
9185
+ const inputClass = cn(searchViewInputVariants());
9186
+ const dividerClass = cn(searchViewDividerVariants());
9187
+ const contentClass = cn(searchViewContentVariants());
9025
9188
  const styledLeadingIcon = leadingIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-on-surface flex size-12 shrink-0 items-center justify-center", children: leadingIcon }) : void 0;
9026
- const styledTrailingActions = trailingActions?.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx(
9027
- "span",
9028
- {
9029
- className: "text-on-surface-variant flex size-12 shrink-0 items-center justify-center",
9030
- children: action
9031
- },
9032
- index
9033
- ));
9189
+ const styledTrailingActions = trailingActions?.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: trailingActionClass, children: action }, index));
9034
9190
  return /* @__PURE__ */ jsxRuntime.jsx(
9035
9191
  SearchViewHeadless,
9036
9192
  {
9037
9193
  ref,
9038
9194
  isOpen,
9039
9195
  onClose,
9196
+ layout,
9040
9197
  ...value !== void 0 ? { value } : {},
9041
9198
  ...defaultValue !== void 0 ? { defaultValue } : {},
9042
9199
  ...onChange !== void 0 ? { onChange } : {},
@@ -9046,53 +9203,20 @@ var SearchView = React.forwardRef(
9046
9203
  ...styledLeadingIcon !== void 0 ? { leadingIcon: styledLeadingIcon } : {},
9047
9204
  ...styledTrailingActions !== void 0 ? { trailingActions: styledTrailingActions } : {},
9048
9205
  showDivider: resolvedShowDivider,
9049
- className: cn(
9050
- searchViewVariants({ style: searchStyle, layout }),
9051
- "animate-md-scale-in",
9052
- getHeaderClasses(searchStyle, layout),
9053
- slotClasses,
9054
- className
9055
- ),
9206
+ className: containerClass,
9207
+ headerClassName: headerClass,
9208
+ backButtonClassName: backButtonClass,
9209
+ clearButtonClassName: clearButtonClass,
9210
+ inputClassName: inputClass,
9211
+ trailingActionsClassName: trailingActionsGroupClass,
9212
+ dividerClassName: dividerClass,
9213
+ contentClassName: contentClass,
9056
9214
  children
9057
9215
  }
9058
9216
  );
9059
9217
  }
9060
9218
  );
9061
9219
  SearchView.displayName = "SearchView";
9062
- var slotClasses = cn(
9063
- // Input styling
9064
- "[&_input]:flex-1 [&_input]:bg-transparent [&_input]:outline-none",
9065
- "[&_input]:text-body-large [&_input]:text-on-surface",
9066
- "[&_input]:placeholder:text-on-surface-variant",
9067
- // Divider
9068
- "[&>[data-slot=divider]]:border-outline",
9069
- // Content area
9070
- "[&>[data-slot=content]]:flex-1 [&>[data-slot=content]]:overflow-y-auto",
9071
- // Clear button
9072
- "[&_[data-slot=clear-button]]:size-12 [&_[data-slot=clear-button]]:flex",
9073
- "[&_[data-slot=clear-button]]:items-center [&_[data-slot=clear-button]]:justify-center",
9074
- "[&_[data-slot=clear-button]]:text-on-surface-variant",
9075
- "[&_[data-slot=clear-button]]:transition-opacity [&_[data-slot=clear-button]]:duration-short4",
9076
- "[&_[data-slot=clear-button]]:ease-standard",
9077
- // Back button
9078
- "[&_[data-slot=back-button]]:size-12 [&_[data-slot=back-button]]:flex",
9079
- "[&_[data-slot=back-button]]:items-center [&_[data-slot=back-button]]:justify-center",
9080
- "[&_[data-slot=back-button]]:text-on-surface"
9081
- );
9082
- function getHeaderClasses(style, layout) {
9083
- const base = "[&>[data-slot=header]]:flex [&>[data-slot=header]]:items-center [&>[data-slot=header]]:w-full [&>[data-slot=header]]:bg-surface-container-high [&>[data-slot=header]]:gap-1";
9084
- if (layout === "docked") {
9085
- return cn(
9086
- base,
9087
- "[&>[data-slot=header]]:h-14",
9088
- style === "contained" ? "[&>[data-slot=header]]:px-3" : "[&>[data-slot=header]]:px-4"
9089
- );
9090
- }
9091
- if (style === "contained") {
9092
- return cn(base, "[&>[data-slot=header]]:h-14 [&>[data-slot=header]]:px-3");
9093
- }
9094
- return cn(base, "[&>[data-slot=header]]:h-[72px] [&>[data-slot=header]]:px-4");
9095
- }
9096
9220
  var Search = React.forwardRef(
9097
9221
  ({
9098
9222
  isOpen: controlledIsOpen,
@@ -16121,8 +16245,22 @@ exports.remToPx = remToPx;
16121
16245
  exports.rgbToHex = rgbToHex;
16122
16246
  exports.richTooltipVariants = richTooltipVariants;
16123
16247
  exports.scrimVariants = scrimVariants2;
16124
- exports.searchBarVariants = searchBarVariants;
16248
+ exports.searchBarAvatarVariants = searchBarAvatarVariants;
16249
+ exports.searchBarFocusRingVariants = searchBarFocusRingVariants;
16250
+ exports.searchBarInputVariants = searchBarInputVariants;
16251
+ exports.searchBarLeadingIconVariants = searchBarLeadingIconVariants;
16252
+ exports.searchBarRootVariants = searchBarRootVariants;
16253
+ exports.searchBarStateLayerVariants = searchBarStateLayerVariants;
16254
+ exports.searchBarTrailingActionVariants = searchBarTrailingActionVariants;
16255
+ exports.searchBarTrailingActionsVariants = searchBarTrailingActionsVariants;
16256
+ exports.searchViewBackButtonVariants = searchViewBackButtonVariants;
16257
+ exports.searchViewClearButtonVariants = searchViewClearButtonVariants;
16258
+ exports.searchViewContentVariants = searchViewContentVariants;
16259
+ exports.searchViewDividerVariants = searchViewDividerVariants;
16125
16260
  exports.searchViewHeaderVariants = searchViewHeaderVariants;
16261
+ exports.searchViewInputVariants = searchViewInputVariants;
16262
+ exports.searchViewTrailingActionVariants = searchViewTrailingActionVariants;
16263
+ exports.searchViewTrailingActionsVariants = searchViewTrailingActionsVariants;
16126
16264
  exports.searchViewVariants = searchViewVariants;
16127
16265
  exports.sliderActiveTrackVariants = sliderActiveTrackVariants;
16128
16266
  exports.sliderContainerVariants = sliderContainerVariants;