@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,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
import type { DisplayTag } from '../../../display/contracts';
|
|
4
|
+
import CloseIcon from '../../icons/CloseIcon.astro';
|
|
5
|
+
import TagAffix from './TagAffix.astro';
|
|
6
|
+
|
|
7
|
+
type TagSize = 'md' | 'sm';
|
|
8
|
+
|
|
9
|
+
type Props = Omit<HTMLAttributes<'span'>, 'size'> &
|
|
10
|
+
DisplayTag & {
|
|
11
|
+
removable?: boolean;
|
|
12
|
+
removeLabel?: string;
|
|
13
|
+
size?: TagSize;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
active = false,
|
|
18
|
+
class: className,
|
|
19
|
+
'data-tone': dataTone,
|
|
20
|
+
href,
|
|
21
|
+
label,
|
|
22
|
+
leading,
|
|
23
|
+
removable = false,
|
|
24
|
+
removeLabel,
|
|
25
|
+
size = 'md',
|
|
26
|
+
tone,
|
|
27
|
+
trailing,
|
|
28
|
+
...attrs
|
|
29
|
+
}: Props = Astro.props;
|
|
30
|
+
const resolvedTone = tone ?? dataTone;
|
|
31
|
+
if (href && removable) {
|
|
32
|
+
throw new Error('A Tag cannot be both linked and removable');
|
|
33
|
+
}
|
|
34
|
+
if (removable && !removeLabel) {
|
|
35
|
+
throw new Error('A removable Tag requires removeLabel');
|
|
36
|
+
}
|
|
37
|
+
const Root = removable ? 'button' : href ? 'a' : 'span';
|
|
38
|
+
const interactive = removable || Boolean(href);
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
<Root
|
|
42
|
+
{...attrs}
|
|
43
|
+
href={href}
|
|
44
|
+
type={removable ? 'button' : undefined}
|
|
45
|
+
aria-current={active && href ? 'page' : undefined}
|
|
46
|
+
aria-label={removable ? removeLabel : undefined}
|
|
47
|
+
class:list={['tag', className]}
|
|
48
|
+
data-widget="tag"
|
|
49
|
+
data-interactive={interactive ? true : undefined}
|
|
50
|
+
data-active={active ? true : undefined}
|
|
51
|
+
data-linked={href ? true : undefined}
|
|
52
|
+
data-removable={removable ? true : undefined}
|
|
53
|
+
data-size={size}
|
|
54
|
+
data-tag-remove={removable ? true : undefined}
|
|
55
|
+
data-tone={resolvedTone}
|
|
56
|
+
>
|
|
57
|
+
{leading ? <TagAffix affix={leading} position="leading" /> : null}
|
|
58
|
+
<span class="tag__label" data-tag-label>{label}</span>
|
|
59
|
+
{trailing ? <TagAffix affix={trailing} position="trailing" /> : null}
|
|
60
|
+
{
|
|
61
|
+
removable ? (
|
|
62
|
+
<span class="tag__remove" aria-hidden="true">
|
|
63
|
+
<CloseIcon class="tag__remove-icon" />
|
|
64
|
+
</span>
|
|
65
|
+
) : null
|
|
66
|
+
}
|
|
67
|
+
</Root>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
.tag {
|
|
2
|
+
--tag-affix-visual-size: 1rem;
|
|
3
|
+
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
align-items: stretch;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border: var(--nox-border-width) solid var(--nox-field-border);
|
|
10
|
+
border-radius: var(--nox-radius-sm);
|
|
11
|
+
background: var(--nox-surface);
|
|
12
|
+
color: var(--nox-text);
|
|
13
|
+
font-family: inherit;
|
|
14
|
+
font-size: var(--nox-font-size-sm);
|
|
15
|
+
font-weight: var(--nox-font-weight-medium);
|
|
16
|
+
letter-spacing: 0;
|
|
17
|
+
line-height: 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.tag[data-interactive] {
|
|
21
|
+
padding: 0;
|
|
22
|
+
color: var(--nox-text);
|
|
23
|
+
text-align: start;
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
transition:
|
|
27
|
+
border-color var(--nox-motion-duration-sm) var(--nox-motion-easing-standard),
|
|
28
|
+
background-color var(--nox-motion-duration-sm)
|
|
29
|
+
var(--nox-motion-easing-standard);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tag[data-size='sm'] {
|
|
33
|
+
min-height: 1.5rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.tag[data-size='md'] {
|
|
37
|
+
min-height: 1.75rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tag__affix {
|
|
41
|
+
display: grid;
|
|
42
|
+
min-width: 0;
|
|
43
|
+
grid-auto-flow: column;
|
|
44
|
+
gap: var(--nox-space-1);
|
|
45
|
+
place-items: center;
|
|
46
|
+
padding-inline: var(--nox-space-1);
|
|
47
|
+
background: var(--nox-tone-background-strong);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.tag__affix[data-position='leading'] {
|
|
51
|
+
border-inline-end: var(--nox-border-width) solid var(--nox-field-border);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.tag__affix[data-position='trailing'] {
|
|
55
|
+
border-inline-start: var(--nox-border-width) solid var(--nox-field-border);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.tag__affix-value {
|
|
59
|
+
font-weight: var(--nox-font-weight-medium);
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tag__image {
|
|
64
|
+
--media-object-inline-size: 100%;
|
|
65
|
+
--media-object-block-size: 100%;
|
|
66
|
+
--media-object-max-inline-size: 100%;
|
|
67
|
+
--media-object-max-block-size: 100%;
|
|
68
|
+
|
|
69
|
+
inline-size: var(--tag-affix-visual-size);
|
|
70
|
+
block-size: var(--tag-affix-visual-size);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.tag__icon {
|
|
74
|
+
display: block;
|
|
75
|
+
inline-size: var(--tag-affix-visual-size);
|
|
76
|
+
block-size: var(--tag-affix-visual-size);
|
|
77
|
+
flex: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.tag__icon[data-tone] {
|
|
81
|
+
color: var(--nox-tone-color);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.tag__label {
|
|
85
|
+
min-width: 0;
|
|
86
|
+
align-self: center;
|
|
87
|
+
padding: var(--nox-space-1) var(--nox-space-2);
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
text-overflow: ellipsis;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.tag__remove {
|
|
94
|
+
display: grid;
|
|
95
|
+
min-width: 1.25rem;
|
|
96
|
+
padding: 0 var(--nox-space-2) 0 var(--nox-space-1);
|
|
97
|
+
place-items: center;
|
|
98
|
+
border-inline-start: var(--nox-border-width) solid var(--nox-field-border);
|
|
99
|
+
background: transparent;
|
|
100
|
+
color: var(--nox-tone-color);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.tag__remove-icon {
|
|
104
|
+
inline-size: 0.875rem;
|
|
105
|
+
block-size: 0.875rem;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.tag[data-interactive]:focus-visible {
|
|
109
|
+
position: relative;
|
|
110
|
+
z-index: 1;
|
|
111
|
+
outline: var(--nox-focus-ring-width) solid var(--nox-focus-ring);
|
|
112
|
+
outline-offset: calc(-1 * var(--nox-focus-ring-width));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@media (hover: hover) and (pointer: fine) {
|
|
116
|
+
.tag[data-interactive]:hover {
|
|
117
|
+
border-color: var(--nox-field-border-hover);
|
|
118
|
+
background: var(--nox-tone-hover-background);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.tag[data-removable]:hover .tag__remove {
|
|
122
|
+
color: var(--nox-tone-text);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.tag[data-interactive]:active {
|
|
127
|
+
background: var(--nox-tone-active-background);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.tag[data-active] {
|
|
131
|
+
border-color: var(--nox-tone-color);
|
|
132
|
+
background: var(--nox-tone-active-background);
|
|
133
|
+
color: var(--nox-tone-text);
|
|
134
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { DisplayTagAffix } from '../../../display/contracts';
|
|
3
|
+
import Media from '../../../primitives/media/Media/Media.astro';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
affix: DisplayTagAffix;
|
|
7
|
+
position: 'leading' | 'trailing';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const { affix, position }: Props = Astro.props;
|
|
11
|
+
const Icon = affix.icon;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<span class="tag__affix" data-position={position} aria-hidden="true">
|
|
15
|
+
{
|
|
16
|
+
Icon ? (
|
|
17
|
+
<Icon class="tag__icon" data-tone={affix.iconTone} />
|
|
18
|
+
) : affix.media ? (
|
|
19
|
+
<Media
|
|
20
|
+
class="tag__image"
|
|
21
|
+
media={affix.media}
|
|
22
|
+
fit="contain"
|
|
23
|
+
framing="content"
|
|
24
|
+
size="intrinsic"
|
|
25
|
+
/>
|
|
26
|
+
) : null
|
|
27
|
+
}
|
|
28
|
+
{
|
|
29
|
+
affix.value !== undefined ? (
|
|
30
|
+
<span class="tag__affix-value">{affix.value}</span>
|
|
31
|
+
) : null
|
|
32
|
+
}
|
|
33
|
+
</span>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
import type {
|
|
4
|
+
DisplayTextValue,
|
|
5
|
+
TextColor,
|
|
6
|
+
TextPairLayout,
|
|
7
|
+
TextSize,
|
|
8
|
+
TextWeight,
|
|
9
|
+
} from '../../../display/contracts';
|
|
10
|
+
|
|
11
|
+
type Props = HTMLAttributes<'span'> & {
|
|
12
|
+
primary: DisplayTextValue;
|
|
13
|
+
primaryColor?: TextColor;
|
|
14
|
+
primarySize?: TextSize;
|
|
15
|
+
primaryWeight?: TextWeight;
|
|
16
|
+
secondary?: DisplayTextValue;
|
|
17
|
+
secondaryWeight?: TextWeight;
|
|
18
|
+
layout?: TextPairLayout;
|
|
19
|
+
truncate?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
class: className,
|
|
24
|
+
layout = 'stack',
|
|
25
|
+
primary,
|
|
26
|
+
primaryColor = 'default',
|
|
27
|
+
primarySize = 'default',
|
|
28
|
+
primaryWeight = 'strong',
|
|
29
|
+
secondary,
|
|
30
|
+
secondaryWeight = 'medium',
|
|
31
|
+
truncate = false,
|
|
32
|
+
...attrs
|
|
33
|
+
}: Props = Astro.props;
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
<span
|
|
37
|
+
{...attrs}
|
|
38
|
+
class:list={['text-pair', className]}
|
|
39
|
+
data-widget="text-pair"
|
|
40
|
+
data-layout={layout}
|
|
41
|
+
data-truncate={truncate ? true : undefined}
|
|
42
|
+
>
|
|
43
|
+
<span
|
|
44
|
+
class="text-pair__primary"
|
|
45
|
+
data-part="text-pair-primary"
|
|
46
|
+
data-text-color={primaryColor}
|
|
47
|
+
data-text-size={primarySize}
|
|
48
|
+
data-text-weight={primaryWeight}
|
|
49
|
+
>
|
|
50
|
+
{primary}
|
|
51
|
+
</span>
|
|
52
|
+
{
|
|
53
|
+
secondary !== undefined ? (
|
|
54
|
+
<span
|
|
55
|
+
class="text-pair__secondary"
|
|
56
|
+
data-part="text-pair-secondary"
|
|
57
|
+
data-text-weight={secondaryWeight}
|
|
58
|
+
>
|
|
59
|
+
{secondary}
|
|
60
|
+
</span>
|
|
61
|
+
) : null
|
|
62
|
+
}
|
|
63
|
+
</span>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
.text-pair {
|
|
2
|
+
--text-pair-primary-color: var(--nox-text);
|
|
3
|
+
--text-pair-secondary-color: var(--nox-text-muted);
|
|
4
|
+
|
|
5
|
+
display: grid;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
gap: var(--nox-space-1);
|
|
8
|
+
line-height: var(--nox-line-height-tight);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.text-pair[data-layout='inline'] {
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
inline-size: max-content;
|
|
14
|
+
min-inline-size: 0;
|
|
15
|
+
align-items: baseline;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
flex-wrap: nowrap;
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.text-pair[data-layout='split'] {
|
|
22
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
23
|
+
align-items: baseline;
|
|
24
|
+
gap: var(--nox-space-4);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.text-pair__primary {
|
|
28
|
+
min-width: 0;
|
|
29
|
+
color: var(--text-pair-primary-color);
|
|
30
|
+
font-size: inherit;
|
|
31
|
+
line-height: inherit;
|
|
32
|
+
overflow-wrap: anywhere;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.text-pair__primary[data-text-color='muted'] {
|
|
36
|
+
color: var(--text-pair-secondary-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.text-pair__primary[data-text-color='inherit'] {
|
|
40
|
+
color: inherit;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.text-pair__primary[data-text-size='small'] {
|
|
44
|
+
font-size: var(--nox-font-size-sm);
|
|
45
|
+
line-height: 1.35;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.text-pair__primary[data-text-size='large'] {
|
|
49
|
+
font-size: var(--nox-font-size-md);
|
|
50
|
+
line-height: var(--nox-line-height-tight);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.text-pair[data-layout='inline'] .text-pair__primary {
|
|
54
|
+
overflow-wrap: normal;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.text-pair__secondary {
|
|
59
|
+
min-width: 0;
|
|
60
|
+
color: var(--text-pair-secondary-color);
|
|
61
|
+
font-size: var(--nox-font-size-sm);
|
|
62
|
+
line-height: 1.35;
|
|
63
|
+
overflow-wrap: anywhere;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.text-pair [data-text-weight='regular'] {
|
|
67
|
+
font-weight: var(--nox-font-weight-regular);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.text-pair [data-text-weight='medium'] {
|
|
71
|
+
font-weight: var(--nox-font-weight-medium);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.text-pair [data-text-weight='strong'] {
|
|
75
|
+
font-weight: var(--nox-font-weight-strong);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.text-pair[data-layout='inline'] .text-pair__secondary {
|
|
79
|
+
line-height: inherit;
|
|
80
|
+
overflow-wrap: normal;
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.text-pair[data-layout='split'] .text-pair__secondary {
|
|
85
|
+
text-align: end;
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.text-pair[data-truncate] {
|
|
90
|
+
overflow: var(--text-pair-truncate-overflow, hidden);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.text-pair[data-truncate] .text-pair__primary,
|
|
94
|
+
.text-pair[data-truncate] .text-pair__secondary {
|
|
95
|
+
overflow: var(--text-pair-truncate-overflow, hidden);
|
|
96
|
+
overflow-wrap: normal;
|
|
97
|
+
text-overflow: var(--text-pair-truncate-text-overflow, ellipsis);
|
|
98
|
+
white-space: nowrap;
|
|
99
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
import type { Tone } from '../../../theme/contracts';
|
|
4
|
+
|
|
5
|
+
type SpinnerSize = 'sm' | 'md' | 'lg';
|
|
6
|
+
|
|
7
|
+
type Props = HTMLAttributes<'span'> & {
|
|
8
|
+
label: string;
|
|
9
|
+
size?: SpinnerSize;
|
|
10
|
+
tone?: Tone;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
class: className,
|
|
15
|
+
'data-tone': dataTone,
|
|
16
|
+
label,
|
|
17
|
+
size = 'md',
|
|
18
|
+
tone,
|
|
19
|
+
...attrs
|
|
20
|
+
}: Props = Astro.props;
|
|
21
|
+
const resolvedTone = tone ?? dataTone;
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<span
|
|
25
|
+
{...attrs}
|
|
26
|
+
class:list={['spinner', className]}
|
|
27
|
+
data-size={size}
|
|
28
|
+
data-tone={resolvedTone}
|
|
29
|
+
data-widget="spinner"
|
|
30
|
+
role="status"
|
|
31
|
+
aria-label={label}
|
|
32
|
+
></span>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.spinner {
|
|
2
|
+
--spinner-size: 2rem;
|
|
3
|
+
--spinner-stroke: 0.1875rem;
|
|
4
|
+
|
|
5
|
+
display: inline-block;
|
|
6
|
+
inline-size: var(--spinner-size);
|
|
7
|
+
block-size: var(--spinner-size);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
border: var(--spinner-stroke) solid
|
|
10
|
+
color-mix(in srgb, var(--nox-tone-color) 24%, transparent);
|
|
11
|
+
border-block-start-color: var(--nox-tone-color);
|
|
12
|
+
border-radius: var(--nox-radius-pill);
|
|
13
|
+
color: var(--nox-tone-color);
|
|
14
|
+
animation: spinner-rotate 720ms linear infinite;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.spinner[data-size='sm'] {
|
|
18
|
+
--spinner-size: 1.25rem;
|
|
19
|
+
--spinner-stroke: 0.125rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.spinner[data-size='lg'] {
|
|
23
|
+
--spinner-size: 3rem;
|
|
24
|
+
--spinner-stroke: 0.25rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@keyframes spinner-rotate {
|
|
28
|
+
to {
|
|
29
|
+
transform: rotate(1turn);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (prefers-reduced-motion: reduce) {
|
|
34
|
+
.spinner {
|
|
35
|
+
animation-duration: 1.8s;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
import type { Tone } from '../../../theme/contracts';
|
|
4
|
+
|
|
5
|
+
type Props = HTMLAttributes<'span'> & {
|
|
6
|
+
activation?: 'interactive' | 'hover';
|
|
7
|
+
alignTo?: 'boundary' | 'trigger';
|
|
8
|
+
content: string;
|
|
9
|
+
tone?: Tone;
|
|
10
|
+
triggerScope?: 'ancestor' | 'content';
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
activation = 'interactive',
|
|
15
|
+
alignTo = 'trigger',
|
|
16
|
+
class: className,
|
|
17
|
+
content,
|
|
18
|
+
'data-tone': dataTone,
|
|
19
|
+
tone,
|
|
20
|
+
triggerScope = 'content',
|
|
21
|
+
...attrs
|
|
22
|
+
}: Props = Astro.props;
|
|
23
|
+
const resolvedTone = tone ?? dataTone;
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
<nox-tooltip
|
|
27
|
+
{...attrs}
|
|
28
|
+
class:list={['tooltip', className]}
|
|
29
|
+
data-tooltip-activation={activation}
|
|
30
|
+
data-tooltip-align-to={alignTo}
|
|
31
|
+
data-tooltip-root
|
|
32
|
+
data-tooltip-trigger-scope={triggerScope}
|
|
33
|
+
data-tone={resolvedTone}
|
|
34
|
+
>
|
|
35
|
+
<slot />
|
|
36
|
+
<span
|
|
37
|
+
class="tooltip__panel"
|
|
38
|
+
data-tooltip-panel
|
|
39
|
+
hidden
|
|
40
|
+
popover="manual"
|
|
41
|
+
role="tooltip"
|
|
42
|
+
>
|
|
43
|
+
{content}
|
|
44
|
+
</span>
|
|
45
|
+
</nox-tooltip>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { initTooltip } from './tooltipController';
|
|
49
|
+
|
|
50
|
+
class NoxTooltipElement extends HTMLElement {
|
|
51
|
+
cleanup?: () => void;
|
|
52
|
+
|
|
53
|
+
connectedCallback() {
|
|
54
|
+
this.cleanup = initTooltip(this);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
disconnectedCallback() {
|
|
58
|
+
this.cleanup?.();
|
|
59
|
+
this.cleanup = undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!customElements.get('nox-tooltip')) {
|
|
64
|
+
customElements.define('nox-tooltip', NoxTooltipElement);
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.tooltip {
|
|
2
|
+
display: contents;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:where([data-tooltip-trigger]) {
|
|
6
|
+
cursor: help;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:where([data-tooltip-trigger]):focus-visible {
|
|
10
|
+
outline: var(--nox-focus-ring-width) solid var(--nox-tone-focus-ring);
|
|
11
|
+
outline-offset: var(--nox-focus-ring-offset);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tooltip[data-tooltip-activation='hover'] :where([data-tooltip-trigger]) {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.tooltip[data-tooltip-activation='hover'] .tooltip__panel {
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.tooltip__panel {
|
|
23
|
+
--tooltip-viewport-gap: var(--nox-space-4);
|
|
24
|
+
--tooltip-trigger-gap: var(--nox-space-2);
|
|
25
|
+
|
|
26
|
+
position: fixed;
|
|
27
|
+
z-index: 100;
|
|
28
|
+
inset: auto;
|
|
29
|
+
inline-size: max-content;
|
|
30
|
+
max-inline-size: min(22rem, calc(100vw - var(--nox-space-4) * 2));
|
|
31
|
+
max-block-size: calc(100dvh - var(--nox-space-4) * 2);
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: var(--nox-space-3) var(--nox-space-4);
|
|
34
|
+
overflow: auto;
|
|
35
|
+
overscroll-behavior: contain;
|
|
36
|
+
border: var(--nox-border-width) solid var(--nox-tone-border);
|
|
37
|
+
border-radius: var(--nox-radius-sm);
|
|
38
|
+
background: var(--nox-surface);
|
|
39
|
+
box-shadow: var(--nox-shadow-surface);
|
|
40
|
+
color: var(--nox-text);
|
|
41
|
+
font-size: var(--nox-font-size-sm);
|
|
42
|
+
font-weight: var(--nox-font-weight-regular);
|
|
43
|
+
line-height: 1.45;
|
|
44
|
+
overflow-wrap: anywhere;
|
|
45
|
+
text-align: start;
|
|
46
|
+
white-space: normal;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.tooltip__panel[hidden] {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@media (width < 30rem) {
|
|
54
|
+
.tooltip__panel {
|
|
55
|
+
--tooltip-viewport-gap: var(--nox-space-3);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (hover: none) and (pointer: coarse) {
|
|
60
|
+
.tooltip[data-tooltip-activation='hover'] :where([data-tooltip-trigger]) {
|
|
61
|
+
cursor: inherit;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.tooltip[data-tooltip-activation='hover'] .tooltip__panel {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
}
|