@keepkit/ui 0.28.15 → 0.28.16
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 +56 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +450 -386
- package/dist/index.js.map +1 -1
- package/dist/styles/base.css +13 -6
- package/dist/styles/collection.css +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[日本語](#日本語) | [English](#english)
|
|
4
4
|
|
|
5
|
-
Release: v0.28.
|
|
5
|
+
Release: v0.28.16
|
|
6
6
|
|
|
7
7
|
## 日本語
|
|
8
8
|
|
|
@@ -145,12 +145,35 @@ function RecoveryScreen() {
|
|
|
145
145
|
| コレクション管理 | `keep.CollectionManager` |
|
|
146
146
|
| 画面一式 | `keep.Workspace`。`basic` / `standard` / `management` / `sync`プリセット |
|
|
147
147
|
| メモ・タグ・保存直後の編集 | `KeepNoteEditor`、`KeepTagEditor`、`KeepSavePopover`、`KeepQuickEditor` |
|
|
148
|
+
|
|
148
149
|
| 再発見・巡回・並び替え | `KeepRediscoveryPanel`、`KeepTourBar`、`KeepFloatingTour`、`KeepReorderableList` |
|
|
149
150
|
| 復元・保存対象の状態・同期状態 | `KeepUndo`、`keep.Backup`、`KeepItemStatusBadge`、`KeepSyncStatusBanner`、`KeepSyncRecoveryDialog` |
|
|
150
151
|
|
|
151
152
|
各コンポーネントは同じProvider内に配置します。`renderItem`、slots、render propsで独自レイアウトへ組み込めます。
|
|
153
|
+
`KeepSavePopover`の編集パネルは、最も近い開いている`dialog`内、または`document.body`に表示されます。独自モーダルでは`portalContainer`にモーダルのコンテンツ要素を指定してください。
|
|
152
154
|
`KeepItemCard`の`Link` / `Media` / `Content` / `Title` / `Tags` / `Actions`でカードの一部だけを組み替えることもできます。
|
|
153
155
|
|
|
156
|
+
### サイトのナビゲーションから一覧を開く
|
|
157
|
+
|
|
158
|
+
共通レイアウトにProviderを一つ置き、ヘッダーやモバイルナビゲーションから保存一覧のURLへリンクします。保存通知からも同じURLに移動できます。ルーティングには利用側のRouterを使用してください。
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import { useState } from "react";
|
|
162
|
+
|
|
163
|
+
function Site() {
|
|
164
|
+
const [saved, setSaved] = useState(false);
|
|
165
|
+
return (
|
|
166
|
+
<keep.Provider onFeedback={(event) => { if (event.type === "item-saved") setSaved(true); }}>
|
|
167
|
+
<header><a href="/saved">保存一覧</a></header>
|
|
168
|
+
{saved && <p role="status">保存しました。 <a href="/saved">保存一覧を見る</a></p>}
|
|
169
|
+
<SiteRoutes /> {/* 記事ページは keep.Button、/saved は keep.Collection */}
|
|
170
|
+
</keep.Provider>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
既存のDrawerを使う場合は、同じProvider内のDrawerに`keep.Collection`を配置します。保存後の編集パネルは画面端とスクロールに追従します。`buttonProps`でラベルやアイコンを指定できます。
|
|
176
|
+
|
|
154
177
|
### テーマとアクセシビリティ
|
|
155
178
|
|
|
156
179
|
通常は`@keepkit/ui/theme.css`を読み込みます。Tailwind CSS v4/shadcnではグローバルCSSに次を記載します。
|
|
@@ -174,8 +197,17 @@ Providerの`theme="ocean"`や`mode="light" | "dark" | "system"`、`density`、`r
|
|
|
174
197
|
|
|
175
198
|
保存・同期の契約は[Core README](../keepkit/README.md)、デモとNext.jsサンプルは[リポジトリREADME](../../README.md)を参照してください。
|
|
176
199
|
|
|
200
|
+
保存ボタンは保存状態の読み込み中と更新中は操作できません。
|
|
201
|
+
|
|
202
|
+
同じ保存領域内では、`targetType`に関係なく`id`を一意にしてください。例えば `article:123` と `product:123` を使います。
|
|
203
|
+
|
|
177
204
|
## English
|
|
178
205
|
|
|
206
|
+
Save buttons are disabled while saved state is loading or a mutation is in progress.
|
|
207
|
+
|
|
208
|
+
Use an `id` unique across all target types within the same storage scope, for example `article:123` and `product:123`.
|
|
209
|
+
|
|
210
|
+
|
|
179
211
|
React UI for KeepKit, including `@keepkit/core`, with a shared provider for save buttons and collections.
|
|
180
212
|
CSS is optional: use the supplied theme or your own styles. Requires React 18 or later.
|
|
181
213
|
|
|
@@ -321,6 +353,29 @@ Use `KeepQuickEditor.closeLabel` to customize the completion button. Manual savi
|
|
|
321
353
|
Place components under the same provider. Use `renderItem`, slots, or render props for custom layouts.
|
|
322
354
|
Rearrange card regions through `KeepItemCard.Link` / `Media` / `Content` / `Title` / `Tags` / `Actions`.
|
|
323
355
|
|
|
356
|
+
### Open saved items from site navigation
|
|
357
|
+
|
|
358
|
+
Mount one provider in the shared layout and link to the saved page from the header or mobile navigation. A save notification can link to the same page. Use your application's router for navigation.
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
import { useState } from "react";
|
|
362
|
+
|
|
363
|
+
function Site() {
|
|
364
|
+
const [saved, setSaved] = useState(false);
|
|
365
|
+
return (
|
|
366
|
+
<keep.Provider onFeedback={(event) => { if (event.type === "item-saved") setSaved(true); }}>
|
|
367
|
+
<header><a href="/saved">Saved items</a></header>
|
|
368
|
+
{saved && <p role="status">Saved. <a href="/saved">View saved items</a></p>}
|
|
369
|
+
<SiteRoutes /> {/* Article pages use keep.Button; /saved renders keep.Collection. */}
|
|
370
|
+
</keep.Provider>
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
To use an existing drawer, place `keep.Collection` inside it under the same provider. The post-save editor follows the trigger and viewport. Configure its labels and icons through `buttonProps`.
|
|
376
|
+
|
|
377
|
+
`KeepSavePopover` renders its editor in the nearest open native `dialog`, or in `document.body` otherwise. For a custom modal with a focus trap, pass its content element as `portalContainer` so the editor remains inside the modal.
|
|
378
|
+
|
|
324
379
|
### Theme and accessibility
|
|
325
380
|
|
|
326
381
|
Import `@keepkit/ui/theme.css` for the standard theme. For Tailwind CSS v4 or shadcn, add these global CSS imports:
|
package/dist/index.d.ts
CHANGED
|
@@ -251,6 +251,7 @@ type KeepSavePopoverProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes
|
|
|
251
251
|
defaultOpen?: boolean;
|
|
252
252
|
onOpenChange?: (open: boolean) => void;
|
|
253
253
|
dialogLabel?: string;
|
|
254
|
+
portalContainer?: HTMLElement | null;
|
|
254
255
|
buttonProps?: Omit<KeepButtonProps<TMeta>, "item" | "asChild"> & {
|
|
255
256
|
asChild?: false;
|
|
256
257
|
};
|
|
@@ -258,7 +259,7 @@ type KeepSavePopoverProps<TMeta = Record<string, unknown>> = Omit<HTMLAttributes
|
|
|
258
259
|
children?: ReactNode;
|
|
259
260
|
};
|
|
260
261
|
/** Opens a quick editor only after this trigger changes from unsaved to saved. */
|
|
261
|
-
declare function KeepSavePopover<TMeta = Record<string, unknown>>({ item, open: controlledOpen, defaultOpen, onOpenChange, dialogLabel, buttonProps, editorProps, children, ...props }: KeepSavePopoverProps<TMeta>): react.JSX.Element;
|
|
262
|
+
declare function KeepSavePopover<TMeta = Record<string, unknown>>({ item, open: controlledOpen, defaultOpen, onOpenChange, dialogLabel, portalContainer, buttonProps, editorProps, children, ...props }: KeepSavePopoverProps<TMeta>): react.JSX.Element;
|
|
262
263
|
|
|
263
264
|
type KeepUndoProps = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
264
265
|
children?: ReactNode;
|