@oneblink/apps-react 8.1.0-beta.2 → 8.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/NotificationGrid.d.ts +13 -0
- package/dist/components/NotificationGrid.js +31 -0
- package/dist/components/NotificationGrid.js.map +1 -0
- package/dist/form-elements/FormElementAPINSWLiquorLicence.d.ts +6 -0
- package/dist/form-elements/FormElementAPINSWLiquorLicence.js +18 -39
- package/dist/form-elements/FormElementAPINSWLiquorLicence.js.map +1 -1
- package/dist/form-elements/FormElementPointAddress.js +10 -15
- package/dist/form-elements/FormElementPointAddress.js.map +1 -1
- package/dist/styles/nsw-point-address.scss +4 -0
- package/dist/styles.css +5 -0
- package/dist/styles.scss +1 -0
- package/package.json +1 -1
@@ -0,0 +1,13 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
export declare function NotificationGrid({ className, gridClassName, children, }: React.PropsWithChildren<{
|
3
|
+
gridClassName: string;
|
4
|
+
className: string;
|
5
|
+
}>): React.JSX.Element;
|
6
|
+
export declare function NotificationGridItem({ label, value, fullWidth, className, labelClassName, valueClassName, }: {
|
7
|
+
label: string;
|
8
|
+
value: string | undefined;
|
9
|
+
fullWidth?: boolean;
|
10
|
+
className: string;
|
11
|
+
labelClassName: string;
|
12
|
+
valueClassName: string;
|
13
|
+
}): React.JSX.Element | null;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Grid } from '@mui/material';
|
3
|
+
export function NotificationGrid({ className, gridClassName, children, }) {
|
4
|
+
return (React.createElement("div", { className: `notification ${className}` },
|
5
|
+
React.createElement(Grid, { container: true, spacing: 1, className: gridClassName }, children)));
|
6
|
+
}
|
7
|
+
export function NotificationGridItem({ label, value, fullWidth, className, labelClassName, valueClassName, }) {
|
8
|
+
if (!value) {
|
9
|
+
return null;
|
10
|
+
}
|
11
|
+
return (React.createElement(Grid, { item: true, className: className, sx: (theme) => ({
|
12
|
+
flexBasis: '100%',
|
13
|
+
flexGrow: 0,
|
14
|
+
maxWidth: '100%',
|
15
|
+
...(fullWidth
|
16
|
+
? {}
|
17
|
+
: {
|
18
|
+
[theme.breakpoints.up('sm').replace('@media', '@container')]: {
|
19
|
+
flexBasis: '50%',
|
20
|
+
maxWidth: '50%',
|
21
|
+
},
|
22
|
+
[theme.breakpoints.up('lg').replace('@media', '@container')]: {
|
23
|
+
flexBasis: '33.33%',
|
24
|
+
maxWidth: '33.33%',
|
25
|
+
},
|
26
|
+
}),
|
27
|
+
}) },
|
28
|
+
React.createElement("label", { className: `is-size-6 has-text-weight-semibold ${labelClassName}` }, label),
|
29
|
+
React.createElement("div", { className: valueClassName }, value)));
|
30
|
+
}
|
31
|
+
//# sourceMappingURL=NotificationGrid.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NotificationGrid.js","sourceRoot":"","sources":["../../src/components/NotificationGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEpC,MAAM,UAAU,gBAAgB,CAAC,EAC/B,SAAS,EACT,aAAa,EACb,QAAQ,GAIR;IACA,OAAO,CACL,6BAAK,SAAS,EAAE,gBAAgB,SAAS,EAAE;QACzC,oBAAC,IAAI,IAAC,SAAS,QAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,aAAa,IACjD,QAAQ,CACJ,CACH,CACP,CAAA;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,EACnC,KAAK,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,cAAc,EACd,cAAc,GAQf;IACC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,oBAAC,IAAI,IACH,IAAI,QACJ,SAAS,EAAE,SAAS,EACpB,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACd,SAAS,EAAE,MAAM;YACjB,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,MAAM;YAEhB,GAAG,CAAC,SAAS;gBACX,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC;oBACE,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE;wBAC5D,SAAS,EAAE,KAAK;wBAChB,QAAQ,EAAE,KAAK;qBAChB;oBACD,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE;wBAC5D,SAAS,EAAE,QAAQ;wBACnB,QAAQ,EAAE,QAAQ;qBACnB;iBACF,CAAC;SACP,CAAC;QAEF,+BAAO,SAAS,EAAE,sCAAsC,cAAc,EAAE,IACrE,KAAK,CACA;QACR,6BAAK,SAAS,EAAE,cAAc,IAAG,KAAK,CAAO,CACxC,CACR,CAAA;AACH,CAAC","sourcesContent":["import * as React from 'react'\nimport { Grid } from '@mui/material'\n\nexport function NotificationGrid({\n className,\n gridClassName,\n children,\n}: React.PropsWithChildren<{\n gridClassName: string\n className: string\n}>) {\n return (\n <div className={`notification ${className}`}>\n <Grid container spacing={1} className={gridClassName}>\n {children}\n </Grid>\n </div>\n )\n}\n\nexport function NotificationGridItem({\n label,\n value,\n fullWidth,\n className,\n labelClassName,\n valueClassName,\n}: {\n label: string\n value: string | undefined\n fullWidth?: boolean\n className: string\n labelClassName: string\n valueClassName: string\n}) {\n if (!value) {\n return null\n }\n\n return (\n <Grid\n item\n className={className}\n sx={(theme) => ({\n flexBasis: '100%',\n flexGrow: 0,\n maxWidth: '100%',\n\n ...(fullWidth\n ? {}\n : {\n [theme.breakpoints.up('sm').replace('@media', '@container')]: {\n flexBasis: '50%',\n maxWidth: '50%',\n },\n [theme.breakpoints.up('lg').replace('@media', '@container')]: {\n flexBasis: '33.33%',\n maxWidth: '33.33%',\n },\n }),\n })}\n >\n <label className={`is-size-6 has-text-weight-semibold ${labelClassName}`}>\n {label}\n </label>\n <div className={valueClassName}>{value}</div>\n </Grid>\n )\n}\n"]}
|
@@ -12,5 +12,11 @@ type Props = {
|
|
12
12
|
autocompleteAttributes?: string;
|
13
13
|
} & IsDirtyProps;
|
14
14
|
declare function FormElementAPINSWLiquorLicence({ formId, id, element, value, onChange, validationMessage, displayValidationMessage, isDirty, setIsDirty, autocompleteAttributes, }: Props): React.JSX.Element;
|
15
|
+
export declare function LicenceDetailGridItem({ label, value, classNameSuffix, fullWidth, }: {
|
16
|
+
label: string;
|
17
|
+
value: string | undefined;
|
18
|
+
classNameSuffix: string;
|
19
|
+
fullWidth?: boolean;
|
20
|
+
}): React.JSX.Element;
|
15
21
|
declare const _default: React.MemoExoticComponent<typeof FormElementAPINSWLiquorLicence>;
|
16
22
|
export default _default;
|
@@ -5,6 +5,7 @@ import AutocompleteDropdown from '../components/renderer/AutocompleteDropdown';
|
|
5
5
|
import useIsMounted from '../hooks/useIsMounted';
|
6
6
|
import { Collapse, Grid } from '@mui/material';
|
7
7
|
import useElementAriaDescribedby from '../hooks/useElementAriaDescribedby';
|
8
|
+
import { NotificationGrid, NotificationGridItem, } from '../components/NotificationGrid';
|
8
9
|
const liquorLicenceClassPrefix = 'ob-api-nsw-liquor-licence__';
|
9
10
|
function FormElementAPINSWLiquorLicence({ formId, id, element, value, onChange, validationMessage, displayValidationMessage, isDirty, setIsDirty, autocompleteAttributes, }) {
|
10
11
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
@@ -75,46 +76,24 @@ function FormElementAPINSWLiquorLicence({ formId, id, element, value, onChange,
|
|
75
76
|
error && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
76
77
|
React.createElement("div", { className: "has-text-danger ob-error__text cypress-api-nsw-liquor-licence-error-message" }, error.toString()))),
|
77
78
|
React.createElement(Collapse, { in: !!value },
|
78
|
-
React.createElement(
|
79
|
-
React.createElement(Grid, {
|
80
|
-
((
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
React.createElement(LicenceDetailGridItem, { label: "Address", value: (_p = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _p === void 0 ? void 0 : _p.address, classNameSuffix: "address", fullWidth: true }))))));
|
79
|
+
React.createElement(NotificationGrid, { className: `${liquorLicenceClassPrefix}record-display has-margin-top-6`, gridClassName: `${liquorLicenceClassPrefix}container` },
|
80
|
+
((_a = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _a === void 0 ? void 0 : _a.licenceName) && (React.createElement(Grid, { item: true, xs: 12, className: `${liquorLicenceClassPrefix}licenceName` },
|
81
|
+
React.createElement("h6", { className: `is-size-5 has-text-weight-semibold ${liquorLicenceClassPrefix}name` }, (_b = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _b === void 0 ? void 0 : _b.licenceName))),
|
82
|
+
React.createElement(LicenceDetailGridItem, { label: "Licence Number", value: (_c = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _c === void 0 ? void 0 : _c.licenceNumber, classNameSuffix: "licenceNumber" }),
|
83
|
+
React.createElement(LicenceDetailGridItem, { label: "Licence Type", value: (_d = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _d === void 0 ? void 0 : _d.licenceTypeName, classNameSuffix: "licenceTypeName" }),
|
84
|
+
React.createElement(LicenceDetailGridItem, { label: "Licensee", value: (_e = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _e === void 0 ? void 0 : _e.licensee, classNameSuffix: "licensee" }),
|
85
|
+
React.createElement(LicenceDetailGridItem, { label: "Licensee Birth Date", value: (_f = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _f === void 0 ? void 0 : _f.licenseeBirthdate, classNameSuffix: "licenseeBirthdate" }),
|
86
|
+
React.createElement(LicenceDetailGridItem, { label: "Licencee ABN", value: (_g = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _g === void 0 ? void 0 : _g.licenceeABN, classNameSuffix: "licenceeABN" }),
|
87
|
+
React.createElement(LicenceDetailGridItem, { label: "Licencee ACN", value: (_h = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _h === void 0 ? void 0 : _h.licenceeACN, classNameSuffix: "licenceeACN" }),
|
88
|
+
React.createElement(LicenceDetailGridItem, { label: "Refused Date", value: (_j = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _j === void 0 ? void 0 : _j.refusedDate, classNameSuffix: "refusedDate" }),
|
89
|
+
React.createElement(LicenceDetailGridItem, { label: "Start Date", value: (_k = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _k === void 0 ? void 0 : _k.startDate, classNameSuffix: "startDate" }),
|
90
|
+
React.createElement(LicenceDetailGridItem, { label: "Expiry Date", value: (_l = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _l === void 0 ? void 0 : _l.expiryDate, classNameSuffix: "expiryDate" }),
|
91
|
+
React.createElement(LicenceDetailGridItem, { label: "Status", value: (_m = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _m === void 0 ? void 0 : _m.status, classNameSuffix: "status" }),
|
92
|
+
React.createElement(LicenceDetailGridItem, { label: "Address Type", value: (_o = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _o === void 0 ? void 0 : _o.addressType, classNameSuffix: "addressType" }),
|
93
|
+
React.createElement(LicenceDetailGridItem, { label: "Address", value: (_p = value === null || value === void 0 ? void 0 : value.licenceDetail) === null || _p === void 0 ? void 0 : _p.address, classNameSuffix: "address", fullWidth: true })))));
|
94
94
|
}
|
95
|
-
function LicenceDetailGridItem({ label, value, classNameSuffix, fullWidth, }) {
|
96
|
-
|
97
|
-
return null;
|
98
|
-
}
|
99
|
-
return (React.createElement(Grid, { item: true, className: `${liquorLicenceClassPrefix}${classNameSuffix}`, sx: (theme) => ({
|
100
|
-
flexBasis: '100%',
|
101
|
-
flexGrow: 0,
|
102
|
-
maxWidth: '100%',
|
103
|
-
...(fullWidth
|
104
|
-
? {}
|
105
|
-
: {
|
106
|
-
[theme.breakpoints.up('sm').replace('@media', '@container')]: {
|
107
|
-
flexBasis: '50%',
|
108
|
-
maxWidth: '50%',
|
109
|
-
},
|
110
|
-
[theme.breakpoints.up('lg').replace('@media', '@container')]: {
|
111
|
-
flexBasis: '33.33%',
|
112
|
-
maxWidth: '33.33%',
|
113
|
-
},
|
114
|
-
}),
|
115
|
-
}) },
|
116
|
-
React.createElement("label", { className: `is-size-6 has-text-weight-semibold ${liquorLicenceClassPrefix}detail-label` }, label),
|
117
|
-
React.createElement("div", { className: `${liquorLicenceClassPrefix}detail-value` }, value)));
|
95
|
+
export function LicenceDetailGridItem({ label, value, classNameSuffix, fullWidth, }) {
|
96
|
+
return (React.createElement(NotificationGridItem, { className: `${liquorLicenceClassPrefix}${classNameSuffix}`, fullWidth: fullWidth, value: value, label: label, labelClassName: `${liquorLicenceClassPrefix}detail-label`, valueClassName: `${liquorLicenceClassPrefix}detail-value` }));
|
118
97
|
}
|
119
98
|
export default React.memo(FormElementAPINSWLiquorLicence);
|
120
99
|
//# sourceMappingURL=FormElementAPINSWLiquorLicence.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormElementAPINSWLiquorLicence.js","sourceRoot":"","sources":["../../src/form-elements/FormElementAPINSWLiquorLicence.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,yBAAyB,MAAM,kDAAkD,CAAA;AAExF,OAAO,oBAAoB,MAAM,6CAA6C,CAAA;AAC9E,OAAO,YAAY,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,yBAAyB,M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AK,EACL,eAAe,EACf,SAAS,GAMV;IACC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,oBAAC,IAAI,IACH,IAAI,QACJ,SAAS,EAAE,GAAG,wBAAwB,GAAG,eAAe,EAAE,EAC1D,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACd,SAAS,EAAE,MAAM;YACjB,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,MAAM;YAEhB,GAAG,CAAC,SAAS;gBACX,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC;oBACE,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE;wBAC5D,SAAS,EAAE,KAAK;wBAChB,QAAQ,EAAE,KAAK;qBAChB;oBACD,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE;wBAC5D,SAAS,EAAE,QAAQ;wBACnB,QAAQ,EAAE,QAAQ;qBACnB;iBACF,CAAC;SACP,CAAC;QAEF,+BACE,SAAS,EAAE,sCAAsC,wBAAwB,cAAc,IAEtF,KAAK,CACA;QACR,6BAAK,SAAS,EAAE,GAAG,wBAAwB,cAAc,IAAG,KAAK,CAAO,CACnE,CACR,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes, APINSWTypes } from '@oneblink/types'\nimport { formService } from '@oneblink/apps'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport { FormElementValueChangeHandler, IsDirtyProps } from '../types/form'\nimport AutocompleteDropdown from '../components/renderer/AutocompleteDropdown'\nimport useIsMounted from '../hooks/useIsMounted'\nimport { Collapse, Grid } from '@mui/material'\nimport useElementAriaDescribedby from '../hooks/useElementAriaDescribedby'\n\ntype Props = {\n formId: number\n id: string\n element: FormTypes.APINSWLiquorLicenceElement\n value: APINSWTypes.LiquorLicenceDetails | undefined\n onChange: FormElementValueChangeHandler<APINSWTypes.LiquorLicenceDetails>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n autocompleteAttributes?: string\n} & IsDirtyProps\n\nconst liquorLicenceClassPrefix = 'ob-api-nsw-liquor-licence__'\nfunction FormElementAPINSWLiquorLicence({\n formId,\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n isDirty,\n setIsDirty,\n autocompleteAttributes,\n}: Props) {\n const ariaDescribedby = useElementAriaDescribedby(id, element)\n const isMounted = useIsMounted()\n const [label, setLabel] = React.useState('')\n const [{ isLoading, error }, setState] = React.useState<{\n isLoading: boolean\n error: Error | null\n }>({\n isLoading: false,\n error: null,\n })\n\n const handleSearch = React.useCallback(\n async (searchText: string, abortSignal: AbortSignal) => {\n setState((current) => ({\n ...current,\n error: null,\n }))\n\n const results = await formService.searchAPINSWLiquorLicences(\n { formId, searchText },\n abortSignal,\n )\n\n return results.map((result, index) => ({\n value: result.licenceID || index.toString(),\n label:\n `${result.licenceNumber} | ${result.licenceName}`.trim() ||\n index.toString(),\n }))\n },\n [formId],\n )\n\n const fetchAndSelectSingleLicence = React.useCallback(\n async (newValue: string | undefined) => {\n console.log(`Selected: ${newValue}`)\n if (!newValue) {\n onChange(element, { value: undefined })\n return\n }\n setState((current) => ({\n ...current,\n isLoading: true,\n }))\n\n try {\n const result = await formService.getAPINSWLiquorLicence(\n formId,\n newValue,\n )\n if (result) {\n onChange(element, { value: result })\n }\n if (isMounted.current) {\n setState({\n isLoading: false,\n error: null,\n })\n }\n } catch (newError) {\n if (isMounted.current) {\n setState({\n isLoading: false,\n error: newError as Error,\n })\n }\n }\n },\n [element, formId, isMounted, onChange],\n )\n\n // Ensure the label is set if the value is set outside of this component\n React.useEffect(() => {\n if (value) {\n const newLabel =\n `${value?.licenceDetail?.licenceNumber} | ${value?.licenceDetail?.licenceName}`.trim()\n if (label !== newLabel) {\n setLabel(newLabel || '')\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value])\n\n return (\n <div className=\"cypress-api-nsw-liquor-licence-element\">\n <FormElementLabelContainer\n className=\"ob-api-nsw-liquor-licence ob-autocomplete\"\n id={id}\n element={element}\n required={element.required}\n >\n <AutocompleteDropdown\n id={id}\n label={label}\n disabled={element.readOnly || isLoading}\n placeholder={element.placeholderValue}\n required={element.required}\n value={value}\n validationMessage={validationMessage}\n displayValidationMessage={displayValidationMessage}\n onChangeValue={fetchAndSelectSingleLicence}\n isLoading={isLoading}\n hasError={!!error}\n onChangeLabel={setLabel}\n searchDebounceMs={750}\n searchMinCharacters={2}\n onSearch={handleSearch}\n isDirty={isDirty}\n setIsDirty={setIsDirty}\n aria-describedby={ariaDescribedby}\n autoComplete={autocompleteAttributes}\n />\n </FormElementLabelContainer>\n\n {error && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-api-nsw-liquor-licence-error-message\">\n {error.toString()}\n </div>\n </div>\n )}\n <Collapse in={!!value}>\n <div\n className={`notification ${liquorLicenceClassPrefix}record-display has-margin-top-6`}\n >\n <Grid\n container\n spacing={1}\n className={`${liquorLicenceClassPrefix}container`}\n >\n {value?.licenceDetail?.licenceName && (\n <Grid\n item\n xs={12}\n className={`${liquorLicenceClassPrefix}licenceName`}\n >\n <h6\n className={`is-size-5 has-text-weight-semibold ${liquorLicenceClassPrefix}name`}\n >\n {value?.licenceDetail?.licenceName}\n </h6>\n </Grid>\n )}\n <LicenceDetailGridItem\n label=\"Licence Number\"\n value={value?.licenceDetail?.licenceNumber}\n classNameSuffix=\"licenceNumber\"\n />\n <LicenceDetailGridItem\n label=\"Licence Type\"\n value={value?.licenceDetail?.licenceTypeName}\n classNameSuffix=\"licenceTypeName\"\n />\n <LicenceDetailGridItem\n label=\"Licensee\"\n value={value?.licenceDetail?.licensee}\n classNameSuffix=\"licensee\"\n />\n <LicenceDetailGridItem\n label=\"Licensee Birth Date\"\n value={value?.licenceDetail?.licenseeBirthdate}\n classNameSuffix=\"licenseeBirthdate\"\n />\n <LicenceDetailGridItem\n label=\"Licencee ABN\"\n value={value?.licenceDetail?.licenceeABN}\n classNameSuffix=\"licenceeABN\"\n />\n <LicenceDetailGridItem\n label=\"Licencee ACN\"\n value={value?.licenceDetail?.licenceeACN}\n classNameSuffix=\"licenceeACN\"\n />\n <LicenceDetailGridItem\n label=\"Refused Date\"\n value={value?.licenceDetail?.refusedDate}\n classNameSuffix=\"refusedDate\"\n />\n <LicenceDetailGridItem\n label=\"Start Date\"\n value={value?.licenceDetail?.startDate}\n classNameSuffix=\"startDate\"\n />\n <LicenceDetailGridItem\n label=\"Expiry Date\"\n value={value?.licenceDetail?.expiryDate}\n classNameSuffix=\"expiryDate\"\n />\n <LicenceDetailGridItem\n label=\"Status\"\n value={value?.licenceDetail?.status}\n classNameSuffix=\"status\"\n />\n <LicenceDetailGridItem\n label=\"Address Type\"\n value={value?.licenceDetail?.addressType}\n classNameSuffix=\"addressType\"\n />\n <LicenceDetailGridItem\n label=\"Address\"\n value={value?.licenceDetail?.address}\n classNameSuffix=\"address\"\n fullWidth\n />\n </Grid>\n </div>\n </Collapse>\n </div>\n )\n}\n\nfunction LicenceDetailGridItem({\n label,\n value,\n classNameSuffix,\n fullWidth,\n}: {\n label: string\n value: string | undefined\n classNameSuffix: string\n fullWidth?: boolean\n}) {\n if (!value) {\n return null\n }\n\n return (\n <Grid\n item\n className={`${liquorLicenceClassPrefix}${classNameSuffix}`}\n sx={(theme) => ({\n flexBasis: '100%',\n flexGrow: 0,\n maxWidth: '100%',\n\n ...(fullWidth\n ? {}\n : {\n [theme.breakpoints.up('sm').replace('@media', '@container')]: {\n flexBasis: '50%',\n maxWidth: '50%',\n },\n [theme.breakpoints.up('lg').replace('@media', '@container')]: {\n flexBasis: '33.33%',\n maxWidth: '33.33%',\n },\n }),\n })}\n >\n <label\n className={`is-size-6 has-text-weight-semibold ${liquorLicenceClassPrefix}detail-label`}\n >\n {label}\n </label>\n <div className={`${liquorLicenceClassPrefix}detail-value`}>{value}</div>\n </Grid>\n )\n}\n\nexport default React.memo(FormElementAPINSWLiquorLicence)\n"]}
|
1
|
+
{"version":3,"file":"FormElementAPINSWLiquorLicence.js","sourceRoot":"","sources":["../../src/form-elements/FormElementAPINSWLiquorLicence.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,yBAAyB,MAAM,kDAAkD,CAAA;AAExF,OAAO,oBAAoB,MAAM,6CAA6C,CAAA;AAC9E,OAAO,YAAY,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,yBAAyB,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,gCAAgC,CAAA;AAavC,MAAM,wBAAwB,GAAG,6BAA6B,CAAA;AAC9D,SAAS,8BAA8B,CAAC,EACtC,MAAM,EACN,EAAE,EACF,OAAO,EACP,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,wBAAwB,EACxB,OAAO,EACP,UAAU,EACV,sBAAsB,GAChB;;IACN,MAAM,eAAe,GAAG,yBAAyB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAC9D,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC5C,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAGpD;QACD,SAAS,EAAE,KAAK;QAChB,KAAK,EAA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KAAK,CAAE,aAAa,0CAAE,UAAU,EACvC,eAAe,EAAC,YAAY,GAC5B;gBACF,oBAAC,qBAAqB,IACpB,KAAK,EAAC,QAAQ,EACd,KAAK,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,MAAM,EACnC,eAAe,EAAC,QAAQ,GACxB;gBACF,oBAAC,qBAAqB,IACpB,KAAK,EAAC,cAAc,EACpB,KAAK,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,WAAW,EACxC,eAAe,EAAC,aAAa,GAC7B;gBACF,oBAAC,qBAAqB,IACpB,KAAK,EAAC,SAAS,EACf,KAAK,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,OAAO,EACpC,eAAe,EAAC,SAAS,EACzB,SAAS,SACT,CACe,CACV,CACP,CACP,CAAA;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,EACpC,KAAK,EACL,KAAK,EACL,eAAe,EACf,SAAS,GAMV;IACC,OAAO,CACL,oBAAC,oBAAoB,IACnB,SAAS,EAAE,GAAG,wBAAwB,GAAG,eAAe,EAAE,EAC1D,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,GAAG,wBAAwB,cAAc,EACzD,cAAc,EAAE,GAAG,wBAAwB,cAAc,GACzD,CACH,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes, APINSWTypes } from '@oneblink/types'\nimport { formService } from '@oneblink/apps'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport { FormElementValueChangeHandler, IsDirtyProps } from '../types/form'\nimport AutocompleteDropdown from '../components/renderer/AutocompleteDropdown'\nimport useIsMounted from '../hooks/useIsMounted'\nimport { Collapse, Grid } from '@mui/material'\nimport useElementAriaDescribedby from '../hooks/useElementAriaDescribedby'\nimport {\n NotificationGrid,\n NotificationGridItem,\n} from '../components/NotificationGrid'\n\ntype Props = {\n formId: number\n id: string\n element: FormTypes.APINSWLiquorLicenceElement\n value: APINSWTypes.LiquorLicenceDetails | undefined\n onChange: FormElementValueChangeHandler<APINSWTypes.LiquorLicenceDetails>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n autocompleteAttributes?: string\n} & IsDirtyProps\n\nconst liquorLicenceClassPrefix = 'ob-api-nsw-liquor-licence__'\nfunction FormElementAPINSWLiquorLicence({\n formId,\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n isDirty,\n setIsDirty,\n autocompleteAttributes,\n}: Props) {\n const ariaDescribedby = useElementAriaDescribedby(id, element)\n const isMounted = useIsMounted()\n const [label, setLabel] = React.useState('')\n const [{ isLoading, error }, setState] = React.useState<{\n isLoading: boolean\n error: Error | null\n }>({\n isLoading: false,\n error: null,\n })\n\n const handleSearch = React.useCallback(\n async (searchText: string, abortSignal: AbortSignal) => {\n setState((current) => ({\n ...current,\n error: null,\n }))\n\n const results = await formService.searchAPINSWLiquorLicences(\n { formId, searchText },\n abortSignal,\n )\n\n return results.map((result, index) => ({\n value: result.licenceID || index.toString(),\n label:\n `${result.licenceNumber} | ${result.licenceName}`.trim() ||\n index.toString(),\n }))\n },\n [formId],\n )\n\n const fetchAndSelectSingleLicence = React.useCallback(\n async (newValue: string | undefined) => {\n console.log(`Selected: ${newValue}`)\n if (!newValue) {\n onChange(element, { value: undefined })\n return\n }\n setState((current) => ({\n ...current,\n isLoading: true,\n }))\n\n try {\n const result = await formService.getAPINSWLiquorLicence(\n formId,\n newValue,\n )\n if (result) {\n onChange(element, { value: result })\n }\n if (isMounted.current) {\n setState({\n isLoading: false,\n error: null,\n })\n }\n } catch (newError) {\n if (isMounted.current) {\n setState({\n isLoading: false,\n error: newError as Error,\n })\n }\n }\n },\n [element, formId, isMounted, onChange],\n )\n\n // Ensure the label is set if the value is set outside of this component\n React.useEffect(() => {\n if (value) {\n const newLabel =\n `${value?.licenceDetail?.licenceNumber} | ${value?.licenceDetail?.licenceName}`.trim()\n if (label !== newLabel) {\n setLabel(newLabel || '')\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value])\n\n return (\n <div className=\"cypress-api-nsw-liquor-licence-element\">\n <FormElementLabelContainer\n className=\"ob-api-nsw-liquor-licence ob-autocomplete\"\n id={id}\n element={element}\n required={element.required}\n >\n <AutocompleteDropdown\n id={id}\n label={label}\n disabled={element.readOnly || isLoading}\n placeholder={element.placeholderValue}\n required={element.required}\n value={value}\n validationMessage={validationMessage}\n displayValidationMessage={displayValidationMessage}\n onChangeValue={fetchAndSelectSingleLicence}\n isLoading={isLoading}\n hasError={!!error}\n onChangeLabel={setLabel}\n searchDebounceMs={750}\n searchMinCharacters={2}\n onSearch={handleSearch}\n isDirty={isDirty}\n setIsDirty={setIsDirty}\n aria-describedby={ariaDescribedby}\n autoComplete={autocompleteAttributes}\n />\n </FormElementLabelContainer>\n\n {error && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-api-nsw-liquor-licence-error-message\">\n {error.toString()}\n </div>\n </div>\n )}\n <Collapse in={!!value}>\n <NotificationGrid\n className={`${liquorLicenceClassPrefix}record-display has-margin-top-6`}\n gridClassName={`${liquorLicenceClassPrefix}container`}\n >\n {value?.licenceDetail?.licenceName && (\n <Grid\n item\n xs={12}\n className={`${liquorLicenceClassPrefix}licenceName`}\n >\n <h6\n className={`is-size-5 has-text-weight-semibold ${liquorLicenceClassPrefix}name`}\n >\n {value?.licenceDetail?.licenceName}\n </h6>\n </Grid>\n )}\n <LicenceDetailGridItem\n label=\"Licence Number\"\n value={value?.licenceDetail?.licenceNumber}\n classNameSuffix=\"licenceNumber\"\n />\n <LicenceDetailGridItem\n label=\"Licence Type\"\n value={value?.licenceDetail?.licenceTypeName}\n classNameSuffix=\"licenceTypeName\"\n />\n <LicenceDetailGridItem\n label=\"Licensee\"\n value={value?.licenceDetail?.licensee}\n classNameSuffix=\"licensee\"\n />\n <LicenceDetailGridItem\n label=\"Licensee Birth Date\"\n value={value?.licenceDetail?.licenseeBirthdate}\n classNameSuffix=\"licenseeBirthdate\"\n />\n <LicenceDetailGridItem\n label=\"Licencee ABN\"\n value={value?.licenceDetail?.licenceeABN}\n classNameSuffix=\"licenceeABN\"\n />\n <LicenceDetailGridItem\n label=\"Licencee ACN\"\n value={value?.licenceDetail?.licenceeACN}\n classNameSuffix=\"licenceeACN\"\n />\n <LicenceDetailGridItem\n label=\"Refused Date\"\n value={value?.licenceDetail?.refusedDate}\n classNameSuffix=\"refusedDate\"\n />\n <LicenceDetailGridItem\n label=\"Start Date\"\n value={value?.licenceDetail?.startDate}\n classNameSuffix=\"startDate\"\n />\n <LicenceDetailGridItem\n label=\"Expiry Date\"\n value={value?.licenceDetail?.expiryDate}\n classNameSuffix=\"expiryDate\"\n />\n <LicenceDetailGridItem\n label=\"Status\"\n value={value?.licenceDetail?.status}\n classNameSuffix=\"status\"\n />\n <LicenceDetailGridItem\n label=\"Address Type\"\n value={value?.licenceDetail?.addressType}\n classNameSuffix=\"addressType\"\n />\n <LicenceDetailGridItem\n label=\"Address\"\n value={value?.licenceDetail?.address}\n classNameSuffix=\"address\"\n fullWidth\n />\n </NotificationGrid>\n </Collapse>\n </div>\n )\n}\n\nexport function LicenceDetailGridItem({\n label,\n value,\n classNameSuffix,\n fullWidth,\n}: {\n label: string\n value: string | undefined\n classNameSuffix: string\n fullWidth?: boolean\n}) {\n return (\n <NotificationGridItem\n className={`${liquorLicenceClassPrefix}${classNameSuffix}`}\n fullWidth={fullWidth}\n value={value}\n label={label}\n labelClassName={`${liquorLicenceClassPrefix}detail-label`}\n valueClassName={`${liquorLicenceClassPrefix}detail-value`}\n />\n )\n}\n\nexport default React.memo(FormElementAPINSWLiquorLicence)\n"]}
|
@@ -4,7 +4,8 @@ import AutocompleteDropdown from '../components/renderer/AutocompleteDropdown';
|
|
4
4
|
import FormElementLabelContainer from '../components/renderer/FormElementLabelContainer';
|
5
5
|
import useIsMounted from '../hooks/useIsMounted';
|
6
6
|
import useElementAriaDescribedby from '../hooks/useElementAriaDescribedby';
|
7
|
-
import { Collapse
|
7
|
+
import { Collapse } from '@mui/material';
|
8
|
+
import { NotificationGrid, NotificationGridItem, } from '../components/NotificationGrid';
|
8
9
|
const pointAddressClass = 'ob-point-address';
|
9
10
|
function FormElementPointAddress({ formId, id, element, value, displayValidationMessage, validationMessage, onChange, isDirty, setIsDirty, autocompleteAttributes, }) {
|
10
11
|
var _a, _b, _c;
|
@@ -72,22 +73,16 @@ function FormElementPointAddress({ formId, id, element, value, displayValidation
|
|
72
73
|
error && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
73
74
|
React.createElement("div", { className: "has-text-danger ob-error__text cypress-point-address-details-error-message" }, error.toString()))),
|
74
75
|
React.createElement(Collapse, { in: !!value && !!element.isDisplayingAddressInformation },
|
75
|
-
React.createElement(
|
76
|
-
React.createElement(
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
}))))));
|
76
|
+
React.createElement(NotificationGrid, { className: `${pointAddressClass}__record-display has-margin-top-6`, gridClassName: `${pointAddressClass}__container` },
|
77
|
+
React.createElement(PointAddressGridItem, { label: "Local Government Area", value: (_a = value === null || value === void 0 ? void 0 : value.localGovernmentArea) === null || _a === void 0 ? void 0 : _a.lgaName, classNameSuffix: "local-government-area-name" }),
|
78
|
+
React.createElement(PointAddressGridItem, { label: "Lot / Section / Plan No.", value: (_b = value === null || value === void 0 ? void 0 : value.addressDetails) === null || _b === void 0 ? void 0 : _b.cadastralIdentifier, classNameSuffix: "cadastral-identifier" }), (_c = value === null || value === void 0 ? void 0 : value.cadastralParcels) === null || _c === void 0 ? void 0 :
|
79
|
+
_c.map((cadastralParcel, index) => {
|
80
|
+
var _a;
|
81
|
+
return (React.createElement(PointAddressGridItem, { key: cadastralParcel.propId || index, label: "Lot / DP Numbers", value: (_a = cadastralParcel === null || cadastralParcel === void 0 ? void 0 : cadastralParcel.parcelId) === null || _a === void 0 ? void 0 : _a.join(', '), classNameSuffix: "cadastral-parcel" }));
|
82
|
+
})))));
|
83
83
|
}
|
84
84
|
function PointAddressGridItem({ label, classNameSuffix, value, }) {
|
85
|
-
|
86
|
-
return null;
|
87
|
-
}
|
88
|
-
return (React.createElement(Grid, { item: true, xs: 12, sm: 6, md: 4, className: `${pointAddressClass}__container-${classNameSuffix}` },
|
89
|
-
React.createElement("label", { className: `is-size-6 has-text-weight-semibold ${pointAddressClass}__detail-label` }, label),
|
90
|
-
React.createElement("div", { className: `${pointAddressClass}__detail-value` }, value)));
|
85
|
+
return (React.createElement(NotificationGridItem, { className: `${pointAddressClass}__container-${classNameSuffix}`, value: value, label: label, labelClassName: `${pointAddressClass}__detail-label`, valueClassName: `${pointAddressClass}__detail-value` }));
|
91
86
|
}
|
92
87
|
export default React.memo(FormElementPointAddress);
|
93
88
|
//# sourceMappingURL=FormElementPointAddress.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormElementPointAddress.js","sourceRoot":"","sources":["../../src/form-elements/FormElementPointAddress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,oBAAoB,MAAM,6CAA6C,CAAA;AAC9E,OAAO,yBAAyB,MAAM,kDAAkD,CAAA;AAExF,OAAO,YAAY,MAAM,uBAAuB,CAAA;AAEhD,OAAO,yBAAyB,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAc9C,MAAM,iBAAiB,GAAG,kBAAkB,CAAA;AAE5C,SAAS,uBAAuB,CAAC,EAC/B,MAAM,EACN,EAAE,EACF,OAAO,EACP,KAAK,EACL,wBAAwB,EACxB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AK,SAAS,EAAE,GAAG,iBAAiB,gBAAgB,IAAG,KAAK,CAAO,CAC9D,CACR,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { formService } from '@oneblink/apps'\n\nimport AutocompleteDropdown from '../components/renderer/AutocompleteDropdown'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport { FormTypes, PointTypes } from '@oneblink/types'\nimport useIsMounted from '../hooks/useIsMounted'\nimport { FormElementValueChangeHandler, IsDirtyProps } from '../types/form'\nimport useElementAriaDescribedby from '../hooks/useElementAriaDescribedby'\nimport { Collapse, Grid } from '@mui/material'\n\ntype Props = {\n formId: number\n id: string\n element: FormTypes.PointAddressElement\n value: PointTypes.PointAddress | undefined\n displayValidationMessage: boolean\n validationMessage: string | undefined\n onChange: FormElementValueChangeHandler<PointTypes.PointAddress>\n autocompleteAttributes?: string\n} & IsDirtyProps\n\ntype AddressType = 'all' | 'physical' | 'mailing'\nconst pointAddressClass = 'ob-point-address'\n\nfunction FormElementPointAddress({\n formId,\n id,\n element,\n value,\n displayValidationMessage,\n validationMessage,\n onChange,\n isDirty,\n setIsDirty,\n autocompleteAttributes,\n}: Props) {\n const ariaDescribedby = useElementAriaDescribedby(id, element)\n const isMounted = useIsMounted()\n const [label, setLabel] = React.useState('')\n const [error, setError] = React.useState<Error | undefined>()\n const [isLoadingAddressDetails, setIsLoadingAddressDetails] =\n React.useState(false)\n\n const handleSearch = React.useCallback(\n async (address: string, abortSignal: AbortSignal) => {\n setError(undefined)\n\n const params: {\n address: string\n maxNumberOfResults?: number\n stateTerritory?: string\n addressType?: AddressType\n } = {\n address,\n maxNumberOfResults: 10,\n }\n\n if (element.stateTerritoryFilter) {\n params.stateTerritory = element.stateTerritoryFilter.join(',')\n }\n if (element.addressTypeFilter) {\n let addressType: AddressType = 'all'\n if (element.addressTypeFilter.length === 1) {\n addressType = element.addressTypeFilter[0] as AddressType\n }\n params.addressType = addressType\n }\n\n const result = await formService.searchPointAddresses(\n formId,\n params,\n abortSignal,\n )\n\n return result.map((suggestion, index) => ({\n value: suggestion.id || index.toString(),\n label: suggestion.address || index.toString(),\n }))\n },\n [element.addressTypeFilter, element.stateTerritoryFilter, formId],\n )\n\n const handleChange = React.useCallback(\n async (addressId: string | undefined) => {\n if (!addressId) {\n onChange(element, { value: undefined })\n return\n }\n\n setIsLoadingAddressDetails(true)\n try {\n const result = await formService.getPointAddress(formId, addressId)\n onChange(element, { value: result })\n } catch (newError) {\n if (isMounted.current) {\n setError(newError as Error)\n }\n }\n if (isMounted.current) {\n setIsLoadingAddressDetails(false)\n }\n },\n [isMounted, onChange, element, formId],\n )\n\n // Ensure the label is set if the value is set outside of this component\n React.useEffect(() => {\n if (value) {\n const newLabel = value.addressDetails?.formattedAddress || value.addressId\n if (label !== newLabel) {\n setLabel(newLabel || '')\n }\n }\n // we don't need this to run again when the label changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value])\n\n return (\n <div className=\"cypress-point-address-element\">\n <FormElementLabelContainer\n className={`${pointAddressClass} ob-autocomplete`}\n element={element}\n id={id}\n required={element.required}\n >\n <AutocompleteDropdown\n id={id}\n label={label}\n disabled={element.readOnly || isLoadingAddressDetails}\n placeholder={element.placeholderValue}\n required={element.required}\n value={value}\n validationMessage={validationMessage}\n displayValidationMessage={displayValidationMessage}\n onChangeValue={handleChange}\n isLoading={isLoadingAddressDetails}\n hasError={!!error}\n onChangeLabel={setLabel}\n searchDebounceMs={750}\n searchMinCharacters={4}\n onSearch={handleSearch}\n isDirty={isDirty}\n setIsDirty={setIsDirty}\n aria-describedby={ariaDescribedby}\n autoComplete={autocompleteAttributes}\n />\n </FormElementLabelContainer>\n\n {error && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-point-address-details-error-message\">\n {error.toString()}\n </div>\n </div>\n )}\n\n <Collapse in={!!value && !!element.isDisplayingAddressInformation}>\n <div\n className={`notification ${pointAddressClass}__record-display has-margin-top-6`}\n >\n <Grid\n container\n spacing={1}\n className={`${pointAddressClass}__container`}\n >\n <PointAddressGridItem\n label=\"Local Government Area\"\n value={value?.localGovernmentArea?.lgaName}\n classNameSuffix=\"local-government-area-name\"\n />\n <PointAddressGridItem\n label=\"Lot / Section / Plan No.\"\n value={value?.addressDetails?.cadastralIdentifier}\n classNameSuffix=\"cadastral-identifier\"\n />\n {value?.cadastralParcels?.map((cadastralParcel, index) => (\n <PointAddressGridItem\n key={cadastralParcel.propId || index}\n label=\"Lot / DP Numbers\"\n value={cadastralParcel?.parcelId?.join(', ')}\n classNameSuffix=\"cadastral-parcel\"\n />\n ))}\n </Grid>\n </div>\n </Collapse>\n </div>\n )\n}\n\nfunction PointAddressGridItem({\n label,\n classNameSuffix,\n value,\n}: {\n label: string\n classNameSuffix: string\n value: string | undefined\n}) {\n if (!value) {\n return null\n }\n\n return (\n <Grid\n item\n xs={12}\n sm={6}\n md={4}\n className={`${pointAddressClass}__container-${classNameSuffix}`}\n >\n <label\n className={`is-size-6 has-text-weight-semibold ${pointAddressClass}__detail-label`}\n >\n {label}\n </label>\n <div className={`${pointAddressClass}__detail-value`}>{value}</div>\n </Grid>\n )\n}\n\nexport default React.memo(FormElementPointAddress)\n"]}
|
1
|
+
{"version":3,"file":"FormElementPointAddress.js","sourceRoot":"","sources":["../../src/form-elements/FormElementPointAddress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,oBAAoB,MAAM,6CAA6C,CAAA;AAC9E,OAAO,yBAAyB,MAAM,kDAAkD,CAAA;AAExF,OAAO,YAAY,MAAM,uBAAuB,CAAA;AAEhD,OAAO,yBAAyB,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EACL,gBA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EACpD,cAAc,EAAE,GAAG,iBAAiB,gBAAgB,GACpD,CACH,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { formService } from '@oneblink/apps'\n\nimport AutocompleteDropdown from '../components/renderer/AutocompleteDropdown'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport { FormTypes, PointTypes } from '@oneblink/types'\nimport useIsMounted from '../hooks/useIsMounted'\nimport { FormElementValueChangeHandler, IsDirtyProps } from '../types/form'\nimport useElementAriaDescribedby from '../hooks/useElementAriaDescribedby'\nimport { Collapse } from '@mui/material'\nimport {\n NotificationGrid,\n NotificationGridItem,\n} from '../components/NotificationGrid'\n\ntype Props = {\n formId: number\n id: string\n element: FormTypes.PointAddressElement\n value: PointTypes.PointAddress | undefined\n displayValidationMessage: boolean\n validationMessage: string | undefined\n onChange: FormElementValueChangeHandler<PointTypes.PointAddress>\n autocompleteAttributes?: string\n} & IsDirtyProps\n\ntype AddressType = 'all' | 'physical' | 'mailing'\nconst pointAddressClass = 'ob-point-address'\n\nfunction FormElementPointAddress({\n formId,\n id,\n element,\n value,\n displayValidationMessage,\n validationMessage,\n onChange,\n isDirty,\n setIsDirty,\n autocompleteAttributes,\n}: Props) {\n const ariaDescribedby = useElementAriaDescribedby(id, element)\n const isMounted = useIsMounted()\n const [label, setLabel] = React.useState('')\n const [error, setError] = React.useState<Error | undefined>()\n const [isLoadingAddressDetails, setIsLoadingAddressDetails] =\n React.useState(false)\n\n const handleSearch = React.useCallback(\n async (address: string, abortSignal: AbortSignal) => {\n setError(undefined)\n\n const params: {\n address: string\n maxNumberOfResults?: number\n stateTerritory?: string\n addressType?: AddressType\n } = {\n address,\n maxNumberOfResults: 10,\n }\n\n if (element.stateTerritoryFilter) {\n params.stateTerritory = element.stateTerritoryFilter.join(',')\n }\n if (element.addressTypeFilter) {\n let addressType: AddressType = 'all'\n if (element.addressTypeFilter.length === 1) {\n addressType = element.addressTypeFilter[0] as AddressType\n }\n params.addressType = addressType\n }\n\n const result = await formService.searchPointAddresses(\n formId,\n params,\n abortSignal,\n )\n\n return result.map((suggestion, index) => ({\n value: suggestion.id || index.toString(),\n label: suggestion.address || index.toString(),\n }))\n },\n [element.addressTypeFilter, element.stateTerritoryFilter, formId],\n )\n\n const handleChange = React.useCallback(\n async (addressId: string | undefined) => {\n if (!addressId) {\n onChange(element, { value: undefined })\n return\n }\n\n setIsLoadingAddressDetails(true)\n try {\n const result = await formService.getPointAddress(formId, addressId)\n onChange(element, { value: result })\n } catch (newError) {\n if (isMounted.current) {\n setError(newError as Error)\n }\n }\n if (isMounted.current) {\n setIsLoadingAddressDetails(false)\n }\n },\n [isMounted, onChange, element, formId],\n )\n\n // Ensure the label is set if the value is set outside of this component\n React.useEffect(() => {\n if (value) {\n const newLabel = value.addressDetails?.formattedAddress || value.addressId\n if (label !== newLabel) {\n setLabel(newLabel || '')\n }\n }\n // we don't need this to run again when the label changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value])\n\n return (\n <div className=\"cypress-point-address-element\">\n <FormElementLabelContainer\n className={`${pointAddressClass} ob-autocomplete`}\n element={element}\n id={id}\n required={element.required}\n >\n <AutocompleteDropdown\n id={id}\n label={label}\n disabled={element.readOnly || isLoadingAddressDetails}\n placeholder={element.placeholderValue}\n required={element.required}\n value={value}\n validationMessage={validationMessage}\n displayValidationMessage={displayValidationMessage}\n onChangeValue={handleChange}\n isLoading={isLoadingAddressDetails}\n hasError={!!error}\n onChangeLabel={setLabel}\n searchDebounceMs={750}\n searchMinCharacters={4}\n onSearch={handleSearch}\n isDirty={isDirty}\n setIsDirty={setIsDirty}\n aria-describedby={ariaDescribedby}\n autoComplete={autocompleteAttributes}\n />\n </FormElementLabelContainer>\n\n {error && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-point-address-details-error-message\">\n {error.toString()}\n </div>\n </div>\n )}\n\n <Collapse in={!!value && !!element.isDisplayingAddressInformation}>\n <NotificationGrid\n className={`${pointAddressClass}__record-display has-margin-top-6`}\n gridClassName={`${pointAddressClass}__container`}\n >\n <PointAddressGridItem\n label=\"Local Government Area\"\n value={value?.localGovernmentArea?.lgaName}\n classNameSuffix=\"local-government-area-name\"\n />\n <PointAddressGridItem\n label=\"Lot / Section / Plan No.\"\n value={value?.addressDetails?.cadastralIdentifier}\n classNameSuffix=\"cadastral-identifier\"\n />\n {value?.cadastralParcels?.map((cadastralParcel, index) => (\n <PointAddressGridItem\n key={cadastralParcel.propId || index}\n label=\"Lot / DP Numbers\"\n value={cadastralParcel?.parcelId?.join(', ')}\n classNameSuffix=\"cadastral-parcel\"\n />\n ))}\n </NotificationGrid>\n </Collapse>\n </div>\n )\n}\n\nfunction PointAddressGridItem({\n label,\n classNameSuffix,\n value,\n}: {\n label: string\n classNameSuffix: string\n value: string | undefined\n}) {\n return (\n <NotificationGridItem\n className={`${pointAddressClass}__container-${classNameSuffix}`}\n value={value}\n label={label}\n labelClassName={`${pointAddressClass}__detail-label`}\n valueClassName={`${pointAddressClass}__detail-value`}\n />\n )\n}\n\nexport default React.memo(FormElementPointAddress)\n"]}
|
package/dist/styles.css
CHANGED
@@ -10052,3 +10052,8 @@ textarea:disabled {
|
|
10052
10052
|
margin-top: 8px;
|
10053
10053
|
margin-bottom: 4px;
|
10054
10054
|
}
|
10055
|
+
|
10056
|
+
.ob-point-address__container {
|
10057
|
+
container-name: ob-point-address__container;
|
10058
|
+
container-type: inline-size;
|
10059
|
+
}
|
package/dist/styles.scss
CHANGED
@@ -143,6 +143,7 @@ $section-padding-mobile: $section-padding-mobile-y $section-padding-mobile-x;
|
|
143
143
|
@import './styles/validation-errors-card.scss';
|
144
144
|
@import './styles/calendar-booking-form.scss';
|
145
145
|
@import './styles/option-buttons.scss';
|
146
|
+
@import './styles/nsw-point-address.scss';
|
146
147
|
//
|
147
148
|
// Third Party
|
148
149
|
//
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@oneblink/apps-react",
|
3
3
|
"description": "Helper functions for OneBlink apps in ReactJS.",
|
4
|
-
"version": "8.1.0-beta.
|
4
|
+
"version": "8.1.0-beta.3",
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/oneblink/apps-react/issues"
|