@ifhover/leaf-ui 0.16.7 → 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 (135) hide show
  1. package/dist/cjs/browser/modules/confirm/confirm.cjs +2 -2
  2. package/dist/cjs/browser/modules/confirm/confirm.cjs.map +1 -1
  3. package/dist/cjs/browser/modules/drawer/drawer.cjs +120 -61
  4. package/dist/cjs/browser/modules/drawer/drawer.cjs.map +1 -1
  5. package/dist/cjs/browser/modules/filelist/filelist.cjs +2 -2
  6. package/dist/cjs/browser/modules/filelist/filelist.cjs.map +1 -1
  7. package/dist/cjs/browser/modules/modal/base.cjs +287 -0
  8. package/dist/cjs/browser/modules/modal/base.cjs.map +1 -0
  9. package/dist/cjs/browser/modules/modal/modal.cjs +64 -209
  10. package/dist/cjs/browser/modules/modal/modal.cjs.map +1 -1
  11. package/dist/cjs/browser/modules/shared/presence.cjs +12 -6
  12. package/dist/cjs/browser/modules/shared/presence.cjs.map +1 -1
  13. package/dist/cjs/browser/modules/tabletanstack/tabletanstack.cjs +14 -2
  14. package/dist/cjs/browser/modules/tabletanstack/tabletanstack.cjs.map +1 -1
  15. package/dist/cjs/browser/modules/tabs/tabs.cjs +194 -175
  16. package/dist/cjs/browser/modules/tabs/tabs.cjs.map +1 -1
  17. package/dist/cjs/confirm/confirm.cjs +2 -2
  18. package/dist/cjs/confirm/confirm.cjs.map +1 -1
  19. package/dist/cjs/drawer/drawer.cjs +120 -61
  20. package/dist/cjs/drawer/drawer.cjs.map +1 -1
  21. package/dist/cjs/drawer/drawer.d.cts +6 -0
  22. package/dist/cjs/drawer/drawer.d.cts.map +1 -1
  23. package/dist/cjs/drawer/index.d.cts +1 -1
  24. package/dist/cjs/drawer/index.d.cts.map +1 -1
  25. package/dist/cjs/filelist/filelist.cjs +2 -2
  26. package/dist/cjs/filelist/filelist.cjs.map +1 -1
  27. package/dist/cjs/index.d.cts +2 -2
  28. package/dist/cjs/index.d.cts.map +1 -1
  29. package/dist/cjs/modal/base.cjs +285 -0
  30. package/dist/cjs/modal/base.cjs.map +1 -0
  31. package/dist/cjs/modal/base.d.cts +23 -0
  32. package/dist/cjs/modal/base.d.cts.map +1 -0
  33. package/dist/cjs/modal/index.d.cts +1 -1
  34. package/dist/cjs/modal/index.d.cts.map +1 -1
  35. package/dist/cjs/modal/modal.cjs +64 -209
  36. package/dist/cjs/modal/modal.cjs.map +1 -1
  37. package/dist/cjs/modal/modal.d.cts +8 -3
  38. package/dist/cjs/modal/modal.d.cts.map +1 -1
  39. package/dist/cjs/shared/presence.cjs +12 -6
  40. package/dist/cjs/shared/presence.cjs.map +1 -1
  41. package/dist/cjs/shared/presence.d.cts +1 -1
  42. package/dist/cjs/shared/presence.d.cts.map +1 -1
  43. package/dist/cjs/styles/card.css +1 -1
  44. package/dist/cjs/styles/colorpicker.css +1 -1
  45. package/dist/cjs/styles/components/card.css +1 -1
  46. package/dist/cjs/styles/components/drawer.css +1 -1
  47. package/dist/cjs/styles/components/modal.css +1 -1
  48. package/dist/cjs/styles/components/tabletanstack.css +1 -1
  49. package/dist/cjs/styles/components/tabs.css +1 -1
  50. package/dist/cjs/styles/config-provider.css +1 -1
  51. package/dist/cjs/styles/confirm.css +1 -1
  52. package/dist/cjs/styles/daterangepicker.css +1 -1
  53. package/dist/cjs/styles/drawer.css +1 -1
  54. package/dist/cjs/styles/filelist.css +1 -1
  55. package/dist/cjs/styles/index.css +75 -14
  56. package/dist/cjs/styles/index.css.map +1 -1
  57. package/dist/cjs/styles/modal.css +1 -1
  58. package/dist/cjs/styles/tabletanstack.css +1 -1
  59. package/dist/cjs/styles/tabs.css +1 -1
  60. package/dist/cjs/styles/upload.css +1 -1
  61. package/dist/cjs/tabletanstack/tabletanstack.cjs +14 -2
  62. package/dist/cjs/tabletanstack/tabletanstack.cjs.map +1 -1
  63. package/dist/cjs/tabletanstack/tabletanstack.d.cts.map +1 -1
  64. package/dist/cjs/tabs/tabs.cjs +194 -175
  65. package/dist/cjs/tabs/tabs.cjs.map +1 -1
  66. package/dist/cjs/tabs/tabs.d.cts +14 -1
  67. package/dist/cjs/tabs/tabs.d.cts.map +1 -1
  68. package/dist/esm/browser/modules/confirm/confirm.js +1 -1
  69. package/dist/esm/browser/modules/confirm/confirm.js.map +1 -1
  70. package/dist/esm/browser/modules/drawer/drawer.js +121 -62
  71. package/dist/esm/browser/modules/drawer/drawer.js.map +1 -1
  72. package/dist/esm/browser/modules/filelist/filelist.js +1 -1
  73. package/dist/esm/browser/modules/filelist/filelist.js.map +1 -1
  74. package/dist/esm/browser/modules/modal/base.js +249 -0
  75. package/dist/esm/browser/modules/modal/base.js.map +1 -0
  76. package/dist/esm/browser/modules/modal/modal.js +65 -207
  77. package/dist/esm/browser/modules/modal/modal.js.map +1 -1
  78. package/dist/esm/browser/modules/shared/presence.js +12 -6
  79. package/dist/esm/browser/modules/shared/presence.js.map +1 -1
  80. package/dist/esm/browser/modules/tabletanstack/tabletanstack.js +14 -2
  81. package/dist/esm/browser/modules/tabletanstack/tabletanstack.js.map +1 -1
  82. package/dist/esm/browser/modules/tabs/tabs.js +190 -174
  83. package/dist/esm/browser/modules/tabs/tabs.js.map +1 -1
  84. package/dist/esm/confirm/confirm.js +1 -1
  85. package/dist/esm/confirm/confirm.js.map +1 -1
  86. package/dist/esm/drawer/drawer.d.ts +6 -0
  87. package/dist/esm/drawer/drawer.d.ts.map +1 -1
  88. package/dist/esm/drawer/drawer.js +121 -62
  89. package/dist/esm/drawer/drawer.js.map +1 -1
  90. package/dist/esm/drawer/index.d.ts +1 -1
  91. package/dist/esm/drawer/index.d.ts.map +1 -1
  92. package/dist/esm/filelist/filelist.js +1 -1
  93. package/dist/esm/filelist/filelist.js.map +1 -1
  94. package/dist/esm/index.d.ts +2 -2
  95. package/dist/esm/index.d.ts.map +1 -1
  96. package/dist/esm/modal/base.d.ts +23 -0
  97. package/dist/esm/modal/base.d.ts.map +1 -0
  98. package/dist/esm/modal/base.js +247 -0
  99. package/dist/esm/modal/base.js.map +1 -0
  100. package/dist/esm/modal/index.d.ts +1 -1
  101. package/dist/esm/modal/index.d.ts.map +1 -1
  102. package/dist/esm/modal/modal.d.ts +8 -3
  103. package/dist/esm/modal/modal.d.ts.map +1 -1
  104. package/dist/esm/modal/modal.js +65 -207
  105. package/dist/esm/modal/modal.js.map +1 -1
  106. package/dist/esm/shared/presence.d.ts +1 -1
  107. package/dist/esm/shared/presence.d.ts.map +1 -1
  108. package/dist/esm/shared/presence.js +12 -6
  109. package/dist/esm/shared/presence.js.map +1 -1
  110. package/dist/esm/styles/card.css +1 -1
  111. package/dist/esm/styles/colorpicker.css +1 -1
  112. package/dist/esm/styles/components/card.css +1 -1
  113. package/dist/esm/styles/components/drawer.css +1 -1
  114. package/dist/esm/styles/components/modal.css +1 -1
  115. package/dist/esm/styles/components/tabletanstack.css +1 -1
  116. package/dist/esm/styles/components/tabs.css +1 -1
  117. package/dist/esm/styles/config-provider.css +1 -1
  118. package/dist/esm/styles/confirm.css +1 -1
  119. package/dist/esm/styles/daterangepicker.css +1 -1
  120. package/dist/esm/styles/drawer.css +1 -1
  121. package/dist/esm/styles/filelist.css +1 -1
  122. package/dist/esm/styles/index.css +75 -14
  123. package/dist/esm/styles/index.css.map +1 -1
  124. package/dist/esm/styles/modal.css +1 -1
  125. package/dist/esm/styles/tabletanstack.css +1 -1
  126. package/dist/esm/styles/tabs.css +1 -1
  127. package/dist/esm/styles/upload.css +1 -1
  128. package/dist/esm/tabletanstack/tabletanstack.d.ts.map +1 -1
  129. package/dist/esm/tabletanstack/tabletanstack.js +14 -2
  130. package/dist/esm/tabletanstack/tabletanstack.js.map +1 -1
  131. package/dist/esm/tabs/tabs.d.ts +14 -1
  132. package/dist/esm/tabs/tabs.d.ts.map +1 -1
  133. package/dist/esm/tabs/tabs.js +190 -174
  134. package/dist/esm/tabs/tabs.js.map +1 -1
  135. package/package.json +2 -2
@@ -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;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AuB,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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C1D,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,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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OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,GAAG,gBAAgB,GAAG,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC;IAC5E,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AA8VD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,WAAW,+BAO3C"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx, jsxs } 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,E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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,MA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AAK;;;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";
@@ -1 +1 @@
1
- {"version":3,"file":"filelist/filelist.js","sources":["../../../src/filelist/filelist.tsx"],"sourcesContent":["import {\n Check,\n CircleAlert,\n Clock3,\n Download,\n Eye,\n File,\n FileArchive,\n FileAudio2,\n FileCode2,\n FileImage,\n FileSpreadsheet,\n FileText,\n FileVideo2,\n Paperclip,\n Trash2,\n} from 'lucide-react';\nimport { type HTMLAttributes, type ReactNode, useEffect, useRef, useState } from 'react';\nimport { ButtonControl } from '../button/button';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { ImagePreviewControl as ImagePreview } from '../image/image';\nimport { ModalBase } from '../modal/modal';\nimport { classes } from '../shared/classes';\nimport { useListMotion } from '../shared/motion';\nimport { useFormattedText } from '../shared/use-formatted-text';\nimport { useText } from '../shared/use-text';\nimport {\n type FileKind,\n fileExtension,\n fileKind,\n fileName,\n formatFileSize,\n safeFileUrl,\n} from './model';\n\nexport interface FileItem {\n uid?: string;\n url?: string;\n name?: string;\n size?: number;\n type?: string;\n status?: 'ready' | 'uploading' | 'done' | 'error' | 'cancelled';\n percent?: number;\n error?: string;\n originFile?: globalThis.File;\n}\nexport interface FileListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'> {\n items: readonly FileItem[];\n downloadable?: boolean;\n previewable?: boolean;\n removable?: boolean;\n onPreview?: (file: FileItem) => void;\n onDownload?: (file: FileItem) => void;\n onRemove?: (file: FileItem) => void | boolean | Promise<void> | Promise<boolean>;\n renderActions?: (file: FileItem, actions: ReactNode) => ReactNode;\n emptyContent?: ReactNode;\n disabled?: boolean;\n listType?: 'text' | 'picture' | 'picture-card';\n}\nconst icons: Record<FileKind, typeof File> = {\n image: FileImage,\n video: FileVideo2,\n audio: FileAudio2,\n document: FileText,\n sheet: FileSpreadsheet,\n archive: FileArchive,\n code: FileCode2,\n file: File,\n};\n\nfunction FileVisual({\n file,\n listType,\n fallbackLabel,\n}: {\n file: FileItem;\n listType: FileListProps['listType'];\n fallbackLabel: string;\n}) {\n const kind = fileKind(file);\n const Icon = icons[kind];\n const url = safeFileUrl(file.url);\n const [failedUrl, setFailedUrl] = useState<string>();\n const thumbnail = Boolean(listType !== 'text' && kind === 'image' && url && failedUrl !== url);\n const extension = fileExtension(file);\n const iconSize = listType === 'text' ? 15 : 18;\n return (\n <span\n className=\"leaf-file-list__icon\"\n data-kind={kind}\n data-extension={extension || undefined}\n data-thumbnail={thumbnail || undefined}\n aria-hidden=\"true\"\n >\n {!thumbnail && (\n <span className=\"leaf-file-list__glyph\">\n <Icon size={iconSize} strokeWidth={1.75} />\n </span>\n )}\n {listType === 'picture-card' && !thumbnail && (\n <span className=\"leaf-file-list__extension\">\n {(extension || fallbackLabel).toUpperCase()}\n </span>\n )}\n {thumbnail && (\n <img src={url} alt=\"\" loading=\"lazy\" decoding=\"async\" onError={() => setFailedUrl(url)} />\n )}\n </span>\n );\n}\n\ninterface FileRowProps\n extends Pick<\n FileListProps,\n 'downloadable' | 'previewable' | 'removable' | 'onDownload' | 'onRemove' | 'renderActions'\n > {\n file: FileItem;\n motionKey: string;\n disabled: boolean;\n listType: FileListProps['listType'];\n onPreview: (file: FileItem) => void;\n}\nfunction FileRow({\n file,\n motionKey,\n disabled,\n listType,\n downloadable,\n previewable,\n removable,\n onDownload,\n onRemove,\n onPreview,\n renderActions,\n}: FileRowProps) {\n const t = useText();\n const format = useFormattedText();\n const [removing, setRemoving] = useState(false);\n const [removeError, setRemoveError] = useState('');\n const pending = useRef(false);\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const name = fileName(file);\n const kind = fileKind(file);\n const url = safeFileUrl(file.url);\n const extension = fileExtension(file).toUpperCase();\n const size = file.size ?? file.originFile?.size;\n const formattedSize = size === undefined ? '' : formatFileSize(size);\n const percent = Number.isFinite(file.percent) ? Math.max(0, Math.min(100, file.percent ?? 0)) : 0;\n const canPreview = Boolean(previewable && url && ['image', 'video', 'audio'].includes(kind));\n const canDownload = Boolean(downloadable && url);\n const canRemove = Boolean(removable && onRemove);\n const inlineDownload = Boolean(url && /^(?:data|blob):/i.test(url));\n const status =\n file.status === 'uploading' ? (\n <bdi>{`${t('fileList.uploading')} ${Math.round(percent)}%`}</bdi>\n ) : file.status === 'done' ? (\n <>\n <Check size={12} strokeWidth={2.1} aria-hidden=\"true\" />\n {t('fileList.uploadComplete')}\n </>\n ) : file.status === 'error' ? (\n <>\n <CircleAlert size={12} strokeWidth={2} aria-hidden=\"true\" />\n {t('fileList.uploadFailed')}\n </>\n ) : file.status === 'cancelled' ? (\n t('fileList.cancelled')\n ) : file.status === 'ready' ? (\n <>\n <Clock3 size={12} strokeWidth={1.85} aria-hidden=\"true\" />\n {t('fileList.ready')}\n </>\n ) : null;\n const actions = (\n <>\n {canPreview && (\n <ButtonControl\n className=\"leaf-file-list__action\"\n variant=\"text\"\n size=\"sm\"\n disabled={disabled}\n startIcon={<Eye size={15} strokeWidth={1.75} />}\n aria-label={format('fileList.preview', { name })}\n title={t('common.preview')}\n onClick={() => onPreview(file)}\n />\n )}\n {canDownload &&\n url &&\n (onDownload ? (\n <ButtonControl\n className=\"leaf-file-list__action\"\n variant=\"text\"\n size=\"sm\"\n disabled={disabled}\n startIcon={<Download size={15} strokeWidth={1.75} />}\n aria-label={format('fileList.download', { name })}\n title={t('common.download')}\n onClick={() => onDownload(file)}\n />\n ) : (\n <a\n className=\"leaf-file-list__action\"\n href={disabled ? undefined : url}\n download={name}\n target={inlineDownload ? undefined : '_blank'}\n rel={inlineDownload ? undefined : 'noopener noreferrer'}\n aria-label={format('fileList.download', { name })}\n title={t('common.download')}\n aria-disabled={disabled || undefined}\n role={disabled ? 'link' : undefined}\n tabIndex={disabled ? -1 : undefined}\n >\n <Download size={15} strokeWidth={1.75} aria-hidden=\"true\" />\n </a>\n ))}\n {canRemove && onRemove && (\n <ButtonControl\n className=\"leaf-file-list__action leaf-file-list__remove\"\n danger\n variant=\"text\"\n size=\"sm\"\n disabled={disabled}\n loading={removing}\n startIcon={<Trash2 size={15} strokeWidth={1.75} />}\n aria-label={format('fileList.remove', { name })}\n title={t('common.remove')}\n onClick={async () => {\n if (pending.current) return;\n pending.current = true;\n setRemoving(true);\n setRemoveError('');\n try {\n await onRemove(file);\n } catch (reason) {\n if (mounted.current)\n setRemoveError(reason instanceof Error ? reason.message : String(reason));\n } finally {\n pending.current = false;\n if (mounted.current) setRemoving(false);\n }\n }}\n />\n )}\n </>\n );\n const hasBuiltInActions = canPreview || canDownload || canRemove;\n const renderedActions = renderActions\n ? renderActions(file, actions)\n : hasBuiltInActions\n ? actions\n : null;\n const showActions =\n renderedActions !== null && renderedActions !== false && renderedActions !== undefined;\n const errorMessage = removeError || (file.status === 'error' ? file.error : '');\n const hasError = Boolean(errorMessage || file.status === 'error');\n const meta = (\n <div className=\"leaf-file-list__meta\">\n <span className=\"leaf-file-list__type\">\n <bdi>{extension || t('fileList.fileType')}</bdi>\n </span>\n {formattedSize && (\n <span className=\"leaf-file-list__size\">\n <bdi>{formattedSize}</bdi>\n </span>\n )}\n {status && (\n <span className=\"leaf-file-list__status\" data-status={file.status}>\n {status}\n </span>\n )}\n </div>\n );\n const progress = file.status === 'uploading' && (\n <div\n className=\"leaf-file-list__progress\"\n role=\"progressbar\"\n aria-label={format('fileList.uploadProgress', { name })}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={Math.round(percent)}\n >\n <span style={{ width: `${percent}%` }} />\n </div>\n );\n const errorNode = errorMessage ? (\n <p className=\"leaf-file-list__error\" role={removeError ? 'alert' : undefined}>\n <bdi>{errorMessage}</bdi>\n </p>\n ) : null;\n return (\n <li\n className=\"leaf-file-list__item\"\n data-kind={kind}\n data-status={file.status}\n data-error={hasError || undefined}\n data-motion-key={motionKey}\n aria-busy={file.status === 'uploading' || removing || undefined}\n >\n <FileVisual file={file} listType={listType} fallbackLabel={t('fileList.fileType')} />\n {listType === 'picture-card' ? (\n <div className=\"leaf-file-list__details\">\n <span className=\"leaf-file-list__name\" title={name}>\n {name}\n </span>\n {progress}\n {errorNode}\n <div className=\"leaf-file-list__footer\">\n {meta}\n {showActions && <div className=\"leaf-file-list__actions\">{renderedActions}</div>}\n </div>\n </div>\n ) : (\n <>\n <div className=\"leaf-file-list__main\">\n <div className=\"leaf-file-list__details\">\n <span className=\"leaf-file-list__name\" title={name}>\n {name}\n </span>\n {meta}\n </div>\n {showActions && <div className=\"leaf-file-list__actions\">{renderedActions}</div>}\n </div>\n {progress}\n {errorNode}\n </>\n )}\n </li>\n );\n}\n\nexport function FileListControl({\n items,\n downloadable = true,\n previewable = true,\n removable = false,\n onPreview,\n onDownload,\n onRemove,\n renderActions,\n emptyContent,\n disabled = false,\n listType = 'text',\n className,\n ...props\n}: FileListProps) {\n const t = useText();\n const root = useRef<HTMLDivElement>(null);\n const occurrences = new Map<string, number>();\n const keys = items.map((file) => {\n const identity = file.uid ?? file.url ?? fileName(file);\n const occurrence = occurrences.get(identity) ?? 0;\n occurrences.set(identity, occurrence + 1);\n return JSON.stringify([identity, occurrence]);\n });\n useListMotion(root, JSON.stringify(keys), '.leaf-file-list__item[data-motion-key]', listType);\n const [preview, setPreview] = useState<FileItem | null>(null);\n const selected = preview\n ? items.find((file) =>\n preview.uid\n ? file.uid === preview.uid\n : preview.url\n ? file.url === preview.url\n : file === preview,\n )\n : undefined;\n const images = items.filter((file) => fileKind(file) === 'image' && safeFileUrl(file.url));\n const kind = selected ? fileKind(selected) : undefined;\n const previewUrl = safeFileUrl(selected?.url);\n const index = selected ? images.indexOf(selected) : -1;\n return (\n <div\n {...props}\n ref={root}\n className={classes('leaf-file-list', `leaf-file-list--${listType}`, className)}\n data-disabled={disabled || undefined}\n >\n {items.length ? (\n <ul className=\"leaf-file-list__items\">\n {items.map((file, position) => (\n <FileRow\n key={keys[position]}\n motionKey={keys[position] ?? String(position)}\n file={file}\n listType={listType}\n disabled={disabled}\n downloadable={downloadable}\n previewable={previewable}\n removable={removable}\n onDownload={onDownload}\n onRemove={onRemove}\n renderActions={renderActions}\n onPreview={(file) => (onPreview ? onPreview(file) : setPreview(file))}\n />\n ))}\n </ul>\n ) : (\n <div className=\"leaf-file-list__empty\">\n {emptyContent ?? (\n <>\n <span className=\"leaf-file-list__empty-icon\" aria-hidden=\"true\">\n <Paperclip size={16} strokeWidth={1.75} />\n </span>\n <span>{t('fileList.noFiles')}</span>\n </>\n )}\n </div>\n )}\n <ImagePreview\n items={images.map((file) => ({\n src: safeFileUrl(file.url) ?? '',\n alt: fileName(file),\n downloadName: fileName(file),\n }))}\n open={Boolean(previewUrl && kind === 'image' && index >= 0)}\n index={Math.max(0, index)}\n onIndexChange={(next) => setPreview(images[next] ?? null)}\n onClose={() => setPreview(null)}\n downloadable={downloadable && !disabled}\n />\n <ModalBase\n open={Boolean(previewUrl && (kind === 'video' || kind === 'audio'))}\n title={selected ? fileName(selected) : ''}\n footer={null}\n width={kind === 'audio' ? 520 : 800}\n onClose={() => setPreview(null)}\n className=\"leaf-file-list__media-modal\"\n >\n {previewUrl && kind === 'video' && (\n <video\n key={previewUrl}\n controls\n preload=\"metadata\"\n src={previewUrl}\n aria-label={selected ? fileName(selected) : ''}\n >\n <track kind=\"captions\" />\n </video>\n )}\n {previewUrl && kind === 'audio' && (\n <audio\n key={previewUrl}\n controls\n preload=\"metadata\"\n src={previewUrl}\n aria-label={selected ? fileName(selected) : ''}\n >\n <track kind=\"captions\" />\n </audio>\n )}\n </ModalBase>\n </div>\n );\n}\n\nexport function FileList(rawProps: FileListProps) {\n const props = useComponentProps('FileList', rawProps);\n return <FileListControl {...props} />;\n}\n"],"names":["icons","FileImage","FileVideo2","FileAudio2","FileText","FileSpreadsheet","FileArchive","FileCode2","File","FileVisual","file","listType","fallbackLabel","kind","fileKind","Icon","url","safeFileUrl","failedUrl","setFailedUrl","useState","thumbnail","Boolean","extension","fileExtension","iconSize","undefined","FileRow","motionKey","disabled","downloadable","previewable","removable","onDownload","onRemove","onPreview","renderActions","t","useText","format","useFormattedText","removing","setRemoving","removeError","setRemoveError","pending","useRef","mounted","useEffect","name","fileName","size","formattedSize","formatFileSize","percent","Number","Math","canPreview","canDownload","canRemove","inlineDownload","status","Check","CircleAlert","Clock3","actions","ButtonControl","Eye","Download","Trash2","reason","Error","String","hasBuiltInActions","renderedActions","showActions","errorMessage","hasError","meta","progress","errorNode","FileListControl","items","emptyContent","className","props","root","occurrences","Map","keys","identity","occurrence","JSON","useListMotion","preview","setPreview","selected","images","previewUrl","index","classes","position","Paperclip","ImagePreview","next","ModalBase","FileList","rawProps","useComponentProps"],"mappings":";;;;;;;;;;;;;AA2DA,MAAMA,QAAuC;IAC3C,OAAOC;IACP,OAAOC;IACP,OAAOC;IACP,UAAUC;IACV,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;IAC5C,OAAO,WAAP,GAAO,IAAC1B,iBAAeA;QAAE,GAAGI,KAAK;;AACnC"}
1
+ {"version":3,"file":"filelist/filelist.js","sources":["../../../src/filelist/filelist.tsx"],"sourcesContent":["import {\n Check,\n CircleAlert,\n Clock3,\n Download,\n Eye,\n File,\n FileArchive,\n FileAudio2,\n FileCode2,\n FileImage,\n FileSpreadsheet,\n FileText,\n FileVideo2,\n Paperclip,\n Trash2,\n} from 'lucide-react';\nimport { type HTMLAttributes, type ReactNode, useEffect, useRef, useState } from 'react';\nimport { ButtonControl } from '../button/button';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { ImagePreviewControl as ImagePreview } from '../image/image';\nimport { ModalBase } from '../modal/base';\nimport { classes } from '../shared/classes';\nimport { useListMotion } from '../shared/motion';\nimport { useFormattedText } from '../shared/use-formatted-text';\nimport { useText } from '../shared/use-text';\nimport {\n type FileKind,\n fileExtension,\n fileKind,\n fileName,\n formatFileSize,\n safeFileUrl,\n} from './model';\n\nexport interface FileItem {\n uid?: string;\n url?: string;\n name?: string;\n size?: number;\n type?: string;\n status?: 'ready' | 'uploading' | 'done' | 'error' | 'cancelled';\n percent?: number;\n error?: string;\n originFile?: globalThis.File;\n}\nexport interface FileListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'> {\n items: readonly FileItem[];\n downloadable?: boolean;\n previewable?: boolean;\n removable?: boolean;\n onPreview?: (file: FileItem) => void;\n onDownload?: (file: FileItem) => void;\n onRemove?: (file: FileItem) => void | boolean | Promise<void> | Promise<boolean>;\n renderActions?: (file: FileItem, actions: ReactNode) => ReactNode;\n emptyContent?: ReactNode;\n disabled?: boolean;\n listType?: 'text' | 'picture' | 'picture-card';\n}\nconst icons: Record<FileKind, typeof File> = {\n image: FileImage,\n video: FileVideo2,\n audio: FileAudio2,\n document: FileText,\n sheet: FileSpreadsheet,\n archive: FileArchive,\n code: FileCode2,\n file: File,\n};\n\nfunction FileVisual({\n file,\n listType,\n fallbackLabel,\n}: {\n file: FileItem;\n listType: FileListProps['listType'];\n fallbackLabel: string;\n}) {\n const kind = fileKind(file);\n const Icon = icons[kind];\n const url = safeFileUrl(file.url);\n const [failedUrl, setFailedUrl] = useState<string>();\n const thumbnail = Boolean(listType !== 'text' && kind === 'image' && url && failedUrl !== url);\n const extension = fileExtension(file);\n const iconSize = listType === 'text' ? 15 : 18;\n return (\n <span\n className=\"leaf-file-list__icon\"\n data-kind={kind}\n data-extension={extension || undefined}\n data-thumbnail={thumbnail || undefined}\n aria-hidden=\"true\"\n >\n {!thumbnail && (\n <span className=\"leaf-file-list__glyph\">\n <Icon size={iconSize} strokeWidth={1.75} />\n </span>\n )}\n {listType === 'picture-card' && !thumbnail && (\n <span className=\"leaf-file-list__extension\">\n {(extension || fallbackLabel).toUpperCase()}\n </span>\n )}\n {thumbnail && (\n <img src={url} alt=\"\" loading=\"lazy\" decoding=\"async\" onError={() => setFailedUrl(url)} />\n )}\n </span>\n );\n}\n\ninterface FileRowProps\n extends Pick<\n FileListProps,\n 'downloadable' | 'previewable' | 'removable' | 'onDownload' | 'onRemove' | 'renderActions'\n > {\n file: FileItem;\n motionKey: string;\n disabled: boolean;\n listType: FileListProps['listType'];\n onPreview: (file: FileItem) => void;\n}\nfunction FileRow({\n file,\n motionKey,\n disabled,\n listType,\n downloadable,\n previewable,\n removable,\n onDownload,\n onRemove,\n onPreview,\n renderActions,\n}: FileRowProps) {\n const t = useText();\n const format = useFormattedText();\n const [removing, setRemoving] = useState(false);\n const [removeError, setRemoveError] = useState('');\n const pending = useRef(false);\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const name = fileName(file);\n const kind = fileKind(file);\n const url = safeFileUrl(file.url);\n const extension = fileExtension(file).toUpperCase();\n const size = file.size ?? file.originFile?.size;\n const formattedSize = size === undefined ? '' : formatFileSize(size);\n const percent = Number.isFinite(file.percent) ? Math.max(0, Math.min(100, file.percent ?? 0)) : 0;\n const canPreview = Boolean(previewable && url && ['image', 'video', 'audio'].includes(kind));\n const canDownload = Boolean(downloadable && url);\n const canRemove = Boolean(removable && onRemove);\n const inlineDownload = Boolean(url && /^(?:data|blob):/i.test(url));\n const status =\n file.status === 'uploading' ? (\n <bdi>{`${t('fileList.uploading')} ${Math.round(percent)}%`}</bdi>\n ) : file.status === 'done' ? (\n <>\n <Check size={12} strokeWidth={2.1} aria-hidden=\"true\" />\n {t('fileList.uploadComplete')}\n </>\n ) : file.status === 'error' ? (\n <>\n <CircleAlert size={12} strokeWidth={2} aria-hidden=\"true\" />\n {t('fileList.uploadFailed')}\n </>\n ) : file.status === 'cancelled' ? (\n t('fileList.cancelled')\n ) : file.status === 'ready' ? (\n <>\n <Clock3 size={12} strokeWidth={1.85} aria-hidden=\"true\" />\n {t('fileList.ready')}\n </>\n ) : null;\n const actions = (\n <>\n {canPreview && (\n <ButtonControl\n className=\"leaf-file-list__action\"\n variant=\"text\"\n size=\"sm\"\n disabled={disabled}\n startIcon={<Eye size={15} strokeWidth={1.75} />}\n aria-label={format('fileList.preview', { name })}\n title={t('common.preview')}\n onClick={() => onPreview(file)}\n />\n )}\n {canDownload &&\n url &&\n (onDownload ? (\n <ButtonControl\n className=\"leaf-file-list__action\"\n variant=\"text\"\n size=\"sm\"\n disabled={disabled}\n startIcon={<Download size={15} strokeWidth={1.75} />}\n aria-label={format('fileList.download', { name })}\n title={t('common.download')}\n onClick={() => onDownload(file)}\n />\n ) : (\n <a\n className=\"leaf-file-list__action\"\n href={disabled ? undefined : url}\n download={name}\n target={inlineDownload ? undefined : '_blank'}\n rel={inlineDownload ? undefined : 'noopener noreferrer'}\n aria-label={format('fileList.download', { name })}\n title={t('common.download')}\n aria-disabled={disabled || undefined}\n role={disabled ? 'link' : undefined}\n tabIndex={disabled ? -1 : undefined}\n >\n <Download size={15} strokeWidth={1.75} aria-hidden=\"true\" />\n </a>\n ))}\n {canRemove && onRemove && (\n <ButtonControl\n className=\"leaf-file-list__action leaf-file-list__remove\"\n danger\n variant=\"text\"\n size=\"sm\"\n disabled={disabled}\n loading={removing}\n startIcon={<Trash2 size={15} strokeWidth={1.75} />}\n aria-label={format('fileList.remove', { name })}\n title={t('common.remove')}\n onClick={async () => {\n if (pending.current) return;\n pending.current = true;\n setRemoving(true);\n setRemoveError('');\n try {\n await onRemove(file);\n } catch (reason) {\n if (mounted.current)\n setRemoveError(reason instanceof Error ? reason.message : String(reason));\n } finally {\n pending.current = false;\n if (mounted.current) setRemoving(false);\n }\n }}\n />\n )}\n </>\n );\n const hasBuiltInActions = canPreview || canDownload || canRemove;\n const renderedActions = renderActions\n ? renderActions(file, actions)\n : hasBuiltInActions\n ? actions\n : null;\n const showActions =\n renderedActions !== null && renderedActions !== false && renderedActions !== undefined;\n const errorMessage = removeError || (file.status === 'error' ? file.error : '');\n const hasError = Boolean(errorMessage || file.status === 'error');\n const meta = (\n <div className=\"leaf-file-list__meta\">\n <span className=\"leaf-file-list__type\">\n <bdi>{extension || t('fileList.fileType')}</bdi>\n </span>\n {formattedSize && (\n <span className=\"leaf-file-list__size\">\n <bdi>{formattedSize}</bdi>\n </span>\n )}\n {status && (\n <span className=\"leaf-file-list__status\" data-status={file.status}>\n {status}\n </span>\n )}\n </div>\n );\n const progress = file.status === 'uploading' && (\n <div\n className=\"leaf-file-list__progress\"\n role=\"progressbar\"\n aria-label={format('fileList.uploadProgress', { name })}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={Math.round(percent)}\n >\n <span style={{ width: `${percent}%` }} />\n </div>\n );\n const errorNode = errorMessage ? (\n <p className=\"leaf-file-list__error\" role={removeError ? 'alert' : undefined}>\n <bdi>{errorMessage}</bdi>\n </p>\n ) : null;\n return (\n <li\n className=\"leaf-file-list__item\"\n data-kind={kind}\n data-status={file.status}\n data-error={hasError || undefined}\n data-motion-key={motionKey}\n aria-busy={file.status === 'uploading' || removing || undefined}\n >\n <FileVisual file={file} listType={listType} fallbackLabel={t('fileList.fileType')} />\n {listType === 'picture-card' ? (\n <div className=\"leaf-file-list__details\">\n <span className=\"leaf-file-list__name\" title={name}>\n {name}\n </span>\n {progress}\n {errorNode}\n <div className=\"leaf-file-list__footer\">\n {meta}\n {showActions && <div className=\"leaf-file-list__actions\">{renderedActions}</div>}\n </div>\n </div>\n ) : (\n <>\n <div className=\"leaf-file-list__main\">\n <div className=\"leaf-file-list__details\">\n <span className=\"leaf-file-list__name\" title={name}>\n {name}\n </span>\n {meta}\n </div>\n {showActions && <div className=\"leaf-file-list__actions\">{renderedActions}</div>}\n </div>\n {progress}\n {errorNode}\n </>\n )}\n </li>\n );\n}\n\nexport function FileListControl({\n items,\n downloadable = true,\n previewable = true,\n removable = false,\n onPreview,\n onDownload,\n onRemove,\n renderActions,\n emptyContent,\n disabled = false,\n listType = 'text',\n className,\n ...props\n}: FileListProps) {\n const t = useText();\n const root = useRef<HTMLDivElement>(null);\n const occurrences = new Map<string, number>();\n const keys = items.map((file) => {\n const identity = file.uid ?? file.url ?? fileName(file);\n const occurrence = occurrences.get(identity) ?? 0;\n occurrences.set(identity, occurrence + 1);\n return JSON.stringify([identity, occurrence]);\n });\n useListMotion(root, JSON.stringify(keys), '.leaf-file-list__item[data-motion-key]', listType);\n const [preview, setPreview] = useState<FileItem | null>(null);\n const selected = preview\n ? items.find((file) =>\n preview.uid\n ? file.uid === preview.uid\n : preview.url\n ? file.url === preview.url\n : file === preview,\n )\n : undefined;\n const images = items.filter((file) => fileKind(file) === 'image' && safeFileUrl(file.url));\n const kind = selected ? fileKind(selected) : undefined;\n const previewUrl = safeFileUrl(selected?.url);\n const index = selected ? images.indexOf(selected) : -1;\n return (\n <div\n {...props}\n ref={root}\n className={classes('leaf-file-list', `leaf-file-list--${listType}`, className)}\n data-disabled={disabled || undefined}\n >\n {items.length ? (\n <ul className=\"leaf-file-list__items\">\n {items.map((file, position) => (\n <FileRow\n key={keys[position]}\n motionKey={keys[position] ?? String(position)}\n file={file}\n listType={listType}\n disabled={disabled}\n downloadable={downloadable}\n previewable={previewable}\n removable={removable}\n onDownload={onDownload}\n onRemove={onRemove}\n renderActions={renderActions}\n onPreview={(file) => (onPreview ? onPreview(file) : setPreview(file))}\n />\n ))}\n </ul>\n ) : (\n <div className=\"leaf-file-list__empty\">\n {emptyContent ?? (\n <>\n <span className=\"leaf-file-list__empty-icon\" aria-hidden=\"true\">\n <Paperclip size={16} strokeWidth={1.75} />\n </span>\n <span>{t('fileList.noFiles')}</span>\n </>\n )}\n </div>\n )}\n <ImagePreview\n items={images.map((file) => ({\n src: safeFileUrl(file.url) ?? '',\n alt: fileName(file),\n downloadName: fileName(file),\n }))}\n open={Boolean(previewUrl && kind === 'image' && index >= 0)}\n index={Math.max(0, index)}\n onIndexChange={(next) => setPreview(images[next] ?? null)}\n onClose={() => setPreview(null)}\n downloadable={downloadable && !disabled}\n />\n <ModalBase\n open={Boolean(previewUrl && (kind === 'video' || kind === 'audio'))}\n title={selected ? fileName(selected) : ''}\n footer={null}\n width={kind === 'audio' ? 520 : 800}\n onClose={() => setPreview(null)}\n className=\"leaf-file-list__media-modal\"\n >\n {previewUrl && kind === 'video' && (\n <video\n key={previewUrl}\n controls\n preload=\"metadata\"\n src={previewUrl}\n aria-label={selected ? fileName(selected) : ''}\n >\n <track kind=\"captions\" />\n </video>\n )}\n {previewUrl && kind === 'audio' && (\n <audio\n key={previewUrl}\n controls\n preload=\"metadata\"\n src={previewUrl}\n aria-label={selected ? fileName(selected) : ''}\n >\n <track kind=\"captions\" />\n </audio>\n )}\n </ModalBase>\n </div>\n );\n}\n\nexport function FileList(rawProps: FileListProps) {\n const props = useComponentProps('FileList', rawProps);\n return <FileListControl {...props} />;\n}\n"],"names":["icons","FileImage","FileVideo2","FileAudio2","FileText","FileSpreadsheet","FileArchive","FileCode2","File","FileVisual","file","listType","fallbackLabel","kind","fileKind","Icon","url","safeFileUrl","failedUrl","setFailedUrl","useState","thumbnail","Boolean","extension","fileExtension","iconSize","undefined","FileRow","motionKey","disabled","downloadable","previewable","removable","onDownload","onRemove","onPreview","renderActions","t","useText","format","useFormattedText","removing","setRemoving","removeError","setRemoveError","pending","useRef","mounted","useEffect","name","fileName","size","formattedSize","formatFileSize","percent","Number","Math","canPreview","canDownload","canRemove","inlineDownload","status","Check","CircleAlert","Clock3","actions","ButtonControl","Eye","Download","Trash2","reason","Error","String","hasBuiltInActions","renderedActions","showActions","errorMessage","hasError","meta","progress","errorNode","FileListControl","items","emptyContent","className","props","root","occurrences","Map","keys","identity","occurrence","JSON","useListMotion","preview","setPreview","selected","images","previewUrl","index","classes","position","Paperclip","ImagePreview","next","ModalBase","FileList","rawProps","useComponentProps"],"mappings":";;;;;;;;;;;;;AA2DA,MAAMA,QAAuC;IAC3C,OAAOC;IACP,OAAOC;IACP,OAAOC;IACP,UAAUC;IACV,OAAOC;IACP,SAASC;IACT,MAAMC;IACN,MAAMC;AACR;AAEA,SAASC,WAAW,EAClBC,IAAI,EACJC,QAAQ,EACRC,aAAa,EAKd;IACC,MAAMC,OAAOC,SAASJ;IACtB,MAAMK,OAAOf,KAAK,CAACa,KAAK;IACxB,MAAMG,MAAMC,YAAYP,KAAK,GAAG;IAChC,MAAM,CAACQ,WAAWC,aAAa,GAAGC;IAClC,MAAMC,YAAYC,QAAQX,AAAa,WAAbA,YAAuBE,AAAS,YAATA,QAAoBG,OAAOE,cAAcF;IAC1F,MAAMO,YAAYC,cAAcd;IAChC,MAAMe,WAAWd,AAAa,WAAbA,WAAsB,KAAK;IAC5C,OAAO,WAAP,GACE,KAAC;QACC,WAAU;QACV,aAAWE;QACX,kBAAgBU,aAAaG;QAC7B,kBAAgBL,aAAaK;QAC7B,eAAY;;YAEX,CAACL,aAAa,WAAbA,GACA,IAAC;gBAAK,WAAU;0BACd,kBAACN,MAAAA;oBAAK,MAAMU;oBAAU,aAAa;;;YAGzB,mBAAbd,YAA+B,CAACU,aAAa,WAAbA,GAC/B,IAAC;gBAAK,WAAU;0BACZE,AAAAA,CAAAA,aAAaX,aAAY,EAAG,WAAW;;YAG5CS,aAAa,W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A,OAAmB,MAAM;gBAChC,SAAS,IAAMkF,WAAW;gBAC1B,WAAU;;oBAETG,cAAcrF,AAAS,YAATA,QAAoB,WAAX,GACtB,IAAC;wBAEC,UAAQ;wBACR,SAAQ;wBACR,KAAKqF;wBACL,cAAYF,WAAW9C,SAAS8C,YAAY;kCAE5C,kBAAC;4BAAM,MAAK;;uBANPE;oBASRA,cAAcrF,AAAS,YAATA,QAAoB,WAAX,GACtB,IAAC;wBAEC,UAAQ;wBACR,SAAQ;wBACR,KAAKqF;wBACL,cAAYF,WAAW9C,SAAS8C,YAAY;kCAE5C,kBAAC;4BAAM,MAAK;;uBANPE;;;;;AAYjB;AAEO,SAASQ,SAASC,QAAuB;IAC9C,MAAMtB,QAAQuB,kBAAkB,YAAYD;IAC5C,OAAO,WAAP,GAAO,IAAC1B,iBAAeA;QAAE,GAAGI,KAAK;;AACnC"}
@@ -43,7 +43,7 @@ export type { DescriptionItem, DescriptionsProps } from './descriptions/index.js
43
43
  export { Descriptions } from './descriptions/index.js';
44
44
  export type { DividerProps } from './divider/index.js';
45
45
  export { Divider } from './divider/index.js';
46
- export type { DrawerProps } from './drawer/index.js';
46
+ export type { DrawerProps, DrawerTabsProps } from './drawer/index.js';
47
47
  export { Drawer } from './drawer/index.js';
48
48
  export type { DropdownItem, DropdownProps } from './dropdown/index.js';
49
49
  export { Dropdown } from './dropdown/index.js';
@@ -89,7 +89,7 @@ export type { MenuGroupProps, MenuItem, MenuProps } from './menu/index.js';
89
89
  export { Menu, MenuGroup } from './menu/index.js';
90
90
  export type { MessageApi, MessageOptions, MessageProps, MessageProviderProps } from './message/index.js';
91
91
  export { Message, MessageProvider, useMessage } from './message/index.js';
92
- export type { ModalFooterActions, ModalProps } from './modal/index.js';
92
+ export type { ModalFooterActions, ModalProps, ModalTabsProps } from './modal/index.js';
93
93
  export { Modal } from './modal/index.js';
94
94
  export type { NotificationApi, NotificationOptions, NotificationProps, NotificationProviderProps, } from './notification/index.js';
95
95
  export { Notification, NotificationProvider, useNotification } from './notification/index.js';