fluent-svelte-extra 1.9.5 → 1.9.6

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 (93) hide show
  1. package/Acrylic/AcrylicSurface.scss +6 -6
  2. package/Acrylic/AcrylicSurface.svelte +26 -26
  3. package/AutoSuggestBox/AutoSuggestBox.scss +44 -44
  4. package/AutoSuggestBox/AutoSuggestBox.svelte +85 -85
  5. package/Button/Button.scss +94 -94
  6. package/Button/Button.svelte +25 -25
  7. package/CalendarDatePicker/CalendarDatePicker.scss +15 -15
  8. package/CalendarDatePicker/CalendarDatePicker.svelte +45 -45
  9. package/CalendarView/CalendarView.scss +156 -156
  10. package/CalendarView/CalendarView.svelte +269 -269
  11. package/CalendarView/CalendarViewItem.scss +130 -130
  12. package/CalendarView/CalendarViewItem.svelte +23 -23
  13. package/Checkbox/Checkbox.scss +117 -117
  14. package/Checkbox/Checkbox.svelte +52 -52
  15. package/ComboBox/ComboBox.scss +152 -152
  16. package/ComboBox/ComboBox.svelte +155 -155
  17. package/ComboBox/ComboBoxItem.scss +80 -80
  18. package/ComboBox/ComboBoxItem.svelte +17 -17
  19. package/ContentDialog/ContentDialog.scss +98 -98
  20. package/ContentDialog/ContentDialog.svelte +76 -76
  21. package/ContextMenu/ContextMenu.scss +11 -11
  22. package/ContextMenu/ContextMenu.svelte +37 -37
  23. package/ExpandMenu/ExpandMenu.svelte +9 -9
  24. package/Expander/Expander.scss +136 -136
  25. package/Expander/Expander.svelte +95 -95
  26. package/Flipper/Flipper.svelte +37 -37
  27. package/Flyout/FlyoutSurface.scss +14 -14
  28. package/Flyout/FlyoutSurface.svelte +7 -7
  29. package/Flyout/FlyoutWrapper.scss +86 -86
  30. package/Flyout/FlyoutWrapper.svelte +60 -60
  31. package/GridView/GridViewItem.scss +20 -20
  32. package/GridView/GridViewItem.svelte +33 -25
  33. package/IconButton/IconButton.scss +32 -32
  34. package/IconButton/IconButton.svelte +28 -28
  35. package/InfoBadge/InfoBadge.scss +39 -39
  36. package/InfoBadge/InfoBadge.svelte +59 -59
  37. package/InfoBar/InfoBar.scss +122 -122
  38. package/InfoBar/InfoBar.svelte +76 -76
  39. package/ListItem/ListItem.scss +76 -76
  40. package/ListItem/ListItem.svelte +49 -49
  41. package/MenuBar/MenuBar.scss +10 -10
  42. package/MenuBar/MenuBar.svelte +7 -7
  43. package/MenuBar/MenuBarItem.scss +38 -38
  44. package/MenuBar/MenuBarItem.svelte +38 -38
  45. package/MenuFlyout/MenuFlyoutDivider.scss +7 -7
  46. package/MenuFlyout/MenuFlyoutDivider.svelte +5 -5
  47. package/MenuFlyout/MenuFlyoutItem.scss +146 -146
  48. package/MenuFlyout/MenuFlyoutItem.svelte +136 -136
  49. package/MenuFlyout/MenuFlyoutSurface.scss +79 -79
  50. package/MenuFlyout/MenuFlyoutSurface.svelte +22 -22
  51. package/MenuFlyout/MenuFlyoutWrapper.scss +64 -64
  52. package/MenuFlyout/MenuFlyoutWrapper.svelte +37 -37
  53. package/NavigationView/NavigationView.svelte +29 -29
  54. package/NumberBox/NumberBox.scss +31 -31
  55. package/NumberBox/NumberBox.svelte +166 -166
  56. package/PersonPicture/PersonPicture.scss +35 -35
  57. package/PersonPicture/PersonPicture.svelte +37 -37
  58. package/ProgressBar/ProgressBar.scss +83 -83
  59. package/ProgressBar/ProgressBar.svelte +36 -36
  60. package/ProgressRing/ProgressRing.scss +37 -37
  61. package/ProgressRing/ProgressRing.svelte +37 -37
  62. package/README.md +19 -19
  63. package/RadioButton/RadioButton.scss +114 -114
  64. package/RadioButton/RadioButton.svelte +38 -38
  65. package/RangeSlider/RangeSlider.svelte +26 -26
  66. package/ScrollView/ScrollView.svelte +3 -3
  67. package/Slider/Slider.scss +281 -281
  68. package/Slider/Slider.svelte +121 -121
  69. package/TeachingTip/TeachingTipSurface.scss +14 -14
  70. package/TeachingTip/TeachingTipSurface.svelte +7 -7
  71. package/TeachingTip/TeachingTipWrapper.scss +181 -79
  72. package/TeachingTip/TeachingTipWrapper.svelte +196 -73
  73. package/TeachingTip/TeachingTipWrapper.svelte.d.ts +6 -0
  74. package/TextArea/TextArea.scss +115 -115
  75. package/TextArea/TextArea.svelte +65 -65
  76. package/TextBlock/TextBlock.scss +66 -66
  77. package/TextBlock/TextBlock.svelte +12 -12
  78. package/TextBox/TextBox.scss +108 -108
  79. package/TextBox/TextBox.svelte +121 -121
  80. package/TextBox/TextBox.svelte.d.ts +7 -0
  81. package/TextBox/TextBoxButton.scss +34 -34
  82. package/TextBox/TextBoxButton.svelte +13 -13
  83. package/ToggleSwitch/ToggleSwitch.scss +118 -118
  84. package/ToggleSwitch/ToggleSwitch.svelte +29 -29
  85. package/Tooltip/TooltipSurface.scss +16 -16
  86. package/Tooltip/TooltipSurface.svelte +13 -13
  87. package/Tooltip/TooltipWrapper.scss +66 -66
  88. package/Tooltip/TooltipWrapper.svelte +37 -37
  89. package/_mixins.scss +130 -130
  90. package/package.json +1 -1
  91. package/svelte-jsx.d.ts +14 -14
  92. package/switchable.css +401 -401
  93. package/theme.css +744 -744
@@ -361,272 +361,272 @@ function fadeScale(node, { delay = 0, duration = 0, easing = x => x, baseScale =
361
361
  }
362
362
  };
363
363
  }
364
- </script>
365
-
366
- <!--
367
- @component
368
- A calendar view lets a user view and interact with a calendar that they can navigate by month, year, or decade. A user can select a single date or multiple dates. [Docs](https://fluent-svelte.vercel.app/docs/components/calendarview)
369
- - Usage:
370
- ```tsx
371
- <CalendarView value={new Date(2022, 2, 14)} />
372
- ```
373
- -->
374
- <div
375
- class="calendar-view {className}"
376
- class:floating={__floating}
377
- use:forwardEvents
378
- bind:this={element}
379
- {...$$restProps}
380
- >
381
- <header class="calendar-view-header">
382
- <div class="calendar-view-header-text" role="heading" aria-live="polite">
383
- <button
384
- on:click={() => updateView(view === "days" ? "months" : "years")}
385
- type="button"
386
- disabled={view === "years"}>{header}</button
387
- >
388
- </div>
389
- <div class="calendar-view-pagination-controls">
390
- <button type="button" disabled={view && min >= page} on:click={() => updatePage(-1)}>
391
- <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
392
- <path
393
- d="M4.95681 10.998C4.14912 10.998 3.67466 10.09 4.13591 9.42698L6.76854 5.64257C7.36532 4.78469 8.63448 4.7847 9.23126 5.64257L11.8639 9.42698C12.3251 10.09 11.8507 10.998 11.043 10.998H4.95681Z"
394
- />
395
- </svg>
396
- </button>
397
- <button type="button" disabled={max < nextPage} on:click={() => updatePage(1)}>
398
- <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
399
- <path
400
- d="M4.95681 5C4.14912 5 3.67466 5.90803 4.13591 6.57107L6.76854 10.3555C7.36532 11.2134 8.63448 11.2133 9.23126 10.3555L11.8639 6.57106C12.3251 5.90803 11.8507 5 11.043 5H4.95681Z"
401
- />
402
- </svg>
403
- </button>
404
- </div>
405
- </header>
406
- <div class="calendar-view-table-wrapper">
407
- {#key view}
408
- <table
409
- class="calendar-view-table view-{view}"
410
- role="grid"
411
- in:fadeScale={{
412
- duration: viewAnimationDirection !== "neutral" ? 500 : 0,
413
- easing: circOut,
414
- baseScale: viewAnimationDirection === "up" ? 1.29 : 0.84,
415
- delay: viewAnimationDirection !== "neutral" ? 150 : 0
416
- }}
417
- out:fadeScale|local={{
418
- duration: viewAnimationDirection !== "neutral" ? 150 : 0,
419
- easing: circOut,
420
- baseScale: viewAnimationDirection === "up" ? 0.84 : 1.29,
421
- delay: 0
422
- }}
423
- >
424
- {#if view === "days"}
425
- <thead>
426
- <tr>
427
- {#each Array(7) as _, day}
428
- <th
429
- scope="col"
430
- {...{
431
- abbr: getWeekdayLocale(day, { locale, offset: weekStart })
432
- }}
433
- >
434
- {getWeekdayLocale(day, {
435
- locale,
436
- format: "short",
437
- offset: weekStart
438
- })}
439
- </th>
440
- {/each}
441
- </tr>
442
- </thead>
443
- {/if}
444
- {#key page}
445
- <tbody
446
- use:bodyElementBinding
447
- in:fly={{
448
- opacity: 1,
449
- duration: pageAnimationDuration,
450
- easing: circOut,
451
- y:
452
- pageAnimationDirection === "neutral"
453
- ? 0
454
- : pageAnimationDirection === "up"
455
- ? -198
456
- : 198
457
- }}
458
- out:fly|local={{
459
- opacity: 1,
460
- duration: pageAnimationDuration,
461
- easing: circOut,
462
- y:
463
- pageAnimationDirection === "neutral"
464
- ? 0
465
- : pageAnimationDirection === "up"
466
- ? 198
467
- : -198
468
- }}
469
- >
470
- {#if view === "days"}
471
- {#each Array(6) as _, week}
472
- <tr>
473
- {#each getCalendarDays(page).slice(week * 7, week * 7 + 7) as day, i}
474
- {@const selected =
475
- value !== null &&
476
- (Array.isArray(value)
477
- ? indexOfDate(value, day, "day") > -1
478
- : compareDates(value, day, "day"))}
479
- {@const inMonth = compareDates(day, page, "month")}
480
- {@const firstFocusableDay = getCalendarDays(page).find(
481
- d =>
482
- compareDates(d, page, "month") &&
483
- (!blackout ||
484
- indexOfDate(blackout, d, "day") === -1) &&
485
- (!min || min <= d) &&
486
- (!max || max >= d)
487
- )}
488
-
489
- <td role="gridcell">
490
- <CalendarViewItem
491
- on:click={() => selectDay(day)}
492
- on:keydown={e => handleKeyDown(e, day)}
493
- outOfRange={!inMonth}
494
- current={compareDates(day, new Date(), "day")}
495
- disabled={min > day || max < day}
496
- blackout={blackout &&
497
- indexOfDate(blackout, day, "day") > -1}
498
- header={page &&
499
- headers &&
500
- day.getDate() === 1 &&
501
- getMonthLocale(day.getMonth(), {
502
- locale,
503
- format: "short"
504
- })}
505
- tabindex={firstFocusableDay &&
506
- compareDates(firstFocusableDay, day, "day")
507
- ? 0
508
- : -1}
509
- {selected}
510
- >
511
- {day.getDate()}
512
- </CalendarViewItem>
513
- </td>
514
- {/each}
515
- </tr>
516
- {/each}
517
- {:else}
518
- {#each Array(4) as _, row}
519
- <tr>
520
- {#if view === "months"}
521
- {#each getCalendarMonths(page).slice(row * 4, row * 4 + 4) as month, i}
522
- {@const selected =
523
- value !== null &&
524
- (Array.isArray(value)
525
- ? indexOfDate(value, month, "month") > -1
526
- : compareDates(value, month, "month"))}
527
- {@const inYear =
528
- month.getFullYear() === page.getFullYear()}
529
- {@const firstFocusableMonth = getCalendarMonths(
530
- page
531
- ).find(
532
- d =>
533
- compareDates(d, page, "year") &&
534
- (!min ||
535
- new Date(
536
- min.getFullYear(),
537
- min.getMonth(),
538
- 1
539
- ) <=
540
- new Date(
541
- d.getFullYear(),
542
- d.getMonth(),
543
- 1
544
- )) &&
545
- (!max || max >= d)
546
- )}
547
-
548
- <td role="gridcell">
549
- <CalendarViewItem
550
- on:click={() => selectMonth(month)}
551
- on:keydown={e => handleKeyDown(e, month)}
552
- variant="monthYear"
553
- outOfRange={!inYear}
554
- current={compareDates(
555
- month,
556
- new Date(),
557
- "month"
558
- )}
559
- disabled={(min?.getMonth() > month.getMonth() &&
560
- min?.getFullYear() ===
561
- month.getFullYear()) ||
562
- max < month}
563
- header={page &&
564
- headers &&
565
- month.getMonth() === 0 &&
566
- month.getFullYear().toString()}
567
- {selected}
568
- tabindex={firstFocusableMonth &&
569
- compareDates(
570
- firstFocusableMonth,
571
- month,
572
- "month"
573
- )
574
- ? 0
575
- : -1}
576
- >
577
- {getMonthLocale(month.getMonth(), {
578
- locale,
579
- format: "short"
580
- })}
581
- </CalendarViewItem>
582
- </td>
583
- {/each}
584
- {:else if view === "years"}
585
- {#each getCalendarYears(page).slice(row * 4, row * 4 + 4) as year, i}
586
- {@const selected =
587
- value !== null &&
588
- (Array.isArray(value)
589
- ? indexOfDate(value, year, "year") > -1
590
- : compareDates(value, year, "year"))}
591
- {@const inDecade = compareDates(year, page, "decade")}
592
- {@const firstFocusableYear = getCalendarYears(
593
- page
594
- ).find(
595
- d =>
596
- compareDates(d, page, "decade") &&
597
- (!min ||
598
- min.getFullYear() <= d.getFullYear()) &&
599
- (!max || max >= d)
600
- )}
601
-
602
- <td role="gridcell">
603
- <CalendarViewItem
604
- on:click={() => selectYear(year)}
605
- on:keydown={e => handleKeyDown(e, year)}
606
- variant="monthYear"
607
- outOfRange={!inDecade}
608
- current={compareDates(year, new Date(), "year")}
609
- disabled={min?.getFullYear() >
610
- year.getFullYear() || max < year}
611
- {selected}
612
- tabindex={firstFocusableYear &&
613
- compareDates(firstFocusableYear, year, "year")
614
- ? 0
615
- : -1}
616
- >
617
- {year.getFullYear()}
618
- </CalendarViewItem>
619
- </td>
620
- {/each}
621
- {/if}
622
- </tr>
623
- {/each}
624
- {/if}
625
- </tbody>
626
- {/key}
627
- </table>
628
- {/key}
629
- </div>
630
- </div>
631
-
632
- <style >.calendar-view{background-clip:padding-box;background-color:var(--fds-solid-background-quarternary);block-size:347px;border:1px solid var(--fds-surface-stroke-flyout);border-radius:var(--fds-control-corner-radius);color:var(--fds-text-primary);display:inline-flex;flex-direction:column;font-family:var(--fds-font-family-text);inline-size:300px;position:relative;text-align:start;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.calendar-view.floating{border-radius:var(--fds-overlay-corner-radius);box-shadow:var(--fds-flyout-shadow)}.calendar-view-header,.calendar-view-pagination-controls{align-items:center;display:flex}.calendar-view-pagination-controls button{-webkit-margin-start:4px;inline-size:30px;margin-inline-start:4px;padding:0}.calendar-view-header{-webkit-border-after:1px solid var(--fds-card-stroke-default);border-block-end:1px solid var(--fds-card-stroke-default);box-sizing:border-box;inline-size:100%;padding:7px}.calendar-view-header button{align-items:center;background-color:var(--fds-subtle-fill-transparent);border:none;border-radius:var(--fds-control-corner-radius);color:var(--fds-text-primary);display:flex;font-family:var(--fds-font-family-text);font-size:14px;font-weight:600;justify-content:center;line-height:20px;min-block-size:32px;outline:none;padding:0}.calendar-view-header button:focus-visible{box-shadow:var(--fds-focus-stroke)}.calendar-view-header button:hover{background-color:var(--fds-subtle-fill-secondary)}.calendar-view-header button:active{background-color:var(--fds-subtle-fill-tertiary);color:var(--fds-text-secondary)}.calendar-view-header button:disabled{background-color:var(--fds-sutble-fill-disabled);color:var(--fds-text-disabled)}.calendar-view-header button:disabled svg{color:var(--fds-control-strong-fill-disabled)}.calendar-view-header button svg{fill:currentColor;block-size:auto;color:var(--fds-control-strong-fill-default);inline-size:16px}.calendar-view-header-text{flex:1 1 auto}.calendar-view-header-text button{flex:1 1 auto;inline-size:100%;justify-content:flex-start;padding-inline:9px}.calendar-view-table{block-size:calc(100% - 6px);box-sizing:border-box;display:block;font-size:14px;inline-size:calc(100% - 6px);inset:0;margin:3px;overflow:hidden;position:absolute}.calendar-view-table-wrapper{background-color:var(--fds-layer-on-acrylic-background-default);block-size:298px;contain:layout;inline-size:298px;overflow:hidden;position:relative}.calendar-view-table.view-months,.calendar-view-table.view-years{block-size:calc(100% - 22px);inline-size:calc(100% - 22px);margin:11px}.calendar-view-table.view-months tr,.calendar-view-table.view-years tr{grid-gap:17.3333333333px;-webkit-margin-after:17.3333333333px;grid-template-columns:repeat(4,1fr);margin-block-end:17.3333333333px}.calendar-view-table td,.calendar-view-table th{padding:0}.calendar-view-table th{align-items:center;block-size:40px;display:flex;font-size:13px;font-weight:600;justify-content:center;text-align:center}.calendar-view-table tbody,.calendar-view-table thead{display:flex;flex-direction:column;inline-size:100%}.calendar-view-table tbody,.calendar-view-table thead tr{background-color:var(--fds-solid-background-quarternary);box-shadow:inset 0 0 0 100vmax var(--fds-layer-on-acrylic-background-default)}.calendar-view-table thead{position:relative;z-index:1}.calendar-view-table tbody{inset-block-end:0;inset-inline-start:0;position:absolute}.calendar-view-table tbody tr:last-child{-webkit-margin-after:0;margin-block-end:0}.calendar-view-table tr{grid-gap:2px;-webkit-margin-after:2px;display:grid;grid-template-columns:repeat(7,1fr);inline-size:100%;margin-block-end:2px}</style>
364
+ </script>
365
+
366
+ <!--
367
+ @component
368
+ A calendar view lets a user view and interact with a calendar that they can navigate by month, year, or decade. A user can select a single date or multiple dates. [Docs](https://fluent-svelte.vercel.app/docs/components/calendarview)
369
+ - Usage:
370
+ ```tsx
371
+ <CalendarView value={new Date(2022, 2, 14)} />
372
+ ```
373
+ -->
374
+ <div
375
+ class="calendar-view {className}"
376
+ class:floating={__floating}
377
+ use:forwardEvents
378
+ bind:this={element}
379
+ {...$$restProps}
380
+ >
381
+ <header class="calendar-view-header">
382
+ <div class="calendar-view-header-text" role="heading" aria-live="polite">
383
+ <button
384
+ on:click={() => updateView(view === "days" ? "months" : "years")}
385
+ type="button"
386
+ disabled={view === "years"}>{header}</button
387
+ >
388
+ </div>
389
+ <div class="calendar-view-pagination-controls">
390
+ <button type="button" disabled={view && min >= page} on:click={() => updatePage(-1)}>
391
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
392
+ <path
393
+ d="M4.95681 10.998C4.14912 10.998 3.67466 10.09 4.13591 9.42698L6.76854 5.64257C7.36532 4.78469 8.63448 4.7847 9.23126 5.64257L11.8639 9.42698C12.3251 10.09 11.8507 10.998 11.043 10.998H4.95681Z"
394
+ />
395
+ </svg>
396
+ </button>
397
+ <button type="button" disabled={max < nextPage} on:click={() => updatePage(1)}>
398
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
399
+ <path
400
+ d="M4.95681 5C4.14912 5 3.67466 5.90803 4.13591 6.57107L6.76854 10.3555C7.36532 11.2134 8.63448 11.2133 9.23126 10.3555L11.8639 6.57106C12.3251 5.90803 11.8507 5 11.043 5H4.95681Z"
401
+ />
402
+ </svg>
403
+ </button>
404
+ </div>
405
+ </header>
406
+ <div class="calendar-view-table-wrapper">
407
+ {#key view}
408
+ <table
409
+ class="calendar-view-table view-{view}"
410
+ role="grid"
411
+ in:fadeScale={{
412
+ duration: viewAnimationDirection !== "neutral" ? 500 : 0,
413
+ easing: circOut,
414
+ baseScale: viewAnimationDirection === "up" ? 1.29 : 0.84,
415
+ delay: viewAnimationDirection !== "neutral" ? 150 : 0
416
+ }}
417
+ out:fadeScale|local={{
418
+ duration: viewAnimationDirection !== "neutral" ? 150 : 0,
419
+ easing: circOut,
420
+ baseScale: viewAnimationDirection === "up" ? 0.84 : 1.29,
421
+ delay: 0
422
+ }}
423
+ >
424
+ {#if view === "days"}
425
+ <thead>
426
+ <tr>
427
+ {#each Array(7) as _, day}
428
+ <th
429
+ scope="col"
430
+ {...{
431
+ abbr: getWeekdayLocale(day, { locale, offset: weekStart })
432
+ }}
433
+ >
434
+ {getWeekdayLocale(day, {
435
+ locale,
436
+ format: "short",
437
+ offset: weekStart
438
+ })}
439
+ </th>
440
+ {/each}
441
+ </tr>
442
+ </thead>
443
+ {/if}
444
+ {#key page}
445
+ <tbody
446
+ use:bodyElementBinding
447
+ in:fly={{
448
+ opacity: 1,
449
+ duration: pageAnimationDuration,
450
+ easing: circOut,
451
+ y:
452
+ pageAnimationDirection === "neutral"
453
+ ? 0
454
+ : pageAnimationDirection === "up"
455
+ ? -198
456
+ : 198
457
+ }}
458
+ out:fly|local={{
459
+ opacity: 1,
460
+ duration: pageAnimationDuration,
461
+ easing: circOut,
462
+ y:
463
+ pageAnimationDirection === "neutral"
464
+ ? 0
465
+ : pageAnimationDirection === "up"
466
+ ? 198
467
+ : -198
468
+ }}
469
+ >
470
+ {#if view === "days"}
471
+ {#each Array(6) as _, week}
472
+ <tr>
473
+ {#each getCalendarDays(page).slice(week * 7, week * 7 + 7) as day, i}
474
+ {@const selected =
475
+ value !== null &&
476
+ (Array.isArray(value)
477
+ ? indexOfDate(value, day, "day") > -1
478
+ : compareDates(value, day, "day"))}
479
+ {@const inMonth = compareDates(day, page, "month")}
480
+ {@const firstFocusableDay = getCalendarDays(page).find(
481
+ d =>
482
+ compareDates(d, page, "month") &&
483
+ (!blackout ||
484
+ indexOfDate(blackout, d, "day") === -1) &&
485
+ (!min || min <= d) &&
486
+ (!max || max >= d)
487
+ )}
488
+
489
+ <td role="gridcell">
490
+ <CalendarViewItem
491
+ on:click={() => selectDay(day)}
492
+ on:keydown={e => handleKeyDown(e, day)}
493
+ outOfRange={!inMonth}
494
+ current={compareDates(day, new Date(), "day")}
495
+ disabled={min > day || max < day}
496
+ blackout={blackout &&
497
+ indexOfDate(blackout, day, "day") > -1}
498
+ header={page &&
499
+ headers &&
500
+ day.getDate() === 1 &&
501
+ getMonthLocale(day.getMonth(), {
502
+ locale,
503
+ format: "short"
504
+ })}
505
+ tabindex={firstFocusableDay &&
506
+ compareDates(firstFocusableDay, day, "day")
507
+ ? 0
508
+ : -1}
509
+ {selected}
510
+ >
511
+ {day.getDate()}
512
+ </CalendarViewItem>
513
+ </td>
514
+ {/each}
515
+ </tr>
516
+ {/each}
517
+ {:else}
518
+ {#each Array(4) as _, row}
519
+ <tr>
520
+ {#if view === "months"}
521
+ {#each getCalendarMonths(page).slice(row * 4, row * 4 + 4) as month, i}
522
+ {@const selected =
523
+ value !== null &&
524
+ (Array.isArray(value)
525
+ ? indexOfDate(value, month, "month") > -1
526
+ : compareDates(value, month, "month"))}
527
+ {@const inYear =
528
+ month.getFullYear() === page.getFullYear()}
529
+ {@const firstFocusableMonth = getCalendarMonths(
530
+ page
531
+ ).find(
532
+ d =>
533
+ compareDates(d, page, "year") &&
534
+ (!min ||
535
+ new Date(
536
+ min.getFullYear(),
537
+ min.getMonth(),
538
+ 1
539
+ ) <=
540
+ new Date(
541
+ d.getFullYear(),
542
+ d.getMonth(),
543
+ 1
544
+ )) &&
545
+ (!max || max >= d)
546
+ )}
547
+
548
+ <td role="gridcell">
549
+ <CalendarViewItem
550
+ on:click={() => selectMonth(month)}
551
+ on:keydown={e => handleKeyDown(e, month)}
552
+ variant="monthYear"
553
+ outOfRange={!inYear}
554
+ current={compareDates(
555
+ month,
556
+ new Date(),
557
+ "month"
558
+ )}
559
+ disabled={(min?.getMonth() > month.getMonth() &&
560
+ min?.getFullYear() ===
561
+ month.getFullYear()) ||
562
+ max < month}
563
+ header={page &&
564
+ headers &&
565
+ month.getMonth() === 0 &&
566
+ month.getFullYear().toString()}
567
+ {selected}
568
+ tabindex={firstFocusableMonth &&
569
+ compareDates(
570
+ firstFocusableMonth,
571
+ month,
572
+ "month"
573
+ )
574
+ ? 0
575
+ : -1}
576
+ >
577
+ {getMonthLocale(month.getMonth(), {
578
+ locale,
579
+ format: "short"
580
+ })}
581
+ </CalendarViewItem>
582
+ </td>
583
+ {/each}
584
+ {:else if view === "years"}
585
+ {#each getCalendarYears(page).slice(row * 4, row * 4 + 4) as year, i}
586
+ {@const selected =
587
+ value !== null &&
588
+ (Array.isArray(value)
589
+ ? indexOfDate(value, year, "year") > -1
590
+ : compareDates(value, year, "year"))}
591
+ {@const inDecade = compareDates(year, page, "decade")}
592
+ {@const firstFocusableYear = getCalendarYears(
593
+ page
594
+ ).find(
595
+ d =>
596
+ compareDates(d, page, "decade") &&
597
+ (!min ||
598
+ min.getFullYear() <= d.getFullYear()) &&
599
+ (!max || max >= d)
600
+ )}
601
+
602
+ <td role="gridcell">
603
+ <CalendarViewItem
604
+ on:click={() => selectYear(year)}
605
+ on:keydown={e => handleKeyDown(e, year)}
606
+ variant="monthYear"
607
+ outOfRange={!inDecade}
608
+ current={compareDates(year, new Date(), "year")}
609
+ disabled={min?.getFullYear() >
610
+ year.getFullYear() || max < year}
611
+ {selected}
612
+ tabindex={firstFocusableYear &&
613
+ compareDates(firstFocusableYear, year, "year")
614
+ ? 0
615
+ : -1}
616
+ >
617
+ {year.getFullYear()}
618
+ </CalendarViewItem>
619
+ </td>
620
+ {/each}
621
+ {/if}
622
+ </tr>
623
+ {/each}
624
+ {/if}
625
+ </tbody>
626
+ {/key}
627
+ </table>
628
+ {/key}
629
+ </div>
630
+ </div>
631
+
632
+ <style >.calendar-view{background-clip:padding-box;background-color:var(--fds-solid-background-quarternary);block-size:347px;border:1px solid var(--fds-surface-stroke-flyout);border-radius:var(--fds-control-corner-radius);color:var(--fds-text-primary);display:inline-flex;flex-direction:column;font-family:var(--fds-font-family-text);inline-size:300px;position:relative;text-align:start;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.calendar-view.floating{border-radius:var(--fds-overlay-corner-radius);box-shadow:var(--fds-flyout-shadow)}.calendar-view-header,.calendar-view-pagination-controls{align-items:center;display:flex}.calendar-view-pagination-controls button{-webkit-margin-start:4px;inline-size:30px;margin-inline-start:4px;padding:0}.calendar-view-header{-webkit-border-after:1px solid var(--fds-card-stroke-default);border-block-end:1px solid var(--fds-card-stroke-default);box-sizing:border-box;inline-size:100%;padding:7px}.calendar-view-header button{align-items:center;background-color:var(--fds-subtle-fill-transparent);border:none;border-radius:var(--fds-control-corner-radius);color:var(--fds-text-primary);display:flex;font-family:var(--fds-font-family-text);font-size:14px;font-weight:600;justify-content:center;line-height:20px;min-block-size:32px;outline:none;padding:0}.calendar-view-header button:focus-visible{box-shadow:var(--fds-focus-stroke)}.calendar-view-header button:hover{background-color:var(--fds-subtle-fill-secondary)}.calendar-view-header button:active{background-color:var(--fds-subtle-fill-tertiary);color:var(--fds-text-secondary)}.calendar-view-header button:disabled{background-color:var(--fds-sutble-fill-disabled);color:var(--fds-text-disabled)}.calendar-view-header button:disabled svg{color:var(--fds-control-strong-fill-disabled)}.calendar-view-header button svg{fill:currentColor;block-size:auto;color:var(--fds-control-strong-fill-default);inline-size:16px}.calendar-view-header-text{flex:1 1 auto}.calendar-view-header-text button{flex:1 1 auto;inline-size:100%;justify-content:flex-start;padding-inline:9px}.calendar-view-table{block-size:calc(100% - 6px);box-sizing:border-box;display:block;font-size:14px;inline-size:calc(100% - 6px);inset:0;margin:3px;overflow:hidden;position:absolute}.calendar-view-table-wrapper{background-color:var(--fds-layer-on-acrylic-background-default);block-size:298px;contain:layout;inline-size:298px;overflow:hidden;position:relative}.calendar-view-table.view-months,.calendar-view-table.view-years{block-size:calc(100% - 22px);inline-size:calc(100% - 22px);margin:11px}.calendar-view-table.view-months tr,.calendar-view-table.view-years tr{grid-gap:17.3333333333px;-webkit-margin-after:17.3333333333px;grid-template-columns:repeat(4,1fr);margin-block-end:17.3333333333px}.calendar-view-table td,.calendar-view-table th{padding:0}.calendar-view-table th{align-items:center;block-size:40px;display:flex;font-size:13px;font-weight:600;justify-content:center;text-align:center}.calendar-view-table tbody,.calendar-view-table thead{display:flex;flex-direction:column;inline-size:100%}.calendar-view-table tbody,.calendar-view-table thead tr{background-color:var(--fds-solid-background-quarternary);box-shadow:inset 0 0 0 100vmax var(--fds-layer-on-acrylic-background-default)}.calendar-view-table thead{position:relative;z-index:1}.calendar-view-table tbody{inset-block-end:0;inset-inline-start:0;position:absolute}.calendar-view-table tbody tr:last-child{-webkit-margin-after:0;margin-block-end:0}.calendar-view-table tr{grid-gap:2px;-webkit-margin-after:2px;display:grid;grid-template-columns:repeat(7,1fr);inline-size:100%;margin-block-end:2px}</style>