@abgov/jsonforms-components 1.44.1 → 1.44.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
@@ -2767,6 +2767,23 @@ const convertToReadableFormat = input => {
2767
2767
  }
2768
2768
  return input.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ');
2769
2769
  };
2770
+ /**
2771
+ * Converts a input to sentence case (eg: incomeThresholdExample or IncomeThresholdExample)
2772
+ * to 'Income threshold example' with the first letter in the sentence capitalized.
2773
+ *
2774
+ * @param input - The camelCase or PascalCase string (e.g., "incomeThresholdExample").
2775
+ * @returns A formatted string with spaces and capitalization (e.g., "Income threshold example").
2776
+ */
2777
+ const convertToSentenceCase = input => {
2778
+ if (!input) {
2779
+ return input;
2780
+ }
2781
+ const convertedInput = convertToReadableFormat(input);
2782
+ if (!convertedInput) return convertedInput;
2783
+ const firstWord = convertedInput.split(' ').splice(0, 1);
2784
+ const newWords = convertedInput.split(' ').splice(1).map(word => word.charAt(0).toLowerCase() + word.slice(1).toLowerCase()).join(' ');
2785
+ return firstWord.concat(newWords).join(' ');
2786
+ };
2770
2787
 
2771
2788
  const StepperContext = /*#__PURE__*/createContext({
2772
2789
  updateStatus: status => {},
@@ -5333,8 +5350,8 @@ let _$5 = t => t,
5333
5350
  _t2$3,
5334
5351
  _t3$3,
5335
5352
  _t4$2,
5336
- _t5$1,
5337
- _t6$1,
5353
+ _t5$2,
5354
+ _t6$2,
5338
5355
  _t7$1,
5339
5356
  _t8$1,
5340
5357
  _t9$1,
@@ -5369,7 +5386,7 @@ const ReviewItemTitle = styled.div(_t4$2 || (_t4$2 = _$5`
5369
5386
  line-height: var(--goa-space-xl);
5370
5387
  font-weight: 300;
5371
5388
  `));
5372
- const Anchor = styled.div(_t5$1 || (_t5$1 = _$5`
5389
+ const Anchor = styled.div(_t5$2 || (_t5$2 = _$5`
5373
5390
  color: #0070c4;
5374
5391
  text-decoration: underline;
5375
5392
  outline: none;
@@ -5380,7 +5397,7 @@ const Anchor = styled.div(_t5$1 || (_t5$1 = _$5`
5380
5397
  background-color: #e6f7ff;
5381
5398
  }
5382
5399
  `));
5383
- styled.div(_t6$1 || (_t6$1 = _$5`
5400
+ styled.div(_t6$2 || (_t6$2 = _$5`
5384
5401
  margin-left: var(--goa-space-m);
5385
5402
  `));
5386
5403
  styled.div(_t7$1 || (_t7$1 = _$5`
@@ -6392,15 +6409,16 @@ let _$2 = t => t,
6392
6409
  _t2$1,
6393
6410
  _t3$1,
6394
6411
  _t4$1,
6395
- _t5,
6396
- _t6,
6412
+ _t5$1,
6413
+ _t6$1,
6397
6414
  _t7,
6398
6415
  _t8,
6399
6416
  _t9,
6400
6417
  _t10,
6401
6418
  _t11,
6402
6419
  _t12,
6403
- _t13;
6420
+ _t13,
6421
+ _t14;
6404
6422
  const DeleteDialogContent = styled.div(_t$2 || (_t$2 = _$2`
6405
6423
  margin-bottom: var(--goa-space-m);
6406
6424
  `));
@@ -6415,10 +6433,10 @@ const ToolBarHeader = styled.div(_t3$1 || (_t3$1 = _$2`
6415
6433
  const ObjectArrayTitle = styled.h2(_t4$1 || (_t4$1 = _$2`
6416
6434
  margin-bottom: var(--goa-space-l);
6417
6435
  `));
6418
- const TextCenter = styled.div(_t5 || (_t5 = _$2`
6436
+ const TextCenter = styled.div(_t5$1 || (_t5$1 = _$2`
6419
6437
  text-align: center;
6420
6438
  `));
6421
- const SideMenuItem = styled.div(_t6 || (_t6 = _$2`
6439
+ const SideMenuItem = styled.div(_t6$1 || (_t6$1 = _$2`
6422
6440
  &:hover {
6423
6441
  background: #f1f1f1;
6424
6442
  }
@@ -6455,6 +6473,9 @@ const ListContainer = styled.div(_t13 || (_t13 = _$2`
6455
6473
  padding: 0 1.5rem 0 0;
6456
6474
  border: 1px solid #dcdcdc;
6457
6475
  `));
6476
+ const TableTHHeader = styled.th(_t14 || (_t14 = _$2`
6477
+ background-color: var(--goa-color-greyscale-100) !important;
6478
+ `));
6458
6479
 
6459
6480
  const DeleteDialog = /*#__PURE__*/React.memo(function DeleteDialog({
6460
6481
  open,
@@ -6783,9 +6804,16 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
6783
6804
  children: [jsx("thead", {
6784
6805
  children: jsxs("tr", {
6785
6806
  children: [Object.keys(properties).map((key, index) => {
6786
- return jsx("th", {
6807
+ if (!isInReview) {
6808
+ return jsx("th", {
6809
+ children: jsx("p", {
6810
+ children: convertToSentenceCase(key)
6811
+ })
6812
+ }, index);
6813
+ }
6814
+ return jsx(TableTHHeader, {
6787
6815
  children: jsx("p", {
6788
- children: key
6816
+ children: convertToSentenceCase(key)
6789
6817
  })
6790
6818
  }, index);
6791
6819
  }), isInReview !== true && jsx("th", {
@@ -7546,7 +7574,9 @@ let _$1 = t => t,
7546
7574
  _t$1,
7547
7575
  _t2,
7548
7576
  _t3,
7549
- _t4;
7577
+ _t4,
7578
+ _t5,
7579
+ _t6;
7550
7580
  const SearchBox = styled.div(_t$1 || (_t$1 = _$1`
7551
7581
  position: relative;
7552
7582
 
@@ -7592,13 +7622,23 @@ const SearchBox = styled.div(_t$1 || (_t$1 = _$1`
7592
7622
  `));
7593
7623
  const AddressIndent = styled.div(_t2 || (_t2 = _$1`
7594
7624
  margin: 1em 1.5em 0 1.5em;
7625
+ textwrap: 'wrap';
7626
+ wordbreak: 'break-word';
7627
+ `));
7628
+ const TextWrap = styled.p(_t3 || (_t3 = _$1`
7629
+ text-wrap: auto;
7630
+ word-break: break-word;
7595
7631
  `));
7596
- const LabelDiv = styled.div(_t3 || (_t3 = _$1`
7632
+ const TextWrapDiv = styled.div(_t4 || (_t4 = _$1`
7633
+ text-wrap: auto;
7634
+ word-break: break-word;
7635
+ `));
7636
+ const LabelDiv = styled.div(_t5 || (_t5 = _$1`
7597
7637
  font-size: var(--goa-font-size-2);
7598
7638
  padding-bottom: var(--goa-space-l);
7599
7639
  `));
7600
7640
  /* istanbul ignore next */
7601
- const ListItem = styled.li(_t4 || (_t4 = _$1`
7641
+ const ListItem = styled.li(_t6 || (_t6 = _$1`
7602
7642
  background-color: ${0};
7603
7643
  color: ${0};
7604
7644
  font-weight: ${0};
@@ -8295,12 +8335,12 @@ const AddressViews = ({
8295
8335
  children: [jsx(GoAFormItem, {
8296
8336
  label: "Address line 1",
8297
8337
  error: ((_a = data === null || data === void 0 ? void 0 : data.addressLine1) === null || _a === void 0 ? void 0 : _a.length) === 0 ? 'addressLine1 is required' : '',
8298
- children: jsx("p", {
8338
+ children: jsx(TextWrap, {
8299
8339
  children: data === null || data === void 0 ? void 0 : data.addressLine1
8300
8340
  })
8301
8341
  }), (data === null || data === void 0 ? void 0 : data.addressLine2) && jsx(GoAFormItem, {
8302
8342
  label: "Address line 2",
8303
- children: jsx("p", {
8343
+ children: jsx(TextWrap, {
8304
8344
  children: data.addressLine2
8305
8345
  })
8306
8346
  })]
@@ -8310,13 +8350,13 @@ const AddressViews = ({
8310
8350
  children: [jsx(GoAFormItem, {
8311
8351
  error: ((_b = data === null || data === void 0 ? void 0 : data.municipality) === null || _b === void 0 ? void 0 : _b.length) === 0 ? 'city is required' : '',
8312
8352
  label: "City",
8313
- children: jsx("p", {
8353
+ children: jsx(TextWrap, {
8314
8354
  children: data === null || data === void 0 ? void 0 : data.municipality
8315
8355
  })
8316
8356
  }), jsx(GoAFormItem, {
8317
8357
  error: ((_c = data === null || data === void 0 ? void 0 : data.postalCode) === null || _c === void 0 ? void 0 : _c.length) === 0 ? 'postalCode is required' : '',
8318
8358
  label: "Postal Code",
8319
- children: jsx("p", {
8359
+ children: jsx(TextWrap, {
8320
8360
  children: data === null || data === void 0 ? void 0 : data.postalCode
8321
8361
  })
8322
8362
  })]
@@ -8488,23 +8528,29 @@ const FullNameReviewControl = props => {
8488
8528
  label: "First Name",
8489
8529
  requirement: (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('firstName')) ? 'required' : undefined,
8490
8530
  error: (_a = errors === null || errors === void 0 ? void 0 : errors['firstName']) !== null && _a !== void 0 ? _a : '',
8491
- children: jsx("div", {
8492
- "data-testid": `firstName-control-${props.id}`,
8493
- children: (_b = props.data) === null || _b === void 0 ? void 0 : _b.firstName
8531
+ children: jsx(TextWrapDiv, {
8532
+ children: jsx("div", {
8533
+ "data-testid": `firstName-control-${props.id}`,
8534
+ children: (_b = props.data) === null || _b === void 0 ? void 0 : _b.firstName
8535
+ })
8494
8536
  })
8495
8537
  }), jsx(GoAFormItem, {
8496
8538
  label: "Middle Name",
8497
- children: jsx("div", {
8498
- "data-testid": `middleName-control-${props.id}`,
8499
- children: (_c = props.data) === null || _c === void 0 ? void 0 : _c.middleName
8539
+ children: jsx(TextWrapDiv, {
8540
+ children: jsx("div", {
8541
+ "data-testid": `middleName-control-${props.id}`,
8542
+ children: (_c = props.data) === null || _c === void 0 ? void 0 : _c.middleName
8543
+ })
8500
8544
  })
8501
8545
  }), jsx(GoAFormItem, {
8502
8546
  label: "Last Name",
8503
8547
  requirement: (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('lastName')) ? 'required' : undefined,
8504
8548
  error: (_d = errors === null || errors === void 0 ? void 0 : errors['lastName']) !== null && _d !== void 0 ? _d : '',
8505
- children: jsx("div", {
8506
- "data-testid": `lastName-control-${props.id}`,
8507
- children: (_e = props.data) === null || _e === void 0 ? void 0 : _e.lastName
8549
+ children: jsx(TextWrapDiv, {
8550
+ children: jsx("div", {
8551
+ "data-testid": `lastName-control-${props.id}`,
8552
+ children: (_e = props.data) === null || _e === void 0 ? void 0 : _e.lastName
8553
+ })
8508
8554
  })
8509
8555
  })]
8510
8556
  });
@@ -8730,15 +8776,19 @@ const FullNameDobReviewControl = props => {
8730
8776
  label: "First name",
8731
8777
  requirement: (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('firstName')) ? 'required' : undefined,
8732
8778
  error: (_a = errors === null || errors === void 0 ? void 0 : errors['firstName']) !== null && _a !== void 0 ? _a : '',
8733
- children: jsx("div", {
8734
- "data-testid": `firstName-control-${props.id}`,
8735
- children: (_b = props.data) === null || _b === void 0 ? void 0 : _b.firstName
8779
+ children: jsx(TextWrapDiv, {
8780
+ children: jsx("div", {
8781
+ "data-testid": `firstName-control-${props.id}`,
8782
+ children: (_b = props.data) === null || _b === void 0 ? void 0 : _b.firstName
8783
+ })
8736
8784
  })
8737
8785
  }), jsx(GoAFormItem, {
8738
8786
  label: "Middle name",
8739
- children: jsx("div", {
8740
- "data-testid": `middleName-control-${props.id}`,
8741
- children: (_c = props.data) === null || _c === void 0 ? void 0 : _c.middleName
8787
+ children: jsx(TextWrapDiv, {
8788
+ children: jsx("div", {
8789
+ "data-testid": `middleName-control-${props.id}`,
8790
+ children: (_c = props.data) === null || _c === void 0 ? void 0 : _c.middleName
8791
+ })
8742
8792
  })
8743
8793
  }), jsx(GoAFormItem, {
8744
8794
  label: "Last name",
@@ -8756,9 +8806,11 @@ const FullNameDobReviewControl = props => {
8756
8806
  label: "Date of birth",
8757
8807
  requirement: (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('dateOfBirth')) ? 'required' : undefined,
8758
8808
  error: (_f = errors === null || errors === void 0 ? void 0 : errors['dateOfBirth']) !== null && _f !== void 0 ? _f : '',
8759
- children: jsx("div", {
8760
- "data-testid": `dob-control-${props.id}`,
8761
- children: (_g = props.data) === null || _g === void 0 ? void 0 : _g.dateOfBirth
8809
+ children: jsx(TextWrapDiv, {
8810
+ children: jsx("div", {
8811
+ "data-testid": `dob-control-${props.id}`,
8812
+ children: (_g = props.data) === null || _g === void 0 ? void 0 : _g.dateOfBirth
8813
+ })
8762
8814
  })
8763
8815
  })
8764
8816
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.44.1",
3
+ "version": "1.44.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",
@@ -5,6 +5,8 @@ interface ListItemProps {
5
5
  }
6
6
  export declare const SearchBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
7
  export declare const AddressIndent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
8
+ export declare const TextWrap: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
9
+ export declare const TextWrapDiv: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
8
10
  export declare const LabelDiv: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
9
11
  export declare const ListItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, ListItemProps>> & string;
10
12
  export {};
@@ -12,3 +12,4 @@ export declare const FlexForm: import("styled-components/dist/types").IStyledCom
12
12
  export declare const TabName: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
13
13
  export declare const Trash: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
14
14
  export declare const ListContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
15
+ export declare const TableTHHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, never>> & string;
@@ -48,3 +48,11 @@ export declare const getLastSegmentFromPointer: (pointer: string) => string;
48
48
  * @returns A formatted string with spaces and capitalization (e.g., "Income Threshold Example").
49
49
  */
50
50
  export declare const convertToReadableFormat: (input: string) => string;
51
+ /**
52
+ * Converts a input to sentence case (eg: incomeThresholdExample or IncomeThresholdExample)
53
+ * to 'Income threshold example' with the first letter in the sentence capitalized.
54
+ *
55
+ * @param input - The camelCase or PascalCase string (e.g., "incomeThresholdExample").
56
+ * @returns A formatted string with spaces and capitalization (e.g., "Income threshold example").
57
+ */
58
+ export declare const convertToSentenceCase: (input: string) => string;