rift-ds 1.34.0 → 1.36.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.
- package/README.md +4 -3
- package/behaviors/chat-card.css +6 -0
- package/behaviors/direction.css +6 -0
- package/behaviors/locale.d.ts +9 -0
- package/behaviors/locale.js +2 -0
- package/behaviors/shell.css +6 -0
- package/behaviors/shortcuts.js +2 -2
- package/behaviors/visually-hidden.css +6 -0
- package/bin/templates/blocks/app/dashboard/page.tsx +1 -1
- package/bin/templates/blocks/app/settings/ProfileForm.tsx +1 -1
- package/bin/templates/blocks/app/sign-in/page.tsx +3 -3
- package/bin/templates/blocks/components/blocks/AppShell.module.css +10 -6
- package/chat/ChatAgentPane.css +6 -0
- package/chat/ChatTabs.js +1 -1
- package/chat/ChatWidget.css +6 -0
- package/chat/ChatWidget.d.ts +2 -2
- package/chat/ChatWidget.js +1 -1
- package/chat/DemoWelcome.js +2 -2
- package/chat/FollowupSuggestions.js +1 -1
- package/chat/demo.css +6 -0
- package/chat/queries.js +1 -1
- package/chat/selection.css +6 -0
- package/components/Accordion/Accordion.css +6 -0
- package/components/ActionBar/ActionBar.css +84 -0
- package/components/ActionBar/ActionBar.d.ts +40 -0
- package/components/ActionBar/ActionBar.js +29 -0
- package/components/ActionCard/ActionCard.css +6 -0
- package/components/ActionReadout/ActionReadout.css +6 -0
- package/components/AgentPlan/AgentPlan.css +6 -0
- package/components/AgentRail/AgentRail.css +6 -0
- package/components/AgentStatus/AgentStatus.css +12 -7
- package/components/AiButton/AiButton.css +17 -11
- package/components/AiButton/AiButton.js +1 -1
- package/components/Alert/Alert.css +22 -0
- package/components/Alert/Alert.d.ts +2 -2
- package/components/Alert/Alert.js +3 -1
- package/components/AlertDialog/AlertDialog.css +6 -0
- package/components/AnchorNav/AnchorNav.css +6 -0
- package/components/AnimatedNumber/AnimatedNumber.css +5 -0
- package/components/AppLayout/AppLayout.css +6 -0
- package/components/AppSidebar/AppSidebar.css +159 -5
- package/components/AppSidebar/AppSidebar.d.ts +13 -1
- package/components/AppSidebar/AppSidebar.js +17 -7
- package/components/ArtifactCard/ArtifactCard.css +6 -0
- package/components/ArtifactPanel/ArtifactPanel.css +6 -0
- package/components/Attachment/Attachment.css +6 -0
- package/components/Attachment/AttachmentGroup.js +4 -1
- package/components/Avatar/Avatar.css +6 -0
- package/components/AvatarGroup/AvatarGroup.css +6 -0
- package/components/BackToTop/BackToTop.css +6 -0
- package/components/Badge/Badge.css +6 -0
- package/components/Banner/Banner.css +6 -0
- package/components/BentoTile/BentoTile.css +6 -0
- package/components/BottomNav/BottomNav.css +6 -0
- package/components/Breadcrumb/Breadcrumb.css +6 -0
- package/components/Button/Button.css +6 -0
- package/components/Button/Button.d.ts +7 -1
- package/components/Button/Button.js +2 -1
- package/components/ButtonGroup/ButtonGroup.css +6 -0
- package/components/Card/Card.css +6 -0
- package/components/CardStack/CardStack.css +5 -0
- package/components/Carousel/Carousel.css +6 -0
- package/components/Chart/Chart.css +9 -1
- package/components/ChatHeader/ChatHeader.css +6 -0
- package/components/ChatMarker/ChatMarker.css +6 -0
- package/components/ChatMessage/ChatMessage.css +6 -0
- package/components/ChatThread/ChatThread.css +6 -0
- package/components/ChatThread/ChatThread.d.ts +5 -1
- package/components/ChatThread/ChatThread.js +1 -1
- package/components/Checkbox/Checkbox.css +6 -0
- package/components/Checkbox/Checkbox.js +1 -1
- package/components/Checklist/Checklist.css +6 -0
- package/components/Chip/Chip.css +6 -0
- package/components/CodeBlock/CodeBlock.css +6 -0
- package/components/CodeDiff/CodeDiff.css +5 -0
- package/components/ColorPicker/ColorPicker.css +6 -0
- package/components/ColourSwatch/ColourSwatch.css +6 -0
- package/components/Combobox/Combobox.css +6 -0
- package/components/CommandPalette/CommandPalette.css +6 -0
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.css +6 -0
- package/components/Composer/Composer.css +6 -0
- package/components/ContactCard/ContactCard.css +6 -0
- package/components/ContextMenu/ContextMenu.css +6 -0
- package/components/ContextMenu/ContextMenu.d.ts +5 -1
- package/components/ContextMenu/ContextMenu.js +2 -1
- package/components/ContributionGraph/ContributionGraph.css +6 -0
- package/components/ContributionGraph/ContributionGraph.d.ts +7 -1
- package/components/ContributionGraph/ContributionGraph.js +4 -18
- package/components/ContributionGraph/weeks.d.ts +8 -0
- package/components/ContributionGraph/weeks.js +25 -0
- package/components/CurrencyInput/CurrencyInput.css +6 -0
- package/components/DataTable/DataTable.css +6 -0
- package/components/DataTable/DataTable.js +7 -3
- package/components/DateInput/DateInput.css +6 -0
- package/components/DatePicker/DatePicker.css +6 -0
- package/components/DateRangePicker/DateRangePicker.css +6 -0
- package/components/Deadline/Deadline.css +6 -0
- package/components/DecisionRow/DecisionRow.css +6 -0
- package/components/DescriptionList/DescriptionList.css +6 -0
- package/components/Dialog/Dialog.css +6 -0
- package/components/Divider/Divider.css +6 -0
- package/components/DocumentChip/DocumentChip.css +6 -0
- package/components/DocumentChip/DocumentChip.js +1 -1
- package/components/DocumentViewer/DocumentViewer.css +6 -0
- package/components/Drawer/Drawer.css +6 -0
- package/components/Dropdown/ChosenMark.css +6 -0
- package/components/Dropdown/Dropdown.css +6 -0
- package/components/Dropdown/Dropdown.js +1 -1
- package/components/DropdownMenu/DropdownMenu.css +6 -0
- package/components/EmptyState/EmptyState.css +6 -0
- package/components/EntityCard/EntityCard.css +6 -0
- package/components/EntitySwitcher/EntitySwitcher.css +17 -3
- package/components/EntitySwitcher/EntitySwitcher.js +1 -1
- package/components/ErrorSummary/ErrorSummary.css +6 -0
- package/components/ErrorSummary/ErrorSummary.js +3 -1
- package/components/EventCalendar/EventCalendar.css +158 -0
- package/components/EventCalendar/EventCalendar.d.ts +50 -4
- package/components/EventCalendar/EventCalendar.js +154 -23
- package/components/EventCalendar/eventTime.d.ts +31 -0
- package/components/EventCalendar/eventTime.js +42 -0
- package/components/Field/Field.css +6 -0
- package/components/Figure/Figure.css +6 -0
- package/components/FileInput/FileInput.css +6 -0
- package/components/FileInput/FileInput.d.ts +12 -4
- package/components/FileInput/FileInput.js +27 -4
- package/components/FilterBar/FilterBar.css +9 -1
- package/components/FormSection/FormSection.css +6 -0
- package/components/FunnelChart/FunnelChart.css +6 -0
- package/components/GanttChart/GanttChart.css +6 -0
- package/components/Gauge/Gauge.css +6 -0
- package/components/Globe/Globe.css +6 -0
- package/components/Grid/Grid.css +6 -0
- package/components/Heading/Heading.css +6 -0
- package/components/HoverCard/HoverCard.css +6 -0
- package/components/Icon/Icon.css +6 -0
- package/components/IconButton/IconButton.css +6 -0
- package/components/IconButton/IconButton.d.ts +7 -1
- package/components/IconButton/IconButton.js +2 -1
- package/components/ImageCompare/ImageCompare.css +6 -0
- package/components/Input/Input.css +52 -4
- package/components/Input/Input.d.ts +8 -0
- package/components/Input/Input.js +3 -0
- package/components/Inspector/Inspector.css +6 -0
- package/components/Instructions/Instructions.css +6 -0
- package/components/InterruptCard/InterruptCard.css +6 -0
- package/components/Kbd/Kbd.css +6 -0
- package/components/LegendTile/LegendTile.css +6 -0
- package/components/Lightbox/Lightbox.css +6 -0
- package/components/Link/Link.css +9 -1
- package/components/LinkList/LinkList.css +6 -0
- package/components/List/List.css +6 -0
- package/components/MapCallout/MapCallout.css +6 -0
- package/components/MapLegend/MapLegend.css +6 -0
- package/components/MaskedInput/MaskedInput.css +6 -0
- package/components/MegaMenu/MegaMenu.css +6 -0
- package/components/Mention/Mention.css +6 -0
- package/components/Mention/Mention.js +1 -1
- package/components/Menubar/Menubar.css +6 -0
- package/components/MessageActions/MessageActions.css +6 -0
- package/components/MessageCard/MessageCard.css +6 -0
- package/components/Meter/Meter.css +6 -0
- package/components/ModelPicker/ModelPicker.css +6 -0
- package/components/MotionSwatch/MotionSwatch.css +6 -0
- package/components/Nav/Nav.css +6 -0
- package/components/NavList/NavList.css +6 -0
- package/components/NotificationCenter/NotificationCenter.css +6 -0
- package/components/NumberInput/NumberInput.css +6 -0
- package/components/OrgChart/OrgChart.css +6 -0
- package/components/PageHeader/PageHeader.css +6 -0
- package/components/Pagination/Pagination.css +6 -0
- package/components/Panel/Panel.css +6 -0
- package/components/PinInput/PinInput.css +6 -0
- package/components/PixelAvatar/PixelAvatar.css +6 -0
- package/components/Popover/Popover.css +6 -0
- package/components/Popover/Popover.d.ts +5 -1
- package/components/Popover/Popover.js +3 -1
- package/components/ProgressBar/ProgressBar.css +6 -0
- package/components/ProgressBar/ProgressBar.d.ts +5 -1
- package/components/ProgressBar/ProgressBar.js +1 -1
- package/components/ProgressiveBlur/ProgressiveBlur.css +6 -0
- package/components/PromptSuggestions/PromptSuggestions.css +5 -0
- package/components/PromptSuggestions/PromptSuggestions.d.ts +5 -1
- package/components/PromptSuggestions/PromptSuggestions.js +1 -1
- package/components/Prose/Prose.css +6 -0
- package/components/QuestionCard/QuestionCard.css +5 -0
- package/components/Quote/Quote.css +6 -0
- package/components/RadioButton/RadioButton.css +6 -0
- package/components/Rating/Rating.css +6 -0
- package/components/Reasoning/Reasoning.css +6 -0
- package/components/ResourceTimeline/ResourceTimeline.css +6 -0
- package/components/ResourceTimeline/ResourceTimeline.js +2 -2
- package/components/RichDropdown/RichDropdown.css +6 -0
- package/components/SectionTitle/SectionTitle.css +6 -0
- package/components/SegmentedControl/SegmentedControl.css +126 -3
- package/components/SegmentedControl/SegmentedControl.d.ts +9 -0
- package/components/SegmentedControl/SegmentedControl.js +11 -1
- package/components/SelectionCard/SelectionCard.css +6 -0
- package/components/ShaderField/ShaderField.css +6 -0
- package/components/ShaderField/ShaderField.js +2 -0
- package/components/ShaderScene/ShaderScene.css +6 -0
- package/components/ShaderScene/ShaderScene.d.ts +3 -3
- package/components/ShaderScene/scenes.d.ts +17 -0
- package/components/ShaderScene/scenes.js +175 -1
- package/components/SidebarPanel/SidebarPanel.css +6 -0
- package/components/SignaturePad/SignaturePad.css +6 -0
- package/components/SiteFooter/SiteFooter.css +6 -0
- package/components/SiteHeader/SiteHeader.css +6 -0
- package/components/SiteLayout/SiteLayout.css +6 -0
- package/components/Skeleton/Skeleton.css +6 -0
- package/components/Slider/Slider.css +6 -0
- package/components/SourceChip/SourceChip.css +6 -0
- package/components/SourceTrail/SourceTrail.css +6 -0
- package/components/SpacingSwatch/SpacingSwatch.css +6 -0
- package/components/Sparkline/Sparkline.css +6 -0
- package/components/Spinner/Spinner.css +6 -0
- package/components/SplitButton/SplitButton.css +6 -0
- package/components/SplitButton/SplitButton.d.ts +7 -1
- package/components/SplitButton/SplitButton.js +3 -1
- package/components/SplitPane/SplitPane.css +6 -0
- package/components/Stack/Stack.css +6 -0
- package/components/Stat/Stat.css +25 -1
- package/components/Stat/Stat.d.ts +5 -0
- package/components/Stat/Stat.js +9 -3
- package/components/StatusDot/StatusDot.css +6 -0
- package/components/Stepper/Stepper.css +6 -0
- package/components/StreamingText/StreamingText.css +6 -0
- package/components/Swatch/Swatch.css +6 -0
- package/components/Table/Table.css +15 -1
- package/components/TableToolbar/TableToolbar.css +6 -0
- package/components/TableToolbar/TableToolbar.js +2 -2
- package/components/Tabs/Tabs.css +6 -0
- package/components/TagInput/TagInput.css +6 -0
- package/components/Text/Text.css +6 -0
- package/components/Textarea/Textarea.css +5 -0
- package/components/ThemePicker/ThemePicker.css +6 -0
- package/components/ThemeToggle/ThemeToggle.css +6 -0
- package/components/ThemeToggle/ThemeToggle.d.ts +1 -1
- package/components/ThreadPanel/ThreadPanel.css +6 -0
- package/components/ThreadTabs/ThreadTabs.css +6 -0
- package/components/ThreadTabs/ThreadTabs.d.ts +5 -1
- package/components/ThreadTabs/ThreadTabs.js +2 -1
- package/components/TimePicker/TimePicker.css +6 -0
- package/components/Timeline/Timeline.css +18 -18
- package/components/Toast/Toast.css +6 -0
- package/components/Toast/Toast.js +1 -1
- package/components/ToggleGroup/ToggleGroup.css +6 -0
- package/components/ToggleGroup/ToggleGroup.d.ts +5 -1
- package/components/ToggleSwitch/ToggleSwitch.css +21 -3
- package/components/ToggleSwitch/ToggleSwitch.d.ts +1 -1
- package/components/ToggleSwitch/ToggleSwitch.js +2 -2
- package/components/ToolCall/ToolCall.css +6 -0
- package/components/Toolbar/Toolbar.css +6 -0
- package/components/Tooltip/Tooltip.css +6 -0
- package/components/TopAppBar/TopAppBar.css +6 -0
- package/components/TreeView/TreeView.css +6 -0
- package/components/TypographySwatch/TypographySwatch.css +6 -0
- package/components/UsageCard/UsageCard.css +6 -0
- package/components/Waveform/Waveform.css +6 -0
- package/components/Widget/Widget.css +6 -0
- package/components/Wizard/Wizard.css +6 -0
- package/components/WorldMap/WorldMap.css +6 -0
- package/components/registry.json +21 -4
- package/components/registry.json.d.ts +21 -4
- package/components/registry.json.js +1 -1
- package/fonts/material-symbols.css +10 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/package.json +1 -1
- package/tokens/base.css +11 -2
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
for actions.
|
|
12
12
|
============================================ */
|
|
13
13
|
|
|
14
|
+
@layer rift.tokens, rift.preset, rift.components;
|
|
15
|
+
|
|
16
|
+
@layer rift.components {
|
|
17
|
+
|
|
14
18
|
.ds-event-calendar {
|
|
15
19
|
display: flex;
|
|
16
20
|
flex-direction: column;
|
|
@@ -22,6 +26,15 @@
|
|
|
22
26
|
padding: var(--padding-400);
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
/* Bare — inside a Panel or Widget that already draws the surface, the
|
|
30
|
+
calendar drops its own, so the two never double their borders. */
|
|
31
|
+
.ds-event-calendar--bare {
|
|
32
|
+
background-color: transparent;
|
|
33
|
+
border: none;
|
|
34
|
+
border-radius: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
/* ============================================
|
|
26
39
|
HEADER
|
|
27
40
|
============================================ */
|
|
@@ -453,6 +466,149 @@ button.ds-event-calendar__more:focus-visible {
|
|
|
453
466
|
grid-template-columns: 1fr;
|
|
454
467
|
}
|
|
455
468
|
|
|
469
|
+
/* ============================================
|
|
470
|
+
DAY VIEW SCHEDULE — the day as a list
|
|
471
|
+
Each event leads with its start over its end
|
|
472
|
+
in a column of its own, so the titles line up;
|
|
473
|
+
a bar in the event's accent sits between. The
|
|
474
|
+
rows take the pill's fill and hover.
|
|
475
|
+
============================================ */
|
|
476
|
+
|
|
477
|
+
.ds-event-calendar__agenda {
|
|
478
|
+
display: flex;
|
|
479
|
+
flex-direction: column;
|
|
480
|
+
gap: var(--gap-050);
|
|
481
|
+
margin: 0;
|
|
482
|
+
padding: 0;
|
|
483
|
+
list-style: none;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.ds-event-calendar__agenda-item {
|
|
487
|
+
display: flex;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
:where(.ds-event-calendar__agenda-event) {
|
|
491
|
+
--ds-event-accent: var(--color-status-neutral-border);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.ds-event-calendar__agenda-event {
|
|
495
|
+
display: flex;
|
|
496
|
+
align-items: stretch;
|
|
497
|
+
gap: var(--gap-200);
|
|
498
|
+
flex: 1 1 auto;
|
|
499
|
+
min-width: 0;
|
|
500
|
+
margin: 0;
|
|
501
|
+
padding: var(--padding-150) var(--padding-200);
|
|
502
|
+
background-color: var(--color-calendar-event-bg);
|
|
503
|
+
border: var(--border-025) solid transparent;
|
|
504
|
+
border-radius: var(--radius-200);
|
|
505
|
+
color: inherit;
|
|
506
|
+
font: inherit;
|
|
507
|
+
text-align: start;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
button.ds-event-calendar__agenda-event {
|
|
511
|
+
cursor: pointer;
|
|
512
|
+
transition:
|
|
513
|
+
background-color var(--motion-duration-fast) var(--motion-ease-standard),
|
|
514
|
+
border-color var(--motion-duration-fast) var(--motion-ease-standard);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
button.ds-event-calendar__agenda-event:hover {
|
|
518
|
+
background-color: var(--color-calendar-event-bg-hover);
|
|
519
|
+
border-color: var(--color-calendar-event-border);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
button.ds-event-calendar__agenda-event:focus-visible {
|
|
523
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
524
|
+
outline-offset: -2px;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.ds-event-calendar__agenda-time {
|
|
528
|
+
display: flex;
|
|
529
|
+
flex: none;
|
|
530
|
+
flex-direction: column;
|
|
531
|
+
min-inline-size: calc(var(--control-height-default) * 2);
|
|
532
|
+
font-variant-numeric: tabular-nums;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.ds-event-calendar__agenda-start {
|
|
536
|
+
color: var(--color-text-primary);
|
|
537
|
+
font-family: var(--font-paragraph-sm-emphasis-family);
|
|
538
|
+
font-size: var(--font-paragraph-sm-emphasis-size);
|
|
539
|
+
font-weight: var(--font-paragraph-sm-emphasis-weight);
|
|
540
|
+
line-height: var(--font-paragraph-sm-emphasis-line-height);
|
|
541
|
+
letter-spacing: var(--font-paragraph-sm-emphasis-letter-spacing);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.ds-event-calendar__agenda-end {
|
|
545
|
+
color: var(--color-text-tertiary);
|
|
546
|
+
font-family: var(--font-paragraph-sm-family);
|
|
547
|
+
font-size: var(--font-paragraph-sm-size);
|
|
548
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
549
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
550
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.ds-event-calendar__agenda-bar {
|
|
554
|
+
flex: none;
|
|
555
|
+
width: var(--gap-050);
|
|
556
|
+
border-radius: var(--radius-pill);
|
|
557
|
+
background-color: var(--ds-event-accent);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.ds-event-calendar__agenda-title {
|
|
561
|
+
flex: 1 1 auto;
|
|
562
|
+
min-width: 0;
|
|
563
|
+
align-self: center;
|
|
564
|
+
overflow-wrap: anywhere;
|
|
565
|
+
color: var(--color-text-primary);
|
|
566
|
+
font-family: var(--font-paragraph-emphasis-family);
|
|
567
|
+
font-size: var(--font-paragraph-emphasis-size);
|
|
568
|
+
font-weight: var(--font-paragraph-emphasis-weight);
|
|
569
|
+
line-height: var(--font-paragraph-emphasis-line-height);
|
|
570
|
+
letter-spacing: var(--font-paragraph-emphasis-letter-spacing);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.ds-event-calendar__agenda-empty {
|
|
574
|
+
margin: 0;
|
|
575
|
+
padding: var(--padding-300) var(--padding-200);
|
|
576
|
+
color: var(--color-text-tertiary);
|
|
577
|
+
font-family: var(--font-paragraph-sm-family);
|
|
578
|
+
font-size: var(--font-paragraph-sm-size);
|
|
579
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
580
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
581
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/* Now — today's convention, the inverse chip, with a rule running on from
|
|
585
|
+
it across the schedule. Current, not selected, so never the action
|
|
586
|
+
colour. */
|
|
587
|
+
.ds-event-calendar__now {
|
|
588
|
+
display: flex;
|
|
589
|
+
align-items: center;
|
|
590
|
+
gap: var(--gap-100);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.ds-event-calendar__now::after {
|
|
594
|
+
content: '';
|
|
595
|
+
flex: 1 1 auto;
|
|
596
|
+
border-block-start: var(--border-050) solid var(--color-bg-page-inverse);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.ds-event-calendar__now-label {
|
|
600
|
+
flex: none;
|
|
601
|
+
padding: 0 var(--padding-100);
|
|
602
|
+
background-color: var(--color-bg-page-inverse);
|
|
603
|
+
border-radius: var(--radius-pill);
|
|
604
|
+
color: var(--color-text-on-inverse);
|
|
605
|
+
font-family: var(--font-paragraph-sm-emphasis-family);
|
|
606
|
+
font-size: var(--font-paragraph-sm-emphasis-size);
|
|
607
|
+
font-weight: var(--font-paragraph-sm-emphasis-weight);
|
|
608
|
+
line-height: var(--font-paragraph-sm-emphasis-line-height);
|
|
609
|
+
letter-spacing: var(--font-paragraph-sm-emphasis-letter-spacing);
|
|
610
|
+
}
|
|
611
|
+
|
|
456
612
|
/* ============================================
|
|
457
613
|
SELECTED DAY — the host's panel for the chosen day
|
|
458
614
|
============================================ */
|
|
@@ -476,3 +632,5 @@ button.ds-event-calendar__more:focus-visible {
|
|
|
476
632
|
width: var(--gap-200);
|
|
477
633
|
height: var(--gap-200);
|
|
478
634
|
}
|
|
635
|
+
|
|
636
|
+
} /* @layer rift.components */
|
|
@@ -10,7 +10,17 @@ export interface EventCalendarEvent {
|
|
|
10
10
|
endDate?: string;
|
|
11
11
|
/** Short label shown in the event pill. */
|
|
12
12
|
title: string;
|
|
13
|
-
/**
|
|
13
|
+
/** When the event starts, as a 24-hour `HH:mm` string ("08:50", "13:40"). The calendar writes it in the resolved locale and sorts each day by it: untimed events first, then by the clock. */
|
|
14
|
+
start?: string;
|
|
15
|
+
/** When the event ends, as a 24-hour `HH:mm` string, later than `start`. With it, the event shows and is named with its range ("8:50 – 9:50 AM" in `en-US`). */
|
|
16
|
+
end?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Start time as already-formatted text like "09:30" or "1:40 PM", shown
|
|
19
|
+
* as written in place of `start` and `end` when it is set. Without `start`
|
|
20
|
+
* it sorts by the clock where it reads as a clock time, after untimed
|
|
21
|
+
* events and ahead of any other text.
|
|
22
|
+
* @deprecated Use `start` (and `end`), which the calendar formats in the resolved locale.
|
|
23
|
+
*/
|
|
14
24
|
time?: string;
|
|
15
25
|
/** Accent for the pill's dot, from the core accent roles. Defaults to `neutral`. */
|
|
16
26
|
color?: EventCalendarColor;
|
|
@@ -49,8 +59,32 @@ type EventCalendarOwnProps = {
|
|
|
49
59
|
* consumer; pair with `onDateClick` to move it.
|
|
50
60
|
*/
|
|
51
61
|
selectedDate?: string;
|
|
52
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* The date the calendar treats as today (`YYYY-MM-DD`): it carries the
|
|
64
|
+
* today chip and picks the month shown first. Defaults to the device's
|
|
65
|
+
* date, read in the browser only: a server render draws no today chip and
|
|
66
|
+
* the browser adds it once it hydrates, so a server in another time zone
|
|
67
|
+
* can never put it on the wrong day, and it moves on at midnight. The month
|
|
68
|
+
* shown first still falls back to the render-time clock, so a server-rendered
|
|
69
|
+
* host passes `today` (or `defaultMonth`) when the first month must match.
|
|
70
|
+
* Pin it for a demo, a test or a time zone the device is not in.
|
|
71
|
+
*/
|
|
53
72
|
today?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The time (24-hour `HH:mm`) the day view's now marker sits at, when the
|
|
75
|
+
* day shown is `today`. Defaults to the device's clock, read in the browser
|
|
76
|
+
* only and moved on every minute, so a server render draws no marker; pin
|
|
77
|
+
* it for a demo, a test or a screenshot.
|
|
78
|
+
*/
|
|
79
|
+
now?: string;
|
|
80
|
+
/** The text of the day view's now marker. */
|
|
81
|
+
nowLabel?: string;
|
|
82
|
+
/** What the day view's schedule shows in place of a time for an event with none. */
|
|
83
|
+
allDayLabel?: string;
|
|
84
|
+
/** What the day view's schedule says on a day with no events. */
|
|
85
|
+
emptyDayLabel?: string;
|
|
86
|
+
/** Strips the calendar's own fill, border, radius and padding, for a Panel or Widget that already draws the surface. */
|
|
87
|
+
bare?: boolean;
|
|
54
88
|
/** What each event colour means, shown as a row of dots and labels under the grid. With `legendToggles`, each entry also shows and hides its colour's events. */
|
|
55
89
|
legend?: EventCalendarLegendItem[];
|
|
56
90
|
/** Makes each legend entry a selectable Chip that shows or hides the events of its colour, so a reader can narrow a busy calendar by kind. */
|
|
@@ -72,7 +106,7 @@ type EventCalendarOwnProps = {
|
|
|
72
106
|
renderSelectedDay?: (date: string, events: EventCalendarEvent[]) => React.ReactNode;
|
|
73
107
|
/** Trailing header slot, e.g. a "New event" Button. */
|
|
74
108
|
actions?: React.ReactNode;
|
|
75
|
-
/** `month` shows the whole month, a day's overflow folded behind "+N more"; `week` shows one week in tall cells with every event, stepping a week at a time from the selected day's week (else today's), which it keeps as its own state after mount; `day` shows that one day
|
|
109
|
+
/** `month` shows the whole month, a day's overflow folded behind "+N more"; `week` shows one week in tall cells with every event, stepping a week at a time from the selected day's week (else today's), which it keeps as its own state after mount; `day` shows that one day as a schedule, each event's start and end time first, with a now marker on today, stepping a day at a time. */
|
|
76
110
|
view?: 'month' | 'week' | 'day';
|
|
77
111
|
/** Accessible name of the previous-month button. */
|
|
78
112
|
previousLabel?: string;
|
|
@@ -92,9 +126,21 @@ type EventCalendarOwnProps = {
|
|
|
92
126
|
* The month heading, given the first day of the month in view: the visible
|
|
93
127
|
* title and the name of the day grid. Defaults to the month name and the
|
|
94
128
|
* year in `locale` ("January 2026" in `en-US`). Month view only; the week
|
|
95
|
-
* view's heading is the
|
|
129
|
+
* view's heading is `weekLabel`, the day view's `dayLabel`.
|
|
96
130
|
*/
|
|
97
131
|
monthLabel?: (month: Date) => string;
|
|
132
|
+
/**
|
|
133
|
+
* The week view's heading, given the first and last day of the week in
|
|
134
|
+
* view: the visible title and the name of the week's cells. Defaults to
|
|
135
|
+
* the range in `locale` ("August 16 – 22, 2026" in `en-US`).
|
|
136
|
+
*/
|
|
137
|
+
weekLabel?: (start: Date, end: Date) => string;
|
|
138
|
+
/**
|
|
139
|
+
* The full name of a day, given the day: the day view's heading and every
|
|
140
|
+
* day's spoken name. Defaults to the weekday and the date in `locale`
|
|
141
|
+
* ("Thursday, August 20, 2026" in `en-US`).
|
|
142
|
+
*/
|
|
143
|
+
dayLabel?: (date: Date) => string;
|
|
98
144
|
/**
|
|
99
145
|
* Accessible name of a day's "+N more" overflow button, given the number of
|
|
100
146
|
* hidden events and the day. Defaults to "N more events" followed by the
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import React, { useMemo, useState } from "react";
|
|
3
|
+
import React, { useMemo, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { Chip } from "../Chip/Chip.js";
|
|
5
5
|
import "./EventCalendar.css";
|
|
6
6
|
import "../../behaviors/visually-hidden.css";
|
|
7
7
|
import "../../fonts/material-symbols.css";
|
|
8
8
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
9
|
-
import { weekStartOf, weekdayOffset, rotateWeek, weekdayHeadersIn } from "../../behaviors/locale.js";
|
|
9
|
+
import { weekStartOf, weekdayOffset, plainSpaces, rotateWeek, weekdayHeadersIn } from "../../behaviors/locale.js";
|
|
10
|
+
import { MOTION_DEADLINE_TICK_MS } from "../../tokens/motion.js";
|
|
11
|
+
import { clockMinutes, compareTimes, nowMarkerIndex, minutesOf } from "./eventTime.js";
|
|
10
12
|
function parseDay(str) {
|
|
11
13
|
const match = str ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(str) : null;
|
|
12
14
|
return match ? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])) : null;
|
|
@@ -39,6 +41,61 @@ const monthLabelIn = (locale) => {
|
|
|
39
41
|
const format = new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" });
|
|
40
42
|
return (month) => format.format(month);
|
|
41
43
|
};
|
|
44
|
+
const weekLabelIn = (locale) => {
|
|
45
|
+
const format = new Intl.DateTimeFormat(locale, { month: "long", day: "numeric", year: "numeric" });
|
|
46
|
+
return (start, end) => plainSpaces(format.formatRange(start, end));
|
|
47
|
+
};
|
|
48
|
+
const atMinutes = (minutes) => new Date(2e3, 0, 1, Math.floor(minutes / 60), minutes % 60);
|
|
49
|
+
const eventTimesIn = (locale) => {
|
|
50
|
+
const format = new Intl.DateTimeFormat(locale, { hour: "numeric", minute: "2-digit" });
|
|
51
|
+
const clock = (minutes) => plainSpaces(format.format(atMinutes(minutes)));
|
|
52
|
+
return (event) => {
|
|
53
|
+
if (event.time) return { range: event.time, start: event.time, end: null };
|
|
54
|
+
const start = clockMinutes(event.start);
|
|
55
|
+
if (start === null) return null;
|
|
56
|
+
const end = clockMinutes(event.end);
|
|
57
|
+
if (end === null || end <= start) return { range: clock(start), start: clock(start), end: null };
|
|
58
|
+
return {
|
|
59
|
+
range: plainSpaces(format.formatRange(atMinutes(start), atMinutes(end))),
|
|
60
|
+
start: clock(start),
|
|
61
|
+
end: clock(end)
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const sortTimeOf = (event) => clockMinutes(event.start) !== null ? event.start : event.time;
|
|
66
|
+
const subscribeClock = (onChange) => {
|
|
67
|
+
let timer;
|
|
68
|
+
const start = () => {
|
|
69
|
+
window.clearInterval(timer);
|
|
70
|
+
onChange();
|
|
71
|
+
timer = window.setInterval(onChange, MOTION_DEADLINE_TICK_MS);
|
|
72
|
+
};
|
|
73
|
+
const onVisibility = () => {
|
|
74
|
+
if (document.hidden) window.clearInterval(timer);
|
|
75
|
+
else start();
|
|
76
|
+
};
|
|
77
|
+
start();
|
|
78
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
79
|
+
return () => {
|
|
80
|
+
window.clearInterval(timer);
|
|
81
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const subscribeNothing = () => () => {
|
|
85
|
+
};
|
|
86
|
+
const clockToDay = () => formatDate(/* @__PURE__ */ new Date());
|
|
87
|
+
const clockToMinute = () => {
|
|
88
|
+
const now = /* @__PURE__ */ new Date();
|
|
89
|
+
return `${formatDate(now)}T${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
|
|
90
|
+
};
|
|
91
|
+
const noClock = () => null;
|
|
92
|
+
function useDeviceClock(precision) {
|
|
93
|
+
return useSyncExternalStore(
|
|
94
|
+
precision === "off" ? subscribeNothing : subscribeClock,
|
|
95
|
+
precision === "minute" ? clockToMinute : precision === "day" ? clockToDay : noClock,
|
|
96
|
+
noClock
|
|
97
|
+
);
|
|
98
|
+
}
|
|
42
99
|
const defaultMoreLabel = (count) => `+${count} more`;
|
|
43
100
|
const overflowLabelIn = (formatDayLabel) => (count, date) => `${count} more event${count === 1 ? "" : "s"}, ${formatDayLabel(date)}`;
|
|
44
101
|
const EventCalendar = React.forwardRef(
|
|
@@ -52,6 +109,11 @@ const EventCalendar = React.forwardRef(
|
|
|
52
109
|
onDateClick,
|
|
53
110
|
selectedDate,
|
|
54
111
|
today: todayProp,
|
|
112
|
+
now: nowProp,
|
|
113
|
+
nowLabel = "Now",
|
|
114
|
+
allDayLabel = "All day",
|
|
115
|
+
emptyDayLabel = "No events",
|
|
116
|
+
bare = false,
|
|
55
117
|
legend,
|
|
56
118
|
legendToggles = false,
|
|
57
119
|
hiddenColors: hiddenColorsProp,
|
|
@@ -69,6 +131,8 @@ const EventCalendar = React.forwardRef(
|
|
|
69
131
|
nextDayLabel = "Next day",
|
|
70
132
|
showLessLabel = "Show less",
|
|
71
133
|
monthLabel: monthLabelProp,
|
|
134
|
+
weekLabel: weekLabelProp,
|
|
135
|
+
dayLabel: dayLabelProp,
|
|
72
136
|
overflowLabel: overflowLabelProp,
|
|
73
137
|
moreLabel = defaultMoreLabel,
|
|
74
138
|
weekdayLabels,
|
|
@@ -78,11 +142,22 @@ const EventCalendar = React.forwardRef(
|
|
|
78
142
|
...rest
|
|
79
143
|
}, ref) => {
|
|
80
144
|
const baseClass = "ds-event-calendar";
|
|
81
|
-
const
|
|
145
|
+
const isDay = view === "day";
|
|
146
|
+
const isWeek = view === "week" || isDay;
|
|
147
|
+
const pinnedToday = useMemo(() => parseDay(todayProp), [todayProp]);
|
|
148
|
+
const pinnedNow = clockMinutes(nowProp);
|
|
149
|
+
const clock = useDeviceClock(isDay && pinnedNow === null ? "minute" : pinnedToday ? "off" : "day");
|
|
150
|
+
const clockDay = clock?.split("T")[0];
|
|
151
|
+
const clockTime = clock?.split("T")[1];
|
|
152
|
+
const deviceToday = useMemo(() => parseDay(clockDay), [clockDay]);
|
|
153
|
+
const today = pinnedToday ?? deviceToday;
|
|
154
|
+
const nowMinutes = pinnedNow ?? clockMinutes(clockTime);
|
|
155
|
+
const startingDay = today ?? /* @__PURE__ */ new Date();
|
|
82
156
|
const locale = useLocale(localeProp);
|
|
83
157
|
const weekStart = weekStartsOn ?? weekStartOf(locale);
|
|
84
158
|
const dayNumber = useMemo(() => new Intl.NumberFormat(locale), [locale]);
|
|
85
|
-
const formatDayLabel = useMemo(() => dayLabelIn(locale), [locale]);
|
|
159
|
+
const formatDayLabel = useMemo(() => dayLabelProp ?? dayLabelIn(locale), [dayLabelProp, locale]);
|
|
160
|
+
const eventTimes = useMemo(() => eventTimesIn(locale), [locale]);
|
|
86
161
|
const monthLabel = useMemo(() => monthLabelProp ?? monthLabelIn(locale), [monthLabelProp, locale]);
|
|
87
162
|
const overflowLabel = useMemo(
|
|
88
163
|
() => overflowLabelProp ?? overflowLabelIn(formatDayLabel),
|
|
@@ -90,7 +165,7 @@ const EventCalendar = React.forwardRef(
|
|
|
90
165
|
);
|
|
91
166
|
const isControlled = month !== void 0;
|
|
92
167
|
const [uncontrolledMonth, setUncontrolledMonth] = useState(
|
|
93
|
-
defaultMonth ?? formatMonth(
|
|
168
|
+
defaultMonth ?? formatMonth(startingDay.getFullYear(), startingDay.getMonth())
|
|
94
169
|
);
|
|
95
170
|
const currentMonth = isControlled ? month : uncontrolledMonth;
|
|
96
171
|
const [viewYear, viewMonth] = parseMonth(currentMonth);
|
|
@@ -100,9 +175,7 @@ const EventCalendar = React.forwardRef(
|
|
|
100
175
|
if (!isControlled) setUncontrolledMonth(value);
|
|
101
176
|
onMonthChange?.(value);
|
|
102
177
|
};
|
|
103
|
-
const
|
|
104
|
-
const isWeek = view === "week" || isDay;
|
|
105
|
-
const [weekAnchor, setWeekAnchor] = useState(() => parseDay(selectedDate) ?? today);
|
|
178
|
+
const [weekAnchor, setWeekAnchor] = useState(() => parseDay(selectedDate) ?? startingDay);
|
|
106
179
|
const weekStartDate = isDay ? weekAnchor : new Date(
|
|
107
180
|
weekAnchor.getFullYear(),
|
|
108
181
|
weekAnchor.getMonth(),
|
|
@@ -119,10 +192,8 @@ const EventCalendar = React.forwardRef(
|
|
|
119
192
|
};
|
|
120
193
|
const [expandedDays, setExpandedDays] = useState([]);
|
|
121
194
|
const toggleDay = (day) => setExpandedDays((current) => current.includes(day) ? current.filter((d) => d !== day) : [...current, day]);
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
return (start) => format.formatRange(start, new Date(start.getFullYear(), start.getMonth(), start.getDate() + 6));
|
|
125
|
-
}, [locale]);
|
|
195
|
+
const weekLabel = useMemo(() => weekLabelProp ?? weekLabelIn(locale), [weekLabelProp, locale]);
|
|
196
|
+
const weekRangeLabel = (start) => weekLabel(start, new Date(start.getFullYear(), start.getMonth(), start.getDate() + 6));
|
|
126
197
|
const [ownHidden, setOwnHidden] = useState(defaultHiddenColors);
|
|
127
198
|
const hiddenColors = hiddenColorsProp ?? ownHidden;
|
|
128
199
|
const toggleColor = (color) => {
|
|
@@ -155,10 +226,12 @@ const EventCalendar = React.forwardRef(
|
|
|
155
226
|
for (const list of map.values()) {
|
|
156
227
|
list.sort((a, b) => {
|
|
157
228
|
if (spans(a) !== spans(b)) return spans(a) ? -1 : 1;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (!
|
|
161
|
-
|
|
229
|
+
const ta = sortTimeOf(a);
|
|
230
|
+
const tb = sortTimeOf(b);
|
|
231
|
+
if (!ta && !tb) return 0;
|
|
232
|
+
if (!ta) return -1;
|
|
233
|
+
if (!tb) return 1;
|
|
234
|
+
return compareTimes(ta, tb, locale);
|
|
162
235
|
});
|
|
163
236
|
}
|
|
164
237
|
return map;
|
|
@@ -168,7 +241,7 @@ const EventCalendar = React.forwardRef(
|
|
|
168
241
|
return (event) => {
|
|
169
242
|
const start = parseDay(event.date);
|
|
170
243
|
const end = parseDay(event.endDate);
|
|
171
|
-
return start && end && end > start ? format.formatRange(start, end) : null;
|
|
244
|
+
return start && end && end > start ? plainSpaces(format.formatRange(start, end)) : null;
|
|
172
245
|
};
|
|
173
246
|
}, [locale]);
|
|
174
247
|
const firstDay = weekdayOffset(new Date(viewYear, viewMonth, 1).getDay(), weekStart);
|
|
@@ -188,10 +261,67 @@ const EventCalendar = React.forwardRef(
|
|
|
188
261
|
cells.push({ date, inMonth: date.getMonth() === viewMonth });
|
|
189
262
|
}
|
|
190
263
|
}
|
|
191
|
-
const classes = [
|
|
264
|
+
const classes = [
|
|
265
|
+
baseClass,
|
|
266
|
+
isWeek ? `${baseClass}--week` : "",
|
|
267
|
+
isDay ? `${baseClass}--day` : "",
|
|
268
|
+
bare ? `${baseClass}--bare` : "",
|
|
269
|
+
className
|
|
270
|
+
].filter(Boolean).join(" ");
|
|
192
271
|
const monthTitle = isDay ? formatDayLabel(weekStartDate) : isWeek ? weekRangeLabel(weekStartDate) : monthLabel(new Date(viewYear, viewMonth, 1));
|
|
193
272
|
const previousName = isDay ? previousDayLabel : isWeek ? previousWeekLabel : previousLabel;
|
|
194
273
|
const nextName = isDay ? nextDayLabel : isWeek ? nextWeekLabel : nextLabel;
|
|
274
|
+
const isTodayDate = (date) => today !== null && date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate();
|
|
275
|
+
const eventName = (event, dayLabel) => {
|
|
276
|
+
const span = formatSpan(event);
|
|
277
|
+
const times = eventTimes(event);
|
|
278
|
+
return span ? `${event.title}, ${span}` : `${event.title}${times ? `, ${times.range}` : ""}, ${dayLabel}`;
|
|
279
|
+
};
|
|
280
|
+
const renderAgenda = (date) => {
|
|
281
|
+
const dateStr = formatDate(date);
|
|
282
|
+
const dayEvents = eventsByDate.get(dateStr) ?? [];
|
|
283
|
+
const dayLabel = formatDayLabel(date);
|
|
284
|
+
const markerAt = isTodayDate(date) && nowMinutes !== null ? nowMarkerIndex(
|
|
285
|
+
dayEvents.map((event) => {
|
|
286
|
+
const time = sortTimeOf(event);
|
|
287
|
+
return time ? minutesOf(time) : null;
|
|
288
|
+
}),
|
|
289
|
+
nowMinutes
|
|
290
|
+
) : null;
|
|
291
|
+
if (dayEvents.length === 0) {
|
|
292
|
+
return /* @__PURE__ */ jsx("p", { className: `${baseClass}__agenda-empty`, children: emptyDayLabel });
|
|
293
|
+
}
|
|
294
|
+
const marker = /* @__PURE__ */ jsx("li", { className: `${baseClass}__now`, children: /* @__PURE__ */ jsx("span", { className: `${baseClass}__now-label`, children: nowLabel }) }, "now");
|
|
295
|
+
return /* @__PURE__ */ jsxs("ul", { className: `${baseClass}__agenda`, children: [
|
|
296
|
+
dayEvents.map((event, index) => {
|
|
297
|
+
const times = eventTimes(event);
|
|
298
|
+
const itemClasses = `${baseClass}__agenda-event ${baseClass}__event--${event.color ?? "neutral"}`;
|
|
299
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
300
|
+
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__agenda-time`, "aria-hidden": "true", children: [
|
|
301
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__agenda-start`, children: times ? times.start : allDayLabel }),
|
|
302
|
+
times?.end && /* @__PURE__ */ jsx("span", { className: `${baseClass}__agenda-end`, children: times.end })
|
|
303
|
+
] }),
|
|
304
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__agenda-bar`, "aria-hidden": "true" }),
|
|
305
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__agenda-title`, "aria-hidden": "true", children: event.title }),
|
|
306
|
+
!onEventClick && /* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", children: times ? `${event.title}, ${times.range}` : `${event.title}, ${allDayLabel}` })
|
|
307
|
+
] });
|
|
308
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
309
|
+
markerAt === index && marker,
|
|
310
|
+
/* @__PURE__ */ jsx("li", { className: `${baseClass}__agenda-item`, children: onEventClick ? /* @__PURE__ */ jsx(
|
|
311
|
+
"button",
|
|
312
|
+
{
|
|
313
|
+
type: "button",
|
|
314
|
+
className: itemClasses,
|
|
315
|
+
onClick: () => onEventClick(event),
|
|
316
|
+
"aria-label": eventName(event, dayLabel),
|
|
317
|
+
children: content
|
|
318
|
+
}
|
|
319
|
+
) : /* @__PURE__ */ jsx("span", { className: itemClasses, children: content }) })
|
|
320
|
+
] }, event.id);
|
|
321
|
+
}),
|
|
322
|
+
markerAt === dayEvents.length && marker
|
|
323
|
+
] });
|
|
324
|
+
};
|
|
195
325
|
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, children: [
|
|
196
326
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
197
327
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__month`, children: monthTitle }),
|
|
@@ -226,13 +356,13 @@ const EventCalendar = React.forwardRef(
|
|
|
226
356
|
className: `${baseClass}__grid`,
|
|
227
357
|
role: "group",
|
|
228
358
|
"aria-label": monthTitle,
|
|
229
|
-
children: cells.map(({ date, inMonth }) => {
|
|
359
|
+
children: isDay ? renderAgenda(weekStartDate) : cells.map(({ date, inMonth }) => {
|
|
230
360
|
const dateStr = formatDate(date);
|
|
231
361
|
const dayEvents = eventsByDate.get(dateStr) ?? [];
|
|
232
362
|
const expanded = isWeek || expandedDays.includes(dateStr);
|
|
233
363
|
const visible = expanded ? dayEvents : dayEvents.slice(0, maxEventsPerDay);
|
|
234
364
|
const overflow = dayEvents.length - visible.length;
|
|
235
|
-
const isToday =
|
|
365
|
+
const isToday = isTodayDate(date);
|
|
236
366
|
const dayLabel = formatDayLabel(date);
|
|
237
367
|
const isSelected = dateStr === selectedDate;
|
|
238
368
|
const cellClasses = [
|
|
@@ -274,6 +404,7 @@ const EventCalendar = React.forwardRef(
|
|
|
274
404
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__events`, children: [
|
|
275
405
|
visible.map((event) => {
|
|
276
406
|
const span = formatSpan(event);
|
|
407
|
+
const timeText = eventTimes(event)?.range;
|
|
277
408
|
const pillClasses = [
|
|
278
409
|
`${baseClass}__event`,
|
|
279
410
|
`${baseClass}__event--${event.color ?? "neutral"}`,
|
|
@@ -284,8 +415,8 @@ const EventCalendar = React.forwardRef(
|
|
|
284
415
|
const pillContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
285
416
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__event-dot`, "aria-hidden": "true" }),
|
|
286
417
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__event-title`, "aria-hidden": "true", children: event.title }),
|
|
287
|
-
|
|
288
|
-
!onEventClick && /* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", children:
|
|
418
|
+
timeText && /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-time`, "aria-hidden": "true", children: timeText }),
|
|
419
|
+
!onEventClick && /* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", children: timeText ? `${event.title}, ${timeText}` : event.title })
|
|
289
420
|
] });
|
|
290
421
|
return onEventClick ? /* @__PURE__ */ jsx(
|
|
291
422
|
"button",
|
|
@@ -293,7 +424,7 @@ const EventCalendar = React.forwardRef(
|
|
|
293
424
|
type: "button",
|
|
294
425
|
className: pillClasses,
|
|
295
426
|
onClick: () => onEventClick(event),
|
|
296
|
-
"aria-label":
|
|
427
|
+
"aria-label": eventName(event, dayLabel),
|
|
297
428
|
children: pillContent
|
|
298
429
|
},
|
|
299
430
|
event.id
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventCalendar's reading of an event's `time`, which is text the consumer
|
|
3
|
+
* has already formatted ("08:50", "1:40 PM", "13 h 40"). Sorting that text
|
|
4
|
+
* as text puts "12:50" before "8:50", so the calendar reads it as a clock
|
|
5
|
+
* time where it can and sorts by minutes after midnight.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* `time` as minutes after midnight, or null when it does not read as a
|
|
9
|
+
* clock time. Takes 24-hour and 12-hour forms, with `:`, `.` or `h` between
|
|
10
|
+
* hour and minutes and an English day period in any case or spacing
|
|
11
|
+
* ("pm", "P.M.").
|
|
12
|
+
*/
|
|
13
|
+
export declare function minutesOf(time: string): number | null;
|
|
14
|
+
/**
|
|
15
|
+
* Orders two events' `time`s: clock times by the clock, ahead of any time
|
|
16
|
+
* that does not read as one, and those by their text in `locale`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function compareTimes(a: string, b: string, locale: string): number;
|
|
19
|
+
/**
|
|
20
|
+
* An event's `start` or `end`, a 24-hour `HH:mm` string ("08:50", "13:40"),
|
|
21
|
+
* as minutes after midnight, or null when it is not one. Stricter than
|
|
22
|
+
* `minutesOf`: these are data, not display text.
|
|
23
|
+
*/
|
|
24
|
+
export declare function clockMinutes(value: string | undefined): number | null;
|
|
25
|
+
/**
|
|
26
|
+
* Where the day view's now marker sits in a day's sorted schedule, given each
|
|
27
|
+
* event's start in minutes (null for an untimed event) and the time now:
|
|
28
|
+
* before the first event that starts later, else after the last timed one.
|
|
29
|
+
* Null when the day has no timed event to place it against.
|
|
30
|
+
*/
|
|
31
|
+
export declare function nowMarkerIndex(starts: (number | null)[], now: number): number | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function minutesOf(time) {
|
|
2
|
+
const match = /^\s*(\d{1,2})(?:\s*[:.h]\s*(\d{2}))?\s*(?:([ap])\.?\s*m\.?)?\s*$/i.exec(time.normalize("NFKC"));
|
|
3
|
+
if (!match) return null;
|
|
4
|
+
let hour = Number(match[1]);
|
|
5
|
+
const minute = match[2] === void 0 ? 0 : Number(match[2]);
|
|
6
|
+
const period = match[3]?.toLowerCase();
|
|
7
|
+
if (minute > 59) return null;
|
|
8
|
+
if (period) {
|
|
9
|
+
if (hour < 1 || hour > 12) return null;
|
|
10
|
+
hour = hour % 12 + (period === "p" ? 12 : 0);
|
|
11
|
+
} else if (hour > 23) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return hour * 60 + minute;
|
|
15
|
+
}
|
|
16
|
+
function compareTimes(a, b, locale) {
|
|
17
|
+
const ma = minutesOf(a);
|
|
18
|
+
const mb = minutesOf(b);
|
|
19
|
+
if (ma !== null && mb !== null && ma !== mb) return ma - mb;
|
|
20
|
+
if (ma === null !== (mb === null)) return ma === null ? 1 : -1;
|
|
21
|
+
return a.localeCompare(b, locale);
|
|
22
|
+
}
|
|
23
|
+
function clockMinutes(value) {
|
|
24
|
+
const match = value ? /^([01]\d|2[0-3]):([0-5]\d)$/.exec(value) : null;
|
|
25
|
+
return match ? Number(match[1]) * 60 + Number(match[2]) : null;
|
|
26
|
+
}
|
|
27
|
+
function nowMarkerIndex(starts, now) {
|
|
28
|
+
let lastTimed = -1;
|
|
29
|
+
for (let i = 0; i < starts.length; i++) {
|
|
30
|
+
const start = starts[i];
|
|
31
|
+
if (start === null) continue;
|
|
32
|
+
if (start > now) return i;
|
|
33
|
+
lastTimed = i;
|
|
34
|
+
}
|
|
35
|
+
return lastTimed === -1 ? null : lastTimed + 1;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
clockMinutes,
|
|
39
|
+
compareTimes,
|
|
40
|
+
minutesOf,
|
|
41
|
+
nowMarkerIndex
|
|
42
|
+
};
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
changes no spacing.
|
|
10
10
|
============================================ */
|
|
11
11
|
|
|
12
|
+
@layer rift.tokens, rift.preset, rift.components;
|
|
13
|
+
|
|
14
|
+
@layer rift.components {
|
|
15
|
+
|
|
12
16
|
/* ============================================
|
|
13
17
|
LABEL
|
|
14
18
|
============================================ */
|
|
@@ -90,3 +94,5 @@
|
|
|
90
94
|
font-size: var(--font-paragraph-sm-size);
|
|
91
95
|
line-height: var(--font-paragraph-sm-line-height);
|
|
92
96
|
}
|
|
97
|
+
|
|
98
|
+
} /* @layer rift.components */
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
Pass onClick for a zoomable (lightbox) figure.
|
|
5
5
|
============================================ */
|
|
6
6
|
|
|
7
|
+
@layer rift.tokens, rift.preset, rift.components;
|
|
8
|
+
|
|
9
|
+
@layer rift.components {
|
|
10
|
+
|
|
7
11
|
.ds-figure {
|
|
8
12
|
margin: 0;
|
|
9
13
|
border-radius: var(--radius-300);
|
|
@@ -95,3 +99,5 @@
|
|
|
95
99
|
.ds-figure__verdict {
|
|
96
100
|
flex: none;
|
|
97
101
|
}
|
|
102
|
+
|
|
103
|
+
} /* @layer rift.components */
|