@krizaka/ui 3.70.0 → 3.72.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/account-menu.d.ts +1 -1
- package/dist/account-menu.js +1 -1
- package/dist/account-settings.d.ts +1 -1
- package/dist/account-settings.js +1 -1
- package/dist/avatar/defaults.d.ts +22 -2
- package/dist/avatar/defaults.js +20 -7
- package/dist/avatar/defaults.js.map +1 -1
- package/dist/{avatar-BdZcfkWR.d.ts → avatar-B_na7r1U.d.ts} +16 -0
- package/dist/avatar.d.ts +22 -2
- package/dist/avatar.js +20 -7
- package/dist/avatar.js.map +1 -1
- package/dist/blocks.css +37 -0
- package/dist/chat.js +1 -1
- package/dist/chunk-3PRYL2LS.js +2 -0
- package/dist/chunk-3PRYL2LS.js.map +1 -0
- package/dist/{chunk-HK525THY.js → chunk-5MPPIGCB.js} +18 -7
- package/dist/chunk-5MPPIGCB.js.map +1 -0
- package/dist/{chunk-CSRKYZ53.js → chunk-CZHPWLNW.js} +1 -1
- package/dist/{chunk-PZ4FJOD5.js → chunk-HLEBSAGC.js} +5 -1
- package/dist/{chunk-PZ4FJOD5.js.map → chunk-HLEBSAGC.js.map} +1 -1
- package/dist/chunk-M3T5RQYV.js +34 -0
- package/dist/chunk-M3T5RQYV.js.map +1 -0
- package/dist/{chunk-EUJ7337V.js → chunk-TISDOZH3.js} +18 -7
- package/dist/chunk-TISDOZH3.js.map +1 -0
- package/dist/chunk-W64RAX4N.js +79 -0
- package/dist/chunk-W64RAX4N.js.map +1 -0
- package/dist/chunk-ZFR6ZNXD.js +203 -0
- package/dist/chunk-ZFR6ZNXD.js.map +1 -0
- package/dist/collection-switcher.d.ts +1 -1
- package/dist/{default-avatar-D9kiSFNB.d.ts → default-avatar-BL0nJFti.d.ts} +16 -0
- package/dist/entity-header.d.ts +1 -1
- package/dist/{frame-D6Xv83t8.d.ts → frame-CNZ5VgDD.d.ts} +11 -4
- package/dist/index.js +7 -7
- package/dist/kind-config-editor.js +3 -2
- package/dist/kind-config-editor.js.map +1 -1
- package/dist/map.d.ts +6 -6
- package/dist/match-dialog.js +1 -1
- package/dist/media-grid.d.ts +16 -0
- package/dist/media-grid.js +1 -1
- package/dist/money-input.js +6 -70
- package/dist/money-input.js.map +1 -1
- package/dist/native.d.ts +16 -0
- package/dist/native.js +17 -6
- package/dist/native.js.map +1 -1
- package/dist/nav-bar.d.ts +13 -2
- package/dist/nav-bar.js +71 -54
- package/dist/nav-bar.js.map +1 -1
- package/dist/notification-preferences.js +2 -1
- package/dist/notification-preferences.js.map +1 -1
- package/dist/price-catalogue-editor.d.ts +117 -0
- package/dist/price-catalogue-editor.js +194 -0
- package/dist/price-catalogue-editor.js.map +1 -0
- package/dist/promo-code-field.js +1 -1
- package/dist/schema-DgjBz7-8.d.ts +242 -0
- package/dist/schema-form.d.ts +106 -0
- package/dist/schema-form.js +268 -0
- package/dist/schema-form.js.map +1 -0
- package/dist/shop/booking.d.ts +2 -2
- package/dist/shop/booking.js +1 -1
- package/dist/shop/booking.js.map +1 -1
- package/dist/shop/bulletin.js +1 -1
- package/dist/shop/faq.d.ts +2 -1
- package/dist/shop/faq.js +1 -1
- package/dist/shop/faq.js.map +1 -1
- package/dist/shop/gallery.js +1 -1
- package/dist/shop/look.d.ts +43 -0
- package/dist/shop/look.js +52 -0
- package/dist/shop/look.js.map +1 -0
- package/dist/shop/policies.d.ts +2 -1
- package/dist/shop/policies.js +1 -1
- package/dist/shop/policies.js.map +1 -1
- package/dist/shop/reviews.d.ts +2 -1
- package/dist/shop/reviews.js +1 -1
- package/dist/shop/reviews.js.map +1 -1
- package/dist/shop/services.js +1 -1
- package/dist/shop/social.js +1 -1
- package/dist/shop/story.d.ts +2 -1
- package/dist/shop/story.js +1 -1
- package/dist/shop/story.js.map +1 -1
- package/dist/shop/team.js +1 -1
- package/dist/shop/video.js +1 -1
- package/dist/shop/visit.js +1 -1
- package/dist/shop-composer.d.ts +29 -0
- package/dist/shop-composer.js +156 -89
- package/dist/shop-composer.js.map +1 -1
- package/dist/shop.d.ts +6 -240
- package/dist/shop.js +24 -212
- package/dist/shop.js.map +1 -1
- package/dist/switch.js +2 -1
- package/dist/vertical-video.js +1 -1
- package/dist/wall.d.ts +7 -1
- package/dist/wall.js +5 -4
- package/dist/wall.js.map +1 -1
- package/package.json +59 -9
- 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 +4 -4
- 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/price-catalogue-editor/default.d.ts +4 -0
- package/registry/examples/price-catalogue-editor/default.js +47 -0
- package/registry/examples/price-catalogue-editor/default.tsx +25 -0
- package/registry/examples/schema-form/default.d.ts +4 -0
- package/registry/examples/schema-form/default.js +29 -0
- package/registry/examples/schema-form/default.tsx +27 -0
- package/registry/examples/wall/pinned-note.js +2 -1
- package/registry/examples/wall/pinned-note.tsx +2 -1
- 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 +81 -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 +30 -6
- 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/price-catalogue-editor.json +228 -0
- 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 +1 -1
- 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/schema-form.json +253 -0
- 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 +10 -6
- package/registry/shop-gallery.json +1 -1
- package/registry/shop.json +51 -10
- 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 +47 -4
- package/registry/waveform.json +1 -1
- package/dist/chunk-A7MQPIEG.js +0 -31
- package/dist/chunk-A7MQPIEG.js.map +0 -1
- package/dist/chunk-EUJ7337V.js.map +0 -1
- package/dist/chunk-HK525THY.js.map +0 -1
- /package/dist/{chunk-CSRKYZ53.js.map → chunk-CZHPWLNW.js.map} +0 -0
package/dist/nav-bar.d.ts
CHANGED
|
@@ -54,11 +54,22 @@ type NavBarSessionProps<TAccount = unknown> = {
|
|
|
54
54
|
signedIn: (account: TAccount, state: {
|
|
55
55
|
signupOpen: boolean;
|
|
56
56
|
}) => React.ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* The server's hint that a session cookie exists (krizaka-ui#827): while the answer is on its way the bar then reserves
|
|
59
|
+
* a signed-in placeholder (account-sized, `data-state="signed-in-pending"`) instead of an empty place, and never the
|
|
60
|
+
* « Sign in » action. A hint, never the proof: `/api/me` still decides. Left out, it is read from the family's readable
|
|
61
|
+
* flag cookie (`kz-session=1`, kept by `sessionHint` of `@krizaka/auth` in the proxy), so a static page needs no prop.
|
|
62
|
+
*/
|
|
63
|
+
sessionHint?: boolean;
|
|
57
64
|
/** The hint's words while the answer is on its way (“Checking your session…”) — passed translated. */
|
|
58
65
|
hint: string;
|
|
59
66
|
/** Classes of the loading placeholder. */
|
|
60
67
|
className?: string;
|
|
61
68
|
};
|
|
69
|
+
/** The readable flag the proxy keeps next to the HttpOnly session cookie (`@krizaka/auth` `SESSION_HINT_COOKIE`; a test pins the two). */
|
|
70
|
+
declare const SESSION_HINT_COOKIE = "kz-session";
|
|
71
|
+
/** Whether the readable flag cookie says a session exists. False on the server and on the first hydration pass (no mismatch). */
|
|
72
|
+
declare function useSessionHint(): boolean;
|
|
62
73
|
declare const sessionKey: (endpoint: string) => readonly ["krizaka", "session", string];
|
|
63
74
|
/** What the bar knows of the visitor: `pending` is NOT « signed out » — nothing is drawn as either until the answer comes. */
|
|
64
75
|
type NavSession<TAccount = unknown> = {
|
|
@@ -83,7 +94,7 @@ declare function useNavSession<TAccount = unknown>(endpoint?: string, initial?:
|
|
|
83
94
|
* `hint` politely (or, given `initial`, draws the server's answer at once); if the first request fails it shows the
|
|
84
95
|
* signed-out actions (the visitor can still sign in).
|
|
85
96
|
*/
|
|
86
|
-
declare function NavBarSession<TAccount = unknown>({ endpoint, initial, signedOut, signedIn, hint, className }: NavBarSessionProps<TAccount>): React.JSX.Element;
|
|
97
|
+
declare function NavBarSession<TAccount = unknown>({ endpoint, initial, sessionHint, signedOut, signedIn, hint, className }: NavBarSessionProps<TAccount>): React.JSX.Element;
|
|
87
98
|
|
|
88
99
|
declare const navBar: tailwind_variants.TVReturnType<{
|
|
89
100
|
floating: {
|
|
@@ -467,5 +478,5 @@ type ProductBarActionsProps = {
|
|
|
467
478
|
/** The product bar's actions: use the app. Put it in `NavBar.Actions` (`placement="bar"`) or in `NavBar.Mobile` (`placement="panel"`). */
|
|
468
479
|
declare function ProductBarActions({ signIn, tryIt, signupOpen, linkAs: Link, placement }: ProductBarActionsProps): React.JSX.Element;
|
|
469
480
|
|
|
470
|
-
export { NavBar, NavBarActions, NavBarBadge, NavBarBrand, NavBarFamily, NavBarItems, NavBarLanguage, NavBarLink, NavBarMenu, NavBarMenuLink, NavBarMobile, NavBarMobileGroup, NavBarMobileLink, NavBarMobilePreferences, NavBarRepo, NavBarRoot, NavBarSession, ProductBarAction, ProductBarActions, meHeaders, meResponse, meSchema, navBar, placePanel, productBarActions, sessionKey, useNavSession };
|
|
481
|
+
export { NavBar, NavBarActions, NavBarBadge, NavBarBrand, NavBarFamily, NavBarItems, NavBarLanguage, NavBarLink, NavBarMenu, NavBarMenuLink, NavBarMobile, NavBarMobileGroup, NavBarMobileLink, NavBarMobilePreferences, NavBarRepo, NavBarRoot, NavBarSession, ProductBarAction, ProductBarActions, SESSION_HINT_COOKIE, meHeaders, meResponse, meSchema, navBar, placePanel, productBarActions, sessionKey, useNavSession, useSessionHint };
|
|
471
482
|
export type { MeResponse, NavBarBadgeProps, NavBarBrandProps, NavBarFamilyProps, NavBarItemsProps, NavBarLanguageProps, NavBarLinkProps, NavBarMenuLinkProps, NavBarMenuProps, NavBarMobileGroupProps, NavBarMobileLinkProps, NavBarMobilePreferencesProps, NavBarMobileProps, NavBarRepoProps, NavBarRootProps, NavBarSessionProps, NavSession, PlacePanel, ProductBarActionsProps, ProductBarLink, ProductBarState };
|
package/dist/nav-bar.js
CHANGED
|
@@ -42,7 +42,7 @@ var meSchema = {
|
|
|
42
42
|
|
|
43
43
|
// src/nav-bar/nav-bar.tsx
|
|
44
44
|
import { NavigationMenu as Nav, Slot } from "radix-ui";
|
|
45
|
-
import * as
|
|
45
|
+
import * as React2 from "react";
|
|
46
46
|
import { tv } from "tailwind-variants";
|
|
47
47
|
|
|
48
48
|
// src/nav-bar/placement.ts
|
|
@@ -55,7 +55,15 @@ function placePanel({ trigger, root, panel, window: window2, gutter = 16 }) {
|
|
|
55
55
|
|
|
56
56
|
// src/nav-bar/session.tsx
|
|
57
57
|
import { krizakaFetch, useQuery } from "@krizaka/query";
|
|
58
|
-
import
|
|
58
|
+
import * as React from "react";
|
|
59
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
60
|
+
var SESSION_HINT_COOKIE = "kz-session";
|
|
61
|
+
var noop = () => () => {
|
|
62
|
+
};
|
|
63
|
+
var readFlag = () => typeof document !== "undefined" && document.cookie.split(";").some((part) => part.trim() === `${SESSION_HINT_COOKIE}=1`);
|
|
64
|
+
function useSessionHint() {
|
|
65
|
+
return React.useSyncExternalStore(noop, readFlag, () => false);
|
|
66
|
+
}
|
|
59
67
|
var sessionKey = (endpoint) => ["krizaka", "session", endpoint];
|
|
60
68
|
function useNavSession(endpoint = "/api/me", initial) {
|
|
61
69
|
const { data, isPending, isError } = useQuery({
|
|
@@ -73,9 +81,16 @@ function useNavSession(endpoint = "/api/me", initial) {
|
|
|
73
81
|
if (isPending && !isError) return { status: "pending" };
|
|
74
82
|
return { status: "out", signupOpen: false };
|
|
75
83
|
}
|
|
76
|
-
function NavBarSession({ endpoint = "/api/me", initial, signedOut, signedIn, hint, className }) {
|
|
84
|
+
function NavBarSession({ endpoint = "/api/me", initial, sessionHint, signedOut, signedIn, hint, className }) {
|
|
77
85
|
const session = useNavSession(endpoint, initial);
|
|
86
|
+
const flagged = useSessionHint();
|
|
78
87
|
if (session.status === "pending") {
|
|
88
|
+
if (sessionHint ?? flagged) {
|
|
89
|
+
return /* @__PURE__ */ jsxs("span", { role: "status", "aria-live": "polite", "data-state": "signed-in-pending", className, children: [
|
|
90
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "inline-block size-9 rounded-full bg-surface-2" }),
|
|
91
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: hint })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
79
94
|
return /* @__PURE__ */ jsx("span", { role: "status", "aria-live": "polite", "data-state": "loading", className, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: hint }) });
|
|
80
95
|
}
|
|
81
96
|
const state = { signupOpen: session.signupOpen };
|
|
@@ -83,7 +98,7 @@ function NavBarSession({ endpoint = "/api/me", initial, signedOut, signedIn, hin
|
|
|
83
98
|
}
|
|
84
99
|
|
|
85
100
|
// src/nav-bar/nav-bar.tsx
|
|
86
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
101
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
87
102
|
var navBar = tv({
|
|
88
103
|
slots: {
|
|
89
104
|
root: "group/nav relative z-40 mx-auto flex h-14 w-full items-center gap-2 border-border-subtle bg-surface-1 transition-[height,background-color,border-color,box-shadow] duration-300 motion-reduce:transition-none data-compact:h-12 data-compact:border-border-default data-compact:bg-surface-1 data-compact:shadow-lg",
|
|
@@ -136,58 +151,58 @@ var navBar = tv({
|
|
|
136
151
|
defaultVariants: { floating: true }
|
|
137
152
|
});
|
|
138
153
|
var s = navBar();
|
|
139
|
-
var Context =
|
|
140
|
-
var ItemsContext =
|
|
154
|
+
var Context = React2.createContext(null);
|
|
155
|
+
var ItemsContext = React2.createContext({ close: () => {
|
|
141
156
|
} });
|
|
142
|
-
var MobileContext =
|
|
157
|
+
var MobileContext = React2.createContext(false);
|
|
143
158
|
var useNavBar = () => {
|
|
144
|
-
const ctx =
|
|
159
|
+
const ctx = React2.useContext(Context);
|
|
145
160
|
if (!ctx) throw new Error("NavBar parts must be inside <NavBar.Root>.");
|
|
146
161
|
return ctx;
|
|
147
162
|
};
|
|
148
163
|
function NavBarRoot({ label, compactAfter = 24, floating = true, className, children, ...props }) {
|
|
149
|
-
const [compact, setCompact] =
|
|
150
|
-
const [open, setOpen] =
|
|
151
|
-
const panelId =
|
|
152
|
-
|
|
164
|
+
const [compact, setCompact] = React2.useState(false);
|
|
165
|
+
const [open, setOpen] = React2.useState(false);
|
|
166
|
+
const panelId = React2.useId();
|
|
167
|
+
React2.useEffect(() => {
|
|
153
168
|
if (compactAfter === false) return;
|
|
154
169
|
const onScroll = () => setCompact(window.scrollY > compactAfter);
|
|
155
170
|
onScroll();
|
|
156
171
|
window.addEventListener("scroll", onScroll, { passive: true });
|
|
157
172
|
return () => window.removeEventListener("scroll", onScroll);
|
|
158
173
|
}, [compactAfter]);
|
|
159
|
-
const ctx =
|
|
174
|
+
const ctx = React2.useMemo(() => ({ label, open, setOpen, panelId }), [label, open, panelId]);
|
|
160
175
|
return /* @__PURE__ */ jsx2(Context.Provider, { value: ctx, children: /* @__PURE__ */ jsx2("header", { "data-compact": compact ? "" : void 0, "data-floating": floating, className: navBar({ floating }).root({ className }), ...props, children }) });
|
|
161
176
|
}
|
|
162
177
|
function NavBarBrand({ asChild, className, org, children, ...props }) {
|
|
163
178
|
const Comp = asChild ? Slot.Root : "a";
|
|
164
179
|
const fromOrg = org && !asChild && children === void 0;
|
|
165
|
-
return /* @__PURE__ */ jsx2(Comp, { className: s.brand({ className }), ...props, children: fromOrg ? /* @__PURE__ */
|
|
180
|
+
return /* @__PURE__ */ jsx2(Comp, { className: s.brand({ className }), ...props, children: fromOrg ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
166
181
|
/* @__PURE__ */ jsx2(FamilyMark, { mark: siteById("krizaka").mark, size: 22 }),
|
|
167
182
|
org.brand.name
|
|
168
183
|
] }) : children });
|
|
169
184
|
}
|
|
170
185
|
function NavBarItems({ className, children, value: valueProp, defaultValue, onValueChange, delayDuration = 200, ...props }) {
|
|
171
186
|
const { label } = useNavBar();
|
|
172
|
-
const [inner, setInner] =
|
|
187
|
+
const [inner, setInner] = React2.useState(defaultValue ?? "");
|
|
173
188
|
const value = valueProp ?? inner;
|
|
174
|
-
const setValue =
|
|
189
|
+
const setValue = React2.useCallback(
|
|
175
190
|
(next) => {
|
|
176
191
|
setInner(next);
|
|
177
192
|
onValueChange?.(next);
|
|
178
193
|
},
|
|
179
194
|
[onValueChange]
|
|
180
195
|
);
|
|
181
|
-
const items =
|
|
196
|
+
const items = React2.useMemo(() => ({ close: () => setValue("") }), [setValue]);
|
|
182
197
|
const { ref, handlers } = useSlidingIndicator({
|
|
183
198
|
item: "[data-nav-item]",
|
|
184
199
|
active: "[data-nav-item][data-active]",
|
|
185
200
|
prefer: "[data-nav-item][data-state=open]",
|
|
186
201
|
follow: true
|
|
187
202
|
});
|
|
188
|
-
const root =
|
|
189
|
-
const viewport =
|
|
190
|
-
|
|
203
|
+
const root = React2.useRef(null);
|
|
204
|
+
const viewport = React2.useRef(null);
|
|
205
|
+
React2.useLayoutEffect(() => {
|
|
191
206
|
const panel = viewport.current;
|
|
192
207
|
const nav = root.current;
|
|
193
208
|
if (!panel || !nav || !value) return;
|
|
@@ -207,13 +222,13 @@ function NavBarItems({ className, children, value: valueProp, defaultValue, onVa
|
|
|
207
222
|
window.removeEventListener("resize", place);
|
|
208
223
|
};
|
|
209
224
|
}, [value]);
|
|
210
|
-
return /* @__PURE__ */ jsx2(ItemsContext.Provider, { value: items, children: /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ jsx2(ItemsContext.Provider, { value: items, children: /* @__PURE__ */ jsxs2(Nav.Root, { ref: root, "aria-label": label, className: s.items({ className }), value, onValueChange: setValue, delayDuration, ...props, children: [
|
|
211
226
|
/* @__PURE__ */ jsx2(Nav.List, { ref, className: s.list(), ...handlers, children }),
|
|
212
227
|
/* @__PURE__ */ jsx2(Nav.Viewport, { ref: viewport, className: s.viewport() })
|
|
213
228
|
] }) });
|
|
214
229
|
}
|
|
215
230
|
function NavBarLink({ active, className, itemClassName, onPointerEnter, ...props }) {
|
|
216
|
-
const { close } =
|
|
231
|
+
const { close } = React2.useContext(ItemsContext);
|
|
217
232
|
return /* @__PURE__ */ jsx2(Nav.Item, { className: itemClassName, children: /* @__PURE__ */ jsx2(
|
|
218
233
|
Nav.Link,
|
|
219
234
|
{
|
|
@@ -233,43 +248,43 @@ function NavBarLink({ active, className, itemClassName, onPointerEnter, ...props
|
|
|
233
248
|
var INLINE_HIDE = { md: "", lg: "max-lg:hidden", xl: "max-xl:hidden" };
|
|
234
249
|
var DROPDOWN_HIDE = { md: "", lg: "lg:hidden", xl: "xl:hidden" };
|
|
235
250
|
function NavBarMenu({ label, active, columns = 1, inlineUpTo = 3, inlineFrom = "lg", children, className, ...props }) {
|
|
236
|
-
const links =
|
|
237
|
-
const dropdown = (hide) => /* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */
|
|
251
|
+
const links = React2.Children.toArray(children);
|
|
252
|
+
const dropdown = (hide) => /* @__PURE__ */ jsxs2(Nav.Item, { className: cn(hide, className), ...props, children: [
|
|
253
|
+
/* @__PURE__ */ jsxs2(Nav.Trigger, { "data-nav-item": "", "data-active": active ? "" : void 0, className: cn(s.item(), "group/trigger"), children: [
|
|
239
254
|
label,
|
|
240
255
|
/* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", className: s.chevron(), fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx2("path", { d: "m6 9 6 6 6-6" }) })
|
|
241
256
|
] }),
|
|
242
257
|
/* @__PURE__ */ jsx2(Nav.Content, { className: cn(s.panel(), columns === 2 && s.panelWide()), children })
|
|
243
258
|
] });
|
|
244
|
-
const inline = links.length > 0 && links.length <= inlineUpTo && links.every((c) =>
|
|
259
|
+
const inline = links.length > 0 && links.length <= inlineUpTo && links.every((c) => React2.isValidElement(c) && c.type === NavBarMenuLink);
|
|
245
260
|
if (inline) {
|
|
246
|
-
return /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
247
262
|
inlineFrom !== "md" && dropdown(DROPDOWN_HIDE[inlineFrom]),
|
|
248
263
|
links.map((link) => {
|
|
249
264
|
const { title, href, active: here, asChild, children: child, icon: _icon, description: _description, className: linkClass, ...rest } = link.props;
|
|
250
|
-
return /* @__PURE__ */ jsx2(NavBarLink, { asChild, href: asChild ? void 0 : href, active: here, className: linkClass, itemClassName: INLINE_HIDE[inlineFrom], ...rest, children: asChild &&
|
|
265
|
+
return /* @__PURE__ */ jsx2(NavBarLink, { asChild, href: asChild ? void 0 : href, active: here, className: linkClass, itemClassName: INLINE_HIDE[inlineFrom], ...rest, children: asChild && React2.isValidElement(child) ? React2.cloneElement(child, void 0, title) : title }, link.key);
|
|
251
266
|
})
|
|
252
267
|
] });
|
|
253
268
|
}
|
|
254
269
|
return dropdown("");
|
|
255
270
|
}
|
|
256
271
|
function NavBarMenuLink({ title, description, icon, active, href, className, asChild, children, ...props }) {
|
|
257
|
-
const body = /* @__PURE__ */
|
|
272
|
+
const body = /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
258
273
|
icon && /* @__PURE__ */ jsx2("span", { className: s.menuIcon(), children: icon }),
|
|
259
|
-
/* @__PURE__ */
|
|
274
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0 flex-1", children: [
|
|
260
275
|
/* @__PURE__ */ jsx2("span", { className: s.menuTitle(), children: title }),
|
|
261
276
|
description && /* @__PURE__ */ jsx2("span", { className: s.menuText(), children: description })
|
|
262
277
|
] })
|
|
263
278
|
] });
|
|
264
|
-
return /* @__PURE__ */ jsx2(Nav.Link, { asChild, href: asChild ? void 0 : href, active, "aria-current": active ? "page" : void 0, "data-active": active ? "" : void 0, className: s.menuLink({ className }), ...props, children: asChild &&
|
|
279
|
+
return /* @__PURE__ */ jsx2(Nav.Link, { asChild, href: asChild ? void 0 : href, active, "aria-current": active ? "page" : void 0, "data-active": active ? "" : void 0, className: s.menuLink({ className }), ...props, children: asChild && React2.isValidElement(children) ? React2.cloneElement(children, void 0, body) : body });
|
|
265
280
|
}
|
|
266
281
|
function NavBarActions({ className, ...props }) {
|
|
267
282
|
return /* @__PURE__ */ jsx2("div", { className: s.actions({ className }), ...props });
|
|
268
283
|
}
|
|
269
284
|
function NavBarMobile({ openLabel, closeLabel, className, children, ...props }) {
|
|
270
285
|
const { label, open, setOpen, panelId } = useNavBar();
|
|
271
|
-
const toggle =
|
|
272
|
-
|
|
286
|
+
const toggle = React2.useRef(null);
|
|
287
|
+
React2.useEffect(() => {
|
|
273
288
|
if (!open) return;
|
|
274
289
|
const onKey = (e) => {
|
|
275
290
|
if (e.key !== "Escape") return;
|
|
@@ -288,7 +303,7 @@ function NavBarMobile({ openLabel, closeLabel, className, children, ...props })
|
|
|
288
303
|
document.removeEventListener("pointerdown", onPress);
|
|
289
304
|
};
|
|
290
305
|
}, [open, setOpen, panelId]);
|
|
291
|
-
return /* @__PURE__ */
|
|
306
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
292
307
|
/* @__PURE__ */ jsx2("button", { ref: toggle, type: "button", "aria-expanded": open, "aria-controls": panelId, "aria-label": open ? closeLabel : openLabel, onClick: () => setOpen(!open), className: s.toggle(), children: /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", className: "h-4.5 w-4.5", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: open ? /* @__PURE__ */ jsx2("path", { d: "M18 6 6 18M6 6l12 12" }) : /* @__PURE__ */ jsx2("path", { d: "M4 7h16M4 12h16M4 17h10" }) }) }),
|
|
293
308
|
open && /* @__PURE__ */ jsx2(
|
|
294
309
|
"nav",
|
|
@@ -313,8 +328,8 @@ function NavBarMobile({ openLabel, closeLabel, className, children, ...props })
|
|
|
313
328
|
] });
|
|
314
329
|
}
|
|
315
330
|
function NavBarMobileGroup({ label, className, children, ...props }) {
|
|
316
|
-
const id =
|
|
317
|
-
return /* @__PURE__ */
|
|
331
|
+
const id = React2.useId();
|
|
332
|
+
return /* @__PURE__ */ jsxs2("div", { role: "group", "aria-labelledby": id, className: s.mobileGroup({ className }), ...props, children: [
|
|
318
333
|
/* @__PURE__ */ jsx2("p", { id, className: s.mobileGroupTitle(), children: label }),
|
|
319
334
|
children
|
|
320
335
|
] });
|
|
@@ -330,22 +345,22 @@ var tagTone = {
|
|
|
330
345
|
current: "bg-surface-3 text-fg-secondary"
|
|
331
346
|
};
|
|
332
347
|
function FamilyName({ site, current, labels }) {
|
|
333
|
-
return /* @__PURE__ */
|
|
348
|
+
return /* @__PURE__ */ jsxs2("span", { className: s.familyName(), children: [
|
|
334
349
|
site.name,
|
|
335
350
|
site.status !== "released" && /* @__PURE__ */ jsx2("span", { className: cn(s.familyTag(), tagTone[site.status]), children: labels.status[site.status] }),
|
|
336
351
|
current && /* @__PURE__ */ jsx2("span", { className: cn(s.familyTag(), tagTone.current), children: labels.current })
|
|
337
352
|
] });
|
|
338
353
|
}
|
|
339
354
|
function NavBarFamily({ current, labels = familyLabels.en, defaultOpen, className }) {
|
|
340
|
-
const inMobile =
|
|
341
|
-
const id =
|
|
355
|
+
const inMobile = React2.useContext(MobileContext);
|
|
356
|
+
const id = React2.useId();
|
|
342
357
|
const groups = sitesByGroup();
|
|
343
358
|
if (inMobile) {
|
|
344
|
-
return /* @__PURE__ */
|
|
359
|
+
return /* @__PURE__ */ jsxs2("div", { role: "group", "aria-labelledby": `${id}-family`, className: s.mobileFamily({ className }), children: [
|
|
345
360
|
/* @__PURE__ */ jsx2("p", { id: `${id}-family`, className: s.familyGroupTitle(), children: labels.family }),
|
|
346
|
-
groups.map(({ group, sites }) => /* @__PURE__ */
|
|
361
|
+
groups.map(({ group, sites }) => /* @__PURE__ */ jsxs2("div", { children: [
|
|
347
362
|
group !== "krizaka" && /* @__PURE__ */ jsx2("p", { id: `${id}-${group}`, className: s.familyGroupTitle(), children: labels.groups[group] }),
|
|
348
|
-
/* @__PURE__ */ jsx2("ul", { "aria-labelledby": group !== "krizaka" ? `${id}-${group}` : `${id}-family`, className: "grid gap-0.5", children: sites.map((site) => /* @__PURE__ */ jsx2("li", { children: /* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ jsx2("ul", { "aria-labelledby": group !== "krizaka" ? `${id}-${group}` : `${id}-family`, className: "grid gap-0.5", children: sites.map((site) => /* @__PURE__ */ jsx2("li", { children: /* @__PURE__ */ jsxs2("a", { href: site.url, "data-current": site.id === current ? "" : void 0, "aria-current": site.id === current ? "true" : void 0, className: s.mobileFamilyLink(), children: [
|
|
349
364
|
/* @__PURE__ */ jsx2("span", { className: s.familyMark(), children: /* @__PURE__ */ jsx2(FamilyMark, { mark: site.mark, size: 24 }) }),
|
|
350
365
|
/* @__PURE__ */ jsx2(FamilyName, { site, current: site.id === current, labels })
|
|
351
366
|
] }) }, site.id)) })
|
|
@@ -354,14 +369,14 @@ function NavBarFamily({ current, labels = familyLabels.en, defaultOpen, classNam
|
|
|
354
369
|
}
|
|
355
370
|
const noHover = (e) => e.preventDefault();
|
|
356
371
|
const columns = [groups.filter((g) => g.group === "krizaka" || g.group === "products"), groups.filter((g) => g.group === "open-source" || g.group === "github")];
|
|
357
|
-
return /* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */ jsx2(Nav.List, { className: "flex", children: /* @__PURE__ */
|
|
372
|
+
return /* @__PURE__ */ jsxs2(Nav.Root, { "aria-label": labels.family, defaultValue: defaultOpen ? "family" : void 0, className: s.family({ className }), children: [
|
|
373
|
+
/* @__PURE__ */ jsx2(Nav.List, { className: "flex", children: /* @__PURE__ */ jsxs2(Nav.Item, { value: "family", children: [
|
|
359
374
|
/* @__PURE__ */ jsx2(Nav.Trigger, { "aria-label": labels.family, onPointerMove: noHover, onPointerLeave: noHover, className: s.familyTrigger(), children: /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", className: s.chevron(), fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx2("path", { d: "m6 9 6 6 6-6" }) }) }),
|
|
360
|
-
/* @__PURE__ */ jsx2(Nav.Content, { onPointerLeave: noHover, className: s.familyPanel(), children: columns.map((column, i) => /* @__PURE__ */ jsx2("div", { className: "grid content-start gap-3", children: column.map(({ group, sites }) => /* @__PURE__ */
|
|
375
|
+
/* @__PURE__ */ jsx2(Nav.Content, { onPointerLeave: noHover, className: s.familyPanel(), children: columns.map((column, i) => /* @__PURE__ */ jsx2("div", { className: "grid content-start gap-3", children: column.map(({ group, sites }) => /* @__PURE__ */ jsxs2("div", { children: [
|
|
361
376
|
/* @__PURE__ */ jsx2("p", { id: `${id}-${group}`, className: s.familyGroupTitle(), children: labels.groups[group] }),
|
|
362
|
-
/* @__PURE__ */ jsx2("ul", { "aria-labelledby": `${id}-${group}`, className: "grid gap-0.5", children: sites.map((site) => /* @__PURE__ */ jsx2("li", { children: /* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ jsx2("ul", { "aria-labelledby": `${id}-${group}`, className: "grid gap-0.5", children: sites.map((site) => /* @__PURE__ */ jsx2("li", { children: /* @__PURE__ */ jsxs2(Nav.Link, { href: site.url, "data-current": site.id === current ? "" : void 0, "aria-current": site.id === current ? "true" : void 0, className: s.familyLink(), children: [
|
|
363
378
|
/* @__PURE__ */ jsx2("span", { className: s.familyMark(), children: /* @__PURE__ */ jsx2(FamilyMark, { mark: site.mark, size: 28 }) }),
|
|
364
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0", children: [
|
|
365
380
|
/* @__PURE__ */ jsx2(FamilyName, { site, current: site.id === current, labels }),
|
|
366
381
|
/* @__PURE__ */ jsx2("span", { className: s.familyText(), children: labels.descriptions[site.id] })
|
|
367
382
|
] })
|
|
@@ -373,18 +388,18 @@ function NavBarFamily({ current, labels = familyLabels.en, defaultOpen, classNam
|
|
|
373
388
|
}
|
|
374
389
|
function NavBarBadge({ env, version, className, children, ...props }) {
|
|
375
390
|
const parts = [env, version && `v${version.replace(/^v/, "")}`].filter(Boolean);
|
|
376
|
-
return /* @__PURE__ */
|
|
391
|
+
return /* @__PURE__ */ jsxs2("span", { className: s.badge({ className }), ...props, children: [
|
|
377
392
|
parts.join(" \xB7 "),
|
|
378
393
|
children
|
|
379
394
|
] });
|
|
380
395
|
}
|
|
381
396
|
function NavBarLanguage(props) {
|
|
382
|
-
const inMobile =
|
|
397
|
+
const inMobile = React2.useContext(MobileContext);
|
|
383
398
|
return /* @__PURE__ */ jsx2(LanguageSwitch, { variant: inMobile ? "inline" : "menu", ...props });
|
|
384
399
|
}
|
|
385
400
|
function NavBarMobilePreferences({ label, className, children, ...props }) {
|
|
386
|
-
const id =
|
|
387
|
-
return /* @__PURE__ */
|
|
401
|
+
const id = React2.useId();
|
|
402
|
+
return /* @__PURE__ */ jsxs2("div", { role: "group", "aria-labelledby": id, className: s.mobileGroup({ className }), ...props, children: [
|
|
388
403
|
/* @__PURE__ */ jsx2("p", { id, className: s.mobileGroupTitle(), children: label }),
|
|
389
404
|
/* @__PURE__ */ jsx2("div", { className: "flex flex-wrap items-center gap-2 px-3 py-1", children })
|
|
390
405
|
] });
|
|
@@ -412,7 +427,7 @@ var NavBar = {
|
|
|
412
427
|
};
|
|
413
428
|
|
|
414
429
|
// src/nav-bar/product-actions.tsx
|
|
415
|
-
import { Fragment as Fragment3, jsx as jsx3, jsxs as
|
|
430
|
+
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
416
431
|
var ProductBarAction = { SignIn: "sign-in", Try: "try" };
|
|
417
432
|
function productBarActions({ signupOpen, hasTry }) {
|
|
418
433
|
return signupOpen && hasTry ? { primary: ProductBarAction.Try, secondary: ProductBarAction.SignIn } : { primary: ProductBarAction.SignIn, secondary: null };
|
|
@@ -422,7 +437,7 @@ function ProductBarActions({ signIn, tryIt, signupOpen, linkAs: Link = "a", plac
|
|
|
422
437
|
const link = (kind) => kind === ProductBarAction.Try && tryIt ? tryIt : signIn;
|
|
423
438
|
const panel = placement === "panel";
|
|
424
439
|
const button = (kind, variant) => /* @__PURE__ */ jsx3(Button, { asChild: true, variant, size: panel ? "md" : "sm", className: panel ? variant === "primary" ? "mt-2 w-full font-bold" : "w-full" : variant === "primary" ? "ml-1 hidden font-bold md:inline-flex" : "hidden md:inline-flex", children: /* @__PURE__ */ jsx3(Link, { href: link(kind).href, children: link(kind).label }) }, kind);
|
|
425
|
-
return /* @__PURE__ */
|
|
440
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
426
441
|
secondary ? button(secondary, "ghost") : null,
|
|
427
442
|
button(primary, "primary")
|
|
428
443
|
] });
|
|
@@ -447,6 +462,7 @@ export {
|
|
|
447
462
|
NavBarSession,
|
|
448
463
|
ProductBarAction,
|
|
449
464
|
ProductBarActions,
|
|
465
|
+
SESSION_HINT_COOKIE,
|
|
450
466
|
meHeaders,
|
|
451
467
|
meResponse,
|
|
452
468
|
meSchema,
|
|
@@ -454,6 +470,7 @@ export {
|
|
|
454
470
|
placePanel,
|
|
455
471
|
productBarActions,
|
|
456
472
|
sessionKey,
|
|
457
|
-
useNavSession
|
|
473
|
+
useNavSession,
|
|
474
|
+
useSessionHint
|
|
458
475
|
};
|
|
459
476
|
//# sourceMappingURL=nav-bar.js.map
|