@ifhover/leaf-ui 0.16.6 → 0.17.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/dist/cjs/browser/modules/card/card.cjs +29 -14
- package/dist/cjs/browser/modules/card/card.cjs.map +1 -1
- package/dist/cjs/browser/modules/confirm/confirm.cjs +2 -2
- package/dist/cjs/browser/modules/confirm/confirm.cjs.map +1 -1
- package/dist/cjs/browser/modules/drawer/drawer.cjs +120 -61
- package/dist/cjs/browser/modules/drawer/drawer.cjs.map +1 -1
- package/dist/cjs/browser/modules/filelist/filelist.cjs +2 -2
- package/dist/cjs/browser/modules/filelist/filelist.cjs.map +1 -1
- package/dist/cjs/browser/modules/modal/base.cjs +287 -0
- package/dist/cjs/browser/modules/modal/base.cjs.map +1 -0
- package/dist/cjs/browser/modules/modal/modal.cjs +64 -209
- package/dist/cjs/browser/modules/modal/modal.cjs.map +1 -1
- package/dist/cjs/browser/modules/shared/presence.cjs +12 -6
- package/dist/cjs/browser/modules/shared/presence.cjs.map +1 -1
- package/dist/cjs/browser/modules/tabletanstack/tabletanstack.cjs +14 -2
- package/dist/cjs/browser/modules/tabletanstack/tabletanstack.cjs.map +1 -1
- package/dist/cjs/browser/modules/tabs/tabs.cjs +194 -174
- package/dist/cjs/browser/modules/tabs/tabs.cjs.map +1 -1
- package/dist/cjs/card/card.cjs +29 -14
- package/dist/cjs/card/card.cjs.map +1 -1
- package/dist/cjs/card/card.d.cts.map +1 -1
- package/dist/cjs/confirm/confirm.cjs +2 -2
- package/dist/cjs/confirm/confirm.cjs.map +1 -1
- package/dist/cjs/drawer/drawer.cjs +120 -61
- package/dist/cjs/drawer/drawer.cjs.map +1 -1
- package/dist/cjs/drawer/drawer.d.cts +6 -0
- package/dist/cjs/drawer/drawer.d.cts.map +1 -1
- package/dist/cjs/drawer/index.d.cts +1 -1
- package/dist/cjs/drawer/index.d.cts.map +1 -1
- package/dist/cjs/filelist/filelist.cjs +2 -2
- package/dist/cjs/filelist/filelist.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/index.d.cts.map +1 -1
- package/dist/cjs/modal/base.cjs +285 -0
- package/dist/cjs/modal/base.cjs.map +1 -0
- package/dist/cjs/modal/base.d.cts +23 -0
- package/dist/cjs/modal/base.d.cts.map +1 -0
- package/dist/cjs/modal/index.d.cts +1 -1
- package/dist/cjs/modal/index.d.cts.map +1 -1
- package/dist/cjs/modal/modal.cjs +64 -209
- package/dist/cjs/modal/modal.cjs.map +1 -1
- package/dist/cjs/modal/modal.d.cts +8 -3
- package/dist/cjs/modal/modal.d.cts.map +1 -1
- package/dist/cjs/shared/presence.cjs +12 -6
- package/dist/cjs/shared/presence.cjs.map +1 -1
- package/dist/cjs/shared/presence.d.cts +1 -1
- package/dist/cjs/shared/presence.d.cts.map +1 -1
- package/dist/cjs/styles/card.css +1 -1
- package/dist/cjs/styles/colorpicker.css +1 -1
- package/dist/cjs/styles/components/card.css +1 -1
- package/dist/cjs/styles/components/drawer.css +1 -1
- package/dist/cjs/styles/components/modal.css +1 -1
- package/dist/cjs/styles/components/tabletanstack.css +1 -1
- package/dist/cjs/styles/components/tabs.css +1 -1
- package/dist/cjs/styles/config-provider.css +1 -1
- package/dist/cjs/styles/confirm.css +1 -1
- package/dist/cjs/styles/daterangepicker.css +1 -1
- package/dist/cjs/styles/drawer.css +1 -1
- package/dist/cjs/styles/filelist.css +1 -1
- package/dist/cjs/styles/index.css +79 -22
- package/dist/cjs/styles/index.css.map +1 -1
- package/dist/cjs/styles/modal.css +1 -1
- package/dist/cjs/styles/tabletanstack.css +1 -1
- package/dist/cjs/styles/tabs.css +1 -1
- package/dist/cjs/styles/upload.css +1 -1
- package/dist/cjs/tabletanstack/tabletanstack.cjs +14 -2
- package/dist/cjs/tabletanstack/tabletanstack.cjs.map +1 -1
- package/dist/cjs/tabletanstack/tabletanstack.d.cts.map +1 -1
- package/dist/cjs/tabs/tabs.cjs +194 -174
- package/dist/cjs/tabs/tabs.cjs.map +1 -1
- package/dist/cjs/tabs/tabs.d.cts +14 -1
- package/dist/cjs/tabs/tabs.d.cts.map +1 -1
- package/dist/esm/browser/modules/card/card.js +30 -15
- package/dist/esm/browser/modules/card/card.js.map +1 -1
- package/dist/esm/browser/modules/confirm/confirm.js +1 -1
- package/dist/esm/browser/modules/confirm/confirm.js.map +1 -1
- package/dist/esm/browser/modules/drawer/drawer.js +121 -62
- package/dist/esm/browser/modules/drawer/drawer.js.map +1 -1
- package/dist/esm/browser/modules/filelist/filelist.js +1 -1
- package/dist/esm/browser/modules/filelist/filelist.js.map +1 -1
- package/dist/esm/browser/modules/modal/base.js +249 -0
- package/dist/esm/browser/modules/modal/base.js.map +1 -0
- package/dist/esm/browser/modules/modal/modal.js +65 -207
- package/dist/esm/browser/modules/modal/modal.js.map +1 -1
- package/dist/esm/browser/modules/shared/presence.js +12 -6
- package/dist/esm/browser/modules/shared/presence.js.map +1 -1
- package/dist/esm/browser/modules/tabletanstack/tabletanstack.js +14 -2
- package/dist/esm/browser/modules/tabletanstack/tabletanstack.js.map +1 -1
- package/dist/esm/browser/modules/tabs/tabs.js +190 -173
- package/dist/esm/browser/modules/tabs/tabs.js.map +1 -1
- package/dist/esm/card/card.d.ts.map +1 -1
- package/dist/esm/card/card.js +30 -15
- package/dist/esm/card/card.js.map +1 -1
- package/dist/esm/confirm/confirm.js +1 -1
- package/dist/esm/confirm/confirm.js.map +1 -1
- package/dist/esm/drawer/drawer.d.ts +6 -0
- package/dist/esm/drawer/drawer.d.ts.map +1 -1
- package/dist/esm/drawer/drawer.js +121 -62
- package/dist/esm/drawer/drawer.js.map +1 -1
- package/dist/esm/drawer/index.d.ts +1 -1
- package/dist/esm/drawer/index.d.ts.map +1 -1
- package/dist/esm/filelist/filelist.js +1 -1
- package/dist/esm/filelist/filelist.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/modal/base.d.ts +23 -0
- package/dist/esm/modal/base.d.ts.map +1 -0
- package/dist/esm/modal/base.js +247 -0
- package/dist/esm/modal/base.js.map +1 -0
- package/dist/esm/modal/index.d.ts +1 -1
- package/dist/esm/modal/index.d.ts.map +1 -1
- package/dist/esm/modal/modal.d.ts +8 -3
- package/dist/esm/modal/modal.d.ts.map +1 -1
- package/dist/esm/modal/modal.js +65 -207
- package/dist/esm/modal/modal.js.map +1 -1
- package/dist/esm/shared/presence.d.ts +1 -1
- package/dist/esm/shared/presence.d.ts.map +1 -1
- package/dist/esm/shared/presence.js +12 -6
- package/dist/esm/shared/presence.js.map +1 -1
- package/dist/esm/styles/card.css +1 -1
- package/dist/esm/styles/colorpicker.css +1 -1
- package/dist/esm/styles/components/card.css +1 -1
- package/dist/esm/styles/components/drawer.css +1 -1
- package/dist/esm/styles/components/modal.css +1 -1
- package/dist/esm/styles/components/tabletanstack.css +1 -1
- package/dist/esm/styles/components/tabs.css +1 -1
- package/dist/esm/styles/config-provider.css +1 -1
- package/dist/esm/styles/confirm.css +1 -1
- package/dist/esm/styles/daterangepicker.css +1 -1
- package/dist/esm/styles/drawer.css +1 -1
- package/dist/esm/styles/filelist.css +1 -1
- package/dist/esm/styles/index.css +79 -22
- package/dist/esm/styles/index.css.map +1 -1
- package/dist/esm/styles/modal.css +1 -1
- package/dist/esm/styles/tabletanstack.css +1 -1
- package/dist/esm/styles/tabs.css +1 -1
- package/dist/esm/styles/upload.css +1 -1
- package/dist/esm/tabletanstack/tabletanstack.d.ts.map +1 -1
- package/dist/esm/tabletanstack/tabletanstack.js +14 -2
- package/dist/esm/tabletanstack/tabletanstack.js.map +1 -1
- package/dist/esm/tabs/tabs.d.ts +14 -1
- package/dist/esm/tabs/tabs.d.ts.map +1 -1
- package/dist/esm/tabs/tabs.js +190 -173
- package/dist/esm/tabs/tabs.js.map +1 -1
- package/package.json +2 -2
|
@@ -43,10 +43,12 @@ const tabs_cjs_namespaceObject = require("../tabs/tabs.cjs");
|
|
|
43
43
|
const external_title_cjs_namespaceObject = require("./title.cjs");
|
|
44
44
|
function Card(rawProps) {
|
|
45
45
|
const { title, description, extra, tabs, cover, footer, loading = false, bordered = true, shadow = true, selected = false, variant = 'default', size = 'md', children, className, ...props } = (0, component_defaults_cjs_namespaceObject.useComponentProps)('Card', rawProps);
|
|
46
|
+
const titleId = (0, external_react_namespaceObject.useId)();
|
|
46
47
|
const body = (0, external_react_namespaceObject.useRef)(null);
|
|
47
|
-
(0, presence_cjs_namespaceObject.useContentTransition)(body, loading ? 'loading' : 'content');
|
|
48
|
-
const
|
|
49
|
-
const
|
|
48
|
+
(0, presence_cjs_namespaceObject.useContentTransition)(body, loading ? 'loading' : 'content', 0, true);
|
|
49
|
+
const rawTabItems = tabs?.items;
|
|
50
|
+
const hasTabs = Boolean(rawTabItems?.length);
|
|
51
|
+
const hasTabPanels = Boolean(rawTabItems?.some((item)=>null != item.children));
|
|
50
52
|
const layered = 'layered' === variant;
|
|
51
53
|
const visibleDescription = layered ? void 0 : description;
|
|
52
54
|
const hasHeading = null != title || null != visibleDescription;
|
|
@@ -62,34 +64,46 @@ function Card(rawProps) {
|
|
|
62
64
|
extra
|
|
63
65
|
]
|
|
64
66
|
});
|
|
67
|
+
const tabItems = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
68
|
+
if (!rawTabItems?.length) return;
|
|
69
|
+
if (!hasTabPanels) return rawTabItems;
|
|
70
|
+
return rawTabItems.map((item)=>({
|
|
71
|
+
...item,
|
|
72
|
+
children: null != item.children ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(skeleton_cjs_namespaceObject.SkeletonControl, {
|
|
73
|
+
loading: loading,
|
|
74
|
+
children: item.children
|
|
75
|
+
}) : item.children
|
|
76
|
+
}));
|
|
77
|
+
}, [
|
|
78
|
+
rawTabItems,
|
|
79
|
+
hasTabPanels,
|
|
80
|
+
loading
|
|
81
|
+
]);
|
|
82
|
+
const tabLabel = tabs?.['aria-label'] ?? ('string' == typeof title ? title : void 0);
|
|
83
|
+
const tabLabelledBy = tabs?.['aria-labelledby'] ?? (tabs?.['aria-label'] == null && null != title ? titleId : void 0);
|
|
65
84
|
const content = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
66
85
|
children: [
|
|
67
86
|
null != cover && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
68
87
|
className: "leaf-card__cover",
|
|
69
88
|
children: cover
|
|
70
89
|
}),
|
|
71
|
-
hasTabs && tabs && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tabs_cjs_namespaceObject.TabsControl, {
|
|
90
|
+
hasTabs && tabs && tabItems && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tabs_cjs_namespaceObject.TabsControl, {
|
|
72
91
|
...tabs,
|
|
73
92
|
type: "line",
|
|
74
93
|
placement: "top",
|
|
75
94
|
size: tabs.size ?? size,
|
|
76
|
-
"aria-label":
|
|
95
|
+
"aria-label": tabLabel,
|
|
96
|
+
"aria-labelledby": tabLabelledBy,
|
|
77
97
|
extra: tabExtra,
|
|
78
98
|
className: (0, classes_cjs_namespaceObject.classes)('leaf-card__tabs', tabs.className),
|
|
79
|
-
items:
|
|
80
|
-
|
|
81
|
-
children: null != item.children ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(skeleton_cjs_namespaceObject.SkeletonControl, {
|
|
82
|
-
loading: loading,
|
|
83
|
-
children: item.children
|
|
84
|
-
}) : item.children
|
|
85
|
-
})),
|
|
86
|
-
onReorder: tabs.onReorder && ((items)=>{
|
|
99
|
+
items: tabItems,
|
|
100
|
+
onReorder: tabs.onReorder && (hasTabPanels ? (items)=>{
|
|
87
101
|
const originals = new Map(tabs.items.map((item)=>[
|
|
88
102
|
item.key,
|
|
89
103
|
item
|
|
90
104
|
]));
|
|
91
105
|
tabs.onReorder?.(items.map((item)=>originals.get(item.key) ?? item));
|
|
92
|
-
})
|
|
106
|
+
} : tabs.onReorder)
|
|
93
107
|
}),
|
|
94
108
|
hasBody && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
95
109
|
className: "leaf-card__body",
|
|
@@ -114,6 +128,7 @@ function Card(rawProps) {
|
|
|
114
128
|
className: "leaf-card__heading",
|
|
115
129
|
children: [
|
|
116
130
|
null != title && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_title_cjs_namespaceObject.CardTitleControl, {
|
|
131
|
+
id: titleId,
|
|
117
132
|
size: size,
|
|
118
133
|
className: "leaf-card__title",
|
|
119
134
|
children: title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card/card.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/card/card.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { type HTMLAttributes, type ReactNode, useRef } from 'react';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { classes } from '../shared/classes';\nimport { useContentTransition } from '../shared/presence';\nimport { SkeletonControl as Skeleton } from '../skeleton/skeleton';\nimport type { TabsProps } from '../tabs';\nimport { TabsControl as Tabs } from '../tabs/tabs';\nimport { CardTitleControl } from './title';\n\n/** Tabs controls integrated with the card; Card fixes the line type and top placement. */\nexport interface CardTabsProps extends Omit<TabsProps, 'type' | 'placement' | 'children'> {}\n\nexport interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n title?: ReactNode;\n /** Supporting text for the default appearance; not displayed by layered cards. */\n description?: ReactNode;\n extra?: ReactNode;\n /** Tabs replace the heading when no title is supplied, otherwise sit below it. */\n tabs?: CardTabsProps;\n cover?: ReactNode;\n footer?: ReactNode;\n loading?: boolean;\n bordered?: boolean;\n /** Show the card's resting shadow; layered cards apply this to the inner content surface. */\n shadow?: boolean;\n /** Visual selection only; use explicit buttons or selection controls for interaction. */\n selected?: boolean;\n /** `layered` separates the content surface from the heading and footer on a muted canvas. */\n variant?: 'default' | 'layered';\n /** Card spacing, heading typography and height, and the default size of embedded tabs. */\n size?: 'sm' | 'md' | 'lg';\n}\nexport function Card(rawProps: CardProps) {\n const {\n title,\n description,\n extra,\n tabs,\n cover,\n footer,\n loading = false,\n bordered = true,\n shadow = true,\n selected = false,\n variant = 'default',\n size = 'md',\n children,\n className,\n ...props\n } = useComponentProps('Card', rawProps);\n const body = useRef<HTMLDivElement>(null);\n useContentTransition(body, loading ? 'loading' : 'content');\n const hasTabs = Boolean(tabs?.items.length);\n const hasTabPanels = Boolean(tabs?.items.some((item) => item.children != null));\n const layered = variant === 'layered';\n const visibleDescription = layered ? undefined : description;\n const hasHeading = title != null || visibleDescription != null;\n // 封面或无面板标签栏可直接搭配 Card children,仅在无标签面板且 loading 时保留空 body 骨架占位。\n const hasBody = children != null || (!hasTabPanels && loading) || (!hasTabs && cover == null);\n const footerContent = footer != null && <div className=\"leaf-card__footer\">{footer}</div>;\n const tabExtra =\n !hasHeading && extra != null ? (\n <div className=\"leaf-card__tab-extra\">\n {tabs?.extra}\n {extra}\n </div>\n ) : (\n tabs?.extra\n );\n const content = (\n <>\n {cover != null && <div className=\"leaf-card__cover\">{cover}</div>}\n {hasTabs && tabs && (\n <Tabs\n {...tabs}\n type=\"line\"\n placement=\"top\"\n size={tabs.size ?? size}\n aria-label={tabs['aria-label'] ?? (typeof title === 'string' ? title : undefined)}\n extra={tabExtra}\n className={classes('leaf-card__tabs', tabs.className)}\n items={tabs.items.map((item) => ({\n ...item,\n children:\n item.children != null ? (\n <Skeleton loading={loading}>{item.children}</Skeleton>\n ) : (\n item.children\n ),\n }))}\n onReorder={\n tabs.onReorder &&\n ((items) => {\n const originals = new Map(tabs.items.map((item) => [item.key, item]));\n tabs.onReorder?.(items.map((item) => originals.get(item.key) ?? item));\n })\n }\n />\n )}\n {hasBody && (\n <div className=\"leaf-card__body\" ref={body}>\n <Skeleton loading={loading}>{children}</Skeleton>\n </div>\n )}\n {!layered && footerContent}\n </>\n );\n return (\n <div\n {...props}\n aria-busy={loading || undefined}\n className={classes(\n 'leaf-card',\n `leaf-card--${size}`,\n bordered && 'leaf-card--bordered',\n !shadow && 'leaf-card--shadowless',\n selected && 'leaf-card--selected',\n layered && 'leaf-card--layered',\n hasHeading && 'leaf-card--headed',\n hasTabs && 'leaf-card--tabbed',\n className,\n )}\n >\n {(hasHeading || (!hasTabs && extra != null)) && (\n <div className=\"leaf-card__header\">\n {hasHeading && (\n <div className=\"leaf-card__heading\">\n {title != null && (\n <CardTitleControl size={size} className=\"leaf-card__title\">\n {title}\n </CardTitleControl>\n )}\n {visibleDescription != null && (\n <div className=\"leaf-card__description\">{visibleDescription}</div>\n )}\n </div>\n )}\n {extra != null && <div className=\"leaf-card__extra\">{extra}</div>}\n </div>\n )}\n <div className=\"leaf-card__panel\">{content}</div>\n {layered && footerContent}\n </div>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","Card","rawProps","title","description","extra","tabs","cover","footer","loading","bordered","shadow","selected","variant","size","children","className","props","useComponentProps","body","useRef","useContentTransition","hasTabs","Boolean","hasTabPanels","item","layered","visibleDescription","undefined","hasHeading","hasBody","footerContent","tabExtra","content","Tabs","classes","Skeleton","items","originals","Map","CardTitleControl"],"mappings":";;;;;;IAAAA,oBA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GAAG,CAAC,CAACmB,OAAS;4BAACA,KAAK,GAAG;4BAAEA;yBAAK;oBACnEnB,KAAK,SAAS,GAAG+B,MAAM,GAAG,CAAC,CAACZ,OAASa,UAAU,GAAG,CAACb,KAAK,GAAG,KAAKA;gBAClE;;YAILK,WACC,AADU,WAAXA,GACC,qCAAC;gBAAI,WAAU;gBAAkB,KAAKX;0BACpC,mDAACiB,6BAAAA,eAAQA,EAAAA;oBAAC,SAAS3B;8BAAUM;;;YAGhC,CAACW,WAAWK;;;IAGjB,OACE,AADK,WAAP,GACE,sCAAC;QACE,GAAGd,KAAK;QACT,aAAWR,WAAWmB;QACtB,WAAWO,AAAAA,IAAAA,4BAAAA,OAAAA,AAAAA,EACT,aACA,CAAC,WAAW,EAAErB,MAAM,EACpBJ,YAAY,uBACZ,CAACC,UAAU,yBACXC,YAAY,uBACZc,WAAW,sBACXG,cAAc,qBACdP,WAAW,qBACXN;;YAGAa,CAAAA,cAAe,CAACP,WAAWjB,AAAS,QAATA,KAAY,KACvC,AADwC,cACxC,sCAAC;gBAAI,WAAU;;oBACZwB,cACC,AADa,WAAdA,GACC,sCAAC;wBAAI,WAAU;;4BACH,QAAT1B,SACC,AADgB,WAAR,GACR,qCAACqC,mCAAAA,gBAAgBA,EAAAA;gCAAC,MAAM1B;gCAAM,WAAU;0CACrCX;;4BAGkB,QAAtBwB,sBACC,AAD6B,WAAR,GACrB,qCAAC;gCAAI,WAAU;0CAA0BA;;;;oBAIrC,QAATtB,SAAiB,WAAR,GAAQ,qCAAC;wBAAI,WAAU;kCAAoBA;;;;0BAGzD,qCAAC;gBAAI,WAAU;0BAAoB4B;;YAClCP,WAAWK;;;AAGlB"}
|
|
1
|
+
{"version":3,"file":"card/card.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/card/card.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { type HTMLAttributes, type ReactNode, useId, useMemo, useRef } from 'react';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { classes } from '../shared/classes';\nimport { useContentTransition } from '../shared/presence';\nimport { SkeletonControl as Skeleton } from '../skeleton/skeleton';\nimport type { TabsProps } from '../tabs';\nimport { TabsControl as Tabs } from '../tabs/tabs';\nimport { CardTitleControl } from './title';\n\n/** Tabs controls integrated with the card; Card fixes the line type and top placement. */\nexport interface CardTabsProps extends Omit<TabsProps, 'type' | 'placement' | 'children'> {}\n\nexport interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n title?: ReactNode;\n /** Supporting text for the default appearance; not displayed by layered cards. */\n description?: ReactNode;\n extra?: ReactNode;\n /** Tabs replace the heading when no title is supplied, otherwise sit below it. */\n tabs?: CardTabsProps;\n cover?: ReactNode;\n footer?: ReactNode;\n loading?: boolean;\n bordered?: boolean;\n /** Show the card's resting shadow; layered cards apply this to the inner content surface. */\n shadow?: boolean;\n /** Visual selection only; use explicit buttons or selection controls for interaction. */\n selected?: boolean;\n /** `layered` separates the content surface from the heading and footer on a muted canvas. */\n variant?: 'default' | 'layered';\n /** Card spacing, heading typography and height, and the default size of embedded tabs. */\n size?: 'sm' | 'md' | 'lg';\n}\nexport function Card(rawProps: CardProps) {\n const {\n title,\n description,\n extra,\n tabs,\n cover,\n footer,\n loading = false,\n bordered = true,\n shadow = true,\n selected = false,\n variant = 'default',\n size = 'md',\n children,\n className,\n ...props\n } = useComponentProps('Card', rawProps);\n const titleId = useId();\n const body = useRef<HTMLDivElement>(null);\n // Skeleton 内部已负责内容显露动效,此处仅保留高度过渡避免叠加。\n useContentTransition(body, loading ? 'loading' : 'content', 0, true);\n const rawTabItems = tabs?.items;\n const hasTabs = Boolean(rawTabItems?.length);\n const hasTabPanels = Boolean(rawTabItems?.some((item) => item.children != null));\n const layered = variant === 'layered';\n const visibleDescription = layered ? undefined : description;\n const hasHeading = title != null || visibleDescription != null;\n // 封面或无面板标签栏可直接搭配 Card children,仅在无标签面板且 loading 时保留空 body 骨架占位。\n const hasBody = children != null || (!hasTabPanels && loading) || (!hasTabs && cover == null);\n const footerContent = footer != null && <div className=\"leaf-card__footer\">{footer}</div>;\n const tabExtra =\n !hasHeading && extra != null ? (\n <div className=\"leaf-card__tab-extra\">\n {tabs?.extra}\n {extra}\n </div>\n ) : (\n tabs?.extra\n );\n const tabItems = useMemo(() => {\n if (!rawTabItems?.length) return undefined;\n if (!hasTabPanels) return rawTabItems;\n return rawTabItems.map((item) => ({\n ...item,\n children:\n item.children != null ? (\n <Skeleton loading={loading}>{item.children}</Skeleton>\n ) : (\n item.children\n ),\n }));\n }, [rawTabItems, hasTabPanels, loading]);\n const tabLabel = tabs?.['aria-label'] ?? (typeof title === 'string' ? title : undefined);\n const tabLabelledBy =\n tabs?.['aria-labelledby'] ??\n (tabs?.['aria-label'] == null && title != null ? titleId : undefined);\n const content = (\n <>\n {cover != null && <div className=\"leaf-card__cover\">{cover}</div>}\n {hasTabs && tabs && tabItems && (\n <Tabs\n {...tabs}\n type=\"line\"\n placement=\"top\"\n size={tabs.size ?? size}\n aria-label={tabLabel}\n aria-labelledby={tabLabelledBy}\n extra={tabExtra}\n className={classes('leaf-card__tabs', tabs.className)}\n items={tabItems}\n onReorder={\n tabs.onReorder &&\n (hasTabPanels\n ? (items) => {\n const originals = new Map(tabs.items.map((item) => [item.key, item]));\n tabs.onReorder?.(items.map((item) => originals.get(item.key) ?? item));\n }\n : tabs.onReorder)\n }\n />\n )}\n {hasBody && (\n <div className=\"leaf-card__body\" ref={body}>\n <Skeleton loading={loading}>{children}</Skeleton>\n </div>\n )}\n {!layered && footerContent}\n </>\n );\n return (\n <div\n {...props}\n aria-busy={loading || undefined}\n className={classes(\n 'leaf-card',\n `leaf-card--${size}`,\n bordered && 'leaf-card--bordered',\n !shadow && 'leaf-card--shadowless',\n selected && 'leaf-card--selected',\n layered && 'leaf-card--layered',\n hasHeading && 'leaf-card--headed',\n hasTabs && 'leaf-card--tabbed',\n className,\n )}\n >\n {(hasHeading || (!hasTabs && extra != null)) && (\n <div className=\"leaf-card__header\">\n {hasHeading && (\n <div className=\"leaf-card__heading\">\n {title != null && (\n <CardTitleControl id={titleId} size={size} className=\"leaf-card__title\">\n {title}\n </CardTitleControl>\n )}\n {visibleDescription != null && (\n <div className=\"leaf-card__description\">{visibleDescription}</div>\n )}\n </div>\n )}\n {extra != null && <div className=\"leaf-card__extra\">{extra}</div>}\n </div>\n )}\n <div className=\"leaf-card__panel\">{content}</div>\n {layered && footerContent}\n </div>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","Card","rawProps","title","description","extra","tabs","cover","footer","loading","bordered","shadow","selected","variant","size","children","className","props","useComponentProps","titleId","useId","body","useRef","useContentTransition","rawTabItems","hasTabs","Boolean","hasTabPanels","item","layered","visibleDescription","undefined","hasHeading","hasBody","footerContent","tabExtra","tabItems","useMemo","Skeleton","tabLabel","tabLabelledBy","content","Tabs","classes","items","originals","Map","CardTitleControl"],"mappings":";;;;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,IAAGJ,oBAAoB,CAAC,CAACI,MAAME,QAAQ,CAACN,oBAAoB,CAAC,CAA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;;oBAIrC,QAATzB,SAAiB,WAAR,GAAQ,qCAAC;wBAAI,WAAU;kCAAoBA;;;;0BAGzD,qCAAC;gBAAI,WAAU;0BAAoBoC;;YAClCZ,WAAWK;;;AAGlB"}
|
|
@@ -37,7 +37,7 @@ const external_react_namespaceObject = require("react");
|
|
|
37
37
|
const alert_cjs_namespaceObject = require("../alert/alert.cjs");
|
|
38
38
|
const button_cjs_namespaceObject = require("../button/button.cjs");
|
|
39
39
|
const context_cjs_namespaceObject = require("../config-provider/context.cjs");
|
|
40
|
-
const
|
|
40
|
+
const base_cjs_namespaceObject = require("../modal/base.cjs");
|
|
41
41
|
function ConfirmDialog({ open, title, icon, children, confirmText, cancelText, type = 'info', showCancel, confirmButtonProps, cancelButtonProps, onCancel, onConfirm, onClose, ...props }) {
|
|
42
42
|
const { messages } = (0, context_cjs_namespaceObject.useLeafConfig)();
|
|
43
43
|
const contentId = (0, external_react_namespaceObject.useId)();
|
|
@@ -90,7 +90,7 @@ function ConfirmDialog({ open, title, icon, children, confirmText, cancelText, t
|
|
|
90
90
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(alert_cjs_namespaceObject.FeedbackIcon, {
|
|
91
91
|
type: type
|
|
92
92
|
}) : icon;
|
|
93
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
93
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(base_cjs_namespaceObject.ModalBase, {
|
|
94
94
|
...props,
|
|
95
95
|
open: open,
|
|
96
96
|
title: null != title && null != contentIcon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm/confirm.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/confirm/confirm.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { CircleAlert } from 'lucide-react';\nimport { type CSSProperties, type ReactNode, useEffect, useId, useRef, useState } from 'react';\nimport { FeedbackIcon } from '../alert/alert';\nimport { ButtonControl, type ButtonProps } from '../button/button';\nimport { useLeafConfig } from '../config-provider/context';\nimport { ModalBase } from '../modal/modal';\nimport type { DialogFocusOptions } from '../shared/dialog';\n\nexport interface ConfirmOptions extends DialogFocusOptions {\n title?: ReactNode;\n /** A short explanation of the action being confirmed. */\n children?: ReactNode;\n /** Bare semantic icon beside the title, or content when untitled. Use null to hide it. */\n icon?: ReactNode;\n type?: 'default' | 'danger' | 'success' | 'warning' | 'info';\n showCancel?: boolean;\n confirmText?: ReactNode;\n cancelText?: ReactNode;\n confirmButtonProps?: ButtonProps;\n cancelButtonProps?: ButtonProps;\n onConfirm?: () => void | Promise<void>;\n onCancel?: () => void;\n width?: number | string;\n closable?: boolean;\n maskClosable?: boolean;\n keyboard?: boolean;\n className?: string;\n style?: CSSProperties;\n}\ninterface ConfirmDialogProps extends ConfirmOptions {\n open: boolean;\n onClose: () => void;\n afterClose?: () => void;\n}\n\n// Rendered only by the confirmation queue; consumers call useConfirm().confirm().\nexport function ConfirmDialog({\n open,\n title,\n icon,\n children,\n confirmText,\n cancelText,\n type = 'info',\n showCancel,\n confirmButtonProps,\n cancelButtonProps,\n onCancel,\n onConfirm,\n onClose,\n ...props\n}: ConfirmDialogProps) {\n const { messages } = useLeafConfig();\n const contentId = useId();\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string>();\n const mounted = useRef(true);\n const busy = useRef(false);\n const generation = useRef(0);\n const confirmLoading = confirmButtonProps?.loading ?? false;\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n useEffect(() => {\n generation.current++;\n busy.current = false;\n setPending(false);\n if (open) setError(undefined);\n }, [open]);\n async function accept() {\n if (busy.current || confirmLoading) return;\n busy.current = true;\n const request = generation.current;\n setPending(true);\n setError(undefined);\n try {\n await onConfirm?.();\n if (mounted.current && generation.current === request) onClose?.();\n } catch (reason) {\n if (mounted.current && generation.current === request)\n setError(reason instanceof Error ? reason.message : String(reason));\n } finally {\n if (generation.current === request) {\n busy.current = false;\n if (mounted.current) setPending(false);\n }\n }\n }\n const cancel = () => {\n if (!pending && !confirmLoading) {\n onCancel?.();\n onClose?.();\n }\n };\n const contentIcon =\n icon === undefined && type !== 'default' ? (\n type === 'danger' ? (\n <CircleAlert aria-hidden=\"true\" />\n ) : (\n <FeedbackIcon type={type} />\n )\n ) : (\n icon\n );\n return (\n <ModalBase\n {...props}\n open={open}\n title={\n title != null && contentIcon != null ? (\n <>\n <span className=\"leaf-confirm__icon\" aria-hidden=\"true\">\n {contentIcon}\n </span>\n <span className=\"leaf-confirm__title\">{title}</span>\n </>\n ) : (\n title\n )\n }\n width={props.width ?? 420}\n divided={false}\n confirmLoading={pending || confirmLoading}\n role=\"alertdialog\"\n aria-label={title == null ? messages.common.confirm : undefined}\n aria-describedby={children != null ? contentId : undefined}\n className={[\n 'leaf-confirm',\n `leaf-confirm--${type}`,\n title != null && contentIcon != null && 'leaf-confirm--titled-icon',\n (icon != null || (icon === undefined && type !== 'default')) && 'leaf-confirm--has-icon',\n props.className,\n ]\n .filter(Boolean)\n .join(' ')}\n maskClosable={pending ? false : (props.maskClosable ?? false)}\n closable={!pending && (props.closable ?? false)}\n keyboard={!pending && (props.keyboard ?? true)}\n onClose={cancel}\n onCancel={cancel}\n footer={\n <>\n {(showCancel ?? type !== 'success') && (\n <ButtonControl\n type=\"button\"\n variant=\"outline\"\n {...cancelButtonProps}\n disabled={pending || confirmLoading || cancelButtonProps?.disabled}\n onClick={(event) => {\n cancelButtonProps?.onClick?.(event);\n if (!event.defaultPrevented) cancel();\n }}\n >\n {cancelText ?? messages.common.cancel}\n </ButtonControl>\n )}\n <ButtonControl\n type=\"button\"\n variant=\"solid\"\n {...confirmButtonProps}\n danger={type === 'danger'}\n loading={pending || confirmLoading || confirmButtonProps?.loading}\n onClick={(event) => {\n confirmButtonProps?.onClick?.(event);\n if (!event.defaultPrevented) void accept();\n }}\n >\n {confirmText ?? messages.common.confirm}\n </ButtonControl>\n </>\n }\n >\n {(contentIcon != null || children != null || error != null) && (\n <div className=\"leaf-confirm__body\">\n {title == null && contentIcon != null && (\n <span className=\"leaf-confirm__icon\" aria-hidden=\"true\">\n {contentIcon}\n </span>\n )}\n <div className=\"leaf-confirm__content\">\n {children != null && (\n <div id={contentId} className=\"leaf-confirm-description\">\n {children}\n </div>\n )}\n {error && (\n <p role=\"alert\" className=\"leaf-confirm-error\">\n {error}\n </p>\n )}\n </div>\n </div>\n )}\n </ModalBase>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","ConfirmDialog","open","title","icon","children","confirmText","cancelText","type","showCancel","confirmButtonProps","cancelButtonProps","onCancel","onConfirm","onClose","props","messages","useLeafConfig","contentId","useId","pending","setPending","useState","error","setError","mounted","useRef","busy","generation","confirmLoading","useEffect","undefined","accept","request","reason","Error","String","cancel","contentIcon","CircleAlert","FeedbackIcon","ModalBase","Boolean","ButtonControl","event"],"mappings":";;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,I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SAASY,WAAWS,kBAAkBnB,oBAAoB;oBAC1D,SAAS,CAACkC;wBACRlC,oBAAoB,UAAUkC;wBAC9B,IAAI,CAACA,MAAM,gBAAgB,EAAOZ;oBACpC;8BAEC1B,eAAeU,SAAS,MAAM,CAAC,OAAO;;;;kBAK3CsB,AAAAA,CAAAA,AAAe,QAAfA,eAAuBjC,AAAY,QAAZA,YAAoBkB,AAAS,QAATA,KAAY,KACvD,AADuD,cACvD,sCAAC;YAAI,WAAU;;gBACH,QAATpB,SAAiBmC,AAAe,QAAfA,eAChB,AADuC,WAAR,GAC/B,qCAAC;oBAAK,WAAU;oBAAqB,eAAY;8BAC9CA;;8BAGL,sCAAC;oBAAI,WAAU;;wBACA,QAAZjC,YACC,AADmB,WAAR,GACX,qCAAC;4BAAI,IAAIa;4BAAW,WAAU;sCAC3Bb;;wBAGJkB,SACC,AADQ,WAATA,GACC,qCAAC;4BAAE,MAAK;4BAAQ,WAAU;sCACvBA;;;;;;;AAQjB"}
|
|
1
|
+
{"version":3,"file":"confirm/confirm.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/confirm/confirm.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { CircleAlert } from 'lucide-react';\nimport { type CSSProperties, type ReactNode, useEffect, useId, useRef, useState } from 'react';\nimport { FeedbackIcon } from '../alert/alert';\nimport { ButtonControl, type ButtonProps } from '../button/button';\nimport { useLeafConfig } from '../config-provider/context';\nimport { ModalBase } from '../modal/base';\nimport type { DialogFocusOptions } from '../shared/dialog';\n\nexport interface ConfirmOptions extends DialogFocusOptions {\n title?: ReactNode;\n /** A short explanation of the action being confirmed. */\n children?: ReactNode;\n /** Bare semantic icon beside the title, or content when untitled. Use null to hide it. */\n icon?: ReactNode;\n type?: 'default' | 'danger' | 'success' | 'warning' | 'info';\n showCancel?: boolean;\n confirmText?: ReactNode;\n cancelText?: ReactNode;\n confirmButtonProps?: ButtonProps;\n cancelButtonProps?: ButtonProps;\n onConfirm?: () => void | Promise<void>;\n onCancel?: () => void;\n width?: number | string;\n closable?: boolean;\n maskClosable?: boolean;\n keyboard?: boolean;\n className?: string;\n style?: CSSProperties;\n}\ninterface ConfirmDialogProps extends ConfirmOptions {\n open: boolean;\n onClose: () => void;\n afterClose?: () => void;\n}\n\n// Rendered only by the confirmation queue; consumers call useConfirm().confirm().\nexport function ConfirmDialog({\n open,\n title,\n icon,\n children,\n confirmText,\n cancelText,\n type = 'info',\n showCancel,\n confirmButtonProps,\n cancelButtonProps,\n onCancel,\n onConfirm,\n onClose,\n ...props\n}: ConfirmDialogProps) {\n const { messages } = useLeafConfig();\n const contentId = useId();\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string>();\n const mounted = useRef(true);\n const busy = useRef(false);\n const generation = useRef(0);\n const confirmLoading = confirmButtonProps?.loading ?? false;\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n useEffect(() => {\n generation.current++;\n busy.current = false;\n setPending(false);\n if (open) setError(undefined);\n }, [open]);\n async function accept() {\n if (busy.current || confirmLoading) return;\n busy.current = true;\n const request = generation.current;\n setPending(true);\n setError(undefined);\n try {\n await onConfirm?.();\n if (mounted.current && generation.current === request) onClose?.();\n } catch (reason) {\n if (mounted.current && generation.current === request)\n setError(reason instanceof Error ? reason.message : String(reason));\n } finally {\n if (generation.current === request) {\n busy.current = false;\n if (mounted.current) setPending(false);\n }\n }\n }\n const cancel = () => {\n if (!pending && !confirmLoading) {\n onCancel?.();\n onClose?.();\n }\n };\n const contentIcon =\n icon === undefined && type !== 'default' ? (\n type === 'danger' ? (\n <CircleAlert aria-hidden=\"true\" />\n ) : (\n <FeedbackIcon type={type} />\n )\n ) : (\n icon\n );\n return (\n <ModalBase\n {...props}\n open={open}\n title={\n title != null && contentIcon != null ? (\n <>\n <span className=\"leaf-confirm__icon\" aria-hidden=\"true\">\n {contentIcon}\n </span>\n <span className=\"leaf-confirm__title\">{title}</span>\n </>\n ) : (\n title\n )\n }\n width={props.width ?? 420}\n divided={false}\n confirmLoading={pending || confirmLoading}\n role=\"alertdialog\"\n aria-label={title == null ? messages.common.confirm : undefined}\n aria-describedby={children != null ? contentId : undefined}\n className={[\n 'leaf-confirm',\n `leaf-confirm--${type}`,\n title != null && contentIcon != null && 'leaf-confirm--titled-icon',\n (icon != null || (icon === undefined && type !== 'default')) && 'leaf-confirm--has-icon',\n props.className,\n ]\n .filter(Boolean)\n .join(' ')}\n maskClosable={pending ? false : (props.maskClosable ?? false)}\n closable={!pending && (props.closable ?? false)}\n keyboard={!pending && (props.keyboard ?? true)}\n onClose={cancel}\n onCancel={cancel}\n footer={\n <>\n {(showCancel ?? type !== 'success') && (\n <ButtonControl\n type=\"button\"\n variant=\"outline\"\n {...cancelButtonProps}\n disabled={pending || confirmLoading || cancelButtonProps?.disabled}\n onClick={(event) => {\n cancelButtonProps?.onClick?.(event);\n if (!event.defaultPrevented) cancel();\n }}\n >\n {cancelText ?? messages.common.cancel}\n </ButtonControl>\n )}\n <ButtonControl\n type=\"button\"\n variant=\"solid\"\n {...confirmButtonProps}\n danger={type === 'danger'}\n loading={pending || confirmLoading || confirmButtonProps?.loading}\n onClick={(event) => {\n confirmButtonProps?.onClick?.(event);\n if (!event.defaultPrevented) void accept();\n }}\n >\n {confirmText ?? messages.common.confirm}\n </ButtonControl>\n </>\n }\n >\n {(contentIcon != null || children != null || error != null) && (\n <div className=\"leaf-confirm__body\">\n {title == null && contentIcon != null && (\n <span className=\"leaf-confirm__icon\" aria-hidden=\"true\">\n {contentIcon}\n </span>\n )}\n <div className=\"leaf-confirm__content\">\n {children != null && (\n <div id={contentId} className=\"leaf-confirm-description\">\n {children}\n </div>\n )}\n {error && (\n <p role=\"alert\" className=\"leaf-confirm-error\">\n {error}\n </p>\n )}\n </div>\n </div>\n )}\n </ModalBase>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","ConfirmDialog","open","title","icon","children","confirmText","cancelText","type","showCancel","confirmButtonProps","cancelButtonProps","onCancel","onConfirm","onClose","props","messages","useLeafConfig","contentId","useId","pending","setPending","useState","error","setError","mounted","useRef","busy","generation","confirmLoading","useEffect","undefined","accept","request","reason","Error","String","cancel","contentIcon","CircleAlert","FeedbackIcon","ModalBase","Boolean","ButtonControl","event"],"mappings":";;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,IAAGJ,oBAAoB,CAAC,CAACI,MAAME,QAAQ,CAACN,oBAAoB,CAAC,CAAC,UAASM,MACtEC,OAAO,cAAc,CAAC,UAASD,KAAK;gBAAE,YAAY;gBAAM,CAACD,KAAK,EAAED,IAAI,CAACE,IAAI;YAAC;QAG7E;QACAH,OAAOF,SAAS;QAChBE,OAAOD,QAAQ;IAChB;;;ICVAF,oBAAoB,CAAC,GAAG,CAACQ,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFT,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOU,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OA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YACC,AADmB,WAAR,GACX,qCAAC;4BAAI,IAAIa;4BAAW,WAAU;sCAC3Bb;;wBAGJkB,SACC,AADQ,WAATA,GACC,qCAAC;4BAAE,MAAK;4BAAQ,WAAU;sCACvBA;;;;;;;AAQjB"}
|
|
@@ -45,13 +45,113 @@ const inert_cjs_namespaceObject = require("../shared/inert.cjs");
|
|
|
45
45
|
const overlay_owner_cjs_namespaceObject = require("../shared/overlay-owner.cjs");
|
|
46
46
|
const presence_cjs_namespaceObject = require("../shared/presence.cjs");
|
|
47
47
|
const scoped_portal_cjs_namespaceObject = require("../shared/scoped-portal.cjs");
|
|
48
|
-
|
|
48
|
+
const tabs_cjs_namespaceObject = require("../tabs/tabs.cjs");
|
|
49
|
+
const emptyTabItems = [];
|
|
50
|
+
function DrawerInner({ id, open, title, description, icon, tabs, extra, footer, closable, onClose, contentRef, ariaLabel, ariaLabelledBy, children }) {
|
|
51
|
+
const { messages } = (0, context_cjs_namespaceObject.useLeafConfig)();
|
|
52
|
+
const hasTabs = Boolean(tabs?.items?.length);
|
|
53
|
+
const hasHeading = null != title || null != description || null != icon;
|
|
54
|
+
const closeButton = closable ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
55
|
+
type: "button",
|
|
56
|
+
className: "leaf-drawer__close",
|
|
57
|
+
"aria-label": messages.common.close,
|
|
58
|
+
onClick: onClose,
|
|
59
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.X, {
|
|
60
|
+
size: 16,
|
|
61
|
+
"aria-hidden": "true"
|
|
62
|
+
})
|
|
63
|
+
}) : null;
|
|
64
|
+
const extraNode = null != extra ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
65
|
+
className: "leaf-drawer__extra",
|
|
66
|
+
children: extra
|
|
67
|
+
}) : null;
|
|
68
|
+
const tabExtra = !hasHeading && (null != extra || closable) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
69
|
+
className: "leaf-dialog-tab-extra leaf-drawer__tab-extra",
|
|
70
|
+
children: [
|
|
71
|
+
tabs?.extra,
|
|
72
|
+
extraNode,
|
|
73
|
+
closeButton
|
|
74
|
+
]
|
|
75
|
+
}) : tabs?.extra;
|
|
76
|
+
const tabLabel = tabs?.['aria-label'] ?? ('string' == typeof title ? title : ariaLabel);
|
|
77
|
+
const tabLabelledBy = tabs?.['aria-labelledby'] ?? (tabs?.['aria-label'] == null && null != title ? `${id}-title` : tabs?.['aria-label'] == null ? ariaLabelledBy : void 0);
|
|
78
|
+
const parts = (0, tabs_cjs_namespaceObject.useTabsParts)({
|
|
79
|
+
...tabs,
|
|
80
|
+
items: tabs?.items ?? emptyTabItems,
|
|
81
|
+
type: 'line',
|
|
82
|
+
placement: 'top',
|
|
83
|
+
size: tabs?.size ?? 'md',
|
|
84
|
+
'aria-label': tabLabel,
|
|
85
|
+
'aria-labelledby': tabLabelledBy,
|
|
86
|
+
extra: tabExtra,
|
|
87
|
+
className: (0, classes_cjs_namespaceObject.classes)('leaf-dialog-tabs', hasHeading && 'leaf-dialog-tabs--headed', 'leaf-drawer__tabs', tabs?.className),
|
|
88
|
+
panelsClassName: 'leaf-dialog-panels',
|
|
89
|
+
visibilityKey: open
|
|
90
|
+
});
|
|
91
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
92
|
+
children: [
|
|
93
|
+
(hasHeading || !hasTabs && (null != extra || closable)) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
94
|
+
className: (0, classes_cjs_namespaceObject.classes)('leaf-drawer__header', !hasHeading && 'leaf-drawer__header--compact'),
|
|
95
|
+
children: [
|
|
96
|
+
null != icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
97
|
+
className: "leaf-drawer__icon",
|
|
98
|
+
"aria-hidden": "true",
|
|
99
|
+
children: icon
|
|
100
|
+
}),
|
|
101
|
+
(null != title || null != description) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
102
|
+
className: "leaf-drawer__heading",
|
|
103
|
+
children: [
|
|
104
|
+
null != title && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h2", {
|
|
105
|
+
id: `${id}-title`,
|
|
106
|
+
children: title
|
|
107
|
+
}),
|
|
108
|
+
null != description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
109
|
+
id: `${id}-description`,
|
|
110
|
+
className: "leaf-drawer__description",
|
|
111
|
+
children: description
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
}),
|
|
115
|
+
extraNode,
|
|
116
|
+
closeButton
|
|
117
|
+
]
|
|
118
|
+
}),
|
|
119
|
+
parts && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
120
|
+
...parts.rootProps,
|
|
121
|
+
children: parts.header
|
|
122
|
+
}),
|
|
123
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(scrollbar_cjs_namespaceObject.ScrollbarControl, {
|
|
124
|
+
className: "leaf-drawer__body",
|
|
125
|
+
viewportClassName: "leaf-drawer__viewport",
|
|
126
|
+
orientation: "vertical",
|
|
127
|
+
role: null != title || ariaLabel ? 'region' : 'presentation',
|
|
128
|
+
"aria-labelledby": null != title ? `${id}-title` : void 0,
|
|
129
|
+
"aria-label": null == title ? ariaLabel ?? tabs?.['aria-label'] : void 0,
|
|
130
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
131
|
+
ref: contentRef,
|
|
132
|
+
className: "leaf-drawer__content",
|
|
133
|
+
children: [
|
|
134
|
+
parts?.panels,
|
|
135
|
+
children
|
|
136
|
+
]
|
|
137
|
+
})
|
|
138
|
+
}),
|
|
139
|
+
null != footer && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
140
|
+
className: "leaf-drawer__footer",
|
|
141
|
+
children: footer
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function DrawerSurface({ open, title, description, icon, divided = false, tabs, footer, extra, placement = 'right', width = 380, height = 300, closable = true, maskClosable = true, keyboard = true, onClose, afterClose, forceRender = false, destroyOnClose = false, preserve, initialFocus, returnFocus, container: _container, push = false, resizable = false, minSize = 240, maxSize = 900, onResize, children, className, style, ...props }) {
|
|
49
147
|
const { messages, maskBlur } = (0, context_cjs_namespaceObject.useLeafConfig)();
|
|
50
148
|
const id = (0, external_react_namespaceObject.useId)();
|
|
51
149
|
const panel = (0, external_react_namespaceObject.useRef)(null);
|
|
52
150
|
const backdrop = (0, external_react_namespaceObject.useRef)(null);
|
|
53
151
|
const content = (0, external_react_namespaceObject.useRef)(null);
|
|
54
152
|
const present = (0, presence_cjs_namespaceObject.usePresence)(open, backdrop);
|
|
153
|
+
const hasTabs = Boolean(tabs?.items?.length);
|
|
154
|
+
const hasHeading = null != title || null != description || null != icon;
|
|
55
155
|
const contentRevision = (0, external_react_namespaceObject.useRef)({
|
|
56
156
|
children,
|
|
57
157
|
revision: 0
|
|
@@ -60,7 +160,7 @@ function DrawerSurface({ open, title, description, icon, divided = false, footer
|
|
|
60
160
|
children,
|
|
61
161
|
revision: contentRevision.current.revision + 1
|
|
62
162
|
};
|
|
63
|
-
(0, presence_cjs_namespaceObject.useContentTransition)(content, `${open}:${contentRevision.current.revision}`, 0, true);
|
|
163
|
+
(0, presence_cjs_namespaceObject.useContentTransition)(content, hasTabs ? String(open) : `${open}:${contentRevision.current.revision}`, 0, true);
|
|
64
164
|
const owner = (0, external_react_namespaceObject.useContext)(overlay_owner_cjs_namespaceObject.OverlayOwner);
|
|
65
165
|
const [resized, setResized] = (0, external_react_namespaceObject.useState)();
|
|
66
166
|
const stopDragging = (0, external_react_namespaceObject.useRef)(void 0);
|
|
@@ -134,7 +234,7 @@ function DrawerSurface({ open, title, description, icon, divided = false, footer
|
|
|
134
234
|
null != description && `${id}-description`
|
|
135
235
|
].filter(Boolean).join(' ') || void 0,
|
|
136
236
|
tabIndex: -1,
|
|
137
|
-
className: (0, classes_cjs_namespaceObject.classes)('leaf-drawer', divided && 'leaf-drawer--divided', className),
|
|
237
|
+
className: (0, classes_cjs_namespaceObject.classes)('leaf-drawer', divided && 'leaf-drawer--divided', hasTabs && 'leaf-drawer--tabbed', hasHeading && 'leaf-drawer--headed', className),
|
|
138
238
|
style: {
|
|
139
239
|
...horizontal ? {
|
|
140
240
|
width: resized ?? width,
|
|
@@ -201,65 +301,24 @@ function DrawerSurface({ open, title, description, icon, divided = false, footer
|
|
|
201
301
|
onResize?.(next);
|
|
202
302
|
}
|
|
203
303
|
}),
|
|
204
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
304
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(overlay_owner_cjs_namespaceObject.OverlayOwner.Provider, {
|
|
205
305
|
value: id,
|
|
206
|
-
children:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
null != description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
223
|
-
id: `${id}-description`,
|
|
224
|
-
className: "leaf-drawer__description",
|
|
225
|
-
children: description
|
|
226
|
-
})
|
|
227
|
-
]
|
|
228
|
-
}),
|
|
229
|
-
extra && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
230
|
-
className: "leaf-drawer__extra",
|
|
231
|
-
children: extra
|
|
232
|
-
}),
|
|
233
|
-
closable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
234
|
-
type: "button",
|
|
235
|
-
className: "leaf-drawer__close",
|
|
236
|
-
"aria-label": messages.common.close,
|
|
237
|
-
onClick: onClose,
|
|
238
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.X, {
|
|
239
|
-
size: 16,
|
|
240
|
-
"aria-hidden": "true"
|
|
241
|
-
})
|
|
242
|
-
})
|
|
243
|
-
]
|
|
244
|
-
}),
|
|
245
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(scrollbar_cjs_namespaceObject.ScrollbarControl, {
|
|
246
|
-
className: "leaf-drawer__body",
|
|
247
|
-
viewportClassName: "leaf-drawer__viewport",
|
|
248
|
-
orientation: "vertical",
|
|
249
|
-
role: null != title || props['aria-label'] ? 'region' : 'presentation',
|
|
250
|
-
"aria-labelledby": null != title ? `${id}-title` : void 0,
|
|
251
|
-
"aria-label": null == title ? props['aria-label'] : void 0,
|
|
252
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
253
|
-
ref: content,
|
|
254
|
-
className: "leaf-drawer__content",
|
|
255
|
-
children: children
|
|
256
|
-
})
|
|
257
|
-
}),
|
|
258
|
-
null != footer && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
259
|
-
className: "leaf-drawer__footer",
|
|
260
|
-
children: footer
|
|
261
|
-
})
|
|
262
|
-
]
|
|
306
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DrawerInner, {
|
|
307
|
+
id: id,
|
|
308
|
+
open: open,
|
|
309
|
+
title: title,
|
|
310
|
+
description: description,
|
|
311
|
+
icon: icon,
|
|
312
|
+
tabs: tabs,
|
|
313
|
+
extra: extra,
|
|
314
|
+
footer: footer,
|
|
315
|
+
closable: closable,
|
|
316
|
+
onClose: onClose,
|
|
317
|
+
contentRef: content,
|
|
318
|
+
ariaLabel: props['aria-label'],
|
|
319
|
+
ariaLabelledBy: props['aria-labelledby'],
|
|
320
|
+
children: children
|
|
321
|
+
})
|
|
263
322
|
})
|
|
264
323
|
]
|
|
265
324
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer/drawer.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/drawer/drawer.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { X } from 'lucide-react';\nimport {\n type HTMLAttributes,\n type ReactNode,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { useLeafConfig } from '../config-provider/context';\nimport { ScrollbarControl } from '../scrollbar/scrollbar';\nimport { classes } from '../shared/classes';\nimport { type DialogFocusOptions, useDialog } from '../shared/dialog';\nimport { inertProps } from '../shared/inert';\nimport { OverlayOwner } from '../shared/overlay-owner';\nimport { useContentTransition, usePresence } from '../shared/presence';\nimport { ScopedPortal } from '../shared/scoped-portal';\n\nexport interface DrawerProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onResize'>,\n DialogFocusOptions {\n open: boolean;\n title?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n divided?: boolean;\n footer?: ReactNode;\n extra?: ReactNode;\n placement?: 'left' | 'right' | 'top' | 'bottom';\n width?: number | string;\n height?: number | string;\n closable?: boolean;\n maskClosable?: boolean;\n keyboard?: boolean;\n onClose?: () => void;\n afterClose?: () => void;\n forceRender?: boolean;\n destroyOnClose?: boolean;\n preserve?: boolean;\n container?: Element | DocumentFragment | (() => Element | DocumentFragment);\n push?: boolean | number;\n resizable?: boolean;\n minSize?: number;\n maxSize?: number;\n onResize?: (size: number) => void;\n}\nfunction DrawerSurface({\n open,\n title,\n description,\n icon,\n divided = false,\n footer,\n extra,\n placement = 'right',\n width = 380,\n height = 300,\n closable = true,\n maskClosable = true,\n keyboard = true,\n onClose,\n afterClose,\n forceRender = false,\n destroyOnClose = false,\n preserve,\n initialFocus,\n returnFocus,\n container: _container,\n push = false,\n resizable = false,\n minSize = 240,\n maxSize = 900,\n onResize,\n children,\n className,\n style,\n ...props\n}: DrawerProps) {\n const { messages, maskBlur } = useLeafConfig();\n const id = useId();\n const panel = useRef<HTMLDivElement>(null);\n const backdrop = useRef<HTMLButtonElement>(null);\n const content = useRef<HTMLDivElement>(null);\n const present = usePresence(open, backdrop);\n const contentRevision = useRef({ children, revision: 0 });\n if (children !== contentRevision.current.children)\n contentRevision.current = { children, revision: contentRevision.current.revision + 1 };\n useContentTransition(content, `${open}:${contentRevision.current.revision}`, 0, true);\n const owner = useContext(OverlayOwner);\n const [resized, setResized] = useState<number>();\n const stopDragging = useRef<(() => void) | undefined>(undefined);\n useEffect(() => () => stopDragging.current?.(), []);\n const horizontal = placement === 'left' || placement === 'right';\n // biome-ignore lint/correctness/useExhaustiveDependencies: Resizing resets when the configured dimensions change.\n useEffect(() => {\n setResized(undefined);\n }, [width, height]);\n useEffect(() => {\n if (!open || !push || !owner) return;\n const parent = document.getElementById(owner);\n if (!parent) return;\n const previous = parent.style.transform;\n const distance = typeof push === 'number' ? push : 40;\n parent.style.transform = `translate${horizontal ? 'X' : 'Y'}(${placement === 'right' || placement === 'bottom' ? -distance : distance}px)`;\n return () => {\n parent.style.transform = previous;\n };\n }, [open, push, owner, placement, horizontal]);\n const previous = useRef(false);\n useEffect(() => {\n if (previous.current && !present) afterClose?.();\n previous.current = present;\n }, [present, afterClose]);\n useDialog(open, panel, id, () => onClose?.(), keyboard, { initialFocus, returnFocus });\n const visited = useRef(false);\n if (open) visited.current = true;\n if (\n !present &&\n !forceRender &&\n ((preserve === undefined ? destroyOnClose : !preserve) || !visited.current)\n )\n return null;\n return (\n <div\n hidden={!present}\n className={classes('leaf-drawer-mask', `leaf-drawer-mask--${placement}`)}\n data-blur={maskBlur ? undefined : 'off'}\n data-state={open ? 'open' : 'closing'}\n aria-hidden={!open || undefined}\n {...inertProps(!open)}\n >\n <button\n ref={backdrop}\n type=\"button\"\n tabIndex={-1}\n className=\"leaf-drawer-backdrop\"\n aria-label={messages.common.close}\n onClick={() => {\n if (maskClosable) onClose?.();\n }}\n />\n <div\n {...props}\n ref={panel}\n id={props.id ?? id}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title != null ? `${id}-title` : props['aria-labelledby']}\n aria-describedby={\n [props['aria-describedby'], description != null && `${id}-description`]\n .filter(Boolean)\n .join(' ') || undefined\n }\n tabIndex={-1}\n className={classes('leaf-drawer', divided && 'leaf-drawer--divided', className)}\n style={{\n ...(horizontal\n ? { width: resized ?? width, height: '100%' }\n : { height: resized ?? height, width: '100%' }),\n ...style,\n }}\n >\n {resizable && (\n // biome-ignore lint/a11y/useSemanticElements: This is the adjustable ARIA window-splitter handle, not a decorative separator.\n <div\n role=\"separator\"\n tabIndex={0}\n aria-label={messages.tree.expand}\n aria-orientation={horizontal ? 'vertical' : 'horizontal'}\n aria-valuemin={minSize}\n aria-valuemax={maxSize}\n aria-valuenow={\n resized ??\n (typeof (horizontal ? width : height) === 'number'\n ? Number(horizontal ? width : height)\n : undefined)\n }\n className=\"leaf-drawer__resize\"\n onPointerDown={(event) => {\n if (!panel.current) return;\n stopDragging.current?.();\n event.preventDefault();\n event.currentTarget.setPointerCapture(event.pointerId);\n const start = horizontal ? event.clientX : event.clientY;\n const bounds = panel.current.getBoundingClientRect();\n const size = horizontal ? bounds.width : bounds.height;\n const update = (event: PointerEvent) => {\n const next = Math.min(\n maxSize,\n Math.max(\n minSize,\n size +\n ((horizontal ? event.clientX : event.clientY) - start) *\n (placement === 'right' || placement === 'bottom' ? -1 : 1),\n ),\n );\n setResized(next);\n onResize?.(next);\n };\n const end = () => {\n window.removeEventListener('pointermove', update);\n window.removeEventListener('pointerup', end);\n window.removeEventListener('pointercancel', end);\n };\n stopDragging.current = end;\n window.addEventListener('pointermove', update);\n window.addEventListener('pointerup', end, { once: true });\n window.addEventListener('pointercancel', end, { once: true });\n }}\n onKeyDown={(event) => {\n if (!panel.current) return;\n if (!['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)) return;\n event.preventDefault();\n const bounds = panel.current.getBoundingClientRect();\n const size = horizontal ? bounds.width : bounds.height;\n const next = Math.min(\n maxSize,\n Math.max(\n minSize,\n size +\n (['ArrowRight', 'ArrowDown'].includes(event.key) ? 10 : -10) *\n (placement === 'right' || placement === 'bottom' ? -1 : 1),\n ),\n );\n setResized(next);\n onResize?.(next);\n }}\n />\n )}\n <OverlayOwner.Provider value={id}>\n {(title != null || description != null || icon != null || closable || extra) && (\n <div\n className={classes(\n 'leaf-drawer__header',\n title == null &&\n description == null &&\n icon == null &&\n 'leaf-drawer__header--compact',\n )}\n >\n {icon != null && (\n <span className=\"leaf-drawer__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n {(title != null || description != null) && (\n <div className=\"leaf-drawer__heading\">\n {title != null && <h2 id={`${id}-title`}>{title}</h2>}\n {description != null && (\n <div id={`${id}-description`} className=\"leaf-drawer__description\">\n {description}\n </div>\n )}\n </div>\n )}\n {extra && <div className=\"leaf-drawer__extra\">{extra}</div>}\n {closable && (\n <button\n type=\"button\"\n className=\"leaf-drawer__close\"\n aria-label={messages.common.close}\n onClick={onClose}\n >\n <X size={16} aria-hidden=\"true\" />\n </button>\n )}\n </div>\n )}\n <ScrollbarControl\n className=\"leaf-drawer__body\"\n viewportClassName=\"leaf-drawer__viewport\"\n orientation=\"vertical\"\n role={title != null || props['aria-label'] ? 'region' : 'presentation'}\n aria-labelledby={title != null ? `${id}-title` : undefined}\n aria-label={title == null ? props['aria-label'] : undefined}\n >\n <div ref={content} className=\"leaf-drawer__content\">\n {children}\n </div>\n </ScrollbarControl>\n {footer != null && <div className=\"leaf-drawer__footer\">{footer}</div>}\n </OverlayOwner.Provider>\n </div>\n </div>\n );\n}\nexport function Drawer(rawProps: DrawerProps) {\n const props = useComponentProps('Drawer', rawProps);\n return (\n <ScopedPortal container={props.container}>\n <DrawerSurface {...props} />\n </ScopedPortal>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","DrawerSurface","open","title","description","icon","divided","footer","extra","placement","width","height","closable","maskClosable","keyboard","onClose","afterClose","forceRender","destroyOnClose","preserve","initialFocus","returnFocus","_container","push","resizable","minSize","maxSize","onResize","children","className","style","props","messages","maskBlur","useLeafConfig","id","useId","panel","useRef","backdrop","content","present","usePresence","contentRevision","useContentTransition","owner","useContext","OverlayOwner","resized","setResized","useState","stopDragging","undefined","useEffect","horizontal","parent","document","previous","distance","useDialog","visited","classes","inertProps","Boolean","Number","event","start","bounds","size","update","next","Math","end","window","X","ScrollbarControl","Drawer","rawProps","useComponentProps","ScopedPortal"],"mappings":";;;;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,IAAGJ,oBAAoB,CAAC,CAACI,MAAME,QAAQ,CAACN,oBAAoB,CAAC,CAAC,UAASM,MACtEC,OAAO,cAAc,CAAC,UAASD,KAAK;gBAAE,YAAY;gBAAM,CAACD,KAAK,EAAED,IAAI,CAACE,IAAI;YAAC;QAG7E;QACAH,OAAOF,SAAS;QAChBE,OAAOD,QAAQ;IAChB;;;ICVAF,oBAAoB,CAAC,GAAG,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;IAC1C,OACE,AADK,WAAP,GACE,qCAACE,kCAAAA,YAAYA,EAAAA;QAAC,WAAWhD,MAAM,SAAS;kBACtC,mDAAC9B,eAAAA;YAAe,GAAG8B,KAAK;;;AAG9B"}
|
|
1
|
+
{"version":3,"file":"drawer/drawer.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/drawer/drawer.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { X } from 'lucide-react';\nimport {\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { useLeafConfig } from '../config-provider/context';\nimport { ScrollbarControl } from '../scrollbar/scrollbar';\nimport { classes } from '../shared/classes';\nimport { type DialogFocusOptions, useDialog } from '../shared/dialog';\nimport { inertProps } from '../shared/inert';\nimport { OverlayOwner } from '../shared/overlay-owner';\nimport { useContentTransition, usePresence } from '../shared/presence';\nimport { ScopedPortal } from '../shared/scoped-portal';\nimport { type TabItem, type TabsProps, useTabsParts } from '../tabs/tabs';\n\nconst emptyTabItems: readonly TabItem[] = [];\n\n/** Tabs controls integrated with the drawer; Drawer fixes the line type and top placement. */\nexport interface DrawerTabsProps extends Omit<TabsProps, 'type' | 'placement' | 'children'> {}\n\nexport interface DrawerProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onResize'>,\n DialogFocusOptions {\n open: boolean;\n title?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n divided?: boolean;\n /** Embedded tabs placed below the heading, or replacing it when no title is supplied. */\n tabs?: DrawerTabsProps;\n footer?: ReactNode;\n extra?: ReactNode;\n placement?: 'left' | 'right' | 'top' | 'bottom';\n width?: number | string;\n height?: number | string;\n closable?: boolean;\n maskClosable?: boolean;\n keyboard?: boolean;\n onClose?: () => void;\n afterClose?: () => void;\n forceRender?: boolean;\n destroyOnClose?: boolean;\n preserve?: boolean;\n container?: Element | DocumentFragment | (() => Element | DocumentFragment);\n push?: boolean | number;\n resizable?: boolean;\n minSize?: number;\n maxSize?: number;\n onResize?: (size: number) => void;\n}\n\ninterface DrawerInnerProps {\n id: string;\n open: boolean;\n title?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n tabs?: DrawerTabsProps;\n extra?: ReactNode;\n footer?: ReactNode;\n closable: boolean;\n onClose?: () => void;\n contentRef: Ref<HTMLDivElement>;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n children?: ReactNode;\n}\n\nfunction DrawerInner({\n id,\n open,\n title,\n description,\n icon,\n tabs,\n extra,\n footer,\n closable,\n onClose,\n contentRef,\n ariaLabel,\n ariaLabelledBy,\n children,\n}: DrawerInnerProps) {\n const { messages } = useLeafConfig();\n const hasTabs = Boolean(tabs?.items?.length);\n const hasHeading = title != null || description != null || icon != null;\n const closeButton = closable ? (\n <button\n type=\"button\"\n className=\"leaf-drawer__close\"\n aria-label={messages.common.close}\n onClick={onClose}\n >\n <X size={16} aria-hidden=\"true\" />\n </button>\n ) : null;\n const extraNode = extra != null ? <div className=\"leaf-drawer__extra\">{extra}</div> : null;\n const tabExtra =\n !hasHeading && (extra != null || closable) ? (\n <div className=\"leaf-dialog-tab-extra leaf-drawer__tab-extra\">\n {tabs?.extra}\n {extraNode}\n {closeButton}\n </div>\n ) : (\n tabs?.extra\n );\n const tabLabel = tabs?.['aria-label'] ?? (typeof title === 'string' ? title : ariaLabel);\n const tabLabelledBy =\n tabs?.['aria-labelledby'] ??\n (tabs?.['aria-label'] == null && title != null\n ? `${id}-title`\n : tabs?.['aria-label'] == null\n ? ariaLabelledBy\n : undefined);\n const parts = useTabsParts({\n ...tabs,\n items: tabs?.items ?? emptyTabItems,\n type: 'line',\n placement: 'top',\n size: tabs?.size ?? 'md',\n 'aria-label': tabLabel,\n 'aria-labelledby': tabLabelledBy,\n extra: tabExtra,\n className: classes(\n 'leaf-dialog-tabs',\n hasHeading && 'leaf-dialog-tabs--headed',\n 'leaf-drawer__tabs',\n tabs?.className,\n ),\n panelsClassName: 'leaf-dialog-panels',\n visibilityKey: open,\n });\n\n return (\n <>\n {(hasHeading || (!hasTabs && (extra != null || closable))) && (\n <div\n className={classes('leaf-drawer__header', !hasHeading && 'leaf-drawer__header--compact')}\n >\n {icon != null && (\n <span className=\"leaf-drawer__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n {(title != null || description != null) && (\n <div className=\"leaf-drawer__heading\">\n {title != null && <h2 id={`${id}-title`}>{title}</h2>}\n {description != null && (\n <div id={`${id}-description`} className=\"leaf-drawer__description\">\n {description}\n </div>\n )}\n </div>\n )}\n {extraNode}\n {closeButton}\n </div>\n )}\n {parts && <div {...parts.rootProps}>{parts.header}</div>}\n <ScrollbarControl\n className=\"leaf-drawer__body\"\n viewportClassName=\"leaf-drawer__viewport\"\n orientation=\"vertical\"\n role={title != null || ariaLabel ? 'region' : 'presentation'}\n aria-labelledby={title != null ? `${id}-title` : undefined}\n aria-label={title == null ? (ariaLabel ?? tabs?.['aria-label']) : undefined}\n >\n <div ref={contentRef} className=\"leaf-drawer__content\">\n {parts?.panels}\n {children}\n </div>\n </ScrollbarControl>\n {footer != null && <div className=\"leaf-drawer__footer\">{footer}</div>}\n </>\n );\n}\n\nfunction DrawerSurface({\n open,\n title,\n description,\n icon,\n divided = false,\n tabs,\n footer,\n extra,\n placement = 'right',\n width = 380,\n height = 300,\n closable = true,\n maskClosable = true,\n keyboard = true,\n onClose,\n afterClose,\n forceRender = false,\n destroyOnClose = false,\n preserve,\n initialFocus,\n returnFocus,\n container: _container,\n push = false,\n resizable = false,\n minSize = 240,\n maxSize = 900,\n onResize,\n children,\n className,\n style,\n ...props\n}: DrawerProps) {\n const { messages, maskBlur } = useLeafConfig();\n const id = useId();\n const panel = useRef<HTMLDivElement>(null);\n const backdrop = useRef<HTMLButtonElement>(null);\n const content = useRef<HTMLDivElement>(null);\n const present = usePresence(open, backdrop);\n const hasTabs = Boolean(tabs?.items?.length);\n const hasHeading = title != null || description != null || icon != null;\n const contentRevision = useRef({ children, revision: 0 });\n if (children !== contentRevision.current.children)\n contentRevision.current = { children, revision: contentRevision.current.revision + 1 };\n useContentTransition(\n content,\n hasTabs ? String(open) : `${open}:${contentRevision.current.revision}`,\n 0,\n true,\n );\n const owner = useContext(OverlayOwner);\n const [resized, setResized] = useState<number>();\n const stopDragging = useRef<(() => void) | undefined>(undefined);\n useEffect(() => () => stopDragging.current?.(), []);\n const horizontal = placement === 'left' || placement === 'right';\n // biome-ignore lint/correctness/useExhaustiveDependencies: Resizing resets when the configured dimensions change.\n useEffect(() => {\n setResized(undefined);\n }, [width, height]);\n useEffect(() => {\n if (!open || !push || !owner) return;\n const parent = document.getElementById(owner);\n if (!parent) return;\n const previous = parent.style.transform;\n const distance = typeof push === 'number' ? push : 40;\n parent.style.transform = `translate${horizontal ? 'X' : 'Y'}(${placement === 'right' || placement === 'bottom' ? -distance : distance}px)`;\n return () => {\n parent.style.transform = previous;\n };\n }, [open, push, owner, placement, horizontal]);\n const previous = useRef(false);\n useEffect(() => {\n if (previous.current && !present) afterClose?.();\n previous.current = present;\n }, [present, afterClose]);\n useDialog(open, panel, id, () => onClose?.(), keyboard, { initialFocus, returnFocus });\n const visited = useRef(false);\n if (open) visited.current = true;\n if (\n !present &&\n !forceRender &&\n ((preserve === undefined ? destroyOnClose : !preserve) || !visited.current)\n )\n return null;\n return (\n <div\n hidden={!present}\n className={classes('leaf-drawer-mask', `leaf-drawer-mask--${placement}`)}\n data-blur={maskBlur ? undefined : 'off'}\n data-state={open ? 'open' : 'closing'}\n aria-hidden={!open || undefined}\n {...inertProps(!open)}\n >\n <button\n ref={backdrop}\n type=\"button\"\n tabIndex={-1}\n className=\"leaf-drawer-backdrop\"\n aria-label={messages.common.close}\n onClick={() => {\n if (maskClosable) onClose?.();\n }}\n />\n <div\n {...props}\n ref={panel}\n id={props.id ?? id}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title != null ? `${id}-title` : props['aria-labelledby']}\n aria-describedby={\n [props['aria-describedby'], description != null && `${id}-description`]\n .filter(Boolean)\n .join(' ') || undefined\n }\n tabIndex={-1}\n className={classes(\n 'leaf-drawer',\n divided && 'leaf-drawer--divided',\n hasTabs && 'leaf-drawer--tabbed',\n hasHeading && 'leaf-drawer--headed',\n className,\n )}\n style={{\n ...(horizontal\n ? { width: resized ?? width, height: '100%' }\n : { height: resized ?? height, width: '100%' }),\n ...style,\n }}\n >\n {resizable && (\n // biome-ignore lint/a11y/useSemanticElements: This is the adjustable ARIA window-splitter handle, not a decorative separator.\n <div\n role=\"separator\"\n tabIndex={0}\n aria-label={messages.tree.expand}\n aria-orientation={horizontal ? 'vertical' : 'horizontal'}\n aria-valuemin={minSize}\n aria-valuemax={maxSize}\n aria-valuenow={\n resized ??\n (typeof (horizontal ? width : height) === 'number'\n ? Number(horizontal ? width : height)\n : undefined)\n }\n className=\"leaf-drawer__resize\"\n onPointerDown={(event) => {\n if (!panel.current) return;\n stopDragging.current?.();\n event.preventDefault();\n event.currentTarget.setPointerCapture(event.pointerId);\n const start = horizontal ? event.clientX : event.clientY;\n const bounds = panel.current.getBoundingClientRect();\n const size = horizontal ? bounds.width : bounds.height;\n const update = (event: PointerEvent) => {\n const next = Math.min(\n maxSize,\n Math.max(\n minSize,\n size +\n ((horizontal ? event.clientX : event.clientY) - start) *\n (placement === 'right' || placement === 'bottom' ? -1 : 1),\n ),\n );\n setResized(next);\n onResize?.(next);\n };\n const end = () => {\n window.removeEventListener('pointermove', update);\n window.removeEventListener('pointerup', end);\n window.removeEventListener('pointercancel', end);\n };\n stopDragging.current = end;\n window.addEventListener('pointermove', update);\n window.addEventListener('pointerup', end, { once: true });\n window.addEventListener('pointercancel', end, { once: true });\n }}\n onKeyDown={(event) => {\n if (!panel.current) return;\n if (!['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)) return;\n event.preventDefault();\n const bounds = panel.current.getBoundingClientRect();\n const size = horizontal ? bounds.width : bounds.height;\n const next = Math.min(\n maxSize,\n Math.max(\n minSize,\n size +\n (['ArrowRight', 'ArrowDown'].includes(event.key) ? 10 : -10) *\n (placement === 'right' || placement === 'bottom' ? -1 : 1),\n ),\n );\n setResized(next);\n onResize?.(next);\n }}\n />\n )}\n <OverlayOwner.Provider value={id}>\n <DrawerInner\n id={id}\n open={open}\n title={title}\n description={description}\n icon={icon}\n tabs={tabs}\n extra={extra}\n footer={footer}\n closable={closable}\n onClose={onClose}\n contentRef={content}\n ariaLabel={props['aria-label']}\n ariaLabelledBy={props['aria-labelledby']}\n >\n {children}\n </DrawerInner>\n </OverlayOwner.Provider>\n </div>\n </div>\n );\n}\nexport function Drawer(rawProps: DrawerProps) {\n const props = useComponentProps('Drawer', rawProps);\n return (\n <ScopedPortal container={props.container}>\n <DrawerSurface {...props} />\n </ScopedPortal>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","emptyTabItems","DrawerInner","id","open","title","description","icon","tabs","extra","footer","closable","onClose","contentRef","ariaLabel","ariaLabelledBy","children","messages","useLeafConfig","hasTabs","Boolean","hasHeading","closeButton","X","extraNode","tabExtra","tabLabel","tabLabelledBy","undefined","parts","useTabsParts","classes","ScrollbarControl","DrawerSurface","divided","placement","width","height","maskClosable","keyboard","afterClose","forceRender","destroyOnClose","preserve","initialFocus","returnFocus","_container","push","resizable","minSize","maxSize","onResize","className","style","props","maskBlur","useId","panel","useRef","backdrop","content","present","usePresence","contentRevision","useContentTransition","String","owner","useContext","OverlayOwner","resized","setResized","useState","stopDragging","useEffect","horizontal","parent","document","previous","distance","useDialog","visited","inertProps","Number","event","start","bounds","size","update","next","Math","end","window","Drawer","rawProps","useComponentProps","ScopedPortal"],"mappings":";;;;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,IAAGJ,oBAAoB,CAAC,CAACI,MAAME,QAAQ,CAACN,oBAAoB,CAAC,CAAC,UAASM,MACtEC,OAAO,cAAc,CAAC,UAASD,KAAK;gBAAE,YAAY;gBAAM,CAACD,KAAK,EAAED,IAAI,CAACE,IAAI;YAAC;QAG7E;QACAH,OAAOF,SAAS;QAChBE,OAAOD,QAAQ;IAChB;;;ICVAF,oBAAoB,CAAC,GAAG,CAACQ,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFT,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOU,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;ACgBA,MAAMI,gBAAoC,EAAE;AAqD5C,SAASC,YAAY,EACnBC,EAAE,EACFC,IAAI,EACJC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,QAAQ,EACS;IACjB,MA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M,SAAS;kBACtC,mDAACrB,eAAAA;YAAe,GAAGqB,KAAK;;;AAG9B"}
|
|
@@ -40,7 +40,7 @@ const external_react_namespaceObject = require("react");
|
|
|
40
40
|
const button_cjs_namespaceObject = require("../button/button.cjs");
|
|
41
41
|
const component_defaults_cjs_namespaceObject = require("../config-provider/component-defaults.cjs");
|
|
42
42
|
const image_cjs_namespaceObject = require("../image/image.cjs");
|
|
43
|
-
const
|
|
43
|
+
const base_cjs_namespaceObject = require("../modal/base.cjs");
|
|
44
44
|
const classes_cjs_namespaceObject = require("../shared/classes.cjs");
|
|
45
45
|
const motion_cjs_namespaceObject = require("../shared/motion.cjs");
|
|
46
46
|
const use_formatted_text_cjs_namespaceObject = require("../shared/use-formatted-text.cjs");
|
|
@@ -415,7 +415,7 @@ function FileListControl({ items, downloadable = true, previewable = true, remov
|
|
|
415
415
|
onClose: ()=>setPreview(null),
|
|
416
416
|
downloadable: downloadable && !disabled
|
|
417
417
|
}),
|
|
418
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(
|
|
418
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(base_cjs_namespaceObject.ModalBase, {
|
|
419
419
|
open: Boolean(previewUrl && ('video' === kind || 'audio' === kind)),
|
|
420
420
|
title: selected ? (0, external_model_cjs_namespaceObject.fileName)(selected) : '',
|
|
421
421
|
footer: null,
|