diff --git a/react-checkout/e2e/checks.ts b/react-checkout/e2e/checks.ts index fa43341..3d9e352 100644 --- a/react-checkout/e2e/checks.ts +++ b/react-checkout/e2e/checks.ts @@ -41,7 +41,7 @@ export async function expectStatusLineWhole(page: Page, message?: string) { const items = { mode: '.ws-status-line__mode', keys: '.ws-status-line__switch', - theme: '.status-line__theme', + theme: '.ws-status-line__theme', } const cut = Object.entries(items).flatMap(([name, selector]) => { const shown = [...line.querySelectorAll(selector)].filter((element) => diff --git a/react-checkout/package.json b/react-checkout/package.json index de71bbf..ba7efd0 100644 --- a/react-checkout/package.json +++ b/react-checkout/package.json @@ -17,7 +17,7 @@ "@formisch/react": "^1.2.0", "@hono/node-server": "^2.1.7", "@valibot/i18n": "^1.3.0", - "@whatsaaaa/design-system": "^0.1.1", + "@whatsaaaa/design-system": "^0.6.1", "@whatsaaaa/form-builder-affects": "0.2.2-rc.0", "@whatsaaaa/form-builder-react": "1.0.0-rc.0", "@whatsaaaa/form-builder-schema": "1.0.0-rc.0", diff --git a/react-checkout/pnpm-lock.yaml b/react-checkout/pnpm-lock.yaml index 70dc7c4..14484ce 100644 --- a/react-checkout/pnpm-lock.yaml +++ b/react-checkout/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: ^1.3.0 version: 1.3.0(valibot@1.5.0(typescript@7.0.2)) '@whatsaaaa/design-system': - specifier: ^0.1.1 - version: 0.1.1 + specifier: ^0.6.1 + version: 0.6.1 '@whatsaaaa/form-builder-affects': specifier: 0.2.2-rc.0 version: 0.2.2-rc.0(@whatsaaaa/form-builder-schema@1.0.0-rc.0(valibot@1.5.0(typescript@7.0.2)))(valibot@1.5.0(typescript@7.0.2)) @@ -741,13 +741,16 @@ packages: '@vitest/spy@5.1.0': resolution: {integrity: sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==} - '@whatsaaaa/design-system@0.1.1': - resolution: {integrity: sha512-1LWR3jvIYdLxcRUH/FvvCbRxgLfEILU0mP/fMq5S6i3daEYM6jzIt0NtWRHAsvz9bKAhA+UihNenNVZGOyfq4g==} + '@whatsaaaa/design-system@0.6.1': + resolution: {integrity: sha512-Cnf6DJXhR/lq0hHCtgbwTBEYimvgbnZWh/O0mrsGA0ScUM+YHsTWxu58+dMVugFobvwSgvizT7E3ne7TdFlZvA==} engines: {node: ^22.18.0 || >=24.12.0} peerDependencies: + tailwindcss: ^4.3.5 vitepress: ^1.6.4 vue: ^3.5.0 peerDependenciesMeta: + tailwindcss: + optional: true vitepress: optional: true vue: @@ -1675,7 +1678,7 @@ snapshots: '@vitest/spy@5.1.0': {} - '@whatsaaaa/design-system@0.1.1': + '@whatsaaaa/design-system@0.6.1': dependencies: '@terrazzo/token-types': 2.10.0 diff --git a/react-checkout/pnpm-workspace.yaml b/react-checkout/pnpm-workspace.yaml index 754a81c..7ebc1d5 100644 --- a/react-checkout/pnpm-workspace.yaml +++ b/react-checkout/pnpm-workspace.yaml @@ -4,4 +4,4 @@ minimumReleaseAgeExclude: - '@whatsaaaa/form-builder-schema@1.0.0-rc.0' - '@whatsaaaa/form-builder-react@1.0.0-rc.0' - '@whatsaaaa/form-builder-affects@0.2.2-rc.0' - - '@whatsaaaa/design-system@0.1.1' + - '@whatsaaaa/design-system@0.6.1' diff --git a/react-checkout/src/styles.css b/react-checkout/src/styles.css index 71bf66d..864c39d 100644 --- a/react-checkout/src/styles.css +++ b/react-checkout/src/styles.css @@ -13,10 +13,6 @@ * form line up with the brand on the left and with the links on the right. */ --page-gutter: var(--ws-space-20); - /* The height of a one-line field and of a button. */ - --control-height: var(--ws-space-40); - /* A tick, drawn as a mask like the design system's icons: only its shape counts. It fills its box. */ - --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 12 12' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5 6.5 12 13 4.5'/%3E%3C/svg%3E"); } @media (width < 64rem) { @@ -25,18 +21,6 @@ } } -.visually-hidden { - position: absolute; - width: 1px; - height: 1px; - margin: -1px; - padding: 0; - overflow: hidden; - clip-path: inset(50%); - white-space: nowrap; - border: 0; -} - /* The window: as tall as the screen, as wide as the form. Its content scrolls inside it. */ body { @@ -84,8 +68,8 @@ body { /* * The mark at 32 px, two screen pixels to a sprite pixel. Its file keeps two empty sprite columns - * on each side, so it reaches past its box by them: its pixels start where the form does, and - * they stand off the name by the bar's own gap. + * on each side, so, as the design system's guide says, it is pulled out by them: its pixels start + * where the form does, and they stand off the name by the bar's own gap. */ .tab-bar__mark { width: var(--ws-space-32); @@ -93,88 +77,6 @@ body { margin-inline: calc(-1 * var(--ws-space-4)); } -/* - * The cut of the mark for the page's theme. The same rule as the design system's for the name of - * the theme in the status line: an image has no token to switch. - */ -[data-theme='dark'] .tab-bar__mark--light, -[data-theme='light'] .tab-bar__mark--dark { - display: none; -} - -@media (prefers-color-scheme: light) { - :root:not([data-theme]) .tab-bar__mark--dark { - display: none; - } -} - -@media not (prefers-color-scheme: light) { - :root:not([data-theme]) .tab-bar__mark--light { - display: none; - } -} - -/* The ghost keeps its body in the text color, as everywhere. */ -.ws-tab-bar__end .tab-bar__ghost { - color: var(--ws-color-text); - line-height: 0; -} - -/* Status line */ - -/* - * The path is what gives way on a narrow screen, so the switches after it always fit. Its box - * takes the room left in the line, as the spacer would: the path shrinks to its ellipsis in it, - * and goes as a whole once "~…" no longer fits inside its padding. The padding is the path's own - * --ws-space-14 on each side, as a container query takes no var(). - */ -.status-line__path { - display: flex; - flex: 1; - container-type: inline-size; -} - -@container (width < calc(2ch + 2 * 0.875rem)) { - .ws-status-line__file { - display: none; - } -} - -.status-line__theme { - margin: 0; - border-block: 0; - border-right: 0; - color: inherit; - font: inherit; - cursor: pointer; - background: none; -} - -.status-line__theme:hover { - color: var(--ws-color-text); -} - -/* - * The focus ring of a control in the status line goes inside it, as the keys switch's does: the - * line cuts off what reaches past its edges. A key hint gets room for the ring from the gap - * around it, so nothing moves. - */ -.ws-status-line__keys :is(button, a) { - margin-inline: calc(-1 * var(--ws-space-6)); - padding-inline: var(--ws-space-6); -} - -.ws-status-line__keys :is(button, a):focus-visible, -.status-line__theme:focus-visible { - outline-offset: calc(-1 * var(--ws-border-width-medium)); -} - -/* The theme's name is the last item, in the window's corner: its ring follows that curve. */ -.status-line__theme:focus-visible { - border-radius: var(--ws-radius-sm) var(--ws-radius-sm) - calc(var(--ws-radius-xl) - var(--ws-border-width-thin)) var(--ws-radius-sm); -} - /* Page header: the title and its lead, with the switch between languages beside the title. */ .page__header { @@ -196,7 +98,6 @@ body { } .language { - display: flex; grid-row: 1; grid-column: 2; align-self: center; @@ -221,53 +122,6 @@ body { } } -/* Language switch: two buttons that share an edge. The pressed one is filled, like a checked radio. */ - -.language__button { - min-height: var(--control-height); - margin: 0; - padding: 0 var(--ws-space-16); - border: var(--ws-border-width-thin) solid var(--ws-color-field-border); - color: var(--ws-color-text-secondary); - font: var(--ws-text-label); - font-weight: var(--ws-font-weight-semibold); - cursor: pointer; - background: none; -} - -.language__button:first-child { - border-radius: var(--ws-radius-md) 0 0 var(--ws-radius-md); -} - -.language__button:last-child { - border-radius: 0 var(--ws-radius-md) var(--ws-radius-md) 0; -} - -/* The shared edge is one line: the pressed or hovered button draws it, on top of the other. */ -.language__button + .language__button { - margin-left: calc(-1 * var(--ws-border-width-thin)); -} - -.language__button:hover { - position: relative; - border-color: var(--ws-color-text-secondary); - color: var(--ws-color-text); - background: var(--ws-color-raised); -} - -.language__button[aria-pressed='true'] { - position: relative; - border-color: var(--ws-color-interactive); - color: var(--ws-color-on-interactive); - cursor: default; - background: var(--ws-color-interactive); -} - -.language__button:focus-visible { - position: relative; - z-index: 1; -} - /* The line the page shows while the checkout loads. */ .status-message { color: var(--ws-color-text-secondary); @@ -374,7 +228,7 @@ body { display: block; width: 100%; min-width: 0; - height: var(--control-height); + height: var(--ws-size-control); padding: 0 var(--ws-space-12); border: var(--ws-border-width-thin) solid var(--ws-color-field-border); border-radius: var(--ws-radius-md); @@ -389,23 +243,9 @@ body { border-color: var(--ws-color-text-secondary); } -/* - * A number is typed, and stepped with the arrow keys. The browser's own spin buttons have no look - * of the system's, so they go. - */ -.input[type='number'] { - appearance: textfield; -} - -.input::-webkit-inner-spin-button, -.input::-webkit-outer-spin-button { - margin: 0; - appearance: none; -} - .input--multiline { height: auto; - min-height: var(--control-height); + min-height: var(--ws-size-control); padding-block: var(--ws-space-8); resize: vertical; } @@ -468,8 +308,8 @@ body { display: grid; flex: none; place-content: center; - width: var(--ws-space-20); - height: var(--ws-space-20); + width: var(--ws-size-check); + height: var(--ws-size-check); margin: var(--ws-space-2) 0 0; border: var(--ws-border-width-thin) solid var(--ws-color-field-border); border-radius: var(--ws-radius-xs); @@ -483,11 +323,11 @@ body { } .choice__input::before { - width: var(--ws-space-12); - height: var(--ws-space-12); + width: 1rem; + height: 1rem; content: ''; background: var(--ws-color-on-interactive); - mask: var(--icon-check) center / contain no-repeat; + mask: var(--ws-icon-check) center / contain no-repeat; scale: 0; } @@ -633,7 +473,7 @@ body { display: inline-flex; align-items: center; justify-content: center; - min-height: var(--control-height); + min-height: var(--ws-size-control); margin: 0; padding: 0 var(--ws-space-20); border: var(--ws-border-width-thin) solid var(--ws-color-field-border); @@ -656,16 +496,14 @@ body { background: var(--ws-color-interactive); } -/* The system has no hover color for the interactive fill: a touch of the text color lifts it. */ .button--primary:enabled:hover { - --hover: color-mix( - in oklab, - var(--ws-color-interactive) 85%, - var(--ws-color-text) - ); + border-color: var(--ws-color-interactive-hover); + background: var(--ws-color-interactive-hover); +} - border-color: var(--hover); - background: var(--hover); +.button--primary:enabled:active { + border-color: var(--ws-color-interactive-active); + background: var(--ws-color-interactive-active); } .button--wide { @@ -686,42 +524,6 @@ body { text-decoration-thickness: var(--ws-border-width-medium); } -/* Summary: what the order costs, a line each, its amounts on the right. */ - -.summary { - border-top: var(--ws-border-width-thin) dashed var(--ws-color-border); -} - -/* A term in the voice of a label, its amount in the face of a field, on one baseline. */ -.summary__row { - display: grid; - grid-template-columns: minmax(0, 1fr) auto; - align-items: baseline; - gap: var(--ws-space-16); - padding-block: var(--ws-space-8); - border-bottom: var(--ws-border-width-thin) dashed var(--ws-color-border); -} - -.summary__term { - color: var(--ws-color-text-secondary); - font: var(--ws-text-label); - overflow-wrap: anywhere; -} - -.summary__value { - font-variant-numeric: tabular-nums; - text-align: right; -} - -.summary__row--total .summary__term { - color: var(--ws-color-text); - font-weight: var(--ws-font-weight-semibold); -} - -.summary__row--total .summary__value { - font-weight: var(--ws-font-weight-semibold); -} - /* Notices */ .notice { @@ -757,7 +559,7 @@ body { height: 1lh; content: ''; background: var(--ws-color-tip); - mask: var(--icon-check) center / var(--ws-space-16) no-repeat; + mask: var(--ws-icon-check) center / var(--ws-space-16) no-repeat; } .notice--error { @@ -789,21 +591,6 @@ body { margin: 0; } -/* - * The order can hold long text a person typed. Its line wraps inside the block, and the rest of - * it starts one level in from the line's own text, so the shape of the JSON still reads. - */ -.code { - white-space: pre-wrap; - overflow-wrap: anywhere; -} - -.code__line { - display: block; - padding-left: calc(var(--hang) * 1ch); - text-indent: calc(var(--hang) * -1ch); -} - @media (width < 64rem) { .notice__title { font: var(--ws-text-h2-compact); @@ -813,28 +600,17 @@ body { /* * In forced colors the browser paints every background in the page's own color, and with it the - * marks drawn as a mask on one. Here they take the system's colors: a checked box and the pressed - * language as a selection, every other mark in the color of the text it stands with. + * marks drawn as a mask on one. Here they take the system's colors: a checked box as a selection, + * every other mark in the color of the text it stands with. The design system does the same for + * the pressed language. */ @media (forced-colors: active) { - .choice__input:checked, - .language__button[aria-pressed='true'] { + .choice__input:checked { border-color: Highlight; color: HighlightText; background: Highlight; } - /* - * The browser puts a plate of the page's color behind text, and the system's text on a - * selection is often that same color. The pressed language's colors are the system's already, - * so it keeps them as they are, and its name shows on the selection itself. Its focus ring - * takes the system's color the browser gives every other one. - */ - .language__button[aria-pressed='true'] { - outline-color: Highlight; - forced-color-adjust: none; - } - .choice__input:checked::before { background: HighlightText; } diff --git a/react-checkout/src/ui/CodeBlock.tsx b/react-checkout/src/ui/CodeBlock.tsx index cb30809..2aed880 100644 --- a/react-checkout/src/ui/CodeBlock.tsx +++ b/react-checkout/src/ui/CodeBlock.tsx @@ -1,4 +1,5 @@ import { + Fragment, useEffect, useMemo, useState, @@ -59,28 +60,30 @@ export function CodeBlock({ code, file, ...props }: CodeBlockProps) { }), [code, highlight], ) + // What a person typed can be long, so the block wraps its lines instead of scrolling. return ( -
+
{file} json
{/* A line break ends each line but the last: the text of the block is the code as given. */} -
+      
         
           {lines.map((line, index) => (
-            
-              {line.tokens.map((token, column) => (
-                
-                  {token.content}
-                
-              ))}
+            
+              
+                {line.tokens.map((token, column) => (
+                  
+                    {token.content}
+                  
+                ))}
+              
               {index < lines.length - 1 ? '\n' : ''}
-            
+            
           ))}
         
       
diff --git a/react-checkout/src/ui/LanguageSwitch.tsx b/react-checkout/src/ui/LanguageSwitch.tsx index 3a99e72..be8c017 100644 --- a/react-checkout/src/ui/LanguageSwitch.tsx +++ b/react-checkout/src/ui/LanguageSwitch.tsx @@ -9,12 +9,15 @@ export function LanguageSwitch({ }) { const { locale, t } = useLocale() return ( -
+
{locales.map((each) => ( {/* The name of the theme, which also switches it: the hints above are hidden on a narrow - screen, and this is not. Both names are in the page and the styles show the theme's one. + screen, and this is not. Both names are in the button and the styles show the theme's + one, so it keeps the focus when the theme changes. */} - - + ) } - -function ThemeName({ theme, name }: { theme: 'dark' | 'light'; name: string }) { - return ( - - ) -} diff --git a/react-checkout/src/ui/TabBar.tsx b/react-checkout/src/ui/TabBar.tsx index 5e54360..5a7d55c 100644 --- a/react-checkout/src/ui/TabBar.tsx +++ b/react-checkout/src/ui/TabBar.tsx @@ -1,25 +1,23 @@ -import { ghostSvg } from '@whatsaaaa/design-system/ghost' +import ghostOnDark from './assets/ghost-on-dark.svg' +import ghostOnLight from './assets/ghost-on-light.svg' import markOnDark from './assets/mark-on-dark.svg' import markOnLight from './assets/mark-on-light.svg' -// The ghost as a picture, for a link: on a project's page it links to the handle's site. -const ghost = { __html: ghostSvg({ px: 2 }) } - /** The top of the window: form-builder's mark and name, its docs, and the ghost. */ export function TabBar() { return (
- {/* The kit has a cut of the mark for each theme. The stylesheet shows the page's one. */} + {/* The kit has a cut of the mark for each theme. The styles show the page's one. */} docs - {/* Markup built by the design system's ghost module. */} - + {/* On a project's page the ghost links to the handle's site. A cut for each theme, too. */} + + + +
) diff --git a/react-checkout/src/ui/assets/ghost-on-dark.svg b/react-checkout/src/ui/assets/ghost-on-dark.svg new file mode 100644 index 0000000..9e4a638 --- /dev/null +++ b/react-checkout/src/ui/assets/ghost-on-dark.svg @@ -0,0 +1 @@ +whatsaaaa ghost diff --git a/react-checkout/src/ui/assets/ghost-on-light.svg b/react-checkout/src/ui/assets/ghost-on-light.svg new file mode 100644 index 0000000..0bf901d --- /dev/null +++ b/react-checkout/src/ui/assets/ghost-on-light.svg @@ -0,0 +1 @@ +whatsaaaa ghost diff --git a/vue-event-registration/e2e/registration.spec.ts b/vue-event-registration/e2e/registration.spec.ts index 3b7dd4f..7440341 100644 --- a/vue-event-registration/e2e/registration.spec.ts +++ b/vue-event-registration/e2e/registration.spec.ts @@ -1,4 +1,4 @@ -import { expect, test, type Page } from '@playwright/test' +import { expect, test, type Locator, type Page } from '@playwright/test' /** The label of the current step, from the step indicator. */ function currentStep(page: Page) { @@ -36,6 +36,27 @@ async function expectNoSidewaysScroll(page: Page) { } } +/** The text of each line an element's text is drawn on, from the top. */ +function linesOf(element: Locator) { + return element.evaluate((element) => { + const lines: { top: number; text: string }[] = [] + const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT) + const range = document.createRange() + for (let node = walker.nextNode(); node; node = walker.nextNode()) { + const text = node.textContent ?? '' + for (let index = 0; index < text.length; index++) { + range.setStart(node, index) + range.setEnd(node, index + 1) + const { top } = range.getBoundingClientRect() + const line = lines.find((each) => Math.abs(each.top - top) < 1) + if (line) line.text += text[index] + else lines.push({ top, text: text[index] }) + } + } + return lines.map((line) => line.text) + }) +} + async function fillAboutYou( page: Page, ticket: 'Standard' | 'Student' | 'Business', @@ -46,6 +67,35 @@ async function fillAboutYou( await page.getByRole('radio', { name: new RegExp(`^${ticket}`) }).check() } +/** Registers a standard attendee for the keynote, with nothing more than it needs. */ +async function registerStandard(page: Page) { + await fillAboutYou(page, 'Standard') + await next(page) + await page.getByRole('checkbox', { name: 'Opening keynote' }).check() + await next(page) + await next(page) + await page + .getByRole('checkbox', { name: 'I accept the code of conduct' }) + .check() + await page.getByRole('button', { name: 'Register' }).click() + await expect( + page.getByRole('heading', { name: "You're registered" }), + ).toBeVisible() +} + +/** The colors the registration on show is drawn in: one for plain text, more once highlighted. */ +function outputColors(page: Page) { + return page + .getByTestId('output') + .evaluate((element) => [ + ...new Set( + [element, ...element.querySelectorAll('span')].map( + (span) => getComputedStyle(span).color, + ), + ), + ]) +} + test.beforeEach(async ({ page }) => { await page.goto('/') }) @@ -174,6 +224,53 @@ test('registers a business attendee with guests, step by step', async ({ await expectNoSidewaysScroll(page) }) +test('shows the registration as plain text until its highlighter loads, then in color', async ({ + page, +}) => { + // The highlighter waits on its way, so the registration shows before it is there. + let load: () => void = () => undefined + const held = new Promise((resolve) => { + load = resolve + }) + await page.route('**/assets/highlight-*.js', async (route) => { + await held + await route.continue() + }) + await page.reload({ waitUntil: 'domcontentloaded' }) + await registerStandard(page) + + const output = page.getByTestId('output') + expect(JSON.parse((await output.textContent()) ?? '')).toMatchObject({ + email: 'marko@example.com', + }) + expect(await outputColors(page)).toHaveLength(1) + + load() + await expect + .poll(async () => (await outputColors(page)).length) + .toBeGreaterThan(1) + expect(JSON.parse((await output.textContent()) ?? '')).toMatchObject({ + email: 'marko@example.com', + }) +}) + +test('shows the registration as plain text when its highlighter does not load', async ({ + page, +}) => { + const errors: Error[] = [] + page.on('pageerror', (error) => errors.push(error)) + await page.route('**/assets/highlight-*.js', (route) => route.abort()) + await page.reload() + await registerStandard(page) + + expect( + JSON.parse((await page.getByTestId('output').textContent()) ?? ''), + ).toMatchObject({ email: 'marko@example.com' }) + // Every piece of the registration is in the block's own text color. + expect(await outputColors(page)).toHaveLength(1) + expect(errors).toEqual([]) +}) + test('keeps the user on a step until its fields are valid', async ({ page, }) => { @@ -387,6 +484,18 @@ for (const width of [320, 390]) { await next(page) await expect(currentStep(page)).toHaveText(/Confirm/) + // A long email breaks after its "@" when it has to, not in the middle of a word. + const email = page + .locator('.summary dl > div', { + has: page.getByText('Email', { exact: true }), + }) + .locator('dd') + const lines = await linesOf(email) + expect(lines, 'the email breaks in the middle of a word').toEqual( + lines.length === 1 + ? ['marko@example.com'] + : ['marko@', 'example.com'], + ) await page.getByRole('button', { name: 'Register' }).click() await expect( page.getByText('Please accept the code of conduct'), diff --git a/vue-event-registration/package.json b/vue-event-registration/package.json index 970c1dc..ad06806 100644 --- a/vue-event-registration/package.json +++ b/vue-event-registration/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@formisch/vue": "^1.2.0", - "@whatsaaaa/design-system": "^0.1.0", + "@whatsaaaa/design-system": "^0.6.1", "@whatsaaaa/form-builder-affects": "0.2.2-rc.0", "@whatsaaaa/form-builder-schema": "1.0.0-rc.0", "@whatsaaaa/form-builder-vue": "1.0.0-rc.0", diff --git a/vue-event-registration/pnpm-lock.yaml b/vue-event-registration/pnpm-lock.yaml index 56ba163..055e8dc 100644 --- a/vue-event-registration/pnpm-lock.yaml +++ b/vue-event-registration/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^1.2.0 version: 1.2.0(typescript@6.0.3)(valibot@1.5.0(typescript@6.0.3))(vue@3.5.45(typescript@6.0.3)) '@whatsaaaa/design-system': - specifier: ^0.1.0 - version: 0.1.0(vue@3.5.45(typescript@6.0.3)) + specifier: ^0.6.1 + version: 0.6.1(vue@3.5.45(typescript@6.0.3)) '@whatsaaaa/form-builder-affects': specifier: 0.2.2-rc.0 version: 0.2.2-rc.0(@whatsaaaa/form-builder-schema@1.0.0-rc.0(valibot@1.5.0(typescript@6.0.3)))(valibot@1.5.0(typescript@6.0.3)) @@ -530,13 +530,16 @@ packages: vue: optional: true - '@whatsaaaa/design-system@0.1.0': - resolution: {integrity: sha512-ZqYSDsLeRRSZAkS4zpva5TFUeq/zaMNJQ8hDcwlOYTzN6uHyrjCYJrIJUBDLHRugGK12gs0I9HM7xlWcfdCE0w==} + '@whatsaaaa/design-system@0.6.1': + resolution: {integrity: sha512-Cnf6DJXhR/lq0hHCtgbwTBEYimvgbnZWh/O0mrsGA0ScUM+YHsTWxu58+dMVugFobvwSgvizT7E3ne7TdFlZvA==} engines: {node: ^22.18.0 || >=24.12.0} peerDependencies: + tailwindcss: ^4.3.5 vitepress: ^1.6.4 vue: ^3.5.0 peerDependenciesMeta: + tailwindcss: + optional: true vitepress: optional: true vue: @@ -1003,6 +1006,7 @@ packages: postcss-selector-parser@7.2.0: resolution: {integrity: sha512-Khh/tERVBn0I1499dvBSHY0pWJloMJWUxDsOBM0CCDPAcVZ10Jl2L1qy1f19uEX22spa8Mv7DCdEQJc0cGwBhQ==} engines: {node: '>=4'} + deprecated: Double-escapes CSS Modules class names (#362). Use 7.2.1. postcss@8.5.32: resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==} @@ -1756,7 +1760,7 @@ snapshots: typescript: 6.0.3 vue: 3.5.45(typescript@6.0.3) - '@whatsaaaa/design-system@0.1.0(vue@3.5.45(typescript@6.0.3))': + '@whatsaaaa/design-system@0.6.1(vue@3.5.45(typescript@6.0.3))': dependencies: '@terrazzo/token-types': 2.10.0 optionalDependencies: diff --git a/vue-event-registration/pnpm-workspace.yaml b/vue-event-registration/pnpm-workspace.yaml index 09f6534..4a9d06c 100644 --- a/vue-event-registration/pnpm-workspace.yaml +++ b/vue-event-registration/pnpm-workspace.yaml @@ -2,4 +2,4 @@ minimumReleaseAgeExclude: - '@whatsaaaa/form-builder-schema@1.0.0-rc.0' - '@whatsaaaa/form-builder-vue@1.0.0-rc.0' - '@whatsaaaa/form-builder-affects@0.2.2-rc.0' - - '@whatsaaaa/design-system@0.1.0' + - '@whatsaaaa/design-system@0.6.1' diff --git a/vue-event-registration/src/styles.css b/vue-event-registration/src/styles.css index 409ba14..a46a541 100644 --- a/vue-event-registration/src/styles.css +++ b/vue-event-registration/src/styles.css @@ -13,11 +13,7 @@ * form line up with the brand on the left and with the links on the right. */ --page-gutter: var(--ws-space-20); - /* The height of a one-line field and of a button. */ - --control-height: var(--ws-space-40); - /* A tick, drawn as a mask like the design system's icons: only its shape counts. It fills its box. */ - --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 12 12' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5 6.5 12 13 4.5'/%3E%3C/svg%3E"); - /* A calendar for the date picker's button, the same way. */ + /* A calendar for the date picker's button, drawn as a mask like the design system's icons. */ --icon-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='1.5 1.25 13 13' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='3.5' width='11' height='10' rx='1.5'/%3E%3Cpath d='M2.5 6.5h11M5.5 2v3M10.5 2v3'/%3E%3C/svg%3E"); } @@ -27,18 +23,6 @@ } } -.visually-hidden { - position: absolute; - width: 1px; - height: 1px; - margin: -1px; - padding: 0; - overflow: hidden; - clip-path: inset(50%); - white-space: nowrap; - border: 0; -} - /* The window: as tall as the screen, as wide as the form. Its content scrolls inside it. */ body { @@ -86,8 +70,8 @@ body { /* * The mark at 32 px, two screen pixels to a sprite pixel. Its file keeps two empty sprite columns - * on each side, so it reaches past its box by them: its pixels start where the form does, and - * they stand off the name by the bar's own gap. + * on each side, so, as the design system's guide says, it is pulled out by them: its pixels start + * where the form does, and they stand off the name by the bar's own gap. */ .tab-bar__mark { width: var(--ws-space-32); @@ -95,88 +79,6 @@ body { margin-inline: calc(-1 * var(--ws-space-4)); } -/* - * The cut of the mark for the page's theme. The same rule as the design system's for the name of - * the theme in the status line: an image has no token to switch. - */ -[data-theme='dark'] .tab-bar__mark--light, -[data-theme='light'] .tab-bar__mark--dark { - display: none; -} - -@media (prefers-color-scheme: light) { - :root:not([data-theme]) .tab-bar__mark--dark { - display: none; - } -} - -@media not (prefers-color-scheme: light) { - :root:not([data-theme]) .tab-bar__mark--light { - display: none; - } -} - -/* The ghost keeps its body in the text color, as everywhere. */ -.ws-tab-bar__end .tab-bar__ghost { - color: var(--ws-color-text); - line-height: 0; -} - -/* Status line */ - -/* - * The path is what gives way on a narrow screen, so the switches after it always fit. Its box - * takes the room left in the line, as the spacer would: the path shrinks to its ellipsis in it, - * and goes as a whole once "~…" no longer fits inside its padding. The padding is the path's own - * --ws-space-14 on each side, as a container query takes no var(). - */ -.status-line__path { - display: flex; - flex: 1; - container-type: inline-size; -} - -@container (width < calc(2ch + 2 * 0.875rem)) { - .ws-status-line__file { - display: none; - } -} - -.status-line__theme { - margin: 0; - border-block: 0; - border-right: 0; - color: inherit; - font: inherit; - cursor: pointer; - background: none; -} - -.status-line__theme:hover { - color: var(--ws-color-text); -} - -/* - * The focus ring of a control in the status line goes inside it, as the keys switch's does: the - * line cuts off what reaches past its edges. A key hint gets room for the ring from the gap - * around it, so nothing moves. - */ -.ws-status-line__keys :is(button, a) { - margin-inline: calc(-1 * var(--ws-space-6)); - padding-inline: var(--ws-space-6); -} - -.ws-status-line__keys :is(button, a):focus-visible, -.status-line__theme:focus-visible { - outline-offset: calc(-1 * var(--ws-border-width-medium)); -} - -/* The theme's name is the last item, in the window's corner: its ring follows that curve. */ -.status-line__theme:focus-visible { - border-radius: var(--ws-radius-sm) var(--ws-radius-sm) - calc(var(--ws-radius-xl) - var(--ws-border-width-thin)) var(--ws-radius-sm); -} - /* Page header */ .page__header { @@ -274,8 +176,8 @@ body { display: grid; flex: none; place-items: center; - width: var(--ws-space-24); - height: var(--ws-space-24); + width: var(--ws-size-step); + height: var(--ws-size-step); border: var(--ws-border-width-thin) solid var(--ws-color-field-border); border-radius: var(--ws-radius-full); font: var(--ws-text-label-sm); @@ -283,11 +185,11 @@ body { } .steps__item--done .steps__number::before { - width: var(--ws-space-12); - height: var(--ws-space-12); + width: 1rem; + height: 1rem; content: ''; background: currentColor; - mask: var(--icon-check) center / contain no-repeat; + mask: var(--ws-icon-check) center / contain no-repeat; } /* The current step is marked like the mode in the status line: a solid chip. */ @@ -351,7 +253,7 @@ body { display: block; width: 100%; min-width: 0; - height: var(--control-height); + height: var(--ws-size-control); padding: 0 var(--ws-space-12); border: var(--ws-border-width-thin) solid var(--ws-color-field-border); border-radius: var(--ws-radius-md); @@ -379,7 +281,7 @@ body { .input--multiline { height: auto; - min-height: var(--control-height); + min-height: var(--ws-size-control); padding-block: var(--ws-space-8); resize: vertical; } @@ -442,8 +344,8 @@ body { display: grid; flex: none; place-content: center; - width: var(--ws-space-20); - height: var(--ws-space-20); + width: var(--ws-size-check); + height: var(--ws-size-check); margin: var(--ws-space-2) 0 0; border: var(--ws-border-width-thin) solid var(--ws-color-field-border); border-radius: var(--ws-radius-xs); @@ -457,11 +359,11 @@ body { } .choice__input::before { - width: var(--ws-space-12); - height: var(--ws-space-12); + width: 1rem; + height: 1rem; content: ''; background: var(--ws-color-on-interactive); - mask: var(--icon-check) center / contain no-repeat; + mask: var(--ws-icon-check) center / contain no-repeat; scale: 0; } @@ -604,7 +506,7 @@ body { display: inline-flex; align-items: center; justify-content: center; - min-height: var(--control-height); + min-height: var(--ws-size-control); margin: 0; padding: 0 var(--ws-space-20); border: var(--ws-border-width-thin) solid var(--ws-color-field-border); @@ -627,16 +529,14 @@ body { background: var(--ws-color-interactive); } -/* The system has no hover color for the interactive fill: a touch of the text color lifts it. */ .button--primary:hover { - --hover: color-mix( - in oklab, - var(--ws-color-interactive) 85%, - var(--ws-color-text) - ); + border-color: var(--ws-color-interactive-hover); + background: var(--ws-color-interactive-hover); +} - border-color: var(--hover); - background: var(--hover); +.button--primary:active { + border-color: var(--ws-color-interactive-active); + background: var(--ws-color-interactive-active); } .button--quiet { @@ -669,29 +569,6 @@ body { text-transform: uppercase; } -.summary__rows { - border-top: var(--ws-border-width-thin) dashed var(--ws-color-border); -} - -/* A term in the voice of a label, its value in the face of a field, on one baseline. */ -.summary__row { - display: grid; - grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); - align-items: baseline; - gap: var(--ws-space-16); - padding-block: var(--ws-space-8); - border-bottom: var(--ws-border-width-thin) dashed var(--ws-color-border); -} - -.summary__term { - color: var(--ws-color-text-secondary); - font: var(--ws-text-label); -} - -.summary__value { - overflow-wrap: anywhere; -} - /* Notices */ .notice { @@ -715,7 +592,7 @@ body { height: 1lh; content: ''; background: var(--ws-color-tip); - mask: var(--icon-check) center / var(--ws-space-16) no-repeat; + mask: var(--ws-icon-check) center / var(--ws-space-16) no-repeat; } .notice--error { @@ -741,21 +618,6 @@ body { margin: 0; } -/* - * What a person typed can be long. Its line wraps inside the block, and the rest of it starts one - * level in from the line's own text, so the shape of the JSON still reads. - */ -.code { - white-space: pre-wrap; - overflow-wrap: anywhere; -} - -.code__line { - display: block; - padding-left: calc(var(--hang) * 1ch); - text-indent: calc(var(--hang) * -1ch); -} - @media (width < 64rem) { .notice__title { font: var(--ws-text-h2-compact); diff --git a/vue-event-registration/src/ui/CodeBlock.vue b/vue-event-registration/src/ui/CodeBlock.vue index 87c1fa3..d69749a 100644 --- a/vue-event-registration/src/ui/CodeBlock.vue +++ b/vue-event-registration/src/ui/CodeBlock.vue @@ -1,6 +1,27 @@ + + diff --git a/vue-event-registration/src/ui/StatusLine.vue b/vue-event-registration/src/ui/StatusLine.vue index 7de0e4a..faacbd0 100644 --- a/vue-event-registration/src/ui/StatusLine.vue +++ b/vue-event-registration/src/ui/StatusLine.vue @@ -31,7 +31,7 @@ onUnmounted(() => {
{{ mode }} - + ~/vue-event-registration @@ -61,23 +61,13 @@ onUnmounted(() => { - -
diff --git a/vue-event-registration/src/ui/StepIndicator.vue b/vue-event-registration/src/ui/StepIndicator.vue index bb44906..2f29222 100644 --- a/vue-event-registration/src/ui/StepIndicator.vue +++ b/vue-event-registration/src/ui/StepIndicator.vue @@ -32,7 +32,7 @@ defineEmits<{ goTo: [index: number] }>() index < current ? '' : index + 1 }} {{ label }} - (done) + (done) diff --git a/vue-event-registration/src/ui/SummaryList.vue b/vue-event-registration/src/ui/SummaryList.vue index d455c56..8c3237b 100644 --- a/vue-event-registration/src/ui/SummaryList.vue +++ b/vue-event-registration/src/ui/SummaryList.vue @@ -6,6 +6,11 @@ defineProps<{ rows: readonly { label: string; value: string }[] }[] }>() + +/** A value in pieces that end at an "@" or a "/": a long email or URL breaks there. */ +function piecesOf(value: string) { + return value.split(/(?<=[@/])/) +}