@keepkit/ui 0.19.0 → 0.21.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 +12 -4
- package/dist/index.d.ts +138 -7
- package/dist/index.js +1058 -326
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ function SavedArticles() {
|
|
|
60
60
|
`KeepCollection`は検索語と選択タグを`KeepActiveFiltersSummary`のチップとして表示し、個別解除と「すべての条件をクリア」を提供します。`activeFilters`でこの領域を差し替えられます。標準の`KeepList` / `KeepCollection`は、全件0件の`empty-storage`と絞り込み結果0件の`empty-filtered`を区別し、後者では`onClearFilters`付きの解除ボタンを表示します。
|
|
61
61
|
`KeepItemCard`は`href`、`onOpen`、`linkTarget`、`linkComponent`に対応し、保存アイテムから詳細ページへ遷移できます。非公開・期限切れ等の`status`を持つアイテムは自動的にリンクを無効化します。`KeepBackup`はJSONのエクスポート、merge / replaceインポート、結果件数、容量エラー表示を提供します。
|
|
62
62
|
`KeepTourBar`(alias: `KeepNavigator`)は進行度、前へ・次へ、一覧へ戻る操作をURLまたはコールバックで提供します。前後ボタンには隣接アイテム名のプレビューが付き、`getItemTitle`で表示名を差し替えられます。`keyboardShortcuts`を指定するとJ/Kまたは]/[で巡回でき、`useKeepTourShortcuts`ではキーと動作を個別に差し替えられます。`KeepReorderableList`はドラッグ操作と矢印キーによる並び替えを提供し、ドラッグ中の挿入位置を表示します。
|
|
63
|
-
`KeepShortcutHint`はセマンティックな`<kbd>`バッジを表示します。`KeepTourBar showShortcutHint`は前へ/次へのキーを、`KeepNoteEditor showShortcutHint`は`Ctrl+Enter`を標準ボタン内に表示します。`mergeProps` / `createSlot`は`asChild`でclassName、style、ARIA
|
|
63
|
+
`KeepShortcutHint`はセマンティックな`<kbd>`バッジを表示します。`KeepTourBar showShortcutHint`は前へ/次へのキーを、`KeepNoteEditor showShortcutHint`は`Ctrl+Enter`を標準ボタン内に表示します。`mergeProps` / `createSlot`は`asChild`でclassName、style、ARIA属性、イベント、子と親のrefを合成し、`composeRefs`はcallback refとobject refをまとめる共通基盤です。フィルターチップは削除後に隣接チップへ戻り、ArrowLeft / ArrowRightで移動できます。
|
|
64
64
|
`KeepList`や`KeepCollection`のカードは検索語を大文字小文字を区別せず`<mark class="keep-highlight" data-highlight="true">`で表示します。単体の`KeepItemCard`では`highlightQuery`、任意のテキストでは`KeepHighlight`を使えます。`KeepItemCard.Media`は読み込み状態を`data-media-status`で公開し、失敗時は`fallback`または標準SVGへ切り替わります。
|
|
65
65
|
テーマCSSではハイライト用の`--keep-highlight-bg` / `--keep-highlight-fg`(ライト/ダーク対応)、タイトル2行・メモプレビュー3行の制限、メディアの固定アスペクト比を適用します。`KeepItemStatusBadge`は状態ラベルに加えてチェック・時計・進入禁止・鍵のSVGアイコンを表示し、状態ごとの形状とトーンを組み合わせます。個別の状態スタイルは`@keepkit/ui/styles/status.css`からも読み込めます。
|
|
66
66
|
外部URLの詳細リンクには`target="_blank"`と`rel="noreferrer"`が既定で補完され、利用できないカードには`aria-disabled="true"`と`data-item-status`が付与されます。同期競合ダイアログではローカルとリモートの更新日時・メモを並べて確認できます。
|
|
@@ -88,7 +88,7 @@ const onFeedback = useKeepToastFeedback(toast);
|
|
|
88
88
|
<KeepKitProvider storage={storage} onFeedback={onFeedback}>{children}</KeepKitProvider>;
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
v0.
|
|
91
|
+
v0.21.0では`KeepTourBar` / `KeepNavigator`、`KeepReorderableList`、`useKeepTourShortcuts`を利用できます。`KeepCollection urlSync layout="list" | "grid" | "compact"`、`KeepBulkActions selectionScope="page" | "query" | "all"`、`KeepUndo`も利用できます。`createNextPagesRouterAdapter`はNext.js Pages Router用の注入adapterです。`locale`は16言語に対応し、`labels`で上書きできます。認証付き同期は`createAuthenticatedSyncKit`から利用できます。
|
|
92
92
|
Phase 4の状態UIとして`KeepItemStatusBadge`、`KeepStaleNotice`、`KeepPruneStaleButton`、`KeepSyncStatusBanner`、`KeepSyncRecoveryDialog`を利用できます。`import "@keepkit/ui/theme.css"`でテーマCSSを有効にできます。
|
|
93
93
|
|
|
94
94
|
### Tailwind/shadcnテーマ
|
|
@@ -179,7 +179,7 @@ function SavedArticles() {
|
|
|
179
179
|
The opt-in theme adds neutral borders, surfaces, shadows, focus treatment, and decorative action icons without changing accessible names. Target individual controls with `data-keep-action`, or override `--keep-icon-size`, `--keep-control-gap`, `--keep-shadow`, `--keep-success`, and `--keep-warning`. Consumers that omit the CSS keep the headless markup, and `KeepButton icons` continues to take precedence over the built-in icon.
|
|
180
180
|
`KeepItemCard` accepts `href`, `onOpen`, `linkTarget`, and `linkComponent` for detail-page navigation. Links are disabled for unavailable `status` values such as private or expired. `KeepBackup` provides JSON export, merge/replace import, result counts, and quota-error messaging.
|
|
181
181
|
`KeepTourBar` (aliased as `KeepNavigator`) provides progress, previous/next, and return-to-list actions through URLs or callbacks. Adjacent item titles are previewed below the navigation labels; customize them with `getItemTitle`. Set `keyboardShortcuts` for J/K or ]/[ tour navigation, or use `useKeepTourShortcuts` for custom bindings. `KeepReorderableList` supports drag and keyboard reordering and shows the active insertion position.
|
|
182
|
-
`KeepShortcutHint` renders semantic `<kbd>` badges. `KeepTourBar showShortcutHint` displays the previous/next keys, while `KeepNoteEditor showShortcutHint` displays `Ctrl+Enter` in the save button. `mergeProps` / `createSlot`
|
|
182
|
+
`KeepShortcutHint` renders semantic `<kbd>` badges. `KeepTourBar showShortcutHint` displays the previous/next keys, while `KeepNoteEditor showShortcutHint` displays `Ctrl+Enter` in the save button. `mergeProps` / `createSlot` compose className, style, ARIA, events, and child/parent refs for `asChild` slots; `composeRefs` combines callback and object refs. Filter chips restore focus to an adjacent chip after removal and support ArrowLeft / ArrowRight navigation.
|
|
183
183
|
Cards rendered by `KeepList` and `KeepCollection` highlight case-insensitive search matches with `<mark class="keep-highlight" data-highlight="true">`. Use `highlightQuery` on a standalone `KeepItemCard` or `KeepHighlight` for arbitrary text. `KeepItemCard.Media` exposes its loading state through `data-media-status` and replaces failed images with `fallback` or the built-in SVG placeholder.
|
|
184
184
|
The theme defines WCAG-oriented `--keep-highlight-bg` / `--keep-highlight-fg` pairs for light and dark modes, clamps titles to two lines and memo previews to three, and reserves a stable media aspect ratio. `KeepItemStatusBadge` combines visible status text with check, clock, ban, or lock SVG icons; import `@keepkit/ui/styles/status.css` when using the status styles independently.
|
|
185
185
|
External detail URLs receive `target="_blank"` and `rel="noreferrer"` defaults. Unavailable cards expose `aria-disabled="true"` and normalized `data-item-status` values, and the sync recovery dialog compares local and remote updated dates and notes side by side.
|
|
@@ -207,7 +207,7 @@ const onFeedback = useKeepToastFeedback(toast);
|
|
|
207
207
|
<KeepKitProvider storage={storage} onFeedback={onFeedback}>{children}</KeepKitProvider>;
|
|
208
208
|
```
|
|
209
209
|
|
|
210
|
-
In v0.
|
|
210
|
+
In v0.21.0, use `KeepTourBar` / `KeepNavigator`, `KeepReorderableList`, and `useKeepTourShortcuts` for continuous saved-item tours. `KeepCollection urlSync` with `layout="list" | "grid" | "compact"`, `KeepBulkActions selectionScope="page" | "query" | "all"`, and `KeepUndo` remain available. `createNextPagesRouterAdapter` is the injected adapter for Next.js Pages Router. `locale` includes 16 built-in dictionaries, and `labels` overrides individual entries. Authenticated sync is available through `createAuthenticatedSyncKit`.
|
|
211
211
|
Phase 4 adds `KeepItemStatusBadge`, `KeepStaleNotice`, `KeepPruneStaleButton`, `KeepSyncStatusBanner`, and `KeepSyncRecoveryDialog` for unavailable items, sync failures, conflict resolution, and backup recovery. Import `@keepkit/ui/theme.css` or `@keepkit/ui/tailwind.css` for the opt-in theme layer.
|
|
212
212
|
|
|
213
213
|
### Tailwind and shadcn theme
|
|
@@ -248,3 +248,11 @@ Use `[data-state="saved"]`, `[data-state="unsaved"]`, `[data-loading="true"]`, `
|
|
|
248
248
|
Collection queries use one canonical shape: `targetType`, `tags`, `search`, `sort`, `pagination`, `filter`, and `savedBetween`. Saved item inputs contain only `id`, `meta`, `targetType`, `note`, and `tags`; KeepKit owns persistence timestamps.
|
|
249
249
|
|
|
250
250
|
Framework-neutral APIs remain available from `@keepkit/core/core`, low-level React bindings from `@keepkit/core/react`, and storage adapters from `@keepkit/core/storage`.
|
|
251
|
+
|
|
252
|
+
## Archive, pin, collections, and quick save editing
|
|
253
|
+
|
|
254
|
+
The UI package exports `KeepArchiveButton`, `KeepPinButton`, `KeepCollectionSelect`, `KeepCollectionFilter`, `KeepSavePopover`, `KeepQuickEditor`, and `useKeepQuickEditor`. Buttons expose `aria-pressed`, `data-archived`/`data-pinned`, and `data-keep-action`. Collection labels default to IDs and can be overridden with `collectionLabels`. Enable `features={{ collectionFilter: true }}` on `KeepCollection` to include the collection filter. `KeepSavePopover` wraps `KeepButton` and opens after a new save; its quick editor debounces note, tags, and collection updates by 300ms by default.
|
|
255
|
+
|
|
256
|
+
## アーカイブ・ピン留め・コレクション・保存直後編集
|
|
257
|
+
|
|
258
|
+
UI パッケージは `KeepArchiveButton`、`KeepPinButton`、`KeepCollectionSelect`、`KeepCollectionFilter`、`KeepSavePopover`、`KeepQuickEditor`、`useKeepQuickEditor` を公開します。ボタンは `aria-pressed`、`data-archived` / `data-pinned`、`data-keep-action` を出力します。コレクション名は既定で ID を表示し、`collectionLabels` で置換できます。`KeepCollection` に `features={{ collectionFilter: true }}` を指定するとフィルターを統合できます。`KeepSavePopover` は `KeepButton` を内部 trigger とし、新規保存後に開きます。クイックエディターはメモ・タグ・コレクションを一時状態として扱い、既定 300ms で保存します。
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { KeepListQuery, KeepUrlSyncOptions, ImportItemsResult, KeepItem, KeepItemStatus, KeepSyncConflict
|
|
2
|
+
import { ButtonHTMLAttributes, ReactNode, HTMLAttributes, ComponentType, Ref, RefCallback, ReactElement, InputHTMLAttributes, FormHTMLAttributes, ImgHTMLAttributes, MouseEvent, HTMLAttributeAnchorTarget, KeyboardEvent, SelectHTMLAttributes, CSSProperties } from 'react';
|
|
3
|
+
import { KeepListQuery, KeepUrlSyncOptions, KeepItemInput, ImportItemsResult, KeepItem, KeepItemStatus, KeepSyncConflict } from '@keepkit/core/core';
|
|
4
4
|
export { AuthenticatedSyncAuthContext, AuthenticatedSyncKit, AuthenticatedSyncKitOptions, AuthenticatedSyncRequestContext, AuthenticatedSyncTransport, KeepItem, KeepItemInput, KeepListQuery, KeepScope, KeepSyncConflict, KeepSyncResolution, KeepSyncState, KeepSyncStatus, KeepUndoState, KeepUrlSyncOptions, createAuthenticatedSyncKit } from '@keepkit/core/core';
|
|
5
|
-
import { KeepButtonProps as KeepButtonProps$1, UseKeepListResult, KeepErrorBoundaryProps, UseKeepNavigatorResult, CreateKeepKitOptions as CreateKeepKitOptions$1, KeepProviderProps, useKeepContext,
|
|
5
|
+
import { useKeepItem, KeepButtonProps as KeepButtonProps$1, UseKeepListResult, KeepErrorBoundaryProps, UseKeepNavigatorResult, CreateKeepKitOptions as CreateKeepKitOptions$1, KeepProviderProps, useKeepContext, useKeepList, UseKeepNavigatorOptions, KeepShortcutOptions } from '@keepkit/core/react';
|
|
6
6
|
export { KeepButtonState, KeepContextValue, KeepErrorBoundary, KeepErrorBoundaryProps, KeepProvider, KeepProviderProps, KeepShortcutOptions, useKeepContext, useKeepItem, useKeepList, useKeepNavigator, useKeepShortcut } from '@keepkit/core/react';
|
|
7
7
|
export { FallbackStorageAdapter, IndexedDBAdapter, IndexedDBSyncQueueAdapter, LocalStorageAdapter, LocalStorageSyncQueueAdapter, SyncStorageAdapter, createBrowserStorageAdapter, createStorageAdapter } from '@keepkit/core/storage';
|
|
8
8
|
|
|
@@ -36,6 +36,27 @@ declare function createNextPagesRouterAdapter(router: KeepPagesRouterLike): Keep
|
|
|
36
36
|
/** Synchronizes collection filters with browser history and supports back/forward restoration. */
|
|
37
37
|
declare function useKeepUrlSync<TMeta = Record<string, unknown>>({ enabled, query, onQueryChange, options, adapter: providedAdapter, }: KeepUrlSyncProps<TMeta>): void;
|
|
38
38
|
|
|
39
|
+
type KeepArchiveButtonState<TMeta = Record<string, unknown>> = ReturnType<typeof useKeepItem<TMeta>>;
|
|
40
|
+
type KeepArchiveButtonProps<TMeta = Record<string, unknown>> = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "onClick" | "aria-pressed"> & {
|
|
41
|
+
item: KeepItemInput<TMeta>;
|
|
42
|
+
children?: ReactNode | ((state: KeepArchiveButtonState<TMeta>) => ReactNode);
|
|
43
|
+
archiveLabel?: ReactNode;
|
|
44
|
+
unarchiveLabel?: ReactNode;
|
|
45
|
+
onToggleError?: (error: unknown) => void;
|
|
46
|
+
};
|
|
47
|
+
/** A style-free accessible archive toggle. */
|
|
48
|
+
declare function KeepArchiveButton<TMeta = Record<string, unknown>>({ item, children, archiveLabel, unarchiveLabel, onToggleError, disabled, ...props }: KeepArchiveButtonProps<TMeta>): react.JSX.Element;
|
|
49
|
+
type KeepPinButtonState<TMeta = Record<string, unknown>> = ReturnType<typeof useKeepItem<TMeta>>;
|
|
50
|
+
type KeepPinButtonProps<TMeta = Record<string, unknown>> = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "onClick" | "aria-pressed"> & {
|
|
51
|
+
item: KeepItemInput<TMeta>;
|
|
52
|
+
children?: ReactNode | ((state: KeepPinButtonState<TMeta>) => ReactNode);
|
|
53
|
+
pinLabel?: ReactNode;
|
|
54
|
+
unpinLabel?: ReactNode;
|
|
55
|
+
onToggleError?: (error: unknown) => void;
|
|
56
|
+
};
|
|
57
|
+
/** A style-free accessible pin toggle. */
|
|
58
|
+
declare function KeepPinButton<TMeta = Record<string, unknown>>({ item, children, pinLabel, unpinLabel, onToggleError, disabled, ...props }: KeepPinButtonProps<TMeta>): react.JSX.Element;
|
|
59
|
+
|
|
39
60
|
type KeepBackupProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
40
61
|
filename?: string;
|
|
41
62
|
onExport?: (data: string) => void;
|
|
@@ -73,6 +94,8 @@ type KeepButtonIcons = {
|
|
|
73
94
|
error?: KeepButtonIcon;
|
|
74
95
|
};
|
|
75
96
|
type MergeableProps = Record<string, unknown>;
|
|
97
|
+
/** Combines callback and object refs while preserving every ref target. */
|
|
98
|
+
declare function composeRefs<T>(...refs: Array<Ref<T> | null | undefined>): RefCallback<T>;
|
|
76
99
|
/** Chains child and component event handlers while preserving both handlers' event order. */
|
|
77
100
|
declare function chainedFunction<T extends (...args: never[]) => unknown>(childHandler: T | undefined, parentHandler: T | undefined): T | undefined;
|
|
78
101
|
/** Merges slot props without dropping child classes, styles, ARIA attributes, or events. */
|
|
@@ -118,6 +141,9 @@ type KeepBulkActionsProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes
|
|
|
118
141
|
declare function KeepBulkActions<TMeta = Record<string, unknown>>({ query, selectedIds: controlledSelectedIds, defaultSelectedIds, onSelectedIdsChange, renderItem, onCompleted, selectionScope: controlledScope, onSelectionScopeChange, render, children, ...props }: KeepBulkActionsProps<TMeta>): react.JSX.Element;
|
|
119
142
|
|
|
120
143
|
type KeepButtonProps<TMeta = Record<string, unknown>> = KeepButtonProps$1<TMeta> & {
|
|
144
|
+
ref?: Ref<HTMLElement> | {
|
|
145
|
+
readonly current: unknown;
|
|
146
|
+
};
|
|
121
147
|
labels?: KeepButtonLabels;
|
|
122
148
|
icons?: KeepButtonIcons;
|
|
123
149
|
iconOnly?: boolean;
|
|
@@ -136,6 +162,65 @@ type KeepItemCheckboxProps<TMeta = Record<string, unknown>> = Omit<InputHTMLAttr
|
|
|
136
162
|
/** A reusable accessible selection checkbox for a saved item. */
|
|
137
163
|
declare function KeepItemCheckbox<TMeta = Record<string, unknown>>({ item, checked, label, onCheckedChange, "aria-label": ariaLabel, ...props }: KeepItemCheckboxProps<TMeta>): react.JSX.Element;
|
|
138
164
|
|
|
165
|
+
type KeepQuickEditorState<TMeta = Record<string, unknown>> = {
|
|
166
|
+
item: KeepItem<TMeta>;
|
|
167
|
+
note: string;
|
|
168
|
+
tags: string[];
|
|
169
|
+
collectionId?: string;
|
|
170
|
+
setNote: (value: string) => void;
|
|
171
|
+
setTags: (value: string[]) => void;
|
|
172
|
+
setCollectionId: (value?: string) => void;
|
|
173
|
+
isDirty: boolean;
|
|
174
|
+
isSaving: boolean;
|
|
175
|
+
error: unknown | null;
|
|
176
|
+
flush: () => Promise<void>;
|
|
177
|
+
};
|
|
178
|
+
declare function useKeepQuickEditor<TMeta = Record<string, unknown>>(item: KeepItem<TMeta>, options?: {
|
|
179
|
+
debounceMs?: number;
|
|
180
|
+
onSaved?: (item: KeepItem<TMeta>) => void;
|
|
181
|
+
onSaveError?: (error: unknown) => void;
|
|
182
|
+
}): {
|
|
183
|
+
state: {
|
|
184
|
+
item: KeepItem<TMeta>;
|
|
185
|
+
note: string;
|
|
186
|
+
tags: string[];
|
|
187
|
+
collectionId: string | undefined;
|
|
188
|
+
setNote: react.Dispatch<react.SetStateAction<string>>;
|
|
189
|
+
setTags: react.Dispatch<react.SetStateAction<string[]>>;
|
|
190
|
+
setCollectionId: react.Dispatch<react.SetStateAction<string | undefined>>;
|
|
191
|
+
isDirty: boolean;
|
|
192
|
+
isSaving: boolean;
|
|
193
|
+
error: unknown;
|
|
194
|
+
flush: () => Promise<void>;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
type KeepQuickEditorProps<TMeta = Record<string, unknown>> = Omit<FormHTMLAttributes<HTMLFormElement>, "children" | "onSubmit"> & {
|
|
198
|
+
item: KeepItem<TMeta>;
|
|
199
|
+
debounceMs?: number;
|
|
200
|
+
collectionIds?: string[];
|
|
201
|
+
collectionLabels?: Record<string, string>;
|
|
202
|
+
children?: ReactNode | ((state: KeepQuickEditorState<TMeta>) => ReactNode);
|
|
203
|
+
onClose?: () => void;
|
|
204
|
+
onSaved?: (item: KeepItem<TMeta>) => void;
|
|
205
|
+
onSaveError?: (error: unknown) => void;
|
|
206
|
+
};
|
|
207
|
+
/** A compact, temporary-state editor for note, tags, and collection metadata. */
|
|
208
|
+
declare function KeepQuickEditor<TMeta = Record<string, unknown>>({ item, debounceMs, collectionIds, collectionLabels, children, onClose, onSaved, onSaveError, ...props }: KeepQuickEditorProps<TMeta>): react.JSX.Element;
|
|
209
|
+
|
|
210
|
+
type KeepSavePopoverProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
211
|
+
item: KeepItemInput<TMeta>;
|
|
212
|
+
open?: boolean;
|
|
213
|
+
defaultOpen?: boolean;
|
|
214
|
+
onOpenChange?: (open: boolean) => void;
|
|
215
|
+
buttonProps?: Omit<KeepButtonProps<TMeta>, "item" | "asChild"> & {
|
|
216
|
+
asChild?: false;
|
|
217
|
+
};
|
|
218
|
+
editorProps?: Omit<KeepQuickEditorProps<TMeta>, "item" | "onClose">;
|
|
219
|
+
children?: ReactNode;
|
|
220
|
+
};
|
|
221
|
+
/** Opens a quick editor only after this trigger changes from unsaved to saved. */
|
|
222
|
+
declare function KeepSavePopover<TMeta = Record<string, unknown>>({ item, open: controlledOpen, defaultOpen, onOpenChange, buttonProps, editorProps, children, ...props }: KeepSavePopoverProps<TMeta>): react.JSX.Element;
|
|
223
|
+
|
|
139
224
|
type KeepUndoProps = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
140
225
|
children?: ReactNode;
|
|
141
226
|
label?: ReactNode;
|
|
@@ -163,6 +248,9 @@ type KeepImageProps = ImgHTMLAttributes<HTMLImageElement> & {
|
|
|
163
248
|
alt: string;
|
|
164
249
|
};
|
|
165
250
|
type KeepItemCardProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children" | "title"> & {
|
|
251
|
+
ref?: Ref<HTMLElement> | {
|
|
252
|
+
readonly current: unknown;
|
|
253
|
+
};
|
|
166
254
|
item: KeepItem<TMeta>;
|
|
167
255
|
title?: ReactNode | ((item: KeepItem<TMeta>) => ReactNode);
|
|
168
256
|
getTitle?: (item: KeepItem<TMeta>) => ReactNode;
|
|
@@ -172,6 +260,7 @@ type KeepItemCardProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HT
|
|
|
172
260
|
renderTags?: (tags: string[], item: KeepItem<TMeta>) => ReactNode;
|
|
173
261
|
showTags?: boolean;
|
|
174
262
|
showSavedAt?: boolean;
|
|
263
|
+
collectionLabels?: Record<string, string>;
|
|
175
264
|
imageAlt?: string;
|
|
176
265
|
render?: RenderProp<KeepItemCardState<TMeta>>;
|
|
177
266
|
children?: ReactNode | RenderProp<KeepItemCardState<TMeta>>;
|
|
@@ -204,7 +293,7 @@ type KeepItemCardSkeletonProps = Omit<HTMLAttributes<HTMLElement>, "children"> &
|
|
|
204
293
|
layout?: KeepLayoutPreset;
|
|
205
294
|
};
|
|
206
295
|
/** A low-dependency item presentation primitive with composable card parts. */
|
|
207
|
-
declare function KeepItemCardRoot<TMeta = Record<string, unknown>>({ item, title, getTitle, getImageProps, imageComponent: ImageComponent, renderImage, renderTags, showTags, showSavedAt, imageAlt, render, children, removeLabel, onRemoveError, onRemoved, onRetry, showSaveButton, saveButtonLabels, asChild, href: hrefOption, onOpen, linkTarget, linkComponent: LinkComponent, linkTargetAttribute, linkRel, highlightQuery, className, ...rootProps }: KeepItemCardProps<TMeta>): react.JSX.Element;
|
|
296
|
+
declare function KeepItemCardRoot<TMeta = Record<string, unknown>>({ item, title, getTitle, getImageProps, imageComponent: ImageComponent, renderImage, renderTags, showTags, showSavedAt, collectionLabels, imageAlt, render, children, removeLabel, onRemoveError, onRemoved, onRetry, showSaveButton, saveButtonLabels, asChild, href: hrefOption, onOpen, linkTarget, linkComponent: LinkComponent, linkTargetAttribute, linkRel, highlightQuery, className, ...rootProps }: KeepItemCardProps<TMeta>): react.JSX.Element;
|
|
208
297
|
declare function KeepItemCardMedia({ children, fallback, ...props }: KeepItemCardMediaProps): react.JSX.Element;
|
|
209
298
|
declare function KeepItemCardContent({ children, ...props }: KeepItemCardContentProps): react.JSX.Element;
|
|
210
299
|
declare function KeepItemCardTitle({ as, children, ...props }: KeepItemCardTitleProps): react.DetailedReactHTMLElement<{
|
|
@@ -491,18 +580,33 @@ declare function KeepItemCardTitle({ as, children, ...props }: KeepItemCardTitle
|
|
|
491
580
|
}, HTMLElement>;
|
|
492
581
|
declare function KeepItemCardTags({ children, ...props }: KeepItemCardTagsProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null;
|
|
493
582
|
declare function KeepItemCardActions({ children, ...props }: KeepItemCardActionsProps): react.JSX.Element;
|
|
583
|
+
type KeepItemCardActionSlotProps = Omit<KeepPinButtonProps<unknown>, "item" | "children"> & {
|
|
584
|
+
children?: ReactNode;
|
|
585
|
+
};
|
|
586
|
+
type KeepItemCardBadgeProps = HTMLAttributes<HTMLSpanElement>;
|
|
587
|
+
declare function KeepItemCardPin({ children, ...props }: KeepItemCardActionSlotProps): react.JSX.Element;
|
|
588
|
+
declare function KeepItemCardArchive({ children, ...props }: Omit<KeepArchiveButtonProps<unknown>, "item" | "children"> & {
|
|
589
|
+
children?: ReactNode;
|
|
590
|
+
}): react.JSX.Element;
|
|
591
|
+
declare function KeepItemCardCollectionBadge({ children, ...props }: KeepItemCardBadgeProps): react.JSX.Element | null;
|
|
494
592
|
declare const KeepItemCard: typeof KeepItemCardRoot & {
|
|
495
593
|
Media: typeof KeepItemCardMedia;
|
|
496
594
|
Content: typeof KeepItemCardContent;
|
|
497
595
|
Title: typeof KeepItemCardTitle;
|
|
498
596
|
Tags: typeof KeepItemCardTags;
|
|
499
597
|
Actions: typeof KeepItemCardActions;
|
|
598
|
+
Pin: typeof KeepItemCardPin;
|
|
599
|
+
Archive: typeof KeepItemCardArchive;
|
|
600
|
+
CollectionBadge: typeof KeepItemCardCollectionBadge;
|
|
500
601
|
};
|
|
501
602
|
/** A non-interactive placeholder that preserves the selected card layout while data loads. */
|
|
502
603
|
declare function KeepItemCardSkeleton({ layout, ...props }: KeepItemCardSkeletonProps): react.JSX.Element;
|
|
503
604
|
|
|
504
605
|
type KeepListState<TMeta = Record<string, unknown>> = UseKeepListResult<TMeta>;
|
|
505
606
|
type KeepListProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
607
|
+
ref?: Ref<HTMLElement> | {
|
|
608
|
+
readonly current: unknown;
|
|
609
|
+
};
|
|
506
610
|
query?: KeepListQuery<TMeta>;
|
|
507
611
|
children?: ReactNode | RenderProp<KeepListState<TMeta>>;
|
|
508
612
|
renderItem?: (item: KeepItem<TMeta>, state: KeepListState<TMeta>) => ReactNode;
|
|
@@ -523,7 +627,7 @@ type KeepListProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLEl
|
|
|
523
627
|
/** A list primitive with built-in loading, empty, error, and removal states. */
|
|
524
628
|
declare function KeepList<TMeta = Record<string, unknown>>(props: KeepListProps<TMeta>): react.JSX.Element;
|
|
525
629
|
|
|
526
|
-
type KeepCollectionFeature = "search" | "sort" | "pagination" | "tagFilter" | "bulkActions";
|
|
630
|
+
type KeepCollectionFeature = "search" | "sort" | "pagination" | "tagFilter" | "collectionFilter" | "bulkActions";
|
|
527
631
|
type KeepLayoutPreset = "list" | "grid" | "compact" | "auto";
|
|
528
632
|
type KeepCollectionProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
529
633
|
query?: KeepListQuery<TMeta>;
|
|
@@ -532,6 +636,7 @@ type KeepCollectionProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<
|
|
|
532
636
|
urlSync?: boolean | KeepUrlSyncOptions;
|
|
533
637
|
urlAdapter?: KeepUrlAdapter;
|
|
534
638
|
features?: Partial<Record<KeepCollectionFeature, boolean>>;
|
|
639
|
+
collectionLabels?: Record<string, string>;
|
|
535
640
|
renderItem?: (item: KeepItem<TMeta>, state: KeepListState<TMeta>) => ReactNode;
|
|
536
641
|
itemCardProps?: Omit<KeepItemCardProps<TMeta>, "item" | "children" | "render">;
|
|
537
642
|
loading?: ReactNode | RenderProp<KeepListState<TMeta>>;
|
|
@@ -627,7 +732,7 @@ type KeepTagEditorProps<TMeta = Record<string, unknown>> = Omit<FormHTMLAttribut
|
|
|
627
732
|
/** Edits one item's normalized tag set; Enter adds and Backspace removes the last tag. */
|
|
628
733
|
declare function KeepTagEditor<TMeta = Record<string, unknown>>({ item, availableTags, onSaved, onSaveError, render, ...props }: KeepTagEditorProps<TMeta>): react.JSX.Element;
|
|
629
734
|
|
|
630
|
-
type KeepUiLabelKey = "save" | "saved" | "remove" | "loading" | "saving" | "syncing" | "error" | "allTags" | "tags" | "filterTags" | "activeFilters" | "clearFilters" | "clearAllFilters" | "removeFilter" | "noFilteredItems" | "noFilteredItemsDescription" | "emptyStorageDescription" | "note" | "saveNote" | "noItems" | "loadingItems" | "errorItems" | "search" | "sort" | "newest" | "oldest" | "savedNewest" | "savedOldest" | "updatedNewest" | "updatedOldest" | "previousPage" | "nextPage" | "pagination" | "page" | "selectItems" | "selectedCount" | "deleteSelected" | "tagsToApply" | "applyTags" | "savedMessage" | "removedMessage" | "restoredMessage" | "syncFailedMessage" | "stalePrunedMessage" | "undo" | "undoAvailable" | "selectionScope" | "currentPage" | "searchResults" | "allItems" | "localVersion" | "remoteVersion" | "updatedAt" | "statusAvailable" | "noteSavedMessage" | "exportData" | "importData" | "importMode" | "merge" | "replace" | "importedCount" | "failedCount" | "storageQuotaError" | "statusExpired" | "statusRemoved" | "statusDeleted" | "statusPrivate" | "statusUnknown" | "retry" | "removeFromList" | "pruneStale" | "retrySync" | "resolveSync" | "keepLocal" | "useServer" | "manualMerge" | "close" | "backupRecovery" | "backupRecoveryDescription" | "syncPending" | "syncSynced" | "syncConflict";
|
|
735
|
+
type KeepUiLabelKey = "save" | "saved" | "remove" | "loading" | "saving" | "syncing" | "error" | "archive" | "unarchive" | "archived" | "pin" | "unpin" | "pinned" | "collection" | "allCollections" | "filterCollections" | "uncategorized" | "saveWithNote" | "allTags" | "tags" | "filterTags" | "activeFilters" | "clearFilters" | "clearAllFilters" | "removeFilter" | "noFilteredItems" | "noFilteredItemsDescription" | "emptyStorageDescription" | "note" | "saveNote" | "noItems" | "loadingItems" | "errorItems" | "search" | "sort" | "newest" | "oldest" | "savedNewest" | "savedOldest" | "updatedNewest" | "updatedOldest" | "previousPage" | "nextPage" | "pagination" | "page" | "selectItems" | "selectedCount" | "deleteSelected" | "tagsToApply" | "applyTags" | "savedMessage" | "removedMessage" | "restoredMessage" | "syncFailedMessage" | "stalePrunedMessage" | "undo" | "undoAvailable" | "selectionScope" | "currentPage" | "searchResults" | "allItems" | "localVersion" | "remoteVersion" | "updatedAt" | "statusAvailable" | "noteSavedMessage" | "exportData" | "importData" | "importMode" | "merge" | "replace" | "importedCount" | "failedCount" | "storageQuotaError" | "statusExpired" | "statusRemoved" | "statusDeleted" | "statusPrivate" | "statusUnknown" | "retry" | "removeFromList" | "pruneStale" | "retrySync" | "resolveSync" | "keepLocal" | "useServer" | "manualMerge" | "close" | "backupRecovery" | "backupRecoveryDescription" | "syncPending" | "syncSynced" | "syncConflict";
|
|
631
736
|
type KeepUiLabels = Partial<Record<KeepUiLabelKey, string>>;
|
|
632
737
|
type KeepUiLocaleLabels = Record<KeepUiLabelKey, string>;
|
|
633
738
|
|
|
@@ -715,6 +820,9 @@ type KeepTourShortcutsOptions = {
|
|
|
715
820
|
declare function useKeepTourShortcuts({ onNext, onPrev, enabled, allowInEditable, preventDefault, nextKeys, prevKeys, onError, }: KeepTourShortcutsOptions): void;
|
|
716
821
|
|
|
717
822
|
type KeepTourBarProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
823
|
+
ref?: Ref<HTMLElement> | {
|
|
824
|
+
readonly current: unknown;
|
|
825
|
+
};
|
|
718
826
|
navigation?: UseKeepNavigatorResult<TMeta>;
|
|
719
827
|
currentId?: string;
|
|
720
828
|
initialIndex?: number;
|
|
@@ -741,6 +849,9 @@ declare function KeepTourBar<TMeta = Record<string, unknown>>({ navigation: prov
|
|
|
741
849
|
declare const KeepNavigator: typeof KeepTourBar;
|
|
742
850
|
|
|
743
851
|
type KeepActiveFiltersSummaryProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
852
|
+
ref?: Ref<HTMLElement> | {
|
|
853
|
+
readonly current: unknown;
|
|
854
|
+
};
|
|
744
855
|
query?: KeepListQuery<TMeta>;
|
|
745
856
|
search?: string;
|
|
746
857
|
tags?: readonly string[];
|
|
@@ -761,6 +872,26 @@ type KeepActiveFiltersSummaryState = {
|
|
|
761
872
|
/** Lists active search and tag filters with one-tap recovery actions. */
|
|
762
873
|
declare function KeepActiveFiltersSummary<TMeta = Record<string, unknown>>({ query, search: providedSearch, tags: providedTags, onSearchChange, onTagChange, onClear, children, asChild, className, ...rootProps }: KeepActiveFiltersSummaryProps<TMeta>): ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
|
|
763
874
|
|
|
875
|
+
type KeepCollectionOption = {
|
|
876
|
+
id?: string;
|
|
877
|
+
label: string;
|
|
878
|
+
};
|
|
879
|
+
type KeepCollectionControlProps = Omit<SelectHTMLAttributes<HTMLSelectElement>, "value" | "defaultValue" | "onChange"> & {
|
|
880
|
+
value?: string;
|
|
881
|
+
defaultValue?: string;
|
|
882
|
+
onValueChange?: (collectionId?: string) => void;
|
|
883
|
+
onChange?: (collectionId?: string) => void;
|
|
884
|
+
collectionLabels?: Record<string, string>;
|
|
885
|
+
allLabel?: string;
|
|
886
|
+
uncategorizedLabel?: string;
|
|
887
|
+
};
|
|
888
|
+
/** A select that moves one item between derived collections. */
|
|
889
|
+
declare function KeepCollectionSelect<TMeta = Record<string, unknown>>({ item, value, defaultValue, onValueChange, onChange, collectionLabels, uncategorizedLabel, ...props }: KeepCollectionControlProps & {
|
|
890
|
+
item: KeepItem<TMeta>;
|
|
891
|
+
}): react.JSX.Element;
|
|
892
|
+
/** A select filter for the collections derived from current items. */
|
|
893
|
+
declare function KeepCollectionFilter<TMeta = Record<string, unknown>>({ value, defaultValue, onValueChange, onChange, collectionLabels, allLabel, uncategorizedLabel, ...props }: KeepCollectionControlProps): react.JSX.Element;
|
|
894
|
+
|
|
764
895
|
type KeepTagFilterState = {
|
|
765
896
|
tags: string[];
|
|
766
897
|
tagCounts: Record<string, number>;
|
|
@@ -960,4 +1091,4 @@ type KeepKit<TMeta = Record<string, unknown>> = {
|
|
|
960
1091
|
/** Create one typed application API for the core and standard UI layer. */
|
|
961
1092
|
declare function createKeepKit<TMeta = Record<string, unknown>>(options?: CreateKeepKitOptions<TMeta>): KeepKit<TMeta>;
|
|
962
1093
|
|
|
963
|
-
export { type CreateKeepKitOptions, KeepActiveFiltersSummary, type KeepActiveFiltersSummaryProps, type KeepActiveFiltersSummaryState, KeepAnnouncements, type KeepAnnouncementsProps, KeepAnnouncer, KeepBackup, type KeepBackupProps, KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState, KeepButton, type KeepButtonIcon, type KeepButtonIconProps, type KeepButtonIcons, type KeepButtonLabels, type KeepButtonProps, KeepCollection, type KeepCollectionFeature, type KeepCollectionProps, type KeepDisplayStatus, KeepEmptyState, type KeepEmptyStateProps, type KeepEmptyStateVariant, KeepHighlight, type KeepHighlightProps, type KeepImageProps, KeepItemCard, type KeepItemCardActionsProps, type KeepItemCardContentProps, type KeepItemCardLinkProps, type KeepItemCardMediaProps, type KeepItemCardProps, KeepItemCardSkeleton, type KeepItemCardSkeletonProps, type KeepItemCardState, type KeepItemCardTagsProps, type KeepItemCardTitleProps, KeepItemCheckbox, type KeepItemCheckboxProps, KeepItemStatusBadge, type KeepItemStatusBadgeProps, type KeepKit, KeepKitProvider, type KeepKitProviderProps, KeepLayout, type KeepLayoutPreset, type KeepLayoutProps, KeepList, type KeepListProps, type KeepListState, KeepNavigator, KeepNoteEditor, type KeepNoteEditorProps, type KeepNoteEditorState, type KeepPagesRouterLike, KeepPagination, type KeepPaginationProps, type KeepPaginationState, KeepPruneStaleButton, type KeepPruneStaleButtonProps, type KeepReorderableItemState, KeepReorderableList, type KeepReorderableListProps, KeepSearchInput, type KeepSearchInputProps, type KeepSelectionScope, KeepShortcutHint, type KeepShortcutHintProps, KeepSortSelect, type KeepSortSelectProps, type KeepSortValue, KeepStaleNotice, type KeepStaleNoticeProps, KeepStatus, type KeepStatusLabels, type KeepStatusProps, type KeepStatusState, type KeepStatusValue, KeepSyncRecoveryDialog, type KeepSyncRecoveryDialogProps, KeepSyncStatusBanner, type KeepSyncStatusBannerProps, KeepTagEditor, type KeepTagEditorProps, type KeepTagEditorState, KeepTagFilter, type KeepTagFilterProps, type KeepTagFilterState, type KeepThemeDensity, type KeepThemeMode, type KeepThemeName, KeepThemeProvider, type KeepThemeProviderProps, type KeepThemeRadius, type KeepThemeVariables, type KeepToastFeedbackOptions, type KeepToastHandler, KeepTourBar, type KeepTourBarProps, type KeepTourShortcutsOptions, type KeepUiFeedbackEvent, type KeepUiLabelContext, type KeepUiLabelKey, type KeepUiLabels, type KeepUiLocale, type KeepUiLocaleLabels, KeepUiProvider, type KeepUiProviderProps, KeepUndo, type KeepUndoProps, type KeepUrlAdapter, type RenderProp, chainedFunction, createKeepKit, createNextPagesRouterAdapter, createSlot, getKeepLocaleLabels, highlightText, isAllSelected, keepThemeNames, mergeProps, toggleSelectAll, useKeepToastFeedback, useKeepTourShortcuts, useKeepUiLabels, useKeepUrlSync };
|
|
1094
|
+
export { type CreateKeepKitOptions, KeepActiveFiltersSummary, type KeepActiveFiltersSummaryProps, type KeepActiveFiltersSummaryState, KeepAnnouncements, type KeepAnnouncementsProps, KeepAnnouncer, KeepArchiveButton, type KeepArchiveButtonProps, type KeepArchiveButtonState, KeepBackup, type KeepBackupProps, KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState, KeepButton, type KeepButtonIcon, type KeepButtonIconProps, type KeepButtonIcons, type KeepButtonLabels, type KeepButtonProps, KeepCollection, type KeepCollectionControlProps, type KeepCollectionFeature, KeepCollectionFilter, type KeepCollectionOption, type KeepCollectionProps, KeepCollectionSelect, type KeepDisplayStatus, KeepEmptyState, type KeepEmptyStateProps, type KeepEmptyStateVariant, KeepHighlight, type KeepHighlightProps, type KeepImageProps, KeepItemCard, type KeepItemCardActionSlotProps, type KeepItemCardActionsProps, type KeepItemCardBadgeProps, type KeepItemCardContentProps, type KeepItemCardLinkProps, type KeepItemCardMediaProps, type KeepItemCardProps, KeepItemCardSkeleton, type KeepItemCardSkeletonProps, type KeepItemCardState, type KeepItemCardTagsProps, type KeepItemCardTitleProps, KeepItemCheckbox, type KeepItemCheckboxProps, KeepItemStatusBadge, type KeepItemStatusBadgeProps, type KeepKit, KeepKitProvider, type KeepKitProviderProps, KeepLayout, type KeepLayoutPreset, type KeepLayoutProps, KeepList, type KeepListProps, type KeepListState, KeepNavigator, KeepNoteEditor, type KeepNoteEditorProps, type KeepNoteEditorState, type KeepPagesRouterLike, KeepPagination, type KeepPaginationProps, type KeepPaginationState, KeepPinButton, type KeepPinButtonProps, type KeepPinButtonState, KeepPruneStaleButton, type KeepPruneStaleButtonProps, KeepQuickEditor, type KeepQuickEditorProps, type KeepQuickEditorState, type KeepReorderableItemState, KeepReorderableList, type KeepReorderableListProps, KeepSavePopover, type KeepSavePopoverProps, KeepSearchInput, type KeepSearchInputProps, type KeepSelectionScope, KeepShortcutHint, type KeepShortcutHintProps, KeepSortSelect, type KeepSortSelectProps, type KeepSortValue, KeepStaleNotice, type KeepStaleNoticeProps, KeepStatus, type KeepStatusLabels, type KeepStatusProps, type KeepStatusState, type KeepStatusValue, KeepSyncRecoveryDialog, type KeepSyncRecoveryDialogProps, KeepSyncStatusBanner, type KeepSyncStatusBannerProps, KeepTagEditor, type KeepTagEditorProps, type KeepTagEditorState, KeepTagFilter, type KeepTagFilterProps, type KeepTagFilterState, type KeepThemeDensity, type KeepThemeMode, type KeepThemeName, KeepThemeProvider, type KeepThemeProviderProps, type KeepThemeRadius, type KeepThemeVariables, type KeepToastFeedbackOptions, type KeepToastHandler, KeepTourBar, type KeepTourBarProps, type KeepTourShortcutsOptions, type KeepUiFeedbackEvent, type KeepUiLabelContext, type KeepUiLabelKey, type KeepUiLabels, type KeepUiLocale, type KeepUiLocaleLabels, KeepUiProvider, type KeepUiProviderProps, KeepUndo, type KeepUndoProps, type KeepUrlAdapter, type RenderProp, chainedFunction, composeRefs, createKeepKit, createNextPagesRouterAdapter, createSlot, getKeepLocaleLabels, highlightText, isAllSelected, keepThemeNames, mergeProps, toggleSelectAll, useKeepQuickEditor, useKeepToastFeedback, useKeepTourShortcuts, useKeepUiLabels, useKeepUrlSync };
|