@abgov/jsonforms-components 2.3.7 → 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',
@@ -7170,7 +7193,7 @@ const ApplicationStatus = ({
7170
7193
 
7171
7194
  /* eslint-disable jsx-a11y/anchor-is-valid */
7172
7195
  const TableOfContents = props => {
7173
- var _a;
7196
+ var _a, _b;
7174
7197
  const testid = 'table-of-contents';
7175
7198
  return jsx(PageBorder, {
7176
7199
  children: jsxs("div", {
@@ -7183,8 +7206,8 @@ const TableOfContents = props => {
7183
7206
  children: props.subtitle
7184
7207
  }), jsx(GoATable, {
7185
7208
  width: "100%",
7186
- children: jsx("tbody", {
7187
- 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) => {
7188
7211
  return jsxs("tr", {
7189
7212
  children: [jsx(TocPageRef, {
7190
7213
  children: jsx("a", {
@@ -7200,7 +7223,28 @@ const TableOfContents = props => {
7200
7223
  children: getCategoryStatusBadge(category)
7201
7224
  })]
7202
7225
  });
7203
- })
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
+ })]
7204
7248
  })
7205
7249
  })]
7206
7250
  })
@@ -7446,7 +7490,8 @@ const FormPagesView = props => {
7446
7490
  } = formStepperCtx;
7447
7491
  const {
7448
7492
  categories,
7449
- activeId
7493
+ activeId,
7494
+ isValid
7450
7495
  } = formStepperCtx.selectStepperState();
7451
7496
  useEffect(() => {
7452
7497
  validatePage(activeId);
@@ -7476,7 +7521,8 @@ const FormPagesView = props => {
7476
7521
  categories,
7477
7522
  onClick: handleGoToPage,
7478
7523
  title: (_b = (_a = props.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.title,
7479
- 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
7480
7526
  };
7481
7527
  return jsx(TableOfContents, Object.assign({}, tocProps));
7482
7528
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.3.7",
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';