haze-ui 1.29.0 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/cli/theme.mjs +446 -0
- package/dist/components/Accordion/Accordion.js +1 -0
- package/dist/components/Accordion/AccordionItem.js +3 -0
- package/dist/components/Affix/Affix.js +1 -0
- package/dist/components/Alert/Alert.js +3 -0
- package/dist/components/Anchor/Anchor.js +21 -15
- package/dist/components/AppShell/AppShell.js +5 -0
- package/dist/components/ApprovalCard/ApprovalCard.js +8 -0
- package/dist/components/AspectRatio/AspectRatio.js +2 -0
- package/dist/components/AsyncSection/AsyncSection.js +8 -0
- package/dist/components/Avatar/Avatar.js +11 -6
- package/dist/components/AvatarGroup/AvatarGroup.js +9 -6
- package/dist/components/BackToTop/BackToTop.js +5 -4
- package/dist/components/Badge/Badge.js +1 -0
- package/dist/components/Banner/Banner.js +3 -0
- package/dist/components/BottomSheet/BottomSheet.js +21 -16
- package/dist/components/Breadcrumb/Breadcrumb.js +11 -7
- package/dist/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/dist/components/Button/Button.js +13 -11
- package/dist/components/Button/ButtonLink.js +15 -13
- package/dist/components/Calendar/Calendar.js +523 -368
- package/dist/components/Calendar/date.js +35 -10
- package/dist/components/Card/Card.js +1 -0
- package/dist/components/Carousel/Carousel.js +157 -60
- package/dist/components/Carousel/CarouselSlide.js +3 -1
- package/dist/components/Cascader/Cascader.js +48 -35
- package/dist/components/Chart/Chart.js +5 -4
- package/dist/components/Chart/chart-elements.js +14 -10
- package/dist/components/ChatContainer/ChatContainer.js +9 -7
- package/dist/components/ChatInput/ChatInput.js +12 -9
- package/dist/components/ChatMessage/ChatMessage.js +83 -44
- package/dist/components/Checkbox/CheckboxCore.js +2 -0
- package/dist/components/Chip/Chip.js +3 -0
- package/dist/components/CodeBlock/CodeBlock.js +18 -9
- package/dist/components/Collapsible/Collapsible.js +24 -21
- package/dist/components/ColorPicker/ColorPicker.js +85 -14
- package/dist/components/ColorPicker/ColorPickerCore.js +6 -0
- package/dist/components/ColorPicker/ColorPickerPanel.js +277 -0
- package/dist/components/ColorPicker/color-math.js +168 -0
- package/dist/components/ColorPicker/color-picker-styles.js +7 -0
- package/dist/components/ColorPicker/index.js +3 -3
- package/dist/components/Combobox/Combobox.js +31 -24
- package/dist/components/Combobox/ComboboxGroup.js +7 -5
- package/dist/components/Combobox/ComboboxOption.js +1 -0
- package/dist/components/Command/Command.js +44 -37
- package/dist/components/Command/CommandDialog.js +8 -8
- package/dist/components/ConfigProvider/ConfigContext.js +30 -0
- package/dist/components/ConfigProvider/ConfigProvider.js +14 -0
- package/dist/components/ConfigProvider/index.js +4 -0
- package/dist/components/ConfigProvider/useConfigDefaults.js +10 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.js +18 -11
- package/dist/components/Container/Container.js +1 -0
- package/dist/components/ContextMenu/ContextMenu.js +7 -6
- package/dist/components/ContextMenu/ContextMenuContent.js +4 -4
- package/dist/components/ContextMenu/ContextMenuItem.js +1 -0
- package/dist/components/ContextMenu/ContextMenuSeparator.js +1 -0
- package/dist/components/ContextMenu/ContextMenuTrigger.js +1 -0
- package/dist/components/ConversationList/ConversationItem.js +4 -0
- package/dist/components/ConversationList/ConversationList.js +1 -0
- package/dist/components/CountUp/CountUp.js +6 -5
- package/dist/components/DataTable/CellEditor.js +4 -4
- package/dist/components/DataTable/DataTable.js +236 -168
- package/dist/components/DateRangePicker/DateRangePickerCore.js +9 -0
- package/dist/components/Datepicker/Datepicker.js +14 -11
- package/dist/components/Datepicker/DatepickerCore.js +75 -60
- package/dist/components/Datepicker/datetime.js +14 -3
- package/dist/components/Descriptions/Descriptions.js +6 -0
- package/dist/components/Dialog/Dialog.js +13 -11
- package/dist/components/DiffViewer/DiffViewer.js +22 -13
- package/dist/components/Disclosure/Disclosure.js +10 -7
- package/dist/components/Divider/Divider.js +2 -0
- package/dist/components/Drawer/Drawer.js +10 -9
- package/dist/components/DropdownMenu/DropdownMenu.js +58 -35
- package/dist/components/DropdownMenu/DropdownMenuCheckboxItem.js +63 -0
- package/dist/components/DropdownMenu/DropdownMenuContent.js +5 -5
- package/dist/components/DropdownMenu/DropdownMenuGroup.js +26 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.js +29 -10
- package/dist/components/DropdownMenu/DropdownMenuRadioGroup.js +30 -0
- package/dist/components/DropdownMenu/DropdownMenuRadioItem.js +59 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenuSub.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenuSubTrigger.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenuTrigger.js +1 -0
- package/dist/components/DropdownMenu/dropdown-menu-item-styles.js +7 -0
- package/dist/components/DropdownMenu/index.js +12 -8
- package/dist/components/Ellipsis/Ellipsis.js +11 -8
- package/dist/components/Empty/Empty.js +4 -0
- package/dist/components/FileInput/FileInput.js +7 -5
- package/dist/components/FilePreview/FilePreview.js +19 -1
- package/dist/components/Flex/Flex.js +1 -0
- package/dist/components/FloatButton/FloatButton.js +4 -0
- package/dist/components/FloatButton/FloatButtonGroup.js +18 -13
- package/dist/components/Fullscreen/Fullscreen.js +6 -3
- package/dist/components/Grid/Grid.js +12 -7
- package/dist/components/Grid/GridItem.js +17 -7
- package/dist/components/Grid/grid-item-styles.js +58 -0
- package/dist/components/HoverCard/HoverCard.js +46 -43
- package/dist/components/Icon/Icon.js +1 -0
- package/dist/components/Image/Image.js +10 -7
- package/dist/components/Image/ImagePreview.js +42 -34
- package/dist/components/InlineCompletion/InlineCompletion.js +15 -11
- package/dist/components/InlineEdit/InlineEdit.js +8 -6
- package/dist/components/Input/InputCore.js +1 -0
- package/dist/components/JsonView/JsonView.js +104 -79
- package/dist/components/Kbd/Kbd.js +1 -0
- package/dist/components/List/List.js +1 -0
- package/dist/components/List/ListItem.js +1 -0
- package/dist/components/LocaleProvider/LocaleProvider.js +4 -4
- package/dist/components/LocaleProvider/ar-sa.js +24 -2
- package/dist/components/LocaleProvider/de-de.js +24 -2
- package/dist/components/LocaleProvider/es-es.js +24 -2
- package/dist/components/LocaleProvider/fr-fr.js +24 -2
- package/dist/components/LocaleProvider/it-it.js +24 -2
- package/dist/components/LocaleProvider/ja-jp.js +24 -2
- package/dist/components/LocaleProvider/ko-kr.js +24 -2
- package/dist/components/LocaleProvider/locale.js +24 -2
- package/dist/components/LocaleProvider/pt-br.js +24 -2
- package/dist/components/LocaleProvider/ru-ru.js +24 -2
- package/dist/components/LocaleProvider/zh-cn.js +24 -2
- package/dist/components/LogViewer/LogViewer.js +25 -14
- package/dist/components/MarkdownRenderer/MarkdownRenderer.js +6 -5
- package/dist/components/MarkdownRenderer/markdown-blocks.js +1 -1
- package/dist/components/Masonry/Masonry.js +13 -10
- package/dist/components/Mentions/MentionsCore.js +15 -11
- package/dist/components/Menu/Menu.js +58 -36
- package/dist/components/Menu/MenuCheckboxItem.js +63 -0
- package/dist/components/Menu/MenuDivider.js +1 -0
- package/dist/components/Menu/MenuGroup.js +26 -0
- package/dist/components/Menu/MenuItem.js +28 -9
- package/dist/components/Menu/MenuRadioGroup.js +30 -0
- package/dist/components/Menu/MenuRadioItem.js +59 -0
- package/dist/components/Menu/MenuSub.js +1 -0
- package/dist/components/Menu/MenuSubTrigger.js +1 -0
- package/dist/components/Menu/index.js +11 -7
- package/dist/components/Menu/menu-item-styles.js +7 -0
- package/dist/components/ModelPicker/ModelPicker.js +3 -0
- package/dist/components/NavigationBar/NavLink.js +7 -6
- package/dist/components/NavigationBar/NavigationBar.js +4 -0
- package/dist/components/NumberInput/NumberInputCore.js +4 -0
- package/dist/components/OTPInput/OTPInputCore.js +9 -7
- package/dist/components/Pagination/Pagination.js +125 -33
- package/dist/components/PasswordInput/PasswordInputCore.js +9 -6
- package/dist/components/Popover/Popover.js +9 -7
- package/dist/components/Progress/Progress.js +5 -0
- package/dist/components/PromptInput/PromptInput.js +49 -41
- package/dist/components/QRCode/QRCode.js +9 -7
- package/dist/components/Radio/Radio.js +2 -0
- package/dist/components/Radio/RadioGroupCore.js +7 -6
- package/dist/components/Rating/RatingCore.js +18 -15
- package/dist/components/Resizable/Resizable.js +25 -22
- package/dist/components/Result/Result.js +5 -0
- package/dist/components/ScrollArea/ScrollArea.js +1 -0
- package/dist/components/Segmented/SegmentedCore.js +9 -7
- package/dist/components/Select/Option.js +1 -0
- package/dist/components/Select/OptionGroup.js +1 -0
- package/dist/components/Select/SelectCore.js +11 -8
- package/dist/components/Select/SelectFloating.js +54 -36
- package/dist/components/Sidebar/Sidebar.js +52 -42
- package/dist/components/Signature/Signature.js +101 -91
- package/dist/components/Skeleton/Skeleton.js +1 -0
- package/dist/components/Slider/SliderCore.js +149 -43
- package/dist/components/Sources/Sources.js +31 -21
- package/dist/components/Spinner/Spinner.js +1 -0
- package/dist/components/Stat/Stat.js +7 -0
- package/dist/components/StepTimeline/StepTimeline.js +6 -0
- package/dist/components/Stepper/Step.js +8 -1
- package/dist/components/Stepper/Stepper.js +7 -6
- package/dist/components/StreamingText/StreamingText.js +62 -29
- package/dist/components/SwipeAction/SwipeAction.js +11 -9
- package/dist/components/Switch/SwitchCore.js +9 -5
- package/dist/components/Table/Table.js +2 -0
- package/dist/components/Table/TableBody.js +1 -0
- package/dist/components/Table/TableCell.js +1 -0
- package/dist/components/Table/TableHead.js +1 -0
- package/dist/components/Table/TableRow.js +1 -0
- package/dist/components/Tabs/Tab.js +1 -0
- package/dist/components/Tabs/TabList.js +5 -4
- package/dist/components/Tabs/TabPanel.js +1 -0
- package/dist/components/Tabs/Tabs.js +1 -0
- package/dist/components/Tag/Tag.js +2 -0
- package/dist/components/TagGroup/SortableTagGroup.js +7 -6
- package/dist/components/TagGroup/TagGroup.js +1 -0
- package/dist/components/TagGroup/TagGroupItem.js +3 -0
- package/dist/components/TagInput/SortableTagInputCore.js +13 -10
- package/dist/components/TagInput/TagInputCore.js +17 -12
- package/dist/components/Textarea/TextareaCore.js +1 -0
- package/dist/components/ThinkingIndicator/ThinkingIndicator.js +18 -4
- package/dist/components/TimePicker/TimePicker.js +30 -14
- package/dist/components/TimePicker/TimePickerCore.js +1 -0
- package/dist/components/TimePicker/TimePickerPanel.js +260 -0
- package/dist/components/TimePicker/time-picker-styles.js +7 -0
- package/dist/components/TimePicker/time.js +51 -0
- package/dist/components/Timeline/Timeline.js +14 -1
- package/dist/components/Toast/Toast.js +94 -48
- package/dist/components/Toast/ToastContainer.js +60 -56
- package/dist/components/Toast/ToastContext.js +3 -1
- package/dist/components/Toast/toast2.js +20 -14
- package/dist/components/Toast/useToast.js +36 -11
- package/dist/components/Toggle/ToggleCore.js +1 -0
- package/dist/components/TokenCounter/TokenCounter.js +8 -1
- package/dist/components/ToolCallCard/ToolCallCard.js +18 -2
- package/dist/components/Toolbar/Toolbar.js +9 -8
- package/dist/components/Toolbar/ToolbarButton.js +1 -0
- package/dist/components/Toolbar/ToolbarSeparator.js +1 -0
- package/dist/components/Toolbar/ToolbarToggle.js +1 -0
- package/dist/components/Tooltip/Tooltip.js +46 -42
- package/dist/components/Tour/Tour.js +76 -65
- package/dist/components/Transfer/TransferCore.js +31 -17
- package/dist/components/Tree/SortableTree.js +151 -0
- package/dist/components/Tree/Tree.js +163 -154
- package/dist/components/Tree/TreeItem.js +52 -39
- package/dist/components/Tree/index.js +2 -1
- package/dist/components/Tree/sortable-tree-styles.js +7 -0
- package/dist/components/Tree/sortable-tree-utils.js +36 -0
- package/dist/components/TreeSelect/TreeSelect.js +44 -34
- package/dist/components/Typography/Typography.js +3 -0
- package/dist/components/Upload/Upload.js +12 -11
- package/dist/components/Upload/UploadCore.js +92 -65
- package/dist/components/Upload/UploadList.js +177 -105
- package/dist/components/VirtualList/VirtualList.js +229 -124
- package/dist/components/Watermark/Watermark.js +8 -6
- package/dist/css/accordion.css +1 -1
- package/dist/css/alert.css +1 -1
- package/dist/css/async-section.css +1 -1
- package/dist/css/banner.css +1 -1
- package/dist/css/bottom-sheet.css +1 -1
- package/dist/css/button.css +2 -2
- package/dist/css/calendar.css +1 -1
- package/dist/css/carousel.css +1 -1
- package/dist/css/chat-message.css +1 -1
- package/dist/css/checkbox.css +1 -1
- package/dist/css/color-picker.css +2 -0
- package/dist/css/combobox.css +2 -2
- package/dist/css/context-menu.css +1 -1
- package/dist/css/dialog.css +1 -1
- package/dist/css/drawer.css +1 -1
- package/dist/css/dropdown-menu.css +7 -2
- package/dist/css/form.css +1 -1
- package/dist/css/grid.css +2 -1
- package/dist/css/hover-card.css +1 -1
- package/dist/css/input.css +1 -1
- package/dist/css/menu.css +9 -4
- package/dist/css/pagination.css +1 -1
- package/dist/css/popover.css +1 -1
- package/dist/css/progress.css +1 -1
- package/dist/css/radio.css +1 -1
- package/dist/css/rating.css +1 -1
- package/dist/css/segmented.css +1 -1
- package/dist/css/skeleton.css +1 -1
- package/dist/css/slider.css +1 -1
- package/dist/css/spinner.css +1 -1
- package/dist/css/stepper.css +1 -1
- package/dist/css/streaming-text.css +1 -1
- package/dist/css/switch.css +1 -1
- package/dist/css/tabs.css +1 -1
- package/dist/css/textarea.css +1 -1
- package/dist/css/thinking-indicator.css +1 -1
- package/dist/css/time-picker.css +1 -0
- package/dist/css/toast.css +1 -1
- package/dist/css/toggle.css +1 -1
- package/dist/css/tokens.css +1 -1
- package/dist/css/tooltip.css +1 -1
- package/dist/css/tree.css +2 -1
- package/dist/css/upload.css +1 -1
- package/dist/css/virtual-list.css +1 -1
- package/dist/css-manifest.json +22 -0
- package/dist/dates/adapter.js +13 -0
- package/dist/dates/gregory.js +44 -0
- package/dist/dates/islamic.js +87 -0
- package/dist/dates/registry.js +13 -0
- package/dist/dates/timezone.js +29 -0
- package/dist/design-tokens/cyan-dark.json +355 -0
- package/dist/design-tokens/cyan-light.json +355 -0
- package/dist/design-tokens/orange-dark.json +355 -0
- package/dist/design-tokens/orange-light.json +355 -0
- package/dist/design-tokens/rose-dark.json +355 -0
- package/dist/design-tokens/rose-light.json +355 -0
- package/dist/design-tokens/teal-dark.json +355 -0
- package/dist/design-tokens/teal-light.json +355 -0
- package/dist/design-tokens/violet-dark.json +355 -0
- package/dist/design-tokens/violet-light.json +355 -0
- package/dist/form/FormItem.js +71 -63
- package/dist/form/FormList.js +6 -6
- package/dist/form/form-item-styles.js +7 -0
- package/dist/haze-ui.css +63 -48
- package/dist/index.js +249 -232
- package/dist/mcp-docs.json +1011 -82
- package/dist/registry.json +17 -17
- package/dist/tokens/index.js +7 -7
- package/dist/tokens/motion.js +9 -2
- package/dist/tokens/palette.js +244 -84
- package/dist/tokens/registry.js +18 -22
- package/dist/types/components/Button/Button.d.ts +1 -1
- package/dist/types/components/Calendar/Calendar.d.ts +39 -14
- package/dist/types/components/Calendar/date.d.ts +51 -0
- package/dist/types/components/Calendar/index.d.ts +1 -1
- package/dist/types/components/Carousel/Carousel.d.ts +5 -1
- package/dist/types/components/Carousel/CarouselSlide.d.ts +3 -3
- package/dist/types/components/Chart/Chart.d.ts +13 -6
- package/dist/types/components/Chart/chart-elements.d.ts +27 -6
- package/dist/types/components/ChatMessage/ChatMessage.d.ts +10 -1
- package/dist/types/components/ColorPicker/ColorPicker.d.ts +44 -5
- package/dist/types/components/ColorPicker/ColorPickerPanel.d.ts +28 -0
- package/dist/types/components/ColorPicker/color-math.d.ts +63 -0
- package/dist/types/components/ColorPicker/color-picker-styles.d.ts +50 -0
- package/dist/types/components/ConfigProvider/ConfigContext.d.ts +67 -0
- package/dist/types/components/ConfigProvider/ConfigProvider.d.ts +25 -0
- package/dist/types/components/ConfigProvider/index.d.ts +4 -0
- package/dist/types/components/ConfigProvider/useConfigDefaults.d.ts +28 -0
- package/dist/types/components/Datepicker/Datepicker.d.ts +23 -10
- package/dist/types/components/Datepicker/DatepickerCore.d.ts +40 -10
- package/dist/types/components/Datepicker/datetime.d.ts +33 -11
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +12 -2
- package/dist/types/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +26 -0
- package/dist/types/components/DropdownMenu/DropdownMenuGroup.d.ts +16 -0
- package/dist/types/components/DropdownMenu/DropdownMenuItem.d.ts +7 -1
- package/dist/types/components/DropdownMenu/DropdownMenuRadioGroup.d.ts +21 -0
- package/dist/types/components/DropdownMenu/DropdownMenuRadioItem.d.ts +22 -0
- package/dist/types/components/DropdownMenu/dropdown-menu-item-styles.d.ts +29 -0
- package/dist/types/components/DropdownMenu/index.d.ts +9 -1
- package/dist/types/components/Fullscreen/Fullscreen.d.ts +1 -0
- package/dist/types/components/Grid/Grid.d.ts +8 -1
- package/dist/types/components/Grid/GridItem.d.ts +24 -1
- package/dist/types/components/Grid/grid-item-styles.d.ts +57 -0
- package/dist/types/components/HoverCard/HoverCard.d.ts +1 -1
- package/dist/types/components/LocaleProvider/locale.d.ts +24 -0
- package/dist/types/components/Menu/Menu.d.ts +11 -2
- package/dist/types/components/Menu/MenuCheckboxItem.d.ts +25 -0
- package/dist/types/components/Menu/MenuGroup.d.ts +16 -0
- package/dist/types/components/Menu/MenuItem.d.ts +7 -1
- package/dist/types/components/Menu/MenuRadioGroup.d.ts +20 -0
- package/dist/types/components/Menu/MenuRadioItem.d.ts +22 -0
- package/dist/types/components/Menu/index.d.ts +9 -1
- package/dist/types/components/Menu/menu-item-styles.d.ts +28 -0
- package/dist/types/components/NavigationBar/NavLink.d.ts +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +17 -3
- package/dist/types/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts +24 -2
- package/dist/types/components/Slider/SliderCore.d.ts +41 -3
- package/dist/types/components/StreamingText/StreamingText.d.ts +8 -1
- package/dist/types/components/TimePicker/TimePicker.d.ts +36 -4
- package/dist/types/components/TimePicker/TimePickerPanel.d.ts +26 -0
- package/dist/types/components/TimePicker/index.d.ts +1 -0
- package/dist/types/components/TimePicker/time-picker-styles.d.ts +30 -0
- package/dist/types/components/TimePicker/time.d.ts +49 -0
- package/dist/types/components/Toast/Toast.d.ts +19 -6
- package/dist/types/components/Toast/ToastContainer.d.ts +1 -1
- package/dist/types/components/Toast/ToastContext.d.ts +22 -2
- package/dist/types/components/Toast/index.d.ts +1 -1
- package/dist/types/components/Toast/toast.d.ts +20 -14
- package/dist/types/components/Toast/useToast.d.ts +14 -4
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/components/Tree/SortableTree.d.ts +38 -0
- package/dist/types/components/Tree/Tree.d.ts +1 -1
- package/dist/types/components/Tree/index.d.ts +2 -0
- package/dist/types/components/Tree/sortable-tree-styles.d.ts +36 -0
- package/dist/types/components/Tree/sortable-tree-utils.d.ts +40 -0
- package/dist/types/components/Upload/Upload.d.ts +17 -10
- package/dist/types/components/Upload/UploadCore.d.ts +26 -12
- package/dist/types/components/Upload/UploadList.d.ts +10 -7
- package/dist/types/components/Upload/index.d.ts +1 -1
- package/dist/types/components/Upload/types.d.ts +33 -7
- package/dist/types/components/VirtualList/VirtualList.d.ts +79 -26
- package/dist/types/components/VirtualList/index.d.ts +1 -1
- package/dist/types/dates/adapter.d.ts +74 -0
- package/dist/types/dates/gregory.d.ts +10 -0
- package/dist/types/dates/index.d.ts +6 -0
- package/dist/types/dates/islamic.d.ts +17 -0
- package/dist/types/dates/registry.d.ts +13 -0
- package/dist/types/dates/timezone.d.ts +36 -0
- package/dist/types/form/FormItem.d.ts +31 -1
- package/dist/types/form/form-item-styles.d.ts +24 -0
- package/dist/types/index.d.ts +19 -11
- package/dist/types/tokens/index.d.ts +4 -2
- package/dist/types/tokens/motion.d.ts +16 -0
- package/dist/types/tokens/palette.d.ts +59 -2
- package/dist/types/utils/menuItems.d.ts +126 -0
- package/dist/types/utils/menuRadio.d.ts +21 -0
- package/dist/utils/floating.js +45 -44
- package/dist/utils/menuItems.js +55 -0
- package/dist/utils/menuKeyboard.js +31 -31
- package/dist/utils/menuRadio.js +28 -0
- package/dist/utils/sortable-shared.js +3 -3
- package/dist/utils/sortable.js +12 -11
- package/package.json +18 -9
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { TreeNodeData } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Pure move math for SortableTree — no React, no dnd, fully unit-testable.
|
|
4
|
+
* The drag runtime reports a target row; these functions turn that into the
|
|
5
|
+
* `onMove` payload and back into a controlled treeData update.
|
|
6
|
+
*/
|
|
7
|
+
/** Payload `SortableTree` reports after a completed drag. */
|
|
8
|
+
export type SortableTreeMoveInfo = {
|
|
9
|
+
/** The dragged node's key. */
|
|
10
|
+
key: string;
|
|
11
|
+
/** The new parent's key — `null` for the root level. */
|
|
12
|
+
parentKey: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Insertion index among the **new** parent's children, computed after
|
|
15
|
+
* removing the dragged node from the tree — `splice(index, 0, node)`
|
|
16
|
+
* lands exactly.
|
|
17
|
+
*/
|
|
18
|
+
index: number;
|
|
19
|
+
};
|
|
20
|
+
/** Every key in the node's own subtree, including itself. */
|
|
21
|
+
export declare function subtreeKeys(node: TreeNodeData): Set<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve a completed drag into the `onMove` payload. Dropping onto a row
|
|
24
|
+
* inserts the dragged node **right after it** — as the target's next
|
|
25
|
+
* sibling at the target's level — so a drop on a same-level row reorders
|
|
26
|
+
* and a drop on a child of another parent reparents. Returns `null` when
|
|
27
|
+
* nothing should happen: drop on itself, on one of its own descendants
|
|
28
|
+
* (the subtree travels as one block and cannot move into itself), back
|
|
29
|
+
* onto its own current position, or an unknown key.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveTreeMove(data: TreeNodeData[], dragKey: string, overKey: string): SortableTreeMoveInfo | null;
|
|
32
|
+
/**
|
|
33
|
+
* Apply a reported move to a tree array — the controlled `treeData`
|
|
34
|
+
* update a consumer makes in `onMove`: detach the node with its whole
|
|
35
|
+
* subtree, then splice it into the new parent's children. Returns fresh
|
|
36
|
+
* arrays on every changed path (originals untouched). A parent key that
|
|
37
|
+
* no longer resolves falls back to appending at the root level rather
|
|
38
|
+
* than dropping the node.
|
|
39
|
+
*/
|
|
40
|
+
export declare function applyTreeMove(data: TreeNodeData[], info: SortableTreeMoveInfo): TreeNodeData[];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ReactNode, Ref } from 'react';
|
|
2
2
|
import type { ControlOrValue } from 'react-use-control';
|
|
3
|
-
import type { UploadFileStatus, UploadHandle, UploadListItemRender, UploadRequest } from './types';
|
|
3
|
+
import type { UploadFileStatus, UploadHandle, UploadListItemRender, UploadRequest, UploadValueItem } from './types';
|
|
4
4
|
type UploadProps = {
|
|
5
|
-
/** Selected files
|
|
6
|
-
|
|
5
|
+
/** Selected files — local `File` picks mixed freely with `UploadFile`
|
|
6
|
+
* echo entries (files already on the server); uncontrolled
|
|
7
|
+
* (accumulating internally) when omitted. */
|
|
8
|
+
value?: ControlOrValue<UploadValueItem[]>;
|
|
7
9
|
accept?: string;
|
|
8
10
|
/** Renders the drag-and-drop drop area (default) or a plain
|
|
9
11
|
* click-only picker area — see `UploadCoreProps.droppable`. */
|
|
@@ -35,9 +37,13 @@ type UploadProps = {
|
|
|
35
37
|
showUploadList?: boolean | {
|
|
36
38
|
itemRender?: UploadListItemRender;
|
|
37
39
|
};
|
|
38
|
-
/** Rendering style of the built-in list (`text` rows
|
|
39
|
-
* `picture-card` thumbnail
|
|
40
|
-
|
|
40
|
+
/** Rendering style of the built-in list (`text` rows, a `picture`
|
|
41
|
+
* row with a 32px inline thumbnail, or a `picture-card` thumbnail
|
|
42
|
+
* grid) — see `UploadCoreProps.listType`. */
|
|
43
|
+
listType?: 'text' | 'picture' | 'picture-card';
|
|
44
|
+
/** Click handler for `picture` / `picture-card` thumbnails (e.g. a
|
|
45
|
+
* lightbox) — see `UploadCoreProps.onPreview`. */
|
|
46
|
+
onPreview?: (file: UploadValueItem) => void;
|
|
41
47
|
/** Overrides the built-in remove-button label — see
|
|
42
48
|
* `UploadCoreProps.removeLabel`. */
|
|
43
49
|
removeLabel?: string;
|
|
@@ -47,13 +53,14 @@ type UploadProps = {
|
|
|
47
53
|
/** Status-machine snapshot callback — see
|
|
48
54
|
* `UploadCoreProps.onStatusChange`. */
|
|
49
55
|
onStatusChange?: (files: UploadFileStatus[]) => void;
|
|
50
|
-
/** Fires with the freshly picked files only
|
|
51
|
-
* the `value` channel (or internal state
|
|
52
|
-
* Removals and `clear()` do not fire this (they
|
|
56
|
+
/** Fires with the freshly picked files only (always local `File`s)
|
|
57
|
+
* — the accumulated list is the `value` channel (or internal state
|
|
58
|
+
* when uncontrolled). Removals and `clear()` do not fire this (they
|
|
59
|
+
* are not picks). */
|
|
53
60
|
onChange?: (files: File[]) => void;
|
|
54
61
|
className?: string;
|
|
55
62
|
children?: ReactNode;
|
|
56
63
|
ref?: Ref<UploadHandle>;
|
|
57
64
|
};
|
|
58
|
-
export default function Upload({ value: valueControl, accept, droppable, beforeUpload, maxCount, multiple, request, action, method, headers, name, data, manual, showUploadList, listType, removeLabel, directory, onStatusChange, onChange, className, children, ref, }: UploadProps): import("react").JSX.Element;
|
|
65
|
+
export default function Upload({ value: valueControl, accept, droppable, beforeUpload, maxCount, multiple, request, action, method, headers, name, data, manual, showUploadList, listType, onPreview, removeLabel, directory, onStatusChange, onChange, className, children, ref, }: UploadProps): import("react").JSX.Element;
|
|
59
66
|
export type { UploadProps };
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
|
-
import type { UploadFileStatus, UploadHandle, UploadListItemRender, UploadRequest } from './types';
|
|
2
|
+
import type { UploadFileStatus, UploadHandle, UploadListItemRender, UploadRequest, UploadValueItem } from './types';
|
|
3
3
|
type UploadCoreProps = {
|
|
4
4
|
/** The selected files — the field value, emitted verbatim (as the
|
|
5
|
-
* complete next list) by `onChange`.
|
|
6
|
-
|
|
5
|
+
* complete next list) by `onChange`. Local `File` picks mix freely
|
|
6
|
+
* with `UploadFile` echo entries describing files already on the
|
|
7
|
+
* server; echo entries only render (and stay removable), they never
|
|
8
|
+
* enter the upload pipeline. */
|
|
9
|
+
value: UploadValueItem[];
|
|
7
10
|
/** Emits the next file list: a single pick replaces `value`, a
|
|
8
11
|
* `multiple` pick appends to it. Removals from the built-in list
|
|
9
|
-
* (and `clear()`) also flow through here
|
|
10
|
-
|
|
12
|
+
* (and `clear()`) also flow through here — echo entries come back
|
|
13
|
+
* as the very objects the consumer passed in. */
|
|
14
|
+
onChange: (files: UploadValueItem[]) => void;
|
|
11
15
|
/** Comma-separated accept tokens (`.txt`, `image/*`, `text/plain`) —
|
|
12
16
|
* the same grammar the native picker uses. Dropped files that do not
|
|
13
17
|
* match are discarded silently (the native dialog already enforces
|
|
@@ -74,12 +78,21 @@ type UploadCoreProps = {
|
|
|
74
78
|
};
|
|
75
79
|
/**
|
|
76
80
|
* Rendering style of the built-in list (default `text`): `text`
|
|
77
|
-
* rows
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
+
* rows; `picture` — a text row with a 32px inline thumbnail before
|
|
82
|
+
* the name (a `url` image for `UploadFile` echoes, an object-URL
|
|
83
|
+
* preview for image files, a type-icon fallback otherwise); or a
|
|
84
|
+
* `picture-card` grid of square thumbnail cards with the upload
|
|
85
|
+
* mask, danger border + retry on error, and corner remove button.
|
|
81
86
|
*/
|
|
82
|
-
listType?: 'text' | 'picture-card';
|
|
87
|
+
listType?: 'text' | 'picture' | 'picture-card';
|
|
88
|
+
/**
|
|
89
|
+
* Click handler for the thumbnails of `picture` / `picture-card`
|
|
90
|
+
* lists — the natural spot to open a lightbox (wire it to
|
|
91
|
+
* `Image`/`ImagePreview`). Receives the value item the thumbnail
|
|
92
|
+
* describes. The remove/retry/cancel buttons sit outside the hit
|
|
93
|
+
* area and keep working.
|
|
94
|
+
*/
|
|
95
|
+
onPreview?: (file: UploadValueItem) => void;
|
|
83
96
|
/**
|
|
84
97
|
* Overrides the built-in remove-button label (list rows and
|
|
85
98
|
* picture-card corners); defaults to the locale string.
|
|
@@ -95,12 +108,13 @@ type UploadCoreProps = {
|
|
|
95
108
|
/**
|
|
96
109
|
* Fires whenever the tracked entries change (added, removed, status
|
|
97
110
|
* or percent) with the complete snapshot in value order. Only tracks
|
|
98
|
-
* while `request`/`action` or `showUploadList` is in play.
|
|
111
|
+
* while `request`/`action` or `showUploadList` is in play. `UploadFile`
|
|
112
|
+
* echoes report their terminal `status`/`percent` like any row.
|
|
99
113
|
*/
|
|
100
114
|
onStatusChange?: (files: UploadFileStatus[]) => void;
|
|
101
115
|
className?: string;
|
|
102
116
|
children?: ReactNode;
|
|
103
117
|
ref?: Ref<UploadHandle>;
|
|
104
118
|
} & Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'onChange' | 'children' | 'onClick' | 'onDrop' | 'onDragOver' | 'onDragEnter' | 'onDragLeave' | 'onKeyDown' | 'role' | 'tabIndex'>;
|
|
105
|
-
export default function UploadCore({ value, onChange, accept, droppable, beforeUpload, maxCount, multiple, request, action, method, headers, name, data, manual, showUploadList, listType, removeLabel, directory, onStatusChange, className, children, ref, ...rest }: UploadCoreProps): import("react").JSX.Element;
|
|
119
|
+
export default function UploadCore({ value, onChange, accept, droppable, beforeUpload, maxCount, multiple, request, action, method, headers, name, data, manual, showUploadList, listType, onPreview, removeLabel, directory, onStatusChange, className, children, ref, ...rest }: UploadCoreProps): import("react").JSX.Element;
|
|
106
120
|
export type { UploadCoreProps };
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import type { UploadEntry, UploadListItemRender } from './types';
|
|
1
|
+
import type { UploadEntry, UploadListItemRender, UploadValueItem } from './types';
|
|
2
2
|
type UploadListProps = {
|
|
3
3
|
/** Tracked rows, in value order. */
|
|
4
4
|
entries: UploadEntry[];
|
|
5
|
-
/** Rendering style of the built-in list: `text` rows (default)
|
|
5
|
+
/** Rendering style of the built-in list: `text` rows (default), a
|
|
6
|
+
* `picture` text row with a 32px inline thumbnail, or a
|
|
6
7
|
* `picture-card` grid of square thumbnail cards. */
|
|
7
|
-
listType?: 'text' | 'picture-card';
|
|
8
|
+
listType?: 'text' | 'picture' | 'picture-card';
|
|
8
9
|
/** Overrides the remove-button label (text rows and picture-card
|
|
9
10
|
* corners alike); defaults to the locale string. */
|
|
10
11
|
removeLabel?: string;
|
|
11
12
|
/** Replaces the default row/cell rendering entirely. */
|
|
12
13
|
itemRender?: UploadListItemRender;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
/** Click handler for `picture` / `picture-card` thumbnails. */
|
|
15
|
+
onPreview?: (file: UploadValueItem) => void;
|
|
16
|
+
onRemove: (file: UploadValueItem) => void;
|
|
17
|
+
onRetry: (file: UploadValueItem) => void;
|
|
18
|
+
onCancel: (file: UploadValueItem) => void;
|
|
16
19
|
};
|
|
17
|
-
export default function UploadList({ entries, listType, removeLabel, itemRender, onRemove, onRetry, onCancel, }: UploadListProps): import("react").JSX.Element;
|
|
20
|
+
export default function UploadList({ entries, listType, removeLabel, itemRender, onPreview, onRemove, onRetry, onCancel, }: UploadListProps): import("react").JSX.Element;
|
|
18
21
|
export type { UploadListProps };
|
|
@@ -2,4 +2,4 @@ export { default as Upload } from './Upload';
|
|
|
2
2
|
export type { UploadProps } from './Upload';
|
|
3
3
|
export { default as UploadCore } from './UploadCore';
|
|
4
4
|
export type { UploadCoreProps } from './UploadCore';
|
|
5
|
-
export type { UploadHandle, UploadStatus, UploadFileStatus, UploadRequest, UploadRequestOptions, UploadListItemActions, UploadListItemRender, } from './types';
|
|
5
|
+
export type { UploadHandle, UploadStatus, UploadFile, UploadValueItem, UploadFileStatus, UploadRequest, UploadRequestOptions, UploadListItemActions, UploadListItemRender, } from './types';
|
|
@@ -2,10 +2,33 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
/** Lifecycle of one tracked file while an upload executor (`request`
|
|
3
3
|
* or `action`) is armed. */
|
|
4
4
|
type UploadStatus = 'idle' | 'uploading' | 'success' | 'error';
|
|
5
|
-
/**
|
|
6
|
-
* `
|
|
5
|
+
/** A file that already lives on the server: described by metadata
|
|
6
|
+
* instead of a local `File` object. Passed through `value` to echo an
|
|
7
|
+
* existing upload — rendered in the built-in list (a `url` thumbnail
|
|
8
|
+
* for the picture list types), removable, but never re-entering the
|
|
9
|
+
* upload pipeline (`beforeUpload`/`request`/`action` only ever see
|
|
10
|
+
* real `File` objects). */
|
|
11
|
+
type UploadFile = {
|
|
12
|
+
/** Stable identity for list keys. When omitted, one is generated per
|
|
13
|
+
* object instance and reused across renders. */
|
|
14
|
+
uid?: string;
|
|
15
|
+
name: string;
|
|
16
|
+
/** Remote source rendered as the thumbnail in picture list types. */
|
|
17
|
+
url?: string;
|
|
18
|
+
/** Bytes, when the server reports them. */
|
|
19
|
+
size?: number;
|
|
20
|
+
/** Terminal state of the echoed upload — defaults to `success`. */
|
|
21
|
+
status?: 'success' | 'error';
|
|
22
|
+
/** 0–100, clamped; purely informational for echo entries. */
|
|
23
|
+
percent?: number;
|
|
24
|
+
};
|
|
25
|
+
/** One item of the value channel: a picked local `File` (enters the
|
|
26
|
+
* upload pipeline) or an `UploadFile` echo (terminal). */
|
|
27
|
+
type UploadValueItem = File | UploadFile;
|
|
28
|
+
/** Status snapshot for one tracked value item — the shape surfaced
|
|
29
|
+
* through `onStatusChange` and `showUploadList.itemRender`. */
|
|
7
30
|
type UploadFileStatus = {
|
|
8
|
-
file:
|
|
31
|
+
file: UploadValueItem;
|
|
9
32
|
status: UploadStatus;
|
|
10
33
|
/** 0–100, clamped; forced to 100 when the upload succeeds. */
|
|
11
34
|
percent: number;
|
|
@@ -32,8 +55,9 @@ type UploadListItemActions = {
|
|
|
32
55
|
/** Abort the in-flight upload and drop the file (uploading state). */
|
|
33
56
|
cancel: () => void;
|
|
34
57
|
};
|
|
35
|
-
/** Custom renderer replacing a built-in list row.
|
|
36
|
-
|
|
58
|
+
/** Custom renderer replacing a built-in list row. Echo entries
|
|
59
|
+
* (`UploadFile` items) reach it the same way local files do. */
|
|
60
|
+
type UploadListItemRender = (file: UploadValueItem, status: UploadStatus, percent: number, actions: UploadListItemActions) => ReactNode;
|
|
37
61
|
/**
|
|
38
62
|
* Imperative surface (`ref.current?.…`) — the same React 19
|
|
39
63
|
* ref-as-prop channel `DialogHandle` uses:
|
|
@@ -53,8 +77,10 @@ type UploadHandle = {
|
|
|
53
77
|
clear: () => void;
|
|
54
78
|
};
|
|
55
79
|
/** Internal tracked row: public status snapshot plus the stable uid the
|
|
56
|
-
* list keys on (
|
|
80
|
+
* list keys on (value items carry no serializable identity). Echo
|
|
81
|
+
* entries hold their terminal `status`/`percent` from the
|
|
82
|
+
* `UploadFile` description. */
|
|
57
83
|
type UploadEntry = UploadFileStatus & {
|
|
58
84
|
uid: string;
|
|
59
85
|
};
|
|
60
|
-
export type { UploadStatus, UploadFileStatus, UploadRequestOptions, UploadRequest, UploadListItemActions, UploadListItemRender, UploadHandle, UploadEntry, };
|
|
86
|
+
export type { UploadStatus, UploadFile, UploadValueItem, UploadFileStatus, UploadRequestOptions, UploadRequest, UploadListItemActions, UploadListItemRender, UploadHandle, UploadEntry, };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
|
+
/** Orientation of the scroll axis. */
|
|
3
|
+
type VirtualListOrientation = 'vertical' | 'horizontal';
|
|
2
4
|
/** Alignment of a row after an imperative `scrollToIndex` call. */
|
|
3
5
|
type VirtualListAlign = 'start' | 'center' | 'end' | 'auto';
|
|
4
6
|
/**
|
|
@@ -16,6 +18,11 @@ type VirtualListHandle = {
|
|
|
16
18
|
* a no-op when the row is already fully visible; rows entering from
|
|
17
19
|
* above align to `'end'` (keeps preceding context on screen), rows
|
|
18
20
|
* entering from below align to `'start'`.
|
|
21
|
+
*
|
|
22
|
+
* In grid mode (`columns > 1`) `index` is the item index and maps to
|
|
23
|
+
* its row/column cell: the row axis honors `align`, the column axis is
|
|
24
|
+
* brought into view minimally. In horizontal orientation the same
|
|
25
|
+
* semantics apply along the x axis.
|
|
19
26
|
*/
|
|
20
27
|
scrollToIndex: (index: number, align?: VirtualListAlign) => void;
|
|
21
28
|
};
|
|
@@ -30,50 +37,96 @@ type VirtualListGroup = {
|
|
|
30
37
|
};
|
|
31
38
|
type VirtualListProps<T> = {
|
|
32
39
|
items: T[];
|
|
33
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Scrollport height in px (the cross-axis size when
|
|
42
|
+
* `orientation='horizontal'`).
|
|
43
|
+
*/
|
|
34
44
|
height: number;
|
|
35
45
|
/**
|
|
36
|
-
*
|
|
46
|
+
* Scrollport width in px — only used with `orientation='horizontal'`:
|
|
47
|
+
* fixes the port width and serves as the main-axis extent until the
|
|
48
|
+
* real `clientWidth` is measured. Ignored in vertical orientation.
|
|
49
|
+
*/
|
|
50
|
+
width?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Extent of one item along the scroll axis: row height in vertical
|
|
53
|
+
* lists, item width with `orientation='horizontal'`, and row height in
|
|
54
|
+
* grid mode. Exact in fixed mode; in dynamic mode only the
|
|
37
55
|
* pre-measurement estimate (pass `estimatedItemHeight` to opt in).
|
|
38
56
|
*/
|
|
39
57
|
itemHeight: number;
|
|
40
58
|
/**
|
|
41
|
-
* Provide to enable dynamic
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
59
|
+
* Provide to enable dynamic heights along the scroll axis: every
|
|
60
|
+
* mounted unit (row — in grid mode the whole row wrapper) is measured
|
|
61
|
+
* with a ResizeObserver and cached by index. Unit offsets come from a
|
|
62
|
+
* prefix sum over measured sizes (never-rendered units fall back to
|
|
63
|
+
* this estimate), so layout stays correct as units resize. Cached
|
|
64
|
+
* sizes survive `items` updates and are truncated when the list
|
|
46
65
|
* shrinks.
|
|
47
66
|
*/
|
|
48
67
|
estimatedItemHeight?: number;
|
|
49
68
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
69
|
+
* Grid mode: lay items out in a row-major grid with this many columns
|
|
70
|
+
* and virtualize both axes — rows are windowed along the scroll axis
|
|
71
|
+
* exactly like a vertical list, columns are windowed against the
|
|
72
|
+
* rendered `clientWidth`. Item `index` maps to row
|
|
73
|
+
* `Math.floor(index / columns)`, column `index % columns`. Only
|
|
74
|
+
* supported in the (default) vertical orientation; combining it with
|
|
75
|
+
* `orientation='horizontal'` logs a dev error and renders a plain
|
|
76
|
+
* horizontal list.
|
|
77
|
+
*/
|
|
78
|
+
columns?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Column width in px (grid mode only); defaults to `itemHeight`.
|
|
81
|
+
* Columns are not dynamically measured.
|
|
82
|
+
*/
|
|
83
|
+
columnWidth?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Scroll axis of the list. `'vertical'` (default) keeps the existing
|
|
86
|
+
* behavior byte-for-byte. `'horizontal'` mirrors the whole windowing
|
|
87
|
+
* system — prefix sums, dynamic measurement, `scrollToIndex`, reverse
|
|
88
|
+
* and sticky group headers — onto the x axis: items are sized by
|
|
89
|
+
* `itemHeight` along it, headers pin to the inline-start edge, and
|
|
90
|
+
* offsets stay *logical* so RTL keeps item 0 at the inline-start edge
|
|
91
|
+
* (the physical right edge): RTL `scrollLeft` reads 0 at the start and
|
|
92
|
+
* goes negative toward the end, which the internal offset scale
|
|
93
|
+
* normalizes.
|
|
94
|
+
*/
|
|
95
|
+
orientation?: VirtualListOrientation;
|
|
96
|
+
/**
|
|
97
|
+
* Optional sticky group headers. A header pins to the scrollport's
|
|
98
|
+
* inline-start (vertical: top) while its group spans the viewport and
|
|
99
|
+
* slides away when the next header reaches it. Header positions derive
|
|
100
|
+
* from the same offset system as rows, so fixed and dynamic modes are
|
|
101
|
+
* both supported; in grid mode a header aligns with the row containing
|
|
102
|
+
* its first item (row granularity). Headers overlay rows — they occupy
|
|
103
|
+
* no layout space in the list.
|
|
55
104
|
*/
|
|
56
105
|
groups?: VirtualListGroup[];
|
|
57
106
|
renderItem: (item: T, index: number) => ReactNode;
|
|
58
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Extra units kept mounted on either side of the visible window —
|
|
109
|
+
* rows along the scroll axis, and columns in grid mode.
|
|
110
|
+
*/
|
|
59
111
|
overscan?: number;
|
|
60
112
|
/**
|
|
61
|
-
* Chat orientation (opt-in):
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
113
|
+
* Chat orientation (opt-in): units anchor to the scrollport's end edge
|
|
114
|
+
* (vertical: bottom; horizontal: inline-end) with index 0 at that edge
|
|
115
|
+
* and later indices stacking toward the start — the natural geometry
|
|
116
|
+
* for a newest-at-the-edge log where new items are prepended. The
|
|
117
|
+
* viewport parks at the end on mount and stays glued there across
|
|
118
|
+
* appends while the user is parked there; a reader who scrolled back
|
|
119
|
+
* keeps their position (units keep their start-origin coordinates as
|
|
120
|
+
* content grows toward the start, so nothing jumps).
|
|
68
121
|
*
|
|
69
|
-
* `scrollToIndex` keeps its signature; alignments mirror
|
|
70
|
-
* `'start'` pins the
|
|
71
|
-
* `'end'` its
|
|
72
|
-
* API is unchanged.
|
|
122
|
+
* `scrollToIndex` keeps its signature; alignments mirror along the
|
|
123
|
+
* scroll axis — `'start'` pins the unit's end edge to the viewport's
|
|
124
|
+
* end edge, `'end'` its start edge to the viewport's start edge. The
|
|
125
|
+
* `VirtualListHandle` API is unchanged.
|
|
73
126
|
*/
|
|
74
127
|
reverse?: boolean;
|
|
75
128
|
className?: string;
|
|
76
129
|
ref?: Ref<VirtualListHandle>;
|
|
77
130
|
} & Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
|
|
78
|
-
export default function VirtualList<T>({ items, height, itemHeight, estimatedItemHeight, groups, renderItem, overscan, reverse, className, style, ref, ...rest }: VirtualListProps<T>): import("react").JSX.Element;
|
|
79
|
-
export type { VirtualListProps, VirtualListHandle, VirtualListGroup, VirtualListAlign, };
|
|
131
|
+
export default function VirtualList<T>({ items, height, width, itemHeight, estimatedItemHeight, columns, columnWidth, orientation, groups, renderItem, overscan, reverse, className, style, ref, ...rest }: VirtualListProps<T>): import("react").JSX.Element;
|
|
132
|
+
export type { VirtualListProps, VirtualListHandle, VirtualListGroup, VirtualListAlign, VirtualListOrientation, };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as VirtualList } from './VirtualList';
|
|
2
|
-
export type { VirtualListProps, VirtualListHandle, VirtualListGroup, VirtualListAlign } from './VirtualList';
|
|
2
|
+
export type { VirtualListProps, VirtualListHandle, VirtualListGroup, VirtualListAlign, VirtualListOrientation } from './VirtualList';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar-agnostic date adapter contract.
|
|
3
|
+
*
|
|
4
|
+
* `src/lib/components/Calendar/date.ts` owns the complete Gregorian math
|
|
5
|
+
* (month lengths, view shifts, ISO weeks, value parsing); this module is
|
|
6
|
+
* the adapter layer above it that lets consumers reason about *any*
|
|
7
|
+
* calendar's civil dates. The contract is deliberately shaped after the
|
|
8
|
+
* operations Calendar actually performs on dates — month lengths for grid
|
|
9
|
+
* building, month shifts for view navigation, name lists for headers —
|
|
10
|
+
* nothing more.
|
|
11
|
+
*
|
|
12
|
+
* Semantics (inherited from date.ts): every `(year, month, day)` triple is
|
|
13
|
+
* a civil calendar date realized as a *local* Date at midnight. DST
|
|
14
|
+
* transitions never move midnight, so `toGregorian` output always
|
|
15
|
+
* round-trips through `fromGregorian` exactly, and internal conversion
|
|
16
|
+
* arithmetic rides the UTC civil timeline (whole-day millisecond spans
|
|
17
|
+
* with no DST drift) before materializing the local-midnight result.
|
|
18
|
+
*/
|
|
19
|
+
/** Civil date parts in a specific calendar. `month` is 0-based — the
|
|
20
|
+
* same `Date#getMonth` convention every date.ts function uses (0 = the
|
|
21
|
+
* calendar's first month, 11 = its last) — while `day` is 1-based. */
|
|
22
|
+
export type CivilDateParts = {
|
|
23
|
+
year: number;
|
|
24
|
+
month: number;
|
|
25
|
+
day: number;
|
|
26
|
+
};
|
|
27
|
+
/** Calendars with a built-in adapter. `islamic-umalqura` is the
|
|
28
|
+
* Umm al-Qura tabulation Node and browsers ship in full ICU; valid there
|
|
29
|
+
* roughly 1300–1600 AH (Gregorian ~1882–2174), beyond which ICU falls
|
|
30
|
+
* back to computed approximations (still self-consistent through this
|
|
31
|
+
* adapter, which routes every conversion through Intl). */
|
|
32
|
+
export type HazeCalendarIdentifier = 'gregory' | 'islamic-umalqura';
|
|
33
|
+
/** Month-name width, mirroring Intl's `month` option values. */
|
|
34
|
+
export type MonthNameStyle = 'long' | 'short' | 'narrow';
|
|
35
|
+
/**
|
|
36
|
+
* Operations on a calendar's civil dates. All members are pure: no
|
|
37
|
+
* internal state, no mutation of arguments.
|
|
38
|
+
*/
|
|
39
|
+
export type HazeDateAdapter = {
|
|
40
|
+
/** Which calendar this adapter speaks; matches the `calendar` string
|
|
41
|
+
* Intl accepts. */
|
|
42
|
+
readonly identifier: HazeCalendarIdentifier;
|
|
43
|
+
/** Hijri/lunar-equivalent parts of a Date's **local civil date** (the
|
|
44
|
+
* date.ts midnight semantics — never the UTC reading of the
|
|
45
|
+
* instant). */
|
|
46
|
+
fromGregorian(date: Date): CivilDateParts;
|
|
47
|
+
/** Local-midnight Date of a civil date in this calendar. Out-of-range
|
|
48
|
+
* month indices normalize with carry (month 12 → next January,
|
|
49
|
+
* mirroring date.ts); a `day` that exists in no month of the calendar
|
|
50
|
+
* throws `RangeError` — never the silent `new Date` rollover. */
|
|
51
|
+
toGregorian(parts: CivilDateParts): Date;
|
|
52
|
+
/** Number of days in a month. Out-of-range months normalize with
|
|
53
|
+
* carry, like date.ts's Gregorian helper. */
|
|
54
|
+
getDaysInMonth(year: number, month: number): number;
|
|
55
|
+
/** Shift by whole calendar months with year carry, truncating the day
|
|
56
|
+
* to the target month's length (1430-12-30 + 1 → next year's month 1
|
|
57
|
+
* day 29 when that month has 29 days). Pure integer arithmetic on the
|
|
58
|
+
* month index — no Date rollover hazards. */
|
|
59
|
+
addMonths(parts: CivilDateParts, delta: number): CivilDateParts;
|
|
60
|
+
/** Twelve month names, index 0 = first month of the calendar year.
|
|
61
|
+
* `locale` defaults to the adapter's base presentation locale ('en'
|
|
62
|
+
* for the built-ins, matching Intl's calendar-extended locales). */
|
|
63
|
+
monthNames(locale?: string, style?: MonthNameStyle): string[];
|
|
64
|
+
/** Era abbreviation for a year ("AH" for Hijri, "AD"/"BC" for
|
|
65
|
+
* Gregorian), via Intl. Optional: consumers that render no era skip
|
|
66
|
+
* it. */
|
|
67
|
+
era?(year: number, locale?: string): string;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Era part of a UTC-civil date in `calendar` via Intl's `era` piece —
|
|
71
|
+
* the shared implementation behind both built-in adapters' `era` members
|
|
72
|
+
* (internal helper; not part of the public dates surface).
|
|
73
|
+
*/
|
|
74
|
+
export declare function eraOfDate(date: Date, calendar: HazeCalendarIdentifier, locale: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gregorian adapter — a thin shim over the calendar math Calendar already
|
|
3
|
+
* uses (`src/lib/components/Calendar/date.ts`, imported here, never
|
|
4
|
+
* duplicated). `fromGregorian`/`toGregorian` are identity mappings
|
|
5
|
+
* between local-civil Dates and their parts; month-length and view-shift
|
|
6
|
+
* semantics are date.ts's own, so a Calendar wired to this adapter
|
|
7
|
+
* behaves exactly like today's hard-wired Gregorian code paths.
|
|
8
|
+
*/
|
|
9
|
+
import type { HazeDateAdapter } from './adapter';
|
|
10
|
+
export declare const gregoryAdapter: HazeDateAdapter;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { gregoryAdapter } from './gregory';
|
|
2
|
+
export { islamicUmalquraAdapter } from './islamic';
|
|
3
|
+
export { getAdapter } from './registry';
|
|
4
|
+
export type { CivilDateParts, HazeDateAdapter, HazeCalendarIdentifier, MonthNameStyle, } from './adapter';
|
|
5
|
+
export { formatInTimeZone, getZonedParts } from './timezone';
|
|
6
|
+
export type { ZonedParts } from './timezone';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Islamic (Hijri) adapter for the Umm al-Qura tabulation — the calendar
|
|
3
|
+
* Node 20+ and every modern browser ship in full ICU
|
|
4
|
+
* (`islamic-umalqura`). There is no `new HijriDate()`, so both
|
|
5
|
+
* conversion directions route through Intl: forward via
|
|
6
|
+
* `formatToParts` on the UTC civil timeline, backward via a seeded
|
|
7
|
+
* linear search that refines against the forward conversion until the
|
|
8
|
+
* round-trip matches exactly. All arithmetic is whole-day UTC
|
|
9
|
+
* milliseconds (no DST drift); results materialize as local-midnight
|
|
10
|
+
* Dates per the date.ts civil semantics.
|
|
11
|
+
*
|
|
12
|
+
* ICU's Umm al-Qura data covers roughly 1300–1600 AH; outside that span
|
|
13
|
+
* ICU falls back to computed months, which this adapter stays
|
|
14
|
+
* self-consistent with (every conversion still passes through Intl).
|
|
15
|
+
*/
|
|
16
|
+
import type { HazeDateAdapter } from './adapter';
|
|
17
|
+
export declare const islamicUmalquraAdapter: HazeDateAdapter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter registry — resolves calendar identifiers to the shared
|
|
3
|
+
* adapter singletons. Lives in its own module so the adapter modules
|
|
4
|
+
* only depend on the contract (`./adapter`), keeping the module graph
|
|
5
|
+
* acyclic.
|
|
6
|
+
*/
|
|
7
|
+
import type { HazeCalendarIdentifier, HazeDateAdapter } from './adapter';
|
|
8
|
+
/**
|
|
9
|
+
* Adapter lookup by calendar identifier. Returns the shared singleton
|
|
10
|
+
* adapters (`gregoryAdapter`, `islamicUmalquraAdapter`); throws
|
|
11
|
+
* `RangeError` for identifiers with no built-in adapter.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAdapter(identifier: HazeCalendarIdentifier): HazeDateAdapter;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-zone formatting utilities on top of `Intl.DateTimeFormat`.
|
|
3
|
+
*
|
|
4
|
+
* Both functions construct their formatter per call — correct and
|
|
5
|
+
* dependency-free; callers on hot paths should hoist their own
|
|
6
|
+
* `Intl.DateTimeFormat` instead.
|
|
7
|
+
*/
|
|
8
|
+
/** Wall-clock parts of an instant inside a time zone. `month` is 0-based
|
|
9
|
+
* (the same `Date#getMonth` convention as the dates adapters and
|
|
10
|
+
* Calendar's date.ts), `hour` runs 0–23 (`h23` cycle). */
|
|
11
|
+
export type ZonedParts = {
|
|
12
|
+
year: number;
|
|
13
|
+
month: number;
|
|
14
|
+
day: number;
|
|
15
|
+
hour: number;
|
|
16
|
+
minute: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Format an instant in a named IANA time zone.
|
|
20
|
+
*
|
|
21
|
+
* `options` are passed through to `Intl.DateTimeFormat` (any locale or
|
|
22
|
+
* calendar preferences come from the runtime's default locale), with one
|
|
23
|
+
* override: an explicit `timeZone` inside `options` loses to the
|
|
24
|
+
* `timeZone` parameter. Throws the `RangeError` Intl emits for an
|
|
25
|
+
* unknown zone (or an invalid Date) — callers validate zones they do
|
|
26
|
+
* not control.
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatInTimeZone(date: Date, timeZone: string, options: Intl.DateTimeFormatOptions): string;
|
|
29
|
+
/**
|
|
30
|
+
* Zoned wall-clock parts (`year`/`month`/`day`/`hour`/`minute`) of an
|
|
31
|
+
* instant — the pieces a zoned date picker or scheduler compares. The
|
|
32
|
+
* formatter pins `en-US` (gregorian digits) and `h23` so the numbers are
|
|
33
|
+
* deterministic; localization is `formatInTimeZone`'s job. Throws the
|
|
34
|
+
* `RangeError` Intl emits for an unknown zone.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getZonedParts(date: Date, timeZone: string): ZonedParts;
|
|
@@ -110,6 +110,29 @@ export type FormItemOwnProps<TValues extends Record<string, any> = any, P extend
|
|
|
110
110
|
form?: FormInstance<TValues>;
|
|
111
111
|
name: P;
|
|
112
112
|
label?: ReactNode;
|
|
113
|
+
/**
|
|
114
|
+
* Layout mode of the item. `'vertical'` (default) stacks the label
|
|
115
|
+
* above the control — the exact historical rendering. `'horizontal'`
|
|
116
|
+
* puts the label in a left column and the control in a right one,
|
|
117
|
+
* with the error message placed under the control column so sibling
|
|
118
|
+
* items keep their controls vertically aligned. `'inline'` flows
|
|
119
|
+
* label + control + error on a single row and adds a trailing
|
|
120
|
+
* `margin-inline-end` so consecutive inline items space themselves.
|
|
121
|
+
*/
|
|
122
|
+
layout?: 'vertical' | 'horizontal' | 'inline';
|
|
123
|
+
/**
|
|
124
|
+
* Width of the label column in the `'horizontal'` layout: a number is
|
|
125
|
+
* treated as pixels, a string is used verbatim as a CSS width (e.g.
|
|
126
|
+
* `'8em'`). Omit for `auto` (content-driven). Ignored in the other
|
|
127
|
+
* layouts.
|
|
128
|
+
*/
|
|
129
|
+
labelWidth?: number | string;
|
|
130
|
+
/**
|
|
131
|
+
* Text alignment inside the label column in the `'horizontal'`
|
|
132
|
+
* layout: `'right'` (default — the AntD convention, labels hugging
|
|
133
|
+
* their controls) or `'left'`. Ignored in the other layouts.
|
|
134
|
+
*/
|
|
135
|
+
labelAlign?: 'left' | 'right';
|
|
113
136
|
/** Field-level validator, registered through react-f0rm's own
|
|
114
137
|
* `useField` channel — validated per the form's `mode` and on submit.
|
|
115
138
|
* With a typed form the value argument is `PathValueOf<TValues, P>`. */
|
|
@@ -308,6 +331,13 @@ export type FormItemProps<TValues extends Record<string, any> = any, P extends F
|
|
|
308
331
|
* When the field has errors, the first error's message is rendered into a
|
|
309
332
|
* `<span id={errorId} role='alert'>` next to the control; with no errors
|
|
310
333
|
* no extra element is rendered.
|
|
334
|
+
*
|
|
335
|
+
* Layout: the default `layout='vertical'` stacks label above control;
|
|
336
|
+
* `layout='horizontal'` pairs a fixed label column (`labelWidth`,
|
|
337
|
+
* `labelAlign='right'` by default) with the control, the error slotting
|
|
338
|
+
* under the control column; `layout='inline'` flows label + control +
|
|
339
|
+
* error on one row with an automatic inter-item `margin-inline-end`.
|
|
340
|
+
* The id/label/aria wiring is identical in all three layouts.
|
|
311
341
|
*/
|
|
312
|
-
export default function FormItem<TValues extends Record<string, any> = any, P extends FieldPath<TValues> | Name = Name, TInputProps extends Record<string, any> = Record<never, never>, TRawElement extends FormItemRawElement = never>({ form, name, label, validate, mode, validateDebounce, delayError, rules, className, renderError, as: As, asProps, input: Input, eventToValue, valueToProps, children, ...inputProps }: FormItemProps<TValues, P, TInputProps, TRawElement>): import("react").JSX.Element;
|
|
342
|
+
export default function FormItem<TValues extends Record<string, any> = any, P extends FieldPath<TValues> | Name = Name, TInputProps extends Record<string, any> = Record<never, never>, TRawElement extends FormItemRawElement = never>({ form, name, label, layout, labelWidth, labelAlign, validate, mode, validateDebounce, delayError, rules, className, renderError, as: As, asProps, input: Input, eventToValue, valueToProps, children, ...inputProps }: FormItemProps<TValues, P, TInputProps, TRawElement>): import("react").JSX.Element;
|
|
313
343
|
export {};
|