@ptsecurity/mosaic 13.7.1 → 13.9.0

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 (107) hide show
  1. package/_theming.scss +186 -53
  2. package/_visual.scss +55 -13
  3. package/core/formatters/date/formatter.d.ts +13 -4
  4. package/core/formatters/date/templates/en-US.d.ts +2 -74
  5. package/core/formatters/date/templates/ru-RU.d.ts +2 -74
  6. package/design-tokens/legacy-2017/tokens/components/checkbox.json5 +4 -0
  7. package/design-tokens/legacy-2017/tokens/components/radio.json5 +11 -10
  8. package/design-tokens/legacy-2017/tokens/components/toast.json5 +54 -0
  9. package/design-tokens/legacy-2017/tokens.d.ts +49 -8
  10. package/design-tokens/pt-2022/tokens/components/button.json5 +1 -1
  11. package/design-tokens/pt-2022/tokens/components/checkbox.json5 +4 -0
  12. package/design-tokens/pt-2022/tokens/components/link.json5 +3 -3
  13. package/design-tokens/pt-2022/tokens/components/radio.json5 +6 -3
  14. package/design-tokens/pt-2022/tokens/components/tags.json5 +1 -1
  15. package/design-tokens/pt-2022/tokens/components/toast.json5 +54 -0
  16. package/design-tokens/pt-2022/tokens/properties/colors.json5 +1 -1
  17. package/design-tokens/pt-2022/tokens.d.ts +55 -13
  18. package/design-tokens/style-dictionary/figma-types.js +41 -0
  19. package/design-tokens/style-dictionary/formats/figma.js +1 -1
  20. package/design-tokens/style-dictionary/transforms/attribute/figma-border.js +1 -1
  21. package/design-tokens/style-dictionary/transforms/attribute/figma-color.js +1 -1
  22. package/design-tokens/style-dictionary/transforms/attribute/figma-default.js +1 -1
  23. package/design-tokens/style-dictionary/transforms/attribute/figma-font.js +1 -1
  24. package/design-tokens/style-dictionary/transforms/attribute/figma-opacity.js +1 -1
  25. package/design-tokens/style-dictionary/transforms/attribute/figma-shadow.js +1 -1
  26. package/design-tokens/style-dictionary/transforms/attribute/figma-sizing.js +1 -1
  27. package/design-tokens/style-dictionary/transforms/attribute/figma-spacing.js +1 -1
  28. package/design-tokens/style-dictionary/transforms/attribute/figma-typography.js +1 -1
  29. package/esm2020/button/button.component.mjs +2 -2
  30. package/esm2020/core/formatters/date/formatter.mjs +22 -16
  31. package/esm2020/core/formatters/date/templates/en-US.mjs +1 -1
  32. package/esm2020/core/formatters/date/templates/ru-RU.mjs +1 -1
  33. package/esm2020/design-tokens/legacy-2017/tokens.mjs +50 -9
  34. package/esm2020/design-tokens/pt-2022/tokens.mjs +56 -14
  35. package/esm2020/navbar/navbar-item.component.mjs +29 -6
  36. package/esm2020/navbar/vertical-navbar.component.mjs +3 -3
  37. package/esm2020/radio/radio.component.mjs +3 -3
  38. package/esm2020/textarea/textarea.component.mjs +3 -4
  39. package/esm2020/toast/index.mjs +2 -0
  40. package/esm2020/toast/ptsecurity-mosaic-toast.mjs +5 -0
  41. package/esm2020/toast/public-api.mjs +6 -0
  42. package/esm2020/toast/toast-animations.mjs +9 -0
  43. package/esm2020/toast/toast-container.component.mjs +44 -0
  44. package/esm2020/toast/toast.component.mjs +89 -0
  45. package/esm2020/toast/toast.module.mjs +42 -0
  46. package/esm2020/toast/toast.service.mjs +178 -0
  47. package/esm2020/toast/toast.type.mjs +15 -0
  48. package/esm2020/tooltip/tooltip.component.mjs +2 -1
  49. package/esm2020/tree/tree-option.component.mjs +3 -2
  50. package/esm2020/tree/tree-selection.component.mjs +3 -2
  51. package/esm2020/tree-select/tree-select.component.mjs +10 -9
  52. package/fesm2015/ptsecurity-mosaic-button.mjs +2 -2
  53. package/fesm2015/ptsecurity-mosaic-button.mjs.map +1 -1
  54. package/fesm2015/ptsecurity-mosaic-core.mjs +21 -15
  55. package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
  56. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs +147 -23
  57. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  58. package/fesm2015/ptsecurity-mosaic-navbar.mjs +33 -9
  59. package/fesm2015/ptsecurity-mosaic-navbar.mjs.map +1 -1
  60. package/fesm2015/ptsecurity-mosaic-radio.mjs +2 -2
  61. package/fesm2015/ptsecurity-mosaic-radio.mjs.map +1 -1
  62. package/fesm2015/ptsecurity-mosaic-textarea.mjs +2 -3
  63. package/fesm2015/ptsecurity-mosaic-textarea.mjs.map +1 -1
  64. package/fesm2015/ptsecurity-mosaic-toast.mjs +363 -0
  65. package/fesm2015/ptsecurity-mosaic-toast.mjs.map +1 -0
  66. package/fesm2015/ptsecurity-mosaic-tooltip.mjs +1 -0
  67. package/fesm2015/ptsecurity-mosaic-tooltip.mjs.map +1 -1
  68. package/fesm2015/ptsecurity-mosaic-tree-select.mjs +9 -8
  69. package/fesm2015/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  70. package/fesm2015/ptsecurity-mosaic-tree.mjs +4 -2
  71. package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
  72. package/fesm2020/ptsecurity-mosaic-button.mjs +2 -2
  73. package/fesm2020/ptsecurity-mosaic-button.mjs.map +1 -1
  74. package/fesm2020/ptsecurity-mosaic-core.mjs +21 -15
  75. package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
  76. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs +147 -23
  77. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  78. package/fesm2020/ptsecurity-mosaic-navbar.mjs +30 -7
  79. package/fesm2020/ptsecurity-mosaic-navbar.mjs.map +1 -1
  80. package/fesm2020/ptsecurity-mosaic-radio.mjs +2 -2
  81. package/fesm2020/ptsecurity-mosaic-radio.mjs.map +1 -1
  82. package/fesm2020/ptsecurity-mosaic-textarea.mjs +2 -3
  83. package/fesm2020/ptsecurity-mosaic-textarea.mjs.map +1 -1
  84. package/fesm2020/ptsecurity-mosaic-toast.mjs +361 -0
  85. package/fesm2020/ptsecurity-mosaic-toast.mjs.map +1 -0
  86. package/fesm2020/ptsecurity-mosaic-tooltip.mjs +1 -0
  87. package/fesm2020/ptsecurity-mosaic-tooltip.mjs.map +1 -1
  88. package/fesm2020/ptsecurity-mosaic-tree-select.mjs +9 -8
  89. package/fesm2020/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  90. package/fesm2020/ptsecurity-mosaic-tree.mjs +4 -2
  91. package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
  92. package/navbar/navbar-item.component.d.ts +9 -3
  93. package/package.json +12 -4
  94. package/prebuilt-themes/dark-theme.css +1 -1
  95. package/prebuilt-themes/default-theme.css +1 -1
  96. package/toast/index.d.ts +1 -0
  97. package/toast/package.json +10 -0
  98. package/toast/ptsecurity-mosaic-toast.d.ts +5 -0
  99. package/toast/public-api.d.ts +5 -0
  100. package/toast/toast-animations.d.ts +4 -0
  101. package/toast/toast-container.component.d.ts +15 -0
  102. package/toast/toast.component.d.ts +35 -0
  103. package/toast/toast.module.d.ts +13 -0
  104. package/toast/toast.service.d.ts +49 -0
  105. package/toast/toast.type.d.ts +27 -0
  106. package/tooltip/tooltip.component.d.ts +1 -1
  107. package/tree/tree-selection.component.d.ts +1 -0
@@ -933,13 +933,13 @@ class DateFormatter {
933
933
  * @param datetime - should time be shown as well
934
934
  * @param seconds - should time with seconds be shown as well
935
935
  * @param milliseconds - should time with milliseconds be shown as well
936
- * @returns absolute date in common format
936
+ * @param currYear - should current year be shown as well
937
937
  */
938
- absoluteDate(date, params, datetime = false, seconds = false, milliseconds = false) {
938
+ absoluteDate(date, params, datetime = false, seconds = false, milliseconds = false, currYear = false) {
939
939
  if (!this.adapter.isDateInstance(date)) {
940
940
  throw new Error(this.invalidDateErrorText);
941
941
  }
942
- const variables = this.compileVariables(date, Object.assign(Object.assign({}, this.adapter.config.variables), params.variables));
942
+ const variables = this.compileVariables(date, Object.assign(Object.assign({}, this.adapter.config.variables), params.variables), currYear);
943
943
  variables.SHOW_SECONDS = seconds ? 'yes' : 'no';
944
944
  variables.SHOW_MILLISECONDS = milliseconds ? 'yes' : 'no';
945
945
  const template = datetime ? params.DATETIME : params.DATE;
@@ -947,10 +947,11 @@ class DateFormatter {
947
947
  }
948
948
  /**
949
949
  * @param date - date
950
+ * @param currYear - should the year be shown forced
950
951
  * @returns absolute date in short format
951
952
  */
952
- absoluteShortDate(date) {
953
- return this.absoluteDate(date, this.config.absoluteTemplates.short);
953
+ absoluteShortDate(date, currYear = false) {
954
+ return this.absoluteDate(date, this.config.absoluteTemplates.short, false, false, false, currYear);
954
955
  }
955
956
  /**
956
957
  * @param date - date
@@ -958,14 +959,15 @@ class DateFormatter {
958
959
  * @returns absolute date in short format with time
959
960
  */
960
961
  absoluteShortDateTime(date, options) {
961
- return this.absoluteDate(date, this.config.absoluteTemplates.short, true, options === null || options === void 0 ? void 0 : options.seconds, options === null || options === void 0 ? void 0 : options.milliseconds);
962
+ return this.absoluteDate(date, this.config.absoluteTemplates.short, true, options === null || options === void 0 ? void 0 : options.seconds, options === null || options === void 0 ? void 0 : options.milliseconds, options === null || options === void 0 ? void 0 : options.currYear);
962
963
  }
963
964
  /**
964
965
  * @param date - date
966
+ * @param currYear - should the year be shown forced
965
967
  * @returns absolute date in long format
966
968
  */
967
- absoluteLongDate(date) {
968
- return this.absoluteDate(date, this.config.absoluteTemplates.long);
969
+ absoluteLongDate(date, currYear = false) {
970
+ return this.absoluteDate(date, this.config.absoluteTemplates.long, false, false, false, currYear);
969
971
  }
970
972
  /**
971
973
  * @param date - date
@@ -973,7 +975,7 @@ class DateFormatter {
973
975
  * @returns absolute date in long format with time
974
976
  */
975
977
  absoluteLongDateTime(date, options) {
976
- return this.absoluteDate(date, this.config.absoluteTemplates.long, true, options === null || options === void 0 ? void 0 : options.seconds, options === null || options === void 0 ? void 0 : options.milliseconds);
978
+ return this.absoluteDate(date, this.config.absoluteTemplates.long, true, options === null || options === void 0 ? void 0 : options.seconds, options === null || options === void 0 ? void 0 : options.milliseconds, options === null || options === void 0 ? void 0 : options.currYear);
977
979
  }
978
980
  /**
979
981
  * @param startDate - start date
@@ -1135,7 +1137,13 @@ class DateFormatter {
1135
1137
  rangeMiddleDateTime(startDate, endDate, options) {
1136
1138
  return this.rangeDateTime(startDate, endDate, this.config.rangeTemplates.closedRange.middle, options === null || options === void 0 ? void 0 : options.seconds, options === null || options === void 0 ? void 0 : options.milliseconds);
1137
1139
  }
1138
- compileVariables(date, variables) {
1140
+ /**
1141
+ * @param date
1142
+ * @param variables - date template variables
1143
+ * @param currYearForced - param for absolute days formatting
1144
+ * @private
1145
+ */
1146
+ compileVariables(date, variables, currYearForced = false) {
1139
1147
  const compiledVariables = {};
1140
1148
  // tslint:disable-next-line:no-for-in
1141
1149
  for (const key in variables) {
@@ -1145,22 +1153,20 @@ class DateFormatter {
1145
1153
  const value = variables[key];
1146
1154
  compiledVariables[key] = this.adapter.format(date, value);
1147
1155
  }
1148
- compiledVariables.CURRENT_YEAR = this.hasSame(date, this.adapter.today(), 'year');
1156
+ compiledVariables.CURRENT_YEAR = (currYearForced && 'no') || this.hasSame(date, this.adapter.today(), 'year');
1149
1157
  return compiledVariables;
1150
1158
  }
1151
1159
  isBeforeYesterday(date) {
1152
1160
  return this.adapter.daysFromToday(date) <= -2;
1153
1161
  }
1154
1162
  isYesterday(date) {
1155
- const interval = this.adapter.daysFromToday(date);
1156
- return interval > -2 && interval <= -1;
1163
+ return this.adapter.daysFromToday(date) === -1;
1157
1164
  }
1158
1165
  isToday(date) {
1159
1166
  return this.adapter.daysFromToday(date) === 0;
1160
1167
  }
1161
1168
  isTomorrow(date) {
1162
- const interval = this.adapter.daysFromToday(date);
1163
- return interval >= 1 && interval < 2;
1169
+ return this.adapter.daysFromToday(date) === 1;
1164
1170
  }
1165
1171
  isAfterTomorrow(date) {
1166
1172
  return this.adapter.daysFromToday(date) >= 2;