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