@flipdish/portal-library 1.0.41 → 1.0.43
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.
- package/dist/components/ui/Chip/Chip.cjs.js +1 -1
- package/dist/components/ui/Chip/Chip.cjs.js.map +1 -1
- package/dist/components/ui/Chip/Chip.js +1 -1
- package/dist/components/ui/Chip/Chip.js.map +1 -1
- package/dist/components/ui/Form/GenericAutocompleteField.cjs.js +1 -1
- package/dist/components/ui/Form/GenericAutocompleteField.cjs.js.map +1 -1
- package/dist/components/ui/Form/GenericAutocompleteField.d.ts +10 -8
- package/dist/components/ui/Form/GenericAutocompleteField.js +1 -1
- package/dist/components/ui/Form/GenericAutocompleteField.js.map +1 -1
- package/dist/components/ui/Form/GenericFormContainer.cjs.js +1 -1
- package/dist/components/ui/Form/GenericFormContainer.cjs.js.map +1 -1
- package/dist/components/ui/Form/GenericFormContainer.js +1 -1
- package/dist/components/ui/Form/GenericFormContainer.js.map +1 -1
- package/dist/components/ui/GenericRadioButtons/GenericRadioButtons.cjs.js +1 -1
- package/dist/components/ui/GenericRadioButtons/GenericRadioButtons.cjs.js.map +1 -1
- package/dist/components/ui/GenericRadioButtons/GenericRadioButtons.js +1 -1
- package/dist/components/ui/GenericRadioButtons/GenericRadioButtons.js.map +1 -1
- package/dist/components/ui/GenericTable/GenericTable.cjs.js +3 -3
- package/dist/components/ui/GenericTable/GenericTable.cjs.js.map +1 -1
- package/dist/components/ui/GenericTable/GenericTable.js +2 -2
- package/dist/components/ui/GenericTable/GenericTable.js.map +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.cjs.js +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.cjs.js.map +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.js +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.js.map +1 -1
- package/dist/components/ui/GenericTableTitle/GenericTableTitle.cjs.js +1 -1
- package/dist/components/ui/GenericTableTitle/GenericTableTitle.cjs.js.map +1 -1
- package/dist/components/ui/GenericTableTitle/GenericTableTitle.js +1 -1
- package/dist/components/ui/GenericTableTitle/GenericTableTitle.js.map +1 -1
- package/dist/components/ui/PageLayout/PageLayout.cjs.js +1 -1
- package/dist/components/ui/PageLayout/PageLayout.cjs.js.map +1 -1
- package/dist/components/ui/PageLayout/PageLayout.js +1 -1
- package/dist/components/ui/PageLayout/PageLayout.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material/Chip"),o=require("@mui/material/styles");const l=o.styled(r,{shouldForwardProp:e=>"colour"!==e&&"rounded"!==e})((({theme:e,colour:r,rounded:o})=>({backgroundColor:"blue"===r?e.palette.flippyBlue.light:"default",borderRadius:o?"100px":"5px"}))),d=o.styled(r,{shouldForwardProp:e=>"colour"!==e&&"rounded"!==e})((({theme:e,colour:r,rounded:o})=>({borderColor:"blue"===r?e.palette.flippyBlue.dark:"default",borderRadius:o?"100px":"5px"})));module.exports=({label:r,color:o="default",size:u="medium",variant:i="filled",icon:a,rounded:t=!0})=>"outlined"===i?e.jsx(d,{icon:a,label:r,colour:o,size:u,variant:"outlined",rounded:t}):e.jsx(l,{icon:a,label:r,colour:o,size:u,variant:"filled",rounded:t});
|
|
2
2
|
//# sourceMappingURL=Chip.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.cjs.js","sources":["../../../../src/components/ui/Chip/Chip.tsx"],"sourcesContent":["import MuiChip, { ChipProps as MuiChipProps } from '@mui/material/Chip';\nimport { styled } from '@mui/material/styles';\n\nexport type ChipProps = {\n label: string;\n color?: 'default' | 'blue';\n size?: MuiChipProps['size'];\n variant?: MuiChipProps['variant'];\n icon?: MuiChipProps['icon'];\n rounded?: boolean;\n};\n\nconst StyledFilledChip = styled(MuiChip)<{ colour: string; rounded: boolean }>(({ theme, colour, rounded }) => ({\n backgroundColor: colour === 'blue' ? theme.palette.flippyBlue.light : 'default',\n borderRadius: rounded ? '100px' : '5px',\n}));\n\nconst StyledOutlinedChip = styled(MuiChip)<{ colour: string; rounded: boolean }>(({ theme, colour, rounded }) => ({\n borderColor: colour === 'blue' ? theme.palette.flippyBlue.dark : 'default',\n borderRadius: rounded ? '100px' : '5px',\n}));\n\nconst Chip = ({ label, color = 'default', size = 'medium', variant = 'filled', icon = undefined, rounded = true }: ChipProps) => {\n if (variant === 'outlined') {\n return <StyledOutlinedChip icon={icon} label={label} colour={color} size={size} variant=\"outlined\" rounded={rounded} />;\n }\n return <StyledFilledChip icon={icon} label={label} colour={color} size={size} variant=\"filled\" rounded={rounded} />;\n};\n\nexport default Chip;\n"],"names":["StyledFilledChip","styled","MuiChip","theme","colour","rounded","backgroundColor","palette","flippyBlue","light","borderRadius","StyledOutlinedChip","borderColor","dark","label","color","size","variant","icon","_jsx"],"mappings":"kHAYA,MAAMA,EAAmBC,EAAMA,OAACC,
|
|
1
|
+
{"version":3,"file":"Chip.cjs.js","sources":["../../../../src/components/ui/Chip/Chip.tsx"],"sourcesContent":["import MuiChip, { ChipProps as MuiChipProps } from '@mui/material/Chip';\nimport { styled } from '@mui/material/styles';\n\nexport type ChipProps = {\n label: string;\n color?: 'default' | 'blue';\n size?: MuiChipProps['size'];\n variant?: MuiChipProps['variant'];\n icon?: MuiChipProps['icon'];\n rounded?: boolean;\n};\n\nconst StyledFilledChip = styled(MuiChip, {\n shouldForwardProp: (prop) => prop !== 'colour' && prop !== 'rounded',\n})<{ colour: string; rounded: boolean }>(({ theme, colour, rounded }) => ({\n backgroundColor: colour === 'blue' ? theme.palette.flippyBlue.light : 'default',\n borderRadius: rounded ? '100px' : '5px',\n}));\n\nconst StyledOutlinedChip = styled(MuiChip, {\n shouldForwardProp: (prop) => prop !== 'colour' && prop !== 'rounded',\n})<{ colour: string; rounded: boolean }>(({ theme, colour, rounded }) => ({\n borderColor: colour === 'blue' ? theme.palette.flippyBlue.dark : 'default',\n borderRadius: rounded ? '100px' : '5px',\n}));\n\nconst Chip = ({ label, color = 'default', size = 'medium', variant = 'filled', icon = undefined, rounded = true }: ChipProps) => {\n if (variant === 'outlined') {\n return <StyledOutlinedChip icon={icon} label={label} colour={color} size={size} variant=\"outlined\" rounded={rounded} />;\n }\n return <StyledFilledChip icon={icon} label={label} colour={color} size={size} variant=\"filled\" rounded={rounded} />;\n};\n\nexport default Chip;\n"],"names":["StyledFilledChip","styled","MuiChip","shouldForwardProp","prop","theme","colour","rounded","backgroundColor","palette","flippyBlue","light","borderRadius","StyledOutlinedChip","borderColor","dark","label","color","size","variant","icon","_jsx"],"mappings":"kHAYA,MAAMA,EAAmBC,EAAMA,OAACC,EAAS,CACrCC,kBAAoBC,GAAkB,WAATA,GAA8B,YAATA,GAD7BH,EAEgB,EAAGI,QAAOC,SAAQC,cAAe,CACtEC,gBAA4B,SAAXF,EAAoBD,EAAMI,QAAQC,WAAWC,MAAQ,UACtEC,aAAcL,EAAU,QAAU,UAGhCM,EAAqBZ,EAAMA,OAACC,EAAS,CACvCC,kBAAoBC,GAAkB,WAATA,GAA8B,YAATA,GAD3BH,EAEc,EAAGI,QAAOC,SAAQC,cAAe,CACtEO,YAAwB,SAAXR,EAAoBD,EAAMI,QAAQC,WAAWK,KAAO,UACjEH,aAAcL,EAAU,QAAU,yBAGzB,EAAGS,QAAOC,QAAQ,UAAWC,OAAO,SAAUC,UAAU,SAAUC,OAAkBb,WAAU,KACvF,aAAZY,EACOE,EAAAA,IAACR,EAAkB,CAACO,KAAMA,EAAMJ,MAAOA,EAAOV,OAAQW,EAAOC,KAAMA,EAAMC,QAAQ,WAAWZ,QAASA,IAEzGc,EAAAA,IAACrB,EAAgB,CAACoB,KAAMA,EAAMJ,MAAOA,EAAOV,OAAQW,EAAOC,KAAMA,EAAMC,QAAQ,SAASZ,QAASA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import r from"@mui/material/Chip";import{styled as e}from"@mui/material/styles";const l=e(r,{shouldForwardProp:o=>"colour"!==o&&"rounded"!==o})((({theme:o,colour:r,rounded:e})=>({backgroundColor:"blue"===r?o.palette.flippyBlue.light:"default",borderRadius:e?"100px":"5px"}))),d=e(r,{shouldForwardProp:o=>"colour"!==o&&"rounded"!==o})((({theme:o,colour:r,rounded:e})=>({borderColor:"blue"===r?o.palette.flippyBlue.dark:"default",borderRadius:e?"100px":"5px"}))),u=({label:r,color:e="default",size:u="medium",variant:i="filled",icon:a,rounded:t=!0})=>"outlined"===i?o(d,{icon:a,label:r,colour:e,size:u,variant:"outlined",rounded:t}):o(l,{icon:a,label:r,colour:e,size:u,variant:"filled",rounded:t});export{u as default};
|
|
2
2
|
//# sourceMappingURL=Chip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.js","sources":["../../../../src/components/ui/Chip/Chip.tsx"],"sourcesContent":["import MuiChip, { ChipProps as MuiChipProps } from '@mui/material/Chip';\nimport { styled } from '@mui/material/styles';\n\nexport type ChipProps = {\n label: string;\n color?: 'default' | 'blue';\n size?: MuiChipProps['size'];\n variant?: MuiChipProps['variant'];\n icon?: MuiChipProps['icon'];\n rounded?: boolean;\n};\n\nconst StyledFilledChip = styled(MuiChip)<{ colour: string; rounded: boolean }>(({ theme, colour, rounded }) => ({\n backgroundColor: colour === 'blue' ? theme.palette.flippyBlue.light : 'default',\n borderRadius: rounded ? '100px' : '5px',\n}));\n\nconst StyledOutlinedChip = styled(MuiChip)<{ colour: string; rounded: boolean }>(({ theme, colour, rounded }) => ({\n borderColor: colour === 'blue' ? theme.palette.flippyBlue.dark : 'default',\n borderRadius: rounded ? '100px' : '5px',\n}));\n\nconst Chip = ({ label, color = 'default', size = 'medium', variant = 'filled', icon = undefined, rounded = true }: ChipProps) => {\n if (variant === 'outlined') {\n return <StyledOutlinedChip icon={icon} label={label} colour={color} size={size} variant=\"outlined\" rounded={rounded} />;\n }\n return <StyledFilledChip icon={icon} label={label} colour={color} size={size} variant=\"filled\" rounded={rounded} />;\n};\n\nexport default Chip;\n"],"names":["StyledFilledChip","styled","MuiChip","theme","colour","rounded","backgroundColor","palette","flippyBlue","light","borderRadius","StyledOutlinedChip","borderColor","dark","Chip","label","color","size","variant","icon","_jsx"],"mappings":"wHAYA,MAAMA,EAAmBC,EAAOC,
|
|
1
|
+
{"version":3,"file":"Chip.js","sources":["../../../../src/components/ui/Chip/Chip.tsx"],"sourcesContent":["import MuiChip, { ChipProps as MuiChipProps } from '@mui/material/Chip';\nimport { styled } from '@mui/material/styles';\n\nexport type ChipProps = {\n label: string;\n color?: 'default' | 'blue';\n size?: MuiChipProps['size'];\n variant?: MuiChipProps['variant'];\n icon?: MuiChipProps['icon'];\n rounded?: boolean;\n};\n\nconst StyledFilledChip = styled(MuiChip, {\n shouldForwardProp: (prop) => prop !== 'colour' && prop !== 'rounded',\n})<{ colour: string; rounded: boolean }>(({ theme, colour, rounded }) => ({\n backgroundColor: colour === 'blue' ? theme.palette.flippyBlue.light : 'default',\n borderRadius: rounded ? '100px' : '5px',\n}));\n\nconst StyledOutlinedChip = styled(MuiChip, {\n shouldForwardProp: (prop) => prop !== 'colour' && prop !== 'rounded',\n})<{ colour: string; rounded: boolean }>(({ theme, colour, rounded }) => ({\n borderColor: colour === 'blue' ? theme.palette.flippyBlue.dark : 'default',\n borderRadius: rounded ? '100px' : '5px',\n}));\n\nconst Chip = ({ label, color = 'default', size = 'medium', variant = 'filled', icon = undefined, rounded = true }: ChipProps) => {\n if (variant === 'outlined') {\n return <StyledOutlinedChip icon={icon} label={label} colour={color} size={size} variant=\"outlined\" rounded={rounded} />;\n }\n return <StyledFilledChip icon={icon} label={label} colour={color} size={size} variant=\"filled\" rounded={rounded} />;\n};\n\nexport default Chip;\n"],"names":["StyledFilledChip","styled","MuiChip","shouldForwardProp","prop","theme","colour","rounded","backgroundColor","palette","flippyBlue","light","borderRadius","StyledOutlinedChip","borderColor","dark","Chip","label","color","size","variant","icon","_jsx"],"mappings":"wHAYA,MAAMA,EAAmBC,EAAOC,EAAS,CACrCC,kBAAoBC,GAAkB,WAATA,GAA8B,YAATA,GAD7BH,EAEgB,EAAGI,QAAOC,SAAQC,cAAe,CACtEC,gBAA4B,SAAXF,EAAoBD,EAAMI,QAAQC,WAAWC,MAAQ,UACtEC,aAAcL,EAAU,QAAU,UAGhCM,EAAqBZ,EAAOC,EAAS,CACvCC,kBAAoBC,GAAkB,WAATA,GAA8B,YAATA,GAD3BH,EAEc,EAAGI,QAAOC,SAAQC,cAAe,CACtEO,YAAwB,SAAXR,EAAoBD,EAAMI,QAAQC,WAAWK,KAAO,UACjEH,aAAcL,EAAU,QAAU,UAGhCS,EAAO,EAAGC,QAAOC,QAAQ,UAAWC,OAAO,SAAUC,UAAU,SAAUC,OAAkBd,WAAU,KACvF,aAAZa,EACOE,EAACT,EAAkB,CAACQ,KAAMA,EAAMJ,MAAOA,EAAOX,OAAQY,EAAOC,KAAMA,EAAMC,QAAQ,WAAWb,QAASA,IAEzGe,EAACtB,EAAgB,CAACqB,KAAMA,EAAMJ,MAAOA,EAAOX,OAAQY,EAAOC,KAAMA,EAAMC,QAAQ,SAASb,QAASA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material"),t=require("formik"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material"),t=require("formik"),i=require("../../custom-hooks/useRenderValidText.cjs.js"),l=require("./FormItemLayout.cjs.js");module.exports=({label:o,fieldName:n,options:a,placeholder:s,getOptionLabel:d,validation:u,onChange:p,onInputChange:m,isOptionEqualToValue:h,onScroll:c,layout:g="horizontal",variant:x="outlined",disabled:v=!1,loading:j=!1,required:b=!1,multiple:q=!1,limitTags:T})=>{const f=()=>e.jsx(t.Field,{name:n,validate:u,children:({field:t,form:l})=>{const{errors:u,touched:f,isSubmitting:y}=l,F=u[t.name],I=!!F&&f[t.name],P=i({fieldError:F,showError:I,touched:!!f[t.name],value:t.value});return e.jsx(r.Autocomplete,{options:a,getOptionLabel:d,isOptionEqualToValue:h,onChange:(e,r)=>{l.setFieldValue(n,r),p&&p(e,r)},onInputChange:m,disabled:y||v,fullWidth:!0,value:t.value,loading:j,renderInput:t=>e.jsx(r.TextField,{...t,label:"standard"===x?void 0:o,variant:x,"data-testid":`text-field-${n}`,fullWidth:!0,style:{paddingRight:"horizontal"===g?16:0},placeholder:s||void 0,required:b,error:I,helperText:P,FormHelperTextProps:{children:" ",style:{textAlign:"right"}},InputProps:{...t.InputProps,endAdornment:e.jsxs(e.Fragment,{children:[j&&e.jsx(r.CircularProgress,{color:"inherit",size:25}),t.InputProps.endAdornment]})}}),ListboxProps:{onScroll:c},multiple:q,limitTags:q?T??2:void 0})}});return"vertical"===g?e.jsxs(e.Fragment,{children:["standard"===x&&e.jsx(r.Typography,{variant:"subtitle1",component:"h3",color:"textPrimary",children:o}),f()]}):e.jsx(l,{label:o,children:f()})};
|
|
2
2
|
//# sourceMappingURL=GenericAutocompleteField.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericAutocompleteField.cjs.js","sources":["../../../../src/components/ui/Form/GenericAutocompleteField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { TextFieldProps, Autocomplete, TextField, Typography, CircularProgress } from '@mui/material';\nimport { Field, FieldProps } from 'formik';\nimport { SyntheticEvent } from 'react';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport FormItemLayout from './FormItemLayout';\n\ntype Props = {\n label: string;\n fieldName: string;\n options:
|
|
1
|
+
{"version":3,"file":"GenericAutocompleteField.cjs.js","sources":["../../../../src/components/ui/Form/GenericAutocompleteField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { TextFieldProps, Autocomplete, TextField, Typography, CircularProgress } from '@mui/material';\nimport { Field, FieldProps } from 'formik';\nimport { SyntheticEvent } from 'react';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport FormItemLayout from './FormItemLayout';\n\ntype 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[]) => 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};\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}: Props<T>) => {\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\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 fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Autocomplete\n options={options}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n onChange={(e: SyntheticEvent, value: T[]) => {\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 disabled={isSubmitting || disabled}\n fullWidth\n value={field.value}\n loading={loading}\n renderInput={(params) => (\n <TextField\n {...params}\n label={variant === 'standard' ? undefined : label}\n variant={variant}\n data-testid={`text-field-${fieldName}`}\n fullWidth\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n placeholder={placeholder ? placeholder : undefined}\n required={required}\n error={showError}\n helperText={helperText}\n FormHelperTextProps={{\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n }}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {loading && <CircularProgress color=\"inherit\" size={25} />}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n />\n )}\n ListboxProps={{\n onScroll,\n }}\n multiple={multiple}\n limitTags={multiple ? (limitTags ?? 2) : undefined}\n />\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 GenericAutocompleteField;\n"],"names":["label","fieldName","options","placeholder","getOptionLabel","validation","onChange","onInputChange","isOptionEqualToValue","onScroll","layout","variant","disabled","loading","required","multiple","limitTags","renderField","_jsx","Field","name","validate","children","field","form","errors","touched","isSubmitting","fieldError","showError","helperText","useRenderValidText","value","Autocomplete","e","setFieldValue","fullWidth","renderInput","params","TextField","undefined","style","paddingRight","error","FormHelperTextProps","textAlign","InputProps","endAdornment","_jsxs","jsxs","_Fragment","jsx","CircularProgress","color","size","ListboxProps","Typography","component","FormItemLayout"],"mappings":"6MA2BiC,EAC7BA,QACAC,YACAC,UACAC,cACAC,iBACAC,aACAC,WACAC,gBACAC,uBACAC,WACAC,SAAS,aACTC,UAAU,WACVC,YAAW,EACXC,WAAU,EACVC,YAAW,EACXC,YAAW,EACXC,gBAEA,MAAMC,EAAc,IAEZC,MAACC,EAAAA,OAAMC,KAAMnB,EAAWoB,SAAUhB,EAAUiB,SACvC,EAAGC,QAAOC,WACP,MAAMC,OAAEA,EAAMC,QAAEA,EAAOC,aAAEA,GAAiBH,EACpCI,EAAaH,EAAOF,EAAMH,MAC1BS,I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|
import { TextFieldProps } from '@mui/material';
|
|
3
3
|
import { SyntheticEvent } from 'react';
|
|
4
4
|
|
|
5
|
-
type Props = {
|
|
5
|
+
type Props<T> = {
|
|
6
6
|
label: string;
|
|
7
7
|
fieldName: string;
|
|
8
|
-
options:
|
|
8
|
+
options: T[];
|
|
9
9
|
placeholder?: string;
|
|
10
|
-
getOptionLabel?: (option:
|
|
11
|
-
validation?: (value:
|
|
12
|
-
onChange?: (e: SyntheticEvent, value:
|
|
13
|
-
onInputChange?: (e: SyntheticEvent, value:
|
|
14
|
-
isOptionEqualToValue?: (option:
|
|
10
|
+
getOptionLabel?: (option: T) => string;
|
|
11
|
+
validation?: (value: T | T[]) => string | undefined;
|
|
12
|
+
onChange?: (e: SyntheticEvent, value: T | T[]) => void;
|
|
13
|
+
onInputChange?: (e: SyntheticEvent, value: string) => void;
|
|
14
|
+
isOptionEqualToValue?: (option: T, value: T) => boolean;
|
|
15
15
|
onScroll?: (e: React.UIEvent<HTMLUListElement, UIEvent>) => void;
|
|
16
16
|
layout?: 'horizontal' | 'vertical';
|
|
17
17
|
variant?: TextFieldProps['variant'];
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
loading?: boolean;
|
|
20
20
|
required?: boolean;
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
limitTags?: number;
|
|
21
23
|
};
|
|
22
|
-
declare const GenericAutocompleteField: ({ label, fieldName, options, placeholder, getOptionLabel, validation, onChange, onInputChange, isOptionEqualToValue, onScroll, layout, variant, disabled, loading, required, }: Props) => react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare const GenericAutocompleteField: <T>({ label, fieldName, options, placeholder, getOptionLabel, validation, onChange, onInputChange, isOptionEqualToValue, onScroll, layout, variant, disabled, loading, required, multiple, limitTags, }: Props<T>) => react_jsx_runtime.JSX.Element;
|
|
23
25
|
|
|
24
26
|
export { GenericAutocompleteField as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{Typography as r,Autocomplete as i,TextField as l,CircularProgress as n}from"@mui/material";import{Field as a}from"formik";import d from"../../custom-hooks/useRenderValidText.js";import s from"./FormItemLayout.js";const u=({label:u,fieldName:m,options:p,placeholder:h,getOptionLabel:c,validation:g,onChange:f,onInputChange:v,isOptionEqualToValue:b,onScroll:x,layout:I="horizontal",variant:T="outlined",disabled:P=!1,loading:y=!1,required:q=!1,multiple:C=!1,limitTags:E})=>{const L=()=>o(a,{name:m,validate:g,children:({field:r,form:a})=>{const{errors:s,touched:g,isSubmitting:L}=a,O=s[r.name],V=!!O&&g[r.name],j=d({fieldError:O,showError:V,touched:!!g[r.name],value:r.value});return o(i,{options:p,getOptionLabel:c,isOptionEqualToValue:b,onChange:(e,t)=>{a.setFieldValue(m,t),f&&f(e,t)},onInputChange:v,disabled:L||P,fullWidth:!0,value:r.value,loading:y,renderInput:r=>o(l,{...r,label:"standard"===T?void 0:u,variant:T,"data-testid":`text-field-${m}`,fullWidth:!0,style:{paddingRight:"horizontal"===I?16:0},placeholder:h||void 0,required:q,error:V,helperText:j,FormHelperTextProps:{children:" ",style:{textAlign:"right"}},InputProps:{...r.InputProps,endAdornment:e(t,{children:[y&&o(n,{color:"inherit",size:25}),r.InputProps.endAdornment]})}}),ListboxProps:{onScroll:x},multiple:C,limitTags:C?E??2:void 0})}});return"vertical"===I?e(t,{children:["standard"===T&&o(r,{variant:"subtitle1",component:"h3",color:"textPrimary",children:u}),L()]}):o(s,{label:u,children:L()})};export{u as default};
|
|
2
2
|
//# sourceMappingURL=GenericAutocompleteField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericAutocompleteField.js","sources":["../../../../src/components/ui/Form/GenericAutocompleteField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { TextFieldProps, Autocomplete, TextField, Typography, CircularProgress } from '@mui/material';\nimport { Field, FieldProps } from 'formik';\nimport { SyntheticEvent } from 'react';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport FormItemLayout from './FormItemLayout';\n\ntype Props = {\n label: string;\n fieldName: string;\n options:
|
|
1
|
+
{"version":3,"file":"GenericAutocompleteField.js","sources":["../../../../src/components/ui/Form/GenericAutocompleteField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { TextFieldProps, Autocomplete, TextField, Typography, CircularProgress } from '@mui/material';\nimport { Field, FieldProps } from 'formik';\nimport { SyntheticEvent } from 'react';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport FormItemLayout from './FormItemLayout';\n\ntype 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[]) => 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};\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}: Props<T>) => {\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\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 fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Autocomplete\n options={options}\n getOptionLabel={getOptionLabel}\n isOptionEqualToValue={isOptionEqualToValue}\n onChange={(e: SyntheticEvent, value: T[]) => {\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 disabled={isSubmitting || disabled}\n fullWidth\n value={field.value}\n loading={loading}\n renderInput={(params) => (\n <TextField\n {...params}\n label={variant === 'standard' ? undefined : label}\n variant={variant}\n data-testid={`text-field-${fieldName}`}\n fullWidth\n style={{ paddingRight: layout === 'horizontal' ? 16 : 0 }}\n placeholder={placeholder ? placeholder : undefined}\n required={required}\n error={showError}\n helperText={helperText}\n FormHelperTextProps={{\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n }}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {loading && <CircularProgress color=\"inherit\" size={25} />}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n />\n )}\n ListboxProps={{\n onScroll,\n }}\n multiple={multiple}\n limitTags={multiple ? (limitTags ?? 2) : undefined}\n />\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 GenericAutocompleteField;\n"],"names":["GenericAutocompleteField","label","fieldName","options","placeholder","getOptionLabel","validation","onChange","onInputChange","isOptionEqualToValue","onScroll","layout","variant","disabled","loading","required","multiple","limitTags","renderField","_jsx","Field","name","validate","children","field","form","errors","touched","isSubmitting","fieldError","showError","helperText","useRenderValidText","value","Autocomplete","e","setFieldValue","fullWidth","renderInput","params","TextField","undefined","style","paddingRight","error","FormHelperTextProps","textAlign","InputProps","endAdornment","_jsxs","_Fragment","CircularProgress","color","size","ListboxProps","Typography","component","FormItemLayout"],"mappings":"4RA2BM,MAAAA,EAA2B,EAC7BC,QACAC,Y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EIsC,EAAAC,EAAA,CAAA3B,SAAA,CACiB,aAAZX,GACGO,EAACoC,EAAU,CAAC3C,QAAQ,YAAY4C,UAAU,KAAKJ,MAAM,cAChD7B,SAAAtB,IAGRiB,OAKNC,EAACsC,EAAc,CAACxD,MAAOA,EAAQsB,SAAAL,KAA+B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var t=require("react/jsx-runtime"),i=require("@mui/material/Button"),e=require("formik");module.exports=({fields:r,onSubmit:a,handleError:n,submitButtonText:u})=>{const s=r.reduce(((t,i)=>(t[i.fieldName]=i.defaultValue,t)),{});return t.jsx(e.Formik,{initialValues:s,onSubmit:async t=>{try{await a(t)}catch(t){n&&n(t)}},children:({isSubmitting:a})=>t.jsxs(e.Form,{children:[r.map(((i,e)=>t.jsx("div",{children:i.component},e))),t.jsx(i,{variant:"contained",type:"submit",disabled:a,sx:{marginTop:4},"data-testid":"submit-form-button",children:u})]})})};
|
|
2
2
|
//# sourceMappingURL=GenericFormContainer.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFormContainer.cjs.js","sources":["../../../../src/components/ui/Form/GenericFormContainer.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\nimport { Form, Formik } from 'formik';\n\ntype 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 = ({ fields, onSubmit, handleError, submitButtonText }: GenericFormContainerProps) => {\n const initialValues = fields.reduce((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) => field.component)}\n\n <Button variant=\"contained\" type=\"submit\" disabled={isSubmitting} sx={{ marginTop: 4 }} data-testid=\"submit-form-button\">\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","component","Button","variant","type","disabled","sx","marginTop"],"mappings":"qHAiB6B,EAAGA,SAAQC,WAAUC,cAAaC,uBAC3D,MAAMC,EAAgBJ,EAAOK,QAAO,CAACC,EAAKC,KACtCD,EAAIC,EAAMC,WAAaD,EAAME,aACtBH,IACR,CAAE,GAEL,OACII,EAAAA,IAACC,EAAAA,OAAM,CACHP,cAAeA,EACfH,SAAUW,MAAOC,IACb,UACUZ,EAASY,EAClB,CAAC,MAAOC,GACDZ,GACAA,EAAYY,EAEnB,
|
|
1
|
+
{"version":3,"file":"GenericFormContainer.cjs.js","sources":["../../../../src/components/ui/Form/GenericFormContainer.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\nimport { Form, Formik } from 'formik';\n\ntype 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 = ({ fields, onSubmit, handleError, submitButtonText }: GenericFormContainerProps) => {\n const initialValues = fields.reduce((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 <div key={index}>{field.component}</div>\n ))}\n\n <Button variant=\"contained\" type=\"submit\" disabled={isSubmitting} sx={{ marginTop: 4 }} data-testid=\"submit-form-button\">\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","jsxs","Form","map","index","jsx","component","Button","variant","type","disabled","sx","marginTop"],"mappings":"qHAiB6B,EAAGA,SAAQC,WAAUC,cAAaC,uBAC3D,MAAMC,EAAgBJ,EAAOK,QAAO,CAACC,EAAKC,KACtCD,EAAIC,EAAMC,WAAaD,EAAME,aACtBH,IACR,CAAE,GAEL,OACII,EAAAA,IAACC,EAAAA,OAAM,CACHP,cAAeA,EACfH,SAAUW,MAAOC,IACb,UACUZ,EAASY,EAClB,CAAC,MAAOC,GACDZ,GACAA,EAAYY,EAEnB,GAGJC,SAAA,EAAGC,kBACAC,EAAAC,KAACC,OAAI,CAAAJ,SAAA,CACAf,EAAOoB,KAAI,CAACb,EAAOc,IAChBX,EAAAY,IAAA,MAAA,CAAAP,SAAkBR,EAAMgB,WAAdF,KAGdX,EAAAA,IAACc,EAAO,CAAAC,QAAQ,YAAYC,KAAK,SAASC,SAAUX,EAAcY,GAAI,CAAEC,UAAW,GAAiB,cAAA,qBAC/Fd,SAAAZ,QAKnB"}
|
|
@@ -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:u})=>{const d=n.reduce(((t,i)=>(t[i.fieldName]=i.defaultValue,t)),{});return t(r,{initialValues:d,onSubmit:async t=>{try{await m(t)}catch(t){o&&o(t)}},children:({isSubmitting:r})=>i(a,{children:[n.map((
|
|
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:u})=>{const d=n.reduce(((t,i)=>(t[i.fieldName]=i.defaultValue,t)),{});return t(r,{initialValues:d,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},e))),t(e,{variant:"contained",type:"submit",disabled:r,sx:{marginTop:4},"data-testid":"submit-form-button",children:u})]})})};export{n as default};
|
|
2
2
|
//# sourceMappingURL=GenericFormContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFormContainer.js","sources":["../../../../src/components/ui/Form/GenericFormContainer.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\nimport { Form, Formik } from 'formik';\n\ntype 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 = ({ fields, onSubmit, handleError, submitButtonText }: GenericFormContainerProps) => {\n const initialValues = fields.reduce((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) => field.component)}\n\n <Button variant=\"contained\" type=\"submit\" disabled={isSubmitting} sx={{ marginTop: 4 }} data-testid=\"submit-form-button\">\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","component","Button","variant","type","disabled","sx","marginTop"],"mappings":"gIAiBA,MAAMA,EAAuB,EAAGC,SAAQC,WAAUC,cAAaC,uBAC3D,MAAMC,EAAgBJ,EAAOK,QAAO,CAACC,EAAKC,KACtCD,EAAIC,EAAMC,WAAaD,EAAME,aACtBH,IACR,CAAE,GAEL,OACII,EAACC,EAAM,CACHP,cAAeA,EACfH,SAAUW,MAAOC,IACb,UACUZ,EAASY,EAClB,CAAC,MAAOC,GACDZ,GACAA,EAAYY,EAEnB,
|
|
1
|
+
{"version":3,"file":"GenericFormContainer.js","sources":["../../../../src/components/ui/Form/GenericFormContainer.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\nimport { Form, Formik } from 'formik';\n\ntype 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 = ({ fields, onSubmit, handleError, submitButtonText }: GenericFormContainerProps) => {\n const initialValues = fields.reduce((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 <div key={index}>{field.component}</div>\n ))}\n\n <Button variant=\"contained\" type=\"submit\" disabled={isSubmitting} sx={{ marginTop: 4 }} data-testid=\"submit-form-button\">\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","variant","type","disabled","sx","marginTop"],"mappings":"gIAiBA,MAAMA,EAAuB,EAAGC,SAAQC,WAAUC,cAAaC,uBAC3D,MAAMC,EAAgBJ,EAAOK,QAAO,CAACC,EAAKC,KACtCD,EAAIC,EAAMC,WAAaD,EAAME,aACtBH,IACR,CAAE,GAEL,OACII,EAACC,EAAM,CACHP,cAAeA,EACfH,SAAUW,MAAOC,IACb,UACUZ,EAASY,EAClB,CAAC,MAAOC,GACDZ,GACAA,EAAYY,EAEnB,GAGJC,SAAA,EAAGC,kBACAC,EAACC,EAAI,CAAAH,SAAA,CACAf,EAAOmB,KAAI,CAACZ,EAAOa,IAChBV,EAAA,MAAA,CAAAK,SAAkBR,EAAMc,WAAdD,KAGdV,EAACY,EAAO,CAAAC,QAAQ,YAAYC,KAAK,SAASC,SAAUT,EAAcU,GAAI,CAAEC,UAAW,GAAiB,cAAA,qBAC/FZ,SAAAZ,QAKnB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("formik"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("formik"),i=require("../Form/FormItemLayout.cjs.js"),a=require("@mui/material/Box"),t=require("@mui/material/Typography"),l=require("../../custom-hooks/useRenderValidText.cjs.js"),o=require("@mui/material/Radio"),s=require("@mui/material/FormControlLabel"),n=require("@mui/material/RadioGroup"),u=require("../Spacer/Spacer.cjs.js"),d=require("@mui/material/styles");const m=d.styled(a)((({theme:e})=>({marginLeft:e.spacing(4)}))),c=d.styled(t,{shouldForwardProp:e=>"showError"!==e})((({theme:e,showError:r})=>({color:r?e.palette.error.main:"inherit",textAlign:"right"})));module.exports=({label:d,fieldName:h,layout:x,onChange:j,options:p,showHelperTextWhenValid:v=!1})=>{const g=()=>e.jsx(r.Field,{name:h,children:({field:r,form:i})=>{const{errors:t,touched:d,isSubmitting:h}=i,g=t[r.name],q=!!g&&d[r.name],b=l({fieldError:g,showError:q,touched:!!d[r.name],value:r.value});return e.jsxs(a,{sx:{paddingRight:"horizontal"===x?"16px":0},children:[e.jsx(n,{name:"radio-buttons-group",value:r.value,onChange:e=>{i.setFieldValue(r.name,e.target.value),j&&j(e)},children:p.map((i=>e.jsxs("div",{children:[e.jsx(s,{value:i.value,control:e.jsx(o,{}),label:i.label,disabled:h||i.disabled}),i.selectedContent&&r.value===i.value&&e.jsxs(m,{children:[i.selectedContent,e.jsx(u,{size:8,variant:"horizontal"})]})]},i.value)))}),e.jsx(c,{showError:q,children:q||v?b:void 0})]})}});return"vertical"===x?e.jsxs(e.Fragment,{children:[d&&e.jsx(t,{variant:"subtitle1",component:"h3",color:"textPrimary",children:d}),g()]}):e.jsx(i,{label:d,children:g()})};
|
|
2
2
|
//# sourceMappingURL=GenericRadioButtons.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericRadioButtons.cjs.js","sources":["../../../../src/components/ui/GenericRadioButtons/GenericRadioButtons.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport Radio from '@mui/material/Radio';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport RadioGroup from '@mui/material/RadioGroup';\nimport { ChangeEvent, ReactNode } from 'react';\nimport { Spacer } from '../Spacer';\nimport { styled } from '@mui/material/styles';\n\ntype Props = {\n label?: string;\n fieldName: string;\n layout?: 'horizontal' | 'vertical';\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n showHelperTextWhenValid?: boolean;\n options: {\n label: string;\n value: string;\n disabled?: boolean;\n selectedContent?: ReactNode;\n }[];\n};\n\nconst StyledSelectedContent = styled(Box)(({ theme }) => ({\n marginLeft: theme.spacing(4),\n}));\n\nconst StyledHelperText = styled(Typography)<{ showError: boolean }>(({ theme, showError }) => ({\n color: showError ? theme.palette.error.main : 'inherit',\n textAlign: 'right',\n}));\n\nconst GenericRadioButtons = ({ label, fieldName, layout, onChange, options, showHelperTextWhenValid = false }: Props) => {\n const renderField = () => {\n return (\n <Field name={fieldName}>\n {({ field, form }: FieldProps) => {\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 fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <RadioGroup\n
|
|
1
|
+
{"version":3,"file":"GenericRadioButtons.cjs.js","sources":["../../../../src/components/ui/GenericRadioButtons/GenericRadioButtons.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport Radio from '@mui/material/Radio';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport RadioGroup from '@mui/material/RadioGroup';\nimport { ChangeEvent, ReactNode } from 'react';\nimport { Spacer } from '../Spacer';\nimport { styled } from '@mui/material/styles';\n\ntype Props = {\n label?: string;\n fieldName: string;\n layout?: 'horizontal' | 'vertical';\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n showHelperTextWhenValid?: boolean;\n options: {\n label: string;\n value: string;\n disabled?: boolean;\n selectedContent?: ReactNode;\n }[];\n};\n\nconst StyledSelectedContent = styled(Box)(({ theme }) => ({\n marginLeft: theme.spacing(4),\n}));\n\nconst StyledHelperText = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'showError',\n})<{ showError: boolean }>(({ theme, showError }) => ({\n color: showError ? theme.palette.error.main : 'inherit',\n textAlign: 'right',\n}));\n\nconst GenericRadioButtons = ({ label, fieldName, layout, onChange, options, showHelperTextWhenValid = false }: Props) => {\n const renderField = () => {\n return (\n <Field name={fieldName}>\n {({ field, form }: FieldProps) => {\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 fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <RadioGroup\n name=\"radio-buttons-group\"\n value={field.value}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(field.name, e.target.value);\n if (onChange) {\n onChange(e);\n }\n }}\n >\n {options.map((option) => (\n <div key={option.value}>\n <FormControlLabel\n value={option.value}\n control={<Radio />}\n label={option.label}\n disabled={isSubmitting || option.disabled}\n />\n {option.selectedContent && field.value === option.value && (\n <StyledSelectedContent>\n {option.selectedContent}\n <Spacer size={8} variant=\"horizontal\" />\n </StyledSelectedContent>\n )}\n </div>\n ))}\n </RadioGroup>\n <StyledHelperText showError={showError}>\n {showError ? helperText : showHelperTextWhenValid ? helperText : undefined}\n </StyledHelperText>\n </Box>\n );\n }}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {label && (\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 GenericRadioButtons;\n"],"names":["StyledSelectedContent","styled","Box","theme","marginLeft","spacing","StyledHelperText","Typography","shouldForwardProp","prop","showError","color","palette","error","main","textAlign","label","fieldName","layout","onChange","options","showHelperTextWhenValid","renderField","_jsx","jsx","Field","name","children","field","form","errors","touched","isSubmitting","fieldError","helperText","useRenderValidText","value","_jsxs","jsxs","sx","paddingRight","RadioGroup","e","setFieldValue","target","map","option","FormControlLabel","control","Radio","disabled","selectedContent","Spacer","size","variant","undefined","_Fragment","component","FormItemLayout"],"mappings":"waA0BA,MAAMA,EAAwBC,EAAAA,OAAOC,EAAPD,EAAY,EAAGE,YAAa,CACtDC,WAAYD,EAAME,QAAQ,OAGxBC,EAAmBL,EAAMA,OAACM,EAAY,CACxCC,kBAAoBC,GAAkB,cAATA,GADRR,EAEE,EAAGE,QAAOO,gBAAiB,CAClDC,MAAOD,EAAYP,EAAMS,QAAQC,MAAMC,KAAO,UAC9CC,UAAW,2BAGa,EAAGC,QAAOC,YAAWC,SAAQC,WAAUC,UAASC,2BAA0B,MAClG,MAAMC,EAAc,IAEZC,EAAAC,IAACC,QAAK,CAACC,KAAMT,EACRU,SAAA,EAAGC,QAAOC,WACP,MAAMC,OAAEA,EAAMC,QAAEA,EAAOC,aAAEA,GAAiBH,EACpCI,EAAaH,EAAOF,EAAMF,MAC1BhB,IAAcuB,GAAeF,EAAQH,EAAMF,MAC3CQ,EAAaC,EAAmB,CAClCF,aACAvB,YACAqB,UAAWA,EAAQH,EAAMF,MACzBU,MAAOR,EAAMQ,QAGjB,OACIC,EAACC,KAAApC,GAAIqC,GAAI,CAAEC,aAAyB,eAAXtB,EAA0B,OAAS,GAAGS,SAAA,CAC3DJ,MAACkB,EAAU,CACPf,KAAK,sBACLU,MAAOR,EAAMQ,MACbjB,SAAWuB,IAEPb,EAAKc,cAAcf,EAAMF,KAAMgB,EAAEE,OAAOR,OACpCjB,GACAA,EAASuB,EACZ,EACJf,SAEAP,EAAQyB,KAAKC,GACVT,EAAAC,KAAA,MAAA,CAAAX,SAAA,CACIJ,EAAAA,IAACwB,EAAgB,CACbX,MAAOU,EAAOV,MACdY,QAASzB,EAAAA,IAAC0B,EAAK,CAAA,GACfjC,MAAO8B,EAAO9B,MACdkC,SAAUlB,GAAgBc,EAAOI,WAEpCJ,EAAOK,iBAAmBvB,EAAMQ,QAAUU,EAAOV,OAC9CC,OAACrC,EAAqB,CAAA2B,SAAA,CACjBmB,EAAOK,gBACR5B,MAAC6B,EAAM,CAACC,KAAM,EAAGC,QAAQ,oBAV3BR,EAAOV,WAgBzBb,MAACjB,EAAgB,CAACI,UAAWA,EAASiB,SACjCjB,GAAyBW,EAAba,OAAoDqB,MAG3E,IAMlB,MAAe,aAAXrC,EAEImB,EAAAC,KAAAkB,WAAA,CAAA7B,SAAA,CACKX,GACGO,MAAChB,EAAU,CAAC+C,QAAQ,YAAYG,UAAU,KAAK9C,MAAM,cAAagB,SAC7DX,IAGRM,OAKNC,EAAAC,IAACkC,EAAc,CAAC1C,MAAOA,EAAQW,SAAAL,KAA+B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as r,Fragment as e,jsx as o}from"react/jsx-runtime";import{Field as t}from"formik";import a from"../Form/FormItemLayout.js";import i from"@mui/material/Box";import l from"@mui/material/Typography";import m from"../../custom-hooks/useRenderValidText.js";import n from"@mui/material/Radio";import d from"@mui/material/FormControlLabel";import u from"@mui/material/RadioGroup";import s from"../Spacer/Spacer.js";import{styled as h}from"@mui/material/styles";const p=h(i)((({theme:r})=>({marginLeft:r.spacing(4)}))),c=h(l,{shouldForwardProp:r=>"showError"!==r})((({theme:r,showError:e})=>({color:e?r.palette.error.main:"inherit",textAlign:"right"}))),f=({label:h,fieldName:f,layout:v,onChange:g,options:b,showHelperTextWhenValid:x=!1})=>{const w=()=>o(t,{name:f,children:({field:e,form:t})=>{const{errors:a,touched:l,isSubmitting:h}=t,f=a[e.name],w=!!f&&l[e.name],y=m({fieldError:f,showError:w,touched:!!l[e.name],value:e.value});return r(i,{sx:{paddingRight:"horizontal"===v?"16px":0},children:[o(u,{name:"radio-buttons-group",value:e.value,onChange:r=>{t.setFieldValue(e.name,r.target.value),g&&g(r)},children:b.map((t=>r("div",{children:[o(d,{value:t.value,control:o(n,{}),label:t.label,disabled:h||t.disabled}),t.selectedContent&&e.value===t.value&&r(p,{children:[t.selectedContent,o(s,{size:8,variant:"horizontal"})]})]},t.value)))}),o(c,{showError:w,children:w||x?y:void 0})]})}});return"vertical"===v?r(e,{children:[h&&o(l,{variant:"subtitle1",component:"h3",color:"textPrimary",children:h}),w()]}):o(a,{label:h,children:w()})};export{f as default};
|
|
2
2
|
//# sourceMappingURL=GenericRadioButtons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericRadioButtons.js","sources":["../../../../src/components/ui/GenericRadioButtons/GenericRadioButtons.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport Radio from '@mui/material/Radio';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport RadioGroup from '@mui/material/RadioGroup';\nimport { ChangeEvent, ReactNode } from 'react';\nimport { Spacer } from '../Spacer';\nimport { styled } from '@mui/material/styles';\n\ntype Props = {\n label?: string;\n fieldName: string;\n layout?: 'horizontal' | 'vertical';\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n showHelperTextWhenValid?: boolean;\n options: {\n label: string;\n value: string;\n disabled?: boolean;\n selectedContent?: ReactNode;\n }[];\n};\n\nconst StyledSelectedContent = styled(Box)(({ theme }) => ({\n marginLeft: theme.spacing(4),\n}));\n\nconst StyledHelperText = styled(Typography)<{ showError: boolean }>(({ theme, showError }) => ({\n color: showError ? theme.palette.error.main : 'inherit',\n textAlign: 'right',\n}));\n\nconst GenericRadioButtons = ({ label, fieldName, layout, onChange, options, showHelperTextWhenValid = false }: Props) => {\n const renderField = () => {\n return (\n <Field name={fieldName}>\n {({ field, form }: FieldProps) => {\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 fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <RadioGroup\n
|
|
1
|
+
{"version":3,"file":"GenericRadioButtons.js","sources":["../../../../src/components/ui/GenericRadioButtons/GenericRadioButtons.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport Radio from '@mui/material/Radio';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport RadioGroup from '@mui/material/RadioGroup';\nimport { ChangeEvent, ReactNode } from 'react';\nimport { Spacer } from '../Spacer';\nimport { styled } from '@mui/material/styles';\n\ntype Props = {\n label?: string;\n fieldName: string;\n layout?: 'horizontal' | 'vertical';\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n showHelperTextWhenValid?: boolean;\n options: {\n label: string;\n value: string;\n disabled?: boolean;\n selectedContent?: ReactNode;\n }[];\n};\n\nconst StyledSelectedContent = styled(Box)(({ theme }) => ({\n marginLeft: theme.spacing(4),\n}));\n\nconst StyledHelperText = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'showError',\n})<{ showError: boolean }>(({ theme, showError }) => ({\n color: showError ? theme.palette.error.main : 'inherit',\n textAlign: 'right',\n}));\n\nconst GenericRadioButtons = ({ label, fieldName, layout, onChange, options, showHelperTextWhenValid = false }: Props) => {\n const renderField = () => {\n return (\n <Field name={fieldName}>\n {({ field, form }: FieldProps) => {\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 fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <RadioGroup\n name=\"radio-buttons-group\"\n value={field.value}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n form.setFieldValue(field.name, e.target.value);\n if (onChange) {\n onChange(e);\n }\n }}\n >\n {options.map((option) => (\n <div key={option.value}>\n <FormControlLabel\n value={option.value}\n control={<Radio />}\n label={option.label}\n disabled={isSubmitting || option.disabled}\n />\n {option.selectedContent && field.value === option.value && (\n <StyledSelectedContent>\n {option.selectedContent}\n <Spacer size={8} variant=\"horizontal\" />\n </StyledSelectedContent>\n )}\n </div>\n ))}\n </RadioGroup>\n <StyledHelperText showError={showError}>\n {showError ? helperText : showHelperTextWhenValid ? helperText : undefined}\n </StyledHelperText>\n </Box>\n );\n }}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {label && (\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 GenericRadioButtons;\n"],"names":["StyledSelectedContent","styled","Box","theme","marginLeft","spacing","StyledHelperText","Typography","shouldForwardProp","prop","showError","color","palette","error","main","textAlign","GenericRadioButtons","label","fieldName","layout","onChange","options","showHelperTextWhenValid","renderField","_jsx","Field","name","children","field","form","errors","touched","isSubmitting","fieldError","helperText","useRenderValidText","value","_jsxs","sx","paddingRight","RadioGroup","e","setFieldValue","target","map","option","FormControlLabel","control","Radio","disabled","selectedContent","Spacer","size","variant","undefined","_Fragment","component","FormItemLayout"],"mappings":"mdA0BA,MAAMA,EAAwBC,EAAOC,EAAPD,EAAY,EAAGE,YAAa,CACtDC,WAAYD,EAAME,QAAQ,OAGxBC,EAAmBL,EAAOM,EAAY,CACxCC,kBAAoBC,GAAkB,cAATA,GADRR,EAEE,EAAGE,QAAOO,gBAAiB,CAClDC,MAAOD,EAAYP,EAAMS,QAAQC,MAAMC,KAAO,UAC9CC,UAAW,YAGTC,EAAsB,EAAGC,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
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/styles"),r=require("@mui/material/Table"),a=require("@mui/material/TableCell"),l=require("@mui/material/TableHead"),t=require("@mui/material/TableRow"),s=require("@mui/material/useMediaQuery"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/styles"),r=require("@mui/material/Table"),a=require("@mui/material/TableCell"),l=require("@mui/material/TableHead"),t=require("@mui/material/TableRow"),s=require("@mui/material/useMediaQuery"),o=require("../GenericTableTitle/GenericTableTitle.cjs.js"),d=require("./HighlightScrollbar.cjs.js"),n=require("../GenericTableBody/GenericTableBody.cjs.js"),c=require("@mui/material/Card");const u=i.styled("div")`
|
|
2
2
|
overflow-x: auto;
|
|
3
3
|
&::-webkit-scrollbar {
|
|
4
4
|
padding: 2px 0;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
background: #f5f5f5;
|
|
13
13
|
border-radius: 3px;
|
|
14
14
|
}
|
|
15
|
-
`,m=i.styled(a)((({theme:e,isSticky:i})=>({fontSize:13,padding:e.spacing(1.25,2),whiteSpace:"nowrap",position:i?"sticky":"relative",zIndex:i?1:"auto"}))),b=i.styled(c)`
|
|
15
|
+
`,m=i.styled(a,{shouldForwardProp:e=>"isSticky"!==e})((({theme:e,isSticky:i})=>({fontSize:13,padding:e.spacing(1.25,2),whiteSpace:"nowrap",position:i?"sticky":"relative",zIndex:i?1:"auto"}))),b=i.styled(c)`
|
|
16
16
|
overflow: hidden;
|
|
17
|
-
`;module.exports=({data:a,title:c,subTitle:h,showTitle:
|
|
17
|
+
`;module.exports=({data:a,title:c,subTitle:h,showTitle:p=!0,onRowClick:x,loading:j,metadata:T})=>{const k=new Set(T.filter((e=>e.isVisible)).sort(((e,i)=>e.ordinal-i.ordinal)).map((e=>e.columnName))),w=T.reduce(((e,i)=>(e[i.columnName]=i,e)),{}),y=i.useTheme(),g=!s(y.breakpoints.up("sm")),f=g?"normal":"sticky";return e.jsxs(u,{children:[p&&e.jsx(o,{title:c,subTitle:h}),e.jsx(b,{children:e.jsx(d,{children:e.jsxs(r,{"aria-label":c,"data-testid":"generic-table"+(p?`-${c.replace(" ","-").toLowerCase()}`:""),children:[e.jsx(l,{children:e.jsx(t,{children:Array.from(k).map(((i,r)=>{const{columnName:a,columnTitle:l,align:t="left"}=w[i];return e.jsx(m,{align:t,isSticky:0===r&&!g,children:e.jsx("div",{children:e.jsx("span",{children:l})})},a)}))})}),e.jsx(n,{type:f,data:a,columns:k,onRowClick:x,loading:j,meta:w})]})})})]})};
|
|
18
18
|
//# sourceMappingURL=GenericTable.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTable.cjs.js","sources":["../../../../src/components/ui/GenericTable/GenericTable.tsx"],"sourcesContent":["import { styled, useTheme } from '@mui/material/styles';\n\nimport Table from '@mui/material/Table';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport useMediaQuery from '@mui/material/useMediaQuery';\nimport { GenericTableColumns } from './types';\nimport GenericTableTitle from '../GenericTableTitle/GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\nimport { GenericTableBody } from '../GenericTableBody';\nimport Card from '@mui/material/Card';\n\ntype GenericTableProps = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n metadata: GenericTableColumns[];\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n showTitle?: boolean;\n subTitle?: string;\n title?: string;\n};\n\nconst StyledContainer = styled('div')`\n overflow-x: auto;\n &::-webkit-scrollbar {\n padding: 2px 0;\n height: 6px;\n border: 1px solid #d5d5d5;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #f5f5f5;\n border-radius: 3px;\n }\n`;\n\nconst StyledTableCell = styled(TableCell)<{ isSticky: boolean }>(({ theme, isSticky }) => ({\n fontSize: 13,\n padding: theme.spacing(1.25, 2),\n whiteSpace: 'nowrap',\n position: isSticky ? 'sticky' : 'relative',\n zIndex: isSticky ? 1 : 'auto',\n}));\n\nconst StyledPaper = styled(Card)`\n overflow: hidden;\n`;\n\nconst GenericTable = ({ data, title, subTitle, showTitle = true, onRowClick, loading, metadata }: GenericTableProps) => {\n const columns = new Set(\n metadata\n .filter((m) => m.isVisible)\n .sort((a, b) => a.ordinal - b.ordinal)\n .map((m) => m.columnName),\n );\n const tableMeta = metadata.reduce<{ [key: string]: GenericTableColumns }>((obj, mData) => {\n obj[mData.columnName] = mData;\n return obj;\n }, {});\n\n const theme = useTheme();\n const isMobile = !useMediaQuery(theme.breakpoints.up('sm'));\n\n // We never want sticky on mobile - only on desktop\n const firstColumnStylePosition = isMobile ? 'normal' : 'sticky';\n\n const renderTableHeader = () => (\n <TableHead>\n <TableRow>\n {Array.from(columns).map((prop, idx) => {\n const { columnName, columnTitle, align = 'left' } = tableMeta[prop];\n return (\n <StyledTableCell key={columnName} align={align} isSticky={idx === 0 && !isMobile}>\n <div>\n <span>{columnTitle}</span>\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle title={title} subTitle={subTitle}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table aria-label={title} data-testid={`generic-table` + (showTitle ? `-${title.replace(' ', '-').toLowerCase()}` : '')}>\n {renderTableHeader()}\n <GenericTableBody\n type={firstColumnStylePosition}\n data={data}\n columns={columns}\n onRowClick={onRowClick}\n loading={loading}\n meta={tableMeta}\n />\n </Table>\n </HighlightScrollbar>\n </StyledPaper>\n </StyledContainer>\n );\n};\n\nexport default GenericTable;\n"],"names":["StyledContainer","styled","StyledTableCell","TableCell","theme","isSticky","fontSize","padding","spacing","whiteSpace","position","zIndex","StyledPaper","Card","data","title","subTitle","showTitle","onRowClick","loading","metadata","columns","Set","filter","m","isVisible","sort","a","b","ordinal","map","columnName","tableMeta","reduce","obj","mData","useTheme","isMobile","useMediaQuery","breakpoints","up","firstColumnStylePosition","_jsxs","jsxs","_jsx","GenericTableTitle","children","HighlightScrollbar","Table","replace","toLowerCase","jsx","TableHead","TableRow","Array","from","
|
|
1
|
+
{"version":3,"file":"GenericTable.cjs.js","sources":["../../../../src/components/ui/GenericTable/GenericTable.tsx"],"sourcesContent":["import { styled, useTheme } from '@mui/material/styles';\n\nimport Table from '@mui/material/Table';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport useMediaQuery from '@mui/material/useMediaQuery';\nimport { GenericTableColumns } from './types';\nimport GenericTableTitle from '../GenericTableTitle/GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\nimport { GenericTableBody } from '../GenericTableBody';\nimport Card from '@mui/material/Card';\n\ntype GenericTableProps = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n metadata: GenericTableColumns[];\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n showTitle?: boolean;\n subTitle?: string;\n title?: string;\n};\n\nconst StyledContainer = styled('div')`\n overflow-x: auto;\n &::-webkit-scrollbar {\n padding: 2px 0;\n height: 6px;\n border: 1px solid #d5d5d5;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #f5f5f5;\n border-radius: 3px;\n }\n`;\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'isSticky',\n})<{ isSticky: boolean }>(({ theme, isSticky }) => ({\n fontSize: 13,\n padding: theme.spacing(1.25, 2),\n whiteSpace: 'nowrap',\n position: isSticky ? 'sticky' : 'relative',\n zIndex: isSticky ? 1 : 'auto',\n}));\n\nconst StyledPaper = styled(Card)`\n overflow: hidden;\n`;\n\nconst GenericTable = ({ data, title, subTitle, showTitle = true, onRowClick, loading, metadata }: GenericTableProps) => {\n const columns = new Set(\n metadata\n .filter((m) => m.isVisible)\n .sort((a, b) => a.ordinal - b.ordinal)\n .map((m) => m.columnName),\n );\n const tableMeta = metadata.reduce<{ [key: string]: GenericTableColumns }>((obj, mData) => {\n obj[mData.columnName] = mData;\n return obj;\n }, {});\n\n const theme = useTheme();\n const isMobile = !useMediaQuery(theme.breakpoints.up('sm'));\n\n // We never want sticky on mobile - only on desktop\n const firstColumnStylePosition = isMobile ? 'normal' : 'sticky';\n\n const renderTableHeader = () => (\n <TableHead>\n <TableRow>\n {Array.from(columns).map((prop, idx) => {\n const { columnName, columnTitle, align = 'left' } = tableMeta[prop];\n return (\n <StyledTableCell key={columnName} align={align} isSticky={idx === 0 && !isMobile}>\n <div>\n <span>{columnTitle}</span>\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle title={title} subTitle={subTitle}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table aria-label={title} data-testid={`generic-table` + (showTitle ? `-${title.replace(' ', '-').toLowerCase()}` : '')}>\n {renderTableHeader()}\n <GenericTableBody\n type={firstColumnStylePosition}\n data={data}\n columns={columns}\n onRowClick={onRowClick}\n loading={loading}\n meta={tableMeta}\n />\n </Table>\n </HighlightScrollbar>\n </StyledPaper>\n </StyledContainer>\n );\n};\n\nexport default GenericTable;\n"],"names":["StyledContainer","styled","StyledTableCell","TableCell","shouldForwardProp","prop","theme","isSticky","fontSize","padding","spacing","whiteSpace","position","zIndex","StyledPaper","Card","data","title","subTitle","showTitle","onRowClick","loading","metadata","columns","Set","filter","m","isVisible","sort","a","b","ordinal","map","columnName","tableMeta","reduce","obj","mData","useTheme","isMobile","useMediaQuery","breakpoints","up","firstColumnStylePosition","_jsxs","jsxs","_jsx","GenericTableTitle","children","HighlightScrollbar","Table","replace","toLowerCase","jsx","TableHead","TableRow","Array","from","idx","columnTitle","align","GenericTableBody","type","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0D,MAAOA,EAAOrD,SAAkB,IAARmD,IAAcnB,EACpES,SAAAF,EAAAA,IAAA,MAAA,CAAAE,SACIF,MAAO,OAAA,CAAAE,SAAAW,OAFO1B,EAKxB,QAaEa,EAAAO,IAACQ,EACG,CAAAC,KAAMnB,EACN3B,KAAMA,EACNO,QAASA,EACTH,WAAYA,EACZC,QAASA,EACT0C,KAAM7B,aAM5B"}
|
|
@@ -12,7 +12,7 @@ import{jsxs as e,jsx as i}from"react/jsx-runtime";import{styled as r,useTheme as
|
|
|
12
12
|
background: #f5f5f5;
|
|
13
13
|
border-radius: 3px;
|
|
14
14
|
}
|
|
15
|
-
`,b=r(l)((({theme:e,isSticky:i})=>({fontSize:13,padding:e.spacing(1.25,2),whiteSpace:"nowrap",position:i?"sticky":"relative",zIndex:i?1:"auto"}))),f=r(p)`
|
|
15
|
+
`,b=r(l,{shouldForwardProp:e=>"isSticky"!==e})((({theme:e,isSticky:i})=>({fontSize:13,padding:e.spacing(1.25,2),whiteSpace:"nowrap",position:i?"sticky":"relative",zIndex:i?1:"auto"}))),f=r(p)`
|
|
16
16
|
overflow: hidden;
|
|
17
|
-
`,h=({data:r,title:l,subTitle:p,showTitle:h=!0,onRowClick:
|
|
17
|
+
`,h=({data:r,title:l,subTitle:p,showTitle:h=!0,onRowClick:k,loading:w,metadata:T})=>{const g=new Set(T.filter((e=>e.isVisible)).sort(((e,i)=>e.ordinal-i.ordinal)).map((e=>e.columnName))),y=T.reduce(((e,i)=>(e[i.columnName]=i,e)),{}),x=a(),S=!n(x.breakpoints.up("sm")),v=S?"normal":"sticky";return e(u,{children:[h&&i(d,{title:l,subTitle:p}),i(f,{children:i(c,{children:e(t,{"aria-label":l,"data-testid":"generic-table"+(h?`-${l.replace(" ","-").toLowerCase()}`:""),children:[i(o,{children:i(m,{children:Array.from(g).map(((e,r)=>{const{columnName:a,columnTitle:t,align:l="left"}=y[e];return i(b,{align:l,isSticky:0===r&&!S,children:i("div",{children:i("span",{children:t})})},a)}))})}),i(s,{type:v,data:r,columns:g,onRowClick:k,loading:w,meta:y})]})})})]})};export{h as default};
|
|
18
18
|
//# sourceMappingURL=GenericTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTable.js","sources":["../../../../src/components/ui/GenericTable/GenericTable.tsx"],"sourcesContent":["import { styled, useTheme } from '@mui/material/styles';\n\nimport Table from '@mui/material/Table';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport useMediaQuery from '@mui/material/useMediaQuery';\nimport { GenericTableColumns } from './types';\nimport GenericTableTitle from '../GenericTableTitle/GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\nimport { GenericTableBody } from '../GenericTableBody';\nimport Card from '@mui/material/Card';\n\ntype GenericTableProps = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n metadata: GenericTableColumns[];\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n showTitle?: boolean;\n subTitle?: string;\n title?: string;\n};\n\nconst StyledContainer = styled('div')`\n overflow-x: auto;\n &::-webkit-scrollbar {\n padding: 2px 0;\n height: 6px;\n border: 1px solid #d5d5d5;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #f5f5f5;\n border-radius: 3px;\n }\n`;\n\nconst StyledTableCell = styled(TableCell)<{ isSticky: boolean }>(({ theme, isSticky }) => ({\n fontSize: 13,\n padding: theme.spacing(1.25, 2),\n whiteSpace: 'nowrap',\n position: isSticky ? 'sticky' : 'relative',\n zIndex: isSticky ? 1 : 'auto',\n}));\n\nconst StyledPaper = styled(Card)`\n overflow: hidden;\n`;\n\nconst GenericTable = ({ data, title, subTitle, showTitle = true, onRowClick, loading, metadata }: GenericTableProps) => {\n const columns = new Set(\n metadata\n .filter((m) => m.isVisible)\n .sort((a, b) => a.ordinal - b.ordinal)\n .map((m) => m.columnName),\n );\n const tableMeta = metadata.reduce<{ [key: string]: GenericTableColumns }>((obj, mData) => {\n obj[mData.columnName] = mData;\n return obj;\n }, {});\n\n const theme = useTheme();\n const isMobile = !useMediaQuery(theme.breakpoints.up('sm'));\n\n // We never want sticky on mobile - only on desktop\n const firstColumnStylePosition = isMobile ? 'normal' : 'sticky';\n\n const renderTableHeader = () => (\n <TableHead>\n <TableRow>\n {Array.from(columns).map((prop, idx) => {\n const { columnName, columnTitle, align = 'left' } = tableMeta[prop];\n return (\n <StyledTableCell key={columnName} align={align} isSticky={idx === 0 && !isMobile}>\n <div>\n <span>{columnTitle}</span>\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle title={title} subTitle={subTitle}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table aria-label={title} data-testid={`generic-table` + (showTitle ? `-${title.replace(' ', '-').toLowerCase()}` : '')}>\n {renderTableHeader()}\n <GenericTableBody\n type={firstColumnStylePosition}\n data={data}\n columns={columns}\n onRowClick={onRowClick}\n loading={loading}\n meta={tableMeta}\n />\n </Table>\n </HighlightScrollbar>\n </StyledPaper>\n </StyledContainer>\n );\n};\n\nexport default GenericTable;\n"],"names":["StyledContainer","styled","StyledTableCell","TableCell","theme","isSticky","fontSize","padding","spacing","whiteSpace","position","zIndex","StyledPaper","Card","GenericTable","data","title","subTitle","showTitle","onRowClick","loading","metadata","columns","Set","filter","m","isVisible","sort","a","b","ordinal","map","columnName","tableMeta","reduce","obj","mData","useTheme","isMobile","useMediaQuery","breakpoints","up","firstColumnStylePosition","_jsxs","_jsx","GenericTableTitle","children","HighlightScrollbar","Table","replace","toLowerCase","TableHead","TableRow","Array","from","
|
|
1
|
+
{"version":3,"file":"GenericTable.js","sources":["../../../../src/components/ui/GenericTable/GenericTable.tsx"],"sourcesContent":["import { styled, useTheme } from '@mui/material/styles';\n\nimport Table from '@mui/material/Table';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport useMediaQuery from '@mui/material/useMediaQuery';\nimport { GenericTableColumns } from './types';\nimport GenericTableTitle from '../GenericTableTitle/GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\nimport { GenericTableBody } from '../GenericTableBody';\nimport Card from '@mui/material/Card';\n\ntype GenericTableProps = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n metadata: GenericTableColumns[];\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n showTitle?: boolean;\n subTitle?: string;\n title?: string;\n};\n\nconst StyledContainer = styled('div')`\n overflow-x: auto;\n &::-webkit-scrollbar {\n padding: 2px 0;\n height: 6px;\n border: 1px solid #d5d5d5;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #f5f5f5;\n border-radius: 3px;\n }\n`;\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'isSticky',\n})<{ isSticky: boolean }>(({ theme, isSticky }) => ({\n fontSize: 13,\n padding: theme.spacing(1.25, 2),\n whiteSpace: 'nowrap',\n position: isSticky ? 'sticky' : 'relative',\n zIndex: isSticky ? 1 : 'auto',\n}));\n\nconst StyledPaper = styled(Card)`\n overflow: hidden;\n`;\n\nconst GenericTable = ({ data, title, subTitle, showTitle = true, onRowClick, loading, metadata }: GenericTableProps) => {\n const columns = new Set(\n metadata\n .filter((m) => m.isVisible)\n .sort((a, b) => a.ordinal - b.ordinal)\n .map((m) => m.columnName),\n );\n const tableMeta = metadata.reduce<{ [key: string]: GenericTableColumns }>((obj, mData) => {\n obj[mData.columnName] = mData;\n return obj;\n }, {});\n\n const theme = useTheme();\n const isMobile = !useMediaQuery(theme.breakpoints.up('sm'));\n\n // We never want sticky on mobile - only on desktop\n const firstColumnStylePosition = isMobile ? 'normal' : 'sticky';\n\n const renderTableHeader = () => (\n <TableHead>\n <TableRow>\n {Array.from(columns).map((prop, idx) => {\n const { columnName, columnTitle, align = 'left' } = tableMeta[prop];\n return (\n <StyledTableCell key={columnName} align={align} isSticky={idx === 0 && !isMobile}>\n <div>\n <span>{columnTitle}</span>\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle title={title} subTitle={subTitle}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table aria-label={title} data-testid={`generic-table` + (showTitle ? `-${title.replace(' ', '-').toLowerCase()}` : '')}>\n {renderTableHeader()}\n <GenericTableBody\n type={firstColumnStylePosition}\n data={data}\n columns={columns}\n onRowClick={onRowClick}\n loading={loading}\n meta={tableMeta}\n />\n </Table>\n </HighlightScrollbar>\n </StyledPaper>\n </StyledContainer>\n );\n};\n\nexport default GenericTable;\n"],"names":["StyledContainer","styled","StyledTableCell","TableCell","shouldForwardProp","prop","theme","isSticky","fontSize","padding","spacing","whiteSpace","position","zIndex","StyledPaper","Card","GenericTable","data","title","subTitle","showTitle","onRowClick","loading","metadata","columns","Set","filter","m","isVisible","sort","a","b","ordinal","map","columnName","tableMeta","reduce","obj","mData","useTheme","isMobile","useMediaQuery","breakpoints","up","firstColumnStylePosition","_jsxs","_jsx","GenericTableTitle","children","HighlightScrollbar","Table","replace","toLowerCase","TableHead","TableRow","Array","from","idx","columnTitle","align","GenericTableBody","type","meta"],"mappings":"yeAyBA,MAAMA,EAAkBC,EAAO,MAAM;;;;;;;;;;;;;;EAgB/BC,EAAkBD,EAAOE,EAAW,CACtCC,kBAAoBC,GAAkB,aAATA,GADTJ,EAEE,EAAGK,QAAOC,eAAgB,CAChDC,SAAU,GACVC,QAASH,EAAMI,QAAQ,KAAM,GAC7BC,WAAY,SACZC,SAAUL,EAAW,SAAW,WAChCM,OAAQN,EAAW,EAAI,WAGrBO,EAAcb,EAAOc,EAAK;;EAI1BC,EAAe,EAAGC,OAAMC,QAAOC,WAAUC,aAAY,EAAMC,aAAYC,UAASC,eAClF,MAAMC,EAAU,IAAIC,IAChBF,EACKG,QAAQC,GAAMA,EAAEC,YAChBC,MAAK,CAACC,EAAGC,IAAMD,EAAEE,QAAUD,EAAEC,UAC7BC,KAAKN,GAAMA,EAAEO,cAEhBC,EAAYZ,EAASa,QAA+C,CAACC,EAAKC,KAC5ED,EAAIC,EAAMJ,YAAcI,EACjBD,IACR,CAAE,GAEC/B,EAAQiC,IACRC,GAAYC,EAAcnC,EAAMoC,YAAYC,GAAG,OAG/CC,EAA2BJ,EAAW,SAAW,SAmBvD,OACIK,EAAC7C,aACIoB,GAAa0B,EAACC,EAAiB,CAAC7B,MAAOA,EAAOC,SAAUA,IACzD2B,EAAChC,EAAW,CAAAkC,SACRF,EAACG,EAAkB,CAAAD,SACfH,EAACK,EAAK,CAAA,aAAahC,EAAoB,cAAA,iBAAmBE,EAAY,IAAIF,EAAMiC,QAAQ,IAAK,KAAKC,gBAAkB,IAC/GJ,SAAA,CAtBjBF,EAACO,EAAS,CAAAL,SACNF,EAACQ,EACI,CAAAN,SAAAO,MAAMC,KAAKhC,GAASS,KAAI,CAAC5B,EAAMoD,KAC5B,MAAMvB,WAAEA,EAAUwB,YAAEA,EAAWC,MAAEA,EAAQ,QAAWxB,EAAU9B,GAC9D,OACIyC,EAAC5C,EAAiC,CAAAyD,MAAOA,EAAOpD,SAAkB,IAARkD,IAAcjB,EACpEQ,SAAAF,EAAA,MAAA,CAAAE,SACIF,EAAO,OAAA,CAAAE,SAAAU,OAFOxB,EAKxB,QAaEY,EAACc,EACG,CAAAC,KAAMjB,EACN3B,KAAMA,EACNO,QAASA,EACTH,WAAYA,EACZC,QAASA,EACTwC,KAAM3B,aAM5B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("@mui/material/styles"),i=require("@mui/material/TableBody"),r=require("@mui/material/TableCell"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@mui/material/styles"),i=require("@mui/material/TableBody"),r=require("@mui/material/TableCell"),l=require("@mui/material/TableRow"),a=require("@mui/material/Skeleton"),o=require("../GenericTableBodyRow/GenericTableBodyRow.cjs.js");const n=t.styled(r,{shouldForwardProp:e=>"align"!==e&&"titleCell"!==e&&"warning"!==e&&"sticky"!==e})((({align:e,titleCell:t,warning:i,sticky:r})=>({textAlign:e,fontWeight:t?"bold":"normal",backgroundColor:i?"#ffcccb":"inherit",position:r?"sticky":"static"}))),s=({colIdx:t,colName:i,hasWarning:r,hasTitle:l,meta:a,row:o,type:s})=>{const c=o[i],m={align:a[i].align??"left",warning:r,titleCell:l,sticky:"sticky"===s&&0===t,"data-testid":`col-${i}`};switch(a[i].columnType){case"String":default:return e.jsx(n,{...m,children:c??"-"});case"Custom":return e.jsx(n,{...m,children:c?a[i].customComponent(c):"-"})}};module.exports=({columns:t,data:r,loading:c,type:m,onRowClick:d,meta:u})=>e.jsx(i,{children:c?Array.from(Array(5)).map(((i,r)=>e.jsx(l,{"data-testid":"row-loader",children:Array.from(t).map(((t,i)=>e.jsx(n,{align:"left",titleCell:!1,warning:!1,sticky:!1,"data-testid":`col-${t}`,children:e.jsx(a,{width:"90%",height:22})},i)))},r))):r?.map(((i,r)=>e.jsx(o,{onRowClick:d,row:i,tableRowTestKey:r.toString(),children:Array.from(t).map(((t,r)=>e.jsx(s,{colIdx:r,colName:t,row:i,type:m,meta:u},r)))},r)))});
|
|
2
2
|
//# sourceMappingURL=GenericTableBody.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableBody.cjs.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell)<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(
|
|
1
|
+
{"version":3,"file":"GenericTableBody.cjs.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(({ align, titleCell, warning, sticky }) => ({\n textAlign: align,\n fontWeight: titleCell ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n}));\n\nexport type TableCellProps = {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'sticky' | 'normal';\n};\n\nconst RenderTableCell: React.FC<TableCellProps> = ({ colIdx, colName, hasWarning, hasTitle, meta, row, type }) => {\n const prop = row[colName];\n const align = meta[colName].align ?? 'left';\n const tableCellProps = {\n align,\n warning: hasWarning,\n titleCell: hasTitle,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n };\n\n switch (meta[colName].columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n case 'Custom':\n return <StyledTableCell {...tableCellProps}>{prop ? meta[colName].customComponent(prop) : '-'}</StyledTableCell>;\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n }\n};\n\ntype TableBodyProps = {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'sticky' | 'normal';\n};\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n <TableRow key={idx} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n key={colIdx}\n align={'left'}\n titleCell={false}\n warning={false}\n sticky={false}\n data-testid={`col-${columnName}`}\n >\n <Skeleton width=\"90%\" height={22} />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow key={rowIdx} onRowClick={onRowClick} row={row} tableRowTestKey={rowIdx.toString()}>\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell key={colIdx} colIdx={colIdx} colName={colName} row={row} type={type} meta={meta} />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","tableCellProps","columnType","_jsx","jsx","customComponent","columns","data","loading","onRowClick","MuiTableBody","children","Array","from","map","_","idx","TableRow","columnName","Skeleton","width","height","rowIdx","GenericTableBodyRow","tableRowTestKey","toString"],"mappings":"mSAUA,MAAMA,EAAkBC,EAAMA,OAACC,EAAW,CACtCC,kBAAoBC,GAAkB,UAATA,GAA6B,cAATA,GAAiC,YAATA,GAA+B,WAATA,GAD3EH,EAEqD,EAAGI,QAAOC,YAAWC,U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FJ4B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{styled as e}from"@mui/material/styles";import i from"@mui/material/TableBody";import r from"@mui/material/TableCell";import o from"@mui/material/TableRow";import a from"@mui/material/Skeleton";import l from"../GenericTableBodyRow/GenericTableBodyRow.js";const
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{styled as e}from"@mui/material/styles";import i from"@mui/material/TableBody";import r from"@mui/material/TableCell";import o from"@mui/material/TableRow";import a from"@mui/material/Skeleton";import l from"../GenericTableBodyRow/GenericTableBodyRow.js";const n=e(r,{shouldForwardProp:t=>"align"!==t&&"titleCell"!==t&&"warning"!==t&&"sticky"!==t})((({align:t,titleCell:e,warning:i,sticky:r})=>({textAlign:t,fontWeight:e?"bold":"normal",backgroundColor:i?"#ffcccb":"inherit",position:r?"sticky":"static"}))),m=({colIdx:e,colName:i,hasWarning:r,hasTitle:o,meta:a,row:l,type:m})=>{const c=l[i],s={align:a[i].align??"left",warning:r,titleCell:o,sticky:"sticky"===m&&0===e,"data-testid":`col-${i}`};switch(a[i].columnType){case"String":default:return t(n,{...s,children:c??"-"});case"Custom":return t(n,{...s,children:c?a[i].customComponent(c):"-"})}},c=({columns:e,data:r,loading:c,type:s,onRowClick:d,meta:p})=>t(i,{children:c?Array.from(Array(5)).map(((i,r)=>t(o,{"data-testid":"row-loader",children:Array.from(e).map(((e,i)=>t(n,{align:"left",titleCell:!1,warning:!1,sticky:!1,"data-testid":`col-${e}`,children:t(a,{width:"90%",height:22})},i)))},r))):r?.map(((i,r)=>t(l,{onRowClick:d,row:i,tableRowTestKey:r.toString(),children:Array.from(e).map(((e,r)=>t(m,{colIdx:r,colName:e,row:i,type:s,meta:p},r)))},r)))});export{c as default};
|
|
2
2
|
//# sourceMappingURL=GenericTableBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableBody.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell)<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(
|
|
1
|
+
{"version":3,"file":"GenericTableBody.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(({ align, titleCell, warning, sticky }) => ({\n textAlign: align,\n fontWeight: titleCell ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n}));\n\nexport type TableCellProps = {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'sticky' | 'normal';\n};\n\nconst RenderTableCell: React.FC<TableCellProps> = ({ colIdx, colName, hasWarning, hasTitle, meta, row, type }) => {\n const prop = row[colName];\n const align = meta[colName].align ?? 'left';\n const tableCellProps = {\n align,\n warning: hasWarning,\n titleCell: hasTitle,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n };\n\n switch (meta[colName].columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n case 'Custom':\n return <StyledTableCell {...tableCellProps}>{prop ? meta[colName].customComponent(prop) : '-'}</StyledTableCell>;\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n }\n};\n\ntype TableBodyProps = {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'sticky' | 'normal';\n};\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n <TableRow key={idx} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n key={colIdx}\n align={'left'}\n titleCell={false}\n warning={false}\n sticky={false}\n data-testid={`col-${columnName}`}\n >\n <Skeleton width=\"90%\" height={22} />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow key={rowIdx} onRowClick={onRowClick} row={row} tableRowTestKey={rowIdx.toString()}>\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell key={colIdx} colIdx={colIdx} colName={colName} row={row} type={type} meta={meta} />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","tableCellProps","columnType","_jsx","customComponent","GenericTableBody","columns","data","loading","onRowClick","MuiTableBody","children","Array","from","map","_","idx","TableRow","columnName","Skeleton","width","height","rowIdx","GenericTableBodyRow","tableRowTest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,KAAI,CAACnB,EAASD,IAC/BS,EAACV,EAAe,CAAcC,OAAQA,EAAQC,QAASA,EAASI,IAAKA,EAAKC,KAAMA,EAAMF,KAAMA,GAAtEJ,MAFJ4B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var i=require("react/jsx-runtime"),e=require("@mui/material/Grid"),t=require("@mui/material/Typography"),r=require("@mui/material/styles");const
|
|
1
|
+
"use strict";var i=require("react/jsx-runtime"),e=require("@mui/material/Grid"),t=require("@mui/material/Typography"),r=require("@mui/material/styles");const d=r.styled(e,{shouldForwardProp:i=>"titlePadding"!==i})((({theme:i,titlePadding:e})=>{switch(e){case"small":return{padding:i.spacing(3,0,1.5),[i.breakpoints.down("md")]:{padding:i.spacing(3,2,1.5)}};case"medium":return{padding:i.spacing(4,0,2),[i.breakpoints.down("md")]:{padding:i.spacing(4,2,2)}};default:return{padding:0}}})),a=r.styled(t)({width:191,height:16,fontSize:12,fontWeight:"normal",lineHeight:1.33,letterSpacing:.4,color:"rgba(0, 0, 0, 0.38)"});module.exports=({maxGridWidth:r=12,subTitle:n,title:s,children:l,titlePadding:c="medium"})=>i.jsxs(d,{container:!0,titlePadding:c,children:[i.jsxs(e,{item:!0,xs:r,sm:r,children:[s&&i.jsx(t,{variant:"h5",children:s}),n&&i.jsx("div",{children:i.jsx(a,{variant:"caption",children:n})})]}),l]});
|
|
2
2
|
//# sourceMappingURL=GenericTableTitle.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableTitle.cjs.js","sources":["../../../../src/components/ui/GenericTableTitle/GenericTableTitle.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport Grid from '@mui/material/Grid';\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\n\ntype OuterProps = {\n maxGridWidth?: boolean | 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n subTitle?: string;\n title?: string;\n children?: ReactNode;\n titlePadding?: 'small' | 'medium';\n};\n\nconst HeaderContainer = styled(Grid)<{ titlePadding: OuterProps['titlePadding'] }>(({ theme, titlePadding }) => {\n switch (titlePadding) {\n case 'small':\n return {\n padding: theme.spacing(3, 0, 1.5),\n [theme.breakpoints.down('md')]: {\n padding: theme.spacing(3, 2, 1.5),\n },\n };\n case 'medium':\n return {\n padding: theme.spacing(4, 0, 2),\n [theme.breakpoints.down('md')]: {\n padding: theme.spacing(4, 2, 2),\n },\n };\n default:\n return { padding: 0 };\n }\n});\n\nconst SubTitle = styled(Typography)({\n width: 191,\n height: 16,\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.33,\n letterSpacing: 0.4,\n color: 'rgba(0, 0, 0, 0.38)',\n});\n\nconst GenericTableTitle = ({ maxGridWidth = 12, subTitle, title, children, titlePadding = 'medium' }: OuterProps) => {\n return (\n <HeaderContainer container titlePadding={titlePadding}>\n <Grid item xs={maxGridWidth} sm={maxGridWidth}>\n {title && <Typography variant=\"h5\">{title}</Typography>}\n {subTitle && (\n <div>\n <SubTitle variant=\"caption\">{subTitle}</SubTitle>\n </div>\n )}\n </Grid>\n\n {children}\n </HeaderContainer>\n );\n};\n\nexport default GenericTableTitle;\n"],"names":["HeaderContainer","styled","Grid","theme","titlePadding","padding","spacing","breakpoints","down","SubTitle","Typography","width","height","fontSize","fontWeight","lineHeight","letterSpacing","color","maxGridWidth","subTitle","title","children","_jsxs","jsxs","container","item","xs","sm","_jsx","jsx","variant"],"mappings":"wJAaA,MAAMA,EAAkBC,EAAMA,OAACC,
|
|
1
|
+
{"version":3,"file":"GenericTableTitle.cjs.js","sources":["../../../../src/components/ui/GenericTableTitle/GenericTableTitle.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport Grid from '@mui/material/Grid';\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\n\ntype OuterProps = {\n maxGridWidth?: boolean | 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n subTitle?: string;\n title?: string;\n children?: ReactNode;\n titlePadding?: 'small' | 'medium';\n};\n\nconst HeaderContainer = styled(Grid, {\n shouldForwardProp: (prop) => prop !== 'titlePadding',\n})<{ titlePadding: OuterProps['titlePadding'] }>(({ theme, titlePadding }) => {\n switch (titlePadding) {\n case 'small':\n return {\n padding: theme.spacing(3, 0, 1.5),\n [theme.breakpoints.down('md')]: {\n padding: theme.spacing(3, 2, 1.5),\n },\n };\n case 'medium':\n return {\n padding: theme.spacing(4, 0, 2),\n [theme.breakpoints.down('md')]: {\n padding: theme.spacing(4, 2, 2),\n },\n };\n default:\n return { padding: 0 };\n }\n});\n\nconst SubTitle = styled(Typography)({\n width: 191,\n height: 16,\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.33,\n letterSpacing: 0.4,\n color: 'rgba(0, 0, 0, 0.38)',\n});\n\nconst GenericTableTitle = ({ maxGridWidth = 12, subTitle, title, children, titlePadding = 'medium' }: OuterProps) => {\n return (\n <HeaderContainer container titlePadding={titlePadding}>\n <Grid item xs={maxGridWidth} sm={maxGridWidth}>\n {title && <Typography variant=\"h5\">{title}</Typography>}\n {subTitle && (\n <div>\n <SubTitle variant=\"caption\">{subTitle}</SubTitle>\n </div>\n )}\n </Grid>\n\n {children}\n </HeaderContainer>\n );\n};\n\nexport default GenericTableTitle;\n"],"names":["HeaderContainer","styled","Grid","shouldForwardProp","prop","theme","titlePadding","padding","spacing","breakpoints","down","SubTitle","Typography","width","height","fontSize","fontWeight","lineHeight","letterSpacing","color","maxGridWidth","subTitle","title","children","_jsxs","jsxs","container","item","xs","sm","_jsx","jsx","variant"],"mappings":"wJAaA,MAAMA,EAAkBC,EAAMA,OAACC,EAAM,CACjCC,kBAAoBC,GAAkB,iBAATA,GADTH,EAEyB,EAAGI,QAAOC,mBACvD,OAAQA,GACJ,IAAK,QACD,MAAO,CACHC,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAC7B,CAACH,EAAMI,YAAYC,KAAK,OAAQ,CAC5BH,QAASF,EAAMG,QAAQ,EAAG,EAAG,OAGzC,IAAK,SACD,MAAO,CACHD,QAASF,EAAMG,QAAQ,EAAG,EAAG,GAC7B,CAACH,EAAMI,YAAYC,KAAK,OAAQ,CAC5BH,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAGzC,QACI,MAAO,CAAED,QAAS,GACzB,IAGCI,EAAWV,EAAAA,OAAOW,EAAPX,CAAmB,CAChCY,MAAO,IACPC,OAAQ,GACRC,SAAU,GACVC,WAAY,SACZC,WAAY,KACZC,cAAe,GACfC,MAAO,uCAGe,EAAGC,eAAe,GAAIC,WAAUC,QAAOC,WAAUjB,eAAe,YAElFkB,EAACC,KAAAzB,EAAgB,CAAA0B,aAAUpB,aAAcA,EAAYiB,SAAA,CACjDC,EAAAA,KAACtB,GAAKyB,MAAI,EAACC,GAAIR,EAAcS,GAAIT,EAAYG,SAAA,CACxCD,GAASQ,EAACC,IAAAnB,GAAWoB,QAAQ,KAAIT,SAAED,IACnCD,GACGS,EACIC,IAAA,MAAA,CAAAR,SAAAO,EAAAA,IAACnB,EAAQ,CAACqB,QAAQ,UAAWT,SAAAF,SAKxCE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as i,jsx as t}from"react/jsx-runtime";import e from"@mui/material/Grid";import
|
|
1
|
+
import{jsxs as i,jsx as t}from"react/jsx-runtime";import e from"@mui/material/Grid";import r from"@mui/material/Typography";import{styled as a}from"@mui/material/styles";const d=a(e,{shouldForwardProp:i=>"titlePadding"!==i})((({theme:i,titlePadding:t})=>{switch(t){case"small":return{padding:i.spacing(3,0,1.5),[i.breakpoints.down("md")]:{padding:i.spacing(3,2,1.5)}};case"medium":return{padding:i.spacing(4,0,2),[i.breakpoints.down("md")]:{padding:i.spacing(4,2,2)}};default:return{padding:0}}})),n=a(r)({width:191,height:16,fontSize:12,fontWeight:"normal",lineHeight:1.33,letterSpacing:.4,color:"rgba(0, 0, 0, 0.38)"}),m=({maxGridWidth:a=12,subTitle:m,title:l,children:o,titlePadding:p="medium"})=>i(d,{container:!0,titlePadding:p,children:[i(e,{item:!0,xs:a,sm:a,children:[l&&t(r,{variant:"h5",children:l}),m&&t("div",{children:t(n,{variant:"caption",children:m})})]}),o]});export{m as default};
|
|
2
2
|
//# sourceMappingURL=GenericTableTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableTitle.js","sources":["../../../../src/components/ui/GenericTableTitle/GenericTableTitle.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport Grid from '@mui/material/Grid';\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\n\ntype OuterProps = {\n maxGridWidth?: boolean | 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n subTitle?: string;\n title?: string;\n children?: ReactNode;\n titlePadding?: 'small' | 'medium';\n};\n\nconst HeaderContainer = styled(Grid)<{ titlePadding: OuterProps['titlePadding'] }>(({ theme, titlePadding }) => {\n switch (titlePadding) {\n case 'small':\n return {\n padding: theme.spacing(3, 0, 1.5),\n [theme.breakpoints.down('md')]: {\n padding: theme.spacing(3, 2, 1.5),\n },\n };\n case 'medium':\n return {\n padding: theme.spacing(4, 0, 2),\n [theme.breakpoints.down('md')]: {\n padding: theme.spacing(4, 2, 2),\n },\n };\n default:\n return { padding: 0 };\n }\n});\n\nconst SubTitle = styled(Typography)({\n width: 191,\n height: 16,\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.33,\n letterSpacing: 0.4,\n color: 'rgba(0, 0, 0, 0.38)',\n});\n\nconst GenericTableTitle = ({ maxGridWidth = 12, subTitle, title, children, titlePadding = 'medium' }: OuterProps) => {\n return (\n <HeaderContainer container titlePadding={titlePadding}>\n <Grid item xs={maxGridWidth} sm={maxGridWidth}>\n {title && <Typography variant=\"h5\">{title}</Typography>}\n {subTitle && (\n <div>\n <SubTitle variant=\"caption\">{subTitle}</SubTitle>\n </div>\n )}\n </Grid>\n\n {children}\n </HeaderContainer>\n );\n};\n\nexport default GenericTableTitle;\n"],"names":["HeaderContainer","styled","Grid","theme","titlePadding","padding","spacing","breakpoints","down","SubTitle","Typography","width","height","fontSize","fontWeight","lineHeight","letterSpacing","color","GenericTableTitle","maxGridWidth","subTitle","title","children","_jsxs","container","item","xs","sm","_jsx","variant"],"mappings":"0KAaA,MAAMA,EAAkBC,EAAOC,
|
|
1
|
+
{"version":3,"file":"GenericTableTitle.js","sources":["../../../../src/components/ui/GenericTableTitle/GenericTableTitle.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport Grid from '@mui/material/Grid';\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\n\ntype OuterProps = {\n maxGridWidth?: boolean | 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n subTitle?: string;\n title?: string;\n children?: ReactNode;\n titlePadding?: 'small' | 'medium';\n};\n\nconst HeaderContainer = styled(Grid, {\n shouldForwardProp: (prop) => prop !== 'titlePadding',\n})<{ titlePadding: OuterProps['titlePadding'] }>(({ theme, titlePadding }) => {\n switch (titlePadding) {\n case 'small':\n return {\n padding: theme.spacing(3, 0, 1.5),\n [theme.breakpoints.down('md')]: {\n padding: theme.spacing(3, 2, 1.5),\n },\n };\n case 'medium':\n return {\n padding: theme.spacing(4, 0, 2),\n [theme.breakpoints.down('md')]: {\n padding: theme.spacing(4, 2, 2),\n },\n };\n default:\n return { padding: 0 };\n }\n});\n\nconst SubTitle = styled(Typography)({\n width: 191,\n height: 16,\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.33,\n letterSpacing: 0.4,\n color: 'rgba(0, 0, 0, 0.38)',\n});\n\nconst GenericTableTitle = ({ maxGridWidth = 12, subTitle, title, children, titlePadding = 'medium' }: OuterProps) => {\n return (\n <HeaderContainer container titlePadding={titlePadding}>\n <Grid item xs={maxGridWidth} sm={maxGridWidth}>\n {title && <Typography variant=\"h5\">{title}</Typography>}\n {subTitle && (\n <div>\n <SubTitle variant=\"caption\">{subTitle}</SubTitle>\n </div>\n )}\n </Grid>\n\n {children}\n </HeaderContainer>\n );\n};\n\nexport default GenericTableTitle;\n"],"names":["HeaderContainer","styled","Grid","shouldForwardProp","prop","theme","titlePadding","padding","spacing","breakpoints","down","SubTitle","Typography","width","height","fontSize","fontWeight","lineHeight","letterSpacing","color","GenericTableTitle","maxGridWidth","subTitle","title","children","_jsxs","container","item","xs","sm","_jsx","variant"],"mappings":"0KAaA,MAAMA,EAAkBC,EAAOC,EAAM,CACjCC,kBAAoBC,GAAkB,iBAATA,GADTH,EAEyB,EAAGI,QAAOC,mBACvD,OAAQA,GACJ,IAAK,QACD,MAAO,CACHC,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAC7B,CAACH,EAAMI,YAAYC,KAAK,OAAQ,CAC5BH,QAASF,EAAMG,QAAQ,EAAG,EAAG,OAGzC,IAAK,SACD,MAAO,CACHD,QAASF,EAAMG,QAAQ,EAAG,EAAG,GAC7B,CAACH,EAAMI,YAAYC,KAAK,OAAQ,CAC5BH,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAGzC,QACI,MAAO,CAAED,QAAS,GACzB,IAGCI,EAAWV,EAAOW,EAAPX,CAAmB,CAChCY,MAAO,IACPC,OAAQ,GACRC,SAAU,GACVC,WAAY,SACZC,WAAY,KACZC,cAAe,GACfC,MAAO,wBAGLC,EAAoB,EAAGC,eAAe,GAAIC,WAAUC,QAAOC,WAAUlB,eAAe,YAElFmB,EAACzB,EAAgB,CAAA0B,aAAUpB,aAAcA,EAAYkB,SAAA,CACjDC,EAACvB,GAAKyB,MAAI,EAACC,GAAIP,EAAcQ,GAAIR,EAAYG,SAAA,CACxCD,GAASO,EAAClB,GAAWmB,QAAQ,KAAIP,SAAED,IACnCD,GACGQ,EACI,MAAA,CAAAN,SAAAM,EAACnB,EAAQ,CAACoB,QAAQ,UAAWP,SAAAF,SAKxCE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("@mui/icons-material/Add"),t=require("@mui/icons-material/ArrowBack"),n=require("@mui/material/Grid"),r=require("@mui/material/IconButton"),a=require("@mui/material/styles"),s=require("@mui/material/Typography"),o=require("@mui/material/useMediaQuery"),d=require("./DocumentTitle.cjs.js"),l=require("./FullWidthContainer.cjs.js"),c=require("../FDErrorBoundary/FDErrorBoundary.cjs.js"),m=require("@mui/material/Button"),p=require("../../../utilities/renderUtilities.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("@mui/icons-material/Add"),t=require("@mui/icons-material/ArrowBack"),n=require("@mui/material/Grid"),r=require("@mui/material/IconButton"),a=require("@mui/material/styles"),s=require("@mui/material/Typography"),o=require("@mui/material/useMediaQuery"),d=require("./DocumentTitle.cjs.js"),l=require("./FullWidthContainer.cjs.js"),c=require("../FDErrorBoundary/FDErrorBoundary.cjs.js"),m=require("@mui/material/Button"),p=require("../../../utilities/renderUtilities.cjs.js"),h=require("../../../utilities/validation.cjs.js"),g=require("../Spacer/Spacer.cjs.js"),u=require("@mui/material/Box"),x=require("@mui/material/Divider");const j=1112,y=a.styled("div")((({theme:e,fluid:i})=>({maxWidth:i?"none":j,[e.breakpoints.down("md")]:{maxWidth:"none"},margin:e.spacing(2,4)}))),f=a.styled(n)((({theme:e})=>({[e.breakpoints.down("sm")]:{width:"100%",paddingTop:e.spacing(2)}}))),v=a.styled(n)((({theme:e})=>({flexWrap:"nowrap",alignItems:"flex-start",paddingTop:e.spacing(3),paddingBottom:e.spacing(3),[e.breakpoints.down("md")]:{paddingTop:e.spacing(2),paddingBottom:e.spacing(3)}}))),b=a.styled(n)((({theme:e})=>({paddingTop:e.spacing(2)}))),k=a.styled(n)((()=>({flexGrow:1}))),B=a.styled("div")((({theme:e})=>({maxWidth:j,paddingBottom:e.spacing(3),[e.breakpoints.down("md")]:{paddingBottom:e.spacing(2),paddingLeft:e.spacing(2),paddingRight:e.spacing(2)}}))),q=a.styled(r,{shouldForwardProp:e=>"hasTitleComponent"!==e})((({theme:e,hasTitleComponent:i})=>({margin:i?e.spacing(-.75,2,-1.5,-1.5):e.spacing(-1.5,2,-1.5,-1.5),[e.breakpoints.only("sm")]:{marginLeft:e.spacing(-2)},[e.breakpoints.only("xs")]:{marginLeft:e.spacing(-2)}}))),w=a.styled("div")((({theme:e})=>({maxWidth:j,marginLeft:e.spacing(6),marginRight:e.spacing(4),paddingBottom:e.spacing(2),[e.breakpoints.only("md")]:{marginLeft:12,marginRight:e.spacing(3)},[e.breakpoints.only("sm")]:{marginLeft:e.spacing(3),marginRight:e.spacing(3),maxWidth:"none"},[e.breakpoints.only("xs")]:{marginLeft:e.spacing(2),marginRight:e.spacing(2),maxWidth:"none"}}))),T=a.styled(n)((()=>({display:"flex",flexGrow:1,justifyContent:"flex-end"}))),W=a.styled(s)((()=>({lineHeight:"26px"}))),C=a.styled(s)((()=>({fontWeight:"bold"}))),L=a.styled(x)((({theme:e})=>({marginBottom:e.spacing(4)}))),F=({title:i})=>e.jsx(C,{variant:"h5",component:"h2",children:i});exports.PageTitle=F,exports.default=r=>{const{actionBtnTitle:s,caption:x,children:j,contextButtons:C,documentTitle:A,fluid:P=!1,fullWidth:D,header:I,hideHeader:R,actionButtonLink:z,openLinkInNewTab:_=!1,pageHeader:G,showActionButton:H,showAddIcon:M,strictToParent:E,title:S,titleComponent:U,toParent:N,navigate:O,hideDivider:Q=!1,customActionButtons:$}=r,J=a.useTheme(),K=o(J.breakpoints.down("md")),V=p.getMicroFrontendAttribute("data-portal-base-url")||"/",X=z?.startsWith("https://"),Y=X?z:void 0!==z?h.joinUrlPaths(V,z):"";return e.jsxs(y,{fluid:P,children:[A&&e.jsx(d,{children:A}),G||null,e.jsxs(w,{children:[G&&e.jsx(g,{size:16,variant:"vertical"}),!R&&e.jsxs(e.Fragment,{children:[e.jsxs(v,{container:!0,alignItems:"center",direction:"column",children:[e.jsx(n,{item:!0,container:!0,direction:"row",alignContent:"space-between",children:e.jsx(T,{item:!0,children:C&&C.map(((i,t)=>e.jsx("div",{children:i},t)))})}),e.jsxs(b,{item:!0,container:!0,children:[N&&e.jsx(u,{children:e.jsx(q,{"aria-label":"Back","data-testid":"back_button",hasTitleComponent:!!U,component:"button",onClick:()=>{N&&E||N&&history.length<3?O(N):O(-1)},children:e.jsx(t,{})})}),e.jsxs(k,{item:!0,children:[U?e.jsx(U,{}):e.jsx(F,{title:S}),x&&e.jsx(W,{variant:"caption",component:"h3",children:x})]}),H&&e.jsxs(e.Fragment,{children:[K&&e.jsx(g,{size:56,variant:"vertical"}),e.jsx(f,{item:!0,children:e.jsxs(m,{variant:"contained",fullWidth:!0,"data-testid":`Action-button-${s}`,href:_||X?Y:"",target:_?"_blank":void 0,rel:_?"noopener noreferrer":void 0,onClick:_||X?()=>{}:()=>O(z),children:[M&&e.jsx(i,{}),s]})})]}),$&&$.map(((i,t)=>e.jsxs("div",{children:[K&&e.jsx(g,{size:56,variant:"vertical"}),!K&&e.jsx(g,{size:16,variant:"vertical"}),e.jsx(f,{item:!0,children:i})]},t)))]})]}),!Q&&e.jsx(L,{})]}),e.jsxs(l,{fullWidth:D,children:[I?e.jsx(B,{children:I}):null,e.jsx(c,{identifier:A,children:e.jsx(e.Fragment,{children:j})})]})]})]})},exports.maxWidth=j;
|
|
2
2
|
//# sourceMappingURL=PageLayout.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.cjs.js","sources":["../../../../src/components/ui/PageLayout/PageLayout.tsx"],"sourcesContent":["import React, { ComponentType, ReactNode } from 'react';\n\nimport Add from '@mui/icons-material/Add';\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack';\nimport Grid from '@mui/material/Grid';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport DocumentTitle from './DocumentTitle';\nimport FullWidthContainer from './FullWidthContainer';\nimport FDErrorBoundary from '../FDErrorBoundary/FDErrorBoundary';\nimport Button from '@mui/material/Button';\nimport { getMicroFrontendAttribute } from '../../../utilities/renderUtilities';\nimport { joinUrlPaths } from '../../../utilities/validation';\nimport Spacer from '../Spacer/Spacer';\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nexport const HORIZONTAL_SPACE_CLASSNAME = 'horizontal-content-space';\nexport const LEFT_HORIZONTAL_SPACE_CLASSNAME = 'left-horizontal-content-space';\nexport const RIGHT_HORIZONTAL_SPACE_CLASSNAME = 'right-horizontal-content-space';\nexport const VERTICAL_SPACE_CLASSNAME = 'vertical-content-space';\nexport const maxWidth = 1112;\nconst historyMinLength = 3;\n\nconst StyledWrapper = styled('div')<{ fluid: boolean }>(({ theme, fluid }) => ({\n maxWidth: fluid ? 'none' : maxWidth,\n [theme.breakpoints.down('md')]: {\n maxWidth: 'none',\n },\n margin: theme.spacing(2, 4),\n}));\n\nconst StyledActionButtonGrid = styled(Grid)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n paddingTop: theme.spacing(2),\n },\n}));\n\nconst StyledHeader = styled(Grid)(({ theme }) => ({\n flexWrap: 'nowrap',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n },\n}));\n\nconst StyledTitleContainer = styled(Grid)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n}));\n\nconst StyledTitleSection = styled(Grid)(() => ({\n flexGrow: 1,\n}));\n\nconst StyledTopSection = styled('div')(({ theme }) => ({\n maxWidth,\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingBottom: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n}));\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst StyledBackButton = styled(IconButton)<{ hasTitleComponent: boolean; component: any }>(({ theme, hasTitleComponent }) => ({\n margin: hasTitleComponent ? theme.spacing(-0.75, 2, -1.5, -1.5) : theme.spacing(-1.5, 2, -1.5, -1.5),\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(-2),\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(-2),\n },\n}));\n\nconst StyledInnerWrapper = styled('div')(({ theme }) => ({\n maxWidth,\n marginLeft: theme.spacing(6),\n marginRight: theme.spacing(4),\n paddingBottom: theme.spacing(2),\n\n [theme.breakpoints.only('md')]: {\n marginLeft: 12,\n marginRight: theme.spacing(3),\n },\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(3),\n marginRight: theme.spacing(3),\n maxWidth: 'none',\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n maxWidth: 'none',\n },\n}));\n\nconst StyledHeaderContainer = styled(Grid)(() => ({\n display: 'flex',\n flexGrow: 1,\n justifyContent: 'flex-end',\n}));\nconst StyledCaption = styled(Typography)<{ component: string }>(() => ({\n lineHeight: '26px',\n}));\n\nconst StyledPageTitle = styled(Typography)<{ component: string }>(() => ({\n fontWeight: 'bold',\n}));\n\nconst StyledPageDivider = styled(Divider)(({ theme }) => ({\n marginBottom: theme.spacing(4),\n}));\n\nexport const PageTitle = ({ title }: { title: string | ReactNode }) => (\n <StyledPageTitle variant=\"h5\" component=\"h2\">\n {title}\n </StyledPageTitle>\n);\n\nexport type Props = {\n actionBtnTitle?: string;\n caption?: ReactNode;\n children: ReactNode;\n contextButtons?: ReactNode[];\n documentTitle: string;\n fluid?: boolean;\n fullWidth?: boolean;\n header?: ReactNode;\n hideHeader?: boolean;\n actionButtonLink?: string;\n pageHeader?: ReactNode;\n showActionButton?: boolean;\n showAddIcon?: boolean;\n strictToParent?: boolean;\n title: ReactNode;\n titleComponent?: ComponentType<React.PropsWithChildren<unknown>>;\n toParent?: string;\n openLinkInNewTab?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n navigate: (to: any) => void;\n hideDivider?: boolean;\n customActionButtons?: ReactNode[];\n};\n\nconst PageLayout = (props: Props) => {\n const {\n actionBtnTitle,\n caption,\n children,\n contextButtons,\n documentTitle,\n fluid = false,\n fullWidth,\n header,\n hideHeader,\n actionButtonLink,\n openLinkInNewTab = false,\n pageHeader,\n showActionButton,\n showAddIcon,\n strictToParent,\n title,\n titleComponent: TitleComponent,\n toParent,\n navigate,\n hideDivider = false,\n customActionButtons,\n } = props;\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('md'));\n const baseUrl = getMicroFrontendAttribute('data-portal-base-url') || '/';\n const actionButtonWithHttps = actionButtonLink?.startsWith('https://');\n const actionButtonLinkFinal = actionButtonWithHttps\n ? actionButtonLink\n : actionButtonLink !== undefined\n ? joinUrlPaths(baseUrl, actionButtonLink)\n : '';\n\n return (\n <StyledWrapper fluid={fluid}>\n {documentTitle && <DocumentTitle>{documentTitle}</DocumentTitle>}\n\n {pageHeader ? pageHeader : null}\n <StyledInnerWrapper>\n {pageHeader && <Spacer size={16} variant=\"vertical\" />}\n {!hideHeader && (\n <>\n <StyledHeader container alignItems=\"center\" direction=\"column\">\n <Grid item container direction=\"row\" alignContent=\"space-between\">\n <StyledHeaderContainer item>{contextButtons && contextButtons.map((button) => <>{button}</>)}</StyledHeaderContainer>\n </Grid>\n <StyledTitleContainer item container>\n {toParent && (\n <Box>\n <StyledBackButton\n aria-label=\"Back\"\n data-testid=\"back_button\"\n hasTitleComponent={!!TitleComponent}\n component={'button'}\n onClick={() => {\n if (toParent && strictToParent) {\n navigate(toParent);\n } else if (toParent && history.length < historyMinLength) {\n navigate(toParent);\n } else {\n navigate(-1);\n }\n }}\n >\n <ArrowBackIcon />\n </StyledBackButton>\n </Box>\n )}\n\n <StyledTitleSection item>\n {TitleComponent ? <TitleComponent /> : <PageTitle title={title} />}\n {caption && (\n <StyledCaption variant=\"caption\" component=\"h3\">\n {caption}\n </StyledCaption>\n )}\n </StyledTitleSection>\n\n {showActionButton && (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n <StyledActionButtonGrid item>\n <Button\n variant=\"contained\"\n fullWidth={true}\n data-testid={`Action-button-${actionBtnTitle}`}\n href={openLinkInNewTab || actionButtonWithHttps ? actionButtonLinkFinal : ''}\n target={openLinkInNewTab ? '_blank' : undefined}\n rel={openLinkInNewTab ? 'noopener noreferrer' : undefined}\n onClick={!openLinkInNewTab && !actionButtonWithHttps ? () => navigate(actionButtonLink) : () => {}}\n >\n {showAddIcon && <Add />}\n {actionBtnTitle}\n </Button>\n </StyledActionButtonGrid>\n </>\n )}\n {customActionButtons &&\n customActionButtons.map((button) => (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n {!isMobile && <Spacer size={16} variant=\"vertical\" />}\n <StyledActionButtonGrid item>{button}</StyledActionButtonGrid>\n </>\n ))}\n </StyledTitleContainer>\n </StyledHeader>\n {!hideDivider && <StyledPageDivider />}\n </>\n )}\n <FullWidthContainer fullWidth={fullWidth}>\n {header ? <StyledTopSection>{header}</StyledTopSection> : null}\n <FDErrorBoundary identifier={documentTitle}>\n <>{children}</>\n </FDErrorBoundary>\n </FullWidthContainer>\n </StyledInnerWrapper>\n </StyledWrapper>\n );\n};\n\nexport default PageLayout;\n"],"names":["maxWidth","StyledWrapper","styled","theme","fluid","breakpoints","down","margin","spacing","StyledActionButtonGrid","Grid","width","paddingTop","StyledHeader","flexWrap","alignItems","paddingBottom","StyledTitleContainer","StyledTitleSection","flexGrow","StyledTopSection","paddingLeft","paddingRight","StyledBackButton","IconButton","hasTitleComponent","only","marginLeft","StyledInnerWrapper","marginRight","StyledHeaderContainer","display","justifyContent","StyledCaption","Typography","lineHeight","StyledPageTitle","fontWeight","StyledPageDivider","Divider","marginBottom","PageTitle","title","_jsx","variant","component","children","props","actionBtnTitle","caption","contextButtons","documentTitle","fullWidth","header","hideHeader","actionButtonLink","openLinkInNewTab","pageHeader","showActionButton","showAddIcon","strictToParent","titleComponent","TitleComponent","toParent","navigate","hideDivider","customActionButtons","useTheme","isMobile","useMediaQuery","baseUrl","getMicroFrontendAttribute","actionButtonWithHttps","startsWith","actionButtonLinkFinal","undefined","joinUrlPaths","_jsxs","DocumentTitle","jsx","Spacer","size","_Fragment","container","direction","item","alignContent","map","button","Fragment","Box","onClick","history","length","ArrowBackIcon","jsxs","Button","href","target","rel","Add","FullWidthContainer","FDErrorBoundary","identifier"],"mappings":"ouBAwBO,MAAMA,EAAW,KAGlBC,EAAgBC,EAAMA,OAAC,MAAPA,EAAkC,EAAGC,QAAOC,YAAa,CAC3EJ,SAAUI,EAAQ,OAASJ,EAC3B,CAACG,EAAME,YAAYC,KAAK,OAAQ,CAC5BN,SAAU,QAEdO,OAAQJ,EAAMK,QAAQ,EAAG,OAGvBC,EAAyBP,EAAAA,OAAOQ,EAAPR,EAAa,EAAGC,YAAa,CACxD,CAACA,EAAME,YAAYC,KAAK,OAAQ,CAC5BK,MAAO,OACPC,WAAYT,EAAMK,QAAQ,QAI5BK,EAAeX,EAAAA,OAAOQ,EAAPR,EAAa,EAAGC,YAAa,CAC9CW,SAAU,SACVC,WAAY,aACZH,WAAYT,EAAMK,QAAQ,GAC1BQ,cAAeb,EAAMK,QAAQ,GAE7B,CAACL,EAAME,YAAYC,KAAK,OAAQ,CAC5BM,WAAYT,EAAMK,QAAQ,GAC1BQ,cAAeb,EAAMK,QAAQ,QAI/BS,EAAuBf,EAAAA,OAAOQ,EAAPR,EAAa,EAAGC,YAAa,CACtDS,WAAYT,EAAMK,QAAQ,OAGxBU,EAAqBhB,EAAAA,OAAOQ,EAAPR,EAAa,KAAO,CAC3CiB,SAAU,MAGRC,EAAmBlB,EAAAA,OAAO,MAAPA,EAAc,EAAGC,YAAa,CACnDH,WACAgB,cAAeb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wB,GAAmBjD,UAAWA,EAC1BN,SAAA,CAAAO,EAASV,MAACvB,EAAkB,CAAA0B,SAAAO,IAA6B,KAC1DV,EAAAA,IAAC2D,EAAgB,CAAAC,WAAYpD,EAAaL,SACtCH,2BAAGG,cAKrB"}
|
|
1
|
+
{"version":3,"file":"PageLayout.cjs.js","sources":["../../../../src/components/ui/PageLayout/PageLayout.tsx"],"sourcesContent":["import React, { ComponentType, ReactNode } from 'react';\n\nimport Add from '@mui/icons-material/Add';\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack';\nimport Grid from '@mui/material/Grid';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport DocumentTitle from './DocumentTitle';\nimport FullWidthContainer from './FullWidthContainer';\nimport FDErrorBoundary from '../FDErrorBoundary/FDErrorBoundary';\nimport Button from '@mui/material/Button';\nimport { getMicroFrontendAttribute } from '../../../utilities/renderUtilities';\nimport { joinUrlPaths } from '../../../utilities/validation';\nimport Spacer from '../Spacer/Spacer';\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nexport const HORIZONTAL_SPACE_CLASSNAME = 'horizontal-content-space';\nexport const LEFT_HORIZONTAL_SPACE_CLASSNAME = 'left-horizontal-content-space';\nexport const RIGHT_HORIZONTAL_SPACE_CLASSNAME = 'right-horizontal-content-space';\nexport const VERTICAL_SPACE_CLASSNAME = 'vertical-content-space';\nexport const maxWidth = 1112;\nconst historyMinLength = 3;\n\nconst StyledWrapper = styled('div')<{ fluid: boolean }>(({ theme, fluid }) => ({\n maxWidth: fluid ? 'none' : maxWidth,\n [theme.breakpoints.down('md')]: {\n maxWidth: 'none',\n },\n margin: theme.spacing(2, 4),\n}));\n\nconst StyledActionButtonGrid = styled(Grid)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n paddingTop: theme.spacing(2),\n },\n}));\n\nconst StyledHeader = styled(Grid)(({ theme }) => ({\n flexWrap: 'nowrap',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n },\n}));\n\nconst StyledTitleContainer = styled(Grid)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n}));\n\nconst StyledTitleSection = styled(Grid)(() => ({\n flexGrow: 1,\n}));\n\nconst StyledTopSection = styled('div')(({ theme }) => ({\n maxWidth,\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingBottom: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n}));\n\nconst StyledBackButton = styled(IconButton, {\n shouldForwardProp: (prop) => prop !== 'hasTitleComponent',\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n})<{ hasTitleComponent: boolean; component: any }>(({ theme, hasTitleComponent }) => ({\n margin: hasTitleComponent ? theme.spacing(-0.75, 2, -1.5, -1.5) : theme.spacing(-1.5, 2, -1.5, -1.5),\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(-2),\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(-2),\n },\n}));\n\nconst StyledInnerWrapper = styled('div')(({ theme }) => ({\n maxWidth,\n marginLeft: theme.spacing(6),\n marginRight: theme.spacing(4),\n paddingBottom: theme.spacing(2),\n\n [theme.breakpoints.only('md')]: {\n marginLeft: 12,\n marginRight: theme.spacing(3),\n },\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(3),\n marginRight: theme.spacing(3),\n maxWidth: 'none',\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n maxWidth: 'none',\n },\n}));\n\nconst StyledHeaderContainer = styled(Grid)(() => ({\n display: 'flex',\n flexGrow: 1,\n justifyContent: 'flex-end',\n}));\nconst StyledCaption = styled(Typography)<{ component: string }>(() => ({\n lineHeight: '26px',\n}));\n\nconst StyledPageTitle = styled(Typography)<{ component: string }>(() => ({\n fontWeight: 'bold',\n}));\n\nconst StyledPageDivider = styled(Divider)(({ theme }) => ({\n marginBottom: theme.spacing(4),\n}));\n\nexport const PageTitle = ({ title }: { title: string | ReactNode }) => (\n <StyledPageTitle variant=\"h5\" component=\"h2\">\n {title}\n </StyledPageTitle>\n);\n\nexport type Props = {\n actionBtnTitle?: string;\n caption?: ReactNode;\n children: ReactNode;\n contextButtons?: ReactNode[];\n documentTitle: string;\n fluid?: boolean;\n fullWidth?: boolean;\n header?: ReactNode;\n hideHeader?: boolean;\n actionButtonLink?: string;\n pageHeader?: ReactNode;\n showActionButton?: boolean;\n showAddIcon?: boolean;\n strictToParent?: boolean;\n title: ReactNode;\n titleComponent?: ComponentType<React.PropsWithChildren<unknown>>;\n toParent?: string;\n openLinkInNewTab?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n navigate: (to: any) => void;\n hideDivider?: boolean;\n customActionButtons?: ReactNode[];\n};\n\nconst PageLayout = (props: Props) => {\n const {\n actionBtnTitle,\n caption,\n children,\n contextButtons,\n documentTitle,\n fluid = false,\n fullWidth,\n header,\n hideHeader,\n actionButtonLink,\n openLinkInNewTab = false,\n pageHeader,\n showActionButton,\n showAddIcon,\n strictToParent,\n title,\n titleComponent: TitleComponent,\n toParent,\n navigate,\n hideDivider = false,\n customActionButtons,\n } = props;\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('md'));\n const baseUrl = getMicroFrontendAttribute('data-portal-base-url') || '/';\n const actionButtonWithHttps = actionButtonLink?.startsWith('https://');\n const actionButtonLinkFinal = actionButtonWithHttps\n ? actionButtonLink\n : actionButtonLink !== undefined\n ? joinUrlPaths(baseUrl, actionButtonLink)\n : '';\n\n return (\n <StyledWrapper fluid={fluid}>\n {documentTitle && <DocumentTitle>{documentTitle}</DocumentTitle>}\n\n {pageHeader ? pageHeader : null}\n <StyledInnerWrapper>\n {pageHeader && <Spacer size={16} variant=\"vertical\" />}\n {!hideHeader && (\n <>\n <StyledHeader container alignItems=\"center\" direction=\"column\">\n <Grid item container direction=\"row\" alignContent=\"space-between\">\n <StyledHeaderContainer item>\n {contextButtons && contextButtons.map((button, index) => <div key={index}>{button}</div>)}\n </StyledHeaderContainer>\n </Grid>\n <StyledTitleContainer item container>\n {toParent && (\n <Box>\n <StyledBackButton\n aria-label=\"Back\"\n data-testid=\"back_button\"\n hasTitleComponent={!!TitleComponent}\n component={'button'}\n onClick={() => {\n if (toParent && strictToParent) {\n navigate(toParent);\n } else if (toParent && history.length < historyMinLength) {\n navigate(toParent);\n } else {\n navigate(-1);\n }\n }}\n >\n <ArrowBackIcon />\n </StyledBackButton>\n </Box>\n )}\n\n <StyledTitleSection item>\n {TitleComponent ? <TitleComponent /> : <PageTitle title={title} />}\n {caption && (\n <StyledCaption variant=\"caption\" component=\"h3\">\n {caption}\n </StyledCaption>\n )}\n </StyledTitleSection>\n\n {showActionButton && (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n <StyledActionButtonGrid item>\n <Button\n variant=\"contained\"\n fullWidth={true}\n data-testid={`Action-button-${actionBtnTitle}`}\n href={openLinkInNewTab || actionButtonWithHttps ? actionButtonLinkFinal : ''}\n target={openLinkInNewTab ? '_blank' : undefined}\n rel={openLinkInNewTab ? 'noopener noreferrer' : undefined}\n onClick={!openLinkInNewTab && !actionButtonWithHttps ? () => navigate(actionButtonLink) : () => {}}\n >\n {showAddIcon && <Add />}\n {actionBtnTitle}\n </Button>\n </StyledActionButtonGrid>\n </>\n )}\n {customActionButtons &&\n customActionButtons.map((button, index) => (\n <div key={index}>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n {!isMobile && <Spacer size={16} variant=\"vertical\" />}\n <StyledActionButtonGrid item>{button}</StyledActionButtonGrid>\n </div>\n ))}\n </StyledTitleContainer>\n </StyledHeader>\n {!hideDivider && <StyledPageDivider />}\n </>\n )}\n <FullWidthContainer fullWidth={fullWidth}>\n {header ? <StyledTopSection>{header}</StyledTopSection> : null}\n <FDErrorBoundary identifier={documentTitle}>\n <>{children}</>\n </FDErrorBoundary>\n </FullWidthContainer>\n </StyledInnerWrapper>\n </StyledWrapper>\n );\n};\n\nexport default PageLayout;\n"],"names":["maxWidth","StyledWrapper","styled","theme","fluid","breakpoints","down","margin","spacing","StyledActionButtonGrid","Grid","width","paddingTop","StyledHeader","flexWrap","alignItems","paddingBottom","StyledTitleContainer","StyledTitleSection","flexGrow","StyledTopSection","paddingLeft","paddingRight","StyledBackButton","IconButton","shouldForwardProp","prop","hasTitleComponent","only","marginLeft","StyledInnerWrapper","marginRight","StyledHeaderContainer","display","justifyContent","StyledCaption","Typography","lineHeight","StyledPageTitle","fontWeight","StyledPageDivider","Divider","marginBottom","PageTitle","title","_jsx","variant","component","children","props","actionBtnTitle","caption","contextButtons","documentTitle","fullWidth","header","hideHeader","actionButtonLink","openLinkInNewTab","pageHeader","showActionButton","showAddIcon","strictToParent","titleComponent","TitleComponent","toParent","navigate","hideDivider","customActionButtons","useTheme","isMobile","useMediaQuery","baseUrl","getMicroFrontendAttribute","actionButtonWithHttps","startsWith","actionButtonLinkFinal","undefined","joinUrlPaths","_jsxs","DocumentTitle","jsxs","Spacer","size","container","direction","jsx","item","alignContent","map","button","index","Box","onClick","history","length","ArrowBackIcon","_Fragment","Button","href","target","rel","Add","FullWidthContainer","FDErrorBoundary","identifier"],"mappings":"ouBAwBO,MAAMA,EAAW,KAGlBC,EAAgBC,EAAMA,OAAC,MAAPA,EAAkC,EAAGC,QAAOC,YAAa,CAC3EJ,SAAUI,EAAQ,OAASJ,EAC3B,CAACG,EAAME,YAAYC,KAAK,OAAQ,CAC5BN,SAAU,QAEdO,OAAQJ,EAAMK,QAAQ,EAAG,OAGvBC,EAAyBP,EAAAA,OAAOQ,EAAPR,EAAa,EAAGC,YAAa,CACxD,CAACA,EAAME,YAAYC,KAAK,OAAQ,C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,QAAQ,YACRQ,WAAW,gBACE,iBAAiBJ,IAC9BiD,KAAMzC,GAAoBgB,EAAwBE,EAAwB,GAC1EwB,OAAQ1C,EAAmB,cAAWmB,EACtCwB,IAAK3C,EAAmB,2BAAwBmB,EAChDgB,QAAUnC,GAAqBgB,EAA2D,OAAnC,IAAMR,EAAST,GAA4BT,SAAA,CAEjGa,GAAehB,MAACyD,EAAG,CAAA,GACnBpD,UAKhBkB,GACGA,EAAoBqB,KAAI,CAACC,EAAQC,IAC7BZ,wBACKT,GAAYzB,MAACqC,EAAM,CAACC,KAAM,GAAIrC,QAAQ,cACrCwB,GAAYzB,EAAAyC,IAACJ,EAAO,CAAAC,KAAM,GAAIrC,QAAQ,aACxCD,EAAAA,IAACpC,GAAuB8E,MAAI,EAAAvC,SAAE0C,MAHxBC,YAQxBxB,GAAetB,EAACyC,IAAA9C,EAAoB,OAG9CuC,EAAAA,KAACwB,EAAmB,CAAAjD,UAAWA,EAASN,SAAA,CACnCO,EAASV,MAACzB,EAAgB,CAAA4B,SAAEO,IAA6B,KAC1DV,EAAAA,IAAC2D,EAAe,CAACC,WAAYpD,EACzBL,SAAAH,MAAAoD,EAAAA,SAAA,CAAAjD,SAAGA,cAKrB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as i,jsx as t,Fragment as n}from"react/jsx-runtime";import e from"@mui/icons-material/Add";import a from"@mui/icons-material/ArrowBack";import r from"@mui/material/Grid";import o from"@mui/material/IconButton";import{styled as m,useTheme as d}from"@mui/material/styles";import l from"@mui/material/Typography";import p from"@mui/material/useMediaQuery";import c from"./DocumentTitle.js";import s from"./FullWidthContainer.js";import h from"../FDErrorBoundary/FDErrorBoundary.js";import g from"@mui/material/Button";import{getMicroFrontendAttribute as u}from"../../../utilities/renderUtilities.js";import{joinUrlPaths as f}from"../../../utilities/validation.js";import v from"../Spacer/Spacer.js";import b from"@mui/material/Box";import x from"@mui/material/Divider";const k=1112,B=m("div")((({theme:i,fluid:t})=>({maxWidth:t?"none":k,[i.breakpoints.down("md")]:{maxWidth:"none"},margin:i.spacing(2,4)}))),w=m(r)((({theme:i})=>({[i.breakpoints.down("sm")]:{width:"100%",paddingTop:i.spacing(2)}}))),y=m(r)((({theme:i})=>({flexWrap:"nowrap",alignItems:"flex-start",paddingTop:i.spacing(3),paddingBottom:i.spacing(3),[i.breakpoints.down("md")]:{paddingTop:i.spacing(2),paddingBottom:i.spacing(3)}}))),
|
|
1
|
+
import{jsxs as i,jsx as t,Fragment as n}from"react/jsx-runtime";import e from"@mui/icons-material/Add";import a from"@mui/icons-material/ArrowBack";import r from"@mui/material/Grid";import o from"@mui/material/IconButton";import{styled as m,useTheme as d}from"@mui/material/styles";import l from"@mui/material/Typography";import p from"@mui/material/useMediaQuery";import c from"./DocumentTitle.js";import s from"./FullWidthContainer.js";import h from"../FDErrorBoundary/FDErrorBoundary.js";import g from"@mui/material/Button";import{getMicroFrontendAttribute as u}from"../../../utilities/renderUtilities.js";import{joinUrlPaths as f}from"../../../utilities/validation.js";import v from"../Spacer/Spacer.js";import b from"@mui/material/Box";import x from"@mui/material/Divider";const k=1112,B=m("div")((({theme:i,fluid:t})=>({maxWidth:t?"none":k,[i.breakpoints.down("md")]:{maxWidth:"none"},margin:i.spacing(2,4)}))),w=m(r)((({theme:i})=>({[i.breakpoints.down("sm")]:{width:"100%",paddingTop:i.spacing(2)}}))),y=m(r)((({theme:i})=>({flexWrap:"nowrap",alignItems:"flex-start",paddingTop:i.spacing(3),paddingBottom:i.spacing(3),[i.breakpoints.down("md")]:{paddingTop:i.spacing(2),paddingBottom:i.spacing(3)}}))),T=m(r)((({theme:i})=>({paddingTop:i.spacing(2)}))),W=m(r)((()=>({flexGrow:1}))),C=m("div")((({theme:i})=>({maxWidth:k,paddingBottom:i.spacing(3),[i.breakpoints.down("md")]:{paddingBottom:i.spacing(2),paddingLeft:i.spacing(2),paddingRight:i.spacing(2)}}))),L=m(o,{shouldForwardProp:i=>"hasTitleComponent"!==i})((({theme:i,hasTitleComponent:t})=>({margin:t?i.spacing(-.75,2,-1.5,-1.5):i.spacing(-1.5,2,-1.5,-1.5),[i.breakpoints.only("sm")]:{marginLeft:i.spacing(-2)},[i.breakpoints.only("xs")]:{marginLeft:i.spacing(-2)}}))),j=m("div")((({theme:i})=>({maxWidth:k,marginLeft:i.spacing(6),marginRight:i.spacing(4),paddingBottom:i.spacing(2),[i.breakpoints.only("md")]:{marginLeft:12,marginRight:i.spacing(3)},[i.breakpoints.only("sm")]:{marginLeft:i.spacing(3),marginRight:i.spacing(3),maxWidth:"none"},[i.breakpoints.only("xs")]:{marginLeft:i.spacing(2),marginRight:i.spacing(2),maxWidth:"none"}}))),A=m(r)((()=>({display:"flex",flexGrow:1,justifyContent:"flex-end"}))),D=m(l)((()=>({lineHeight:"26px"}))),I=m(l)((()=>({fontWeight:"bold"}))),R=m(x)((({theme:i})=>({marginBottom:i.spacing(4)}))),z=({title:i})=>t(I,{variant:"h5",component:"h2",children:i}),F=o=>{const{actionBtnTitle:m,caption:l,children:x,contextButtons:k,documentTitle:I,fluid:F=!1,fullWidth:G,header:H,hideHeader:P,actionButtonLink:E,openLinkInNewTab:S=!1,pageHeader:_,showActionButton:M,showAddIcon:N,strictToParent:Q,title:U,titleComponent:$,toParent:q,navigate:J,hideDivider:K=!1,customActionButtons:O}=o,V=d(),X=p(V.breakpoints.down("md")),Y=u("data-portal-base-url")||"/",Z=E?.startsWith("https://"),ii=Z?E:void 0!==E?f(Y,E):"";return i(B,{fluid:F,children:[I&&t(c,{children:I}),_||null,i(j,{children:[_&&t(v,{size:16,variant:"vertical"}),!P&&i(n,{children:[i(y,{container:!0,alignItems:"center",direction:"column",children:[t(r,{item:!0,container:!0,direction:"row",alignContent:"space-between",children:t(A,{item:!0,children:k&&k.map(((i,n)=>t("div",{children:i},n)))})}),i(T,{item:!0,container:!0,children:[q&&t(b,{children:t(L,{"aria-label":"Back","data-testid":"back_button",hasTitleComponent:!!$,component:"button",onClick:()=>{q&&Q||q&&history.length<3?J(q):J(-1)},children:t(a,{})})}),i(W,{item:!0,children:[$?t($,{}):t(z,{title:U}),l&&t(D,{variant:"caption",component:"h3",children:l})]}),M&&i(n,{children:[X&&t(v,{size:56,variant:"vertical"}),t(w,{item:!0,children:i(g,{variant:"contained",fullWidth:!0,"data-testid":`Action-button-${m}`,href:S||Z?ii:"",target:S?"_blank":void 0,rel:S?"noopener noreferrer":void 0,onClick:S||Z?()=>{}:()=>J(E),children:[N&&t(e,{}),m]})})]}),O&&O.map(((n,e)=>i("div",{children:[X&&t(v,{size:56,variant:"vertical"}),!X&&t(v,{size:16,variant:"vertical"}),t(w,{item:!0,children:n})]},e)))]})]}),!K&&t(R,{})]}),i(s,{fullWidth:G,children:[H?t(C,{children:H}):null,t(h,{identifier:I,children:t(n,{children:x})})]})]})]})};export{z as PageTitle,F as default,k as maxWidth};
|
|
2
2
|
//# sourceMappingURL=PageLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.js","sources":["../../../../src/components/ui/PageLayout/PageLayout.tsx"],"sourcesContent":["import React, { ComponentType, ReactNode } from 'react';\n\nimport Add from '@mui/icons-material/Add';\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack';\nimport Grid from '@mui/material/Grid';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport DocumentTitle from './DocumentTitle';\nimport FullWidthContainer from './FullWidthContainer';\nimport FDErrorBoundary from '../FDErrorBoundary/FDErrorBoundary';\nimport Button from '@mui/material/Button';\nimport { getMicroFrontendAttribute } from '../../../utilities/renderUtilities';\nimport { joinUrlPaths } from '../../../utilities/validation';\nimport Spacer from '../Spacer/Spacer';\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nexport const HORIZONTAL_SPACE_CLASSNAME = 'horizontal-content-space';\nexport const LEFT_HORIZONTAL_SPACE_CLASSNAME = 'left-horizontal-content-space';\nexport const RIGHT_HORIZONTAL_SPACE_CLASSNAME = 'right-horizontal-content-space';\nexport const VERTICAL_SPACE_CLASSNAME = 'vertical-content-space';\nexport const maxWidth = 1112;\nconst historyMinLength = 3;\n\nconst StyledWrapper = styled('div')<{ fluid: boolean }>(({ theme, fluid }) => ({\n maxWidth: fluid ? 'none' : maxWidth,\n [theme.breakpoints.down('md')]: {\n maxWidth: 'none',\n },\n margin: theme.spacing(2, 4),\n}));\n\nconst StyledActionButtonGrid = styled(Grid)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n paddingTop: theme.spacing(2),\n },\n}));\n\nconst StyledHeader = styled(Grid)(({ theme }) => ({\n flexWrap: 'nowrap',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n },\n}));\n\nconst StyledTitleContainer = styled(Grid)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n}));\n\nconst StyledTitleSection = styled(Grid)(() => ({\n flexGrow: 1,\n}));\n\nconst StyledTopSection = styled('div')(({ theme }) => ({\n maxWidth,\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingBottom: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n}));\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst StyledBackButton = styled(IconButton)<{ hasTitleComponent: boolean; component: any }>(({ theme, hasTitleComponent }) => ({\n margin: hasTitleComponent ? theme.spacing(-0.75, 2, -1.5, -1.5) : theme.spacing(-1.5, 2, -1.5, -1.5),\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(-2),\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(-2),\n },\n}));\n\nconst StyledInnerWrapper = styled('div')(({ theme }) => ({\n maxWidth,\n marginLeft: theme.spacing(6),\n marginRight: theme.spacing(4),\n paddingBottom: theme.spacing(2),\n\n [theme.breakpoints.only('md')]: {\n marginLeft: 12,\n marginRight: theme.spacing(3),\n },\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(3),\n marginRight: theme.spacing(3),\n maxWidth: 'none',\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n maxWidth: 'none',\n },\n}));\n\nconst StyledHeaderContainer = styled(Grid)(() => ({\n display: 'flex',\n flexGrow: 1,\n justifyContent: 'flex-end',\n}));\nconst StyledCaption = styled(Typography)<{ component: string }>(() => ({\n lineHeight: '26px',\n}));\n\nconst StyledPageTitle = styled(Typography)<{ component: string }>(() => ({\n fontWeight: 'bold',\n}));\n\nconst StyledPageDivider = styled(Divider)(({ theme }) => ({\n marginBottom: theme.spacing(4),\n}));\n\nexport const PageTitle = ({ title }: { title: string | ReactNode }) => (\n <StyledPageTitle variant=\"h5\" component=\"h2\">\n {title}\n </StyledPageTitle>\n);\n\nexport type Props = {\n actionBtnTitle?: string;\n caption?: ReactNode;\n children: ReactNode;\n contextButtons?: ReactNode[];\n documentTitle: string;\n fluid?: boolean;\n fullWidth?: boolean;\n header?: ReactNode;\n hideHeader?: boolean;\n actionButtonLink?: string;\n pageHeader?: ReactNode;\n showActionButton?: boolean;\n showAddIcon?: boolean;\n strictToParent?: boolean;\n title: ReactNode;\n titleComponent?: ComponentType<React.PropsWithChildren<unknown>>;\n toParent?: string;\n openLinkInNewTab?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n navigate: (to: any) => void;\n hideDivider?: boolean;\n customActionButtons?: ReactNode[];\n};\n\nconst PageLayout = (props: Props) => {\n const {\n actionBtnTitle,\n caption,\n children,\n contextButtons,\n documentTitle,\n fluid = false,\n fullWidth,\n header,\n hideHeader,\n actionButtonLink,\n openLinkInNewTab = false,\n pageHeader,\n showActionButton,\n showAddIcon,\n strictToParent,\n title,\n titleComponent: TitleComponent,\n toParent,\n navigate,\n hideDivider = false,\n customActionButtons,\n } = props;\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('md'));\n const baseUrl = getMicroFrontendAttribute('data-portal-base-url') || '/';\n const actionButtonWithHttps = actionButtonLink?.startsWith('https://');\n const actionButtonLinkFinal = actionButtonWithHttps\n ? actionButtonLink\n : actionButtonLink !== undefined\n ? joinUrlPaths(baseUrl, actionButtonLink)\n : '';\n\n return (\n <StyledWrapper fluid={fluid}>\n {documentTitle && <DocumentTitle>{documentTitle}</DocumentTitle>}\n\n {pageHeader ? pageHeader : null}\n <StyledInnerWrapper>\n {pageHeader && <Spacer size={16} variant=\"vertical\" />}\n {!hideHeader && (\n <>\n <StyledHeader container alignItems=\"center\" direction=\"column\">\n <Grid item container direction=\"row\" alignContent=\"space-between\">\n <StyledHeaderContainer item>{contextButtons && contextButtons.map((button) => <>{button}</>)}</StyledHeaderContainer>\n </Grid>\n <StyledTitleContainer item container>\n {toParent && (\n <Box>\n <StyledBackButton\n aria-label=\"Back\"\n data-testid=\"back_button\"\n hasTitleComponent={!!TitleComponent}\n component={'button'}\n onClick={() => {\n if (toParent && strictToParent) {\n navigate(toParent);\n } else if (toParent && history.length < historyMinLength) {\n navigate(toParent);\n } else {\n navigate(-1);\n }\n }}\n >\n <ArrowBackIcon />\n </StyledBackButton>\n </Box>\n )}\n\n <StyledTitleSection item>\n {TitleComponent ? <TitleComponent /> : <PageTitle title={title} />}\n {caption && (\n <StyledCaption variant=\"caption\" component=\"h3\">\n {caption}\n </StyledCaption>\n )}\n </StyledTitleSection>\n\n {showActionButton && (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n <StyledActionButtonGrid item>\n <Button\n variant=\"contained\"\n fullWidth={true}\n data-testid={`Action-button-${actionBtnTitle}`}\n href={openLinkInNewTab || actionButtonWithHttps ? actionButtonLinkFinal : ''}\n target={openLinkInNewTab ? '_blank' : undefined}\n rel={openLinkInNewTab ? 'noopener noreferrer' : undefined}\n onClick={!openLinkInNewTab && !actionButtonWithHttps ? () => navigate(actionButtonLink) : () => {}}\n >\n {showAddIcon && <Add />}\n {actionBtnTitle}\n </Button>\n </StyledActionButtonGrid>\n </>\n )}\n {customActionButtons &&\n customActionButtons.map((button) => (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n {!isMobile && <Spacer size={16} variant=\"vertical\" />}\n <StyledActionButtonGrid item>{button}</StyledActionButtonGrid>\n </>\n ))}\n </StyledTitleContainer>\n </StyledHeader>\n {!hideDivider && <StyledPageDivider />}\n </>\n )}\n <FullWidthContainer fullWidth={fullWidth}>\n {header ? <StyledTopSection>{header}</StyledTopSection> : null}\n <FDErrorBoundary identifier={documentTitle}>\n <>{children}</>\n </FDErrorBoundary>\n </FullWidthContainer>\n </StyledInnerWrapper>\n </StyledWrapper>\n );\n};\n\nexport default PageLayout;\n"],"names":["maxWidth","StyledWrapper","styled","theme","fluid","breakpoints","down","margin","spacing","StyledActionButtonGrid","Grid","width","paddingTop","StyledHeader","flexWrap","alignItems","paddingBottom","StyledTitleContainer","StyledTitleSection","flexGrow","StyledTopSection","paddingLeft","paddingRight","StyledBackButton","IconButton","hasTitleComponent","only","marginLeft","StyledInnerWrapper","marginRight","StyledHeaderContainer","display","justifyContent","StyledCaption","Typography","lineHeight","StyledPageTitle","fontWeight","StyledPageDivider","Divider","marginBottom","PageTitle","title","_jsx","variant","component","children","PageLayout","props","actionBtnTitle","caption","contextButtons","documentTitle","fullWidth","header","hideHeader","actionButtonLink","openLinkInNewTab","pageHeader","showActionButton","showAddIcon","strictToParent","titleComponent","TitleComponent","toParent","navigate","hideDivider","customActionButtons","useTheme","isMobile","useMediaQuery","baseUrl","getMicroFrontendAttribute","actionButtonWithHttps","startsWith","actionButtonLinkFinal","undefined","joinUrlPaths","_jsxs","DocumentTitle","Spacer","size","_Fragment","container","direction","item","alignContent","map","button","Box","onClick","history","length","ArrowBackIcon","Button","href","target","rel","Add","FullWidthContain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,aACvCD,EAAClC,EAAuB,CAAA4E,iBACpBP,EAACgB,GACGlD,QAAQ,YACRS,WAAW,gBACE,iBAAiBJ,IAC9B8C,KAAMtC,GAAoBgB,EAAwBE,GAAwB,GAC1EqB,OAAQvC,EAAmB,cAAWmB,EACtCqB,IAAKxC,EAAmB,2BAAwBmB,EAChDc,QAAUjC,GAAqBgB,EAA2D,OAAnC,IAAMR,EAAST,GAA4BV,SAAA,CAEjGc,GAAejB,EAACuD,EAAG,CAAA,GACnBjD,UAKhBkB,GACGA,EAAoBoB,KAAKC,GACrBV,EAAAI,EAAA,CAAApC,SAAA,CACKuB,GAAY1B,EAACqC,EAAO,CAAAC,KAAM,GAAIrC,QAAQ,cACrCyB,GAAY1B,EAACqC,GAAOC,KAAM,GAAIrC,QAAQ,aACxCD,EAAClC,GAAuB4E,MAAI,EAAAvC,SAAE0C,gBAKhDtB,GAAevB,EAACL,SAG1BwC,EAACqB,GAAmB9C,UAAWA,EAC1BP,SAAA,CAAAQ,EAASX,EAACvB,EAAkB,CAAA0B,SAAAQ,IAA6B,KAC1DX,EAACyD,EAAgB,CAAAC,WAAYjD,EAAaN,SACtCH,cAAGG,cAKrB"}
|
|
1
|
+
{"version":3,"file":"PageLayout.js","sources":["../../../../src/components/ui/PageLayout/PageLayout.tsx"],"sourcesContent":["import React, { ComponentType, ReactNode } from 'react';\n\nimport Add from '@mui/icons-material/Add';\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack';\nimport Grid from '@mui/material/Grid';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport DocumentTitle from './DocumentTitle';\nimport FullWidthContainer from './FullWidthContainer';\nimport FDErrorBoundary from '../FDErrorBoundary/FDErrorBoundary';\nimport Button from '@mui/material/Button';\nimport { getMicroFrontendAttribute } from '../../../utilities/renderUtilities';\nimport { joinUrlPaths } from '../../../utilities/validation';\nimport Spacer from '../Spacer/Spacer';\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nexport const HORIZONTAL_SPACE_CLASSNAME = 'horizontal-content-space';\nexport const LEFT_HORIZONTAL_SPACE_CLASSNAME = 'left-horizontal-content-space';\nexport const RIGHT_HORIZONTAL_SPACE_CLASSNAME = 'right-horizontal-content-space';\nexport const VERTICAL_SPACE_CLASSNAME = 'vertical-content-space';\nexport const maxWidth = 1112;\nconst historyMinLength = 3;\n\nconst StyledWrapper = styled('div')<{ fluid: boolean }>(({ theme, fluid }) => ({\n maxWidth: fluid ? 'none' : maxWidth,\n [theme.breakpoints.down('md')]: {\n maxWidth: 'none',\n },\n margin: theme.spacing(2, 4),\n}));\n\nconst StyledActionButtonGrid = styled(Grid)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n paddingTop: theme.spacing(2),\n },\n}));\n\nconst StyledHeader = styled(Grid)(({ theme }) => ({\n flexWrap: 'nowrap',\n alignItems: 'flex-start',\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n },\n}));\n\nconst StyledTitleContainer = styled(Grid)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n}));\n\nconst StyledTitleSection = styled(Grid)(() => ({\n flexGrow: 1,\n}));\n\nconst StyledTopSection = styled('div')(({ theme }) => ({\n maxWidth,\n paddingBottom: theme.spacing(3),\n\n [theme.breakpoints.down('md')]: {\n paddingBottom: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n}));\n\nconst StyledBackButton = styled(IconButton, {\n shouldForwardProp: (prop) => prop !== 'hasTitleComponent',\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n})<{ hasTitleComponent: boolean; component: any }>(({ theme, hasTitleComponent }) => ({\n margin: hasTitleComponent ? theme.spacing(-0.75, 2, -1.5, -1.5) : theme.spacing(-1.5, 2, -1.5, -1.5),\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(-2),\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(-2),\n },\n}));\n\nconst StyledInnerWrapper = styled('div')(({ theme }) => ({\n maxWidth,\n marginLeft: theme.spacing(6),\n marginRight: theme.spacing(4),\n paddingBottom: theme.spacing(2),\n\n [theme.breakpoints.only('md')]: {\n marginLeft: 12,\n marginRight: theme.spacing(3),\n },\n\n [theme.breakpoints.only('sm')]: {\n marginLeft: theme.spacing(3),\n marginRight: theme.spacing(3),\n maxWidth: 'none',\n },\n\n [theme.breakpoints.only('xs')]: {\n marginLeft: theme.spacing(2),\n marginRight: theme.spacing(2),\n maxWidth: 'none',\n },\n}));\n\nconst StyledHeaderContainer = styled(Grid)(() => ({\n display: 'flex',\n flexGrow: 1,\n justifyContent: 'flex-end',\n}));\nconst StyledCaption = styled(Typography)<{ component: string }>(() => ({\n lineHeight: '26px',\n}));\n\nconst StyledPageTitle = styled(Typography)<{ component: string }>(() => ({\n fontWeight: 'bold',\n}));\n\nconst StyledPageDivider = styled(Divider)(({ theme }) => ({\n marginBottom: theme.spacing(4),\n}));\n\nexport const PageTitle = ({ title }: { title: string | ReactNode }) => (\n <StyledPageTitle variant=\"h5\" component=\"h2\">\n {title}\n </StyledPageTitle>\n);\n\nexport type Props = {\n actionBtnTitle?: string;\n caption?: ReactNode;\n children: ReactNode;\n contextButtons?: ReactNode[];\n documentTitle: string;\n fluid?: boolean;\n fullWidth?: boolean;\n header?: ReactNode;\n hideHeader?: boolean;\n actionButtonLink?: string;\n pageHeader?: ReactNode;\n showActionButton?: boolean;\n showAddIcon?: boolean;\n strictToParent?: boolean;\n title: ReactNode;\n titleComponent?: ComponentType<React.PropsWithChildren<unknown>>;\n toParent?: string;\n openLinkInNewTab?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n navigate: (to: any) => void;\n hideDivider?: boolean;\n customActionButtons?: ReactNode[];\n};\n\nconst PageLayout = (props: Props) => {\n const {\n actionBtnTitle,\n caption,\n children,\n contextButtons,\n documentTitle,\n fluid = false,\n fullWidth,\n header,\n hideHeader,\n actionButtonLink,\n openLinkInNewTab = false,\n pageHeader,\n showActionButton,\n showAddIcon,\n strictToParent,\n title,\n titleComponent: TitleComponent,\n toParent,\n navigate,\n hideDivider = false,\n customActionButtons,\n } = props;\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('md'));\n const baseUrl = getMicroFrontendAttribute('data-portal-base-url') || '/';\n const actionButtonWithHttps = actionButtonLink?.startsWith('https://');\n const actionButtonLinkFinal = actionButtonWithHttps\n ? actionButtonLink\n : actionButtonLink !== undefined\n ? joinUrlPaths(baseUrl, actionButtonLink)\n : '';\n\n return (\n <StyledWrapper fluid={fluid}>\n {documentTitle && <DocumentTitle>{documentTitle}</DocumentTitle>}\n\n {pageHeader ? pageHeader : null}\n <StyledInnerWrapper>\n {pageHeader && <Spacer size={16} variant=\"vertical\" />}\n {!hideHeader && (\n <>\n <StyledHeader container alignItems=\"center\" direction=\"column\">\n <Grid item container direction=\"row\" alignContent=\"space-between\">\n <StyledHeaderContainer item>\n {contextButtons && contextButtons.map((button, index) => <div key={index}>{button}</div>)}\n </StyledHeaderContainer>\n </Grid>\n <StyledTitleContainer item container>\n {toParent && (\n <Box>\n <StyledBackButton\n aria-label=\"Back\"\n data-testid=\"back_button\"\n hasTitleComponent={!!TitleComponent}\n component={'button'}\n onClick={() => {\n if (toParent && strictToParent) {\n navigate(toParent);\n } else if (toParent && history.length < historyMinLength) {\n navigate(toParent);\n } else {\n navigate(-1);\n }\n }}\n >\n <ArrowBackIcon />\n </StyledBackButton>\n </Box>\n )}\n\n <StyledTitleSection item>\n {TitleComponent ? <TitleComponent /> : <PageTitle title={title} />}\n {caption && (\n <StyledCaption variant=\"caption\" component=\"h3\">\n {caption}\n </StyledCaption>\n )}\n </StyledTitleSection>\n\n {showActionButton && (\n <>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n <StyledActionButtonGrid item>\n <Button\n variant=\"contained\"\n fullWidth={true}\n data-testid={`Action-button-${actionBtnTitle}`}\n href={openLinkInNewTab || actionButtonWithHttps ? actionButtonLinkFinal : ''}\n target={openLinkInNewTab ? '_blank' : undefined}\n rel={openLinkInNewTab ? 'noopener noreferrer' : undefined}\n onClick={!openLinkInNewTab && !actionButtonWithHttps ? () => navigate(actionButtonLink) : () => {}}\n >\n {showAddIcon && <Add />}\n {actionBtnTitle}\n </Button>\n </StyledActionButtonGrid>\n </>\n )}\n {customActionButtons &&\n customActionButtons.map((button, index) => (\n <div key={index}>\n {isMobile && <Spacer size={56} variant=\"vertical\" />}\n {!isMobile && <Spacer size={16} variant=\"vertical\" />}\n <StyledActionButtonGrid item>{button}</StyledActionButtonGrid>\n </div>\n ))}\n </StyledTitleContainer>\n </StyledHeader>\n {!hideDivider && <StyledPageDivider />}\n </>\n )}\n <FullWidthContainer fullWidth={fullWidth}>\n {header ? <StyledTopSection>{header}</StyledTopSection> : null}\n <FDErrorBoundary identifier={documentTitle}>\n <>{children}</>\n </FDErrorBoundary>\n </FullWidthContainer>\n </StyledInnerWrapper>\n </StyledWrapper>\n );\n};\n\nexport default PageLayout;\n"],"names":["maxWidth","StyledWrapper","styled","theme","fluid","breakpoints","down","margin","spacing","StyledActionButtonGrid","Grid","width","paddingTop","StyledHeader","flexWrap","alignItems","paddingBottom","StyledTitleContainer","StyledTitleSection","flexGrow","StyledTopSection","paddingLeft","paddingRight","StyledBackButton","IconButton","shouldForwardProp","prop","hasTitleComponent","only","marginLeft","StyledInnerWrapper","marginRight","StyledHeaderContainer","display","justifyContent","StyledCaption","Typography","lineHeight","StyledPageTitle","fontWeight","StyledPageDivider","Divider","marginBottom","PageTitle","title","_jsx","variant","component","children","PageLayout","props","actionBtnTitle","caption","contextButtons","documentTitle","fullWidth","header","hideHeader","actionButtonLink","openLinkInNewTab","pageHeader","showActionButton","showAddIcon","strictToParent","titleComponent","TitleComponent","toParent","navigate","hideDivider","customActionButtons","useTheme","isMobile","useMediaQuery","baseUrl","getMicroFrontendAttribute","actionButtonWithHttps","startsWith","actionButtonLinkFinal","undefined","joinUrlPaths","_jsxs","DocumentTitle","Spacer","size","container","direction","item","alignContent","map","button","index","Box","onClick","history","length","ArrowBackIcon","_Fragment","Button","href","target","rel","Add","FullWidthContainer","FDErrorBoundary","identifier"],"mappings":"0wBAwBO,MAAMA,EAAW,KAGlBC,EAAgBC,EAAO,MAAPA,EAAkC,EAAGC,QAAOC,YAAa,CAC3EJ,SAAUI,EAAQ,OAASJ,EAC3B,CAACG,EAAME,YAAYC,KAAK,OAAQ,CAC5BN,SAAU,QAEdO,OAAQJ,EAAMK,QAAQ,EAAG,OAGvBC,EAAyBP,EAAOQ,EAAPR,EAAa,EAAGC,YAAa,CACxD,CAACA,EAAME,YAAYC,KAAK,OAAQ,CAC5BK,MAAO,OACPC,WAAYT,EAAMK,QAAQ,QAI5BK,EAAeX,EAAOQ,EAAPR,EAAa,EAAGC,YAAa,CAC9CW,SAAU,SACVC,WAAY,aACZH,WAAYT,EAAMK,QAAQ,GAC1BQ,cAAeb,EAAMK,QAAQ,GAE7B,CAACL,EAAME,YAAYC,KAAK,OAAQ,CAC5BM,WAAYT,EAAMK,QAAQ,GAC1BQ,cAAeb,EAAMK,QAAQ,QAI/BS,EAAuBf,EAAOQ,EAAPR,EAAa,EAAGC,YAAa,CACtDS,WAAYT,EAAMK,QAAQ,OAGxBU,EAAqBhB,EAAOQ,EAAPR,EAAa,KAAO,CAC3CiB,SAAU,MAGRC,EAAmBlB,EAAO,MAAPA,EAAc,EAAGC,YAAa,CACnDH,WACAgB,cAAeb,EAAMK,QAAQ,GAE7B,CAACL,EAAME,YAAYC,KAAK,OAAQ,CAC5BU,cAAeb,EAAMK,QAAQ,GAC7Ba,YAAalB,EAAMK,QAAQ,GAC3Bc,aAAcnB,EAAMK,QAAQ,QAI9Be,EAAmBrB,EAAOsB,EAAY,CACxCC,kBAAoBC,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