@krizaka/ui 3.69.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/dist/chunk-2FCQCWIK.js +86 -0
- package/dist/chunk-2FCQCWIK.js.map +1 -0
- package/dist/chunk-S4TLZRGZ.js +42 -0
- package/dist/chunk-S4TLZRGZ.js.map +1 -0
- package/dist/confirm-button.js +5 -78
- package/dist/confirm-button.js.map +1 -1
- package/dist/map.d.ts +6 -6
- 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/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/status-chip.js +16 -43
- package/dist/status-chip.js.map +1 -1
- package/package.json +17 -3
- 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/field.json +1 -1
- package/registry/file-upload.json +1 -1
- package/registry/filter-bar.json +1 -1
- 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 +42 -8
- 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 +1 -1
- package/registry/shop.json +3 -3
- 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 +1 -1
- 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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Button
|
|
4
|
+
} from "./chunk-V7W4RLRW.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-NSLXEDIS.js";
|
|
8
|
+
|
|
9
|
+
// src/confirm-button/confirm-button.tsx
|
|
10
|
+
import { VisuallyHidden } from "radix-ui";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var confirmArmed = "border border-danger bg-danger/20 text-fg hover:border-danger hover:bg-danger/30";
|
|
14
|
+
function ConfirmButton({
|
|
15
|
+
confirmLabel,
|
|
16
|
+
label,
|
|
17
|
+
onConfirm,
|
|
18
|
+
timeoutMs = 4e3,
|
|
19
|
+
onArmedChange,
|
|
20
|
+
armedContent,
|
|
21
|
+
variant = "ghost",
|
|
22
|
+
className,
|
|
23
|
+
children,
|
|
24
|
+
onBlur,
|
|
25
|
+
onKeyDown,
|
|
26
|
+
...props
|
|
27
|
+
}) {
|
|
28
|
+
const [armed, setArmedState] = React.useState(false);
|
|
29
|
+
const armedRef = React.useRef(false);
|
|
30
|
+
const onArmedChangeRef = React.useRef(onArmedChange);
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
onArmedChangeRef.current = onArmedChange;
|
|
33
|
+
}, [onArmedChange]);
|
|
34
|
+
const setArmed = React.useCallback((next) => {
|
|
35
|
+
if (armedRef.current === next) return;
|
|
36
|
+
armedRef.current = next;
|
|
37
|
+
setArmedState(next);
|
|
38
|
+
onArmedChangeRef.current?.(next);
|
|
39
|
+
}, []);
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
if (!armed) return;
|
|
42
|
+
const timer = window.setTimeout(() => setArmed(false), timeoutMs);
|
|
43
|
+
return () => window.clearTimeout(timer);
|
|
44
|
+
}, [armed, timeoutMs, setArmed]);
|
|
45
|
+
const name = armed ? confirmLabel : label;
|
|
46
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
|
+
Button,
|
|
49
|
+
{
|
|
50
|
+
variant,
|
|
51
|
+
"aria-label": name,
|
|
52
|
+
title: name,
|
|
53
|
+
"data-armed": armed ? "" : void 0,
|
|
54
|
+
className: cn(armed && confirmArmed, className),
|
|
55
|
+
onClick: () => {
|
|
56
|
+
if (!armed) return setArmed(true);
|
|
57
|
+
setArmed(false);
|
|
58
|
+
onConfirm();
|
|
59
|
+
},
|
|
60
|
+
onBlur: (event) => {
|
|
61
|
+
onBlur?.(event);
|
|
62
|
+
setArmed(false);
|
|
63
|
+
},
|
|
64
|
+
onKeyDown: (event) => {
|
|
65
|
+
onKeyDown?.(event);
|
|
66
|
+
if (armed && event.key === "Escape") {
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
setArmed(false);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
...props,
|
|
72
|
+
children: armed ? armedContent ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73
|
+
children,
|
|
74
|
+
/* @__PURE__ */ jsx("span", { children: confirmLabel })
|
|
75
|
+
] }) : children
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(VisuallyHidden.Root, { "aria-live": "polite", children: armed ? confirmLabel : "" })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
confirmArmed,
|
|
84
|
+
ConfirmButton
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=chunk-2FCQCWIK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/confirm-button/confirm-button.tsx"],"sourcesContent":["// Client (a state). A destructive action confirmed by a second press, never `window.confirm`: the first press arms it\n// and says what will happen (`confirmLabel`, announced politely), the second runs `onConfirm`. It disarms by itself\n// after `timeoutMs`, on Escape, and when the focus leaves. The danger is the border and the tint; the words stay a\n// text role (contrast AA in both themes).\nimport { VisuallyHidden } from \"radix-ui\";\nimport * as React from \"react\";\n\nimport { Button, type ButtonProps } from \"../button/button\";\nimport { cn } from \"../cn\";\n\nexport const confirmArmed = \"border border-danger bg-danger/20 text-fg hover:border-danger hover:bg-danger/30\";\n\nexport type ConfirmButtonProps = Omit<ButtonProps, \"onClick\" | \"asChild\"> & {\n /** What the second press does, in words — shown and announced once armed (\"Delete for good?\"). Passed translated. */\n confirmLabel: string;\n /** The accessible name while idle, for an icon-only button (the confirm label names it once armed). */\n label?: string;\n /** Runs on the second press. */\n onConfirm: () => void;\n /** Disarms after this many milliseconds (4000 by default). */\n timeoutMs?: number;\n /** What it shows once armed (default: its children, then `confirmLabel`). */\n armedContent?: React.ReactNode;\n /** Notified when it arms and disarms. */\n onArmedChange?: (armed: boolean) => void;\n};\n\n/** A two-step button: press to arm, press again within `timeoutMs` to confirm. State: `data-armed`. */\nexport function ConfirmButton({\n confirmLabel,\n label,\n onConfirm,\n timeoutMs = 4000,\n onArmedChange,\n armedContent,\n variant = \"ghost\",\n className,\n children,\n onBlur,\n onKeyDown,\n ...props\n}: ConfirmButtonProps) {\n const [armed, setArmedState] = React.useState(false);\n const armedRef = React.useRef(false);\n const onArmedChangeRef = React.useRef(onArmedChange);\n React.useEffect(() => {\n onArmedChangeRef.current = onArmedChange;\n }, [onArmedChange]);\n const setArmed = React.useCallback((next: boolean) => {\n if (armedRef.current === next) return;\n armedRef.current = next;\n setArmedState(next);\n onArmedChangeRef.current?.(next);\n }, []);\n React.useEffect(() => {\n if (!armed) return;\n const timer = window.setTimeout(() => setArmed(false), timeoutMs);\n return () => window.clearTimeout(timer);\n }, [armed, timeoutMs, setArmed]);\n const name = armed ? confirmLabel : label;\n return (\n <>\n <Button\n variant={variant}\n aria-label={name}\n title={name}\n data-armed={armed ? \"\" : undefined}\n className={cn(armed && confirmArmed, className)}\n onClick={() => {\n if (!armed) return setArmed(true);\n setArmed(false);\n onConfirm();\n }}\n onBlur={(event) => {\n onBlur?.(event);\n setArmed(false);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (armed && event.key === \"Escape\") {\n event.stopPropagation();\n setArmed(false);\n }\n }}\n {...props}\n >\n {armed\n ? (armedContent ?? (\n <>\n {children}\n <span>{confirmLabel}</span>\n </>\n ))\n : children}\n </Button>\n <VisuallyHidden.Root aria-live=\"polite\">{armed ? confirmLabel : \"\"}</VisuallyHidden.Root>\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAIA,SAAS,sBAAsB;AAC/B,YAAY,WAAW;AAmFT,mBAEE,KAFF;AA9EP,IAAM,eAAe;AAkBrB,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAuB;AACrB,QAAM,CAAC,OAAO,aAAa,IAAU,eAAS,KAAK;AACnD,QAAM,WAAiB,aAAO,KAAK;AACnC,QAAM,mBAAyB,aAAO,aAAa;AACnD,EAAM,gBAAU,MAAM;AACpB,qBAAiB,UAAU;AAAA,EAC7B,GAAG,CAAC,aAAa,CAAC;AAClB,QAAM,WAAiB,kBAAY,CAAC,SAAkB;AACpD,QAAI,SAAS,YAAY,KAAM;AAC/B,aAAS,UAAU;AACnB,kBAAc,IAAI;AAClB,qBAAiB,UAAU,IAAI;AAAA,EACjC,GAAG,CAAC,CAAC;AACL,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,MAAO;AACZ,UAAM,QAAQ,OAAO,WAAW,MAAM,SAAS,KAAK,GAAG,SAAS;AAChE,WAAO,MAAM,OAAO,aAAa,KAAK;AAAA,EACxC,GAAG,CAAC,OAAO,WAAW,QAAQ,CAAC;AAC/B,QAAM,OAAO,QAAQ,eAAe;AACpC,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAY;AAAA,QACZ,OAAO;AAAA,QACP,cAAY,QAAQ,KAAK;AAAA,QACzB,WAAW,GAAG,SAAS,cAAc,SAAS;AAAA,QAC9C,SAAS,MAAM;AACb,cAAI,CAAC,MAAO,QAAO,SAAS,IAAI;AAChC,mBAAS,KAAK;AACd,oBAAU;AAAA,QACZ;AAAA,QACA,QAAQ,CAAC,UAAU;AACjB,mBAAS,KAAK;AACd,mBAAS,KAAK;AAAA,QAChB;AAAA,QACA,WAAW,CAAC,UAAU;AACpB,sBAAY,KAAK;AACjB,cAAI,SAAS,MAAM,QAAQ,UAAU;AACnC,kBAAM,gBAAgB;AACtB,qBAAS,KAAK;AAAA,UAChB;AAAA,QACF;AAAA,QACC,GAAG;AAAA,QAEH,kBACI,gBACC,iCACG;AAAA;AAAA,UACD,oBAAC,UAAM,wBAAa;AAAA,WACtB,IAEF;AAAA;AAAA,IACN;AAAA,IACA,oBAAC,eAAe,MAAf,EAAoB,aAAU,UAAU,kBAAQ,eAAe,IAAG;AAAA,KACrE;AAEJ;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
defineRecipe
|
|
4
|
+
} from "./chunk-D3T54RSL.js";
|
|
5
|
+
|
|
6
|
+
// src/badge/badge.tsx
|
|
7
|
+
import { tv } from "tailwind-variants";
|
|
8
|
+
|
|
9
|
+
// src/badge/recipe.ts
|
|
10
|
+
var badgeRecipe = defineRecipe({
|
|
11
|
+
base: "inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm font-semibold ",
|
|
12
|
+
variants: {
|
|
13
|
+
tone: {
|
|
14
|
+
neutral: "bg-surface-3 text-fg-secondary",
|
|
15
|
+
accent: "bg-accent-soft text-fg ring-1 ring-inset ring-accent/40 [&>[data-dot]]:bg-accent",
|
|
16
|
+
success: "bg-success/15 text-fg ring-1 ring-inset ring-success/40 [&>[data-dot]]:bg-success",
|
|
17
|
+
warning: "bg-warning/15 text-fg ring-1 ring-inset ring-warning/40 [&>[data-dot]]:bg-warning",
|
|
18
|
+
danger: "bg-danger/15 text-fg ring-1 ring-inset ring-danger/40 [&>[data-dot]]:bg-danger",
|
|
19
|
+
/** On a media: veil and text invariant, identical in both themes. */
|
|
20
|
+
scrim: "bg-scrim text-fg-on-media backdrop-blur-md"
|
|
21
|
+
},
|
|
22
|
+
size: { sm: "px-2 py-0.5 text-[10px]", md: "px-2.5 py-1 text-[11px]" },
|
|
23
|
+
pulse: { true: "[&>[data-dot]]:motion-safe:animate-pulse" }
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: { tone: "neutral", size: "sm" }
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// src/badge/badge.tsx
|
|
29
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
|
+
var badgeVariants = tv(badgeRecipe);
|
|
31
|
+
function Badge({ tone, size, pulse, dot, className, children, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsxs("span", { "data-tone": tone ?? "neutral", className: badgeVariants({ tone, size, pulse, className }), ...props, children: [
|
|
33
|
+
dot && /* @__PURE__ */ jsx("span", { "data-dot": "", "aria-hidden": true, className: "h-1.5 w-1.5 rounded-full bg-current" }),
|
|
34
|
+
children
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
badgeVariants,
|
|
40
|
+
Badge
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=chunk-S4TLZRGZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/badge/badge.tsx","../src/badge/recipe.ts"],"sourcesContent":["// Server-safe: no hook, no context.\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nimport { badgeRecipe } from \"./recipe\";\n\n// Status tones are soft (a tint, a coloured dot, a text role): the invariant status tokens are too light to carry\n// small text on a light surface, or to sit under white text (WCAG AA).\nexport const badgeVariants = tv(badgeRecipe);\n\nexport type BadgeVariants = VariantProps<typeof badgeVariants>;\n\nexport type BadgeProps = React.ComponentProps<\"span\"> &\n BadgeVariants & {\n /**\n * neutral · accent · success · warning · danger (soft tints, the text stays a text role) · scrim (on a media).\n * @default \"neutral\"\n */\n tone?: BadgeVariants[\"tone\"];\n /**\n * sm · md.\n * @default \"sm\"\n */\n size?: BadgeVariants[\"size\"];\n /** Makes the `dot` pulse (stopped under reduced motion). */\n pulse?: BadgeVariants[\"pulse\"];\n /** A small dot before the text, in the tone's colour (pulsing with `pulse`). */\n dot?: boolean;\n };\n\nexport function Badge({ tone, size, pulse, dot, className, children, ...props }: BadgeProps) {\n return (\n <span data-tone={tone ?? \"neutral\"} className={badgeVariants({ tone, size, pulse, className })} {...props}>\n {dot && <span data-dot=\"\" aria-hidden className=\"h-1.5 w-1.5 rounded-full bg-current\" />}\n {children}\n </span>\n );\n}\n","// The badge's tones and sizes, written once as classes of the Krizaka tokens: the web wears them with `tv(badgeRecipe)`,\n// React Native reads the same classes into styles (native/badge.tsx). Status tones are soft (a tint, a coloured dot, a\n// text role): the invariant status tokens are too light to carry small text on a light surface, or to sit under white\n// text (WCAG AA).\nimport { defineRecipe } from \"../recipes/define\";\n\nexport const badgeRecipe = defineRecipe({\n base: \"inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm font-semibold \",\n variants: {\n tone: {\n neutral: \"bg-surface-3 text-fg-secondary\",\n accent: \"bg-accent-soft text-fg ring-1 ring-inset ring-accent/40 [&>[data-dot]]:bg-accent\",\n success: \"bg-success/15 text-fg ring-1 ring-inset ring-success/40 [&>[data-dot]]:bg-success\",\n warning: \"bg-warning/15 text-fg ring-1 ring-inset ring-warning/40 [&>[data-dot]]:bg-warning\",\n danger: \"bg-danger/15 text-fg ring-1 ring-inset ring-danger/40 [&>[data-dot]]:bg-danger\",\n /** On a media: veil and text invariant, identical in both themes. */\n scrim: \"bg-scrim text-fg-on-media backdrop-blur-md\",\n },\n size: { sm: \"px-2 py-0.5 text-[10px]\", md: \"px-2.5 py-1 text-[11px]\" },\n pulse: { true: \"[&>[data-dot]]:motion-safe:animate-pulse\" },\n },\n defaultVariants: { tone: \"neutral\", size: \"sm\" },\n});\n"],"mappings":";;;;;;AAEA,SAAS,UAA6B;;;ACI/B,IAAM,cAAc,aAAa;AAAA,EACtC,MAAM;AAAA,EACN,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA;AAAA,MAER,OAAO;AAAA,IACT;AAAA,IACA,MAAM,EAAE,IAAI,2BAA2B,IAAI,0BAA0B;AAAA,IACrE,OAAO,EAAE,MAAM,2CAA2C;AAAA,EAC5D;AAAA,EACA,iBAAiB,EAAE,MAAM,WAAW,MAAM,KAAK;AACjD,CAAC;;;ADUG,SACU,KADV;AAxBG,IAAM,gBAAgB,GAAG,WAAW;AAsBpC,SAAS,MAAM,EAAE,MAAM,MAAM,OAAO,KAAK,WAAW,UAAU,GAAG,MAAM,GAAe;AAC3F,SACE,qBAAC,UAAK,aAAW,QAAQ,WAAW,WAAW,cAAc,EAAE,MAAM,MAAM,OAAO,UAAU,CAAC,GAAI,GAAG,OACjG;AAAA,WAAO,oBAAC,UAAK,YAAS,IAAG,eAAW,MAAC,WAAU,uCAAsC;AAAA,IACrF;AAAA,KACH;AAEJ;","names":[]}
|
package/dist/confirm-button.js
CHANGED
|
@@ -1,85 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
ConfirmButton,
|
|
4
|
+
confirmArmed
|
|
5
|
+
} from "./chunk-2FCQCWIK.js";
|
|
6
|
+
import "./chunk-V7W4RLRW.js";
|
|
5
7
|
import "./chunk-D3T54RSL.js";
|
|
6
8
|
import "./chunk-WEVYKZIF.js";
|
|
7
|
-
import
|
|
8
|
-
cn
|
|
9
|
-
} from "./chunk-NSLXEDIS.js";
|
|
10
|
-
|
|
11
|
-
// src/confirm-button/confirm-button.tsx
|
|
12
|
-
import { VisuallyHidden } from "radix-ui";
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
var confirmArmed = "border border-danger bg-danger/20 text-fg hover:border-danger hover:bg-danger/30";
|
|
16
|
-
function ConfirmButton({
|
|
17
|
-
confirmLabel,
|
|
18
|
-
label,
|
|
19
|
-
onConfirm,
|
|
20
|
-
timeoutMs = 4e3,
|
|
21
|
-
onArmedChange,
|
|
22
|
-
armedContent,
|
|
23
|
-
variant = "ghost",
|
|
24
|
-
className,
|
|
25
|
-
children,
|
|
26
|
-
onBlur,
|
|
27
|
-
onKeyDown,
|
|
28
|
-
...props
|
|
29
|
-
}) {
|
|
30
|
-
const [armed, setArmedState] = React.useState(false);
|
|
31
|
-
const armedRef = React.useRef(false);
|
|
32
|
-
const onArmedChangeRef = React.useRef(onArmedChange);
|
|
33
|
-
React.useEffect(() => {
|
|
34
|
-
onArmedChangeRef.current = onArmedChange;
|
|
35
|
-
}, [onArmedChange]);
|
|
36
|
-
const setArmed = React.useCallback((next) => {
|
|
37
|
-
if (armedRef.current === next) return;
|
|
38
|
-
armedRef.current = next;
|
|
39
|
-
setArmedState(next);
|
|
40
|
-
onArmedChangeRef.current?.(next);
|
|
41
|
-
}, []);
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
if (!armed) return;
|
|
44
|
-
const timer = window.setTimeout(() => setArmed(false), timeoutMs);
|
|
45
|
-
return () => window.clearTimeout(timer);
|
|
46
|
-
}, [armed, timeoutMs, setArmed]);
|
|
47
|
-
const name = armed ? confirmLabel : label;
|
|
48
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
|
-
/* @__PURE__ */ jsx(
|
|
50
|
-
Button,
|
|
51
|
-
{
|
|
52
|
-
variant,
|
|
53
|
-
"aria-label": name,
|
|
54
|
-
title: name,
|
|
55
|
-
"data-armed": armed ? "" : void 0,
|
|
56
|
-
className: cn(armed && confirmArmed, className),
|
|
57
|
-
onClick: () => {
|
|
58
|
-
if (!armed) return setArmed(true);
|
|
59
|
-
setArmed(false);
|
|
60
|
-
onConfirm();
|
|
61
|
-
},
|
|
62
|
-
onBlur: (event) => {
|
|
63
|
-
onBlur?.(event);
|
|
64
|
-
setArmed(false);
|
|
65
|
-
},
|
|
66
|
-
onKeyDown: (event) => {
|
|
67
|
-
onKeyDown?.(event);
|
|
68
|
-
if (armed && event.key === "Escape") {
|
|
69
|
-
event.stopPropagation();
|
|
70
|
-
setArmed(false);
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
...props,
|
|
74
|
-
children: armed ? armedContent ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
75
|
-
children,
|
|
76
|
-
/* @__PURE__ */ jsx("span", { children: confirmLabel })
|
|
77
|
-
] }) : children
|
|
78
|
-
}
|
|
79
|
-
),
|
|
80
|
-
/* @__PURE__ */ jsx(VisuallyHidden.Root, { "aria-live": "polite", children: armed ? confirmLabel : "" })
|
|
81
|
-
] });
|
|
82
|
-
}
|
|
9
|
+
import "./chunk-NSLXEDIS.js";
|
|
83
10
|
export {
|
|
84
11
|
ConfirmButton,
|
|
85
12
|
confirmArmed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/map.d.ts
CHANGED
|
@@ -119,10 +119,10 @@ declare const map: tailwind_variants.TVReturnType<{
|
|
|
119
119
|
[key: string]: {
|
|
120
120
|
[key: string]: tailwind_variants.ClassValue | {
|
|
121
121
|
root?: tailwind_variants.ClassValue;
|
|
122
|
+
attribution?: tailwind_variants.ClassValue;
|
|
122
123
|
canvas?: tailwind_variants.ClassValue;
|
|
123
124
|
fallback?: tailwind_variants.ClassValue;
|
|
124
125
|
controls?: tailwind_variants.ClassValue;
|
|
125
|
-
attribution?: tailwind_variants.ClassValue;
|
|
126
126
|
places?: tailwind_variants.ClassValue;
|
|
127
127
|
markerLabel?: tailwind_variants.ClassValue;
|
|
128
128
|
control?: tailwind_variants.ClassValue;
|
|
@@ -133,10 +133,10 @@ declare const map: tailwind_variants.TVReturnType<{
|
|
|
133
133
|
[x: string]: {
|
|
134
134
|
[x: string]: tailwind_variants.ClassValue | {
|
|
135
135
|
root?: tailwind_variants.ClassValue;
|
|
136
|
+
attribution?: tailwind_variants.ClassValue;
|
|
136
137
|
canvas?: tailwind_variants.ClassValue;
|
|
137
138
|
fallback?: tailwind_variants.ClassValue;
|
|
138
139
|
controls?: tailwind_variants.ClassValue;
|
|
139
|
-
attribution?: tailwind_variants.ClassValue;
|
|
140
140
|
places?: tailwind_variants.ClassValue;
|
|
141
141
|
markerLabel?: tailwind_variants.ClassValue;
|
|
142
142
|
control?: tailwind_variants.ClassValue;
|
|
@@ -157,10 +157,10 @@ declare const map: tailwind_variants.TVReturnType<{
|
|
|
157
157
|
[key: string]: {
|
|
158
158
|
[key: string]: tailwind_variants.ClassValue | {
|
|
159
159
|
root?: tailwind_variants.ClassValue;
|
|
160
|
+
attribution?: tailwind_variants.ClassValue;
|
|
160
161
|
canvas?: tailwind_variants.ClassValue;
|
|
161
162
|
fallback?: tailwind_variants.ClassValue;
|
|
162
163
|
controls?: tailwind_variants.ClassValue;
|
|
163
|
-
attribution?: tailwind_variants.ClassValue;
|
|
164
164
|
places?: tailwind_variants.ClassValue;
|
|
165
165
|
markerLabel?: tailwind_variants.ClassValue;
|
|
166
166
|
control?: tailwind_variants.ClassValue;
|
|
@@ -455,16 +455,16 @@ declare const staticMap: tailwind_variants.TVReturnType<{
|
|
|
455
455
|
[key: string]: {
|
|
456
456
|
[key: string]: tailwind_variants.ClassValue | {
|
|
457
457
|
root?: tailwind_variants.ClassValue;
|
|
458
|
-
attribution?: tailwind_variants.ClassValue;
|
|
459
458
|
svg?: tailwind_variants.ClassValue;
|
|
459
|
+
attribution?: tailwind_variants.ClassValue;
|
|
460
460
|
};
|
|
461
461
|
};
|
|
462
462
|
} | {
|
|
463
463
|
[x: string]: {
|
|
464
464
|
[x: string]: tailwind_variants.ClassValue | {
|
|
465
465
|
root?: tailwind_variants.ClassValue;
|
|
466
|
-
attribution?: tailwind_variants.ClassValue;
|
|
467
466
|
svg?: tailwind_variants.ClassValue;
|
|
467
|
+
attribution?: tailwind_variants.ClassValue;
|
|
468
468
|
};
|
|
469
469
|
};
|
|
470
470
|
} | {}, {
|
|
@@ -475,8 +475,8 @@ declare const staticMap: tailwind_variants.TVReturnType<{
|
|
|
475
475
|
[key: string]: {
|
|
476
476
|
[key: string]: tailwind_variants.ClassValue | {
|
|
477
477
|
root?: tailwind_variants.ClassValue;
|
|
478
|
-
attribution?: tailwind_variants.ClassValue;
|
|
479
478
|
svg?: tailwind_variants.ClassValue;
|
|
479
|
+
attribution?: tailwind_variants.ClassValue;
|
|
480
480
|
};
|
|
481
481
|
};
|
|
482
482
|
} | {}, {
|
package/dist/nav-bar.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
LanguageSwitch
|
|
4
|
+
} from "./chunk-VPO27AFS.js";
|
|
2
5
|
import {
|
|
3
6
|
FamilyMark,
|
|
4
7
|
GitHubGlyph,
|
|
@@ -6,9 +9,6 @@ import {
|
|
|
6
9
|
siteById,
|
|
7
10
|
sitesByGroup
|
|
8
11
|
} from "./chunk-Y5YBTHVD.js";
|
|
9
|
-
import {
|
|
10
|
-
LanguageSwitch
|
|
11
|
-
} from "./chunk-VPO27AFS.js";
|
|
12
12
|
import {
|
|
13
13
|
useSlidingIndicator
|
|
14
14
|
} from "./chunk-4QN5YJ3D.js";
|
|
@@ -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":";;;;;;;;;;;;;;;;;AA6CU,cAGA,YAHA;AAdV,IAAM,OAAO,EAAE,OAAO,KAAK,SAAS,UAAK,SAAS,IAAI;AACtD,IAAM,OAAO;AAAA,EACX,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX;AAGO,SAAS,SAAS,EAAE,OAAO,OAAO,WAAW,GAAG,MAAM,GAA4B;AACvF,QAAM,SAAS,EAAE,OAAO,MAAM,OAAO,SAAS,MAAM,SAAS,SAAS,MAAM,UAAU;AACtF,SACE,oBAAC,SAAI,MAAK,SAAQ,cAAY,MAAM,OAAO,aAAU,IAAG,WAAW,GAAG,kFAAkF,SAAS,GAAI,GAAG,OACrK,gBAAM,IAAI,CAAC,MAAM,UAChB,qBAAC,SAAkC,aAAW,KAAK,MAAM,WAAW,GAAG,wBAAwB,KAAK,KAAK,IAAI,CAAC,GAC5G;AAAA,wBAAC,UAAK,eAAW,MAAC,WAAU,sDACzB,eAAK,KAAK,IAAI,GACjB;AAAA,IACA,qBAAC,UAAK,WAAU,WAAW;AAAA,aAAO,KAAK,IAAI;AAAA,MAAE;AAAA,OAAE;AAAA,IAC/C,oBAAC,UAAK,WAAU,2CAA2C,eAAK,MAAK;AAAA,OAL7D,GAAG,KAAK,IAAI,KAAK,IAAI,EAM/B,CACD,GACH;AAEJ;;;AClDA,YAAY,WAAW;AAqEf,SAeE,UAdS,OAAAA,MADX,QAAAC,aAAA;AATR,IAAM,QAAQ,EAAE,MAAM,WAAW,QAAQ,UAAU,KAAK,UAAU;AAG3D,SAAS,eAAe,EAAE,OAAO,MAAM,SAAS,YAAY,UAAU,OAAO,QAAQ,OAAO,WAAW,UAAU,QAAQ,eAAe,OAAO,OAAO,OAAO,WAAW,GAAG,MAAM,GAAkC;AACxN,QAAM,YAAkB,YAAM;AAC9B,QAAM,UAAU,WAAW,YAAY,SAAY,OAAO,IAAI,KAAK,aAAa,QAAQ,EAAE,OAAO,WAAW,uBAAuB,EAAE,CAAC,EAAE,OAAO,WAAW,UAAU,GAAG;AACvK,SACE,gBAAAA,MAAC,aAAQ,mBAAiB,WAAW,cAAY,OAAO,WAAW,GAAG,wEAAwE,SAAS,GAAI,GAAG,OAC5J;AAAA,oBAAAA,MAAC,YAAO,WAAU,+DAChB;AAAA,sBAAAA,MAAC,SAAI,WAAU,mCACZ;AAAA,gBAAQ,gBAAAD,KAAC,UAAK,WAAU,8CAA8C,gBAAK;AAAA,QAC5E,gBAAAA,KAAC,OAAE,IAAI,WAAW,WAAU,qDACzB,iBACH;AAAA,SACF;AAAA,MACA,gBAAAC,MAAC,SAAM,MAAM,MAAM,WAAW,KAAK,GAAG,KAAG,MACtC;AAAA,mBAAW;AAAA,QACX,WAAW,SAAM,OAAO;AAAA,SAC3B;AAAA,OACF;AAAA,IACA,gBAAAD,KAAC,OAAE,WAAU,qBAAqB,mBAAQ;AAAA,IACzC;AAAA,IACD,gBAAAC,MAAC,SAAI,WAAU,qCACZ;AAAA,gBAAU,YACT,gBAAAA,MAAA,YACG;AAAA,uBACC,gBAAAD,KAAC,iBAAc,SAAQ,WAAU,MAAK,MAAK,UAAU,MAAM,cAAc,MAAM,gBAAgB,WAAW,WACvG,gBAAM,SACT,IAEA,gBAAAA,KAAC,UAAO,SAAQ,WAAU,MAAK,MAAK,UAAU,MAAM,SAAS,WAC1D,gBAAM,SACT;AAAA,QAEF,gBAAAA,KAAC,UAAO,SAAQ,aAAY,MAAK,MAAK,UAAU,MAAM,SAAS,UAC5D,gBAAM,QACT;AAAA,QACC,UAAU,MAAM,QACf,gBAAAA,KAAC,UAAO,SAAQ,SAAQ,MAAK,MAAK,UAAU,MAAM,SAAS,QACxD,gBAAM,MACT;AAAA,SAEJ,IACE;AAAA,MACJ,gBAAAA,KAAC,YAAO,uBAAqB,OAAO,WAAW,GAAG,uBAAuB,UAAU,YAAY,YAAY,mBAAmB,GAC3H,gBAAM,OAAO,KAAK,GACrB;AAAA,OACF;AAAA,KACF;AAEJ;","names":["jsx","jsxs"]}
|
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":[]}
|