@jobber/components 9.14.2 → 9.14.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 (60) hide show
  1. package/dist/ActivityIndicator-cjs.js +1 -1
  2. package/dist/ActivityIndicator-es.js +1 -1
  3. package/dist/ConfirmationModal-cjs.js +1 -1
  4. package/dist/ConfirmationModal-es.js +1 -1
  5. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +3 -2
  6. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +3 -2
  7. package/dist/DataList/components/DataListFilters/index.cjs +3 -2
  8. package/dist/DataList/components/DataListFilters/index.mjs +3 -2
  9. package/dist/DataList/components/DataListTotalCount/DataListTotalCount.messages.d.ts +9 -7
  10. package/dist/DataList/index.cjs +1 -0
  11. package/dist/DataList/index.mjs +1 -0
  12. package/dist/DataListTotalCount-cjs.js +11 -9
  13. package/dist/DataListTotalCount-es.js +11 -9
  14. package/dist/DatePicker/index.cjs +2 -1
  15. package/dist/DatePicker/index.mjs +2 -1
  16. package/dist/DatePicker-cjs.js +70 -708
  17. package/dist/DatePicker-es.js +68 -706
  18. package/dist/FilterPicker/FilterPicker.messages.d.ts +51 -0
  19. package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentHeader/index.cjs +3 -0
  20. package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentHeader/index.mjs +3 -0
  21. package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentList/index.cjs +1 -0
  22. package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentList/index.mjs +1 -0
  23. package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentSearch/index.cjs +3 -0
  24. package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentSearch/index.mjs +3 -0
  25. package/dist/FilterPicker/components/FilterPickerContent/index.cjs +3 -2
  26. package/dist/FilterPicker/components/FilterPickerContent/index.mjs +3 -2
  27. package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +1 -0
  28. package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +1 -0
  29. package/dist/FilterPicker/index.cjs +3 -2
  30. package/dist/FilterPicker/index.mjs +3 -2
  31. package/dist/FilterPicker.messages-cjs.js +58 -0
  32. package/dist/FilterPicker.messages-es.js +56 -0
  33. package/dist/FilterPickerContentHeader-cjs.js +12 -8
  34. package/dist/FilterPickerContentHeader-es.js +12 -8
  35. package/dist/FilterPickerContentList-cjs.js +10 -10
  36. package/dist/FilterPickerContentList-es.js +10 -10
  37. package/dist/FilterPickerContentSearch-cjs.js +8 -2
  38. package/dist/FilterPickerContentSearch-es.js +8 -2
  39. package/dist/FilterPickerTrigger-cjs.js +7 -2
  40. package/dist/FilterPickerTrigger-es.js +7 -2
  41. package/dist/InputDate/index.cjs +1 -0
  42. package/dist/InputDate/index.mjs +1 -0
  43. package/dist/Spinner-cjs.js +1 -1
  44. package/dist/Spinner-es.js +1 -1
  45. package/dist/dateLocale-cjs.js +1146 -0
  46. package/dist/dateLocale-es.js +1142 -0
  47. package/dist/docs/AtlantisThemeContext/AtlantisThemeContext.md +24 -9
  48. package/dist/docs/FilterPicker/FilterPicker.md +9 -4
  49. package/dist/docs/Icon/Icon.md +1 -0
  50. package/dist/index.cjs +2 -0
  51. package/dist/index.mjs +2 -0
  52. package/dist/sharedHelpers/i18n/dateLocale.d.ts +2 -0
  53. package/dist/sharedHelpers/i18n/index.cjs +3 -0
  54. package/dist/sharedHelpers/i18n/index.d.ts +1 -0
  55. package/dist/sharedHelpers/i18n/index.mjs +1 -0
  56. package/dist/sharedHelpers/i18n/releasedLanguages.d.ts +7 -0
  57. package/dist/sharedHelpers/i18n/useAtlantisI18n.d.ts +17 -6
  58. package/dist/useAtlantisI18n-cjs.js +23 -1
  59. package/dist/useAtlantisI18n-es.js +23 -1
  60. package/package.json +4 -3
@@ -4,6 +4,7 @@ var React = require('react');
4
4
  var classnames = require('classnames');
5
5
  var floatingUi_react = require('./floating-ui.react-cjs.js');
6
6
  var ReactDOM = require('react-dom');
7
+ var dateLocale = require('./dateLocale-cjs.js');
7
8
  var jobberHooks = require('@jobber/hooks');
8
9
  var useAtlantisI18n = require('./useAtlantisI18n-cjs.js');
9
10
  var AtlantisContext = require('./AtlantisContext-cjs.js');
@@ -19,8 +20,6 @@ var isTypedArray = require('./isTypedArray-cjs.js');
19
20
  var _baseFlatten = require('./_baseFlatten-cjs.js');
20
21
  var _setToString = require('./_setToString-cjs.js');
21
22
 
22
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
23
-
24
23
  /**
25
24
  * @module constants
26
25
  * @summary Useful constants
@@ -133,6 +132,20 @@ function constructFrom(date, value) {
133
132
  return new Date(value);
134
133
  }
135
134
 
135
+ function normalizeDates(context, ...dates) {
136
+ const normalize = constructFrom.bind(
137
+ null,
138
+ dates.find((date) => typeof date === "object"),
139
+ );
140
+ return dates.map(normalize);
141
+ }
142
+
143
+ let defaultOptions = {};
144
+
145
+ function getDefaultOptions$1() {
146
+ return defaultOptions;
147
+ }
148
+
136
149
  /**
137
150
  * @name toDate
138
151
  * @category Common Helpers
@@ -176,6 +189,57 @@ function toDate(argument, context) {
176
189
  return constructFrom(context || argument, argument);
177
190
  }
178
191
 
192
+ /**
193
+ * The {@link startOfWeek} function options.
194
+ */
195
+
196
+ /**
197
+ * @name startOfWeek
198
+ * @category Week Helpers
199
+ * @summary Return the start of a week for the given date.
200
+ *
201
+ * @description
202
+ * Return the start of a week for the given date.
203
+ * The result will be in the local timezone.
204
+ *
205
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
206
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
207
+ *
208
+ * @param date - The original date
209
+ * @param options - An object with options
210
+ *
211
+ * @returns The start of a week
212
+ *
213
+ * @example
214
+ * // The start of a week for 2 September 2014 11:55:00:
215
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
216
+ * //=> Sun Aug 31 2014 00:00:00
217
+ *
218
+ * @example
219
+ * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
220
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
221
+ * //=> Mon Sep 01 2014 00:00:00
222
+ */
223
+ function startOfWeek(date, options) {
224
+ const defaultOptions = getDefaultOptions$1();
225
+ const weekStartsOn =
226
+ options?.weekStartsOn ??
227
+ options?.locale?.options?.weekStartsOn ??
228
+ defaultOptions.weekStartsOn ??
229
+ defaultOptions.locale?.options?.weekStartsOn ??
230
+ 0;
231
+
232
+ const _date = toDate(date, options?.in);
233
+ const day = _date.getDay();
234
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
235
+
236
+ _date.setDate(_date.getDate() - diff);
237
+ _date.setHours(0, 0, 0, 0);
238
+ return _date;
239
+ }
240
+
241
+ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
242
+
179
243
  /**
180
244
  * The {@link addDays} function options.
181
245
  */
@@ -344,61 +408,6 @@ function addHours(date, amount, options) {
344
408
  return addMilliseconds(date, amount * millisecondsInHour);
345
409
  }
346
410
 
347
- let defaultOptions = {};
348
-
349
- function getDefaultOptions$1() {
350
- return defaultOptions;
351
- }
352
-
353
- /**
354
- * The {@link startOfWeek} function options.
355
- */
356
-
357
- /**
358
- * @name startOfWeek
359
- * @category Week Helpers
360
- * @summary Return the start of a week for the given date.
361
- *
362
- * @description
363
- * Return the start of a week for the given date.
364
- * The result will be in the local timezone.
365
- *
366
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
367
- * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
368
- *
369
- * @param date - The original date
370
- * @param options - An object with options
371
- *
372
- * @returns The start of a week
373
- *
374
- * @example
375
- * // The start of a week for 2 September 2014 11:55:00:
376
- * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
377
- * //=> Sun Aug 31 2014 00:00:00
378
- *
379
- * @example
380
- * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
381
- * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
382
- * //=> Mon Sep 01 2014 00:00:00
383
- */
384
- function startOfWeek(date, options) {
385
- const defaultOptions = getDefaultOptions$1();
386
- const weekStartsOn =
387
- options?.weekStartsOn ??
388
- options?.locale?.options?.weekStartsOn ??
389
- defaultOptions.weekStartsOn ??
390
- defaultOptions.locale?.options?.weekStartsOn ??
391
- 0;
392
-
393
- const _date = toDate(date, options?.in);
394
- const day = _date.getDay();
395
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
396
-
397
- _date.setDate(_date.getDate() - diff);
398
- _date.setHours(0, 0, 0, 0);
399
- return _date;
400
- }
401
-
402
411
  /**
403
412
  * The {@link startOfISOWeek} function options.
404
413
  */
@@ -506,14 +515,6 @@ function getTimezoneOffsetInMilliseconds(date) {
506
515
  return +date - +utcDate;
507
516
  }
508
517
 
509
- function normalizeDates(context, ...dates) {
510
- const normalize = constructFrom.bind(
511
- null,
512
- dates.find((date) => typeof date === "object"),
513
- );
514
- return dates.map(normalize);
515
- }
516
-
517
518
  /**
518
519
  * The {@link startOfDay} function options.
519
520
  */
@@ -1491,646 +1492,6 @@ function endOfWeek(date, options) {
1491
1492
  return _date;
1492
1493
  }
1493
1494
 
1494
- const formatDistanceLocale = {
1495
- lessThanXSeconds: {
1496
- one: "less than a second",
1497
- other: "less than {{count}} seconds",
1498
- },
1499
-
1500
- xSeconds: {
1501
- one: "1 second",
1502
- other: "{{count}} seconds",
1503
- },
1504
-
1505
- halfAMinute: "half a minute",
1506
-
1507
- lessThanXMinutes: {
1508
- one: "less than a minute",
1509
- other: "less than {{count}} minutes",
1510
- },
1511
-
1512
- xMinutes: {
1513
- one: "1 minute",
1514
- other: "{{count}} minutes",
1515
- },
1516
-
1517
- aboutXHours: {
1518
- one: "about 1 hour",
1519
- other: "about {{count}} hours",
1520
- },
1521
-
1522
- xHours: {
1523
- one: "1 hour",
1524
- other: "{{count}} hours",
1525
- },
1526
-
1527
- xDays: {
1528
- one: "1 day",
1529
- other: "{{count}} days",
1530
- },
1531
-
1532
- aboutXWeeks: {
1533
- one: "about 1 week",
1534
- other: "about {{count}} weeks",
1535
- },
1536
-
1537
- xWeeks: {
1538
- one: "1 week",
1539
- other: "{{count}} weeks",
1540
- },
1541
-
1542
- aboutXMonths: {
1543
- one: "about 1 month",
1544
- other: "about {{count}} months",
1545
- },
1546
-
1547
- xMonths: {
1548
- one: "1 month",
1549
- other: "{{count}} months",
1550
- },
1551
-
1552
- aboutXYears: {
1553
- one: "about 1 year",
1554
- other: "about {{count}} years",
1555
- },
1556
-
1557
- xYears: {
1558
- one: "1 year",
1559
- other: "{{count}} years",
1560
- },
1561
-
1562
- overXYears: {
1563
- one: "over 1 year",
1564
- other: "over {{count}} years",
1565
- },
1566
-
1567
- almostXYears: {
1568
- one: "almost 1 year",
1569
- other: "almost {{count}} years",
1570
- },
1571
- };
1572
-
1573
- const formatDistance = (token, count, options) => {
1574
- let result;
1575
-
1576
- const tokenValue = formatDistanceLocale[token];
1577
- if (typeof tokenValue === "string") {
1578
- result = tokenValue;
1579
- } else if (count === 1) {
1580
- result = tokenValue.one;
1581
- } else {
1582
- result = tokenValue.other.replace("{{count}}", count.toString());
1583
- }
1584
-
1585
- if (options?.addSuffix) {
1586
- if (options.comparison && options.comparison > 0) {
1587
- return "in " + result;
1588
- } else {
1589
- return result + " ago";
1590
- }
1591
- }
1592
-
1593
- return result;
1594
- };
1595
-
1596
- function buildFormatLongFn(args) {
1597
- return (options = {}) => {
1598
- // TODO: Remove String()
1599
- const width = options.width ? String(options.width) : args.defaultWidth;
1600
- const format = args.formats[width] || args.formats[args.defaultWidth];
1601
- return format;
1602
- };
1603
- }
1604
-
1605
- const dateFormats = {
1606
- full: "EEEE, MMMM do, y",
1607
- long: "MMMM do, y",
1608
- medium: "MMM d, y",
1609
- short: "MM/dd/yyyy",
1610
- };
1611
-
1612
- const timeFormats = {
1613
- full: "h:mm:ss a zzzz",
1614
- long: "h:mm:ss a z",
1615
- medium: "h:mm:ss a",
1616
- short: "h:mm a",
1617
- };
1618
-
1619
- const dateTimeFormats = {
1620
- full: "{{date}} 'at' {{time}}",
1621
- long: "{{date}} 'at' {{time}}",
1622
- medium: "{{date}}, {{time}}",
1623
- short: "{{date}}, {{time}}",
1624
- };
1625
-
1626
- const formatLong = {
1627
- date: buildFormatLongFn({
1628
- formats: dateFormats,
1629
- defaultWidth: "full",
1630
- }),
1631
-
1632
- time: buildFormatLongFn({
1633
- formats: timeFormats,
1634
- defaultWidth: "full",
1635
- }),
1636
-
1637
- dateTime: buildFormatLongFn({
1638
- formats: dateTimeFormats,
1639
- defaultWidth: "full",
1640
- }),
1641
- };
1642
-
1643
- const formatRelativeLocale = {
1644
- lastWeek: "'last' eeee 'at' p",
1645
- yesterday: "'yesterday at' p",
1646
- today: "'today at' p",
1647
- tomorrow: "'tomorrow at' p",
1648
- nextWeek: "eeee 'at' p",
1649
- other: "P",
1650
- };
1651
-
1652
- const formatRelative = (token, _date, _baseDate, _options) =>
1653
- formatRelativeLocale[token];
1654
-
1655
- /**
1656
- * The localize function argument callback which allows to convert raw value to
1657
- * the actual type.
1658
- *
1659
- * @param value - The value to convert
1660
- *
1661
- * @returns The converted value
1662
- */
1663
-
1664
- /**
1665
- * The map of localized values for each width.
1666
- */
1667
-
1668
- /**
1669
- * The index type of the locale unit value. It types conversion of units of
1670
- * values that don't start at 0 (i.e. quarters).
1671
- */
1672
-
1673
- /**
1674
- * Converts the unit value to the tuple of values.
1675
- */
1676
-
1677
- /**
1678
- * The tuple of localized era values. The first element represents BC,
1679
- * the second element represents AD.
1680
- */
1681
-
1682
- /**
1683
- * The tuple of localized quarter values. The first element represents Q1.
1684
- */
1685
-
1686
- /**
1687
- * The tuple of localized day values. The first element represents Sunday.
1688
- */
1689
-
1690
- /**
1691
- * The tuple of localized month values. The first element represents January.
1692
- */
1693
-
1694
- function buildLocalizeFn(args) {
1695
- return (value, options) => {
1696
- const context = options?.context ? String(options.context) : "standalone";
1697
-
1698
- let valuesArray;
1699
- if (context === "formatting" && args.formattingValues) {
1700
- const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1701
- const width = options?.width ? String(options.width) : defaultWidth;
1702
-
1703
- valuesArray =
1704
- args.formattingValues[width] || args.formattingValues[defaultWidth];
1705
- } else {
1706
- const defaultWidth = args.defaultWidth;
1707
- const width = options?.width ? String(options.width) : args.defaultWidth;
1708
-
1709
- valuesArray = args.values[width] || args.values[defaultWidth];
1710
- }
1711
- const index = args.argumentCallback ? args.argumentCallback(value) : value;
1712
-
1713
- // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
1714
- return valuesArray[index];
1715
- };
1716
- }
1717
-
1718
- const eraValues = {
1719
- narrow: ["B", "A"],
1720
- abbreviated: ["BC", "AD"],
1721
- wide: ["Before Christ", "Anno Domini"],
1722
- };
1723
-
1724
- const quarterValues = {
1725
- narrow: ["1", "2", "3", "4"],
1726
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
1727
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
1728
- };
1729
-
1730
- // Note: in English, the names of days of the week and months are capitalized.
1731
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1732
- // Generally, formatted dates should look like they are in the middle of a sentence,
1733
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
1734
- const monthValues = {
1735
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
1736
- abbreviated: [
1737
- "Jan",
1738
- "Feb",
1739
- "Mar",
1740
- "Apr",
1741
- "May",
1742
- "Jun",
1743
- "Jul",
1744
- "Aug",
1745
- "Sep",
1746
- "Oct",
1747
- "Nov",
1748
- "Dec",
1749
- ],
1750
-
1751
- wide: [
1752
- "January",
1753
- "February",
1754
- "March",
1755
- "April",
1756
- "May",
1757
- "June",
1758
- "July",
1759
- "August",
1760
- "September",
1761
- "October",
1762
- "November",
1763
- "December",
1764
- ],
1765
- };
1766
-
1767
- const dayValues = {
1768
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
1769
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1770
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1771
- wide: [
1772
- "Sunday",
1773
- "Monday",
1774
- "Tuesday",
1775
- "Wednesday",
1776
- "Thursday",
1777
- "Friday",
1778
- "Saturday",
1779
- ],
1780
- };
1781
-
1782
- const dayPeriodValues = {
1783
- narrow: {
1784
- am: "a",
1785
- pm: "p",
1786
- midnight: "mi",
1787
- noon: "n",
1788
- morning: "morning",
1789
- afternoon: "afternoon",
1790
- evening: "evening",
1791
- night: "night",
1792
- },
1793
- abbreviated: {
1794
- am: "AM",
1795
- pm: "PM",
1796
- midnight: "midnight",
1797
- noon: "noon",
1798
- morning: "morning",
1799
- afternoon: "afternoon",
1800
- evening: "evening",
1801
- night: "night",
1802
- },
1803
- wide: {
1804
- am: "a.m.",
1805
- pm: "p.m.",
1806
- midnight: "midnight",
1807
- noon: "noon",
1808
- morning: "morning",
1809
- afternoon: "afternoon",
1810
- evening: "evening",
1811
- night: "night",
1812
- },
1813
- };
1814
-
1815
- const formattingDayPeriodValues = {
1816
- narrow: {
1817
- am: "a",
1818
- pm: "p",
1819
- midnight: "mi",
1820
- noon: "n",
1821
- morning: "in the morning",
1822
- afternoon: "in the afternoon",
1823
- evening: "in the evening",
1824
- night: "at night",
1825
- },
1826
- abbreviated: {
1827
- am: "AM",
1828
- pm: "PM",
1829
- midnight: "midnight",
1830
- noon: "noon",
1831
- morning: "in the morning",
1832
- afternoon: "in the afternoon",
1833
- evening: "in the evening",
1834
- night: "at night",
1835
- },
1836
- wide: {
1837
- am: "a.m.",
1838
- pm: "p.m.",
1839
- midnight: "midnight",
1840
- noon: "noon",
1841
- morning: "in the morning",
1842
- afternoon: "in the afternoon",
1843
- evening: "in the evening",
1844
- night: "at night",
1845
- },
1846
- };
1847
-
1848
- const ordinalNumber = (dirtyNumber, _options) => {
1849
- const number = Number(dirtyNumber);
1850
-
1851
- // If ordinal numbers depend on context, for example,
1852
- // if they are different for different grammatical genders,
1853
- // use `options.unit`.
1854
- //
1855
- // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1856
- // 'day', 'hour', 'minute', 'second'.
1857
-
1858
- const rem100 = number % 100;
1859
- if (rem100 > 20 || rem100 < 10) {
1860
- switch (rem100 % 10) {
1861
- case 1:
1862
- return number + "st";
1863
- case 2:
1864
- return number + "nd";
1865
- case 3:
1866
- return number + "rd";
1867
- }
1868
- }
1869
- return number + "th";
1870
- };
1871
-
1872
- const localize = {
1873
- ordinalNumber,
1874
-
1875
- era: buildLocalizeFn({
1876
- values: eraValues,
1877
- defaultWidth: "wide",
1878
- }),
1879
-
1880
- quarter: buildLocalizeFn({
1881
- values: quarterValues,
1882
- defaultWidth: "wide",
1883
- argumentCallback: (quarter) => quarter - 1,
1884
- }),
1885
-
1886
- month: buildLocalizeFn({
1887
- values: monthValues,
1888
- defaultWidth: "wide",
1889
- }),
1890
-
1891
- day: buildLocalizeFn({
1892
- values: dayValues,
1893
- defaultWidth: "wide",
1894
- }),
1895
-
1896
- dayPeriod: buildLocalizeFn({
1897
- values: dayPeriodValues,
1898
- defaultWidth: "wide",
1899
- formattingValues: formattingDayPeriodValues,
1900
- defaultFormattingWidth: "wide",
1901
- }),
1902
- };
1903
-
1904
- function buildMatchFn(args) {
1905
- return (string, options = {}) => {
1906
- const width = options.width;
1907
-
1908
- const matchPattern =
1909
- (width && args.matchPatterns[width]) ||
1910
- args.matchPatterns[args.defaultMatchWidth];
1911
- const matchResult = string.match(matchPattern);
1912
-
1913
- if (!matchResult) {
1914
- return null;
1915
- }
1916
- const matchedString = matchResult[0];
1917
-
1918
- const parsePatterns =
1919
- (width && args.parsePatterns[width]) ||
1920
- args.parsePatterns[args.defaultParseWidth];
1921
-
1922
- const key = Array.isArray(parsePatterns)
1923
- ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
1924
- : // [TODO] -- I challenge you to fix the type
1925
- findKey(parsePatterns, (pattern) => pattern.test(matchedString));
1926
-
1927
- let value;
1928
-
1929
- value = args.valueCallback ? args.valueCallback(key) : key;
1930
- value = options.valueCallback
1931
- ? // [TODO] -- I challenge you to fix the type
1932
- options.valueCallback(value)
1933
- : value;
1934
-
1935
- const rest = string.slice(matchedString.length);
1936
-
1937
- return { value, rest };
1938
- };
1939
- }
1940
-
1941
- function findKey(object, predicate) {
1942
- for (const key in object) {
1943
- if (
1944
- Object.prototype.hasOwnProperty.call(object, key) &&
1945
- predicate(object[key])
1946
- ) {
1947
- return key;
1948
- }
1949
- }
1950
- return undefined;
1951
- }
1952
-
1953
- function findIndex(array, predicate) {
1954
- for (let key = 0; key < array.length; key++) {
1955
- if (predicate(array[key])) {
1956
- return key;
1957
- }
1958
- }
1959
- return undefined;
1960
- }
1961
-
1962
- function buildMatchPatternFn(args) {
1963
- return (string, options = {}) => {
1964
- const matchResult = string.match(args.matchPattern);
1965
- if (!matchResult) return null;
1966
- const matchedString = matchResult[0];
1967
-
1968
- const parseResult = string.match(args.parsePattern);
1969
- if (!parseResult) return null;
1970
- let value = args.valueCallback
1971
- ? args.valueCallback(parseResult[0])
1972
- : parseResult[0];
1973
-
1974
- // [TODO] I challenge you to fix the type
1975
- value = options.valueCallback ? options.valueCallback(value) : value;
1976
-
1977
- const rest = string.slice(matchedString.length);
1978
-
1979
- return { value, rest };
1980
- };
1981
- }
1982
-
1983
- const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1984
- const parseOrdinalNumberPattern = /\d+/i;
1985
-
1986
- const matchEraPatterns = {
1987
- narrow: /^(b|a)/i,
1988
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1989
- wide: /^(before christ|before common era|anno domini|common era)/i,
1990
- };
1991
- const parseEraPatterns = {
1992
- any: [/^b/i, /^(a|c)/i],
1993
- };
1994
-
1995
- const matchQuarterPatterns = {
1996
- narrow: /^[1234]/i,
1997
- abbreviated: /^q[1234]/i,
1998
- wide: /^[1234](th|st|nd|rd)? quarter/i,
1999
- };
2000
- const parseQuarterPatterns = {
2001
- any: [/1/i, /2/i, /3/i, /4/i],
2002
- };
2003
-
2004
- const matchMonthPatterns = {
2005
- narrow: /^[jfmasond]/i,
2006
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
2007
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,
2008
- };
2009
- const parseMonthPatterns = {
2010
- narrow: [
2011
- /^j/i,
2012
- /^f/i,
2013
- /^m/i,
2014
- /^a/i,
2015
- /^m/i,
2016
- /^j/i,
2017
- /^j/i,
2018
- /^a/i,
2019
- /^s/i,
2020
- /^o/i,
2021
- /^n/i,
2022
- /^d/i,
2023
- ],
2024
-
2025
- any: [
2026
- /^ja/i,
2027
- /^f/i,
2028
- /^mar/i,
2029
- /^ap/i,
2030
- /^may/i,
2031
- /^jun/i,
2032
- /^jul/i,
2033
- /^au/i,
2034
- /^s/i,
2035
- /^o/i,
2036
- /^n/i,
2037
- /^d/i,
2038
- ],
2039
- };
2040
-
2041
- const matchDayPatterns = {
2042
- narrow: /^[smtwf]/i,
2043
- short: /^(su|mo|tu|we|th|fr|sa)/i,
2044
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
2045
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,
2046
- };
2047
- const parseDayPatterns = {
2048
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
2049
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
2050
- };
2051
-
2052
- const matchDayPeriodPatterns = {
2053
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
2054
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
2055
- };
2056
- const parseDayPeriodPatterns = {
2057
- any: {
2058
- am: /^a/i,
2059
- pm: /^p/i,
2060
- midnight: /^mi/i,
2061
- noon: /^no/i,
2062
- morning: /morning/i,
2063
- afternoon: /afternoon/i,
2064
- evening: /evening/i,
2065
- night: /night/i,
2066
- },
2067
- };
2068
-
2069
- const match = {
2070
- ordinalNumber: buildMatchPatternFn({
2071
- matchPattern: matchOrdinalNumberPattern,
2072
- parsePattern: parseOrdinalNumberPattern,
2073
- valueCallback: (value) => parseInt(value, 10),
2074
- }),
2075
-
2076
- era: buildMatchFn({
2077
- matchPatterns: matchEraPatterns,
2078
- defaultMatchWidth: "wide",
2079
- parsePatterns: parseEraPatterns,
2080
- defaultParseWidth: "any",
2081
- }),
2082
-
2083
- quarter: buildMatchFn({
2084
- matchPatterns: matchQuarterPatterns,
2085
- defaultMatchWidth: "wide",
2086
- parsePatterns: parseQuarterPatterns,
2087
- defaultParseWidth: "any",
2088
- valueCallback: (index) => index + 1,
2089
- }),
2090
-
2091
- month: buildMatchFn({
2092
- matchPatterns: matchMonthPatterns,
2093
- defaultMatchWidth: "wide",
2094
- parsePatterns: parseMonthPatterns,
2095
- defaultParseWidth: "any",
2096
- }),
2097
-
2098
- day: buildMatchFn({
2099
- matchPatterns: matchDayPatterns,
2100
- defaultMatchWidth: "wide",
2101
- parsePatterns: parseDayPatterns,
2102
- defaultParseWidth: "any",
2103
- }),
2104
-
2105
- dayPeriod: buildMatchFn({
2106
- matchPatterns: matchDayPeriodPatterns,
2107
- defaultMatchWidth: "any",
2108
- parsePatterns: parseDayPeriodPatterns,
2109
- defaultParseWidth: "any",
2110
- }),
2111
- };
2112
-
2113
- /**
2114
- * @category Locales
2115
- * @summary English locale (United States).
2116
- * @language English
2117
- * @iso-639-2 eng
2118
- * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
2119
- * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
2120
- */
2121
- const enUS = {
2122
- code: "en-US",
2123
- formatDistance: formatDistance,
2124
- formatLong: formatLong,
2125
- formatRelative: formatRelative,
2126
- localize: localize,
2127
- match: match,
2128
- options: {
2129
- weekStartsOn: 0 /* Sunday */,
2130
- firstWeekContainsDate: 1,
2131
- },
2132
- };
2133
-
2134
1495
  /**
2135
1496
  * The {@link getDayOfYear} function options.
2136
1497
  */
@@ -3635,7 +2996,7 @@ const unescapedLatinCharacterRegExp$1 = /[a-zA-Z]/;
3635
2996
  */
3636
2997
  function format(date, formatStr, options) {
3637
2998
  const defaultOptions = getDefaultOptions$1();
3638
- const locale = options?.locale ?? defaultOptions.locale ?? enUS;
2999
+ const locale = options?.locale ?? defaultOptions.locale ?? dateLocale.enUS;
3639
3000
 
3640
3001
  const firstWeekContainsDate =
3641
3002
  options?.firstWeekContainsDate ??
@@ -6499,7 +5860,7 @@ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
6499
5860
  function parse(dateStr, formatStr, referenceDate, options) {
6500
5861
  const invalidDate = () => constructFrom(options?.in || referenceDate, NaN);
6501
5862
  const defaultOptions = getDefaultOptions();
6502
- const locale = options?.locale ?? defaultOptions.locale ?? enUS;
5863
+ const locale = options?.locale ?? defaultOptions.locale ?? dateLocale.enUS;
6503
5864
 
6504
5865
  const firstWeekContainsDate =
6505
5866
  options?.firstWeekContainsDate ??
@@ -13547,6 +12908,7 @@ function useDatePickerHandlers(onChange, setOpen, onOpenChange, smartAutofocus,
13547
12908
  function DatePicker({ onChange, onMonthChange, onOpenChange, activator, inline, selected, readonly = false, disabled = false, fullWidth = false, smartAutofocus = true, maxDate, minDate, highlightDates, firstDayOfWeek, }) {
13548
12909
  const [open, setOpen] = React.useState(false);
13549
12910
  const { dateFormat, firstDayOfWeek: contextFirstDayOfWeek } = AtlantisContext.useAtlantisContext();
12911
+ const dateLocale$1 = dateLocale.useDateLocale();
13550
12912
  const effectiveFirstDayOfWeek = firstDayOfWeek !== null && firstDayOfWeek !== void 0 ? firstDayOfWeek : contextFirstDayOfWeek;
13551
12913
  const renderInsidePortal = !inline;
13552
12914
  const uniquePortalId = React.useId();
@@ -13561,7 +12923,7 @@ function DatePicker({ onChange, onMonthChange, onOpenChange, activator, inline,
13561
12923
  event.stopPropagation();
13562
12924
  }
13563
12925
  } },
13564
- React.createElement(DatePicker$1, Object.assign({ ref: pickerRef, calendarClassName: datePickerClassNames, showPopperArrow: false, selected: selected, inline: inline, disabled: disabled, readOnly: readonly, onChange: handleChange, maxDate: maxDate, preventOpenOnFocus: true, minDate: minDate, useWeekdaysShort: true, customInput: React.createElement(DatePickerActivator, { activator: activator, fullWidth: fullWidth }), renderCustomHeader: props => React.createElement(DatePickerCustomHeader, Object.assign({}, props)), onCalendarOpen: handleCalendarOpen, onCalendarClose: handleCalendarClose, dateFormat: [
12926
+ React.createElement(DatePicker$1, Object.assign({ ref: pickerRef, calendarClassName: datePickerClassNames, showPopperArrow: false, selected: selected, inline: inline, disabled: disabled, readOnly: readonly, onChange: handleChange, maxDate: maxDate, preventOpenOnFocus: true, minDate: minDate, locale: dateLocale$1, useWeekdaysShort: true, customInput: React.createElement(DatePickerActivator, { activator: activator, fullWidth: fullWidth }), renderCustomHeader: props => React.createElement(DatePickerCustomHeader, Object.assign({}, props)), onCalendarOpen: handleCalendarOpen, onCalendarClose: handleCalendarClose, dateFormat: [
13565
12927
  dateFormat,
13566
12928
  "P",
13567
12929
  "PP",