@abgov/jsonforms-components 2.3.6 → 2.3.8

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
@@ -3086,6 +3086,21 @@ const standardizeDate = date => {
3086
3086
  return undefined;
3087
3087
  }
3088
3088
  };
3089
+ const to12HourFormat = time24 => {
3090
+ return UTCToFullLocalTime('2025-03-22 ' + time24, true).slice(-11);
3091
+ };
3092
+ const UTCToFullLocalTime = (fullTime, useUTC = false) => {
3093
+ return new Date(fullTime).toLocaleString('en-CA', {
3094
+ hour12: true,
3095
+ year: 'numeric',
3096
+ month: '2-digit',
3097
+ day: '2-digit',
3098
+ hour: '2-digit',
3099
+ second: 'numeric',
3100
+ minute: 'numeric',
3101
+ timeZone: useUTC ? undefined : 'America/Edmonton'
3102
+ }).replace('p.m.', 'PM').replace('a.m.', 'AM');
3103
+ };
3089
3104
 
3090
3105
  /**
3091
3106
  * Checks input controls data value to determine is required and has any data.
@@ -5737,6 +5752,8 @@ const GoABaseInputReviewComponent = props => {
5737
5752
  } = props;
5738
5753
  let reviewText = data;
5739
5754
  const isBoolean = typeof data === 'boolean';
5755
+ const isTime = (schema === null || schema === void 0 ? void 0 : schema.type) === 'string' && (schema === null || schema === void 0 ? void 0 : schema.format) === 'time';
5756
+ const isDateTime = (schema === null || schema === void 0 ? void 0 : schema.type) === 'string' && (schema === null || schema === void 0 ? void 0 : schema.format) === 'date-time';
5740
5757
  const getRequiredLabelText = () => {
5741
5758
  var _a, _b;
5742
5759
  let label = '';
@@ -5779,6 +5796,12 @@ const GoABaseInputReviewComponent = props => {
5779
5796
  }
5780
5797
  }
5781
5798
  }
5799
+ if (isTime) {
5800
+ reviewText = reviewText && to12HourFormat(reviewText);
5801
+ }
5802
+ if (isDateTime) {
5803
+ reviewText = reviewText && UTCToFullLocalTime(reviewText);
5804
+ }
5782
5805
  return jsxs("div", {
5783
5806
  style: {
5784
5807
  fontWeight: '400',
@@ -5848,16 +5871,14 @@ const GoAInputBaseTableReviewControl = withJsonFormsControlProps(GoAInputBaseTab
5848
5871
  let _$7 = t => t,
5849
5872
  _t$7;
5850
5873
  const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
5851
- return elements.map((child, index) => jsx("div", {
5852
- children: jsx(JsonFormsDispatch, {
5853
- uischema: child,
5854
- schema: schema,
5855
- path: path,
5856
- enabled: enabled,
5857
- renderers: renderers,
5858
- cells: cells
5859
- }, path)
5860
- }, index));
5874
+ return elements.map((child, index) => jsx(JsonFormsDispatch, {
5875
+ uischema: child,
5876
+ schema: schema,
5877
+ path: path,
5878
+ enabled: enabled,
5879
+ renderers: renderers,
5880
+ cells: cells
5881
+ }, `review-${path}_${index}`));
5861
5882
  };
5862
5883
  const withAjvProps = Component => function WithAjvProps(props) {
5863
5884
  const ctx = useJsonForms();
@@ -7172,7 +7193,7 @@ const ApplicationStatus = ({
7172
7193
 
7173
7194
  /* eslint-disable jsx-a11y/anchor-is-valid */
7174
7195
  const TableOfContents = props => {
7175
- var _a;
7196
+ var _a, _b;
7176
7197
  const testid = 'table-of-contents';
7177
7198
  return jsx(PageBorder, {
7178
7199
  children: jsxs("div", {
@@ -7185,8 +7206,8 @@ const TableOfContents = props => {
7185
7206
  children: props.subtitle
7186
7207
  }), jsx(GoATable, {
7187
7208
  width: "100%",
7188
- children: jsx("tbody", {
7189
- children: (_a = props.categories) === null || _a === void 0 ? void 0 : _a.map((category, index) => {
7209
+ children: jsxs("tbody", {
7210
+ children: [(_a = props.categories) === null || _a === void 0 ? void 0 : _a.map((category, index) => {
7190
7211
  return jsxs("tr", {
7191
7212
  children: [jsx(TocPageRef, {
7192
7213
  children: jsx("a", {
@@ -7202,7 +7223,28 @@ const TableOfContents = props => {
7202
7223
  children: getCategoryStatusBadge(category)
7203
7224
  })]
7204
7225
  });
7205
- })
7226
+ }), jsxs("tr", {
7227
+ children: [jsx(TocPageRef, {
7228
+ children: jsx("a", {
7229
+ "data-testid": `page-ref-${(_b = props.categories) === null || _b === void 0 ? void 0 : _b.length}`,
7230
+ href: "#",
7231
+ onClick: e => {
7232
+ var _a;
7233
+ e.preventDefault();
7234
+ props.onClick((_a = props.categories) === null || _a === void 0 ? void 0 : _a.length);
7235
+ },
7236
+ children: jsx("b", {
7237
+ children: "Summary"
7238
+ })
7239
+ })
7240
+ }), jsxs(CategoryStatus, {
7241
+ children: [jsx(GoABadge, {
7242
+ type: props.isValid ? 'success' : 'information',
7243
+ content: props.isValid ? 'Completed' : 'Incomplete',
7244
+ ariaLabel: props.isValid ? 'Completed' : 'Incomplete'
7245
+ }), props.isValid]
7246
+ })]
7247
+ })]
7206
7248
  })
7207
7249
  })]
7208
7250
  })
@@ -7448,7 +7490,8 @@ const FormPagesView = props => {
7448
7490
  } = formStepperCtx;
7449
7491
  const {
7450
7492
  categories,
7451
- activeId
7493
+ activeId,
7494
+ isValid
7452
7495
  } = formStepperCtx.selectStepperState();
7453
7496
  useEffect(() => {
7454
7497
  validatePage(activeId);
@@ -7478,7 +7521,8 @@ const FormPagesView = props => {
7478
7521
  categories,
7479
7522
  onClick: handleGoToPage,
7480
7523
  title: (_b = (_a = props.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.title,
7481
- subtitle: (_d = (_c = props.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.subtitle
7524
+ subtitle: (_d = (_c = props.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.subtitle,
7525
+ isValid: isValid
7482
7526
  };
7483
7527
  return jsx(TableOfContents, Object.assign({}, tocProps));
7484
7528
  } else {
@@ -10369,6 +10413,7 @@ const FullNameControlReview = props => {
10369
10413
  mb: "m",
10370
10414
  children: [jsx(GoAFormItem, {
10371
10415
  label: "First name",
10416
+ requirement: "required",
10372
10417
  children: jsx(TextWrapDiv, {
10373
10418
  children: jsx("div", {
10374
10419
  "data-testid": `firstName-control-${props.id}`,
@@ -10385,6 +10430,7 @@ const FullNameControlReview = props => {
10385
10430
  })
10386
10431
  }), jsx(GoAFormItem, {
10387
10432
  label: "Last name",
10433
+ requirement: "required",
10388
10434
  children: jsx(TextWrapDiv, {
10389
10435
  children: jsx("div", {
10390
10436
  "data-testid": `lastName-control-${props.id}`,
@@ -10543,6 +10589,7 @@ const FullNameDobReviewControl = props => {
10543
10589
  mb: "m",
10544
10590
  children: [jsx(GoAFormItem, {
10545
10591
  label: "First name",
10592
+ requirement: "required",
10546
10593
  children: jsx(TextWrapDiv, {
10547
10594
  children: jsx("div", {
10548
10595
  "data-testid": `firstName-control-${props.id}`,
@@ -10559,6 +10606,7 @@ const FullNameDobReviewControl = props => {
10559
10606
  })
10560
10607
  }), jsx(GoAFormItem, {
10561
10608
  label: "Last name",
10609
+ requirement: "required",
10562
10610
  children: jsx(TextWrapDiv, {
10563
10611
  children: jsx("div", {
10564
10612
  "data-testid": `lastName-control-${props.id}`,
@@ -10571,6 +10619,7 @@ const FullNameDobReviewControl = props => {
10571
10619
  gap: "s",
10572
10620
  children: jsx(GoAFormItem, {
10573
10621
  label: "Date of birth",
10622
+ requirement: "required",
10574
10623
  children: jsx(TextWrapDiv, {
10575
10624
  children: jsx("div", {
10576
10625
  "data-testid": `dob-control-${props.id}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.3.6",
3
+ "version": "2.3.8",
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",
@@ -5,6 +5,7 @@ export interface TocProps {
5
5
  onClick: (id: number) => void;
6
6
  title: string | undefined;
7
7
  subtitle: string | undefined;
8
+ isValid: boolean;
8
9
  }
9
10
  export declare const TableOfContents: (props: TocProps) => JSX.Element;
10
11
  export declare const TableOfContentsTester: RankedTester;
@@ -1 +1,3 @@
1
1
  export declare const standardizeDate: (date: Date | string) => string | undefined;
2
+ export declare const to12HourFormat: (time24: string) => string;
3
+ export declare const UTCToFullLocalTime: (fullTime: string, useUTC?: boolean) => string;
@@ -2,3 +2,4 @@ export * from './inputControlUtils';
2
2
  export * from './style-component';
3
3
  export * from './type';
4
4
  export * from './stringUtils';
5
+ export * from './dateUtils';