@keepkit/ui 0.7.0 → 0.8.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 CHANGED
@@ -32,7 +32,7 @@ function SavedArticles() {
32
32
  }
33
33
  ```
34
34
 
35
- `keep.Collection`は検索、ソート、ページング、loading / empty / error、ARIA live通知を標準で提供します。検索は既定で300msデバウンスされます。`features={{ tagFilter: true, bulkActions: true }}`でタグフィルターと一括操作も有効にできます。個別の`KeepList`、`KeepSearchInput`、`KeepSortSelect`、`KeepPagination`、`KeepItemCheckbox`、`KeepTagEditor`などは高度なレイアウト用に利用できます。`KeepBulkActions`はrender propsで操作UIを差し替えられます。`KeepNoteEditor`は既定300msのデバウンス保存に対応し、`debounceMs={0}`でフォーム送信のみへ戻せます。通知領域だけを明示的に置く場合は`KeepAnnouncer`(`KeepAnnouncements`のalias)を使えます。
35
+ `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)を使えます。
36
36
 
37
37
  一覧のqueryは次の形式に統一されています。
38
38
 
@@ -81,7 +81,7 @@ function SavedArticles() {
81
81
  }
82
82
  ```
83
83
 
84
- `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 for replacing its operation UI. `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.
84
+ `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.
85
85
 
86
86
  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.
87
87
 
package/dist/index.d.ts CHANGED
@@ -20,15 +20,21 @@ type KeepBulkActionsState<TMeta = Record<string, unknown>> = {
20
20
  items: KeepItem<TMeta>[];
21
21
  selectedIds: string[];
22
22
  selectedCount: number;
23
+ isAllSelected: boolean;
23
24
  allSelected: boolean;
24
25
  tagsInput: string;
25
26
  setTagsInput: (value: string) => void;
26
27
  toggle: (id: string) => void;
28
+ toggleSelectAll: () => void;
27
29
  toggleAll: () => void;
28
30
  remove: () => Promise<void>;
29
31
  updateTags: () => Promise<void>;
30
32
  isMutating: boolean;
31
33
  };
34
+ /** Returns whether every visible item is selected. Empty lists are never all selected. */
35
+ declare function isAllSelected<TMeta>(items: readonly Pick<KeepItem<TMeta>, "id">[], selectedIds: readonly string[]): boolean;
36
+ /** Toggles only the visible items, preserving selections outside the current query or page. */
37
+ declare function toggleSelectAll<TMeta>(items: readonly Pick<KeepItem<TMeta>, "id">[], selectedIds: readonly string[]): string[];
32
38
  type KeepBulkActionsProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, "children"> & {
33
39
  query?: KeepListQuery<TMeta>;
34
40
  selectedIds?: string[];
@@ -287,4 +293,4 @@ type KeepKit<TMeta = Record<string, unknown>> = {
287
293
  /** Create one typed application API for the core and standard UI layer. */
288
294
  declare function createKeepKit<TMeta = Record<string, unknown>>(options?: CreateKeepKitOptions<TMeta>): KeepKit<TMeta>;
289
295
 
290
- export { type CreateKeepKitOptions, KeepAnnouncements, type KeepAnnouncementsProps, KeepAnnouncer, KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState, KeepButton, type KeepButtonLabels, type KeepButtonProps, KeepCollection, type KeepCollectionFeature, type KeepCollectionProps, KeepEmptyState, type KeepEmptyStateProps, type KeepImageProps, KeepItemCard, 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, useKeepUiLabels };
296
+ export { type CreateKeepKitOptions, KeepAnnouncements, type KeepAnnouncementsProps, KeepAnnouncer, KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState, KeepButton, type KeepButtonLabels, type KeepButtonProps, KeepCollection, type KeepCollectionFeature, type KeepCollectionProps, KeepEmptyState, type KeepEmptyStateProps, type KeepImageProps, KeepItemCard, 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 };
package/dist/index.js CHANGED
@@ -133,6 +133,20 @@ function useUiLabel(key, override) {
133
133
 
134
134
  // src/KeepBulkActions.tsx
135
135
  import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
136
+ function isAllSelected(items, selectedIds) {
137
+ if (items.length === 0) return false;
138
+ const selected = new Set(selectedIds);
139
+ return items.every((item) => selected.has(item.id));
140
+ }
141
+ function toggleSelectAll(items, selectedIds) {
142
+ const visibleIds = new Set(items.map((item) => item.id));
143
+ if (isAllSelected(items, selectedIds)) return selectedIds.filter((id) => !visibleIds.has(id));
144
+ const nextIds = [...selectedIds];
145
+ for (const item of items) {
146
+ if (!nextIds.includes(item.id)) nextIds.push(item.id);
147
+ }
148
+ return nextIds;
149
+ }
136
150
  function KeepBulkActions({
137
151
  query,
138
152
  selectedIds: controlledSelectedIds,
@@ -159,8 +173,8 @@ function KeepBulkActions({
159
173
  onSelectedIdsChange?.(ids);
160
174
  };
161
175
  const toggle = (id) => setSelectedIds(selected.has(id) ? selectedIds.filter((current) => current !== id) : [...selectedIds, id]);
162
- const allSelected = list.items.length > 0 && list.items.every((item) => selected.has(item.id));
163
- const toggleAll = () => setSelectedIds(allSelected ? [] : list.items.map((item) => item.id));
176
+ const allSelected = isAllSelected(list.items, selectedIds);
177
+ const toggleAll = () => setSelectedIds(toggleSelectAll(list.items, selectedIds));
164
178
  const remove = async () => {
165
179
  const ids = [...selectedIds];
166
180
  await list.removeBatch(ids);
@@ -177,10 +191,12 @@ function KeepBulkActions({
177
191
  items: list.items,
178
192
  selectedIds,
179
193
  selectedCount: selectedIds.length,
194
+ isAllSelected: allSelected,
180
195
  allSelected,
181
196
  tagsInput,
182
197
  setTagsInput,
183
198
  toggle,
199
+ toggleSelectAll: toggleAll,
184
200
  toggleAll,
185
201
  remove,
186
202
  updateTags,
@@ -812,6 +828,7 @@ function KeepTagEditor({
812
828
  onChange: (event) => setInput(event.currentTarget.value),
813
829
  onKeyDown: (event) => {
814
830
  if (event.key === "Enter") {
831
+ if (event.nativeEvent.isComposing) return;
815
832
  event.preventDefault();
816
833
  if (input.trim()) addTag(input);
817
834
  } else if (event.key === "Backspace" && input.length === 0 && tags.length > 0) {
@@ -1015,6 +1032,8 @@ export {
1015
1032
  createBrowserStorageAdapter,
1016
1033
  createKeepKit,
1017
1034
  createStorageAdapter,
1035
+ isAllSelected,
1036
+ toggleSelectAll,
1018
1037
  useKeepContext2 as useKeepContext,
1019
1038
  useKeepItem5 as useKeepItem,
1020
1039
  useKeepList5 as useKeepList,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.tsx","../src/KeepBulkActions.tsx","../src/KeepItemCheckbox.tsx","../src/shared.tsx","../src/ui-context.tsx","../src/KeepButton.tsx","../src/KeepCollection.tsx","../src/KeepList.tsx","../src/KeepItemCard.tsx","../src/KeepTagFilter.tsx","../src/query-controls.tsx","../src/KeepNoteEditor.tsx","../src/KeepTagEditor.tsx","../src/status.tsx"],"sourcesContent":["\"use client\";\n\nimport type { KeepItem, KeepItemInput, KeepListQuery } from \"@keepkit/core/core\";\nimport {\n type CreateKeepKitOptions as CoreCreateKeepKitOptions,\n KeepProvider as CoreKeepProvider,\n createKeepKit as createCoreKeepKit,\n type KeepProviderProps,\n type KeepShortcutOptions,\n type useKeepContext,\n type useKeepItem,\n type useKeepList,\n} from \"@keepkit/core/react\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState } from \"./KeepBulkActions\";\nimport { KeepButton, type KeepButtonLabels, type KeepButtonProps } from \"./KeepButton\";\nimport { KeepCollection, type KeepCollectionFeature, type KeepCollectionProps } from \"./KeepCollection\";\nimport { type KeepImageProps, KeepItemCard, type KeepItemCardProps, type KeepItemCardState } from \"./KeepItemCard\";\nimport { KeepItemCheckbox, type KeepItemCheckboxProps } from \"./KeepItemCheckbox\";\nimport { KeepList, type KeepListProps, type KeepListState } from \"./KeepList\";\nimport { KeepNoteEditor, type KeepNoteEditorProps, type KeepNoteEditorState } from \"./KeepNoteEditor\";\nimport { KeepTagEditor, type KeepTagEditorProps, type KeepTagEditorState } from \"./KeepTagEditor\";\nimport { KeepTagFilter, type KeepTagFilterProps, type KeepTagFilterState } from \"./KeepTagFilter\";\nimport {\n KeepPagination,\n type KeepPaginationProps,\n type KeepPaginationState,\n KeepSearchInput,\n type KeepSearchInputProps,\n KeepSortSelect,\n type KeepSortSelectProps,\n type KeepSortValue,\n} from \"./query-controls\";\nimport {\n KeepAnnouncements,\n type KeepAnnouncementsProps,\n KeepAnnouncer,\n KeepEmptyState,\n type KeepEmptyStateProps,\n KeepStatus,\n type KeepStatusLabels,\n type KeepStatusProps,\n type KeepStatusState,\n type KeepStatusValue,\n} from \"./status\";\nimport {\n type KeepUiLabelContext,\n type KeepUiLabelKey,\n type KeepUiLabels,\n KeepUiProvider,\n type KeepUiProviderProps,\n useKeepUiLabels,\n} from \"./ui-context\";\n\nexport type KeepKitProviderProps<TMeta = Record<string, unknown>> = Omit<KeepProviderProps<TMeta>, \"children\"> &\n Omit<KeepUiProviderProps, \"children\"> & { children?: ReactNode };\n\n/** Combines the core store, UI labels, and the global live announcer. */\nexport function KeepKitProvider<TMeta = Record<string, unknown>>({\n labels,\n locale,\n labelResolver,\n children,\n ...providerProps\n}: KeepKitProviderProps<TMeta>) {\n return (\n <KeepUiProvider labels={labels} locale={locale} labelResolver={labelResolver}>\n <CoreKeepProvider<TMeta> {...providerProps}>\n {children}\n <KeepAnnouncements />\n </CoreKeepProvider>\n </KeepUiProvider>\n );\n}\n\nexport type { KeepItem, KeepItemInput, KeepListQuery, KeepSyncStatus } from \"@keepkit/core/core\";\nexport type { KeepButtonState, KeepContextValue, KeepProviderProps, KeepShortcutOptions } from \"@keepkit/core/react\";\nexport { KeepProvider, useKeepContext, useKeepItem, useKeepList, useKeepShortcut } from \"@keepkit/core/react\";\nexport {\n createBrowserStorageAdapter,\n createStorageAdapter,\n FallbackStorageAdapter,\n IndexedDBAdapter,\n IndexedDBSyncQueueAdapter,\n LocalStorageAdapter,\n LocalStorageSyncQueueAdapter,\n SyncStorageAdapter,\n} from \"@keepkit/core/storage\";\nexport type { RenderProp } from \"./shared\";\nexport type {\n KeepAnnouncementsProps,\n KeepBulkActionsProps,\n KeepBulkActionsState,\n KeepButtonLabels,\n KeepButtonProps,\n KeepCollectionFeature,\n KeepCollectionProps,\n KeepEmptyStateProps,\n KeepImageProps,\n KeepItemCardProps,\n KeepItemCardState,\n KeepItemCheckboxProps,\n KeepListProps,\n KeepListState,\n KeepNoteEditorProps,\n KeepNoteEditorState,\n KeepPaginationProps,\n KeepPaginationState,\n KeepSearchInputProps,\n KeepSortSelectProps,\n KeepSortValue,\n KeepStatusLabels,\n KeepStatusProps,\n KeepStatusState,\n KeepStatusValue,\n KeepTagEditorProps,\n KeepTagEditorState,\n KeepTagFilterProps,\n KeepTagFilterState,\n KeepUiLabelContext,\n KeepUiLabelKey,\n KeepUiLabels,\n KeepUiProviderProps,\n};\nexport {\n KeepAnnouncements,\n KeepAnnouncer,\n KeepBulkActions,\n KeepButton,\n KeepCollection,\n KeepEmptyState,\n KeepItemCard,\n KeepItemCheckbox,\n KeepList,\n KeepNoteEditor,\n KeepPagination,\n KeepSearchInput,\n KeepSortSelect,\n KeepStatus,\n KeepTagEditor,\n KeepTagFilter,\n KeepUiProvider,\n useKeepUiLabels,\n};\n\nexport type CreateKeepKitOptions<TMeta = Record<string, unknown>> = CoreCreateKeepKitOptions<TMeta> &\n Omit<KeepUiProviderProps, \"children\"> & {\n getTitle?: (item: KeepItem<TMeta>) => ReactNode;\n getImageProps?: (item: KeepItem<TMeta>, title: ReactNode) => KeepImageProps | undefined;\n };\n\nexport type KeepKit<TMeta = Record<string, unknown>> = {\n Provider: ComponentType<KeepKitProviderProps<TMeta>>;\n Button: ComponentType<KeepButtonProps<TMeta>>;\n Collection: ComponentType<KeepCollectionProps<TMeta>>;\n useContext: () => ReturnType<typeof useKeepContext<TMeta>>;\n useItem: (item?: KeepItemInput<TMeta>) => ReturnType<typeof useKeepItem<TMeta>>;\n useList: (query?: KeepListQuery<TMeta>) => ReturnType<typeof useKeepList<TMeta>>;\n useShortcut: (options: KeepShortcutOptions<TMeta>) => void;\n};\n\n/** Create one typed application API for the core and standard UI layer. */\nexport function createKeepKit<TMeta = Record<string, unknown>>(\n options: CreateKeepKitOptions<TMeta> = {},\n): KeepKit<TMeta> {\n const { labels, locale, labelResolver, getTitle, getImageProps, ...coreOptions } = options;\n const coreKit = createCoreKeepKit<TMeta>(coreOptions);\n return {\n Provider: (props) => (\n <KeepKitProvider<TMeta>\n {...coreOptions}\n labels={labels}\n locale={locale}\n labelResolver={labelResolver}\n {...props}\n />\n ),\n Button: (props) => <KeepButton<TMeta> {...props} />,\n Collection: (props) => (\n <KeepCollection<TMeta>\n {...props}\n itemCardProps={{\n ...(getTitle ? { getTitle } : {}),\n ...(getImageProps ? { getImageProps } : {}),\n ...props.itemCardProps,\n }}\n />\n ),\n useContext: () => coreKit.useContext(),\n useItem: (item) => coreKit.useItem(item),\n useList: (query) => coreKit.useList(query),\n useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions),\n };\n}\n","\"use client\";\n\nimport type { KeepItem, KeepListQuery } from \"@keepkit/core/core\";\nimport { useKeepList } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, type ReactNode, useState } from \"react\";\nimport { KeepItemCheckbox } from \"./KeepItemCheckbox\";\nimport { getMetaTitle, normalizeUiTags, type RenderProp } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepBulkActionsState<TMeta = Record<string, unknown>> = {\n items: KeepItem<TMeta>[];\n selectedIds: string[];\n selectedCount: number;\n allSelected: boolean;\n tagsInput: string;\n setTagsInput: (value: string) => void;\n toggle: (id: string) => void;\n toggleAll: () => void;\n remove: () => Promise<void>;\n updateTags: () => Promise<void>;\n isMutating: boolean;\n};\n\nexport type KeepBulkActionsProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n query?: KeepListQuery<TMeta>;\n selectedIds?: string[];\n defaultSelectedIds?: string[];\n onSelectedIdsChange?: (ids: string[]) => void;\n renderItem?: (item: KeepItem<TMeta>, selected: boolean) => ReactNode;\n onCompleted?: (action: \"remove\" | \"tags\", ids: string[]) => void;\n render?: RenderProp<KeepBulkActionsState<TMeta>>;\n children?: ReactNode | RenderProp<KeepBulkActionsState<TMeta>>;\n};\n\n/** Selects visible items and performs one storage operation for the whole selection. */\nexport function KeepBulkActions<TMeta = Record<string, unknown>>({\n query,\n selectedIds: controlledSelectedIds,\n defaultSelectedIds = [],\n onSelectedIdsChange,\n renderItem,\n onCompleted,\n render,\n children,\n ...props\n}: KeepBulkActionsProps<TMeta>) {\n const selectItemsLabel = useUiLabel(\"selectItems\");\n const selectedCountLabel = useUiLabel(\"selectedCount\");\n const deleteSelectedLabel = useUiLabel(\"deleteSelected\");\n const tagsLabel = useUiLabel(\"tagsToApply\");\n const applyTagsLabel = useUiLabel(\"applyTags\");\n const list = useKeepList<TMeta>(query);\n const [uncontrolledSelectedIds, setUncontrolledSelectedIds] = useState(defaultSelectedIds);\n const selectedIds = controlledSelectedIds ?? uncontrolledSelectedIds;\n const selected = new Set(selectedIds);\n const [tagsInput, setTagsInput] = useState(\"\");\n const setSelectedIds = (ids: string[]) => {\n if (controlledSelectedIds === undefined) setUncontrolledSelectedIds(ids);\n onSelectedIdsChange?.(ids);\n };\n const toggle = (id: string) =>\n setSelectedIds(selected.has(id) ? selectedIds.filter((current) => current !== id) : [...selectedIds, id]);\n const allSelected = list.items.length > 0 && list.items.every((item) => selected.has(item.id));\n const toggleAll = () => setSelectedIds(allSelected ? [] : list.items.map((item) => item.id));\n const remove = async () => {\n const ids = [...selectedIds];\n await list.removeBatch(ids);\n onCompleted?.(\"remove\", ids);\n setSelectedIds([]);\n };\n const updateTags = async () => {\n const ids = [...selectedIds];\n await list.updateTagsBatch(ids, normalizeUiTags(tagsInput.split(\",\")));\n onCompleted?.(\"tags\", ids);\n setSelectedIds([]);\n };\n const state: KeepBulkActionsState<TMeta> = {\n items: list.items,\n selectedIds,\n selectedCount: selectedIds.length,\n allSelected,\n tagsInput,\n setTagsInput,\n toggle,\n toggleAll,\n remove,\n updateTags,\n isMutating: list.isMutating,\n };\n const body = render\n ? render(state)\n : typeof children === \"function\"\n ? children(state)\n : (children ?? (\n <>\n <fieldset>\n <legend>{selectItemsLabel}</legend>\n <label>\n <input type=\"checkbox\" checked={allSelected} onChange={toggleAll} aria-label={selectItemsLabel} />\n {selectedIds.length} {selectedCountLabel}\n </label>\n {list.items.map((item) => (\n <span key={item.id}>\n <KeepItemCheckbox\n item={item}\n checked={selected.has(item.id)}\n onCheckedChange={() => toggle(item.id)}\n />\n {renderItem ? renderItem(item, selected.has(item.id)) : (getMetaTitle(item.meta) ?? item.id)}\n </span>\n ))}\n </fieldset>\n <button type=\"button\" onClick={() => void remove()} disabled={selectedIds.length === 0 || list.isMutating}>\n {deleteSelectedLabel}\n </button>\n <label>\n {tagsLabel}\n <input value={tagsInput} onChange={(event) => setTagsInput(event.currentTarget.value)} />\n </label>\n <button\n type=\"button\"\n onClick={() => void updateTags()}\n disabled={selectedIds.length === 0 || list.isMutating}\n >\n {applyTagsLabel}\n </button>\n </>\n ));\n return (\n <section {...props} aria-busy={list.isMutating || props[\"aria-busy\"]}>\n {body}\n </section>\n );\n}\n","\"use client\";\n\nimport type { KeepItem } from \"@keepkit/core/core\";\nimport type { InputHTMLAttributes, ReactNode } from \"react\";\n\nexport type KeepItemCheckboxProps<TMeta = Record<string, unknown>> = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"checked\" | \"defaultChecked\" | \"onChange\"\n> & {\n item: KeepItem<TMeta>;\n checked?: boolean;\n label?: ReactNode;\n onCheckedChange?: (checked: boolean) => void;\n};\n\n/** A reusable accessible selection checkbox for a saved item. */\nexport function KeepItemCheckbox<TMeta = Record<string, unknown>>({\n item,\n checked = false,\n label,\n onCheckedChange,\n \"aria-label\": ariaLabel,\n ...props\n}: KeepItemCheckboxProps<TMeta>) {\n const itemLabel = getItemLabel(item) ?? item.id;\n const accessibleLabel = ariaLabel ?? (typeof label === \"string\" ? label : itemLabel);\n return (\n <input\n {...props}\n type=\"checkbox\"\n checked={checked}\n aria-label={accessibleLabel}\n onChange={(event) => onCheckedChange?.(event.currentTarget.checked)}\n />\n );\n}\n\nfunction getItemLabel<TMeta>(item: KeepItem<TMeta>): string | undefined {\n if (typeof item.meta !== \"object\" || item.meta === null || !(\"title\" in item.meta)) return undefined;\n const title = (item.meta as { title?: unknown }).title;\n return typeof title === \"string\" && title.trim() ? title.trim() : undefined;\n}\n","\"use client\";\n\nimport type { KeepItem, KeepItemInput, KeepListQuery } from \"@keepkit/core/core\";\nimport {\n cloneElement,\n type HTMLAttributes,\n type ImgHTMLAttributes,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from \"react\";\n\nexport type RenderProp<TState> = (state: TState) => ReactNode;\n\nexport type KeepButtonLabels = {\n saved?: ReactNode;\n unsaved?: ReactNode;\n loading?: ReactNode;\n error?: ReactNode;\n savedAriaLabel?: string;\n unsavedAriaLabel?: string;\n};\n\nexport type KeepImageProps = ImgHTMLAttributes<HTMLImageElement> & {\n src: string;\n alt: string;\n};\n\nexport function toKeepButtonItem<TMeta>(item: KeepItem<TMeta>): KeepItemInput<TMeta> {\n return {\n id: item.id,\n meta: item.meta,\n targetType: item.targetType,\n note: item.note,\n tags: item.tags,\n };\n}\n\nexport function getMetaTitle<TMeta>(meta: TMeta): string | undefined {\n if (typeof meta !== \"object\" || meta === null || !(\"title\" in meta)) return undefined;\n const title = (meta as { title?: unknown }).title;\n return typeof title === \"string\" && title.trim() ? title.trim() : undefined;\n}\n\nexport function normalizeUiTags(tags: string[]): string[] {\n return [...new Set(tags.map((tag) => tag.trim()).filter(Boolean))];\n}\n\nexport function sortToValue(sort: KeepListQuery[\"sort\"]): `${\"savedAt\" | \"updatedAt\"}:${\"asc\" | \"desc\"}` {\n return `${sort?.by ?? \"updatedAt\"}:${sort?.direction ?? \"desc\"}`;\n}\n\nexport function resolveContent<TState>(content: ReactNode | RenderProp<TState>, state: TState): ReactNode {\n return typeof content === \"function\" ? content(state) : content;\n}\n\nexport function renderRoot(\n asChild: boolean,\n child: ReactNode,\n props: HTMLAttributes<HTMLElement> & Record<string, unknown>,\n body: ReactNode,\n componentName: string,\n): ReactElement {\n if (asChild) {\n if (!isValidElement(child)) throw new Error(`${componentName} with asChild requires a single React element child.`);\n return cloneElement(child as ReactElement<Record<string, unknown>>, { ...props, children: body });\n }\n return <div {...props}>{body}</div>;\n}\n","\"use client\";\n\nimport { createContext, type ReactNode, useContext, useMemo } from \"react\";\n\nexport type KeepUiLabelKey =\n | \"save\"\n | \"saved\"\n | \"remove\"\n | \"loading\"\n | \"saving\"\n | \"syncing\"\n | \"error\"\n | \"allTags\"\n | \"filterTags\"\n | \"note\"\n | \"saveNote\"\n | \"noItems\"\n | \"loadingItems\"\n | \"errorItems\"\n | \"search\"\n | \"sort\"\n | \"newest\"\n | \"oldest\"\n | \"savedNewest\"\n | \"savedOldest\"\n | \"updatedNewest\"\n | \"updatedOldest\"\n | \"previousPage\"\n | \"nextPage\"\n | \"pagination\"\n | \"page\"\n | \"selectItems\"\n | \"selectedCount\"\n | \"deleteSelected\"\n | \"tagsToApply\"\n | \"applyTags\"\n | \"savedMessage\"\n | \"removedMessage\"\n | \"noteSavedMessage\";\n\nexport type KeepUiLabels = Partial<Record<KeepUiLabelKey, string>>;\n\nexport type KeepUiLabelContext = {\n locale?: string;\n labels: Readonly<Record<KeepUiLabelKey, string>>;\n labelResolver?: (key: KeepUiLabelKey, context: { locale?: string }) => string | undefined;\n};\n\nexport const DEFAULT_LABELS: Record<KeepUiLabelKey, string> = {\n save: \"Save\",\n saved: \"Saved\",\n remove: \"Remove\",\n loading: \"Loading…\",\n saving: \"Saving…\",\n syncing: \"Syncing…\",\n error: \"Something went wrong.\",\n allTags: \"All\",\n filterTags: \"Filter saved items by tag\",\n note: \"Note\",\n saveNote: \"Save note\",\n noItems: \"No saved items.\",\n loadingItems: \"Loading saved items…\",\n errorItems: \"Could not load saved items.\",\n search: \"Search saved items\",\n sort: \"Sort saved items\",\n newest: \"Newest first\",\n oldest: \"Oldest first\",\n savedNewest: \"Saved newest first\",\n savedOldest: \"Saved oldest first\",\n updatedNewest: \"Updated newest first\",\n updatedOldest: \"Updated oldest first\",\n previousPage: \"Previous page\",\n nextPage: \"Next page\",\n pagination: \"Pagination\",\n page: \"Page\",\n selectItems: \"Select saved items\",\n selectedCount: \"selected\",\n deleteSelected: \"Delete selected\",\n tagsToApply: \"Tags to apply\",\n applyTags: \"Apply tags\",\n savedMessage: \"Item saved.\",\n removedMessage: \"Item removed.\",\n noteSavedMessage: \"Note saved.\",\n};\n\nconst KeepUiLabelsContext = createContext<KeepUiLabelContext>({ labels: DEFAULT_LABELS });\n\nexport type KeepUiProviderProps = {\n labels?: KeepUiLabels;\n locale?: string;\n labelResolver?: KeepUiLabelContext[\"labelResolver\"];\n children?: ReactNode;\n};\n\n/** Provides one locale-aware label source to every UI primitive. */\nexport function KeepUiProvider({ labels, locale, labelResolver, children }: KeepUiProviderProps) {\n const value = useMemo<KeepUiLabelContext>(() => {\n const resolved = { ...DEFAULT_LABELS, ...labels };\n return { locale, labels: resolved, labelResolver };\n }, [labelResolver, labels, locale]);\n return <KeepUiLabelsContext.Provider value={value}>{children}</KeepUiLabelsContext.Provider>;\n}\n\nexport function useKeepUiLabels(): KeepUiLabelContext {\n return useContext(KeepUiLabelsContext);\n}\n\nexport function useUiLabel(key: KeepUiLabelKey, override?: string): string {\n const context = useKeepUiLabels();\n return override ?? context.labelResolver?.(key, { locale: context.locale }) ?? context.labels[key];\n}\n","\"use client\";\n\nimport {\n KeepButton as CoreKeepButton,\n type KeepButtonProps as CoreKeepButtonProps,\n type KeepButtonState,\n useKeepItem,\n} from \"@keepkit/core/react\";\nimport type { ReactNode } from \"react\";\nimport type { KeepButtonLabels } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type { KeepButtonLabels } from \"./shared\";\n\nexport type KeepButtonProps<TMeta = Record<string, unknown>> = CoreKeepButtonProps<TMeta> & {\n labels?: KeepButtonLabels;\n};\n\n/** A style-free save toggle with localized labels and the core button's ARIA/asChild behavior. */\nexport function KeepButton<TMeta = Record<string, unknown>>({ labels, ...props }: KeepButtonProps<TMeta>) {\n const saveLabel = useUiLabel(\"save\", typeof labels?.unsaved === \"string\" ? labels.unsaved : undefined);\n const savedLabel = useUiLabel(\"saved\", typeof labels?.saved === \"string\" ? labels.saved : undefined);\n const loadingLabel = useUiLabel(\"loading\", typeof labels?.loading === \"string\" ? labels.loading : undefined);\n const errorLabel = useUiLabel(\"error\", typeof labels?.error === \"string\" ? labels.error : undefined);\n const buttonState = useKeepItem<TMeta>(props.item);\n const customStateLabel = labels?.loading !== undefined || labels?.error !== undefined;\n const getStateContent = (state: KeepButtonState<TMeta>): ReactNode => {\n if (state.error) return labels?.error ?? errorLabel;\n if (state.isMutating) return labels?.loading ?? loadingLabel;\n if (typeof props.children === \"function\") return props.children(state);\n if (props.children !== undefined) return props.children;\n return state.isSaved ? (labels?.saved ?? savedLabel) : (labels?.unsaved ?? saveLabel);\n };\n const sharedProps = {\n ...props,\n \"aria-busy\": props[\"aria-busy\"] ?? (buttonState.isLoading || buttonState.isMutating),\n savedLabel: labels?.saved ?? props.savedLabel ?? savedLabel,\n unsavedLabel: labels?.unsaved ?? props.unsavedLabel ?? saveLabel,\n savedAriaLabel: labels?.savedAriaLabel ?? props.savedAriaLabel,\n unsavedAriaLabel: labels?.unsavedAriaLabel ?? props.unsavedAriaLabel,\n };\n if (!customStateLabel) return <CoreKeepButton<TMeta> {...sharedProps} />;\n return (\n <CoreKeepButton<TMeta> {...sharedProps}>\n {(state: KeepButtonState<TMeta>) => <>{getStateContent(state)}</>}\n </CoreKeepButton>\n );\n}\n","\"use client\";\n\nimport type { KeepItem, KeepListQuery } from \"@keepkit/core/core\";\nimport { useKeepList } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, type ReactNode, useMemo, useState } from \"react\";\nimport { KeepBulkActions } from \"./KeepBulkActions\";\nimport type { KeepItemCardProps } from \"./KeepItemCard\";\nimport { KeepList, type KeepListState } from \"./KeepList\";\nimport { KeepTagFilter } from \"./KeepTagFilter\";\nimport { KeepPagination, KeepSearchInput, KeepSortSelect } from \"./query-controls\";\nimport { type RenderProp, sortToValue } from \"./shared\";\n\nexport type KeepCollectionFeature = \"search\" | \"sort\" | \"pagination\" | \"tagFilter\" | \"bulkActions\";\n\nexport type KeepCollectionProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n query?: KeepListQuery<TMeta>;\n pageSize?: number;\n features?: Partial<Record<KeepCollectionFeature, boolean>>;\n renderItem?: (item: KeepItem<TMeta>, state: KeepListState<TMeta>) => ReactNode;\n itemCardProps?: Omit<KeepItemCardProps<TMeta>, \"item\" | \"children\" | \"render\">;\n loading?: ReactNode | RenderProp<KeepListState<TMeta>>;\n empty?: ReactNode | RenderProp<KeepListState<TMeta>>;\n error?: ReactNode | RenderProp<KeepListState<TMeta>>;\n};\n\n/** A batteries-included collection with query controls and accessible status feedback. */\nexport function KeepCollection<TMeta = Record<string, unknown>>({\n query = {},\n pageSize = 20,\n features,\n renderItem,\n itemCardProps,\n loading,\n empty,\n error,\n className,\n ...rootProps\n}: KeepCollectionProps<TMeta>) {\n const enabled = {\n search: true,\n sort: true,\n pagination: true,\n tagFilter: false,\n bulkActions: false,\n ...features,\n };\n const [searchValue, setSearchValue] = useState(query.search?.query ?? \"\");\n const [sort, setSort] = useState(query.sort ?? { by: \"updatedAt\" as const, direction: \"desc\" as const });\n const [tag, setTag] = useState<string | undefined>(query.tags?.[0]);\n const [page, setPage] = useState(query.pagination?.page ?? 1);\n const resolvedPageSize = query.pagination?.pageSize ?? pageSize;\n const resolvedQuery = useMemo<KeepListQuery<TMeta>>(\n () => ({\n ...query,\n search: enabled.search ? { ...query.search, query: searchValue } : query.search,\n sort: enabled.sort ? sort : query.sort,\n tags: tag ? [...new Set([...(query.tags ?? []), tag])] : query.tags,\n pagination: enabled.pagination ? { ...query.pagination, page, pageSize: resolvedPageSize } : query.pagination,\n }),\n [enabled.pagination, enabled.search, enabled.sort, page, query, resolvedPageSize, searchValue, sort, tag],\n );\n const list = useKeepList<TMeta>(resolvedQuery);\n\n return (\n <section\n {...rootProps}\n className={className}\n aria-busy={list.isLoading || list.isMutating || rootProps[\"aria-busy\"]}\n >\n <div>\n {enabled.search ? (\n <KeepSearchInput\n value={searchValue}\n onValueChange={(value) => {\n setSearchValue(value);\n setPage(1);\n }}\n />\n ) : null}\n {enabled.sort ? (\n <KeepSortSelect\n value={sortToValue(sort)}\n onValueChange={(_value, nextSort) => {\n setSort(nextSort);\n setPage(1);\n }}\n />\n ) : null}\n {enabled.tagFilter ? (\n <KeepTagFilter<TMeta>\n query={query}\n value={tag}\n onValueChange={(value) => {\n setTag(value);\n setPage(1);\n }}\n />\n ) : null}\n </div>\n <KeepList<TMeta>\n query={resolvedQuery}\n renderItem={renderItem}\n itemCardProps={itemCardProps}\n loading={loading}\n empty={empty}\n error={error}\n />\n {enabled.pagination ? (\n <KeepPagination\n totalCount={list.totalCount}\n pageSize={resolvedPageSize}\n page={list.page}\n onPageChange={(nextPage) => setPage(nextPage)}\n />\n ) : null}\n {enabled.bulkActions ? <KeepBulkActions<TMeta> query={resolvedQuery} /> : null}\n </section>\n );\n}\n","\"use client\";\n\nimport type { KeepItem, KeepListQuery } from \"@keepkit/core/core\";\nimport type { UseKeepListResult } from \"@keepkit/core/react\";\nimport { useKeepList } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, isValidElement, type ReactNode } from \"react\";\nimport { KeepItemCard, type KeepItemCardProps } from \"./KeepItemCard\";\nimport { type RenderProp, renderRoot, resolveContent } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepListState<TMeta = Record<string, unknown>> = UseKeepListResult<TMeta>;\n\nexport type KeepListProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n query?: KeepListQuery<TMeta>;\n children?: ReactNode | RenderProp<KeepListState<TMeta>>;\n renderItem?: (item: KeepItem<TMeta>, state: KeepListState<TMeta>) => ReactNode;\n loading?: ReactNode | RenderProp<KeepListState<TMeta>>;\n empty?: ReactNode | RenderProp<KeepListState<TMeta>>;\n error?: ReactNode | RenderProp<KeepListState<TMeta>>;\n itemCardProps?: Omit<KeepItemCardProps<TMeta>, \"item\" | \"children\" | \"render\">;\n asChild?: boolean;\n};\n\n/** A list primitive with built-in loading, empty, error, and removal states. */\nexport function KeepList<TMeta = Record<string, unknown>>({\n query,\n children,\n renderItem,\n loading,\n empty,\n error: errorContent,\n itemCardProps,\n asChild = false,\n className,\n ...rootProps\n}: KeepListProps<TMeta>) {\n const defaultLoading = useUiLabel(\"loadingItems\");\n const defaultEmpty = useUiLabel(\"noItems\");\n const defaultError = useUiLabel(\"errorItems\");\n const state = useKeepList<TMeta>(query);\n const body = getListBody(state, {\n children,\n renderItem,\n loading: loading ?? defaultLoading,\n empty: empty ?? defaultEmpty,\n error: errorContent ?? defaultError,\n itemCardProps,\n });\n return renderRoot(\n asChild,\n asChild && isValidElement(children) ? children : undefined,\n { ...rootProps, className, \"aria-busy\": state.isLoading || rootProps[\"aria-busy\"] },\n body,\n \"KeepList\",\n );\n}\n\nfunction getListBody<TMeta>(\n state: KeepListState<TMeta>,\n options: {\n children?: ReactNode | RenderProp<KeepListState<TMeta>>;\n renderItem?: (item: KeepItem<TMeta>, state: KeepListState<TMeta>) => ReactNode;\n loading: ReactNode | RenderProp<KeepListState<TMeta>>;\n empty: ReactNode | RenderProp<KeepListState<TMeta>>;\n error: ReactNode | RenderProp<KeepListState<TMeta>>;\n itemCardProps?: Omit<KeepItemCardProps<TMeta>, \"item\" | \"children\" | \"render\">;\n },\n): ReactNode {\n if (state.error && state.items.length === 0) return resolveContent(options.error, state);\n if (state.isLoading && !state.isHydrated) return resolveContent(options.loading, state);\n if (state.isHydrated && state.items.length === 0) return resolveContent(options.empty, state);\n if (typeof options.children === \"function\") return options.children(state);\n if (options.children !== undefined && !isValidElement(options.children)) return options.children;\n return (\n <ul>\n {state.items.map((item) =>\n options.renderItem ? (\n options.renderItem(item, state)\n ) : (\n <li key={item.id}>\n <KeepItemCard item={item} {...options.itemCardProps} />\n </li>\n ),\n )}\n </ul>\n );\n}\n","\"use client\";\n\nimport type { KeepItem } from \"@keepkit/core/core\";\nimport { useKeepItem } from \"@keepkit/core/react\";\nimport { type ComponentType, type HTMLAttributes, type ImgHTMLAttributes, isValidElement, type ReactNode } from \"react\";\nimport { KeepButton, type KeepButtonLabels } from \"./KeepButton\";\nimport { getMetaTitle, type RenderProp, renderRoot, toKeepButtonItem } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepItemCardState<TMeta = Record<string, unknown>> = {\n item: KeepItem<TMeta>;\n isSaved: boolean;\n isMutating: boolean;\n error: unknown | null;\n remove: () => Promise<void>;\n};\n\nexport type KeepImageProps = ImgHTMLAttributes<HTMLImageElement> & {\n src: string;\n alt: string;\n};\n\nexport type KeepItemCardProps<TMeta = Record<string, unknown>> = Omit<\n HTMLAttributes<HTMLElement>,\n \"children\" | \"title\"\n> & {\n item: KeepItem<TMeta>;\n title?: ReactNode | ((item: KeepItem<TMeta>) => ReactNode);\n getTitle?: (item: KeepItem<TMeta>) => ReactNode;\n getImageProps?: (item: KeepItem<TMeta>, title: ReactNode) => KeepImageProps | undefined;\n imageComponent?: ComponentType<KeepImageProps>;\n renderImage?: (props: KeepImageProps, item: KeepItem<TMeta>) => ReactNode;\n imageAlt?: string;\n render?: RenderProp<KeepItemCardState<TMeta>>;\n children?: ReactNode | RenderProp<KeepItemCardState<TMeta>>;\n removeLabel?: string;\n onRemoveError?: (error: unknown) => void;\n onRemoved?: (item: KeepItem<TMeta>) => void;\n showSaveButton?: boolean;\n saveButtonLabels?: KeepButtonLabels;\n asChild?: boolean;\n};\n\n/** A low-dependency item presentation primitive. The default markup can be replaced with render props. */\nexport function KeepItemCard<TMeta = Record<string, unknown>>({\n item,\n title,\n getTitle,\n getImageProps,\n imageComponent: ImageComponent,\n renderImage,\n imageAlt,\n render,\n children,\n removeLabel,\n onRemoveError,\n onRemoved,\n showSaveButton = true,\n saveButtonLabels,\n asChild = false,\n className,\n ...rootProps\n}: KeepItemCardProps<TMeta>) {\n const saveActionLabel = useUiLabel(\"save\");\n const removeActionLabel = useUiLabel(\"remove\");\n const itemState = useKeepItem<TMeta>(item);\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const state: KeepItemCardState<TMeta> = {\n item,\n isSaved: itemState.isSaved,\n isMutating: itemState.isMutating,\n error: itemState.error,\n remove: itemState.remove,\n };\n const resolvedTitle =\n typeof title === \"function\" ? title(item) : (title ?? getTitle?.(item) ?? getMetaTitle(item.meta) ?? item.id);\n const imageProps = getImageProps?.(item, resolvedTitle);\n\n async function handleRemove() {\n try {\n await itemState.remove();\n onRemoved?.(item);\n } catch (error) {\n onRemoveError?.(error);\n }\n }\n\n const body = render\n ? render(state)\n : typeof contentChildren === \"function\"\n ? contentChildren(state)\n : (contentChildren ?? (\n <>\n {imageProps\n ? (renderImage?.({ ...imageProps, alt: imageAlt ?? imageProps.alt }, item) ??\n (ImageComponent ? (\n <ImageComponent {...imageProps} alt={imageAlt ?? imageProps.alt} />\n ) : (\n <img {...imageProps} alt={imageAlt ?? imageProps.alt} />\n )))\n : null}\n <h3>{resolvedTitle}</h3>\n {showSaveButton ? (\n <KeepButton\n item={toKeepButtonItem(item)}\n labels={saveButtonLabels}\n getAriaLabel={(buttonState) =>\n `${buttonState.isSaved ? removeActionLabel : saveActionLabel} ${String(resolvedTitle)}`\n }\n />\n ) : null}\n <button type=\"button\" onClick={() => void handleRemove()} disabled={itemState.isMutating}>\n {removeLabel ?? removeActionLabel}\n </button>\n </>\n ));\n\n return renderRoot(\n asChild,\n isValidElement(children) ? children : undefined,\n { ...rootProps, className, \"aria-busy\": itemState.isMutating || rootProps[\"aria-busy\"] },\n body,\n \"KeepItemCard\",\n );\n}\n","\"use client\";\n\nimport type { KeepListQuery } from \"@keepkit/core/core\";\nimport { useKeepList } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, isValidElement, type ReactNode, useCallback, useMemo, useState } from \"react\";\nimport { type RenderProp, renderRoot } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepTagFilterState = {\n tags: string[];\n tagCounts: Record<string, number>;\n value?: string;\n select: (tag?: string) => void;\n};\n\nexport type KeepTagFilterProps<TMeta = Record<string, unknown>> = Omit<\n HTMLAttributes<HTMLElement>,\n \"children\" | \"onChange\"\n> & {\n query?: KeepListQuery<TMeta>;\n value?: string;\n defaultValue?: string;\n onChange?: (tag?: string) => void;\n onValueChange?: (tag?: string) => void;\n allLabel?: ReactNode;\n ariaLabel?: string;\n renderTag?: (tag: string, count: number, selected: boolean) => ReactNode;\n render?: RenderProp<KeepTagFilterState>;\n children?: ReactNode | RenderProp<KeepTagFilterState>;\n asChild?: boolean;\n};\n\n/** An ARIA button group for tag filtering; consumers can connect value to a collection query. */\nexport function KeepTagFilter<TMeta = Record<string, unknown>>({\n query,\n value: controlledValue,\n defaultValue,\n onChange,\n onValueChange,\n allLabel,\n ariaLabel,\n renderTag,\n render,\n children,\n asChild = false,\n className,\n ...rootProps\n}: KeepTagFilterProps<TMeta>) {\n const uiAllLabel = useUiLabel(\"allTags\");\n const uiAriaLabel = useUiLabel(\"filterTags\");\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const resolvedValue = controlledValue ?? uncontrolledValue;\n const list = useKeepList<TMeta>({\n ...query,\n tags: resolvedValue ? [...(query?.tags ?? []), resolvedValue] : query?.tags,\n });\n const select = useCallback(\n (tag?: string) => {\n if (controlledValue === undefined) setUncontrolledValue(tag);\n onChange?.(tag);\n onValueChange?.(tag);\n },\n [controlledValue, onChange, onValueChange],\n );\n const state = useMemo<KeepTagFilterState>(\n () => ({ tags: list.tags, tagCounts: list.tagCounts, value: resolvedValue, select }),\n [list.tagCounts, list.tags, resolvedValue, select],\n );\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const body = render\n ? render(state)\n : typeof contentChildren === \"function\"\n ? contentChildren(state)\n : (contentChildren ?? (\n <fieldset>\n <legend>{ariaLabel ?? uiAriaLabel}</legend>\n <button type=\"button\" aria-pressed={resolvedValue === undefined} onClick={() => select()}>\n {allLabel ?? uiAllLabel}\n </button>\n {list.tags.map((tag) => (\n <button key={tag} type=\"button\" aria-pressed={resolvedValue === tag} onClick={() => select(tag)}>\n {renderTag ? renderTag(tag, list.tagCounts[tag] ?? 0, resolvedValue === tag) : tag}\n <span> ({list.tagCounts[tag] ?? 0})</span>\n </button>\n ))}\n </fieldset>\n ));\n return renderRoot(\n asChild,\n isValidElement(children) ? children : undefined,\n { ...rootProps, className },\n body,\n \"KeepTagFilter\",\n );\n}\n","\"use client\";\n\nimport type { KeepListQuery } from \"@keepkit/core/core\";\nimport { type InputHTMLAttributes, type ReactNode, type SelectHTMLAttributes, useEffect, useState } from \"react\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepSearchInputProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"value\" | \"defaultValue\" | \"onChange\"\n> & {\n value?: string;\n defaultValue?: string;\n /** Delay before notifying consumers; set to 0 to disable debouncing. */\n debounceMs?: number;\n onValueChange?: (value: string) => void;\n};\n\n/** A controlled/uncontrolled search field with a small built-in debounce. */\nexport function KeepSearchInput({\n value: controlledValue,\n defaultValue = \"\",\n debounceMs = 300,\n onValueChange,\n \"aria-label\": ariaLabel,\n placeholder,\n ...props\n}: KeepSearchInputProps) {\n const label = useUiLabel(\"search\");\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const value = controlledValue ?? uncontrolledValue;\n\n useEffect(() => {\n if (!onValueChange) return;\n if (debounceMs <= 0) {\n onValueChange(value);\n return;\n }\n const timer = window.setTimeout(() => onValueChange(value), debounceMs);\n return () => window.clearTimeout(timer);\n }, [debounceMs, onValueChange, value]);\n\n return (\n <input\n {...props}\n type=\"search\"\n value={value}\n aria-label={ariaLabel ?? label}\n placeholder={placeholder ?? label}\n onChange={(event) => {\n const nextValue = event.currentTarget.value;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n }}\n />\n );\n}\n\nexport type KeepSortValue = \"savedAt:desc\" | \"savedAt:asc\" | \"updatedAt:desc\" | \"updatedAt:asc\";\n\nexport type KeepSortSelectProps = Omit<\n SelectHTMLAttributes<HTMLSelectElement>,\n \"value\" | \"defaultValue\" | \"onChange\"\n> & {\n value?: KeepSortValue;\n defaultValue?: KeepSortValue;\n onValueChange?: (value: KeepSortValue, sort: NonNullable<KeepListQuery[\"sort\"]>) => void;\n};\n\n/** Emits a normalized sort descriptor that can be passed directly to useKeepList. */\nexport function KeepSortSelect({\n value: controlledValue,\n defaultValue = \"updatedAt:desc\",\n onValueChange,\n \"aria-label\": ariaLabel,\n children,\n ...props\n}: KeepSortSelectProps) {\n const label = useUiLabel(\"sort\");\n const updatedNewestLabel = useUiLabel(\"updatedNewest\");\n const updatedOldestLabel = useUiLabel(\"updatedOldest\");\n const savedNewestLabel = useUiLabel(\"savedNewest\");\n const savedOldestLabel = useUiLabel(\"savedOldest\");\n const [uncontrolledValue, setUncontrolledValue] = useState<KeepSortValue>(defaultValue);\n const value = controlledValue ?? uncontrolledValue;\n const options = children ?? (\n <>\n <option value=\"updatedAt:desc\">{updatedNewestLabel}</option>\n <option value=\"updatedAt:asc\">{updatedOldestLabel}</option>\n <option value=\"savedAt:desc\">{savedNewestLabel}</option>\n <option value=\"savedAt:asc\">{savedOldestLabel}</option>\n </>\n );\n return (\n <select\n {...props}\n value={value}\n aria-label={ariaLabel ?? label}\n onChange={(event) => {\n const nextValue = event.currentTarget.value as KeepSortValue;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n const [by, direction] = nextValue.split(\":\") as [\"savedAt\" | \"updatedAt\", \"asc\" | \"desc\"];\n onValueChange?.(nextValue, { by, direction });\n }}\n >\n {options}\n </select>\n );\n}\n\nexport type KeepPaginationState = { page: number; pageCount: number; goToPage: (page: number) => void };\n\nexport type KeepPaginationProps = Omit<React.HTMLAttributes<HTMLElement>, \"children\"> & {\n totalCount: number;\n pageSize: number;\n page?: number;\n maxPageButtons?: number;\n onPageChange?: (page: number, offset: number) => void;\n render?: (state: KeepPaginationState) => ReactNode;\n};\n\n/** Accessible pagination with previous/next controls and numbered page buttons. */\nexport function KeepPagination({\n totalCount,\n pageSize,\n page = 1,\n maxPageButtons = 7,\n onPageChange,\n render,\n ...props\n}: KeepPaginationProps) {\n const previousPageLabel = useUiLabel(\"previousPage\");\n const nextPageLabel = useUiLabel(\"nextPage\");\n const pageLabel = useUiLabel(\"page\");\n const paginationLabel = useUiLabel(\"pagination\");\n const pageCount = Math.max(1, Math.ceil(totalCount / Math.max(1, pageSize)));\n const currentPage = Math.min(Math.max(1, page), pageCount);\n const goToPage = (nextPage: number) => {\n const next = Math.min(Math.max(1, nextPage), pageCount);\n onPageChange?.(next, (next - 1) * pageSize);\n };\n const navProps = { ...props, \"aria-label\": props[\"aria-label\"] ?? paginationLabel };\n if (render) return <nav {...navProps}>{render({ page: currentPage, pageCount, goToPage })}</nav>;\n const visiblePages = getVisiblePages(currentPage, pageCount, Math.max(1, maxPageButtons));\n return (\n <nav {...navProps}>\n <button type=\"button\" onClick={() => goToPage(currentPage - 1)} disabled={currentPage <= 1}>\n {previousPageLabel}\n </button>\n {visiblePages.map((nextPage) => (\n <button\n key={nextPage}\n type=\"button\"\n aria-current={nextPage === currentPage ? \"page\" : undefined}\n aria-label={`${pageLabel} ${nextPage}`}\n onClick={() => goToPage(nextPage)}\n >\n {nextPage}\n </button>\n ))}\n <button type=\"button\" onClick={() => goToPage(currentPage + 1)} disabled={currentPage >= pageCount}>\n {nextPageLabel}\n </button>\n </nav>\n );\n}\n\nfunction getVisiblePages(currentPage: number, pageCount: number, maxPageButtons: number): number[] {\n if (pageCount <= maxPageButtons) return Array.from({ length: pageCount }, (_, index) => index + 1);\n const half = Math.floor(maxPageButtons / 2);\n const start = Math.min(Math.max(1, currentPage - half), pageCount - maxPageButtons + 1);\n return Array.from({ length: maxPageButtons }, (_, index) => start + index);\n}\n","\"use client\";\n\nimport type { KeepItem } from \"@keepkit/core/core\";\nimport { useKeepItem } from \"@keepkit/core/react\";\nimport {\n type FormHTMLAttributes,\n isValidElement,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { type RenderProp, renderRoot } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepNoteEditorState<TMeta = Record<string, unknown>> = {\n item: KeepItem<TMeta>;\n note: string;\n setNote: (note: string) => void;\n isDirty: boolean;\n isSaving: boolean;\n error: unknown | null;\n save: () => Promise<void>;\n};\n\nexport type KeepNoteEditorProps<TMeta = Record<string, unknown>> = Omit<\n FormHTMLAttributes<HTMLFormElement>,\n \"children\" | \"onSubmit\"\n> & {\n item: KeepItem<TMeta>;\n label?: ReactNode;\n saveLabel?: ReactNode;\n placeholder?: string;\n /** Automatically save dirty notes after this delay; set to 0 to disable auto-save. */\n debounceMs?: number;\n onSaved?: (note?: string) => void;\n onSaveError?: (error: unknown) => void;\n render?: RenderProp<KeepNoteEditorState<TMeta>>;\n children?: ReactNode | RenderProp<KeepNoteEditorState<TMeta>>;\n asChild?: boolean;\n};\n\n/** A controlled-by-default note editor that persists through useKeepItem. */\nexport function KeepNoteEditor<TMeta = Record<string, unknown>>({\n item,\n label,\n saveLabel,\n placeholder,\n debounceMs = 300,\n onSaved,\n onSaveError,\n render,\n children,\n asChild = false,\n className,\n ...formProps\n}: KeepNoteEditorProps<TMeta>) {\n const defaultLabel = useUiLabel(\"note\");\n const defaultSaveLabel = useUiLabel(\"saveNote\");\n const itemState = useKeepItem<TMeta>(item);\n const { error, isMutating, item: savedItem, updateNote } = itemState;\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const [note, setNote] = useState(item.note ?? \"\");\n const baselineNote = savedItem?.note ?? item.note ?? \"\";\n const isDirty = note !== baselineNote;\n const lastSavedNoteRef = useRef<string | undefined>(undefined);\n useEffect(() => setNote(baselineNote), [baselineNote]);\n const save = useCallback(async () => {\n const nextNote = note.trim() || undefined;\n try {\n await updateNote(nextNote);\n lastSavedNoteRef.current = note;\n onSaved?.(nextNote);\n } catch (error) {\n onSaveError?.(error);\n throw error;\n }\n }, [note, onSaveError, onSaved, updateNote]);\n useEffect(() => {\n if (!isDirty || debounceMs <= 0 || lastSavedNoteRef.current === note) return;\n const timer = window.setTimeout(() => void save().catch(() => undefined), debounceMs);\n return () => window.clearTimeout(timer);\n }, [debounceMs, isDirty, note, save]);\n const state: KeepNoteEditorState<TMeta> = {\n item,\n note,\n setNote,\n isDirty,\n isSaving: isMutating,\n error,\n save,\n };\n const body = render\n ? render(state)\n : typeof contentChildren === \"function\"\n ? contentChildren(state)\n : (contentChildren ?? (\n <>\n <label>\n {label ?? defaultLabel}\n <textarea\n value={note}\n onChange={(event) => setNote(event.currentTarget.value)}\n placeholder={placeholder}\n disabled={isMutating}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n void save().catch(() => undefined);\n }\n }}\n />\n </label>\n <button type=\"submit\" disabled={isMutating} aria-busy={isMutating}>\n {saveLabel ?? defaultSaveLabel}\n </button>\n </>\n ));\n const handleSubmit: FormHTMLAttributes<HTMLFormElement>[\"onSubmit\"] = (event) => {\n event.preventDefault();\n void save().catch(() => undefined);\n };\n if (!asChild) {\n return (\n <form\n {...formProps}\n className={className}\n onSubmit={handleSubmit}\n aria-busy={isMutating || formProps[\"aria-busy\"]}\n >\n {body}\n </form>\n );\n }\n return renderRoot(\n true,\n isValidElement(children) ? children : undefined,\n { ...formProps, className, onSubmit: handleSubmit, \"aria-busy\": isMutating || formProps[\"aria-busy\"] },\n body,\n \"KeepNoteEditor\",\n );\n}\n","\"use client\";\n\nimport type { KeepItem } from \"@keepkit/core/core\";\nimport { useKeepItem } from \"@keepkit/core/react\";\nimport { type FormHTMLAttributes, useCallback, useEffect, useState } from \"react\";\nimport { normalizeUiTags, type RenderProp } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepTagEditorState = {\n tags: string[];\n setTags: (tags: string[]) => void;\n save: () => Promise<void>;\n isSaving: boolean;\n};\n\nexport type KeepTagEditorProps<TMeta = Record<string, unknown>> = Omit<\n FormHTMLAttributes<HTMLFormElement>,\n \"children\" | \"onSubmit\"\n> & {\n item: KeepItem<TMeta>;\n availableTags?: string[];\n onSaved?: (tags?: string[]) => void;\n onSaveError?: (error: unknown) => void;\n render?: RenderProp<KeepTagEditorState>;\n};\n\n/** Edits one item's normalized tag set; Enter adds and Backspace removes the last tag. */\nexport function KeepTagEditor<TMeta = Record<string, unknown>>({\n item,\n availableTags = [],\n onSaved,\n onSaveError,\n render,\n ...props\n}: KeepTagEditorProps<TMeta>) {\n const tagsLabel = useUiLabel(\"tagsToApply\");\n const removeLabel = useUiLabel(\"remove\");\n const applyTagsLabel = useUiLabel(\"applyTags\");\n const itemState = useKeepItem<TMeta>(item);\n const [tags, setTags] = useState(item.tags ?? []);\n const [input, setInput] = useState(\"\");\n useEffect(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);\n const save = useCallback(async () => {\n const nextTags = normalizeUiTags(tags);\n try {\n await itemState.updateTags(nextTags);\n setTags(nextTags);\n onSaved?.(nextTags);\n } catch (error) {\n onSaveError?.(error);\n throw error;\n }\n }, [itemState, onSaveError, onSaved, tags]);\n const addTag = (tag: string) => {\n setTags(normalizeUiTags([...tags, tag]));\n setInput(\"\");\n };\n const body = render ? (\n render({ tags, setTags, save, isSaving: itemState.isMutating })\n ) : (\n <>\n <label>\n {tagsLabel}\n <input\n value={input}\n list={availableTags.length > 0 ? `keep-tags-${item.id}` : undefined}\n onChange={(event) => setInput(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n event.preventDefault();\n if (input.trim()) addTag(input);\n } else if (event.key === \"Backspace\" && input.length === 0 && tags.length > 0) {\n event.preventDefault();\n setTags(tags.slice(0, -1));\n }\n }}\n />\n </label>\n {availableTags.length > 0 ? (\n <datalist id={`keep-tags-${item.id}`}>\n {availableTags.map((tag) => (\n <option key={tag} value={tag} />\n ))}\n </datalist>\n ) : null}\n <ul aria-label={tagsLabel}>\n {tags.map((tag) => (\n <li key={tag}>\n {tag}\n <button type=\"button\" onClick={() => setTags(tags.filter((current) => current !== tag))}>\n {removeLabel}\n </button>\n </li>\n ))}\n </ul>\n <button type=\"submit\" disabled={itemState.isMutating} aria-busy={itemState.isMutating}>\n {applyTagsLabel}\n </button>\n </>\n );\n return (\n <form\n {...props}\n onSubmit={(event) => {\n event.preventDefault();\n void save().catch(() => undefined);\n }}\n aria-busy={itemState.isMutating || props[\"aria-busy\"]}\n >\n {body}\n </form>\n );\n}\n","\"use client\";\n\nimport type { KeepChangeContext, KeepItem } from \"@keepkit/core/core\";\nimport { useKeepContext } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, isValidElement, type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { type RenderProp, renderRoot } from \"./shared\";\nimport { type KeepUiLabelKey, useUiLabel } from \"./ui-context\";\n\nexport type KeepEmptyStateProps = Omit<HTMLAttributes<HTMLElement>, \"children\" | \"title\"> & {\n title?: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n children?: ReactNode;\n asChild?: boolean;\n};\n\n/** A style-free, reusable empty collection state. */\nexport function KeepEmptyState({\n title,\n description,\n action,\n children,\n asChild = false,\n className,\n ...rootProps\n}: KeepEmptyStateProps) {\n const defaultTitle = useUiLabel(\"noItems\").replace(/\\.$/, \"\");\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const body = contentChildren ?? (\n <>\n <h2>{title ?? defaultTitle}</h2>\n {description ? <p>{description}</p> : null}\n {action}\n </>\n );\n return renderRoot(asChild, children, { ...rootProps, className }, body, \"KeepEmptyState\");\n}\n\nexport type KeepStatusValue = \"idle\" | \"empty\" | \"loading\" | \"saving\" | \"syncing\" | \"error\";\nexport type KeepStatusLabels = Partial<Record<KeepStatusValue, ReactNode>>;\n\nexport type KeepStatusState<TMeta = Record<string, unknown>> = {\n status: KeepStatusValue;\n error: unknown | null;\n pendingCount: number;\n items: KeepItem<TMeta>[];\n};\n\nexport type KeepStatusProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n status?: KeepStatusValue;\n labels?: KeepStatusLabels;\n children?: ReactNode | RenderProp<KeepStatusState<TMeta>>;\n render?: RenderProp<KeepStatusState<TMeta>>;\n asChild?: boolean;\n};\n\n/** Presents provider loading, mutation, synchronization, empty, and error states accessibly. */\nexport function KeepStatus<TMeta = Record<string, unknown>>({\n status,\n labels,\n children,\n render,\n asChild = false,\n className,\n ...rootProps\n}: KeepStatusProps<TMeta>) {\n const context = useKeepContext<TMeta>();\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const resolvedStatus = status ?? getDerivedStatus(context);\n const defaultLabel = useUiLabel(getStatusLabelKey(resolvedStatus));\n const state: KeepStatusState<TMeta> = {\n status: resolvedStatus,\n error: context.error,\n pendingCount: context.syncState.pendingCount,\n items: context.items,\n };\n const body = render\n ? render(state)\n : typeof contentChildren === \"function\"\n ? contentChildren(state)\n : (contentChildren ?? labels?.[resolvedStatus] ?? defaultLabel);\n const role = rootProps.role ?? (resolvedStatus === \"error\" ? \"alert\" : \"status\");\n return renderRoot(\n asChild,\n isValidElement(children) ? children : undefined,\n { ...rootProps, className, role, \"aria-live\": rootProps[\"aria-live\"] ?? \"polite\" },\n body,\n \"KeepStatus\",\n );\n}\n\nexport type KeepAnnouncementsProps = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n messages?: Partial<Record<\"save\" | \"remove\" | \"note\", string>>;\n};\n\n/** Announces successful save, remove, and note operations in a polite live region. */\nexport function KeepAnnouncements<TMeta = Record<string, unknown>>({ messages, ...props }: KeepAnnouncementsProps) {\n const context = useKeepContext<TMeta>();\n const savedMessage = useUiLabel(\"savedMessage\", messages?.save);\n const removedMessage = useUiLabel(\"removedMessage\", messages?.remove);\n const noteSavedMessage = useUiLabel(\"noteSavedMessage\", messages?.note);\n const [message, setMessage] = useState(\"\");\n const lastChangeRef = useRef<KeepChangeContext<TMeta> | undefined>(undefined);\n useEffect(() => {\n const change = context.lastChange;\n if (!change || change === lastChangeRef.current) return;\n lastChangeRef.current = change;\n if (change.action === \"save\") setMessage(savedMessage);\n else if (change.action === \"remove\" || change.action === \"removeBatch\") setMessage(removedMessage);\n else if (change.action === \"updateNote\") setMessage(noteSavedMessage);\n }, [context.lastChange, noteSavedMessage, removedMessage, savedMessage]);\n return (\n <div {...props} role={props.role ?? \"status\"} aria-live={props[\"aria-live\"] ?? \"polite\"} aria-atomic=\"true\">\n {message}\n </div>\n );\n}\n\n/** Singular alias for applications that mount one announcer explicitly. */\nexport const KeepAnnouncer = KeepAnnouncements;\n\nfunction getDerivedStatus<TMeta>(context: ReturnType<typeof useKeepContext<TMeta>>): KeepStatusValue {\n if (context.error) return \"error\";\n if (context.syncState.status === \"pending\" || context.syncState.status === \"syncing\") return \"syncing\";\n if (context.isMutating) return \"saving\";\n if (context.isLoading && !context.isHydrated) return \"loading\";\n if (context.isHydrated && context.items.length === 0) return \"empty\";\n return \"idle\";\n}\n\nfunction getStatusLabelKey(status: KeepStatusValue): KeepUiLabelKey {\n if (status === \"empty\") return \"noItems\";\n if (status === \"loading\") return \"loadingItems\";\n if (status === \"error\") return \"error\";\n if (status === \"saving\") return \"saving\";\n if (status === \"syncing\") return \"syncing\";\n return \"saved\";\n}\n"],"mappings":";;;AAGA;AAAA,EAEE,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,OAMZ;;;ACTP,SAAS,mBAAmB;AAC5B,SAA8C,gBAAgB;;;ACuB1D;AAXG,SAAS,iBAAkD;AAAA,EAChE;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,GAAG;AACL,GAAiC;AAC/B,QAAM,YAAY,aAAa,IAAI,KAAK,KAAK;AAC7C,QAAM,kBAAkB,cAAc,OAAO,UAAU,WAAW,QAAQ;AAC1E,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,MAAK;AAAA,MACL;AAAA,MACA,cAAY;AAAA,MACZ,UAAU,CAAC,UAAU,kBAAkB,MAAM,cAAc,OAAO;AAAA;AAAA,EACpE;AAEJ;AAEA,SAAS,aAAoB,MAA2C;AACtE,MAAI,OAAO,KAAK,SAAS,YAAY,KAAK,SAAS,QAAQ,EAAE,WAAW,KAAK,MAAO,QAAO;AAC3F,QAAM,QAAS,KAAK,KAA6B;AACjD,SAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI;AACpE;;;ACtCA;AAAA,EACE;AAAA,EAGA;AAAA,OAGK;AAyDE,gBAAAA,YAAA;AAvCF,SAAS,iBAAwB,MAA6C;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ACK;AApBD,SAEE,OAAAC,OAFF,QAAAC,aAAA;AATC,SAAS,gBAAiD;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAgC;AAC9B,SACE,gBAAAD,MAAC,kBAAe,QAAgB,QAAgB,eAC9C,0BAAAC,MAAC,oBAAyB,GAAG,eAC1B;AAAA;AAAA,IACD,gBAAAD,MAAC,qBAAkB;AAAA,KACrB,GACF;AAEJ;AAyFO,SAAS,cACd,UAAuC,CAAC,GACxB;AAChB,QAAM,EAAE,QAAQ,QAAQ,eAAe,UAAU,eAAe,GAAG,YAAY,IAAI;AACnF,QAAM,UAAU,kBAAyB,WAAW;AACpD,SAAO;AAAA,IACL,UAAU,CAAC,UACT,gBAAAE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,IAEF,QAAQ,CAAC,UAAU,gBAAAA,MAAC,cAAmB,GAAG,OAAO;AAAA,IACjD,YAAY,CAAC,UACX,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,eAAe;AAAA,UACb,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;AAAA,UAC/B,GAAI,gBAAgB,EAAE,cAAc,IAAI,CAAC;AAAA,UACzC,GAAG,MAAM;AAAA,QACX;AAAA;AAAA,IACF;AAAA,IAEF,YAAY,MAAM,QAAQ,WAAW;AAAA,IACrC,SAAS,CAAC,SAAS,QAAQ,QAAQ,IAAI;AAAA,IACvC,SAAS,CAAC,UAAU,QAAQ,QAAQ,KAAK;AAAA,IACzC,aAAa,CAAC,oBAAoB,QAAQ,YAAY,eAAe;AAAA,EACvE;AACF;","names":["jsx","jsx","jsx","Fragment","jsx","useKeepList","useMemo","useState","useKeepList","isValidElement","useKeepItem","isValidElement","Fragment","jsx","jsxs","useKeepItem","isValidElement","jsx","useKeepList","isValidElement","useKeepList","isValidElement","useMemo","useState","jsx","jsxs","useState","useKeepList","useMemo","isValidElement","useState","Fragment","jsx","jsxs","useState","jsx","jsxs","useState","useMemo","useKeepList","useKeepItem","isValidElement","useCallback","useEffect","useState","Fragment","jsx","jsxs","useKeepItem","isValidElement","useState","useEffect","useCallback","error","useKeepItem","useCallback","useEffect","useState","Fragment","jsx","jsxs","useKeepItem","useState","useEffect","useCallback","isValidElement","useEffect","useRef","useState","Fragment","jsx","jsxs","isValidElement","useState","useRef","useEffect","useKeepContext","useKeepItem","useKeepList","jsx","jsxs","jsx"]}
1
+ {"version":3,"sources":["../src/index.tsx","../src/KeepBulkActions.tsx","../src/KeepItemCheckbox.tsx","../src/shared.tsx","../src/ui-context.tsx","../src/KeepButton.tsx","../src/KeepCollection.tsx","../src/KeepList.tsx","../src/KeepItemCard.tsx","../src/KeepTagFilter.tsx","../src/query-controls.tsx","../src/KeepNoteEditor.tsx","../src/KeepTagEditor.tsx","../src/status.tsx"],"sourcesContent":["\"use client\";\n\nimport type { KeepItem, KeepItemInput, KeepListQuery } from \"@keepkit/core/core\";\nimport {\n type CreateKeepKitOptions as CoreCreateKeepKitOptions,\n KeepProvider as CoreKeepProvider,\n createKeepKit as createCoreKeepKit,\n type KeepProviderProps,\n type KeepShortcutOptions,\n type useKeepContext,\n type useKeepItem,\n type useKeepList,\n} from \"@keepkit/core/react\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState } from \"./KeepBulkActions\";\nimport { KeepButton, type KeepButtonLabels, type KeepButtonProps } from \"./KeepButton\";\nimport { KeepCollection, type KeepCollectionFeature, type KeepCollectionProps } from \"./KeepCollection\";\nimport { type KeepImageProps, KeepItemCard, type KeepItemCardProps, type KeepItemCardState } from \"./KeepItemCard\";\nimport { KeepItemCheckbox, type KeepItemCheckboxProps } from \"./KeepItemCheckbox\";\nimport { KeepList, type KeepListProps, type KeepListState } from \"./KeepList\";\nimport { KeepNoteEditor, type KeepNoteEditorProps, type KeepNoteEditorState } from \"./KeepNoteEditor\";\nimport { KeepTagEditor, type KeepTagEditorProps, type KeepTagEditorState } from \"./KeepTagEditor\";\nimport { KeepTagFilter, type KeepTagFilterProps, type KeepTagFilterState } from \"./KeepTagFilter\";\nimport {\n KeepPagination,\n type KeepPaginationProps,\n type KeepPaginationState,\n KeepSearchInput,\n type KeepSearchInputProps,\n KeepSortSelect,\n type KeepSortSelectProps,\n type KeepSortValue,\n} from \"./query-controls\";\nimport {\n KeepAnnouncements,\n type KeepAnnouncementsProps,\n KeepAnnouncer,\n KeepEmptyState,\n type KeepEmptyStateProps,\n KeepStatus,\n type KeepStatusLabels,\n type KeepStatusProps,\n type KeepStatusState,\n type KeepStatusValue,\n} from \"./status\";\nimport {\n type KeepUiLabelContext,\n type KeepUiLabelKey,\n type KeepUiLabels,\n KeepUiProvider,\n type KeepUiProviderProps,\n useKeepUiLabels,\n} from \"./ui-context\";\n\nexport type KeepKitProviderProps<TMeta = Record<string, unknown>> = Omit<KeepProviderProps<TMeta>, \"children\"> &\n Omit<KeepUiProviderProps, \"children\"> & { children?: ReactNode };\n\n/** Combines the core store, UI labels, and the global live announcer. */\nexport function KeepKitProvider<TMeta = Record<string, unknown>>({\n labels,\n locale,\n labelResolver,\n children,\n ...providerProps\n}: KeepKitProviderProps<TMeta>) {\n return (\n <KeepUiProvider labels={labels} locale={locale} labelResolver={labelResolver}>\n <CoreKeepProvider<TMeta> {...providerProps}>\n {children}\n <KeepAnnouncements />\n </CoreKeepProvider>\n </KeepUiProvider>\n );\n}\n\nexport type { KeepItem, KeepItemInput, KeepListQuery, KeepSyncStatus } from \"@keepkit/core/core\";\nexport type { KeepButtonState, KeepContextValue, KeepProviderProps, KeepShortcutOptions } from \"@keepkit/core/react\";\nexport { KeepProvider, useKeepContext, useKeepItem, useKeepList, useKeepShortcut } from \"@keepkit/core/react\";\nexport {\n createBrowserStorageAdapter,\n createStorageAdapter,\n FallbackStorageAdapter,\n IndexedDBAdapter,\n IndexedDBSyncQueueAdapter,\n LocalStorageAdapter,\n LocalStorageSyncQueueAdapter,\n SyncStorageAdapter,\n} from \"@keepkit/core/storage\";\nexport { isAllSelected, toggleSelectAll } from \"./KeepBulkActions\";\nexport type { RenderProp } from \"./shared\";\nexport type {\n KeepAnnouncementsProps,\n KeepBulkActionsProps,\n KeepBulkActionsState,\n KeepButtonLabels,\n KeepButtonProps,\n KeepCollectionFeature,\n KeepCollectionProps,\n KeepEmptyStateProps,\n KeepImageProps,\n KeepItemCardProps,\n KeepItemCardState,\n KeepItemCheckboxProps,\n KeepListProps,\n KeepListState,\n KeepNoteEditorProps,\n KeepNoteEditorState,\n KeepPaginationProps,\n KeepPaginationState,\n KeepSearchInputProps,\n KeepSortSelectProps,\n KeepSortValue,\n KeepStatusLabels,\n KeepStatusProps,\n KeepStatusState,\n KeepStatusValue,\n KeepTagEditorProps,\n KeepTagEditorState,\n KeepTagFilterProps,\n KeepTagFilterState,\n KeepUiLabelContext,\n KeepUiLabelKey,\n KeepUiLabels,\n KeepUiProviderProps,\n};\nexport {\n KeepAnnouncements,\n KeepAnnouncer,\n KeepBulkActions,\n KeepButton,\n KeepCollection,\n KeepEmptyState,\n KeepItemCard,\n KeepItemCheckbox,\n KeepList,\n KeepNoteEditor,\n KeepPagination,\n KeepSearchInput,\n KeepSortSelect,\n KeepStatus,\n KeepTagEditor,\n KeepTagFilter,\n KeepUiProvider,\n useKeepUiLabels,\n};\n\nexport type CreateKeepKitOptions<TMeta = Record<string, unknown>> = CoreCreateKeepKitOptions<TMeta> &\n Omit<KeepUiProviderProps, \"children\"> & {\n getTitle?: (item: KeepItem<TMeta>) => ReactNode;\n getImageProps?: (item: KeepItem<TMeta>, title: ReactNode) => KeepImageProps | undefined;\n };\n\nexport type KeepKit<TMeta = Record<string, unknown>> = {\n Provider: ComponentType<KeepKitProviderProps<TMeta>>;\n Button: ComponentType<KeepButtonProps<TMeta>>;\n Collection: ComponentType<KeepCollectionProps<TMeta>>;\n useContext: () => ReturnType<typeof useKeepContext<TMeta>>;\n useItem: (item?: KeepItemInput<TMeta>) => ReturnType<typeof useKeepItem<TMeta>>;\n useList: (query?: KeepListQuery<TMeta>) => ReturnType<typeof useKeepList<TMeta>>;\n useShortcut: (options: KeepShortcutOptions<TMeta>) => void;\n};\n\n/** Create one typed application API for the core and standard UI layer. */\nexport function createKeepKit<TMeta = Record<string, unknown>>(\n options: CreateKeepKitOptions<TMeta> = {},\n): KeepKit<TMeta> {\n const { labels, locale, labelResolver, getTitle, getImageProps, ...coreOptions } = options;\n const coreKit = createCoreKeepKit<TMeta>(coreOptions);\n return {\n Provider: (props) => (\n <KeepKitProvider<TMeta>\n {...coreOptions}\n labels={labels}\n locale={locale}\n labelResolver={labelResolver}\n {...props}\n />\n ),\n Button: (props) => <KeepButton<TMeta> {...props} />,\n Collection: (props) => (\n <KeepCollection<TMeta>\n {...props}\n itemCardProps={{\n ...(getTitle ? { getTitle } : {}),\n ...(getImageProps ? { getImageProps } : {}),\n ...props.itemCardProps,\n }}\n />\n ),\n useContext: () => coreKit.useContext(),\n useItem: (item) => coreKit.useItem(item),\n useList: (query) => coreKit.useList(query),\n useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions),\n };\n}\n","\"use client\";\n\nimport type { KeepItem, KeepListQuery } from \"@keepkit/core/core\";\nimport { useKeepList } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, type ReactNode, useState } from \"react\";\nimport { KeepItemCheckbox } from \"./KeepItemCheckbox\";\nimport { getMetaTitle, normalizeUiTags, type RenderProp } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepBulkActionsState<TMeta = Record<string, unknown>> = {\n items: KeepItem<TMeta>[];\n selectedIds: string[];\n selectedCount: number;\n isAllSelected: boolean;\n allSelected: boolean;\n tagsInput: string;\n setTagsInput: (value: string) => void;\n toggle: (id: string) => void;\n toggleSelectAll: () => void;\n toggleAll: () => void;\n remove: () => Promise<void>;\n updateTags: () => Promise<void>;\n isMutating: boolean;\n};\n\n/** Returns whether every visible item is selected. Empty lists are never all selected. */\nexport function isAllSelected<TMeta>(\n items: readonly Pick<KeepItem<TMeta>, \"id\">[],\n selectedIds: readonly string[],\n): boolean {\n if (items.length === 0) return false;\n const selected = new Set(selectedIds);\n return items.every((item) => selected.has(item.id));\n}\n\n/** Toggles only the visible items, preserving selections outside the current query or page. */\nexport function toggleSelectAll<TMeta>(\n items: readonly Pick<KeepItem<TMeta>, \"id\">[],\n selectedIds: readonly string[],\n): string[] {\n const visibleIds = new Set(items.map((item) => item.id));\n if (isAllSelected(items, selectedIds)) return selectedIds.filter((id) => !visibleIds.has(id));\n const nextIds = [...selectedIds];\n for (const item of items) {\n if (!nextIds.includes(item.id)) nextIds.push(item.id);\n }\n return nextIds;\n}\n\nexport type KeepBulkActionsProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n query?: KeepListQuery<TMeta>;\n selectedIds?: string[];\n defaultSelectedIds?: string[];\n onSelectedIdsChange?: (ids: string[]) => void;\n renderItem?: (item: KeepItem<TMeta>, selected: boolean) => ReactNode;\n onCompleted?: (action: \"remove\" | \"tags\", ids: string[]) => void;\n render?: RenderProp<KeepBulkActionsState<TMeta>>;\n children?: ReactNode | RenderProp<KeepBulkActionsState<TMeta>>;\n};\n\n/** Selects visible items and performs one storage operation for the whole selection. */\nexport function KeepBulkActions<TMeta = Record<string, unknown>>({\n query,\n selectedIds: controlledSelectedIds,\n defaultSelectedIds = [],\n onSelectedIdsChange,\n renderItem,\n onCompleted,\n render,\n children,\n ...props\n}: KeepBulkActionsProps<TMeta>) {\n const selectItemsLabel = useUiLabel(\"selectItems\");\n const selectedCountLabel = useUiLabel(\"selectedCount\");\n const deleteSelectedLabel = useUiLabel(\"deleteSelected\");\n const tagsLabel = useUiLabel(\"tagsToApply\");\n const applyTagsLabel = useUiLabel(\"applyTags\");\n const list = useKeepList<TMeta>(query);\n const [uncontrolledSelectedIds, setUncontrolledSelectedIds] = useState(defaultSelectedIds);\n const selectedIds = controlledSelectedIds ?? uncontrolledSelectedIds;\n const selected = new Set(selectedIds);\n const [tagsInput, setTagsInput] = useState(\"\");\n const setSelectedIds = (ids: string[]) => {\n if (controlledSelectedIds === undefined) setUncontrolledSelectedIds(ids);\n onSelectedIdsChange?.(ids);\n };\n const toggle = (id: string) =>\n setSelectedIds(selected.has(id) ? selectedIds.filter((current) => current !== id) : [...selectedIds, id]);\n const allSelected = isAllSelected(list.items, selectedIds);\n const toggleAll = () => setSelectedIds(toggleSelectAll(list.items, selectedIds));\n const remove = async () => {\n const ids = [...selectedIds];\n await list.removeBatch(ids);\n onCompleted?.(\"remove\", ids);\n setSelectedIds([]);\n };\n const updateTags = async () => {\n const ids = [...selectedIds];\n await list.updateTagsBatch(ids, normalizeUiTags(tagsInput.split(\",\")));\n onCompleted?.(\"tags\", ids);\n setSelectedIds([]);\n };\n const state: KeepBulkActionsState<TMeta> = {\n items: list.items,\n selectedIds,\n selectedCount: selectedIds.length,\n isAllSelected: allSelected,\n allSelected,\n tagsInput,\n setTagsInput,\n toggle,\n toggleSelectAll: toggleAll,\n toggleAll,\n remove,\n updateTags,\n isMutating: list.isMutating,\n };\n const body = render\n ? render(state)\n : typeof children === \"function\"\n ? children(state)\n : (children ?? (\n <>\n <fieldset>\n <legend>{selectItemsLabel}</legend>\n <label>\n <input type=\"checkbox\" checked={allSelected} onChange={toggleAll} aria-label={selectItemsLabel} />\n {selectedIds.length} {selectedCountLabel}\n </label>\n {list.items.map((item) => (\n <span key={item.id}>\n <KeepItemCheckbox\n item={item}\n checked={selected.has(item.id)}\n onCheckedChange={() => toggle(item.id)}\n />\n {renderItem ? renderItem(item, selected.has(item.id)) : (getMetaTitle(item.meta) ?? item.id)}\n </span>\n ))}\n </fieldset>\n <button type=\"button\" onClick={() => void remove()} disabled={selectedIds.length === 0 || list.isMutating}>\n {deleteSelectedLabel}\n </button>\n <label>\n {tagsLabel}\n <input value={tagsInput} onChange={(event) => setTagsInput(event.currentTarget.value)} />\n </label>\n <button\n type=\"button\"\n onClick={() => void updateTags()}\n disabled={selectedIds.length === 0 || list.isMutating}\n >\n {applyTagsLabel}\n </button>\n </>\n ));\n return (\n <section {...props} aria-busy={list.isMutating || props[\"aria-busy\"]}>\n {body}\n </section>\n );\n}\n","\"use client\";\n\nimport type { KeepItem } from \"@keepkit/core/core\";\nimport type { InputHTMLAttributes, ReactNode } from \"react\";\n\nexport type KeepItemCheckboxProps<TMeta = Record<string, unknown>> = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"checked\" | \"defaultChecked\" | \"onChange\"\n> & {\n item: KeepItem<TMeta>;\n checked?: boolean;\n label?: ReactNode;\n onCheckedChange?: (checked: boolean) => void;\n};\n\n/** A reusable accessible selection checkbox for a saved item. */\nexport function KeepItemCheckbox<TMeta = Record<string, unknown>>({\n item,\n checked = false,\n label,\n onCheckedChange,\n \"aria-label\": ariaLabel,\n ...props\n}: KeepItemCheckboxProps<TMeta>) {\n const itemLabel = getItemLabel(item) ?? item.id;\n const accessibleLabel = ariaLabel ?? (typeof label === \"string\" ? label : itemLabel);\n return (\n <input\n {...props}\n type=\"checkbox\"\n checked={checked}\n aria-label={accessibleLabel}\n onChange={(event) => onCheckedChange?.(event.currentTarget.checked)}\n />\n );\n}\n\nfunction getItemLabel<TMeta>(item: KeepItem<TMeta>): string | undefined {\n if (typeof item.meta !== \"object\" || item.meta === null || !(\"title\" in item.meta)) return undefined;\n const title = (item.meta as { title?: unknown }).title;\n return typeof title === \"string\" && title.trim() ? title.trim() : undefined;\n}\n","\"use client\";\n\nimport type { KeepItem, KeepItemInput, KeepListQuery } from \"@keepkit/core/core\";\nimport {\n cloneElement,\n type HTMLAttributes,\n type ImgHTMLAttributes,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from \"react\";\n\nexport type RenderProp<TState> = (state: TState) => ReactNode;\n\nexport type KeepButtonLabels = {\n saved?: ReactNode;\n unsaved?: ReactNode;\n loading?: ReactNode;\n error?: ReactNode;\n savedAriaLabel?: string;\n unsavedAriaLabel?: string;\n};\n\nexport type KeepImageProps = ImgHTMLAttributes<HTMLImageElement> & {\n src: string;\n alt: string;\n};\n\nexport function toKeepButtonItem<TMeta>(item: KeepItem<TMeta>): KeepItemInput<TMeta> {\n return {\n id: item.id,\n meta: item.meta,\n targetType: item.targetType,\n note: item.note,\n tags: item.tags,\n };\n}\n\nexport function getMetaTitle<TMeta>(meta: TMeta): string | undefined {\n if (typeof meta !== \"object\" || meta === null || !(\"title\" in meta)) return undefined;\n const title = (meta as { title?: unknown }).title;\n return typeof title === \"string\" && title.trim() ? title.trim() : undefined;\n}\n\nexport function normalizeUiTags(tags: string[]): string[] {\n return [...new Set(tags.map((tag) => tag.trim()).filter(Boolean))];\n}\n\nexport function sortToValue(sort: KeepListQuery[\"sort\"]): `${\"savedAt\" | \"updatedAt\"}:${\"asc\" | \"desc\"}` {\n return `${sort?.by ?? \"updatedAt\"}:${sort?.direction ?? \"desc\"}`;\n}\n\nexport function resolveContent<TState>(content: ReactNode | RenderProp<TState>, state: TState): ReactNode {\n return typeof content === \"function\" ? content(state) : content;\n}\n\nexport function renderRoot(\n asChild: boolean,\n child: ReactNode,\n props: HTMLAttributes<HTMLElement> & Record<string, unknown>,\n body: ReactNode,\n componentName: string,\n): ReactElement {\n if (asChild) {\n if (!isValidElement(child)) throw new Error(`${componentName} with asChild requires a single React element child.`);\n return cloneElement(child as ReactElement<Record<string, unknown>>, { ...props, children: body });\n }\n return <div {...props}>{body}</div>;\n}\n","\"use client\";\n\nimport { createContext, type ReactNode, useContext, useMemo } from \"react\";\n\nexport type KeepUiLabelKey =\n | \"save\"\n | \"saved\"\n | \"remove\"\n | \"loading\"\n | \"saving\"\n | \"syncing\"\n | \"error\"\n | \"allTags\"\n | \"filterTags\"\n | \"note\"\n | \"saveNote\"\n | \"noItems\"\n | \"loadingItems\"\n | \"errorItems\"\n | \"search\"\n | \"sort\"\n | \"newest\"\n | \"oldest\"\n | \"savedNewest\"\n | \"savedOldest\"\n | \"updatedNewest\"\n | \"updatedOldest\"\n | \"previousPage\"\n | \"nextPage\"\n | \"pagination\"\n | \"page\"\n | \"selectItems\"\n | \"selectedCount\"\n | \"deleteSelected\"\n | \"tagsToApply\"\n | \"applyTags\"\n | \"savedMessage\"\n | \"removedMessage\"\n | \"noteSavedMessage\";\n\nexport type KeepUiLabels = Partial<Record<KeepUiLabelKey, string>>;\n\nexport type KeepUiLabelContext = {\n locale?: string;\n labels: Readonly<Record<KeepUiLabelKey, string>>;\n labelResolver?: (key: KeepUiLabelKey, context: { locale?: string }) => string | undefined;\n};\n\nexport const DEFAULT_LABELS: Record<KeepUiLabelKey, string> = {\n save: \"Save\",\n saved: \"Saved\",\n remove: \"Remove\",\n loading: \"Loading…\",\n saving: \"Saving…\",\n syncing: \"Syncing…\",\n error: \"Something went wrong.\",\n allTags: \"All\",\n filterTags: \"Filter saved items by tag\",\n note: \"Note\",\n saveNote: \"Save note\",\n noItems: \"No saved items.\",\n loadingItems: \"Loading saved items…\",\n errorItems: \"Could not load saved items.\",\n search: \"Search saved items\",\n sort: \"Sort saved items\",\n newest: \"Newest first\",\n oldest: \"Oldest first\",\n savedNewest: \"Saved newest first\",\n savedOldest: \"Saved oldest first\",\n updatedNewest: \"Updated newest first\",\n updatedOldest: \"Updated oldest first\",\n previousPage: \"Previous page\",\n nextPage: \"Next page\",\n pagination: \"Pagination\",\n page: \"Page\",\n selectItems: \"Select saved items\",\n selectedCount: \"selected\",\n deleteSelected: \"Delete selected\",\n tagsToApply: \"Tags to apply\",\n applyTags: \"Apply tags\",\n savedMessage: \"Item saved.\",\n removedMessage: \"Item removed.\",\n noteSavedMessage: \"Note saved.\",\n};\n\nconst KeepUiLabelsContext = createContext<KeepUiLabelContext>({ labels: DEFAULT_LABELS });\n\nexport type KeepUiProviderProps = {\n labels?: KeepUiLabels;\n locale?: string;\n labelResolver?: KeepUiLabelContext[\"labelResolver\"];\n children?: ReactNode;\n};\n\n/** Provides one locale-aware label source to every UI primitive. */\nexport function KeepUiProvider({ labels, locale, labelResolver, children }: KeepUiProviderProps) {\n const value = useMemo<KeepUiLabelContext>(() => {\n const resolved = { ...DEFAULT_LABELS, ...labels };\n return { locale, labels: resolved, labelResolver };\n }, [labelResolver, labels, locale]);\n return <KeepUiLabelsContext.Provider value={value}>{children}</KeepUiLabelsContext.Provider>;\n}\n\nexport function useKeepUiLabels(): KeepUiLabelContext {\n return useContext(KeepUiLabelsContext);\n}\n\nexport function useUiLabel(key: KeepUiLabelKey, override?: string): string {\n const context = useKeepUiLabels();\n return override ?? context.labelResolver?.(key, { locale: context.locale }) ?? context.labels[key];\n}\n","\"use client\";\n\nimport {\n KeepButton as CoreKeepButton,\n type KeepButtonProps as CoreKeepButtonProps,\n type KeepButtonState,\n useKeepItem,\n} from \"@keepkit/core/react\";\nimport type { ReactNode } from \"react\";\nimport type { KeepButtonLabels } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type { KeepButtonLabels } from \"./shared\";\n\nexport type KeepButtonProps<TMeta = Record<string, unknown>> = CoreKeepButtonProps<TMeta> & {\n labels?: KeepButtonLabels;\n};\n\n/** A style-free save toggle with localized labels and the core button's ARIA/asChild behavior. */\nexport function KeepButton<TMeta = Record<string, unknown>>({ labels, ...props }: KeepButtonProps<TMeta>) {\n const saveLabel = useUiLabel(\"save\", typeof labels?.unsaved === \"string\" ? labels.unsaved : undefined);\n const savedLabel = useUiLabel(\"saved\", typeof labels?.saved === \"string\" ? labels.saved : undefined);\n const loadingLabel = useUiLabel(\"loading\", typeof labels?.loading === \"string\" ? labels.loading : undefined);\n const errorLabel = useUiLabel(\"error\", typeof labels?.error === \"string\" ? labels.error : undefined);\n const buttonState = useKeepItem<TMeta>(props.item);\n const customStateLabel = labels?.loading !== undefined || labels?.error !== undefined;\n const getStateContent = (state: KeepButtonState<TMeta>): ReactNode => {\n if (state.error) return labels?.error ?? errorLabel;\n if (state.isMutating) return labels?.loading ?? loadingLabel;\n if (typeof props.children === \"function\") return props.children(state);\n if (props.children !== undefined) return props.children;\n return state.isSaved ? (labels?.saved ?? savedLabel) : (labels?.unsaved ?? saveLabel);\n };\n const sharedProps = {\n ...props,\n \"aria-busy\": props[\"aria-busy\"] ?? (buttonState.isLoading || buttonState.isMutating),\n savedLabel: labels?.saved ?? props.savedLabel ?? savedLabel,\n unsavedLabel: labels?.unsaved ?? props.unsavedLabel ?? saveLabel,\n savedAriaLabel: labels?.savedAriaLabel ?? props.savedAriaLabel,\n unsavedAriaLabel: labels?.unsavedAriaLabel ?? props.unsavedAriaLabel,\n };\n if (!customStateLabel) return <CoreKeepButton<TMeta> {...sharedProps} />;\n return (\n <CoreKeepButton<TMeta> {...sharedProps}>\n {(state: KeepButtonState<TMeta>) => <>{getStateContent(state)}</>}\n </CoreKeepButton>\n );\n}\n","\"use client\";\n\nimport type { KeepItem, KeepListQuery } from \"@keepkit/core/core\";\nimport { useKeepList } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, type ReactNode, useMemo, useState } from \"react\";\nimport { KeepBulkActions } from \"./KeepBulkActions\";\nimport type { KeepItemCardProps } from \"./KeepItemCard\";\nimport { KeepList, type KeepListState } from \"./KeepList\";\nimport { KeepTagFilter } from \"./KeepTagFilter\";\nimport { KeepPagination, KeepSearchInput, KeepSortSelect } from \"./query-controls\";\nimport { type RenderProp, sortToValue } from \"./shared\";\n\nexport type KeepCollectionFeature = \"search\" | \"sort\" | \"pagination\" | \"tagFilter\" | \"bulkActions\";\n\nexport type KeepCollectionProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n query?: KeepListQuery<TMeta>;\n pageSize?: number;\n features?: Partial<Record<KeepCollectionFeature, boolean>>;\n renderItem?: (item: KeepItem<TMeta>, state: KeepListState<TMeta>) => ReactNode;\n itemCardProps?: Omit<KeepItemCardProps<TMeta>, \"item\" | \"children\" | \"render\">;\n loading?: ReactNode | RenderProp<KeepListState<TMeta>>;\n empty?: ReactNode | RenderProp<KeepListState<TMeta>>;\n error?: ReactNode | RenderProp<KeepListState<TMeta>>;\n};\n\n/** A batteries-included collection with query controls and accessible status feedback. */\nexport function KeepCollection<TMeta = Record<string, unknown>>({\n query = {},\n pageSize = 20,\n features,\n renderItem,\n itemCardProps,\n loading,\n empty,\n error,\n className,\n ...rootProps\n}: KeepCollectionProps<TMeta>) {\n const enabled = {\n search: true,\n sort: true,\n pagination: true,\n tagFilter: false,\n bulkActions: false,\n ...features,\n };\n const [searchValue, setSearchValue] = useState(query.search?.query ?? \"\");\n const [sort, setSort] = useState(query.sort ?? { by: \"updatedAt\" as const, direction: \"desc\" as const });\n const [tag, setTag] = useState<string | undefined>(query.tags?.[0]);\n const [page, setPage] = useState(query.pagination?.page ?? 1);\n const resolvedPageSize = query.pagination?.pageSize ?? pageSize;\n const resolvedQuery = useMemo<KeepListQuery<TMeta>>(\n () => ({\n ...query,\n search: enabled.search ? { ...query.search, query: searchValue } : query.search,\n sort: enabled.sort ? sort : query.sort,\n tags: tag ? [...new Set([...(query.tags ?? []), tag])] : query.tags,\n pagination: enabled.pagination ? { ...query.pagination, page, pageSize: resolvedPageSize } : query.pagination,\n }),\n [enabled.pagination, enabled.search, enabled.sort, page, query, resolvedPageSize, searchValue, sort, tag],\n );\n const list = useKeepList<TMeta>(resolvedQuery);\n\n return (\n <section\n {...rootProps}\n className={className}\n aria-busy={list.isLoading || list.isMutating || rootProps[\"aria-busy\"]}\n >\n <div>\n {enabled.search ? (\n <KeepSearchInput\n value={searchValue}\n onValueChange={(value) => {\n setSearchValue(value);\n setPage(1);\n }}\n />\n ) : null}\n {enabled.sort ? (\n <KeepSortSelect\n value={sortToValue(sort)}\n onValueChange={(_value, nextSort) => {\n setSort(nextSort);\n setPage(1);\n }}\n />\n ) : null}\n {enabled.tagFilter ? (\n <KeepTagFilter<TMeta>\n query={query}\n value={tag}\n onValueChange={(value) => {\n setTag(value);\n setPage(1);\n }}\n />\n ) : null}\n </div>\n <KeepList<TMeta>\n query={resolvedQuery}\n renderItem={renderItem}\n itemCardProps={itemCardProps}\n loading={loading}\n empty={empty}\n error={error}\n />\n {enabled.pagination ? (\n <KeepPagination\n totalCount={list.totalCount}\n pageSize={resolvedPageSize}\n page={list.page}\n onPageChange={(nextPage) => setPage(nextPage)}\n />\n ) : null}\n {enabled.bulkActions ? <KeepBulkActions<TMeta> query={resolvedQuery} /> : null}\n </section>\n );\n}\n","\"use client\";\n\nimport type { KeepItem, KeepListQuery } from \"@keepkit/core/core\";\nimport type { UseKeepListResult } from \"@keepkit/core/react\";\nimport { useKeepList } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, isValidElement, type ReactNode } from \"react\";\nimport { KeepItemCard, type KeepItemCardProps } from \"./KeepItemCard\";\nimport { type RenderProp, renderRoot, resolveContent } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepListState<TMeta = Record<string, unknown>> = UseKeepListResult<TMeta>;\n\nexport type KeepListProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n query?: KeepListQuery<TMeta>;\n children?: ReactNode | RenderProp<KeepListState<TMeta>>;\n renderItem?: (item: KeepItem<TMeta>, state: KeepListState<TMeta>) => ReactNode;\n loading?: ReactNode | RenderProp<KeepListState<TMeta>>;\n empty?: ReactNode | RenderProp<KeepListState<TMeta>>;\n error?: ReactNode | RenderProp<KeepListState<TMeta>>;\n itemCardProps?: Omit<KeepItemCardProps<TMeta>, \"item\" | \"children\" | \"render\">;\n asChild?: boolean;\n};\n\n/** A list primitive with built-in loading, empty, error, and removal states. */\nexport function KeepList<TMeta = Record<string, unknown>>({\n query,\n children,\n renderItem,\n loading,\n empty,\n error: errorContent,\n itemCardProps,\n asChild = false,\n className,\n ...rootProps\n}: KeepListProps<TMeta>) {\n const defaultLoading = useUiLabel(\"loadingItems\");\n const defaultEmpty = useUiLabel(\"noItems\");\n const defaultError = useUiLabel(\"errorItems\");\n const state = useKeepList<TMeta>(query);\n const body = getListBody(state, {\n children,\n renderItem,\n loading: loading ?? defaultLoading,\n empty: empty ?? defaultEmpty,\n error: errorContent ?? defaultError,\n itemCardProps,\n });\n return renderRoot(\n asChild,\n asChild && isValidElement(children) ? children : undefined,\n { ...rootProps, className, \"aria-busy\": state.isLoading || rootProps[\"aria-busy\"] },\n body,\n \"KeepList\",\n );\n}\n\nfunction getListBody<TMeta>(\n state: KeepListState<TMeta>,\n options: {\n children?: ReactNode | RenderProp<KeepListState<TMeta>>;\n renderItem?: (item: KeepItem<TMeta>, state: KeepListState<TMeta>) => ReactNode;\n loading: ReactNode | RenderProp<KeepListState<TMeta>>;\n empty: ReactNode | RenderProp<KeepListState<TMeta>>;\n error: ReactNode | RenderProp<KeepListState<TMeta>>;\n itemCardProps?: Omit<KeepItemCardProps<TMeta>, \"item\" | \"children\" | \"render\">;\n },\n): ReactNode {\n if (state.error && state.items.length === 0) return resolveContent(options.error, state);\n if (state.isLoading && !state.isHydrated) return resolveContent(options.loading, state);\n if (state.isHydrated && state.items.length === 0) return resolveContent(options.empty, state);\n if (typeof options.children === \"function\") return options.children(state);\n if (options.children !== undefined && !isValidElement(options.children)) return options.children;\n return (\n <ul>\n {state.items.map((item) =>\n options.renderItem ? (\n options.renderItem(item, state)\n ) : (\n <li key={item.id}>\n <KeepItemCard item={item} {...options.itemCardProps} />\n </li>\n ),\n )}\n </ul>\n );\n}\n","\"use client\";\n\nimport type { KeepItem } from \"@keepkit/core/core\";\nimport { useKeepItem } from \"@keepkit/core/react\";\nimport { type ComponentType, type HTMLAttributes, type ImgHTMLAttributes, isValidElement, type ReactNode } from \"react\";\nimport { KeepButton, type KeepButtonLabels } from \"./KeepButton\";\nimport { getMetaTitle, type RenderProp, renderRoot, toKeepButtonItem } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepItemCardState<TMeta = Record<string, unknown>> = {\n item: KeepItem<TMeta>;\n isSaved: boolean;\n isMutating: boolean;\n error: unknown | null;\n remove: () => Promise<void>;\n};\n\nexport type KeepImageProps = ImgHTMLAttributes<HTMLImageElement> & {\n src: string;\n alt: string;\n};\n\nexport type KeepItemCardProps<TMeta = Record<string, unknown>> = Omit<\n HTMLAttributes<HTMLElement>,\n \"children\" | \"title\"\n> & {\n item: KeepItem<TMeta>;\n title?: ReactNode | ((item: KeepItem<TMeta>) => ReactNode);\n getTitle?: (item: KeepItem<TMeta>) => ReactNode;\n getImageProps?: (item: KeepItem<TMeta>, title: ReactNode) => KeepImageProps | undefined;\n imageComponent?: ComponentType<KeepImageProps>;\n renderImage?: (props: KeepImageProps, item: KeepItem<TMeta>) => ReactNode;\n imageAlt?: string;\n render?: RenderProp<KeepItemCardState<TMeta>>;\n children?: ReactNode | RenderProp<KeepItemCardState<TMeta>>;\n removeLabel?: string;\n onRemoveError?: (error: unknown) => void;\n onRemoved?: (item: KeepItem<TMeta>) => void;\n showSaveButton?: boolean;\n saveButtonLabels?: KeepButtonLabels;\n asChild?: boolean;\n};\n\n/** A low-dependency item presentation primitive. The default markup can be replaced with render props. */\nexport function KeepItemCard<TMeta = Record<string, unknown>>({\n item,\n title,\n getTitle,\n getImageProps,\n imageComponent: ImageComponent,\n renderImage,\n imageAlt,\n render,\n children,\n removeLabel,\n onRemoveError,\n onRemoved,\n showSaveButton = true,\n saveButtonLabels,\n asChild = false,\n className,\n ...rootProps\n}: KeepItemCardProps<TMeta>) {\n const saveActionLabel = useUiLabel(\"save\");\n const removeActionLabel = useUiLabel(\"remove\");\n const itemState = useKeepItem<TMeta>(item);\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const state: KeepItemCardState<TMeta> = {\n item,\n isSaved: itemState.isSaved,\n isMutating: itemState.isMutating,\n error: itemState.error,\n remove: itemState.remove,\n };\n const resolvedTitle =\n typeof title === \"function\" ? title(item) : (title ?? getTitle?.(item) ?? getMetaTitle(item.meta) ?? item.id);\n const imageProps = getImageProps?.(item, resolvedTitle);\n\n async function handleRemove() {\n try {\n await itemState.remove();\n onRemoved?.(item);\n } catch (error) {\n onRemoveError?.(error);\n }\n }\n\n const body = render\n ? render(state)\n : typeof contentChildren === \"function\"\n ? contentChildren(state)\n : (contentChildren ?? (\n <>\n {imageProps\n ? (renderImage?.({ ...imageProps, alt: imageAlt ?? imageProps.alt }, item) ??\n (ImageComponent ? (\n <ImageComponent {...imageProps} alt={imageAlt ?? imageProps.alt} />\n ) : (\n <img {...imageProps} alt={imageAlt ?? imageProps.alt} />\n )))\n : null}\n <h3>{resolvedTitle}</h3>\n {showSaveButton ? (\n <KeepButton\n item={toKeepButtonItem(item)}\n labels={saveButtonLabels}\n getAriaLabel={(buttonState) =>\n `${buttonState.isSaved ? removeActionLabel : saveActionLabel} ${String(resolvedTitle)}`\n }\n />\n ) : null}\n <button type=\"button\" onClick={() => void handleRemove()} disabled={itemState.isMutating}>\n {removeLabel ?? removeActionLabel}\n </button>\n </>\n ));\n\n return renderRoot(\n asChild,\n isValidElement(children) ? children : undefined,\n { ...rootProps, className, \"aria-busy\": itemState.isMutating || rootProps[\"aria-busy\"] },\n body,\n \"KeepItemCard\",\n );\n}\n","\"use client\";\n\nimport type { KeepListQuery } from \"@keepkit/core/core\";\nimport { useKeepList } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, isValidElement, type ReactNode, useCallback, useMemo, useState } from \"react\";\nimport { type RenderProp, renderRoot } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepTagFilterState = {\n tags: string[];\n tagCounts: Record<string, number>;\n value?: string;\n select: (tag?: string) => void;\n};\n\nexport type KeepTagFilterProps<TMeta = Record<string, unknown>> = Omit<\n HTMLAttributes<HTMLElement>,\n \"children\" | \"onChange\"\n> & {\n query?: KeepListQuery<TMeta>;\n value?: string;\n defaultValue?: string;\n onChange?: (tag?: string) => void;\n onValueChange?: (tag?: string) => void;\n allLabel?: ReactNode;\n ariaLabel?: string;\n renderTag?: (tag: string, count: number, selected: boolean) => ReactNode;\n render?: RenderProp<KeepTagFilterState>;\n children?: ReactNode | RenderProp<KeepTagFilterState>;\n asChild?: boolean;\n};\n\n/** An ARIA button group for tag filtering; consumers can connect value to a collection query. */\nexport function KeepTagFilter<TMeta = Record<string, unknown>>({\n query,\n value: controlledValue,\n defaultValue,\n onChange,\n onValueChange,\n allLabel,\n ariaLabel,\n renderTag,\n render,\n children,\n asChild = false,\n className,\n ...rootProps\n}: KeepTagFilterProps<TMeta>) {\n const uiAllLabel = useUiLabel(\"allTags\");\n const uiAriaLabel = useUiLabel(\"filterTags\");\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const resolvedValue = controlledValue ?? uncontrolledValue;\n const list = useKeepList<TMeta>({\n ...query,\n tags: resolvedValue ? [...(query?.tags ?? []), resolvedValue] : query?.tags,\n });\n const select = useCallback(\n (tag?: string) => {\n if (controlledValue === undefined) setUncontrolledValue(tag);\n onChange?.(tag);\n onValueChange?.(tag);\n },\n [controlledValue, onChange, onValueChange],\n );\n const state = useMemo<KeepTagFilterState>(\n () => ({ tags: list.tags, tagCounts: list.tagCounts, value: resolvedValue, select }),\n [list.tagCounts, list.tags, resolvedValue, select],\n );\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const body = render\n ? render(state)\n : typeof contentChildren === \"function\"\n ? contentChildren(state)\n : (contentChildren ?? (\n <fieldset>\n <legend>{ariaLabel ?? uiAriaLabel}</legend>\n <button type=\"button\" aria-pressed={resolvedValue === undefined} onClick={() => select()}>\n {allLabel ?? uiAllLabel}\n </button>\n {list.tags.map((tag) => (\n <button key={tag} type=\"button\" aria-pressed={resolvedValue === tag} onClick={() => select(tag)}>\n {renderTag ? renderTag(tag, list.tagCounts[tag] ?? 0, resolvedValue === tag) : tag}\n <span> ({list.tagCounts[tag] ?? 0})</span>\n </button>\n ))}\n </fieldset>\n ));\n return renderRoot(\n asChild,\n isValidElement(children) ? children : undefined,\n { ...rootProps, className },\n body,\n \"KeepTagFilter\",\n );\n}\n","\"use client\";\n\nimport type { KeepListQuery } from \"@keepkit/core/core\";\nimport { type InputHTMLAttributes, type ReactNode, type SelectHTMLAttributes, useEffect, useState } from \"react\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepSearchInputProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"value\" | \"defaultValue\" | \"onChange\"\n> & {\n value?: string;\n defaultValue?: string;\n /** Delay before notifying consumers; set to 0 to disable debouncing. */\n debounceMs?: number;\n onValueChange?: (value: string) => void;\n};\n\n/** A controlled/uncontrolled search field with a small built-in debounce. */\nexport function KeepSearchInput({\n value: controlledValue,\n defaultValue = \"\",\n debounceMs = 300,\n onValueChange,\n \"aria-label\": ariaLabel,\n placeholder,\n ...props\n}: KeepSearchInputProps) {\n const label = useUiLabel(\"search\");\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const value = controlledValue ?? uncontrolledValue;\n\n useEffect(() => {\n if (!onValueChange) return;\n if (debounceMs <= 0) {\n onValueChange(value);\n return;\n }\n const timer = window.setTimeout(() => onValueChange(value), debounceMs);\n return () => window.clearTimeout(timer);\n }, [debounceMs, onValueChange, value]);\n\n return (\n <input\n {...props}\n type=\"search\"\n value={value}\n aria-label={ariaLabel ?? label}\n placeholder={placeholder ?? label}\n onChange={(event) => {\n const nextValue = event.currentTarget.value;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n }}\n />\n );\n}\n\nexport type KeepSortValue = \"savedAt:desc\" | \"savedAt:asc\" | \"updatedAt:desc\" | \"updatedAt:asc\";\n\nexport type KeepSortSelectProps = Omit<\n SelectHTMLAttributes<HTMLSelectElement>,\n \"value\" | \"defaultValue\" | \"onChange\"\n> & {\n value?: KeepSortValue;\n defaultValue?: KeepSortValue;\n onValueChange?: (value: KeepSortValue, sort: NonNullable<KeepListQuery[\"sort\"]>) => void;\n};\n\n/** Emits a normalized sort descriptor that can be passed directly to useKeepList. */\nexport function KeepSortSelect({\n value: controlledValue,\n defaultValue = \"updatedAt:desc\",\n onValueChange,\n \"aria-label\": ariaLabel,\n children,\n ...props\n}: KeepSortSelectProps) {\n const label = useUiLabel(\"sort\");\n const updatedNewestLabel = useUiLabel(\"updatedNewest\");\n const updatedOldestLabel = useUiLabel(\"updatedOldest\");\n const savedNewestLabel = useUiLabel(\"savedNewest\");\n const savedOldestLabel = useUiLabel(\"savedOldest\");\n const [uncontrolledValue, setUncontrolledValue] = useState<KeepSortValue>(defaultValue);\n const value = controlledValue ?? uncontrolledValue;\n const options = children ?? (\n <>\n <option value=\"updatedAt:desc\">{updatedNewestLabel}</option>\n <option value=\"updatedAt:asc\">{updatedOldestLabel}</option>\n <option value=\"savedAt:desc\">{savedNewestLabel}</option>\n <option value=\"savedAt:asc\">{savedOldestLabel}</option>\n </>\n );\n return (\n <select\n {...props}\n value={value}\n aria-label={ariaLabel ?? label}\n onChange={(event) => {\n const nextValue = event.currentTarget.value as KeepSortValue;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n const [by, direction] = nextValue.split(\":\") as [\"savedAt\" | \"updatedAt\", \"asc\" | \"desc\"];\n onValueChange?.(nextValue, { by, direction });\n }}\n >\n {options}\n </select>\n );\n}\n\nexport type KeepPaginationState = { page: number; pageCount: number; goToPage: (page: number) => void };\n\nexport type KeepPaginationProps = Omit<React.HTMLAttributes<HTMLElement>, \"children\"> & {\n totalCount: number;\n pageSize: number;\n page?: number;\n maxPageButtons?: number;\n onPageChange?: (page: number, offset: number) => void;\n render?: (state: KeepPaginationState) => ReactNode;\n};\n\n/** Accessible pagination with previous/next controls and numbered page buttons. */\nexport function KeepPagination({\n totalCount,\n pageSize,\n page = 1,\n maxPageButtons = 7,\n onPageChange,\n render,\n ...props\n}: KeepPaginationProps) {\n const previousPageLabel = useUiLabel(\"previousPage\");\n const nextPageLabel = useUiLabel(\"nextPage\");\n const pageLabel = useUiLabel(\"page\");\n const paginationLabel = useUiLabel(\"pagination\");\n const pageCount = Math.max(1, Math.ceil(totalCount / Math.max(1, pageSize)));\n const currentPage = Math.min(Math.max(1, page), pageCount);\n const goToPage = (nextPage: number) => {\n const next = Math.min(Math.max(1, nextPage), pageCount);\n onPageChange?.(next, (next - 1) * pageSize);\n };\n const navProps = { ...props, \"aria-label\": props[\"aria-label\"] ?? paginationLabel };\n if (render) return <nav {...navProps}>{render({ page: currentPage, pageCount, goToPage })}</nav>;\n const visiblePages = getVisiblePages(currentPage, pageCount, Math.max(1, maxPageButtons));\n return (\n <nav {...navProps}>\n <button type=\"button\" onClick={() => goToPage(currentPage - 1)} disabled={currentPage <= 1}>\n {previousPageLabel}\n </button>\n {visiblePages.map((nextPage) => (\n <button\n key={nextPage}\n type=\"button\"\n aria-current={nextPage === currentPage ? \"page\" : undefined}\n aria-label={`${pageLabel} ${nextPage}`}\n onClick={() => goToPage(nextPage)}\n >\n {nextPage}\n </button>\n ))}\n <button type=\"button\" onClick={() => goToPage(currentPage + 1)} disabled={currentPage >= pageCount}>\n {nextPageLabel}\n </button>\n </nav>\n );\n}\n\nfunction getVisiblePages(currentPage: number, pageCount: number, maxPageButtons: number): number[] {\n if (pageCount <= maxPageButtons) return Array.from({ length: pageCount }, (_, index) => index + 1);\n const half = Math.floor(maxPageButtons / 2);\n const start = Math.min(Math.max(1, currentPage - half), pageCount - maxPageButtons + 1);\n return Array.from({ length: maxPageButtons }, (_, index) => start + index);\n}\n","\"use client\";\n\nimport type { KeepItem } from \"@keepkit/core/core\";\nimport { useKeepItem } from \"@keepkit/core/react\";\nimport {\n type FormHTMLAttributes,\n isValidElement,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { type RenderProp, renderRoot } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepNoteEditorState<TMeta = Record<string, unknown>> = {\n item: KeepItem<TMeta>;\n note: string;\n setNote: (note: string) => void;\n isDirty: boolean;\n isSaving: boolean;\n error: unknown | null;\n save: () => Promise<void>;\n};\n\nexport type KeepNoteEditorProps<TMeta = Record<string, unknown>> = Omit<\n FormHTMLAttributes<HTMLFormElement>,\n \"children\" | \"onSubmit\"\n> & {\n item: KeepItem<TMeta>;\n label?: ReactNode;\n saveLabel?: ReactNode;\n placeholder?: string;\n /** Automatically save dirty notes after this delay; set to 0 to disable auto-save. */\n debounceMs?: number;\n onSaved?: (note?: string) => void;\n onSaveError?: (error: unknown) => void;\n render?: RenderProp<KeepNoteEditorState<TMeta>>;\n children?: ReactNode | RenderProp<KeepNoteEditorState<TMeta>>;\n asChild?: boolean;\n};\n\n/** A controlled-by-default note editor that persists through useKeepItem. */\nexport function KeepNoteEditor<TMeta = Record<string, unknown>>({\n item,\n label,\n saveLabel,\n placeholder,\n debounceMs = 300,\n onSaved,\n onSaveError,\n render,\n children,\n asChild = false,\n className,\n ...formProps\n}: KeepNoteEditorProps<TMeta>) {\n const defaultLabel = useUiLabel(\"note\");\n const defaultSaveLabel = useUiLabel(\"saveNote\");\n const itemState = useKeepItem<TMeta>(item);\n const { error, isMutating, item: savedItem, updateNote } = itemState;\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const [note, setNote] = useState(item.note ?? \"\");\n const baselineNote = savedItem?.note ?? item.note ?? \"\";\n const isDirty = note !== baselineNote;\n const lastSavedNoteRef = useRef<string | undefined>(undefined);\n useEffect(() => setNote(baselineNote), [baselineNote]);\n const save = useCallback(async () => {\n const nextNote = note.trim() || undefined;\n try {\n await updateNote(nextNote);\n lastSavedNoteRef.current = note;\n onSaved?.(nextNote);\n } catch (error) {\n onSaveError?.(error);\n throw error;\n }\n }, [note, onSaveError, onSaved, updateNote]);\n useEffect(() => {\n if (!isDirty || debounceMs <= 0 || lastSavedNoteRef.current === note) return;\n const timer = window.setTimeout(() => void save().catch(() => undefined), debounceMs);\n return () => window.clearTimeout(timer);\n }, [debounceMs, isDirty, note, save]);\n const state: KeepNoteEditorState<TMeta> = {\n item,\n note,\n setNote,\n isDirty,\n isSaving: isMutating,\n error,\n save,\n };\n const body = render\n ? render(state)\n : typeof contentChildren === \"function\"\n ? contentChildren(state)\n : (contentChildren ?? (\n <>\n <label>\n {label ?? defaultLabel}\n <textarea\n value={note}\n onChange={(event) => setNote(event.currentTarget.value)}\n placeholder={placeholder}\n disabled={isMutating}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n void save().catch(() => undefined);\n }\n }}\n />\n </label>\n <button type=\"submit\" disabled={isMutating} aria-busy={isMutating}>\n {saveLabel ?? defaultSaveLabel}\n </button>\n </>\n ));\n const handleSubmit: FormHTMLAttributes<HTMLFormElement>[\"onSubmit\"] = (event) => {\n event.preventDefault();\n void save().catch(() => undefined);\n };\n if (!asChild) {\n return (\n <form\n {...formProps}\n className={className}\n onSubmit={handleSubmit}\n aria-busy={isMutating || formProps[\"aria-busy\"]}\n >\n {body}\n </form>\n );\n }\n return renderRoot(\n true,\n isValidElement(children) ? children : undefined,\n { ...formProps, className, onSubmit: handleSubmit, \"aria-busy\": isMutating || formProps[\"aria-busy\"] },\n body,\n \"KeepNoteEditor\",\n );\n}\n","\"use client\";\n\nimport type { KeepItem } from \"@keepkit/core/core\";\nimport { useKeepItem } from \"@keepkit/core/react\";\nimport { type FormHTMLAttributes, useCallback, useEffect, useState } from \"react\";\nimport { normalizeUiTags, type RenderProp } from \"./shared\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepTagEditorState = {\n tags: string[];\n setTags: (tags: string[]) => void;\n save: () => Promise<void>;\n isSaving: boolean;\n};\n\nexport type KeepTagEditorProps<TMeta = Record<string, unknown>> = Omit<\n FormHTMLAttributes<HTMLFormElement>,\n \"children\" | \"onSubmit\"\n> & {\n item: KeepItem<TMeta>;\n availableTags?: string[];\n onSaved?: (tags?: string[]) => void;\n onSaveError?: (error: unknown) => void;\n render?: RenderProp<KeepTagEditorState>;\n};\n\n/** Edits one item's normalized tag set; Enter adds and Backspace removes the last tag. */\nexport function KeepTagEditor<TMeta = Record<string, unknown>>({\n item,\n availableTags = [],\n onSaved,\n onSaveError,\n render,\n ...props\n}: KeepTagEditorProps<TMeta>) {\n const tagsLabel = useUiLabel(\"tagsToApply\");\n const removeLabel = useUiLabel(\"remove\");\n const applyTagsLabel = useUiLabel(\"applyTags\");\n const itemState = useKeepItem<TMeta>(item);\n const [tags, setTags] = useState(item.tags ?? []);\n const [input, setInput] = useState(\"\");\n useEffect(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);\n const save = useCallback(async () => {\n const nextTags = normalizeUiTags(tags);\n try {\n await itemState.updateTags(nextTags);\n setTags(nextTags);\n onSaved?.(nextTags);\n } catch (error) {\n onSaveError?.(error);\n throw error;\n }\n }, [itemState, onSaveError, onSaved, tags]);\n const addTag = (tag: string) => {\n setTags(normalizeUiTags([...tags, tag]));\n setInput(\"\");\n };\n const body = render ? (\n render({ tags, setTags, save, isSaving: itemState.isMutating })\n ) : (\n <>\n <label>\n {tagsLabel}\n <input\n value={input}\n list={availableTags.length > 0 ? `keep-tags-${item.id}` : undefined}\n onChange={(event) => setInput(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n if (event.nativeEvent.isComposing) return;\n event.preventDefault();\n if (input.trim()) addTag(input);\n } else if (event.key === \"Backspace\" && input.length === 0 && tags.length > 0) {\n event.preventDefault();\n setTags(tags.slice(0, -1));\n }\n }}\n />\n </label>\n {availableTags.length > 0 ? (\n <datalist id={`keep-tags-${item.id}`}>\n {availableTags.map((tag) => (\n <option key={tag} value={tag} />\n ))}\n </datalist>\n ) : null}\n <ul aria-label={tagsLabel}>\n {tags.map((tag) => (\n <li key={tag}>\n {tag}\n <button type=\"button\" onClick={() => setTags(tags.filter((current) => current !== tag))}>\n {removeLabel}\n </button>\n </li>\n ))}\n </ul>\n <button type=\"submit\" disabled={itemState.isMutating} aria-busy={itemState.isMutating}>\n {applyTagsLabel}\n </button>\n </>\n );\n return (\n <form\n {...props}\n onSubmit={(event) => {\n event.preventDefault();\n void save().catch(() => undefined);\n }}\n aria-busy={itemState.isMutating || props[\"aria-busy\"]}\n >\n {body}\n </form>\n );\n}\n","\"use client\";\n\nimport type { KeepChangeContext, KeepItem } from \"@keepkit/core/core\";\nimport { useKeepContext } from \"@keepkit/core/react\";\nimport { type HTMLAttributes, isValidElement, type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { type RenderProp, renderRoot } from \"./shared\";\nimport { type KeepUiLabelKey, useUiLabel } from \"./ui-context\";\n\nexport type KeepEmptyStateProps = Omit<HTMLAttributes<HTMLElement>, \"children\" | \"title\"> & {\n title?: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n children?: ReactNode;\n asChild?: boolean;\n};\n\n/** A style-free, reusable empty collection state. */\nexport function KeepEmptyState({\n title,\n description,\n action,\n children,\n asChild = false,\n className,\n ...rootProps\n}: KeepEmptyStateProps) {\n const defaultTitle = useUiLabel(\"noItems\").replace(/\\.$/, \"\");\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const body = contentChildren ?? (\n <>\n <h2>{title ?? defaultTitle}</h2>\n {description ? <p>{description}</p> : null}\n {action}\n </>\n );\n return renderRoot(asChild, children, { ...rootProps, className }, body, \"KeepEmptyState\");\n}\n\nexport type KeepStatusValue = \"idle\" | \"empty\" | \"loading\" | \"saving\" | \"syncing\" | \"error\";\nexport type KeepStatusLabels = Partial<Record<KeepStatusValue, ReactNode>>;\n\nexport type KeepStatusState<TMeta = Record<string, unknown>> = {\n status: KeepStatusValue;\n error: unknown | null;\n pendingCount: number;\n items: KeepItem<TMeta>[];\n};\n\nexport type KeepStatusProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n status?: KeepStatusValue;\n labels?: KeepStatusLabels;\n children?: ReactNode | RenderProp<KeepStatusState<TMeta>>;\n render?: RenderProp<KeepStatusState<TMeta>>;\n asChild?: boolean;\n};\n\n/** Presents provider loading, mutation, synchronization, empty, and error states accessibly. */\nexport function KeepStatus<TMeta = Record<string, unknown>>({\n status,\n labels,\n children,\n render,\n asChild = false,\n className,\n ...rootProps\n}: KeepStatusProps<TMeta>) {\n const context = useKeepContext<TMeta>();\n const contentChildren = asChild && isValidElement(children) ? undefined : children;\n const resolvedStatus = status ?? getDerivedStatus(context);\n const defaultLabel = useUiLabel(getStatusLabelKey(resolvedStatus));\n const state: KeepStatusState<TMeta> = {\n status: resolvedStatus,\n error: context.error,\n pendingCount: context.syncState.pendingCount,\n items: context.items,\n };\n const body = render\n ? render(state)\n : typeof contentChildren === \"function\"\n ? contentChildren(state)\n : (contentChildren ?? labels?.[resolvedStatus] ?? defaultLabel);\n const role = rootProps.role ?? (resolvedStatus === \"error\" ? \"alert\" : \"status\");\n return renderRoot(\n asChild,\n isValidElement(children) ? children : undefined,\n { ...rootProps, className, role, \"aria-live\": rootProps[\"aria-live\"] ?? \"polite\" },\n body,\n \"KeepStatus\",\n );\n}\n\nexport type KeepAnnouncementsProps = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n messages?: Partial<Record<\"save\" | \"remove\" | \"note\", string>>;\n};\n\n/** Announces successful save, remove, and note operations in a polite live region. */\nexport function KeepAnnouncements<TMeta = Record<string, unknown>>({ messages, ...props }: KeepAnnouncementsProps) {\n const context = useKeepContext<TMeta>();\n const savedMessage = useUiLabel(\"savedMessage\", messages?.save);\n const removedMessage = useUiLabel(\"removedMessage\", messages?.remove);\n const noteSavedMessage = useUiLabel(\"noteSavedMessage\", messages?.note);\n const [message, setMessage] = useState(\"\");\n const lastChangeRef = useRef<KeepChangeContext<TMeta> | undefined>(undefined);\n useEffect(() => {\n const change = context.lastChange;\n if (!change || change === lastChangeRef.current) return;\n lastChangeRef.current = change;\n if (change.action === \"save\") setMessage(savedMessage);\n else if (change.action === \"remove\" || change.action === \"removeBatch\") setMessage(removedMessage);\n else if (change.action === \"updateNote\") setMessage(noteSavedMessage);\n }, [context.lastChange, noteSavedMessage, removedMessage, savedMessage]);\n return (\n <div {...props} role={props.role ?? \"status\"} aria-live={props[\"aria-live\"] ?? \"polite\"} aria-atomic=\"true\">\n {message}\n </div>\n );\n}\n\n/** Singular alias for applications that mount one announcer explicitly. */\nexport const KeepAnnouncer = KeepAnnouncements;\n\nfunction getDerivedStatus<TMeta>(context: ReturnType<typeof useKeepContext<TMeta>>): KeepStatusValue {\n if (context.error) return \"error\";\n if (context.syncState.status === \"pending\" || context.syncState.status === \"syncing\") return \"syncing\";\n if (context.isMutating) return \"saving\";\n if (context.isLoading && !context.isHydrated) return \"loading\";\n if (context.isHydrated && context.items.length === 0) return \"empty\";\n return \"idle\";\n}\n\nfunction getStatusLabelKey(status: KeepStatusValue): KeepUiLabelKey {\n if (status === \"empty\") return \"noItems\";\n if (status === \"loading\") return \"loadingItems\";\n if (status === \"error\") return \"error\";\n if (status === \"saving\") return \"saving\";\n if (status === \"syncing\") return \"syncing\";\n return \"saved\";\n}\n"],"mappings":";;;AAGA;AAAA,EAEE,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,OAMZ;;;ACTP,SAAS,mBAAmB;AAC5B,SAA8C,gBAAgB;;;ACuB1D;AAXG,SAAS,iBAAkD;AAAA,EAChE;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,GAAG;AACL,GAAiC;AAC/B,QAAM,YAAY,aAAa,IAAI,KAAK,KAAK;AAC7C,QAAM,kBAAkB,cAAc,OAAO,UAAU,WAAW,QAAQ;AAC1E,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,MAAK;AAAA,MACL;AAAA,MACA,cAAY;AAAA,MACZ,UAAU,CAAC,UAAU,kBAAkB,MAAM,cAAc,OAAO;AAAA;AAAA,EACpE;AAEJ;AAEA,SAAS,aAAoB,MAA2C;AACtE,MAAI,OAAO,KAAK,SAAS,YAAY,KAAK,SAAS,QAAQ,EAAE,WAAW,KAAK,MAAO,QAAO;AAC3F,QAAM,QAAS,KAAK,KAA6B;AACjD,SAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI;AACpE;;;ACtCA;AAAA,EACE;AAAA,EAGA;AAAA,O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X,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,eAAe;AAAA,UACb,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;AAAA,UAC/B,GAAI,gBAAgB,EAAE,cAAc,IAAI,CAAC;AAAA,UACzC,GAAG,MAAM;AAAA,QACX;AAAA;AAAA,IACF;AAAA,IAEF,YAAY,MAAM,QAAQ,WAAW;AAAA,IACrC,SAAS,CAAC,SAAS,QAAQ,QAAQ,IAAI;AAAA,IACvC,SAAS,CAAC,UAAU,QAAQ,QAAQ,KAAK;AAAA,IACzC,aAAa,CAAC,oBAAoB,QAAQ,YAAY,eAAe;AAAA,EACvE;AACF;","names":["jsx","jsx","jsx","Fragment","jsx","useKeepList","useMemo","useState","useKeepList","isValidElement","useKeepItem","isValidElement","Fragment","jsx","jsxs","useKeepItem","isValidElement","jsx","useKeepList","isValidElement","useKeepList","isValidElement","useMemo","useState","jsx","jsxs","useState","useKeepList","useMemo","isValidElement","useState","Fragment","jsx","jsxs","useState","jsx","jsxs","useState","useMemo","useKeepList","useKeepItem","isValidElement","useCallback","useEffect","useState","Fragment","jsx","jsxs","useKeepItem","isValidElement","useState","useEffect","useCallback","error","useKeepItem","useCallback","useEffect","useState","Fragment","jsx","jsxs","useKeepItem","useState","useEffect","useCallback","isValidElement","useEffect","useRef","useState","Fragment","jsx","jsxs","isValidElement","useState","useRef","useEffect","useKeepContext","useKeepItem","useKeepList","jsx","jsxs","jsx"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keepkit/ui",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Headless, accessible React UI components for KeepKit.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "react": ">=18"
31
31
  },
32
32
  "dependencies": {
33
- "@keepkit/core": "0.7.0"
33
+ "@keepkit/core": "0.8.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@testing-library/react": "^16.3.3",