@abgov/jsonforms-components 2.60.3 → 2.60.5

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 CHANGED
@@ -4317,6 +4317,9 @@ const OPTION_DEFINITIONS = defineFields$1({
4317
4317
  enablePhone: {
4318
4318
  schema: true
4319
4319
  },
4320
+ placeholder: {
4321
+ schema: 'Please select something'
4322
+ },
4320
4323
  emailFirst: {
4321
4324
  schema: true
4322
4325
  },
@@ -8071,24 +8074,22 @@ function fetchRegisterConfigFromOptions(options) {
8071
8074
  return config;
8072
8075
  }
8073
8076
  const EnumSelect = props => {
8074
- var _props$uischema, _uischema$options, _uischema$options2, _props$uischema2, _uischema$options3;
8077
+ var _props$uischema, _uischema$options, _uischema$options2, _uischema$options$pla, _uischema$options3, _props$uischema2, _uischema$options4;
8075
8078
  const {
8076
8079
  data,
8077
8080
  enabled,
8078
8081
  path,
8079
8082
  handleChange,
8080
8083
  options,
8081
- label,
8082
8084
  uischema,
8083
- required,
8084
- setIsVisited,
8085
- isVisited,
8086
- schema
8085
+ schema,
8086
+ errors
8087
8087
  } = props;
8088
8088
  const registerCtx = useContext(JsonFormsRegisterContext);
8089
8089
  const registerConfig = fetchRegisterConfigFromOptions((_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.register);
8090
8090
  const labelPath = (uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.label) || 'label';
8091
8091
  const valuePath = (uischema == null || (_uischema$options2 = uischema.options) == null ? void 0 : _uischema$options2.value) || 'value';
8092
+ const placeholder = (_uischema$options$pla = uischema == null || (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.placeholder) != null ? _uischema$options$pla : 'Select an option';
8092
8093
  let registerData = [];
8093
8094
  let error = '';
8094
8095
  if (registerConfig) {
@@ -8098,13 +8099,15 @@ const EnumSelect = props => {
8098
8099
  const autoCompletion = ((_props$uischema2 = props.uischema) == null || (_props$uischema2 = _props$uischema2.options) == null ? void 0 : _props$uischema2.autoComplete) === true;
8099
8100
  const mergedOptions = useMemo(() => {
8100
8101
  var _registerData;
8101
- const newOptions = [...(options || []), ...(((_registerData = registerData) == null ? void 0 : _registerData.map(d => {
8102
+ const staticOptions = (options || []).filter(item => !(item.value === '' && item.label.trim() === ''));
8103
+ const dynamicOptions = ((_registerData = registerData) == null ? void 0 : _registerData.map(d => {
8102
8104
  if (typeof d === 'string') {
8103
8105
  return {
8104
8106
  value: d,
8105
8107
  label: d
8106
8108
  };
8107
- } else if (typeof d === 'object' && d !== null) {
8109
+ }
8110
+ if (typeof d === 'object' && d !== null) {
8108
8111
  return {
8109
8112
  value: ___default.get(d, valuePath) || '',
8110
8113
  label: ___default.get(d, labelPath) || ''
@@ -8114,21 +8117,16 @@ const EnumSelect = props => {
8114
8117
  label: '',
8115
8118
  value: ''
8116
8119
  };
8117
- })) || [])];
8118
- const hasNonEmptyOptions = newOptions.some(option => option.value !== '');
8119
- if (!hasNonEmptyOptions && newOptions.length === 1 && newOptions[0].value === '') {
8120
- return newOptions;
8121
- }
8122
- if (newOptions && newOptions.length === 0) {
8123
- newOptions.push({
8124
- label: '',
8125
- value: ''
8126
- });
8127
- }
8120
+ })) || [];
8121
+ const filteredDynamicOptions = dynamicOptions.filter(item => !(item.value === '' && item.label.trim() === ''));
8122
+ const newOptions = [{
8123
+ label: placeholder,
8124
+ value: ''
8125
+ }, ...staticOptions, ...filteredDynamicOptions];
8128
8126
  return newOptions;
8129
- //eslint-disable-next-line
8130
- }, [registerData, options]);
8131
- const width = (uischema == null || (_uischema$options3 = uischema.options) == null || (_uischema$options3 = _uischema$options3.componentProps) == null ? void 0 : _uischema$options3.width) || '100%';
8127
+ // eslint-disable-next-line
8128
+ }, [registerData, options, valuePath, labelPath]);
8129
+ const width = (uischema == null || (_uischema$options4 = uischema.options) == null || (_uischema$options4 = _uischema$options4.componentProps) == null ? void 0 : _uischema$options4.width) || '100%';
8132
8130
  useEffect(() => {
8133
8131
  if (registerConfig) {
8134
8132
  registerCtx == null || registerCtx.fetchRegisterByUrl(registerConfig);
@@ -8171,8 +8169,8 @@ const enumControl = props => {
8171
8169
  }));
8172
8170
  };
8173
8171
  const GoAEnumControlTester = rankWith(4, (uischema, schema, context) => {
8174
- var _uischema$options4;
8175
- return (schema == null ? void 0 : schema.type) === 'object' && isControl$1(uischema) && (uischema == null || (_uischema$options4 = uischema.options) == null ? void 0 : _uischema$options4.format) === 'enum' || isEnumControl(uischema, schema, context);
8172
+ var _uischema$options5;
8173
+ return (schema == null ? void 0 : schema.type) === 'object' && isControl$1(uischema) && (uischema == null || (_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.format) === 'enum' || isEnumControl(uischema, schema, context);
8176
8174
  });
8177
8175
  const GoAEnumControl = withJsonFormsEnumProps(withTranslateProps(enumControl), true);
8178
8176
 
@@ -12197,7 +12195,7 @@ const ObjectArrayControl = props => {
12197
12195
  const isInReview = isStepperReview === true;
12198
12196
  const isListWithDetail = controlElement.type === 'ListWithDetail';
12199
12197
  if (isInReview) {
12200
- var _uischema$options6;
12198
+ var _uischema$options6, _uischema$options7;
12201
12199
  return jsx("tr", {
12202
12200
  children: jsxs(PageReviewContainer, {
12203
12201
  colSpan: 3,
@@ -12229,12 +12227,12 @@ const ObjectArrayControl = props => {
12229
12227
  },
12230
12228
  children: maxItemsError
12231
12229
  })]
12232
- }), ((_uischema$options6 = uischema.options) == null ? void 0 : _uischema$options6.stepId) !== undefined && jsx(GoabButton, {
12230
+ }), ((_uischema$options6 = uischema.options) == null ? void 0 : _uischema$options6.stepId) !== undefined && !((_uischema$options7 = uischema.options) != null && (_uischema$options7 = _uischema$options7.componentProps) != null && _uischema$options7.readOnly) && jsx(GoabButton, {
12233
12231
  type: "tertiary",
12234
12232
  size: "compact",
12235
12233
  onClick: () => {
12236
- var _uischema$options7;
12237
- return context == null ? void 0 : context.goToPage((_uischema$options7 = uischema.options) == null ? void 0 : _uischema$options7.stepId);
12234
+ var _uischema$options8;
12235
+ return context == null ? void 0 : context.goToPage((_uischema$options8 = uischema.options) == null ? void 0 : _uischema$options8.stepId);
12238
12236
  },
12239
12237
  children: "Change"
12240
12238
  })]
@@ -12607,7 +12605,7 @@ const AddressViews = ({
12607
12605
  })
12608
12606
  })]
12609
12607
  }), jsx("br", {}), jsxs(GoabGrid, {
12610
- minChildWidth: "0",
12608
+ minChildWidth: "18rem",
12611
12609
  gap: "s",
12612
12610
  children: [jsxs(GoabFormItem, {
12613
12611
  label: "Province",
@@ -14857,7 +14855,7 @@ const AddressInputs = ({
14857
14855
  })
14858
14856
  })]
14859
14857
  }), jsx("br", {}), jsxs(GoabGrid, {
14860
- minChildWidth: "0",
14858
+ minChildWidth: "18rem",
14861
14859
  gap: "s",
14862
14860
  children: [jsxs(GoabFormItem, {
14863
14861
  label: "Province",
@@ -14871,7 +14869,7 @@ const AddressInputs = ({
14871
14869
  ariaLabel: 'address-form-province',
14872
14870
  value: (address == null ? void 0 : address.subdivisionCode) || '',
14873
14871
  onChange: detail => handleInputChange('subdivisionCode', detail.value),
14874
- width: "25ch",
14872
+ width: "100%",
14875
14873
  children: provinces.map(w => jsx(GoabDropdownItem, {
14876
14874
  value: w.value,
14877
14875
  label: w.label
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.60.3",
3
+ "version": "2.60.5",
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",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-04-15T22:47:55.536Z",
4
- "sourceCommit": "c6ed1617cb77a6af93af89e0c715feb74b3dbf12",
3
+ "generatedAt": "2026-04-16T21:11:38.005Z",
4
+ "sourceCommit": "6201e03089bfd38b981d5a976a690f9985c2492d",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [
@@ -8,6 +8,9 @@ export declare const OPTION_DEFINITIONS: {
8
8
  enablePhone: {
9
9
  schema: boolean;
10
10
  };
11
+ placeholder: {
12
+ schema: string;
13
+ };
11
14
  emailFirst: {
12
15
  schema: boolean;
13
16
  };