@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
|
@@ -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, cloneElement, createContext, isValidElement, 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
|
|
@@ -6224,46 +6224,43 @@ function Input({ children, className, description, descriptionProps: { className
|
|
|
6224
6224
|
}
|
|
6225
6225
|
//#endregion
|
|
6226
6226
|
//#region src/hooks/create-fast-context.tsx
|
|
6227
|
-
function createFastContext(
|
|
6228
|
-
function useStoreData(
|
|
6229
|
-
const store = useRef(initialState)
|
|
6230
|
-
const
|
|
6231
|
-
|
|
6232
|
-
else store.current = value;
|
|
6233
|
-
subscribers.current.forEach((callback) => callback());
|
|
6234
|
-
};
|
|
6235
|
-
const subscribe = (callback) => {
|
|
6236
|
-
subscribers.current.add(callback);
|
|
6237
|
-
return () => subscribers.current.delete(callback);
|
|
6238
|
-
};
|
|
6227
|
+
function createFastContext(initialState) {
|
|
6228
|
+
function useStoreData() {
|
|
6229
|
+
const store = useRef(initialState);
|
|
6230
|
+
const get = useCallback(() => store.current, []);
|
|
6231
|
+
const subscribers = useRef(/* @__PURE__ */ new Set());
|
|
6239
6232
|
return {
|
|
6240
6233
|
get,
|
|
6241
|
-
set
|
|
6242
|
-
|
|
6234
|
+
set: useCallback((value) => {
|
|
6235
|
+
store.current = {
|
|
6236
|
+
...store.current,
|
|
6237
|
+
...value
|
|
6238
|
+
};
|
|
6239
|
+
subscribers.current.forEach((callback) => callback());
|
|
6240
|
+
}, []),
|
|
6241
|
+
subscribe: useCallback((callback) => {
|
|
6242
|
+
subscribers.current.add(callback);
|
|
6243
|
+
return () => subscribers.current.delete(callback);
|
|
6244
|
+
}, [])
|
|
6243
6245
|
};
|
|
6244
6246
|
}
|
|
6245
6247
|
const StoreContext = createContext(null);
|
|
6246
|
-
function Provider({
|
|
6248
|
+
function Provider({ children }) {
|
|
6247
6249
|
return /* @__PURE__ */ jsx(StoreContext.Provider, {
|
|
6248
|
-
value: useStoreData(
|
|
6249
|
-
|
|
6250
|
+
value: useStoreData(),
|
|
6251
|
+
children
|
|
6250
6252
|
});
|
|
6251
6253
|
}
|
|
6252
|
-
function useStore(selector
|
|
6254
|
+
function useStore(selector) {
|
|
6253
6255
|
const store = useContext(StoreContext);
|
|
6254
|
-
if (!store)
|
|
6255
|
-
|
|
6256
|
-
const noOpSet = () => console.warn("Attempting to set store value outside of Provider");
|
|
6257
|
-
return [selectedValue, noOpSet];
|
|
6258
|
-
}
|
|
6259
|
-
return [useSyncExternalStore(store.subscribe, () => selector(store.get()), () => selector(initialValue !== void 0 ? initialValue : defaultInitialState)), store.set];
|
|
6256
|
+
if (!store) throw new Error("Store not found");
|
|
6257
|
+
return [useSyncExternalStore(store.subscribe, () => selector(store.get()), () => selector(initialState)), store.set];
|
|
6260
6258
|
}
|
|
6261
6259
|
return {
|
|
6262
6260
|
Provider,
|
|
6263
6261
|
useStore
|
|
6264
6262
|
};
|
|
6265
6263
|
}
|
|
6266
|
-
const { Provider, useStore } = createFastContext("incomplete");
|
|
6267
6264
|
//#endregion
|
|
6268
6265
|
//#region src/hooks/use-mobile-device.ts
|
|
6269
6266
|
function useMobileDevice() {
|
|
@@ -6397,17 +6394,11 @@ function ModalDialog({ dialogPanelProps: { className: dialogPanelClassName, styl
|
|
|
6397
6394
|
if (!setModalControls) return;
|
|
6398
6395
|
if (progressY >= DRAG_TO_CLOSE_PROGRESS && !readyToCloseRef.current) {
|
|
6399
6396
|
readyToCloseRef.current = true;
|
|
6400
|
-
setModalControls(
|
|
6401
|
-
...prev,
|
|
6402
|
-
readyToClose: true
|
|
6403
|
-
}));
|
|
6397
|
+
setModalControls({ readyToClose: true });
|
|
6404
6398
|
}
|
|
6405
6399
|
if (progressY < DRAG_TO_CLOSE_PROGRESS && readyToCloseRef.current) {
|
|
6406
6400
|
readyToCloseRef.current = false;
|
|
6407
|
-
setModalControls(
|
|
6408
|
-
...prev,
|
|
6409
|
-
readyToClose: false
|
|
6410
|
-
}));
|
|
6401
|
+
setModalControls({ readyToClose: false });
|
|
6411
6402
|
}
|
|
6412
6403
|
},
|
|
6413
6404
|
trigger: draggableTrigger
|
|
@@ -6532,23 +6523,18 @@ function ModalClose({ as, onClick, ...props }) {
|
|
|
6532
6523
|
}
|
|
6533
6524
|
function ModalDisplay({ children, className, onClose, onOpen, place = "bottom" }) {
|
|
6534
6525
|
const [modalControls, setModalControls] = useModalControls((store) => store), isMobileDevice = useMobileDevice();
|
|
6535
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
6536
6526
|
const localDialogPanelRef = useRef(null);
|
|
6537
6527
|
const openModal = () => {
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
onOpen?.();
|
|
6541
|
-
return true;
|
|
6542
|
-
});
|
|
6528
|
+
setModalControls({ isOpen: true });
|
|
6529
|
+
onOpen?.();
|
|
6543
6530
|
};
|
|
6544
6531
|
const closeFunctions = () => {
|
|
6545
6532
|
onClose?.();
|
|
6546
6533
|
modalControls?.pseudoContainerRef?.current?.remove();
|
|
6547
|
-
setModalControls?.(
|
|
6548
|
-
...previous,
|
|
6534
|
+
setModalControls?.({
|
|
6549
6535
|
pseudoContainerRef: { current: null },
|
|
6550
6536
|
readyToClose: false
|
|
6551
|
-
})
|
|
6537
|
+
});
|
|
6552
6538
|
};
|
|
6553
6539
|
const mobileAnimation = {
|
|
6554
6540
|
y: "100%",
|
|
@@ -6570,30 +6556,21 @@ function ModalDisplay({ children, className, onClose, onOpen, place = "bottom" }
|
|
|
6570
6556
|
});
|
|
6571
6557
|
};
|
|
6572
6558
|
const closeModal = () => {
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
handleClose();
|
|
6576
|
-
return false;
|
|
6577
|
-
});
|
|
6559
|
+
setModalControls({ isOpen: false });
|
|
6560
|
+
handleClose();
|
|
6578
6561
|
};
|
|
6579
|
-
|
|
6580
|
-
setModalControls?.(
|
|
6581
|
-
...previous,
|
|
6582
|
-
isOpen,
|
|
6562
|
+
const onVisible = () => {
|
|
6563
|
+
setModalControls?.({
|
|
6583
6564
|
place,
|
|
6584
6565
|
className,
|
|
6585
6566
|
openModal,
|
|
6586
6567
|
closeModal,
|
|
6587
6568
|
dialogPanelRef: localDialogPanelRef
|
|
6588
|
-
})
|
|
6589
|
-
}
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
openModal,
|
|
6594
|
-
place,
|
|
6595
|
-
setModalControls
|
|
6596
|
-
]);
|
|
6569
|
+
});
|
|
6570
|
+
};
|
|
6571
|
+
useEffect(() => {
|
|
6572
|
+
onVisible();
|
|
6573
|
+
}, []);
|
|
6597
6574
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
6598
6575
|
}
|
|
6599
6576
|
function Modal(props) {
|
|
@@ -6652,6 +6629,10 @@ function ChevronUpChevronDown({ weight = "regular", ...props }) {
|
|
|
6652
6629
|
}
|
|
6653
6630
|
//#endregion
|
|
6654
6631
|
//#region src/components/select.tsx
|
|
6632
|
+
const { Provider: SelectContextProvider, useStore: useSelectContext } = createFastContext({
|
|
6633
|
+
multiple: false,
|
|
6634
|
+
selectedOptionDisplayProps: {}
|
|
6635
|
+
});
|
|
6655
6636
|
/**
|
|
6656
6637
|
* ## Select Section Title
|
|
6657
6638
|
*
|
|
@@ -6666,48 +6647,32 @@ function SelectSectionTitle({ className, ...props }) {
|
|
|
6666
6647
|
/**
|
|
6667
6648
|
* ## SelectOption
|
|
6668
6649
|
*
|
|
6669
|
-
* @prop children - This is what is displayed in the drop down menu
|
|
6670
|
-
* @prop name - This is displayed in the trigger button
|
|
6671
|
-
* @prop value - This is used for FormData
|
|
6672
|
-
|
|
6673
|
-
|
|
6650
|
+
* @prop children - This is what is displayed in the drop down menu.
|
|
6651
|
+
* @prop name - This is displayed in the trigger button.
|
|
6652
|
+
* @prop value - This is used for FormData.
|
|
6653
|
+
* @prop selectedDisplayProps - This is used to customize the display of the selected option (takes priority over selectedOptionDisplayProps).
|
|
6654
|
+
*/
|
|
6655
|
+
function SelectOption({ children, className, name, selectedDisplayProps: { children: selectedDisplayChildren, className: selectedDisplayClassName, ...selectedDisplayProps } = {}, ...props }) {
|
|
6656
|
+
const [selectContext] = useSelectContext((store) => store), { multiple, selectedOptionDisplayProps } = selectContext || {};
|
|
6657
|
+
const { children: selectedOptionDisplayChildren, className: selectedOptionDisplayClassName } = selectedOptionDisplayProps || {};
|
|
6674
6658
|
return /* @__PURE__ */ jsx(ListboxOption, {
|
|
6675
6659
|
className: "group/option contents",
|
|
6676
6660
|
...props,
|
|
6677
6661
|
children: (bag) => bag.selectedOption ? /* @__PURE__ */ jsx("span", {
|
|
6678
|
-
|
|
6679
|
-
|
|
6662
|
+
...selectedOptionDisplayProps,
|
|
6663
|
+
...selectedDisplayProps,
|
|
6664
|
+
className: twMerge(!selectedDisplayClassName && !selectedOptionDisplayClassName && multiple && `before:content-[',_'] group-first-of-type/option:before:content-['']`, selectedOptionDisplayClassName, selectedDisplayClassName),
|
|
6665
|
+
children: selectedDisplayChildren ? typeof selectedDisplayChildren === "function" ? selectedDisplayChildren(name) : selectedDisplayChildren : selectedOptionDisplayChildren ? typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren : name
|
|
6680
6666
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
6681
|
-
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:
|
|
6682
|
-
children: [/* @__PURE__ */ jsx(Checkmark, { className: "
|
|
6667
|
+
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),
|
|
6668
|
+
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]
|
|
6683
6669
|
})
|
|
6684
6670
|
});
|
|
6685
6671
|
}
|
|
6686
|
-
|
|
6687
|
-
* # Select
|
|
6688
|
-
*
|
|
6689
|
-
* A customizable select component intended to work very similar to HTML's `<select>` element.
|
|
6690
|
-
*
|
|
6691
|
-
* Use the `SelectOption` component to define the options.
|
|
6692
|
-
*
|
|
6693
|
-
* Use the `SelectSectionTitle` component to define titles.
|
|
6694
|
-
*
|
|
6695
|
-
* @prop label - The label for the select component.
|
|
6696
|
-
* @prop description - The description for the select component.
|
|
6697
|
-
* @prop placeholder - The placeholder for the select component.
|
|
6698
|
-
* @prop required - Whether the select component is required.
|
|
6699
|
-
* @prop invalid - Whether the select component is invalid.
|
|
6700
|
-
* @prop multiple - Whether the select component allows multiple selections.
|
|
6701
|
-
* @prop optionsProps - The props to be passed to each SelectOption component.
|
|
6702
|
-
* @prop selectedOptionProps - The props to be passed to the selected option component.
|
|
6703
|
-
* @prop fieldProps - The props to be passed to the parent field component.
|
|
6704
|
-
* @prop labelProps - The props to be passed to the label component.
|
|
6705
|
-
* @prop descriptionProps - The props to be passed to the description component.
|
|
6706
|
-
* @prop anchor - The anchor point for the drop down menu.
|
|
6707
|
-
*/
|
|
6708
|
-
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 }) {
|
|
6672
|
+
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 }) {
|
|
6709
6673
|
const uniqueId = useId();
|
|
6710
|
-
const multiple = props.multiple;
|
|
6674
|
+
const multiple = Boolean(props.multiple);
|
|
6675
|
+
const [, setSelectContext] = useSelectContext((store) => store);
|
|
6711
6676
|
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);
|
|
6712
6677
|
const listboxButtonRef = useRef(null);
|
|
6713
6678
|
const [isInvalid, setIsInvalid] = useState(invalid);
|
|
@@ -6719,6 +6684,15 @@ function Select({ buttonProps, children, className, description, descriptionProp
|
|
|
6719
6684
|
};
|
|
6720
6685
|
const handleInvalid = () => setIsInvalid(true);
|
|
6721
6686
|
const refocus = () => listboxButtonRef.current?.focus();
|
|
6687
|
+
const onVisible = useEffectEvent(() => {
|
|
6688
|
+
setSelectContext?.({
|
|
6689
|
+
multiple,
|
|
6690
|
+
selectedOptionDisplayProps
|
|
6691
|
+
});
|
|
6692
|
+
});
|
|
6693
|
+
useEffect(() => {
|
|
6694
|
+
onVisible();
|
|
6695
|
+
}, []);
|
|
6722
6696
|
return /* @__PURE__ */ jsxs(Field, {
|
|
6723
6697
|
...fieldProps,
|
|
6724
6698
|
className: (bag) => twMerge("grid gap-1", typeof fieldClassName === "function" ? fieldClassName(bag) : fieldClassName),
|
|
@@ -6775,6 +6749,32 @@ function Select({ buttonProps, children, className, description, descriptionProp
|
|
|
6775
6749
|
]
|
|
6776
6750
|
});
|
|
6777
6751
|
}
|
|
6752
|
+
/**
|
|
6753
|
+
* # Select
|
|
6754
|
+
*
|
|
6755
|
+
* A customizable select component intended to work very similar to HTML's `<select>` element.
|
|
6756
|
+
*
|
|
6757
|
+
* Use the `SelectOption` component to define the options.
|
|
6758
|
+
*
|
|
6759
|
+
* Use the `SelectSectionTitle` component to define titles.
|
|
6760
|
+
*
|
|
6761
|
+
* @prop label - The label for the select component.
|
|
6762
|
+
* @prop description - The description for the select component.
|
|
6763
|
+
* @prop placeholder - The placeholder for the select component.
|
|
6764
|
+
* @prop required - Whether the select component is required.
|
|
6765
|
+
* @prop invalid - Whether the select component is invalid.
|
|
6766
|
+
* @prop multiple - Whether the select component allows multiple selections.
|
|
6767
|
+
* @prop optionsProps - The props to be passed to each SelectOption component.
|
|
6768
|
+
* @prop selectedOptionProps - The props to be passed to the selected option component.
|
|
6769
|
+
* @prop selectedOptionDisplayProps - The props to be passed to each selected option in the selected option component.
|
|
6770
|
+
* @prop fieldProps - The props to be passed to the parent field component.
|
|
6771
|
+
* @prop labelProps - The props to be passed to the label component.
|
|
6772
|
+
* @prop descriptionProps - The props to be passed to the description component.
|
|
6773
|
+
* @prop anchor - The anchor point for the drop down menu.
|
|
6774
|
+
*/
|
|
6775
|
+
function Select(props) {
|
|
6776
|
+
return /* @__PURE__ */ jsx(SelectContextProvider, { children: /* @__PURE__ */ jsx(SelectField, { ...props }) });
|
|
6777
|
+
}
|
|
6778
6778
|
//#endregion
|
|
6779
6779
|
//#region src/symbols/plus.tsx
|
|
6780
6780
|
function Plus({ weight = "regular", ...props }) {
|
|
@@ -6828,6 +6828,23 @@ function Plus({ weight = "regular", ...props }) {
|
|
|
6828
6828
|
}
|
|
6829
6829
|
//#endregion
|
|
6830
6830
|
//#region src/components/search.tsx
|
|
6831
|
+
const { Provider: SearchContextProvider, useStore: useSearchContext } = createFastContext({
|
|
6832
|
+
multiple: false,
|
|
6833
|
+
query: "",
|
|
6834
|
+
selectedOptionDisplayProps: {},
|
|
6835
|
+
selectedOptionList: []
|
|
6836
|
+
});
|
|
6837
|
+
/**
|
|
6838
|
+
* ## Search Section Title
|
|
6839
|
+
*
|
|
6840
|
+
* Displays a simple title.
|
|
6841
|
+
*/
|
|
6842
|
+
function SearchSectionTitle({ className, ...props }) {
|
|
6843
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6844
|
+
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),
|
|
6845
|
+
...props
|
|
6846
|
+
});
|
|
6847
|
+
}
|
|
6831
6848
|
/**
|
|
6832
6849
|
* ## SearchOption
|
|
6833
6850
|
*
|
|
@@ -6835,8 +6852,17 @@ function Plus({ weight = "regular", ...props }) {
|
|
|
6835
6852
|
* @prop name - This is used for filtering by default
|
|
6836
6853
|
* @prop value - This is used as selected value and for FormData
|
|
6837
6854
|
*/
|
|
6838
|
-
function SearchOption({ children, className, name, value, ...props }) {
|
|
6839
|
-
|
|
6855
|
+
function SearchOption({ children, className, isInDisplay, name, selectedDisplayProps: { children: selectedDisplayChildren, className: selectedDisplayClassName, ...selectedDisplayProps } = {}, value, ...props }) {
|
|
6856
|
+
const [searchContext] = useSearchContext((store) => store);
|
|
6857
|
+
const { multiple, query, selectedOptionDisplayProps } = searchContext || {};
|
|
6858
|
+
if (!((query || "").trim() === "" || name.toLowerCase().includes((query || "").toLowerCase()) || isInDisplay)) return /* @__PURE__ */ jsx(Fragment, {});
|
|
6859
|
+
const { children: selectedOptionDisplayChildren, className: selectedOptionDisplayClassName } = selectedOptionDisplayProps || {};
|
|
6860
|
+
return isInDisplay ? /* @__PURE__ */ jsx("span", {
|
|
6861
|
+
...selectedOptionDisplayProps,
|
|
6862
|
+
...selectedDisplayProps,
|
|
6863
|
+
className: twMerge(!selectedDisplayClassName && !selectedOptionDisplayClassName && multiple && `after:content-[',_'] last-of-type:after:content-['']`, selectedOptionDisplayClassName, selectedDisplayClassName),
|
|
6864
|
+
children: selectedDisplayChildren ? typeof selectedDisplayChildren === "function" ? selectedDisplayChildren(name) : selectedDisplayChildren : selectedOptionDisplayChildren ? typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren : name
|
|
6865
|
+
}) : /* @__PURE__ */ jsx(ComboboxOption, {
|
|
6840
6866
|
className: "group/option contents",
|
|
6841
6867
|
value: {
|
|
6842
6868
|
id: value,
|
|
@@ -6844,46 +6870,130 @@ function SearchOption({ children, className, name, value, ...props }) {
|
|
|
6844
6870
|
},
|
|
6845
6871
|
...props,
|
|
6846
6872
|
children: (bag) => /* @__PURE__ */ jsxs("div", {
|
|
6847
|
-
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:
|
|
6848
|
-
children: [/* @__PURE__ */ jsx(Checkmark, { className: "
|
|
6873
|
+
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),
|
|
6874
|
+
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]
|
|
6849
6875
|
})
|
|
6850
6876
|
});
|
|
6851
6877
|
}
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6878
|
+
function checkEquality(aOptionList, bOptionList) {
|
|
6879
|
+
if (aOptionList.length !== bOptionList.length) return false;
|
|
6880
|
+
for (let i = 0; i < aOptionList.length; i += 1) {
|
|
6881
|
+
const aOption = aOptionList[i], bOption = bOptionList[i];
|
|
6882
|
+
if (aOption?.id !== bOption?.id || aOption?.name !== bOption?.name) return false;
|
|
6883
|
+
}
|
|
6884
|
+
return true;
|
|
6885
|
+
}
|
|
6886
|
+
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 }) {
|
|
6860
6887
|
const uniqueId = useId();
|
|
6861
|
-
const
|
|
6862
|
-
if (!isValidElement(child)) return [];
|
|
6863
|
-
const candidate = child;
|
|
6864
|
-
if (typeof candidate.props?.name !== "string") return [];
|
|
6865
|
-
if (typeof candidate.props?.value !== "string") return [];
|
|
6866
|
-
return [{
|
|
6867
|
-
name: candidate.props.name,
|
|
6868
|
-
value: candidate.props.value,
|
|
6869
|
-
element: child
|
|
6870
|
-
}];
|
|
6871
|
-
});
|
|
6872
|
-
const [query, setQuery] = useState("");
|
|
6888
|
+
const [searchContext, setSearchContext] = useSearchContext((store) => store), { query } = searchContext || {};
|
|
6873
6889
|
const [isInvalid, setIsInvalid] = useState(invalid);
|
|
6874
6890
|
const [selectedOptionSync, setSelectedOptionSync] = useState(() => {
|
|
6875
6891
|
if (multiple) return Array.isArray(defaultValue) ? defaultValue : [];
|
|
6876
6892
|
return typeof defaultValue === "string" ? defaultValue : null;
|
|
6877
6893
|
});
|
|
6878
6894
|
const comboboxInputRef = useRef(null);
|
|
6879
|
-
const
|
|
6895
|
+
const childOptionList = useMemo(() => Children.toArray(children).filter((child) => isValidElement(child) && !!child.props && "value" in child.props && "name" in child.props), [children]);
|
|
6896
|
+
const staticOptionList = useMemo(() => childOptionList.map((child) => ({
|
|
6897
|
+
id: child.props.value,
|
|
6898
|
+
name: child.props.name,
|
|
6899
|
+
selectedDisplayProps: child.props.selectedDisplayProps
|
|
6900
|
+
})), [childOptionList]);
|
|
6901
|
+
const [addedOptionList, setAddedOptionList] = useState([]);
|
|
6902
|
+
const customOptionFromQuery = useMemo(() => {
|
|
6903
|
+
const trimmedQuery = query.trim();
|
|
6904
|
+
if (!allowCustom || trimmedQuery.length === 0) return null;
|
|
6905
|
+
return {
|
|
6906
|
+
id: props.customOptionParams?.formatID?.(trimmedQuery) ?? toLowerCase(trimmedQuery, [" ", "_"]),
|
|
6907
|
+
name: trimmedQuery
|
|
6908
|
+
};
|
|
6909
|
+
}, [
|
|
6910
|
+
allowCustom,
|
|
6911
|
+
props.customOptionParams,
|
|
6912
|
+
query
|
|
6913
|
+
]);
|
|
6914
|
+
const optionLookupMap = useMemo(() => {
|
|
6915
|
+
const lookupMap = /* @__PURE__ */ new Map();
|
|
6916
|
+
for (const option of staticOptionList) lookupMap.set(option.id, option.name);
|
|
6917
|
+
for (const option of addedOptionList) lookupMap.set(option.id, option.name);
|
|
6918
|
+
return lookupMap;
|
|
6919
|
+
}, [addedOptionList, staticOptionList]);
|
|
6920
|
+
const saveCustomOption = useEffectEvent((option) => {
|
|
6921
|
+
if (!multiple) return;
|
|
6922
|
+
setAddedOptionList((prevOptionList) => {
|
|
6923
|
+
if (prevOptionList.some((prevOption) => prevOption.id === option.id)) return prevOptionList;
|
|
6924
|
+
return [...prevOptionList, option];
|
|
6925
|
+
});
|
|
6926
|
+
});
|
|
6880
6927
|
const handleChange = (selected) => {
|
|
6881
6928
|
setIsInvalid(false);
|
|
6929
|
+
if (multiple && Array.isArray(selected)) {
|
|
6930
|
+
const selectedValueList = selected.map((selectedValue) => {
|
|
6931
|
+
if (selectedValue && typeof selectedValue === "object" && "id" in selectedValue && "name" in selectedValue) {
|
|
6932
|
+
const option = {
|
|
6933
|
+
id: String(selectedValue.id),
|
|
6934
|
+
name: String(selectedValue.name)
|
|
6935
|
+
};
|
|
6936
|
+
saveCustomOption(option);
|
|
6937
|
+
return option.id;
|
|
6938
|
+
}
|
|
6939
|
+
return String(selectedValue);
|
|
6940
|
+
});
|
|
6941
|
+
setSelectedOptionSync(selectedValueList);
|
|
6942
|
+
onChange?.(selectedValueList);
|
|
6943
|
+
return;
|
|
6944
|
+
}
|
|
6945
|
+
if (!multiple) {
|
|
6946
|
+
const normalizedSelected = selected && typeof selected === "object" && !Array.isArray(selected) ? String(selected.id) : selected;
|
|
6947
|
+
setSelectedOptionSync(normalizedSelected);
|
|
6948
|
+
onChange?.(normalizedSelected);
|
|
6949
|
+
return;
|
|
6950
|
+
}
|
|
6882
6951
|
setSelectedOptionSync(selected);
|
|
6883
|
-
|
|
6952
|
+
};
|
|
6953
|
+
const formatSelectedDisplay = (name) => {
|
|
6954
|
+
const selectedOptionDisplayChildren = selectedOptionDisplayProps?.children;
|
|
6955
|
+
if (!selectedOptionDisplayChildren) return name;
|
|
6956
|
+
const selectedOptionDisplayValue = typeof selectedOptionDisplayChildren === "function" ? selectedOptionDisplayChildren(name) : selectedOptionDisplayChildren;
|
|
6957
|
+
return typeof selectedOptionDisplayValue === "string" ? selectedOptionDisplayValue : name;
|
|
6884
6958
|
};
|
|
6885
6959
|
const handleInvalid = () => setIsInvalid(true);
|
|
6886
6960
|
const refocus = () => comboboxInputRef.current?.focus();
|
|
6961
|
+
const onVisible = useEffectEvent(() => {
|
|
6962
|
+
setSearchContext?.({
|
|
6963
|
+
multiple,
|
|
6964
|
+
query: "",
|
|
6965
|
+
selectedOptionDisplayProps
|
|
6966
|
+
});
|
|
6967
|
+
});
|
|
6968
|
+
useEffect(() => {
|
|
6969
|
+
onVisible();
|
|
6970
|
+
}, []);
|
|
6971
|
+
useEffect(() => {
|
|
6972
|
+
const selectedOptionList = (Array.isArray(selectedOptionSync) ? selectedOptionSync : typeof selectedOptionSync === "string" ? [selectedOptionSync] : []).map((selectedId) => ({
|
|
6973
|
+
id: selectedId,
|
|
6974
|
+
name: optionLookupMap.get(selectedId) ?? selectedId
|
|
6975
|
+
}));
|
|
6976
|
+
if (!checkEquality(searchContext?.selectedOptionList ?? [], selectedOptionList)) setSearchContext?.({ selectedOptionList });
|
|
6977
|
+
}, [
|
|
6978
|
+
optionLookupMap,
|
|
6979
|
+
searchContext?.selectedOptionList,
|
|
6980
|
+
selectedOptionSync,
|
|
6981
|
+
setSearchContext
|
|
6982
|
+
]);
|
|
6983
|
+
const queryChange = (e) => {
|
|
6984
|
+
const { currentTarget } = e, { value } = currentTarget;
|
|
6985
|
+
setSearchContext?.({ query: value });
|
|
6986
|
+
};
|
|
6987
|
+
const handleClose = () => {
|
|
6988
|
+
setSearchContext?.({ query: "" });
|
|
6989
|
+
};
|
|
6990
|
+
const updateDisplayValue = (value) => {
|
|
6991
|
+
if (multiple && Array.isArray(value)) {
|
|
6992
|
+
if (singleDisplay) return value.map((v) => formatSelectedDisplay(v.name)).join(", ");
|
|
6993
|
+
}
|
|
6994
|
+
if (!multiple && value) return formatSelectedDisplay(value.name);
|
|
6995
|
+
return "";
|
|
6996
|
+
};
|
|
6887
6997
|
return /* @__PURE__ */ jsxs(Field, {
|
|
6888
6998
|
...fieldProps,
|
|
6889
6999
|
className: (bag) => twMerge("grid gap-1", typeof fieldClassName === "function" ? fieldClassName(bag) : fieldClassName),
|
|
@@ -6898,64 +7008,88 @@ function Search({ allowCustom, buttonProps, children, className, defaultValue, d
|
|
|
6898
7008
|
invalid: isInvalid || invalid,
|
|
6899
7009
|
multiple,
|
|
6900
7010
|
onChange: handleChange,
|
|
6901
|
-
onClose:
|
|
6902
|
-
value: selectedOptionSync || "",
|
|
7011
|
+
onClose: handleClose,
|
|
6903
7012
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
7013
|
+
...multiple ? { "data-multiple": "" } : {},
|
|
7014
|
+
className: "isolate contents data-multiple:grid",
|
|
7015
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
7016
|
+
className: "relative",
|
|
7017
|
+
children: [
|
|
7018
|
+
/* @__PURE__ */ jsx(ComboboxInput, {
|
|
7019
|
+
...inputProps,
|
|
7020
|
+
"aria-label": typeof label === "string" ? label : props.name,
|
|
7021
|
+
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),
|
|
7022
|
+
displayValue: updateDisplayValue,
|
|
7023
|
+
name: props.name,
|
|
7024
|
+
onChange: queryChange,
|
|
7025
|
+
placeholder: placeholder || `${multiple ? "Choose Any" : "Choose One"}${allowCustom ? " or Create Your Own" : ""}`,
|
|
7026
|
+
ref: comboboxInputRef,
|
|
7027
|
+
required
|
|
7028
|
+
}),
|
|
7029
|
+
/* @__PURE__ */ jsx("input", {
|
|
7030
|
+
"aria-hidden": "true",
|
|
7031
|
+
className: "sr-only top-0 left-1/2",
|
|
7032
|
+
id: props.name + ":input:id" + uniqueId,
|
|
7033
|
+
name: props.name,
|
|
7034
|
+
onChange: () => {},
|
|
7035
|
+
onFocus: refocus,
|
|
7036
|
+
onInvalid: handleInvalid,
|
|
7037
|
+
required,
|
|
7038
|
+
tabIndex: -1,
|
|
7039
|
+
value: Array.isArray(selectedOptionSync) ? selectedOptionSync.join(", ") : selectedOptionSync ?? ""
|
|
7040
|
+
}),
|
|
7041
|
+
/* @__PURE__ */ jsx(ComboboxButton, {
|
|
7042
|
+
...buttonProps,
|
|
7043
|
+
className: "absolute top-1/2 right-1.5 -translate-y-1/2 rounded p-0.5",
|
|
7044
|
+
children: /* @__PURE__ */ jsx(ChevronUpChevronDown, { className: "size-3 fill-current/50" })
|
|
7045
|
+
})
|
|
7046
|
+
]
|
|
7047
|
+
}), multiple && !singleDisplay && /* @__PURE__ */ jsx("div", {
|
|
7048
|
+
...shelfProps,
|
|
7049
|
+
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),
|
|
7050
|
+
children: searchContext?.selectedOptionList?.length > 0 && [...staticOptionList, ...addedOptionList].filter((option, optionIndex, optionList) => {
|
|
7051
|
+
return optionList.findIndex((innerOption) => innerOption.id === option.id) === optionIndex;
|
|
7052
|
+
}).map((option) => {
|
|
7053
|
+
if (!searchContext.selectedOptionList.some(({ id }) => id === option.id)) return null;
|
|
7054
|
+
return /* @__PURE__ */ jsx(SearchOption, {
|
|
7055
|
+
name: option.name,
|
|
7056
|
+
value: option.id,
|
|
7057
|
+
selectedDisplayProps: option.selectedDisplayProps,
|
|
7058
|
+
isInDisplay: true,
|
|
7059
|
+
children: option.name
|
|
7060
|
+
}, option.id);
|
|
7061
|
+
}).filter(Boolean)
|
|
7062
|
+
})]
|
|
6935
7063
|
}), /* @__PURE__ */ jsxs(ComboboxOptions, {
|
|
6936
7064
|
...optionsProps,
|
|
6937
7065
|
anchor: anchor || "bottom start",
|
|
6938
|
-
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
|
|
7066
|
+
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),
|
|
6939
7067
|
transition: transition ?? true,
|
|
6940
|
-
children: [
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
7068
|
+
children: [
|
|
7069
|
+
allowCustom && query.length > 0 && customOptionFromQuery && !addedOptionList.some((addedOption) => addedOption.id === customOptionFromQuery.id) && /* @__PURE__ */ jsx(ComboboxOption, {
|
|
7070
|
+
value: customOptionFromQuery,
|
|
7071
|
+
className: "group/option contents",
|
|
7072
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
7073
|
+
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",
|
|
7074
|
+
children: [
|
|
7075
|
+
/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }),
|
|
7076
|
+
"Use ",
|
|
7077
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
|
7078
|
+
"\"",
|
|
7079
|
+
query,
|
|
7080
|
+
"\""
|
|
7081
|
+
] })
|
|
7082
|
+
]
|
|
7083
|
+
})
|
|
7084
|
+
}),
|
|
7085
|
+
children,
|
|
7086
|
+
multiple && addedOptionList.filter((addedOption) => !staticOptionList.some((staticOption) => staticOption.id === addedOption.id)).map((addedOption) => /* @__PURE__ */ jsx(SearchOption, {
|
|
7087
|
+
name: addedOption.name,
|
|
7088
|
+
value: addedOption.id,
|
|
7089
|
+
selectedDisplayProps: addedOption.selectedDisplayProps,
|
|
7090
|
+
children: addedOption.name
|
|
7091
|
+
}, "added:" + addedOption.id))
|
|
7092
|
+
]
|
|
6959
7093
|
})]
|
|
6960
7094
|
}),
|
|
6961
7095
|
description && /* @__PURE__ */ jsx(Description, {
|
|
@@ -6966,6 +7100,31 @@ function Search({ allowCustom, buttonProps, children, className, defaultValue, d
|
|
|
6966
7100
|
]
|
|
6967
7101
|
});
|
|
6968
7102
|
}
|
|
7103
|
+
/**
|
|
7104
|
+
* # Search
|
|
7105
|
+
*
|
|
7106
|
+
* A searchable select component built on top of Headless UI's `Combobox`.
|
|
7107
|
+
*
|
|
7108
|
+
* Use the `SearchOption` component to define options.
|
|
7109
|
+
*
|
|
7110
|
+
* Use the `SearchSectionTitle` component to define titles.
|
|
7111
|
+
*
|
|
7112
|
+
* @prop label - The label for the select component.
|
|
7113
|
+
* @prop description - The description for the select component.
|
|
7114
|
+
* @prop placeholder - The placeholder for the select component.
|
|
7115
|
+
* @prop required - Whether the select component is required.
|
|
7116
|
+
* @prop invalid - Whether the select component is invalid.
|
|
7117
|
+
* @prop multiple - Whether the select component allows multiple selections.
|
|
7118
|
+
* @prop optionsProps - The props to be passed to each SearchOption component.
|
|
7119
|
+
* @prop selectedOptionDisplayProps - The props to be passed to each selected option in the selected option component.
|
|
7120
|
+
* @prop fieldProps - The props to be passed to the parent field component.
|
|
7121
|
+
* @prop labelProps - The props to be passed to the label component.
|
|
7122
|
+
* @prop descriptionProps - The props to be passed to the description component.
|
|
7123
|
+
* @prop anchor - The anchor point for the drop down menu.
|
|
7124
|
+
*/
|
|
7125
|
+
function Search(props) {
|
|
7126
|
+
return /* @__PURE__ */ jsx(SearchContextProvider, { children: /* @__PURE__ */ jsx(SearchField, { ...props }) });
|
|
7127
|
+
}
|
|
6969
7128
|
//#endregion
|
|
6970
7129
|
//#region src/symbols/circle.fill.tsx
|
|
6971
7130
|
function CircleFill({ weight = "regular", ...props }) {
|
|
@@ -8968,25 +9127,21 @@ function TooltipDisplay({ anchor = "top", arrow: arrow$4, arrowClassName, childr
|
|
|
8968
9127
|
clearTimeout(timeoutRef.current);
|
|
8969
9128
|
};
|
|
8970
9129
|
}, []);
|
|
8971
|
-
const [, setTooltipContext] = useTooltipContext(() =>
|
|
9130
|
+
const [tooltipContext, setTooltipContext] = useTooltipContext(() => defaultTooltipContext);
|
|
8972
9131
|
useEffect(() => {
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
arrowRef,
|
|
8987
|
-
arrow: nextArrow,
|
|
8988
|
-
arrowClassName: nextArrowClassName
|
|
8989
|
-
};
|
|
9132
|
+
const nextArrow = arrow$4 || false, nextArrowClassName = arrowClassName || "";
|
|
9133
|
+
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?.({
|
|
9134
|
+
isOpen,
|
|
9135
|
+
openTooltip,
|
|
9136
|
+
closeTooltip,
|
|
9137
|
+
refs,
|
|
9138
|
+
floatingStyles,
|
|
9139
|
+
isPositioned,
|
|
9140
|
+
placement,
|
|
9141
|
+
middlewareData,
|
|
9142
|
+
arrowRef,
|
|
9143
|
+
arrow: nextArrow,
|
|
9144
|
+
arrowClassName: nextArrowClassName
|
|
8990
9145
|
});
|
|
8991
9146
|
}, [
|
|
8992
9147
|
arrow$4,
|
|
@@ -9047,4 +9202,4 @@ function ArrowSvg({ className, ...props }) {
|
|
|
9047
9202
|
});
|
|
9048
9203
|
}
|
|
9049
9204
|
//#endregion
|
|
9050
|
-
export { Anchor, Button, Checkbox, Details, DetailsBody, DetailsSummary, DropDown, DropDownButton, DropDownItem, DropDownItems, DropDownSection, DropDownSeparator, Fieldset, Form, Ghost, Heading, HumanVerification, IFrame, Input, Link, Modal, ModalClose, ModalDialog, ModalTitle, ModalTrigger, Search, SearchOption, Select, SelectOption, SelectSectionTitle, SubmitButton, Textarea, Time, Tooltip, TooltipPanel, TooltipTrigger, generateHumanValidationToken, getLinkClasses, validateHuman };
|
|
9205
|
+
export { Anchor, Button, Checkbox, Details, DetailsBody, DetailsSummary, DropDown, DropDownButton, DropDownItem, DropDownItems, DropDownSection, DropDownSeparator, Fieldset, Form, Ghost, Heading, HumanVerification, IFrame, Input, Link, Modal, ModalClose, ModalDialog, ModalTitle, ModalTrigger, Search, SearchOption, SearchSectionTitle, Select, SelectOption, SelectSectionTitle, SubmitButton, Textarea, Time, Tooltip, TooltipPanel, TooltipTrigger, generateHumanValidationToken, getLinkClasses, validateHuman };
|