@softure-ai/theme-notion 0.11.1 → 0.13.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 +20 -0
- package/README.md +47 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/messages/en.d.ts +7 -0
- package/dist/messages/en.d.ts.map +1 -1
- package/dist/messages/en.js +7 -0
- package/dist/messages/en.js.map +1 -1
- package/dist/messages/index.d.ts +7 -0
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/notion/AsidePanel.d.ts +67 -0
- package/dist/notion/AsidePanel.d.ts.map +1 -0
- package/dist/notion/AsidePanel.js +158 -0
- package/dist/notion/AsidePanel.js.map +1 -0
- package/dist/notion/overlay-open.d.ts +7 -0
- package/dist/notion/overlay-open.d.ts.map +1 -0
- package/dist/notion/overlay-open.js +28 -0
- package/dist/notion/overlay-open.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +14 -0
- package/src/messages/en.ts +7 -0
- package/src/notion/AsidePanel.tsx +359 -0
- package/src/notion/overlay-open.ts +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,26 @@ 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.13.0
|
|
8
|
+
|
|
9
|
+
- `AsidePanel` follow-ups (#1075): `AsidePanelToggle icon` (a `LucideIcon` drawn in both states, for a panel that
|
|
10
|
+
holds one tool its users know by its icon); the wide-screen `aside` carries `max-md:hidden`, so a phone served the
|
|
11
|
+
server HTML with a kept open panel no longer paints it until hydration swaps in the sheet (an app's
|
|
12
|
+
`contents max-md:hidden` wrapper can go); the toggle, the width switch and the sidebar opener set `title` from
|
|
13
|
+
their labels, so they show a hover hint; `AsidePanel description` adds one line under the phone sheet's title.
|
|
14
|
+
New optional props only.
|
|
15
|
+
|
|
16
|
+
## 0.12.0
|
|
17
|
+
|
|
18
|
+
- A panel slid in from the right of the app shell (#1044): `AsidePanelProvider` (replaces `SidebarProvider`, keeps
|
|
19
|
+
one side panel open at a time: the left sidebar folds while the panel is open on a wide screen), `AsidePanelToggle`
|
|
20
|
+
(fixed top-right, `aria-expanded`/`aria-controls`, `outline` closed and `secondary` open), `AsidePanel` (an `aside`
|
|
21
|
+
beside the content at two fifths or half the shell, a width switch, Escape and focus; a right `Sheet` on a phone,
|
|
22
|
+
opened for the page only), `AsidePanelSidebarOpener` (brings the sidebar back and closes the panel),
|
|
23
|
+
`useAsidePanel` and `isOverlayOpen(root)`. Kept state through `initialState` and `save(state)`; a failed save keeps
|
|
24
|
+
the choice and reaches `onSaveError`; `isHidden` for screens with no panel. Copy in `notionMessages.en.asidePanel`.
|
|
25
|
+
New exports only.
|
|
26
|
+
|
|
7
27
|
## 0.11.1
|
|
8
28
|
|
|
9
29
|
- `tabsListVariants` can be called from a Server Component (#1008): the class builder of `TabsList` moved out of the
|
package/README.md
CHANGED
|
@@ -74,7 +74,8 @@ import { CircleCheck } from "lucide-react";
|
|
|
74
74
|
|
|
75
75
|
**Copy.** The components' built-in texts are accessible names in English (`notionMessages.en`). Pass the app's own
|
|
76
76
|
wording by props: `Breadcrumb aria-label`, `BreadcrumbEllipsis label`, `PageHeader crumbsLabel`,
|
|
77
|
-
`DialogContent closeLabel`, `DialogFooter closeLabel` (the `showCloseButton` button's text), `SheetContent closeLabel`, `SidePanel closeLabel`, `
|
|
77
|
+
`DialogContent closeLabel`, `DialogFooter closeLabel` (the `showCloseButton` button's text), `SheetContent closeLabel`, `SidePanel closeLabel`, `AsidePanelToggle showLabel hideLabel`,
|
|
78
|
+
`AsidePanel widenLabel narrowLabel closeLabel`, `AsidePanelSidebarOpener label`, `Steps stateLabels`,
|
|
78
79
|
`Sidebar mobileTitle mobileDescription`, `SidebarTrigger label`, `SidebarRail label`, `Spinner aria-label`,
|
|
79
80
|
`CommandDialog title description` (`title` also names its search field), `Command label` (the search field's
|
|
80
81
|
name outside a `CommandDialog`; without it the field has none), `SortableList instructions announcements`, `SortableHandle label`.
|
|
@@ -131,7 +132,8 @@ sidebar, skeleton, sonner (`Toaster`), spinner, switch, table, tabs, textarea, t
|
|
|
131
132
|
word), `PageHeader` (breadcrumb, icon box, title, description, actions), `PropertyList` (fields of one record),
|
|
132
133
|
`DetailTable` (an item's details as a label and value table), `FoldRow` (a list row folding open to a `DetailTable`
|
|
133
134
|
and more, a native `<details>`), `PageFrame` (a page outside the app shell, the target of `sft-bridge.css`),
|
|
134
|
-
`SidePanel` (a non-modal panel at a side of a canvas, below), `
|
|
135
|
+
`SidePanel` (a non-modal panel at a side of a canvas, below), `AsidePanelProvider`, `AsidePanelToggle`,
|
|
136
|
+
`AsidePanel` and `AsidePanelSidebarOpener` (a panel slid in from the right of the app shell, beside the content, below), `SheetMenu`, `SheetMenuItem` and `SheetMenuButton`
|
|
135
137
|
(navigation rows in a side `Sheet`, a phone's drawer, below), `TabBar` (a screen's tabs as links with an optional icon
|
|
136
138
|
and count, the shown tab in the address; `Tabs` keeps it in client state), `MarkPopover` (a counted tag that opens a
|
|
137
139
|
list of what it counts, below), `FilterChip` and `FilterChipAdd` (a list's filter pills, below), `Steps` (numbered
|
|
@@ -225,6 +227,49 @@ Escape inside or the close button calls `onClose`, and the caller moves focus ba
|
|
|
225
227
|
</div>
|
|
226
228
|
```
|
|
227
229
|
|
|
230
|
+
**`AsidePanel`.** A column of the app shell that slides in from the right, beside `SidebarInset`: the content
|
|
231
|
+
narrows next to it and stays usable (`SidePanel` is a panel over a canvas instead). `AsidePanelProvider` replaces
|
|
232
|
+
`SidebarProvider` (every other prop passes through) and keeps one side panel open at a time: while the panel is open
|
|
233
|
+
on a wide screen the left `Sidebar` (offcanvas) is folded, and opening the sidebar any way (its trigger, Ctrl+B,
|
|
234
|
+
`AsidePanelSidebarOpener`) closes the panel; closing the panel brings the sidebar back unless the user folded it.
|
|
235
|
+
|
|
236
|
+
- `AsidePanelToggle`: one icon button fixed at the top-right edge, in the same place open or closed, with
|
|
237
|
+
`aria-expanded`, `aria-controls` and a label that switches between show and hide; `outline` while closed,
|
|
238
|
+
`secondary` while open. Opening from it moves focus to the panel's heading (`tabIndex=-1`). `icon` (a
|
|
239
|
+
`LucideIcon`) replaces the panel icons in both states, for a panel that holds one tool its users know by its icon.
|
|
240
|
+
The toggle, the width switch and the sidebar opener show their label as a hover hint (`title`) too.
|
|
241
|
+
- `AsidePanel title`: an `aside` (`sticky top-0 h-dvh`, `border-l`) with a header holding the heading and a ghost
|
|
242
|
+
width switch: `standard` (two fifths) or `half` (the shell split half and half). Escape closes it and returns focus
|
|
243
|
+
to the toggle unless a dialog, menu, listbox or popover is open (`isOverlayOpen(document)`: Radix
|
|
244
|
+
`data-state="open"`, `:popover-open` or `dialog[open]`; a closed popover left in the page does not count).
|
|
245
|
+
Below `MOBILE_BREAKPOINT` it is a right `Sheet`, opened for that page only: the kept state never opens it there;
|
|
246
|
+
`description` adds one line under the sheet's title (its `aria-describedby`). The `aside` carries `max-md:hidden`,
|
|
247
|
+
so a phone served the wide-screen HTML (the server cannot tell the width) never paints it before hydration.
|
|
248
|
+
Its children render only while it is open, so pass a lazily loaded body (`next/dynamic` with `ssr: false`) and
|
|
249
|
+
screens that never open it never load its code.
|
|
250
|
+
- `AsidePanelSidebarOpener`: an icon button fixed at the top-left edge, shown only while the sidebar is folded on a
|
|
251
|
+
wide screen; it brings the sidebar back and closes the panel.
|
|
252
|
+
- Kept state: `initialState` (`{ isOpen, width }`) and `save(state)`, called after each change on a wide screen; keep
|
|
253
|
+
it per signed-in user (the app's database), so the panel opens the same way across screens, reloads and devices. A
|
|
254
|
+
failed save keeps the choice on the page and reaches `onSaveError`. `isHidden` marks a screen that offers no panel:
|
|
255
|
+
no toggle, no panel, and the sidebar stays open whatever the kept state says. `useAsidePanel()` reads the state.
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
const MapPanel = dynamic(() => import("./map-panel"), { ssr: false });
|
|
259
|
+
|
|
260
|
+
<AsidePanelProvider initialState={panelState} save={savePanelState} isHidden={!offersMap}>
|
|
261
|
+
<AppSidebar />
|
|
262
|
+
<SidebarInset>
|
|
263
|
+
<AsidePanelSidebarOpener />
|
|
264
|
+
<AsidePanelToggle icon={MapIcon} />
|
|
265
|
+
{children}
|
|
266
|
+
</SidebarInset>
|
|
267
|
+
<AsidePanel title="Map">
|
|
268
|
+
<MapPanel />
|
|
269
|
+
</AsidePanel>
|
|
270
|
+
</AsidePanelProvider>
|
|
271
|
+
```
|
|
272
|
+
|
|
228
273
|
**`SheetMenu`.** A phone's navigation drawer: a `Sheet` from the right with a heading and a ghost close button,
|
|
229
274
|
navigation rows at the top and one row at the foot, the way a desktop `Sidebar` ends with its foot menu.
|
|
230
275
|
`SheetMenu` (`ul`), `SheetMenuItem` (`li`) and `SheetMenuButton` (the row) mirror `SidebarMenu`, `SidebarMenuItem`
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export { tabsListVariants } from "./ui/tabs-variants.js";
|
|
|
41
41
|
export * from "./ui/textarea.js";
|
|
42
42
|
export * from "./ui/tooltip.js";
|
|
43
43
|
export { ICON_STROKE_WIDTH } from "./notion/icon-stroke.js";
|
|
44
|
+
export { AsidePanel, AsidePanelProvider, AsidePanelSidebarOpener, AsidePanelToggle, useAsidePanel, type AsidePanelProps, type AsidePanelProviderProps, type AsidePanelSidebarOpenerProps, type AsidePanelState, type AsidePanelToggleProps, type AsidePanelWidth, } from "./notion/AsidePanel.js";
|
|
45
|
+
export { isOverlayOpen } from "./notion/overlay-open.js";
|
|
44
46
|
export { Code, CodeBlock, type CodeBlockProps } from "./notion/Code.js";
|
|
45
47
|
export { DetailTable, type DetailRow, type DetailTableProps } from "./notion/DetailTable.js";
|
|
46
48
|
export { FilterChip, FilterChipAdd, type FilterChipAddProps, type FilterChipProps } from "./notion/FilterChip.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;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MA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AAM,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,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,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
|
@@ -43,6 +43,8 @@ export { tabsListVariants } from "./ui/tabs-variants.js";
|
|
|
43
43
|
export * from "./ui/textarea.js";
|
|
44
44
|
export * from "./ui/tooltip.js";
|
|
45
45
|
export { ICON_STROKE_WIDTH } from "./notion/icon-stroke.js";
|
|
46
|
+
export { AsidePanel, AsidePanelProvider, AsidePanelSidebarOpener, AsidePanelToggle, useAsidePanel, } from "./notion/AsidePanel.js";
|
|
47
|
+
export { isOverlayOpen } from "./notion/overlay-open.js";
|
|
46
48
|
export { Code, CodeBlock } from "./notion/Code.js";
|
|
47
49
|
export { DetailTable } from "./notion/DetailTable.js";
|
|
48
50
|
export { FilterChip, FilterChipAdd } from "./notion/FilterChip.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,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB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AmB,CAAC"}
|
package/dist/messages/en.d.ts
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* replace it with the app's own wording from its message layer.
|
|
4
4
|
*/
|
|
5
5
|
export declare const en: {
|
|
6
|
+
readonly asidePanel: {
|
|
7
|
+
readonly show: "Show the panel";
|
|
8
|
+
readonly hide: "Hide the panel";
|
|
9
|
+
readonly widen: "Widen the panel";
|
|
10
|
+
readonly narrow: "Narrow the panel";
|
|
11
|
+
readonly showSidebar: "Show the menu and hide the panel";
|
|
12
|
+
};
|
|
6
13
|
readonly breadcrumb: {
|
|
7
14
|
readonly label: "breadcrumb";
|
|
8
15
|
readonly more: "More";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CL,CAAC"}
|
package/dist/messages/en.js
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* replace it with the app's own wording from its message layer.
|
|
4
4
|
*/
|
|
5
5
|
export const en = {
|
|
6
|
+
asidePanel: {
|
|
7
|
+
show: "Show the panel",
|
|
8
|
+
hide: "Hide the panel",
|
|
9
|
+
widen: "Widen the panel",
|
|
10
|
+
narrow: "Narrow the panel",
|
|
11
|
+
showSidebar: "Show the menu and hide the panel",
|
|
12
|
+
},
|
|
6
13
|
breadcrumb: { label: "breadcrumb", more: "More" },
|
|
7
14
|
dialog: { close: "Close" },
|
|
8
15
|
filterChip: { add: "Add filter" },
|
package/dist/messages/en.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.js","sour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C5B,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;KACjB;IACD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;IAC5E,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,gCAAgC,EAAE;CAC5E,CAAC"}
|
package/dist/messages/index.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ import { en } from "./en.js";
|
|
|
2
2
|
/** The built-in English dictionary; replace a text through the component's prop (README, "Copy"). */
|
|
3
3
|
export declare const notionMessages: {
|
|
4
4
|
en: {
|
|
5
|
+
readonly asidePanel: {
|
|
6
|
+
readonly show: "Show the panel";
|
|
7
|
+
readonly hide: "Hide the panel";
|
|
8
|
+
readonly widen: "Widen the panel";
|
|
9
|
+
readonly narrow: "Narrow the panel";
|
|
10
|
+
readonly showSidebar: "Show the menu and hide the panel";
|
|
11
|
+
};
|
|
5
12
|
readonly breadcrumb: {
|
|
6
13
|
readonly label: "breadcrumb";
|
|
7
14
|
readonly more: "More";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,qGAAqG;AACrG,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,qGAAqG;AACrG,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
import { type ComponentProps, type ReactNode, type RefObject } from "react";
|
|
3
|
+
import { SidebarProvider } from "../ui/sidebar.js";
|
|
4
|
+
export type AsidePanelWidth = "standard" | "half";
|
|
5
|
+
export interface AsidePanelState {
|
|
6
|
+
readonly isOpen: boolean;
|
|
7
|
+
readonly width: AsidePanelWidth;
|
|
8
|
+
}
|
|
9
|
+
export type AsidePanelProviderProps = Omit<ComponentProps<typeof SidebarProvider>, "open" | "onOpenChange" | "hidden"> & {
|
|
10
|
+
readonly initialState: AsidePanelState;
|
|
11
|
+
readonly save?: (state: AsidePanelState) => void | Promise<void>;
|
|
12
|
+
readonly onSaveError?: (error: unknown) => void;
|
|
13
|
+
readonly isHidden?: boolean;
|
|
14
|
+
readonly panelId?: string;
|
|
15
|
+
};
|
|
16
|
+
interface AsidePanelContextValue {
|
|
17
|
+
readonly panelId: string;
|
|
18
|
+
readonly isOpen: boolean;
|
|
19
|
+
readonly width: AsidePanelWidth;
|
|
20
|
+
readonly isMobile: boolean;
|
|
21
|
+
readonly isHidden: boolean;
|
|
22
|
+
readonly isSidebarFolded: boolean;
|
|
23
|
+
readonly toggleRef: RefObject<HTMLButtonElement | null>;
|
|
24
|
+
readonly isHeadingFocusRequested: RefObject<boolean>;
|
|
25
|
+
readonly toggle: () => void;
|
|
26
|
+
readonly close: () => void;
|
|
27
|
+
readonly setWidth: (width: AsidePanelWidth) => void;
|
|
28
|
+
readonly openSidebar: () => void;
|
|
29
|
+
}
|
|
30
|
+
/** The panel's state and actions, for an app that builds its own toggle or reads whether the panel is open. */
|
|
31
|
+
export declare function useAsidePanel(): Pick<AsidePanelContextValue, "panelId" | "isOpen" | "width" | "isMobile" | "isHidden" | "isSidebarFolded" | "toggle" | "close" | "setWidth" | "openSidebar">;
|
|
32
|
+
/**
|
|
33
|
+
* The app shell's provider: renders `SidebarProvider` and keeps one side panel open at a time. While the right panel
|
|
34
|
+
* is open on a wide screen, the left sidebar is folded (offcanvas); opening the sidebar any way closes the panel.
|
|
35
|
+
* Use it in place of `SidebarProvider`; every other `SidebarProvider` prop passes through.
|
|
36
|
+
*/
|
|
37
|
+
export declare function AsidePanelProvider({ initialState, save, onSaveError, isHidden, panelId, defaultOpen, children, ...props }: AsidePanelProviderProps): import("react").JSX.Element;
|
|
38
|
+
export interface AsidePanelToggleProps {
|
|
39
|
+
readonly showLabel?: string;
|
|
40
|
+
readonly hideLabel?: string;
|
|
41
|
+
readonly icon?: LucideIcon;
|
|
42
|
+
readonly className?: string;
|
|
43
|
+
}
|
|
44
|
+
/** The icon button at the top-right edge that shows and hides the panel; it stays in place either way. */
|
|
45
|
+
export declare function AsidePanelToggle({ showLabel, hideLabel, icon, className }: AsidePanelToggleProps): import("react").JSX.Element | null;
|
|
46
|
+
export interface AsidePanelSidebarOpenerProps {
|
|
47
|
+
readonly label?: string;
|
|
48
|
+
readonly className?: string;
|
|
49
|
+
}
|
|
50
|
+
/** The icon button at the top-left edge, shown only while the sidebar is folded: brings it back, closes the panel. */
|
|
51
|
+
export declare function AsidePanelSidebarOpener({ label, className }: AsidePanelSidebarOpenerProps): import("react").JSX.Element | null;
|
|
52
|
+
export interface AsidePanelProps {
|
|
53
|
+
readonly title: string;
|
|
54
|
+
readonly children: ReactNode;
|
|
55
|
+
readonly widenLabel?: string;
|
|
56
|
+
readonly narrowLabel?: string;
|
|
57
|
+
readonly closeLabel?: string;
|
|
58
|
+
readonly description?: string;
|
|
59
|
+
readonly className?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The panel: an `aside` beside the shell's content on a wide screen (the content narrows next to it), a right `Sheet`
|
|
63
|
+
* on a phone. Place it after `SidebarInset` inside `AsidePanelProvider`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function AsidePanel({ title, children, widenLabel, narrowLabel, closeLabel, description, className, }: AsidePanelProps): import("react").JSX.Element | null;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=AsidePanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsidePanel.d.ts","sourceRoot":"","sources":["../../src/notion/AsidePanel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA2E,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACxH,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMnD,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,CAAC;AAGlD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;CACjC;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,QAAQ,CAAC,GAAG;IAEvH,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IAEvC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAEhD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAE5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CA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,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,sHAAsH;AACtH,wBAAgB,uBAAuB,CAAC,EAAE,KAAuC,EAAE,SAAS,EAAE,EAAE,4BAA4B,sCAkB3H;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAGvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,UAAsC,EACtC,WAAwC,EACxC,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,eAAe,sCA2FjB"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useIsMobile } from "@softure-ai/theme-kit/react";
|
|
4
|
+
import { ChevronsLeft, ChevronsRight, PanelLeft, PanelRightClose, PanelRightOpen } from "lucide-react";
|
|
5
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
import { en as messages } from "../messages/en.js";
|
|
8
|
+
import { Button } from "../ui/button.js";
|
|
9
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "../ui/sheet.js";
|
|
10
|
+
import { SidebarProvider } from "../ui/sidebar.js";
|
|
11
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
12
|
+
import { isOverlayOpen } from "./overlay-open.js";
|
|
13
|
+
const AsidePanelContext = createContext(null);
|
|
14
|
+
/** The panel's state and actions, for an app that builds its own toggle or reads whether the panel is open. */
|
|
15
|
+
export function useAsidePanel() {
|
|
16
|
+
const context = useContext(AsidePanelContext);
|
|
17
|
+
if (context === null)
|
|
18
|
+
throw new Error("useAsidePanel must be used within an AsidePanelProvider.");
|
|
19
|
+
return context;
|
|
20
|
+
}
|
|
21
|
+
function useAsidePanelContext(component) {
|
|
22
|
+
const context = useContext(AsidePanelContext);
|
|
23
|
+
if (context === null)
|
|
24
|
+
throw new Error(`${component} must be used within an AsidePanelProvider.`);
|
|
25
|
+
return context;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The app shell's provider: renders `SidebarProvider` and keeps one side panel open at a time. While the right panel
|
|
29
|
+
* is open on a wide screen, the left sidebar is folded (offcanvas); opening the sidebar any way closes the panel.
|
|
30
|
+
* Use it in place of `SidebarProvider`; every other `SidebarProvider` prop passes through.
|
|
31
|
+
*/
|
|
32
|
+
export function AsidePanelProvider({ initialState, save, onSaveError, isHidden = false, panelId = "aside-panel", defaultOpen = true, children, ...props }) {
|
|
33
|
+
const isMobile = useIsMobile();
|
|
34
|
+
const [kept, setKept] = useState(initialState);
|
|
35
|
+
const [isMobileOpen, setMobileOpen] = useState(false);
|
|
36
|
+
const [isSidebarOpen, setSidebarOpen] = useState(defaultOpen);
|
|
37
|
+
const toggleRef = useRef(null);
|
|
38
|
+
const isHeadingFocusRequested = useRef(false);
|
|
39
|
+
const isOpen = isHidden ? false : isMobile ? isMobileOpen : kept.isOpen;
|
|
40
|
+
const isSidebarShown = isSidebarOpen && !(kept.isOpen && !isMobile && !isHidden);
|
|
41
|
+
const keep = useCallback((next) => {
|
|
42
|
+
setKept(next);
|
|
43
|
+
if (save === undefined)
|
|
44
|
+
return;
|
|
45
|
+
// The choice stays on the page when the save fails; the app hears about it through `onSaveError`.
|
|
46
|
+
Promise.resolve()
|
|
47
|
+
.then(() => save(next))
|
|
48
|
+
.catch((error) => onSaveError?.(error));
|
|
49
|
+
}, [save, onSaveError]);
|
|
50
|
+
const setPanelOpen = useCallback((next) => {
|
|
51
|
+
if (isMobile)
|
|
52
|
+
setMobileOpen(next);
|
|
53
|
+
else if (next !== kept.isOpen)
|
|
54
|
+
keep({ ...kept, isOpen: next });
|
|
55
|
+
}, [isMobile, kept, keep]);
|
|
56
|
+
const toggle = useCallback(() => {
|
|
57
|
+
if (!isOpen)
|
|
58
|
+
isHeadingFocusRequested.current = true;
|
|
59
|
+
setPanelOpen(!isOpen);
|
|
60
|
+
}, [isOpen, setPanelOpen]);
|
|
61
|
+
const close = useCallback(() => setPanelOpen(false), [setPanelOpen]);
|
|
62
|
+
const setWidth = useCallback((width) => {
|
|
63
|
+
if (width !== kept.width)
|
|
64
|
+
keep({ ...kept, width });
|
|
65
|
+
}, [kept, keep]);
|
|
66
|
+
const openSidebar = useCallback(() => {
|
|
67
|
+
setSidebarOpen(true);
|
|
68
|
+
if (kept.isOpen && !isMobile)
|
|
69
|
+
keep({ ...kept, isOpen: false });
|
|
70
|
+
}, [isMobile, kept, keep]);
|
|
71
|
+
const changeSidebar = useCallback((next) => {
|
|
72
|
+
if (next)
|
|
73
|
+
openSidebar();
|
|
74
|
+
else
|
|
75
|
+
setSidebarOpen(false);
|
|
76
|
+
}, [openSidebar]);
|
|
77
|
+
const value = useMemo(() => ({
|
|
78
|
+
panelId,
|
|
79
|
+
isOpen,
|
|
80
|
+
width: kept.width,
|
|
81
|
+
isMobile,
|
|
82
|
+
isHidden,
|
|
83
|
+
isSidebarFolded: !isSidebarShown,
|
|
84
|
+
toggleRef,
|
|
85
|
+
isHeadingFocusRequested,
|
|
86
|
+
toggle,
|
|
87
|
+
close,
|
|
88
|
+
setWidth,
|
|
89
|
+
openSidebar,
|
|
90
|
+
}), [panelId, isOpen, kept.width, isMobile, isHidden, isSidebarShown, toggle, close, setWidth, openSidebar]);
|
|
91
|
+
return (_jsx(AsidePanelContext.Provider, { value: value, children: _jsx(SidebarProvider, { open: isSidebarShown, onOpenChange: changeSidebar, ...props, children: children }) }));
|
|
92
|
+
}
|
|
93
|
+
/** The icon button at the top-right edge that shows and hides the panel; it stays in place either way. */
|
|
94
|
+
export function AsidePanelToggle({ showLabel = messages.asidePanel.show, hideLabel = messages.asidePanel.hide, icon, className }) {
|
|
95
|
+
const { panelId, isOpen, isHidden, toggleRef, toggle } = useAsidePanelContext("AsidePanelToggle");
|
|
96
|
+
if (isHidden)
|
|
97
|
+
return null;
|
|
98
|
+
const Icon = icon ?? (isOpen ? PanelRightClose : PanelRightOpen);
|
|
99
|
+
const label = isOpen ? hideLabel : showLabel;
|
|
100
|
+
return (_jsx(Button, { ref: toggleRef, type: "button", "data-slot": "aside-panel-toggle", variant: isOpen ? "secondary" : "outline", size: "icon", "aria-expanded": isOpen, "aria-controls": panelId, "aria-label": label, title: label, className: cn("fixed top-[calc(--spacing(2)+env(safe-area-inset-top))] right-[calc(--spacing(2)+env(safe-area-inset-right))] z-20", className), onClick: toggle, children: _jsx(Icon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) }));
|
|
101
|
+
}
|
|
102
|
+
/** The icon button at the top-left edge, shown only while the sidebar is folded: brings it back, closes the panel. */
|
|
103
|
+
export function AsidePanelSidebarOpener({ label = messages.asidePanel.showSidebar, className }) {
|
|
104
|
+
const { isMobile, isSidebarFolded, openSidebar } = useAsidePanelContext("AsidePanelSidebarOpener");
|
|
105
|
+
if (isMobile || !isSidebarFolded)
|
|
106
|
+
return null;
|
|
107
|
+
return (_jsx(Button, { type: "button", "data-slot": "aside-panel-sidebar-opener", variant: "outline", size: "icon", "aria-label": label, title: label, className: cn("fixed top-[calc(--spacing(2)+env(safe-area-inset-top))] left-[calc(--spacing(2)+env(safe-area-inset-left))] z-20", className), onClick: openSidebar, children: _jsx(PanelLeft, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) }));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The panel: an `aside` beside the shell's content on a wide screen (the content narrows next to it), a right `Sheet`
|
|
111
|
+
* on a phone. Place it after `SidebarInset` inside `AsidePanelProvider`.
|
|
112
|
+
*/
|
|
113
|
+
export function AsidePanel({ title, children, widenLabel = messages.asidePanel.widen, narrowLabel = messages.asidePanel.narrow, closeLabel, description, className, }) {
|
|
114
|
+
const { panelId, isOpen, width, isMobile, isHidden, toggleRef, isHeadingFocusRequested, close, setWidth } = useAsidePanelContext("AsidePanel");
|
|
115
|
+
const headingRef = useRef(null);
|
|
116
|
+
const headingId = `${panelId}-heading`;
|
|
117
|
+
const isDesktopOpen = isOpen && !isMobile && !isHidden;
|
|
118
|
+
// Opening from the toggle moves focus to the heading; a panel kept open on load leaves focus alone.
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (!isDesktopOpen || !isHeadingFocusRequested.current)
|
|
121
|
+
return;
|
|
122
|
+
isHeadingFocusRequested.current = false;
|
|
123
|
+
headingRef.current?.focus();
|
|
124
|
+
}, [isDesktopOpen, isHeadingFocusRequested]);
|
|
125
|
+
// Escape closes the panel and returns focus to the toggle, unless an open overlay takes the key first.
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (!isDesktopOpen)
|
|
128
|
+
return;
|
|
129
|
+
const closeOnEscape = (event) => {
|
|
130
|
+
if (event.key !== "Escape" || event.defaultPrevented || isOverlayOpen(document))
|
|
131
|
+
return;
|
|
132
|
+
close();
|
|
133
|
+
toggleRef.current?.focus();
|
|
134
|
+
};
|
|
135
|
+
document.addEventListener("keydown", closeOnEscape);
|
|
136
|
+
return () => document.removeEventListener("keydown", closeOnEscape);
|
|
137
|
+
}, [isDesktopOpen, close, toggleRef]);
|
|
138
|
+
if (isHidden)
|
|
139
|
+
return null;
|
|
140
|
+
if (isMobile) {
|
|
141
|
+
return (_jsx(Sheet, { open: isOpen, onOpenChange: (next) => !next && close(), children: _jsxs(SheetContent, { id: panelId, side: "right", "data-slot": "aside-panel-sheet", ...(description === undefined ? { "aria-describedby": undefined } : {}), closeLabel: closeLabel, className: cn("w-full gap-0 sm:max-w-none", className), onOpenAutoFocus: (event) => {
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
headingRef.current?.focus();
|
|
144
|
+
}, onCloseAutoFocus: (event) => {
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
toggleRef.current?.focus();
|
|
147
|
+
}, children: [_jsxs(SheetHeader, { className: "border-b border-border", children: [_jsx(SheetTitle, { ref: headingRef, tabIndex: -1, className: "outline-none", children: title }), description === undefined ? null : _jsx(SheetDescription, { children: description })] }), _jsx("div", { "data-slot": "aside-panel-content", className: "min-h-0 flex-1 overflow-y-auto", children: isOpen ? children : null })] }) }));
|
|
148
|
+
}
|
|
149
|
+
if (!isOpen)
|
|
150
|
+
return null;
|
|
151
|
+
const isHalf = width === "half";
|
|
152
|
+
const WidthIcon = isHalf ? ChevronsRight : ChevronsLeft;
|
|
153
|
+
const widthLabel = isHalf ? narrowLabel : widenLabel;
|
|
154
|
+
// A phone gets this branch in the server HTML (`useIsMobile` is false there) until hydration swaps in the sheet:
|
|
155
|
+
// `max-md:hidden` keeps it from painting. The `md` breakpoint equals the theme's mobile breakpoint.
|
|
156
|
+
return (_jsxs("aside", { id: panelId, "data-slot": "aside-panel", "data-width": width, "aria-labelledby": headingId, className: cn("sticky top-0 flex h-dvh max-md:hidden w-2/5 shrink-0 flex-col border-l border-border bg-background text-foreground data-[width=half]:w-1/2", className), children: [_jsxs("div", { "data-slot": "aside-panel-header", className: "flex h-11 shrink-0 items-center gap-2 border-b border-border pr-12 pl-4", children: [_jsx("h2", { ref: headingRef, id: headingId, tabIndex: -1, className: "min-w-0 flex-1 truncate text-heading-3 outline-none", children: title }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": widthLabel, title: widthLabel, onClick: () => setWidth(isHalf ? "standard" : "half"), children: _jsx(WidthIcon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) })] }), _jsx("div", { "data-slot": "aside-panel-content", className: "min-h-0 flex-1 overflow-y-auto", children: children })] }));
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=AsidePanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsidePanel.js","sourceRoot":"","sources":["../../src/notion/AsidePanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAC;AACxH,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAuClD,MAAM,iBAAiB,GAAG,aAAa,CAAgC,IAAI,CAAC,CAAC;AAE7E,+GAA+G;AAC/G,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC9C,IAAI,OAAO,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAClG,OAAO,OAAO,CAAC;AACjB,CAAC;A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dialog, menu, listbox or popover is open under `root`: one with Radix `data-state="open"`, one that
|
|
3
|
+
* matches `:popover-open`, or a `dialog[open]`. A closed popover that stays in the page with `role="dialog"` does
|
|
4
|
+
* not count. A keyboard handler reads it before acting on Escape, so the overlay closes first.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isOverlayOpen(root: ParentNode): boolean;
|
|
7
|
+
//# sourceMappingURL=overlay-open.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-open.d.ts","sourceRoot":"","sources":["../../src/notion/overlay-open.ts"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEvD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Kept out of the "use client" AsidePanel module so a Server Component or a plain script can call it too.
|
|
2
|
+
// Overlays that handle Escape themselves: a Radix dialog, menu, listbox or popover while it is open, a native modal.
|
|
3
|
+
const OPEN_OVERLAY_SELECTORS = [
|
|
4
|
+
'[role="dialog"][data-state="open"]',
|
|
5
|
+
'[role="alertdialog"][data-state="open"]',
|
|
6
|
+
'[role="menu"][data-state="open"]',
|
|
7
|
+
'[role="listbox"][data-state="open"]',
|
|
8
|
+
"dialog[open]",
|
|
9
|
+
":popover-open",
|
|
10
|
+
];
|
|
11
|
+
function hasMatch(root, selector) {
|
|
12
|
+
try {
|
|
13
|
+
return root.querySelector(selector) !== null;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// A DOM that does not know the selector (`:popover-open` in an older engine) has no such overlay open.
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Whether a dialog, menu, listbox or popover is open under `root`: one with Radix `data-state="open"`, one that
|
|
22
|
+
* matches `:popover-open`, or a `dialog[open]`. A closed popover that stays in the page with `role="dialog"` does
|
|
23
|
+
* not count. A keyboard handler reads it before acting on Escape, so the overlay closes first.
|
|
24
|
+
*/
|
|
25
|
+
export function isOverlayOpen(root) {
|
|
26
|
+
return OPEN_OVERLAY_SELECTORS.some((selector) => hasMatch(root, selector));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=overlay-open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-open.js","sourceRoot":"","sources":["../../src/notion/overlay-open.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,qHAAqH;AACrH,MAAM,sBAAsB,GAAG;IAC7B,oCAAoC;IACpC,yCAAyC;IACzC,kCAAkC;IAClC,qCAAqC;IACrC,cAAc;IACd,eAAe;CACP,CAAC;AAEX,SAAS,QAAQ,CAAC,IAAgB,EAAE,QAAgB;IAClD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,uGAAuG;QACvG,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,IAAgB;IAC5C,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC7E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softure-ai/theme-notion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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
|
@@ -45,6 +45,20 @@ export * from "./ui/textarea.js";
|
|
|
45
45
|
export * from "./ui/tooltip.js";
|
|
46
46
|
|
|
47
47
|
export { ICON_STROKE_WIDTH } from "./notion/icon-stroke.js";
|
|
48
|
+
export {
|
|
49
|
+
AsidePanel,
|
|
50
|
+
AsidePanelProvider,
|
|
51
|
+
AsidePanelSidebarOpener,
|
|
52
|
+
AsidePanelToggle,
|
|
53
|
+
useAsidePanel,
|
|
54
|
+
type AsidePanelProps,
|
|
55
|
+
type AsidePanelProviderProps,
|
|
56
|
+
type AsidePanelSidebarOpenerProps,
|
|
57
|
+
type AsidePanelState,
|
|
58
|
+
type AsidePanelToggleProps,
|
|
59
|
+
type AsidePanelWidth,
|
|
60
|
+
} from "./notion/AsidePanel.js";
|
|
61
|
+
export { isOverlayOpen } from "./notion/overlay-open.js";
|
|
48
62
|
export { Code, CodeBlock, type CodeBlockProps } from "./notion/Code.js";
|
|
49
63
|
export { DetailTable, type DetailRow, type DetailTableProps } from "./notion/DetailTable.js";
|
|
50
64
|
export { FilterChip, FilterChipAdd, type FilterChipAddProps, type FilterChipProps } from "./notion/FilterChip.js";
|
package/src/messages/en.ts
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* replace it with the app's own wording from its message layer.
|
|
4
4
|
*/
|
|
5
5
|
export const en = {
|
|
6
|
+
asidePanel: {
|
|
7
|
+
show: "Show the panel",
|
|
8
|
+
hide: "Hide the panel",
|
|
9
|
+
widen: "Widen the panel",
|
|
10
|
+
narrow: "Narrow the panel",
|
|
11
|
+
showSidebar: "Show the menu and hide the panel",
|
|
12
|
+
},
|
|
6
13
|
breadcrumb: { label: "breadcrumb", more: "More" },
|
|
7
14
|
dialog: { close: "Close" },
|
|
8
15
|
filterChip: { add: "Add filter" },
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useIsMobile } from "@softure-ai/theme-kit/react";
|
|
4
|
+
import { ChevronsLeft, ChevronsRight, PanelLeft, PanelRightClose, PanelRightOpen, type LucideIcon } from "lucide-react";
|
|
5
|
+
import {
|
|
6
|
+
createContext,
|
|
7
|
+
useCallback,
|
|
8
|
+
useContext,
|
|
9
|
+
useEffect,
|
|
10
|
+
useMemo,
|
|
11
|
+
useRef,
|
|
12
|
+
useState,
|
|
13
|
+
type ComponentProps,
|
|
14
|
+
type ReactNode,
|
|
15
|
+
type RefObject,
|
|
16
|
+
} from "react";
|
|
17
|
+
|
|
18
|
+
import { cn } from "../lib/utils.js";
|
|
19
|
+
import { en as messages } from "../messages/en.js";
|
|
20
|
+
import { Button } from "../ui/button.js";
|
|
21
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "../ui/sheet.js";
|
|
22
|
+
import { SidebarProvider } from "../ui/sidebar.js";
|
|
23
|
+
|
|
24
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
25
|
+
import { isOverlayOpen } from "./overlay-open.js";
|
|
26
|
+
|
|
27
|
+
// `standard` takes two fifths of the shell, `half` splits the shell half and half between the content and the panel.
|
|
28
|
+
export type AsidePanelWidth = "standard" | "half";
|
|
29
|
+
|
|
30
|
+
// What the app keeps per signed-in user, so the panel opens the same way across screens, reloads and devices.
|
|
31
|
+
export interface AsidePanelState {
|
|
32
|
+
readonly isOpen: boolean;
|
|
33
|
+
readonly width: AsidePanelWidth;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type AsidePanelProviderProps = Omit<ComponentProps<typeof SidebarProvider>, "open" | "onOpenChange" | "hidden"> & {
|
|
37
|
+
// The kept state the panel starts from on a wide screen; a phone always starts closed.
|
|
38
|
+
readonly initialState: AsidePanelState;
|
|
39
|
+
// Called with the new state after each change on a wide screen; a failed save keeps the choice on the page.
|
|
40
|
+
readonly save?: (state: AsidePanelState) => void | Promise<void>;
|
|
41
|
+
// Receives a failed save (a rejected promise or a thrown error).
|
|
42
|
+
readonly onSaveError?: (error: unknown) => void;
|
|
43
|
+
// A screen that offers no panel: no toggle, no panel, and the sidebar stays open whatever the kept state says.
|
|
44
|
+
readonly isHidden?: boolean;
|
|
45
|
+
// The panel's `id`, which the toggle points at with `aria-controls`.
|
|
46
|
+
readonly panelId?: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
interface AsidePanelContextValue {
|
|
50
|
+
readonly panelId: string;
|
|
51
|
+
readonly isOpen: boolean;
|
|
52
|
+
readonly width: AsidePanelWidth;
|
|
53
|
+
readonly isMobile: boolean;
|
|
54
|
+
readonly isHidden: boolean;
|
|
55
|
+
readonly isSidebarFolded: boolean;
|
|
56
|
+
readonly toggleRef: RefObject<HTMLButtonElement | null>;
|
|
57
|
+
readonly isHeadingFocusRequested: RefObject<boolean>;
|
|
58
|
+
readonly toggle: () => void;
|
|
59
|
+
readonly close: () => void;
|
|
60
|
+
readonly setWidth: (width: AsidePanelWidth) => void;
|
|
61
|
+
readonly openSidebar: () => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const AsidePanelContext = createContext<AsidePanelContextValue | null>(null);
|
|
65
|
+
|
|
66
|
+
/** The panel's state and actions, for an app that builds its own toggle or reads whether the panel is open. */
|
|
67
|
+
export function useAsidePanel(): Pick<AsidePanelContextValue, "panelId" | "isOpen" | "width" | "isMobile" | "isHidden" | "isSidebarFolded" | "toggle" | "close" | "setWidth" | "openSidebar"> {
|
|
68
|
+
const context = useContext(AsidePanelContext);
|
|
69
|
+
if (context === null) throw new Error("useAsidePanel must be used within an AsidePanelProvider.");
|
|
70
|
+
return context;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function useAsidePanelContext(component: string): AsidePanelContextValue {
|
|
74
|
+
const context = useContext(AsidePanelContext);
|
|
75
|
+
if (context === null) throw new Error(`${component} must be used within an AsidePanelProvider.`);
|
|
76
|
+
return context;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The app shell's provider: renders `SidebarProvider` and keeps one side panel open at a time. While the right panel
|
|
81
|
+
* is open on a wide screen, the left sidebar is folded (offcanvas); opening the sidebar any way closes the panel.
|
|
82
|
+
* Use it in place of `SidebarProvider`; every other `SidebarProvider` prop passes through.
|
|
83
|
+
*/
|
|
84
|
+
export function AsidePanelProvider({
|
|
85
|
+
initialState,
|
|
86
|
+
save,
|
|
87
|
+
onSaveError,
|
|
88
|
+
isHidden = false,
|
|
89
|
+
panelId = "aside-panel",
|
|
90
|
+
defaultOpen = true,
|
|
91
|
+
children,
|
|
92
|
+
...props
|
|
93
|
+
}: AsidePanelProviderProps) {
|
|
94
|
+
const isMobile = useIsMobile();
|
|
95
|
+
const [kept, setKept] = useState<AsidePanelState>(initialState);
|
|
96
|
+
const [isMobileOpen, setMobileOpen] = useState(false);
|
|
97
|
+
const [isSidebarOpen, setSidebarOpen] = useState(defaultOpen);
|
|
98
|
+
const toggleRef = useRef<HTMLButtonElement>(null);
|
|
99
|
+
const isHeadingFocusRequested = useRef(false);
|
|
100
|
+
|
|
101
|
+
const isOpen = isHidden ? false : isMobile ? isMobileOpen : kept.isOpen;
|
|
102
|
+
const isSidebarShown = isSidebarOpen && !(kept.isOpen && !isMobile && !isHidden);
|
|
103
|
+
|
|
104
|
+
const keep = useCallback(
|
|
105
|
+
(next: AsidePanelState) => {
|
|
106
|
+
setKept(next);
|
|
107
|
+
if (save === undefined) return;
|
|
108
|
+
// The choice stays on the page when the save fails; the app hears about it through `onSaveError`.
|
|
109
|
+
Promise.resolve()
|
|
110
|
+
.then(() => save(next))
|
|
111
|
+
.catch((error: unknown) => onSaveError?.(error));
|
|
112
|
+
},
|
|
113
|
+
[save, onSaveError],
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const setPanelOpen = useCallback(
|
|
117
|
+
(next: boolean) => {
|
|
118
|
+
if (isMobile) setMobileOpen(next);
|
|
119
|
+
else if (next !== kept.isOpen) keep({ ...kept, isOpen: next });
|
|
120
|
+
},
|
|
121
|
+
[isMobile, kept, keep],
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const toggle = useCallback(() => {
|
|
125
|
+
if (!isOpen) isHeadingFocusRequested.current = true;
|
|
126
|
+
setPanelOpen(!isOpen);
|
|
127
|
+
}, [isOpen, setPanelOpen]);
|
|
128
|
+
|
|
129
|
+
const close = useCallback(() => setPanelOpen(false), [setPanelOpen]);
|
|
130
|
+
|
|
131
|
+
const setWidth = useCallback(
|
|
132
|
+
(width: AsidePanelWidth) => {
|
|
133
|
+
if (width !== kept.width) keep({ ...kept, width });
|
|
134
|
+
},
|
|
135
|
+
[kept, keep],
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const openSidebar = useCallback(() => {
|
|
139
|
+
setSidebarOpen(true);
|
|
140
|
+
if (kept.isOpen && !isMobile) keep({ ...kept, isOpen: false });
|
|
141
|
+
}, [isMobile, kept, keep]);
|
|
142
|
+
|
|
143
|
+
const changeSidebar = useCallback(
|
|
144
|
+
(next: boolean) => {
|
|
145
|
+
if (next) openSidebar();
|
|
146
|
+
else setSidebarOpen(false);
|
|
147
|
+
},
|
|
148
|
+
[openSidebar],
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const value = useMemo<AsidePanelContextValue>(
|
|
152
|
+
() => ({
|
|
153
|
+
panelId,
|
|
154
|
+
isOpen,
|
|
155
|
+
width: kept.width,
|
|
156
|
+
isMobile,
|
|
157
|
+
isHidden,
|
|
158
|
+
isSidebarFolded: !isSidebarShown,
|
|
159
|
+
toggleRef,
|
|
160
|
+
isHeadingFocusRequested,
|
|
161
|
+
toggle,
|
|
162
|
+
close,
|
|
163
|
+
setWidth,
|
|
164
|
+
openSidebar,
|
|
165
|
+
}),
|
|
166
|
+
[panelId, isOpen, kept.width, isMobile, isHidden, isSidebarShown, toggle, close, setWidth, openSidebar],
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<AsidePanelContext.Provider value={value}>
|
|
171
|
+
<SidebarProvider open={isSidebarShown} onOpenChange={changeSidebar} {...props}>
|
|
172
|
+
{children}
|
|
173
|
+
</SidebarProvider>
|
|
174
|
+
</AsidePanelContext.Provider>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface AsidePanelToggleProps {
|
|
179
|
+
// The accessible names while closed and while open, from the app's message layer.
|
|
180
|
+
readonly showLabel?: string;
|
|
181
|
+
readonly hideLabel?: string;
|
|
182
|
+
// The icon drawn in both states, for a panel that holds one tool its users know by its icon (a map, a chat);
|
|
183
|
+
// `PanelRightOpen` and `PanelRightClose` otherwise.
|
|
184
|
+
readonly icon?: LucideIcon;
|
|
185
|
+
readonly className?: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** The icon button at the top-right edge that shows and hides the panel; it stays in place either way. */
|
|
189
|
+
export function AsidePanelToggle({ showLabel = messages.asidePanel.show, hideLabel = messages.asidePanel.hide, icon, className }: AsidePanelToggleProps) {
|
|
190
|
+
const { panelId, isOpen, isHidden, toggleRef, toggle } = useAsidePanelContext("AsidePanelToggle");
|
|
191
|
+
if (isHidden) return null;
|
|
192
|
+
const Icon = icon ?? (isOpen ? PanelRightClose : PanelRightOpen);
|
|
193
|
+
const label = isOpen ? hideLabel : showLabel;
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<Button
|
|
197
|
+
ref={toggleRef}
|
|
198
|
+
type="button"
|
|
199
|
+
data-slot="aside-panel-toggle"
|
|
200
|
+
variant={isOpen ? "secondary" : "outline"}
|
|
201
|
+
size="icon"
|
|
202
|
+
aria-expanded={isOpen}
|
|
203
|
+
aria-controls={panelId}
|
|
204
|
+
aria-label={label}
|
|
205
|
+
title={label}
|
|
206
|
+
className={cn("fixed top-[calc(--spacing(2)+env(safe-area-inset-top))] right-[calc(--spacing(2)+env(safe-area-inset-right))] z-20", className)}
|
|
207
|
+
onClick={toggle}
|
|
208
|
+
>
|
|
209
|
+
<Icon aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} />
|
|
210
|
+
</Button>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface AsidePanelSidebarOpenerProps {
|
|
215
|
+
// The accessible name ("show the menu and hide the panel"), from the app's message layer.
|
|
216
|
+
readonly label?: string;
|
|
217
|
+
readonly className?: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** The icon button at the top-left edge, shown only while the sidebar is folded: brings it back, closes the panel. */
|
|
221
|
+
export function AsidePanelSidebarOpener({ label = messages.asidePanel.showSidebar, className }: AsidePanelSidebarOpenerProps) {
|
|
222
|
+
const { isMobile, isSidebarFolded, openSidebar } = useAsidePanelContext("AsidePanelSidebarOpener");
|
|
223
|
+
if (isMobile || !isSidebarFolded) return null;
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<Button
|
|
227
|
+
type="button"
|
|
228
|
+
data-slot="aside-panel-sidebar-opener"
|
|
229
|
+
variant="outline"
|
|
230
|
+
size="icon"
|
|
231
|
+
aria-label={label}
|
|
232
|
+
title={label}
|
|
233
|
+
className={cn("fixed top-[calc(--spacing(2)+env(safe-area-inset-top))] left-[calc(--spacing(2)+env(safe-area-inset-left))] z-20", className)}
|
|
234
|
+
onClick={openSidebar}
|
|
235
|
+
>
|
|
236
|
+
<PanelLeft aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} />
|
|
237
|
+
</Button>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface AsidePanelProps {
|
|
242
|
+
readonly title: string;
|
|
243
|
+
// The panel's body, rendered only while the panel is open: pass a lazily loaded component (`next/dynamic` with
|
|
244
|
+
// `ssr: false`, or `React.lazy`), so screens that never open the panel never load its code.
|
|
245
|
+
readonly children: ReactNode;
|
|
246
|
+
// The width switch's accessible names, from the app's message layer.
|
|
247
|
+
readonly widenLabel?: string;
|
|
248
|
+
readonly narrowLabel?: string;
|
|
249
|
+
// The phone sheet's close button text.
|
|
250
|
+
readonly closeLabel?: string;
|
|
251
|
+
// One line under the phone sheet's title, which the sheet is described by.
|
|
252
|
+
readonly description?: string;
|
|
253
|
+
readonly className?: string;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* The panel: an `aside` beside the shell's content on a wide screen (the content narrows next to it), a right `Sheet`
|
|
258
|
+
* on a phone. Place it after `SidebarInset` inside `AsidePanelProvider`.
|
|
259
|
+
*/
|
|
260
|
+
export function AsidePanel({
|
|
261
|
+
title,
|
|
262
|
+
children,
|
|
263
|
+
widenLabel = messages.asidePanel.widen,
|
|
264
|
+
narrowLabel = messages.asidePanel.narrow,
|
|
265
|
+
closeLabel,
|
|
266
|
+
description,
|
|
267
|
+
className,
|
|
268
|
+
}: AsidePanelProps) {
|
|
269
|
+
const { panelId, isOpen, width, isMobile, isHidden, toggleRef, isHeadingFocusRequested, close, setWidth } = useAsidePanelContext("AsidePanel");
|
|
270
|
+
const headingRef = useRef<HTMLHeadingElement>(null);
|
|
271
|
+
const headingId = `${panelId}-heading`;
|
|
272
|
+
const isDesktopOpen = isOpen && !isMobile && !isHidden;
|
|
273
|
+
|
|
274
|
+
// Opening from the toggle moves focus to the heading; a panel kept open on load leaves focus alone.
|
|
275
|
+
useEffect(() => {
|
|
276
|
+
if (!isDesktopOpen || !isHeadingFocusRequested.current) return;
|
|
277
|
+
isHeadingFocusRequested.current = false;
|
|
278
|
+
headingRef.current?.focus();
|
|
279
|
+
}, [isDesktopOpen, isHeadingFocusRequested]);
|
|
280
|
+
|
|
281
|
+
// Escape closes the panel and returns focus to the toggle, unless an open overlay takes the key first.
|
|
282
|
+
useEffect(() => {
|
|
283
|
+
if (!isDesktopOpen) return;
|
|
284
|
+
const closeOnEscape = (event: KeyboardEvent) => {
|
|
285
|
+
if (event.key !== "Escape" || event.defaultPrevented || isOverlayOpen(document)) return;
|
|
286
|
+
close();
|
|
287
|
+
toggleRef.current?.focus();
|
|
288
|
+
};
|
|
289
|
+
document.addEventListener("keydown", closeOnEscape);
|
|
290
|
+
return () => document.removeEventListener("keydown", closeOnEscape);
|
|
291
|
+
}, [isDesktopOpen, close, toggleRef]);
|
|
292
|
+
|
|
293
|
+
if (isHidden) return null;
|
|
294
|
+
|
|
295
|
+
if (isMobile) {
|
|
296
|
+
return (
|
|
297
|
+
<Sheet open={isOpen} onOpenChange={(next) => !next && close()}>
|
|
298
|
+
<SheetContent
|
|
299
|
+
id={panelId}
|
|
300
|
+
side="right"
|
|
301
|
+
data-slot="aside-panel-sheet"
|
|
302
|
+
{...(description === undefined ? { "aria-describedby": undefined } : {})}
|
|
303
|
+
closeLabel={closeLabel}
|
|
304
|
+
className={cn("w-full gap-0 sm:max-w-none", className)}
|
|
305
|
+
onOpenAutoFocus={(event) => {
|
|
306
|
+
event.preventDefault();
|
|
307
|
+
headingRef.current?.focus();
|
|
308
|
+
}}
|
|
309
|
+
onCloseAutoFocus={(event) => {
|
|
310
|
+
event.preventDefault();
|
|
311
|
+
toggleRef.current?.focus();
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
<SheetHeader className="border-b border-border">
|
|
315
|
+
<SheetTitle ref={headingRef} tabIndex={-1} className="outline-none">
|
|
316
|
+
{title}
|
|
317
|
+
</SheetTitle>
|
|
318
|
+
{description === undefined ? null : <SheetDescription>{description}</SheetDescription>}
|
|
319
|
+
</SheetHeader>
|
|
320
|
+
<div data-slot="aside-panel-content" className="min-h-0 flex-1 overflow-y-auto">
|
|
321
|
+
{isOpen ? children : null}
|
|
322
|
+
</div>
|
|
323
|
+
</SheetContent>
|
|
324
|
+
</Sheet>
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (!isOpen) return null;
|
|
329
|
+
const isHalf = width === "half";
|
|
330
|
+
const WidthIcon = isHalf ? ChevronsRight : ChevronsLeft;
|
|
331
|
+
const widthLabel = isHalf ? narrowLabel : widenLabel;
|
|
332
|
+
|
|
333
|
+
// A phone gets this branch in the server HTML (`useIsMobile` is false there) until hydration swaps in the sheet:
|
|
334
|
+
// `max-md:hidden` keeps it from painting. The `md` breakpoint equals the theme's mobile breakpoint.
|
|
335
|
+
return (
|
|
336
|
+
<aside
|
|
337
|
+
id={panelId}
|
|
338
|
+
data-slot="aside-panel"
|
|
339
|
+
data-width={width}
|
|
340
|
+
aria-labelledby={headingId}
|
|
341
|
+
className={cn(
|
|
342
|
+
"sticky top-0 flex h-dvh max-md:hidden w-2/5 shrink-0 flex-col border-l border-border bg-background text-foreground data-[width=half]:w-1/2",
|
|
343
|
+
className,
|
|
344
|
+
)}
|
|
345
|
+
>
|
|
346
|
+
<div data-slot="aside-panel-header" className="flex h-11 shrink-0 items-center gap-2 border-b border-border pr-12 pl-4">
|
|
347
|
+
<h2 ref={headingRef} id={headingId} tabIndex={-1} className="min-w-0 flex-1 truncate text-heading-3 outline-none">
|
|
348
|
+
{title}
|
|
349
|
+
</h2>
|
|
350
|
+
<Button type="button" variant="ghost" size="icon" aria-label={widthLabel} title={widthLabel} onClick={() => setWidth(isHalf ? "standard" : "half")}>
|
|
351
|
+
<WidthIcon aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} />
|
|
352
|
+
</Button>
|
|
353
|
+
</div>
|
|
354
|
+
<div data-slot="aside-panel-content" className="min-h-0 flex-1 overflow-y-auto">
|
|
355
|
+
{children}
|
|
356
|
+
</div>
|
|
357
|
+
</aside>
|
|
358
|
+
);
|
|
359
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Kept out of the "use client" AsidePanel module so a Server Component or a plain script can call it too.
|
|
2
|
+
|
|
3
|
+
// Overlays that handle Escape themselves: a Radix dialog, menu, listbox or popover while it is open, a native modal.
|
|
4
|
+
const OPEN_OVERLAY_SELECTORS = [
|
|
5
|
+
'[role="dialog"][data-state="open"]',
|
|
6
|
+
'[role="alertdialog"][data-state="open"]',
|
|
7
|
+
'[role="menu"][data-state="open"]',
|
|
8
|
+
'[role="listbox"][data-state="open"]',
|
|
9
|
+
"dialog[open]",
|
|
10
|
+
":popover-open",
|
|
11
|
+
] as const;
|
|
12
|
+
|
|
13
|
+
function hasMatch(root: ParentNode, selector: string): boolean {
|
|
14
|
+
try {
|
|
15
|
+
return root.querySelector(selector) !== null;
|
|
16
|
+
} catch {
|
|
17
|
+
// A DOM that does not know the selector (`:popover-open` in an older engine) has no such overlay open.
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Whether a dialog, menu, listbox or popover is open under `root`: one with Radix `data-state="open"`, one that
|
|
24
|
+
* matches `:popover-open`, or a `dialog[open]`. A closed popover that stays in the page with `role="dialog"` does
|
|
25
|
+
* not count. A keyboard handler reads it before acting on Escape, so the overlay closes first.
|
|
26
|
+
*/
|
|
27
|
+
export function isOverlayOpen(root: ParentNode): boolean {
|
|
28
|
+
return OPEN_OVERLAY_SELECTORS.some((selector) => hasMatch(root, selector));
|
|
29
|
+
}
|