@astronox/core 0.1.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/LICENSE +21 -0
- package/README.md +66 -0
- package/package.json +77 -0
- package/src/client/clipboard.ts +7 -0
- package/src/client/focus.ts +17 -0
- package/src/client/index.ts +3 -0
- package/src/client/scroll.ts +15 -0
- package/src/components/actions/ActionListItem/ActionListItem.astro +78 -0
- package/src/components/actions/ActionListItem/ActionListItem.css +43 -0
- package/src/components/actions/Button/Button.astro +100 -0
- package/src/components/actions/Button/Button.css +165 -0
- package/src/components/actions/CardAction/CardAction.astro +97 -0
- package/src/components/actions/CardAction/CardAction.css +188 -0
- package/src/components/actions/MediaTrigger/MediaTrigger.astro +55 -0
- package/src/components/actions/MediaTrigger/MediaTrigger.css +175 -0
- package/src/components/actions/ScrollToTop/ScrollToTop.astro +36 -0
- package/src/components/actions/ScrollToTop/ScrollToTop.css +19 -0
- package/src/components/actions/ScrollToTop/scrollToTopController.ts +32 -0
- package/src/components/content/CardBody/CardBody.astro +31 -0
- package/src/components/content/CardBody/CardBody.css +74 -0
- package/src/components/content/CardFooter/CardFooter.astro +58 -0
- package/src/components/content/CardFooter/CardFooter.css +102 -0
- package/src/components/content/CardHeader/CardHeader.astro +96 -0
- package/src/components/content/CardHeader/CardHeader.css +164 -0
- package/src/components/content/CardLink/CardLink.astro +138 -0
- package/src/components/content/CardLink/CardLink.css +362 -0
- package/src/components/content/CodeBlock/CodeBlock.astro +102 -0
- package/src/components/content/CodeBlock/CodeBlock.css +85 -0
- package/src/components/content/CodeBlock/codeBlockController.ts +60 -0
- package/src/components/content/CodeBlock/contracts.ts +8 -0
- package/src/components/content/InlineDefinition/InlineDefinition.astro +31 -0
- package/src/components/content/InlineDefinition/InlineDefinition.css +9 -0
- package/src/components/content/MarkdownContent/MarkdownContent.astro +32 -0
- package/src/components/content/MarkdownContent/MarkdownContent.css +358 -0
- package/src/components/content/MarkdownContent/MarkdownInline.astro +44 -0
- package/src/components/content/MarkdownContent/MarkdownNode.astro +280 -0
- package/src/components/content/MarkdownContent/MarkdownSymbol.astro +47 -0
- package/src/components/content/MarkdownContent/contracts.ts +181 -0
- package/src/components/data-display/BadgeList/BadgeList.astro +54 -0
- package/src/components/data-display/BadgeList/BadgeList.css +29 -0
- package/src/components/data-display/IconList/IconList.astro +64 -0
- package/src/components/data-display/IconList/IconList.css +55 -0
- package/src/components/data-display/MetricTile/MetricTile.astro +68 -0
- package/src/components/data-display/MetricTile/MetricTile.css +103 -0
- package/src/components/data-display/MetricTile/MetricTileContent.astro +70 -0
- package/src/components/data-display/MetricTile/metricTileController.ts +9 -0
- package/src/components/data-display/Tag/Tag.astro +67 -0
- package/src/components/data-display/Tag/Tag.css +134 -0
- package/src/components/data-display/Tag/TagAffix.astro +33 -0
- package/src/components/data-display/TextPair/TextPair.astro +63 -0
- package/src/components/data-display/TextPair/TextPair.css +99 -0
- package/src/components/feedback/Spinner/Spinner.astro +32 -0
- package/src/components/feedback/Spinner/Spinner.css +37 -0
- package/src/components/feedback/Tooltip/Tooltip.astro +66 -0
- package/src/components/feedback/Tooltip/Tooltip.css +67 -0
- package/src/components/feedback/Tooltip/tooltipController.ts +371 -0
- package/src/components/forms/FieldError/FieldError.astro +31 -0
- package/src/components/forms/FieldError/FieldError.css +12 -0
- package/src/components/forms/FieldError/fieldErrorState.ts +21 -0
- package/src/components/forms/FieldLabel/FieldLabel.astro +32 -0
- package/src/components/forms/FieldLabel/FieldLabel.css +17 -0
- package/src/components/forms/TextInput/TextInput.astro +79 -0
- package/src/components/forms/TextInput/TextInput.css +121 -0
- package/src/components/forms/TextInput/textInputController.ts +53 -0
- package/src/components/icons/ArrowDownIcon.astro +26 -0
- package/src/components/icons/ArrowLeftIcon.astro +26 -0
- package/src/components/icons/ArrowRightIcon.astro +26 -0
- package/src/components/icons/ArrowUpDownIcon.astro +26 -0
- package/src/components/icons/ArrowUpIcon.astro +26 -0
- package/src/components/icons/BulletIcon.astro +21 -0
- package/src/components/icons/BurnIcon.astro +24 -0
- package/src/components/icons/CircleSymbolIcon.css +66 -0
- package/src/components/icons/ClearIcon.astro +28 -0
- package/src/components/icons/CloseIcon.astro +21 -0
- package/src/components/icons/CopyIcon.astro +30 -0
- package/src/components/icons/CurrencyIcon.css +9 -0
- package/src/components/icons/DayIcon.astro +33 -0
- package/src/components/icons/DollarIcon.astro +28 -0
- package/src/components/icons/DownloadIcon.astro +22 -0
- package/src/components/icons/EnterFullscreenIcon.astro +22 -0
- package/src/components/icons/EqualIcon.astro +25 -0
- package/src/components/icons/ExitFullscreenIcon.astro +22 -0
- package/src/components/icons/ExternalLinkIcon.astro +22 -0
- package/src/components/icons/FieldIcon.astro +28 -0
- package/src/components/icons/GrassIcon.astro +29 -0
- package/src/components/icons/InfoIcon.astro +24 -0
- package/src/components/icons/MinusIcon.astro +21 -0
- package/src/components/icons/MountainIcon.astro +31 -0
- package/src/components/icons/NightIcon.astro +32 -0
- package/src/components/icons/PlayIcon.astro +22 -0
- package/src/components/icons/PlusIcon.astro +21 -0
- package/src/components/icons/PoisonIcon.astro +24 -0
- package/src/components/icons/RibbonIcon.astro +25 -0
- package/src/components/icons/SlashIcon.astro +22 -0
- package/src/components/icons/SlowIcon.astro +25 -0
- package/src/components/icons/StarIcon.astro +28 -0
- package/src/components/icons/StunIcon.astro +22 -0
- package/src/components/icons/TableSortIcon.astro +34 -0
- package/src/components/icons/WaterIcon.astro +30 -0
- package/src/components/index.ts +83 -0
- package/src/components/media/CanvasFrame/CanvasFrame.astro +130 -0
- package/src/components/media/CanvasFrame/CanvasFrame.css +59 -0
- package/src/components/media/CanvasFrame/canvasFrameController.ts +104 -0
- package/src/components/media/EmbedFrame/EmbedFrame.astro +147 -0
- package/src/components/media/EmbedFrame/EmbedFrame.css +51 -0
- package/src/components/media/EmbedFrame/embedFrameController.ts +66 -0
- package/src/components/media/MediaFrame/MediaFrame.astro +34 -0
- package/src/components/media/MediaFrame/MediaFrame.css +66 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.astro +55 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.css +89 -0
- package/src/components/navigation/DesktopNavigation.astro +92 -0
- package/src/components/navigation/DesktopNavigation.css +99 -0
- package/src/components/navigation/Header.astro +73 -0
- package/src/components/navigation/Header.css +20 -0
- package/src/components/navigation/MobileNavigation.astro +124 -0
- package/src/components/navigation/MobileNavigation.css +177 -0
- package/src/components/navigation/NavigationBrand.astro +63 -0
- package/src/components/navigation/NavigationBrand.css +52 -0
- package/src/components/navigation/NavigationControl.css +166 -0
- package/src/components/navigation/NavigationItemContent.astro +24 -0
- package/src/components/navigation/NavigationLink.astro +121 -0
- package/src/components/navigation/NavigationLinks.astro +27 -0
- package/src/components/navigation/NavigationMenuList.astro +37 -0
- package/src/components/navigation/NavigationMenuList.css +6 -0
- package/src/components/navigation/SkipLink/SkipLink.astro +18 -0
- package/src/components/navigation/SkipLink/SkipLink.css +26 -0
- package/src/components/navigation/SubNavigation/SubNavigation.astro +124 -0
- package/src/components/navigation/SubNavigation/SubNavigation.css +211 -0
- package/src/components/navigation/mobileNavigationController.ts +122 -0
- package/src/components/navigation/navigationState.ts +35 -0
- package/src/components/navigation/navigationTypes.ts +18 -0
- package/src/components/seo/SeoHead.astro +194 -0
- package/src/components/widgetTypes.ts +3 -0
- package/src/composition/Grid/Grid.astro +82 -0
- package/src/composition/Grid/Grid.css +314 -0
- package/src/composition/GridItem/GridItem.astro +50 -0
- package/src/composition/GridItem/GridItem.css +95 -0
- package/src/composition/Inline/Inline.astro +48 -0
- package/src/composition/Inline/Inline.css +65 -0
- package/src/composition/Stack/Stack.astro +37 -0
- package/src/composition/Stack/Stack.css +31 -0
- package/src/composition/SurfaceGroup/SurfaceGroup.astro +44 -0
- package/src/composition/SurfaceGroup/SurfaceGroup.css +76 -0
- package/src/composition/SurfaceGroup/stickySurfaceGroupController.ts +89 -0
- package/src/composition/index.ts +6 -0
- package/src/config/index.ts +2 -0
- package/src/config/pageMeta.ts +55 -0
- package/src/config/siteConfig.ts +90 -0
- package/src/data/collectionValidation.ts +61 -0
- package/src/data/index.ts +1 -0
- package/src/display/contracts.ts +284 -0
- package/src/display/index.ts +1 -0
- package/src/index.ts +6 -0
- package/src/layouts/BaseLayout.astro +74 -0
- package/src/layouts/PageSurface.astro +15 -0
- package/src/layouts/PageSurface.css +24 -0
- package/src/layouts/index.ts +2 -0
- package/src/patterns/CircuitPuzzle/CircuitPuzzle.astro +93 -0
- package/src/patterns/CircuitPuzzle/CircuitPuzzle.css +118 -0
- package/src/patterns/CircuitPuzzle/circuitPuzzleController.ts +205 -0
- package/src/patterns/CircuitPuzzle/contracts.ts +42 -0
- package/src/patterns/Combobox/Combobox.astro +462 -0
- package/src/patterns/Combobox/Combobox.css +403 -0
- package/src/patterns/Combobox/comboboxController.ts +788 -0
- package/src/patterns/Combobox/contracts.ts +18 -0
- package/src/patterns/Dropdown/Dropdown.astro +127 -0
- package/src/patterns/Dropdown/Dropdown.css +100 -0
- package/src/patterns/Dropdown/dropdownController.ts +157 -0
- package/src/patterns/Fullscreen/FullscreenControl.astro +103 -0
- package/src/patterns/Fullscreen/FullscreenControl.css +49 -0
- package/src/patterns/Fullscreen/fullscreenController.ts +73 -0
- package/src/patterns/GlitchOverlay/GlitchOverlay.astro +50 -0
- package/src/patterns/GlitchOverlay/GlitchOverlay.css +234 -0
- package/src/patterns/GlitchOverlay/glitchOverlayController.ts +152 -0
- package/src/patterns/GuidedFlow/GuidedFlow.astro +60 -0
- package/src/patterns/GuidedFlow/GuidedFlow.css +82 -0
- package/src/patterns/GuidedFlow/contracts.ts +3 -0
- package/src/patterns/GuidedFlow/guidedFlowController.ts +49 -0
- package/src/patterns/MagneticFieldPuzzle/MagneticFieldPuzzle.astro +217 -0
- package/src/patterns/MagneticFieldPuzzle/MagneticFieldPuzzle.css +383 -0
- package/src/patterns/MagneticFieldPuzzle/contracts.ts +81 -0
- package/src/patterns/MagneticFieldPuzzle/magneticFieldPuzzleController.ts +802 -0
- package/src/patterns/MagneticFieldPuzzle/simulation.ts +244 -0
- package/src/patterns/MapViewport/MapViewport.astro +296 -0
- package/src/patterns/MapViewport/MapViewport.css +257 -0
- package/src/patterns/MapViewport/contracts.ts +79 -0
- package/src/patterns/MapViewport/geometry.ts +80 -0
- package/src/patterns/MapViewport/mapViewportController.ts +636 -0
- package/src/patterns/Modal/Modal.astro +64 -0
- package/src/patterns/Modal/Modal.css +87 -0
- package/src/patterns/Modal/ModalClose.astro +37 -0
- package/src/patterns/Modal/ModalOpen.astro +36 -0
- package/src/patterns/Modal/modalController.ts +118 -0
- package/src/patterns/PuzzleGrid/PuzzleGrid.astro +22 -0
- package/src/patterns/PuzzleGrid/PuzzleGrid.css +149 -0
- package/src/patterns/PuzzleGrid/contracts.ts +2 -0
- package/src/patterns/PuzzleGrid/selectionDismissal.ts +27 -0
- package/src/patterns/PuzzleGrid/state.ts +25 -0
- package/src/patterns/SpriteProjectilePreview/SpriteProjectilePreview.astro +65 -0
- package/src/patterns/SpriteProjectilePreview/SpriteProjectilePreview.css +35 -0
- package/src/patterns/SpriteProjectilePreview/contracts.ts +33 -0
- package/src/patterns/SpriteProjectilePreview/spriteProjectilePreviewController.ts +586 -0
- package/src/patterns/StageFlow/StageFlow.astro +57 -0
- package/src/patterns/StageFlow/StageFlow.css +54 -0
- package/src/patterns/StageFlow/StageFlowAlternative.astro +23 -0
- package/src/patterns/StageFlow/StageFlowArrow.astro +22 -0
- package/src/patterns/StageFlow/StageFlowConnector.astro +7 -0
- package/src/patterns/StageFlow/StageFlowConnector.css +4 -0
- package/src/patterns/StageFlow/StageFlowStage.astro +51 -0
- package/src/patterns/StageFlow/StageFlowStage.css +106 -0
- package/src/patterns/StageFlow/StageFlowStep.astro +24 -0
- package/src/patterns/StageFlow/StageFlowStep.css +19 -0
- package/src/patterns/StageFlow/StageFlowSymbol.css +28 -0
- package/src/patterns/Table/Table.astro +176 -0
- package/src/patterns/Table/Table.css +70 -0
- package/src/patterns/Table/TableBody.astro +185 -0
- package/src/patterns/Table/TableBody.css +262 -0
- package/src/patterns/Table/TableCell.astro +59 -0
- package/src/patterns/Table/TableCell.css +99 -0
- package/src/patterns/Table/TableCellValue.astro +86 -0
- package/src/patterns/Table/TableFooter.astro +32 -0
- package/src/patterns/Table/TableFooter.css +31 -0
- package/src/patterns/Table/TableHeader.astro +118 -0
- package/src/patterns/Table/TableHeader.css +209 -0
- package/src/patterns/Table/TablePagination.astro +70 -0
- package/src/patterns/Table/TablePagination.css +133 -0
- package/src/patterns/Table/TableSkeleton.astro +36 -0
- package/src/patterns/Table/TableSkeleton.css +81 -0
- package/src/patterns/Table/tableCellController.ts +11 -0
- package/src/patterns/Table/tableFilterController.ts +206 -0
- package/src/patterns/Table/tableHeaderOverflowController.ts +105 -0
- package/src/patterns/Table/tableLayout.ts +113 -0
- package/src/patterns/Table/tableProgressiveController.ts +319 -0
- package/src/patterns/Table/tableRowNavigationController.ts +91 -0
- package/src/patterns/Table/tableScrollController.ts +192 -0
- package/src/patterns/Table/tableSortController.ts +272 -0
- package/src/patterns/index.ts +46 -0
- package/src/primitives/index.ts +4 -0
- package/src/primitives/layout/Separator/Separator.astro +29 -0
- package/src/primitives/layout/Separator/Separator.css +20 -0
- package/src/primitives/media/AmbientAudio/AmbientAudio.astro +28 -0
- package/src/primitives/media/Media/Media.astro +122 -0
- package/src/primitives/media/Media/Media.css +161 -0
- package/src/primitives/text/TextBlock/TextBlock.astro +46 -0
- package/src/primitives/text/TextBlock/TextBlock.css +21 -0
- package/src/seo/StaticRedirect.astro +32 -0
- package/src/seo/index.ts +6 -0
- package/src/seo/pageSeo.ts +99 -0
- package/src/seo/robots.ts +16 -0
- package/src/seo/sitemap.ts +38 -0
- package/src/seo/structuredData.ts +133 -0
- package/src/seo/url.ts +64 -0
- package/src/styles/base.css +148 -0
- package/src/styles/interaction.css +108 -0
- package/src/styles/style.css +93 -0
- package/src/styles/tokens.css +256 -0
- package/src/theme/contracts.ts +7 -0
- package/src/theme/index.ts +1 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
.card-footer {
|
|
2
|
+
--surface-border-width: var(--nox-border-width);
|
|
3
|
+
--surface-border-color: var(--nox-border);
|
|
4
|
+
--surface-radius: var(--nox-radius-md);
|
|
5
|
+
--surface-background: var(--nox-surface-muted);
|
|
6
|
+
|
|
7
|
+
container-type: inline-size;
|
|
8
|
+
min-width: 0;
|
|
9
|
+
overflow: clip;
|
|
10
|
+
border: var(--surface-border-width) solid var(--surface-border-color);
|
|
11
|
+
border-radius: var(--surface-radius);
|
|
12
|
+
background: var(--surface-background);
|
|
13
|
+
color: var(--nox-text-muted);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.card-footer__layout {
|
|
17
|
+
--card-footer-size: var(--nox-section-block-size);
|
|
18
|
+
--card-footer-media-size: var(--nox-compact-media-responsive-size);
|
|
19
|
+
|
|
20
|
+
display: grid;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
min-height: var(--card-footer-size);
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.card-footer[data-has-media] .card-footer__layout {
|
|
27
|
+
grid-template-columns: var(--card-footer-size) minmax(0, 1fr);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.card-footer[data-has-action] .card-footer__layout {
|
|
31
|
+
grid-template-columns: minmax(0, 1fr) var(--card-footer-size);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.card-footer[data-has-media][data-has-action] .card-footer__layout {
|
|
35
|
+
grid-template-columns:
|
|
36
|
+
var(--card-footer-size)
|
|
37
|
+
minmax(0, 1fr)
|
|
38
|
+
var(--card-footer-size);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.card-footer__media {
|
|
42
|
+
display: grid;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
min-height: var(--card-footer-size);
|
|
45
|
+
place-items: center;
|
|
46
|
+
border-inline-end: var(--nox-border-width) solid var(--surface-border-color);
|
|
47
|
+
background: var(--nox-surface-strong);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.card-footer__image {
|
|
51
|
+
--media-object-inline-size: 100%;
|
|
52
|
+
--media-object-block-size: 100%;
|
|
53
|
+
--media-object-max-inline-size: var(--card-footer-media-size);
|
|
54
|
+
--media-object-max-block-size: var(--card-footer-media-size);
|
|
55
|
+
|
|
56
|
+
inline-size: var(--card-footer-size);
|
|
57
|
+
block-size: var(--card-footer-size);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.card-footer__content {
|
|
61
|
+
display: grid;
|
|
62
|
+
min-width: 0;
|
|
63
|
+
min-height: var(--card-footer-size);
|
|
64
|
+
align-items: center;
|
|
65
|
+
padding: var(--nox-space-3) var(--nox-space-5);
|
|
66
|
+
font-size: var(--nox-font-size-sm);
|
|
67
|
+
font-weight: var(--nox-font-weight-medium);
|
|
68
|
+
line-height: var(--nox-line-height-tight);
|
|
69
|
+
overflow-wrap: anywhere;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.card-footer__content a {
|
|
73
|
+
color: var(--nox-link);
|
|
74
|
+
text-underline-offset: 0.2em;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.card-footer__content strong {
|
|
78
|
+
font-weight: var(--nox-font-weight-strong);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.card-footer__action {
|
|
82
|
+
display: grid;
|
|
83
|
+
min-width: 0;
|
|
84
|
+
min-height: var(--card-footer-size);
|
|
85
|
+
place-items: stretch;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
border-inline-start: var(--nox-border-width) solid var(--surface-border-color);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.card-footer__action > .nox-button[data-button-borderless] {
|
|
91
|
+
--nox-button-background: transparent;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@container (width < 32rem) {
|
|
95
|
+
.card-footer__layout {
|
|
96
|
+
--card-footer-size: var(--nox-section-compact-block-size);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.card-footer__content {
|
|
100
|
+
padding-inline: var(--nox-space-4);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
import type { Tone } from '../../../theme/contracts';
|
|
4
|
+
import type { DisplayMedia, TextWeight } from '../../../display/contracts';
|
|
5
|
+
import type {
|
|
6
|
+
AstroComponent,
|
|
7
|
+
HeadingLevel,
|
|
8
|
+
} from '../../widgetTypes';
|
|
9
|
+
import Inline from '../../../composition/Inline/Inline.astro';
|
|
10
|
+
import Media from '../../../primitives/media/Media/Media.astro';
|
|
11
|
+
|
|
12
|
+
type HeaderVisual =
|
|
13
|
+
| { icon?: AstroComponent; media?: never }
|
|
14
|
+
| { icon?: never; media: DisplayMedia };
|
|
15
|
+
|
|
16
|
+
type Props = HTMLAttributes<'header'> &
|
|
17
|
+
HeaderVisual & {
|
|
18
|
+
title: string;
|
|
19
|
+
endWeight?: TextWeight;
|
|
20
|
+
headingLevel?: HeadingLevel;
|
|
21
|
+
sticky?: boolean;
|
|
22
|
+
tone?: Tone;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
class: className,
|
|
27
|
+
'data-tone': dataTone,
|
|
28
|
+
title,
|
|
29
|
+
endWeight = 'strong',
|
|
30
|
+
icon: Icon,
|
|
31
|
+
media,
|
|
32
|
+
headingLevel = 2,
|
|
33
|
+
sticky = false,
|
|
34
|
+
tone,
|
|
35
|
+
...attrs
|
|
36
|
+
}: Props = Astro.props;
|
|
37
|
+
const HeadingTag = `h${headingLevel}` as const;
|
|
38
|
+
const hasVisual = Boolean(Icon || media);
|
|
39
|
+
const hasEnd = Astro.slots.has('end');
|
|
40
|
+
const hasAction = Astro.slots.has('action');
|
|
41
|
+
const resolvedTone = tone ?? dataTone;
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
<header
|
|
45
|
+
{...attrs}
|
|
46
|
+
class:list={['card-header', className]}
|
|
47
|
+
data-widget="card-header"
|
|
48
|
+
data-surface
|
|
49
|
+
data-has-action={hasAction ? 'true' : undefined}
|
|
50
|
+
data-has-end={hasEnd ? 'true' : undefined}
|
|
51
|
+
data-has-visual={hasVisual ? 'true' : 'false'}
|
|
52
|
+
data-sticky-surface={sticky ? true : undefined}
|
|
53
|
+
data-tone={resolvedTone}
|
|
54
|
+
>
|
|
55
|
+
<div class="card-header__layout">
|
|
56
|
+
{
|
|
57
|
+
hasVisual ? (
|
|
58
|
+
<div class="card-header__media" aria-hidden="true">
|
|
59
|
+
{Icon ? (
|
|
60
|
+
<Icon />
|
|
61
|
+
) : media ? (
|
|
62
|
+
<Media
|
|
63
|
+
class="card-header__image"
|
|
64
|
+
media={media}
|
|
65
|
+
fit="contain"
|
|
66
|
+
size="intrinsic"
|
|
67
|
+
/>
|
|
68
|
+
) : null}
|
|
69
|
+
</div>
|
|
70
|
+
) : null
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
<div class="card-header__main">
|
|
74
|
+
<Inline align="center" gap="md" justify="between">
|
|
75
|
+
<HeadingTag class="card-header__title" data-card-header-title>
|
|
76
|
+
{title}
|
|
77
|
+
</HeadingTag>
|
|
78
|
+
{
|
|
79
|
+
hasEnd ? (
|
|
80
|
+
<span class="card-header__end" data-text-weight={endWeight}>
|
|
81
|
+
<slot name="end" />
|
|
82
|
+
</span>
|
|
83
|
+
) : null
|
|
84
|
+
}
|
|
85
|
+
</Inline>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
{
|
|
89
|
+
hasAction ? (
|
|
90
|
+
<div class="card-header__action">
|
|
91
|
+
<slot name="action" />
|
|
92
|
+
</div>
|
|
93
|
+
) : null
|
|
94
|
+
}
|
|
95
|
+
</div>
|
|
96
|
+
</header>
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
.card-header {
|
|
2
|
+
--surface-border-width: var(--nox-border-width);
|
|
3
|
+
--surface-border-color: var(--nox-border);
|
|
4
|
+
--surface-radius: var(--nox-radius-md);
|
|
5
|
+
--surface-background: var(--nox-tone-background);
|
|
6
|
+
--card-header-border-color: var(--surface-border-color);
|
|
7
|
+
|
|
8
|
+
container-type: inline-size;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
overflow: clip;
|
|
11
|
+
border: var(--surface-border-width) solid var(--card-header-border-color);
|
|
12
|
+
border-radius: var(--surface-radius);
|
|
13
|
+
background: var(--surface-background);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.card-header[data-sticky-surface] {
|
|
17
|
+
position: sticky;
|
|
18
|
+
z-index: 41;
|
|
19
|
+
top: var(--nox-layout-gap);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.card-header__layout {
|
|
23
|
+
--card-header-size: var(--nox-section-responsive-block-size);
|
|
24
|
+
--card-header-icon-size: var(--nox-compact-media-responsive-size);
|
|
25
|
+
--card-header-media-size: var(--nox-compact-media-responsive-size);
|
|
26
|
+
--card-header-title-size: 1.55rem;
|
|
27
|
+
|
|
28
|
+
display: grid;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
block-size: var(--card-header-size);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.card-header[data-has-visual='true'] .card-header__layout {
|
|
34
|
+
grid-template-columns: var(--card-header-size) minmax(0, 1fr);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.card-header[data-has-action='true'] .card-header__layout {
|
|
38
|
+
grid-template-columns: minmax(0, 1fr) var(--card-header-size);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.card-header[data-has-visual='true'][data-has-action='true']
|
|
42
|
+
.card-header__layout {
|
|
43
|
+
grid-template-columns:
|
|
44
|
+
var(--card-header-size)
|
|
45
|
+
minmax(0, 1fr)
|
|
46
|
+
var(--card-header-size);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.card-header__media {
|
|
50
|
+
display: grid;
|
|
51
|
+
min-width: 0;
|
|
52
|
+
min-height: var(--card-header-size);
|
|
53
|
+
place-items: center;
|
|
54
|
+
border-inline-end: var(--nox-border-width) solid
|
|
55
|
+
var(--card-header-border-color);
|
|
56
|
+
background: var(--nox-tone-background-strong);
|
|
57
|
+
color: var(--nox-tone-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.card-header__media svg {
|
|
61
|
+
display: block;
|
|
62
|
+
width: var(--card-header-icon-size);
|
|
63
|
+
height: var(--card-header-icon-size);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.card-header__image {
|
|
67
|
+
--media-object-inline-size: 100%;
|
|
68
|
+
--media-object-block-size: 100%;
|
|
69
|
+
--media-object-max-inline-size: var(--card-header-media-size);
|
|
70
|
+
--media-object-max-block-size: var(--card-header-media-size);
|
|
71
|
+
|
|
72
|
+
inline-size: var(--card-header-size);
|
|
73
|
+
block-size: var(--card-header-size);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.card-header__action {
|
|
77
|
+
display: grid;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
min-height: var(--card-header-size);
|
|
80
|
+
place-items: stretch;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
border-inline-start: var(--nox-border-width) solid
|
|
83
|
+
var(--card-header-border-color);
|
|
84
|
+
background: var(--nox-tone-background-strong);
|
|
85
|
+
color: var(--nox-tone-color);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.card-header__action > .nox-button[data-button-borderless] {
|
|
89
|
+
--nox-button-background: transparent;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.card-header__main {
|
|
93
|
+
display: grid;
|
|
94
|
+
min-width: 0;
|
|
95
|
+
align-content: center;
|
|
96
|
+
padding: var(--nox-space-3) var(--nox-space-5);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.card-header[data-has-end='true'] .card-header__main {
|
|
100
|
+
padding-block: var(--nox-space-1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.card-header__title {
|
|
104
|
+
min-width: 0;
|
|
105
|
+
flex: 1 1 auto;
|
|
106
|
+
margin: 0;
|
|
107
|
+
color: var(--nox-tone-text);
|
|
108
|
+
font-size: var(--card-header-title-size);
|
|
109
|
+
font-weight: var(--nox-font-weight-strong);
|
|
110
|
+
letter-spacing: var(--nox-letter-spacing-wide);
|
|
111
|
+
line-height: 1.05;
|
|
112
|
+
overflow-wrap: anywhere;
|
|
113
|
+
text-transform: uppercase;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.card-header[data-has-end='true'] .card-header__title {
|
|
117
|
+
flex: 0 0 auto;
|
|
118
|
+
overflow-wrap: normal;
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.card-header__end {
|
|
123
|
+
display: flex;
|
|
124
|
+
min-width: 0;
|
|
125
|
+
max-width: 100%;
|
|
126
|
+
flex: 1 1 0;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: flex-end;
|
|
129
|
+
color: var(--nox-text-muted);
|
|
130
|
+
font-size: var(--card-header-title-size);
|
|
131
|
+
font-weight: var(--nox-font-weight-strong);
|
|
132
|
+
letter-spacing: var(--nox-letter-spacing-wide);
|
|
133
|
+
line-height: 1.05;
|
|
134
|
+
overflow-wrap: anywhere;
|
|
135
|
+
text-align: end;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.card-header__end[data-text-weight='regular'] {
|
|
139
|
+
font-weight: var(--nox-font-weight-regular);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.card-header__end[data-text-weight='medium'] {
|
|
143
|
+
font-weight: var(--nox-font-weight-medium);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.card-header__end[data-text-weight='strong'] {
|
|
147
|
+
font-weight: var(--nox-font-weight-strong);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@container (width < 32rem) {
|
|
151
|
+
.card-header__main {
|
|
152
|
+
padding-inline: var(--nox-space-4);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@media (width < 48rem) {
|
|
157
|
+
.card-header__layout {
|
|
158
|
+
--card-header-title-size: var(--nox-font-size-md);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.card-header__main {
|
|
162
|
+
padding-inline: var(--nox-space-4);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
import type { AstroComponent } from '../../widgetTypes';
|
|
4
|
+
import type { DisplayCardLink } from '../../../display/contracts';
|
|
5
|
+
import type { Tone } from '../../../theme/contracts';
|
|
6
|
+
import TextPair from '../../data-display/TextPair/TextPair.astro';
|
|
7
|
+
import Media from '../../../primitives/media/Media/Media.astro';
|
|
8
|
+
|
|
9
|
+
type Props = Omit<HTMLAttributes<'a'>, 'href' | 'media'> &
|
|
10
|
+
DisplayCardLink & {
|
|
11
|
+
class?: string;
|
|
12
|
+
'data-tone'?: Tone;
|
|
13
|
+
icon?: AstroComponent;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
class: className,
|
|
18
|
+
'data-tone': dataTone,
|
|
19
|
+
collapse = 'none',
|
|
20
|
+
compactContent,
|
|
21
|
+
compactText,
|
|
22
|
+
compactVisual = 'show',
|
|
23
|
+
disabled = false,
|
|
24
|
+
direction,
|
|
25
|
+
full = false,
|
|
26
|
+
href,
|
|
27
|
+
icon: Icon,
|
|
28
|
+
iconTone,
|
|
29
|
+
label,
|
|
30
|
+
media,
|
|
31
|
+
mediaPosition = 'start',
|
|
32
|
+
mediaSize = 'default',
|
|
33
|
+
meta,
|
|
34
|
+
mode = 'link',
|
|
35
|
+
tone,
|
|
36
|
+
title,
|
|
37
|
+
...attrs
|
|
38
|
+
}: Props = Astro.props;
|
|
39
|
+
const accessibleLabel = `${label} : ${title}${meta !== undefined ? ` ${meta}` : ''}`;
|
|
40
|
+
const isDisabled = disabled || (mode === 'link' && !href);
|
|
41
|
+
const isInteractive = mode === 'link' && !isDisabled;
|
|
42
|
+
const Root = isInteractive ? 'a' : 'span';
|
|
43
|
+
const hasVisual = Boolean(Icon || media);
|
|
44
|
+
const hasContentMedia = Boolean(Icon && media);
|
|
45
|
+
const resolvedCompactContent =
|
|
46
|
+
compactContent === 'media' && hasContentMedia
|
|
47
|
+
? 'media'
|
|
48
|
+
: compactContent === 'text' && compactText !== undefined
|
|
49
|
+
? 'text'
|
|
50
|
+
: !compactContent && compactText !== undefined
|
|
51
|
+
? 'text'
|
|
52
|
+
: undefined;
|
|
53
|
+
const resolvedTone = tone ?? dataTone;
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
<Root
|
|
57
|
+
{...attrs}
|
|
58
|
+
aria-disabled={mode === 'link' && isDisabled ? 'true' : undefined}
|
|
59
|
+
role={mode === 'link' && isDisabled ? 'link' : undefined}
|
|
60
|
+
class:list={['card-link', className]}
|
|
61
|
+
href={isInteractive ? href : undefined}
|
|
62
|
+
aria-label={accessibleLabel}
|
|
63
|
+
data-widget="card-link"
|
|
64
|
+
data-surface
|
|
65
|
+
data-collapse={collapse}
|
|
66
|
+
data-compact-content={resolvedCompactContent}
|
|
67
|
+
data-compact-visual={compactVisual}
|
|
68
|
+
data-disabled={isDisabled ? 'true' : 'false'}
|
|
69
|
+
data-direction={direction}
|
|
70
|
+
data-full={full ? 'true' : 'false'}
|
|
71
|
+
data-interactive={isInteractive ? 'true' : 'false'}
|
|
72
|
+
data-has-content-media={hasContentMedia ? 'true' : 'false'}
|
|
73
|
+
data-has-visual={hasVisual ? 'true' : 'false'}
|
|
74
|
+
data-media-position={hasVisual ? mediaPosition : undefined}
|
|
75
|
+
data-media-size={hasVisual ? mediaSize : undefined}
|
|
76
|
+
data-mode={mode}
|
|
77
|
+
data-tone={resolvedTone}
|
|
78
|
+
>
|
|
79
|
+
<span class="card-link__layout">
|
|
80
|
+
{
|
|
81
|
+
hasVisual && mediaPosition === 'start' ? (
|
|
82
|
+
<span class="card-link__media" aria-hidden="true">
|
|
83
|
+
{Icon ? (
|
|
84
|
+
<Icon class="card-link__icon" data-tone={iconTone} />
|
|
85
|
+
) : media ? (
|
|
86
|
+
<Media
|
|
87
|
+
media={media}
|
|
88
|
+
fit="contain"
|
|
89
|
+
size="intrinsic"
|
|
90
|
+
/>
|
|
91
|
+
) : null}
|
|
92
|
+
</span>
|
|
93
|
+
) : null
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
<span class="card-link__content">
|
|
97
|
+
{
|
|
98
|
+
hasContentMedia && media ? (
|
|
99
|
+
<span class="card-link__content-media" aria-hidden="true">
|
|
100
|
+
<Media
|
|
101
|
+
media={media}
|
|
102
|
+
fit="contain"
|
|
103
|
+
size="intrinsic"
|
|
104
|
+
/>
|
|
105
|
+
</span>
|
|
106
|
+
) : null
|
|
107
|
+
}
|
|
108
|
+
<span class="card-link__content-copy">
|
|
109
|
+
<span class="card-link__compact-text" aria-hidden="true">
|
|
110
|
+
{compactText}
|
|
111
|
+
</span>
|
|
112
|
+
<span class="card-link__label">{label}</span>
|
|
113
|
+
<TextPair
|
|
114
|
+
class="card-link__text"
|
|
115
|
+
layout="inline"
|
|
116
|
+
primary={title}
|
|
117
|
+
secondary={meta}
|
|
118
|
+
/>
|
|
119
|
+
</span>
|
|
120
|
+
</span>
|
|
121
|
+
|
|
122
|
+
{
|
|
123
|
+
hasVisual && mediaPosition === 'end' ? (
|
|
124
|
+
<span class="card-link__media" aria-hidden="true">
|
|
125
|
+
{Icon ? (
|
|
126
|
+
<Icon class="card-link__icon" data-tone={iconTone} />
|
|
127
|
+
) : media ? (
|
|
128
|
+
<Media
|
|
129
|
+
media={media}
|
|
130
|
+
fit="contain"
|
|
131
|
+
size="intrinsic"
|
|
132
|
+
/>
|
|
133
|
+
) : null}
|
|
134
|
+
</span>
|
|
135
|
+
) : null
|
|
136
|
+
}
|
|
137
|
+
</span>
|
|
138
|
+
</Root>
|