@abgov/react-components 6.10.0-dev.1 → 6.10.0-dev.3

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.
package/index.mjs CHANGED
@@ -2107,12 +2107,15 @@ const formatters = {
2107
2107
  G: function(date, token, localize2) {
2108
2108
  const era = date.getFullYear() > 0 ? 1 : 0;
2109
2109
  switch (token) {
2110
+ // AD, BC
2110
2111
  case "G":
2111
2112
  case "GG":
2112
2113
  case "GGG":
2113
2114
  return localize2.era(era, { width: "abbreviated" });
2115
+ // A, B
2114
2116
  case "GGGGG":
2115
2117
  return localize2.era(era, { width: "narrow" });
2118
+ // Anno Domini, Before Christ
2116
2119
  case "GGGG":
2117
2120
  default:
2118
2121
  return localize2.era(era, { width: "wide" });
@@ -2162,22 +2165,28 @@ const formatters = {
2162
2165
  Q: function(date, token, localize2) {
2163
2166
  const quarter = Math.ceil((date.getMonth() + 1) / 3);
2164
2167
  switch (token) {
2168
+ // 1, 2, 3, 4
2165
2169
  case "Q":
2166
2170
  return String(quarter);
2171
+ // 01, 02, 03, 04
2167
2172
  case "QQ":
2168
2173
  return addLeadingZeros(quarter, 2);
2174
+ // 1st, 2nd, 3rd, 4th
2169
2175
  case "Qo":
2170
2176
  return localize2.ordinalNumber(quarter, { unit: "quarter" });
2177
+ // Q1, Q2, Q3, Q4
2171
2178
  case "QQQ":
2172
2179
  return localize2.quarter(quarter, {
2173
2180
  width: "abbreviated",
2174
2181
  context: "formatting"
2175
2182
  });
2183
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2176
2184
  case "QQQQQ":
2177
2185
  return localize2.quarter(quarter, {
2178
2186
  width: "narrow",
2179
2187
  context: "formatting"
2180
2188
  });
2189
+ // 1st quarter, 2nd quarter, ...
2181
2190
  case "QQQQ":
2182
2191
  default:
2183
2192
  return localize2.quarter(quarter, {
@@ -2190,22 +2199,28 @@ const formatters = {
2190
2199
  q: function(date, token, localize2) {
2191
2200
  const quarter = Math.ceil((date.getMonth() + 1) / 3);
2192
2201
  switch (token) {
2202
+ // 1, 2, 3, 4
2193
2203
  case "q":
2194
2204
  return String(quarter);
2205
+ // 01, 02, 03, 04
2195
2206
  case "qq":
2196
2207
  return addLeadingZeros(quarter, 2);
2208
+ // 1st, 2nd, 3rd, 4th
2197
2209
  case "qo":
2198
2210
  return localize2.ordinalNumber(quarter, { unit: "quarter" });
2211
+ // Q1, Q2, Q3, Q4
2199
2212
  case "qqq":
2200
2213
  return localize2.quarter(quarter, {
2201
2214
  width: "abbreviated",
2202
2215
  context: "standalone"
2203
2216
  });
2217
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2204
2218
  case "qqqqq":
2205
2219
  return localize2.quarter(quarter, {
2206
2220
  width: "narrow",
2207
2221
  context: "standalone"
2208
2222
  });
2223
+ // 1st quarter, 2nd quarter, ...
2209
2224
  case "qqqq":
2210
2225
  default:
2211
2226
  return localize2.quarter(quarter, {
@@ -2221,18 +2236,22 @@ const formatters = {
2221
2236
  case "M":
2222
2237
  case "MM":
2223
2238
  return lightFormatters.M(date, token);
2239
+ // 1st, 2nd, ..., 12th
2224
2240
  case "Mo":
2225
2241
  return localize2.ordinalNumber(month + 1, { unit: "month" });
2242
+ // Jan, Feb, ..., Dec
2226
2243
  case "MMM":
2227
2244
  return localize2.month(month, {
2228
2245
  width: "abbreviated",
2229
2246
  context: "formatting"
2230
2247
  });
2248
+ // J, F, ..., D
2231
2249
  case "MMMMM":
2232
2250
  return localize2.month(month, {
2233
2251
  width: "narrow",
2234
2252
  context: "formatting"
2235
2253
  });
2254
+ // January, February, ..., December
2236
2255
  case "MMMM":
2237
2256
  default:
2238
2257
  return localize2.month(month, { width: "wide", context: "formatting" });
@@ -2242,22 +2261,28 @@ const formatters = {
2242
2261
  L: function(date, token, localize2) {
2243
2262
  const month = date.getMonth();
2244
2263
  switch (token) {
2264
+ // 1, 2, ..., 12
2245
2265
  case "L":
2246
2266
  return String(month + 1);
2267
+ // 01, 02, ..., 12
2247
2268
  case "LL":
2248
2269
  return addLeadingZeros(month + 1, 2);
2270
+ // 1st, 2nd, ..., 12th
2249
2271
  case "Lo":
2250
2272
  return localize2.ordinalNumber(month + 1, { unit: "month" });
2273
+ // Jan, Feb, ..., Dec
2251
2274
  case "LLL":
2252
2275
  return localize2.month(month, {
2253
2276
  width: "abbreviated",
2254
2277
  context: "standalone"
2255
2278
  });
2279
+ // J, F, ..., D
2256
2280
  case "LLLLL":
2257
2281
  return localize2.month(month, {
2258
2282
  width: "narrow",
2259
2283
  context: "standalone"
2260
2284
  });
2285
+ // January, February, ..., December
2261
2286
  case "LLLL":
2262
2287
  default:
2263
2288
  return localize2.month(month, { width: "wide", context: "standalone" });
@@ -2298,6 +2323,7 @@ const formatters = {
2298
2323
  E: function(date, token, localize2) {
2299
2324
  const dayOfWeek = date.getDay();
2300
2325
  switch (token) {
2326
+ // Tue
2301
2327
  case "E":
2302
2328
  case "EE":
2303
2329
  case "EEE":
@@ -2305,16 +2331,19 @@ const formatters = {
2305
2331
  width: "abbreviated",
2306
2332
  context: "formatting"
2307
2333
  });
2334
+ // T
2308
2335
  case "EEEEE":
2309
2336
  return localize2.day(dayOfWeek, {
2310
2337
  width: "narrow",
2311
2338
  context: "formatting"
2312
2339
  });
2340
+ // Tu
2313
2341
  case "EEEEEE":
2314
2342
  return localize2.day(dayOfWeek, {
2315
2343
  width: "short",
2316
2344
  context: "formatting"
2317
2345
  });
2346
+ // Tuesday
2318
2347
  case "EEEE":
2319
2348
  default:
2320
2349
  return localize2.day(dayOfWeek, {
@@ -2328,10 +2357,13 @@ const formatters = {
2328
2357
  const dayOfWeek = date.getDay();
2329
2358
  const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2330
2359
  switch (token) {
2360
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
2331
2361
  case "e":
2332
2362
  return String(localDayOfWeek);
2363
+ // Padded numerical value
2333
2364
  case "ee":
2334
2365
  return addLeadingZeros(localDayOfWeek, 2);
2366
+ // 1st, 2nd, ..., 7th
2335
2367
  case "eo":
2336
2368
  return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
2337
2369
  case "eee":
@@ -2339,16 +2371,19 @@ const formatters = {
2339
2371
  width: "abbreviated",
2340
2372
  context: "formatting"
2341
2373
  });
2374
+ // T
2342
2375
  case "eeeee":
2343
2376
  return localize2.day(dayOfWeek, {
2344
2377
  width: "narrow",
2345
2378
  context: "formatting"
2346
2379
  });
2380
+ // Tu
2347
2381
  case "eeeeee":
2348
2382
  return localize2.day(dayOfWeek, {
2349
2383
  width: "short",
2350
2384
  context: "formatting"
2351
2385
  });
2386
+ // Tuesday
2352
2387
  case "eeee":
2353
2388
  default:
2354
2389
  return localize2.day(dayOfWeek, {
@@ -2362,10 +2397,13 @@ const formatters = {
2362
2397
  const dayOfWeek = date.getDay();
2363
2398
  const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2364
2399
  switch (token) {
2400
+ // Numerical value (same as in `e`)
2365
2401
  case "c":
2366
2402
  return String(localDayOfWeek);
2403
+ // Padded numerical value
2367
2404
  case "cc":
2368
2405
  return addLeadingZeros(localDayOfWeek, token.length);
2406
+ // 1st, 2nd, ..., 7th
2369
2407
  case "co":
2370
2408
  return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
2371
2409
  case "ccc":
@@ -2373,16 +2411,19 @@ const formatters = {
2373
2411
  width: "abbreviated",
2374
2412
  context: "standalone"
2375
2413
  });
2414
+ // T
2376
2415
  case "ccccc":
2377
2416
  return localize2.day(dayOfWeek, {
2378
2417
  width: "narrow",
2379
2418
  context: "standalone"
2380
2419
  });
2420
+ // Tu
2381
2421
  case "cccccc":
2382
2422
  return localize2.day(dayOfWeek, {
2383
2423
  width: "short",
2384
2424
  context: "standalone"
2385
2425
  });
2426
+ // Tuesday
2386
2427
  case "cccc":
2387
2428
  default:
2388
2429
  return localize2.day(dayOfWeek, {
@@ -2396,27 +2437,34 @@ const formatters = {
2396
2437
  const dayOfWeek = date.getDay();
2397
2438
  const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
2398
2439
  switch (token) {
2440
+ // 2
2399
2441
  case "i":
2400
2442
  return String(isoDayOfWeek);
2443
+ // 02
2401
2444
  case "ii":
2402
2445
  return addLeadingZeros(isoDayOfWeek, token.length);
2446
+ // 2nd
2403
2447
  case "io":
2404
2448
  return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
2449
+ // Tue
2405
2450
  case "iii":
2406
2451
  return localize2.day(dayOfWeek, {
2407
2452
  width: "abbreviated",
2408
2453
  context: "formatting"
2409
2454
  });
2455
+ // T
2410
2456
  case "iiiii":
2411
2457
  return localize2.day(dayOfWeek, {
2412
2458
  width: "narrow",
2413
2459
  context: "formatting"
2414
2460
  });
2461
+ // Tu
2415
2462
  case "iiiiii":
2416
2463
  return localize2.day(dayOfWeek, {
2417
2464
  width: "short",
2418
2465
  context: "formatting"
2419
2466
  });
2467
+ // Tuesday
2420
2468
  case "iiii":
2421
2469
  default:
2422
2470
  return localize2.day(dayOfWeek, {
@@ -2582,13 +2630,21 @@ const formatters = {
2582
2630
  return "Z";
2583
2631
  }
2584
2632
  switch (token) {
2633
+ // Hours and optional minutes
2585
2634
  case "X":
2586
2635
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
2636
+ // Hours, minutes and optional seconds without `:` delimiter
2637
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2638
+ // so this token always has the same output as `XX`
2587
2639
  case "XXXX":
2588
2640
  case "XX":
2589
2641
  return formatTimezone(timezoneOffset);
2642
+ // Hours, minutes and optional seconds with `:` delimiter
2643
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2644
+ // so this token always has the same output as `XXX`
2590
2645
  case "XXXXX":
2591
2646
  case "XXX":
2647
+ // Hours and minutes with `:` delimiter
2592
2648
  default:
2593
2649
  return formatTimezone(timezoneOffset, ":");
2594
2650
  }
@@ -2597,13 +2653,21 @@ const formatters = {
2597
2653
  x: function(date, token, _localize) {
2598
2654
  const timezoneOffset = date.getTimezoneOffset();
2599
2655
  switch (token) {
2656
+ // Hours and optional minutes
2600
2657
  case "x":
2601
2658
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
2659
+ // Hours, minutes and optional seconds without `:` delimiter
2660
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2661
+ // so this token always has the same output as `xx`
2602
2662
  case "xxxx":
2603
2663
  case "xx":
2604
2664
  return formatTimezone(timezoneOffset);
2665
+ // Hours, minutes and optional seconds with `:` delimiter
2666
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2667
+ // so this token always has the same output as `xxx`
2605
2668
  case "xxxxx":
2606
2669
  case "xxx":
2670
+ // Hours and minutes with `:` delimiter
2607
2671
  default:
2608
2672
  return formatTimezone(timezoneOffset, ":");
2609
2673
  }
@@ -2612,10 +2676,12 @@ const formatters = {
2612
2676
  O: function(date, token, _localize) {
2613
2677
  const timezoneOffset = date.getTimezoneOffset();
2614
2678
  switch (token) {
2679
+ // Short
2615
2680
  case "O":
2616
2681
  case "OO":
2617
2682
  case "OOO":
2618
2683
  return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2684
+ // Long
2619
2685
  case "OOOO":
2620
2686
  default:
2621
2687
  return "GMT" + formatTimezone(timezoneOffset, ":");
@@ -2625,10 +2691,12 @@ const formatters = {
2625
2691
  z: function(date, token, _localize) {
2626
2692
  const timezoneOffset = date.getTimezoneOffset();
2627
2693
  switch (token) {
2694
+ // Short
2628
2695
  case "z":
2629
2696
  case "zz":
2630
2697
  case "zzz":
2631
2698
  return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2699
+ // Long
2632
2700
  case "zzzz":
2633
2701
  default:
2634
2702
  return "GMT" + formatTimezone(timezoneOffset, ":");
@@ -3802,6 +3870,7 @@ function GoabText(props) {
3802
3870
  size: props.size,
3803
3871
  maxwidth: props.maxWidth,
3804
3872
  color: props.color,
3873
+ id: props.id,
3805
3874
  mt: props.mt,
3806
3875
  mb: props.mb,
3807
3876
  ml: props.ml,