@andrilla/mado-ui 1.0.11 → 1.1.1

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.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { extendTailwindMerge, twJoin } from "tailwind-merge";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { Button as Button$1, Checkbox as Checkbox$1, Description, Dialog, DialogBackdrop, DialogPanel, DialogTitle, Disclosure, DisclosureButton, DisclosurePanel, Field, Fieldset as Fieldset$1, Input as Input$1, Label, Legend, Listbox, ListboxButton, ListboxOption, ListboxOptions, ListboxSelectedOption, Menu, MenuButton, MenuHeading, MenuItem, MenuItems, MenuSection, MenuSeparator, Textarea as Textarea$1 } from "@headlessui/react";
3
+ import { Button as Button$1, Checkbox as Checkbox$1, Combobox, ComboboxButton, ComboboxInput, ComboboxOption, ComboboxOptions, Description, Dialog, DialogBackdrop, DialogPanel, DialogTitle, Disclosure, DisclosureButton, DisclosurePanel, Field, Fieldset as Fieldset$1, Input as Input$1, Label, Legend, Listbox, ListboxButton, ListboxOption, ListboxOptions, ListboxSelectedOption, Menu, MenuButton, MenuHeading, MenuItem, MenuItems, MenuSection, MenuSeparator, Textarea as Textarea$1 } from "@headlessui/react";
4
4
  import * as React from "react";
5
- import { Children, Suspense, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useEffectEvent, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
5
+ import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useEffectEvent, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
6
6
  import * as ReactDOM from "react-dom";
7
7
  import { createPortal } from "react-dom";
8
8
  //#region src/utils/custom-tailwind-merge.ts
@@ -6732,39 +6732,37 @@ function Input({ children, className, description, descriptionProps: { className
6732
6732
  }
6733
6733
  //#endregion
6734
6734
  //#region src/hooks/create-fast-context.tsx
6735
- function createFastContext(defaultInitialState) {
6736
- function useStoreData(initialState = defaultInitialState) {
6737
- const store = useRef(initialState), get = () => store.current, subscribers = useRef(/* @__PURE__ */ new Set());
6738
- const set = (value) => {
6739
- if (typeof value === "function") store.current = value(store.current);
6740
- else store.current = value;
6741
- subscribers.current.forEach((callback) => callback());
6742
- };
6743
- const subscribe = (callback) => {
6744
- subscribers.current.add(callback);
6745
- return () => subscribers.current.delete(callback);
6746
- };
6735
+ function createFastContext(initialState) {
6736
+ function useStoreData() {
6737
+ const store = useRef(initialState);
6738
+ const get = useCallback(() => store.current, []);
6739
+ const subscribers = useRef(/* @__PURE__ */ new Set());
6747
6740
  return {
6748
6741
  get,
6749
- set,
6750
- subscribe
6742
+ set: useCallback((value) => {
6743
+ store.current = {
6744
+ ...store.current,
6745
+ ...value
6746
+ };
6747
+ subscribers.current.forEach((callback) => callback());
6748
+ }, []),
6749
+ subscribe: useCallback((callback) => {
6750
+ subscribers.current.add(callback);
6751
+ return () => subscribers.current.delete(callback);
6752
+ }, [])
6751
6753
  };
6752
6754
  }
6753
6755
  const StoreContext = createContext(null);
6754
- function Provider({ initialValue = defaultInitialState, ...props }) {
6756
+ function Provider({ children }) {
6755
6757
  return /* @__PURE__ */ jsx(StoreContext.Provider, {
6756
- value: useStoreData(initialValue),
6757
- ...props
6758
+ value: useStoreData(),
6759
+ children
6758
6760
  });
6759
6761
  }
6760
- function useStore(selector, initialValue) {
6762
+ function useStore(selector) {
6761
6763
  const store = useContext(StoreContext);
6762
- if (!store) {
6763
- const selectedValue = selector(initialValue !== void 0 ? initialValue : defaultInitialState);
6764
- const noOpSet = () => console.warn("Attempting to set store value outside of Provider");
6765
- return [selectedValue, noOpSet];
6766
- }
6767
- return [useSyncExternalStore(store.subscribe, () => selector(store.get()), () => selector(initialValue !== void 0 ? initialValue : defaultInitialState)), store.set];
6764
+ if (!store) throw new Error("Store not found");
6765
+ return [useSyncExternalStore(store.subscribe, () => selector(store.get()), () => selector(initialState)), store.set];
6768
6766
  }
6769
6767
  return {
6770
6768
  Provider,
@@ -6774,15 +6772,12 @@ function createFastContext(defaultInitialState) {
6774
6772
  //#endregion
6775
6773
  //#region src/hooks/use-form-status.tsx
6776
6774
  const DEFAULT_STATUS = "incomplete";
6777
- const { Provider, useStore } = createFastContext(DEFAULT_STATUS);
6778
- function FormStatusProvider({ children, initialStatus = DEFAULT_STATUS }) {
6779
- return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(Provider, {
6780
- initialValue: initialStatus,
6781
- children
6782
- }) });
6783
- }
6784
- function useFormStatus() {
6785
- return useStore((store) => store);
6775
+ function useFormStatusContext(initialStatus = DEFAULT_STATUS) {
6776
+ const { Provider: FormStatusProvider, useStore: useFormStatus } = createFastContext(initialStatus);
6777
+ return {
6778
+ FormStatusProvider,
6779
+ useFormStatus
6780
+ };
6786
6781
  }
6787
6782
  //#endregion
6788
6783
  //#region src/hooks/use-pointer-movement.ts
@@ -6994,7 +6989,7 @@ function ModalTitle({ as, ref, ...props }) {
6994
6989
  ref
6995
6990
  });
6996
6991
  }
6997
- function ModalDialog(props) {
6992
+ function ModalDialog({ dialogPanelProps: { className: dialogPanelClassName, style: dialogPanelStyle, ...dialogPanelProps } = {}, modalScrollContainerProps: { className: modalScrollContainerClassName, ...modalScrollContainerProps } = {}, ...props }) {
6998
6993
  const [modalControls, setModalControls] = useModalControls((store) => store), isMobileDevice = useMobileDevice();
6999
6994
  const { className, closeModal, dialogPanelRef, isOpen, place, pseudoContainerRef, readyToClose } = modalControls || {};
7000
6995
  const [dialogPanelEl, setDialogPanelEl] = useState(null);
@@ -7030,17 +7025,11 @@ function ModalDialog(props) {
7030
7025
  if (!setModalControls) return;
7031
7026
  if (progressY >= DRAG_TO_CLOSE_PROGRESS && !readyToCloseRef.current) {
7032
7027
  readyToCloseRef.current = true;
7033
- setModalControls((prev) => ({
7034
- ...prev,
7035
- readyToClose: true
7036
- }));
7028
+ setModalControls({ readyToClose: true });
7037
7029
  }
7038
7030
  if (progressY < DRAG_TO_CLOSE_PROGRESS && readyToCloseRef.current) {
7039
7031
  readyToCloseRef.current = false;
7040
- setModalControls((prev) => ({
7041
- ...prev,
7042
- readyToClose: false
7043
- }));
7032
+ setModalControls({ readyToClose: false });
7044
7033
  }
7045
7034
  },
7046
7035
  trigger: draggableTrigger
@@ -7057,7 +7046,6 @@ function ModalDialog(props) {
7057
7046
  pseudoContainer.style.width = `${width}px`;
7058
7047
  pseudoContainer.style.height = `100dvh`;
7059
7048
  pseudoContainer.style.zIndex = "-1";
7060
- pseudoContainer.style.border = "2px solid blue";
7061
7049
  document.body.appendChild(pseudoContainer);
7062
7050
  animate(dialogPanel, {
7063
7051
  ...isMobileDevice ? {
@@ -7125,8 +7113,12 @@ function ModalDialog(props) {
7125
7113
  })
7126
7114
  }), /* @__PURE__ */ jsxs(DialogPanel, {
7127
7115
  ref: setDialogPanelRef,
7128
- className: twMerge("fixed left-1/2 w-screen -translate-x-1/2 bg-neutral-50 px-4 shadow-[0_-15px_50px_-12px] shadow-neutral-950/25 ease-exponential sm:w-[calc(100vw-2rem)] sm:max-w-fit sm:px-6 sm:shadow-2xl lg:px-8 dark:bg-neutral-900", place === "center" ? "top-1/2 -translate-y-1/2 rounded-2xl" : "bottom-0 h-fit max-h-[calc(100dvh-4rem)] translate-y-0 rounded-ss-4xl rounded-se-4xl after:absolute after:inset-x-0 after:-bottom-64 after:h-64 after:bg-inherit sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2 sm:rounded-ee-4xl sm:rounded-es-4xl sm:after:hidden pointer-fine:top-1/2 pointer-fine:bottom-auto pointer-fine:-translate-y-1/2 pointer-fine:rounded-3xl", className),
7129
- style: isMobileDevice ? void 0 : { opacity: 0 },
7116
+ ...dialogPanelProps,
7117
+ className: twMerge("fixed left-1/2 w-screen -translate-x-1/2 bg-neutral-50 shadow-[0_-15px_50px_-12px] shadow-neutral-950/25 ease-exponential sm:w-[calc(100vw-2rem)] sm:max-w-fit sm:shadow-2xl dark:bg-neutral-900", place === "center" ? "top-1/2 -translate-y-1/2 rounded-2xl" : "bottom-0 h-fit max-h-[calc(100dvh-4rem)] translate-y-0 rounded-ss-4xl rounded-se-4xl after:absolute after:inset-x-0 after:-bottom-64 after:h-64 after:bg-inherit sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2 sm:rounded-ee-4xl sm:rounded-es-4xl sm:after:hidden pointer-fine:top-1/2 pointer-fine:bottom-auto pointer-fine:-translate-y-1/2 pointer-fine:rounded-3xl", dialogPanelClassName),
7118
+ style: {
7119
+ ...dialogPanelStyle,
7120
+ ...isMobileDevice ? {} : { opacity: 0 }
7121
+ },
7130
7122
  children: [/* @__PURE__ */ jsx("button", {
7131
7123
  className: "absolute inset-x-0 top-0 z-10 flex h-6 cursor-grab items-center justify-center after:h-1 after:w-8 after:rounded-full after:bg-neutral-500/50 after:transition-[scale,background-color] after:duration-500 after:ease-exponential active:cursor-grabbing active:after:scale-x-150 active:after:scale-y-125 active:after:bg-neutral-500 data-ready:after:scale-x-200 data-ready:after:scale-y-200 data-ready:after:bg-(--base-theme-color) pointer-fine:hover:after:scale-x-125 pointer-fine:hover:after:bg-neutral-500/75 pointer-fine:active:after:scale-x-150 pointer-fine:active:after:bg-neutral-500 data-ready:pointer-fine:hover:after:scale-x-200 data-ready:pointer-fine:hover:after:scale-y-200 data-ready:pointer-fine:hover:after:bg-(--base-theme-color) data-ready:pointer-fine:active:after:scale-x-200 data-ready:pointer-fine:active:after:scale-y-200 data-ready:pointer-fine:active:after:bg-(--base-theme-color)",
7132
7124
  ...readyToClose ? { "data-ready": "" } : {},
@@ -7137,10 +7129,11 @@ function ModalDialog(props) {
7137
7129
  children: "Drag down to close"
7138
7130
  })
7139
7131
  }), /* @__PURE__ */ jsx("div", {
7140
- className: "overflow-y-scroll",
7132
+ ...modalScrollContainerProps,
7133
+ className: twMerge("h-fit max-h-[calc(100dvh-4rem)] overflow-y-scroll px-4 sm:px-6 lg:px-8", modalScrollContainerClassName),
7141
7134
  children: /* @__PURE__ */ jsx("div", {
7142
7135
  ...props,
7143
- className: "py-4 sm:py-6 lg:py-8"
7136
+ className: twMerge("h-full py-3 sm:py-5 lg:py-7", className)
7144
7137
  })
7145
7138
  })]
7146
7139
  })]
@@ -7173,11 +7166,10 @@ function ModalDisplay({ children, className, onClose, onOpen, place = "bottom" }
7173
7166
  const closeFunctions = () => {
7174
7167
  onClose?.();
7175
7168
  modalControls?.pseudoContainerRef?.current?.remove();
7176
- setModalControls?.((previous) => ({
7177
- ...previous,
7169
+ setModalControls?.({
7178
7170
  pseudoContainerRef: { current: null },
7179
7171
  readyToClose: false
7180
- }));
7172
+ });
7181
7173
  };
7182
7174
  const mobileAnimation = {
7183
7175
  y: "100%",
@@ -7206,15 +7198,14 @@ function ModalDisplay({ children, className, onClose, onOpen, place = "bottom" }
7206
7198
  });
7207
7199
  };
7208
7200
  useEffect(() => {
7209
- setModalControls?.((previous) => ({
7210
- ...previous,
7201
+ setModalControls?.({
7211
7202
  isOpen,
7212
7203
  place,
7213
7204
  className,
7214
7205
  openModal,
7215
7206
  closeModal,
7216
7207
  dialogPanelRef: localDialogPanelRef
7217
- }));
7208
+ });
7218
7209
  }, [
7219
7210
  className,
7220
7211
  closeModal,
@@ -7281,6 +7272,10 @@ function ChevronUpChevronDown({ weight = "regular", ...props }) {
7281
7272
  }
7282
7273
  //#endregion
7283
7274
  //#region src/components/select.tsx
7275
+ const { Provider: SelectContextProvider, useStore: useSelectContext } = createFastContext({
7276
+ multiple: false,
7277
+ selectedOptionDisplayProps: {}
7278
+ });
7284
7279
  /**
7285
7280
  * ## Select Section Title
7286
7281
  *
@@ -7295,48 +7290,32 @@ function SelectSectionTitle({ className, ...props }) {
7295
7290
  /**
7296
7291
  * ## SelectOption
7297
7292
  *
7298
- * @prop children - This is what is displayed in the drop down menu
7299
- * @prop name - This is displayed in the trigger button
7300
- * @prop value - This is used for FormData
7301
- */
7302
- function SelectOption({ children, className, name, ...props }) {
7293
+ * @prop children - This is what is displayed in the drop down menu.
7294
+ * @prop name - This is displayed in the trigger button.
7295
+ * @prop value - This is used for FormData.
7296
+ * @prop selectedDisplayProps - This is used to customize the display of the selected option (takes priority over selectedOptionDisplayProps).
7297
+ */
7298
+ function SelectOption({ children, className, name, selectedDisplayProps: { children: selectedDisplayChildren, className: selectedDisplayClassName, ...selectedDisplayProps } = {}, ...props }) {
7299
+ const [selectContext] = useSelectContext((store) => store), { multiple, selectedOptionDisplayProps } = selectContext || {};
7300
+ const { children: selectedOptionDisplayChildren, className: selectedOptionDisplayClassName } = selectedOptionDisplayProps || {};
7303
7301
  return /* @__PURE__ */ jsx(ListboxOption, {
7304
7302
  className: "group/option contents",
7305
7303
  ...props,
7306
7304
  children: (bag) => bag.selectedOption ? /* @__PURE__ */ jsx("span", {
7307
- className: `mr-3 before:absolute before:-left-3 before:content-[',_']`,
7308
- children: name
7305
+ ...selectedOptionDisplayProps,
7306
+ ...selectedDisplayProps,
7307
+ className: twMerge(!selectedDisplayClassName && !selectedOptionDisplayClassName && multiple && `before:content-[',_'] group-first-of-type/option:before:content-['']`, selectedOptionDisplayClassName, selectedDisplayClassName),
7308
+ children: selectedDisplayChildren ? typeof selectedDisplayChildren === "function" ? selectedDisplayChildren(name) : selectedDisplayChildren : selectedOptionDisplayChildren ? typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren : name
7309
7309
  }) : /* @__PURE__ */ jsxs("div", {
7310
- className: twMerge("flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1 transition-[background-color] duration-200 ease-exponential select-none [--theme-color:var(--base-theme-color)] corner-super-1.5 group-disabled/option:opacity-50 group-data-focus/option:bg-(--theme-color)/15 group-data-selected/option:cursor-default group-data-selected/option:text-(--theme-color) group-data-focus/option:group-data-selected/option:bg-transparent dark:group-data-focus/option:bg-(--theme-color)/15", className),
7311
- children: [/* @__PURE__ */ jsx(Checkmark, { className: "invisible size-3.5 group-data-selected/option:visible" }), typeof children === "function" ? children(bag) : children]
7310
+ className: twMerge("flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1 transition-[background-color,color] duration-200 ease-exponential select-none [--theme-color:var(--base-theme-color)] corner-super-1.5 group-disabled/option:opacity-50 group-data-focus/option:bg-(--theme-color)/15 group-data-selected/option:text-(--theme-color) dark:group-data-focus/option:bg-(--theme-color)/15", !multiple && "group-data-selected/option:cursor-default group-data-focus/option:group-data-selected/option:bg-transparent", className),
7311
+ children: [/* @__PURE__ */ jsx(Checkmark, { className: "size-3.5 scale-70 opacity-0 transition-[opacity,scale] duration-200 ease-exponential group-data-selected/option:scale-100 group-data-selected/option:opacity-100" }), typeof children === "function" ? children(bag) : children]
7312
7312
  })
7313
7313
  });
7314
7314
  }
7315
- /**
7316
- * # Select
7317
- *
7318
- * A customizable select component intended to work very similar to HTML's `<select>` element.
7319
- *
7320
- * Use the `SelectOption` component to define the options.
7321
- *
7322
- * Use the `SelectSectionTitle` component to define titles.
7323
- *
7324
- * @prop label - The label for the select component.
7325
- * @prop description - The description for the select component.
7326
- * @prop placeholder - The placeholder for the select component.
7327
- * @prop required - Whether the select component is required.
7328
- * @prop invalid - Whether the select component is invalid.
7329
- * @prop multiple - Whether the select component allows multiple selections.
7330
- * @prop optionsProps - The props to be passed to each SelectOption component.
7331
- * @prop selectedOptionProps - The props to be passed to the selected option component.
7332
- * @prop fieldProps - The props to be passed to the parent field component.
7333
- * @prop labelProps - The props to be passed to the label component.
7334
- * @prop descriptionProps - The props to be passed to the description component.
7335
- * @prop anchor - The anchor point for the drop down menu.
7336
- */
7337
- function Select({ buttonProps, children, className, description, descriptionProps: { className: descriptionClassName, ...descriptionProps } = {}, fieldProps: { className: fieldClassName, ...fieldProps } = {}, invalid, label, labelProps: { className: labelClassName, ...labelProps } = {}, onChange, optionsProps: { anchor, className: optionsClassName, transition, ...optionsProps } = {}, placeholder, required, selectedOptionProps: { ...selectedOptionProps } = {}, ...props }) {
7315
+ function SelectField({ buttonProps, children, className, description, descriptionProps: { className: descriptionClassName, ...descriptionProps } = {}, fieldProps: { className: fieldClassName, ...fieldProps } = {}, invalid, label, labelProps: { className: labelClassName, ...labelProps } = {}, onChange, optionsProps: { anchor, className: optionsClassName, transition, ...optionsProps } = {}, placeholder, required, selectedOptionProps, selectedOptionDisplayProps, ...props }) {
7338
7316
  const uniqueId = useId();
7339
- const multiple = props.multiple;
7317
+ const multiple = Boolean(props.multiple);
7318
+ const [, setSelectContext] = useSelectContext((store) => store);
7340
7319
  const selectOptionList = Children.toArray(children).filter((child) => isValidElement(child) && child.props && typeof child.props === "object" && "name" in child.props && "value" in child.props && "children" in child.props);
7341
7320
  const listboxButtonRef = useRef(null);
7342
7321
  const [isInvalid, setIsInvalid] = useState(invalid);
@@ -7348,6 +7327,15 @@ function Select({ buttonProps, children, className, description, descriptionProp
7348
7327
  };
7349
7328
  const handleInvalid = () => setIsInvalid(true);
7350
7329
  const refocus = () => listboxButtonRef.current?.focus();
7330
+ const onVisible = useEffectEvent(() => {
7331
+ setSelectContext?.({
7332
+ multiple,
7333
+ selectedOptionDisplayProps
7334
+ });
7335
+ });
7336
+ useEffect(() => {
7337
+ onVisible();
7338
+ }, []);
7351
7339
  return /* @__PURE__ */ jsxs(Field, {
7352
7340
  ...fieldProps,
7353
7341
  className: (bag) => twMerge("grid gap-1", typeof fieldClassName === "function" ? fieldClassName(bag) : fieldClassName),
@@ -7404,6 +7392,382 @@ function Select({ buttonProps, children, className, description, descriptionProp
7404
7392
  ]
7405
7393
  });
7406
7394
  }
7395
+ /**
7396
+ * # Select
7397
+ *
7398
+ * A customizable select component intended to work very similar to HTML's `<select>` element.
7399
+ *
7400
+ * Use the `SelectOption` component to define the options.
7401
+ *
7402
+ * Use the `SelectSectionTitle` component to define titles.
7403
+ *
7404
+ * @prop label - The label for the select component.
7405
+ * @prop description - The description for the select component.
7406
+ * @prop placeholder - The placeholder for the select component.
7407
+ * @prop required - Whether the select component is required.
7408
+ * @prop invalid - Whether the select component is invalid.
7409
+ * @prop multiple - Whether the select component allows multiple selections.
7410
+ * @prop optionsProps - The props to be passed to each SelectOption component.
7411
+ * @prop selectedOptionProps - The props to be passed to the selected option component.
7412
+ * @prop selectedOptionDisplayProps - The props to be passed to each selected option in the selected option component.
7413
+ * @prop fieldProps - The props to be passed to the parent field component.
7414
+ * @prop labelProps - The props to be passed to the label component.
7415
+ * @prop descriptionProps - The props to be passed to the description component.
7416
+ * @prop anchor - The anchor point for the drop down menu.
7417
+ */
7418
+ function Select(props) {
7419
+ return /* @__PURE__ */ jsx(SelectContextProvider, { children: /* @__PURE__ */ jsx(SelectField, { ...props }) });
7420
+ }
7421
+ //#endregion
7422
+ //#region src/symbols/plus.tsx
7423
+ function Plus({ weight = "regular", ...props }) {
7424
+ switch (weight) {
7425
+ case "ultralight": return /* @__PURE__ */ jsx("svg", {
7426
+ viewBox: "9.76562 -65.2349 59.96 59.96",
7427
+ ...props,
7428
+ children: /* @__PURE__ */ jsx("path", { d: "M40.8828-6.4126L40.8828-64.0952C40.8828-64.7417 40.3511-65.2349 39.7466-65.2349C39.1421-65.2349 38.6069-64.7417 38.6069-64.0952L38.6069-6.4126C38.6069-5.76611 39.1421-5.27293 39.7466-5.27293C40.3511-5.27293 40.8828-5.76611 40.8828-6.4126ZM10.9053-34.1142L68.5879-34.1142C69.2344-34.1142 69.7242-34.6494 69.7242-35.2539C69.7242-35.8584 69.2344-36.3936 68.5879-36.3936L10.9053-36.3936C10.2554-36.3936 9.76562-35.8584 9.76562-35.2539C9.76562-34.6494 10.2554-34.1142 10.9053-34.1142Z" })
7429
+ });
7430
+ case "thin": return /* @__PURE__ */ jsx("svg", {
7431
+ viewBox: "9.76562 -65.6758 60.83 60.84",
7432
+ ...props,
7433
+ children: /* @__PURE__ */ jsx("path", { d: "M41.9492-6.60743L41.9492-63.9004C41.9492-64.875 41.1406-65.6758 40.1875-65.6758C39.2344-65.6758 38.4121-64.875 38.4121-63.9004L38.4121-6.60743C38.4121-5.63281 39.2344-4.83202 40.1875-4.83202C41.1406-4.83202 41.9492-5.63281 41.9492-6.60743ZM11.541-33.4785L68.834-33.4785C69.8086-33.4785 70.5957-34.3008 70.5957-35.2539C70.5957-36.207 69.8086-37.0293 68.834-37.0293L11.541-37.0293C10.5527-37.0293 9.76562-36.207 9.76562-35.2539C9.76562-34.3008 10.5527-33.4785 11.541-33.4785Z" })
7434
+ });
7435
+ case "light": return /* @__PURE__ */ jsx("svg", {
7436
+ viewBox: "9.76562 -66.5366 62.53 62.57",
7437
+ ...props,
7438
+ children: /* @__PURE__ */ jsx("path", { d: "M44.0313-6.9878L44.0313-63.52C44.0313-65.1353 42.6821-66.5366 41.0483-66.5366C39.4146-66.5366 38.0317-65.1353 38.0317-63.52L38.0317-6.9878C38.0317-5.37256 39.4146-3.97119 41.0483-3.97119C42.6821-3.97119 44.0313-5.37256 44.0313-6.9878ZM12.7822-32.2373L69.3145-32.2373C70.9297-32.2373 72.2974-33.6201 72.2974-35.2539C72.2974-36.8877 70.9297-38.2705 69.3145-38.2705L12.7822-38.2705C11.1333-38.2705 9.76562-36.8877 9.76562-35.2539C9.76562-33.6201 11.1333-32.2373 12.7822-32.2373Z" })
7439
+ });
7440
+ case "regular": return /* @__PURE__ */ jsx("svg", {
7441
+ viewBox: "9.76562 -67.1875 63.82 63.87",
7442
+ ...props,
7443
+ children: /* @__PURE__ */ jsx("path", { d: "M45.6055-7.27539L45.6055-63.2324C45.6055-65.332 43.8477-67.1875 41.6992-67.1875C39.5508-67.1875 37.7441-65.332 37.7441-63.2324L37.7441-7.27539C37.7441-5.17578 39.5508-3.32031 41.6992-3.32031C43.8477-3.32031 45.6055-5.17578 45.6055-7.27539ZM13.7207-31.2988L69.6777-31.2988C71.7773-31.2988 73.584-33.1055 73.584-35.2539C73.584-37.4023 71.7773-39.209 69.6777-39.209L13.7207-39.209C11.5723-39.209 9.76562-37.4023 9.76562-35.2539C9.76562-33.1055 11.5723-31.2988 13.7207-31.2988Z" })
7444
+ });
7445
+ case "medium": return /* @__PURE__ */ jsx("svg", {
7446
+ viewBox: "9.76562 -67.6006 64.67 64.71",
7447
+ ...props,
7448
+ children: /* @__PURE__ */ jsx("path", { d: "M46.8623-7.6709L46.8623-62.8193C46.8623-65.3936 44.7354-67.6006 42.1211-67.6006C39.5068-67.6006 37.3398-65.3936 37.3398-62.8193L37.3398-7.6709C37.3398-5.09668 39.5068-2.88965 42.1211-2.88965C44.7354-2.88965 46.8623-5.09668 46.8623-7.6709ZM14.5469-30.4639L69.6953-30.4639C72.2695-30.4639 74.4365-32.6309 74.4365-35.2451C74.4365-37.8594 72.2695-40.0264 69.6953-40.0264L14.5469-40.0264C11.9326-40.0264 9.76562-37.8594 9.76562-35.2451C9.76562-32.6309 11.9326-30.4639 14.5469-30.4639Z" })
7449
+ });
7450
+ case "semibold": return /* @__PURE__ */ jsx("svg", {
7451
+ viewBox: "9.76562 -67.9173 65.32 65.36",
7452
+ ...props,
7453
+ children: /* @__PURE__ */ jsx("path", { d: "M47.8259-7.97412L47.8259-62.5026C47.8259-65.4407 45.4159-67.9173 42.4445-67.9173C39.4731-67.9173 37.0299-65.4407 37.0299-62.5026L37.0299-7.97412C37.0299-5.03604 39.4731-2.55947 42.4445-2.55947C45.4159-2.55947 47.8259-5.03604 47.8259-7.97412ZM15.1803-29.8237L69.7088-29.8237C72.6469-29.8237 75.0901-32.267 75.0901-35.2384C75.0901-38.2098 72.6469-40.653 69.7088-40.653L15.1803-40.653C12.2089-40.653 9.76562-38.2098 9.76562-35.2384C9.76562-32.267 12.2089-29.8237 15.1803-29.8237Z" })
7454
+ });
7455
+ case "bold": return /* @__PURE__ */ jsx("svg", {
7456
+ viewBox: "9.76562 -68.335 66.19 66.21",
7457
+ ...props,
7458
+ children: /* @__PURE__ */ jsx("path", { d: "M49.0967-8.37402L49.0967-62.085C49.0967-65.5029 46.3135-68.335 42.8711-68.335C39.4287-68.335 36.6211-65.5029 36.6211-62.085L36.6211-8.37402C36.6211-4.95605 39.4287-2.12402 42.8711-2.12402C46.3135-2.12402 49.0967-4.95605 49.0967-8.37402ZM16.0156-28.9795L69.7266-28.9795C73.1445-28.9795 75.9521-31.7871 75.9521-35.2295C75.9521-38.6719 73.1445-41.4795 69.7266-41.4795L16.0156-41.4795C12.5732-41.4795 9.76562-38.6719 9.76562-35.2295C9.76562-31.7871 12.5732-28.9795 16.0156-28.9795Z" })
7459
+ });
7460
+ case "heavy": return /* @__PURE__ */ jsx("svg", {
7461
+ viewBox: "9.76562 -68.9408 67.44 67.45",
7462
+ ...props,
7463
+ children: /* @__PURE__ */ jsx("path", { d: "M50.9399-8.95406L50.9399-61.4791C50.9399-65.5932 47.6153-68.9408 43.4898-68.9408C39.3643-68.9408 36.0282-65.5932 36.0282-61.4791L36.0282-8.95406C36.0282-4.84005 39.3643-1.49243 43.4898-1.49243C47.6153-1.49243 50.9399-4.84005 50.9399-8.95406ZM17.2272-27.755L69.7523-27.755C73.8663-27.755 77.2024-31.0911 77.2024-35.2166C77.2024-39.3421 73.8663-42.6782 69.7523-42.6782L17.2272-42.6782C13.1017-42.6782 9.76562-39.3421 9.76562-35.2166C9.76562-31.0911 13.1017-27.755 17.2272-27.755Z" })
7464
+ });
7465
+ case "black": return /* @__PURE__ */ jsx("svg", {
7466
+ viewBox: "9.76562 -69.4824 68.55 68.55",
7467
+ ...props,
7468
+ children: /* @__PURE__ */ jsx("path", { d: "M52.5879-9.47266L52.5879-60.9375C52.5879-65.6738 48.7793-69.4824 44.043-69.4824C39.3066-69.4824 35.498-65.6738 35.498-60.9375L35.498-9.47266C35.498-4.73633 39.3066-0.927734 44.043-0.927734C48.7793-0.927734 52.5879-4.73633 52.5879-9.47266ZM18.3105-26.6602L69.7754-26.6602C74.5117-26.6602 78.3203-30.4688 78.3203-35.2051C78.3203-39.9414 74.5117-43.75 69.7754-43.75L18.3105-43.75C13.5742-43.75 9.76562-39.9414 9.76562-35.2051C9.76562-30.4688 13.5742-26.6602 18.3105-26.6602Z" })
7469
+ });
7470
+ }
7471
+ }
7472
+ //#endregion
7473
+ //#region src/components/search.tsx
7474
+ const { Provider: SearchContextProvider, useStore: useSearchContext } = createFastContext({
7475
+ multiple: false,
7476
+ query: "",
7477
+ selectedOptionDisplayProps: {},
7478
+ selectedOptionList: []
7479
+ });
7480
+ /**
7481
+ * ## Search Section Title
7482
+ *
7483
+ * Displays a simple title.
7484
+ */
7485
+ function SearchSectionTitle({ className, ...props }) {
7486
+ return /* @__PURE__ */ jsx("div", {
7487
+ className: twMerge("sticky -top-1 z-10 -mx-1 bg-inherit mask-t-from-transparent mask-t-from-0 mask-t-to-white mask-t-to-1.5 pl-2 font-bold text-neutral-500/50 backdrop-blur-[2px] backdrop-brightness-101", className),
7488
+ ...props
7489
+ });
7490
+ }
7491
+ /**
7492
+ * ## SearchOption
7493
+ *
7494
+ * @prop children - This is what is displayed in the drop down menu
7495
+ * @prop name - This is used for filtering by default
7496
+ * @prop value - This is used as selected value and for FormData
7497
+ */
7498
+ function SearchOption({ children, className, isInDisplay, name, selectedDisplayProps: { children: selectedDisplayChildren, className: selectedDisplayClassName, ...selectedDisplayProps } = {}, value, ...props }) {
7499
+ const [searchContext] = useSearchContext((store) => store);
7500
+ const { multiple, query, selectedOptionDisplayProps } = searchContext || {};
7501
+ if (!((query || "").trim() === "" || name.toLowerCase().includes((query || "").toLowerCase()) || isInDisplay)) return /* @__PURE__ */ jsx(Fragment, {});
7502
+ const { children: selectedOptionDisplayChildren, className: selectedOptionDisplayClassName } = selectedOptionDisplayProps || {};
7503
+ return isInDisplay ? /* @__PURE__ */ jsx("span", {
7504
+ ...selectedOptionDisplayProps,
7505
+ ...selectedDisplayProps,
7506
+ className: twMerge(!selectedDisplayClassName && !selectedOptionDisplayClassName && multiple && `after:content-[',_'] last-of-type:after:content-['']`, selectedOptionDisplayClassName, selectedDisplayClassName),
7507
+ children: selectedDisplayChildren ? typeof selectedDisplayChildren === "function" ? selectedDisplayChildren(name) : selectedDisplayChildren : selectedOptionDisplayChildren ? typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren : name
7508
+ }) : /* @__PURE__ */ jsx(ComboboxOption, {
7509
+ className: "group/option contents",
7510
+ value: {
7511
+ id: value,
7512
+ name
7513
+ },
7514
+ ...props,
7515
+ children: (bag) => /* @__PURE__ */ jsxs("div", {
7516
+ className: twMerge("flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1 transition-[background-color,color] duration-200 ease-exponential select-none [--theme-color:var(--base-theme-color)] corner-super-1.5 group-disabled/option:opacity-50 group-data-focus/option:bg-(--theme-color)/15 group-data-selected/option:text-(--theme-color) dark:group-data-focus/option:bg-(--theme-color)/15", !multiple && "group-data-selected/option:cursor-default group-data-focus/option:group-data-selected/option:bg-transparent", className),
7517
+ children: [/* @__PURE__ */ jsx(Checkmark, { className: "size-3.5 scale-70 opacity-0 transition-[opacity,scale] duration-200 ease-exponential group-data-selected/option:scale-100 group-data-selected/option:opacity-100" }), typeof children === "function" ? children(bag) : children ?? name]
7518
+ })
7519
+ });
7520
+ }
7521
+ function checkEquality(aOptionList, bOptionList) {
7522
+ if (aOptionList.length !== bOptionList.length) return false;
7523
+ for (let i = 0; i < aOptionList.length; i += 1) {
7524
+ const aOption = aOptionList[i], bOption = bOptionList[i];
7525
+ if (aOption?.id !== bOption?.id || aOption?.name !== bOption?.name) return false;
7526
+ }
7527
+ return true;
7528
+ }
7529
+ function SearchField({ allowCustom, buttonProps, children, className, defaultValue, description, descriptionProps: { className: descriptionClassName, ...descriptionProps } = {}, fieldProps: { className: fieldClassName, ...fieldProps } = {}, inputProps, invalid, label, labelProps: { className: labelClassName, ...labelProps } = {}, multiple, onChange, optionsProps: { anchor, className: optionsClassName, transition, ...optionsProps } = {}, placeholder, required = true, shelfProps: { className: shelfClassName, ...shelfProps } = {}, selectedOptionDisplayProps, singleDisplay, ...props }) {
7530
+ const uniqueId = useId();
7531
+ const [searchContext, setSearchContext] = useSearchContext((store) => store), { query } = searchContext || {};
7532
+ const [isInvalid, setIsInvalid] = useState(invalid);
7533
+ const [selectedOptionSync, setSelectedOptionSync] = useState(() => {
7534
+ if (multiple) return Array.isArray(defaultValue) ? defaultValue : [];
7535
+ return typeof defaultValue === "string" ? defaultValue : null;
7536
+ });
7537
+ const comboboxInputRef = useRef(null);
7538
+ const childOptionList = useMemo(() => Children.toArray(children).filter((child) => isValidElement(child) && !!child.props && "value" in child.props && "name" in child.props), [children]);
7539
+ const staticOptionList = useMemo(() => childOptionList.map((child) => ({
7540
+ id: child.props.value,
7541
+ name: child.props.name,
7542
+ selectedDisplayProps: child.props.selectedDisplayProps
7543
+ })), [childOptionList]);
7544
+ const [addedOptionList, setAddedOptionList] = useState([]);
7545
+ const customOptionFromQuery = useMemo(() => {
7546
+ const trimmedQuery = query.trim();
7547
+ if (!allowCustom || trimmedQuery.length === 0) return null;
7548
+ return {
7549
+ id: props.customOptionParams?.formatID?.(trimmedQuery) ?? toLowerCase(trimmedQuery, [" ", "_"]),
7550
+ name: trimmedQuery
7551
+ };
7552
+ }, [
7553
+ allowCustom,
7554
+ props.customOptionParams,
7555
+ query
7556
+ ]);
7557
+ const optionLookupMap = useMemo(() => {
7558
+ const lookupMap = /* @__PURE__ */ new Map();
7559
+ for (const option of staticOptionList) lookupMap.set(option.id, option.name);
7560
+ for (const option of addedOptionList) lookupMap.set(option.id, option.name);
7561
+ return lookupMap;
7562
+ }, [addedOptionList, staticOptionList]);
7563
+ const saveCustomOption = useEffectEvent((option) => {
7564
+ if (!multiple) return;
7565
+ setAddedOptionList((prevOptionList) => {
7566
+ if (prevOptionList.some((prevOption) => prevOption.id === option.id)) return prevOptionList;
7567
+ return [...prevOptionList, option];
7568
+ });
7569
+ });
7570
+ const handleChange = (selected) => {
7571
+ setIsInvalid(false);
7572
+ if (multiple && Array.isArray(selected)) {
7573
+ const selectedValueList = selected.map((selectedValue) => {
7574
+ if (selectedValue && typeof selectedValue === "object" && "id" in selectedValue && "name" in selectedValue) {
7575
+ const option = {
7576
+ id: String(selectedValue.id),
7577
+ name: String(selectedValue.name)
7578
+ };
7579
+ saveCustomOption(option);
7580
+ return option.id;
7581
+ }
7582
+ return String(selectedValue);
7583
+ });
7584
+ setSelectedOptionSync(selectedValueList);
7585
+ onChange?.(selectedValueList);
7586
+ return;
7587
+ }
7588
+ if (!multiple) {
7589
+ const normalizedSelected = selected && typeof selected === "object" && !Array.isArray(selected) ? String(selected.id) : selected;
7590
+ setSelectedOptionSync(normalizedSelected);
7591
+ onChange?.(normalizedSelected);
7592
+ return;
7593
+ }
7594
+ setSelectedOptionSync(selected);
7595
+ };
7596
+ const formatSelectedDisplay = (name) => {
7597
+ const selectedOptionDisplayChildren = selectedOptionDisplayProps?.children;
7598
+ if (!selectedOptionDisplayChildren) return name;
7599
+ const selectedOptionDisplayValue = typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren;
7600
+ return typeof selectedOptionDisplayValue === "string" ? selectedOptionDisplayValue : name;
7601
+ };
7602
+ const handleInvalid = () => setIsInvalid(true);
7603
+ const refocus = () => comboboxInputRef.current?.focus();
7604
+ const onVisible = useEffectEvent(() => {
7605
+ setSearchContext?.({
7606
+ multiple,
7607
+ query: "",
7608
+ selectedOptionDisplayProps
7609
+ });
7610
+ });
7611
+ useEffect(() => {
7612
+ onVisible();
7613
+ }, []);
7614
+ useEffect(() => {
7615
+ const selectedOptionList = (Array.isArray(selectedOptionSync) ? selectedOptionSync : typeof selectedOptionSync === "string" ? [selectedOptionSync] : []).map((selectedId) => ({
7616
+ id: selectedId,
7617
+ name: optionLookupMap.get(selectedId) ?? selectedId
7618
+ }));
7619
+ if (!checkEquality(searchContext?.selectedOptionList ?? [], selectedOptionList)) setSearchContext?.({ selectedOptionList });
7620
+ }, [
7621
+ optionLookupMap,
7622
+ searchContext?.selectedOptionList,
7623
+ selectedOptionSync,
7624
+ setSearchContext
7625
+ ]);
7626
+ const queryChange = (e) => {
7627
+ const { currentTarget } = e, { value } = currentTarget;
7628
+ setSearchContext?.({ query: value });
7629
+ };
7630
+ const handleClose = () => {
7631
+ setSearchContext?.({ query: "" });
7632
+ };
7633
+ const updateDisplayValue = (value) => {
7634
+ if (multiple && Array.isArray(value)) {
7635
+ if (singleDisplay) return value.map((v) => formatSelectedDisplay(v.name)).join(", ");
7636
+ }
7637
+ if (!multiple && value) return formatSelectedDisplay(value.name);
7638
+ return "";
7639
+ };
7640
+ return /* @__PURE__ */ jsxs(Field, {
7641
+ ...fieldProps,
7642
+ className: (bag) => twMerge("grid gap-1", typeof fieldClassName === "function" ? fieldClassName(bag) : fieldClassName),
7643
+ children: [
7644
+ label && /* @__PURE__ */ jsx(Label, {
7645
+ ...labelProps,
7646
+ className: (bag) => twMerge("text-sm font-medium", required ? `after:text-red-700 after:content-['_*']` : "", typeof labelClassName === "function" ? labelClassName(bag) : labelClassName),
7647
+ children: label
7648
+ }),
7649
+ /* @__PURE__ */ jsxs(Combobox, {
7650
+ ...props,
7651
+ invalid: isInvalid || invalid,
7652
+ multiple,
7653
+ onChange: handleChange,
7654
+ onClose: handleClose,
7655
+ children: [/* @__PURE__ */ jsxs("div", {
7656
+ ...multiple ? { "data-multiple": "" } : {},
7657
+ className: "isolate contents data-multiple:grid",
7658
+ children: [/* @__PURE__ */ jsxs("div", {
7659
+ className: "relative",
7660
+ children: [
7661
+ /* @__PURE__ */ jsx(ComboboxInput, {
7662
+ ...inputProps,
7663
+ "aria-label": typeof label === "string" ? label : props.name,
7664
+ className: (bag) => twMerge("inline-block w-full overflow-clip rounded-xl border border-neutral-500/50 bg-neutral-100 py-1 pr-8 pl-2 text-left text-neutral-950 outline-offset-1 outline-blue-400/95 transition-[background-color] duration-300 ease-exponential corner-super-1.5 dark:bg-neutral-700 dark:text-neutral-50", "focus:outline-3 focus-visible:bg-neutral-50 focus-visible:outline-3 active:bg-neutral-200 dark:focus-visible:bg-neutral-600 dark:active:bg-neutral-800 pointer-fine:hover:bg-neutral-50 pointer-fine:active:bg-neutral-200 dark:pointer-fine:hover:bg-neutral-600 dark:pointer-fine:active:bg-neutral-800", "data-invalid:border-red-500 data-invalid:bg-[color-mix(in_oklch,var(--color-red-500)_5%,var(--color-neutral-100)_5%)] data-invalid:focus-visible:bg-[color-mix(in_oklch,var(--color-red-500)_1%,var(--color-neutral-100))] data-invalid:active:bg-[color-mix(in_oklch,var(--color-red-500)_5%,var(--color-neutral-100))] dark:data-invalid:bg-[color-mix(in_oklch,var(--color-red-500)_5%,var(--color-neutral-800)_5%)] dark:data-invalid:focus-visible:bg-[color-mix(in_oklch,var(--color-red-500)_1%,var(--color-neutral-800))] dark:data-invalid:active:bg-[color-mix(in_oklch,var(--color-red-500)_5%,var(--color-neutral-800)_5%)] data-invalid:pointer-fine:hover:bg-[color-mix(in_oklch,var(--color-red-500)_10%,var(--color-neutral-500)_5%)] data-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklch,var(--color-red-500)_1%,var(--color-neutral-100))] data-invalid:pointer-fine:active:bg-[color-mix(in_oklch,var(--color-red-500)_5%,var(--color-neutral-100))] dark:data-invalid:pointer-fine:hover:bg-[color-mix(in_oklch,var(--color-red-500)_10%,var(--color-neutral-800)_5%)] dark:data-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklch,var(--color-red-500)_1%,var(--color-neutral-800))] dark:data-invalid:pointer-fine:active:bg-[color-mix(in_oklch,var(--color-red-500)_5%,var(--color-neutral-800)_5%)]", typeof className === "function" ? className(bag) : className),
7665
+ displayValue: updateDisplayValue,
7666
+ name: props.name,
7667
+ onChange: queryChange,
7668
+ placeholder: placeholder || `${multiple ? "Choose Any" : "Choose One"}${allowCustom ? " or Create Your Own" : ""}`,
7669
+ ref: comboboxInputRef,
7670
+ required
7671
+ }),
7672
+ /* @__PURE__ */ jsx("input", {
7673
+ "aria-hidden": "true",
7674
+ className: "sr-only top-0 left-1/2",
7675
+ id: props.name + ":input:id" + uniqueId,
7676
+ name: props.name,
7677
+ onChange: () => {},
7678
+ onFocus: refocus,
7679
+ onInvalid: handleInvalid,
7680
+ required,
7681
+ tabIndex: -1,
7682
+ value: Array.isArray(selectedOptionSync) ? selectedOptionSync.join(", ") : selectedOptionSync ?? ""
7683
+ }),
7684
+ /* @__PURE__ */ jsx(ComboboxButton, {
7685
+ ...buttonProps,
7686
+ className: "absolute top-1/2 right-1.5 -translate-y-1/2 rounded p-0.5",
7687
+ children: /* @__PURE__ */ jsx(ChevronUpChevronDown, { className: "size-3 fill-current/50" })
7688
+ })
7689
+ ]
7690
+ }), multiple && !singleDisplay && /* @__PURE__ */ jsx("div", {
7691
+ ...shelfProps,
7692
+ className: twMerge("flex min-h-8 flex-wrap gap-1 p-2 before:absolute before:inset-x-0 before:-top-4 before:bottom-0 before:-z-10 before:rounded-b-xl before:border before:border-t-0 before:border-neutral-500/50", shelfClassName),
7693
+ children: searchContext?.selectedOptionList?.length > 0 && [...staticOptionList, ...addedOptionList].filter((option, optionIndex, optionList) => {
7694
+ return optionList.findIndex((innerOption) => innerOption.id === option.id) === optionIndex;
7695
+ }).map((option) => {
7696
+ if (!searchContext.selectedOptionList.some(({ id }) => id === option.id)) return null;
7697
+ return /* @__PURE__ */ jsx(SearchOption, {
7698
+ name: option.name,
7699
+ value: option.id,
7700
+ selectedDisplayProps: option.selectedDisplayProps,
7701
+ isInDisplay: true,
7702
+ children: option.name
7703
+ }, option.id);
7704
+ }).filter(Boolean)
7705
+ })]
7706
+ }), /* @__PURE__ */ jsxs(ComboboxOptions, {
7707
+ ...optionsProps,
7708
+ anchor: anchor || "bottom start",
7709
+ className: (bag) => twMerge("z-50 w-(--input-width) origin-top rounded-xl border border-neutral-500/50 bg-neutral-50/95 p-1 backdrop-blur-sm backdrop-brightness-110 transition-[opacity,scale,translate] duration-300 ease-exponential corner-super-1.5 empty:invisible focus:outline-none data-closed:-translate-y-0.5 data-closed:scale-y-0 data-closed:opacity-0 data-[anchor*=top]:origin-bottom dark:bg-neutral-800/95", multiple && !singleDisplay ? "[--anchor-gap:--spacing(8)]" : "[--anchor-gap:--spacing(1)]", typeof optionsClassName === "function" ? optionsClassName(bag) : optionsClassName),
7710
+ transition: transition ?? true,
7711
+ children: [
7712
+ allowCustom && query.length > 0 && customOptionFromQuery && !addedOptionList.some((addedOption) => addedOption.id === customOptionFromQuery.id) && /* @__PURE__ */ jsx(ComboboxOption, {
7713
+ value: customOptionFromQuery,
7714
+ className: "group/option contents",
7715
+ children: /* @__PURE__ */ jsxs("div", {
7716
+ className: "flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1 transition-[background-color] duration-200 ease-exponential select-none [--theme-color:var(--base-theme-color)] corner-super-1.5 group-disabled/option:opacity-50 group-data-focus/option:bg-(--theme-color)/15 dark:group-data-focus/option:bg-(--theme-color)/15",
7717
+ children: [
7718
+ /* @__PURE__ */ jsx(Plus, { className: "size-3.5" }),
7719
+ "Use ",
7720
+ /* @__PURE__ */ jsxs("b", { children: [
7721
+ "\"",
7722
+ query,
7723
+ "\""
7724
+ ] })
7725
+ ]
7726
+ })
7727
+ }),
7728
+ children,
7729
+ multiple && addedOptionList.filter((addedOption) => !staticOptionList.some((staticOption) => staticOption.id === addedOption.id)).map((addedOption) => /* @__PURE__ */ jsx(SearchOption, {
7730
+ name: addedOption.name,
7731
+ value: addedOption.id,
7732
+ selectedDisplayProps: addedOption.selectedDisplayProps,
7733
+ children: addedOption.name
7734
+ }, "added:" + addedOption.id))
7735
+ ]
7736
+ })]
7737
+ }),
7738
+ description && /* @__PURE__ */ jsx(Description, {
7739
+ ...descriptionProps,
7740
+ className: (bag) => twMerge("text-xs text-current/60", typeof descriptionClassName === "function" ? descriptionClassName(bag) : descriptionClassName),
7741
+ children: description
7742
+ })
7743
+ ]
7744
+ });
7745
+ }
7746
+ /**
7747
+ * # Search
7748
+ *
7749
+ * A searchable select component built on top of Headless UI's `Combobox`.
7750
+ *
7751
+ * Use the `SearchOption` component to define options.
7752
+ *
7753
+ * Use the `SearchSectionTitle` component to define titles.
7754
+ *
7755
+ * @prop label - The label for the select component.
7756
+ * @prop description - The description for the select component.
7757
+ * @prop placeholder - The placeholder for the select component.
7758
+ * @prop required - Whether the select component is required.
7759
+ * @prop invalid - Whether the select component is invalid.
7760
+ * @prop multiple - Whether the select component allows multiple selections.
7761
+ * @prop optionsProps - The props to be passed to each SearchOption component.
7762
+ * @prop selectedOptionDisplayProps - The props to be passed to each selected option in the selected option component.
7763
+ * @prop fieldProps - The props to be passed to the parent field component.
7764
+ * @prop labelProps - The props to be passed to the label component.
7765
+ * @prop descriptionProps - The props to be passed to the description component.
7766
+ * @prop anchor - The anchor point for the drop down menu.
7767
+ */
7768
+ function Search(props) {
7769
+ return /* @__PURE__ */ jsx(SearchContextProvider, { children: /* @__PURE__ */ jsx(SearchField, { ...props }) });
7770
+ }
7407
7771
  //#endregion
7408
7772
  //#region src/symbols/circle.fill.tsx
7409
7773
  function CircleFill({ weight = "regular", ...props }) {
@@ -9406,25 +9770,21 @@ function TooltipDisplay({ anchor = "top", arrow: arrow$4, arrowClassName, childr
9406
9770
  clearTimeout(timeoutRef.current);
9407
9771
  };
9408
9772
  }, []);
9409
- const [, setTooltipContext] = useTooltipContext(() => void 0, defaultTooltipContext);
9773
+ const [tooltipContext, setTooltipContext] = useTooltipContext(() => defaultTooltipContext);
9410
9774
  useEffect(() => {
9411
- setTooltipContext?.((previous) => {
9412
- const nextArrow = arrow$4 || false, nextArrowClassName = arrowClassName || "";
9413
- if (previous.isOpen === isOpen && previous.openTooltip === openTooltip && previous.closeTooltip === closeTooltip && previous.refs === refs && previous.floatingStyles === floatingStyles && previous.isPositioned === isPositioned && previous.placement === placement && previous.middlewareData === middlewareData && previous.arrowRef === arrowRef && previous.arrow === nextArrow && previous.arrowClassName === nextArrowClassName) return previous;
9414
- return {
9415
- ...previous,
9416
- isOpen,
9417
- openTooltip,
9418
- closeTooltip,
9419
- refs,
9420
- floatingStyles,
9421
- isPositioned,
9422
- placement,
9423
- middlewareData,
9424
- arrowRef,
9425
- arrow: nextArrow,
9426
- arrowClassName: nextArrowClassName
9427
- };
9775
+ const nextArrow = arrow$4 || false, nextArrowClassName = arrowClassName || "";
9776
+ if (tooltipContext && tooltipContext.isOpen !== isOpen || tooltipContext.openTooltip !== openTooltip || tooltipContext.closeTooltip !== closeTooltip || tooltipContext.refs !== refs || tooltipContext.floatingStyles !== floatingStyles || tooltipContext.isPositioned !== isPositioned || tooltipContext.placement !== placement || tooltipContext.middlewareData !== middlewareData || tooltipContext.arrowRef !== arrowRef || tooltipContext.arrow !== nextArrow || tooltipContext.arrowClassName !== nextArrowClassName) setTooltipContext?.({
9777
+ isOpen,
9778
+ openTooltip,
9779
+ closeTooltip,
9780
+ refs,
9781
+ floatingStyles,
9782
+ isPositioned,
9783
+ placement,
9784
+ middlewareData,
9785
+ arrowRef,
9786
+ arrow: nextArrow,
9787
+ arrowClassName: nextArrowClassName
9428
9788
  });
9429
9789
  }, [
9430
9790
  arrow$4,
@@ -9899,4 +10259,4 @@ function YouTubeLogo({ className, cutout = false, targets, ...props }) {
9899
10259
  });
9900
10260
  }
9901
10261
  //#endregion
9902
- export { Anchor, Button, Checkbox, Details, DetailsBody, DetailsSummary, DropDown, DropDownButton, DropDownItem, DropDownItems, DropDownSection, DropDownSeparator, FacebookLogo, Fieldset, Form, FormStatusProvider, Ghost, GoogleLogo, Heading, HumanVerification, IFrame, Input, InstagramLogo, Link, LinkedInLogo, Modal, ModalClose, ModalDialog, ModalTitle, ModalTrigger, Select, SelectOption, SelectSectionTitle, SubmitButton, Textarea, TikTokLogo, Time, Tooltip, TooltipPanel, TooltipTrigger, XLogo, YouTubeLogo, addClass, createFastContext, currentMonthName, currentWeekdayName, daysInMonth, easeOutExpo, emailRegex, extendMadoTailwindMerge, firstOfMonth, formatPhoneNumber, generateHumanValidationToken, getDate, getHours, getHoursIn12, getLinkClasses, getLocalTime, getMeridianFromHour, getMilliseconds, getMinutes, getMonth, getMonthIndexFromName, getMonthName, getNextMonth, getPreviousMonth, getSeconds, getTimezone, getUserReadableDate, getUserReadableDateFromTimestampz, getWeekdayName, getYearsInRange, hasClass, isEmail, isPhoneNumber, monthNamesList, removeClass, splitCamelCase, telRegex, toCamelCase, toFullDateString, toLowerCase, toTitleCase, toggleClass, twMerge, useFormStatus, useMobileDevice, usePointerMovement, validateHuman, weekdayNamesList };
10262
+ export { Anchor, Button, Checkbox, Details, DetailsBody, DetailsSummary, DropDown, DropDownButton, DropDownItem, DropDownItems, DropDownSection, DropDownSeparator, FacebookLogo, Fieldset, Form, Ghost, GoogleLogo, Heading, HumanVerification, IFrame, Input, InstagramLogo, Link, LinkedInLogo, Modal, ModalClose, ModalDialog, ModalTitle, ModalTrigger, Search, SearchOption, SearchSectionTitle, Select, SelectOption, SelectSectionTitle, SubmitButton, Textarea, TikTokLogo, Time, Tooltip, TooltipPanel, TooltipTrigger, XLogo, YouTubeLogo, addClass, createFastContext, currentMonthName, currentWeekdayName, daysInMonth, easeOutExpo, emailRegex, extendMadoTailwindMerge, firstOfMonth, formatPhoneNumber, generateHumanValidationToken, getDate, getHours, getHoursIn12, getLinkClasses, getLocalTime, getMeridianFromHour, getMilliseconds, getMinutes, getMonth, getMonthIndexFromName, getMonthName, getNextMonth, getPreviousMonth, getSeconds, getTimezone, getUserReadableDate, getUserReadableDateFromTimestampz, getWeekdayName, getYearsInRange, hasClass, isEmail, isPhoneNumber, monthNamesList, removeClass, splitCamelCase, telRegex, toCamelCase, toFullDateString, toLowerCase, toTitleCase, toggleClass, twMerge, useFormStatusContext, useMobileDevice, usePointerMovement, validateHuman, weekdayNamesList };