@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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type DiffLine = {
|
|
4
|
+
/** `removed` (−), `added` (+) or `context` (unchanged). */
|
|
5
|
+
kind: "added" | "removed" | "context";
|
|
6
|
+
/** The line's text, without its sign. */
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
9
|
+
type DiffViewWords = {
|
|
10
|
+
/** The group's accessible name: « Proposed changes ». */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Read before an added line: « Added ». */
|
|
13
|
+
added: string;
|
|
14
|
+
/** Read before a removed line: « Removed ». */
|
|
15
|
+
removed: string;
|
|
16
|
+
/** Read before an unchanged line: « Unchanged ». */
|
|
17
|
+
unchanged: string;
|
|
18
|
+
};
|
|
19
|
+
type DiffViewProps = Omit<React.ComponentProps<"div">, "children"> & {
|
|
20
|
+
/** The lines of the change, in order. */
|
|
21
|
+
lines: readonly DiffLine[];
|
|
22
|
+
/** The words, passed translated. */
|
|
23
|
+
words: DiffViewWords;
|
|
24
|
+
};
|
|
25
|
+
/** The lines of a change, signed and labelled; colour only reinforces. */
|
|
26
|
+
declare function DiffView({ lines, words, className, ...props }: Readonly<DiffViewProps>): React.JSX.Element;
|
|
27
|
+
|
|
28
|
+
type ProposalState = "waiting" | "approved" | "rejected" | "expired";
|
|
29
|
+
type ProposalConfidence = {
|
|
30
|
+
/** In words: « High confidence », never colour alone. */
|
|
31
|
+
label: string;
|
|
32
|
+
/** 0 to 100, shown beside the words when given. */
|
|
33
|
+
percent?: number;
|
|
34
|
+
/** `high` · `medium` · `low`: the tone of the chip. */
|
|
35
|
+
level: "high" | "medium" | "low";
|
|
36
|
+
};
|
|
37
|
+
type ProposalWords = {
|
|
38
|
+
/** « Approve » */
|
|
39
|
+
approve: string;
|
|
40
|
+
/** « Reject » */
|
|
41
|
+
reject: string;
|
|
42
|
+
/** Shown only when `onEdit` is given. */
|
|
43
|
+
edit?: string;
|
|
44
|
+
/** What the second press of an irreversible approval does: « Approve for good? ». */
|
|
45
|
+
confirmApprove: string;
|
|
46
|
+
/** The states in words, announced when they change. */
|
|
47
|
+
states: Record<ProposalState, string>;
|
|
48
|
+
};
|
|
49
|
+
type ProposalReviewProps = Omit<React.ComponentProps<"section">, "title" | "children"> & {
|
|
50
|
+
/** The agent that proposes: its name, with its bird or mark in `mark`. */
|
|
51
|
+
agent: string;
|
|
52
|
+
/** The agent's bird or mark, drawn small beside its name. */
|
|
53
|
+
mark?: React.ReactNode;
|
|
54
|
+
/** What it proposes, in one sentence. */
|
|
55
|
+
summary: string;
|
|
56
|
+
/** How sure the agent is: in words, with the figure when known. */
|
|
57
|
+
confidence: ProposalConfidence;
|
|
58
|
+
/** The evidence: a `DiffView`, a list, a quote. */
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
/** Where the decision stands; the host owns it. */
|
|
61
|
+
state: ProposalState;
|
|
62
|
+
/** BCP 47 language for the percentage. */
|
|
63
|
+
locale?: string;
|
|
64
|
+
/** The words, passed translated. */
|
|
65
|
+
words: ProposalWords;
|
|
66
|
+
/** The person approves. */
|
|
67
|
+
onApprove: () => void;
|
|
68
|
+
/** The person rejects. */
|
|
69
|
+
onReject: () => void;
|
|
70
|
+
/** The person edits the proposal first; the button shows only when given. */
|
|
71
|
+
onEdit?: () => void;
|
|
72
|
+
/** The approval cannot be undone: it takes two presses. */
|
|
73
|
+
irreversible?: boolean;
|
|
74
|
+
/** Blocks the actions while the host saves the decision. */
|
|
75
|
+
busy?: boolean;
|
|
76
|
+
};
|
|
77
|
+
/** One proposal of an agent, its evidence, and the person's decision. */
|
|
78
|
+
declare function ProposalReview({ agent, mark, summary, confidence, children, state, locale, words, onApprove, onReject, onEdit, irreversible, busy, className, ...props }: Readonly<ProposalReviewProps>): React.JSX.Element;
|
|
79
|
+
|
|
80
|
+
export { DiffView, ProposalReview };
|
|
81
|
+
export type { DiffLine, DiffViewProps, DiffViewWords, ProposalConfidence, ProposalReviewProps, ProposalState, ProposalWords };
|
package/dist/proposal.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ConfirmButton
|
|
4
|
+
} from "./chunk-2FCQCWIK.js";
|
|
5
|
+
import {
|
|
6
|
+
Badge
|
|
7
|
+
} from "./chunk-S4TLZRGZ.js";
|
|
8
|
+
import {
|
|
9
|
+
Button
|
|
10
|
+
} from "./chunk-V7W4RLRW.js";
|
|
11
|
+
import "./chunk-D3T54RSL.js";
|
|
12
|
+
import "./chunk-WEVYKZIF.js";
|
|
13
|
+
import {
|
|
14
|
+
cn
|
|
15
|
+
} from "./chunk-NSLXEDIS.js";
|
|
16
|
+
|
|
17
|
+
// src/proposal/diff-view.tsx
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var SIGN = { added: "+", removed: "\u2212", context: " " };
|
|
20
|
+
var TONE = {
|
|
21
|
+
added: "bg-success/10 text-fg",
|
|
22
|
+
removed: "bg-danger/10 text-fg",
|
|
23
|
+
context: "text-fg-secondary"
|
|
24
|
+
};
|
|
25
|
+
function DiffView({ lines, words, className, ...props }) {
|
|
26
|
+
const spoken = { added: words.added, removed: words.removed, context: words.unchanged };
|
|
27
|
+
return /* @__PURE__ */ jsx("div", { role: "group", "aria-label": words.label, "data-diff": "", className: cn("overflow-hidden rounded-lg border border-border bg-surface-1 font-mono text-xs", className), ...props, children: lines.map((line, index) => /* @__PURE__ */ jsxs("div", { "data-kind": line.kind, className: cn("flex gap-2 px-3 py-1", TONE[line.kind]), children: [
|
|
28
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "w-3 shrink-0 select-none text-center font-semibold", children: SIGN[line.kind] }),
|
|
29
|
+
/* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
30
|
+
spoken[line.kind],
|
|
31
|
+
": "
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 whitespace-pre-wrap break-words", children: line.text })
|
|
34
|
+
] }, `${index}-${line.kind}`)) });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/proposal/proposal-review.tsx
|
|
38
|
+
import * as React from "react";
|
|
39
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
40
|
+
var TONES = { high: "success", medium: "accent", low: "warning" };
|
|
41
|
+
function ProposalReview({ agent, mark, summary, confidence, children, state, locale, words, onApprove, onReject, onEdit, irreversible = false, busy = false, className, ...props }) {
|
|
42
|
+
const headingId = React.useId();
|
|
43
|
+
const percent = confidence.percent === void 0 ? null : new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 }).format(confidence.percent / 100);
|
|
44
|
+
return /* @__PURE__ */ jsxs2("section", { "aria-labelledby": headingId, "data-state": state, className: cn("flex flex-col gap-3 rounded-xl border border-border bg-surface-1 p-4", className), ...props, children: [
|
|
45
|
+
/* @__PURE__ */ jsxs2("header", { className: "flex flex-wrap items-center justify-between gap-x-3 gap-y-2", children: [
|
|
46
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
47
|
+
mark && /* @__PURE__ */ jsx2("span", { className: "h-8 w-8 shrink-0 [&>*]:h-full [&>*]:w-full", children: mark }),
|
|
48
|
+
/* @__PURE__ */ jsx2("p", { id: headingId, className: "min-w-0 text-sm font-semibold break-words text-fg", children: agent })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsxs2(Badge, { tone: TONES[confidence.level], dot: true, children: [
|
|
51
|
+
confidence.label,
|
|
52
|
+
percent && ` \xB7 ${percent}`
|
|
53
|
+
] })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ jsx2("p", { className: "text-base text-fg", children: summary }),
|
|
56
|
+
children,
|
|
57
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
58
|
+
state === "waiting" ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
59
|
+
irreversible ? /* @__PURE__ */ jsx2(ConfirmButton, { variant: "primary", size: "md", disabled: busy, confirmLabel: words.confirmApprove, onConfirm: onApprove, children: words.approve }) : /* @__PURE__ */ jsx2(Button, { variant: "primary", size: "md", disabled: busy, onClick: onApprove, children: words.approve }),
|
|
60
|
+
/* @__PURE__ */ jsx2(Button, { variant: "secondary", size: "md", disabled: busy, onClick: onReject, children: words.reject }),
|
|
61
|
+
onEdit && words.edit && /* @__PURE__ */ jsx2(Button, { variant: "ghost", size: "md", disabled: busy, onClick: onEdit, children: words.edit })
|
|
62
|
+
] }) : null,
|
|
63
|
+
/* @__PURE__ */ jsx2("output", { "data-proposal-state": state, className: cn("text-sm font-medium", state === "waiting" ? "sr-only" : "text-fg-secondary"), children: words.states[state] })
|
|
64
|
+
] })
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
DiffView,
|
|
69
|
+
ProposalReview
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=proposal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/proposal/diff-view.tsx","../src/proposal/proposal-review.tsx"],"sourcesContent":["// Server-safe: no hook. Removed and added lines of a proposal: each line carries a sign (− or +) AND a text label for\n// screen readers, so the colour is never the only signal. Long lines wrap (a phone has no horizontal scroll).\nimport type * as React from \"react\";\n\nimport { cn } from \"../cn\";\n\nexport type DiffLine = {\n /** `removed` (−), `added` (+) or `context` (unchanged). */\n kind: \"added\" | \"removed\" | \"context\";\n /** The line's text, without its sign. */\n text: string;\n};\n\nexport type DiffViewWords = {\n /** The group's accessible name: « Proposed changes ». */\n label: string;\n /** Read before an added line: « Added ». */\n added: string;\n /** Read before a removed line: « Removed ». */\n removed: string;\n /** Read before an unchanged line: « Unchanged ». */\n unchanged: string;\n};\n\nexport type DiffViewProps = Omit<React.ComponentProps<\"div\">, \"children\"> & {\n /** The lines of the change, in order. */\n lines: readonly DiffLine[];\n /** The words, passed translated. */\n words: DiffViewWords;\n};\n\nconst SIGN = { added: \"+\", removed: \"−\", context: \" \" } as const;\nconst TONE = {\n added: \"bg-success/10 text-fg\",\n removed: \"bg-danger/10 text-fg\",\n context: \"text-fg-secondary\",\n} as const;\n\n/** The lines of a change, signed and labelled; colour only reinforces. */\nexport function DiffView({ lines, words, className, ...props }: Readonly<DiffViewProps>) {\n const spoken = { added: words.added, removed: words.removed, context: words.unchanged } as const;\n return (\n <div role=\"group\" aria-label={words.label} data-diff=\"\" className={cn(\"overflow-hidden rounded-lg border border-border bg-surface-1 font-mono text-xs\", className)} {...props}>\n {lines.map((line, index) => (\n <div key={`${index}-${line.kind}`} data-kind={line.kind} className={cn(\"flex gap-2 px-3 py-1\", TONE[line.kind])}>\n <span aria-hidden className=\"w-3 shrink-0 select-none text-center font-semibold\">\n {SIGN[line.kind]}\n </span>\n <span className=\"sr-only\">{spoken[line.kind]}: </span>\n <span className=\"min-w-0 whitespace-pre-wrap break-words\">{line.text}</span>\n </div>\n ))}\n </div>\n );\n}\n","\"use client\";\n// Client (the two-step confirmation lives in ConfirmButton). An agent proposes, a person approves, rejects or edits. The\n// host owns the state (`waiting` · `approved` · `rejected` · `expired`) and announces it here; the block never decides\n// for the person. No slide-to-approve (ADR-006): a button, reachable by keyboard and read by a screen reader.\nimport * as React from \"react\";\n\nimport { Badge } from \"../badge/badge\";\nimport { Button } from \"../button/button\";\nimport { cn } from \"../cn\";\nimport { ConfirmButton } from \"../confirm-button/confirm-button\";\n\nexport type ProposalState = \"waiting\" | \"approved\" | \"rejected\" | \"expired\";\n\nexport type ProposalConfidence = {\n /** In words: « High confidence », never colour alone. */\n label: string;\n /** 0 to 100, shown beside the words when given. */\n percent?: number;\n /** `high` · `medium` · `low`: the tone of the chip. */\n level: \"high\" | \"medium\" | \"low\";\n};\n\nexport type ProposalWords = {\n /** « Approve » */\n approve: string;\n /** « Reject » */\n reject: string;\n /** Shown only when `onEdit` is given. */\n edit?: string;\n /** What the second press of an irreversible approval does: « Approve for good? ». */\n confirmApprove: string;\n /** The states in words, announced when they change. */\n states: Record<ProposalState, string>;\n};\n\nexport type ProposalReviewProps = Omit<React.ComponentProps<\"section\">, \"title\" | \"children\"> & {\n /** The agent that proposes: its name, with its bird or mark in `mark`. */\n agent: string;\n /** The agent's bird or mark, drawn small beside its name. */\n mark?: React.ReactNode;\n /** What it proposes, in one sentence. */\n summary: string;\n /** How sure the agent is: in words, with the figure when known. */\n confidence: ProposalConfidence;\n /** The evidence: a `DiffView`, a list, a quote. */\n children?: React.ReactNode;\n /** Where the decision stands; the host owns it. */\n state: ProposalState;\n /** BCP 47 language for the percentage. */\n locale?: string;\n /** The words, passed translated. */\n words: ProposalWords;\n /** The person approves. */\n onApprove: () => void;\n /** The person rejects. */\n onReject: () => void;\n /** The person edits the proposal first; the button shows only when given. */\n onEdit?: () => void;\n /** The approval cannot be undone: it takes two presses. */\n irreversible?: boolean;\n /** Blocks the actions while the host saves the decision. */\n busy?: boolean;\n};\n\nconst TONES = { high: \"success\", medium: \"accent\", low: \"warning\" } as const;\n\n/** One proposal of an agent, its evidence, and the person's decision. */\nexport function ProposalReview({ agent, mark, summary, confidence, children, state, locale, words, onApprove, onReject, onEdit, irreversible = false, busy = false, className, ...props }: Readonly<ProposalReviewProps>) {\n const headingId = React.useId();\n const percent = confidence.percent === undefined ? null : new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 }).format(confidence.percent / 100);\n return (\n <section aria-labelledby={headingId} data-state={state} className={cn(\"flex flex-col gap-3 rounded-xl border border-border bg-surface-1 p-4\", className)} {...props}>\n <header className=\"flex flex-wrap items-center justify-between gap-x-3 gap-y-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n {mark && <span className=\"h-8 w-8 shrink-0 [&>*]:h-full [&>*]:w-full\">{mark}</span>}\n <p id={headingId} className=\"min-w-0 text-sm font-semibold break-words text-fg\">\n {agent}\n </p>\n </div>\n <Badge tone={TONES[confidence.level]} dot>\n {confidence.label}\n {percent && ` · ${percent}`}\n </Badge>\n </header>\n <p className=\"text-base text-fg\">{summary}</p>\n {children}\n <div className=\"flex flex-wrap items-center gap-2\">\n {state === \"waiting\" ? (\n <>\n {irreversible ? (\n <ConfirmButton variant=\"primary\" size=\"md\" disabled={busy} confirmLabel={words.confirmApprove} onConfirm={onApprove}>\n {words.approve}\n </ConfirmButton>\n ) : (\n <Button variant=\"primary\" size=\"md\" disabled={busy} onClick={onApprove}>\n {words.approve}\n </Button>\n )}\n <Button variant=\"secondary\" size=\"md\" disabled={busy} onClick={onReject}>\n {words.reject}\n </Button>\n {onEdit && words.edit && (\n <Button variant=\"ghost\" size=\"md\" disabled={busy} onClick={onEdit}>\n {words.edit}\n </Button>\n )}\n </>\n ) : null}\n <output data-proposal-state={state} className={cn(\"text-sm font-medium\", state === \"waiting\" ? \"sr-only\" : \"text-fg-secondary\")}>\n {words.states[state]}\n </output>\n </div>\n </section>\n );\n}\n"],"mappings":"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","names":["jsx","jsxs"]}
|
package/dist/shop/booking.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { L as LinkComponent } from '../block-link-BAg4eoZk.js';
|
|
3
|
+
import { ShopPhoto } from '../shop.js';
|
|
3
4
|
|
|
4
|
-
type BookingVariant = "strip" | "panel" | "sticky";
|
|
5
|
+
type BookingVariant = "strip" | "panel" | "closing" | "sticky";
|
|
6
|
+
/** `closing`: the second action beside « Book » (`Call`, `Directions`): the host chooses it from the shop's settings. */
|
|
7
|
+
type BookingSecondary = {
|
|
8
|
+
label: string;
|
|
9
|
+
href: string;
|
|
10
|
+
};
|
|
5
11
|
type BookingTime = {
|
|
6
12
|
id: string;
|
|
7
13
|
/** In words, formatted by the app (`Today 4:30 pm`). */
|
|
@@ -25,12 +31,25 @@ type BookingSectionProps = Omit<React.ComponentProps<"section">, "title"> & {
|
|
|
25
31
|
/** `panel`: the invitation (`Ready when you are`), and why. */
|
|
26
32
|
title?: React.ReactNode;
|
|
27
33
|
body?: React.ReactNode;
|
|
34
|
+
/** `closing`: the shop's photo, one the page does not already show (the host plans it). Wins over `mark`. */
|
|
35
|
+
photo?: ShopPhoto;
|
|
36
|
+
/** `closing`: the shop's mark, when there is no photo. Decorative (hidden from assistive technology). */
|
|
37
|
+
mark?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* `closing`: the next free time (`Tomorrow 9 am`). On a closed day it is the next opening's. Absent, the call is the
|
|
40
|
+
* title and the primary action alone: never an empty box.
|
|
41
|
+
*/
|
|
42
|
+
nextTime?: BookingTime;
|
|
43
|
+
/** `closing`: the words before the time (`Next free time`). */
|
|
44
|
+
nextTimeLabel?: string;
|
|
45
|
+
/** `closing`: « Call » or « Directions ». */
|
|
46
|
+
secondary?: BookingSecondary;
|
|
28
47
|
linkAs?: LinkComponent;
|
|
29
48
|
/** `sticky`: the selector of the page's own action (`#hero-book`): while it is on screen the bar hides. */
|
|
30
49
|
hideWhileVisible?: string;
|
|
31
50
|
};
|
|
32
51
|
/** The way to book: the next free times, a closing call, or the phone bar. */
|
|
33
|
-
declare function BookingSection({ variant, times, label, emptyLabel, href, actionLabel, title, body, linkAs, hideWhileVisible, className, ...props }: BookingSectionProps): React.JSX.Element;
|
|
52
|
+
declare function BookingSection({ variant, times, label, emptyLabel, href, actionLabel, title, body, linkAs, hideWhileVisible, photo, mark, nextTime, nextTimeLabel, secondary, className, ...props }: BookingSectionProps): React.JSX.Element;
|
|
34
53
|
|
|
35
54
|
export { BookingSection };
|
|
36
|
-
export type { BookingSectionProps, BookingTime, BookingVariant };
|
|
55
|
+
export type { BookingSecondary, BookingSectionProps, BookingTime, BookingVariant };
|
package/dist/shop/booking.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlockLink
|
|
3
3
|
} from "../chunk-HKEAYSFS.js";
|
|
4
|
+
import {
|
|
5
|
+
Photo
|
|
6
|
+
} from "../chunk-5D7NMUF6.js";
|
|
4
7
|
import {
|
|
5
8
|
ShopSection
|
|
6
9
|
} from "../chunk-A7MQPIEG.js";
|
|
7
10
|
import {
|
|
11
|
+
Page,
|
|
8
12
|
cn
|
|
9
13
|
} from "../chunk-B47WSPMP.js";
|
|
10
14
|
|
|
@@ -12,12 +16,40 @@ import {
|
|
|
12
16
|
import { buttonVariants } from "@krizaka/ui/button";
|
|
13
17
|
import { CtaPanel } from "@krizaka/ui/cta-panel";
|
|
14
18
|
import { StickyAction } from "@krizaka/ui/sticky-action";
|
|
19
|
+
import * as React from "react";
|
|
15
20
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
function
|
|
21
|
+
function ClosingMedia({ photo, mark }) {
|
|
22
|
+
if (photo) return /* @__PURE__ */ jsx(Photo, { photo, ratio: "4/3", sizes: "(min-width: 64rem) 36rem, calc(100vw - 2rem)" });
|
|
23
|
+
if (!mark) return null;
|
|
24
|
+
return /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "grid aspect-[4/3] w-full place-items-center overflow-hidden rounded-xl bg-accent-soft text-fg-accent [&>svg]:h-1/2 [&>svg]:w-auto", children: mark });
|
|
25
|
+
}
|
|
26
|
+
function ClosingCall({ title, body, photo, mark, nextTime, nextTimeLabel, secondary, href, actionLabel, linkAs, className, ...props }) {
|
|
27
|
+
const headingId = React.useId();
|
|
28
|
+
const hasMedia = Boolean(photo ?? mark);
|
|
29
|
+
return /* @__PURE__ */ jsx(ShopSection, { "aria-labelledby": headingId, "data-variant": "closing", bleed: true, className, ...props, children: /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsxs("div", { className: cn("grid items-center gap-6 rounded-2xl bg-surface-1 p-4 sm:p-6 lg:gap-10 lg:p-8", hasMedia && "lg:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]"), children: [
|
|
30
|
+
/* @__PURE__ */ jsx(ClosingMedia, { photo, mark }),
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col items-start gap-4", children: [
|
|
32
|
+
/* @__PURE__ */ jsx("h2", { id: headingId, className: "m-0 text-2xl font-bold leading-tight text-fg sm:text-3xl", children: title }),
|
|
33
|
+
body ? /* @__PURE__ */ jsx("p", { className: "m-0 max-w-prose text-[15px] leading-relaxed text-fg-secondary", children: body }) : null,
|
|
34
|
+
nextTime ? /* @__PURE__ */ jsxs("p", { className: "m-0 flex flex-wrap items-center gap-2 text-sm text-fg-secondary", children: [
|
|
35
|
+
nextTimeLabel ? /* @__PURE__ */ jsx("span", { children: nextTimeLabel }) : null,
|
|
36
|
+
/* @__PURE__ */ jsx(BlockLink, { href: nextTime.href, linkAs, className: "inline-flex min-h-11 items-center rounded-md border border-border-control bg-surface-2 px-3 text-sm font-semibold tabular-nums text-fg no-underline hover:border-accent hover:bg-accent-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", children: nextTime.label })
|
|
37
|
+
] }) : null,
|
|
38
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
39
|
+
/* @__PURE__ */ jsx(BlockLink, { href, linkAs, className: cn(buttonVariants({ variant: "primary", size: "lg" }), "no-underline"), children: actionLabel }),
|
|
40
|
+
secondary ? /* @__PURE__ */ jsx(BlockLink, { href: secondary.href, linkAs, className: cn(buttonVariants({ variant: "secondary", size: "lg" }), "no-underline"), children: secondary.label }) : null
|
|
41
|
+
] })
|
|
42
|
+
] })
|
|
43
|
+
] }) }) });
|
|
44
|
+
}
|
|
45
|
+
function BookingSection({ variant = "strip", times = [], label, emptyLabel, href, actionLabel, title, body, linkAs, hideWhileVisible, photo, mark, nextTime, nextTimeLabel, secondary, className, ...props }) {
|
|
17
46
|
const action = (size) => /* @__PURE__ */ jsx(BlockLink, { href, linkAs, className: cn(buttonVariants({ variant: "primary", size }), "no-underline"), children: actionLabel });
|
|
18
47
|
if (variant === "sticky") {
|
|
19
48
|
return /* @__PURE__ */ jsx(StickyAction, { hideWhileVisible, "data-variant": "sticky", className, ...props, children: /* @__PURE__ */ jsx(BlockLink, { href, linkAs, className: cn(buttonVariants({ variant: "primary", size: "lg" }), "w-full justify-center no-underline"), children: actionLabel }) });
|
|
20
49
|
}
|
|
50
|
+
if (variant === "closing") {
|
|
51
|
+
return /* @__PURE__ */ jsx(ClosingCall, { title: title ?? label, body, photo, mark, nextTime, nextTimeLabel, secondary, href, actionLabel, linkAs, className, ...props });
|
|
52
|
+
}
|
|
21
53
|
if (variant === "panel") {
|
|
22
54
|
return /* @__PURE__ */ jsx(ShopSection, { "aria-label": typeof title === "string" ? title : label, "data-variant": "panel", className, ...props, children: /* @__PURE__ */ jsx(CtaPanel, { title: title ?? label, body, children: action("lg") }) });
|
|
23
55
|
}
|
package/dist/shop/booking.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shop/booking/booking.tsx"],"sourcesContent":["// Server-safe (the phone bar is a client island imported through its own entry). The way to book (ADR-007 §3): `strip` —\n// the next free times, one tap each, in one line; `panel` — the closing call; `sticky` — the phone bar, held at the bottom\n// edge and never over content. The times are resolved by the product: the section draws them, it never fetches.\nimport { buttonVariants } from \"@krizaka/ui/button\";\nimport { CtaPanel } from \"@krizaka/ui/cta-panel\";\nimport { StickyAction } from \"@krizaka/ui/sticky-action\";\nimport * as React from \"react\";\n\nimport { BlockLink, type LinkComponent } from \"../../block-link\";\nimport { cn } from \"../../cn\";\nimport { ShopSection } from \"../frame\";\n\nexport type BookingVariant = \"strip\" | \"panel\" | \"sticky\";\n\nexport type BookingTime = {\n id: string;\n /** In words, formatted by the app (`Today 4:30 pm`). */\n label: string;\n /** The booking page with this time chosen. */\n href: string;\n};\n\nexport type BookingSectionProps = Omit<React.ComponentProps<\"section\">, \"title\"> & {\n /** @default \"strip\" */\n variant?: BookingVariant;\n /** `strip`: the next free times, in order (the first `count`). */\n times?: readonly BookingTime[];\n /** `strip`: the group's name (`Next free times`). */\n label: string;\n /** `strip`: said when no time is free. */\n emptyLabel?: string;\n /** The booking page (`All times →`, `Book`). */\n href: string;\n /** The words of that link / button. */\n actionLabel: string;\n /** `panel`: the invitation (`Ready when you are`), and why. */\n title?: React.ReactNode;\n body?: React.ReactNode;\n linkAs?: LinkComponent;\n /** `sticky`: the selector of the page's own action (`#hero-book`): while it is on screen the bar hides. */\n hideWhileVisible?: string;\n};\n\n/** The way to book: the next free times, a closing call, or the phone bar. */\nexport function BookingSection({ variant = \"strip\", times = [], label, emptyLabel, href, actionLabel, title, body, linkAs, hideWhileVisible, className, ...props }: BookingSectionProps) {\n const action = (size: \"md\" | \"lg\") => (\n <BlockLink href={href} linkAs={linkAs} className={cn(buttonVariants({ variant: \"primary\", size }), \"no-underline\")}>\n {actionLabel}\n </BlockLink>\n );\n if (variant === \"sticky\") {\n return (\n <StickyAction hideWhileVisible={hideWhileVisible} data-variant=\"sticky\" className={className} {...(props as object)}>\n <BlockLink href={href} linkAs={linkAs} className={cn(buttonVariants({ variant: \"primary\", size: \"lg\" }), \"w-full justify-center no-underline\")}>\n {actionLabel}\n </BlockLink>\n </StickyAction>\n );\n }\n if (variant === \"panel\") {\n return (\n <ShopSection aria-label={typeof title === \"string\" ? title : label} data-variant=\"panel\" className={className} {...props}>\n <CtaPanel title={title ?? label} body={body}>\n {action(\"lg\")}\n </CtaPanel>\n </ShopSection>\n );\n }\n return (\n <ShopSection aria-label={label} data-variant=\"strip\" className={className} {...props}>\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-border-default bg-surface-1 p-3 sm:px-4\">\n <p className=\"m-0 order-1 text-sm font-semibold text-fg\">{label}</p>\n {times.length > 0 ? (\n <ul className=\"m-0 order-3 grid w-full list-none grid-cols-2 gap-2 p-0 sm:order-2 sm:flex sm:w-auto sm:min-w-0 sm:flex-1 sm:flex-wrap\">\n {times.map((t) => (\n <li key={t.id}>\n <BlockLink href={t.href} linkAs={linkAs} className=\"inline-flex min-h-11 items-center rounded-md border border-border-control bg-surface-2 px-3 text-[13px] font-semibold tabular-nums text-fg no-underline hover:border-accent hover:bg-accent-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\">\n {t.label}\n </BlockLink>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"m-0 order-3 w-full text-sm text-fg-secondary sm:order-2 sm:w-auto sm:flex-1\">{emptyLabel}</p>\n )}\n <BlockLink href={href} linkAs={linkAs} className=\"order-2 ml-auto inline-flex min-h-11 items-center gap-1 text-[13px] sm:order-3 font-semibold text-fg-accent no-underline hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\">\n {actionLabel} <span aria-hidden>→</span>\n </BlockLink>\n </div>\n </ShopSection>\n );\n}\n"],"mappings":";;;;;;;;;;;AAGA,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAyCzB,cAuCI,YAvCJ;AAFG,SAAS,eAAe,EAAE,UAAU,SAAS,QAAQ,CAAC,GAAG,OAAO,YAAY,MAAM,aAAa,OAAO,MAAM,QAAQ,kBAAkB,WAAW,GAAG,MAAM,GAAwB;AACvL,QAAM,SAAS,CAAC,SACd,oBAAC,aAAU,MAAY,QAAgB,WAAW,GAAG,eAAe,EAAE,SAAS,WAAW,KAAK,CAAC,GAAG,cAAc,GAC9G,uBACH;AAEF,MAAI,YAAY,UAAU;AACxB,WACE,oBAAC,gBAAa,kBAAoC,gBAAa,UAAS,WAAuB,GAAI,OACjG,8BAAC,aAAU,MAAY,QAAgB,WAAW,GAAG,eAAe,EAAE,SAAS,WAAW,MAAM,KAAK,CAAC,GAAG,oCAAoC,GAC1I,uBACH,GACF;AAAA,EAEJ;AACA,MAAI,YAAY,SAAS;AACvB,WACE,oBAAC,eAAY,cAAY,OAAO,UAAU,WAAW,QAAQ,OAAO,gBAAa,SAAQ,WAAuB,GAAG,OACjH,8BAAC,YAAS,OAAO,SAAS,OAAO,MAC9B,iBAAO,IAAI,GACd,GACF;AAAA,EAEJ;AACA,SACE,oBAAC,eAAY,cAAY,OAAO,gBAAa,SAAQ,WAAuB,GAAG,OAC7E,+BAAC,SAAI,WAAU,gHACb;AAAA,wBAAC,OAAE,WAAU,6CAA6C,iBAAM;AAAA,IAC/D,MAAM,SAAS,IACd,oBAAC,QAAG,WAAU,0HACX,gBAAM,IAAI,CAAC,MACV,oBAAC,QACC,8BAAC,aAAU,MAAM,EAAE,MAAM,QAAgB,WAAU,sRAChD,YAAE,OACL,KAHO,EAAE,EAIX,CACD,GACH,IAEA,oBAAC,OAAE,WAAU,+EAA+E,sBAAW;AAAA,IAEzG,qBAAC,aAAU,MAAY,QAAgB,WAAU,8NAC9C;AAAA;AAAA,MAAY;AAAA,MAAC,oBAAC,UAAK,eAAW,MAAC,oBAAC;AAAA,OACnC;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/shop/booking/booking.tsx"],"sourcesContent":["// Server-safe (the phone bar is a client island imported through its own entry). The way to book (ADR-007 §3): `strip` —\n// the next free times, one tap each, in one line; `panel` — the closing call in a box; `closing` — the closing call of a look (the shop's photo or mark, the next free time, Book); `sticky` — the phone bar, held at the bottom\n// edge and never over content. The times are resolved by the product: the section draws them, it never fetches.\nimport { buttonVariants } from \"@krizaka/ui/button\";\nimport { CtaPanel } from \"@krizaka/ui/cta-panel\";\nimport { StickyAction } from \"@krizaka/ui/sticky-action\";\nimport * as React from \"react\";\n\nimport { BlockLink, type LinkComponent } from \"../../block-link\";\nimport { cn } from \"../../cn\";\nimport { Page } from \"../../page/page\";\nimport { type ShopPhoto, ShopSection } from \"../frame\";\nimport { Photo } from \"../photo\";\n\nexport type BookingVariant = \"strip\" | \"panel\" | \"closing\" | \"sticky\";\n\n/** `closing`: the second action beside « Book » (`Call`, `Directions`): the host chooses it from the shop's settings. */\nexport type BookingSecondary = { label: string; href: string };\n\nexport type BookingTime = {\n id: string;\n /** In words, formatted by the app (`Today 4:30 pm`). */\n label: string;\n /** The booking page with this time chosen. */\n href: string;\n};\n\nexport type BookingSectionProps = Omit<React.ComponentProps<\"section\">, \"title\"> & {\n /** @default \"strip\" */\n variant?: BookingVariant;\n /** `strip`: the next free times, in order (the first `count`). */\n times?: readonly BookingTime[];\n /** `strip`: the group's name (`Next free times`). */\n label: string;\n /** `strip`: said when no time is free. */\n emptyLabel?: string;\n /** The booking page (`All times →`, `Book`). */\n href: string;\n /** The words of that link / button. */\n actionLabel: string;\n /** `panel`: the invitation (`Ready when you are`), and why. */\n title?: React.ReactNode;\n body?: React.ReactNode;\n /** `closing`: the shop's photo, one the page does not already show (the host plans it). Wins over `mark`. */\n photo?: ShopPhoto;\n /** `closing`: the shop's mark, when there is no photo. Decorative (hidden from assistive technology). */\n mark?: React.ReactNode;\n /**\n * `closing`: the next free time (`Tomorrow 9 am`). On a closed day it is the next opening's. Absent, the call is the\n * title and the primary action alone: never an empty box.\n */\n nextTime?: BookingTime;\n /** `closing`: the words before the time (`Next free time`). */\n nextTimeLabel?: string;\n /** `closing`: « Call » or « Directions ». */\n secondary?: BookingSecondary;\n linkAs?: LinkComponent;\n /** `sticky`: the selector of the page's own action (`#hero-book`): while it is on screen the bar hides. */\n hideWhileVisible?: string;\n};\n\ntype ClosingCallProps = Omit<React.ComponentProps<\"section\">, \"title\"> &\n Pick<BookingSectionProps, \"body\" | \"photo\" | \"mark\" | \"nextTime\" | \"nextTimeLabel\" | \"secondary\" | \"href\" | \"actionLabel\" | \"linkAs\"> & { title: React.ReactNode };\n\n/** The photo, or the mark when there is none, or nothing: the call then reads on one column. */\nfunction ClosingMedia({ photo, mark }: Pick<BookingSectionProps, \"photo\" | \"mark\">) {\n if (photo) return <Photo photo={photo} ratio=\"4/3\" sizes=\"(min-width: 64rem) 36rem, calc(100vw - 2rem)\" />;\n if (!mark) return null;\n return (\n <div aria-hidden className=\"grid aspect-[4/3] w-full place-items-center overflow-hidden rounded-xl bg-accent-soft text-fg-accent [&>svg]:h-1/2 [&>svg]:w-auto\">\n {mark}\n </div>\n );\n}\n\nfunction ClosingCall({ title, body, photo, mark, nextTime, nextTimeLabel, secondary, href, actionLabel, linkAs, className, ...props }: ClosingCallProps) {\n const headingId = React.useId();\n const hasMedia = Boolean(photo ?? mark);\n return (\n <ShopSection aria-labelledby={headingId} data-variant=\"closing\" bleed className={className} {...props}>\n <Page>\n <div className={cn(\"grid items-center gap-6 rounded-2xl bg-surface-1 p-4 sm:p-6 lg:gap-10 lg:p-8\", hasMedia && \"lg:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]\")}>\n <ClosingMedia photo={photo} mark={mark} />\n <div className=\"flex min-w-0 flex-col items-start gap-4\">\n <h2 id={headingId} className=\"m-0 text-2xl font-bold leading-tight text-fg sm:text-3xl\">\n {title}\n </h2>\n {body ? <p className=\"m-0 max-w-prose text-[15px] leading-relaxed text-fg-secondary\">{body}</p> : null}\n {nextTime ? (\n <p className=\"m-0 flex flex-wrap items-center gap-2 text-sm text-fg-secondary\">\n {nextTimeLabel ? <span>{nextTimeLabel}</span> : null}\n <BlockLink href={nextTime.href} linkAs={linkAs} className=\"inline-flex min-h-11 items-center rounded-md border border-border-control bg-surface-2 px-3 text-sm font-semibold tabular-nums text-fg no-underline hover:border-accent hover:bg-accent-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\">\n {nextTime.label}\n </BlockLink>\n </p>\n ) : null}\n <div className=\"flex flex-wrap items-center gap-3\">\n <BlockLink href={href} linkAs={linkAs} className={cn(buttonVariants({ variant: \"primary\", size: \"lg\" }), \"no-underline\")}>\n {actionLabel}\n </BlockLink>\n {secondary ? (\n <BlockLink href={secondary.href} linkAs={linkAs} className={cn(buttonVariants({ variant: \"secondary\", size: \"lg\" }), \"no-underline\")}>\n {secondary.label}\n </BlockLink>\n ) : null}\n </div>\n </div>\n </div>\n </Page>\n </ShopSection>\n );\n}\n\n/** The way to book: the next free times, a closing call, or the phone bar. */\nexport function BookingSection({ variant = \"strip\", times = [], label, emptyLabel, href, actionLabel, title, body, linkAs, hideWhileVisible, photo, mark, nextTime, nextTimeLabel, secondary, className, ...props }: BookingSectionProps) {\n const action = (size: \"md\" | \"lg\") => (\n <BlockLink href={href} linkAs={linkAs} className={cn(buttonVariants({ variant: \"primary\", size }), \"no-underline\")}>\n {actionLabel}\n </BlockLink>\n );\n if (variant === \"sticky\") {\n return (\n <StickyAction hideWhileVisible={hideWhileVisible} data-variant=\"sticky\" className={className} {...(props as object)}>\n <BlockLink href={href} linkAs={linkAs} className={cn(buttonVariants({ variant: \"primary\", size: \"lg\" }), \"w-full justify-center no-underline\")}>\n {actionLabel}\n </BlockLink>\n </StickyAction>\n );\n }\n if (variant === \"closing\") {\n return <ClosingCall title={title ?? label} body={body} photo={photo} mark={mark} nextTime={nextTime} nextTimeLabel={nextTimeLabel} secondary={secondary} href={href} actionLabel={actionLabel} linkAs={linkAs} className={className} {...props} />;\n }\n if (variant === \"panel\") {\n return (\n <ShopSection aria-label={typeof title === \"string\" ? title : label} data-variant=\"panel\" className={className} {...props}>\n <CtaPanel title={title ?? label} body={body}>\n {action(\"lg\")}\n </CtaPanel>\n </ShopSection>\n );\n }\n return (\n <ShopSection aria-label={label} data-variant=\"strip\" className={className} {...props}>\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-border-default bg-surface-1 p-3 sm:px-4\">\n <p className=\"m-0 order-1 text-sm font-semibold text-fg\">{label}</p>\n {times.length > 0 ? (\n <ul className=\"m-0 order-3 grid w-full list-none grid-cols-2 gap-2 p-0 sm:order-2 sm:flex sm:w-auto sm:min-w-0 sm:flex-1 sm:flex-wrap\">\n {times.map((t) => (\n <li key={t.id}>\n <BlockLink href={t.href} linkAs={linkAs} className=\"inline-flex min-h-11 items-center rounded-md border border-border-control bg-surface-2 px-3 text-[13px] font-semibold tabular-nums text-fg no-underline hover:border-accent hover:bg-accent-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\">\n {t.label}\n </BlockLink>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"m-0 order-3 w-full text-sm text-fg-secondary sm:order-2 sm:w-auto sm:flex-1\">{emptyLabel}</p>\n )}\n <BlockLink href={href} linkAs={linkAs} className=\"order-2 ml-auto inline-flex min-h-11 items-center gap-1 text-[13px] sm:order-3 font-semibold text-fg-accent no-underline hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\">\n {actionLabel} <span aria-hidden>→</span>\n </BlockLink>\n </div>\n </ShopSection>\n );\n}\n"],"mappings":"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","names":[]}
|
package/dist/shop/map-gate.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type MapGateProps = {
|
|
|
11
11
|
places?: StaticMapProps["places"];
|
|
12
12
|
/** The button's words (`Show the map`). */
|
|
13
13
|
showLabel: string;
|
|
14
|
-
/** More props of the live map (`brand`, `lang`, `labels`). */
|
|
14
|
+
/** More props of the live map (`brand`, `lang`, `labels`). Its `className` replaces the default `h-full w-full`: the map fills the gate's frame. */
|
|
15
15
|
map?: Partial<Omit<MapProps, "label" | "center" | "zoom" | "fallback">>;
|
|
16
16
|
className?: string;
|
|
17
17
|
};
|
package/dist/shop/map-gate.js
CHANGED
|
@@ -16,7 +16,7 @@ function MapGate({ label, center, zoom = 14, places, showLabel, map, className }
|
|
|
16
16
|
const live = asked || wide;
|
|
17
17
|
const still = /* @__PURE__ */ jsx(StaticMap, { label, center, zoom, places });
|
|
18
18
|
return /* @__PURE__ */ jsx("div", { className, "data-live": live ? "" : void 0, children: /* @__PURE__ */ jsxs("div", { className: "relative aspect-[4/3] w-full overflow-hidden rounded-xl border border-border-default sm:aspect-[16/9]", children: [
|
|
19
|
-
live ? /* @__PURE__ */ jsx(LiveMap, { label, center, zoom, fallback: still, ...map }) : still,
|
|
19
|
+
live ? /* @__PURE__ */ jsx(LiveMap, { label, center, zoom, fallback: still, ...map, className: map?.className ?? "h-full w-full" }) : still,
|
|
20
20
|
!live && /* @__PURE__ */ jsx(
|
|
21
21
|
"button",
|
|
22
22
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shop/map-gate/map-gate.tsx"],"sourcesContent":["\"use client\";\n\n// A map behind a button on a phone (ADR-007 §3, §7). Until it is asked for, the page holds a still drawing of the place\n// (SVG, nothing requested) and a button: no engine, no tile, no request. From `sm` up the live map shows at once, because a\n// laptop can afford it. The tiles are the Krizaka CDN's: no third party.\nimport { Map as LiveMap, type MapProps, StaticMap, type StaticMapProps } from \"@krizaka/ui/map\";\nimport * as React from \"react\";\n\nexport type MapGateProps = {\n /** The map's accessible name (`Where the salon is`). */\n label: string;\n /** Longitude, latitude. */\n center: StaticMapProps[\"center\"];\n zoom?: number;\n /** Places drawn on the still and listed in its name. */\n places?: StaticMapProps[\"places\"];\n /** The button's words (`Show the map`). */\n showLabel: string;\n /** More props of the live map (`brand`, `lang`, `labels`). */\n map?: Partial<Omit<MapProps, \"label\" | \"center\" | \"zoom\" | \"fallback\">>;\n className?: string;\n};\n\nconst WIDE = \"(min-width: 40rem)\";\nfunction subscribeWide(notify: () => void) {\n const q = window.matchMedia(WIDE);\n q.addEventListener(\"change\", notify);\n return () => q.removeEventListener(\"change\", notify);\n}\n\n/** The place as a still, the live map on a click — or at once on a screen that can afford it. */\nexport function MapGate({ label, center, zoom = 14, places, showLabel, map, className }: MapGateProps) {\n const [asked, setAsked] = React.useState(false);\n // A screen that can afford it shows the live map at once; the server and a phone start with the still.\n const wide = React.useSyncExternalStore(subscribeWide, () => window.matchMedia(WIDE).matches, () => false);\n const live = asked || wide;\n const still = <StaticMap label={label} center={center} zoom={zoom} places={places} />;\n return (\n <div className={className} data-live={live ? \"\" : undefined}>\n <div className=\"relative aspect-[4/3] w-full overflow-hidden rounded-xl border border-border-default sm:aspect-[16/9]\">\n {live ? <LiveMap label={label} center={center} zoom={zoom} fallback={still} {...map} /> : still}\n {!live && (\n <button\n type=\"button\"\n onClick={() => setAsked(true)}\n className=\"absolute bottom-3 left-3 inline-flex min-h-11 items-center rounded-md border border-border-control bg-surface-1 px-4 text-sm font-semibold text-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\"\n >\n {showLabel}\n </button>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;AAKA,SAAS,OAAO,SAAwB,iBAAsC;AAC9E,YAAY,WAAW;AA8BP,cAGV,YAHU;AAbhB,IAAM,OAAO;AACb,SAAS,cAAc,QAAoB;AACzC,QAAM,IAAI,OAAO,WAAW,IAAI;AAChC,IAAE,iBAAiB,UAAU,MAAM;AACnC,SAAO,MAAM,EAAE,oBAAoB,UAAU,MAAM;AACrD;AAGO,SAAS,QAAQ,EAAE,OAAO,QAAQ,OAAO,IAAI,QAAQ,WAAW,KAAK,UAAU,GAAiB;AACrG,QAAM,CAAC,OAAO,QAAQ,IAAU,eAAS,KAAK;AAE9C,QAAM,OAAa,2BAAqB,eAAe,MAAM,OAAO,WAAW,IAAI,EAAE,SAAS,MAAM,KAAK;AACzG,QAAM,OAAO,SAAS;AACtB,QAAM,QAAQ,oBAAC,aAAU,OAAc,QAAgB,MAAY,QAAgB;AACnF,SACE,oBAAC,SAAI,WAAsB,aAAW,OAAO,KAAK,QAChD,+BAAC,SAAI,WAAU,yGACZ;AAAA,WAAO,oBAAC,WAAQ,OAAc,QAAgB,MAAY,UAAU,OAAQ,GAAG,KAAK,IAAK;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/shop/map-gate/map-gate.tsx"],"sourcesContent":["\"use client\";\n\n// A map behind a button on a phone (ADR-007 §3, §7). Until it is asked for, the page holds a still drawing of the place\n// (SVG, nothing requested) and a button: no engine, no tile, no request. From `sm` up the live map shows at once, because a\n// laptop can afford it. The tiles are the Krizaka CDN's: no third party.\nimport { Map as LiveMap, type MapProps, StaticMap, type StaticMapProps } from \"@krizaka/ui/map\";\nimport * as React from \"react\";\n\nexport type MapGateProps = {\n /** The map's accessible name (`Where the salon is`). */\n label: string;\n /** Longitude, latitude. */\n center: StaticMapProps[\"center\"];\n zoom?: number;\n /** Places drawn on the still and listed in its name. */\n places?: StaticMapProps[\"places\"];\n /** The button's words (`Show the map`). */\n showLabel: string;\n /** More props of the live map (`brand`, `lang`, `labels`). Its `className` replaces the default `h-full w-full`: the map fills the gate's frame. */\n map?: Partial<Omit<MapProps, \"label\" | \"center\" | \"zoom\" | \"fallback\">>;\n className?: string;\n};\n\nconst WIDE = \"(min-width: 40rem)\";\nfunction subscribeWide(notify: () => void) {\n const q = window.matchMedia(WIDE);\n q.addEventListener(\"change\", notify);\n return () => q.removeEventListener(\"change\", notify);\n}\n\n/** The place as a still, the live map on a click — or at once on a screen that can afford it. */\nexport function MapGate({ label, center, zoom = 14, places, showLabel, map, className }: MapGateProps) {\n const [asked, setAsked] = React.useState(false);\n // A screen that can afford it shows the live map at once; the server and a phone start with the still.\n const wide = React.useSyncExternalStore(subscribeWide, () => window.matchMedia(WIDE).matches, () => false);\n const live = asked || wide;\n const still = <StaticMap label={label} center={center} zoom={zoom} places={places} />;\n return (\n <div className={className} data-live={live ? \"\" : undefined}>\n <div className=\"relative aspect-[4/3] w-full overflow-hidden rounded-xl border border-border-default sm:aspect-[16/9]\">\n {live ? <LiveMap label={label} center={center} zoom={zoom} fallback={still} {...map} className={map?.className ?? \"h-full w-full\"} /> : still}\n {!live && (\n <button\n type=\"button\"\n onClick={() => setAsked(true)}\n className=\"absolute bottom-3 left-3 inline-flex min-h-11 items-center rounded-md border border-border-control bg-surface-1 px-4 text-sm font-semibold text-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\"\n >\n {showLabel}\n </button>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;AAKA,SAAS,OAAO,SAAwB,iBAAsC;AAC9E,YAAY,WAAW;AA8BP,cAGV,YAHU;AAbhB,IAAM,OAAO;AACb,SAAS,cAAc,QAAoB;AACzC,QAAM,IAAI,OAAO,WAAW,IAAI;AAChC,IAAE,iBAAiB,UAAU,MAAM;AACnC,SAAO,MAAM,EAAE,oBAAoB,UAAU,MAAM;AACrD;AAGO,SAAS,QAAQ,EAAE,OAAO,QAAQ,OAAO,IAAI,QAAQ,WAAW,KAAK,UAAU,GAAiB;AACrG,QAAM,CAAC,OAAO,QAAQ,IAAU,eAAS,KAAK;AAE9C,QAAM,OAAa,2BAAqB,eAAe,MAAM,OAAO,WAAW,IAAI,EAAE,SAAS,MAAM,KAAK;AACzG,QAAM,OAAO,SAAS;AACtB,QAAM,QAAQ,oBAAC,aAAU,OAAc,QAAgB,MAAY,QAAgB;AACnF,SACE,oBAAC,SAAI,WAAsB,aAAW,OAAO,KAAK,QAChD,+BAAC,SAAI,WAAU,yGACZ;AAAA,WAAO,oBAAC,WAAQ,OAAc,QAAgB,MAAY,UAAU,OAAQ,GAAG,KAAK,WAAW,KAAK,aAAa,iBAAiB,IAAK;AAAA,IACvI,CAAC,QACA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS,MAAM,SAAS,IAAI;AAAA,QAC5B,WAAU;AAAA,QAET;AAAA;AAAA,IACH;AAAA,KAEJ,GACF;AAEJ;","names":[]}
|
package/dist/shop-composer.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ declare const SECTION_DEFINITIONS: readonly [SectionDefinitionOf<"hero", readonl
|
|
|
85
85
|
service: z.ZodMiniObject<{
|
|
86
86
|
serviceId: z.ZodMiniString<string>;
|
|
87
87
|
}, z.core.$strip>;
|
|
88
|
-
}>, SectionDefinitionOf<"booking", readonly ["strip", "panel", "sticky"], z.ZodMiniObject<{
|
|
88
|
+
}>, SectionDefinitionOf<"booking", readonly ["strip", "panel", "closing", "sticky"], z.ZodMiniObject<{
|
|
89
89
|
serviceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
90
90
|
count: z.ZodMiniUnion<[z.ZodMiniLiteral<3 | 4 | 6>, z.ZodMiniLiteral<3 | 4 | 6>]>;
|
|
91
91
|
}, z.core.$strip>, Record<never, never>>, SectionDefinitionOf<"gallery", readonly ["mosaic", "filmstrip", "wall", "grid"], z.ZodMiniObject<{
|