@bioturing/components 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/choice-list/component.js.map +1 -1
- package/dist/components/combobox/component.js +163 -159
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/dropdown-menu/component.js +26 -24
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/item.js +67 -58
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.js +58 -55
- package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -1
- package/dist/components/input/component.js +24 -23
- package/dist/components/input/component.js.map +1 -1
- package/dist/components/scroll-area/component.js +83 -64
- package/dist/components/scroll-area/component.js.map +1 -1
- package/dist/components/select/component.js.map +1 -1
- package/dist/index.d.ts +60 -19
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropdownMenu.js","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\nimport { DropdownMenuItemType, DropdownMenuGroup } from \"./types\";\nimport { DropdownMenuItem } from \"./item\";\nimport { DropdownMenuDivider } from \"./divider\";\nimport { reactNodeToString, clsx, useCls } from \"../utils\";\nimport { Menu } from \"@base-ui-components/react\";\nimport { Command } from \"../cmdk\";\n\nexport interface UseDropdownMenuProps {\n /**\n * Callback function to handle the open state change of the dropdown menu.\n */\n onOpenChange?: (open: boolean) => void;\n items: DropdownMenuItemType[];\n inCombobox?: boolean;\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemSuffix?: string;\n group?: string;\n groupLabel?: string;\n divider?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement
|
|
1
|
+
{"version":3,"file":"useDropdownMenu.js","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\nimport { DropdownMenuItemType, DropdownMenuGroup } from \"./types\";\nimport { DropdownMenuItem } from \"./item\";\nimport { DropdownMenuDivider } from \"./divider\";\nimport { reactNodeToString, clsx, useCls } from \"../utils\";\nimport { Menu } from \"@base-ui-components/react\";\nimport { Command } from \"../cmdk\";\n\nexport interface UseDropdownMenuProps {\n /**\n * Callback function to handle the open state change of the dropdown menu.\n */\n onOpenChange?: (open: boolean) => void;\n items: DropdownMenuItemType[];\n inCombobox?: boolean;\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemSuffix?: string;\n group?: string;\n groupLabel?: string;\n divider?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Custom render function for menu item labels\n */\n itemLabelRender?: (\n item: DropdownMenuItemType & { type: \"item\" },\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Whether to keep the dropdown open when an item is selected\n * @default false\n */\n keepOpenOnSelect?: boolean;\n /**\n * Control the highlighted state of the menu item\n */\n highlightedItemKey?: React.Key;\n /**\n * Control the selected state of the menu item\n */\n selectedItemKeys?: React.Key[];\n /**\n * Whether to show checkbox\n * @default false\n */\n showCheckbox?: boolean;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [String(item.key), reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: DropdownMenuItemType & { type: \"item\" }) => string[];\n}\n\nexport const useDropdownMenu = ({\n items,\n inCombobox = false,\n classNames = {},\n selectedItemKeys,\n keepOpenOnSelect,\n showCheckbox = false,\n getItemKeywords = (item) => [String(item.key), reactNodeToString(item.label)],\n onOpenChange,\n itemRender,\n itemLabelRender,\n}: UseDropdownMenuProps) => {\n const cls = useCls();\n const renderMenuItem = useCallback(\n (item: DropdownMenuItemType, i: number, j: number) => {\n if (item.type === \"item\") {\n return (\n <DropdownMenuItem\n key={i + \"-\" + j}\n item={item}\n inCombobox={inCombobox}\n selected={selectedItemKeys?.includes(item.key)}\n onSelect={\n inCombobox\n ? item.onSelect\n ? item.onSelect\n : () => {\n const e = new MouseEvent(\"click\", {\n bubbles: true,\n cancelable: true,\n }) as unknown as React.MouseEvent<\n HTMLElement,\n MouseEvent\n >;\n item.onClick(e);\n if (!keepOpenOnSelect) onOpenChange?.(false);\n }\n : undefined\n }\n itemRender={itemRender}\n showCheckbox={showCheckbox}\n getItemKeywords={getItemKeywords}\n itemLabelRender={itemLabelRender}\n classNames={{\n item: classNames.item,\n itemIcon: classNames.itemIcon,\n itemSuffix: classNames.itemSuffix,\n }}\n />\n );\n } else if (item.type === \"divider\") {\n return (\n <DropdownMenuDivider\n key={i + \"-\" + j}\n inCombobox={inCombobox}\n className={classNames?.divider}\n />\n );\n }\n return null;\n },\n [\n classNames,\n itemRender,\n onOpenChange,\n inCombobox,\n keepOpenOnSelect,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n itemLabelRender,\n ]\n );\n\n const renderGroup = useCallback(\n (group: DropdownMenuGroup, index: number) => (\n <Menu.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n >\n {group.label && (\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Menu.Group>\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderGroupCombobox = useCallback(\n (group: DropdownMenuGroup, index: number) =>\n group.label ? (\n <Command.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n heading={\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n }\n >\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Command.Group>\n ) : (\n group.items.map((item, j) => renderMenuItem(item, index, j))\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const itemGroups = useMemo(\n () =>\n items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push(current);\n }\n // Skip dividers\n return acc;\n }, []),\n [items]\n );\n return {\n itemGroups,\n renderMenuItem,\n renderGroup: inCombobox ? renderGroupCombobox : renderGroup,\n };\n};\n"],"names":["useDropdownMenu","items","inCombobox","classNames","selectedItemKeys","keepOpenOnSelect","showCheckbox","getItemKeywords","item","reactNodeToString","onOpenChange","itemRender","itemLabelRender","cls","useCls","renderMenuItem","useCallback","i","j","jsx","DropdownMenuItem","e","DropdownMenuDivider","renderGroup","group","index","jsxs","Menu","clsx","renderGroupCombobox","Command","useMemo","acc","current"],"mappings":";;;;;;;;;AA8DO,MAAMA,IAAkB,CAAC;AAAA,EAC9B,OAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa,CAAC;AAAA,EACd,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,iBAAAC,IAAkB,CAACC,MAAS,CAAC,OAAOA,EAAK,GAAG,GAAGC,EAAkBD,EAAK,KAAK,CAAC;AAAA,EAC5E,cAAAE;AAAA,EACA,YAAAC;AAAA,EACA,iBAAAC;AACF,MAA4B;AAC1B,QAAMC,IAAMC,EAAO,GACbC,IAAiBC;AAAA,IACrB,CAACR,GAA4BS,GAAWC,MAClCV,EAAK,SAAS,SAEd,gBAAAW;AAAA,MAACC;AAAA,MAAA;AAAA,QAEC,MAAAZ;AAAA,QACA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CACT,KAIAA,EAAQ,SAAS,UAAUA,EAAQ,SAAS,cAC7CD,EAAI,SAAS,KAEbA,EAAIA,EAAI,SAAS,CAAC,EAAE,MAAM,KAAKC,CAAO,GAGjCD,IACN,EAAE;AAAA,MACP,CAAC/B,CAAK;AAAA,IACR;AAAA,IAGE,gBAAAc;AAAA,IACA,aAAab,IAAa2B,IAAsBN;AAAA,EAClD;AACF;"}
|
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
import { jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { MagnifyingGlassIcon as p, EyeIcon as x, EyeClosedIcon as C } from "@bioturing/assets";
|
|
4
4
|
import { Input as n } from "antd";
|
|
5
|
-
import { forwardRef as
|
|
5
|
+
import { forwardRef as i, useCallback as d, useMemo as P } from "react";
|
|
6
6
|
import './style.css';/* empty css */
|
|
7
7
|
import { useCls as g } from "../utils/antdUtils.js";
|
|
8
8
|
import { Spin as z } from "../spin/component.js";
|
|
9
9
|
import { IconButton as M } from "../icon-button/component.js";
|
|
10
|
-
const T = (
|
|
10
|
+
const T = (t, s) => /* @__PURE__ */ r(n, { ref: s, ...t }), y = (t, s) => {
|
|
11
11
|
const o = P(() => ({
|
|
12
|
-
iconRender: (
|
|
12
|
+
iconRender: (e) => /* @__PURE__ */ r(
|
|
13
13
|
M,
|
|
14
14
|
{
|
|
15
15
|
size: "small",
|
|
16
|
-
label:
|
|
17
|
-
children:
|
|
16
|
+
label: e ? "Hide password" : "Show password",
|
|
17
|
+
children: e ? /* @__PURE__ */ r(x, {}) : /* @__PURE__ */ r(C, {})
|
|
18
18
|
}
|
|
19
19
|
),
|
|
20
|
-
...
|
|
21
|
-
}), [
|
|
20
|
+
...t
|
|
21
|
+
}), [t]);
|
|
22
22
|
return /* @__PURE__ */ r(n.Password, { ref: s, ...o });
|
|
23
23
|
}, A = ({
|
|
24
|
-
enterButton:
|
|
24
|
+
enterButton: t = !1,
|
|
25
25
|
onSearch: s,
|
|
26
26
|
prefix: o,
|
|
27
|
-
onPressEnter:
|
|
28
|
-
onClear:
|
|
29
|
-
loading:
|
|
30
|
-
...
|
|
27
|
+
onPressEnter: e,
|
|
28
|
+
onClear: a,
|
|
29
|
+
loading: u,
|
|
30
|
+
...c
|
|
31
31
|
}, l) => {
|
|
32
32
|
const I = g(), f = d(
|
|
33
33
|
(m) => {
|
|
@@ -37,29 +37,30 @@ const T = (e, s) => /* @__PURE__ */ r(n, { ref: s, ...e }), y = (e, s) => {
|
|
|
37
37
|
), w = d(() => {
|
|
38
38
|
s == null || s("", void 0, { source: "clear" });
|
|
39
39
|
}, [s]);
|
|
40
|
-
return
|
|
40
|
+
return t === !1 ? /* @__PURE__ */ r(
|
|
41
41
|
n,
|
|
42
42
|
{
|
|
43
43
|
ref: l,
|
|
44
|
-
prefix: o || (
|
|
45
|
-
onPressEnter:
|
|
46
|
-
onClear:
|
|
44
|
+
prefix: o || (u ? /* @__PURE__ */ r(z, { size: 16 }) : /* @__PURE__ */ r(p, { size: 16, className: I("input-search-icon") })),
|
|
45
|
+
onPressEnter: e || f,
|
|
46
|
+
onClear: a || w,
|
|
47
47
|
allowClear: !0,
|
|
48
|
-
...
|
|
48
|
+
...c
|
|
49
49
|
}
|
|
50
50
|
) : /* @__PURE__ */ r(
|
|
51
51
|
n.Search,
|
|
52
52
|
{
|
|
53
53
|
ref: l,
|
|
54
54
|
prefix: o,
|
|
55
|
-
onPressEnter:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
onPressEnter: e,
|
|
56
|
+
onSearch: s,
|
|
57
|
+
onClear: a,
|
|
58
|
+
loading: u,
|
|
59
|
+
enterButton: t === !0 ? /* @__PURE__ */ r(p, { size: 16 }) : t,
|
|
60
|
+
...c
|
|
60
61
|
}
|
|
61
62
|
);
|
|
62
|
-
}, E = (
|
|
63
|
+
}, E = (t, s) => /* @__PURE__ */ r(n.TextArea, { ref: s, ...t }), b = i(T), j = i(y), R = i(A), k = i(E), D = Object.assign(b, {
|
|
63
64
|
Password: j,
|
|
64
65
|
Search: R,
|
|
65
66
|
TextArea: k
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/input/component.tsx"],"sourcesContent":["\"use client\";\nimport { EyeIcon, EyeClosedIcon, MagnifyingGlassIcon } from \"@bioturing/assets\";\nimport {\n Input as AntInput,\n type InputProps as AntInputProps,\n type InputRef,\n} from \"antd\";\nimport { type PasswordProps as AntPasswordProps } from \"antd/es/input\";\nimport { type SearchProps as AntSearchProps } from \"antd/es/input\";\nimport { type TextAreaProps as AntTextAreaProps } from \"antd/es/input\";\nimport { forwardRef, useCallback, useMemo } from \"react\";\nimport { useCls } from \"../utils\";\nimport { Spin } from \"../spin\";\n\nimport \"./style.css\";\nimport { IconButton } from \"../icon-button\";\n\n// Define props interfaces\nexport interface InputProps extends AntInputProps {}\nexport interface PasswordProps extends AntPasswordProps {}\nexport interface TextAreaProps extends AntTextAreaProps {}\nexport interface SearchProps extends AntSearchProps {}\n\n// Create inner function for main Input\nconst MainInputInner = (props: InputProps, ref: React.Ref<InputRef>) => {\n return <AntInput ref={ref} {...props} />;\n};\n\n// Create inner function for Password\nconst PasswordInner = (props: PasswordProps, ref: React.Ref<InputRef>) => {\n // Apply default iconRender unless overridden by props\n const mergedProps = useMemo(() => {\n return {\n iconRender: (visible: boolean) => (\n <IconButton\n size=\"small\"\n label={visible ? \"Hide password\" : \"Show password\"}\n >\n {visible ? <EyeIcon /> : <EyeClosedIcon />}\n </IconButton>\n ),\n ...props,\n };\n }, [props]);\n\n return <AntInput.Password ref={ref} {...mergedProps} />;\n};\n\n// Create inner function for Search\nconst SearchInner = (\n {\n enterButton = false,\n onSearch,\n prefix,\n onPressEnter,\n onClear,\n loading,\n ...rest\n }: SearchProps,\n ref: React.Ref<InputRef>\n) => {\n const cls = useCls();\n\n const handlePressEnter = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n onSearch?.(event.currentTarget.value, event, { source: \"input\" });\n },\n [onSearch]\n );\n\n const handleClear = useCallback(() => {\n onSearch?.(\"\", undefined, { source: \"clear\" });\n }, [onSearch]);\n\n return enterButton === false ? (\n <AntInput\n ref={ref}\n prefix={\n prefix ||\n (loading ? (\n <Spin size={16} />\n ) : (\n <MagnifyingGlassIcon size={16} className={cls(\"input-search-icon\")} />\n ))\n }\n onPressEnter={onPressEnter || handlePressEnter}\n onClear={onClear || handleClear}\n allowClear\n {...rest}\n />\n ) : (\n <AntInput.Search\n ref={ref}\n prefix={prefix}\n onPressEnter={onPressEnter}\n onClear={onClear}\n loading={loading}\n enterButton={\n enterButton === true ? <MagnifyingGlassIcon size={16} /> : enterButton\n }\n {...rest}\n />\n );\n};\n\n// Create inner function for TextArea\nconst TextAreaInner = (\n props: TextAreaProps,\n ref: React.Ref<HTMLTextAreaElement>\n) => {\n return <AntInput.TextArea ref={ref} {...props} />;\n};\n\n// Use forwardRef with type assertion for main Input\nconst MainInput = forwardRef(MainInputInner) as (\n props: InputProps & {\n ref?: React.ForwardedRef<InputRef>;\n }\n) => ReturnType<typeof MainInputInner>;\n\n// Use forwardRef with type assertion for Password\nconst Password = forwardRef(PasswordInner) as (\n props: PasswordProps & {\n ref?: React.ForwardedRef<InputRef>;\n }\n) => ReturnType<typeof PasswordInner>;\n\n// Use forwardRef with type assertion for Search\nconst Search = forwardRef(SearchInner) as (\n props: SearchProps & {\n ref?: React.ForwardedRef<InputRef>;\n }\n) => ReturnType<typeof SearchInner>;\n\n// Use forwardRef with type assertion for TextArea\nconst TextArea = forwardRef(TextAreaInner) as (\n props: TextAreaProps & {\n ref?: React.ForwardedRef<HTMLTextAreaElement>;\n }\n) => ReturnType<typeof TextAreaInner>;\n\n// Export the final composed component\nexport const Input = Object.assign(MainInput, {\n Password,\n Search,\n TextArea,\n});\n"],"names":["MainInputInner","props","ref","jsx","AntInput","PasswordInner","mergedProps","useMemo","visible","IconButton","EyeIcon","EyeClosedIcon","SearchInner","enterButton","onSearch","prefix","onPressEnter","onClear","loading","rest","cls","useCls","handlePressEnter","useCallback","event","handleClear","Spin","MagnifyingGlassIcon","TextAreaInner","MainInput","forwardRef","Password","Search","TextArea","Input"],"mappings":";;;;;;;;;AAwBA,MAAMA,IAAiB,CAACC,GAAmBC,MACjC,gBAAAC,EAAAC,GAAA,EAAS,KAAAF,GAAW,GAAGD,EAAO,CAAA,GAIlCI,IAAgB,CAACJ,GAAsBC,MAA6B;AAElE,QAAAI,IAAcC,EAAQ,OACnB;AAAA,IACL,YAAY,CAACC,MACX,gBAAAL;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOD,IAAU,kBAAkB;AAAA,QAElC,UAAUA,IAAA,gBAAAL,EAACO,GAAQ,CAAA,CAAA,sBAAMC,GAAc,CAAA,CAAA;AAAA,MAAA;AAAA,IAC1C;AAAA,IAEF,GAAGV;AAAA,EACL,IACC,CAACA,CAAK,CAAC;AAEV,2BAAQG,EAAS,UAAT,EAAkB,KAAAF,GAAW,GAAGI,GAAa;AACvD,GAGMM,IAAc,CAClB;AAAA,EACE,aAAAC,IAAc;AAAA,EACd,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,GAAGC;AACL,GACAjB,MACG;AACH,QAAMkB,IAAMC,EAAO,GAEbC,IAAmBC;AAAA,IACvB,CAACC,MAAiD;AAChD,MAAAV,KAAA,QAAAA,EAAWU,EAAM,cAAc,OAAOA,GAAO,EAAE,QAAQ;IACzD;AAAA,IACA,CAACV,CAAQ;AAAA,EACX,GAEMW,IAAcF,EAAY,MAAM;AACpC,IAAAT,KAAA,QAAAA,EAAW,IAAI,QAAW,EAAE,QAAQ;EAAS,GAC5C,CAACA,CAAQ,CAAC;AAEb,SAAOD,MAAgB,KACrB,gBAAAV;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,QACEa,MACCG,IACC,gBAAAf,EAACuB,KAAK,MAAM,IAAI,IAEhB,gBAAAvB,EAACwB,KAAoB,MAAM,IAAI,WAAWP,EAAI,mBAAmB,EAAG,CAAA;AAAA,MAGxE,cAAcJ,KAAgBM;AAAA,MAC9B,SAASL,KAAWQ;AAAA,MACpB,YAAU;AAAA,MACT,GAAGN;AAAA,IAAA;AAAA,EAAA,IAGN,gBAAAhB;AAAA,IAACC,EAAS;AAAA,IAAT;AAAA,MACC,KAAAF;AAAA,MACA,QAAAa;AAAA,MACA,cAAAC;AAAA,MACA,
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/input/component.tsx"],"sourcesContent":["\"use client\";\nimport { EyeIcon, EyeClosedIcon, MagnifyingGlassIcon } from \"@bioturing/assets\";\nimport {\n Input as AntInput,\n type InputProps as AntInputProps,\n type InputRef,\n} from \"antd\";\nimport { type PasswordProps as AntPasswordProps } from \"antd/es/input\";\nimport { type SearchProps as AntSearchProps } from \"antd/es/input\";\nimport { type TextAreaProps as AntTextAreaProps } from \"antd/es/input\";\nimport { forwardRef, useCallback, useMemo } from \"react\";\nimport { useCls } from \"../utils\";\nimport { Spin } from \"../spin\";\n\nimport \"./style.css\";\nimport { IconButton } from \"../icon-button\";\n\n// Define props interfaces\nexport interface InputProps extends AntInputProps {}\nexport interface PasswordProps extends AntPasswordProps {}\nexport interface TextAreaProps extends AntTextAreaProps {}\nexport interface SearchProps extends AntSearchProps {}\n\n// Create inner function for main Input\nconst MainInputInner = (props: InputProps, ref: React.Ref<InputRef>) => {\n return <AntInput ref={ref} {...props} />;\n};\n\n// Create inner function for Password\nconst PasswordInner = (props: PasswordProps, ref: React.Ref<InputRef>) => {\n // Apply default iconRender unless overridden by props\n const mergedProps = useMemo(() => {\n return {\n iconRender: (visible: boolean) => (\n <IconButton\n size=\"small\"\n label={visible ? \"Hide password\" : \"Show password\"}\n >\n {visible ? <EyeIcon /> : <EyeClosedIcon />}\n </IconButton>\n ),\n ...props,\n };\n }, [props]);\n\n return <AntInput.Password ref={ref} {...mergedProps} />;\n};\n\n// Create inner function for Search\nconst SearchInner = (\n {\n enterButton = false,\n onSearch,\n prefix,\n onPressEnter,\n onClear,\n loading,\n ...rest\n }: SearchProps,\n ref: React.Ref<InputRef>\n) => {\n const cls = useCls();\n\n const handlePressEnter = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n onSearch?.(event.currentTarget.value, event, { source: \"input\" });\n },\n [onSearch]\n );\n\n const handleClear = useCallback(() => {\n onSearch?.(\"\", undefined, { source: \"clear\" });\n }, [onSearch]);\n\n return enterButton === false ? (\n <AntInput\n ref={ref}\n prefix={\n prefix ||\n (loading ? (\n <Spin size={16} />\n ) : (\n <MagnifyingGlassIcon size={16} className={cls(\"input-search-icon\")} />\n ))\n }\n onPressEnter={onPressEnter || handlePressEnter}\n onClear={onClear || handleClear}\n allowClear\n {...rest}\n />\n ) : (\n <AntInput.Search\n ref={ref}\n prefix={prefix}\n onPressEnter={onPressEnter}\n onSearch={onSearch}\n onClear={onClear}\n loading={loading}\n enterButton={\n enterButton === true ? <MagnifyingGlassIcon size={16} /> : enterButton\n }\n {...rest}\n />\n );\n};\n\n// Create inner function for TextArea\nconst TextAreaInner = (\n props: TextAreaProps,\n ref: React.Ref<HTMLTextAreaElement>\n) => {\n return <AntInput.TextArea ref={ref} {...props} />;\n};\n\n// Use forwardRef with type assertion for main Input\nconst MainInput = forwardRef(MainInputInner) as (\n props: InputProps & {\n ref?: React.ForwardedRef<InputRef>;\n }\n) => ReturnType<typeof MainInputInner>;\n\n// Use forwardRef with type assertion for Password\nconst Password = forwardRef(PasswordInner) as (\n props: PasswordProps & {\n ref?: React.ForwardedRef<InputRef>;\n }\n) => ReturnType<typeof PasswordInner>;\n\n// Use forwardRef with type assertion for Search\nconst Search = forwardRef(SearchInner) as (\n props: SearchProps & {\n ref?: React.ForwardedRef<InputRef>;\n }\n) => ReturnType<typeof SearchInner>;\n\n// Use forwardRef with type assertion for TextArea\nconst TextArea = forwardRef(TextAreaInner) as (\n props: TextAreaProps & {\n ref?: React.ForwardedRef<HTMLTextAreaElement>;\n }\n) => ReturnType<typeof TextAreaInner>;\n\n// Export the final composed component\nexport const Input = Object.assign(MainInput, {\n Password,\n Search,\n TextArea,\n});\n"],"names":["MainInputInner","props","ref","jsx","AntInput","PasswordInner","mergedProps","useMemo","visible","IconButton","EyeIcon","EyeClosedIcon","SearchInner","enterButton","onSearch","prefix","onPressEnter","onClear","loading","rest","cls","useCls","handlePressEnter","useCallback","event","handleClear","Spin","MagnifyingGlassIcon","TextAreaInner","MainInput","forwardRef","Password","Search","TextArea","Input"],"mappings":";;;;;;;;;AAwBA,MAAMA,IAAiB,CAACC,GAAmBC,MACjC,gBAAAC,EAAAC,GAAA,EAAS,KAAAF,GAAW,GAAGD,EAAO,CAAA,GAIlCI,IAAgB,CAACJ,GAAsBC,MAA6B;AAElE,QAAAI,IAAcC,EAAQ,OACnB;AAAA,IACL,YAAY,CAACC,MACX,gBAAAL;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOD,IAAU,kBAAkB;AAAA,QAElC,UAAUA,IAAA,gBAAAL,EAACO,GAAQ,CAAA,CAAA,sBAAMC,GAAc,CAAA,CAAA;AAAA,MAAA;AAAA,IAC1C;AAAA,IAEF,GAAGV;AAAA,EACL,IACC,CAACA,CAAK,CAAC;AAEV,2BAAQG,EAAS,UAAT,EAAkB,KAAAF,GAAW,GAAGI,GAAa;AACvD,GAGMM,IAAc,CAClB;AAAA,EACE,aAAAC,IAAc;AAAA,EACd,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,GAAGC;AACL,GACAjB,MACG;AACH,QAAMkB,IAAMC,EAAO,GAEbC,IAAmBC;AAAA,IACvB,CAACC,MAAiD;AAChD,MAAAV,KAAA,QAAAA,EAAWU,EAAM,cAAc,OAAOA,GAAO,EAAE,QAAQ;IACzD;AAAA,IACA,CAACV,CAAQ;AAAA,EACX,GAEMW,IAAcF,EAAY,MAAM;AACpC,IAAAT,KAAA,QAAAA,EAAW,IAAI,QAAW,EAAE,QAAQ;EAAS,GAC5C,CAACA,CAAQ,CAAC;AAEb,SAAOD,MAAgB,KACrB,gBAAAV;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,QACEa,MACCG,IACC,gBAAAf,EAACuB,KAAK,MAAM,IAAI,IAEhB,gBAAAvB,EAACwB,KAAoB,MAAM,IAAI,WAAWP,EAAI,mBAAmB,EAAG,CAAA;AAAA,MAGxE,cAAcJ,KAAgBM;AAAA,MAC9B,SAASL,KAAWQ;AAAA,MACpB,YAAU;AAAA,MACT,GAAGN;AAAA,IAAA;AAAA,EAAA,IAGN,gBAAAhB;AAAA,IAACC,EAAS;AAAA,IAAT;AAAA,MACC,KAAAF;AAAA,MACA,QAAAa;AAAA,MACA,cAAAC;AAAA,MACA,UAAAF;AAAA,MACA,SAAAG;AAAA,MACA,SAAAC;AAAA,MACA,aACEL,MAAgB,uBAAQc,GAAoB,EAAA,MAAM,GAAI,CAAA,IAAKd;AAAA,MAE5D,GAAGM;AAAA,IAAA;AAAA,EACN;AAEJ,GAGMS,IAAgB,CACpB3B,GACAC,wBAEQE,EAAS,UAAT,EAAkB,KAAAF,GAAW,GAAGD,GAAO,GAI3C4B,IAAYC,EAAW9B,CAAc,GAOrC+B,IAAWD,EAAWzB,CAAa,GAOnC2B,IAASF,EAAWlB,CAAW,GAO/BqB,IAAWH,EAAWF,CAAa,GAO5BM,IAAQ,OAAO,OAAOL,GAAW;AAAA,EAC5C,UAAAE;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AACF,CAAC;"}
|
|
@@ -1,87 +1,106 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { ScrollArea as
|
|
2
|
+
import { jsxs as E, jsx as f } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as L, useState as j, useEffect as C } from "react";
|
|
4
|
+
import { ScrollArea as h } from "@base-ui-components/react";
|
|
5
5
|
import './style.css';/* empty css */
|
|
6
|
-
import { useCls as
|
|
7
|
-
import { clsx as
|
|
8
|
-
const
|
|
9
|
-
children:
|
|
10
|
-
className:
|
|
11
|
-
classNames:
|
|
12
|
-
orientation:
|
|
6
|
+
import { useCls as H } from "../utils/antdUtils.js";
|
|
7
|
+
import { clsx as u } from "../utils/cn.js";
|
|
8
|
+
const q = ({
|
|
9
|
+
children: z,
|
|
10
|
+
className: x,
|
|
11
|
+
classNames: t = {},
|
|
12
|
+
orientation: c = "vertical",
|
|
13
13
|
fadeEdges: e = !1,
|
|
14
|
-
onScroll:
|
|
14
|
+
onScroll: A,
|
|
15
|
+
styles: l = {},
|
|
16
|
+
...R
|
|
15
17
|
}) => {
|
|
16
|
-
const
|
|
18
|
+
const o = H(), v = L(null), [r, d] = j({
|
|
17
19
|
isAtStart: !0,
|
|
18
20
|
isAtEnd: !1,
|
|
19
21
|
isScrollable: !1
|
|
20
22
|
});
|
|
21
|
-
return
|
|
22
|
-
if (!
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
26
|
-
const { scrollTop:
|
|
27
|
-
|
|
28
|
-
isAtStart:
|
|
29
|
-
isAtEnd:
|
|
30
|
-
isScrollable:
|
|
23
|
+
return C(() => {
|
|
24
|
+
if (!v.current) return;
|
|
25
|
+
const i = v.current, n = (m) => {
|
|
26
|
+
if (m && A && A(m), e)
|
|
27
|
+
if (c === "vertical") {
|
|
28
|
+
const { scrollTop: a, scrollHeight: b, clientHeight: S } = i, p = b > S;
|
|
29
|
+
d({
|
|
30
|
+
isAtStart: a <= 1,
|
|
31
|
+
isAtEnd: a >= b - S - 1,
|
|
32
|
+
isScrollable: p
|
|
31
33
|
});
|
|
32
34
|
} else {
|
|
33
|
-
const { scrollLeft:
|
|
34
|
-
|
|
35
|
-
isAtStart:
|
|
36
|
-
isAtEnd:
|
|
37
|
-
isScrollable:
|
|
35
|
+
const { scrollLeft: a, scrollWidth: b, clientWidth: S } = i, p = b > S + 2;
|
|
36
|
+
d({
|
|
37
|
+
isAtStart: a <= 1,
|
|
38
|
+
isAtEnd: a >= b - S - 1,
|
|
39
|
+
isScrollable: p
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
};
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
43
|
+
n();
|
|
44
|
+
const T = setTimeout(n, 0);
|
|
45
|
+
i.addEventListener("scroll", n);
|
|
46
|
+
const w = new ResizeObserver(() => {
|
|
47
|
+
n();
|
|
46
48
|
});
|
|
47
|
-
return
|
|
48
|
-
clearTimeout(
|
|
49
|
+
return w.observe(i), () => {
|
|
50
|
+
clearTimeout(T), i.removeEventListener("scroll", n), w.disconnect();
|
|
49
51
|
};
|
|
50
|
-
}, [e,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
}, [e, c, A]), /* @__PURE__ */ E(
|
|
53
|
+
h.Root,
|
|
54
|
+
{
|
|
55
|
+
className: u(o("scroll-area"), x),
|
|
56
|
+
...R,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ f(
|
|
59
|
+
h.Viewport,
|
|
60
|
+
{
|
|
61
|
+
ref: v,
|
|
62
|
+
className: u(
|
|
63
|
+
o("scroll-area-viewport"),
|
|
64
|
+
e && r.isScrollable && c === "vertical" && r.isAtStart && o("scroll-area-fade-bottom-only"),
|
|
65
|
+
e && r.isScrollable && c === "vertical" && r.isAtEnd && o("scroll-area-fade-top-only"),
|
|
66
|
+
e && r.isScrollable && c === "vertical" && !r.isAtStart && !r.isAtEnd && o("scroll-area-fade-both-vertical"),
|
|
67
|
+
e && r.isScrollable && c === "horizontal" && r.isAtStart && o("scroll-area-fade-right-only"),
|
|
68
|
+
e && r.isScrollable && c === "horizontal" && r.isAtEnd && o("scroll-area-fade-left-only"),
|
|
69
|
+
e && r.isScrollable && c === "horizontal" && !r.isAtStart && !r.isAtEnd && o("scroll-area-fade-both-horizontal"),
|
|
70
|
+
t == null ? void 0 : t.viewport
|
|
71
|
+
),
|
|
72
|
+
style: l == null ? void 0 : l.viewport,
|
|
73
|
+
children: /* @__PURE__ */ f(
|
|
74
|
+
h.Content,
|
|
75
|
+
{
|
|
76
|
+
className: u(o("scroll-area-content"), t == null ? void 0 : t.content),
|
|
77
|
+
style: l == null ? void 0 : l.content,
|
|
78
|
+
children: z
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
}
|
|
64
82
|
),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
),
|
|
68
|
-
/* @__PURE__ */ f(
|
|
69
|
-
S.Scrollbar,
|
|
70
|
-
{
|
|
71
|
-
className: b(l("scroll-area-scrollbar"), o == null ? void 0 : o.scrollbar),
|
|
72
|
-
orientation: t,
|
|
73
|
-
"data-orientation": t,
|
|
74
|
-
children: /* @__PURE__ */ f(
|
|
75
|
-
S.Thumb,
|
|
83
|
+
/* @__PURE__ */ f(
|
|
84
|
+
h.Scrollbar,
|
|
76
85
|
{
|
|
77
|
-
className:
|
|
86
|
+
className: u(o("scroll-area-scrollbar"), t == null ? void 0 : t.scrollbar),
|
|
87
|
+
orientation: c,
|
|
88
|
+
"data-orientation": c,
|
|
89
|
+
style: l == null ? void 0 : l.scrollbar,
|
|
90
|
+
children: /* @__PURE__ */ f(
|
|
91
|
+
h.Thumb,
|
|
92
|
+
{
|
|
93
|
+
className: u(o("scroll-area-thumb"), t == null ? void 0 : t.thumb),
|
|
94
|
+
style: l == null ? void 0 : l.thumb
|
|
95
|
+
}
|
|
96
|
+
)
|
|
78
97
|
}
|
|
79
98
|
)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
);
|
|
83
102
|
};
|
|
84
103
|
export {
|
|
85
|
-
|
|
104
|
+
q as ScrollArea
|
|
86
105
|
};
|
|
87
106
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/scroll-area/component.tsx"],"sourcesContent":["\"use client\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { ScrollArea as BaseScrollArea } from \"@base-ui-components/react\";\nimport { clsx, useCls } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface ScrollAreaProps {\n children: ReactNode;\n /**\n * Additional class name for the root component\n */\n className?: string;\n /**\n * Custom class names for each part of the scroll area\n */\n classNames?: {\n /**\n * Class name for the viewport element\n */\n viewport?: string;\n /**\n * Class name for the scrollbar element\n */\n scrollbar?: string;\n /**\n * Class name for the thumb element\n */\n thumb?: string;\n };\n /**\n * Orientation of the scrollbar\n * @default \"vertical\"\n */\n orientation?: \"vertical\" | \"horizontal\";\n /**\n * Enable fade-out effect at scrollable edges\n * @default false\n */\n fadeEdges?: boolean;\n /**\n * Callback fired when the scroll position changes\n */\n onScroll?: (event: Event) => void;\n}\n\nexport const ScrollArea = ({\n children,\n className,\n classNames = {},\n orientation = \"vertical\",\n fadeEdges = false,\n onScroll,\n}: ScrollAreaProps) => {\n const cls = useCls();\n const viewportRef = useRef<HTMLDivElement>(null);\n const [scrollState, setScrollState] = useState({\n isAtStart: true,\n isAtEnd: false,\n isScrollable: false,\n });\n\n useEffect(() => {\n if (!viewportRef.current) return;\n\n const viewport = viewportRef.current;\n\n const handleScroll = (event?: Event) => {\n // Call the onScroll callback if provided and event exists\n if (event && onScroll) {\n onScroll(event);\n }\n\n // Handle fade edges state update if enabled\n if (fadeEdges) {\n if (orientation === \"vertical\") {\n const { scrollTop, scrollHeight, clientHeight } = viewport;\n const isScrollable = scrollHeight > clientHeight;\n setScrollState({\n isAtStart: scrollTop <= 1,\n isAtEnd: scrollTop >= scrollHeight - clientHeight - 1,\n isScrollable,\n });\n } else {\n const { scrollLeft, scrollWidth, clientWidth } = viewport;\n // Add a small buffer (2px) to account for rounding errors\n const isScrollable = scrollWidth > clientWidth + 2;\n setScrollState({\n isAtStart: scrollLeft <= 1,\n isAtEnd: scrollLeft >= scrollWidth - clientWidth - 1,\n isScrollable,\n });\n }\n }\n };\n\n // Initial check (without event)\n handleScroll();\n\n // Use a timeout to check again after content might have rendered\n const timeoutId = setTimeout(handleScroll, 0);\n\n viewport.addEventListener(\"scroll\", handleScroll);\n\n // Add resize observer to detect content size changes\n const resizeObserver = new ResizeObserver(() => {\n handleScroll();\n });\n resizeObserver.observe(viewport);\n\n return () => {\n clearTimeout(timeoutId);\n viewport.removeEventListener(\"scroll\", handleScroll);\n resizeObserver.disconnect();\n };\n }, [fadeEdges, orientation, onScroll]);\n return (\n <BaseScrollArea.Root
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/scroll-area/component.tsx"],"sourcesContent":["\"use client\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { ScrollArea as BaseScrollArea } from \"@base-ui-components/react\";\nimport { clsx, useCls } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface ScrollAreaProps\n extends Omit<BaseScrollArea.Root.Props, \"onScroll\"> {\n children: ReactNode;\n /**\n * Additional class name for the root component\n */\n className?: string;\n /**\n * Custom class names for each part of the scroll area\n */\n classNames?: {\n /**\n * Class name for the viewport element\n */\n viewport?: string;\n /**\n * Class name for the content element\n */\n content?: string;\n /**\n * Class name for the scrollbar element\n */\n scrollbar?: string;\n /**\n * Class name for the thumb element\n */\n thumb?: string;\n };\n /**\n * Custom styles for each part of the scroll area\n */\n styles?: {\n /**\n * Styles for the viewport element\n */\n viewport?: React.CSSProperties;\n /**\n * Styles for the content element\n */\n content?: React.CSSProperties;\n /**\n * Styles for the scrollbar element\n */\n scrollbar?: React.CSSProperties;\n /**\n * Styles for the thumb element\n */\n thumb?: React.CSSProperties;\n };\n /**\n * Orientation of the scrollbar\n * @default \"vertical\"\n */\n orientation?: \"vertical\" | \"horizontal\";\n /**\n * Enable fade-out effect at scrollable edges\n * @default false\n */\n fadeEdges?: boolean;\n /**\n * Callback fired when the scroll position changes\n */\n onScroll?: (event: Event) => void;\n}\n\nexport const ScrollArea = ({\n children,\n className,\n classNames = {},\n orientation = \"vertical\",\n fadeEdges = false,\n onScroll,\n styles = {},\n ...rest\n}: ScrollAreaProps) => {\n const cls = useCls();\n const viewportRef = useRef<HTMLDivElement>(null);\n const [scrollState, setScrollState] = useState({\n isAtStart: true,\n isAtEnd: false,\n isScrollable: false,\n });\n\n useEffect(() => {\n if (!viewportRef.current) return;\n\n const viewport = viewportRef.current;\n\n const handleScroll = (event?: Event) => {\n // Call the onScroll callback if provided and event exists\n if (event && onScroll) {\n onScroll(event);\n }\n\n // Handle fade edges state update if enabled\n if (fadeEdges) {\n if (orientation === \"vertical\") {\n const { scrollTop, scrollHeight, clientHeight } = viewport;\n const isScrollable = scrollHeight > clientHeight;\n setScrollState({\n isAtStart: scrollTop <= 1,\n isAtEnd: scrollTop >= scrollHeight - clientHeight - 1,\n isScrollable,\n });\n } else {\n const { scrollLeft, scrollWidth, clientWidth } = viewport;\n // Add a small buffer (2px) to account for rounding errors\n const isScrollable = scrollWidth > clientWidth + 2;\n setScrollState({\n isAtStart: scrollLeft <= 1,\n isAtEnd: scrollLeft >= scrollWidth - clientWidth - 1,\n isScrollable,\n });\n }\n }\n };\n\n // Initial check (without event)\n handleScroll();\n\n // Use a timeout to check again after content might have rendered\n const timeoutId = setTimeout(handleScroll, 0);\n\n viewport.addEventListener(\"scroll\", handleScroll);\n\n // Add resize observer to detect content size changes\n const resizeObserver = new ResizeObserver(() => {\n handleScroll();\n });\n resizeObserver.observe(viewport);\n\n return () => {\n clearTimeout(timeoutId);\n viewport.removeEventListener(\"scroll\", handleScroll);\n resizeObserver.disconnect();\n };\n }, [fadeEdges, orientation, onScroll]);\n return (\n <BaseScrollArea.Root\n className={clsx(cls(\"scroll-area\"), className)}\n {...rest}\n >\n <BaseScrollArea.Viewport\n ref={viewportRef}\n className={clsx(\n cls(\"scroll-area-viewport\"),\n fadeEdges &&\n scrollState.isScrollable &&\n orientation === \"vertical\" &&\n scrollState.isAtStart &&\n cls(\"scroll-area-fade-bottom-only\"),\n fadeEdges &&\n scrollState.isScrollable &&\n orientation === \"vertical\" &&\n scrollState.isAtEnd &&\n cls(\"scroll-area-fade-top-only\"),\n fadeEdges &&\n scrollState.isScrollable &&\n orientation === \"vertical\" &&\n !scrollState.isAtStart &&\n !scrollState.isAtEnd &&\n cls(\"scroll-area-fade-both-vertical\"),\n fadeEdges &&\n scrollState.isScrollable &&\n orientation === \"horizontal\" &&\n scrollState.isAtStart &&\n cls(\"scroll-area-fade-right-only\"),\n fadeEdges &&\n scrollState.isScrollable &&\n orientation === \"horizontal\" &&\n scrollState.isAtEnd &&\n cls(\"scroll-area-fade-left-only\"),\n fadeEdges &&\n scrollState.isScrollable &&\n orientation === \"horizontal\" &&\n !scrollState.isAtStart &&\n !scrollState.isAtEnd &&\n cls(\"scroll-area-fade-both-horizontal\"),\n classNames?.viewport\n )}\n style={styles?.viewport}\n >\n <BaseScrollArea.Content\n className={clsx(cls(\"scroll-area-content\"), classNames?.content)}\n style={styles?.content}\n >\n {children}\n </BaseScrollArea.Content>\n </BaseScrollArea.Viewport>\n <BaseScrollArea.Scrollbar\n className={clsx(cls(\"scroll-area-scrollbar\"), classNames?.scrollbar)}\n orientation={orientation}\n data-orientation={orientation}\n style={styles?.scrollbar}\n >\n <BaseScrollArea.Thumb\n className={clsx(cls(\"scroll-area-thumb\"), classNames?.thumb)}\n style={styles?.thumb}\n />\n </BaseScrollArea.Scrollbar>\n </BaseScrollArea.Root>\n );\n};\n"],"names":["ScrollArea","children","className","classNames","orientation","fadeEdges","onScroll","styles","rest","cls","useCls","viewportRef","useRef","scrollState","setScrollState","useState","useEffect","viewport","handleScroll","event","scrollTop","scrollHeight","clientHeight","isScrollable","scrollLeft","scrollWidth","clientWidth","timeoutId","resizeObserver","jsxs","BaseScrollArea","clsx","jsx"],"mappings":";;;;;;;AAyEO,MAAMA,IAAa,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC,IAAa,CAAC;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,QAAAC,IAAS,CAAC;AAAA,EACV,GAAGC;AACL,MAAuB;AACrB,QAAMC,IAAMC,EAAO,GACbC,IAAcC,EAAuB,IAAI,GACzC,CAACC,GAAaC,CAAc,IAAIC,EAAS;AAAA,IAC7C,WAAW;AAAA,IACX,SAAS;AAAA,IACT,cAAc;AAAA,EAAA,CACf;AAED,SAAAC,EAAU,MAAM;AACV,QAAA,CAACL,EAAY,QAAS;AAE1B,UAAMM,IAAWN,EAAY,SAEvBO,IAAe,CAACC,MAAkB;AAOtC,UALIA,KAASb,KACXA,EAASa,CAAK,GAIZd;AACF,YAAID,MAAgB,YAAY;AAC9B,gBAAM,EAAE,WAAAgB,GAAW,cAAAC,GAAc,cAAAC,EAAiB,IAAAL,GAC5CM,IAAeF,IAAeC;AACrB,UAAAR,EAAA;AAAA,YACb,WAAWM,KAAa;AAAA,YACxB,SAASA,KAAaC,IAAeC,IAAe;AAAA,YACpD,cAAAC;AAAA,UAAA,CACD;AAAA,QAAA,OACI;AACL,gBAAM,EAAE,YAAAC,GAAY,aAAAC,GAAa,aAAAC,EAAgB,IAAAT,GAE3CM,IAAeE,IAAcC,IAAc;AAClC,UAAAZ,EAAA;AAAA,YACb,WAAWU,KAAc;AAAA,YACzB,SAASA,KAAcC,IAAcC,IAAc;AAAA,YACnD,cAAAH;AAAA,UAAA,CACD;AAAA,QAAA;AAAA,IAGP;AAGa,IAAAL,EAAA;AAGP,UAAAS,IAAY,WAAWT,GAAc,CAAC;AAEnC,IAAAD,EAAA,iBAAiB,UAAUC,CAAY;A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Y,OAAO;AAAA,gBAC/D,OAAOI,KAAA,gBAAAA,EAAQ;AAAA,gBAEd,UAAAN;AAAA,cAAA;AAAA,YAAA;AAAA,UACH;AAAA,QACF;AAAA,QACA,gBAAA+B;AAAA,UAACF,EAAe;AAAA,UAAf;AAAA,YACC,WAAWC,EAAKtB,EAAI,uBAAuB,GAAGN,KAAA,gBAAAA,EAAY,SAAS;AAAA,YACnE,aAAAC;AAAA,YACA,oBAAkBA;AAAA,YAClB,OAAOG,KAAA,gBAAAA,EAAQ;AAAA,YAEf,UAAA,gBAAAyB;AAAA,cAACF,EAAe;AAAA,cAAf;AAAA,gBACC,WAAWC,EAAKtB,EAAI,mBAAmB,GAAGN,KAAA,gBAAAA,EAAY,KAAK;AAAA,gBAC3D,OAAOI,KAAA,gBAAAA,EAAQ;AAAA,cAAA;AAAA,YAAA;AAAA,UACjB;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/select/component.tsx"],"sourcesContent":["\"use client\";\nimport { CaretDown } from \"@bioturing/assets\";\nimport {\n autoPlacement,\n autoUpdate,\n FloatingOverlay,\n offset,\n shift,\n size,\n useFloating,\n useFloatingPortalNode,\n} from \"@floating-ui/react\";\nimport { default as Checkbox } from \"antd/es/checkbox\";\nimport {\n default as AntSelect,\n type SelectProps as AntSelectProps,\n type BaseOptionType,\n type DefaultOptionType,\n} from \"antd/es/select\";\nimport { toMerged } from \"es-toolkit\";\nimport React, {\n CSSProperties,\n forwardRef,\n isValidElement,\n useCallback,\n} from \"react\";\nimport { useControlledState } from \"../hooks\";\nimport { PopupPanelSize } from \"../popup-panel/constants\";\nimport { clsx, useCls } from \"../utils\";\n\n// Import component-specific styles\nimport { Divider } from \"antd\";\nimport { CheckboxProps } from \"../checkbox\";\nimport { SelectItem } from \"./item\";\nimport \"./style.css\";\n\n// SelectItem component props\n\n// Define props interface extending Ant Design's SelectProps\nexport interface SelectProps<\n ValueType = unknown,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType\n> extends AntSelectProps<ValueType, OptionType> {\n /**\n * Whether to enhance the positioner using floating-ui\n * @default false\n */\n enhancePositioner?: boolean;\n /**\n * Size of the popup panel\n * Will be ignored if enhancePositioner is false\n */\n popupSize?: string | number | PopupPanelSize;\n /**\n * Show selection summary instead of tags in multiple case\n * @default false\n */\n showSelectionSummary?: boolean;\n /**\n * Render function for the selection summary in multiple case\n * @default (value) => `${value.length} items selected`\n */\n selectionSummaryRender?: (value: ValueType) => React.ReactNode;\n /**\n * Show select all option when in multiple mode\n * @default false\n */\n showSelectAll?: boolean;\n /**\n * Render function for the select all option\n */\n selectAllRender?: (props: {\n onClick: () => void;\n checked: CheckboxProps[\"checked\"];\n indeterminate: CheckboxProps[\"indeterminate\"];\n }) => React.ReactNode;\n}\n\nexport type {\n BaseOptionType as SelectBaseOptionType,\n DefaultOptionType as SelectDefaultOptionType,\n};\n\n// Create inner function\nconst MainSelectInner = <\n ValueType = unknown,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType\n>(\n {\n mode,\n className,\n open: openProp,\n defaultOpen,\n onOpenChange,\n popupClassName,\n onDropdownVisibleChange,\n enhancePositioner,\n getPopupContainer,\n popupSize,\n popupRender,\n dropdownRender,\n classNames,\n styles = {},\n showSelectionSummary,\n selectionSummaryRender,\n value: valueProp,\n onChange: onChangeProp,\n defaultValue,\n showSelectAll,\n selectAllRender,\n options,\n ...rest\n }: SelectProps<ValueType, OptionType>,\n ref: React.Ref<React.ComponentRef<typeof AntSelect>>\n) => {\n const portalNode = useFloatingPortalNode({});\n const isMultiple = mode === \"multiple\" || mode === \"tags\";\n const [open, setOpen] = useControlledState(\n openProp,\n onOpenChange || onDropdownVisibleChange,\n defaultOpen\n );\n const cls = useCls();\n const [value, onChange] = useControlledState(\n valueProp,\n onChangeProp,\n defaultValue\n );\n // enhancePositioner\n const { floatingStyles, refs } = useFloating({\n placement: \"bottom-start\",\n transform: false,\n open: enhancePositioner && open,\n middleware: [\n offset({\n mainAxis: 4,\n }),\n autoPlacement({\n allowedPlacements: [\n \"bottom-start\",\n \"bottom-end\",\n \"bottom\",\n \"top-start\",\n \"top-end\",\n \"top\",\n ],\n }),\n shift({\n padding: 8,\n }),\n size({\n padding: 8,\n apply({ availableHeight, availableWidth, elements }) {\n // 2. Or, use a CSS variable:\n elements.floating.style.setProperty(\n \"--available-width\",\n availableWidth + \"px\"\n );\n elements.floating.style.setProperty(\n \"--available-height\",\n availableHeight + \"px\"\n );\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n const defaultSelectionSummaryRender = useCallback(\n (v: ValueType) => {\n const count = Array.isArray(v) ? v.length : 1;\n if (isMultiple) {\n return count + ` ${count == 1 ? \"item\" : \"items\"} selected`;\n }\n return <>{v}</>;\n },\n [isMultiple]\n );\n\n const dsSelectClassname = clsx(\n cls(\"select\", showSelectionSummary && \"select-selection-summary\"),\n className\n );\n\n const dsPopupClassName = clsx(\n cls(\n \"select-popup\",\n isMultiple && \"select-multiple\",\n enhancePositioner && \"select-popup-enhanced\"\n ),\n classNames?.popup?.root || popupClassName\n );\n const popupWidth =\n popupSize && typeof popupSize === \"string\" && popupSize in PopupPanelSize\n ? PopupPanelSize[popupSize as keyof typeof PopupPanelSize]\n : typeof popupSize === \"number\"\n ? popupSize + \"px\"\n : popupSize || \"fit-content\";\n const customRenderMenu = useCallback(\n (menu: React.ReactElement) => {\n const renderedMenu = popupRender\n ? popupRender(menu)\n : dropdownRender\n ? dropdownRender(menu)\n : menu;\n if (!showSelectAll) return renderedMenu;\n const checked = Array.isArray(value) && value.length > 0;\n const allValues = Array.isArray(options)\n ? options.map((option) => option.value)\n : (value as any).map((v: any) => v.value);\n const indeterminate =\n Array.isArray(value) && value.length && value.length < options.length;\n return (\n <>\n <SelectItem\n className={cls(\n \"select-item\",\n \"select-item-option\",\n checked && \"select-item-option-selected\",\n \"select-item-option-active\"\n )}\n onMouseOver={(e) => {}}\n selectAllRender={selectAllRender}\n checked={checked}\n indeterminate={indeterminate}\n onSelectAll={() => onChange(allValues)}\n onDeselectAll={() => onChange([] as ValueType)}\n />\n <Divider />\n {renderedMenu}\n </>\n );\n },\n [\n popupRender,\n dropdownRender,\n showSelectAll,\n value,\n options,\n cls,\n selectAllRender,\n onChange,\n ]\n );\n return (\n <AntSelect\n // ref={ref}\n ref={(node) => {\n if (ref) {\n if (typeof ref == \"function\") {\n ref(node);\n } else {\n ref.current = node;\n }\n }\n if (!node) return;\n refs.setReference(node?.nativeElement as HTMLElement);\n }}\n suffixIcon={<CaretDown weight=\"bold\" />}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onChange={onChange}\n // for old version\n popupClassName={dsPopupClassName}\n classNames={{\n popup: {\n root: dsPopupClassName,\n },\n ...classNames,\n }}\n {...(isMultiple\n ? {\n menuItemSelectedIcon: ({ isSelected }) => (\n <span className=\"ant-select-checkbox-indicator\">\n {isSelected ? (\n <Checkbox checked />\n ) : (\n <Checkbox checked={false} />\n )}\n </span>\n ),\n }\n : {})}\n mode={mode}\n className={dsSelectClassname}\n styles={\n enhancePositioner\n ? toMerged(styles, {\n popup: {\n root: {\n transition: \"none\",\n ...floatingStyles,\n \"--ds-select-popup-width\": popupWidth,\n } as CSSProperties,\n },\n })\n : styles\n }\n getPopupContainer={\n getPopupContainer ||\n (enhancePositioner ? () => portalNode || document.body : undefined)\n }\n popupRender={(menu) => {\n if (!enhancePositioner) {\n return customRenderMenu(menu);\n }\n return (\n <>\n <FloatingOverlay lockScroll onClick={() => setOpen(false)} />\n <div\n ref={(node) => {\n if (!node) return;\n const popupEl = node.closest(\n \".ds-select-dropdown\"\n ) as HTMLDivElement;\n refs.setFloating(popupEl);\n }}\n >\n {customRenderMenu(menu)}\n </div>\n </>\n );\n }}\n options={options}\n {...(showSelectionSummary\n ? {\n maxTagCount: 1,\n showSearch: false,\n labelRender: () => {\n if (selectionSummaryRender) {\n return selectionSummaryRender(value);\n }\n return defaultSelectionSummaryRender(value);\n },\n }\n : {})}\n {...rest}\n />\n );\n};\n\n// Use forwardRef with type assertion\nconst MainSelect = forwardRef(MainSelectInner) as <\n ValueType = unknown,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType\n>(\n props: SelectProps<ValueType, OptionType> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntSelect>>;\n }\n) => ReturnType<typeof MainSelectInner>;\n\nexport const Select = Object.assign(MainSelect, {\n Option: AntSelect.Option,\n OptGroup: AntSelect.OptGroup,\n});\n"],"names":["MainSelectInner","mode","className","openProp","defaultOpen","onOpenChange","popupClassName","onDropdownVisibleChange","enhancePositioner","getPopupContainer","popupSize","popupRender","dropdownRender","classNames","styles","showSelectionSummary","selectionSummaryRender","valueProp","onChangeProp","defaultValue","showSelectAll","selectAllRender","options","rest","ref","portalNode","useFloatingPortalNode","isMultiple","open","setOpen","useControlledState","cls","useCls","value","onChange","floatingStyles","refs","useFloating","offset","autoPlacement","shift","size","availableHeight","availableWidth","elements","autoUpdate","defaultSelectionSummaryRender","useCallback","v","count","dsSelectClassname","clsx","dsPopupClassName","_a","popupWidth","PopupPanelSize","customRenderMenu","menu","renderedMenu","checked","allValues","option","indeterminate","jsxs","Fragment","jsx","SelectItem","e","Divider","AntSelect","node","CaretDown","isSelected","Checkbox","toMerged","FloatingOverlay","popupEl","MainSelect","forwardRef","Select"],"mappings":";;;;;;;;;;;;;;;AAoFA,MAAMA,KAAkB,CAItB;AAAA,EACE,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAMC;AAAA,EACN,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC,IAAS,CAAC;AAAA,EACV,sBAAAC;AAAA,EACA,wBAA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Ac,SAAS,OAAO;AAAA,MAE3D,aAAa,CAACgC,MACPjD,IAKD,gBAAAuD,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAC,EAACU,MAAgB,YAAU,IAAC,SAAS,MAAM9C,EAAQ,EAAK,GAAG;AAAA,QAC3D,gBAAAoC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAK,CAACK,MAAS;AACb,kBAAI,CAACA,EAAM;AACX,oBAAMM,IAAUN,EAAK;AAAA,gBACnB;AAAA,cACF;AACA,cAAAlC,EAAK,YAAYwC,CAAO;AAAA,YAC1B;AAAA,YAEC,YAAiBnB,CAAI;AAAA,UAAA;AAAA,QAAA;AAAA,MACxB,GACF,IAhBOD,EAAiBC,CAAI;AAAA,MAmBhC,SAAAnC;AAAA,MACC,GAAIP,IACD;AAAA,QACE,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,aAAa,MACPC,IACKA,EAAuBiB,CAAK,IAE9Ba,EAA8Bb,CAAK;AAAA,MAC5C,IAEF,CAAC;AAAA,MACJ,GAAGV;AAAA,IAAA;AAAA,EACN;AAEJ,GAGMsD,KAAaC,GAAW9E,EAAe,GAShC+E,KAAS,OAAO,OAAOF,IAAY;AAAA,EAC9C,QAAQR,EAAU;AAAA,EAClB,UAAUA,EAAU;AACtB,CAAC;"}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/select/component.tsx"],"sourcesContent":["\"use client\";\nimport { CaretDown } from \"@bioturing/assets\";\nimport {\n autoPlacement,\n autoUpdate,\n FloatingOverlay,\n offset,\n shift,\n size,\n useFloating,\n useFloatingPortalNode,\n} from \"@floating-ui/react\";\nimport { default as Checkbox } from \"antd/es/checkbox\";\nimport {\n default as AntSelect,\n type SelectProps as AntSelectProps,\n type BaseOptionType,\n type DefaultOptionType,\n} from \"antd/es/select\";\nimport { toMerged } from \"es-toolkit\";\nimport React, { CSSProperties, forwardRef, useCallback } from \"react\";\nimport { useControlledState } from \"../hooks\";\nimport { PopupPanelSize } from \"../popup-panel/constants\";\nimport { clsx, useCls } from \"../utils\";\n\n// Import component-specific styles\nimport { Divider } from \"antd\";\nimport { CheckboxProps } from \"../checkbox\";\nimport { SelectItem } from \"./item\";\nimport \"./style.css\";\n\n// SelectItem component props\n\n// Define props interface extending Ant Design's SelectProps\nexport interface SelectProps<\n ValueType = unknown,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType\n> extends AntSelectProps<ValueType, OptionType> {\n /**\n * Whether to enhance the positioner using floating-ui\n * @default false\n */\n enhancePositioner?: boolean;\n /**\n * Size of the popup panel\n * Will be ignored if enhancePositioner is false\n */\n popupSize?: string | number | PopupPanelSize;\n /**\n * Show selection summary instead of tags in multiple case\n * @default false\n */\n showSelectionSummary?: boolean;\n /**\n * Render function for the selection summary in multiple case\n * @default (value) => `${value.length} items selected`\n */\n selectionSummaryRender?: (value: ValueType) => React.ReactNode;\n /**\n * Show select all option when in multiple mode\n * @default false\n */\n showSelectAll?: boolean;\n /**\n * Render function for the select all option\n */\n selectAllRender?: (props: {\n onClick: () => void;\n checked: CheckboxProps[\"checked\"];\n indeterminate: CheckboxProps[\"indeterminate\"];\n }) => React.ReactNode;\n}\n\nexport type {\n BaseOptionType as SelectBaseOptionType,\n DefaultOptionType as SelectDefaultOptionType,\n};\n\n// Create inner function\nconst MainSelectInner = <\n ValueType = unknown,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType\n>(\n {\n mode,\n className,\n open: openProp,\n defaultOpen,\n onOpenChange,\n popupClassName,\n onDropdownVisibleChange,\n enhancePositioner,\n getPopupContainer,\n popupSize,\n popupRender,\n dropdownRender,\n classNames,\n styles = {},\n showSelectionSummary,\n selectionSummaryRender,\n value: valueProp,\n onChange: onChangeProp,\n defaultValue,\n showSelectAll,\n selectAllRender,\n options,\n ...rest\n }: SelectProps<ValueType, OptionType>,\n ref: React.Ref<React.ComponentRef<typeof AntSelect>>\n) => {\n const portalNode = useFloatingPortalNode({});\n const isMultiple = mode === \"multiple\" || mode === \"tags\";\n const [open, setOpen] = useControlledState(\n openProp,\n onOpenChange || onDropdownVisibleChange,\n defaultOpen\n );\n const cls = useCls();\n const [value, onChange] = useControlledState(\n valueProp,\n onChangeProp,\n defaultValue\n );\n // enhancePositioner\n const { floatingStyles, refs } = useFloating({\n placement: \"bottom-start\",\n transform: false,\n open: enhancePositioner && open,\n middleware: [\n offset({\n mainAxis: 4,\n }),\n autoPlacement({\n allowedPlacements: [\n \"bottom-start\",\n \"bottom-end\",\n \"bottom\",\n \"top-start\",\n \"top-end\",\n \"top\",\n ],\n }),\n shift({\n padding: 8,\n }),\n size({\n padding: 8,\n apply({ availableHeight, availableWidth, elements }) {\n // 2. Or, use a CSS variable:\n elements.floating.style.setProperty(\n \"--available-width\",\n availableWidth + \"px\"\n );\n elements.floating.style.setProperty(\n \"--available-height\",\n availableHeight + \"px\"\n );\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n const defaultSelectionSummaryRender = useCallback(\n (v: ValueType) => {\n const count = Array.isArray(v) ? v.length : 1;\n if (isMultiple) {\n return count + ` ${count == 1 ? \"item\" : \"items\"} selected`;\n }\n return <>{v}</>;\n },\n [isMultiple]\n );\n\n const dsSelectClassname = clsx(\n cls(\"select\", showSelectionSummary && \"select-selection-summary\"),\n className\n );\n\n const dsPopupClassName = clsx(\n cls(\n \"select-popup\",\n isMultiple && \"select-multiple\",\n enhancePositioner && \"select-popup-enhanced\"\n ),\n classNames?.popup?.root || popupClassName\n );\n const popupWidth =\n popupSize && typeof popupSize === \"string\" && popupSize in PopupPanelSize\n ? PopupPanelSize[popupSize as keyof typeof PopupPanelSize]\n : typeof popupSize === \"number\"\n ? popupSize + \"px\"\n : popupSize || \"fit-content\";\n const customRenderMenu = useCallback(\n (menu: React.ReactElement) => {\n const renderedMenu = popupRender\n ? popupRender(menu)\n : dropdownRender\n ? dropdownRender(menu)\n : menu;\n if (!showSelectAll) return renderedMenu;\n const checked = Array.isArray(value) && value.length > 0;\n const allValues = Array.isArray(options)\n ? options.map((option) => option.value)\n : (value as any).map((v: any) => v.value);\n const indeterminate =\n Array.isArray(value) && value.length && value.length < options.length;\n return (\n <>\n <SelectItem\n className={cls(\n \"select-item\",\n \"select-item-option\",\n checked && \"select-item-option-selected\",\n \"select-item-option-active\"\n )}\n onMouseOver={(e) => {}}\n selectAllRender={selectAllRender}\n checked={checked}\n indeterminate={indeterminate}\n onSelectAll={() => onChange(allValues)}\n onDeselectAll={() => onChange([] as ValueType)}\n />\n <Divider />\n {renderedMenu}\n </>\n );\n },\n [\n popupRender,\n dropdownRender,\n showSelectAll,\n value,\n options,\n cls,\n selectAllRender,\n onChange,\n ]\n );\n return (\n <AntSelect\n // ref={ref}\n ref={(node) => {\n if (ref) {\n if (typeof ref == \"function\") {\n ref(node);\n } else {\n ref.current = node;\n }\n }\n if (!node) return;\n refs.setReference(node?.nativeElement as HTMLElement);\n }}\n suffixIcon={<CaretDown weight=\"bold\" />}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onChange={onChange}\n // for old version\n popupClassName={dsPopupClassName}\n classNames={{\n popup: {\n root: dsPopupClassName,\n },\n ...classNames,\n }}\n {...(isMultiple\n ? {\n menuItemSelectedIcon: ({ isSelected }) => (\n <span className=\"ant-select-checkbox-indicator\">\n {isSelected ? (\n <Checkbox checked />\n ) : (\n <Checkbox checked={false} />\n )}\n </span>\n ),\n }\n : {})}\n mode={mode}\n className={dsSelectClassname}\n styles={\n enhancePositioner\n ? toMerged(styles, {\n popup: {\n root: {\n transition: \"none\",\n ...floatingStyles,\n \"--ds-select-popup-width\": popupWidth,\n } as CSSProperties,\n },\n })\n : styles\n }\n getPopupContainer={\n getPopupContainer ||\n (enhancePositioner ? () => portalNode || document.body : undefined)\n }\n popupRender={(menu) => {\n if (!enhancePositioner) {\n return customRenderMenu(menu);\n }\n return (\n <>\n <FloatingOverlay lockScroll onClick={() => setOpen(false)} />\n <div\n ref={(node) => {\n if (!node) return;\n const popupEl = node.closest(\n \".ds-select-dropdown\"\n ) as HTMLDivElement;\n refs.setFloating(popupEl);\n }}\n >\n {customRenderMenu(menu)}\n </div>\n </>\n );\n }}\n options={options}\n {...(showSelectionSummary\n ? {\n maxTagCount: 1,\n showSearch: false,\n labelRender: () => {\n if (selectionSummaryRender) {\n return selectionSummaryRender(value);\n }\n return defaultSelectionSummaryRender(value);\n },\n }\n : {})}\n {...rest}\n />\n );\n};\n\n// Use forwardRef with type assertion\nconst MainSelect = forwardRef(MainSelectInner) as <\n ValueType = unknown,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType\n>(\n props: SelectProps<ValueType, OptionType> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntSelect>>;\n }\n) => ReturnType<typeof MainSelectInner>;\n\nexport const Select = Object.assign(MainSelect, {\n Option: AntSelect.Option,\n OptGroup: AntSelect.OptGroup,\n});\n"],"names":["MainSelectInner","mode","className","openProp","defaultOpen","onOpenChange","popupClassName","onDropdownVisibleChange","enhancePositioner","getPopupContainer","popupSize","popupRender","dropdownRender","classNames","styles","showSelectionSummary","selectionSummaryRender","valueProp","onChangeProp","defaultValue","showSelectAll","selectAllRender","options","rest","ref","portalNode","useFloatingPortalNode","isMultiple","open","setOpen","useControlledState","cls","useCls","value","onChange","floatingStyles","refs","useFloating","offset","autoPlacement","shift","size","availableHeight","availableWidth","elements","autoUpdate","defaultSelectionSummaryRender","useCallback","v","count","dsSelectClassname","clsx","dsPopupClassName","_a","popupWidth","PopupPanelSize","customRenderMenu","menu","renderedMenu","checked","allValues","option","indeterminate","jsxs","Fragment","jsx","SelectItem","e","Divider","AntSelect","node","CaretDown","isSelected","Checkbox","toMerged","FloatingOverlay","popupEl","MainSelect","forwardRef","Select"],"mappings":";;;;;;;;;;;;;;;AA+EA,MAAMA,KAAkB,CAItB;AAAA,EACE,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAMC;AAAA,EACN,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,yBAAA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