@krizaka/ui 2.5.0 → 2.6.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 +44 -1
- package/dist/action-bar.d.ts +38 -0
- package/dist/action-bar.js +52 -0
- package/dist/action-bar.js.map +1 -0
- package/dist/argument-card.d.ts +67 -0
- package/dist/argument-card.js +69 -0
- package/dist/argument-card.js.map +1 -0
- package/dist/audio-player.js +1 -1
- package/dist/block-link-BAg4eoZk.d.ts +12 -0
- package/dist/blocks.css +529 -0
- package/dist/button.js +5 -94
- package/dist/button.js.map +1 -1
- package/dist/card-grid.d.ts +42 -0
- package/dist/card-grid.js +47 -0
- package/dist/card-grid.js.map +1 -0
- package/dist/chunk-2AGSO3WH.js +20 -0
- package/dist/chunk-2AGSO3WH.js.map +1 -0
- package/dist/chunk-AB5D3KBG.js +37 -0
- package/dist/chunk-AB5D3KBG.js.map +1 -0
- package/dist/{chunk-YX6CNVJA.js → chunk-CPA5CF35.js} +1 -1
- package/dist/chunk-CPA5CF35.js.map +1 -0
- package/dist/chunk-K3SWZXYT.js +92 -0
- package/dist/chunk-K3SWZXYT.js.map +1 -0
- package/dist/{chunk-XUMJA5ZI.js → chunk-X6TW3X6Y.js} +2 -2
- package/dist/chunk-XCBVFMNV.js +41 -0
- package/dist/{chunk-YX6CNVJA.js.map → chunk-XCBVFMNV.js.map} +1 -1
- package/dist/chunk-XVLWVTQA.js +28 -0
- package/dist/chunk-XVLWVTQA.js.map +1 -0
- package/dist/chunk-Z6FUPB3Q.js +102 -0
- package/dist/chunk-Z6FUPB3Q.js.map +1 -0
- package/dist/code-block.d.ts +42 -0
- package/dist/code-block.js +202 -0
- package/dist/code-block.js.map +1 -0
- package/dist/combobox.js +2 -2
- package/dist/cta-panel.d.ts +23 -0
- package/dist/cta-panel.js +20 -0
- package/dist/cta-panel.js.map +1 -0
- package/dist/data-table.js +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/decision-list.d.ts +34 -0
- package/dist/decision-list.js +67 -0
- package/dist/decision-list.js.map +1 -0
- package/dist/file-upload.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/link-card.d.ts +35 -0
- package/dist/link-card.js +46 -0
- package/dist/link-card.js.map +1 -0
- package/dist/mascot-quote.d.ts +42 -0
- package/dist/mascot-quote.js +267 -0
- package/dist/mascot-quote.js.map +1 -0
- package/dist/media-capture.js +1 -1
- package/dist/motion.css +25 -1
- package/dist/page-hero.d.ts +44 -0
- package/dist/page-hero.js +41 -0
- package/dist/page-hero.js.map +1 -0
- package/dist/page.d.ts +116 -0
- package/dist/page.js +17 -0
- package/dist/page.js.map +1 -0
- package/dist/pagination.js +25 -44
- package/dist/pagination.js.map +1 -1
- package/dist/pointer-light.d.ts +20 -0
- package/dist/pointer-light.js +12 -0
- package/dist/pointer-light.js.map +1 -0
- package/dist/search-field.js +1 -1
- package/dist/section-backdrop.js +4 -22
- package/dist/section-backdrop.js.map +1 -1
- package/dist/tag-input.js +2 -2
- package/dist/terminal-replay.d.ts +68 -0
- package/dist/terminal-replay.js +231 -0
- package/dist/terminal-replay.js.map +1 -0
- package/dist/toc.d.ts +23 -0
- package/dist/toc.js +39 -0
- package/dist/toc.js.map +1 -0
- package/dist/video-player.js +1 -1
- package/package.json +192 -7
- package/registry/action-bar.json +205 -0
- package/registry/alert.json +1 -1
- package/registry/argument-card.json +327 -0
- package/registry/audio-player.json +2 -2
- package/registry/avatar.json +1 -1
- package/registry/badge.json +1 -1
- package/registry/button.json +5 -5
- package/registry/card-grid.json +221 -0
- package/registry/card.json +3 -3
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/code-block.json +262 -0
- package/registry/combobox.json +2 -2
- package/registry/command.json +1 -1
- package/registry/confirm-button.json +3 -3
- package/registry/countdown.json +1 -1
- package/registry/cta-panel.json +154 -0
- package/registry/data-table.json +2 -2
- package/registry/date-picker.json +2 -2
- package/registry/decision-list.json +144 -0
- package/registry/dialog.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/examples/action-bar/buttons.d.ts +4 -0
- package/registry/examples/action-bar/buttons.js +22 -0
- package/registry/examples/action-bar/buttons.tsx +17 -0
- package/registry/examples/action-bar/icons.d.ts +4 -0
- package/registry/examples/action-bar/icons.js +24 -0
- package/registry/examples/action-bar/icons.tsx +23 -0
- package/registry/examples/argument-card/building-block.d.ts +4 -0
- package/registry/examples/argument-card/building-block.js +29 -0
- package/registry/examples/argument-card/building-block.tsx +29 -0
- package/registry/examples/argument-card/grid.d.ts +4 -0
- package/registry/examples/argument-card/grid.js +17 -0
- package/registry/examples/argument-card/grid.tsx +19 -0
- package/registry/examples/argument-card/unfold.d.ts +4 -0
- package/registry/examples/argument-card/unfold.js +26 -0
- package/registry/examples/argument-card/unfold.tsx +21 -0
- package/registry/examples/card-grid/products.d.ts +4 -0
- package/registry/examples/card-grid/products.js +16 -0
- package/registry/examples/card-grid/products.tsx +13 -0
- package/registry/examples/card-grid/reveal.d.ts +4 -0
- package/registry/examples/card-grid/reveal.js +13 -0
- package/registry/examples/card-grid/reveal.tsx +16 -0
- package/registry/examples/code-block/build-tools.d.ts +4 -0
- package/registry/examples/code-block/build-tools.js +30 -0
- package/registry/examples/code-block/build-tools.tsx +25 -0
- package/registry/examples/code-block/file.d.ts +4 -0
- package/registry/examples/code-block/file.js +17 -0
- package/registry/examples/code-block/file.tsx +13 -0
- package/registry/examples/cta-panel/discuss.d.ts +4 -0
- package/registry/examples/cta-panel/discuss.js +31 -0
- package/registry/examples/cta-panel/discuss.tsx +23 -0
- package/registry/examples/decision-list/product.d.ts +4 -0
- package/registry/examples/decision-list/product.js +35 -0
- package/registry/examples/decision-list/product.tsx +30 -0
- package/registry/examples/link-card/docs-hub.d.ts +4 -0
- package/registry/examples/link-card/docs-hub.js +18 -0
- package/registry/examples/link-card/docs-hub.tsx +20 -0
- package/registry/examples/link-card/external.d.ts +4 -0
- package/registry/examples/link-card/external.js +22 -0
- package/registry/examples/link-card/external.tsx +16 -0
- package/registry/examples/link-card/stack.d.ts +4 -0
- package/registry/examples/link-card/stack.js +26 -0
- package/registry/examples/link-card/stack.tsx +21 -0
- package/registry/examples/mascot-quote/callout.d.ts +4 -0
- package/registry/examples/mascot-quote/callout.js +11 -0
- package/registry/examples/mascot-quote/callout.tsx +10 -0
- package/registry/examples/mascot-quote/inline.d.ts +4 -0
- package/registry/examples/mascot-quote/inline.js +11 -0
- package/registry/examples/mascot-quote/inline.tsx +10 -0
- package/registry/examples/page/backdrop.d.ts +4 -0
- package/registry/examples/page/backdrop.js +23 -0
- package/registry/examples/page/backdrop.tsx +18 -0
- package/registry/examples/page/facts.d.ts +4 -0
- package/registry/examples/page/facts.js +24 -0
- package/registry/examples/page/facts.tsx +21 -0
- package/registry/examples/page/frame.d.ts +4 -0
- package/registry/examples/page/frame.js +15 -0
- package/registry/examples/page/frame.tsx +17 -0
- package/registry/examples/page/sections.d.ts +4 -0
- package/registry/examples/page/sections.js +14 -0
- package/registry/examples/page/sections.tsx +15 -0
- package/registry/examples/page-hero/building-block.d.ts +4 -0
- package/registry/examples/page-hero/building-block.js +24 -0
- package/registry/examples/page-hero/building-block.tsx +20 -0
- package/registry/examples/page-hero/hub.d.ts +4 -0
- package/registry/examples/page-hero/hub.js +21 -0
- package/registry/examples/page-hero/hub.tsx +15 -0
- package/registry/examples/pointer-light/list.d.ts +4 -0
- package/registry/examples/pointer-light/list.js +16 -0
- package/registry/examples/pointer-light/list.tsx +14 -0
- package/registry/examples/terminal-replay/at-rest.d.ts +4 -0
- package/registry/examples/terminal-replay/at-rest.js +32 -0
- package/registry/examples/terminal-replay/at-rest.tsx +26 -0
- package/registry/examples/terminal-replay/session.d.ts +4 -0
- package/registry/examples/terminal-replay/session.js +34 -0
- package/registry/examples/terminal-replay/session.tsx +28 -0
- package/registry/examples/toc/reading-page.d.ts +4 -0
- package/registry/examples/toc/reading-page.js +21 -0
- package/registry/examples/toc/reading-page.tsx +21 -0
- package/registry/field.json +1 -1
- package/registry/file-upload.json +2 -2
- package/registry/filter-bar.json +2 -2
- package/registry/glow-card.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/index.json +241 -1
- package/registry/iso.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/link-card.json +279 -0
- package/registry/loader.json +1 -1
- package/registry/marquee.json +1 -1
- package/registry/mascot-quote.json +191 -0
- package/registry/mascots.json +1 -1
- package/registry/media-capture.json +4 -4
- package/registry/meter.json +1 -1
- package/registry/nav-bar.json +1 -1
- package/registry/number-ticker.json +1 -1
- package/registry/page-header.json +1 -1
- package/registry/page-hero.json +254 -0
- package/registry/page.json +497 -0
- package/registry/pagination.json +2 -2
- package/registry/pointer-light.json +119 -0
- package/registry/popover.json +1 -1
- package/registry/progress.json +1 -1
- package/registry/radio-group.json +1 -1
- package/registry/search-field.json +2 -2
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/skeleton.json +3 -3
- package/registry/slider.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/spinner.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/stepper.json +1 -1
- package/registry/switch.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/tag-input.json +1 -1
- package/registry/terminal-replay.json +317 -0
- package/registry/theme.json +1 -1
- package/registry/toast.json +1 -1
- package/registry/toc.json +157 -0
- package/registry/tooltip.json +1 -1
- package/registry/video-player.json +4 -4
- package/registry/video-trimmer.json +3 -3
- /package/dist/{chunk-XUMJA5ZI.js.map → chunk-X6TW3X6Y.js.map} +0 -0
package/dist/page.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SectionBackdropProps } from './section-backdrop.js';
|
|
3
|
+
import 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
type PageSize = "narrow" | "default" | "wide" | "full";
|
|
6
|
+
type PageProps = React.HTMLAttributes<HTMLElement> & {
|
|
7
|
+
/**
|
|
8
|
+
* The width of the content: `default` (72rem, `--kz-page-max`), `narrow` (48rem, a reading column), `wide`
|
|
9
|
+
* (88rem, documentation with a sidebar), `full` (the gutters only).
|
|
10
|
+
* @default "default"
|
|
11
|
+
*/
|
|
12
|
+
size?: PageSize;
|
|
13
|
+
/** The element: `div` (default), `main`, `header`, `footer`, `section` or `article`. */
|
|
14
|
+
as?: "div" | "main" | "header" | "footer" | "section" | "article";
|
|
15
|
+
};
|
|
16
|
+
/** The page frame: centred, at most `--kz-page-max` wide, with the gutters of `--kz-page-gutter` (16 → 32 px). */
|
|
17
|
+
declare function Page({ size, as: Tag, className, ...props }: PageProps): React.JSX.Element;
|
|
18
|
+
type SectionHeadingProps = Omit<React.HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
19
|
+
/** The id of the title: the section's anchor and its accessible name. */
|
|
20
|
+
id?: string;
|
|
21
|
+
/** A short mono line above the title (the section's subject). */
|
|
22
|
+
eyebrow?: React.ReactNode;
|
|
23
|
+
/** The title. */
|
|
24
|
+
title: React.ReactNode;
|
|
25
|
+
/** One or two sentences under the title. */
|
|
26
|
+
lead?: React.ReactNode;
|
|
27
|
+
/** Actions on the right of the heading (a link to everything, a filter). */
|
|
28
|
+
actions?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The level of the title.
|
|
31
|
+
* @default 2
|
|
32
|
+
*/
|
|
33
|
+
level?: 2 | 3;
|
|
34
|
+
/**
|
|
35
|
+
* `md` for a section that argues, `sm` for a section of a reading page.
|
|
36
|
+
* @default "md"
|
|
37
|
+
*/
|
|
38
|
+
size?: "sm" | "md";
|
|
39
|
+
/**
|
|
40
|
+
* `center` for a heading that stands alone above a grid.
|
|
41
|
+
* @default "start"
|
|
42
|
+
*/
|
|
43
|
+
align?: "start" | "center";
|
|
44
|
+
/** Rises into place once, as it enters the viewport (`[data-reveal]`, MotionObserver). Never on the first screen. */
|
|
45
|
+
reveal?: boolean;
|
|
46
|
+
};
|
|
47
|
+
/** The head of a section: eyebrow (mono, the accent), title, lead — and its actions on the right. */
|
|
48
|
+
declare function SectionHeading({ id, eyebrow, title, lead, actions, level, size, align, reveal, className, ...props }: SectionHeadingProps): React.JSX.Element;
|
|
49
|
+
type SectionProps = Omit<React.HTMLAttributes<HTMLElement>, "title"> & {
|
|
50
|
+
/** The id of the title (and the anchor of the section). Required with a `title`. */
|
|
51
|
+
id?: string;
|
|
52
|
+
/** The heading's eyebrow. */
|
|
53
|
+
eyebrow?: React.ReactNode;
|
|
54
|
+
/** The section's title: an `h2` (a `SectionHeading`), which names the section for assistive technology. */
|
|
55
|
+
title?: React.ReactNode;
|
|
56
|
+
/** The heading's lead. */
|
|
57
|
+
lead?: React.ReactNode;
|
|
58
|
+
/** The heading's actions. */
|
|
59
|
+
actions?: React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* The heading's size: `md` for a page that argues, `sm` for a reading page.
|
|
62
|
+
* @default "md"
|
|
63
|
+
*/
|
|
64
|
+
headingSize?: "sm" | "md";
|
|
65
|
+
/**
|
|
66
|
+
* The heading's alignment.
|
|
67
|
+
* @default "start"
|
|
68
|
+
*/
|
|
69
|
+
headingAlign?: "start" | "center";
|
|
70
|
+
/** The heading rises into place once (never on the first screen). */
|
|
71
|
+
reveal?: boolean;
|
|
72
|
+
/** A hairline above the section, inside the gutters: the transition between two sections of the same surface. */
|
|
73
|
+
divider?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The vertical space above and below: `sm` (a reading page), `md`, `lg` (a page's main moments).
|
|
76
|
+
* @default "md"
|
|
77
|
+
*/
|
|
78
|
+
spacing?: "sm" | "md" | "lg";
|
|
79
|
+
/**
|
|
80
|
+
* The width of the content.
|
|
81
|
+
* @default "default"
|
|
82
|
+
*/
|
|
83
|
+
size?: PageSize;
|
|
84
|
+
/** The brand's colour transition behind the section (SectionBackdrop): `true`, or its props (`direction`, `grid`…). */
|
|
85
|
+
backdrop?: boolean | Omit<SectionBackdropProps, "as" | "children">;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* A section of a page: full-bleed (its backdrop reaches the edges), its content in the page frame, its heading on top.
|
|
89
|
+
* Sections follow each other on one rhythm; a `divider` or a `backdrop` marks the transition.
|
|
90
|
+
*/
|
|
91
|
+
declare function Section({ id, eyebrow, title, lead, actions, headingSize, headingAlign, reveal, divider, spacing, size, backdrop, className, children, ...props }: SectionProps): React.JSX.Element;
|
|
92
|
+
type TicksProps = {
|
|
93
|
+
/** A sentence where words between backticks are code: "Every request carries a `requestId`." */
|
|
94
|
+
children: string;
|
|
95
|
+
};
|
|
96
|
+
/** A sentence of a message catalogue where words between backticks read as code — no markup in the translations. */
|
|
97
|
+
declare function Ticks({ children }: TicksProps): React.JSX.Element;
|
|
98
|
+
interface Fact {
|
|
99
|
+
/** A few words: `npm 2.5.0`, `Maven Central`, `in progress`. */
|
|
100
|
+
label: string;
|
|
101
|
+
/**
|
|
102
|
+
* `ok` — published, usable today; `wip` — in progress, said honestly; `neutral` — a fact.
|
|
103
|
+
* @default "neutral"
|
|
104
|
+
*/
|
|
105
|
+
tone?: "ok" | "wip" | "neutral";
|
|
106
|
+
/** Where the fact is proven (a registry page): the fact becomes a link. */
|
|
107
|
+
href?: string;
|
|
108
|
+
}
|
|
109
|
+
type FactsProps = React.HTMLAttributes<HTMLUListElement> & {
|
|
110
|
+
/** The facts, in reading order. */
|
|
111
|
+
items: readonly Fact[];
|
|
112
|
+
};
|
|
113
|
+
/** Compact facts on one line — a dot that says the state, a few mono words. Links open in a new tab. */
|
|
114
|
+
declare function Facts({ items, className, ...props }: FactsProps): React.JSX.Element;
|
|
115
|
+
|
|
116
|
+
export { type Fact, Facts, type FactsProps, Page, type PageProps, type PageSize, Section, SectionHeading, type SectionHeadingProps, type SectionProps, Ticks, type TicksProps };
|
package/dist/page.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Facts,
|
|
3
|
+
Page,
|
|
4
|
+
Section,
|
|
5
|
+
SectionHeading,
|
|
6
|
+
Ticks
|
|
7
|
+
} from "./chunk-K3SWZXYT.js";
|
|
8
|
+
import "./chunk-XVLWVTQA.js";
|
|
9
|
+
import "./chunk-FJDSLNXK.js";
|
|
10
|
+
export {
|
|
11
|
+
Facts,
|
|
12
|
+
Page,
|
|
13
|
+
Section,
|
|
14
|
+
SectionHeading,
|
|
15
|
+
Ticks
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=page.js.map
|
package/dist/page.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/pagination.js
CHANGED
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// src/glyphs.tsx
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
function Glyph({ className = "h-4 w-4", fill, children }) {
|
|
7
|
-
return /* @__PURE__ */ jsx(
|
|
8
|
-
"svg",
|
|
9
|
-
{
|
|
10
|
-
viewBox: "0 0 24 24",
|
|
11
|
-
className,
|
|
12
|
-
fill: fill ? "currentColor" : "none",
|
|
13
|
-
stroke: fill ? "none" : "currentColor",
|
|
14
|
-
strokeWidth: "2",
|
|
15
|
-
strokeLinecap: "round",
|
|
16
|
-
strokeLinejoin: "round",
|
|
17
|
-
"aria-hidden": true,
|
|
18
|
-
focusable: "false",
|
|
19
|
-
children
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
var ChevronGlyph = ({ direction = "down", ...p }) => /* @__PURE__ */ jsx(Glyph, { ...p, children: /* @__PURE__ */ jsx("path", { d: { left: "m15 6-6 6 6 6", right: "m9 6 6 6-6 6", up: "m6 15 6-6 6 6", down: "m6 9 6 6 6-6" }[direction] }) });
|
|
1
|
+
import {
|
|
2
|
+
ChevronGlyph
|
|
3
|
+
} from "./chunk-XCBVFMNV.js";
|
|
24
4
|
|
|
25
5
|
// src/pagination/pagination.tsx
|
|
26
|
-
import {
|
|
6
|
+
import { tv } from "tailwind-variants";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
27
8
|
var pagination = tv({
|
|
28
9
|
slots: {
|
|
29
10
|
root: "@container flex w-full flex-wrap items-center justify-between gap-3 text-sm",
|
|
@@ -65,12 +46,12 @@ function pageRange(page, pageCount, siblings = 1, boundaries = 1) {
|
|
|
65
46
|
function Item({ href, onClick, disabled, current, label, className, children }) {
|
|
66
47
|
const common = { "aria-label": label, "aria-current": current ? "page" : void 0, className };
|
|
67
48
|
if (href && !disabled) {
|
|
68
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ jsx("a", { href, onClick, ...common, children });
|
|
69
50
|
}
|
|
70
51
|
if (href) {
|
|
71
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ jsx("a", { role: "link", "aria-disabled": true, ...common, children });
|
|
72
53
|
}
|
|
73
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsx("button", { type: "button", onClick, disabled, ...common, children });
|
|
74
55
|
}
|
|
75
56
|
function Pagination({
|
|
76
57
|
page = 1,
|
|
@@ -101,25 +82,25 @@ function Pagination({
|
|
|
101
82
|
const canNext = paged ? current < count : Boolean(hasNext);
|
|
102
83
|
const go = (target) => () => onPageChange?.(target);
|
|
103
84
|
const href = (target) => paged && getHref ? getHref(target) : void 0;
|
|
104
|
-
return /* @__PURE__ */
|
|
105
|
-
status !== void 0 || pageSizeOptions ? /* @__PURE__ */
|
|
106
|
-
status !== void 0 && /* @__PURE__ */
|
|
107
|
-
pageSizeOptions && pageSize !== void 0 && /* @__PURE__ */
|
|
85
|
+
return /* @__PURE__ */ jsxs("nav", { "aria-label": labels.nav, className: s.root({ className }), ...props, children: [
|
|
86
|
+
status !== void 0 || pageSizeOptions ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
87
|
+
status !== void 0 && /* @__PURE__ */ jsx("p", { className: s.status(), children: status }),
|
|
88
|
+
pageSizeOptions && pageSize !== void 0 && /* @__PURE__ */ jsxs("label", { className: s.size(), children: [
|
|
108
89
|
labels.pageSize,
|
|
109
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
110
91
|
"select",
|
|
111
92
|
{
|
|
112
93
|
className: s.select(),
|
|
113
94
|
value: pageSize,
|
|
114
95
|
disabled,
|
|
115
96
|
onChange: (event) => onPageSizeChange?.(Number(event.target.value)),
|
|
116
|
-
children: pageSizeOptions.map((size) => /* @__PURE__ */
|
|
97
|
+
children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx("option", { value: size, children: size }, size))
|
|
117
98
|
}
|
|
118
99
|
)
|
|
119
100
|
] })
|
|
120
101
|
] }) : null,
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ jsxs("ul", { className: s.list(), children: [
|
|
103
|
+
/* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
123
104
|
Item,
|
|
124
105
|
{
|
|
125
106
|
href: href(current - 1),
|
|
@@ -128,18 +109,18 @@ function Pagination({
|
|
|
128
109
|
label: labels.previous,
|
|
129
110
|
className: s.item({ className: s.edge() }),
|
|
130
111
|
children: [
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ jsx(ChevronGlyph, { direction: "left" }),
|
|
113
|
+
/* @__PURE__ */ jsx("span", { className: "hidden @lg:inline", children: labels.previous })
|
|
133
114
|
]
|
|
134
115
|
}
|
|
135
116
|
) }),
|
|
136
|
-
paged && /* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
(n, i) => n === "\u2026" ? /* @__PURE__ */
|
|
117
|
+
paged && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
118
|
+
/* @__PURE__ */ jsx("li", { className: s.pages(), children: /* @__PURE__ */ jsx("ul", { className: "contents", children: pageRange(current, count, siblings, boundaries).map(
|
|
119
|
+
(n, i) => n === "\u2026" ? /* @__PURE__ */ jsx("li", { "aria-hidden": true, className: s.ellipsis(), children: "\u2026" }, `gap-${i}`) : /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Item, { href: href(n), onClick: go(n), disabled, current: n === current, label: labels.page(n), className: s.item(), children: n }) }, n)
|
|
139
120
|
) }) }),
|
|
140
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ jsx("li", { className: s.compact(), children: labels.compact(current, count) })
|
|
141
122
|
] }),
|
|
142
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
143
124
|
Item,
|
|
144
125
|
{
|
|
145
126
|
href: href(current + 1),
|
|
@@ -148,8 +129,8 @@ function Pagination({
|
|
|
148
129
|
label: labels.next,
|
|
149
130
|
className: s.item({ className: s.edge() }),
|
|
150
131
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ jsx("span", { className: "hidden @lg:inline", children: labels.next }),
|
|
133
|
+
/* @__PURE__ */ jsx(ChevronGlyph, { direction: "right" })
|
|
153
134
|
]
|
|
154
135
|
}
|
|
155
136
|
) })
|
package/dist/pagination.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/pagination/pagination.tsx","../src/glyphs.tsx"],"sourcesContent":["// Server-safe: no hook, no context. A `<nav>` named by `labels.nav`; the current page is `aria-current=\"page\"`.\n// Two modes: pages (`page` + `pageCount`: numbers with ellipses, which fold into \"Page 3 of 12\" in a narrow container)\n// and cursor (`hasPrevious` / `hasNext`: an API that only knows the next and previous pages). Links (`getHref`) when\n// the page lives in the address — the right default for a list a search engine or a shared link should reach — or\n// buttons (`onPageChange`).\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { ChevronGlyph } from \"../glyphs\";\n\nexport const pagination = tv({\n slots: {\n root: \"@container flex w-full flex-wrap items-center justify-between gap-3 text-sm\",\n list: \"flex items-center gap-1\",\n pages: \"hidden items-center gap-1 @md:flex\",\n compact: \"px-2 text-xs font-semibold tabular-nums text-fg-secondary @md:hidden\",\n item:\n \"inline-flex h-9 min-w-9 select-none items-center justify-center gap-1.5 rounded-lg px-2.5 text-sm font-semibold tabular-nums text-fg-secondary \" +\n \"transition-colors hover:bg-surface-2 hover:text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring \" +\n \"aria-[current=page]:bg-accent aria-[current=page]:text-on-accent aria-[current=page]:hover:bg-accent \" +\n \"aria-disabled:pointer-events-none aria-disabled:opacity-40 disabled:pointer-events-none disabled:opacity-40\",\n edge: \"border border-border-default bg-surface-1 px-3\",\n ellipsis: \"inline-flex h-9 min-w-6 items-end justify-center pb-2 text-fg-muted\",\n status: \"text-xs text-fg-secondary tabular-nums\",\n size: \"flex items-center gap-2 text-xs text-fg-secondary\",\n select:\n \"h-9 rounded-lg border border-border-default bg-surface-2 px-2 text-sm text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n },\n});\n\nexport type PaginationLabels = {\n /** The accessible name of the navigation (\"Pagination\", \"Pages of results\"). */\n nav: string;\n /** The previous-page control. */\n previous: string;\n /** The next-page control. */\n next: string;\n /** The accessible name of a page number: `(3) => \"Page 3\"`. */\n page: (page: number) => string;\n /** The folded form, in a narrow container: `(3, 12) => \"Page 3 of 12\"`. */\n compact: (page: number, pageCount: number) => string;\n /** The label of the page-size select (\"Rows per page\"). */\n pageSize: string;\n};\n\n/** The English words, for a quick start — pass your translations through `labels`. */\nexport const paginationLabels: PaginationLabels = {\n nav: \"Pagination\",\n previous: \"Previous\",\n next: \"Next\",\n page: (page) => `Page ${page}`,\n compact: (page, count) => `Page ${page} of ${count}`,\n pageSize: \"Rows per page\",\n};\n\n/**\n * The pages to show: the first and last `boundaries`, the current page and its `siblings`, and `\"…\"` where pages are\n * skipped. A gap of a single page shows that page instead of an ellipsis; few pages are all shown.\n */\nexport function pageRange(page: number, pageCount: number, siblings = 1, boundaries = 1): (number | \"…\")[] {\n // Few enough pages to show them all in the room the folded form takes: no ellipsis.\n if (pageCount <= 2 * boundaries + 2 * siblings + 3) return Array.from({ length: Math.max(0, pageCount) }, (_, i) => i + 1);\n const pages = new Set<number>();\n for (let i = 1; i <= Math.min(boundaries, pageCount); i += 1) pages.add(i);\n for (let i = Math.max(1, pageCount - boundaries + 1); i <= pageCount; i += 1) pages.add(i);\n for (let i = Math.max(1, page - siblings); i <= Math.min(pageCount, page + siblings); i += 1) pages.add(i);\n const sorted = [...pages].sort((a, b) => a - b);\n const out: (number | \"…\")[] = [];\n sorted.forEach((n, i) => {\n const prev = sorted[i - 1];\n if (prev !== undefined && n - prev === 2) out.push(prev + 1);\n else if (prev !== undefined && n - prev > 2) out.push(\"…\");\n out.push(n);\n });\n return out;\n}\n\nexport type PaginationProps = Omit<React.ComponentProps<\"nav\">, \"children\"> & {\n /** Pages mode: the current page, from 1. */\n page?: number;\n /** Pages mode: how many pages there are. Without it, the pagination is in cursor mode. */\n pageCount?: number;\n /** Called with the page asked for (buttons). Ignored for the pages `getHref` turns into links. */\n onPageChange?: (page: number) => void;\n /** The address of a page: the pages become links (crawlable, shareable, the state in the URL). */\n getHref?: (page: number) => string;\n /** Cursor mode: whether there is a previous page. */\n hasPrevious?: boolean;\n /** Cursor mode: whether there is a next page. */\n hasNext?: boolean;\n /** Cursor mode: called by the previous control. */\n onPrevious?: () => void;\n /** Cursor mode: called by the next control. */\n onNext?: () => void;\n /** Pages shown on each side of the current one. Default 1. */\n siblings?: number;\n /** Pages always shown at each end. Default 1. */\n boundaries?: number;\n /** A text beside the controls, read as is: \"41–60 of 1,284\", \"12 results\". */\n status?: React.ReactNode;\n /** The page size, with `pageSizeOptions` and `onPageSizeChange`: a select of rows per page. */\n pageSize?: number;\n /** The sizes offered (`[10, 20, 50]`). */\n pageSizeOptions?: readonly number[];\n /** Called with the size chosen. */\n onPageSizeChange?: (size: number) => void;\n /** Disables every control (a page is loading). */\n disabled?: boolean;\n /** The words, passed translated; English by default. */\n labels?: Partial<PaginationLabels>;\n};\n\ntype ItemProps = {\n href?: string;\n onClick?: () => void;\n disabled?: boolean;\n current?: boolean;\n label: string;\n className: string;\n children: React.ReactNode;\n};\n\nfunction Item({ href, onClick, disabled, current, label, className, children }: ItemProps) {\n const common = { \"aria-label\": label, \"aria-current\": current ? (\"page\" as const) : undefined, className };\n if (href && !disabled) {\n return (\n <a href={href} onClick={onClick} {...common}>\n {children}\n </a>\n );\n }\n if (href) {\n return (\n <a role=\"link\" aria-disabled {...common}>\n {children}\n </a>\n );\n }\n return (\n <button type=\"button\" onClick={onClick} disabled={disabled} {...common}>\n {children}\n </button>\n );\n}\n\n/** Moves through a long list: page numbers (folded on a narrow screen) or previous / next on a cursor. */\nexport function Pagination({\n page = 1,\n pageCount,\n onPageChange,\n getHref,\n hasPrevious,\n hasNext,\n onPrevious,\n onNext,\n siblings = 1,\n boundaries = 1,\n status,\n pageSize,\n pageSizeOptions,\n onPageSizeChange,\n disabled,\n labels: given,\n className,\n ...props\n}: PaginationProps) {\n const s = pagination();\n const labels = { ...paginationLabels, ...given };\n const paged = pageCount !== undefined;\n const count = Math.max(1, pageCount ?? 1);\n const current = Math.min(Math.max(1, page), count);\n const canPrevious = paged ? current > 1 : Boolean(hasPrevious);\n const canNext = paged ? current < count : Boolean(hasNext);\n const go = (target: number) => () => onPageChange?.(target);\n const href = (target: number) => (paged && getHref ? getHref(target) : undefined);\n\n return (\n <nav aria-label={labels.nav} className={s.root({ className })} {...props}>\n {status !== undefined || pageSizeOptions ? (\n <div className=\"flex flex-wrap items-center gap-4\">\n {status !== undefined && <p className={s.status()}>{status}</p>}\n {pageSizeOptions && pageSize !== undefined && (\n <label className={s.size()}>\n {labels.pageSize}\n <select\n className={s.select()}\n value={pageSize}\n disabled={disabled}\n onChange={(event) => onPageSizeChange?.(Number(event.target.value))}\n >\n {pageSizeOptions.map((size) => (\n <option key={size} value={size}>\n {size}\n </option>\n ))}\n </select>\n </label>\n )}\n </div>\n ) : null}\n <ul className={s.list()}>\n <li>\n <Item\n href={href(current - 1)}\n onClick={paged ? go(current - 1) : onPrevious}\n disabled={disabled || !canPrevious}\n label={labels.previous}\n className={s.item({ className: s.edge() })}\n >\n <ChevronGlyph direction=\"left\" />\n <span className=\"hidden @lg:inline\">{labels.previous}</span>\n </Item>\n </li>\n {paged && (\n <>\n <li className={s.pages()}>\n <ul className=\"contents\">\n {pageRange(current, count, siblings, boundaries).map((n, i) =>\n n === \"…\" ? (\n <li key={`gap-${i}`} aria-hidden className={s.ellipsis()}>\n …\n </li>\n ) : (\n <li key={n}>\n <Item href={href(n)} onClick={go(n)} disabled={disabled} current={n === current} label={labels.page(n)} className={s.item()}>\n {n}\n </Item>\n </li>\n ),\n )}\n </ul>\n </li>\n <li className={s.compact()}>\n {labels.compact(current, count)}\n </li>\n </>\n )}\n <li>\n <Item\n href={href(current + 1)}\n onClick={paged ? go(current + 1) : onNext}\n disabled={disabled || !canNext}\n label={labels.next}\n className={s.item({ className: s.edge() })}\n >\n <span className=\"hidden @lg:inline\">{labels.next}</span>\n <ChevronGlyph direction=\"right\" />\n </Item>\n </li>\n </ul>\n </nav>\n );\n}\n","// The small line glyphs the data and media primitives draw (play, volume, search, chevrons…): decorative, 24-unit\n// box, `currentColor`, sized by the caller's class. Shared by the entries that need them; never exported on its own —\n// a product draws its own icons with @krizaka/icons.\nimport type * as React from \"react\";\n\ntype GlyphProps = { className?: string };\n\nfunction Glyph({ className = \"h-4 w-4\", fill, children }: GlyphProps & { fill?: boolean; children: React.ReactNode }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={className}\n fill={fill ? \"currentColor\" : \"none\"}\n stroke={fill ? \"none\" : \"currentColor\"}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\nexport const PlayGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <path d=\"M8 5.5v13a1 1 0 0 0 1.5.86l10.4-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z\" />\n </Glyph>\n);\nexport const PauseGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n </Glyph>\n);\nexport const VolumeGlyph = ({ muted, ...p }: GlyphProps & { muted?: boolean }) => (\n <Glyph {...p}>\n <path d=\"M11 5 6 9H3v6h3l5 4V5Z\" />\n {muted ? <path d=\"m22 9-6 6m0-6 6 6\" /> : <path d=\"M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13\" />}\n </Glyph>\n);\nexport const FullscreenGlyph = ({ exit, ...p }: GlyphProps & { exit?: boolean }) => (\n <Glyph {...p}>\n {exit ? <path d=\"M9 4v5H4m11-5v5h5M9 20v-5H4m11 5v-5h5\" /> : <path d=\"M4 9V4h5m6 0h5v5M4 15v5h5m11-5v5h-5\" />}\n </Glyph>\n);\nexport const CaptionsGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M17 10.5a2 2 0 1 0 0 3\" />\n </Glyph>\n);\nexport const PipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <rect x=\"12\" y=\"12\" width=\"6\" height=\"4\" rx=\"1\" />\n </Glyph>\n);\nexport const SearchGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </Glyph>\n);\nexport const CloseGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </Glyph>\n);\nexport const ChevronGlyph = ({ direction = \"down\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" | \"up\" | \"down\" }) => (\n <Glyph {...p}>\n <path d={{ left: \"m15 6-6 6 6 6\", right: \"m9 6 6 6-6 6\", up: \"m6 15 6-6 6 6\", down: \"m6 9 6 6 6-6\" }[direction]} />\n </Glyph>\n);\nexport const CheckGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n);\nexport const PlusGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 5v14M5 12h14\" />\n </Glyph>\n);\nexport const CalendarGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M3 10h18M8 3v4M16 3v4\" />\n </Glyph>\n);\nexport const UploadGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 16V4m0 0L7 9m5-5 5 5\" />\n <path d=\"M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" />\n </Glyph>\n);\nexport const FileGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5Z\" />\n <path d=\"M14 3v5h5\" />\n </Glyph>\n);\nexport const CameraGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 8h3l2-3h6l2 3h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z\" />\n <circle cx=\"12\" cy=\"13.5\" r=\"3.5\" />\n </Glyph>\n);\nexport const FlipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3\" />\n <path d=\"M18 3v4h-4M6 21v-4h4\" />\n </Glyph>\n);\nexport const RetryGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 1 0 2.3-5.7L4 8.5\" />\n <path d=\"M4 4v4.5h4.5\" />\n </Glyph>\n);\nexport const SortGlyph = ({ direction, ...p }: GlyphProps & { direction?: \"ascending\" | \"descending\" }) => (\n <Glyph {...p}>\n {direction === \"ascending\" ? <path d=\"m7 14 5-5 5 5\" /> : direction === \"descending\" ? <path d=\"m7 10 5 5 5-5\" /> : <path d=\"m8 9 4-4 4 4M8 15l4 4 4-4\" />}\n </Glyph>\n);\n"],"mappings":";AAMA,SAAS,UAAU;;;ACGf,cAsBF,YAtBE;AAFJ,SAAS,MAAM,EAAE,YAAY,WAAW,MAAM,SAAS,GAA+D;AACpH,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR;AAAA,MACA,MAAM,OAAO,iBAAiB;AAAA,MAC9B,QAAQ,OAAO,SAAS;AAAA,MACxB,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAW;AAAA,MACX,WAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;AA+CO,IAAM,eAAe,CAAC,EAAE,YAAY,QAAQ,GAAG,EAAE,MACtD,oBAAC,SAAO,GAAG,GACT,8BAAC,UAAK,GAAG,EAAE,MAAM,iBAAiB,OAAO,gBAAgB,IAAI,iBAAiB,MAAM,eAAe,EAAE,SAAS,GAAG,GACnH;;;ADqDI,SAwFI,UAxFJ,OAAAA,MAwDM,QAAAC,aAxDN;AApHC,IAAM,aAAa,GAAG;AAAA,EAC3B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MACE;AAAA,IAIF,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;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AAM,KAAK,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,UAAoB,SAAS,MAAM,SAAS,OAAO,OAAO,KAAK,CAAC,GAAG,WAAW,EAAE,KAAK,GACvH,aACH,KAHO,CAIT;AAAA,QAEJ,GACF,GACF;AAAA,QACA,gBAAAA,KAAC,QAAG,WAAW,EAAE,QAAQ,GACtB,iBAAO,QAAQ,SAAS,KAAK,GAChC;AAAA,SACF;AAAA,MAEF,gBAAAA,KAAC,QACC,0BAAAC;AAAA,QAAC;AAAA;AAAA,UACC,MAAM,KAAK,UAAU,CAAC;AAAA,UACtB,SAAS,QAAQ,GAAG,UAAU,CAAC,IAAI;AAAA,UACnC,UAAU,YAAY,CAAC;AAAA,UACvB,OAAO,OAAO;AAAA,UACd,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAAA,UAEzC;AAAA,4BAAAD,KAAC,UAAK,WAAU,qBAAqB,iBAAO,MAAK;AAAA,YACjD,gBAAAA,KAAC,gBAAa,WAAU,SAAQ;AAAA;AAAA;AAAA,MAClC,GACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":["jsx","jsxs"]}
|
|
1
|
+
{"version":3,"sources":["../src/pagination/pagination.tsx"],"sourcesContent":["// Server-safe: no hook, no context. A `<nav>` named by `labels.nav`; the current page is `aria-current=\"page\"`.\n// Two modes: pages (`page` + `pageCount`: numbers with ellipses, which fold into \"Page 3 of 12\" in a narrow container)\n// and cursor (`hasPrevious` / `hasNext`: an API that only knows the next and previous pages). Links (`getHref`) when\n// the page lives in the address — the right default for a list a search engine or a shared link should reach — or\n// buttons (`onPageChange`).\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { ChevronGlyph } from \"../glyphs\";\n\nexport const pagination = tv({\n slots: {\n root: \"@container flex w-full flex-wrap items-center justify-between gap-3 text-sm\",\n list: \"flex items-center gap-1\",\n pages: \"hidden items-center gap-1 @md:flex\",\n compact: \"px-2 text-xs font-semibold tabular-nums text-fg-secondary @md:hidden\",\n item:\n \"inline-flex h-9 min-w-9 select-none items-center justify-center gap-1.5 rounded-lg px-2.5 text-sm font-semibold tabular-nums text-fg-secondary \" +\n \"transition-colors hover:bg-surface-2 hover:text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring \" +\n \"aria-[current=page]:bg-accent aria-[current=page]:text-on-accent aria-[current=page]:hover:bg-accent \" +\n \"aria-disabled:pointer-events-none aria-disabled:opacity-40 disabled:pointer-events-none disabled:opacity-40\",\n edge: \"border border-border-default bg-surface-1 px-3\",\n ellipsis: \"inline-flex h-9 min-w-6 items-end justify-center pb-2 text-fg-muted\",\n status: \"text-xs text-fg-secondary tabular-nums\",\n size: \"flex items-center gap-2 text-xs text-fg-secondary\",\n select:\n \"h-9 rounded-lg border border-border-default bg-surface-2 px-2 text-sm text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n },\n});\n\nexport type PaginationLabels = {\n /** The accessible name of the navigation (\"Pagination\", \"Pages of results\"). */\n nav: string;\n /** The previous-page control. */\n previous: string;\n /** The next-page control. */\n next: string;\n /** The accessible name of a page number: `(3) => \"Page 3\"`. */\n page: (page: number) => string;\n /** The folded form, in a narrow container: `(3, 12) => \"Page 3 of 12\"`. */\n compact: (page: number, pageCount: number) => string;\n /** The label of the page-size select (\"Rows per page\"). */\n pageSize: string;\n};\n\n/** The English words, for a quick start — pass your translations through `labels`. */\nexport const paginationLabels: PaginationLabels = {\n nav: \"Pagination\",\n previous: \"Previous\",\n next: \"Next\",\n page: (page) => `Page ${page}`,\n compact: (page, count) => `Page ${page} of ${count}`,\n pageSize: \"Rows per page\",\n};\n\n/**\n * The pages to show: the first and last `boundaries`, the current page and its `siblings`, and `\"…\"` where pages are\n * skipped. A gap of a single page shows that page instead of an ellipsis; few pages are all shown.\n */\nexport function pageRange(page: number, pageCount: number, siblings = 1, boundaries = 1): (number | \"…\")[] {\n // Few enough pages to show them all in the room the folded form takes: no ellipsis.\n if (pageCount <= 2 * boundaries + 2 * siblings + 3) return Array.from({ length: Math.max(0, pageCount) }, (_, i) => i + 1);\n const pages = new Set<number>();\n for (let i = 1; i <= Math.min(boundaries, pageCount); i += 1) pages.add(i);\n for (let i = Math.max(1, pageCount - boundaries + 1); i <= pageCount; i += 1) pages.add(i);\n for (let i = Math.max(1, page - siblings); i <= Math.min(pageCount, page + siblings); i += 1) pages.add(i);\n const sorted = [...pages].sort((a, b) => a - b);\n const out: (number | \"…\")[] = [];\n sorted.forEach((n, i) => {\n const prev = sorted[i - 1];\n if (prev !== undefined && n - prev === 2) out.push(prev + 1);\n else if (prev !== undefined && n - prev > 2) out.push(\"…\");\n out.push(n);\n });\n return out;\n}\n\nexport type PaginationProps = Omit<React.ComponentProps<\"nav\">, \"children\"> & {\n /** Pages mode: the current page, from 1. */\n page?: number;\n /** Pages mode: how many pages there are. Without it, the pagination is in cursor mode. */\n pageCount?: number;\n /** Called with the page asked for (buttons). Ignored for the pages `getHref` turns into links. */\n onPageChange?: (page: number) => void;\n /** The address of a page: the pages become links (crawlable, shareable, the state in the URL). */\n getHref?: (page: number) => string;\n /** Cursor mode: whether there is a previous page. */\n hasPrevious?: boolean;\n /** Cursor mode: whether there is a next page. */\n hasNext?: boolean;\n /** Cursor mode: called by the previous control. */\n onPrevious?: () => void;\n /** Cursor mode: called by the next control. */\n onNext?: () => void;\n /** Pages shown on each side of the current one. Default 1. */\n siblings?: number;\n /** Pages always shown at each end. Default 1. */\n boundaries?: number;\n /** A text beside the controls, read as is: \"41–60 of 1,284\", \"12 results\". */\n status?: React.ReactNode;\n /** The page size, with `pageSizeOptions` and `onPageSizeChange`: a select of rows per page. */\n pageSize?: number;\n /** The sizes offered (`[10, 20, 50]`). */\n pageSizeOptions?: readonly number[];\n /** Called with the size chosen. */\n onPageSizeChange?: (size: number) => void;\n /** Disables every control (a page is loading). */\n disabled?: boolean;\n /** The words, passed translated; English by default. */\n labels?: Partial<PaginationLabels>;\n};\n\ntype ItemProps = {\n href?: string;\n onClick?: () => void;\n disabled?: boolean;\n current?: boolean;\n label: string;\n className: string;\n children: React.ReactNode;\n};\n\nfunction Item({ href, onClick, disabled, current, label, className, children }: ItemProps) {\n const common = { \"aria-label\": label, \"aria-current\": current ? (\"page\" as const) : undefined, className };\n if (href && !disabled) {\n return (\n <a href={href} onClick={onClick} {...common}>\n {children}\n </a>\n );\n }\n if (href) {\n return (\n <a role=\"link\" aria-disabled {...common}>\n {children}\n </a>\n );\n }\n return (\n <button type=\"button\" onClick={onClick} disabled={disabled} {...common}>\n {children}\n </button>\n );\n}\n\n/** Moves through a long list: page numbers (folded on a narrow screen) or previous / next on a cursor. */\nexport function Pagination({\n page = 1,\n pageCount,\n onPageChange,\n getHref,\n hasPrevious,\n hasNext,\n onPrevious,\n onNext,\n siblings = 1,\n boundaries = 1,\n status,\n pageSize,\n pageSizeOptions,\n onPageSizeChange,\n disabled,\n labels: given,\n className,\n ...props\n}: PaginationProps) {\n const s = pagination();\n const labels = { ...paginationLabels, ...given };\n const paged = pageCount !== undefined;\n const count = Math.max(1, pageCount ?? 1);\n const current = Math.min(Math.max(1, page), count);\n const canPrevious = paged ? current > 1 : Boolean(hasPrevious);\n const canNext = paged ? current < count : Boolean(hasNext);\n const go = (target: number) => () => onPageChange?.(target);\n const href = (target: number) => (paged && getHref ? getHref(target) : undefined);\n\n return (\n <nav aria-label={labels.nav} className={s.root({ className })} {...props}>\n {status !== undefined || pageSizeOptions ? (\n <div className=\"flex flex-wrap items-center gap-4\">\n {status !== undefined && <p className={s.status()}>{status}</p>}\n {pageSizeOptions && pageSize !== undefined && (\n <label className={s.size()}>\n {labels.pageSize}\n <select\n className={s.select()}\n value={pageSize}\n disabled={disabled}\n onChange={(event) => onPageSizeChange?.(Number(event.target.value))}\n >\n {pageSizeOptions.map((size) => (\n <option key={size} value={size}>\n {size}\n </option>\n ))}\n </select>\n </label>\n )}\n </div>\n ) : null}\n <ul className={s.list()}>\n <li>\n <Item\n href={href(current - 1)}\n onClick={paged ? go(current - 1) : onPrevious}\n disabled={disabled || !canPrevious}\n label={labels.previous}\n className={s.item({ className: s.edge() })}\n >\n <ChevronGlyph direction=\"left\" />\n <span className=\"hidden @lg:inline\">{labels.previous}</span>\n </Item>\n </li>\n {paged && (\n <>\n <li className={s.pages()}>\n <ul className=\"contents\">\n {pageRange(current, count, siblings, boundaries).map((n, i) =>\n n === \"…\" ? (\n <li key={`gap-${i}`} aria-hidden className={s.ellipsis()}>\n …\n </li>\n ) : (\n <li key={n}>\n <Item href={href(n)} onClick={go(n)} disabled={disabled} current={n === current} label={labels.page(n)} className={s.item()}>\n {n}\n </Item>\n </li>\n ),\n )}\n </ul>\n </li>\n <li className={s.compact()}>\n {labels.compact(current, count)}\n </li>\n </>\n )}\n <li>\n <Item\n href={href(current + 1)}\n onClick={paged ? go(current + 1) : onNext}\n disabled={disabled || !canNext}\n label={labels.next}\n className={s.item({ className: s.edge() })}\n >\n <span className=\"hidden @lg:inline\">{labels.next}</span>\n <ChevronGlyph direction=\"right\" />\n </Item>\n </li>\n </ul>\n </nav>\n );\n}\n"],"mappings":";;;;;AAMA,SAAS,UAAU;AAwHb,SAwFI,UAxFJ,KAwDM,YAxDN;AApHC,IAAM,aAAa,GAAG;AAAA,EAC3B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MACE;AAAA,IAIF,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QACE;AAAA,EACJ;AACF,CAAC;AAkBM,IAAM,mBAAqC;AAAA,EAChD,KAAK;AAAA,EACL,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM,CAAC,SAAS,QAAQ,IAAI;AAAA,EAC5B,SAAS,CAAC,MAAM,UAAU,QAAQ,IAAI,OAAO,KAAK;AAAA,EAClD,UAAU;AACZ;AAMO,SAAS,UAAU,MAAc,WAAmB,WAAW,GAAG,aAAa,GAAqB;A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AAW,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAAA,UAEzC;AAAA,gCAAC,UAAK,WAAU,qBAAqB,iBAAO,MAAK;AAAA,YACjD,oBAAC,gBAAa,WAAU,SAAQ;AAAA;AAAA;AAAA,MAClC,GACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** Every card of the page blocks carries it: LinkCard, ArgumentCard. */
|
|
4
|
+
declare const POINTER_LIGHT_TARGET = "[data-kz-light]";
|
|
5
|
+
/** Lights the cards inside `ref` that match `target`. Returns nothing; the effect cleans itself up. */
|
|
6
|
+
declare function usePointerLight(ref: React.RefObject<HTMLElement | null>, target?: string): void;
|
|
7
|
+
type PointerLightProps = {
|
|
8
|
+
/**
|
|
9
|
+
* The cards to light, as a selector inside the parent element.
|
|
10
|
+
* @default "[data-kz-light]"
|
|
11
|
+
*/
|
|
12
|
+
target?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Drop it inside any group of cards (a grid, a list) — it listens on its parent element. Renders an empty, hidden span.
|
|
16
|
+
* CardGrid includes it already.
|
|
17
|
+
*/
|
|
18
|
+
declare function PointerLight({ target }: PointerLightProps): React.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { POINTER_LIGHT_TARGET, PointerLight, type PointerLightProps, usePointerLight };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/search-field.js
CHANGED
package/dist/section-backdrop.js
CHANGED
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
slots: {
|
|
6
|
-
root: "kz-backdrop",
|
|
7
|
-
drift: "kz-backdrop-drift",
|
|
8
|
-
dome: "kz-backdrop-dome",
|
|
9
|
-
grid: "kz-backdrop-grid",
|
|
10
|
-
media: "kz-backdrop-media"
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
function SectionBackdrop({ as: Tag = "section", direction = "down", dome = true, grid = false, media, animated = true, className, children, ...props }) {
|
|
14
|
-
const s = sectionBackdropVariants();
|
|
15
|
-
return /* @__PURE__ */ jsxs(Tag, { className: s.root({ className }), "data-direction": direction, ...props, children: [
|
|
16
|
-
animated ? /* @__PURE__ */ jsx("div", { "data-backdrop-layer": true, "aria-hidden": true, className: s.drift() }) : null,
|
|
17
|
-
dome ? /* @__PURE__ */ jsx("div", { "data-backdrop-layer": true, "aria-hidden": true, className: s.dome() }) : null,
|
|
18
|
-
grid ? /* @__PURE__ */ jsx("div", { "data-backdrop-layer": true, "aria-hidden": true, className: s.grid() }) : null,
|
|
19
|
-
media ? /* @__PURE__ */ jsx("div", { "data-backdrop-layer": true, "aria-hidden": true, className: s.media(), children: media }) : null,
|
|
20
|
-
children
|
|
21
|
-
] });
|
|
22
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
SectionBackdrop,
|
|
3
|
+
sectionBackdropVariants
|
|
4
|
+
} from "./chunk-XVLWVTQA.js";
|
|
23
5
|
export {
|
|
24
6
|
SectionBackdrop,
|
|
25
7
|
sectionBackdropVariants
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/tag-input.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Combobox
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-X6TW3X6Y.js";
|
|
5
5
|
import "./chunk-YH4LMWRU.js";
|
|
6
6
|
import "./chunk-ZIXB33X7.js";
|
|
7
7
|
import {
|
|
8
8
|
useControllable
|
|
9
9
|
} from "./chunk-EUPTXKH7.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-CPA5CF35.js";
|
|
11
11
|
|
|
12
12
|
// src/tag-input/tag-input.tsx
|
|
13
13
|
import * as React from "react";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** The colour of an output line — the tokens' text roles, all AA on the screen: secondary, accent, success, warning, danger. */
|
|
4
|
+
type TerminalTone = "muted" | "accent" | "success" | "warning" | "danger";
|
|
5
|
+
interface TerminalLine {
|
|
6
|
+
/** The line as the program printed it (no colour codes). */
|
|
7
|
+
text: string;
|
|
8
|
+
/** Its colour, when the program coloured it. */
|
|
9
|
+
tone?: TerminalTone;
|
|
10
|
+
}
|
|
11
|
+
interface TerminalStep {
|
|
12
|
+
/** What is typed at the prompt (`npx orazaka install`). */
|
|
13
|
+
command: string;
|
|
14
|
+
/** What it printed, line by line. */
|
|
15
|
+
output?: readonly (string | TerminalLine)[];
|
|
16
|
+
}
|
|
17
|
+
type TerminalReplayProps = Omit<React.ComponentProps<"figure">, "children" | "title"> & {
|
|
18
|
+
/** The session, in order. */
|
|
19
|
+
steps: readonly TerminalStep[];
|
|
20
|
+
/** The accessible name of the screen (“Terminal session: install, start, dev”) — passed translated. */
|
|
21
|
+
label: string;
|
|
22
|
+
/** The window's title, shown in its bar (`~/projects — zsh`). */
|
|
23
|
+
title?: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* What the prompt shows before each command.
|
|
26
|
+
* @default "$"
|
|
27
|
+
*/
|
|
28
|
+
prompt?: string;
|
|
29
|
+
/** The play button's words (the replay is waiting or paused). */
|
|
30
|
+
playLabel: string;
|
|
31
|
+
/** The pause button's words (the replay is running). */
|
|
32
|
+
pauseLabel: string;
|
|
33
|
+
/** The replay button's words (the session is shown whole). */
|
|
34
|
+
replayLabel: string;
|
|
35
|
+
/** The copy button's words: it copies the commands, one per line. Without it, no copy button. */
|
|
36
|
+
copyLabel?: string;
|
|
37
|
+
/** What the copy button says once the commands are copied (announced politely). */
|
|
38
|
+
copiedLabel?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Milliseconds per typed character.
|
|
41
|
+
* @default 34
|
|
42
|
+
*/
|
|
43
|
+
typingSpeed?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Milliseconds between two output lines.
|
|
46
|
+
* @default 70
|
|
47
|
+
*/
|
|
48
|
+
lineDelay?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Milliseconds between a command's last line and the next command.
|
|
51
|
+
* @default 900
|
|
52
|
+
*/
|
|
53
|
+
stepDelay?: number;
|
|
54
|
+
/**
|
|
55
|
+
* The screen's height, in lines; longer sessions scroll.
|
|
56
|
+
* @default 18
|
|
57
|
+
*/
|
|
58
|
+
rows?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Plays the first time it scrolls into view. `false`: the session rests whole until the reader presses play.
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
autoPlay?: boolean;
|
|
64
|
+
};
|
|
65
|
+
/** A terminal session played back: commands typed at the prompt, their output line by line — or the whole session at rest. */
|
|
66
|
+
declare function TerminalReplay({ steps, label, title, prompt, playLabel, pauseLabel, replayLabel, copyLabel, copiedLabel, typingSpeed, lineDelay, stepDelay, rows, autoPlay, className, style, ...props }: TerminalReplayProps): React.JSX.Element;
|
|
67
|
+
|
|
68
|
+
export { type TerminalLine, TerminalReplay, type TerminalReplayProps, type TerminalStep, type TerminalTone };
|