@softure-ai/theme-notion 0.32.0 → 0.34.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 +33 -0
- package/README.md +54 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/focus-first-field.d.ts +7 -0
- package/dist/lib/focus-first-field.d.ts.map +1 -0
- package/dist/lib/focus-first-field.js +39 -0
- package/dist/lib/focus-first-field.js.map +1 -0
- package/dist/notion/List.d.ts +32 -1
- package/dist/notion/List.d.ts.map +1 -1
- package/dist/notion/List.js +20 -1
- package/dist/notion/List.js.map +1 -1
- package/dist/notion/ResultBadge.d.ts +20 -0
- package/dist/notion/ResultBadge.d.ts.map +1 -0
- package/dist/notion/ResultBadge.js +25 -0
- package/dist/notion/ResultBadge.js.map +1 -0
- package/dist/notion/TabBar.d.ts +1 -1
- package/dist/notion/TabBar.d.ts.map +1 -1
- package/dist/notion/TabBar.js +51 -1
- package/dist/notion/TabBar.js.map +1 -1
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/badge.js.map +1 -1
- package/dist/ui/dialog.d.ts +1 -1
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +3 -2
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/sheet.d.ts +1 -1
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +3 -2
- package/dist/ui/sheet.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/lib/focus-first-field.ts +39 -0
- package/src/notion/List.tsx +120 -1
- package/src/notion/ResultBadge.tsx +59 -0
- package/src/notion/TabBar.tsx +54 -2
- package/src/ui/badge.tsx +1 -0
- package/src/ui/dialog.tsx +3 -0
- package/src/ui/sheet.tsx +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,39 @@ 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.34.0
|
|
8
|
+
|
|
9
|
+
- `ListEntry` (#1481): a list row with an identity and a right column. `title` and `details` (the lines under it) on
|
|
10
|
+
the left; `status` at the top of the right column and `actions` under it. With `href` (and `linkComponent` for a
|
|
11
|
+
router's link) the title's link is stretched over the whole row with an arrow beside the column, which never wraps
|
|
12
|
+
alone; the column stays above the link. Below `md` the column wraps under the identity, right-aligned, with 44 px
|
|
13
|
+
controls. A control marked `data-row-wide` makes the column take the full row width, its lines starting on the left.
|
|
14
|
+
`ListRow` is unchanged.
|
|
15
|
+
- `ResultBadge` (#1481): a result as a filled tag in its tone's colour (`TONE_COLORS`), the tone's icon
|
|
16
|
+
(`RESULT_BADGE_ICONS`, overridable with `icon`) and always a word; `isSpinning` spins the icon
|
|
17
|
+
(`motion-safe:animate-spin`) for a run in progress.
|
|
18
|
+
- Migration: an app that built its own list row with a state/actions column and a stretched title link, or its own
|
|
19
|
+
result badge on the tones, replaces them with `ListEntry` and `ResultBadge`.
|
|
20
|
+
- `Badge` (#1482): a badge given a palette `color` renders `data-color="<color>"` next to its `data-variant`, the way
|
|
21
|
+
`Status` names its colour, so a browser test checks a filled tag with `[data-color=red]` as it checks a status.
|
|
22
|
+
`color="none"` or no colour sets nothing; an app's own `data-color` still wins.
|
|
23
|
+
- Migration: an app that added its own `data-tone` or `data-color` to its badges to test their colour drops it.
|
|
24
|
+
|
|
25
|
+
## 0.33.0
|
|
26
|
+
|
|
27
|
+
- `DialogContent` and `SheetContent` (#1476): on open they focus the first form field (`input` other than hidden,
|
|
28
|
+
`select`, `textarea`, `[role=combobox]`, not disabled) instead of the first focusable element, so a dialog whose
|
|
29
|
+
first focusable is a help `TooltipTrigger` opens with no tooltip over the form. With no field Radix's default focus
|
|
30
|
+
stays; an app's own `onOpenAutoFocus` runs first and keeps control when it prevents the default.
|
|
31
|
+
- Migration: an app that focused the first field itself in `onOpenAutoFocus` (to keep a tooltip shut) drops the
|
|
32
|
+
handler.
|
|
33
|
+
- `TabBar` (#1477): when the tabs overflow the strip (a phone), the strip scrolls itself, never the page, so the
|
|
34
|
+
current tab is whole on load (a deep link to a late tab) and whenever `current` changes, with a fade's width of room
|
|
35
|
+
so no fade covers it; nothing moves when it is already in view. Each edge that hides tabs fades out (a static 32 px
|
|
36
|
+
mask) and is marked on the nav with `data-overflow-start` / `data-overflow-end`, so a tab cut at the edge reads as a
|
|
37
|
+
scrollable list. `TabBar` is now a client component; its props are unchanged.
|
|
38
|
+
- Migration: an app that scrolled the current tab into view itself, or drew its own edge fade, drops that code.
|
|
39
|
+
|
|
7
40
|
## 0.32.0
|
|
8
41
|
|
|
9
42
|
- `FoldRow` (#1463): the bar and its opened content share one 8 px horizontal inset. The summary is padded `px-2`
|
package/README.md
CHANGED
|
@@ -109,6 +109,9 @@ name outside a `CommandDialog`; without it the field has none), `SortableList in
|
|
|
109
109
|
does not fit ends in an ellipsis while the icon keeps its size, and the full word is the badge's `title` when it is
|
|
110
110
|
a string or a number (pass `title` for any other node). A plain `Badge` clips its text at the end; wrap the
|
|
111
111
|
text in `<span className="min-w-0 truncate">` for an ellipsis.
|
|
112
|
+
- A badge names its colour and variant in attributes, so a browser test checks them without parsing classes: a
|
|
113
|
+
`Badge` with a palette `color` renders `data-color="<color>"` next to `data-variant` (none for `color="none"`), and
|
|
114
|
+
a `Status` renders `data-color` the same way (`[data-slot=badge][data-color=red]`).
|
|
112
115
|
- Installed on a phone's home screen (`viewport-fit=cover`), the parts at a screen edge pad by the screen's
|
|
113
116
|
safe-area insets on the edges they touch: `SheetContent` (every `side`, its close button too), the `Sidebar` on a
|
|
114
117
|
phone, the popper `SelectContent` (its height stops short of the inset it opens towards) and `PageFrame`. The insets
|
|
@@ -116,6 +119,10 @@ name outside a `CommandDialog`; without it the field has none), `SortableList in
|
|
|
116
119
|
edge, so put content padding on its children (`SheetHeader`, `SheetFooter`, an inner `div`). An app pads its own
|
|
117
120
|
screen roots with the same classes: `pt-[env(safe-area-inset-top)]`, `pb-[env(safe-area-inset-bottom)]`,
|
|
118
121
|
`pl-[env(safe-area-inset-left)]`, `pr-[env(safe-area-inset-right)]`.
|
|
122
|
+
- `DialogContent` and `SheetContent` focus their first form field on open (`input`, `select`, `textarea` or a
|
|
123
|
+
`combobox`, not disabled), not the first focusable element, so a help `TooltipTrigger` beside a label does not open
|
|
124
|
+
its tooltip over the form. With no field Radix's default focus stays; an app's `onOpenAutoFocus` runs first and
|
|
125
|
+
keeps control when it calls `event.preventDefault()`. Tab onto the trigger still shows the tooltip.
|
|
119
126
|
- Figures, bar segments and box edges take a **tone** by what they mean: `default` (text colour), `success` (green,
|
|
120
127
|
done), `warning` (orange, to do), `danger` (red, owed or failing), `muted` (gray, out of play). `TONE_COLORS` gives
|
|
121
128
|
a tone's palette colour (`null` for `default`); `TONE_TEXT`, `TONE_FILL` and `TONE_EDGE` give literal class names
|
|
@@ -135,7 +142,7 @@ All 37 shadcn/ui components of the design system, exported from the package root
|
|
|
135
142
|
avatar, badge, breadcrumb, button, button-group, card, checkbox, collapsible, command, dialog, dropdown-menu, empty,
|
|
136
143
|
field, input, input-group, item, kbd, label, popover, progress, radio-group, scroll-area, select, separator, sheet,
|
|
137
144
|
sidebar, skeleton, sonner (`Toaster`), spinner, switch, table, tabs, textarea, tooltip. Compositions: `Status` (badge, icon,
|
|
138
|
-
word), `PageHeader` (breadcrumb, icon box, title, description, actions), `PageLayout` (a screen in the app shell: its
|
|
145
|
+
word), `ResultBadge` (a result as a filled tag in its tone's colour, with an icon and a word, below), `PageHeader` (breadcrumb, icon box, title, description, actions), `PageLayout` (a screen in the app shell: its
|
|
139
146
|
`PageHeader`, then its sections, at one width and spacing, below), `PropertyList` (fields of one record),
|
|
140
147
|
`DetailTable` (an item's details as a label and value table, laid out fixed at its container's width, each label
|
|
141
148
|
above its value where the table is narrower than 28rem), `FoldRow` (a list row folding open to a `DetailTable`
|
|
@@ -150,6 +157,7 @@ stages with a state, below), `Timeline` (dated entries on a vertical rail, below
|
|
|
150
157
|
`Prose` (the text styles of a long read the app does not draw itself, such as Markdown rendered to HTML, below),
|
|
151
158
|
`SortableList`, `SortableItem`, `SortableHandle` and `SortableActivator` (rows reordered by dragging, below),
|
|
152
159
|
`List`, `ListItem` and `ListRow` (a list of rows, compact or roomy by the page's density, below),
|
|
160
|
+
`ListEntry` (a list row with an identity and a right column, its state over its controls, below),
|
|
153
161
|
`ListGroup` and `ListGroupHeading` (a run of rows under a heading that sticks at the top of its scroll, below),
|
|
154
162
|
`MiniProgress` (a compact bar with its figure inside, for a table cell or a tile, below),
|
|
155
163
|
`UpdatePrompt` (the offer to reload into a new build, for an installed app, below),
|
|
@@ -171,7 +179,9 @@ and zoom; one row per document with its type, size and an "available offline" ma
|
|
|
171
179
|
(`DropdownMenuContent size="touch"`, or `size="touch"` on a `DropdownMenuItem`, `DropdownMenuCheckboxItem`,
|
|
172
180
|
`DropdownMenuRadioItem` or `DropdownMenuSubTrigger`) and the tabs (`TabsList size="touch"` grows to its triggers,
|
|
173
181
|
each at least 44 × 44, or `TabsTrigger size="touch"`). `TabBar size="touch"` draws every tab link at least 44 × 44 (`data-size="touch"`), and its
|
|
174
|
-
`tabClassName` goes on every link after the size (`tabClassName="md:h-control-height md:min-w-0"` on a desktop).
|
|
182
|
+
`tabClassName` goes on every link after the size (`tabClassName="md:h-control-height md:min-w-0"` on a desktop). When its tabs overflow the strip (a phone), `TabBar` scrolls the strip itself, never the page, so the current tab is
|
|
183
|
+
whole on load and whenever `current` changes, and fades each edge that hides tabs (`data-overflow-start`,
|
|
184
|
+
`data-overflow-end` on the nav, a static 32 px mask, so nothing moves under reduced motion). `Switch size="touch"` is a 44 × 44 square that draws the same 26 × 16 track
|
|
175
185
|
inside it and keeps the track's place in the layout (negative margins), so a phone taps the whole square; `className="md:m-0
|
|
176
186
|
md:h-4 md:w-[26px]"` brings the plain switch back on a desktop. `AccordionTrigger size="touch"` is at least 44 px high
|
|
177
187
|
whatever its padding, and `DialogContent closeButtonSize="touch"` draws the close button 44 × 44 around the same
|
|
@@ -515,6 +525,48 @@ scheme the theme's `border` is that card's own grey.
|
|
|
515
525
|
renders with other components, `LIST_CLASSES` holds the same classes (`list`, `tintedList`, `item`, `row`), e.g.
|
|
516
526
|
`<SortableList className={LIST_CLASSES.list}>` with `<SortableItem className={LIST_CLASSES.item}>`.
|
|
517
527
|
|
|
528
|
+
**`ListEntry`: a row with a right column.** The most common row of an admin list: what the row is on the left
|
|
529
|
+
(`title`, in the medium weight, and `details`, the lines under it in the muted colour) and a right column with the
|
|
530
|
+
row's state on top (`status`, badges that wrap right-aligned) and its controls under it (`actions`). With `href` the
|
|
531
|
+
title is a link stretched over the whole row, so the row is one box lit on hover with one focus ring, and a muted arrow
|
|
532
|
+
sits beside the column; the arrow and the column are one group, so the arrow never wraps onto a line of its own. The
|
|
533
|
+
column stays above the link: its controls are their own targets, and a click on the gap between them or on the arrow
|
|
534
|
+
still opens the row. Pass `linkComponent` for a router's link (it takes `href`, `className` and `children`). On a
|
|
535
|
+
phone (below `md`) the column wraps under the identity, right-aligned, and every control is at least the touch target
|
|
536
|
+
(44 px). A control that needs room while it is open (an inline answer form) carries `data-row-wide`: the column then
|
|
537
|
+
takes the full row width under the identity, its lines starting on the left. Place the row in a `ListItem`, so it
|
|
538
|
+
follows the list's density.
|
|
539
|
+
|
|
540
|
+
```tsx
|
|
541
|
+
<List aria-label="Deploys">
|
|
542
|
+
{deploys.map((deploy) => (
|
|
543
|
+
<ListItem key={deploy.id}>
|
|
544
|
+
<ListEntry
|
|
545
|
+
href={`/deploys/${deploy.id}`}
|
|
546
|
+
linkComponent={Link}
|
|
547
|
+
title={deploy.name}
|
|
548
|
+
details={<><span>{deploy.branch}</span><span>{deploy.startedAt}</span></>}
|
|
549
|
+
status={<ResultBadge tone={TONE_BY_RESULT[deploy.result]}>{deploy.resultLabel}</ResultBadge>}
|
|
550
|
+
actions={<Button variant="ghost" size="icon-sm" aria-label="Retry"><RotateCw /></Button>}
|
|
551
|
+
/>
|
|
552
|
+
</ListItem>
|
|
553
|
+
))}
|
|
554
|
+
</List>
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
**`ResultBadge`: a result in its tone.** A result (passed, failed, skipped, running) as a filled tag in its tone's
|
|
558
|
+
colour (`TONE_COLORS`: `success` green, `warning` orange, `danger` red, `muted` gray, `default` the default tag), with
|
|
559
|
+
the tone's icon (`RESULT_BADGE_ICONS`: `CircleCheck`, `TriangleAlert`, `CircleX`, `CircleMinus`, `Circle`; pass
|
|
560
|
+
`icon` for another) and always a word. The app keeps its own table of which result takes which tone; the theme owns
|
|
561
|
+
the colours, so "failed" is red in every list. `isSpinning` marks a run still in progress: the icon (a
|
|
562
|
+
`LoaderCircle` unless `icon` is given) spins with `motion-safe:animate-spin`, still for a reader who asked for reduced
|
|
563
|
+
motion. `Status` is the ghost counterpart, for a state written in text colour.
|
|
564
|
+
|
|
565
|
+
```tsx
|
|
566
|
+
<ResultBadge tone="danger">Failed</ResultBadge>
|
|
567
|
+
<ResultBadge tone="muted" isSpinning>Running</ResultBadge>
|
|
568
|
+
```
|
|
569
|
+
|
|
518
570
|
**`ListGroup`, `ListGroupHeading`: a sticky group heading.** A heading over a run of rows (a country's days, a month's
|
|
519
571
|
entries) that sticks at the top of the scroll container while its rows pass under it, and is pushed away by the next
|
|
520
572
|
group's heading. Put the groups straight in the scrolling element and give it no padding: a sticky box sticks at the
|
package/dist/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export { FilterChip, FilterChipAdd, type FilterChipAddProps, type FilterChipProp
|
|
|
50
50
|
export { FoldRow, type FoldRowBadge, type FoldRowProps } from "./notion/FoldRow.js";
|
|
51
51
|
export { InstallBar, type InstallBarOffer, type InstallBarProps } from "./notion/InstallBar.js";
|
|
52
52
|
export { LaunchScreen, type LaunchScreenProps } from "./notion/LaunchScreen.js";
|
|
53
|
-
export { LIST_CLASSES, List, ListGroup, ListGroupHeading, ListItem, ListRow, type ListGroupHeadingProps, type ListGroupProps, type ListItemProps, type ListProps, type ListRowProps, type ListSurface, } from "./notion/List.js";
|
|
53
|
+
export { LIST_CLASSES, List, ListGroup, ListGroupHeading, ListItem, ListEntry, ListRow, type ListGroupHeadingProps, type ListGroupProps, type ListItemProps, type ListProps, type ListEntryLinkComponent, type ListEntryProps, type ListRowProps, type ListSurface, } from "./notion/List.js";
|
|
54
54
|
export { PALETTE_COLORS, type PaletteColor } from "./notion/palette.js";
|
|
55
55
|
export { MarkPopover, type MarkPopoverProps } from "./notion/MarkPopover.js";
|
|
56
56
|
export { MiniProgress, type MiniProgressProps } from "./notion/MiniProgress.js";
|
|
@@ -69,6 +69,7 @@ export { SortableActivator, SortableHandle, SortableItem, SortableList, type Sor
|
|
|
69
69
|
export { StatCards, StatPills, StatsFold, type StatCard, type StatCardAside, type StatCardsProps, type StatPill, type StatPillsProps, type StatsFoldProps, } from "./notion/Stats.js";
|
|
70
70
|
export { FileInput, type FileInputMessages, type FileInputMessagesOverride, type FileInputProps } from "./notion/FileInput.js";
|
|
71
71
|
export { FormGrid, type FormGridColumns, type FormGridProps } from "./notion/FormGrid.js";
|
|
72
|
+
export { RESULT_BADGE_ICONS, ResultBadge, type ResultBadgeProps } from "./notion/ResultBadge.js";
|
|
72
73
|
export { Status, type StatusProps } from "./notion/Status.js";
|
|
73
74
|
export { Steps, type StepItem, type StepState, type StepsLayout, type StepsProps } from "./notion/Steps.js";
|
|
74
75
|
export { TabBar, type TabBarItem, type TabBarProps } from "./notion/TabBar.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,OA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AAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACxJ,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAChF,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 { FilterChip, FilterChipAdd } from "./notion/FilterChip.js";
|
|
|
52
52
|
export { FoldRow } from "./notion/FoldRow.js";
|
|
53
53
|
export { InstallBar } from "./notion/InstallBar.js";
|
|
54
54
|
export { LaunchScreen } from "./notion/LaunchScreen.js";
|
|
55
|
-
export { LIST_CLASSES, List, ListGroup, ListGroupHeading, ListItem, ListRow, } from "./notion/List.js";
|
|
55
|
+
export { LIST_CLASSES, List, ListGroup, ListGroupHeading, ListItem, ListEntry, ListRow, } from "./notion/List.js";
|
|
56
56
|
export { PALETTE_COLORS } from "./notion/palette.js";
|
|
57
57
|
export { MarkPopover } from "./notion/MarkPopover.js";
|
|
58
58
|
export { MiniProgress } from "./notion/MiniProgress.js";
|
|
@@ -71,6 +71,7 @@ export { SortableActivator, SortableHandle, SortableItem, SortableList, } from "
|
|
|
71
71
|
export { StatCards, StatPills, StatsFold, } from "./notion/Stats.js";
|
|
72
72
|
export { FileInput } from "./notion/FileInput.js";
|
|
73
73
|
export { FormGrid } from "./notion/FormGrid.js";
|
|
74
|
+
export { RESULT_BADGE_ICONS, ResultBadge } from "./notion/ResultBadge.js";
|
|
74
75
|
export { Status } from "./notion/Status.js";
|
|
75
76
|
export { Steps } from "./notion/Steps.js";
|
|
76
77
|
export { TabBar } from "./notion/TabBar.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;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,c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OAAO,EAAE,aAAa,EAA2B,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAqB,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,GAOf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAA0C,MAAM,wBAAwB,CAAC;AACjG,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,GAQX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An `onOpenAutoFocus` handler for a Radix dialog or sheet content: it runs the app's own handler first, then, unless
|
|
3
|
+
* that prevented the default, focuses the first form field inside the content instead of the first focusable element.
|
|
4
|
+
* With no field, Radix's default focus stays.
|
|
5
|
+
*/
|
|
6
|
+
export declare function withFirstFieldFocus(onOpenAutoFocus: ((event: Event) => void) | undefined): (event: Event) => void;
|
|
7
|
+
//# sourceMappingURL=focus-first-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-first-field.d.ts","sourceRoot":"","sources":["../../src/lib/focus-first-field.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS,GACpD,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CASxB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// The form controls a dialog or sheet focuses on open, ahead of any button before them (a tooltip trigger beside a
|
|
2
|
+
// label opens its tooltip on focus, #1476).
|
|
3
|
+
const FIELD_SELECTOR = [
|
|
4
|
+
'input:not([type="hidden"]):not(:disabled)',
|
|
5
|
+
"select:not(:disabled)",
|
|
6
|
+
"textarea:not(:disabled)",
|
|
7
|
+
'[role="combobox"]:not(:disabled):not([aria-disabled="true"])',
|
|
8
|
+
].join(", ");
|
|
9
|
+
function findFirstField(container) {
|
|
10
|
+
for (const candidate of container.querySelectorAll(FIELD_SELECTOR)) {
|
|
11
|
+
if (candidate.closest("[hidden], [inert]") === null)
|
|
12
|
+
return candidate;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
function focusField(field) {
|
|
17
|
+
field.focus({ preventScroll: true });
|
|
18
|
+
// Selected as Radix selects the first text input it focuses.
|
|
19
|
+
if (field instanceof HTMLInputElement && document.activeElement === field)
|
|
20
|
+
field.select();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An `onOpenAutoFocus` handler for a Radix dialog or sheet content: it runs the app's own handler first, then, unless
|
|
24
|
+
* that prevented the default, focuses the first form field inside the content instead of the first focusable element.
|
|
25
|
+
* With no field, Radix's default focus stays.
|
|
26
|
+
*/
|
|
27
|
+
export function withFirstFieldFocus(onOpenAutoFocus) {
|
|
28
|
+
return (event) => {
|
|
29
|
+
onOpenAutoFocus?.(event);
|
|
30
|
+
if (event.defaultPrevented || !(event.currentTarget instanceof Element))
|
|
31
|
+
return;
|
|
32
|
+
const field = findFirstField(event.currentTarget);
|
|
33
|
+
if (field === null)
|
|
34
|
+
return;
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
focusField(field);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=focus-first-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-first-field.js","sourceRoot":"","sources":["../../src/lib/focus-first-field.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,4CAA4C;AAC5C,MAAM,cAAc,GAAG;IACrB,2CAA2C;IAC3C,uBAAuB;IACvB,yBAAyB;IACzB,8DAA8D;CAC/D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ,SAAS,cAAc,CAAC,SAAkB;IACxC,KAAK,MAAM,SAAS,IAAI,SAAS,CAAC,gBAAgB,CAAc,cAAc,CAAC,EAAE,CAAC;QAChF,IAAI,SAAS,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI;YAAE,OAAO,SAAS,CAAA;IACvE,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,UAAU,CAAC,KAAkB;IACpC,KAAK,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;IACpC,6DAA6D;IAC7D,IAAI,KAAK,YAAY,gBAAgB,IAAI,QAAQ,CAAC,aAAa,KAAK,KAAK;QAAE,KAAK,CAAC,MAAM,EAAE,CAAA;AAC3F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,eAAqD;IAErD,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,eAAe,EAAE,CAAC,KAAK,CAAC,CAAA;QACxB,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,CAAC,KAAK,CAAC,aAAa,YAAY,OAAO,CAAC;YAAE,OAAM;QAC/E,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QACjD,IAAI,KAAK,KAAK,IAAI;YAAE,OAAM;QAC1B,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,UAAU,CAAC,KAAK,CAAC,CAAA;IACnB,CAAC,CAAA;AACH,CAAC"}
|
package/dist/notion/List.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Density } from "@softure-ai/theme-kit";
|
|
2
|
-
import type { ComponentProps } from "react";
|
|
2
|
+
import type { ComponentProps, ElementType, ReactNode } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* The classes of a list that follows the density (`data-density` on the list or an ancestor; theme-kit's
|
|
5
5
|
* `--list-*` variables). For a list the app renders itself, such as a `SortableList` and its `SortableItem`s.
|
|
@@ -48,6 +48,37 @@ export type ListRowProps = ComponentProps<"div"> & {
|
|
|
48
48
|
};
|
|
49
49
|
/** A row in a `ListItem`: full width, the density's vertical padding, the theme's hover. */
|
|
50
50
|
export declare function ListRow({ asChild, className, ...props }: ListRowProps): import("react").JSX.Element;
|
|
51
|
+
/** The link a `ListEntry` title renders: a plain `a`, or the app's router link taking the same props. */
|
|
52
|
+
export type ListEntryLinkComponent = ElementType<{
|
|
53
|
+
href: string;
|
|
54
|
+
className?: string;
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
}>;
|
|
57
|
+
export type ListEntryProps = Omit<ComponentProps<"div">, "title" | "children"> & {
|
|
58
|
+
/** What the row is: its name, in the medium weight. With `href` it is the link that opens the row. */
|
|
59
|
+
readonly title: ReactNode;
|
|
60
|
+
/** Lines under the title (facts, a path, a time), in the muted colour; the app lays out its own lines. */
|
|
61
|
+
readonly details?: ReactNode;
|
|
62
|
+
/** The row's state, at the top of the right column (one or more badges, which wrap right-aligned). */
|
|
63
|
+
readonly status?: ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* The row's controls, under the status. They stay their own targets above the row's link, and are at least the
|
|
66
|
+
* touch target (44 px) on a phone. A control marked `data-row-wide` (an inline form that needs room) makes the right
|
|
67
|
+
* column take the full row width under the identity, its lines starting on the left.
|
|
68
|
+
*/
|
|
69
|
+
readonly actions?: ReactNode;
|
|
70
|
+
/** The row opens this address: the title's link is stretched over the whole row, with an arrow at its right. */
|
|
71
|
+
readonly href?: string;
|
|
72
|
+
/** The element for the link (a router's link component); a plain `a` by default. */
|
|
73
|
+
readonly linkComponent?: ListEntryLinkComponent;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* A list row with an identity and a right column: the title and its detail lines on the left, the row's state at the
|
|
77
|
+
* top of the right column and its controls under it. With `href` the title is a link stretched over the whole row, so
|
|
78
|
+
* the row is one box lit on hover, and an arrow sits beside the column (never on a line of its own); the column stays
|
|
79
|
+
* above the link. On a phone (below `md`) the column wraps under the identity, right-aligned. Place it in a `ListItem`.
|
|
80
|
+
*/
|
|
81
|
+
export declare function ListEntry({ title, details, status, actions, href, linkComponent: Link, className, ...props }: ListEntryProps): import("react").JSX.Element;
|
|
51
82
|
export type ListGroupProps = ComponentProps<"div"> & {
|
|
52
83
|
/** Renders the child element (a `section`, an app's own `li`) with the group's classes. */
|
|
53
84
|
readonly asChild?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/notion/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/notion/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY;aACvB,IAAI,EAAE,oEAAoE;aAC1E,UAAU,EAAE,wEAAwE;aACpF,IAAI,EAAE,oBAAoB;aAC1B,GAAG,EAAE,uPAAuP;aAC5P,KAAK,EAAE,4CAA4C;aACnD,YAAY,EACV,kIAAkI;aACpI,kBAAkB,EAChB,qIAAqI;CAC/H,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5C,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG;IAC1D,kDAAkD;IAClD,QAAQ,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,oFAAoF;IACpF,QAAQ,CAAC,OAAO,CAAC,EAA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AQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,gHAAgH;IAChH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,QAAQ,CAAC,aAAa,CAAC,EAAE,sBAAsB,CAAC;CACjD,CAAC;AAMF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,OAAO,EACP,MAAM,EACN,OAAO,EACP,IAAI,EACJ,aAAa,EAAE,IAAU,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,+BAyEhB;AAED,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACnD,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,OAAe,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,+BAGjF;AAED,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAC1D,2GAA2G;IAC3G,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;IAC/B,4FAA4F;IAC5F,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,4GAA4G;AAC5G,wBAAgB,gBAAgB,CAAC,EAAE,OAAgB,EAAE,OAAe,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,+BAUjH"}
|
package/dist/notion/List.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRight } from "lucide-react";
|
|
2
3
|
import { Slot } from "radix-ui";
|
|
3
4
|
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
4
6
|
/**
|
|
5
7
|
* The classes of a list that follows the density (`data-density` on the list or an ancestor; theme-kit's
|
|
6
8
|
* `--list-*` variables). For a list the app renders itself, such as a `SortableList` and its `SortableItem`s.
|
|
@@ -40,6 +42,23 @@ export function ListRow({ asChild = false, className, ...props }) {
|
|
|
40
42
|
const Comp = asChild ? Slot.Root : "div";
|
|
41
43
|
return _jsx(Comp, { "data-slot": "list-row", className: cn(LIST_CLASSES.row, className), ...props });
|
|
42
44
|
}
|
|
45
|
+
function isDrawn(node) {
|
|
46
|
+
return node !== undefined && node !== null && node !== false;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A list row with an identity and a right column: the title and its detail lines on the left, the row's state at the
|
|
50
|
+
* top of the right column and its controls under it. With `href` the title is a link stretched over the whole row, so
|
|
51
|
+
* the row is one box lit on hover, and an arrow sits beside the column (never on a line of its own); the column stays
|
|
52
|
+
* above the link. On a phone (below `md`) the column wraps under the identity, right-aligned. Place it in a `ListItem`.
|
|
53
|
+
*/
|
|
54
|
+
export function ListEntry({ title, details, status, actions, href, linkComponent: Link = "a", className, ...props }) {
|
|
55
|
+
const hasStatus = isDrawn(status);
|
|
56
|
+
const hasActions = isDrawn(actions);
|
|
57
|
+
const hasColumn = hasStatus || hasActions;
|
|
58
|
+
const hasLink = href !== undefined;
|
|
59
|
+
const titleClasses = "min-w-0 text-ui-medium text-foreground";
|
|
60
|
+
return (_jsxs("div", { "data-slot": "list-entry", className: cn("relative flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-2 py-(--list-row-y) text-ui transition-colors duration-100 hover:bg-accent", "has-[[data-slot=list-entry-title]:focus-visible]:ring-2 has-[[data-slot=list-entry-title]:focus-visible]:ring-ring", className), ...props, children: [_jsxs("div", { "data-slot": "list-entry-identity", className: "flex min-w-0 flex-1 basis-48 flex-col gap-0.5 max-md:basis-full", children: [hasLink ? (_jsx(Link, { "data-slot": "list-entry-title", href: href, className: cn(titleClasses, "outline-none after:absolute after:inset-0 after:rounded-md after:content-['']"), children: title })) : (_jsx("span", { "data-slot": "list-entry-title", className: titleClasses, children: title })), isDrawn(details) ? (_jsx("div", { "data-slot": "list-entry-details", className: "flex min-w-0 flex-col text-ui text-muted-foreground", children: details })) : null] }), hasColumn || hasLink ? (_jsxs("div", { "data-slot": "list-entry-side", className: "group/list-entry-side pointer-events-none relative z-10 ml-auto flex max-w-full min-w-0 flex-nowrap items-center gap-2 has-[[data-row-wide]]:ml-0 has-[[data-row-wide]]:basis-full", children: [hasColumn ? (_jsxs("div", { "data-slot": "list-entry-column", className: "flex min-w-0 flex-col items-end gap-1 has-[[data-row-wide]]:flex-1 has-[[data-row-wide]]:items-stretch", children: [hasStatus ? (_jsx("div", { "data-slot": "list-entry-status", className: "pointer-events-auto flex min-w-0 flex-wrap items-center justify-end gap-1 group-has-[[data-row-wide]]/list-entry-side:justify-start", children: status })) : null, hasActions ? (_jsx("div", { "data-slot": "list-entry-actions", className: "pointer-events-auto flex min-w-0 flex-wrap items-center justify-end gap-1 has-[[data-row-wide]]:flex-col has-[[data-row-wide]]:items-stretch has-[[data-row-wide]]:justify-start max-md:*:min-h-touch-target max-md:*:min-w-touch-target", children: actions })) : null] })) : null, hasLink ? (_jsx("span", { "data-slot": "list-entry-arrow", "aria-hidden": "true", className: "flex shrink-0 text-muted-foreground", children: _jsx(ChevronRight, { strokeWidth: ICON_STROKE_WIDTH, className: "size-4" }) })) : null] })) : null] }));
|
|
61
|
+
}
|
|
43
62
|
/**
|
|
44
63
|
* A run of rows under a `ListGroupHeading` (a country's days, a month's entries), placed straight in the scroll
|
|
45
64
|
* container, which has no top padding of its own: the heading sticks at the top while the group's rows pass under it,
|
package/dist/notion/List.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../src/notion/List.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,OAAO,EA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,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzC,OAAO,CACL,KAAC,IAAI,iBACO,oBAAoB,kBAChB,OAAO,EACrB,SAAS,EAAE,EAAE,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC,KACxG,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { type Tone } from "./tones.js";
|
|
4
|
+
/** The icon a result badge draws for each tone when the app passes none. */
|
|
5
|
+
export declare const RESULT_BADGE_ICONS: Readonly<Record<Tone, LucideIcon>>;
|
|
6
|
+
export interface ResultBadgeProps {
|
|
7
|
+
/** What the result means; the theme owns its colour (`TONE_COLORS`), so one result reads alike in every list. */
|
|
8
|
+
readonly tone: Tone;
|
|
9
|
+
/** The app's own icon in place of the tone's default (a spinning run defaults to a loader). */
|
|
10
|
+
readonly icon?: LucideIcon;
|
|
11
|
+
/** A run still in progress: the icon spins, unless the reader asked for reduced motion. */
|
|
12
|
+
readonly isSpinning?: boolean;
|
|
13
|
+
/** The word: a result always carries one, so results read apart without telling colours apart. */
|
|
14
|
+
readonly children: ReactNode;
|
|
15
|
+
/** The full word on hover; defaults to the word itself when it is a string or a number. */
|
|
16
|
+
readonly title?: string;
|
|
17
|
+
readonly className?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function ResultBadge({ tone, icon, isSpinning, children, title, className }: ResultBadgeProps): import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=ResultBadge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultBadge.d.ts","sourceRoot":"","sources":["../../src/notion/ResultBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0E,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEpD,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAMjE,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,iHAAiH;IACjH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,+FAA+F;IAC/F,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,kGAAkG;IAClG,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AASD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BAmB3G"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Circle, CircleCheck, CircleMinus, CircleX, LoaderCircle, TriangleAlert } from "lucide-react";
|
|
3
|
+
import { cn } from "../lib/utils.js";
|
|
4
|
+
import { Badge } from "../ui/badge.js";
|
|
5
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
6
|
+
import { TONE_COLORS } from "./tones.js";
|
|
7
|
+
/** The icon a result badge draws for each tone when the app passes none. */
|
|
8
|
+
export const RESULT_BADGE_ICONS = {
|
|
9
|
+
default: Circle,
|
|
10
|
+
success: CircleCheck,
|
|
11
|
+
warning: TriangleAlert,
|
|
12
|
+
danger: CircleX,
|
|
13
|
+
muted: CircleMinus,
|
|
14
|
+
};
|
|
15
|
+
/** The word as plain text, or undefined when it is any other node. */
|
|
16
|
+
function getPlainText(children) {
|
|
17
|
+
return typeof children === "string" || typeof children === "number" ? String(children) : undefined;
|
|
18
|
+
}
|
|
19
|
+
// A result (passed, failed, skipped, running): a filled tag in its tone's colour, with an icon and a word. The filled
|
|
20
|
+
// counterpart of `Status`, for a list whose rows each end in a result.
|
|
21
|
+
export function ResultBadge({ tone, icon, isSpinning = false, children, title, className }) {
|
|
22
|
+
const Icon = icon ?? (isSpinning ? LoaderCircle : RESULT_BADGE_ICONS[tone]);
|
|
23
|
+
return (_jsxs(Badge, { variant: "tag", color: TONE_COLORS[tone] ?? "default", "data-slot": "result-badge", "data-tone": tone, "data-color": TONE_COLORS[tone] ?? "default", "data-spinning": isSpinning || undefined, title: title ?? getPlainText(children), className: cn("gap-1 [&>svg]:size-3.5 [&>svg]:shrink-0", className), children: [_jsx(Icon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: isSpinning ? "motion-safe:animate-spin" : undefined }), _jsx("span", { "data-slot": "result-badge-label", className: "min-w-0 truncate", children: children })] }));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ResultBadge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultBadge.js","sourceRoot":"","sources":["../../src/notion/ResultBadge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAmB,MAAM,cAAc,CAAC;AAGvH,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AAEpD,4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d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/notion/TabBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/notion/TabBar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,SAAS,EAAkB,MAAM,OAAO,CAAC;AAI1E,MAAM,WAAW,UAAU,CAAC,GAAG,SAAS,MAAM;IAE5C,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAE1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW,CAAC,GAAG,SAAS,MAAM;IAE7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC;IAEtB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAGpC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAwDD,wBAAgB,MAAM,CAAC,GAAG,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAgB,EAAE,YAAY,EAAE,EAAE,WAAW,CAAC,GAAG,CAAC,+BA6BpH"}
|
package/dist/notion/TabBar.js
CHANGED
|
@@ -1,10 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
2
4
|
import { cn } from "../lib/utils.js";
|
|
3
5
|
const TAB_CLASS = "relative inline-flex h-control-height items-center gap-1.5 rounded-md px-2 text-ui-medium whitespace-nowrap text-muted-foreground transition-colors duration-120 after:absolute after:inset-x-0 after:-bottom-1 after:h-0.5 after:bg-foreground after:opacity-0 hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none aria-[current=page]:text-foreground aria-[current=page]:after:opacity-100 [&_svg]:size-4 [&_svg]:shrink-0";
|
|
4
6
|
const TOUCH_TAB_CLASS = "h-touch-target min-w-touch-target justify-center px-3";
|
|
7
|
+
// Static fades (no motion, so nothing to drop under prefers-reduced-motion) on each edge that hides tabs.
|
|
8
|
+
const NAV_CLASS = "overflow-x-auto border-b border-border data-overflow-start:mask-l-from-[calc(100%---spacing(8))] data-overflow-end:mask-r-from-[calc(100%---spacing(8))]";
|
|
9
|
+
// Marks each edge that hides tabs (`data-overflow-start`, `data-overflow-end`); a pixel of rounding is not overflow.
|
|
10
|
+
function markOverflowEdges(strip) {
|
|
11
|
+
strip.toggleAttribute("data-overflow-start", strip.scrollLeft > 1);
|
|
12
|
+
strip.toggleAttribute("data-overflow-end", strip.scrollWidth - strip.clientWidth - strip.scrollLeft > 1);
|
|
13
|
+
}
|
|
14
|
+
// The edge fade's width (`--spacing(8)` in NAV_CLASS): the current tab keeps this much room, so no fade covers it.
|
|
15
|
+
const FADE_WIDTH_PX = 32;
|
|
16
|
+
// Scrolls the strip itself (never the page) just far enough that the current tab is whole and clear of the fades.
|
|
17
|
+
function scrollTabIntoStrip(strip, current) {
|
|
18
|
+
const link = [...strip.querySelectorAll("a[data-tab]")].find((candidate) => candidate.dataset["tab"] === current);
|
|
19
|
+
if (link === undefined)
|
|
20
|
+
return;
|
|
21
|
+
const linkBox = link.getBoundingClientRect();
|
|
22
|
+
const start = linkBox.left - strip.getBoundingClientRect().left + strip.scrollLeft;
|
|
23
|
+
const end = start + linkBox.width;
|
|
24
|
+
const maxScroll = Math.max(0, strip.scrollWidth - strip.clientWidth);
|
|
25
|
+
if (start < strip.scrollLeft)
|
|
26
|
+
strip.scrollLeft = Math.max(0, start - FADE_WIDTH_PX);
|
|
27
|
+
else if (end > strip.scrollLeft + strip.clientWidth)
|
|
28
|
+
strip.scrollLeft = Math.min(maxScroll, end + FADE_WIDTH_PX - strip.clientWidth);
|
|
29
|
+
}
|
|
30
|
+
// Keeps the current tab in view (on mount and when it changes) and the overflow marks in step (on scroll and resize).
|
|
31
|
+
function useStripScroll(strip, current) {
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const element = strip.current;
|
|
34
|
+
if (element === null)
|
|
35
|
+
return;
|
|
36
|
+
const markEdges = () => markOverflowEdges(element);
|
|
37
|
+
element.addEventListener("scroll", markEdges, { passive: true });
|
|
38
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(markEdges);
|
|
39
|
+
observer?.observe(element);
|
|
40
|
+
return () => {
|
|
41
|
+
element.removeEventListener("scroll", markEdges);
|
|
42
|
+
observer?.disconnect();
|
|
43
|
+
};
|
|
44
|
+
}, [strip]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const element = strip.current;
|
|
47
|
+
if (element === null)
|
|
48
|
+
return;
|
|
49
|
+
scrollTabIntoStrip(element, current);
|
|
50
|
+
markOverflowEdges(element);
|
|
51
|
+
}, [strip, current]);
|
|
52
|
+
}
|
|
5
53
|
// A screen's tabs as line tabs where each tab is a link, so the shown tab lives in the address and survives a reload.
|
|
6
54
|
export function TabBar({ label, tabs, current, size = "default", tabClassName }) {
|
|
7
55
|
const linkClass = cn(TAB_CLASS, size === "touch" && TOUCH_TAB_CLASS, tabClassName);
|
|
8
|
-
|
|
56
|
+
const stripRef = useRef(null);
|
|
57
|
+
useStripScroll(stripRef, current);
|
|
58
|
+
return (_jsx("nav", { ref: stripRef, "aria-label": label, "data-slot": "tab-bar", className: NAV_CLASS, children: _jsx("ul", { className: "flex gap-1 pb-1", children: tabs.map((tab) => (_jsx("li", { children: _jsxs("a", { href: tab.href, className: linkClass, "data-tab": tab.key, "data-size": size === "touch" ? "touch" : undefined, "aria-current": tab.key === current ? "page" : undefined, children: [tab.icon, tab.label, tab.count === undefined ? null : (_jsx("span", { "data-slot": "tab-bar-count", className: "rounded-xs bg-accent px-1 text-small text-muted-foreground tabular-nums", children: tab.count }))] }) }, tab.key))) }) }));
|
|
9
59
|
}
|
|
10
60
|
//# sourceMappingURL=TabBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../src/notion/TabBar.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../src/notion/TabBar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAkC,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAyBrC,MAAM,SAAS,GACb,ydAAyd,CAAC;AAE5d,MAAM,eAAe,GAAG,uDAAuD,CAAC;AAEhF,0GAA0G;AAC1G,MAAM,SAAS,GACb,0JAA0J,CAAC;AAE7J,qHAAqH;AACrH,SAAS,iBAAiB,CAAC,KAAkB;IAC3C,KAAK,CAAC,eAAe,CAAC,qBAAqB,EAAE,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IACnE,KAAK,CAAC,eAAe,CAAC,mBAAmB,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;AAC3G,CAAC;AAED,mHAAmH;AACnH,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,kHAAkH;AAClH,SAAS,kBAAkB,CAAC,KAAkB,EAAE,OAAe;IAC7D,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAc,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,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CAAC,CAAC,SAAS,kBACnC,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,aAErD,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,KAAK,EACT,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAChC,4BAAgB,eAAe,EAAC,SAAS,EAAC,yEAAyE,YAChH,GAAG,CAAC,KAAK,GACL,CACR,IACC,IAfG,GAAG,CAAC,GAAG,CAgBX,CACN,CAAC,GACC,GACD,CACP,CAAC;AACJ,CAAC"}
|
package/dist/ui/badge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAoBjE,QAAA,MAAM,aAAa;;;8EAyClB,CAAA;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAmB,EACnB,KAAK,EACL,OAAe,EACf,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,GAC5C,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAoBjE,QAAA,MAAM,aAAa;;;8EAyClB,CAAA;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAmB,EACnB,KAAK,EACL,OAAe,EACf,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,GAC5C,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,qBAY3D;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
package/dist/ui/badge.js
CHANGED
|
@@ -55,7 +55,7 @@ const badgeVariants = cva("inline-flex w-fit max-w-full shrink-0 items-center ju
|
|
|
55
55
|
});
|
|
56
56
|
function Badge({ className, variant = "default", color, asChild = false, ...props }) {
|
|
57
57
|
const Comp = asChild ? Slot.Root : "span";
|
|
58
|
-
return (_jsx(Comp, { "data-slot": "badge", "data-variant": variant, className: cn(badgeVariants({ variant, color }), className), ...props }));
|
|
58
|
+
return (_jsx(Comp, { "data-slot": "badge", "data-variant": variant, "data-color": color === "none" ? undefined : (color ?? undefined), className: cn(badgeVariants({ variant, color }), className), ...props }));
|
|
59
59
|
}
|
|
60
60
|
export { Badge, badgeVariants };
|
|
61
61
|
//# sourceMappingURL=badge.js.map
|
package/dist/ui/badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/ui/badge.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,MAAM,UAAU,GAAG;IACjB,OAAO,EAAE,4CAA4C;IACrD,IAAI,EAAE,sCAAsC;IAC5C,KAAK,EAAE,wCAAwC;IAC/C,MAAM,EAAE,0CAA0C;IAClD,MAAM,EAAE,0CAA0C;IAClD,KAAK,EAAE,wCAAwC;IAC/C,IAAI,EAAE,sCAAsC;IAC5C,MAAM,EAAE,0CAA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V,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,GAAG,EAAE,EAAE;SACR;KACF;IACD,uEAAuE;IACvE,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;QACxE,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC;QAC9B,KAAK,EAAE,KAAgC;QACvC,SAAS;KACV,CAAC,CAAC;IACH,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,MAAM;KACd;CACF,CACF,CAAA;AAED,SAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,KAAK,EACL,OAAO,GAAG,KAAK,EACf,GAAG,KAAK,EAEkD;IAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAA;IAEzC,OAAO,CACL,KAAC,IAAI,iBACO,OAAO,kBACH,OAAO,gBACT,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,EAC/D,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC,KACvD,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
package/dist/ui/dialog.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogP
|
|
|
5
5
|
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): React.JSX.Element;
|
|
6
6
|
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): React.JSX.Element;
|
|
7
7
|
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element;
|
|
8
|
-
declare function DialogContent({ className, children, showCloseButton, closeLabel, closeButtonSize, size, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
8
|
+
declare function DialogContent({ className, children, showCloseButton, closeLabel, closeButtonSize, size, onOpenAutoFocus, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
10
|
closeLabel?: string;
|
|
11
11
|
closeButtonSize?: "default" | "touch";
|
package/dist/ui/dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AAIpD,iBAAS,MAAM,CAAC,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAEnD;AAED,iBAAS,aAAa,CAAC,EACrB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAEtD;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,qBAErD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;AA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,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAA"}
|
package/dist/ui/dialog.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { en as messages } from "../messages/en.js";
|
|
5
|
+
import { withFirstFieldFocus } from "../lib/focus-first-field.js";
|
|
5
6
|
import { cn } from "../lib/utils.js";
|
|
6
7
|
import { XIcon } from "lucide-react";
|
|
7
8
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
@@ -21,8 +22,8 @@ function DialogClose({ ...props }) {
|
|
|
21
22
|
function DialogOverlay({ className, ...props }) {
|
|
22
23
|
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn("fixed inset-0 z-50 bg-overlay duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", className), ...props }));
|
|
23
24
|
}
|
|
24
|
-
function DialogContent({ className, children, showCloseButton = true, closeLabel = messages.dialog.close, closeButtonSize = "default", size = "default", ...props }) {
|
|
25
|
-
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl bg-popover p-6 text-popover-foreground shadow-dialog duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg", size === "wide" && "lg:max-w-1/2", size === "lg" &&
|
|
25
|
+
function DialogContent({ className, children, showCloseButton = true, closeLabel = messages.dialog.close, closeButtonSize = "default", size = "default", onOpenAutoFocus, ...props }) {
|
|
26
|
+
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", onOpenAutoFocus: withFirstFieldFocus(onOpenAutoFocus), className: cn("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl bg-popover p-6 text-popover-foreground shadow-dialog duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg", size === "wide" && "lg:max-w-1/2", size === "lg" &&
|
|
26
27
|
"flex h-[calc(100dvh-2rem)] flex-col overflow-y-auto sm:h-3/4 sm:max-w-3/4 lg:h-1/2 lg:min-h-96 lg:max-w-1/2", size === "sm" && "max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-md", className), ...props, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: cn("absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", closeButtonSize === "touch" &&
|
|
27
28
|
"top-0.5 right-0.5 inline-flex size-touch-target items-center justify-center rounded-md"), children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: closeLabel })] }))] })] }));
|
|
28
29
|
}
|
package/dist/ui/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAClD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AS,EAAE,GAAG,KAAK,EAA+B;IACxE,OAAO,CACL,2BACY,eAAe,EACzB,SAAS,EAAE,EAAE,CAAC,8CAA8C,EAAE,SAAS,CAAC,KACpE,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CAAC,EACpB,SAAS,EACT,eAAe,GAAG,KAAK,EACvB,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,EAClC,QAAQ,EACR,GAAG,KAAK,EAKT;IACC,OAAO,CACL,4BACY,eAAe,EACzB,SAAS,EAAE,EAAE,CACX,wDAAwD,EACxD,SAAS,CACV,KACG,KAAK,aAER,eAAe,IAAI,CAClB,KAAC,eAAe,CAAC,KAAK,IAAC,OAAO,kBAC5B,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,YAAE,UAAU,GAAU,GACzB,CACzB,EACA,QAAQ,IACL,CACP,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EAC2C;IACnD,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAC1D,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACiD;IACzD,OAAO,CACL,KAAC,eAAe,CAAC,WAAW,iBAChB,oBAAoB,EAC9B,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KACrD,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAA"}
|
package/dist/ui/sheet.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Dialog as SheetPrimitive } from "radix-ui";
|
|
|
3
3
|
declare function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): React.JSX.Element;
|
|
4
4
|
declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>): React.JSX.Element;
|
|
5
5
|
declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): React.JSX.Element;
|
|
6
|
-
declare function SheetContent({ className, children, side, showCloseButton, closeLabel, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
6
|
+
declare function SheetContent({ className, children, side, showCloseButton, closeLabel, onOpenAutoFocus, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
7
7
|
side?: "top" | "right" | "bottom" | "left";
|
|
8
8
|
showCloseButton?: boolean;
|
|
9
9
|
closeLabel?: string;
|
package/dist/ui/sheet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../src/ui/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../src/ui/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,UAAU,CAAA;AAEnD,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,qBAE5E;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,qBAErD;AAED,iBAAS,UAAU,CAAC,EAClB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAEnD;AAwBD,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,IAAc,EACd,eAAsB,EACtB,UAAiC,EACjC,eAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG;IACvD,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,qBAqCA;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAQnD;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,WAAW,CAAC,qBAQzD;AAED,OAAO,EACL,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,CAAA"}
|
package/dist/ui/sheet.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { en as messages } from "../messages/en.js";
|
|
5
|
+
import { withFirstFieldFocus } from "../lib/focus-first-field.js";
|
|
5
6
|
import { cn } from "../lib/utils.js";
|
|
6
7
|
import { XIcon } from "lucide-react";
|
|
7
8
|
import { Dialog as SheetPrimitive } from "radix-ui";
|
|
@@ -20,8 +21,8 @@ function SheetPortal({ ...props }) {
|
|
|
20
21
|
function SheetOverlay({ className, ...props }) {
|
|
21
22
|
return (_jsx(SheetPrimitive.Overlay, { "data-slot": "sheet-overlay", className: cn("fixed inset-0 z-50 bg-overlay data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", className), ...props }));
|
|
22
23
|
}
|
|
23
|
-
function SheetContent({ className, children, side = "right", showCloseButton = true, closeLabel = messages.sheet.close, ...props }) {
|
|
24
|
-
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Content, { "data-slot": "sheet-content", className: cn("fixed z-50 flex flex-col gap-4 bg-popover text-popover-foreground shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500", side === "right" &&
|
|
24
|
+
function SheetContent({ className, children, side = "right", showCloseButton = true, closeLabel = messages.sheet.close, onOpenAutoFocus, ...props }) {
|
|
25
|
+
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Content, { "data-slot": "sheet-content", onOpenAutoFocus: withFirstFieldFocus(onOpenAutoFocus), className: cn("fixed z-50 flex flex-col gap-4 bg-popover text-popover-foreground shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500", side === "right" &&
|
|
25
26
|
"inset-y-0 right-0 h-full pt-[env(safe-area-inset-top)] pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", side === "left" &&
|
|
26
27
|
"inset-y-0 left-0 h-full pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)] w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", side === "top" &&
|
|
27
28
|
"inset-x-0 top-0 h-auto pt-[env(safe-area-inset-top)] pr-[env(safe-area-inset-right)] pl-[env(safe-area-inset-left)] border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", side === "bottom" &&
|
package/dist/ui/sheet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet.js","sourceRoot":"","sources":["../../src/ui/sheet.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,UAAU,CAAA;AAEnD,SAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAoD;IAC3E,OAAO,KAAC,cAAc,CAAC,IAAI,iBAAW,OAAO,KAAK,KAAK,GAAI,CAAA;AAC7D,CAAC;AAED,SAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EAC4C;IACpD,OAAO,KAAC,cAAc,CAAC,OAAO,iBAAW,eAAe,KAAK,KAAK,GAAI,CAAA;AACxE,CAAC;AAED,SAAS,UAAU,CAAC,EAClB,GAAG,KAAK,EAC0C;IAClD,OAAO,KAAC,cAAc,CAAC,KAAK,iBAAW,aAAa,KAAK,KAAK,GAAI,CAAA;AACpE,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EAC2C;IACnD,OAAO,KAAC,cAAc,CAAC,MAAM,iBAAW,cAAc,KAAK,KAAK,GAAI,CAAA;AACtE,CAAC;AAED,SAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EAC4C;IACpD,OAAO,CACL,KAAC,cAAc,CAAC,OAAO,iBACX,eAAe,EACzB,SAAS,EAAE,EAAE,CACX,w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",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.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",
|
package/src/index.ts
CHANGED
|
@@ -72,11 +72,14 @@ export {
|
|
|
72
72
|
ListGroup,
|
|
73
73
|
ListGroupHeading,
|
|
74
74
|
ListItem,
|
|
75
|
+
ListEntry,
|
|
75
76
|
ListRow,
|
|
76
77
|
type ListGroupHeadingProps,
|
|
77
78
|
type ListGroupProps,
|
|
78
79
|
type ListItemProps,
|
|
79
80
|
type ListProps,
|
|
81
|
+
type ListEntryLinkComponent,
|
|
82
|
+
type ListEntryProps,
|
|
80
83
|
type ListRowProps,
|
|
81
84
|
type ListSurface,
|
|
82
85
|
} from "./notion/List.js";
|
|
@@ -121,6 +124,7 @@ export {
|
|
|
121
124
|
} from "./notion/Stats.js";
|
|
122
125
|
export { FileInput, type FileInputMessages, type FileInputMessagesOverride, type FileInputProps } from "./notion/FileInput.js";
|
|
123
126
|
export { FormGrid, type FormGridColumns, type FormGridProps } from "./notion/FormGrid.js";
|
|
127
|
+
export { RESULT_BADGE_ICONS, ResultBadge, type ResultBadgeProps } from "./notion/ResultBadge.js";
|
|
124
128
|
export { Status, type StatusProps } from "./notion/Status.js";
|
|
125
129
|
export { Steps, type StepItem, type StepState, type StepsLayout, type StepsProps } from "./notion/Steps.js";
|
|
126
130
|
export { TabBar, type TabBarItem, type TabBarProps } from "./notion/TabBar.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// The form controls a dialog or sheet focuses on open, ahead of any button before them (a tooltip trigger beside a
|
|
2
|
+
// label opens its tooltip on focus, #1476).
|
|
3
|
+
const FIELD_SELECTOR = [
|
|
4
|
+
'input:not([type="hidden"]):not(:disabled)',
|
|
5
|
+
"select:not(:disabled)",
|
|
6
|
+
"textarea:not(:disabled)",
|
|
7
|
+
'[role="combobox"]:not(:disabled):not([aria-disabled="true"])',
|
|
8
|
+
].join(", ")
|
|
9
|
+
|
|
10
|
+
function findFirstField(container: Element): HTMLElement | null {
|
|
11
|
+
for (const candidate of container.querySelectorAll<HTMLElement>(FIELD_SELECTOR)) {
|
|
12
|
+
if (candidate.closest("[hidden], [inert]") === null) return candidate
|
|
13
|
+
}
|
|
14
|
+
return null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function focusField(field: HTMLElement): void {
|
|
18
|
+
field.focus({ preventScroll: true })
|
|
19
|
+
// Selected as Radix selects the first text input it focuses.
|
|
20
|
+
if (field instanceof HTMLInputElement && document.activeElement === field) field.select()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An `onOpenAutoFocus` handler for a Radix dialog or sheet content: it runs the app's own handler first, then, unless
|
|
25
|
+
* that prevented the default, focuses the first form field inside the content instead of the first focusable element.
|
|
26
|
+
* With no field, Radix's default focus stays.
|
|
27
|
+
*/
|
|
28
|
+
export function withFirstFieldFocus(
|
|
29
|
+
onOpenAutoFocus: ((event: Event) => void) | undefined
|
|
30
|
+
): (event: Event) => void {
|
|
31
|
+
return (event) => {
|
|
32
|
+
onOpenAutoFocus?.(event)
|
|
33
|
+
if (event.defaultPrevented || !(event.currentTarget instanceof Element)) return
|
|
34
|
+
const field = findFirstField(event.currentTarget)
|
|
35
|
+
if (field === null) return
|
|
36
|
+
event.preventDefault()
|
|
37
|
+
focusField(field)
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/notion/List.tsx
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Density } from "@softure-ai/theme-kit";
|
|
2
|
+
import { ChevronRight } from "lucide-react";
|
|
2
3
|
import { Slot } from "radix-ui";
|
|
3
|
-
import type { ComponentProps } from "react";
|
|
4
|
+
import type { ComponentProps, ElementType, ReactNode } from "react";
|
|
4
5
|
|
|
5
6
|
import { cn } from "../lib/utils.js";
|
|
6
7
|
|
|
8
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* The classes of a list that follows the density (`data-density` on the list or an ancestor; theme-kit's
|
|
9
12
|
* `--list-*` variables). For a list the app renders itself, such as a `SortableList` and its `SortableItem`s.
|
|
@@ -78,6 +81,122 @@ export function ListRow({ asChild = false, className, ...props }: ListRowProps)
|
|
|
78
81
|
return <Comp data-slot="list-row" className={cn(LIST_CLASSES.row, className)} {...props} />;
|
|
79
82
|
}
|
|
80
83
|
|
|
84
|
+
/** The link a `ListEntry` title renders: a plain `a`, or the app's router link taking the same props. */
|
|
85
|
+
export type ListEntryLinkComponent = ElementType<{ href: string; className?: string; children?: ReactNode }>;
|
|
86
|
+
|
|
87
|
+
export type ListEntryProps = Omit<ComponentProps<"div">, "title" | "children"> & {
|
|
88
|
+
/** What the row is: its name, in the medium weight. With `href` it is the link that opens the row. */
|
|
89
|
+
readonly title: ReactNode;
|
|
90
|
+
/** Lines under the title (facts, a path, a time), in the muted colour; the app lays out its own lines. */
|
|
91
|
+
readonly details?: ReactNode;
|
|
92
|
+
/** The row's state, at the top of the right column (one or more badges, which wrap right-aligned). */
|
|
93
|
+
readonly status?: ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* The row's controls, under the status. They stay their own targets above the row's link, and are at least the
|
|
96
|
+
* touch target (44 px) on a phone. A control marked `data-row-wide` (an inline form that needs room) makes the right
|
|
97
|
+
* column take the full row width under the identity, its lines starting on the left.
|
|
98
|
+
*/
|
|
99
|
+
readonly actions?: ReactNode;
|
|
100
|
+
/** The row opens this address: the title's link is stretched over the whole row, with an arrow at its right. */
|
|
101
|
+
readonly href?: string;
|
|
102
|
+
/** The element for the link (a router's link component); a plain `a` by default. */
|
|
103
|
+
readonly linkComponent?: ListEntryLinkComponent;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
function isDrawn(node: ReactNode): boolean {
|
|
107
|
+
return node !== undefined && node !== null && node !== false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* A list row with an identity and a right column: the title and its detail lines on the left, the row's state at the
|
|
112
|
+
* top of the right column and its controls under it. With `href` the title is a link stretched over the whole row, so
|
|
113
|
+
* the row is one box lit on hover, and an arrow sits beside the column (never on a line of its own); the column stays
|
|
114
|
+
* above the link. On a phone (below `md`) the column wraps under the identity, right-aligned. Place it in a `ListItem`.
|
|
115
|
+
*/
|
|
116
|
+
export function ListEntry({
|
|
117
|
+
title,
|
|
118
|
+
details,
|
|
119
|
+
status,
|
|
120
|
+
actions,
|
|
121
|
+
href,
|
|
122
|
+
linkComponent: Link = "a",
|
|
123
|
+
className,
|
|
124
|
+
...props
|
|
125
|
+
}: ListEntryProps) {
|
|
126
|
+
const hasStatus = isDrawn(status);
|
|
127
|
+
const hasActions = isDrawn(actions);
|
|
128
|
+
const hasColumn = hasStatus || hasActions;
|
|
129
|
+
const hasLink = href !== undefined;
|
|
130
|
+
const titleClasses = "min-w-0 text-ui-medium text-foreground";
|
|
131
|
+
return (
|
|
132
|
+
<div
|
|
133
|
+
data-slot="list-entry"
|
|
134
|
+
className={cn(
|
|
135
|
+
"relative flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-2 py-(--list-row-y) text-ui transition-colors duration-100 hover:bg-accent",
|
|
136
|
+
"has-[[data-slot=list-entry-title]:focus-visible]:ring-2 has-[[data-slot=list-entry-title]:focus-visible]:ring-ring",
|
|
137
|
+
className,
|
|
138
|
+
)}
|
|
139
|
+
{...props}
|
|
140
|
+
>
|
|
141
|
+
<div data-slot="list-entry-identity" className="flex min-w-0 flex-1 basis-48 flex-col gap-0.5 max-md:basis-full">
|
|
142
|
+
{hasLink ? (
|
|
143
|
+
<Link
|
|
144
|
+
data-slot="list-entry-title"
|
|
145
|
+
href={href}
|
|
146
|
+
className={cn(titleClasses, "outline-none after:absolute after:inset-0 after:rounded-md after:content-['']")}
|
|
147
|
+
>
|
|
148
|
+
{title}
|
|
149
|
+
</Link>
|
|
150
|
+
) : (
|
|
151
|
+
<span data-slot="list-entry-title" className={titleClasses}>
|
|
152
|
+
{title}
|
|
153
|
+
</span>
|
|
154
|
+
)}
|
|
155
|
+
{isDrawn(details) ? (
|
|
156
|
+
<div data-slot="list-entry-details" className="flex min-w-0 flex-col text-ui text-muted-foreground">
|
|
157
|
+
{details}
|
|
158
|
+
</div>
|
|
159
|
+
) : null}
|
|
160
|
+
</div>
|
|
161
|
+
{hasColumn || hasLink ? (
|
|
162
|
+
<div
|
|
163
|
+
data-slot="list-entry-side"
|
|
164
|
+
className="group/list-entry-side pointer-events-none relative z-10 ml-auto flex max-w-full min-w-0 flex-nowrap items-center gap-2 has-[[data-row-wide]]:ml-0 has-[[data-row-wide]]:basis-full"
|
|
165
|
+
>
|
|
166
|
+
{hasColumn ? (
|
|
167
|
+
<div
|
|
168
|
+
data-slot="list-entry-column"
|
|
169
|
+
className="flex min-w-0 flex-col items-end gap-1 has-[[data-row-wide]]:flex-1 has-[[data-row-wide]]:items-stretch"
|
|
170
|
+
>
|
|
171
|
+
{hasStatus ? (
|
|
172
|
+
<div
|
|
173
|
+
data-slot="list-entry-status"
|
|
174
|
+
className="pointer-events-auto flex min-w-0 flex-wrap items-center justify-end gap-1 group-has-[[data-row-wide]]/list-entry-side:justify-start"
|
|
175
|
+
>
|
|
176
|
+
{status}
|
|
177
|
+
</div>
|
|
178
|
+
) : null}
|
|
179
|
+
{hasActions ? (
|
|
180
|
+
<div
|
|
181
|
+
data-slot="list-entry-actions"
|
|
182
|
+
className="pointer-events-auto flex min-w-0 flex-wrap items-center justify-end gap-1 has-[[data-row-wide]]:flex-col has-[[data-row-wide]]:items-stretch has-[[data-row-wide]]:justify-start max-md:*:min-h-touch-target max-md:*:min-w-touch-target"
|
|
183
|
+
>
|
|
184
|
+
{actions}
|
|
185
|
+
</div>
|
|
186
|
+
) : null}
|
|
187
|
+
</div>
|
|
188
|
+
) : null}
|
|
189
|
+
{hasLink ? (
|
|
190
|
+
<span data-slot="list-entry-arrow" aria-hidden="true" className="flex shrink-0 text-muted-foreground">
|
|
191
|
+
<ChevronRight strokeWidth={ICON_STROKE_WIDTH} className="size-4" />
|
|
192
|
+
</span>
|
|
193
|
+
) : null}
|
|
194
|
+
</div>
|
|
195
|
+
) : null}
|
|
196
|
+
</div>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
81
200
|
export type ListGroupProps = ComponentProps<"div"> & {
|
|
82
201
|
/** Renders the child element (a `section`, an app's own `li`) with the group's classes. */
|
|
83
202
|
readonly asChild?: boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Circle, CircleCheck, CircleMinus, CircleX, LoaderCircle, TriangleAlert, type LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { Badge } from "../ui/badge.js";
|
|
6
|
+
|
|
7
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
8
|
+
import { TONE_COLORS, type Tone } from "./tones.js";
|
|
9
|
+
|
|
10
|
+
/** The icon a result badge draws for each tone when the app passes none. */
|
|
11
|
+
export const RESULT_BADGE_ICONS: Readonly<Record<Tone, LucideIcon>> = {
|
|
12
|
+
default: Circle,
|
|
13
|
+
success: CircleCheck,
|
|
14
|
+
warning: TriangleAlert,
|
|
15
|
+
danger: CircleX,
|
|
16
|
+
muted: CircleMinus,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export interface ResultBadgeProps {
|
|
20
|
+
/** What the result means; the theme owns its colour (`TONE_COLORS`), so one result reads alike in every list. */
|
|
21
|
+
readonly tone: Tone;
|
|
22
|
+
/** The app's own icon in place of the tone's default (a spinning run defaults to a loader). */
|
|
23
|
+
readonly icon?: LucideIcon;
|
|
24
|
+
/** A run still in progress: the icon spins, unless the reader asked for reduced motion. */
|
|
25
|
+
readonly isSpinning?: boolean;
|
|
26
|
+
/** The word: a result always carries one, so results read apart without telling colours apart. */
|
|
27
|
+
readonly children: ReactNode;
|
|
28
|
+
/** The full word on hover; defaults to the word itself when it is a string or a number. */
|
|
29
|
+
readonly title?: string;
|
|
30
|
+
readonly className?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The word as plain text, or undefined when it is any other node. */
|
|
34
|
+
function getPlainText(children: ReactNode): string | undefined {
|
|
35
|
+
return typeof children === "string" || typeof children === "number" ? String(children) : undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// A result (passed, failed, skipped, running): a filled tag in its tone's colour, with an icon and a word. The filled
|
|
39
|
+
// counterpart of `Status`, for a list whose rows each end in a result.
|
|
40
|
+
export function ResultBadge({ tone, icon, isSpinning = false, children, title, className }: ResultBadgeProps) {
|
|
41
|
+
const Icon = icon ?? (isSpinning ? LoaderCircle : RESULT_BADGE_ICONS[tone]);
|
|
42
|
+
return (
|
|
43
|
+
<Badge
|
|
44
|
+
variant="tag"
|
|
45
|
+
color={TONE_COLORS[tone] ?? "default"}
|
|
46
|
+
data-slot="result-badge"
|
|
47
|
+
data-tone={tone}
|
|
48
|
+
data-color={TONE_COLORS[tone] ?? "default"}
|
|
49
|
+
data-spinning={isSpinning || undefined}
|
|
50
|
+
title={title ?? getPlainText(children)}
|
|
51
|
+
className={cn("gap-1 [&>svg]:size-3.5 [&>svg]:shrink-0", className)}
|
|
52
|
+
>
|
|
53
|
+
<Icon aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} className={isSpinning ? "motion-safe:animate-spin" : undefined} />
|
|
54
|
+
<span data-slot="result-badge-label" className="min-w-0 truncate">
|
|
55
|
+
{children}
|
|
56
|
+
</span>
|
|
57
|
+
</Badge>
|
|
58
|
+
);
|
|
59
|
+
}
|
package/src/notion/TabBar.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, type ReactNode, type RefObject } from "react";
|
|
2
4
|
|
|
3
5
|
import { cn } from "../lib/utils.js";
|
|
4
6
|
|
|
@@ -30,11 +32,61 @@ const TAB_CLASS =
|
|
|
30
32
|
|
|
31
33
|
const TOUCH_TAB_CLASS = "h-touch-target min-w-touch-target justify-center px-3";
|
|
32
34
|
|
|
35
|
+
// Static fades (no motion, so nothing to drop under prefers-reduced-motion) on each edge that hides tabs.
|
|
36
|
+
const NAV_CLASS =
|
|
37
|
+
"overflow-x-auto border-b border-border data-overflow-start:mask-l-from-[calc(100%---spacing(8))] data-overflow-end:mask-r-from-[calc(100%---spacing(8))]";
|
|
38
|
+
|
|
39
|
+
// Marks each edge that hides tabs (`data-overflow-start`, `data-overflow-end`); a pixel of rounding is not overflow.
|
|
40
|
+
function markOverflowEdges(strip: HTMLElement) {
|
|
41
|
+
strip.toggleAttribute("data-overflow-start", strip.scrollLeft > 1);
|
|
42
|
+
strip.toggleAttribute("data-overflow-end", strip.scrollWidth - strip.clientWidth - strip.scrollLeft > 1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// The edge fade's width (`--spacing(8)` in NAV_CLASS): the current tab keeps this much room, so no fade covers it.
|
|
46
|
+
const FADE_WIDTH_PX = 32;
|
|
47
|
+
|
|
48
|
+
// Scrolls the strip itself (never the page) just far enough that the current tab is whole and clear of the fades.
|
|
49
|
+
function scrollTabIntoStrip(strip: HTMLElement, current: string) {
|
|
50
|
+
const link = [...strip.querySelectorAll<HTMLElement>("a[data-tab]")].find((candidate) => candidate.dataset["tab"] === current);
|
|
51
|
+
if (link === undefined) return;
|
|
52
|
+
const linkBox = link.getBoundingClientRect();
|
|
53
|
+
const start = linkBox.left - strip.getBoundingClientRect().left + strip.scrollLeft;
|
|
54
|
+
const end = start + linkBox.width;
|
|
55
|
+
const maxScroll = Math.max(0, strip.scrollWidth - strip.clientWidth);
|
|
56
|
+
if (start < strip.scrollLeft) strip.scrollLeft = Math.max(0, start - FADE_WIDTH_PX);
|
|
57
|
+
else if (end > strip.scrollLeft + strip.clientWidth) strip.scrollLeft = Math.min(maxScroll, end + FADE_WIDTH_PX - strip.clientWidth);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Keeps the current tab in view (on mount and when it changes) and the overflow marks in step (on scroll and resize).
|
|
61
|
+
function useStripScroll(strip: RefObject<HTMLElement | null>, current: string) {
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const element = strip.current;
|
|
64
|
+
if (element === null) return;
|
|
65
|
+
const markEdges = () => markOverflowEdges(element);
|
|
66
|
+
element.addEventListener("scroll", markEdges, { passive: true });
|
|
67
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(markEdges);
|
|
68
|
+
observer?.observe(element);
|
|
69
|
+
return () => {
|
|
70
|
+
element.removeEventListener("scroll", markEdges);
|
|
71
|
+
observer?.disconnect();
|
|
72
|
+
};
|
|
73
|
+
}, [strip]);
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const element = strip.current;
|
|
77
|
+
if (element === null) return;
|
|
78
|
+
scrollTabIntoStrip(element, current);
|
|
79
|
+
markOverflowEdges(element);
|
|
80
|
+
}, [strip, current]);
|
|
81
|
+
}
|
|
82
|
+
|
|
33
83
|
// A screen's tabs as line tabs where each tab is a link, so the shown tab lives in the address and survives a reload.
|
|
34
84
|
export function TabBar<Key extends string>({ label, tabs, current, size = "default", tabClassName }: TabBarProps<Key>) {
|
|
35
85
|
const linkClass = cn(TAB_CLASS, size === "touch" && TOUCH_TAB_CLASS, tabClassName);
|
|
86
|
+
const stripRef = useRef<HTMLElement | null>(null);
|
|
87
|
+
useStripScroll(stripRef, current);
|
|
36
88
|
return (
|
|
37
|
-
<nav aria-label={label} data-slot="tab-bar" className=
|
|
89
|
+
<nav ref={stripRef} aria-label={label} data-slot="tab-bar" className={NAV_CLASS}>
|
|
38
90
|
<ul className="flex gap-1 pb-1">
|
|
39
91
|
{tabs.map((tab) => (
|
|
40
92
|
<li key={tab.key}>
|
package/src/ui/badge.tsx
CHANGED
package/src/ui/dialog.tsx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { en as messages } from "../messages/en.js"
|
|
5
|
+
import { withFirstFieldFocus } from "../lib/focus-first-field.js"
|
|
5
6
|
import { cn } from "../lib/utils.js"
|
|
6
7
|
import { XIcon } from "lucide-react"
|
|
7
8
|
import { Dialog as DialogPrimitive } from "radix-ui"
|
|
@@ -55,6 +56,7 @@ function DialogContent({
|
|
|
55
56
|
closeLabel = messages.dialog.close,
|
|
56
57
|
closeButtonSize = "default",
|
|
57
58
|
size = "default",
|
|
59
|
+
onOpenAutoFocus,
|
|
58
60
|
...props
|
|
59
61
|
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
60
62
|
showCloseButton?: boolean
|
|
@@ -72,6 +74,7 @@ function DialogContent({
|
|
|
72
74
|
<DialogOverlay />
|
|
73
75
|
<DialogPrimitive.Content
|
|
74
76
|
data-slot="dialog-content"
|
|
77
|
+
onOpenAutoFocus={withFirstFieldFocus(onOpenAutoFocus)}
|
|
75
78
|
className={cn(
|
|
76
79
|
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl bg-popover p-6 text-popover-foreground shadow-dialog duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
|
77
80
|
size === "wide" && "lg:max-w-1/2",
|
package/src/ui/sheet.tsx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { en as messages } from "../messages/en.js"
|
|
5
|
+
import { withFirstFieldFocus } from "../lib/focus-first-field.js"
|
|
5
6
|
import { cn } from "../lib/utils.js"
|
|
6
7
|
import { XIcon } from "lucide-react"
|
|
7
8
|
import { Dialog as SheetPrimitive } from "radix-ui"
|
|
@@ -50,6 +51,7 @@ function SheetContent({
|
|
|
50
51
|
side = "right",
|
|
51
52
|
showCloseButton = true,
|
|
52
53
|
closeLabel = messages.sheet.close,
|
|
54
|
+
onOpenAutoFocus,
|
|
53
55
|
...props
|
|
54
56
|
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
55
57
|
side?: "top" | "right" | "bottom" | "left"
|
|
@@ -62,6 +64,7 @@ function SheetContent({
|
|
|
62
64
|
<SheetOverlay />
|
|
63
65
|
<SheetPrimitive.Content
|
|
64
66
|
data-slot="sheet-content"
|
|
67
|
+
onOpenAutoFocus={withFirstFieldFocus(onOpenAutoFocus)}
|
|
65
68
|
className={cn(
|
|
66
69
|
"fixed z-50 flex flex-col gap-4 bg-popover text-popover-foreground shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500",
|
|
67
70
|
side === "right" &&
|