@abgov/jsonforms-components 2.58.1 → 2.58.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/index.esm.js CHANGED
@@ -12314,17 +12314,67 @@ const PrimitiveArrayControl = props => {
12314
12314
  const addItem = () => {
12315
12315
  handleChange(path, [...items, '']);
12316
12316
  };
12317
+ const getOptionValue = option => typeof option === 'string' ? option : option.const;
12318
+ const getOptionLabel = option => typeof option === 'string' ? option : option.title || option.const;
12319
+ const getOptionDescription = option => typeof option === 'string' ? undefined : option.description;
12317
12320
  const removeItem = index => {
12318
12321
  const copy = [...items];
12319
12322
  copy.splice(index, 1);
12320
12323
  handleChange(path, copy);
12321
12324
  };
12325
+ const getPrimitiveArrayOptions = schema => {
12326
+ const itemSchema = schema == null ? void 0 : schema.items;
12327
+ if (Array.isArray(itemSchema == null ? void 0 : itemSchema.oneOf)) {
12328
+ return itemSchema.oneOf;
12329
+ }
12330
+ if (Array.isArray(itemSchema == null ? void 0 : itemSchema.enum)) {
12331
+ return itemSchema.enum;
12332
+ }
12333
+ return [];
12334
+ };
12322
12335
  const itemUiSchema = Object.assign({}, uischema, {
12323
12336
  scope: '#'
12324
12337
  });
12338
+ const options = uischema.options || {};
12325
12339
  const label = (uischema == null ? void 0 : uischema.label) || (schema == null ? void 0 : schema.title) || 'Item';
12326
12340
  const arrayLabel = getLabelText(uischema.scope, label);
12327
12341
  const prettyLabel = pluralize.singular(arrayLabel.charAt(0).toLocaleUpperCase() + arrayLabel.slice(1));
12342
+ if (options.format === 'checkboxes') {
12343
+ const checkboxOptions = getPrimitiveArrayOptions(schema);
12344
+ return jsxs(Visible, {
12345
+ visible: visible,
12346
+ children: [jsx("h4", {
12347
+ children: prettyLabel
12348
+ }), jsx("div", {
12349
+ children: checkboxOptions.map(option => {
12350
+ const value = getOptionValue(option);
12351
+ const text = getOptionLabel(option);
12352
+ const description = getOptionDescription(option);
12353
+ const checked = items.includes(value);
12354
+ return jsx(GoabCheckbox, {
12355
+ name: value,
12356
+ value: value,
12357
+ text: text,
12358
+ description: description,
12359
+ checked: checked,
12360
+ disabled: !enabled,
12361
+ testId: `${value}-checkbox`,
12362
+ onChange: detail => {
12363
+ let newValue = [...items];
12364
+ if (detail.value) {
12365
+ if (!newValue.includes(value)) {
12366
+ newValue.push(value);
12367
+ }
12368
+ } else {
12369
+ newValue = newValue.filter(item => item !== value);
12370
+ }
12371
+ handleChange(path, newValue.length ? newValue : undefined);
12372
+ }
12373
+ }, value);
12374
+ })
12375
+ })]
12376
+ });
12377
+ }
12328
12378
  return jsxs(Visible, {
12329
12379
  visible: visible,
12330
12380
  children: [jsx("div", {
@@ -12336,6 +12386,10 @@ const PrimitiveArrayControl = props => {
12336
12386
  onClick: () => addItem(),
12337
12387
  children: ["Add ", prettyLabel]
12338
12388
  })
12389
+ }), jsx("pre", {
12390
+ children: JSON.stringify(schema.items, null, 2)
12391
+ }), jsx("pre", {
12392
+ children: JSON.stringify(itemUiSchema, null, 2)
12339
12393
  }), items.length === 0 && jsxs("p", {
12340
12394
  style: {
12341
12395
  opacity: 0.7
@@ -14066,9 +14120,7 @@ const RenderPages = props => {
14066
14120
  const formStepperCtx = useContext(JsonFormsStepperContext);
14067
14121
  const {
14068
14122
  goToPage,
14069
- toggleShowReviewLink,
14070
- goToTableOfContext,
14071
- validatePage
14123
+ goToTableOfContext
14072
14124
  } = formStepperCtx;
14073
14125
  const {
14074
14126
  categories,
@@ -14102,6 +14154,21 @@ const RenderPages = props => {
14102
14154
  const onCloseModal = () => {
14103
14155
  setIsOpen(false);
14104
14156
  };
14157
+ const category = categories[activeId];
14158
+ const categoryProps = {
14159
+ category: category == null ? void 0 : category.uischema,
14160
+ categoryIndex: category == null ? void 0 : category.id,
14161
+ visible: category == null ? void 0 : category.visible,
14162
+ enabled: category == null ? void 0 : category.isEnabled,
14163
+ path,
14164
+ schema,
14165
+ renderers,
14166
+ cells,
14167
+ data,
14168
+ validationTrigger
14169
+ };
14170
+ const currentStep = activeId + 1 - categories.filter(c => !c.visible && c.id < activeId).length;
14171
+ const totalSteps = categories.filter(c => c.visible).length;
14105
14172
  return jsxs("div", {
14106
14173
  "data-testid": "form-stepper-test-wrapper",
14107
14174
  ref: topElementRef,
@@ -14117,85 +14184,67 @@ const RenderPages = props => {
14117
14184
  goToTableOfContext();
14118
14185
  },
14119
14186
  testId: "back-to-tasks"
14120
- }), //eslint-disable-next-line
14121
- categories == null ? void 0 : categories.map((category, index) => {
14122
- const categoryProps = {
14123
- category: category.uischema,
14124
- categoryIndex: category.id,
14125
- visible: category == null ? void 0 : category.visible,
14126
- enabled: category == null ? void 0 : category.isEnabled,
14127
- path,
14128
- schema,
14129
- renderers,
14130
- cells,
14131
- data,
14132
- validationTrigger
14133
- };
14134
- const currentStep = index + 1 - categories.filter(c => !c.visible && c.id < index).length;
14135
- const totalSteps = categories.filter(c => c.visible).length;
14136
- const isActive = index === activeId && !isOnReview;
14137
- return jsx(Visible, {
14138
- visible: isActive,
14139
- children: jsxs("div", {
14140
- "data-testid": `step_${index}-content-pages`,
14141
- style: {
14142
- marginTop: '1.5rem'
14143
- },
14144
- children: [jsxs(PageRenderPadding, {
14145
- children: [jsxs("h3", {
14146
- children: ["Step ", currentStep, " of ", totalSteps]
14147
- }), jsx(RenderStepElements, Object.assign({}, categoryProps))]
14148
- }), jsx(PageRenderPadding, {
14149
- children: jsxs(GoabGrid, {
14150
- minChildWidth: "100px",
14151
- gap: "2xs",
14152
- children: [jsxs(GoabButtonGroup, {
14153
- alignment: "start",
14154
- children: [activeId > 0 && jsx(GoabButton, {
14155
- type: "secondary",
14156
- onClick: () => {
14157
- handleSave();
14158
- let prevId = activeId - 1;
14159
- while (prevId >= 0 && categories[prevId].visible === false) {
14160
- prevId = prevId - 1;
14161
- }
14162
- if (prevId >= 0) {
14163
- if (topElementRef.current) {
14164
- topElementRef.current.scrollIntoView();
14165
- }
14166
- goToPage(prevId);
14167
- }
14168
- },
14169
- testId: "pages-prev-btn",
14170
- children: "Previous"
14171
- }), ' ']
14172
- }), jsx(GoabButtonGroup, {
14173
- alignment: "end",
14174
- children: jsx(GoabButton, {
14175
- type: "submit",
14176
- onClick: () => {
14177
- handleSave();
14178
- let nextId = activeId + 1;
14179
- while (nextId < categories.length && categories[nextId].visible === false) {
14180
- nextId = nextId + 1;
14187
+ }), !isOnReview && jsx(Visible, {
14188
+ visible: true,
14189
+ children: jsxs("div", {
14190
+ "data-testid": `step_${activeId}-content-pages`,
14191
+ style: {
14192
+ marginTop: '1.5rem'
14193
+ },
14194
+ children: [jsxs(PageRenderPadding, {
14195
+ children: [jsxs("h3", {
14196
+ children: ["Step ", currentStep, " of ", totalSteps]
14197
+ }), jsx(RenderStepElements, Object.assign({}, categoryProps))]
14198
+ }), jsx(PageRenderPadding, {
14199
+ children: jsxs(GoabGrid, {
14200
+ minChildWidth: "100px",
14201
+ gap: "2xs",
14202
+ children: [jsxs(GoabButtonGroup, {
14203
+ alignment: "start",
14204
+ children: [activeId > 0 && jsx(GoabButton, {
14205
+ type: "secondary",
14206
+ onClick: () => {
14207
+ handleSave();
14208
+ let prevId = activeId - 1;
14209
+ while (prevId >= 0 && categories[prevId].visible === false) {
14210
+ prevId = prevId - 1;
14211
+ }
14212
+ if (prevId >= 0) {
14213
+ if (topElementRef.current) {
14214
+ topElementRef.current.scrollIntoView();
14181
14215
  }
14182
- if (!(currentStep === totalSteps && hideSummary)) {
14183
- if (topElementRef.current) {
14184
- topElementRef.current.scrollIntoView();
14185
- }
14186
- goToPage(nextId);
14216
+ goToPage(prevId);
14217
+ }
14218
+ },
14219
+ testId: "pages-prev-btn",
14220
+ children: "Previous"
14221
+ }), ' ']
14222
+ }), jsx(GoabButtonGroup, {
14223
+ alignment: "end",
14224
+ children: jsx(GoabButton, {
14225
+ type: "submit",
14226
+ onClick: () => {
14227
+ handleSave();
14228
+ let nextId = activeId + 1;
14229
+ while (nextId < categories.length && categories[nextId].visible === false) {
14230
+ nextId = nextId + 1;
14231
+ }
14232
+ if (!(currentStep === totalSteps && hideSummary)) {
14233
+ if (topElementRef.current) {
14234
+ topElementRef.current.scrollIntoView();
14187
14235
  }
14188
- },
14189
- disabled: !enabled,
14190
- testId: "pages-save-continue-btn",
14191
- children: currentStep === totalSteps ? submissionLabel : 'Next'
14192
- })
14193
- })]
14194
- })
14195
- })]
14196
- })
14197
- }, `page-${category.id}`);
14198
- }), isOnReview && jsxs("div", {
14236
+ goToPage(nextId);
14237
+ }
14238
+ },
14239
+ disabled: !enabled,
14240
+ testId: "pages-save-continue-btn",
14241
+ children: currentStep === totalSteps ? submissionLabel : 'Next'
14242
+ })
14243
+ })]
14244
+ })
14245
+ })]
14246
+ })
14247
+ }, `page-${category == null ? void 0 : category.id}`), isOnReview && jsxs("div", {
14199
14248
  "data-testid": "stepper-pages-review-page",
14200
14249
  children: [jsx(FormStepperPageReviewer, Object.assign({}, props.categoryProps, {
14201
14250
  navigationFunc: goToPage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.58.1",
3
+ "version": "2.58.3",
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-03-30T15:31:44.524Z",
4
- "sourceCommit": "8e3617b9358f0855a8c79f185293ebf01769e437",
3
+ "generatedAt": "2026-04-06T15:32:07.375Z",
4
+ "sourceCommit": "1d7a0054291ed3ec1af68caee9d7554ce382199e",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [