@mittwald/flow-react-components 1.6.0-next.65 → 1.6.0-next.67

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 (92) hide show
  1. package/AGENTS.md +0 -11
  2. package/MIGRATION.md +0 -205
  3. package/USAGE.md +1 -1
  4. package/dist/assets/component-index.json +1 -1
  5. package/dist/assets/doc-properties.json +1 -1
  6. package/dist/css/all-layered.css +1 -1
  7. package/dist/css/all.css +6 -8
  8. package/dist/js/default.mjs +1 -1
  9. package/dist/js/internal.mjs +2 -2
  10. package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs +11 -35
  11. package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs.map +1 -1
  12. package/dist/js/packages/components/src/components/AccentBox/AccentBox.module.mjs +11 -11
  13. package/dist/js/packages/components/src/components/AccentBox/AccentBox.module.mjs.map +1 -1
  14. package/dist/js/packages/components/src/components/Accordion/Accordion.mjs +1 -1
  15. package/dist/js/packages/components/src/components/ActionGroup/ActionGroup.mjs +1 -1
  16. package/dist/js/packages/components/src/components/Alert/Alert.module.mjs.map +1 -1
  17. package/dist/js/packages/components/src/components/Avatar/Avatar.mjs +2 -8
  18. package/dist/js/packages/components/src/components/Avatar/Avatar.mjs.map +1 -1
  19. package/dist/js/packages/components/src/components/Avatar/Avatar.module.mjs +7 -9
  20. package/dist/js/packages/components/src/components/Avatar/Avatar.module.mjs.map +1 -1
  21. package/dist/js/packages/components/src/components/Avatar/avatarColors.mjs +7 -3
  22. package/dist/js/packages/components/src/components/Avatar/avatarColors.mjs.map +1 -1
  23. package/dist/js/packages/components/src/components/Badge/Badge.mjs +3 -16
  24. package/dist/js/packages/components/src/components/Badge/Badge.mjs.map +1 -1
  25. package/dist/js/packages/components/src/components/Badge/Badge.module.mjs +11 -11
  26. package/dist/js/packages/components/src/components/Badge/Badge.module.mjs.map +1 -1
  27. package/dist/js/packages/components/src/components/Breadcrumb/Breadcrumb.mjs +1 -1
  28. package/dist/js/packages/components/src/components/Button/Button.mjs +1 -1
  29. package/dist/js/packages/components/src/components/CartesianChart/components/Area/Area.mjs +1 -1
  30. package/dist/js/packages/components/src/components/CartesianChart/components/Area/Area.mjs.map +1 -1
  31. package/dist/js/packages/components/src/components/CartesianChart/components/Bar/Bar.mjs +1 -1
  32. package/dist/js/packages/components/src/components/CartesianChart/components/Bar/Bar.mjs.map +1 -1
  33. package/dist/js/packages/components/src/components/CartesianChart/components/Line/Line.mjs +1 -1
  34. package/dist/js/packages/components/src/components/CartesianChart/components/Line/Line.mjs.map +1 -1
  35. package/dist/js/packages/components/src/components/CodeEditor/themes/defaultEditorTheme.mjs +10 -10
  36. package/dist/js/packages/components/src/components/CodeEditor/themes/defaultEditorTheme.mjs.map +1 -1
  37. package/dist/js/packages/components/src/components/Color/Color.mjs +6 -5
  38. package/dist/js/packages/components/src/components/Color/Color.mjs.map +1 -1
  39. package/dist/js/packages/components/src/components/Color/Color.module.mjs +5 -7
  40. package/dist/js/packages/components/src/components/Color/Color.module.mjs.map +1 -1
  41. package/dist/js/packages/components/src/components/DonutChart/components/DonutChartFill.mjs +1 -1
  42. package/dist/js/packages/components/src/components/DonutChart/components/DonutChartFill.mjs.map +1 -1
  43. package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs +1 -1
  44. package/dist/js/packages/components/src/components/Heading/Heading.mjs +1 -1
  45. package/dist/js/packages/components/src/components/Icon/Icon.mjs +7 -5
  46. package/dist/js/packages/components/src/components/Icon/Icon.mjs.map +1 -1
  47. package/dist/js/packages/components/src/components/Icon/Icon.module.mjs +5 -7
  48. package/dist/js/packages/components/src/components/Icon/Icon.module.mjs.map +1 -1
  49. package/dist/js/packages/components/src/components/IllustratedMessage/IllustratedMessage.mjs +1 -1
  50. package/dist/js/packages/components/src/components/Initials/lib/getColorFromInitials.mjs +1 -1
  51. package/dist/js/packages/components/src/components/Initials/lib/getColorFromInitials.mjs.map +1 -1
  52. package/dist/js/packages/components/src/components/Legend/components/LegendItem/LegendItem.mjs +1 -1
  53. package/dist/js/packages/components/src/components/Legend/components/LegendItem/LegendItem.mjs.map +1 -1
  54. package/dist/js/packages/components/src/components/Link/Link.mjs +1 -1
  55. package/dist/js/packages/components/src/components/LoadingSpinner/LoadingSpinner.mjs +1 -1
  56. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs +2 -2
  57. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs.map +1 -1
  58. package/dist/js/packages/components/src/components/MarkdownEditor/MarkdownEditor.mjs +3 -1
  59. package/dist/js/packages/components/src/components/MarkdownEditor/MarkdownEditor.mjs.map +1 -1
  60. package/dist/js/packages/components/src/components/MarkdownEditor/lib/fileUpload.mjs +2 -2
  61. package/dist/js/packages/components/src/components/MarkdownEditor/lib/fileUpload.mjs.map +1 -1
  62. package/dist/js/packages/components/src/components/MarkdownEditor/lib/useFileUpload.mjs +2 -2
  63. package/dist/js/packages/components/src/components/MarkdownEditor/lib/useFileUpload.mjs.map +1 -1
  64. package/dist/js/packages/components/src/components/Notification/Notification.module.mjs.map +1 -1
  65. package/dist/js/packages/components/src/components/Overlay/Overlay.module.mjs.map +1 -1
  66. package/dist/js/packages/components/src/components/ProgressBar/components/ProgressBarBar.mjs +1 -1
  67. package/dist/js/packages/components/src/components/ProgressBar/components/ProgressBarBar.mjs.map +1 -1
  68. package/dist/js/packages/components/src/components/Text/Text.mjs +1 -1
  69. package/dist/js/packages/components/src/lib/tokens/CategoricalColors.mjs +1 -1
  70. package/dist/js/packages/components/src/lib/tokens/CategoricalColors.mjs.map +1 -1
  71. package/dist/js/packages/components/src/lib/types/props.mjs +1 -17
  72. package/dist/js/packages/components/src/lib/types/props.mjs.map +1 -1
  73. package/dist/js/packages/design-tokens/dist/json-runtime/all-dark.mjs +1270 -1779
  74. package/dist/js/packages/design-tokens/dist/json-runtime/all-dark.mjs.map +1 -1
  75. package/dist/js/packages/design-tokens/dist/json-runtime/all-light.mjs +1270 -1779
  76. package/dist/js/packages/design-tokens/dist/json-runtime/all-light.mjs.map +1 -1
  77. package/dist/types/components/AccentBox/AccentBox.d.ts +3 -12
  78. package/dist/types/components/Avatar/Avatar.d.ts +3 -7
  79. package/dist/types/components/Avatar/avatarColors.d.ts +1 -2
  80. package/dist/types/components/Badge/Badge.d.ts +3 -19
  81. package/dist/types/components/Color/Color.d.ts +4 -8
  82. package/dist/types/components/Icon/Icon.d.ts +3 -5
  83. package/dist/types/components/Markdown/Markdown.d.ts +2 -0
  84. package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +1 -1
  85. package/dist/types/lib/theming/hooks/useDesignTokens.d.ts +889 -1409
  86. package/dist/types/lib/tokens/CategoricalColors.d.ts +1 -1
  87. package/dist/types/lib/tokens/getCategoricalColorByIndex.d.ts +1 -1
  88. package/dist/types/lib/types/props.d.ts +0 -12
  89. package/package.json +10 -10
  90. package/dist/js/packages/components/src/lib/hooks/useDeprecatedColor.mjs +0 -20
  91. package/dist/js/packages/components/src/lib/hooks/useDeprecatedColor.mjs.map +0 -1
  92. package/dist/types/lib/hooks/useDeprecatedColor.d.ts +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownEditor.mjs","names":["DefaultMarkdown","styles"],"sources":["../../../../../../../src/components/MarkdownEditor/MarkdownEditor.tsx"],"sourcesContent":["import { type ComponentType, type KeyboardEventHandler, useState } from \"react\";\nimport styles from \"./MarkdownEditor.module.scss\";\nimport {\n Markdown as DefaultMarkdown,\n type MarkdownProps,\n} from \"@/components/Markdown\";\nimport { TextArea, type TextAreaProps } from \"@/components/TextArea\";\nimport { Toolbar } from \"@/components/MarkdownEditor/components/Toolbar\";\nimport clsx from \"clsx\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport {\n modifyValueByMarkdownSyntax,\n scrollToCursor,\n} from \"@/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax\";\nimport {\n type InsertType,\n modifyValueByType,\n} from \"@/components/MarkdownEditor/lib/modifyValueByType\";\nimport type { MarkdownEditorUpload } from \"@/components/MarkdownEditor/lib/fileUpload\";\nimport { useFileUpload } from \"@/components/MarkdownEditor/lib/useFileUpload\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport {\n overlayTriggersTunneledTo,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport {\n SkeletonModeReset,\n useSkeletonMode,\n} from \"@/components/SkeletonMode/skeletonModeContext\";\n\nexport type MarkdownEditorMode = \"editor\" | \"preview\";\n\nexport type { MarkdownEditorUpload };\n\nconst toolbarActionsTunnel = {\n id: \"toolbarActions\",\n component: \"MarkdownEditor\",\n} as const;\n\nexport interface MarkdownEditorProps\n extends TextAreaProps, Pick<MarkdownProps, \"headingOffset\"> {\n /**\n * Allows replacing the markdown preview renderer implementation. Defaults to\n * the internal `Markdown` component.\n */\n markdownComponent?: ComponentType<MarkdownProps>;\n /**\n * Uploads a file the user dropped onto the editor, pasted into it or picked\n * with its attachment button. A placeholder comment sits at the cursor while\n * the returned promise is pending: resolving replaces it with markdown\n * linking to the file — an image embed for an image — and rejecting takes it\n * back out. Without this prop the editor takes no files at all.\n *\n * Named without an `on` prefix on purpose: the remote generator turns an\n * `on*` prop into a fire-and-forget event, and this one has to hand a result\n * back.\n */\n uploadFile?: (file: File) => Promise<MarkdownEditorUpload>;\n /**\n * Which file types the editor takes, as the `accept` attribute of a file\n * input: a comma separated list of MIME types (`image/png`), MIME wildcards\n * (`image/*`) and file extensions (`.png`). Defaults to every type.\n */\n accept?: string;\n}\n\n/** @flr-generate all */\nexport const MarkdownEditor = flowComponent(\"MarkdownEditor\", (props) => {\n const {\n isDisabled,\n isReadOnly,\n children,\n className,\n rows = 5,\n autoResizeMaxRows,\n headingOffset,\n markdownComponent: MarkdownComponent = DefaultMarkdown,\n value,\n onChange,\n uploadFile,\n accept,\n ref,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n const inputRef = useObjectRef(ref);\n const [mode, setMode] = useState<MarkdownEditorMode>(\"editor\");\n const toolbarActionsDisabled = isDisabled || mode === \"preview\";\n\n const { dropProps, isDropTarget, uploadFiles } = useFileUpload({\n accept,\n uploadFile,\n isDisabled: isDisabled || isReadOnly || mode === \"preview\",\n value,\n onChange,\n textAreaRef: inputRef,\n });\n\n const isSkeleton = useSkeletonMode();\n\n const rootClassName = clsx(\n styles.markdownEditor,\n styles[`mode-${mode}`],\n isDropTarget && styles.dropTarget,\n isSkeleton && styles.skeleton,\n className,\n );\n\n const toolbarActionsPropsContext: PropsContext = {\n ...overlayTriggersTunneledTo(toolbarActionsTunnel),\n Button: {\n tunnel: toolbarActionsTunnel,\n size: \"s\",\n variant: \"plain\",\n color: \"dark\",\n isDisabled: toolbarActionsDisabled,\n },\n };\n\n const handleKeyDown: KeyboardEventHandler = (event) => {\n if (event.key !== \"Enter\") {\n return;\n }\n\n const modifyParams = modifyValueByMarkdownSyntax(value, inputRef);\n if (!modifyParams) {\n return;\n }\n\n const { newValue, newSelectionStart, newSelectionEnd } = modifyParams;\n\n requestAnimationFrame(() => {\n if (inputRef.current) {\n inputRef.current.value = newValue;\n inputRef.current?.setSelectionRange(newSelectionStart, newSelectionEnd);\n scrollToCursor(newValue, inputRef.current);\n }\n });\n\n event.preventDefault();\n onChange(newValue);\n };\n\n const handleToolButtonPressed = (type: InsertType) => {\n const { newValue, newSelectionStart, newSelectionEnd } = modifyValueByType(\n value,\n type,\n inputRef,\n );\n\n requestAnimationFrame(() => {\n if (inputRef.current) {\n inputRef.current.value = newValue;\n inputRef.current.setSelectionRange(newSelectionStart, newSelectionEnd);\n inputRef.current.focus();\n }\n });\n\n onChange(newValue);\n };\n\n return (\n <div\n {...dropProps}\n className={rootClassName}\n inert={isSkeleton || undefined}\n >\n <TextArea\n {...rest}\n aria-hidden={mode === \"preview\"}\n isReadOnly={isReadOnly || mode === \"preview\"}\n isDisabled={isDisabled}\n ref={inputRef}\n value={value}\n rows={rows}\n autoResizeMaxRows={autoResizeMaxRows}\n onChange={onChange}\n onKeyDown={handleKeyDown}\n >\n <PropsContextProvider\n props={toolbarActionsPropsContext}\n dependencies={[toolbarActionsDisabled]}\n >\n {children}\n {mode === \"preview\" && (\n <MarkdownComponent\n headingOffset={headingOffset}\n className={styles.markdown}\n >\n {value}\n </MarkdownComponent>\n )}\n {/* Covered by the skeleton surface, so its buttons draw none. */}\n <SkeletonModeReset>\n <Toolbar\n currentMode={mode}\n isDisabled={isDisabled}\n onModeChange={setMode}\n onToolPressed={handleToolButtonPressed}\n accept={accept}\n isReadOnly={isReadOnly}\n onFilesSelected={uploadFiles}\n />\n </SkeletonModeReset>\n </PropsContextProvider>\n </TextArea>\n {/* One surface over toolbar and text area. The label and the field\n description keep their own skeleton rule. */}\n {isSkeleton && <div className={styles.skeletonSurface} />}\n </div>\n );\n});\n\nexport default MarkdownEditor;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,IAAM,uBAAuB;CAC3B,IAAI;CACJ,WAAW;AACb;;AA8BA,IAAa,iBAAiB,cAAc,mBAAmB,UAAU;CACvE,MAAM,EACJ,YACA,YACA,UACA,WACA,OAAO,GACP,mBACA,eACA,mBAAmB,oBAAoBA,UACvC,OACA,UACA,YACA,QACA,KACA,GAAG,SACD,4BAA4B,OAAO,EAAE;CAEzC,MAAM,WAAW,aAAa,GAAG;CACjC,MAAM,CAAC,MAAM,WAAW,SAA6B,QAAQ;CAC7D,MAAM,yBAAyB,cAAc,SAAS;CAEtD,MAAM,EAAE,WAAW,cAAc,gBAAgB,cAAc;EAC7D;EACA;EACA,YAAY,cAAc,cAAc,SAAS;EACjD;EACA;EACA,aAAa;CACf,CAAC;CAED,MAAM,aAAa,gBAAgB;CAEnC,MAAM,gBAAgB,KACpBC,8BAAO,gBACPA,8BAAO,QAAQ,SACf,gBAAgBA,8BAAO,YACvB,cAAcA,8BAAO,UACrB,SACF;CAEA,MAAM,6BAA2C;EAC/C,GAAG,0BAA0B,oBAAoB;EACjD,QAAQ;GAC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,WAAWA,8BAAO,gBAAkB,CAAA,CACrD;;AAET,CAAC"}
1
+ {"version":3,"file":"MarkdownEditor.mjs","names":["DefaultMarkdown","styles"],"sources":["../../../../../../../src/components/MarkdownEditor/MarkdownEditor.tsx"],"sourcesContent":["import { type ComponentType, type KeyboardEventHandler, useState } from \"react\";\nimport styles from \"./MarkdownEditor.module.scss\";\nimport {\n Markdown as DefaultMarkdown,\n type MarkdownProps,\n} from \"@/components/Markdown\";\nimport { TextArea, type TextAreaProps } from \"@/components/TextArea\";\nimport { Toolbar } from \"@/components/MarkdownEditor/components/Toolbar\";\nimport clsx from \"clsx\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport {\n modifyValueByMarkdownSyntax,\n scrollToCursor,\n} from \"@/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax\";\nimport {\n type InsertType,\n modifyValueByType,\n} from \"@/components/MarkdownEditor/lib/modifyValueByType\";\nimport type { MarkdownEditorUpload } from \"@/components/MarkdownEditor/lib/fileUpload\";\nimport { useFileUpload } from \"@/components/MarkdownEditor/lib/useFileUpload\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport {\n overlayTriggersTunneledTo,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport {\n SkeletonModeReset,\n useSkeletonMode,\n} from \"@/components/SkeletonMode/skeletonModeContext\";\n\nexport type MarkdownEditorMode = \"editor\" | \"preview\";\n\nexport type { MarkdownEditorUpload };\n\nconst toolbarActionsTunnel = {\n id: \"toolbarActions\",\n component: \"MarkdownEditor\",\n} as const;\n\nexport interface MarkdownEditorProps\n extends\n TextAreaProps,\n Pick<MarkdownProps, \"headingOffset\" | \"disableImages\"> {\n /**\n * Allows replacing the markdown preview renderer implementation. Defaults to\n * the internal `Markdown` component.\n */\n markdownComponent?: ComponentType<MarkdownProps>;\n /**\n * Uploads a file the user dropped onto the editor, pasted into it or picked\n * with its attachment button. A placeholder comment sits at the cursor while\n * the returned promise is pending: resolving replaces it with markdown\n * linking to the file — an image embed for an image — and rejecting takes it\n * back out. Without this prop the editor takes no files at all.\n *\n * Named without an `on` prefix on purpose: the remote generator turns an\n * `on*` prop into a fire-and-forget event, and this one has to hand a result\n * back.\n */\n uploadFile?: (file: File) => Promise<MarkdownEditorUpload>;\n /**\n * Which file types the editor takes, as the `accept` attribute of a file\n * input: a comma separated list of MIME types (`image/png`), MIME wildcards\n * (`image/*`) and file extensions (`.png`). Defaults to every type.\n */\n accept?: string;\n}\n\n/** @flr-generate all */\nexport const MarkdownEditor = flowComponent(\"MarkdownEditor\", (props) => {\n const {\n isDisabled,\n isReadOnly,\n children,\n className,\n rows = 5,\n autoResizeMaxRows,\n headingOffset,\n disableImages,\n markdownComponent: MarkdownComponent = DefaultMarkdown,\n value,\n onChange,\n uploadFile,\n accept,\n ref,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n const inputRef = useObjectRef(ref);\n const [mode, setMode] = useState<MarkdownEditorMode>(\"editor\");\n const toolbarActionsDisabled = isDisabled || mode === \"preview\";\n\n const { dropProps, isDropTarget, uploadFiles } = useFileUpload({\n accept,\n uploadFile,\n disableImages,\n isDisabled: isDisabled || isReadOnly || mode === \"preview\",\n value,\n onChange,\n textAreaRef: inputRef,\n });\n\n const isSkeleton = useSkeletonMode();\n\n const rootClassName = clsx(\n styles.markdownEditor,\n styles[`mode-${mode}`],\n isDropTarget && styles.dropTarget,\n isSkeleton && styles.skeleton,\n className,\n );\n\n const toolbarActionsPropsContext: PropsContext = {\n ...overlayTriggersTunneledTo(toolbarActionsTunnel),\n Button: {\n tunnel: toolbarActionsTunnel,\n size: \"s\",\n variant: \"plain\",\n color: \"dark\",\n isDisabled: toolbarActionsDisabled,\n },\n };\n\n const handleKeyDown: KeyboardEventHandler = (event) => {\n if (event.key !== \"Enter\") {\n return;\n }\n\n const modifyParams = modifyValueByMarkdownSyntax(value, inputRef);\n if (!modifyParams) {\n return;\n }\n\n const { newValue, newSelectionStart, newSelectionEnd } = modifyParams;\n\n requestAnimationFrame(() => {\n if (inputRef.current) {\n inputRef.current.value = newValue;\n inputRef.current?.setSelectionRange(newSelectionStart, newSelectionEnd);\n scrollToCursor(newValue, inputRef.current);\n }\n });\n\n event.preventDefault();\n onChange(newValue);\n };\n\n const handleToolButtonPressed = (type: InsertType) => {\n const { newValue, newSelectionStart, newSelectionEnd } = modifyValueByType(\n value,\n type,\n inputRef,\n );\n\n requestAnimationFrame(() => {\n if (inputRef.current) {\n inputRef.current.value = newValue;\n inputRef.current.setSelectionRange(newSelectionStart, newSelectionEnd);\n inputRef.current.focus();\n }\n });\n\n onChange(newValue);\n };\n\n return (\n <div\n {...dropProps}\n className={rootClassName}\n inert={isSkeleton || undefined}\n >\n <TextArea\n {...rest}\n aria-hidden={mode === \"preview\"}\n isReadOnly={isReadOnly || mode === \"preview\"}\n isDisabled={isDisabled}\n ref={inputRef}\n value={value}\n rows={rows}\n autoResizeMaxRows={autoResizeMaxRows}\n onChange={onChange}\n onKeyDown={handleKeyDown}\n >\n <PropsContextProvider\n props={toolbarActionsPropsContext}\n dependencies={[toolbarActionsDisabled]}\n >\n {children}\n {mode === \"preview\" && (\n <MarkdownComponent\n headingOffset={headingOffset}\n disableImages={disableImages}\n className={styles.markdown}\n >\n {value}\n </MarkdownComponent>\n )}\n {/* Covered by the skeleton surface, so its buttons draw none. */}\n <SkeletonModeReset>\n <Toolbar\n currentMode={mode}\n isDisabled={isDisabled}\n onModeChange={setMode}\n onToolPressed={handleToolButtonPressed}\n accept={accept}\n isReadOnly={isReadOnly}\n onFilesSelected={uploadFiles}\n />\n </SkeletonModeReset>\n </PropsContextProvider>\n </TextArea>\n {/* One surface over toolbar and text area. The label and the field\n description keep their own skeleton rule. */}\n {isSkeleton && <div className={styles.skeletonSurface} />}\n </div>\n );\n});\n\nexport default MarkdownEditor;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,IAAM,uBAAuB;CAC3B,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AS,QAAQ,kBAAkB,mBAAmB,eAAe;IACrE,SAAS,QAAQ,MAAM;GACzB;EACF,CAAC;EAED,SAAS,QAAQ;CACnB;CAEA,OACE,qBAAC,OAAD;EACE,GAAI;EACJ,WAAW;EACX,OAAO,cAAc,KAAA;EAHvB,UAAA,CAKE,oBAAC,UAAD;GACE,GAAI;GACJ,eAAa,SAAS;GACtB,YAAY,cAAc,SAAS;GACvB;GACZ,KAAK;GACE;GACD;GACa;GACT;GACV,WAAW;GAEX,UAAA,qBAAC,sBAAD;IACE,OAAO;IACP,cAAc,CAAC,sBAAsB;IAFvC,UAAA;KAIG;KACA,SAAS,aACR,oBAAC,mBAAD;MACiB;MACA;MACf,WAAWA,8BAAO;MAEjB,UAAA;KACgB,CAAA;KAGrB,oBAAC,mBAAD,EAAA,UACE,oBAAC,SAAD;MACE,aAAa;MACD;MACZ,cAAc;MACd,eAAe;MACP;MACI;MACZ,iBAAiB;KAClB,CAAA,EACgB,CAAA;IACC;;EACd,CAAA,GAGT,cAAc,oBAAC,OAAD,EAAK,WAAWA,8BAAO,gBAAkB,CAAA,CACrD;;AAET,CAAC"}
@@ -18,9 +18,9 @@ var uploadPlaceholder = (fileName) => `<!-- Uploading "${escapeComment(fileName)
18
18
  *
19
19
  * @internal
20
20
  */
21
- var uploadedFileMarkdown = (file, upload) => {
21
+ var uploadedFileMarkdown = (file, upload, disableImages = false) => {
22
22
  const link = `[${escapeLinkLabel(upload.name ?? file.name)}](${escapeLinkTarget(upload.url)})`;
23
- return file.type.startsWith("image/") ? `!${link}` : link;
23
+ return file.type.startsWith("image/") && !disableImages ? `!${link}` : link;
24
24
  };
25
25
  /**
26
26
  * Splices `insert` into `value` at `caret`, on a line of its own, and reports
@@ -1 +1 @@
1
- {"version":3,"file":"fileUpload.mjs","names":[],"sources":["../../../../../../../../src/components/MarkdownEditor/lib/fileUpload.ts"],"sourcesContent":["/**\n * The result of uploading a file dropped into, pasted into or selected in a\n * `MarkdownEditor`.\n */\nexport interface MarkdownEditorUpload {\n /** The URL the uploaded file is available at. */\n url: string;\n /**\n * The link text of the inserted markdown — the alt text for an image.\n * Defaults to the name of the uploaded file.\n */\n name?: string;\n}\n\n/** A new editor value together with where the cursor ends up in it. */\nexport interface ValueEdit {\n value: string;\n selectionStart: number;\n selectionEnd: number;\n}\n\n/*\n * A file name that closes the comment early would leave the rest of it as\n * visible text. Every way to close one starts with `--`: `-->` does, `--!>`\n * does too, and dropping only `-->` can forge a new one — `a-->>b` collapses to\n * `a-->b`. Breaking up every `--` is what holds in all three.\n */\nconst escapeComment = (fileName: string) => fileName.replace(/-(?=-)/g, \"- \");\n\n/*\n * Brackets are what ends a markdown link label, and a line break ends the link\n * altogether. A file name may legally contain both.\n *\n * The backslash is escaped in the same pass, and has to be: escaping only the\n * brackets turns `a\\]b` into `a\\\\]b`, which markdown reads as an escaped\n * backslash followed by a bare `]` — the label ends right there.\n */\nconst escapeLinkLabel = (label: string) =>\n label\n .replace(/[\\\\[\\]]/g, \"\\\\$&\")\n .replace(/\\s+/g, \" \")\n .trim();\n\n/*\n * A bare link target ends at the first whitespace or unbalanced parenthesis.\n * Pointy brackets take a target that contains either — and are themselves the\n * only thing that cannot appear inside them.\n */\nconst escapeLinkTarget = (url: string) =>\n /[\\s()]/.test(url) ? `<${url.replace(/[<>]/g, encodeURIComponent)}>` : url;\n\n/**\n * What sits at the cursor while a file uploads. An HTML comment, so it stays\n * out of the rendered preview and out of a message sent before the upload\n * finished — the same marker GitHub leaves behind.\n *\n * @internal\n */\nexport const uploadPlaceholder = (fileName: string): string =>\n `<!-- Uploading \"${escapeComment(fileName)}\"... -->`;\n\n/**\n * The markdown a finished upload leaves behind: an embed for an image, a link\n * for everything else.\n *\n * @internal\n */\nexport const uploadedFileMarkdown = (\n file: Pick<File, \"name\" | \"type\">,\n upload: MarkdownEditorUpload,\n): string => {\n const label = escapeLinkLabel(upload.name ?? file.name);\n const target = escapeLinkTarget(upload.url);\n const link = `[${label}](${target})`;\n\n return file.type.startsWith(\"image/\") ? `!${link}` : link;\n};\n\n/**\n * Splices `insert` into `value` at `caret`, on a line of its own, and reports\n * where the cursor ends up.\n *\n * @internal\n */\nexport const insertAtCaret = (\n value: string,\n insert: string,\n caret: number,\n): ValueEdit => {\n const before = value.slice(0, caret);\n const after = value.slice(caret);\n\n const prefix = before.length > 0 && !before.endsWith(\"\\n\") ? \"\\n\" : \"\";\n const suffix = after.startsWith(\"\\n\") ? \"\" : \"\\n\";\n const inserted = `${prefix}${insert}${suffix}`;\n\n return {\n value: `${before}${inserted}${after}`,\n selectionStart: caret + inserted.length,\n selectionEnd: caret + inserted.length,\n };\n};\n\n/**\n * Replaces the first occurrence of `search`, carrying the cursor along. Returns\n * `null` when the editor no longer contains it — the user deleted the\n * placeholder while the upload was running, and the result is dropped.\n *\n * @internal\n */\nexport const replacePlaceholder = (\n value: string,\n search: string,\n replacement: string,\n selectionStart: number,\n selectionEnd: number,\n): ValueEdit | null => {\n const index = value.indexOf(search);\n\n if (index === -1) {\n return null;\n }\n\n const end = index + search.length;\n const delta = replacement.length - search.length;\n\n /*\n * A cursor before the placeholder does not move, one after it moves by the\n * length difference, and one inside it — the user was typing where the file\n * landed — comes to rest behind the replacement.\n */\n const shift = (position: number) => {\n if (position <= index) {\n return position;\n }\n return position >= end ? position + delta : index + replacement.length;\n };\n\n return {\n value: value.slice(0, index) + replacement + value.slice(end),\n selectionStart: shift(selectionStart),\n selectionEnd: shift(selectionEnd),\n };\n};\n\n/**\n * Takes a placeholder back out after a failed upload, including the line break\n * it was inserted with.\n *\n * @internal\n */\nexport const removePlaceholder = (\n value: string,\n placeholder: string,\n selectionStart: number,\n selectionEnd: number,\n): ValueEdit | null =>\n replacePlaceholder(\n value,\n `${placeholder}\\n`,\n \"\",\n selectionStart,\n selectionEnd,\n ) ?? replacePlaceholder(value, placeholder, \"\", selectionStart, selectionEnd);\n"],"mappings":";;;AA2BA,IAAM,iBAAiB,aAAqB,SAAS,QAAQ,WAAW,IAAI;AAU5E,IA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ACF;;;;;;;AAQA,IAAa,qBACX,OACA,aACA,gBACA,iBAEA,mBACE,OACA,GAAG,YAAY,KACf,IACA,gBACA,YACF,KAAK,mBAAmB,OAAO,aAAa,IAAI,gBAAgB,YAAY"}
1
+ {"version":3,"file":"fileUpload.mjs","names":[],"sources":["../../../../../../../../src/components/MarkdownEditor/lib/fileUpload.ts"],"sourcesContent":["/**\n * The result of uploading a file dropped into, pasted into or selected in a\n * `MarkdownEditor`.\n */\nexport interface MarkdownEditorUpload {\n /** The URL the uploaded file is available at. */\n url: string;\n /**\n * The link text of the inserted markdown — the alt text for an image.\n * Defaults to the name of the uploaded file.\n */\n name?: string;\n}\n\n/** A new editor value together with where the cursor ends up in it. */\nexport interface ValueEdit {\n value: string;\n selectionStart: number;\n selectionEnd: number;\n}\n\n/*\n * A file name that closes the comment early would leave the rest of it as\n * visible text. Every way to close one starts with `--`: `-->` does, `--!>`\n * does too, and dropping only `-->` can forge a new one — `a-->>b` collapses to\n * `a-->b`. Breaking up every `--` is what holds in all three.\n */\nconst escapeComment = (fileName: string) => fileName.replace(/-(?=-)/g, \"- \");\n\n/*\n * Brackets are what ends a markdown link label, and a line break ends the link\n * altogether. A file name may legally contain both.\n *\n * The backslash is escaped in the same pass, and has to be: escaping only the\n * brackets turns `a\\]b` into `a\\\\]b`, which markdown reads as an escaped\n * backslash followed by a bare `]` — the label ends right there.\n */\nconst escapeLinkLabel = (label: string) =>\n label\n .replace(/[\\\\[\\]]/g, \"\\\\$&\")\n .replace(/\\s+/g, \" \")\n .trim();\n\n/*\n * A bare link target ends at the first whitespace or unbalanced parenthesis.\n * Pointy brackets take a target that contains either — and are themselves the\n * only thing that cannot appear inside them.\n */\nconst escapeLinkTarget = (url: string) =>\n /[\\s()]/.test(url) ? `<${url.replace(/[<>]/g, encodeURIComponent)}>` : url;\n\n/**\n * What sits at the cursor while a file uploads. An HTML comment, so it stays\n * out of the rendered preview and out of a message sent before the upload\n * finished — the same marker GitHub leaves behind.\n *\n * @internal\n */\nexport const uploadPlaceholder = (fileName: string): string =>\n `<!-- Uploading \"${escapeComment(fileName)}\"... -->`;\n\n/**\n * The markdown a finished upload leaves behind: an embed for an image, a link\n * for everything else.\n *\n * @internal\n */\nexport const uploadedFileMarkdown = (\n file: Pick<File, \"name\" | \"type\">,\n upload: MarkdownEditorUpload,\n disableImages = false,\n): string => {\n const label = escapeLinkLabel(upload.name ?? file.name);\n const target = escapeLinkTarget(upload.url);\n const link = `[${label}](${target})`;\n\n return file.type.startsWith(\"image/\") && !disableImages ? `!${link}` : link;\n};\n\n/**\n * Splices `insert` into `value` at `caret`, on a line of its own, and reports\n * where the cursor ends up.\n *\n * @internal\n */\nexport const insertAtCaret = (\n value: string,\n insert: string,\n caret: number,\n): ValueEdit => {\n const before = value.slice(0, caret);\n const after = value.slice(caret);\n\n const prefix = before.length > 0 && !before.endsWith(\"\\n\") ? \"\\n\" : \"\";\n const suffix = after.startsWith(\"\\n\") ? \"\" : \"\\n\";\n const inserted = `${prefix}${insert}${suffix}`;\n\n return {\n value: `${before}${inserted}${after}`,\n selectionStart: caret + inserted.length,\n selectionEnd: caret + inserted.length,\n };\n};\n\n/**\n * Replaces the first occurrence of `search`, carrying the cursor along. Returns\n * `null` when the editor no longer contains it — the user deleted the\n * placeholder while the upload was running, and the result is dropped.\n *\n * @internal\n */\nexport const replacePlaceholder = (\n value: string,\n search: string,\n replacement: string,\n selectionStart: number,\n selectionEnd: number,\n): ValueEdit | null => {\n const index = value.indexOf(search);\n\n if (index === -1) {\n return null;\n }\n\n const end = index + search.length;\n const delta = replacement.length - search.length;\n\n /*\n * A cursor before the placeholder does not move, one after it moves by the\n * length difference, and one inside it — the user was typing where the file\n * landed — comes to rest behind the replacement.\n */\n const shift = (position: number) => {\n if (position <= index) {\n return position;\n }\n return position >= end ? position + delta : index + replacement.length;\n };\n\n return {\n value: value.slice(0, index) + replacement + value.slice(end),\n selectionStart: shift(selectionStart),\n selectionEnd: shift(selectionEnd),\n };\n};\n\n/**\n * Takes a placeholder back out after a failed upload, including the line break\n * it was inserted with.\n *\n * @internal\n */\nexport const removePlaceholder = (\n value: string,\n placeholder: string,\n selectionStart: number,\n selectionEnd: number,\n): ValueEdit | null =>\n replacePlaceholder(\n value,\n `${placeholder}\\n`,\n \"\",\n selectionStart,\n selectionEnd,\n ) ?? replacePlaceholder(value, placeholder, \"\", selectionStart, selectionEnd);\n"],"mappings":";;;AA2BA,IAAM,iBAAiB,aAAqB,SAAS,QAAQ,WAAW,IAAI;AAU5E,IAAM,mBAAmB,UACvB,MACG,QAAQ,YAAY,MAAM,CAAC,CAC3B,QAAQ,QAAQ,GAAG,CAAC,CACpB,KAAK;AAOV,IAAM,oBAAoB,QACxB,SAAS,KAAK,GAAG,IAAI,IAAI,IAAI,QAAQ,SAAS,kBAAkB,EAAE,KAAK;;;;;;;;AASzE,IAAa,qBAAqB,aAChC,mBAAmB,cAAc,QAAQ,EAAE;;;;;;;AAQ7C,IAAa,wBACX,MACA,QACA,gBAAgB,UACL;CAGX,MAAM,OAAO,IAFC,gBAAgB,OAAO,QAAQ,KAAK,IAEjC,EAAM,IADR,iBAAiB,OAAO,GACZ,EAAO;CAElC,OAAO,KAAK,KAAK,WAAW,QAAQ,KAAK,CAAC,gBAAgB,IAAI,SAAS;AACzE;;;;;;;AAQA,IAAa,iBACX,OACA,QACA,UACc;CACd,MAAM,SAAS,MAAM,MAAM,GAAG,KAAK;CACnC,MAAM,QAAQ,MAAM,MAAM,KAAK;CAI/B,MAAM,WAAW,GAFF,OAAO,SAAS,KAAK,CAAC,OAAO,SAAS,IAAI,IAAI,OAAO,KAEvC,SADd,MAAM,WAAW,IAAI,IAAI,KAAK;CAG7C,OAAO;EACL,OAAO,GAAG,SAAS,WAAW;EAC9B,gBAAgB,QAAQ,SAAS;EACjC,cAAc,QAAQ,SAAS;CACjC;AACF;;;;;;;;AASA,IAAa,sBACX,OACA,QACA,aACA,gBACA,iBACqB;CACrB,MAAM,QAAQ,MAAM,QAAQ,MAAM;CAElC,IAAI,UAAU,IACZ,OAAO;CAGT,MAAM,MAAM,QAAQ,OAAO;CAC3B,MAAM,QAAQ,YAAY,SAAS,OAAO;CAO1C,MAAM,SAAS,aAAqB;EAClC,IAAI,YAAY,OACd,OAAO;EAET,OAAO,YAAY,MAAM,WAAW,QAAQ,QAAQ,YAAY;CAClE;CAEA,OAAO;EACL,OAAO,MAAM,MAAM,GAAG,KAAK,IAAI,cAAc,MAAM,MAAM,GAAG;EAC5D,gBAAgB,MAAM,cAAc;EACpC,cAAc,MAAM,YAAY;CAClC;AACF;;;;;;;AAQA,IAAa,qBACX,OACA,aACA,gBACA,iBAEA,mBACE,OACA,GAAG,YAAY,KACf,IACA,gBACA,YACF,KAAK,mBAAmB,OAAO,aAAa,IAAI,gBAAgB,YAAY"}
@@ -17,7 +17,7 @@ var acceptedFrom = (files, accept) => Array.from(files ?? []).filter((file) => m
17
17
  * @internal
18
18
  */
19
19
  var useFileUpload = (options) => {
20
- const { accept, uploadFile, isDisabled, value, onChange, textAreaRef } = options;
20
+ const { accept, uploadFile, disableImages, isDisabled, value, onChange, textAreaRef } = options;
21
21
  const stringFormatter = useLocalizedStringFormatter(__locale_default, "MarkdownEditor");
22
22
  const isEnabled = !!uploadFile && !isDisabled;
23
23
  const valueRef = useRef(value);
@@ -59,7 +59,7 @@ var useFileUpload = (options) => {
59
59
  try {
60
60
  const result = await upload(file);
61
61
  const selection = readSelection();
62
- const edit = replacePlaceholder(readValue(), placeholder, uploadedFileMarkdown(file, result), selection.start, selection.end);
62
+ const edit = replacePlaceholder(readValue(), placeholder, uploadedFileMarkdown(file, result, disableImages), selection.start, selection.end);
63
63
  if (edit) applyEdit(edit);
64
64
  announce(stringFormatter.format("upload.succeeded", { name: file.name }), "polite");
65
65
  } catch {
@@ -1 +1 @@
1
- {"version":3,"file":"useFileUpload.mjs","names":["locales"],"sources":["../../../../../../../../src/components/MarkdownEditor/lib/useFileUpload.ts"],"sourcesContent":["import {\n type DragEvent as ReactDragEvent,\n type DragEventHandler,\n type RefObject,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { announce } from \"@react-aria/live-announcer\";\nimport { matchesAccept } from \"@/lib/files/acceptedFiles\";\nimport {\n insertAtCaret,\n type MarkdownEditorUpload,\n removePlaceholder,\n replacePlaceholder,\n uploadedFileMarkdown,\n uploadPlaceholder,\n type ValueEdit,\n} from \"@/components/MarkdownEditor/lib/fileUpload\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"../locales/*.locale.json\";\n\n/** The files of a paste or a drop that `accept` covers. */\nconst acceptedFrom = (files: FileList | null | undefined, accept?: string) =>\n Array.from(files ?? []).filter((file) => matchesAccept(file, accept));\n\n/** @internal */\nexport type MarkdownEditorFileUploadHandler = (\n file: File,\n) => Promise<MarkdownEditorUpload>;\n\ninterface Options {\n /** Which file types to take, as an `accept` attribute value. */\n accept?: string;\n /** Uploads one file. Uploading is off entirely while this is undefined. */\n uploadFile?: MarkdownEditorFileUploadHandler;\n /** Turns dropping, pasting and the toolbar button off. */\n isDisabled?: boolean;\n value: string;\n onChange: (value: string) => void;\n textAreaRef: RefObject<HTMLTextAreaElement | null>;\n}\n\ninterface DropProps {\n onDragEnter?: DragEventHandler;\n onDragOver?: DragEventHandler;\n onDragLeave?: DragEventHandler;\n onDrop?: DragEventHandler;\n}\n\ninterface FileUpload {\n /** Drop handling for the editor's root element. */\n dropProps: DropProps;\n /** Whether a drag is currently over the editor. */\n isDropTarget: boolean;\n /**\n * Uploads the files the toolbar button picked. `undefined` while uploading is\n * off.\n */\n uploadFiles?: (files: File[]) => void;\n}\n\n/**\n * Drop, paste and toolbar uploads for the `MarkdownEditor`: a placeholder\n * comment goes to the cursor right away and is replaced by a markdown link once\n * the consumer's upload resolves.\n *\n * @internal\n */\nexport const useFileUpload = (options: Options): FileUpload => {\n const { accept, uploadFile, isDisabled, value, onChange, textAreaRef } =\n options;\n\n const stringFormatter = useLocalizedStringFormatter(\n locales,\n \"MarkdownEditor\",\n );\n\n const isEnabled = !!uploadFile && !isDisabled;\n\n /*\n * An upload resolves long after the drop, and the editor has kept taking\n * input in the meantime. The textarea's own value is the only one that is\n * current by then — the `value` prop is a render old whenever two uploads\n * resolve in the same tick.\n */\n const valueRef = useRef(value);\n useEffect(() => {\n valueRef.current = value;\n }, [value]);\n\n const readValue = () => textAreaRef.current?.value ?? valueRef.current;\n\n /*\n * A textarea keeps its `selectionStart` after losing focus, so the caret is\n * still readable once the attachment button has taken the focus away. What it\n * cannot tell apart is a caret at position 0 from one that was never placed —\n * both read 0, and appending is the better answer for the second.\n */\n const wasFocusedRef = useRef(false);\n useEffect(() => {\n const textArea = textAreaRef.current;\n\n if (!textArea) {\n return;\n }\n\n const rememberFocus = () => {\n wasFocusedRef.current = true;\n };\n\n textArea.addEventListener(\"focus\", rememberFocus);\n return () => textArea.removeEventListener(\"focus\", rememberFocus);\n }, [textAreaRef]);\n\n const readSelection = () => {\n const textArea = textAreaRef.current;\n const fallback = readValue().length;\n return {\n start: textArea?.selectionStart ?? fallback,\n end: textArea?.selectionEnd ?? fallback,\n };\n };\n\n const applyEdit = (edit: ValueEdit) => {\n valueRef.current = edit.value;\n\n const textArea = textAreaRef.current;\n if (textArea) {\n /*\n * Written before the re-render so an upload resolving in the same tick\n * reads this one's result, and the selection restored after it, once\n * React has rendered the controlled value.\n */\n textArea.value = edit.value;\n requestAnimationFrame(() => {\n textArea.setSelectionRange(edit.selectionStart, edit.selectionEnd);\n });\n }\n\n onChange(edit.value);\n };\n\n const runUpload = async (\n upload: MarkdownEditorFileUploadHandler,\n file: File,\n placeholder: string,\n ) => {\n announce(\n stringFormatter.format(\"upload.pending\", { name: file.name }),\n \"polite\",\n );\n\n try {\n const result = await upload(file);\n const selection = readSelection();\n const edit = replacePlaceholder(\n readValue(),\n placeholder,\n uploadedFileMarkdown(file, result),\n selection.start,\n selection.end,\n );\n\n if (edit) {\n applyEdit(edit);\n }\n\n announce(\n stringFormatter.format(\"upload.succeeded\", { name: file.name }),\n \"polite\",\n );\n } catch {\n const selection = readSelection();\n const edit = removePlaceholder(\n readValue(),\n placeholder,\n selection.start,\n selection.end,\n );\n\n if (edit) {\n applyEdit(edit);\n }\n\n announce(\n stringFormatter.format(\"upload.failed\", { name: file.name }),\n \"assertive\",\n );\n }\n };\n\n const uploadFiles = (files: File[]) => {\n if (!uploadFile || files.length === 0) {\n return;\n }\n\n const textArea = textAreaRef.current;\n const caret =\n textArea && wasFocusedRef.current\n ? textArea.selectionStart\n : readValue().length;\n\n const uploads = files.map((file) => ({\n file,\n placeholder: uploadPlaceholder(file.name),\n }));\n\n applyEdit(\n insertAtCaret(\n readValue(),\n uploads.map((upload) => upload.placeholder).join(\"\\n\"),\n caret,\n ),\n );\n textArea?.focus();\n\n for (const upload of uploads) {\n void runUpload(uploadFile, upload.file, upload.placeholder);\n }\n };\n\n const uploadFilesRef = useRef(uploadFiles);\n uploadFilesRef.current = uploadFiles;\n\n /*\n * The paste listener is attached imperatively rather than through react-aria's\n * `useClipboard`, which calls `preventDefault` on every paste it sees and\n * would take plain text pasting with it.\n */\n useEffect(() => {\n const textArea = textAreaRef.current;\n\n if (!textArea || !isEnabled) {\n return;\n }\n\n const handlePaste = (event: ClipboardEvent) => {\n const files = acceptedFrom(event.clipboardData?.files, accept);\n\n if (files.length === 0) {\n return;\n }\n\n event.preventDefault();\n uploadFilesRef.current(files);\n };\n\n textArea.addEventListener(\"paste\", handlePaste);\n return () => textArea.removeEventListener(\"paste\", handlePaste);\n }, [isEnabled, accept, textAreaRef]);\n\n /*\n * Native handlers rather than react-aria's `useDrop`: that one claims every\n * drag it sees — its `onDrop` calls `preventDefault` and `stopPropagation`\n * unconditionally — which is right for a dedicated drop surface like\n * `FileDropZone`, but here it would swallow a plain text drag into the\n * textarea. A drag is claimed only when it carries files, and\n * `dataTransfer.types` is the only place that says so: the public\n * `DragTypes` of `getDropOperation` offers just `has(type)`, which cannot\n * express it — the wildcard type is always true, and WebKit reports every\n * file drag as an unknown type that answers true to anything.\n */\n const dragHasFiles = (event: ReactDragEvent) =>\n event.dataTransfer.types.includes(\"Files\");\n\n /*\n * `dragenter` and `dragleave` fire again for every child the pointer\n * crosses, so the highlight follows their balance rather than the last one.\n */\n const dragDepth = useRef(0);\n const [isDropTarget, setIsDropTarget] = useState(false);\n\n const endDrag = () => {\n dragDepth.current = 0;\n setIsDropTarget(false);\n };\n\n const dropProps: DropProps = isEnabled\n ? {\n onDragEnter: (event) => {\n if (!dragHasFiles(event)) {\n return;\n }\n event.preventDefault();\n dragDepth.current += 1;\n setIsDropTarget(true);\n },\n onDragOver: (event) => {\n if (!dragHasFiles(event)) {\n return;\n }\n // Without this the browser refuses the drop and opens the file instead.\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n },\n onDragLeave: (event) => {\n if (!dragHasFiles(event)) {\n return;\n }\n dragDepth.current = Math.max(0, dragDepth.current - 1);\n if (dragDepth.current === 0) {\n setIsDropTarget(false);\n }\n },\n onDrop: (event) => {\n if (!dragHasFiles(event)) {\n return;\n }\n event.preventDefault();\n endDrag();\n uploadFilesRef.current(\n acceptedFrom(event.dataTransfer.files, accept),\n );\n },\n }\n : {};\n\n return {\n dropProps,\n isDropTarget,\n uploadFiles: uploadFile ? uploadFiles : undefined,\n };\n};\n"],"mappings":";;;;;;;;;;AAuBA,IAAM,gBAAgB,OAAoC,WACxD,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,SAAS,cAAc,MAAM,MAAM,CAAC;;;;;;;;AA6CtE,IAAa,iBAAiB,YAAiC;CAC7D,MAAM,EAAE,QAAQ,YAAY,YAAY,OAAO,UAAU,gBACvD;CAEF,MAAM,kBAAkB,4BACtBA,kBACA,gBACF;CAEA,MAAM,YAAY,CAAC,CAAC,cAAc,CAAC;CAQnC,MAAM,WAAW,OAAO,KAAK;CAC7B,gBAAgB;EACd,SAAS,UAAU;CACrB,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,kBAAkB,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C,aAAa,KAAK,GACrB;IAGF,MAAM,eAAe;IACrB,MAAM,aAAa,aAAa;GAClC;GACA,cAAc,UAAU;IACtB,IAAI,CAAC,aAAa,KAAK,GACrB;IAEF,UAAU,UAAU,KAAK,IAAI,GAAG,UAAU,UAAU,CAAC;IACrD,IAAI,UAAU,YAAY,GACxB,gBAAgB,KAAK;GAEzB;GACA,SAAS,UAAU;IACjB,IAAI,CAAC,aAAa,KAAK,GACrB;IAEF,MAAM,eAAe;IACrB,QAAQ;IACR,eAAe,QACb,aAAa,MAAM,aAAa,OAAO,MAAM,CAC/C;GACF;EACF,IACA,CAAC;EAIH;EACA,aAAa,aAAa,cAAc,KAAA;CAC1C;AACF"}
1
+ {"version":3,"file":"useFileUpload.mjs","names":["locales"],"sources":["../../../../../../../../src/components/MarkdownEditor/lib/useFileUpload.ts"],"sourcesContent":["import {\n type DragEvent as ReactDragEvent,\n type DragEventHandler,\n type RefObject,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { announce } from \"@react-aria/live-announcer\";\nimport { matchesAccept } from \"@/lib/files/acceptedFiles\";\nimport {\n insertAtCaret,\n type MarkdownEditorUpload,\n removePlaceholder,\n replacePlaceholder,\n uploadedFileMarkdown,\n uploadPlaceholder,\n type ValueEdit,\n} from \"@/components/MarkdownEditor/lib/fileUpload\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"../locales/*.locale.json\";\n\n/** The files of a paste or a drop that `accept` covers. */\nconst acceptedFrom = (files: FileList | null | undefined, accept?: string) =>\n Array.from(files ?? []).filter((file) => matchesAccept(file, accept));\n\n/** @internal */\nexport type MarkdownEditorFileUploadHandler = (\n file: File,\n) => Promise<MarkdownEditorUpload>;\n\ninterface Options {\n /** Which file types to take, as an `accept` attribute value. */\n accept?: string;\n disableImages?: boolean;\n /** Uploads one file. Uploading is off entirely while this is undefined. */\n uploadFile?: MarkdownEditorFileUploadHandler;\n /** Turns dropping, pasting and the toolbar button off. */\n isDisabled?: boolean;\n value: string;\n onChange: (value: string) => void;\n textAreaRef: RefObject<HTMLTextAreaElement | null>;\n}\n\ninterface DropProps {\n onDragEnter?: DragEventHandler;\n onDragOver?: DragEventHandler;\n onDragLeave?: DragEventHandler;\n onDrop?: DragEventHandler;\n}\n\ninterface FileUpload {\n /** Drop handling for the editor's root element. */\n dropProps: DropProps;\n /** Whether a drag is currently over the editor. */\n isDropTarget: boolean;\n /**\n * Uploads the files the toolbar button picked. `undefined` while uploading is\n * off.\n */\n uploadFiles?: (files: File[]) => void;\n}\n\n/**\n * Drop, paste and toolbar uploads for the `MarkdownEditor`: a placeholder\n * comment goes to the cursor right away and is replaced by a markdown link once\n * the consumer's upload resolves.\n *\n * @internal\n */\nexport const useFileUpload = (options: Options): FileUpload => {\n const {\n accept,\n uploadFile,\n disableImages,\n isDisabled,\n value,\n onChange,\n textAreaRef,\n } = options;\n\n const stringFormatter = useLocalizedStringFormatter(\n locales,\n \"MarkdownEditor\",\n );\n\n const isEnabled = !!uploadFile && !isDisabled;\n\n /*\n * An upload resolves long after the drop, and the editor has kept taking\n * input in the meantime. The textarea's own value is the only one that is\n * current by then — the `value` prop is a render old whenever two uploads\n * resolve in the same tick.\n */\n const valueRef = useRef(value);\n useEffect(() => {\n valueRef.current = value;\n }, [value]);\n\n const readValue = () => textAreaRef.current?.value ?? valueRef.current;\n\n /*\n * A textarea keeps its `selectionStart` after losing focus, so the caret is\n * still readable once the attachment button has taken the focus away. What it\n * cannot tell apart is a caret at position 0 from one that was never placed —\n * both read 0, and appending is the better answer for the second.\n */\n const wasFocusedRef = useRef(false);\n useEffect(() => {\n const textArea = textAreaRef.current;\n\n if (!textArea) {\n return;\n }\n\n const rememberFocus = () => {\n wasFocusedRef.current = true;\n };\n\n textArea.addEventListener(\"focus\", rememberFocus);\n return () => textArea.removeEventListener(\"focus\", rememberFocus);\n }, [textAreaRef]);\n\n const readSelection = () => {\n const textArea = textAreaRef.current;\n const fallback = readValue().length;\n return {\n start: textArea?.selectionStart ?? fallback,\n end: textArea?.selectionEnd ?? fallback,\n };\n };\n\n const applyEdit = (edit: ValueEdit) => {\n valueRef.current = edit.value;\n\n const textArea = textAreaRef.current;\n if (textArea) {\n /*\n * Written before the re-render so an upload resolving in the same tick\n * reads this one's result, and the selection restored after it, once\n * React has rendered the controlled value.\n */\n textArea.value = edit.value;\n requestAnimationFrame(() => {\n textArea.setSelectionRange(edit.selectionStart, edit.selectionEnd);\n });\n }\n\n onChange(edit.value);\n };\n\n const runUpload = async (\n upload: MarkdownEditorFileUploadHandler,\n file: File,\n placeholder: string,\n ) => {\n announce(\n stringFormatter.format(\"upload.pending\", { name: file.name }),\n \"polite\",\n );\n\n try {\n const result = await upload(file);\n const selection = readSelection();\n const edit = replacePlaceholder(\n readValue(),\n placeholder,\n uploadedFileMarkdown(file, result, disableImages),\n selection.start,\n selection.end,\n );\n\n if (edit) {\n applyEdit(edit);\n }\n\n announce(\n stringFormatter.format(\"upload.succeeded\", { name: file.name }),\n \"polite\",\n );\n } catch {\n const selection = readSelection();\n const edit = removePlaceholder(\n readValue(),\n placeholder,\n selection.start,\n selection.end,\n );\n\n if (edit) {\n applyEdit(edit);\n }\n\n announce(\n stringFormatter.format(\"upload.failed\", { name: file.name }),\n \"assertive\",\n );\n }\n };\n\n const uploadFiles = (files: File[]) => {\n if (!uploadFile || files.length === 0) {\n return;\n }\n\n const textArea = textAreaRef.current;\n const caret =\n textArea && wasFocusedRef.current\n ? textArea.selectionStart\n : readValue().length;\n\n const uploads = files.map((file) => ({\n file,\n placeholder: uploadPlaceholder(file.name),\n }));\n\n applyEdit(\n insertAtCaret(\n readValue(),\n uploads.map((upload) => upload.placeholder).join(\"\\n\"),\n caret,\n ),\n );\n textArea?.focus();\n\n for (const upload of uploads) {\n void runUpload(uploadFile, upload.file, upload.placeholder);\n }\n };\n\n const uploadFilesRef = useRef(uploadFiles);\n uploadFilesRef.current = uploadFiles;\n\n /*\n * The paste listener is attached imperatively rather than through react-aria's\n * `useClipboard`, which calls `preventDefault` on every paste it sees and\n * would take plain text pasting with it.\n */\n useEffect(() => {\n const textArea = textAreaRef.current;\n\n if (!textArea || !isEnabled) {\n return;\n }\n\n const handlePaste = (event: ClipboardEvent) => {\n const files = acceptedFrom(event.clipboardData?.files, accept);\n\n if (files.length === 0) {\n return;\n }\n\n event.preventDefault();\n uploadFilesRef.current(files);\n };\n\n textArea.addEventListener(\"paste\", handlePaste);\n return () => textArea.removeEventListener(\"paste\", handlePaste);\n }, [isEnabled, accept, textAreaRef]);\n\n /*\n * Native handlers rather than react-aria's `useDrop`: that one claims every\n * drag it sees — its `onDrop` calls `preventDefault` and `stopPropagation`\n * unconditionally — which is right for a dedicated drop surface like\n * `FileDropZone`, but here it would swallow a plain text drag into the\n * textarea. A drag is claimed only when it carries files, and\n * `dataTransfer.types` is the only place that says so: the public\n * `DragTypes` of `getDropOperation` offers just `has(type)`, which cannot\n * express it — the wildcard type is always true, and WebKit reports every\n * file drag as an unknown type that answers true to anything.\n */\n const dragHasFiles = (event: ReactDragEvent) =>\n event.dataTransfer.types.includes(\"Files\");\n\n /*\n * `dragenter` and `dragleave` fire again for every child the pointer\n * crosses, so the highlight follows their balance rather than the last one.\n */\n const dragDepth = useRef(0);\n const [isDropTarget, setIsDropTarget] = useState(false);\n\n const endDrag = () => {\n dragDepth.current = 0;\n setIsDropTarget(false);\n };\n\n const dropProps: DropProps = isEnabled\n ? {\n onDragEnter: (event) => {\n if (!dragHasFiles(event)) {\n return;\n }\n event.preventDefault();\n dragDepth.current += 1;\n setIsDropTarget(true);\n },\n onDragOver: (event) => {\n if (!dragHasFiles(event)) {\n return;\n }\n // Without this the browser refuses the drop and opens the file instead.\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n },\n onDragLeave: (event) => {\n if (!dragHasFiles(event)) {\n return;\n }\n dragDepth.current = Math.max(0, dragDepth.current - 1);\n if (dragDepth.current === 0) {\n setIsDropTarget(false);\n }\n },\n onDrop: (event) => {\n if (!dragHasFiles(event)) {\n return;\n }\n event.preventDefault();\n endDrag();\n uploadFilesRef.current(\n acceptedFrom(event.dataTransfer.files, accept),\n );\n },\n }\n : {};\n\n return {\n dropProps,\n isDropTarget,\n uploadFiles: uploadFile ? uploadFiles : undefined,\n };\n};\n"],"mappings":";;;;;;;;;;AAuBA,IAAM,gBAAgB,OAAoC,WACxD,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,SAAS,cAAc,MAAM,MAAM,CAAC;;;;;;;;AA8CtE,IAAa,iBAAiB,YAAiC;CAC7D,MAAM,EACJ,QACA,YACA,eACA,YACA,OACA,UACA,gBACE;CAEJ,MAAM,kBAAkB,4BACtBA,kBACA,gBACF;CAEA,MAAM,YAAY,CAAC,CAAC,cAAc,CAAC;CAQnC,MAAM,WAAW,OAAO,KAAK;CAC7B,gBAAgB;EACd,SAAS,UAAU;CACrB,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,kBAAkB,YAAY,SAAS,SAAS,SAAS;CAQ/D,MAAM,gBAAgB,OAAO,KAAK;CAClC,gBAAgB;EACd,MAAM,WAAW,YAAY;EAE7B,IAAI,CAAC,UACH;EAGF,MAAM,sBAAsB;GAC1B,cAAc,UAAU;EAC1B;EAEA,SAAS,iBAAiB,SAAS,aAAa;EAChD,aAAa,SAAS,oBAAoB,SAAS,aAAa;CAClE,GAAG,CAAC,WAAW,CAAC;CAEhB,MAAM,sBAAsB;EAC1B,MAAM,WAAW,YAAY;EAC7B,MAAM,WAAW,UAAU,CAAC,CAAC;EAC7B,OAAO;GACL,OAAO,UAAU,kBAAkB;GACnC,KAAK,UAAU,gBAAgB;EACjC;CACF;CAEA,MAAM,aAAa,SAAoB;EACrC,SAAS,UAAU,KAAK;EAExB,MAAM,WAAW,YAAY;EAC7B,IAAI,UAAU;GAMZ,SAAS,QAAQ,KAAK;GACtB,4BAA4B;IAC1B,SAAS,kBAAkB,KAAK,gBAAgB,KAAK,YAAY;GACnE,CAAC;EACH;EAEA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aAAa,MAAM,eAAe,OAAO,MAAM;GAE7D,IAAI,MAAM,WAAW,GACnB;GAGF,MAAM,eAAe;GACrB,eAAe,QAAQ,KAAK;EAC9B;EAEA,SAAS,iBAAiB,SAAS,WAAW;EAC9C,aAAa,SAAS,oBAAoB,SAAS,WAAW;CAChE,GAAG;EAAC;EAAW;EAAQ;CAAW,CAAC;CAanC,MAAM,gBAAgB,UACpB,MAAM,aAAa,MAAM,SAAS,OAAO;CAM3C,MAAM,YAAY,OAAO,CAAC;CAC1B,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CAEtD,MAAM,gBAAgB;EACpB,UAAU,UAAU;EACpB,gBAAgB,KAAK;CACvB;CA0CA,OAAO;EACL,WAzC2B,YACzB;GACE,cAAc,UAAU;IACtB,IAAI,CAAC,aAAa,KAAK,GACrB;IAEF,MAAM,eAAe;IACrB,UAAU,WAAW;IACrB,gBAAgB,IAAI;GACtB;GACA,aAAa,UAAU;IACrB,IAAI,CAAC,aAAa,KAAK,GACrB;IAGF,MAAM,eAAe;IACrB,MAAM,aAAa,aAAa;GAClC;GACA,cAAc,UAAU;IACtB,IAAI,CAAC,aAAa,KAAK,GACrB;IAEF,UAAU,UAAU,KAAK,IAAI,GAAG,UAAU,UAAU,CAAC;IACrD,IAAI,UAAU,YAAY,GACxB,gBAAgB,KAAK;GAEzB;GACA,SAAS,UAAU;IACjB,IAAI,CAAC,aAAa,KAAK,GACrB;IAEF,MAAM,eAAe;IACrB,QAAQ;IACR,eAAe,QACb,aAAa,MAAM,aAAa,OAAO,MAAM,CAC/C;GACF;EACF,IACA,CAAC;EAIH;EACA,aAAa,aAAa,cAAc,KAAA;CAC1C;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.module.mjs","names":[],"sources":["../../../../../../../src/components/Notification/Notification.module.scss"],"sourcesContent":["@use \"@/styles/mixins/focus\";\n@use \"@/styles/mixins/skeleton\";\n\n.notification {\n border-radius: var(--notification--corner-radius);\n width: var(--notification--width);\n max-width: var(--notification--max-width);\n box-shadow: var(--notification--box-shadow);\n position: relative;\n border: var(--notification--border-width) var(--notification--border-style)\n var(--notification--border-color);\n\n /* The status stripe is masked out of a layer in the notification's\n shape, so it follows the corner radius instead of bending into it. */\n &::after {\n content: \"\";\n position: absolute;\n inset: calc(var(--notification--border-width) * -1);\n border-radius: inherit;\n pointer-events: none;\n mask-image: linear-gradient(\n to right,\n #000 var(--notification--border-x-start-width),\n transparent 0\n );\n }\n\n &:dir(rtl)::after {\n mask-image: linear-gradient(\n to left,\n #000 var(--notification--border-x-start-width),\n transparent 0\n );\n }\n\n @extend .info;\n\n /* Elements */\n\n .link {\n padding: var(--notification--padding);\n padding-inline-start: calc(\n var(--notification--padding) + var(--notification--border-x-start-width)\n );\n display: flex;\n flex-direction: column;\n row-gap: var(--notification--heading-to-text-spacing);\n cursor: default;\n transition-property: background-color;\n transition-duration: var(--transition--duration--default);\n position: relative;\n border-radius: calc(var(--notification--corner-radius) - 1px);\n\n @include focus.focus;\n }\n\n .heading {\n --button-size: calc(\n var(--button--line-height-s) + 2 * var(--button--padding-s-x)\n );\n\n padding-inline-end: calc(\n var(--button-size) + var(--heading--icon-to-text-spacing)\n );\n\n .icon {\n height: var(--heading-line-height);\n width: var(--heading-line-height);\n vertical-align: bottom;\n display: inline-block;\n margin-inline-end: var(--heading--icon-to-text-spacing);\n }\n }\n\n .text {\n font-size: var(--notification--font-size);\n }\n\n .close {\n position: absolute;\n top: var(--notification--padding);\n inset-inline-end: var(--notification--padding);\n }\n\n /* Status */\n\n @mixin status($status) {\n &.#{$status} {\n .link {\n border-color: var(--notification--#{$status}-background-color--default);\n background-color: var(\n --notification--#{$status}-background-color--default\n );\n }\n\n &::after {\n background-color: var(--notification--#{$status}-border-color);\n }\n\n &.hasLink {\n .link {\n &:hover {\n background-color: var(\n --notification--#{$status}-background-color--hover\n );\n }\n\n &[data-pressed] {\n background-color: var(\n --notification--#{$status}-background-color--pressed\n );\n }\n }\n }\n\n .heading {\n color: var(--notification--#{$status}-heading-color);\n }\n }\n }\n\n @include status(info);\n @include status(warning);\n @include status(danger);\n @include status(success);\n @include status(unavailable);\n\n /* SkeletonMode: no status color while the content loads */\n &.skeleton::after {\n background-color: skeleton.$background-color;\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"Notification.module.mjs","names":[],"sources":["../../../../../../../src/components/Notification/Notification.module.scss"],"sourcesContent":["@use \"@/styles/mixins/focus\";\n@use \"@/styles/mixins/skeleton\";\n\n.notification {\n border-radius: var(--notification--corner-radius);\n width: var(--notification--width);\n max-width: var(--notification--max-width);\n box-shadow: var(--notification--box-shadow);\n position: relative;\n border: var(--notification--border-width) var(--notification--border-style)\n var(--notification--border-color);\n\n &::after {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n width: var(--notification--border-x-start-width);\n inset-inline-start: calc(var(--size-px--xxxs) * -1);\n border-start-start-radius: var(--notification--corner-radius);\n border-end-start-radius: var(--notification--corner-radius);\n }\n\n @extend .info;\n\n /* Elements */\n\n .link {\n padding: var(--notification--padding);\n padding-inline-start: calc(\n var(--notification--padding) + var(--notification--border-x-start-width)\n );\n display: flex;\n flex-direction: column;\n row-gap: var(--notification--heading-to-text-spacing);\n cursor: default;\n transition-property: background-color;\n transition-duration: var(--transition--duration--default);\n position: relative;\n border-radius: calc(var(--notification--corner-radius) - 1px);\n\n @include focus.focus;\n }\n\n .heading {\n --button-size: calc(\n var(--button--line-height-s) + 2 * var(--button--padding-s-x)\n );\n\n padding-inline-end: calc(\n var(--button-size) + var(--heading--icon-to-text-spacing)\n );\n\n .icon {\n height: var(--heading-line-height);\n width: var(--heading-line-height);\n vertical-align: bottom;\n display: inline-block;\n margin-inline-end: var(--heading--icon-to-text-spacing);\n }\n }\n\n .text {\n font-size: var(--notification--font-size);\n }\n\n .close {\n position: absolute;\n top: var(--notification--padding);\n inset-inline-end: var(--notification--padding);\n }\n\n /* Status */\n\n @mixin status($status) {\n &.#{$status} {\n .link {\n border-color: var(--notification--#{$status}-background-color--default);\n background-color: var(\n --notification--#{$status}-background-color--default\n );\n }\n\n &::after {\n background-color: var(--notification--#{$status}-border-color);\n }\n\n &.hasLink {\n .link {\n &:hover {\n background-color: var(\n --notification--#{$status}-background-color--hover\n );\n }\n\n &[data-pressed] {\n background-color: var(\n --notification--#{$status}-background-color--pressed\n );\n }\n }\n }\n\n .heading {\n color: var(--notification--#{$status}-heading-color);\n }\n }\n }\n\n @include status(info);\n @include status(warning);\n @include status(danger);\n @include status(success);\n @include status(unavailable);\n\n /* SkeletonMode: no status color while the content loads */\n &.skeleton::after {\n background-color: skeleton.$background-color;\n }\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Overlay.module.mjs","names":[],"sources":["../../../../../../../src/components/Overlay/Overlay.module.scss"],"sourcesContent":["/* Full-page backdrop behind every overlay (Modal, LightBox, …).\n\n Sized to `--visual-viewport-height`, the property the Modal wrapper uses too,\n so the whole overlay stack tracks the on-screen keyboard as one. react-aria\n publishes it on this element and updates it with the visual viewport.\n\n Not `--page-height` (the full document height): this element is `fixed`, so\n anything past the viewport never shows, while `backdrop-filter` blurs the\n whole layer every frame. Chromium drops an oversized one for single frames\n while scrolling, flickering backdrop and modal alike. #2338 switched\n `absolute` → `fixed` and added the blur, but kept the `--page-height` that\n `absolute` had needed. */\n.overlay {\n position: fixed;\n top: 0;\n inset-inline-start: 0;\n width: 100%;\n height: var(--visual-viewport-height);\n isolation: isolate;\n background: var(--overlay--backdrop-color);\n backdrop-filter: blur(var(--blur));\n\n &[data-entering] {\n animation: overlay-fade var(--transition--duration--slow);\n }\n\n &[data-exiting] {\n animation: overlay-fade var(--transition--duration--default) reverse ease-in;\n }\n}\n\n/* Centering viewport between the backdrop and react-aria's modal wrapper.\n Sized to the visual viewport so it tracks the on-screen keyboard. Modal,\n OffCanvas and LightBox refine it (padding, pointer-events) — they used to\n repeat this whole block behind a `> div` selector each. */\n.viewport {\n position: fixed;\n height: var(--visual-viewport-height);\n display: flex;\n flex-direction: column;\n width: 100%;\n justify-content: center;\n align-items: center;\n}\n\n/* Fallback shown while suspended overlay content loads. */\n.suspense {\n padding: var(--size-px--xl);\n}\n\n@keyframes overlay-fade {\n 0% {\n opacity: 0;\n }\n\n 50% {\n opacity: 1;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n@media (prefers-contrast: more), (prefers-reduced-transparency) {\n .overlay {\n backdrop-filter: none;\n background-color: var(--dark--color--strong--300);\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"Overlay.module.mjs","names":[],"sources":["../../../../../../../src/components/Overlay/Overlay.module.scss"],"sourcesContent":["/* Full-page backdrop behind every overlay (Modal, LightBox, …).\n\n Sized to `--visual-viewport-height`, the property the Modal wrapper uses too,\n so the whole overlay stack tracks the on-screen keyboard as one. react-aria\n publishes it on this element and updates it with the visual viewport.\n\n Not `--page-height` (the full document height): this element is `fixed`, so\n anything past the viewport never shows, while `backdrop-filter` blurs the\n whole layer every frame. Chromium drops an oversized one for single frames\n while scrolling, flickering backdrop and modal alike. #2338 switched\n `absolute` → `fixed` and added the blur, but kept the `--page-height` that\n `absolute` had needed. */\n.overlay {\n position: fixed;\n top: 0;\n inset-inline-start: 0;\n width: 100%;\n height: var(--visual-viewport-height);\n isolation: isolate;\n background: var(--overlay--backdrop-color);\n backdrop-filter: blur(var(--blur));\n\n &[data-entering] {\n animation: overlay-fade var(--transition--duration--slow);\n }\n\n &[data-exiting] {\n animation: overlay-fade var(--transition--duration--default) reverse ease-in;\n }\n}\n\n/* Centering viewport between the backdrop and react-aria's modal wrapper.\n Sized to the visual viewport so it tracks the on-screen keyboard. Modal,\n OffCanvas and LightBox refine it (padding, pointer-events) — they used to\n repeat this whole block behind a `> div` selector each. */\n.viewport {\n position: fixed;\n height: var(--visual-viewport-height);\n display: flex;\n flex-direction: column;\n width: 100%;\n justify-content: center;\n align-items: center;\n}\n\n/* Fallback shown while suspended overlay content loads. */\n.suspense {\n padding: var(--size-px--xl);\n}\n\n@keyframes overlay-fade {\n 0% {\n opacity: 0;\n }\n\n 50% {\n opacity: 1;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n@media (prefers-contrast: more), (prefers-reduced-transparency) {\n .overlay {\n backdrop-filter: none;\n background-color: var(--dark--color--600);\n }\n}\n"],"mappings":""}
@@ -10,7 +10,7 @@ var ProgressBarBar = (props) => {
10
10
  const { segments, percentage } = props;
11
11
  if (useSkeletonMode()) return /* @__PURE__ */ jsx("div", { className: ProgressBar_module_default.bar });
12
12
  const segmentFill = segments && segments.length > 0 ? segments.map((s, i) => {
13
- const backgroundColor = !s.color ? `var(--categorical--color--${getCategoricalColorByIndex(i)})` : isCategoricalColor(s.color) ? `var(--categorical--color--${s.color})` : s.color;
13
+ const backgroundColor = !s.color ? `var(--color--categorical--${getCategoricalColorByIndex(i)})` : isCategoricalColor(s.color) ? `var(--color--categorical--${s.color})` : s.color;
14
14
  return /* @__PURE__ */ jsx("div", {
15
15
  "aria-hidden": true,
16
16
  className: ProgressBar_module_default.segment,
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBarBar.mjs","names":["styles"],"sources":["../../../../../../../../src/components/ProgressBar/components/ProgressBarBar.tsx"],"sourcesContent":["import styles from \"@/components/ProgressBar/ProgressBar.module.scss\";\nimport type { FC } from \"react\";\nimport type { ProgressBarProps } from \"@/components/ProgressBar\";\nimport { getCategoricalColorByIndex } from \"@/lib/tokens/getCategoricalColorByIndex\";\nimport { isCategoricalColor } from \"@/lib/tokens/isCategoricalColor\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\n\ninterface Props extends Pick<ProgressBarProps, \"segments\"> {\n percentage?: number;\n}\n\nexport const ProgressBarBar: FC<Props> = (props) => {\n const { segments, percentage } = props;\n\n const isSkeleton = useSkeletonMode();\n\n /* In the mode, the track stays and shows no value. */\n if (isSkeleton) {\n return <div className={styles.bar} />;\n }\n\n const segmentFill =\n segments && segments.length > 0\n ? segments.map((s, i) => {\n const backgroundColor = !s.color\n ? `var(--categorical--color--${getCategoricalColorByIndex(i)})`\n : isCategoricalColor(s.color)\n ? `var(--categorical--color--${s.color})`\n : s.color;\n\n return (\n <div\n key={s.title}\n aria-hidden\n className={styles.segment}\n style={{\n backgroundColor,\n \"--progress-bar--segment-value\": s.value,\n }}\n />\n );\n })\n : null;\n\n return (\n <div className={styles.bar}>\n <div\n className={styles.fill}\n style={{ \"--progress-bar--percentage\": percentage }}\n >\n {segmentFill}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAWA,IAAa,kBAA6B,UAAU;CAClD,MAAM,EAAE,UAAU,eAAe;CAKjC,IAHmB,gBAGf,GACF,OAAO,oBAAC,OAAD,EAAK,WAAWA,2BAAO,IAAM,CAAA;CAGtC,MAAM,cACJ,YAAY,SAAS,SAAS,IAC1B,SAAS,KAAK,GAAG,MAAM;EACrB,MAAM,kBAAkB,CAAC,EAAE,QACvB,6BAA6B,2BAA2B,CAAC,EAAE,KAC3D,mBAAmB,EAAE,KAAK,IACxB,6BAA6B,EAAE,MAAM,KACrC,EAAE;EAER,OACE,oBAAC,OAAD;GAEE,eAAA;GACA,WAAWA,2BAAO;GAClB,OAAO;IACL;IACA,iCAAiC,EAAE;GACrC;EACD,GAPM,EAAE,KAOR;CAEL,CAAC,IACD;CAEN,OACE,oBAAC,OAAD;EAAK,WAAWA,2BAAO;EACrB,UAAA,oBAAC,OAAD;GACE,WAAWA,2BAAO;GAClB,OAAO,EAAE,8BAA8B,WAAW;GAEjD,UAAA;EACE,CAAA;CACF,CAAA;AAET"}
1
+ {"version":3,"file":"ProgressBarBar.mjs","names":["styles"],"sources":["../../../../../../../../src/components/ProgressBar/components/ProgressBarBar.tsx"],"sourcesContent":["import styles from \"@/components/ProgressBar/ProgressBar.module.scss\";\nimport type { FC } from \"react\";\nimport type { ProgressBarProps } from \"@/components/ProgressBar\";\nimport { getCategoricalColorByIndex } from \"@/lib/tokens/getCategoricalColorByIndex\";\nimport { isCategoricalColor } from \"@/lib/tokens/isCategoricalColor\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\n\ninterface Props extends Pick<ProgressBarProps, \"segments\"> {\n percentage?: number;\n}\n\nexport const ProgressBarBar: FC<Props> = (props) => {\n const { segments, percentage } = props;\n\n const isSkeleton = useSkeletonMode();\n\n /* In the mode, the track stays and shows no value. */\n if (isSkeleton) {\n return <div className={styles.bar} />;\n }\n\n const segmentFill =\n segments && segments.length > 0\n ? segments.map((s, i) => {\n const backgroundColor = !s.color\n ? `var(--color--categorical--${getCategoricalColorByIndex(i)})`\n : isCategoricalColor(s.color)\n ? `var(--color--categorical--${s.color})`\n : s.color;\n\n return (\n <div\n key={s.title}\n aria-hidden\n className={styles.segment}\n style={{\n backgroundColor,\n \"--progress-bar--segment-value\": s.value,\n }}\n />\n );\n })\n : null;\n\n return (\n <div className={styles.bar}>\n <div\n className={styles.fill}\n style={{ \"--progress-bar--percentage\": percentage }}\n >\n {segmentFill}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAWA,IAAa,kBAA6B,UAAU;CAClD,MAAM,EAAE,UAAU,eAAe;CAKjC,IAHmB,gBAGf,GACF,OAAO,oBAAC,OAAD,EAAK,WAAWA,2BAAO,IAAM,CAAA;CAGtC,MAAM,cACJ,YAAY,SAAS,SAAS,IAC1B,SAAS,KAAK,GAAG,MAAM;EACrB,MAAM,kBAAkB,CAAC,EAAE,QACvB,6BAA6B,2BAA2B,CAAC,EAAE,KAC3D,mBAAmB,EAAE,KAAK,IACxB,6BAA6B,EAAE,MAAM,KACrC,EAAE;EAER,OACE,oBAAC,OAAD;GAEE,eAAA;GACA,WAAWA,2BAAO;GAClB,OAAO;IACL;IACA,iCAAiC,EAAE;GACrC;EACD,GAPM,EAAE,KAOR;CAEL,CAAC,IACD;CAEN,OACE,oBAAC,OAAD;EAAK,WAAWA,2BAAO;EACrB,UAAA,oBAAC,OAAD;GACE,WAAWA,2BAAO;GAClB,OAAO,EAAE,8BAA8B,WAAW;GAEjD,UAAA;EACE,CAAA;CACF,CAAA;AAET"}
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
  /* */
3
- import { isAlphaColor } from "../../lib/types/props.mjs";
4
3
  import { PropsContextProvider } from "../../lib/propsContext/components/PropsContextProvider.mjs";
5
4
  import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
5
+ import { isAlphaColor } from "../../lib/types/props.mjs";
6
6
  import { useSkeletonMode } from "../SkeletonMode/skeletonModeContext.mjs";
7
7
  import { Wrap } from "../Wrap/Wrap.mjs";
8
8
  import { EmulatedBoldText } from "../EmulatedBoldText/EmulatedBoldText.mjs";
@@ -2,7 +2,7 @@
2
2
  /* */
3
3
  import all_light_default from "../../../../design-tokens/dist/json-runtime/all-light.mjs";
4
4
  // src/lib/tokens/CategoricalColors.ts
5
- var categoricalColors = Object.keys(all_light_default.categorical.color);
5
+ var categoricalColors = Object.keys(all_light_default.color.categorical);
6
6
  export { categoricalColors };
7
7
 
8
8
  //# sourceMappingURL=CategoricalColors.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CategoricalColors.mjs","names":["tokens"],"sources":["../../../../../../../src/lib/tokens/CategoricalColors.ts"],"sourcesContent":["import tokens from \"@mittwald/flow-design-tokens/json-runtime/all-light.json\";\n\nexport const categoricalColors = Object.keys(\n tokens.categorical.color,\n) as (keyof typeof tokens.categorical.color)[];\n\nexport type CategoricalColor = (typeof categoricalColors)[number];\nexport type CategoricalWithCustomColor = CategoricalColor | (string & {});\n"],"mappings":";;;;AAEA,IAAa,oBAAoB,OAAO,KACtCA,kBAAO,YAAY,KACrB"}
1
+ {"version":3,"file":"CategoricalColors.mjs","names":["tokens"],"sources":["../../../../../../../src/lib/tokens/CategoricalColors.ts"],"sourcesContent":["import tokens from \"@mittwald/flow-design-tokens/json-runtime/all-light.json\";\n\nexport const categoricalColors = Object.keys(\n tokens.color.categorical,\n) as (keyof typeof tokens.color.categorical)[];\n\nexport type CategoricalColor = (typeof categoricalColors)[number];\nexport type CategoricalWithCustomColor = CategoricalColor | (string & {});\n"],"mappings":";;;;AAEA,IAAa,oBAAoB,OAAO,KACtCA,kBAAO,MAAM,WACf"}
@@ -17,22 +17,6 @@ var alphaColors = [
17
17
  function isAlphaColor(color) {
18
18
  return alphaColors.includes(color);
19
19
  }
20
- /** The decorative colors, one per mittwald brand color. */
21
- var decorativeColors = [
22
- "blue",
23
- "navy",
24
- "lilac",
25
- "sage",
26
- "salmon"
27
- ];
28
- /**
29
- * Deprecated decorative color values and the color each renders as. `violet`
30
- * duplicated `lilac`; `teal` already rendered the sage tone.
31
- */
32
- var deprecatedDecorativeColors = {
33
- violet: "lilac",
34
- teal: "sage"
35
- };
36
- export { alphaColors, decorativeColors, deprecatedDecorativeColors, isAlphaColor, statusTypes };
20
+ export { alphaColors, isAlphaColor, statusTypes };
37
21
 
38
22
  //# sourceMappingURL=props.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.mjs","names":[],"sources":["../../../../../../../src/lib/types/props.ts"],"sourcesContent":["import type { FlowComponentName } from \"@/components/propTypes\";\nimport type { ExoticComponent, HTMLAttributes } from \"react\";\n\nexport const statusTypes = [\n \"info\",\n \"success\",\n \"warning\",\n \"danger\",\n \"unavailable\",\n] as const;\n\nexport type Status = (typeof statusTypes)[number];\n\nexport type PropsWithStatus<T extends Status = Status, P = unknown> = P & {\n /** The elements status */\n status?: T;\n};\n\nexport type TunnelTarget = {\n id: string;\n component: FlowComponentName;\n /**\n * A stable entry id instead of a generated one. Needed wherever the same\n * component is rendered more than once for a single logical element:\n * react-aria renders collection children twice — once into its hidden\n * collection document, once for real — and a generated id would register each\n * render as its own entry, so the tunnel exit renders every element twice.\n * Must be unique among the siblings of one tunnel.\n */\n staticEntryId?: string;\n} | null;\n\nexport interface PropsWithTunnel {\n /** @internal */\n tunnel?: TunnelTarget;\n}\n\nexport interface PropsWithClassName {\n /** The elements class name. */\n className?: string;\n}\n\nexport type PropsWithElementType<\n T extends keyof HTMLElementTagNameMap = never,\n> = HTMLAttributes<HTMLElement> & {\n /** The HTML element or React component rendered as the elements root. */\n elementType?: T | ExoticComponent;\n};\n\nexport type ContainerBreakpointSize = \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n\nexport interface PropsWithContainerBreakpointSize {\n /**\n * The breakpoint at which the element switches to its compact layout.\n * Evaluated as a container query against the surrounding container, not\n * against the viewport.\n */\n containerBreakpointSize?: ContainerBreakpointSize;\n}\n\nexport const alphaColors = [\n \"dark\",\n \"light\",\n \"dark-static\",\n \"light-static\",\n] as const;\n\nexport type AlphaColor = (typeof alphaColors)[number];\n\nexport function isAlphaColor(color: string): color is AlphaColor {\n return alphaColors.includes(color as AlphaColor);\n}\n\n/** The decorative colors, one per mittwald brand color. */\nexport const decorativeColors = [\n \"blue\",\n \"navy\",\n \"lilac\",\n \"sage\",\n \"salmon\",\n] as const;\n\nexport type DecorativeColor = (typeof decorativeColors)[number];\n\n/**\n * Deprecated decorative color values and the color each renders as. `violet`\n * duplicated `lilac`; `teal` already rendered the sage tone.\n */\nexport const deprecatedDecorativeColors = {\n violet: \"lilac\",\n teal: \"sage\",\n} as const satisfies Record<string, DecorativeColor>;\n\nexport type DeprecatedDecorativeColor = keyof typeof deprecatedDecorativeColors;\n"],"mappings":";;;AAGA,IAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;AACF;AAmDA,IAAa,cAAc;CACzB;CACA;CACA;CACA;AACF;AAIA,SAAgB,aAAa,OAAoC;CAC/D,OAAO,YAAY,SAAS,KAAmB;AACjD;;AAGA,IAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;AACF;;;;;AAQA,IAAa,6BAA6B;CACxC,QAAQ;CACR,MAAM;AACR"}
1
+ {"version":3,"file":"props.mjs","names":[],"sources":["../../../../../../../src/lib/types/props.ts"],"sourcesContent":["import type { FlowComponentName } from \"@/components/propTypes\";\nimport type { ExoticComponent, HTMLAttributes } from \"react\";\n\nexport const statusTypes = [\n \"info\",\n \"success\",\n \"warning\",\n \"danger\",\n \"unavailable\",\n] as const;\n\nexport type Status = (typeof statusTypes)[number];\n\nexport type PropsWithStatus<T extends Status = Status, P = unknown> = P & {\n /** The elements status */\n status?: T;\n};\n\nexport type TunnelTarget = {\n id: string;\n component: FlowComponentName;\n /**\n * A stable entry id instead of a generated one. Needed wherever the same\n * component is rendered more than once for a single logical element:\n * react-aria renders collection children twice — once into its hidden\n * collection document, once for real — and a generated id would register each\n * render as its own entry, so the tunnel exit renders every element twice.\n * Must be unique among the siblings of one tunnel.\n */\n staticEntryId?: string;\n} | null;\n\nexport interface PropsWithTunnel {\n /** @internal */\n tunnel?: TunnelTarget;\n}\n\nexport interface PropsWithClassName {\n /** The elements class name. */\n className?: string;\n}\n\nexport type PropsWithElementType<\n T extends keyof HTMLElementTagNameMap = never,\n> = HTMLAttributes<HTMLElement> & {\n /** The HTML element or React component rendered as the elements root. */\n elementType?: T | ExoticComponent;\n};\n\nexport type ContainerBreakpointSize = \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n\nexport interface PropsWithContainerBreakpointSize {\n /**\n * The breakpoint at which the element switches to its compact layout.\n * Evaluated as a container query against the surrounding container, not\n * against the viewport.\n */\n containerBreakpointSize?: ContainerBreakpointSize;\n}\n\nexport const alphaColors = [\n \"dark\",\n \"light\",\n \"dark-static\",\n \"light-static\",\n] as const;\n\nexport type AlphaColor = (typeof alphaColors)[number];\n\nexport function isAlphaColor(color: string): color is AlphaColor {\n return alphaColors.includes(color as AlphaColor);\n}\n"],"mappings":";;;AAGA,IAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;AACF;AAmDA,IAAa,cAAc;CACzB;CACA;CACA;CACA;AACF;AAIA,SAAgB,aAAa,OAAoC;CAC/D,OAAO,YAAY,SAAS,KAAmB;AACjD"}