@krizaka/ui 2.10.0 → 3.1.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 +4 -2
- package/dist/audio-player.js +1 -1
- package/dist/{chunk-EUPTXKH7.js → chunk-BRKMQ6JV.js} +2 -1
- package/dist/chunk-FDCMBWUU.js +168 -0
- package/dist/chunk-FDCMBWUU.js.map +1 -0
- package/dist/chunk-HCNOOPZE.js +210 -0
- package/dist/chunk-HCNOOPZE.js.map +1 -0
- package/dist/{chunk-X6TW3X6Y.js → chunk-LCZXS6AK.js} +2 -2
- package/dist/chunk-OGJI5X4W.js +157 -0
- package/dist/chunk-OGJI5X4W.js.map +1 -0
- package/dist/combobox.js +2 -2
- package/dist/data-table.d.ts +284 -24
- package/dist/data-table.js +914 -121
- package/dist/data-table.js.map +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/filter-bar.d.ts +12 -12
- package/dist/filter-bar.js +9 -145
- package/dist/filter-bar.js.map +1 -1
- package/dist/form/server.d.ts +96 -0
- package/dist/form/server.js +82 -0
- package/dist/form/server.js.map +1 -0
- package/dist/form.d.ts +503 -0
- package/dist/form.js +760 -0
- package/dist/form.js.map +1 -0
- package/dist/image-cropper.js +1 -1
- package/dist/media-capture.js +1 -1
- package/dist/native/form.d.ts +376 -0
- package/dist/native/form.js +650 -0
- package/dist/native/form.js.map +1 -0
- package/dist/native/list.d.ts +95 -0
- package/dist/native/list.js +135 -0
- package/dist/native/list.js.map +1 -0
- package/dist/native.d.ts +113 -2
- package/dist/native.js +618 -388
- package/dist/native.js.map +1 -1
- package/dist/search-field.js +6 -160
- package/dist/search-field.js.map +1 -1
- package/dist/tag-input.js +2 -2
- package/dist/video-player.js +1 -1
- package/dist/video-trimmer.js +1 -1
- package/dist/virtual.d.ts +140 -0
- package/dist/virtual.js +19 -0
- package/dist/virtual.js.map +1 -0
- package/package.json +111 -8
- package/registry/achievement.json +1 -1
- package/registry/action-bar.json +1 -1
- package/registry/alert.json +1 -1
- package/registry/app-shell.json +1 -1
- package/registry/argument-card.json +1 -1
- package/registry/audio-player.json +1 -1
- package/registry/auth-layout.json +1 -1
- package/registry/avatar.json +1 -1
- package/registry/badge.json +1 -1
- package/registry/button.json +1 -1
- package/registry/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/checkbox.json +89 -4
- package/registry/chip-link.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/choice-grid.json +1 -1
- package/registry/code-block.json +1 -1
- package/registry/combobox.json +1 -1
- package/registry/command.json +1 -1
- package/registry/component-page.json +1 -1
- package/registry/confirm-button.json +1 -1
- package/registry/contact-page.json +1 -1
- package/registry/continue-prompt.json +1 -1
- package/registry/countdown.json +1 -1
- package/registry/cta-panel.json +1 -1
- package/registry/dashboard-layout.json +1 -1
- package/registry/data-table.json +643 -49
- package/registry/date-picker.json +142 -4
- package/registry/decision-list.json +1 -1
- package/registry/detail-layout.json +1 -1
- package/registry/dialog.json +1 -1
- package/registry/docs-article-page.json +1 -1
- package/registry/docs-hub-page.json +1 -1
- package/registry/docs-layout.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/error-page.json +1 -1
- package/registry/examples/checkbox/native/terms.d.ts +4 -0
- package/registry/examples/checkbox/native/terms.dark.png +0 -0
- package/registry/examples/checkbox/native/terms.js +26 -0
- package/registry/examples/checkbox/native/terms.light.png +0 -0
- package/registry/examples/checkbox/native/terms.tsx +28 -0
- package/registry/examples/data-table/details.d.ts +4 -0
- package/registry/examples/data-table/details.js +33 -0
- package/registry/examples/data-table/details.tsx +31 -0
- package/registry/examples/data-table/filters.d.ts +4 -0
- package/registry/examples/data-table/filters.js +40 -0
- package/registry/examples/data-table/filters.tsx +40 -0
- package/registry/examples/data-table/grouped.d.ts +4 -0
- package/registry/examples/data-table/grouped.js +24 -0
- package/registry/examples/data-table/grouped.tsx +23 -0
- package/registry/examples/data-table/paginated.d.ts +4 -0
- package/registry/examples/data-table/paginated.js +23 -0
- package/registry/examples/data-table/paginated.tsx +22 -0
- package/registry/examples/data-table/pinned.d.ts +4 -0
- package/registry/examples/data-table/pinned.js +26 -0
- package/registry/examples/data-table/pinned.tsx +25 -0
- package/registry/examples/data-table/server.d.ts +4 -0
- package/registry/examples/data-table/server.js +40 -0
- package/registry/examples/data-table/server.tsx +40 -0
- package/registry/examples/data-table/virtualized.js +2 -2
- package/registry/examples/data-table/virtualized.tsx +3 -3
- package/registry/examples/date-picker/native/birth-date.d.ts +4 -0
- package/registry/examples/date-picker/native/birth-date.dark.png +0 -0
- package/registry/examples/date-picker/native/birth-date.js +30 -0
- package/registry/examples/date-picker/native/birth-date.light.png +0 -0
- package/registry/examples/date-picker/native/birth-date.tsx +27 -0
- package/registry/examples/field/native/default.d.ts +4 -0
- package/registry/examples/field/native/default.dark.png +0 -0
- package/registry/examples/field/native/default.js +29 -0
- package/registry/examples/field/native/default.light.png +0 -0
- package/registry/examples/field/native/default.tsx +23 -0
- package/registry/examples/form/amount.d.ts +4 -0
- package/registry/examples/form/amount.js +30 -0
- package/registry/examples/form/amount.tsx +36 -0
- package/registry/examples/form/audience.d.ts +4 -0
- package/registry/examples/form/audience.js +29 -0
- package/registry/examples/form/audience.tsx +31 -0
- package/registry/examples/form/native/amount.d.ts +4 -0
- package/registry/examples/form/native/amount.dark.png +0 -0
- package/registry/examples/form/native/amount.js +26 -0
- package/registry/examples/form/native/amount.light.png +0 -0
- package/registry/examples/form/native/amount.tsx +30 -0
- package/registry/examples/form/native/audience.d.ts +4 -0
- package/registry/examples/form/native/audience.dark.png +0 -0
- package/registry/examples/form/native/audience.js +24 -0
- package/registry/examples/form/native/audience.light.png +0 -0
- package/registry/examples/form/native/audience.tsx +24 -0
- package/registry/examples/form/native/profile.d.ts +4 -0
- package/registry/examples/form/native/profile.dark.png +0 -0
- package/registry/examples/form/native/profile.js +33 -0
- package/registry/examples/form/native/profile.light.png +0 -0
- package/registry/examples/form/native/profile.tsx +36 -0
- package/registry/examples/form/native/settings.d.ts +4 -0
- package/registry/examples/form/native/settings.dark.png +0 -0
- package/registry/examples/form/native/settings.js +25 -0
- package/registry/examples/form/native/settings.light.png +0 -0
- package/registry/examples/form/native/settings.tsx +23 -0
- package/registry/examples/form/native/sign-up.d.ts +4 -0
- package/registry/examples/form/native/sign-up.dark.png +0 -0
- package/registry/examples/form/native/sign-up.js +38 -0
- package/registry/examples/form/native/sign-up.light.png +0 -0
- package/registry/examples/form/native/sign-up.tsx +34 -0
- package/registry/examples/form/native/upload.d.ts +4 -0
- package/registry/examples/form/native/upload.dark.png +0 -0
- package/registry/examples/form/native/upload.js +23 -0
- package/registry/examples/form/native/upload.light.png +0 -0
- package/registry/examples/form/native/upload.tsx +22 -0
- package/registry/examples/form/profile.d.ts +4 -0
- package/registry/examples/form/profile.js +35 -0
- package/registry/examples/form/profile.tsx +40 -0
- package/registry/examples/form/report.d.ts +4 -0
- package/registry/examples/form/report.js +30 -0
- package/registry/examples/form/report.tsx +30 -0
- package/registry/examples/form/settings.d.ts +4 -0
- package/registry/examples/form/settings.js +30 -0
- package/registry/examples/form/settings.tsx +31 -0
- package/registry/examples/form/sign-up.d.ts +4 -0
- package/registry/examples/form/sign-up.js +38 -0
- package/registry/examples/form/sign-up.tsx +37 -0
- package/registry/examples/form/upload.d.ts +4 -0
- package/registry/examples/form/upload.js +32 -0
- package/registry/examples/form/upload.tsx +32 -0
- package/registry/examples/list/native/default.d.ts +4 -0
- package/registry/examples/list/native/default.dark.png +0 -0
- package/registry/examples/list/native/default.js +33 -0
- package/registry/examples/list/native/default.light.png +0 -0
- package/registry/examples/list/native/default.tsx +31 -0
- package/registry/examples/list/native/infinite.d.ts +4 -0
- package/registry/examples/list/native/infinite.dark.png +0 -0
- package/registry/examples/list/native/infinite.js +30 -0
- package/registry/examples/list/native/infinite.light.png +0 -0
- package/registry/examples/list/native/infinite.tsx +35 -0
- package/registry/examples/list/native/states.d.ts +4 -0
- package/registry/examples/list/native/states.dark.png +0 -0
- package/registry/examples/list/native/states.js +26 -0
- package/registry/examples/list/native/states.light.png +0 -0
- package/registry/examples/list/native/states.tsx +21 -0
- package/registry/examples/virtual/feed.d.ts +4 -0
- package/registry/examples/virtual/feed.js +26 -0
- package/registry/examples/virtual/feed.tsx +24 -0
- package/registry/examples/virtual/gallery.d.ts +4 -0
- package/registry/examples/virtual/gallery.js +31 -0
- package/registry/examples/virtual/gallery.tsx +28 -0
- package/registry/examples/virtual/messages.d.ts +4 -0
- package/registry/examples/virtual/messages.js +28 -0
- package/registry/examples/virtual/messages.tsx +28 -0
- package/registry/field.json +104 -4
- package/registry/file-upload.json +1 -1
- package/registry/filter-bar.json +1 -1
- package/registry/form.json +2940 -0
- package/registry/gallery-page.json +1 -1
- package/registry/glow-card.json +1 -1
- package/registry/goal-gauge.json +1 -1
- package/registry/how-it-works-page.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/index.json +86 -11
- package/registry/iso.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/landing-page.json +1 -1
- package/registry/landscape.json +1 -1
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +1 -1
- package/registry/list.json +249 -0
- package/registry/loader.json +1 -1
- package/registry/longform-page.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 +2 -2
- package/registry/mascots.json +2 -2
- package/registry/media-capture.json +1 -1
- 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 +1 -1
- package/registry/page.json +1 -1
- package/registry/pagination.json +1 -1
- package/registry/pointer-light.json +1 -1
- package/registry/popover.json +1 -1
- package/registry/pricing-page.json +1 -1
- package/registry/product-page.json +1 -1
- package/registry/profile-card.json +1 -1
- package/registry/progress.json +1 -1
- package/registry/promise-card.json +1 -1
- package/registry/radio-group.json +1 -1
- package/registry/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/settings-layout.json +1 -1
- package/registry/skeleton.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/spinner.json +1 -1
- package/registry/split-view.json +1 -1
- package/registry/stage-banner.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/status-page.json +1 -1
- package/registry/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 +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/video-player.json +1 -1
- package/registry/video-trimmer.json +1 -1
- package/registry/virtual.json +569 -0
- package/skills/data-table/SKILL.md +56 -0
- package/skills/form/SKILL.md +44 -0
- package/skills/native-list/SKILL.md +39 -0
- package/skills/virtual/SKILL.md +35 -0
- /package/dist/{chunk-EUPTXKH7.js.map → chunk-BRKMQ6JV.js.map} +0 -0
- /package/dist/{chunk-X6TW3X6Y.js.map → chunk-LCZXS6AK.js.map} +0 -0
package/dist/search-field.js
CHANGED
|
@@ -1,165 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
CloseGlyph,
|
|
11
|
-
SearchGlyph
|
|
12
|
-
} from "./chunk-CPA5CF35.js";
|
|
13
|
-
|
|
14
|
-
// src/search-field/search-field.tsx
|
|
15
|
-
import * as React from "react";
|
|
16
|
-
import { tv as tv2 } from "tailwind-variants";
|
|
17
|
-
|
|
18
|
-
// src/kbd/kbd.tsx
|
|
19
|
-
import { tv } from "tailwind-variants";
|
|
20
|
-
import { jsx } from "react/jsx-runtime";
|
|
21
|
-
var kbdVariants = tv({
|
|
22
|
-
base: "inline-flex shrink-0 items-center justify-center rounded-md border border-border-default border-b-2 bg-surface-2 font-mono font-semibold text-fg-secondary",
|
|
23
|
-
variants: { size: { sm: "h-5 min-w-5 px-1 text-[10px]", md: "h-6 min-w-6 px-1.5 text-xs" } },
|
|
24
|
-
defaultVariants: { size: "md" }
|
|
25
|
-
});
|
|
26
|
-
function Kbd({ size, className, ...props }) {
|
|
27
|
-
return /* @__PURE__ */ jsx("kbd", { className: kbdVariants({ size, className }), ...props });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// src/search-field/search-field.tsx
|
|
31
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
32
|
-
var searchField = tv2({
|
|
33
|
-
slots: {
|
|
34
|
-
root: "relative w-full",
|
|
35
|
-
control: "flex h-11 w-full items-center gap-2 rounded-lg border border-border-default bg-surface-2 pl-3 pr-1.5 text-sm text-fg transition-[border-color,box-shadow] focus-within:border-accent focus-within:ring-2 focus-within:ring-ring",
|
|
36
|
-
icon: "h-4 w-4 shrink-0 text-fg-secondary",
|
|
37
|
-
input: "h-full min-w-0 flex-1 bg-transparent text-sm text-fg outline-hidden placeholder:text-fg-muted [&::-webkit-search-cancel-button]:appearance-none",
|
|
38
|
-
clear: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-fg-secondary hover:bg-surface-3 hover:text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
39
|
-
shortcut: "hidden shrink-0 items-center gap-0.5 pr-1 sm:flex",
|
|
40
|
-
list: "absolute inset-x-0 top-full z-50 mt-1 max-h-72 overflow-y-auto rounded-lg border border-border-default bg-surface-2 p-1 shadow-lg",
|
|
41
|
-
option: "flex cursor-pointer select-none items-center gap-2.5 rounded-md px-2.5 py-2 text-sm text-fg data-[active]:bg-surface-3",
|
|
42
|
-
group: "px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase text-fg-muted"
|
|
43
|
-
},
|
|
44
|
-
variants: {
|
|
45
|
-
size: { md: {}, sm: { control: "h-9", clear: "h-7 w-7" } }
|
|
46
|
-
},
|
|
47
|
-
defaultVariants: { size: "md" }
|
|
48
|
-
});
|
|
49
|
-
var isApple = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
50
|
-
function SearchField({
|
|
51
|
-
label,
|
|
52
|
-
value: valueProp,
|
|
53
|
-
defaultValue = "",
|
|
54
|
-
onValueChange,
|
|
55
|
-
onSearch,
|
|
56
|
-
debounce = 250,
|
|
57
|
-
onSubmit,
|
|
58
|
-
shortcut = false,
|
|
59
|
-
suggestions,
|
|
60
|
-
suggestionsLabel,
|
|
61
|
-
onSuggestionSelect,
|
|
62
|
-
clearLabel = "Clear search",
|
|
63
|
-
landmark = true,
|
|
64
|
-
size,
|
|
65
|
-
className,
|
|
66
|
-
placeholder,
|
|
67
|
-
...props
|
|
68
|
-
}) {
|
|
69
|
-
const s = searchField({ size });
|
|
70
|
-
const [value, setValue] = useControllable(valueProp, defaultValue, onValueChange);
|
|
71
|
-
const [open, setOpen] = React.useState(false);
|
|
72
|
-
const [apple, setApple] = React.useState(false);
|
|
73
|
-
const input = React.useRef(null);
|
|
74
|
-
const search = useDebouncedCallback((query) => onSearch?.(query), debounce);
|
|
75
|
-
const list = suggestions ?? [];
|
|
76
|
-
const pick = (i) => {
|
|
77
|
-
const suggestion = list[i];
|
|
78
|
-
if (!suggestion) return;
|
|
79
|
-
setOpen(false);
|
|
80
|
-
onSuggestionSelect?.(suggestion);
|
|
81
|
-
};
|
|
82
|
-
const listbox = useListbox({ count: list.length, onPick: pick, open: open && list.length > 0, setOpen });
|
|
83
|
-
React.useEffect(() => {
|
|
84
|
-
if (!shortcut) return;
|
|
85
|
-
setApple(isApple());
|
|
86
|
-
const onKey = (event) => {
|
|
87
|
-
if (event.key.toLowerCase() === shortcut.toLowerCase() && (event.metaKey || event.ctrlKey) && !event.altKey) {
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
input.current?.focus();
|
|
90
|
-
input.current?.select();
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
window.addEventListener("keydown", onKey);
|
|
94
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
95
|
-
}, [shortcut]);
|
|
96
|
-
const change = (query) => {
|
|
97
|
-
setValue(query);
|
|
98
|
-
search(query);
|
|
99
|
-
listbox.setActive(-1);
|
|
100
|
-
setOpen(true);
|
|
101
|
-
};
|
|
102
|
-
const field = /* @__PURE__ */ jsxs("div", { className: s.root({ className }), onBlur: (event) => !event.currentTarget.contains(event.relatedTarget) && setOpen(false), children: [
|
|
103
|
-
/* @__PURE__ */ jsxs("div", { className: s.control(), children: [
|
|
104
|
-
/* @__PURE__ */ jsx2(SearchGlyph, { className: s.icon() }),
|
|
105
|
-
/* @__PURE__ */ jsx2(
|
|
106
|
-
"input",
|
|
107
|
-
{
|
|
108
|
-
ref: input,
|
|
109
|
-
type: "search",
|
|
110
|
-
"aria-label": label,
|
|
111
|
-
enterKeyHint: "search",
|
|
112
|
-
autoComplete: "off",
|
|
113
|
-
...list.length > 0 ? listbox.inputProps : {},
|
|
114
|
-
value,
|
|
115
|
-
placeholder,
|
|
116
|
-
className: s.input(),
|
|
117
|
-
onChange: (event) => change(event.target.value),
|
|
118
|
-
onFocus: () => setOpen(true),
|
|
119
|
-
onKeyDown: (event) => {
|
|
120
|
-
if (list.length > 0 && listbox.onKeyDown(event)) return;
|
|
121
|
-
if (event.key === "Enter") {
|
|
122
|
-
event.preventDefault();
|
|
123
|
-
search.cancel();
|
|
124
|
-
onSearch?.(value);
|
|
125
|
-
onSubmit?.(value);
|
|
126
|
-
setOpen(false);
|
|
127
|
-
} else if (event.key === "Escape" && value) {
|
|
128
|
-
event.preventDefault();
|
|
129
|
-
change("");
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
...props
|
|
133
|
-
}
|
|
134
|
-
),
|
|
135
|
-
value ? /* @__PURE__ */ jsx2(
|
|
136
|
-
"button",
|
|
137
|
-
{
|
|
138
|
-
type: "button",
|
|
139
|
-
"aria-label": clearLabel,
|
|
140
|
-
className: s.clear(),
|
|
141
|
-
onClick: () => {
|
|
142
|
-
change("");
|
|
143
|
-
input.current?.focus();
|
|
144
|
-
},
|
|
145
|
-
children: /* @__PURE__ */ jsx2(CloseGlyph, { className: "h-4 w-4" })
|
|
146
|
-
}
|
|
147
|
-
) : shortcut ? /* @__PURE__ */ jsxs("span", { className: s.shortcut(), "aria-hidden": true, children: [
|
|
148
|
-
/* @__PURE__ */ jsx2(Kbd, { size: "sm", children: apple ? "\u2318" : "Ctrl" }),
|
|
149
|
-
/* @__PURE__ */ jsx2(Kbd, { size: "sm", children: shortcut.toUpperCase() })
|
|
150
|
-
] }) : null
|
|
151
|
-
] }),
|
|
152
|
-
list.length > 0 && /* @__PURE__ */ jsxs("div", { hidden: !open, className: s.list(), children: [
|
|
153
|
-
suggestionsLabel ? /* @__PURE__ */ jsx2("div", { "aria-hidden": true, className: s.group(), children: suggestionsLabel }) : null,
|
|
154
|
-
/* @__PURE__ */ jsx2("div", { id: listbox.listId, role: "listbox", "aria-label": suggestionsLabel ?? label, children: list.map((suggestion, i) => /* @__PURE__ */ jsxs("div", { ...listbox.optionProps(i, false), className: s.option(), children: [
|
|
155
|
-
/* @__PURE__ */ jsx2(SearchGlyph, { className: "h-3.5 w-3.5 shrink-0 text-fg-muted" }),
|
|
156
|
-
/* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate", children: suggestion.label }),
|
|
157
|
-
suggestion.meta ? /* @__PURE__ */ jsx2("span", { className: "shrink-0 text-xs text-fg-secondary", children: suggestion.meta }) : null
|
|
158
|
-
] }, suggestion.value)) })
|
|
159
|
-
] })
|
|
160
|
-
] });
|
|
161
|
-
return landmark ? /* @__PURE__ */ jsx2("div", { role: "search", children: field }) : field;
|
|
162
|
-
}
|
|
3
|
+
SearchField,
|
|
4
|
+
searchField
|
|
5
|
+
} from "./chunk-FDCMBWUU.js";
|
|
6
|
+
import "./chunk-ZIXB33X7.js";
|
|
7
|
+
import "./chunk-BRKMQ6JV.js";
|
|
8
|
+
import "./chunk-CPA5CF35.js";
|
|
163
9
|
export {
|
|
164
10
|
SearchField,
|
|
165
11
|
searchField
|
package/dist/search-field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/search-field/search-field.tsx","../src/kbd/kbd.tsx"],"sourcesContent":["// Client. A search input (`type=\"search\"` inside a `role=\"search\"` landmark when it stands alone): a leading glyph,\n// a clear button, a global shortcut that focuses it (⌘K on Apple devices, Ctrl+K elsewhere, shown as `Kbd`), and\n// optional suggestions through the shared combobox engine. `onSearch` is debounced; Enter submits.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { CloseGlyph, SearchGlyph } from \"../glyphs\";\nimport { Kbd } from \"../kbd\";\nimport { useListbox } from \"../listbox\";\nimport { useControllable, useDebouncedCallback } from \"../media\";\n\nexport const searchField = tv({\n slots: {\n root: \"relative w-full\",\n control:\n \"flex h-11 w-full items-center gap-2 rounded-lg border border-border-default bg-surface-2 pl-3 pr-1.5 text-sm text-fg \" +\n \"transition-[border-color,box-shadow] focus-within:border-accent focus-within:ring-2 focus-within:ring-ring\",\n icon: \"h-4 w-4 shrink-0 text-fg-secondary\",\n input:\n \"h-full min-w-0 flex-1 bg-transparent text-sm text-fg outline-hidden placeholder:text-fg-muted \" +\n \"[&::-webkit-search-cancel-button]:appearance-none\",\n clear:\n \"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-fg-secondary hover:bg-surface-3 hover:text-fg \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n shortcut: \"hidden shrink-0 items-center gap-0.5 pr-1 sm:flex\",\n list: \"absolute inset-x-0 top-full z-50 mt-1 max-h-72 overflow-y-auto rounded-lg border border-border-default bg-surface-2 p-1 shadow-lg\",\n option: \"flex cursor-pointer select-none items-center gap-2.5 rounded-md px-2.5 py-2 text-sm text-fg data-[active]:bg-surface-3\",\n group: \"px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase text-fg-muted\",\n },\n variants: {\n size: { md: {}, sm: { control: \"h-9\", clear: \"h-7 w-7\" } },\n },\n defaultVariants: { size: \"md\" },\n});\n\nexport type SearchSuggestion = {\n /** What `onSuggestionSelect` receives. */\n value: string;\n /** What the person reads. */\n label: string;\n /** A small text on the right (\"Creator\", \"12 videos\"). */\n meta?: string;\n};\n\nexport type SearchFieldProps = Omit<React.ComponentProps<\"input\">, \"value\" | \"defaultValue\" | \"onChange\" | \"onSubmit\" | \"size\" | \"type\"> & {\n /** The accessible name of the input (\"Search videos\"), passed translated. */\n label: string;\n /** The query (controlled). */\n value?: string;\n /** The query at first, uncontrolled. */\n defaultValue?: string;\n /** Called on every key with the query. */\n onValueChange?: (query: string) => void;\n /** Called with the query once typing pauses (`debounce` ms): fetch the results here. */\n onSearch?: (query: string) => void;\n /** The pause, in ms, before `onSearch`. Default 250. */\n debounce?: number;\n /** Called on Enter (no suggestion active) with the query: go to the results page. */\n onSubmit?: (query: string) => void;\n /** The global key that focuses the field with ⌘ / Ctrl (`\"k\"`), or `false` for none. Default `false`. */\n shortcut?: string | false;\n /** Suggestions under the field (recent searches, completions). */\n suggestions?: readonly SearchSuggestion[];\n /** A title above the suggestions (\"Recent searches\"). */\n suggestionsLabel?: string;\n /** Called with a suggestion picked (Enter on it, or a click). */\n onSuggestionSelect?: (suggestion: SearchSuggestion) => void;\n /** The clear button's name (\"Clear search\"), passed translated. */\n clearLabel?: string;\n /** Wraps the field in a `role=\"search\"` landmark (default) — `false` inside a form that already is one. */\n landmark?: boolean;\n /** md (default) · sm. */\n size?: \"md\" | \"sm\";\n};\n\nconst isApple = () => typeof navigator !== \"undefined\" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);\n\n/** A search box: clear, shortcut, debounced search, submit on Enter, suggestions with the keyboard. */\nexport function SearchField({\n label,\n value: valueProp,\n defaultValue = \"\",\n onValueChange,\n onSearch,\n debounce = 250,\n onSubmit,\n shortcut = false,\n suggestions,\n suggestionsLabel,\n onSuggestionSelect,\n clearLabel = \"Clear search\",\n landmark = true,\n size,\n className,\n placeholder,\n ...props\n}: SearchFieldProps) {\n const s = searchField({ size });\n const [value, setValue] = useControllable(valueProp, defaultValue, onValueChange);\n const [open, setOpen] = React.useState(false);\n const [apple, setApple] = React.useState(false);\n const input = React.useRef<HTMLInputElement>(null);\n const search = useDebouncedCallback((query: string) => onSearch?.(query), debounce);\n const list = suggestions ?? [];\n\n const pick = (i: number) => {\n const suggestion = list[i];\n if (!suggestion) return;\n setOpen(false);\n onSuggestionSelect?.(suggestion);\n };\n const listbox = useListbox({ count: list.length, onPick: pick, open: open && list.length > 0, setOpen });\n\n React.useEffect(() => {\n if (!shortcut) return;\n // eslint-disable-next-line react-hooks/set-state-in-effect -- the platform is only known in the browser (no hydration mismatch)\n setApple(isApple());\n const onKey = (event: KeyboardEvent) => {\n if (event.key.toLowerCase() === shortcut.toLowerCase() && (event.metaKey || event.ctrlKey) && !event.altKey) {\n event.preventDefault();\n input.current?.focus();\n input.current?.select();\n }\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut]);\n\n const change = (query: string) => {\n setValue(query);\n search(query);\n listbox.setActive(-1);\n setOpen(true);\n };\n\n const field = (\n <div className={s.root({ className })} onBlur={(event) => !event.currentTarget.contains(event.relatedTarget as Node | null) && setOpen(false)}>\n <div className={s.control()}>\n <SearchGlyph className={s.icon()} />\n <input\n ref={input}\n type=\"search\"\n aria-label={label}\n enterKeyHint=\"search\"\n autoComplete=\"off\"\n {...(list.length > 0 ? listbox.inputProps : {})}\n value={value}\n placeholder={placeholder}\n className={s.input()}\n onChange={(event) => change(event.target.value)}\n onFocus={() => setOpen(true)}\n onKeyDown={(event) => {\n if (list.length > 0 && listbox.onKeyDown(event)) return;\n if (event.key === \"Enter\") {\n event.preventDefault();\n search.cancel();\n onSearch?.(value);\n onSubmit?.(value);\n setOpen(false);\n } else if (event.key === \"Escape\" && value) {\n event.preventDefault();\n change(\"\");\n }\n }}\n {...props}\n />\n {value ? (\n <button\n type=\"button\"\n aria-label={clearLabel}\n className={s.clear()}\n onClick={() => {\n change(\"\");\n input.current?.focus();\n }}\n >\n <CloseGlyph className=\"h-4 w-4\" />\n </button>\n ) : shortcut ? (\n <span className={s.shortcut()} aria-hidden>\n <Kbd size=\"sm\">{apple ? \"⌘\" : \"Ctrl\"}</Kbd>\n <Kbd size=\"sm\">{shortcut.toUpperCase()}</Kbd>\n </span>\n ) : null}\n </div>\n {list.length > 0 && (\n <div hidden={!open} className={s.list()}>\n {suggestionsLabel ? (\n <div aria-hidden className={s.group()}>\n {suggestionsLabel}\n </div>\n ) : null}\n <div id={listbox.listId} role=\"listbox\" aria-label={suggestionsLabel ?? label}>\n {list.map((suggestion, i) => (\n <div key={suggestion.value} {...listbox.optionProps(i, false)} className={s.option()}>\n <SearchGlyph className=\"h-3.5 w-3.5 shrink-0 text-fg-muted\" />\n <span className=\"min-w-0 flex-1 truncate\">{suggestion.label}</span>\n {suggestion.meta ? <span className=\"shrink-0 text-xs text-fg-secondary\">{suggestion.meta}</span> : null}\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n );\n return landmark ? <div role=\"search\">{field}</div> : field;\n}\n","// Server-safe. A key, or a shortcut of several (`<Kbd>⌘</Kbd><Kbd>K</Kbd>`).\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nexport const kbdVariants = tv({\n base:\n \"inline-flex shrink-0 items-center justify-center rounded-md border border-border-default border-b-2 bg-surface-2 \" +\n \"font-mono font-semibold text-fg-secondary\",\n variants: { size: { sm: \"h-5 min-w-5 px-1 text-[10px]\", md: \"h-6 min-w-6 px-1.5 text-xs\" } },\n defaultVariants: { size: \"md\" },\n});\n\nexport type KbdProps = React.ComponentProps<\"kbd\"> & {\n /**\n * sm · md.\n * @default \"md\"\n */\n size?: VariantProps<typeof kbdVariants>[\"size\"];\n};\n\nexport function Kbd({ size, className, ...props }: KbdProps) {\n return <kbd className={kbdVariants({ size, className })} {...props} />;\n}\n"],"mappings":"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","names":["tv","jsx","tv"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/tag-input.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Combobox
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LCZXS6AK.js";
|
|
5
5
|
import "./chunk-YH4LMWRU.js";
|
|
6
6
|
import "./chunk-ZIXB33X7.js";
|
|
7
7
|
import {
|
|
8
8
|
useControllable
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BRKMQ6JV.js";
|
|
10
10
|
import "./chunk-CPA5CF35.js";
|
|
11
11
|
|
|
12
12
|
// src/tag-input/tag-input.tsx
|
package/dist/video-player.js
CHANGED
package/dist/video-trimmer.js
CHANGED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import { ReactVirtualizer, useVirtualizer as useVirtualizer$1, useWindowVirtualizer as useWindowVirtualizer$1 } from '@tanstack/react-virtual';
|
|
3
|
+
export { VirtualItem } from '@tanstack/react-virtual';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
declare const virtual: tailwind_variants.TVReturnType<{
|
|
7
|
+
[key: string]: {
|
|
8
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
9
|
+
list?: tailwind_variants.ClassValue;
|
|
10
|
+
row?: tailwind_variants.ClassValue;
|
|
11
|
+
item?: tailwind_variants.ClassValue;
|
|
12
|
+
viewport?: tailwind_variants.ClassValue;
|
|
13
|
+
empty?: tailwind_variants.ClassValue;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
[x: string]: {
|
|
18
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
19
|
+
list?: tailwind_variants.ClassValue;
|
|
20
|
+
row?: tailwind_variants.ClassValue;
|
|
21
|
+
item?: tailwind_variants.ClassValue;
|
|
22
|
+
viewport?: tailwind_variants.ClassValue;
|
|
23
|
+
empty?: tailwind_variants.ClassValue;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
} | {}, {
|
|
27
|
+
viewport: string;
|
|
28
|
+
list: string;
|
|
29
|
+
item: string;
|
|
30
|
+
row: string;
|
|
31
|
+
empty: string;
|
|
32
|
+
}, undefined, {
|
|
33
|
+
[key: string]: {
|
|
34
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
35
|
+
list?: tailwind_variants.ClassValue;
|
|
36
|
+
row?: tailwind_variants.ClassValue;
|
|
37
|
+
item?: tailwind_variants.ClassValue;
|
|
38
|
+
viewport?: tailwind_variants.ClassValue;
|
|
39
|
+
empty?: tailwind_variants.ClassValue;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
} | {}, {
|
|
43
|
+
viewport: string;
|
|
44
|
+
list: string;
|
|
45
|
+
item: string;
|
|
46
|
+
row: string;
|
|
47
|
+
empty: string;
|
|
48
|
+
}, tailwind_variants.TVReturnTypeLike<unknown, {
|
|
49
|
+
viewport: string;
|
|
50
|
+
list: string;
|
|
51
|
+
item: string;
|
|
52
|
+
row: string;
|
|
53
|
+
empty: string;
|
|
54
|
+
}>>;
|
|
55
|
+
/** What a list or a grid can be asked to do from outside (`ref`). */
|
|
56
|
+
type VirtualHandle = {
|
|
57
|
+
/** Scrolls the item at `index` into view — smoothly, unless the person asked for less motion. */
|
|
58
|
+
scrollToIndex: (index: number, align?: "start" | "center" | "end" | "auto") => void;
|
|
59
|
+
};
|
|
60
|
+
/** The window virtualizer of TanStack Virtual (a feed that scrolls the page), re-exported through the facade. */
|
|
61
|
+
declare const useWindowVirtualizer: typeof useWindowVirtualizer$1;
|
|
62
|
+
/** The element virtualizer of TanStack Virtual (anything the components do not cover), re-exported through the facade. */
|
|
63
|
+
declare const useVirtualizer: typeof useVirtualizer$1;
|
|
64
|
+
type Virtualizer<S extends Element | Window = Element, I extends Element = Element> = ReactVirtualizer<S, I>;
|
|
65
|
+
type Size = number | ((index: number) => number);
|
|
66
|
+
type VirtualListProps<T> = {
|
|
67
|
+
/** The items, all of them: only those in view (and `overscan` around) are rendered. */
|
|
68
|
+
items: readonly T[];
|
|
69
|
+
/** Draws one item. */
|
|
70
|
+
renderItem: (item: T, index: number) => React.ReactNode;
|
|
71
|
+
/** A stable key per item (an id): keeps measurements on the right item when the list changes. Default: the index. */
|
|
72
|
+
getKey?: (item: T, index: number) => string | number;
|
|
73
|
+
/** The size of an item in px, or a guess per index; each item is then measured (dynamic sizes). */
|
|
74
|
+
estimateSize: Size;
|
|
75
|
+
/** The accessible name of the list ("Messages", "Events"), passed translated. */
|
|
76
|
+
label: string;
|
|
77
|
+
/** `self` (default): the list scrolls in its own region of `height`. `window`: the page scrolls (a feed). */
|
|
78
|
+
scroll?: "self" | "window";
|
|
79
|
+
/** The height of the scrolling region (`self`): px or any CSS length. Default 400. */
|
|
80
|
+
height?: number | string;
|
|
81
|
+
/** Items rendered beyond the visible ones, on each side. Default 6. */
|
|
82
|
+
overscan?: number;
|
|
83
|
+
/** Space between two items, in px. Default 0. */
|
|
84
|
+
gap?: number;
|
|
85
|
+
/** Called when the end comes near (load the next page): once per length of `items`. */
|
|
86
|
+
onEndReached?: () => void;
|
|
87
|
+
/** How many items before the end `onEndReached` fires. Default 5. */
|
|
88
|
+
endReachedThreshold?: number;
|
|
89
|
+
/** Shown instead of the list when there is no item. */
|
|
90
|
+
empty?: React.ReactNode;
|
|
91
|
+
/** Shown after the last item (a spinner while the next page loads). */
|
|
92
|
+
footer?: React.ReactNode;
|
|
93
|
+
/** `scrollToIndex` from outside. */
|
|
94
|
+
ref?: React.Ref<VirtualHandle>;
|
|
95
|
+
/** Classes merged on the scrolling region (`self`) or the list (`window`). */
|
|
96
|
+
className?: string;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* A long list rendered by what is in view: fixed or measured sizes, its own scrolling region or the page's, the end
|
|
100
|
+
* announced for infinite loading, items placed in the whole for assistive technology.
|
|
101
|
+
*/
|
|
102
|
+
declare function VirtualList<T>({ items, renderItem, getKey, estimateSize, label, scroll, height, overscan, gap, onEndReached, endReachedThreshold, empty, footer, ref, className, }: VirtualListProps<T>): React.JSX.Element;
|
|
103
|
+
type VirtualGridProps<T> = {
|
|
104
|
+
/** The items, all of them: only the rows in view are rendered. */
|
|
105
|
+
items: readonly T[];
|
|
106
|
+
/** Draws one cell (a card, a thumbnail). */
|
|
107
|
+
renderItem: (item: T, index: number) => React.ReactNode;
|
|
108
|
+
/** A stable key per item. Default: the index. */
|
|
109
|
+
getKey?: (item: T, index: number) => string | number;
|
|
110
|
+
/** The height of a row in px (a guess: rows are measured). */
|
|
111
|
+
estimateRowHeight: number;
|
|
112
|
+
/** The accessible name of the grid of items ("Videos"), passed translated. */
|
|
113
|
+
label: string;
|
|
114
|
+
/** A fixed number of columns. Without it, as many columns of at least `minItemWidth` as the width allows. */
|
|
115
|
+
columns?: number;
|
|
116
|
+
/** The narrowest a cell may be, in px, when `columns` is not set. Default 220. */
|
|
117
|
+
minItemWidth?: number;
|
|
118
|
+
/** The height of the scrolling region: px or any CSS length. Default 480. */
|
|
119
|
+
height?: number | string;
|
|
120
|
+
/** Space between cells, in px. Default 16. */
|
|
121
|
+
gap?: number;
|
|
122
|
+
/** Rows rendered beyond the visible ones. Default 3. */
|
|
123
|
+
overscan?: number;
|
|
124
|
+
/** Called when the last rows come near (load the next page). */
|
|
125
|
+
onEndReached?: () => void;
|
|
126
|
+
/** Shown instead of the grid when there is no item. */
|
|
127
|
+
empty?: React.ReactNode;
|
|
128
|
+
/** Shown after the last row. */
|
|
129
|
+
footer?: React.ReactNode;
|
|
130
|
+
/** `scrollToIndex` (of an item) from outside. */
|
|
131
|
+
ref?: React.Ref<VirtualHandle>;
|
|
132
|
+
/** Classes merged on the scrolling region. */
|
|
133
|
+
className?: string;
|
|
134
|
+
};
|
|
135
|
+
/** The number of columns a width holds at `minItemWidth` each (at least one). */
|
|
136
|
+
declare const columnsFor: (width: number, minItemWidth: number, gap: number) => number;
|
|
137
|
+
/** A gallery rendered by the rows in view: as many columns as the width allows (or a fixed number), measured rows. */
|
|
138
|
+
declare function VirtualGrid<T>({ items, renderItem, getKey, estimateRowHeight, label, columns: fixed, minItemWidth, height, gap, overscan, onEndReached, empty, footer, ref, className, }: VirtualGridProps<T>): React.JSX.Element;
|
|
139
|
+
|
|
140
|
+
export { VirtualGrid, type VirtualGridProps, type VirtualHandle, VirtualList, type VirtualListProps, type Virtualizer, columnsFor, useVirtualizer, useWindowVirtualizer, virtual };
|
package/dist/virtual.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
VirtualGrid,
|
|
4
|
+
VirtualList,
|
|
5
|
+
columnsFor,
|
|
6
|
+
useVirtualizer,
|
|
7
|
+
useWindowVirtualizer,
|
|
8
|
+
virtual
|
|
9
|
+
} from "./chunk-HCNOOPZE.js";
|
|
10
|
+
import "./chunk-BRKMQ6JV.js";
|
|
11
|
+
export {
|
|
12
|
+
VirtualGrid,
|
|
13
|
+
VirtualList,
|
|
14
|
+
columnsFor,
|
|
15
|
+
useVirtualizer,
|
|
16
|
+
useWindowVirtualizer,
|
|
17
|
+
virtual
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=virtual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krizaka/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "The Krizaka front-end platform's components: the primitives (button, card, dialog, toast, menu, field, tabs, chip, switch, slider, command palette, theme, countdown…) on the semantic --kz-* tokens, the animated marks (Krizaka, Orazaka, Orochia, Yazakia, Yororis) and the motion signature — web and /native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"krizaka",
|
|
@@ -25,7 +25,12 @@
|
|
|
25
25
|
"page-layout",
|
|
26
26
|
"layouts",
|
|
27
27
|
"templates",
|
|
28
|
-
"app-shell"
|
|
28
|
+
"app-shell",
|
|
29
|
+
"data-table",
|
|
30
|
+
"virtual-list",
|
|
31
|
+
"flashlist",
|
|
32
|
+
"tanstack",
|
|
33
|
+
"tanstack-intent"
|
|
29
34
|
],
|
|
30
35
|
"homepage": "https://github.com/krizaka/krizaka-ui#readme",
|
|
31
36
|
"bugs": "https://github.com/krizaka/krizaka-ui/issues",
|
|
@@ -233,10 +238,22 @@
|
|
|
233
238
|
"types": "./dist/data-table.d.ts",
|
|
234
239
|
"import": "./dist/data-table.js"
|
|
235
240
|
},
|
|
241
|
+
"./virtual": {
|
|
242
|
+
"types": "./dist/virtual.d.ts",
|
|
243
|
+
"import": "./dist/virtual.js"
|
|
244
|
+
},
|
|
236
245
|
"./filter-bar": {
|
|
237
246
|
"types": "./dist/filter-bar.d.ts",
|
|
238
247
|
"import": "./dist/filter-bar.js"
|
|
239
248
|
},
|
|
249
|
+
"./form": {
|
|
250
|
+
"types": "./dist/form.d.ts",
|
|
251
|
+
"import": "./dist/form.js"
|
|
252
|
+
},
|
|
253
|
+
"./form/server": {
|
|
254
|
+
"types": "./dist/form/server.d.ts",
|
|
255
|
+
"import": "./dist/form/server.js"
|
|
256
|
+
},
|
|
240
257
|
"./combobox": {
|
|
241
258
|
"types": "./dist/combobox.d.ts",
|
|
242
259
|
"import": "./dist/combobox.js"
|
|
@@ -469,6 +486,14 @@
|
|
|
469
486
|
"types": "./dist/native/media-capture.d.ts",
|
|
470
487
|
"import": "./dist/native/media-capture.js"
|
|
471
488
|
},
|
|
489
|
+
"./native/list": {
|
|
490
|
+
"types": "./dist/native/list.d.ts",
|
|
491
|
+
"import": "./dist/native/list.js"
|
|
492
|
+
},
|
|
493
|
+
"./native/form": {
|
|
494
|
+
"types": "./dist/native/form.d.ts",
|
|
495
|
+
"import": "./dist/native/form.js"
|
|
496
|
+
},
|
|
472
497
|
"./registry/examples/*": {
|
|
473
498
|
"types": "./registry/examples/*.d.ts",
|
|
474
499
|
"import": "./registry/examples/*.js"
|
|
@@ -483,6 +508,7 @@
|
|
|
483
508
|
"registry/examples/**/*.js",
|
|
484
509
|
"registry/examples/**/*.d.ts",
|
|
485
510
|
"registry/examples/**/*.png",
|
|
511
|
+
"skills",
|
|
486
512
|
"tailwind.css",
|
|
487
513
|
"README.md",
|
|
488
514
|
"LICENSE"
|
|
@@ -491,7 +517,9 @@
|
|
|
491
517
|
"*.css"
|
|
492
518
|
],
|
|
493
519
|
"peerDependencies": {
|
|
494
|
-
"@krizaka/
|
|
520
|
+
"@krizaka/query": ">=0.1.0",
|
|
521
|
+
"@krizaka/tailwind": ">=3.1.0",
|
|
522
|
+
"@shopify/flash-list": ">=2",
|
|
495
523
|
"expo-camera": ">=16",
|
|
496
524
|
"expo-video": ">=2",
|
|
497
525
|
"hls.js": ">=1.5",
|
|
@@ -507,6 +535,7 @@
|
|
|
507
535
|
"@jest/globals": "30.4.1",
|
|
508
536
|
"@react-native/babel-preset": "0.86.3",
|
|
509
537
|
"@react-native/jest-preset": "0.86.3",
|
|
538
|
+
"@shopify/flash-list": "2.3.3",
|
|
510
539
|
"@size-limit/preset-small-lib": "^14.2.0",
|
|
511
540
|
"@storybook/react-vite": "10.6.1",
|
|
512
541
|
"@testing-library/dom": "^10.4.0",
|
|
@@ -540,8 +569,10 @@
|
|
|
540
569
|
"tsup": "^8.5.1",
|
|
541
570
|
"typescript": "^5.9.0",
|
|
542
571
|
"vitest": "^4.1.11",
|
|
543
|
-
"
|
|
544
|
-
"@krizaka/
|
|
572
|
+
"zod": "^4.6.5",
|
|
573
|
+
"@krizaka/query": "0.1.0",
|
|
574
|
+
"@krizaka/tokens": "3.1.0",
|
|
575
|
+
"@krizaka/config": "0.2.0"
|
|
545
576
|
},
|
|
546
577
|
"engines": {
|
|
547
578
|
"node": ">=20"
|
|
@@ -550,9 +581,15 @@
|
|
|
550
581
|
"access": "public"
|
|
551
582
|
},
|
|
552
583
|
"peerDependenciesMeta": {
|
|
584
|
+
"@krizaka/query": {
|
|
585
|
+
"optional": true
|
|
586
|
+
},
|
|
553
587
|
"@krizaka/tailwind": {
|
|
554
588
|
"optional": true
|
|
555
589
|
},
|
|
590
|
+
"@shopify/flash-list": {
|
|
591
|
+
"optional": true
|
|
592
|
+
},
|
|
556
593
|
"expo-camera": {
|
|
557
594
|
"optional": true
|
|
558
595
|
},
|
|
@@ -585,7 +622,7 @@
|
|
|
585
622
|
{
|
|
586
623
|
"name": "./native (bundled into the app by Metro, never downloaded: a regression guard, not a budget)",
|
|
587
624
|
"path": "dist/native.js",
|
|
588
|
-
"limit": "
|
|
625
|
+
"limit": "21.5 kB",
|
|
589
626
|
"gzip": true
|
|
590
627
|
},
|
|
591
628
|
{
|
|
@@ -1041,9 +1078,31 @@
|
|
|
1041
1078
|
]
|
|
1042
1079
|
},
|
|
1043
1080
|
{
|
|
1044
|
-
"name": "./data-table",
|
|
1081
|
+
"name": "./data-table: DataTable (TanStack Table v9, the windowing of TanStack Virtual, Radix Checkbox, the pagination)",
|
|
1082
|
+
"path": "dist/data-table.js",
|
|
1083
|
+
"import": "{ DataTable }",
|
|
1084
|
+
"limit": "44 kB",
|
|
1085
|
+
"gzip": true,
|
|
1086
|
+
"ignore": [
|
|
1087
|
+
"tailwind-variants",
|
|
1088
|
+
"clsx"
|
|
1089
|
+
]
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
"name": "./data-table: the toolbar (FilterBar on Radix DropdownMenu, SearchField, the columns menu, the export)",
|
|
1045
1093
|
"path": "dist/data-table.js",
|
|
1046
|
-
"
|
|
1094
|
+
"import": "{ DataTableFilters, DataTableColumnsMenu, DataTableExport }",
|
|
1095
|
+
"limit": "40 kB",
|
|
1096
|
+
"gzip": true,
|
|
1097
|
+
"ignore": [
|
|
1098
|
+
"tailwind-variants",
|
|
1099
|
+
"clsx"
|
|
1100
|
+
]
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
"name": "./virtual (TanStack Virtual v3)",
|
|
1104
|
+
"path": "dist/virtual.js",
|
|
1105
|
+
"limit": "12 kB",
|
|
1047
1106
|
"gzip": true,
|
|
1048
1107
|
"ignore": [
|
|
1049
1108
|
"tailwind-variants",
|
|
@@ -1060,6 +1119,24 @@
|
|
|
1060
1119
|
"clsx"
|
|
1061
1120
|
]
|
|
1062
1121
|
},
|
|
1122
|
+
{
|
|
1123
|
+
"name": "./form (TanStack Form v1; the fields import the primitives' own entries)",
|
|
1124
|
+
"path": "dist/form.js",
|
|
1125
|
+
"limit": "24.5 kB",
|
|
1126
|
+
"gzip": true,
|
|
1127
|
+
"ignore": [
|
|
1128
|
+
"tailwind-variants",
|
|
1129
|
+
"clsx",
|
|
1130
|
+
"@krizaka/intl",
|
|
1131
|
+
"@krizaka/ui"
|
|
1132
|
+
]
|
|
1133
|
+
},
|
|
1134
|
+
{
|
|
1135
|
+
"name": "./form/server",
|
|
1136
|
+
"path": "dist/form/server.js",
|
|
1137
|
+
"limit": "1.5 kB",
|
|
1138
|
+
"gzip": true
|
|
1139
|
+
},
|
|
1063
1140
|
{
|
|
1064
1141
|
"name": "./combobox",
|
|
1065
1142
|
"path": "dist/combobox.js",
|
|
@@ -1182,6 +1259,29 @@
|
|
|
1182
1259
|
"@krizaka/ui"
|
|
1183
1260
|
]
|
|
1184
1261
|
},
|
|
1262
|
+
{
|
|
1263
|
+
"name": "./native/list (FlashList and @krizaka/query are the app's)",
|
|
1264
|
+
"path": "dist/native/list.js",
|
|
1265
|
+
"limit": "2 kB",
|
|
1266
|
+
"gzip": true,
|
|
1267
|
+
"ignore": [
|
|
1268
|
+
"@shopify/flash-list",
|
|
1269
|
+
"@krizaka/query",
|
|
1270
|
+
"@krizaka/ui",
|
|
1271
|
+
"react-native"
|
|
1272
|
+
]
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
"name": "./native/form (TanStack Form v1; the platform is the app's)",
|
|
1276
|
+
"path": "dist/native/form.js",
|
|
1277
|
+
"limit": "23 kB",
|
|
1278
|
+
"gzip": true,
|
|
1279
|
+
"ignore": [
|
|
1280
|
+
"@krizaka/ui",
|
|
1281
|
+
"@krizaka/intl",
|
|
1282
|
+
"react-native"
|
|
1283
|
+
]
|
|
1284
|
+
},
|
|
1185
1285
|
{
|
|
1186
1286
|
"name": "./page",
|
|
1187
1287
|
"path": "dist/page.js",
|
|
@@ -1640,6 +1740,9 @@
|
|
|
1640
1740
|
],
|
|
1641
1741
|
"dependencies": {
|
|
1642
1742
|
"@krizaka/intl": "^0.1.0",
|
|
1743
|
+
"@tanstack/react-form": "1.33.5",
|
|
1744
|
+
"@tanstack/react-table": "9.2.8",
|
|
1745
|
+
"@tanstack/react-virtual": "3.14.15",
|
|
1643
1746
|
"clsx": "^2.1.1",
|
|
1644
1747
|
"cmdk": "^1.1.1",
|
|
1645
1748
|
"radix-ui": "^1.7.0",
|