@synerise/ds-core 1.11.0 → 1.11.1

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 (125) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/i18n/{en.json → en.json.d.ts} +4 -2
  3. package/dist/i18n/en.json.js +8 -0
  4. package/dist/i18n/{es.json → es.json.d.ts} +4 -2
  5. package/dist/i18n/es.json.js +8 -0
  6. package/dist/i18n/index.js +14 -11
  7. package/dist/i18n/{pl.json → pl.json.d.ts} +4 -2
  8. package/dist/i18n/pl.json.js +8 -0
  9. package/dist/i18n/{pt.json → pt.json.d.ts} +4 -2
  10. package/dist/i18n/pt.json.js +8 -0
  11. package/dist/js/DSProvider/DSProvider.d.ts +5 -6
  12. package/dist/js/DSProvider/DSProvider.js +36 -31
  13. package/dist/js/DSProvider/LocaleProvider/LocaleProvider.d.ts +2 -2
  14. package/dist/js/DSProvider/LocaleProvider/LocaleProvider.js +29 -38
  15. package/dist/js/DSProvider/LocaleProvider/LocaleProvider.types.d.ts +3 -3
  16. package/dist/js/DSProvider/LocaleProvider/LocaleProvider.types.js +1 -1
  17. package/dist/js/DSProvider/LocaleProvider/LocaleProvider.utils.d.ts +1 -1
  18. package/dist/js/DSProvider/LocaleProvider/LocaleProvider.utils.js +22 -19
  19. package/dist/js/DSProvider/LocaleProvider/antLocales.d.ts +6 -6
  20. package/dist/js/DSProvider/LocaleProvider/antLocales.js +16 -13
  21. package/dist/js/DSProvider/LocaleProvider/index.js +4 -1
  22. package/dist/js/DSProvider/ThemeProvider/ThemeProvider.d.ts +2 -2
  23. package/dist/js/DSProvider/ThemeProvider/ThemeProvider.js +14 -12
  24. package/dist/js/DSProvider/ThemeProvider/breakpoints.js +5 -2
  25. package/dist/js/DSProvider/ThemeProvider/index.js +4 -1
  26. package/dist/js/DSProvider/ThemeProvider/theme.d.ts +1 -1
  27. package/dist/js/DSProvider/ThemeProvider/theme.js +17 -17
  28. package/dist/js/DSProvider/ThemeProvider/variables.d.ts +8 -0
  29. package/dist/js/DSProvider/ThemeProvider/variables.js +531 -530
  30. package/dist/js/DSProvider/index.js +4 -1
  31. package/dist/js/DropdownContext/DropdownContext/DropdownContextProvider.d.ts +2 -2
  32. package/dist/js/DropdownContext/DropdownContext/DropdownContextProvider.js +11 -11
  33. package/dist/js/DropdownContext/DropdownContext.d.ts +1 -1
  34. package/dist/js/DropdownContext/DropdownContext.js +5 -2
  35. package/dist/js/DropdownContext/DropdownContextProvider.d.ts +2 -2
  36. package/dist/js/DropdownContext/DropdownContextProvider.js +11 -11
  37. package/dist/js/DropdownContext/index.js +8 -3
  38. package/dist/js/DropdownContext/useDropdown.d.ts +1 -1
  39. package/dist/js/DropdownContext/useDropdown.js +7 -4
  40. package/dist/js/data-format/components/FormattedDate.d.ts +4 -4
  41. package/dist/js/data-format/components/FormattedDate.js +23 -9
  42. package/dist/js/data-format/components/FormattedDateTime.d.ts +4 -4
  43. package/dist/js/data-format/components/FormattedDateTime.js +26 -12
  44. package/dist/js/data-format/components/FormattedNumber.d.ts +2 -2
  45. package/dist/js/data-format/components/FormattedNumber.js +23 -9
  46. package/dist/js/data-format/components/FormattedRelativeDateTime.d.ts +3 -3
  47. package/dist/js/data-format/components/FormattedRelativeDateTime.js +40 -21
  48. package/dist/js/data-format/components/FormattedTime.d.ts +4 -4
  49. package/dist/js/data-format/components/FormattedTime.js +26 -12
  50. package/dist/js/data-format/components/index.js +13 -5
  51. package/dist/js/data-format/constants/dataFormat.constants.d.ts +2 -2
  52. package/dist/js/data-format/constants/dataFormat.constants.js +85 -49
  53. package/dist/js/data-format/constants/dataFormatConfig.constants.d.ts +2 -2
  54. package/dist/js/data-format/constants/dataFormatConfig.constants.js +15 -8
  55. package/dist/js/data-format/constants/dateTimeParts.constants.d.ts +1 -1
  56. package/dist/js/data-format/constants/dateTimeParts.constants.js +10 -4
  57. package/dist/js/data-format/constants/index.js +48 -3
  58. package/dist/js/data-format/contexts/DataFormatConfigContext.d.ts +2 -2
  59. package/dist/js/data-format/contexts/DataFormatConfigContext.js +6 -3
  60. package/dist/js/data-format/contexts/DataFormatIntlsContext.d.ts +2 -2
  61. package/dist/js/data-format/contexts/DataFormatIntlsContext.js +7 -4
  62. package/dist/js/data-format/contexts/index.js +6 -2
  63. package/dist/js/data-format/hocs/withDataFormat.d.ts +2 -2
  64. package/dist/js/data-format/hocs/withDataFormat.js +23 -9
  65. package/dist/js/data-format/hooks/index.js +14 -6
  66. package/dist/js/data-format/hooks/useDataFormat.d.ts +1 -1
  67. package/dist/js/data-format/hooks/useDataFormat.js +93 -90
  68. package/dist/js/data-format/hooks/useDataFormatConfig.d.ts +1 -1
  69. package/dist/js/data-format/hooks/useDataFormatConfig.js +8 -4
  70. package/dist/js/data-format/hooks/useDataFormatIntls.d.ts +1 -1
  71. package/dist/js/data-format/hooks/useDataFormatIntls.js +8 -4
  72. package/dist/js/data-format/hooks/useDataFormatUtils.d.ts +4 -4
  73. package/dist/js/data-format/hooks/useDataFormatUtils.js +62 -63
  74. package/dist/js/data-format/hooks/useRelativeDateTimeUpdate.d.ts +2 -2
  75. package/dist/js/data-format/hooks/useRelativeDateTimeUpdate.js +19 -23
  76. package/dist/js/data-format/hooks/useSingleIntl.d.ts +1 -1
  77. package/dist/js/data-format/hooks/useSingleIntl.js +11 -8
  78. package/dist/js/data-format/index.js +83 -7
  79. package/dist/js/data-format/providers/DataFormatConfigProvider.d.ts +2 -2
  80. package/dist/js/data-format/providers/DataFormatConfigProvider.js +37 -26
  81. package/dist/js/data-format/types/dataFormat.types.d.ts +3 -3
  82. package/dist/js/data-format/types/dataFormat.types.js +1 -5
  83. package/dist/js/data-format/types/dataFormatConfig.types.d.ts +1 -1
  84. package/dist/js/data-format/types/dataFormatConfig.types.js +1 -2
  85. package/dist/js/data-format/types/dateTimeParts.types.js +1 -2
  86. package/dist/js/data-format/types/index.js +1 -1
  87. package/dist/js/data-format/utils/dataFormat.utils.d.ts +2 -2
  88. package/dist/js/data-format/utils/dataFormat.utils.js +82 -67
  89. package/dist/js/data-format/utils/dataFormatConfig.utils.d.ts +1 -1
  90. package/dist/js/data-format/utils/dataFormatConfig.utils.js +9 -8
  91. package/dist/js/data-format/utils/date.utils.d.ts +2 -2
  92. package/dist/js/data-format/utils/date.utils.js +25 -21
  93. package/dist/js/data-format/utils/dateTimeParts.utils.d.ts +2 -2
  94. package/dist/js/data-format/utils/dateTimeParts.utils.js +68 -52
  95. package/dist/js/data-format/utils/index.js +41 -5
  96. package/dist/js/data-format/utils/timeZone.utils.d.ts +1 -1
  97. package/dist/js/data-format/utils/timeZone.utils.js +59 -51
  98. package/dist/js/index.js +112 -7
  99. package/dist/js/mediaQuery/mediaQuery.d.ts +2 -2
  100. package/dist/js/mediaQuery/mediaQuery.js +15 -25
  101. package/dist/js/style.d.ts +0 -2
  102. package/dist/js/style.js +1 -2
  103. package/dist/js/testing/index.js +6 -2
  104. package/dist/js/testing/renderWithProvider/renderWithProvider.d.ts +4 -4
  105. package/dist/js/testing/renderWithProvider/renderWithProvider.js +35 -27
  106. package/dist/js/testing/sleep.js +6 -8
  107. package/dist/js/toaster/Toaster.d.ts +1 -1
  108. package/dist/js/toaster/Toaster.js +12 -8
  109. package/dist/js/toaster/Toaster.types.js +1 -1
  110. package/dist/js/toaster/constants.d.ts +1 -1
  111. package/dist/js/toaster/constants.js +7 -4
  112. package/dist/js/toaster/contexts/ToasterContext.d.ts +2 -2
  113. package/dist/js/toaster/contexts/ToasterContext.js +9 -5
  114. package/dist/js/toaster/hooks/useToaster.d.ts +1 -1
  115. package/dist/js/toaster/hooks/useToaster.js +7 -4
  116. package/dist/js/toaster/index.js +12 -5
  117. package/dist/js/toaster/providers/ToasterProvider.d.ts +2 -2
  118. package/dist/js/toaster/providers/ToasterProvider.js +17 -17
  119. package/package.json +4 -4
  120. package/dist/js/testing/renderWithProvider/renderWithProvider.spec.d.ts +0 -1
  121. package/dist/style/colors.less +0 -137
  122. package/dist/style/config.less +0 -521
  123. package/dist/style/core.less +0 -55
  124. package/dist/style/variables.less +0 -2
  125. /package/dist/{style/variables.css → assets/style/core-tn0RQdqM.css} +0 -0
@@ -1,65 +1,68 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import { DEFAULT_FORMAT_DATE_OPTIONS, DEFAULT_FORMAT_MONTH_LONG_OPTIONS, DEFAULT_FORMAT_MONTH_SHORT_OPTIONS, DEFAULT_FORMAT_TIME_OPTIONS, DEFAULT_FORMAT_WEEKDAY_LONG_OPTIONS, DEFAULT_FORMAT_WEEKDAY_SHORT_OPTIONS, LONG, MONTH, MONTH_LONG, MONTH_SHORT, SHORT, WEEKDAY, WEEKDAY_LONG, WEEKDAY_SHORT } from '../constants';
3
- import { dateToIsoWithOffset } from './timeZone.utils';
4
- export var getDateParts = function getDateParts(value, dateFormatIntl, option) {
5
- return dateFormatIntl.formatDateToParts(dateToIsoWithOffset(value, dateFormatIntl), _extends({}, DEFAULT_FORMAT_DATE_OPTIONS, option));
6
- };
7
- export var getTimeParts = function getTimeParts(value, timeFormatIntl, option) {
8
- return timeFormatIntl.formatDateToParts(dateToIsoWithOffset(value, timeFormatIntl), _extends({}, DEFAULT_FORMAT_TIME_OPTIONS, option));
9
- };
10
- export var getWeekdayLongDateParts = function getWeekdayLongDateParts(value, dateFormatIntl, option) {
11
- return dateFormatIntl.formatDateToParts(value, _extends({}, DEFAULT_FORMAT_WEEKDAY_LONG_OPTIONS, option));
12
- };
13
- export var getWeekdayShortDateParts = function getWeekdayShortDateParts(value, dateFormatIntl, option) {
14
- return dateFormatIntl.formatDateToParts(value, _extends({}, DEFAULT_FORMAT_WEEKDAY_SHORT_OPTIONS, option));
15
- };
16
- export var getMonthLongDateParts = function getMonthLongDateParts(value, dateFormatIntl, option) {
17
- return dateFormatIntl.formatDateToParts(value, _extends({}, DEFAULT_FORMAT_MONTH_LONG_OPTIONS, option));
18
- };
19
- export var getMonthShortDateParts = function getMonthShortDateParts(value, dateFormatIntl, option) {
20
- return dateFormatIntl.formatDateToParts(value, _extends({}, DEFAULT_FORMAT_MONTH_SHORT_OPTIONS, option));
1
+ import "../constants/dataFormatConfig.constants.js";
2
+ import { DEFAULT_FORMAT_DATE_OPTIONS, DEFAULT_FORMAT_MONTH_LONG_OPTIONS, DEFAULT_FORMAT_MONTH_SHORT_OPTIONS, DEFAULT_FORMAT_TIME_OPTIONS, DEFAULT_FORMAT_WEEKDAY_LONG_OPTIONS, DEFAULT_FORMAT_WEEKDAY_SHORT_OPTIONS, WEEKDAY_LONG, WEEKDAY_SHORT, MONTH_LONG, MONTH_SHORT } from "../constants/dataFormat.constants.js";
3
+ import { LONG, SHORT, WEEKDAY, MONTH } from "../constants/dateTimeParts.constants.js";
4
+ import { dateToIsoWithOffset } from "./timeZone.utils.js";
5
+ const getDateParts = (value, dateFormatIntl, option) => {
6
+ return dateFormatIntl.formatDateToParts(dateToIsoWithOffset(value, dateFormatIntl), {
7
+ ...DEFAULT_FORMAT_DATE_OPTIONS,
8
+ ...option
9
+ });
21
10
  };
22
- export var getDateTimePartsSubset = function getDateTimePartsSubset(dateTimeParts, subsetTypes) {
23
- var resultDateTimeParts = [];
24
- dateTimeParts.forEach(function (dateTimePart) {
11
+ const getTimeParts = (value, timeFormatIntl, option) => timeFormatIntl.formatDateToParts(dateToIsoWithOffset(value, timeFormatIntl), {
12
+ ...DEFAULT_FORMAT_TIME_OPTIONS,
13
+ ...option
14
+ });
15
+ const getWeekdayLongDateParts = (value, dateFormatIntl, option) => dateFormatIntl.formatDateToParts(value, {
16
+ ...DEFAULT_FORMAT_WEEKDAY_LONG_OPTIONS,
17
+ ...option
18
+ });
19
+ const getWeekdayShortDateParts = (value, dateFormatIntl, option) => dateFormatIntl.formatDateToParts(value, {
20
+ ...DEFAULT_FORMAT_WEEKDAY_SHORT_OPTIONS,
21
+ ...option
22
+ });
23
+ const getMonthLongDateParts = (value, dateFormatIntl, option) => dateFormatIntl.formatDateToParts(value, {
24
+ ...DEFAULT_FORMAT_MONTH_LONG_OPTIONS,
25
+ ...option
26
+ });
27
+ const getMonthShortDateParts = (value, dateFormatIntl, option) => dateFormatIntl.formatDateToParts(value, {
28
+ ...DEFAULT_FORMAT_MONTH_SHORT_OPTIONS,
29
+ ...option
30
+ });
31
+ const getDateTimePartsSubset = (dateTimeParts, subsetTypes) => {
32
+ const resultDateTimeParts = [];
33
+ dateTimeParts.forEach((dateTimePart) => {
25
34
  if (subsetTypes.includes(dateTimePart.type)) {
26
35
  resultDateTimeParts.push(dateTimePart);
27
36
  }
28
37
  });
29
38
  return resultDateTimeParts;
30
39
  };
31
- export var nbspToSpace = function nbspToSpace(text) {
32
- return text.replace(/&nbsp;/g, ' ').replace(/\u00A0/g, ' ');
40
+ const nbspToSpace = (text) => {
41
+ return text.replace(/&nbsp;/g, " ").replace(/\u00A0/g, " ");
33
42
  };
34
- export var numberPartsToString = function numberPartsToString(numberParts, thousandDelimiter, decimalDelimiter) {
35
- var numberPartsWithReplacedDelimiters = numberParts.map(function (numberPart) {
36
- var numberPartWithReplacedDelimiters = numberPart;
37
- if (numberPartWithReplacedDelimiters.type === 'group') {
43
+ const numberPartsToString = (numberParts, thousandDelimiter, decimalDelimiter) => {
44
+ const numberPartsWithReplacedDelimiters = numberParts.map((numberPart) => {
45
+ const numberPartWithReplacedDelimiters = numberPart;
46
+ if (numberPartWithReplacedDelimiters.type === "group") {
38
47
  numberPartWithReplacedDelimiters.value = thousandDelimiter;
39
48
  }
40
- if (numberPartWithReplacedDelimiters.type === 'decimal') {
49
+ if (numberPartWithReplacedDelimiters.type === "decimal") {
41
50
  numberPartWithReplacedDelimiters.value = decimalDelimiter;
42
51
  }
43
52
  return numberPartWithReplacedDelimiters;
44
53
  });
45
- var joinedNumberParts = numberPartsWithReplacedDelimiters.map(function (numberPart) {
46
- return numberPart.value;
47
- }).join('');
54
+ const joinedNumberParts = numberPartsWithReplacedDelimiters.map((numberPart) => numberPart.value).join("");
48
55
  return nbspToSpace(joinedNumberParts);
49
56
  };
50
- export var dateTimePartsToString = function dateTimePartsToString(dateTimeParts) {
51
- var joinedDateTimeParts = dateTimeParts.map(function (dateTimePart) {
52
- return dateTimePart.value;
53
- }).join('');
57
+ const dateTimePartsToString = (dateTimeParts) => {
58
+ const joinedDateTimeParts = dateTimeParts.map((dateTimePart) => dateTimePart.value).join("");
54
59
  return nbspToSpace(joinedDateTimeParts);
55
60
  };
56
- export var replaceDateTimeParts = function replaceDateTimeParts(dateTimeParts, replacementDateTimeParts, replacementDateTimeFormatPartTypes) {
57
- return dateTimeParts.map(function (dateTimePart) {
58
- var dateTimePartToReplace = dateTimePart;
59
- if (replacementDateTimeFormatPartTypes != null && replacementDateTimeFormatPartTypes.includes(dateTimePartToReplace.type)) {
60
- var foundedReplacementDateTimePart = replacementDateTimeParts == null ? void 0 : replacementDateTimeParts.find(function (replacementDateTimePart) {
61
- return replacementDateTimePart.type === dateTimePartToReplace.type;
62
- });
61
+ const replaceDateTimeParts = (dateTimeParts, replacementDateTimeParts, replacementDateTimeFormatPartTypes) => {
62
+ return dateTimeParts.map((dateTimePart) => {
63
+ const dateTimePartToReplace = dateTimePart;
64
+ if (replacementDateTimeFormatPartTypes?.includes(dateTimePartToReplace.type)) {
65
+ const foundedReplacementDateTimePart = replacementDateTimeParts?.find((replacementDateTimePart) => replacementDateTimePart.type === dateTimePartToReplace.type);
63
66
  if (foundedReplacementDateTimePart) {
64
67
  dateTimePartToReplace.value = foundedReplacementDateTimePart.value;
65
68
  }
@@ -67,20 +70,33 @@ export var replaceDateTimeParts = function replaceDateTimeParts(dateTimeParts, r
67
70
  return dateTimePartToReplace;
68
71
  });
69
72
  };
70
- export var translateDateTimeParts = function translateDateTimeParts(dateTimeParts, dateTimePartsFromLanguageIntl, options) {
71
- var _options$dateOptions, _options$dateOptions2;
72
- var replacementDateTimeFormatPartTypes = [];
73
- if ((options == null ? void 0 : options.targetFormat) === WEEKDAY_LONG || (options == null ? void 0 : options.targetFormat) === WEEKDAY_SHORT) {
73
+ const translateDateTimeParts = (dateTimeParts, dateTimePartsFromLanguageIntl, options) => {
74
+ const replacementDateTimeFormatPartTypes = [];
75
+ if (options?.targetFormat === WEEKDAY_LONG || options?.targetFormat === WEEKDAY_SHORT) {
74
76
  replacementDateTimeFormatPartTypes.push(WEEKDAY);
75
77
  }
76
- if ((options == null ? void 0 : options.targetFormat) === MONTH_LONG || (options == null ? void 0 : options.targetFormat) === MONTH_SHORT) {
78
+ if (options?.targetFormat === MONTH_LONG || options?.targetFormat === MONTH_SHORT) {
77
79
  replacementDateTimeFormatPartTypes.push(MONTH);
78
80
  }
79
- if ((options == null || (_options$dateOptions = options.dateOptions) == null ? void 0 : _options$dateOptions.month) === LONG || (options == null || (_options$dateOptions2 = options.dateOptions) == null ? void 0 : _options$dateOptions2.month) === SHORT) {
81
+ if (options?.dateOptions?.month === LONG || options?.dateOptions?.month === SHORT) {
80
82
  replacementDateTimeFormatPartTypes.push(MONTH);
81
83
  }
82
- if ((options == null ? void 0 : options.month) === LONG || (options == null ? void 0 : options.month) === SHORT) {
84
+ if (options?.month === LONG || options?.month === SHORT) {
83
85
  replacementDateTimeFormatPartTypes.push(MONTH);
84
86
  }
85
87
  return replaceDateTimeParts(dateTimeParts, dateTimePartsFromLanguageIntl, replacementDateTimeFormatPartTypes);
86
- };
88
+ };
89
+ export {
90
+ dateTimePartsToString,
91
+ getDateParts,
92
+ getDateTimePartsSubset,
93
+ getMonthLongDateParts,
94
+ getMonthShortDateParts,
95
+ getTimeParts,
96
+ getWeekdayLongDateParts,
97
+ getWeekdayShortDateParts,
98
+ nbspToSpace,
99
+ numberPartsToString,
100
+ replaceDateTimeParts,
101
+ translateDateTimeParts
102
+ };
@@ -1,5 +1,41 @@
1
- export { getDataFormatConfigFromNotation } from './dataFormatConfig.utils';
2
- export { getDateParts, getTimeParts, getWeekdayLongDateParts, getWeekdayShortDateParts, getDateTimePartsSubset, nbspToSpace, numberPartsToString, dateTimePartsToString, replaceDateTimeParts, translateDateTimeParts, getMonthLongDateParts, getMonthShortDateParts } from './dateTimeParts.utils';
3
- export { convertNumberString, convertDateToDateTimeString, convertDateToRelativeToString, convertDateToRelativeFromString, convertDateToTimeString, convertDateToDateString, convertDateToWeekdayLongString, convertDateToWeekdayShortString, convertDateToMonthLongString, convertDateToMonthShortString, addPrefix, addSuffix, changeNamingConvention, getDefaultDataTimeOptions } from './dataFormat.utils';
4
- export { getConstantDatesAndFormattingOptions } from './date.utils';
5
- export { applyTimezoneOffset, currentTimeInTimezone, getValueAsLocalDate, getTimeZone, dateStringTimeZoneParts, removeTimeZoneOffset } from './timeZone.utils';
1
+ import { getDataFormatConfigFromNotation } from "./dataFormatConfig.utils.js";
2
+ import { dateTimePartsToString, getDateParts, getDateTimePartsSubset, getMonthLongDateParts, getMonthShortDateParts, getTimeParts, getWeekdayLongDateParts, getWeekdayShortDateParts, nbspToSpace, numberPartsToString, replaceDateTimeParts, translateDateTimeParts } from "./dateTimeParts.utils.js";
3
+ import { addPrefix, addSuffix, changeNamingConvention, convertDateToDateString, convertDateToDateTimeString, convertDateToMonthLongString, convertDateToMonthShortString, convertDateToRelativeFromString, convertDateToRelativeToString, convertDateToTimeString, convertDateToWeekdayLongString, convertDateToWeekdayShortString, convertNumberString, getDefaultDataTimeOptions } from "./dataFormat.utils.js";
4
+ import { getConstantDatesAndFormattingOptions } from "./date.utils.js";
5
+ import { applyTimezoneOffset, currentTimeInTimezone, dateStringTimeZoneParts, getTimeZone, getValueAsLocalDate, removeTimeZoneOffset } from "./timeZone.utils.js";
6
+ export {
7
+ addPrefix,
8
+ addSuffix,
9
+ applyTimezoneOffset,
10
+ changeNamingConvention,
11
+ convertDateToDateString,
12
+ convertDateToDateTimeString,
13
+ convertDateToMonthLongString,
14
+ convertDateToMonthShortString,
15
+ convertDateToRelativeFromString,
16
+ convertDateToRelativeToString,
17
+ convertDateToTimeString,
18
+ convertDateToWeekdayLongString,
19
+ convertDateToWeekdayShortString,
20
+ convertNumberString,
21
+ currentTimeInTimezone,
22
+ dateStringTimeZoneParts,
23
+ dateTimePartsToString,
24
+ getConstantDatesAndFormattingOptions,
25
+ getDataFormatConfigFromNotation,
26
+ getDateParts,
27
+ getDateTimePartsSubset,
28
+ getDefaultDataTimeOptions,
29
+ getMonthLongDateParts,
30
+ getMonthShortDateParts,
31
+ getTimeParts,
32
+ getTimeZone,
33
+ getValueAsLocalDate,
34
+ getWeekdayLongDateParts,
35
+ getWeekdayShortDateParts,
36
+ nbspToSpace,
37
+ numberPartsToString,
38
+ removeTimeZoneOffset,
39
+ replaceDateTimeParts,
40
+ translateDateTimeParts
41
+ };
@@ -1,4 +1,4 @@
1
- import { type IntlShape } from 'react-intl';
1
+ import { IntlShape } from 'react-intl';
2
2
  export declare const TIMEZONE_OFFSET_REGEX: RegExp;
3
3
  export declare const dateToIsoWithOffset: (value: Date, intlObject: IntlShape) => string;
4
4
  export declare const applyTimezoneOffset: (date: Date | undefined, timezoneOffset: true | string | undefined, intl?: IntlShape) => string | Date | undefined;
@@ -1,94 +1,102 @@
1
- import { format, getTimezoneOffset, utcToZonedTime } from 'date-fns-tz';
2
- export var TIMEZONE_OFFSET_REGEX = /([+-]\d\d:\d\d)|([Z])$/;
3
- var defaultTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
4
- export var dateToIsoWithOffset = function dateToIsoWithOffset(value, intlObject) {
1
+ import { utcToZonedTime, format, getTimezoneOffset } from "date-fns-tz";
2
+ const TIMEZONE_OFFSET_REGEX = /([+-]\d\d:\d\d)|([Z])$/;
3
+ const defaultTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
4
+ const dateToIsoWithOffset = (value, intlObject) => {
5
5
  return format(value, "yyyy-MM-dd'T'HH:mm:ssxxx", {
6
- timeZone: (intlObject == null ? void 0 : intlObject.timeZone) || defaultTimezone
6
+ timeZone: intlObject?.timeZone || defaultTimezone
7
7
  });
8
8
  };
9
- export var applyTimezoneOffset = function applyTimezoneOffset(date, timezoneOffset, intl) {
9
+ const applyTimezoneOffset = (date, timezoneOffset, intl) => {
10
10
  if (!timezoneOffset) {
11
11
  return date;
12
12
  }
13
- var timezoneString = getTimeZone(timezoneOffset, intl);
13
+ const timezoneString = getTimeZone(timezoneOffset, intl);
14
14
  return toIsoString(date, timezoneString);
15
15
  };
16
- export var removeTimeZoneOffset = function removeTimeZoneOffset(dateString) {
17
- var date = dateString instanceof Date ? dateString.toISOString() : dateString;
18
- var finalDate = date.replace(TIMEZONE_OFFSET_REGEX, '');
16
+ const removeTimeZoneOffset = (dateString) => {
17
+ const date = dateString instanceof Date ? dateString.toISOString() : dateString;
18
+ const finalDate = date.replace(TIMEZONE_OFFSET_REGEX, "");
19
19
  return finalDate;
20
20
  };
21
- export var extractTimeZoneOffset = function extractTimeZoneOffset(datestring) {
22
- var date = datestring.toString();
23
- var found = date.match(TIMEZONE_OFFSET_REGEX);
21
+ const extractTimeZoneOffset = (datestring) => {
22
+ const date = datestring.toString();
23
+ const found = date.match(TIMEZONE_OFFSET_REGEX);
24
24
  return found && found[0];
25
25
  };
26
- export var dateStringTimeZoneParts = function dateStringTimeZoneParts(dateTimeIsoString) {
26
+ const dateStringTimeZoneParts = (dateTimeIsoString) => {
27
27
  return {
28
28
  dateTimeString: removeTimeZoneOffset(dateTimeIsoString),
29
29
  offsetString: extractTimeZoneOffset(dateTimeIsoString)
30
30
  };
31
31
  };
32
- export var getLocalDateInTimeZone = function getLocalDateInTimeZone(dateIsoString, timezone) {
33
- var _dateStringTimeZonePa = dateStringTimeZoneParts(dateIsoString),
34
- offsetString = _dateStringTimeZonePa.offsetString,
35
- dateTimeString = _dateStringTimeZonePa.dateTimeString;
36
- var localDate = new Date(dateTimeString);
37
- var localTimezoneOffset = getTimezoneOffset(timezone, localDate); // +2
38
- var dateTimezoneOffset = offsetString ? getTimezoneOffset(offsetString, localDate) : 0; // -4
39
-
40
- var offsetDiff = localTimezoneOffset - dateTimezoneOffset;
32
+ const getLocalDateInTimeZone = (dateIsoString, timezone) => {
33
+ const {
34
+ offsetString,
35
+ dateTimeString
36
+ } = dateStringTimeZoneParts(dateIsoString);
37
+ const localDate = new Date(dateTimeString);
38
+ const localTimezoneOffset = getTimezoneOffset(timezone, localDate);
39
+ const dateTimezoneOffset = offsetString ? getTimezoneOffset(offsetString, localDate) : 0;
40
+ const offsetDiff = localTimezoneOffset - dateTimezoneOffset;
41
41
  localDate.setMilliseconds(localDate.getMilliseconds() + offsetDiff);
42
42
  return localDate;
43
43
  };
44
- var pad = function pad(num) {
45
- return (num < 10 ? '0' : '') + num;
46
- };
47
- export function toIsoString(date, timeZone) {
48
- if (timeZone === void 0) {
49
- timeZone = 'UTC';
50
- }
44
+ const pad = (num) => (num < 10 ? "0" : "") + num;
45
+ function toIsoString(date, timeZone = "UTC") {
51
46
  if (!timeZone) {
52
47
  return date.toISOString();
53
48
  }
54
- var timeZoneOffset = getTimezoneOffset(timeZone, date);
55
- var dif = timeZoneOffset >= 0 ? '+' : '-';
56
- var tzHours = pad(Math.floor(Math.abs(timeZoneOffset) / 60 / 60 / 1000));
57
- var tzMinutes = pad(Math.abs(timeZoneOffset) / 60 / 1000 % 60);
58
- return date.getFullYear() + "-" + pad(date.getMonth() + 1) + "-" + pad(date.getDate()) + "T" + pad(date.getHours()) + ":" + pad(date.getMinutes()) + ":" + pad(date.getSeconds()) + dif + tzHours + ":" + tzMinutes;
49
+ const timeZoneOffset = getTimezoneOffset(timeZone, date);
50
+ const dif = timeZoneOffset >= 0 ? "+" : "-";
51
+ const tzHours = pad(Math.floor(Math.abs(timeZoneOffset) / 60 / 60 / 1e3));
52
+ const tzMinutes = pad(Math.abs(timeZoneOffset) / 60 / 1e3 % 60);
53
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}${dif}${tzHours}:${tzMinutes}`;
59
54
  }
60
- export var currentTimeInTimezone = function currentTimeInTimezone(timezoneString) {
61
- var now = new Date();
55
+ const currentTimeInTimezone = (timezoneString) => {
56
+ const now = /* @__PURE__ */ new Date();
62
57
  return utcToZonedTime(now.toISOString(), timezoneString);
63
58
  };
64
- export var dateTimeStringToLocalDate = function dateTimeStringToLocalDate(value, timeZone) {
59
+ const dateTimeStringToLocalDate = (value, timeZone) => {
65
60
  if (!value || !timeZone) {
66
- return new Date();
61
+ return /* @__PURE__ */ new Date();
67
62
  }
68
- if (timeZone !== undefined) {
63
+ if (timeZone !== void 0) {
69
64
  return getLocalDateInTimeZone(value, timeZone);
70
65
  }
71
- // FIXME ????
72
- return typeof value === 'string' ? new Date(value) : value;
66
+ return typeof value === "string" ? new Date(value) : value;
73
67
  };
74
- export var getValueAsLocalDate = function getValueAsLocalDate(value, timeZone) {
68
+ const getValueAsLocalDate = (value, timeZone) => {
75
69
  if (!value) {
76
- return new Date();
70
+ return /* @__PURE__ */ new Date();
77
71
  }
78
- if (timeZone !== undefined) {
79
- if (typeof value !== 'string') {
72
+ if (timeZone !== void 0) {
73
+ if (typeof value !== "string") {
80
74
  return getLocalDateInTimeZone(value.toISOString(), timeZone);
81
75
  }
82
76
  return getLocalDateInTimeZone(value, timeZone);
83
77
  }
84
- return typeof value === 'string' ? new Date(value) : value;
78
+ return typeof value === "string" ? new Date(value) : value;
85
79
  };
86
- export var getTimeZone = function getTimeZone(timeZone, intl) {
80
+ const getTimeZone = (timeZone, intl) => {
87
81
  if (!timeZone) {
88
- return undefined;
82
+ return void 0;
89
83
  }
90
84
  if (timeZone === true) {
91
- return (intl == null ? void 0 : intl.timeZone) || defaultTimezone;
85
+ return intl?.timeZone || defaultTimezone;
92
86
  }
93
87
  return timeZone;
94
- };
88
+ };
89
+ export {
90
+ TIMEZONE_OFFSET_REGEX,
91
+ applyTimezoneOffset,
92
+ currentTimeInTimezone,
93
+ dateStringTimeZoneParts,
94
+ dateTimeStringToLocalDate,
95
+ dateToIsoWithOffset,
96
+ extractTimeZoneOffset,
97
+ getLocalDateInTimeZone,
98
+ getTimeZone,
99
+ getValueAsLocalDate,
100
+ removeTimeZoneOffset,
101
+ toIsoString
102
+ };
package/dist/js/index.js CHANGED
@@ -1,7 +1,112 @@
1
- export { default as DSProvider } from './DSProvider';
2
- export { default as mediaQuery } from './mediaQuery/mediaQuery';
3
- export { theme, useTheme, defaultColorsOrder, themeVariables } from './DSProvider/ThemeProvider/theme';
4
- export * from './data-format';
5
- export * from './testing';
6
- export * from './toaster';
7
- export * from './DropdownContext';
1
+ import { default as default2 } from "./DSProvider/DSProvider.js";
2
+ import { default as default3 } from "./mediaQuery/mediaQuery.js";
3
+ import { defaultColorsOrder, default as default4, themeVariables, useTheme } from "./DSProvider/ThemeProvider/theme.js";
4
+ import { DataFormatConfigProvider } from "./data-format/providers/DataFormatConfigProvider.js";
5
+ import { FormattedDate } from "./data-format/components/FormattedDate.js";
6
+ import { FormattedDateTime } from "./data-format/components/FormattedDateTime.js";
7
+ import { FormattedNumber } from "./data-format/components/FormattedNumber.js";
8
+ import { FormattedTime } from "./data-format/components/FormattedTime.js";
9
+ import { FormattedRelativeDateTimeFrom, FormattedRelativeDateTimeTo } from "./data-format/components/FormattedRelativeDateTime.js";
10
+ import { useDataFormatConfig } from "./data-format/hooks/useDataFormatConfig.js";
11
+ import { useDataFormat } from "./data-format/hooks/useDataFormat.js";
12
+ import { useDataFormatUtils } from "./data-format/hooks/useDataFormatUtils.js";
13
+ import "react-intl";
14
+ import { useDataFormatIntls } from "./data-format/hooks/useDataFormatIntls.js";
15
+ import "react";
16
+ import { withDataFormat } from "./data-format/hocs/withDataFormat.js";
17
+ import { getDataFormatConfigFromNotation } from "./data-format/utils/dataFormatConfig.utils.js";
18
+ import { DEFAULT_DATA_FORMAT_CONFIG, DEFAULT_DATA_FORMAT_INTL, DEFAULT_DATA_FORMAT_NOTATION, EU_NOTATION, US_NOTATION } from "./data-format/constants/dataFormatConfig.constants.js";
19
+ import { COMPACT_DECIMAL_LARGER_NUMBER, COMPACT_LARGER_NUMBER, DATE, DATETIME, DATE_CONSTANTS_TARGET_FORMATS, DEFAULT_FORMAT_DATE_OPTIONS, DEFAULT_FORMAT_MONTH_LONG_OPTIONS, DEFAULT_FORMAT_MONTH_SHORT_OPTIONS, DEFAULT_FORMAT_NUMBER_OPTIONS, DEFAULT_FORMAT_TIME_OPTIONS, DEFAULT_FORMAT_WEEKDAY_LONG_OPTIONS, DEFAULT_FORMAT_WEEKDAY_SHORT_OPTIONS, EU_DECIMAL_DELIMITER, EU_THOUSAND_DELIMITER, LARGER_NUMBER_LIMIT, LOWER_CASE, LOWER_FIRST, MONTHS_LONG, MONTHS_SHORT, MONTH_LONG, MONTH_SHORT, RELATIVE_FROM, RELATIVE_FROM_WITHOUT_SUFFIX, RELATIVE_TO, RELATIVE_TO_WITHOUT_SUFFIX, TIME, UPPER_CASE, UPPER_FIRST, US_DECIMAL_DELIMITER, US_THOUSAND_DELIMITER, WEEKDAYS_LONG, WEEKDAYS_SHORT, WEEKDAY_LONG, WEEKDAY_SHORT } from "./data-format/constants/dataFormat.constants.js";
20
+ import { LONG, MONTH, SHORT, WEEKDAY } from "./data-format/constants/dateTimeParts.constants.js";
21
+ import "./data-format/utils/timeZone.utils.js";
22
+ import { getDefaultDataTimeOptions } from "./data-format/utils/dataFormat.utils.js";
23
+ import "dayjs";
24
+ import { DataFormatConfigContext } from "./data-format/contexts/DataFormatConfigContext.js";
25
+ import { DataFormatIntlsContext } from "./data-format/contexts/DataFormatIntlsContext.js";
26
+ import { default as default5 } from "./testing/renderWithProvider/renderWithProvider.js";
27
+ import { sleep } from "./testing/sleep.js";
28
+ import "react/jsx-runtime";
29
+ import "react-hot-toast";
30
+ import { useToaster } from "./toaster/hooks/useToaster.js";
31
+ import { TOASTER_DEFAULTS } from "./toaster/constants.js";
32
+ import { ToasterContext } from "./toaster/contexts/ToasterContext.js";
33
+ import { ToasterProvider } from "./toaster/providers/ToasterProvider.js";
34
+ import { DropdownContext } from "./DropdownContext/DropdownContext.js";
35
+ import { DropdownContextProvider } from "./DropdownContext/DropdownContextProvider.js";
36
+ import { useDropdown } from "./DropdownContext/useDropdown.js";
37
+ export {
38
+ COMPACT_DECIMAL_LARGER_NUMBER,
39
+ COMPACT_LARGER_NUMBER,
40
+ DATE,
41
+ DATETIME,
42
+ DATE_CONSTANTS_TARGET_FORMATS,
43
+ DEFAULT_DATA_FORMAT_CONFIG,
44
+ DEFAULT_DATA_FORMAT_INTL,
45
+ DEFAULT_DATA_FORMAT_NOTATION,
46
+ DEFAULT_FORMAT_DATE_OPTIONS,
47
+ DEFAULT_FORMAT_MONTH_LONG_OPTIONS,
48
+ DEFAULT_FORMAT_MONTH_SHORT_OPTIONS,
49
+ DEFAULT_FORMAT_NUMBER_OPTIONS,
50
+ DEFAULT_FORMAT_TIME_OPTIONS,
51
+ DEFAULT_FORMAT_WEEKDAY_LONG_OPTIONS,
52
+ DEFAULT_FORMAT_WEEKDAY_SHORT_OPTIONS,
53
+ default2 as DSProvider,
54
+ DataFormatConfigContext,
55
+ DataFormatConfigProvider,
56
+ DataFormatIntlsContext,
57
+ DropdownContext,
58
+ DropdownContextProvider,
59
+ EU_DECIMAL_DELIMITER,
60
+ EU_NOTATION,
61
+ EU_THOUSAND_DELIMITER,
62
+ FormattedDate,
63
+ FormattedDateTime,
64
+ FormattedNumber,
65
+ FormattedRelativeDateTimeFrom,
66
+ FormattedRelativeDateTimeTo,
67
+ FormattedTime,
68
+ LARGER_NUMBER_LIMIT,
69
+ LONG,
70
+ LOWER_CASE,
71
+ LOWER_FIRST,
72
+ MONTH,
73
+ MONTHS_LONG,
74
+ MONTHS_SHORT,
75
+ MONTH_LONG,
76
+ MONTH_SHORT,
77
+ RELATIVE_FROM,
78
+ RELATIVE_FROM_WITHOUT_SUFFIX,
79
+ RELATIVE_TO,
80
+ RELATIVE_TO_WITHOUT_SUFFIX,
81
+ SHORT,
82
+ TIME,
83
+ TOASTER_DEFAULTS,
84
+ ToasterContext,
85
+ ToasterProvider,
86
+ UPPER_CASE,
87
+ UPPER_FIRST,
88
+ US_DECIMAL_DELIMITER,
89
+ US_NOTATION,
90
+ US_THOUSAND_DELIMITER,
91
+ WEEKDAY,
92
+ WEEKDAYS_LONG,
93
+ WEEKDAYS_SHORT,
94
+ WEEKDAY_LONG,
95
+ WEEKDAY_SHORT,
96
+ defaultColorsOrder,
97
+ getDataFormatConfigFromNotation,
98
+ getDefaultDataTimeOptions,
99
+ default3 as mediaQuery,
100
+ default5 as renderWithProvider,
101
+ sleep,
102
+ default4 as theme,
103
+ themeVariables,
104
+ useDataFormat,
105
+ useDataFormatConfig,
106
+ useDataFormatIntls,
107
+ useDataFormatUtils,
108
+ useDropdown,
109
+ useTheme,
110
+ useToaster,
111
+ withDataFormat
112
+ };
@@ -1,5 +1,5 @@
1
- import { type FlattenSimpleInterpolation, type SimpleInterpolation } from 'styled-components';
2
- import { type BreakpointKey } from '../DSProvider/ThemeProvider/breakpoints';
1
+ import { FlattenSimpleInterpolation, SimpleInterpolation } from 'styled-components';
2
+ import { BreakpointKey } from '../DSProvider/ThemeProvider/breakpoints';
3
3
  export type Media = {
4
4
  from: BreakpointsType;
5
5
  to: BreakpointsType;
@@ -1,36 +1,26 @@
1
- import { css } from 'styled-components';
2
- import breakpoints from '../DSProvider/ThemeProvider/breakpoints';
3
- export var MEDIA_FROM = Object.keys(breakpoints).reduce(function (acc, label) {
4
- var mediaTemplateFunction = function mediaTemplateFunction(strings) {
5
- for (var _len = arguments.length, interpolations = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
6
- interpolations[_key - 1] = arguments[_key];
7
- }
8
- return css(["@media (min-width:", "em){", ";}"], breakpoints[label].max / 16, css.apply(void 0, [strings].concat(interpolations)));
9
- };
1
+ import { css } from "styled-components";
2
+ import { breakpoints } from "../DSProvider/ThemeProvider/breakpoints.js";
3
+ const MEDIA_FROM = Object.keys(breakpoints).reduce((acc, label) => {
4
+ const mediaTemplateFunction = (strings, ...interpolations) => css(["@media (min-width:", "em){", ";}"], breakpoints[label].max / 16, css(strings, ...interpolations));
10
5
  acc[label] = mediaTemplateFunction;
11
6
  return acc;
12
7
  }, {});
13
- export var MEDIA_TO = Object.keys(breakpoints).reduce(function (acc, label) {
14
- acc[label] = function (strings) {
15
- for (var _len2 = arguments.length, interpolations = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
16
- interpolations[_key2 - 1] = arguments[_key2];
17
- }
18
- return css(["@media (max-width:", "em){", ";}"], breakpoints[label].max / 16, css.apply(void 0, [strings].concat(interpolations)));
19
- };
8
+ const MEDIA_TO = Object.keys(breakpoints).reduce((acc, label) => {
9
+ acc[label] = (strings, ...interpolations) => css(["@media (max-width:", "em){", ";}"], breakpoints[label].max / 16, css(strings, ...interpolations));
20
10
  return acc;
21
11
  }, {});
22
- export var MEDIA_ONLY = Object.keys(breakpoints).reduce(function (acc, label) {
23
- acc[label] = function (strings) {
24
- for (var _len3 = arguments.length, interpolations = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
25
- interpolations[_key3 - 1] = arguments[_key3];
26
- }
27
- return css(["@media (min-width:", "em) and (max-width:", "em){", ";}"], breakpoints[label].min / 16, breakpoints[label].max / 16, css.apply(void 0, [strings].concat(interpolations)));
28
- };
12
+ const MEDIA_ONLY = Object.keys(breakpoints).reduce((acc, label) => {
13
+ acc[label] = (strings, ...interpolations) => css(["@media (min-width:", "em) and (max-width:", "em){", ";}"], breakpoints[label].min / 16, breakpoints[label].max / 16, css(strings, ...interpolations));
29
14
  return acc;
30
15
  }, {});
31
- var mediaQuery = {
16
+ const mediaQuery = {
32
17
  from: MEDIA_FROM,
33
18
  to: MEDIA_TO,
34
19
  only: MEDIA_ONLY
35
20
  };
36
- export default mediaQuery;
21
+ export {
22
+ MEDIA_FROM,
23
+ MEDIA_ONLY,
24
+ MEDIA_TO,
25
+ mediaQuery as default
26
+ };
@@ -1,2 +0,0 @@
1
- import '../style/core.less';
2
- import '../style/variables.less';
package/dist/js/style.js CHANGED
@@ -1,2 +1 @@
1
- import "../style/core.css";
2
- import "../style/variables.css";
1
+ import "./../style/core.css";
@@ -1,2 +1,6 @@
1
- export { default as renderWithProvider } from './renderWithProvider/renderWithProvider';
2
- export { sleep } from './sleep';
1
+ import { default as default2 } from "./renderWithProvider/renderWithProvider.js";
2
+ import { sleep } from "./sleep.js";
3
+ export {
4
+ default2 as renderWithProvider,
5
+ sleep
6
+ };
@@ -1,7 +1,7 @@
1
- import { type ReactNode } from 'react';
2
- import { type RenderOptions, type RenderResult } from '@testing-library/react';
3
- import { type DSProviderProps } from '../../DSProvider/DSProvider';
4
- import { type DataFormatNotationType } from '../../data-format';
1
+ import { ReactNode } from 'react';
2
+ import { RenderOptions, RenderResult } from '@testing-library/react';
3
+ import { DSProviderProps } from '../../DSProvider/DSProvider';
4
+ import { DataFormatNotationType } from '../../data-format';
5
5
  type Options = Omit<RenderOptions, 'queries'>;
6
6
  declare const renderWithProvider: (node: ReactNode, options?: Options, props?: Partial<Omit<DSProviderProps, "onErrorIntl" | "dataFormatConfig">> & {
7
7
  notation?: DataFormatNotationType;