import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Search as SearchIcon } from "@truststack/icons-ui";
import { createStyledContext, Input, styled, ThemeableStack, withStaticProperties } from "tamagui";
import { Icon } from "./Icon.native.js";
import { Spinner } from "./Spinner.native.js";
var SearchContext = createStyledContext(),
  SearchFrame = styled(ThemeableStack, {
    name: "Search",
    context: SearchContext,
    backgroundColor: "$surfaceContainerHigh",
    alignItems: "center",
    brc: "transparent",
    btc: "transparent",
    bbc: "transparent",
    blc: "transparent",
    br: "$shape.corner_full",
    height: 56,
    minWidth: 360,
    maxWidth: 720,
    flexDirection: "row",
    variants: {
      loading: {
        true: {},
        false: {}
      }
    },
    defaultVariants: {
      loading: !1
    }
  }),
  StartAdornment = styled(Icon, {
    name: "SearchStartAdornment",
    width: 24,
    height: 24,
    col: "$onSurface",
    marginLeft: 16
  }),
  SearchInput = styled(Input, {
    name: "SearchInput",
    unstyled: !0,
    col: "$onSurfaceVariant",
    placeholder: "Search...",
    marginLeft: 16,
    marginRight: 16,
    flexGrow: 1
  }),
  SearchSpinner = styled(Spinner, {
    name: "SearchSpinner",
    context: SearchContext,
    size: 24,
    col: "$onSurface",
    marginRight: 16,
    variants: {
      loading: {
        true: {},
        false: {
          display: "none"
        }
      }
    },
    defaultVariants: {
      loading: !1
    }
  }),
  EndAdornment = styled(Icon, {
    name: "SearchEndAdornment",
    width: 24,
    height: 24,
    col: "$onSurface",
    marginRight: 16
  }),
  Search = withStaticProperties(SearchFrame, {
    Props: SearchContext.Provider,
    StartAdornment,
    Input: SearchInput,
    EndAdornment,
    Spinner: SearchSpinner
  });
function SearchBar(param) {
  var {
    value,
    onChangeText,
    placeholder = "Search...",
    ...props
  } = param;
  return /* @__PURE__ */_jsxs(Search, {
    ...props,
    children: [/* @__PURE__ */_jsx(Search.StartAdornment, {
      Icon: SearchIcon
    }), /* @__PURE__ */_jsx(Search.Input, {
      placeholder,
      value,
      onChangeText
    }), /* @__PURE__ */_jsx(Search.Spinner, {})]
  });
}
export { Search, SearchBar };
//# sourceMappingURL=Search.native.js.map
