@keepkit/ui 0.27.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.d.ts +8 -3
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -106,7 +106,7 @@ const onFeedback = useKeepToastFeedback(toast);
|
|
|
106
106
|
<KeepKitProvider storage={storage} onFeedback={onFeedback}>{children}</KeepKitProvider>;
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
v0.27.
|
|
109
|
+
v0.27.1では`KeepCollection`の最小構成と高度な操作を確認できる`apps/collection-demo`を追加しました。Tailwind CSS v4との統合、ホストテーマ変数との衝突回避、CSS cascade layer対応も引き続き利用できます。
|
|
110
110
|
Phase 4の状態UIとして`KeepItemStatusBadge`、`KeepStaleNotice`、`KeepPruneStaleButton`、`KeepSyncStatusBanner`、`KeepSyncRecoveryDialog`を利用できます。`import "@keepkit/ui/theme.css"`でテーマCSSを有効にできます。
|
|
111
111
|
|
|
112
112
|
### Tailwind/shadcnテーマ
|
|
@@ -243,7 +243,7 @@ const onFeedback = useKeepToastFeedback(toast);
|
|
|
243
243
|
<KeepKitProvider storage={storage} onFeedback={onFeedback}>{children}</KeepKitProvider>;
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
v0.27.
|
|
246
|
+
v0.27.1 adds `apps/collection-demo` for exploring minimal and advanced `KeepCollection` configurations. Tailwind CSS v4 integration, host-theme isolation, and cascade-layer support remain available.
|
|
247
247
|
Phase 4 adds `KeepItemStatusBadge`, `KeepStaleNotice`, `KeepPruneStaleButton`, `KeepSyncStatusBanner`, and `KeepSyncRecoveryDialog` for unavailable items, sync failures, conflict resolution, and backup recovery. Import `@keepkit/ui/theme.css` or `@keepkit/ui/tailwind.css` for the opt-in theme layer.
|
|
248
248
|
|
|
249
249
|
### Tailwind and shadcn theme
|
package/dist/index.d.ts
CHANGED
|
@@ -196,19 +196,22 @@ declare function useKeepQuickEditor<TMeta = Record<string, unknown>>(item: KeepI
|
|
|
196
196
|
flush: () => Promise<void>;
|
|
197
197
|
};
|
|
198
198
|
};
|
|
199
|
+
type KeepQuickEditorFeature = "note" | "tags" | "collection";
|
|
199
200
|
type KeepQuickEditorProps<TMeta = Record<string, unknown>> = Omit<FormHTMLAttributes<HTMLFormElement>, "children" | "onSubmit"> & {
|
|
200
201
|
item: KeepItem<TMeta>;
|
|
201
202
|
debounceMs?: number;
|
|
202
203
|
collectionIds?: string[];
|
|
203
204
|
collectionLabels?: Record<string, string>;
|
|
204
205
|
showSaveButton?: boolean;
|
|
206
|
+
/** Controls which fields are visible. Defaults to all fields shown. */
|
|
207
|
+
features?: Partial<Record<KeepQuickEditorFeature, boolean>>;
|
|
205
208
|
children?: ReactNode | ((state: KeepQuickEditorState<TMeta>) => ReactNode);
|
|
206
209
|
onClose?: () => void;
|
|
207
210
|
onSaved?: (item: KeepItem<TMeta>) => void;
|
|
208
211
|
onSaveError?: (error: unknown) => void;
|
|
209
212
|
};
|
|
210
213
|
/** A compact, temporary-state editor for note, tags, and collection metadata. */
|
|
211
|
-
declare function KeepQuickEditor<TMeta = Record<string, unknown>>({ item, debounceMs, onSaved, onSaveError, ...props }: KeepQuickEditorProps<TMeta>): react.JSX.Element;
|
|
214
|
+
declare function KeepQuickEditor<TMeta = Record<string, unknown>>({ item, debounceMs, onSaved, onSaveError, features, ...props }: KeepQuickEditorProps<TMeta>): react.JSX.Element;
|
|
212
215
|
|
|
213
216
|
type KeepSavePopoverProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
214
217
|
item: KeepItemInput<TMeta>;
|
|
@@ -280,6 +283,8 @@ type KeepItemCardProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes<HT
|
|
|
280
283
|
showEditButton?: boolean;
|
|
281
284
|
onEdit?: (item: KeepItem<TMeta>) => void;
|
|
282
285
|
editSlot?: (item: KeepItem<TMeta>, close: () => void) => ReactNode;
|
|
286
|
+
/** Controls which fields are visible in the default quick editor. */
|
|
287
|
+
editFeatures?: Partial<Record<KeepQuickEditorFeature, boolean>>;
|
|
283
288
|
saveButtonLabels?: KeepButtonLabels;
|
|
284
289
|
asChild?: boolean;
|
|
285
290
|
href?: string | ((item: KeepItem<TMeta>) => string | undefined);
|
|
@@ -306,7 +311,7 @@ type KeepItemCardSkeletonProps = Omit<HTMLAttributes<HTMLElement>, "children"> &
|
|
|
306
311
|
layout?: KeepLayoutPreset;
|
|
307
312
|
};
|
|
308
313
|
/** A low-dependency item presentation primitive with composable card parts. */
|
|
309
|
-
declare function KeepItemCardRoot<TMeta = Record<string, unknown>>({ item, title, getTitle, getImageProps, imageComponent: ImageComponent, renderImage, renderTags, showTags, showNote, showSavedAt, collectionLabels, imageAlt, render, children, removeLabel, onRemoveError, onRemoved, onRetry, showSaveButton, showPinButton, showArchiveButton, showEditButton, onEdit, editSlot, saveButtonLabels, asChild, href: hrefOption, onOpen, linkTarget, linkComponent: LinkComponent, linkTargetAttribute, linkRel, highlightQuery, cardVariant, className, ...rootProps }: KeepItemCardProps<TMeta>): react.JSX.Element;
|
|
314
|
+
declare function KeepItemCardRoot<TMeta = Record<string, unknown>>({ item, title, getTitle, getImageProps, imageComponent: ImageComponent, renderImage, renderTags, showTags, showNote, showSavedAt, collectionLabels, imageAlt, render, children, removeLabel, onRemoveError, onRemoved, onRetry, showSaveButton, showPinButton, showArchiveButton, showEditButton, onEdit, editSlot, editFeatures, saveButtonLabels, asChild, href: hrefOption, onOpen, linkTarget, linkComponent: LinkComponent, linkTargetAttribute, linkRel, highlightQuery, cardVariant, className, ...rootProps }: KeepItemCardProps<TMeta>): react.JSX.Element;
|
|
310
315
|
declare function KeepItemCardMedia({ children, fallback, ...props }: KeepItemCardMediaProps): react.JSX.Element;
|
|
311
316
|
declare function KeepItemCardContent({ children, ...props }: KeepItemCardContentProps): react.JSX.Element;
|
|
312
317
|
declare function KeepItemCardTitle({ as, children, ...props }: KeepItemCardTitleProps): react.DetailedReactHTMLElement<{
|
|
@@ -1221,4 +1226,4 @@ type KeepKit<TMeta = Record<string, unknown>> = {
|
|
|
1221
1226
|
/** Create one typed application API for the core and standard UI layer. */
|
|
1222
1227
|
declare function createKeepKit<TMeta = Record<string, unknown>>(options?: CreateKeepKitOptions<TMeta>): KeepKit<TMeta>;
|
|
1223
1228
|
|
|
1224
|
-
export { type CreateKeepKitOptions, KeepActiveFiltersSummary, type KeepActiveFiltersSummaryProps, type KeepActiveFiltersSummaryState, KeepAnnouncements, type KeepAnnouncementsProps, KeepAnnouncer, KeepArchiveButton, type KeepArchiveButtonProps, type KeepArchiveButtonState, type KeepArchiveScope, KeepArchiveScopeSelect, type KeepArchiveScopeSelectProps, KeepBackup, type KeepBackupProps, KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState, KeepButton, type KeepButtonIcon, type KeepButtonIconProps, type KeepButtonIcons, type KeepButtonLabels, type KeepButtonProps, KeepCollection, type KeepCollectionControlProps, KeepCollectionCreate, type KeepCollectionCreateProps, type KeepCollectionFeature, KeepCollectionFilter, type KeepCollectionOption, type KeepCollectionProps, KeepCollectionSelect, type KeepCollectionSlots, type KeepCollectionToolbarContent, type KeepCollectionToolbarGroup, type KeepCollectionToolbarLayout, type KeepCollectionToolbarVariant, type KeepDisplayStatus, KeepEmptyState, type KeepEmptyStateProps, type KeepEmptyStateVariant, KeepHighlight, type KeepHighlightProps, type KeepImageProps, KeepItemCard, type KeepItemCardActionSlotProps, type KeepItemCardActionsProps, type KeepItemCardBadgeProps, type KeepItemCardContentProps, type KeepItemCardLinkProps, type KeepItemCardMediaProps, type KeepItemCardProps, type KeepItemCardRemoveProps, type KeepItemCardSaveProps, KeepItemCardSkeleton, type KeepItemCardSkeletonProps, type KeepItemCardState, type KeepItemCardTagsProps, type KeepItemCardTitleProps, type KeepItemCardVariant, KeepItemCheckbox, type KeepItemCheckboxProps, KeepItemStatusBadge, type KeepItemStatusBadgeProps, type KeepKit, KeepKitProvider, type KeepKitProviderProps, KeepLayout, type KeepLayoutPreset, type KeepLayoutProps, KeepList, type KeepListProps, type KeepListState, KeepNavigator, KeepNoteEditor, type KeepNoteEditorProps, type KeepNoteEditorState, type KeepPagesRouterLike, KeepPagination, type KeepPaginationProps, type KeepPaginationState, KeepPinButton, type KeepPinButtonProps, type KeepPinButtonState, KeepPruneStaleButton, type KeepPruneStaleButtonProps, KeepQuickEditor, type KeepQuickEditorProps, type KeepQuickEditorState, type KeepReorderableItemState, KeepReorderableList, type KeepReorderableListProps, KeepSavePopover, type KeepSavePopoverProps, KeepSearchInput, type KeepSearchInputProps, type KeepSelectionScope, KeepShortcutHint, type KeepShortcutHintProps, KeepSortSelect, type KeepSortSelectProps, type KeepSortValue, KeepStaleNotice, type KeepStaleNoticeProps, KeepStatus, type KeepStatusLabels, type KeepStatusProps, type KeepStatusState, type KeepStatusValue, KeepSyncRecoveryDialog, type KeepSyncRecoveryDialogProps, KeepSyncStatusBanner, type KeepSyncStatusBannerProps, KeepTagEditor, type KeepTagEditorProps, type KeepTagEditorState, KeepTagFilter, type KeepTagFilterProps, type KeepTagFilterState, type KeepThemeDensity, type KeepThemeMode, type KeepThemeName, KeepThemeProvider, type KeepThemeProviderProps, type KeepThemeRadius, type KeepThemeVariables, type KeepToastFeedbackOptions, type KeepToastHandler, KeepTourBar, type KeepTourBarProps, type KeepTourShortcutsOptions, type KeepUiFeedbackEvent, type KeepUiLabelContext, type KeepUiLabelKey, type KeepUiLabelOptions, type KeepUiLabelOptionsMap, type KeepUiLabels, type KeepUiLocale, type KeepUiLocaleLabels, KeepUiProvider, type KeepUiProviderProps, KeepUndo, type KeepUndoProps, type KeepUrlAdapter, KeepWorkspace, type KeepWorkspaceModule, type KeepWorkspacePreset, type KeepWorkspaceProps, type KeepWorkspaceRegion, type KeepWorkspaceSectionGap, type KeepWorkspaceSlots, type KeepWorkspaceState, type KeepWorkspaceSurface, type RenderProp, chainedFunction, composeRefs, createKeepKit, createNextPagesRouterAdapter, createSlot, getKeepLocaleLabels, highlightText, isAllSelected, keepThemeNames, mergeProps, toggleSelectAll, useKeepQuickEditor, useKeepToastFeedback, useKeepTourShortcuts, useKeepUiLabels, useKeepUrlSync, useUiLabelVisibility };
|
|
1229
|
+
export { type CreateKeepKitOptions, KeepActiveFiltersSummary, type KeepActiveFiltersSummaryProps, type KeepActiveFiltersSummaryState, KeepAnnouncements, type KeepAnnouncementsProps, KeepAnnouncer, KeepArchiveButton, type KeepArchiveButtonProps, type KeepArchiveButtonState, type KeepArchiveScope, KeepArchiveScopeSelect, type KeepArchiveScopeSelectProps, KeepBackup, type KeepBackupProps, KeepBulkActions, type KeepBulkActionsProps, type KeepBulkActionsState, KeepButton, type KeepButtonIcon, type KeepButtonIconProps, type KeepButtonIcons, type KeepButtonLabels, type KeepButtonProps, KeepCollection, type KeepCollectionControlProps, KeepCollectionCreate, type KeepCollectionCreateProps, type KeepCollectionFeature, KeepCollectionFilter, type KeepCollectionOption, type KeepCollectionProps, KeepCollectionSelect, type KeepCollectionSlots, type KeepCollectionToolbarContent, type KeepCollectionToolbarGroup, type KeepCollectionToolbarLayout, type KeepCollectionToolbarVariant, type KeepDisplayStatus, KeepEmptyState, type KeepEmptyStateProps, type KeepEmptyStateVariant, KeepHighlight, type KeepHighlightProps, type KeepImageProps, KeepItemCard, type KeepItemCardActionSlotProps, type KeepItemCardActionsProps, type KeepItemCardBadgeProps, type KeepItemCardContentProps, type KeepItemCardLinkProps, type KeepItemCardMediaProps, type KeepItemCardProps, type KeepItemCardRemoveProps, type KeepItemCardSaveProps, KeepItemCardSkeleton, type KeepItemCardSkeletonProps, type KeepItemCardState, type KeepItemCardTagsProps, type KeepItemCardTitleProps, type KeepItemCardVariant, KeepItemCheckbox, type KeepItemCheckboxProps, KeepItemStatusBadge, type KeepItemStatusBadgeProps, type KeepKit, KeepKitProvider, type KeepKitProviderProps, KeepLayout, type KeepLayoutPreset, type KeepLayoutProps, KeepList, type KeepListProps, type KeepListState, KeepNavigator, KeepNoteEditor, type KeepNoteEditorProps, type KeepNoteEditorState, type KeepPagesRouterLike, KeepPagination, type KeepPaginationProps, type KeepPaginationState, KeepPinButton, type KeepPinButtonProps, type KeepPinButtonState, KeepPruneStaleButton, type KeepPruneStaleButtonProps, KeepQuickEditor, type KeepQuickEditorFeature, type KeepQuickEditorProps, type KeepQuickEditorState, type KeepReorderableItemState, KeepReorderableList, type KeepReorderableListProps, KeepSavePopover, type KeepSavePopoverProps, KeepSearchInput, type KeepSearchInputProps, type KeepSelectionScope, KeepShortcutHint, type KeepShortcutHintProps, KeepSortSelect, type KeepSortSelectProps, type KeepSortValue, KeepStaleNotice, type KeepStaleNoticeProps, KeepStatus, type KeepStatusLabels, type KeepStatusProps, type KeepStatusState, type KeepStatusValue, KeepSyncRecoveryDialog, type KeepSyncRecoveryDialogProps, KeepSyncStatusBanner, type KeepSyncStatusBannerProps, KeepTagEditor, type KeepTagEditorProps, type KeepTagEditorState, KeepTagFilter, type KeepTagFilterProps, type KeepTagFilterState, type KeepThemeDensity, type KeepThemeMode, type KeepThemeName, KeepThemeProvider, type KeepThemeProviderProps, type KeepThemeRadius, type KeepThemeVariables, type KeepToastFeedbackOptions, type KeepToastHandler, KeepTourBar, type KeepTourBarProps, type KeepTourShortcutsOptions, type KeepUiFeedbackEvent, type KeepUiLabelContext, type KeepUiLabelKey, type KeepUiLabelOptions, type KeepUiLabelOptionsMap, type KeepUiLabels, type KeepUiLocale, type KeepUiLocaleLabels, KeepUiProvider, type KeepUiProviderProps, KeepUndo, type KeepUndoProps, type KeepUrlAdapter, KeepWorkspace, type KeepWorkspaceModule, type KeepWorkspacePreset, type KeepWorkspaceProps, type KeepWorkspaceRegion, type KeepWorkspaceSectionGap, type KeepWorkspaceSlots, type KeepWorkspaceState, type KeepWorkspaceSurface, type RenderProp, chainedFunction, composeRefs, createKeepKit, createNextPagesRouterAdapter, createSlot, getKeepLocaleLabels, highlightText, isAllSelected, keepThemeNames, mergeProps, toggleSelectAll, useKeepQuickEditor, useKeepToastFeedback, useKeepTourShortcuts, useKeepUiLabels, useKeepUrlSync, useUiLabelVisibility };
|
package/dist/index.js
CHANGED
|
@@ -2890,21 +2890,29 @@ function KeepQuickEditor({
|
|
|
2890
2890
|
debounceMs = 300,
|
|
2891
2891
|
onSaved,
|
|
2892
2892
|
onSaveError,
|
|
2893
|
+
features,
|
|
2893
2894
|
...props
|
|
2894
2895
|
}) {
|
|
2895
2896
|
const view = useKeepQuickEditor(item, { debounceMs, onSaved, onSaveError });
|
|
2896
|
-
return /* @__PURE__ */ jsx7(KeepQuickEditorView, { ...props, state: view.state });
|
|
2897
|
+
return /* @__PURE__ */ jsx7(KeepQuickEditorView, { ...props, features, state: view.state });
|
|
2897
2898
|
}
|
|
2899
|
+
var DEFAULT_FEATURES = {
|
|
2900
|
+
note: true,
|
|
2901
|
+
tags: true,
|
|
2902
|
+
collection: true
|
|
2903
|
+
};
|
|
2898
2904
|
function KeepQuickEditorView({
|
|
2899
2905
|
state,
|
|
2900
2906
|
collectionIds,
|
|
2901
2907
|
collectionLabels,
|
|
2902
2908
|
showSaveButton = true,
|
|
2909
|
+
features,
|
|
2903
2910
|
children,
|
|
2904
2911
|
onClose,
|
|
2905
2912
|
focusScopeRef,
|
|
2906
2913
|
...props
|
|
2907
2914
|
}) {
|
|
2915
|
+
const enabled = { ...DEFAULT_FEATURES, ...features };
|
|
2908
2916
|
const collections = useKeepCollections({ targetType: state.item.targetType, orderBy: "name" });
|
|
2909
2917
|
const rootRef = useRef4(null);
|
|
2910
2918
|
const noteLabel = useUiLabel("note");
|
|
@@ -2937,7 +2945,7 @@ function KeepQuickEditorView({
|
|
|
2937
2945
|
};
|
|
2938
2946
|
const statusMessage = state.saveStatus === "dirty" ? unsavedChangesLabel : state.saveStatus === "saving" ? savingLabel : state.saveStatus === "saved" ? savedLabel : state.saveStatus === "error" ? getErrorMessage2(state.error, errorLabel) : null;
|
|
2939
2947
|
const body = typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
2940
|
-
/* @__PURE__ */ jsxs5("label", { "data-keep-field": "note", children: [
|
|
2948
|
+
enabled.note ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "note", children: [
|
|
2941
2949
|
showNoteLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: noteLabel }) : null,
|
|
2942
2950
|
/* @__PURE__ */ jsx7(
|
|
2943
2951
|
"textarea",
|
|
@@ -2947,8 +2955,8 @@ function KeepQuickEditorView({
|
|
|
2947
2955
|
onChange: (event) => state.setNote(event.currentTarget.value)
|
|
2948
2956
|
}
|
|
2949
2957
|
)
|
|
2950
|
-
] }),
|
|
2951
|
-
/* @__PURE__ */ jsxs5("label", { "data-keep-field": "tags", children: [
|
|
2958
|
+
] }) : null,
|
|
2959
|
+
enabled.tags ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "tags", children: [
|
|
2952
2960
|
showTagsLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: tagsLabel }) : null,
|
|
2953
2961
|
/* @__PURE__ */ jsx7(
|
|
2954
2962
|
"input",
|
|
@@ -2960,8 +2968,8 @@ function KeepQuickEditorView({
|
|
|
2960
2968
|
)
|
|
2961
2969
|
}
|
|
2962
2970
|
)
|
|
2963
|
-
] }),
|
|
2964
|
-
/* @__PURE__ */ jsxs5("label", { "data-keep-field": "collection", children: [
|
|
2971
|
+
] }) : null,
|
|
2972
|
+
enabled.collection ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "collection", children: [
|
|
2965
2973
|
showCollectionLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: collectionLabel }) : null,
|
|
2966
2974
|
/* @__PURE__ */ jsxs5(
|
|
2967
2975
|
"select",
|
|
@@ -2975,7 +2983,7 @@ function KeepQuickEditorView({
|
|
|
2975
2983
|
]
|
|
2976
2984
|
}
|
|
2977
2985
|
)
|
|
2978
|
-
] }),
|
|
2986
|
+
] }) : null,
|
|
2979
2987
|
statusMessage ? /* @__PURE__ */ jsx7(
|
|
2980
2988
|
"p",
|
|
2981
2989
|
{
|
|
@@ -4471,6 +4479,7 @@ function KeepItemCardRoot({
|
|
|
4471
4479
|
showEditButton = false,
|
|
4472
4480
|
onEdit,
|
|
4473
4481
|
editSlot,
|
|
4482
|
+
editFeatures,
|
|
4474
4483
|
saveButtonLabels,
|
|
4475
4484
|
asChild = false,
|
|
4476
4485
|
href: hrefOption,
|
|
@@ -4559,7 +4568,7 @@ function KeepItemCardRoot({
|
|
|
4559
4568
|
] }) : null;
|
|
4560
4569
|
const error = view.itemState.error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: getErrorMessage3(view.itemState.error, view.labels.error) }) : null;
|
|
4561
4570
|
const actions = view.statusLabel ? /* @__PURE__ */ jsx18(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4562
|
-
showEditButton ? isEditOpen ? /* @__PURE__ */ jsx18("div", { id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx18(KeepQuickEditor, { item: view.itemState.item ?? item, onClose: closeEdit }) }) : /* @__PURE__ */ jsx18(
|
|
4571
|
+
showEditButton ? isEditOpen ? /* @__PURE__ */ jsx18("div", { id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx18(KeepQuickEditor, { item: view.itemState.item ?? item, onClose: closeEdit, features: editFeatures }) }) : /* @__PURE__ */ jsx18(
|
|
4563
4572
|
"button",
|
|
4564
4573
|
{
|
|
4565
4574
|
ref: editTriggerRef,
|