@softure-ai/theme-notion 0.3.0 → 0.5.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/CHANGELOG.md +48 -0
- package/README.md +60 -11
- package/dist/base.css +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/maplibre.css +2 -0
- package/dist/notion/Sortable.d.ts +17 -6
- package/dist/notion/Sortable.d.ts.map +1 -1
- package/dist/notion/Sortable.js +97 -22
- package/dist/notion/Sortable.js.map +1 -1
- package/dist/notion/Stats.d.ts +3 -0
- package/dist/notion/Stats.d.ts.map +1 -1
- package/dist/notion/Stats.js +9 -4
- package/dist/notion/Stats.js.map +1 -1
- package/dist/preflight.css +2 -0
- package/dist/ui/command.d.ts +6 -1
- package/dist/ui/command.d.ts.map +1 -1
- package/dist/ui/command.js +3 -3
- package/dist/ui/command.js.map +1 -1
- package/dist/ui/item.d.ts.map +1 -1
- package/dist/ui/item.js +1 -0
- package/dist/ui/item.js.map +1 -1
- package/package.json +6 -3
- package/src/index.ts +2 -0
- package/src/notion/Sortable.tsx +147 -30
- package/src/notion/Stats.tsx +17 -5
- package/src/ui/command.tsx +11 -3
- package/src/ui/item.tsx +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,54 @@ Newest first. Each version lists what changed for an app that uses the theme. Wh
|
|
|
4
4
|
production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
|
|
5
5
|
"Definition of done").
|
|
6
6
|
|
|
7
|
+
## 0.5.0
|
|
8
|
+
|
|
9
|
+
- Needs `@softure-ai/theme-kit` `^0.1.4` (was `^0.1.3`): the version whose `softure-theme-css` writes `preflight.css`
|
|
10
|
+
and the stylesheet re-exports (#795).
|
|
11
|
+
- `Command` (#809): `CommandDialog` passes its `title` to cmdk's `label`, so the palette's combobox is named by the
|
|
12
|
+
dialog's title (it had an empty name: cmdk's `aria-labelledby` points at its hidden label and wins over an
|
|
13
|
+
`aria-label` on `CommandInput`). A bare `Command` needs `label` from the app. `CommandInput` takes `children`,
|
|
14
|
+
rendered after the input inside the input row (a `Kbd` "Esc" sits at its right end with no positioning), and
|
|
15
|
+
`wrapperClassName`, merged into the row's classes (`h-12` for the 48 px row). An app drops its absolutely
|
|
16
|
+
positioned `Kbd` beside `CommandInput` and its parent selector on `data-slot=command-input-wrapper`; a `label` it
|
|
17
|
+
set on `Command` keeps working. Without the new props the classes are unchanged.
|
|
18
|
+
- `StatCards` (#813): a card takes an optional `icon` (a Lucide icon component, e.g. `icon: Wallet`), drawn before the
|
|
19
|
+
label at 16 px with `ICON_STROKE_WIDTH` in the label's muted colour, 6 px apart, `aria-hidden`. An app that rebuilt
|
|
20
|
+
the card from `Card` to show the icon goes back to `StatCards`. A card without `icon` renders as before.
|
|
21
|
+
- `base.css`, `preflight.css`, `maplibre.css` (#795): the kit's page stylesheets, exported by the theme as
|
|
22
|
+
`@softure-ai/theme-notion/<name>.css`. Each is one `@import` of the kit's file, resolved from the theme's own dependency,
|
|
23
|
+
so the app gets the kit version the theme was built against and needs no `@softure-ai/theme-kit` of its own. An app
|
|
24
|
+
replaces `@softure-ai/theme-kit/` with `@softure-ai/theme-notion/` in its `globals.css` and drops a direct
|
|
25
|
+
`@softure-ai/theme-kit` dependency it kept only for the CSS. The old imports keep working while the kit is hoisted.
|
|
26
|
+
|
|
27
|
+
## 0.4.0
|
|
28
|
+
|
|
29
|
+
- Server Components (#770): the package root imports from a React Server Component again. 0.3.0's `ui/item.tsx`
|
|
30
|
+
created the `ItemGroup` context at module level without `"use client"`, so `next build` failed with
|
|
31
|
+
`createContext is not a function` on any server page that imported from `@softure-ai/theme-notion`, even for
|
|
32
|
+
server-safe parts such as `PageHeader` or `Empty`. The file is a client module now; `tests/repo/themes.test.ts`
|
|
33
|
+
checks every theme so a file with a context or a component hook cannot ship without the directive. An app on 0.2.0
|
|
34
|
+
moves to this version with no change of its own; an app on 0.3.0 drops any workaround that avoided the root import.
|
|
35
|
+
- `SortableList` covers what kept an app on its own dnd-kit wiring (#771); everything is opt-in, existing lists
|
|
36
|
+
behave as before:
|
|
37
|
+
- `disabled` on the list (read-only: no row lifts by touch, mouse or keyboard, rows stay clickable) and on a
|
|
38
|
+
`SortableItem` (one row; wins over the list's). A disabled row carries `data-disabled` and no drag attributes; a
|
|
39
|
+
disabled row's `SortableHandle` is a disabled button.
|
|
40
|
+
- `group` on a `SortableItem`: a lifted row lands only among rows of its own group, by pointer and keyboard.
|
|
41
|
+
- `onDragStart(id)`, `onDragEnd(id, move | null)` (every drop, `null` when the order stayed) and
|
|
42
|
+
`onDragCancel(id)`; the list carries `data-sorting` while a row is lifted. The list's props no longer take the
|
|
43
|
+
native HTML `onDragStart` / `onDragEnd` (dnd-kit never used native drag events).
|
|
44
|
+
- `dragBy="activator"` with `SortableActivator`: the app's own element inside the row lifts it with the row's
|
|
45
|
+
hold; a press elsewhere in the row does not. The keyboard picks up the focused row, which stays focusable.
|
|
46
|
+
- `as="ol"`; children that are not a `SortableItem` stay in place.
|
|
47
|
+
- Fix: a key pressed on a control inside a row (Enter on a button) no longer picks up the row in `row` mode.
|
|
48
|
+
- Migration for an app with its own `DndContext` / `useSortable`: render `SortableList` (`as="ol"` for a numbered
|
|
49
|
+
list, `disabled` for the read-only mode, `dragBy="activator"` with the row's button in `SortableActivator`),
|
|
50
|
+
a `SortableItem` per row with `group`, and move the lift and drop side effects (hiding secondary content, a
|
|
51
|
+
vibration) to `onDragStart` / `onDragEnd` / `onDragCancel` or to `group-data-[sorting]:…` classes. Drop the
|
|
52
|
+
click grace timer after a drop: the click that ends a mouse drop never reaches the row. Remove the app's
|
|
53
|
+
`accent-strong` / `shadow-menu` lifted classes and its `@dnd-kit/*` dependencies if nothing else uses them.
|
|
54
|
+
|
|
7
55
|
## 0.3.0
|
|
8
56
|
|
|
9
57
|
- Needs `@softure-ai/theme-kit` `^0.1.3` (was `^0.1.2`): the version whose `base.css` carries the border and outline
|
package/README.md
CHANGED
|
@@ -16,11 +16,16 @@ npm i @softure-ai/theme-notion tailwindcss @tailwindcss/postcss
|
|
|
16
16
|
@import "tailwindcss";
|
|
17
17
|
@import "@softure-ai/theme-notion/theme.css"; /* tokens, utilities, dark:, animations, the components' classes */
|
|
18
18
|
@import "@softure-ai/theme-notion/sft-bridge.css"; /* optional: pages of the SOFTURE packages in a PageFrame */
|
|
19
|
-
@import "@softure-ai/theme-
|
|
19
|
+
@import "@softure-ai/theme-notion/base.css"; /* body on the theme's background, text colour and font */
|
|
20
20
|
@import "@softure-ai/theme-notion/page.css"; /* body text 14 px, blue text selection, font smoothing */
|
|
21
|
-
@import "@softure-ai/theme-
|
|
21
|
+
@import "@softure-ai/theme-notion/maplibre.css"; /* only if the app shows MapLibre maps */
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
Every stylesheet comes from the theme. `base.css`, `maplibre.css` and `preflight.css` are the kit's
|
|
25
|
+
([`@softure-ai/theme-kit`](../theme-kit/README.md)), re-exported by the theme: they resolve the kit from the theme's own
|
|
26
|
+
dependency, so the app declares only the theme and gets the kit version the theme was built against, in any package
|
|
27
|
+
manager layout.
|
|
28
|
+
|
|
24
29
|
`theme.css` names the package's components as Tailwind sources, so their classes are generated without the app
|
|
25
30
|
listing `node_modules`. It clears Tailwind's default palette: only the theme's colours exist as utilities.
|
|
26
31
|
|
|
@@ -31,13 +36,13 @@ taking the scoped preflight instead of Tailwind's:
|
|
|
31
36
|
@import "@softure-ai/ui/styles.css"; /* first: it declares the layer order */
|
|
32
37
|
@layer theme, base, components, utilities;
|
|
33
38
|
@import "tailwindcss/theme.css" layer(theme);
|
|
34
|
-
@import "@softure-ai/theme-
|
|
39
|
+
@import "@softure-ai/theme-notion/preflight.css"; /* Tailwind's preflight, only inside [data-slot] elements */
|
|
35
40
|
@import "tailwindcss/utilities.css" layer(utilities);
|
|
36
41
|
@import "@softure-ai/theme-notion/theme.css";
|
|
37
42
|
@import "@softure-ai/theme-notion/sft-bridge.css";
|
|
38
|
-
@import "@softure-ai/theme-
|
|
43
|
+
@import "@softure-ai/theme-notion/base.css"; /* nothing else styles body under the scoped preflight */
|
|
39
44
|
@import "@softure-ai/theme-notion/page.css";
|
|
40
|
-
@import "@softure-ai/theme-
|
|
45
|
+
@import "@softure-ai/theme-notion/maplibre.css"; /* only if the app shows MapLibre maps */
|
|
41
46
|
```
|
|
42
47
|
|
|
43
48
|
`base.css` gives `body` the theme's background, text colour and sans font without the browser's 8 px margin, so a
|
|
@@ -71,7 +76,8 @@ import { CircleCheck } from "lucide-react";
|
|
|
71
76
|
wording by props: `Breadcrumb aria-label`, `BreadcrumbEllipsis label`, `PageHeader crumbsLabel`,
|
|
72
77
|
`DialogContent closeLabel`, `SheetContent closeLabel`, `SidePanel closeLabel`, `Steps stateLabels`,
|
|
73
78
|
`Sidebar mobileTitle mobileDescription`, `SidebarTrigger label`, `SidebarRail label`, `Spinner aria-label`,
|
|
74
|
-
`CommandDialog title description
|
|
79
|
+
`CommandDialog title description` (`title` also names its search field), `Command label` (the search field's
|
|
80
|
+
name outside a `CommandDialog`; without it the field has none), `SortableList instructions announcements`, `SortableHandle label`.
|
|
75
81
|
|
|
76
82
|
## Rules, in short
|
|
77
83
|
|
|
@@ -117,7 +123,7 @@ and more, a native `<details>`), `PageFrame` (a page outside the app shell, the
|
|
|
117
123
|
and count, the shown tab in the address; `Tabs` keeps it in client state), `MarkPopover` (a counted tag that opens a
|
|
118
124
|
list of what it counts, below), `FilterChip` and `FilterChipAdd` (a list's filter pills, below), `Steps` (numbered
|
|
119
125
|
stages with a state, below), `Code` (inline code) and `CodeBlock` (a mono block for logs and paths, below),
|
|
120
|
-
`SortableList`, `SortableItem` and `
|
|
126
|
+
`SortableList`, `SortableItem`, `SortableHandle` and `SortableActivator` (rows reordered by dragging, below).
|
|
121
127
|
|
|
122
128
|
**`FilterChip`.** The filters above a list or a table, drawn the way a Notion database view draws them: a 24 px pill
|
|
123
129
|
`icon · Label: value ▾` that opens a menu of options in the design system's popover. While the default value is
|
|
@@ -161,14 +167,15 @@ A screen's summary figures: `StatsFold` (figures folded under a heading, closed
|
|
|
161
167
|
optional `hint`, optional `aside` tag; `isFullWidth` and `isOneRow` change the grid) and `StatPills` ("label **value**" tags in one row). Each figure takes a
|
|
162
168
|
`tone`; the app keeps only its own table of which meaning takes which tone. A card's `progress` (0–100, clamped) draws
|
|
163
169
|
the package's 6 px `Progress` under the figure, filled in the card's tone (primary without one) and named by
|
|
164
|
-
`progressLabel` (default: the card's `label`).
|
|
170
|
+
`progressLabel` (default: the card's `label`). A card's `icon` (a Lucide icon component) is drawn before the label: 16 px,
|
|
171
|
+
`ICON_STROKE_WIDTH`, the label's muted colour, 6 px apart, `aria-hidden` (the label stays the card's text).
|
|
165
172
|
|
|
166
173
|
```tsx
|
|
167
174
|
<StatsFold title="Summary">
|
|
168
175
|
<StatCards
|
|
169
176
|
label="Totals"
|
|
170
177
|
cards={[
|
|
171
|
-
{ key: "paid", label: "Paid", value: "1,200", tone: "success" },
|
|
178
|
+
{ key: "paid", label: "Paid", value: "1,200", tone: "success", icon: Wallet },
|
|
172
179
|
{ key: "owed", label: "Owed", value: "300", tone: "danger", hint: "2 invoices", aside: { text: "+5%" } },
|
|
173
180
|
{ key: "hours", label: "Hours", value: "21.5 / 23.4 h", progress: 92, progressLabel: "Hours used" },
|
|
174
181
|
]}
|
|
@@ -230,8 +237,20 @@ app: `items` are the rows' ids in order, and `onReorder(next, { id, from, to })`
|
|
|
230
237
|
`dragBy="handle"` leaves the row alone and drags only by a `SortableHandle` (a ghost grip button, for a desktop list;
|
|
231
238
|
a mouse starts at once there). A screen reader hears the `instructions` on the row (or handle) and the
|
|
232
239
|
`announcements` while it moves: strings with `{item}`, `{position}` and `{total}`, where `getItemLabel(id)` names the
|
|
233
|
-
row (the id by default). `data-slot="sortable-list"`, `sortable-item` (with `data-id`)
|
|
234
|
-
parts.
|
|
240
|
+
row (the id by default). `data-slot="sortable-list"`, `sortable-item` (with `data-id`), `sortable-handle` and
|
|
241
|
+
`sortable-activator` mark the parts.
|
|
242
|
+
|
|
243
|
+
`dragBy="activator"` lifts a row only from the app's own element wrapped in `SortableActivator` (the row's button,
|
|
244
|
+
not its unfolded details), with the same hold; the element keeps its click and keys. The keyboard still picks up the
|
|
245
|
+
focused row, so the row stays focusable next to the button: Space and Enter on the button keep meaning "open". A key
|
|
246
|
+
pressed on any control inside a row stays with that control in every mode. `disabled` on the list makes it read-only
|
|
247
|
+
(no row lifts by touch, mouse or keyboard, the drag attributes go, the rows keep their own handlers, `data-disabled`
|
|
248
|
+
marks them); `disabled` on a `SortableItem` holds one row and wins over the list's. `group` on a `SortableItem` keeps
|
|
249
|
+
a lifted row among rows of the same group (by pointer and keyboard); rows without a group form one together.
|
|
250
|
+
`onDragStart(id)`, `onDragEnd(id, move | null)` (every drop; `null` when the order stayed) and `onDragCancel(id)`
|
|
251
|
+
follow the drag, and the list carries `data-sorting` while a row is lifted (`group-data-[sorting]:hidden` on a row's
|
|
252
|
+
secondary content with `group` on the list). `as="ol"` renders a numbered list; children that are not a
|
|
253
|
+
`SortableItem` (an empty-state `<li>`) stay in place. The click that ends a mouse drop never reaches the row.
|
|
235
254
|
|
|
236
255
|
```tsx
|
|
237
256
|
<SortableList label="Shopping list" items={ids} onReorder={(next) => setIds(next)}
|
|
@@ -251,6 +270,23 @@ parts.
|
|
|
251
270
|
</SortableItem>
|
|
252
271
|
))}
|
|
253
272
|
</SortableList>
|
|
273
|
+
|
|
274
|
+
<SortableList label="Day" as="ol" items={ids} onReorder={setIds} dragBy="activator" disabled={isReadOnly}
|
|
275
|
+
onDragStart={() => navigator.vibrate?.(10)} className="group">
|
|
276
|
+
{ids.map((id) => (
|
|
277
|
+
<SortableItem key={id} id={id} group={byId[id].isStop ? "stops" : "to-fit"}>
|
|
278
|
+
<SortableActivator>
|
|
279
|
+
<button type="button" onClick={() => toggle(id)}>{byId[id].name}</button>
|
|
280
|
+
</SortableActivator>
|
|
281
|
+
{openId === id ? (
|
|
282
|
+
<div className="group-data-[sorting]:hidden">
|
|
283
|
+
<DetailTable label="Details" rows={byId[id].details} />
|
|
284
|
+
</div>
|
|
285
|
+
) : null}
|
|
286
|
+
</SortableItem>
|
|
287
|
+
))}
|
|
288
|
+
{ids.length === 0 ? <li className="text-muted-foreground">Nothing planned</li> : null}
|
|
289
|
+
</SortableList>
|
|
254
290
|
```
|
|
255
291
|
|
|
256
292
|
Deltas from stock shadcn:
|
|
@@ -262,6 +298,19 @@ Deltas from stock shadcn:
|
|
|
262
298
|
Notion callout).
|
|
263
299
|
- `input`, `textarea`, `select`, `input-group`: 28 px high, grey `field` background, thin `input` border.
|
|
264
300
|
- `dropdown-menu`, `select`, `popover`, `command`: radius 10, `shadow-menu` without a border, 28 px items.
|
|
301
|
+
- `command`: `CommandDialog` passes its `title` to cmdk's `label`, the search field's accessible name (cmdk's
|
|
302
|
+
`aria-labelledby` wins over an `aria-label` on `CommandInput`). `CommandInput` renders its `children` at the end of
|
|
303
|
+
the input row and merges `wrapperClassName` into the row:
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
<CommandDialog open={open} onOpenChange={setOpen} title="Search pages">
|
|
307
|
+
<CommandInput placeholder="Search…" wrapperClassName="h-12">
|
|
308
|
+
<Kbd>Esc</Kbd>
|
|
309
|
+
</CommandInput>
|
|
310
|
+
<CommandList>…</CommandList>
|
|
311
|
+
</CommandDialog>
|
|
312
|
+
```
|
|
313
|
+
|
|
265
314
|
- `dialog`, `alert-dialog`: radius 10, `shadow-dialog`, no border. `card`: `shadow-card` instead of a border.
|
|
266
315
|
- `checkbox` 16 px with a 1.5 px border, `radio-group` drawn the same (round, a `primary` dot), `switch` 26 × 16
|
|
267
316
|
(thumb shadow in `SWITCH_THUMB_SHADOW_CLASS`, for a native switch drawn the same), `tooltip` dark without an arrow,
|
package/dist/base.css
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export { PageFrame, type PageFrameProps } from "./notion/PageFrame.js";
|
|
|
50
50
|
export { PageHeader, type PageCrumb, type PageHeaderProps } from "./notion/PageHeader.js";
|
|
51
51
|
export { PropertyList, type Property, type PropertyListProps } from "./notion/PropertyList.js";
|
|
52
52
|
export { SidePanel, type SidePanelLayout, type SidePanelProps } from "./notion/SidePanel.js";
|
|
53
|
-
export { SortableHandle, SortableItem, SortableList, type SortableAnnouncements, type SortableDragBy, type SortableHandleProps, type SortableItemProps, type SortableListProps, type SortableMove, } from "./notion/Sortable.js";
|
|
53
|
+
export { SortableActivator, SortableHandle, SortableItem, SortableList, type SortableActivatorProps, type SortableAnnouncements, type SortableDragBy, type SortableHandleProps, type SortableItemProps, type SortableListProps, type SortableMove, } from "./notion/Sortable.js";
|
|
54
54
|
export { StatCards, StatPills, StatsFold, type StatCard, type StatCardAside, type StatCardsProps, type StatPill, type StatPillsProps, type StatsFoldProps, } from "./notion/Stats.js";
|
|
55
55
|
export { Status, type StatusProps } from "./notion/Status.js";
|
|
56
56
|
export { Steps, type StepItem, type StepState, type StepsLayout, type StepsProps } from "./notion/Steps.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;A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EAClB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ export { PageFrame } from "./notion/PageFrame.js";
|
|
|
52
52
|
export { PageHeader } from "./notion/PageHeader.js";
|
|
53
53
|
export { PropertyList } from "./notion/PropertyList.js";
|
|
54
54
|
export { SidePanel } from "./notion/SidePanel.js";
|
|
55
|
-
export { SortableHandle, SortableItem, SortableList, } from "./notion/Sortable.js";
|
|
55
|
+
export { SortableActivator, SortableHandle, SortableItem, SortableList, } from "./notion/Sortable.js";
|
|
56
56
|
export { StatCards, StatPills, StatsFold, } from "./notion/Stats.js";
|
|
57
57
|
export { Status } from "./notion/Status.js";
|
|
58
58
|
export { Steps } from "./notion/Steps.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,oGAAoG;AACpG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAuB,MAAM,qBAAqB,CAAC;AA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AOV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAoB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAoE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAE,MAAM,EAAqC,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Slot } from "radix-ui";
|
|
2
|
+
import { type ComponentProps, type ReactNode, type Ref } from "react";
|
|
2
3
|
import { Button } from "../ui/button.js";
|
|
3
4
|
export interface SortableAnnouncements {
|
|
4
5
|
readonly pickedUp: string;
|
|
@@ -11,8 +12,9 @@ export interface SortableMove {
|
|
|
11
12
|
readonly from: number;
|
|
12
13
|
readonly to: number;
|
|
13
14
|
}
|
|
14
|
-
export type SortableDragBy = "row" | "handle";
|
|
15
|
-
export interface SortableListProps extends Omit<ComponentProps<"ul">, "children"> {
|
|
15
|
+
export type SortableDragBy = "row" | "handle" | "activator";
|
|
16
|
+
export interface SortableListProps extends Omit<ComponentProps<"ul">, "children" | "ref" | "onDragStart" | "onDragEnd"> {
|
|
17
|
+
readonly ref?: Ref<HTMLUListElement | HTMLOListElement>;
|
|
16
18
|
readonly label: string;
|
|
17
19
|
readonly items: readonly string[];
|
|
18
20
|
readonly onReorder: (next: string[], move: SortableMove) => void;
|
|
@@ -22,15 +24,24 @@ export interface SortableListProps extends Omit<ComponentProps<"ul">, "children"
|
|
|
22
24
|
readonly instructions?: string;
|
|
23
25
|
readonly announcements?: Partial<SortableAnnouncements>;
|
|
24
26
|
readonly getItemLabel?: (id: string) => string;
|
|
27
|
+
readonly disabled?: boolean;
|
|
28
|
+
readonly as?: "ul" | "ol";
|
|
29
|
+
readonly onDragStart?: (id: string) => void;
|
|
30
|
+
readonly onDragEnd?: (id: string, move: SortableMove | null) => void;
|
|
31
|
+
readonly onDragCancel?: (id: string) => void;
|
|
25
32
|
readonly children: ReactNode;
|
|
26
33
|
}
|
|
27
|
-
export declare function SortableList({ label, items, onReorder, dragBy, holdDelay, tolerance, instructions, announcements, getItemLabel, className, children, ...props }: SortableListProps): import("react").JSX.Element;
|
|
34
|
+
export declare function SortableList({ label, items, onReorder, dragBy, holdDelay, tolerance, instructions, announcements, getItemLabel, disabled, as: List, onDragStart, onDragEnd, onDragCancel, ref, className, children, ...props }: SortableListProps): import("react").JSX.Element;
|
|
28
35
|
export interface SortableItemProps extends ComponentProps<"li"> {
|
|
29
36
|
readonly id: string;
|
|
37
|
+
readonly group?: string;
|
|
38
|
+
readonly disabled?: boolean;
|
|
30
39
|
}
|
|
31
|
-
export declare function SortableItem({ id, className, style, children, ...props }: SortableItemProps): import("react").JSX.Element;
|
|
40
|
+
export declare function SortableItem({ id, group, disabled, className, style, children, ...props }: SortableItemProps): import("react").JSX.Element;
|
|
41
|
+
export type SortableActivatorProps = ComponentProps<typeof Slot.Root>;
|
|
42
|
+
export declare function SortableActivator(props: SortableActivatorProps): import("react").JSX.Element;
|
|
32
43
|
export interface SortableHandleProps extends Omit<ComponentProps<typeof Button>, "children"> {
|
|
33
44
|
readonly label?: string;
|
|
34
45
|
}
|
|
35
|
-
export declare function SortableHandle({ label, className, ...props }: SortableHandleProps): import("react").JSX.Element;
|
|
46
|
+
export declare function SortableHandle({ label, className, disabled, ...props }: SortableHandleProps): import("react").JSX.Element;
|
|
36
47
|
//# sourceMappingURL=Sortable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sortable.d.ts","sourceRoot":"","sources":["../../src/notion/Sortable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sortable.d.ts","sourceRoot":"","sources":["../../src/notion/Sortable.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAmE,KA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CAAC,IAAI,CAAC,CAAC;AAKtE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAK9D;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,UAAU,CAAC;IAE1F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAID,wBAAgB,cAAc,CAAC,EAAE,KAAgC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,+BAoBtH"}
|
package/dist/notion/Sortable.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { closestCenter, DndContext, KeyboardSensor, MouseSensor, TouchSensor, useSensor, useSensors, } from "@dnd-kit/core";
|
|
3
|
+
import { closestCenter, DndContext, KeyboardSensor, MouseSensor, TouchSensor, useDndContext, useSensor, useSensors, } from "@dnd-kit/core";
|
|
4
4
|
import { arrayMove, SortableContext, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy, } from "@dnd-kit/sortable";
|
|
5
5
|
import { CSS } from "@dnd-kit/utilities";
|
|
6
6
|
import { GripVertical } from "lucide-react";
|
|
7
|
-
import {
|
|
7
|
+
import { Slot } from "radix-ui";
|
|
8
|
+
import { createContext, useContext, useId, useCallback, useRef, useState } from "react";
|
|
8
9
|
import { en as messages } from "../messages/en.js";
|
|
9
10
|
import { cn } from "../lib/utils.js";
|
|
10
11
|
import { Button } from "../ui/button.js";
|
|
@@ -15,13 +16,35 @@ const restrictToVerticalAxis = ({ transform }) => ({ ...transform, x: 0 });
|
|
|
15
16
|
function fillAnnouncement(template, values) {
|
|
16
17
|
return template.replace(/\{(\w+)\}/g, (match, key) => (key in values ? String(values[key]) : match));
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
function assignRef(ref, node) {
|
|
20
|
+
if (typeof ref === "function")
|
|
21
|
+
ref(node);
|
|
22
|
+
else if (ref)
|
|
23
|
+
ref.current = node;
|
|
24
|
+
}
|
|
25
|
+
// A row's group travels in the drag data; dnd-kit types that data loosely, so it is read as unknown.
|
|
26
|
+
function readGroup(data) {
|
|
27
|
+
if (typeof data !== "object" || data === null || !("group" in data))
|
|
28
|
+
return undefined;
|
|
29
|
+
return typeof data.group === "string" ? data.group : undefined;
|
|
30
|
+
}
|
|
31
|
+
// The keyboard sensor binds `onKeyDown`; the pointer sensors bind the rest.
|
|
32
|
+
function splitListeners(listeners) {
|
|
33
|
+
const entries = Object.entries(listeners ?? {});
|
|
34
|
+
return {
|
|
35
|
+
keyboard: Object.fromEntries(entries.filter(([name]) => name === "onKeyDown")),
|
|
36
|
+
pointer: Object.fromEntries(entries.filter(([name]) => name !== "onKeyDown")),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const SortableListContext = createContext({ dragBy: "row", isDisabled: false });
|
|
40
|
+
const SortableItemContext = createContext(null);
|
|
20
41
|
// A list whose rows are reordered by dragging: a long press lifts a row on a touch screen (a swipe before the hold
|
|
21
42
|
// still scrolls, a tap still activates the row), a mouse drags it, the keyboard picks it up with Space or Enter and
|
|
22
|
-
// moves it with the arrows. The order stays with the app: `onReorder` gets the new one.
|
|
23
|
-
|
|
43
|
+
// moves it with the arrows. The order stays with the app: `onReorder` gets the new one. While a row is lifted the
|
|
44
|
+
// list carries `data-sorting`.
|
|
45
|
+
export function SortableList({ label, items, onReorder, dragBy = "row", holdDelay = 500, tolerance = 8, instructions = messages.sortable.instructions, announcements, getItemLabel = (id) => id, disabled = false, as: List = "ul", onDragStart, onDragEnd, onDragCancel, ref, className, children, ...props }) {
|
|
24
46
|
const contextId = useId();
|
|
47
|
+
const [isSorting, setIsSorting] = useState(false);
|
|
25
48
|
const hold = { delay: holdDelay, tolerance };
|
|
26
49
|
const sensors = useSensors(useSensor(MouseSensor, {
|
|
27
50
|
activationConstraint: dragBy === "handle" ? { distance: HANDLE_MOUSE_DISTANCE } : hold,
|
|
@@ -48,36 +71,88 @@ export function SortableList({ label, items, onReorder, dragBy = "row", holdDela
|
|
|
48
71
|
onDragEnd: ({ active, over }) => announce(over ? copy.dropped : copy.cancelled, active.id, over?.id),
|
|
49
72
|
onDragCancel: ({ active }) => announce(copy.cancelled, active.id),
|
|
50
73
|
};
|
|
51
|
-
|
|
74
|
+
// The move a drop makes, or null when it keeps the order (no target, the row's own place, another group).
|
|
75
|
+
function getMove({ active, over }) {
|
|
52
76
|
if (!over || active.id === over.id)
|
|
53
|
-
return;
|
|
77
|
+
return null;
|
|
78
|
+
if (readGroup(active.data.current) !== readGroup(over.data.current))
|
|
79
|
+
return null;
|
|
54
80
|
const from = items.indexOf(String(active.id));
|
|
55
81
|
const to = items.indexOf(String(over.id));
|
|
56
82
|
if (from < 0 || to < 0)
|
|
57
|
-
return;
|
|
58
|
-
|
|
83
|
+
return null;
|
|
84
|
+
return { id: String(active.id), from, to };
|
|
85
|
+
}
|
|
86
|
+
function handleDragEnd(event) {
|
|
87
|
+
setIsSorting(false);
|
|
88
|
+
const move = getMove(event);
|
|
89
|
+
if (move)
|
|
90
|
+
onReorder(arrayMove([...items], move.from, move.to), move);
|
|
91
|
+
onDragEnd?.(String(event.active.id), move);
|
|
59
92
|
}
|
|
60
|
-
return (_jsx(DndContext, { id: contextId, sensors: sensors, collisionDetection: closestCenter, modifiers: [restrictToVerticalAxis], accessibility: { announcements: liveAnnouncements, screenReaderInstructions: { draggable: instructions } },
|
|
93
|
+
return (_jsx(DndContext, { id: contextId, sensors: sensors, collisionDetection: closestCenter, modifiers: [restrictToVerticalAxis], accessibility: { announcements: liveAnnouncements, screenReaderInstructions: { draggable: instructions } }, onDragStart: ({ active }) => {
|
|
94
|
+
setIsSorting(true);
|
|
95
|
+
onDragStart?.(String(active.id));
|
|
96
|
+
}, onDragEnd: handleDragEnd, onDragCancel: ({ active }) => {
|
|
97
|
+
setIsSorting(false);
|
|
98
|
+
onDragCancel?.(String(active.id));
|
|
99
|
+
}, children: _jsx(SortableContext, { items: [...items], strategy: verticalListSortingStrategy, children: _jsx(SortableListContext.Provider, { value: { dragBy, isDisabled: disabled }, children: _jsx(List, { ref: (node) => assignRef(ref, node), "aria-label": label, "data-slot": "sortable-list", "data-drag-by": dragBy, "data-disabled": disabled ? "" : undefined, "data-sorting": isSorting ? "" : undefined, className: cn("flex flex-col", className), ...props, children: children }) }) }) }));
|
|
61
100
|
}
|
|
62
101
|
// The lifted row floats on `accent-strong` with `shadow-menu`, above its siblings; `data-dragging` marks it.
|
|
63
102
|
const SORTABLE_ITEM = "rounded-md bg-background outline-none touch-manipulation select-none [-webkit-touch-callout:none] focus-visible:ring-2 focus-visible:ring-ring data-[dragging]:relative data-[dragging]:z-10 data-[dragging]:bg-accent-strong data-[dragging]:shadow-menu";
|
|
103
|
+
// The drag props the row element itself carries.
|
|
104
|
+
function getRowBinding(binding) {
|
|
105
|
+
if (binding.isDisabled || binding.dragBy === "handle")
|
|
106
|
+
return {};
|
|
107
|
+
if (binding.dragBy === "activator")
|
|
108
|
+
return { ...binding.attributes, ...splitListeners(binding.listeners).keyboard };
|
|
109
|
+
return { ...binding.attributes, ...binding.listeners };
|
|
110
|
+
}
|
|
64
111
|
// One row of a `SortableList`. In `row` mode the row itself is the drag target and is focusable; in `handle` mode a
|
|
65
|
-
// `SortableHandle` inside it is
|
|
66
|
-
|
|
67
|
-
|
|
112
|
+
// `SortableHandle` inside it is; in `activator` mode a `SortableActivator` takes the press and the row the keyboard.
|
|
113
|
+
// The drag's own pointer and key handlers win over the same props on the drag target; a key pressed on a control
|
|
114
|
+
// inside the row stays with that control.
|
|
115
|
+
export function SortableItem({ id, group, disabled, className, style, children, ...props }) {
|
|
116
|
+
const list = useContext(SortableListContext);
|
|
117
|
+
const { active } = useDndContext();
|
|
118
|
+
const isDisabled = disabled ?? list.isDisabled;
|
|
119
|
+
const isOtherGroup = active !== null && readGroup(active.data.current) !== group;
|
|
68
120
|
const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({
|
|
69
121
|
id,
|
|
122
|
+
data: { group },
|
|
70
123
|
attributes: { role: "listitem" },
|
|
124
|
+
disabled: { draggable: isDisabled, droppable: isOtherGroup },
|
|
71
125
|
});
|
|
72
|
-
const
|
|
73
|
-
|
|
126
|
+
const binding = { attributes, listeners, setActivatorNodeRef, dragBy: list.dragBy, isDisabled };
|
|
127
|
+
const isRowActivator = list.dragBy !== "handle";
|
|
128
|
+
// The row is the keyboard's activator outside `handle` mode, so a key on a control inside the row stays there.
|
|
129
|
+
const setRowRef = useCallback((node) => {
|
|
130
|
+
setNodeRef(node);
|
|
131
|
+
if (isRowActivator)
|
|
132
|
+
setActivatorNodeRef(node);
|
|
133
|
+
}, [setNodeRef, setActivatorNodeRef, isRowActivator]);
|
|
134
|
+
return (_jsx(SortableItemContext.Provider, { value: binding, children: _jsx("li", { ref: setRowRef, "data-slot": "sortable-item", "data-id": id, "data-group": group, "data-disabled": isDisabled ? "" : undefined, "data-dragging": isDragging ? "" : undefined, className: cn(SORTABLE_ITEM, className), style: { ...style, transform: CSS.Translate.toString(transform), transition }, ...props, ...getRowBinding(binding), children: children }) }));
|
|
74
135
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const binding = useContext(SortableHandleContext);
|
|
136
|
+
function useSortableItemBinding(part) {
|
|
137
|
+
const binding = useContext(SortableItemContext);
|
|
78
138
|
if (!binding)
|
|
79
|
-
throw new Error(
|
|
80
|
-
|
|
81
|
-
|
|
139
|
+
throw new Error(`${part} failed: it must be rendered inside a SortableItem`);
|
|
140
|
+
return binding;
|
|
141
|
+
}
|
|
142
|
+
// The app's own element inside a row (a button, a title) that lifts the row on a press, for a list with
|
|
143
|
+
// `dragBy="activator"`; a press elsewhere in the row does nothing. Its own click and keys keep working. In the other
|
|
144
|
+
// modes, or on a disabled row, it renders its child unchanged.
|
|
145
|
+
export function SortableActivator(props) {
|
|
146
|
+
const binding = useSortableItemBinding("SortableActivator");
|
|
147
|
+
const isBound = binding.dragBy === "activator" && !binding.isDisabled;
|
|
148
|
+
const pointer = isBound ? splitListeners(binding.listeners).pointer : {};
|
|
149
|
+
return _jsx(Slot.Root, { "data-slot": "sortable-activator", ...props, ...pointer });
|
|
150
|
+
}
|
|
151
|
+
// A grip button that drags its row, for a list with `dragBy="handle"`.
|
|
152
|
+
// On a disabled row it is a disabled button.
|
|
153
|
+
export function SortableHandle({ label = messages.sortable.handle, className, disabled, ...props }) {
|
|
154
|
+
const { attributes, listeners, setActivatorNodeRef, isDisabled } = useSortableItemBinding("SortableHandle");
|
|
155
|
+
const dragProps = isDisabled ? {} : { ...attributes, ...listeners };
|
|
156
|
+
return (_jsx(Button, { ref: setActivatorNodeRef, type: "button", variant: "ghost", size: "icon-sm", "data-slot": "sortable-handle", className: cn("cursor-grab touch-none text-muted-foreground active:cursor-grabbing", className), disabled: isDisabled || disabled, ...props, ...dragProps, role: "button", "aria-label": label, children: _jsx(GripVertical, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) }));
|
|
82
157
|
}
|
|
83
158
|
//# sourceMappingURL=Sortable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sortable.js","sourceRoot":"","sources":["../../src/notion/Sortable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,GAKX,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,eAAe,EACf,2BAA2B,EAC3B,WAAW,EACX,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":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K,KAAK,KAAM,OAAO,GAAI,CAAC;AAC9E,CAAC;AAOD,uEAAuE;AACvE,6CAA6C;AAC7C,MAAM,UAAU,cAAc,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAuB;IACrH,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,GAAG,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IAC5G,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,SAAS,EAAE,CAAC;IACpE,OAAO,CACL,KAAC,MAAM,IACL,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,SAAS,eACJ,iBAAiB,EAC3B,SAAS,EAAE,EAAE,CAAC,qEAAqE,EAAE,SAAS,CAAC,EAC/F,QAAQ,EAAE,UAAU,IAAI,QAAQ,KAC5B,KAAK,KACL,SAAS,EACb,IAAI,EAAC,QAAQ,gBACD,KAAK,YAEjB,KAAC,YAAY,mBAAa,MAAM,EAAC,WAAW,EAAE,iBAAiB,GAAI,GAC5D,CACV,CAAC;AACJ,CAAC"}
|
package/dist/notion/Stats.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
import { type Tone } from "./tones.js";
|
|
3
4
|
export interface StatsFoldProps {
|
|
@@ -15,6 +16,8 @@ export interface StatCard {
|
|
|
15
16
|
/** Unique within the row; kept as `data-stat`. */
|
|
16
17
|
readonly key: string;
|
|
17
18
|
readonly label: string;
|
|
19
|
+
/** A decorative icon before the label: 16 px, the design system's stroke, the label's muted colour. */
|
|
20
|
+
readonly icon?: LucideIcon;
|
|
18
21
|
readonly value: string;
|
|
19
22
|
readonly hint?: string;
|
|
20
23
|
readonly tone?: Tone;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stats.d.ts","sourceRoot":"","sources":["../../src/notion/Stats.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stats.d.ts","sourceRoot":"","sources":["../../src/notion/Stats.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,OAAO,EAAqC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE1E,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAID,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,cAAc,+BAmBvE;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,kDAAkD;IAClD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,wGAAwG;IACxG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,8FAA8F;IAC9F,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAyBD,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAmB,EAAE,QAAgB,EAAE,EAAE,cAAc,+BAsDhG;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;CACrC;AAGD,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,cAAc,+BAYzD"}
|
package/dist/notion/Stats.js
CHANGED
|
@@ -20,15 +20,20 @@ function getStatCardsLayout(isFullWidth, isOneRow) {
|
|
|
20
20
|
return "row";
|
|
21
21
|
return isFullWidth ? "full" : "grid";
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
function StatCardLabel({ label, icon: Icon }) {
|
|
24
|
+
if (Icon === undefined)
|
|
25
|
+
return _jsx("div", { className: "text-section-label text-muted-foreground", children: label });
|
|
26
|
+
return (_jsxs("div", { className: "flex items-center gap-1.5 text-section-label text-muted-foreground", children: [_jsx(Icon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: "size-4 shrink-0" }), label] }));
|
|
27
|
+
}
|
|
28
|
+
// Summary figures as a row of cards wrapping on a narrow screen: the label (after an optional icon), the figure in its
|
|
29
|
+
// tone's colour (never broken, tabular numbers), an optional bar under it, an optional note and an optional short
|
|
30
|
+
// figure on its right as a tag.
|
|
26
31
|
export function StatCards({ label, cards, isFullWidth = false, isOneRow = false }) {
|
|
27
32
|
return (_jsx("ul", { "aria-label": label, "data-slot": "stat-cards", "data-layout": getStatCardsLayout(isFullWidth, isOneRow), className: cn("grid gap-2", isFullWidth
|
|
28
33
|
? "grid-cols-[repeat(auto-fit,minmax(min(14rem,100%),1fr))]"
|
|
29
34
|
: "grid-cols-[repeat(auto-fill,minmax(min(10rem,100%),1fr))]", isOneRow && "sm:auto-cols-fr sm:grid-flow-col sm:grid-cols-none"), children: cards.map((card) => {
|
|
30
35
|
const tone = card.tone ?? "default";
|
|
31
|
-
return (_jsxs("li", { "data-stat": card.key, className: "flex min-w-0 items-start justify-between gap-2 rounded-lg bg-card p-3 text-card-foreground shadow-card", children: [_jsxs("div", { className: cn("min-w-0", card.progress !== undefined && "flex-1"), children: [_jsx(
|
|
36
|
+
return (_jsxs("li", { "data-stat": card.key, className: "flex min-w-0 items-start justify-between gap-2 rounded-lg bg-card p-3 text-card-foreground shadow-card", children: [_jsxs("div", { className: cn("min-w-0", card.progress !== undefined && "flex-1"), children: [_jsx(StatCardLabel, { label: card.label, icon: card.icon }), _jsx("div", { "data-tone": tone, className: cn("mt-1 text-heading-3 whitespace-nowrap tabular-nums", TONE_TEXT[tone]), children: card.value }), card.progress === undefined ? null : (_jsx(Progress, { value: clampProgress(card.progress), "aria-label": card.progressLabel ?? card.label, "data-slot": "stat-card-progress", className: "mt-2", indicatorClassName: card.tone === undefined ? undefined : TONE_FILL[card.tone] })), card.hint === undefined ? null : _jsx("div", { className: "mt-1 text-small text-muted-foreground", children: card.hint })] }), card.aside === undefined ? null : (_jsx(Badge, { variant: "tag", color: TONE_COLORS[card.aside.tone ?? "default"] ?? "default", "data-slot": "stat-card-aside", "data-tone": card.aside.tone ?? "default", className: "text-small", children: card.aside.text }))] }, card.key));
|
|
32
37
|
}) }));
|
|
33
38
|
}
|
|
34
39
|
// Small counts as "label **value**" tags in one row, wrapping only on a phone, each in its tone's colour.
|
package/dist/notion/Stats.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stats.js","sourceRoot":"","sources":["../../src/notion/Stats.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"Stats.js","sourceRoot":"","sources":["../../src/notion/Stats.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAmB,MAAM,cAAc,CAAC;AAG7D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAS1E,qHAAqH;AACrH,oHAAoH;AACpH,MAAM,UAAU,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAkB;IACtE,OAAO,CACL,gCAAmB,YAAY,EAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,aAC1E,gCACY,oBAAoB,EAC9B,SAAS,EAAC,yPAAyP,aAEnQ,KAAC,YAAY,mBACC,MAAM,EAClB,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAC,yGAAyG,GACnH,EACF,aAAI,SAAS,EAAC,gBAAgB,YAAE,KAAK,GAAM,IACnC,EACV,2BAAe,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AAK,CAAC,IAAI,IAAI,SAAS,EACvC,SAAS,EAAC,YAAY,YAErB,IAAI,CAAC,KAAK,CAAC,IAAI,GACV,CACT,KA9BI,IAAI,CAAC,GAAG,CA+BV,CACN,CAAC;QACJ,CAAC,CAAC,GACC,CACN,CAAC;AACJ,CAAC;AAeD,0GAA0G;AAC1G,MAAM,UAAU,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAkB;IACxD,OAAO,CACL,2BAAgB,KAAK,eAAY,YAAY,EAAC,SAAS,EAAC,0DAA0D,YAC/G,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,0BAA8B,IAAI,CAAC,GAAG,eAAa,IAAI,CAAC,IAAI,IAAI,SAAS,YACvE,MAAC,KAAK,IAAC,OAAO,EAAC,KAAK,EAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,SAAS,aACzE,IAAI,CAAC,KAAK,OAAE,iBAAQ,SAAS,EAAC,0BAA0B,YAAE,IAAI,CAAC,KAAK,GAAU,IACzE,IAHD,IAAI,CAAC,GAAG,CAIZ,CACN,CAAC,GACC,CACN,CAAC;AACJ,CAAC"}
|
package/dist/ui/command.d.ts
CHANGED
|
@@ -8,7 +8,12 @@ declare function CommandDialog({ title, description, children, className, showCl
|
|
|
8
8
|
className?: string;
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
10
|
}): React.JSX.Element;
|
|
11
|
-
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>
|
|
11
|
+
declare function CommandInput({ className, wrapperClassName, children, ...props }: React.ComponentProps<typeof CommandPrimitive.Input> & {
|
|
12
|
+
/** Classes for the input row (e.g. its height), merged after the row's own. */
|
|
13
|
+
wrapperClassName?: string;
|
|
14
|
+
/** Content at the end of the input row, after the input (e.g. a `Kbd`). */
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}): React.JSX.Element;
|
|
12
17
|
declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element;
|
|
13
18
|
declare function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
|
|
14
19
|
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element;
|
package/dist/ui/command.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/ui/command.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAKlD,OAAO,EACL,MAAM,EAKP,MAAM,aAAa,CAAA;AAEpB,iBAAS,OAAO,CAAC,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,qBAW/C;AAED,iBAAS,aAAa,CAAC,EACrB,KAA8B,EAC9B,WAA0C,EAC1C,QAAQ,EACR,SAAS,EACT,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,qBAiBA;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/ui/command.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,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CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,SAAS,CAAC,qBAQzD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,qBAWpD;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,qBAW9B;AAED,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,CAAA"}
|
package/dist/ui/command.js
CHANGED
|
@@ -10,10 +10,10 @@ function Command({ className, ...props }) {
|
|
|
10
10
|
return (_jsx(CommandPrimitive, { "data-slot": "command", className: cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", className), ...props }));
|
|
11
11
|
}
|
|
12
12
|
function CommandDialog({ title = messages.command.title, description = messages.command.description, children, className, showCloseButton = true, ...props }) {
|
|
13
|
-
return (_jsxs(Dialog, { ...props, children: [_jsxs(DialogHeader, { className: "sr-only", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), _jsx(DialogContent, { className: cn("overflow-hidden p-0", className), showCloseButton: showCloseButton, children: _jsx(Command, { className: "**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: children }) })] }));
|
|
13
|
+
return (_jsxs(Dialog, { ...props, children: [_jsxs(DialogHeader, { className: "sr-only", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), _jsx(DialogContent, { className: cn("overflow-hidden p-0", className), showCloseButton: showCloseButton, children: _jsx(Command, { label: title, className: "**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: children }) })] }));
|
|
14
14
|
}
|
|
15
|
-
function CommandInput({ className, ...props }) {
|
|
16
|
-
return (_jsxs("div", { "data-slot": "command-input-wrapper", className: "flex h-9 items-center gap-2 border-b px-3", children: [_jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }), _jsx(CommandPrimitive.Input, { "data-slot": "command-input", className: cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", className), ...props })] }));
|
|
15
|
+
function CommandInput({ className, wrapperClassName, children, ...props }) {
|
|
16
|
+
return (_jsxs("div", { "data-slot": "command-input-wrapper", className: cn("flex h-9 items-center gap-2 border-b px-3", wrapperClassName), children: [_jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }), _jsx(CommandPrimitive.Input, { "data-slot": "command-input", className: cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", className), ...props }), children] }));
|
|
17
17
|
}
|
|
18
18
|
function CommandList({ className, ...props }) {
|
|
19
19
|
return (_jsx(CommandPrimitive.List, { "data-slot": "command-list", className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className), ...props }));
|
package/dist/ui/command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/ui/command.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAClD,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACZ,MAAM,aAAa,CAAA;AAEpB,SAAS,OAAO,CAAC,EACf,SAAS,EACT,GAAG,KAAK,EACsC;IAC9C,OAAO,CACL,KAAC,gBAAgB,iBACL,SAAS,EACnB,SAAS,EAAE,EAAE,CACX,2FAA2F,EAC3F,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,aAAa,CAAC,EACrB,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAC9B,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAC1C,QAAQ,EACR,SAAS,EACT,eAAe,GAAG,IAAI,EACtB,GAAG,KAAK,EAMT;IACC,OAAO,CACL,MAAC,MAAM,OAAK,KAAK,aACf,MAAC,YAAY,IAAC,SAAS,EAAC,SAAS,aAC/B,KAAC,WAAW,cAAE,KAAK,GAAe,EAClC,KAAC,iBAAiB,cAAE,WAAW,GAAqB,IACvC,EACf,KAAC,aAAa,IACZ,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAC/C,eAAe,EAAE,eAAe,YAEhC,KAAC,OAAO,IAAC,SA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EACT,GAAG,KAAK,EAC2C;IACnD,OAAO,CACL,KAAC,gBAAgB,CAAC,IAAI,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CACX,2YAA2Y,EAC3Y,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACqB;IAC7B,OAAO,CACL,4BACY,kBAAkB,EAC5B,SAAS,EAAE,EAAE,CACX,uDAAuD,EACvD,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,CAAA"}
|
package/dist/ui/item.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../src/ui/item.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../src/ui/item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAK1C,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWtE;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,qBASxC;AAED,QAAA,MAAM,YAAY;;;8EAmBjB,CAAA;AAED,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,OAAmB,EACnB,IAAgB,EAChB,OAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,C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"@softure-ai/theme-notion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "SOFTURE AI Notion theme: shadcn/ui components (new-york v4, Radix, Tailwind CSS v4, lucide) with the Notion design system's tokens and deltas, ready to import.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
},
|
|
35
35
|
"./theme.css": "./dist/theme.css",
|
|
36
36
|
"./sft-bridge.css": "./dist/sft-bridge.css",
|
|
37
|
-
"./page.css": "./dist/page.css"
|
|
37
|
+
"./page.css": "./dist/page.css",
|
|
38
|
+
"./preflight.css": "./dist/preflight.css",
|
|
39
|
+
"./base.css": "./dist/base.css",
|
|
40
|
+
"./maplibre.css": "./dist/maplibre.css"
|
|
38
41
|
},
|
|
39
42
|
"softureTheme": {
|
|
40
43
|
"sources": [
|
|
@@ -58,7 +61,7 @@
|
|
|
58
61
|
"@dnd-kit/core": "^6.3.1",
|
|
59
62
|
"@dnd-kit/sortable": "^10.0.0",
|
|
60
63
|
"@dnd-kit/utilities": "^3.2.2",
|
|
61
|
-
"@softure-ai/theme-kit": "^0.1.
|
|
64
|
+
"@softure-ai/theme-kit": "^0.1.4",
|
|
62
65
|
"class-variance-authority": "^0.7.1",
|
|
63
66
|
"cmdk": "^1.1.1",
|
|
64
67
|
"lucide-react": "^1.61.0",
|
package/src/index.ts
CHANGED
|
@@ -55,9 +55,11 @@ export { PageHeader, type PageCrumb, type PageHeaderProps } from "./notion/PageH
|
|
|
55
55
|
export { PropertyList, type Property, type PropertyListProps } from "./notion/PropertyList.js";
|
|
56
56
|
export { SidePanel, type SidePanelLayout, type SidePanelProps } from "./notion/SidePanel.js";
|
|
57
57
|
export {
|
|
58
|
+
SortableActivator,
|
|
58
59
|
SortableHandle,
|
|
59
60
|
SortableItem,
|
|
60
61
|
SortableList,
|
|
62
|
+
type SortableActivatorProps,
|
|
61
63
|
type SortableAnnouncements,
|
|
62
64
|
type SortableDragBy,
|
|
63
65
|
type SortableHandleProps,
|
package/src/notion/Sortable.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
KeyboardSensor,
|
|
7
7
|
MouseSensor,
|
|
8
8
|
TouchSensor,
|
|
9
|
+
useDndContext,
|
|
9
10
|
useSensor,
|
|
10
11
|
useSensors,
|
|
11
12
|
type Announcements,
|
|
@@ -22,7 +23,8 @@ import {
|
|
|
22
23
|
} from "@dnd-kit/sortable";
|
|
23
24
|
import { CSS } from "@dnd-kit/utilities";
|
|
24
25
|
import { GripVertical } from "lucide-react";
|
|
25
|
-
import {
|
|
26
|
+
import { Slot } from "radix-ui";
|
|
27
|
+
import { createContext, useContext, useId, useCallback, useRef, useState, type ComponentProps, type ReactNode, type Ref } from "react";
|
|
26
28
|
|
|
27
29
|
import { en as messages } from "../messages/en.js";
|
|
28
30
|
import { cn } from "../lib/utils.js";
|
|
@@ -43,10 +45,14 @@ export interface SortableMove {
|
|
|
43
45
|
readonly to: number;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
// `row`: the whole row is dragged (a phone list); `handle`: only `SortableHandle` starts a drag (a desktop list)
|
|
47
|
-
|
|
48
|
+
// `row`: the whole row is dragged (a phone list); `handle`: only `SortableHandle` starts a drag (a desktop list);
|
|
49
|
+
// `activator`: a press on the app's own `SortableActivator` inside the row lifts it, with the row's hold, while the
|
|
50
|
+
// keyboard still picks up the focused row.
|
|
51
|
+
export type SortableDragBy = "row" | "handle" | "activator";
|
|
48
52
|
|
|
49
|
-
export interface SortableListProps
|
|
53
|
+
export interface SortableListProps
|
|
54
|
+
extends Omit<ComponentProps<"ul">, "children" | "ref" | "onDragStart" | "onDragEnd"> {
|
|
55
|
+
readonly ref?: Ref<HTMLUListElement | HTMLOListElement>;
|
|
50
56
|
// The list's accessible name.
|
|
51
57
|
readonly label: string;
|
|
52
58
|
// The rows' ids in their current order; the app owns the order.
|
|
@@ -63,6 +69,16 @@ export interface SortableListProps extends Omit<ComponentProps<"ul">, "children"
|
|
|
63
69
|
readonly announcements?: Partial<SortableAnnouncements>;
|
|
64
70
|
// A row's name in the announcements; defaults to its id.
|
|
65
71
|
readonly getItemLabel?: (id: string) => string;
|
|
72
|
+
// No row lifts by touch, mouse or keyboard; the rows still render and keep their own handlers.
|
|
73
|
+
readonly disabled?: boolean;
|
|
74
|
+
// The list element: `ol` for a numbered list. Children that are not a `SortableItem` stay in place.
|
|
75
|
+
readonly as?: "ul" | "ol";
|
|
76
|
+
// Called when a row lifts.
|
|
77
|
+
readonly onDragStart?: (id: string) => void;
|
|
78
|
+
// Called on every drop, with the move when the order changed and `null` when it did not.
|
|
79
|
+
readonly onDragEnd?: (id: string, move: SortableMove | null) => void;
|
|
80
|
+
// Called when a drag is cancelled (Escape, or the page lost focus).
|
|
81
|
+
readonly onDragCancel?: (id: string) => void;
|
|
66
82
|
readonly children: ReactNode;
|
|
67
83
|
}
|
|
68
84
|
|
|
@@ -75,19 +91,46 @@ function fillAnnouncement(template: string, values: Readonly<Record<string, stri
|
|
|
75
91
|
return template.replace(/\{(\w+)\}/g, (match, key: string) => (key in values ? String(values[key]) : match));
|
|
76
92
|
}
|
|
77
93
|
|
|
78
|
-
|
|
94
|
+
function assignRef<T>(ref: Ref<T> | undefined, node: T | null) {
|
|
95
|
+
if (typeof ref === "function") ref(node);
|
|
96
|
+
else if (ref) ref.current = node;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// A row's group travels in the drag data; dnd-kit types that data loosely, so it is read as unknown.
|
|
100
|
+
function readGroup(data: unknown): string | undefined {
|
|
101
|
+
if (typeof data !== "object" || data === null || !("group" in data)) return undefined;
|
|
102
|
+
return typeof data.group === "string" ? data.group : undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
type SortableListeners = ReturnType<typeof useSortable>["listeners"];
|
|
106
|
+
|
|
107
|
+
// The keyboard sensor binds `onKeyDown`; the pointer sensors bind the rest.
|
|
108
|
+
function splitListeners(listeners: SortableListeners): { keyboard: SortableListeners; pointer: SortableListeners } {
|
|
109
|
+
const entries = Object.entries(listeners ?? {});
|
|
110
|
+
return {
|
|
111
|
+
keyboard: Object.fromEntries(entries.filter(([name]) => name === "onKeyDown")),
|
|
112
|
+
pointer: Object.fromEntries(entries.filter(([name]) => name !== "onKeyDown")),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface SortableListContextValue {
|
|
79
117
|
readonly dragBy: SortableDragBy;
|
|
118
|
+
readonly isDisabled: boolean;
|
|
80
119
|
}
|
|
81
120
|
|
|
82
|
-
const SortableListContext = createContext<
|
|
121
|
+
const SortableListContext = createContext<SortableListContextValue>({ dragBy: "row", isDisabled: false });
|
|
83
122
|
|
|
84
|
-
|
|
123
|
+
interface SortableItemBinding extends Pick<ReturnType<typeof useSortable>, "attributes" | "listeners" | "setActivatorNodeRef"> {
|
|
124
|
+
readonly dragBy: SortableDragBy;
|
|
125
|
+
readonly isDisabled: boolean;
|
|
126
|
+
}
|
|
85
127
|
|
|
86
|
-
const
|
|
128
|
+
const SortableItemContext = createContext<SortableItemBinding | null>(null);
|
|
87
129
|
|
|
88
130
|
// A list whose rows are reordered by dragging: a long press lifts a row on a touch screen (a swipe before the hold
|
|
89
131
|
// still scrolls, a tap still activates the row), a mouse drags it, the keyboard picks it up with Space or Enter and
|
|
90
|
-
// moves it with the arrows. The order stays with the app: `onReorder` gets the new one.
|
|
132
|
+
// moves it with the arrows. The order stays with the app: `onReorder` gets the new one. While a row is lifted the
|
|
133
|
+
// list carries `data-sorting`.
|
|
91
134
|
export function SortableList({
|
|
92
135
|
label,
|
|
93
136
|
items,
|
|
@@ -98,11 +141,18 @@ export function SortableList({
|
|
|
98
141
|
instructions = messages.sortable.instructions,
|
|
99
142
|
announcements,
|
|
100
143
|
getItemLabel = (id) => id,
|
|
144
|
+
disabled = false,
|
|
145
|
+
as: List = "ul",
|
|
146
|
+
onDragStart,
|
|
147
|
+
onDragEnd,
|
|
148
|
+
onDragCancel,
|
|
149
|
+
ref,
|
|
101
150
|
className,
|
|
102
151
|
children,
|
|
103
152
|
...props
|
|
104
153
|
}: SortableListProps) {
|
|
105
154
|
const contextId = useId();
|
|
155
|
+
const [isSorting, setIsSorting] = useState(false);
|
|
106
156
|
const hold = { delay: holdDelay, tolerance };
|
|
107
157
|
const sensors = useSensors(
|
|
108
158
|
useSensor(MouseSensor, {
|
|
@@ -135,12 +185,21 @@ export function SortableList({
|
|
|
135
185
|
onDragCancel: ({ active }) => announce(copy.cancelled, active.id),
|
|
136
186
|
};
|
|
137
187
|
|
|
138
|
-
|
|
139
|
-
|
|
188
|
+
// The move a drop makes, or null when it keeps the order (no target, the row's own place, another group).
|
|
189
|
+
function getMove({ active, over }: DragEndEvent): SortableMove | null {
|
|
190
|
+
if (!over || active.id === over.id) return null;
|
|
191
|
+
if (readGroup(active.data.current) !== readGroup(over.data.current)) return null;
|
|
140
192
|
const from = items.indexOf(String(active.id));
|
|
141
193
|
const to = items.indexOf(String(over.id));
|
|
142
|
-
if (from < 0 || to < 0) return;
|
|
143
|
-
|
|
194
|
+
if (from < 0 || to < 0) return null;
|
|
195
|
+
return { id: String(active.id), from, to };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function handleDragEnd(event: DragEndEvent) {
|
|
199
|
+
setIsSorting(false);
|
|
200
|
+
const move = getMove(event);
|
|
201
|
+
if (move) onReorder(arrayMove([...items], move.from, move.to), move);
|
|
202
|
+
onDragEnd?.(String(event.active.id), move);
|
|
144
203
|
}
|
|
145
204
|
|
|
146
205
|
return (
|
|
@@ -150,19 +209,30 @@ export function SortableList({
|
|
|
150
209
|
collisionDetection={closestCenter}
|
|
151
210
|
modifiers={[restrictToVerticalAxis]}
|
|
152
211
|
accessibility={{ announcements: liveAnnouncements, screenReaderInstructions: { draggable: instructions } }}
|
|
212
|
+
onDragStart={({ active }) => {
|
|
213
|
+
setIsSorting(true);
|
|
214
|
+
onDragStart?.(String(active.id));
|
|
215
|
+
}}
|
|
153
216
|
onDragEnd={handleDragEnd}
|
|
217
|
+
onDragCancel={({ active }) => {
|
|
218
|
+
setIsSorting(false);
|
|
219
|
+
onDragCancel?.(String(active.id));
|
|
220
|
+
}}
|
|
154
221
|
>
|
|
155
222
|
<SortableContext items={[...items]} strategy={verticalListSortingStrategy}>
|
|
156
|
-
<SortableListContext.Provider value={{ dragBy }}>
|
|
157
|
-
<
|
|
223
|
+
<SortableListContext.Provider value={{ dragBy, isDisabled: disabled }}>
|
|
224
|
+
<List
|
|
225
|
+
ref={(node: HTMLUListElement | HTMLOListElement | null) => assignRef(ref, node)}
|
|
158
226
|
aria-label={label}
|
|
159
227
|
data-slot="sortable-list"
|
|
160
228
|
data-drag-by={dragBy}
|
|
229
|
+
data-disabled={disabled ? "" : undefined}
|
|
230
|
+
data-sorting={isSorting ? "" : undefined}
|
|
161
231
|
className={cn("flex flex-col", className)}
|
|
162
232
|
{...props}
|
|
163
233
|
>
|
|
164
234
|
{children}
|
|
165
|
-
</
|
|
235
|
+
</List>
|
|
166
236
|
</SortableListContext.Provider>
|
|
167
237
|
</SortableContext>
|
|
168
238
|
</DndContext>
|
|
@@ -172,49 +242,96 @@ export function SortableList({
|
|
|
172
242
|
export interface SortableItemProps extends ComponentProps<"li"> {
|
|
173
243
|
// The row's id, one of the list's `items`.
|
|
174
244
|
readonly id: string;
|
|
245
|
+
// A lifted row lands only among rows of its own group; rows without one form a group of their own.
|
|
246
|
+
readonly group?: string;
|
|
247
|
+
// This row does not lift; it wins over the list's `disabled`. Other rows may still move past it.
|
|
248
|
+
readonly disabled?: boolean;
|
|
175
249
|
}
|
|
176
250
|
|
|
177
251
|
// The lifted row floats on `accent-strong` with `shadow-menu`, above its siblings; `data-dragging` marks it.
|
|
178
252
|
const SORTABLE_ITEM =
|
|
179
253
|
"rounded-md bg-background outline-none touch-manipulation select-none [-webkit-touch-callout:none] focus-visible:ring-2 focus-visible:ring-ring data-[dragging]:relative data-[dragging]:z-10 data-[dragging]:bg-accent-strong data-[dragging]:shadow-menu";
|
|
180
254
|
|
|
255
|
+
// The drag props the row element itself carries.
|
|
256
|
+
function getRowBinding(binding: SortableItemBinding) {
|
|
257
|
+
if (binding.isDisabled || binding.dragBy === "handle") return {};
|
|
258
|
+
if (binding.dragBy === "activator") return { ...binding.attributes, ...splitListeners(binding.listeners).keyboard };
|
|
259
|
+
return { ...binding.attributes, ...binding.listeners };
|
|
260
|
+
}
|
|
261
|
+
|
|
181
262
|
// One row of a `SortableList`. In `row` mode the row itself is the drag target and is focusable; in `handle` mode a
|
|
182
|
-
// `SortableHandle` inside it is
|
|
183
|
-
|
|
184
|
-
|
|
263
|
+
// `SortableHandle` inside it is; in `activator` mode a `SortableActivator` takes the press and the row the keyboard.
|
|
264
|
+
// The drag's own pointer and key handlers win over the same props on the drag target; a key pressed on a control
|
|
265
|
+
// inside the row stays with that control.
|
|
266
|
+
export function SortableItem({ id, group, disabled, className, style, children, ...props }: SortableItemProps) {
|
|
267
|
+
const list = useContext(SortableListContext);
|
|
268
|
+
const { active } = useDndContext();
|
|
269
|
+
const isDisabled = disabled ?? list.isDisabled;
|
|
270
|
+
const isOtherGroup = active !== null && readGroup(active.data.current) !== group;
|
|
185
271
|
const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({
|
|
186
272
|
id,
|
|
273
|
+
data: { group },
|
|
187
274
|
attributes: { role: "listitem" },
|
|
275
|
+
disabled: { draggable: isDisabled, droppable: isOtherGroup },
|
|
188
276
|
});
|
|
189
|
-
const
|
|
277
|
+
const binding: SortableItemBinding = { attributes, listeners, setActivatorNodeRef, dragBy: list.dragBy, isDisabled };
|
|
278
|
+
const isRowActivator = list.dragBy !== "handle";
|
|
279
|
+
// The row is the keyboard's activator outside `handle` mode, so a key on a control inside the row stays there.
|
|
280
|
+
const setRowRef = useCallback(
|
|
281
|
+
(node: HTMLLIElement | null) => {
|
|
282
|
+
setNodeRef(node);
|
|
283
|
+
if (isRowActivator) setActivatorNodeRef(node);
|
|
284
|
+
},
|
|
285
|
+
[setNodeRef, setActivatorNodeRef, isRowActivator],
|
|
286
|
+
);
|
|
190
287
|
return (
|
|
191
|
-
<
|
|
288
|
+
<SortableItemContext.Provider value={binding}>
|
|
192
289
|
<li
|
|
193
|
-
ref={
|
|
290
|
+
ref={setRowRef}
|
|
194
291
|
data-slot="sortable-item"
|
|
195
292
|
data-id={id}
|
|
293
|
+
data-group={group}
|
|
294
|
+
data-disabled={isDisabled ? "" : undefined}
|
|
196
295
|
data-dragging={isDragging ? "" : undefined}
|
|
197
296
|
className={cn(SORTABLE_ITEM, className)}
|
|
198
297
|
style={{ ...style, transform: CSS.Translate.toString(transform), transition }}
|
|
199
298
|
{...props}
|
|
200
|
-
{...
|
|
299
|
+
{...getRowBinding(binding)}
|
|
201
300
|
>
|
|
202
301
|
{children}
|
|
203
302
|
</li>
|
|
204
|
-
</
|
|
303
|
+
</SortableItemContext.Provider>
|
|
205
304
|
);
|
|
206
305
|
}
|
|
207
306
|
|
|
307
|
+
function useSortableItemBinding(part: string): SortableItemBinding {
|
|
308
|
+
const binding = useContext(SortableItemContext);
|
|
309
|
+
if (!binding) throw new Error(`${part} failed: it must be rendered inside a SortableItem`);
|
|
310
|
+
return binding;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export type SortableActivatorProps = ComponentProps<typeof Slot.Root>;
|
|
314
|
+
|
|
315
|
+
// The app's own element inside a row (a button, a title) that lifts the row on a press, for a list with
|
|
316
|
+
// `dragBy="activator"`; a press elsewhere in the row does nothing. Its own click and keys keep working. In the other
|
|
317
|
+
// modes, or on a disabled row, it renders its child unchanged.
|
|
318
|
+
export function SortableActivator(props: SortableActivatorProps) {
|
|
319
|
+
const binding = useSortableItemBinding("SortableActivator");
|
|
320
|
+
const isBound = binding.dragBy === "activator" && !binding.isDisabled;
|
|
321
|
+
const pointer = isBound ? splitListeners(binding.listeners).pointer : {};
|
|
322
|
+
return <Slot.Root data-slot="sortable-activator" {...props} {...pointer} />;
|
|
323
|
+
}
|
|
324
|
+
|
|
208
325
|
export interface SortableHandleProps extends Omit<ComponentProps<typeof Button>, "children"> {
|
|
209
326
|
// The handle's accessible name.
|
|
210
327
|
readonly label?: string;
|
|
211
328
|
}
|
|
212
329
|
|
|
213
330
|
// A grip button that drags its row, for a list with `dragBy="handle"`.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const { attributes, listeners
|
|
331
|
+
// On a disabled row it is a disabled button.
|
|
332
|
+
export function SortableHandle({ label = messages.sortable.handle, className, disabled, ...props }: SortableHandleProps) {
|
|
333
|
+
const { attributes, listeners, setActivatorNodeRef, isDisabled } = useSortableItemBinding("SortableHandle");
|
|
334
|
+
const dragProps = isDisabled ? {} : { ...attributes, ...listeners };
|
|
218
335
|
return (
|
|
219
336
|
<Button
|
|
220
337
|
ref={setActivatorNodeRef}
|
|
@@ -223,9 +340,9 @@ export function SortableHandle({ label = messages.sortable.handle, className, ..
|
|
|
223
340
|
size="icon-sm"
|
|
224
341
|
data-slot="sortable-handle"
|
|
225
342
|
className={cn("cursor-grab touch-none text-muted-foreground active:cursor-grabbing", className)}
|
|
343
|
+
disabled={isDisabled || disabled}
|
|
226
344
|
{...props}
|
|
227
|
-
{...
|
|
228
|
-
{...listeners}
|
|
345
|
+
{...dragProps}
|
|
229
346
|
role="button"
|
|
230
347
|
aria-label={label}
|
|
231
348
|
>
|
package/src/notion/Stats.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChevronRight } from "lucide-react";
|
|
1
|
+
import { ChevronRight, type LucideIcon } from "lucide-react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
import { Badge } from "../ui/badge.js";
|
|
@@ -47,6 +47,8 @@ export interface StatCard {
|
|
|
47
47
|
/** Unique within the row; kept as `data-stat`. */
|
|
48
48
|
readonly key: string;
|
|
49
49
|
readonly label: string;
|
|
50
|
+
/** A decorative icon before the label: 16 px, the design system's stroke, the label's muted colour. */
|
|
51
|
+
readonly icon?: LucideIcon;
|
|
50
52
|
readonly value: string;
|
|
51
53
|
readonly hint?: string;
|
|
52
54
|
readonly tone?: Tone;
|
|
@@ -77,9 +79,19 @@ function getStatCardsLayout(isFullWidth: boolean, isOneRow: boolean): "row" | "f
|
|
|
77
79
|
return isFullWidth ? "full" : "grid";
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
function StatCardLabel({ label, icon: Icon }: { readonly label: string; readonly icon: LucideIcon | undefined }) {
|
|
83
|
+
if (Icon === undefined) return <div className="text-section-label text-muted-foreground">{label}</div>;
|
|
84
|
+
return (
|
|
85
|
+
<div className="flex items-center gap-1.5 text-section-label text-muted-foreground">
|
|
86
|
+
<Icon aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} className="size-4 shrink-0" />
|
|
87
|
+
{label}
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Summary figures as a row of cards wrapping on a narrow screen: the label (after an optional icon), the figure in its
|
|
93
|
+
// tone's colour (never broken, tabular numbers), an optional bar under it, an optional note and an optional short
|
|
94
|
+
// figure on its right as a tag.
|
|
83
95
|
export function StatCards({ label, cards, isFullWidth = false, isOneRow = false }: StatCardsProps) {
|
|
84
96
|
return (
|
|
85
97
|
<ul
|
|
@@ -103,7 +115,7 @@ export function StatCards({ label, cards, isFullWidth = false, isOneRow = false
|
|
|
103
115
|
className="flex min-w-0 items-start justify-between gap-2 rounded-lg bg-card p-3 text-card-foreground shadow-card"
|
|
104
116
|
>
|
|
105
117
|
<div className={cn("min-w-0", card.progress !== undefined && "flex-1")}>
|
|
106
|
-
<
|
|
118
|
+
<StatCardLabel label={card.label} icon={card.icon} />
|
|
107
119
|
<div data-tone={tone} className={cn("mt-1 text-heading-3 whitespace-nowrap tabular-nums", TONE_TEXT[tone])}>
|
|
108
120
|
{card.value}
|
|
109
121
|
</div>
|
package/src/ui/command.tsx
CHANGED
|
@@ -53,7 +53,7 @@ function CommandDialog({
|
|
|
53
53
|
className={cn("overflow-hidden p-0", className)}
|
|
54
54
|
showCloseButton={showCloseButton}
|
|
55
55
|
>
|
|
56
|
-
<Command className="**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
56
|
+
<Command label={title} className="**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
57
57
|
{children}
|
|
58
58
|
</Command>
|
|
59
59
|
</DialogContent>
|
|
@@ -63,12 +63,19 @@ function CommandDialog({
|
|
|
63
63
|
|
|
64
64
|
function CommandInput({
|
|
65
65
|
className,
|
|
66
|
+
wrapperClassName,
|
|
67
|
+
children,
|
|
66
68
|
...props
|
|
67
|
-
}: React.ComponentProps<typeof CommandPrimitive.Input>
|
|
69
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input> & {
|
|
70
|
+
/** Classes for the input row (e.g. its height), merged after the row's own. */
|
|
71
|
+
wrapperClassName?: string
|
|
72
|
+
/** Content at the end of the input row, after the input (e.g. a `Kbd`). */
|
|
73
|
+
children?: React.ReactNode
|
|
74
|
+
}) {
|
|
68
75
|
return (
|
|
69
76
|
<div
|
|
70
77
|
data-slot="command-input-wrapper"
|
|
71
|
-
className="flex h-9 items-center gap-2 border-b px-3"
|
|
78
|
+
className={cn("flex h-9 items-center gap-2 border-b px-3", wrapperClassName)}
|
|
72
79
|
>
|
|
73
80
|
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
74
81
|
<CommandPrimitive.Input
|
|
@@ -79,6 +86,7 @@ function CommandInput({
|
|
|
79
86
|
)}
|
|
80
87
|
{...props}
|
|
81
88
|
/>
|
|
89
|
+
{children}
|
|
82
90
|
</div>
|
|
83
91
|
)
|
|
84
92
|
}
|