@abgov/jsonforms-components 1.34.4 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +190 -183
- package/package.json +1 -1
- package/src/lib/Additional/HelpContent.d.ts +5 -3
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import React, { createContext, useContext, useReducer, useMemo, useEffect, useState, useRef, useCallback } from 'react';
|
|
3
|
-
import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADropdown, GoADropdownItem,
|
|
3
|
+
import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADropdown, GoADropdownItem, GoADetails, GoASkeleton } from '@abgov/react-components';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import get$1 from 'lodash/get';
|
|
@@ -7008,6 +7008,188 @@ const validatePostalCode = values => {
|
|
|
7008
7008
|
return postalCodeRegex.test(values);
|
|
7009
7009
|
};
|
|
7010
7010
|
|
|
7011
|
+
let _ = t => t,
|
|
7012
|
+
_t;
|
|
7013
|
+
const HelpContentDiv = styled.div(_t || (_t = _`
|
|
7014
|
+
.parent-label {
|
|
7015
|
+
font-size: 24px;
|
|
7016
|
+
margin-bottom: var(--goa-space-m);
|
|
7017
|
+
font-weight: bold;
|
|
7018
|
+
}
|
|
7019
|
+
|
|
7020
|
+
.child-label {
|
|
7021
|
+
font-size: 18px;
|
|
7022
|
+
margin-bottom: var(--goa-space-xs);
|
|
7023
|
+
font-weight: bold;
|
|
7024
|
+
}
|
|
7025
|
+
.parent-margin {
|
|
7026
|
+
margin-bottom: var(--goa-space-l);
|
|
7027
|
+
}
|
|
7028
|
+
.child-margin {
|
|
7029
|
+
margin-bottom: var(--goa-space-2xs);
|
|
7030
|
+
}
|
|
7031
|
+
ul {
|
|
7032
|
+
margin: 0 0 0 var(--goa-space-xs);
|
|
7033
|
+
}
|
|
7034
|
+
.single-line {
|
|
7035
|
+
margin: var(--goa-space-2xs) 0 var(--goa-space-2xs) 0;
|
|
7036
|
+
}
|
|
7037
|
+
`));
|
|
7038
|
+
|
|
7039
|
+
const linkLength = 40;
|
|
7040
|
+
const invalidExtensions = ['exe'];
|
|
7041
|
+
const RenderLink = props => {
|
|
7042
|
+
var _a;
|
|
7043
|
+
const {
|
|
7044
|
+
link,
|
|
7045
|
+
help
|
|
7046
|
+
} = props;
|
|
7047
|
+
const [linkValid, setLinkValid] = useState(null);
|
|
7048
|
+
let error = undefined;
|
|
7049
|
+
let linkLabel = link && (link === null || link === void 0 ? void 0 : link.length) > linkLength ? `${link === null || link === void 0 ? void 0 : link.slice(0, linkLength)}...` : link;
|
|
7050
|
+
let linkUrl = link;
|
|
7051
|
+
if (help) {
|
|
7052
|
+
linkLabel = help;
|
|
7053
|
+
}
|
|
7054
|
+
const count = ((_a = link === null || link === void 0 ? void 0 : link.split('.')) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
7055
|
+
const extension = link === null || link === void 0 ? void 0 : link.split('.')[count - 1];
|
|
7056
|
+
if (invalidExtensions.includes(extension || '')) {
|
|
7057
|
+
linkUrl = '';
|
|
7058
|
+
linkLabel = '';
|
|
7059
|
+
error = `Invalid extension: ${extension}`;
|
|
7060
|
+
}
|
|
7061
|
+
useEffect(() => {
|
|
7062
|
+
if (linkUrl) {
|
|
7063
|
+
setLinkValid(isValidHref(linkUrl));
|
|
7064
|
+
}
|
|
7065
|
+
}, [linkUrl]);
|
|
7066
|
+
if (!linkLabel && !error) {
|
|
7067
|
+
linkLabel = 'Link';
|
|
7068
|
+
}
|
|
7069
|
+
if (linkValid === false) {
|
|
7070
|
+
linkLabel = '';
|
|
7071
|
+
error = 'Invalid Link';
|
|
7072
|
+
}
|
|
7073
|
+
return jsx(GoAFormItem, {
|
|
7074
|
+
error: error,
|
|
7075
|
+
label: "",
|
|
7076
|
+
children: jsx("div", {
|
|
7077
|
+
"data-testid": "link-jsonform",
|
|
7078
|
+
children: linkUrl && linkValid ? jsx("div", {
|
|
7079
|
+
children: jsxs("a", {
|
|
7080
|
+
href: link,
|
|
7081
|
+
rel: "noopener noreferrer",
|
|
7082
|
+
target: "_blank",
|
|
7083
|
+
children: [linkLabel, isMailToHref(link !== null && link !== void 0 ? link : '') ? jsx(GoAContextMenuIcon, {
|
|
7084
|
+
type: "mail",
|
|
7085
|
+
title: "Email",
|
|
7086
|
+
testId: "mail-icon"
|
|
7087
|
+
}) : jsx(GoAIconButton, {
|
|
7088
|
+
icon: "open",
|
|
7089
|
+
title: "Open",
|
|
7090
|
+
testId: "open-icon",
|
|
7091
|
+
size: "small"
|
|
7092
|
+
})]
|
|
7093
|
+
})
|
|
7094
|
+
}) : linkLabel
|
|
7095
|
+
})
|
|
7096
|
+
});
|
|
7097
|
+
};
|
|
7098
|
+
|
|
7099
|
+
const HelpContentReviewComponent = () => {
|
|
7100
|
+
return jsx(Fragment, {});
|
|
7101
|
+
};
|
|
7102
|
+
const HelpContentComponent = _a => {
|
|
7103
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
7104
|
+
var {
|
|
7105
|
+
isParent = true,
|
|
7106
|
+
showLabel = true
|
|
7107
|
+
} = _a,
|
|
7108
|
+
props = __rest(_a, ["isParent", "showLabel"]);
|
|
7109
|
+
const labelClass = isParent ? 'parent-label' : 'child-label';
|
|
7110
|
+
const marginClass = isParent ? 'parent-margin' : 'child-margin';
|
|
7111
|
+
// eslint-disable-next-line
|
|
7112
|
+
const {
|
|
7113
|
+
uischema,
|
|
7114
|
+
visible,
|
|
7115
|
+
label
|
|
7116
|
+
} = props;
|
|
7117
|
+
const link = (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.link;
|
|
7118
|
+
const renderHelp = () => {
|
|
7119
|
+
var _a, _b, _c;
|
|
7120
|
+
return Array.isArray((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.help) ? jsx("ul", {
|
|
7121
|
+
children: (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help.map((line, index) => jsx("li", {
|
|
7122
|
+
children: `${line}`
|
|
7123
|
+
}, index))
|
|
7124
|
+
}) : jsx("p", {
|
|
7125
|
+
className: "single-line",
|
|
7126
|
+
children: (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help
|
|
7127
|
+
});
|
|
7128
|
+
};
|
|
7129
|
+
const renderImage = ({
|
|
7130
|
+
height,
|
|
7131
|
+
width,
|
|
7132
|
+
alt,
|
|
7133
|
+
src
|
|
7134
|
+
}) => {
|
|
7135
|
+
return jsx("img", {
|
|
7136
|
+
src: src,
|
|
7137
|
+
width: width,
|
|
7138
|
+
height: height,
|
|
7139
|
+
alt: alt
|
|
7140
|
+
});
|
|
7141
|
+
};
|
|
7142
|
+
const textVariant = !((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.variant) || ((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.variant) !== 'details' && ((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.variant) !== 'hyperlink';
|
|
7143
|
+
return jsx(Visible, {
|
|
7144
|
+
visible: visible,
|
|
7145
|
+
children: jsx(HelpContentDiv, {
|
|
7146
|
+
"aria-label": (_f = uischema.options) === null || _f === void 0 ? void 0 : _f.ariaLabel,
|
|
7147
|
+
children: jsxs("div", {
|
|
7148
|
+
className: marginClass,
|
|
7149
|
+
children: [label && showLabel && (!((_g = uischema.options) === null || _g === void 0 ? void 0 : _g.variant) || ((_h = uischema.options) === null || _h === void 0 ? void 0 : _h.variant) === 'hyperlink') && jsxs("div", {
|
|
7150
|
+
className: labelClass,
|
|
7151
|
+
"data-testid": label,
|
|
7152
|
+
children: [label, jsx("br", {})]
|
|
7153
|
+
}), ((_j = uischema.options) === null || _j === void 0 ? void 0 : _j.variant) && ((_k = uischema.options) === null || _k === void 0 ? void 0 : _k.variant) === 'img' && renderImage(uischema.options), ((_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.variant) && ((_m = uischema.options) === null || _m === void 0 ? void 0 : _m.variant) === 'hyperlink' && link && RenderLink(uischema === null || uischema === void 0 ? void 0 : uischema.options), textVariant && renderHelp(), ((_o = uischema.options) === null || _o === void 0 ? void 0 : _o.variant) && ((_p = uischema.options) === null || _p === void 0 ? void 0 : _p.variant) === 'details' && jsxs(GoADetails, {
|
|
7154
|
+
heading: label ? label : '',
|
|
7155
|
+
mt: "3xs",
|
|
7156
|
+
mb: "none",
|
|
7157
|
+
children: [renderHelp(), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && ((_q = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _q === void 0 ? void 0 : _q.length) > 0 && jsx(HelpContents, {
|
|
7158
|
+
elements: uischema === null || uischema === void 0 ? void 0 : uischema.elements
|
|
7159
|
+
})]
|
|
7160
|
+
}), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && (uischema === null || uischema === void 0 ? void 0 : uischema.elements.length) > 0 && ((_r = uischema.options) === null || _r === void 0 ? void 0 : _r.variant) !== 'details' && jsx(HelpContents, {
|
|
7161
|
+
elements: uischema.elements,
|
|
7162
|
+
isParent: false
|
|
7163
|
+
})]
|
|
7164
|
+
})
|
|
7165
|
+
})
|
|
7166
|
+
});
|
|
7167
|
+
};
|
|
7168
|
+
const HelpContents = ({
|
|
7169
|
+
elements,
|
|
7170
|
+
isParent: _isParent = false
|
|
7171
|
+
}) => jsx("div", {
|
|
7172
|
+
children: elements === null || elements === void 0 ? void 0 : elements.map((element, index) => {
|
|
7173
|
+
return jsx(HelpContentComponent, {
|
|
7174
|
+
uischema: element,
|
|
7175
|
+
label: element.label,
|
|
7176
|
+
errors: '',
|
|
7177
|
+
data: undefined,
|
|
7178
|
+
enabled: false,
|
|
7179
|
+
visible: true,
|
|
7180
|
+
path: '',
|
|
7181
|
+
handleChange: () => {},
|
|
7182
|
+
rootSchema: {},
|
|
7183
|
+
id: '',
|
|
7184
|
+
schema: {},
|
|
7185
|
+
isParent: _isParent
|
|
7186
|
+
}, `${element.label}-help-content-${index}`);
|
|
7187
|
+
})
|
|
7188
|
+
});
|
|
7189
|
+
const HelpContentTester = rankWith(1, uiTypeIs('HelpContent'));
|
|
7190
|
+
const HelpContent = withJsonFormsControlProps(HelpContentComponent);
|
|
7191
|
+
const HelpReviewContent = withJsonFormsControlProps(HelpContentReviewComponent);
|
|
7192
|
+
|
|
7011
7193
|
const ADDRESS_PATH = 'api/gateway/v1/address/v1/find';
|
|
7012
7194
|
const AddressLookUpControl = props => {
|
|
7013
7195
|
var _a, _b, _c;
|
|
@@ -7059,6 +7241,12 @@ const AddressLookUpControl = props => {
|
|
|
7059
7241
|
setAddress(newAddress);
|
|
7060
7242
|
updateFormData(newAddress);
|
|
7061
7243
|
};
|
|
7244
|
+
const renderHelp = () => {
|
|
7245
|
+
return jsx(HelpContentComponent, Object.assign({}, props, {
|
|
7246
|
+
isParent: true,
|
|
7247
|
+
showLabel: false
|
|
7248
|
+
}));
|
|
7249
|
+
};
|
|
7062
7250
|
useEffect(() => {
|
|
7063
7251
|
const fetchSuggestions = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7064
7252
|
if (searchTerm.length > 2) {
|
|
@@ -7090,7 +7278,7 @@ const AddressLookUpControl = props => {
|
|
|
7090
7278
|
setSuggestions([]);
|
|
7091
7279
|
};
|
|
7092
7280
|
return jsxs("div", {
|
|
7093
|
-
children: [jsx(GoAFormItem, {
|
|
7281
|
+
children: [renderHelp(), jsx(GoAFormItem, {
|
|
7094
7282
|
label: label,
|
|
7095
7283
|
children: jsxs(SearchBox, {
|
|
7096
7284
|
children: [jsx(GoAInput, {
|
|
@@ -7286,187 +7474,6 @@ const GoAGroupControlComponent = props => {
|
|
|
7286
7474
|
const GoAGroupLayoutTester = rankWith(1, uiTypeIs('Group'));
|
|
7287
7475
|
const GoAGroupControl = withJsonFormsLayoutProps(GoAGroupControlComponent, true);
|
|
7288
7476
|
|
|
7289
|
-
let _ = t => t,
|
|
7290
|
-
_t;
|
|
7291
|
-
const HelpContentDiv = styled.div(_t || (_t = _`
|
|
7292
|
-
.parent-label {
|
|
7293
|
-
font-size: 24px;
|
|
7294
|
-
margin-bottom: var(--goa-space-m);
|
|
7295
|
-
font-weight: bold;
|
|
7296
|
-
}
|
|
7297
|
-
|
|
7298
|
-
.child-label {
|
|
7299
|
-
font-size: 18px;
|
|
7300
|
-
margin-bottom: var(--goa-space-xs);
|
|
7301
|
-
font-weight: bold;
|
|
7302
|
-
}
|
|
7303
|
-
.parent-margin {
|
|
7304
|
-
margin-bottom: var(--goa-space-l);
|
|
7305
|
-
}
|
|
7306
|
-
.child-margin {
|
|
7307
|
-
margin-bottom: var(--goa-space-2xs);
|
|
7308
|
-
}
|
|
7309
|
-
ul {
|
|
7310
|
-
margin: 0 0 0 var(--goa-space-xs);
|
|
7311
|
-
}
|
|
7312
|
-
.single-line {
|
|
7313
|
-
margin: var(--goa-space-2xs) 0 var(--goa-space-2xs) 0;
|
|
7314
|
-
}
|
|
7315
|
-
`));
|
|
7316
|
-
|
|
7317
|
-
const linkLength = 40;
|
|
7318
|
-
const invalidExtensions = ['exe'];
|
|
7319
|
-
const RenderLink = props => {
|
|
7320
|
-
var _a;
|
|
7321
|
-
const {
|
|
7322
|
-
link,
|
|
7323
|
-
help
|
|
7324
|
-
} = props;
|
|
7325
|
-
const [linkValid, setLinkValid] = useState(null);
|
|
7326
|
-
let error = undefined;
|
|
7327
|
-
let linkLabel = link && (link === null || link === void 0 ? void 0 : link.length) > linkLength ? `${link === null || link === void 0 ? void 0 : link.slice(0, linkLength)}...` : link;
|
|
7328
|
-
let linkUrl = link;
|
|
7329
|
-
if (help) {
|
|
7330
|
-
linkLabel = help;
|
|
7331
|
-
}
|
|
7332
|
-
const count = ((_a = link === null || link === void 0 ? void 0 : link.split('.')) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
7333
|
-
const extension = link === null || link === void 0 ? void 0 : link.split('.')[count - 1];
|
|
7334
|
-
if (invalidExtensions.includes(extension || '')) {
|
|
7335
|
-
linkUrl = '';
|
|
7336
|
-
linkLabel = '';
|
|
7337
|
-
error = `Invalid extension: ${extension}`;
|
|
7338
|
-
}
|
|
7339
|
-
useEffect(() => {
|
|
7340
|
-
if (linkUrl) {
|
|
7341
|
-
setLinkValid(isValidHref(linkUrl));
|
|
7342
|
-
}
|
|
7343
|
-
}, [linkUrl]);
|
|
7344
|
-
if (!linkLabel && !error) {
|
|
7345
|
-
linkLabel = 'Link';
|
|
7346
|
-
}
|
|
7347
|
-
if (linkValid === false) {
|
|
7348
|
-
linkLabel = '';
|
|
7349
|
-
error = 'Invalid Link';
|
|
7350
|
-
}
|
|
7351
|
-
return jsx(GoAFormItem, {
|
|
7352
|
-
error: error,
|
|
7353
|
-
label: "",
|
|
7354
|
-
children: jsx("div", {
|
|
7355
|
-
"data-testid": "link-jsonform",
|
|
7356
|
-
children: linkUrl && linkValid ? jsx("div", {
|
|
7357
|
-
children: jsxs("a", {
|
|
7358
|
-
href: link,
|
|
7359
|
-
rel: "noopener noreferrer",
|
|
7360
|
-
target: "_blank",
|
|
7361
|
-
children: [linkLabel, isMailToHref(link !== null && link !== void 0 ? link : '') ? jsx(GoAContextMenuIcon, {
|
|
7362
|
-
type: "mail",
|
|
7363
|
-
title: "Email",
|
|
7364
|
-
testId: "mail-icon"
|
|
7365
|
-
}) : jsx(GoAIconButton, {
|
|
7366
|
-
icon: "open",
|
|
7367
|
-
title: "Open",
|
|
7368
|
-
testId: "open-icon",
|
|
7369
|
-
size: "small"
|
|
7370
|
-
})]
|
|
7371
|
-
})
|
|
7372
|
-
}) : linkLabel
|
|
7373
|
-
})
|
|
7374
|
-
});
|
|
7375
|
-
};
|
|
7376
|
-
|
|
7377
|
-
const HelpContentReviewComponent = () => {
|
|
7378
|
-
return jsx(Fragment, {});
|
|
7379
|
-
};
|
|
7380
|
-
const HelpContentComponent = _a => {
|
|
7381
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
7382
|
-
var {
|
|
7383
|
-
isParent = true
|
|
7384
|
-
} = _a,
|
|
7385
|
-
props = __rest(_a, ["isParent"]);
|
|
7386
|
-
const labelClass = isParent ? 'parent-label' : 'child-label';
|
|
7387
|
-
const marginClass = isParent ? 'parent-margin' : 'child-margin';
|
|
7388
|
-
// eslint-disable-next-line
|
|
7389
|
-
const {
|
|
7390
|
-
uischema,
|
|
7391
|
-
visible,
|
|
7392
|
-
label
|
|
7393
|
-
} = props;
|
|
7394
|
-
const link = (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.link;
|
|
7395
|
-
const renderHelp = () => {
|
|
7396
|
-
var _a, _b, _c;
|
|
7397
|
-
return Array.isArray((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.help) ? jsx("ul", {
|
|
7398
|
-
children: (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help.map((line, index) => jsx("li", {
|
|
7399
|
-
children: `${line}`
|
|
7400
|
-
}, index))
|
|
7401
|
-
}) : jsx("p", {
|
|
7402
|
-
className: "single-line",
|
|
7403
|
-
children: (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help
|
|
7404
|
-
});
|
|
7405
|
-
};
|
|
7406
|
-
const renderImage = ({
|
|
7407
|
-
height,
|
|
7408
|
-
width,
|
|
7409
|
-
alt,
|
|
7410
|
-
src
|
|
7411
|
-
}) => {
|
|
7412
|
-
return jsx("img", {
|
|
7413
|
-
src: src,
|
|
7414
|
-
width: width,
|
|
7415
|
-
height: height,
|
|
7416
|
-
alt: alt
|
|
7417
|
-
});
|
|
7418
|
-
};
|
|
7419
|
-
const textVariant = !((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.variant) || ((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.variant) !== 'details' && ((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.variant) !== 'hyperlink';
|
|
7420
|
-
return jsx(Visible, {
|
|
7421
|
-
visible: visible,
|
|
7422
|
-
children: jsx(HelpContentDiv, {
|
|
7423
|
-
"aria-label": (_f = uischema.options) === null || _f === void 0 ? void 0 : _f.ariaLabel,
|
|
7424
|
-
children: jsxs("div", {
|
|
7425
|
-
className: marginClass,
|
|
7426
|
-
children: [label && (!((_g = uischema.options) === null || _g === void 0 ? void 0 : _g.variant) || ((_h = uischema.options) === null || _h === void 0 ? void 0 : _h.variant) === 'hyperlink') && jsxs("div", {
|
|
7427
|
-
className: labelClass,
|
|
7428
|
-
"data-testid": label,
|
|
7429
|
-
children: [label, jsx("br", {})]
|
|
7430
|
-
}), ((_j = uischema.options) === null || _j === void 0 ? void 0 : _j.variant) && ((_k = uischema.options) === null || _k === void 0 ? void 0 : _k.variant) === 'img' && renderImage(uischema.options), ((_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.variant) && ((_m = uischema.options) === null || _m === void 0 ? void 0 : _m.variant) === 'hyperlink' && link && RenderLink(uischema === null || uischema === void 0 ? void 0 : uischema.options), textVariant && renderHelp(), ((_o = uischema.options) === null || _o === void 0 ? void 0 : _o.variant) && ((_p = uischema.options) === null || _p === void 0 ? void 0 : _p.variant) === 'details' && jsxs(GoADetails, {
|
|
7431
|
-
heading: label ? label : '',
|
|
7432
|
-
mt: "3xs",
|
|
7433
|
-
mb: "none",
|
|
7434
|
-
children: [renderHelp(), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && ((_q = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _q === void 0 ? void 0 : _q.length) > 0 && jsx(HelpContents, {
|
|
7435
|
-
elements: uischema === null || uischema === void 0 ? void 0 : uischema.elements
|
|
7436
|
-
})]
|
|
7437
|
-
}), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && (uischema === null || uischema === void 0 ? void 0 : uischema.elements.length) > 0 && ((_r = uischema.options) === null || _r === void 0 ? void 0 : _r.variant) !== 'details' && jsx(HelpContents, {
|
|
7438
|
-
elements: uischema.elements,
|
|
7439
|
-
isParent: false
|
|
7440
|
-
})]
|
|
7441
|
-
})
|
|
7442
|
-
})
|
|
7443
|
-
});
|
|
7444
|
-
};
|
|
7445
|
-
const HelpContents = ({
|
|
7446
|
-
elements,
|
|
7447
|
-
isParent: _isParent = false
|
|
7448
|
-
}) => jsx("div", {
|
|
7449
|
-
children: elements === null || elements === void 0 ? void 0 : elements.map((element, index) => {
|
|
7450
|
-
return jsx(HelpContentComponent, {
|
|
7451
|
-
uischema: element,
|
|
7452
|
-
label: element.label,
|
|
7453
|
-
errors: '',
|
|
7454
|
-
data: undefined,
|
|
7455
|
-
enabled: false,
|
|
7456
|
-
visible: true,
|
|
7457
|
-
path: '',
|
|
7458
|
-
handleChange: () => {},
|
|
7459
|
-
rootSchema: {},
|
|
7460
|
-
id: '',
|
|
7461
|
-
schema: {},
|
|
7462
|
-
isParent: _isParent
|
|
7463
|
-
}, `${element.label}-help-content-${index}`);
|
|
7464
|
-
})
|
|
7465
|
-
});
|
|
7466
|
-
const HelpContentTester = rankWith(1, uiTypeIs('HelpContent'));
|
|
7467
|
-
const HelpContent = withJsonFormsControlProps(HelpContentComponent);
|
|
7468
|
-
const HelpReviewContent = withJsonFormsControlProps(HelpContentReviewComponent);
|
|
7469
|
-
|
|
7470
7477
|
const isNullSchema = schema => {
|
|
7471
7478
|
return schema === undefined || schema === null;
|
|
7472
7479
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
|
|
6
6
|
"repository": "https://github.com/GovAlta/adsp-monorepo",
|
|
@@ -15,12 +15,14 @@ interface CustomControlElement extends ControlElement {
|
|
|
15
15
|
options?: OptionProps;
|
|
16
16
|
elements?: CustomControlElement[];
|
|
17
17
|
}
|
|
18
|
+
interface ExtraHelpContentProps {
|
|
19
|
+
isParent?: boolean;
|
|
20
|
+
showLabel?: boolean;
|
|
21
|
+
}
|
|
18
22
|
interface CustomControlProps extends ControlProps {
|
|
19
23
|
uischema: CustomControlElement;
|
|
20
24
|
}
|
|
21
|
-
export declare const HelpContentComponent: ({ isParent, ...props }: CustomControlProps &
|
|
22
|
-
isParent?: boolean;
|
|
23
|
-
}) => JSX.Element;
|
|
25
|
+
export declare const HelpContentComponent: ({ isParent, showLabel, ...props }: CustomControlProps & ExtraHelpContentProps) => JSX.Element;
|
|
24
26
|
export declare const HelpContentTester: RankedTester;
|
|
25
27
|
export declare const HelpContent: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
|
|
26
28
|
export declare const HelpReviewContent: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
|