@andrilla/mado-ui 1.1.0 → 1.1.2
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/README.md +23 -1
- package/dist/client/components/index.js +347 -192
- package/dist/client.js +353 -200
- package/dist/components/index.js +347 -192
- package/dist/components/search.d.ts +46 -4
- package/dist/components/select.d.ts +17 -7
- package/dist/hooks/create-fast-context.d.ts +8 -9
- package/dist/hooks/index.js +30 -35
- package/dist/hooks/use-form-status.d.ts +8 -10
- package/dist/index.js +353 -200
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { extendTailwindMerge, twJoin } from "tailwind-merge";
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
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,
|
|
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(
|
|
6736
|
-
function useStoreData(
|
|
6737
|
-
const store = useRef(initialState)
|
|
6738
|
-
const
|
|
6739
|
-
|
|
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
|
-
|
|
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({
|
|
6756
|
+
function Provider({ children }) {
|
|
6755
6757
|
return /* @__PURE__ */ jsx(StoreContext.Provider, {
|
|
6756
|
-
value: useStoreData(
|
|
6757
|
-
|
|
6758
|
+
value: useStoreData(),
|
|
6759
|
+
children
|
|
6758
6760
|
});
|
|
6759
6761
|
}
|
|
6760
|
-
function useStore(selector
|
|
6762
|
+
function useStore(selector) {
|
|
6761
6763
|
const store = useContext(StoreContext);
|
|
6762
|
-
if (!store)
|
|
6763
|
-
|
|
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
|
-
|
|
6778
|
-
|
|
6779
|
-
return
|
|
6780
|
-
|
|
6781
|
-
|
|
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
|
|
@@ -7030,17 +7025,11 @@ function ModalDialog({ dialogPanelProps: { className: dialogPanelClassName, styl
|
|
|
7030
7025
|
if (!setModalControls) return;
|
|
7031
7026
|
if (progressY >= DRAG_TO_CLOSE_PROGRESS && !readyToCloseRef.current) {
|
|
7032
7027
|
readyToCloseRef.current = true;
|
|
7033
|
-
setModalControls(
|
|
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(
|
|
7041
|
-
...prev,
|
|
7042
|
-
readyToClose: false
|
|
7043
|
-
}));
|
|
7032
|
+
setModalControls({ readyToClose: false });
|
|
7044
7033
|
}
|
|
7045
7034
|
},
|
|
7046
7035
|
trigger: draggableTrigger
|
|
@@ -7165,23 +7154,18 @@ function ModalClose({ as, onClick, ...props }) {
|
|
|
7165
7154
|
}
|
|
7166
7155
|
function ModalDisplay({ children, className, onClose, onOpen, place = "bottom" }) {
|
|
7167
7156
|
const [modalControls, setModalControls] = useModalControls((store) => store), isMobileDevice = useMobileDevice();
|
|
7168
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
7169
7157
|
const localDialogPanelRef = useRef(null);
|
|
7170
7158
|
const openModal = () => {
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
onOpen?.();
|
|
7174
|
-
return true;
|
|
7175
|
-
});
|
|
7159
|
+
setModalControls({ isOpen: true });
|
|
7160
|
+
onOpen?.();
|
|
7176
7161
|
};
|
|
7177
7162
|
const closeFunctions = () => {
|
|
7178
7163
|
onClose?.();
|
|
7179
7164
|
modalControls?.pseudoContainerRef?.current?.remove();
|
|
7180
|
-
setModalControls?.(
|
|
7181
|
-
...previous,
|
|
7165
|
+
setModalControls?.({
|
|
7182
7166
|
pseudoContainerRef: { current: null },
|
|
7183
7167
|
readyToClose: false
|
|
7184
|
-
})
|
|
7168
|
+
});
|
|
7185
7169
|
};
|
|
7186
7170
|
const mobileAnimation = {
|
|
7187
7171
|
y: "100%",
|
|
@@ -7203,30 +7187,21 @@ function ModalDisplay({ children, className, onClose, onOpen, place = "bottom" }
|
|
|
7203
7187
|
});
|
|
7204
7188
|
};
|
|
7205
7189
|
const closeModal = () => {
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
handleClose();
|
|
7209
|
-
return false;
|
|
7210
|
-
});
|
|
7190
|
+
setModalControls({ isOpen: false });
|
|
7191
|
+
handleClose();
|
|
7211
7192
|
};
|
|
7212
|
-
|
|
7213
|
-
setModalControls?.(
|
|
7214
|
-
...previous,
|
|
7215
|
-
isOpen,
|
|
7193
|
+
const onVisible = () => {
|
|
7194
|
+
setModalControls?.({
|
|
7216
7195
|
place,
|
|
7217
7196
|
className,
|
|
7218
7197
|
openModal,
|
|
7219
7198
|
closeModal,
|
|
7220
7199
|
dialogPanelRef: localDialogPanelRef
|
|
7221
|
-
})
|
|
7222
|
-
}
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
openModal,
|
|
7227
|
-
place,
|
|
7228
|
-
setModalControls
|
|
7229
|
-
]);
|
|
7200
|
+
});
|
|
7201
|
+
};
|
|
7202
|
+
useEffect(() => {
|
|
7203
|
+
onVisible();
|
|
7204
|
+
}, []);
|
|
7230
7205
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
7231
7206
|
}
|
|
7232
7207
|
function Modal(props) {
|
|
@@ -7285,6 +7260,10 @@ function ChevronUpChevronDown({ weight = "regular", ...props }) {
|
|
|
7285
7260
|
}
|
|
7286
7261
|
//#endregion
|
|
7287
7262
|
//#region src/components/select.tsx
|
|
7263
|
+
const { Provider: SelectContextProvider, useStore: useSelectContext } = createFastContext({
|
|
7264
|
+
multiple: false,
|
|
7265
|
+
selectedOptionDisplayProps: {}
|
|
7266
|
+
});
|
|
7288
7267
|
/**
|
|
7289
7268
|
* ## Select Section Title
|
|
7290
7269
|
*
|
|
@@ -7299,48 +7278,32 @@ function SelectSectionTitle({ className, ...props }) {
|
|
|
7299
7278
|
/**
|
|
7300
7279
|
* ## SelectOption
|
|
7301
7280
|
*
|
|
7302
|
-
* @prop children - This is what is displayed in the drop down menu
|
|
7303
|
-
* @prop name - This is displayed in the trigger button
|
|
7304
|
-
* @prop value - This is used for FormData
|
|
7305
|
-
|
|
7306
|
-
|
|
7281
|
+
* @prop children - This is what is displayed in the drop down menu.
|
|
7282
|
+
* @prop name - This is displayed in the trigger button.
|
|
7283
|
+
* @prop value - This is used for FormData.
|
|
7284
|
+
* @prop selectedDisplayProps - This is used to customize the display of the selected option (takes priority over selectedOptionDisplayProps).
|
|
7285
|
+
*/
|
|
7286
|
+
function SelectOption({ children, className, name, selectedDisplayProps: { children: selectedDisplayChildren, className: selectedDisplayClassName, ...selectedDisplayProps } = {}, ...props }) {
|
|
7287
|
+
const [selectContext] = useSelectContext((store) => store), { multiple, selectedOptionDisplayProps } = selectContext || {};
|
|
7288
|
+
const { children: selectedOptionDisplayChildren, className: selectedOptionDisplayClassName } = selectedOptionDisplayProps || {};
|
|
7307
7289
|
return /* @__PURE__ */ jsx(ListboxOption, {
|
|
7308
7290
|
className: "group/option contents",
|
|
7309
7291
|
...props,
|
|
7310
7292
|
children: (bag) => bag.selectedOption ? /* @__PURE__ */ jsx("span", {
|
|
7311
|
-
|
|
7312
|
-
|
|
7293
|
+
...selectedOptionDisplayProps,
|
|
7294
|
+
...selectedDisplayProps,
|
|
7295
|
+
className: twMerge(!selectedDisplayClassName && !selectedOptionDisplayClassName && multiple && `before:content-[',_'] group-first-of-type/option:before:content-['']`, selectedOptionDisplayClassName, selectedDisplayClassName),
|
|
7296
|
+
children: selectedDisplayChildren ? typeof selectedDisplayChildren === "function" ? selectedDisplayChildren(name) : selectedDisplayChildren : selectedOptionDisplayChildren ? typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren : name
|
|
7313
7297
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
7314
|
-
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:
|
|
7315
|
-
children: [/* @__PURE__ */ jsx(Checkmark, { className: "
|
|
7298
|
+
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),
|
|
7299
|
+
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]
|
|
7316
7300
|
})
|
|
7317
7301
|
});
|
|
7318
7302
|
}
|
|
7319
|
-
|
|
7320
|
-
* # Select
|
|
7321
|
-
*
|
|
7322
|
-
* A customizable select component intended to work very similar to HTML's `<select>` element.
|
|
7323
|
-
*
|
|
7324
|
-
* Use the `SelectOption` component to define the options.
|
|
7325
|
-
*
|
|
7326
|
-
* Use the `SelectSectionTitle` component to define titles.
|
|
7327
|
-
*
|
|
7328
|
-
* @prop label - The label for the select component.
|
|
7329
|
-
* @prop description - The description for the select component.
|
|
7330
|
-
* @prop placeholder - The placeholder for the select component.
|
|
7331
|
-
* @prop required - Whether the select component is required.
|
|
7332
|
-
* @prop invalid - Whether the select component is invalid.
|
|
7333
|
-
* @prop multiple - Whether the select component allows multiple selections.
|
|
7334
|
-
* @prop optionsProps - The props to be passed to each SelectOption component.
|
|
7335
|
-
* @prop selectedOptionProps - The props to be passed to the selected option component.
|
|
7336
|
-
* @prop fieldProps - The props to be passed to the parent field component.
|
|
7337
|
-
* @prop labelProps - The props to be passed to the label component.
|
|
7338
|
-
* @prop descriptionProps - The props to be passed to the description component.
|
|
7339
|
-
* @prop anchor - The anchor point for the drop down menu.
|
|
7340
|
-
*/
|
|
7341
|
-
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 }) {
|
|
7303
|
+
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 }) {
|
|
7342
7304
|
const uniqueId = useId();
|
|
7343
|
-
const multiple = props.multiple;
|
|
7305
|
+
const multiple = Boolean(props.multiple);
|
|
7306
|
+
const [, setSelectContext] = useSelectContext((store) => store);
|
|
7344
7307
|
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);
|
|
7345
7308
|
const listboxButtonRef = useRef(null);
|
|
7346
7309
|
const [isInvalid, setIsInvalid] = useState(invalid);
|
|
@@ -7352,6 +7315,15 @@ function Select({ buttonProps, children, className, description, descriptionProp
|
|
|
7352
7315
|
};
|
|
7353
7316
|
const handleInvalid = () => setIsInvalid(true);
|
|
7354
7317
|
const refocus = () => listboxButtonRef.current?.focus();
|
|
7318
|
+
const onVisible = useEffectEvent(() => {
|
|
7319
|
+
setSelectContext?.({
|
|
7320
|
+
multiple,
|
|
7321
|
+
selectedOptionDisplayProps
|
|
7322
|
+
});
|
|
7323
|
+
});
|
|
7324
|
+
useEffect(() => {
|
|
7325
|
+
onVisible();
|
|
7326
|
+
}, []);
|
|
7355
7327
|
return /* @__PURE__ */ jsxs(Field, {
|
|
7356
7328
|
...fieldProps,
|
|
7357
7329
|
className: (bag) => twMerge("grid gap-1", typeof fieldClassName === "function" ? fieldClassName(bag) : fieldClassName),
|
|
@@ -7408,6 +7380,32 @@ function Select({ buttonProps, children, className, description, descriptionProp
|
|
|
7408
7380
|
]
|
|
7409
7381
|
});
|
|
7410
7382
|
}
|
|
7383
|
+
/**
|
|
7384
|
+
* # Select
|
|
7385
|
+
*
|
|
7386
|
+
* A customizable select component intended to work very similar to HTML's `<select>` element.
|
|
7387
|
+
*
|
|
7388
|
+
* Use the `SelectOption` component to define the options.
|
|
7389
|
+
*
|
|
7390
|
+
* Use the `SelectSectionTitle` component to define titles.
|
|
7391
|
+
*
|
|
7392
|
+
* @prop label - The label for the select component.
|
|
7393
|
+
* @prop description - The description for the select component.
|
|
7394
|
+
* @prop placeholder - The placeholder for the select component.
|
|
7395
|
+
* @prop required - Whether the select component is required.
|
|
7396
|
+
* @prop invalid - Whether the select component is invalid.
|
|
7397
|
+
* @prop multiple - Whether the select component allows multiple selections.
|
|
7398
|
+
* @prop optionsProps - The props to be passed to each SelectOption component.
|
|
7399
|
+
* @prop selectedOptionProps - The props to be passed to the selected option component.
|
|
7400
|
+
* @prop selectedOptionDisplayProps - The props to be passed to each selected option in the selected option component.
|
|
7401
|
+
* @prop fieldProps - The props to be passed to the parent field component.
|
|
7402
|
+
* @prop labelProps - The props to be passed to the label component.
|
|
7403
|
+
* @prop descriptionProps - The props to be passed to the description component.
|
|
7404
|
+
* @prop anchor - The anchor point for the drop down menu.
|
|
7405
|
+
*/
|
|
7406
|
+
function Select(props) {
|
|
7407
|
+
return /* @__PURE__ */ jsx(SelectContextProvider, { children: /* @__PURE__ */ jsx(SelectField, { ...props }) });
|
|
7408
|
+
}
|
|
7411
7409
|
//#endregion
|
|
7412
7410
|
//#region src/symbols/plus.tsx
|
|
7413
7411
|
function Plus({ weight = "regular", ...props }) {
|
|
@@ -7461,6 +7459,23 @@ function Plus({ weight = "regular", ...props }) {
|
|
|
7461
7459
|
}
|
|
7462
7460
|
//#endregion
|
|
7463
7461
|
//#region src/components/search.tsx
|
|
7462
|
+
const { Provider: SearchContextProvider, useStore: useSearchContext } = createFastContext({
|
|
7463
|
+
multiple: false,
|
|
7464
|
+
query: "",
|
|
7465
|
+
selectedOptionDisplayProps: {},
|
|
7466
|
+
selectedOptionList: []
|
|
7467
|
+
});
|
|
7468
|
+
/**
|
|
7469
|
+
* ## Search Section Title
|
|
7470
|
+
*
|
|
7471
|
+
* Displays a simple title.
|
|
7472
|
+
*/
|
|
7473
|
+
function SearchSectionTitle({ className, ...props }) {
|
|
7474
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7475
|
+
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 ps-2 font-bold text-neutral-500/50 backdrop-blur-[2px] backdrop-brightness-101", className),
|
|
7476
|
+
...props
|
|
7477
|
+
});
|
|
7478
|
+
}
|
|
7464
7479
|
/**
|
|
7465
7480
|
* ## SearchOption
|
|
7466
7481
|
*
|
|
@@ -7468,8 +7483,17 @@ function Plus({ weight = "regular", ...props }) {
|
|
|
7468
7483
|
* @prop name - This is used for filtering by default
|
|
7469
7484
|
* @prop value - This is used as selected value and for FormData
|
|
7470
7485
|
*/
|
|
7471
|
-
function SearchOption({ children, className, name, value, ...props }) {
|
|
7472
|
-
|
|
7486
|
+
function SearchOption({ children, className, isInDisplay, name, selectedDisplayProps: { children: selectedDisplayChildren, className: selectedDisplayClassName, ...selectedDisplayProps } = {}, value, ...props }) {
|
|
7487
|
+
const [searchContext] = useSearchContext((store) => store);
|
|
7488
|
+
const { multiple, query, selectedOptionDisplayProps } = searchContext || {};
|
|
7489
|
+
if (!((query || "").trim() === "" || name.toLowerCase().includes((query || "").toLowerCase()) || isInDisplay)) return /* @__PURE__ */ jsx(Fragment, {});
|
|
7490
|
+
const { children: selectedOptionDisplayChildren, className: selectedOptionDisplayClassName } = selectedOptionDisplayProps || {};
|
|
7491
|
+
return isInDisplay ? /* @__PURE__ */ jsx("span", {
|
|
7492
|
+
...selectedOptionDisplayProps,
|
|
7493
|
+
...selectedDisplayProps,
|
|
7494
|
+
className: twMerge(!selectedDisplayClassName && !selectedOptionDisplayClassName && multiple && `after:content-[',_'] last-of-type:after:content-['']`, selectedOptionDisplayClassName, selectedDisplayClassName),
|
|
7495
|
+
children: selectedDisplayChildren ? typeof selectedDisplayChildren === "function" ? selectedDisplayChildren(name) : selectedDisplayChildren : selectedOptionDisplayChildren ? typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren : name
|
|
7496
|
+
}) : /* @__PURE__ */ jsx(ComboboxOption, {
|
|
7473
7497
|
className: "group/option contents",
|
|
7474
7498
|
value: {
|
|
7475
7499
|
id: value,
|
|
@@ -7477,46 +7501,130 @@ function SearchOption({ children, className, name, value, ...props }) {
|
|
|
7477
7501
|
},
|
|
7478
7502
|
...props,
|
|
7479
7503
|
children: (bag) => /* @__PURE__ */ jsxs("div", {
|
|
7480
|
-
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:
|
|
7481
|
-
children: [/* @__PURE__ */ jsx(Checkmark, { className: "
|
|
7504
|
+
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),
|
|
7505
|
+
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]
|
|
7482
7506
|
})
|
|
7483
7507
|
});
|
|
7484
7508
|
}
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7509
|
+
function checkEquality(aOptionList, bOptionList) {
|
|
7510
|
+
if (aOptionList.length !== bOptionList.length) return false;
|
|
7511
|
+
for (let i = 0; i < aOptionList.length; i += 1) {
|
|
7512
|
+
const aOption = aOptionList[i], bOption = bOptionList[i];
|
|
7513
|
+
if (aOption?.id !== bOption?.id || aOption?.name !== bOption?.name) return false;
|
|
7514
|
+
}
|
|
7515
|
+
return true;
|
|
7516
|
+
}
|
|
7517
|
+
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 }) {
|
|
7493
7518
|
const uniqueId = useId();
|
|
7494
|
-
const
|
|
7495
|
-
if (!isValidElement(child)) return [];
|
|
7496
|
-
const candidate = child;
|
|
7497
|
-
if (typeof candidate.props?.name !== "string") return [];
|
|
7498
|
-
if (typeof candidate.props?.value !== "string") return [];
|
|
7499
|
-
return [{
|
|
7500
|
-
name: candidate.props.name,
|
|
7501
|
-
value: candidate.props.value,
|
|
7502
|
-
element: child
|
|
7503
|
-
}];
|
|
7504
|
-
});
|
|
7505
|
-
const [query, setQuery] = useState("");
|
|
7519
|
+
const [searchContext, setSearchContext] = useSearchContext((store) => store), { query } = searchContext || {};
|
|
7506
7520
|
const [isInvalid, setIsInvalid] = useState(invalid);
|
|
7507
7521
|
const [selectedOptionSync, setSelectedOptionSync] = useState(() => {
|
|
7508
7522
|
if (multiple) return Array.isArray(defaultValue) ? defaultValue : [];
|
|
7509
7523
|
return typeof defaultValue === "string" ? defaultValue : null;
|
|
7510
7524
|
});
|
|
7511
7525
|
const comboboxInputRef = useRef(null);
|
|
7512
|
-
const
|
|
7526
|
+
const childOptionList = useMemo(() => Children.toArray(children).filter((child) => isValidElement(child) && !!child.props && "value" in child.props && "name" in child.props), [children]);
|
|
7527
|
+
const staticOptionList = useMemo(() => childOptionList.map((child) => ({
|
|
7528
|
+
id: child.props.value,
|
|
7529
|
+
name: child.props.name,
|
|
7530
|
+
selectedDisplayProps: child.props.selectedDisplayProps
|
|
7531
|
+
})), [childOptionList]);
|
|
7532
|
+
const [addedOptionList, setAddedOptionList] = useState([]);
|
|
7533
|
+
const customOptionFromQuery = useMemo(() => {
|
|
7534
|
+
const trimmedQuery = query.trim();
|
|
7535
|
+
if (!allowCustom || trimmedQuery.length === 0) return null;
|
|
7536
|
+
return {
|
|
7537
|
+
id: props.customOptionParams?.formatID?.(trimmedQuery) ?? toLowerCase(trimmedQuery, [" ", "_"]),
|
|
7538
|
+
name: trimmedQuery
|
|
7539
|
+
};
|
|
7540
|
+
}, [
|
|
7541
|
+
allowCustom,
|
|
7542
|
+
props.customOptionParams,
|
|
7543
|
+
query
|
|
7544
|
+
]);
|
|
7545
|
+
const optionLookupMap = useMemo(() => {
|
|
7546
|
+
const lookupMap = /* @__PURE__ */ new Map();
|
|
7547
|
+
for (const option of staticOptionList) lookupMap.set(option.id, option.name);
|
|
7548
|
+
for (const option of addedOptionList) lookupMap.set(option.id, option.name);
|
|
7549
|
+
return lookupMap;
|
|
7550
|
+
}, [addedOptionList, staticOptionList]);
|
|
7551
|
+
const saveCustomOption = useEffectEvent((option) => {
|
|
7552
|
+
if (!multiple) return;
|
|
7553
|
+
setAddedOptionList((prevOptionList) => {
|
|
7554
|
+
if (prevOptionList.some((prevOption) => prevOption.id === option.id)) return prevOptionList;
|
|
7555
|
+
return [...prevOptionList, option];
|
|
7556
|
+
});
|
|
7557
|
+
});
|
|
7513
7558
|
const handleChange = (selected) => {
|
|
7514
7559
|
setIsInvalid(false);
|
|
7560
|
+
if (multiple && Array.isArray(selected)) {
|
|
7561
|
+
const selectedValueList = selected.map((selectedValue) => {
|
|
7562
|
+
if (selectedValue && typeof selectedValue === "object" && "id" in selectedValue && "name" in selectedValue) {
|
|
7563
|
+
const option = {
|
|
7564
|
+
id: String(selectedValue.id),
|
|
7565
|
+
name: String(selectedValue.name)
|
|
7566
|
+
};
|
|
7567
|
+
saveCustomOption(option);
|
|
7568
|
+
return option.id;
|
|
7569
|
+
}
|
|
7570
|
+
return String(selectedValue);
|
|
7571
|
+
});
|
|
7572
|
+
setSelectedOptionSync(selectedValueList);
|
|
7573
|
+
onChange?.(selectedValueList);
|
|
7574
|
+
return;
|
|
7575
|
+
}
|
|
7576
|
+
if (!multiple) {
|
|
7577
|
+
const normalizedSelected = selected && typeof selected === "object" && !Array.isArray(selected) ? String(selected.id) : selected;
|
|
7578
|
+
setSelectedOptionSync(normalizedSelected);
|
|
7579
|
+
onChange?.(normalizedSelected);
|
|
7580
|
+
return;
|
|
7581
|
+
}
|
|
7515
7582
|
setSelectedOptionSync(selected);
|
|
7516
|
-
|
|
7583
|
+
};
|
|
7584
|
+
const formatSelectedDisplay = (name) => {
|
|
7585
|
+
const selectedOptionDisplayChildren = selectedOptionDisplayProps?.children;
|
|
7586
|
+
if (!selectedOptionDisplayChildren) return name;
|
|
7587
|
+
const selectedOptionDisplayValue = typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren;
|
|
7588
|
+
return typeof selectedOptionDisplayValue === "string" ? selectedOptionDisplayValue : name;
|
|
7517
7589
|
};
|
|
7518
7590
|
const handleInvalid = () => setIsInvalid(true);
|
|
7519
7591
|
const refocus = () => comboboxInputRef.current?.focus();
|
|
7592
|
+
const onVisible = useEffectEvent(() => {
|
|
7593
|
+
setSearchContext?.({
|
|
7594
|
+
multiple,
|
|
7595
|
+
query: "",
|
|
7596
|
+
selectedOptionDisplayProps
|
|
7597
|
+
});
|
|
7598
|
+
});
|
|
7599
|
+
useEffect(() => {
|
|
7600
|
+
onVisible();
|
|
7601
|
+
}, []);
|
|
7602
|
+
useEffect(() => {
|
|
7603
|
+
const selectedOptionList = (Array.isArray(selectedOptionSync) ? selectedOptionSync : typeof selectedOptionSync === "string" ? [selectedOptionSync] : []).map((selectedId) => ({
|
|
7604
|
+
id: selectedId,
|
|
7605
|
+
name: optionLookupMap.get(selectedId) ?? selectedId
|
|
7606
|
+
}));
|
|
7607
|
+
if (!checkEquality(searchContext?.selectedOptionList ?? [], selectedOptionList)) setSearchContext?.({ selectedOptionList });
|
|
7608
|
+
}, [
|
|
7609
|
+
optionLookupMap,
|
|
7610
|
+
searchContext?.selectedOptionList,
|
|
7611
|
+
selectedOptionSync,
|
|
7612
|
+
setSearchContext
|
|
7613
|
+
]);
|
|
7614
|
+
const queryChange = (e) => {
|
|
7615
|
+
const { currentTarget } = e, { value } = currentTarget;
|
|
7616
|
+
setSearchContext?.({ query: value });
|
|
7617
|
+
};
|
|
7618
|
+
const handleClose = () => {
|
|
7619
|
+
setSearchContext?.({ query: "" });
|
|
7620
|
+
};
|
|
7621
|
+
const updateDisplayValue = (value) => {
|
|
7622
|
+
if (multiple && Array.isArray(value)) {
|
|
7623
|
+
if (singleDisplay) return value.map((v) => formatSelectedDisplay(v.name)).join(", ");
|
|
7624
|
+
}
|
|
7625
|
+
if (!multiple && value) return formatSelectedDisplay(value.name);
|
|
7626
|
+
return "";
|
|
7627
|
+
};
|
|
7520
7628
|
return /* @__PURE__ */ jsxs(Field, {
|
|
7521
7629
|
...fieldProps,
|
|
7522
7630
|
className: (bag) => twMerge("grid gap-1", typeof fieldClassName === "function" ? fieldClassName(bag) : fieldClassName),
|
|
@@ -7531,64 +7639,88 @@ function Search({ allowCustom, buttonProps, children, className, defaultValue, d
|
|
|
7531
7639
|
invalid: isInvalid || invalid,
|
|
7532
7640
|
multiple,
|
|
7533
7641
|
onChange: handleChange,
|
|
7534
|
-
onClose:
|
|
7535
|
-
value: selectedOptionSync || "",
|
|
7642
|
+
onClose: handleClose,
|
|
7536
7643
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7644
|
+
...multiple ? { "data-multiple": "" } : {},
|
|
7645
|
+
className: "isolate contents data-multiple:grid",
|
|
7646
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
7647
|
+
className: "relative",
|
|
7648
|
+
children: [
|
|
7649
|
+
/* @__PURE__ */ jsx(ComboboxInput, {
|
|
7650
|
+
...inputProps,
|
|
7651
|
+
"aria-label": typeof label === "string" ? label : props.name,
|
|
7652
|
+
className: (bag) => twMerge("inline-block w-full overflow-clip rounded-xl border border-neutral-500/50 bg-neutral-100 py-1 ps-2 pe-8 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),
|
|
7653
|
+
displayValue: updateDisplayValue,
|
|
7654
|
+
name: props.name,
|
|
7655
|
+
onChange: queryChange,
|
|
7656
|
+
placeholder: placeholder || `${multiple ? "Choose Any" : "Choose One"}${allowCustom ? " or Create Your Own" : ""}`,
|
|
7657
|
+
ref: comboboxInputRef,
|
|
7658
|
+
required
|
|
7659
|
+
}),
|
|
7660
|
+
/* @__PURE__ */ jsx("input", {
|
|
7661
|
+
"aria-hidden": "true",
|
|
7662
|
+
className: "sr-only top-0 left-1/2",
|
|
7663
|
+
id: props.name + ":input:id" + uniqueId,
|
|
7664
|
+
name: props.name,
|
|
7665
|
+
onChange: () => {},
|
|
7666
|
+
onFocus: refocus,
|
|
7667
|
+
onInvalid: handleInvalid,
|
|
7668
|
+
required,
|
|
7669
|
+
tabIndex: -1,
|
|
7670
|
+
value: Array.isArray(selectedOptionSync) ? selectedOptionSync.join(", ") : selectedOptionSync ?? ""
|
|
7671
|
+
}),
|
|
7672
|
+
/* @__PURE__ */ jsx(ComboboxButton, {
|
|
7673
|
+
...buttonProps,
|
|
7674
|
+
className: "absolute top-1/2 right-1.5 -translate-y-1/2 rounded p-0.5",
|
|
7675
|
+
children: /* @__PURE__ */ jsx(ChevronUpChevronDown, { className: "size-3 fill-current/50" })
|
|
7676
|
+
})
|
|
7677
|
+
]
|
|
7678
|
+
}), multiple && !singleDisplay && /* @__PURE__ */ jsx("div", {
|
|
7679
|
+
...shelfProps,
|
|
7680
|
+
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),
|
|
7681
|
+
children: searchContext?.selectedOptionList?.length > 0 && [...staticOptionList, ...addedOptionList].filter((option, optionIndex, optionList) => {
|
|
7682
|
+
return optionList.findIndex((innerOption) => innerOption.id === option.id) === optionIndex;
|
|
7683
|
+
}).map((option) => {
|
|
7684
|
+
if (!searchContext.selectedOptionList.some(({ id }) => id === option.id)) return null;
|
|
7685
|
+
return /* @__PURE__ */ jsx(SearchOption, {
|
|
7686
|
+
name: option.name,
|
|
7687
|
+
value: option.id,
|
|
7688
|
+
selectedDisplayProps: option.selectedDisplayProps,
|
|
7689
|
+
isInDisplay: true,
|
|
7690
|
+
children: option.name
|
|
7691
|
+
}, option.id);
|
|
7692
|
+
}).filter(Boolean)
|
|
7693
|
+
})]
|
|
7568
7694
|
}), /* @__PURE__ */ jsxs(ComboboxOptions, {
|
|
7569
7695
|
...optionsProps,
|
|
7570
7696
|
anchor: anchor || "bottom start",
|
|
7571
|
-
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
|
|
7697
|
+
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),
|
|
7572
7698
|
transition: transition ?? true,
|
|
7573
|
-
children: [
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7699
|
+
children: [
|
|
7700
|
+
allowCustom && query.length > 0 && customOptionFromQuery && !addedOptionList.some((addedOption) => addedOption.id === customOptionFromQuery.id) && /* @__PURE__ */ jsx(ComboboxOption, {
|
|
7701
|
+
value: customOptionFromQuery,
|
|
7702
|
+
className: "group/option contents",
|
|
7703
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
7704
|
+
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",
|
|
7705
|
+
children: [
|
|
7706
|
+
/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }),
|
|
7707
|
+
"Use ",
|
|
7708
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
|
7709
|
+
"\"",
|
|
7710
|
+
query,
|
|
7711
|
+
"\""
|
|
7712
|
+
] })
|
|
7713
|
+
]
|
|
7714
|
+
})
|
|
7715
|
+
}),
|
|
7716
|
+
children,
|
|
7717
|
+
multiple && addedOptionList.filter((addedOption) => !staticOptionList.some((staticOption) => staticOption.id === addedOption.id)).map((addedOption) => /* @__PURE__ */ jsx(SearchOption, {
|
|
7718
|
+
name: addedOption.name,
|
|
7719
|
+
value: addedOption.id,
|
|
7720
|
+
selectedDisplayProps: addedOption.selectedDisplayProps,
|
|
7721
|
+
children: addedOption.name
|
|
7722
|
+
}, "added:" + addedOption.id))
|
|
7723
|
+
]
|
|
7592
7724
|
})]
|
|
7593
7725
|
}),
|
|
7594
7726
|
description && /* @__PURE__ */ jsx(Description, {
|
|
@@ -7599,6 +7731,31 @@ function Search({ allowCustom, buttonProps, children, className, defaultValue, d
|
|
|
7599
7731
|
]
|
|
7600
7732
|
});
|
|
7601
7733
|
}
|
|
7734
|
+
/**
|
|
7735
|
+
* # Search
|
|
7736
|
+
*
|
|
7737
|
+
* A searchable select component built on top of Headless UI's `Combobox`.
|
|
7738
|
+
*
|
|
7739
|
+
* Use the `SearchOption` component to define options.
|
|
7740
|
+
*
|
|
7741
|
+
* Use the `SearchSectionTitle` component to define titles.
|
|
7742
|
+
*
|
|
7743
|
+
* @prop label - The label for the select component.
|
|
7744
|
+
* @prop description - The description for the select component.
|
|
7745
|
+
* @prop placeholder - The placeholder for the select component.
|
|
7746
|
+
* @prop required - Whether the select component is required.
|
|
7747
|
+
* @prop invalid - Whether the select component is invalid.
|
|
7748
|
+
* @prop multiple - Whether the select component allows multiple selections.
|
|
7749
|
+
* @prop optionsProps - The props to be passed to each SearchOption component.
|
|
7750
|
+
* @prop selectedOptionDisplayProps - The props to be passed to each selected option in the selected option component.
|
|
7751
|
+
* @prop fieldProps - The props to be passed to the parent field component.
|
|
7752
|
+
* @prop labelProps - The props to be passed to the label component.
|
|
7753
|
+
* @prop descriptionProps - The props to be passed to the description component.
|
|
7754
|
+
* @prop anchor - The anchor point for the drop down menu.
|
|
7755
|
+
*/
|
|
7756
|
+
function Search(props) {
|
|
7757
|
+
return /* @__PURE__ */ jsx(SearchContextProvider, { children: /* @__PURE__ */ jsx(SearchField, { ...props }) });
|
|
7758
|
+
}
|
|
7602
7759
|
//#endregion
|
|
7603
7760
|
//#region src/symbols/circle.fill.tsx
|
|
7604
7761
|
function CircleFill({ weight = "regular", ...props }) {
|
|
@@ -9601,25 +9758,21 @@ function TooltipDisplay({ anchor = "top", arrow: arrow$4, arrowClassName, childr
|
|
|
9601
9758
|
clearTimeout(timeoutRef.current);
|
|
9602
9759
|
};
|
|
9603
9760
|
}, []);
|
|
9604
|
-
const [, setTooltipContext] = useTooltipContext(() =>
|
|
9761
|
+
const [tooltipContext, setTooltipContext] = useTooltipContext(() => defaultTooltipContext);
|
|
9605
9762
|
useEffect(() => {
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
arrowRef,
|
|
9620
|
-
arrow: nextArrow,
|
|
9621
|
-
arrowClassName: nextArrowClassName
|
|
9622
|
-
};
|
|
9763
|
+
const nextArrow = arrow$4 || false, nextArrowClassName = arrowClassName || "";
|
|
9764
|
+
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?.({
|
|
9765
|
+
isOpen,
|
|
9766
|
+
openTooltip,
|
|
9767
|
+
closeTooltip,
|
|
9768
|
+
refs,
|
|
9769
|
+
floatingStyles,
|
|
9770
|
+
isPositioned,
|
|
9771
|
+
placement,
|
|
9772
|
+
middlewareData,
|
|
9773
|
+
arrowRef,
|
|
9774
|
+
arrow: nextArrow,
|
|
9775
|
+
arrowClassName: nextArrowClassName
|
|
9623
9776
|
});
|
|
9624
9777
|
}, [
|
|
9625
9778
|
arrow$4,
|
|
@@ -10094,4 +10247,4 @@ function YouTubeLogo({ className, cutout = false, targets, ...props }) {
|
|
|
10094
10247
|
});
|
|
10095
10248
|
}
|
|
10096
10249
|
//#endregion
|
|
10097
|
-
export { Anchor, Button, Checkbox, Details, DetailsBody, DetailsSummary, DropDown, DropDownButton, DropDownItem, DropDownItems, DropDownSection, DropDownSeparator, FacebookLogo, Fieldset, Form,
|
|
10250
|
+
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 };
|