suabochica-design-system 1.3.0 → 1.4.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/CHANGELOG.md +29 -0
- package/DESIGN_DECISIONS.md +25 -19
- package/DISTRIBUTION.md +4 -4
- package/MIGRATION.md +6 -5
- package/README.md +8 -2
- package/dist/icons/computer.svg +5 -0
- package/dist/icons/half-moon.svg +3 -0
- package/dist/icons/manifest.json +14 -1
- package/dist/icons/sun-light.svg +11 -0
- package/dist/js/index.js +329 -22
- package/dist/js/index.js.map +1 -1
- package/dist/styles/suabochica.css +1 -1
- package/dist/types/components/Dropdown/Dropdown.d.ts +24 -0
- package/dist/types/icons/generated.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Button/README.md +1 -1
- package/src/components/Dropdown/README.md +102 -0
- package/src/components/FORMS.md +2 -2
- package/src/components/Icon/README.md +6 -3
- package/src/components/LAYOUT.md +1 -1
- package/src/components/SiteHeader/README.md +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,34 @@ Unreleased until a version is published.
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## [1.4.0] - 2026-11-08
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Dropdown molecule: a controlled single-selection select-only combobox with an
|
|
14
|
+
icon+label trigger, listbox popup, keyboard navigation, typeahead, disabled
|
|
15
|
+
options, and a native-select fallback that works before hydration and without
|
|
16
|
+
JavaScript. SiteHeader's optional theme selector now uses Dropdown (public
|
|
17
|
+
`themeSelector` API unchanged) with sun/half-moon/computer icons. Escape
|
|
18
|
+
inside the theme listbox closes only the listbox. React/Astro and a documented
|
|
19
|
+
plain-HTML/Hugo fallback share `sua-dropdown*` classes.
|
|
20
|
+
- Iconoir regular catalog grew to twelve SVGs with `sun-light`, `half-moon`, and
|
|
21
|
+
`computer` for light/dark/system theme presentation.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Light-theme reading, input, and secondary-text surfaces moved from pure white
|
|
26
|
+
to warm sand `#F1D4AF`. Dependent tokens retuned for contrast: secondary
|
|
27
|
+
button text uses cream `#FFF0C5`, placeholders use `#5C5A56`, structural
|
|
28
|
+
borders use stronger sand, and light headings/accent use deeper coral/teal
|
|
29
|
+
(`#A52A1A` / `#1F5F60`).
|
|
30
|
+
|
|
31
|
+
### Validation record
|
|
32
|
+
|
|
33
|
+
203 Jest tests and 560 Chromium checks passed in the pinned browser container,
|
|
34
|
+
including visual comparisons across light and dark themes, plus packed Astro/Hugo
|
|
35
|
+
installs of the 1.4.0 tarball.
|
|
36
|
+
|
|
9
37
|
## [1.3.0] - 2026-11-06
|
|
10
38
|
|
|
11
39
|
### Added
|
|
@@ -166,3 +194,4 @@ choosing the first release. See [RELEASE.md](RELEASE.md) for the sequence.
|
|
|
166
194
|
[1.1.0]: https://github.com/suabochica/suabochica-storybook/releases/tag/v1.1.0
|
|
167
195
|
[1.2.0]: https://github.com/suabochica/suabochica-storybook/releases/tag/v1.2.0
|
|
168
196
|
[1.3.0]: https://github.com/suabochica/suabochica-storybook/releases/tag/v1.3.0
|
|
197
|
+
[1.4.0]: https://github.com/suabochica/suabochica-storybook/releases/tag/v1.4.0
|
package/DESIGN_DECISIONS.md
CHANGED
|
@@ -26,7 +26,7 @@ recipes; browser-level accessibility validation remains part of component work.
|
|
|
26
26
|
Use the written guide's roles, not its generated frontmatter palette:
|
|
27
27
|
|
|
28
28
|
- Canvas: `#FFF0C5`.
|
|
29
|
-
- Paper surface: `#FDF6DE`; input and reading surfaces: `#
|
|
29
|
+
- Paper surface: `#FDF6DE`; input and reading surfaces: `#F1D4AF`.
|
|
30
30
|
- Primary text: `#4A4947`.
|
|
31
31
|
- Structural borders: `#E3CAA5` and `#CDB38B`.
|
|
32
32
|
- Primary action: `#972828`; hover and border: `#7D1F1F`.
|
|
@@ -52,28 +52,34 @@ boundaries and focus indicators need 3:1 against adjacent colors. Ratios below
|
|
|
52
52
|
are displayed to three decimal places. These measurements do not establish
|
|
53
53
|
whole-component WCAG conformance.
|
|
54
54
|
|
|
55
|
-
- **Body text:** ink on canvas **7.932:1**, paper **8.314:1**, and
|
|
56
|
-
**
|
|
55
|
+
- **Body text:** ink on canvas **7.932:1**, paper **8.314:1**, and the
|
|
56
|
+
reading/input surface (`#F1D4AF`) **6.328:1**. Use ink for body, labels, and
|
|
57
|
+
muted text on warm surfaces.
|
|
57
58
|
- **Primary action:** canvas text on primary **6.989:1** and on primary-hover
|
|
58
59
|
**8.872:1**. Retain the written button recipe.
|
|
59
60
|
- **Secondary action:** white on original teal is **3.173:1**, failing normal
|
|
60
61
|
text. Use darker teal `#28797A` as the functional secondary background;
|
|
61
|
-
|
|
62
|
-
**4.511:1** and paper at **4.728:1**. Retain original teal for
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
cream `#FFF0C5` on darker teal is **4.511:1**. It also contrasts with canvas
|
|
63
|
+
at **4.511:1** and paper at **4.728:1**. Retain original teal for
|
|
64
|
+
decoration.
|
|
65
|
+
- **Text links:** primary on canvas **6.989:1**, paper **7.326:1**, and the
|
|
66
|
+
reading surface **5.576:1**. Underline links in prose; use primary-hover on
|
|
67
|
+
hover. Coral on canvas is only **3.226:1**, so do not turn normal-size link
|
|
68
|
+
text coral.
|
|
69
|
+
- **Focus:** darker teal on canvas is **4.511:1** and on the reading surface
|
|
70
|
+
**3.599:1**. Use darker teal for a 2px outline with a 2px offset on
|
|
71
|
+
supported light surfaces. The offset exposes the surrounding surface rather
|
|
72
|
+
than touching the control fill. Audit a different pairing if the
|
|
73
|
+
surrounding surface is dark or an image.
|
|
74
|
+
- **Input boundaries:** ink on the reading/input surface is **6.328:1**.
|
|
75
|
+
Sand borders are decorative only (sand-strong on reading **1.419:1**).
|
|
72
76
|
Use ink for functional input borders; retain sand for decorative separators
|
|
73
77
|
and noninteractive cards that are understandable without their borders.
|
|
74
|
-
- **Placeholder:** `#
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
- **Placeholder:** `#5C5A56` on the reading/input surface is **4.842:1**.
|
|
79
|
+
Restrict this placeholder role to input surfaces. Do not use it for small
|
|
80
|
+
metadata text on cream or as a replacement for labels.
|
|
81
|
+
- **Headings:** accent `#A52A1A` on canvas **6.287:1**, paper **6.590:1**,
|
|
82
|
+
and reading **5.016:1**; h3 teal-ink `#1F5F60` on reading **5.159:1**.
|
|
77
83
|
- **Status:** ink on mint is **5.404:1**. Pair status text with a label or icon;
|
|
78
84
|
a mint dot alone does not communicate success.
|
|
79
85
|
|
|
@@ -82,7 +88,7 @@ whole-component WCAG conformance.
|
|
|
82
88
|
- **Primary button:** default primary fill, primary-hover fill on hover and
|
|
83
89
|
press; canvas text throughout. Hover may add the documented contact shadow;
|
|
84
90
|
press may translate 1px down/right. Preserve the focus outline independently.
|
|
85
|
-
- **Secondary button:** darker teal fill and
|
|
91
|
+
- **Secondary button:** darker teal fill and cream text in all enabled states.
|
|
86
92
|
Use shadow/position changes for hover and press instead of inventing an
|
|
87
93
|
unmeasured color. Keep the same contrast-tested palette.
|
|
88
94
|
- **Outline button:** transparent fill, ink text/border; paper hover fill.
|
|
@@ -91,7 +97,7 @@ whole-component WCAG conformance.
|
|
|
91
97
|
Disabled controls are not tabbable; explanatory text stays in normal contrast.
|
|
92
98
|
- **Loading buttons, when implemented:** preserve the accessible name, expose
|
|
93
99
|
busy status, and prevent duplicate activation. Do not rely on a spinner alone.
|
|
94
|
-
- **Fields:**
|
|
100
|
+
- **Fields:** reading-surface background, ink border/text, measured placeholder role.
|
|
95
101
|
Invalid fields use primary-colored borders plus an explicit associated error
|
|
96
102
|
message and `aria-invalid`; error text uses primary on a supported light
|
|
97
103
|
surface. Focus still uses the separate outline. Do not use placeholder text
|
package/DISTRIBUTION.md
CHANGED
|
@@ -15,10 +15,10 @@ pnpm pack --pack-destination /path/to/existing/output-directory
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
`prepack` rebuilds the artifact, so packing never silently ships stale output.
|
|
18
|
-
Install the generated `suabochica-design-system-1.
|
|
18
|
+
Install the generated `suabochica-design-system-1.4.0.tgz` in a separate consumer:
|
|
19
19
|
|
|
20
20
|
```sh
|
|
21
|
-
pnpm add /path/to/suabochica-design-system-1.
|
|
21
|
+
pnpm add /path/to/suabochica-design-system-1.4.0.tgz react@19.3.1 react-dom@19.3.1
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
```tsx
|
|
@@ -51,7 +51,7 @@ no consumer Tailwind plugin or library-source scanning requirement.
|
|
|
51
51
|
| `suabochica-design-system` | Named ESM React components and public TypeScript types |
|
|
52
52
|
| `suabochica-design-system/styles.css` | Compiled tokens, scoped base styles, and all component/template styles |
|
|
53
53
|
| `suabochica-design-system/styles/*` | Relative assets and SIL font notices under the complete styles directory |
|
|
54
|
-
| `suabochica-design-system/icons/*.svg` |
|
|
54
|
+
| `suabochica-design-system/icons/*.svg` | Twelve pinned Iconoir regular SVGs for static HTML/Hugo use |
|
|
55
55
|
| `suabochica-design-system/icons/LICENSE` | Iconoir MIT copyright and license notice |
|
|
56
56
|
| `suabochica-design-system/icons/manifest.json` | Curated icon names and upstream version |
|
|
57
57
|
| `suabochica-design-system/images/*.png` | Packaged SiteHeader portrait for optional brand imagery |
|
|
@@ -76,7 +76,7 @@ no consumer Tailwind plugin or library-source scanning requirement.
|
|
|
76
76
|
declarations reachable from the public entry. `dist/styles/` contains CSS,
|
|
77
77
|
four relative variable-font assets, and both SIL notices. Preserve the complete
|
|
78
78
|
styles tree when copying it to a static site's public assets.
|
|
79
|
-
- `dist/icons/` contains only
|
|
79
|
+
- `dist/icons/` contains only twelve Iconoir SVGs, their manifest, and the separate
|
|
80
80
|
MIT notice. Astro renders the Icon atom without hydration; Hugo copies these
|
|
81
81
|
assets to its `assets/` tree and inlines them through a validated partial.
|
|
82
82
|
See the [Icon guide](src/components/Icon/README.md) for site integration.
|
package/MIGRATION.md
CHANGED
|
@@ -96,8 +96,8 @@ rather than porting routes/content logic into the library.
|
|
|
96
96
|
fixtures are verified; the actual portfolio/blog repositories and their versions
|
|
97
97
|
need separate integration review. Alternate React/framework versions are not
|
|
98
98
|
established by those fixture results.
|
|
99
|
-
- **Packaging:** `suabochica-design-system@1.
|
|
100
|
-
|
|
99
|
+
- **Packaging:** `suabochica-design-system@1.4.0` includes the Icon atom,
|
|
100
|
+
SiteHeader portrait/theme selector, ScrollTrack, and Dropdown. Packed ESM
|
|
101
101
|
builds are verified.
|
|
102
102
|
Arbitrary consumer Tailwind utilities are not generated by the precompiled
|
|
103
103
|
stylesheet.
|
|
@@ -105,11 +105,12 @@ rather than porting routes/content logic into the library.
|
|
|
105
105
|
Markdown rendering, sanitization, and image optimization. CodeBlock provides
|
|
106
106
|
optional snippet highlighting; Hugo uses its built-in highlighter with the
|
|
107
107
|
shared CodeBlock styles.
|
|
108
|
-
The Icon atom supplies
|
|
108
|
+
The Icon atom supplies twelve pinned Iconoir regular SVGs; Astro renders it
|
|
109
109
|
statically, while Hugo inlines the same packaged SVGs from a local partial.
|
|
110
110
|
Apps own contact details, profile URLs, and cross-site destinations.
|
|
111
|
-
Newsletter backends, reading progress,
|
|
112
|
-
icon sets, and ecommerce flows are deferred.
|
|
111
|
+
Newsletter backends, reading progress, multi-select/overlay menu systems,
|
|
112
|
+
broad icon sets, and ecommerce flows are deferred. Single-selection Dropdown
|
|
113
|
+
is included; action menus and multi-select are not.
|
|
113
114
|
- **Verification:** browser automation is Chromium at two widths, with axe and
|
|
114
115
|
selected visual baselines. It complements manual keyboard/visual review;
|
|
115
116
|
production content, assistive-technology review, additional browsers, and the
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ pnpm pack --pack-destination /path/to/existing/output-directory
|
|
|
23
23
|
resulting tarball in your React application:
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
pnpm add /path/to/suabochica-design-system-1.
|
|
26
|
+
pnpm add /path/to/suabochica-design-system-1.4.0.tgz react@19.3.1 react-dom@19.3.1
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
Import styles once in the application layout and components from the public entry:
|
|
@@ -212,7 +212,7 @@ Progress is tracked in `IMPLEMENTATION_PLAN.md`.
|
|
|
212
212
|
|
|
213
213
|
## Component and template catalog
|
|
214
214
|
|
|
215
|
-
**Atoms → Icon** provides
|
|
215
|
+
**Atoms → Icon** provides twelve pinned Iconoir SVGs for email, phone, CV, social
|
|
216
216
|
links, and website/blog navigation. The React atom renders static inline SVG in
|
|
217
217
|
Astro; the same packaged artwork powers a Hugo partial without React. See the
|
|
218
218
|
[Icon guide](src/components/Icon/README.md) for names, accessibility, licensing,
|
|
@@ -250,6 +250,12 @@ caller-formatted metadata, and natural image/caption composition. See
|
|
|
250
250
|
[`src/components/MOLECULES.md`](src/components/MOLECULES.md) for APIs, semantics,
|
|
251
251
|
image constraints, fixture attribution, and shared HTML markup.
|
|
252
252
|
|
|
253
|
+
**Molecules → Dropdown** is a controlled single-selection combobox: icon+label
|
|
254
|
+
trigger, listbox keyboard/typeahead behavior, and a native-select fallback for
|
|
255
|
+
SSR and no-JavaScript hosts. See
|
|
256
|
+
[`src/components/Dropdown/README.md`](src/components/Dropdown/README.md) for
|
|
257
|
+
props, the interaction contract, and plain-HTML/Hugo markup.
|
|
258
|
+
|
|
253
259
|
**Organisms → SiteHeader** composes the brand and navigation with a mobile
|
|
254
260
|
disclosure, responsive focus management, and usable static/server markup. See
|
|
255
261
|
[`src/components/SiteHeader/README.md`](src/components/SiteHeader/README.md) for
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="24" height="24" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M2 21L17 21" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M21 21L22 21" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M2 16.4V3.6C2 3.26863 2.26863 3 2.6 3H21.4C21.7314 3 22 3.26863 22 3.6V16.4C22 16.7314 21.7314 17 21.4 17H2.6C2.26863 17 2 16.7314 2 16.4Z" stroke="currentColor" stroke-width="1.5"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M3 11.5066C3 16.7497 7.25034 21 12.4934 21C16.2209 21 19.4466 18.8518 21 15.7259C12.4934 15.7259 8.27411 11.5066 8.27411 3C5.14821 4.55344 3 7.77915 3 11.5066Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
</svg>
|
package/dist/icons/manifest.json
CHANGED
|
@@ -2,5 +2,18 @@
|
|
|
2
2
|
"source": "https://github.com/iconoir-icons/iconoir/tree/v7.12.2/icons/regular",
|
|
3
3
|
"version": "7.12.2",
|
|
4
4
|
"style": "regular",
|
|
5
|
-
"icons": [
|
|
5
|
+
"icons": [
|
|
6
|
+
"mail-out",
|
|
7
|
+
"phone-income",
|
|
8
|
+
"post",
|
|
9
|
+
"page-star",
|
|
10
|
+
"github",
|
|
11
|
+
"linkedin",
|
|
12
|
+
"x",
|
|
13
|
+
"instagram",
|
|
14
|
+
"home",
|
|
15
|
+
"sun-light",
|
|
16
|
+
"half-moon",
|
|
17
|
+
"computer"
|
|
18
|
+
]
|
|
6
19
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="24" height="24" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M22 12L23 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M12 2V1" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M12 23V22" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
<path d="M20 20L19 19" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
<path d="M20 4L19 5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
+
<path d="M4 20L5 19" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
9
|
+
<path d="M4 4L5 5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
10
|
+
<path d="M1 12L2 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
11
|
+
</svg>
|
package/dist/js/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cx from "classnames";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createElement, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createElement, useCallback, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
4
4
|
import hljs from "highlight.js/lib/common";
|
|
5
5
|
import lisp from "highlight.js/lib/languages/lisp";
|
|
6
6
|
// src/components/Button/Button.tsx
|
|
@@ -332,7 +332,88 @@ var iconPaths = {
|
|
|
332
332
|
stroke: "currentColor",
|
|
333
333
|
strokeLinecap: "round",
|
|
334
334
|
strokeLinejoin: "round"
|
|
335
|
-
}]
|
|
335
|
+
}],
|
|
336
|
+
"sun-light": [
|
|
337
|
+
{
|
|
338
|
+
d: "M12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18Z",
|
|
339
|
+
stroke: "currentColor",
|
|
340
|
+
strokeLinecap: "round",
|
|
341
|
+
strokeLinejoin: "round"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
d: "M22 12L23 12",
|
|
345
|
+
stroke: "currentColor",
|
|
346
|
+
strokeLinecap: "round",
|
|
347
|
+
strokeLinejoin: "round"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
d: "M12 2V1",
|
|
351
|
+
stroke: "currentColor",
|
|
352
|
+
strokeLinecap: "round",
|
|
353
|
+
strokeLinejoin: "round"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
d: "M12 23V22",
|
|
357
|
+
stroke: "currentColor",
|
|
358
|
+
strokeLinecap: "round",
|
|
359
|
+
strokeLinejoin: "round"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
d: "M20 20L19 19",
|
|
363
|
+
stroke: "currentColor",
|
|
364
|
+
strokeLinecap: "round",
|
|
365
|
+
strokeLinejoin: "round"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
d: "M20 4L19 5",
|
|
369
|
+
stroke: "currentColor",
|
|
370
|
+
strokeLinecap: "round",
|
|
371
|
+
strokeLinejoin: "round"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
d: "M4 20L5 19",
|
|
375
|
+
stroke: "currentColor",
|
|
376
|
+
strokeLinecap: "round",
|
|
377
|
+
strokeLinejoin: "round"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
d: "M4 4L5 5",
|
|
381
|
+
stroke: "currentColor",
|
|
382
|
+
strokeLinecap: "round",
|
|
383
|
+
strokeLinejoin: "round"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
d: "M1 12L2 12",
|
|
387
|
+
stroke: "currentColor",
|
|
388
|
+
strokeLinecap: "round",
|
|
389
|
+
strokeLinejoin: "round"
|
|
390
|
+
}
|
|
391
|
+
],
|
|
392
|
+
"half-moon": [{
|
|
393
|
+
d: "M3 11.5066C3 16.7497 7.25034 21 12.4934 21C16.2209 21 19.4466 18.8518 21 15.7259C12.4934 15.7259 8.27411 11.5066 8.27411 3C5.14821 4.55344 3 7.77915 3 11.5066Z",
|
|
394
|
+
stroke: "currentColor",
|
|
395
|
+
strokeLinecap: "round",
|
|
396
|
+
strokeLinejoin: "round"
|
|
397
|
+
}],
|
|
398
|
+
computer: [
|
|
399
|
+
{
|
|
400
|
+
d: "M2 21L17 21",
|
|
401
|
+
stroke: "currentColor",
|
|
402
|
+
strokeLinecap: "round",
|
|
403
|
+
strokeLinejoin: "round"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
d: "M21 21L22 21",
|
|
407
|
+
stroke: "currentColor",
|
|
408
|
+
strokeLinecap: "round",
|
|
409
|
+
strokeLinejoin: "round"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
d: "M2 16.4V3.6C2 3.26863 2.26863 3 2.6 3H21.4C21.7314 3 22 3.26863 22 3.6V16.4C22 16.7314 21.7314 17 21.4 17H2.6C2.26863 17 2 16.7314 2 16.4Z",
|
|
413
|
+
stroke: "currentColor",
|
|
414
|
+
strokeWidth: 1.5
|
|
415
|
+
}
|
|
416
|
+
]
|
|
336
417
|
};
|
|
337
418
|
// src/components/Icon/Icon.tsx
|
|
338
419
|
function Icon({ name, size = "md", label, className, ...props }) {
|
|
@@ -537,7 +618,246 @@ function CodeBlock({ code, children, language, caption, className, ...props }) {
|
|
|
537
618
|
})]
|
|
538
619
|
});
|
|
539
620
|
}
|
|
621
|
+
// src/components/Dropdown/Dropdown.tsx
|
|
622
|
+
function Dropdown({ label, value, onChange, options, disabled = false, placeholder = "Select…", align = "start", className, ref, ...props }) {
|
|
623
|
+
const generatedId = useId();
|
|
624
|
+
const labelId = `${generatedId}-label`;
|
|
625
|
+
const triggerValueId = `${generatedId}-value`;
|
|
626
|
+
const listId = `${generatedId}-list`;
|
|
627
|
+
const optionId = (index) => `${generatedId}-option-${index}`;
|
|
628
|
+
const rootRef = useRef(null);
|
|
629
|
+
const triggerRef = useRef(null);
|
|
630
|
+
const selectRef = useRef(null);
|
|
631
|
+
const typeahead = useRef({
|
|
632
|
+
buffer: "",
|
|
633
|
+
timer: 0
|
|
634
|
+
});
|
|
635
|
+
const [enhanced, setEnhanced] = useState(false);
|
|
636
|
+
const [open, setOpen] = useState(false);
|
|
637
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
638
|
+
const selectedIndex = options.findIndex((option) => option.value === value);
|
|
639
|
+
const selected = selectedIndex >= 0 ? options[selectedIndex] : void 0;
|
|
640
|
+
const enabledIndexes = options.flatMap((option, index) => option.disabled ? [] : [index]);
|
|
641
|
+
const firstEnabled = enabledIndexes[0] ?? -1;
|
|
642
|
+
const lastEnabled = enabledIndexes[enabledIndexes.length - 1] ?? -1;
|
|
643
|
+
useImperativeHandle(ref, () => rootRef.current, []);
|
|
644
|
+
useEffect(() => {
|
|
645
|
+
const selectFocused = document.activeElement === selectRef.current && selectRef.current !== null;
|
|
646
|
+
setEnhanced(rootRef.current?.isConnected ?? false);
|
|
647
|
+
if (selectFocused) triggerRef.current?.focus();
|
|
648
|
+
const handlePointerDown = (event) => {
|
|
649
|
+
if (rootRef.current && !rootRef.current.contains(event.target)) setOpen(false);
|
|
650
|
+
};
|
|
651
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
652
|
+
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
653
|
+
}, []);
|
|
654
|
+
useEffect(() => () => window.clearTimeout(typeahead.current.timer), []);
|
|
655
|
+
const activeOptionId = open && enabledIndexes.length > 0 ? optionId(activeIndex) : null;
|
|
656
|
+
useEffect(() => {
|
|
657
|
+
if (!activeOptionId) return;
|
|
658
|
+
document.getElementById(activeOptionId)?.scrollIntoView?.({ block: "nearest" });
|
|
659
|
+
}, [activeOptionId]);
|
|
660
|
+
const close = useCallback((returnFocus) => {
|
|
661
|
+
setOpen(false);
|
|
662
|
+
if (returnFocus) triggerRef.current?.focus();
|
|
663
|
+
}, []);
|
|
664
|
+
const commit = (index) => {
|
|
665
|
+
const option = options[index];
|
|
666
|
+
if (!option || option.disabled) return;
|
|
667
|
+
onChange(option.value);
|
|
668
|
+
close(true);
|
|
669
|
+
};
|
|
670
|
+
const step = (direction) => {
|
|
671
|
+
if (enabledIndexes.length === 0) return;
|
|
672
|
+
const position = enabledIndexes.indexOf(activeIndex);
|
|
673
|
+
const nextPosition = position === -1 ? direction === 1 ? 0 : enabledIndexes.length - 1 : (position + direction + enabledIndexes.length) % enabledIndexes.length;
|
|
674
|
+
setActiveIndex(enabledIndexes[nextPosition]);
|
|
675
|
+
};
|
|
676
|
+
const openList = () => {
|
|
677
|
+
if (disabled || enabledIndexes.length === 0) return;
|
|
678
|
+
const start = selectedIndex >= 0 && !options[selectedIndex]?.disabled ? selectedIndex : directionStart(1);
|
|
679
|
+
setActiveIndex(start);
|
|
680
|
+
setOpen(true);
|
|
681
|
+
};
|
|
682
|
+
function directionStart(direction) {
|
|
683
|
+
return direction === 1 ? firstEnabled : lastEnabled;
|
|
684
|
+
}
|
|
685
|
+
const applyTypeahead = (character) => {
|
|
686
|
+
const state = typeahead.current;
|
|
687
|
+
window.clearTimeout(state.timer);
|
|
688
|
+
state.buffer += character.toLowerCase();
|
|
689
|
+
state.timer = window.setTimeout(() => {
|
|
690
|
+
state.buffer = "";
|
|
691
|
+
}, 500);
|
|
692
|
+
const buffer = state.buffer;
|
|
693
|
+
const start = buffer.length === 1 ? activeIndex + 1 : activeIndex;
|
|
694
|
+
for (let offset = 0; offset < options.length; offset++) {
|
|
695
|
+
const index = (start + offset + options.length) % options.length;
|
|
696
|
+
const option = options[index];
|
|
697
|
+
if (option.disabled) continue;
|
|
698
|
+
if (option.label.toLowerCase().startsWith(buffer)) {
|
|
699
|
+
setActiveIndex(index);
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
const handleTriggerKeyDown = (event) => {
|
|
705
|
+
if (disabled) return;
|
|
706
|
+
if (!open) {
|
|
707
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
708
|
+
event.preventDefault();
|
|
709
|
+
openList();
|
|
710
|
+
}
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
switch (event.key) {
|
|
714
|
+
case "ArrowDown":
|
|
715
|
+
event.preventDefault();
|
|
716
|
+
step(1);
|
|
717
|
+
break;
|
|
718
|
+
case "ArrowUp":
|
|
719
|
+
event.preventDefault();
|
|
720
|
+
step(-1);
|
|
721
|
+
break;
|
|
722
|
+
case "Home":
|
|
723
|
+
event.preventDefault();
|
|
724
|
+
if (firstEnabled >= 0) setActiveIndex(firstEnabled);
|
|
725
|
+
break;
|
|
726
|
+
case "End":
|
|
727
|
+
event.preventDefault();
|
|
728
|
+
if (lastEnabled >= 0) setActiveIndex(lastEnabled);
|
|
729
|
+
break;
|
|
730
|
+
case "Enter":
|
|
731
|
+
case " ":
|
|
732
|
+
event.preventDefault();
|
|
733
|
+
commit(activeIndex);
|
|
734
|
+
break;
|
|
735
|
+
case "Escape":
|
|
736
|
+
event.preventDefault();
|
|
737
|
+
event.stopPropagation();
|
|
738
|
+
close(true);
|
|
739
|
+
break;
|
|
740
|
+
case "Tab":
|
|
741
|
+
setOpen(false);
|
|
742
|
+
break;
|
|
743
|
+
default: if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) applyTypeahead(event.key);
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
const handleOptionClick = (event, index) => {
|
|
747
|
+
event.preventDefault();
|
|
748
|
+
commit(index);
|
|
749
|
+
};
|
|
750
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
751
|
+
...props,
|
|
752
|
+
ref: rootRef,
|
|
753
|
+
className: cx("sua-dropdown", className),
|
|
754
|
+
"data-enhanced": enhanced ? "true" : void 0,
|
|
755
|
+
children: [
|
|
756
|
+
/* @__PURE__ */ jsx("span", {
|
|
757
|
+
className: "sua-dropdown__label",
|
|
758
|
+
id: labelId,
|
|
759
|
+
children: label
|
|
760
|
+
}),
|
|
761
|
+
/* @__PURE__ */ jsx("select", {
|
|
762
|
+
ref: selectRef,
|
|
763
|
+
className: "sua-dropdown__fallback",
|
|
764
|
+
hidden: enhanced,
|
|
765
|
+
disabled,
|
|
766
|
+
value,
|
|
767
|
+
"aria-labelledby": labelId,
|
|
768
|
+
onChange: (event) => onChange(event.currentTarget.value),
|
|
769
|
+
children: options.map((option) => /* @__PURE__ */ jsx("option", {
|
|
770
|
+
value: option.value,
|
|
771
|
+
disabled: option.disabled,
|
|
772
|
+
children: option.label
|
|
773
|
+
}, option.value))
|
|
774
|
+
}),
|
|
775
|
+
/* @__PURE__ */ jsxs("div", {
|
|
776
|
+
className: "sua-dropdown__control",
|
|
777
|
+
hidden: !enhanced,
|
|
778
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
779
|
+
ref: triggerRef,
|
|
780
|
+
type: "button",
|
|
781
|
+
className: "sua-dropdown__trigger",
|
|
782
|
+
disabled,
|
|
783
|
+
"aria-haspopup": "listbox",
|
|
784
|
+
"aria-expanded": open,
|
|
785
|
+
"aria-controls": listId,
|
|
786
|
+
"aria-labelledby": `${labelId} ${triggerValueId}`,
|
|
787
|
+
"aria-activedescendant": open && enabledIndexes.length > 0 ? optionId(activeIndex) : void 0,
|
|
788
|
+
onClick: () => open ? close(false) : openList(),
|
|
789
|
+
onKeyDown: handleTriggerKeyDown,
|
|
790
|
+
children: [
|
|
791
|
+
selected?.icon && /* @__PURE__ */ jsx(Icon, {
|
|
792
|
+
name: selected.icon,
|
|
793
|
+
className: "sua-dropdown__trigger-icon"
|
|
794
|
+
}),
|
|
795
|
+
/* @__PURE__ */ jsx("span", {
|
|
796
|
+
className: "sua-dropdown__trigger-value",
|
|
797
|
+
id: triggerValueId,
|
|
798
|
+
children: selected?.label ?? placeholder
|
|
799
|
+
}),
|
|
800
|
+
/* @__PURE__ */ jsx("span", {
|
|
801
|
+
className: "sua-dropdown__caret",
|
|
802
|
+
"aria-hidden": "true"
|
|
803
|
+
})
|
|
804
|
+
]
|
|
805
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
806
|
+
id: listId,
|
|
807
|
+
role: "listbox",
|
|
808
|
+
"aria-labelledby": labelId,
|
|
809
|
+
className: "sua-dropdown__list",
|
|
810
|
+
"data-align": align,
|
|
811
|
+
hidden: !open,
|
|
812
|
+
children: options.map((option, index) => /* @__PURE__ */ jsxs("li", {
|
|
813
|
+
id: optionId(index),
|
|
814
|
+
role: "option",
|
|
815
|
+
"aria-selected": index === selectedIndex,
|
|
816
|
+
"aria-disabled": option.disabled || void 0,
|
|
817
|
+
className: cx("sua-dropdown__option", index === activeIndex && open && "sua-dropdown__option--active", option.disabled && "sua-dropdown__option--disabled"),
|
|
818
|
+
onClick: (event) => handleOptionClick(event, index),
|
|
819
|
+
onMouseEnter: () => {
|
|
820
|
+
if (!option.disabled) setActiveIndex(index);
|
|
821
|
+
},
|
|
822
|
+
children: [
|
|
823
|
+
option.icon && /* @__PURE__ */ jsx(Icon, {
|
|
824
|
+
name: option.icon,
|
|
825
|
+
className: "sua-dropdown__option-icon"
|
|
826
|
+
}),
|
|
827
|
+
/* @__PURE__ */ jsx("span", {
|
|
828
|
+
className: "sua-dropdown__option-label",
|
|
829
|
+
children: option.label
|
|
830
|
+
}),
|
|
831
|
+
index === selectedIndex && /* @__PURE__ */ jsx("span", {
|
|
832
|
+
className: "sua-dropdown__option-check",
|
|
833
|
+
"aria-hidden": "true",
|
|
834
|
+
children: "✓"
|
|
835
|
+
})
|
|
836
|
+
]
|
|
837
|
+
}, option.value))
|
|
838
|
+
})]
|
|
839
|
+
})
|
|
840
|
+
]
|
|
841
|
+
});
|
|
842
|
+
}
|
|
540
843
|
// src/components/SiteHeader/SiteHeader.tsx
|
|
844
|
+
var themeOptions = [
|
|
845
|
+
{
|
|
846
|
+
value: "light",
|
|
847
|
+
label: "Light",
|
|
848
|
+
icon: "sun-light"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
value: "dark",
|
|
852
|
+
label: "Dark",
|
|
853
|
+
icon: "half-moon"
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
value: "system",
|
|
857
|
+
label: "System",
|
|
858
|
+
icon: "computer"
|
|
859
|
+
}
|
|
860
|
+
];
|
|
541
861
|
function isWide(element) {
|
|
542
862
|
return element !== null && window.getComputedStyle(element).getPropertyValue("--sua-header-wide").trim() === "1";
|
|
543
863
|
}
|
|
@@ -660,26 +980,13 @@ function SiteHeader({ brand, items, currentKey, navigationLabel = "Primary", men
|
|
|
660
980
|
})
|
|
661
981
|
]
|
|
662
982
|
}),
|
|
663
|
-
themeSelector && /* @__PURE__ */
|
|
983
|
+
themeSelector && /* @__PURE__ */ jsx(Dropdown, {
|
|
664
984
|
className: "sua-site-header__theme",
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
value: "light",
|
|
671
|
-
children: "Light"
|
|
672
|
-
}),
|
|
673
|
-
/* @__PURE__ */ jsx("option", {
|
|
674
|
-
value: "dark",
|
|
675
|
-
children: "Dark"
|
|
676
|
-
}),
|
|
677
|
-
/* @__PURE__ */ jsx("option", {
|
|
678
|
-
value: "system",
|
|
679
|
-
children: "System"
|
|
680
|
-
})
|
|
681
|
-
]
|
|
682
|
-
})]
|
|
985
|
+
label: themeSelector.label ?? "Theme",
|
|
986
|
+
value: themeSelector.value,
|
|
987
|
+
options: themeOptions,
|
|
988
|
+
align: "end",
|
|
989
|
+
onChange: (value) => themeSelector.onChange(value)
|
|
683
990
|
}),
|
|
684
991
|
hasLinks && /* @__PURE__ */ jsx(Button, {
|
|
685
992
|
ref: toggleRef,
|
|
@@ -1347,6 +1654,6 @@ function ArticleTemplate({ header, article, content, leadFigure, signOff, footer
|
|
|
1347
1654
|
]
|
|
1348
1655
|
});
|
|
1349
1656
|
}
|
|
1350
|
-
export { ArticleBody, ArticleScrollRegion, ArticleSummaryCard, ArticleTemplate, Badge, Badge as Tag, Surface as Box, Surface, Button, CodeBlock, Container, Figure, FormField, Grid, GridItem, Heading, Icon, Label, MetadataRow, NavLinkGroup, PortfolioIndexTemplate, ProjectShowcaseCard, ReaderSupport, ScrollTrack, SiteHeader, Stack, Text, TextInput, TextLink };
|
|
1657
|
+
export { ArticleBody, ArticleScrollRegion, ArticleSummaryCard, ArticleTemplate, Badge, Badge as Tag, Surface as Box, Surface, Button, CodeBlock, Container, Dropdown, Figure, FormField, Grid, GridItem, Heading, Icon, Label, MetadataRow, NavLinkGroup, PortfolioIndexTemplate, ProjectShowcaseCard, ReaderSupport, ScrollTrack, SiteHeader, Stack, Text, TextInput, TextLink };
|
|
1351
1658
|
|
|
1352
1659
|
//# sourceMappingURL=index.js.map
|