@dxc-technology/halstack-react 0.0.0-1b3d457 → 0.0.0-1b8b460

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.
Files changed (80) hide show
  1. package/HalstackContext.js +7 -8
  2. package/accordion/types.d.ts +1 -0
  3. package/accordion-group/types.d.ts +1 -0
  4. package/box/types.d.ts +1 -0
  5. package/card/types.d.ts +1 -0
  6. package/checkbox/Checkbox.d.ts +2 -2
  7. package/checkbox/Checkbox.js +16 -16
  8. package/checkbox/Checkbox.stories.tsx +79 -59
  9. package/checkbox/types.d.ts +4 -0
  10. package/common/variables.js +129 -125
  11. package/date-input/Calendar.d.ts +4 -0
  12. package/date-input/Calendar.js +258 -0
  13. package/date-input/DateInput.js +77 -222
  14. package/date-input/DateInput.stories.tsx +30 -17
  15. package/date-input/DateInput.test.js +411 -138
  16. package/date-input/DatePicker.d.ts +4 -0
  17. package/date-input/DatePicker.js +160 -0
  18. package/date-input/YearPicker.d.ts +4 -0
  19. package/date-input/YearPicker.js +115 -0
  20. package/date-input/types.d.ts +53 -0
  21. package/dialog/Dialog.js +4 -4
  22. package/dialog/Dialog.stories.tsx +56 -0
  23. package/dialog/types.d.ts +1 -0
  24. package/dropdown/Dropdown.js +37 -33
  25. package/dropdown/Dropdown.test.js +19 -25
  26. package/dropdown/DropdownMenuItem.js +1 -1
  27. package/file-input/FileInput.d.ts +2 -2
  28. package/file-input/FileInput.js +177 -219
  29. package/file-input/FileInput.stories.tsx +38 -10
  30. package/file-input/FileInput.test.js +53 -12
  31. package/file-input/FileItem.d.ts +4 -14
  32. package/file-input/FileItem.js +38 -63
  33. package/file-input/types.d.ts +17 -0
  34. package/flex/Flex.d.ts +1 -1
  35. package/flex/Flex.js +31 -19
  36. package/flex/types.d.ts +14 -3
  37. package/footer/types.d.ts +1 -0
  38. package/header/types.d.ts +1 -0
  39. package/link/Link.js +1 -1
  40. package/number-input/NumberInput.test.js +43 -7
  41. package/package.json +7 -12
  42. package/paginator/Paginator.js +2 -2
  43. package/paginator/Paginator.test.js +1 -1
  44. package/password-input/PasswordInput.test.js +13 -12
  45. package/quick-nav/QuickNav.js +11 -12
  46. package/quick-nav/QuickNav.stories.tsx +97 -19
  47. package/radio-group/Radio.d.ts +1 -1
  48. package/radio-group/Radio.js +43 -28
  49. package/radio-group/RadioGroup.js +15 -13
  50. package/radio-group/RadioGroup.stories.tsx +1 -0
  51. package/radio-group/RadioGroup.test.js +123 -96
  52. package/radio-group/types.d.ts +2 -2
  53. package/resultsetTable/Icons.d.ts +7 -0
  54. package/resultsetTable/Icons.js +51 -0
  55. package/resultsetTable/ResultsetTable.js +48 -107
  56. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  57. package/resultsetTable/ResultsetTable.test.js +23 -41
  58. package/resultsetTable/types.d.ts +2 -2
  59. package/select/Select.js +3 -1
  60. package/select/Select.stories.tsx +2 -5
  61. package/select/Select.test.js +267 -209
  62. package/slider/Slider.d.ts +2 -2
  63. package/slider/Slider.js +15 -11
  64. package/slider/types.d.ts +4 -0
  65. package/spinner/Spinner.js +2 -2
  66. package/switch/Switch.d.ts +3 -3
  67. package/switch/Switch.js +93 -82
  68. package/switch/Switch.test.js +26 -13
  69. package/switch/types.d.ts +6 -1
  70. package/table/Table.js +1 -1
  71. package/table/Table.test.js +1 -1
  72. package/tabs/Tabs.js +3 -3
  73. package/tabs/Tabs.stories.tsx +0 -1
  74. package/tabs-nav/Tab.js +1 -1
  75. package/text-input/Suggestion.js +32 -5
  76. package/text-input/TextInput.js +165 -151
  77. package/text-input/TextInput.stories.tsx +6 -1
  78. package/text-input/TextInput.test.js +658 -647
  79. package/text-input/types.d.ts +5 -0
  80. package/common/RequiredComponent.js +0 -32
@@ -408,7 +408,7 @@ var componentTokens = {
408
408
  pickerHoverDateBackgroundColor: globalTokens.hal_purple_l_90,
409
409
  pickerSelectedDateColor: globalTokens.hal_white,
410
410
  pickerSelectedDateBackgroundColor: globalTokens.hal_purple_s_38,
411
- pickerActualDateFontColor: globalTokens.hal_grey_l_60,
411
+ pickerActualDateFontColor: globalTokens.hal_black,
412
412
  pickerYearFontColor: globalTokens.hal_black,
413
413
  pickerMonthFontColor: globalTokens.hal_black,
414
414
  pickerWeekFontColor: globalTokens.hal_black,
@@ -416,7 +416,8 @@ var componentTokens = {
416
416
  pickerMonthArrowsBackgroundColor: globalTokens.transparent,
417
417
  pickerFocusColor: globalTokens.hal_blue_l_50,
418
418
  pickerHeight: "316px",
419
- pickerWidth: "290px"
419
+ // not referenced in the actual implementation
420
+ pickerWidth: "292px"
420
421
  },
421
422
  dialog: {
422
423
  overlayColor: globalTokens.hal_black,
@@ -633,99 +634,6 @@ var componentTokens = {
633
634
  level5LineHeight: globalTokens.type_leading_normal,
634
635
  level5LetterSpacing: globalTokens.type_spacing_wide_01
635
636
  },
636
- textInput: {
637
- fontFamily: globalTokens.type_sans,
638
- enabledBorderColor: globalTokens.hal_black,
639
- enabledBorderColorOnDark: globalTokens.hal_white,
640
- hoverBorderColor: globalTokens.hal_purple_l_65,
641
- hoverBorderColorOnDark: globalTokens.hal_purple_l_65,
642
- focusBorderColor: globalTokens.hal_blue_l_50,
643
- focusBorderColorOnDark: globalTokens.hal_blue_l_50,
644
- disabledBorderColor: globalTokens.hal_grey_l_60,
645
- disabledBorderColorOnDark: globalTokens.hal_grey_l_60,
646
- disabledContainerFillColor: globalTokens.hal_grey_l_95,
647
- disabledContainerFillColorOnDark: globalTokens.hal_grey_s_40,
648
- errorBorderColor: globalTokens.hal_red_s_41,
649
- errorBorderColorOnDark: globalTokens.hal_red_l_60,
650
- hoverErrorBorderColor: globalTokens.color_red_600,
651
- hoverErrorBorderColorOnDark: "#fe677b",
652
- inputMarginTop: globalTokens.spacing_02,
653
- inputMarginBottom: globalTokens.spacing_02,
654
- errorMessageColor: globalTokens.hal_red_s_41,
655
- errorMessageColorOnDark: globalTokens.hal_red_l_60,
656
- errorIconColor: globalTokens.hal_red_s_41,
657
- errorIconColorOnDark: globalTokens.hal_red_l_60,
658
- labelFontColor: globalTokens.hal_black,
659
- labelFontColorOnDark: globalTokens.hal_white,
660
- labelFontSize: globalTokens.type_scale_02,
661
- labelFontStyle: globalTokens.type_normal,
662
- labelFontWeight: globalTokens.type_semibold,
663
- labelLineHeight: globalTokens.type_leading_loose_01,
664
- disabledLabelFontColor: globalTokens.hal_grey_l_60,
665
- disabledLabelFontColorOnDark: globalTokens.hal_grey_l_60,
666
- optionalLabelFontWeight: globalTokens.type_regular,
667
- helperTextFontColor: globalTokens.hal_black,
668
- helperTextFontColorOnDark: globalTokens.hal_white,
669
- helperTextFontSize: globalTokens.type_scale_01,
670
- helperTextFontStyle: globalTokens.type_normal,
671
- helperTextFontWeight: globalTokens.type_regular,
672
- helperTextLineHeight: globalTokens.type_leading_normal,
673
- disabledHelperTextFontColor: globalTokens.hal_grey_l_60,
674
- disabledHelperTextFontColorOnDark: globalTokens.hal_grey_l_60,
675
- prefixColor: globalTokens.hal_grey_s_40,
676
- prefixColorOnDark: globalTokens.hal_white,
677
- suffixColor: globalTokens.hal_grey_s_40,
678
- suffixColorOnDark: globalTokens.hal_white,
679
- disabledPrefixColor: globalTokens.hal_grey_l_75,
680
- disabledSuffixColor: globalTokens.hal_grey_l_75,
681
- disabledPrefixColorOnDark: globalTokens.hal_grey_l_60,
682
- disabledSuffixColorOnDark: globalTokens.hal_grey_l_60,
683
- placeholderFontColor: "#000000b3",
684
- placeholderFontColorOnDark: globalTokens.hal_grey_l_95,
685
- disabledPlaceholderFontColor: globalTokens.hal_grey_l_60,
686
- disabledPlaceholderFontColorOnDark: globalTokens.hal_grey_l_60,
687
- valueFontColor: globalTokens.hal_black,
688
- valueFontColorOnDark: globalTokens.hal_white,
689
- valueFontSize: globalTokens.type_scale_03,
690
- valueFontStyle: globalTokens.type_normal,
691
- valueFontWeight: globalTokens.type_regular,
692
- disabledValueFontColor: globalTokens.hal_grey_l_60,
693
- disabledValueFontColorOnDark: globalTokens.hal_grey_l_60,
694
- actionIconColor: globalTokens.hal_black,
695
- actionIconColorOnDark: globalTokens.hal_white,
696
- disabledActionIconColor: globalTokens.hal_grey_l_60,
697
- disabledActionIconColorOnDark: globalTokens.hal_grey_l_60,
698
- hoverActionIconColor: globalTokens.hal_black,
699
- hoverActionIconColorOnDark: globalTokens.hal_white,
700
- focusActionIconColor: globalTokens.hal_black,
701
- focusActionIconColorOnDark: globalTokens.hal_white,
702
- activeActionIconColor: globalTokens.hal_black,
703
- activeActionIconColorOnDark: globalTokens.hal_black,
704
- actionBackgroundColor: globalTokens.transparent,
705
- actionBackgroundColorOnDark: globalTokens.transparent,
706
- disabledActionBackgroundColor: globalTokens.transparent,
707
- disabledActionBackgroundColorOnDark: globalTokens.transparent,
708
- hoverActionBackgroundColor: globalTokens.hal_grey_l_95,
709
- hoverActionBackgroundColorOnDark: globalTokens.hal_grey_s_40,
710
- focusActionBorderColor: globalTokens.hal_blue_l_50,
711
- focusActionBorderColorOnDark: globalTokens.hal_blue_l_50,
712
- activeActionBackgroundColor: globalTokens.hal_grey_l_80,
713
- activeActionBackgroundColorOnDark: globalTokens.hal_grey_l_60,
714
- listDialogBackgroundColor: globalTokens.hal_white,
715
- listDialogBorderColor: globalTokens.hal_grey_l_75,
716
- listOptionDividerColor: globalTokens.hal_grey_l_90,
717
- listOptionFontColor: globalTokens.hal_black,
718
- listOptionFontSize: globalTokens.type_scale_02,
719
- listOptionFontStyle: globalTokens.type_normal,
720
- listOptionFontWeight: globalTokens.type_regular,
721
- systemMessageFontColor: globalTokens.hal_grey_s_40,
722
- errorListDialogFontColor: globalTokens.hal_black,
723
- errorListDialogBackgroundColor: globalTokens.color_red_50,
724
- errorListDialogBorderColor: globalTokens.hal_red_s_41,
725
- hoverListOptionBackgroundColor: globalTokens.hal_grey_l_95,
726
- activeListOptionBackgroundColor: globalTokens.hal_grey_l_80,
727
- focusListOptionBorderColor: globalTokens.hal_blue_l_50
728
- },
729
637
  link: {
730
638
  fontColor: globalTokens.hal_blue_s_35,
731
639
  fontFamily: globalTokens.inherit,
@@ -763,13 +671,13 @@ var componentTokens = {
763
671
  fontTextTransform: "none",
764
672
  verticalPadding: "0.75rem",
765
673
  horizontalPadding: "2rem",
766
- marginRight: "2rem",
767
- marginLeft: "2rem",
674
+ marginRight: "40px",
675
+ marginLeft: "20px",
768
676
  itemsPerPageSelectorMarginLeft: "0px",
769
- itemsPerPageSelectorMarginRight: "1rem",
677
+ itemsPerPageSelectorMarginRight: "0.5rem",
770
678
  pageSelectorMarginRight: "30px",
771
679
  pageSelectorMarginLeft: "0px",
772
- totalItemsContainerMarginRight: "3rem",
680
+ totalItemsContainerMarginRight: "2.5rem",
773
681
  totalItemsContainerMarginLeft: "0px"
774
682
  },
775
683
  progressBar: {
@@ -804,7 +712,6 @@ var componentTokens = {
804
712
  quickNav: {
805
713
  fontColor: globalTokens.hal_grey_s_40,
806
714
  hoverFontColor: globalTokens.hal_purple_d_70,
807
- selectedFontColor: globalTokens.hal_purple_s_38,
808
715
  dividerBorderColor: globalTokens.hal_grey_l_75,
809
716
  focusBorderColor: globalTokens.hal_blue_l_50,
810
717
  focusBorderStyle: globalTokens.border_solid,
@@ -1025,7 +932,7 @@ var componentTokens = {
1025
932
  trackLineColorOnDark: globalTokens.hal_blue_l_50,
1026
933
  totalLineThickness: "2px",
1027
934
  totalLineVerticalPosition: "50%",
1028
- totalLineColor: globalTokens.hal_grey_l_90,
935
+ totalLineColor: "#0000001a",
1029
936
  totalLineColorOnDark: globalTokens.hal_grey_l_75,
1030
937
  disabledThumbVerticalPosition: "10px",
1031
938
  disabledThumbBackgroundColor: globalTokens.hal_grey_l_60,
@@ -1111,23 +1018,6 @@ var componentTokens = {
1111
1018
  trackWidth: "36px",
1112
1019
  spaceBetweenLabelSwitch: "8px"
1113
1020
  },
1114
- tag: {
1115
- fontFamily: globalTokens.type_sans,
1116
- fontColor: globalTokens.hal_black,
1117
- fontSize: globalTokens.type_scale_02,
1118
- fontStyle: globalTokens.type_normal,
1119
- fontWeight: globalTokens.type_regular,
1120
- labelPaddingTop: "0px",
1121
- labelPaddingBottom: "0px",
1122
- labelPaddingLeft: "16px",
1123
- labelPaddingRight: "16px",
1124
- height: "40px",
1125
- iconColor: globalTokens.hal_white,
1126
- iconSectionWidth: "40px",
1127
- iconHeight: "24px",
1128
- iconWidth: "auto",
1129
- focusColor: globalTokens.hal_blue_l_50
1130
- },
1131
1021
  table: {
1132
1022
  rowSeparatorThickness: "1px",
1133
1023
  rowSeparatorStyle: "solid",
@@ -1202,6 +1092,23 @@ var componentTokens = {
1202
1092
  badgeHeightWithNotificationNumber: "17px",
1203
1093
  badgeRadiusWithNotificationNumber: "10px"
1204
1094
  },
1095
+ tag: {
1096
+ fontFamily: globalTokens.type_sans,
1097
+ fontColor: globalTokens.hal_black,
1098
+ fontSize: globalTokens.type_scale_02,
1099
+ fontStyle: globalTokens.type_normal,
1100
+ fontWeight: globalTokens.type_regular,
1101
+ labelPaddingTop: "0px",
1102
+ labelPaddingBottom: "0px",
1103
+ labelPaddingLeft: "16px",
1104
+ labelPaddingRight: "16px",
1105
+ height: "40px",
1106
+ iconColor: globalTokens.hal_white,
1107
+ iconSectionWidth: "40px",
1108
+ iconHeight: "24px",
1109
+ iconWidth: "auto",
1110
+ focusColor: globalTokens.hal_blue_l_50
1111
+ },
1205
1112
  textarea: {
1206
1113
  fontFamily: globalTokens.type_sans,
1207
1114
  enabledBorderColor: globalTokens.hal_black,
@@ -1251,6 +1158,99 @@ var componentTokens = {
1251
1158
  disabledValueFontColor: globalTokens.hal_grey_l_60,
1252
1159
  disabledValueFontColorOnDark: globalTokens.hal_grey_l_60
1253
1160
  },
1161
+ textInput: {
1162
+ fontFamily: globalTokens.type_sans,
1163
+ enabledBorderColor: globalTokens.hal_black,
1164
+ enabledBorderColorOnDark: globalTokens.hal_white,
1165
+ hoverBorderColor: globalTokens.hal_purple_l_65,
1166
+ hoverBorderColorOnDark: globalTokens.hal_purple_l_65,
1167
+ focusBorderColor: globalTokens.hal_blue_l_50,
1168
+ focusBorderColorOnDark: globalTokens.hal_blue_l_50,
1169
+ disabledBorderColor: globalTokens.hal_grey_l_60,
1170
+ disabledBorderColorOnDark: globalTokens.hal_grey_l_60,
1171
+ disabledContainerFillColor: globalTokens.hal_grey_l_95,
1172
+ disabledContainerFillColorOnDark: globalTokens.hal_grey_s_40,
1173
+ errorBorderColor: globalTokens.hal_red_s_41,
1174
+ errorBorderColorOnDark: globalTokens.hal_red_l_60,
1175
+ hoverErrorBorderColor: globalTokens.color_red_600,
1176
+ hoverErrorBorderColorOnDark: "#fe677b",
1177
+ inputMarginTop: globalTokens.spacing_02,
1178
+ inputMarginBottom: globalTokens.spacing_02,
1179
+ errorMessageColor: globalTokens.hal_red_s_41,
1180
+ errorMessageColorOnDark: globalTokens.hal_red_l_60,
1181
+ errorIconColor: globalTokens.hal_red_s_41,
1182
+ errorIconColorOnDark: globalTokens.hal_red_l_60,
1183
+ labelFontColor: globalTokens.hal_black,
1184
+ labelFontColorOnDark: globalTokens.hal_white,
1185
+ labelFontSize: globalTokens.type_scale_02,
1186
+ labelFontStyle: globalTokens.type_normal,
1187
+ labelFontWeight: globalTokens.type_semibold,
1188
+ labelLineHeight: globalTokens.type_leading_loose_01,
1189
+ disabledLabelFontColor: globalTokens.hal_grey_l_60,
1190
+ disabledLabelFontColorOnDark: globalTokens.hal_grey_l_60,
1191
+ optionalLabelFontWeight: globalTokens.type_regular,
1192
+ helperTextFontColor: globalTokens.hal_black,
1193
+ helperTextFontColorOnDark: globalTokens.hal_white,
1194
+ helperTextFontSize: globalTokens.type_scale_01,
1195
+ helperTextFontStyle: globalTokens.type_normal,
1196
+ helperTextFontWeight: globalTokens.type_regular,
1197
+ helperTextLineHeight: globalTokens.type_leading_normal,
1198
+ disabledHelperTextFontColor: globalTokens.hal_grey_l_60,
1199
+ disabledHelperTextFontColorOnDark: globalTokens.hal_grey_l_60,
1200
+ prefixColor: globalTokens.hal_grey_s_40,
1201
+ prefixColorOnDark: globalTokens.hal_white,
1202
+ suffixColor: globalTokens.hal_grey_s_40,
1203
+ suffixColorOnDark: globalTokens.hal_white,
1204
+ disabledPrefixColor: globalTokens.hal_grey_l_75,
1205
+ disabledSuffixColor: globalTokens.hal_grey_l_75,
1206
+ disabledPrefixColorOnDark: globalTokens.hal_grey_l_60,
1207
+ disabledSuffixColorOnDark: globalTokens.hal_grey_l_60,
1208
+ placeholderFontColor: "#000000b3",
1209
+ placeholderFontColorOnDark: globalTokens.hal_grey_l_95,
1210
+ disabledPlaceholderFontColor: globalTokens.hal_grey_l_60,
1211
+ disabledPlaceholderFontColorOnDark: globalTokens.hal_grey_l_60,
1212
+ valueFontColor: globalTokens.hal_black,
1213
+ valueFontColorOnDark: globalTokens.hal_white,
1214
+ valueFontSize: globalTokens.type_scale_03,
1215
+ valueFontStyle: globalTokens.type_normal,
1216
+ valueFontWeight: globalTokens.type_regular,
1217
+ disabledValueFontColor: globalTokens.hal_grey_l_60,
1218
+ disabledValueFontColorOnDark: globalTokens.hal_grey_l_60,
1219
+ actionIconColor: globalTokens.hal_black,
1220
+ actionIconColorOnDark: globalTokens.hal_white,
1221
+ disabledActionIconColor: globalTokens.hal_grey_l_60,
1222
+ disabledActionIconColorOnDark: globalTokens.hal_grey_l_60,
1223
+ hoverActionIconColor: globalTokens.hal_black,
1224
+ hoverActionIconColorOnDark: globalTokens.hal_white,
1225
+ focusActionIconColor: globalTokens.hal_black,
1226
+ focusActionIconColorOnDark: globalTokens.hal_white,
1227
+ activeActionIconColor: globalTokens.hal_black,
1228
+ activeActionIconColorOnDark: globalTokens.hal_black,
1229
+ actionBackgroundColor: globalTokens.transparent,
1230
+ actionBackgroundColorOnDark: globalTokens.transparent,
1231
+ disabledActionBackgroundColor: globalTokens.transparent,
1232
+ disabledActionBackgroundColorOnDark: globalTokens.transparent,
1233
+ hoverActionBackgroundColor: globalTokens.hal_grey_l_95,
1234
+ hoverActionBackgroundColorOnDark: globalTokens.hal_grey_s_40,
1235
+ focusActionBorderColor: globalTokens.hal_blue_l_50,
1236
+ focusActionBorderColorOnDark: globalTokens.hal_blue_l_50,
1237
+ activeActionBackgroundColor: globalTokens.hal_grey_l_80,
1238
+ activeActionBackgroundColorOnDark: globalTokens.hal_grey_l_60,
1239
+ listDialogBackgroundColor: globalTokens.hal_white,
1240
+ listDialogBorderColor: globalTokens.hal_grey_l_75,
1241
+ listOptionDividerColor: globalTokens.hal_grey_l_90,
1242
+ listOptionFontColor: globalTokens.hal_black,
1243
+ listOptionFontSize: globalTokens.type_scale_02,
1244
+ listOptionFontStyle: globalTokens.type_normal,
1245
+ listOptionFontWeight: globalTokens.type_regular,
1246
+ systemMessageFontColor: globalTokens.hal_grey_s_40,
1247
+ errorListDialogFontColor: globalTokens.hal_black,
1248
+ errorListDialogBackgroundColor: globalTokens.color_red_50,
1249
+ errorListDialogBorderColor: globalTokens.hal_red_s_41,
1250
+ hoverListOptionBackgroundColor: globalTokens.hal_grey_l_95,
1251
+ activeListOptionBackgroundColor: globalTokens.hal_grey_l_80,
1252
+ focusListOptionBorderColor: globalTokens.hal_blue_l_50
1253
+ },
1254
1254
  toggleGroup: {
1255
1255
  containerBackgroundColor: globalTokens.color_grey_50,
1256
1256
  containerBorderColor: globalTokens.hal_grey_l_60,
@@ -1424,6 +1424,9 @@ var defaultTranslatedComponentLabels = {
1424
1424
  },
1425
1425
  logoAlternativeText: "Logo"
1426
1426
  },
1427
+ applicationLayout: {
1428
+ visibilityToggleTitle: "Toggle visibility sidenav"
1429
+ },
1427
1430
  alert: {
1428
1431
  infoTitleText: "information",
1429
1432
  successTitleText: "success",
@@ -1440,7 +1443,8 @@ var defaultTranslatedComponentLabels = {
1440
1443
  singleButtonLabelDefault: "Select file",
1441
1444
  dropAreaButtonLabelDefault: "Select",
1442
1445
  multipleDropAreaLabelDefault: "or drop files",
1443
- singleDropAreaLabelDefault: "or drop a file"
1446
+ singleDropAreaLabelDefault: "or drop a file",
1447
+ deleteFileActionTitle: "Remove file"
1444
1448
  },
1445
1449
  footer: {
1446
1450
  copyrightText: function copyrightText(year) {
@@ -1462,7 +1466,7 @@ var defaultTranslatedComponentLabels = {
1462
1466
  incrementValueTitle: "Increment value"
1463
1467
  },
1464
1468
  paginator: {
1465
- itemsPerPageText: "Items per page ",
1469
+ itemsPerPageText: "Items per page: ",
1466
1470
  minToMaxOfText: function minToMaxOfText(minNumberOfItems, maxNumberOfItems, totalItems) {
1467
1471
  return "".concat(minNumberOfItems, " to ").concat(maxNumberOfItems, " of ").concat(totalItems);
1468
1472
  },
@@ -1497,12 +1501,12 @@ var defaultTranslatedComponentLabels = {
1497
1501
  },
1498
1502
  calendar: {
1499
1503
  days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
1500
- daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1504
+ daysShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1501
1505
  months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
1502
- monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
1503
- },
1504
- applicationLayout: {
1505
- visibilityToggleTitle: "Toggle visibility sidenav"
1506
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
1507
+ previousMonthTitle: "Previous month",
1508
+ nextMonthTitle: "Next month",
1509
+ openCalendar: "Open calendar"
1506
1510
  }
1507
1511
  };
1508
1512
  exports.defaultTranslatedComponentLabels = defaultTranslatedComponentLabels;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { CalendarPropsType } from "./types";
3
+ declare const _default: React.MemoExoticComponent<({ selectedDate, innerDate, onInnerDateChange, onDaySelect }: CalendarPropsType) => JSX.Element>;
4
+ export default _default;
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
16
+ var _dayjs = _interopRequireDefault(require("dayjs"));
17
+
18
+ var _react = _interopRequireWildcard(require("react"));
19
+
20
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
21
+
22
+ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
23
+
24
+ var _main = require("../main");
25
+
26
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
27
+
28
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
+
30
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
+
32
+ var getDays = function getDays(innerDate) {
33
+ var monthDayCells = [];
34
+ var lastMonthNumberOfDays = innerDate.set("month", innerDate.get("month") - 1).endOf("month");
35
+ var firstDayOfMonth = innerDate.startOf("month").day() === 0 ? 6 : innerDate.startOf("month").day() - 1;
36
+ var daysInMonth = firstDayOfMonth + innerDate.daysInMonth();
37
+
38
+ for (var i = 0; i < 42; i++) {
39
+ if (i < firstDayOfMonth) {
40
+ monthDayCells.push({
41
+ day: lastMonthNumberOfDays.get("date") - firstDayOfMonth + i + 1,
42
+ month: innerDate.get("month") ? innerDate.get("month") - 1 : 11,
43
+ year: innerDate.set("month", innerDate.get("month") - 1).get("year")
44
+ });
45
+ } else if (i < daysInMonth) {
46
+ monthDayCells.push({
47
+ day: i - firstDayOfMonth + 1,
48
+ month: innerDate.get("month"),
49
+ year: innerDate.get("year")
50
+ });
51
+ } else {
52
+ monthDayCells.push({
53
+ day: i - daysInMonth + 1,
54
+ month: innerDate.get("month") === 11 ? 0 : innerDate.get("month") + 1,
55
+ year: innerDate.set("month", innerDate.get("month") + 1).get("year")
56
+ });
57
+ }
58
+ }
59
+
60
+ return monthDayCells;
61
+ };
62
+
63
+ var isDaySelected = function isDaySelected(date, selectedDate) {
64
+ return (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("month")) === date.month && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("year")) === date.year && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("date")) === date.day;
65
+ };
66
+
67
+ var Calendar = function Calendar(_ref) {
68
+ var selectedDate = _ref.selectedDate,
69
+ innerDate = _ref.innerDate,
70
+ onInnerDateChange = _ref.onInnerDateChange,
71
+ onDaySelect = _ref.onDaySelect;
72
+
73
+ var _useState = (0, _react.useState)((selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("month")) === innerDate.get("month") && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("year")) === innerDate.get("year") ? selectedDate : (0, _dayjs["default"])()),
74
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
75
+ dateToFocus = _useState2[0],
76
+ setDateToFocus = _useState2[1];
77
+
78
+ var _useState3 = (0, _react.useState)(false),
79
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
80
+ toFocus = _useState4[0],
81
+ setToFocus = _useState4[1];
82
+
83
+ var today = (0, _dayjs["default"])();
84
+ var dayCells = (0, _react.useMemo)(function () {
85
+ return getDays(innerDate);
86
+ }, [innerDate]);
87
+ var translatedLabels = (0, _useTranslatedLabels["default"])();
88
+ var weekDays = translatedLabels.calendar.daysShort;
89
+
90
+ var onDateClickHandler = function onDateClickHandler(date) {
91
+ var newDate = innerDate.set("month", date.month).set("date", date.day);
92
+ onDaySelect(newDate);
93
+ setDateToFocus(newDate);
94
+ };
95
+
96
+ var handleOnBlur = function handleOnBlur(event) {
97
+ if (!(event !== null && event !== void 0 && event.currentTarget.contains(event.relatedTarget))) {
98
+ updateDateToFocus();
99
+ }
100
+ };
101
+
102
+ var updateDateToFocus = function updateDateToFocus() {
103
+ if ((selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("month")) === innerDate.get("month") && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("year")) === innerDate.get("year")) {
104
+ setDateToFocus(selectedDate);
105
+ } else if (today.get("month") === innerDate.get("month") && today.get("year") === innerDate.get("year")) {
106
+ setDateToFocus(today);
107
+ } else {
108
+ setDateToFocus(innerDate.set("date", 1));
109
+ }
110
+ };
111
+
112
+ var focusDate = function focusDate(date) {
113
+ if (innerDate.get("month") !== date.get("month") || innerDate.get("year") !== date.get("year")) {
114
+ onInnerDateChange(date);
115
+ }
116
+
117
+ setDateToFocus(date);
118
+ setToFocus(true);
119
+ };
120
+
121
+ (0, _react.useEffect)(function () {
122
+ if (toFocus) {
123
+ var _document$getElementB;
124
+
125
+ (_document$getElementB = document.getElementById("day_".concat(dateToFocus.get("date"), "_month").concat(dateToFocus.get("month")))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.focus();
126
+ setToFocus(false);
127
+ }
128
+ }, [dateToFocus, toFocus]);
129
+ (0, _react.useEffect)(function () {
130
+ if (dateToFocus.get("month") !== innerDate.get("month") || dateToFocus.get("year") !== innerDate.get("year")) {
131
+ updateDateToFocus();
132
+ }
133
+ }, [innerDate, dateToFocus, selectedDate]);
134
+
135
+ var handleDayKeyboardEvent = function handleDayKeyboardEvent(event, date) {
136
+ var dateToFocusTemp = date.month === innerDate.get("month") ? innerDate.set("date", date.day) : innerDate.set("date", date.day).set("month", date.month);
137
+
138
+ switch (event.key) {
139
+ case "PageUp":
140
+ event.preventDefault();
141
+ event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") - 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") - 1);
142
+ focusDate(dateToFocusTemp);
143
+ break;
144
+
145
+ case "PageDown":
146
+ event.preventDefault();
147
+ event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") + 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") + 1);
148
+ focusDate(dateToFocusTemp);
149
+ break;
150
+
151
+ case "ArrowLeft":
152
+ event.preventDefault();
153
+ dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 1);
154
+ focusDate(dateToFocusTemp);
155
+ break;
156
+
157
+ case "ArrowRight":
158
+ event.preventDefault();
159
+ dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 1);
160
+ focusDate(dateToFocusTemp);
161
+ break;
162
+
163
+ case "ArrowUp":
164
+ event.preventDefault();
165
+ dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 7);
166
+ focusDate(dateToFocusTemp);
167
+ break;
168
+
169
+ case "ArrowDown":
170
+ event.preventDefault();
171
+ dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 7);
172
+ focusDate(dateToFocusTemp);
173
+ break;
174
+
175
+ case "Home":
176
+ event.preventDefault();
177
+ dateToFocus.get("day") !== 0 ? dateToFocusTemp = dateToFocusTemp.day(1) : dateToFocusTemp = innerDate.date(date.day - 1).day(1);
178
+ focusDate(dateToFocusTemp);
179
+ break;
180
+
181
+ case "End":
182
+ event.preventDefault();
183
+ dateToFocusTemp.get("day") !== 0 && (dateToFocusTemp = dateToFocusTemp.day(7));
184
+ focusDate(dateToFocusTemp);
185
+ break;
186
+
187
+ case " ":
188
+ event.preventDefault();
189
+ onDaySelect(dateToFocusTemp);
190
+ break;
191
+ }
192
+ };
193
+
194
+ return /*#__PURE__*/_react["default"].createElement(CalendarContainer, null, /*#__PURE__*/_react["default"].createElement(_main.DxcFlex, {
195
+ alignItems: "center",
196
+ justifyContent: "space-between"
197
+ }, weekDays.map(function (weekDay) {
198
+ return /*#__PURE__*/_react["default"].createElement(WeekHeaderCell, {
199
+ key: weekDay
200
+ }, weekDay);
201
+ })), /*#__PURE__*/_react["default"].createElement(DayCellsContainer, {
202
+ onBlur: handleOnBlur
203
+ }, dayCells.map(function (date, index) {
204
+ return date !== 0 ? /*#__PURE__*/_react["default"].createElement(DayCell, {
205
+ onKeyDown: function onKeyDown(event) {
206
+ return handleDayKeyboardEvent(event, date);
207
+ },
208
+ "aria-label": date.day,
209
+ id: "day_".concat(date.day, "_month").concat(date.month),
210
+ key: "day_".concat(index),
211
+ onClick: function onClick() {
212
+ return onDateClickHandler(date);
213
+ },
214
+ selected: isDaySelected(date, selectedDate),
215
+ actualMonth: date.month === innerDate.get("month"),
216
+ autoFocus: date.day === dateToFocus.get("date") && date.month === dateToFocus.get("month"),
217
+ "aria-selected": isDaySelected(date, selectedDate),
218
+ tabIndex: date.day === dateToFocus.get("date") && date.month === dateToFocus.get("month") ? 0 : -1,
219
+ isCurrentDay: today.get("date") === date.day && today.get("month") === innerDate.get("month") && today.get("month") === date.month && today.get("year") === innerDate.get("year")
220
+ }, date.day) : /*#__PURE__*/_react["default"].createElement(EmptyDayCell, {
221
+ key: "empty_".concat(index)
222
+ });
223
+ })));
224
+ };
225
+
226
+ var CalendarContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0px 8px 8px 8px;\n width: ", ";\n"])), function (props) {
227
+ return props.theme.dateInput.pickerWidth;
228
+ });
229
+
230
+ var WeekHeaderCell = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n font-family: ", ";\n font-size: 14px;\n line-height: 19px;\n color: ", ";\n"])), function (props) {
231
+ return props.theme.dateInput.pickerFontFamily;
232
+ }, function (props) {
233
+ return props.theme.dateInput.pickerWeekFontColor;
234
+ });
235
+
236
+ var DayCellsContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n gap: 4px;\n flex-wrap: wrap;\n justify-content: space-between;\n"])));
237
+
238
+ var DayCell = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n width: 36px;\n height: 36px;\n padding: 0;\n font-size: 0.875rem;\n font-family: ", ";\n font-weight: 400;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n\n &:focus {\n outline: ", " solid 2px;\n }\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n &:active {\n background-color: #4b1c7d;\n color: #ffffff;\n }\n\n ", "\n background-color: ", ";\n color: ", ";\n"])), function (props) {
239
+ return props.theme.dateInput.pickerFontFamily;
240
+ }, function (props) {
241
+ return props.theme.dateInput.pickerFocusColor;
242
+ }, function (props) {
243
+ return props.selected ? props.theme.dateInput.pickerSelectedDateBackgroundColor : props.theme.dateInput.pickerHoverDateBackgroundColor;
244
+ }, function (props) {
245
+ return props.selected ? props.theme.dateInput.pickerSelectedDateColor : props.theme.dateInput.pickerHoverDateFontColor;
246
+ }, function (props) {
247
+ return props.isCurrentDay && !props.selected && "border: 1px solid #cbacec;";
248
+ }, function (props) {
249
+ return props.selected ? props.theme.dateInput.pickerSelectedDateBackgroundColor : "transparent";
250
+ }, function (props) {
251
+ return props.selected ? props.theme.dateInput.pickerSelectedDateColor : props.isCurrentDay ? props.theme.dateInput.pickerActualDateFontColor : !props.actualMonth ? "#999999" : props.theme.dateInput.pickerDayFontColor;
252
+ });
253
+
254
+ var EmptyDayCell = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-block;\n width: 40px;\n height: 36px;\n"])));
255
+
256
+ var _default = /*#__PURE__*/_react["default"].memo(Calendar);
257
+
258
+ exports["default"] = _default;