@flipdish/portal-library 7.12.1 → 8.0.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 (82) hide show
  1. package/README.md +22 -4
  2. package/dist/components/atoms/Tag/index.cjs.js +1 -1
  3. package/dist/components/atoms/Tag/index.cjs.js.map +1 -1
  4. package/dist/components/atoms/Tag/index.d.ts +3 -7
  5. package/dist/components/atoms/Tag/index.js +1 -1
  6. package/dist/components/atoms/Tag/index.js.map +1 -1
  7. package/dist/components/atoms/TextArea/index.cjs.js.map +1 -1
  8. package/dist/components/atoms/TextArea/index.d.ts +1 -1
  9. package/dist/components/atoms/TextArea/index.js.map +1 -1
  10. package/dist/components/atoms/TextField/index.cjs.js +1 -1
  11. package/dist/components/atoms/TextField/index.cjs.js.map +1 -1
  12. package/dist/components/atoms/TextField/index.d.ts +5 -22
  13. package/dist/components/atoms/TextField/index.js +1 -1
  14. package/dist/components/atoms/TextField/index.js.map +1 -1
  15. package/dist/components/molecules/AlertGlobal/index.cjs.js +1 -1
  16. package/dist/components/molecules/AlertGlobal/index.cjs.js.map +1 -1
  17. package/dist/components/molecules/AlertGlobal/index.d.ts +1 -8
  18. package/dist/components/molecules/AlertGlobal/index.js +1 -1
  19. package/dist/components/molecules/AlertGlobal/index.js.map +1 -1
  20. package/dist/components/molecules/Autocomplete/index.cjs.js +1 -1
  21. package/dist/components/molecules/Autocomplete/index.cjs.js.map +1 -1
  22. package/dist/components/molecules/Autocomplete/index.d.ts +1 -16
  23. package/dist/components/molecules/Autocomplete/index.js +1 -1
  24. package/dist/components/molecules/Autocomplete/index.js.map +1 -1
  25. package/dist/components/molecules/Pagination/index.cjs.js +1 -1
  26. package/dist/components/molecules/Pagination/index.cjs.js.map +1 -1
  27. package/dist/components/molecules/Pagination/index.d.ts +1 -12
  28. package/dist/components/molecules/Pagination/index.js +1 -1
  29. package/dist/components/molecules/Pagination/index.js.map +1 -1
  30. package/dist/components/molecules/QuantitySelector/index.cjs.js +1 -1
  31. package/dist/components/molecules/QuantitySelector/index.cjs.js.map +1 -1
  32. package/dist/components/molecules/QuantitySelector/index.d.ts +1 -7
  33. package/dist/components/molecules/QuantitySelector/index.js +1 -1
  34. package/dist/components/molecules/QuantitySelector/index.js.map +1 -1
  35. package/dist/components/molecules/Rating/index.cjs.js +1 -1
  36. package/dist/components/molecules/Rating/index.cjs.js.map +1 -1
  37. package/dist/components/molecules/Rating/index.d.ts +0 -15
  38. package/dist/components/molecules/Rating/index.js +1 -1
  39. package/dist/components/molecules/Rating/index.js.map +1 -1
  40. package/dist/components/molecules/SearchInput/index.cjs.js +1 -1
  41. package/dist/components/molecules/SearchInput/index.cjs.js.map +1 -1
  42. package/dist/components/molecules/SearchInput/index.d.ts +1 -5
  43. package/dist/components/molecules/SearchInput/index.js +1 -1
  44. package/dist/components/molecules/SearchInput/index.js.map +1 -1
  45. package/dist/components/organisms/FileUpload/components/FileDropZone.cjs.js +1 -1
  46. package/dist/components/organisms/FileUpload/components/FileDropZone.cjs.js.map +1 -1
  47. package/dist/components/organisms/FileUpload/components/FileDropZone.js +1 -1
  48. package/dist/components/organisms/FileUpload/components/FileDropZone.js.map +1 -1
  49. package/dist/components/organisms/Heading/Heading.cjs.js +1 -1
  50. package/dist/components/organisms/Heading/Heading.cjs.js.map +1 -1
  51. package/dist/components/organisms/Heading/Heading.d.ts +0 -1
  52. package/dist/components/organisms/Heading/Heading.js +1 -1
  53. package/dist/components/organisms/Heading/Heading.js.map +1 -1
  54. package/dist/localization/de.json.cjs.js +1 -1
  55. package/dist/localization/de.json.js +1 -1
  56. package/dist/localization/en-US.json.cjs.js +1 -1
  57. package/dist/localization/en-US.json.js +1 -1
  58. package/dist/localization/en.json.cjs.js +1 -1
  59. package/dist/localization/en.json.d.ts +116 -1
  60. package/dist/localization/en.json.js +1 -1
  61. package/dist/localization/es-MX.json.cjs.js +1 -1
  62. package/dist/localization/es-MX.json.js +1 -1
  63. package/dist/localization/es.json.cjs.js +1 -1
  64. package/dist/localization/es.json.js +1 -1
  65. package/dist/localization/fr.json.cjs.js +1 -1
  66. package/dist/localization/fr.json.js +1 -1
  67. package/dist/localization/it.json.cjs.js +1 -1
  68. package/dist/localization/it.json.js +1 -1
  69. package/dist/localization/nl.json.cjs.js +1 -1
  70. package/dist/localization/nl.json.js +1 -1
  71. package/dist/localization/pt.json.cjs.js +1 -1
  72. package/dist/localization/pt.json.js +1 -1
  73. package/dist/providers/TranslationProvider.cjs.js.map +1 -1
  74. package/dist/providers/TranslationProvider.d.ts +6 -2
  75. package/dist/providers/TranslationProvider.js +1 -1
  76. package/dist/providers/TranslationProvider.js.map +1 -1
  77. package/dist/utilities/renderUtilities.cjs.js +1 -1
  78. package/dist/utilities/renderUtilities.cjs.js.map +1 -1
  79. package/dist/utilities/renderUtilities.d.ts +14 -1
  80. package/dist/utilities/renderUtilities.js +1 -1
  81. package/dist/utilities/renderUtilities.js.map +1 -1
  82. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../Autocomplete/index.cjs.js");const a=({ariaLabel:a,clearTextAriaLabel:r,onChange:o,shortcutHotkeyAriaDescription:i,...s})=>e.jsx(t.Autocomplete,{...s,ariaLabel:a,multiple:!1,onChange:()=>{},onInputChange:o,options:[],translations:{clearTextAriaLabel:r,shortcutHotkeyAriaDescription:i,dismissTagAriaLabel:"",loadingText:"",noOptionsText:"",openPopupAriaLabel:""},type:"search"});exports.SearchInput=a,exports.default=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../Autocomplete/index.cjs.js");const r=({ariaLabel:r,onChange:a,...o})=>e.jsx(t.Autocomplete,{...o,ariaLabel:r,multiple:!1,onChange:()=>{},onInputChange:a,options:[],type:"search"});exports.SearchInput=r,exports.default=r;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/molecules/SearchInput/index.tsx"],"sourcesContent":["import Autocomplete, { type AutocompleteProps } from '../Autocomplete';\n\n/**\n * The props for the SearchInput component.\n */\nexport type SearchInputProps = Omit<\n AutocompleteProps,\n | 'errorText'\n | 'helperText'\n | 'label'\n | 'multiple'\n | 'onChange'\n | 'onInputChange'\n | 'options'\n | 'required'\n | 'translations'\n | 'type'\n> & {\n /** Aria-label for the search input. */\n ariaLabel: string;\n /** Aria-label for the clear button. */\n clearTextAriaLabel: AutocompleteProps['translations']['clearTextAriaLabel'];\n /** Called when the input text changes. */\n onChange: AutocompleteProps['onInputChange'];\n /** Screen reader hint describing the shortcut, e.g., \"Press ⌘+K to focus search\". */\n shortcutHotkeyAriaDescription: AutocompleteProps['translations']['shortcutHotkeyAriaDescription'];\n};\n\n/**\n * A SearchInput component.\n *\n * @param props - The component props\n * @returns The rendered SearchInput component\n */\nexport const SearchInput = ({\n ariaLabel,\n clearTextAriaLabel,\n onChange,\n shortcutHotkeyAriaDescription,\n ...props\n}: SearchInputProps): JSX.Element => {\n return (\n <Autocomplete\n {...props}\n ariaLabel={ariaLabel}\n multiple={false}\n onChange={() => {}}\n onInputChange={onChange}\n options={[]}\n translations={{\n clearTextAriaLabel,\n shortcutHotkeyAriaDescription,\n dismissTagAriaLabel: '',\n loadingText: '',\n noOptionsText: '',\n openPopupAriaLabel: '',\n }}\n type=\"search\"\n />\n );\n};\n\nexport default SearchInput;\n"],"names":["SearchInput","ariaLabel","clearTextAriaLabel","onChange","shortcutHotkeyAriaDescription","props","_jsx","Autocomplete","multiple","onInputChange","options","translations","dismissTagAriaLabel","loadingText","noOptionsText","openPopupAriaLabel","type"],"mappings":"iJAkCO,MAAMA,EAAc,EACzBC,YACAC,qBACAC,WACAC,mCACGC,KAGDC,EAAAA,IAACC,EAAAA,aAAY,IACPF,EACJJ,UAAWA,EACXO,UAAU,EACVL,SAAU,OACVM,cAAeN,EACfO,QAAS,GACTC,aAAc,CACZT,qBACAE,gCACAQ,oBAAqB,GACrBC,YAAa,GACbC,cAAe,GACfC,mBAAoB,IAEtBC,KAAK"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/molecules/SearchInput/index.tsx"],"sourcesContent":["import Autocomplete, { type AutocompleteProps } from '../Autocomplete';\n\n/**\n * The props for the SearchInput component.\n */\nexport type SearchInputProps = Omit<\n AutocompleteProps,\n | 'errorText'\n | 'helperText'\n | 'label'\n | 'multiple'\n | 'onChange'\n | 'onInputChange'\n | 'options'\n | 'required'\n | 'translations'\n | 'type'\n> & {\n /** Aria-label for the search input. */\n ariaLabel: string;\n /** Called when the input text changes. */\n onChange: AutocompleteProps['onInputChange'];\n};\n\n/**\n * A SearchInput component.\n *\n * @param props - The component props\n * @returns The rendered SearchInput component\n */\nexport const SearchInput = ({ ariaLabel, onChange, ...props }: SearchInputProps): JSX.Element => {\n return (\n <Autocomplete\n {...props}\n ariaLabel={ariaLabel}\n multiple={false}\n onChange={() => {}}\n onInputChange={onChange}\n options={[]}\n type=\"search\"\n />\n );\n};\n\nexport default SearchInput;\n"],"names":["SearchInput","ariaLabel","onChange","props","_jsx","Autocomplete","multiple","onInputChange","options","type"],"mappings":"iJA8BO,MAAMA,EAAc,EAAGC,YAAWC,cAAaC,KAElDC,EAAAA,IAACC,EAAAA,aAAY,IACPF,EACJF,UAAWA,EACXK,UAAU,EACVJ,SAAU,OACVK,cAAeL,EACfM,QAAS,GACTC,KAAK"}
@@ -6,12 +6,8 @@ import { AutocompleteProps } from '../Autocomplete/index.js';
6
6
  type SearchInputProps = Omit<AutocompleteProps, 'errorText' | 'helperText' | 'label' | 'multiple' | 'onChange' | 'onInputChange' | 'options' | 'required' | 'translations' | 'type'> & {
7
7
  /** Aria-label for the search input. */
8
8
  ariaLabel: string;
9
- /** Aria-label for the clear button. */
10
- clearTextAriaLabel: AutocompleteProps['translations']['clearTextAriaLabel'];
11
9
  /** Called when the input text changes. */
12
10
  onChange: AutocompleteProps['onInputChange'];
13
- /** Screen reader hint describing the shortcut, e.g., "Press ⌘+K to focus search". */
14
- shortcutHotkeyAriaDescription: AutocompleteProps['translations']['shortcutHotkeyAriaDescription'];
15
11
  };
16
12
  /**
17
13
  * A SearchInput component.
@@ -19,7 +15,7 @@ type SearchInputProps = Omit<AutocompleteProps, 'errorText' | 'helperText' | 'la
19
15
  * @param props - The component props
20
16
  * @returns The rendered SearchInput component
21
17
  */
22
- declare const SearchInput: ({ ariaLabel, clearTextAriaLabel, onChange, shortcutHotkeyAriaDescription, ...props }: SearchInputProps) => JSX.Element;
18
+ declare const SearchInput: ({ ariaLabel, onChange, ...props }: SearchInputProps) => JSX.Element;
23
19
 
24
20
  export { SearchInput, SearchInput as default };
25
21
  export type { SearchInputProps };
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import{Autocomplete as a}from"../Autocomplete/index.js";const t=({ariaLabel:t,clearTextAriaLabel:o,onChange:i,shortcutHotkeyAriaDescription:r,...n})=>e(a,{...n,ariaLabel:t,multiple:!1,onChange:()=>{},onInputChange:i,options:[],translations:{clearTextAriaLabel:o,shortcutHotkeyAriaDescription:r,dismissTagAriaLabel:"",loadingText:"",noOptionsText:"",openPopupAriaLabel:""},type:"search"});export{t as SearchInput,t as default};
1
+ import{jsx as e}from"react/jsx-runtime";import{Autocomplete as a}from"../Autocomplete/index.js";const o=({ariaLabel:o,onChange:t,...n})=>e(a,{...n,ariaLabel:o,multiple:!1,onChange:()=>{},onInputChange:t,options:[],type:"search"});export{o as SearchInput,o as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/molecules/SearchInput/index.tsx"],"sourcesContent":["import Autocomplete, { type AutocompleteProps } from '../Autocomplete';\n\n/**\n * The props for the SearchInput component.\n */\nexport type SearchInputProps = Omit<\n AutocompleteProps,\n | 'errorText'\n | 'helperText'\n | 'label'\n | 'multiple'\n | 'onChange'\n | 'onInputChange'\n | 'options'\n | 'required'\n | 'translations'\n | 'type'\n> & {\n /** Aria-label for the search input. */\n ariaLabel: string;\n /** Aria-label for the clear button. */\n clearTextAriaLabel: AutocompleteProps['translations']['clearTextAriaLabel'];\n /** Called when the input text changes. */\n onChange: AutocompleteProps['onInputChange'];\n /** Screen reader hint describing the shortcut, e.g., \"Press ⌘+K to focus search\". */\n shortcutHotkeyAriaDescription: AutocompleteProps['translations']['shortcutHotkeyAriaDescription'];\n};\n\n/**\n * A SearchInput component.\n *\n * @param props - The component props\n * @returns The rendered SearchInput component\n */\nexport const SearchInput = ({\n ariaLabel,\n clearTextAriaLabel,\n onChange,\n shortcutHotkeyAriaDescription,\n ...props\n}: SearchInputProps): JSX.Element => {\n return (\n <Autocomplete\n {...props}\n ariaLabel={ariaLabel}\n multiple={false}\n onChange={() => {}}\n onInputChange={onChange}\n options={[]}\n translations={{\n clearTextAriaLabel,\n shortcutHotkeyAriaDescription,\n dismissTagAriaLabel: '',\n loadingText: '',\n noOptionsText: '',\n openPopupAriaLabel: '',\n }}\n type=\"search\"\n />\n );\n};\n\nexport default SearchInput;\n"],"names":["SearchInput","ariaLabel","clearTextAriaLabel","onChange","shortcutHotkeyAriaDescription","props","_jsx","Autocomplete","multiple","onInputChange","options","translations","dismissTagAriaLabel","loadingText","noOptionsText","openPopupAriaLabel","type"],"mappings":"gGAkCO,MAAMA,EAAc,EACzBC,YACAC,qBACAC,WACAC,mCACGC,KAGDC,EAACC,EAAY,IACPF,EACJJ,UAAWA,EACXO,UAAU,EACVL,SAAU,OACVM,cAAeN,EACfO,QAAS,GACTC,aAAc,CACZT,qBACAE,gCACAQ,oBAAqB,GACrBC,YAAa,GACbC,cAAe,GACfC,mBAAoB,IAEtBC,KAAK"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/molecules/SearchInput/index.tsx"],"sourcesContent":["import Autocomplete, { type AutocompleteProps } from '../Autocomplete';\n\n/**\n * The props for the SearchInput component.\n */\nexport type SearchInputProps = Omit<\n AutocompleteProps,\n | 'errorText'\n | 'helperText'\n | 'label'\n | 'multiple'\n | 'onChange'\n | 'onInputChange'\n | 'options'\n | 'required'\n | 'translations'\n | 'type'\n> & {\n /** Aria-label for the search input. */\n ariaLabel: string;\n /** Called when the input text changes. */\n onChange: AutocompleteProps['onInputChange'];\n};\n\n/**\n * A SearchInput component.\n *\n * @param props - The component props\n * @returns The rendered SearchInput component\n */\nexport const SearchInput = ({ ariaLabel, onChange, ...props }: SearchInputProps): JSX.Element => {\n return (\n <Autocomplete\n {...props}\n ariaLabel={ariaLabel}\n multiple={false}\n onChange={() => {}}\n onInputChange={onChange}\n options={[]}\n type=\"search\"\n />\n );\n};\n\nexport default SearchInput;\n"],"names":["SearchInput","ariaLabel","onChange","props","_jsx","Autocomplete","multiple","onInputChange","options","type"],"mappings":"gGA8BO,MAAMA,EAAc,EAAGC,YAAWC,cAAaC,KAElDC,EAACC,EAAY,IACPF,EACJF,UAAWA,EACXK,UAAU,EACVJ,SAAU,OACVK,cAAeL,EACfM,QAAS,GACTC,KAAK"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Box/Box"),i=require("@mui/material/Stack/Stack"),a=require("@mui/material/styles/styled"),l=require("@mui/material/styles/useTheme"),n=require("../../../atoms/Button/index.cjs.js"),s=require("@mui/material/FormHelperText"),o=require("@mui/material/Typography"),c=require("../../../../icons/CancelCircle/index.cjs.js"),u=require("../../../../icons/Upload/index.cjs.js"),d=require("../../../../providers/TranslationProvider.cjs.js");const p=a(t,{shouldForwardProp:e=>"hasError"!==e})((({theme:e,hasError:r})=>({flex:"1",display:"flex",flexDirection:"column",height:"100%",boxSizing:"border-box",alignItems:"center",justifyContent:"center",padding:e.spacing(4),borderRadius:e.radius["radius-8"],border:r?`1px solid ${e.palette.semantic.stroke["stroke-error-weak"]}`:`1px dashed ${e.palette.semantic.stroke["stroke-strong"]}`,background:r?e.palette.semantic.fill["fill-error-weak"]:e.palette.semantic.fill["fill-weaker"],cursor:"pointer",transition:"all 0.2s ease-in-out",[e.breakpoints.only("mobile")]:{justifyContent:"center",gap:e.spacing(4)}}))),m=a("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),f=a(t,{shouldForwardProp:e=>"hasError"!==e})((({hasError:e,theme:r})=>({display:"flex",flexDirection:"column",width:"48px",height:"48px",padding:"0px",justifyContent:"center",alignItems:"center",borderRadius:r.radius["radius-32"],backgroundColor:e?r.palette.semantic.fill["fill-error-weak"]:r.palette.semantic.fill["fill-primary-weak"]}))),h=a(n.Button)({alignSelf:"center"});module.exports=({handleUpload:t,multiple:a,maxFiles:n,maxFileSize:g,allowedFileTypes:x=[],disabled:b=!1,dragActiveText:k,dragInactiveText:j,browseButtonText:y,invalidFileTypesText:v,invalidFileSizeText:C,invalidFileCountText:w})=>{const _=l(),[T,F]=r.useState(!1),D=r.useRef(null),[S,q]=r.useState(null),{translate:P}=d.useTranslation(),E=r.useCallback((e=>{if(g&&e.size>g)return q(C||P("File_size_is_too_large").replace("{maxFileSize}",g?.toString()||"")),!1;const r=e.name.split(".").pop()?.toLowerCase();return!(x.length>0&&r&&!x.includes(r))||(q(v||P("File_type_is_not_allowed").replace("{allowedFileTypes}",x.join(", "))),!1)}),[g,x,v,C,P]),z=r.useCallback((e=>{const r=Array.from(e),i=[];n&&r.length>n?q(w||P("Too_many_files_selected").replace("{maxFiles}",n.toString())):(r.forEach((e=>{E(e)&&i.push(e)})),i.length>0&&(q(null),t(i)))}),[n,E,t,w,P]),B=r.useCallback((e=>{e.preventDefault(),e.stopPropagation(),b||F(!0)}),[b]),I=r.useCallback((e=>{e.preventDefault(),e.stopPropagation(),b||F(!1)}),[b]),R=r.useCallback((e=>{e.preventDefault(),e.stopPropagation()}),[]),A=r.useCallback((e=>{if(e.preventDefault(),e.stopPropagation(),b)return;F(!1);const r=e.dataTransfer.files;r&&r.length>0&&z(r)}),[b,z]),L=r.useCallback((e=>{if(b)return;const r=e.target.files;r&&r.length>0&&z(r),D.current&&(D.current.value="")}),[b,z]),U=r.useCallback((e=>{e.preventDefault(),e.stopPropagation(),D.current?.click()}),[]),$=r.useCallback((()=>{b||D.current?.click()}),[b]);return e.jsxs(e.Fragment,{children:[!!S&&e.jsxs(s,{error:!0,children:[e.jsx(c,{}),S]}),e.jsxs(p,{"data-testid":"file-drop-zone",hasError:!!S,onClick:b?void 0:$,onDragEnter:B,onDragLeave:I,onDragOver:R,onDrop:A,children:[e.jsx(m,{ref:D,"data-testid":"file-upload-input",disabled:b,multiple:a,onChange:L,type:"file"}),e.jsxs(i,{alignItems:"center",direction:"column",gap:_.spacing(2),justifyContent:"center",width:"100%",children:[e.jsx(f,{hasError:!!S,children:e.jsx(u,{color:S?_.palette.semantic.icon["icon-error"]:_.palette.semantic.icon["icon-primary"]})}),e.jsx(o,{variant:"b1Strong",children:T?k||P("Drop_files_here"):j||P("Drag_and_drop_files_here")}),e.jsx(h,{disabled:b,fdKey:"file-upload-btn",onClick:b?void 0:U,variant:"secondary",children:y||P("Browse_files")})]})]})]})};
1
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Box/Box"),i=require("@mui/material/Stack/Stack"),a=require("@mui/material/styles/styled"),l=require("@mui/material/styles/useTheme"),n=require("../../../atoms/Button/index.cjs.js"),s=require("@mui/material/FormHelperText"),o=require("@mui/material/Typography"),c=require("../../../../icons/CancelCircle/index.cjs.js"),u=require("../../../../icons/Upload/index.cjs.js"),d=require("../../../../providers/TranslationProvider.cjs.js");const p=a(t,{shouldForwardProp:e=>"hasError"!==e})((({theme:e,hasError:r})=>({flex:"1",display:"flex",flexDirection:"column",height:"100%",boxSizing:"border-box",alignItems:"center",justifyContent:"center",padding:e.spacing(4),borderRadius:e.radius["radius-8"],border:r?`1px solid ${e.palette.semantic.stroke["stroke-error-weak"]}`:`1px dashed ${e.palette.semantic.stroke["stroke-strong"]}`,background:r?e.palette.semantic.fill["fill-error-weak"]:e.palette.semantic.fill["fill-weaker"],cursor:"pointer",transition:"all 0.2s ease-in-out",[e.breakpoints.only("mobile")]:{justifyContent:"center",gap:e.spacing(4)}}))),m=a("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),f=a(t,{shouldForwardProp:e=>"hasError"!==e})((({hasError:e,theme:r})=>({display:"flex",flexDirection:"column",width:"48px",height:"48px",padding:"0px",justifyContent:"center",alignItems:"center",borderRadius:r.radius["radius-32"],backgroundColor:e?r.palette.semantic.fill["fill-error-weak"]:r.palette.semantic.fill["fill-primary-weak"]}))),h=a(n.Button)({alignSelf:"center"});module.exports=({handleUpload:t,multiple:a,maxFiles:n,maxFileSize:g,allowedFileTypes:x=[],disabled:b=!1,dragActiveText:k,dragInactiveText:j,browseButtonText:y,invalidFileTypesText:v,invalidFileSizeText:C,invalidFileCountText:w})=>{const _=l(),[T,F]=r.useState(!1),D=r.useRef(null),[S,q]=r.useState(null),{translate:P}=d.useTranslation(),E=r.useCallback((e=>{if(g&&e.size>g)return q(C||P("File_size_is_too_large",{maxFileSize:g?.toString()||""})),!1;const r=e.name.split(".").pop()?.toLowerCase();return!(x.length>0&&r&&!x.includes(r))||(q(v||P("File_type_is_not_allowed",{allowedFileTypes:x.join(", ")})),!1)}),[g,x,v,C,P]),z=r.useCallback((e=>{const r=Array.from(e),i=[];n&&r.length>n?q(w||P("Too_many_files_selected",{maxFiles:n.toString()})):(r.forEach((e=>{E(e)&&i.push(e)})),i.length>0&&(q(null),t(i)))}),[n,E,t,w,P]),B=r.useCallback((e=>{e.preventDefault(),e.stopPropagation(),b||F(!0)}),[b]),I=r.useCallback((e=>{e.preventDefault(),e.stopPropagation(),b||F(!1)}),[b]),R=r.useCallback((e=>{e.preventDefault(),e.stopPropagation()}),[]),A=r.useCallback((e=>{if(e.preventDefault(),e.stopPropagation(),b)return;F(!1);const r=e.dataTransfer.files;r&&r.length>0&&z(r)}),[b,z]),L=r.useCallback((e=>{if(b)return;const r=e.target.files;r&&r.length>0&&z(r),D.current&&(D.current.value="")}),[b,z]),U=r.useCallback((e=>{e.preventDefault(),e.stopPropagation(),D.current?.click()}),[]),$=r.useCallback((()=>{b||D.current?.click()}),[b]);return e.jsxs(e.Fragment,{children:[!!S&&e.jsxs(s,{error:!0,children:[e.jsx(c,{}),S]}),e.jsxs(p,{"data-testid":"file-drop-zone",hasError:!!S,onClick:b?void 0:$,onDragEnter:B,onDragLeave:I,onDragOver:R,onDrop:A,children:[e.jsx(m,{ref:D,"data-testid":"file-upload-input",disabled:b,multiple:a,onChange:L,type:"file"}),e.jsxs(i,{alignItems:"center",direction:"column",gap:_.spacing(2),justifyContent:"center",width:"100%",children:[e.jsx(f,{hasError:!!S,children:e.jsx(u,{color:S?_.palette.semantic.icon["icon-error"]:_.palette.semantic.icon["icon-primary"]})}),e.jsx(o,{variant:"b1Strong",children:T?k||P("Drop_files_here"):j||P("Drag_and_drop_files_here")}),e.jsx(h,{disabled:b,fdKey:"file-upload-btn",onClick:b?void 0:U,variant:"secondary",children:y||P("Browse_files")})]})]})]})};
2
2
  //# sourceMappingURL=FileDropZone.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileDropZone.cjs.js","sources":["../../../../../src/components/organisms/FileUpload/components/FileDropZone.tsx"],"sourcesContent":["import React, { useCallback, useRef, useState } from 'react';\n\nimport Box from '@mui/material/Box/Box';\nimport Stack from '@mui/material/Stack/Stack';\nimport styled from '@mui/material/styles/styled';\nimport useTheme from '@mui/material/styles/useTheme';\n\nimport FlipdishButton from '@fd/components/atoms/Button';\nimport FlipdishFormHelperText from '@fd/components/atoms/FormHelperText';\nimport FlipdishTypography from '@fd/components/atoms/Typography';\nimport CancelCircleIcon from '@fd/icons/CancelCircle';\nimport UploadIcon from '@fd/icons/Upload';\nimport { useTranslation } from '@fd/providers/TranslationProvider';\n\nconst StyledUploadAreaContainer = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'hasError',\n})<{ hasError?: boolean }>(({ theme, hasError }) => ({\n flex: '1',\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n boxSizing: 'border-box',\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing(4),\n borderRadius: theme.radius['radius-8'],\n border: hasError\n ? `1px solid ${theme.palette.semantic.stroke['stroke-error-weak']}`\n : `1px dashed ${theme.palette.semantic.stroke['stroke-strong']}`,\n background: hasError\n ? theme.palette.semantic.fill['fill-error-weak']\n : theme.palette.semantic.fill['fill-weaker'],\n cursor: 'pointer',\n transition: 'all 0.2s ease-in-out',\n [theme.breakpoints.only('mobile')]: {\n justifyContent: 'center',\n gap: theme.spacing(4),\n },\n}));\n\nconst VisuallyHiddenInput = styled('input')({\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: 1,\n overflow: 'hidden',\n position: 'absolute',\n bottom: 0,\n left: 0,\n whiteSpace: 'nowrap',\n width: 1,\n});\n\nconst StyledIconContainer = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'hasError',\n})<{ hasError?: boolean }>(({ hasError, theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n width: '48px',\n height: '48px',\n padding: '0px',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: theme.radius['radius-32'],\n backgroundColor: hasError\n ? theme.palette.semantic.fill['fill-error-weak']\n : theme.palette.semantic.fill['fill-primary-weak'],\n}));\n\nconst StyledButton = styled(FlipdishButton)({\n alignSelf: 'center',\n});\n\n/**\n * Props for the FileDropZone component.\n * Provides a drag-and-drop file upload interface with validation.\n */\nexport interface FileDropZoneProps {\n /**\n * Callback function invoked when files are successfully validated and ready to upload.\n * @param files - Array of File objects to be uploaded\n */\n handleUpload: (files: File[]) => void;\n\n /**\n * Whether multiple files can be selected at once.\n * @default true\n */\n multiple?: boolean;\n\n /**\n * Maximum number of files that can be selected in a single operation.\n * If exceeded, an error message will be displayed.\n * @default undefined (no limit)\n */\n maxFiles?: number;\n\n /**\n * Maximum file size allowed in bytes.\n * Files exceeding this size will be rejected with an error message.\n * Example: 10 * 1024 * 1024 for 10MB\n * @default undefined (no limit)\n */\n maxFileSize?: number;\n\n /**\n * Array of allowed file extensions (without dots).\n * Files with extensions not in this list will be rejected.\n * Example: ['jpg', 'png', 'pdf']\n * @default [] (all file types allowed)\n */\n allowedFileTypes?: string[];\n\n /**\n * Whether the file drop zone is disabled.\n * When true, prevents all file selection and drag-and-drop interactions.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Text displayed when files are being dragged over the drop zone.\n * @default 'Drop files here'\n */\n dragActiveText?: string;\n\n /**\n * Text displayed when no files are being dragged (idle state).\n * @default 'Drag and drop files here'\n */\n dragInactiveText?: string;\n\n /**\n * Text displayed on the browse/upload button.\n * @default 'Browse files'\n */\n browseButtonText?: string;\n\n /**\n * Text displayed when a file type is not allowed.\n * @default 'File type is not allowed. Allowed types: {allowedFileTypes}'\n */\n invalidFileTypesText?: string;\n\n /**\n * Text displayed when a file size is too large.\n * @default 'File size is too large. Maximum size: {maxFileSize}'\n */\n invalidFileSizeText?: string;\n\n /**\n * Text displayed when too many files are selected.\n * @default 'Too many files selected. Maximum allowed: {maxFiles}'\n */\n invalidFileCountText?: string;\n}\n\nconst FileDropZone: React.FC<FileDropZoneProps> = ({\n handleUpload,\n multiple,\n maxFiles,\n maxFileSize,\n allowedFileTypes = [],\n disabled = false,\n dragActiveText,\n dragInactiveText,\n browseButtonText,\n invalidFileTypesText,\n invalidFileSizeText,\n invalidFileCountText,\n}) => {\n const theme = useTheme();\n const [isDragActive, setIsDragActive] = useState(false);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const [error, setError] = useState<string | null>(null);\n const { translate } = useTranslation();\n\n const validateFile = useCallback(\n (file: File): boolean => {\n // Check file size\n if (maxFileSize && file.size > maxFileSize) {\n setError(\n invalidFileSizeText ||\n translate('File_size_is_too_large').replace('{maxFileSize}', maxFileSize?.toString() || ''),\n );\n return false;\n }\n\n // Check file type\n const fileExtension = file.name.split('.').pop()?.toLowerCase();\n if (allowedFileTypes.length > 0 && fileExtension && !allowedFileTypes.includes(fileExtension)) {\n setError(\n invalidFileTypesText ||\n translate('File_type_is_not_allowed').replace('{allowedFileTypes}', allowedFileTypes.join(', ')),\n );\n return false;\n }\n\n return true;\n },\n [maxFileSize, allowedFileTypes, invalidFileTypesText, invalidFileSizeText, translate],\n );\n\n const processFiles = useCallback(\n (files: File[] | FileList) => {\n const fileArray = Array.from(files);\n const validFiles: File[] = [];\n\n // Check max files limit\n if (maxFiles && fileArray.length > maxFiles) {\n setError(\n invalidFileCountText ||\n translate('Too_many_files_selected').replace('{maxFiles}', maxFiles.toString()),\n );\n return;\n }\n\n // Validate each file\n fileArray.forEach((file) => {\n if (validateFile(file)) {\n validFiles.push(file);\n }\n });\n\n if (validFiles.length > 0) {\n setError(null);\n handleUpload(validFiles);\n }\n },\n [maxFiles, validateFile, handleUpload, invalidFileCountText, translate],\n );\n\n const handleDragEnter = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(true);\n },\n [disabled],\n );\n\n const handleDragLeave = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(false);\n },\n [disabled],\n );\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n\n const handleDrop = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(false);\n\n const files = e.dataTransfer.files;\n if (files && files.length > 0) {\n processFiles(files);\n }\n },\n [disabled, processFiles],\n );\n\n const handleFileInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n const files = e.target.files;\n if (files && files.length > 0) {\n processFiles(files);\n }\n\n // Reset input value to allow selecting the same file again\n if (fileInputRef.current) {\n fileInputRef.current.value = '';\n }\n },\n [disabled, processFiles],\n );\n\n const handleButtonClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n fileInputRef.current?.click();\n }, []);\n\n const handleContainerClick = useCallback(() => {\n if (disabled) return;\n\n fileInputRef.current?.click();\n }, [disabled]);\n\n return (\n <>\n {!!error && (\n <FlipdishFormHelperText error>\n <CancelCircleIcon />\n {error}\n </FlipdishFormHelperText>\n )}\n <StyledUploadAreaContainer\n data-testid=\"file-drop-zone\"\n hasError={!!error}\n onClick={disabled ? undefined : handleContainerClick}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <VisuallyHiddenInput\n ref={fileInputRef}\n data-testid=\"file-upload-input\"\n disabled={disabled}\n multiple={multiple}\n onChange={handleFileInputChange}\n type=\"file\"\n />\n\n <Stack\n alignItems=\"center\"\n direction=\"column\"\n gap={theme.spacing(2)}\n justifyContent=\"center\"\n width=\"100%\"\n >\n <StyledIconContainer hasError={!!error}>\n <UploadIcon\n color={\n error\n ? theme.palette.semantic.icon['icon-error']\n : theme.palette.semantic.icon['icon-primary']\n }\n />\n </StyledIconContainer>\n\n <FlipdishTypography variant=\"b1Strong\">\n {isDragActive\n ? dragActiveText || translate('Drop_files_here')\n : dragInactiveText || translate('Drag_and_drop_files_here')}\n </FlipdishTypography>\n\n <StyledButton\n disabled={disabled}\n fdKey=\"file-upload-btn\"\n onClick={disabled ? undefined : handleButtonClick}\n variant=\"secondary\"\n >\n {browseButtonText || translate('Browse_files')}\n </StyledButton>\n </Stack>\n </StyledUploadAreaContainer>\n </>\n );\n};\n\nexport default FileDropZone;\n"],"names":["StyledUploadAreaContainer","styled","Box","shouldForwardProp","prop","theme","hasError","flex","display","flexDirection","height","boxSizing","alignItems","justifyContent","padding","spacing","borderRadius","radius","border","palette","semantic","stroke","background","fill","cursor","transition","breakpoints","only","gap","VisuallyHiddenInput","clip","clipPath","overflow","position","bottom","left","whiteSpace","width","StyledIconContainer","backgroundColor","StyledButton","FlipdishButton","alignSelf","handleUpload","multiple","maxFiles","maxFileSize","allowedFileTypes","disabled","dragActiveText","dragInactiveText","browseButtonText","invalidFileTypesText","invalidFileSizeText","invalidFileCountText","useTheme","isDragActive","setIsDragActive","useState","fileInputRef","useRef","error","setError","translate","useTranslation","validateFile","useCallback","file","size","replace","toString","fileExtension","name","split","pop","toLowerCase","length","includes","join","processFiles","files","fileArray","Array","from","validFiles","forEach","push","handleDragEnter","e","preventDefault","stopPropagation","handleDragLeave","handleDragOver","handleDrop","dataTransfer","handleFileInputChange","target","current","value","handleButtonClick","event","click","handleContainerClick","_jsxs","_Fragment","children","FlipdishFormHelperText","_jsx","CancelCircleIcon","onClick","undefined","onDragEnter","onDragLeave","onDragOver","onDrop","ref","onChange","type","Stack","direction","UploadIcon","color","icon","FlipdishTypography","variant","fdKey"],"mappings":"2gBAcA,MAAMA,EAA4BC,EAAOC,EAAK,CAC5CC,kBAAoBC,GAAkB,aAATA,GADGH,EAEP,EAAGI,QAAOC,eAAU,CAC7CC,KAAM,IACNC,QAAS,OACTC,cAAe,SACfC,OAAQ,OACRC,UAAW,aACXC,WAAY,SACZC,eAAgB,SAChBC,QAAST,EAAMU,QAAQ,GACvBC,aAAcX,EAAMY,OAAO,YAC3BC,OAAQZ,EACJ,aAAaD,EAAMc,QAAQC,SAASC,OAAO,uBAC3C,cAAchB,EAAMc,QAAQC,SAASC,OAAO,mBAChDC,WAAYhB,EACRD,EAAMc,QAAQC,SAASG,KAAK,mBAC5BlB,EAAMc,QAAQC,SAASG,KAAK,eAChCC,OAAQ,UACRC,WAAY,uBACZ,CAACpB,EAAMqB,YAAYC,KAAK,WAAY,CAClCd,eAAgB,SAChBe,IAAKvB,EAAMU,QAAQ,QAIjBc,EAAsB5B,EAAO,QAAPA,CAAgB,CAC1C6B,KAAM,gBACNC,SAAU,aACVrB,OAAQ,EACRsB,SAAU,SACVC,SAAU,WACVC,OAAQ,EACR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AAAA,IAAC9E,EAAmB,CAClBsF,IAAKxD,EAAY,cACL,oBACZX,SAAUA,EACVJ,SAAUA,EACVwE,SAAUrB,EACVsB,KAAK,SAGPd,EAAAA,KAACe,EAAK,CACJ1G,WAAW,SACX2G,UAAU,SACV3F,IAAKvB,EAAMU,QAAQ,GACnBF,eAAe,SACfwB,MAAM,OAAMoE,SAAA,CAEZE,EAAAA,IAACrE,EAAmB,CAAChC,WAAYuD,EAAK4C,SACpCE,EAAAA,IAACa,EAAU,CACTC,MACE5D,EACIxD,EAAMc,QAAQC,SAASsG,KAAK,cAC5BrH,EAAMc,QAAQC,SAASsG,KAAK,oBAKtCf,EAAAA,IAACgB,GAAmBC,QAAQ,WAAUnB,SACnCjD,EACGP,GAAkBc,EAAU,mBAC5Bb,GAAoBa,EAAU,8BAGpC4C,EAAAA,IAACnE,EAAY,CACXQ,SAAUA,EACV6E,MAAM,kBACNhB,QAAS7D,OAAW8D,EAAYX,EAChCyB,QAAQ,YAAWnB,SAElBtD,GAAoBY,EAAU"}
1
+ {"version":3,"file":"FileDropZone.cjs.js","sources":["../../../../../src/components/organisms/FileUpload/components/FileDropZone.tsx"],"sourcesContent":["import React, { useCallback, useRef, useState } from 'react';\n\nimport Box from '@mui/material/Box/Box';\nimport Stack from '@mui/material/Stack/Stack';\nimport styled from '@mui/material/styles/styled';\nimport useTheme from '@mui/material/styles/useTheme';\n\nimport FlipdishButton from '@fd/components/atoms/Button';\nimport FlipdishFormHelperText from '@fd/components/atoms/FormHelperText';\nimport FlipdishTypography from '@fd/components/atoms/Typography';\nimport CancelCircleIcon from '@fd/icons/CancelCircle';\nimport UploadIcon from '@fd/icons/Upload';\nimport { useTranslation } from '@fd/providers/TranslationProvider';\n\nconst StyledUploadAreaContainer = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'hasError',\n})<{ hasError?: boolean }>(({ theme, hasError }) => ({\n flex: '1',\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n boxSizing: 'border-box',\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing(4),\n borderRadius: theme.radius['radius-8'],\n border: hasError\n ? `1px solid ${theme.palette.semantic.stroke['stroke-error-weak']}`\n : `1px dashed ${theme.palette.semantic.stroke['stroke-strong']}`,\n background: hasError\n ? theme.palette.semantic.fill['fill-error-weak']\n : theme.palette.semantic.fill['fill-weaker'],\n cursor: 'pointer',\n transition: 'all 0.2s ease-in-out',\n [theme.breakpoints.only('mobile')]: {\n justifyContent: 'center',\n gap: theme.spacing(4),\n },\n}));\n\nconst VisuallyHiddenInput = styled('input')({\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: 1,\n overflow: 'hidden',\n position: 'absolute',\n bottom: 0,\n left: 0,\n whiteSpace: 'nowrap',\n width: 1,\n});\n\nconst StyledIconContainer = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'hasError',\n})<{ hasError?: boolean }>(({ hasError, theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n width: '48px',\n height: '48px',\n padding: '0px',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: theme.radius['radius-32'],\n backgroundColor: hasError\n ? theme.palette.semantic.fill['fill-error-weak']\n : theme.palette.semantic.fill['fill-primary-weak'],\n}));\n\nconst StyledButton = styled(FlipdishButton)({\n alignSelf: 'center',\n});\n\n/**\n * Props for the FileDropZone component.\n * Provides a drag-and-drop file upload interface with validation.\n */\nexport interface FileDropZoneProps {\n /**\n * Callback function invoked when files are successfully validated and ready to upload.\n * @param files - Array of File objects to be uploaded\n */\n handleUpload: (files: File[]) => void;\n\n /**\n * Whether multiple files can be selected at once.\n * @default true\n */\n multiple?: boolean;\n\n /**\n * Maximum number of files that can be selected in a single operation.\n * If exceeded, an error message will be displayed.\n * @default undefined (no limit)\n */\n maxFiles?: number;\n\n /**\n * Maximum file size allowed in bytes.\n * Files exceeding this size will be rejected with an error message.\n * Example: 10 * 1024 * 1024 for 10MB\n * @default undefined (no limit)\n */\n maxFileSize?: number;\n\n /**\n * Array of allowed file extensions (without dots).\n * Files with extensions not in this list will be rejected.\n * Example: ['jpg', 'png', 'pdf']\n * @default [] (all file types allowed)\n */\n allowedFileTypes?: string[];\n\n /**\n * Whether the file drop zone is disabled.\n * When true, prevents all file selection and drag-and-drop interactions.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Text displayed when files are being dragged over the drop zone.\n * @default 'Drop files here'\n */\n dragActiveText?: string;\n\n /**\n * Text displayed when no files are being dragged (idle state).\n * @default 'Drag and drop files here'\n */\n dragInactiveText?: string;\n\n /**\n * Text displayed on the browse/upload button.\n * @default 'Browse files'\n */\n browseButtonText?: string;\n\n /**\n * Text displayed when a file type is not allowed.\n * @default 'File type is not allowed. Allowed types: {allowedFileTypes}'\n */\n invalidFileTypesText?: string;\n\n /**\n * Text displayed when a file size is too large.\n * @default 'File size is too large. Maximum size: {maxFileSize}'\n */\n invalidFileSizeText?: string;\n\n /**\n * Text displayed when too many files are selected.\n * @default 'Too many files selected. Maximum allowed: {maxFiles}'\n */\n invalidFileCountText?: string;\n}\n\nconst FileDropZone: React.FC<FileDropZoneProps> = ({\n handleUpload,\n multiple,\n maxFiles,\n maxFileSize,\n allowedFileTypes = [],\n disabled = false,\n dragActiveText,\n dragInactiveText,\n browseButtonText,\n invalidFileTypesText,\n invalidFileSizeText,\n invalidFileCountText,\n}) => {\n const theme = useTheme();\n const [isDragActive, setIsDragActive] = useState(false);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const [error, setError] = useState<string | null>(null);\n const { translate } = useTranslation();\n\n const validateFile = useCallback(\n (file: File): boolean => {\n // Check file size\n if (maxFileSize && file.size > maxFileSize) {\n setError(\n invalidFileSizeText ||\n translate('File_size_is_too_large', { maxFileSize: maxFileSize?.toString() || '' }),\n );\n return false;\n }\n\n // Check file type\n const fileExtension = file.name.split('.').pop()?.toLowerCase();\n if (allowedFileTypes.length > 0 && fileExtension && !allowedFileTypes.includes(fileExtension)) {\n setError(\n invalidFileTypesText ||\n translate('File_type_is_not_allowed', { allowedFileTypes: allowedFileTypes.join(', ') }),\n );\n return false;\n }\n\n return true;\n },\n [maxFileSize, allowedFileTypes, invalidFileTypesText, invalidFileSizeText, translate],\n );\n\n const processFiles = useCallback(\n (files: File[] | FileList) => {\n const fileArray = Array.from(files);\n const validFiles: File[] = [];\n\n // Check max files limit\n if (maxFiles && fileArray.length > maxFiles) {\n setError(\n invalidFileCountText || translate('Too_many_files_selected', { maxFiles: maxFiles.toString() }),\n );\n return;\n }\n\n // Validate each file\n fileArray.forEach((file) => {\n if (validateFile(file)) {\n validFiles.push(file);\n }\n });\n\n if (validFiles.length > 0) {\n setError(null);\n handleUpload(validFiles);\n }\n },\n [maxFiles, validateFile, handleUpload, invalidFileCountText, translate],\n );\n\n const handleDragEnter = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(true);\n },\n [disabled],\n );\n\n const handleDragLeave = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(false);\n },\n [disabled],\n );\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n\n const handleDrop = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(false);\n\n const files = e.dataTransfer.files;\n if (files && files.length > 0) {\n processFiles(files);\n }\n },\n [disabled, processFiles],\n );\n\n const handleFileInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n const files = e.target.files;\n if (files && files.length > 0) {\n processFiles(files);\n }\n\n // Reset input value to allow selecting the same file again\n if (fileInputRef.current) {\n fileInputRef.current.value = '';\n }\n },\n [disabled, processFiles],\n );\n\n const handleButtonClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n fileInputRef.current?.click();\n }, []);\n\n const handleContainerClick = useCallback(() => {\n if (disabled) return;\n\n fileInputRef.current?.click();\n }, [disabled]);\n\n return (\n <>\n {!!error && (\n <FlipdishFormHelperText error>\n <CancelCircleIcon />\n {error}\n </FlipdishFormHelperText>\n )}\n <StyledUploadAreaContainer\n data-testid=\"file-drop-zone\"\n hasError={!!error}\n onClick={disabled ? undefined : handleContainerClick}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <VisuallyHiddenInput\n ref={fileInputRef}\n data-testid=\"file-upload-input\"\n disabled={disabled}\n multiple={multiple}\n onChange={handleFileInputChange}\n type=\"file\"\n />\n\n <Stack\n alignItems=\"center\"\n direction=\"column\"\n gap={theme.spacing(2)}\n justifyContent=\"center\"\n width=\"100%\"\n >\n <StyledIconContainer hasError={!!error}>\n <UploadIcon\n color={\n error\n ? theme.palette.semantic.icon['icon-error']\n : theme.palette.semantic.icon['icon-primary']\n }\n />\n </StyledIconContainer>\n\n <FlipdishTypography variant=\"b1Strong\">\n {isDragActive\n ? dragActiveText || translate('Drop_files_here')\n : dragInactiveText || translate('Drag_and_drop_files_here')}\n </FlipdishTypography>\n\n <StyledButton\n disabled={disabled}\n fdKey=\"file-upload-btn\"\n onClick={disabled ? undefined : handleButtonClick}\n variant=\"secondary\"\n >\n {browseButtonText || translate('Browse_files')}\n </StyledButton>\n </Stack>\n </StyledUploadAreaContainer>\n </>\n );\n};\n\nexport default FileDropZone;\n"],"names":["StyledUploadAreaContainer","styled","Box","shouldForwardProp","prop","theme","hasError","flex","display","flexDirection","height","boxSizing","alignItems","justifyContent","padding","spacing","borderRadius","radius","border","palette","semantic","stroke","background","fill","cursor","transition","breakpoints","only","gap","VisuallyHiddenInput","clip","clipPath","overflow","position","bottom","left","whiteSpace","width","StyledIconContainer","backgroundColor","StyledButton","FlipdishButton","alignSelf","handleUpload","multiple","maxFiles","maxFileSize","allowedFileTypes","disabled","dragActiveText","dragInactiveText","browseButtonText","invalidFileTypesText","invalidFileSizeText","invalidFileCountText","useTheme","isDragActive","setIsDragActive","useState","fileInputRef","useRef","error","setError","translate","useTranslation","validateFile","useCallback","file","size","toString","fileExtension","name","split","pop","toLowerCase","length","includes","join","processFiles","files","fileArray","Array","from","validFiles","forEach","push","handleDragEnter","e","preventDefault","stopPropagation","handleDragLeave","handleDragOver","handleDrop","dataTransfer","handleFileInputChange","target","current","value","handleButtonClick","event","click","handleContainerClick","_jsxs","_Fragment","children","FlipdishFormHelperText","_jsx","CancelCircleIcon","onClick","undefined","onDragEnter","onDragLeave","onDragOver","onDrop","ref","onChange","type","Stack","direction","UploadIcon","color","icon","FlipdishTypography","variant","fdKey"],"mappings":"2gBAcA,MAAMA,EAA4BC,EAAOC,EAAK,CAC5CC,kBAAoBC,GAAkB,aAATA,GADGH,EAEP,EAAGI,QAAOC,eAAU,CAC7CC,KAAM,IACNC,QAAS,OACTC,cAAe,SACfC,OAAQ,OACRC,UAAW,aACXC,WAAY,SACZC,eAAgB,SAChBC,QAAST,EAAMU,QAAQ,GACvBC,aAAcX,EAAMY,OAAO,YAC3BC,OAAQZ,EACJ,aAAaD,EAAMc,QAAQC,SAASC,OAAO,uBAC3C,cAAchB,EAAMc,QAAQC,SAASC,OAAO,mBAChDC,WAAYhB,EACRD,EAAMc,QAAQC,SAASG,KAAK,mBAC5BlB,EAAMc,QAAQC,SAASG,KAAK,eAChCC,OAAQ,UACRC,WAAY,uBACZ,CAACpB,EAAMqB,YAAYC,KAAK,WAAY,CAClCd,eAAgB,SAChBe,IAAKvB,EAAMU,QAAQ,QAIjBc,EAAsB5B,EAAO,QAAPA,CAAgB,CAC1C6B,KAAM,gBACNC,SAAU,aACVrB,OAAQ,EACRsB,SAAU,SACVC,SAAU,WACVC,OAAQ,EACRC,KAAM,EACNC,WAAY,SACZC,MAAO,IAGHC,EAAsBrC,EAAOC,EAAK,CACtCC,kBAAoBC,GAAkB,aAATA,GADHH,EAED,EAAGK,WAAUD,YAAO,CAC7CG,QAAS,OACT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CACJzG,WAAW,SACX0G,UAAU,SACV1F,IAAKvB,EAAMU,QAAQ,GACnBF,eAAe,SACfwB,MAAM,OAAMmE,SAAA,CAEZE,EAAAA,IAACpE,EAAmB,CAAChC,WAAYuD,EAAK2C,SACpCE,EAAAA,IAACa,EAAU,CACTC,MACE3D,EACIxD,EAAMc,QAAQC,SAASqG,KAAK,cAC5BpH,EAAMc,QAAQC,SAASqG,KAAK,oBAKtCf,EAAAA,IAACgB,GAAmBC,QAAQ,WAAUnB,SACnChD,EACGP,GAAkBc,EAAU,mBAC5Bb,GAAoBa,EAAU,8BAGpC2C,EAAAA,IAAClE,EAAY,CACXQ,SAAUA,EACV4E,MAAM,kBACNhB,QAAS5D,OAAW6D,EAAYX,EAChCyB,QAAQ,YAAWnB,SAElBrD,GAAoBY,EAAU"}
@@ -1,2 +1,2 @@
1
- import{jsxs as e,Fragment as r,jsx as t}from"react/jsx-runtime";import{useState as i,useRef as o,useCallback as a}from"react";import l from"@mui/material/Box/Box";import n from"@mui/material/Stack/Stack";import s from"@mui/material/styles/styled";import p from"@mui/material/styles/useTheme";import{Button as d}from"../../../atoms/Button/index.js";import c from"@mui/material/FormHelperText";import m from"@mui/material/Typography";import u from"../../../../icons/CancelCircle/index.js";import f from"../../../../icons/Upload/index.js";import{useTranslation as h}from"../../../../providers/TranslationProvider.js";const g=s(l,{shouldForwardProp:e=>"hasError"!==e})((({theme:e,hasError:r})=>({flex:"1",display:"flex",flexDirection:"column",height:"100%",boxSizing:"border-box",alignItems:"center",justifyContent:"center",padding:e.spacing(4),borderRadius:e.radius["radius-8"],border:r?`1px solid ${e.palette.semantic.stroke["stroke-error-weak"]}`:`1px dashed ${e.palette.semantic.stroke["stroke-strong"]}`,background:r?e.palette.semantic.fill["fill-error-weak"]:e.palette.semantic.fill["fill-weaker"],cursor:"pointer",transition:"all 0.2s ease-in-out",[e.breakpoints.only("mobile")]:{justifyContent:"center",gap:e.spacing(4)}}))),x=s("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),y=s(l,{shouldForwardProp:e=>"hasError"!==e})((({hasError:e,theme:r})=>({display:"flex",flexDirection:"column",width:"48px",height:"48px",padding:"0px",justifyContent:"center",alignItems:"center",borderRadius:r.radius["radius-32"],backgroundColor:e?r.palette.semantic.fill["fill-error-weak"]:r.palette.semantic.fill["fill-primary-weak"]}))),v=s(d)({alignSelf:"center"}),w=({handleUpload:l,multiple:s,maxFiles:d,maxFileSize:w,allowedFileTypes:b=[],disabled:k=!1,dragActiveText:_,dragInactiveText:T,browseButtonText:F,invalidFileTypesText:D,invalidFileSizeText:C,invalidFileCountText:S})=>{const j=p(),[P,E]=i(!1),z=o(null),[B,I]=i(null),{translate:A}=h(),L=a((e=>{if(w&&e.size>w)return I(C||A("File_size_is_too_large").replace("{maxFileSize}",w?.toString()||"")),!1;const r=e.name.split(".").pop()?.toLowerCase();return!(b.length>0&&r&&!b.includes(r))||(I(D||A("File_type_is_not_allowed").replace("{allowedFileTypes}",b.join(", "))),!1)}),[w,b,D,C,A]),R=a((e=>{const r=Array.from(e),t=[];d&&r.length>d?I(S||A("Too_many_files_selected").replace("{maxFiles}",d.toString())):(r.forEach((e=>{L(e)&&t.push(e)})),t.length>0&&(I(null),l(t)))}),[d,L,l,S,A]),U=a((e=>{e.preventDefault(),e.stopPropagation(),k||E(!0)}),[k]),$=a((e=>{e.preventDefault(),e.stopPropagation(),k||E(!1)}),[k]),H=a((e=>{e.preventDefault(),e.stopPropagation()}),[]),K=a((e=>{if(e.preventDefault(),e.stopPropagation(),k)return;E(!1);const r=e.dataTransfer.files;r&&r.length>0&&R(r)}),[k,R]),O=a((e=>{if(k)return;const r=e.target.files;r&&r.length>0&&R(r),z.current&&(z.current.value="")}),[k,R]),q=a((e=>{e.preventDefault(),e.stopPropagation(),z.current?.click()}),[]),G=a((()=>{k||z.current?.click()}),[k]);return e(r,{children:[!!B&&e(c,{error:!0,children:[t(u,{}),B]}),e(g,{"data-testid":"file-drop-zone",hasError:!!B,onClick:k?void 0:G,onDragEnter:U,onDragLeave:$,onDragOver:H,onDrop:K,children:[t(x,{ref:z,"data-testid":"file-upload-input",disabled:k,multiple:s,onChange:O,type:"file"}),e(n,{alignItems:"center",direction:"column",gap:j.spacing(2),justifyContent:"center",width:"100%",children:[t(y,{hasError:!!B,children:t(f,{color:B?j.palette.semantic.icon["icon-error"]:j.palette.semantic.icon["icon-primary"]})}),t(m,{variant:"b1Strong",children:P?_||A("Drop_files_here"):T||A("Drag_and_drop_files_here")}),t(v,{disabled:k,fdKey:"file-upload-btn",onClick:k?void 0:q,variant:"secondary",children:F||A("Browse_files")})]})]})]})};export{w as default};
1
+ import{jsxs as e,Fragment as r,jsx as t}from"react/jsx-runtime";import{useState as i,useRef as o,useCallback as a}from"react";import l from"@mui/material/Box/Box";import n from"@mui/material/Stack/Stack";import s from"@mui/material/styles/styled";import p from"@mui/material/styles/useTheme";import{Button as d}from"../../../atoms/Button/index.js";import c from"@mui/material/FormHelperText";import m from"@mui/material/Typography";import u from"../../../../icons/CancelCircle/index.js";import f from"../../../../icons/Upload/index.js";import{useTranslation as h}from"../../../../providers/TranslationProvider.js";const g=s(l,{shouldForwardProp:e=>"hasError"!==e})((({theme:e,hasError:r})=>({flex:"1",display:"flex",flexDirection:"column",height:"100%",boxSizing:"border-box",alignItems:"center",justifyContent:"center",padding:e.spacing(4),borderRadius:e.radius["radius-8"],border:r?`1px solid ${e.palette.semantic.stroke["stroke-error-weak"]}`:`1px dashed ${e.palette.semantic.stroke["stroke-strong"]}`,background:r?e.palette.semantic.fill["fill-error-weak"]:e.palette.semantic.fill["fill-weaker"],cursor:"pointer",transition:"all 0.2s ease-in-out",[e.breakpoints.only("mobile")]:{justifyContent:"center",gap:e.spacing(4)}}))),x=s("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),y=s(l,{shouldForwardProp:e=>"hasError"!==e})((({hasError:e,theme:r})=>({display:"flex",flexDirection:"column",width:"48px",height:"48px",padding:"0px",justifyContent:"center",alignItems:"center",borderRadius:r.radius["radius-32"],backgroundColor:e?r.palette.semantic.fill["fill-error-weak"]:r.palette.semantic.fill["fill-primary-weak"]}))),v=s(d)({alignSelf:"center"}),w=({handleUpload:l,multiple:s,maxFiles:d,maxFileSize:w,allowedFileTypes:b=[],disabled:k=!1,dragActiveText:_,dragInactiveText:T,browseButtonText:F,invalidFileTypesText:D,invalidFileSizeText:C,invalidFileCountText:S})=>{const j=p(),[P,E]=i(!1),z=o(null),[B,I]=i(null),{translate:A}=h(),L=a((e=>{if(w&&e.size>w)return I(C||A("File_size_is_too_large",{maxFileSize:w?.toString()||""})),!1;const r=e.name.split(".").pop()?.toLowerCase();return!(b.length>0&&r&&!b.includes(r))||(I(D||A("File_type_is_not_allowed",{allowedFileTypes:b.join(", ")})),!1)}),[w,b,D,C,A]),R=a((e=>{const r=Array.from(e),t=[];d&&r.length>d?I(S||A("Too_many_files_selected",{maxFiles:d.toString()})):(r.forEach((e=>{L(e)&&t.push(e)})),t.length>0&&(I(null),l(t)))}),[d,L,l,S,A]),U=a((e=>{e.preventDefault(),e.stopPropagation(),k||E(!0)}),[k]),$=a((e=>{e.preventDefault(),e.stopPropagation(),k||E(!1)}),[k]),H=a((e=>{e.preventDefault(),e.stopPropagation()}),[]),K=a((e=>{if(e.preventDefault(),e.stopPropagation(),k)return;E(!1);const r=e.dataTransfer.files;r&&r.length>0&&R(r)}),[k,R]),O=a((e=>{if(k)return;const r=e.target.files;r&&r.length>0&&R(r),z.current&&(z.current.value="")}),[k,R]),q=a((e=>{e.preventDefault(),e.stopPropagation(),z.current?.click()}),[]),G=a((()=>{k||z.current?.click()}),[k]);return e(r,{children:[!!B&&e(c,{error:!0,children:[t(u,{}),B]}),e(g,{"data-testid":"file-drop-zone",hasError:!!B,onClick:k?void 0:G,onDragEnter:U,onDragLeave:$,onDragOver:H,onDrop:K,children:[t(x,{ref:z,"data-testid":"file-upload-input",disabled:k,multiple:s,onChange:O,type:"file"}),e(n,{alignItems:"center",direction:"column",gap:j.spacing(2),justifyContent:"center",width:"100%",children:[t(y,{hasError:!!B,children:t(f,{color:B?j.palette.semantic.icon["icon-error"]:j.palette.semantic.icon["icon-primary"]})}),t(m,{variant:"b1Strong",children:P?_||A("Drop_files_here"):T||A("Drag_and_drop_files_here")}),t(v,{disabled:k,fdKey:"file-upload-btn",onClick:k?void 0:q,variant:"secondary",children:F||A("Browse_files")})]})]})]})};export{w as default};
2
2
  //# sourceMappingURL=FileDropZone.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileDropZone.js","sources":["../../../../../src/components/organisms/FileUpload/components/FileDropZone.tsx"],"sourcesContent":["import React, { useCallback, useRef, useState } from 'react';\n\nimport Box from '@mui/material/Box/Box';\nimport Stack from '@mui/material/Stack/Stack';\nimport styled from '@mui/material/styles/styled';\nimport useTheme from '@mui/material/styles/useTheme';\n\nimport FlipdishButton from '@fd/components/atoms/Button';\nimport FlipdishFormHelperText from '@fd/components/atoms/FormHelperText';\nimport FlipdishTypography from '@fd/components/atoms/Typography';\nimport CancelCircleIcon from '@fd/icons/CancelCircle';\nimport UploadIcon from '@fd/icons/Upload';\nimport { useTranslation } from '@fd/providers/TranslationProvider';\n\nconst StyledUploadAreaContainer = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'hasError',\n})<{ hasError?: boolean }>(({ theme, hasError }) => ({\n flex: '1',\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n boxSizing: 'border-box',\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing(4),\n borderRadius: theme.radius['radius-8'],\n border: hasError\n ? `1px solid ${theme.palette.semantic.stroke['stroke-error-weak']}`\n : `1px dashed ${theme.palette.semantic.stroke['stroke-strong']}`,\n background: hasError\n ? theme.palette.semantic.fill['fill-error-weak']\n : theme.palette.semantic.fill['fill-weaker'],\n cursor: 'pointer',\n transition: 'all 0.2s ease-in-out',\n [theme.breakpoints.only('mobile')]: {\n justifyContent: 'center',\n gap: theme.spacing(4),\n },\n}));\n\nconst VisuallyHiddenInput = styled('input')({\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: 1,\n overflow: 'hidden',\n position: 'absolute',\n bottom: 0,\n left: 0,\n whiteSpace: 'nowrap',\n width: 1,\n});\n\nconst StyledIconContainer = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'hasError',\n})<{ hasError?: boolean }>(({ hasError, theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n width: '48px',\n height: '48px',\n padding: '0px',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: theme.radius['radius-32'],\n backgroundColor: hasError\n ? theme.palette.semantic.fill['fill-error-weak']\n : theme.palette.semantic.fill['fill-primary-weak'],\n}));\n\nconst StyledButton = styled(FlipdishButton)({\n alignSelf: 'center',\n});\n\n/**\n * Props for the FileDropZone component.\n * Provides a drag-and-drop file upload interface with validation.\n */\nexport interface FileDropZoneProps {\n /**\n * Callback function invoked when files are successfully validated and ready to upload.\n * @param files - Array of File objects to be uploaded\n */\n handleUpload: (files: File[]) => void;\n\n /**\n * Whether multiple files can be selected at once.\n * @default true\n */\n multiple?: boolean;\n\n /**\n * Maximum number of files that can be selected in a single operation.\n * If exceeded, an error message will be displayed.\n * @default undefined (no limit)\n */\n maxFiles?: number;\n\n /**\n * Maximum file size allowed in bytes.\n * Files exceeding this size will be rejected with an error message.\n * Example: 10 * 1024 * 1024 for 10MB\n * @default undefined (no limit)\n */\n maxFileSize?: number;\n\n /**\n * Array of allowed file extensions (without dots).\n * Files with extensions not in this list will be rejected.\n * Example: ['jpg', 'png', 'pdf']\n * @default [] (all file types allowed)\n */\n allowedFileTypes?: string[];\n\n /**\n * Whether the file drop zone is disabled.\n * When true, prevents all file selection and drag-and-drop interactions.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Text displayed when files are being dragged over the drop zone.\n * @default 'Drop files here'\n */\n dragActiveText?: string;\n\n /**\n * Text displayed when no files are being dragged (idle state).\n * @default 'Drag and drop files here'\n */\n dragInactiveText?: string;\n\n /**\n * Text displayed on the browse/upload button.\n * @default 'Browse files'\n */\n browseButtonText?: string;\n\n /**\n * Text displayed when a file type is not allowed.\n * @default 'File type is not allowed. Allowed types: {allowedFileTypes}'\n */\n invalidFileTypesText?: string;\n\n /**\n * Text displayed when a file size is too large.\n * @default 'File size is too large. Maximum size: {maxFileSize}'\n */\n invalidFileSizeText?: string;\n\n /**\n * Text displayed when too many files are selected.\n * @default 'Too many files selected. Maximum allowed: {maxFiles}'\n */\n invalidFileCountText?: string;\n}\n\nconst FileDropZone: React.FC<FileDropZoneProps> = ({\n handleUpload,\n multiple,\n maxFiles,\n maxFileSize,\n allowedFileTypes = [],\n disabled = false,\n dragActiveText,\n dragInactiveText,\n browseButtonText,\n invalidFileTypesText,\n invalidFileSizeText,\n invalidFileCountText,\n}) => {\n const theme = useTheme();\n const [isDragActive, setIsDragActive] = useState(false);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const [error, setError] = useState<string | null>(null);\n const { translate } = useTranslation();\n\n const validateFile = useCallback(\n (file: File): boolean => {\n // Check file size\n if (maxFileSize && file.size > maxFileSize) {\n setError(\n invalidFileSizeText ||\n translate('File_size_is_too_large').replace('{maxFileSize}', maxFileSize?.toString() || ''),\n );\n return false;\n }\n\n // Check file type\n const fileExtension = file.name.split('.').pop()?.toLowerCase();\n if (allowedFileTypes.length > 0 && fileExtension && !allowedFileTypes.includes(fileExtension)) {\n setError(\n invalidFileTypesText ||\n translate('File_type_is_not_allowed').replace('{allowedFileTypes}', allowedFileTypes.join(', ')),\n );\n return false;\n }\n\n return true;\n },\n [maxFileSize, allowedFileTypes, invalidFileTypesText, invalidFileSizeText, translate],\n );\n\n const processFiles = useCallback(\n (files: File[] | FileList) => {\n const fileArray = Array.from(files);\n const validFiles: File[] = [];\n\n // Check max files limit\n if (maxFiles && fileArray.length > maxFiles) {\n setError(\n invalidFileCountText ||\n translate('Too_many_files_selected').replace('{maxFiles}', maxFiles.toString()),\n );\n return;\n }\n\n // Validate each file\n fileArray.forEach((file) => {\n if (validateFile(file)) {\n validFiles.push(file);\n }\n });\n\n if (validFiles.length > 0) {\n setError(null);\n handleUpload(validFiles);\n }\n },\n [maxFiles, validateFile, handleUpload, invalidFileCountText, translate],\n );\n\n const handleDragEnter = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(true);\n },\n [disabled],\n );\n\n const handleDragLeave = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(false);\n },\n [disabled],\n );\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n\n const handleDrop = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(false);\n\n const files = e.dataTransfer.files;\n if (files && files.length > 0) {\n processFiles(files);\n }\n },\n [disabled, processFiles],\n );\n\n const handleFileInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n const files = e.target.files;\n if (files && files.length > 0) {\n processFiles(files);\n }\n\n // Reset input value to allow selecting the same file again\n if (fileInputRef.current) {\n fileInputRef.current.value = '';\n }\n },\n [disabled, processFiles],\n );\n\n const handleButtonClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n fileInputRef.current?.click();\n }, []);\n\n const handleContainerClick = useCallback(() => {\n if (disabled) return;\n\n fileInputRef.current?.click();\n }, [disabled]);\n\n return (\n <>\n {!!error && (\n <FlipdishFormHelperText error>\n <CancelCircleIcon />\n {error}\n </FlipdishFormHelperText>\n )}\n <StyledUploadAreaContainer\n data-testid=\"file-drop-zone\"\n hasError={!!error}\n onClick={disabled ? undefined : handleContainerClick}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <VisuallyHiddenInput\n ref={fileInputRef}\n data-testid=\"file-upload-input\"\n disabled={disabled}\n multiple={multiple}\n onChange={handleFileInputChange}\n type=\"file\"\n />\n\n <Stack\n alignItems=\"center\"\n direction=\"column\"\n gap={theme.spacing(2)}\n justifyContent=\"center\"\n width=\"100%\"\n >\n <StyledIconContainer hasError={!!error}>\n <UploadIcon\n color={\n error\n ? theme.palette.semantic.icon['icon-error']\n : theme.palette.semantic.icon['icon-primary']\n }\n />\n </StyledIconContainer>\n\n <FlipdishTypography variant=\"b1Strong\">\n {isDragActive\n ? dragActiveText || translate('Drop_files_here')\n : dragInactiveText || translate('Drag_and_drop_files_here')}\n </FlipdishTypography>\n\n <StyledButton\n disabled={disabled}\n fdKey=\"file-upload-btn\"\n onClick={disabled ? undefined : handleButtonClick}\n variant=\"secondary\"\n >\n {browseButtonText || translate('Browse_files')}\n </StyledButton>\n </Stack>\n </StyledUploadAreaContainer>\n </>\n );\n};\n\nexport default FileDropZone;\n"],"names":["StyledUploadAreaContainer","styled","Box","shouldForwardProp","prop","theme","hasError","flex","display","flexDirection","height","boxSizing","alignItems","justifyContent","padding","spacing","borderRadius","radius","border","palette","semantic","stroke","background","fill","cursor","transition","breakpoints","only","gap","VisuallyHiddenInput","clip","clipPath","overflow","position","bottom","left","whiteSpace","width","StyledIconContainer","backgroundColor","StyledButton","FlipdishButton","alignSelf","FileDropZone","handleUpload","multiple","maxFiles","maxFileSize","allowedFileTypes","disabled","dragActiveText","dragInactiveText","browseButtonText","invalidFileTypesText","invalidFileSizeText","invalidFileCountText","useTheme","isDragActive","setIsDragActive","useState","fileInputRef","useRef","error","setError","translate","useTranslation","validateFile","useCallback","file","size","replace","toString","fileExtension","name","split","pop","toLowerCase","length","includes","join","processFiles","files","fileArray","Array","from","validFiles","forEach","push","handleDragEnter","e","preventDefault","stopPropagation","handleDragLeave","handleDragOver","handleDrop","dataTransfer","handleFileInputChange","target","current","value","handleButtonClick","event","click","handleContainerClick","_jsxs","_Fragment","children","FlipdishFormHelperText","_jsx","CancelCircleIcon","onClick","undefined","onDragEnter","onDragLeave","onDragOver","onDrop","ref","onChange","type","Stack","direction","UploadIcon","color","icon","FlipdishTypography","variant","fdKey"],"mappings":"smBAcA,MAAMA,EAA4BC,EAAOC,EAAK,CAC5CC,kBAAoBC,GAAkB,aAATA,GADGH,EAEP,EAAGI,QAAOC,eAAU,CAC7CC,KAAM,IACNC,QAAS,OACTC,cAAe,SACfC,OAAQ,OACRC,UAAW,aACXC,WAAY,SACZC,eAAgB,SAChBC,QAAST,EAAMU,QAAQ,GACvBC,aAAcX,EAAMY,OAAO,YAC3BC,OAAQZ,EACJ,aAAaD,EAAMc,QAAQC,SAASC,OAAO,uBAC3C,cAAchB,EAAMc,QAAQC,SAASC,OAAO,mBAChDC,WAAYhB,EACRD,EAAMc,QAAQC,SAASG,KAAK,mBAC5BlB,EAAMc,QAAQC,SAASG,KAAK,eAChCC,OAAQ,UACRC,WAAY,uBACZ,CAACpB,EAAMqB,YAAYC,KAAK,WAAY,CAClCd,eAAgB,SAChBe,IAAKvB,EAAMU,QAAQ,QAIjBc,EAAsB5B,EAAO,QAAPA,CAAgB,CAC1C6B,KAAM,gBACNC,SAAU,aACVrB,OAAQ,EACRsB,SAAU,SACVC,SAAU,WACVC,OAAQ,EACRC,KAAM,EACNC,WAAY,SACZC,MAAO,IAGHC,EAAsBrC,EAAOC,EAAK,CACtCC,kBAAoBC,GAAkB,aAATA,GADHH,EAED,EAAGK,WAAUD,YAAO,CAC7CG,QAAS,OACTC,cAAe,SACf4B,MAAO,OACP3B,OAAQ,OACRI,QAAS,MACTD,eAAgB,SAChBD,WAAY,SACZI,aAAcX,EAAMY,OAAO,aAC3BsB,gBAAiBjC,EACbD,EAAMc,QAAQC,SAASG,KAAK,mBAC5BlB,EAAMc,QAAQC,SAASG,KAAK,yBAG5BiB,EAAevC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ACnCjD,EACGP,GAAkBc,EAAU,mBAC5Bb,GAAoBa,EAAU,8BAGpC4C,EAACpE,EAAY,CACXS,SAAUA,EACV6E,MAAM,kBACNhB,QAAS7D,OAAW8D,EAAYX,EAChCyB,QAAQ,YAAWnB,SAElBtD,GAAoBY,EAAU"}
1
+ {"version":3,"file":"FileDropZone.js","sources":["../../../../../src/components/organisms/FileUpload/components/FileDropZone.tsx"],"sourcesContent":["import React, { useCallback, useRef, useState } from 'react';\n\nimport Box from '@mui/material/Box/Box';\nimport Stack from '@mui/material/Stack/Stack';\nimport styled from '@mui/material/styles/styled';\nimport useTheme from '@mui/material/styles/useTheme';\n\nimport FlipdishButton from '@fd/components/atoms/Button';\nimport FlipdishFormHelperText from '@fd/components/atoms/FormHelperText';\nimport FlipdishTypography from '@fd/components/atoms/Typography';\nimport CancelCircleIcon from '@fd/icons/CancelCircle';\nimport UploadIcon from '@fd/icons/Upload';\nimport { useTranslation } from '@fd/providers/TranslationProvider';\n\nconst StyledUploadAreaContainer = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'hasError',\n})<{ hasError?: boolean }>(({ theme, hasError }) => ({\n flex: '1',\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n boxSizing: 'border-box',\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing(4),\n borderRadius: theme.radius['radius-8'],\n border: hasError\n ? `1px solid ${theme.palette.semantic.stroke['stroke-error-weak']}`\n : `1px dashed ${theme.palette.semantic.stroke['stroke-strong']}`,\n background: hasError\n ? theme.palette.semantic.fill['fill-error-weak']\n : theme.palette.semantic.fill['fill-weaker'],\n cursor: 'pointer',\n transition: 'all 0.2s ease-in-out',\n [theme.breakpoints.only('mobile')]: {\n justifyContent: 'center',\n gap: theme.spacing(4),\n },\n}));\n\nconst VisuallyHiddenInput = styled('input')({\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: 1,\n overflow: 'hidden',\n position: 'absolute',\n bottom: 0,\n left: 0,\n whiteSpace: 'nowrap',\n width: 1,\n});\n\nconst StyledIconContainer = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'hasError',\n})<{ hasError?: boolean }>(({ hasError, theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n width: '48px',\n height: '48px',\n padding: '0px',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: theme.radius['radius-32'],\n backgroundColor: hasError\n ? theme.palette.semantic.fill['fill-error-weak']\n : theme.palette.semantic.fill['fill-primary-weak'],\n}));\n\nconst StyledButton = styled(FlipdishButton)({\n alignSelf: 'center',\n});\n\n/**\n * Props for the FileDropZone component.\n * Provides a drag-and-drop file upload interface with validation.\n */\nexport interface FileDropZoneProps {\n /**\n * Callback function invoked when files are successfully validated and ready to upload.\n * @param files - Array of File objects to be uploaded\n */\n handleUpload: (files: File[]) => void;\n\n /**\n * Whether multiple files can be selected at once.\n * @default true\n */\n multiple?: boolean;\n\n /**\n * Maximum number of files that can be selected in a single operation.\n * If exceeded, an error message will be displayed.\n * @default undefined (no limit)\n */\n maxFiles?: number;\n\n /**\n * Maximum file size allowed in bytes.\n * Files exceeding this size will be rejected with an error message.\n * Example: 10 * 1024 * 1024 for 10MB\n * @default undefined (no limit)\n */\n maxFileSize?: number;\n\n /**\n * Array of allowed file extensions (without dots).\n * Files with extensions not in this list will be rejected.\n * Example: ['jpg', 'png', 'pdf']\n * @default [] (all file types allowed)\n */\n allowedFileTypes?: string[];\n\n /**\n * Whether the file drop zone is disabled.\n * When true, prevents all file selection and drag-and-drop interactions.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Text displayed when files are being dragged over the drop zone.\n * @default 'Drop files here'\n */\n dragActiveText?: string;\n\n /**\n * Text displayed when no files are being dragged (idle state).\n * @default 'Drag and drop files here'\n */\n dragInactiveText?: string;\n\n /**\n * Text displayed on the browse/upload button.\n * @default 'Browse files'\n */\n browseButtonText?: string;\n\n /**\n * Text displayed when a file type is not allowed.\n * @default 'File type is not allowed. Allowed types: {allowedFileTypes}'\n */\n invalidFileTypesText?: string;\n\n /**\n * Text displayed when a file size is too large.\n * @default 'File size is too large. Maximum size: {maxFileSize}'\n */\n invalidFileSizeText?: string;\n\n /**\n * Text displayed when too many files are selected.\n * @default 'Too many files selected. Maximum allowed: {maxFiles}'\n */\n invalidFileCountText?: string;\n}\n\nconst FileDropZone: React.FC<FileDropZoneProps> = ({\n handleUpload,\n multiple,\n maxFiles,\n maxFileSize,\n allowedFileTypes = [],\n disabled = false,\n dragActiveText,\n dragInactiveText,\n browseButtonText,\n invalidFileTypesText,\n invalidFileSizeText,\n invalidFileCountText,\n}) => {\n const theme = useTheme();\n const [isDragActive, setIsDragActive] = useState(false);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const [error, setError] = useState<string | null>(null);\n const { translate } = useTranslation();\n\n const validateFile = useCallback(\n (file: File): boolean => {\n // Check file size\n if (maxFileSize && file.size > maxFileSize) {\n setError(\n invalidFileSizeText ||\n translate('File_size_is_too_large', { maxFileSize: maxFileSize?.toString() || '' }),\n );\n return false;\n }\n\n // Check file type\n const fileExtension = file.name.split('.').pop()?.toLowerCase();\n if (allowedFileTypes.length > 0 && fileExtension && !allowedFileTypes.includes(fileExtension)) {\n setError(\n invalidFileTypesText ||\n translate('File_type_is_not_allowed', { allowedFileTypes: allowedFileTypes.join(', ') }),\n );\n return false;\n }\n\n return true;\n },\n [maxFileSize, allowedFileTypes, invalidFileTypesText, invalidFileSizeText, translate],\n );\n\n const processFiles = useCallback(\n (files: File[] | FileList) => {\n const fileArray = Array.from(files);\n const validFiles: File[] = [];\n\n // Check max files limit\n if (maxFiles && fileArray.length > maxFiles) {\n setError(\n invalidFileCountText || translate('Too_many_files_selected', { maxFiles: maxFiles.toString() }),\n );\n return;\n }\n\n // Validate each file\n fileArray.forEach((file) => {\n if (validateFile(file)) {\n validFiles.push(file);\n }\n });\n\n if (validFiles.length > 0) {\n setError(null);\n handleUpload(validFiles);\n }\n },\n [maxFiles, validateFile, handleUpload, invalidFileCountText, translate],\n );\n\n const handleDragEnter = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(true);\n },\n [disabled],\n );\n\n const handleDragLeave = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(false);\n },\n [disabled],\n );\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n\n const handleDrop = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (disabled) return;\n\n setIsDragActive(false);\n\n const files = e.dataTransfer.files;\n if (files && files.length > 0) {\n processFiles(files);\n }\n },\n [disabled, processFiles],\n );\n\n const handleFileInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n const files = e.target.files;\n if (files && files.length > 0) {\n processFiles(files);\n }\n\n // Reset input value to allow selecting the same file again\n if (fileInputRef.current) {\n fileInputRef.current.value = '';\n }\n },\n [disabled, processFiles],\n );\n\n const handleButtonClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n fileInputRef.current?.click();\n }, []);\n\n const handleContainerClick = useCallback(() => {\n if (disabled) return;\n\n fileInputRef.current?.click();\n }, [disabled]);\n\n return (\n <>\n {!!error && (\n <FlipdishFormHelperText error>\n <CancelCircleIcon />\n {error}\n </FlipdishFormHelperText>\n )}\n <StyledUploadAreaContainer\n data-testid=\"file-drop-zone\"\n hasError={!!error}\n onClick={disabled ? undefined : handleContainerClick}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <VisuallyHiddenInput\n ref={fileInputRef}\n data-testid=\"file-upload-input\"\n disabled={disabled}\n multiple={multiple}\n onChange={handleFileInputChange}\n type=\"file\"\n />\n\n <Stack\n alignItems=\"center\"\n direction=\"column\"\n gap={theme.spacing(2)}\n justifyContent=\"center\"\n width=\"100%\"\n >\n <StyledIconContainer hasError={!!error}>\n <UploadIcon\n color={\n error\n ? theme.palette.semantic.icon['icon-error']\n : theme.palette.semantic.icon['icon-primary']\n }\n />\n </StyledIconContainer>\n\n <FlipdishTypography variant=\"b1Strong\">\n {isDragActive\n ? dragActiveText || translate('Drop_files_here')\n : dragInactiveText || translate('Drag_and_drop_files_here')}\n </FlipdishTypography>\n\n <StyledButton\n disabled={disabled}\n fdKey=\"file-upload-btn\"\n onClick={disabled ? undefined : handleButtonClick}\n variant=\"secondary\"\n >\n {browseButtonText || translate('Browse_files')}\n </StyledButton>\n </Stack>\n </StyledUploadAreaContainer>\n </>\n );\n};\n\nexport default FileDropZone;\n"],"names":["StyledUploadAreaContainer","styled","Box","shouldForwardProp","prop","theme","hasError","flex","display","flexDirection","height","boxSizing","alignItems","justifyContent","padding","spacing","borderRadius","radius","border","palette","semantic","stroke","background","fill","cursor","transition","breakpoints","only","gap","VisuallyHiddenInput","clip","clipPath","overflow","position","bottom","left","whiteSpace","width","StyledIconContainer","backgroundColor","StyledButton","FlipdishButton","alignSelf","FileDropZone","handleUpload","multiple","maxFiles","maxFileSize","allowedFileTypes","disabled","dragActiveText","dragInactiveText","browseButtonText","invalidFileTypesText","invalidFileSizeText","invalidFileCountText","useTheme","isDragActive","setIsDragActive","useState","fileInputRef","useRef","error","setError","translate","useTranslation","validateFile","useCallback","file","size","toString","fileExtension","name","split","pop","toLowerCase","length","includes","join","processFiles","files","fileArray","Array","from","validFiles","forEach","push","handleDragEnter","e","preventDefault","stopPropagation","handleDragLeave","handleDragOver","handleDrop","dataTransfer","handleFileInputChange","target","current","value","handleButtonClick","event","click","handleContainerClick","_jsxs","_Fragment","children","FlipdishFormHelperText","_jsx","CancelCircleIcon","onClick","undefined","onDragEnter","onDragLeave","onDragOver","onDrop","ref","onChange","type","Stack","direction","UploadIcon","color","icon","FlipdishTypography","variant","fdKey"],"mappings":"smBAcA,MAAMA,EAA4BC,EAAOC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value:!0});var e=require("react/jsx-runtime");require("react");var t=require("@mui/material/Toolbar"),i=require("@mui/material/styles"),a=require("@mui/material/Box"),n=require("../../atoms/BreadCrumbs/index.cjs.js"),l=require("../../atoms/Button/index.cjs.js"),s=require("@mui/material/Typography"),r=require("../../molecules/ButtonGroup/index.cjs.js"),o=require("../../molecules/Combobox/index.cjs.js");const d=i.styled(t)((({theme:e})=>({flexDirection:"column",alignItems:"stretch",[e.breakpoints.up("tablet")]:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)},[e.breakpoints.down("tablet")]:{paddingTop:e.spacing(2),paddingBottom:e.spacing(2)}}))),p=i.styled(a)((({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",flex:"1 1 auto",gap:e.spacing(.5),minWidth:0,maxWidth:"100%",[e.breakpoints.up("tablet")]:{marginRight:e.spacing(2)}}))),c=i.styled(a)((({theme:e})=>({display:"flex",justifyContent:"flex-end",alignItems:"center",gap:e.spacing(1),flexShrink:0,alignSelf:"flex-start",paddingTop:e.spacing(.5),[e.breakpoints.down("tablet")]:{justifyContent:"flex-end",marginTop:e.spacing(1),paddingTop:0,alignSelf:"stretch",width:"100%"}}))),u=i.styled(a)((({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:e.spacing(2),width:"100%",maxWidth:"100%",[e.breakpoints.up("tablet")]:{flexDirection:"row",alignItems:"center",paddingTop:e.spacing(2),flexWrap:"wrap"},[e.breakpoints.down("tablet")]:{flexDirection:"column",alignItems:"flex-start",paddingTop:e.spacing(2),paddingBottom:e.spacing(2),width:"100%"}}))),g=({title:t,buttons:i,description:a,breadcrumbItems:g,selectBoxes:m})=>e.jsxs(d,{children:[e.jsxs(p,{children:[g&&e.jsx(n,{items:g}),t&&e.jsx(s,{variant:"h1Strong",children:t}),a&&e.jsx(s,{color:"semantic.text.text-weak",variant:"captionWeak",children:a}),m?.length?e.jsx(u,{children:m.map((t=>e.jsx(o.Combobox,{fdKey:t.fdKey,label:t.label,onChange:t.onChange,options:t.options,placeholder:t.placeholder,translations:t.translations,value:t.value??null},t.fdKey)))}):null]}),i?.length?e.jsx(c,{children:e.jsx(r,{align:"right",fdKey:"heading-button-group",layout:"horizontal",size:"medium",children:i.map((t=>{const i=t.variant;return e.jsx(l.Button,{disabled:t.disabled??!1,fdKey:t.fdKey,onClick:t.onClick,variant:i,children:t.label},t.fdKey)}))})}):null]});exports.Heading=g,exports.default=g;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("react");var t=require("@mui/material/Toolbar"),i=require("@mui/material/styles"),a=require("@mui/material/Box"),n=require("../../atoms/BreadCrumbs/index.cjs.js"),l=require("../../atoms/Button/index.cjs.js"),r=require("@mui/material/Typography"),s=require("../../molecules/ButtonGroup/index.cjs.js"),o=require("../../molecules/Combobox/index.cjs.js");const d=i.styled(t)((({theme:e})=>({flexDirection:"column",alignItems:"stretch",[e.breakpoints.up("tablet")]:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)},[e.breakpoints.down("tablet")]:{paddingTop:e.spacing(2),paddingBottom:e.spacing(2)}}))),p=i.styled(a)((({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",flex:"1 1 auto",gap:e.spacing(.5),minWidth:0,maxWidth:"100%",[e.breakpoints.up("tablet")]:{marginRight:e.spacing(2)}}))),c=i.styled(a)((({theme:e})=>({display:"flex",justifyContent:"flex-end",alignItems:"center",gap:e.spacing(1),flexShrink:0,alignSelf:"flex-start",paddingTop:e.spacing(.5),[e.breakpoints.down("tablet")]:{justifyContent:"flex-end",marginTop:e.spacing(1),paddingTop:0,alignSelf:"stretch",width:"100%"}}))),u=i.styled(a)((({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:e.spacing(2),width:"100%",maxWidth:"100%",[e.breakpoints.up("tablet")]:{flexDirection:"row",alignItems:"center",paddingTop:e.spacing(2),flexWrap:"wrap"},[e.breakpoints.down("tablet")]:{flexDirection:"column",alignItems:"flex-start",paddingTop:e.spacing(2),paddingBottom:e.spacing(2),width:"100%"}}))),g=({title:t,buttons:i,description:a,breadcrumbItems:g,selectBoxes:m})=>e.jsxs(d,{children:[e.jsxs(p,{children:[g&&e.jsx(n,{items:g}),t&&e.jsx(r,{variant:"h1Strong",children:t}),a&&e.jsx(r,{color:"semantic.text.text-weak",variant:"captionWeak",children:a}),m?.length?e.jsx(u,{children:m.map((t=>e.jsx(o.Combobox,{fdKey:t.fdKey,label:t.label,onChange:t.onChange,options:t.options,placeholder:t.placeholder,value:t.value??null},t.fdKey)))}):null]}),i?.length?e.jsx(c,{children:e.jsx(s,{align:"right",fdKey:"heading-button-group",layout:"horizontal",size:"medium",children:i.map((t=>{const i=t.variant;return e.jsx(l.Button,{disabled:t.disabled??!1,fdKey:t.fdKey,onClick:t.onClick,variant:i,children:t.label},t.fdKey)}))})}):null]});exports.Heading=g,exports.default=g;
2
2
  //# sourceMappingURL=Heading.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Heading.cjs.js","sources":["../../../../src/components/organisms/Heading/Heading.tsx"],"sourcesContent":["import React from 'react';\n\nimport Toolbar from '@mui/material/Toolbar';\n\nimport styled from '@fd/utilities/styledUtilities';\n\nimport Box from '../../atoms/Box';\nimport BreadCrumbs, { type BreadcrumbItem } from '../../atoms/BreadCrumbs';\nimport Button from '../../atoms/Button';\nimport { type ButtonType } from '../../atoms/Button/getButtonStyles';\nimport Typography from '../../atoms/Typography';\nimport ButtonGroup from '../../molecules/ButtonGroup';\nimport { Combobox, type ComboboxOption, type ComboboxProps } from '../../molecules/Combobox';\n\nexport interface ButtonConfig {\n variant: ButtonType;\n onClick: () => void;\n label: string;\n fdKey: string;\n disabled?: boolean;\n}\n\nexport interface SelectConfig {\n options: ComboboxOption[];\n label: string;\n placeholder?: string;\n fdKey: string;\n onChange?: ComboboxProps['onChange'];\n value?: ComboboxProps['value'];\n translations: ComboboxProps['translations'];\n}\n\nexport interface HeadingProps {\n title?: string;\n buttons?: ButtonConfig[];\n description?: string;\n breadcrumbItems?: BreadcrumbItem[];\n selectBoxes?: SelectConfig[];\n}\n\nconst StyledToolbar = styled(Toolbar)(({ theme }) => ({\n flexDirection: 'column',\n alignItems: 'stretch',\n [theme.breakpoints.up('tablet')]: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n [theme.breakpoints.down('tablet')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n}));\n\nconst StyledLeftSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n flex: '1 1 auto',\n gap: theme.spacing(0.5),\n minWidth: 0,\n maxWidth: '100%',\n [theme.breakpoints.up('tablet')]: {\n marginRight: theme.spacing(2),\n },\n}));\n\nconst StyledRightSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n justifyContent: 'flex-end',\n alignItems: 'center',\n gap: theme.spacing(1),\n flexShrink: 0,\n alignSelf: 'flex-start',\n paddingTop: theme.spacing(0.5),\n [theme.breakpoints.down('tablet')]: {\n justifyContent: 'flex-end',\n marginTop: theme.spacing(1),\n paddingTop: 0,\n alignSelf: 'stretch',\n width: '100%',\n },\n}));\n\nconst StyledSelectedSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n gap: theme.spacing(2),\n width: '100%',\n maxWidth: '100%',\n [theme.breakpoints.up('tablet')]: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingTop: theme.spacing(2),\n flexWrap: 'wrap',\n },\n [theme.breakpoints.down('tablet')]: {\n flexDirection: 'column',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n width: '100%',\n },\n}));\n\nexport const Heading: React.FC<HeadingProps> = ({\n title,\n buttons,\n description,\n breadcrumbItems,\n selectBoxes,\n}: HeadingProps) => {\n const renderSelectedSection = () => {\n if (!selectBoxes?.length) {\n return null;\n }\n\n return (\n <StyledSelectedSection>\n {selectBoxes.map((selectConfig) => (\n <Combobox\n key={selectConfig.fdKey}\n fdKey={selectConfig.fdKey}\n label={selectConfig.label}\n onChange={selectConfig.onChange}\n options={selectConfig.options}\n placeholder={selectConfig.placeholder}\n translations={selectConfig.translations}\n value={selectConfig.value ?? null}\n />\n ))}\n </StyledSelectedSection>\n );\n };\n\n const renderLeftSection = () => (\n <StyledLeftSection>\n {breadcrumbItems && <BreadCrumbs items={breadcrumbItems} />}\n {title && <Typography variant=\"h1Strong\">{title}</Typography>}\n {description && (\n <Typography color=\"semantic.text.text-weak\" variant=\"captionWeak\">\n {description}\n </Typography>\n )}\n {renderSelectedSection()}\n </StyledLeftSection>\n );\n\n const renderRightSection = () => {\n if (!buttons?.length) {\n return null;\n }\n\n return (\n <StyledRightSection>\n <ButtonGroup align=\"right\" fdKey=\"heading-button-group\" layout=\"horizontal\" size=\"medium\">\n {buttons.map((buttonConfig: ButtonConfig) => {\n const variant: ButtonType = buttonConfig.variant;\n return (\n <Button\n key={buttonConfig.fdKey}\n disabled={buttonConfig.disabled ?? false}\n fdKey={buttonConfig.fdKey}\n onClick={buttonConfig.onClick}\n variant={variant}\n >\n {buttonConfig.label}\n </Button>\n );\n })}\n </ButtonGroup>\n </StyledRightSection>\n );\n };\n\n return (\n <StyledToolbar>\n {renderLeftSection()}\n {renderRightSection()}\n </StyledToolbar>\n );\n};\n\nexport default Heading;\n"],"names":["StyledToolbar","styled","Toolbar","theme","flexDirection","alignItems","breakpoints","up","justifyContent","paddingTop","spacing","paddingBottom","down","StyledLeftSection","Box","display","flex","gap","minWidth","maxWidth","marginRight","StyledRightSection","flexShrink","alignSelf","marginTop","width","StyledSelectedSection","flexWrap","Heading","title","buttons","description","breadcrumbItems","selectBoxes","_jsxs","children","_jsx","BreadCrumbs","items","Typography","variant","color","length","map","selectConfig","Combobox","fdKey","label","onChange","options","placeholder","translations","value","ButtonGroup","align","layout","size","buttonConfig","Button","disabled","onClick"],"mappings":"8cAwCA,MAAMA,EAAgBC,EAAAA,OAAOC,EAAPD,EAAgB,EAAGE,YAAO,CAC9CC,cAAe,SACfC,WAAY,UACZ,CAACF,EAAMG,YAAYC,GAAG,WAAY,CAChCH,cAAe,MACfC,WAAY,aACZG,eAAgB,gBAChBC,WAAYN,EAAMO,QAAQ,GAC1BC,cAAeR,EAAMO,QAAQ,IAE/B,CAACP,EAAMG,YAAYM,KAAK,WAAY,CAClCH,WAAYN,EAAMO,QAAQ,GAC1BC,cAAeR,EAAMO,QAAQ,QAI3BG,EAAoBZ,EAAAA,OAAOa,EAAPb,EAAY,EAAGE,YAAO,CAC9CY,QAAS,OACTX,cAAe,SACfC,WAAY,aACZW,KAAM,WACNC,IAAKd,EAAMO,QAAQ,IACnBQ,SAAU,EACVC,SAAU,OACV,CAAChB,EAAMG,YAAYC,GAAG,WAAY,CAChCa,YAAajB,EAAMO,QAAQ,QAIzBW,EAAqBpB,EAAAA,OAAOa,EAAPb,EAAY,EAAGE,YAAO,CAC/CY,QAAS,OACTP,eAAgB,WAChBH,WAAY,SACZY,IAAKd,EAAMO,QAAQ,GACnBY,WAAY,EACZC,UAAW,aACXd,WAAYN,EAAMO,QAAQ,IAC1B,CAACP,EAAMG,YAAYM,KAAK,WAAY,CAClCJ,eAAgB,WAChBgB,UAAWrB,EAAMO,QAAQ,GACzBD,WAAY,EACZc,UAAW,UACXE,MAAO,YAILC,EAAwBzB,EAAAA,OAAOa,EAAPb,EAAY,EAAGE,YAAO,CAClDY,QAAS,OACTX,cAAe,SACfC,WAAY,aACZY,IAAKd,EAAMO,QAAQ,GACnBe,MAAO,OACPN,SAAU,OACV,CAAChB,EAAMG,YAAYC,GAAG,WAAY,CAChCH,cAAe,MACfC,WAAY,SACZI,WAAYN,EAAMO,QAAQ,GAC1BiB,SAAU,QAEZ,CAACxB,EAAMG,YAAYM,KAAK,WAAY,CAClCR,cAAe,SACfC,WAAY,aACZI,WAAYN,EAAMO,QAAQ,GAC1BC,cAAeR,EAAMO,QAAQ,GAC7Be,MAAO,YAIEG,EAAkC,EAC7CC,QACAC,UACAC,cACAC,kBACAC,iBAkEEC,EAAAA,KAAClC,EAAa,CAAAmC,SAAA,CAxCdD,OAACrB,EAAiB,CAAAsB,SAAA,CACfH,GAAmBI,EAAAA,IAACC,EAAW,CAACC,MAAON,IACvCH,GAASO,EAAAA,IAACG,EAAU,CAACC,QAAQ,WAAUL,SAAEN,IACzCE,GACCK,EAAAA,IAACG,EAAU,CAACE,MAAM,0BAA0BD,QAAQ,cAAaL,SAC9DJ,IA5BFE,GAAaS,OAKhBN,EAAAA,IAACV,EAAqB,CAAAS,SACnBF,EAAYU,KAAKC,GAChBR,EAAAA,IAACS,EAAAA,SAAQ,CAEPC,MAAOF,EAAaE,MACpBC,MAAOH,EAAaG,MACpBC,SAAUJ,EAAaI,SACvBC,QAASL,EAAaK,QACtBC,YAAaN,EAAaM,YAC1BC,aAAcP,EAAaO,aAC3BC,MAAOR,EAAaQ,OAAS,MAPxBR,EAAaE,WAPjB,QAmCJhB,GAASY,OAKZN,EAAAA,IAACf,EAAkB,CAAAc,SACjBC,EAAAA,IAACiB,EAAW,CAACC,MAAM,QAAQR,MAAM,uBAAuBS,OAAO,aAAaC,KAAK,SAAQrB,SACtFL,EAAQa,KAAKc,IACZ,MAAMjB,EAAsBiB,EAAajB,QACzC,OACEJ,EAAAA,IAACsB,SAAM,CAELC,SAAUF,EAAaE,WAAY,EACnCb,MAAOW,EAAaX,MACpBc,QAASH,EAAaG,QACtBpB,QAASA,EAAOL,SAEfsB,EAAaV,OANTU,EAAaX,cAVrB"}
1
+ {"version":3,"file":"Heading.cjs.js","sources":["../../../../src/components/organisms/Heading/Heading.tsx"],"sourcesContent":["import React from 'react';\n\nimport Toolbar from '@mui/material/Toolbar';\n\nimport styled from '@fd/utilities/styledUtilities';\n\nimport Box from '../../atoms/Box';\nimport BreadCrumbs, { type BreadcrumbItem } from '../../atoms/BreadCrumbs';\nimport Button from '../../atoms/Button';\nimport { type ButtonType } from '../../atoms/Button/getButtonStyles';\nimport Typography from '../../atoms/Typography';\nimport ButtonGroup from '../../molecules/ButtonGroup';\nimport { Combobox, type ComboboxOption, type ComboboxProps } from '../../molecules/Combobox';\n\nexport interface ButtonConfig {\n variant: ButtonType;\n onClick: () => void;\n label: string;\n fdKey: string;\n disabled?: boolean;\n}\n\nexport interface SelectConfig {\n options: ComboboxOption[];\n label: string;\n placeholder?: string;\n fdKey: string;\n onChange?: ComboboxProps['onChange'];\n value?: ComboboxProps['value'];\n}\n\nexport interface HeadingProps {\n title?: string;\n buttons?: ButtonConfig[];\n description?: string;\n breadcrumbItems?: BreadcrumbItem[];\n selectBoxes?: SelectConfig[];\n}\n\nconst StyledToolbar = styled(Toolbar)(({ theme }) => ({\n flexDirection: 'column',\n alignItems: 'stretch',\n [theme.breakpoints.up('tablet')]: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n [theme.breakpoints.down('tablet')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n}));\n\nconst StyledLeftSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n flex: '1 1 auto',\n gap: theme.spacing(0.5),\n minWidth: 0,\n maxWidth: '100%',\n [theme.breakpoints.up('tablet')]: {\n marginRight: theme.spacing(2),\n },\n}));\n\nconst StyledRightSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n justifyContent: 'flex-end',\n alignItems: 'center',\n gap: theme.spacing(1),\n flexShrink: 0,\n alignSelf: 'flex-start',\n paddingTop: theme.spacing(0.5),\n [theme.breakpoints.down('tablet')]: {\n justifyContent: 'flex-end',\n marginTop: theme.spacing(1),\n paddingTop: 0,\n alignSelf: 'stretch',\n width: '100%',\n },\n}));\n\nconst StyledSelectedSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n gap: theme.spacing(2),\n width: '100%',\n maxWidth: '100%',\n [theme.breakpoints.up('tablet')]: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingTop: theme.spacing(2),\n flexWrap: 'wrap',\n },\n [theme.breakpoints.down('tablet')]: {\n flexDirection: 'column',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n width: '100%',\n },\n}));\n\nexport const Heading: React.FC<HeadingProps> = ({\n title,\n buttons,\n description,\n breadcrumbItems,\n selectBoxes,\n}: HeadingProps) => {\n const renderSelectedSection = () => {\n if (!selectBoxes?.length) {\n return null;\n }\n\n return (\n <StyledSelectedSection>\n {selectBoxes.map((selectConfig) => (\n <Combobox\n key={selectConfig.fdKey}\n fdKey={selectConfig.fdKey}\n label={selectConfig.label}\n onChange={selectConfig.onChange}\n options={selectConfig.options}\n placeholder={selectConfig.placeholder}\n value={selectConfig.value ?? null}\n />\n ))}\n </StyledSelectedSection>\n );\n };\n\n const renderLeftSection = () => (\n <StyledLeftSection>\n {breadcrumbItems && <BreadCrumbs items={breadcrumbItems} />}\n {title && <Typography variant=\"h1Strong\">{title}</Typography>}\n {description && (\n <Typography color=\"semantic.text.text-weak\" variant=\"captionWeak\">\n {description}\n </Typography>\n )}\n {renderSelectedSection()}\n </StyledLeftSection>\n );\n\n const renderRightSection = () => {\n if (!buttons?.length) {\n return null;\n }\n\n return (\n <StyledRightSection>\n <ButtonGroup align=\"right\" fdKey=\"heading-button-group\" layout=\"horizontal\" size=\"medium\">\n {buttons.map((buttonConfig: ButtonConfig) => {\n const variant: ButtonType = buttonConfig.variant;\n return (\n <Button\n key={buttonConfig.fdKey}\n disabled={buttonConfig.disabled ?? false}\n fdKey={buttonConfig.fdKey}\n onClick={buttonConfig.onClick}\n variant={variant}\n >\n {buttonConfig.label}\n </Button>\n );\n })}\n </ButtonGroup>\n </StyledRightSection>\n );\n };\n\n return (\n <StyledToolbar>\n {renderLeftSection()}\n {renderRightSection()}\n </StyledToolbar>\n );\n};\n\nexport default Heading;\n"],"names":["StyledToolbar","styled","Toolbar","theme","flexDirection","alignItems","breakpoints","up","justifyContent","paddingTop","spacing","paddingBottom","down","StyledLeftSection","Box","display","flex","gap","minWidth","maxWidth","marginRight","StyledRightSection","flexShrink","alignSelf","marginTop","width","StyledSelectedSection","flexWrap","Heading","title","buttons","description","breadcrumbItems","selectBoxes","_jsxs","children","_jsx","BreadCrumbs","items","Typography","variant","color","length","map","selectConfig","Combobox","fdKey","label","onChange","options","placeholder","value","ButtonGroup","align","layout","size","buttonConfig","Button","disabled","onClick"],"mappings":"8cAuCA,MAAMA,EAAgBC,EAAAA,OAAOC,EAAPD,EAAgB,EAAGE,YAAO,CAC9CC,cAAe,SACfC,WAAY,UACZ,CAACF,EAAMG,YAAYC,GAAG,WAAY,CAChCH,cAAe,MACfC,WAAY,aACZG,eAAgB,gBAChBC,WAAYN,EAAMO,QAAQ,GAC1BC,cAAeR,EAAMO,QAAQ,IAE/B,CAACP,EAAMG,YAAYM,KAAK,WAAY,CAClCH,WAAYN,EAAMO,QAAQ,GAC1BC,cAAeR,EAAMO,QAAQ,QAI3BG,EAAoBZ,EAAAA,OAAOa,EAAPb,EAAY,EAAGE,YAAO,CAC9CY,QAAS,OACTX,cAAe,SACfC,WAAY,aACZW,KAAM,WACNC,IAAKd,EAAMO,QAAQ,IACnBQ,SAAU,EACVC,SAAU,OACV,CAAChB,EAAMG,YAAYC,GAAG,WAAY,CAChCa,YAAajB,EAAMO,QAAQ,QAIzBW,EAAqBpB,EAAAA,OAAOa,EAAPb,EAAY,EAAGE,YAAO,CAC/CY,QAAS,OACTP,eAAgB,WAChBH,WAAY,SACZY,IAAKd,EAAMO,QAAQ,GACnBY,WAAY,EACZC,UAAW,aACXd,WAAYN,EAAMO,QAAQ,IAC1B,CAACP,EAAMG,YAAYM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a,IACZ,MAAMhB,EAAsBgB,EAAahB,QACzC,OACEJ,EAAAA,IAACqB,SAAM,CAELC,SAAUF,EAAaE,WAAY,EACnCZ,MAAOU,EAAaV,MACpBa,QAASH,EAAaG,QACtBnB,QAASA,EAAOL,SAEfqB,EAAaT,OANTS,EAAaV,cAVrB"}
@@ -17,7 +17,6 @@ interface SelectConfig {
17
17
  fdKey: string;
18
18
  onChange?: ComboboxProps['onChange'];
19
19
  value?: ComboboxProps['value'];
20
- translations: ComboboxProps['translations'];
21
20
  }
22
21
  interface HeadingProps {
23
22
  title?: string;
@@ -1,2 +1,2 @@
1
- import{jsxs as t,jsx as e}from"react/jsx-runtime";import"react";import i from"@mui/material/Toolbar";import{styled as a}from"@mui/material/styles";import n from"@mui/material/Box";import o from"../../atoms/BreadCrumbs/index.js";import{Button as l}from"../../atoms/Button/index.js";import r from"@mui/material/Typography";import s from"../../molecules/ButtonGroup/index.js";import{Combobox as p}from"../../molecules/Combobox/index.js";const m=a(i)((({theme:t})=>({flexDirection:"column",alignItems:"stretch",[t.breakpoints.up("tablet")]:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",paddingTop:t.spacing(2),paddingBottom:t.spacing(2)},[t.breakpoints.down("tablet")]:{paddingTop:t.spacing(2),paddingBottom:t.spacing(2)}}))),d=a(n)((({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",flex:"1 1 auto",gap:t.spacing(.5),minWidth:0,maxWidth:"100%",[t.breakpoints.up("tablet")]:{marginRight:t.spacing(2)}}))),c=a(n)((({theme:t})=>({display:"flex",justifyContent:"flex-end",alignItems:"center",gap:t.spacing(1),flexShrink:0,alignSelf:"flex-start",paddingTop:t.spacing(.5),[t.breakpoints.down("tablet")]:{justifyContent:"flex-end",marginTop:t.spacing(1),paddingTop:0,alignSelf:"stretch",width:"100%"}}))),g=a(n)((({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:t.spacing(2),width:"100%",maxWidth:"100%",[t.breakpoints.up("tablet")]:{flexDirection:"row",alignItems:"center",paddingTop:t.spacing(2),flexWrap:"wrap"},[t.breakpoints.down("tablet")]:{flexDirection:"column",alignItems:"flex-start",paddingTop:t.spacing(2),paddingBottom:t.spacing(2),width:"100%"}}))),f=({title:i,buttons:a,description:n,breadcrumbItems:f,selectBoxes:u})=>t(m,{children:[t(d,{children:[f&&e(o,{items:f}),i&&e(r,{variant:"h1Strong",children:i}),n&&e(r,{color:"semantic.text.text-weak",variant:"captionWeak",children:n}),u?.length?e(g,{children:u.map((t=>e(p,{fdKey:t.fdKey,label:t.label,onChange:t.onChange,options:t.options,placeholder:t.placeholder,translations:t.translations,value:t.value??null},t.fdKey)))}):null]}),a?.length?e(c,{children:e(s,{align:"right",fdKey:"heading-button-group",layout:"horizontal",size:"medium",children:a.map((t=>{const i=t.variant;return e(l,{disabled:t.disabled??!1,fdKey:t.fdKey,onClick:t.onClick,variant:i,children:t.label},t.fdKey)}))})}):null]});export{f as Heading,f as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import"react";import i from"@mui/material/Toolbar";import{styled as a}from"@mui/material/styles";import n from"@mui/material/Box";import o from"../../atoms/BreadCrumbs/index.js";import{Button as l}from"../../atoms/Button/index.js";import r from"@mui/material/Typography";import p from"../../molecules/ButtonGroup/index.js";import{Combobox as s}from"../../molecules/Combobox/index.js";const m=a(i)((({theme:e})=>({flexDirection:"column",alignItems:"stretch",[e.breakpoints.up("tablet")]:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)},[e.breakpoints.down("tablet")]:{paddingTop:e.spacing(2),paddingBottom:e.spacing(2)}}))),d=a(n)((({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",flex:"1 1 auto",gap:e.spacing(.5),minWidth:0,maxWidth:"100%",[e.breakpoints.up("tablet")]:{marginRight:e.spacing(2)}}))),c=a(n)((({theme:e})=>({display:"flex",justifyContent:"flex-end",alignItems:"center",gap:e.spacing(1),flexShrink:0,alignSelf:"flex-start",paddingTop:e.spacing(.5),[e.breakpoints.down("tablet")]:{justifyContent:"flex-end",marginTop:e.spacing(1),paddingTop:0,alignSelf:"stretch",width:"100%"}}))),g=a(n)((({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:e.spacing(2),width:"100%",maxWidth:"100%",[e.breakpoints.up("tablet")]:{flexDirection:"row",alignItems:"center",paddingTop:e.spacing(2),flexWrap:"wrap"},[e.breakpoints.down("tablet")]:{flexDirection:"column",alignItems:"flex-start",paddingTop:e.spacing(2),paddingBottom:e.spacing(2),width:"100%"}}))),f=({title:i,buttons:a,description:n,breadcrumbItems:f,selectBoxes:u})=>e(m,{children:[e(d,{children:[f&&t(o,{items:f}),i&&t(r,{variant:"h1Strong",children:i}),n&&t(r,{color:"semantic.text.text-weak",variant:"captionWeak",children:n}),u?.length?t(g,{children:u.map((e=>t(s,{fdKey:e.fdKey,label:e.label,onChange:e.onChange,options:e.options,placeholder:e.placeholder,value:e.value??null},e.fdKey)))}):null]}),a?.length?t(c,{children:t(p,{align:"right",fdKey:"heading-button-group",layout:"horizontal",size:"medium",children:a.map((e=>{const i=e.variant;return t(l,{disabled:e.disabled??!1,fdKey:e.fdKey,onClick:e.onClick,variant:i,children:e.label},e.fdKey)}))})}):null]});export{f as Heading,f as default};
2
2
  //# sourceMappingURL=Heading.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Heading.js","sources":["../../../../src/components/organisms/Heading/Heading.tsx"],"sourcesContent":["import React from 'react';\n\nimport Toolbar from '@mui/material/Toolbar';\n\nimport styled from '@fd/utilities/styledUtilities';\n\nimport Box from '../../atoms/Box';\nimport BreadCrumbs, { type BreadcrumbItem } from '../../atoms/BreadCrumbs';\nimport Button from '../../atoms/Button';\nimport { type ButtonType } from '../../atoms/Button/getButtonStyles';\nimport Typography from '../../atoms/Typography';\nimport ButtonGroup from '../../molecules/ButtonGroup';\nimport { Combobox, type ComboboxOption, type ComboboxProps } from '../../molecules/Combobox';\n\nexport interface ButtonConfig {\n variant: ButtonType;\n onClick: () => void;\n label: string;\n fdKey: string;\n disabled?: boolean;\n}\n\nexport interface SelectConfig {\n options: ComboboxOption[];\n label: string;\n placeholder?: string;\n fdKey: string;\n onChange?: ComboboxProps['onChange'];\n value?: ComboboxProps['value'];\n translations: ComboboxProps['translations'];\n}\n\nexport interface HeadingProps {\n title?: string;\n buttons?: ButtonConfig[];\n description?: string;\n breadcrumbItems?: BreadcrumbItem[];\n selectBoxes?: SelectConfig[];\n}\n\nconst StyledToolbar = styled(Toolbar)(({ theme }) => ({\n flexDirection: 'column',\n alignItems: 'stretch',\n [theme.breakpoints.up('tablet')]: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n [theme.breakpoints.down('tablet')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n}));\n\nconst StyledLeftSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n flex: '1 1 auto',\n gap: theme.spacing(0.5),\n minWidth: 0,\n maxWidth: '100%',\n [theme.breakpoints.up('tablet')]: {\n marginRight: theme.spacing(2),\n },\n}));\n\nconst StyledRightSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n justifyContent: 'flex-end',\n alignItems: 'center',\n gap: theme.spacing(1),\n flexShrink: 0,\n alignSelf: 'flex-start',\n paddingTop: theme.spacing(0.5),\n [theme.breakpoints.down('tablet')]: {\n justifyContent: 'flex-end',\n marginTop: theme.spacing(1),\n paddingTop: 0,\n alignSelf: 'stretch',\n width: '100%',\n },\n}));\n\nconst StyledSelectedSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n gap: theme.spacing(2),\n width: '100%',\n maxWidth: '100%',\n [theme.breakpoints.up('tablet')]: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingTop: theme.spacing(2),\n flexWrap: 'wrap',\n },\n [theme.breakpoints.down('tablet')]: {\n flexDirection: 'column',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n width: '100%',\n },\n}));\n\nexport const Heading: React.FC<HeadingProps> = ({\n title,\n buttons,\n description,\n breadcrumbItems,\n selectBoxes,\n}: HeadingProps) => {\n const renderSelectedSection = () => {\n if (!selectBoxes?.length) {\n return null;\n }\n\n return (\n <StyledSelectedSection>\n {selectBoxes.map((selectConfig) => (\n <Combobox\n key={selectConfig.fdKey}\n fdKey={selectConfig.fdKey}\n label={selectConfig.label}\n onChange={selectConfig.onChange}\n options={selectConfig.options}\n placeholder={selectConfig.placeholder}\n translations={selectConfig.translations}\n value={selectConfig.value ?? null}\n />\n ))}\n </StyledSelectedSection>\n );\n };\n\n const renderLeftSection = () => (\n <StyledLeftSection>\n {breadcrumbItems && <BreadCrumbs items={breadcrumbItems} />}\n {title && <Typography variant=\"h1Strong\">{title}</Typography>}\n {description && (\n <Typography color=\"semantic.text.text-weak\" variant=\"captionWeak\">\n {description}\n </Typography>\n )}\n {renderSelectedSection()}\n </StyledLeftSection>\n );\n\n const renderRightSection = () => {\n if (!buttons?.length) {\n return null;\n }\n\n return (\n <StyledRightSection>\n <ButtonGroup align=\"right\" fdKey=\"heading-button-group\" layout=\"horizontal\" size=\"medium\">\n {buttons.map((buttonConfig: ButtonConfig) => {\n const variant: ButtonType = buttonConfig.variant;\n return (\n <Button\n key={buttonConfig.fdKey}\n disabled={buttonConfig.disabled ?? false}\n fdKey={buttonConfig.fdKey}\n onClick={buttonConfig.onClick}\n variant={variant}\n >\n {buttonConfig.label}\n </Button>\n );\n })}\n </ButtonGroup>\n </StyledRightSection>\n );\n };\n\n return (\n <StyledToolbar>\n {renderLeftSection()}\n {renderRightSection()}\n </StyledToolbar>\n );\n};\n\nexport default Heading;\n"],"names":["StyledToolbar","styled","Toolbar","theme","flexDirection","alignItems","breakpoints","up","justifyContent","paddingTop","spacing","paddingBottom","down","StyledLeftSection","Box","display","flex","gap","minWidth","maxWidth","marginRight","StyledRightSection","flexShrink","alignSelf","marginTop","width","StyledSelectedSection","flexWrap","Heading","title","buttons","description","breadcrumbItems","selectBoxes","_jsxs","children","_jsx","BreadCrumbs","items","Typography","variant","color","length","map","selectConfig","Combobox","fdKey","label","onChange","options","placeholder","translations","value","ButtonGroup","align","layout","size","buttonConfig","Button","disabled","onClick"],"mappings":"kbAwCA,MAAMA,EAAgBC,EAAOC,EAAPD,EAAgB,EAAGE,YAAO,CAC9CC,cAAe,SACfC,WAAY,UACZ,CAACF,EAAMG,YAAYC,GAAG,WAAY,CAChCH,cAAe,MACfC,WAAY,aACZG,eAAgB,gBAChBC,WAAYN,EAAMO,QAAQ,GAC1BC,cAAeR,EAAMO,QAAQ,IAE/B,CAACP,EAAMG,YAAYM,KAAK,WAAY,CAClCH,WAAYN,EAAMO,QAAQ,GAC1BC,cAAeR,EAAMO,QAAQ,QAI3BG,EAAoBZ,EAAOa,EAAPb,EAAY,EAAGE,YAAO,CAC9CY,QAAS,OACTX,cAAe,SACfC,WAAY,aACZW,KAAM,WACNC,IAAKd,EAAMO,QAAQ,IACnBQ,SAAU,EACVC,SAAU,OACV,CAAChB,EAAMG,YAAYC,GAAG,WAAY,CAChCa,YAAajB,EAAMO,QAAQ,QAIzBW,EAAqBpB,EAAOa,EAAPb,EAAY,EAAGE,YAAO,CAC/CY,QAAS,OACTP,eAAgB,WAChBH,WAAY,SACZY,IAAKd,EAAMO,QAAQ,GACnBY,WAAY,EACZC,UAAW,aACXd,WAAYN,EAAMO,QAAQ,IAC1B,CAACP,EAAMG,YAAYM,KAAK,WAAY,CAClCJ,eAAgB,WAChBgB,UAAWrB,EAAMO,QAAQ,GACzBD,WAAY,EACZc,UAAW,UACXE,MAAO,YAILC,EAAwBzB,EAAOa,EAAPb,EAAY,EAAGE,YAAO,CAClDY,QAAS,OACTX,cAAe,SACfC,WAAY,aACZY,IAAKd,EAAM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ourcesContent":["import React from 'react';\n\nimport Toolbar from '@mui/material/Toolbar';\n\nimport styled from '@fd/utilities/styledUtilities';\n\nimport Box from '../../atoms/Box';\nimport BreadCrumbs, { type BreadcrumbItem } from '../../atoms/BreadCrumbs';\nimport Button from '../../atoms/Button';\nimport { type ButtonType } from '../../atoms/Button/getButtonStyles';\nimport Typography from '../../atoms/Typography';\nimport ButtonGroup from '../../molecules/ButtonGroup';\nimport { Combobox, type ComboboxOption, type ComboboxProps } from '../../molecules/Combobox';\n\nexport interface ButtonConfig {\n variant: ButtonType;\n onClick: () => void;\n label: string;\n fdKey: string;\n disabled?: boolean;\n}\n\nexport interface SelectConfig {\n options: ComboboxOption[];\n label: string;\n placeholder?: string;\n fdKey: string;\n onChange?: ComboboxProps['onChange'];\n value?: ComboboxProps['value'];\n}\n\nexport interface HeadingProps {\n title?: string;\n buttons?: ButtonConfig[];\n description?: string;\n breadcrumbItems?: BreadcrumbItem[];\n selectBoxes?: SelectConfig[];\n}\n\nconst StyledToolbar = styled(Toolbar)(({ theme }) => ({\n flexDirection: 'column',\n alignItems: 'stretch',\n [theme.breakpoints.up('tablet')]: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n [theme.breakpoints.down('tablet')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n}));\n\nconst StyledLeftSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n flex: '1 1 auto',\n gap: theme.spacing(0.5),\n minWidth: 0,\n maxWidth: '100%',\n [theme.breakpoints.up('tablet')]: {\n marginRight: theme.spacing(2),\n },\n}));\n\nconst StyledRightSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n justifyContent: 'flex-end',\n alignItems: 'center',\n gap: theme.spacing(1),\n flexShrink: 0,\n alignSelf: 'flex-start',\n paddingTop: theme.spacing(0.5),\n [theme.breakpoints.down('tablet')]: {\n justifyContent: 'flex-end',\n marginTop: theme.spacing(1),\n paddingTop: 0,\n alignSelf: 'stretch',\n width: '100%',\n },\n}));\n\nconst StyledSelectedSection = styled(Box)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n gap: theme.spacing(2),\n width: '100%',\n maxWidth: '100%',\n [theme.breakpoints.up('tablet')]: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingTop: theme.spacing(2),\n flexWrap: 'wrap',\n },\n [theme.breakpoints.down('tablet')]: {\n flexDirection: 'column',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n width: '100%',\n },\n}));\n\nexport const Heading: React.FC<HeadingProps> = ({\n title,\n buttons,\n description,\n breadcrumbItems,\n selectBoxes,\n}: HeadingProps) => {\n const renderSelectedSection = () => {\n if (!selectBoxes?.length) {\n return null;\n }\n\n return (\n <StyledSelectedSection>\n {selectBoxes.map((selectConfig) => (\n <Combobox\n key={selectConfig.fdKey}\n fdKey={selectConfig.fdKey}\n label={selectConfig.label}\n onChange={selectConfig.onChange}\n options={selectConfig.options}\n placeholder={selectConfig.placeholder}\n value={selectConfig.value ?? null}\n />\n ))}\n </StyledSelectedSection>\n );\n };\n\n const renderLeftSection = () => (\n <StyledLeftSection>\n {breadcrumbItems && <BreadCrumbs items={breadcrumbItems} />}\n {title && <Typography variant=\"h1Strong\">{title}</Typography>}\n {description && (\n <Typography color=\"semantic.text.text-weak\" variant=\"captionWeak\">\n {description}\n </Typography>\n )}\n {renderSelectedSection()}\n </StyledLeftSection>\n );\n\n const renderRightSection = () => {\n if (!buttons?.length) {\n return null;\n }\n\n return (\n <StyledRightSection>\n <ButtonGroup align=\"right\" fdKey=\"heading-button-group\" layout=\"horizontal\" size=\"medium\">\n {buttons.map((buttonConfig: ButtonConfig) => {\n const variant: ButtonType = buttonConfig.variant;\n return (\n <Button\n key={buttonConfig.fdKey}\n disabled={buttonConfig.disabled ?? false}\n fdKey={buttonConfig.fdKey}\n onClick={buttonConfig.onClick}\n variant={variant}\n >\n {buttonConfig.label}\n </Button>\n );\n })}\n </ButtonGroup>\n </StyledRightSection>\n );\n };\n\n return (\n <StyledToolbar>\n {renderLeftSection()}\n {renderRightSection()}\n </StyledToolbar>\n );\n};\n\nexport default Heading;\n"],"names":["StyledToolbar","styled","Toolbar","theme","flexDirection","alignItems","breakpoints","up","justifyContent","paddingTop","spacing","paddingBottom","down","StyledLeftSection","Box","display","flex","gap","minWidth","maxWidth","marginRight","StyledRightSection","flexShrink","alignSelf","marginTop","width","StyledSelectedSection","flexWrap","Heading","title","buttons","description","breadcrumbItems","selectBoxes","_jsxs","children","_jsx","BreadCrumbs","items","Typography","variant","color","length","map","selectConfig","Combobox","fdKey","label","onChange","options","placeholder","value","ButtonGroup","align","layout","size","buttonConfig","Button","disabled","onClick"],"mappings":"kbAuCA,MAAMA,EAAgBC,EAAOC,EAAPD,EAAgB,EAAGE,YAAO,CAC9CC,cAAe,SACfC,WAAY,UACZ,CAACF,EAAMG,YAAYC,GAAG,WAAY,CAChCH,cAAe,MACfC,WAAY,aACZG,eAAgB,gBAChBC,WAAYN,EAAMO,QAAQ,GAC1BC,cAAeR,EAAMO,QAAQ,IAE/B,CAACP,EAAMG,YAAYM,KAAK,WAAY,CAClCH,WAAYN,EAAMO,QAAQ,GAC1BC,cAAeR,EAAMO,QAAQ,QAI3BG,EAAoBZ,EAAOa,EAAPb,EAAY,EAAGE,YAAO,CAC9CY,QAAS,OACTX,cAAe,SACfC,WAAY,aACZW,KAAM,WACNC,IAAKd,EAAMO,QAAQ,IACnBQ,SAAU,EACVC,SAAU,OACV,CAAChB,EAAMG,YAAYC,GAAG,WAAY,CAChCa,YAAajB,EAAMO,QAAQ,QAIzBW,EAAqBpB,EAAOa,EAAPb,EAAY,EAAGE,YAAO,CAC/CY,QAAS,OACTP,eAAgB,WAChBH,WAAY,SACZY,IAAKd,EAAMO,QAAQ,GACnBY,WAAY,EACZC,UA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B,EAAsBgB,EAAahB,QACzC,OACEJ,EAACqB,EAAM,CAELC,SAAUF,EAAaE,WAAY,EACnCZ,MAAOU,EAAaV,MACpBa,QAASH,EAAaG,QACtBnB,QAASA,EAAOL,SAEfqB,EAAaT,OANTS,EAAaV,cAVrB"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={value:"Passwort anzeigen"},a={value:"Passwort ausblenden"},l={value:"Bilder auswählen"},s={value:"Bilder hochladen"},r={value:"Hochladen"},o={value:"Galerie"},t={value:"Abbrechen"},i={value:"Speichern"},_={value:"Auswählen"},p={value:"Dateien hier ablegen"},n={value:"Dateien hierher ziehen"},u={value:"Dateien durchsuchen"},d={value:"Dateityp nicht erlaubt. Erlaubte Typen: {allowedFileTypes}"},v={value:"Dateigröße zu groß. Maximale Größe: {maxFileSize}"},h={value:"Zu viele Dateien ausgewählt. Maximale Anzahl: {maxFiles}"},x={value:"Datei entfernen"},c={Show_password:e,Hide_password:a,Select_Images:l,Upload_Images:s,Upload:r,Library:o,Cancel:t,Save:i,Select:_,Drop_files_here:p,Drag_and_drop_files_here:n,Browse_files:u,File_type_is_not_allowed:d,File_size_is_too_large:v,Too_many_files_selected:h,Remove_file:x};exports.Browse_files=u,exports.Cancel=t,exports.Drag_and_drop_files_here=n,exports.Drop_files_here=p,exports.File_size_is_too_large=v,exports.File_type_is_not_allowed=d,exports.Hide_password=a,exports.Library=o,exports.Remove_file=x,exports.Save=i,exports.Select=_,exports.Select_Images=l,exports.Show_password=e,exports.Too_many_files_selected=h,exports.Upload=r,exports.Upload_Images=s,exports.default=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={value:"Passwort anzeigen"},t={value:"Passwort ausblenden"},o={value:"Bilder auswählen"},a={value:"Bilder hochladen"},r={value:"Hochladen"},s={value:"Galerie"},l={value:"Abbrechen"},_={value:"Speichern"},i={value:"Auswählen"},n={value:"Dateien hier ablegen"},u={value:"Dateien hierher ziehen"},p={value:"Dateien durchsuchen"},v={value:"Dateityp nicht erlaubt. Erlaubte Typen: {allowedFileTypes}"},x={value:"Dateigröße zu groß. Maximale Größe: {maxFileSize}"},d={value:"Zu viele Dateien ausgewählt. Maximale Anzahl: {maxFiles}"},h={value:"Datei entfernen"},c={value:"Auswahl löschen"},g={value:"Laden"},m={value:"Keine Optionen"},f={value:"Popup öffnen"},w={value:"Drücken Sie {hotkey}, um die Suche zu fokussieren"},b={value:"Weiter"},S={value:"{page} von {count}"},y={value:"Zurück"},D={value:"Zeige {start} - {end} von {total}"},P={value:"Vorherige Seite"},z={value:"Nächste Seite"},F={value:"Seite {number}"},N={value:"Ausgewählte Seite {number}"},k={value:"{number} von {total} Herzen"},B={value:"{number} von {total} Sternen"},C={value:"Von"},I={value:"{total} Bewertungen"},M={value:"Schließen"},A={value:"Menge verringern"},L={value:"Menge erhöhen"},q={value:"Menge"},H={value:"Verwerfen {dismissible}"},O={value:"1 Bewertung"},T={Show_password:e,Hide_password:t,Select_Images:o,Upload_Images:a,Upload:r,Library:s,Cancel:l,Save:_,Select:i,Drop_files_here:n,Drag_and_drop_files_here:u,Browse_files:p,File_type_is_not_allowed:v,File_size_is_too_large:x,Too_many_files_selected:d,Remove_file:h,Clear_selection:c,Loading:g,No_options:m,Open_popup:f,Press_hotkey_to_focus_search:w,Next:b,page_of_count:S,Previous:y,Showing_start_end_of_total:D,Previous_page:P,Next_page:z,Page_number:F,Selected_page_number:N,number_out_of_total_hearts:k,number_out_of_total_stars:B,From:C,total_reviews:I,Close:M,Decrease_quantity:A,Increase_quantity:L,Quantity:q,Dismiss_dismissible:H,one_review:O};exports.Browse_files=p,exports.Cancel=l,exports.Clear_selection=c,exports.Close=M,exports.Decrease_quantity=A,exports.Dismiss_dismissible=H,exports.Drag_and_drop_files_here=u,exports.Drop_files_here=n,exports.File_size_is_too_large=x,exports.File_type_is_not_allowed=v,exports.From=C,exports.Hide_password=t,exports.Increase_quantity=L,exports.Library=s,exports.Loading=g,exports.Next=b,exports.Next_page=z,exports.No_options=m,exports.Open_popup=f,exports.Page_number=F,exports.Press_hotkey_to_focus_search=w,exports.Previous=y,exports.Previous_page=P,exports.Quantity=q,exports.Remove_file=h,exports.Save=_,exports.Select=i,exports.Select_Images=o,exports.Selected_page_number=N,exports.Show_password=e,exports.Showing_start_end_of_total=D,exports.Too_many_files_selected=d,exports.Upload=r,exports.Upload_Images=a,exports.default=T,exports.number_out_of_total_hearts=k,exports.number_out_of_total_stars=B,exports.one_review=O,exports.page_of_count=S,exports.total_reviews=I;
2
2
  //# sourceMappingURL=de.json.cjs.js.map
@@ -1,2 +1,2 @@
1
- var e={value:"Passwort anzeigen"},a={value:"Passwort ausblenden"},l={value:"Bilder auswählen"},i={value:"Bilder hochladen"},r={value:"Hochladen"},n={value:"Galerie"},s={value:"Abbrechen"},u={value:"Speichern"},t={value:"Auswählen"},_={value:"Dateien hier ablegen"},o={value:"Dateien hierher ziehen"},v={value:"Dateien durchsuchen"},h={value:"Dateityp nicht erlaubt. Erlaubte Typen: {allowedFileTypes}"},d={value:"Dateigröße zu groß. Maximale Größe: {maxFileSize}"},p={value:"Zu viele Dateien ausgewählt. Maximale Anzahl: {maxFiles}"},c={value:"Datei entfernen"},w={Show_password:e,Hide_password:a,Select_Images:l,Upload_Images:i,Upload:r,Library:n,Cancel:s,Save:u,Select:t,Drop_files_here:_,Drag_and_drop_files_here:o,Browse_files:v,File_type_is_not_allowed:h,File_size_is_too_large:d,Too_many_files_selected:p,Remove_file:c};export{v as Browse_files,s as Cancel,o as Drag_and_drop_files_here,_ as Drop_files_here,d as File_size_is_too_large,h as File_type_is_not_allowed,a as Hide_password,n as Library,c as Remove_file,u as Save,t as Select,l as Select_Images,e as Show_password,p as Too_many_files_selected,r as Upload,i as Upload_Images,w as default};
1
+ var e={value:"Passwort anzeigen"},a={value:"Passwort ausblenden"},l={value:"Bilder auswählen"},u={value:"Bilder hochladen"},n={value:"Hochladen"},t={value:"Galerie"},i={value:"Abbrechen"},r={value:"Speichern"},o={value:"Auswählen"},s={value:"Dateien hier ablegen"},_={value:"Dateien hierher ziehen"},v={value:"Dateien durchsuchen"},h={value:"Dateityp nicht erlaubt. Erlaubte Typen: {allowedFileTypes}"},g={value:"Dateigröße zu groß. Maximale Größe: {maxFileSize}"},c={value:"Zu viele Dateien ausgewählt. Maximale Anzahl: {maxFiles}"},d={value:"Datei entfernen"},p={value:"Auswahl löschen"},m={value:"Laden"},w={value:"Keine Optionen"},b={value:"Popup öffnen"},f={value:"Drücken Sie {hotkey}, um die Suche zu fokussieren"},S={value:"Weiter"},D={value:"{page} von {count}"},y={value:"Zurück"},z={value:"Zeige {start} - {end} von {total}"},x={value:"Vorherige Seite"},P={value:"Nächste Seite"},F={value:"Seite {number}"},k={value:"Ausgewählte Seite {number}"},A={value:"{number} von {total} Herzen"},B={value:"{number} von {total} Sternen"},M={value:"Von"},N={value:"{total} Bewertungen"},C={value:"Schließen"},H={value:"Menge verringern"},I={value:"Menge erhöhen"},L={value:"Menge"},T={value:"Verwerfen {dismissible}"},V={value:"1 Bewertung"},Z={Show_password:e,Hide_password:a,Select_Images:l,Upload_Images:u,Upload:n,Library:t,Cancel:i,Save:r,Select:o,Drop_files_here:s,Drag_and_drop_files_here:_,Browse_files:v,File_type_is_not_allowed:h,File_size_is_too_large:g,Too_many_files_selected:c,Remove_file:d,Clear_selection:p,Loading:m,No_options:w,Open_popup:b,Press_hotkey_to_focus_search:f,Next:S,page_of_count:D,Previous:y,Showing_start_end_of_total:z,Previous_page:x,Next_page:P,Page_number:F,Selected_page_number:k,number_out_of_total_hearts:A,number_out_of_total_stars:B,From:M,total_reviews:N,Close:C,Decrease_quantity:H,Increase_quantity:I,Quantity:L,Dismiss_dismissible:T,one_review:V};export{v as Browse_files,i as Cancel,p as Clear_selection,C as Close,H as Decrease_quantity,T as Dismiss_dismissible,_ as Drag_and_drop_files_here,s as Drop_files_here,g as File_size_is_too_large,h as File_type_is_not_allowed,M as From,a as Hide_password,I as Increase_quantity,t as Library,m as Loading,S as Next,P as Next_page,w as No_options,b as Open_popup,F as Page_number,f as Press_hotkey_to_focus_search,y as Previous,x as Previous_page,L as Quantity,d as Remove_file,r as Save,o as Select,l as Select_Images,k as Selected_page_number,e as Show_password,z as Showing_start_end_of_total,c as Too_many_files_selected,n as Upload,u as Upload_Images,Z as default,A as number_out_of_total_hearts,B as number_out_of_total_stars,V as one_review,D as page_of_count,N as total_reviews};
2
2
  //# sourceMappingURL=de.json.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={value:"Show password"},l={value:"Hide password"},s={value:"Select Images"},o={value:"Upload Images"},a={value:"Upload"},r={value:"Library"},_={value:"Cancel"},i={value:"Save"},p={value:"Select"},t={value:"Drop files here"},d={value:"Drag and drop files here"},v={value:"Browse files"},u={value:"File type is not allowed. Allowed types: {allowedFileTypes}"},x={value:"File size is too large. Maximum size: {maxFileSize}"},m={value:"Too many files selected. Maximum allowed: {maxFiles}"},w={value:"Remove file"},f={Show_password:e,Hide_password:l,Select_Images:s,Upload_Images:o,Upload:a,Library:r,Cancel:_,Save:i,Select:p,Drop_files_here:t,Drag_and_drop_files_here:d,Browse_files:v,File_type_is_not_allowed:u,File_size_is_too_large:x,Too_many_files_selected:m,Remove_file:w};exports.Browse_files=v,exports.Cancel=_,exports.Drag_and_drop_files_here=d,exports.Drop_files_here=t,exports.File_size_is_too_large=x,exports.File_type_is_not_allowed=u,exports.Hide_password=l,exports.Library=r,exports.Remove_file=w,exports.Save=i,exports.Select=p,exports.Select_Images=s,exports.Show_password=e,exports.Too_many_files_selected=m,exports.Upload=a,exports.Upload_Images=o,exports.default=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={value:"Show password"},o={value:"Hide password"},s={value:"Select Images"},a={value:"Upload Images"},t={value:"Upload"},r={value:"Library"},l={value:"Cancel"},_={value:"Save"},i={value:"Select"},p={value:"Drop files here"},u={value:"Drag and drop files here"},n={value:"Browse files"},v={value:"File type is not allowed. Allowed types: {allowedFileTypes}"},x={value:"File size is too large. Maximum size: {maxFileSize}"},d={value:"Too many files selected. Maximum allowed: {maxFiles}"},m={value:"Remove file"},c={value:"Clear selection"},g={value:"Loading"},f={value:"No options"},w={value:"Open popup"},y={value:"Press {hotkey} to focus search"},h={value:"Next"},b={value:"{page} of {count}"},S={value:"Previous"},P={value:"Showing {start} - {end} of {total}"},D={value:"Previous page"},F={value:"Next page"},C={value:"Page {number}"},I={value:"Selected page {number}"},N={value:"{number} out of {total} hearts"},q={value:"{number} out of {total} stars"},L={value:"From"},U={value:"{total} reviews"},z={value:"Close"},O={value:"Decrease quantity"},T={value:"Increase quantity"},k={value:"Quantity"},B={value:"Dismiss {dismissible}"},H={value:"1 review"},M={Show_password:e,Hide_password:o,Select_Images:s,Upload_Images:a,Upload:t,Library:r,Cancel:l,Save:_,Select:i,Drop_files_here:p,Drag_and_drop_files_here:u,Browse_files:n,File_type_is_not_allowed:v,File_size_is_too_large:x,Too_many_files_selected:d,Remove_file:m,Clear_selection:c,Loading:g,No_options:f,Open_popup:w,Press_hotkey_to_focus_search:y,Next:h,page_of_count:b,Previous:S,Showing_start_end_of_total:P,Previous_page:D,Next_page:F,Page_number:C,Selected_page_number:I,number_out_of_total_hearts:N,number_out_of_total_stars:q,From:L,total_reviews:U,Close:z,Decrease_quantity:O,Increase_quantity:T,Quantity:k,Dismiss_dismissible:B,one_review:H};exports.Browse_files=n,exports.Cancel=l,exports.Clear_selection=c,exports.Close=z,exports.Decrease_quantity=O,exports.Dismiss_dismissible=B,exports.Drag_and_drop_files_here=u,exports.Drop_files_here=p,exports.File_size_is_too_large=x,exports.File_type_is_not_allowed=v,exports.From=L,exports.Hide_password=o,exports.Increase_quantity=T,exports.Library=r,exports.Loading=g,exports.Next=h,exports.Next_page=F,exports.No_options=f,exports.Open_popup=w,exports.Page_number=C,exports.Press_hotkey_to_focus_search=y,exports.Previous=S,exports.Previous_page=D,exports.Quantity=k,exports.Remove_file=m,exports.Save=_,exports.Select=i,exports.Select_Images=s,exports.Selected_page_number=I,exports.Show_password=e,exports.Showing_start_end_of_total=P,exports.Too_many_files_selected=d,exports.Upload=t,exports.Upload_Images=a,exports.default=M,exports.number_out_of_total_hearts=N,exports.number_out_of_total_stars=q,exports.one_review=H,exports.page_of_count=b,exports.total_reviews=U;
2
2
  //# sourceMappingURL=en-US.json.cjs.js.map
@@ -1,2 +1,2 @@
1
- var e={value:"Show password"},l={value:"Hide password"},a={value:"Select Images"},s={value:"Upload Images"},o={value:"Upload"},i={value:"Library"},r={value:"Cancel"},_={value:"Save"},d={value:"Select"},v={value:"Drop files here"},u={value:"Drag and drop files here"},p={value:"Browse files"},t={value:"File type is not allowed. Allowed types: {allowedFileTypes}"},m={value:"File size is too large. Maximum size: {maxFileSize}"},w={value:"Too many files selected. Maximum allowed: {maxFiles}"},f={value:"Remove file"},S={Show_password:e,Hide_password:l,Select_Images:a,Upload_Images:s,Upload:o,Library:i,Cancel:r,Save:_,Select:d,Drop_files_here:v,Drag_and_drop_files_here:u,Browse_files:p,File_type_is_not_allowed:t,File_size_is_too_large:m,Too_many_files_selected:w,Remove_file:f};export{p as Browse_files,r as Cancel,u as Drag_and_drop_files_here,v as Drop_files_here,m as File_size_is_too_large,t as File_type_is_not_allowed,l as Hide_password,i as Library,f as Remove_file,_ as Save,d as Select,a as Select_Images,e as Show_password,w as Too_many_files_selected,o as Upload,s as Upload_Images,S as default};
1
+ var e={value:"Show password"},a={value:"Hide password"},l={value:"Select Images"},o={value:"Upload Images"},s={value:"Upload"},t={value:"Library"},u={value:"Cancel"},i={value:"Save"},r={value:"Select"},_={value:"Drop files here"},v={value:"Drag and drop files here"},n={value:"Browse files"},p={value:"File type is not allowed. Allowed types: {allowedFileTypes}"},d={value:"File size is too large. Maximum size: {maxFileSize}"},m={value:"Too many files selected. Maximum allowed: {maxFiles}"},c={value:"Remove file"},g={value:"Clear selection"},f={value:"Loading"},w={value:"No options"},y={value:"Open popup"},h={value:"Press {hotkey} to focus search"},S={value:"Next"},b={value:"{page} of {count}"},x={value:"Previous"},F={value:"Showing {start} - {end} of {total}"},D={value:"Previous page"},P={value:"Next page"},C={value:"Page {number}"},I={value:"Selected page {number}"},N={value:"{number} out of {total} hearts"},q={value:"{number} out of {total} stars"},z={value:"From"},L={value:"{total} reviews"},U={value:"Close"},T={value:"Decrease quantity"},k={value:"Increase quantity"},B={value:"Quantity"},H={value:"Dismiss {dismissible}"},M={value:"1 review"},O={Show_password:e,Hide_password:a,Select_Images:l,Upload_Images:o,Upload:s,Library:t,Cancel:u,Save:i,Select:r,Drop_files_here:_,Drag_and_drop_files_here:v,Browse_files:n,File_type_is_not_allowed:p,File_size_is_too_large:d,Too_many_files_selected:m,Remove_file:c,Clear_selection:g,Loading:f,No_options:w,Open_popup:y,Press_hotkey_to_focus_search:h,Next:S,page_of_count:b,Previous:x,Showing_start_end_of_total:F,Previous_page:D,Next_page:P,Page_number:C,Selected_page_number:I,number_out_of_total_hearts:N,number_out_of_total_stars:q,From:z,total_reviews:L,Close:U,Decrease_quantity:T,Increase_quantity:k,Quantity:B,Dismiss_dismissible:H,one_review:M};export{n as Browse_files,u as Cancel,g as Clear_selection,U as Close,T as Decrease_quantity,H as Dismiss_dismissible,v as Drag_and_drop_files_here,_ as Drop_files_here,d as File_size_is_too_large,p as File_type_is_not_allowed,z as From,a as Hide_password,k as Increase_quantity,t as Library,f as Loading,S as Next,P as Next_page,w as No_options,y as Open_popup,C as Page_number,h as Press_hotkey_to_focus_search,x as Previous,D as Previous_page,B as Quantity,c as Remove_file,i as Save,r as Select,l as Select_Images,I as Selected_page_number,e as Show_password,F as Showing_start_end_of_total,m as Too_many_files_selected,s as Upload,o as Upload_Images,O as default,N as number_out_of_total_hearts,q as number_out_of_total_stars,M as one_review,b as page_of_count,L as total_reviews};
2
2
  //# sourceMappingURL=en-US.json.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={value:"Show password"},l={value:"Hide password"},s={value:"Select Images"},o={value:"Upload Images"},a={value:"Upload"},r={value:"Library"},_={value:"Cancel"},i={value:"Save"},p={value:"Select"},t={value:"Drop files here"},d={value:"Drag and drop files here"},v={value:"Browse files"},u={value:"File type is not allowed. Allowed types: {allowedFileTypes}"},x={value:"File size is too large. Maximum size: {maxFileSize}"},m={value:"Too many files selected. Maximum allowed: {maxFiles}"},w={value:"Remove file"},f={Show_password:e,Hide_password:l,Select_Images:s,Upload_Images:o,Upload:a,Library:r,Cancel:_,Save:i,Select:p,Drop_files_here:t,Drag_and_drop_files_here:d,Browse_files:v,File_type_is_not_allowed:u,File_size_is_too_large:x,Too_many_files_selected:m,Remove_file:w};exports.Browse_files=v,exports.Cancel=_,exports.Drag_and_drop_files_here=d,exports.Drop_files_here=t,exports.File_size_is_too_large=x,exports.File_type_is_not_allowed=u,exports.Hide_password=l,exports.Library=r,exports.Remove_file=w,exports.Save=i,exports.Select=p,exports.Select_Images=s,exports.Show_password=e,exports.Too_many_files_selected=m,exports.Upload=a,exports.Upload_Images=o,exports.default=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={value:"Show password"},o={value:"Hide password"},s={value:"Select Images"},a={value:"Upload Images"},t={value:"Upload"},r={value:"Library"},l={value:"Cancel"},_={value:"Save"},i={value:"Select"},p={value:"Drop files here"},u={value:"Drag and drop files here"},n={value:"Browse files"},v={value:"File type is not allowed. Allowed types: {allowedFileTypes}"},x={value:"File size is too large. Maximum size: {maxFileSize}"},d={value:"Too many files selected. Maximum allowed: {maxFiles}"},m={value:"Remove file"},c={value:"Clear selection"},g={value:"Loading"},f={value:"No options"},w={value:"Open popup"},y={value:"Press {hotkey} to focus search"},h={value:"Next"},b={value:"{page} of {count}"},S={value:"Previous"},P={value:"Showing {start} - {end} of {total}"},D={value:"Previous page"},F={value:"Next page"},C={value:"Page {number}"},I={value:"Selected page {number}"},N={value:"{number} out of {total} hearts"},q={value:"{number} out of {total} stars"},L={value:"From"},U={value:"{total} reviews"},z={value:"Close"},O={value:"Decrease quantity"},T={value:"Increase quantity"},k={value:"Quantity"},B={value:"Dismiss {dismissible}"},H={value:"1 review"},M={Show_password:e,Hide_password:o,Select_Images:s,Upload_Images:a,Upload:t,Library:r,Cancel:l,Save:_,Select:i,Drop_files_here:p,Drag_and_drop_files_here:u,Browse_files:n,File_type_is_not_allowed:v,File_size_is_too_large:x,Too_many_files_selected:d,Remove_file:m,Clear_selection:c,Loading:g,No_options:f,Open_popup:w,Press_hotkey_to_focus_search:y,Next:h,page_of_count:b,Previous:S,Showing_start_end_of_total:P,Previous_page:D,Next_page:F,Page_number:C,Selected_page_number:I,number_out_of_total_hearts:N,number_out_of_total_stars:q,From:L,total_reviews:U,Close:z,Decrease_quantity:O,Increase_quantity:T,Quantity:k,Dismiss_dismissible:B,one_review:H};exports.Browse_files=n,exports.Cancel=l,exports.Clear_selection=c,exports.Close=z,exports.Decrease_quantity=O,exports.Dismiss_dismissible=B,exports.Drag_and_drop_files_here=u,exports.Drop_files_here=p,exports.File_size_is_too_large=x,exports.File_type_is_not_allowed=v,exports.From=L,exports.Hide_password=o,exports.Increase_quantity=T,exports.Library=r,exports.Loading=g,exports.Next=h,exports.Next_page=F,exports.No_options=f,exports.Open_popup=w,exports.Page_number=C,exports.Press_hotkey_to_focus_search=y,exports.Previous=S,exports.Previous_page=D,exports.Quantity=k,exports.Remove_file=m,exports.Save=_,exports.Select=i,exports.Select_Images=s,exports.Selected_page_number=I,exports.Show_password=e,exports.Showing_start_end_of_total=P,exports.Too_many_files_selected=d,exports.Upload=t,exports.Upload_Images=a,exports.default=M,exports.number_out_of_total_hearts=N,exports.number_out_of_total_stars=q,exports.one_review=H,exports.page_of_count=b,exports.total_reviews=U;
2
2
  //# sourceMappingURL=en.json.cjs.js.map