@abgov/jsonforms-components 2.82.0 → 2.82.2
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 +96 -41
- package/package.json +2 -2
- package/renderer-catalog.json +2 -2
- package/src/lib/Components/FluidDropdown.d.ts +14 -0
package/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import styled, { css } from 'styled-components';
|
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import get$1 from 'lodash/get';
|
|
7
7
|
import { toDataPath, INIT, UPDATE_CORE, isEnabled, isVisible, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, or, isOneOfEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, schemaTypeIs, formatIs, getAjv, schemaMatches, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout } from '@jsonforms/core';
|
|
8
|
-
import * as _$
|
|
8
|
+
import * as _$d from 'lodash';
|
|
9
9
|
import ___default, { isEqual as isEqual$1, isEmpty, isObject as isObject$o } from 'lodash';
|
|
10
10
|
import isEqual from 'lodash/isEqual';
|
|
11
11
|
import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
|
|
@@ -6051,16 +6051,16 @@ const ensureGoaDatePointerCursor = host => {
|
|
|
6051
6051
|
sr.appendChild(style);
|
|
6052
6052
|
};
|
|
6053
6053
|
|
|
6054
|
-
let _$
|
|
6055
|
-
_t$
|
|
6054
|
+
let _$c = t => t,
|
|
6055
|
+
_t$d,
|
|
6056
6056
|
_t2$7;
|
|
6057
|
-
styled.div(_t$
|
|
6057
|
+
styled.div(_t$d || (_t$d = _$c`
|
|
6058
6058
|
height: 70vh;
|
|
6059
6059
|
overflow-y: auto;
|
|
6060
6060
|
padding-left: var(--goa-space-2xs);
|
|
6061
6061
|
padding-right: var(--goa-space-2xs);
|
|
6062
6062
|
`));
|
|
6063
|
-
const Visible = styled.div(_t2$7 || (_t2$7 = _$
|
|
6063
|
+
const Visible = styled.div(_t2$7 || (_t2$7 = _$c`
|
|
6064
6064
|
display: ${0};
|
|
6065
6065
|
width: 100%;
|
|
6066
6066
|
`), p => p.$visible !== false ? 'block' : 'none');
|
|
@@ -7553,8 +7553,8 @@ const useRegisterUser = () => {
|
|
|
7553
7553
|
return ctx.user;
|
|
7554
7554
|
};
|
|
7555
7555
|
|
|
7556
|
-
let _$
|
|
7557
|
-
_t$
|
|
7556
|
+
let _$b = t => t,
|
|
7557
|
+
_t$c,
|
|
7558
7558
|
_t2$6,
|
|
7559
7559
|
_t3$4,
|
|
7560
7560
|
_t4$4,
|
|
@@ -7568,10 +7568,10 @@ let _$a = t => t,
|
|
|
7568
7568
|
_t10$2,
|
|
7569
7569
|
_t11$2,
|
|
7570
7570
|
_t12$2;
|
|
7571
|
-
const FormFieldWrapper$1 = styled.div(_t$
|
|
7571
|
+
const FormFieldWrapper$1 = styled.div(_t$c || (_t$c = _$b`
|
|
7572
7572
|
margin-bottom: var(--goa-space-l);
|
|
7573
7573
|
`));
|
|
7574
|
-
const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$
|
|
7574
|
+
const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$b`
|
|
7575
7575
|
display: flex;
|
|
7576
7576
|
align-items: flex-start;
|
|
7577
7577
|
gap: var(--goa-space-2xs);
|
|
@@ -7579,32 +7579,32 @@ const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$a`
|
|
|
7579
7579
|
color: var(--goa-form-item-error-message-color);
|
|
7580
7580
|
margin-top: var(--goa-form-item-message-margin-top);
|
|
7581
7581
|
`));
|
|
7582
|
-
const RequiredTextLabel = styled.label(_t3$4 || (_t3$4 = _$
|
|
7582
|
+
const RequiredTextLabel = styled.label(_t3$4 || (_t3$4 = _$b`
|
|
7583
7583
|
color: var(--goa-color-greyscale-700);
|
|
7584
7584
|
font-weight: var(--goa-font-weight-regular);
|
|
7585
7585
|
font-size: var(--goa-font-size-2);
|
|
7586
7586
|
line-height: var(--goa-line-height-1);
|
|
7587
7587
|
font-style: normal;
|
|
7588
7588
|
`));
|
|
7589
|
-
styled.td(_t4$4 || (_t4$4 = _$
|
|
7589
|
+
styled.td(_t4$4 || (_t4$4 = _$b`
|
|
7590
7590
|
width: 40%;
|
|
7591
7591
|
padding-top: var(--goa-space-s);
|
|
7592
7592
|
padding-bottom: var(--goa-space-s);
|
|
7593
7593
|
padding-right: var(--goa-space-m);
|
|
7594
7594
|
vertical-align: top;
|
|
7595
7595
|
`));
|
|
7596
|
-
styled.td(_t5$3 || (_t5$3 = _$
|
|
7596
|
+
styled.td(_t5$3 || (_t5$3 = _$b`
|
|
7597
7597
|
width: 40%;
|
|
7598
7598
|
text-align: left;
|
|
7599
7599
|
vertical-align: top;
|
|
7600
7600
|
`));
|
|
7601
|
-
const PageReviewContainer = styled.td(_t6$3 || (_t6$3 = _$
|
|
7601
|
+
const PageReviewContainer = styled.td(_t6$3 || (_t6$3 = _$b`
|
|
7602
7602
|
padding: var(--goa-space-xs) var(--goa-space-m) var(--goa-space-xs);
|
|
7603
7603
|
border-bottom: 1px solid #ccc;
|
|
7604
7604
|
width: 100%;
|
|
7605
7605
|
vertical-align: top;
|
|
7606
7606
|
`));
|
|
7607
|
-
const ReviewHeader = styled.div(_t7$2 || (_t7$2 = _$
|
|
7607
|
+
const ReviewHeader = styled.div(_t7$2 || (_t7$2 = _$b`
|
|
7608
7608
|
display: flex;
|
|
7609
7609
|
justify-content: space-between;
|
|
7610
7610
|
align-items: center;
|
|
@@ -7616,7 +7616,7 @@ const ReviewHeader = styled.div(_t7$2 || (_t7$2 = _$a`
|
|
|
7616
7616
|
flex-wrap: wrap;
|
|
7617
7617
|
}
|
|
7618
7618
|
`));
|
|
7619
|
-
const ReviewLabel = styled.div(_t8$2 || (_t8$2 = _$
|
|
7619
|
+
const ReviewLabel = styled.div(_t8$2 || (_t8$2 = _$b`
|
|
7620
7620
|
font-weight: var(--goa-font-weight-bold);
|
|
7621
7621
|
font-size: var(--goa-font-size-4);
|
|
7622
7622
|
line-height: var(--goa-line-height-3);
|
|
@@ -7624,7 +7624,7 @@ const ReviewLabel = styled.div(_t8$2 || (_t8$2 = _$a`
|
|
|
7624
7624
|
overflow-wrap: break-word;
|
|
7625
7625
|
min-width: 0;
|
|
7626
7626
|
`));
|
|
7627
|
-
const ReviewValue = styled.div(_t9$2 || (_t9$2 = _$
|
|
7627
|
+
const ReviewValue = styled.div(_t9$2 || (_t9$2 = _$b`
|
|
7628
7628
|
margin-top: var(--goa-space-m);
|
|
7629
7629
|
color: var(--goa-color-text-default);
|
|
7630
7630
|
font-size: var(--goa-font-size-4);
|
|
@@ -7633,23 +7633,23 @@ const ReviewValue = styled.div(_t9$2 || (_t9$2 = _$a`
|
|
|
7633
7633
|
overflow-wrap: anywhere;
|
|
7634
7634
|
`));
|
|
7635
7635
|
//Check and unchecked are different heights otherwise
|
|
7636
|
-
const CheckboxWrapper = styled.div(_t0$2 || (_t0$2 = _$
|
|
7636
|
+
const CheckboxWrapper = styled.div(_t0$2 || (_t0$2 = _$b`
|
|
7637
7637
|
min-height: 28px;
|
|
7638
7638
|
`));
|
|
7639
|
-
const NoneGivenText = styled.span(_t1$2 || (_t1$2 = _$
|
|
7639
|
+
const NoneGivenText = styled.span(_t1$2 || (_t1$2 = _$b`
|
|
7640
7640
|
color: var(--goa-color-greyscale-700);
|
|
7641
7641
|
font-style: italic;
|
|
7642
7642
|
`));
|
|
7643
|
-
const NoneGivenTableText = styled.span(_t10$2 || (_t10$2 = _$
|
|
7643
|
+
const NoneGivenTableText = styled.span(_t10$2 || (_t10$2 = _$b`
|
|
7644
7644
|
padding-top: var(--goa-space-l);
|
|
7645
7645
|
color: var(--goa-color-greyscale-700);
|
|
7646
7646
|
font-style: italic;
|
|
7647
7647
|
`));
|
|
7648
|
-
styled.h4(_t11$2 || (_t11$2 = _$
|
|
7648
|
+
styled.h4(_t11$2 || (_t11$2 = _$b`
|
|
7649
7649
|
margin: 0 0 0.25rem 0;
|
|
7650
7650
|
fontsize: larger;
|
|
7651
7651
|
`));
|
|
7652
|
-
styled.h4(_t12$2 || (_t12$2 = _$
|
|
7652
|
+
styled.h4(_t12$2 || (_t12$2 = _$b`
|
|
7653
7653
|
border-bottom: 1px solid #ddd;
|
|
7654
7654
|
`));
|
|
7655
7655
|
|
|
@@ -7966,7 +7966,7 @@ const collectPropertyValues = (obj, property, endWithType) => {
|
|
|
7966
7966
|
Object.entries(obj).forEach(function ([key, value]) {
|
|
7967
7967
|
if (key === property) {
|
|
7968
7968
|
values.push(value);
|
|
7969
|
-
} else if (_$
|
|
7969
|
+
} else if (_$d.isObject(value)) {
|
|
7970
7970
|
// if the object type is equal to end type, we are not going to continue the recursive approach
|
|
7971
7971
|
if ((value == null ? void 0 : value.type) === endWithType) {
|
|
7972
7972
|
if (property in value) {
|
|
@@ -7975,7 +7975,7 @@ const collectPropertyValues = (obj, property, endWithType) => {
|
|
|
7975
7975
|
} else {
|
|
7976
7976
|
values = [...values, ...pickPropertyValues(value, property, endWithType)];
|
|
7977
7977
|
}
|
|
7978
|
-
} else if (_$
|
|
7978
|
+
} else if (_$d.isArray(value)) {
|
|
7979
7979
|
const nextValues = value.map(function (arrayObj) {
|
|
7980
7980
|
return pickPropertyValues(arrayObj, property, endWithType);
|
|
7981
7981
|
});
|
|
@@ -9269,17 +9269,17 @@ const mergeAutoPopulatedData = (data, autoPopulatedData) => {
|
|
|
9269
9269
|
const defaults = autoPopulatedData.reduce((values, {
|
|
9270
9270
|
path,
|
|
9271
9271
|
value
|
|
9272
|
-
}) => _$
|
|
9273
|
-
const normalizedData = _$
|
|
9272
|
+
}) => _$d.set(values, path, value), {});
|
|
9273
|
+
const normalizedData = _$d.cloneDeep(data != null ? data : {});
|
|
9274
9274
|
autoPopulatedData.forEach(({
|
|
9275
9275
|
path,
|
|
9276
9276
|
value
|
|
9277
9277
|
}) => {
|
|
9278
|
-
if (isEmptyAutoPopulateTarget(_$
|
|
9279
|
-
_$
|
|
9278
|
+
if (isEmptyAutoPopulateTarget(_$d.get(normalizedData, path)) && value !== undefined && value !== null) {
|
|
9279
|
+
_$d.unset(normalizedData, path);
|
|
9280
9280
|
}
|
|
9281
9281
|
});
|
|
9282
|
-
return _$
|
|
9282
|
+
return _$d.defaultsDeep({}, normalizedData, defaults);
|
|
9283
9283
|
};
|
|
9284
9284
|
const createAutoPopulateMiddleware = (uischema, user) => (state, action, defaultReducer) => {
|
|
9285
9285
|
const newState = defaultReducer(state, action);
|
|
@@ -10950,6 +10950,71 @@ function useDebounce(value, delay) {
|
|
|
10950
10950
|
return debouncedValue;
|
|
10951
10951
|
}
|
|
10952
10952
|
|
|
10953
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
10954
|
+
if (null == r) return {};
|
|
10955
|
+
var t = {};
|
|
10956
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
10957
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
10958
|
+
t[n] = r[n];
|
|
10959
|
+
}
|
|
10960
|
+
return t;
|
|
10961
|
+
}
|
|
10962
|
+
|
|
10963
|
+
const _excluded$7 = ["width"];
|
|
10964
|
+
let _$a = t => t,
|
|
10965
|
+
_t$b;
|
|
10966
|
+
// Inline-size containment stops the dropdown's pixel width from counting towards its container's
|
|
10967
|
+
// minimum width, so the container can still shrink and the observer below sees the new width.
|
|
10968
|
+
const DropdownWidthWrapper = styled.div(_t$b || (_t$b = _$a`
|
|
10969
|
+
contain: inline-size;
|
|
10970
|
+
`));
|
|
10971
|
+
/**
|
|
10972
|
+
* goa-dropdown turns a percentage width into a pixel width that it measures only when its options
|
|
10973
|
+
* mount or its menu opens, never when its container resizes. When the layout changes width after
|
|
10974
|
+
* mount (list-with-details stacking its panes, a window resize, a phone rotating) the dropdown keeps
|
|
10975
|
+
* its old width until it is clicked. This measures the wrapper instead and passes the dropdown a
|
|
10976
|
+
* whole-pixel width (goa-dropdown rejects fractional values) that follows the container.
|
|
10977
|
+
*/
|
|
10978
|
+
const useFluidDropdownWidth = width => {
|
|
10979
|
+
var _exec;
|
|
10980
|
+
const ref = useRef(null);
|
|
10981
|
+
const [measured, setMeasured] = useState();
|
|
10982
|
+
const percent = width ? (_exec = /^(\d+(?:\.\d+)?)%$/.exec(width)) == null ? void 0 : _exec[1] : undefined;
|
|
10983
|
+
useLayoutEffect(() => {
|
|
10984
|
+
const el = ref.current;
|
|
10985
|
+
if (!percent || !el || typeof ResizeObserver === 'undefined') {
|
|
10986
|
+
setMeasured(undefined);
|
|
10987
|
+
return;
|
|
10988
|
+
}
|
|
10989
|
+
const update = containerWidth => {
|
|
10990
|
+
const px = Math.floor(containerWidth * Number(percent) / 100);
|
|
10991
|
+
setMeasured(px > 0 ? `${px}px` : undefined);
|
|
10992
|
+
};
|
|
10993
|
+
update(el.clientWidth);
|
|
10994
|
+
const observer = new ResizeObserver(([entry]) => update(entry.contentRect.width));
|
|
10995
|
+
observer.observe(el);
|
|
10996
|
+
return () => observer.disconnect();
|
|
10997
|
+
}, [percent]);
|
|
10998
|
+
return {
|
|
10999
|
+
ref,
|
|
11000
|
+
width: measured != null ? measured : width
|
|
11001
|
+
};
|
|
11002
|
+
};
|
|
11003
|
+
/** GoabDropdown whose percentage width keeps following its container. */
|
|
11004
|
+
const FluidDropdown = _ref => {
|
|
11005
|
+
let {
|
|
11006
|
+
width
|
|
11007
|
+
} = _ref,
|
|
11008
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
11009
|
+
const fluid = useFluidDropdownWidth(width);
|
|
11010
|
+
return jsx(DropdownWidthWrapper, {
|
|
11011
|
+
ref: fluid.ref,
|
|
11012
|
+
children: jsx(GoabDropdown, Object.assign({}, props, {
|
|
11013
|
+
width: fluid.width
|
|
11014
|
+
}))
|
|
11015
|
+
});
|
|
11016
|
+
};
|
|
11017
|
+
|
|
10953
11018
|
function fetchRegisterConfigFromOptions$1(options) {
|
|
10954
11019
|
if (!(options != null && options.url) && !(options != null && options.urn)) return undefined;
|
|
10955
11020
|
const config = Object.assign({}, options);
|
|
@@ -11104,7 +11169,7 @@ const InnerGoAInputText = props => {
|
|
|
11104
11169
|
const readOnly = (_uischema$options$com2 = uischema == null || (_uischema$options9 = uischema.options) == null || (_uischema$options9 = _uischema$options9.componentProps) == null ? void 0 : _uischema$options9.readOnly) != null ? _uischema$options$com2 : false;
|
|
11105
11170
|
const formatPattern = uischema == null || (_uischema$options0 = uischema.options) == null ? void 0 : _uischema$options0.formatPattern;
|
|
11106
11171
|
return jsx("div", {
|
|
11107
|
-
children: mergedOptions.length > 1 ? jsx(
|
|
11172
|
+
children: mergedOptions.length > 1 ? jsx(FluidDropdown, {
|
|
11108
11173
|
name: `jsonforms-${path}-dropdown`,
|
|
11109
11174
|
value: data,
|
|
11110
11175
|
disabled: !enabled,
|
|
@@ -11341,16 +11406,6 @@ const MultiLineTextControlInput = props => jsx(GoAInputBaseControl, Object.assig
|
|
|
11341
11406
|
const MultiLineTextControlTester = rankWith(3, and(isStringControl, optionIs('multi', true)));
|
|
11342
11407
|
const MultiLineTextControl = withJsonFormsControlProps(MultiLineTextControlInput);
|
|
11343
11408
|
|
|
11344
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
11345
|
-
if (null == r) return {};
|
|
11346
|
-
var t = {};
|
|
11347
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
11348
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
11349
|
-
t[n] = r[n];
|
|
11350
|
-
}
|
|
11351
|
-
return t;
|
|
11352
|
-
}
|
|
11353
|
-
|
|
11354
11409
|
var toIntegerOrInfinity$1 = toIntegerOrInfinity$9;
|
|
11355
11410
|
var toString$5 = toString$n;
|
|
11356
11411
|
var requireObjectCoercible$3 = requireObjectCoercible$e;
|
|
@@ -12009,7 +12064,7 @@ const EnumSelect = props => {
|
|
|
12009
12064
|
return jsx("div", {
|
|
12010
12065
|
children: error.length > 0 ? callout({
|
|
12011
12066
|
message: error
|
|
12012
|
-
}) : jsx(
|
|
12067
|
+
}) : jsx(FluidDropdown, {
|
|
12013
12068
|
name: `jsonforms-${path}-dropdown`,
|
|
12014
12069
|
value: typeof data === 'object' ? ___default.get(data, valuePath) : data,
|
|
12015
12070
|
disabled: !enabled,
|
|
@@ -19077,7 +19132,7 @@ const AddressInputs = ({
|
|
|
19077
19132
|
children: [isAlbertaAddress && jsx(LabelDiv, {
|
|
19078
19133
|
"data-testid": "address-form-province",
|
|
19079
19134
|
children: "Alberta"
|
|
19080
|
-
}), !isAlbertaAddress && jsx(
|
|
19135
|
+
}), !isAlbertaAddress && jsx(FluidDropdown, {
|
|
19081
19136
|
name: "subdivisionCode",
|
|
19082
19137
|
disabled: !enabled,
|
|
19083
19138
|
testId: "address-form-province-dropdown",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.82.
|
|
3
|
+
"version": "2.82.2",
|
|
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",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@jsonforms/core": "^3.1.0",
|
|
11
11
|
"@jsonforms/react": "^3.1.0",
|
|
12
12
|
"react": "^18.0.0",
|
|
13
|
-
"dompurify": "^3.
|
|
13
|
+
"dompurify": "^3.4.17",
|
|
14
14
|
"xss": "^1.0.15",
|
|
15
15
|
"ajv": "^8.6.1",
|
|
16
16
|
"ajv-errors": "^3.0.0",
|
package/renderer-catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-11-
|
|
4
|
-
"sourceCommit": "
|
|
3
|
+
"generatedAt": "2026-11-09T16:50:10.156Z",
|
|
4
|
+
"sourceCommit": "841d841afc334e8326aa6f415a9725ef6b338f12",
|
|
5
5
|
"sourcePath": "libs/jsonforms-components/src/index.ts",
|
|
6
6
|
"rendererCount": 23,
|
|
7
7
|
"renderers": [
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GoabDropdownProps } from '@abgov/react-components-ds1';
|
|
2
|
+
/**
|
|
3
|
+
* goa-dropdown turns a percentage width into a pixel width that it measures only when its options
|
|
4
|
+
* mount or its menu opens, never when its container resizes. When the layout changes width after
|
|
5
|
+
* mount (list-with-details stacking its panes, a window resize, a phone rotating) the dropdown keeps
|
|
6
|
+
* its old width until it is clicked. This measures the wrapper instead and passes the dropdown a
|
|
7
|
+
* whole-pixel width (goa-dropdown rejects fractional values) that follows the container.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useFluidDropdownWidth: (width?: string) => {
|
|
10
|
+
ref: import("react").RefObject<HTMLDivElement>;
|
|
11
|
+
width: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
/** GoabDropdown whose percentage width keeps following its container. */
|
|
14
|
+
export declare const FluidDropdown: ({ width, ...props }: GoabDropdownProps) => JSX.Element;
|