@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/client.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { extendTailwindMerge, twJoin } from "tailwind-merge";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- 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";
4
+ 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";
5
5
  import * as React from "react";
6
- import { Children, Suspense, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useEffectEvent, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
6
+ import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useEffectEvent, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
7
7
  import * as ReactDOM from "react-dom";
8
8
  import { createPortal } from "react-dom";
9
9
  //#region src/utils/custom-tailwind-merge.ts
@@ -6733,39 +6733,37 @@ function Input({ children, className, description, descriptionProps: { className
6733
6733
  }
6734
6734
  //#endregion
6735
6735
  //#region src/hooks/create-fast-context.tsx
6736
- function createFastContext(defaultInitialState) {
6737
- function useStoreData(initialState = defaultInitialState) {
6738
- const store = useRef(initialState), get = () => store.current, subscribers = useRef(/* @__PURE__ */ new Set());
6739
- const set = (value) => {
6740
- if (typeof value === "function") store.current = value(store.current);
6741
- else store.current = value;
6742
- subscribers.current.forEach((callback) => callback());
6743
- };
6744
- const subscribe = (callback) => {
6745
- subscribers.current.add(callback);
6746
- return () => subscribers.current.delete(callback);
6747
- };
6736
+ function createFastContext(initialState) {
6737
+ function useStoreData() {
6738
+ const store = useRef(initialState);
6739
+ const get = useCallback(() => store.current, []);
6740
+ const subscribers = useRef(/* @__PURE__ */ new Set());
6748
6741
  return {
6749
6742
  get,
6750
- set,
6751
- subscribe
6743
+ set: useCallback((value) => {
6744
+ store.current = {
6745
+ ...store.current,
6746
+ ...value
6747
+ };
6748
+ subscribers.current.forEach((callback) => callback());
6749
+ }, []),
6750
+ subscribe: useCallback((callback) => {
6751
+ subscribers.current.add(callback);
6752
+ return () => subscribers.current.delete(callback);
6753
+ }, [])
6752
6754
  };
6753
6755
  }
6754
6756
  const StoreContext = createContext(null);
6755
- function Provider({ initialValue = defaultInitialState, ...props }) {
6757
+ function Provider({ children }) {
6756
6758
  return /* @__PURE__ */ jsx(StoreContext.Provider, {
6757
- value: useStoreData(initialValue),
6758
- ...props
6759
+ value: useStoreData(),
6760
+ children
6759
6761
  });
6760
6762
  }
6761
- function useStore(selector, initialValue) {
6763
+ function useStore(selector) {
6762
6764
  const store = useContext(StoreContext);
6763
- if (!store) {
6764
- const selectedValue = selector(initialValue !== void 0 ? initialValue : defaultInitialState);
6765
- const noOpSet = () => console.warn("Attempting to set store value outside of Provider");
6766
- return [selectedValue, noOpSet];
6767
- }
6768
- return [useSyncExternalStore(store.subscribe, () => selector(store.get()), () => selector(initialValue !== void 0 ? initialValue : defaultInitialState)), store.set];
6765
+ if (!store) throw new Error("Store not found");
6766
+ return [useSyncExternalStore(store.subscribe, () => selector(store.get()), () => selector(initialState)), store.set];
6769
6767
  }
6770
6768
  return {
6771
6769
  Provider,
@@ -6775,15 +6773,12 @@ function createFastContext(defaultInitialState) {
6775
6773
  //#endregion
6776
6774
  //#region src/hooks/use-form-status.tsx
6777
6775
  const DEFAULT_STATUS = "incomplete";
6778
- const { Provider, useStore } = createFastContext(DEFAULT_STATUS);
6779
- function FormStatusProvider({ children, initialStatus = DEFAULT_STATUS }) {
6780
- return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(Provider, {
6781
- initialValue: initialStatus,
6782
- children
6783
- }) });
6784
- }
6785
- function useFormStatus() {
6786
- return useStore((store) => store);
6776
+ function useFormStatusContext(initialStatus = DEFAULT_STATUS) {
6777
+ const { Provider: FormStatusProvider, useStore: useFormStatus } = createFastContext(initialStatus);
6778
+ return {
6779
+ FormStatusProvider,
6780
+ useFormStatus
6781
+ };
6787
6782
  }
6788
6783
  //#endregion
6789
6784
  //#region src/hooks/use-pointer-movement.ts
@@ -6995,7 +6990,7 @@ function ModalTitle({ as, ref, ...props }) {
6995
6990
  ref
6996
6991
  });
6997
6992
  }
6998
- function ModalDialog(props) {
6993
+ function ModalDialog({ dialogPanelProps: { className: dialogPanelClassName, style: dialogPanelStyle, ...dialogPanelProps } = {}, modalScrollContainerProps: { className: modalScrollContainerClassName, ...modalScrollContainerProps } = {}, ...props }) {
6999
6994
  const [modalControls, setModalControls] = useModalControls((store) => store), isMobileDevice = useMobileDevice();
7000
6995
  const { className, closeModal, dialogPanelRef, isOpen, place, pseudoContainerRef, readyToClose } = modalControls || {};
7001
6996
  const [dialogPanelEl, setDialogPanelEl] = useState(null);
@@ -7031,17 +7026,11 @@ function ModalDialog(props) {
7031
7026
  if (!setModalControls) return;
7032
7027
  if (progressY >= DRAG_TO_CLOSE_PROGRESS && !readyToCloseRef.current) {
7033
7028
  readyToCloseRef.current = true;
7034
- setModalControls((prev) => ({
7035
- ...prev,
7036
- readyToClose: true
7037
- }));
7029
+ setModalControls({ readyToClose: true });
7038
7030
  }
7039
7031
  if (progressY < DRAG_TO_CLOSE_PROGRESS && readyToCloseRef.current) {
7040
7032
  readyToCloseRef.current = false;
7041
- setModalControls((prev) => ({
7042
- ...prev,
7043
- readyToClose: false
7044
- }));
7033
+ setModalControls({ readyToClose: false });
7045
7034
  }
7046
7035
  },
7047
7036
  trigger: draggableTrigger
@@ -7058,7 +7047,6 @@ function ModalDialog(props) {
7058
7047
  pseudoContainer.style.width = `${width}px`;
7059
7048
  pseudoContainer.style.height = `100dvh`;
7060
7049
  pseudoContainer.style.zIndex = "-1";
7061
- pseudoContainer.style.border = "2px solid blue";
7062
7050
  document.body.appendChild(pseudoContainer);
7063
7051
  animate(dialogPanel, {
7064
7052
  ...isMobileDevice ? {
@@ -7126,8 +7114,12 @@ function ModalDialog(props) {
7126
7114
  })
7127
7115
  }), /* @__PURE__ */ jsxs(DialogPanel, {
7128
7116
  ref: setDialogPanelRef,
7129
- 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),
7130
- style: isMobileDevice ? void 0 : { opacity: 0 },
7117
+ ...dialogPanelProps,
7118
+ 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),
7119
+ style: {
7120
+ ...dialogPanelStyle,
7121
+ ...isMobileDevice ? {} : { opacity: 0 }
7122
+ },
7131
7123
  children: [/* @__PURE__ */ jsx("button", {
7132
7124
  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)",
7133
7125
  ...readyToClose ? { "data-ready": "" } : {},
@@ -7138,10 +7130,11 @@ function ModalDialog(props) {
7138
7130
  children: "Drag down to close"
7139
7131
  })
7140
7132
  }), /* @__PURE__ */ jsx("div", {
7141
- className: "overflow-y-scroll",
7133
+ ...modalScrollContainerProps,
7134
+ className: twMerge("h-fit max-h-[calc(100dvh-4rem)] overflow-y-scroll px-4 sm:px-6 lg:px-8", modalScrollContainerClassName),
7142
7135
  children: /* @__PURE__ */ jsx("div", {
7143
7136
  ...props,
7144
- className: "py-4 sm:py-6 lg:py-8"
7137
+ className: twMerge("h-full py-3 sm:py-5 lg:py-7", className)
7145
7138
  })
7146
7139
  })]
7147
7140
  })]
@@ -7174,11 +7167,10 @@ function ModalDisplay({ children, className, onClose, onOpen, place = "bottom" }
7174
7167
  const closeFunctions = () => {
7175
7168
  onClose?.();
7176
7169
  modalControls?.pseudoContainerRef?.current?.remove();
7177
- setModalControls?.((previous) => ({
7178
- ...previous,
7170
+ setModalControls?.({
7179
7171
  pseudoContainerRef: { current: null },
7180
7172
  readyToClose: false
7181
- }));
7173
+ });
7182
7174
  };
7183
7175
  const mobileAnimation = {
7184
7176
  y: "100%",
@@ -7207,15 +7199,14 @@ function ModalDisplay({ children, className, onClose, onOpen, place = "bottom" }
7207
7199
  });
7208
7200
  };
7209
7201
  useEffect(() => {
7210
- setModalControls?.((previous) => ({
7211
- ...previous,
7202
+ setModalControls?.({
7212
7203
  isOpen,
7213
7204
  place,
7214
7205
  className,
7215
7206
  openModal,
7216
7207
  closeModal,
7217
7208
  dialogPanelRef: localDialogPanelRef
7218
- }));
7209
+ });
7219
7210
  }, [
7220
7211
  className,
7221
7212
  closeModal,
@@ -7282,6 +7273,10 @@ function ChevronUpChevronDown({ weight = "regular", ...props }) {
7282
7273
  }
7283
7274
  //#endregion
7284
7275
  //#region src/components/select.tsx
7276
+ const { Provider: SelectContextProvider, useStore: useSelectContext } = createFastContext({
7277
+ multiple: false,
7278
+ selectedOptionDisplayProps: {}
7279
+ });
7285
7280
  /**
7286
7281
  * ## Select Section Title
7287
7282
  *
@@ -7296,48 +7291,32 @@ function SelectSectionTitle({ className, ...props }) {
7296
7291
  /**
7297
7292
  * ## SelectOption
7298
7293
  *
7299
- * @prop children - This is what is displayed in the drop down menu
7300
- * @prop name - This is displayed in the trigger button
7301
- * @prop value - This is used for FormData
7302
- */
7303
- function SelectOption({ children, className, name, ...props }) {
7294
+ * @prop children - This is what is displayed in the drop down menu.
7295
+ * @prop name - This is displayed in the trigger button.
7296
+ * @prop value - This is used for FormData.
7297
+ * @prop selectedDisplayProps - This is used to customize the display of the selected option (takes priority over selectedOptionDisplayProps).
7298
+ */
7299
+ function SelectOption({ children, className, name, selectedDisplayProps: { children: selectedDisplayChildren, className: selectedDisplayClassName, ...selectedDisplayProps } = {}, ...props }) {
7300
+ const [selectContext] = useSelectContext((store) => store), { multiple, selectedOptionDisplayProps } = selectContext || {};
7301
+ const { children: selectedOptionDisplayChildren, className: selectedOptionDisplayClassName } = selectedOptionDisplayProps || {};
7304
7302
  return /* @__PURE__ */ jsx(ListboxOption, {
7305
7303
  className: "group/option contents",
7306
7304
  ...props,
7307
7305
  children: (bag) => bag.selectedOption ? /* @__PURE__ */ jsx("span", {
7308
- className: `mr-3 before:absolute before:-left-3 before:content-[',_']`,
7309
- children: name
7306
+ ...selectedOptionDisplayProps,
7307
+ ...selectedDisplayProps,
7308
+ className: twMerge(!selectedDisplayClassName && !selectedOptionDisplayClassName && multiple && `before:content-[',_'] group-first-of-type/option:before:content-['']`, selectedOptionDisplayClassName, selectedDisplayClassName),
7309
+ children: selectedDisplayChildren ? typeof selectedDisplayChildren === "function" ? selectedDisplayChildren(name) : selectedDisplayChildren : selectedOptionDisplayChildren ? typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren : name
7310
7310
  }) : /* @__PURE__ */ jsxs("div", {
7311
- 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),
7312
- children: [/* @__PURE__ */ jsx(Checkmark, { className: "invisible size-3.5 group-data-selected/option:visible" }), typeof children === "function" ? children(bag) : children]
7311
+ 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),
7312
+ 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]
7313
7313
  })
7314
7314
  });
7315
7315
  }
7316
- /**
7317
- * # Select
7318
- *
7319
- * A customizable select component intended to work very similar to HTML's `<select>` element.
7320
- *
7321
- * Use the `SelectOption` component to define the options.
7322
- *
7323
- * Use the `SelectSectionTitle` component to define titles.
7324
- *
7325
- * @prop label - The label for the select component.
7326
- * @prop description - The description for the select component.
7327
- * @prop placeholder - The placeholder for the select component.
7328
- * @prop required - Whether the select component is required.
7329
- * @prop invalid - Whether the select component is invalid.
7330
- * @prop multiple - Whether the select component allows multiple selections.
7331
- * @prop optionsProps - The props to be passed to each SelectOption component.
7332
- * @prop selectedOptionProps - The props to be passed to the selected option component.
7333
- * @prop fieldProps - The props to be passed to the parent field component.
7334
- * @prop labelProps - The props to be passed to the label component.
7335
- * @prop descriptionProps - The props to be passed to the description component.
7336
- * @prop anchor - The anchor point for the drop down menu.
7337
- */
7338
- 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 }) {
7316
+ 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 }) {
7339
7317
  const uniqueId = useId();
7340
- const multiple = props.multiple;
7318
+ const multiple = Boolean(props.multiple);
7319
+ const [, setSelectContext] = useSelectContext((store) => store);
7341
7320
  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);
7342
7321
  const listboxButtonRef = useRef(null);
7343
7322
  const [isInvalid, setIsInvalid] = useState(invalid);
@@ -7349,6 +7328,15 @@ function Select({ buttonProps, children, className, description, descriptionProp
7349
7328
  };
7350
7329
  const handleInvalid = () => setIsInvalid(true);
7351
7330
  const refocus = () => listboxButtonRef.current?.focus();
7331
+ const onVisible = useEffectEvent(() => {
7332
+ setSelectContext?.({
7333
+ multiple,
7334
+ selectedOptionDisplayProps
7335
+ });
7336
+ });
7337
+ useEffect(() => {
7338
+ onVisible();
7339
+ }, []);
7352
7340
  return /* @__PURE__ */ jsxs(Field, {
7353
7341
  ...fieldProps,
7354
7342
  className: (bag) => twMerge("grid gap-1", typeof fieldClassName === "function" ? fieldClassName(bag) : fieldClassName),
@@ -7405,6 +7393,382 @@ function Select({ buttonProps, children, className, description, descriptionProp
7405
7393
  ]
7406
7394
  });
7407
7395
  }
7396
+ /**
7397
+ * # Select
7398
+ *
7399
+ * A customizable select component intended to work very similar to HTML's `<select>` element.
7400
+ *
7401
+ * Use the `SelectOption` component to define the options.
7402
+ *
7403
+ * Use the `SelectSectionTitle` component to define titles.
7404
+ *
7405
+ * @prop label - The label for the select component.
7406
+ * @prop description - The description for the select component.
7407
+ * @prop placeholder - The placeholder for the select component.
7408
+ * @prop required - Whether the select component is required.
7409
+ * @prop invalid - Whether the select component is invalid.
7410
+ * @prop multiple - Whether the select component allows multiple selections.
7411
+ * @prop optionsProps - The props to be passed to each SelectOption component.
7412
+ * @prop selectedOptionProps - The props to be passed to the selected option component.
7413
+ * @prop selectedOptionDisplayProps - The props to be passed to each selected option in the selected option component.
7414
+ * @prop fieldProps - The props to be passed to the parent field component.
7415
+ * @prop labelProps - The props to be passed to the label component.
7416
+ * @prop descriptionProps - The props to be passed to the description component.
7417
+ * @prop anchor - The anchor point for the drop down menu.
7418
+ */
7419
+ function Select(props) {
7420
+ return /* @__PURE__ */ jsx(SelectContextProvider, { children: /* @__PURE__ */ jsx(SelectField, { ...props }) });
7421
+ }
7422
+ //#endregion
7423
+ //#region src/symbols/plus.tsx
7424
+ function Plus({ weight = "regular", ...props }) {
7425
+ switch (weight) {
7426
+ case "ultralight": return /* @__PURE__ */ jsx("svg", {
7427
+ viewBox: "9.76562 -65.2349 59.96 59.96",
7428
+ ...props,
7429
+ 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" })
7430
+ });
7431
+ case "thin": return /* @__PURE__ */ jsx("svg", {
7432
+ viewBox: "9.76562 -65.6758 60.83 60.84",
7433
+ ...props,
7434
+ 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" })
7435
+ });
7436
+ case "light": return /* @__PURE__ */ jsx("svg", {
7437
+ viewBox: "9.76562 -66.5366 62.53 62.57",
7438
+ ...props,
7439
+ 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" })
7440
+ });
7441
+ case "regular": return /* @__PURE__ */ jsx("svg", {
7442
+ viewBox: "9.76562 -67.1875 63.82 63.87",
7443
+ ...props,
7444
+ 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" })
7445
+ });
7446
+ case "medium": return /* @__PURE__ */ jsx("svg", {
7447
+ viewBox: "9.76562 -67.6006 64.67 64.71",
7448
+ ...props,
7449
+ 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" })
7450
+ });
7451
+ case "semibold": return /* @__PURE__ */ jsx("svg", {
7452
+ viewBox: "9.76562 -67.9173 65.32 65.36",
7453
+ ...props,
7454
+ 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" })
7455
+ });
7456
+ case "bold": return /* @__PURE__ */ jsx("svg", {
7457
+ viewBox: "9.76562 -68.335 66.19 66.21",
7458
+ ...props,
7459
+ 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" })
7460
+ });
7461
+ case "heavy": return /* @__PURE__ */ jsx("svg", {
7462
+ viewBox: "9.76562 -68.9408 67.44 67.45",
7463
+ ...props,
7464
+ 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" })
7465
+ });
7466
+ case "black": return /* @__PURE__ */ jsx("svg", {
7467
+ viewBox: "9.76562 -69.4824 68.55 68.55",
7468
+ ...props,
7469
+ 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" })
7470
+ });
7471
+ }
7472
+ }
7473
+ //#endregion
7474
+ //#region src/components/search.tsx
7475
+ const { Provider: SearchContextProvider, useStore: useSearchContext } = createFastContext({
7476
+ multiple: false,
7477
+ query: "",
7478
+ selectedOptionDisplayProps: {},
7479
+ selectedOptionList: []
7480
+ });
7481
+ /**
7482
+ * ## Search Section Title
7483
+ *
7484
+ * Displays a simple title.
7485
+ */
7486
+ function SearchSectionTitle({ className, ...props }) {
7487
+ return /* @__PURE__ */ jsx("div", {
7488
+ 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),
7489
+ ...props
7490
+ });
7491
+ }
7492
+ /**
7493
+ * ## SearchOption
7494
+ *
7495
+ * @prop children - This is what is displayed in the drop down menu
7496
+ * @prop name - This is used for filtering by default
7497
+ * @prop value - This is used as selected value and for FormData
7498
+ */
7499
+ function SearchOption({ children, className, isInDisplay, name, selectedDisplayProps: { children: selectedDisplayChildren, className: selectedDisplayClassName, ...selectedDisplayProps } = {}, value, ...props }) {
7500
+ const [searchContext] = useSearchContext((store) => store);
7501
+ const { multiple, query, selectedOptionDisplayProps } = searchContext || {};
7502
+ if (!((query || "").trim() === "" || name.toLowerCase().includes((query || "").toLowerCase()) || isInDisplay)) return /* @__PURE__ */ jsx(Fragment, {});
7503
+ const { children: selectedOptionDisplayChildren, className: selectedOptionDisplayClassName } = selectedOptionDisplayProps || {};
7504
+ return isInDisplay ? /* @__PURE__ */ jsx("span", {
7505
+ ...selectedOptionDisplayProps,
7506
+ ...selectedDisplayProps,
7507
+ className: twMerge(!selectedDisplayClassName && !selectedOptionDisplayClassName && multiple && `after:content-[',_'] last-of-type:after:content-['']`, selectedOptionDisplayClassName, selectedDisplayClassName),
7508
+ children: selectedDisplayChildren ? typeof selectedDisplayChildren === "function" ? selectedDisplayChildren(name) : selectedDisplayChildren : selectedOptionDisplayChildren ? typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren : name
7509
+ }) : /* @__PURE__ */ jsx(ComboboxOption, {
7510
+ className: "group/option contents",
7511
+ value: {
7512
+ id: value,
7513
+ name
7514
+ },
7515
+ ...props,
7516
+ children: (bag) => /* @__PURE__ */ jsxs("div", {
7517
+ 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),
7518
+ 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]
7519
+ })
7520
+ });
7521
+ }
7522
+ function checkEquality(aOptionList, bOptionList) {
7523
+ if (aOptionList.length !== bOptionList.length) return false;
7524
+ for (let i = 0; i < aOptionList.length; i += 1) {
7525
+ const aOption = aOptionList[i], bOption = bOptionList[i];
7526
+ if (aOption?.id !== bOption?.id || aOption?.name !== bOption?.name) return false;
7527
+ }
7528
+ return true;
7529
+ }
7530
+ 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 }) {
7531
+ const uniqueId = useId();
7532
+ const [searchContext, setSearchContext] = useSearchContext((store) => store), { query } = searchContext || {};
7533
+ const [isInvalid, setIsInvalid] = useState(invalid);
7534
+ const [selectedOptionSync, setSelectedOptionSync] = useState(() => {
7535
+ if (multiple) return Array.isArray(defaultValue) ? defaultValue : [];
7536
+ return typeof defaultValue === "string" ? defaultValue : null;
7537
+ });
7538
+ const comboboxInputRef = useRef(null);
7539
+ const childOptionList = useMemo(() => Children.toArray(children).filter((child) => isValidElement(child) && !!child.props && "value" in child.props && "name" in child.props), [children]);
7540
+ const staticOptionList = useMemo(() => childOptionList.map((child) => ({
7541
+ id: child.props.value,
7542
+ name: child.props.name,
7543
+ selectedDisplayProps: child.props.selectedDisplayProps
7544
+ })), [childOptionList]);
7545
+ const [addedOptionList, setAddedOptionList] = useState([]);
7546
+ const customOptionFromQuery = useMemo(() => {
7547
+ const trimmedQuery = query.trim();
7548
+ if (!allowCustom || trimmedQuery.length === 0) return null;
7549
+ return {
7550
+ id: props.customOptionParams?.formatID?.(trimmedQuery) ?? toLowerCase(trimmedQuery, [" ", "_"]),
7551
+ name: trimmedQuery
7552
+ };
7553
+ }, [
7554
+ allowCustom,
7555
+ props.customOptionParams,
7556
+ query
7557
+ ]);
7558
+ const optionLookupMap = useMemo(() => {
7559
+ const lookupMap = /* @__PURE__ */ new Map();
7560
+ for (const option of staticOptionList) lookupMap.set(option.id, option.name);
7561
+ for (const option of addedOptionList) lookupMap.set(option.id, option.name);
7562
+ return lookupMap;
7563
+ }, [addedOptionList, staticOptionList]);
7564
+ const saveCustomOption = useEffectEvent((option) => {
7565
+ if (!multiple) return;
7566
+ setAddedOptionList((prevOptionList) => {
7567
+ if (prevOptionList.some((prevOption) => prevOption.id === option.id)) return prevOptionList;
7568
+ return [...prevOptionList, option];
7569
+ });
7570
+ });
7571
+ const handleChange = (selected) => {
7572
+ setIsInvalid(false);
7573
+ if (multiple && Array.isArray(selected)) {
7574
+ const selectedValueList = selected.map((selectedValue) => {
7575
+ if (selectedValue && typeof selectedValue === "object" && "id" in selectedValue && "name" in selectedValue) {
7576
+ const option = {
7577
+ id: String(selectedValue.id),
7578
+ name: String(selectedValue.name)
7579
+ };
7580
+ saveCustomOption(option);
7581
+ return option.id;
7582
+ }
7583
+ return String(selectedValue);
7584
+ });
7585
+ setSelectedOptionSync(selectedValueList);
7586
+ onChange?.(selectedValueList);
7587
+ return;
7588
+ }
7589
+ if (!multiple) {
7590
+ const normalizedSelected = selected && typeof selected === "object" && !Array.isArray(selected) ? String(selected.id) : selected;
7591
+ setSelectedOptionSync(normalizedSelected);
7592
+ onChange?.(normalizedSelected);
7593
+ return;
7594
+ }
7595
+ setSelectedOptionSync(selected);
7596
+ };
7597
+ const formatSelectedDisplay = (name) => {
7598
+ const selectedOptionDisplayChildren = selectedOptionDisplayProps?.children;
7599
+ if (!selectedOptionDisplayChildren) return name;
7600
+ const selectedOptionDisplayValue = typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren;
7601
+ return typeof selectedOptionDisplayValue === "string" ? selectedOptionDisplayValue : name;
7602
+ };
7603
+ const handleInvalid = () => setIsInvalid(true);
7604
+ const refocus = () => comboboxInputRef.current?.focus();
7605
+ const onVisible = useEffectEvent(() => {
7606
+ setSearchContext?.({
7607
+ multiple,
7608
+ query: "",
7609
+ selectedOptionDisplayProps
7610
+ });
7611
+ });
7612
+ useEffect(() => {
7613
+ onVisible();
7614
+ }, []);
7615
+ useEffect(() => {
7616
+ const selectedOptionList = (Array.isArray(selectedOptionSync) ? selectedOptionSync : typeof selectedOptionSync === "string" ? [selectedOptionSync] : []).map((selectedId) => ({
7617
+ id: selectedId,
7618
+ name: optionLookupMap.get(selectedId) ?? selectedId
7619
+ }));
7620
+ if (!checkEquality(searchContext?.selectedOptionList ?? [], selectedOptionList)) setSearchContext?.({ selectedOptionList });
7621
+ }, [
7622
+ optionLookupMap,
7623
+ searchContext?.selectedOptionList,
7624
+ selectedOptionSync,
7625
+ setSearchContext
7626
+ ]);
7627
+ const queryChange = (e) => {
7628
+ const { currentTarget } = e, { value } = currentTarget;
7629
+ setSearchContext?.({ query: value });
7630
+ };
7631
+ const handleClose = () => {
7632
+ setSearchContext?.({ query: "" });
7633
+ };
7634
+ const updateDisplayValue = (value) => {
7635
+ if (multiple && Array.isArray(value)) {
7636
+ if (singleDisplay) return value.map((v) => formatSelectedDisplay(v.name)).join(", ");
7637
+ }
7638
+ if (!multiple && value) return formatSelectedDisplay(value.name);
7639
+ return "";
7640
+ };
7641
+ return /* @__PURE__ */ jsxs(Field, {
7642
+ ...fieldProps,
7643
+ className: (bag) => twMerge("grid gap-1", typeof fieldClassName === "function" ? fieldClassName(bag) : fieldClassName),
7644
+ children: [
7645
+ label && /* @__PURE__ */ jsx(Label, {
7646
+ ...labelProps,
7647
+ className: (bag) => twMerge("text-sm font-medium", required ? `after:text-red-700 after:content-['_*']` : "", typeof labelClassName === "function" ? labelClassName(bag) : labelClassName),
7648
+ children: label
7649
+ }),
7650
+ /* @__PURE__ */ jsxs(Combobox, {
7651
+ ...props,
7652
+ invalid: isInvalid || invalid,
7653
+ multiple,
7654
+ onChange: handleChange,
7655
+ onClose: handleClose,
7656
+ children: [/* @__PURE__ */ jsxs("div", {
7657
+ ...multiple ? { "data-multiple": "" } : {},
7658
+ className: "isolate contents data-multiple:grid",
7659
+ children: [/* @__PURE__ */ jsxs("div", {
7660
+ className: "relative",
7661
+ children: [
7662
+ /* @__PURE__ */ jsx(ComboboxInput, {
7663
+ ...inputProps,
7664
+ "aria-label": typeof label === "string" ? label : props.name,
7665
+ 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),
7666
+ displayValue: updateDisplayValue,
7667
+ name: props.name,
7668
+ onChange: queryChange,
7669
+ placeholder: placeholder || `${multiple ? "Choose Any" : "Choose One"}${allowCustom ? " or Create Your Own" : ""}`,
7670
+ ref: comboboxInputRef,
7671
+ required
7672
+ }),
7673
+ /* @__PURE__ */ jsx("input", {
7674
+ "aria-hidden": "true",
7675
+ className: "sr-only top-0 left-1/2",
7676
+ id: props.name + ":input:id" + uniqueId,
7677
+ name: props.name,
7678
+ onChange: () => {},
7679
+ onFocus: refocus,
7680
+ onInvalid: handleInvalid,
7681
+ required,
7682
+ tabIndex: -1,
7683
+ value: Array.isArray(selectedOptionSync) ? selectedOptionSync.join(", ") : selectedOptionSync ?? ""
7684
+ }),
7685
+ /* @__PURE__ */ jsx(ComboboxButton, {
7686
+ ...buttonProps,
7687
+ className: "absolute top-1/2 right-1.5 -translate-y-1/2 rounded p-0.5",
7688
+ children: /* @__PURE__ */ jsx(ChevronUpChevronDown, { className: "size-3 fill-current/50" })
7689
+ })
7690
+ ]
7691
+ }), multiple && !singleDisplay && /* @__PURE__ */ jsx("div", {
7692
+ ...shelfProps,
7693
+ 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),
7694
+ children: searchContext?.selectedOptionList?.length > 0 && [...staticOptionList, ...addedOptionList].filter((option, optionIndex, optionList) => {
7695
+ return optionList.findIndex((innerOption) => innerOption.id === option.id) === optionIndex;
7696
+ }).map((option) => {
7697
+ if (!searchContext.selectedOptionList.some(({ id }) => id === option.id)) return null;
7698
+ return /* @__PURE__ */ jsx(SearchOption, {
7699
+ name: option.name,
7700
+ value: option.id,
7701
+ selectedDisplayProps: option.selectedDisplayProps,
7702
+ isInDisplay: true,
7703
+ children: option.name
7704
+ }, option.id);
7705
+ }).filter(Boolean)
7706
+ })]
7707
+ }), /* @__PURE__ */ jsxs(ComboboxOptions, {
7708
+ ...optionsProps,
7709
+ anchor: anchor || "bottom start",
7710
+ 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),
7711
+ transition: transition ?? true,
7712
+ children: [
7713
+ allowCustom && query.length > 0 && customOptionFromQuery && !addedOptionList.some((addedOption) => addedOption.id === customOptionFromQuery.id) && /* @__PURE__ */ jsx(ComboboxOption, {
7714
+ value: customOptionFromQuery,
7715
+ className: "group/option contents",
7716
+ children: /* @__PURE__ */ jsxs("div", {
7717
+ 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",
7718
+ children: [
7719
+ /* @__PURE__ */ jsx(Plus, { className: "size-3.5" }),
7720
+ "Use ",
7721
+ /* @__PURE__ */ jsxs("b", { children: [
7722
+ "\"",
7723
+ query,
7724
+ "\""
7725
+ ] })
7726
+ ]
7727
+ })
7728
+ }),
7729
+ children,
7730
+ multiple && addedOptionList.filter((addedOption) => !staticOptionList.some((staticOption) => staticOption.id === addedOption.id)).map((addedOption) => /* @__PURE__ */ jsx(SearchOption, {
7731
+ name: addedOption.name,
7732
+ value: addedOption.id,
7733
+ selectedDisplayProps: addedOption.selectedDisplayProps,
7734
+ children: addedOption.name
7735
+ }, "added:" + addedOption.id))
7736
+ ]
7737
+ })]
7738
+ }),
7739
+ description && /* @__PURE__ */ jsx(Description, {
7740
+ ...descriptionProps,
7741
+ className: (bag) => twMerge("text-xs text-current/60", typeof descriptionClassName === "function" ? descriptionClassName(bag) : descriptionClassName),
7742
+ children: description
7743
+ })
7744
+ ]
7745
+ });
7746
+ }
7747
+ /**
7748
+ * # Search
7749
+ *
7750
+ * A searchable select component built on top of Headless UI's `Combobox`.
7751
+ *
7752
+ * Use the `SearchOption` component to define options.
7753
+ *
7754
+ * Use the `SearchSectionTitle` component to define titles.
7755
+ *
7756
+ * @prop label - The label for the select component.
7757
+ * @prop description - The description for the select component.
7758
+ * @prop placeholder - The placeholder for the select component.
7759
+ * @prop required - Whether the select component is required.
7760
+ * @prop invalid - Whether the select component is invalid.
7761
+ * @prop multiple - Whether the select component allows multiple selections.
7762
+ * @prop optionsProps - The props to be passed to each SearchOption component.
7763
+ * @prop selectedOptionDisplayProps - The props to be passed to each selected option in the selected option component.
7764
+ * @prop fieldProps - The props to be passed to the parent field component.
7765
+ * @prop labelProps - The props to be passed to the label component.
7766
+ * @prop descriptionProps - The props to be passed to the description component.
7767
+ * @prop anchor - The anchor point for the drop down menu.
7768
+ */
7769
+ function Search(props) {
7770
+ return /* @__PURE__ */ jsx(SearchContextProvider, { children: /* @__PURE__ */ jsx(SearchField, { ...props }) });
7771
+ }
7408
7772
  //#endregion
7409
7773
  //#region src/symbols/circle.fill.tsx
7410
7774
  function CircleFill({ weight = "regular", ...props }) {
@@ -9407,25 +9771,21 @@ function TooltipDisplay({ anchor = "top", arrow: arrow$4, arrowClassName, childr
9407
9771
  clearTimeout(timeoutRef.current);
9408
9772
  };
9409
9773
  }, []);
9410
- const [, setTooltipContext] = useTooltipContext(() => void 0, defaultTooltipContext);
9774
+ const [tooltipContext, setTooltipContext] = useTooltipContext(() => defaultTooltipContext);
9411
9775
  useEffect(() => {
9412
- setTooltipContext?.((previous) => {
9413
- const nextArrow = arrow$4 || false, nextArrowClassName = arrowClassName || "";
9414
- 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;
9415
- return {
9416
- ...previous,
9417
- isOpen,
9418
- openTooltip,
9419
- closeTooltip,
9420
- refs,
9421
- floatingStyles,
9422
- isPositioned,
9423
- placement,
9424
- middlewareData,
9425
- arrowRef,
9426
- arrow: nextArrow,
9427
- arrowClassName: nextArrowClassName
9428
- };
9776
+ const nextArrow = arrow$4 || false, nextArrowClassName = arrowClassName || "";
9777
+ 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?.({
9778
+ isOpen,
9779
+ openTooltip,
9780
+ closeTooltip,
9781
+ refs,
9782
+ floatingStyles,
9783
+ isPositioned,
9784
+ placement,
9785
+ middlewareData,
9786
+ arrowRef,
9787
+ arrow: nextArrow,
9788
+ arrowClassName: nextArrowClassName
9429
9789
  });
9430
9790
  }, [
9431
9791
  arrow$4,
@@ -9900,4 +10260,4 @@ function YouTubeLogo({ className, cutout = false, targets, ...props }) {
9900
10260
  });
9901
10261
  }
9902
10262
  //#endregion
9903
- 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 };
10263
+ 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 };