@krizaka/ui 3.24.0 → 3.26.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 +9 -1
- package/dist/account-menu.d.ts +163 -0
- package/dist/account-menu.js +211 -0
- package/dist/account-menu.js.map +1 -0
- package/dist/app-shell.js +4 -4
- package/dist/changelog-page.d.ts +13 -1
- package/dist/changelog-page.js +20 -0
- package/dist/changelog-page.js.map +1 -1
- package/dist/{chunk-CEJDH6SA.js → chunk-2PNLHZLT.js} +23 -3
- package/dist/chunk-2PNLHZLT.js.map +1 -0
- package/dist/chunk-3S4GHSPZ.js +109 -0
- package/dist/chunk-3S4GHSPZ.js.map +1 -0
- package/dist/{chunk-FTX66XZY.js → chunk-BCGJZ5PG.js} +3 -3
- package/dist/{chunk-FTX66XZY.js.map → chunk-BCGJZ5PG.js.map} +1 -1
- package/dist/chunk-C7LTF5CC.js +21 -0
- package/dist/chunk-C7LTF5CC.js.map +1 -0
- package/dist/{chunk-F7FVPPBB.js → chunk-LYOPPBMC.js} +2 -2
- package/dist/{chunk-AFY35UCB.js → chunk-P7GZR5CU.js} +3 -1
- package/dist/{chunk-AFY35UCB.js.map → chunk-P7GZR5CU.js.map} +1 -1
- package/dist/code-block.js +1 -1
- package/dist/cover-hero.d.ts +125 -0
- package/dist/cover-hero.js +82 -0
- package/dist/cover-hero.js.map +1 -0
- package/dist/data-table.js +2 -2
- package/dist/docs-nav.js +3 -16
- package/dist/docs-nav.js.map +1 -1
- package/dist/dropdown-menu.d.ts +12 -1
- package/dist/dropdown-menu.js +25 -2
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/genui.js +2 -2
- package/dist/language-switch.d.ts +120 -0
- package/dist/language-switch.js +32 -0
- package/dist/language-switch.js.map +1 -0
- package/dist/media-gallery.d.ts +73 -0
- package/dist/media-gallery.js +42 -0
- package/dist/media-gallery.js.map +1 -0
- package/dist/nav-bar.d.ts +40 -2
- package/dist/nav-bar.js +68 -12
- package/dist/nav-bar.js.map +1 -1
- package/dist/opening-hours.d.ts +124 -0
- package/dist/opening-hours.js +48 -0
- package/dist/opening-hours.js.map +1 -0
- package/dist/rail-nav.js +1 -1
- package/dist/service-card.d.ts +168 -0
- package/dist/service-card.js +112 -0
- package/dist/service-card.js.map +1 -0
- package/dist/site-footer.js +1 -1
- package/dist/sites.js +2 -2
- package/dist/sites.js.map +1 -1
- package/dist/slot-picker.d.ts +119 -0
- package/dist/slot-picker.js +46 -0
- package/dist/slot-picker.js.map +1 -0
- package/dist/sticky-action.d.ts +12 -0
- package/dist/sticky-action.js +14 -0
- package/dist/sticky-action.js.map +1 -0
- package/package.json +121 -7
- package/registry/account-menu.json +280 -0
- package/registry/achievement.json +1 -1
- package/registry/action-bar.json +1 -1
- package/registry/activity-feed.json +3 -3
- package/registry/alert.json +1 -1
- 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/button.json +1 -1
- package/registry/captcha.json +1 -1
- package/registry/card-grid.json +1 -1
- package/registry/card.json +3 -3
- package/registry/catalogue-page.json +1 -1
- package/registry/changelog-page.json +3 -3
- package/registry/chat.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.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/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/countdown.json +1 -1
- package/registry/cover-hero.json +246 -0
- 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/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/dropdown-menu.json +33 -3
- package/registry/empty-state.json +1 -1
- package/registry/error-page.json +1 -1
- package/registry/examples/account-menu/default.d.ts +4 -0
- package/registry/examples/account-menu/default.js +28 -0
- package/registry/examples/account-menu/default.tsx +22 -0
- package/registry/examples/cover-hero/plain.d.ts +4 -0
- package/registry/examples/cover-hero/plain.js +12 -0
- package/registry/examples/cover-hero/plain.tsx +7 -0
- package/registry/examples/cover-hero/shop.d.ts +4 -0
- package/registry/examples/cover-hero/shop.js +27 -0
- package/registry/examples/cover-hero/shop.tsx +20 -0
- package/registry/examples/language-switch/inline.d.ts +4 -0
- package/registry/examples/language-switch/inline.js +11 -0
- package/registry/examples/language-switch/inline.tsx +6 -0
- package/registry/examples/language-switch/menu.d.ts +4 -0
- package/registry/examples/language-switch/menu.js +11 -0
- package/registry/examples/language-switch/menu.tsx +6 -0
- package/registry/examples/media-gallery/shop.d.ts +4 -0
- package/registry/examples/media-gallery/shop.js +22 -0
- package/registry/examples/media-gallery/shop.tsx +18 -0
- package/registry/examples/nav-bar/family-product.js +18 -10
- package/registry/examples/nav-bar/family-product.tsx +28 -27
- package/registry/examples/opening-hours/week.d.ts +4 -0
- package/registry/examples/opening-hours/week.js +28 -0
- package/registry/examples/opening-hours/week.tsx +22 -0
- package/registry/examples/service-card/services.d.ts +4 -0
- package/registry/examples/service-card/services.js +15 -0
- package/registry/examples/service-card/services.tsx +12 -0
- package/registry/examples/slot-picker/times.d.ts +4 -0
- package/registry/examples/slot-picker/times.js +27 -0
- package/registry/examples/slot-picker/times.tsx +23 -0
- package/registry/examples/sticky-action/phone.d.ts +4 -0
- package/registry/examples/sticky-action/phone.js +15 -0
- package/registry/examples/sticky-action/phone.tsx +14 -0
- package/registry/field.json +1 -1
- package/registry/file-upload.json +1 -1
- package/registry/filter-bar.json +1 -1
- package/registry/force-update-screen.json +1 -1
- package/registry/form.json +3 -3
- package/registry/gallery-page.json +1 -1
- package/registry/genui.json +1 -1
- package/registry/glow-card.json +1 -1
- package/registry/goal-gauge.json +1 -1
- package/registry/how-it-works-page.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/index.json +258 -5
- package/registry/iso.json +1 -1
- package/registry/kanban.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/landing-page.json +1 -1
- package/registry/landscape.json +1 -1
- package/registry/language-switch.json +246 -0
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +3 -3
- 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/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 +3 -3
- package/registry/media-gallery.json +144 -0
- package/registry/media-grid.json +3 -3
- package/registry/meta-row.json +1 -1
- package/registry/meter.json +1 -1
- package/registry/nav-bar.json +138 -8
- package/registry/number-ticker.json +1 -1
- package/registry/opening-hours.json +178 -0
- package/registry/page-header.json +1 -1
- package/registry/page-hero.json +3 -3
- package/registry/page.json +7 -7
- 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/radio-group.json +1 -1
- package/registry/rail-nav.json +2 -2
- package/registry/recipes.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 +358 -0
- package/registry/settings-layout.json +1 -1
- package/registry/showcase.json +1 -1
- package/registry/site-footer.json +2 -2
- package/registry/sites.json +2 -2
- package/registry/skeleton.json +3 -3
- package/registry/skip-link.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot-picker.json +222 -0
- package/registry/slot.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-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 +108 -0
- 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/terminal-replay.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/verified-badge.json +1 -1
- package/registry/vertical-video.json +5 -5
- package/registry/video-player.json +3 -3
- package/registry/video-trimmer.json +1 -1
- package/registry/virtual.json +1 -1
- package/registry/waveform.json +1 -1
- package/dist/chunk-CEJDH6SA.js.map +0 -1
- /package/dist/{chunk-F7FVPPBB.js.map → chunk-LYOPPBMC.js.map} +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { L as LinkComponent } from './block-link-BAg4eoZk.js';
|
|
4
|
+
|
|
5
|
+
declare const coverHero: tailwind_variants.TVReturnType<{
|
|
6
|
+
[key: string]: {
|
|
7
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
8
|
+
body?: tailwind_variants.ClassValue;
|
|
9
|
+
title?: tailwind_variants.ClassValue;
|
|
10
|
+
media?: tailwind_variants.ClassValue;
|
|
11
|
+
root?: tailwind_variants.ClassValue;
|
|
12
|
+
eyebrow?: tailwind_variants.ClassValue;
|
|
13
|
+
lead?: tailwind_variants.ClassValue;
|
|
14
|
+
actions?: tailwind_variants.ClassValue;
|
|
15
|
+
veil?: tailwind_variants.ClassValue;
|
|
16
|
+
plain?: tailwind_variants.ClassValue;
|
|
17
|
+
back?: tailwind_variants.ClassValue;
|
|
18
|
+
facts?: tailwind_variants.ClassValue;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
} | {
|
|
22
|
+
[x: string]: {
|
|
23
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
24
|
+
body?: tailwind_variants.ClassValue;
|
|
25
|
+
title?: tailwind_variants.ClassValue;
|
|
26
|
+
media?: tailwind_variants.ClassValue;
|
|
27
|
+
root?: tailwind_variants.ClassValue;
|
|
28
|
+
eyebrow?: tailwind_variants.ClassValue;
|
|
29
|
+
lead?: tailwind_variants.ClassValue;
|
|
30
|
+
actions?: tailwind_variants.ClassValue;
|
|
31
|
+
veil?: tailwind_variants.ClassValue;
|
|
32
|
+
plain?: tailwind_variants.ClassValue;
|
|
33
|
+
back?: tailwind_variants.ClassValue;
|
|
34
|
+
facts?: tailwind_variants.ClassValue;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
} | {}, {
|
|
38
|
+
root: string;
|
|
39
|
+
media: string;
|
|
40
|
+
veil: string;
|
|
41
|
+
plain: string;
|
|
42
|
+
body: string;
|
|
43
|
+
back: string;
|
|
44
|
+
eyebrow: string;
|
|
45
|
+
title: string;
|
|
46
|
+
lead: string;
|
|
47
|
+
facts: string;
|
|
48
|
+
actions: string;
|
|
49
|
+
}, undefined, {
|
|
50
|
+
[key: string]: {
|
|
51
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
52
|
+
body?: tailwind_variants.ClassValue;
|
|
53
|
+
title?: tailwind_variants.ClassValue;
|
|
54
|
+
media?: tailwind_variants.ClassValue;
|
|
55
|
+
root?: tailwind_variants.ClassValue;
|
|
56
|
+
eyebrow?: tailwind_variants.ClassValue;
|
|
57
|
+
lead?: tailwind_variants.ClassValue;
|
|
58
|
+
actions?: tailwind_variants.ClassValue;
|
|
59
|
+
veil?: tailwind_variants.ClassValue;
|
|
60
|
+
plain?: tailwind_variants.ClassValue;
|
|
61
|
+
back?: tailwind_variants.ClassValue;
|
|
62
|
+
facts?: tailwind_variants.ClassValue;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
} | {}, {
|
|
66
|
+
root: string;
|
|
67
|
+
media: string;
|
|
68
|
+
veil: string;
|
|
69
|
+
plain: string;
|
|
70
|
+
body: string;
|
|
71
|
+
back: string;
|
|
72
|
+
eyebrow: string;
|
|
73
|
+
title: string;
|
|
74
|
+
lead: string;
|
|
75
|
+
facts: string;
|
|
76
|
+
actions: string;
|
|
77
|
+
}, tailwind_variants.TVReturnTypeLike<unknown, {
|
|
78
|
+
root: string;
|
|
79
|
+
media: string;
|
|
80
|
+
veil: string;
|
|
81
|
+
plain: string;
|
|
82
|
+
body: string;
|
|
83
|
+
back: string;
|
|
84
|
+
eyebrow: string;
|
|
85
|
+
title: string;
|
|
86
|
+
lead: string;
|
|
87
|
+
facts: string;
|
|
88
|
+
actions: string;
|
|
89
|
+
}>>;
|
|
90
|
+
type CoverMedia = {
|
|
91
|
+
/** The still: the photo, or the poster of the loop (shown first, and alone under reduced motion). */
|
|
92
|
+
src: string;
|
|
93
|
+
/** What it shows, in words; empty when it only decorates. */
|
|
94
|
+
alt?: string;
|
|
95
|
+
/** A muted loop over the still: WebM first, MP4 for Safari. */
|
|
96
|
+
video?: {
|
|
97
|
+
webm?: string;
|
|
98
|
+
mp4?: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
type CoverHeroProps = Omit<React.ComponentProps<"header">, "title"> & {
|
|
102
|
+
/** The cover. Without it the hero wears the brand's colours. */
|
|
103
|
+
cover?: CoverMedia;
|
|
104
|
+
/** A short mono line above the name (where the shop is: `Saint-Henri · Montréal`). */
|
|
105
|
+
eyebrow?: React.ReactNode;
|
|
106
|
+
/** The name: the page's `h1`. */
|
|
107
|
+
title: React.ReactNode;
|
|
108
|
+
/** One line: what it promises. */
|
|
109
|
+
lead?: React.ReactNode;
|
|
110
|
+
/** Chips under the lead: open now, the neighbourhood, a rating — only what is true. */
|
|
111
|
+
facts?: React.ReactNode;
|
|
112
|
+
/** The main action (`ButtonLink`). */
|
|
113
|
+
actions?: React.ReactNode;
|
|
114
|
+
/** The way back, above the eyebrow. */
|
|
115
|
+
back?: {
|
|
116
|
+
href: string;
|
|
117
|
+
label: string;
|
|
118
|
+
};
|
|
119
|
+
/** The app's link component for the back link. */
|
|
120
|
+
linkAs?: LinkComponent;
|
|
121
|
+
};
|
|
122
|
+
/** A shop's first screen: the cover, the name, the promise, the facts and the main action. */
|
|
123
|
+
declare function CoverHero({ cover, eyebrow, title, lead, facts, actions, back, linkAs, className, ...props }: CoverHeroProps): React.JSX.Element;
|
|
124
|
+
|
|
125
|
+
export { CoverHero, type CoverHeroProps, type CoverMedia, coverHero };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ArrowGlyph
|
|
4
|
+
} from "./chunk-P7GZR5CU.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-WU4VLSEA.js";
|
|
8
|
+
import {
|
|
9
|
+
BlockLink
|
|
10
|
+
} from "./chunk-C7LTF5CC.js";
|
|
11
|
+
|
|
12
|
+
// src/cover-hero/cover-hero.tsx
|
|
13
|
+
import * as React2 from "react";
|
|
14
|
+
import { tv } from "tailwind-variants";
|
|
15
|
+
|
|
16
|
+
// src/page/page.tsx
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
function Page({ size = "default", as: Tag = "div", className, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(Tag, { "data-size": size === "default" ? void 0 : size, className: cn("kz-frame", className), ...props });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/cover-hero/cover-hero.tsx
|
|
24
|
+
import { Fragment as Fragment3, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
25
|
+
var coverHero = tv({
|
|
26
|
+
slots: {
|
|
27
|
+
root: "relative isolate flex min-h-[26rem] items-end overflow-hidden bg-surface-1 text-fg data-[cover]:text-fg-on-media sm:min-h-[30rem] lg:min-h-[34rem]",
|
|
28
|
+
media: "absolute inset-0 -z-20 h-full w-full object-cover",
|
|
29
|
+
veil: "absolute inset-0 -z-10 bg-linear-to-t from-scrim-strong via-scrim/55 to-scrim/10",
|
|
30
|
+
plain: "absolute inset-0 -z-10 bg-linear-to-br from-accent/25 via-surface-1 to-accent-2/20",
|
|
31
|
+
body: "flex flex-col gap-4 pb-8 pt-24 sm:pb-12",
|
|
32
|
+
back: "inline-flex w-fit items-center gap-1.5 text-sm font-semibold text-current no-underline opacity-90 hover:opacity-100",
|
|
33
|
+
eyebrow: "m-0 font-mono text-xs font-semibold uppercase tracking-widest opacity-90",
|
|
34
|
+
title: "m-0 max-w-3xl font-display text-4xl font-black leading-[1.05] tracking-tight sm:text-5xl lg:text-6xl",
|
|
35
|
+
lead: "m-0 max-w-2xl text-base leading-relaxed opacity-95 sm:text-lg",
|
|
36
|
+
facts: "flex flex-wrap items-center gap-2",
|
|
37
|
+
actions: "flex flex-wrap items-center gap-3 pt-1"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var s = coverHero();
|
|
41
|
+
function usePlayLoop(enabled) {
|
|
42
|
+
const [play, setPlay] = React2.useState(false);
|
|
43
|
+
React2.useEffect(() => {
|
|
44
|
+
if (!enabled) return;
|
|
45
|
+
const q = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
46
|
+
const sync = () => setPlay(!q.matches);
|
|
47
|
+
sync();
|
|
48
|
+
q.addEventListener("change", sync);
|
|
49
|
+
return () => q.removeEventListener("change", sync);
|
|
50
|
+
}, [enabled]);
|
|
51
|
+
return play;
|
|
52
|
+
}
|
|
53
|
+
function CoverHero({ cover, eyebrow, title, lead, facts, actions, back, linkAs, className, ...props }) {
|
|
54
|
+
const play = usePlayLoop(Boolean(cover?.video));
|
|
55
|
+
return /* @__PURE__ */ jsxs2("header", { "data-cover": cover ? "" : void 0, className: s.root({ className }), ...props, children: [
|
|
56
|
+
cover ? /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
57
|
+
/* @__PURE__ */ jsx2("img", { src: cover.src, alt: cover.alt ?? "", className: s.media(), fetchPriority: "high", decoding: "async" }),
|
|
58
|
+
play && cover.video && /* @__PURE__ */ jsxs2("video", { className: s.media(), poster: cover.src, autoPlay: true, muted: true, loop: true, playsInline: true, preload: "metadata", "aria-hidden": true, tabIndex: -1, children: [
|
|
59
|
+
cover.video.webm && /* @__PURE__ */ jsx2("source", { src: cover.video.webm, type: "video/webm" }),
|
|
60
|
+
cover.video.mp4 && /* @__PURE__ */ jsx2("source", { src: cover.video.mp4, type: "video/mp4" })
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ jsx2("div", { "aria-hidden": true, className: s.veil() })
|
|
63
|
+
] }) : /* @__PURE__ */ jsx2("div", { "aria-hidden": true, className: s.plain() }),
|
|
64
|
+
/* @__PURE__ */ jsx2(Page, { children: /* @__PURE__ */ jsxs2("div", { className: s.body(), children: [
|
|
65
|
+
back && /* @__PURE__ */ jsxs2(BlockLink, { href: back.href, linkAs, className: s.back(), children: [
|
|
66
|
+
/* @__PURE__ */ jsx2(ArrowGlyph, { direction: "left", className: "h-3.5 w-3.5" }),
|
|
67
|
+
" ",
|
|
68
|
+
back.label
|
|
69
|
+
] }),
|
|
70
|
+
eyebrow && /* @__PURE__ */ jsx2("p", { className: s.eyebrow(), children: eyebrow }),
|
|
71
|
+
/* @__PURE__ */ jsx2("h1", { className: s.title(), children: title }),
|
|
72
|
+
lead && /* @__PURE__ */ jsx2("p", { className: s.lead(), children: lead }),
|
|
73
|
+
facts && /* @__PURE__ */ jsx2("div", { className: s.facts(), children: facts }),
|
|
74
|
+
actions && /* @__PURE__ */ jsx2("div", { className: s.actions(), children: actions })
|
|
75
|
+
] }) })
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
CoverHero,
|
|
80
|
+
coverHero
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=cover-hero.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cover-hero/cover-hero.tsx","../src/page/page.tsx"],"sourcesContent":["// Client (the reader's motion preference). The first screen of a shop or a place: its cover — a photo, or a muted loop that\n// stays a still under reduced motion — behind the name, a one-line promise, a few facts and the main action. The words sit\n// on a veil that reads in both themes; without a cover the brand's colours take its place.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { BlockLink, type LinkComponent } from \"../block-link\";\nimport { ArrowGlyph } from \"../glyphs\";\nimport { Page } from \"../page/page\";\n\nexport const coverHero = tv({\n slots: {\n root: \"relative isolate flex min-h-[26rem] items-end overflow-hidden bg-surface-1 text-fg data-[cover]:text-fg-on-media sm:min-h-[30rem] lg:min-h-[34rem]\",\n media: \"absolute inset-0 -z-20 h-full w-full object-cover\",\n veil: \"absolute inset-0 -z-10 bg-linear-to-t from-scrim-strong via-scrim/55 to-scrim/10\",\n plain: \"absolute inset-0 -z-10 bg-linear-to-br from-accent/25 via-surface-1 to-accent-2/20\",\n body: \"flex flex-col gap-4 pb-8 pt-24 sm:pb-12\",\n back: \"inline-flex w-fit items-center gap-1.5 text-sm font-semibold text-current no-underline opacity-90 hover:opacity-100\",\n eyebrow: \"m-0 font-mono text-xs font-semibold uppercase tracking-widest opacity-90\",\n title: \"m-0 max-w-3xl font-display text-4xl font-black leading-[1.05] tracking-tight sm:text-5xl lg:text-6xl\",\n lead: \"m-0 max-w-2xl text-base leading-relaxed opacity-95 sm:text-lg\",\n facts: \"flex flex-wrap items-center gap-2\",\n actions: \"flex flex-wrap items-center gap-3 pt-1\",\n },\n});\nconst s = coverHero();\n\nexport type CoverMedia = {\n /** The still: the photo, or the poster of the loop (shown first, and alone under reduced motion). */\n src: string;\n /** What it shows, in words; empty when it only decorates. */\n alt?: string;\n /** A muted loop over the still: WebM first, MP4 for Safari. */\n video?: { webm?: string; mp4?: string };\n};\n\nexport type CoverHeroProps = Omit<React.ComponentProps<\"header\">, \"title\"> & {\n /** The cover. Without it the hero wears the brand's colours. */\n cover?: CoverMedia;\n /** A short mono line above the name (where the shop is: `Saint-Henri · Montréal`). */\n eyebrow?: React.ReactNode;\n /** The name: the page's `h1`. */\n title: React.ReactNode;\n /** One line: what it promises. */\n lead?: React.ReactNode;\n /** Chips under the lead: open now, the neighbourhood, a rating — only what is true. */\n facts?: React.ReactNode;\n /** The main action (`ButtonLink`). */\n actions?: React.ReactNode;\n /** The way back, above the eyebrow. */\n back?: { href: string; label: string };\n /** The app's link component for the back link. */\n linkAs?: LinkComponent;\n};\n\nfunction usePlayLoop(enabled: boolean) {\n const [play, setPlay] = React.useState(false);\n React.useEffect(() => {\n if (!enabled) return;\n const q = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n const sync = () => setPlay(!q.matches);\n sync();\n q.addEventListener(\"change\", sync);\n return () => q.removeEventListener(\"change\", sync);\n }, [enabled]);\n return play;\n}\n\n/** A shop's first screen: the cover, the name, the promise, the facts and the main action. */\nexport function CoverHero({ cover, eyebrow, title, lead, facts, actions, back, linkAs, className, ...props }: CoverHeroProps) {\n const play = usePlayLoop(Boolean(cover?.video));\n return (\n <header data-cover={cover ? \"\" : undefined} className={s.root({ className })} {...props}>\n {cover ? (\n <>\n <img src={cover.src} alt={cover.alt ?? \"\"} className={s.media()} fetchPriority=\"high\" decoding=\"async\" />\n {play && cover.video && (\n <video className={s.media()} poster={cover.src} autoPlay muted loop playsInline preload=\"metadata\" aria-hidden tabIndex={-1}>\n {cover.video.webm && <source src={cover.video.webm} type=\"video/webm\" />}\n {cover.video.mp4 && <source src={cover.video.mp4} type=\"video/mp4\" />}\n </video>\n )}\n <div aria-hidden className={s.veil()} />\n </>\n ) : (\n <div aria-hidden className={s.plain()} />\n )}\n <Page>\n <div className={s.body()}>\n {back && (\n <BlockLink href={back.href} linkAs={linkAs} className={s.back()}>\n <ArrowGlyph direction=\"left\" className=\"h-3.5 w-3.5\" /> {back.label}\n </BlockLink>\n )}\n {eyebrow && <p className={s.eyebrow()}>{eyebrow}</p>}\n <h1 className={s.title()}>{title}</h1>\n {lead && <p className={s.lead()}>{lead}</p>}\n {facts && <div className={s.facts()}>{facts}</div>}\n {actions && <div className={s.actions()}>{actions}</div>}\n </div>\n </Page>\n </header>\n );\n}\n","// Server-safe. The frame of every page (blocks.css): one width, one pair of gutters, one vertical rhythm — so the\n// navigation, the hero and every section line up on the same edges, at any width.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { SectionBackdrop, type SectionBackdropProps } from \"../section-backdrop/section-backdrop\";\n\nexport type PageSize = \"narrow\" | \"default\" | \"wide\" | \"full\";\n\nexport type PageProps = React.HTMLAttributes<HTMLElement> & {\n /**\n * The width of the content: `default` (72rem, `--kz-page-max`), `narrow` (48rem, a reading column), `wide`\n * (88rem, documentation with a sidebar), `full` (the gutters only).\n * @default \"default\"\n */\n size?: PageSize;\n /** The element: `div` (default), `main`, `header`, `footer`, `section` or `article`. */\n as?: \"div\" | \"main\" | \"header\" | \"footer\" | \"section\" | \"article\";\n};\n\n/** The page frame: centred, at most `--kz-page-max` wide, with the gutters of `--kz-page-gutter` (16 → 32 px). */\nexport function Page({ size = \"default\", as: Tag = \"div\", className, ...props }: PageProps) {\n return <Tag data-size={size === \"default\" ? undefined : size} className={cn(\"kz-frame\", className)} {...props} />;\n}\n\nexport type SectionHeadingProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> & {\n /** The id of the title: the section's anchor and its accessible name. */\n id?: string;\n /** A short mono line above the title (the section's subject). */\n eyebrow?: React.ReactNode;\n /** The title. */\n title: React.ReactNode;\n /** One or two sentences under the title. */\n lead?: React.ReactNode;\n /** Actions on the right of the heading (a link to everything, a filter). */\n actions?: React.ReactNode;\n /**\n * The level of the title.\n * @default 2\n */\n level?: 2 | 3;\n /**\n * `md` for a section that argues, `sm` for a section of a reading page.\n * @default \"md\"\n */\n size?: \"sm\" | \"md\";\n /**\n * `center` for a heading that stands alone above a grid.\n * @default \"start\"\n */\n align?: \"start\" | \"center\";\n /** Rises into place once, as it enters the viewport (`[data-reveal]`, MotionObserver). Never on the first screen. */\n reveal?: boolean;\n};\n\n/** The head of a section: eyebrow (mono, the accent), title, lead — and its actions on the right. */\nexport function SectionHeading({ id, eyebrow, title, lead, actions, level = 2, size = \"md\", align = \"start\", reveal, className, ...props }: SectionHeadingProps) {\n const H = level === 2 ? \"h2\" : \"h3\";\n return (\n <div\n className={cn(\"kz-heading\", className)}\n data-size={size === \"md\" ? undefined : size}\n data-align={align === \"start\" ? undefined : align}\n data-actions={actions ? \"\" : undefined}\n data-reveal={reveal ? \"\" : undefined}\n {...props}\n >\n {eyebrow && <p className=\"kz-eyebrow\">{eyebrow}</p>}\n <H id={id} className=\"kz-heading-title\">\n {title}\n </H>\n {lead && <p className=\"kz-heading-lead\">{lead}</p>}\n {actions && <div className=\"kz-heading-actions\">{actions}</div>}\n </div>\n );\n}\n\nexport type SectionProps = Omit<React.HTMLAttributes<HTMLElement>, \"title\"> & {\n /** The id of the title (and the anchor of the section). Required with a `title`. */\n id?: string;\n /** The heading's eyebrow. */\n eyebrow?: React.ReactNode;\n /** The section's title: an `h2` (a `SectionHeading`), which names the section for assistive technology. */\n title?: React.ReactNode;\n /** The heading's lead. */\n lead?: React.ReactNode;\n /** The heading's actions. */\n actions?: React.ReactNode;\n /**\n * The heading's size: `md` for a page that argues, `sm` for a reading page.\n * @default \"md\"\n */\n headingSize?: \"sm\" | \"md\";\n /**\n * The heading's alignment.\n * @default \"start\"\n */\n headingAlign?: \"start\" | \"center\";\n /** The heading rises into place once (never on the first screen). */\n reveal?: boolean;\n /** A hairline above the section, inside the gutters: the transition between two sections of the same surface. */\n divider?: boolean;\n /**\n * The vertical space above and below: `sm` (a reading page), `md`, `lg` (a page's main moments).\n * @default \"md\"\n */\n spacing?: \"sm\" | \"md\" | \"lg\";\n /**\n * The width of the content.\n * @default \"default\"\n */\n size?: PageSize;\n /** The brand's colour transition behind the section (SectionBackdrop): `true`, or its props (`direction`, `grid`…). */\n backdrop?: boolean | Omit<SectionBackdropProps, \"as\" | \"children\">;\n};\n\n/**\n * A section of a page: full-bleed (its backdrop reaches the edges), its content in the page frame, its heading on top.\n * Sections follow each other on one rhythm; a `divider` or a `backdrop` marks the transition.\n */\nexport function Section({\n id,\n eyebrow,\n title,\n lead,\n actions,\n headingSize,\n headingAlign,\n reveal,\n divider,\n spacing = \"md\",\n size,\n backdrop,\n className,\n children,\n ...props\n}: SectionProps) {\n const body = (\n <Page size={size}>\n {title && <SectionHeading id={id} eyebrow={eyebrow} title={title} lead={lead} actions={actions} size={headingSize} align={headingAlign} reveal={reveal} />}\n {children}\n </Page>\n );\n const shared = {\n \"aria-labelledby\": title && id ? id : undefined,\n \"data-divider\": divider ? \"\" : undefined,\n \"data-spacing\": spacing === \"md\" ? undefined : spacing,\n ...props,\n };\n if (backdrop) {\n const backdropProps = backdrop === true ? {} : backdrop;\n return (\n <SectionBackdrop {...backdropProps} {...shared} className={cn(\"kz-section\", className)}>\n {body}\n </SectionBackdrop>\n );\n }\n return (\n <section {...shared} className={cn(\"kz-section\", className)}>\n {body}\n </section>\n );\n}\n\nexport type TicksProps = {\n /** A sentence where words between backticks are code: \"Every request carries a `requestId`.\" */\n children: string;\n};\n\n/** A sentence of a message catalogue where words between backticks read as code — no markup in the translations. */\nexport function Ticks({ children }: TicksProps) {\n const parts = children.split(\"`\");\n return (\n <>\n {parts.map((part, i) =>\n i % 2 ? (\n <code key={i} className=\"kz-ic\">\n {part}\n </code>\n ) : (\n <React.Fragment key={i}>{part}</React.Fragment>\n ),\n )}\n </>\n );\n}\n\nexport interface Fact {\n /** A few words: `npm 2.5.0`, `Maven Central`, `in progress`. */\n label: string;\n /**\n * `ok` — published, usable today; `wip` — in progress, said honestly; `neutral` — a fact.\n * @default \"neutral\"\n */\n tone?: \"ok\" | \"wip\" | \"neutral\";\n /** Where the fact is proven (a registry page): the fact becomes a link. */\n href?: string;\n}\n\nexport type FactsProps = React.HTMLAttributes<HTMLUListElement> & {\n /** The facts, in reading order. */\n items: readonly Fact[];\n};\n\n/** Compact facts on one line — a dot that says the state, a few mono words. Links open in a new tab. */\nexport function Facts({ items, className, ...props }: FactsProps) {\n return (\n <ul className={cn(\"kz-facts\", className)} {...props}>\n {items.map((fact) => {\n const body = (\n <>\n <span className=\"kz-fact-dot\" aria-hidden /> {fact.label}\n </>\n );\n const tone = fact.tone && fact.tone !== \"neutral\" ? fact.tone : undefined;\n return (\n <li key={fact.label}>\n {fact.href ? (\n <a href={fact.href} target=\"_blank\" rel=\"noopener noreferrer\" className=\"kz-fact\" data-tone={tone}>\n {body}\n </a>\n ) : (\n <span className=\"kz-fact\" data-tone={tone}>\n {body}\n </span>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n"],"mappings":"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","names":["React","Fragment","Fragment","jsx","jsxs"]}
|
package/dist/data-table.js
CHANGED
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
dataTableCsv,
|
|
10
10
|
dataTableLabels,
|
|
11
11
|
useDataTable
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LYOPPBMC.js";
|
|
13
13
|
import "./chunk-7Z4KHPFC.js";
|
|
14
14
|
import "./chunk-JXLDUDTD.js";
|
|
15
15
|
import "./chunk-DZU6RMYD.js";
|
|
16
16
|
import "./chunk-KVDB4GXV.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-2PNLHZLT.js";
|
|
18
18
|
import "./chunk-7UCPGXKN.js";
|
|
19
19
|
import "./chunk-D3T54RSL.js";
|
|
20
20
|
import "./chunk-J3NC6ER4.js";
|
package/dist/docs-nav.js
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var twMergeConfig = {
|
|
5
|
-
extend: {
|
|
6
|
-
classGroups: {
|
|
7
|
-
"bg-image": ["bg-sheen", "bg-fill-shade", "bg-halo"],
|
|
8
|
-
shadow: ["shadow-raised", "shadow-floating", "shadow-overlay", "shadow-glow", "shadow-glow-lg"],
|
|
9
|
-
"inset-shadow": ["inset-shadow-edge", "inset-shadow-edge-fill", "inset-shadow-well"]
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
var mergeConfig = { twMergeConfig };
|
|
14
|
-
function cn(...inputs) {
|
|
15
|
-
return cnMerge(clsx(inputs))(mergeConfig) ?? "";
|
|
16
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-KH3JOEPY.js";
|
|
17
4
|
|
|
18
5
|
// src/docs-nav/docs-nav.tsx
|
|
19
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
package/dist/docs-nav.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/docs-nav/docs-nav.tsx"],"sourcesContent":["// Server-safe. The pages of a documentation, grouped: a quiet list of links, each group a native `details` (open when it\n// holds the current page), only the current page marked. No state: the app tells which page is current.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport type { LinkComponent } from \"../page-hero\";\n\nexport type DocsNavGroup = {\n /** A stable key. */\n id: string;\n /** The group's name — one word or two. */\n title: React.ReactNode;\n /** Its pages: a short, one-line title each. */\n items: readonly { href: string; label: React.ReactNode }[];\n};\n\nexport type DocsNavProps = Omit<React.HTMLAttributes<HTMLElement>, \"children\"> & {\n /** The navigation's accessible name (`Documentation`). */\n label: string;\n /** The groups, in order. */\n groups: readonly DocsNavGroup[];\n /** The `href` of the page being read. */\n current?: string;\n /** The app's link component (Next's `Link`). */\n linkAs?: LinkComponent;\n};\n\n/** The pages of the documentation in groups; the group of the current page is open, the others fold. */\nexport function DocsNav({ label, groups, current, linkAs, className, ...props }: DocsNavProps) {\n const L = linkAs ?? \"a\";\n return (\n <nav aria-label={label} className={cn(\"flex flex-col gap-1 text-sm\", className)} {...props}>\n {groups.map((g) => {\n const open = g.items.some((i) => i.href === current) || !current;\n return (\n <details key={g.id} open={open} className=\"group py-1\">\n <summary className=\"flex cursor-pointer list-none items-center justify-between rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider text-fg-muted marker:content-none hover:text-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&::-webkit-details-marker]:hidden\">\n {g.title}\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" className=\"h-3.5 w-3.5 fill-none stroke-current stroke-2 transition-transform group-open:rotate-180 motion-reduce:transition-none\">\n <path d=\"m6 9 6 6 6-6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </summary>\n <ul className=\"mt-1 flex flex-col gap-0.5 border-l border-border-subtle\">\n {g.items.map((i) => (\n <li key={i.href}>\n <L\n href={i.href}\n aria-current={i.href === current ? \"page\" : undefined}\n className=\"-ml-px block truncate border-l border-transparent px-3 py-1.5 text-fg-secondary no-underline transition-colors hover:text-fg focus-visible:outline-2 focus-visible:outline-ring aria-[current=page]:border-accent aria-[current=page]:font-semibold aria-[current=page]:text-fg\"\n >\n {i.label}\n </L>\n </li>\n ))}\n </ul>\n </details>\n );\n })}\n </nav>\n );\n}\n"],"mappings":";;;;;AAoCY,SAGI,KAHJ;AARL,SAAS,QAAQ,EAAE,OAAO,QAAQ,SAAS,QAAQ,WAAW,GAAG,MAAM,GAAiB;AAC7F,QAAM,IAAI,UAAU;AACpB,SACE,oBAAC,SAAI,cAAY,OAAO,WAAW,GAAG,+BAA+B,SAAS,GAAI,GAAG,OAClF,iBAAO,IAAI,CAAC,MAAM;AACjB,UAAM,OAAO,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,OAAO,KAAK,CAAC;AACzD,WACE,qBAAC,aAAmB,MAAY,WAAU,cACxC;AAAA,2BAAC,aAAQ,WAAU,ySAChB;AAAA,UAAE;AAAA,QACH,oBAAC,SAAI,SAAQ,aAAY,eAAY,QAAO,WAAU,SAAQ,WAAU,0HACtE,8BAAC,UAAK,GAAE,gBAAe,eAAc,SAAQ,gBAAe,SAAQ,GACtE;AAAA,SACF;AAAA,MACA,oBAAC,QAAG,WAAU,4DACX,YAAE,MAAM,IAAI,CAAC,MACZ,oBAAC,QACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAM,EAAE;AAAA,UACR,gBAAc,EAAE,SAAS,UAAU,SAAS;AAAA,UAC5C,WAAU;AAAA,UAET,YAAE;AAAA;AAAA,MACL,KAPO,EAAE,IAQX,CACD,GACH;AAAA,SAnBY,EAAE,EAoBhB;AAAA,EAEJ,CAAC,GACH;AAEJ;","names":[]}
|
package/dist/dropdown-menu.d.ts
CHANGED
|
@@ -55,6 +55,12 @@ type DropdownMenuItemProps = React.ComponentProps<typeof DropdownMenu$1.Item> &
|
|
|
55
55
|
declare function DropdownMenuItem({ tone, className, ...props }: DropdownMenuItemProps): React.JSX.Element;
|
|
56
56
|
/** A toggled option: `checked` + `onCheckedChange`. */
|
|
57
57
|
declare function DropdownMenuCheckboxItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenu$1.CheckboxItem>): React.JSX.Element;
|
|
58
|
+
/** A submenu's trigger: an item that opens `DropdownMenu.SubContent`, with a chevron. */
|
|
59
|
+
declare function DropdownMenuSubTrigger({ className, children, ...props }: React.ComponentProps<typeof DropdownMenu$1.SubTrigger>): React.JSX.Element;
|
|
60
|
+
/** The submenu's panel (same material as the menu). */
|
|
61
|
+
declare function DropdownMenuSubContent({ sideOffset, collisionPadding, className, ...props }: React.ComponentProps<typeof DropdownMenu$1.SubContent>): React.JSX.Element;
|
|
62
|
+
/** One choice among several (`DropdownMenu.RadioGroup` holds the value): a language, a sort order. */
|
|
63
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenu$1.RadioItem>): React.JSX.Element;
|
|
58
64
|
declare function DropdownMenuLabel({ className, ...props }: React.ComponentProps<typeof DropdownMenu$1.Label>): React.JSX.Element;
|
|
59
65
|
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenu$1.Separator>): React.JSX.Element;
|
|
60
66
|
/** `DropdownMenu.Root/Trigger/Content/Item/CheckboxItem/Label/Separator/Group`. `open`/`defaultOpen` + `onOpenChange`. */
|
|
@@ -67,6 +73,11 @@ declare const DropdownMenu: {
|
|
|
67
73
|
Label: typeof DropdownMenuLabel;
|
|
68
74
|
Separator: typeof DropdownMenuSeparator;
|
|
69
75
|
Group: React.ForwardRefExoticComponent<DropdownMenu$1.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
76
|
+
Sub: React.FC<DropdownMenu$1.DropdownMenuSubProps>;
|
|
77
|
+
SubTrigger: typeof DropdownMenuSubTrigger;
|
|
78
|
+
SubContent: typeof DropdownMenuSubContent;
|
|
79
|
+
RadioGroup: React.ForwardRefExoticComponent<DropdownMenu$1.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
80
|
+
RadioItem: typeof DropdownMenuRadioItem;
|
|
70
81
|
};
|
|
71
82
|
|
|
72
|
-
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuSeparator, menu };
|
|
83
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSubContent, DropdownMenuSubTrigger, menu };
|
package/dist/dropdown-menu.js
CHANGED
|
@@ -12,7 +12,7 @@ import { tv } from "tailwind-variants";
|
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
var menu = tv({
|
|
14
14
|
slots: {
|
|
15
|
-
content: cn(floating, "min-w-48 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto p-1 origin-(--radix-dropdown-menu-content-transform-origin)"),
|
|
15
|
+
content: cn(floating, "min-w-48 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto overflow-x-hidden overscroll-contain p-1 origin-(--radix-dropdown-menu-content-transform-origin)"),
|
|
16
16
|
item: "relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-2 text-sm text-fg outline-hidden transition-colors data-highlighted:bg-surface-3 data-disabled:pointer-events-none data-disabled:opacity-40 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0 [&>svg]:text-fg-secondary",
|
|
17
17
|
indicator: "ml-auto flex h-4 w-4 items-center justify-center text-fg-accent",
|
|
18
18
|
label: "px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wider text-fg-secondary",
|
|
@@ -38,6 +38,21 @@ function DropdownMenuCheckboxItem({ className, children, ...props }) {
|
|
|
38
38
|
/* @__PURE__ */ jsx(MenuPrimitive.ItemIndicator, { className: s.indicator(), children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) }) })
|
|
39
39
|
] });
|
|
40
40
|
}
|
|
41
|
+
function DropdownMenuSubTrigger({ className, children, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsxs(MenuPrimitive.SubTrigger, { className: s.item({ className: cn("data-[state=open]:bg-surface-3", className) }), ...props, children: [
|
|
43
|
+
children,
|
|
44
|
+
/* @__PURE__ */ jsx("svg", { className: "ml-auto !h-4 !w-4 text-fg-secondary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" }) })
|
|
45
|
+
] });
|
|
46
|
+
}
|
|
47
|
+
function DropdownMenuSubContent({ sideOffset = 4, collisionPadding = 8, className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(MenuPrimitive.SubContent, { sideOffset, collisionPadding, className: s.content({ className: cn("max-h-(--radix-dropdown-menu-content-available-height)", className) }), ...props }) });
|
|
49
|
+
}
|
|
50
|
+
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsxs(MenuPrimitive.RadioItem, { className: s.item({ className }), ...props, children: [
|
|
52
|
+
children,
|
|
53
|
+
/* @__PURE__ */ jsx(MenuPrimitive.ItemIndicator, { className: s.indicator(), children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) }) })
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
41
56
|
function DropdownMenuLabel({ className, ...props }) {
|
|
42
57
|
return /* @__PURE__ */ jsx(MenuPrimitive.Label, { className: s.label({ className }), ...props });
|
|
43
58
|
}
|
|
@@ -52,7 +67,12 @@ var DropdownMenu = {
|
|
|
52
67
|
CheckboxItem: DropdownMenuCheckboxItem,
|
|
53
68
|
Label: DropdownMenuLabel,
|
|
54
69
|
Separator: DropdownMenuSeparator,
|
|
55
|
-
Group: MenuPrimitive.Group
|
|
70
|
+
Group: MenuPrimitive.Group,
|
|
71
|
+
Sub: MenuPrimitive.Sub,
|
|
72
|
+
SubTrigger: DropdownMenuSubTrigger,
|
|
73
|
+
SubContent: DropdownMenuSubContent,
|
|
74
|
+
RadioGroup: MenuPrimitive.RadioGroup,
|
|
75
|
+
RadioItem: DropdownMenuRadioItem
|
|
56
76
|
};
|
|
57
77
|
export {
|
|
58
78
|
DropdownMenu,
|
|
@@ -60,7 +80,10 @@ export {
|
|
|
60
80
|
DropdownMenuContent,
|
|
61
81
|
DropdownMenuItem,
|
|
62
82
|
DropdownMenuLabel,
|
|
83
|
+
DropdownMenuRadioItem,
|
|
63
84
|
DropdownMenuSeparator,
|
|
85
|
+
DropdownMenuSubContent,
|
|
86
|
+
DropdownMenuSubTrigger,
|
|
64
87
|
menu
|
|
65
88
|
};
|
|
66
89
|
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["// Client (a portal). Radix does the roving focus, the arrows, Home/End, typeahead, Escape and the focus return.\nimport { DropdownMenu as MenuPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { cn } from \"../cn\";\nimport { floating } from \"../floating\";\n\nexport const menu = tv({\n slots: {\n content: cn(floating, \"min-w-48 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto p-1 origin-(--radix-dropdown-menu-content-transform-origin)\"),\n item:\n \"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-2 text-sm text-fg outline-hidden transition-colors \" +\n \"data-highlighted:bg-surface-3 data-disabled:pointer-events-none data-disabled:opacity-40 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0 \" +\n \"[&>svg]:text-fg-secondary\",\n indicator: \"ml-auto flex h-4 w-4 items-center justify-center text-fg-accent\",\n label: \"px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wider text-fg-secondary\",\n separator: \"-mx-1 my-1 h-px bg-border-subtle\",\n },\n variants: {\n // The label reads in the danger text role (≥ 4.5:1 on the menu surface, both themes); the icon and the highlight\n // carry the danger fill.\n tone: { default: {}, danger: { item: \"text-fg-danger data-highlighted:bg-danger/15 [&>svg]:text-danger\" } },\n },\n defaultVariants: { tone: \"default\" },\n});\nconst s = menu();\n\nexport type DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Content> & {\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n};\n\nexport function DropdownMenuContent({ sideOffset = 6, align = \"end\", collisionPadding = 8, container, className, ...props }: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Content sideOffset={sideOffset} align={align} collisionPadding={collisionPadding} className={s.content({ className })} {...props} />\n </MenuPrimitive.Portal>\n );\n}\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & {\n /** `danger` for a destructive action: the icon and the highlight carry the danger, the label stays legible. */\n tone?: \"default\" | \"danger\";\n};\n\n/** An action. `tone=\"danger\"` for a destructive one; `onSelect` runs it (the menu closes). */\nexport function DropdownMenuItem({ tone, className, ...props }: DropdownMenuItemProps) {\n return <MenuPrimitive.Item data-tone={tone ?? \"default\"} className={menu({ tone }).item({ className })} {...props} />;\n}\n\n/** A toggled option: `checked` + `onCheckedChange`. */\nexport function DropdownMenuCheckboxItem({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n return (\n <MenuPrimitive.CheckboxItem className={s.item({ className })} {...props}>\n {children}\n <MenuPrimitive.ItemIndicator className={s.indicator()}>\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n </MenuPrimitive.ItemIndicator>\n </MenuPrimitive.CheckboxItem>\n );\n}\n\nexport function DropdownMenuLabel({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Label>) {\n return <MenuPrimitive.Label className={s.label({ className })} {...props} />;\n}\n\nexport function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return <MenuPrimitive.Separator className={s.separator({ className })} {...props} />;\n}\n\n/** `DropdownMenu.Root/Trigger/Content/Item/CheckboxItem/Label/Separator/Group`. `open`/`defaultOpen` + `onOpenChange`. */\nexport const DropdownMenu = {\n Root: MenuPrimitive.Root,\n Trigger: MenuPrimitive.Trigger,\n Content: DropdownMenuContent,\n Item: DropdownMenuItem,\n CheckboxItem: DropdownMenuCheckboxItem,\n Label: DropdownMenuLabel,\n Separator: DropdownMenuSeparator,\n Group: MenuPrimitive.Group,\n};\n"],"mappings":";;;;;;;;;AACA,SAAS,gBAAgB,qBAAqB;AAE9C,SAAS,UAAU;AAiCb,cAkBF,YAlBE;AA5BC,IAAM,OAAO,GAAG;AAAA,EACrB,OAAO;AAAA,IACL,SAAS,GAAG,UAAU,
|
|
1
|
+
{"version":3,"sources":["../src/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["// Client (a portal). Radix does the roving focus, the arrows, Home/End, typeahead, Escape and the focus return.\nimport { DropdownMenu as MenuPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { cn } from \"../cn\";\nimport { floating } from \"../floating\";\n\nexport const menu = tv({\n slots: {\n content: cn(floating, \"min-w-48 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto overflow-x-hidden overscroll-contain p-1 origin-(--radix-dropdown-menu-content-transform-origin)\"),\n item:\n \"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-2 text-sm text-fg outline-hidden transition-colors \" +\n \"data-highlighted:bg-surface-3 data-disabled:pointer-events-none data-disabled:opacity-40 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0 \" +\n \"[&>svg]:text-fg-secondary\",\n indicator: \"ml-auto flex h-4 w-4 items-center justify-center text-fg-accent\",\n label: \"px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wider text-fg-secondary\",\n separator: \"-mx-1 my-1 h-px bg-border-subtle\",\n },\n variants: {\n // The label reads in the danger text role (≥ 4.5:1 on the menu surface, both themes); the icon and the highlight\n // carry the danger fill.\n tone: { default: {}, danger: { item: \"text-fg-danger data-highlighted:bg-danger/15 [&>svg]:text-danger\" } },\n },\n defaultVariants: { tone: \"default\" },\n});\nconst s = menu();\n\nexport type DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Content> & {\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n};\n\nexport function DropdownMenuContent({ sideOffset = 6, align = \"end\", collisionPadding = 8, container, className, ...props }: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Content sideOffset={sideOffset} align={align} collisionPadding={collisionPadding} className={s.content({ className })} {...props} />\n </MenuPrimitive.Portal>\n );\n}\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & {\n /** `danger` for a destructive action: the icon and the highlight carry the danger, the label stays legible. */\n tone?: \"default\" | \"danger\";\n};\n\n/** An action. `tone=\"danger\"` for a destructive one; `onSelect` runs it (the menu closes). */\nexport function DropdownMenuItem({ tone, className, ...props }: DropdownMenuItemProps) {\n return <MenuPrimitive.Item data-tone={tone ?? \"default\"} className={menu({ tone }).item({ className })} {...props} />;\n}\n\n/** A toggled option: `checked` + `onCheckedChange`. */\nexport function DropdownMenuCheckboxItem({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n return (\n <MenuPrimitive.CheckboxItem className={s.item({ className })} {...props}>\n {children}\n <MenuPrimitive.ItemIndicator className={s.indicator()}>\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n </MenuPrimitive.ItemIndicator>\n </MenuPrimitive.CheckboxItem>\n );\n}\n\n/** A submenu's trigger: an item that opens `DropdownMenu.SubContent`, with a chevron. */\nexport function DropdownMenuSubTrigger({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.SubTrigger>) {\n return (\n <MenuPrimitive.SubTrigger className={s.item({ className: cn(\"data-[state=open]:bg-surface-3\", className) })} {...props}>\n {children}\n <svg className=\"ml-auto !h-4 !w-4 text-fg-secondary\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </MenuPrimitive.SubTrigger>\n );\n}\n\n/** The submenu's panel (same material as the menu). */\nexport function DropdownMenuSubContent({ sideOffset = 4, collisionPadding = 8, className, ...props }: React.ComponentProps<typeof MenuPrimitive.SubContent>) {\n return (\n <MenuPrimitive.Portal>\n <MenuPrimitive.SubContent sideOffset={sideOffset} collisionPadding={collisionPadding} className={s.content({ className: cn(\"max-h-(--radix-dropdown-menu-content-available-height)\", className) })} {...props} />\n </MenuPrimitive.Portal>\n );\n}\n\n/** One choice among several (`DropdownMenu.RadioGroup` holds the value): a language, a sort order. */\nexport function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.RadioItem>) {\n return (\n <MenuPrimitive.RadioItem className={s.item({ className })} {...props}>\n {children}\n <MenuPrimitive.ItemIndicator className={s.indicator()}>\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n </MenuPrimitive.ItemIndicator>\n </MenuPrimitive.RadioItem>\n );\n}\n\nexport function DropdownMenuLabel({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Label>) {\n return <MenuPrimitive.Label className={s.label({ className })} {...props} />;\n}\n\nexport function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return <MenuPrimitive.Separator className={s.separator({ className })} {...props} />;\n}\n\n/** `DropdownMenu.Root/Trigger/Content/Item/CheckboxItem/Label/Separator/Group`. `open`/`defaultOpen` + `onOpenChange`. */\nexport const DropdownMenu = {\n Root: MenuPrimitive.Root,\n Trigger: MenuPrimitive.Trigger,\n Content: DropdownMenuContent,\n Item: DropdownMenuItem,\n CheckboxItem: DropdownMenuCheckboxItem,\n Label: DropdownMenuLabel,\n Separator: DropdownMenuSeparator,\n Group: MenuPrimitive.Group,\n Sub: MenuPrimitive.Sub,\n SubTrigger: DropdownMenuSubTrigger,\n SubContent: DropdownMenuSubContent,\n RadioGroup: MenuPrimitive.RadioGroup,\n RadioItem: DropdownMenuRadioItem,\n};\n"],"mappings":";;;;;;;;;AACA,SAAS,gBAAgB,qBAAqB;AAE9C,SAAS,UAAU;AAiCb,cAkBF,YAlBE;AA5BC,IAAM,OAAO,GAAG;AAAA,EACrB,OAAO;AAAA,IACL,SAAS,GAAG,UAAU,kLAAkL;AAAA,IACxM,MACE;AAAA,IAGF,WAAW;AAAA,IACX,OAAO;AAAA,IACP,WAAW;AAAA,EACb;AAAA,EACA,UAAU;AAAA;AAAA;AAAA,IAGR,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAAE,MAAM,mEAAmE,EAAE;AAAA,EAC5G;AAAA,EACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AACD,IAAM,IAAI,KAAK;AAOR,SAAS,oBAAoB,EAAE,aAAa,GAAG,QAAQ,OAAO,mBAAmB,GAAG,WAAW,WAAW,GAAG,MAAM,GAA6B;AACrJ,SACE,oBAAC,cAAc,QAAd,EAAqB,WACpB,8BAAC,cAAc,SAAd,EAAsB,YAAwB,OAAc,kBAAoC,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO,GACnJ;AAEJ;AAQO,SAAS,iBAAiB,EAAE,MAAM,WAAW,GAAG,MAAM,GAA0B;AACrF,SAAO,oBAAC,cAAc,MAAd,EAAmB,aAAW,QAAQ,WAAW,WAAW,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AACrH;AAGO,SAAS,yBAAyB,EAAE,WAAW,UAAU,GAAG,MAAM,GAA4D;AACnI,SACE,qBAAC,cAAc,cAAd,EAA2B,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAC/D;AAAA;AAAA,IACD,oBAAC,cAAc,eAAd,EAA4B,WAAW,EAAE,UAAU,GAClD,8BAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,OAAM,eAAc,SAAQ,gBAAe,SAAQ,eAAW,MACnI,8BAAC,UAAK,GAAE,mBAAkB,GAC5B,GACF;AAAA,KACF;AAEJ;AAGO,SAAS,uBAAuB,EAAE,WAAW,UAAU,GAAG,MAAM,GAA0D;AAC/H,SACE,qBAAC,cAAc,YAAd,EAAyB,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,kCAAkC,SAAS,EAAE,CAAC,GAAI,GAAG,OAC9G;AAAA;AAAA,IACD,oBAAC,SAAI,WAAU,uCAAsC,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,KAAI,eAAc,SAAQ,gBAAe,SAAQ,eAAW,MACjL,8BAAC,UAAK,GAAE,iBAAgB,GAC1B;AAAA,KACF;AAEJ;AAGO,SAAS,uBAAuB,EAAE,aAAa,GAAG,mBAAmB,GAAG,WAAW,GAAG,MAAM,GAA0D;AAC3J,SACE,oBAAC,cAAc,QAAd,EACC,8BAAC,cAAc,YAAd,EAAyB,YAAwB,kBAAoC,WAAW,EAAE,QAAQ,EAAE,WAAW,GAAG,0DAA0D,SAAS,EAAE,CAAC,GAAI,GAAG,OAAO,GACjN;AAEJ;AAGO,SAAS,sBAAsB,EAAE,WAAW,UAAU,GAAG,MAAM,GAAyD;AAC7H,SACE,qBAAC,cAAc,WAAd,EAAwB,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAC5D;AAAA;AAAA,IACD,oBAAC,cAAc,eAAd,EAA4B,WAAW,EAAE,UAAU,GAClD,8BAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,OAAM,eAAc,SAAQ,gBAAe,SAAQ,eAAW,MACnI,8BAAC,UAAK,GAAE,mBAAkB,GAC5B,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,kBAAkB,EAAE,WAAW,GAAG,MAAM,GAAqD;AAC3G,SAAO,oBAAC,cAAc,OAAd,EAAoB,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AAC5E;AAEO,SAAS,sBAAsB,EAAE,WAAW,GAAG,MAAM,GAAyD;AACnH,SAAO,oBAAC,cAAc,WAAd,EAAwB,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AACpF;AAGO,IAAM,eAAe;AAAA,EAC1B,MAAM,cAAc;AAAA,EACpB,SAAS,cAAc;AAAA,EACvB,SAAS;AAAA,EACT,MAAM;AAAA,EACN,cAAc;AAAA,EACd,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO,cAAc;AAAA,EACrB,KAAK,cAAc;AAAA,EACnB,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY,cAAc;AAAA,EAC1B,WAAW;AACb;","names":[]}
|
package/dist/filter-bar.js
CHANGED
package/dist/genui.js
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./chunk-MQPC3P4T.js";
|
|
8
8
|
import {
|
|
9
9
|
DataTable
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LYOPPBMC.js";
|
|
11
11
|
import "./chunk-7Z4KHPFC.js";
|
|
12
12
|
import "./chunk-JXLDUDTD.js";
|
|
13
13
|
import "./chunk-DZU6RMYD.js";
|
|
14
14
|
import "./chunk-KVDB4GXV.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-2PNLHZLT.js";
|
|
16
16
|
import "./chunk-7UCPGXKN.js";
|
|
17
17
|
import "./chunk-D3T54RSL.js";
|
|
18
18
|
import "./chunk-J3NC6ER4.js";
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/** A language the site speaks: its code (`fr`), its name in its own language (`Français`) and the address of the page in it. */
|
|
5
|
+
interface Language {
|
|
6
|
+
code: string;
|
|
7
|
+
name: string;
|
|
8
|
+
href: string;
|
|
9
|
+
}
|
|
10
|
+
/** The languages of the family, each named in its own language — the switch never shows “French” to a French reader. */
|
|
11
|
+
declare const languageNames: Readonly<Record<string, string>>;
|
|
12
|
+
/**
|
|
13
|
+
* The same page in another language: `/fr/baux?x=1#a` → `/en/baux?x=1#a`. The first segment is the language when it is
|
|
14
|
+
* one of `locales`; an address without a language prefix gets one. Query and hash are kept.
|
|
15
|
+
*/
|
|
16
|
+
declare function languageHref(path: string, to: string, locales?: readonly string[]): string;
|
|
17
|
+
/** The `languages` of a switch for the page at `path`, in the order of `locales`, each named in its own language. */
|
|
18
|
+
declare function languagesFor(path: string, locales?: readonly string[]): Language[];
|
|
19
|
+
|
|
20
|
+
declare const languageSwitch: tailwind_variants.TVReturnType<{
|
|
21
|
+
[key: string]: {
|
|
22
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
23
|
+
heading?: tailwind_variants.ClassValue;
|
|
24
|
+
root?: tailwind_variants.ClassValue;
|
|
25
|
+
glyph?: tailwind_variants.ClassValue;
|
|
26
|
+
panel?: tailwind_variants.ClassValue;
|
|
27
|
+
check?: tailwind_variants.ClassValue;
|
|
28
|
+
inline?: tailwind_variants.ClassValue;
|
|
29
|
+
trigger?: tailwind_variants.ClassValue;
|
|
30
|
+
item?: tailwind_variants.ClassValue;
|
|
31
|
+
inlineLink?: tailwind_variants.ClassValue;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
} | {
|
|
35
|
+
[x: string]: {
|
|
36
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
37
|
+
heading?: tailwind_variants.ClassValue;
|
|
38
|
+
root?: tailwind_variants.ClassValue;
|
|
39
|
+
glyph?: tailwind_variants.ClassValue;
|
|
40
|
+
panel?: tailwind_variants.ClassValue;
|
|
41
|
+
check?: tailwind_variants.ClassValue;
|
|
42
|
+
inline?: tailwind_variants.ClassValue;
|
|
43
|
+
trigger?: tailwind_variants.ClassValue;
|
|
44
|
+
item?: tailwind_variants.ClassValue;
|
|
45
|
+
inlineLink?: tailwind_variants.ClassValue;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
} | {}, {
|
|
49
|
+
root: string;
|
|
50
|
+
trigger: string;
|
|
51
|
+
glyph: string;
|
|
52
|
+
panel: string;
|
|
53
|
+
heading: string;
|
|
54
|
+
item: string;
|
|
55
|
+
check: string;
|
|
56
|
+
inline: string;
|
|
57
|
+
inlineLink: string;
|
|
58
|
+
}, undefined, {
|
|
59
|
+
[key: string]: {
|
|
60
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
61
|
+
heading?: tailwind_variants.ClassValue;
|
|
62
|
+
root?: tailwind_variants.ClassValue;
|
|
63
|
+
glyph?: tailwind_variants.ClassValue;
|
|
64
|
+
panel?: tailwind_variants.ClassValue;
|
|
65
|
+
check?: tailwind_variants.ClassValue;
|
|
66
|
+
inline?: tailwind_variants.ClassValue;
|
|
67
|
+
trigger?: tailwind_variants.ClassValue;
|
|
68
|
+
item?: tailwind_variants.ClassValue;
|
|
69
|
+
inlineLink?: tailwind_variants.ClassValue;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
} | {}, {
|
|
73
|
+
root: string;
|
|
74
|
+
trigger: string;
|
|
75
|
+
glyph: string;
|
|
76
|
+
panel: string;
|
|
77
|
+
heading: string;
|
|
78
|
+
item: string;
|
|
79
|
+
check: string;
|
|
80
|
+
inline: string;
|
|
81
|
+
inlineLink: string;
|
|
82
|
+
}, tailwind_variants.TVReturnTypeLike<unknown, {
|
|
83
|
+
root: string;
|
|
84
|
+
trigger: string;
|
|
85
|
+
glyph: string;
|
|
86
|
+
panel: string;
|
|
87
|
+
heading: string;
|
|
88
|
+
item: string;
|
|
89
|
+
check: string;
|
|
90
|
+
inline: string;
|
|
91
|
+
inlineLink: string;
|
|
92
|
+
}>>;
|
|
93
|
+
type LanguageSwitchProps = {
|
|
94
|
+
/** The control's accessible name (“Language”, “Langue”) — passed translated. */
|
|
95
|
+
label: string;
|
|
96
|
+
/** The code of the page's language (`fr`). */
|
|
97
|
+
current: string;
|
|
98
|
+
/** The languages offered, each with its name in its own language and the address of the same page (`languagesFor`). */
|
|
99
|
+
languages: readonly Language[];
|
|
100
|
+
/**
|
|
101
|
+
* `menu`: a globe and the code, opening a menu (the bar). `inline`: every language in a row (a mobile panel, a settings page).
|
|
102
|
+
* @default "menu"
|
|
103
|
+
*/
|
|
104
|
+
variant?: "menu" | "inline";
|
|
105
|
+
/** Your router's `<Link>` (it receives `href`, `hrefLang`, `lang`). A plain `<a>` otherwise. */
|
|
106
|
+
linkAs?: React.ElementType;
|
|
107
|
+
/** Opens the menu at first render (a story, a screenshot). */
|
|
108
|
+
defaultOpen?: boolean;
|
|
109
|
+
/** Classes of the control. */
|
|
110
|
+
className?: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* The language switch, the same on every Krizaka site and app: a compact control — a globe and the current code
|
|
114
|
+
* (`FR`) — that opens a menu of the languages named in their own language (Français · English), each a link with
|
|
115
|
+
* `hreflang` to the same page. It shows the language you are in, never the “other” one. `variant="inline"` lays the
|
|
116
|
+
* languages in a row for a phone's panel or a settings page.
|
|
117
|
+
*/
|
|
118
|
+
declare function LanguageSwitch({ label, current, languages, variant, linkAs, defaultOpen, className }: LanguageSwitchProps): React.JSX.Element;
|
|
119
|
+
|
|
120
|
+
export { type Language, LanguageSwitch, type LanguageSwitchProps, languageHref, languageNames, languageSwitch, languagesFor };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
LanguageSwitch,
|
|
4
|
+
languageSwitch
|
|
5
|
+
} from "./chunk-3S4GHSPZ.js";
|
|
6
|
+
|
|
7
|
+
// src/language-switch/href.ts
|
|
8
|
+
var languageNames = {
|
|
9
|
+
en: "English",
|
|
10
|
+
fr: "Fran\xE7ais",
|
|
11
|
+
es: "Espa\xF1ol",
|
|
12
|
+
de: "Deutsch",
|
|
13
|
+
it: "Italiano",
|
|
14
|
+
pt: "Portugu\xEAs"
|
|
15
|
+
};
|
|
16
|
+
function languageHref(path, to, locales = ["en", "fr"]) {
|
|
17
|
+
const [, pathname = "/", rest = ""] = /^([^?#]*)(.*)$/.exec(path) ?? [];
|
|
18
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
19
|
+
if (segments[0] && locales.includes(segments[0])) segments.shift();
|
|
20
|
+
return `/${[to, ...segments].join("/")}${rest}`;
|
|
21
|
+
}
|
|
22
|
+
function languagesFor(path, locales = ["en", "fr"]) {
|
|
23
|
+
return locales.map((code) => ({ code, name: languageNames[code] ?? code.toUpperCase(), href: languageHref(path, code, locales) }));
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
LanguageSwitch,
|
|
27
|
+
languageHref,
|
|
28
|
+
languageNames,
|
|
29
|
+
languageSwitch,
|
|
30
|
+
languagesFor
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=language-switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/language-switch/href.ts"],"sourcesContent":["/** A language the site speaks: its code (`fr`), its name in its own language (`Français`) and the address of the page in it. */\nexport interface Language {\n code: string;\n name: string;\n href: string;\n}\n\n/** The languages of the family, each named in its own language — the switch never shows “French” to a French reader. */\nexport const languageNames: Readonly<Record<string, string>> = {\n en: \"English\",\n fr: \"Français\",\n es: \"Español\",\n de: \"Deutsch\",\n it: \"Italiano\",\n pt: \"Português\",\n};\n\n/**\n * The same page in another language: `/fr/baux?x=1#a` → `/en/baux?x=1#a`. The first segment is the language when it is\n * one of `locales`; an address without a language prefix gets one. Query and hash are kept.\n */\nexport function languageHref(path: string, to: string, locales: readonly string[] = [\"en\", \"fr\"]): string {\n const [, pathname = \"/\", rest = \"\"] = /^([^?#]*)(.*)$/.exec(path) ?? [];\n const segments = pathname.split(\"/\").filter(Boolean);\n if (segments[0] && locales.includes(segments[0])) segments.shift();\n return `/${[to, ...segments].join(\"/\")}${rest}`;\n}\n\n/** The `languages` of a switch for the page at `path`, in the order of `locales`, each named in its own language. */\nexport function languagesFor(path: string, locales: readonly string[] = [\"en\", \"fr\"]): Language[] {\n return locales.map((code) => ({ code, name: languageNames[code] ?? code.toUpperCase(), href: languageHref(path, code, locales) }));\n}\n"],"mappings":";;;;;;;AAQO,IAAM,gBAAkD;AAAA,EAC7D,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAMO,SAAS,aAAa,MAAc,IAAY,UAA6B,CAAC,MAAM,IAAI,GAAW;AACxG,QAAM,CAAC,EAAE,WAAW,KAAK,OAAO,EAAE,IAAI,iBAAiB,KAAK,IAAI,KAAK,CAAC;AACtE,QAAM,WAAW,SAAS,MAAM,GAAG,EAAE,OAAO,OAAO;AACnD,MAAI,SAAS,CAAC,KAAK,QAAQ,SAAS,SAAS,CAAC,CAAC,EAAG,UAAS,MAAM;AACjE,SAAO,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,KAAK,GAAG,CAAC,GAAG,IAAI;AAC/C;AAGO,SAAS,aAAa,MAAc,UAA6B,CAAC,MAAM,IAAI,GAAe;AAChG,SAAO,QAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,MAAM,cAAc,IAAI,KAAK,KAAK,YAAY,GAAG,MAAM,aAAa,MAAM,MAAM,OAAO,EAAE,EAAE;AACnI;","names":[]}
|