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