@flipdish/portal-library 8.0.2 → 8.0.3

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 (139) hide show
  1. package/README.md +7 -1
  2. package/dist/components/FlipdishLogoLoader/index.cjs.js +1 -1
  3. package/dist/components/FlipdishLogoLoader/index.cjs.js.map +1 -1
  4. package/dist/components/FlipdishLogoLoader/index.d.ts +2 -2
  5. package/dist/components/FlipdishLogoLoader/index.js +1 -1
  6. package/dist/components/FlipdishLogoLoader/index.js.map +1 -1
  7. package/dist/components/Form/GenericAutocompleteField/index.cjs.js +1 -1
  8. package/dist/components/Form/GenericAutocompleteField/index.cjs.js.map +1 -1
  9. package/dist/components/Form/GenericAutocompleteField/index.js +1 -1
  10. package/dist/components/Form/GenericAutocompleteField/index.js.map +1 -1
  11. package/dist/components/Form/GenericFormContainer/index.cjs.js +1 -1
  12. package/dist/components/Form/GenericFormContainer/index.cjs.js.map +1 -1
  13. package/dist/components/Form/GenericFormContainer/index.js +1 -1
  14. package/dist/components/Form/GenericFormContainer/index.js.map +1 -1
  15. package/dist/components/Form/GenericTextField/index.cjs.js +1 -1
  16. package/dist/components/Form/GenericTextField/index.cjs.js.map +1 -1
  17. package/dist/components/Form/GenericTextField/index.d.ts +2 -2
  18. package/dist/components/Form/GenericTextField/index.js +1 -1
  19. package/dist/components/Form/GenericTextField/index.js.map +1 -1
  20. package/dist/components/PageLayout/index.cjs.js +1 -1
  21. package/dist/components/PageLayout/index.cjs.js.map +1 -1
  22. package/dist/components/PageLayout/index.js +1 -1
  23. package/dist/components/PageLayout/index.js.map +1 -1
  24. package/dist/components/atoms/BadgeCount/index.cjs.js +1 -1
  25. package/dist/components/atoms/BadgeCount/index.cjs.js.map +1 -1
  26. package/dist/components/atoms/BadgeCount/index.d.ts +2 -2
  27. package/dist/components/atoms/BadgeCount/index.js +1 -1
  28. package/dist/components/atoms/BadgeCount/index.js.map +1 -1
  29. package/dist/components/atoms/BadgeDot/index.cjs.js +1 -1
  30. package/dist/components/atoms/BadgeDot/index.cjs.js.map +1 -1
  31. package/dist/components/atoms/BadgeDot/index.d.ts +2 -2
  32. package/dist/components/atoms/BadgeDot/index.js +1 -1
  33. package/dist/components/atoms/BadgeDot/index.js.map +1 -1
  34. package/dist/components/atoms/BreadCrumbs/index.cjs.js +1 -1
  35. package/dist/components/atoms/BreadCrumbs/index.cjs.js.map +1 -1
  36. package/dist/components/atoms/BreadCrumbs/index.d.ts +5 -5
  37. package/dist/components/atoms/BreadCrumbs/index.js +1 -1
  38. package/dist/components/atoms/BreadCrumbs/index.js.map +1 -1
  39. package/dist/components/atoms/IconButton/index.cjs.js +1 -1
  40. package/dist/components/atoms/IconButton/index.cjs.js.map +1 -1
  41. package/dist/components/atoms/IconButton/index.js +1 -1
  42. package/dist/components/atoms/IconButton/index.js.map +1 -1
  43. package/dist/components/atoms/IconContainer/index.cjs.js +1 -1
  44. package/dist/components/atoms/IconContainer/index.cjs.js.map +1 -1
  45. package/dist/components/atoms/IconContainer/index.d.ts +9 -9
  46. package/dist/components/atoms/IconContainer/index.js +1 -1
  47. package/dist/components/atoms/IconContainer/index.js.map +1 -1
  48. package/dist/components/atoms/LinearProgress/index.cjs.js +1 -1
  49. package/dist/components/atoms/LinearProgress/index.cjs.js.map +1 -1
  50. package/dist/components/atoms/LinearProgress/index.d.ts +2 -0
  51. package/dist/components/atoms/LinearProgress/index.js +1 -1
  52. package/dist/components/atoms/LinearProgress/index.js.map +1 -1
  53. package/dist/components/atoms/Switch/index.cjs.js +1 -1
  54. package/dist/components/atoms/Switch/index.cjs.js.map +1 -1
  55. package/dist/components/atoms/Switch/index.d.ts +13 -2
  56. package/dist/components/atoms/Switch/index.js +1 -1
  57. package/dist/components/atoms/Switch/index.js.map +1 -1
  58. package/dist/components/atoms/Tab/index.cjs.js +1 -1
  59. package/dist/components/atoms/Tab/index.cjs.js.map +1 -1
  60. package/dist/components/atoms/Tab/index.d.ts +6 -5
  61. package/dist/components/atoms/Tab/index.js +1 -1
  62. package/dist/components/atoms/Tab/index.js.map +1 -1
  63. package/dist/components/atoms/Tag/index.cjs.js +1 -1
  64. package/dist/components/atoms/Tag/index.cjs.js.map +1 -1
  65. package/dist/components/atoms/Tag/index.js +1 -1
  66. package/dist/components/atoms/Tag/index.js.map +1 -1
  67. package/dist/components/molecules/Alert/index.cjs.js +1 -1
  68. package/dist/components/molecules/Alert/index.cjs.js.map +1 -1
  69. package/dist/components/molecules/Alert/index.d.ts +3 -3
  70. package/dist/components/molecules/Alert/index.js +1 -1
  71. package/dist/components/molecules/Alert/index.js.map +1 -1
  72. package/dist/components/molecules/AlertSnackbar/index.cjs.js +1 -1
  73. package/dist/components/molecules/AlertSnackbar/index.cjs.js.map +1 -1
  74. package/dist/components/molecules/AlertSnackbar/index.d.ts +4 -4
  75. package/dist/components/molecules/AlertSnackbar/index.js +1 -1
  76. package/dist/components/molecules/AlertSnackbar/index.js.map +1 -1
  77. package/dist/components/molecules/Autocomplete/index.cjs.js +1 -1
  78. package/dist/components/molecules/Autocomplete/index.cjs.js.map +1 -1
  79. package/dist/components/molecules/Autocomplete/index.js +1 -1
  80. package/dist/components/molecules/Autocomplete/index.js.map +1 -1
  81. package/dist/components/molecules/EmptyState/index.cjs.js +1 -1
  82. package/dist/components/molecules/EmptyState/index.cjs.js.map +1 -1
  83. package/dist/components/molecules/EmptyState/index.js +1 -1
  84. package/dist/components/molecules/EmptyState/index.js.map +1 -1
  85. package/dist/components/molecules/FlipdishStaffContainer/index.cjs.js +1 -1
  86. package/dist/components/molecules/FlipdishStaffContainer/index.cjs.js.map +1 -1
  87. package/dist/components/molecules/FlipdishStaffContainer/index.js +1 -1
  88. package/dist/components/molecules/FlipdishStaffContainer/index.js.map +1 -1
  89. package/dist/components/molecules/GenericTable/GenericTableBody/index.cjs.js +1 -1
  90. package/dist/components/molecules/GenericTable/GenericTableBody/index.cjs.js.map +1 -1
  91. package/dist/components/molecules/GenericTable/GenericTableBody/index.js +1 -1
  92. package/dist/components/molecules/GenericTable/GenericTableBody/index.js.map +1 -1
  93. package/dist/components/molecules/GenericTable/GenericTableBodyRow/index.cjs.js +1 -1
  94. package/dist/components/molecules/GenericTable/GenericTableBodyRow/index.cjs.js.map +1 -1
  95. package/dist/components/molecules/GenericTable/GenericTableBodyRow/index.js +1 -1
  96. package/dist/components/molecules/GenericTable/GenericTableBodyRow/index.js.map +1 -1
  97. package/dist/components/molecules/GenericTable/index.cjs.js +1 -1
  98. package/dist/components/molecules/GenericTable/index.cjs.js.map +1 -1
  99. package/dist/components/molecules/GenericTable/index.js +3 -3
  100. package/dist/components/molecules/GenericTable/index.js.map +1 -1
  101. package/dist/components/molecules/Modal/index.cjs.js +1 -1
  102. package/dist/components/molecules/Modal/index.cjs.js.map +1 -1
  103. package/dist/components/molecules/Modal/index.d.ts +2 -2
  104. package/dist/components/molecules/Modal/index.js +1 -1
  105. package/dist/components/molecules/Modal/index.js.map +1 -1
  106. package/dist/components/molecules/Pagination/index.cjs.js +1 -1
  107. package/dist/components/molecules/Pagination/index.cjs.js.map +1 -1
  108. package/dist/components/molecules/Pagination/index.js +1 -1
  109. package/dist/components/molecules/Pagination/index.js.map +1 -1
  110. package/dist/components/molecules/ProgressStepper/index.cjs.js +1 -1
  111. package/dist/components/molecules/ProgressStepper/index.cjs.js.map +1 -1
  112. package/dist/components/molecules/ProgressStepper/index.js +1 -1
  113. package/dist/components/molecules/ProgressStepper/index.js.map +1 -1
  114. package/dist/components/molecules/RadioGroup/index.cjs.js +1 -1
  115. package/dist/components/molecules/RadioGroup/index.cjs.js.map +1 -1
  116. package/dist/components/molecules/RadioGroup/index.js +1 -1
  117. package/dist/components/molecules/RadioGroup/index.js.map +1 -1
  118. package/dist/components/molecules/Rating/index.cjs.js +1 -1
  119. package/dist/components/molecules/Rating/index.cjs.js.map +1 -1
  120. package/dist/components/molecules/Rating/index.js +1 -1
  121. package/dist/components/molecules/Rating/index.js.map +1 -1
  122. package/dist/components/molecules/TextBlock/index.cjs.js +1 -1
  123. package/dist/components/molecules/TextBlock/index.cjs.js.map +1 -1
  124. package/dist/components/molecules/TextBlock/index.d.ts +1 -1
  125. package/dist/components/molecules/TextBlock/index.js +1 -1
  126. package/dist/components/molecules/TextBlock/index.js.map +1 -1
  127. package/dist/components/organisms/FileUpload/components/FileDropZone.cjs.js +1 -1
  128. package/dist/components/organisms/FileUpload/components/FileDropZone.cjs.js.map +1 -1
  129. package/dist/components/organisms/FileUpload/components/FileDropZone.js +1 -1
  130. package/dist/components/organisms/FileUpload/components/FileDropZone.js.map +1 -1
  131. package/dist/components/organisms/ImageUploadWidget/components/ImageDropZone.cjs.js +1 -1
  132. package/dist/components/organisms/ImageUploadWidget/components/ImageDropZone.cjs.js.map +1 -1
  133. package/dist/components/organisms/ImageUploadWidget/components/ImageDropZone.js +1 -1
  134. package/dist/components/organisms/ImageUploadWidget/components/ImageDropZone.js.map +1 -1
  135. package/dist/components/organisms/ImageUploadWidget/index.cjs.js +1 -1
  136. package/dist/components/organisms/ImageUploadWidget/index.cjs.js.map +1 -1
  137. package/dist/components/organisms/ImageUploadWidget/index.js +1 -1
  138. package/dist/components/organisms/ImageUploadWidget/index.js.map +1 -1
  139. package/package.json +1 -1
package/README.md CHANGED
@@ -96,7 +96,9 @@ You can find the current list of provided icons at https://flipdishbytes.github.
96
96
 
97
97
  ## Changelog
98
98
 
99
- ### 8.0.0 — 2026-01-07
99
+ ### 8.0.0 — 2026-01-09
100
+
101
+ ---
100
102
 
101
103
  #### Breaking Changes
102
104
 
@@ -111,8 +113,12 @@ You can find the current list of provided icons at https://flipdishbytes.github.
111
113
  - **Molecules:** AlertGlobal, Autocomplete, Combobox, Pagination, QuantitySelector, Rating, SearchInput
112
114
  - **Organisms:** Heading
113
115
 
116
+ ---
117
+
114
118
  ### 5.0.0 — 2025-08-19
115
119
 
120
+ ---
121
+
116
122
  #### Breaking Changes
117
123
 
118
124
  - Required MUI v6 for Grid usage. Apps on MUI v5 should use MUI v5 Grid: https://v5.mui.com/material-ui/react-grid/.
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("@mui/material/styles"),i=require("../../assets/images/fd-loader.gif.cjs.js"),r=require("@mui/material/Typography");const l=t.styled("div")((({theme:e,fullscreen:t})=>({display:"flex",alignItems:"center",justifyContent:"center",background:e.palette.semantic.background["background-base"],flexDirection:"column",...t&&{width:"100vw",height:"100vh",position:"absolute",top:0,left:0}}))),a=t.styled("div")((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:"160px",height:"160px",borderRadius:"80px",background:e.palette.semantic.fill["fill-white"],boxShadow:"0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)",marginBottom:"32px"}))),s=t.styled("img")({height:"96px",width:"96px"}),n=t.styled(r)((({theme:e})=>({color:e.palette.semantic.text["text-primary"],lineHeight:"1.2",marginBottom:"4px"}))),o=t.styled(r)((({theme:e})=>({fontSize:"20px",color:e.palette.semantic.text["text-weak"],lineHeight:"1.4",letterSpacing:"normal"})));module.exports=({headline:t,subHeadline:r,fullscreen:d=!1})=>e.jsxs(l,{fullscreen:d,"data-testid":"FlipdishLogoLoader",children:[e.jsx(a,{children:e.jsx(s,{src:i,alt:"Flipdish Logo Loader"})}),e.jsx(n,{variant:"h2",children:t}),r&&e.jsx(o,{children:r})]});
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("@mui/material/styles"),i=require("@mui/material/Typography"),r=require("../../assets/images/fd-loader.gif.cjs.js");const l=t.styled("div")((({theme:e,fullscreen:t})=>({display:"flex",alignItems:"center",justifyContent:"center",background:e.palette.semantic.background["background-base"],flexDirection:"column",...t&&{width:"100vw",height:"100vh",position:"absolute",top:0,left:0}}))),a=t.styled("div")((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:"160px",height:"160px",borderRadius:"80px",background:e.palette.semantic.fill["fill-white"],boxShadow:"0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)",marginBottom:"32px"}))),s=t.styled("img")({height:"96px",width:"96px"}),n=t.styled(i)((({theme:e})=>({color:e.palette.semantic.text["text-primary"],lineHeight:"1.2",marginBottom:"4px"}))),o=t.styled(i)((({theme:e})=>({fontSize:"20px",color:e.palette.semantic.text["text-weak"],lineHeight:"1.4",letterSpacing:"normal"})));module.exports=({headline:t,subHeadline:i,fullscreen:d=!1})=>e.jsxs(l,{"data-fd":"FlipdishLogoLoader",fullscreen:d,children:[e.jsx(a,{children:e.jsx(s,{alt:"Flipdish Logo Loader",src:r})}),e.jsx(n,{variant:"h2",children:t}),i&&e.jsx(o,{children:i})]});
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../src/components/FlipdishLogoLoader/index.tsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport FdLoader from '../../assets/images/fd-loader.gif';\nimport Typography from '@mui/material/Typography';\n\nconst StyledContainer = styled('div')<{ fullscreen?: boolean }>(({ theme, fullscreen }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: theme.palette.semantic.background['background-base'],\n flexDirection: 'column',\n ...(fullscreen && {\n width: '100vw',\n height: '100vh',\n position: 'absolute',\n top: 0,\n left: 0,\n }),\n}));\n\nconst ImageContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '160px',\n height: '160px',\n borderRadius: '80px',\n background: theme.palette.semantic.fill['fill-white'],\n boxShadow: '0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)',\n marginBottom: '32px',\n}));\n\nconst StyledImage = styled('img')({\n height: '96px',\n width: '96px',\n});\n\nconst StyledHeadline = styled(Typography)(({ theme }) => ({\n color: theme.palette.semantic.text['text-primary'],\n lineHeight: '1.2',\n marginBottom: '4px',\n}));\n\nconst StyledSubHeadline = styled(Typography)(({ theme }) => ({\n fontSize: '20px',\n color: theme.palette.semantic.text['text-weak'],\n lineHeight: '1.4',\n letterSpacing: 'normal',\n}));\n\ntype FlipdishLogoLoaderProps = {\n headline: string;\n subHeadline?: string;\n fullscreen?: boolean;\n};\n\nconst FlipdishLogoLoader = ({ headline, subHeadline, fullscreen = false }: FlipdishLogoLoaderProps) => {\n return (\n <StyledContainer fullscreen={fullscreen} data-testid=\"FlipdishLogoLoader\">\n <ImageContainer>\n <StyledImage src={FdLoader} alt=\"Flipdish Logo Loader\" />\n </ImageContainer>\n <StyledHeadline variant=\"h2\">{headline}</StyledHeadline>\n {subHeadline && <StyledSubHeadline>{subHeadline}</StyledSubHeadline>}\n </StyledContainer>\n );\n};\n\nexport default FlipdishLogoLoader;\n"],"names":["StyledContainer","styled","theme","fullscreen","display","alignItems","justifyContent","background","palette","semantic","flexDirection","width","height","position","top","left","ImageContainer","borderRadius","fill","boxShadow","marginBottom","StyledImage","StyledHeadline","Typography","color","text","lineHeight","StyledSubHeadline","fontSize","letterSpacing","headline","subHeadline","_jsxs","children","_jsx","src","FdLoader","alt","variant"],"mappings":"8KAIA,MAAMA,EAAkBC,EAAAA,OAAO,MAAPA,EAAwC,EAAGC,QAAOC,iBAAY,CAClFC,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBC,WAAYL,EAAMM,QAAQC,SAASF,WAAW,mBAC9CG,cAAe,YACXP,GAAc,CACdQ,MAAO,QACPC,OAAQ,QACRC,SAAU,WACVC,IAAK,EACLC,KAAM,OAIRC,EAAiBf,EAAAA,OAAO,MAAPA,EAAc,EAAGC,YAAO,CAC3CE,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBK,MAAO,QACPC,OAAQ,QACRK,aAAc,OACdV,WAAYL,EAAMM,QAAQC,SAASS,KAAK,cACxCC,UAAW,4GACXC,aAAc,WAGZC,EAAcpB,EAAAA,OAAO,MAAPA,CAAc,CAC9BW,OAAQ,OACRD,MAAO,SAGLW,EAAiBrB,EAAAA,OAAOsB,EAAPtB,EAAmB,EAAGC,YAAO,CAChDsB,MAAOtB,EAAMM,QAAQC,SAASgB,KAAK,gBACnCC,WAAY,MACZN,aAAc,UAGZO,EAAoB1B,EAAAA,OAAOsB,EAAPtB,EAAmB,EAAGC,YAAO,CACnD0B,SAAU,OACVJ,MAAOtB,EAAMM,QAAQC,SAASgB,KAAK,aACnCC,WAAY,MACZG,cAAe,4BASQ,EAAGC,WAAUC,cAAa5B,cAAa,KAE1D6B,EAAAA,KAAChC,EAAe,CAACG,WAAYA,gBAAwB,qBAAoB8B,SAAA,CACrEC,EAAAA,IAAClB,EAAc,CAAAiB,SACXC,EAAAA,IAACb,EAAW,CAACc,IAAKC,EAAUC,IAAI,2BAEpCH,MAACZ,GAAegB,QAAQ,KAAIL,SAAEH,IAC7BC,GAAeG,EAAAA,IAACP,YAAmBI"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../src/components/FlipdishLogoLoader/index.tsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport FdLoader from '../../assets/images/fd-loader.gif';\n\nconst StyledContainer = styled('div')<{ fullscreen?: boolean }>(({ theme, fullscreen }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: theme.palette.semantic.background['background-base'],\n flexDirection: 'column',\n ...(fullscreen && {\n width: '100vw',\n height: '100vh',\n position: 'absolute',\n top: 0,\n left: 0,\n }),\n}));\n\nconst ImageContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '160px',\n height: '160px',\n borderRadius: '80px',\n background: theme.palette.semantic.fill['fill-white'],\n boxShadow:\n '0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)',\n marginBottom: '32px',\n}));\n\nconst StyledImage = styled('img')({\n height: '96px',\n width: '96px',\n});\n\nconst StyledHeadline = styled(Typography)(({ theme }) => ({\n color: theme.palette.semantic.text['text-primary'],\n lineHeight: '1.2',\n marginBottom: '4px',\n}));\n\nconst StyledSubHeadline = styled(Typography)(({ theme }) => ({\n fontSize: '20px',\n color: theme.palette.semantic.text['text-weak'],\n lineHeight: '1.4',\n letterSpacing: 'normal',\n}));\n\ninterface FlipdishLogoLoaderProps {\n headline: string;\n subHeadline?: string;\n fullscreen?: boolean;\n}\n\nconst FlipdishLogoLoader = ({ headline, subHeadline, fullscreen = false }: FlipdishLogoLoaderProps) => {\n return (\n <StyledContainer data-fd=\"FlipdishLogoLoader\" fullscreen={fullscreen}>\n <ImageContainer>\n <StyledImage alt=\"Flipdish Logo Loader\" src={FdLoader} />\n </ImageContainer>\n <StyledHeadline variant=\"h2\">{headline}</StyledHeadline>\n {subHeadline && <StyledSubHeadline>{subHeadline}</StyledSubHeadline>}\n </StyledContainer>\n );\n};\n\nexport default FlipdishLogoLoader;\n"],"names":["StyledContainer","styled","theme","fullscreen","display","alignItems","justifyContent","background","palette","semantic","flexDirection","width","height","position","top","left","ImageContainer","borderRadius","fill","boxShadow","marginBottom","StyledImage","StyledHeadline","Typography","color","text","lineHeight","StyledSubHeadline","fontSize","letterSpacing","headline","subHeadline","_jsxs","children","_jsx","alt","src","FdLoader","variant"],"mappings":"8KAKA,MAAMA,EAAkBC,EAAAA,OAAO,MAAPA,EAAwC,EAAGC,QAAOC,iBAAY,CACpFC,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBC,WAAYL,EAAMM,QAAQC,SAASF,WAAW,mBAC9CG,cAAe,YACXP,GAAc,CAChBQ,MAAO,QACPC,OAAQ,QACRC,SAAU,WACVC,IAAK,EACLC,KAAM,OAIJC,EAAiBf,EAAAA,OAAO,MAAPA,EAAc,EAAGC,YAAO,CAC7CE,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBK,MAAO,QACPC,OAAQ,QACRK,aAAc,OACdV,WAAYL,EAAMM,QAAQC,SAASS,KAAK,cACxCC,UACE,4GACFC,aAAc,WAGVC,EAAcpB,EAAAA,OAAO,MAAPA,CAAc,CAChCW,OAAQ,OACRD,MAAO,SAGHW,EAAiBrB,EAAAA,OAAOsB,EAAPtB,EAAmB,EAAGC,YAAO,CAClDsB,MAAOtB,EAAMM,QAAQC,SAASgB,KAAK,gBACnCC,WAAY,MACZN,aAAc,UAGVO,EAAoB1B,EAAAA,OAAOsB,EAAPtB,EAAmB,EAAGC,YAAO,CACrD0B,SAAU,OACVJ,MAAOtB,EAAMM,QAAQC,SAASgB,KAAK,aACnCC,WAAY,MACZG,cAAe,4BASU,EAAGC,WAAUC,cAAa5B,cAAa,KAE9D6B,EAAAA,KAAChC,EAAe,CAAA,UAAS,qBAAqBG,WAAYA,EAAU8B,SAAA,CAClEC,EAAAA,IAAClB,EAAc,CAAAiB,SACbC,EAAAA,IAACb,EAAW,CAACc,IAAI,uBAAuBC,IAAKC,MAE/CH,MAACZ,GAAegB,QAAQ,KAAIL,SAAEH,IAC7BC,GAAeG,EAAAA,IAACP,YAAmBI"}
@@ -1,10 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
- type FlipdishLogoLoaderProps = {
3
+ interface FlipdishLogoLoaderProps {
4
4
  headline: string;
5
5
  subHeadline?: string;
6
6
  fullscreen?: boolean;
7
- };
7
+ }
8
8
  declare const FlipdishLogoLoader: ({ headline, subHeadline, fullscreen }: FlipdishLogoLoaderProps) => react_jsx_runtime.JSX.Element;
9
9
 
10
10
  export { FlipdishLogoLoader as default };
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{styled as i}from"@mui/material/styles";import a from"../../assets/images/fd-loader.gif.js";import r from"@mui/material/Typography";const l=i("div")((({theme:e,fullscreen:t})=>({display:"flex",alignItems:"center",justifyContent:"center",background:e.palette.semantic.background["background-base"],flexDirection:"column",...t&&{width:"100vw",height:"100vh",position:"absolute",top:0,left:0}}))),o=i("div")((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:"160px",height:"160px",borderRadius:"80px",background:e.palette.semantic.fill["fill-white"],boxShadow:"0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)",marginBottom:"32px"}))),n=i("img")({height:"96px",width:"96px"}),p=i(r)((({theme:e})=>({color:e.palette.semantic.text["text-primary"],lineHeight:"1.2",marginBottom:"4px"}))),m=i(r)((({theme:e})=>({fontSize:"20px",color:e.palette.semantic.text["text-weak"],lineHeight:"1.4",letterSpacing:"normal"}))),s=({headline:i,subHeadline:r,fullscreen:s=!1})=>e(l,{fullscreen:s,"data-testid":"FlipdishLogoLoader",children:[t(o,{children:t(n,{src:a,alt:"Flipdish Logo Loader"})}),t(p,{variant:"h2",children:i}),r&&t(m,{children:r})]});export{s as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{styled as i}from"@mui/material/styles";import a from"@mui/material/Typography";import r from"../../assets/images/fd-loader.gif.js";const l=i("div")((({theme:e,fullscreen:t})=>({display:"flex",alignItems:"center",justifyContent:"center",background:e.palette.semantic.background["background-base"],flexDirection:"column",...t&&{width:"100vw",height:"100vh",position:"absolute",top:0,left:0}}))),o=i("div")((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:"160px",height:"160px",borderRadius:"80px",background:e.palette.semantic.fill["fill-white"],boxShadow:"0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)",marginBottom:"32px"}))),n=i("img")({height:"96px",width:"96px"}),p=i(a)((({theme:e})=>({color:e.palette.semantic.text["text-primary"],lineHeight:"1.2",marginBottom:"4px"}))),m=i(a)((({theme:e})=>({fontSize:"20px",color:e.palette.semantic.text["text-weak"],lineHeight:"1.4",letterSpacing:"normal"}))),s=({headline:i,subHeadline:a,fullscreen:s=!1})=>e(l,{"data-fd":"FlipdishLogoLoader",fullscreen:s,children:[t(o,{children:t(n,{alt:"Flipdish Logo Loader",src:r})}),t(p,{variant:"h2",children:i}),a&&t(m,{children:a})]});export{s as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/FlipdishLogoLoader/index.tsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport FdLoader from '../../assets/images/fd-loader.gif';\nimport Typography from '@mui/material/Typography';\n\nconst StyledContainer = styled('div')<{ fullscreen?: boolean }>(({ theme, fullscreen }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: theme.palette.semantic.background['background-base'],\n flexDirection: 'column',\n ...(fullscreen && {\n width: '100vw',\n height: '100vh',\n position: 'absolute',\n top: 0,\n left: 0,\n }),\n}));\n\nconst ImageContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '160px',\n height: '160px',\n borderRadius: '80px',\n background: theme.palette.semantic.fill['fill-white'],\n boxShadow: '0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)',\n marginBottom: '32px',\n}));\n\nconst StyledImage = styled('img')({\n height: '96px',\n width: '96px',\n});\n\nconst StyledHeadline = styled(Typography)(({ theme }) => ({\n color: theme.palette.semantic.text['text-primary'],\n lineHeight: '1.2',\n marginBottom: '4px',\n}));\n\nconst StyledSubHeadline = styled(Typography)(({ theme }) => ({\n fontSize: '20px',\n color: theme.palette.semantic.text['text-weak'],\n lineHeight: '1.4',\n letterSpacing: 'normal',\n}));\n\ntype FlipdishLogoLoaderProps = {\n headline: string;\n subHeadline?: string;\n fullscreen?: boolean;\n};\n\nconst FlipdishLogoLoader = ({ headline, subHeadline, fullscreen = false }: FlipdishLogoLoaderProps) => {\n return (\n <StyledContainer fullscreen={fullscreen} data-testid=\"FlipdishLogoLoader\">\n <ImageContainer>\n <StyledImage src={FdLoader} alt=\"Flipdish Logo Loader\" />\n </ImageContainer>\n <StyledHeadline variant=\"h2\">{headline}</StyledHeadline>\n {subHeadline && <StyledSubHeadline>{subHeadline}</StyledSubHeadline>}\n </StyledContainer>\n );\n};\n\nexport default FlipdishLogoLoader;\n"],"names":["StyledContainer","styled","theme","fullscreen","display","alignItems","justifyContent","background","palette","semantic","flexDirection","width","height","position","top","left","ImageContainer","borderRadius","fill","boxShadow","marginBottom","StyledImage","StyledHeadline","Typography","color","text","lineHeight","StyledSubHeadline","fontSize","letterSpacing","FlipdishLogoLoader","headline","subHeadline","_jsxs","children","_jsx","src","FdLoader","alt","variant"],"mappings":"4LAIA,MAAMA,EAAkBC,EAAO,MAAPA,EAAwC,EAAGC,QAAOC,iBAAY,CAClFC,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBC,WAAYL,EAAMM,QAAQC,SAASF,WAAW,mBAC9CG,cAAe,YACXP,GAAc,CACdQ,MAAO,QACPC,OAAQ,QACRC,SAAU,WACVC,IAAK,EACLC,KAAM,OAIRC,EAAiBf,EAAO,MAAPA,EAAc,EAAGC,YAAO,CAC3CE,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBK,MAAO,QACPC,OAAQ,QACRK,aAAc,OACdV,WAAYL,EAAMM,QAAQC,SAASS,KAAK,cACxCC,UAAW,4GACXC,aAAc,WAGZC,EAAcpB,EAAO,MAAPA,CAAc,CAC9BW,OAAQ,OACRD,MAAO,SAGLW,EAAiBrB,EAAOsB,EAAPtB,EAAmB,EAAGC,YAAO,CAChDsB,MAAOtB,EAAMM,QAAQC,SAASgB,KAAK,gBACnCC,WAAY,MACZN,aAAc,UAGZO,EAAoB1B,EAAOsB,EAAPtB,EAAmB,EAAGC,YAAO,CACnD0B,SAAU,OACVJ,MAAOtB,EAAMM,QAAQC,SAASgB,KAAK,aACnCC,WAAY,MACZG,cAAe,aASbC,EAAqB,EAAGC,WAAUC,cAAa7B,cAAa,KAE1D8B,EAACjC,EAAe,CAACG,WAAYA,gBAAwB,qBAAoB+B,SAAA,CACrEC,EAACnB,EAAc,CAAAkB,SACXC,EAACd,EAAW,CAACe,IAAKC,EAAUC,IAAI,2BAEpCH,EAACb,GAAeiB,QAAQ,KAAIL,SAAEH,IAC7BC,GAAeG,EAACR,YAAmBK"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/FlipdishLogoLoader/index.tsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport FdLoader from '../../assets/images/fd-loader.gif';\n\nconst StyledContainer = styled('div')<{ fullscreen?: boolean }>(({ theme, fullscreen }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: theme.palette.semantic.background['background-base'],\n flexDirection: 'column',\n ...(fullscreen && {\n width: '100vw',\n height: '100vh',\n position: 'absolute',\n top: 0,\n left: 0,\n }),\n}));\n\nconst ImageContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '160px',\n height: '160px',\n borderRadius: '80px',\n background: theme.palette.semantic.fill['fill-white'],\n boxShadow:\n '0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)',\n marginBottom: '32px',\n}));\n\nconst StyledImage = styled('img')({\n height: '96px',\n width: '96px',\n});\n\nconst StyledHeadline = styled(Typography)(({ theme }) => ({\n color: theme.palette.semantic.text['text-primary'],\n lineHeight: '1.2',\n marginBottom: '4px',\n}));\n\nconst StyledSubHeadline = styled(Typography)(({ theme }) => ({\n fontSize: '20px',\n color: theme.palette.semantic.text['text-weak'],\n lineHeight: '1.4',\n letterSpacing: 'normal',\n}));\n\ninterface FlipdishLogoLoaderProps {\n headline: string;\n subHeadline?: string;\n fullscreen?: boolean;\n}\n\nconst FlipdishLogoLoader = ({ headline, subHeadline, fullscreen = false }: FlipdishLogoLoaderProps) => {\n return (\n <StyledContainer data-fd=\"FlipdishLogoLoader\" fullscreen={fullscreen}>\n <ImageContainer>\n <StyledImage alt=\"Flipdish Logo Loader\" src={FdLoader} />\n </ImageContainer>\n <StyledHeadline variant=\"h2\">{headline}</StyledHeadline>\n {subHeadline && <StyledSubHeadline>{subHeadline}</StyledSubHeadline>}\n </StyledContainer>\n );\n};\n\nexport default FlipdishLogoLoader;\n"],"names":["StyledContainer","styled","theme","fullscreen","display","alignItems","justifyContent","background","palette","semantic","flexDirection","width","height","position","top","left","ImageContainer","borderRadius","fill","boxShadow","marginBottom","StyledImage","StyledHeadline","Typography","color","text","lineHeight","StyledSubHeadline","fontSize","letterSpacing","FlipdishLogoLoader","headline","subHeadline","_jsxs","children","_jsx","alt","src","FdLoader","variant"],"mappings":"4LAKA,MAAMA,EAAkBC,EAAO,MAAPA,EAAwC,EAAGC,QAAOC,iBAAY,CACpFC,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBC,WAAYL,EAAMM,QAAQC,SAASF,WAAW,mBAC9CG,cAAe,YACXP,GAAc,CAChBQ,MAAO,QACPC,OAAQ,QACRC,SAAU,WACVC,IAAK,EACLC,KAAM,OAIJC,EAAiBf,EAAO,MAAPA,EAAc,EAAGC,YAAO,CAC7CE,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBK,MAAO,QACPC,OAAQ,QACRK,aAAc,OACdV,WAAYL,EAAMM,QAAQC,SAASS,KAAK,cACxCC,UACE,4GACFC,aAAc,WAGVC,EAAcpB,EAAO,MAAPA,CAAc,CAChCW,OAAQ,OACRD,MAAO,SAGHW,EAAiBrB,EAAOsB,EAAPtB,EAAmB,EAAGC,YAAO,CAClDsB,MAAOtB,EAAMM,QAAQC,SAASgB,KAAK,gBACnCC,WAAY,MACZN,aAAc,UAGVO,EAAoB1B,EAAOsB,EAAPtB,EAAmB,EAAGC,YAAO,CACrD0B,SAAU,OACVJ,MAAOtB,EAAMM,QAAQC,SAASgB,KAAK,aACnCC,WAAY,MACZG,cAAe,aASXC,EAAqB,EAAGC,WAAUC,cAAa7B,cAAa,KAE9D8B,EAACjC,EAAe,CAAA,UAAS,qBAAqBG,WAAYA,EAAU+B,SAAA,CAClEC,EAACnB,EAAc,CAAAkB,SACbC,EAACd,EAAW,CAACe,IAAI,uBAAuBC,IAAKC,MAE/CH,EAACb,GAAeiB,QAAQ,KAAIL,SAAEH,IAC7BC,GAAeG,EAACR,YAAmBK"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime");require("react");var i=require("@mui/material/Autocomplete"),l=require("@mui/material/CircularProgress"),t=require("@mui/material/TextField"),r=require("@mui/material/Typography"),o=require("formik"),a=require("../../../custom-hooks/useRenderValidText.cjs.js"),n=require("../FormItemLayout/index.cjs.js");const s=({field:r,form:o,fieldName:n,options:s,label:d,variant:u,placeholder:p,getOptionLabel:m,filterOptions:h,isOptionEqualToValue:c,onChange:g,onInputChange:x,onScroll:q,layout:b="horizontal",disabled:v=!1,loading:f=!1,required:j=!1,multiple:T=!1,limitTags:O})=>{const{errors:y,touched:C,isSubmitting:I}=o,V=r.value,E=y[r.name],F=!!E&&C[r.name],P=a({fieldError:E,showError:F,touched:!!C[r.name],value:V},"Valid");return e.jsx(i,{fullWidth:!0,disabled:I||v,filterOptions:h,getOptionLabel:m,isOptionEqualToValue:c,limitTags:T?O??2:void 0,loading:f,multiple:T,onChange:(e,i)=>{o.setFieldValue(n,i),g&&g(e,i)},onInputChange:x,options:s,renderInput:i=>e.jsx(t,{...i,fullWidth:!0,"data-testid":`text-field-${n}`,error:F,helperText:P,label:"standard"===u?void 0:d,placeholder:p||void 0,required:j,slotProps:{input:{...i.InputProps,endAdornment:e.jsxs(e.Fragment,{children:[f&&e.jsx(l,{color:"inherit",size:25}),i.InputProps.endAdornment]})},formHelperText:{children:" ",style:{textAlign:"right"}}},style:{paddingRight:"horizontal"===b?16:0},variant:u}),slotProps:{listbox:{onScroll:q}},value:V||(T?[]:null)})};module.exports=({label:i,fieldName:l,options:t,placeholder:a,getOptionLabel:d,validation:u,onChange:p,onInputChange:m,isOptionEqualToValue:h,onScroll:c,layout:g="horizontal",variant:x="outlined",disabled:q=!1,loading:b=!1,required:v=!1,multiple:f=!1,limitTags:j,filterOptions:T})=>{const O=()=>e.jsx(o.Field,{name:l,validate:u,children:r=>e.jsx(s,{...r,disabled:q,fieldName:l,filterOptions:T,getOptionLabel:d,isOptionEqualToValue:h,label:i,layout:g,limitTags:j,loading:b,multiple:f,onChange:p,onInputChange:m,onScroll:c,options:t,placeholder:a,required:v,variant:x})});return"vertical"===g?e.jsxs(e.Fragment,{children:["standard"===x&&e.jsx(r,{color:"textPrimary",component:"h3",variant:"subtitle1",children:i}),O()]}):e.jsx(n,{label:i,children:O()})};
1
+ "use strict";var e=require("react/jsx-runtime");require("react");var i=require("@mui/material/Autocomplete"),l=require("@mui/material/CircularProgress"),r=require("@mui/material/TextField"),t=require("@mui/material/Typography"),o=require("formik"),a=require("../../../custom-hooks/useRenderValidText.cjs.js"),n=require("../FormItemLayout/index.cjs.js");const s=({field:t,form:o,fieldName:n,options:s,label:d,variant:u,placeholder:p,getOptionLabel:m,filterOptions:h,isOptionEqualToValue:c,onChange:g,onInputChange:x,onScroll:q,layout:b="horizontal",disabled:f=!1,loading:v=!1,required:j=!1,multiple:T=!1,limitTags:O})=>{const{errors:y,touched:C,isSubmitting:I}=o,V=t.value,E=y[t.name],F=!!E&&C[t.name],P=a({fieldError:E,showError:F,touched:!!C[t.name],value:V},"Valid");return e.jsx(i,{fullWidth:!0,disabled:I||f,filterOptions:h,getOptionLabel:m,isOptionEqualToValue:c,limitTags:T?O??2:void 0,loading:v,multiple:T,onChange:(e,i)=>{o.setFieldValue(n,i),g&&g(e,i)},onInputChange:x,options:s,renderInput:i=>e.jsx(r,{...i,fullWidth:!0,"data-fd":`text-field-${n}`,error:F,helperText:P,label:"standard"===u?void 0:d,placeholder:p||void 0,required:j,slotProps:{input:{...i.InputProps,endAdornment:e.jsxs(e.Fragment,{children:[v&&e.jsx(l,{color:"inherit",size:25}),i.InputProps.endAdornment]})},formHelperText:{children:" ",style:{textAlign:"right"}}},style:{paddingRight:"horizontal"===b?16:0},variant:u}),slotProps:{listbox:{onScroll:q}},value:V||(T?[]:null)})};module.exports=({label:i,fieldName:l,options:r,placeholder:a,getOptionLabel:d,validation:u,onChange:p,onInputChange:m,isOptionEqualToValue:h,onScroll:c,layout:g="horizontal",variant:x="outlined",disabled:q=!1,loading:b=!1,required:f=!1,multiple:v=!1,limitTags:j,filterOptions:T})=>{const O=()=>e.jsx(o.Field,{name:l,validate:u,children:t=>e.jsx(s,{...t,disabled:q,fieldName:l,filterOptions:T,getOptionLabel:d,isOptionEqualToValue:h,label:i,layout:g,limitTags:j,loading:b,multiple:v,onChange:p,onInputChange:m,onScroll:c,options:r,placeholder:a,required:f,variant:x})});return"vertical"===g?e.jsxs(e.Fragment,{children:["standard"===x&&e.jsx(t,{color:"textPrimary",component:"h3",variant:"subtitle1",children:i}),O()]}):e.jsx(n,{label:i,children:O()})};
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/Form/GenericAutocompleteField/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { type SyntheticEvent } from 'react';\n\nimport Autocomplete from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport TextField, { type TextFieldProps } from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { Field, type FieldProps } from 'formik';\n\nimport useRenderValidText from '../../../custom-hooks/useRenderValidText';\nimport FormItemLayout from '../FormItemLayout';\n\nexport interface Props<T> {\n label: string;\n fieldName: string;\n options: T[];\n placeholder?: string;\n getOptionLabel?: (option: T) => string;\n validation?: (value: T | T[]) => string | undefined;\n onChange?: (e: SyntheticEvent, value: T | T[] | null) => void;\n onInputChange?: (e: SyntheticEvent, value: string) => void;\n isOptionEqualToValue?: (option: T, value: T) => boolean;\n onScroll?: (e: React.UIEvent<HTMLUListElement, UIEvent>) => void;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n loading?: boolean;\n required?: boolean;\n multiple?: boolean;\n limitTags?: number;\n filterOptions?: (options: T[]) => T[];\n}\n\ninterface AutocompleteFieldProps<T> {\n field: FieldProps['field'];\n form: FieldProps['form'];\n fieldName: string;\n // this prop overrides the default filter options\n filterOptions?: (options: T[]) => T[];\n options: T[];\n label: string;\n variant: TextFieldProps['variant'];\n placeholder?: string;\n getOptionLabel?: (option: T) => string;\n isOptionEqualToValue?: (option: T, value: T) => boolean;\n onChange?: (e: SyntheticEvent, value: T | T[] | null) => void;\n onInputChange?: (e: SyntheticEvent, value: string) => void;\n onScroll?: (e: React.UIEvent<HTMLUListElement, UIEvent>) => void;\n layout?: 'horizontal' | 'vertical';\n disabled?: boolean;\n loading?: boolean;\n required?: boolean;\n multiple?: boolean;\n limitTags?: number;\n}\n\nconst AutocompleteFieldComponent = <T,>({\n field,\n form,\n fieldName,\n options,\n label,\n variant,\n placeholder,\n getOptionLabel,\n filterOptions,\n isOptionEqualToValue,\n onChange,\n onInputChange,\n onScroll,\n layout = 'horizontal',\n disabled = false,\n loading = false,\n required = false,\n multiple = false,\n limitTags,\n}: AutocompleteFieldProps<T>): JSX.Element => {\n const { errors, touched, isSubmitting } = form;\n const fieldValue = field.value as T | T[] | null;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText(\n {\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: fieldValue as string,\n },\n 'Valid',\n );\n\n return (\n <Autocomplete\n fullWidth\n disabled={isSubmitting || disabled}\n filterOptions={filterOptions}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n limitTags={multiple ? (limitTags ?? 2) : undefined}\n loading={loading}\n multiple={multiple}\n onChange={(e: SyntheticEvent<Element, Event>, value: T | T[] | null) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(fieldName, value);\n if (onChange) {\n onChange(e, value);\n }\n }}\n onInputChange={onInputChange}\n options={options}\n renderInput={(params) => (\n <TextField\n {...params}\n fullWidth\n data-testid={`text-field-${fieldName}`}\n error={showError}\n helperText={helperText}\n label={variant === 'standard' ? undefined : label}\n placeholder={placeholder || undefined}\n required={required}\n slotProps={{\n input: {\n ...params.InputProps,\n endAdornment: (\n <>\n {loading && <CircularProgress color=\"inherit\" size={25} />}\n {params.InputProps.endAdornment}\n </>\n ),\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n variant={variant}\n />\n )}\n slotProps={{\n listbox: {\n onScroll,\n },\n }}\n value={fieldValue || (multiple ? [] : null)}\n />\n );\n};\n\nconst GenericAutocompleteField = <T,>({\n label,\n fieldName,\n options,\n placeholder,\n getOptionLabel,\n validation,\n onChange,\n onInputChange,\n isOptionEqualToValue,\n onScroll,\n layout = 'horizontal',\n variant = 'outlined',\n disabled = false,\n loading = false,\n required = false,\n multiple = false,\n limitTags = undefined,\n filterOptions,\n}: Props<T>): JSX.Element => {\n const renderField = (): React.ReactNode => {\n return (\n <Field name={fieldName} validate={validation}>\n {(fieldProps: FieldProps) => (\n <AutocompleteFieldComponent<T>\n {...fieldProps}\n disabled={disabled}\n fieldName={fieldName}\n filterOptions={filterOptions}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n label={label}\n layout={layout}\n limitTags={limitTags}\n loading={loading}\n multiple={multiple}\n onChange={onChange}\n onInputChange={onInputChange}\n onScroll={onScroll}\n options={options}\n placeholder={placeholder}\n required={required}\n variant={variant}\n />\n )}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography color=\"textPrimary\" component=\"h3\" variant=\"subtitle1\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericAutocompleteField;\n"],"names":["AutocompleteFieldComponent","field","form","fieldName","options","label","variant","placeholder","getOptionLabel","filterOptions","isOptionEqualToValue","onChange","onInputChange","onScroll","layout","disabled","loading","required","multiple","limitTags","errors","touched","isSubmitting","fieldValue","value","fieldError","name","showError","helperText","useRenderValidText","_jsx","Autocomplete","fullWidth","undefined","e","setFieldValue","renderInput","params","TextField","error","slotProps","input","InputProps","endAdornment","_jsxs","_Fragment","children","CircularProgress","color","size","formHelperText","style","textAlign","paddingRight","listbox","validation","renderField","Field","validate","fieldProps","Typography","component","FormItemLayout"],"mappings":"iWAyDA,MAAMA,EAA6B,EACjCC,QACAC,OACAC,YACAC,UACAC,QACAC,UACAC,cACAC,iBACAC,gBACAC,uBACAC,WACAC,gBACAC,WACAC,SAAS,aACTC,YAAW,EACXC,WAAU,EACVC,YAAW,EACXC,YAAW,EACXC,gBAEA,MAAMC,OAAEA,EAAMC,QAAEA,EAAOC,aAAEA,GAAiBpB,EACpCqB,EAAatB,EAAMuB,MACnBC,EAAaL,EAAOnB,EAAMyB,MAC1BC,IAAcF,GAAeJ,EAAQpB,EAAMyB,MAC3CE,EAAaC,EACjB,CACEJ,aACAE,YACAN,UAAWA,EAAQpB,EAAMyB,MACzBF,MAAOD,GAET,SAGF,OACEO,EAAAA,IAACC,EAAY,CACXC,aACAjB,SAAUO,GAAgBP,EAC1BN,cAAeA,EACfD,eAAgBA,EAChBE,qBAAsBA,EACtBS,UAAWD,EAAYC,GAAa,OAAKc,EACzCjB,QAASA,EACTE,SAAUA,EACVP,SAAU,CAACuB,EAAmCV,KAE5CtB,EAAKiC,cAAchC,EAAWqB,GAC1Bb,GACFA,EAASuB,EAAGV,IAGhBZ,cAAeA,EACfR,QAASA,EACTgC,YAAcC,GACZP,EAAAA,IAACQ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,IAACgC,EAAc,CAACzD,MAAOA,EAAKyC,SAAGU"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/Form/GenericAutocompleteField/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { type SyntheticEvent } from 'react';\n\nimport Autocomplete from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport TextField, { type TextFieldProps } from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { Field, type FieldProps } from 'formik';\n\nimport useRenderValidText from '../../../custom-hooks/useRenderValidText';\nimport FormItemLayout from '../FormItemLayout';\n\nexport interface Props<T> {\n label: string;\n fieldName: string;\n options: T[];\n placeholder?: string;\n getOptionLabel?: (option: T) => string;\n validation?: (value: T | T[]) => string | undefined;\n onChange?: (e: SyntheticEvent, value: T | T[] | null) => void;\n onInputChange?: (e: SyntheticEvent, value: string) => void;\n isOptionEqualToValue?: (option: T, value: T) => boolean;\n onScroll?: (e: React.UIEvent<HTMLUListElement, UIEvent>) => void;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n loading?: boolean;\n required?: boolean;\n multiple?: boolean;\n limitTags?: number;\n filterOptions?: (options: T[]) => T[];\n}\n\ninterface AutocompleteFieldProps<T> {\n field: FieldProps['field'];\n form: FieldProps['form'];\n fieldName: string;\n // this prop overrides the default filter options\n filterOptions?: (options: T[]) => T[];\n options: T[];\n label: string;\n variant: TextFieldProps['variant'];\n placeholder?: string;\n getOptionLabel?: (option: T) => string;\n isOptionEqualToValue?: (option: T, value: T) => boolean;\n onChange?: (e: SyntheticEvent, value: T | T[] | null) => void;\n onInputChange?: (e: SyntheticEvent, value: string) => void;\n onScroll?: (e: React.UIEvent<HTMLUListElement, UIEvent>) => void;\n layout?: 'horizontal' | 'vertical';\n disabled?: boolean;\n loading?: boolean;\n required?: boolean;\n multiple?: boolean;\n limitTags?: number;\n}\n\nconst AutocompleteFieldComponent = <T,>({\n field,\n form,\n fieldName,\n options,\n label,\n variant,\n placeholder,\n getOptionLabel,\n filterOptions,\n isOptionEqualToValue,\n onChange,\n onInputChange,\n onScroll,\n layout = 'horizontal',\n disabled = false,\n loading = false,\n required = false,\n multiple = false,\n limitTags,\n}: AutocompleteFieldProps<T>): JSX.Element => {\n const { errors, touched, isSubmitting } = form;\n const fieldValue = field.value as T | T[] | null;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText(\n {\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: fieldValue as string,\n },\n 'Valid',\n );\n\n return (\n <Autocomplete\n fullWidth\n disabled={isSubmitting || disabled}\n filterOptions={filterOptions}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n limitTags={multiple ? (limitTags ?? 2) : undefined}\n loading={loading}\n multiple={multiple}\n onChange={(e: SyntheticEvent<Element, Event>, value: T | T[] | null) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(fieldName, value);\n if (onChange) {\n onChange(e, value);\n }\n }}\n onInputChange={onInputChange}\n options={options}\n renderInput={(params) => (\n <TextField\n {...params}\n fullWidth\n data-fd={`text-field-${fieldName}`}\n error={showError}\n helperText={helperText}\n label={variant === 'standard' ? undefined : label}\n placeholder={placeholder || undefined}\n required={required}\n slotProps={{\n input: {\n ...params.InputProps,\n endAdornment: (\n <>\n {loading && <CircularProgress color=\"inherit\" size={25} />}\n {params.InputProps.endAdornment}\n </>\n ),\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n variant={variant}\n />\n )}\n slotProps={{\n listbox: {\n onScroll,\n },\n }}\n value={fieldValue || (multiple ? [] : null)}\n />\n );\n};\n\nconst GenericAutocompleteField = <T,>({\n label,\n fieldName,\n options,\n placeholder,\n getOptionLabel,\n validation,\n onChange,\n onInputChange,\n isOptionEqualToValue,\n onScroll,\n layout = 'horizontal',\n variant = 'outlined',\n disabled = false,\n loading = false,\n required = false,\n multiple = false,\n limitTags = undefined,\n filterOptions,\n}: Props<T>): JSX.Element => {\n const renderField = (): React.ReactNode => {\n return (\n <Field name={fieldName} validate={validation}>\n {(fieldProps: FieldProps) => (\n <AutocompleteFieldComponent<T>\n {...fieldProps}\n disabled={disabled}\n fieldName={fieldName}\n filterOptions={filterOptions}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n label={label}\n layout={layout}\n limitTags={limitTags}\n loading={loading}\n multiple={multiple}\n onChange={onChange}\n onInputChange={onInputChange}\n onScroll={onScroll}\n options={options}\n placeholder={placeholder}\n required={required}\n variant={variant}\n />\n )}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography color=\"textPrimary\" component=\"h3\" variant=\"subtitle1\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericAutocompleteField;\n"],"names":["AutocompleteFieldComponent","field","form","fieldName","options","label","variant","placeholder","getOptionLabel","filterOptions","isOptionEqualToValue","onChange","onInputChange","onScroll","layout","disabled","loading","required","multiple","limitTags","errors","touched","isSubmitting","fieldValue","value","fieldError","name","showError","helperText","useRenderValidText","_jsx","Autocomplete","fullWidth","undefined","e","setFieldValue","renderInput","params","TextField","error","slotProps","input","InputProps","endAdornment","_jsxs","_Fragment","children","CircularProgress","color","size","formHelperText","style","textAlign","paddingRight","listbox","validation","renderField","Field","validate","fieldProps","Typography","component","FormItemLayout"],"mappings":"iWAyDA,MAAMA,EAA6B,EACjCC,QACAC,OACAC,YACAC,UACAC,QACAC,UACAC,cACAC,iBACAC,gBACAC,uBACAC,WACAC,gBACAC,WACAC,SAAS,aACTC,YAAW,EACXC,WAAU,EACVC,YAAW,EACXC,YAAW,EACXC,gBAEA,MAAMC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AAM+C,EAAc,IAEhB1B,MAAC2B,EAAAA,MAAK,CAAC/B,KAAMvB,EAAWuD,SAAUH,EAAUT,SACxCa,GACA7B,EAAAA,IAAC9B,EAA0B,IACrB2D,EACJ5C,SAAUA,EACVZ,UAAWA,EACXM,cAAeA,EACfD,eAAgBA,EAChBE,qBAAsBA,EACtBL,MAAOA,EACPS,OAAQA,EACRK,UAAWA,EACXH,QAASA,EACTE,SAAUA,EACVP,SAAUA,EACVC,cAAeA,EACfC,SAAUA,EACVT,QAASA,EACTG,YAAaA,EACbU,SAAUA,EACVX,QAASA,MAOnB,MAAe,aAAXQ,EAEA8B,EAAAA,KAAAC,WAAA,CAAAC,SAAA,CACe,aAAZxC,GACCwB,EAAAA,IAAC8B,EAAU,CAACZ,MAAM,cAAca,UAAU,KAAKvD,QAAQ,YAAWwC,SAC/DzC,IAGJmD,OAKA1B,EAAAA,IAACgC,EAAc,CAACzD,MAAOA,EAAKyC,SAAGU"}
@@ -1,2 +1,2 @@
1
- import{jsxs as e,Fragment as i,jsx as t}from"react/jsx-runtime";import"react";import o from"@mui/material/Autocomplete";import l from"@mui/material/CircularProgress";import r from"@mui/material/TextField";import a from"@mui/material/Typography";import{Field as n}from"formik";import d from"../../../custom-hooks/useRenderValidText.js";import m from"../FormItemLayout/index.js";const p=({field:a,form:n,fieldName:m,options:p,label:u,variant:s,placeholder:h,getOptionLabel:c,filterOptions:g,isOptionEqualToValue:f,onChange:b,onInputChange:v,onScroll:T,layout:O="horizontal",disabled:x=!1,loading:y=!1,required:C=!1,multiple:q=!1,limitTags:I})=>{const{errors:V,touched:E,isSubmitting:P}=n,L=a.value,S=V[a.name],z=!!S&&E[a.name],A=d({fieldError:S,showError:z,touched:!!E[a.name],value:L},"Valid");return t(o,{fullWidth:!0,disabled:P||x,filterOptions:g,getOptionLabel:c,isOptionEqualToValue:f,limitTags:q?I??2:void 0,loading:y,multiple:q,onChange:(e,i)=>{n.setFieldValue(m,i),b&&b(e,i)},onInputChange:v,options:p,renderInput:o=>t(r,{...o,fullWidth:!0,"data-testid":`text-field-${m}`,error:z,helperText:A,label:"standard"===s?void 0:u,placeholder:h||void 0,required:C,slotProps:{input:{...o.InputProps,endAdornment:e(i,{children:[y&&t(l,{color:"inherit",size:25}),o.InputProps.endAdornment]})},formHelperText:{children:" ",style:{textAlign:"right"}}},style:{paddingRight:"horizontal"===O?16:0},variant:s}),slotProps:{listbox:{onScroll:T}},value:L||(q?[]:null)})},u=({label:o,fieldName:l,options:r,placeholder:d,getOptionLabel:u,validation:s,onChange:h,onInputChange:c,isOptionEqualToValue:g,onScroll:f,layout:b="horizontal",variant:v="outlined",disabled:T=!1,loading:O=!1,required:x=!1,multiple:y=!1,limitTags:C,filterOptions:q})=>{const I=()=>t(n,{name:l,validate:s,children:e=>t(p,{...e,disabled:T,fieldName:l,filterOptions:q,getOptionLabel:u,isOptionEqualToValue:g,label:o,layout:b,limitTags:C,loading:O,multiple:y,onChange:h,onInputChange:c,onScroll:f,options:r,placeholder:d,required:x,variant:v})});return"vertical"===b?e(i,{children:["standard"===v&&t(a,{color:"textPrimary",component:"h3",variant:"subtitle1",children:o}),I()]}):t(m,{label:o,children:I()})};export{u as default};
1
+ import{jsxs as e,Fragment as i,jsx as o}from"react/jsx-runtime";import"react";import l from"@mui/material/Autocomplete";import t from"@mui/material/CircularProgress";import r from"@mui/material/TextField";import a from"@mui/material/Typography";import{Field as n}from"formik";import d from"../../../custom-hooks/useRenderValidText.js";import m from"../FormItemLayout/index.js";const p=({field:a,form:n,fieldName:m,options:p,label:u,variant:s,placeholder:h,getOptionLabel:c,filterOptions:g,isOptionEqualToValue:f,onChange:b,onInputChange:v,onScroll:T,layout:O="horizontal",disabled:x=!1,loading:y=!1,required:C=!1,multiple:q=!1,limitTags:I})=>{const{errors:V,touched:E,isSubmitting:P}=n,L=a.value,S=V[a.name],z=!!S&&E[a.name],A=d({fieldError:S,showError:z,touched:!!E[a.name],value:L},"Valid");return o(l,{fullWidth:!0,disabled:P||x,filterOptions:g,getOptionLabel:c,isOptionEqualToValue:f,limitTags:q?I??2:void 0,loading:y,multiple:q,onChange:(e,i)=>{n.setFieldValue(m,i),b&&b(e,i)},onInputChange:v,options:p,renderInput:l=>o(r,{...l,fullWidth:!0,"data-fd":`text-field-${m}`,error:z,helperText:A,label:"standard"===s?void 0:u,placeholder:h||void 0,required:C,slotProps:{input:{...l.InputProps,endAdornment:e(i,{children:[y&&o(t,{color:"inherit",size:25}),l.InputProps.endAdornment]})},formHelperText:{children:" ",style:{textAlign:"right"}}},style:{paddingRight:"horizontal"===O?16:0},variant:s}),slotProps:{listbox:{onScroll:T}},value:L||(q?[]:null)})},u=({label:l,fieldName:t,options:r,placeholder:d,getOptionLabel:u,validation:s,onChange:h,onInputChange:c,isOptionEqualToValue:g,onScroll:f,layout:b="horizontal",variant:v="outlined",disabled:T=!1,loading:O=!1,required:x=!1,multiple:y=!1,limitTags:C,filterOptions:q})=>{const I=()=>o(n,{name:t,validate:s,children:e=>o(p,{...e,disabled:T,fieldName:t,filterOptions:q,getOptionLabel:u,isOptionEqualToValue:g,label:l,layout:b,limitTags:C,loading:O,multiple:y,onChange:h,onInputChange:c,onScroll:f,options:r,placeholder:d,required:x,variant:v})});return"vertical"===b?e(i,{children:["standard"===v&&o(a,{color:"textPrimary",component:"h3",variant:"subtitle1",children:l}),I()]}):o(m,{label:l,children:I()})};export{u as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Form/GenericAutocompleteField/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { type SyntheticEvent } from 'react';\n\nimport Autocomplete from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport TextField, { type TextFieldProps } from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { Field, type FieldProps } from 'formik';\n\nimport useRenderValidText from '../../../custom-hooks/useRenderValidText';\nimport FormItemLayout from '../FormItemLayout';\n\nexport interface Props<T> {\n label: string;\n fieldName: string;\n options: T[];\n placeholder?: string;\n getOptionLabel?: (option: T) => string;\n validation?: (value: T | T[]) => string | undefined;\n onChange?: (e: SyntheticEvent, value: T | T[] | null) => void;\n onInputChange?: (e: SyntheticEvent, value: string) => void;\n isOptionEqualToValue?: (option: T, value: T) => boolean;\n onScroll?: (e: React.UIEvent<HTMLUListElement, UIEvent>) => void;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n loading?: boolean;\n required?: boolean;\n multiple?: boolean;\n limitTags?: number;\n filterOptions?: (options: T[]) => T[];\n}\n\ninterface AutocompleteFieldProps<T> {\n field: FieldProps['field'];\n form: FieldProps['form'];\n fieldName: string;\n // this prop overrides the default filter options\n filterOptions?: (options: T[]) => T[];\n options: T[];\n label: string;\n variant: TextFieldProps['variant'];\n placeholder?: string;\n getOptionLabel?: (option: T) => string;\n isOptionEqualToValue?: (option: T, value: T) => boolean;\n onChange?: (e: SyntheticEvent, value: T | T[] | null) => void;\n onInputChange?: (e: SyntheticEvent, value: string) => void;\n onScroll?: (e: React.UIEvent<HTMLUListElement, UIEvent>) => void;\n layout?: 'horizontal' | 'vertical';\n disabled?: boolean;\n loading?: boolean;\n required?: boolean;\n multiple?: boolean;\n limitTags?: number;\n}\n\nconst AutocompleteFieldComponent = <T,>({\n field,\n form,\n fieldName,\n options,\n label,\n variant,\n placeholder,\n getOptionLabel,\n filterOptions,\n isOptionEqualToValue,\n onChange,\n onInputChange,\n onScroll,\n layout = 'horizontal',\n disabled = false,\n loading = false,\n required = false,\n multiple = false,\n limitTags,\n}: AutocompleteFieldProps<T>): JSX.Element => {\n const { errors, touched, isSubmitting } = form;\n const fieldValue = field.value as T | T[] | null;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText(\n {\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: fieldValue as string,\n },\n 'Valid',\n );\n\n return (\n <Autocomplete\n fullWidth\n disabled={isSubmitting || disabled}\n filterOptions={filterOptions}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n limitTags={multiple ? (limitTags ?? 2) : undefined}\n loading={loading}\n multiple={multiple}\n onChange={(e: SyntheticEvent<Element, Event>, value: T | T[] | null) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(fieldName, value);\n if (onChange) {\n onChange(e, value);\n }\n }}\n onInputChange={onInputChange}\n options={options}\n renderInput={(params) => (\n <TextField\n {...params}\n fullWidth\n data-testid={`text-field-${fieldName}`}\n error={showError}\n helperText={helperText}\n label={variant === 'standard' ? undefined : label}\n placeholder={placeholder || undefined}\n required={required}\n slotProps={{\n input: {\n ...params.InputProps,\n endAdornment: (\n <>\n {loading && <CircularProgress color=\"inherit\" size={25} />}\n {params.InputProps.endAdornment}\n </>\n ),\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n variant={variant}\n />\n )}\n slotProps={{\n listbox: {\n onScroll,\n },\n }}\n value={fieldValue || (multiple ? [] : null)}\n />\n );\n};\n\nconst GenericAutocompleteField = <T,>({\n label,\n fieldName,\n options,\n placeholder,\n getOptionLabel,\n validation,\n onChange,\n onInputChange,\n isOptionEqualToValue,\n onScroll,\n layout = 'horizontal',\n variant = 'outlined',\n disabled = false,\n loading = false,\n required = false,\n multiple = false,\n limitTags = undefined,\n filterOptions,\n}: Props<T>): JSX.Element => {\n const renderField = (): React.ReactNode => {\n return (\n <Field name={fieldName} validate={validation}>\n {(fieldProps: FieldProps) => (\n <AutocompleteFieldComponent<T>\n {...fieldProps}\n disabled={disabled}\n fieldName={fieldName}\n filterOptions={filterOptions}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n label={label}\n layout={layout}\n limitTags={limitTags}\n loading={loading}\n multiple={multiple}\n onChange={onChange}\n onInputChange={onInputChange}\n onScroll={onScroll}\n options={options}\n placeholder={placeholder}\n required={required}\n variant={variant}\n />\n )}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography color=\"textPrimary\" component=\"h3\" variant=\"subtitle1\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericAutocompleteField;\n"],"names":["AutocompleteFieldComponent","field","form","fieldName","options","label","variant","placeholder","getOptionLabel","filterOptions","isOptionEqualToValue","onChange","onInputChange","onScroll","layout","disabled","loading","required","multiple","limitTags","errors","touched","isSubmitting","fieldValue","value","fieldError","name","showError","helperText","useRenderValidText","_jsx","Autocomplete","fullWidth","undefined","e","setFieldValue","renderInput","params","TextField","error","slotProps","input","InputProps","endAdornment","_jsxs","_Fragment","children","CircularProgress","color","size","formHelperText","style","textAlign","paddingRight","listbox","GenericAutocompleteField","validation","renderField","Field","validate","fieldProps","Typography","component","FormItemLayout"],"mappings":"yXAyDA,MAAMA,EAA6B,EACjCC,QACAC,OACAC,YACAC,UACAC,QACAC,UACAC,cACAC,iBACAC,gBACAC,uBACAC,WACAC,gBACAC,WACAC,SAAS,aACTC,YAAW,EACXC,WAAU,EACVC,YAAW,EACXC,YAAW,EACXC,gBAEA,MAAMC,OAAEA,EAAMC,QAAEA,EAAOC,aAAEA,GAAiBpB,EACpCqB,EAAatB,EAAMuB,MACnBC,EAAaL,EAAOnB,EAAMyB,MAC1BC,IAAcF,GAAeJ,EAAQpB,EAAMyB,MAC3CE,EAAaC,EACjB,CACEJ,aACAE,YACAN,UAAWA,EAAQpB,EAAMyB,MACzBF,MAAOD,GAET,SAGF,OACEO,EAACC,EAAY,CACXC,aACAjB,SAAUO,GAAgBP,EAC1BN,cAAeA,EACfD,eAAgBA,EAChBE,qBAAsBA,EACtBS,UAAWD,EAAYC,GAAa,OAAKc,EACzCjB,QAAS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AC,SAAA,CACe,aAAZxC,GACCwB,EAAC+B,EAAU,CAACb,MAAM,cAAcc,UAAU,KAAKxD,QAAQ,YAAWwC,SAC/DzC,IAGJoD,OAKA3B,EAACiC,EAAc,CAAC1D,MAAOA,EAAKyC,SAAGW"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Form/GenericAutocompleteField/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { type SyntheticEvent } from 'react';\n\nimport Autocomplete from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport TextField, { type TextFieldProps } from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { Field, type FieldProps } from 'formik';\n\nimport useRenderValidText from '../../../custom-hooks/useRenderValidText';\nimport FormItemLayout from '../FormItemLayout';\n\nexport interface Props<T> {\n label: string;\n fieldName: string;\n options: T[];\n placeholder?: string;\n getOptionLabel?: (option: T) => string;\n validation?: (value: T | T[]) => string | undefined;\n onChange?: (e: SyntheticEvent, value: T | T[] | null) => void;\n onInputChange?: (e: SyntheticEvent, value: string) => void;\n isOptionEqualToValue?: (option: T, value: T) => boolean;\n onScroll?: (e: React.UIEvent<HTMLUListElement, UIEvent>) => void;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n loading?: boolean;\n required?: boolean;\n multiple?: boolean;\n limitTags?: number;\n filterOptions?: (options: T[]) => T[];\n}\n\ninterface AutocompleteFieldProps<T> {\n field: FieldProps['field'];\n form: FieldProps['form'];\n fieldName: string;\n // this prop overrides the default filter options\n filterOptions?: (options: T[]) => T[];\n options: T[];\n label: string;\n variant: TextFieldProps['variant'];\n placeholder?: string;\n getOptionLabel?: (option: T) => string;\n isOptionEqualToValue?: (option: T, value: T) => boolean;\n onChange?: (e: SyntheticEvent, value: T | T[] | null) => void;\n onInputChange?: (e: SyntheticEvent, value: string) => void;\n onScroll?: (e: React.UIEvent<HTMLUListElement, UIEvent>) => void;\n layout?: 'horizontal' | 'vertical';\n disabled?: boolean;\n loading?: boolean;\n required?: boolean;\n multiple?: boolean;\n limitTags?: number;\n}\n\nconst AutocompleteFieldComponent = <T,>({\n field,\n form,\n fieldName,\n options,\n label,\n variant,\n placeholder,\n getOptionLabel,\n filterOptions,\n isOptionEqualToValue,\n onChange,\n onInputChange,\n onScroll,\n layout = 'horizontal',\n disabled = false,\n loading = false,\n required = false,\n multiple = false,\n limitTags,\n}: AutocompleteFieldProps<T>): JSX.Element => {\n const { errors, touched, isSubmitting } = form;\n const fieldValue = field.value as T | T[] | null;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText(\n {\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: fieldValue as string,\n },\n 'Valid',\n );\n\n return (\n <Autocomplete\n fullWidth\n disabled={isSubmitting || disabled}\n filterOptions={filterOptions}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n limitTags={multiple ? (limitTags ?? 2) : undefined}\n loading={loading}\n multiple={multiple}\n onChange={(e: SyntheticEvent<Element, Event>, value: T | T[] | null) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(fieldName, value);\n if (onChange) {\n onChange(e, value);\n }\n }}\n onInputChange={onInputChange}\n options={options}\n renderInput={(params) => (\n <TextField\n {...params}\n fullWidth\n data-fd={`text-field-${fieldName}`}\n error={showError}\n helperText={helperText}\n label={variant === 'standard' ? undefined : label}\n placeholder={placeholder || undefined}\n required={required}\n slotProps={{\n input: {\n ...params.InputProps,\n endAdornment: (\n <>\n {loading && <CircularProgress color=\"inherit\" size={25} />}\n {params.InputProps.endAdornment}\n </>\n ),\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n variant={variant}\n />\n )}\n slotProps={{\n listbox: {\n onScroll,\n },\n }}\n value={fieldValue || (multiple ? [] : null)}\n />\n );\n};\n\nconst GenericAutocompleteField = <T,>({\n label,\n fieldName,\n options,\n placeholder,\n getOptionLabel,\n validation,\n onChange,\n onInputChange,\n isOptionEqualToValue,\n onScroll,\n layout = 'horizontal',\n variant = 'outlined',\n disabled = false,\n loading = false,\n required = false,\n multiple = false,\n limitTags = undefined,\n filterOptions,\n}: Props<T>): JSX.Element => {\n const renderField = (): React.ReactNode => {\n return (\n <Field name={fieldName} validate={validation}>\n {(fieldProps: FieldProps) => (\n <AutocompleteFieldComponent<T>\n {...fieldProps}\n disabled={disabled}\n fieldName={fieldName}\n filterOptions={filterOptions}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n label={label}\n layout={layout}\n limitTags={limitTags}\n loading={loading}\n multiple={multiple}\n onChange={onChange}\n onInputChange={onInputChange}\n onScroll={onScroll}\n options={options}\n placeholder={placeholder}\n required={required}\n variant={variant}\n />\n )}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography color=\"textPrimary\" component=\"h3\" variant=\"subtitle1\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericAutocompleteField;\n"],"names":["AutocompleteFieldComponent","field","form","fieldName","options","label","variant","placeholder","getOptionLabel","filterOptions","isOptionEqualToValue","onChange","onInputChange","onScroll","layout","disabled","loading","required","multiple","limitTags","errors","touched","isSubmitting","fieldValue","value","fieldError","name","showError","helperText","useRenderValidText","_jsx","Autocomplete","fullWidth","undefined","e","setFieldValue","renderInput","params","TextField","error","slotProps","input","InputProps","endAdornment","_jsxs","_Fragment","children","CircularProgress","color","size","formHelperText","style","textAlign","paddingRight","listbox","GenericAutocompleteField","validation","renderField","Field","validate","fieldProps","Typography","component","FormItemLayout"],"mappings":"yXAyDA,MAAMA,EAA6B,EACjCC,QACAC,OACAC,YACAC,UACAC,QACA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C,gBACAF,uBACAG,WACAC,SAAS,aACTR,UAAU,WACVS,YAAW,EACXC,WAAU,EACVC,YAAW,EACXC,YAAW,EACXC,YACAV,oBAEA,MAAMgD,EAAc,IAEhB3B,EAAC4B,EAAK,CAAChC,KAAMvB,EAAWwD,SAAUH,EAAUV,SACxCc,GACA9B,EAAC9B,EAA0B,IACrB4D,EACJ7C,SAAUA,EACVZ,UAAWA,EACXM,cAAeA,EACfD,eAAgBA,EAChBE,qBAAsBA,EACtBL,MAAOA,EACPS,OAAQA,EACRK,UAAWA,EACXH,QAASA,EACTE,SAAUA,EACVP,SAAUA,EACVC,cAAeA,EACfC,SAAUA,EACVT,QAASA,EACTG,YAAaA,EACbU,SAAUA,EACVX,QAASA,MAOnB,MAAe,aAAXQ,EAEA8B,EAAAC,EAAA,CAAAC,SAAA,CACe,aAAZxC,GACCwB,EAAC+B,EAAU,CAACb,MAAM,cAAcc,UAAU,KAAKxD,QAAQ,YAAWwC,SAC/DzC,IAGJoD,OAKA3B,EAACiC,EAAc,CAAC1D,MAAOA,EAAKyC,SAAGW"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/Button"),t=require("formik");module.exports=({fields:r,onSubmit:a,handleError:n,submitButtonText:u})=>{const s=r.reduce(((e,i)=>(e[i.fieldName]=i.defaultValue,e)),{});return e.jsx(t.Formik,{initialValues:s,onSubmit:async e=>{try{await a(e)}catch(e){n&&n(e)}},children:({isSubmitting:a})=>e.jsxs(t.Form,{children:[r.map(((i,t)=>e.jsx("div",{children:i.component},`field_${i.fieldName}_${t}`))),e.jsx(i,{"data-testid":"submit-form-button",disabled:a,sx:{marginTop:4},type:"submit",variant:"contained",children:u})]})})};
1
+ "use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/Button"),t=require("formik");module.exports=({fields:r,onSubmit:a,handleError:n,submitButtonText:u})=>{const m=r.reduce(((e,i)=>(e[i.fieldName]=i.defaultValue,e)),{});return e.jsx(t.Formik,{initialValues:m,onSubmit:async e=>{try{await a(e)}catch(e){n&&n(e)}},children:({isSubmitting:a})=>e.jsxs(t.Form,{children:[r.map(((i,t)=>e.jsx("div",{children:i.component},`field_${i.fieldName}_${t}`))),e.jsx(i,{"data-fd":"submit-form-button",disabled:a,sx:{marginTop:4},type:"submit",variant:"contained",children:u})]})})};
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/Form/GenericFormContainer/index.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\n\nimport { Form, Formik } from 'formik';\n\ninterface GenericFormContainerProps {\n fields: {\n fieldName: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultValue: any;\n component: React.ReactNode;\n }[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onSubmit: (values: any) => Promise<void>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handleError?: (error: any) => void;\n submitButtonText: string;\n}\n\nconst GenericFormContainer = ({\n fields,\n onSubmit,\n handleError,\n submitButtonText,\n}: GenericFormContainerProps) => {\n const initialValues = fields.reduce<Record<string, unknown>>((acc, field) => {\n acc[field.fieldName] = field.defaultValue;\n return acc;\n }, {});\n\n return (\n <Formik\n initialValues={initialValues}\n onSubmit={async (values) => {\n try {\n await onSubmit(values);\n } catch (error) {\n if (handleError) {\n handleError(error);\n }\n }\n }}\n >\n {({ isSubmitting }) => (\n <Form>\n {fields.map((field, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <div key={`field_${field.fieldName}_${index}`}>{field.component}</div>\n ))}\n\n <Button\n data-testid=\"submit-form-button\"\n disabled={isSubmitting}\n sx={{ marginTop: 4 }}\n type=\"submit\"\n variant=\"contained\"\n >\n {submitButtonText}\n </Button>\n </Form>\n )}\n </Formik>\n );\n};\n\nexport default GenericFormContainer;\n"],"names":["fields","onSubmit","handleError","submitButtonText","initialValues","reduce","acc","field","fieldName","defaultValue","_jsx","Formik","async","values","error","children","isSubmitting","_jsxs","Form","map","index","component","Button","disabled","sx","marginTop","type","variant"],"mappings":"qHAkB6B,EAC3BA,SACAC,WACAC,cACAC,uBAEA,MAAMC,EAAgBJ,EAAOK,QAAgC,CAACC,EAAKC,KACjED,EAAIC,EAAMC,WAAaD,EAAME,aACtBH,IACN,CAAA,GAEH,OACEI,EAAAA,IAACC,EAAAA,OAAM,CACLP,cAAeA,EACfH,SAAUW,MAAOC,IACf,UACQZ,EAASY,EACjB,CAAE,MAAOC,GACHZ,GACFA,EAAYY,EAEhB,GACDC,SAEA,EAAGC,kBACFC,EAAAA,KAACC,EAAAA,gBACElB,EAAOmB,KAAI,CAACZ,EAAOa,IAElBV,EAAAA,IAAA,MAAA,CAAAK,SAAgDR,EAAMc,WAA5C,SAASd,EAAMC,aAAaY,OAGxCV,EAAAA,IAACY,EAAM,CAAA,cACO,qBACZC,SAAUP,EACVQ,GAAI,CAAEC,UAAW,GACjBC,KAAK,SACLC,QAAQ,YAAWZ,SAElBZ"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/Form/GenericFormContainer/index.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\n\nimport { Form, Formik } from 'formik';\n\ninterface GenericFormContainerProps {\n fields: {\n fieldName: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultValue: any;\n component: React.ReactNode;\n }[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onSubmit: (values: any) => Promise<void>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handleError?: (error: any) => void;\n submitButtonText: string;\n}\n\nconst GenericFormContainer = ({\n fields,\n onSubmit,\n handleError,\n submitButtonText,\n}: GenericFormContainerProps) => {\n const initialValues = fields.reduce<Record<string, unknown>>((acc, field) => {\n acc[field.fieldName] = field.defaultValue;\n return acc;\n }, {});\n\n return (\n <Formik\n initialValues={initialValues}\n onSubmit={async (values) => {\n try {\n await onSubmit(values);\n } catch (error) {\n if (handleError) {\n handleError(error);\n }\n }\n }}\n >\n {({ isSubmitting }) => (\n <Form>\n {fields.map((field, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <div key={`field_${field.fieldName}_${index}`}>{field.component}</div>\n ))}\n\n <Button\n data-fd=\"submit-form-button\"\n disabled={isSubmitting}\n sx={{ marginTop: 4 }}\n type=\"submit\"\n variant=\"contained\"\n >\n {submitButtonText}\n </Button>\n </Form>\n )}\n </Formik>\n );\n};\n\nexport default GenericFormContainer;\n"],"names":["fields","onSubmit","handleError","submitButtonText","initialValues","reduce","acc","field","fieldName","defaultValue","_jsx","Formik","async","values","error","children","isSubmitting","_jsxs","Form","map","index","component","Button","disabled","sx","marginTop","type","variant"],"mappings":"qHAkB6B,EAC3BA,SACAC,WACAC,cACAC,uBAEA,MAAMC,EAAgBJ,EAAOK,QAAgC,CAACC,EAAKC,KACjED,EAAIC,EAAMC,WAAaD,EAAME,aACtBH,IACN,CAAA,GAEH,OACEI,EAAAA,IAACC,EAAAA,OAAM,CACLP,cAAeA,EACfH,SAAUW,MAAOC,IACf,UACQZ,EAASY,EACjB,CAAE,MAAOC,GACHZ,GACFA,EAAYY,EAEhB,GACDC,SAEA,EAAGC,kBACFC,EAAAA,KAACC,EAAAA,gBACElB,EAAOmB,KAAI,CAACZ,EAAOa,IAElBV,EAAAA,IAAA,MAAA,CAAAK,SAAgDR,EAAMc,WAA5C,SAASd,EAAMC,aAAaY,OAGxCV,EAAAA,IAACY,EAAM,CAAA,UACG,qBACRC,SAAUP,EACVQ,GAAI,CAAEC,UAAW,GACjBC,KAAK,SACLC,QAAQ,YAAWZ,SAElBZ"}
@@ -1,2 +1,2 @@
1
- import{jsx as t,jsxs as i}from"react/jsx-runtime";import e from"@mui/material/Button";import{Formik as r,Form as a}from"formik";const n=({fields:n,onSubmit:m,handleError:o,submitButtonText:d})=>{const u=n.reduce(((t,i)=>(t[i.fieldName]=i.defaultValue,t)),{});return t(r,{initialValues:u,onSubmit:async t=>{try{await m(t)}catch(t){o&&o(t)}},children:({isSubmitting:r})=>i(a,{children:[n.map(((i,e)=>t("div",{children:i.component},`field_${i.fieldName}_${e}`))),t(e,{"data-testid":"submit-form-button",disabled:r,sx:{marginTop:4},type:"submit",variant:"contained",children:d})]})})};export{n as default};
1
+ import{jsx as t,jsxs as i}from"react/jsx-runtime";import e from"@mui/material/Button";import{Formik as r,Form as a}from"formik";const n=({fields:n,onSubmit:m,handleError:o,submitButtonText:d})=>{const u=n.reduce(((t,i)=>(t[i.fieldName]=i.defaultValue,t)),{});return t(r,{initialValues:u,onSubmit:async t=>{try{await m(t)}catch(t){o&&o(t)}},children:({isSubmitting:r})=>i(a,{children:[n.map(((i,e)=>t("div",{children:i.component},`field_${i.fieldName}_${e}`))),t(e,{"data-fd":"submit-form-button",disabled:r,sx:{marginTop:4},type:"submit",variant:"contained",children:d})]})})};export{n as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Form/GenericFormContainer/index.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\n\nimport { Form, Formik } from 'formik';\n\ninterface GenericFormContainerProps {\n fields: {\n fieldName: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultValue: any;\n component: React.ReactNode;\n }[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onSubmit: (values: any) => Promise<void>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handleError?: (error: any) => void;\n submitButtonText: string;\n}\n\nconst GenericFormContainer = ({\n fields,\n onSubmit,\n handleError,\n submitButtonText,\n}: GenericFormContainerProps) => {\n const initialValues = fields.reduce<Record<string, unknown>>((acc, field) => {\n acc[field.fieldName] = field.defaultValue;\n return acc;\n }, {});\n\n return (\n <Formik\n initialValues={initialValues}\n onSubmit={async (values) => {\n try {\n await onSubmit(values);\n } catch (error) {\n if (handleError) {\n handleError(error);\n }\n }\n }}\n >\n {({ isSubmitting }) => (\n <Form>\n {fields.map((field, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <div key={`field_${field.fieldName}_${index}`}>{field.component}</div>\n ))}\n\n <Button\n data-testid=\"submit-form-button\"\n disabled={isSubmitting}\n sx={{ marginTop: 4 }}\n type=\"submit\"\n variant=\"contained\"\n >\n {submitButtonText}\n </Button>\n </Form>\n )}\n </Formik>\n );\n};\n\nexport default GenericFormContainer;\n"],"names":["GenericFormContainer","fields","onSubmit","handleError","submitButtonText","initialValues","reduce","acc","field","fieldName","defaultValue","_jsx","Formik","async","values","error","children","isSubmitting","_jsxs","Form","map","index","component","Button","disabled","sx","marginTop","type","variant"],"mappings":"gIAkBA,MAAMA,EAAuB,EAC3BC,SACAC,WACAC,cACAC,uBAEA,MAAMC,EAAgBJ,EAAOK,QAAgC,CAACC,EAAKC,KACjED,EAAIC,EAAMC,WAAaD,EAAME,aACtBH,IACN,CAAA,GAEH,OACEI,EAACC,EAAM,CACLP,cAAeA,EACfH,SAAUW,MAAOC,IACf,UACQZ,EAASY,EACjB,CAAE,MAAOC,GACHZ,GACFA,EAAYY,EAEhB,GACDC,SAEA,EAAGC,kBACFC,EAACC,aACElB,EAAOmB,KAAI,CAACZ,EAAOa,IAElBV,EAAA,MAAA,CAAAK,SAAgDR,EAAMc,WAA5C,SAASd,EAAMC,aAAaY,OAGxCV,EAACY,EAAM,CAAA,cACO,qBACZC,SAAUP,EACVQ,GAAI,CAAEC,UAAW,GACjBC,KAAK,SACLC,QAAQ,YAAWZ,SAElBZ"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Form/GenericFormContainer/index.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\n\nimport { Form, Formik } from 'formik';\n\ninterface GenericFormContainerProps {\n fields: {\n fieldName: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultValue: any;\n component: React.ReactNode;\n }[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onSubmit: (values: any) => Promise<void>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handleError?: (error: any) => void;\n submitButtonText: string;\n}\n\nconst GenericFormContainer = ({\n fields,\n onSubmit,\n handleError,\n submitButtonText,\n}: GenericFormContainerProps) => {\n const initialValues = fields.reduce<Record<string, unknown>>((acc, field) => {\n acc[field.fieldName] = field.defaultValue;\n return acc;\n }, {});\n\n return (\n <Formik\n initialValues={initialValues}\n onSubmit={async (values) => {\n try {\n await onSubmit(values);\n } catch (error) {\n if (handleError) {\n handleError(error);\n }\n }\n }}\n >\n {({ isSubmitting }) => (\n <Form>\n {fields.map((field, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <div key={`field_${field.fieldName}_${index}`}>{field.component}</div>\n ))}\n\n <Button\n data-fd=\"submit-form-button\"\n disabled={isSubmitting}\n sx={{ marginTop: 4 }}\n type=\"submit\"\n variant=\"contained\"\n >\n {submitButtonText}\n </Button>\n </Form>\n )}\n </Formik>\n );\n};\n\nexport default GenericFormContainer;\n"],"names":["GenericFormContainer","fields","onSubmit","handleError","submitButtonText","initialValues","reduce","acc","field","fieldName","defaultValue","_jsx","Formik","async","values","error","children","isSubmitting","_jsxs","Form","map","index","component","Button","disabled","sx","marginTop","type","variant"],"mappings":"gIAkBA,MAAMA,EAAuB,EAC3BC,SACAC,WACAC,cACAC,uBAEA,MAAMC,EAAgBJ,EAAOK,QAAgC,CAACC,EAAKC,KACjED,EAAIC,EAAMC,WAAaD,EAAME,aACtBH,IACN,CAAA,GAEH,OACEI,EAACC,EAAM,CACLP,cAAeA,EACfH,SAAUW,MAAOC,IACf,UACQZ,EAASY,EACjB,CAAE,MAAOC,GACHZ,GACFA,EAAYY,EAEhB,GACDC,SAEA,EAAGC,kBACFC,EAACC,aACElB,EAAOmB,KAAI,CAACZ,EAAOa,IAElBV,EAAA,MAAA,CAAAK,SAAgDR,EAAMc,WAA5C,SAASd,EAAMC,aAAaY,OAGxCV,EAACY,EAAM,CAAA,UACG,qBACRC,SAAUP,EACVQ,GAAI,CAAEC,UAAW,GACjBC,KAAK,SACLC,QAAQ,YAAWZ,SAElBZ"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime");require("react");var t=require("formik"),i=require("@mui/material/TextField"),r=require("../../../custom-hooks/useRenderValidText.cjs.js"),a=require("../FormItemLayout/index.cjs.js"),l=require("@mui/material/Typography"),o=require("@mui/material/InputAdornment");const n=({field:t,form:a,fieldName:l,label:n,placeholder:d,onChange:s,multiline:u,minRows:m,maxRows:h,layout:p="horizontal",variant:c="standard",disabled:v=!1,required:x=!1,showHelperTextWhenValid:g=!1,startIcon:f,endIcon:j,value:w,type:y="text"})=>{const{errors:b,touched:q,isSubmitting:R}=a,I=b[t.name],T=!!I&&q[t.name],C=r({fieldError:I,showError:T,touched:!!q[t.name],value:t.value},"Valid");return e.jsx(i,{label:"standard"===c?void 0:n,variant:c,value:w??t.value,"data-testid":`text-field-${l??n.toLowerCase().replace(/\s+/g,"-")}`,autoComplete:"off",fullWidth:!0,multiline:u,minRows:m??(u?3:void 0),maxRows:h??(u?10:void 0),style:{paddingRight:"horizontal"===p?16:0},placeholder:d||void 0,disabled:R||v,required:x,error:T,helperText:T||g?C:void 0,onChange:e=>{"number"===y&&isNaN(Number(e.target.value))||(a.setFieldValue(l,e.target.value),s&&s(e))},slotProps:{htmlInput:{style:{paddingTop:"outlined"!==c?0:void 0,height:"1.1876em"}},formHelperText:{children:" ",style:{textAlign:"right"}}},InputProps:{startAdornment:f?e.jsx(o,{position:"start",children:f}):void 0,endAdornment:j?e.jsx(o,{position:"end",children:j}):void 0}})};module.exports=({label:r,fieldName:d,placeholder:s,validation:u,onChange:m,multiline:h,minRows:p,maxRows:c,layout:v="horizontal",variant:x="standard",disabled:g=!1,required:f=!1,showHelperTextWhenValid:j=!1,startIcon:w,endIcon:y,value:b,type:q="text"})=>{const R=!!d,I=()=>R?e.jsx(t.Field,{name:d,validate:u,children:t=>e.jsx(n,{...t,fieldName:d,label:r,placeholder:s,onChange:m,multiline:h,minRows:p,maxRows:c,layout:v,variant:x,disabled:g,required:f,showHelperTextWhenValid:j,startIcon:w,endIcon:y,value:b,type:q})}):e.jsx(i,{label:"standard"===x?void 0:r,variant:x,value:b,"data-testid":`text-field-${d??r.toLowerCase().replace(/\s+/g,"-")}`,autoComplete:"off",fullWidth:!0,multiline:h,minRows:p??(h?3:void 0),maxRows:c??(h?10:void 0),style:{paddingRight:"horizontal"===v?16:0},placeholder:s||void 0,disabled:g,required:f,onChange:m,slotProps:{htmlInput:{style:{paddingTop:"outlined"!==x?0:void 0,height:"1.1876em"}},formHelperText:{children:" ",style:{textAlign:"right"}}},InputProps:{startAdornment:w?e.jsx(o,{position:"start",children:w}):void 0,endAdornment:y?e.jsx(o,{position:"end",children:y}):void 0}});return"vertical"===v?e.jsxs(e.Fragment,{children:["standard"===x&&e.jsx(l,{variant:"subtitle1",component:"h3",color:"textPrimary",children:r}),I()]}):e.jsx(a,{label:r,children:I()})};
1
+ "use strict";var e=require("react/jsx-runtime");require("react");var t=require("@mui/material/InputAdornment"),i=require("@mui/material/TextField"),r=require("@mui/material/Typography"),a=require("formik"),l=require("../../../custom-hooks/useRenderValidText.cjs.js"),o=require("../FormItemLayout/index.cjs.js");const n=({field:r,form:a,fieldName:o,label:n,placeholder:d,onChange:s,multiline:u,minRows:m,maxRows:h,layout:p="horizontal",variant:c="standard",disabled:v=!1,required:x=!1,showHelperTextWhenValid:g=!1,startIcon:f,endIcon:j,value:w,type:y="text"})=>{const{errors:b,touched:q,isSubmitting:R}=a,I=b[r.name],T=!!I&&q[r.name],C=l({fieldError:I,showError:T,touched:!!q[r.name],value:r.value},"Valid");return e.jsx(i,{fullWidth:!0,autoComplete:"off","data-fd":`text-field-${o??n.toLowerCase().replace(/\s+/g,"-")}`,disabled:R||v,error:T,helperText:T||g?C:void 0,InputProps:{startAdornment:f?e.jsx(t,{position:"start",children:f}):void 0,endAdornment:j?e.jsx(t,{position:"end",children:j}):void 0},label:"standard"===c?void 0:n,maxRows:h??(u?10:void 0),minRows:m??(u?3:void 0),multiline:u,onChange:e=>{"number"===y&&isNaN(Number(e.target.value))||(a.setFieldValue(o,e.target.value),s&&s(e))},placeholder:d||void 0,required:x,slotProps:{htmlInput:{style:{paddingTop:"outlined"!==c?0:void 0,height:"1.1876em"}},formHelperText:{children:" ",style:{textAlign:"right"}}},style:{paddingRight:"horizontal"===p?16:0},value:w??r.value,variant:c})};module.exports=({label:l,fieldName:d,placeholder:s,validation:u,onChange:m,multiline:h,minRows:p,maxRows:c,layout:v="horizontal",variant:x="standard",disabled:g=!1,required:f=!1,showHelperTextWhenValid:j=!1,startIcon:w,endIcon:y,value:b,type:q="text"})=>{const R=!!d,I=()=>R?e.jsx(a.Field,{name:d,validate:u,children:t=>e.jsx(n,{...t,disabled:g,endIcon:y,fieldName:d,label:l,layout:v,maxRows:c,minRows:p,multiline:h,onChange:m,placeholder:s,required:f,showHelperTextWhenValid:j,startIcon:w,type:q,value:b,variant:x})}):e.jsx(i,{fullWidth:!0,autoComplete:"off","data-fd":`text-field-${d??l.toLowerCase().replace(/\s+/g,"-")}`,disabled:g,InputProps:{startAdornment:w?e.jsx(t,{position:"start",children:w}):void 0,endAdornment:y?e.jsx(t,{position:"end",children:y}):void 0},label:"standard"===x?void 0:l,maxRows:c??(h?10:void 0),minRows:p??(h?3:void 0),multiline:h,onChange:m,placeholder:s||void 0,required:f,slotProps:{htmlInput:{style:{paddingTop:"outlined"!==x?0:void 0,height:"1.1876em"}},formHelperText:{children:" ",style:{textAlign:"right"}}},style:{paddingRight:"horizontal"===v?16:0},value:b,variant:x});return"vertical"===v?e.jsxs(e.Fragment,{children:["standard"===x&&e.jsx(r,{color:"textPrimary",component:"h3",variant:"subtitle1",children:l}),I()]}):e.jsx(o,{label:l,children:I()})};
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/Form/GenericTextField/index.tsx"],"sourcesContent":["import { type ChangeEvent } from 'react';\n\nimport { type FieldProps, Field } from 'formik';\nimport TextField, { type TextFieldProps } from '@mui/material/TextField';\nimport useRenderValidText from '../../../custom-hooks/useRenderValidText';\nimport FormItemLayout from '../FormItemLayout';\nimport Typography from '@mui/material/Typography';\nimport InputAdornment from '@mui/material/InputAdornment';\n\ntype Props = {\n label: string;\n fieldName?: string;\n placeholder?: string;\n validation?: (value: string) => string | undefined;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n multiline?: boolean;\n minRows?: number;\n maxRows?: number;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n required?: boolean;\n showHelperTextWhenValid?: boolean;\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n value?: string;\n type?: 'number' | 'text';\n};\n\ntype TextFieldComponentProps = {\n field: FieldProps['field'];\n form: FieldProps['form'];\n fieldName: string;\n label: string;\n placeholder?: string;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n multiline?: boolean;\n minRows?: number;\n maxRows?: number;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n required?: boolean;\n showHelperTextWhenValid?: boolean;\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n value?: string;\n type?: 'number' | 'text';\n};\n\nconst TextFieldComponent = ({\n field,\n form,\n fieldName,\n label,\n placeholder,\n onChange,\n multiline,\n minRows,\n maxRows,\n layout = 'horizontal',\n variant = 'standard',\n disabled = false,\n required = false,\n showHelperTextWhenValid = false,\n startIcon,\n endIcon,\n value,\n type = 'text',\n}: TextFieldComponentProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText(\n {\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n },\n 'Valid',\n );\n\n return (\n <TextField\n label={variant === 'standard' ? undefined : label}\n variant={variant}\n value={value ?? field.value}\n data-testid={`text-field-${fieldName ?? label.toLowerCase().replace(/\\s+/g, '-')}`}\n autoComplete=\"off\"\n fullWidth\n multiline={multiline}\n minRows={minRows ?? (multiline ? 3 : undefined)}\n maxRows={maxRows ?? (multiline ? 10 : undefined)}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n placeholder={placeholder || undefined}\n disabled={isSubmitting || disabled}\n required={required}\n error={showError}\n helperText={(() => {\n if (showError) return helperText;\n if (showHelperTextWhenValid) return helperText;\n return undefined;\n })()}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (type === 'number' && isNaN(Number(e.target.value))) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(fieldName, e.target.value);\n if (onChange) {\n onChange(e);\n }\n }}\n slotProps={{\n htmlInput: {\n style: {\n paddingTop: variant !== 'outlined' ? 0 : undefined,\n height: '1.1876em',\n },\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n InputProps={{\n startAdornment: startIcon ? <InputAdornment position=\"start\">{startIcon}</InputAdornment> : undefined,\n endAdornment: endIcon ? <InputAdornment position=\"end\">{endIcon}</InputAdornment> : undefined,\n }}\n />\n );\n};\n\nconst GenericTextField = ({\n label,\n fieldName = undefined,\n placeholder,\n validation,\n onChange,\n multiline,\n minRows,\n maxRows,\n layout = 'horizontal',\n variant = 'standard',\n disabled = false,\n required = false,\n showHelperTextWhenValid = false,\n startIcon = undefined,\n endIcon = undefined,\n value,\n type = 'text',\n}: Props) => {\n const useFormik = !!fieldName;\n\n const renderField = () => {\n if (!useFormik) {\n return (\n <TextField\n label={variant === 'standard' ? undefined : label}\n variant={variant}\n value={value}\n data-testid={`text-field-${fieldName ?? label.toLowerCase().replace(/\\s+/g, '-')}`}\n autoComplete=\"off\"\n fullWidth\n multiline={multiline}\n minRows={minRows ?? (multiline ? 3 : undefined)}\n maxRows={maxRows ?? (multiline ? 10 : undefined)}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n placeholder={placeholder || undefined}\n disabled={disabled}\n required={required}\n onChange={onChange}\n slotProps={{\n htmlInput: {\n style: {\n paddingTop: variant !== 'outlined' ? 0 : undefined,\n height: '1.1876em',\n },\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n InputProps={{\n startAdornment: startIcon ? <InputAdornment position=\"start\">{startIcon}</InputAdornment> : undefined,\n endAdornment: endIcon ? <InputAdornment position=\"end\">{endIcon}</InputAdornment> : undefined,\n }}\n />\n );\n }\n\n return (\n <Field name={fieldName} validate={validation}>\n {(fieldProps: FieldProps) => (\n <TextFieldComponent\n {...fieldProps}\n fieldName={fieldName}\n label={label}\n placeholder={placeholder}\n onChange={onChange}\n multiline={multiline}\n minRows={minRows}\n maxRows={maxRows}\n layout={layout}\n variant={variant}\n disabled={disabled}\n required={required}\n showHelperTextWhenValid={showHelperTextWhenValid}\n startIcon={startIcon}\n endIcon={endIcon}\n value={value}\n type={type}\n />\n )}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography variant=\"subtitle1\" component=\"h3\" color=\"textPrimary\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericTextField;\n"],"names":["TextFieldComponent","field","form","fieldName","label","placeholder","onChange","multiline","minRows","maxRows","layout","variant","disabled","required","showHelperTextWhenValid","startIcon","endIcon","value","type","errors","touched","isSubmitting","fieldError","name","showError","helperText","useRenderValidText","_jsx","TextField","undefined","toLowerCase","replace","autoComplete","fullWidth","style","paddingRight","error","e","isNaN","Number","target","setFieldValue","slotProps","htmlInput","paddingTop","height","formHelperText","children","textAlign","InputProps","startAdornment","InputAdornment","position","endAdornment","validation","useFormik","renderField","Field","validate","fieldProps","_jsxs","_Fragment","Typography","component","color","FormItemLayout"],"mappings":"uTAkDA,MAAMA,EAAqB,EACvBC,QACAC,OACAC,YACAC,QACAC,cACAC,WACAC,YACAC,UACAC,UACAC,SAAS,aACTC,UAA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,CAAAd,SAAA,CACiB,aAAZpC,GACGgB,EAAAA,IAACmC,EAAU,CAACnD,QAAQ,YAAYoD,UAAU,KAAKC,MAAM,cAAajB,SAC7D3C,IAGRoD,OAKN7B,EAAAA,IAACsC,EAAc,CAAC7D,MAAOA,EAAK2C,SAAGS"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/Form/GenericTextField/index.tsx"],"sourcesContent":["import { type ChangeEvent } from 'react';\n\nimport InputAdornment from '@mui/material/InputAdornment';\nimport TextField, { type TextFieldProps } from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { Field, type FieldProps } from 'formik';\n\nimport useRenderValidText from '../../../custom-hooks/useRenderValidText';\nimport FormItemLayout from '../FormItemLayout';\n\ninterface Props {\n label: string;\n fieldName?: string;\n placeholder?: string;\n validation?: (value: string) => string | undefined;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n multiline?: boolean;\n minRows?: number;\n maxRows?: number;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n required?: boolean;\n showHelperTextWhenValid?: boolean;\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n value?: string;\n type?: 'number' | 'text';\n}\n\ninterface TextFieldComponentProps {\n field: FieldProps['field'];\n form: FieldProps['form'];\n fieldName: string;\n label: string;\n placeholder?: string;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n multiline?: boolean;\n minRows?: number;\n maxRows?: number;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n required?: boolean;\n showHelperTextWhenValid?: boolean;\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n value?: string;\n type?: 'number' | 'text';\n}\n\nconst TextFieldComponent = ({\n field,\n form,\n fieldName,\n label,\n placeholder,\n onChange,\n multiline,\n minRows,\n maxRows,\n layout = 'horizontal',\n variant = 'standard',\n disabled = false,\n required = false,\n showHelperTextWhenValid = false,\n startIcon,\n endIcon,\n value,\n type = 'text',\n}: TextFieldComponentProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText(\n {\n fieldError,\n showError,\n touched: !!touched[field.name],\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n value: field.value,\n },\n 'Valid',\n );\n\n return (\n <TextField\n fullWidth\n autoComplete=\"off\"\n data-fd={`text-field-${fieldName ?? label.toLowerCase().replace(/\\s+/g, '-')}`}\n disabled={isSubmitting || disabled}\n error={showError}\n helperText={(() => {\n if (showError) return helperText;\n if (showHelperTextWhenValid) return helperText;\n return undefined;\n })()}\n InputProps={{\n startAdornment: startIcon ? <InputAdornment position=\"start\">{startIcon}</InputAdornment> : undefined,\n endAdornment: endIcon ? <InputAdornment position=\"end\">{endIcon}</InputAdornment> : undefined,\n }}\n label={variant === 'standard' ? undefined : label}\n maxRows={maxRows ?? (multiline ? 10 : undefined)}\n minRows={minRows ?? (multiline ? 3 : undefined)}\n multiline={multiline}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (type === 'number' && isNaN(Number(e.target.value))) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(fieldName, e.target.value);\n if (onChange) {\n onChange(e);\n }\n }}\n placeholder={placeholder || undefined}\n required={required}\n slotProps={{\n htmlInput: {\n style: {\n paddingTop: variant !== 'outlined' ? 0 : undefined,\n height: '1.1876em',\n },\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n value={value ?? field.value}\n variant={variant}\n />\n );\n};\n\nconst GenericTextField = ({\n label,\n fieldName = undefined,\n placeholder,\n validation,\n onChange,\n multiline,\n minRows,\n maxRows,\n layout = 'horizontal',\n variant = 'standard',\n disabled = false,\n required = false,\n showHelperTextWhenValid = false,\n startIcon = undefined,\n endIcon = undefined,\n value,\n type = 'text',\n}: Props) => {\n const useFormik = !!fieldName;\n\n const renderField = () => {\n if (!useFormik) {\n return (\n <TextField\n fullWidth\n autoComplete=\"off\"\n data-fd={`text-field-${fieldName ?? label.toLowerCase().replace(/\\s+/g, '-')}`}\n disabled={disabled}\n InputProps={{\n startAdornment: startIcon ? (\n <InputAdornment position=\"start\">{startIcon}</InputAdornment>\n ) : undefined,\n endAdornment: endIcon ? <InputAdornment position=\"end\">{endIcon}</InputAdornment> : undefined,\n }}\n label={variant === 'standard' ? undefined : label}\n maxRows={maxRows ?? (multiline ? 10 : undefined)}\n minRows={minRows ?? (multiline ? 3 : undefined)}\n multiline={multiline}\n onChange={onChange}\n placeholder={placeholder || undefined}\n required={required}\n slotProps={{\n htmlInput: {\n style: {\n paddingTop: variant !== 'outlined' ? 0 : undefined,\n height: '1.1876em',\n },\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n value={value}\n variant={variant}\n />\n );\n }\n\n return (\n <Field name={fieldName} validate={validation}>\n {(fieldProps: FieldProps) => (\n <TextFieldComponent\n {...fieldProps}\n disabled={disabled}\n endIcon={endIcon}\n fieldName={fieldName}\n label={label}\n layout={layout}\n maxRows={maxRows}\n minRows={minRows}\n multiline={multiline}\n onChange={onChange}\n placeholder={placeholder}\n required={required}\n showHelperTextWhenValid={showHelperTextWhenValid}\n startIcon={startIcon}\n type={type}\n value={value}\n variant={variant}\n />\n )}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography color=\"textPrimary\" component=\"h3\" variant=\"subtitle1\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericTextField;\n"],"names":["TextFieldComponent","field","form","fieldName","label","placeholder","onChange","multiline","minRows","maxRows","layout","variant","disabled","required","showHelperTextWhenValid","startIcon","endIcon","value","type","errors","touched","isSubmitting","fieldError","name","showError","helperText","useRenderValidText","_jsx","TextField","fullWidth","autoComplete","toLowerCase","replace","error","InputProps","startAdornment","InputAdornment","position","children","undefined","endAdornment","e","isNaN","Number","target","setFieldValue","slotProps","htmlInput","style","paddingTop","height","formHelperText","textAlign","paddingRight","validation","useFormik","renderField","Field","validate","fieldProps","_jsxs","_Fragment","Typography","color","component","FormItemLayout"],"mappings":"uTAoDA,MAAMA,EAAqB,EACzBC,QACAC,OACAC,YACAC,QACAC,cACAC,WACAC,YACAC,UACAC,UACAC,SAAS,aACTC,UAAU,WACVC,YAAW,EACXC,YAAW,EACXC,2BAA0B,EAC1BC,YACAC,UACAC,QACAC,OAAO,WAEP,MAAMC,OAAEA,EAAMC,QAAEA,EAAOC,aAAEA,GAAiBnB,EACpCoB,EAAaH,EAAOlB,EAAMsB,MAC1BC,IAAcF,GAAeF,EAAQnB,EAAMsB,MAC3CE,EAAaC,EACjB,CACEJ,aACAE,YACAJ,UAAWA,EAAQnB,EAAMsB,MAEzBN,MAAOhB,EAAMgB,OAEf,SAGF,OACEU,MAACC,GACCC,WAAS,EACTC,aAAa,MAAK,UACT,cAAc3B,GAAaC,EAAM2B,cAAcC,QAAQ,OAAQ,OACxEpB,SAAUS,GAAgBT,EAC1BqB,MAAOT,EACPC,WACMD,GACAV,EADkBW,OACtB,EAGFS,WAAY,CACVC,eAAgBpB,EAAYY,EAAAA,IAACS,EAAc,CAACC,SAAS,QAAOC,SAAEvB,SAA8BwB,EAC5FC,aAAcxB,EAAUW,EAAAA,IAACS,EAAc,CAACC,SAAS,MAAKC,SAAEtB,SAA4BuB,GAEtFnC,MAAmB,aAAZO,OAAyB4B,EAAYnC,EAC5CK,QAASA,IAAYF,EAAY,QAAKgC,GACtC/B,QAASA,IAAYD,EAAY,OAAIgC,GACrChC,UAAWA,EACXD,SAAWmC,IACI,WAATv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,EAC5CK,QAASA,IAAYF,EAAY,QAAKgC,GACtC/B,QAASA,IAAYD,EAAY,OAAIgC,GACrChC,UAAWA,EACXD,SAAUA,EACVD,YAAaA,QAAekC,EAC5B1B,SAAUA,EACViC,UAAW,CACTC,UAAW,CACTC,MAAO,CACLC,WAAwB,aAAZtC,EAAyB,OAAI4B,EACzCW,OAAQ,aAGZC,eAAgB,CACdb,SAAU,IACVU,MAAO,CAAEI,UAAW,WAGxBJ,MAAO,CAAEK,aAAyB,eAAX3C,EAA0B,GAAK,GACtDO,MAAOA,EACPN,QAASA,IAgCjB,MAAe,aAAXD,EAEAkD,EAAAA,KAAAC,WAAA,CAAAvB,SAAA,CACe,aAAZ3B,GACCgB,EAAAA,IAACmC,EAAU,CAACC,MAAM,cAAcC,UAAU,KAAKrD,QAAQ,YAAW2B,SAC/DlC,IAGJoD,OAKA7B,EAAAA,IAACsC,EAAc,CAAC7D,MAAOA,EAAKkC,SAAGkB"}
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ChangeEvent } from 'react';
3
3
  import { TextFieldProps } from '@mui/material/TextField';
4
4
 
5
- type Props = {
5
+ interface Props {
6
6
  label: string;
7
7
  fieldName?: string;
8
8
  placeholder?: string;
@@ -20,7 +20,7 @@ type Props = {
20
20
  endIcon?: React.ReactNode;
21
21
  value?: string;
22
22
  type?: 'number' | 'text';
23
- };
23
+ }
24
24
  declare const GenericTextField: ({ label, fieldName, placeholder, validation, onChange, multiline, minRows, maxRows, layout, variant, disabled, required, showHelperTextWhenValid, startIcon, endIcon, value, type, }: Props) => react_jsx_runtime.JSX.Element;
25
25
 
26
26
  export { GenericTextField as default };
@@ -1,2 +1,2 @@
1
- import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import"react";import{Field as i}from"formik";import r from"@mui/material/TextField";import a from"../../../custom-hooks/useRenderValidText.js";import l from"../FormItemLayout/index.js";import n from"@mui/material/Typography";import d from"@mui/material/InputAdornment";const s=({field:e,form:t,fieldName:i,label:l,placeholder:n,onChange:s,multiline:m,minRows:u,maxRows:h,layout:p="horizontal",variant:c="standard",disabled:v=!1,required:f=!1,showHelperTextWhenValid:g=!1,startIcon:x,endIcon:w,value:y,type:b="text"})=>{const{errors:R,touched:I,isSubmitting:T}=t,C=R[e.name],A=!!C&&I[e.name],N=a({fieldError:C,showError:A,touched:!!I[e.name],value:e.value},"Valid");return o(r,{label:"standard"===c?void 0:l,variant:c,value:y??e.value,"data-testid":`text-field-${i??l.toLowerCase().replace(/\s+/g,"-")}`,autoComplete:"off",fullWidth:!0,multiline:m,minRows:u??(m?3:void 0),maxRows:h??(m?10:void 0),style:{paddingRight:"horizontal"===p?16:0},placeholder:n||void 0,disabled:T||v,required:f,error:A,helperText:A||g?N:void 0,onChange:e=>{"number"===b&&isNaN(Number(e.target.value))||(t.setFieldValue(i,e.target.value),s&&s(e))},slotProps:{htmlInput:{style:{paddingTop:"outlined"!==c?0:void 0,height:"1.1876em"}},formHelperText:{children:" ",style:{textAlign:"right"}}},InputProps:{startAdornment:x?o(d,{position:"start",children:x}):void 0,endAdornment:w?o(d,{position:"end",children:w}):void 0}})},m=({label:a,fieldName:m,placeholder:u,validation:h,onChange:p,multiline:c,minRows:v,maxRows:f,layout:g="horizontal",variant:x="standard",disabled:w=!1,required:y=!1,showHelperTextWhenValid:b=!1,startIcon:R,endIcon:I,value:T,type:C="text"})=>{const A=!!m,N=()=>A?o(i,{name:m,validate:h,children:e=>o(s,{...e,fieldName:m,label:a,placeholder:u,onChange:p,multiline:c,minRows:v,maxRows:f,layout:g,variant:x,disabled:w,required:y,showHelperTextWhenValid:b,startIcon:R,endIcon:I,value:T,type:C})}):o(r,{label:"standard"===x?void 0:a,variant:x,value:T,"data-testid":`text-field-${m??a.toLowerCase().replace(/\s+/g,"-")}`,autoComplete:"off",fullWidth:!0,multiline:c,minRows:v??(c?3:void 0),maxRows:f??(c?10:void 0),style:{paddingRight:"horizontal"===g?16:0},placeholder:u||void 0,disabled:w,required:y,onChange:p,slotProps:{htmlInput:{style:{paddingTop:"outlined"!==x?0:void 0,height:"1.1876em"}},formHelperText:{children:" ",style:{textAlign:"right"}}},InputProps:{startAdornment:R?o(d,{position:"start",children:R}):void 0,endAdornment:I?o(d,{position:"end",children:I}):void 0}});return"vertical"===g?e(t,{children:["standard"===x&&o(n,{variant:"subtitle1",component:"h3",color:"textPrimary",children:a}),N()]}):o(l,{label:a,children:N()})};export{m as default};
1
+ import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import"react";import i from"@mui/material/InputAdornment";import r from"@mui/material/TextField";import a from"@mui/material/Typography";import{Field as l}from"formik";import n from"../../../custom-hooks/useRenderValidText.js";import d from"../FormItemLayout/index.js";const m=({field:e,form:t,fieldName:a,label:l,placeholder:d,onChange:m,multiline:s,minRows:u,maxRows:h,layout:p="horizontal",variant:c="standard",disabled:v=!1,required:f=!1,showHelperTextWhenValid:g=!1,startIcon:x,endIcon:w,value:y,type:b="text"})=>{const{errors:R,touched:I,isSubmitting:T}=t,C=R[e.name],A=!!C&&I[e.name],N=n({fieldError:C,showError:A,touched:!!I[e.name],value:e.value},"Valid");return o(r,{fullWidth:!0,autoComplete:"off","data-fd":`text-field-${a??l.toLowerCase().replace(/\s+/g,"-")}`,disabled:T||v,error:A,helperText:A||g?N:void 0,InputProps:{startAdornment:x?o(i,{position:"start",children:x}):void 0,endAdornment:w?o(i,{position:"end",children:w}):void 0},label:"standard"===c?void 0:l,maxRows:h??(s?10:void 0),minRows:u??(s?3:void 0),multiline:s,onChange:e=>{"number"===b&&isNaN(Number(e.target.value))||(t.setFieldValue(a,e.target.value),m&&m(e))},placeholder:d||void 0,required:f,slotProps:{htmlInput:{style:{paddingTop:"outlined"!==c?0:void 0,height:"1.1876em"}},formHelperText:{children:" ",style:{textAlign:"right"}}},style:{paddingRight:"horizontal"===p?16:0},value:y??e.value,variant:c})},s=({label:n,fieldName:s,placeholder:u,validation:h,onChange:p,multiline:c,minRows:v,maxRows:f,layout:g="horizontal",variant:x="standard",disabled:w=!1,required:y=!1,showHelperTextWhenValid:b=!1,startIcon:R,endIcon:I,value:T,type:C="text"})=>{const A=!!s,N=()=>A?o(l,{name:s,validate:h,children:e=>o(m,{...e,disabled:w,endIcon:I,fieldName:s,label:n,layout:g,maxRows:f,minRows:v,multiline:c,onChange:p,placeholder:u,required:y,showHelperTextWhenValid:b,startIcon:R,type:C,value:T,variant:x})}):o(r,{fullWidth:!0,autoComplete:"off","data-fd":`text-field-${s??n.toLowerCase().replace(/\s+/g,"-")}`,disabled:w,InputProps:{startAdornment:R?o(i,{position:"start",children:R}):void 0,endAdornment:I?o(i,{position:"end",children:I}):void 0},label:"standard"===x?void 0:n,maxRows:f??(c?10:void 0),minRows:v??(c?3:void 0),multiline:c,onChange:p,placeholder:u||void 0,required:y,slotProps:{htmlInput:{style:{paddingTop:"outlined"!==x?0:void 0,height:"1.1876em"}},formHelperText:{children:" ",style:{textAlign:"right"}}},style:{paddingRight:"horizontal"===g?16:0},value:T,variant:x});return"vertical"===g?e(t,{children:["standard"===x&&o(a,{color:"textPrimary",component:"h3",variant:"subtitle1",children:n}),N()]}):o(d,{label:n,children:N()})};export{s as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Form/GenericTextField/index.tsx"],"sourcesContent":["import { type ChangeEvent } from 'react';\n\nimport { type FieldProps, Field } from 'formik';\nimport TextField, { type TextFieldProps } from '@mui/material/TextField';\nimport useRenderValidText from '../../../custom-hooks/useRenderValidText';\nimport FormItemLayout from '../FormItemLayout';\nimport Typography from '@mui/material/Typography';\nimport InputAdornment from '@mui/material/InputAdornment';\n\ntype Props = {\n label: string;\n fieldName?: string;\n placeholder?: string;\n validation?: (value: string) => string | undefined;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n multiline?: boolean;\n minRows?: number;\n maxRows?: number;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n required?: boolean;\n showHelperTextWhenValid?: boolean;\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n value?: string;\n type?: 'number' | 'text';\n};\n\ntype TextFieldComponentProps = {\n field: FieldProps['field'];\n form: FieldProps['form'];\n fieldName: string;\n label: string;\n placeholder?: string;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n multiline?: boolean;\n minRows?: number;\n maxRows?: number;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n required?: boolean;\n showHelperTextWhenValid?: boolean;\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n value?: string;\n type?: 'number' | 'text';\n};\n\nconst TextFieldComponent = ({\n field,\n form,\n fieldName,\n label,\n placeholder,\n onChange,\n multiline,\n minRows,\n maxRows,\n layout = 'horizontal',\n variant = 'standard',\n disabled = false,\n required = false,\n showHelperTextWhenValid = false,\n startIcon,\n endIcon,\n value,\n type = 'text',\n}: TextFieldComponentProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText(\n {\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n },\n 'Valid',\n );\n\n return (\n <TextField\n label={variant === 'standard' ? undefined : label}\n variant={variant}\n value={value ?? field.value}\n data-testid={`text-field-${fieldName ?? label.toLowerCase().replace(/\\s+/g, '-')}`}\n autoComplete=\"off\"\n fullWidth\n multiline={multiline}\n minRows={minRows ?? (multiline ? 3 : undefined)}\n maxRows={maxRows ?? (multiline ? 10 : undefined)}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n placeholder={placeholder || undefined}\n disabled={isSubmitting || disabled}\n required={required}\n error={showError}\n helperText={(() => {\n if (showError) return helperText;\n if (showHelperTextWhenValid) return helperText;\n return undefined;\n })()}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (type === 'number' && isNaN(Number(e.target.value))) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(fieldName, e.target.value);\n if (onChange) {\n onChange(e);\n }\n }}\n slotProps={{\n htmlInput: {\n style: {\n paddingTop: variant !== 'outlined' ? 0 : undefined,\n height: '1.1876em',\n },\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n InputProps={{\n startAdornment: startIcon ? <InputAdornment position=\"start\">{startIcon}</InputAdornment> : undefined,\n endAdornment: endIcon ? <InputAdornment position=\"end\">{endIcon}</InputAdornment> : undefined,\n }}\n />\n );\n};\n\nconst GenericTextField = ({\n label,\n fieldName = undefined,\n placeholder,\n validation,\n onChange,\n multiline,\n minRows,\n maxRows,\n layout = 'horizontal',\n variant = 'standard',\n disabled = false,\n required = false,\n showHelperTextWhenValid = false,\n startIcon = undefined,\n endIcon = undefined,\n value,\n type = 'text',\n}: Props) => {\n const useFormik = !!fieldName;\n\n const renderField = () => {\n if (!useFormik) {\n return (\n <TextField\n label={variant === 'standard' ? undefined : label}\n variant={variant}\n value={value}\n data-testid={`text-field-${fieldName ?? label.toLowerCase().replace(/\\s+/g, '-')}`}\n autoComplete=\"off\"\n fullWidth\n multiline={multiline}\n minRows={minRows ?? (multiline ? 3 : undefined)}\n maxRows={maxRows ?? (multiline ? 10 : undefined)}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n placeholder={placeholder || undefined}\n disabled={disabled}\n required={required}\n onChange={onChange}\n slotProps={{\n htmlInput: {\n style: {\n paddingTop: variant !== 'outlined' ? 0 : undefined,\n height: '1.1876em',\n },\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n InputProps={{\n startAdornment: startIcon ? <InputAdornment position=\"start\">{startIcon}</InputAdornment> : undefined,\n endAdornment: endIcon ? <InputAdornment position=\"end\">{endIcon}</InputAdornment> : undefined,\n }}\n />\n );\n }\n\n return (\n <Field name={fieldName} validate={validation}>\n {(fieldProps: FieldProps) => (\n <TextFieldComponent\n {...fieldProps}\n fieldName={fieldName}\n label={label}\n placeholder={placeholder}\n onChange={onChange}\n multiline={multiline}\n minRows={minRows}\n maxRows={maxRows}\n layout={layout}\n variant={variant}\n disabled={disabled}\n required={required}\n showHelperTextWhenValid={showHelperTextWhenValid}\n startIcon={startIcon}\n endIcon={endIcon}\n value={value}\n type={type}\n />\n )}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography variant=\"subtitle1\" component=\"h3\" color=\"textPrimary\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericTextField;\n"],"names":["TextFieldComponent","field","form","fieldName","label","placeholder","onChange","multiline","minRows","maxRows","layout","variant","disabled","required","showHelperTextWhenValid","startIcon","endIcon","value","type","errors","touched","isSubmitting","fieldError","name","showError","helperText","useRenderValidText","_jsx","TextField","undefined","toLowerCase","replace","autoComplete","fullWidth","style","paddingRight","error","e","isNaN","Number","target","setFieldValue","slotProps","htmlInput","paddingTop","height","formHelperText","children","textAlign","InputProps","startAdornment","InputAdornment","position","endAdornment","GenericTextField","validation","useFormik","renderField","Field","validate","fieldProps","_jsxs","_Fragment","Typography","component","color","FormItemLayout"],"mappings":"6UAkDA,MAAMA,EAAqB,EACvBC,QACAC,OACAC,YACAC,QACAC,cACAC,WACAC,YACAC,UACAC,UACAC,SAAS,aACTC,UAAU,WACVC,YAAW,EACXC,YAAW,EACXC,2BAA0B,EAC1BC,YACAC,UACAC,QACAC,OAAO,WAEP,MAAMC,OAAEA,EAAMC,QAAEA,EAAOC,aAAEA,GAAiBnB,EACpCoB,EAAaH,EAAOlB,EAAMsB,MAC1BC,IAAcF,GAAeF,EAAQnB,EAAMsB,MAC3CE,EAAaC,EACf,CACIJ,aACAE,YACAJ,UAAWA,EAAQnB,EAAMsB,MACzBN,MAAOhB,EAAMgB,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EACbC,SAAUA,EACVC,UAAWA,EACXC,QAASA,EACTC,QAASA,EACTC,OAAQA,EACRC,QAASA,EACTC,SAAUA,EACVC,SAAUA,EACVC,wBAAyBA,EACzBC,UAAWA,EACXC,QAASA,EACTC,MAAOA,EACPC,KAAMA,MAvDdS,EAACC,EAAS,CACNxB,MAAmB,aAAZO,OAAyBkB,EAAYzB,EAC5CO,QAASA,EACTM,MAAOA,EAAK,cACC,cAAcd,GAAaC,EAAM0B,cAAcC,QAAQ,OAAQ,OAC5EC,aAAa,MACbC,WAAS,EACT1B,UAAWA,EACXC,QAASA,IAAYD,EAAY,OAAIsB,GACrCpB,QAASA,IAAYF,EAAY,QAAKsB,GACtCK,MAAO,CAAEC,aAAyB,eAAXzB,EAA0B,GAAK,GACtDL,YAAaA,QAAewB,EAC5BjB,SAAUA,EACVC,SAAUA,EACVP,SAAUA,EACVoC,UAAW,CACPC,UAAW,CACPT,MAAO,CACHU,WAAwB,aAAZjC,EAAyB,OAAIkB,EACzCgB,OAAQ,aAGhBC,eAAgB,CACZC,SAAU,IACVb,MAAO,CAAEc,UAAW,WAG5BC,WAAY,CACRC,eAAgBnC,EAAYY,EAACwB,EAAc,CAACC,SAAS,QAAOL,SAAEhC,SAA8Bc,EAC5FwB,aAAcrC,EAAUW,EAACwB,EAAc,CAACC,SAAS,MAAKL,SAAE/B,SAA4Ba,KAiCxG,MAAe,aAAXnB,EAEImD,EAAAC,EAAA,CAAAf,SAAA,CACiB,aAAZpC,GACGgB,EAACoC,EAAU,CAACpD,QAAQ,YAAYqD,UAAU,KAAKC,MAAM,cAAalB,SAC7D3C,IAGRqD,OAKN9B,EAACuC,EAAc,CAAC9D,MAAOA,EAAK2C,SAAGU"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Form/GenericTextField/index.tsx"],"sourcesContent":["import { type ChangeEvent } from 'react';\n\nimport InputAdornment from '@mui/material/InputAdornment';\nimport TextField, { type TextFieldProps } from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { Field, type FieldProps } from 'formik';\n\nimport useRenderValidText from '../../../custom-hooks/useRenderValidText';\nimport FormItemLayout from '../FormItemLayout';\n\ninterface Props {\n label: string;\n fieldName?: string;\n placeholder?: string;\n validation?: (value: string) => string | undefined;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n multiline?: boolean;\n minRows?: number;\n maxRows?: number;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n required?: boolean;\n showHelperTextWhenValid?: boolean;\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n value?: string;\n type?: 'number' | 'text';\n}\n\ninterface TextFieldComponentProps {\n field: FieldProps['field'];\n form: FieldProps['form'];\n fieldName: string;\n label: string;\n placeholder?: string;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n multiline?: boolean;\n minRows?: number;\n maxRows?: number;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldProps['variant'];\n disabled?: boolean;\n required?: boolean;\n showHelperTextWhenValid?: boolean;\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n value?: string;\n type?: 'number' | 'text';\n}\n\nconst TextFieldComponent = ({\n field,\n form,\n fieldName,\n label,\n placeholder,\n onChange,\n multiline,\n minRows,\n maxRows,\n layout = 'horizontal',\n variant = 'standard',\n disabled = false,\n required = false,\n showHelperTextWhenValid = false,\n startIcon,\n endIcon,\n value,\n type = 'text',\n}: TextFieldComponentProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText(\n {\n fieldError,\n showError,\n touched: !!touched[field.name],\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n value: field.value,\n },\n 'Valid',\n );\n\n return (\n <TextField\n fullWidth\n autoComplete=\"off\"\n data-fd={`text-field-${fieldName ?? label.toLowerCase().replace(/\\s+/g, '-')}`}\n disabled={isSubmitting || disabled}\n error={showError}\n helperText={(() => {\n if (showError) return helperText;\n if (showHelperTextWhenValid) return helperText;\n return undefined;\n })()}\n InputProps={{\n startAdornment: startIcon ? <InputAdornment position=\"start\">{startIcon}</InputAdornment> : undefined,\n endAdornment: endIcon ? <InputAdornment position=\"end\">{endIcon}</InputAdornment> : undefined,\n }}\n label={variant === 'standard' ? undefined : label}\n maxRows={maxRows ?? (multiline ? 10 : undefined)}\n minRows={minRows ?? (multiline ? 3 : undefined)}\n multiline={multiline}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (type === 'number' && isNaN(Number(e.target.value))) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(fieldName, e.target.value);\n if (onChange) {\n onChange(e);\n }\n }}\n placeholder={placeholder || undefined}\n required={required}\n slotProps={{\n htmlInput: {\n style: {\n paddingTop: variant !== 'outlined' ? 0 : undefined,\n height: '1.1876em',\n },\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n value={value ?? field.value}\n variant={variant}\n />\n );\n};\n\nconst GenericTextField = ({\n label,\n fieldName = undefined,\n placeholder,\n validation,\n onChange,\n multiline,\n minRows,\n maxRows,\n layout = 'horizontal',\n variant = 'standard',\n disabled = false,\n required = false,\n showHelperTextWhenValid = false,\n startIcon = undefined,\n endIcon = undefined,\n value,\n type = 'text',\n}: Props) => {\n const useFormik = !!fieldName;\n\n const renderField = () => {\n if (!useFormik) {\n return (\n <TextField\n fullWidth\n autoComplete=\"off\"\n data-fd={`text-field-${fieldName ?? label.toLowerCase().replace(/\\s+/g, '-')}`}\n disabled={disabled}\n InputProps={{\n startAdornment: startIcon ? (\n <InputAdornment position=\"start\">{startIcon}</InputAdornment>\n ) : undefined,\n endAdornment: endIcon ? <InputAdornment position=\"end\">{endIcon}</InputAdornment> : undefined,\n }}\n label={variant === 'standard' ? undefined : label}\n maxRows={maxRows ?? (multiline ? 10 : undefined)}\n minRows={minRows ?? (multiline ? 3 : undefined)}\n multiline={multiline}\n onChange={onChange}\n placeholder={placeholder || undefined}\n required={required}\n slotProps={{\n htmlInput: {\n style: {\n paddingTop: variant !== 'outlined' ? 0 : undefined,\n height: '1.1876em',\n },\n },\n formHelperText: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n }}\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n value={value}\n variant={variant}\n />\n );\n }\n\n return (\n <Field name={fieldName} validate={validation}>\n {(fieldProps: FieldProps) => (\n <TextFieldComponent\n {...fieldProps}\n disabled={disabled}\n endIcon={endIcon}\n fieldName={fieldName}\n label={label}\n layout={layout}\n maxRows={maxRows}\n minRows={minRows}\n multiline={multiline}\n onChange={onChange}\n placeholder={placeholder}\n required={required}\n showHelperTextWhenValid={showHelperTextWhenValid}\n startIcon={startIcon}\n type={type}\n value={value}\n variant={variant}\n />\n )}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography color=\"textPrimary\" component=\"h3\" variant=\"subtitle1\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericTextField;\n"],"names":["TextFieldComponent","field","form","fieldName","label","placeholder","onChange","multiline","minRows","maxRows","layout","variant","disabled","required","showHelperTextWhenValid","startIcon","endIcon","value","type","errors","touched","isSubmitting","fieldError","name","showError","helperText","useRenderValidText","_jsx","TextField","fullWidth","autoComplete","toLowerCase","replace","error","InputProps","startAdornment","InputAdornment","position","children","undefined","endAdornment","e","isNaN","Number","target","setFieldValue","slotProps","htmlInput","style","paddingTop","height","formHelperText","textAlign","paddingRight","GenericTextField","validation","useFormik","renderField","Field","validate","fieldProps","_jsxs","_Fragment","Typography","color","component","FormItemLayout"],"mappings":"6UAoDA,MAAMA,EAAqB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AC,EAAA,CAAAxB,SAAA,CACe,aAAZ3B,GACCgB,EAACoC,EAAU,CAACC,MAAM,cAAcC,UAAU,KAAKtD,QAAQ,YAAW2B,SAC/DlC,IAGJqD,OAKA9B,EAACuC,EAAc,CAAC9D,MAAOA,EAAKkC,SAAGmB"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material/Box"),n=require("@mui/material/Button"),a=require("@mui/material/Divider"),r=require("@mui/material/IconButton"),s=require("@mui/material/styles"),o=require("@mui/material/Typography"),l=require("@mui/material/useMediaQuery"),d=require("../../icons/Add/index.cjs.js"),c=require("../../icons/ArrowLeft02/index.cjs.js"),p=require("../../utilities/renderUtilities.cjs.js"),g=require("../../utilities/validation.cjs.js"),m=require("@mui/material/Grid2"),h=require("../FDErrorBoundary/index.cjs.js"),u=require("../Spacer/index.cjs.js"),x=require("./DocumentTitle.cjs.js"),j=require("./FullWidthContainer.cjs.js");const f=1112,b=s.styled("div")((({theme:e,fluid:t})=>({maxWidth:t?"none":f,[e.breakpoints.down("laptop")]:{maxWidth:"none"},padding:e.spacing(2,4),position:"relative",minHeight:"100vh"}))),y=s.styled(m)((({theme:e})=>({[e.breakpoints.down("laptop")]:{width:"100%",paddingTop:e.spacing(2)}}))),k=s.styled(m)((({theme:e})=>({flexWrap:"nowrap",alignItems:"flex-start",paddingTop:e.spacing(3),paddingBottom:e.spacing(3),[e.breakpoints.down("laptop")]:{paddingTop:e.spacing(2),paddingBottom:e.spacing(3)}}))),v=s.styled(m,{shouldForwardProp:e=>"stackAboveTitle"!==e})((({theme:e,stackAboveTitle:t})=>({paddingTop:e.spacing(2),...t?{flexDirection:"column",alignItems:"flex-start"}:{},[e.breakpoints.up("laptop")]:{width:"100%",alignItems:t?"flex-start":"center",...t?{flexDirection:"column"}:{}},[e.breakpoints.only("mobile")]:{marginLeft:e.spacing(-3),marginRight:e.spacing(-3),flexDirection:"column",alignItems:"flex-start"},[e.breakpoints.only("base")]:{marginLeft:e.spacing(-2),marginRight:e.spacing(-2),flexDirection:"column",alignItems:"flex-start"}}))),A=s.styled(m)((()=>({flexGrow:1}))),T=s.styled("div")((({theme:e})=>({maxWidth:f,paddingBottom:e.spacing(3),[e.breakpoints.down("laptop")]:{paddingBottom:e.spacing(2),paddingLeft:e.spacing(2),paddingRight:e.spacing(2)}}))),C=s.styled(d)((({theme:e})=>({marginRight:e.spacing(1)}))),L=s.styled(i)((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-start",marginBottom:e.spacing(1),marginLeft:e.spacing(-2)}))),B=s.styled(r,{shouldForwardProp:e=>"hasTitleComponent"!==e&&"alignWithContent"!==e})((({theme:e,hasTitleComponent:t,alignWithContent:i})=>{const n=t?e.spacing(-.75):e.spacing(-1.5),a=e.spacing(-1.5);return{marginTop:n,marginRight:e.spacing(.5),marginBottom:a,marginLeft:i?0:e.spacing(-1.5),padding:0,[e.breakpoints.only("tablet")]:{marginLeft:i?0:e.spacing(-2)},[e.breakpoints.only("base")]:{marginLeft:i?0:e.spacing(-2)}}})),W=s.styled("div")((({theme:e})=>({maxWidth:f,marginLeft:e.spacing(6),marginRight:e.spacing(4),paddingBottom:e.spacing(2),[e.breakpoints.only("tablet")]:{marginLeft:12,marginRight:e.spacing(3)},[e.breakpoints.only("mobile")]:{marginLeft:e.spacing(3),marginRight:e.spacing(3),maxWidth:"none"},[e.breakpoints.only("base")]:{marginLeft:e.spacing(2),marginRight:e.spacing(2),maxWidth:"none"}}))),w=s.styled(m)((()=>({display:"flex",flexGrow:1,justifyContent:"flex-end"}))),q=s.styled(o)((({theme:e})=>({lineHeight:"26px",color:e.palette.semantic.text["text-weak"]}))),I=s.styled(o)((()=>({fontWeight:"bold"}))),R=s.styled(a)((({theme:e})=>({marginBottom:e.spacing(4)}))),S=({title:t})=>e.jsx(I,{component:"h2",variant:"h5",children:t}),_=s.styled("div")((({useAlternateBackground:e,theme:t})=>({backgroundColor:e?t.palette.semantic.background["background-alternate"]:t.palette.semantic.background["background-base"],width:"100%",height:"100%"})));exports.HORIZONTAL_SPACE_CLASSNAME="horizontal-content-space",exports.LEFT_HORIZONTAL_SPACE_CLASSNAME="left-horizontal-content-space",exports.PageTitle=S,exports.RIGHT_HORIZONTAL_SPACE_CLASSNAME="right-horizontal-content-space",exports.VERTICAL_SPACE_CLASSNAME="vertical-content-space",exports.default=a=>{const{actionBtnTitle:r,caption:o,children:d,contextButtons:f,documentTitle:I,fluid:E=!1,fullWidth:P,header:F,hideHeader:z,actionButtonLink:D,openLinkInNewTab:H=!1,pageHeader:N,showActionButton:M,showAddIcon:O,title:G,titleComponent:V,toPrevious:Z,toParent:$,toParentCaption:U,strictToParent:Q,navigate:J,hideDivider:K=!1,customActionButtons:X,useAlternateBackground:Y=!1,titleComponentAfter:ee,errorBoundarySomethingWentWrongText:te}=a,ie=s.useTheme(),ne=l(ie.breakpoints.down("tablet")),ae=p.getMicroFrontendAttribute("data-portal-base-url")||"/",re=!!D&&D.startsWith("https://"),se=re?D:void 0!==D?g.joinUrlPaths(ae,D):"";return e.jsx(_,{useAlternateBackground:Y,children:e.jsxs(b,{fluid:E,children:[I&&e.jsx(x,{children:I}),N||null,e.jsxs(W,{children:[N&&e.jsx(u,{size:16,variant:"vertical"}),!z&&e.jsxs(e.Fragment,{children:[e.jsxs(k,{container:!0,alignItems:"center",direction:"column",children:[e.jsx(m,{container:!0,alignContent:"space-between",direction:"row",children:e.jsx(w,{children:f?.map((i=>e.jsx("div",{children:i},`context-button-${t.isValidElement(i)?i.props?.["data-testid"]||i.props?.children:"fallback"}`)))})}),e.jsxs(v,{container:!0,stackAboveTitle:!!U,children:[($||Z)&&e.jsxs(L,{children:[e.jsx(B,{alignWithContent:!!U,"aria-label":"Back",component:"button","data-testid":"back_button",hasTitleComponent:!!V,onClick:()=>{Z?J(-1):$&&Q||$&&history.length<3?J($):J(-1)},children:e.jsx(c,{})}),U&&e.jsx(q,{component:"h3",variant:"caption",children:U})]}),e.jsxs(A,{children:[V?e.jsx(V,{}):e.jsxs(i,{alignItems:"center",display:"flex",gap:2,children:[e.jsx(S,{title:G}),ee]}),o&&e.jsx(q,{component:"h3",variant:"caption",children:o})]}),M&&e.jsxs(e.Fragment,{children:[ne&&e.jsx(u,{size:56,variant:"vertical"}),e.jsx(y,{children:e.jsxs(n,{"data-testid":`Action-button-${r}`,fullWidth:!0,href:H||re?se:"",onClick:H||re?()=>{}:()=>{J(D)},rel:H?"noopener noreferrer":void 0,target:H?"_blank":void 0,variant:"contained",children:[O&&e.jsx(C,{size:"sm"}),r]})})]}),X?.map((i=>e.jsxs("div",{children:[ne&&e.jsx(u,{size:56,variant:"vertical"}),!ne&&e.jsx(u,{size:16,variant:"vertical"}),e.jsx(y,{children:i})]},`custom-action-button-${t.isValidElement(i)?i.props?.["data-testid"]||i.props?.children:"fallback"}`)))]})]}),!K&&e.jsx(R,{})]}),e.jsxs(j,{fullWidth:P,children:[F?e.jsx(T,{children:F}):null,e.jsx(h,{identifier:I,somethingWentWrongText:te,children:e.jsx(e.Fragment,{children:d})})]})]})]})})},exports.maxWidth=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material/Box"),n=require("@mui/material/Button"),a=require("@mui/material/Divider"),r=require("@mui/material/IconButton"),s=require("@mui/material/styles"),o=require("@mui/material/Typography"),l=require("@mui/material/useMediaQuery"),d=require("../../icons/Add/index.cjs.js"),c=require("../../icons/ArrowLeft02/index.cjs.js"),p=require("../../utilities/renderUtilities.cjs.js"),g=require("../../utilities/validation.cjs.js"),m=require("@mui/material/Grid2"),h=require("../FDErrorBoundary/index.cjs.js"),u=require("../Spacer/index.cjs.js"),x=require("./DocumentTitle.cjs.js"),j=require("./FullWidthContainer.cjs.js");const f=1112,b=s.styled("div")((({theme:e,fluid:t})=>({maxWidth:t?"none":f,[e.breakpoints.down("laptop")]:{maxWidth:"none"},padding:e.spacing(2,4),position:"relative",minHeight:"100vh"}))),y=s.styled(m)((({theme:e})=>({[e.breakpoints.down("laptop")]:{width:"100%",paddingTop:e.spacing(2)}}))),k=s.styled(m)((({theme:e})=>({flexWrap:"nowrap",alignItems:"flex-start",paddingTop:e.spacing(3),paddingBottom:e.spacing(3),[e.breakpoints.down("laptop")]:{paddingTop:e.spacing(2),paddingBottom:e.spacing(3)}}))),v=s.styled(m,{shouldForwardProp:e=>"stackAboveTitle"!==e})((({theme:e,stackAboveTitle:t})=>({paddingTop:e.spacing(2),...t?{flexDirection:"column",alignItems:"flex-start"}:{},[e.breakpoints.up("laptop")]:{width:"100%",alignItems:t?"flex-start":"center",...t?{flexDirection:"column"}:{}},[e.breakpoints.only("mobile")]:{marginLeft:e.spacing(-3),marginRight:e.spacing(-3),flexDirection:"column",alignItems:"flex-start"},[e.breakpoints.only("base")]:{marginLeft:e.spacing(-2),marginRight:e.spacing(-2),flexDirection:"column",alignItems:"flex-start"}}))),A=s.styled(m)((()=>({flexGrow:1}))),T=s.styled("div")((({theme:e})=>({maxWidth:f,paddingBottom:e.spacing(3),[e.breakpoints.down("laptop")]:{paddingBottom:e.spacing(2),paddingLeft:e.spacing(2),paddingRight:e.spacing(2)}}))),C=s.styled(d)((({theme:e})=>({marginRight:e.spacing(1)}))),L=s.styled(i)((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-start",marginBottom:e.spacing(1),marginLeft:e.spacing(-2)}))),B=s.styled(r,{shouldForwardProp:e=>"hasTitleComponent"!==e&&"alignWithContent"!==e})((({theme:e,hasTitleComponent:t,alignWithContent:i})=>{const n=t?e.spacing(-.75):e.spacing(-1.5),a=e.spacing(-1.5);return{marginTop:n,marginRight:e.spacing(.5),marginBottom:a,marginLeft:i?0:e.spacing(-1.5),padding:0,[e.breakpoints.only("tablet")]:{marginLeft:i?0:e.spacing(-2)},[e.breakpoints.only("base")]:{marginLeft:i?0:e.spacing(-2)}}})),W=s.styled("div")((({theme:e})=>({maxWidth:f,marginLeft:e.spacing(6),marginRight:e.spacing(4),paddingBottom:e.spacing(2),[e.breakpoints.only("tablet")]:{marginLeft:12,marginRight:e.spacing(3)},[e.breakpoints.only("mobile")]:{marginLeft:e.spacing(3),marginRight:e.spacing(3),maxWidth:"none"},[e.breakpoints.only("base")]:{marginLeft:e.spacing(2),marginRight:e.spacing(2),maxWidth:"none"}}))),w=s.styled(m)((()=>({display:"flex",flexGrow:1,justifyContent:"flex-end"}))),q=s.styled(o)((({theme:e})=>({lineHeight:"26px",color:e.palette.semantic.text["text-weak"]}))),I=s.styled(o)((()=>({fontWeight:"bold"}))),R=s.styled(a)((({theme:e})=>({marginBottom:e.spacing(4)}))),S=({title:t})=>e.jsx(I,{component:"h2",variant:"h5",children:t}),_=s.styled("div")((({useAlternateBackground:e,theme:t})=>({backgroundColor:e?t.palette.semantic.background["background-alternate"]:t.palette.semantic.background["background-base"],width:"100%",height:"100%"})));exports.HORIZONTAL_SPACE_CLASSNAME="horizontal-content-space",exports.LEFT_HORIZONTAL_SPACE_CLASSNAME="left-horizontal-content-space",exports.PageTitle=S,exports.RIGHT_HORIZONTAL_SPACE_CLASSNAME="right-horizontal-content-space",exports.VERTICAL_SPACE_CLASSNAME="vertical-content-space",exports.default=a=>{const{actionBtnTitle:r,caption:o,children:d,contextButtons:f,documentTitle:I,fluid:E=!1,fullWidth:P,header:F,hideHeader:z,actionButtonLink:D,openLinkInNewTab:H=!1,pageHeader:N,showActionButton:M,showAddIcon:O,title:G,titleComponent:V,toPrevious:Z,toParent:$,toParentCaption:U,strictToParent:Q,navigate:J,hideDivider:K=!1,customActionButtons:X,useAlternateBackground:Y=!1,titleComponentAfter:ee,errorBoundarySomethingWentWrongText:te}=a,ie=s.useTheme(),ne=l(ie.breakpoints.down("tablet")),ae=p.getMicroFrontendAttribute("data-portal-base-url")||"/",re=!!D&&D.startsWith("https://"),se=re?D:void 0!==D?g.joinUrlPaths(ae,D):"";return e.jsx(_,{useAlternateBackground:Y,children:e.jsxs(b,{fluid:E,children:[I&&e.jsx(x,{children:I}),N||null,e.jsxs(W,{children:[N&&e.jsx(u,{size:16,variant:"vertical"}),!z&&e.jsxs(e.Fragment,{children:[e.jsxs(k,{container:!0,alignItems:"center",direction:"column",children:[e.jsx(m,{container:!0,alignContent:"space-between",direction:"row",children:e.jsx(w,{children:f?.map((i=>e.jsx("div",{children:i},`context-button-${t.isValidElement(i)?i.props?.["data-fd"]||i.props?.children:"fallback"}`)))})}),e.jsxs(v,{container:!0,stackAboveTitle:!!U,children:[($||Z)&&e.jsxs(L,{children:[e.jsx(B,{alignWithContent:!!U,"aria-label":"Back",component:"button","data-fd":"back_button",hasTitleComponent:!!V,onClick:()=>{Z?J(-1):$&&Q||$&&history.length<3?J($):J(-1)},children:e.jsx(c,{})}),U&&e.jsx(q,{component:"h3",variant:"caption",children:U})]}),e.jsxs(A,{children:[V?e.jsx(V,{}):e.jsxs(i,{alignItems:"center",display:"flex",gap:2,children:[e.jsx(S,{title:G}),ee]}),o&&e.jsx(q,{component:"h3",variant:"caption",children:o})]}),M&&e.jsxs(e.Fragment,{children:[ne&&e.jsx(u,{size:56,variant:"vertical"}),e.jsx(y,{children:e.jsxs(n,{"data-fd":`Action-button-${r}`,fullWidth:!0,href:H||re?se:"",onClick:H||re?()=>{}:()=>{J(D)},rel:H?"noopener noreferrer":void 0,target:H?"_blank":void 0,variant:"contained",children:[O&&e.jsx(C,{size:"sm"}),r]})})]}),X?.map((i=>e.jsxs("div",{children:[ne&&e.jsx(u,{size:56,variant:"vertical"}),!ne&&e.jsx(u,{size:16,variant:"vertical"}),e.jsx(y,{children:i})]},`custom-action-button-${t.isValidElement(i)?i.props?.["data-fd"]||i.props?.children:"fallback"}`)))]})]}),!K&&e.jsx(R,{})]}),e.jsxs(j,{fullWidth:P,children:[F?e.jsx(T,{children:F}):null,e.jsx(h,{identifier:I,somethingWentWrongText:te,children:e.jsx(e.Fragment,{children:d})})]})]})]})})},exports.maxWidth=f;
2
2
  //# sourceMappingURL=index.cjs.js.map