@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.
Files changed (145) hide show
  1. package/dist/cjs/browser/modules/card/card.cjs +29 -14
  2. package/dist/cjs/browser/modules/card/card.cjs.map +1 -1
  3. package/dist/cjs/browser/modules/confirm/confirm.cjs +2 -2
  4. package/dist/cjs/browser/modules/confirm/confirm.cjs.map +1 -1
  5. package/dist/cjs/browser/modules/drawer/drawer.cjs +120 -61
  6. package/dist/cjs/browser/modules/drawer/drawer.cjs.map +1 -1
  7. package/dist/cjs/browser/modules/filelist/filelist.cjs +2 -2
  8. package/dist/cjs/browser/modules/filelist/filelist.cjs.map +1 -1
  9. package/dist/cjs/browser/modules/modal/base.cjs +287 -0
  10. package/dist/cjs/browser/modules/modal/base.cjs.map +1 -0
  11. package/dist/cjs/browser/modules/modal/modal.cjs +64 -209
  12. package/dist/cjs/browser/modules/modal/modal.cjs.map +1 -1
  13. package/dist/cjs/browser/modules/shared/presence.cjs +12 -6
  14. package/dist/cjs/browser/modules/shared/presence.cjs.map +1 -1
  15. package/dist/cjs/browser/modules/tabletanstack/tabletanstack.cjs +14 -2
  16. package/dist/cjs/browser/modules/tabletanstack/tabletanstack.cjs.map +1 -1
  17. package/dist/cjs/browser/modules/tabs/tabs.cjs +194 -174
  18. package/dist/cjs/browser/modules/tabs/tabs.cjs.map +1 -1
  19. package/dist/cjs/card/card.cjs +29 -14
  20. package/dist/cjs/card/card.cjs.map +1 -1
  21. package/dist/cjs/card/card.d.cts.map +1 -1
  22. package/dist/cjs/confirm/confirm.cjs +2 -2
  23. package/dist/cjs/confirm/confirm.cjs.map +1 -1
  24. package/dist/cjs/drawer/drawer.cjs +120 -61
  25. package/dist/cjs/drawer/drawer.cjs.map +1 -1
  26. package/dist/cjs/drawer/drawer.d.cts +6 -0
  27. package/dist/cjs/drawer/drawer.d.cts.map +1 -1
  28. package/dist/cjs/drawer/index.d.cts +1 -1
  29. package/dist/cjs/drawer/index.d.cts.map +1 -1
  30. package/dist/cjs/filelist/filelist.cjs +2 -2
  31. package/dist/cjs/filelist/filelist.cjs.map +1 -1
  32. package/dist/cjs/index.d.cts +2 -2
  33. package/dist/cjs/index.d.cts.map +1 -1
  34. package/dist/cjs/modal/base.cjs +285 -0
  35. package/dist/cjs/modal/base.cjs.map +1 -0
  36. package/dist/cjs/modal/base.d.cts +23 -0
  37. package/dist/cjs/modal/base.d.cts.map +1 -0
  38. package/dist/cjs/modal/index.d.cts +1 -1
  39. package/dist/cjs/modal/index.d.cts.map +1 -1
  40. package/dist/cjs/modal/modal.cjs +64 -209
  41. package/dist/cjs/modal/modal.cjs.map +1 -1
  42. package/dist/cjs/modal/modal.d.cts +8 -3
  43. package/dist/cjs/modal/modal.d.cts.map +1 -1
  44. package/dist/cjs/shared/presence.cjs +12 -6
  45. package/dist/cjs/shared/presence.cjs.map +1 -1
  46. package/dist/cjs/shared/presence.d.cts +1 -1
  47. package/dist/cjs/shared/presence.d.cts.map +1 -1
  48. package/dist/cjs/styles/card.css +1 -1
  49. package/dist/cjs/styles/colorpicker.css +1 -1
  50. package/dist/cjs/styles/components/card.css +1 -1
  51. package/dist/cjs/styles/components/drawer.css +1 -1
  52. package/dist/cjs/styles/components/modal.css +1 -1
  53. package/dist/cjs/styles/components/tabletanstack.css +1 -1
  54. package/dist/cjs/styles/components/tabs.css +1 -1
  55. package/dist/cjs/styles/config-provider.css +1 -1
  56. package/dist/cjs/styles/confirm.css +1 -1
  57. package/dist/cjs/styles/daterangepicker.css +1 -1
  58. package/dist/cjs/styles/drawer.css +1 -1
  59. package/dist/cjs/styles/filelist.css +1 -1
  60. package/dist/cjs/styles/index.css +79 -22
  61. package/dist/cjs/styles/index.css.map +1 -1
  62. package/dist/cjs/styles/modal.css +1 -1
  63. package/dist/cjs/styles/tabletanstack.css +1 -1
  64. package/dist/cjs/styles/tabs.css +1 -1
  65. package/dist/cjs/styles/upload.css +1 -1
  66. package/dist/cjs/tabletanstack/tabletanstack.cjs +14 -2
  67. package/dist/cjs/tabletanstack/tabletanstack.cjs.map +1 -1
  68. package/dist/cjs/tabletanstack/tabletanstack.d.cts.map +1 -1
  69. package/dist/cjs/tabs/tabs.cjs +194 -174
  70. package/dist/cjs/tabs/tabs.cjs.map +1 -1
  71. package/dist/cjs/tabs/tabs.d.cts +14 -1
  72. package/dist/cjs/tabs/tabs.d.cts.map +1 -1
  73. package/dist/esm/browser/modules/card/card.js +30 -15
  74. package/dist/esm/browser/modules/card/card.js.map +1 -1
  75. package/dist/esm/browser/modules/confirm/confirm.js +1 -1
  76. package/dist/esm/browser/modules/confirm/confirm.js.map +1 -1
  77. package/dist/esm/browser/modules/drawer/drawer.js +121 -62
  78. package/dist/esm/browser/modules/drawer/drawer.js.map +1 -1
  79. package/dist/esm/browser/modules/filelist/filelist.js +1 -1
  80. package/dist/esm/browser/modules/filelist/filelist.js.map +1 -1
  81. package/dist/esm/browser/modules/modal/base.js +249 -0
  82. package/dist/esm/browser/modules/modal/base.js.map +1 -0
  83. package/dist/esm/browser/modules/modal/modal.js +65 -207
  84. package/dist/esm/browser/modules/modal/modal.js.map +1 -1
  85. package/dist/esm/browser/modules/shared/presence.js +12 -6
  86. package/dist/esm/browser/modules/shared/presence.js.map +1 -1
  87. package/dist/esm/browser/modules/tabletanstack/tabletanstack.js +14 -2
  88. package/dist/esm/browser/modules/tabletanstack/tabletanstack.js.map +1 -1
  89. package/dist/esm/browser/modules/tabs/tabs.js +190 -173
  90. package/dist/esm/browser/modules/tabs/tabs.js.map +1 -1
  91. package/dist/esm/card/card.d.ts.map +1 -1
  92. package/dist/esm/card/card.js +30 -15
  93. package/dist/esm/card/card.js.map +1 -1
  94. package/dist/esm/confirm/confirm.js +1 -1
  95. package/dist/esm/confirm/confirm.js.map +1 -1
  96. package/dist/esm/drawer/drawer.d.ts +6 -0
  97. package/dist/esm/drawer/drawer.d.ts.map +1 -1
  98. package/dist/esm/drawer/drawer.js +121 -62
  99. package/dist/esm/drawer/drawer.js.map +1 -1
  100. package/dist/esm/drawer/index.d.ts +1 -1
  101. package/dist/esm/drawer/index.d.ts.map +1 -1
  102. package/dist/esm/filelist/filelist.js +1 -1
  103. package/dist/esm/filelist/filelist.js.map +1 -1
  104. package/dist/esm/index.d.ts +2 -2
  105. package/dist/esm/index.d.ts.map +1 -1
  106. package/dist/esm/modal/base.d.ts +23 -0
  107. package/dist/esm/modal/base.d.ts.map +1 -0
  108. package/dist/esm/modal/base.js +247 -0
  109. package/dist/esm/modal/base.js.map +1 -0
  110. package/dist/esm/modal/index.d.ts +1 -1
  111. package/dist/esm/modal/index.d.ts.map +1 -1
  112. package/dist/esm/modal/modal.d.ts +8 -3
  113. package/dist/esm/modal/modal.d.ts.map +1 -1
  114. package/dist/esm/modal/modal.js +65 -207
  115. package/dist/esm/modal/modal.js.map +1 -1
  116. package/dist/esm/shared/presence.d.ts +1 -1
  117. package/dist/esm/shared/presence.d.ts.map +1 -1
  118. package/dist/esm/shared/presence.js +12 -6
  119. package/dist/esm/shared/presence.js.map +1 -1
  120. package/dist/esm/styles/card.css +1 -1
  121. package/dist/esm/styles/colorpicker.css +1 -1
  122. package/dist/esm/styles/components/card.css +1 -1
  123. package/dist/esm/styles/components/drawer.css +1 -1
  124. package/dist/esm/styles/components/modal.css +1 -1
  125. package/dist/esm/styles/components/tabletanstack.css +1 -1
  126. package/dist/esm/styles/components/tabs.css +1 -1
  127. package/dist/esm/styles/config-provider.css +1 -1
  128. package/dist/esm/styles/confirm.css +1 -1
  129. package/dist/esm/styles/daterangepicker.css +1 -1
  130. package/dist/esm/styles/drawer.css +1 -1
  131. package/dist/esm/styles/filelist.css +1 -1
  132. package/dist/esm/styles/index.css +79 -22
  133. package/dist/esm/styles/index.css.map +1 -1
  134. package/dist/esm/styles/modal.css +1 -1
  135. package/dist/esm/styles/tabletanstack.css +1 -1
  136. package/dist/esm/styles/tabs.css +1 -1
  137. package/dist/esm/styles/upload.css +1 -1
  138. package/dist/esm/tabletanstack/tabletanstack.d.ts.map +1 -1
  139. package/dist/esm/tabletanstack/tabletanstack.js +14 -2
  140. package/dist/esm/tabletanstack/tabletanstack.js.map +1 -1
  141. package/dist/esm/tabs/tabs.d.ts +14 -1
  142. package/dist/esm/tabs/tabs.d.ts.map +1 -1
  143. package/dist/esm/tabs/tabs.js +190 -173
  144. package/dist/esm/tabs/tabs.js.map +1 -1
  145. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useRef } from "react";
3
+ import { useId, useMemo, useRef } from "react";
4
4
  import { useComponentProps } from "../config-provider/component-defaults.js";
5
5
  import { classes } from "../shared/classes.js";
6
6
  import { useContentTransition } from "../shared/presence.js";
@@ -9,10 +9,12 @@ import { TabsControl } from "../tabs/tabs.js";
9
9
  import { CardTitleControl } from "./title.js";
10
10
  function Card(rawProps) {
11
11
  const { title, description, extra, tabs, cover, footer, loading = false, bordered = true, shadow = true, selected = false, variant = 'default', size = 'md', children, className, ...props } = useComponentProps('Card', rawProps);
12
+ const titleId = useId();
12
13
  const body = useRef(null);
13
- useContentTransition(body, loading ? 'loading' : 'content');
14
- const hasTabs = Boolean(tabs?.items.length);
15
- const hasTabPanels = Boolean(tabs?.items.some((item)=>null != item.children));
14
+ useContentTransition(body, loading ? 'loading' : 'content', 0, true);
15
+ const rawTabItems = tabs?.items;
16
+ const hasTabs = Boolean(rawTabItems?.length);
17
+ const hasTabPanels = Boolean(rawTabItems?.some((item)=>null != item.children));
16
18
  const layered = 'layered' === variant;
17
19
  const visibleDescription = layered ? void 0 : description;
18
20
  const hasHeading = null != title || null != visibleDescription;
@@ -28,34 +30,46 @@ function Card(rawProps) {
28
30
  extra
29
31
  ]
30
32
  });
33
+ const tabItems = useMemo(()=>{
34
+ if (!rawTabItems?.length) return;
35
+ if (!hasTabPanels) return rawTabItems;
36
+ return rawTabItems.map((item)=>({
37
+ ...item,
38
+ children: null != item.children ? /*#__PURE__*/ jsx(SkeletonControl, {
39
+ loading: loading,
40
+ children: item.children
41
+ }) : item.children
42
+ }));
43
+ }, [
44
+ rawTabItems,
45
+ hasTabPanels,
46
+ loading
47
+ ]);
48
+ const tabLabel = tabs?.['aria-label'] ?? ('string' == typeof title ? title : void 0);
49
+ const tabLabelledBy = tabs?.['aria-labelledby'] ?? (tabs?.['aria-label'] == null && null != title ? titleId : void 0);
31
50
  const content = /*#__PURE__*/ jsxs(Fragment, {
32
51
  children: [
33
52
  null != cover && /*#__PURE__*/ jsx("div", {
34
53
  className: "leaf-card__cover",
35
54
  children: cover
36
55
  }),
37
- hasTabs && tabs && /*#__PURE__*/ jsx(TabsControl, {
56
+ hasTabs && tabs && tabItems && /*#__PURE__*/ jsx(TabsControl, {
38
57
  ...tabs,
39
58
  type: "line",
40
59
  placement: "top",
41
60
  size: tabs.size ?? size,
42
- "aria-label": tabs['aria-label'] ?? ('string' == typeof title ? title : void 0),
61
+ "aria-label": tabLabel,
62
+ "aria-labelledby": tabLabelledBy,
43
63
  extra: tabExtra,
44
64
  className: classes('leaf-card__tabs', tabs.className),
45
- items: tabs.items.map((item)=>({
46
- ...item,
47
- children: null != item.children ? /*#__PURE__*/ jsx(SkeletonControl, {
48
- loading: loading,
49
- children: item.children
50
- }) : item.children
51
- })),
52
- onReorder: tabs.onReorder && ((items)=>{
65
+ items: tabItems,
66
+ onReorder: tabs.onReorder && (hasTabPanels ? (items)=>{
53
67
  const originals = new Map(tabs.items.map((item)=>[
54
68
  item.key,
55
69
  item
56
70
  ]));
57
71
  tabs.onReorder?.(items.map((item)=>originals.get(item.key) ?? item));
58
- })
72
+ } : tabs.onReorder)
59
73
  }),
60
74
  hasBody && /*#__PURE__*/ jsx("div", {
61
75
  className: "leaf-card__body",
@@ -80,6 +94,7 @@ function Card(rawProps) {
80
94
  className: "leaf-card__heading",
81
95
  children: [
82
96
  null != title && /*#__PURE__*/ jsx(CardTitleControl, {
97
+ id: titleId,
83
98
  size: size,
84
99
  className: "leaf-card__title",
85
100
  children: title
@@ -1 +1 @@
1
- {"version":3,"file":"card/card.js","sources":["../../../src/card/card.tsx"],"sourcesContent":["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":["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":";;;;;;;;;AAgCO,SAASA,KAAKC,QAAmB;IACtC,MAAM,EACJC,KAAK,EACLC,WAAW,EACXC,KAAK,EACLC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,UAAU,KAAK,EACfC,WAAW,IAAI,EACfC,SAAS,IAAI,EACbC,WAAW,KAAK,EAChBC,UAAU,SAAS,EACnBC,OAAO,IAAI,EACXC,QAAQ,EACRC,SAAS,EACT,GAAGC,OACJ,GAAGC,kBAAkB,QAAQhB;IAC9B,MAAMiB,OAAOC,OAAuB;IACpCC,qBAAqBF,MAAMV,UAAU,YAAY;IACjD,MAAMa,UAAUC,QAAQjB,MAAM,MAAM;IACpC,MAAMkB,eAAeD,QAAQjB,MAAM,MAAM,KAAK,CAACmB,OAASA,AAAiB,QAAjBA,KAAK,QAAQ;IACrE,MAAMC,UAAUb,AAAY,cAAZA;IAChB,MAAMc,qBAAqBD,UAAUE,SAAYxB;IACjD,MAAMyB,aAAa1B,AAAS,QAATA,SAAiBwB,AAAsB,QAAtBA;IAEpC,MAAMG,UAAUf,AAAY,QAAZA,YAAqB,CAACS,gBAAgBf,WAAa,CAACa,WAAWf,AAAS,QAATA;IAC/E,MAAMwB,gBAAgBvB,AAAU,QAAVA,UAAkB,WAAR,GAAQ,IAAC;QAAI,WAAU;kBAAqBA;;IAC5E,MAAMwB,WACJ,AAACH,cAAcxB,AAAS,QAATA,QAMbC,MAAM,QANuB,WAAP,GACtB,KAAC;QAAI,WAAU;;YACZA,MAAM;YACND;;;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AS,QAATA,KAAY,KAAC,cACxC,KAAC;gBAAI,WAAU;;oBACZwB,cAAc,WAAdA,GACC,KAAC;wBAAI,WAAU;;4BACH,QAAT1B,SAAiB,WAAR,GACR,IAACqC,kBAAgBA;gCAAC,MAAM1B;gCAAM,WAAU;0CACrCX;;4BAGkB,QAAtBwB,sBAA8B,WAAR,GACrB,IAAC;gCAAI,WAAU;0CAA0BA;;;;oBAIrC,QAATtB,SAAiB,WAAR,GAAQ,IAAC;wBAAI,WAAU;kCAAoBA;;;;0BAGzD,IAAC;gBAAI,WAAU;0BAAoB4B;;YAClCP,WAAWK;;;AAGlB"}
1
+ {"version":3,"file":"card/card.js","sources":["../../../src/card/card.tsx"],"sourcesContent":["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":["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":";;;;;;;;;AAgCO,SAASA,KAAKC,QAAmB;IACtC,MAAM,EACJC,KAAK,EACLC,WAAW,EACXC,KAAK,EACLC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,UAAU,KAAK,EACfC,WAAW,IAAI,EACfC,SAAS,IAAI,EACb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wBAAI,WAAU;;4BACH,QAAT7B,SAAiB,WAAR,GACR,IAAC4C,kBAAgBA;gCAAC,IAAI5B;gCAAS,MAAML;gCAAM,WAAU;0CAClDX;;4BAGkB,QAAtB2B,sBAA8B,WAAR,GACrB,IAAC;gCAAI,WAAU;0CAA0BA;;;;oBAIrC,QAATzB,SAAiB,WAAR,GAAQ,IAAC;wBAAI,WAAU;kCAAoBA;;;;0BAGzD,IAAC;gBAAI,WAAU;0BAAoBoC;;YAClCZ,WAAWK;;;AAGlB"}
@@ -5,7 +5,7 @@ import { useEffect, useId, useRef, useState } from "react";
5
5
  import { FeedbackIcon } from "../alert/alert.js";
6
6
  import { ButtonControl } from "../button/button.js";
7
7
  import { useLeafConfig } from "../config-provider/context.js";
8
- import { ModalBase } from "../modal/modal.js";
8
+ import { ModalBase } from "../modal/base.js";
9
9
  function ConfirmDialog({ open, title, icon, children, confirmText, cancelText, type = 'info', showCancel, confirmButtonProps, cancelButtonProps, onCancel, onConfirm, onClose, ...props }) {
10
10
  const { messages } = useLeafConfig();
11
11
  const contentId = useId();
@@ -1 +1 @@
1
- {"version":3,"file":"confirm/confirm.js","sources":["../../../src/confirm/confirm.tsx"],"sourcesContent":["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":["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":";;;;;;;;AAoCO,SAASA,cAAc,EAC5BC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,OAAO,MAAM,EACbC,UAAU,EACVC,kBAAkB,EAClBC,iBAAiB,EACjBC,QAAQ,EACRC,SAAS,EACTC,OAAO,EACP,GAAGC,OACgB;IACnB,MAAM,EAAEC,QAAQ,EAAE,GAAGC;IACrB,MAAMC,YAAYC;IAClB,MAAM,CAACC,SAASC,WAAW,GAAGC,SAAS;IACvC,MAAM,CAACC,OAAOC,SAAS,GAAGF;IAC1B,MAAMG,UAAUC,OAAO;IACvB,MAAMC,OAAOD,OAAO;IACpB,MAAME,aAAaF,OAAO;IAC1B,MAAMG,iBAAiBnB,oBAAoB,WAAW;IACtDoB,UAAU;QACRL,QAAQ,OAAO,GAAG;QAClB,OAAO;YACLA,QAAQ,OAAO,GAAG;QACpB;IACF,GAAG,EAAE;IACLK,UAAU;QACRF,WAAW,OAAO;QAClBD,KAAK,OAAO,GAAG;QACfN,WAAW;QACX,IAAInB,MAAMsB,SAASO;IACrB,GAAG;QAAC7B;KAAK;IACT,eAAe8B;QACb,IAAIL,KAAK,OAAO,IAAIE,gBAAgB;QACpCF,KAAK,OAAO,GAAG;QACf,MAAMM,UAAUL,WAAW,OAAO;QAClCP,WAAW;QACXG,SAASO;QACT,IAAI;YACF,MAAMlB;YACN,IAAIY,QAAQ,OAAO,IAAIG,WAAW,OAAO,KAAKK,SAASnB;QACzD,EAAE,OAAOoB,QAAQ;YACf,IAAIT,QAAQ,OAAO,IAAIG,WAAW,OAAO,KAAKK,SAC5CT,SAASU,kBAAkBC,QAAQD,OAAO,OAAO,GAAGE,OAAOF;QAC/D,SAAU;YACR,IAA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AAA,cAAcD,AAAS,cAATA,IAAiB,mBAC/B,IAACmC,eAAaA;oBACZ,MAAK;oBACL,SAAQ;oBACP,GAAGhC,iBAAiB;oBACrB,UAAUS,WAAWS,kBAAkBlB,mBAAmB;oBAC1D,SAAS,CAACiC;wBACRjC,mBAAmB,UAAUiC;wBAC7B,IAAI,CAACA,MAAM,gBAAgB,EAAEP;oBAC/B;8BAEC9B,cAAcS,SAAS,MAAM,CAAC,MAAM;;8BAGzC,IAAC2B,eAAaA;oBACZ,MAAK;oBACL,SAAQ;oBACP,GAAGjC,kBAAkB;oBACtB,QAAQF,AAAS,aAATA;oBACR,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,mBACvD,KAAC;YAAI,WAAU;;gBACH,QAATpB,SAAiBmC,AAAe,QAAfA,eAAuB,WAAR,GAC/B,IAAC;oBAAK,WAAU;oBAAqB,eAAY;8BAC9CA;;8BAGL,KAAC;oBAAI,WAAU;;wBACA,QAAZjC,YAAoB,WAAR,GACX,IAAC;4BAAI,IAAIa;4BAAW,WAAU;sCAC3Bb;;wBAGJkB,SAAS,WAATA,GACC,IAAC;4BAAE,MAAK;4BAAQ,WAAU;sCACvBA;;;;;;;AAQjB"}
1
+ {"version":3,"file":"confirm/confirm.js","sources":["../../../src/confirm/confirm.tsx"],"sourcesContent":["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":["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":";;;;;;;;AAoCO,SAASA,cAAc,EAC5BC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,OAAO,MAAM,EACbC,UAAU,EACVC,kBAAkB,EAClBC,iBAAiB,EACjBC,QAAQ,EACRC,SAAS,EACTC,OAAO,EACP,GAAGC,OACgB;IACnB,MAAM,EAAEC,QAAQ,EAAE,GAAGC;IACrB,MAAMC,YAAYC;IAClB,MAAM,CAACC,SAASC,WAAW,GAAGC,SAAS;IACvC,MAAM,CAACC,OAAOC,SAAS,GAAGF;IAC1B,MAAMG,UAAUC,OAAO;IACvB,MAAMC,OAAOD,OAAO;IACpB,MAAME,aAAaF,OAAO;IAC1B,MAAMG,iBAAiBnB,oBAAoB,WAAW;IACtDoB,UAAU;QACRL,QAAQ,OAAO,GAAG;QAClB,OAAO;YACLA,QAAQ,OAAO,GAAG;QACpB;IACF,GAAG,EAAE;IACLK,UAAU;QACRF,WAAW,OAAO;QAClBD,KAAK,OAAO,GAAG;QACfN,WAAW;QACX,IAAInB,MAAMsB,SAASO;IACrB,GAAG;QAAC7B;KAAK;IACT,eAAe8B;QACb,IAAIL,KAAK,OAAO,IAAIE,gBAAgB;QACpCF,KAAK,OAAO,GAAG;QACf,M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,WAAU;sCACvBA;;;;;;;AAQjB"}
@@ -1,11 +1,17 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
2
  import { type DialogFocusOptions } from '../shared/dialog.js';
3
+ import { type TabsProps } from '../tabs/tabs.js';
4
+ /** Tabs controls integrated with the drawer; Drawer fixes the line type and top placement. */
5
+ export interface DrawerTabsProps extends Omit<TabsProps, 'type' | 'placement' | 'children'> {
6
+ }
3
7
  export interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onResize'>, DialogFocusOptions {
4
8
  open: boolean;
5
9
  title?: ReactNode;
6
10
  description?: ReactNode;
7
11
  icon?: ReactNode;
8
12
  divided?: boolean;
13
+ /** Embedded tabs placed below the heading, or replacing it when no title is supplied. */
14
+ tabs?: DrawerTabsProps;
9
15
  footer?: ReactNode;
10
16
  extra?: ReactNode;
11
17
  placement?: 'left' | 'right' | 'top' | 'bottom';
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/drawer/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,KAAK,kBAAkB,EAAa,MAAM,kBAAkB,CAAC;AAMtE,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,EAChE,kBAAkB;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IAChD,KAAK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xs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { X } from "lucide-react";
4
4
  import { useContext, useEffect, useId, useRef, useState } from "react";
5
5
  import { useComponentProps } from "../config-provider/component-defaults.js";
@@ -11,13 +11,113 @@ import { inertProps } from "../shared/inert.js";
11
11
  import { OverlayOwner } from "../shared/overlay-owner.js";
12
12
  import { useContentTransition, usePresence } from "../shared/presence.js";
13
13
  import { ScopedPortal } from "../shared/scoped-portal.js";
14
- function DrawerSurface({ open, title, description, icon, divided = false, 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 }) {
14
+ import { useTabsParts } from "../tabs/tabs.js";
15
+ const emptyTabItems = [];
16
+ function DrawerInner({ id, open, title, description, icon, tabs, extra, footer, closable, onClose, contentRef, ariaLabel, ariaLabelledBy, children }) {
17
+ const { messages } = useLeafConfig();
18
+ const hasTabs = Boolean(tabs?.items?.length);
19
+ const hasHeading = null != title || null != description || null != icon;
20
+ const closeButton = closable ? /*#__PURE__*/ jsx("button", {
21
+ type: "button",
22
+ className: "leaf-drawer__close",
23
+ "aria-label": messages.common.close,
24
+ onClick: onClose,
25
+ children: /*#__PURE__*/ jsx(X, {
26
+ size: 16,
27
+ "aria-hidden": "true"
28
+ })
29
+ }) : null;
30
+ const extraNode = null != extra ? /*#__PURE__*/ jsx("div", {
31
+ className: "leaf-drawer__extra",
32
+ children: extra
33
+ }) : null;
34
+ const tabExtra = !hasHeading && (null != extra || closable) ? /*#__PURE__*/ jsxs("div", {
35
+ className: "leaf-dialog-tab-extra leaf-drawer__tab-extra",
36
+ children: [
37
+ tabs?.extra,
38
+ extraNode,
39
+ closeButton
40
+ ]
41
+ }) : tabs?.extra;
42
+ const tabLabel = tabs?.['aria-label'] ?? ('string' == typeof title ? title : ariaLabel);
43
+ const tabLabelledBy = tabs?.['aria-labelledby'] ?? (tabs?.['aria-label'] == null && null != title ? `${id}-title` : tabs?.['aria-label'] == null ? ariaLabelledBy : void 0);
44
+ const parts = useTabsParts({
45
+ ...tabs,
46
+ items: tabs?.items ?? emptyTabItems,
47
+ type: 'line',
48
+ placement: 'top',
49
+ size: tabs?.size ?? 'md',
50
+ 'aria-label': tabLabel,
51
+ 'aria-labelledby': tabLabelledBy,
52
+ extra: tabExtra,
53
+ className: classes('leaf-dialog-tabs', hasHeading && 'leaf-dialog-tabs--headed', 'leaf-drawer__tabs', tabs?.className),
54
+ panelsClassName: 'leaf-dialog-panels',
55
+ visibilityKey: open
56
+ });
57
+ return /*#__PURE__*/ jsxs(Fragment, {
58
+ children: [
59
+ (hasHeading || !hasTabs && (null != extra || closable)) && /*#__PURE__*/ jsxs("div", {
60
+ className: classes('leaf-drawer__header', !hasHeading && 'leaf-drawer__header--compact'),
61
+ children: [
62
+ null != icon && /*#__PURE__*/ jsx("span", {
63
+ className: "leaf-drawer__icon",
64
+ "aria-hidden": "true",
65
+ children: icon
66
+ }),
67
+ (null != title || null != description) && /*#__PURE__*/ jsxs("div", {
68
+ className: "leaf-drawer__heading",
69
+ children: [
70
+ null != title && /*#__PURE__*/ jsx("h2", {
71
+ id: `${id}-title`,
72
+ children: title
73
+ }),
74
+ null != description && /*#__PURE__*/ jsx("div", {
75
+ id: `${id}-description`,
76
+ className: "leaf-drawer__description",
77
+ children: description
78
+ })
79
+ ]
80
+ }),
81
+ extraNode,
82
+ closeButton
83
+ ]
84
+ }),
85
+ parts && /*#__PURE__*/ jsx("div", {
86
+ ...parts.rootProps,
87
+ children: parts.header
88
+ }),
89
+ /*#__PURE__*/ jsx(ScrollbarControl, {
90
+ className: "leaf-drawer__body",
91
+ viewportClassName: "leaf-drawer__viewport",
92
+ orientation: "vertical",
93
+ role: null != title || ariaLabel ? 'region' : 'presentation',
94
+ "aria-labelledby": null != title ? `${id}-title` : void 0,
95
+ "aria-label": null == title ? ariaLabel ?? tabs?.['aria-label'] : void 0,
96
+ children: /*#__PURE__*/ jsxs("div", {
97
+ ref: contentRef,
98
+ className: "leaf-drawer__content",
99
+ children: [
100
+ parts?.panels,
101
+ children
102
+ ]
103
+ })
104
+ }),
105
+ null != footer && /*#__PURE__*/ jsx("div", {
106
+ className: "leaf-drawer__footer",
107
+ children: footer
108
+ })
109
+ ]
110
+ });
111
+ }
112
+ 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 }) {
15
113
  const { messages, maskBlur } = useLeafConfig();
16
114
  const id = useId();
17
115
  const panel = useRef(null);
18
116
  const backdrop = useRef(null);
19
117
  const content = useRef(null);
20
118
  const present = usePresence(open, backdrop);
119
+ const hasTabs = Boolean(tabs?.items?.length);
120
+ const hasHeading = null != title || null != description || null != icon;
21
121
  const contentRevision = useRef({
22
122
  children,
23
123
  revision: 0
@@ -26,7 +126,7 @@ function DrawerSurface({ open, title, description, icon, divided = false, footer
26
126
  children,
27
127
  revision: contentRevision.current.revision + 1
28
128
  };
29
- useContentTransition(content, `${open}:${contentRevision.current.revision}`, 0, true);
129
+ useContentTransition(content, hasTabs ? String(open) : `${open}:${contentRevision.current.revision}`, 0, true);
30
130
  const owner = useContext(OverlayOwner);
31
131
  const [resized, setResized] = useState();
32
132
  const stopDragging = useRef(void 0);
@@ -100,7 +200,7 @@ function DrawerSurface({ open, title, description, icon, divided = false, footer
100
200
  null != description && `${id}-description`
101
201
  ].filter(Boolean).join(' ') || void 0,
102
202
  tabIndex: -1,
103
- className: classes('leaf-drawer', divided && 'leaf-drawer--divided', className),
203
+ className: classes('leaf-drawer', divided && 'leaf-drawer--divided', hasTabs && 'leaf-drawer--tabbed', hasHeading && 'leaf-drawer--headed', className),
104
204
  style: {
105
205
  ...horizontal ? {
106
206
  width: resized ?? width,
@@ -167,65 +267,24 @@ function DrawerSurface({ open, title, description, icon, divided = false, footer
167
267
  onResize?.(next);
168
268
  }
169
269
  }),
170
- /*#__PURE__*/ jsxs(OverlayOwner.Provider, {
270
+ /*#__PURE__*/ jsx(OverlayOwner.Provider, {
171
271
  value: id,
172
- children: [
173
- (null != title || null != description || null != icon || closable || extra) && /*#__PURE__*/ jsxs("div", {
174
- className: classes('leaf-drawer__header', null == title && null == description && null == icon && 'leaf-drawer__header--compact'),
175
- children: [
176
- null != icon && /*#__PURE__*/ jsx("span", {
177
- className: "leaf-drawer__icon",
178
- "aria-hidden": "true",
179
- children: icon
180
- }),
181
- (null != title || null != description) && /*#__PURE__*/ jsxs("div", {
182
- className: "leaf-drawer__heading",
183
- children: [
184
- null != title && /*#__PURE__*/ jsx("h2", {
185
- id: `${id}-title`,
186
- children: title
187
- }),
188
- null != description && /*#__PURE__*/ jsx("div", {
189
- id: `${id}-description`,
190
- className: "leaf-drawer__description",
191
- children: description
192
- })
193
- ]
194
- }),
195
- extra && /*#__PURE__*/ jsx("div", {
196
- className: "leaf-drawer__extra",
197
- children: extra
198
- }),
199
- closable && /*#__PURE__*/ jsx("button", {
200
- type: "button",
201
- className: "leaf-drawer__close",
202
- "aria-label": messages.common.close,
203
- onClick: onClose,
204
- children: /*#__PURE__*/ jsx(X, {
205
- size: 16,
206
- "aria-hidden": "true"
207
- })
208
- })
209
- ]
210
- }),
211
- /*#__PURE__*/ jsx(ScrollbarControl, {
212
- className: "leaf-drawer__body",
213
- viewportClassName: "leaf-drawer__viewport",
214
- orientation: "vertical",
215
- role: null != title || props['aria-label'] ? 'region' : 'presentation',
216
- "aria-labelledby": null != title ? `${id}-title` : void 0,
217
- "aria-label": null == title ? props['aria-label'] : void 0,
218
- children: /*#__PURE__*/ jsx("div", {
219
- ref: content,
220
- className: "leaf-drawer__content",
221
- children: children
222
- })
223
- }),
224
- null != footer && /*#__PURE__*/ jsx("div", {
225
- className: "leaf-drawer__footer",
226
- children: footer
227
- })
228
- ]
272
+ children: /*#__PURE__*/ jsx(DrawerInner, {
273
+ id: id,
274
+ open: open,
275
+ title: title,
276
+ description: description,
277
+ icon: icon,
278
+ tabs: tabs,
279
+ extra: extra,
280
+ footer: footer,
281
+ closable: closable,
282
+ onClose: onClose,
283
+ contentRef: content,
284
+ ariaLabel: props['aria-label'],
285
+ ariaLabelledBy: props['aria-labelledby'],
286
+ children: children
287
+ })
229
288
  })
230
289
  ]
231
290
  })
@@ -1 +1 @@
1
- {"version":3,"file":"drawer/drawer.js","sources":["../../../src/drawer/drawer.tsx"],"sourcesContent":["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":["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":";;;;;;;;;;;;;AAgDA,SAASA,cAAc,EACrBC,IAAI,EACJC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,UAAU,KAAK,EACfC,MAAM,EACNC,KAAK,EACLC,YAAY,OAAO,EACnBC,QAAQ,GAAG,EACXC,SAAS,GAAG,EACZC,WAAW,IAAI,EACfC,eAAe,IAAI,EACnBC,WAAW,IAAI,EACfC,OAAO,EACPC,UAAU,EACVC,cAAc,KAAK,EACnBC,iBAAiB,KAAK,EACtBC,QAAQ,EACRC,YAAY,EACZC,WAAW,EACX,WAAWC,UAAU,EACrBC,OAAO,KAAK,EACZC,YAAY,KAAK,EACjBC,UAAU,GAAG,EACbC,UAAU,GAAG,EACbC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACL,GAAGC,OACS;IACZ,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGC;IAC/B,MAAMC,KAAKC;IACX,MAAMC,QAAQC,OAAuB;IACrC,MAAMC,WAAWD,OAA0B;IAC3C,MAAME,UAAUF,OAAuB;IACvC,MAAMG,UAAUC,Y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,MAAM,CAAC,KAAK;wCACjC,SAASjB;kDAET,kBAAC2D,GAACA;4CAAC,MAAM;4CAAI,eAAY;;;;;0CAKjC,IAACC,kBAAgBA;gCACf,WAAU;gCACV,mBAAkB;gCAClB,aAAY;gCACZ,MAAMxE,AAAS,QAATA,SAAiB4B,KAAK,CAAC,aAAa,GAAG,WAAW;gCACxD,mBAAiB5B,AAAS,QAATA,QAAgB,GAAGgC,GAAG,MAAM,CAAC,GAAGiB;gCACjD,cAAYjD,AAAS,QAATA,QAAgB4B,KAAK,CAAC,aAAa,GAAGqB;0CAElD,kBAAC;oCAAI,KAAKZ;oCAAS,WAAU;8CAC1BZ;;;4BAGM,QAAVrB,UAAkB,WAAR,GAAQ,IAAC;gCAAI,WAAU;0CAAuBA;;;;;;;;AAKnE;AACO,SAASqE,OAAOC,QAAqB;IAC1C,MAAM9C,QAAQ+C,kBAAkB,UAAUD;IAC1C,OAAO,WAAP,GACE,IAACE,cAAYA;QAAC,WAAWhD,MAAM,SAAS;kBACtC,kBAAC9B,eAAaA;YAAE,GAAG8B,KAAK;;;AAG9B"}
1
+ {"version":3,"file":"drawer/drawer.js","sources":["../../../src/drawer/drawer.tsx"],"sourcesContent":["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":["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":";;;;;;;;;;;;;;AAsBA,MAAMA,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,MAAM,EAAEC,QAAQ,EAAE,GAAGC;IACrB,MAAMC,UAAUC,QAAQZ,MAAM,OAAO;IACrC,MAAMa,aAAahB,AAAS,QAATA,SAAiBC,AAAe,QAAfA,eAAuBC,AAAQ,QAARA;IAC3D,MAAMe,cAAcX,WAAW,WAAXA,GAClB,IAAC;QACC,MAAK;QACL,WAAU;QACV,cAAYM,SAAS,MAAM,CAAC,KAAK;QACjC,SAASL;kBAET,kBAACW,GAACA;YAAC,MAAM;YAAI,eAAY;;SAEzB;IACJ,MAAMC,YAAYf,AAAS,QAATA,QAAgB,WAAP,GAAO,IAAC;QAAI,WAAU;kBAAsBA;SAAe;IACtF,MAAMgB,WACJ,CAACJ,cAAeZ,CAAAA,AAAS,QAATA,SAAiBE,QAAO,kBACtC,KAAC;QAAI,WAAU;;YACZH,MAAM;YACNgB;YACAF;;SAGHd,MAAM;IAEV,MAAMkB,WAAWlB,MAAM,CAAC,aAAa,IAAK,CAAiB,YAAjB,OAAOH,QAAqBA,QAAQS,SAAQ;IACtF,MAAMa,gBACJnB,MAAM,CAAC,kBAAkB,IACxBA,CAAAA,MAAM,CAAC,aAAa,IAAI,QAAQH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C,KAAK,GAAG,CACnBvC,SACAuC,KAAK,GAAG,CACNxC,SACAqC,OACG;gCAAC;gCAAc;6BAAY,CAAC,QAAQ,CAACH,MAAM,GAAG,IAAI,KAAK,GAAE,IACvDhD,CAAAA,AAAc,YAAdA,aAAyBA,AAAc,aAAdA,YAAyB,KAAK;4BAGhEmC,WAAWkB;4BACXrC,WAAWqC;wBACb;;kCAGJ,IAACpB,aAAa,QAAQ;wBAAC,OAAOjE;kCAC5B,kBAACD,aAAWA;4BACV,IAAIC;4BACJ,MAAMC;4BACN,OAAOC;4BACP,aAAaC;4BACb,MAAMC;4BACN,MAAMC;4BACN,OAAOC;4BACP,QAAQC;4BACR,UAAUC;4BACV,SAASC;4BACT,YAAYgD;4BACZ,WAAWN,KAAK,CAAC,aAAa;4BAC9B,gBAAgBA,KAAK,CAAC,kBAAkB;sCAEvCtC;;;;;;;AAMb;AACO,SAAS4E,OAAOC,QAAqB;IAC1C,MAAMvC,QAAQwC,kBAAkB,UAAUD;IAC1C,OAAO,WAAP,GACE,IAACE,cAAYA;QAAC,WAAWzC,MAAM,SAAS;kBACtC,kBAACrB,eAAaA;YAAE,GAAGqB,KAAK;;;AAG9B"}
@@ -1,3 +1,3 @@
1
- export type { DrawerProps } from './drawer.js';
1
+ export type { DrawerProps, DrawerTabsProps } from './drawer.js';
2
2
  export { Drawer } from './drawer.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drawer/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drawer/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -5,7 +5,7 @@ import { useEffect, useRef, useState } from "react";
5
5
  import { ButtonControl } from "../button/button.js";
6
6
  import { useComponentProps } from "../config-provider/component-defaults.js";
7
7
  import { ImagePreviewControl } from "../image/image.js";
8
- import { ModalBase } from "../modal/modal.js";
8
+ import { ModalBase } from "../modal/base.js";
9
9
  import { classes } from "../shared/classes.js";
10
10
  import { useListMotion } from "../shared/motion.js";
11
11
  import { useFormattedText } from "../shared/use-formatted-text.js";