@krizaka/ui 3.80.0 → 3.82.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/shop.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as ShopPage } from './schema-DgjBz7-8.js';
2
- export { L as LocalizedText, P as ParsedSection, b as SECTION_DEFINITIONS, c as SECTION_TYPES, d as SHOP_SCHEMA_VERSION, a as Section, e as SectionDefinition, f as SectionOf, g as SectionSpec, h as SectionType, i as ShopPageIssue, j as ShopPageResult, k as defineSection, p as parseShopPage, s as sectionDefinition, l as shopPageSchema } from './schema-DgjBz7-8.js';
1
+ import { S as ShopPage } from './schema-CL7t7xqb.js';
2
+ export { L as LocalizedText, P as ParsedSection, b as SECTION_DEFINITIONS, c as SECTION_TYPES, d as SHOP_SCHEMA_VERSION, a as Section, e as SectionDefinition, f as SectionOf, g as SectionSpec, h as SectionType, i as ShopPageIssue, j as ShopPageResult, k as defineSection, p as parseShopPage, s as sectionDefinition, l as shopPageSchema } from './schema-CL7t7xqb.js';
3
3
  export { b as ShopFrame, c as ShopFrameProps, a as ShopPhoto, d as ShopSection, S as ShopSectionProps } from './frame-CNZ5VgDD.js';
4
4
  import 'zod/mini';
5
5
  import 'react';
@@ -107,10 +107,49 @@ interface OrgFamilyEntry {
107
107
  id: string;
108
108
  name: string;
109
109
  group: SiteGroup;
110
- status: "released" | "development";
110
+ status: SiteStatus;
111
111
  url: string;
112
112
  }
113
113
 
114
+ /** A status said once, on a column's heading (never on each link). */
115
+ type FooterStatus = Exclude<SiteStatus, "released">;
116
+ /** A link, its words resolved. `external`: it leaves this site (a plain `<a>`, never the router). */
117
+ type FooterLink = {
118
+ label: string;
119
+ href: string;
120
+ external?: boolean;
121
+ };
122
+ /** A column, its words resolved. */
123
+ type FooterColumn = {
124
+ id: string;
125
+ title: string;
126
+ status?: FooterStatus;
127
+ links: readonly FooterLink[];
128
+ };
129
+ /** The legal line: who publishes the site, once — `legalName · NEQ … · city`, then the version and the legal links. */
130
+ type FooterLegal = {
131
+ legalName: string;
132
+ /** The Québec enterprise number, shown as the publisher's legal identity (`NEQ 1182652231`). */
133
+ neq?: string;
134
+ city: string;
135
+ showVersion: boolean;
136
+ /** Where the version leads (the release's page), when it is a link. */
137
+ versionHref?: string;
138
+ links: readonly FooterLink[];
139
+ };
140
+ /** What `SiteFooter` draws from `config`: the columns, then the legal line and the socials. */
141
+ type SiteFooterConfig = {
142
+ /** The name of the columns' navigation (« Pied de page » / « Footer »). */
143
+ label: string;
144
+ columns: readonly FooterColumn[];
145
+ legal: FooterLegal;
146
+ social?: readonly {
147
+ id: string;
148
+ label: string;
149
+ href: string;
150
+ }[];
151
+ };
152
+
114
153
  type Tone = "product" | "cahier";
115
154
  type SiteFooterProps = Omit<React.ComponentProps<"footer">, "children"> & {
116
155
  /** The site this footer belongs to (`@krizaka/ui/sites`): marked in the family, its address for `path`. */
@@ -157,6 +196,14 @@ type SiteFooterProps = Omit<React.ComponentProps<"footer">, "children"> & {
157
196
  variant?: "site" | "docs" | "app";
158
197
  /** `cahier` on the Cahier sites (www, blog, ui., java., ts., lab.), `product` in the products. @default "product" */
159
198
  tone?: Tone;
199
+ /**
200
+ * The footer as the admin configured it (`resolveFooterSettings` of the app's settings): its columns, then one legal
201
+ * line — `legalName · NEQ … · city`, the version when `showVersion`, the legal links, the socials. With it the family
202
+ * is not drawn (the columns hold what the site wants) and the org's signature gives way to the legal identity.
203
+ */
204
+ config?: SiteFooterConfig;
205
+ /** The app's router link for the config's internal links (Next's `Link`). @default "a" */
206
+ linkAs?: LinkComponent;
160
207
  };
161
208
 
162
209
  interface SiteCahierNavItem {
@@ -136,7 +136,7 @@ function InkDefs({ ids: id, geometry: G }) {
136
136
  ] })
137
137
  ] });
138
138
  }
139
- function InkMark({ size = 32, animated = true, title, className, prefix, css, geometry: G, figure }) {
139
+ function InkMark({ size = 32, animated = true, title, className, prefix, css, geometry: G, figure: figure2 }) {
140
140
  const id = useIds(prefix, ["ink", "blue", "glow"]);
141
141
  const m = (cls) => animated ? `${prefix}-${cls}` : void 0;
142
142
  const dots = [G.node, G.core];
@@ -147,7 +147,7 @@ function InkMark({ size = 32, animated = true, title, className, prefix, css, ge
147
147
  /* @__PURE__ */ jsx3("circle", { className: m("spin"), cx: "200", cy: "200", r: G.orbit.r, stroke: neutral("--kz-border-strong", 40), strokeWidth: G.orbit.width, strokeDasharray: G.orbit.dash, opacity: ".6" }),
148
148
  /* @__PURE__ */ jsx3("circle", { cx: "200", cy: "200", r: G.ring.r, stroke: neutral("--kz-border-default", 30), strokeWidth: G.ring.width, opacity: ".35" }),
149
149
  /* @__PURE__ */ jsxs3("g", { transform: `translate(${G.offset} ${G.offset})`, children: [
150
- figure(`url(#${id.ink})`),
150
+ figure2(`url(#${id.ink})`),
151
151
  dots.map((d) => /* @__PURE__ */ jsxs3("g", { className: m("pulse"), children: [
152
152
  /* @__PURE__ */ jsx3("circle", { cx: d.cx, cy: d.cy, r: d.r, fill: `url(#${id.blue})` }),
153
153
  /* @__PURE__ */ jsx3("circle", { cx: d.cx, cy: d.cy, r: d.inner, fill: G.highlight })
@@ -188,6 +188,9 @@ var CSS2 = `
188
188
  }
189
189
  @media (prefers-reduced-motion: reduce) { .kzm-spin, .kzm-pulse { animation: none; } }
190
190
  `;
191
+ function figure(ink) {
192
+ return /* @__PURE__ */ jsx4("path", { d: KRIZAKA.shield, stroke: ink, strokeWidth: KRIZAKA.stroke, strokeLinecap: "round", strokeLinejoin: "round" });
193
+ }
191
194
  function KrizakaLogo(props) {
192
195
  return /* @__PURE__ */ jsx4(
193
196
  InkMark,
@@ -196,7 +199,7 @@ function KrizakaLogo(props) {
196
199
  prefix: "kzm",
197
200
  css: CSS2,
198
201
  geometry: KRIZAKA,
199
- figure: (ink) => /* @__PURE__ */ jsx4("path", { d: KRIZAKA.shield, stroke: ink, strokeWidth: KRIZAKA.stroke, strokeLinecap: "round", strokeLinejoin: "round" })
202
+ figure
200
203
  }
201
204
  );
202
205
  }
@@ -338,12 +341,12 @@ function ProductLogo({ id, ...props }) {
338
341
  var site = (s) => ({ ...s, host: s.url.replace(/^https?:\/\//, "").replace(/\/$/, "") });
339
342
  var sites = [
340
343
  site({ id: "krizaka", name: "Krizaka", url: "https://www.krizaka.com", kind: "company", group: "krizaka", status: "released", mark: "krizaka", repo: "https://github.com/krizaka/krizaka-com" }),
341
- site({ id: "orazaka", name: "Orazaka", url: "https://www.orazaka.com", kind: "product", group: "products", status: "released", mark: "orazaka", repo: "https://github.com/krizaka/orazaka" }),
344
+ site({ id: "orazaka", name: "Orazaka", url: "https://www.orazaka.com", kind: "product", group: "products", status: "development", mark: "orazaka", repo: "https://github.com/krizaka/orazaka" }),
342
345
  site({ id: "yomizaka", name: "Yomizaka", url: "https://www.yomizaka.com", kind: "product", group: "products", status: "development", mark: "yomizaka", repo: "https://github.com/krizaka/yomizaka" }),
343
346
  site({ id: "akinaza", name: "Akinaza", url: "https://www.akinaza.com", kind: "product", group: "products", status: "development", mark: "akinaza", repo: "https://github.com/krizaka/akinaza" }),
344
- site({ id: "ui", name: "Krizaka UI", url: "https://ui.krizaka.com", kind: "open-source", group: "open-source", status: "released", mark: "krizaka", repo: "https://github.com/krizaka/krizaka-ui" }),
345
- site({ id: "java", name: "Krizaka Java", url: "https://java.krizaka.com", kind: "open-source", group: "open-source", status: "released", mark: "krizaka", repo: "https://github.com/krizaka/krizaka-build" }),
346
- site({ id: "ts", name: "Krizaka TypeScript", url: "https://ts.krizaka.com", kind: "open-source", group: "open-source", status: "released", mark: "krizaka", repo: "https://github.com/krizaka/krizaka-ts" }),
347
+ site({ id: "ui", name: "Krizaka UI", url: "https://ui.krizaka.com", kind: "open-source", group: "open-source", status: "development", mark: "krizaka", repo: "https://github.com/krizaka/krizaka-ui" }),
348
+ site({ id: "java", name: "Krizaka Java", url: "https://java.krizaka.com", kind: "open-source", group: "open-source", status: "development", mark: "krizaka", repo: "https://github.com/krizaka/krizaka-build" }),
349
+ site({ id: "ts", name: "Krizaka TypeScript", url: "https://ts.krizaka.com", kind: "open-source", group: "open-source", status: "development", mark: "krizaka", repo: "https://github.com/krizaka/krizaka-ts" }),
347
350
  // The family lab: built in the open, served at lab.krizaka.com; what proves itself there moves into Krizaka UI.
348
351
  site({ id: "motion", name: "Krizaka Lab", url: "https://lab.krizaka.com", kind: "open-source", group: "open-source", status: "development", mark: "krizaka", repo: "https://github.com/krizaka/krizaka-lab" }),
349
352
  site({ id: "github", name: "GitHub", url: "https://github.com/krizaka", kind: "open-source", group: "github", status: "released", mark: "github", repo: "https://github.com/krizaka" })
@@ -409,10 +412,18 @@ var familyLabels = {
409
412
  // src/sites/family-groups.ts
410
413
  var ORG_ID = { motion: "lab" };
411
414
  function familyGroups(org) {
412
- const entries = org?.family ? org.family.map((e) => ({ id: e.id, name: e.name, url: e.url, group: e.group })) : sites.map((s) => ({ id: ORG_ID[s.id] ?? s.id, name: s.name, url: s.url, group: s.group }));
415
+ const entries = org?.family ? org.family.map((e) => ({ id: e.id, name: e.name, url: e.url, group: e.group, status: e.status })) : sites.map((s) => ({ id: ORG_ID[s.id] ?? s.id, name: s.name, url: s.url, group: s.group, status: s.status }));
413
416
  return siteGroups.map((group) => ({ group, entries: entries.filter((e) => e.group === group) })).filter((g) => g.entries.length > 0);
414
417
  }
415
418
  var orgIdOf = (id) => ORG_ID[id] ?? id;
419
+ function columnStatus(entries) {
420
+ const counts = /* @__PURE__ */ new Map();
421
+ for (const e of entries) counts.set(e.status, (counts.get(e.status) ?? 0) + 1);
422
+ const common = [...counts.entries()].sort((a, b) => b[1] - a[1])[0]?.[0] ?? null;
423
+ const exceptions = /* @__PURE__ */ new Map();
424
+ for (const e of entries) if (e.status !== common && e.status !== "released") exceptions.set(e.id, e.status);
425
+ return { shared: common === null || common === "released" ? null : common, exceptions };
426
+ }
416
427
 
417
428
  // src/site-footer/site-footer.tsx
418
429
  import { Fragment, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
@@ -427,13 +438,19 @@ var siteFooter = tv({
427
438
  chevron: "size-4 shrink-0 transition-transform group-open/fold:rotate-180 motion-reduce:transition-none lg:hidden",
428
439
  column: "inline-flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1",
429
440
  title: "text-xs font-semibold text-fg-secondary",
441
+ note: "font-normal",
430
442
  list: "flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-1 pb-2 lg:pb-0",
431
443
  link: "inline-flex min-h-6 min-w-0 items-center rounded-md text-sm [overflow-wrap:anywhere] text-fg-secondary no-underline transition-colors hover:text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring aria-[current=page]:text-fg aria-[current=page]:font-semibold aria-[current=true]:text-fg aria-[current=true]:font-semibold",
432
444
  bottom: "flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-secondary",
433
445
  signature: "inline-flex items-center gap-2 rounded-md font-medium text-fg no-underline hover:text-fg-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
434
446
  version: "rounded-sm border border-border-subtle bg-surface-2 px-2 py-0.5 font-mono text-[11px] text-fg-secondary",
435
447
  legal: "flex flex-wrap items-center gap-x-4 gap-y-2",
436
- controls: "flex flex-wrap items-center gap-2 sm:ml-auto"
448
+ controls: "flex flex-wrap items-center gap-2 sm:ml-auto",
449
+ // `config`: real columns — two on a phone, side by side from `sm`, each a heading over a stacked list.
450
+ columns: "grid min-w-0 grid-cols-2 gap-x-6 gap-y-6 pb-2 sm:grid-flow-col sm:grid-cols-none sm:auto-cols-[minmax(0,13rem)] sm:gap-x-10",
451
+ stack: "flex min-w-0 flex-col gap-2",
452
+ stackList: "flex min-w-0 flex-col gap-1",
453
+ identity: "text-fg-secondary"
437
454
  },
438
455
  variants: {
439
456
  // `site`: the three lines. `docs`: the same on the documentation's width. `app`: line 3 only, inside a signed-in product.
@@ -474,6 +491,7 @@ function backToTop(event) {
474
491
  window.scrollTo({ top: 0, behavior: "auto" });
475
492
  }
476
493
  var ToneContext = React.createContext("product");
494
+ var NO_STATUS = { shared: null, exceptions: /* @__PURE__ */ new Map() };
477
495
  function SiteFooter({
478
496
  current,
479
497
  labels = familyLabels.en,
@@ -488,13 +506,15 @@ function SiteFooter({
488
506
  products,
489
507
  variant = "site",
490
508
  tone = "product",
509
+ config,
510
+ linkAs,
491
511
  className,
492
512
  ...props
493
513
  }) {
494
514
  const id = React.useId();
495
515
  const s = siteFooter({ variant, tone });
496
516
  const slim = variant === "app";
497
- const family = !slim && (familyProp ?? current === "krizaka");
517
+ const family = !slim && (familyProp ?? (current === "krizaka" && !config));
498
518
  const site2 = siteById(current);
499
519
  const krizaka = siteById("krizaka");
500
520
  const currentId = orgIdOf(current);
@@ -513,28 +533,41 @@ function SiteFooter({
513
533
  const companyEntries = companyLinks.map((l) => ({ id: l.id, name: company[l.id], url: l.url[lang] }));
514
534
  return /* @__PURE__ */ jsx8(ToneContext.Provider, { value: tone, children: /* @__PURE__ */ jsx8("footer", { className: s.root({ className }), ...props, children: /* @__PURE__ */ jsxs6("div", { className: s.inner(), children: [
515
535
  own && /* @__PURE__ */ jsx8("div", { className: s.row(), children }),
536
+ config && !slim && /* @__PURE__ */ jsx8(ConfigColumns, { s, config, id, labels, linkAs, path }),
516
537
  family && /* @__PURE__ */ jsx8("nav", { "aria-label": labels.family, className: s.family(), children: [
517
- ...columns.map((c) => ({ key: c.group, title: labels.groups[c.group], entries: c.entries })),
518
- { key: "krizaka", title: labels.groups.krizaka, entries: companyEntries }
538
+ ...columns.map((c) => ({ key: c.group, title: labels.groups[c.group], entries: c.entries, ...columnStatus(c.entries) })),
539
+ { key: "krizaka", title: labels.groups.krizaka, entries: companyEntries, ...NO_STATUS }
519
540
  ].filter((c) => c.entries.length > 0).map((c) => /* @__PURE__ */ jsxs6("details", { className: s.group(), children: [
520
- /* @__PURE__ */ jsxs6("summary", { id: `${id}-${c.key}`, className: s.summary(), children: [
521
- c.title,
541
+ /* @__PURE__ */ jsxs6("summary", { className: s.summary(), children: [
542
+ /* @__PURE__ */ jsxs6("span", { children: [
543
+ /* @__PURE__ */ jsx8("span", { id: `${id}-${c.key}`, children: c.title }),
544
+ c.shared && /* @__PURE__ */ jsxs6("span", { className: s.note(), children: [
545
+ /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: " \xB7 " }),
546
+ labels.status[c.shared]
547
+ ] })
548
+ ] }),
522
549
  /* @__PURE__ */ jsx8("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", className: s.chevron(), children: /* @__PURE__ */ jsx8("path", { d: "M4 6l4 4 4-4", strokeLinecap: "round", strokeLinejoin: "round" }) })
523
550
  ] }),
524
551
  /* @__PURE__ */ jsx8("ul", { "aria-labelledby": `${id}-${c.key}`, className: s.list(), children: c.entries.map((e) => {
525
552
  const isCompany = c.key === "krizaka";
526
553
  const atHome = isCompany && here(e.url);
527
- const isCurrent = !isCompany && e.id === currentId;
554
+ const exception = c.exceptions.get(e.id);
555
+ const isCurrent2 = !isCompany && e.id === currentId;
528
556
  return /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs6(
529
557
  "a",
530
558
  {
531
559
  href: e.url,
532
- "aria-current": atHome ? "page" : isCurrent ? "true" : void 0,
560
+ "aria-current": atHome ? "page" : isCurrent2 ? "true" : void 0,
533
561
  onClick: atHome ? backToTop : void 0,
534
562
  className: s.link(),
535
563
  children: [
536
564
  e.name,
537
- isCurrent && /* @__PURE__ */ jsxs6("span", { className: "sr-only", children: [
565
+ exception && /* @__PURE__ */ jsxs6("span", { className: s.note(), children: [
566
+ " (",
567
+ labels.status[exception],
568
+ ")"
569
+ ] }),
570
+ isCurrent2 && /* @__PURE__ */ jsxs6("span", { className: "sr-only", children: [
538
571
  " (",
539
572
  labels.current,
540
573
  ")"
@@ -544,7 +577,7 @@ function SiteFooter({
544
577
  ) }, e.id);
545
578
  }) })
546
579
  ] }, c.key)) }),
547
- /* @__PURE__ */ jsxs6("div", { className: s.bottom(), children: [
580
+ config ? /* @__PURE__ */ jsx8(ConfigBottom, { s, config, krizaka: krizaka.url, brand: org?.brand.name ?? "Krizaka", tag, env, versionLabel: labels.version, linkAs, path, controls }) : /* @__PURE__ */ jsxs6("div", { className: s.bottom(), children: [
548
581
  /* @__PURE__ */ jsxs6("a", { href: krizaka.url, className: s.signature(), children: [
549
582
  /* @__PURE__ */ jsx8(ProductLogo, { id: "krizaka", size: 18, animated: false }),
550
583
  org ? org.footer.line[lang] : `${labels.signature[site2.kind]} \xB7 ${labels.place}`
@@ -561,6 +594,64 @@ function SiteFooter({
561
594
  ] })
562
595
  ] }) }) });
563
596
  }
597
+ var isCurrent = (l, path) => path !== void 0 && !l.external && bare(l.href.split(/[?#]/)[0]) === bare(path.split(/[?#]/)[0]);
598
+ function ConfigBottom({
599
+ s,
600
+ config,
601
+ krizaka,
602
+ brand,
603
+ tag,
604
+ env,
605
+ versionLabel,
606
+ linkAs,
607
+ path,
608
+ controls
609
+ }) {
610
+ const { legal, social } = config;
611
+ const configured = (l) => /* @__PURE__ */ jsx8(ConfigLink, { link: l, linkAs, current: isCurrent(l, path) }, l.href);
612
+ const shown = legal.showVersion ? tag : env;
613
+ const identity = [legal.legalName, legal.neq && `NEQ ${legal.neq}`, legal.city].filter(Boolean).join(" \xB7 ");
614
+ const versionText = /* @__PURE__ */ jsxs6(Fragment, { children: [
615
+ /* @__PURE__ */ jsxs6("span", { className: "sr-only", children: [
616
+ versionLabel,
617
+ " "
618
+ ] }),
619
+ shown
620
+ ] });
621
+ return /* @__PURE__ */ jsxs6("div", { className: s.bottom(), children: [
622
+ /* @__PURE__ */ jsx8("a", { href: krizaka, className: s.signature(), "aria-label": brand, children: /* @__PURE__ */ jsx8(ProductLogo, { id: "krizaka", size: 18, animated: false }) }),
623
+ /* @__PURE__ */ jsx8("span", { className: s.identity(), children: identity }),
624
+ shown && (legal.showVersion && legal.versionHref ? /* @__PURE__ */ jsx8("a", { href: legal.versionHref, className: s.version({ className: "no-underline hover:text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" }), children: versionText }) : /* @__PURE__ */ jsx8("span", { className: s.version(), children: versionText })),
625
+ legal.links.length > 0 && /* @__PURE__ */ jsx8("div", { className: s.legal(), children: legal.links.map(configured) }),
626
+ social && social.length > 0 && /* @__PURE__ */ jsx8("div", { className: s.legal(), children: social.map((x) => configured({ label: x.label, href: x.href, external: true })) }),
627
+ controls && /* @__PURE__ */ jsx8("div", { className: s.controls(), children: controls })
628
+ ] });
629
+ }
630
+ function ConfigColumns({
631
+ s,
632
+ config,
633
+ id,
634
+ labels,
635
+ linkAs,
636
+ path
637
+ }) {
638
+ if (config.columns.length === 0) return null;
639
+ return /* @__PURE__ */ jsx8("nav", { "aria-label": config.label, className: s.columns(), children: config.columns.map((c) => /* @__PURE__ */ jsxs6("div", { className: s.stack(), children: [
640
+ /* @__PURE__ */ jsxs6("p", { id: `${id}-c-${c.id}`, className: s.title(), children: [
641
+ c.title,
642
+ c.status && /* @__PURE__ */ jsxs6("span", { className: s.note(), children: [
643
+ /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: " \xB7 " }),
644
+ labels.status[c.status]
645
+ ] })
646
+ ] }),
647
+ /* @__PURE__ */ jsx8("ul", { "aria-labelledby": `${id}-c-${c.id}`, className: s.stackList(), children: c.links.map((l) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsx8(ConfigLink, { link: l, linkAs, current: isCurrent(l, path) }) }, l.href)) })
648
+ ] }, c.id)) });
649
+ }
650
+ function ConfigLink({ link, linkAs, current }) {
651
+ const s = siteFooter();
652
+ const Comp = link.external || !linkAs ? "a" : linkAs;
653
+ return /* @__PURE__ */ jsx8(Comp, { href: link.href, className: s.link(), "aria-current": current ? "page" : void 0, children: link.label });
654
+ }
564
655
  function SiteFooterColumn({ title, children, className, ...props }) {
565
656
  const id = React.useId();
566
657
  const tone = React.useContext(ToneContext);