@justanarthur/modo-ui 2.8.0 → 2.10.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/README.md CHANGED
@@ -258,6 +258,7 @@ shell: {
258
258
  Select: '@justanarthur/modo-ui/docs#Select',
259
259
  Icon: '@justanarthur/modo-ui/docs#Icon',
260
260
  Sidebar: '@justanarthur/modo-ui/docs#DocsNav',
261
+ SiteSwitcher: '@justanarthur/modo-ui/docs#SiteSwitcher',
261
262
  },
262
263
  panel: { items: [{ label: 'Theme', component: '@justanarthur/modo-ui/docs#ThemeSwitcher' }] },
263
264
  vite: './vite.ts',
@@ -1,4 +1,4 @@
1
- import { IconSlotProps, LinkSlotProps, SelectSlotProps, SidebarItemProps, SidebarSectionProps, SidebarSlotProps } from "@justanarthur/modo";
1
+ import { IconSlotProps, LinkSlotProps, SelectSlotProps, SidebarItemProps, SidebarSectionProps, SidebarSlotProps, SiteSwitcherSlotProps } from "@justanarthur/modo";
2
2
  import { ForwardRefExoticComponent as ForwardRefExoticComponent_tcubfn } from "react";
3
3
  import { ButtonProps as ButtonProps_1qs1xe } from "..";
4
4
  import { RefAttributes as RefAttributes_miuf56 } from "react";
@@ -51,4 +51,12 @@ declare function DocsNavSection({ title, children }: SidebarSectionProps): Eleme
51
51
  * OS flips underneath 'system'.
52
52
  */
53
53
  declare function ThemeSwitcher(): Element_12xgc;
54
- export { Button, DocsNav, Icon, Link, Select, ThemeSwitcher };
54
+ /**
55
+ * SiteSwitcher slot: the site view's badge (the site's mark, else a pages glyph) on an elevated
56
+ * surface, opening a Popover that grows out of it: the site and the page on screen, the pages as a
57
+ * Sidebar menu (the current one lit, the hover melting from row to row, arrow keys between them), the
58
+ * panel items as list rows, and the links back to the docs. It opens away from the corner modo keeps
59
+ * it in; picking a page closes it. modo drags it between corners, so the tooltip says so.
60
+ */
61
+ declare function SiteSwitcher({ name, logo, pages, current, sections, links, corner }: SiteSwitcherSlotProps): Element_12xgc;
62
+ export { Button, DocsNav, Icon, Link, Select, SiteSwitcher, ThemeSwitcher };
@@ -14,6 +14,12 @@ import"../shared/components-ywgqahmg.js";
14
14
  import {
15
15
  button_default
16
16
  } from "../shared/components-ycwhrqe1.js";
17
+ import"../shared/components-wwd093xg.js";
18
+ import"../shared/components-nz14rwtd.js";
19
+ import {
20
+ LIST_POPOVER2,
21
+ list_default
22
+ } from "../shared/components-t0c1rw40.js";
17
23
  import"../shared/components-grxgqa75.js";
18
24
  import"../shared/components-1ztgy933.js";
19
25
  import"../shared/components-21hcwp85.js";
@@ -22,7 +28,6 @@ import"../shared/components-8pnvkrbw.js";
22
28
  import"../shared/components-bxqmbcz2.js";
23
29
  import"../shared/components-9b2m90st.js";
24
30
  import"../shared/components-5wykqxph.js";
25
- import"../shared/components-wwd093xg.js";
26
31
  import"../shared/components-ft5dgjg6.js";
27
32
  import"../shared/components-mse06t0x.js";
28
33
  import"../shared/components-q0hs5rqn.js";
@@ -36,7 +41,6 @@ import"../shared/components-tcyz2tdn.js";
36
41
  import"../shared/components-v2j3jx89.js";
37
42
  import"../shared/components-6f5pyzb2.js";
38
43
  import"../shared/components-5fet4gqt.js";
39
- import"../shared/components-nz14rwtd.js";
40
44
  import {
41
45
  select_default
42
46
  } from "../shared/components-a8bcq2yc.js";
@@ -52,7 +56,12 @@ import"../shared/components-y09nr7fe.js";
52
56
  import {
53
57
  useIsMobile2
54
58
  } from "../shared/components-8wp8d8q1.js";
55
- import"../shared/components-7rn454aq.js";
59
+ import {
60
+ tooltip_default
61
+ } from "../shared/components-7rn454aq.js";
62
+ import {
63
+ popover_default
64
+ } from "../shared/components-0v4jxw7z.js";
56
65
 
57
66
  // docs/chrome.tsx
58
67
  import {
@@ -65,6 +74,7 @@ import {
65
74
  Monitor,
66
75
  Moon,
67
76
  Package,
77
+ PanelsTopLeft,
68
78
  Sun,
69
79
  X
70
80
  } from "lucide-react";
@@ -318,11 +328,96 @@ function ThemeSwitcher() {
318
328
  ]
319
329
  });
320
330
  }
331
+ function SiteSwitcher({ name, logo, pages, current, sections, links, corner }) {
332
+ const [open, setOpen] = useState(false);
333
+ const label = current ? `Pages: ${current}` : "Pages";
334
+ return /* @__PURE__ */ jsxs(popover_default, {
335
+ open,
336
+ onOpenChange: setOpen,
337
+ children: [
338
+ /* @__PURE__ */ jsx("div", {
339
+ "data-modo-ui": "site-badge",
340
+ children: /* @__PURE__ */ jsx(tooltip_default, {
341
+ content: "Pages · drag to move",
342
+ side: corner.startsWith("top") ? "bottom" : "top",
343
+ children: /* @__PURE__ */ jsx(popover_default.Trigger, {
344
+ render: /* @__PURE__ */ jsx(button_default, {
345
+ variant: "ghost",
346
+ size: "icon",
347
+ "aria-label": label,
348
+ children: logo ?? /* @__PURE__ */ jsx(PanelsTopLeft, {
349
+ "aria-hidden": true
350
+ })
351
+ })
352
+ })
353
+ })
354
+ }),
355
+ /* @__PURE__ */ jsxs(popover_default.Content, {
356
+ side: corner.startsWith("top") ? "bottom" : "top",
357
+ align: corner.endsWith("left") ? "start" : "end",
358
+ sideOffset: 8,
359
+ className: LIST_POPOVER2,
360
+ "aria-label": `${name} pages`,
361
+ children: [
362
+ /* @__PURE__ */ jsxs("div", {
363
+ "data-modo-ui": "site-head",
364
+ children: [
365
+ /* @__PURE__ */ jsx(popover_default.Title, {
366
+ children: name
367
+ }),
368
+ /* @__PURE__ */ jsx(popover_default.Description, {
369
+ children: current ?? "No page"
370
+ })
371
+ ]
372
+ }),
373
+ /* @__PURE__ */ jsx(list_default.Section, {
374
+ title: "Pages",
375
+ children: /* @__PURE__ */ jsx("nav", {
376
+ "aria-label": "Pages",
377
+ children: /* @__PURE__ */ jsx(sidebar_default.Menu, {
378
+ children: pages.map((page) => /* @__PURE__ */ jsx(sidebar_default.MenuItem, {
379
+ children: /* @__PURE__ */ jsx(sidebar_default.MenuButton, {
380
+ isActive: page.current,
381
+ render: /* @__PURE__ */ jsx("a", {
382
+ href: page.href,
383
+ "aria-current": page.current ? "page" : undefined
384
+ }),
385
+ onClick: () => setOpen(false),
386
+ children: page.title
387
+ })
388
+ }, page.id))
389
+ })
390
+ })
391
+ }),
392
+ sections.length > 0 && /* @__PURE__ */ jsx(list_default, {
393
+ children: sections.map((section, i) => /* @__PURE__ */ jsx(list_default.Row, {
394
+ label: section.label,
395
+ children: section.content
396
+ }, `${i}-${section.label}`))
397
+ }),
398
+ /* @__PURE__ */ jsx("div", {
399
+ "data-modo-ui": "site-foot",
400
+ children: links.map((link) => /* @__PURE__ */ jsx(button_default, {
401
+ variant: "ghost",
402
+ size: "compact",
403
+ render: /* @__PURE__ */ jsx("a", {
404
+ href: link.href
405
+ }),
406
+ onClick: () => setOpen(false),
407
+ children: link.label
408
+ }, link.href))
409
+ })
410
+ ]
411
+ })
412
+ ]
413
+ });
414
+ }
321
415
  export {
322
416
  Button,
323
417
  DocsNav,
324
418
  Icon,
325
419
  Link,
326
420
  Select,
421
+ SiteSwitcher,
327
422
  ThemeSwitcher
328
423
  };
package/docs/chrome.css CHANGED
@@ -173,3 +173,68 @@
173
173
  [data-modo-ui="nav-controls"] {
174
174
  padding-inline: var(--space-2);
175
175
  }
176
+
177
+ /* The site view's indicator (/site): the badge and its menu as one of the
178
+ design system's popups, a surface lifted off the page on its shadow. */
179
+ [data-modo="site-badge"],
180
+ [data-modo="site-menu"] {
181
+ border-color: transparent;
182
+ background-color: var(--surface-3);
183
+ box-shadow: var(--shadow-3);
184
+ }
185
+
186
+ [data-modo="site-badge"] {
187
+ transition: background-color var(--duration-fast);
188
+ }
189
+
190
+ [data-modo="site-badge"]:hover {
191
+ background-image: linear-gradient(var(--hover), var(--hover));
192
+ }
193
+
194
+ [data-modo="site-menu"] {
195
+ border-radius: var(--radius-shell);
196
+ }
197
+
198
+ [data-modo="site-menu-page"] {
199
+ border-radius: var(--radius);
200
+ transition: background-color var(--duration-fast);
201
+ }
202
+
203
+ [data-modo="site-menu-page"]:hover {
204
+ background-color: var(--hover);
205
+ }
206
+
207
+ [data-modo="site-menu-page"][aria-current="page"] {
208
+ background-color: var(--active);
209
+ }
210
+
211
+ /* The SiteSwitcher slot (./chrome.tsx): its badge is a popup surface off the
212
+ page, round around its icon button; the logo sits at the icon's size. */
213
+ [data-modo-ui="site-badge"] {
214
+ display: flex;
215
+ padding: var(--space-1);
216
+ border-radius: var(--radius-pill-shell);
217
+ background-color: var(--surface-3);
218
+ box-shadow: var(--shadow-3);
219
+ }
220
+
221
+ [data-modo-ui="site-badge"] > button {
222
+ border-radius: var(--radius-pill);
223
+ }
224
+
225
+ [data-modo-ui="site-badge"] img {
226
+ width: 1rem;
227
+ height: 1rem;
228
+ }
229
+
230
+ /* The popover's head and links, inset like the list's captions. */
231
+ [data-modo-ui="site-head"] {
232
+ display: flex;
233
+ flex-direction: column;
234
+ padding-inline: var(--space-2);
235
+ }
236
+
237
+ [data-modo-ui="site-foot"] {
238
+ display: flex;
239
+ gap: var(--space-1);
240
+ }
package/docs/chrome.tsx CHANGED
@@ -18,6 +18,7 @@ import type {
18
18
  SidebarItemProps,
19
19
  SidebarSectionProps,
20
20
  SidebarSlotProps,
21
+ SiteSwitcherSlotProps,
21
22
  } from '@justanarthur/modo'
22
23
  import {
23
24
  Check,
@@ -30,13 +31,17 @@ import {
30
31
  Monitor,
31
32
  Moon,
32
33
  Package,
34
+ PanelsTopLeft,
33
35
  Sun,
34
36
  X,
35
37
  } from 'lucide-react'
36
38
  import { Children, createContext, isValidElement, type ReactNode, useContext, useEffect, useState } from 'react'
37
39
  import ModoButton from '../components/actions/button'
40
+ import List, { LIST_POPOVER } from '../components/data-display/list'
38
41
  import FluidSelect from '../components/inputs/select'
39
42
  import Sidebar, { type SidebarSide, useSidebar } from '../components/navigation/sidebar'
43
+ import Popover from '../components/overlays/popover'
44
+ import Tooltip from '../components/overlays/tooltip'
40
45
  import { useIsMobile } from '../lib/use-is-mobile'
41
46
 
42
47
  /**
@@ -312,3 +317,81 @@ export function ThemeSwitcher() {
312
317
  </FluidSelect>
313
318
  )
314
319
  }
320
+
321
+ /**
322
+ * SiteSwitcher slot: the site view's badge (the site's mark, else a pages glyph) on an elevated
323
+ * surface, opening a Popover that grows out of it: the site and the page on screen, the pages as a
324
+ * Sidebar menu (the current one lit, the hover melting from row to row, arrow keys between them), the
325
+ * panel items as list rows, and the links back to the docs. It opens away from the corner modo keeps
326
+ * it in; picking a page closes it. modo drags it between corners, so the tooltip says so.
327
+ */
328
+ export function SiteSwitcher({ name, logo, pages, current, sections, links, corner }: SiteSwitcherSlotProps) {
329
+ const [open, setOpen] = useState(false)
330
+ const label = current ? `Pages: ${current}` : 'Pages'
331
+ return (
332
+ <Popover open={open} onOpenChange={setOpen}>
333
+ <div data-modo-ui="site-badge">
334
+ <Tooltip content="Pages · drag to move" side={corner.startsWith('top') ? 'bottom' : 'top'}>
335
+ <Popover.Trigger
336
+ render={
337
+ <ModoButton variant="ghost" size="icon" aria-label={label}>
338
+ {logo ?? <PanelsTopLeft aria-hidden />}
339
+ </ModoButton>
340
+ }
341
+ />
342
+ </Tooltip>
343
+ </div>
344
+ <Popover.Content
345
+ side={corner.startsWith('top') ? 'bottom' : 'top'}
346
+ align={corner.endsWith('left') ? 'start' : 'end'}
347
+ sideOffset={8}
348
+ className={LIST_POPOVER}
349
+ aria-label={`${name} pages`}
350
+ >
351
+ <div data-modo-ui="site-head">
352
+ <Popover.Title>{name}</Popover.Title>
353
+ <Popover.Description>{current ?? 'No page'}</Popover.Description>
354
+ </div>
355
+ <List.Section title="Pages">
356
+ <nav aria-label="Pages">
357
+ <Sidebar.Menu>
358
+ {pages.map(page => (
359
+ <Sidebar.MenuItem key={page.id}>
360
+ <Sidebar.MenuButton
361
+ isActive={page.current}
362
+ render={<a href={page.href} aria-current={page.current ? 'page' : undefined} />}
363
+ onClick={() => setOpen(false)}
364
+ >
365
+ {page.title}
366
+ </Sidebar.MenuButton>
367
+ </Sidebar.MenuItem>
368
+ ))}
369
+ </Sidebar.Menu>
370
+ </nav>
371
+ </List.Section>
372
+ {sections.length > 0 && (
373
+ <List>
374
+ {sections.map((section, i) => (
375
+ <List.Row key={`${i}-${section.label}`} label={section.label}>
376
+ {section.content}
377
+ </List.Row>
378
+ ))}
379
+ </List>
380
+ )}
381
+ <div data-modo-ui="site-foot">
382
+ {links.map(link => (
383
+ <ModoButton
384
+ key={link.href}
385
+ variant="ghost"
386
+ size="compact"
387
+ render={<a href={link.href} />}
388
+ onClick={() => setOpen(false)}
389
+ >
390
+ {link.label}
391
+ </ModoButton>
392
+ ))}
393
+ </div>
394
+ </Popover.Content>
395
+ </Popover>
396
+ )
397
+ }
package/docs/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * The docs chrome as one module, for a design system documented with modo:
3
- * `shell: { Sidebar: '@justanarthur/modo-ui/docs#DocsNav', … }` and
3
+ * `shell: { Sidebar: '@justanarthur/modo-ui/docs#DocsNav', SiteSwitcher: '@justanarthur/modo-ui/docs#SiteSwitcher', … }` and
4
4
  * `panel: { items: [{ label: 'Theme', component: '@justanarthur/modo-ui/docs#ThemeSwitcher' }] }`.
5
5
  * Its look is `@justanarthur/modo-ui/docs/chrome.css`; the pre-paint theme controller is
6
6
  * `docsTheme` in `@justanarthur/modo-ui/docs/vite`. The package's main entry never imports it.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justanarthur/modo-ui",
3
3
  "type": "module",
4
- "version": "2.8.0",
4
+ "version": "2.10.0",
5
5
  "description": "Fluid Functionalism (Base UI flavor, MIT © 2026 Micka Touillaud) ported to UnoCSS: motion springs, fluid hover, a two-step size ladder and an eight-level elevated surface system. Documented with modo.",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -349,7 +349,7 @@
349
349
  }
350
350
  },
351
351
  "devDependencies": {
352
- "@justanarthur/modo": "1.1.0",
352
+ "@justanarthur/modo": "1.3.0",
353
353
  "@types/react": "^18.3.0",
354
354
  "@types/react-dom": "^18.3.0",
355
355
  "bunup": "^0.16.0",