codeforlife 2.11.4 → 2.11.6
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/Countdown-CL7dyZrl.cjs +2 -0
- package/dist/{Countdown-BtUbr1J_.cjs.map → Countdown-CL7dyZrl.cjs.map} +1 -1
- package/dist/Countdown-snRYiLrs.js +28 -0
- package/dist/{Countdown-DhjAmB0u.js.map → Countdown-snRYiLrs.js.map} +1 -1
- package/dist/Image-B_6DmnVe.cjs +2 -0
- package/dist/{Image-CgRVUblT.cjs.map → Image-B_6DmnVe.cjs.map} +1 -1
- package/dist/{Image-DTOu0h-V.js → Image-mkNhOo5p.js} +3 -3
- package/dist/{Image-DTOu0h-V.js.map → Image-mkNhOo5p.js.map} +1 -1
- package/dist/LinkButton-BQMG96aQ.cjs +2 -0
- package/dist/{LinkButton-Kw2brLTK.cjs.map → LinkButton-BQMG96aQ.cjs.map} +1 -1
- package/dist/LinkButton-CRDs950E.js +12 -0
- package/dist/{LinkButton-sQ5jgHnX.js.map → LinkButton-CRDs950E.js.map} +1 -1
- package/dist/Navigate-Ch0ljYa-.cjs +2 -0
- package/dist/{Navigate-CrMwdIBB.cjs.map → Navigate-Ch0ljYa-.cjs.map} +1 -1
- package/dist/Navigate-Zt9DRJve.js +25 -0
- package/dist/{Navigate-ClPcw87e.js.map → Navigate-Zt9DRJve.js.map} +1 -1
- package/dist/api/endpoints/index.cjs.js +1 -1
- package/dist/api/endpoints/index.cjs.js.map +1 -1
- package/dist/api/endpoints/index.es.js +29 -28
- package/dist/api/endpoints/index.es.js.map +1 -1
- package/dist/api/index.cjs.js +1 -3
- package/dist/api/index.cjs.js.map +1 -1
- package/dist/api/index.es.js +33 -515
- package/dist/api/index.es.js.map +1 -1
- package/dist/api-DIgp_6Vr.cjs +2 -0
- package/dist/{api-9cnyvZj7.cjs.map → api-DIgp_6Vr.cjs.map} +1 -1
- package/dist/api-G8CV5bUa.cjs +2 -0
- package/dist/{api-CAH3GT1O.cjs.map → api-G8CV5bUa.cjs.map} +1 -1
- package/dist/{api-BFYu8ZvQ.js → api-uh8UKwsU.js} +25 -25
- package/dist/{api-BFYu8ZvQ.js.map → api-uh8UKwsU.js.map} +1 -1
- package/dist/auth-B6anBtxF.js +238 -0
- package/dist/{auth-Bb8WkZGN.js.map → auth-B6anBtxF.js.map} +1 -1
- package/dist/auth-C2OUeLmQ.cjs +2 -0
- package/dist/{auth-BwpsrTko.cjs.map → auth-C2OUeLmQ.cjs.map} +1 -1
- package/dist/components/form/index.cjs.js +1 -1
- package/dist/components/form/index.es.js +1 -1
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.cjs.js.map +1 -1
- package/dist/components/index.es.js +118 -118
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/page/index.cjs.js +1 -1
- package/dist/components/page/index.es.js +1 -1
- package/dist/components/router/index.cjs.js +1 -1
- package/dist/components/router/index.es.js +2 -2
- package/dist/components/table/index.cjs.js +1 -1
- package/dist/components/table/index.es.js +1 -1
- package/dist/features/index.cjs.js +1 -1
- package/dist/features/index.cjs.js.map +1 -1
- package/dist/features/index.es.js +24 -22
- package/dist/features/index.es.js.map +1 -1
- package/dist/general-BPbbmkeX.cjs +2 -0
- package/dist/{general-Bo6JGvKB.cjs.map → general-BPbbmkeX.cjs.map} +1 -1
- package/dist/hooks/index.cjs.js +1 -1
- package/dist/hooks/index.es.js +1 -1
- package/dist/index-B3QkMBQe.cjs +2 -0
- package/dist/{index-5C9hpxRF.cjs.map → index-B3QkMBQe.cjs.map} +1 -1
- package/dist/index-BIL7PoEV.js +622 -0
- package/dist/index-BIL7PoEV.js.map +1 -0
- package/dist/index-C08WO83n.js +237 -0
- package/dist/{index-hdS8RgRc.js.map → index-C08WO83n.js.map} +1 -1
- package/dist/{index-CHboZsxD.js → index-CDxf6gMv.js} +92 -92
- package/dist/{index-CHboZsxD.js.map → index-CDxf6gMv.js.map} +1 -1
- package/dist/index-D2B9uIE4.cjs +2 -0
- package/dist/{index-B89FjK7v.cjs.map → index-D2B9uIE4.cjs.map} +1 -1
- package/dist/index-Dadidnct.cjs +2 -0
- package/dist/index-Dadidnct.cjs.map +1 -0
- package/dist/index-IXGAdLKG.js +30 -0
- package/dist/{index-B3e_XaVG.js.map → index-IXGAdLKG.js.map} +1 -1
- package/dist/index-JY2Et3RQ.cjs +2 -0
- package/dist/{index-CwC9mpb3.cjs.map → index-JY2Et3RQ.cjs.map} +1 -1
- package/dist/{schemas-BMQZbhti.js → schemas-UIk-meAN.js} +2 -2
- package/dist/{schemas-BMQZbhti.js.map → schemas-UIk-meAN.js.map} +1 -1
- package/dist/schemas-hIW9-H6-.cjs +2 -0
- package/dist/{schemas-DXX4rh8i.cjs.map → schemas-hIW9-H6-.cjs.map} +1 -1
- package/dist/server/App.cjs.js +1 -1
- package/dist/server/App.cjs.js.map +1 -1
- package/dist/server/App.es.js +11 -11
- package/dist/server/App.es.js.map +1 -1
- package/dist/server/entry.cjs.js +1 -208
- package/dist/server/entry.cjs.js.map +1 -1
- package/dist/server/entry.d.ts +1 -1
- package/dist/server/entry.es.js +32 -21871
- package/dist/server/entry.es.js.map +1 -1
- package/dist/{session-D312kYKk.js → session-COyN01K0.js} +11 -10
- package/dist/{session-D312kYKk.js.map → session-COyN01K0.js.map} +1 -1
- package/dist/session-eOp0H-EC.cjs +2 -0
- package/dist/{session-CacrgFSv.cjs.map → session-eOp0H-EC.cjs.map} +1 -1
- package/dist/theme/components/index.cjs.js +1 -1
- package/dist/theme/components/index.es.js +1 -1
- package/dist/theme/index.cjs.js +1 -1
- package/dist/theme/index.cjs.js.map +1 -1
- package/dist/theme/index.es.js +49 -49
- package/dist/theme/index.es.js.map +1 -1
- package/dist/{urls-CGZI0f1w.cjs → urls-2gheISSO.cjs} +2 -2
- package/dist/{urls-CGZI0f1w.cjs.map → urls-2gheISSO.cjs.map} +1 -1
- package/dist/{urls-DP4a8kxP.js → urls-BG788CnL.js} +2 -2
- package/dist/{urls-DP4a8kxP.js.map → urls-BG788CnL.js.map} +1 -1
- package/dist/utils/api.cjs.js +1 -1
- package/dist/utils/api.es.js +2 -2
- package/dist/utils/router.cjs.js +1 -1
- package/dist/utils/router.cjs.js.map +1 -1
- package/dist/utils/router.es.js +2 -2
- package/dist/utils/store.cjs.js +1 -1
- package/dist/utils/store.cjs.js.map +1 -1
- package/dist/utils/store.es.js +6 -6
- package/dist/utils/test.cjs.js +1 -1
- package/dist/utils/test.cjs.js.map +1 -1
- package/dist/utils/test.es.js +9 -9
- package/dist/utils/test.es.js.map +1 -1
- package/dist/utils/theme.cjs.js +1 -1
- package/dist/utils/theme.es.js +2 -2
- package/package.json +1 -1
- package/dist/Countdown-BtUbr1J_.cjs +0 -2
- package/dist/Countdown-DhjAmB0u.js +0 -28
- package/dist/Image-CgRVUblT.cjs +0 -2
- package/dist/LinkButton-Kw2brLTK.cjs +0 -2
- package/dist/LinkButton-sQ5jgHnX.js +0 -12
- package/dist/Navigate-ClPcw87e.js +0 -25
- package/dist/Navigate-CrMwdIBB.cjs +0 -2
- package/dist/_commonjsHelpers-DKOUU3wS.cjs +0 -2
- package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +0 -1
- package/dist/_commonjsHelpers-DaMA6jEr.js +0 -9
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +0 -1
- package/dist/api-9cnyvZj7.cjs +0 -2
- package/dist/api-CAH3GT1O.cjs +0 -2
- package/dist/auth-Bb8WkZGN.js +0 -237
- package/dist/auth-BwpsrTko.cjs +0 -2
- package/dist/client-BK9NlSVR.js +0 -25208
- package/dist/client-BK9NlSVR.js.map +0 -1
- package/dist/client-CmAMc2Wj.cjs +0 -251
- package/dist/client-CmAMc2Wj.cjs.map +0 -1
- package/dist/en-gb-B_rK7Jx1.js +0 -20
- package/dist/en-gb-B_rK7Jx1.js.map +0 -1
- package/dist/en-gb-CpyEkKq3.cjs +0 -2
- package/dist/en-gb-CpyEkKq3.cjs.map +0 -1
- package/dist/general-Bo6JGvKB.cjs +0 -2
- package/dist/index-5C9hpxRF.cjs +0 -2
- package/dist/index-B3e_XaVG.js +0 -30
- package/dist/index-B89FjK7v.cjs +0 -2
- package/dist/index-BRHFlEjS.js +0 -1187
- package/dist/index-BRHFlEjS.js.map +0 -1
- package/dist/index-CwC9mpb3.cjs +0 -2
- package/dist/index-DuArGzQE.cjs +0 -5
- package/dist/index-DuArGzQE.cjs.map +0 -1
- package/dist/index-hdS8RgRc.js +0 -237
- package/dist/jsx-runtime-B2pbW5Fp.cjs +0 -23
- package/dist/jsx-runtime-B2pbW5Fp.cjs.map +0 -1
- package/dist/jsx-runtime-lzYHhGH3.js +0 -285
- package/dist/jsx-runtime-lzYHhGH3.js.map +0 -1
- package/dist/rtk-query.modern-CjetfYPg.js +0 -3038
- package/dist/rtk-query.modern-CjetfYPg.js.map +0 -1
- package/dist/rtk-query.modern-PBCErCqb.cjs +0 -15
- package/dist/rtk-query.modern-PBCErCqb.cjs.map +0 -1
- package/dist/schemas-DXX4rh8i.cjs +0 -2
- package/dist/session-CacrgFSv.cjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-5C9hpxRF.cjs","sources":["../src/components/page/Section.tsx","../src/components/page/Notification.tsx","../src/components/page/Page.tsx","../src/components/page/Banner.tsx","../src/components/page/TabBar.tsx"],"sourcesContent":["import {\n Box,\n type BoxProps,\n Container,\n type ContainerProps,\n} from \"@mui/material\"\nimport type { FC } from \"react\"\n\nexport interface SectionProps extends ContainerProps {\n boxProps?: Omit<BoxProps, \"children\">\n}\n\nconst Section: FC<SectionProps> = ({ boxProps, ...containerProps }) => {\n return (\n <Box {...boxProps}>\n <Container {...containerProps} />\n </Box>\n )\n}\n\nexport default Section\n","import {\n CloseOutlined as CloseOutlinedIcon,\n ErrorOutline as ErrorOutlineIcon,\n InfoOutlined as InfoOutlinedIcon,\n} from \"@mui/icons-material\"\nimport { type FC, type ReactNode, useEffect, useState } from \"react\"\nimport { IconButton, Stack, Typography } from \"@mui/material\"\n\nimport Section from \"./Section\"\nimport palette from \"../../theme/palette\"\n\nexport interface NotificationProps {\n open?: boolean\n error?: boolean\n onClose?: () => void\n children: ReactNode\n bgcolor?: \"secondary\" | \"tertiary\"\n}\n\nconst Notification: FC<NotificationProps> = ({\n open = true,\n error = false,\n onClose,\n children,\n bgcolor = \"secondary\",\n}) => {\n const [_open, _setOpen] = useState(open)\n\n useEffect(() => {\n _setOpen(open)\n }, [open])\n\n if (!_open) return <></>\n\n // @ts-expect-error guaranteed to be in palette\n const contrastText = palette[bgcolor].contrastText as string\n\n return (\n <Section\n boxProps={{\n bgcolor: {\n secondary: \"#ffd23b\",\n tertiary: \"#08bafc\",\n }[bgcolor],\n }}\n sx={{ paddingY: \"5px\" }}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={2}>\n {error ? (\n <ErrorOutlineIcon htmlColor={contrastText} />\n ) : (\n <InfoOutlinedIcon htmlColor={contrastText} />\n )}\n <Typography variant=\"body2\" color={contrastText} mb={0}>\n {children}\n </Typography>\n <IconButton\n style={{ marginLeft: \"auto\" }}\n onClick={() => {\n _setOpen(false)\n if (onClose !== undefined) onClose()\n }}\n >\n <CloseOutlinedIcon htmlColor={contrastText} />\n </IconButton>\n </Stack>\n </Section>\n )\n}\n\nexport default Notification\n","import { Children, type JSX, useEffect } from \"react\"\nimport { type Location, useLocation } from \"react-router\"\n\nimport Notification, { type NotificationProps } from \"./Notification\"\nimport {\n type SessionMetadata,\n type UseSessionChildren,\n type UseSessionChildrenFunction,\n type UseSessionOptions,\n useSession,\n} from \"../../hooks/auth\"\n\nexport type PageState = {\n notifications: Array<{\n index?: number\n props: NotificationProps\n }>\n scroll: { x: number; y: number }\n}\n\nexport interface PageProps<\n SessionUserType extends SessionMetadata[\"user_type\"] | undefined,\n> {\n children: UseSessionChildren<SessionUserType>\n session?: UseSessionOptions<SessionUserType>\n}\n\nconst Page = <\n SessionUserType extends SessionMetadata[\"user_type\"] | undefined = undefined,\n>({\n children,\n session,\n}: PageProps<SessionUserType>): JSX.Element => {\n const { state } = useLocation() as Location<null | Partial<PageState>>\n\n let { scroll, notifications } = state || {}\n scroll = scroll || { x: 0, y: 0 }\n notifications = notifications || []\n\n useEffect(() => {\n window.scroll(scroll.x, scroll.y)\n }, [scroll.x, scroll.y])\n\n return (\n <>\n {useSession((metadata?: SessionMetadata) => {\n if (typeof children === \"function\") {\n children = metadata\n ? (children as UseSessionChildrenFunction<true>)(metadata)\n : (children as UseSessionChildrenFunction<false>)(metadata)\n }\n\n if (notifications.length) {\n const childrenArray = Children.toArray(children)\n\n notifications.forEach((notification, index) => {\n void childrenArray.splice(\n notification.index ?? index,\n 0,\n <Notification {...notification.props} />,\n )\n })\n\n return childrenArray\n }\n\n return children\n }, session)}\n </>\n )\n}\n\nexport default Page\n","import { Stack, Typography } from \"@mui/material\"\n\nimport Image, { type ImageProps } from \"../Image\"\nimport { LinkButton, type LinkButtonProps } from \"../router\"\nimport { primary, secondary, tertiary } from \"../../theme/colors\"\nimport Section from \"./Section\"\nimport palette from \"../../theme/palette\"\n\nexport interface BannerProps<\n Button1State extends Record<string, any> = Record<string, any>,\n Button2State extends Record<string, any> = Record<string, any>,\n> {\n header: string\n subheader?: string\n textAlign?: \"start\" | \"center\"\n imageProps?: ImageProps\n button1Props?: LinkButtonProps<\"to\", Button1State>\n button2Props?: LinkButtonProps<\"to\", Button2State>\n bgcolor?: \"primary\" | \"secondary\" | \"tertiary\"\n}\n\nconst Banner = <\n Button1State extends Record<string, any> = Record<string, any>,\n Button2State extends Record<string, any> = Record<string, any>,\n>({\n header,\n subheader,\n textAlign = \"start\",\n imageProps,\n button1Props,\n button2Props,\n bgcolor = \"primary\",\n}: BannerProps<Button1State, Button2State>) => {\n // @ts-expect-error guaranteed to be in palette\n const contrastText = palette[bgcolor].contrastText as string\n\n return (\n <Section\n boxProps={{\n bgcolor: {\n primary: primary[500],\n secondary: secondary[500],\n tertiary: tertiary[500],\n }[bgcolor],\n }}\n sx={{ paddingY: 0 }}\n >\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent={textAlign}\n gap={2}\n >\n <Stack\n py={{\n xs: \"80px\",\n md: imageProps !== undefined ? 0 : \"100px\",\n }}\n textAlign={textAlign}\n >\n <Typography\n variant=\"h2\"\n color={contrastText}\n mb={subheader !== undefined ? undefined : 0}\n >\n {header}\n </Typography>\n {subheader !== undefined && (\n <Typography\n color={contrastText}\n variant=\"h4\"\n mb={button1Props !== undefined ? undefined : 0}\n >\n {subheader}\n </Typography>\n )}\n <Stack direction=\"row\" gap={2}>\n {button1Props !== undefined && <LinkButton {...button1Props} />}\n {button2Props !== undefined && <LinkButton {...button2Props} />}\n </Stack>\n </Stack>\n {imageProps !== undefined && (\n <Image\n {...imageProps}\n display={{ xs: \"none\", md: \"block\" }}\n maxWidth=\"320px\"\n marginLeft=\"auto\"\n />\n )}\n </Stack>\n </Section>\n )\n}\n\nexport default Banner\n","import {\n ChevronLeft as ChevronLeftIcon,\n ChevronRight as ChevronRightIcon,\n} from \"@mui/icons-material\"\nimport { type FC, type ReactNode, useEffect, useState } from \"react\"\nimport {\n IconButton,\n Tab,\n type TabScrollButtonProps,\n Tabs,\n Typography,\n} from \"@mui/material\"\nimport { object as YupObject, string as YupString } from \"yup\"\nimport { generatePath, useNavigate, useParams } from \"react-router\"\n\nimport Section from \"./Section\"\nimport { primary } from \"../../theme/colors\"\nimport { tryValidateSync } from \"../../utils/schema\"\n\nexport interface TabBarProps {\n header: string\n tabs: Array<{\n label: string\n children: ReactNode\n path: string\n }>\n originalPath: string\n value?: number\n}\n\nconst TabBar: FC<TabBarProps> = ({ header, tabs, originalPath, value = 0 }) => {\n const params = useParams()\n const navigate = useNavigate()\n const [_value, _setValue] = useState(\n value < 0 ? 0 : value >= tabs.length ? tabs.length - 1 : value,\n )\n\n const labels = tabs.map(tab => tab.label)\n const children = tabs.map(tab => tab.children)\n const paths = tabs.map(tab => tab.path)\n\n useEffect(() => {\n _setValue(value)\n }, [value])\n\n useEffect(() => {\n const tab = tryValidateSync(\n params,\n YupObject({\n tab: YupString().oneOf(paths).required(),\n }),\n )?.tab\n\n if (tab !== undefined) {\n _setValue(paths.indexOf(tab))\n }\n }, [params, paths])\n\n return (\n <>\n <Section\n boxProps={{ bgcolor: primary[500] }}\n sx={{ paddingY: \"100px\" }}\n className=\"flex-center\"\n >\n <Typography\n textAlign=\"center\"\n variant=\"h2\"\n style={{ color: \"white\" }}\n mb={0}\n >\n {header}\n </Typography>\n </Section>\n <Section\n boxProps={{ bgcolor: primary[300] }}\n sx={{ paddingY: \"6px\" }}\n className=\"flex-center\"\n >\n <Tabs\n value={_value}\n onChange={(_, value: number) => {\n void navigate(\n generatePath(originalPath, {\n tab: paths[value],\n }),\n )\n }}\n ScrollButtonComponent={({\n disabled,\n onClick,\n direction,\n }: TabScrollButtonProps) => {\n return (\n <>\n {disabled === false && (\n <IconButton\n onClick={onClick}\n style={{\n padding: 0,\n [direction === \"left\" ? \"marginRight\" : \"marginLeft\"]:\n \"15px\",\n color: \"white\",\n }}\n >\n {direction === \"left\" ? (\n <>\n <ChevronLeftIcon />\n </>\n ) : (\n <>\n <ChevronRightIcon />\n </>\n )}\n </IconButton>\n )}\n </>\n )\n }}\n >\n {labels.map(label => (\n <Tab disableRipple key={label} label={label} />\n ))}\n </Tabs>\n </Section>\n {children[_value]}\n </>\n )\n}\n\nexport default TabBar\n"],"names":["Section","boxProps","containerProps","jsx","Box","Container","Notification","open","error","onClose","children","bgcolor","_open","_setOpen","useState","useEffect","Fragment","contrastText","palette","Stack","ErrorOutlineIcon","InfoOutlinedIcon","Typography","IconButton","CloseOutlinedIcon","Page","session","state","useLocation","scroll","notifications","useSession","metadata","childrenArray","Children","notification","index","Banner","header","subheader","textAlign","imageProps","button1Props","button2Props","primary","secondary","tertiary","jsxs","LinkButton","Image","TabBar","tabs","originalPath","value","params","useParams","navigate","useNavigate","_value","_setValue","labels","tab","paths","tryValidateSync","YupObject","YupString","Tabs","_","generatePath","disabled","onClick","direction","Chev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AAA,SAAA,CACG,aAAa,IACZb,EAAAA,kBAAAA,IAACoB,EAAAA,WAAA,CACC,QAAA+C,EACA,MAAO,CACL,QAAS,EACT,CAACC,IAAc,OAAS,cAAgB,YAAY,EAClD,OACF,MAAO,OAAA,EAGR,SAAAA,IAAc,OACbpE,EAAAA,kBAAAA,IAAAa,EAAAA,kBAAAA,SAAA,CACE,SAAAb,EAAAA,kBAAAA,IAACqE,EAAAA,YAAA,CAAA,CAAgB,EACnB,EAEArE,EAAAA,kBAAAA,IAAAa,6BAAA,CACE,SAAAb,wBAACsE,EAAAA,aAAA,CAAA,CAAiB,CAAA,CACpB,CAAA,CAAA,EAIR,EAIH,SAAAb,EAAO,IAAIc,GACVvE,EAAAA,kBAAAA,IAACwE,OAAI,cAAa,GAAa,MAAAD,CAAA,EAAPA,CAAqB,CAC9C,CAAA,CAAA,CACH,CAAA,EAEDhE,EAASgD,CAAM,CAAA,EAClB,CAEJ"}
|
|
1
|
+
{"version":3,"file":"index-B3QkMBQe.cjs","sources":["../src/components/page/Section.tsx","../src/components/page/Notification.tsx","../src/components/page/Page.tsx","../src/components/page/Banner.tsx","../src/components/page/TabBar.tsx"],"sourcesContent":["import {\n Box,\n type BoxProps,\n Container,\n type ContainerProps,\n} from \"@mui/material\"\nimport type { FC } from \"react\"\n\nexport interface SectionProps extends ContainerProps {\n boxProps?: Omit<BoxProps, \"children\">\n}\n\nconst Section: FC<SectionProps> = ({ boxProps, ...containerProps }) => {\n return (\n <Box {...boxProps}>\n <Container {...containerProps} />\n </Box>\n )\n}\n\nexport default Section\n","import {\n CloseOutlined as CloseOutlinedIcon,\n ErrorOutline as ErrorOutlineIcon,\n InfoOutlined as InfoOutlinedIcon,\n} from \"@mui/icons-material\"\nimport { type FC, type ReactNode, useEffect, useState } from \"react\"\nimport { IconButton, Stack, Typography } from \"@mui/material\"\n\nimport Section from \"./Section\"\nimport palette from \"../../theme/palette\"\n\nexport interface NotificationProps {\n open?: boolean\n error?: boolean\n onClose?: () => void\n children: ReactNode\n bgcolor?: \"secondary\" | \"tertiary\"\n}\n\nconst Notification: FC<NotificationProps> = ({\n open = true,\n error = false,\n onClose,\n children,\n bgcolor = \"secondary\",\n}) => {\n const [_open, _setOpen] = useState(open)\n\n useEffect(() => {\n _setOpen(open)\n }, [open])\n\n if (!_open) return <></>\n\n // @ts-expect-error guaranteed to be in palette\n const contrastText = palette[bgcolor].contrastText as string\n\n return (\n <Section\n boxProps={{\n bgcolor: {\n secondary: \"#ffd23b\",\n tertiary: \"#08bafc\",\n }[bgcolor],\n }}\n sx={{ paddingY: \"5px\" }}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={2}>\n {error ? (\n <ErrorOutlineIcon htmlColor={contrastText} />\n ) : (\n <InfoOutlinedIcon htmlColor={contrastText} />\n )}\n <Typography variant=\"body2\" color={contrastText} mb={0}>\n {children}\n </Typography>\n <IconButton\n style={{ marginLeft: \"auto\" }}\n onClick={() => {\n _setOpen(false)\n if (onClose !== undefined) onClose()\n }}\n >\n <CloseOutlinedIcon htmlColor={contrastText} />\n </IconButton>\n </Stack>\n </Section>\n )\n}\n\nexport default Notification\n","import { Children, type JSX, useEffect } from \"react\"\nimport { type Location, useLocation } from \"react-router\"\n\nimport Notification, { type NotificationProps } from \"./Notification\"\nimport {\n type SessionMetadata,\n type UseSessionChildren,\n type UseSessionChildrenFunction,\n type UseSessionOptions,\n useSession,\n} from \"../../hooks/auth\"\n\nexport type PageState = {\n notifications: Array<{\n index?: number\n props: NotificationProps\n }>\n scroll: { x: number; y: number }\n}\n\nexport interface PageProps<\n SessionUserType extends SessionMetadata[\"user_type\"] | undefined,\n> {\n children: UseSessionChildren<SessionUserType>\n session?: UseSessionOptions<SessionUserType>\n}\n\nconst Page = <\n SessionUserType extends SessionMetadata[\"user_type\"] | undefined = undefined,\n>({\n children,\n session,\n}: PageProps<SessionUserType>): JSX.Element => {\n const { state } = useLocation() as Location<null | Partial<PageState>>\n\n let { scroll, notifications } = state || {}\n scroll = scroll || { x: 0, y: 0 }\n notifications = notifications || []\n\n useEffect(() => {\n window.scroll(scroll.x, scroll.y)\n }, [scroll.x, scroll.y])\n\n return (\n <>\n {useSession((metadata?: SessionMetadata) => {\n if (typeof children === \"function\") {\n children = metadata\n ? (children as UseSessionChildrenFunction<true>)(metadata)\n : (children as UseSessionChildrenFunction<false>)(metadata)\n }\n\n if (notifications.length) {\n const childrenArray = Children.toArray(children)\n\n notifications.forEach((notification, index) => {\n void childrenArray.splice(\n notification.index ?? index,\n 0,\n <Notification {...notification.props} />,\n )\n })\n\n return childrenArray\n }\n\n return children\n }, session)}\n </>\n )\n}\n\nexport default Page\n","import { Stack, Typography } from \"@mui/material\"\n\nimport Image, { type ImageProps } from \"../Image\"\nimport { LinkButton, type LinkButtonProps } from \"../router\"\nimport { primary, secondary, tertiary } from \"../../theme/colors\"\nimport Section from \"./Section\"\nimport palette from \"../../theme/palette\"\n\nexport interface BannerProps<\n Button1State extends Record<string, any> = Record<string, any>,\n Button2State extends Record<string, any> = Record<string, any>,\n> {\n header: string\n subheader?: string\n textAlign?: \"start\" | \"center\"\n imageProps?: ImageProps\n button1Props?: LinkButtonProps<\"to\", Button1State>\n button2Props?: LinkButtonProps<\"to\", Button2State>\n bgcolor?: \"primary\" | \"secondary\" | \"tertiary\"\n}\n\nconst Banner = <\n Button1State extends Record<string, any> = Record<string, any>,\n Button2State extends Record<string, any> = Record<string, any>,\n>({\n header,\n subheader,\n textAlign = \"start\",\n imageProps,\n button1Props,\n button2Props,\n bgcolor = \"primary\",\n}: BannerProps<Button1State, Button2State>) => {\n // @ts-expect-error guaranteed to be in palette\n const contrastText = palette[bgcolor].contrastText as string\n\n return (\n <Section\n boxProps={{\n bgcolor: {\n primary: primary[500],\n secondary: secondary[500],\n tertiary: tertiary[500],\n }[bgcolor],\n }}\n sx={{ paddingY: 0 }}\n >\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent={textAlign}\n gap={2}\n >\n <Stack\n py={{\n xs: \"80px\",\n md: imageProps !== undefined ? 0 : \"100px\",\n }}\n textAlign={textAlign}\n >\n <Typography\n variant=\"h2\"\n color={contrastText}\n mb={subheader !== undefined ? undefined : 0}\n >\n {header}\n </Typography>\n {subheader !== undefined && (\n <Typography\n color={contrastText}\n variant=\"h4\"\n mb={button1Props !== undefined ? undefined : 0}\n >\n {subheader}\n </Typography>\n )}\n <Stack direction=\"row\" gap={2}>\n {button1Props !== undefined && <LinkButton {...button1Props} />}\n {button2Props !== undefined && <LinkButton {...button2Props} />}\n </Stack>\n </Stack>\n {imageProps !== undefined && (\n <Image\n {...imageProps}\n display={{ xs: \"none\", md: \"block\" }}\n maxWidth=\"320px\"\n marginLeft=\"auto\"\n />\n )}\n </Stack>\n </Section>\n )\n}\n\nexport default Banner\n","import {\n ChevronLeft as ChevronLeftIcon,\n ChevronRight as ChevronRightIcon,\n} from \"@mui/icons-material\"\nimport { type FC, type ReactNode, useEffect, useState } from \"react\"\nimport {\n IconButton,\n Tab,\n type TabScrollButtonProps,\n Tabs,\n Typography,\n} from \"@mui/material\"\nimport { object as YupObject, string as YupString } from \"yup\"\nimport { generatePath, useNavigate, useParams } from \"react-router\"\n\nimport Section from \"./Section\"\nimport { primary } from \"../../theme/colors\"\nimport { tryValidateSync } from \"../../utils/schema\"\n\nexport interface TabBarProps {\n header: string\n tabs: Array<{\n label: string\n children: ReactNode\n path: string\n }>\n originalPath: string\n value?: number\n}\n\nconst TabBar: FC<TabBarProps> = ({ header, tabs, originalPath, value = 0 }) => {\n const params = useParams()\n const navigate = useNavigate()\n const [_value, _setValue] = useState(\n value < 0 ? 0 : value >= tabs.length ? tabs.length - 1 : value,\n )\n\n const labels = tabs.map(tab => tab.label)\n const children = tabs.map(tab => tab.children)\n const paths = tabs.map(tab => tab.path)\n\n useEffect(() => {\n _setValue(value)\n }, [value])\n\n useEffect(() => {\n const tab = tryValidateSync(\n params,\n YupObject({\n tab: YupString().oneOf(paths).required(),\n }),\n )?.tab\n\n if (tab !== undefined) {\n _setValue(paths.indexOf(tab))\n }\n }, [params, paths])\n\n return (\n <>\n <Section\n boxProps={{ bgcolor: primary[500] }}\n sx={{ paddingY: \"100px\" }}\n className=\"flex-center\"\n >\n <Typography\n textAlign=\"center\"\n variant=\"h2\"\n style={{ color: \"white\" }}\n mb={0}\n >\n {header}\n </Typography>\n </Section>\n <Section\n boxProps={{ bgcolor: primary[300] }}\n sx={{ paddingY: \"6px\" }}\n className=\"flex-center\"\n >\n <Tabs\n value={_value}\n onChange={(_, value: number) => {\n void navigate(\n generatePath(originalPath, {\n tab: paths[value],\n }),\n )\n }}\n ScrollButtonComponent={({\n disabled,\n onClick,\n direction,\n }: TabScrollButtonProps) => {\n return (\n <>\n {disabled === false && (\n <IconButton\n onClick={onClick}\n style={{\n padding: 0,\n [direction === \"left\" ? \"marginRight\" : \"marginLeft\"]:\n \"15px\",\n color: \"white\",\n }}\n >\n {direction === \"left\" ? (\n <>\n <ChevronLeftIcon />\n </>\n ) : (\n <>\n <ChevronRightIcon />\n </>\n )}\n </IconButton>\n )}\n </>\n )\n }}\n >\n {labels.map(label => (\n <Tab disableRipple key={label} label={label} />\n ))}\n </Tabs>\n </Section>\n {children[_value]}\n </>\n )\n}\n\nexport default TabBar\n"],"names":["Section","boxProps","containerProps","jsx","Box","Container","Notification","open","error","onClose","children","bgcolor","_open","_setOpen","useState","useEffect","Fragment","contrastText","palette","Stack","ErrorOutlineIcon","InfoOutlinedIcon","Typography","IconButton","CloseOutlinedIcon","Page","session","state","useLocation","scroll","notifications","useSession","metadata","childrenArray","Children","notification","index","Banner","header","subheader","textAlign","imageProps","button1Props","button2Props","primary","secondary","tertiary","jsxs","LinkButton","Image","TabBar","tabs","originalPath","value","params","useParams","navigate","useNavigate","_value","_setValue","labels","tab","paths","tryValidateSync","YupObject","YupString","Tabs","_","generatePath","disabled","onClick","direction","ChevronLeftIcon","ChevronRightIcon","label","Tab"],"mappings":"6VAYMA,EAA4B,CAAC,CAAE,SAAAC,EAAU,GAAGC,KAE9C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,EAAAA,aAAA,CAAA,CAAiB,CAAA,CACpB,CAAA,CAAA,EAIR,EAIH,SAAAb,EAAO,IAAIc,GACVvE,EAAAA,IAACwE,OAAI,cAAa,GAAa,MAAAD,CAAA,EAAPA,CAAqB,CAC9C,CAAA,CAAA,CACH,CAAA,EAEDhE,EAASgD,CAAM,CAAA,EAClB,CAEJ"}
|
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
import { jsx as o, Fragment as j, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import { CircularProgress as H, Button as M, Autocomplete as K, TextField as N, FormControl as G, FormControlLabel as W, Checkbox as J, FormHelperText as U, InputAdornment as w, IconButton as Q } from "@mui/material";
|
|
3
|
+
import { useState as E, useEffect as B, forwardRef as X, Children as Z, useRef as ee } from "react";
|
|
4
|
+
import { S as te } from "./api-uh8UKwsU.js";
|
|
5
|
+
import { u as re } from "./api-Cs4Y-WeI.js";
|
|
6
|
+
import { Field as T, Formik as oe, Form as ne } from "formik";
|
|
7
|
+
import { string as I, number as ie, bool as se, date as le, array as ae } from "yup";
|
|
8
|
+
import { schemaToFieldValidator as V, submitForm as ce } from "./utils/form.es.js";
|
|
9
|
+
import { getNestedProperty as y, COUNTRY_ISO_CODE_MAPPING as ue, COUNTRY_ISO_CODES as de, getKeyPaths as he, UK_COUNTIES as pe } from "./utils/general.es.js";
|
|
10
|
+
import "dayjs/locale/en-gb";
|
|
11
|
+
import { LocalizationProvider as fe, DatePicker as me } from "@mui/x-date-pickers";
|
|
12
|
+
import ge from "dayjs";
|
|
13
|
+
import { AdapterDayjs as be } from "@mui/x-date-pickers/AdapterDayjs";
|
|
14
|
+
import { EmailOutlined as ye, PersonOutlined as Fe, Visibility as Ce, VisibilityOff as Pe } from "@mui/icons-material";
|
|
15
|
+
import "@reduxjs/toolkit/query/react";
|
|
16
|
+
import "./settings/index.es.js";
|
|
17
|
+
import "./session-oI-Ht2C8.js";
|
|
18
|
+
import "js-cookie";
|
|
19
|
+
import { u as Oe } from "./schemas-UIk-meAN.js";
|
|
20
|
+
import "./urls-BG788CnL.js";
|
|
21
|
+
const xe = ({
|
|
22
|
+
useLazyListQuery: t,
|
|
23
|
+
filterOptions: e,
|
|
24
|
+
getOptionLabel: n,
|
|
25
|
+
getOptionKey: r = (l) => l.id,
|
|
26
|
+
searchKey: i,
|
|
27
|
+
...s
|
|
28
|
+
}) => {
|
|
29
|
+
const [l, d] = E(""), [a, { isLoading: u, isError: c }] = t(), [{ limit: m, offset: p }, f] = re(), [{ options: C, hasMore: g }, _] = E({ options: {}, hasMore: !0 });
|
|
30
|
+
B(
|
|
31
|
+
() => {
|
|
32
|
+
const F = { limit: m, offset: p, ...e };
|
|
33
|
+
l && (F[i] = l), a(F, !0).unwrap().then(({ data: O, offset: S, limit: x, count: v }) => {
|
|
34
|
+
_(({ options: D }) => {
|
|
35
|
+
const R = { ...D };
|
|
36
|
+
return O.forEach(($) => {
|
|
37
|
+
R[r($)] = $;
|
|
38
|
+
}), { options: R, hasMore: S + x < v };
|
|
39
|
+
});
|
|
40
|
+
}).catch((O) => {
|
|
41
|
+
O && console.error(O);
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
+
[
|
|
46
|
+
a,
|
|
47
|
+
m,
|
|
48
|
+
p,
|
|
49
|
+
i,
|
|
50
|
+
l,
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
...Object.values(e || {})
|
|
53
|
+
]
|
|
54
|
+
);
|
|
55
|
+
let h = Object.keys(C);
|
|
56
|
+
if (!h.length) return /* @__PURE__ */ o(j, {});
|
|
57
|
+
typeof r(Object.values(C)[0]) == "number" && (h = h.map(Number));
|
|
58
|
+
function b() {
|
|
59
|
+
f(({ page: F, limit: O }) => ({ page: F + 1, limit: O }));
|
|
60
|
+
}
|
|
61
|
+
return /* @__PURE__ */ o(
|
|
62
|
+
L,
|
|
63
|
+
{
|
|
64
|
+
options: h,
|
|
65
|
+
getOptionLabel: (F) => n(C[F]),
|
|
66
|
+
onInputChange: (F, O, S) => {
|
|
67
|
+
d(S === "input" ? O : "");
|
|
68
|
+
},
|
|
69
|
+
ListboxComponent: X(({ children: F, ...O }, S) => {
|
|
70
|
+
const x = Z.toArray(F);
|
|
71
|
+
return u ? x.push(/* @__PURE__ */ o(H, {}, "is-loading")) : (c && x.push(/* @__PURE__ */ o(te, {}, "is-error")), g && x.push(
|
|
72
|
+
/* @__PURE__ */ o(M, { onClick: b, children: "Load more" }, "load-more")
|
|
73
|
+
)), /* @__PURE__ */ o(
|
|
74
|
+
"ul",
|
|
75
|
+
{
|
|
76
|
+
...O,
|
|
77
|
+
ref: S,
|
|
78
|
+
onScroll: (v) => {
|
|
79
|
+
!u && v.currentTarget.clientHeight + v.currentTarget.scrollTop >= v.currentTarget.scrollHeight && b();
|
|
80
|
+
},
|
|
81
|
+
children: x
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}),
|
|
85
|
+
...s
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}, L = ({
|
|
89
|
+
textFieldProps: t,
|
|
90
|
+
options: e,
|
|
91
|
+
validateOptions: n,
|
|
92
|
+
...r
|
|
93
|
+
}) => {
|
|
94
|
+
const { id: i, name: s, required: l, ...d } = t, a = s.split("."), u = "not a valid option";
|
|
95
|
+
let c = typeof e[0] == "string" ? I().oneOf(e, u) : ie().oneOf(e, u);
|
|
96
|
+
l && (c = c.required());
|
|
97
|
+
const m = {
|
|
98
|
+
name: s,
|
|
99
|
+
type: typeof e[0] == "string" ? "text" : "number",
|
|
100
|
+
validate: V(c, n)
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ o(T, { ...m, children: ({ form: p, meta: f }) => {
|
|
103
|
+
const C = y(
|
|
104
|
+
p.values,
|
|
105
|
+
a
|
|
106
|
+
), g = y(p.touched, a), _ = y(p.errors, a);
|
|
107
|
+
return /* @__PURE__ */ o(
|
|
108
|
+
K,
|
|
109
|
+
{
|
|
110
|
+
options: e,
|
|
111
|
+
defaultValue: f.initialValue === "" ? void 0 : f.initialValue,
|
|
112
|
+
renderInput: ({
|
|
113
|
+
id: h,
|
|
114
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
115
|
+
...b
|
|
116
|
+
}) => /* @__PURE__ */ o(
|
|
117
|
+
N,
|
|
118
|
+
{
|
|
119
|
+
id: i ?? s,
|
|
120
|
+
name: s,
|
|
121
|
+
required: l,
|
|
122
|
+
type: "text",
|
|
123
|
+
value: C,
|
|
124
|
+
error: g && !!_,
|
|
125
|
+
helperText: g && _,
|
|
126
|
+
...d,
|
|
127
|
+
...b
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
onChange: (h, b) => {
|
|
131
|
+
p.setFieldValue(s, b ?? void 0, !0);
|
|
132
|
+
},
|
|
133
|
+
onBlur: p.handleBlur,
|
|
134
|
+
...r
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
} });
|
|
138
|
+
}, Te = ({
|
|
139
|
+
id: t,
|
|
140
|
+
name: e,
|
|
141
|
+
formControlLabelProps: n,
|
|
142
|
+
required: r = !1,
|
|
143
|
+
errorMessage: i = "this is a required field",
|
|
144
|
+
validateOptions: s,
|
|
145
|
+
...l
|
|
146
|
+
}) => {
|
|
147
|
+
const d = e.split(".");
|
|
148
|
+
let a = se();
|
|
149
|
+
r && (a = a.oneOf([!0], i));
|
|
150
|
+
const u = {
|
|
151
|
+
name: e,
|
|
152
|
+
type: "checkbox",
|
|
153
|
+
validate: V(a, s)
|
|
154
|
+
};
|
|
155
|
+
return /* @__PURE__ */ o(T, { ...u, children: ({ form: c, meta: m }) => {
|
|
156
|
+
const p = y(c.touched, d), f = y(c.errors, d), C = y(
|
|
157
|
+
c.values,
|
|
158
|
+
d
|
|
159
|
+
), g = p && !!f;
|
|
160
|
+
return /* @__PURE__ */ k(G, { error: g, required: r, children: [
|
|
161
|
+
/* @__PURE__ */ o(
|
|
162
|
+
W,
|
|
163
|
+
{
|
|
164
|
+
control: /* @__PURE__ */ o(
|
|
165
|
+
J,
|
|
166
|
+
{
|
|
167
|
+
defaultChecked: m.initialValue,
|
|
168
|
+
id: t ?? e,
|
|
169
|
+
name: e,
|
|
170
|
+
value: C,
|
|
171
|
+
onChange: c.handleChange,
|
|
172
|
+
onBlur: c.handleBlur,
|
|
173
|
+
...l
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
...n
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
g && /* @__PURE__ */ o(U, { children: f })
|
|
180
|
+
] });
|
|
181
|
+
} });
|
|
182
|
+
}, _e = ({
|
|
183
|
+
textFieldProps: t,
|
|
184
|
+
...e
|
|
185
|
+
}) => {
|
|
186
|
+
const {
|
|
187
|
+
name: n = "country",
|
|
188
|
+
label: r = "Country",
|
|
189
|
+
placeholder: i = "Select your country",
|
|
190
|
+
...s
|
|
191
|
+
} = t || {};
|
|
192
|
+
return /* @__PURE__ */ o(
|
|
193
|
+
L,
|
|
194
|
+
{
|
|
195
|
+
options: de,
|
|
196
|
+
getOptionLabel: (l) => ue[l],
|
|
197
|
+
textFieldProps: { name: n, label: r, placeholder: i, ...s },
|
|
198
|
+
...e
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
}, Se = ({
|
|
202
|
+
name: t,
|
|
203
|
+
required: e,
|
|
204
|
+
minDate: n,
|
|
205
|
+
maxDate: r,
|
|
206
|
+
validateOptions: i,
|
|
207
|
+
...s
|
|
208
|
+
}) => {
|
|
209
|
+
const l = t.split(".");
|
|
210
|
+
function d(c) {
|
|
211
|
+
return c.locale("en-gb").format("L");
|
|
212
|
+
}
|
|
213
|
+
let a = le();
|
|
214
|
+
e && (a = a.required()), n && (a = a.min(
|
|
215
|
+
n,
|
|
216
|
+
`this field must be after or equal to ${d(n)}`
|
|
217
|
+
)), r && (a = a.max(
|
|
218
|
+
r,
|
|
219
|
+
`this field must be before or equal to ${d(r)}`
|
|
220
|
+
));
|
|
221
|
+
const u = {
|
|
222
|
+
name: t,
|
|
223
|
+
type: "date",
|
|
224
|
+
validate: V(a, i)
|
|
225
|
+
};
|
|
226
|
+
return /* @__PURE__ */ o(T, { ...u, children: ({ form: c }) => {
|
|
227
|
+
const m = y(c.errors, l), p = y(c.touched, l);
|
|
228
|
+
let f = y(
|
|
229
|
+
c.values,
|
|
230
|
+
l
|
|
231
|
+
);
|
|
232
|
+
f = f ? ge(f) : null;
|
|
233
|
+
function C(g) {
|
|
234
|
+
c.setFieldValue(
|
|
235
|
+
t,
|
|
236
|
+
g && g.isValid() ? g.format("YYYY-MM-DD") : null,
|
|
237
|
+
!0
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
return /* @__PURE__ */ o(
|
|
241
|
+
fe,
|
|
242
|
+
{
|
|
243
|
+
dateAdapter: be,
|
|
244
|
+
adapterLocale: "en-gb",
|
|
245
|
+
children: /* @__PURE__ */ o(
|
|
246
|
+
me,
|
|
247
|
+
{
|
|
248
|
+
name: t,
|
|
249
|
+
value: f,
|
|
250
|
+
minDate: n,
|
|
251
|
+
maxDate: r,
|
|
252
|
+
onChange: C,
|
|
253
|
+
slotProps: {
|
|
254
|
+
textField: {
|
|
255
|
+
id: t,
|
|
256
|
+
// @ts-expect-error value is compatible
|
|
257
|
+
onChange: (g) => {
|
|
258
|
+
C(g);
|
|
259
|
+
},
|
|
260
|
+
onBlur: c.handleBlur,
|
|
261
|
+
required: e,
|
|
262
|
+
error: p && !!m,
|
|
263
|
+
helperText: p && m
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
...s
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
} });
|
|
272
|
+
}, A = ({
|
|
273
|
+
id: t,
|
|
274
|
+
name: e,
|
|
275
|
+
schema: n,
|
|
276
|
+
type: r = "text",
|
|
277
|
+
required: i = !1,
|
|
278
|
+
dirty: s = !1,
|
|
279
|
+
unique: l = !1,
|
|
280
|
+
uniqueCaseInsensitive: d = !1,
|
|
281
|
+
split: a,
|
|
282
|
+
validateOptions: u,
|
|
283
|
+
...c
|
|
284
|
+
}) => {
|
|
285
|
+
const [m, p] = E(""), f = e.split(".");
|
|
286
|
+
function C() {
|
|
287
|
+
let h = n;
|
|
288
|
+
if (h = i ? h.required() : h.optional(), s && !a && (h = h.notOneOf(
|
|
289
|
+
[m],
|
|
290
|
+
"cannot be initial value"
|
|
291
|
+
)), !a) return h;
|
|
292
|
+
let b = ae().of(h);
|
|
293
|
+
return b = i ? b.required().min(1) : b.optional(), (l || d) && (b = b.test({
|
|
294
|
+
message: "cannot have duplicates",
|
|
295
|
+
test: (P) => Array.isArray(P) && P.length >= 2 && P.every((F) => typeof F == "string") ? new Set(
|
|
296
|
+
d ? P.map((F) => F.toLowerCase()) : P
|
|
297
|
+
).size === P.length : !0
|
|
298
|
+
})), s && (b = b.notOneOf(
|
|
299
|
+
[m],
|
|
300
|
+
"cannot be initial value"
|
|
301
|
+
)), b;
|
|
302
|
+
}
|
|
303
|
+
const g = {
|
|
304
|
+
name: e,
|
|
305
|
+
type: r,
|
|
306
|
+
validate: V(C(), u)
|
|
307
|
+
};
|
|
308
|
+
return /* @__PURE__ */ o(T, { ...g, children: ({ form: h }) => {
|
|
309
|
+
const b = y(
|
|
310
|
+
h.initialValues,
|
|
311
|
+
f
|
|
312
|
+
), P = y(
|
|
313
|
+
h.values,
|
|
314
|
+
f
|
|
315
|
+
), F = y(h.errors, f), O = y(h.touched, f);
|
|
316
|
+
return B(() => {
|
|
317
|
+
p(b);
|
|
318
|
+
}, [b]), B(() => {
|
|
319
|
+
h.setFieldValue(
|
|
320
|
+
e,
|
|
321
|
+
a && typeof P == "string" ? P.split(a) : P,
|
|
322
|
+
!0
|
|
323
|
+
);
|
|
324
|
+
}, [P]), /* @__PURE__ */ o(
|
|
325
|
+
N,
|
|
326
|
+
{
|
|
327
|
+
id: t ?? e,
|
|
328
|
+
name: e,
|
|
329
|
+
type: r,
|
|
330
|
+
required: i,
|
|
331
|
+
value: P,
|
|
332
|
+
onChange: h.handleChange,
|
|
333
|
+
onBlur: h.handleBlur,
|
|
334
|
+
error: O && !!F,
|
|
335
|
+
helperText: O && F,
|
|
336
|
+
...c
|
|
337
|
+
}
|
|
338
|
+
);
|
|
339
|
+
} });
|
|
340
|
+
}, ve = ({
|
|
341
|
+
name: t = "email",
|
|
342
|
+
label: e = "Email address",
|
|
343
|
+
placeholder: n = "Enter your email address",
|
|
344
|
+
InputProps: r = {},
|
|
345
|
+
...i
|
|
346
|
+
}) => /* @__PURE__ */ o(
|
|
347
|
+
A,
|
|
348
|
+
{
|
|
349
|
+
type: "email",
|
|
350
|
+
schema: I().email(),
|
|
351
|
+
name: t,
|
|
352
|
+
label: e,
|
|
353
|
+
placeholder: n,
|
|
354
|
+
InputProps: {
|
|
355
|
+
endAdornment: /* @__PURE__ */ o(w, { position: "end", children: /* @__PURE__ */ o(ye, {}) }),
|
|
356
|
+
...r
|
|
357
|
+
},
|
|
358
|
+
...i
|
|
359
|
+
}
|
|
360
|
+
), Ee = ({
|
|
361
|
+
name: t = "first_name",
|
|
362
|
+
label: e = "First name",
|
|
363
|
+
placeholder: n = "Enter your first name",
|
|
364
|
+
InputProps: r = {},
|
|
365
|
+
...i
|
|
366
|
+
}) => /* @__PURE__ */ o(
|
|
367
|
+
A,
|
|
368
|
+
{
|
|
369
|
+
schema: Oe.first_name,
|
|
370
|
+
name: t,
|
|
371
|
+
label: e,
|
|
372
|
+
placeholder: n,
|
|
373
|
+
InputProps: {
|
|
374
|
+
endAdornment: /* @__PURE__ */ o(w, { position: "end", children: /* @__PURE__ */ o(Fe, {}) }),
|
|
375
|
+
...r
|
|
376
|
+
},
|
|
377
|
+
...i
|
|
378
|
+
}
|
|
379
|
+
), q = {
|
|
380
|
+
behavior: "smooth",
|
|
381
|
+
block: "start"
|
|
382
|
+
}, Be = ({
|
|
383
|
+
scrollIntoViewOptions: t = q,
|
|
384
|
+
...e
|
|
385
|
+
}) => {
|
|
386
|
+
const n = ee(null);
|
|
387
|
+
return B(() => {
|
|
388
|
+
n.current && n.current.scrollIntoView(t);
|
|
389
|
+
}, [t]), /* @__PURE__ */ o(U, { ref: n, error: !0, ...e });
|
|
390
|
+
}, Y = ({
|
|
391
|
+
children: t,
|
|
392
|
+
scrollIntoViewOptions: e = q,
|
|
393
|
+
nonFieldErrorsProps: n,
|
|
394
|
+
fieldRefs: r = [],
|
|
395
|
+
...i
|
|
396
|
+
}) => /* @__PURE__ */ o(oe, { ...i, children: (s) => {
|
|
397
|
+
const l = !!Object.keys(s.errors).length, d = l && typeof s.errors.__all__ == "string";
|
|
398
|
+
if (l && !d && s.isSubmitting && r.length) {
|
|
399
|
+
const a = he(s.errors), u = r.find(({ name: c }) => a.includes(c))?.inputRef.current;
|
|
400
|
+
u && u.scrollIntoView(e);
|
|
401
|
+
}
|
|
402
|
+
return /* @__PURE__ */ k(j, { children: [
|
|
403
|
+
d && /* @__PURE__ */ o(Be, { ...n, children: s.errors.__all__ }),
|
|
404
|
+
/* @__PURE__ */ o(ne, { children: typeof t == "function" ? t(s) : t })
|
|
405
|
+
] });
|
|
406
|
+
} }), Ie = ({
|
|
407
|
+
useMutation: t,
|
|
408
|
+
submitOptions: e,
|
|
409
|
+
...n
|
|
410
|
+
}) => {
|
|
411
|
+
const [r] = t();
|
|
412
|
+
return /* @__PURE__ */ o(
|
|
413
|
+
Y,
|
|
414
|
+
{
|
|
415
|
+
...n,
|
|
416
|
+
onSubmit: ce(
|
|
417
|
+
r,
|
|
418
|
+
n.initialValues,
|
|
419
|
+
e
|
|
420
|
+
)
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
}, Ve = (t) => "onSubmit" in t ? /* @__PURE__ */ o(Y, { ...t }) : Ie(t), Ae = ({
|
|
424
|
+
name: t = "otp",
|
|
425
|
+
label: e = "OTP",
|
|
426
|
+
placeholder: n = "Enter your OTP",
|
|
427
|
+
...r
|
|
428
|
+
}) => /* @__PURE__ */ o(
|
|
429
|
+
A,
|
|
430
|
+
{
|
|
431
|
+
name: t,
|
|
432
|
+
label: e,
|
|
433
|
+
schema: I().matches(/^[0-9]{6}$/, "Must be exactly 6 digits."),
|
|
434
|
+
placeholder: n,
|
|
435
|
+
required: !0,
|
|
436
|
+
...r
|
|
437
|
+
}
|
|
438
|
+
), Le = ({
|
|
439
|
+
id: t,
|
|
440
|
+
repeatName: e,
|
|
441
|
+
setValue: n,
|
|
442
|
+
fieldProps: r,
|
|
443
|
+
name: i,
|
|
444
|
+
label: s,
|
|
445
|
+
placeholder: l,
|
|
446
|
+
type: d,
|
|
447
|
+
...a
|
|
448
|
+
}) => {
|
|
449
|
+
const { form: u } = r, c = i.split("."), m = y(u.values, c), p = e.split("."), f = y(
|
|
450
|
+
u.values,
|
|
451
|
+
p
|
|
452
|
+
), C = y(
|
|
453
|
+
u.touched,
|
|
454
|
+
p
|
|
455
|
+
), g = y(u.errors, p);
|
|
456
|
+
return B(() => {
|
|
457
|
+
n(m);
|
|
458
|
+
}, [n, m]), /* @__PURE__ */ o(
|
|
459
|
+
N,
|
|
460
|
+
{
|
|
461
|
+
required: !0,
|
|
462
|
+
type: d,
|
|
463
|
+
label: s ?? `Repeat ${i.replace("_", " ")}`,
|
|
464
|
+
placeholder: l ?? `Enter your ${i.replace("_", " ")} again`,
|
|
465
|
+
id: t ?? e,
|
|
466
|
+
name: e,
|
|
467
|
+
value: f,
|
|
468
|
+
onChange: u.handleChange,
|
|
469
|
+
onBlur: u.handleBlur,
|
|
470
|
+
error: C && !!g,
|
|
471
|
+
helperText: C && g,
|
|
472
|
+
...a
|
|
473
|
+
}
|
|
474
|
+
);
|
|
475
|
+
}, z = ({
|
|
476
|
+
name: t,
|
|
477
|
+
type: e = "text",
|
|
478
|
+
validateOptions: n,
|
|
479
|
+
...r
|
|
480
|
+
}) => {
|
|
481
|
+
const [i, s] = E(""), l = `${t}_repeat`, d = {
|
|
482
|
+
name: l,
|
|
483
|
+
type: e,
|
|
484
|
+
validate: V(
|
|
485
|
+
I().required().equals([i], "does not match"),
|
|
486
|
+
n
|
|
487
|
+
)
|
|
488
|
+
};
|
|
489
|
+
return /* @__PURE__ */ o(T, { ...d, children: (a) => /* @__PURE__ */ o(
|
|
490
|
+
Le,
|
|
491
|
+
{
|
|
492
|
+
name: t,
|
|
493
|
+
type: e,
|
|
494
|
+
repeatName: l,
|
|
495
|
+
setValue: s,
|
|
496
|
+
fieldProps: a,
|
|
497
|
+
...r
|
|
498
|
+
}
|
|
499
|
+
) });
|
|
500
|
+
}, je = ({
|
|
501
|
+
name: t = "password",
|
|
502
|
+
label: e = "Password",
|
|
503
|
+
placeholder: n = "Enter your password",
|
|
504
|
+
schema: r = I(),
|
|
505
|
+
InputProps: i = {},
|
|
506
|
+
withRepeatField: s = !1,
|
|
507
|
+
repeatFieldProps: l = {},
|
|
508
|
+
...d
|
|
509
|
+
}) => {
|
|
510
|
+
const [a, u] = E(!1), c = a ? "text" : "password", m = /* @__PURE__ */ o(w, { position: "end", children: /* @__PURE__ */ o(
|
|
511
|
+
Q,
|
|
512
|
+
{
|
|
513
|
+
onClick: () => {
|
|
514
|
+
u((p) => !p);
|
|
515
|
+
},
|
|
516
|
+
edge: "end",
|
|
517
|
+
children: a ? /* @__PURE__ */ o(Ce, {}) : /* @__PURE__ */ o(Pe, {})
|
|
518
|
+
}
|
|
519
|
+
) });
|
|
520
|
+
return /* @__PURE__ */ k(j, { children: [
|
|
521
|
+
/* @__PURE__ */ o(
|
|
522
|
+
A,
|
|
523
|
+
{
|
|
524
|
+
autoComplete: "off",
|
|
525
|
+
type: c,
|
|
526
|
+
name: t,
|
|
527
|
+
label: e,
|
|
528
|
+
schema: r,
|
|
529
|
+
placeholder: n,
|
|
530
|
+
InputProps: { endAdornment: m, ...i },
|
|
531
|
+
...d
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
s && /* @__PURE__ */ o(
|
|
535
|
+
z,
|
|
536
|
+
{
|
|
537
|
+
name: t,
|
|
538
|
+
type: c,
|
|
539
|
+
...l,
|
|
540
|
+
InputProps: { endAdornment: m, ...l.InputProps }
|
|
541
|
+
}
|
|
542
|
+
)
|
|
543
|
+
] });
|
|
544
|
+
}, ke = ({
|
|
545
|
+
children: t = "Submit",
|
|
546
|
+
...e
|
|
547
|
+
}) => {
|
|
548
|
+
function n(r, i) {
|
|
549
|
+
i = i || {};
|
|
550
|
+
for (const s in r) {
|
|
551
|
+
const l = r[s];
|
|
552
|
+
i[s] = l instanceof Object && l.constructor === Object ? n(l, i) : !0;
|
|
553
|
+
}
|
|
554
|
+
return i;
|
|
555
|
+
}
|
|
556
|
+
return /* @__PURE__ */ o(T, { name: "submit", type: "submit", children: ({ form: r }) => /* @__PURE__ */ o(
|
|
557
|
+
M,
|
|
558
|
+
{
|
|
559
|
+
type: "button",
|
|
560
|
+
onClick: () => {
|
|
561
|
+
r.setTouched(n(r.values), !0).then((i) => {
|
|
562
|
+
const s = !!(i && Object.keys(i).length);
|
|
563
|
+
r.setSubmitting(s), s || r.submitForm();
|
|
564
|
+
});
|
|
565
|
+
},
|
|
566
|
+
...e,
|
|
567
|
+
children: t
|
|
568
|
+
}
|
|
569
|
+
) });
|
|
570
|
+
}, Ne = ({
|
|
571
|
+
textFieldProps: t,
|
|
572
|
+
...e
|
|
573
|
+
}) => {
|
|
574
|
+
const {
|
|
575
|
+
name: n = "uk_county",
|
|
576
|
+
label: r = "UK county",
|
|
577
|
+
placeholder: i = "Select your UK county",
|
|
578
|
+
...s
|
|
579
|
+
} = t || {};
|
|
580
|
+
return /* @__PURE__ */ o(
|
|
581
|
+
L,
|
|
582
|
+
{
|
|
583
|
+
options: pe,
|
|
584
|
+
textFieldProps: { name: n, label: r, placeholder: i, ...s },
|
|
585
|
+
...e
|
|
586
|
+
}
|
|
587
|
+
);
|
|
588
|
+
}, ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
589
|
+
__proto__: null,
|
|
590
|
+
ApiAutocompleteField: xe,
|
|
591
|
+
AutocompleteField: L,
|
|
592
|
+
CheckboxField: Te,
|
|
593
|
+
CountryField: _e,
|
|
594
|
+
DatePickerField: Se,
|
|
595
|
+
EmailField: ve,
|
|
596
|
+
FirstNameField: Ee,
|
|
597
|
+
Form: Ve,
|
|
598
|
+
OtpField: Ae,
|
|
599
|
+
PasswordField: je,
|
|
600
|
+
RepeatField: z,
|
|
601
|
+
SubmitButton: ke,
|
|
602
|
+
TextField: A,
|
|
603
|
+
UkCountyField: Ne
|
|
604
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
605
|
+
export {
|
|
606
|
+
xe as A,
|
|
607
|
+
Te as C,
|
|
608
|
+
Se as D,
|
|
609
|
+
ve as E,
|
|
610
|
+
Ee as F,
|
|
611
|
+
Ae as O,
|
|
612
|
+
je as P,
|
|
613
|
+
z as R,
|
|
614
|
+
ke as S,
|
|
615
|
+
A as T,
|
|
616
|
+
Ne as U,
|
|
617
|
+
L as a,
|
|
618
|
+
_e as b,
|
|
619
|
+
Ve as c,
|
|
620
|
+
ot as i
|
|
621
|
+
};
|
|
622
|
+
//# sourceMappingURL=index-BIL7PoEV.js.map
|