sproutsite 0.0.0-stage → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +14 -0
  3. package/README.md +604 -2
  4. package/THIRD_PARTY_NOTICES.md +85 -0
  5. package/VERSION +1 -0
  6. package/package.json +107 -5
  7. package/src/lib/sproutsite/colors.ts +7 -0
  8. package/src/lib/sproutsite/language-links.ts +60 -0
  9. package/src/lib/sproutsite/pages.ts +78 -0
  10. package/src/lib/sproutsite/rehype-ids.ts +20 -0
  11. package/src/lib/sproutsite/rehype-links.ts +19 -0
  12. package/src/lib/sproutsite/rehype-tables.ts +74 -0
  13. package/src/lib/sproutsite/remark-links.ts +19 -0
  14. package/src/lib/sproutsite/site-config.ts +110 -0
  15. package/src/lib/sproutsite/sitemap.ts +160 -0
  16. package/src/lib/sproutsite/types.ts +45 -0
  17. package/src/lib/sproutsite/urls.ts +79 -0
  18. package/src/lib/sproutsite/validation.ts +1406 -0
  19. package/src/package/404.astro +5 -0
  20. package/src/package/500.astro +5 -0
  21. package/src/package/components.ts +17 -0
  22. package/src/package/config.ts +161 -0
  23. package/src/package/content.ts +117 -0
  24. package/src/package/index.ts +3 -0
  25. package/src/package/manifest.ts +27 -0
  26. package/src/package/page.astro +124 -0
  27. package/src/themes/default/assets/branding/apple-touch-icon.png +0 -0
  28. package/src/themes/default/assets/branding/favicon-16x16.png +0 -0
  29. package/src/themes/default/assets/branding/favicon-32x32.png +0 -0
  30. package/src/themes/default/assets/branding/favicon-48x48.png +0 -0
  31. package/src/themes/default/assets/branding/favicon.ico +0 -0
  32. package/src/themes/default/assets/branding/favicon.svg +1 -0
  33. package/src/themes/default/assets/branding/icon-192x192.png +0 -0
  34. package/src/themes/default/assets/branding/icon-512x512.png +0 -0
  35. package/src/themes/default/assets/branding/icon-monochrome.svg +1 -0
  36. package/src/themes/default/assets/branding/icon.svg +18 -0
  37. package/src/themes/default/assets/branding/logo-dark.svg +18 -0
  38. package/src/themes/default/assets/branding/logo-monochrome.svg +1 -0
  39. package/src/themes/default/assets/branding/logo.svg +18 -0
  40. package/src/themes/default/assets/branding/social-card.png +0 -0
  41. package/src/themes/default/assets/hero-waves.svg +41 -0
  42. package/src/themes/default/components/atoms/Badge/Badge.astro +65 -0
  43. package/src/themes/default/components/atoms/Badge/Badge.css +5 -0
  44. package/src/themes/default/components/atoms/BrandLogo/BrandLogo.astro +26 -0
  45. package/src/themes/default/components/atoms/BrandLogo/BrandLogo.css +22 -0
  46. package/src/themes/default/components/atoms/Button/Button.astro +106 -0
  47. package/src/themes/default/components/atoms/Button/Button.css +14 -0
  48. package/src/themes/default/components/atoms/ContentImage/ContentImage.astro +54 -0
  49. package/src/themes/default/components/atoms/ContentImage/ContentImage.css +21 -0
  50. package/src/themes/default/components/atoms/Eyebrow/Eyebrow.astro +3 -0
  51. package/src/themes/default/components/atoms/Eyebrow/Eyebrow.css +18 -0
  52. package/src/themes/default/components/atoms/Icon/Icon.astro +80 -0
  53. package/src/themes/default/components/atoms/Icon/Icon.css +68 -0
  54. package/src/themes/default/components/atoms/Tab/Tab.astro +15 -0
  55. package/src/themes/default/components/atoms/Tab/Tab.css +34 -0
  56. package/src/themes/default/components/layout/Column/Column.astro +18 -0
  57. package/src/themes/default/components/layout/Column/Column.css +82 -0
  58. package/src/themes/default/components/layout/Columns/Columns.astro +163 -0
  59. package/src/themes/default/components/layout/Columns/Columns.css +177 -0
  60. package/src/themes/default/components/molecules/Accordion/Accordion.astro +17 -0
  61. package/src/themes/default/components/molecules/Accordion/Accordion.css +11 -0
  62. package/src/themes/default/components/molecules/Accordion/accordion.ts +47 -0
  63. package/src/themes/default/components/molecules/AccordionItem/AccordionItem.astro +100 -0
  64. package/src/themes/default/components/molecules/AccordionItem/AccordionItem.css +118 -0
  65. package/src/themes/default/components/molecules/Alert/Alert.astro +42 -0
  66. package/src/themes/default/components/molecules/Alert/Alert.css +13 -0
  67. package/src/themes/default/components/molecules/Card/Card.astro +57 -0
  68. package/src/themes/default/components/molecules/Card/Card.css +25 -0
  69. package/src/themes/default/components/molecules/CardActions/CardActions.astro +3 -0
  70. package/src/themes/default/components/molecules/CardActions/CardActions.css +13 -0
  71. package/src/themes/default/components/molecules/ContentTable/ContentTable.astro +42 -0
  72. package/src/themes/default/components/molecules/ContentTable/ContentTable.css +59 -0
  73. package/src/themes/default/components/molecules/Feature/Feature.astro +108 -0
  74. package/src/themes/default/components/molecules/Feature/Feature.css +157 -0
  75. package/src/themes/default/components/molecules/FoundationSample/FoundationSample.astro +165 -0
  76. package/src/themes/default/components/molecules/FoundationSample/FoundationSample.css +201 -0
  77. package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.astro +118 -0
  78. package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.css +134 -0
  79. package/src/themes/default/components/molecules/Tabs/Tabs.astro +33 -0
  80. package/src/themes/default/components/molecules/Tabs/Tabs.css +38 -0
  81. package/src/themes/default/components/molecules/Tabs/tabs.ts +91 -0
  82. package/src/themes/default/components/organisms/BlogIndex/BlogIndex.astro +86 -0
  83. package/src/themes/default/components/organisms/BlogIndex/BlogIndex.css +17 -0
  84. package/src/themes/default/components/organisms/BlogPost/BlogPost.astro +51 -0
  85. package/src/themes/default/components/organisms/BlogPost/BlogPost.css +5 -0
  86. package/src/themes/default/components/organisms/Footer/Footer.astro +57 -0
  87. package/src/themes/default/components/organisms/Footer/Footer.css +63 -0
  88. package/src/themes/default/components/organisms/Header/Header.astro +223 -0
  89. package/src/themes/default/components/organisms/Header/Header.css +282 -0
  90. package/src/themes/default/components/organisms/Hero/Hero.astro +106 -0
  91. package/src/themes/default/components/organisms/Hero/Hero.css +187 -0
  92. package/src/themes/default/components/organisms/PageTitle/PageTitle.astro +39 -0
  93. package/src/themes/default/components/organisms/PageTitle/PageTitle.css +25 -0
  94. package/src/themes/default/components/organisms/Section/Section.astro +39 -0
  95. package/src/themes/default/components/organisms/Section/Section.css +21 -0
  96. package/src/themes/default/i18n/de.yaml +38 -0
  97. package/src/themes/default/i18n/en.yaml +38 -0
  98. package/src/themes/default/i18n/index.ts +63 -0
  99. package/src/themes/default/layouts/ErrorPage/ErrorPage.astro +110 -0
  100. package/src/themes/default/layouts/PageLayout/PageLayout.astro +108 -0
  101. package/src/themes/default/layouts/PageLayout/PageLayout.css +15 -0
  102. package/src/themes/default/styles/foundation/base.css +19 -0
  103. package/src/themes/default/styles/foundation/focus.css +6 -0
  104. package/src/themes/default/styles/foundation/fonts/OFL.txt +93 -0
  105. package/src/themes/default/styles/foundation/fonts/nunito-latin-variable.woff2 +0 -0
  106. package/src/themes/default/styles/foundation/fonts.css +17 -0
  107. package/src/themes/default/styles/foundation/layout.css +6 -0
  108. package/src/themes/default/styles/foundation/prose.css +54 -0
  109. package/src/themes/default/styles/foundation/tokens.css +48 -0
  110. package/src/themes/default/styles/theme.css +99 -0
  111. package/src/themes/default/styles/themes/section-tones.css +30 -0
  112. package/third-party-licenses/daisyui-LICENSE +21 -0
  113. package/third-party-licenses/flag-icons-LICENSE +21 -0
  114. package/third-party-licenses/lucide-LICENSE +43 -0
  115. package/third-party-licenses/tailwindcss-LICENSE +21 -0
  116. package/third-party-licenses/tailwindcss-typography-LICENSE +21 -0
@@ -0,0 +1,165 @@
1
+ ---
2
+ import { t } from '../../../i18n/index.js';
3
+ const locale = Astro.currentLocale === 'de' ? 'de' : 'en';
4
+ const kinds = [
5
+ 'colors',
6
+ 'type',
7
+ 'spacing',
8
+ 'radius',
9
+ 'shadow',
10
+ 'focus',
11
+ ] as const;
12
+ type SampleKind = (typeof kinds)[number];
13
+
14
+ interface Props {
15
+ kind: SampleKind;
16
+ }
17
+
18
+ const { kind } = Astro.props;
19
+ if (!kinds.includes(kind))
20
+ throw new Error(
21
+ `FoundationSample kind must be one of: ${kinds.join(', ')}.`,
22
+ );
23
+
24
+ const colors = [
25
+ ['base-100', t(locale, 'foundationDefault')],
26
+ ['base-200', t(locale, 'foundationMuted')],
27
+ ['base-300', t(locale, 'foundationBorder')],
28
+ ['base-content', t(locale, 'foundationText')],
29
+ ['primary', t(locale, 'foundationPrimary')],
30
+ ['secondary', t(locale, 'foundationSecondary')],
31
+ ['accent', t(locale, 'foundationAccent')],
32
+ ['neutral', t(locale, 'foundationNeutral')],
33
+ ['info', t(locale, 'foundationInfo')],
34
+ ['success', t(locale, 'foundationSuccess')],
35
+ ['warning', t(locale, 'foundationWarning')],
36
+ ['error', t(locale, 'foundationError')],
37
+ ] as const;
38
+ const spaces = [
39
+ ['1', '0.25rem'],
40
+ ['2', '0.5rem'],
41
+ ['4', '1rem'],
42
+ ['6', '1.5rem'],
43
+ ['8', '2rem'],
44
+ ] as const;
45
+ const radii = [
46
+ ['none', t(locale, 'foundationSquare'), '0'],
47
+ ['field', t(locale, 'foundationFields'), '--radius-field'],
48
+ ['box', t(locale, 'foundationBoxes'), '--radius-box'],
49
+ ] as const;
50
+ const shadows = [
51
+ ['none', t(locale, 'foundationNoShadow'), 'none'],
52
+ ['sm', t(locale, 'foundationSmall'), '--shadow-sm'],
53
+ ['soft', t(locale, 'foundationSoft'), '--shadow-soft'],
54
+ ['raised', t(locale, 'foundationRaised'), '--shadow-raised'],
55
+ ] as const;
56
+ ---
57
+
58
+ <div
59
+ class:list={[
60
+ 'ss-foundation-sample',
61
+ `ss-foundation-sample--${kind}`,
62
+ 'not-prose',
63
+ ]}
64
+ >
65
+ {kind === 'colors' && (
66
+ <ul class="ss-foundation-sample__palette">
67
+ {colors.map(([name, label]) => (
68
+ <li class="ss-foundation-sample__color">
69
+ <div
70
+ class:list={[
71
+ 'ss-foundation-sample__swatch',
72
+ `ss-foundation-sample__swatch--${name}`,
73
+ ]}
74
+ aria-hidden="true"
75
+ />
76
+ <span>{label}</span>
77
+ <code>--color-{name}</code>
78
+ </li>
79
+ ))}
80
+ </ul>
81
+ )}
82
+ {kind === 'type' && (
83
+ <div class="ss-foundation-sample__type">
84
+ <p class="ss-foundation-sample__label">
85
+ {t(locale, 'foundationDisplayLabel')}
86
+ </p>
87
+ <p class="ss-foundation-sample__display">
88
+ {t(locale, 'foundationDisplay')}
89
+ </p>
90
+ <p class="ss-foundation-sample__label">
91
+ {t(locale, 'foundationHeadingLabel')}
92
+ </p>
93
+ <p class="ss-foundation-sample__heading">
94
+ {t(locale, 'foundationHeading')}
95
+ </p>
96
+ <p class="ss-foundation-sample__label">
97
+ {t(locale, 'foundationBodyLabel')}
98
+ </p>
99
+ <p class="ss-foundation-sample__body">
100
+ {t(locale, 'foundationBody')}
101
+ </p>
102
+ </div>
103
+ )}
104
+ {kind === 'spacing' && (
105
+ <ul class="ss-foundation-sample__spaces">
106
+ {spaces.map(([step, size]) => (
107
+ <li class="ss-foundation-sample__space-row">
108
+ <span>
109
+ {locale === 'de' ? size.replace('.', ',') : size}
110
+ </span>
111
+ <div class="ss-foundation-sample__track" aria-hidden="true">
112
+ <span
113
+ class:list={[
114
+ 'ss-foundation-sample__space',
115
+ `ss-foundation-sample__space--${step}`,
116
+ ]}
117
+ />
118
+ </div>
119
+ </li>
120
+ ))}
121
+ </ul>
122
+ )}
123
+ {kind === 'radius' && (
124
+ <ul class="ss-foundation-sample__tiles">
125
+ {radii.map(([name, label, token]) => (
126
+ <li class="ss-foundation-sample__tile">
127
+ <div
128
+ class:list={[
129
+ 'ss-foundation-sample__shape',
130
+ `ss-foundation-sample__shape--${name}`,
131
+ ]}
132
+ aria-hidden="true"
133
+ />
134
+ <span>{label}</span>
135
+ <code>{token}</code>
136
+ </li>
137
+ ))}
138
+ </ul>
139
+ )}
140
+ {kind === 'shadow' && (
141
+ <ul class="ss-foundation-sample__tiles">
142
+ {shadows.map(([name, label, token]) => (
143
+ <li class="ss-foundation-sample__tile">
144
+ <div
145
+ class:list={[
146
+ 'ss-foundation-sample__elevation',
147
+ `ss-foundation-sample__elevation--${name}`,
148
+ ]}
149
+ aria-hidden="true"
150
+ />
151
+ <span>{label}</span>
152
+ <code>{token}</code>
153
+ </li>
154
+ ))}
155
+ </ul>
156
+ )}
157
+ {kind === 'focus' && (
158
+ <div class="ss-foundation-sample__focus-area">
159
+ <p>{t(locale, 'foundationFocus')}</p>
160
+ <a class="ss-foundation-sample__focus" href="#main-content">
161
+ {t(locale, 'foundationFocusLink')}
162
+ </a>
163
+ </div>
164
+ )}
165
+ </div>
@@ -0,0 +1,201 @@
1
+ @layer components {
2
+ .ss-foundation-sample {
3
+ @apply min-w-0 text-base-content;
4
+
5
+ .ss-foundation-sample__palette,
6
+ .ss-foundation-sample__spaces,
7
+ .ss-foundation-sample__tiles {
8
+ @apply m-0 list-none p-0;
9
+ }
10
+
11
+ .ss-foundation-sample__color,
12
+ .ss-foundation-sample__tile {
13
+ @apply m-0 flex min-w-0 flex-col gap-2 p-0 text-sm;
14
+
15
+ code {
16
+ @apply text-xs;
17
+ overflow-wrap: anywhere;
18
+ }
19
+ }
20
+
21
+ .ss-foundation-sample__label {
22
+ @apply m-0 text-sm font-semibold;
23
+ }
24
+ }
25
+
26
+ .ss-foundation-sample--colors {
27
+ .ss-foundation-sample__palette {
28
+ @apply grid grid-cols-2 gap-5 sm:grid-cols-3 lg:grid-cols-4;
29
+ }
30
+
31
+ .ss-foundation-sample__swatch {
32
+ @apply h-20 rounded-box border border-base-300;
33
+
34
+ &.ss-foundation-sample__swatch--base-100 {
35
+ background-color: var(--color-base-100);
36
+ }
37
+ &.ss-foundation-sample__swatch--base-200 {
38
+ background-color: var(--color-base-200);
39
+ }
40
+ &.ss-foundation-sample__swatch--base-300 {
41
+ background-color: var(--color-base-300);
42
+ }
43
+ &.ss-foundation-sample__swatch--base-content {
44
+ background-color: var(--color-base-content);
45
+ }
46
+ &.ss-foundation-sample__swatch--primary {
47
+ background-color: var(--color-primary);
48
+ }
49
+ &.ss-foundation-sample__swatch--secondary {
50
+ background-color: var(--color-secondary);
51
+ }
52
+ &.ss-foundation-sample__swatch--accent {
53
+ background-color: var(--color-accent);
54
+ }
55
+ &.ss-foundation-sample__swatch--neutral {
56
+ background-color: var(--color-neutral);
57
+ }
58
+ &.ss-foundation-sample__swatch--info {
59
+ background-color: var(--color-info);
60
+ }
61
+ &.ss-foundation-sample__swatch--success {
62
+ background-color: var(--color-success);
63
+ }
64
+ &.ss-foundation-sample__swatch--warning {
65
+ background-color: var(--color-warning);
66
+ }
67
+ &.ss-foundation-sample__swatch--error {
68
+ background-color: var(--color-error);
69
+ }
70
+ }
71
+ }
72
+
73
+ .ss-foundation-sample--type {
74
+ .ss-foundation-sample__type {
75
+ @apply grid gap-3;
76
+
77
+ .ss-foundation-sample__display,
78
+ .ss-foundation-sample__heading {
79
+ @apply m-0 mb-4;
80
+ font-family: var(--font-heading);
81
+ line-height: 1.2;
82
+ overflow-wrap: anywhere;
83
+ }
84
+
85
+ .ss-foundation-sample__display {
86
+ font-size: var(--text-display);
87
+ font-weight: 700;
88
+ }
89
+
90
+ .ss-foundation-sample__heading {
91
+ font-size: var(--text-heading-2);
92
+ font-weight: 500;
93
+ }
94
+
95
+ .ss-foundation-sample__body {
96
+ @apply m-0;
97
+ font-family: var(--font-sans);
98
+ line-height: 1.75;
99
+ }
100
+ }
101
+ }
102
+
103
+ .ss-foundation-sample--spacing {
104
+ .ss-foundation-sample__spaces {
105
+ @apply grid gap-4;
106
+ }
107
+
108
+ .ss-foundation-sample__space-row {
109
+ @apply m-0 grid grid-cols-[6rem_1fr] items-center gap-4 text-sm;
110
+
111
+ .ss-foundation-sample__track {
112
+ @apply rounded-field bg-base-200;
113
+ }
114
+
115
+ .ss-foundation-sample__space {
116
+ @apply block h-6 bg-primary;
117
+
118
+ &.ss-foundation-sample__space--1 {
119
+ width: calc(var(--spacing) * 1);
120
+ }
121
+ &.ss-foundation-sample__space--2 {
122
+ width: calc(var(--spacing) * 2);
123
+ }
124
+ &.ss-foundation-sample__space--4 {
125
+ width: calc(var(--spacing) * 4);
126
+ }
127
+ &.ss-foundation-sample__space--6 {
128
+ width: calc(var(--spacing) * 6);
129
+ }
130
+ &.ss-foundation-sample__space--8 {
131
+ width: calc(var(--spacing) * 8);
132
+ }
133
+ }
134
+ }
135
+ }
136
+
137
+ .ss-foundation-sample--radius,
138
+ .ss-foundation-sample--shadow {
139
+ .ss-foundation-sample__tiles {
140
+ @apply grid grid-cols-1 gap-8 p-3 sm:grid-cols-3;
141
+ }
142
+ }
143
+
144
+ .ss-foundation-sample--radius {
145
+ .ss-foundation-sample__shape {
146
+ @apply h-24 border-2 border-primary bg-base-200;
147
+
148
+ &.ss-foundation-sample__shape--none {
149
+ border-radius: 0;
150
+ }
151
+ &.ss-foundation-sample__shape--field {
152
+ border-radius: var(--radius-field);
153
+ }
154
+ &.ss-foundation-sample__shape--box {
155
+ border-radius: var(--radius-box);
156
+ }
157
+ }
158
+ }
159
+
160
+ .ss-foundation-sample--shadow {
161
+ .ss-foundation-sample__tiles {
162
+ @apply sm:grid-cols-2 lg:grid-cols-4;
163
+ }
164
+
165
+ .ss-foundation-sample__elevation {
166
+ @apply h-24 rounded-box border border-base-300 bg-base-100;
167
+
168
+ &.ss-foundation-sample__elevation--none {
169
+ box-shadow: none;
170
+ }
171
+ &.ss-foundation-sample__elevation--sm {
172
+ box-shadow: var(--shadow-sm);
173
+ }
174
+ &.ss-foundation-sample__elevation--soft {
175
+ box-shadow: var(--shadow-soft);
176
+ }
177
+ &.ss-foundation-sample__elevation--raised {
178
+ box-shadow: var(--shadow-raised);
179
+ }
180
+ }
181
+ }
182
+
183
+ .ss-foundation-sample--focus {
184
+ .ss-foundation-sample__focus-area {
185
+ @apply p-2;
186
+
187
+ p {
188
+ @apply m-0 mb-5;
189
+ }
190
+
191
+ .ss-foundation-sample__focus {
192
+ @apply inline-flex min-h-11 items-center rounded-field border border-base-300 bg-base-100 px-4 py-3 text-base-content;
193
+
194
+ &:focus-visible {
195
+ outline: 3px solid var(--color-primary);
196
+ outline-offset: 3px;
197
+ }
198
+ }
199
+ }
200
+ }
201
+ }
@@ -0,0 +1,118 @@
1
+ ---
2
+ import { getCollection } from 'astro:content';
3
+ import { getRelativeLocaleUrl } from 'astro:i18n';
4
+ import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
5
+ import { languageLinks } from '../../../../../lib/sproutsite/language-links.js';
6
+ import { withBase } from '../../../../../lib/sproutsite/urls.js';
7
+ import { t } from '../../../i18n/index.js';
8
+ import Icon from '../../atoms/Icon/Icon.astro';
9
+ import englishFlag from 'flag-icons/flags/4x3/gb.svg?url&no-inline';
10
+ import germanFlag from 'flag-icons/flags/4x3/de.svg?url&no-inline';
11
+
12
+ interface Props {
13
+ site: SiteConfig;
14
+ route: string;
15
+ }
16
+ const { site, route } = Astro.props;
17
+ const [pages, posts] = await Promise.all([
18
+ getCollection('pages'),
19
+ getCollection('blogPages'),
20
+ ]);
21
+ const flags: Record<string, string> = { en: englishFlag, de: germanFlag };
22
+ const options = languageLinks(
23
+ pages,
24
+ posts,
25
+ site.locales,
26
+ site.language,
27
+ route,
28
+ ).map((option) => ({
29
+ ...option,
30
+ name:
31
+ new Intl.DisplayNames([option.locale], { type: 'language' }).of(
32
+ option.locale,
33
+ ) ?? option.locale,
34
+ flag: flags[option.locale],
35
+ href:
36
+ site.locales.length > 1
37
+ ? getRelativeLocaleUrl(option.locale, option.route.slice(1))
38
+ : withBase(option.route, site.base),
39
+ }));
40
+ ---
41
+
42
+ <details class="ss-language-switcher">
43
+ <summary
44
+ aria-label={t(site.language === 'de' ? 'de' : 'en', 'languageSwitcher')}
45
+ >
46
+ <Icon name="Globe" size={20} />
47
+ <span>{site.language.toUpperCase()}</span>
48
+ <Icon name="ChevronDown" size={16} />
49
+ </summary>
50
+ <ul class="ss-language-switcher__options">
51
+ {options.map((option) => (
52
+ <li>
53
+ <a
54
+ href={option.href}
55
+ hreflang={option.locale}
56
+ lang={option.locale}
57
+ aria-current={option.current ? 'true' : undefined}
58
+ >
59
+ <span
60
+ class="ss-language-switcher__check"
61
+ aria-hidden="true"
62
+ >
63
+ {option.current && <Icon name="Check" size={20} />}
64
+ </span>
65
+ {option.flag && (
66
+ <img src={option.flag} width="24" height="18" alt="" />
67
+ )}
68
+ <span>{option.name}</span>
69
+ </a>
70
+ </li>
71
+ ))}
72
+ </ul>
73
+ </details>
74
+
75
+ <script>
76
+ document
77
+ .querySelectorAll<HTMLDetailsElement>('.ss-language-switcher')
78
+ .forEach((switcher) => {
79
+ const positionOptions = () => {
80
+ if (!switcher.open) return;
81
+ const options = switcher.querySelector<HTMLElement>(
82
+ '.ss-language-switcher__options',
83
+ );
84
+ if (!options) return;
85
+ if (switcher.closest('.ss-header__dialog')) {
86
+ options.removeAttribute('data-positioned');
87
+ options.style.removeProperty('--ss-language-shift');
88
+ return;
89
+ }
90
+ options.dataset.positioned = '';
91
+ options.style.removeProperty('--ss-language-shift');
92
+ const bounds = options.getBoundingClientRect();
93
+ const shift = Math.max(
94
+ 16 - bounds.left,
95
+ Math.min(0, window.innerWidth - 16 - bounds.right),
96
+ );
97
+ options.style.setProperty('--ss-language-shift', `${shift}px`);
98
+ };
99
+ switcher.addEventListener('toggle', positionOptions);
100
+ window.addEventListener('resize', positionOptions);
101
+ document.addEventListener('click', (event) => {
102
+ if (
103
+ event.target instanceof Node &&
104
+ !switcher.contains(event.target)
105
+ ) {
106
+ switcher.open = false;
107
+ }
108
+ });
109
+ switcher.addEventListener('keydown', (event) => {
110
+ if (event.key === 'Escape' && switcher.open) {
111
+ event.preventDefault();
112
+ event.stopPropagation();
113
+ switcher.open = false;
114
+ switcher.querySelector('summary')?.focus();
115
+ }
116
+ });
117
+ });
118
+ </script>
@@ -0,0 +1,134 @@
1
+ @layer components {
2
+ .ss-language-switcher {
3
+ position: relative;
4
+ font-size: var(--text-lg);
5
+
6
+ > summary {
7
+ display: flex;
8
+ align-items: center;
9
+ gap: 0.5rem;
10
+ min-height: 2.75rem;
11
+ padding-inline: 0.75rem;
12
+ border-radius: 0.5rem;
13
+ cursor: pointer;
14
+ list-style: none;
15
+
16
+ &::-webkit-details-marker {
17
+ display: none;
18
+ }
19
+ &:hover {
20
+ background: color-mix(in srgb, currentColor 10%, transparent);
21
+ }
22
+ }
23
+
24
+ .ss-language-switcher__options {
25
+ position: absolute;
26
+ inset-block-start: calc(100% + 1.25rem);
27
+ inset-inline-start: 50%;
28
+ translate: -50% 0;
29
+ z-index: 50;
30
+ min-width: 11rem;
31
+ max-width: calc(100vw - 2rem);
32
+ margin: 0;
33
+ padding: 0.5rem;
34
+ list-style: none;
35
+ border: 1px solid
36
+ var(--ss-header-dropdown-border, var(--color-base-300));
37
+ border-radius: 0.75rem;
38
+ background: var(--ss-header-dropdown-bg, var(--color-base-100));
39
+ @apply shadow-lg;
40
+
41
+ .ss-header--scrolled & {
42
+ inset-block-start: calc(100% + 2.5rem);
43
+ }
44
+
45
+ @media (max-width: 47.999rem) {
46
+ inset-inline-start: 0;
47
+ translate: none;
48
+ }
49
+
50
+ &[data-positioned] {
51
+ inset-inline-start: 50%;
52
+ translate: calc(-50% + var(--ss-language-shift, 0px)) 0;
53
+ }
54
+
55
+ &::before {
56
+ content: '';
57
+ position: absolute;
58
+ inset-block-start: 0;
59
+ inset-inline-start: calc(50% - var(--ss-language-shift, 0px));
60
+ width: 0.875rem;
61
+ height: 0.875rem;
62
+ background: inherit;
63
+ border-top: inherit;
64
+ border-left: inherit;
65
+ translate: -50% -50%;
66
+ rotate: 45deg;
67
+ }
68
+
69
+ a {
70
+ display: flex;
71
+ align-items: center;
72
+ gap: 0.625rem;
73
+ min-height: 2.75rem;
74
+ padding: 0.5rem;
75
+ border-radius: 0.375rem;
76
+ color: inherit;
77
+ text-decoration: none;
78
+
79
+ &:hover {
80
+ background: color-mix(
81
+ in srgb,
82
+ currentColor 10%,
83
+ transparent
84
+ );
85
+ }
86
+ &[aria-current] {
87
+ font-weight: 700;
88
+ }
89
+ }
90
+
91
+ img {
92
+ flex-shrink: 0;
93
+ border-radius: 2px;
94
+ }
95
+ }
96
+
97
+ .ss-language-switcher__check {
98
+ width: 1.25rem;
99
+ flex-shrink: 0;
100
+ }
101
+
102
+ .ss-header__dialog & {
103
+ width: 100%;
104
+
105
+ > summary {
106
+ width: fit-content;
107
+ padding-inline: 0;
108
+ }
109
+
110
+ .ss-language-switcher__options {
111
+ position: static;
112
+ width: 100%;
113
+ min-width: 0;
114
+ max-width: none;
115
+ margin-top: 0.5rem;
116
+ translate: none;
117
+ box-shadow: none;
118
+
119
+ &::before {
120
+ display: none;
121
+ }
122
+
123
+ a[aria-current] {
124
+ color: var(--color-hero-cyan);
125
+ background: color-mix(
126
+ in srgb,
127
+ var(--color-primary-content) 10%,
128
+ transparent
129
+ );
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
@@ -0,0 +1,33 @@
1
+ ---
2
+ type TabsVariant = 'border' | 'box' | 'lift';
3
+
4
+ interface Props {
5
+ label: string;
6
+ variant?: TabsVariant;
7
+ initial?: number;
8
+ }
9
+
10
+ const { label, variant = 'border', initial = 1 } = Astro.props;
11
+ const variants: Record<TabsVariant, string> = {
12
+ border: 'tabs-border',
13
+ box: 'tabs-box',
14
+ lift: 'tabs-lift',
15
+ };
16
+ if (!label?.trim() || !Object.hasOwn(variants, variant))
17
+ throw new Error('Tabs requires a label and variant border, box, or lift.');
18
+ if (!Number.isInteger(initial) || initial < 1)
19
+ throw new Error('Tabs initial must be a positive, one-based integer.');
20
+ ---
21
+
22
+ <div class="ss-tabs" data-initial={initial} data-variant={variant}>
23
+ <div
24
+ class:list={['ss-tabs__list', 'tabs', variants[variant]]}
25
+ data-label={label}
26
+ hidden
27
+ ></div>
28
+ <slot />
29
+ </div>
30
+
31
+ <script>
32
+ import './tabs';
33
+ </script>
@@ -0,0 +1,38 @@
1
+ @layer components {
2
+ .ss-tabs {
3
+ @apply my-6 min-w-0 text-base-content;
4
+
5
+ :where(.tone-brand) & {
6
+ @apply rounded-box bg-base-100 p-4;
7
+ }
8
+
9
+ .ss-tabs__list {
10
+ @apply mb-2 flex max-w-full !flex-nowrap overflow-x-auto;
11
+ scrollbar-width: none;
12
+
13
+ &[hidden] {
14
+ display: none;
15
+ }
16
+
17
+ .ss-tabs__button {
18
+ @apply min-h-11 shrink-0 whitespace-nowrap font-semibold !text-base-content;
19
+
20
+ &:focus-visible {
21
+ outline: 3px solid var(--color-primary) !important;
22
+ outline-offset: -3px !important;
23
+ }
24
+ }
25
+ }
26
+
27
+ &[data-variant='lift'][data-enhanced='true'] {
28
+ .ss-tabs__list {
29
+ @apply relative z-10;
30
+ margin-bottom: -1px;
31
+ }
32
+
33
+ > .ss-tab {
34
+ @apply mt-0 rounded-tl-none;
35
+ }
36
+ }
37
+ }
38
+ }