@lobehub/ui 4.36.1 → 4.36.3
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/es/Accordion/Accordion.d.mts +2 -2
- package/es/Accordion/AccordionItem.d.mts +2 -2
- package/es/ActionIcon/ActionIcon.d.mts +2 -2
- package/es/Alert/Alert.d.mts +2 -2
- package/es/AutoComplete/Select.d.mts +2 -2
- package/es/Avatar/AvatarGroup/index.d.mts +2 -2
- package/es/Burger/Burger.d.mts +2 -2
- package/es/CodeDiff/CodeDiff.d.mts +2 -2
- package/es/CodeDiff/PatchDiff.d.mts +2 -2
- package/es/CodeEditor/CodeEditor.d.mts +2 -2
- package/es/Collapse/Collapse.d.mts +2 -2
- package/es/ConfigProvider/index.d.mts +2 -2
- package/es/ContextMenu/ContextMenuHost.d.mts +2 -2
- package/es/ContextMenu/ContextMenuHost.mjs +1 -1
- package/es/ContextMenu/ContextMenuHost.mjs.map +1 -1
- package/es/CopyButton/CopyButton.d.mts +2 -2
- package/es/DatePicker/DatePicker.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
- package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
- package/es/Drawer/Drawer.d.mts +2 -2
- package/es/Dropdown/Dropdown.d.mts +2 -2
- package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
- package/es/DropdownMenu/atoms.d.mts +19 -20
- package/es/DropdownMenu/atoms.mjs +1 -2
- package/es/DropdownMenu/atoms.mjs.map +1 -1
- package/es/DropdownMenu/index.d.mts +2 -2
- package/es/DropdownMenu/index.mjs +2 -2
- package/es/EditableText/EditableText.d.mts +2 -2
- package/es/EditorSlashMenu/atoms.d.mts +14 -15
- package/es/EditorSlashMenu/atoms.mjs +1 -2
- package/es/EditorSlashMenu/atoms.mjs.map +1 -1
- package/es/EditorSlashMenu/index.d.mts +2 -2
- package/es/EditorSlashMenu/index.mjs +2 -2
- package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
- package/es/Flex/FlexBasic.d.mts +2 -2
- package/es/FontLoader/index.d.mts +2 -2
- package/es/Footer/Footer.d.mts +2 -2
- package/es/Form/components/FormGroup.d.mts +2 -2
- package/es/Form/components/FormItem.d.mts +2 -2
- package/es/Form/components/FormSubmitFooter.d.mts +2 -2
- package/es/FormModal/FormModal.d.mts +2 -2
- package/es/Freeze/Freeze.d.mts +2 -2
- package/es/GuideCard/GuideCard.d.mts +2 -2
- package/es/Header/Header.d.mts +2 -2
- package/es/Highlighter/Highlighter.d.mts +2 -2
- package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
- package/es/Hotkey/Hotkey.d.mts +2 -2
- package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
- package/es/Icon/Icon.d.mts +2 -2
- package/es/Icon/components/IconProvider.d.mts +3 -3
- package/es/Image/PreviewGroup.d.mts +2 -2
- package/es/Input/Input.d.mts +2 -2
- package/es/Input/InputNumber.d.mts +2 -2
- package/es/Input/InputOPT.d.mts +2 -2
- package/es/Input/InputPassword.d.mts +2 -2
- package/es/Input/TextArea.d.mts +2 -2
- package/es/Layout/components/LayoutFooter.d.mts +2 -2
- package/es/Layout/components/LayoutHeader.d.mts +2 -2
- package/es/Layout/components/LayoutMain.d.mts +2 -2
- package/es/Layout/components/LayoutSidebar.d.mts +2 -2
- package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
- package/es/Layout/components/LayoutToc.d.mts +2 -2
- package/es/List/ListItem/index.d.mts +2 -2
- package/es/LobeSelect/LobeSelect.d.mts +2 -2
- package/es/LobeSelect/LobeSelect.mjs +50 -45
- package/es/LobeSelect/LobeSelect.mjs.map +1 -1
- package/es/LobeSelect/atoms.d.mts +19 -20
- package/es/LobeSelect/atoms.mjs +0 -1
- package/es/LobeSelect/atoms.mjs.map +1 -1
- package/es/LobeSelect/index.d.mts +1 -2
- package/es/LobeSelect/index.mjs +1 -2
- package/es/LobeSwitch/LobeSwitch.d.mts +2 -2
- package/es/LobeSwitch/atoms.d.mts +4 -4
- package/es/Markdown/Markdown.d.mts +2 -2
- package/es/Markdown/Typography.d.mts +2 -2
- package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
- package/es/MaskShadow/MaskShadow.d.mts +2 -2
- package/es/Menu/Menu.d.mts +2 -2
- package/es/Mermaid/Mermaid.d.mts +2 -2
- package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
- package/es/Modal/Modal.d.mts +2 -2
- package/es/Modal/ModalProvider.d.mts +2 -2
- package/es/Modal/imperative.d.mts +2 -2
- package/es/MotionProvider/index.d.mts +2 -2
- package/es/Popover/ArrowIcon.d.mts +2 -2
- package/es/Popover/PopoverPortal.d.mts +1 -2
- package/es/Popover/PopoverPortal.mjs +1 -2
- package/es/Popover/PopoverPortal.mjs.map +1 -1
- package/es/Popover/atoms.d.mts +9 -9
- package/es/Popover/context.d.mts +2 -2
- package/es/Popover/index.d.mts +2 -2
- package/es/Popover/index.mjs +2 -2
- package/es/ScrollArea/atoms.d.mts +7 -7
- package/es/SearchBar/SearchBar.d.mts +2 -2
- package/es/Segmented/Segmented.d.mts +2 -2
- package/es/Select/Select.d.mts +2 -2
- package/es/SideNav/SideNav.d.mts +2 -2
- package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
- package/es/SortableList/components/DragHandle.d.mts +2 -2
- package/es/SortableList/components/SortableItem.d.mts +2 -2
- package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
- package/es/Toast/imperative.d.mts +4 -5
- package/es/Toast/imperative.mjs +14 -10
- package/es/Toast/imperative.mjs.map +1 -1
- package/es/Toast/index.d.mts +2 -2
- package/es/Toast/index.mjs +2 -2
- package/es/Toc/Toc.d.mts +2 -2
- package/es/Video/index.d.mts +2 -2
- package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
- package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
- package/es/awesome/Features/Features.d.mts +2 -2
- package/es/awesome/Giscus/Giscus.d.mts +2 -2
- package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
- package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
- package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
- package/es/awesome/Hero/Hero.d.mts +2 -2
- package/es/awesome/Spline/Spine.d.mts +2 -2
- package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
- package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
- package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
- package/es/brand/LobeChat/index.d.mts +2 -2
- package/es/brand/LobeHub/index.d.mts +2 -2
- package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
- package/es/brand/LogoThree/index.d.mts +2 -2
- package/es/chat/BackBottom/BackBottom.d.mts +2 -2
- package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
- package/es/chat/ChatItem/ChatItem.d.mts +2 -2
- package/es/chat/ChatList/ChatList.d.mts +2 -2
- package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
- package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
- package/es/chat/MessageInput/MessageInput.d.mts +2 -2
- package/es/chat/MessageModal/MessageModal.d.mts +2 -2
- package/es/color/ColorScales/index.d.mts +2 -2
- package/es/color/CssVar/index.d.mts +2 -2
- package/es/i18n/context.d.mts +2 -2
- package/es/icons/lucideExtra/GroupBotIcon.d.mts +3 -3
- package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
- package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +3 -3
- package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +3 -3
- package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
- package/es/index.d.mts +3 -4
- package/es/index.mjs +3 -4
- package/es/mdx/Mdx/index.d.mts +2 -2
- package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
- package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
- package/es/mobile/TabBar/TabBar.d.mts +2 -2
- package/es/storybook/StoryBook/index.d.mts +2 -2
- package/package.json +1 -1
- package/es/LobeSelect/constants.d.mts +0 -5
- package/es/LobeSelect/constants.mjs +0 -6
- package/es/LobeSelect/constants.mjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useAppElement } from "../ThemeProvider/AppElementContext.mjs";
|
|
3
4
|
import Icon_default from "../Icon/Icon.mjs";
|
|
4
5
|
import { styles } from "../Menu/sharedStyle.mjs";
|
|
5
6
|
import { styles as styles$1, triggerVariants } from "./style.mjs";
|
|
@@ -453,6 +454,7 @@ const LobeSelect = memo(({ allowClear, autoFocus, className, classNames, default
|
|
|
453
454
|
})]
|
|
454
455
|
}, `${String(item.value)}-${currentIndex}`);
|
|
455
456
|
});
|
|
457
|
+
const appElement = useAppElement();
|
|
456
458
|
return /* @__PURE__ */ jsxs(Select.Root, {
|
|
457
459
|
disabled,
|
|
458
460
|
id,
|
|
@@ -495,53 +497,56 @@ const LobeSelect = memo(({ allowClear, autoFocus, className, classNames, default
|
|
|
495
497
|
})]
|
|
496
498
|
})
|
|
497
499
|
]
|
|
498
|
-
}), /* @__PURE__ */ jsx(Select.Portal, {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
className: cx(styles$1.
|
|
509
|
-
children: /* @__PURE__ */ jsx("
|
|
510
|
-
className: styles$1.
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
const content = filteredOptions.length > 0 ? renderOptions(filteredOptions) : /* @__PURE__ */ jsx("div", {
|
|
518
|
-
className: cx(styles.item, styles.empty, styles$1.empty, classNames?.empty),
|
|
519
|
-
children: "No data"
|
|
520
|
-
});
|
|
521
|
-
if (!virtual || filteredOptions.length === 0) return /* @__PURE__ */ jsx(Select.List, {
|
|
522
|
-
className: cx(styles$1.list, classNames?.list),
|
|
523
|
-
"data-virtual": virtual || void 0,
|
|
524
|
-
children: content
|
|
525
|
-
});
|
|
526
|
-
return /* @__PURE__ */ jsx(Select.List, {
|
|
527
|
-
className: cx(styles$1.list, classNames?.list),
|
|
528
|
-
"data-virtual": virtual || void 0,
|
|
529
|
-
ref: listRef,
|
|
530
|
-
style: virtualListStyle,
|
|
531
|
-
tabIndex: virtual ? -1 : void 0,
|
|
532
|
-
onPointerDown: virtual ? markPointerScroll : void 0,
|
|
533
|
-
onScroll: virtual ? handleListScroll : void 0,
|
|
534
|
-
onTouchMove: virtual ? markPointerScroll : void 0,
|
|
535
|
-
onWheel: virtual ? markPointerScroll : void 0,
|
|
536
|
-
children: /* @__PURE__ */ jsx(Virtualizer, {
|
|
537
|
-
itemSize: listItemHeight,
|
|
538
|
-
keepMounted: keepMountedIndices,
|
|
539
|
-
children: content
|
|
500
|
+
}), /* @__PURE__ */ jsx(Select.Portal, {
|
|
501
|
+
container: appElement,
|
|
502
|
+
children: /* @__PURE__ */ jsx(Select.Positioner, {
|
|
503
|
+
align: "start",
|
|
504
|
+
alignItemWithTrigger: isItemAligned,
|
|
505
|
+
className: styles$1.positioner,
|
|
506
|
+
side: "bottom",
|
|
507
|
+
sideOffset: 6,
|
|
508
|
+
children: /* @__PURE__ */ jsxs(Select.Popup, {
|
|
509
|
+
style: popupStyle,
|
|
510
|
+
className: cx(styles.popup, styles$1.popup, popupClassName, classNames?.popup, classNames?.dropdown),
|
|
511
|
+
children: [shouldShowSearch && /* @__PURE__ */ jsx("div", {
|
|
512
|
+
className: cx(styles$1.search, classNames?.search),
|
|
513
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
514
|
+
className: styles$1.searchInput,
|
|
515
|
+
placeholder: typeof placeholder === "string" ? placeholder : void 0,
|
|
516
|
+
value: searchValue,
|
|
517
|
+
onChange: handleSearchChange,
|
|
518
|
+
onKeyDown: handleSearchKeyDown
|
|
540
519
|
})
|
|
541
|
-
})
|
|
542
|
-
|
|
520
|
+
}), (() => {
|
|
521
|
+
const content = filteredOptions.length > 0 ? renderOptions(filteredOptions) : /* @__PURE__ */ jsx("div", {
|
|
522
|
+
className: cx(styles.item, styles.empty, styles$1.empty, classNames?.empty),
|
|
523
|
+
children: "No data"
|
|
524
|
+
});
|
|
525
|
+
if (!virtual || filteredOptions.length === 0) return /* @__PURE__ */ jsx(Select.List, {
|
|
526
|
+
className: cx(styles$1.list, classNames?.list),
|
|
527
|
+
"data-virtual": virtual || void 0,
|
|
528
|
+
children: content
|
|
529
|
+
});
|
|
530
|
+
return /* @__PURE__ */ jsx(Select.List, {
|
|
531
|
+
className: cx(styles$1.list, classNames?.list),
|
|
532
|
+
"data-virtual": virtual || void 0,
|
|
533
|
+
ref: listRef,
|
|
534
|
+
style: virtualListStyle,
|
|
535
|
+
tabIndex: virtual ? -1 : void 0,
|
|
536
|
+
onPointerDown: virtual ? markPointerScroll : void 0,
|
|
537
|
+
onScroll: virtual ? handleListScroll : void 0,
|
|
538
|
+
onTouchMove: virtual ? markPointerScroll : void 0,
|
|
539
|
+
onWheel: virtual ? markPointerScroll : void 0,
|
|
540
|
+
children: /* @__PURE__ */ jsx(Virtualizer, {
|
|
541
|
+
itemSize: listItemHeight,
|
|
542
|
+
keepMounted: keepMountedIndices,
|
|
543
|
+
children: content
|
|
544
|
+
})
|
|
545
|
+
});
|
|
546
|
+
})()]
|
|
547
|
+
})
|
|
543
548
|
})
|
|
544
|
-
})
|
|
549
|
+
})]
|
|
545
550
|
});
|
|
546
551
|
});
|
|
547
552
|
LobeSelect.displayName = "LobeSelect";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LobeSelect.mjs","names":["mergedOptions: LobeSelectOptions","missingValueOptions: LobeSelectOption<any>[]","styles","option","content","Icon","baseStyle: React.CSSProperties","indices: number[]","menuStyles","currentIndex"],"sources":["../../src/LobeSelect/LobeSelect.tsx"],"sourcesContent":["'use client';\n\nimport { Select } from '@base-ui/react/select';\nimport { cx, useThemeMode } from 'antd-style';\nimport { Check, ChevronDown, Loader2, X } from 'lucide-react';\nimport {\n type ChangeEvent,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type MutableRefObject,\n type Ref,\n} from 'react';\nimport { isValidElement, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Virtualizer } from 'virtua';\n\nimport Icon from '@/Icon';\nimport { styles as menuStyles } from '@/Menu/sharedStyle';\n\nimport { styles, triggerVariants } from './style';\nimport {\n type LobeSelectOption,\n type LobeSelectOptionGroup,\n type LobeSelectOptions,\n type LobeSelectProps,\n} from './type';\n\nconst isGroupOption = <Value,>(\n option: LobeSelectOption<Value> | LobeSelectOptionGroup<Value>,\n): option is LobeSelectOptionGroup<Value> =>\n Boolean((option as LobeSelectOptionGroup<Value>).options);\n\nconst getOptionSearchText = <Value,>(option: LobeSelectOption<Value>) => {\n if (typeof option.label === 'string' || typeof option.label === 'number') {\n return String(option.label);\n }\n if (typeof option.value === 'string' || typeof option.value === 'number') {\n return String(option.value);\n }\n if (option.title) return option.title;\n return '';\n};\n\nconst escapeRegExp = (value: string) => value.replaceAll(/[$()*+.?[\\\\\\]^{|}]/g, '\\\\$&');\n\nconst splitBySeparators = (value: string, separators?: string[]) => {\n if (!separators || separators.length === 0) return [value];\n const pattern = separators.map(escapeRegExp).join('|');\n return value.split(new RegExp(pattern, 'g'));\n};\n\nconst countVirtualItems = (items: LobeSelectOptions) =>\n items.reduce((count, item) => {\n if (isGroupOption(item)) {\n return count + item.options.length + 1;\n }\n return count + 1;\n }, 0);\n\nconst isValueEmpty = (value: unknown) => value === null || value === undefined || value === '';\n\nconst LobeSelect = memo<LobeSelectProps<any>>(\n ({\n allowClear,\n autoFocus,\n className,\n classNames,\n defaultOpen,\n defaultValue,\n disabled,\n id,\n labelRender,\n listHeight = 512,\n listItemHeight,\n loading,\n mode,\n name,\n onChange,\n onOpenChange,\n onSelect,\n open,\n optionRender,\n options,\n placeholder,\n popupClassName,\n popupMatchSelectWidth,\n prefix,\n readOnly,\n required,\n behaviorVariant = 'default',\n selectedIndicatorVariant = 'check',\n shadow,\n showSearch,\n size = 'middle',\n style,\n suffixIcon,\n suffixIconProps,\n tokenSeparators,\n value,\n variant,\n virtual,\n }) => {\n const { isDarkMode } = useThemeMode();\n const resolvedVariant = variant ?? (isDarkMode ? 'filled' : 'outlined');\n const isMultiple = mode === 'multiple' || mode === 'tags';\n const isItemAligned = behaviorVariant === 'item-aligned';\n\n const [uncontrolledValue, setUncontrolledValue] = useState<any>(() => {\n if (defaultValue !== undefined) return defaultValue;\n return isMultiple ? [] : null;\n });\n\n const normalizeValue = useCallback(\n (nextValue: any) => {\n if (isMultiple) {\n if (Array.isArray(nextValue)) return nextValue;\n if (nextValue === null || nextValue === undefined) return [];\n return [nextValue];\n }\n if (Array.isArray(nextValue)) return nextValue[0] ?? null;\n return nextValue === undefined ? null : nextValue;\n },\n [isMultiple],\n );\n\n const mergedValue = value !== undefined ? value : uncontrolledValue;\n const normalizedValue = useMemo(\n () => normalizeValue(mergedValue),\n [mergedValue, normalizeValue],\n );\n const valueArray = useMemo(\n () =>\n isMultiple\n ? (normalizedValue as any[])\n : isValueEmpty(normalizedValue)\n ? []\n : [normalizedValue],\n [isMultiple, normalizedValue],\n );\n\n const [extraOptions, setExtraOptions] = useState<LobeSelectOption<any>[]>([]);\n\n useEffect(() => {\n if (mode !== 'tags' && extraOptions.length > 0) {\n setExtraOptions([]);\n }\n }, [mode, extraOptions.length]);\n\n const { resolvedOptions, optionMap } = useMemo(() => {\n const baseOptions = options ?? [];\n const optionValueMap = new Map<any, LobeSelectOption<any>>();\n\n const addOption = (item: LobeSelectOption<any>) => {\n if (!optionValueMap.has(item.value)) {\n optionValueMap.set(item.value, item);\n }\n };\n\n const walkOptions = (items: LobeSelectOptions) => {\n items.forEach((item) => {\n if (isGroupOption(item)) {\n item.options.forEach(addOption);\n } else {\n addOption(item);\n }\n });\n };\n\n walkOptions(baseOptions);\n\n const filteredExtraOptions = extraOptions.filter((item) => !optionValueMap.has(item.value));\n filteredExtraOptions.forEach(addOption);\n\n const mergedOptions: LobeSelectOptions = [...baseOptions, ...filteredExtraOptions];\n\n const missingValueOptions: LobeSelectOption<any>[] = valueArray\n .filter((val) => !optionValueMap.has(val))\n .map((val) => ({\n label: String(val),\n value: val,\n }));\n missingValueOptions.forEach(addOption);\n\n return {\n optionMap: optionValueMap,\n resolvedOptions: missingValueOptions.length\n ? [...mergedOptions, ...missingValueOptions]\n : mergedOptions,\n };\n }, [extraOptions, options, valueArray]);\n\n const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));\n\n useEffect(() => {\n if (open !== undefined) {\n setUncontrolledOpen(open);\n }\n }, [open]);\n\n const mergedOpen = open ?? uncontrolledOpen;\n\n const handleOpenChange = useCallback(\n (nextOpen: boolean) => {\n onOpenChange?.(nextOpen);\n if (open === undefined) {\n setUncontrolledOpen(nextOpen);\n }\n },\n [onOpenChange, open],\n );\n\n const [searchValue, setSearchValue] = useState('');\n const shouldShowSearch = Boolean(showSearch || mode === 'tags');\n\n useEffect(() => {\n if (!mergedOpen) setSearchValue('');\n }, [mergedOpen]);\n\n const getOption = useCallback(\n (optionValue: any): LobeSelectOption<any> => {\n const matched = optionMap.get(optionValue);\n if (matched) return matched;\n if (optionValue && typeof optionValue === 'object' && 'label' in optionValue) {\n return {\n label: (optionValue as any).label,\n value: optionValue,\n };\n }\n return {\n label: String(optionValue),\n value: optionValue,\n };\n },\n [optionMap],\n );\n\n const previousValueRef = useRef<any>(normalizedValue);\n\n useEffect(() => {\n previousValueRef.current = normalizedValue;\n }, [normalizedValue]);\n\n const handleValueChange = useCallback(\n (nextValue: any) => {\n const normalizedNextValue = normalizeValue(nextValue);\n const previousValue = previousValueRef.current;\n\n if (isMultiple) {\n const prevValues = Array.isArray(previousValue) ? previousValue : [];\n const nextValues = Array.isArray(normalizedNextValue) ? normalizedNextValue : [];\n const addedValues = nextValues.filter(\n (val) => !prevValues.some((prev) => Object.is(prev, val)),\n );\n\n addedValues.forEach((val) => {\n onSelect?.(val, getOption(val));\n });\n\n if (value === undefined) {\n setUncontrolledValue(nextValues);\n }\n onChange?.(\n nextValues,\n nextValues.map((val) => getOption(val)),\n );\n } else {\n if (\n !isValueEmpty(normalizedNextValue) &&\n !Object.is(previousValue, normalizedNextValue)\n ) {\n onSelect?.(normalizedNextValue, getOption(normalizedNextValue));\n }\n if (value === undefined) {\n setUncontrolledValue(normalizedNextValue);\n }\n onChange?.(\n normalizedNextValue,\n isValueEmpty(normalizedNextValue) ? undefined : getOption(normalizedNextValue),\n );\n }\n\n previousValueRef.current = normalizedNextValue;\n },\n [getOption, isMultiple, normalizeValue, onChange, onSelect, value],\n );\n\n const appendTagValues = useCallback(\n (rawValues: string[]) => {\n const valuesToAdd = rawValues.map((val) => val.trim()).filter(Boolean);\n if (!valuesToAdd.length) return;\n\n const nextValues = [...valueArray];\n const newOptionValues = valuesToAdd.filter((val) => !optionMap.has(val));\n\n if (newOptionValues.length > 0) {\n setExtraOptions((prev) => {\n const existingValues = new Set(prev.map((item) => item.value));\n const merged = [...prev];\n newOptionValues.forEach((val) => {\n if (!existingValues.has(val)) {\n merged.push({ label: val, value: val });\n }\n });\n return merged;\n });\n }\n\n valuesToAdd.forEach((val) => {\n if (!nextValues.some((item) => Object.is(item, val))) {\n nextValues.push(val);\n }\n });\n\n if (nextValues.length !== valueArray.length) {\n handleValueChange(nextValues);\n }\n },\n [handleValueChange, optionMap, valueArray],\n );\n\n const handleSearchChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const nextValue = event.target.value;\n if (mode === 'tags') {\n const parts = splitBySeparators(nextValue, tokenSeparators);\n if (parts.length > 1) {\n const pending = parts.pop() ?? '';\n appendTagValues(parts.filter(Boolean));\n setSearchValue(pending);\n return;\n }\n }\n setSearchValue(nextValue);\n },\n [appendTagValues, mode, tokenSeparators],\n );\n\n const handleSearchKeyDown = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n event.stopPropagation();\n\n if (event.key === 'Escape') {\n handleOpenChange(false);\n return;\n }\n\n if (mode !== 'tags') return;\n\n if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n appendTagValues([searchValue]);\n setSearchValue('');\n return;\n }\n\n if (tokenSeparators?.includes(event.key)) {\n event.preventDefault();\n event.stopPropagation();\n appendTagValues([searchValue]);\n setSearchValue('');\n }\n },\n [appendTagValues, handleOpenChange, mode, searchValue, tokenSeparators],\n );\n\n const filteredOptions = useMemo(() => {\n if (!shouldShowSearch || !searchValue.trim()) return resolvedOptions;\n const query = searchValue.trim().toLowerCase();\n\n const filterItems = (items: LobeSelectOptions): LobeSelectOptions => {\n const filtered = items\n .map((item) => {\n if (isGroupOption(item)) {\n const groupItems = item.options.filter((option) =>\n getOptionSearchText(option).toLowerCase().includes(query),\n );\n if (!groupItems.length) return null;\n return { ...item, options: groupItems };\n }\n return getOptionSearchText(item).toLowerCase().includes(query) ? item : null;\n })\n .filter(Boolean) as LobeSelectOptions;\n\n return filtered;\n };\n\n return filterItems(resolvedOptions);\n }, [resolvedOptions, searchValue, shouldShowSearch]);\n\n const renderValue = useCallback(\n (currentValue: any) => {\n const resolved = normalizeValue(currentValue);\n const placeholderNode =\n placeholder === undefined ? null : (\n <span className={styles.valueText}>{placeholder}</span>\n );\n\n if (isMultiple) {\n const values = Array.isArray(resolved) ? resolved : [];\n if (values.length === 0) return placeholderNode;\n return (\n <span className={styles.tags}>\n {values.map((val, index) => {\n const option = getOption(val);\n const content = labelRender ? labelRender(option) : (option.label ?? String(val));\n return (\n <span className={styles.tag} key={`${String(val)}-${index}`}>\n {content}\n </span>\n );\n })}\n </span>\n );\n }\n\n if (isValueEmpty(resolved)) return placeholderNode;\n const option = getOption(resolved);\n const content = labelRender ? labelRender(option) : (option.label ?? String(resolved));\n return <span className={styles.valueText}>{content}</span>;\n },\n [getOption, isMultiple, labelRender, normalizeValue, placeholder],\n );\n\n const hasValue = isMultiple ? valueArray.length > 0 : !isValueEmpty(normalizedValue);\n const showClear = Boolean(allowClear && hasValue && !disabled && !readOnly);\n\n const handleClear = useCallback(\n (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n handleValueChange(isMultiple ? [] : null);\n },\n [handleValueChange, isMultiple],\n );\n\n const prefixNode = useMemo(() => {\n if (prefix === undefined || prefix === null) return null;\n if (isValidElement(prefix) || typeof prefix === 'string' || typeof prefix === 'number') {\n return prefix;\n }\n return <Icon icon={prefix as any} size={'small'} />;\n }, [prefix]);\n\n const suffixIconNode = useMemo(() => {\n if (loading) {\n return <Icon spin icon={Loader2} size={'small'} />;\n }\n if (suffixIcon === null) return null;\n if (\n isValidElement(suffixIcon) ||\n typeof suffixIcon === 'string' ||\n typeof suffixIcon === 'number'\n ) {\n return suffixIcon;\n }\n return (\n <Icon\n icon={(suffixIcon as any) || ChevronDown}\n size={'small'}\n {...suffixIconProps}\n style={{\n pointerEvents: 'none',\n ...suffixIconProps?.style,\n }}\n />\n );\n }, [loading, suffixIcon, suffixIconProps]);\n\n const popupStyle = useMemo(() => {\n const maxHeight = isItemAligned ? '80vh' : `${listHeight}px`;\n const baseStyle: React.CSSProperties = {\n maxHeight,\n maxWidth: 'var(--available-width)',\n minWidth: 'var(--anchor-width)',\n ['--lobe-select-popup-max-height' as any]: maxHeight,\n };\n\n if (popupMatchSelectWidth === undefined || popupMatchSelectWidth === true) {\n return baseStyle;\n }\n if (typeof popupMatchSelectWidth === 'number') {\n return {\n ...baseStyle,\n minWidth: popupMatchSelectWidth,\n width: popupMatchSelectWidth,\n };\n }\n return {\n ...baseStyle,\n minWidth: 'max-content',\n };\n }, [isItemAligned, listHeight, popupMatchSelectWidth]);\n\n const triggerClassName = cx(\n triggerVariants({ shadow, size, variant: resolvedVariant }),\n className,\n classNames?.root,\n classNames?.trigger,\n );\n\n const listRef = useRef<HTMLDivElement | null>(null);\n const pointerScrollRef = useRef(false);\n const pointerScrollTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const renderVirtualItem = useCallback((props: HTMLAttributes<HTMLDivElement>) => {\n const { ref, ...rest } = props as HTMLAttributes<HTMLDivElement> & {\n ref?: Ref<HTMLDivElement>;\n };\n\n return (\n <div\n {...rest}\n ref={(node) => {\n if (node) {\n node.scrollIntoView = (...args) => {\n if (!pointerScrollRef.current) {\n HTMLElement.prototype.scrollIntoView.call(node, ...args);\n }\n };\n }\n\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref && 'current' in ref) {\n (ref as MutableRefObject<HTMLDivElement | null>).current = node;\n }\n }}\n />\n );\n }, []);\n\n const markPointerScroll = useCallback(() => {\n pointerScrollRef.current = true;\n if (pointerScrollTimeoutRef.current) {\n clearTimeout(pointerScrollTimeoutRef.current);\n }\n pointerScrollTimeoutRef.current = setTimeout(() => {\n pointerScrollRef.current = false;\n }, 120);\n }, []);\n\n const handleListScroll = useCallback(() => {\n if (!virtual || !pointerScrollRef.current) return;\n const listElement = listRef.current;\n const activeElement = document.activeElement;\n if (listElement && activeElement && listElement.contains(activeElement)) {\n listElement.focus({ preventScroll: true });\n }\n }, [virtual]);\n\n useEffect(() => {\n return () => {\n if (pointerScrollTimeoutRef.current) {\n clearTimeout(pointerScrollTimeoutRef.current);\n }\n };\n }, []);\n const virtualListStyle = useMemo(() => {\n if (!virtual) return undefined;\n const rowCount = countVirtualItems(filteredOptions);\n const maxVisibleRows = 6;\n const estimatedRowHeight =\n listItemHeight ?? (size === 'large' ? 40 : size === 'small' ? 28 : 32);\n const visibleRows = Math.min(Math.max(rowCount, 1), maxVisibleRows);\n const estimatedHeight = visibleRows * estimatedRowHeight + 8;\n\n return {\n height: `min(${estimatedHeight}px, var(--lobe-select-available-height, var(--available-height)))`,\n };\n }, [filteredOptions, listItemHeight, size, virtual]);\n\n const keepMountedIndices = useMemo(() => {\n if (!virtual || valueArray.length === 0) return undefined;\n const selectedSet = new Set(valueArray);\n const indices: number[] = [];\n let index = 0;\n\n filteredOptions.forEach((item) => {\n if (isGroupOption(item)) {\n if (item.options.some((option) => selectedSet.has(option.value))) {\n indices.push(index);\n }\n index += 1;\n return;\n }\n\n if (selectedSet.has(item.value)) {\n indices.push(index);\n }\n index += 1;\n });\n\n return indices.length ? indices : undefined;\n }, [filteredOptions, valueArray, virtual]);\n\n const itemTextClassName = cx(\n optionRender ? menuStyles.itemContent : menuStyles.label,\n styles.itemText,\n classNames?.itemText,\n );\n\n const isBoldIndicator = selectedIndicatorVariant === 'bold';\n let optionIndex = 0;\n const renderOptions = (items: LobeSelectOptions) =>\n items.map((item, index) => {\n if (isGroupOption(item)) {\n return (\n <Select.Group className={cx(styles.group, classNames?.group)} key={`group-${index}`}>\n <Select.GroupLabel\n className={cx(menuStyles.groupLabel, styles.groupLabel, classNames?.groupLabel)}\n >\n {item.label}\n </Select.GroupLabel>\n {item.options.map((option) => {\n const currentIndex = optionIndex++;\n return (\n <Select.Item\n disabled={option.disabled}\n key={`${String(option.value)}-${currentIndex}`}\n label={getOptionSearchText(option)}\n render={virtual ? renderVirtualItem : undefined}\n value={option.value}\n className={cx(\n menuStyles.item,\n styles.item,\n isBoldIndicator && styles.itemBoldSelected,\n classNames?.item,\n classNames?.option,\n option.className,\n )}\n style={{\n minHeight: listItemHeight,\n ...option.style,\n }}\n >\n <Select.ItemText className={itemTextClassName}>\n {optionRender ? optionRender(option, { index: currentIndex }) : option.label}\n </Select.ItemText>\n {!isBoldIndicator && (\n <Select.ItemIndicator\n className={cx(styles.itemIndicator, classNames?.itemIndicator)}\n >\n <Icon icon={Check} size={'small'} />\n </Select.ItemIndicator>\n )}\n </Select.Item>\n );\n })}\n </Select.Group>\n );\n }\n\n const currentIndex = optionIndex++;\n return (\n <Select.Item\n disabled={item.disabled}\n key={`${String(item.value)}-${currentIndex}`}\n label={getOptionSearchText(item)}\n render={virtual ? renderVirtualItem : undefined}\n value={item.value}\n className={cx(\n menuStyles.item,\n styles.item,\n isBoldIndicator && styles.itemBoldSelected,\n classNames?.item,\n classNames?.option,\n item.className,\n )}\n style={{\n minHeight: listItemHeight,\n ...item.style,\n }}\n >\n <Select.ItemText className={itemTextClassName}>\n {optionRender ? optionRender(item, { index: currentIndex }) : item.label}\n </Select.ItemText>\n {!isBoldIndicator && (\n <Select.ItemIndicator className={cx(styles.itemIndicator, classNames?.itemIndicator)}>\n <Icon icon={Check} size={'small'} />\n </Select.ItemIndicator>\n )}\n </Select.Item>\n );\n });\n\n return (\n <Select.Root\n disabled={disabled}\n id={id}\n modal={isItemAligned}\n multiple={isMultiple}\n name={name}\n open={mergedOpen}\n readOnly={readOnly}\n required={required}\n value={normalizedValue}\n onOpenChange={handleOpenChange}\n onValueChange={handleValueChange}\n >\n <Select.Trigger\n autoFocus={autoFocus}\n className={triggerClassName}\n disabled={disabled}\n style={style}\n >\n {prefixNode !== null && prefixNode !== undefined && (\n <span className={cx(styles.prefix, classNames?.prefix)}>{prefixNode}</span>\n )}\n <Select.Value className={cx(styles.value, classNames?.value)}>{renderValue}</Select.Value>\n <span className={cx(styles.suffix, classNames?.suffix)}>\n {showClear && (\n <span\n className={cx(styles.clear, classNames?.clear)}\n data-role=\"lobe-select-clear\"\n onClick={handleClear}\n >\n <Icon icon={X} size={'small'} />\n </span>\n )}\n {suffixIconNode !== null && suffixIconNode !== undefined && (\n <Select.Icon className={cx(styles.icon, classNames?.icon)}>\n {suffixIconNode}\n </Select.Icon>\n )}\n </span>\n </Select.Trigger>\n\n <Select.Portal>\n <Select.Positioner\n align=\"start\"\n alignItemWithTrigger={isItemAligned}\n className={styles.positioner}\n side=\"bottom\"\n sideOffset={6}\n >\n <Select.Popup\n style={popupStyle}\n className={cx(\n menuStyles.popup,\n styles.popup,\n popupClassName,\n classNames?.popup,\n classNames?.dropdown,\n )}\n >\n {shouldShowSearch && (\n <div className={cx(styles.search, classNames?.search)}>\n <input\n className={styles.searchInput}\n placeholder={typeof placeholder === 'string' ? placeholder : undefined}\n value={searchValue}\n onChange={handleSearchChange}\n onKeyDown={handleSearchKeyDown}\n />\n </div>\n )}\n {(() => {\n const content =\n filteredOptions.length > 0 ? (\n renderOptions(filteredOptions)\n ) : (\n <div\n className={cx(\n menuStyles.item,\n menuStyles.empty,\n styles.empty,\n classNames?.empty,\n )}\n >\n No data\n </div>\n );\n\n if (!virtual || filteredOptions.length === 0) {\n return (\n <Select.List\n className={cx(styles.list, classNames?.list)}\n data-virtual={virtual || undefined}\n >\n {content}\n </Select.List>\n );\n }\n\n return (\n <Select.List\n className={cx(styles.list, classNames?.list)}\n data-virtual={virtual || undefined}\n ref={listRef}\n style={virtualListStyle}\n tabIndex={virtual ? -1 : undefined}\n onPointerDown={virtual ? markPointerScroll : undefined}\n onScroll={virtual ? handleListScroll : undefined}\n onTouchMove={virtual ? markPointerScroll : undefined}\n onWheel={virtual ? markPointerScroll : undefined}\n >\n <Virtualizer itemSize={listItemHeight} keepMounted={keepMountedIndices}>\n {content}\n </Virtualizer>\n </Select.List>\n );\n })()}\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n );\n },\n);\n\nLobeSelect.displayName = 'LobeSelect';\n\nexport default LobeSelect;\n"],"mappings":";;;;;;;;;;;;;AA2BA,MAAM,iBACJ,WAEA,QAAS,OAAwC,QAAQ;AAE3D,MAAM,uBAA+B,WAAoC;AACvE,KAAI,OAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAAU,SAC9D,QAAO,OAAO,OAAO,MAAM;AAE7B,KAAI,OAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAA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MAAK;GACL,YAAY;aAEZ,qBAAC,OAAO;IACN,OAAO;IACP,WAAW,GACTM,OAAW,OACXN,SAAO,OACP,gBACA,YAAY,OACZ,YAAY,SACb;eAEA,oBACC,oBAAC;KAAI,WAAW,GAAGA,SAAO,QAAQ,YAAY,OAAO;eACnD,oBAAC;MACC,WAAWA,SAAO;MAClB,aAAa,OAAO,gBAAgB,WAAW,cAAc;MAC7D,OAAO;MACP,UAAU;MACV,WAAW;OACX;MACE,SAEA;KACN,MAAM,UACJ,gBAAgB,SAAS,IACvB,cAAc,gBAAgB,GAE9B,oBAAC;MACC,WAAW,GACTM,OAAW,MACXA,OAAW,OACXN,SAAO,OACP,YAAY,MACb;gBACF;OAEK;AAGV,SAAI,CAAC,WAAW,gBAAgB,WAAW,EACzC,QACE,oBAAC,OAAO;MACN,WAAW,GAAGA,SAAO,MAAM,YAAY,KAAK;MAC5C,gBAAc,WAAW;gBAExB;OACW;AAIlB,YACE,oBAAC,OAAO;MACN,WAAW,GAAGA,SAAO,MAAM,YAAY,KAAK;MAC5C,gBAAc,WAAW;MACzB,KAAK;MACL,OAAO;MACP,UAAU,UAAU,KAAK;MACzB,eAAe,UAAU,oBAAoB;MAC7C,UAAU,UAAU,mBAAmB;MACvC,aAAa,UAAU,oBAAoB;MAC3C,SAAS,UAAU,oBAAoB;gBAEvC,oBAAC;OAAY,UAAU;OAAgB,aAAa;iBACjD;QACW;OACF;QAEd;KACS;IACG,GACN;GACJ;EAGnB;AAED,WAAW,cAAc;AAEzB,yBAAe"}
|
|
1
|
+
{"version":3,"file":"LobeSelect.mjs","names":["mergedOptions: LobeSelectOptions","missingValueOptions: LobeSelectOption<any>[]","styles","option","content","Icon","baseStyle: React.CSSProperties","indices: number[]","menuStyles","currentIndex"],"sources":["../../src/LobeSelect/LobeSelect.tsx"],"sourcesContent":["'use client';\n\nimport { Select } from '@base-ui/react/select';\nimport { cx, useThemeMode } from 'antd-style';\nimport { Check, ChevronDown, Loader2, X } from 'lucide-react';\nimport {\n type ChangeEvent,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type MutableRefObject,\n type Ref,\n} from 'react';\nimport { isValidElement, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Virtualizer } from 'virtua';\n\nimport Icon from '@/Icon';\nimport { styles as menuStyles } from '@/Menu/sharedStyle';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { styles, triggerVariants } from './style';\nimport {\n type LobeSelectOption,\n type LobeSelectOptionGroup,\n type LobeSelectOptions,\n type LobeSelectProps,\n} from './type';\n\nconst isGroupOption = <Value,>(\n option: LobeSelectOption<Value> | LobeSelectOptionGroup<Value>,\n): option is LobeSelectOptionGroup<Value> =>\n Boolean((option as LobeSelectOptionGroup<Value>).options);\n\nconst getOptionSearchText = <Value,>(option: LobeSelectOption<Value>) => {\n if (typeof option.label === 'string' || typeof option.label === 'number') {\n return String(option.label);\n }\n if (typeof option.value === 'string' || typeof option.value === 'number') {\n return String(option.value);\n }\n if (option.title) return option.title;\n return '';\n};\n\nconst escapeRegExp = (value: string) => value.replaceAll(/[$()*+.?[\\\\\\]^{|}]/g, '\\\\$&');\n\nconst splitBySeparators = (value: string, separators?: string[]) => {\n if (!separators || separators.length === 0) return [value];\n const pattern = separators.map(escapeRegExp).join('|');\n return value.split(new RegExp(pattern, 'g'));\n};\n\nconst countVirtualItems = (items: LobeSelectOptions) =>\n items.reduce((count, item) => {\n if (isGroupOption(item)) {\n return count + item.options.length + 1;\n }\n return count + 1;\n }, 0);\n\nconst isValueEmpty = (value: unknown) => value === null || value === undefined || value === '';\n\nconst LobeSelect = memo<LobeSelectProps<any>>(\n ({\n allowClear,\n autoFocus,\n className,\n classNames,\n defaultOpen,\n defaultValue,\n disabled,\n id,\n labelRender,\n listHeight = 512,\n listItemHeight,\n loading,\n mode,\n name,\n onChange,\n onOpenChange,\n onSelect,\n open,\n optionRender,\n options,\n placeholder,\n popupClassName,\n popupMatchSelectWidth,\n prefix,\n readOnly,\n required,\n behaviorVariant = 'default',\n selectedIndicatorVariant = 'check',\n shadow,\n showSearch,\n size = 'middle',\n style,\n suffixIcon,\n suffixIconProps,\n tokenSeparators,\n value,\n variant,\n virtual,\n }) => {\n const { isDarkMode } = useThemeMode();\n const resolvedVariant = variant ?? (isDarkMode ? 'filled' : 'outlined');\n const isMultiple = mode === 'multiple' || mode === 'tags';\n const isItemAligned = behaviorVariant === 'item-aligned';\n\n const [uncontrolledValue, setUncontrolledValue] = useState<any>(() => {\n if (defaultValue !== undefined) return defaultValue;\n return isMultiple ? [] : null;\n });\n\n const normalizeValue = useCallback(\n (nextValue: any) => {\n if (isMultiple) {\n if (Array.isArray(nextValue)) return nextValue;\n if (nextValue === null || nextValue === undefined) return [];\n return [nextValue];\n }\n if (Array.isArray(nextValue)) return nextValue[0] ?? null;\n return nextValue === undefined ? null : nextValue;\n },\n [isMultiple],\n );\n\n const mergedValue = value !== undefined ? value : uncontrolledValue;\n const normalizedValue = useMemo(\n () => normalizeValue(mergedValue),\n [mergedValue, normalizeValue],\n );\n const valueArray = useMemo(\n () =>\n isMultiple\n ? (normalizedValue as any[])\n : isValueEmpty(normalizedValue)\n ? []\n : [normalizedValue],\n [isMultiple, normalizedValue],\n );\n\n const [extraOptions, setExtraOptions] = useState<LobeSelectOption<any>[]>([]);\n\n useEffect(() => {\n if (mode !== 'tags' && extraOptions.length > 0) {\n setExtraOptions([]);\n }\n }, [mode, extraOptions.length]);\n\n const { resolvedOptions, optionMap } = useMemo(() => {\n const baseOptions = options ?? [];\n const optionValueMap = new Map<any, LobeSelectOption<any>>();\n\n const addOption = (item: LobeSelectOption<any>) => {\n if (!optionValueMap.has(item.value)) {\n optionValueMap.set(item.value, item);\n }\n };\n\n const walkOptions = (items: LobeSelectOptions) => {\n items.forEach((item) => {\n if (isGroupOption(item)) {\n item.options.forEach(addOption);\n } else {\n addOption(item);\n }\n });\n };\n\n walkOptions(baseOptions);\n\n const filteredExtraOptions = extraOptions.filter((item) => !optionValueMap.has(item.value));\n filteredExtraOptions.forEach(addOption);\n\n const mergedOptions: LobeSelectOptions = [...baseOptions, ...filteredExtraOptions];\n\n const missingValueOptions: LobeSelectOption<any>[] = valueArray\n .filter((val) => !optionValueMap.has(val))\n .map((val) => ({\n label: String(val),\n value: val,\n }));\n missingValueOptions.forEach(addOption);\n\n return {\n optionMap: optionValueMap,\n resolvedOptions: missingValueOptions.length\n ? [...mergedOptions, ...missingValueOptions]\n : mergedOptions,\n };\n }, [extraOptions, options, valueArray]);\n\n const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));\n\n useEffect(() => {\n if (open !== undefined) {\n setUncontrolledOpen(open);\n }\n }, [open]);\n\n const mergedOpen = open ?? uncontrolledOpen;\n\n const handleOpenChange = useCallback(\n (nextOpen: boolean) => {\n onOpenChange?.(nextOpen);\n if (open === undefined) {\n setUncontrolledOpen(nextOpen);\n }\n },\n [onOpenChange, open],\n );\n\n const [searchValue, setSearchValue] = useState('');\n const shouldShowSearch = Boolean(showSearch || mode === 'tags');\n\n useEffect(() => {\n if (!mergedOpen) setSearchValue('');\n }, [mergedOpen]);\n\n const getOption = useCallback(\n (optionValue: any): LobeSelectOption<any> => {\n const matched = optionMap.get(optionValue);\n if (matched) return matched;\n if (optionValue && typeof optionValue === 'object' && 'label' in optionValue) {\n return {\n label: (optionValue as any).label,\n value: optionValue,\n };\n }\n return {\n label: String(optionValue),\n value: optionValue,\n };\n },\n [optionMap],\n );\n\n const previousValueRef = useRef<any>(normalizedValue);\n\n useEffect(() => {\n previousValueRef.current = normalizedValue;\n }, [normalizedValue]);\n\n const handleValueChange = useCallback(\n (nextValue: any) => {\n const normalizedNextValue = normalizeValue(nextValue);\n const previousValue = previousValueRef.current;\n\n if (isMultiple) {\n const prevValues = Array.isArray(previousValue) ? previousValue : [];\n const nextValues = Array.isArray(normalizedNextValue) ? normalizedNextValue : [];\n const addedValues = nextValues.filter(\n (val) => !prevValues.some((prev) => Object.is(prev, val)),\n );\n\n addedValues.forEach((val) => {\n onSelect?.(val, getOption(val));\n });\n\n if (value === undefined) {\n setUncontrolledValue(nextValues);\n }\n onChange?.(\n nextValues,\n nextValues.map((val) => getOption(val)),\n );\n } else {\n if (\n !isValueEmpty(normalizedNextValue) &&\n !Object.is(previousValue, normalizedNextValue)\n ) {\n onSelect?.(normalizedNextValue, getOption(normalizedNextValue));\n }\n if (value === undefined) {\n setUncontrolledValue(normalizedNextValue);\n }\n onChange?.(\n normalizedNextValue,\n isValueEmpty(normalizedNextValue) ? undefined : getOption(normalizedNextValue),\n );\n }\n\n previousValueRef.current = normalizedNextValue;\n },\n [getOption, isMultiple, normalizeValue, onChange, onSelect, value],\n );\n\n const appendTagValues = useCallback(\n (rawValues: string[]) => {\n const valuesToAdd = rawValues.map((val) => val.trim()).filter(Boolean);\n if (!valuesToAdd.length) return;\n\n const nextValues = [...valueArray];\n const newOptionValues = valuesToAdd.filter((val) => !optionMap.has(val));\n\n if (newOptionValues.length > 0) {\n setExtraOptions((prev) => {\n const existingValues = new Set(prev.map((item) => item.value));\n const merged = [...prev];\n newOptionValues.forEach((val) => {\n if (!existingValues.has(val)) {\n merged.push({ label: val, value: val });\n }\n });\n return merged;\n });\n }\n\n valuesToAdd.forEach((val) => {\n if (!nextValues.some((item) => Object.is(item, val))) {\n nextValues.push(val);\n }\n });\n\n if (nextValues.length !== valueArray.length) {\n handleValueChange(nextValues);\n }\n },\n [handleValueChange, optionMap, valueArray],\n );\n\n const handleSearchChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const nextValue = event.target.value;\n if (mode === 'tags') {\n const parts = splitBySeparators(nextValue, tokenSeparators);\n if (parts.length > 1) {\n const pending = parts.pop() ?? '';\n appendTagValues(parts.filter(Boolean));\n setSearchValue(pending);\n return;\n }\n }\n setSearchValue(nextValue);\n },\n [appendTagValues, mode, tokenSeparators],\n );\n\n const handleSearchKeyDown = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n event.stopPropagation();\n\n if (event.key === 'Escape') {\n handleOpenChange(false);\n return;\n }\n\n if (mode !== 'tags') return;\n\n if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n appendTagValues([searchValue]);\n setSearchValue('');\n return;\n }\n\n if (tokenSeparators?.includes(event.key)) {\n event.preventDefault();\n event.stopPropagation();\n appendTagValues([searchValue]);\n setSearchValue('');\n }\n },\n [appendTagValues, handleOpenChange, mode, searchValue, tokenSeparators],\n );\n\n const filteredOptions = useMemo(() => {\n if (!shouldShowSearch || !searchValue.trim()) return resolvedOptions;\n const query = searchValue.trim().toLowerCase();\n\n const filterItems = (items: LobeSelectOptions): LobeSelectOptions => {\n const filtered = items\n .map((item) => {\n if (isGroupOption(item)) {\n const groupItems = item.options.filter((option) =>\n getOptionSearchText(option).toLowerCase().includes(query),\n );\n if (!groupItems.length) return null;\n return { ...item, options: groupItems };\n }\n return getOptionSearchText(item).toLowerCase().includes(query) ? item : null;\n })\n .filter(Boolean) as LobeSelectOptions;\n\n return filtered;\n };\n\n return filterItems(resolvedOptions);\n }, [resolvedOptions, searchValue, shouldShowSearch]);\n\n const renderValue = useCallback(\n (currentValue: any) => {\n const resolved = normalizeValue(currentValue);\n const placeholderNode =\n placeholder === undefined ? null : (\n <span className={styles.valueText}>{placeholder}</span>\n );\n\n if (isMultiple) {\n const values = Array.isArray(resolved) ? resolved : [];\n if (values.length === 0) return placeholderNode;\n return (\n <span className={styles.tags}>\n {values.map((val, index) => {\n const option = getOption(val);\n const content = labelRender ? labelRender(option) : (option.label ?? String(val));\n return (\n <span className={styles.tag} key={`${String(val)}-${index}`}>\n {content}\n </span>\n );\n })}\n </span>\n );\n }\n\n if (isValueEmpty(resolved)) return placeholderNode;\n const option = getOption(resolved);\n const content = labelRender ? labelRender(option) : (option.label ?? String(resolved));\n return <span className={styles.valueText}>{content}</span>;\n },\n [getOption, isMultiple, labelRender, normalizeValue, placeholder],\n );\n\n const hasValue = isMultiple ? valueArray.length > 0 : !isValueEmpty(normalizedValue);\n const showClear = Boolean(allowClear && hasValue && !disabled && !readOnly);\n\n const handleClear = useCallback(\n (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n handleValueChange(isMultiple ? [] : null);\n },\n [handleValueChange, isMultiple],\n );\n\n const prefixNode = useMemo(() => {\n if (prefix === undefined || prefix === null) return null;\n if (isValidElement(prefix) || typeof prefix === 'string' || typeof prefix === 'number') {\n return prefix;\n }\n return <Icon icon={prefix as any} size={'small'} />;\n }, [prefix]);\n\n const suffixIconNode = useMemo(() => {\n if (loading) {\n return <Icon spin icon={Loader2} size={'small'} />;\n }\n if (suffixIcon === null) return null;\n if (\n isValidElement(suffixIcon) ||\n typeof suffixIcon === 'string' ||\n typeof suffixIcon === 'number'\n ) {\n return suffixIcon;\n }\n return (\n <Icon\n icon={(suffixIcon as any) || ChevronDown}\n size={'small'}\n {...suffixIconProps}\n style={{\n pointerEvents: 'none',\n ...suffixIconProps?.style,\n }}\n />\n );\n }, [loading, suffixIcon, suffixIconProps]);\n\n const popupStyle = useMemo(() => {\n const maxHeight = isItemAligned ? '80vh' : `${listHeight}px`;\n const baseStyle: React.CSSProperties = {\n maxHeight,\n maxWidth: 'var(--available-width)',\n minWidth: 'var(--anchor-width)',\n ['--lobe-select-popup-max-height' as any]: maxHeight,\n };\n\n if (popupMatchSelectWidth === undefined || popupMatchSelectWidth === true) {\n return baseStyle;\n }\n if (typeof popupMatchSelectWidth === 'number') {\n return {\n ...baseStyle,\n minWidth: popupMatchSelectWidth,\n width: popupMatchSelectWidth,\n };\n }\n return {\n ...baseStyle,\n minWidth: 'max-content',\n };\n }, [isItemAligned, listHeight, popupMatchSelectWidth]);\n\n const triggerClassName = cx(\n triggerVariants({ shadow, size, variant: resolvedVariant }),\n className,\n classNames?.root,\n classNames?.trigger,\n );\n\n const listRef = useRef<HTMLDivElement | null>(null);\n const pointerScrollRef = useRef(false);\n const pointerScrollTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const renderVirtualItem = useCallback((props: HTMLAttributes<HTMLDivElement>) => {\n const { ref, ...rest } = props as HTMLAttributes<HTMLDivElement> & {\n ref?: Ref<HTMLDivElement>;\n };\n\n return (\n <div\n {...rest}\n ref={(node) => {\n if (node) {\n node.scrollIntoView = (...args) => {\n if (!pointerScrollRef.current) {\n HTMLElement.prototype.scrollIntoView.call(node, ...args);\n }\n };\n }\n\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref && 'current' in ref) {\n (ref as MutableRefObject<HTMLDivElement | null>).current = node;\n }\n }}\n />\n );\n }, []);\n\n const markPointerScroll = useCallback(() => {\n pointerScrollRef.current = true;\n if (pointerScrollTimeoutRef.current) {\n clearTimeout(pointerScrollTimeoutRef.current);\n }\n pointerScrollTimeoutRef.current = setTimeout(() => {\n pointerScrollRef.current = false;\n }, 120);\n }, []);\n\n const handleListScroll = useCallback(() => {\n if (!virtual || !pointerScrollRef.current) return;\n const listElement = listRef.current;\n const activeElement = document.activeElement;\n if (listElement && activeElement && listElement.contains(activeElement)) {\n listElement.focus({ preventScroll: true });\n }\n }, [virtual]);\n\n useEffect(() => {\n return () => {\n if (pointerScrollTimeoutRef.current) {\n clearTimeout(pointerScrollTimeoutRef.current);\n }\n };\n }, []);\n const virtualListStyle = useMemo(() => {\n if (!virtual) return undefined;\n const rowCount = countVirtualItems(filteredOptions);\n const maxVisibleRows = 6;\n const estimatedRowHeight =\n listItemHeight ?? (size === 'large' ? 40 : size === 'small' ? 28 : 32);\n const visibleRows = Math.min(Math.max(rowCount, 1), maxVisibleRows);\n const estimatedHeight = visibleRows * estimatedRowHeight + 8;\n\n return {\n height: `min(${estimatedHeight}px, var(--lobe-select-available-height, var(--available-height)))`,\n };\n }, [filteredOptions, listItemHeight, size, virtual]);\n\n const keepMountedIndices = useMemo(() => {\n if (!virtual || valueArray.length === 0) return undefined;\n const selectedSet = new Set(valueArray);\n const indices: number[] = [];\n let index = 0;\n\n filteredOptions.forEach((item) => {\n if (isGroupOption(item)) {\n if (item.options.some((option) => selectedSet.has(option.value))) {\n indices.push(index);\n }\n index += 1;\n return;\n }\n\n if (selectedSet.has(item.value)) {\n indices.push(index);\n }\n index += 1;\n });\n\n return indices.length ? indices : undefined;\n }, [filteredOptions, valueArray, virtual]);\n\n const itemTextClassName = cx(\n optionRender ? menuStyles.itemContent : menuStyles.label,\n styles.itemText,\n classNames?.itemText,\n );\n\n const isBoldIndicator = selectedIndicatorVariant === 'bold';\n let optionIndex = 0;\n const renderOptions = (items: LobeSelectOptions) =>\n items.map((item, index) => {\n if (isGroupOption(item)) {\n return (\n <Select.Group className={cx(styles.group, classNames?.group)} key={`group-${index}`}>\n <Select.GroupLabel\n className={cx(menuStyles.groupLabel, styles.groupLabel, classNames?.groupLabel)}\n >\n {item.label}\n </Select.GroupLabel>\n {item.options.map((option) => {\n const currentIndex = optionIndex++;\n return (\n <Select.Item\n disabled={option.disabled}\n key={`${String(option.value)}-${currentIndex}`}\n label={getOptionSearchText(option)}\n render={virtual ? renderVirtualItem : undefined}\n value={option.value}\n className={cx(\n menuStyles.item,\n styles.item,\n isBoldIndicator && styles.itemBoldSelected,\n classNames?.item,\n classNames?.option,\n option.className,\n )}\n style={{\n minHeight: listItemHeight,\n ...option.style,\n }}\n >\n <Select.ItemText className={itemTextClassName}>\n {optionRender ? optionRender(option, { index: currentIndex }) : option.label}\n </Select.ItemText>\n {!isBoldIndicator && (\n <Select.ItemIndicator\n className={cx(styles.itemIndicator, classNames?.itemIndicator)}\n >\n <Icon icon={Check} size={'small'} />\n </Select.ItemIndicator>\n )}\n </Select.Item>\n );\n })}\n </Select.Group>\n );\n }\n\n const currentIndex = optionIndex++;\n return (\n <Select.Item\n disabled={item.disabled}\n key={`${String(item.value)}-${currentIndex}`}\n label={getOptionSearchText(item)}\n render={virtual ? renderVirtualItem : undefined}\n value={item.value}\n className={cx(\n menuStyles.item,\n styles.item,\n isBoldIndicator && styles.itemBoldSelected,\n classNames?.item,\n classNames?.option,\n item.className,\n )}\n style={{\n minHeight: listItemHeight,\n ...item.style,\n }}\n >\n <Select.ItemText className={itemTextClassName}>\n {optionRender ? optionRender(item, { index: currentIndex }) : item.label}\n </Select.ItemText>\n {!isBoldIndicator && (\n <Select.ItemIndicator className={cx(styles.itemIndicator, classNames?.itemIndicator)}>\n <Icon icon={Check} size={'small'} />\n </Select.ItemIndicator>\n )}\n </Select.Item>\n );\n });\n\n const appElement = useAppElement();\n return (\n <Select.Root\n disabled={disabled}\n id={id}\n modal={isItemAligned}\n multiple={isMultiple}\n name={name}\n open={mergedOpen}\n readOnly={readOnly}\n required={required}\n value={normalizedValue}\n onOpenChange={handleOpenChange}\n onValueChange={handleValueChange}\n >\n <Select.Trigger\n autoFocus={autoFocus}\n className={triggerClassName}\n disabled={disabled}\n style={style}\n >\n {prefixNode !== null && prefixNode !== undefined && (\n <span className={cx(styles.prefix, classNames?.prefix)}>{prefixNode}</span>\n )}\n <Select.Value className={cx(styles.value, classNames?.value)}>{renderValue}</Select.Value>\n <span className={cx(styles.suffix, classNames?.suffix)}>\n {showClear && (\n <span\n className={cx(styles.clear, classNames?.clear)}\n data-role=\"lobe-select-clear\"\n onClick={handleClear}\n >\n <Icon icon={X} size={'small'} />\n </span>\n )}\n {suffixIconNode !== null && suffixIconNode !== undefined && (\n <Select.Icon className={cx(styles.icon, classNames?.icon)}>\n {suffixIconNode}\n </Select.Icon>\n )}\n </span>\n </Select.Trigger>\n\n <Select.Portal container={appElement}>\n <Select.Positioner\n align=\"start\"\n alignItemWithTrigger={isItemAligned}\n className={styles.positioner}\n side=\"bottom\"\n sideOffset={6}\n >\n <Select.Popup\n style={popupStyle}\n className={cx(\n menuStyles.popup,\n styles.popup,\n popupClassName,\n classNames?.popup,\n classNames?.dropdown,\n )}\n >\n {shouldShowSearch && (\n <div className={cx(styles.search, classNames?.search)}>\n <input\n className={styles.searchInput}\n placeholder={typeof placeholder === 'string' ? placeholder : undefined}\n value={searchValue}\n onChange={handleSearchChange}\n onKeyDown={handleSearchKeyDown}\n />\n </div>\n )}\n {(() => {\n const content =\n filteredOptions.length > 0 ? (\n renderOptions(filteredOptions)\n ) : (\n <div\n className={cx(\n menuStyles.item,\n menuStyles.empty,\n styles.empty,\n classNames?.empty,\n )}\n >\n No data\n </div>\n );\n\n if (!virtual || filteredOptions.length === 0) {\n return (\n <Select.List\n className={cx(styles.list, classNames?.list)}\n data-virtual={virtual || undefined}\n >\n {content}\n </Select.List>\n );\n }\n\n return (\n <Select.List\n className={cx(styles.list, classNames?.list)}\n data-virtual={virtual || undefined}\n ref={listRef}\n style={virtualListStyle}\n tabIndex={virtual ? -1 : undefined}\n onPointerDown={virtual ? markPointerScroll : undefined}\n onScroll={virtual ? handleListScroll : undefined}\n onTouchMove={virtual ? markPointerScroll : undefined}\n onWheel={virtual ? markPointerScroll : undefined}\n >\n <Virtualizer itemSize={listItemHeight} keepMounted={keepMountedIndices}>\n {content}\n </Virtualizer>\n </Select.List>\n );\n })()}\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n );\n },\n);\n\nLobeSelect.displayName = 'LobeSelect';\n\nexport default LobeSelect;\n"],"mappings":";;;;;;;;;;;;;;AA4BA,MAAM,iBACJ,WAEA,QAAS,OAAwC,QAAQ;AAE3D,MAAM,uBAA+B,WAAoC;AACvE,KAAI,OAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAAU,SAC9D,QAAO,OAAO,OAAO,MAAM;AAE7B,KAAI,OAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAAU,SAC9D,QAAO,OAAO,OAAO,MAAM;AAE7B,KAAI,OAAO,MAAO,QAAO,OAAO;AAChC,QAAO;;AAGT,MAAM,gBAAgB,UAAkB,MAAM,WAAW,uBAAuB,OAAO;AAEvF,MAAM,qBAAqB,OAAe,eAA0B;AAClE,KAAI,CAAC,cAAc,WAAW,WAAW,EAAG,QAAO,CAAC,MAAM;CAC1D,MAAM,UAAU,WAAW,IAAI,aAAa,CAAC,KAAK,IAAI;AACtD,QAAO,MAAM,MAAM,IAAI,OAAO,SAA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OACE,SAEA;MACN,MAAM,UACJ,gBAAgB,SAAS,IACvB,cAAc,gBAAgB,GAE9B,oBAAC;OACC,WAAW,GACTM,OAAW,MACXA,OAAW,OACXN,SAAO,OACP,YAAY,MACb;iBACF;QAEK;AAGV,UAAI,CAAC,WAAW,gBAAgB,WAAW,EACzC,QACE,oBAAC,OAAO;OACN,WAAW,GAAGA,SAAO,MAAM,YAAY,KAAK;OAC5C,gBAAc,WAAW;iBAExB;QACW;AAIlB,aACE,oBAAC,OAAO;OACN,WAAW,GAAGA,SAAO,MAAM,YAAY,KAAK;OAC5C,gBAAc,WAAW;OACzB,KAAK;OACL,OAAO;OACP,UAAU,UAAU,KAAK;OACzB,eAAe,UAAU,oBAAoB;OAC7C,UAAU,UAAU,mBAAmB;OACvC,aAAa,UAAU,oBAAoB;OAC3C,SAAS,UAAU,oBAAoB;iBAEvC,oBAAC;QAAY,UAAU;QAAgB,aAAa;kBACjD;SACW;QACF;SAEd;MACS;KACG;IACN;GACJ;EAGnB;AAED,WAAW,cAAc;AAEzB,yBAAe"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { LobeSelectSize, LobeSelectVariant } from "./type.mjs";
|
|
2
|
-
import
|
|
3
|
-
import * as react28 from "react";
|
|
2
|
+
import * as react5 from "react";
|
|
4
3
|
import { ComponentProps, ComponentPropsWithRef } from "react";
|
|
5
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
5
|
import * as _base_ui_react_select0 from "@base-ui/react/select";
|
|
7
6
|
import { Select } from "@base-ui/react/select";
|
|
8
7
|
import * as node_modules__base_ui_react_esm_separator_Separator0 from "node_modules/@base-ui/react/esm/separator/Separator";
|
|
9
8
|
|
|
10
9
|
//#region src/LobeSelect/atoms.d.ts
|
|
11
10
|
declare const LobeSelectRoot: typeof Select.Root;
|
|
12
|
-
declare const LobeSelectBackdrop:
|
|
13
|
-
declare const LobeSelectSeparator:
|
|
11
|
+
declare const LobeSelectBackdrop: react5.ForwardRefExoticComponent<_base_ui_react_select0.SelectBackdropProps & react5.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const LobeSelectSeparator: react5.ForwardRefExoticComponent<node_modules__base_ui_react_esm_separator_Separator0.SeparatorProps & react5.RefAttributes<HTMLDivElement>>;
|
|
14
13
|
type LobeSelectTriggerProps = Omit<ComponentPropsWithRef<typeof Select.Trigger>, 'children' | 'render'> & {
|
|
15
14
|
children: ComponentProps<typeof Select.Trigger>['children'];
|
|
16
15
|
shadow?: boolean;
|
|
@@ -27,7 +26,7 @@ declare const LobeSelectTrigger: {
|
|
|
27
26
|
variant,
|
|
28
27
|
ref: refProp,
|
|
29
28
|
...rest
|
|
30
|
-
}: LobeSelectTriggerProps):
|
|
29
|
+
}: LobeSelectTriggerProps): react_jsx_runtime0.JSX.Element;
|
|
31
30
|
displayName: string;
|
|
32
31
|
};
|
|
33
32
|
type LobeSelectIconProps = ComponentProps<typeof Select.Icon>;
|
|
@@ -35,7 +34,7 @@ declare const LobeSelectIcon: {
|
|
|
35
34
|
({
|
|
36
35
|
className,
|
|
37
36
|
...rest
|
|
38
|
-
}: LobeSelectIconProps):
|
|
37
|
+
}: LobeSelectIconProps): react_jsx_runtime0.JSX.Element;
|
|
39
38
|
displayName: string;
|
|
40
39
|
};
|
|
41
40
|
type LobeSelectValueProps = ComponentProps<typeof Select.Value>;
|
|
@@ -43,7 +42,7 @@ declare const LobeSelectValue: {
|
|
|
43
42
|
({
|
|
44
43
|
className,
|
|
45
44
|
...rest
|
|
46
|
-
}: LobeSelectValueProps):
|
|
45
|
+
}: LobeSelectValueProps): react_jsx_runtime0.JSX.Element;
|
|
47
46
|
displayName: string;
|
|
48
47
|
};
|
|
49
48
|
type LobeSelectPortalProps = ComponentProps<typeof Select.Portal> & {
|
|
@@ -56,7 +55,7 @@ declare const LobeSelectPortal: {
|
|
|
56
55
|
({
|
|
57
56
|
container,
|
|
58
57
|
...rest
|
|
59
|
-
}: LobeSelectPortalProps):
|
|
58
|
+
}: LobeSelectPortalProps): react_jsx_runtime0.JSX.Element;
|
|
60
59
|
displayName: string;
|
|
61
60
|
};
|
|
62
61
|
type LobeSelectPositionerProps = ComponentProps<typeof Select.Positioner>;
|
|
@@ -68,7 +67,7 @@ declare const LobeSelectPositioner: {
|
|
|
68
67
|
side,
|
|
69
68
|
sideOffset,
|
|
70
69
|
...rest
|
|
71
|
-
}: LobeSelectPositionerProps):
|
|
70
|
+
}: LobeSelectPositionerProps): react_jsx_runtime0.JSX.Element;
|
|
72
71
|
displayName: string;
|
|
73
72
|
};
|
|
74
73
|
type LobeSelectPopupProps = ComponentProps<typeof Select.Popup>;
|
|
@@ -76,7 +75,7 @@ declare const LobeSelectPopup: {
|
|
|
76
75
|
({
|
|
77
76
|
className,
|
|
78
77
|
...rest
|
|
79
|
-
}: LobeSelectPopupProps):
|
|
78
|
+
}: LobeSelectPopupProps): react_jsx_runtime0.JSX.Element;
|
|
80
79
|
displayName: string;
|
|
81
80
|
};
|
|
82
81
|
type LobeSelectListProps = ComponentProps<typeof Select.List>;
|
|
@@ -84,7 +83,7 @@ declare const LobeSelectList: {
|
|
|
84
83
|
({
|
|
85
84
|
className,
|
|
86
85
|
...rest
|
|
87
|
-
}: LobeSelectListProps):
|
|
86
|
+
}: LobeSelectListProps): react_jsx_runtime0.JSX.Element;
|
|
88
87
|
displayName: string;
|
|
89
88
|
};
|
|
90
89
|
type LobeSelectItemProps = ComponentProps<typeof Select.Item>;
|
|
@@ -92,7 +91,7 @@ declare const LobeSelectItem: {
|
|
|
92
91
|
({
|
|
93
92
|
className,
|
|
94
93
|
...rest
|
|
95
|
-
}: LobeSelectItemProps):
|
|
94
|
+
}: LobeSelectItemProps): react_jsx_runtime0.JSX.Element;
|
|
96
95
|
displayName: string;
|
|
97
96
|
};
|
|
98
97
|
type LobeSelectItemTextProps = ComponentProps<typeof Select.ItemText>;
|
|
@@ -100,7 +99,7 @@ declare const LobeSelectItemText: {
|
|
|
100
99
|
({
|
|
101
100
|
className,
|
|
102
101
|
...rest
|
|
103
|
-
}: LobeSelectItemTextProps):
|
|
102
|
+
}: LobeSelectItemTextProps): react_jsx_runtime0.JSX.Element;
|
|
104
103
|
displayName: string;
|
|
105
104
|
};
|
|
106
105
|
type LobeSelectItemIndicatorProps = ComponentProps<typeof Select.ItemIndicator>;
|
|
@@ -108,7 +107,7 @@ declare const LobeSelectItemIndicator: {
|
|
|
108
107
|
({
|
|
109
108
|
className,
|
|
110
109
|
...rest
|
|
111
|
-
}: LobeSelectItemIndicatorProps):
|
|
110
|
+
}: LobeSelectItemIndicatorProps): react_jsx_runtime0.JSX.Element;
|
|
112
111
|
displayName: string;
|
|
113
112
|
};
|
|
114
113
|
type LobeSelectGroupProps = ComponentProps<typeof Select.Group>;
|
|
@@ -116,7 +115,7 @@ declare const LobeSelectGroup: {
|
|
|
116
115
|
({
|
|
117
116
|
className,
|
|
118
117
|
...rest
|
|
119
|
-
}: LobeSelectGroupProps):
|
|
118
|
+
}: LobeSelectGroupProps): react_jsx_runtime0.JSX.Element;
|
|
120
119
|
displayName: string;
|
|
121
120
|
};
|
|
122
121
|
type LobeSelectGroupLabelProps = ComponentProps<typeof Select.GroupLabel>;
|
|
@@ -124,7 +123,7 @@ declare const LobeSelectGroupLabel: {
|
|
|
124
123
|
({
|
|
125
124
|
className,
|
|
126
125
|
...rest
|
|
127
|
-
}: LobeSelectGroupLabelProps):
|
|
126
|
+
}: LobeSelectGroupLabelProps): react_jsx_runtime0.JSX.Element;
|
|
128
127
|
displayName: string;
|
|
129
128
|
};
|
|
130
129
|
type LobeSelectScrollUpArrowProps = ComponentProps<typeof Select.ScrollUpArrow>;
|
|
@@ -132,7 +131,7 @@ declare const LobeSelectScrollUpArrow: {
|
|
|
132
131
|
({
|
|
133
132
|
className,
|
|
134
133
|
...rest
|
|
135
|
-
}: LobeSelectScrollUpArrowProps):
|
|
134
|
+
}: LobeSelectScrollUpArrowProps): react_jsx_runtime0.JSX.Element;
|
|
136
135
|
displayName: string;
|
|
137
136
|
};
|
|
138
137
|
type LobeSelectScrollDownArrowProps = ComponentProps<typeof Select.ScrollDownArrow>;
|
|
@@ -140,7 +139,7 @@ declare const LobeSelectScrollDownArrow: {
|
|
|
140
139
|
({
|
|
141
140
|
className,
|
|
142
141
|
...rest
|
|
143
|
-
}: LobeSelectScrollDownArrowProps):
|
|
142
|
+
}: LobeSelectScrollDownArrowProps): react_jsx_runtime0.JSX.Element;
|
|
144
143
|
displayName: string;
|
|
145
144
|
};
|
|
146
145
|
type LobeSelectArrowProps = ComponentProps<typeof Select.Arrow>;
|
|
@@ -148,7 +147,7 @@ declare const LobeSelectArrow: {
|
|
|
148
147
|
({
|
|
149
148
|
className,
|
|
150
149
|
...rest
|
|
151
|
-
}: LobeSelectArrowProps):
|
|
150
|
+
}: LobeSelectArrowProps): react_jsx_runtime0.JSX.Element;
|
|
152
151
|
displayName: string;
|
|
153
152
|
};
|
|
154
153
|
//#endregion
|
package/es/LobeSelect/atoms.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import { useNativeButton } from "../hooks/useNativeButton.mjs";
|
|
|
4
4
|
import { useAppElement } from "../ThemeProvider/AppElementContext.mjs";
|
|
5
5
|
import { styles } from "../Menu/sharedStyle.mjs";
|
|
6
6
|
import { styles as styles$1, triggerVariants } from "./style.mjs";
|
|
7
|
-
import { LOBE_SELECT_CONTAINER_ATTR } from "./constants.mjs";
|
|
8
7
|
import { cloneElement, isValidElement } from "react";
|
|
9
8
|
import { jsx } from "react/jsx-runtime";
|
|
10
9
|
import { cx, useThemeMode } from "antd-style";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atoms.mjs","names":["styles","menuStyles"],"sources":["../../src/LobeSelect/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Select } from '@base-ui/react/select';\nimport { cx, useThemeMode } from 'antd-style';\nimport {\n cloneElement,\n type ComponentProps,\n type ComponentPropsWithRef,\n isValidElement,\n} from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { styles as menuStyles } from '@/Menu/sharedStyle';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { styles, triggerVariants } from './style';\nimport { type LobeSelectSize, type LobeSelectVariant } from './type';\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport const LobeSelectRoot = Select.Root;\nexport const LobeSelectBackdrop = Select.Backdrop;\nexport const LobeSelectSeparator = Select.Separator;\n\nexport type LobeSelectTriggerProps = Omit<\n ComponentPropsWithRef<typeof Select.Trigger>,\n 'children' | 'render'\n> & {\n children: ComponentProps<typeof Select.Trigger>['children'];\n shadow?: boolean;\n size?: LobeSelectSize;\n variant?: LobeSelectVariant;\n};\n\nexport const LobeSelectTrigger = ({\n children,\n className,\n nativeButton,\n shadow,\n size = 'middle',\n variant,\n ref: refProp,\n ...rest\n}: LobeSelectTriggerProps) => {\n const { isDarkMode } = useThemeMode();\n const resolvedVariant = variant ?? (isDarkMode ? 'filled' : 'outlined');\n const baseClassName = triggerVariants({ shadow, size, variant: resolvedVariant });\n\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n if (isValidElement(children)) {\n return (\n <Select.Trigger\n {...rest}\n nativeButton={resolvedNativeButton}\n render={(props, state) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ref: triggerRef, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n const childClassName =\n typeof (mergedProps as any).className === 'function'\n ? (mergedProps as any).className(state)\n : (mergedProps as any).className;\n const extraClassName = typeof className === 'function' ? className(state) : className;\n\n return cloneElement(children as any, {\n ...mergedProps,\n className: cx(baseClassName, childClassName, extraClassName),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n }}\n />\n );\n }\n\n return (\n <Select.Trigger\n {...rest}\n className={mergeStateClassName(baseClassName, className) as any}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Select.Trigger>\n );\n};\n\nLobeSelectTrigger.displayName = 'LobeSelectTrigger';\n\nexport type LobeSelectIconProps = ComponentProps<typeof Select.Icon>;\n\nexport const LobeSelectIcon = ({ className, ...rest }: LobeSelectIconProps) => {\n return <Select.Icon className={mergeStateClassName(styles.icon, className) as any} {...rest} />;\n};\n\nLobeSelectIcon.displayName = 'LobeSelectIcon';\n\nexport type LobeSelectValueProps = ComponentProps<typeof Select.Value>;\n\nexport const LobeSelectValue = ({ className, ...rest }: LobeSelectValueProps) => {\n return <Select.Value className={mergeStateClassName(styles.value, className) as any} {...rest} />;\n};\n\nLobeSelectValue.displayName = 'LobeSelectValue';\n\nexport type LobeSelectPortalProps = ComponentProps<typeof Select.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const LobeSelectPortal = ({ container, ...rest }: LobeSelectPortalProps) => {\n const appElement = useAppElement();\n return <Select.Portal container={container ?? appElement ?? undefined} {...rest} />;\n};\n\nLobeSelectPortal.displayName = 'LobeSelectPortal';\n\nexport type LobeSelectPositionerProps = ComponentProps<typeof Select.Positioner>;\n\nexport const LobeSelectPositioner = ({\n align,\n alignItemWithTrigger,\n className,\n side,\n sideOffset,\n ...rest\n}: LobeSelectPositionerProps) => {\n return (\n <Select.Positioner\n align={align ?? 'start'}\n alignItemWithTrigger={alignItemWithTrigger ?? false}\n className={mergeStateClassName(styles.positioner, className) as any}\n side={side ?? 'bottom'}\n sideOffset={sideOffset ?? 6}\n {...rest}\n />\n );\n};\n\nLobeSelectPositioner.displayName = 'LobeSelectPositioner';\n\nexport type LobeSelectPopupProps = ComponentProps<typeof Select.Popup>;\n\nexport const LobeSelectPopup = ({ className, ...rest }: LobeSelectPopupProps) => {\n return (\n <Select.Popup\n className={mergeStateClassName(cx(menuStyles.popup, styles.popup), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectPopup.displayName = 'LobeSelectPopup';\n\nexport type LobeSelectListProps = ComponentProps<typeof Select.List>;\n\nexport const LobeSelectList = ({ className, ...rest }: LobeSelectListProps) => {\n return <Select.List className={mergeStateClassName(styles.list, className) as any} {...rest} />;\n};\n\nLobeSelectList.displayName = 'LobeSelectList';\n\nexport type LobeSelectItemProps = ComponentProps<typeof Select.Item>;\n\nexport const LobeSelectItem = ({ className, ...rest }: LobeSelectItemProps) => {\n return (\n <Select.Item\n className={mergeStateClassName(cx(menuStyles.item, styles.item), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItem.displayName = 'LobeSelectItem';\n\nexport type LobeSelectItemTextProps = ComponentProps<typeof Select.ItemText>;\n\nexport const LobeSelectItemText = ({ className, ...rest }: LobeSelectItemTextProps) => {\n return (\n <Select.ItemText\n className={mergeStateClassName(cx(menuStyles.label, styles.itemText), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItemText.displayName = 'LobeSelectItemText';\n\nexport type LobeSelectItemIndicatorProps = ComponentProps<typeof Select.ItemIndicator>;\n\nexport const LobeSelectItemIndicator = ({ className, ...rest }: LobeSelectItemIndicatorProps) => {\n return (\n <Select.ItemIndicator\n className={mergeStateClassName(styles.itemIndicator, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItemIndicator.displayName = 'LobeSelectItemIndicator';\n\nexport type LobeSelectGroupProps = ComponentProps<typeof Select.Group>;\n\nexport const LobeSelectGroup = ({ className, ...rest }: LobeSelectGroupProps) => {\n return <Select.Group className={mergeStateClassName(styles.group, className) as any} {...rest} />;\n};\n\nLobeSelectGroup.displayName = 'LobeSelectGroup';\n\nexport type LobeSelectGroupLabelProps = ComponentProps<typeof Select.GroupLabel>;\n\nexport const LobeSelectGroupLabel = ({ className, ...rest }: LobeSelectGroupLabelProps) => {\n return (\n <Select.GroupLabel\n className={\n mergeStateClassName(cx(menuStyles.groupLabel, styles.groupLabel), className) as any\n }\n {...rest}\n />\n );\n};\n\nLobeSelectGroupLabel.displayName = 'LobeSelectGroupLabel';\n\nexport type LobeSelectScrollUpArrowProps = ComponentProps<typeof Select.ScrollUpArrow>;\n\nexport const LobeSelectScrollUpArrow = ({ className, ...rest }: LobeSelectScrollUpArrowProps) => {\n return (\n <Select.ScrollUpArrow\n className={mergeStateClassName(styles.scrollArrow, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectScrollUpArrow.displayName = 'LobeSelectScrollUpArrow';\n\nexport type LobeSelectScrollDownArrowProps = ComponentProps<typeof Select.ScrollDownArrow>;\n\nexport const LobeSelectScrollDownArrow = ({\n className,\n ...rest\n}: LobeSelectScrollDownArrowProps) => {\n return (\n <Select.ScrollDownArrow\n className={mergeStateClassName(styles.scrollArrow, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectScrollDownArrow.displayName = 'LobeSelectScrollDownArrow';\n\nexport type LobeSelectArrowProps = ComponentProps<typeof Select.Arrow>;\n\nexport const LobeSelectArrow = ({ className, ...rest }: LobeSelectArrowProps) => {\n return <Select.Arrow className={mergeStateClassName(styles.arrow, className) as any} {...rest} />;\n};\n\nLobeSelectArrow.displayName = 'LobeSelectArrow';\n\nexport { LOBE_SELECT_CONTAINER_ATTR } from './constants';\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAM,uBACJ,MACA,cACG;AACH,KAAI,OAAO,cAAc,WAAY,SAAQ,UAAkB,GAAG,MAAM,UAAU,MAAM,CAAC;AACzF,QAAO,GAAG,MAAM,UAAU;;AAG5B,MAAa,iBAAiB,OAAO;AACrC,MAAa,qBAAqB,OAAO;AACzC,MAAa,sBAAsB,OAAO;AAY1C,MAAa,qBAAqB,EAChC,UACA,WACA,cACA,QACA,OAAO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EAAE,WAAW,GAAG,WAAiC;AAC/E,QAAO,oBAAC,OAAO;EAAM,WAAW,oBAAoBA,SAAO,OAAO,UAAU;EAAS,GAAI;GAAQ;;AAGnG,gBAAgB,cAAc;AAI9B,MAAa,wBAAwB,EAAE,WAAW,GAAG,WAAsC;AACzF,QACE,oBAAC,OAAO;EACN,WACE,oBAAoB,GAAGC,OAAW,YAAYD,SAAO,WAAW,EAAE,UAAU;EAE9E,GAAI;GACJ;;AAIN,qBAAqB,cAAc;AAInC,MAAa,2BAA2B,EAAE,WAAW,GAAG,WAAyC;AAC/F,QACE,oBAAC,OAAO;EACN,WAAW,oBAAoBA,SAAO,aAAa,UAAU;EAC7D,GAAI;GACJ;;AAIN,wBAAwB,cAAc;AAItC,MAAa,6BAA6B,EACxC,WACA,GAAG,WACiC;AACpC,QACE,oBAAC,OAAO;EACN,WAAW,oBAAoBA,SAAO,aAAa,UAAU;EAC7D,GAAI;GACJ;;AAIN,0BAA0B,cAAc;AAIxC,MAAa,mBAAmB,EAAE,WAAW,GAAG,WAAiC;AAC/E,QAAO,oBAAC,OAAO;EAAM,WAAW,oBAAoBA,SAAO,OAAO,UAAU;EAAS,GAAI;GAAQ;;AAGnG,gBAAgB,cAAc"}
|
|
1
|
+
{"version":3,"file":"atoms.mjs","names":["styles","menuStyles"],"sources":["../../src/LobeSelect/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Select } from '@base-ui/react/select';\nimport { cx, useThemeMode } from 'antd-style';\nimport {\n cloneElement,\n type ComponentProps,\n type ComponentPropsWithRef,\n isValidElement,\n} from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { styles as menuStyles } from '@/Menu/sharedStyle';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { styles, triggerVariants } from './style';\nimport { type LobeSelectSize, type LobeSelectVariant } from './type';\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport const LobeSelectRoot = Select.Root;\nexport const LobeSelectBackdrop = Select.Backdrop;\nexport const LobeSelectSeparator = Select.Separator;\n\nexport type LobeSelectTriggerProps = Omit<\n ComponentPropsWithRef<typeof Select.Trigger>,\n 'children' | 'render'\n> & {\n children: ComponentProps<typeof Select.Trigger>['children'];\n shadow?: boolean;\n size?: LobeSelectSize;\n variant?: LobeSelectVariant;\n};\n\nexport const LobeSelectTrigger = ({\n children,\n className,\n nativeButton,\n shadow,\n size = 'middle',\n variant,\n ref: refProp,\n ...rest\n}: LobeSelectTriggerProps) => {\n const { isDarkMode } = useThemeMode();\n const resolvedVariant = variant ?? (isDarkMode ? 'filled' : 'outlined');\n const baseClassName = triggerVariants({ shadow, size, variant: resolvedVariant });\n\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n if (isValidElement(children)) {\n return (\n <Select.Trigger\n {...rest}\n nativeButton={resolvedNativeButton}\n render={(props, state) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ref: triggerRef, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n const childClassName =\n typeof (mergedProps as any).className === 'function'\n ? (mergedProps as any).className(state)\n : (mergedProps as any).className;\n const extraClassName = typeof className === 'function' ? className(state) : className;\n\n return cloneElement(children as any, {\n ...mergedProps,\n className: cx(baseClassName, childClassName, extraClassName),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n }}\n />\n );\n }\n\n return (\n <Select.Trigger\n {...rest}\n className={mergeStateClassName(baseClassName, className) as any}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Select.Trigger>\n );\n};\n\nLobeSelectTrigger.displayName = 'LobeSelectTrigger';\n\nexport type LobeSelectIconProps = ComponentProps<typeof Select.Icon>;\n\nexport const LobeSelectIcon = ({ className, ...rest }: LobeSelectIconProps) => {\n return <Select.Icon className={mergeStateClassName(styles.icon, className) as any} {...rest} />;\n};\n\nLobeSelectIcon.displayName = 'LobeSelectIcon';\n\nexport type LobeSelectValueProps = ComponentProps<typeof Select.Value>;\n\nexport const LobeSelectValue = ({ className, ...rest }: LobeSelectValueProps) => {\n return <Select.Value className={mergeStateClassName(styles.value, className) as any} {...rest} />;\n};\n\nLobeSelectValue.displayName = 'LobeSelectValue';\n\nexport type LobeSelectPortalProps = ComponentProps<typeof Select.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const LobeSelectPortal = ({ container, ...rest }: LobeSelectPortalProps) => {\n const appElement = useAppElement();\n return <Select.Portal container={container ?? appElement ?? undefined} {...rest} />;\n};\n\nLobeSelectPortal.displayName = 'LobeSelectPortal';\n\nexport type LobeSelectPositionerProps = ComponentProps<typeof Select.Positioner>;\n\nexport const LobeSelectPositioner = ({\n align,\n alignItemWithTrigger,\n className,\n side,\n sideOffset,\n ...rest\n}: LobeSelectPositionerProps) => {\n return (\n <Select.Positioner\n align={align ?? 'start'}\n alignItemWithTrigger={alignItemWithTrigger ?? false}\n className={mergeStateClassName(styles.positioner, className) as any}\n side={side ?? 'bottom'}\n sideOffset={sideOffset ?? 6}\n {...rest}\n />\n );\n};\n\nLobeSelectPositioner.displayName = 'LobeSelectPositioner';\n\nexport type LobeSelectPopupProps = ComponentProps<typeof Select.Popup>;\n\nexport const LobeSelectPopup = ({ className, ...rest }: LobeSelectPopupProps) => {\n return (\n <Select.Popup\n className={mergeStateClassName(cx(menuStyles.popup, styles.popup), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectPopup.displayName = 'LobeSelectPopup';\n\nexport type LobeSelectListProps = ComponentProps<typeof Select.List>;\n\nexport const LobeSelectList = ({ className, ...rest }: LobeSelectListProps) => {\n return <Select.List className={mergeStateClassName(styles.list, className) as any} {...rest} />;\n};\n\nLobeSelectList.displayName = 'LobeSelectList';\n\nexport type LobeSelectItemProps = ComponentProps<typeof Select.Item>;\n\nexport const LobeSelectItem = ({ className, ...rest }: LobeSelectItemProps) => {\n return (\n <Select.Item\n className={mergeStateClassName(cx(menuStyles.item, styles.item), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItem.displayName = 'LobeSelectItem';\n\nexport type LobeSelectItemTextProps = ComponentProps<typeof Select.ItemText>;\n\nexport const LobeSelectItemText = ({ className, ...rest }: LobeSelectItemTextProps) => {\n return (\n <Select.ItemText\n className={mergeStateClassName(cx(menuStyles.label, styles.itemText), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItemText.displayName = 'LobeSelectItemText';\n\nexport type LobeSelectItemIndicatorProps = ComponentProps<typeof Select.ItemIndicator>;\n\nexport const LobeSelectItemIndicator = ({ className, ...rest }: LobeSelectItemIndicatorProps) => {\n return (\n <Select.ItemIndicator\n className={mergeStateClassName(styles.itemIndicator, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItemIndicator.displayName = 'LobeSelectItemIndicator';\n\nexport type LobeSelectGroupProps = ComponentProps<typeof Select.Group>;\n\nexport const LobeSelectGroup = ({ className, ...rest }: LobeSelectGroupProps) => {\n return <Select.Group className={mergeStateClassName(styles.group, className) as any} {...rest} />;\n};\n\nLobeSelectGroup.displayName = 'LobeSelectGroup';\n\nexport type LobeSelectGroupLabelProps = ComponentProps<typeof Select.GroupLabel>;\n\nexport const LobeSelectGroupLabel = ({ className, ...rest }: LobeSelectGroupLabelProps) => {\n return (\n <Select.GroupLabel\n className={\n mergeStateClassName(cx(menuStyles.groupLabel, styles.groupLabel), className) as any\n }\n {...rest}\n />\n );\n};\n\nLobeSelectGroupLabel.displayName = 'LobeSelectGroupLabel';\n\nexport type LobeSelectScrollUpArrowProps = ComponentProps<typeof Select.ScrollUpArrow>;\n\nexport const LobeSelectScrollUpArrow = ({ className, ...rest }: LobeSelectScrollUpArrowProps) => {\n return (\n <Select.ScrollUpArrow\n className={mergeStateClassName(styles.scrollArrow, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectScrollUpArrow.displayName = 'LobeSelectScrollUpArrow';\n\nexport type LobeSelectScrollDownArrowProps = ComponentProps<typeof Select.ScrollDownArrow>;\n\nexport const LobeSelectScrollDownArrow = ({\n className,\n ...rest\n}: LobeSelectScrollDownArrowProps) => {\n return (\n <Select.ScrollDownArrow\n className={mergeStateClassName(styles.scrollArrow, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectScrollDownArrow.displayName = 'LobeSelectScrollDownArrow';\n\nexport type LobeSelectArrowProps = ComponentProps<typeof Select.Arrow>;\n\nexport const LobeSelectArrow = ({ className, ...rest }: LobeSelectArrowProps) => {\n return <Select.Arrow className={mergeStateClassName(styles.arrow, className) as any} {...rest} />;\n};\n\nLobeSelectArrow.displayName = 'LobeSelectArrow';\n"],"mappings":";;;;;;;;;;;;;;AAoBA,MAAM,uBACJ,MACA,cACG;AACH,KAAI,OAAO,cAAc,WAAY,SAAQ,UAAkB,GAAG,MAAM,UAAU,MAAM,CAAC;AACzF,QAAO,GAAG,MAAM,UAAU;;AAG5B,MAAa,iBAAiB,OAAO;AACrC,MAAa,qBAAqB,OAAO;AACzC,MAAa,sBAAsB,OAAO;AAY1C,MAAa,qBAAqB,EAChC,UACA,WACA,cACA,QACA,OAAO,UACP,SACA,KAAK,SACL,GAAG,WACyB;CAC5B,MAAM,EAAE,eAAe,cAAc;CAErC,MAAM,gBAAgB,gBAAgB;EAAE;EAAQ;EAAM,SAD9B,YAAY,aAAa,WAAW;EACoB,CAAC;CAEjF,MAAM,EAAE,8BAA8B,yBAAyB,gBAAgB;EAC7E;EACA;EACD,CAAC;AAEF,KAAI,eAAe,SAAS,CAC1B,QACE,oBAAC,OAAO;EACN,GA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GAAI;GACJ;;AAIN,qBAAqB,cAAc;AAInC,MAAa,2BAA2B,EAAE,WAAW,GAAG,WAAyC;AAC/F,QACE,oBAAC,OAAO;EACN,WAAW,oBAAoBA,SAAO,aAAa,UAAU;EAC7D,GAAI;GACJ;;AAIN,wBAAwB,cAAc;AAItC,MAAa,6BAA6B,EACxC,WACA,GAAG,WACiC;AACpC,QACE,oBAAC,OAAO;EACN,WAAW,oBAAoBA,SAAO,aAAa,UAAU;EAC7D,GAAI;GACJ;;AAIN,0BAA0B,cAAc;AAIxC,MAAa,mBAAmB,EAAE,WAAW,GAAG,WAAiC;AAC/E,QAAO,oBAAC,OAAO;EAAM,WAAW,oBAAoBA,SAAO,OAAO,UAAU;EAAS,GAAI;GAAQ;;AAGnG,gBAAgB,cAAc"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LobeSelectBehaviorVariant, LobeSelectClassNames, LobeSelectIndicatorVariant, LobeSelectOption, LobeSelectOptionGroup, LobeSelectOptions, LobeSelectProps, LobeSelectSize, LobeSelectVariant } from "./type.mjs";
|
|
2
|
-
import { LOBE_SELECT_CONTAINER_ATTR } from "./constants.mjs";
|
|
3
2
|
import { LobeSelectArrow, LobeSelectArrowProps, LobeSelectBackdrop, LobeSelectGroup, LobeSelectGroupLabel, LobeSelectGroupLabelProps, LobeSelectGroupProps, LobeSelectIcon, LobeSelectIconProps, LobeSelectItem, LobeSelectItemIndicator, LobeSelectItemIndicatorProps, LobeSelectItemProps, LobeSelectItemText, LobeSelectItemTextProps, LobeSelectList, LobeSelectListProps, LobeSelectPopup, LobeSelectPopupProps, LobeSelectPortal, LobeSelectPortalProps, LobeSelectPositioner, LobeSelectPositionerProps, LobeSelectRoot, LobeSelectScrollDownArrow, LobeSelectScrollDownArrowProps, LobeSelectScrollUpArrow, LobeSelectScrollUpArrowProps, LobeSelectSeparator, LobeSelectTrigger, LobeSelectTriggerProps, LobeSelectValue, LobeSelectValueProps } from "./atoms.mjs";
|
|
4
3
|
import { LobeSelect } from "./LobeSelect.mjs";
|
|
5
|
-
export {
|
|
4
|
+
export { LobeSelectArrow, type LobeSelectArrowProps, LobeSelectBackdrop, type LobeSelectBehaviorVariant, type LobeSelectClassNames, LobeSelectGroup, LobeSelectGroupLabel, type LobeSelectGroupLabelProps, type LobeSelectGroupProps, LobeSelectIcon, type LobeSelectIconProps, type LobeSelectIndicatorVariant, LobeSelectItem, LobeSelectItemIndicator, type LobeSelectItemIndicatorProps, type LobeSelectItemProps, LobeSelectItemText, type LobeSelectItemTextProps, LobeSelectList, type LobeSelectListProps, type LobeSelectOption, type LobeSelectOptionGroup, type LobeSelectOptions, LobeSelectPopup, type LobeSelectPopupProps, LobeSelectPortal, type LobeSelectPortalProps, LobeSelectPositioner, type LobeSelectPositionerProps, type LobeSelectProps, LobeSelectRoot, LobeSelectScrollDownArrow, type LobeSelectScrollDownArrowProps, LobeSelectScrollUpArrow, type LobeSelectScrollUpArrowProps, LobeSelectSeparator, type LobeSelectSize, LobeSelectTrigger, type LobeSelectTriggerProps, LobeSelectValue, type LobeSelectValueProps, type LobeSelectVariant, LobeSelect as default };
|
package/es/LobeSelect/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { LOBE_SELECT_CONTAINER_ATTR } from "./constants.mjs";
|
|
2
1
|
import { LobeSelectArrow, LobeSelectBackdrop, LobeSelectGroup, LobeSelectGroupLabel, LobeSelectIcon, LobeSelectItem, LobeSelectItemIndicator, LobeSelectItemText, LobeSelectList, LobeSelectPopup, LobeSelectPortal, LobeSelectPositioner, LobeSelectRoot, LobeSelectScrollDownArrow, LobeSelectScrollUpArrow, LobeSelectSeparator, LobeSelectTrigger, LobeSelectValue } from "./atoms.mjs";
|
|
3
2
|
import LobeSelect_default from "./LobeSelect.mjs";
|
|
4
3
|
|
|
5
|
-
export {
|
|
4
|
+
export { LobeSelectArrow, LobeSelectBackdrop, LobeSelectGroup, LobeSelectGroupLabel, LobeSelectIcon, LobeSelectItem, LobeSelectItemIndicator, LobeSelectItemText, LobeSelectList, LobeSelectPopup, LobeSelectPortal, LobeSelectPositioner, LobeSelectRoot, LobeSelectScrollDownArrow, LobeSelectScrollUpArrow, LobeSelectSeparator, LobeSelectTrigger, LobeSelectValue, LobeSelect_default as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LobeSwitchProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react10 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/LobeSwitch/LobeSwitch.d.ts
|
|
5
|
-
declare const LobeSwitch:
|
|
5
|
+
declare const LobeSwitch: react10.NamedExoticComponent<LobeSwitchProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { LobeSwitch };
|
|
8
8
|
//# sourceMappingURL=LobeSwitch.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LobeSwitchChangeEventHandler, LobeSwitchContextType, LobeSwitchIconProps, LobeSwitchRootProps, LobeSwitchThumbProps } from "./type.mjs";
|
|
2
2
|
import { styles } from "./style.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/LobeSwitch/atoms.d.ts
|
|
6
6
|
declare const useLobeSwitchContext: () => LobeSwitchContextType;
|
|
@@ -24,7 +24,7 @@ declare const LobeSwitchRoot: {
|
|
|
24
24
|
id,
|
|
25
25
|
name,
|
|
26
26
|
...rest
|
|
27
|
-
}: LobeSwitchRootInternalProps):
|
|
27
|
+
}: LobeSwitchRootInternalProps): react_jsx_runtime14.JSX.Element;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
30
30
|
declare const LobeSwitchThumb: {
|
|
@@ -35,7 +35,7 @@ declare const LobeSwitchThumb: {
|
|
|
35
35
|
transition,
|
|
36
36
|
children,
|
|
37
37
|
...rest
|
|
38
|
-
}: LobeSwitchThumbProps):
|
|
38
|
+
}: LobeSwitchThumbProps): react_jsx_runtime14.JSX.Element;
|
|
39
39
|
displayName: string;
|
|
40
40
|
};
|
|
41
41
|
declare const LobeSwitchIcon: {
|
|
@@ -48,7 +48,7 @@ declare const LobeSwitchIcon: {
|
|
|
48
48
|
}: LobeSwitchIconProps & {
|
|
49
49
|
children?: React.ReactNode;
|
|
50
50
|
size?: "default" | "small";
|
|
51
|
-
}):
|
|
51
|
+
}): react_jsx_runtime14.JSX.Element;
|
|
52
52
|
displayName: string;
|
|
53
53
|
};
|
|
54
54
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MarkdownProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react1 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Markdown/Markdown.d.ts
|
|
5
|
-
declare const Markdown:
|
|
5
|
+
declare const Markdown: react1.NamedExoticComponent<MarkdownProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Markdown };
|
|
8
8
|
//# sourceMappingURL=Markdown.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TypographyProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react0 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Markdown/Typography.d.ts
|
|
5
|
-
declare const Typography:
|
|
5
|
+
declare const Typography: react0.NamedExoticComponent<TypographyProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Typography };
|
|
8
8
|
//# sourceMappingURL=Typography.d.mts.map
|