@lobehub/ui 6.15.2 → 6.15.4
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/A/index.d.mts +1 -2
- package/es/Accordion/Accordion.d.mts +1 -2
- package/es/Accordion/atoms.d.mts +1 -2
- package/es/Accordion/style.d.mts +1 -2
- package/es/Accordion/type.d.mts +1 -2
- package/es/ActionIcon/ActionIcon.d.mts +1 -2
- package/es/ActionIcon/style.d.mts +1 -2
- package/es/ActionIcon/type.d.mts +1 -2
- package/es/ActionIconGroup/ActionIconGroup.d.mts +1 -2
- package/es/ActionIconGroup/ActionIconGroup.mjs.map +1 -1
- package/es/ActionIconGroup/type.d.mts +1 -2
- package/es/AgentAvatar/AgentAvatar.d.mts +1 -2
- package/es/AgentAvatar/type.d.mts +1 -2
- package/es/AgentAvatar/utils.d.mts +1 -2
- package/es/Alert/Alert.d.mts +1 -2
- package/es/Alert/style.d.mts +1 -2
- package/es/Alert/type.d.mts +1 -2
- package/es/Anchor/Anchor.d.mts +1 -2
- package/es/Anchor/Anchor.mjs +1 -1
- package/es/Anchor/type.d.mts +1 -2
- package/es/AutoComplete/AutoComplete.d.mts +1 -2
- package/es/AutoComplete/style.d.mts +2 -3
- package/es/AutoComplete/type.d.mts +1 -2
- package/es/Avatar/AvatarGroup/index.d.mts +1 -2
- package/es/Avatar/index.d.mts +1 -2
- package/es/Avatar/type.d.mts +1 -2
- package/es/Badge/Badge.d.mts +1 -2
- package/es/Badge/type.d.mts +1 -2
- package/es/Block/Block.d.mts +1 -2
- package/es/Block/type.d.mts +1 -2
- package/es/Breadcrumb/Breadcrumb.d.mts +1 -2
- package/es/Breadcrumb/type.d.mts +1 -2
- package/es/Burger/Burger.d.mts +1 -2
- package/es/Burger/type.d.mts +1 -2
- package/es/Button/Button.d.mts +1 -2
- package/es/Button/SplitButton.d.mts +1 -2
- package/es/Button/SplitButton.mjs.map +1 -1
- package/es/Button/style.d.mts +1 -2
- package/es/Button/type.d.mts +1 -2
- package/es/Carousel/Carousel.d.mts +1 -2
- package/es/Carousel/type.d.mts +1 -2
- package/es/Checkbox/Checkbox.d.mts +1 -2
- package/es/Checkbox/Checkbox.mjs +6 -6
- package/es/Checkbox/Checkbox.mjs.map +1 -1
- package/es/Checkbox/CheckboxGroup.d.mts +1 -2
- package/es/Checkbox/CheckboxGroup.mjs +5 -5
- package/es/Checkbox/CheckboxGroup.mjs.map +1 -1
- package/es/Checkbox/style.d.mts +1 -2
- package/es/Checkbox/type.d.mts +1 -2
- package/es/CodeDiff/CodeDiff.d.mts +1 -2
- package/es/CodeDiff/PatchDiff.d.mts +1 -2
- package/es/CodeDiff/PatchDiff.mjs +5 -5
- package/es/CodeDiff/PatchDiff.mjs.map +1 -1
- package/es/CodeDiff/theme.mjs.map +1 -1
- package/es/CodeDiff/type.d.mts +1 -2
- package/es/CodeEditor/CodeEditor.d.mts +1 -2
- package/es/CodeEditor/type.d.mts +1 -2
- package/es/Collapsible/Collapsible.d.mts +1 -2
- package/es/Collapsible/Collapsible.mjs +5 -5
- package/es/Collapsible/Collapsible.mjs.map +1 -1
- package/es/Collapsible/type.d.mts +1 -2
- package/es/ColorPicker/ColorPicker.d.mts +1 -2
- package/es/ColorPicker/type.d.mts +1 -2
- package/es/ColorSwatches/ColorSwatches.d.mts +1 -2
- package/es/ColorSwatches/type.d.mts +1 -2
- package/es/ConfigProvider/AppElementContext.d.mts +1 -2
- package/es/ConfigProvider/index.d.mts +1 -2
- package/es/ContextMenu/ContextMenuHost.d.mts +1 -2
- package/es/ContextMenu/ContextMenuTrigger.d.mts +1 -2
- package/es/ContextMenu/renderItems.d.mts +1 -1
- package/es/ContextMenu/store.d.mts +1 -2
- package/es/ContextMenu/type.d.mts +1 -2
- package/es/CopyButton/CopyButton.d.mts +1 -2
- package/es/CopyButton/type.d.mts +1 -2
- package/es/DatePicker/DatePicker.d.mts +1 -2
- package/es/DatePicker/DateRangePicker.d.mts +1 -2
- package/es/DatePicker/DayjsDatePicker.d.mts +1 -2
- package/es/DatePicker/DayjsDateRangePicker.d.mts +1 -2
- package/es/DatePicker/RangePicker.mjs.map +1 -1
- package/es/DatePicker/SinglePicker.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Popup/Footer.mjs +2 -2
- package/es/DatePicker/core/PickerInput/Popup/Footer.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Popup/PopupPanel.mjs +4 -4
- package/es/DatePicker/core/PickerInput/Popup/PopupPanel.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Popup/index.mjs +14 -14
- package/es/DatePicker/core/PickerInput/Popup/index.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/RangePicker.d.mts +3 -4
- package/es/DatePicker/core/PickerInput/RangePicker.mjs +11 -11
- package/es/DatePicker/core/PickerInput/RangePicker.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Selector/ClearIcon.mjs +2 -2
- package/es/DatePicker/core/PickerInput/Selector/ClearIcon.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Selector/Icon.mjs +2 -2
- package/es/DatePicker/core/PickerInput/Selector/Icon.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Selector/Input.mjs +15 -15
- package/es/DatePicker/core/PickerInput/Selector/Input.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Selector/RangeSelector.d.mts +1 -2
- package/es/DatePicker/core/PickerInput/Selector/RangeSelector.mjs +11 -11
- package/es/DatePicker/core/PickerInput/Selector/RangeSelector.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/HoverSelector.mjs +2 -2
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/HoverSelector.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/index.mjs +6 -6
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/index.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Selector/hooks/useInputProps.mjs +4 -4
- package/es/DatePicker/core/PickerInput/Selector/hooks/useInputProps.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/Selector/hooks/useRootProps.mjs +2 -2
- package/es/DatePicker/core/PickerInput/Selector/hooks/useRootProps.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/SinglePicker.d.mts +6 -7
- package/es/DatePicker/core/PickerInput/SinglePicker.mjs +8 -8
- package/es/DatePicker/core/PickerInput/SinglePicker.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/context.mjs +2 -2
- package/es/DatePicker/core/PickerInput/context.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useCellRender.mjs +3 -3
- package/es/DatePicker/core/PickerInput/hooks/useCellRender.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useFieldFormat.mjs +2 -2
- package/es/DatePicker/core/PickerInput/hooks/useFieldFormat.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useFieldsInvalidate.mjs +3 -3
- package/es/DatePicker/core/PickerInput/hooks/useFieldsInvalidate.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useFilledProps.mjs +5 -5
- package/es/DatePicker/core/PickerInput/hooks/useFilledProps.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useFocusEvents.mjs +2 -2
- package/es/DatePicker/core/PickerInput/hooks/useFocusEvents.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useFocusLock.mjs +2 -2
- package/es/DatePicker/core/PickerInput/hooks/useFocusLock.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useHoverStore.mjs +3 -3
- package/es/DatePicker/core/PickerInput/hooks/useHoverStore.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useLockEffect.mjs +2 -2
- package/es/DatePicker/core/PickerInput/hooks/useLockEffect.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/usePickerRef.mjs +3 -3
- package/es/DatePicker/core/PickerInput/hooks/usePickerRef.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/usePresets.mjs +2 -2
- package/es/DatePicker/core/PickerInput/hooks/usePresets.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useRangePickerValue.mjs +4 -4
- package/es/DatePicker/core/PickerInput/hooks/useRangePickerValue.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useRangeValue.mjs +3 -3
- package/es/DatePicker/core/PickerInput/hooks/useRangeValue.mjs.map +1 -1
- package/es/DatePicker/core/PickerInput/hooks/useRangeValueChange.mjs +5 -5
- package/es/DatePicker/core/PickerInput/hooks/useRangeValueChange.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/PanelBody.mjs +2 -2
- package/es/DatePicker/core/PickerPanel/PanelBody.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/PanelHeader.mjs +6 -6
- package/es/DatePicker/core/PickerPanel/PanelHeader.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/ClockDial.mjs +3 -3
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/ClockDial.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/geometry.mjs +1 -1
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/index.mjs +2 -2
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/index.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/TimeColumn.mjs +3 -3
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/TimeColumn.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/index.mjs +2 -2
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/index.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/useScrollTo.mjs +5 -5
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/useScrollTo.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/useTimeState.mjs +7 -7
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/useTimeState.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/context.mjs +6 -6
- package/es/DatePicker/core/PickerPanel/context.mjs.map +1 -1
- package/es/DatePicker/core/PickerPanel/index.mjs +12 -12
- package/es/DatePicker/core/PickerPanel/index.mjs.map +1 -1
- package/es/DatePicker/core/generate/index.d.mts +1 -2
- package/es/DatePicker/core/hooks/react.mjs +8 -8
- package/es/DatePicker/core/hooks/react.mjs.map +1 -1
- package/es/DatePicker/core/hooks/useSyncState.mjs +3 -3
- package/es/DatePicker/core/hooks/useSyncState.mjs.map +1 -1
- package/es/DatePicker/core/hooks/useTimeInfo.mjs +6 -6
- package/es/DatePicker/core/hooks/useTimeInfo.mjs.map +1 -1
- package/es/DatePicker/core/index.d.mts +28 -0
- package/es/DatePicker/core/interface.d.mts +1 -2
- package/es/DatePicker/generatePicker.d.mts +1 -2
- package/es/DatePicker/legacyDate.mjs.map +1 -1
- package/es/DatePicker/locale.d.mts +1 -2
- package/es/DatePicker/locale.mjs.map +1 -1
- package/es/DatePicker/type.d.mts +1 -2
- package/es/DatePicker/usePickerShared.mjs.map +1 -1
- package/es/Descriptions/Descriptions.d.mts +1 -2
- package/es/Descriptions/type.d.mts +1 -2
- package/es/Divider/Divider.d.mts +1 -2
- package/es/Divider/type.d.mts +1 -2
- package/es/DownloadButton/DownloadButton.d.mts +1 -2
- package/es/DownloadButton/type.d.mts +1 -2
- package/es/DraggablePanel/DraggablePanel.d.mts +1 -2
- package/es/DraggablePanel/atoms.d.mts +1 -2
- package/es/DraggablePanel/context.d.mts +1 -2
- package/es/DraggablePanel/core/axes.d.mts +1 -2
- package/es/DraggablePanel/core/controller.d.mts +1 -2
- package/es/DraggablePanel/type.d.mts +1 -2
- package/es/DraggableSideNav/DraggableSideNav.d.mts +1 -2
- package/es/DraggableSideNav/type.d.mts +1 -2
- package/es/Drawer/Drawer.d.mts +1 -2
- package/es/Drawer/atoms.d.mts +1 -2
- package/es/Drawer/constants.d.mts +1 -2
- package/es/Drawer/type.d.mts +1 -2
- package/es/DropdownMenu/DropdownMenu.d.mts +1 -2
- package/es/DropdownMenu/atoms.d.mts +1 -2
- package/es/DropdownMenu/renderItems.d.mts +1 -2
- package/es/DropdownMenu/style.d.mts +1 -2
- package/es/DropdownMenu/type.d.mts +1 -2
- package/es/EditableText/ControlInput.d.mts +1 -2
- package/es/EditableText/EditableText.d.mts +1 -2
- package/es/EditableText/EditableText.mjs.map +1 -1
- package/es/EditableText/type.d.mts +1 -2
- package/es/EditorSlashMenu/EditorSlashMenu.d.mts +1 -2
- package/es/EditorSlashMenu/EditorSlashMenu.mjs.map +1 -1
- package/es/EditorSlashMenu/atoms.d.mts +1 -2
- package/es/EditorSlashMenu/type.d.mts +1 -2
- package/es/EmojiPicker/EmojiPicker.d.mts +1 -2
- package/es/EmojiPicker/type.d.mts +1 -2
- package/es/Empty/Empty.d.mts +1 -2
- package/es/Empty/Empty.mjs.map +1 -1
- package/es/Empty/type.d.mts +1 -2
- package/es/FileTypeIcon/FileTypeIcon.d.mts +1 -2
- package/es/FileTypeIcon/type.d.mts +1 -2
- package/es/Flex/Center.d.mts +1 -2
- package/es/Flex/FlexBasic.d.mts +1 -2
- package/es/Flex/type.d.mts +1 -2
- package/es/FloatingPanel/FloatingPanel.d.mts +1 -2
- package/es/FloatingPanel/type.d.mts +1 -2
- package/es/FloatingSheet/FloatingSheet.d.mts +1 -2
- package/es/FloatingSheet/type.d.mts +1 -2
- package/es/FluentEmoji/FluentEmoji.d.mts +1 -2
- package/es/FluentEmoji/type.d.mts +1 -2
- package/es/FluentEmoji/utils.d.mts +1 -2
- package/es/FocusScope/FocusScope.d.mts +1 -2
- package/es/FocusScope/store.d.mts +1 -2
- package/es/FocusScope/style.d.mts +1 -2
- package/es/FocusScope/useScopeArrowNav.d.mts +1 -2
- package/es/FocusScope/useScopeSwitcher.d.mts +1 -2
- package/es/FontLoader/index.d.mts +1 -2
- package/es/FontLoader/index.mjs +2 -2
- package/es/FontLoader/index.mjs.map +1 -1
- package/es/Form/Form.mjs +5 -5
- package/es/Form/Form.mjs.map +1 -1
- package/es/Form/components/FormDivider.d.mts +1 -2
- package/es/Form/components/FormField.d.mts +1 -2
- package/es/Form/components/FormFlatGroup.d.mts +1 -2
- package/es/Form/components/FormFooter.d.mts +1 -2
- package/es/Form/components/FormGroup.d.mts +1 -2
- package/es/Form/components/FormSubmitFooter.d.mts +1 -2
- package/es/Form/components/FormTitle.d.mts +1 -2
- package/es/Form/context.d.mts +1 -2
- package/es/Form/index.d.mts +1 -2
- package/es/Form/type.d.mts +1 -2
- package/es/FormKit/Field.d.mts +1 -2
- package/es/FormKit/List.d.mts +1 -2
- package/es/FormKit/SubmitFooter.d.mts +1 -2
- package/es/FormKit/context.d.mts +1 -2
- package/es/FormKit/engine/tanstack.mjs.map +1 -1
- package/es/FormKit/engine/types.d.mts +1 -2
- package/es/FormKit/index.d.mts +1 -2
- package/es/FormKit/schema.d.mts +1 -2
- package/es/FormKit/type.d.mts +1 -2
- package/es/FormKit/useForm.d.mts +1 -2
- package/es/FormKit/useWatch.d.mts +1 -2
- package/es/Freeze/Freeze.d.mts +1 -2
- package/es/Freeze/type.d.mts +1 -2
- package/es/GlobalFocusRing/index.d.mts +1 -2
- package/es/Grid/Grid.d.mts +1 -2
- package/es/Grid/type.d.mts +1 -2
- package/es/GroupAvatar/GroupAvatar.d.mts +1 -2
- package/es/GroupAvatar/type.d.mts +1 -2
- package/es/GuideCard/GuideCard.d.mts +1 -2
- package/es/GuideCard/type.d.mts +1 -2
- package/es/Header/Header.d.mts +1 -2
- package/es/Header/type.d.mts +1 -2
- package/es/Highlighter/Highlighter.d.mts +1 -2
- package/es/Highlighter/SyntaxHighlighter/index.d.mts +1 -2
- package/es/Highlighter/const.d.mts +1 -2
- package/es/Highlighter/theme/lobe-highlights-theme.d.mts +1 -2
- package/es/Highlighter/theme/lobe-theme.d.mts +1 -2
- package/es/Highlighter/type.d.mts +1 -2
- package/es/Hotkey/Hotkey.d.mts +1 -2
- package/es/Hotkey/const.d.mts +1 -2
- package/es/Hotkey/type.d.mts +1 -2
- package/es/Hotkey/utils.d.mts +1 -2
- package/es/HotkeyInput/HotkeyInput.d.mts +1 -2
- package/es/HotkeyInput/type.d.mts +1 -2
- package/es/HtmlPreview/HtmlPreview.d.mts +1 -2
- package/es/HtmlPreview/HtmlPreview.mjs.map +1 -1
- package/es/HtmlPreview/Iframe.d.mts +1 -2
- package/es/HtmlPreview/Iframe.mjs.map +1 -1
- package/es/HtmlPreview/const.d.mts +1 -2
- package/es/HtmlPreview/injectAutoHeightScript.d.mts +1 -2
- package/es/HtmlPreview/type.d.mts +1 -2
- package/es/Icon/Icon.d.mts +1 -2
- package/es/Icon/components/IconProvider.d.mts +1 -2
- package/es/Icon/type.d.mts +1 -2
- package/es/Image/PreviewGroup.d.mts +1 -2
- package/es/Image/index.d.mts +1 -2
- package/es/Image/type.d.mts +1 -2
- package/es/Image/useImagePreview.d.mts +1 -2
- package/es/Image/viewer/geometry.d.mts +1 -2
- package/es/Image/viewer/registry.d.mts +1 -1
- package/es/ImageSelect/ImageSelect.d.mts +1 -2
- package/es/ImageSelect/type.d.mts +1 -2
- package/es/Input/Input.d.mts +1 -2
- package/es/Input/Input.mjs +5 -5
- package/es/Input/Input.mjs.map +1 -1
- package/es/Input/InputNumber.d.mts +1 -2
- package/es/Input/InputOTP.d.mts +1 -2
- package/es/Input/InputPassword.d.mts +1 -2
- package/es/Input/TextArea.d.mts +1 -2
- package/es/Input/style.d.mts +1 -2
- package/es/Input/type.d.mts +1 -2
- package/es/Layout/components/LayoutFooter.d.mts +1 -2
- package/es/Layout/components/LayoutHeader.d.mts +1 -2
- package/es/Layout/components/LayoutMain.d.mts +1 -2
- package/es/Layout/components/LayoutSidebar.d.mts +1 -2
- package/es/Layout/components/LayoutSidebarInner.d.mts +1 -2
- package/es/Layout/components/LayoutToc.d.mts +1 -2
- package/es/Layout/index.d.mts +1 -2
- package/es/Layout/type.d.mts +1 -2
- package/es/List/List.d.mts +1 -2
- package/es/List/ListRow.d.mts +1 -1
- package/es/List/type.d.mts +1 -2
- package/es/Markdown/Markdown.d.mts +1 -2
- package/es/Markdown/Typography.d.mts +1 -2
- package/es/Markdown/components/SearchResultCards/index.d.mts +1 -2
- package/es/Markdown/plugins/rehypeCustomFootnotes.d.mts +1 -2
- package/es/Markdown/plugins/rehypeKatexDir.d.mts +1 -2
- package/es/Markdown/plugins/remarkBr.d.mts +1 -2
- package/es/Markdown/plugins/remarkColor.d.mts +1 -2
- package/es/Markdown/plugins/remarkCustomFootnotes.d.mts +1 -2
- package/es/Markdown/plugins/remarkGfmPlus.d.mts +1 -2
- package/es/Markdown/plugins/remarkVideo.d.mts +1 -2
- package/es/Markdown/type.d.mts +1 -2
- package/es/MaskShadow/MaskShadow.d.mts +1 -2
- package/es/MaskShadow/type.d.mts +1 -2
- package/es/MaterialFileTypeIcon/MaterialFileTypeIcon.d.mts +1 -2
- package/es/MaterialFileTypeIcon/icon-map.json.d.mts +1 -2
- package/es/MaterialFileTypeIcon/{icon-map.mjs → icon-map.json.mjs} +1 -1
- package/es/MaterialFileTypeIcon/icon-map.json.mjs.map +1 -0
- package/es/MaterialFileTypeIcon/type.d.mts +1 -2
- package/es/MaterialFileTypeIcon/utils.mjs +1 -1
- package/es/Mermaid/Mermaid.d.mts +1 -2
- package/es/Mermaid/SyntaxMermaid/index.d.mts +1 -2
- package/es/Mermaid/const.d.mts +1 -2
- package/es/Mermaid/index.d.mts +1 -2
- package/es/Mermaid/themes.d.mts +2 -3
- package/es/Mermaid/type.d.mts +1 -2
- package/es/Meta/Meta.d.mts +1 -2
- package/es/Modal/Modal.d.mts +1 -2
- package/es/Modal/atoms.d.mts +1 -2
- package/es/Modal/constants.d.mts +1 -2
- package/es/Modal/context.d.mts +1 -2
- package/es/Modal/imperative.d.mts +1 -2
- package/es/Modal/type.d.mts +1 -2
- package/es/MotionProvider/index.d.mts +1 -2
- package/es/Pagination/Pagination.d.mts +1 -2
- package/es/Pagination/type.d.mts +1 -2
- package/es/Popover/ArrowIcon.d.mts +1 -2
- package/es/Popover/Popover.d.mts +1 -2
- package/es/Popover/PopoverGroup.d.mts +1 -2
- package/es/Popover/PopoverPortal.d.mts +1 -2
- package/es/Popover/atoms.d.mts +1 -2
- package/es/Popover/context.d.mts +1 -2
- package/es/Popover/groupContext.d.mts +1 -2
- package/es/Popover/type.d.mts +10 -12
- package/es/ProTable/ProTable.d.mts +1 -2
- package/es/ProTable/ProTable.mjs.map +1 -1
- package/es/ProTable/hooks/useFetchData.mjs.map +1 -1
- package/es/ProTable/hooks/useFullscreen.mjs.map +1 -1
- package/es/ProTable/hooks/useProRequest.mjs.map +1 -1
- package/es/ProTable/locale.d.mts +1 -2
- package/es/ProTable/parts/LightFilter.mjs.map +1 -1
- package/es/ProTable/parts/renderValue.mjs.map +1 -1
- package/es/ProTable/type.d.mts +1 -2
- package/es/Progress/Progress.d.mts +1 -2
- package/es/Progress/type.d.mts +1 -2
- package/es/ProgressiveBlur/ProgressiveBlur.d.mts +1 -2
- package/es/ProgressiveBlur/type.d.mts +1 -2
- package/es/QRCode/QRCode.d.mts +1 -2
- package/es/QRCode/type.d.mts +1 -2
- package/es/Radio/Radio.d.mts +1 -2
- package/es/Radio/Radio.mjs +6 -6
- package/es/Radio/Radio.mjs.map +1 -1
- package/es/Radio/RadioGroup.d.mts +1 -2
- package/es/Radio/RadioGroup.mjs +5 -5
- package/es/Radio/RadioGroup.mjs.map +1 -1
- package/es/Radio/style.d.mts +1 -2
- package/es/Radio/type.d.mts +1 -2
- package/es/Rate/Rate.d.mts +1 -2
- package/es/Rate/type.d.mts +1 -2
- package/es/Result/Result.d.mts +1 -2
- package/es/Result/type.d.mts +1 -2
- package/es/ScrollArea/ScrollArea.d.mts +1 -2
- package/es/ScrollArea/atoms.d.mts +1 -2
- package/es/ScrollArea/type.d.mts +1 -2
- package/es/ScrollShadow/ScrollShadow.d.mts +1 -2
- package/es/ScrollShadow/type.d.mts +1 -2
- package/es/SearchBar/SearchBar.d.mts +1 -2
- package/es/SearchBar/type.d.mts +1 -2
- package/es/Segmented/Segmented.d.mts +1 -2
- package/es/Segmented/Segmented.mjs.map +1 -1
- package/es/Segmented/atoms.d.mts +1 -2
- package/es/Segmented/type.d.mts +3 -4
- package/es/Select/Select.d.mts +1 -2
- package/es/Select/Select.mjs +9 -9
- package/es/Select/Select.mjs.map +1 -1
- package/es/Select/atoms.d.mts +1 -2
- package/es/Select/hooks.mjs.map +1 -1
- package/es/Select/type.d.mts +1 -2
- package/es/SideNav/SideNav.d.mts +1 -2
- package/es/SideNav/type.d.mts +1 -2
- package/es/Skeleton/SkeletonAvatar.d.mts +1 -2
- package/es/Skeleton/SkeletonText.d.mts +1 -2
- package/es/Skeleton/index.d.mts +1 -2
- package/es/Skeleton/type.d.mts +1 -2
- package/es/Slider/Slider.d.mts +1 -2
- package/es/Slider/Slider.mjs +7 -7
- package/es/Slider/Slider.mjs.map +1 -1
- package/es/Slider/SliderWithInput.d.mts +1 -2
- package/es/Slider/style.d.mts +1 -2
- package/es/Slider/type.d.mts +1 -2
- package/es/Snippet/Snippet.d.mts +1 -2
- package/es/Snippet/type.d.mts +1 -2
- package/es/SortableList/SortableList.d.mts +1 -2
- package/es/SortableList/components/DragHandle.d.mts +1 -2
- package/es/SortableList/components/SortableItem.d.mts +1 -2
- package/es/SortableList/type.d.mts +1 -2
- package/es/Spin/Spin.d.mts +1 -2
- package/es/Spin/type.d.mts +1 -2
- package/es/Statistic/Statistic.d.mts +1 -2
- package/es/Statistic/formatValue.d.mts +1 -2
- package/es/Statistic/type.d.mts +1 -2
- package/es/Steps/Steps.d.mts +1 -2
- package/es/Steps/type.d.mts +1 -2
- package/es/Switch/Switch.d.mts +1 -2
- package/es/Switch/atoms.d.mts +1 -2
- package/es/Switch/style.d.mts +1 -2
- package/es/Switch/type.d.mts +1 -2
- package/es/Table/Column.d.mts +1 -2
- package/es/Table/ColumnGroup.d.mts +1 -2
- package/es/Table/Table.d.mts +1 -2
- package/es/Table/atoms/cells.d.mts +1 -2
- package/es/Table/atoms/layout.d.mts +1 -2
- package/es/Table/engine/types.d.mts +1 -1
- package/es/Table/internal.d.mts +1 -1
- package/es/Table/pipeline/columnUtils.d.mts +1 -2
- package/es/Table/pipeline/selectionUtils.d.mts +2 -3
- package/es/Table/render/SelectionCells.mjs.map +1 -1
- package/es/Table/render/Summary.d.mts +2 -3
- package/es/Table/store/createTableStore.d.mts +1 -1
- package/es/Table/type.d.mts +1 -2
- package/es/Tabs/Tabs.d.mts +1 -2
- package/es/Tabs/atoms.d.mts +1 -2
- package/es/Tabs/style.d.mts +1 -2
- package/es/Tabs/type.d.mts +1 -2
- package/es/Tag/Tag.d.mts +1 -2
- package/es/Tag/type.d.mts +1 -2
- package/es/Tag/utils.d.mts +1 -2
- package/es/Text/Text.d.mts +1 -2
- package/es/Text/Text.mjs.map +1 -1
- package/es/Text/style.d.mts +1 -2
- package/es/Text/type.d.mts +1 -2
- package/es/Toast/imperative.d.mts +1 -2
- package/es/Toast/type.d.mts +1 -2
- package/es/Toc/Toc.d.mts +1 -2
- package/es/Toc/Toc.mjs +1 -1
- package/es/Toc/toFlatTocItems.d.mts +1 -2
- package/es/Toc/tocPath.d.mts +1 -2
- package/es/Toc/type.d.mts +1 -2
- package/es/ToggleGroup/ToggleGroup.d.mts +1 -2
- package/es/ToggleGroup/atoms.d.mts +1 -2
- package/es/ToggleGroup/style.d.mts +1 -2
- package/es/ToggleGroup/type.d.mts +1 -2
- package/es/Tooltip/Tooltip.d.mts +1 -2
- package/es/Tooltip/TooltipGroup.d.mts +1 -2
- package/es/Tooltip/type.d.mts +8 -10
- package/es/Tree/Tree.d.mts +1 -2
- package/es/Tree/style.d.mts +1 -2
- package/es/Tree/type.d.mts +1 -2
- package/es/Tree/utils.d.mts +1 -2
- package/es/Upload/Upload.d.mts +1 -2
- package/es/Upload/Upload.mjs +5 -5
- package/es/Upload/Upload.mjs.map +1 -1
- package/es/Upload/UploadDragger.d.mts +1 -2
- package/es/Upload/type.d.mts +1 -2
- package/es/Video/index.d.mts +1 -2
- package/es/Video/parts/Caption.d.mts +1 -2
- package/es/Video/parts/CenterPlay.d.mts +1 -2
- package/es/Video/parts/CenterPlay.mjs.map +1 -1
- package/es/Video/parts/Controls.d.mts +1 -2
- package/es/Video/parts/Frame.d.mts +1 -2
- package/es/Video/parts/LoadError.d.mts +1 -2
- package/es/Video/parts/Root.d.mts +1 -2
- package/es/Video/parts/SectionList.d.mts +1 -2
- package/es/Video/parts/Timeline.d.mts +1 -2
- package/es/Video/store.mjs.map +1 -1
- package/es/Video/type.d.mts +1 -2
- package/es/Video/useVideo.d.mts +1 -2
- package/es/_virtual/_rolldown/runtime.mjs +4 -4
- package/es/awesome/AgentSkillCard/AgentSkillCard.d.mts +1 -2
- package/es/awesome/AgentSkillCard/AgentSkillCard.mjs +2 -2
- package/es/awesome/AgentSkillCard/AgentSkillCard.mjs.map +1 -1
- package/es/awesome/AgentSkillCard/agents.d.mts +1 -2
- package/es/awesome/AgentSkillCard/type.d.mts +2 -3
- package/es/awesome/AuroraBackground/AuroraBackground.d.mts +1 -2
- package/es/awesome/AuroraBackground/type.d.mts +1 -2
- package/es/awesome/BentoGrid/BentoCard.d.mts +1 -2
- package/es/awesome/BentoGrid/BentoGrid.d.mts +1 -2
- package/es/awesome/BentoGrid/type.d.mts +1 -2
- package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +1 -2
- package/es/awesome/BottomGradientButton/type.d.mts +1 -2
- package/es/awesome/CodeShowcase/CodeShowcase.d.mts +1 -2
- package/es/awesome/CodeShowcase/type.d.mts +1 -2
- package/es/awesome/FeatureGrid/FeatureGrid.d.mts +1 -2
- package/es/awesome/FeatureGrid/type.d.mts +1 -2
- package/es/awesome/Features/Features.d.mts +1 -2
- package/es/awesome/Features/type.d.mts +1 -2
- package/es/awesome/FluidGradient/FluidGradient.d.mts +1 -2
- package/es/awesome/FluidGradient/type.d.mts +1 -2
- package/es/awesome/Giscus/Giscus.d.mts +1 -2
- package/es/awesome/Giscus/type.d.mts +1 -2
- package/es/awesome/GradientButton/GradientButton.d.mts +1 -2
- package/es/awesome/GradientButton/type.d.mts +1 -2
- package/es/awesome/Grainient/Grainient.d.mts +1 -2
- package/es/awesome/Grainient/type.d.mts +1 -2
- package/es/awesome/GridBackground/GridBackground.d.mts +1 -2
- package/es/awesome/GridBackground/GridShowcase.d.mts +1 -2
- package/es/awesome/GridBackground/type.d.mts +1 -2
- package/es/awesome/Hero/Hero.d.mts +1 -2
- package/es/awesome/Hero/type.d.mts +1 -2
- package/es/awesome/InstallBanner/InstallBanner.d.mts +1 -2
- package/es/awesome/InstallBanner/type.d.mts +1 -2
- package/es/awesome/LandingHero/LandingHero.d.mts +1 -2
- package/es/awesome/LandingHero/type.d.mts +1 -2
- package/es/awesome/LandingSection/LandingSection.d.mts +1 -2
- package/es/awesome/LandingSection/type.d.mts +1 -2
- package/es/awesome/LogoMarquee/LogoMarquee.d.mts +1 -2
- package/es/awesome/LogoMarquee/type.d.mts +1 -2
- package/es/awesome/Spotlight/Spotlight.d.mts +1 -2
- package/es/awesome/Spotlight/type.d.mts +1 -2
- package/es/awesome/SpotlightCard/SpotlightCard.d.mts +1 -2
- package/es/awesome/SpotlightCard/SpotlightCard.mjs.map +1 -1
- package/es/awesome/SpotlightCard/type.d.mts +1 -2
- package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +1 -2
- package/es/awesome/TypewriterEffect/type.d.mts +1 -2
- package/es/awesome/landingActions.d.mts +1 -2
- package/es/awesome/landingLink.d.mts +1 -2
- package/es/awesome/landingTokens.d.mts +1 -2
- package/es/brand/BrandLoading/index.d.mts +1 -2
- package/es/brand/LobeChat/index.d.mts +1 -2
- package/es/brand/LobeChatText/index.d.mts +1 -2
- package/es/brand/LobeHub/index.d.mts +1 -2
- package/es/brand/LobeHubText/index.d.mts +1 -2
- package/es/brand/Logo3d/index.d.mts +1 -2
- package/es/brand/LogoFlat/index.d.mts +1 -2
- package/es/chat/BackBottom/BackBottom.d.mts +1 -2
- package/es/chat/BackBottom/BackBottom.mjs.map +1 -1
- package/es/chat/BackBottom/type.d.mts +1 -2
- package/es/chat/ChatHeader/ChatHeaderTitle.d.mts +1 -2
- package/es/chat/ChatHeader/index.d.mts +1 -2
- package/es/chat/ChatHeader/type.d.mts +1 -2
- package/es/chat/ChatInputArea/components/ChatInputActionBar.d.mts +1 -2
- package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +1 -2
- package/es/chat/ChatInputArea/components/ChatSendButton.d.mts +1 -2
- package/es/chat/ChatInputArea/index.d.mts +1 -2
- package/es/chat/ChatInputArea/type.d.mts +1 -2
- package/es/chat/ChatItem/ChatItem.d.mts +1 -2
- package/es/chat/ChatItem/type.d.mts +1 -2
- package/es/chat/ChatList/ChatList.d.mts +1 -2
- package/es/chat/ChatList/components/ChatActionsBar.d.mts +1 -2
- package/es/chat/ChatList/type.d.mts +1 -2
- package/es/chat/EditableMessage/EditableMessage.d.mts +1 -2
- package/es/chat/EditableMessage/type.d.mts +1 -2
- package/es/chat/EditableMessageList/EditableMessageList.d.mts +1 -2
- package/es/chat/EditableMessageList/type.d.mts +1 -2
- package/es/chat/LoadingDots/LoadingDots.d.mts +1 -2
- package/es/chat/LoadingDots/type.d.mts +1 -2
- package/es/chat/MessageInput/MessageInput.d.mts +1 -2
- package/es/chat/MessageInput/type.d.mts +1 -2
- package/es/chat/MessageModal/MessageModal.d.mts +1 -2
- package/es/chat/MessageModal/type.d.mts +1 -2
- package/es/chat/TokenTag/TokenTag.d.mts +1 -2
- package/es/chat/TokenTag/type.d.mts +1 -2
- package/es/chat/types/chatMessage.d.mts +1 -2
- package/es/chat/types/error.d.mts +1 -2
- package/es/chat/types/llm.d.mts +1 -2
- package/es/chat/types/meta.d.mts +1 -2
- package/es/color/ColorScales/index.d.mts +1 -2
- package/es/color/CssVar/index.d.mts +1 -2
- package/es/color/colors/blue.d.mts +1 -2
- package/es/color/colors/cyan.d.mts +1 -2
- package/es/color/colors/geekblue.d.mts +1 -2
- package/es/color/colors/gold.d.mts +1 -2
- package/es/color/colors/gray.d.mts +1 -2
- package/es/color/colors/green.d.mts +1 -2
- package/es/color/colors/index.d.mts +1 -2
- package/es/color/colors/index.mjs.map +1 -1
- package/es/color/colors/lime.d.mts +1 -2
- package/es/color/colors/magenta.d.mts +1 -2
- package/es/color/colors/orange.d.mts +1 -2
- package/es/color/colors/primary.d.mts +1 -2
- package/es/color/colors/purple.d.mts +1 -2
- package/es/color/colors/red.d.mts +1 -2
- package/es/color/colors/volcano.d.mts +1 -2
- package/es/color/colors/yellow.d.mts +1 -2
- package/es/color/neutrals/index.d.mts +1 -2
- package/es/color/neutrals/mauve.d.mts +1 -2
- package/es/color/neutrals/olive.d.mts +1 -2
- package/es/color/neutrals/sage.d.mts +1 -2
- package/es/color/neutrals/sand.d.mts +1 -2
- package/es/color/neutrals/slate.d.mts +1 -2
- package/es/color/status/index.d.mts +1 -2
- package/es/color/types.d.mts +1 -2
- package/es/dashboard/AuthLayout/Aside.d.mts +1 -2
- package/es/dashboard/AuthLayout/AuthLayout.d.mts +1 -2
- package/es/dashboard/AuthLayout/type.d.mts +1 -2
- package/es/dashboard/AuthTools/AuthLocaleSwitch.d.mts +1 -2
- package/es/dashboard/AuthTools/AuthThemeSwitch.d.mts +1 -2
- package/es/dashboard/AuthTools/type.d.mts +1 -2
- package/es/dashboard/Breadcrumb/Breadcrumb.d.mts +1 -2
- package/es/dashboard/Breadcrumb/type.d.mts +1 -2
- package/es/dashboard/ChartGrid/ChartGrid.d.mts +1 -2
- package/es/dashboard/ChartGrid/type.d.mts +1 -2
- package/es/dashboard/ConsoleNav/ConsoleNav.d.mts +1 -2
- package/es/dashboard/ConsoleNav/Skeleton.d.mts +1 -2
- package/es/dashboard/ConsoleNav/active.d.mts +1 -2
- package/es/dashboard/ConsoleNav/type.d.mts +1 -2
- package/es/dashboard/ConsoleShell/ConsoleBrand.d.mts +1 -2
- package/es/dashboard/ConsoleShell/ConsoleShell.d.mts +1 -2
- package/es/dashboard/ConsoleShell/context.d.mts +1 -2
- package/es/dashboard/ConsoleShell/type.d.mts +1 -2
- package/es/dashboard/FilterSidebar/FilterSidebar.d.mts +1 -2
- package/es/dashboard/FilterSidebar/context.d.mts +2 -3
- package/es/dashboard/FilterSidebar/type.d.mts +1 -2
- package/es/dashboard/FilterStrip/FilterStrip.d.mts +1 -2
- package/es/dashboard/FilterStrip/type.d.mts +1 -2
- package/es/dashboard/LabelWithKey/LabelWithKey.d.mts +1 -2
- package/es/dashboard/LabelWithKey/type.d.mts +1 -2
- package/es/dashboard/MetricStrip/MetricStrip.d.mts +1 -2
- package/es/dashboard/MetricStrip/type.d.mts +1 -2
- package/es/dashboard/PageHeader/PageHeader.d.mts +1 -2
- package/es/dashboard/PageHeader/type.d.mts +1 -2
- package/es/dashboard/PageSkeleton/PageSkeleton.d.mts +1 -2
- package/es/dashboard/PageSkeleton/type.d.mts +1 -2
- package/es/dashboard/PageTabs/PageTabs.d.mts +1 -2
- package/es/dashboard/PageTabs/type.d.mts +1 -2
- package/es/dashboard/PageToolbar/PageToolbar.d.mts +1 -2
- package/es/dashboard/PageToolbar/type.d.mts +1 -2
- package/es/dashboard/PanelSurface/PanelSurface.d.mts +1 -2
- package/es/dashboard/PanelSurface/type.d.mts +1 -2
- package/es/dashboard/RouteProgress/RouteProgress.d.mts +1 -2
- package/es/dashboard/RouteProgress/type.d.mts +1 -2
- package/es/dashboard/Section/Section.d.mts +1 -2
- package/es/dashboard/Section/type.d.mts +1 -2
- package/es/dashboard/StatCard/StatCard.d.mts +1 -2
- package/es/dashboard/StatCard/type.d.mts +1 -2
- package/es/dashboard/Surface/Surface.d.mts +1 -2
- package/es/dashboard/Surface/link.d.mts +1 -2
- package/es/dashboard/Surface/style.d.mts +1 -2
- package/es/dashboard/Surface/type.d.mts +1 -2
- package/es/dashboard/TableIconActions/TableIconActions.d.mts +1 -2
- package/es/dashboard/TableIconActions/type.d.mts +1 -2
- package/es/dashboard/TitleWithTips/TitleWithTips.d.mts +1 -2
- package/es/dashboard/TitleWithTips/type.d.mts +1 -2
- package/es/eslint/index.d.mts +1 -2
- package/es/hooks/useMarkdown/utils.d.mts +1 -2
- package/es/hooks/useScroll.d.mts +1 -2
- package/es/i18n/context.d.mts +1 -2
- package/es/i18n/resources/en/burger.d.mts +1 -2
- package/es/i18n/resources/en/chat.d.mts +1 -2
- package/es/i18n/resources/en/colorPicker.d.mts +1 -2
- package/es/i18n/resources/en/common.d.mts +1 -2
- package/es/i18n/resources/en/datePicker.d.mts +1 -2
- package/es/i18n/resources/en/editableMessage.d.mts +1 -2
- package/es/i18n/resources/en/emojiPicker.d.mts +1 -2
- package/es/i18n/resources/en/form.d.mts +1 -2
- package/es/i18n/resources/en/hotkey.d.mts +1 -2
- package/es/i18n/resources/en/image.d.mts +1 -2
- package/es/i18n/resources/en/index.d.mts +1 -2
- package/es/i18n/resources/en/messageModal.d.mts +1 -2
- package/es/i18n/resources/en/qrCode.d.mts +1 -2
- package/es/i18n/resources/en/sideNav.d.mts +1 -2
- package/es/i18n/resources/en/table.d.mts +1 -2
- package/es/i18n/resources/en/toc.d.mts +1 -2
- package/es/i18n/resources/en/video.d.mts +1 -2
- package/es/i18n/resources/zhCn/burger.d.mts +1 -2
- package/es/i18n/resources/zhCn/chat.d.mts +1 -2
- package/es/i18n/resources/zhCn/colorPicker.d.mts +1 -2
- package/es/i18n/resources/zhCn/common.d.mts +1 -2
- package/es/i18n/resources/zhCn/datePicker.d.mts +1 -2
- package/es/i18n/resources/zhCn/editableMessage.d.mts +1 -2
- package/es/i18n/resources/zhCn/emojiPicker.d.mts +1 -2
- package/es/i18n/resources/zhCn/form.d.mts +1 -2
- package/es/i18n/resources/zhCn/hotkey.d.mts +1 -2
- package/es/i18n/resources/zhCn/image.d.mts +1 -2
- package/es/i18n/resources/zhCn/index.d.mts +1 -2
- package/es/i18n/resources/zhCn/messageModal.d.mts +1 -2
- package/es/i18n/resources/zhCn/qrCode.d.mts +1 -2
- package/es/i18n/resources/zhCn/sideNav.d.mts +1 -2
- package/es/i18n/resources/zhCn/table.d.mts +1 -2
- package/es/i18n/resources/zhCn/toc.d.mts +1 -2
- package/es/i18n/resources/zhCn/video.d.mts +1 -2
- package/es/i18n/types.d.mts +1 -2
- package/es/i18n/useTranslation.d.mts +1 -2
- package/es/icons/Auth0/components/Avatar.d.mts +1 -2
- package/es/icons/Auth0/components/Mono.d.mts +1 -2
- package/es/icons/Auth0/index.d.mts +1 -2
- package/es/icons/Authelia/components/Avatar.d.mts +1 -2
- package/es/icons/Authelia/components/Color.d.mts +1 -2
- package/es/icons/Authelia/components/Mono.d.mts +1 -2
- package/es/icons/Authelia/index.d.mts +1 -2
- package/es/icons/Authentik/components/Avatar.d.mts +1 -2
- package/es/icons/Authentik/components/Color.d.mts +1 -2
- package/es/icons/Authentik/components/Mono.d.mts +1 -2
- package/es/icons/Authentik/index.d.mts +1 -2
- package/es/icons/Casdoor/components/Avatar.d.mts +1 -2
- package/es/icons/Casdoor/components/Color.d.mts +1 -2
- package/es/icons/Casdoor/components/Mono.d.mts +1 -2
- package/es/icons/Casdoor/index.d.mts +1 -2
- package/es/icons/Clerk/components/Avatar.d.mts +1 -2
- package/es/icons/Clerk/components/Color.d.mts +1 -2
- package/es/icons/Clerk/components/Mono.d.mts +1 -2
- package/es/icons/Clerk/index.d.mts +1 -2
- package/es/icons/DingTalk/components/Avatar.d.mts +1 -2
- package/es/icons/DingTalk/components/Color.d.mts +1 -2
- package/es/icons/DingTalk/components/Mono.d.mts +1 -2
- package/es/icons/DingTalk/index.d.mts +1 -2
- package/es/icons/Discord/components/Avatar.d.mts +1 -2
- package/es/icons/Discord/components/Color.d.mts +1 -2
- package/es/icons/Discord/components/Mono.d.mts +1 -2
- package/es/icons/Discord/index.d.mts +1 -2
- package/es/icons/GoogleChat/components/Avatar.d.mts +1 -2
- package/es/icons/GoogleChat/components/Color.d.mts +1 -2
- package/es/icons/GoogleChat/components/Mono.d.mts +1 -2
- package/es/icons/GoogleChat/index.d.mts +1 -2
- package/es/icons/IMessage/components/Avatar.d.mts +1 -2
- package/es/icons/IMessage/components/Color.d.mts +1 -2
- package/es/icons/IMessage/components/Mono.d.mts +1 -2
- package/es/icons/IMessage/index.d.mts +1 -2
- package/es/icons/Lark/components/Avatar.d.mts +1 -2
- package/es/icons/Lark/components/Color.d.mts +1 -2
- package/es/icons/Lark/components/Mono.d.mts +1 -2
- package/es/icons/Lark/index.d.mts +1 -2
- package/es/icons/Line/components/Avatar.d.mts +1 -2
- package/es/icons/Line/components/Color.d.mts +1 -2
- package/es/icons/Line/components/Mono.d.mts +1 -2
- package/es/icons/Line/index.d.mts +1 -2
- package/es/icons/Logto/components/Avatar.d.mts +1 -2
- package/es/icons/Logto/components/Color.d.mts +1 -2
- package/es/icons/Logto/components/Mono.d.mts +1 -2
- package/es/icons/Logto/index.d.mts +1 -2
- package/es/icons/MicrosoftEntra/components/Avatar.d.mts +1 -2
- package/es/icons/MicrosoftEntra/components/Color.d.mts +1 -2
- package/es/icons/MicrosoftEntra/components/Mono.d.mts +1 -2
- package/es/icons/MicrosoftEntra/index.d.mts +1 -2
- package/es/icons/MicrosoftTeams/components/Avatar.d.mts +1 -2
- package/es/icons/MicrosoftTeams/components/Color.d.mts +1 -2
- package/es/icons/MicrosoftTeams/components/Mono.d.mts +1 -2
- package/es/icons/MicrosoftTeams/index.d.mts +1 -2
- package/es/icons/NextAuth/components/Avatar.d.mts +1 -2
- package/es/icons/NextAuth/components/Color.d.mts +1 -2
- package/es/icons/NextAuth/components/Mono.d.mts +1 -2
- package/es/icons/NextAuth/index.d.mts +1 -2
- package/es/icons/QQ/components/Avatar.d.mts +1 -2
- package/es/icons/QQ/components/Color.d.mts +1 -2
- package/es/icons/QQ/components/Mono.d.mts +1 -2
- package/es/icons/QQ/index.d.mts +1 -2
- package/es/icons/Slack/components/Avatar.d.mts +1 -2
- package/es/icons/Slack/components/Color.d.mts +1 -2
- package/es/icons/Slack/components/Mono.d.mts +1 -2
- package/es/icons/Slack/index.d.mts +1 -2
- package/es/icons/Telegram/components/Avatar.d.mts +1 -2
- package/es/icons/Telegram/components/Color.d.mts +1 -2
- package/es/icons/Telegram/components/Mono.d.mts +1 -2
- package/es/icons/Telegram/index.d.mts +1 -2
- package/es/icons/WeChat/components/Avatar.d.mts +1 -2
- package/es/icons/WeChat/components/Color.d.mts +1 -2
- package/es/icons/WeChat/components/Mono.d.mts +1 -2
- package/es/icons/WeChat/index.d.mts +1 -2
- package/es/icons/WhatsApp/components/Avatar.d.mts +1 -2
- package/es/icons/WhatsApp/components/Color.d.mts +1 -2
- package/es/icons/WhatsApp/components/Mono.d.mts +1 -2
- package/es/icons/WhatsApp/index.d.mts +1 -2
- package/es/icons/Zitadel/components/Avatar.d.mts +1 -2
- package/es/icons/Zitadel/components/Color.d.mts +1 -2
- package/es/icons/Zitadel/components/Mono.d.mts +1 -2
- package/es/icons/Zitadel/index.d.mts +1 -2
- package/es/icons/lucideExtra/AndroidIcon.d.mts +1 -2
- package/es/icons/lucideExtra/AppleIcon.d.mts +1 -2
- package/es/icons/lucideExtra/AppstoreIcon.d.mts +1 -2
- package/es/icons/lucideExtra/BotPromptIcon.d.mts +1 -2
- package/es/icons/lucideExtra/BrainOffIcon.d.mts +1 -2
- package/es/icons/lucideExtra/ChromeIcon.d.mts +1 -2
- package/es/icons/lucideExtra/CodepenIcon.d.mts +1 -2
- package/es/icons/lucideExtra/CodesandboxIcon.d.mts +1 -2
- package/es/icons/lucideExtra/CreateBotIcon.d.mts +1 -2
- package/es/icons/lucideExtra/DiscordIcon.d.mts +1 -2
- package/es/icons/lucideExtra/FacebookIcon.d.mts +1 -2
- package/es/icons/lucideExtra/FigmaIcon.d.mts +1 -2
- package/es/icons/lucideExtra/FramerIcon.d.mts +1 -2
- package/es/icons/lucideExtra/GithubIcon.d.mts +1 -2
- package/es/icons/lucideExtra/GitlabIcon.d.mts +1 -2
- package/es/icons/lucideExtra/GlobeOffIcon.d.mts +1 -2
- package/es/icons/lucideExtra/GooglePlayIcon.d.mts +1 -2
- package/es/icons/lucideExtra/GroupBotIcon.d.mts +1 -2
- package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +1 -2
- package/es/icons/lucideExtra/InstagramIcon.d.mts +1 -2
- package/es/icons/lucideExtra/LeftClickIcon.d.mts +1 -2
- package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +1 -2
- package/es/icons/lucideExtra/LinkedinIcon.d.mts +1 -2
- package/es/icons/lucideExtra/McpIcon.d.mts +1 -2
- package/es/icons/lucideExtra/NotionIcon.d.mts +1 -2
- package/es/icons/lucideExtra/PocketIcon.d.mts +1 -2
- package/es/icons/lucideExtra/ProviderIcon.d.mts +1 -2
- package/es/icons/lucideExtra/RailSymbolIcon.d.mts +1 -2
- package/es/icons/lucideExtra/RedditIcon.d.mts +1 -2
- package/es/icons/lucideExtra/RightClickIcon.d.mts +1 -2
- package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +1 -2
- package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +1 -2
- package/es/icons/lucideExtra/SkillsIcon.d.mts +1 -2
- package/es/icons/lucideExtra/SlackIcon.d.mts +1 -2
- package/es/icons/lucideExtra/ThinkIcon.d.mts +1 -2
- package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +1 -2
- package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +1 -2
- package/es/internal/controlSize.d.mts +1 -2
- package/es/internal/floating/collisionPadding.d.mts +1 -2
- package/es/internal/menu/baseItem.d.mts +1 -2
- package/es/internal/menu/checkboxItem.d.mts +1 -2
- package/es/internal/menu/itemInterface.d.mts +1 -2
- package/es/internal/menu/renderUtils.d.mts +1 -2
- package/es/internal/menu/switchItem.d.mts +1 -2
- package/es/internal/menu/type.d.mts +1 -2
- package/es/internal/virtual/MenuVirtualList.d.mts +1 -1
- package/es/internal/virtual/VirtualScrollArea.d.mts +1 -1
- package/es/internal/virtual/type.d.mts +1 -2
- package/es/internal/virtual/useMenuVirtualList.d.mts +1 -1
- package/es/mdx/Callout/index.d.mts +1 -2
- package/es/mdx/Cards/Card.d.mts +1 -2
- package/es/mdx/Cards/index.d.mts +1 -2
- package/es/mdx/FileTree/File.d.mts +1 -2
- package/es/mdx/FileTree/File.mjs +3 -3
- package/es/mdx/FileTree/File.mjs.map +1 -1
- package/es/mdx/FileTree/Folder.d.mts +1 -2
- package/es/mdx/FileTree/Folder.mjs +3 -3
- package/es/mdx/FileTree/Folder.mjs.map +1 -1
- package/es/mdx/FileTree/index.d.mts +1 -2
- package/es/mdx/Mdx/index.d.mts +1 -2
- package/es/mdx/Steps/index.d.mts +1 -2
- package/es/mdx/Tabs/Tab.d.mts +1 -2
- package/es/mdx/Tabs/index.d.mts +1 -2
- package/es/mdx/mdxComponents/CodeBlock.d.mts +1 -2
- package/es/mdx/mdxComponents/Image.d.mts +1 -2
- package/es/mdx/mdxComponents/Link.d.mts +1 -2
- package/es/mdx/mdxComponents/Pre.d.mts +1 -2
- package/es/mdx/mdxComponents/Video.d.mts +1 -2
- package/es/mdx/mdxComponents/index.d.mts +1 -2
- package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +1 -2
- package/es/mobile/ChatHeader/index.d.mts +1 -2
- package/es/mobile/ChatHeader/type.d.mts +1 -2
- package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +1 -2
- package/es/mobile/ChatInputArea/index.d.mts +1 -2
- package/es/mobile/ChatInputArea/type.d.mts +1 -2
- package/es/mobile/SafeArea/SafeArea.d.mts +1 -2
- package/es/mobile/SafeArea/type.d.mts +1 -2
- package/es/mobile/TabBar/TabBar.d.mts +1 -2
- package/es/mobile/TabBar/type.d.mts +1 -2
- package/es/node_modules/.pnpm/@eslint_core@1.2.1/node_modules/@eslint/core/dist/esm/types.d.mts +4 -2
- package/es/node_modules/.pnpm/@eslint_plugin-kit@0.7.3/node_modules/@eslint/plugin-kit/dist/cjs/index.d.mts +1 -2
- package/es/node_modules/.pnpm/@eslint_plugin-kit@0.7.3/node_modules/@eslint/plugin-kit/dist/cjs/types.d.mts +5 -2
- package/es/node_modules/.pnpm/@types_estree@1.0.10/node_modules/@types/estree/index.d.mts +1 -2
- package/es/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.mts +1 -2
- package/es/node_modules/.pnpm/@types_mdx@2.0.14/node_modules/@types/mdx/types.d.mts +1 -2
- package/es/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.mts +1 -2
- package/es/node_modules/.pnpm/eslint@10.14.0_jiti@2.7.0_supports-color@10.2.2/node_modules/eslint/lib/types/index.d.mts +5 -2
- package/es/node_modules/.pnpm/unist-util-visit@5.2.0/node_modules/unist-util-visit/lib/index.mjs +2 -2
- package/es/spline/LogoThree/LogoSpline.d.mts +1 -2
- package/es/spline/LogoThree/index.d.mts +1 -2
- package/es/spline/Spline/Spine.d.mts +2 -3
- package/es/spline/Spline/Spine.mjs.map +1 -1
- package/es/spline/Spline/type.d.mts +1 -2
- package/es/storybook/StoryBook/index.d.mts +1 -2
- package/es/styles/classNames.d.mts +1 -2
- package/es/styles/createGlobalStyle.d.mts +1 -2
- package/es/styles/css.d.mts +1 -2
- package/es/styles/customTheme.d.mts +1 -2
- package/es/styles/stylex/props.d.mts +1 -1
- package/es/styles/theme/createLobeToken.d.mts +1 -2
- package/es/styles/theme/customNeutral.d.mts +1 -2
- package/es/styles/theme/customPalette.d.mts +1 -2
- package/es/styles/theme/customPrimary.d.mts +1 -2
- package/es/styles/theme/customStylishStatic.d.mts +1 -2
- package/es/styles/theme/generateColorPalette.d.mts +1 -2
- package/es/styles/theme/scope.d.mts +1 -2
- package/es/styles/theme/themeCss.d.mts +1 -2
- package/es/styles/theme/token/font.d.mts +1 -2
- package/es/styles/theme/token/neutralText.d.mts +1 -2
- package/es/types/citation.d.mts +1 -2
- package/es/types/customStylish.d.mts +1 -2
- package/es/types/customToken.d.mts +1 -2
- package/es/types/index.d.mts +1 -2
- package/es/types/trigger.d.mts +1 -2
- package/es/utils/copyToClipboard.d.mts +1 -2
- package/es/utils/dom.d.mts +1 -2
- package/es/utils/genCdnUrl.d.mts +1 -2
- package/es/utils/parseTrigger.d.mts +1 -2
- package/es/utils/placement.d.mts +1 -2
- package/es/utils/smoothCorners.d.mts +2 -3
- package/package.json +1 -1
- package/es/MaterialFileTypeIcon/icon-map.mjs.map +0 -1
|
@@ -21,7 +21,7 @@ import useShowNow from "./hooks/useShowNow.mjs";
|
|
|
21
21
|
import Popup from "./Popup/index.mjs";
|
|
22
22
|
import RefRangeSelector from "./Selector/RangeSelector.mjs";
|
|
23
23
|
import { clsx } from "clsx";
|
|
24
|
-
import * as React
|
|
24
|
+
import * as React from "react";
|
|
25
25
|
import { jsx } from "react/jsx-runtime";
|
|
26
26
|
// src/DatePicker/core/PickerInput/RangePicker.tsx
|
|
27
27
|
function separateConfig(config, defaultConfig) {
|
|
@@ -42,7 +42,7 @@ function RangePicker(props, ref) {
|
|
|
42
42
|
});
|
|
43
43
|
const { prefixCls, rootClassName, styles: propStyles, classNames: propClassNames, previewValue, defaultValue, value, needConfirm, onClear, onKeyDown, disabled, allowEmpty, disabledDate, minDate, maxDate, defaultOpen, open, onOpenChange, locale, generateConfig, picker, showNow, showToday, showTime, mode, onPanelChange, onCalendarChange, onOk, defaultPickerValue, pickerValue, onPickerValueChange, inputReadOnly, suffixIcon, onFocus, onBlur, presets, ranges, components, cellRender, dateRender, monthCellRender, onClick } = filledProps;
|
|
44
44
|
const selectorRef = usePickerRef(ref);
|
|
45
|
-
const popupRef = React
|
|
45
|
+
const popupRef = React.useRef(null);
|
|
46
46
|
const [mergedClassNames, mergedStyles] = useSemantic(propClassNames, propStyles);
|
|
47
47
|
const [mergedOpen, setMergeOpen] = useOpen(open, defaultOpen, disabled, onOpenChange);
|
|
48
48
|
const triggerOpen = (nextOpen, config) => {
|
|
@@ -73,7 +73,7 @@ function RangePicker(props, ref) {
|
|
|
73
73
|
if (!firstMount && !mergedOpen) triggerRangeValueChange(rangeValueIndex ?? activeIndex, "popupClose");
|
|
74
74
|
}, [mergedOpen]);
|
|
75
75
|
/** Used for Popup panel */
|
|
76
|
-
const mergedShowTime = React
|
|
76
|
+
const mergedShowTime = React.useMemo(() => {
|
|
77
77
|
if (!showTime) return null;
|
|
78
78
|
const { disabledTime } = showTime;
|
|
79
79
|
const proxyDisabledTime = disabledTime ? (date) => {
|
|
@@ -134,17 +134,17 @@ function RangePicker(props, ref) {
|
|
|
134
134
|
triggerOpen(false, { force: true });
|
|
135
135
|
onClear?.();
|
|
136
136
|
};
|
|
137
|
-
const [hoverSource, setHoverSource] = React
|
|
138
|
-
const [internalHoverValues, setInternalHoverValues] = React
|
|
139
|
-
const hoverValues = React
|
|
137
|
+
const [hoverSource, setHoverSource] = React.useState(null);
|
|
138
|
+
const [internalHoverValues, setInternalHoverValues] = React.useState(null);
|
|
139
|
+
const hoverValues = React.useMemo(() => {
|
|
140
140
|
return internalHoverValues || calendarValue;
|
|
141
141
|
}, [calendarValue, internalHoverValues]);
|
|
142
142
|
const showWeakHover = hoverSource === "cell" && !calendarValue[(activeIndex + 1) % 2] && !isSameTimestamp(generateConfig, calendarValue[activeIndex], mergedValue[activeIndex]);
|
|
143
143
|
const activeHoverValue = internalHoverValues?.[activeIndex];
|
|
144
|
-
React
|
|
144
|
+
React.useEffect(() => {
|
|
145
145
|
if (!mergedOpen) setInternalHoverValues(null);
|
|
146
146
|
}, [mergedOpen]);
|
|
147
|
-
const [activeInfo, setActiveInfo] = React
|
|
147
|
+
const [activeInfo, setActiveInfo] = React.useState([
|
|
148
148
|
0,
|
|
149
149
|
0,
|
|
150
150
|
0
|
|
@@ -182,7 +182,7 @@ function RangePicker(props, ref) {
|
|
|
182
182
|
const isPopupInvalidateDate = useEvent((date) => {
|
|
183
183
|
return isInvalidateDate(date, { activeIndex });
|
|
184
184
|
});
|
|
185
|
-
const panelProps = React
|
|
185
|
+
const panelProps = React.useMemo(() => {
|
|
186
186
|
const domProps = pickAttrs(filledProps);
|
|
187
187
|
return omit(filledProps, [
|
|
188
188
|
...Object.keys(domProps),
|
|
@@ -256,7 +256,7 @@ function RangePicker(props, ref) {
|
|
|
256
256
|
}
|
|
257
257
|
onKeyDown?.(event, preventDefault);
|
|
258
258
|
};
|
|
259
|
-
const context = React
|
|
259
|
+
const context = React.useMemo(() => ({
|
|
260
260
|
prefixCls,
|
|
261
261
|
locale,
|
|
262
262
|
generateConfig,
|
|
@@ -335,7 +335,7 @@ function RangePicker(props, ref) {
|
|
|
335
335
|
})
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
|
-
const RefRangePicker = React
|
|
338
|
+
const RefRangePicker = React.forwardRef(RangePicker);
|
|
339
339
|
if (process.env.NODE_ENV !== "production") RefRangePicker.displayName = "RefRangePicker";
|
|
340
340
|
export { RefRangePicker as default };
|
|
341
341
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangePicker.mjs","names":["React","RangeSelector"],"sources":["../../../../src/DatePicker/core/PickerInput/RangePicker.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport * as React from 'react';\n\nimport { useControlledState, useEvent, useLayoutEffect } from '../hooks/react';\nimport useSemantic from '../hooks/useSemantic';\nimport type {\n BaseInfo,\n InternalMode,\n OnOpenChange,\n OpenConfig,\n PanelMode,\n RangePickerRef,\n RangeTimeProps,\n SelectorProps,\n SharedHTMLAttrs,\n SharedPickerProps,\n ValueDate,\n} from '../interface';\nimport type { PickerPanelProps } from '../PickerPanel';\nimport PickerPopup from '../PickerPopup';\nimport { omit, pickAttrs, warning } from '../utils/common';\nimport { isSameTimestamp } from '../utils/dateUtil';\nimport { fillIndex, getFromDate, toArray } from '../utils/miscUtil';\nimport PickerContext from './context';\nimport useCellRender from './hooks/useCellRender';\nimport useFieldsInvalidate from './hooks/useFieldsInvalidate';\nimport useFilledProps from './hooks/useFilledProps';\nimport useFocusEvents, { isTargetInContainers } from './hooks/useFocusEvents';\nimport useFocusLock from './hooks/useFocusLock';\nimport useOpen from './hooks/useOpen';\nimport usePickerRef from './hooks/usePickerRef';\nimport usePresets from './hooks/usePresets';\nimport useRangeDisabledDate from './hooks/useRangeDisabledDate';\nimport useRangePickerValue from './hooks/useRangePickerValue';\nimport useRangeValue, { useInnerValue } from './hooks/useRangeValue';\nimport useRangeValueChange, { type RangeValueChangeSource } from './hooks/useRangeValueChange';\nimport useShowNow from './hooks/useShowNow';\nimport Popup, { type PopupShowTimeConfig } from './Popup';\nimport RangeSelector, {\n type RangeSelectorRef,\n type SelectorIdType,\n} from './Selector/RangeSelector';\n\nfunction separateConfig<T>(config: T | [T, T] | null | undefined, defaultConfig: T): [T, T] {\n const singleConfig = config ?? defaultConfig;\n\n if (Array.isArray(singleConfig)) {\n return singleConfig;\n }\n\n return [singleConfig, singleConfig];\n}\n\nexport type RangeValueType<DateType> = [\n start: DateType | null | undefined,\n end: DateType | null | undefined,\n];\n\n/** Used for change event, it should always be not undefined */\nexport type NoUndefinedRangeValueType<DateType> = [start: DateType | null, end: DateType | null];\n\nexport interface BaseRangePickerProps<DateType extends object> extends Omit<\n SharedPickerProps<DateType>,\n 'showTime' | 'id'\n> {\n allowEmpty?: boolean | [boolean, boolean];\n\n // Picker Value\n /**\n * Config the popup panel date.\n * Every time active the input to open popup will reset with `defaultPickerValue`.\n *\n * Note: `defaultPickerValue` priority is higher than `value` for the first open.\n */\n defaultPickerValue?: [DateType, DateType] | DateType | null;\n\n defaultValue?: RangeValueType<DateType>;\n // Control\n disabled?: boolean | [boolean, boolean];\n // Structure\n id?: SelectorIdType;\n // Mode\n mode?: [startMode: PanelMode, endMode: PanelMode];\n onCalendarChange?: (\n dates: NoUndefinedRangeValueType<DateType>,\n dateStrings: [string, string],\n info: BaseInfo,\n ) => void;\n\n onChange?: (\n dates: NoUndefinedRangeValueType<DateType> | null,\n dateStrings: [string, string],\n ) => void;\n\n onOk?: (values: NoUndefinedRangeValueType<DateType>) => void;\n /** Trigger on each `mode` or `pickerValue` changed. */\n onPanelChange?: (\n values: NoUndefinedRangeValueType<DateType>,\n modes: [startMode: PanelMode, endMode: PanelMode],\n ) => void;\n /**\n * Each popup panel `pickerValue` includes `mode` change will trigger the callback.\n * @param date The changed picker value\n * @param info.source `panel` from the panel click. `reset` from popup open or field typing\n * @param info.mode Next `mode` panel\n */\n onPickerValueChange?: (\n date: [DateType, DateType],\n info: BaseInfo & {\n source: 'reset' | 'panel';\n mode: [PanelMode, PanelMode];\n },\n ) => void;\n\n /**\n * Config each start & end field popup panel date.\n * When config `pickerValue`, you must also provide `onPickerValueChange` to handle changes.\n */\n pickerValue?: [DateType, DateType] | DateType | null;\n // Placeholder\n placeholder?: [string, string];\n\n // Preset\n presets?: ValueDate<Exclude<RangeValueType<DateType>, null>>[];\n /** @deprecated Please use `presets` instead */\n ranges?: Record<\n string,\n Exclude<RangeValueType<DateType>, null> | (() => Exclude<RangeValueType<DateType>, null>)\n >;\n\n separator?: React.ReactNode;\n\n // Time\n showTime?: boolean | RangeTimeProps<DateType>;\n // Value\n value?: RangeValueType<DateType> | null;\n}\n\nexport interface RangePickerProps<DateType extends object>\n extends\n BaseRangePickerProps<DateType>,\n Omit<RangeTimeProps<DateType>, 'format' | 'defaultValue' | 'defaultOpenValue'> {}\n\nfunction getActiveRange(activeIndex: number) {\n return activeIndex === 1 ? 'end' : 'start';\n}\n\nfunction RangePicker<DateType extends object = any>(\n props: RangePickerProps<DateType>,\n ref: React.Ref<RangePickerRef>,\n) {\n // ========================= Prop =========================\n const [filledProps, internalPicker, complexPicker, formatList, maskFormat, isInvalidateDate] =\n useFilledProps(props, () => {\n const { disabled, allowEmpty } = props;\n\n const mergedDisabled = separateConfig(disabled, false);\n const mergedAllowEmpty = separateConfig(allowEmpty, false);\n\n return {\n disabled: mergedDisabled,\n allowEmpty: mergedAllowEmpty,\n };\n });\n\n const {\n // Style\n prefixCls,\n rootClassName,\n styles: propStyles,\n classNames: propClassNames,\n\n previewValue,\n // Value\n defaultValue,\n value,\n needConfirm,\n onClear,\n onKeyDown,\n\n // Disabled\n disabled,\n allowEmpty,\n disabledDate,\n minDate,\n maxDate,\n\n // Open\n defaultOpen,\n open,\n onOpenChange,\n\n // Picker\n locale,\n generateConfig,\n picker,\n showNow,\n showToday,\n showTime,\n\n // Mode\n mode,\n onPanelChange,\n onCalendarChange,\n onOk,\n\n // Picker Value\n defaultPickerValue,\n pickerValue,\n onPickerValueChange,\n\n // Format\n inputReadOnly,\n\n suffixIcon,\n\n // Focus\n onFocus,\n onBlur,\n\n // Presets\n presets,\n ranges,\n\n // Render\n components,\n cellRender,\n dateRender,\n monthCellRender,\n\n // Native\n onClick,\n } = filledProps;\n\n // ========================= Refs =========================\n const selectorRef = usePickerRef<Parameters<RangePickerRef['focus']>[0], RangeSelectorRef>(ref);\n const popupRef = React.useRef<HTMLDivElement>(null);\n\n // ======================= Semantic =======================\n const [mergedClassNames, mergedStyles] = useSemantic(propClassNames, propStyles);\n\n // ========================= Open =========================\n const [mergedOpen, setMergeOpen] = useOpen(open, defaultOpen, disabled, onOpenChange);\n\n const triggerOpen: OnOpenChange = (nextOpen, config?: OpenConfig) => {\n // No need to open if all disabled\n if (disabled.some((fieldDisabled) => !fieldDisabled) || !nextOpen) {\n setMergeOpen(nextOpen, config);\n }\n };\n\n // ======================== Values ========================\n const [mergedValue, setInnerValue, getCalendarValue, triggerCalendarChange, triggerOk] =\n useInnerValue<RangeValueType<DateType>, DateType>(\n generateConfig,\n locale,\n formatList,\n true,\n false,\n defaultValue,\n value,\n onCalendarChange,\n onOk,\n );\n\n const calendarValue = getCalendarValue();\n\n // ======================== Focus =========================\n const isInternalPickerElement = useEvent((element: EventTarget | null) =>\n isTargetInContainers(element, [selectorRef.current!.nativeElement, popupRef.current]),\n );\n\n const [focused, onFieldFocus, onFieldBlur] = useFocusEvents(\n isInternalPickerElement,\n (index, event) => {\n onFocus?.(event, {\n range: getActiveRange(index),\n });\n },\n (index, event) => {\n onBlur?.(event, {\n range: getActiveRange(index),\n });\n },\n () => {\n triggerOpen(false);\n },\n );\n\n // ======================== Value =========================\n const [\n /** Trigger `onChange` by check `disabledDate` */\n flushSubmit,\n /** Trigger `onChange` directly without check `disabledDate` */\n triggerSubmitChange,\n /** Reset uncommitted values */\n resetValue,\n ] = useRangeValue<RangeValueType<DateType>, DateType>(\n filledProps,\n mergedValue,\n setInnerValue,\n getCalendarValue,\n triggerCalendarChange,\n disabled,\n formatList,\n isInvalidateDate,\n );\n\n const triggerFieldCalendarChange = useEvent((index: number, date: DateType) => {\n triggerCalendarChange(fillIndex(getCalendarValue(), index, date));\n });\n\n const flushFieldSubmit = useEvent((index: number, needTriggerChange: boolean) => {\n flushSubmit(index, needTriggerChange);\n\n if (needTriggerChange) {\n triggerOpen(false, { force: true });\n }\n });\n\n const enabledFieldCount = disabled.filter((fieldDisabled) => !fieldDisabled).length;\n const [\n rangeValueIndex,\n activeIndex,\n forceFocus,\n triggeredFields,\n triggerRangeValueChange,\n resetRangeValueChange,\n ] = useRangeValueChange(\n enabledFieldCount,\n needConfirm,\n allowEmpty,\n getCalendarValue,\n triggerFieldCalendarChange,\n flushFieldSubmit,\n resetValue,\n );\n\n useFocusLock(rangeValueIndex, forceFocus, selectorRef, popupRef, triggerOpen);\n\n // Finalize the current interaction only after the popup is actually closed.\n // 仅在 popup 实际关闭后,统一收口当前交互。\n useLayoutEffect(\n (firstMount) => {\n if (!firstMount && !mergedOpen) {\n triggerRangeValueChange(rangeValueIndex ?? activeIndex, 'popupClose');\n }\n },\n [mergedOpen],\n );\n\n // ======================= ShowTime =======================\n /** Used for Popup panel */\n const mergedShowTime = React.useMemo<\n (PopupShowTimeConfig<DateType> & Pick<RangeTimeProps<DateType>, 'defaultOpenValue'>) | null\n >(() => {\n if (!showTime) {\n return null;\n }\n\n const { disabledTime } = showTime;\n\n const proxyDisabledTime = disabledTime\n ? (date: DateType) => {\n const range = getActiveRange(activeIndex);\n const fromDate = getFromDate(calendarValue, triggeredFields, activeIndex);\n return disabledTime(date, range, {\n from: fromDate,\n });\n }\n : undefined;\n\n return { ...showTime, disabledTime: proxyDisabledTime };\n }, [showTime, activeIndex, calendarValue, triggeredFields]);\n\n // ========================= Mode =========================\n const [modes, setModes] = useControlledState<[PanelMode, PanelMode]>([picker, picker], mode);\n\n const mergedMode = modes[activeIndex] || picker;\n\n /** Extends from `mergedMode` to patch `datetime` mode */\n const internalMode: InternalMode =\n mergedMode === 'date' && mergedShowTime ? 'datetime' : mergedMode;\n\n // ====================== PanelCount ======================\n const multiplePanel = internalMode === picker && internalMode !== 'time';\n\n // ======================= Show Now =======================\n const mergedShowNow = useShowNow(picker, mergedMode, showNow, showToday, true);\n\n // ===================== DisabledDate =====================\n const mergedDisabledDate = useRangeDisabledDate(\n calendarValue,\n disabled,\n activeIndex,\n triggeredFields,\n generateConfig,\n locale,\n disabledDate,\n );\n\n // ======================= Validate =======================\n const [submitInvalidates, onSelectorInvalid] = useFieldsInvalidate(\n calendarValue,\n isInvalidateDate,\n allowEmpty,\n );\n\n // ===================== Picker Value =====================\n const [currentPickerValue, setCurrentPickerValue] = useRangePickerValue(\n generateConfig,\n locale,\n calendarValue,\n modes,\n mergedOpen,\n focused,\n activeIndex,\n internalPicker,\n multiplePanel,\n defaultPickerValue,\n pickerValue,\n mergedShowTime?.defaultOpenValue,\n onPickerValueChange,\n minDate,\n maxDate,\n );\n\n // >>> Mode need wait for `pickerValue`\n const triggerModeChange = useEvent(\n (nextPickerValue: DateType | null, nextMode: PanelMode, triggerEvent?: boolean) => {\n const clone = fillIndex(modes, activeIndex, nextMode);\n\n if (clone[0] !== modes[0] || clone[1] !== modes[1]) {\n setModes(clone);\n }\n\n // Compatible with `onPanelChange`\n if (onPanelChange && triggerEvent !== false) {\n const clonePickerValue: RangeValueType<DateType> = [...calendarValue];\n if (nextPickerValue) {\n clonePickerValue[activeIndex] = nextPickerValue;\n }\n onPanelChange(clonePickerValue as NoUndefinedRangeValueType<DateType>, clone);\n }\n },\n );\n\n // ======================== Change ========================\n const fillCalendarValue = (date: DateType, index: number) =>\n // Trigger change only when date changed\n fillIndex(calendarValue, index, date);\n\n // ======================== Submit ========================\n /**\n * Trigger by confirm operation.\n * This function has already handle the `needConfirm` check logic.\n * - Selector: enter key\n * - Panel: OK button\n */\n const triggerPartConfirm = (\n date?: DateType | null,\n source: RangeValueChangeSource = 'confirm',\n ) => {\n triggerRangeValueChange(activeIndex, source, date ?? undefined);\n };\n\n // ======================== Click =========================\n const onSelectorClick: React.MouseEventHandler<HTMLDivElement> = (event) => {\n const rootNode = (event.target as HTMLElement).getRootNode();\n if (\n !selectorRef.current!.nativeElement.contains(\n (rootNode as Document | ShadowRoot).activeElement ?? document.activeElement,\n )\n ) {\n // Click to focus the enabled input\n const enabledIndex = disabled.findIndex((d) => !d);\n if (enabledIndex >= 0) {\n selectorRef.current!.focus({ index: enabledIndex });\n }\n }\n\n triggerOpen(true);\n\n onClick?.(event);\n };\n\n const onSelectorClear = () => {\n resetRangeValueChange();\n triggerSubmitChange(null);\n triggerOpen(false, { force: true });\n onClear?.();\n };\n\n // ======================== Hover =========================\n const [hoverSource, setHoverSource] = React.useState<'cell' | 'preset' | null>(null);\n const [internalHoverValues, setInternalHoverValues] =\n React.useState<RangeValueType<DateType> | null>(null);\n\n const hoverValues = React.useMemo(() => {\n return internalHoverValues || calendarValue;\n }, [calendarValue, internalHoverValues]);\n\n // \"Weak\" hover only highlights the hovered cell instead of composing a range.\n // Use it while choosing the first value so the pending selection remains selected.\n const showWeakHover =\n // Preset hover always previews the whole range.\n hoverSource === 'cell' &&\n // Once the other field has a value, range hover takes precedence.\n !calendarValue[(activeIndex + 1) % 2] &&\n // Only a changed active value needs weak hover.\n !isSameTimestamp(generateConfig, calendarValue[activeIndex], mergedValue[activeIndex]);\n const activeHoverValue = internalHoverValues?.[activeIndex];\n\n // Clean up `internalHoverValues` when closed\n React.useEffect(() => {\n if (!mergedOpen) {\n setInternalHoverValues(null);\n }\n }, [mergedOpen]);\n\n // ========================================================\n // == Panels ==\n // ========================================================\n // Save the offset with active bar position\n // const [activeOffset, setActiveOffset] = React.useState(0);\n const [activeInfo, setActiveInfo] = React.useState<\n [activeInputLeft: number, activeInputRight: number, selectorWidth: number]\n >([0, 0, 0]);\n\n const onSetHover = (date: RangeValueType<DateType> | null, source: 'cell' | 'preset') => {\n if (previewValue !== 'hover') {\n return;\n }\n setInternalHoverValues(date);\n setHoverSource(source);\n };\n\n // ======================= Presets ========================\n const presetList = usePresets(presets, ranges);\n\n const onPresetHover = (nextValues: RangeValueType<DateType> | null) => {\n onSetHover(nextValues, 'preset');\n };\n\n const onPresetSubmit = (nextValues: RangeValueType<DateType>) => {\n const passed = triggerSubmitChange(nextValues);\n\n if (passed) {\n triggerOpen(false, { force: true });\n }\n };\n\n const onNow = (now: DateType) => {\n triggerPartConfirm(now);\n };\n\n // ======================== Panel =========================\n const onPanelHover = (date: DateType) => {\n onSetHover(date ? fillCalendarValue(date, activeIndex) : null, 'cell');\n };\n\n // >>> Focus\n const onPanelFocus: React.FocusEventHandler<HTMLElement> = (event) => {\n triggerOpen(true);\n onFieldFocus(activeIndex, 'panel', event);\n };\n\n // >>> Calendar\n const onPanelSelect: PickerPanelProps<DateType>['onSelect'] = (date: DateType) => {\n const panelFinished = !complexPicker && internalPicker === internalMode;\n\n triggerRangeValueChange(\n activeIndex,\n panelFinished ? 'panel-final' : 'panel-intermediate',\n date,\n );\n };\n\n // >>> Close\n const onPopupClose = () => {\n triggerOpen(false);\n };\n\n // >>> cellRender\n const onInternalCellRender = useCellRender(\n cellRender,\n dateRender,\n monthCellRender,\n getActiveRange(activeIndex),\n );\n\n // >>> Value\n const panelValue = calendarValue[activeIndex] || null;\n\n // >>> invalid\n const isPopupInvalidateDate = useEvent((date: DateType) => {\n return isInvalidateDate(date, {\n activeIndex,\n });\n });\n\n const panelProps = React.useMemo(() => {\n const domProps = pickAttrs(filledProps);\n const restProps = omit(filledProps, [\n ...(Object.keys(domProps) as (keyof SharedHTMLAttrs)[]),\n 'onChange',\n 'onCalendarChange',\n 'onClear',\n 'style',\n 'className',\n 'onPanelChange',\n 'disabledTime',\n 'classNames',\n 'styles',\n ]);\n return restProps;\n }, [filledProps]);\n\n // >>> Render\n const panel = (\n <Popup<any>\n containerRef={popupRef}\n // MISC\n {...panelProps}\n defaultOpenValue={toArray(showTime?.defaultOpenValue)[activeIndex]}\n hoverRangeValue={showWeakHover ? null : hoverValues}\n internalMode={internalMode}\n multiplePanel={multiplePanel}\n showNow={mergedShowNow}\n styles={mergedStyles}\n value={panelValue}\n onChange={null}\n onFocus={onPanelFocus}\n onPresetHover={onPresetHover}\n onSubmit={(date) => triggerPartConfirm(date, 'confirm')}\n activeInfo={activeInfo}\n // Disabled\n disabledDate={mergedDisabledDate}\n cellRender={onInternalCellRender}\n // Styles\n classNames={mergedClassNames}\n isInvalid={isPopupInvalidateDate}\n // Focus\n mode={mergedMode}\n showTime={mergedShowTime}\n // Range\n range\n onBlur={(event) => onFieldBlur(activeIndex, 'panel', event)}\n // Mode\n picker={picker}\n onHover={onPanelHover}\n // Submit\n needConfirm={needConfirm}\n onOk={triggerOk}\n // Preset\n presets={presetList}\n onPanelChange={triggerModeChange}\n // Value\n format={maskFormat}\n onPickerValueChange={setCurrentPickerValue}\n // Hover\n hoverValue={showWeakHover && activeHoverValue ? [activeHoverValue] : null}\n // Render\n onPresetSubmit={onPresetSubmit}\n // Now\n onNow={onNow}\n onSelect={onPanelSelect}\n // PickerValue\n pickerValue={currentPickerValue}\n />\n );\n\n // ========================================================\n // == Selector ==\n // ========================================================\n\n // ======================== Change ========================\n const onSelectorChange = (date: DateType, index?: number) => {\n triggerRangeValueChange(index!, 'input', date);\n };\n\n const onSelectorInputChange = () => {\n triggerRangeValueChange(activeIndex, 'input');\n };\n\n // ======================= Selector =======================\n const onSelectorFocus: SelectorProps['onFocus'] = (event, index) => {\n triggerRangeValueChange(index!, 'field-switch');\n\n triggerOpen(true, {\n inherit: true,\n });\n\n onFieldFocus(index!, 'input', event);\n };\n\n const onSelectorBlur: SelectorProps['onBlur'] = (event, index) => {\n onFieldBlur(index!, 'input', event);\n };\n\n const onSelectorKeyDown: SelectorProps['onKeyDown'] = (event, preventDefault) => {\n if (event.key === 'Tab') {\n triggerPartConfirm(null, 'keyboard-submit-weak');\n } else if (event.key === 'Escape') {\n triggerRangeValueChange(activeIndex, 'esc');\n triggerOpen(false);\n }\n\n onKeyDown?.(event, preventDefault);\n };\n\n // ======================= Context ========================\n const context = React.useMemo(\n () => ({\n prefixCls,\n locale,\n generateConfig,\n button: components.button,\n input: components.input,\n classNames: mergedClassNames,\n styles: mergedStyles,\n }),\n [\n prefixCls,\n locale,\n generateConfig,\n components.button,\n components.input,\n mergedClassNames,\n mergedStyles,\n ],\n );\n\n // ======================== Effect ========================\n // >>> Mode\n // Reset for every active\n useLayoutEffect(() => {\n if (mergedOpen && activeIndex !== undefined) {\n // Legacy compatible. This effect update should not trigger `onPanelChange`\n triggerModeChange(null, picker, false);\n }\n }, [mergedOpen, activeIndex, picker]);\n\n // ====================== DevWarning ======================\n if (process.env.NODE_ENV !== 'production') {\n const isIndexEmpty = (index: number) => {\n return (\n // Value is empty\n !value?.[index] &&\n // DefaultValue is empty\n !defaultValue?.[index]\n );\n };\n\n if (\n disabled.some(\n (fieldDisabled, index) => fieldDisabled && isIndexEmpty(index) && !allowEmpty[index],\n )\n ) {\n warning(\n false,\n '`disabled` should not set with empty `value`. You should set `allowEmpty` or `value` instead.',\n );\n }\n }\n\n // ======================== Render ========================\n return (\n <PickerContext value={context}>\n <PickerPopup\n direction={filledProps.direction}\n getAnchor={() => selectorRef.current?.nativeElement}\n getPopupContainer={filledProps.getPopupContainer}\n inline={filledProps.inlinePopup}\n placement={filledProps.placement}\n popupElement={panel}\n popupStyle={mergedStyles.popup.root}\n popupClassName={clsx(rootClassName, mergedClassNames.popup.root)}\n // Visible\n visible={mergedOpen}\n onClose={onPopupClose}\n // Range\n range\n >\n <RangeSelector\n // Shared\n {...filledProps}\n // Ref\n activeHelp={!!internalHoverValues}\n focused={focused}\n maskFormat={maskFormat}\n open={mergedOpen}\n onBlur={onSelectorBlur}\n onChange={onSelectorChange}\n onFocus={onSelectorFocus}\n onKeyDown={onSelectorKeyDown}\n activeIndex={focused || mergedOpen ? activeIndex : null}\n // Active\n allHelp={!!internalHoverValues && hoverSource === 'preset'}\n inputReadOnly={inputReadOnly}\n // Disabled\n disabled={disabled}\n ref={selectorRef}\n // Style\n className={clsx(filledProps.className, rootClassName, mergedClassNames.root)}\n style={{ ...mergedStyles.root, ...filledProps.style }}\n // Icon\n suffixIcon={suffixIcon}\n onClear={onSelectorClear}\n // Invalid\n invalid={submitInvalidates}\n // Open\n onInputChange={onSelectorInputChange}\n // Format\n format={formatList}\n onInvalid={onSelectorInvalid}\n // Offset\n onActiveInfo={setActiveInfo}\n onOpenChange={triggerOpen}\n // Click\n onClick={onSelectorClick}\n onSubmit={() => triggerPartConfirm(null, 'keyboard-submit')}\n // Change\n value={hoverValues}\n />\n </PickerPopup>\n </PickerContext>\n );\n}\n\nconst RefRangePicker = React.forwardRef(RangePicker) as <DateType extends object = any>(\n props: RangePickerProps<DateType> & React.RefAttributes<RangePickerRef>,\n) => React.ReactElement;\n\nif (process.env.NODE_ENV !== 'production') {\n (RefRangePicker as any).displayName = 'RefRangePicker';\n}\n\nexport default RefRangePicker;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAS,eAAkB,QAAuC,eAA0B;CAC1F,MAAM,eAAe,UAAU;CAE/B,IAAI,MAAM,QAAQ,YAAY,GAC5B,OAAO;CAGT,OAAO,CAAC,cAAc,YAAY;AACpC;AA4FA,SAAS,eAAe,aAAqB;CAC3C,OAAO,gBAAgB,IAAI,QAAQ;AACrC;AAEA,SAAS,YACP,OACA,KACA;CAEA,MAAM,CAAC,aAAa,gBAAgB,eAAe,YAAY,YAAY,oBACzE,eAAe,aAAa;EAC1B,MAAM,EAAE,UAAU,eAAe;EAKjC,OAAO;GACL,UAJqB,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AAc;IACd,cAAc;IAEd,SAAS;IACT,gBAAgB,mBAAmB,MAAM,iBAAiB;IAE1D,OAAO;GACR,CAAA;EACU,CAAA;CACA,CAAA;AAEnB;AAEA,MAAM,iBAAiBD,QAAM,WAAW,WAAW;AAInD,IAAI,QAAQ,IAAI,aAAa,cAC3B,eAAwB,cAAc"}
|
|
1
|
+
{"version":3,"file":"RangePicker.mjs","names":["useLayoutEffect","RangeSelector"],"sources":["../../../../src/DatePicker/core/PickerInput/RangePicker.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport * as React from 'react';\n\nimport { useControlledState, useEvent, useLayoutEffect } from '../hooks/react';\nimport useSemantic from '../hooks/useSemantic';\nimport type {\n BaseInfo,\n InternalMode,\n OnOpenChange,\n OpenConfig,\n PanelMode,\n RangePickerRef,\n RangeTimeProps,\n SelectorProps,\n SharedHTMLAttrs,\n SharedPickerProps,\n ValueDate,\n} from '../interface';\nimport type { PickerPanelProps } from '../PickerPanel';\nimport PickerPopup from '../PickerPopup';\nimport { omit, pickAttrs, warning } from '../utils/common';\nimport { isSameTimestamp } from '../utils/dateUtil';\nimport { fillIndex, getFromDate, toArray } from '../utils/miscUtil';\nimport PickerContext from './context';\nimport useCellRender from './hooks/useCellRender';\nimport useFieldsInvalidate from './hooks/useFieldsInvalidate';\nimport useFilledProps from './hooks/useFilledProps';\nimport useFocusEvents, { isTargetInContainers } from './hooks/useFocusEvents';\nimport useFocusLock from './hooks/useFocusLock';\nimport useOpen from './hooks/useOpen';\nimport usePickerRef from './hooks/usePickerRef';\nimport usePresets from './hooks/usePresets';\nimport useRangeDisabledDate from './hooks/useRangeDisabledDate';\nimport useRangePickerValue from './hooks/useRangePickerValue';\nimport useRangeValue, { useInnerValue } from './hooks/useRangeValue';\nimport useRangeValueChange, { type RangeValueChangeSource } from './hooks/useRangeValueChange';\nimport useShowNow from './hooks/useShowNow';\nimport Popup, { type PopupShowTimeConfig } from './Popup';\nimport RangeSelector, {\n type RangeSelectorRef,\n type SelectorIdType,\n} from './Selector/RangeSelector';\n\nfunction separateConfig<T>(config: T | [T, T] | null | undefined, defaultConfig: T): [T, T] {\n const singleConfig = config ?? defaultConfig;\n\n if (Array.isArray(singleConfig)) {\n return singleConfig;\n }\n\n return [singleConfig, singleConfig];\n}\n\nexport type RangeValueType<DateType> = [\n start: DateType | null | undefined,\n end: DateType | null | undefined,\n];\n\n/** Used for change event, it should always be not undefined */\nexport type NoUndefinedRangeValueType<DateType> = [start: DateType | null, end: DateType | null];\n\nexport interface BaseRangePickerProps<DateType extends object> extends Omit<\n SharedPickerProps<DateType>,\n 'showTime' | 'id'\n> {\n allowEmpty?: boolean | [boolean, boolean];\n\n // Picker Value\n /**\n * Config the popup panel date.\n * Every time active the input to open popup will reset with `defaultPickerValue`.\n *\n * Note: `defaultPickerValue` priority is higher than `value` for the first open.\n */\n defaultPickerValue?: [DateType, DateType] | DateType | null;\n\n defaultValue?: RangeValueType<DateType>;\n // Control\n disabled?: boolean | [boolean, boolean];\n // Structure\n id?: SelectorIdType;\n // Mode\n mode?: [startMode: PanelMode, endMode: PanelMode];\n onCalendarChange?: (\n dates: NoUndefinedRangeValueType<DateType>,\n dateStrings: [string, string],\n info: BaseInfo,\n ) => void;\n\n onChange?: (\n dates: NoUndefinedRangeValueType<DateType> | null,\n dateStrings: [string, string],\n ) => void;\n\n onOk?: (values: NoUndefinedRangeValueType<DateType>) => void;\n /** Trigger on each `mode` or `pickerValue` changed. */\n onPanelChange?: (\n values: NoUndefinedRangeValueType<DateType>,\n modes: [startMode: PanelMode, endMode: PanelMode],\n ) => void;\n /**\n * Each popup panel `pickerValue` includes `mode` change will trigger the callback.\n * @param date The changed picker value\n * @param info.source `panel` from the panel click. `reset` from popup open or field typing\n * @param info.mode Next `mode` panel\n */\n onPickerValueChange?: (\n date: [DateType, DateType],\n info: BaseInfo & {\n source: 'reset' | 'panel';\n mode: [PanelMode, PanelMode];\n },\n ) => void;\n\n /**\n * Config each start & end field popup panel date.\n * When config `pickerValue`, you must also provide `onPickerValueChange` to handle changes.\n */\n pickerValue?: [DateType, DateType] | DateType | null;\n // Placeholder\n placeholder?: [string, string];\n\n // Preset\n presets?: ValueDate<Exclude<RangeValueType<DateType>, null>>[];\n /** @deprecated Please use `presets` instead */\n ranges?: Record<\n string,\n Exclude<RangeValueType<DateType>, null> | (() => Exclude<RangeValueType<DateType>, null>)\n >;\n\n separator?: React.ReactNode;\n\n // Time\n showTime?: boolean | RangeTimeProps<DateType>;\n // Value\n value?: RangeValueType<DateType> | null;\n}\n\nexport interface RangePickerProps<DateType extends object>\n extends\n BaseRangePickerProps<DateType>,\n Omit<RangeTimeProps<DateType>, 'format' | 'defaultValue' | 'defaultOpenValue'> {}\n\nfunction getActiveRange(activeIndex: number) {\n return activeIndex === 1 ? 'end' : 'start';\n}\n\nfunction RangePicker<DateType extends object = any>(\n props: RangePickerProps<DateType>,\n ref: React.Ref<RangePickerRef>,\n) {\n // ========================= Prop =========================\n const [filledProps, internalPicker, complexPicker, formatList, maskFormat, isInvalidateDate] =\n useFilledProps(props, () => {\n const { disabled, allowEmpty } = props;\n\n const mergedDisabled = separateConfig(disabled, false);\n const mergedAllowEmpty = separateConfig(allowEmpty, false);\n\n return {\n disabled: mergedDisabled,\n allowEmpty: mergedAllowEmpty,\n };\n });\n\n const {\n // Style\n prefixCls,\n rootClassName,\n styles: propStyles,\n classNames: propClassNames,\n\n previewValue,\n // Value\n defaultValue,\n value,\n needConfirm,\n onClear,\n onKeyDown,\n\n // Disabled\n disabled,\n allowEmpty,\n disabledDate,\n minDate,\n maxDate,\n\n // Open\n defaultOpen,\n open,\n onOpenChange,\n\n // Picker\n locale,\n generateConfig,\n picker,\n showNow,\n showToday,\n showTime,\n\n // Mode\n mode,\n onPanelChange,\n onCalendarChange,\n onOk,\n\n // Picker Value\n defaultPickerValue,\n pickerValue,\n onPickerValueChange,\n\n // Format\n inputReadOnly,\n\n suffixIcon,\n\n // Focus\n onFocus,\n onBlur,\n\n // Presets\n presets,\n ranges,\n\n // Render\n components,\n cellRender,\n dateRender,\n monthCellRender,\n\n // Native\n onClick,\n } = filledProps;\n\n // ========================= Refs =========================\n const selectorRef = usePickerRef<Parameters<RangePickerRef['focus']>[0], RangeSelectorRef>(ref);\n const popupRef = React.useRef<HTMLDivElement>(null);\n\n // ======================= Semantic =======================\n const [mergedClassNames, mergedStyles] = useSemantic(propClassNames, propStyles);\n\n // ========================= Open =========================\n const [mergedOpen, setMergeOpen] = useOpen(open, defaultOpen, disabled, onOpenChange);\n\n const triggerOpen: OnOpenChange = (nextOpen, config?: OpenConfig) => {\n // No need to open if all disabled\n if (disabled.some((fieldDisabled) => !fieldDisabled) || !nextOpen) {\n setMergeOpen(nextOpen, config);\n }\n };\n\n // ======================== Values ========================\n const [mergedValue, setInnerValue, getCalendarValue, triggerCalendarChange, triggerOk] =\n useInnerValue<RangeValueType<DateType>, DateType>(\n generateConfig,\n locale,\n formatList,\n true,\n false,\n defaultValue,\n value,\n onCalendarChange,\n onOk,\n );\n\n const calendarValue = getCalendarValue();\n\n // ======================== Focus =========================\n const isInternalPickerElement = useEvent((element: EventTarget | null) =>\n isTargetInContainers(element, [selectorRef.current!.nativeElement, popupRef.current]),\n );\n\n const [focused, onFieldFocus, onFieldBlur] = useFocusEvents(\n isInternalPickerElement,\n (index, event) => {\n onFocus?.(event, {\n range: getActiveRange(index),\n });\n },\n (index, event) => {\n onBlur?.(event, {\n range: getActiveRange(index),\n });\n },\n () => {\n triggerOpen(false);\n },\n );\n\n // ======================== Value =========================\n const [\n /** Trigger `onChange` by check `disabledDate` */\n flushSubmit,\n /** Trigger `onChange` directly without check `disabledDate` */\n triggerSubmitChange,\n /** Reset uncommitted values */\n resetValue,\n ] = useRangeValue<RangeValueType<DateType>, DateType>(\n filledProps,\n mergedValue,\n setInnerValue,\n getCalendarValue,\n triggerCalendarChange,\n disabled,\n formatList,\n isInvalidateDate,\n );\n\n const triggerFieldCalendarChange = useEvent((index: number, date: DateType) => {\n triggerCalendarChange(fillIndex(getCalendarValue(), index, date));\n });\n\n const flushFieldSubmit = useEvent((index: number, needTriggerChange: boolean) => {\n flushSubmit(index, needTriggerChange);\n\n if (needTriggerChange) {\n triggerOpen(false, { force: true });\n }\n });\n\n const enabledFieldCount = disabled.filter((fieldDisabled) => !fieldDisabled).length;\n const [\n rangeValueIndex,\n activeIndex,\n forceFocus,\n triggeredFields,\n triggerRangeValueChange,\n resetRangeValueChange,\n ] = useRangeValueChange(\n enabledFieldCount,\n needConfirm,\n allowEmpty,\n getCalendarValue,\n triggerFieldCalendarChange,\n flushFieldSubmit,\n resetValue,\n );\n\n useFocusLock(rangeValueIndex, forceFocus, selectorRef, popupRef, triggerOpen);\n\n // Finalize the current interaction only after the popup is actually closed.\n // 仅在 popup 实际关闭后,统一收口当前交互。\n useLayoutEffect(\n (firstMount) => {\n if (!firstMount && !mergedOpen) {\n triggerRangeValueChange(rangeValueIndex ?? activeIndex, 'popupClose');\n }\n },\n [mergedOpen],\n );\n\n // ======================= ShowTime =======================\n /** Used for Popup panel */\n const mergedShowTime = React.useMemo<\n (PopupShowTimeConfig<DateType> & Pick<RangeTimeProps<DateType>, 'defaultOpenValue'>) | null\n >(() => {\n if (!showTime) {\n return null;\n }\n\n const { disabledTime } = showTime;\n\n const proxyDisabledTime = disabledTime\n ? (date: DateType) => {\n const range = getActiveRange(activeIndex);\n const fromDate = getFromDate(calendarValue, triggeredFields, activeIndex);\n return disabledTime(date, range, {\n from: fromDate,\n });\n }\n : undefined;\n\n return { ...showTime, disabledTime: proxyDisabledTime };\n }, [showTime, activeIndex, calendarValue, triggeredFields]);\n\n // ========================= Mode =========================\n const [modes, setModes] = useControlledState<[PanelMode, PanelMode]>([picker, picker], mode);\n\n const mergedMode = modes[activeIndex] || picker;\n\n /** Extends from `mergedMode` to patch `datetime` mode */\n const internalMode: InternalMode =\n mergedMode === 'date' && mergedShowTime ? 'datetime' : mergedMode;\n\n // ====================== PanelCount ======================\n const multiplePanel = internalMode === picker && internalMode !== 'time';\n\n // ======================= Show Now =======================\n const mergedShowNow = useShowNow(picker, mergedMode, showNow, showToday, true);\n\n // ===================== DisabledDate =====================\n const mergedDisabledDate = useRangeDisabledDate(\n calendarValue,\n disabled,\n activeIndex,\n triggeredFields,\n generateConfig,\n locale,\n disabledDate,\n );\n\n // ======================= Validate =======================\n const [submitInvalidates, onSelectorInvalid] = useFieldsInvalidate(\n calendarValue,\n isInvalidateDate,\n allowEmpty,\n );\n\n // ===================== Picker Value =====================\n const [currentPickerValue, setCurrentPickerValue] = useRangePickerValue(\n generateConfig,\n locale,\n calendarValue,\n modes,\n mergedOpen,\n focused,\n activeIndex,\n internalPicker,\n multiplePanel,\n defaultPickerValue,\n pickerValue,\n mergedShowTime?.defaultOpenValue,\n onPickerValueChange,\n minDate,\n maxDate,\n );\n\n // >>> Mode need wait for `pickerValue`\n const triggerModeChange = useEvent(\n (nextPickerValue: DateType | null, nextMode: PanelMode, triggerEvent?: boolean) => {\n const clone = fillIndex(modes, activeIndex, nextMode);\n\n if (clone[0] !== modes[0] || clone[1] !== modes[1]) {\n setModes(clone);\n }\n\n // Compatible with `onPanelChange`\n if (onPanelChange && triggerEvent !== false) {\n const clonePickerValue: RangeValueType<DateType> = [...calendarValue];\n if (nextPickerValue) {\n clonePickerValue[activeIndex] = nextPickerValue;\n }\n onPanelChange(clonePickerValue as NoUndefinedRangeValueType<DateType>, clone);\n }\n },\n );\n\n // ======================== Change ========================\n const fillCalendarValue = (date: DateType, index: number) =>\n // Trigger change only when date changed\n fillIndex(calendarValue, index, date);\n\n // ======================== Submit ========================\n /**\n * Trigger by confirm operation.\n * This function has already handle the `needConfirm` check logic.\n * - Selector: enter key\n * - Panel: OK button\n */\n const triggerPartConfirm = (\n date?: DateType | null,\n source: RangeValueChangeSource = 'confirm',\n ) => {\n triggerRangeValueChange(activeIndex, source, date ?? undefined);\n };\n\n // ======================== Click =========================\n const onSelectorClick: React.MouseEventHandler<HTMLDivElement> = (event) => {\n const rootNode = (event.target as HTMLElement).getRootNode();\n if (\n !selectorRef.current!.nativeElement.contains(\n (rootNode as Document | ShadowRoot).activeElement ?? document.activeElement,\n )\n ) {\n // Click to focus the enabled input\n const enabledIndex = disabled.findIndex((d) => !d);\n if (enabledIndex >= 0) {\n selectorRef.current!.focus({ index: enabledIndex });\n }\n }\n\n triggerOpen(true);\n\n onClick?.(event);\n };\n\n const onSelectorClear = () => {\n resetRangeValueChange();\n triggerSubmitChange(null);\n triggerOpen(false, { force: true });\n onClear?.();\n };\n\n // ======================== Hover =========================\n const [hoverSource, setHoverSource] = React.useState<'cell' | 'preset' | null>(null);\n const [internalHoverValues, setInternalHoverValues] =\n React.useState<RangeValueType<DateType> | null>(null);\n\n const hoverValues = React.useMemo(() => {\n return internalHoverValues || calendarValue;\n }, [calendarValue, internalHoverValues]);\n\n // \"Weak\" hover only highlights the hovered cell instead of composing a range.\n // Use it while choosing the first value so the pending selection remains selected.\n const showWeakHover =\n // Preset hover always previews the whole range.\n hoverSource === 'cell' &&\n // Once the other field has a value, range hover takes precedence.\n !calendarValue[(activeIndex + 1) % 2] &&\n // Only a changed active value needs weak hover.\n !isSameTimestamp(generateConfig, calendarValue[activeIndex], mergedValue[activeIndex]);\n const activeHoverValue = internalHoverValues?.[activeIndex];\n\n // Clean up `internalHoverValues` when closed\n React.useEffect(() => {\n if (!mergedOpen) {\n setInternalHoverValues(null);\n }\n }, [mergedOpen]);\n\n // ========================================================\n // == Panels ==\n // ========================================================\n // Save the offset with active bar position\n // const [activeOffset, setActiveOffset] = React.useState(0);\n const [activeInfo, setActiveInfo] = React.useState<\n [activeInputLeft: number, activeInputRight: number, selectorWidth: number]\n >([0, 0, 0]);\n\n const onSetHover = (date: RangeValueType<DateType> | null, source: 'cell' | 'preset') => {\n if (previewValue !== 'hover') {\n return;\n }\n setInternalHoverValues(date);\n setHoverSource(source);\n };\n\n // ======================= Presets ========================\n const presetList = usePresets(presets, ranges);\n\n const onPresetHover = (nextValues: RangeValueType<DateType> | null) => {\n onSetHover(nextValues, 'preset');\n };\n\n const onPresetSubmit = (nextValues: RangeValueType<DateType>) => {\n const passed = triggerSubmitChange(nextValues);\n\n if (passed) {\n triggerOpen(false, { force: true });\n }\n };\n\n const onNow = (now: DateType) => {\n triggerPartConfirm(now);\n };\n\n // ======================== Panel =========================\n const onPanelHover = (date: DateType) => {\n onSetHover(date ? fillCalendarValue(date, activeIndex) : null, 'cell');\n };\n\n // >>> Focus\n const onPanelFocus: React.FocusEventHandler<HTMLElement> = (event) => {\n triggerOpen(true);\n onFieldFocus(activeIndex, 'panel', event);\n };\n\n // >>> Calendar\n const onPanelSelect: PickerPanelProps<DateType>['onSelect'] = (date: DateType) => {\n const panelFinished = !complexPicker && internalPicker === internalMode;\n\n triggerRangeValueChange(\n activeIndex,\n panelFinished ? 'panel-final' : 'panel-intermediate',\n date,\n );\n };\n\n // >>> Close\n const onPopupClose = () => {\n triggerOpen(false);\n };\n\n // >>> cellRender\n const onInternalCellRender = useCellRender(\n cellRender,\n dateRender,\n monthCellRender,\n getActiveRange(activeIndex),\n );\n\n // >>> Value\n const panelValue = calendarValue[activeIndex] || null;\n\n // >>> invalid\n const isPopupInvalidateDate = useEvent((date: DateType) => {\n return isInvalidateDate(date, {\n activeIndex,\n });\n });\n\n const panelProps = React.useMemo(() => {\n const domProps = pickAttrs(filledProps);\n const restProps = omit(filledProps, [\n ...(Object.keys(domProps) as (keyof SharedHTMLAttrs)[]),\n 'onChange',\n 'onCalendarChange',\n 'onClear',\n 'style',\n 'className',\n 'onPanelChange',\n 'disabledTime',\n 'classNames',\n 'styles',\n ]);\n return restProps;\n }, [filledProps]);\n\n // >>> Render\n const panel = (\n <Popup<any>\n containerRef={popupRef}\n // MISC\n {...panelProps}\n defaultOpenValue={toArray(showTime?.defaultOpenValue)[activeIndex]}\n hoverRangeValue={showWeakHover ? null : hoverValues}\n internalMode={internalMode}\n multiplePanel={multiplePanel}\n showNow={mergedShowNow}\n styles={mergedStyles}\n value={panelValue}\n onChange={null}\n onFocus={onPanelFocus}\n onPresetHover={onPresetHover}\n onSubmit={(date) => triggerPartConfirm(date, 'confirm')}\n activeInfo={activeInfo}\n // Disabled\n disabledDate={mergedDisabledDate}\n cellRender={onInternalCellRender}\n // Styles\n classNames={mergedClassNames}\n isInvalid={isPopupInvalidateDate}\n // Focus\n mode={mergedMode}\n showTime={mergedShowTime}\n // Range\n range\n onBlur={(event) => onFieldBlur(activeIndex, 'panel', event)}\n // Mode\n picker={picker}\n onHover={onPanelHover}\n // Submit\n needConfirm={needConfirm}\n onOk={triggerOk}\n // Preset\n presets={presetList}\n onPanelChange={triggerModeChange}\n // Value\n format={maskFormat}\n onPickerValueChange={setCurrentPickerValue}\n // Hover\n hoverValue={showWeakHover && activeHoverValue ? [activeHoverValue] : null}\n // Render\n onPresetSubmit={onPresetSubmit}\n // Now\n onNow={onNow}\n onSelect={onPanelSelect}\n // PickerValue\n pickerValue={currentPickerValue}\n />\n );\n\n // ========================================================\n // == Selector ==\n // ========================================================\n\n // ======================== Change ========================\n const onSelectorChange = (date: DateType, index?: number) => {\n triggerRangeValueChange(index!, 'input', date);\n };\n\n const onSelectorInputChange = () => {\n triggerRangeValueChange(activeIndex, 'input');\n };\n\n // ======================= Selector =======================\n const onSelectorFocus: SelectorProps['onFocus'] = (event, index) => {\n triggerRangeValueChange(index!, 'field-switch');\n\n triggerOpen(true, {\n inherit: true,\n });\n\n onFieldFocus(index!, 'input', event);\n };\n\n const onSelectorBlur: SelectorProps['onBlur'] = (event, index) => {\n onFieldBlur(index!, 'input', event);\n };\n\n const onSelectorKeyDown: SelectorProps['onKeyDown'] = (event, preventDefault) => {\n if (event.key === 'Tab') {\n triggerPartConfirm(null, 'keyboard-submit-weak');\n } else if (event.key === 'Escape') {\n triggerRangeValueChange(activeIndex, 'esc');\n triggerOpen(false);\n }\n\n onKeyDown?.(event, preventDefault);\n };\n\n // ======================= Context ========================\n const context = React.useMemo(\n () => ({\n prefixCls,\n locale,\n generateConfig,\n button: components.button,\n input: components.input,\n classNames: mergedClassNames,\n styles: mergedStyles,\n }),\n [\n prefixCls,\n locale,\n generateConfig,\n components.button,\n components.input,\n mergedClassNames,\n mergedStyles,\n ],\n );\n\n // ======================== Effect ========================\n // >>> Mode\n // Reset for every active\n useLayoutEffect(() => {\n if (mergedOpen && activeIndex !== undefined) {\n // Legacy compatible. This effect update should not trigger `onPanelChange`\n triggerModeChange(null, picker, false);\n }\n }, [mergedOpen, activeIndex, picker]);\n\n // ====================== DevWarning ======================\n if (process.env.NODE_ENV !== 'production') {\n const isIndexEmpty = (index: number) => {\n return (\n // Value is empty\n !value?.[index] &&\n // DefaultValue is empty\n !defaultValue?.[index]\n );\n };\n\n if (\n disabled.some(\n (fieldDisabled, index) => fieldDisabled && isIndexEmpty(index) && !allowEmpty[index],\n )\n ) {\n warning(\n false,\n '`disabled` should not set with empty `value`. You should set `allowEmpty` or `value` instead.',\n );\n }\n }\n\n // ======================== Render ========================\n return (\n <PickerContext value={context}>\n <PickerPopup\n direction={filledProps.direction}\n getAnchor={() => selectorRef.current?.nativeElement}\n getPopupContainer={filledProps.getPopupContainer}\n inline={filledProps.inlinePopup}\n placement={filledProps.placement}\n popupElement={panel}\n popupStyle={mergedStyles.popup.root}\n popupClassName={clsx(rootClassName, mergedClassNames.popup.root)}\n // Visible\n visible={mergedOpen}\n onClose={onPopupClose}\n // Range\n range\n >\n <RangeSelector\n // Shared\n {...filledProps}\n // Ref\n activeHelp={!!internalHoverValues}\n focused={focused}\n maskFormat={maskFormat}\n open={mergedOpen}\n onBlur={onSelectorBlur}\n onChange={onSelectorChange}\n onFocus={onSelectorFocus}\n onKeyDown={onSelectorKeyDown}\n activeIndex={focused || mergedOpen ? activeIndex : null}\n // Active\n allHelp={!!internalHoverValues && hoverSource === 'preset'}\n inputReadOnly={inputReadOnly}\n // Disabled\n disabled={disabled}\n ref={selectorRef}\n // Style\n className={clsx(filledProps.className, rootClassName, mergedClassNames.root)}\n style={{ ...mergedStyles.root, ...filledProps.style }}\n // Icon\n suffixIcon={suffixIcon}\n onClear={onSelectorClear}\n // Invalid\n invalid={submitInvalidates}\n // Open\n onInputChange={onSelectorInputChange}\n // Format\n format={formatList}\n onInvalid={onSelectorInvalid}\n // Offset\n onActiveInfo={setActiveInfo}\n onOpenChange={triggerOpen}\n // Click\n onClick={onSelectorClick}\n onSubmit={() => triggerPartConfirm(null, 'keyboard-submit')}\n // Change\n value={hoverValues}\n />\n </PickerPopup>\n </PickerContext>\n );\n}\n\nconst RefRangePicker = React.forwardRef(RangePicker) as <DateType extends object = any>(\n props: RangePickerProps<DateType> & React.RefAttributes<RangePickerRef>,\n) => React.ReactElement;\n\nif (process.env.NODE_ENV !== 'production') {\n (RefRangePicker as any).displayName = 'RefRangePicker';\n}\n\nexport default RefRangePicker;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAS,eAAkB,QAAuC,eAA0B;CAC1F,MAAM,eAAe,UAAU;CAE/B,IAAI,MAAM,QAAQ,YAAY,GAC5B,OAAO;CAGT,OAAO,CAAC,cAAc,YAAY;AACpC;AA4FA,SAAS,eAAe,aAAqB;CAC3C,OAAO,gBAAgB,IAAI,QAAQ;AACrC;AAEA,SAAS,YACP,OACA,KACA;CAEA,MAAM,CAAC,aAAa,gBAAgB,eAAe,YAAY,YAAY,oBACzE,eAAe,aAAa;EAC1B,MAAM,EAAE,UAAU,eAAe;EAKjC,OAAO;GACL,UAJqB,eAAe,UAAU,KAIvB;GACvB,YAJuB,eAAe,YAAY,KAIvB;EAC7B;CACF,CAAC;CAEH,MAAM,EAEJ,WACA,eACA,QAAQ,YACR,YAAY,gBAEZ,cAEA,cACA,OACA,aACA,SACA,WAGA,UACA,YACA,cACA,SACA,SAGA,aACA,MACA,cAGA,QACA,gBACA,QACA,SACA,WACA,UAGA,MACA,eACA,kBACA,MAGA,oBACA,aACA,qBAGA,eAEA,YAGA,SACA,QAGA,SACA,QAGA,YACA,YACA,YACA,iBAGA,YACE;CAGJ,MAAM,cAAc,aAAuE,GA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;EACzC,MAAM,gBAAgB,UAAkB;GACtC,OAEE,CAAC,QAAQ,UAET,CAAC,eAAe;EAEpB;EAEA,IACE,SAAS,MACN,eAAe,UAAU,iBAAiB,aAAa,KAAK,KAAK,CAAC,WAAW,MAChF,GAEA,QACE,OACA,+FACF;CAEJ;CAGA,OACE,oBAAC,eAAD;EAAe,OAAO;EACpB,UAAA,oBAAC,aAAD;GACE,WAAW,YAAY;GACvB,iBAAiB,YAAY,SAAS;GACtC,mBAAmB,YAAY;GAC/B,QAAQ,YAAY;GACpB,WAAW,YAAY;GACvB,cAAc;GACd,YAAY,aAAa,MAAM;GAC/B,gBAAgB,KAAK,eAAe,iBAAiB,MAAM,IAAI;GAE/D,SAAS;GACT,SAAS;GAET,OAAA;GAEA,UAAA,oBAACC,kBAAD;IAEE,GAAI;IAEJ,YAAY,CAAC,CAAC;IACL;IACG;IACZ,MAAM;IACN,QAAQ;IACR,UAAU;IACV,SAAS;IACT,WAAW;IACX,aAAa,WAAW,aAAa,cAAc;IAEnD,SAAS,CAAC,CAAC,uBAAuB,gBAAgB;IACnC;IAEL;IACV,KAAK;IAEL,WAAW,KAAK,YAAY,WAAW,eAAe,iBAAiB,IAAI;IAC3E,OAAO;KAAE,GAAG,aAAa;KAAM,GAAG,YAAY;IAAM;IAExC;IACZ,SAAS;IAET,SAAS;IAET,eAAe;IAEf,QAAQ;IACR,WAAW;IAEX,cAAc;IACd,cAAc;IAEd,SAAS;IACT,gBAAgB,mBAAmB,MAAM,iBAAiB;IAE1D,OAAO;GACR,CAAA;EACU,CAAA;CACA,CAAA;AAEnB;AAEA,MAAM,iBAAiB,MAAM,WAAW,WAAW;AAInD,IAAI,QAAQ,IAAI,aAAa,cAC1B,eAAuB,cAAc"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import PickerContext from "../context.mjs";
|
|
2
2
|
import { clsx } from "clsx";
|
|
3
|
-
import * as React
|
|
3
|
+
import * as React from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
// src/DatePicker/core/PickerInput/Selector/ClearIcon.tsx
|
|
6
6
|
function ClearIcon({ icon, onClear, ...restProps }) {
|
|
7
|
-
const { prefixCls, classNames, styles, locale } = React
|
|
7
|
+
const { prefixCls, classNames, styles, locale } = React.use(PickerContext);
|
|
8
8
|
return /* @__PURE__ */ jsx("button", {
|
|
9
9
|
...restProps,
|
|
10
10
|
"aria-label": locale.clear,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearIcon.mjs","names":[
|
|
1
|
+
{"version":3,"file":"ClearIcon.mjs","names":[],"sources":["../../../../../src/DatePicker/core/PickerInput/Selector/ClearIcon.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport * as React from 'react';\n\nimport PickerContext from '../context';\n\nexport interface ClearIconProps extends React.HtmlHTMLAttributes<HTMLElement> {\n icon?: React.ReactNode;\n onClear: VoidFunction;\n}\n\nexport default function ClearIcon({ icon, onClear, ...restProps }: ClearIconProps) {\n const { prefixCls, classNames, styles, locale } = React.use(PickerContext);\n\n return (\n <button\n {...restProps}\n aria-label={locale.clear}\n className={clsx(`${prefixCls}-clear`, classNames.suffix)}\n style={styles.suffix}\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n onClear();\n }}\n onMouseDown={(e) => {\n e.preventDefault();\n }}\n >\n {icon}\n </button>\n );\n}\n"],"mappings":";;;;;AAUA,SAAwB,UAAU,EAAE,MAAM,SAAS,GAAG,aAA6B;CACjF,MAAM,EAAE,WAAW,YAAY,QAAQ,WAAW,MAAM,IAAI,aAAa;CAEzE,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,cAAY,OAAO;EACnB,WAAW,KAAK,GAAG,UAAU,SAAS,WAAW,MAAM;EACvD,OAAO,OAAO;EACd,MAAK;EACL,UAAU,MAAM;GACd,EAAE,gBAAgB;GAClB,QAAQ;EACV;EACA,cAAc,MAAM;GAClB,EAAE,eAAe;EACnB;EAEC,UAAA;CACK,CAAA;AAEZ"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isReactRenderable } from "../../utils/common.mjs";
|
|
2
2
|
import PickerContext from "../context.mjs";
|
|
3
3
|
import { clsx } from "clsx";
|
|
4
|
-
import * as React
|
|
4
|
+
import * as React from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
// src/DatePicker/core/PickerInput/Selector/Icon.tsx
|
|
7
7
|
function Icon({ icon, ...restProps }) {
|
|
8
|
-
const { prefixCls, classNames, styles } = React
|
|
8
|
+
const { prefixCls, classNames, styles } = React.use(PickerContext);
|
|
9
9
|
return isReactRenderable(icon) ? /* @__PURE__ */ jsx("span", {
|
|
10
10
|
className: clsx(`${prefixCls}-suffix`, classNames.suffix),
|
|
11
11
|
style: styles.suffix,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.mjs","names":[
|
|
1
|
+
{"version":3,"file":"Icon.mjs","names":[],"sources":["../../../../../src/DatePicker/core/PickerInput/Selector/Icon.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport * as React from 'react';\n\nimport { isReactRenderable } from '../../utils/common';\nimport PickerContext from '../context';\n\nexport interface IconProps extends React.HtmlHTMLAttributes<HTMLElement> {\n icon?: React.ReactNode;\n}\n\nexport default function Icon({ icon, ...restProps }: IconProps) {\n const { prefixCls, classNames, styles } = React.use(PickerContext);\n\n return isReactRenderable(icon) ? (\n <span\n className={clsx(`${prefixCls}-suffix`, classNames.suffix)}\n style={styles.suffix}\n {...restProps}\n >\n {icon}\n </span>\n ) : null;\n}\n"],"mappings":";;;;;;AAUA,SAAwB,KAAK,EAAE,MAAM,GAAG,aAAwB;CAC9D,MAAM,EAAE,WAAW,YAAY,WAAW,MAAM,IAAI,aAAa;CAEjE,OAAO,kBAAkB,IAAI,IAC3B,oBAAC,QAAD;EACE,WAAW,KAAK,GAAG,UAAU,UAAU,WAAW,MAAM;EACxD,OAAO,OAAO;EACd,GAAI;EAEH,UAAA;CACG,CAAA,IACJ;AACN"}
|
|
@@ -7,27 +7,27 @@ import Icon from "./Icon.mjs";
|
|
|
7
7
|
import MaskFormat from "./MaskFormat.mjs";
|
|
8
8
|
import { getMaskRange } from "./util.mjs";
|
|
9
9
|
import { clsx } from "clsx";
|
|
10
|
-
import * as React
|
|
10
|
+
import * as React from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
// src/DatePicker/core/PickerInput/Selector/Input.tsx
|
|
13
13
|
const Input = ({ ref, ...props }) => {
|
|
14
14
|
const { className, active, showActiveCls = true, suffixIcon, format, validateFormat, onChange, onInput, helped, onHelp, onSubmit, onKeyDown, preserveInvalidOnBlur = false, invalid, clearIcon, ...restProps } = props;
|
|
15
15
|
const { value, onFocus, onBlur, onMouseUp } = props;
|
|
16
|
-
const { prefixCls, input: Component = "input", classNames, styles } = React
|
|
16
|
+
const { prefixCls, input: Component = "input", classNames, styles } = React.use(PickerContext);
|
|
17
17
|
const inputPrefixCls = `${prefixCls}-input`;
|
|
18
|
-
const [focused, setFocused] = React
|
|
19
|
-
const [internalInputValue, setInputValue] = React
|
|
20
|
-
const [focusCellText, setFocusCellText] = React
|
|
21
|
-
const [focusCellIndex, setFocusCellIndex] = React
|
|
22
|
-
const [forceSelectionSyncMark, forceSelectionSync] = React
|
|
18
|
+
const [focused, setFocused] = React.useState(false);
|
|
19
|
+
const [internalInputValue, setInputValue] = React.useState(value);
|
|
20
|
+
const [focusCellText, setFocusCellText] = React.useState("");
|
|
21
|
+
const [focusCellIndex, setFocusCellIndex] = React.useState(null);
|
|
22
|
+
const [forceSelectionSyncMark, forceSelectionSync] = React.useState(null);
|
|
23
23
|
const inputValue = internalInputValue || "";
|
|
24
|
-
React
|
|
24
|
+
React.useEffect(() => {
|
|
25
25
|
setInputValue(value);
|
|
26
26
|
}, [value]);
|
|
27
|
-
const holderRef = React
|
|
28
|
-
const inputRef = React
|
|
29
|
-
const mouseDownRef = React
|
|
30
|
-
React
|
|
27
|
+
const holderRef = React.useRef(null);
|
|
28
|
+
const inputRef = React.useRef(null);
|
|
29
|
+
const mouseDownRef = React.useRef(false);
|
|
30
|
+
React.useImperativeHandle(ref, () => ({
|
|
31
31
|
nativeElement: holderRef.current,
|
|
32
32
|
inputElement: inputRef.current,
|
|
33
33
|
focus: (options) => {
|
|
@@ -37,8 +37,8 @@ const Input = ({ ref, ...props }) => {
|
|
|
37
37
|
inputRef.current.blur();
|
|
38
38
|
}
|
|
39
39
|
}));
|
|
40
|
-
const maskFormat = React
|
|
41
|
-
const [selectionStart, selectionEnd] = React
|
|
40
|
+
const maskFormat = React.useMemo(() => new MaskFormat(format || ""), [format]);
|
|
41
|
+
const [selectionStart, selectionEnd] = React.useMemo(() => {
|
|
42
42
|
if (helped) return [0, 0];
|
|
43
43
|
return maskFormat.getSelection(focusCellIndex);
|
|
44
44
|
}, [
|
|
@@ -172,7 +172,7 @@ const Input = ({ ref, ...props }) => {
|
|
|
172
172
|
}
|
|
173
173
|
forceSelectionSync({});
|
|
174
174
|
};
|
|
175
|
-
const rafRef = React
|
|
175
|
+
const rafRef = React.useRef(void 0);
|
|
176
176
|
useLayoutEffect$1(() => {
|
|
177
177
|
if (!focused || !format || mouseDownRef.current) return;
|
|
178
178
|
if (!maskFormat.match(inputValue)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.mjs","names":["React"],"sources":["../../../../../src/DatePicker/core/PickerInput/Selector/Input.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport * as React from 'react';\n\nimport { useEvent, useLayoutEffect } from '../../hooks/react';\nimport type { PickerRef } from '../../interface';\nimport { raf } from '../../utils/common';\nimport { leftPad } from '../../utils/miscUtil';\nimport PickerContext from '../context';\nimport useLockEffect from '../hooks/useLockEffect';\nimport Icon from './Icon';\nimport MaskFormat from './MaskFormat';\nimport { getMaskRange } from './util';\n\n// Format logic\n//\n// First time on focus:\n// 1. check if the text is valid, if not fill with format\n// 2. set highlight cell to the first cell\n// Cells\n// 1. Selection the index cell, set inner `cacheValue` to ''\n// 2. Key input filter non-number char, patch after the `cacheValue`\n// 1. Replace the `cacheValue` with input align the cell length\n// 2. Re-selection the mask cell\n// 3. If `cacheValue` match the limit length or cell format (like 1 ~ 12 month), go to next cell\n\nexport interface InputRef extends PickerRef {\n inputElement: HTMLInputElement;\n}\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {\n active?: boolean;\n clearIcon?: React.ReactNode;\n format?: string | null;\n /** Meaning current is from the hover cell getting the placeholder text */\n helped?: boolean;\n invalid?: boolean;\n onChange: (value: string) => void;\n /**\n * Trigger when input need additional help.\n * Like open the popup for interactive.\n */\n onHelp: () => void;\n onSubmit: VoidFunction;\n preserveInvalidOnBlur?: boolean;\n /** Used for single picker only */\n showActiveCls?: boolean;\n suffixIcon?: React.ReactNode;\n validateFormat: (value: string) => boolean;\n\n value?: string;\n}\n\nconst Input = ({ ref, ...props }: InputProps & { ref?: React.RefObject<InputRef | null> }) => {\n const {\n className,\n active,\n showActiveCls = true,\n suffixIcon,\n format,\n validateFormat,\n onChange,\n onInput,\n helped,\n onHelp,\n onSubmit,\n onKeyDown,\n preserveInvalidOnBlur = false,\n invalid,\n clearIcon,\n // Pass to input\n ...restProps\n } = props;\n const { value, onFocus, onBlur, onMouseUp } = props;\n\n const { prefixCls, input: Component = 'input', classNames, styles } = React.use(PickerContext);\n const inputPrefixCls = `${prefixCls}-input`;\n\n // ======================== Value =========================\n const [focused, setFocused] = React.useState(false);\n const [internalInputValue, setInputValue] = React.useState<string | undefined>(value);\n const [focusCellText, setFocusCellText] = React.useState<string>('');\n const [focusCellIndex, setFocusCellIndex] = React.useState<number | null>(null);\n const [forceSelectionSyncMark, forceSelectionSync] = React.useState<object | null>(null);\n\n const inputValue = internalInputValue || '';\n\n // Sync value if needed\n React.useEffect(() => {\n setInputValue(value);\n }, [value]);\n\n // ========================= Refs =========================\n const holderRef = React.useRef<HTMLDivElement>(null);\n const inputRef = React.useRef<HTMLInputElement>(null);\n // When mousedown get focus, defer selection to mouseUp so click position is used\n const mouseDownRef = React.useRef(false);\n\n React.useImperativeHandle(ref, () => ({\n nativeElement: holderRef.current!,\n inputElement: inputRef.current!,\n focus: (options) => {\n inputRef.current!.focus(options);\n },\n blur: () => {\n inputRef.current!.blur();\n },\n }));\n\n // ======================== Format ========================\n const maskFormat = React.useMemo(() => new MaskFormat(format || ''), [format]);\n\n const [selectionStart, selectionEnd] = React.useMemo(() => {\n if (helped) {\n return [0, 0];\n }\n\n return maskFormat.getSelection(focusCellIndex!);\n }, [maskFormat, focusCellIndex, helped]);\n\n // ======================== Modify ========================\n // When input modify content, trigger `onHelp` if is not the format\n const onModify = (text: string) => {\n if (text && text !== format && text !== value) {\n onHelp();\n }\n };\n\n // ======================== Change ========================\n /**\n * Triggered by paste, keyDown and focus to show format\n */\n const triggerInputChange = useEvent((text: string) => {\n if (validateFormat(text)) {\n onChange(text);\n }\n setInputValue(text);\n onModify(text);\n });\n\n // Directly trigger `onChange` if `format` is empty\n const onInternalChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n // Hack `onChange` with format to do nothing\n if (!format) {\n const text = event.target.value;\n\n onModify(text);\n setInputValue(text);\n onChange(text);\n }\n };\n\n const onFormatPaste: React.ClipboardEventHandler<HTMLInputElement> = (event) => {\n // Block paste until selection is set (after mouseUp when focus was by mousedown)\n if (mouseDownRef.current) {\n event.preventDefault();\n return;\n }\n\n // Get paste text\n const pasteText = event.clipboardData.getData('text');\n\n if (validateFormat(pasteText)) {\n triggerInputChange(pasteText);\n }\n };\n\n // ======================== Mouse =========================\n // When `mouseDown` get focus, it's better to not to change the selection\n // Since the up position maybe not is the first cell\n const onFormatMouseDown: React.MouseEventHandler<HTMLInputElement> = () => {\n mouseDownRef.current = true;\n };\n\n const onFormatMouseUp: React.MouseEventHandler<HTMLInputElement> = (event) => {\n const { selectionStart: start } = event.target as HTMLInputElement;\n\n const closeMaskIndex = maskFormat.getMaskCellIndex(start!);\n setFocusCellIndex(closeMaskIndex);\n\n // Force update the selection\n forceSelectionSync({});\n\n onMouseUp?.(event);\n\n mouseDownRef.current = false;\n };\n\n // ====================== Focus Blur ======================\n const onFormatFocus: React.FocusEventHandler<HTMLInputElement> = (event) => {\n setFocused(true);\n setFocusCellIndex(0);\n setFocusCellText('');\n\n onFocus!(event);\n };\n\n const onSharedBlur: React.FocusEventHandler<HTMLInputElement> = (event) => {\n onBlur!(event);\n };\n\n const onFormatBlur: React.FocusEventHandler<HTMLInputElement> = (event) => {\n setFocused(false);\n\n onSharedBlur(event);\n };\n\n // ======================== Active ========================\n // Check if blur need reset input value\n useLockEffect(active, () => {\n if (!active && !preserveInvalidOnBlur) {\n setInputValue(value);\n }\n });\n\n // ======================= Keyboard =======================\n const onSharedKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {\n if (event.key === 'Enter' && validateFormat(inputValue)) {\n onSubmit();\n }\n\n onKeyDown?.(event);\n };\n\n const onFormatKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {\n // Block key input until selection is set (after mouseUp when focus was by mousedown)\n if (mouseDownRef.current) {\n event.preventDefault();\n return;\n }\n\n onSharedKeyDown(event);\n\n const { key } = event;\n\n // Save the cache with cell text\n let nextCellText: string | null = null;\n\n // Fill in the input\n let nextFillText: string | null = null;\n\n const maskCellLen = selectionEnd - selectionStart;\n const cellFormat = format!.slice(selectionStart, selectionEnd);\n\n // Cell Index\n const offsetCellIndex = (offset: number) => {\n setFocusCellIndex((idx) => {\n let nextIndex = idx! + offset;\n nextIndex = Math.max(nextIndex, 0);\n nextIndex = Math.min(nextIndex, maskFormat.size() - 1);\n return nextIndex;\n });\n };\n\n // Range\n const offsetCellValue = (offset: number) => {\n const [rangeStart, rangeEnd, rangeDefault] = getMaskRange(cellFormat);\n\n const currentText = inputValue.slice(selectionStart, selectionEnd);\n const currentTextNum = Number(currentText);\n\n if (isNaN(currentTextNum)) {\n return String(rangeDefault ? rangeDefault : offset > 0 ? rangeStart : rangeEnd);\n }\n\n const num = currentTextNum + offset;\n const range = rangeEnd - rangeStart + 1;\n return String(rangeStart + ((range + num - rangeStart) % range));\n };\n\n switch (key) {\n // =============== Remove ===============\n case 'Backspace':\n case 'Delete': {\n nextCellText = '';\n nextFillText = cellFormat;\n break;\n }\n\n // =============== Arrows ===============\n // Left key\n case 'ArrowLeft': {\n nextCellText = '';\n offsetCellIndex(-1);\n break;\n }\n\n // Right key\n case 'ArrowRight': {\n nextCellText = '';\n offsetCellIndex(1);\n break;\n }\n\n // Up key\n case 'ArrowUp': {\n nextCellText = '';\n nextFillText = offsetCellValue(1);\n break;\n }\n\n // Down key\n case 'ArrowDown': {\n nextCellText = '';\n nextFillText = offsetCellValue(-1);\n break;\n }\n\n // =============== Number ===============\n default: {\n if (!isNaN(Number(key))) {\n nextCellText = focusCellText + key;\n nextFillText = nextCellText;\n }\n break;\n }\n }\n\n // Update cell text\n if (nextCellText !== null) {\n setFocusCellText(nextCellText);\n\n if (nextCellText.length >= maskCellLen) {\n // Go to next cell\n offsetCellIndex(1);\n setFocusCellText('');\n }\n }\n\n // Update the input text\n if (nextFillText !== null) {\n // Replace selection range with `nextCellText`\n const nextFocusValue =\n // before\n inputValue.slice(0, selectionStart) +\n // replace\n leftPad(nextFillText, maskCellLen) +\n // after\n inputValue.slice(selectionEnd);\n triggerInputChange(nextFocusValue.slice(0, format!.length));\n }\n\n // Always trigger selection sync after key down\n forceSelectionSync({});\n };\n\n // ======================== Format ========================\n const rafRef = React.useRef<number | undefined>(undefined);\n\n useLayoutEffect(() => {\n if (!focused || !format || mouseDownRef.current) {\n return;\n }\n\n // Reset with format if not match\n if (!maskFormat.match(inputValue)) {\n triggerInputChange(format);\n return;\n }\n\n // Match the selection range\n inputRef.current!.setSelectionRange(selectionStart, selectionEnd);\n\n // Chrome has the bug anchor position looks not correct but actually correct\n rafRef.current = raf(() => {\n inputRef.current!.setSelectionRange(selectionStart, selectionEnd);\n });\n\n return () => {\n raf.cancel(rafRef.current!);\n };\n }, [\n maskFormat,\n format,\n focused,\n inputValue,\n focusCellIndex,\n selectionStart,\n selectionEnd,\n forceSelectionSyncMark,\n triggerInputChange,\n ]);\n\n // ======================== Render ========================\n // Input props for format\n const inputProps: React.InputHTMLAttributes<HTMLInputElement> = format\n ? {\n onFocus: onFormatFocus,\n onBlur: onFormatBlur,\n onKeyDown: onFormatKeyDown,\n onMouseDown: onFormatMouseDown,\n onMouseUp: onFormatMouseUp,\n onPaste: onFormatPaste,\n }\n : {};\n\n return (\n <div\n ref={holderRef}\n className={clsx(\n inputPrefixCls,\n {\n [`${inputPrefixCls}-active`]: active && showActiveCls,\n [`${inputPrefixCls}-placeholder`]: helped,\n },\n className,\n )}\n >\n <Component\n aria-invalid={invalid}\n autoComplete=\"off\"\n ref={inputRef}\n {...restProps}\n onKeyDown={onSharedKeyDown}\n onBlur={onSharedBlur}\n // Replace with format\n {...inputProps}\n // Value\n className={classNames.input}\n style={styles.input}\n value={inputValue}\n onChange={onInternalChange}\n />\n <Icon icon={suffixIcon} />\n {clearIcon}\n </div>\n );\n};\n\nif (process.env.NODE_ENV !== 'production') {\n Input.displayName = 'Input';\n}\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;;AAoDA,MAAM,SAAS,EAAE,KAAK,GAAG,YAAqE;CAC5F,MAAM,EACJ,WACA,QACA,gBAAgB,MAChB,YACA,QACA,gBACA,UACA,SACA,QACA,QACA,UACA,WACA,wBAAwB,OACxB,SACA,WAEA,GAAG,cACD;CACJ,MAAM,EAAE,OAAO,SAAS,QAAQ,cAAc;CAE9C,MAAM,EAAE,WAAW,OAAO,YAAY,SAAS,YAAY,WAAWA,QAAM,IAAI,aAAa;CAC7F,MAAM,iBAAiB,GAAG,UAAU;CAGpC,MAAM,CAAC,SAAS,cAAcA,QAAM,SAAS,KAAK;CAClD,MAAM,CAAC,oBAAoB,iBAAiBA,QAAM,SAA6B,KAAK;CACpF,MAAM,CAAC,eAAe,oBAAoBA,QAAM,SAAiB,EA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,QAAS,kBAAkB,gBAAgB,YAAY;EAClE,CAAC;EAED,aAAa;GACX,IAAI,OAAO,OAAO,OAAQ;EAC5B;CACF,GAAG;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAID,MAAM,aAA0D,SAC5D;EACE,SAAS;EACT,QAAQ;EACR,WAAW;EACX,aAAa;EACb,WAAW;EACX,SAAS;CACX,IACA,CAAC;CAEL,OACE,qBAAC,OAAD;EACE,KAAK;EACL,WAAW,KACT,gBACA;IACG,GAAG,eAAe,WAAW,UAAU;IACvC,GAAG,eAAe,gBAAgB;EACrC,GACA,SACF;EATF,UAAA;GAWE,oBAAC,WAAD;IACE,gBAAc;IACd,cAAa;IACb,KAAK;IACL,GAAI;IACJ,WAAW;IACX,QAAQ;IAER,GAAI;IAEJ,WAAW,WAAW;IACtB,OAAO,OAAO;IACd,OAAO;IACP,UAAU;GACX,CAAA;GACD,oBAAC,MAAD,EAAM,MAAM,WAAa,CAAA;GACxB;EACE;;AAET;AAEA,IAAI,QAAQ,IAAI,aAAa,cAC3B,MAAM,cAAc"}
|
|
1
|
+
{"version":3,"file":"Input.mjs","names":["useLayoutEffect"],"sources":["../../../../../src/DatePicker/core/PickerInput/Selector/Input.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport * as React from 'react';\n\nimport { useEvent, useLayoutEffect } from '../../hooks/react';\nimport type { PickerRef } from '../../interface';\nimport { raf } from '../../utils/common';\nimport { leftPad } from '../../utils/miscUtil';\nimport PickerContext from '../context';\nimport useLockEffect from '../hooks/useLockEffect';\nimport Icon from './Icon';\nimport MaskFormat from './MaskFormat';\nimport { getMaskRange } from './util';\n\n// Format logic\n//\n// First time on focus:\n// 1. check if the text is valid, if not fill with format\n// 2. set highlight cell to the first cell\n// Cells\n// 1. Selection the index cell, set inner `cacheValue` to ''\n// 2. Key input filter non-number char, patch after the `cacheValue`\n// 1. Replace the `cacheValue` with input align the cell length\n// 2. Re-selection the mask cell\n// 3. If `cacheValue` match the limit length or cell format (like 1 ~ 12 month), go to next cell\n\nexport interface InputRef extends PickerRef {\n inputElement: HTMLInputElement;\n}\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {\n active?: boolean;\n clearIcon?: React.ReactNode;\n format?: string | null;\n /** Meaning current is from the hover cell getting the placeholder text */\n helped?: boolean;\n invalid?: boolean;\n onChange: (value: string) => void;\n /**\n * Trigger when input need additional help.\n * Like open the popup for interactive.\n */\n onHelp: () => void;\n onSubmit: VoidFunction;\n preserveInvalidOnBlur?: boolean;\n /** Used for single picker only */\n showActiveCls?: boolean;\n suffixIcon?: React.ReactNode;\n validateFormat: (value: string) => boolean;\n\n value?: string;\n}\n\nconst Input = ({ ref, ...props }: InputProps & { ref?: React.RefObject<InputRef | null> }) => {\n const {\n className,\n active,\n showActiveCls = true,\n suffixIcon,\n format,\n validateFormat,\n onChange,\n onInput,\n helped,\n onHelp,\n onSubmit,\n onKeyDown,\n preserveInvalidOnBlur = false,\n invalid,\n clearIcon,\n // Pass to input\n ...restProps\n } = props;\n const { value, onFocus, onBlur, onMouseUp } = props;\n\n const { prefixCls, input: Component = 'input', classNames, styles } = React.use(PickerContext);\n const inputPrefixCls = `${prefixCls}-input`;\n\n // ======================== Value =========================\n const [focused, setFocused] = React.useState(false);\n const [internalInputValue, setInputValue] = React.useState<string | undefined>(value);\n const [focusCellText, setFocusCellText] = React.useState<string>('');\n const [focusCellIndex, setFocusCellIndex] = React.useState<number | null>(null);\n const [forceSelectionSyncMark, forceSelectionSync] = React.useState<object | null>(null);\n\n const inputValue = internalInputValue || '';\n\n // Sync value if needed\n React.useEffect(() => {\n setInputValue(value);\n }, [value]);\n\n // ========================= Refs =========================\n const holderRef = React.useRef<HTMLDivElement>(null);\n const inputRef = React.useRef<HTMLInputElement>(null);\n // When mousedown get focus, defer selection to mouseUp so click position is used\n const mouseDownRef = React.useRef(false);\n\n React.useImperativeHandle(ref, () => ({\n nativeElement: holderRef.current!,\n inputElement: inputRef.current!,\n focus: (options) => {\n inputRef.current!.focus(options);\n },\n blur: () => {\n inputRef.current!.blur();\n },\n }));\n\n // ======================== Format ========================\n const maskFormat = React.useMemo(() => new MaskFormat(format || ''), [format]);\n\n const [selectionStart, selectionEnd] = React.useMemo(() => {\n if (helped) {\n return [0, 0];\n }\n\n return maskFormat.getSelection(focusCellIndex!);\n }, [maskFormat, focusCellIndex, helped]);\n\n // ======================== Modify ========================\n // When input modify content, trigger `onHelp` if is not the format\n const onModify = (text: string) => {\n if (text && text !== format && text !== value) {\n onHelp();\n }\n };\n\n // ======================== Change ========================\n /**\n * Triggered by paste, keyDown and focus to show format\n */\n const triggerInputChange = useEvent((text: string) => {\n if (validateFormat(text)) {\n onChange(text);\n }\n setInputValue(text);\n onModify(text);\n });\n\n // Directly trigger `onChange` if `format` is empty\n const onInternalChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n // Hack `onChange` with format to do nothing\n if (!format) {\n const text = event.target.value;\n\n onModify(text);\n setInputValue(text);\n onChange(text);\n }\n };\n\n const onFormatPaste: React.ClipboardEventHandler<HTMLInputElement> = (event) => {\n // Block paste until selection is set (after mouseUp when focus was by mousedown)\n if (mouseDownRef.current) {\n event.preventDefault();\n return;\n }\n\n // Get paste text\n const pasteText = event.clipboardData.getData('text');\n\n if (validateFormat(pasteText)) {\n triggerInputChange(pasteText);\n }\n };\n\n // ======================== Mouse =========================\n // When `mouseDown` get focus, it's better to not to change the selection\n // Since the up position maybe not is the first cell\n const onFormatMouseDown: React.MouseEventHandler<HTMLInputElement> = () => {\n mouseDownRef.current = true;\n };\n\n const onFormatMouseUp: React.MouseEventHandler<HTMLInputElement> = (event) => {\n const { selectionStart: start } = event.target as HTMLInputElement;\n\n const closeMaskIndex = maskFormat.getMaskCellIndex(start!);\n setFocusCellIndex(closeMaskIndex);\n\n // Force update the selection\n forceSelectionSync({});\n\n onMouseUp?.(event);\n\n mouseDownRef.current = false;\n };\n\n // ====================== Focus Blur ======================\n const onFormatFocus: React.FocusEventHandler<HTMLInputElement> = (event) => {\n setFocused(true);\n setFocusCellIndex(0);\n setFocusCellText('');\n\n onFocus!(event);\n };\n\n const onSharedBlur: React.FocusEventHandler<HTMLInputElement> = (event) => {\n onBlur!(event);\n };\n\n const onFormatBlur: React.FocusEventHandler<HTMLInputElement> = (event) => {\n setFocused(false);\n\n onSharedBlur(event);\n };\n\n // ======================== Active ========================\n // Check if blur need reset input value\n useLockEffect(active, () => {\n if (!active && !preserveInvalidOnBlur) {\n setInputValue(value);\n }\n });\n\n // ======================= Keyboard =======================\n const onSharedKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {\n if (event.key === 'Enter' && validateFormat(inputValue)) {\n onSubmit();\n }\n\n onKeyDown?.(event);\n };\n\n const onFormatKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {\n // Block key input until selection is set (after mouseUp when focus was by mousedown)\n if (mouseDownRef.current) {\n event.preventDefault();\n return;\n }\n\n onSharedKeyDown(event);\n\n const { key } = event;\n\n // Save the cache with cell text\n let nextCellText: string | null = null;\n\n // Fill in the input\n let nextFillText: string | null = null;\n\n const maskCellLen = selectionEnd - selectionStart;\n const cellFormat = format!.slice(selectionStart, selectionEnd);\n\n // Cell Index\n const offsetCellIndex = (offset: number) => {\n setFocusCellIndex((idx) => {\n let nextIndex = idx! + offset;\n nextIndex = Math.max(nextIndex, 0);\n nextIndex = Math.min(nextIndex, maskFormat.size() - 1);\n return nextIndex;\n });\n };\n\n // Range\n const offsetCellValue = (offset: number) => {\n const [rangeStart, rangeEnd, rangeDefault] = getMaskRange(cellFormat);\n\n const currentText = inputValue.slice(selectionStart, selectionEnd);\n const currentTextNum = Number(currentText);\n\n if (isNaN(currentTextNum)) {\n return String(rangeDefault ? rangeDefault : offset > 0 ? rangeStart : rangeEnd);\n }\n\n const num = currentTextNum + offset;\n const range = rangeEnd - rangeStart + 1;\n return String(rangeStart + ((range + num - rangeStart) % range));\n };\n\n switch (key) {\n // =============== Remove ===============\n case 'Backspace':\n case 'Delete': {\n nextCellText = '';\n nextFillText = cellFormat;\n break;\n }\n\n // =============== Arrows ===============\n // Left key\n case 'ArrowLeft': {\n nextCellText = '';\n offsetCellIndex(-1);\n break;\n }\n\n // Right key\n case 'ArrowRight': {\n nextCellText = '';\n offsetCellIndex(1);\n break;\n }\n\n // Up key\n case 'ArrowUp': {\n nextCellText = '';\n nextFillText = offsetCellValue(1);\n break;\n }\n\n // Down key\n case 'ArrowDown': {\n nextCellText = '';\n nextFillText = offsetCellValue(-1);\n break;\n }\n\n // =============== Number ===============\n default: {\n if (!isNaN(Number(key))) {\n nextCellText = focusCellText + key;\n nextFillText = nextCellText;\n }\n break;\n }\n }\n\n // Update cell text\n if (nextCellText !== null) {\n setFocusCellText(nextCellText);\n\n if (nextCellText.length >= maskCellLen) {\n // Go to next cell\n offsetCellIndex(1);\n setFocusCellText('');\n }\n }\n\n // Update the input text\n if (nextFillText !== null) {\n // Replace selection range with `nextCellText`\n const nextFocusValue =\n // before\n inputValue.slice(0, selectionStart) +\n // replace\n leftPad(nextFillText, maskCellLen) +\n // after\n inputValue.slice(selectionEnd);\n triggerInputChange(nextFocusValue.slice(0, format!.length));\n }\n\n // Always trigger selection sync after key down\n forceSelectionSync({});\n };\n\n // ======================== Format ========================\n const rafRef = React.useRef<number | undefined>(undefined);\n\n useLayoutEffect(() => {\n if (!focused || !format || mouseDownRef.current) {\n return;\n }\n\n // Reset with format if not match\n if (!maskFormat.match(inputValue)) {\n triggerInputChange(format);\n return;\n }\n\n // Match the selection range\n inputRef.current!.setSelectionRange(selectionStart, selectionEnd);\n\n // Chrome has the bug anchor position looks not correct but actually correct\n rafRef.current = raf(() => {\n inputRef.current!.setSelectionRange(selectionStart, selectionEnd);\n });\n\n return () => {\n raf.cancel(rafRef.current!);\n };\n }, [\n maskFormat,\n format,\n focused,\n inputValue,\n focusCellIndex,\n selectionStart,\n selectionEnd,\n forceSelectionSyncMark,\n triggerInputChange,\n ]);\n\n // ======================== Render ========================\n // Input props for format\n const inputProps: React.InputHTMLAttributes<HTMLInputElement> = format\n ? {\n onFocus: onFormatFocus,\n onBlur: onFormatBlur,\n onKeyDown: onFormatKeyDown,\n onMouseDown: onFormatMouseDown,\n onMouseUp: onFormatMouseUp,\n onPaste: onFormatPaste,\n }\n : {};\n\n return (\n <div\n ref={holderRef}\n className={clsx(\n inputPrefixCls,\n {\n [`${inputPrefixCls}-active`]: active && showActiveCls,\n [`${inputPrefixCls}-placeholder`]: helped,\n },\n className,\n )}\n >\n <Component\n aria-invalid={invalid}\n autoComplete=\"off\"\n ref={inputRef}\n {...restProps}\n onKeyDown={onSharedKeyDown}\n onBlur={onSharedBlur}\n // Replace with format\n {...inputProps}\n // Value\n className={classNames.input}\n style={styles.input}\n value={inputValue}\n onChange={onInternalChange}\n />\n <Icon icon={suffixIcon} />\n {clearIcon}\n </div>\n );\n};\n\nif (process.env.NODE_ENV !== 'production') {\n Input.displayName = 'Input';\n}\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;;AAoDA,MAAM,SAAS,EAAE,KAAK,GAAG,YAAqE;CAC5F,MAAM,EACJ,WACA,QACA,gBAAgB,MAChB,YACA,QACA,gBACA,UACA,SACA,QACA,QACA,UACA,WACA,wBAAwB,OACxB,SACA,WAEA,GAAG,cACD;CACJ,MAAM,EAAE,OAAO,SAAS,QAAQ,cAAc;CAE9C,MAAM,EAAE,WAAW,OAAO,YAAY,SAAS,YAAY,WAAW,MAAM,IAAI,aAAa;CAC7F,MAAM,iBAAiB,GAAG,UAAU;CAGpC,MAAM,CAAC,SAAS,cAAc,MAAM,SAAS,KAAK;CAClD,MAAM,CAAC,oBAAoB,iBAAiB,MAAM,SAA6B,KAAK;CACpF,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAAiB,EAAE;CACnE,MAAM,CAAC,gBAAgB,qBAAqB,MAAM,SAAwB,IAAI;CAC9E,MAAM,CAAC,wBAAwB,sBAAsB,MAAM,SAAwB,IAAI;CAEvF,MAAM,aA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ACA;EACA;CACF,CAAC;CAID,MAAM,aAA0D,SAC5D;EACE,SAAS;EACT,QAAQ;EACR,WAAW;EACX,aAAa;EACb,WAAW;EACX,SAAS;CACX,IACA,CAAC;CAEL,OACE,qBAAC,OAAD;EACE,KAAK;EACL,WAAW,KACT,gBACA;IACG,GAAG,eAAe,WAAW,UAAU;IACvC,GAAG,eAAe,gBAAgB;EACrC,GACA,SACF;EATF,UAAA;GAWE,oBAAC,WAAD;IACE,gBAAc;IACd,cAAa;IACb,KAAK;IACL,GAAI;IACJ,WAAW;IACX,QAAQ;IAER,GAAI;IAEJ,WAAW,WAAW;IACtB,OAAO,OAAO;IACd,OAAO;IACP,UAAU;GACX,CAAA;GACD,oBAAC,MAAD,EAAM,MAAM,WAAa,CAAA;GACxB;EACE;;AAET;AAEA,IAAI,QAAQ,IAAI,aAAa,cAC3B,MAAM,cAAc"}
|
|
@@ -7,23 +7,23 @@ import useRootProps from "./hooks/useRootProps.mjs";
|
|
|
7
7
|
import Icon from "./Icon.mjs";
|
|
8
8
|
import Input from "./Input.mjs";
|
|
9
9
|
import { clsx } from "clsx";
|
|
10
|
-
import * as React
|
|
10
|
+
import * as React from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
// src/DatePicker/core/PickerInput/Selector/RangeSelector.tsx
|
|
13
13
|
function RangeSelector(props, ref) {
|
|
14
14
|
const { id, prefix, clearIcon, suffixIcon, separator = "~", activeIndex, activeHelp, allHelp, focused, onFocus, onBlur, onKeyDown, locale, generateConfig, placeholder, className, style, onClick, onClear, value, onChange, onSubmit, onInputChange, format, maskFormat, preserveInvalidOnBlur, onInvalid, disabled, invalid, inputReadOnly, direction, onOpenChange, onActiveInfo, placement, onMouseDown, required, "aria-required": ariaRequired, autoFocus, tabIndex, ...restProps } = props;
|
|
15
15
|
const rtl = direction === "rtl";
|
|
16
|
-
const { prefixCls, classNames, styles } = React
|
|
17
|
-
const ids = React
|
|
16
|
+
const { prefixCls, classNames, styles } = React.use(PickerContext);
|
|
17
|
+
const ids = React.useMemo(() => {
|
|
18
18
|
if (typeof id === "string") return [id];
|
|
19
19
|
const mergedId = id || {};
|
|
20
20
|
return [mergedId.start, mergedId.end];
|
|
21
21
|
}, [id]);
|
|
22
|
-
const rootRef = React
|
|
23
|
-
const inputStartRef = React
|
|
24
|
-
const inputEndRef = React
|
|
22
|
+
const rootRef = React.useRef(null);
|
|
23
|
+
const inputStartRef = React.useRef(null);
|
|
24
|
+
const inputEndRef = React.useRef(null);
|
|
25
25
|
const getInput = (index) => [inputStartRef, inputEndRef][index]?.current;
|
|
26
|
-
React
|
|
26
|
+
React.useImperativeHandle(ref, () => ({
|
|
27
27
|
nativeElement: rootRef.current,
|
|
28
28
|
startInput: inputStartRef.current.inputElement,
|
|
29
29
|
endInput: inputEndRef.current.inputElement,
|
|
@@ -39,13 +39,13 @@ function RangeSelector(props, ref) {
|
|
|
39
39
|
}
|
|
40
40
|
}));
|
|
41
41
|
const rootProps = useRootProps(restProps);
|
|
42
|
-
const mergedPlaceholder = React
|
|
42
|
+
const mergedPlaceholder = React.useMemo(() => Array.isArray(placeholder) ? placeholder : [placeholder, placeholder], [placeholder]);
|
|
43
43
|
const [getInputProps] = useInputProps({
|
|
44
44
|
...props,
|
|
45
45
|
id: ids,
|
|
46
46
|
placeholder: mergedPlaceholder
|
|
47
47
|
});
|
|
48
|
-
const [activeBarStyle, setActiveBarStyle] = React
|
|
48
|
+
const [activeBarStyle, setActiveBarStyle] = React.useState({
|
|
49
49
|
position: "absolute",
|
|
50
50
|
width: 0
|
|
51
51
|
});
|
|
@@ -67,7 +67,7 @@ function RangeSelector(props, ref) {
|
|
|
67
67
|
]);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
React
|
|
70
|
+
React.useEffect(() => {
|
|
71
71
|
syncActiveOffset();
|
|
72
72
|
}, [activeIndex]);
|
|
73
73
|
useResizeObserver(rootRef, syncActiveOffset);
|
|
@@ -128,7 +128,7 @@ function RangeSelector(props, ref) {
|
|
|
128
128
|
]
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
const RefRangeSelector = React
|
|
131
|
+
const RefRangeSelector = React.forwardRef(RangeSelector);
|
|
132
132
|
if (process.env.NODE_ENV !== "production") RefRangeSelector.displayName = "RangeSelector";
|
|
133
133
|
export { RefRangeSelector as default };
|
|
134
134
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeSelector.mjs","names":["React"],"sources":["../../../../../src/DatePicker/core/PickerInput/Selector/RangeSelector.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport * as React from 'react';\n\nimport { useEvent, useResizeObserver } from '../../hooks/react';\nimport type { RangePickerRef, SelectorProps } from '../../interface';\nimport { isReactRenderable } from '../../utils/common';\nimport PickerContext from '../context';\nimport ClearIcon from './ClearIcon';\nimport useInputProps from './hooks/useInputProps';\nimport useRootProps from './hooks/useRootProps';\nimport Icon from './Icon';\nimport Input, { type InputRef } from './Input';\n\nexport type SelectorIdType =\n | string\n | {\n start?: string;\n end?: string;\n };\n\nexport interface RangeSelectorRef extends RangePickerRef {\n endInput: HTMLInputElement;\n startInput: HTMLInputElement;\n}\n\nexport interface RangeSelectorProps<DateType = any> extends SelectorProps<DateType> {\n activeIndex: number | null;\n\n /** All the field show as `placeholder` */\n allHelp: boolean;\n\n disabled: [boolean, boolean];\n\n id?: SelectorIdType;\n // Invalid\n invalid: [boolean, boolean];\n\n // Offset\n /**\n * Trigger when the active bar offset position changed.\n * This is used for popup panel offset.\n */\n onActiveInfo: (\n info: [activeInputLeft: number, activeInputRight: number, selectorWidth: number],\n ) => void;\n\n onChange: (date: DateType, index?: number) => void;\n\n placeholder?: string | [string, string];\n\n placement?: string;\n separator?: React.ReactNode;\n value?: [start?: DateType | null, end?: DateType | null];\n}\n\nfunction RangeSelector<DateType extends object = any>(\n props: RangeSelectorProps<DateType>,\n ref: React.Ref<RangeSelectorRef>,\n) {\n const {\n id,\n\n prefix,\n clearIcon,\n suffixIcon,\n separator = '~',\n activeIndex,\n activeHelp,\n allHelp,\n\n focused,\n onFocus,\n onBlur,\n onKeyDown,\n locale,\n generateConfig,\n\n // Placeholder\n placeholder,\n\n // Style\n className,\n style,\n\n // Click\n onClick,\n onClear,\n\n // Change\n value,\n onChange,\n onSubmit,\n onInputChange,\n\n // Valid\n format,\n maskFormat,\n preserveInvalidOnBlur,\n onInvalid,\n\n // Disabled\n disabled,\n invalid,\n inputReadOnly,\n\n // Direction\n direction,\n\n // Open\n onOpenChange,\n\n // Offset\n onActiveInfo,\n placement,\n\n // Native\n onMouseDown,\n\n // Input\n required,\n 'aria-required': ariaRequired,\n autoFocus,\n tabIndex,\n\n ...restProps\n } = props;\n\n const rtl = direction === 'rtl';\n\n // ======================== Prefix ========================\n const { prefixCls, classNames, styles } = React.use(PickerContext);\n\n // ========================== Id ==========================\n const ids = React.useMemo(() => {\n if (typeof id === 'string') {\n return [id];\n }\n\n const mergedId = id || {};\n\n return [mergedId.start, mergedId.end];\n }, [id]);\n\n // ========================= Refs =========================\n const rootRef = React.useRef<HTMLDivElement>(null);\n const inputStartRef = React.useRef<InputRef>(null);\n const inputEndRef = React.useRef<InputRef>(null);\n\n const getInput = (index: number) => [inputStartRef, inputEndRef][index]?.current;\n\n React.useImperativeHandle(ref, () => ({\n nativeElement: rootRef.current!,\n startInput: inputStartRef.current!.inputElement,\n endInput: inputEndRef.current!.inputElement,\n focus: (options) => {\n if (typeof options === 'object') {\n const { index = 0, ...rest } = options || {};\n getInput(index)?.focus(rest);\n } else {\n getInput(options ?? 0)?.focus();\n }\n },\n blur: () => {\n getInput(0)?.blur();\n getInput(1)?.blur();\n },\n }));\n\n // ======================== Props =========================\n const rootProps = useRootProps(restProps);\n\n // ===================== Placeholder ======================\n const mergedPlaceholder = React.useMemo<[string | undefined, string | undefined]>(\n () => (Array.isArray(placeholder) ? placeholder : [placeholder, placeholder]),\n [placeholder],\n );\n\n // ======================== Inputs ========================\n const [getInputProps] = useInputProps({\n ...props,\n id: ids,\n placeholder: mergedPlaceholder,\n });\n\n // ====================== ActiveBar =======================\n const [activeBarStyle, setActiveBarStyle] = React.useState<React.CSSProperties>({\n position: 'absolute',\n width: 0,\n });\n\n const syncActiveOffset = useEvent(() => {\n const input = getInput(activeIndex!);\n if (input) {\n const inputRect = input.nativeElement.getBoundingClientRect();\n const parentRect = rootRef.current!.getBoundingClientRect();\n\n const rectOffset = inputRect.left - parentRect.left;\n setActiveBarStyle((ori) => ({\n ...ori,\n width: inputRect.width,\n left: rectOffset,\n }));\n onActiveInfo([inputRect.left, inputRect.right, parentRect.width]);\n }\n });\n\n React.useEffect(() => {\n syncActiveOffset();\n }, [activeIndex]);\n\n useResizeObserver(rootRef, syncActiveOffset);\n\n // ======================== Clear =========================\n const showClear =\n isReactRenderable(clearIcon) && ((value![0] && !disabled[0]) || (value![1] && !disabled[1]));\n\n // ======================= Disabled =======================\n const startAutoFocus = autoFocus && !disabled[0];\n const endAutoFocus = autoFocus && !startAutoFocus && !disabled[1];\n\n // ======================== Render ========================\n return (\n <div\n {...rootProps}\n ref={rootRef}\n style={style}\n className={clsx(\n prefixCls,\n `${prefixCls}-range`,\n {\n [`${prefixCls}-focused`]: focused,\n [`${prefixCls}-disabled`]: disabled.every((i) => i),\n [`${prefixCls}-invalid`]: invalid.some((i) => i),\n [`${prefixCls}-rtl`]: rtl,\n },\n className,\n )}\n onClick={onClick}\n // Not lose current input focus\n onMouseDown={(e) => {\n const { target } = e;\n if (\n target !== inputStartRef.current!.inputElement &&\n target !== inputEndRef.current!.inputElement\n ) {\n e.preventDefault();\n }\n\n onMouseDown?.(e);\n }}\n >\n {isReactRenderable(prefix) && (\n <div className={clsx(`${prefixCls}-prefix`, classNames.prefix)} style={styles.prefix}>\n {prefix}\n </div>\n )}\n <Input\n ref={inputStartRef}\n {...getInputProps(0)}\n autoFocus={startAutoFocus}\n className={`${prefixCls}-input-start`}\n date-range=\"start\"\n tabIndex={tabIndex}\n />\n <div className={`${prefixCls}-range-separator`}>{separator}</div>\n <Input\n ref={inputEndRef}\n {...getInputProps(1)}\n autoFocus={endAutoFocus}\n className={`${prefixCls}-input-end`}\n date-range=\"end\"\n tabIndex={tabIndex}\n />\n <div className={`${prefixCls}-active-bar`} style={activeBarStyle} />\n <Icon icon={suffixIcon} />\n {showClear && <ClearIcon icon={clearIcon} onClear={onClear} />}\n </div>\n );\n}\n\nconst RefRangeSelector = React.forwardRef<RangeSelectorRef, RangeSelectorProps>(RangeSelector);\n\nif (process.env.NODE_ENV !== 'production') {\n RefRangeSelector.displayName = 'RangeSelector';\n}\n\nexport default RefRangeSelector;\n"],"mappings":";;;;;;;;;;;;AAuDA,SAAS,cACP,OACA,KACA;CACA,MAAM,EACJ,IAEA,QACA,WACA,YACA,YAAY,KACZ,aACA,YACA,SAEA,SACA,SACA,QACA,WACA,QACA,gBAGA,aAGA,WACA,OAGA,SACA,SAGA,OACA,UACA,UACA,eAGA,QACA,YACA,uBACA,WAGA,UACA,SACA,eAGA,WAGA,cAGA,cACA,WAGA,aAGA,UACA,iBAAiB,cACjB,WACA,UAEA,GAAG,cACD;CAEJ,MAAM,MAAM,cAAc;CAG1B,MAAM,EAAE,WAAW,YAAY,WAAWA,QAAM,IAAI,aAAa;CAGjE,MAAM,MAAMA,QAAM,cAAc;EAC9B,IAAI,OAAO,OAAO,UAChB,OAAO,CAAC,EAAE;EAGZ,MAAM,WAAW,MAAM,CAAC;EAExB,OAAO,CAAC,SAAS,OAAO,SAAS,GAAG;CACtC,GAAG,CAAC,EAAE,CAAC;CAGP,MAAM,UAAUA,QAAM,OAAuB,IAAI;CACjD,MAAM,gBAAgBA,QAAM,OAAiB,IAAI;CACjD,MAAM,cAAcA,QAAM,OAAiB,IAAI;CAE/C,MAAM,YAAY,UAAkB,CAAC,eAAe,WAAW,CAAC,CAAC,MAAM,EAAE;CAEzE,QAAM,oBAAoB,YAAY;EACpC,eAAe,QAAQ;EACvB,YAAY,cAAc,QAAS;EACnC,UAAU,YAAY,QAA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D,OACE,qBAAC,OAAD;EACE,GAAI;EACJ,KAAK;EACE;EACP,WAAW,KACT,WACA,GAAG,UAAU,SACb;IACG,GAAG,UAAU,YAAY;IACzB,GAAG,UAAU,aAAa,SAAS,OAAO,MAAM,CAAC;IACjD,GAAG,UAAU,YAAY,QAAQ,MAAM,MAAM,CAAC;IAC9C,GAAG,UAAU,QAAQ;EACxB,GACA,SACF;EACS;EAET,cAAc,MAAM;GAClB,MAAM,EAAE,WAAW;GACnB,IACE,WAAW,cAAc,QAAS,gBAClC,WAAW,YAAY,QAAS,cAEhC,EAAE,eAAe;GAGnB,cAAc,CAAC;EACjB;EA3BF,UAAA;GA6BG,kBAAkB,MAAM,KACvB,oBAAC,OAAD;IAAK,WAAW,KAAK,GAAG,UAAU,UAAU,WAAW,MAAM;IAAG,OAAO,OAAO;IAC3E,UAAA;GACE,CAAA;GAEP,oBAAC,OAAD;IACE,KAAK;IACL,GAAI,cAAc,CAAC;IACnB,WAAW;IACX,WAAW,GAAG,UAAU;IACxB,cAAW;IACD;GACX,CAAA;GACD,oBAAC,OAAD;IAAK,WAAW,GAAG,UAAU;IAAoB,UAAA;GAAe,CAAA;GAChE,oBAAC,OAAD;IACE,KAAK;IACL,GAAI,cAAc,CAAC;IACnB,WAAW;IACX,WAAW,GAAG,UAAU;IACxB,cAAW;IACD;GACX,CAAA;GACD,oBAAC,OAAD;IAAK,WAAW,GAAG,UAAU;IAAc,OAAO;GAAiB,CAAA;GACnE,oBAAC,MAAD,EAAM,MAAM,WAAa,CAAA;GACxB,aAAa,oBAAC,WAAD;IAAW,MAAM;IAAoB;GAAU,CAAA;EAC1D;;AAET;AAEA,MAAM,mBAAmBA,QAAM,WAAiD,aAAa;AAE7F,IAAI,QAAQ,IAAI,aAAa,cAC3B,iBAAiB,cAAc"}
|
|
1
|
+
{"version":3,"file":"RangeSelector.mjs","names":[],"sources":["../../../../../src/DatePicker/core/PickerInput/Selector/RangeSelector.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport * as React from 'react';\n\nimport { useEvent, useResizeObserver } from '../../hooks/react';\nimport type { RangePickerRef, SelectorProps } from '../../interface';\nimport { isReactRenderable } from '../../utils/common';\nimport PickerContext from '../context';\nimport ClearIcon from './ClearIcon';\nimport useInputProps from './hooks/useInputProps';\nimport useRootProps from './hooks/useRootProps';\nimport Icon from './Icon';\nimport Input, { type InputRef } from './Input';\n\nexport type SelectorIdType =\n | string\n | {\n start?: string;\n end?: string;\n };\n\nexport interface RangeSelectorRef extends RangePickerRef {\n endInput: HTMLInputElement;\n startInput: HTMLInputElement;\n}\n\nexport interface RangeSelectorProps<DateType = any> extends SelectorProps<DateType> {\n activeIndex: number | null;\n\n /** All the field show as `placeholder` */\n allHelp: boolean;\n\n disabled: [boolean, boolean];\n\n id?: SelectorIdType;\n // Invalid\n invalid: [boolean, boolean];\n\n // Offset\n /**\n * Trigger when the active bar offset position changed.\n * This is used for popup panel offset.\n */\n onActiveInfo: (\n info: [activeInputLeft: number, activeInputRight: number, selectorWidth: number],\n ) => void;\n\n onChange: (date: DateType, index?: number) => void;\n\n placeholder?: string | [string, string];\n\n placement?: string;\n separator?: React.ReactNode;\n value?: [start?: DateType | null, end?: DateType | null];\n}\n\nfunction RangeSelector<DateType extends object = any>(\n props: RangeSelectorProps<DateType>,\n ref: React.Ref<RangeSelectorRef>,\n) {\n const {\n id,\n\n prefix,\n clearIcon,\n suffixIcon,\n separator = '~',\n activeIndex,\n activeHelp,\n allHelp,\n\n focused,\n onFocus,\n onBlur,\n onKeyDown,\n locale,\n generateConfig,\n\n // Placeholder\n placeholder,\n\n // Style\n className,\n style,\n\n // Click\n onClick,\n onClear,\n\n // Change\n value,\n onChange,\n onSubmit,\n onInputChange,\n\n // Valid\n format,\n maskFormat,\n preserveInvalidOnBlur,\n onInvalid,\n\n // Disabled\n disabled,\n invalid,\n inputReadOnly,\n\n // Direction\n direction,\n\n // Open\n onOpenChange,\n\n // Offset\n onActiveInfo,\n placement,\n\n // Native\n onMouseDown,\n\n // Input\n required,\n 'aria-required': ariaRequired,\n autoFocus,\n tabIndex,\n\n ...restProps\n } = props;\n\n const rtl = direction === 'rtl';\n\n // ======================== Prefix ========================\n const { prefixCls, classNames, styles } = React.use(PickerContext);\n\n // ========================== Id ==========================\n const ids = React.useMemo(() => {\n if (typeof id === 'string') {\n return [id];\n }\n\n const mergedId = id || {};\n\n return [mergedId.start, mergedId.end];\n }, [id]);\n\n // ========================= Refs =========================\n const rootRef = React.useRef<HTMLDivElement>(null);\n const inputStartRef = React.useRef<InputRef>(null);\n const inputEndRef = React.useRef<InputRef>(null);\n\n const getInput = (index: number) => [inputStartRef, inputEndRef][index]?.current;\n\n React.useImperativeHandle(ref, () => ({\n nativeElement: rootRef.current!,\n startInput: inputStartRef.current!.inputElement,\n endInput: inputEndRef.current!.inputElement,\n focus: (options) => {\n if (typeof options === 'object') {\n const { index = 0, ...rest } = options || {};\n getInput(index)?.focus(rest);\n } else {\n getInput(options ?? 0)?.focus();\n }\n },\n blur: () => {\n getInput(0)?.blur();\n getInput(1)?.blur();\n },\n }));\n\n // ======================== Props =========================\n const rootProps = useRootProps(restProps);\n\n // ===================== Placeholder ======================\n const mergedPlaceholder = React.useMemo<[string | undefined, string | undefined]>(\n () => (Array.isArray(placeholder) ? placeholder : [placeholder, placeholder]),\n [placeholder],\n );\n\n // ======================== Inputs ========================\n const [getInputProps] = useInputProps({\n ...props,\n id: ids,\n placeholder: mergedPlaceholder,\n });\n\n // ====================== ActiveBar =======================\n const [activeBarStyle, setActiveBarStyle] = React.useState<React.CSSProperties>({\n position: 'absolute',\n width: 0,\n });\n\n const syncActiveOffset = useEvent(() => {\n const input = getInput(activeIndex!);\n if (input) {\n const inputRect = input.nativeElement.getBoundingClientRect();\n const parentRect = rootRef.current!.getBoundingClientRect();\n\n const rectOffset = inputRect.left - parentRect.left;\n setActiveBarStyle((ori) => ({\n ...ori,\n width: inputRect.width,\n left: rectOffset,\n }));\n onActiveInfo([inputRect.left, inputRect.right, parentRect.width]);\n }\n });\n\n React.useEffect(() => {\n syncActiveOffset();\n }, [activeIndex]);\n\n useResizeObserver(rootRef, syncActiveOffset);\n\n // ======================== Clear =========================\n const showClear =\n isReactRenderable(clearIcon) && ((value![0] && !disabled[0]) || (value![1] && !disabled[1]));\n\n // ======================= Disabled =======================\n const startAutoFocus = autoFocus && !disabled[0];\n const endAutoFocus = autoFocus && !startAutoFocus && !disabled[1];\n\n // ======================== Render ========================\n return (\n <div\n {...rootProps}\n ref={rootRef}\n style={style}\n className={clsx(\n prefixCls,\n `${prefixCls}-range`,\n {\n [`${prefixCls}-focused`]: focused,\n [`${prefixCls}-disabled`]: disabled.every((i) => i),\n [`${prefixCls}-invalid`]: invalid.some((i) => i),\n [`${prefixCls}-rtl`]: rtl,\n },\n className,\n )}\n onClick={onClick}\n // Not lose current input focus\n onMouseDown={(e) => {\n const { target } = e;\n if (\n target !== inputStartRef.current!.inputElement &&\n target !== inputEndRef.current!.inputElement\n ) {\n e.preventDefault();\n }\n\n onMouseDown?.(e);\n }}\n >\n {isReactRenderable(prefix) && (\n <div className={clsx(`${prefixCls}-prefix`, classNames.prefix)} style={styles.prefix}>\n {prefix}\n </div>\n )}\n <Input\n ref={inputStartRef}\n {...getInputProps(0)}\n autoFocus={startAutoFocus}\n className={`${prefixCls}-input-start`}\n date-range=\"start\"\n tabIndex={tabIndex}\n />\n <div className={`${prefixCls}-range-separator`}>{separator}</div>\n <Input\n ref={inputEndRef}\n {...getInputProps(1)}\n autoFocus={endAutoFocus}\n className={`${prefixCls}-input-end`}\n date-range=\"end\"\n tabIndex={tabIndex}\n />\n <div className={`${prefixCls}-active-bar`} style={activeBarStyle} />\n <Icon icon={suffixIcon} />\n {showClear && <ClearIcon icon={clearIcon} onClear={onClear} />}\n </div>\n );\n}\n\nconst RefRangeSelector = React.forwardRef<RangeSelectorRef, RangeSelectorProps>(RangeSelector);\n\nif (process.env.NODE_ENV !== 'production') {\n RefRangeSelector.displayName = 'RangeSelector';\n}\n\nexport default R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CAAC;EACjB;EA3BF,UAAA;GA6BG,kBAAkB,MAAM,KACvB,oBAAC,OAAD;IAAK,WAAW,KAAK,GAAG,UAAU,UAAU,WAAW,MAAM;IAAG,OAAO,OAAO;IAC3E,UAAA;GACE,CAAA;GAEP,oBAAC,OAAD;IACE,KAAK;IACL,GAAI,cAAc,CAAC;IACnB,WAAW;IACX,WAAW,GAAG,UAAU;IACxB,cAAW;IACD;GACX,CAAA;GACD,oBAAC,OAAD;IAAK,WAAW,GAAG,UAAU;IAAoB,UAAA;GAAe,CAAA;GAChE,oBAAC,OAAD;IACE,KAAK;IACL,GAAI,cAAc,CAAC;IACnB,WAAW;IACX,WAAW,GAAG,UAAU;IACxB,cAAW;IACD;GACX,CAAA;GACD,oBAAC,OAAD;IAAK,WAAW,GAAG,UAAU;IAAc,OAAO;GAAiB,CAAA;GACnE,oBAAC,MAAD,EAAM,MAAM,WAAa,CAAA;GACxB,aAAa,oBAAC,WAAD;IAAW,MAAM;IAAoB;GAAU,CAAA;EAC1D;;AAET;AAEA,MAAM,mBAAmB,MAAM,WAAiD,aAAa;AAE7F,IAAI,QAAQ,IAAI,aAAa,cAC3B,iBAAiB,cAAc"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useHoverSnapshot } from "../../hooks/useHoverStore.mjs";
|
|
2
2
|
import RefSingleSelector from "./index.mjs";
|
|
3
|
-
import * as React
|
|
3
|
+
import * as React from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
// src/DatePicker/core/PickerInput/Selector/SingleSelector/HoverSelector.tsx
|
|
6
6
|
function HoverSelector({ calendarValue, hoverStore, ref, ...props }) {
|
|
7
7
|
const hover = useHoverSnapshot(hoverStore);
|
|
8
8
|
const { multiple } = props;
|
|
9
|
-
const value = React
|
|
9
|
+
const value = React.useMemo(() => {
|
|
10
10
|
if (!multiple && hover.value) return [hover.value];
|
|
11
11
|
return calendarValue.filter((date) => date);
|
|
12
12
|
}, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoverSelector.mjs","names":["
|
|
1
|
+
{"version":3,"file":"HoverSelector.mjs","names":["SingleSelector"],"sources":["../../../../../../src/DatePicker/core/PickerInput/Selector/SingleSelector/HoverSelector.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport type { PickerRef } from '../../../interface';\nimport { type HoverStore, useHoverSnapshot } from '../../hooks/useHoverStore';\nimport SingleSelector, { type SingleSelectorProps } from './index';\n\nexport interface HoverSelectorProps<DateType extends object> extends Omit<\n SingleSelectorProps<DateType>,\n 'activeHelp' | 'allHelp' | 'value'\n> {\n calendarValue: DateType[];\n hoverStore: HoverStore<DateType>;\n ref?: React.Ref<PickerRef>;\n}\n\nexport default function HoverSelector<DateType extends object = any>({\n calendarValue,\n hoverStore,\n ref,\n ...props\n}: HoverSelectorProps<DateType>) {\n const hover = useHoverSnapshot(hoverStore);\n const { multiple } = props;\n\n const value = React.useMemo(() => {\n if (!multiple && hover.value) return [hover.value];\n return calendarValue.filter((date) => date);\n }, [calendarValue, hover.value, multiple]);\n\n return (\n <SingleSelector\n {...props}\n activeHelp={!!hover.value}\n allHelp={!!hover.value && hover.source === 'preset'}\n ref={ref}\n value={value}\n />\n );\n}\n"],"mappings":";;;;;AAeA,SAAwB,cAA6C,EACnE,eACA,YACA,KACA,GAAG,SAC4B;CAC/B,MAAM,QAAQ,iBAAiB,UAAU;CACzC,MAAM,EAAE,aAAa;CAErB,MAAM,QAAQ,MAAM,cAAc;EAChC,IAAI,CAAC,YAAY,MAAM,OAAO,OAAO,CAAC,MAAM,KAAK;EACjD,OAAO,cAAc,QAAQ,SAAS,IAAI;CAC5C,GAAG;EAAC;EAAe,MAAM;EAAO;CAAQ,CAAC;CAEzC,OACE,oBAACA,mBAAD;EACE,GAAI;EACJ,YAAY,CAAC,CAAC,MAAM;EACpB,SAAS,CAAC,CAAC,MAAM,SAAS,MAAM,WAAW;EACtC;EACE;CACR,CAAA;AAEL"}
|