@keepkit/ui 0.9.0 → 0.10.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/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 {\n KeepButtonState,\n KeepContextValue,\n KeepErrorBoundaryProps,\n KeepProviderProps,\n KeepShortcutOptions,\n} from \"@keepkit/core/react\";\nexport {\n KeepErrorBoundary,\n KeepProvider,\n useKeepContext,\n useKeepItem,\n useKeepList,\n useKeepShortcut,\n} 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\n {...props}\n aria-busy={list.isMutating || props[\"aria-busy\"]}\n data-state={selectedIds.length > 0 ? \"selected\" : \"idle\"}\n data-loading={list.isLoading || list.isMutating ? \"true\" : undefined}\n >\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 data-state={checked ? \"checked\" : \"unchecked\"}\n data-disabled={props.disabled ? \"true\" : undefined}\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 { KeepErrorBoundary, type KeepErrorBoundaryProps, 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 fallback?: KeepErrorBoundaryProps[\"fallback\"];\n onBoundaryError?: KeepErrorBoundaryProps[\"onError\"];\n boundaryResetKey?: unknown;\n};\n\n/** A batteries-included collection with query controls and accessible status feedback. */\nexport function KeepCollection<TMeta = Record<string, unknown>>(props: KeepCollectionProps<TMeta>) {\n const { fallback, onBoundaryError, boundaryResetKey, ...collectionProps } = props;\n const content = <KeepCollectionContent<TMeta> {...collectionProps} />;\n if (fallback === undefined && onBoundaryError === undefined) return content;\n return (\n <KeepErrorBoundary fallback={fallback} onError={onBoundaryError} resetKey={boundaryResetKey}>\n {content}\n </KeepErrorBoundary>\n );\n}\n\nfunction KeepCollectionContent<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}: Omit<KeepCollectionProps<TMeta>, \"fallback\" | \"onBoundaryError\" | \"boundaryResetKey\">) {\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 data-state={getCollectionState(list)}\n data-loading={list.isLoading || list.isMutating ? \"true\" : undefined}\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\nfunction getCollectionState<TMeta>(list: KeepListState<TMeta>): \"loading\" | \"error\" | \"empty\" | \"ready\" {\n if (list.error && list.items.length === 0) return \"error\";\n if (list.isLoading && !list.isHydrated) return \"loading\";\n if (list.isHydrated && list.items.length === 0) return \"empty\";\n return \"ready\";\n}\n","\"use client\";\n\nimport type { KeepItem, KeepListQuery } from \"@keepkit/core/core\";\nimport {\n KeepErrorBoundary,\n type KeepErrorBoundaryProps,\n type UseKeepListResult,\n useKeepList,\n} 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 fallback?: KeepErrorBoundaryProps[\"fallback\"];\n onBoundaryError?: KeepErrorBoundaryProps[\"onError\"];\n boundaryResetKey?: unknown;\n};\n\n/** A list primitive with built-in loading, empty, error, and removal states. */\nexport function KeepList<TMeta = Record<string, unknown>>(props: KeepListProps<TMeta>) {\n const { fallback, onBoundaryError, boundaryResetKey, ...listProps } = props;\n const content = <KeepListContent<TMeta> {...listProps} />;\n if (fallback === undefined && onBoundaryError === undefined) return content;\n return (\n <KeepErrorBoundary fallback={fallback} onError={onBoundaryError} resetKey={boundaryResetKey}>\n {content}\n </KeepErrorBoundary>\n );\n}\n\nfunction KeepListContent<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 {\n ...rootProps,\n className,\n \"aria-busy\": state.isLoading || rootProps[\"aria-busy\"],\n \"data-state\": getListState(state),\n \"data-loading\": state.isLoading ? \"true\" : undefined,\n },\n body,\n \"KeepList\",\n );\n}\n\nfunction getListState<TMeta>(state: KeepListState<TMeta>): \"loading\" | \"error\" | \"empty\" | \"ready\" {\n if (state.error && state.items.length === 0) return \"error\";\n if (state.isLoading && !state.isHydrated) return \"loading\";\n if (state.isHydrated && state.items.length === 0) return \"empty\";\n return \"ready\";\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 {\n ...rootProps,\n className,\n \"aria-busy\": itemState.isMutating || rootProps[\"aria-busy\"],\n \"data-state\": itemState.isSaved ? \"saved\" : \"unsaved\",\n \"data-loading\": itemState.isMutating ? \"true\" : undefined,\n },\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 {\n ...rootProps,\n className,\n \"data-state\": resolvedValue === undefined ? \"all\" : \"filtered\",\n \"data-loading\": list.isLoading ? \"true\" : undefined,\n },\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 data-state={value ? \"active\" : \"idle\"}\n data-disabled={props.disabled ? \"true\" : undefined}\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 data-state=\"selected\"\n data-disabled={props.disabled ? \"true\" : undefined}\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 = {\n ...props,\n \"aria-label\": props[\"aria-label\"] ?? paginationLabel,\n \"data-state\": pageCount > 1 ? \"active\" : \"idle\",\n };\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 data-state={isDirty ? \"dirty\" : \"clean\"}\n data-loading={isMutating ? \"true\" : undefined}\n data-disabled={isMutating ? \"true\" : undefined}\n >\n {body}\n </form>\n );\n }\n return renderRoot(\n true,\n isValidElement(children) ? children : undefined,\n {\n ...formProps,\n className,\n onSubmit: handleSubmit,\n \"aria-busy\": isMutating || formProps[\"aria-busy\"],\n \"data-state\": isDirty ? \"dirty\" : \"clean\",\n \"data-loading\": isMutating ? \"true\" : undefined,\n \"data-disabled\": isMutating ? \"true\" : undefined,\n },\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 data-state={itemState.isMutating ? \"saving\" : \"idle\"}\n data-loading={itemState.isMutating ? \"true\" : undefined}\n data-disabled={itemState.isMutating ? \"true\" : undefined}\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, \"data-state\": \"empty\" }, 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 {\n ...rootProps,\n className,\n role,\n \"aria-live\": rootProps[\"aria-live\"] ?? \"polite\",\n \"data-state\": resolvedStatus,\n \"data-loading\":\n resolvedStatus === \"loading\" || resolvedStatus === \"saving\" || resolvedStatus === \"syncing\"\n ? \"true\"\n : undefined,\n },\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\n {...props}\n role={props.role ?? \"status\"}\n aria-live={props[\"aria-live\"] ?? \"polite\"}\n aria-atomic=\"true\"\n data-state=\"announcing\"\n >\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\";\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C,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;AAuGO,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","KeepErrorBoundary","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","KeepErrorBoundary","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","KeepErrorBoundary","useKeepContext","useKeepItem","useKeepList","jsx","jsxs","jsx"]}
1
+ {"version":3,"sources":["../src/index.tsx","../src/KeepBackup.tsx","../src/ui-context.tsx","../src/KeepBulkActions.tsx","../src/KeepItemCheckbox.tsx","../src/shared.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 { KeepBackup, type KeepBackupProps } from \"./KeepBackup\";\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 {\n type KeepImageProps,\n KeepItemCard,\n type KeepItemCardLinkProps,\n type KeepItemCardProps,\n type KeepItemCardState,\n} 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 {\n KeepButtonState,\n KeepContextValue,\n KeepErrorBoundaryProps,\n KeepProviderProps,\n KeepShortcutOptions,\n} from \"@keepkit/core/react\";\nexport {\n KeepErrorBoundary,\n KeepProvider,\n useKeepContext,\n useKeepItem,\n useKeepList,\n useKeepShortcut,\n} 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 KeepBackupProps,\n KeepBulkActionsProps,\n KeepBulkActionsState,\n KeepButtonLabels,\n KeepButtonProps,\n KeepCollectionFeature,\n KeepCollectionProps,\n KeepEmptyStateProps,\n KeepImageProps,\n KeepItemCardLinkProps,\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 KeepBackup,\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 Backup: ComponentType<KeepBackupProps<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 Backup: (props) => <KeepBackup<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 { ImportItemsResult } from \"@keepkit/core/core\";\nimport { useKeepContext } from \"@keepkit/core/react\";\nimport { type ChangeEvent, type HTMLAttributes, useRef, useState } from \"react\";\nimport { useUiLabel } from \"./ui-context\";\n\nexport type KeepBackupProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLElement>, \"children\"> & {\n filename?: string;\n onExport?: (data: string) => void;\n onImported?: (result: ImportItemsResult<TMeta>) => void;\n};\n\n/** Accessible JSON backup controls backed by the current KeepProvider storage. */\nexport function KeepBackup<TMeta = Record<string, unknown>>({\n filename = \"keepkit-backup.json\",\n onExport,\n onImported,\n ...props\n}: KeepBackupProps<TMeta>) {\n const context = useKeepContext<TMeta>();\n const exportLabel = useUiLabel(\"exportData\");\n const importLabel = useUiLabel(\"importData\");\n const importModeLabel = useUiLabel(\"importMode\");\n const mergeLabel = useUiLabel(\"merge\");\n const replaceLabel = useUiLabel(\"replace\");\n const importedCountLabel = useUiLabel(\"importedCount\");\n const failedCountLabel = useUiLabel(\"failedCount\");\n const quotaErrorLabel = useUiLabel(\"storageQuotaError\");\n const inputRef = useRef<HTMLInputElement>(null);\n const [mode, setMode] = useState<\"merge\" | \"replace\">(\"merge\");\n const [result, setResult] = useState<ImportItemsResult<TMeta>>();\n const [error, setError] = useState<unknown>();\n\n async function handleExport() {\n setError(undefined);\n try {\n const data = await context.exportBackup();\n onExport?.(data);\n if (typeof document === \"undefined\") return;\n const url = URL.createObjectURL(new Blob([data], { type: \"application/json\" }));\n const anchor = document.createElement(\"a\");\n anchor.href = url;\n anchor.download = filename;\n anchor.click();\n URL.revokeObjectURL(url);\n } catch (cause) {\n setError(cause);\n }\n }\n\n async function handleImport(event: ChangeEvent<HTMLInputElement>) {\n const file = event.currentTarget.files?.[0];\n event.currentTarget.value = \"\";\n if (!file) return;\n setError(undefined);\n setResult(undefined);\n try {\n const imported = await context.importBackup(await file.text(), { mode });\n setResult(imported);\n onImported?.(imported);\n } catch (cause) {\n setError(cause);\n }\n }\n\n return (\n <section {...props} data-state={error ? \"error\" : result ? \"complete\" : \"idle\"}>\n <button type=\"button\" onClick={() => void handleExport()} disabled={context.isMutating}>\n {exportLabel}\n </button>\n <label>\n {importModeLabel}\n <select value={mode} onChange={(event) => setMode(event.currentTarget.value as \"merge\" | \"replace\")}>\n <option value=\"merge\">{mergeLabel}</option>\n <option value=\"replace\">{replaceLabel}</option>\n </select>\n </label>\n <button type=\"button\" onClick={() => inputRef.current?.click()} disabled={context.isMutating}>\n {importLabel}\n </button>\n <input\n ref={inputRef}\n type=\"file\"\n accept=\"application/json,.json\"\n aria-label={importLabel}\n onChange={(event) => void handleImport(event)}\n />\n {result ? (\n <p role=\"status\">\n {result.imported} {importedCountLabel}; {result.failed} {failedCountLabel}\n </p>\n ) : null}\n {error ? <p role=\"alert\">{isQuotaError(error) ? quotaErrorLabel : getErrorMessage(error)}</p> : null}\n </section>\n );\n}\n\nfunction isQuotaError(error: unknown): boolean {\n if (error instanceof Error && error.name === \"KeepStorageQuotaError\") return true;\n if (error && typeof error === \"object\" && \"cause\" in error) return isQuotaError(error.cause);\n return false;\n}\n\nfunction getErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : \"Something went wrong.\";\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 | \"exportData\"\n | \"importData\"\n | \"importMode\"\n | \"merge\"\n | \"replace\"\n | \"importedCount\"\n | \"failedCount\"\n | \"storageQuotaError\"\n | \"statusExpired\"\n | \"statusRemoved\"\n | \"statusDeleted\"\n | \"statusPrivate\"\n | \"statusUnknown\";\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 exportData: \"Export JSON\",\n importData: \"Import JSON\",\n importMode: \"Import mode\",\n merge: \"Merge\",\n replace: \"Replace\",\n importedCount: \"items imported\",\n failedCount: \"items failed\",\n storageQuotaError: \"Storage is full. Free space and try again.\",\n statusExpired: \"Expired\",\n statusRemoved: \"Removed\",\n statusDeleted: \"Deleted\",\n statusPrivate: \"Private\",\n statusUnknown: \"Unavailable\",\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 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\n {...props}\n aria-busy={list.isMutating || props[\"aria-busy\"]}\n data-state={selectedIds.length > 0 ? \"selected\" : \"idle\"}\n data-loading={list.isLoading || list.isMutating ? \"true\" : undefined}\n >\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 data-state={checked ? \"checked\" : \"unchecked\"}\n data-disabled={props.disabled ? \"true\" : undefined}\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 {\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 { KeepErrorBoundary, type KeepErrorBoundaryProps, 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 fallback?: KeepErrorBoundaryProps[\"fallback\"];\n onBoundaryError?: KeepErrorBoundaryProps[\"onError\"];\n boundaryResetKey?: unknown;\n};\n\n/** A batteries-included collection with query controls and accessible status feedback. */\nexport function KeepCollection<TMeta = Record<string, unknown>>(props: KeepCollectionProps<TMeta>) {\n const { fallback, onBoundaryError, boundaryResetKey, ...collectionProps } = props;\n const content = <KeepCollectionContent<TMeta> {...collectionProps} />;\n if (fallback === undefined && onBoundaryError === undefined) return content;\n return (\n <KeepErrorBoundary fallback={fallback} onError={onBoundaryError} resetKey={boundaryResetKey}>\n {content}\n </KeepErrorBoundary>\n );\n}\n\nfunction KeepCollectionContent<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}: Omit<KeepCollectionProps<TMeta>, \"fallback\" | \"onBoundaryError\" | \"boundaryResetKey\">) {\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 data-state={getCollectionState(list)}\n data-loading={list.isLoading || list.isMutating ? \"true\" : undefined}\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\nfunction getCollectionState<TMeta>(list: KeepListState<TMeta>): \"loading\" | \"error\" | \"empty\" | \"ready\" {\n if (list.error && list.items.length === 0) return \"error\";\n if (list.isLoading && !list.isHydrated) return \"loading\";\n if (list.isHydrated && list.items.length === 0) return \"empty\";\n return \"ready\";\n}\n","\"use client\";\n\nimport type { KeepItem, KeepListQuery } from \"@keepkit/core/core\";\nimport {\n KeepErrorBoundary,\n type KeepErrorBoundaryProps,\n type UseKeepListResult,\n useKeepList,\n} 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 fallback?: KeepErrorBoundaryProps[\"fallback\"];\n onBoundaryError?: KeepErrorBoundaryProps[\"onError\"];\n boundaryResetKey?: unknown;\n};\n\n/** A list primitive with built-in loading, empty, error, and removal states. */\nexport function KeepList<TMeta = Record<string, unknown>>(props: KeepListProps<TMeta>) {\n const { fallback, onBoundaryError, boundaryResetKey, ...listProps } = props;\n const content = <KeepListContent<TMeta> {...listProps} />;\n if (fallback === undefined && onBoundaryError === undefined) return content;\n return (\n <KeepErrorBoundary fallback={fallback} onError={onBoundaryError} resetKey={boundaryResetKey}>\n {content}\n </KeepErrorBoundary>\n );\n}\n\nfunction KeepListContent<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 {\n ...rootProps,\n className,\n \"aria-busy\": state.isLoading || rootProps[\"aria-busy\"],\n \"data-state\": getListState(state),\n \"data-loading\": state.isLoading ? \"true\" : undefined,\n },\n body,\n \"KeepList\",\n );\n}\n\nfunction getListState<TMeta>(state: KeepListState<TMeta>): \"loading\" | \"error\" | \"empty\" | \"ready\" {\n if (state.error && state.items.length === 0) return \"error\";\n if (state.isLoading && !state.isHydrated) return \"loading\";\n if (state.isHydrated && state.items.length === 0) return \"empty\";\n return \"ready\";\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 {\n type ComponentType,\n type HTMLAttributeAnchorTarget,\n type HTMLAttributes,\n type ImgHTMLAttributes,\n isValidElement,\n type MouseEvent,\n type ReactNode,\n} 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 status: KeepItem[\"status\"];\n};\n\nexport type KeepItemCardLinkProps = {\n href: string;\n children?: ReactNode;\n target?: HTMLAttributeAnchorTarget;\n rel?: string;\n onClick?: (event: MouseEvent<HTMLElement>) => 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 href?: string | ((item: KeepItem<TMeta>) => string | undefined);\n onOpen?: (item: KeepItem<TMeta>, event: MouseEvent<HTMLElement>) => void;\n linkTarget?: \"title\" | \"card\";\n linkComponent?: ComponentType<KeepItemCardLinkProps>;\n linkTargetAttribute?: HTMLAttributeAnchorTarget;\n linkRel?: string;\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 href: hrefOption,\n onOpen,\n linkTarget = \"title\",\n linkComponent: LinkComponent,\n linkTargetAttribute,\n linkRel,\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 status: item.status,\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 const href = typeof hrefOption === \"function\" ? hrefOption(item) : hrefOption;\n const isAvailable = item.status === undefined || item.status === \"available\";\n const statusLabelKey = item.status && item.status !== \"available\" ? getStatusLabelKey(item.status) : \"statusUnknown\";\n const unavailableLabel = useUiLabel(statusLabelKey);\n const statusLabel = item.status && item.status !== \"available\" ? unavailableLabel : undefined;\n\n function renderLink(content: ReactNode): ReactNode {\n if (!href || !isAvailable) return content;\n const linkProps: KeepItemCardLinkProps = {\n href,\n target: linkTargetAttribute,\n rel: linkRel,\n onClick: (event) => onOpen?.(item, event),\n children: content,\n };\n return LinkComponent ? <LinkComponent {...linkProps} /> : <a {...linkProps} />;\n }\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>{linkTarget === \"title\" ? renderLink(resolvedTitle) : resolvedTitle}</h3>\n {statusLabel ? <p data-status={item.status}>{statusLabel}</p> : null}\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 const linkedBody = linkTarget === \"card\" ? renderLink(body) : body;\n return renderRoot(\n asChild,\n isValidElement(children) ? children : undefined,\n {\n ...rootProps,\n className,\n \"aria-busy\": itemState.isMutating || rootProps[\"aria-busy\"],\n \"data-state\": itemState.isSaved ? \"saved\" : \"unsaved\",\n \"data-status\": item.status ?? \"available\",\n \"data-loading\": itemState.isMutating ? \"true\" : undefined,\n },\n linkedBody,\n \"KeepItemCard\",\n );\n}\n\nfunction getStatusLabelKey(\n status: NonNullable<KeepItem[\"status\"]>,\n): \"statusExpired\" | \"statusRemoved\" | \"statusDeleted\" | \"statusPrivate\" | \"statusUnknown\" {\n switch (status) {\n case \"expired\":\n return \"statusExpired\";\n case \"removed\":\n return \"statusRemoved\";\n case \"deleted\":\n return \"statusDeleted\";\n case \"private\":\n return \"statusPrivate\";\n default:\n return \"statusUnknown\";\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 {\n ...rootProps,\n className,\n \"data-state\": resolvedValue === undefined ? \"all\" : \"filtered\",\n \"data-loading\": list.isLoading ? \"true\" : undefined,\n },\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 data-state={value ? \"active\" : \"idle\"}\n data-disabled={props.disabled ? \"true\" : undefined}\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 data-state=\"selected\"\n data-disabled={props.disabled ? \"true\" : undefined}\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 = {\n ...props,\n \"aria-label\": props[\"aria-label\"] ?? paginationLabel,\n \"data-state\": pageCount > 1 ? \"active\" : \"idle\",\n };\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 data-state={isDirty ? \"dirty\" : \"clean\"}\n data-loading={isMutating ? \"true\" : undefined}\n data-disabled={isMutating ? \"true\" : undefined}\n >\n {body}\n </form>\n );\n }\n return renderRoot(\n true,\n isValidElement(children) ? children : undefined,\n {\n ...formProps,\n className,\n onSubmit: handleSubmit,\n \"aria-busy\": isMutating || formProps[\"aria-busy\"],\n \"data-state\": isDirty ? \"dirty\" : \"clean\",\n \"data-loading\": isMutating ? \"true\" : undefined,\n \"data-disabled\": isMutating ? \"true\" : undefined,\n },\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 data-state={itemState.isMutating ? \"saving\" : \"idle\"}\n data-loading={itemState.isMutating ? \"true\" : undefined}\n data-disabled={itemState.isMutating ? \"true\" : undefined}\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, \"data-state\": \"empty\" }, 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 {\n ...rootProps,\n className,\n role,\n \"aria-live\": rootProps[\"aria-live\"] ?? \"polite\",\n \"data-state\": resolvedStatus,\n \"data-loading\":\n resolvedStatus === \"loading\" || resolvedStatus === \"saving\" || resolvedStatus === \"syncing\"\n ? \"true\"\n : undefined,\n },\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\n {...props}\n role={props.role ?? \"status\"}\n aria-live={props[\"aria-live\"] ?? \"polite\"}\n aria-atomic=\"true\"\n data-state=\"announcing\"\n >\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,sBAAsB;AAC/B,SAAgD,QAAQ,gBAAgB;;;ACFxE,SAAS,eAA+B,YAAY,eAAe;AA4H1D;AAjEF,IAAM,iBAAiD;AAAA,EAC5D,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,aAAa;AAAA,EACb,eAAe;AAAA,EACf,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,aAAa;AAAA,EACb,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,cAAc;AAAA,EACd,gBA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G;AAAA;AAAA,IACN;AAAA,IAEF,QAAQ,CAAC,UAAU,gBAAAA,MAAC,cAAmB,GAAG,OAAO;AAAA,IACjD,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","useState","jsx","jsx","jsx","jsxs","useState","Fragment","jsx","KeepErrorBoundary","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","KeepErrorBoundary","useState","useMemo","useKeepList","useKeepItem","isValidElement","useCallback","useEffect","useRef","useState","Fragment","jsx","jsxs","useKeepItem","isValidElement","useState","useRef","useEffect","useCallback","error","useKeepItem","useCallback","useEffect","useState","Fragment","jsx","jsxs","useKeepItem","useState","useEffect","useCallback","useKeepContext","isValidElement","useEffect","useRef","useState","Fragment","jsx","jsxs","isValidElement","useKeepContext","getStatusLabelKey","useState","useRef","useEffect","KeepErrorBoundary","useKeepContext","useKeepItem","useKeepList","jsx","jsxs","jsx"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keepkit/ui",
3
- "version": "0.9.0",
3
+ "version": "0.10.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.9.0"
33
+ "@keepkit/core": "0.10.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@testing-library/react": "^16.3.3",