@semcore/date-picker 2.8.3 → 2.8.4

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 (37) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/DatePicker.js +1 -1
  3. package/lib/cjs/components/ButtonTrigger.js +3 -9
  4. package/lib/cjs/components/ButtonTrigger.js.map +1 -1
  5. package/lib/cjs/components/Calendar.js +5 -5
  6. package/lib/cjs/components/PickerAbstract.js +1 -2
  7. package/lib/cjs/components/PickerAbstract.js.map +1 -1
  8. package/lib/cjs/components/RangePickerAbstract.js +2 -4
  9. package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
  10. package/lib/cjs/components/index.js +13 -18
  11. package/lib/cjs/components/index.js.map +1 -1
  12. package/lib/cjs/index.d.ts +355 -0
  13. package/lib/cjs/index.js +5 -39
  14. package/lib/cjs/index.js.map +1 -1
  15. package/lib/cjs/utils/shortDateRangeFormat.js +1 -0
  16. package/lib/cjs/utils/shortDateRangeFormat.js.map +1 -1
  17. package/lib/es6/DatePicker.js +1 -1
  18. package/lib/es6/components/ButtonTrigger.js +3 -9
  19. package/lib/es6/components/ButtonTrigger.js.map +1 -1
  20. package/lib/es6/components/Calendar.js +5 -5
  21. package/lib/es6/components/PickerAbstract.js +1 -2
  22. package/lib/es6/components/PickerAbstract.js.map +1 -1
  23. package/lib/es6/components/RangePickerAbstract.js +2 -4
  24. package/lib/es6/components/RangePickerAbstract.js.map +1 -1
  25. package/lib/es6/components/index.js +13 -18
  26. package/lib/es6/components/index.js.map +1 -1
  27. package/lib/es6/index.d.ts +355 -0
  28. package/lib/es6/index.js +0 -3
  29. package/lib/es6/index.js.map +1 -1
  30. package/lib/es6/utils/shortDateRangeFormat.js +1 -0
  31. package/lib/es6/utils/shortDateRangeFormat.js.map +1 -1
  32. package/package.json +5 -2
  33. package/src/components/ButtonTrigger.jsx +2 -3
  34. package/src/components/PickerAbstract.jsx +0 -1
  35. package/src/components/RangePickerAbstract.jsx +10 -10
  36. package/src/index.js +0 -3
  37. package/src/utils/shortDateRangeFormat.js +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/shortDateRangeFormat.js"],"names":["dayjs","getDayJSLocale","locale","includes","shortDateRangeFormat","dates","options","Intl","DateTimeFormat","format","normalizeDates","map","date","toDate","monthsYears","month","year","length","isSimilarDay","isSimilarMonth","isSimilarYear","day","getDate","getFullYear","newOptions"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;;AAEA,SAASC,cAAT,CAAwBC,MAAxB,EAAgC;AAC9B,MAAIA,MAAM,CAACC,QAAP,CAAgB,IAAhB,KAAyBD,MAAM,CAACC,QAAP,CAAgB,IAAhB,CAA7B,EAAoD;AAClD,WAAO,IAAP;AACD;;AACD,SAAO,IAAP;AACD;;AAED,eAAe,SAASC,oBAAT,CAA8BC,KAA9B,QAAuE;AAAA,yBAAhCH,MAAgC;AAAA,MAAhCA,MAAgC,4BAAvB,OAAuB;AAAA,MAAXI,OAAW;;AACpF,6BAAmB,IAAIC,IAAI,CAACC,cAAT,CAAwBN,MAAxB,EAAgCI,OAAhC,CAAnB;AAAA,MAAQG,MAAR,wBAAQA,MAAR;;AACA,MAAMC,cAAc,GAAGL,KAAK,CAACM,GAAN,CAAU,UAACC,IAAD;AAAA,WAAUZ,KAAK,CAACY,IAAD,CAAL,CAAYC,MAAZ,EAAV;AAAA,GAAV,CAAvB;AACA,MAAMC,WAAW,GAAGT,KAAK,CAACM,GAAN,CAAU,UAACC,IAAD;AAAA,WAAU,CACtCZ,KAAK,CAACY,IAAD,CAAL,CAAYA,IAAZ,EADsC,EAEtCZ,KAAK,CAACY,IAAD,CAAL,CAAYG,KAAZ,EAFsC,EAGtCf,KAAK,CAACY,IAAD,CAAL,CAAYI,IAAZ,EAHsC,CAAV;AAAA,GAAV,CAApB;;AAMA,MAAIF,WAAW,CAACG,MAAZ,GAAqB,CAAzB,EAA4B;AAC1B,QAAMC,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BAEO,IAAIH,IAAI,CAACC,cAAT,CAAwBN,MAAxB,EAAgCsB,UAAhC,EAA4Cf,MAA5C,CACLC,cAAc,CAAC,CAAD,CADT,CAFP,cAIKA,cAAc,CAAC,CAAD,CAAd,CAAkBa,WAAlB,EAJL;AAKD;;AAED,qBAAUd,MAAM,CAACC,cAAc,CAAC,CAAD,CAAf,CAAhB,gBAAyCD,MAAM,CAACC,cAAc,CAAC,CAAD,CAAf,CAA/C;AACD;;AAED,SAAOD,MAAM,CAACC,cAAc,CAAC,CAAD,CAAf,CAAb;AACD","sourcesContent":["import dayjs from 'dayjs';\n\nfunction getDayJSLocale(locale) {\n if (locale.includes('en') || locale.includes('ja')) {\n return 'en';\n }\n return 'ru';\n}\n\nexport default function shortDateRangeFormat(dates, { locale = 'en-US', ...options }) {\n const { format } = new Intl.DateTimeFormat(locale, options);\n const normalizeDates = dates.map((date) => dayjs(date).toDate());\n const monthsYears = dates.map((date) => [\n dayjs(date).date(),\n dayjs(date).month(),\n dayjs(date).year(),\n ]);\n\n if (monthsYears.length > 1) {\n const isSimilarDay = monthsYears[0][0] === monthsYears[1][0];\n const isSimilarMonth = monthsYears[0][1] === monthsYears[1][1];\n const isSimilarYear = monthsYears[0][2] === monthsYears[1][2];\n\n if (isSimilarMonth && isSimilarYear && !options.day) {\n return format(normalizeDates[0]);\n }\n if (isSimilarMonth && isSimilarYear) {\n if (getDayJSLocale(locale) === 'en') {\n if (isSimilarDay) {\n return `${new Intl.DateTimeFormat(locale, { month: options.month }).format(\n normalizeDates[0],\n )} ${normalizeDates[0].getDate()}, ${normalizeDates[0].getFullYear()}`;\n }\n return `${new Intl.DateTimeFormat(locale, { month: options.month }).format(\n normalizeDates[0],\n )} ${normalizeDates[0].getDate()} - ${normalizeDates[1].getDate()}, ${normalizeDates[0].getFullYear()}`;\n }\n if (isSimilarDay) {\n return `${normalizeDates[0].getDate()} ${new Intl.DateTimeFormat(locale, {\n month: options.month,\n }).format(normalizeDates[0])} ${normalizeDates[0].getFullYear()}`;\n }\n return `${normalizeDates[0].getDate()} - ${normalizeDates[1].getDate()} ${new Intl.DateTimeFormat(\n locale,\n { month: options.month },\n ).format(normalizeDates[0])} ${normalizeDates[0].getFullYear()}`;\n }\n\n if (isSimilarYear) {\n const { year, ...newOptions } = options;\n if (getDayJSLocale(locale) === 'en') {\n return `${new Intl.DateTimeFormat(locale, newOptions).format(\n normalizeDates[0],\n )} - ${new Intl.DateTimeFormat(locale, newOptions).format(\n normalizeDates[1],\n )}, ${normalizeDates[0].getFullYear()}`;\n }\n return `${new Intl.DateTimeFormat(locale, newOptions).format(\n normalizeDates[0],\n )} - ${new Intl.DateTimeFormat(locale, newOptions).format(\n normalizeDates[1],\n )} ${normalizeDates[0].getFullYear()}`;\n }\n\n return `${format(normalizeDates[0])} - ${format(normalizeDates[1])}`;\n }\n\n return format(normalizeDates[0]);\n}\n"],"file":"shortDateRangeFormat.js"}
1
+ {"version":3,"sources":["../../../src/utils/shortDateRangeFormat.js"],"names":["dayjs","getDayJSLocale","locale","includes","shortDateRangeFormat","dates","options","Intl","DateTimeFormat","format","normalizeDates","map","date","toDate","monthsYears","month","year","length","isSimilarDay","isSimilarMonth","isSimilarYear","day","getDate","getFullYear","newOptions"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;;AAEA,SAASC,cAAT,CAAwBC,MAAxB,EAAgC;AAC9B,MAAIA,MAAM,CAACC,QAAP,CAAgB,IAAhB,KAAyBD,MAAM,CAACC,QAAP,CAAgB,IAAhB,CAA7B,EAAoD;AAClD,WAAO,IAAP;AACD;;AACD,SAAO,IAAP;AACD;;AAED,eAAe,SAASC,oBAAT,CAA8BC,KAA9B,QAAuE;AAAA,yBAAhCH,MAAgC;AAAA,MAAhCA,MAAgC,4BAAvB,OAAuB;AAAA,MAAXI,OAAW;;AACpF,6BAAmB,IAAIC,IAAI,CAACC,cAAT,CAAwBN,MAAxB,EAAgCI,OAAhC,CAAnB;AAAA,MAAQG,MAAR,wBAAQA,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AACA,UAAIL,cAAc,CAACC,MAAD,CAAd,KAA2B,IAA/B,EAAqC;AACnC,yBAAU,IAAIK,IAAI,CAACC,cAAT,CAAwBN,MAAxB,EAAgCsB,UAAhC,EAA4Cf,MAA5C,CACRC,cAAc,CAAC,CAAD,CADN,CAAV,gBAEO,IAAIH,IAAI,CAACC,cAAT,CAAwBN,MAAxB,EAAgCsB,UAAhC,EAA4Cf,MAA5C,CACLC,cAAc,CAAC,CAAD,CADT,CAFP,eAIMA,cAAc,CAAC,CAAD,CAAd,CAAkBa,WAAlB,EAJN;AAKD;;AACD,uBAAU,IAAIhB,IAAI,CAACC,cAAT,CAAwBN,MAAxB,EAAgCsB,UAAhC,EAA4Cf,MAA5C,CACRC,cAAc,CAAC,CAAD,CADN,CAAV,gBAEO,IAAIH,IAAI,CAACC,cAAT,CAAwBN,MAAxB,EAAgCsB,UAAhC,EAA4Cf,MAA5C,CACLC,cAAc,CAAC,CAAD,CADT,CAFP,cAIKA,cAAc,CAAC,CAAD,CAAd,CAAkBa,WAAlB,EAJL;AAKD;;AAED,qBAAUd,MAAM,CAACC,cAAc,CAAC,CAAD,CAAf,CAAhB,gBAAyCD,MAAM,CAACC,cAAc,CAAC,CAAD,CAAf,CAA/C;AACD;;AAED,SAAOD,MAAM,CAACC,cAAc,CAAC,CAAD,CAAf,CAAb;AACD","sourcesContent":["import dayjs from 'dayjs';\n\nfunction getDayJSLocale(locale) {\n if (locale.includes('en') || locale.includes('ja')) {\n return 'en';\n }\n return 'ru';\n}\n\nexport default function shortDateRangeFormat(dates, { locale = 'en-US', ...options }) {\n const { format } = new Intl.DateTimeFormat(locale, options);\n const normalizeDates = dates.map((date) => dayjs(date).toDate());\n const monthsYears = dates.map((date) => [\n dayjs(date).date(),\n dayjs(date).month(),\n dayjs(date).year(),\n ]);\n\n if (monthsYears.length > 1) {\n const isSimilarDay = monthsYears[0][0] === monthsYears[1][0];\n const isSimilarMonth = monthsYears[0][1] === monthsYears[1][1];\n const isSimilarYear = monthsYears[0][2] === monthsYears[1][2];\n\n if (isSimilarMonth && isSimilarYear && !options.day) {\n return format(normalizeDates[0]);\n }\n if (isSimilarMonth && isSimilarYear) {\n if (getDayJSLocale(locale) === 'en') {\n if (isSimilarDay) {\n return `${new Intl.DateTimeFormat(locale, { month: options.month }).format(\n normalizeDates[0],\n )} ${normalizeDates[0].getDate()}, ${normalizeDates[0].getFullYear()}`;\n }\n return `${new Intl.DateTimeFormat(locale, { month: options.month }).format(\n normalizeDates[0],\n )} ${normalizeDates[0].getDate()} - ${normalizeDates[1].getDate()}, ${normalizeDates[0].getFullYear()}`;\n }\n if (isSimilarDay) {\n return `${normalizeDates[0].getDate()} ${new Intl.DateTimeFormat(locale, {\n month: options.month,\n }).format(normalizeDates[0])} ${normalizeDates[0].getFullYear()}`;\n }\n return `${normalizeDates[0].getDate()} - ${normalizeDates[1].getDate()} ${new Intl.DateTimeFormat(\n locale,\n { month: options.month },\n ).format(normalizeDates[0])} ${normalizeDates[0].getFullYear()}`;\n }\n\n if (isSimilarYear) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { year, ...newOptions } = options;\n if (getDayJSLocale(locale) === 'en') {\n return `${new Intl.DateTimeFormat(locale, newOptions).format(\n normalizeDates[0],\n )} - ${new Intl.DateTimeFormat(locale, newOptions).format(\n normalizeDates[1],\n )}, ${normalizeDates[0].getFullYear()}`;\n }\n return `${new Intl.DateTimeFormat(locale, newOptions).format(\n normalizeDates[0],\n )} - ${new Intl.DateTimeFormat(locale, newOptions).format(\n normalizeDates[1],\n )} ${normalizeDates[0].getFullYear()}`;\n }\n\n return `${format(normalizeDates[0])} - ${format(normalizeDates[1])}`;\n }\n\n return format(normalizeDates[0]);\n}\n"],"file":"shortDateRangeFormat.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/date-picker",
3
3
  "description": "SEMRush DatePicker Component",
4
- "version": "2.8.3",
4
+ "version": "2.8.4",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "@semcore/icon": "^2.16",
22
22
  "@semcore/dropdown": "^2",
23
23
  "@semcore/typography": "^3",
24
- "dayjs": "^1.8"
24
+ "dayjs": "1.8.36"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@semcore/core": "^1.11",
@@ -34,5 +34,8 @@
34
34
  "type": "git",
35
35
  "url": "https://github.com/semrush/intergalactic.git",
36
36
  "directory": "semcore/date-picker"
37
+ },
38
+ "devDependencies": {
39
+ "@semcore/jest-preset-ui": "1.0.0"
37
40
  }
38
41
  }
@@ -1,11 +1,10 @@
1
- import React, { ComponentProps } from 'react';
1
+ import React from 'react';
2
2
  import BaseTrigger from '@semcore/base-trigger';
3
- import { Box } from '@semcore/flex-box';
4
3
  import addonTextChildren from '@semcore/utils/lib/addonTextChildren';
5
4
  import Calendar from '@semcore/icon/Calendar/m';
6
5
  import createComponent, { Root } from '@semcore/core';
7
6
 
8
- const ButtonTriggerRoot = ({ Children, size }) => {
7
+ const ButtonTriggerRoot = ({ Children }) => {
9
8
  return (
10
9
  <Root render={BaseTrigger}>
11
10
  <ButtonTrigger.Addon tag={Calendar} />
@@ -131,7 +131,6 @@ class PickerAbstract extends Component {
131
131
  }
132
132
 
133
133
  getPopperProps() {
134
- const { interaction } = this.asProps;
135
134
  const Picker = this[CORE_INSTANCE];
136
135
  return {
137
136
  tabIndex: 0,
@@ -109,7 +109,7 @@ class RangePickerAbstract extends Component {
109
109
  const day = this.keyDiff[e.keyCode];
110
110
 
111
111
  const setNextDisplayedPeriod = (next_highlighted) => {
112
- const [_, right_period] = next_highlighted;
112
+ const [, right_period] = next_highlighted;
113
113
 
114
114
  if (right_period) {
115
115
  const month_right_period = right_period.getMonth();
@@ -193,13 +193,7 @@ class RangePickerAbstract extends Component {
193
193
 
194
194
  getPopperProps() {
195
195
  const Picker = this[CORE_INSTANCE];
196
- const {
197
- value,
198
- periods = this.getDefaultPeriods(),
199
- unclearable,
200
- getI18nText,
201
- interaction,
202
- } = this.asProps;
196
+ const { value, periods = this.getDefaultPeriods(), unclearable, getI18nText } = this.asProps;
203
197
  const { dirtyValue } = this.state;
204
198
 
205
199
  const buttons = (
@@ -292,8 +286,14 @@ class RangePickerAbstract extends Component {
292
286
  }
293
287
 
294
288
  getCalendarProps(props, index) {
295
- const { locale, displayedPeriod, disabled, value, highlighted, onHighlightedChange } =
296
- this.asProps;
289
+ const {
290
+ locale,
291
+ displayedPeriod,
292
+ disabled,
293
+ value,
294
+ highlighted,
295
+ onHighlightedChange,
296
+ } = this.asProps;
297
297
  const { dirtyValue } = this.state;
298
298
 
299
299
  return {
package/src/index.js CHANGED
@@ -2,10 +2,7 @@ export { default as DatePicker } from './DatePicker';
2
2
  export * from './DatePicker';
3
3
 
4
4
  export { default as DateRangePicker } from './DateRangePicker';
5
- export * from './DateRangePicker';
6
5
 
7
6
  export { default as MonthPicker } from './MonthPicker';
8
- export * from './MonthPicker';
9
7
 
10
8
  export { default as MonthRangePicker } from './MonthRangePicker';
11
- export * from './MonthRangePicker';
@@ -47,6 +47,7 @@ export default function shortDateRangeFormat(dates, { locale = 'en-US', ...optio
47
47
  }
48
48
 
49
49
  if (isSimilarYear) {
50
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
50
51
  const { year, ...newOptions } = options;
51
52
  if (getDayJSLocale(locale) === 'en') {
52
53
  return `${new Intl.DateTimeFormat(locale, newOptions).format(