@pactor-app/ui 1.2.0 → 1.7.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 +2 -0
- package/dist/{chunk-L45CSL6I.js → chunk-7KC6DMKH.js} +3 -3
- package/dist/{chunk-Q5NUGUJG.js → chunk-E2TD6JD2.js} +205 -414
- package/dist/{chunk-F3H23KYG.js → chunk-F42SGQNW.js} +31 -93
- package/dist/{chunk-22TEN3ER.js → chunk-FJPRXEKQ.js} +13 -13
- package/dist/chunk-L4Z7MNYY.js +1197 -0
- package/dist/{chunk-LMEJ242M.js → chunk-PMYLC26E.js} +615 -307
- package/dist/chunk-WKJUCGV4.js +78 -0
- package/dist/chunk-ZM3WJZZ7.js +727 -0
- package/dist/components/index.cjs +1694 -969
- package/dist/components/index.d.cts +115 -13
- package/dist/components/index.d.ts +115 -13
- package/dist/components/index.js +10 -6
- package/dist/index.cjs +1889 -1164
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -8
- package/dist/interaction/index.cjs +10 -6
- package/dist/interaction/index.js +3 -3
- package/dist/layout/index.cjs +811 -269
- package/dist/layout/index.d.cts +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/index.js +4 -4
- package/dist/ui/index.cjs +1689 -534
- package/dist/ui/index.d.cts +130 -16
- package/dist/ui/index.d.ts +130 -16
- package/dist/ui/index.js +481 -22
- package/package.json +6 -5
- package/styles.css +975 -114
- package/dist/chunk-2LYMCWEJ.js +0 -289
- package/dist/chunk-HJPHJKVA.js +0 -671
- package/dist/chunk-RQHJBTEU.js +0 -10
|
@@ -558,6 +558,79 @@ interface DataTableProps {
|
|
|
558
558
|
*/
|
|
559
559
|
declare function DataTable({ columns, rows, rowKey, pagination, sort, onSort, onPageChange, className, style, }: DataTableProps): React.JSX.Element;
|
|
560
560
|
|
|
561
|
+
/** range 模式值(ISO yyyy-MM-dd 对) */
|
|
562
|
+
interface DateRangeValue {
|
|
563
|
+
start: string;
|
|
564
|
+
end: string;
|
|
565
|
+
}
|
|
566
|
+
/** 内置预设 key(计算与文案由框架提供,label 可覆盖) */
|
|
567
|
+
type DatePickerPresetKey = 'today' | 'thisWeek' | 'thisMonth';
|
|
568
|
+
/**
|
|
569
|
+
* presets 数组项的三种形态:
|
|
570
|
+
* - `{ key, label? }`:内置项(today / thisWeek / thisMonth),label 覆盖内置 i18n 文案
|
|
571
|
+
* - `{ label, days: N }`:最近 N 天(含今天)
|
|
572
|
+
* - `{ label, range: { start, end } }`:显式 ISO 区间
|
|
573
|
+
*/
|
|
574
|
+
type DatePickerPreset = {
|
|
575
|
+
key: DatePickerPresetKey;
|
|
576
|
+
label?: string;
|
|
577
|
+
} | {
|
|
578
|
+
label: string;
|
|
579
|
+
days: number;
|
|
580
|
+
} | {
|
|
581
|
+
label: string;
|
|
582
|
+
range: DateRangeValue;
|
|
583
|
+
};
|
|
584
|
+
interface DatePickerCommonProps {
|
|
585
|
+
/** 字段名;在 Form 内声明 name 即自动成为表单项 */
|
|
586
|
+
name?: string;
|
|
587
|
+
/** 表单项标签 */
|
|
588
|
+
label?: string;
|
|
589
|
+
/** 校验规则 */
|
|
590
|
+
rules?: FieldRule[];
|
|
591
|
+
/** 占位文案(缺省取 i18n key,按 mode 区分 single/range) */
|
|
592
|
+
placeholder?: string;
|
|
593
|
+
disabled?: boolean;
|
|
594
|
+
/**
|
|
595
|
+
* 快捷预设栏:未提供时 range 模式缺省为内置三项(今天/本周/本月),
|
|
596
|
+
* single 模式不渲染;`false` 显式关闭
|
|
597
|
+
*/
|
|
598
|
+
presets?: DatePickerPreset[] | false;
|
|
599
|
+
/** 通用:根节点 class(Form 内为 form-item 容器,独立渲染时为触发器) */
|
|
600
|
+
className?: string;
|
|
601
|
+
/** 通用:根节点内联样式(同 className 的挂载规则) */
|
|
602
|
+
style?: CSSProperties;
|
|
603
|
+
}
|
|
604
|
+
interface DatePickerSingleProps extends DatePickerCommonProps {
|
|
605
|
+
/** 选择模式(缺省 single) */
|
|
606
|
+
mode?: 'single';
|
|
607
|
+
/** 受控值(ISO 日期字符串 yyyy-MM-dd);Form 内作为字段初始值 */
|
|
608
|
+
value?: string;
|
|
609
|
+
/** 选中日期事件,传出 ISO 日期字符串(yyyy-MM-dd),清除传 undefined */
|
|
610
|
+
onChange?: (value: string | undefined) => void;
|
|
611
|
+
}
|
|
612
|
+
interface DatePickerRangeProps extends DatePickerCommonProps {
|
|
613
|
+
mode: 'range';
|
|
614
|
+
/** 受控值({ start, end } ISO 对);Form 内作为字段初始值 */
|
|
615
|
+
value?: DateRangeValue;
|
|
616
|
+
/** 范围选定事件,仅两端齐备时触发,传出 { start, end } ISO 对象 */
|
|
617
|
+
onChange?: (value: DateRangeValue | undefined) => void;
|
|
618
|
+
}
|
|
619
|
+
type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
|
|
620
|
+
/**
|
|
621
|
+
* DatePicker 适配器(shadcn kit):input 风格触发器 + 受控 Popover 内嵌
|
|
622
|
+
* vendored Calendar(react-day-picker)。`mode: 'single' | 'range'`;
|
|
623
|
+
* 值契约:single 为 ISO 字符串(yyyy-MM-dd),range 为 `{ start, end }`
|
|
624
|
+
* ISO 对象(仅两端齐备才触发 onChange)。range 为左右双面板(两个
|
|
625
|
+
* `mode="single"` 日历,各自受控月份与导航箭头),选择语义为
|
|
626
|
+
* 「任意面板两次点击」:首击设开始日并清空结束日,第二击不早于开始日
|
|
627
|
+
* 即提交、早于则重新开始,已有完整区间再点击开始新一轮。
|
|
628
|
+
* presets 快捷选择(除定位型「今天」外点击即完成选择、触发 onChange、
|
|
629
|
+
* 不关浮层);默认文案走 `pactor.datePicker.*` i18n key,日历本体按
|
|
630
|
+
* useI18n().locale 映射 date-fns locale。Form 内声明 `name` 自动成为表单项。
|
|
631
|
+
*/
|
|
632
|
+
declare function DatePicker(props: DatePickerProps): React.JSX.Element;
|
|
633
|
+
|
|
561
634
|
interface DialogProps {
|
|
562
635
|
/** 对话框标题 */
|
|
563
636
|
title?: string;
|
|
@@ -685,7 +758,11 @@ interface FlexProps {
|
|
|
685
758
|
style?: CSSProperties;
|
|
686
759
|
children?: ReactNode;
|
|
687
760
|
}
|
|
688
|
-
/**
|
|
761
|
+
/**
|
|
762
|
+
* Flex 布局(shadcn kit):方向 / 对齐映射 Tailwind 工具类,数字 gap 内联。
|
|
763
|
+
* gap 未指定时应用默认间距令牌 `--flex-gap`(命名档位读
|
|
764
|
+
* `--flex-gap-sm/md/lg`),均可被皮肤 CSS 覆盖;`gap: 0` 显式关闭。
|
|
765
|
+
*/
|
|
689
766
|
declare function Flex({ direction, gap, justify, align, className, style, children, }: FlexProps): React.JSX.Element;
|
|
690
767
|
|
|
691
768
|
interface FooterProps {
|
|
@@ -733,7 +810,7 @@ declare function Form({ name, layout, initialValues, className, style, children,
|
|
|
733
810
|
interface GridProps {
|
|
734
811
|
/** 列数,默认 1;每列等宽(columns 取整下限 1) */
|
|
735
812
|
columns?: number;
|
|
736
|
-
/**
|
|
813
|
+
/** 栏间距(px);未指定时应用默认间距令牌 `--grid-gap`,`gap: 0` 显式关闭 */
|
|
737
814
|
gap?: number;
|
|
738
815
|
/** 通用:根节点 class(与内置样式合并) */
|
|
739
816
|
className?: string;
|
|
@@ -1030,6 +1107,13 @@ interface MenuProps {
|
|
|
1030
1107
|
mode?: 'inline' | 'horizontal';
|
|
1031
1108
|
/** 受控选中项 key(可绑 `${state.x}`) */
|
|
1032
1109
|
selectedKey?: string;
|
|
1110
|
+
/**
|
|
1111
|
+
* 可折叠子菜单(仅 inline 模式生效,缺省 false):含 children 的目录项
|
|
1112
|
+
* 点击展开/收起(不触发 onSelect),右端 chevron 指示
|
|
1113
|
+
*/
|
|
1114
|
+
collapsible?: boolean;
|
|
1115
|
+
/** 初始展开的目录 key(与 selectedKey 祖先链合并;展开状态非受控) */
|
|
1116
|
+
defaultExpandedKeys?: string[];
|
|
1033
1117
|
/** 选中变化事件,传出选中项 key */
|
|
1034
1118
|
onSelect?: (key: string) => void;
|
|
1035
1119
|
/** 通用:根节点 class(与内置样式合并) */
|
|
@@ -1042,8 +1126,11 @@ interface MenuProps {
|
|
|
1042
1126
|
* 不直接读取外壳层 MenuRegistry;选中态受控(selectedKey + onSelect
|
|
1043
1127
|
* 闭环,典型接 navigate 动作)。在 Sidebar 内且侧栏折叠(icon rail)
|
|
1044
1128
|
* 时自动降级为仅图标(label / badge / dot / 分组隐藏,hover 经 RailTooltip 展示)。
|
|
1129
|
+
* `collapsible`(仅 inline 模式)使含 children 的目录项可展开/收起:
|
|
1130
|
+
* 点击目录项只 toggle 不触发 onSelect,右端 chevron 展开时旋转 180°;
|
|
1131
|
+
* 展开状态内部维护,初始为 defaultExpandedKeys ∪ selectedKey 祖先链。
|
|
1045
1132
|
*/
|
|
1046
|
-
declare function Menu({ items, mode, selectedKey, onSelect, className, style, }: MenuProps): React.JSX.Element;
|
|
1133
|
+
declare function Menu({ items, mode, selectedKey, collapsible, defaultExpandedKeys, onSelect, className, style, }: MenuProps): React.JSX.Element;
|
|
1047
1134
|
|
|
1048
1135
|
/** 菜单项(叶子);value 为 onSelect 传出值 */
|
|
1049
1136
|
interface MenubarLeafItem {
|
|
@@ -1203,6 +1290,12 @@ interface ResizablePanelData {
|
|
|
1203
1290
|
children?: DslNode[];
|
|
1204
1291
|
/** 默认尺寸(百分比,0-100) */
|
|
1205
1292
|
defaultSize?: number;
|
|
1293
|
+
/** 默认尺寸(像素;与 defaultSize 同时提供时优先生效) */
|
|
1294
|
+
defaultSizePx?: number;
|
|
1295
|
+
/** 最小尺寸(像素) */
|
|
1296
|
+
minSizePx?: number;
|
|
1297
|
+
/** 最大尺寸(像素) */
|
|
1298
|
+
maxSizePx?: number;
|
|
1206
1299
|
}
|
|
1207
1300
|
interface ResizableProps {
|
|
1208
1301
|
/** 面板列表(相邻面板间渲染拖拽手柄) */
|
|
@@ -1217,7 +1310,8 @@ interface ResizableProps {
|
|
|
1217
1310
|
/**
|
|
1218
1311
|
* Resizable 适配器(shadcn kit):基于 vendored Resizable
|
|
1219
1312
|
* (react-resizable-panels);panels 声明面板,相邻面板间为可拖拽手柄;
|
|
1220
|
-
* DSL 的 defaultSize
|
|
1313
|
+
* DSL 的 defaultSize 统一按百分比解释,defaultSizePx/minSizePx/maxSizePx
|
|
1314
|
+
* 按像素解释(像素优先级高于百分比)。
|
|
1221
1315
|
*/
|
|
1222
1316
|
declare function Resizable({ panels, direction, className, style, }: ResizableProps): React.JSX.Element;
|
|
1223
1317
|
|
|
@@ -1335,7 +1429,7 @@ interface SidebarProps {
|
|
|
1335
1429
|
content?: ReactNode;
|
|
1336
1430
|
/** 侧栏底部固定区(渲染在滚动区之后,不随内容滚动;未提供不渲染容器) */
|
|
1337
1431
|
sidebarFooter?: ReactNode;
|
|
1338
|
-
/** 是否渲染折叠触发器:折叠后桌面侧栏收窄为 icon rail
|
|
1432
|
+
/** 是否渲染折叠触发器:折叠后桌面侧栏收窄为 icon rail(导航仅图标) */
|
|
1339
1433
|
collapsible?: boolean;
|
|
1340
1434
|
/** 折叠状态变化事件,传出 boolean */
|
|
1341
1435
|
onCollapse?: (collapsed: boolean) => void;
|
|
@@ -1350,21 +1444,28 @@ interface SidebarProps {
|
|
|
1350
1444
|
/** 主内容区 */
|
|
1351
1445
|
children?: ReactNode;
|
|
1352
1446
|
}
|
|
1447
|
+
/**
|
|
1448
|
+
* 侧栏抽屉 context(向后兼容):侧栏内容(如 Menu)经 `useSidebarDrawer()` 取
|
|
1449
|
+
* `close()`(导航后关闭移动端抽屉)与 `collapsed`(桌面 icon rail 状态);
|
|
1450
|
+
* 不在 Sidebar 内时返回 null。
|
|
1451
|
+
*
|
|
1452
|
+
* 内部桥接 shadcn Sidebar 的 useSidebar context。
|
|
1453
|
+
*/
|
|
1353
1454
|
declare function useSidebarDrawer(): {
|
|
1354
1455
|
close: () => void;
|
|
1355
1456
|
collapsed: boolean;
|
|
1356
1457
|
} | null;
|
|
1357
1458
|
/**
|
|
1358
1459
|
* Sidebar 页面级组合(shadcn kit):品牌区 + 侧栏(items 嵌套导航或
|
|
1359
|
-
* content 自由内容槽)+ children
|
|
1360
|
-
* sidebar 系列语义令牌。
|
|
1460
|
+
* content 自由内容槽)+ children 主内容区组成的页面外壳。
|
|
1361
1461
|
*
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1365
|
-
*
|
|
1366
|
-
*
|
|
1462
|
+
* 内部组合 shadcn Sidebar 原语(SidebarProvider / Sidebar / SidebarInset):
|
|
1463
|
+
* - 桌面(≥768px):侧栏与主区同行;collapsible 时折叠触发器把
|
|
1464
|
+
* 侧栏收窄为 icon rail(导航仅图标、hover 经 Tooltip 展示);
|
|
1465
|
+
* - 移动端(<768px,drawer 缺省开启):侧栏变为 Sheet 覆盖抽屉——
|
|
1466
|
+
* 顶栏菜单按钮开启,遮罩点击 / Escape / locationKey 变化关闭;
|
|
1367
1467
|
* - 侧栏内容可经 useSidebarDrawer() 取 close / collapsed 自行适配。
|
|
1468
|
+
* - ⌘B / Ctrl+B 键盘快捷键切换侧栏(shadcn SidebarProvider 内建)。
|
|
1368
1469
|
*/
|
|
1369
1470
|
declare function Sidebar({ brand, items, content, sidebarFooter, collapsible, onCollapse, locationKey, drawer, className, style, children, }: SidebarProps): React.JSX.Element;
|
|
1370
1471
|
|
|
@@ -1773,6 +1874,7 @@ declare const builtinComponents: {
|
|
|
1773
1874
|
readonly Tooltip: typeof Tooltip;
|
|
1774
1875
|
readonly HoverCard: typeof HoverCard;
|
|
1775
1876
|
readonly Calendar: typeof Calendar;
|
|
1877
|
+
readonly DatePicker: typeof DatePicker;
|
|
1776
1878
|
readonly InputOTP: typeof InputOTP;
|
|
1777
1879
|
readonly Combobox: typeof Combobox;
|
|
1778
1880
|
readonly Carousel: typeof Carousel;
|
|
@@ -1835,4 +1937,4 @@ interface FormContextValue {
|
|
|
1835
1937
|
/** 在字段组件内探测 Form 上下文;不在 Form 内时返回 null */
|
|
1836
1938
|
declare function useFormContext(): FormContextValue | null;
|
|
1837
1939
|
|
|
1838
|
-
export { Accordion, type AccordionItemData, type AccordionProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, AspectRatio, type AspectRatioProps, Avatar, type AvatarProps, Badge, type BadgeProps, type BadgeVariant, Breadcrumb, type BreadcrumbItemData, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, type CalendarProps, Card, type CardProps, Carousel, type CarouselImage, type CarouselItemData, type CarouselProps, Chart, type ChartProps, type ChartType, Checkbox, type CheckboxProps, Collapsible, type CollapsibleProps, Combobox, type ComboboxOption, type ComboboxProps, Command, type CommandGroupData, type CommandItemData, type CommandProps, Content, type ContentProps, ContextMenu, type ContextMenuItemData, type ContextMenuProps, DataTable, type DataTableColumn, type DataTablePagination, type DataTableProps, type DataTableSort, type DataTableSortOrder, Dialog, type DialogProps, Drawer, type DrawerPlacement, type DrawerProps, DropdownMenu, type DropdownMenuItemData, type DropdownMenuProps, Empty, type EmptyProps, Field, type FieldProps, type FieldRule, Flex, type FlexProps, Footer, type FooterProps, Form, type FormContextValue, type FormProps, Grid, type GridProps, Header, type HeaderBrandPosition, type HeaderDropdown, type HeaderDropdownItem, type HeaderLocale, type HeaderMenuItem, type HeaderProps, type HeaderUser, type HeaderUserItem, HoverCard, type HoverCardProps, ICONS, Icon, type IconProps, type IconSize, Input, InputGroup, type InputGroupProps, InputOTP, type InputOTPProps, type InputProps, Item, type ItemProps, Kbd, type KbdProps, Label, type LabelProps, Layout, type LayoutProps, Link, type LinkProps, Menu, type MenuItem, type MenuProps, Menubar, type MenubarLeafItem, type MenubarMenuData, type MenubarProps, NavigationMenu, type NavigationMenuChildItem, type NavigationMenuItemData, type NavigationMenuProps, Page, type PageProps, Pagination, type PaginationProps, Popover, type PopoverProps, Progress, type ProgressProps, RadioGroup, type RadioGroupOption, type RadioGroupProps, RailTooltip, Resizable, type ResizablePanelData, type ResizableProps, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, type SheetSide, Sidebar, type SidebarBrand, type SidebarNavItem, type SidebarProps, Sider, type SiderProps, Skeleton, type SkeletonProps, type SkeletonShape, Slider, type SliderProps, Sonner, type SonnerProps, Spinner, type SpinnerProps, type SpinnerSize, Statistic, type StatisticProps, Switch, type SwitchProps, type TabItem, Table, type TableColumn, type TablePagination, type TablePaginationInfo, type TableProps, Tabs, type TabsProps, Text, type TextProps, type TextType, Textarea, type TextareaProps, Toggle, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleProps, Tooltip, type TooltipProps, Typography, type TypographyProps, type TypographyVariant, builtinComponents, createComponentRegistry, normalizeIconName, registerBuiltinComponents, useFormContext, useSidebarDrawer };
|
|
1940
|
+
export { Accordion, type AccordionItemData, type AccordionProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, AspectRatio, type AspectRatioProps, Avatar, type AvatarProps, Badge, type BadgeProps, type BadgeVariant, Breadcrumb, type BreadcrumbItemData, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, type CalendarProps, Card, type CardProps, Carousel, type CarouselImage, type CarouselItemData, type CarouselProps, Chart, type ChartProps, type ChartType, ChatInput, type ChatInputProps, Checkbox, type CheckboxProps, Collapsible, type CollapsibleProps, Combobox, type ComboboxOption, type ComboboxProps, Command, type CommandGroupData, type CommandItemData, type CommandProps, Content, type ContentProps, ContextMenu, type ContextMenuItemData, type ContextMenuProps, DataTable, type DataTableColumn, type DataTablePagination, type DataTableProps, type DataTableSort, type DataTableSortOrder, DatePicker, type DatePickerPreset, type DatePickerPresetKey, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, type DateRangeValue, Dialog, type DialogProps, Drawer, type DrawerPlacement, type DrawerProps, DropdownMenu, type DropdownMenuItemData, type DropdownMenuProps, Empty, type EmptyProps, Field, type FieldProps, type FieldRule, Flex, type FlexProps, Footer, type FooterProps, Form, type FormContextValue, type FormProps, Grid, type GridProps, Header, type HeaderBrandPosition, type HeaderDropdown, type HeaderDropdownItem, type HeaderLocale, type HeaderMenuItem, type HeaderProps, type HeaderUser, type HeaderUserItem, HoverCard, type HoverCardProps, ICONS, Icon, type IconProps, type IconSize, Input, InputGroup, type InputGroupProps, InputOTP, type InputOTPProps, type InputProps, Item, type ItemProps, Kbd, type KbdProps, Label, type LabelProps, Layout, type LayoutProps, Link, type LinkProps, Menu, type MenuItem, type MenuProps, Menubar, type MenubarLeafItem, type MenubarMenuData, type MenubarProps, NavigationMenu, type NavigationMenuChildItem, type NavigationMenuItemData, type NavigationMenuProps, Page, type PageProps, Pagination, type PaginationProps, Popover, type PopoverProps, Progress, type ProgressProps, RadioGroup, type RadioGroupOption, type RadioGroupProps, RailTooltip, Resizable, type ResizablePanelData, type ResizableProps, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, type SheetSide, Sidebar, type SidebarBrand, type SidebarNavItem, type SidebarProps, Sider, type SiderProps, Skeleton, type SkeletonProps, type SkeletonShape, Slider, type SliderProps, Sonner, type SonnerProps, Spinner, type SpinnerProps, type SpinnerSize, Statistic, type StatisticProps, Switch, type SwitchProps, type TabItem, Table, type TableColumn, type TablePagination, type TablePaginationInfo, type TableProps, Tabs, type TabsProps, Text, type TextProps, type TextType, Textarea, type TextareaProps, Toggle, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleProps, Tooltip, type TooltipProps, Typography, type TypographyProps, type TypographyVariant, builtinComponents, createComponentRegistry, normalizeIconName, registerBuiltinComponents, useFormContext, useSidebarDrawer };
|
|
@@ -558,6 +558,79 @@ interface DataTableProps {
|
|
|
558
558
|
*/
|
|
559
559
|
declare function DataTable({ columns, rows, rowKey, pagination, sort, onSort, onPageChange, className, style, }: DataTableProps): React.JSX.Element;
|
|
560
560
|
|
|
561
|
+
/** range 模式值(ISO yyyy-MM-dd 对) */
|
|
562
|
+
interface DateRangeValue {
|
|
563
|
+
start: string;
|
|
564
|
+
end: string;
|
|
565
|
+
}
|
|
566
|
+
/** 内置预设 key(计算与文案由框架提供,label 可覆盖) */
|
|
567
|
+
type DatePickerPresetKey = 'today' | 'thisWeek' | 'thisMonth';
|
|
568
|
+
/**
|
|
569
|
+
* presets 数组项的三种形态:
|
|
570
|
+
* - `{ key, label? }`:内置项(today / thisWeek / thisMonth),label 覆盖内置 i18n 文案
|
|
571
|
+
* - `{ label, days: N }`:最近 N 天(含今天)
|
|
572
|
+
* - `{ label, range: { start, end } }`:显式 ISO 区间
|
|
573
|
+
*/
|
|
574
|
+
type DatePickerPreset = {
|
|
575
|
+
key: DatePickerPresetKey;
|
|
576
|
+
label?: string;
|
|
577
|
+
} | {
|
|
578
|
+
label: string;
|
|
579
|
+
days: number;
|
|
580
|
+
} | {
|
|
581
|
+
label: string;
|
|
582
|
+
range: DateRangeValue;
|
|
583
|
+
};
|
|
584
|
+
interface DatePickerCommonProps {
|
|
585
|
+
/** 字段名;在 Form 内声明 name 即自动成为表单项 */
|
|
586
|
+
name?: string;
|
|
587
|
+
/** 表单项标签 */
|
|
588
|
+
label?: string;
|
|
589
|
+
/** 校验规则 */
|
|
590
|
+
rules?: FieldRule[];
|
|
591
|
+
/** 占位文案(缺省取 i18n key,按 mode 区分 single/range) */
|
|
592
|
+
placeholder?: string;
|
|
593
|
+
disabled?: boolean;
|
|
594
|
+
/**
|
|
595
|
+
* 快捷预设栏:未提供时 range 模式缺省为内置三项(今天/本周/本月),
|
|
596
|
+
* single 模式不渲染;`false` 显式关闭
|
|
597
|
+
*/
|
|
598
|
+
presets?: DatePickerPreset[] | false;
|
|
599
|
+
/** 通用:根节点 class(Form 内为 form-item 容器,独立渲染时为触发器) */
|
|
600
|
+
className?: string;
|
|
601
|
+
/** 通用:根节点内联样式(同 className 的挂载规则) */
|
|
602
|
+
style?: CSSProperties;
|
|
603
|
+
}
|
|
604
|
+
interface DatePickerSingleProps extends DatePickerCommonProps {
|
|
605
|
+
/** 选择模式(缺省 single) */
|
|
606
|
+
mode?: 'single';
|
|
607
|
+
/** 受控值(ISO 日期字符串 yyyy-MM-dd);Form 内作为字段初始值 */
|
|
608
|
+
value?: string;
|
|
609
|
+
/** 选中日期事件,传出 ISO 日期字符串(yyyy-MM-dd),清除传 undefined */
|
|
610
|
+
onChange?: (value: string | undefined) => void;
|
|
611
|
+
}
|
|
612
|
+
interface DatePickerRangeProps extends DatePickerCommonProps {
|
|
613
|
+
mode: 'range';
|
|
614
|
+
/** 受控值({ start, end } ISO 对);Form 内作为字段初始值 */
|
|
615
|
+
value?: DateRangeValue;
|
|
616
|
+
/** 范围选定事件,仅两端齐备时触发,传出 { start, end } ISO 对象 */
|
|
617
|
+
onChange?: (value: DateRangeValue | undefined) => void;
|
|
618
|
+
}
|
|
619
|
+
type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
|
|
620
|
+
/**
|
|
621
|
+
* DatePicker 适配器(shadcn kit):input 风格触发器 + 受控 Popover 内嵌
|
|
622
|
+
* vendored Calendar(react-day-picker)。`mode: 'single' | 'range'`;
|
|
623
|
+
* 值契约:single 为 ISO 字符串(yyyy-MM-dd),range 为 `{ start, end }`
|
|
624
|
+
* ISO 对象(仅两端齐备才触发 onChange)。range 为左右双面板(两个
|
|
625
|
+
* `mode="single"` 日历,各自受控月份与导航箭头),选择语义为
|
|
626
|
+
* 「任意面板两次点击」:首击设开始日并清空结束日,第二击不早于开始日
|
|
627
|
+
* 即提交、早于则重新开始,已有完整区间再点击开始新一轮。
|
|
628
|
+
* presets 快捷选择(除定位型「今天」外点击即完成选择、触发 onChange、
|
|
629
|
+
* 不关浮层);默认文案走 `pactor.datePicker.*` i18n key,日历本体按
|
|
630
|
+
* useI18n().locale 映射 date-fns locale。Form 内声明 `name` 自动成为表单项。
|
|
631
|
+
*/
|
|
632
|
+
declare function DatePicker(props: DatePickerProps): React.JSX.Element;
|
|
633
|
+
|
|
561
634
|
interface DialogProps {
|
|
562
635
|
/** 对话框标题 */
|
|
563
636
|
title?: string;
|
|
@@ -685,7 +758,11 @@ interface FlexProps {
|
|
|
685
758
|
style?: CSSProperties;
|
|
686
759
|
children?: ReactNode;
|
|
687
760
|
}
|
|
688
|
-
/**
|
|
761
|
+
/**
|
|
762
|
+
* Flex 布局(shadcn kit):方向 / 对齐映射 Tailwind 工具类,数字 gap 内联。
|
|
763
|
+
* gap 未指定时应用默认间距令牌 `--flex-gap`(命名档位读
|
|
764
|
+
* `--flex-gap-sm/md/lg`),均可被皮肤 CSS 覆盖;`gap: 0` 显式关闭。
|
|
765
|
+
*/
|
|
689
766
|
declare function Flex({ direction, gap, justify, align, className, style, children, }: FlexProps): React.JSX.Element;
|
|
690
767
|
|
|
691
768
|
interface FooterProps {
|
|
@@ -733,7 +810,7 @@ declare function Form({ name, layout, initialValues, className, style, children,
|
|
|
733
810
|
interface GridProps {
|
|
734
811
|
/** 列数,默认 1;每列等宽(columns 取整下限 1) */
|
|
735
812
|
columns?: number;
|
|
736
|
-
/**
|
|
813
|
+
/** 栏间距(px);未指定时应用默认间距令牌 `--grid-gap`,`gap: 0` 显式关闭 */
|
|
737
814
|
gap?: number;
|
|
738
815
|
/** 通用:根节点 class(与内置样式合并) */
|
|
739
816
|
className?: string;
|
|
@@ -1030,6 +1107,13 @@ interface MenuProps {
|
|
|
1030
1107
|
mode?: 'inline' | 'horizontal';
|
|
1031
1108
|
/** 受控选中项 key(可绑 `${state.x}`) */
|
|
1032
1109
|
selectedKey?: string;
|
|
1110
|
+
/**
|
|
1111
|
+
* 可折叠子菜单(仅 inline 模式生效,缺省 false):含 children 的目录项
|
|
1112
|
+
* 点击展开/收起(不触发 onSelect),右端 chevron 指示
|
|
1113
|
+
*/
|
|
1114
|
+
collapsible?: boolean;
|
|
1115
|
+
/** 初始展开的目录 key(与 selectedKey 祖先链合并;展开状态非受控) */
|
|
1116
|
+
defaultExpandedKeys?: string[];
|
|
1033
1117
|
/** 选中变化事件,传出选中项 key */
|
|
1034
1118
|
onSelect?: (key: string) => void;
|
|
1035
1119
|
/** 通用:根节点 class(与内置样式合并) */
|
|
@@ -1042,8 +1126,11 @@ interface MenuProps {
|
|
|
1042
1126
|
* 不直接读取外壳层 MenuRegistry;选中态受控(selectedKey + onSelect
|
|
1043
1127
|
* 闭环,典型接 navigate 动作)。在 Sidebar 内且侧栏折叠(icon rail)
|
|
1044
1128
|
* 时自动降级为仅图标(label / badge / dot / 分组隐藏,hover 经 RailTooltip 展示)。
|
|
1129
|
+
* `collapsible`(仅 inline 模式)使含 children 的目录项可展开/收起:
|
|
1130
|
+
* 点击目录项只 toggle 不触发 onSelect,右端 chevron 展开时旋转 180°;
|
|
1131
|
+
* 展开状态内部维护,初始为 defaultExpandedKeys ∪ selectedKey 祖先链。
|
|
1045
1132
|
*/
|
|
1046
|
-
declare function Menu({ items, mode, selectedKey, onSelect, className, style, }: MenuProps): React.JSX.Element;
|
|
1133
|
+
declare function Menu({ items, mode, selectedKey, collapsible, defaultExpandedKeys, onSelect, className, style, }: MenuProps): React.JSX.Element;
|
|
1047
1134
|
|
|
1048
1135
|
/** 菜单项(叶子);value 为 onSelect 传出值 */
|
|
1049
1136
|
interface MenubarLeafItem {
|
|
@@ -1203,6 +1290,12 @@ interface ResizablePanelData {
|
|
|
1203
1290
|
children?: DslNode[];
|
|
1204
1291
|
/** 默认尺寸(百分比,0-100) */
|
|
1205
1292
|
defaultSize?: number;
|
|
1293
|
+
/** 默认尺寸(像素;与 defaultSize 同时提供时优先生效) */
|
|
1294
|
+
defaultSizePx?: number;
|
|
1295
|
+
/** 最小尺寸(像素) */
|
|
1296
|
+
minSizePx?: number;
|
|
1297
|
+
/** 最大尺寸(像素) */
|
|
1298
|
+
maxSizePx?: number;
|
|
1206
1299
|
}
|
|
1207
1300
|
interface ResizableProps {
|
|
1208
1301
|
/** 面板列表(相邻面板间渲染拖拽手柄) */
|
|
@@ -1217,7 +1310,8 @@ interface ResizableProps {
|
|
|
1217
1310
|
/**
|
|
1218
1311
|
* Resizable 适配器(shadcn kit):基于 vendored Resizable
|
|
1219
1312
|
* (react-resizable-panels);panels 声明面板,相邻面板间为可拖拽手柄;
|
|
1220
|
-
* DSL 的 defaultSize
|
|
1313
|
+
* DSL 的 defaultSize 统一按百分比解释,defaultSizePx/minSizePx/maxSizePx
|
|
1314
|
+
* 按像素解释(像素优先级高于百分比)。
|
|
1221
1315
|
*/
|
|
1222
1316
|
declare function Resizable({ panels, direction, className, style, }: ResizableProps): React.JSX.Element;
|
|
1223
1317
|
|
|
@@ -1335,7 +1429,7 @@ interface SidebarProps {
|
|
|
1335
1429
|
content?: ReactNode;
|
|
1336
1430
|
/** 侧栏底部固定区(渲染在滚动区之后,不随内容滚动;未提供不渲染容器) */
|
|
1337
1431
|
sidebarFooter?: ReactNode;
|
|
1338
|
-
/** 是否渲染折叠触发器:折叠后桌面侧栏收窄为 icon rail
|
|
1432
|
+
/** 是否渲染折叠触发器:折叠后桌面侧栏收窄为 icon rail(导航仅图标) */
|
|
1339
1433
|
collapsible?: boolean;
|
|
1340
1434
|
/** 折叠状态变化事件,传出 boolean */
|
|
1341
1435
|
onCollapse?: (collapsed: boolean) => void;
|
|
@@ -1350,21 +1444,28 @@ interface SidebarProps {
|
|
|
1350
1444
|
/** 主内容区 */
|
|
1351
1445
|
children?: ReactNode;
|
|
1352
1446
|
}
|
|
1447
|
+
/**
|
|
1448
|
+
* 侧栏抽屉 context(向后兼容):侧栏内容(如 Menu)经 `useSidebarDrawer()` 取
|
|
1449
|
+
* `close()`(导航后关闭移动端抽屉)与 `collapsed`(桌面 icon rail 状态);
|
|
1450
|
+
* 不在 Sidebar 内时返回 null。
|
|
1451
|
+
*
|
|
1452
|
+
* 内部桥接 shadcn Sidebar 的 useSidebar context。
|
|
1453
|
+
*/
|
|
1353
1454
|
declare function useSidebarDrawer(): {
|
|
1354
1455
|
close: () => void;
|
|
1355
1456
|
collapsed: boolean;
|
|
1356
1457
|
} | null;
|
|
1357
1458
|
/**
|
|
1358
1459
|
* Sidebar 页面级组合(shadcn kit):品牌区 + 侧栏(items 嵌套导航或
|
|
1359
|
-
* content 自由内容槽)+ children
|
|
1360
|
-
* sidebar 系列语义令牌。
|
|
1460
|
+
* content 自由内容槽)+ children 主内容区组成的页面外壳。
|
|
1361
1461
|
*
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1365
|
-
*
|
|
1366
|
-
*
|
|
1462
|
+
* 内部组合 shadcn Sidebar 原语(SidebarProvider / Sidebar / SidebarInset):
|
|
1463
|
+
* - 桌面(≥768px):侧栏与主区同行;collapsible 时折叠触发器把
|
|
1464
|
+
* 侧栏收窄为 icon rail(导航仅图标、hover 经 Tooltip 展示);
|
|
1465
|
+
* - 移动端(<768px,drawer 缺省开启):侧栏变为 Sheet 覆盖抽屉——
|
|
1466
|
+
* 顶栏菜单按钮开启,遮罩点击 / Escape / locationKey 变化关闭;
|
|
1367
1467
|
* - 侧栏内容可经 useSidebarDrawer() 取 close / collapsed 自行适配。
|
|
1468
|
+
* - ⌘B / Ctrl+B 键盘快捷键切换侧栏(shadcn SidebarProvider 内建)。
|
|
1368
1469
|
*/
|
|
1369
1470
|
declare function Sidebar({ brand, items, content, sidebarFooter, collapsible, onCollapse, locationKey, drawer, className, style, children, }: SidebarProps): React.JSX.Element;
|
|
1370
1471
|
|
|
@@ -1773,6 +1874,7 @@ declare const builtinComponents: {
|
|
|
1773
1874
|
readonly Tooltip: typeof Tooltip;
|
|
1774
1875
|
readonly HoverCard: typeof HoverCard;
|
|
1775
1876
|
readonly Calendar: typeof Calendar;
|
|
1877
|
+
readonly DatePicker: typeof DatePicker;
|
|
1776
1878
|
readonly InputOTP: typeof InputOTP;
|
|
1777
1879
|
readonly Combobox: typeof Combobox;
|
|
1778
1880
|
readonly Carousel: typeof Carousel;
|
|
@@ -1835,4 +1937,4 @@ interface FormContextValue {
|
|
|
1835
1937
|
/** 在字段组件内探测 Form 上下文;不在 Form 内时返回 null */
|
|
1836
1938
|
declare function useFormContext(): FormContextValue | null;
|
|
1837
1939
|
|
|
1838
|
-
export { Accordion, type AccordionItemData, type AccordionProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, AspectRatio, type AspectRatioProps, Avatar, type AvatarProps, Badge, type BadgeProps, type BadgeVariant, Breadcrumb, type BreadcrumbItemData, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, type CalendarProps, Card, type CardProps, Carousel, type CarouselImage, type CarouselItemData, type CarouselProps, Chart, type ChartProps, type ChartType, Checkbox, type CheckboxProps, Collapsible, type CollapsibleProps, Combobox, type ComboboxOption, type ComboboxProps, Command, type CommandGroupData, type CommandItemData, type CommandProps, Content, type ContentProps, ContextMenu, type ContextMenuItemData, type ContextMenuProps, DataTable, type DataTableColumn, type DataTablePagination, type DataTableProps, type DataTableSort, type DataTableSortOrder, Dialog, type DialogProps, Drawer, type DrawerPlacement, type DrawerProps, DropdownMenu, type DropdownMenuItemData, type DropdownMenuProps, Empty, type EmptyProps, Field, type FieldProps, type FieldRule, Flex, type FlexProps, Footer, type FooterProps, Form, type FormContextValue, type FormProps, Grid, type GridProps, Header, type HeaderBrandPosition, type HeaderDropdown, type HeaderDropdownItem, type HeaderLocale, type HeaderMenuItem, type HeaderProps, type HeaderUser, type HeaderUserItem, HoverCard, type HoverCardProps, ICONS, Icon, type IconProps, type IconSize, Input, InputGroup, type InputGroupProps, InputOTP, type InputOTPProps, type InputProps, Item, type ItemProps, Kbd, type KbdProps, Label, type LabelProps, Layout, type LayoutProps, Link, type LinkProps, Menu, type MenuItem, type MenuProps, Menubar, type MenubarLeafItem, type MenubarMenuData, type MenubarProps, NavigationMenu, type NavigationMenuChildItem, type NavigationMenuItemData, type NavigationMenuProps, Page, type PageProps, Pagination, type PaginationProps, Popover, type PopoverProps, Progress, type ProgressProps, RadioGroup, type RadioGroupOption, type RadioGroupProps, RailTooltip, Resizable, type ResizablePanelData, type ResizableProps, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, type SheetSide, Sidebar, type SidebarBrand, type SidebarNavItem, type SidebarProps, Sider, type SiderProps, Skeleton, type SkeletonProps, type SkeletonShape, Slider, type SliderProps, Sonner, type SonnerProps, Spinner, type SpinnerProps, type SpinnerSize, Statistic, type StatisticProps, Switch, type SwitchProps, type TabItem, Table, type TableColumn, type TablePagination, type TablePaginationInfo, type TableProps, Tabs, type TabsProps, Text, type TextProps, type TextType, Textarea, type TextareaProps, Toggle, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleProps, Tooltip, type TooltipProps, Typography, type TypographyProps, type TypographyVariant, builtinComponents, createComponentRegistry, normalizeIconName, registerBuiltinComponents, useFormContext, useSidebarDrawer };
|
|
1940
|
+
export { Accordion, type AccordionItemData, type AccordionProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, AspectRatio, type AspectRatioProps, Avatar, type AvatarProps, Badge, type BadgeProps, type BadgeVariant, Breadcrumb, type BreadcrumbItemData, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, type CalendarProps, Card, type CardProps, Carousel, type CarouselImage, type CarouselItemData, type CarouselProps, Chart, type ChartProps, type ChartType, ChatInput, type ChatInputProps, Checkbox, type CheckboxProps, Collapsible, type CollapsibleProps, Combobox, type ComboboxOption, type ComboboxProps, Command, type CommandGroupData, type CommandItemData, type CommandProps, Content, type ContentProps, ContextMenu, type ContextMenuItemData, type ContextMenuProps, DataTable, type DataTableColumn, type DataTablePagination, type DataTableProps, type DataTableSort, type DataTableSortOrder, DatePicker, type DatePickerPreset, type DatePickerPresetKey, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, type DateRangeValue, Dialog, type DialogProps, Drawer, type DrawerPlacement, type DrawerProps, DropdownMenu, type DropdownMenuItemData, type DropdownMenuProps, Empty, type EmptyProps, Field, type FieldProps, type FieldRule, Flex, type FlexProps, Footer, type FooterProps, Form, type FormContextValue, type FormProps, Grid, type GridProps, Header, type HeaderBrandPosition, type HeaderDropdown, type HeaderDropdownItem, type HeaderLocale, type HeaderMenuItem, type HeaderProps, type HeaderUser, type HeaderUserItem, HoverCard, type HoverCardProps, ICONS, Icon, type IconProps, type IconSize, Input, InputGroup, type InputGroupProps, InputOTP, type InputOTPProps, type InputProps, Item, type ItemProps, Kbd, type KbdProps, Label, type LabelProps, Layout, type LayoutProps, Link, type LinkProps, Menu, type MenuItem, type MenuProps, Menubar, type MenubarLeafItem, type MenubarMenuData, type MenubarProps, NavigationMenu, type NavigationMenuChildItem, type NavigationMenuItemData, type NavigationMenuProps, Page, type PageProps, Pagination, type PaginationProps, Popover, type PopoverProps, Progress, type ProgressProps, RadioGroup, type RadioGroupOption, type RadioGroupProps, RailTooltip, Resizable, type ResizablePanelData, type ResizableProps, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, type SheetSide, Sidebar, type SidebarBrand, type SidebarNavItem, type SidebarProps, Sider, type SiderProps, Skeleton, type SkeletonProps, type SkeletonShape, Slider, type SliderProps, Sonner, type SonnerProps, Spinner, type SpinnerProps, type SpinnerSize, Statistic, type StatisticProps, Switch, type SwitchProps, type TabItem, Table, type TableColumn, type TablePagination, type TablePaginationInfo, type TableProps, Tabs, type TabsProps, Text, type TextProps, type TextType, Textarea, type TextareaProps, Toggle, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleProps, Tooltip, type TooltipProps, Typography, type TypographyProps, type TypographyVariant, builtinComponents, createComponentRegistry, normalizeIconName, registerBuiltinComponents, useFormContext, useSidebarDrawer };
|
package/dist/components/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
Card,
|
|
13
13
|
Carousel,
|
|
14
14
|
Chart,
|
|
15
|
+
ChatInput,
|
|
15
16
|
Checkbox,
|
|
16
17
|
Collapsible,
|
|
17
18
|
Combobox,
|
|
@@ -19,6 +20,7 @@ import {
|
|
|
19
20
|
Content,
|
|
20
21
|
ContextMenu,
|
|
21
22
|
DataTable,
|
|
23
|
+
DatePicker,
|
|
22
24
|
Dialog,
|
|
23
25
|
Drawer,
|
|
24
26
|
DropdownMenu,
|
|
@@ -69,7 +71,7 @@ import {
|
|
|
69
71
|
createComponentRegistry,
|
|
70
72
|
registerBuiltinComponents,
|
|
71
73
|
useFormContext
|
|
72
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-PMYLC26E.js";
|
|
73
75
|
import {
|
|
74
76
|
ICONS,
|
|
75
77
|
Icon,
|
|
@@ -78,11 +80,11 @@ import {
|
|
|
78
80
|
Sidebar,
|
|
79
81
|
normalizeIconName,
|
|
80
82
|
useSidebarDrawer
|
|
81
|
-
} from "../chunk-
|
|
82
|
-
import "../chunk-
|
|
83
|
-
import "../chunk-
|
|
84
|
-
import "../chunk-
|
|
85
|
-
import "../chunk-
|
|
83
|
+
} from "../chunk-ZM3WJZZ7.js";
|
|
84
|
+
import "../chunk-E2TD6JD2.js";
|
|
85
|
+
import "../chunk-F42SGQNW.js";
|
|
86
|
+
import "../chunk-L4Z7MNYY.js";
|
|
87
|
+
import "../chunk-WKJUCGV4.js";
|
|
86
88
|
export {
|
|
87
89
|
Accordion,
|
|
88
90
|
Alert,
|
|
@@ -97,6 +99,7 @@ export {
|
|
|
97
99
|
Card,
|
|
98
100
|
Carousel,
|
|
99
101
|
Chart,
|
|
102
|
+
ChatInput,
|
|
100
103
|
Checkbox,
|
|
101
104
|
Collapsible,
|
|
102
105
|
Combobox,
|
|
@@ -104,6 +107,7 @@ export {
|
|
|
104
107
|
Content,
|
|
105
108
|
ContextMenu,
|
|
106
109
|
DataTable,
|
|
110
|
+
DatePicker,
|
|
107
111
|
Dialog,
|
|
108
112
|
Drawer,
|
|
109
113
|
DropdownMenu,
|