dishui 0.0.81 → 0.0.83

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.
Files changed (87) hide show
  1. package/dist/components/Accordion/index.js +6 -6
  2. package/dist/components/Accordion/index.js.map +1 -1
  3. package/dist/components/Button/index.d.ts +1 -0
  4. package/dist/components/Button/index.js.map +1 -1
  5. package/dist/components/ButtonMenu/index.d.ts +28 -0
  6. package/dist/components/ButtonMenu/index.js +197 -0
  7. package/dist/components/ButtonMenu/index.js.map +1 -0
  8. package/dist/components/Card/index.d.ts +7 -4
  9. package/dist/components/Card/index.js +98 -65
  10. package/dist/components/Card/index.js.map +1 -1
  11. package/dist/components/Demo/index.d.ts +5 -0
  12. package/dist/components/Demo/index.js +131 -56
  13. package/dist/components/Demo/index.js.map +1 -1
  14. package/dist/components/Demo/source.d.ts +9 -0
  15. package/dist/components/Demo/source.js +32 -0
  16. package/dist/components/Demo/source.js.map +1 -0
  17. package/dist/components/EmptyState/index.js +4 -4
  18. package/dist/components/EmptyState/index.js.map +1 -1
  19. package/dist/components/Field/index.d.ts +8 -0
  20. package/dist/components/Field/index.js +43 -0
  21. package/dist/components/Field/index.js.map +1 -0
  22. package/dist/components/LayoutSuite/DashboardSuite.d.ts +35 -0
  23. package/dist/components/LayoutSuite/DashboardSuite.js +61 -0
  24. package/dist/components/LayoutSuite/DashboardSuite.js.map +1 -0
  25. package/dist/components/LayoutSuite/index.d.ts +56 -0
  26. package/dist/components/LayoutSuite/index.js +101 -0
  27. package/dist/components/LayoutSuite/index.js.map +1 -0
  28. package/dist/components/List/index.js +5 -5
  29. package/dist/components/List/index.js.map +1 -1
  30. package/dist/components/Modal/focusScope.d.ts +1 -0
  31. package/dist/components/Modal/focusScope.js +81 -0
  32. package/dist/components/Modal/focusScope.js.map +1 -0
  33. package/dist/components/Modal/index.d.ts +4 -1
  34. package/dist/components/Modal/index.js +53 -48
  35. package/dist/components/Modal/index.js.map +1 -1
  36. package/dist/components/Page/Float.d.ts +14 -0
  37. package/dist/components/Page/Float2.js +154 -0
  38. package/dist/components/Page/Float2.js.map +1 -0
  39. package/dist/components/Page/index.d.ts +18 -5
  40. package/dist/components/Page/index.js +103 -34
  41. package/dist/components/Page/index.js.map +1 -1
  42. package/dist/components/Page/resize.d.ts +28 -0
  43. package/dist/components/Page/resize2.js +95 -0
  44. package/dist/components/Page/resize2.js.map +1 -0
  45. package/dist/components/PageHeader/index.d.ts +10 -3
  46. package/dist/components/PageHeader/index.js +46 -25
  47. package/dist/components/PageHeader/index.js.map +1 -1
  48. package/dist/components/PagePanel/index.d.ts +29 -0
  49. package/dist/components/PagePanel/index.js +99 -0
  50. package/dist/components/PagePanel/index.js.map +1 -0
  51. package/dist/components/Resizable/ResizeGrip.d.ts +5 -0
  52. package/dist/components/Resizable/ResizeGrip.js +14 -0
  53. package/dist/components/Resizable/ResizeGrip.js.map +1 -0
  54. package/dist/components/Resizable/index.js +57 -59
  55. package/dist/components/Resizable/index.js.map +1 -1
  56. package/dist/components/Resizable/useResize.d.ts +6 -0
  57. package/dist/components/Resizable/useResize.js +29 -28
  58. package/dist/components/Resizable/useResize.js.map +1 -1
  59. package/dist/components/SidebarToggleButton/index.d.ts +5 -3
  60. package/dist/components/SidebarToggleButton/index.js +24 -21
  61. package/dist/components/SidebarToggleButton/index.js.map +1 -1
  62. package/dist/components/Table/index.d.ts +10 -12
  63. package/dist/components/Table/index.js +25 -20
  64. package/dist/components/Table/index.js.map +1 -1
  65. package/dist/components/Text/index.d.ts +1 -1
  66. package/dist/components/Text/index.js +11 -10
  67. package/dist/components/Text/index.js.map +1 -1
  68. package/dist/components/Textarea/index.d.ts +14 -0
  69. package/dist/components/Textarea/index.js +44 -0
  70. package/dist/components/Textarea/index.js.map +1 -0
  71. package/dist/components/Tree/Tree.d.ts +2 -0
  72. package/dist/components/Tree/Tree.js +49 -40
  73. package/dist/components/Tree/Tree.js.map +1 -1
  74. package/dist/dishui.css +1 -1
  75. package/dist/index-nostyled.d.ts +9 -0
  76. package/dist/index.d.ts +11 -2
  77. package/dist/index.js +119 -113
  78. package/dist/layouts/Sidebar.d.ts +12 -1
  79. package/dist/layouts/Sidebar.js +121 -97
  80. package/dist/layouts/Sidebar.js.map +1 -1
  81. package/dist/lite.d.ts +10 -2
  82. package/dist/lite.js +17 -12
  83. package/dist/styles/themeStyles.js +6 -6
  84. package/dist/styles/themeStyles.js.map +1 -1
  85. package/dist/utils/menu.js +14 -16
  86. package/dist/utils/menu.js.map +1 -1
  87. package/package.json +3 -1
@@ -0,0 +1,154 @@
1
+ import { cn as e } from "../../utils/cn.js";
2
+ /* empty css */
3
+ import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
4
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
5
+ //#region src/components/Page/Float.tsx
6
+ function c({ title: c = "Float", collapsed: l, defaultCollapsed: u = !1, onCollapsedChange: d, defaultPosition: f = {
7
+ x: 16,
8
+ y: 16
9
+ }, draggable: p = !0, className: m, style: h, children: g, ..._ }) {
10
+ let [v, y] = i(u), b = l ?? v, [x, S] = i(f), C = r(null), w = r(null), T = r(null), E = r(!1), D = t((e) => {
11
+ let t = C.current, n = t?.offsetParent;
12
+ return !t || !n ? e : {
13
+ x: Math.max(0, Math.min(e.x, n.clientWidth - t.offsetWidth)),
14
+ y: Math.max(0, Math.min(e.y, n.clientHeight - t.offsetHeight))
15
+ };
16
+ }, []);
17
+ n(() => {
18
+ let e = () => S((e) => {
19
+ let t = D(e);
20
+ return t.x === e.x && t.y === e.y ? e : t;
21
+ });
22
+ e();
23
+ let t = new ResizeObserver(e);
24
+ return C.current && t.observe(C.current), C.current?.offsetParent && t.observe(C.current.offsetParent), () => t.disconnect();
25
+ }, [D, b]);
26
+ let O = () => {
27
+ y(!b), d?.(!b), w.current?.focus();
28
+ }, k = {
29
+ onPointerDown: (e) => {
30
+ E.current = !1, p && e.button === 0 && (T.current = {
31
+ id: e.pointerId,
32
+ x: e.clientX,
33
+ y: e.clientY,
34
+ origin: x,
35
+ moved: !1
36
+ }, e.currentTarget.setPointerCapture(e.pointerId));
37
+ },
38
+ onPointerMove: (e) => {
39
+ let t = T.current;
40
+ if (!t || t.id !== e.pointerId) return;
41
+ let n = e.clientX - t.x, r = e.clientY - t.y;
42
+ Math.abs(n) + Math.abs(r) > 4 && (t.moved = !0), t.moved && S(D({
43
+ x: t.origin.x + n,
44
+ y: t.origin.y + r
45
+ }));
46
+ },
47
+ onPointerUp: (e) => {
48
+ E.current = T.current?.moved ?? !1, T.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId);
49
+ },
50
+ onPointerCancel: () => {
51
+ T.current = null;
52
+ },
53
+ onLostPointerCapture: () => {
54
+ T.current = null;
55
+ },
56
+ onKeyDown: (e) => {
57
+ if (!p) return;
58
+ let t = e.shiftKey ? 32 : 8, n = {
59
+ ArrowLeft: [-t, 0],
60
+ ArrowRight: [t, 0],
61
+ ArrowUp: [0, -t],
62
+ ArrowDown: [0, t]
63
+ }[e.key];
64
+ n && (e.preventDefault(), S((e) => D({
65
+ x: e.x + n[0],
66
+ y: e.y + n[1]
67
+ })));
68
+ }
69
+ };
70
+ return /* @__PURE__ */ s("div", {
71
+ ..._,
72
+ ref: C,
73
+ className: e("dishui-page-float absolute z-30 overflow-hidden border border-base-300 bg-base-100 text-base-content shadow-sm", b ? "rounded-full" : "rounded-lg", m),
74
+ "data-collapsed": b,
75
+ style: {
76
+ width: 288,
77
+ maxWidth: "100%",
78
+ maxHeight: "100%",
79
+ ...h,
80
+ ...b ? {
81
+ boxSizing: "border-box",
82
+ width: 48,
83
+ height: 48,
84
+ minWidth: 48,
85
+ minHeight: 48,
86
+ maxWidth: 48,
87
+ maxHeight: 48,
88
+ padding: 0,
89
+ borderRadius: "50%"
90
+ } : {},
91
+ left: x.x,
92
+ top: x.y
93
+ },
94
+ children: [/* @__PURE__ */ s("div", {
95
+ className: e("flex items-center border-base-300", b && "h-full w-full"),
96
+ children: [!b && /* @__PURE__ */ o("button", {
97
+ type: "button",
98
+ ...k,
99
+ onClick: () => {
100
+ E.current = !1;
101
+ },
102
+ "aria-label": `${c}: move with arrow keys`,
103
+ className: "min-w-0 flex-1 truncate px-3 py-2 text-left text-sm font-medium focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",
104
+ style: {
105
+ touchAction: p ? "none" : void 0,
106
+ cursor: p ? "grab" : void 0
107
+ },
108
+ children: c
109
+ }), /* @__PURE__ */ o("button", {
110
+ ref: w,
111
+ type: "button",
112
+ ...b ? k : {},
113
+ "aria-label": `${b ? "Expand" : "Collapse"} ${c}`,
114
+ "aria-expanded": !b,
115
+ title: `${b ? "Expand" : "Collapse"} ${c}`,
116
+ className: e("dishui-page-float-toggle flex shrink-0 items-center justify-center focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary", b ? "h-full w-full rounded-full" : "h-9 w-9 rounded-md"),
117
+ style: {
118
+ touchAction: b && p ? "none" : void 0,
119
+ cursor: b && p ? "grab" : "pointer"
120
+ },
121
+ onClick: () => {
122
+ E.current || O(), E.current = !1;
123
+ },
124
+ children: /* @__PURE__ */ o("svg", {
125
+ "aria-hidden": "true",
126
+ width: "20",
127
+ height: "20",
128
+ viewBox: "0 0 24 24",
129
+ fill: "none",
130
+ stroke: "currentColor",
131
+ strokeWidth: "1.75",
132
+ strokeLinecap: "round",
133
+ strokeLinejoin: "round",
134
+ children: b ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("rect", {
135
+ x: "4",
136
+ y: "4",
137
+ width: "16",
138
+ height: "16",
139
+ rx: "3"
140
+ }), /* @__PURE__ */ o("path", { d: "M4 10h16M9 4v6" })] }) : /* @__PURE__ */ o("path", { d: "M6 12h12" })
141
+ })
142
+ })]
143
+ }), /* @__PURE__ */ o("div", {
144
+ hidden: b,
145
+ className: "overflow-auto border-t border-base-300 p-3 text-sm",
146
+ style: { maxHeight: "min(60vh, 360px)" },
147
+ children: g
148
+ })]
149
+ });
150
+ }
151
+ //#endregion
152
+ export { c as default };
153
+
154
+ //# sourceMappingURL=Float2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Float2.js","names":[],"sources":["../../../src/components/Page/Float.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { cn } from '../../utils/cn';\nimport './Float.css';\n\nexport type PageFloatProps = React.HTMLAttributes<HTMLDivElement> & {\n title?: string;\n collapsed?: boolean;\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n defaultPosition?: { x: number; y: number };\n draggable?: boolean;\n};\n\n/** Coordinates are relative to the containing Page; dragging is confined to it. */\nexport default function PageFloat({\n title = 'Float', collapsed, defaultCollapsed = false, onCollapsedChange,\n defaultPosition = { x: 16, y: 16 }, draggable = true,\n className, style, children, ...rest\n}: PageFloatProps) {\n const [internalCollapsed, setInternalCollapsed] = useState(defaultCollapsed);\n const isCollapsed = collapsed ?? internalCollapsed;\n const [position, setPosition] = useState(defaultPosition);\n const root = useRef<HTMLDivElement>(null);\n const toggle = useRef<HTMLButtonElement>(null);\n const drag = useRef<{ id: number; x: number; y: number; origin: typeof position; moved: boolean } | null>(null);\n const suppressClick = useRef(false);\n const clamp = useCallback((next: typeof position) => {\n const element = root.current;\n const parent = element?.offsetParent as HTMLElement | null;\n if (!element || !parent) return next;\n return {\n x: Math.max(0, Math.min(next.x, parent.clientWidth - element.offsetWidth)),\n y: Math.max(0, Math.min(next.y, parent.clientHeight - element.offsetHeight)),\n };\n }, []);\n useEffect(() => {\n const update = () => setPosition(current => {\n const next = clamp(current);\n return next.x === current.x && next.y === current.y ? current : next;\n });\n update();\n const observer = new ResizeObserver(update);\n if (root.current) observer.observe(root.current);\n if (root.current?.offsetParent) observer.observe(root.current.offsetParent);\n return () => observer.disconnect();\n }, [clamp, isCollapsed]);\n const changeCollapsed = () => {\n setInternalCollapsed(!isCollapsed);\n onCollapsedChange?.(!isCollapsed);\n toggle.current?.focus();\n };\n const dragEvents = {\n onPointerDown: (event: React.PointerEvent<HTMLButtonElement>) => {\n suppressClick.current = false;\n if (!draggable || event.button !== 0) return;\n drag.current = { id: event.pointerId, x: event.clientX, y: event.clientY, origin: position, moved: false };\n event.currentTarget.setPointerCapture(event.pointerId);\n },\n onPointerMove: (event: React.PointerEvent<HTMLButtonElement>) => {\n const current = drag.current;\n if (!current || current.id !== event.pointerId) return;\n const dx = event.clientX - current.x;\n const dy = event.clientY - current.y;\n if (Math.abs(dx) + Math.abs(dy) > 4) current.moved = true;\n if (current.moved) setPosition(clamp({ x: current.origin.x + dx, y: current.origin.y + dy }));\n },\n onPointerUp: (event: React.PointerEvent<HTMLButtonElement>) => {\n suppressClick.current = drag.current?.moved ?? false;\n drag.current = null;\n if (event.currentTarget.hasPointerCapture(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);\n },\n onPointerCancel: () => { drag.current = null; },\n onLostPointerCapture: () => { drag.current = null; },\n onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (!draggable) return;\n const delta = event.shiftKey ? 32 : 8;\n const offsets: Record<string, [number, number]> = { ArrowLeft: [-delta, 0], ArrowRight: [delta, 0], ArrowUp: [0, -delta], ArrowDown: [0, delta] };\n const offset = offsets[event.key];\n if (!offset) return;\n event.preventDefault();\n setPosition(current => clamp({ x: current.x + offset[0], y: current.y + offset[1] }));\n },\n };\n return (\n <div {...rest} ref={root} className={cn('dishui-page-float absolute z-30 overflow-hidden border border-base-300 bg-base-100 text-base-content shadow-sm', isCollapsed ? 'rounded-full' : 'rounded-lg', className)}\n data-collapsed={isCollapsed}\n style={{ width: 288, maxWidth: '100%', maxHeight: '100%', ...style,\n ...(isCollapsed ? { boxSizing: 'border-box', width: 48, height: 48, minWidth: 48, minHeight: 48, maxWidth: 48, maxHeight: 48, padding: 0, borderRadius: '50%' } as React.CSSProperties : {}),\n left: position.x, top: position.y }}>\n <div className={cn('flex items-center border-base-300', isCollapsed && 'h-full w-full')}>\n {!isCollapsed && <button type=\"button\" {...dragEvents} onClick={() => { suppressClick.current = false; }} aria-label={`${title}: move with arrow keys`} className=\"min-w-0 flex-1 truncate px-3 py-2 text-left text-sm font-medium focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary\" style={{ touchAction: draggable ? 'none' : undefined, cursor: draggable ? 'grab' : undefined }}>{title}</button>}\n <button ref={toggle} type=\"button\" {...(isCollapsed ? dragEvents : {})} aria-label={`${isCollapsed ? 'Expand' : 'Collapse'} ${title}`} aria-expanded={!isCollapsed}\n title={`${isCollapsed ? 'Expand' : 'Collapse'} ${title}`}\n className={cn('dishui-page-float-toggle flex shrink-0 items-center justify-center focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary', isCollapsed ? 'h-full w-full rounded-full' : 'h-9 w-9 rounded-md')}\n style={{ touchAction: isCollapsed && draggable ? 'none' : undefined, cursor: isCollapsed && draggable ? 'grab' : 'pointer' }}\n onClick={() => { if (!suppressClick.current) changeCollapsed(); suppressClick.current = false; }}>\n <svg aria-hidden=\"true\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.75\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n {isCollapsed ? <><rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"3\" /><path d=\"M4 10h16M9 4v6\" /></> : <path d=\"M6 12h12\" />}\n </svg>\n </button>\n </div>\n <div hidden={isCollapsed} className=\"overflow-auto border-t border-base-300 p-3 text-sm\" style={{ maxHeight: 'min(60vh, 360px)' }}>{children}</div>\n </div>\n );\n}\n"],"mappings":";;;;;AAcA,SAAwB,EAAU,EAC9B,WAAQ,SAAS,cAAW,sBAAmB,IAAO,sBACtD,qBAAkB;CAAE,GAAG;CAAI,GAAG;AAAG,GAAG,eAAY,IAChD,cAAW,UAAO,aAAU,GAAG,KAChB;CACf,IAAM,CAAC,GAAmB,KAAwB,EAAS,CAAgB,GACrE,IAAc,KAAa,GAC3B,CAAC,GAAU,KAA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,CAAA,CACjJ;;AAEb"}
@@ -1,5 +1,10 @@
1
1
  import React from 'react';
2
+ import PageFloat from './Float';
3
+ import { type PageResizeProps } from './resize';
4
+ export type { PageFloatProps } from './Float';
2
5
  import { PageHeaderProps } from '../PageHeader';
6
+ import { type PagePanelProps, type PageAutoHideProps } from '../PagePanel';
7
+ export type { PagePanelProps } from '../PagePanel';
3
8
  /**
4
9
  * Page 布局脚手架
5
10
  * ----------------------------------------------------------------------------
@@ -26,8 +31,8 @@ export type PageBodyProps = React.HTMLAttributes<HTMLDivElement> & {
26
31
  /** 是否让主体区在剩余空间内滚动(配合 Page fullHeight 使用) */
27
32
  scroll?: boolean;
28
33
  };
29
- export type PageAsideProps = React.HTMLAttributes<HTMLDivElement> & {
30
- /** 侧栏宽度,数字按 px 处理,默认 260 */
34
+ export type PageAsideProps = React.HTMLAttributes<HTMLDivElement> & PagePanelProps & PageResizeProps & {
35
+ /** 侧栏宽度,数字按 px 处理;Left 默认 260,Right 默认 320。外部变化会同步到拖动宽度。 */
31
36
  width?: number | string;
32
37
  /** 是否显示分隔边框 */
33
38
  bordered?: boolean;
@@ -43,16 +48,24 @@ export type PageMainProps = React.HTMLAttributes<HTMLDivElement> & {
43
48
  /** 页头:直接复用 PageHeader,作为 Page.Header 使用 */
44
49
  declare const PageHeaderSlot: (props: PageHeaderProps) => React.JSX.Element;
45
50
  declare const PageBody: ({ gap, scroll, className, style, children, ...rest }: PageBodyProps) => React.JSX.Element;
46
- declare const PageLeft: ({ width, bordered, scroll, hideOnMobile, className, style, children, ...rest }: PageAsideProps) => React.JSX.Element;
47
- declare const PageRight: ({ width, bordered, scroll, hideOnMobile, className, style, children, ...rest }: PageAsideProps) => React.JSX.Element;
51
+ declare const PageLeft: ({ resizeVariant, resizable, minWidth, maxWidth, onWidthChange, open, mode, animated, duration, width, bordered, scroll, hideOnMobile, className, style, children, ...rest }: PageAsideProps) => React.JSX.Element;
52
+ declare const PageRight: ({ resizeVariant, resizable, minWidth, maxWidth, onWidthChange, open, mode, animated, duration, width, bordered, scroll, hideOnMobile, className, style, children, ...rest }: PageAsideProps) => React.JSX.Element;
53
+ export type PageFooterProps = React.HTMLAttributes<HTMLElement> & PagePanelProps & PageAutoHideProps & {
54
+ left?: React.ReactNode;
55
+ center?: React.ReactNode;
56
+ right?: React.ReactNode;
57
+ };
58
+ declare const PageFooter: ({ open, mode, animated, duration, autoHide, className, children, left, center, right, ...rest }: PageFooterProps) => React.JSX.Element;
48
59
  declare const PageMain: ({ scroll, className, children, ...rest }: PageMainProps) => React.JSX.Element;
49
60
  interface PageCompound extends React.FC<PageProps> {
50
61
  Header: typeof PageHeaderSlot;
62
+ Footer: typeof PageFooter;
63
+ Float: typeof PageFloat;
51
64
  Body: typeof PageBody;
52
65
  Left: typeof PageLeft;
53
66
  Right: typeof PageRight;
54
67
  Main: typeof PageMain;
55
68
  }
56
69
  declare const PageWithCompounds: PageCompound;
57
- export { PageBody, PageLeft, PageRight, PageMain };
70
+ export { PageBody, PageLeft, PageRight, PageMain, PageFooter, PageFloat };
58
71
  export default PageWithCompounds;
@@ -1,43 +1,112 @@
1
1
  import { cn as e } from "../../utils/cn.js";
2
- import t from "../PageHeader/index.js";
2
+ import t from "../PagePanel/index.js";
3
+ import n from "../PageHeader/index.js";
4
+ import r from "./Float2.js";
5
+ import i from "./resize2.js";
3
6
  import "react";
4
- import { jsx as n } from "react/jsx-runtime";
7
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
8
  //#region src/components/Page/index.tsx
6
- var r = (e) => typeof e == "number" ? `${e}px` : e, i = ({ fullHeight: t = !1, className: r = "", children: i, ...a }) => /* @__PURE__ */ n("div", {
7
- className: e("dishui-page flex w-full flex-col", t && "h-full min-h-0", r),
8
- ...a,
9
- children: i
10
- }), a = (e) => /* @__PURE__ */ n(t, { ...e }), o = ({ gap: t = 16, scroll: i = !1, className: a = "", style: o, children: s, ...c }) => /* @__PURE__ */ n("div", {
11
- className: e("dishui-page-body flex w-full flex-col md:flex-row", i && "min-h-0 flex-1", a),
9
+ var s = (e) => typeof e == "number" ? `${e}px` : e, c = ({ fullHeight: t = !1, className: n = "", children: r, ...i }) => /* @__PURE__ */ a("div", {
10
+ className: e("dishui-page flex w-full min-w-0 flex-col text-body leading-5 text-base-content", t && "h-full min-h-0", n),
11
+ ...i,
12
+ children: r
13
+ }), l = (e) => /* @__PURE__ */ a(n, { ...e }), u = ({ gap: t = 16, scroll: n = !1, className: r = "", style: i, children: o, ...c }) => /* @__PURE__ */ a("div", {
14
+ className: e("dishui-page-body flex w-full flex-col md:flex-row", n && "min-h-0 flex-1", r),
12
15
  style: {
13
- gap: r(t),
14
- ...o
16
+ ...i,
17
+ gap: 0,
18
+ "--dishui-page-gap": s(i?.gap ?? t)
15
19
  },
16
20
  ...c,
17
- children: s
18
- }), s = ({ width: t = 260, bordered: i = !0, scroll: a = !0, hideOnMobile: o = !1, className: s = "", style: c, children: l, ...u }) => /* @__PURE__ */ n("aside", {
19
- className: e("dishui-page-left w-full shrink-0 md:w-(--dishui-aside-w)", i && "md:border-r md:border-base-300 md:pr-4", a && "md:min-h-0 md:overflow-y-auto", o && "hidden md:block", s),
20
- style: {
21
- "--dishui-aside-w": r(t),
22
- ...c
23
- },
24
- ...u,
25
- children: l
26
- }), c = ({ width: t = 320, bordered: i = !0, scroll: a = !0, hideOnMobile: o = !1, className: s = "", style: c, children: l, ...u }) => /* @__PURE__ */ n("aside", {
27
- className: e("dishui-page-right w-full shrink-0 md:w-(--dishui-aside-w)", i && "md:border-l md:border-base-300 md:pl-4", a && "md:min-h-0 md:overflow-y-auto", o && "hidden md:block", s),
28
- style: {
29
- "--dishui-aside-w": r(t),
30
- ...c
31
- },
32
- ...u,
33
- children: l
34
- }), l = ({ scroll: t = !1, className: r = "", children: i, ...a }) => /* @__PURE__ */ n("main", {
35
- className: e("dishui-page-main min-w-0 flex-1", t && "min-h-0 overflow-y-auto", r),
36
- ...a,
37
- children: i
38
- }), u = i;
39
- u.Header = a, u.Body = o, u.Left = s, u.Right = c, u.Main = l;
21
+ children: o
22
+ }), d = ({ resizeVariant: n = "pill", resizable: r = !1, minWidth: o = 160, maxWidth: c = 600, onWidthChange: l, open: u, mode: d, animated: f, duration: p, width: m = 260, bordered: h = !0, scroll: g = !0, hideOnMobile: _ = !1, className: v = "", style: y, children: b, ...x }) => {
23
+ let S = /* @__PURE__ */ a(t, {
24
+ edge: "left",
25
+ width: y?.width ?? m,
26
+ hideOnMobile: _,
27
+ open: u,
28
+ mode: d,
29
+ animated: f,
30
+ duration: p,
31
+ children: /* @__PURE__ */ a("aside", {
32
+ className: e("dishui-page-left w-full shrink-0 md:w-(--dishui-aside-w)", h && "md:border-r md:border-base-300 md:pr-4", g && "md:min-h-0 md:overflow-y-auto", _ && "hidden md:block", v),
33
+ style: {
34
+ "--dishui-aside-w": s(m),
35
+ ...y
36
+ },
37
+ ...x,
38
+ children: b
39
+ })
40
+ });
41
+ return r ? /* @__PURE__ */ a(i, {
42
+ panel: S,
43
+ resizeVariant: n,
44
+ minWidth: o,
45
+ maxWidth: c,
46
+ onWidthChange: l
47
+ }) : S;
48
+ }, f = ({ resizeVariant: n = "pill", resizable: r = !1, minWidth: o = 160, maxWidth: c = 600, onWidthChange: l, open: u, mode: d, animated: f, duration: p, width: m = 320, bordered: h = !0, scroll: g = !0, hideOnMobile: _ = !1, className: v = "", style: y, children: b, ...x }) => {
49
+ let S = /* @__PURE__ */ a(t, {
50
+ edge: "right",
51
+ width: y?.width ?? m,
52
+ hideOnMobile: _,
53
+ open: u,
54
+ mode: d,
55
+ animated: f,
56
+ duration: p,
57
+ children: /* @__PURE__ */ a("aside", {
58
+ className: e("dishui-page-right w-full shrink-0 md:w-(--dishui-aside-w)", h && "md:border-l md:border-base-300 md:pl-4", g && "md:min-h-0 md:overflow-y-auto", _ && "hidden md:block", v),
59
+ style: {
60
+ "--dishui-aside-w": s(m),
61
+ ...y
62
+ },
63
+ ...x,
64
+ children: b
65
+ })
66
+ });
67
+ return r ? /* @__PURE__ */ a(i, {
68
+ panel: S,
69
+ resizeVariant: n,
70
+ minWidth: o,
71
+ maxWidth: c,
72
+ onWidthChange: l
73
+ }) : S;
74
+ }, p = ({ open: n, mode: r, animated: i, duration: s, autoHide: c, className: l, children: u, left: d, center: f, right: p, ...m }) => /* @__PURE__ */ a(t, {
75
+ edge: "footer",
76
+ autoHide: c,
77
+ open: n,
78
+ mode: r,
79
+ animated: i,
80
+ duration: s,
81
+ children: /* @__PURE__ */ a("footer", {
82
+ className: e("dishui-page-footer", l),
83
+ ...m,
84
+ children: u === void 0 ? /* @__PURE__ */ o("div", {
85
+ className: "dishui-page-header-layout",
86
+ "data-centered": f != null && f !== !1 || void 0,
87
+ children: [
88
+ d != null && /* @__PURE__ */ a("div", {
89
+ className: "dishui-page-header-left",
90
+ children: d
91
+ }),
92
+ f != null && /* @__PURE__ */ a("div", {
93
+ className: "dishui-page-header-center",
94
+ children: f
95
+ }),
96
+ p != null && /* @__PURE__ */ a("div", {
97
+ className: "dishui-page-header-right",
98
+ children: p
99
+ })
100
+ ]
101
+ }) : u
102
+ })
103
+ }), m = ({ scroll: t = !1, className: n = "", children: r, ...i }) => /* @__PURE__ */ a("main", {
104
+ className: e("dishui-page-main min-w-0 flex-1", t && "min-h-0 overflow-y-auto", n),
105
+ ...i,
106
+ children: r
107
+ }), h = c;
108
+ h.Header = l, h.Footer = p, h.Float = r, h.Body = u, h.Left = d, h.Right = f, h.Main = m;
40
109
  //#endregion
41
- export { o as PageBody, s as PageLeft, l as PageMain, c as PageRight, u as default };
110
+ export { u as PageBody, r as PageFloat, p as PageFooter, d as PageLeft, m as PageMain, f as PageRight, h as default };
42
111
 
43
112
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Page/index.tsx"],"sourcesContent":["import React from 'react';\nimport PageHeader, { PageHeaderProps } from '../PageHeader';\nimport { cn } from '../../utils/cn';\n\n/**\n * Page 布局脚手架\n * ----------------------------------------------------------------------------\n * 为管理后台等页面提供统一的「页头 + 主体 + 左右侧栏」骨架,配合 PageHeader、\n * Card.Info 等组件使用。所有区域都是可选的,可按需组合。\n *\n * 典型结构:\n * <Page fullHeight>\n * <Page.Header title=\"用户管理\" actions={<Button>新建</Button>} />\n * <Page.Body scroll>\n * <Page.Left width={240}>筛选器</Page.Left>\n * <Page.Main scroll>主内容</Page.Main>\n * <Page.Right width={320}>详情</Page.Right>\n * </Page.Body>\n * </Page>\n */\n\nexport type PageProps = React.HTMLAttributes<HTMLDivElement> & {\n /** 是否占满父容器高度并启用内部滚动(主体区滚动,页头固定) */\n fullHeight?: boolean;\n};\n\nexport type PageBodyProps = React.HTMLAttributes<HTMLDivElement> & {\n /** 主体内的间距(left/main/right 之间),数字按 px 处理,默认 16 */\n gap?: number | string;\n /** 是否让主体区在剩余空间内滚动(配合 Page fullHeight 使用) */\n scroll?: boolean;\n};\n\nexport type PageAsideProps = React.HTMLAttributes<HTMLDivElement> & {\n /** 侧栏宽度,数字按 px 处理,默认 260 */\n width?: number | string;\n /** 是否显示分隔边框 */\n bordered?: boolean;\n /** 侧栏内部纵向滚动自适应 */\n scroll?: boolean;\n /** 小屏(<768px)下是否隐藏(侧栏通常在移动端折叠) */\n hideOnMobile?: boolean;\n};\n\nexport type PageMainProps = React.HTMLAttributes<HTMLDivElement> & {\n /** 主内容区是否在剩余空间内纵向滚动 */\n scroll?: boolean;\n};\n\nconst toCssSize = (value: number | string | undefined): string | undefined =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst Page = ({ fullHeight = false, className = '', children, ...rest }: PageProps) => (\n <div\n className={cn(\n 'dishui-page flex w-full flex-col',\n fullHeight && 'h-full min-h-0',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n);\n\n/** 页头:直接复用 PageHeader,作为 Page.Header 使用 */\nconst PageHeaderSlot = (props: PageHeaderProps) => <PageHeader {...props} />;\n\nconst PageBody = ({ gap = 16, scroll = false, className = '', style, children, ...rest }: PageBodyProps) => (\n <div\n className={cn(\n 'dishui-page-body flex w-full flex-col md:flex-row',\n scroll && 'min-h-0 flex-1',\n className,\n )}\n style={{ gap: toCssSize(gap), ...style }}\n {...rest}\n >\n {children}\n </div>\n);\n\nconst PageLeft = ({\n width = 260,\n bordered = true,\n scroll = true,\n hideOnMobile = false,\n className = '',\n style,\n children,\n ...rest\n}: PageAsideProps) => (\n <aside\n className={cn(\n 'dishui-page-left w-full shrink-0 md:w-(--dishui-aside-w)',\n bordered && 'md:border-r md:border-base-300 md:pr-4',\n scroll && 'md:min-h-0 md:overflow-y-auto',\n hideOnMobile && 'hidden md:block',\n className,\n )}\n style={{ ['--dishui-aside-w' as string]: toCssSize(width), ...style }}\n {...rest}\n >\n {children}\n </aside>\n);\n\nconst PageRight = ({\n width = 320,\n bordered = true,\n scroll = true,\n hideOnMobile = false,\n className = '',\n style,\n children,\n ...rest\n}: PageAsideProps) => (\n <aside\n className={cn(\n 'dishui-page-right w-full shrink-0 md:w-(--dishui-aside-w)',\n bordered && 'md:border-l md:border-base-300 md:pl-4',\n scroll && 'md:min-h-0 md:overflow-y-auto',\n hideOnMobile && 'hidden md:block',\n className,\n )}\n style={{ ['--dishui-aside-w' as string]: toCssSize(width), ...style }}\n {...rest}\n >\n {children}\n </aside>\n);\n\nconst PageMain = ({ scroll = false, className = '', children, ...rest }: PageMainProps) => (\n <main\n className={cn(\n 'dishui-page-main min-w-0 flex-1',\n scroll && 'min-h-0 overflow-y-auto',\n className,\n )}\n {...rest}\n >\n {children}\n </main>\n);\n\ninterface PageCompound extends React.FC<PageProps> {\n Header: typeof PageHeaderSlot;\n Body: typeof PageBody;\n Left: typeof PageLeft;\n Right: typeof PageRight;\n Main: typeof PageMain;\n}\n\nconst PageWithCompounds = Page as PageCompound;\nPageWithCompounds.Header = PageHeaderSlot;\nPageWithCompounds.Body = PageBody;\nPageWithCompounds.Left = PageLeft;\nPageWithCompounds.Right = PageRight;\nPageWithCompounds.Main = PageMain;\n\nexport { PageBody, PageLeft, P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AkB,OAAO,GACzB,EAAkB,OAAO,GACzB,EAAkB,QAAQ,GAC1B,EAAkB,OAAO"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Page/index.tsx"],"sourcesContent":["import React from 'react';\nimport PageFloat from './Float';\nimport ResizableAside, { type PageResizeProps } from './resize';\nexport type { PageFloatProps } from './Float';\nimport PageHeader, { PageHeaderProps } from '../PageHeader';\nimport { cn } from '../../utils/cn';\nimport PagePanel, { type PagePanelProps, type PageAutoHideProps } from '../PagePanel';\n\nexport type { PagePanelProps } from '../PagePanel';\n\n/**\n * Page 布局脚手架\n * ----------------------------------------------------------------------------\n * 为管理后台等页面提供统一的「页头 + 主体 + 左右侧栏」骨架,配合 PageHeader、\n * Card.Info 等组件使用。所有区域都是可选的,可按需组合。\n *\n * 典型结构:\n * <Page fullHeight>\n * <Page.Header title=\"用户管理\" actions={<Button>新建</Button>} />\n * <Page.Body scroll>\n * <Page.Left width={240}>筛选器</Page.Left>\n * <Page.Main scroll>主内容</Page.Main>\n * <Page.Right width={320}>详情</Page.Right>\n * </Page.Body>\n * </Page>\n */\n\nexport type PageProps = React.HTMLAttributes<HTMLDivElement> & {\n /** 是否占满父容器高度并启用内部滚动(主体区滚动,页头固定) */\n fullHeight?: boolean;\n};\n\nexport type PageBodyProps = React.HTMLAttributes<HTMLDivElement> & {\n /** 主体内的间距(left/main/right 之间),数字按 px 处理,默认 16 */\n gap?: number | string;\n /** 是否让主体区在剩余空间内滚动(配合 Page fullHeight 使用) */\n scroll?: boolean;\n};\n\nexport type PageAsideProps = React.HTMLAttributes<HTMLDivElement> & PagePanelProps & PageResizeProps & {\n /** 侧栏宽度,数字按 px 处理;Left 默认 260,Right 默认 320。外部变化会同步到拖动宽度。 */\n width?: number | string;\n /** 是否显示分隔边框 */\n bordered?: boolean;\n /** 侧栏内部纵向滚动自适应 */\n scroll?: boolean;\n /** 小屏(<768px)下是否隐藏(侧栏通常在移动端折叠) */\n hideOnMobile?: boolean;\n};\n\nexport type PageMainProps = React.HTMLAttributes<HTMLDivElement> & {\n /** 主内容区是否在剩余空间内纵向滚动 */\n scroll?: boolean;\n};\n\nconst toCssSize = (value: number | string | undefined): string | undefined =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst Page = ({ fullHeight = false, className = '', children, ...rest }: PageProps) => (\n <div\n className={cn(\n 'dishui-page flex w-full min-w-0 flex-col text-body leading-5 text-base-content',\n fullHeight && 'h-full min-h-0',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n);\n\n/** 页头:直接复用 PageHeader,作为 Page.Header 使用 */\nconst PageHeaderSlot = (props: PageHeaderProps) => <PageHeader {...props} />;\n\nconst PageBody = ({ gap = 16, scroll = false, className = '', style, children, ...rest }: PageBodyProps) => (\n <div\n className={cn(\n 'dishui-page-body flex w-full flex-col md:flex-row',\n scroll && 'min-h-0 flex-1',\n className,\n )}\n style={{ ...style, gap: 0, ['--dishui-page-gap' as string]: toCssSize(style?.gap ?? gap) }}\n {...rest}\n >\n {children}\n </div>\n);\n\nconst PageLeft = ({\n resizeVariant = 'pill', resizable = false, minWidth = 160, maxWidth = 600, onWidthChange,\n open, mode, animated, duration,\n width = 260,\n bordered = true,\n scroll = true,\n hideOnMobile = false,\n className = '',\n style,\n children,\n ...rest\n}: PageAsideProps) => {\n const panel = <PagePanel edge=\"left\" width={style?.width ?? width} hideOnMobile={hideOnMobile} open={open} mode={mode} animated={animated} duration={duration}>\n <aside\n className={cn(\n 'dishui-page-left w-full shrink-0 md:w-(--dishui-aside-w)',\n bordered && 'md:border-r md:border-base-300 md:pr-4',\n scroll && 'md:min-h-0 md:overflow-y-auto',\n hideOnMobile && 'hidden md:block',\n className,\n )}\n style={{ ['--dishui-aside-w' as string]: toCssSize(width), ...style }}\n {...rest}\n >\n {children}\n </aside>\n </PagePanel>;\n return resizable ? <ResizableAside panel={panel} resizeVariant={resizeVariant} minWidth={minWidth} maxWidth={maxWidth} onWidthChange={onWidthChange} /> : panel;\n};\n\nconst PageRight = ({\n resizeVariant = 'pill', resizable = false, minWidth = 160, maxWidth = 600, onWidthChange,\n open, mode, animated, duration,\n width = 320,\n bordered = true,\n scroll = true,\n hideOnMobile = false,\n className = '',\n style,\n children,\n ...rest\n}: PageAsideProps) => {\n const panel = <PagePanel edge=\"right\" width={style?.width ?? width} hideOnMobile={hideOnMobile} open={open} mode={mode} animated={animated} duration={duration}>\n <aside\n className={cn(\n 'dishui-page-right w-full shrink-0 md:w-(--dishui-aside-w)',\n bordered && 'md:border-l md:border-base-300 md:pl-4',\n scroll && 'md:min-h-0 md:overflow-y-auto',\n hideOnMobile && 'hidden md:block',\n className,\n )}\n style={{ ['--dishui-aside-w' as string]: toCssSize(width), ...style }}\n {...rest}\n >\n {children}\n </aside>\n </PagePanel>;\n return resizable ? <ResizableAside panel={panel} resizeVariant={resizeVariant} minWidth={minWidth} maxWidth={maxWidth} onWidthChange={onWidthChange} /> : panel;\n};\n\nexport type PageFooterProps = React.HTMLAttributes<HTMLElement> & PagePanelProps & PageAutoHideProps & {\n left?: React.ReactNode;\n center?: React.ReactNode;\n right?: React.ReactNode;\n};\n\nconst PageFooter = ({\n open, mode, animated, duration, autoHide, className, children, left, center, right, ...rest\n}: PageFooterProps) => (\n <PagePanel edge=\"footer\" autoHide={autoHide} open={open} mode={mode} animated={animated} duration={duration}>\n <footer className={cn('dishui-page-footer', className)} {...rest}>\n {children !== undefined ? children : (\n <div className=\"dishui-page-header-layout\" data-centered={center != null && center !== false || undefined}>\n {left != null && <div className=\"dishui-page-header-left\">{left}</div>}\n {center != null && <div className=\"dishui-page-header-center\">{center}</div>}\n {right != null && <div className=\"dishui-page-header-right\">{right}</div>}\n </div>\n )}\n </footer>\n </PagePanel>\n);\n\nconst PageMain = ({ scroll = false, className = '', children, ...rest }: PageMainProps) => (\n <main\n className={cn(\n 'dishui-page-main min-w-0 flex-1',\n scroll && 'min-h-0 overflow-y-auto',\n className,\n )}\n {...rest}\n >\n {children}\n </main>\n);\n\ninterface PageCompound extends React.FC<PageProps> {\n Header: typeof PageHeaderSlot;\n Footer: typeof PageFooter;\n Float: typeof PageFloat;\n Body: typeof PageBody;\n Left: typeof PageLeft;\n Right: typeof PageRight;\n Main: typeof PageMain;\n}\n\nconst PageWithCompounds = Page as PageCompound;\nPageWithCompounds.Header = PageHeaderSlot;\nPageWithCompounds.Footer = PageFooter;\nPageWithCompounds.Float = PageFloat;\nPageWithCompounds.Body = PageBody;\nPageWithCompounds.Left = PageLeft;\nPageWithCompounds.Right = PageRight;\nPageWithCompounds.Main = PageMain;\n\nexport { PageBody, PageLeft, PageRight, PageMain, PageFooter, PageFloat };\nexport default PageWithCompounds;\n"],"mappings":";;;;;;;;AAuDA,IAAM,KAAa,MACf,OAAO,KAAU,WAAW,GAAG,EAAM,MAAM,GAEzC,KAAQ,EAAE,gBAAa,IAAO,eAAY,IAAI,aAAU,GAAG,QAC7D,kBAAC,OAAD;CACI,WAAW,EACP,kFACA,KAAc,kBACd,CACJ;CACA,GAAI;CAEH;AACA,CAAA,GAIH,KAAkB,MAA2B,kBAAC,GAAD,EAAY,GAAI,EAAQ,CAAA,GAErE,KAAY,EAAE,SAAM,IAAI,YAAS,IAAO,eAAY,IAAI,UAAO,aAAU,GAAG,QAC9E,kBAAC,OAAD;CACI,WAAW,EACP,qDACA,KAAU,kBACV,CACJ;CACA,OAAO;EAAE,GAAG;EAAO,KAAK;EAAI,qBAAgC,EAAU,GAAO,OAAO,CAAG;CAAE;CACzF,GAAI;CAEH;AACA,CAAA,GAGH,KAAY,EACd,mBAAgB,QAAQ,eAAY,IAAO,cAAW,KAAK,cAAW,KAAK,kBAC3E,SAAM,SAAM,aAAU,aACtB,WAAQ,KACR,cAAW,IACX,YAAS,IACT,kBAAe,IACf,eAAY,IACZ,UACA,aACA,GAAG,QACe;CAClB,IAAM,IAAQ,kBAAC,GAAD;EAAW,MAAK;EAAO,OAAO,GAAO,SAAS;EAAqB;EAAoB;EAAY;EAAgB;EAAoB;EACrJ,UAAA,kBAAC,SAAD;GAC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KAAU,QAAQ,kBAAC,OAAD;KAAK,WAAU;KAA6B,UAAA;IAAY,CAAA;IAC1E,KAAS,QAAQ,kBAAC,OAAD;KAAK,WAAU;KAA4B,UAAA;IAAW,CAAA;GACvE;OALiB;CAOtB,CAAA;AACD,CAAA,GAGT,KAAY,EAAE,YAAS,IAAO,eAAY,IAAI,aAAU,GAAG,QAC7D,kBAAC,QAAD;CACI,WAAW,EACP,mCACA,KAAU,2BACV,CACJ;CACA,GAAI;CAEH;AACC,CAAA,GAaJ,IAAoB;AAC1B,EAAkB,SAAS,GAC3B,EAAkB,SAAS,GAC3B,EAAkB,QAAQ,GAC1B,EAAkB,OAAO,GACzB,EAAkB,OAAO,GACzB,EAAkB,QAAQ,GAC1B,EAAkB,OAAO"}
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import PagePanel from '../PagePanel';
3
+ export type PageResizeProps = {
4
+ /** 启用侧栏宽度调整,默认 false。 */
5
+ resizable?: boolean;
6
+ /** 调宽手柄外观,默认 pill;line 仅显示分隔线。 */
7
+ resizeVariant?: 'pill' | 'line';
8
+ /** 可调整的最小像素宽度,默认 160。 */
9
+ minWidth?: number;
10
+ /** 可调整的最大像素宽度,默认 600。 */
11
+ maxWidth?: number;
12
+ /** 用户调整宽度时触发,参数为像素宽度。 */
13
+ onWidthChange?: (width: number) => void;
14
+ };
15
+ export declare function resizeLimits(min?: number, max?: number): readonly [number, number];
16
+ export declare const clampWidth: (width: number, min: number, max: number) => number;
17
+ type Props = Omit<PageResizeProps, 'resizable'> & {
18
+ panel: React.ReactElement<React.ComponentProps<typeof PagePanel>>;
19
+ };
20
+ /** Keep the legacy aside markup/scroll owner; the separator belongs to the shell. */
21
+ export default function ResizableAside({ panel, minWidth, maxWidth, onWidthChange, resizeVariant }: Props): React.ReactElement<import(".").PagePanelProps & import("../PagePanel").PageAutoHideProps & {
22
+ edge: 'header' | 'footer' | 'left' | 'right';
23
+ width?: number | string;
24
+ hideOnMobile?: boolean;
25
+ children: React.ReactNode;
26
+ resizeHandle?: React.ReactNode;
27
+ }, string | React.JSXElementConstructor<any>>;
28
+ export {};
@@ -0,0 +1,95 @@
1
+ import { useResize as e } from "../Resizable/useResize.js";
2
+ import { ResizeGrip as t } from "../Resizable/ResizeGrip.js";
3
+ /* empty css */
4
+ import n, { useEffect as r, useId as i, useLayoutEffect as a, useRef as o, useState as s } from "react";
5
+ import { jsx as c } from "react/jsx-runtime";
6
+ //#region src/components/Page/resize.tsx
7
+ function l(e = 160, t = 600) {
8
+ let n = Number.isFinite(e) ? Math.max(0, e) : 160;
9
+ return [n, Number.isFinite(t) ? Math.max(n, t) : Math.max(n, 600)];
10
+ }
11
+ var u = (e, t, n) => Math.min(n, Math.max(t, e));
12
+ function d({ panel: d, minWidth: f, maxWidth: p, onWidthChange: m, resizeVariant: h = "pill" }) {
13
+ let { width: g = 260, open: _ = !0, edge: v } = d.props, [y, b] = l(f, p), [x, S] = s({ source: g });
14
+ x.source !== g && S({ source: g });
15
+ let C = o(void 0), [w, T] = s(typeof g == "number" ? u(g, y, b) : y), E = o(null), D = i(), O = d.props.children, k = O.props.id ?? D, A = x.source === g && x.value !== void 0 ? u(x.value, y, b) : typeof g == "number" ? u(g, y, b) : g, j = v === "right" ? -1 : 1, M = e({
16
+ value: typeof A == "number" ? A : w,
17
+ getValue: () => E.current?.getBoundingClientRect().width ?? w,
18
+ min: y,
19
+ max: b,
20
+ disabled: !_,
21
+ getScale: () => j,
22
+ keyboardDirection: j,
23
+ step: 8,
24
+ shiftMultiplier: 4,
25
+ threshold: 0,
26
+ onChange: (e) => P(e)
27
+ }), N = M.cancel;
28
+ a(() => {
29
+ g !== C.current && N();
30
+ }, [g, N]), r(() => {
31
+ let e = window.matchMedia("(min-width: 768px)"), t = () => N();
32
+ return e.addEventListener("change", t), () => {
33
+ e.removeEventListener("change", t), N();
34
+ };
35
+ }, [N]), r(() => {
36
+ _ || N();
37
+ }, [_, N]), a(() => {
38
+ let e = E.current;
39
+ if (!e) return;
40
+ let t = () => {
41
+ window.matchMedia("(min-width: 768px)").matches && _ && T(u(e.getBoundingClientRect().width, y, b));
42
+ };
43
+ t();
44
+ let n = new ResizeObserver(t);
45
+ return n.observe(e), () => n.disconnect();
46
+ }, [
47
+ y,
48
+ b,
49
+ _
50
+ ]);
51
+ let P = (e) => {
52
+ let t = u(e, y, b);
53
+ t !== (E.current?.getBoundingClientRect().width ?? w) && (C.current = t, S({
54
+ source: g,
55
+ value: t
56
+ }), T(t), m?.(t));
57
+ }, F = () => _ && window.matchMedia("(min-width: 768px)").matches, I = /* @__PURE__ */ c("div", {
58
+ className: "dishui-resize-handle dishui-page-resize-handle",
59
+ "data-orientation": "horizontal",
60
+ "data-variant": h,
61
+ "data-dragging": M.dragging || void 0,
62
+ role: "separator",
63
+ tabIndex: _ ? 0 : -1,
64
+ "aria-label": v === "right" ? "Resize right panel" : "Resize left panel",
65
+ "aria-orientation": "vertical",
66
+ "aria-controls": k,
67
+ "aria-valuemin": y,
68
+ "aria-valuemax": b,
69
+ "aria-valuenow": typeof A == "number" ? A : w,
70
+ onPointerDown: (e) => {
71
+ F() && (e.preventDefault(), M.onPointerDown(e));
72
+ },
73
+ onClickCapture: M.onClickCapture,
74
+ onKeyDown: (e) => {
75
+ F() && M.onKeyDown(e);
76
+ },
77
+ children: /* @__PURE__ */ c(t, { variant: h })
78
+ });
79
+ return n.cloneElement(d, {
80
+ width: typeof A == "string" ? `clamp(${y}px, ${A}, ${b}px)` : A,
81
+ resizeHandle: I
82
+ }, n.cloneElement(O, {
83
+ ref: E,
84
+ id: k,
85
+ style: {
86
+ ...O.props.style,
87
+ width: void 0,
88
+ "--dishui-aside-w": typeof A == "number" ? `${A}px` : A
89
+ }
90
+ }));
91
+ }
92
+ //#endregion
93
+ export { u as clampWidth, d as default, l as resizeLimits };
94
+
95
+ //# sourceMappingURL=resize2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resize2.js","names":[],"sources":["../../../src/components/Page/resize.tsx"],"sourcesContent":["import React, { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';\nimport PagePanel from '../PagePanel';\nimport { useResize } from '../Resizable/useResize';\nimport { ResizeGrip } from '../Resizable/ResizeGrip';\nimport './resize.css';\n\nexport type PageResizeProps = {\n /** 启用侧栏宽度调整,默认 false。 */\n resizable?: boolean;\n /** 调宽手柄外观,默认 pill;line 仅显示分隔线。 */\n resizeVariant?: 'pill' | 'line';\n /** 可调整的最小像素宽度,默认 160。 */\n minWidth?: number;\n /** 可调整的最大像素宽度,默认 600。 */\n maxWidth?: number;\n /** 用户调整宽度时触发,参数为像素宽度。 */\n onWidthChange?: (width: number) => void;\n};\n\nexport function resizeLimits(min = 160, max = 600) {\n const lower = Number.isFinite(min) ? Math.max(0, min) : 160;\n return [lower, Number.isFinite(max) ? Math.max(lower, max) : Math.max(lower, 600)] as const;\n}\n\nexport const clampWidth = (width: number, min: number, max: number) => Math.min(max, Math.max(min, width));\n\ntype Props = Omit<PageResizeProps, 'resizable'> & {\n panel: React.ReactElement<React.ComponentProps<typeof PagePanel>>;\n};\n\n/** Keep the legacy aside markup/scroll owner; the separator belongs to the shell. */\nexport default function ResizableAside({ panel, minWidth, maxWidth, onWidthChange, resizeVariant = 'pill' }: Props) {\n const { width = 260, open = true, edge } = panel.props;\n const [min, max] = resizeLimits(minWidth, maxWidth);\n const [local, setLocal] = useState<{ source: number | string; value?: number }>({ source: width });\n // Reset on prop changes, not on every parent render or callback notification.\n if (local.source !== width) setLocal({ source: width });\n const lastRequestedWidth = useRef<number | undefined>(undefined);\n const [measured, setMeasured] = useState(typeof width === 'number' ? clampWidth(width, min, max) : min);\n const asideRef = useRef<HTMLElement>(null);\n\n const generatedId = useId();\n const aside = panel.props.children as React.ReactElement<React.HTMLAttributes<HTMLElement>>;\n const id = aside.props.id ?? generatedId;\n const effective = local.source === width && local.value !== undefined ? clampWidth(local.value, min, max)\n : typeof width === 'number' ? clampWidth(width, min, max) : width;\n const direction = edge === 'right' ? -1 : 1;\n\n const resize = useResize({\n value: typeof effective === 'number' ? effective : measured,\n getValue: () => asideRef.current?.getBoundingClientRect().width ?? measured,\n min, max, disabled: !open,\n getScale: () => direction,\n keyboardDirection: direction,\n step: 8, shiftMultiplier: 4, threshold: 0,\n onChange: value => change(value),\n });\n const stop = resize.cancel;\n\n // Parent feedback acknowledges the drag; unrelated external changes cancel it.\n useLayoutEffect(() => {\n if (width !== lastRequestedWidth.current) stop();\n }, [width, stop]);\n useEffect(() => {\n const media = window.matchMedia('(min-width: 768px)');\n const cancel = () => stop();\n media.addEventListener('change', cancel);\n return () => { media.removeEventListener('change', cancel); stop(); };\n }, [stop]);\n useEffect(() => { if (!open) stop(); }, [open, stop]);\n useLayoutEffect(() => {\n const element = asideRef.current;\n if (!element) return;\n const measure = () => {\n if (window.matchMedia('(min-width: 768px)').matches && open) {\n setMeasured(clampWidth(element.getBoundingClientRect().width, min, max));\n }\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [min, max, open]);\n\n const change = (value: number) => {\n const next = clampWidth(value, min, max);\n const current = asideRef.current?.getBoundingClientRect().width ?? measured;\n if (next === current) return;\n lastRequestedWidth.current = next;\n setLocal({ source: width, value: next });\n setMeasured(next);\n onWidthChange?.(next);\n };\n const enabled = () => open && window.matchMedia('(min-width: 768px)').matches;\n const handle = <div\n className=\"dishui-resize-handle dishui-page-resize-handle\"\n data-orientation=\"horizontal\"\n data-variant={resizeVariant}\n data-dragging={resize.dragging || undefined}\n role=\"separator\"\n tabIndex={open ? 0 : -1}\n aria-label={edge === 'right' ? 'Resize right panel' : 'Resize left panel'}\n aria-orientation=\"vertical\"\n aria-controls={id}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={typeof effective === 'number' ? effective : measured}\n onPointerDown={event => {\n if (!enabled()) return;\n event.preventDefault();\n resize.onPointerDown(event);\n }}\n onClickCapture={resize.onClickCapture}\n onKeyDown={event => {\n if (!enabled()) return;\n resize.onKeyDown(event);\n }}\n ><ResizeGrip variant={resizeVariant} /></div>;\n return React.cloneElement(panel, {\n width: typeof effective === 'string' ? `clamp(${min}px, ${effective}, ${max}px)` : effective,\n resizeHandle: handle,\n },\n React.cloneElement(aside as React.ReactElement<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>, {\n ref: asideRef,\n id,\n style: { ...aside.props.style, width: undefined, '--dishui-aside-w': typeof effective === 'number' ? `${effective}px` : effective } as React.CSSProperties,\n }));\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,EAAa,IAAM,KAAK,IAAM,KAAK;CAC/C,IAAM,IAAQ,OAAO,SAAS,CAAG,IAAI,KAAK,IAAI,GAAG,CAAG,IAAI;CACxD,OAAO,CAAC,GAAO,OAAO,SAAS,CAAG,IAAI,KAAK,IAAI,GAAO,CAAG,IAAI,KAAK,IAAI,GAAO,GAAG,CAAC;AACrF;AAEA,IAAa,KAAc,GAAe,GAAa,MAAgB,KAAK,IAAI,GAAK,KAAK,IAAI,GAAK,CAAK,CAAC;AAOzG,SAAwB,EAAe,EAAE,UAAO,aAAU,aAAU,kBAAe,mBAAgB,UAAiB;CAChH,IAAM,EAAE,WAAQ,KAAK,UAAO,IAAM,YAAS,EAAM,OAC3C,CAAC,GAAK,KAAO,EAAa,GAAU,CAAQ,GAC5C,CAAC,GAAO,KAAY,EAAsD,EAAE,QAAQ,EAAM,CAAC;CAEjG,AAAI,EAAM,WAAW,KAAO,EAAS,EAAE,QAAQ,EAAM,CAAC;CACtD,IAAM,IAAqB,EAA2B,KAAA,CAAS,GACzD,CAAC,GAAU,KAAe,EAAS,OAAO,KAAU,WAAW,EAAW,GAAO,GAAK,CAAG,IAAI,CAAG,GAChG,IAAW,EAAoB,IAAI,GAEnC,IAAc,EAAM,GACpB,IAAQ,EAAM,MAAM,UACpB,IAAK,EAAM,MAAM,MAAM,GACvB,IAAY,EAAM,WAAW,KAAS,EAAM,UAAU,KAAA,IAAY,EAAW,EAAM,OAAO,GAAK,CAAG,IAClG,OAA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AO;EAAK,CAAC,GACvC,EAAY,CAAI,GAChB,IAAgB,CAAI;CACxB,GACM,UAAgB,KAAQ,OAAO,WAAW,oBAAoB,CAAC,CAAC,SAChE,IAAS,kBAAC,OAAD;EACX,WAAU;EACV,oBAAiB;EACjB,gBAAc;EACd,iBAAe,EAAO,YAAY,KAAA;EAClC,MAAK;EACL,UAAU,IAAO,IAAI;EACrB,cAAY,MAAS,UAAU,uBAAuB;EACtD,oBAAiB;EACjB,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,iBAAe,OAAO,KAAc,WAAW,IAAY;EAC3D,gBAAe,MAAS;GACf,EAAQ,MACb,EAAM,eAAe,GACrB,EAAO,cAAc,CAAK;EAC9B;EACA,gBAAgB,EAAO;EACvB,YAAW,MAAS;GACX,EAAQ,KACb,EAAO,UAAU,CAAK;EAC1B;EACH,UAAA,kBAAC,GAAD,EAAY,SAAS,EAAgB,CAAA;CAAM,CAAA;CAC5C,OAAO,EAAM,aAAa,GAAO;EACzB,OAAO,OAAO,KAAc,WAAW,SAAS,EAAI,MAAM,EAAU,IAAI,EAAI,OAAO;EACnF,cAAc;CAClB,GACA,EAAM,aAAa,GAAmG;EAClH,KAAK;EACL;EACA,OAAO;GAAE,GAAG,EAAM,MAAM;GAAO,OAAO,KAAA;GAAW,oBAAoB,OAAO,KAAc,WAAW,GAAG,EAAU,MAAM;EAAU;CACtI,CAAC,CAAC;AACV"}
@@ -1,7 +1,14 @@
1
1
  import React from 'react';
2
- export type PageHeaderProps = {
2
+ import { type PagePanelProps, type PageAutoHideProps } from '../PagePanel';
3
+ export type PageHeaderProps = PagePanelProps & PageAutoHideProps & {
3
4
  /** 页面标题 */
4
- title: React.ReactNode;
5
+ title?: React.ReactNode;
6
+ /** 覆盖默认图标、标题和描述;null 清空,undefined 使用旧 API。 */
7
+ left?: React.ReactNode;
8
+ /** 相对整个 header 水平居中的内容。 */
9
+ center?: React.ReactNode;
10
+ /** 覆盖 actions;null 清空,undefined 使用 actions。 */
11
+ right?: React.ReactNode;
5
12
  /** 标题下方的描述文字 */
6
13
  description?: React.ReactNode;
7
14
  /** 标题左侧的图标(通常为 lucide 图标) */
@@ -16,5 +23,5 @@ export type PageHeaderProps = {
16
23
  * 页面头部:统一管理后台等页面的标题 / 描述 / 操作区排版。
17
24
  * 相比页面内手写的 `text-3xl` 标题,默认字号更精致(text-lg)。
18
25
  */
19
- declare const PageHeader: ({ title, description, icon, actions, compact, className, }: PageHeaderProps) => React.JSX.Element;
26
+ declare const PageHeader: ({ open, mode, animated, duration, autoHide, title, description, icon, actions, left, center, right, compact, className, }: PageHeaderProps) => React.JSX.Element;
20
27
  export default PageHeader;