@krizaka/ui 3.68.0 → 3.70.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/README.md +1 -0
- package/dist/chunk-2FCQCWIK.js +86 -0
- package/dist/chunk-2FCQCWIK.js.map +1 -0
- package/dist/chunk-E4FMPPDL.js +134 -0
- package/dist/chunk-E4FMPPDL.js.map +1 -0
- package/dist/{chunk-E4X3V7QX.js → chunk-GRVIZTT2.js} +2 -2
- package/dist/chunk-S4TLZRGZ.js +42 -0
- package/dist/chunk-S4TLZRGZ.js.map +1 -0
- package/dist/{chunk-PFPOBIHL.js → chunk-T5NZSKWT.js} +15 -12
- package/dist/{chunk-PFPOBIHL.js.map → chunk-T5NZSKWT.js.map} +1 -1
- package/dist/confirm-button.js +5 -78
- package/dist/confirm-button.js.map +1 -1
- package/dist/data-table.js +3 -3
- package/dist/filter-bar.js +1 -1
- package/dist/genui.js +3 -3
- package/dist/lightbox-D5NAHFEA.js +95 -0
- package/dist/lightbox-D5NAHFEA.js.map +1 -0
- package/dist/map.d.ts +6 -6
- package/dist/match-dialog.js +17 -140
- package/dist/match-dialog.js.map +1 -1
- package/dist/nav-bar.js +3 -3
- package/dist/proposal.d.ts +81 -0
- package/dist/proposal.js +71 -0
- package/dist/proposal.js.map +1 -0
- package/dist/shop/booking.d.ts +22 -3
- package/dist/shop/booking.js +33 -1
- package/dist/shop/booking.js.map +1 -1
- package/dist/shop/map-gate.d.ts +1 -1
- package/dist/shop/map-gate.js +1 -1
- package/dist/shop/map-gate.js.map +1 -1
- package/dist/shop-composer.d.ts +1 -1
- package/dist/shop-composer.js +109 -85
- package/dist/shop-composer.js.map +1 -1
- package/dist/shop-gallery.d.ts +47 -0
- package/dist/shop-gallery.js +121 -0
- package/dist/shop-gallery.js.map +1 -0
- package/dist/shop.d.ts +1 -1
- package/dist/shop.js +1 -1
- package/dist/shop.js.map +1 -1
- package/dist/status-chip.js +16 -43
- package/dist/status-chip.js.map +1 -1
- package/dist/tag-selector.js +5 -5
- package/dist/tag-selector.js.map +1 -1
- package/package.json +33 -4
- package/registry/account-menu.json +1 -1
- package/registry/account-settings.json +1 -1
- package/registry/achievement.json +1 -1
- package/registry/action-bar.json +1 -1
- package/registry/activity-feed.json +1 -1
- package/registry/agenda.json +1 -1
- package/registry/alert.json +1 -1
- package/registry/analysis-report.json +1 -1
- package/registry/anatomy-plate.json +1 -1
- package/registry/app-frame.json +2 -2
- package/registry/app-header.json +1 -1
- package/registry/app-shell.json +1 -1
- package/registry/argument-card.json +1 -1
- package/registry/audio-player.json +1 -1
- package/registry/auth-layout.json +1 -1
- package/registry/avatar.json +1 -1
- package/registry/badge.json +1 -1
- package/registry/bird-plate.json +1 -1
- package/registry/button.json +1 -1
- package/registry/captcha.json +1 -1
- package/registry/card-grid.json +1 -1
- package/registry/card.json +1 -1
- package/registry/catalogue-page.json +1 -1
- package/registry/changelog-page.json +1 -1
- package/registry/chapter.json +1 -1
- package/registry/chat.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.json +1 -1
- package/registry/chip-row.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/choice-grid.json +1 -1
- package/registry/code-block.json +1 -1
- package/registry/collection-switcher.json +1 -1
- package/registry/combobox.json +1 -1
- package/registry/command.json +1 -1
- package/registry/comparison-table.json +1 -1
- package/registry/component-page.json +1 -1
- package/registry/confirm-button.json +1 -1
- package/registry/contact-page.json +1 -1
- package/registry/continue-prompt.json +1 -1
- package/registry/copy-button.json +1 -1
- package/registry/countdown.json +1 -1
- package/registry/cover-hero.json +1 -1
- package/registry/cta-panel.json +1 -1
- package/registry/dashboard-layout.json +1 -1
- package/registry/data-table.json +1 -1
- package/registry/date-picker.json +1 -1
- package/registry/decision-list.json +1 -1
- package/registry/description-list.json +1 -1
- package/registry/desktop-window.json +1 -1
- package/registry/detail-layout.json +1 -1
- package/registry/dialog.json +1 -1
- package/registry/docs-article-page.json +1 -1
- package/registry/docs-hub-page.json +1 -1
- package/registry/docs-layout.json +1 -1
- package/registry/docs-nav.json +1 -1
- package/registry/document-viewer.json +1 -1
- package/registry/doodle.json +1 -1
- package/registry/drop-overlay.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/elephant.json +2 -2
- package/registry/embed-facade.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/engine-flow.json +1 -1
- package/registry/entity-header.json +1 -1
- package/registry/environment-notice.json +1 -1
- package/registry/error-page.json +1 -1
- package/registry/examples/proposal/default.d.ts +4 -0
- package/registry/examples/proposal/default.js +30 -0
- package/registry/examples/proposal/default.tsx +24 -0
- package/registry/examples/shop/booking-closing-closed.d.ts +4 -0
- package/registry/examples/shop/booking-closing-closed.js +26 -0
- package/registry/examples/shop/booking-closing-closed.tsx +22 -0
- package/registry/examples/shop/booking-closing-mark.d.ts +4 -0
- package/registry/examples/shop/booking-closing-mark.js +13 -0
- package/registry/examples/shop/booking-closing-mark.tsx +12 -0
- package/registry/examples/shop/booking-closing.d.ts +4 -0
- package/registry/examples/shop/booking-closing.js +27 -0
- package/registry/examples/shop/booking-closing.tsx +23 -0
- package/registry/examples/shop-gallery/five.d.ts +4 -0
- package/registry/examples/shop-gallery/five.js +14 -0
- package/registry/examples/shop-gallery/five.tsx +10 -0
- package/registry/examples/shop-gallery/three.d.ts +4 -0
- package/registry/examples/shop-gallery/three.js +14 -0
- package/registry/examples/shop-gallery/three.tsx +10 -0
- package/registry/examples/shop-gallery/twelve.d.ts +4 -0
- package/registry/examples/shop-gallery/twelve.js +14 -0
- package/registry/examples/shop-gallery/twelve.tsx +10 -0
- package/registry/field.json +1 -1
- package/registry/file-upload.json +1 -1
- package/registry/filter-bar.json +2 -2
- package/registry/flock.json +1 -1
- package/registry/footnote.json +1 -1
- package/registry/force-update-screen.json +1 -1
- package/registry/form.json +1 -1
- package/registry/gallery-page.json +1 -1
- package/registry/genui.json +1 -1
- package/registry/glossary-term.json +1 -1
- package/registry/glossary.json +1 -1
- package/registry/glow-card.json +1 -1
- package/registry/goal-gauge.json +1 -1
- package/registry/grade-stamp.json +1 -1
- package/registry/how-it-works-page.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/index.json +76 -9
- package/registry/iso.json +1 -1
- package/registry/kanban.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/kind-config-editor.json +1 -1
- package/registry/kpi-explained.json +1 -1
- package/registry/landing-page.json +1 -1
- package/registry/landscape.json +1 -1
- package/registry/language-switch.json +1 -1
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +1 -1
- package/registry/list.json +1 -1
- package/registry/loader.json +1 -1
- package/registry/longform-page.json +1 -1
- package/registry/maintenance-screen.json +1 -1
- package/registry/map.json +2 -2
- package/registry/margin-layout.json +1 -1
- package/registry/markdown.json +1 -1
- package/registry/marketing-layout.json +1 -1
- package/registry/marquee.json +1 -1
- package/registry/mascot-quote.json +1 -1
- package/registry/mascot-state.json +1 -1
- package/registry/mascots.json +1 -1
- package/registry/match-dialog.json +1 -1
- package/registry/media-capture.json +1 -1
- package/registry/media-gallery.json +1 -1
- package/registry/media-grid.json +1 -1
- package/registry/meta-row.json +1 -1
- package/registry/meter.json +1 -1
- package/registry/money-input.json +1 -1
- package/registry/nav-bar.json +2 -2
- package/registry/next-actions.json +1 -1
- package/registry/notification-preferences.json +1 -1
- package/registry/number-ticker.json +1 -1
- package/registry/opening-hours.json +1 -1
- package/registry/page-header.json +1 -1
- package/registry/page-hero.json +1 -1
- package/registry/page-index.json +1 -1
- package/registry/page.json +1 -1
- package/registry/pagination.json +1 -1
- package/registry/photo-grid.json +1 -1
- package/registry/pointer-light.json +1 -1
- package/registry/popover.json +1 -1
- package/registry/pricing-page.json +1 -1
- package/registry/product-page.json +1 -1
- package/registry/profile-card.json +1 -1
- package/registry/progress.json +1 -1
- package/registry/promise-card.json +1 -1
- package/registry/promo-code-field.json +1 -1
- package/registry/proposal.json +353 -0
- package/registry/qr-code.json +1 -1
- package/registry/quota-meter.json +1 -1
- package/registry/radio-group.json +1 -1
- package/registry/rail-nav.json +2 -2
- package/registry/recipes.json +1 -1
- package/registry/retro-tv.json +1 -1
- package/registry/reviews.json +1 -1
- package/registry/router.json +1 -1
- package/registry/scroll-stage.json +1 -1
- package/registry/search-field.json +1 -1
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/service-card.json +1 -1
- package/registry/settings-layout.json +1 -1
- package/registry/shop-composer.json +1 -1
- package/registry/shop-gallery.json +209 -0
- package/registry/shop.json +31 -7
- package/registry/showcase.json +1 -1
- package/registry/signature.json +1 -1
- package/registry/site-cahier.json +1 -1
- package/registry/site-footer.json +2 -2
- package/registry/sites.json +1 -1
- package/registry/skeleton.json +1 -1
- package/registry/skip-link.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot-picker.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/specimen-tag.json +1 -1
- package/registry/speed-lines.json +1 -1
- package/registry/spinner.json +1 -1
- package/registry/split-view.json +1 -1
- package/registry/stage-banner.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/status-chip.json +1 -1
- package/registry/status-page.json +1 -1
- package/registry/step-progress.json +1 -1
- package/registry/step-showcase.json +1 -1
- package/registry/stepper.json +1 -1
- package/registry/sticky-action.json +1 -1
- package/registry/stuck.json +1 -1
- package/registry/swipe-deck.json +1 -1
- package/registry/switch.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/tag-input.json +1 -1
- package/registry/tag-selector.json +2 -2
- package/registry/taped-photo.json +1 -1
- package/registry/terminal-replay.json +1 -1
- package/registry/text-style.json +1 -1
- package/registry/theme.json +1 -1
- package/registry/toast.json +1 -1
- package/registry/toc.json +1 -1
- package/registry/tooltip.json +1 -1
- package/registry/tree-view.json +1 -1
- package/registry/update-prompt.json +1 -1
- package/registry/upload-queue.json +1 -1
- package/registry/usage.json +1 -1
- package/registry/verified-badge.json +1 -1
- package/registry/versus-card.json +1 -1
- package/registry/vertical-video.json +1 -1
- package/registry/video-player.json +1 -1
- package/registry/video-trimmer.json +1 -1
- package/registry/virtual.json +1 -1
- package/registry/wall.json +1 -1
- package/registry/waveform.json +1 -1
- /package/dist/{chunk-E4X3V7QX.js.map → chunk-GRVIZTT2.js.map} +0 -0
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
"files": [
|
|
221
221
|
{
|
|
222
222
|
"path": "meta.ts",
|
|
223
|
-
"content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which ui.krizaka.com (apps/site) renders as\n// ui.krizaka.com/components/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"notification-preferences\"\n | \"quota-meter\"\n | \"environment-notice\"\n | \"embed-facade\"\n | \"reviews\"\n | \"margin-layout\"\n | \"analysis-report\"\n | \"status-chip\"\n | \"kind-config-editor\"\n | \"agenda\"\n | \"account-settings\"\n | \"drop-overlay\"\n | \"upload-queue\"\n | \"achievement\"\n | \"anatomy-plate\"\n | \"bird-plate\"\n | \"taped-photo\"\n | \"stuck\"\n | \"doodle\"\n | \"signature\"\n | \"grade-stamp\"\n | \"versus-card\"\n | \"speed-lines\"\n | \"site-cahier\"\n | \"text-style\"\n | \"flock\"\n | \"elephant\"\n | \"footnote\"\n | \"page-index\"\n | \"chapter\"\n | \"specimen-tag\"\n | \"action-bar\"\n | \"action-sheet\"\n | \"activity-feed\"\n | \"alert\"\n | \"app-frame\"\n | \"desktop-window\"\n | \"form-flow\"\n | \"grid\"\n | \"list-detail\"\n | \"state-screen\"\n | \"app-header\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"captcha\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"chat\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"chip-row\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"comparison-table\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"copy-button\"\n | \"money-input\"\n | \"promo-code-field\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cover-hero\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"description-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"docs-nav\"\n | \"document-viewer\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"engine-flow\"\n | \"error-page\"\n | \"fab\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"force-update-screen\"\n | \"form\"\n | \"gallery-page\"\n | \"genui\"\n | \"glossary\"\n | \"glossary-term\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"header\"\n | \"how-it-works-page\"\n | \"image-cropper\"\n | \"image-viewer\"\n | \"iso\"\n | \"kanban\"\n | \"kbd\"\n | \"kpi-explained\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"longform-page\"\n | \"maintenance-screen\"\n | \"map\"\n | \"markdown\"\n | \"meta-row\"\n | \"waveform\"\n | \"qr-code\"\n | \"entity-header\"\n | \"collection-switcher\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\n | \"media-grid\"\n | \"language-switch\"\n | \"media-gallery\"\n | \"media-picker\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"onboarding\"\n | \"opening-hours\"\n | \"otp-input\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"permission-prompt\"\n | \"photo-grid\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"pull-to-refresh\"\n | \"retro-tv\"\n | \"radio-group\"\n | \"router\"\n | \"rail-nav\"\n | \"recipes\"\n | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"service-card\"\n | \"shop\"\n | \"shop-composer\"\n | \"settings-layout\"\n | \"account-menu\"\n | \"showcase\"\n | \"step-showcase\"\n | \"site-footer\"\n | \"sites\"\n | \"skeleton\"\n | \"skip-link\"\n | \"slider\"\n | \"slot-picker\"\n | \"slot\"\n | \"spinner\"\n | \"sticky-action\"\n | \"splash-handoff\"\n | \"split-view\"\n | \"stage-banner\"\n | \"stat\"\n | \"usage\"\n | \"status-page\"\n | \"step-progress\"\n | \"stepper\"\n | \"swipe-deck\"\n | \"swipeable-row\"\n | \"switch\"\n | \"tab-bar\"\n | \"tabs\"\n | \"tag-input\"\n | \"tag-selector\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"tree-view\"\n | \"txt\"\n | \"update-prompt\"\n | \"verified-badge\"\n | \"vertical-video\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\"\n | \"wall\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/**\n * Why a component is not on a platform — a decision, never a silence (the parity matrix of ui.krizaka.com/platforms):\n * - `gap` (✗): it belongs there and is not built yet; `issue` is the issue that tracks it (`krizaka/krizaka-ui#275`);\n * - `n/a`: it is not meant for that platform (a site's page block on a phone, a swipe on a desktop); `use` names the\n * component that answers there, when one does.\n */\nexport type Absence =\n | { readonly status: \"gap\"; readonly issue: string; readonly reason: string; readonly use?: undefined }\n | { readonly status: \"n/a\"; readonly reason: string; readonly use?: ComponentName; readonly issue?: undefined };\n\n/**\n * Desktop is the Orazaka Mac app (Tauri 2: the system WebView renders the web components — ADR-002). `web`: the web\n * component runs there as it is; `desktop`: it also has a desktop form (a window's title bar, a denser layout…), said in\n * its documentation; otherwise the absence and why.\n */\nexport type DesktopSupport = \"web\" | \"desktop\" | Absence;\n\n/**\n * The three platforms of Krizaka UI — web · native (React Native, Expo) · desktop — for one component. The side a\n * component has is `platforms`; the side it lacks says why here: `native` is required for (and only for) a web-only\n * component, `web` for a native-only one; `desktop` always. `scripts/registry.test.mjs` fails on a missing decision.\n */\nexport interface Parity {\n readonly web?: Absence;\n readonly native?: Absence;\n readonly desktop: DesktopSupport;\n}\n\n/**\n * `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: no product uses it and\n * no work plans to — it still works, says what replaces it, and goes in the major named by `deprecated.removedIn`.\n */\nexport type Status = \"stable\" | \"beta\" | \"deprecated\";\n\n/** What a deprecated component says (required when `status` is `deprecated`, absent otherwise). */\nexport interface Deprecation {\n /** The version that deprecated it (`3.6.0`). */\n readonly since: string;\n /** The major that removes it (`4.0.0`). */\n readonly removedIn: string;\n /** What replaces it, when a component does. */\n readonly use?: ComponentName;\n /** Why it goes: no product uses it, no planned work needs it. */\n readonly reason: string;\n}\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/** Why a reader needs a template: the seven intents the templates are grouped by (sidebar sub-headings, catalogue filter). */\nexport type TemplatePurpose = \"convince\" | \"explain\" | \"show\" | \"act\" | \"operate\" | \"converse\" | \"recover\";\n\n/** The groups of templates, in reading order: the title, and the one line that says when to come to that group. */\nexport const templatePurposes = {\n convince: { title: \"Convince\", useWhen: \"You come here when a visitor must decide: a landing, a product, a price, a comparison, a proof.\" },\n explain: { title: \"Explain\", useWhen: \"You come here when a reader must understand: how it works, a documentation hub or article, a changelog, a FAQ, a policy.\" },\n show: { title: \"Show\", useWhen: \"You come here when the work itself is the argument: a gallery, a story, a case study, an object and its details.\" },\n act: { title: \"Act\", useWhen: \"You come here when a person must do something once: reach the team, sign in or up, set up, pay.\" },\n operate: { title: \"Operate\", useWhen: \"You come here when a person works every day: a dashboard, a console with a table, settings, an app shell.\" },\n converse: { title: \"Converse\", useWhen: \"You come here when people talk: an inbox, a chat, comments, a notifications centre.\" },\n recover: { title: \"Recover\", useWhen: \"You come here when the way is blocked: an empty list, an error, a missing page, maintenance, a product still being built.\" },\n} as const satisfies Record<TemplatePurpose, { readonly title: string; readonly useWhen: string }>;\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\ninterface ExampleBase {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** A plain example, or a template: a whole screen with its intent (`purpose`) and the user goal its layout serves (`why`). */\nexport type Example =\n | (ExampleBase & { readonly template?: false; readonly purpose?: undefined; readonly why?: undefined })\n | (ExampleBase & {\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its\n * phone version thought out), copied as a starting point — at most 160 lines, listed on ui.krizaka.com/templates.\n */\n readonly template: true;\n /** The intent that groups it: why you need this block. */\n readonly purpose: TemplatePurpose;\n /** Why this layout: the user goal it serves, in one sentence. */\n readonly why: string;\n });\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n /** The React Native entry alone is deprecated while the web one stays (ADR-006 §7); a deprecated component says it once, above. */\n readonly deprecated?: Deprecation;\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n /** Required for, and only for, a `deprecated` component. */\n readonly deprecated?: Deprecation;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** The platforms it is not on, and why; and its desktop form (see `Parity`). */\n readonly parity: Parity;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
|
|
223
|
+
"content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which ui.krizaka.com (apps/site) renders as\n// ui.krizaka.com/components/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"notification-preferences\"\n | \"quota-meter\"\n | \"environment-notice\"\n | \"embed-facade\"\n | \"reviews\"\n | \"margin-layout\"\n | \"analysis-report\"\n | \"status-chip\"\n | \"kind-config-editor\"\n | \"agenda\"\n | \"account-settings\"\n | \"drop-overlay\"\n | \"upload-queue\"\n | \"achievement\"\n | \"anatomy-plate\"\n | \"bird-plate\"\n | \"taped-photo\"\n | \"stuck\"\n | \"doodle\"\n | \"signature\"\n | \"grade-stamp\"\n | \"versus-card\"\n | \"speed-lines\"\n | \"site-cahier\"\n | \"text-style\"\n | \"flock\"\n | \"elephant\"\n | \"footnote\"\n | \"page-index\"\n | \"chapter\"\n | \"specimen-tag\"\n | \"action-bar\"\n | \"action-sheet\"\n | \"activity-feed\"\n | \"alert\"\n | \"app-frame\"\n | \"desktop-window\"\n | \"form-flow\"\n | \"grid\"\n | \"list-detail\"\n | \"state-screen\"\n | \"app-header\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"captcha\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"chat\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"chip-row\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"comparison-table\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"copy-button\"\n | \"money-input\"\n | \"promo-code-field\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cover-hero\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"description-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"docs-nav\"\n | \"document-viewer\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"engine-flow\"\n | \"error-page\"\n | \"fab\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"force-update-screen\"\n | \"form\"\n | \"gallery-page\"\n | \"genui\"\n | \"glossary\"\n | \"glossary-term\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"header\"\n | \"how-it-works-page\"\n | \"image-cropper\"\n | \"image-viewer\"\n | \"iso\"\n | \"kanban\"\n | \"kbd\"\n | \"kpi-explained\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"longform-page\"\n | \"maintenance-screen\"\n | \"map\"\n | \"markdown\"\n | \"meta-row\"\n | \"waveform\"\n | \"proposal\"\n | \"qr-code\"\n | \"entity-header\"\n | \"collection-switcher\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\n | \"media-grid\"\n | \"language-switch\"\n | \"media-gallery\"\n | \"media-picker\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"onboarding\"\n | \"opening-hours\"\n | \"otp-input\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"permission-prompt\"\n | \"photo-grid\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"pull-to-refresh\"\n | \"retro-tv\"\n | \"shop-gallery\"\n | \"radio-group\"\n | \"router\"\n | \"rail-nav\"\n | \"recipes\"\n | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"service-card\"\n | \"shop\"\n | \"shop-composer\"\n | \"settings-layout\"\n | \"account-menu\"\n | \"showcase\"\n | \"step-showcase\"\n | \"site-footer\"\n | \"sites\"\n | \"skeleton\"\n | \"skip-link\"\n | \"slider\"\n | \"slot-picker\"\n | \"slot\"\n | \"spinner\"\n | \"sticky-action\"\n | \"splash-handoff\"\n | \"split-view\"\n | \"stage-banner\"\n | \"stat\"\n | \"usage\"\n | \"status-page\"\n | \"step-progress\"\n | \"stepper\"\n | \"swipe-deck\"\n | \"swipeable-row\"\n | \"switch\"\n | \"tab-bar\"\n | \"tabs\"\n | \"tag-input\"\n | \"tag-selector\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"tree-view\"\n | \"txt\"\n | \"update-prompt\"\n | \"verified-badge\"\n | \"vertical-video\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\"\n | \"wall\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/**\n * Why a component is not on a platform — a decision, never a silence (the parity matrix of ui.krizaka.com/platforms):\n * - `gap` (✗): it belongs there and is not built yet; `issue` is the issue that tracks it (`krizaka/krizaka-ui#275`);\n * - `n/a`: it is not meant for that platform (a site's page block on a phone, a swipe on a desktop); `use` names the\n * component that answers there, when one does.\n */\nexport type Absence =\n | { readonly status: \"gap\"; readonly issue: string; readonly reason: string; readonly use?: undefined }\n | { readonly status: \"n/a\"; readonly reason: string; readonly use?: ComponentName; readonly issue?: undefined };\n\n/**\n * Desktop is the Orazaka Mac app (Tauri 2: the system WebView renders the web components — ADR-002). `web`: the web\n * component runs there as it is; `desktop`: it also has a desktop form (a window's title bar, a denser layout…), said in\n * its documentation; otherwise the absence and why.\n */\nexport type DesktopSupport = \"web\" | \"desktop\" | Absence;\n\n/**\n * The three platforms of Krizaka UI — web · native (React Native, Expo) · desktop — for one component. The side a\n * component has is `platforms`; the side it lacks says why here: `native` is required for (and only for) a web-only\n * component, `web` for a native-only one; `desktop` always. `scripts/registry.test.mjs` fails on a missing decision.\n */\nexport interface Parity {\n readonly web?: Absence;\n readonly native?: Absence;\n readonly desktop: DesktopSupport;\n}\n\n/**\n * `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: no product uses it and\n * no work plans to — it still works, says what replaces it, and goes in the major named by `deprecated.removedIn`.\n */\nexport type Status = \"stable\" | \"beta\" | \"deprecated\";\n\n/** What a deprecated component says (required when `status` is `deprecated`, absent otherwise). */\nexport interface Deprecation {\n /** The version that deprecated it (`3.6.0`). */\n readonly since: string;\n /** The major that removes it (`4.0.0`). */\n readonly removedIn: string;\n /** What replaces it, when a component does. */\n readonly use?: ComponentName;\n /** Why it goes: no product uses it, no planned work needs it. */\n readonly reason: string;\n}\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/** Why a reader needs a template: the seven intents the templates are grouped by (sidebar sub-headings, catalogue filter). */\nexport type TemplatePurpose = \"convince\" | \"explain\" | \"show\" | \"act\" | \"operate\" | \"converse\" | \"recover\";\n\n/** The groups of templates, in reading order: the title, and the one line that says when to come to that group. */\nexport const templatePurposes = {\n convince: { title: \"Convince\", useWhen: \"You come here when a visitor must decide: a landing, a product, a price, a comparison, a proof.\" },\n explain: { title: \"Explain\", useWhen: \"You come here when a reader must understand: how it works, a documentation hub or article, a changelog, a FAQ, a policy.\" },\n show: { title: \"Show\", useWhen: \"You come here when the work itself is the argument: a gallery, a story, a case study, an object and its details.\" },\n act: { title: \"Act\", useWhen: \"You come here when a person must do something once: reach the team, sign in or up, set up, pay.\" },\n operate: { title: \"Operate\", useWhen: \"You come here when a person works every day: a dashboard, a console with a table, settings, an app shell.\" },\n converse: { title: \"Converse\", useWhen: \"You come here when people talk: an inbox, a chat, comments, a notifications centre.\" },\n recover: { title: \"Recover\", useWhen: \"You come here when the way is blocked: an empty list, an error, a missing page, maintenance, a product still being built.\" },\n} as const satisfies Record<TemplatePurpose, { readonly title: string; readonly useWhen: string }>;\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\ninterface ExampleBase {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** A plain example, or a template: a whole screen with its intent (`purpose`) and the user goal its layout serves (`why`). */\nexport type Example =\n | (ExampleBase & { readonly template?: false; readonly purpose?: undefined; readonly why?: undefined })\n | (ExampleBase & {\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its\n * phone version thought out), copied as a starting point — at most 160 lines, listed on ui.krizaka.com/templates.\n */\n readonly template: true;\n /** The intent that groups it: why you need this block. */\n readonly purpose: TemplatePurpose;\n /** Why this layout: the user goal it serves, in one sentence. */\n readonly why: string;\n });\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n /** The React Native entry alone is deprecated while the web one stays (ADR-006 §7); a deprecated component says it once, above. */\n readonly deprecated?: Deprecation;\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n /** Required for, and only for, a `deprecated` component. */\n readonly deprecated?: Deprecation;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** The platforms it is not on, and why; and its desktop form (see `Parity`). */\n readonly parity: Parity;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
|
|
224
224
|
},
|
|
225
225
|
{
|
|
226
226
|
"path": "shop-composer/commands.ts",
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shop-gallery",
|
|
3
|
+
"type": "primitive",
|
|
4
|
+
"title": "Shop gallery",
|
|
5
|
+
"summary": "A shop's photos as a bento mosaic (one 2×2 lead, four tiles, the last one « + N photos »), a snap strip with a counter on a phone, and a lightbox with swipe, arrow keys and the alt text as caption. Fixed ratios, no layout shift; the lightbox is a lazy chunk.",
|
|
6
|
+
"description": "A shop's photos as a bento mosaic (one 2×2 lead, four tiles, the last one « + N photos »), a snap strip with a counter on a phone, and a lightbox with swipe, arrow keys and the alt text as caption. Fixed ratios, no layout shift; the lightbox is a lazy chunk.",
|
|
7
|
+
"status": "beta",
|
|
8
|
+
"deprecated": null,
|
|
9
|
+
"category": "media",
|
|
10
|
+
"platforms": "web",
|
|
11
|
+
"parity": {
|
|
12
|
+
"web": {
|
|
13
|
+
"state": "yes"
|
|
14
|
+
},
|
|
15
|
+
"native": {
|
|
16
|
+
"state": "n/a",
|
|
17
|
+
"reason": "A shop's public page is a web page.",
|
|
18
|
+
"use": "photo-grid"
|
|
19
|
+
},
|
|
20
|
+
"desktop": {
|
|
21
|
+
"state": "yes"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"whenToUse": [
|
|
25
|
+
"The « Photos » section of a shop page: five to a few dozen real photos that a visitor looks at, then opens one by one.",
|
|
26
|
+
"Any set of still images where a quiet mosaic and a full-size viewer are enough."
|
|
27
|
+
],
|
|
28
|
+
"whenNotToUse": [
|
|
29
|
+
{
|
|
30
|
+
"when": "Photos mixed with muted loops and captions on the tiles.",
|
|
31
|
+
"use": "media-gallery"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"when": "A feed of creator videos with counts and a preview.",
|
|
35
|
+
"use": "media-grid"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"bestPractices": [
|
|
39
|
+
"Give each photo its `alt`: it names the tile for a screen reader and is the lightbox's caption.",
|
|
40
|
+
"Pass `srcSet` (400 / 800 / 1200 w) for the tiles and `fullSrcSet` for the lightbox; the tiles carry `sizes` and a fixed ratio, so the page never shifts.",
|
|
41
|
+
"From five photos on a phone the mosaic becomes a snap strip with a « 1 / N » counter; with fewer it stays a two-column mosaic.",
|
|
42
|
+
"Pass `labels` translated (`shopGalleryLabelsFr` for French); the host's text is never hard-coded here."
|
|
43
|
+
],
|
|
44
|
+
"accessibility": {
|
|
45
|
+
"keyboard": [
|
|
46
|
+
{
|
|
47
|
+
"keys": "Tab / Enter / Space",
|
|
48
|
+
"action": "Move across the tiles and open one in the lightbox."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"keys": "← →",
|
|
52
|
+
"action": "Previous and next photo in the lightbox."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"keys": "Esc",
|
|
56
|
+
"action": "Close the lightbox; focus returns to the tile that opened it."
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"notes": [
|
|
60
|
+
"Each tile is a button named « Open photo 3 of 12: … »; the lightbox is a modal dialog with its focus trapped, and swiping works on touch.",
|
|
61
|
+
"Under reduced motion the hover zoom, the smooth strip scroll and the photo fade stop."
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"related": [
|
|
65
|
+
"media-gallery",
|
|
66
|
+
"dialog",
|
|
67
|
+
"shop",
|
|
68
|
+
"wall"
|
|
69
|
+
],
|
|
70
|
+
"web": {
|
|
71
|
+
"entry": "@krizaka/ui/shop-gallery",
|
|
72
|
+
"import": "import { ShopGallery, shopGalleryLabels, shopGalleryLabelsFr } from \"@krizaka/ui/shop-gallery\";",
|
|
73
|
+
"props": [
|
|
74
|
+
{
|
|
75
|
+
"component": "ShopGallery",
|
|
76
|
+
"description": "A shop's photos: a bento mosaic (one 2×2 lead and four tiles, the last one « + N photos »), a snap strip on a phone, and a lightbox.",
|
|
77
|
+
"props": [
|
|
78
|
+
{
|
|
79
|
+
"name": "label",
|
|
80
|
+
"type": "string",
|
|
81
|
+
"default": null,
|
|
82
|
+
"description": "The gallery's accessible name (`Photos of the salon`).",
|
|
83
|
+
"required": true
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "photos",
|
|
87
|
+
"type": "readonly ShopGalleryPhoto[]",
|
|
88
|
+
"default": null,
|
|
89
|
+
"description": "The shop's photos, in order, already unique.",
|
|
90
|
+
"required": true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "labels",
|
|
94
|
+
"type": "Partial<ShopGalleryLabels>",
|
|
95
|
+
"default": null,
|
|
96
|
+
"description": "Translated texts; `shopGalleryLabelsFr` for French.",
|
|
97
|
+
"required": false
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "sizes",
|
|
101
|
+
"type": "string",
|
|
102
|
+
"default": null,
|
|
103
|
+
"description": "The tiles' `sizes` (default: the bento's share of a 72 rem page on a desktop, 78 vw on a phone).",
|
|
104
|
+
"required": false
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"examples": [
|
|
110
|
+
{
|
|
111
|
+
"name": "five",
|
|
112
|
+
"title": "Five photos",
|
|
113
|
+
"description": "The bento at its fullest: a lead and four tiles; a snap strip on a phone.",
|
|
114
|
+
"path": "examples/shop-gallery/five.tsx",
|
|
115
|
+
"module": "@krizaka/ui/registry/examples/shop-gallery/five",
|
|
116
|
+
"code": "import { ShopGallery } from \"@krizaka/ui/shop-gallery\";\n\n// Drawn pictures (data URIs, no network); a shop passes its own photos, with the srcSet of the widths it holds.\nconst PIC = (a: string, b: string) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 600'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='${a}'/><stop offset='1' stop-color='${b}'/></linearGradient></defs><rect width='800' height='600' fill='url(#g)'/></svg>`)}`;\nconst ALTS = [\"Two chairs by the window\",\"The colour bar\",\"A fresh cut\",\"Morning light on the mirrors\",\"Our shampoo corner\",\"Tools laid out\",\"The front desk\",\"A waiting sofa\",\"Plants by the door\",\"The back room\",\"Evening at the shop\",\"The street sign\"];\nconst photos = ALTS.slice(0, 5).map((alt, i) => ({ id: `p${i}`, src: PIC(`hsl(${(i * 31) % 360} 45% 32%)`, `hsl(${(i * 31 + 50) % 360} 55% 58%)`), alt }));\n\nexport default function ShopGalleryFive() {\n return <ShopGallery label=\"Photos of the salon\" photos={photos} />;\n}\n"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "twelve",
|
|
120
|
+
"title": "Twelve photos",
|
|
121
|
+
"description": "The last tile reads « + 8 photos » and opens the rest in the lightbox.",
|
|
122
|
+
"path": "examples/shop-gallery/twelve.tsx",
|
|
123
|
+
"module": "@krizaka/ui/registry/examples/shop-gallery/twelve",
|
|
124
|
+
"code": "import { ShopGallery } from \"@krizaka/ui/shop-gallery\";\n\n// Drawn pictures (data URIs, no network); a shop passes its own photos, with the srcSet of the widths it holds.\nconst PIC = (a: string, b: string) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 600'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='${a}'/><stop offset='1' stop-color='${b}'/></linearGradient></defs><rect width='800' height='600' fill='url(#g)'/></svg>`)}`;\nconst ALTS = [\"Two chairs by the window\",\"The colour bar\",\"A fresh cut\",\"Morning light on the mirrors\",\"Our shampoo corner\",\"Tools laid out\",\"The front desk\",\"A waiting sofa\",\"Plants by the door\",\"The back room\",\"Evening at the shop\",\"The street sign\"];\nconst photos = ALTS.slice(0, 12).map((alt, i) => ({ id: `p${i}`, src: PIC(`hsl(${(i * 31) % 360} 45% 32%)`, `hsl(${(i * 31 + 50) % 360} 55% 58%)`), alt }));\n\nexport default function ShopGalleryTwelve() {\n return <ShopGallery label=\"Photos of the salon\" photos={photos} />;\n}\n"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "three",
|
|
128
|
+
"title": "Three photos, in French",
|
|
129
|
+
"description": "A short set stays a mosaic on every screen; labels in French.",
|
|
130
|
+
"path": "examples/shop-gallery/three.tsx",
|
|
131
|
+
"module": "@krizaka/ui/registry/examples/shop-gallery/three",
|
|
132
|
+
"code": "import { ShopGallery, shopGalleryLabelsFr } from \"@krizaka/ui/shop-gallery\";\n\n// Drawn pictures (data URIs, no network); a shop passes its own photos, with the srcSet of the widths it holds.\nconst PIC = (a: string, b: string) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 600'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='${a}'/><stop offset='1' stop-color='${b}'/></linearGradient></defs><rect width='800' height='600' fill='url(#g)'/></svg>`)}`;\nconst ALTS = [\"Deux fauteuils près de la fenêtre\",\"Le bar à couleurs\",\"Une coupe fraîche\",\"La lumière du matin\",\"Le coin shampoing\",\"Les outils\"];\nconst photos = ALTS.slice(0, 3).map((alt, i) => ({ id: `p${i}`, src: PIC(`hsl(${(i * 31) % 360} 45% 32%)`, `hsl(${(i * 31 + 50) % 360} 55% 58%)`), alt }));\n\nexport default function ShopGalleryThree() {\n return <ShopGallery label=\"Photos du salon\" photos={photos} labels={shopGalleryLabelsFr} />;\n}\n"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"native": null,
|
|
137
|
+
"files": [
|
|
138
|
+
{
|
|
139
|
+
"path": "meta.ts",
|
|
140
|
+
"content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which ui.krizaka.com (apps/site) renders as\n// ui.krizaka.com/components/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"notification-preferences\"\n | \"quota-meter\"\n | \"environment-notice\"\n | \"embed-facade\"\n | \"reviews\"\n | \"margin-layout\"\n | \"analysis-report\"\n | \"status-chip\"\n | \"kind-config-editor\"\n | \"agenda\"\n | \"account-settings\"\n | \"drop-overlay\"\n | \"upload-queue\"\n | \"achievement\"\n | \"anatomy-plate\"\n | \"bird-plate\"\n | \"taped-photo\"\n | \"stuck\"\n | \"doodle\"\n | \"signature\"\n | \"grade-stamp\"\n | \"versus-card\"\n | \"speed-lines\"\n | \"site-cahier\"\n | \"text-style\"\n | \"flock\"\n | \"elephant\"\n | \"footnote\"\n | \"page-index\"\n | \"chapter\"\n | \"specimen-tag\"\n | \"action-bar\"\n | \"action-sheet\"\n | \"activity-feed\"\n | \"alert\"\n | \"app-frame\"\n | \"desktop-window\"\n | \"form-flow\"\n | \"grid\"\n | \"list-detail\"\n | \"state-screen\"\n | \"app-header\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"captcha\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"chat\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"chip-row\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"comparison-table\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"copy-button\"\n | \"money-input\"\n | \"promo-code-field\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cover-hero\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"description-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"docs-nav\"\n | \"document-viewer\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"engine-flow\"\n | \"error-page\"\n | \"fab\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"force-update-screen\"\n | \"form\"\n | \"gallery-page\"\n | \"genui\"\n | \"glossary\"\n | \"glossary-term\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"header\"\n | \"how-it-works-page\"\n | \"image-cropper\"\n | \"image-viewer\"\n | \"iso\"\n | \"kanban\"\n | \"kbd\"\n | \"kpi-explained\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"longform-page\"\n | \"maintenance-screen\"\n | \"map\"\n | \"markdown\"\n | \"meta-row\"\n | \"waveform\"\n | \"proposal\"\n | \"qr-code\"\n | \"entity-header\"\n | \"collection-switcher\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\n | \"media-grid\"\n | \"language-switch\"\n | \"media-gallery\"\n | \"media-picker\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"onboarding\"\n | \"opening-hours\"\n | \"otp-input\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"permission-prompt\"\n | \"photo-grid\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"pull-to-refresh\"\n | \"retro-tv\"\n | \"shop-gallery\"\n | \"radio-group\"\n | \"router\"\n | \"rail-nav\"\n | \"recipes\"\n | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"service-card\"\n | \"shop\"\n | \"shop-composer\"\n | \"settings-layout\"\n | \"account-menu\"\n | \"showcase\"\n | \"step-showcase\"\n | \"site-footer\"\n | \"sites\"\n | \"skeleton\"\n | \"skip-link\"\n | \"slider\"\n | \"slot-picker\"\n | \"slot\"\n | \"spinner\"\n | \"sticky-action\"\n | \"splash-handoff\"\n | \"split-view\"\n | \"stage-banner\"\n | \"stat\"\n | \"usage\"\n | \"status-page\"\n | \"step-progress\"\n | \"stepper\"\n | \"swipe-deck\"\n | \"swipeable-row\"\n | \"switch\"\n | \"tab-bar\"\n | \"tabs\"\n | \"tag-input\"\n | \"tag-selector\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"tree-view\"\n | \"txt\"\n | \"update-prompt\"\n | \"verified-badge\"\n | \"vertical-video\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\"\n | \"wall\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/**\n * Why a component is not on a platform — a decision, never a silence (the parity matrix of ui.krizaka.com/platforms):\n * - `gap` (✗): it belongs there and is not built yet; `issue` is the issue that tracks it (`krizaka/krizaka-ui#275`);\n * - `n/a`: it is not meant for that platform (a site's page block on a phone, a swipe on a desktop); `use` names the\n * component that answers there, when one does.\n */\nexport type Absence =\n | { readonly status: \"gap\"; readonly issue: string; readonly reason: string; readonly use?: undefined }\n | { readonly status: \"n/a\"; readonly reason: string; readonly use?: ComponentName; readonly issue?: undefined };\n\n/**\n * Desktop is the Orazaka Mac app (Tauri 2: the system WebView renders the web components — ADR-002). `web`: the web\n * component runs there as it is; `desktop`: it also has a desktop form (a window's title bar, a denser layout…), said in\n * its documentation; otherwise the absence and why.\n */\nexport type DesktopSupport = \"web\" | \"desktop\" | Absence;\n\n/**\n * The three platforms of Krizaka UI — web · native (React Native, Expo) · desktop — for one component. The side a\n * component has is `platforms`; the side it lacks says why here: `native` is required for (and only for) a web-only\n * component, `web` for a native-only one; `desktop` always. `scripts/registry.test.mjs` fails on a missing decision.\n */\nexport interface Parity {\n readonly web?: Absence;\n readonly native?: Absence;\n readonly desktop: DesktopSupport;\n}\n\n/**\n * `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: no product uses it and\n * no work plans to — it still works, says what replaces it, and goes in the major named by `deprecated.removedIn`.\n */\nexport type Status = \"stable\" | \"beta\" | \"deprecated\";\n\n/** What a deprecated component says (required when `status` is `deprecated`, absent otherwise). */\nexport interface Deprecation {\n /** The version that deprecated it (`3.6.0`). */\n readonly since: string;\n /** The major that removes it (`4.0.0`). */\n readonly removedIn: string;\n /** What replaces it, when a component does. */\n readonly use?: ComponentName;\n /** Why it goes: no product uses it, no planned work needs it. */\n readonly reason: string;\n}\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/** Why a reader needs a template: the seven intents the templates are grouped by (sidebar sub-headings, catalogue filter). */\nexport type TemplatePurpose = \"convince\" | \"explain\" | \"show\" | \"act\" | \"operate\" | \"converse\" | \"recover\";\n\n/** The groups of templates, in reading order: the title, and the one line that says when to come to that group. */\nexport const templatePurposes = {\n convince: { title: \"Convince\", useWhen: \"You come here when a visitor must decide: a landing, a product, a price, a comparison, a proof.\" },\n explain: { title: \"Explain\", useWhen: \"You come here when a reader must understand: how it works, a documentation hub or article, a changelog, a FAQ, a policy.\" },\n show: { title: \"Show\", useWhen: \"You come here when the work itself is the argument: a gallery, a story, a case study, an object and its details.\" },\n act: { title: \"Act\", useWhen: \"You come here when a person must do something once: reach the team, sign in or up, set up, pay.\" },\n operate: { title: \"Operate\", useWhen: \"You come here when a person works every day: a dashboard, a console with a table, settings, an app shell.\" },\n converse: { title: \"Converse\", useWhen: \"You come here when people talk: an inbox, a chat, comments, a notifications centre.\" },\n recover: { title: \"Recover\", useWhen: \"You come here when the way is blocked: an empty list, an error, a missing page, maintenance, a product still being built.\" },\n} as const satisfies Record<TemplatePurpose, { readonly title: string; readonly useWhen: string }>;\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\ninterface ExampleBase {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** A plain example, or a template: a whole screen with its intent (`purpose`) and the user goal its layout serves (`why`). */\nexport type Example =\n | (ExampleBase & { readonly template?: false; readonly purpose?: undefined; readonly why?: undefined })\n | (ExampleBase & {\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its\n * phone version thought out), copied as a starting point — at most 160 lines, listed on ui.krizaka.com/templates.\n */\n readonly template: true;\n /** The intent that groups it: why you need this block. */\n readonly purpose: TemplatePurpose;\n /** Why this layout: the user goal it serves, in one sentence. */\n readonly why: string;\n });\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n /** The React Native entry alone is deprecated while the web one stays (ADR-006 §7); a deprecated component says it once, above. */\n readonly deprecated?: Deprecation;\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n /** Required for, and only for, a `deprecated` component. */\n readonly deprecated?: Deprecation;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** The platforms it is not on, and why; and its desktop form (see `Parity`). */\n readonly parity: Parity;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"path": "shop-gallery/index.ts",
|
|
144
|
+
"content": "/** @krizaka/ui/shop-gallery — `ShopGallery`: a shop's photos as a bento mosaic (a snap strip on a phone) that opens a lightbox. Client. */\nexport { type ShopGalleryLabels, shopGalleryLabels, shopGalleryLabelsFr } from \"./labels\";\nexport { ShopGallery, type ShopGalleryPhoto, type ShopGalleryProps } from \"./shop-gallery\";\n"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"path": "shop-gallery/labels.ts",
|
|
148
|
+
"content": "export type ShopGalleryLabels = {\n /** The tile's name: `Open photo 3 of 12: Two chairs by the window`. */\n open: (alt: string, position: number, total: number) => string;\n /** The last tile of the mosaic: `+ 8 photos`. */\n more: (count: number) => string;\n /** The phone strip's counter: `3 / 12`. */\n counter: (position: number, total: number) => string;\n previous: string;\n next: string;\n close: string;\n /** The lightbox's title, read by a screen reader: `Photos of the salon`. */\n title: (label: string) => string;\n /** The lightbox's position: `3 of 12`. */\n position: (position: number, total: number) => string;\n};\n\nexport const shopGalleryLabels: ShopGalleryLabels = {\n open: (alt, position, total) => (alt ? `Open photo ${position} of ${total}: ${alt}` : `Open photo ${position} of ${total}`),\n more: (count) => `+ ${count} photos`,\n counter: (position, total) => `${position} / ${total}`,\n previous: \"Previous photo\",\n next: \"Next photo\",\n close: \"Close\",\n title: (label) => label,\n position: (position, total) => `${position} of ${total}`,\n};\n\nexport const shopGalleryLabelsFr: ShopGalleryLabels = {\n open: (alt, position, total) => (alt ? `Ouvrir la photo ${position} sur ${total} : ${alt}` : `Ouvrir la photo ${position} sur ${total}`),\n more: (count) => `+ ${count} photos`,\n counter: (position, total) => `${position} / ${total}`,\n previous: \"Photo précédente\",\n next: \"Photo suivante\",\n close: \"Fermer\",\n title: (label) => label,\n position: (position, total) => `${position} sur ${total}`,\n};\n"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"path": "shop-gallery/lightbox.tsx",
|
|
152
|
+
"content": "\"use client\";\n\n// The lightbox: loaded as a lazy chunk, only once a photo is opened. A Dialog (focus trapped, Escape, scroll lock), arrow\n// keys and a horizontal swipe, the photo at full resolution and its alt text as the caption.\nimport * as React from \"react\";\n\nimport { IconButton } from \"../button/button\";\nimport { Dialog } from \"../dialog\";\nimport type { ShopGalleryLabels } from \"./labels\";\nimport type { ShopGalleryPhoto } from \"./shop-gallery\";\n\nconst SWIPE = 50;\n\nfunction Arrow({ dir }: { dir: \"left\" | \"right\" }) {\n return (\n <svg viewBox=\"0 0 24 24\" className=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d={dir === \"left\" ? \"m15 6-6 6 6 6\" : \"m9 6 6 6-6 6\"} />\n </svg>\n );\n}\n\nexport type ShopGalleryLightboxProps = {\n photos: readonly ShopGalleryPhoto[];\n index: number;\n onIndexChange: (index: number) => void;\n onClose: () => void;\n label: string;\n labels: ShopGalleryLabels;\n /** Where focus goes back to when it closes. */\n returnFocus: () => HTMLElement | null;\n};\n\nexport default function ShopGalleryLightbox({ photos, index, onIndexChange, onClose, label, labels, returnFocus }: ShopGalleryLightboxProps) {\n const total = photos.length;\n const photo = photos[index];\n const startX = React.useRef<number | null>(null);\n const go = (to: number) => onIndexChange(((to % total) + total) % total);\n if (!photo) return null;\n const preload = [photos[(index + 1) % total], photos[(index - 1 + total) % total]];\n return (\n <Dialog.Root open onOpenChange={(open) => !open && onClose()}>\n <Dialog.Content\n closeLabel={labels.close}\n size=\"lg\"\n className=\"kz-sg-lightbox sm:max-w-5xl\"\n onCloseAutoFocus={(event) => {\n const target = returnFocus();\n if (target) {\n event.preventDefault();\n target.focus();\n }\n }}\n onKeyDown={(event) => {\n if (event.key === \"ArrowLeft\") go(index - 1);\n else if (event.key === \"ArrowRight\") go(index + 1);\n }}\n >\n <style>{`.kz-sg-stage{touch-action:pan-y}.kz-sg-lightbox img{user-select:none;-webkit-user-drag:none}@media (prefers-reduced-motion:no-preference){.kz-sg-photo{animation:kz-sg-in .22s ease-out}}@keyframes kz-sg-in{from{opacity:.4}to{opacity:1}}`}</style>\n <Dialog.Header>\n <Dialog.Title className=\"sr-only\">{labels.title(label)}</Dialog.Title>\n <p className=\"m-0 text-sm text-fg-secondary\" aria-live=\"polite\">{labels.position(index + 1, total)}</p>\n </Dialog.Header>\n <Dialog.Body className=\"flex flex-col gap-3\">\n <div\n className=\"kz-sg-stage relative flex items-center justify-center\"\n onTouchStart={(event) => {\n startX.current = event.touches[0]?.clientX ?? null;\n }}\n onTouchEnd={(event) => {\n const from = startX.current;\n const to = event.changedTouches[0]?.clientX;\n startX.current = null;\n if (from === null || to === undefined) return;\n if (to - from <= -SWIPE) go(index + 1);\n else if (to - from >= SWIPE) go(index - 1);\n }}\n >\n <img\n key={photo.id}\n src={photo.fullSrc ?? photo.src}\n srcSet={photo.fullSrcSet ?? photo.srcSet}\n sizes={photo.fullSrcSet ?? photo.srcSet ? \"(min-width: 64rem) 64rem, 100vw\" : undefined}\n alt={photo.alt}\n decoding=\"async\"\n className=\"kz-sg-photo max-h-[68dvh] w-full rounded-lg object-contain\"\n />\n {total > 1 && (\n <>\n <IconButton label={labels.previous} variant=\"secondary\" shape=\"pill\" className=\"absolute left-2 top-1/2 -translate-y-1/2\" onClick={() => go(index - 1)}>\n <Arrow dir=\"left\" />\n </IconButton>\n <IconButton label={labels.next} variant=\"secondary\" shape=\"pill\" className=\"absolute right-2 top-1/2 -translate-y-1/2\" onClick={() => go(index + 1)}>\n <Arrow dir=\"right\" />\n </IconButton>\n </>\n )}\n </div>\n <Dialog.Description className=\"m-0 min-h-5 text-center\">{photo.alt}</Dialog.Description>\n <div hidden aria-hidden>\n {preload.map((p) => p && p.id !== photo.id && <img key={p.id} src={p.fullSrc ?? p.src} alt=\"\" />)}\n </div>\n </Dialog.Body>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"path": "shop-gallery/meta.ts",
|
|
156
|
+
"content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Shop gallery\",\n summary: \"A shop's photos as a bento mosaic (one 2×2 lead, four tiles, the last one « + N photos »), a snap strip with a counter on a phone, and a lightbox with swipe, arrow keys and the alt text as caption. Fixed ratios, no layout shift; the lightbox is a lazy chunk.\",\n status: \"beta\",\n category: \"media\",\n platforms: \"web\",\n parity: { native: { status: \"n/a\", reason: \"A shop's public page is a web page.\", use: \"photo-grid\" }, desktop: \"web\" },\n whenToUse: [\n \"The « Photos » section of a shop page: five to a few dozen real photos that a visitor looks at, then opens one by one.\",\n \"Any set of still images where a quiet mosaic and a full-size viewer are enough.\",\n ],\n whenNotToUse: [\n { when: \"Photos mixed with muted loops and captions on the tiles.\", use: \"media-gallery\" },\n { when: \"A feed of creator videos with counts and a preview.\", use: \"media-grid\" },\n ],\n bestPractices: [\n \"Give each photo its `alt`: it names the tile for a screen reader and is the lightbox's caption.\",\n \"Pass `srcSet` (400 / 800 / 1200 w) for the tiles and `fullSrcSet` for the lightbox; the tiles carry `sizes` and a fixed ratio, so the page never shifts.\",\n \"From five photos on a phone the mosaic becomes a snap strip with a « 1 / N » counter; with fewer it stays a two-column mosaic.\",\n \"Pass `labels` translated (`shopGalleryLabelsFr` for French); the host's text is never hard-coded here.\",\n ],\n accessibility: {\n keyboard: [\n { keys: \"Tab / Enter / Space\", action: \"Move across the tiles and open one in the lightbox.\" },\n { keys: \"← →\", action: \"Previous and next photo in the lightbox.\" },\n { keys: \"Esc\", action: \"Close the lightbox; focus returns to the tile that opened it.\" },\n ],\n notes: [\n \"Each tile is a button named « Open photo 3 of 12: … »; the lightbox is a modal dialog with its focus trapped, and swiping works on touch.\",\n \"Under reduced motion the hover zoom, the smooth strip scroll and the photo fade stop.\",\n ],\n },\n related: [\"media-gallery\", \"dialog\", \"shop\", \"wall\"],\n web: {\n imports: [\"ShopGallery\", \"shopGalleryLabels\", \"shopGalleryLabelsFr\"],\n examples: [\n { name: \"five\", title: \"Five photos\", description: \"The bento at its fullest: a lead and four tiles; a snap strip on a phone.\" },\n { name: \"twelve\", title: \"Twelve photos\", description: \"The last tile reads « + 8 photos » and opens the rest in the lightbox.\" },\n { name: \"three\", title: \"Three photos, in French\", description: \"A short set stays a mosaic on every screen; labels in French.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"path": "shop-gallery/shop-gallery.tsx",
|
|
160
|
+
"content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { type ShopGalleryLabels, shopGalleryLabels } from \"./labels\";\n\n// The lightbox is a lazy chunk: nothing of it is loaded until a photo is opened.\nconst Lightbox = React.lazy(() => import(\"./lightbox\"));\n\nexport type ShopGalleryPhoto = {\n id: string;\n /** The tile's image. */\n src: string;\n /** What it shows, in words: the tile's name and the lightbox's caption. */\n alt: string;\n /** The widths the product holds (`/a-400.avif 400w, /a-800.avif 800w, /a-1200.avif 1200w`). */\n srcSet?: string;\n /** The lightbox's image at full resolution (default: `src`). */\n fullSrc?: string;\n fullSrcSet?: string;\n};\n\nexport type ShopGalleryProps = Omit<React.ComponentProps<\"div\">, \"children\"> & {\n /** The shop's photos, in order, already unique. */\n photos: readonly ShopGalleryPhoto[];\n /** The gallery's accessible name (`Photos of the salon`). */\n label: string;\n /** The tiles' `sizes` (default: the bento's share of a 72 rem page on a desktop, 78 vw on a phone). */\n sizes?: string;\n /** Translated texts; `shopGalleryLabelsFr` for French. */\n labels?: Partial<ShopGalleryLabels>;\n};\n\nconst BENTO = 5;\n\nconst styles = `\n.kz-sg{position:relative}\n.kz-sg-list{margin:0;padding:0;list-style:none;display:grid;grid-template-columns:repeat(2,1fr);gap:.5rem}\n.kz-sg-tile{position:relative;display:block;width:100%;height:100%;padding:0;overflow:hidden;cursor:zoom-in;border:1px solid var(--kz-border-subtle);border-radius:var(--kz-shop-photo-radius,.75rem);background:var(--kz-surface-2);color:var(--kz-text-on-media)}\n.kz-sg-tile img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n.kz-sg-tile:focus-visible{outline:2px solid var(--kz-ring);outline-offset:2px}\n.kz-sg-list>li{aspect-ratio:1/1;min-width:0}\n.kz-sg-list>li:first-child:nth-last-child(odd){grid-column:span 2;aspect-ratio:16/10}\n.kz-sg-more,.kz-sg-count{display:none}\n.kz-sg[data-strip=true] .kz-sg-list{display:flex;gap:.75rem;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;margin-inline:-1rem;padding-inline:1rem;scroll-padding-inline:1rem;-webkit-mask-image:linear-gradient(to right,transparent,currentcolor 1.25rem,currentcolor calc(100% - 1.25rem),transparent);mask-image:linear-gradient(to right,transparent,currentcolor 1.25rem,currentcolor calc(100% - 1.25rem),transparent)}\n.kz-sg[data-strip=true] .kz-sg-list::-webkit-scrollbar{display:none}\n.kz-sg[data-strip=true] .kz-sg-list>li{flex:0 0 78%;aspect-ratio:4/5;scroll-snap-align:start}\n.kz-sg[data-strip=true] .kz-sg-list>li:first-child:nth-last-child(odd){grid-column:auto;aspect-ratio:4/5}\n.kz-sg[data-strip=true] .kz-sg-count{display:block;margin:.5rem 0 0;text-align:end;font:600 .75rem/1 var(--kz-font-mono,monospace);color:var(--kz-text-secondary)}\n@media (prefers-reduced-motion:no-preference){.kz-sg[data-strip=true] .kz-sg-list{scroll-behavior:smooth}.kz-sg-tile img{transition:transform .35s ease}.kz-sg-tile:hover img{transform:scale(1.03)}}\n@media (min-width:40rem){\n.kz-sg-list{gap:.75rem}\n.kz-sg[data-strip=true] .kz-sg-list{display:grid;overflow:visible;margin-inline:0;padding-inline:0;-webkit-mask-image:none;mask-image:none}\n.kz-sg[data-strip=true] .kz-sg-count{display:none}\n.kz-sg[data-count=\"1\"] .kz-sg-list{grid-template-columns:1fr}\n.kz-sg[data-count=\"1\"] .kz-sg-list>li{aspect-ratio:16/9}\n.kz-sg[data-count=\"2\"] .kz-sg-list>li,.kz-sg[data-count=\"2\"] .kz-sg-list>li:first-child:nth-last-child(odd){aspect-ratio:4/3;grid-column:auto}\n.kz-sg:not([data-count=\"1\"]):not([data-count=\"2\"]) .kz-sg-list{grid-template-columns:repeat(4,1fr);grid-template-rows:repeat(2,1fr);aspect-ratio:2/1}\n.kz-sg:not([data-count=\"1\"]):not([data-count=\"2\"]) .kz-sg-list>li,.kz-sg[data-strip=true] .kz-sg-list>li{aspect-ratio:auto;flex:none}\n.kz-sg:not([data-count=\"1\"]):not([data-count=\"2\"]) .kz-sg-list>li:first-child{grid-column:1/3;grid-row:1/3}\n.kz-sg[data-count=\"3\"] .kz-sg-list>li:nth-child(n+2){grid-column:3/5}\n.kz-sg[data-count=\"4\"] .kz-sg-list>li:nth-child(2){grid-column:3/5}\n.kz-sg[data-strip=true] .kz-sg-list>li:nth-child(n+6){display:none}\n.kz-sg[data-more=true] .kz-sg-list>li:nth-child(5) .kz-sg-more{position:absolute;inset:0;display:grid;place-items:center;background:color-mix(in srgb,var(--kz-scrim-strong) 62%,transparent);font:700 1.125rem/1.2 var(--kz-font-sans,system-ui);text-align:center}\n}\n`;\n\n/** A shop's photos: a bento mosaic (one 2×2 lead and four tiles, the last one « + N photos »), a snap strip on a phone, and a lightbox. */\nexport function ShopGallery({ photos, label, sizes, labels: given, className, ...props }: ShopGalleryProps) {\n const labels = { ...shopGalleryLabels, ...given };\n const total = photos.length;\n const strip = total >= BENTO;\n const [open, setOpen] = React.useState<number | null>(null);\n const [current, setCurrent] = React.useState(1);\n const tiles = React.useRef<(HTMLButtonElement | null)[]>([]);\n const opener = React.useRef<number>(0);\n if (total === 0) return null;\n\n const tileSizes = sizes ?? (strip ? \"(min-width: 40rem) 36rem, 78vw\" : \"(min-width: 40rem) 36rem, 50vw\");\n const onScroll = (event: React.UIEvent<HTMLUListElement>) => {\n const list = event.currentTarget;\n const first = list.children[0] as HTMLElement | undefined;\n const step = first ? first.offsetWidth + 12 : 0;\n if (step > 0) setCurrent(Math.min(total, Math.max(1, Math.round(list.scrollLeft / step) + 1)));\n };\n return (\n <div className={cn(\"kz-sg\", className)} data-count={total} data-strip={strip || undefined} data-more={total > BENTO || undefined} role=\"group\" aria-label={label} {...props}>\n <style>{styles}</style>\n <ul className=\"kz-sg-list\" onScroll={strip ? onScroll : undefined}>\n {photos.map((photo, i) => (\n <li key={photo.id}>\n <button\n type=\"button\"\n ref={(node) => {\n tiles.current[i] = node;\n }}\n className=\"kz-sg-tile\"\n aria-label={i === BENTO - 1 && total > BENTO ? `${labels.more(total - BENTO + 1)}: ${labels.open(photo.alt, i + 1, total)}` : labels.open(photo.alt, i + 1, total)}\n onClick={() => {\n opener.current = i;\n setOpen(i);\n }}\n >\n <img src={photo.src} srcSet={photo.srcSet} sizes={photo.srcSet ? tileSizes : undefined} alt=\"\" loading=\"lazy\" decoding=\"async\" />\n {i === BENTO - 1 && total > BENTO && <span className=\"kz-sg-more\" aria-hidden>{labels.more(total - BENTO + 1)}</span>}\n </button>\n </li>\n ))}\n </ul>\n {strip && <p className=\"kz-sg-count\" aria-hidden>{labels.counter(current, total)}</p>}\n {open !== null && (\n <React.Suspense fallback={null}>\n <Lightbox\n photos={photos}\n index={open}\n onIndexChange={setOpen}\n onClose={() => setOpen(null)}\n label={label}\n labels={labels}\n returnFocus={() => tiles.current[opener.current] ?? null}\n />\n </React.Suspense>\n )}\n </div>\n );\n}\n"
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"dependencies": [],
|
|
164
|
+
"registryDependencies": [
|
|
165
|
+
"button",
|
|
166
|
+
"cn",
|
|
167
|
+
"dialog"
|
|
168
|
+
],
|
|
169
|
+
"demo": {
|
|
170
|
+
"path": "examples/shop-gallery/five.tsx",
|
|
171
|
+
"content": "import { ShopGallery } from \"@krizaka/ui/shop-gallery\";\n\n// Drawn pictures (data URIs, no network); a shop passes its own photos, with the srcSet of the widths it holds.\nconst PIC = (a: string, b: string) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 600'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='${a}'/><stop offset='1' stop-color='${b}'/></linearGradient></defs><rect width='800' height='600' fill='url(#g)'/></svg>`)}`;\nconst ALTS = [\"Two chairs by the window\",\"The colour bar\",\"A fresh cut\",\"Morning light on the mirrors\",\"Our shampoo corner\",\"Tools laid out\",\"The front desk\",\"A waiting sofa\",\"Plants by the door\",\"The back room\",\"Evening at the shop\",\"The street sign\"];\nconst photos = ALTS.slice(0, 5).map((alt, i) => ({ id: `p${i}`, src: PIC(`hsl(${(i * 31) % 360} 45% 32%)`, `hsl(${(i * 31 + 50) % 360} 55% 58%)`), alt }));\n\nexport default function ShopGalleryFive() {\n return <ShopGallery label=\"Photos of the salon\" photos={photos} />;\n}\n"
|
|
172
|
+
},
|
|
173
|
+
"props": [
|
|
174
|
+
{
|
|
175
|
+
"component": "ShopGallery",
|
|
176
|
+
"description": "A shop's photos: a bento mosaic (one 2×2 lead and four tiles, the last one « + N photos »), a snap strip on a phone, and a lightbox.",
|
|
177
|
+
"props": [
|
|
178
|
+
{
|
|
179
|
+
"name": "label",
|
|
180
|
+
"type": "string",
|
|
181
|
+
"default": null,
|
|
182
|
+
"description": "The gallery's accessible name (`Photos of the salon`).",
|
|
183
|
+
"required": true
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"name": "photos",
|
|
187
|
+
"type": "readonly ShopGalleryPhoto[]",
|
|
188
|
+
"default": null,
|
|
189
|
+
"description": "The shop's photos, in order, already unique.",
|
|
190
|
+
"required": true
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "labels",
|
|
194
|
+
"type": "Partial<ShopGalleryLabels>",
|
|
195
|
+
"default": null,
|
|
196
|
+
"description": "Translated texts; `shopGalleryLabelsFr` for French.",
|
|
197
|
+
"required": false
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"name": "sizes",
|
|
201
|
+
"type": "string",
|
|
202
|
+
"default": null,
|
|
203
|
+
"description": "The tiles' `sizes` (default: the bento's share of a 72 rem page on a desktop, 78 vw on a phone).",
|
|
204
|
+
"required": false
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|