@keepkit/ui 0.10.0 → 0.12.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 +6 -0
- package/dist/index.d.ts +119 -8
- package/dist/index.js +1738 -119
- package/dist/index.js.map +1 -1
- package/dist/theme.css +134 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -57,6 +57,9 @@ function SavedArticles() {
|
|
|
57
57
|
`keep.Collection`は検索、ソート、ページング、loading / empty / error、ARIA live通知を標準で提供します。検索は既定で300msデバウンスされます。`features={{ tagFilter: true, bulkActions: true }}`でタグフィルターと一括操作も有効にできます。個別の`KeepList`、`KeepSearchInput`、`KeepSortSelect`、`KeepPagination`、`KeepItemCheckbox`、`KeepTagEditor`などは高度なレイアウト用に利用できます。`KeepBulkActions`はrender propsで操作UIを差し替えられ、`isAllSelected` / `toggleSelectAll`で表示中アイテムを一括操作できます。`KeepNoteEditor`は既定300msのデバウンス保存に対応し、`debounceMs={0}`でフォーム送信のみへ戻せます。通知領域だけを明示的に置く場合は`KeepAnnouncer`(`KeepAnnouncements`のalias)を使えます。
|
|
58
58
|
`KeepItemCard`は`href`、`onOpen`、`linkTarget`、`linkComponent`に対応し、保存アイテムから詳細ページへ遷移できます。非公開・期限切れ等の`status`を持つアイテムは自動的にリンクを無効化します。`KeepBackup`はJSONのエクスポート、merge / replaceインポート、結果件数、容量エラー表示を提供します。
|
|
59
59
|
|
|
60
|
+
v0.12.0では`KeepCollection urlSync layout="list" | "grid" | "compact"`、`KeepBulkActions selectionScope="page" | "query" | "all"`、`KeepUndo`を利用できます。`createNextPagesRouterAdapter`はNext.js Pages Router用の注入adapterです。`locale`は英語、日本語、韓国語、中国語簡体字・繁体字、タイ語、フランス語、スペイン語、ポルトガル語、イタリア語、ドイツ語、ロシア語、フィリピン語、ベトナム語、インドネシア語、マレー語の16言語に対応し、`labels`で上書きできます。認証付き同期は`createAuthenticatedSyncKit`から利用できます。
|
|
61
|
+
Phase 4の状態UIとして`KeepItemStatusBadge`、`KeepStaleNotice`、`KeepPruneStaleButton`、`KeepSyncStatusBanner`、`KeepSyncRecoveryDialog`を利用できます。任意で`import "@keepkit/ui/theme.css"`を追加すると、CSS変数による軽量テーマ、ダークモード、モバイル向け文字サイズが適用されます。
|
|
62
|
+
|
|
60
63
|
一覧のqueryは次の形式に統一されています。
|
|
61
64
|
|
|
62
65
|
```tsx
|
|
@@ -107,6 +110,9 @@ function SavedArticles() {
|
|
|
107
110
|
`keep.Collection` includes search, sorting, pagination, loading/empty/error states, and polite live announcements. Search is debounced by 300ms by default. Enable `features={{ tagFilter: true, bulkActions: true }}` for tag filtering and bulk operations. Use the individual `KeepList`, `KeepSearchInput`, `KeepSortSelect`, `KeepPagination`, `KeepItemCheckbox`, and `KeepTagEditor` primitives when you need a custom layout. `KeepBulkActions` supports render props and exposes `isAllSelected` / `toggleSelectAll` for visible-item selection. `KeepNoteEditor` auto-saves dirty notes after 300ms by default; set `debounceMs={0}` to use form submission only. Mount `KeepAnnouncer` (`KeepAnnouncements` alias) when you need the live region explicitly.
|
|
108
111
|
`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.
|
|
109
112
|
|
|
113
|
+
In v0.12.0, use `KeepCollection urlSync` with `layout="list" | "grid" | "compact"`, `KeepBulkActions selectionScope="page" | "query" | "all"`, and `KeepUndo`. `createNextPagesRouterAdapter` is the injected adapter for Next.js Pages Router. `locale` includes complete dictionaries for 16 built-in locales; `labels` overrides individual entries. Authenticated sync is available through `createAuthenticatedSyncKit`.
|
|
114
|
+
Phase 4 adds `KeepItemStatusBadge`, `KeepStaleNotice`, `KeepPruneStaleButton`, `KeepSyncStatusBanner`, and `KeepSyncRecoveryDialog` for unavailable items, sync failures, conflict resolution, and backup recovery. Optionally import `@keepkit/ui/theme.css` for a lightweight CSS-variable theme with dark-mode and mobile typography support.
|
|
115
|
+
|
|
110
116
|
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.
|
|
111
117
|
|
|
112
118
|
Framework-neutral APIs remain available from `@keepkit/core/core`, low-level React bindings from `@keepkit/core/react`, and storage adapters from `@keepkit/core/storage`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { HTMLAttributes, ReactNode, ImgHTMLAttributes, ComponentType, MouseEvent, HTMLAttributeAnchorTarget, InputHTMLAttributes, FormHTMLAttributes, SelectHTMLAttributes } from 'react';
|
|
3
|
-
import { ImportItemsResult, KeepListQuery, KeepItem, KeepItemInput } from '@keepkit/core/core';
|
|
4
|
-
export { KeepItem, KeepItemInput, KeepListQuery, KeepSyncStatus } from '@keepkit/core/core';
|
|
2
|
+
import { HTMLAttributes, ReactNode, ImgHTMLAttributes, ComponentType, MouseEvent, HTMLAttributeAnchorTarget, InputHTMLAttributes, FormHTMLAttributes, ButtonHTMLAttributes, SelectHTMLAttributes } from 'react';
|
|
3
|
+
import { ImportItemsResult, KeepListQuery, KeepItem, KeepUrlSyncOptions, KeepItemStatus, KeepSyncConflict, KeepItemInput } from '@keepkit/core/core';
|
|
4
|
+
export { AuthenticatedSyncAuthContext, AuthenticatedSyncKit, AuthenticatedSyncKitOptions, AuthenticatedSyncRequestContext, AuthenticatedSyncTransport, KeepItem, KeepItemInput, KeepListQuery, KeepScope, KeepSyncConflict, KeepSyncResolution, KeepSyncState, KeepSyncStatus, KeepUndoState, KeepUrlSyncOptions, createAuthenticatedSyncKit } from '@keepkit/core/core';
|
|
5
5
|
import { KeepButtonProps as KeepButtonProps$1, UseKeepListResult, KeepErrorBoundaryProps, CreateKeepKitOptions as CreateKeepKitOptions$1, KeepProviderProps, useKeepContext, useKeepItem, useKeepList, KeepShortcutOptions } from '@keepkit/core/react';
|
|
6
6
|
export { KeepButtonState, KeepContextValue, KeepErrorBoundary, KeepErrorBoundaryProps, KeepProvider, KeepProviderProps, KeepShortcutOptions, useKeepContext, useKeepItem, useKeepList, useKeepShortcut } from '@keepkit/core/react';
|
|
7
7
|
export { FallbackStorageAdapter, IndexedDBAdapter, IndexedDBSyncQueueAdapter, LocalStorageAdapter, LocalStorageSyncQueueAdapter, SyncStorageAdapter, createBrowserStorageAdapter, createStorageAdapter } from '@keepkit/core/storage';
|
|
@@ -38,7 +38,10 @@ type KeepBulkActionsState<TMeta = Record<string, unknown>> = {
|
|
|
38
38
|
remove: () => Promise<void>;
|
|
39
39
|
updateTags: () => Promise<void>;
|
|
40
40
|
isMutating: boolean;
|
|
41
|
+
selectionScope: KeepSelectionScope;
|
|
42
|
+
setSelectionScope: (scope: KeepSelectionScope) => void;
|
|
41
43
|
};
|
|
44
|
+
type KeepSelectionScope = "page" | "query" | "all";
|
|
42
45
|
/** Returns whether every visible item is selected. Empty lists are never all selected. */
|
|
43
46
|
declare function isAllSelected<TMeta>(items: readonly Pick<KeepItem<TMeta>, "id">[], selectedIds: readonly string[]): boolean;
|
|
44
47
|
/** Toggles only the visible items, preserving selections outside the current query or page. */
|
|
@@ -50,11 +53,13 @@ type KeepBulkActionsProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes
|
|
|
50
53
|
onSelectedIdsChange?: (ids: string[]) => void;
|
|
51
54
|
renderItem?: (item: KeepItem<TMeta>, selected: boolean) => ReactNode;
|
|
52
55
|
onCompleted?: (action: "remove" | "tags", ids: string[]) => void;
|
|
56
|
+
selectionScope?: KeepSelectionScope;
|
|
57
|
+
onSelectionScopeChange?: (scope: KeepSelectionScope) => void;
|
|
53
58
|
render?: RenderProp<KeepBulkActionsState<TMeta>>;
|
|
54
59
|
children?: ReactNode | RenderProp<KeepBulkActionsState<TMeta>>;
|
|
55
60
|
};
|
|
56
61
|
/** Selects visible items and performs one storage operation for the whole selection. */
|
|
57
|
-
declare function KeepBulkActions<TMeta = Record<string, unknown>>({ query, selectedIds: controlledSelectedIds, defaultSelectedIds, onSelectedIdsChange, renderItem, onCompleted, render, children, ...props }: KeepBulkActionsProps<TMeta>): react.JSX.Element;
|
|
62
|
+
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;
|
|
58
63
|
|
|
59
64
|
type KeepButtonProps<TMeta = Record<string, unknown>> = KeepButtonProps$1<TMeta> & {
|
|
60
65
|
labels?: KeepButtonLabels;
|
|
@@ -88,12 +93,15 @@ type KeepItemCardProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HT
|
|
|
88
93
|
getImageProps?: (item: KeepItem<TMeta>, title: ReactNode) => KeepImageProps | undefined;
|
|
89
94
|
imageComponent?: ComponentType<KeepImageProps>;
|
|
90
95
|
renderImage?: (props: KeepImageProps, item: KeepItem<TMeta>) => ReactNode;
|
|
96
|
+
renderTags?: (tags: string[], item: KeepItem<TMeta>) => ReactNode;
|
|
97
|
+
showTags?: boolean;
|
|
91
98
|
imageAlt?: string;
|
|
92
99
|
render?: RenderProp<KeepItemCardState<TMeta>>;
|
|
93
100
|
children?: ReactNode | RenderProp<KeepItemCardState<TMeta>>;
|
|
94
101
|
removeLabel?: string;
|
|
95
102
|
onRemoveError?: (error: unknown) => void;
|
|
96
103
|
onRemoved?: (item: KeepItem<TMeta>) => void;
|
|
104
|
+
onRetry?: (item: KeepItem<TMeta>) => void | Promise<void>;
|
|
97
105
|
showSaveButton?: boolean;
|
|
98
106
|
saveButtonLabels?: KeepButtonLabels;
|
|
99
107
|
asChild?: boolean;
|
|
@@ -105,7 +113,7 @@ type KeepItemCardProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HT
|
|
|
105
113
|
linkRel?: string;
|
|
106
114
|
};
|
|
107
115
|
/** A low-dependency item presentation primitive. The default markup can be replaced with render props. */
|
|
108
|
-
declare function KeepItemCard<TMeta = Record<string, unknown>>({ item, title, getTitle, getImageProps, imageComponent: ImageComponent, renderImage, imageAlt, render, children, removeLabel, onRemoveError, onRemoved, showSaveButton, saveButtonLabels, asChild, href: hrefOption, onOpen, linkTarget, linkComponent: LinkComponent, linkTargetAttribute, linkRel, className, ...rootProps }: KeepItemCardProps<TMeta>): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
116
|
+
declare function KeepItemCard<TMeta = Record<string, unknown>>({ item, title, getTitle, getImageProps, imageComponent: ImageComponent, renderImage, renderTags, showTags, imageAlt, render, children, removeLabel, onRemoveError, onRemoved, onRetry, showSaveButton, saveButtonLabels, asChild, href: hrefOption, onOpen, linkTarget, linkComponent: LinkComponent, linkTargetAttribute, linkRel, className, ...rootProps }: KeepItemCardProps<TMeta>): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
109
117
|
|
|
110
118
|
type KeepListState<TMeta = Record<string, unknown>> = UseKeepListResult<TMeta>;
|
|
111
119
|
type KeepListProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
@@ -116,6 +124,7 @@ type KeepListProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLEl
|
|
|
116
124
|
empty?: ReactNode | RenderProp<KeepListState<TMeta>>;
|
|
117
125
|
error?: ReactNode | RenderProp<KeepListState<TMeta>>;
|
|
118
126
|
itemCardProps?: Omit<KeepItemCardProps<TMeta>, "item" | "children" | "render">;
|
|
127
|
+
layout?: KeepLayoutPreset;
|
|
119
128
|
asChild?: boolean;
|
|
120
129
|
fallback?: KeepErrorBoundaryProps["fallback"];
|
|
121
130
|
onBoundaryError?: KeepErrorBoundaryProps["onError"];
|
|
@@ -124,10 +133,44 @@ type KeepListProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLEl
|
|
|
124
133
|
/** A list primitive with built-in loading, empty, error, and removal states. */
|
|
125
134
|
declare function KeepList<TMeta = Record<string, unknown>>(props: KeepListProps<TMeta>): react.JSX.Element;
|
|
126
135
|
|
|
136
|
+
type KeepUrlAdapter = {
|
|
137
|
+
getUrl: () => string;
|
|
138
|
+
subscribe?: (listener: () => void) => () => void;
|
|
139
|
+
navigate: (url: string, mode: "replace" | "push") => void;
|
|
140
|
+
};
|
|
141
|
+
type KeepPagesRouterLike = {
|
|
142
|
+
asPath?: string;
|
|
143
|
+
push: (url: string, as?: string, options?: {
|
|
144
|
+
shallow?: boolean;
|
|
145
|
+
}) => Promise<boolean> | boolean;
|
|
146
|
+
replace: (url: string, as?: string, options?: {
|
|
147
|
+
shallow?: boolean;
|
|
148
|
+
}) => Promise<boolean> | boolean;
|
|
149
|
+
events?: {
|
|
150
|
+
on: (event: string, listener: () => void) => void;
|
|
151
|
+
off: (event: string, listener: () => void) => void;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
type KeepUrlSyncProps<TMeta = Record<string, unknown>> = {
|
|
155
|
+
enabled?: boolean;
|
|
156
|
+
query: KeepListQuery<TMeta>;
|
|
157
|
+
onQueryChange: (query: KeepListQuery<TMeta> | ((previous: KeepListQuery<TMeta>) => KeepListQuery<TMeta>)) => void;
|
|
158
|
+
options?: KeepUrlSyncOptions;
|
|
159
|
+
adapter?: KeepUrlAdapter;
|
|
160
|
+
};
|
|
161
|
+
/** Adapter for Next.js Pages Router. It intentionally uses structural typing and has no Next dependency. */
|
|
162
|
+
declare function createNextPagesRouterAdapter(router: KeepPagesRouterLike): KeepUrlAdapter;
|
|
163
|
+
/** Synchronizes collection filters with browser history and supports back/forward restoration. */
|
|
164
|
+
declare function useKeepUrlSync<TMeta = Record<string, unknown>>({ enabled, query, onQueryChange, options, adapter: providedAdapter, }: KeepUrlSyncProps<TMeta>): void;
|
|
165
|
+
|
|
127
166
|
type KeepCollectionFeature = "search" | "sort" | "pagination" | "tagFilter" | "bulkActions";
|
|
167
|
+
type KeepLayoutPreset = "list" | "grid" | "compact";
|
|
128
168
|
type KeepCollectionProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
129
169
|
query?: KeepListQuery<TMeta>;
|
|
130
170
|
pageSize?: number;
|
|
171
|
+
layout?: KeepLayoutPreset;
|
|
172
|
+
urlSync?: boolean | KeepUrlSyncOptions;
|
|
173
|
+
urlAdapter?: KeepUrlAdapter;
|
|
131
174
|
features?: Partial<Record<KeepCollectionFeature, boolean>>;
|
|
132
175
|
renderItem?: (item: KeepItem<TMeta>, state: KeepListState<TMeta>) => ReactNode;
|
|
133
176
|
itemCardProps?: Omit<KeepItemCardProps<TMeta>, "item" | "children" | "render">;
|
|
@@ -150,6 +193,20 @@ type KeepItemCheckboxProps<TMeta = Record<string, unknown>> = Omit<InputHTMLAttr
|
|
|
150
193
|
/** A reusable accessible selection checkbox for a saved item. */
|
|
151
194
|
declare function KeepItemCheckbox<TMeta = Record<string, unknown>>({ item, checked, label, onCheckedChange, "aria-label": ariaLabel, ...props }: KeepItemCheckboxProps<TMeta>): react.JSX.Element;
|
|
152
195
|
|
|
196
|
+
type KeepItemStatusBadgeProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
|
|
197
|
+
status?: KeepItemStatus;
|
|
198
|
+
label?: ReactNode;
|
|
199
|
+
};
|
|
200
|
+
/** Displays the normalized availability state of a saved item. */
|
|
201
|
+
declare function KeepItemStatusBadge({ status, label, className, ...props }: KeepItemStatusBadgeProps): react.JSX.Element;
|
|
202
|
+
|
|
203
|
+
type KeepLayoutProps = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
204
|
+
layout?: KeepLayoutPreset;
|
|
205
|
+
children?: ReactNode;
|
|
206
|
+
};
|
|
207
|
+
/** A CSS-free layout wrapper with responsive grid presets and data attributes for host styling. */
|
|
208
|
+
declare function KeepLayout({ layout, children, style, ...props }: KeepLayoutProps): react.JSX.Element;
|
|
209
|
+
|
|
153
210
|
type KeepNoteEditorState<TMeta = Record<string, unknown>> = {
|
|
154
211
|
item: KeepItem<TMeta>;
|
|
155
212
|
note: string;
|
|
@@ -175,6 +232,46 @@ type KeepNoteEditorProps<TMeta = Record<string, unknown>> = Omit<FormHTMLAttribu
|
|
|
175
232
|
/** A controlled-by-default note editor that persists through useKeepItem. */
|
|
176
233
|
declare function KeepNoteEditor<TMeta = Record<string, unknown>>({ item, label, saveLabel, placeholder, debounceMs, onSaved, onSaveError, render, children, asChild, className, ...formProps }: KeepNoteEditorProps<TMeta>): react.JSX.Element;
|
|
177
234
|
|
|
235
|
+
type KeepStaleNoticeProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
236
|
+
item: KeepItem<TMeta>;
|
|
237
|
+
onRetry?: (item: KeepItem<TMeta>) => void | Promise<void>;
|
|
238
|
+
onRemoved?: (item: KeepItem<TMeta>) => void;
|
|
239
|
+
retryLabel?: ReactNode;
|
|
240
|
+
removeLabel?: ReactNode;
|
|
241
|
+
children?: ReactNode;
|
|
242
|
+
};
|
|
243
|
+
/** Provides retry and remove actions for an item whose source is no longer available. */
|
|
244
|
+
declare function KeepStaleNotice<TMeta = Record<string, unknown>>({ item, onRetry, onRemoved, retryLabel, removeLabel, children, className, ...props }: KeepStaleNoticeProps<TMeta>): react.JSX.Element;
|
|
245
|
+
type KeepPruneStaleButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
246
|
+
statuses?: KeepItemStatus[];
|
|
247
|
+
label?: ReactNode;
|
|
248
|
+
onPruned?: (ids: string[]) => void;
|
|
249
|
+
children?: ReactNode;
|
|
250
|
+
};
|
|
251
|
+
/** Removes all unavailable items through the provider's undo-capable batch action. */
|
|
252
|
+
declare function KeepPruneStaleButton<TMeta = Record<string, unknown>>({ statuses, label, onPruned, children, disabled, ...props }: KeepPruneStaleButtonProps): react.JSX.Element;
|
|
253
|
+
|
|
254
|
+
type KeepSyncRecoveryDialogProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children" | "title"> & {
|
|
255
|
+
open?: boolean;
|
|
256
|
+
onOpenChange?: (open: boolean) => void;
|
|
257
|
+
conflicts?: KeepSyncConflict<TMeta>[];
|
|
258
|
+
onManualMerge?: (conflict: KeepSyncConflict<TMeta>) => KeepItem<TMeta> | Promise<KeepItem<TMeta>>;
|
|
259
|
+
backup?: ReactNode;
|
|
260
|
+
showBackupControls?: boolean;
|
|
261
|
+
title?: ReactNode;
|
|
262
|
+
children?: ReactNode;
|
|
263
|
+
};
|
|
264
|
+
/** Resolves queued sync conflicts and guides users to restore a backup after data corruption. */
|
|
265
|
+
declare function KeepSyncRecoveryDialog<TMeta = Record<string, unknown>>({ open, onOpenChange, conflicts, onManualMerge, backup, showBackupControls, title, children, className, ...props }: KeepSyncRecoveryDialogProps<TMeta>): react.JSX.Element | null;
|
|
266
|
+
|
|
267
|
+
type KeepSyncStatusBannerProps = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
268
|
+
onRetry?: () => void | Promise<void>;
|
|
269
|
+
onResolveConflicts?: () => void;
|
|
270
|
+
children?: ReactNode;
|
|
271
|
+
};
|
|
272
|
+
/** Announces synchronization failures and exposes retry or conflict-recovery entry points. */
|
|
273
|
+
declare function KeepSyncStatusBanner({ onRetry, onResolveConflicts, children, className, ...props }: KeepSyncStatusBannerProps): react.JSX.Element | null;
|
|
274
|
+
|
|
178
275
|
type KeepTagEditorState = {
|
|
179
276
|
tags: string[];
|
|
180
277
|
setTags: (tags: string[]) => void;
|
|
@@ -213,6 +310,13 @@ type KeepTagFilterProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<H
|
|
|
213
310
|
/** An ARIA button group for tag filtering; consumers can connect value to a collection query. */
|
|
214
311
|
declare function KeepTagFilter<TMeta = Record<string, unknown>>({ query, value: controlledValue, defaultValue, onChange, onValueChange, allLabel, ariaLabel, renderTag, render, children, asChild, className, ...rootProps }: KeepTagFilterProps<TMeta>): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
215
312
|
|
|
313
|
+
type KeepUndoProps = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
314
|
+
children?: ReactNode;
|
|
315
|
+
label?: ReactNode;
|
|
316
|
+
};
|
|
317
|
+
/** Presents the short-lived undo action created by removeWithUndo/removeBatchWithUndo. */
|
|
318
|
+
declare function KeepUndo({ children, label, ...props }: KeepUndoProps): react.JSX.Element | null;
|
|
319
|
+
|
|
216
320
|
type KeepSearchInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange"> & {
|
|
217
321
|
value?: string;
|
|
218
322
|
defaultValue?: string;
|
|
@@ -280,11 +384,18 @@ declare function KeepAnnouncements<TMeta = Record<string, unknown>>({ messages,
|
|
|
280
384
|
/** Singular alias for applications that mount one announcer explicitly. */
|
|
281
385
|
declare const KeepAnnouncer: typeof KeepAnnouncements;
|
|
282
386
|
|
|
283
|
-
type KeepUiLabelKey = "save" | "saved" | "remove" | "loading" | "saving" | "syncing" | "error" | "allTags" | "filterTags" | "note" | "saveNote" | "noItems" | "loadingItems" | "errorItems" | "search" | "sort" | "newest" | "oldest" | "savedNewest" | "savedOldest" | "updatedNewest" | "updatedOldest" | "previousPage" | "nextPage" | "pagination" | "page" | "selectItems" | "selectedCount" | "deleteSelected" | "tagsToApply" | "applyTags" | "savedMessage" | "removedMessage" | "noteSavedMessage" | "exportData" | "importData" | "importMode" | "merge" | "replace" | "importedCount" | "failedCount" | "storageQuotaError" | "statusExpired" | "statusRemoved" | "statusDeleted" | "statusPrivate" | "statusUnknown";
|
|
387
|
+
type KeepUiLabelKey = "save" | "saved" | "remove" | "loading" | "saving" | "syncing" | "error" | "allTags" | "tags" | "filterTags" | "note" | "saveNote" | "noItems" | "loadingItems" | "errorItems" | "search" | "sort" | "newest" | "oldest" | "savedNewest" | "savedOldest" | "updatedNewest" | "updatedOldest" | "previousPage" | "nextPage" | "pagination" | "page" | "selectItems" | "selectedCount" | "deleteSelected" | "tagsToApply" | "applyTags" | "savedMessage" | "removedMessage" | "undo" | "undoAvailable" | "selectionScope" | "currentPage" | "searchResults" | "allItems" | "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";
|
|
284
388
|
type KeepUiLabels = Partial<Record<KeepUiLabelKey, string>>;
|
|
389
|
+
type KeepUiLocaleLabels = Record<KeepUiLabelKey, string>;
|
|
390
|
+
|
|
391
|
+
declare const KEEP_BUILT_IN_LOCALES: readonly ["en", "ja", "ko", "zh-Hans", "zh-Hant", "th", "fr", "es", "pt-BR", "it", "de", "ru", "fil", "vi", "id", "ms"];
|
|
392
|
+
type KeepUiLocale = (typeof KEEP_BUILT_IN_LOCALES)[number];
|
|
393
|
+
declare function getKeepLocaleLabels(locale?: string): KeepUiLocaleLabels;
|
|
394
|
+
|
|
285
395
|
type KeepUiLabelContext = {
|
|
286
396
|
locale?: string;
|
|
287
397
|
labels: Readonly<Record<KeepUiLabelKey, string>>;
|
|
398
|
+
customLabels?: KeepUiLabels;
|
|
288
399
|
labelResolver?: (key: KeepUiLabelKey, context: {
|
|
289
400
|
locale?: string;
|
|
290
401
|
}) => string | undefined;
|
|
@@ -295,7 +406,7 @@ type KeepUiProviderProps = {
|
|
|
295
406
|
labelResolver?: KeepUiLabelContext["labelResolver"];
|
|
296
407
|
children?: ReactNode;
|
|
297
408
|
};
|
|
298
|
-
/** Provides one locale-aware label source to every UI primitive. */
|
|
409
|
+
/** Provides one complete locale-aware label source to every UI primitive. */
|
|
299
410
|
declare function KeepUiProvider({ labels, locale, labelResolver, children }: KeepUiProviderProps): react.JSX.Element;
|
|
300
411
|
declare function useKeepUiLabels(): KeepUiLabelContext;
|
|
301
412
|
|
|
@@ -322,4 +433,4 @@ type KeepKit<TMeta = Record<string, unknown>> = {
|
|
|
322
433
|
/** Create one typed application API for the core and standard UI layer. */
|
|
323
434
|
declare function createKeepKit<TMeta = Record<string, unknown>>(options?: CreateKeepKitOptions<TMeta>): KeepKit<TMeta>;
|
|
324
435
|
|
|
325
|
-
export { type CreateKeepKitOptions, KeepAnnouncements, type KeepAnnouncementsProps, KeepAnnouncer, KeepBackup, type KeepBackupProps, KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState, KeepButton, type KeepButtonLabels, type KeepButtonProps, KeepCollection, type KeepCollectionFeature, type KeepCollectionProps, KeepEmptyState, type KeepEmptyStateProps, type KeepImageProps, KeepItemCard, type KeepItemCardLinkProps, type KeepItemCardProps, type KeepItemCardState, KeepItemCheckbox, type KeepItemCheckboxProps, type KeepKit, KeepKitProvider, type KeepKitProviderProps, KeepList, type KeepListProps, type KeepListState, KeepNoteEditor, type KeepNoteEditorProps, type KeepNoteEditorState, KeepPagination, type KeepPaginationProps, type KeepPaginationState, KeepSearchInput, type KeepSearchInputProps, KeepSortSelect, type KeepSortSelectProps, type KeepSortValue, KeepStatus, type KeepStatusLabels, type KeepStatusProps, type KeepStatusState, type KeepStatusValue, KeepTagEditor, type KeepTagEditorProps, type KeepTagEditorState, KeepTagFilter, type KeepTagFilterProps, type KeepTagFilterState, type KeepUiLabelContext, type KeepUiLabelKey, type KeepUiLabels, KeepUiProvider, type KeepUiProviderProps, type RenderProp, createKeepKit, isAllSelected, toggleSelectAll, useKeepUiLabels };
|
|
436
|
+
export { type CreateKeepKitOptions, KeepAnnouncements, type KeepAnnouncementsProps, KeepAnnouncer, KeepBackup, type KeepBackupProps, KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState, KeepButton, type KeepButtonLabels, type KeepButtonProps, KeepCollection, type KeepCollectionFeature, type KeepCollectionProps, KeepEmptyState, type KeepEmptyStateProps, type KeepImageProps, KeepItemCard, type KeepItemCardLinkProps, type KeepItemCardProps, type KeepItemCardState, KeepItemCheckbox, type KeepItemCheckboxProps, KeepItemStatusBadge, type KeepItemStatusBadgeProps, type KeepKit, KeepKitProvider, type KeepKitProviderProps, KeepLayout, type KeepLayoutPreset, type KeepLayoutProps, KeepList, type KeepListProps, type KeepListState, KeepNoteEditor, type KeepNoteEditorProps, type KeepNoteEditorState, type KeepPagesRouterLike, KeepPagination, type KeepPaginationProps, type KeepPaginationState, KeepPruneStaleButton, type KeepPruneStaleButtonProps, KeepSearchInput, type KeepSearchInputProps, type KeepSelectionScope, 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 KeepUiLabelContext, type KeepUiLabelKey, type KeepUiLabels, type KeepUiLocale, type KeepUiLocaleLabels, KeepUiProvider, type KeepUiProviderProps, KeepUndo, type KeepUndoProps, type KeepUrlAdapter, type RenderProp, createKeepKit, createNextPagesRouterAdapter, getKeepLocaleLabels, isAllSelected, toggleSelectAll, useKeepUiLabels, useKeepUrlSync };
|