@pequity/squirrel 10.0.3 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +20 -1
  2. package/dist/cjs/chunks/p-action-bar.js +17 -14
  3. package/dist/cjs/chunks/p-dropdown-select.js +27 -26
  4. package/dist/cjs/chunks/p-inline-date-picker.js +53 -84
  5. package/dist/cjs/chunks/p-pagination-info.js +2 -2
  6. package/dist/cjs/chunks/p-pagination.js +13 -11
  7. package/dist/cjs/chunks/p-tabs-pills.js +8 -8
  8. package/dist/cjs/dateLocale.js +886 -0
  9. package/dist/cjs/index.js +103 -50
  10. package/dist/cjs/p-date-picker.js +146 -2
  11. package/dist/cjs/p-drawer.js +4 -4
  12. package/dist/cjs/p-input-search.js +5 -4
  13. package/dist/cjs/p-modal.js +3 -3
  14. package/dist/cjs/p-select-pill.js +1 -1
  15. package/dist/es/chunks/p-action-bar.js +18 -15
  16. package/dist/es/chunks/p-dropdown-select.js +27 -26
  17. package/dist/es/chunks/p-inline-date-picker.js +52 -83
  18. package/dist/es/chunks/p-pagination-info.js +2 -2
  19. package/dist/es/chunks/p-pagination.js +13 -11
  20. package/dist/es/chunks/p-tabs-pills.js +8 -8
  21. package/dist/es/dateLocale.js +886 -0
  22. package/dist/es/index.js +152 -99
  23. package/dist/es/p-date-picker.js +146 -2
  24. package/dist/es/p-drawer.js +4 -4
  25. package/dist/es/p-input-search.js +5 -4
  26. package/dist/es/p-modal.js +3 -3
  27. package/dist/es/p-select-pill.js +1 -1
  28. package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +19 -23
  29. package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +2 -2
  30. package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +12 -13
  31. package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +2 -2
  32. package/dist/squirrel/components/p-steps/p-steps.vue.d.ts +1 -1
  33. package/dist/squirrel/index.d.ts +1 -0
  34. package/dist/squirrel/plugin/index.d.ts +11 -0
  35. package/dist/squirrel/utils/dateLocale.d.ts +2 -0
  36. package/dist/squirrel.css +73 -40
  37. package/package.json +33 -29
  38. package/squirrel/components/p-action-bar/p-action-bar.vue +4 -1
  39. package/squirrel/components/p-btn/p-btn.spec.js +0 -1
  40. package/squirrel/components/p-checkbox/p-checkbox.stories.js +2 -2
  41. package/squirrel/components/p-date-picker/p-date-picker.spec.js +49 -4
  42. package/squirrel/components/p-date-picker/p-date-picker.vue +85 -12
  43. package/squirrel/components/p-drawer/p-drawer.spec.js +364 -0
  44. package/squirrel/components/p-drawer/p-drawer.vue +8 -2
  45. package/squirrel/components/p-dropdown/p-dropdown.spec.js +252 -55
  46. package/squirrel/components/p-dropdown-select/p-dropdown-select.vue +16 -12
  47. package/squirrel/components/p-file-upload/p-file-upload.spec.js +0 -1
  48. package/squirrel/components/p-file-upload/p-file-upload.vue +26 -9
  49. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.spec.js +33 -18
  50. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue +23 -10
  51. package/squirrel/components/p-input-search/p-input-search.vue +2 -2
  52. package/squirrel/components/p-modal/p-modal.vue +1 -1
  53. package/squirrel/components/p-pagination/p-pagination.vue +3 -3
  54. package/squirrel/components/p-pagination-info/p-pagination-info.vue +2 -2
  55. package/squirrel/components/p-progress-bar/{p-progess-bar.spec.js → p-progress-bar.spec.js} +7 -5
  56. package/squirrel/components/p-select-btn/p-select-btn.spec.js +104 -0
  57. package/squirrel/components/p-select-list/p-select-list.vue +7 -5
  58. package/squirrel/components/p-select-pill/p-select-pill.spec.js +114 -0
  59. package/squirrel/components/p-select-pill/p-select-pill.vue +1 -1
  60. package/squirrel/components/p-table/usePTableColResize.spec.js +123 -11
  61. package/squirrel/components/p-table/usePTableHeaderWrap.spec.js +1 -1
  62. package/squirrel/components/p-table/usePTableRowVirtualizer.spec.js +207 -0
  63. package/squirrel/components/p-table-header-cell/p-table-header-cell.stories.js +3 -0
  64. package/squirrel/components/p-table-sort/p-table-sort.vue +4 -4
  65. package/squirrel/components/p-tabs-pills/p-tabs-pills.vue +1 -1
  66. package/squirrel/index.spec.js +5 -0
  67. package/squirrel/index.ts +1 -0
  68. package/squirrel/locales/en-US.json +47 -0
  69. package/squirrel/locales/fr-CA.json +47 -0
  70. package/squirrel/plugin/index.spec.ts +140 -0
  71. package/squirrel/plugin/index.ts +54 -0
  72. package/squirrel/utils/dateLocale.spec.ts +20 -0
  73. package/squirrel/utils/dateLocale.ts +19 -0
  74. package/squirrel/utils/listKeyboardNavigation.spec.js +58 -0
  75. package/dist/cjs/chunks/p-date-picker.js +0 -169
  76. package/dist/es/chunks/p-date-picker.js +0 -170
@@ -0,0 +1,886 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const formatDistanceLocale$1 = {
4
+ lessThanXSeconds: {
5
+ one: "less than a second",
6
+ other: "less than {{count}} seconds"
7
+ },
8
+ xSeconds: {
9
+ one: "1 second",
10
+ other: "{{count}} seconds"
11
+ },
12
+ halfAMinute: "half a minute",
13
+ lessThanXMinutes: {
14
+ one: "less than a minute",
15
+ other: "less than {{count}} minutes"
16
+ },
17
+ xMinutes: {
18
+ one: "1 minute",
19
+ other: "{{count}} minutes"
20
+ },
21
+ aboutXHours: {
22
+ one: "about 1 hour",
23
+ other: "about {{count}} hours"
24
+ },
25
+ xHours: {
26
+ one: "1 hour",
27
+ other: "{{count}} hours"
28
+ },
29
+ xDays: {
30
+ one: "1 day",
31
+ other: "{{count}} days"
32
+ },
33
+ aboutXWeeks: {
34
+ one: "about 1 week",
35
+ other: "about {{count}} weeks"
36
+ },
37
+ xWeeks: {
38
+ one: "1 week",
39
+ other: "{{count}} weeks"
40
+ },
41
+ aboutXMonths: {
42
+ one: "about 1 month",
43
+ other: "about {{count}} months"
44
+ },
45
+ xMonths: {
46
+ one: "1 month",
47
+ other: "{{count}} months"
48
+ },
49
+ aboutXYears: {
50
+ one: "about 1 year",
51
+ other: "about {{count}} years"
52
+ },
53
+ xYears: {
54
+ one: "1 year",
55
+ other: "{{count}} years"
56
+ },
57
+ overXYears: {
58
+ one: "over 1 year",
59
+ other: "over {{count}} years"
60
+ },
61
+ almostXYears: {
62
+ one: "almost 1 year",
63
+ other: "almost {{count}} years"
64
+ }
65
+ };
66
+ const formatDistance$1 = (token, count, options) => {
67
+ let result;
68
+ const tokenValue = formatDistanceLocale$1[token];
69
+ if (typeof tokenValue === "string") {
70
+ result = tokenValue;
71
+ } else if (count === 1) {
72
+ result = tokenValue.one;
73
+ } else {
74
+ result = tokenValue.other.replace("{{count}}", count.toString());
75
+ }
76
+ if (options?.addSuffix) {
77
+ if (options.comparison && options.comparison > 0) {
78
+ return "in " + result;
79
+ } else {
80
+ return result + " ago";
81
+ }
82
+ }
83
+ return result;
84
+ };
85
+ function buildFormatLongFn(args) {
86
+ return (options = {}) => {
87
+ const width = options.width ? String(options.width) : args.defaultWidth;
88
+ const format = args.formats[width] || args.formats[args.defaultWidth];
89
+ return format;
90
+ };
91
+ }
92
+ const dateFormats$1 = {
93
+ full: "EEEE, MMMM do, y",
94
+ long: "MMMM do, y",
95
+ medium: "MMM d, y",
96
+ short: "MM/dd/yyyy"
97
+ };
98
+ const timeFormats$1 = {
99
+ full: "h:mm:ss a zzzz",
100
+ long: "h:mm:ss a z",
101
+ medium: "h:mm:ss a",
102
+ short: "h:mm a"
103
+ };
104
+ const dateTimeFormats$1 = {
105
+ full: "{{date}} 'at' {{time}}",
106
+ long: "{{date}} 'at' {{time}}",
107
+ medium: "{{date}}, {{time}}",
108
+ short: "{{date}}, {{time}}"
109
+ };
110
+ const formatLong$1 = {
111
+ date: buildFormatLongFn({
112
+ formats: dateFormats$1,
113
+ defaultWidth: "full"
114
+ }),
115
+ time: buildFormatLongFn({
116
+ formats: timeFormats$1,
117
+ defaultWidth: "full"
118
+ }),
119
+ dateTime: buildFormatLongFn({
120
+ formats: dateTimeFormats$1,
121
+ defaultWidth: "full"
122
+ })
123
+ };
124
+ const formatRelativeLocale$1 = {
125
+ lastWeek: "'last' eeee 'at' p",
126
+ yesterday: "'yesterday at' p",
127
+ today: "'today at' p",
128
+ tomorrow: "'tomorrow at' p",
129
+ nextWeek: "eeee 'at' p",
130
+ other: "P"
131
+ };
132
+ const formatRelative$1 = (token, _date, _baseDate, _options) => formatRelativeLocale$1[token];
133
+ function buildLocalizeFn(args) {
134
+ return (value, options) => {
135
+ const context = options?.context ? String(options.context) : "standalone";
136
+ let valuesArray;
137
+ if (context === "formatting" && args.formattingValues) {
138
+ const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
139
+ const width = options?.width ? String(options.width) : defaultWidth;
140
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
141
+ } else {
142
+ const defaultWidth = args.defaultWidth;
143
+ const width = options?.width ? String(options.width) : args.defaultWidth;
144
+ valuesArray = args.values[width] || args.values[defaultWidth];
145
+ }
146
+ const index = args.argumentCallback ? args.argumentCallback(value) : value;
147
+ return valuesArray[index];
148
+ };
149
+ }
150
+ const eraValues$1 = {
151
+ narrow: ["B", "A"],
152
+ abbreviated: ["BC", "AD"],
153
+ wide: ["Before Christ", "Anno Domini"]
154
+ };
155
+ const quarterValues$1 = {
156
+ narrow: ["1", "2", "3", "4"],
157
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
158
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
159
+ };
160
+ const monthValues$1 = {
161
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
162
+ abbreviated: [
163
+ "Jan",
164
+ "Feb",
165
+ "Mar",
166
+ "Apr",
167
+ "May",
168
+ "Jun",
169
+ "Jul",
170
+ "Aug",
171
+ "Sep",
172
+ "Oct",
173
+ "Nov",
174
+ "Dec"
175
+ ],
176
+ wide: [
177
+ "January",
178
+ "February",
179
+ "March",
180
+ "April",
181
+ "May",
182
+ "June",
183
+ "July",
184
+ "August",
185
+ "September",
186
+ "October",
187
+ "November",
188
+ "December"
189
+ ]
190
+ };
191
+ const dayValues$1 = {
192
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
193
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
194
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
195
+ wide: [
196
+ "Sunday",
197
+ "Monday",
198
+ "Tuesday",
199
+ "Wednesday",
200
+ "Thursday",
201
+ "Friday",
202
+ "Saturday"
203
+ ]
204
+ };
205
+ const dayPeriodValues$1 = {
206
+ narrow: {
207
+ am: "a",
208
+ pm: "p",
209
+ midnight: "mi",
210
+ noon: "n",
211
+ morning: "morning",
212
+ afternoon: "afternoon",
213
+ evening: "evening",
214
+ night: "night"
215
+ },
216
+ abbreviated: {
217
+ am: "AM",
218
+ pm: "PM",
219
+ midnight: "midnight",
220
+ noon: "noon",
221
+ morning: "morning",
222
+ afternoon: "afternoon",
223
+ evening: "evening",
224
+ night: "night"
225
+ },
226
+ wide: {
227
+ am: "a.m.",
228
+ pm: "p.m.",
229
+ midnight: "midnight",
230
+ noon: "noon",
231
+ morning: "morning",
232
+ afternoon: "afternoon",
233
+ evening: "evening",
234
+ night: "night"
235
+ }
236
+ };
237
+ const formattingDayPeriodValues = {
238
+ narrow: {
239
+ am: "a",
240
+ pm: "p",
241
+ midnight: "mi",
242
+ noon: "n",
243
+ morning: "in the morning",
244
+ afternoon: "in the afternoon",
245
+ evening: "in the evening",
246
+ night: "at night"
247
+ },
248
+ abbreviated: {
249
+ am: "AM",
250
+ pm: "PM",
251
+ midnight: "midnight",
252
+ noon: "noon",
253
+ morning: "in the morning",
254
+ afternoon: "in the afternoon",
255
+ evening: "in the evening",
256
+ night: "at night"
257
+ },
258
+ wide: {
259
+ am: "a.m.",
260
+ pm: "p.m.",
261
+ midnight: "midnight",
262
+ noon: "noon",
263
+ morning: "in the morning",
264
+ afternoon: "in the afternoon",
265
+ evening: "in the evening",
266
+ night: "at night"
267
+ }
268
+ };
269
+ const ordinalNumber$1 = (dirtyNumber, _options) => {
270
+ const number = Number(dirtyNumber);
271
+ const rem100 = number % 100;
272
+ if (rem100 > 20 || rem100 < 10) {
273
+ switch (rem100 % 10) {
274
+ case 1:
275
+ return number + "st";
276
+ case 2:
277
+ return number + "nd";
278
+ case 3:
279
+ return number + "rd";
280
+ }
281
+ }
282
+ return number + "th";
283
+ };
284
+ const localize$1 = {
285
+ ordinalNumber: ordinalNumber$1,
286
+ era: buildLocalizeFn({
287
+ values: eraValues$1,
288
+ defaultWidth: "wide"
289
+ }),
290
+ quarter: buildLocalizeFn({
291
+ values: quarterValues$1,
292
+ defaultWidth: "wide",
293
+ argumentCallback: (quarter) => quarter - 1
294
+ }),
295
+ month: buildLocalizeFn({
296
+ values: monthValues$1,
297
+ defaultWidth: "wide"
298
+ }),
299
+ day: buildLocalizeFn({
300
+ values: dayValues$1,
301
+ defaultWidth: "wide"
302
+ }),
303
+ dayPeriod: buildLocalizeFn({
304
+ values: dayPeriodValues$1,
305
+ defaultWidth: "wide",
306
+ formattingValues: formattingDayPeriodValues,
307
+ defaultFormattingWidth: "wide"
308
+ })
309
+ };
310
+ function buildMatchFn(args) {
311
+ return (string, options = {}) => {
312
+ const width = options.width;
313
+ const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
314
+ const matchResult = string.match(matchPattern);
315
+ if (!matchResult) {
316
+ return null;
317
+ }
318
+ const matchedString = matchResult[0];
319
+ const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
320
+ const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
321
+ // [TODO] -- I challenge you to fix the type
322
+ findKey(parsePatterns, (pattern) => pattern.test(matchedString))
323
+ );
324
+ let value;
325
+ value = args.valueCallback ? args.valueCallback(key) : key;
326
+ value = options.valueCallback ? (
327
+ // [TODO] -- I challenge you to fix the type
328
+ options.valueCallback(value)
329
+ ) : value;
330
+ const rest = string.slice(matchedString.length);
331
+ return { value, rest };
332
+ };
333
+ }
334
+ function findKey(object, predicate) {
335
+ for (const key in object) {
336
+ if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
337
+ return key;
338
+ }
339
+ }
340
+ return void 0;
341
+ }
342
+ function findIndex(array, predicate) {
343
+ for (let key = 0; key < array.length; key++) {
344
+ if (predicate(array[key])) {
345
+ return key;
346
+ }
347
+ }
348
+ return void 0;
349
+ }
350
+ function buildMatchPatternFn(args) {
351
+ return (string, options = {}) => {
352
+ const matchResult = string.match(args.matchPattern);
353
+ if (!matchResult) return null;
354
+ const matchedString = matchResult[0];
355
+ const parseResult = string.match(args.parsePattern);
356
+ if (!parseResult) return null;
357
+ let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
358
+ value = options.valueCallback ? options.valueCallback(value) : value;
359
+ const rest = string.slice(matchedString.length);
360
+ return { value, rest };
361
+ };
362
+ }
363
+ const matchOrdinalNumberPattern$1 = /^(\d+)(th|st|nd|rd)?/i;
364
+ const parseOrdinalNumberPattern$1 = /\d+/i;
365
+ const matchEraPatterns$1 = {
366
+ narrow: /^(b|a)/i,
367
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
368
+ wide: /^(before christ|before common era|anno domini|common era)/i
369
+ };
370
+ const parseEraPatterns$1 = {
371
+ any: [/^b/i, /^(a|c)/i]
372
+ };
373
+ const matchQuarterPatterns$1 = {
374
+ narrow: /^[1234]/i,
375
+ abbreviated: /^q[1234]/i,
376
+ wide: /^[1234](th|st|nd|rd)? quarter/i
377
+ };
378
+ const parseQuarterPatterns$1 = {
379
+ any: [/1/i, /2/i, /3/i, /4/i]
380
+ };
381
+ const matchMonthPatterns$1 = {
382
+ narrow: /^[jfmasond]/i,
383
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
384
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
385
+ };
386
+ const parseMonthPatterns$1 = {
387
+ narrow: [
388
+ /^j/i,
389
+ /^f/i,
390
+ /^m/i,
391
+ /^a/i,
392
+ /^m/i,
393
+ /^j/i,
394
+ /^j/i,
395
+ /^a/i,
396
+ /^s/i,
397
+ /^o/i,
398
+ /^n/i,
399
+ /^d/i
400
+ ],
401
+ any: [
402
+ /^ja/i,
403
+ /^f/i,
404
+ /^mar/i,
405
+ /^ap/i,
406
+ /^may/i,
407
+ /^jun/i,
408
+ /^jul/i,
409
+ /^au/i,
410
+ /^s/i,
411
+ /^o/i,
412
+ /^n/i,
413
+ /^d/i
414
+ ]
415
+ };
416
+ const matchDayPatterns$1 = {
417
+ narrow: /^[smtwf]/i,
418
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
419
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
420
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
421
+ };
422
+ const parseDayPatterns$1 = {
423
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
424
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
425
+ };
426
+ const matchDayPeriodPatterns$1 = {
427
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
428
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
429
+ };
430
+ const parseDayPeriodPatterns$1 = {
431
+ any: {
432
+ am: /^a/i,
433
+ pm: /^p/i,
434
+ midnight: /^mi/i,
435
+ noon: /^no/i,
436
+ morning: /morning/i,
437
+ afternoon: /afternoon/i,
438
+ evening: /evening/i,
439
+ night: /night/i
440
+ }
441
+ };
442
+ const match$1 = {
443
+ ordinalNumber: buildMatchPatternFn({
444
+ matchPattern: matchOrdinalNumberPattern$1,
445
+ parsePattern: parseOrdinalNumberPattern$1,
446
+ valueCallback: (value) => parseInt(value, 10)
447
+ }),
448
+ era: buildMatchFn({
449
+ matchPatterns: matchEraPatterns$1,
450
+ defaultMatchWidth: "wide",
451
+ parsePatterns: parseEraPatterns$1,
452
+ defaultParseWidth: "any"
453
+ }),
454
+ quarter: buildMatchFn({
455
+ matchPatterns: matchQuarterPatterns$1,
456
+ defaultMatchWidth: "wide",
457
+ parsePatterns: parseQuarterPatterns$1,
458
+ defaultParseWidth: "any",
459
+ valueCallback: (index) => index + 1
460
+ }),
461
+ month: buildMatchFn({
462
+ matchPatterns: matchMonthPatterns$1,
463
+ defaultMatchWidth: "wide",
464
+ parsePatterns: parseMonthPatterns$1,
465
+ defaultParseWidth: "any"
466
+ }),
467
+ day: buildMatchFn({
468
+ matchPatterns: matchDayPatterns$1,
469
+ defaultMatchWidth: "wide",
470
+ parsePatterns: parseDayPatterns$1,
471
+ defaultParseWidth: "any"
472
+ }),
473
+ dayPeriod: buildMatchFn({
474
+ matchPatterns: matchDayPeriodPatterns$1,
475
+ defaultMatchWidth: "any",
476
+ parsePatterns: parseDayPeriodPatterns$1,
477
+ defaultParseWidth: "any"
478
+ })
479
+ };
480
+ const enUS = {
481
+ code: "en-US",
482
+ formatDistance: formatDistance$1,
483
+ formatLong: formatLong$1,
484
+ formatRelative: formatRelative$1,
485
+ localize: localize$1,
486
+ match: match$1,
487
+ options: {
488
+ weekStartsOn: 0,
489
+ firstWeekContainsDate: 1
490
+ }
491
+ };
492
+ const formatDistanceLocale = {
493
+ lessThanXSeconds: {
494
+ one: "moins d’une seconde",
495
+ other: "moins de {{count}} secondes"
496
+ },
497
+ xSeconds: {
498
+ one: "1 seconde",
499
+ other: "{{count}} secondes"
500
+ },
501
+ halfAMinute: "30 secondes",
502
+ lessThanXMinutes: {
503
+ one: "moins d’une minute",
504
+ other: "moins de {{count}} minutes"
505
+ },
506
+ xMinutes: {
507
+ one: "1 minute",
508
+ other: "{{count}} minutes"
509
+ },
510
+ aboutXHours: {
511
+ one: "environ 1 heure",
512
+ other: "environ {{count}} heures"
513
+ },
514
+ xHours: {
515
+ one: "1 heure",
516
+ other: "{{count}} heures"
517
+ },
518
+ xDays: {
519
+ one: "1 jour",
520
+ other: "{{count}} jours"
521
+ },
522
+ aboutXWeeks: {
523
+ one: "environ 1 semaine",
524
+ other: "environ {{count}} semaines"
525
+ },
526
+ xWeeks: {
527
+ one: "1 semaine",
528
+ other: "{{count}} semaines"
529
+ },
530
+ aboutXMonths: {
531
+ one: "environ 1 mois",
532
+ other: "environ {{count}} mois"
533
+ },
534
+ xMonths: {
535
+ one: "1 mois",
536
+ other: "{{count}} mois"
537
+ },
538
+ aboutXYears: {
539
+ one: "environ 1 an",
540
+ other: "environ {{count}} ans"
541
+ },
542
+ xYears: {
543
+ one: "1 an",
544
+ other: "{{count}} ans"
545
+ },
546
+ overXYears: {
547
+ one: "plus d’un an",
548
+ other: "plus de {{count}} ans"
549
+ },
550
+ almostXYears: {
551
+ one: "presqu’un an",
552
+ other: "presque {{count}} ans"
553
+ }
554
+ };
555
+ const formatDistance = (token, count, options) => {
556
+ let result;
557
+ const form = formatDistanceLocale[token];
558
+ if (typeof form === "string") {
559
+ result = form;
560
+ } else if (count === 1) {
561
+ result = form.one;
562
+ } else {
563
+ result = form.other.replace("{{count}}", String(count));
564
+ }
565
+ if (options?.addSuffix) {
566
+ if (options.comparison && options.comparison > 0) {
567
+ return "dans " + result;
568
+ } else {
569
+ return "il y a " + result;
570
+ }
571
+ }
572
+ return result;
573
+ };
574
+ const formatRelativeLocale = {
575
+ lastWeek: "eeee 'dernier à' p",
576
+ yesterday: "'hier à' p",
577
+ today: "'aujourd’hui à' p",
578
+ tomorrow: "'demain à' p'",
579
+ nextWeek: "eeee 'prochain à' p",
580
+ other: "P"
581
+ };
582
+ const formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
583
+ const eraValues = {
584
+ narrow: ["av. J.-C", "ap. J.-C"],
585
+ abbreviated: ["av. J.-C", "ap. J.-C"],
586
+ wide: ["avant Jésus-Christ", "après Jésus-Christ"]
587
+ };
588
+ const quarterValues = {
589
+ narrow: ["T1", "T2", "T3", "T4"],
590
+ abbreviated: ["1er trim.", "2ème trim.", "3ème trim.", "4ème trim."],
591
+ wide: ["1er trimestre", "2ème trimestre", "3ème trimestre", "4ème trimestre"]
592
+ };
593
+ const monthValues = {
594
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
595
+ abbreviated: [
596
+ "janv.",
597
+ "févr.",
598
+ "mars",
599
+ "avr.",
600
+ "mai",
601
+ "juin",
602
+ "juil.",
603
+ "août",
604
+ "sept.",
605
+ "oct.",
606
+ "nov.",
607
+ "déc."
608
+ ],
609
+ wide: [
610
+ "janvier",
611
+ "février",
612
+ "mars",
613
+ "avril",
614
+ "mai",
615
+ "juin",
616
+ "juillet",
617
+ "août",
618
+ "septembre",
619
+ "octobre",
620
+ "novembre",
621
+ "décembre"
622
+ ]
623
+ };
624
+ const dayValues = {
625
+ narrow: ["D", "L", "M", "M", "J", "V", "S"],
626
+ short: ["di", "lu", "ma", "me", "je", "ve", "sa"],
627
+ abbreviated: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."],
628
+ wide: [
629
+ "dimanche",
630
+ "lundi",
631
+ "mardi",
632
+ "mercredi",
633
+ "jeudi",
634
+ "vendredi",
635
+ "samedi"
636
+ ]
637
+ };
638
+ const dayPeriodValues = {
639
+ narrow: {
640
+ am: "AM",
641
+ pm: "PM",
642
+ midnight: "minuit",
643
+ noon: "midi",
644
+ morning: "mat.",
645
+ afternoon: "ap.m.",
646
+ evening: "soir",
647
+ night: "mat."
648
+ },
649
+ abbreviated: {
650
+ am: "AM",
651
+ pm: "PM",
652
+ midnight: "minuit",
653
+ noon: "midi",
654
+ morning: "matin",
655
+ afternoon: "après-midi",
656
+ evening: "soir",
657
+ night: "matin"
658
+ },
659
+ wide: {
660
+ am: "AM",
661
+ pm: "PM",
662
+ midnight: "minuit",
663
+ noon: "midi",
664
+ morning: "du matin",
665
+ afternoon: "de l’après-midi",
666
+ evening: "du soir",
667
+ night: "du matin"
668
+ }
669
+ };
670
+ const ordinalNumber = (dirtyNumber, options) => {
671
+ const number = Number(dirtyNumber);
672
+ const unit = options?.unit;
673
+ if (number === 0) return "0";
674
+ const feminineUnits = ["year", "week", "hour", "minute", "second"];
675
+ let suffix;
676
+ if (number === 1) {
677
+ suffix = unit && feminineUnits.includes(unit) ? "ère" : "er";
678
+ } else {
679
+ suffix = "ème";
680
+ }
681
+ return number + suffix;
682
+ };
683
+ const LONG_MONTHS_TOKENS = ["MMM", "MMMM"];
684
+ const localize = {
685
+ preprocessor: (date, parts) => {
686
+ if (date.getDate() === 1) return parts;
687
+ const hasLongMonthToken = parts.some(
688
+ (part) => part.isToken && LONG_MONTHS_TOKENS.includes(part.value)
689
+ );
690
+ if (!hasLongMonthToken) return parts;
691
+ return parts.map(
692
+ (part) => part.isToken && part.value === "do" ? { isToken: true, value: "d" } : part
693
+ );
694
+ },
695
+ ordinalNumber,
696
+ era: buildLocalizeFn({
697
+ values: eraValues,
698
+ defaultWidth: "wide"
699
+ }),
700
+ quarter: buildLocalizeFn({
701
+ values: quarterValues,
702
+ defaultWidth: "wide",
703
+ argumentCallback: (quarter) => quarter - 1
704
+ }),
705
+ month: buildLocalizeFn({
706
+ values: monthValues,
707
+ defaultWidth: "wide"
708
+ }),
709
+ day: buildLocalizeFn({
710
+ values: dayValues,
711
+ defaultWidth: "wide"
712
+ }),
713
+ dayPeriod: buildLocalizeFn({
714
+ values: dayPeriodValues,
715
+ defaultWidth: "wide"
716
+ })
717
+ };
718
+ const matchOrdinalNumberPattern = /^(\d+)(ième|ère|ème|er|e)?/i;
719
+ const parseOrdinalNumberPattern = /\d+/i;
720
+ const matchEraPatterns = {
721
+ narrow: /^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,
722
+ abbreviated: /^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,
723
+ wide: /^(avant Jésus-Christ|après Jésus-Christ)/i
724
+ };
725
+ const parseEraPatterns = {
726
+ any: [/^av/i, /^ap/i]
727
+ };
728
+ const matchQuarterPatterns = {
729
+ narrow: /^T?[1234]/i,
730
+ abbreviated: /^[1234](er|ème|e)? trim\.?/i,
731
+ wide: /^[1234](er|ème|e)? trimestre/i
732
+ };
733
+ const parseQuarterPatterns = {
734
+ any: [/1/i, /2/i, /3/i, /4/i]
735
+ };
736
+ const matchMonthPatterns = {
737
+ narrow: /^[jfmasond]/i,
738
+ abbreviated: /^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,
739
+ wide: /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i
740
+ };
741
+ const parseMonthPatterns = {
742
+ narrow: [
743
+ /^j/i,
744
+ /^f/i,
745
+ /^m/i,
746
+ /^a/i,
747
+ /^m/i,
748
+ /^j/i,
749
+ /^j/i,
750
+ /^a/i,
751
+ /^s/i,
752
+ /^o/i,
753
+ /^n/i,
754
+ /^d/i
755
+ ],
756
+ any: [
757
+ /^ja/i,
758
+ /^f/i,
759
+ /^mar/i,
760
+ /^av/i,
761
+ /^ma/i,
762
+ /^juin/i,
763
+ /^juil/i,
764
+ /^ao/i,
765
+ /^s/i,
766
+ /^o/i,
767
+ /^n/i,
768
+ /^d/i
769
+ ]
770
+ };
771
+ const matchDayPatterns = {
772
+ narrow: /^[lmjvsd]/i,
773
+ short: /^(di|lu|ma|me|je|ve|sa)/i,
774
+ abbreviated: /^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,
775
+ wide: /^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i
776
+ };
777
+ const parseDayPatterns = {
778
+ narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
779
+ any: [/^di/i, /^lu/i, /^ma/i, /^me/i, /^je/i, /^ve/i, /^sa/i]
780
+ };
781
+ const matchDayPeriodPatterns = {
782
+ narrow: /^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,
783
+ any: /^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i
784
+ };
785
+ const parseDayPeriodPatterns = {
786
+ any: {
787
+ am: /^a/i,
788
+ pm: /^p/i,
789
+ midnight: /^min/i,
790
+ noon: /^mid/i,
791
+ morning: /mat/i,
792
+ afternoon: /ap/i,
793
+ evening: /soir/i,
794
+ night: /nuit/i
795
+ }
796
+ };
797
+ const match = {
798
+ ordinalNumber: buildMatchPatternFn({
799
+ matchPattern: matchOrdinalNumberPattern,
800
+ parsePattern: parseOrdinalNumberPattern,
801
+ valueCallback: (value) => parseInt(value)
802
+ }),
803
+ era: buildMatchFn({
804
+ matchPatterns: matchEraPatterns,
805
+ defaultMatchWidth: "wide",
806
+ parsePatterns: parseEraPatterns,
807
+ defaultParseWidth: "any"
808
+ }),
809
+ quarter: buildMatchFn({
810
+ matchPatterns: matchQuarterPatterns,
811
+ defaultMatchWidth: "wide",
812
+ parsePatterns: parseQuarterPatterns,
813
+ defaultParseWidth: "any",
814
+ valueCallback: (index) => index + 1
815
+ }),
816
+ month: buildMatchFn({
817
+ matchPatterns: matchMonthPatterns,
818
+ defaultMatchWidth: "wide",
819
+ parsePatterns: parseMonthPatterns,
820
+ defaultParseWidth: "any"
821
+ }),
822
+ day: buildMatchFn({
823
+ matchPatterns: matchDayPatterns,
824
+ defaultMatchWidth: "wide",
825
+ parsePatterns: parseDayPatterns,
826
+ defaultParseWidth: "any"
827
+ }),
828
+ dayPeriod: buildMatchFn({
829
+ matchPatterns: matchDayPeriodPatterns,
830
+ defaultMatchWidth: "any",
831
+ parsePatterns: parseDayPeriodPatterns,
832
+ defaultParseWidth: "any"
833
+ })
834
+ };
835
+ const dateFormats = {
836
+ full: "EEEE d MMMM y",
837
+ long: "d MMMM y",
838
+ medium: "d MMM y",
839
+ short: "yy-MM-dd"
840
+ };
841
+ const timeFormats = {
842
+ full: "HH:mm:ss zzzz",
843
+ long: "HH:mm:ss z",
844
+ medium: "HH:mm:ss",
845
+ short: "HH:mm"
846
+ };
847
+ const dateTimeFormats = {
848
+ full: "{{date}} 'à' {{time}}",
849
+ long: "{{date}} 'à' {{time}}",
850
+ medium: "{{date}}, {{time}}",
851
+ short: "{{date}}, {{time}}"
852
+ };
853
+ const formatLong = {
854
+ date: buildFormatLongFn({
855
+ formats: dateFormats,
856
+ defaultWidth: "full"
857
+ }),
858
+ time: buildFormatLongFn({
859
+ formats: timeFormats,
860
+ defaultWidth: "full"
861
+ }),
862
+ dateTime: buildFormatLongFn({
863
+ formats: dateTimeFormats,
864
+ defaultWidth: "full"
865
+ })
866
+ };
867
+ const frCA = {
868
+ code: "fr-CA",
869
+ formatDistance,
870
+ formatLong,
871
+ formatRelative,
872
+ localize,
873
+ match,
874
+ // Unique for fr-CA
875
+ options: {
876
+ weekStartsOn: 0,
877
+ firstWeekContainsDate: 1
878
+ }
879
+ };
880
+ const localeMap = {
881
+ "fr-CA": frCA,
882
+ "en-US": enUS
883
+ };
884
+ const isValidLocaleCode = (code) => code in localeMap;
885
+ const getDateFnsLocale = (localeCode) => isValidLocaleCode(localeCode) ? localeMap[localeCode] : enUS;
886
+ exports.getDateFnsLocale = getDateFnsLocale;