@jskit-ai/shell-web 0.2.13 → 0.2.15
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 +18 -0
- package/fixtures/adaptive-shell/src/ActionsFormPage.vue +22 -0
- package/fixtures/adaptive-shell/src/ActionsPage.vue +74 -0
- package/fixtures/adaptive-shell/src/App.vue +1 -0
- package/fixtures/adaptive-shell/src/ButtonStatesPage.vue +63 -0
- package/fixtures/adaptive-shell/src/ButtonsPage.vue +33 -3
- package/fixtures/adaptive-shell/src/ComponentsPage.vue +178 -0
- package/fixtures/adaptive-shell/src/FeedbackPage.vue +59 -0
- package/fixtures/adaptive-shell/src/ReportsPage.vue +29 -0
- package/fixtures/adaptive-shell/src/StatusButton.vue +17 -0
- package/fixtures/adaptive-shell/src/TitleClaim.vue +17 -0
- package/fixtures/adaptive-shell/src/main.js +131 -5
- package/fixtures/production-build/index.html +15 -0
- package/fixtures/production-build/package.json +5 -0
- package/fixtures/production-build/src/App.vue +27 -0
- package/fixtures/production-build/src/componentChunk.css +5 -0
- package/fixtures/production-build/src/main.js +10 -0
- package/fixtures/production-build/vite.config.mjs +12 -0
- package/locales/en.json +1 -0
- package/package.json +9 -5
- package/patterns/application-shell/PATTERN.md +11 -6
- package/patterns/application-shell/example/src/components/menus/SectionTabLinkItem.vue +42 -0
- package/patterns/application-shell/example/src/pages/home.vue +1 -1
- package/patterns/application-shell/example/src/views/NotFound.vue +1 -1
- package/patterns/page-and-placement/PATTERN.md +6 -0
- package/patterns/page-and-placement/example/src/pages/home/reports.vue +9 -4
- package/patterns/page-and-placement/example/src/placementTopology.js +5 -3
- package/src/client/components/ShellErrorHost.vue +20 -1
- package/src/client/components/ShellLayout.vue +42 -27
- package/src/client/components/ShellNavigationItem.vue +8 -3
- package/src/client/components/ShellNavigationScope.vue +1 -1
- package/src/client/components/ShellOutlet.vue +12 -1
- package/src/client/components/ShellPageAction.vue +107 -28
- package/src/client/components/ShellPageActionsTarget.vue +81 -2
- package/src/client/components/ShellPrimaryAction.vue +69 -0
- package/src/client/components/ShellSectionTabLinkItem.vue +104 -0
- package/src/client/components/ShellTabLinkItem.vue +18 -3
- package/src/client/components/ShellUpButton.vue +13 -8
- package/src/client/composables/useShellAppBar.js +10 -1
- package/src/client/composables/useShellPageClose.js +18 -0
- package/src/client/index.js +3 -0
- package/src/client/navigation/shellNavigationRuntime.js +59 -12
- package/src/client/navigation/usePaths.js +13 -0
- package/src/client/navigation/useShellNavigation.js +2 -0
- package/src/client/providers/ShellWebClientProvider.js +25 -9
- package/src/client/support/drawerPresentation.js +23 -6
- package/src/client/support/navigationPresentation.js +1 -1
- package/src/client/support/pageActions.js +126 -0
- package/src/test/adaptiveShellSmoke.js +31 -16
- package/test/adaptiveShell.browser.test.js +1019 -334
- package/test/drawerPresentation.test.js +20 -2
- package/test/linkResolver.test.js +4 -0
- package/test/materialBaselines.browser.test.js +142 -27
- package/test/packageRouteParent.test.js +41 -0
- package/test/pageActions.test.js +84 -0
- package/test/productionBuild.browser.test.js +98 -0
- package/test/settingsPlacementContract.test.js +11 -4
- package/test/shellNavigationRuntime.test.js +272 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- The shell's client provider starts loading the app's `src/placementTopology.js`, `src/placement.js` and `src/error.js` together instead of each after the one before; it still reads, checks and applies them in the same order, and each is still optional. Measured on the accounts starter with 60 ms of latency per request: the three arrived by 851 ms instead of 935 ms (721-790, 799-865 and 869-935 ms before, 718-851 ms together after), and the bootstrap request that follows them started 82 ms sooner.
|
|
6
|
+
- After Up or the browser's Back, the shell's attempts to focus the element that opened the page left (every 100 ms for up to 1.5 s, until the page draws it) stop at the next navigation and when focus has moved since they started. Before, they outlived both: a Back then a Forward within 1.5 s could focus a matching link or tab on the next page and take the caret from a field someone was typing in. Focus that only fell back to the page body, as when the left page's element goes away, still gets the opener.
|
|
7
|
+
- `ShellErrorHost`'s snackbar no longer covers the actions it reports on: it showed at the bottom end for 5 seconds over Save and the FAB, so a second Save waited it out. It is centred at the bottom on compact windows and starts at the content's start edge on wider ones, at most half the content's width, clear of end-aligned FABs and form actions; Vuetify keeps it above the navigation bar and a FAB that takes layout room (`<v-fab app layout>`). On a phone a form's Save is the app bar's primary action (`ShellPageAction primary`), which it never covers.
|
|
8
|
+
- `ShellSectionTabLinkItem` (new, `@jskit-ai/shell-web/client/components/ShellSectionTabLinkItem`) is a page's section tab (`page.section-nav`): a Material 3 primary tab, 48dp (64dp with the placement's icon above the label), its label in title-small, the active one's label `primary` over a 3dp indicator under its content with rounded top corners, `aria-current="page"`. The starter registers it as `local.main.ui.section-tab-link-item`, and the page-and-placement pattern's Reports tabs use it in a row of their own over an `outline-variant` divider. `ShellTabLinkItem` styles itself as a navigation bar destination (its 64x32 indicator, full height, no padding, 5.5rem label) only inside `ShellLayout`'s navigation bar, which now gives its outlet the "bar" presentation; placed anywhere else, as in a page's section tabs, it draws a `ShellSectionTabLinkItem`, instead of squashed 64dp pills with clipped labels.
|
|
9
|
+
- Navigation needs two destinations: with one (Home alone) `ShellLayout` draws no navigation bar, rail, drawer or menu control, as a surface with none already had none. The destinations are counted across the bar and the drawer, so a phone's one drawer destination beside the bar's (Settings beside Home) keeps its drawer; the layout's own `menu` slot keeps one too, and the surface identity (a workspace switcher) keeps the drawer beside any navigation. `shellLayoutHasNavigationBar()` joins `shellLayoutHasDrawer()`.
|
|
10
|
+
- The standard drawer's header holds its menu control alone, with a tooltip naming what it does ("Collapse navigation drawer"), instead of the surface's label beside it, which read as the control's label ("Home", right above the Home destination). The surface label stays the app bar's title for a page that declares none.
|
|
11
|
+
- `usePaths().page(path, { scope: "global" })` gives a global route's path (a route with `scope: "global"`, such as `/auth/login`, on no surface), its params filled from the route and `params`, instead of the current surface's. `explicitTo` stays for a finished target that arrives as data.
|
|
12
|
+
- `runAdaptiveShellSmokeCase` passes a phone shell whose destinations are all in the navigation bar (the standard topology, with compact main navigation in `shell-layout:primary-bottom-nav`): it reads the compact layout from the navigation bar when the shell draws no drawer, and checks there is no menu control, instead of waiting for a drawer that never renders.
|
|
5
13
|
- Exact Material 3 out of the box, in light and dark, with `@jskit-ai/material-web`: the top app bar carries the page's title (`meta.jskit.title`, or `useShellPageTitle()`), its Up arrow and its actions (`ShellPageActions` and `ShellPageAction`, one of them `primary`; `href` makes an action a link that leaves the app); window size classes (`useShellWindowSizeClass()`: compact, medium, expanded, large) pick the navigation bar, the navigation rail with a modal drawer, or the standard drawer; the active destination has a filled icon in its indicator; snackbars are inverse-surface, their actions 40dp text buttons without a fixed 48px height, and banners use their severity's container colours.
|
|
6
14
|
- Up navigation per the Material 3 navigation spec: a page declares the page it belongs to as `meta.jskit.parent` (a path on its surface, or `{ surface, path }`), and the shell's arrow returns to the page the person came from (with its scroll position, state and focus) or else to that parent; main destinations reset the trail and show no arrow, and a list-detail page shows none beside its list. `useShellNavigation()` gives `{ canGoUp, upTarget, up, finish, pageUnavailable }`: `finish(target)` leaves a finished form by replacing its history entry, and `pageUnavailable()` sends a page Up returned to and whose record is gone to its parent. `@jskit-ai/shell-web/test/shellNavigation` has the browser checks.
|
|
7
15
|
- The application-shell pattern's not-found view renders in the shell, so the top app bar carries its title and the navigation leads back into the app; the shell foundation has it too.
|
|
@@ -12,6 +20,16 @@
|
|
|
12
20
|
- `leaveApp(url, { replace: true })` leaves in place of the current history entry, for a hand-off page that only forwards (to an OAuth provider's consent screen), so Back from the site doesn't rerun it; `leaveApp(url)` still pushes.
|
|
13
21
|
- `ShellPageTitle`'s default slot, given `{ title }`, replaces the text inside the h1, so a title that is also a switcher (a project menu) can be the menu's activator and stay the page's one h1, with its id and focus.
|
|
14
22
|
- A layout that draws its own top app bar builds it from the pieces of `ShellLayout`'s bar: `ShellUpButton` (the Up arrow, shown only on inner pages), `ShellPageTitle` (the page's one `h1`) and `ShellPageActionsTarget`, with `useShellAppBar()` once in the layout so its pages enter the trail and their `ShellPageActions` show in its bar. `ShellLayout` is built from the same pieces and looks and behaves as before.
|
|
23
|
+
- `ShellPrimaryAction` is a screen's adaptive primary action, such as a list's "New": an extended FAB above the navigation bar or beside the rail on compact and medium windows, the app bar's filled primary action on expanded and large ones. It takes `to`, or a click handler for a "New" that opens a dialog, so any list uses it instead of wiring `v-fab`, `ShellPageAction` and `useShellWindowSizeClass()` by hand; http-web's CRUD list uses it.
|
|
24
|
+
- `ShellPageAction` takes `color` (a colour role, such as `error` for a destructive action), `download` (with `href`, a file to save, such as a CSV export) and `replace` (with `to`). Its attributes (`data-testid`, `target`, `type`, `form`, `aria-*`) land on the button in every form; on compact windows they used to land on the tooltip and were lost.
|
|
25
|
+
- The top app bar has Material 3's overflow menu: `<ShellPageAction overflow>` is an item of the bar's trailing "More actions" menu (a record's secondary actions), and on compact windows every action but the primary one joins it (see the one-trailing-item rule below). The menu is `role="menu"` with `menuitem`s that keep each action's link, download, colour, attributes and click handler. New message key: `jskit.shell.actions.more` ("More actions").
|
|
26
|
+
- `useShellPageTitle()` claims stack: releasing a claim shows the previous claim's title again instead of none, so a component that claims the title for a while gives the page its own title back. Route pages own the title; a nested component uses a section heading.
|
|
27
|
+
- `finish(target)` from `useShellNavigation()` returns to the trail's entry with its query (filters, search, sort, page) and scroll when the target is the page the form was opened from and carries no query or hash of its own; it used to drop the list's query.
|
|
28
|
+
- `useShellPageClose({ label, close })` makes a page a task that closes, as Material 3 draws a full-screen form: while it lives, the top app bar's Up arrow is a close (X) labelled `label` that runs `close` (the form's Cancel), so the bar never shows an X beside the arrow. The leading button keeps `data-testid="jskit-shell-back"` and carries `data-action="up"` or `"close"`; its accessible name is the close's label. http-web's new and edit pages use it.
|
|
29
|
+
- On compact windows the top app bar keeps one trailing item, so the title keeps its room: the page's primary action when it has one (a form's Save), otherwise the top-right item nearest the corner (the account avatar). Every other page action and top-right item (tools, a notification bell, and the avatar on a form) goes into the bar's one overflow menu, the actions first. Medium and wider windows are unchanged. `ShellPageActionsTarget` takes a `#menu` slot for those items, `ShellOutlet` takes `start` and `end` to render part of an outlet, and `useShellAppBar()` returns `{ pageActions }`, whose `hasPrimary` tells a layout with its own bar whether the primary action took the place.
|
|
30
|
+
- `ShellTabLinkItem`'s navigation bar destination is a text button in on-surface-variant of its own, as the section tab it draws outside the bar already is, so it never takes an app's filled, primary button defaults (a dark primary pill with a hard-to-read label) wherever its bar is drawn. The shell's navigation bar looks as before.
|
|
31
|
+
- Pages in one route folder are different pages for the trail, as for the kernel's scroll behaviour: two records of one page type in a folder (`/w/bookings/7`, then `/w/bookings/8`) put the first on the trail, so Up returns to it with its scroll. Tabs of a layout stay one page and keep the trail.
|
|
32
|
+
- Navigation rail labels wrap to a second line instead of ending in an ellipsis, as Material 3's do; only a label that needs a third line is cut.
|
|
15
33
|
- Upgrading: see the guide's [Move an app to the Material 3 defaults](https://mobily-enterprises.github.io/jskit-ai/guide/app-setup/material-3-migration).
|
|
16
34
|
|
|
17
35
|
## 0.2.0 - 2026-10-29
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ShellPageAction from "../../../src/client/components/ShellPageAction.vue";
|
|
3
|
+
import ShellPageActions from "../../../src/client/components/ShellPageActions.vue";
|
|
4
|
+
import { useShellPageClose } from "../../../src/client/composables/useShellPageClose.js";
|
|
5
|
+
import { usePaths } from "../../../src/client/navigation/usePaths.js";
|
|
6
|
+
import { useShellNavigation } from "../../../src/client/navigation/useShellNavigation.js";
|
|
7
|
+
|
|
8
|
+
// A new page that saves to its list (finish with a target) and closes back to where it was opened (finish()): its Up
|
|
9
|
+
// arrow is the close.
|
|
10
|
+
const paths = usePaths();
|
|
11
|
+
const { finish } = useShellNavigation();
|
|
12
|
+
useShellPageClose({ label: "Cancel", close: () => finish() });
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<section class="pa-4">
|
|
17
|
+
<ShellPageActions>
|
|
18
|
+
<ShellPageAction primary label="Save" @click="finish(paths.page('/actions'))" />
|
|
19
|
+
</ShellPageActions>
|
|
20
|
+
<p>A new entry.</p>
|
|
21
|
+
</section>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import { RouterLink } from "vue-router";
|
|
4
|
+
import ShellPageAction from "../../../src/client/components/ShellPageAction.vue";
|
|
5
|
+
import ShellPageActions from "../../../src/client/components/ShellPageActions.vue";
|
|
6
|
+
import ShellPrimaryAction from "../../../src/client/components/ShellPrimaryAction.vue";
|
|
7
|
+
import { useShellPageTitle } from "../../../src/client/composables/useShellPageTitle.js";
|
|
8
|
+
import { usePaths } from "../../../src/client/navigation/usePaths.js";
|
|
9
|
+
import TitleClaim from "./TitleClaim.vue";
|
|
10
|
+
|
|
11
|
+
// Page actions in every form: icon-only and labelled, links that leave the app or download a file, a destructive one,
|
|
12
|
+
// an overflow one and, on compact windows, more than the bar holds; the adaptive primary action opening a dialog; and
|
|
13
|
+
// a nested component that claims the title for a while.
|
|
14
|
+
const paths = usePaths();
|
|
15
|
+
const log = ref([]);
|
|
16
|
+
const dialog = ref(false);
|
|
17
|
+
const panel = ref(false);
|
|
18
|
+
|
|
19
|
+
useShellPageTitle("Page actions");
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<section class="pa-4">
|
|
24
|
+
<ShellPageActions>
|
|
25
|
+
<ShellPageAction icon="$edit" label="Edit" data-testid="fixture-action-edit" @click="log.push('edit')" />
|
|
26
|
+
<ShellPageAction
|
|
27
|
+
icon="$download"
|
|
28
|
+
label="Export"
|
|
29
|
+
href="/records.csv"
|
|
30
|
+
download="records.csv"
|
|
31
|
+
data-testid="fixture-action-export"
|
|
32
|
+
/>
|
|
33
|
+
<ShellPageAction
|
|
34
|
+
icon="$openInNew"
|
|
35
|
+
label="Open site"
|
|
36
|
+
href="https://example.com/"
|
|
37
|
+
target="_blank"
|
|
38
|
+
data-testid="fixture-action-site"
|
|
39
|
+
/>
|
|
40
|
+
<ShellPageAction
|
|
41
|
+
icon="$delete"
|
|
42
|
+
label="Delete"
|
|
43
|
+
color="error"
|
|
44
|
+
data-testid="fixture-action-delete"
|
|
45
|
+
@click="log.push('delete')"
|
|
46
|
+
/>
|
|
47
|
+
<ShellPageAction
|
|
48
|
+
overflow
|
|
49
|
+
icon="$contentCopy"
|
|
50
|
+
label="Duplicate"
|
|
51
|
+
data-testid="fixture-action-duplicate"
|
|
52
|
+
@click="log.push('duplicate')"
|
|
53
|
+
/>
|
|
54
|
+
</ShellPageActions>
|
|
55
|
+
<ShellPrimaryAction label="New record" data-testid="fixture-primary" @click="dialog = true" />
|
|
56
|
+
|
|
57
|
+
<p data-testid="fixture-action-log">{{ log.join(",") }}</p>
|
|
58
|
+
<p>
|
|
59
|
+
<RouterLink :to="paths.page('/actions/new')">New entry</RouterLink>
|
|
60
|
+
</p>
|
|
61
|
+
<v-btn variant="text" data-testid="fixture-toggle-panel" @click="panel = !panel">Toggle panel</v-btn>
|
|
62
|
+
<TitleClaim v-if="panel" title="Panel title" />
|
|
63
|
+
|
|
64
|
+
<v-dialog v-model="dialog" max-width="400">
|
|
65
|
+
<v-card title="New record" data-testid="fixture-new-dialog">
|
|
66
|
+
<v-card-text>Fill in the record.</v-card-text>
|
|
67
|
+
<v-card-actions>
|
|
68
|
+
<v-btn @click="dialog = false">Cancel</v-btn>
|
|
69
|
+
<v-btn @click="dialog = false">Create</v-btn>
|
|
70
|
+
</v-card-actions>
|
|
71
|
+
</v-card>
|
|
72
|
+
</v-dialog>
|
|
73
|
+
</section>
|
|
74
|
+
</template>
|
|
@@ -12,6 +12,7 @@ const bare = computed(() => route.meta.bare === true);
|
|
|
12
12
|
const ownBar = computed(() => route.meta.ownBar === true);
|
|
13
13
|
const surface = computed(() => {
|
|
14
14
|
if (route.path.startsWith("/w/")) return "admin";
|
|
15
|
+
if (route.path.startsWith("/solo")) return "solo";
|
|
15
16
|
return route.path.startsWith("/account") ? "account" : "home";
|
|
16
17
|
});
|
|
17
18
|
const surfaceLabel = computed(() => ({ admin: "Admin", account: "Account" })[surface.value] || "Home");
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
// Buttons by variant and pressable chips, at rest, selected and disabled, for the state-layer baselines: every
|
|
3
|
+
// layer (a tonal underlay, a disabled or selected state layer, hover, focus and pressed) stays inside the control's
|
|
4
|
+
// shape. A pagination shows its selected page. The last rows are auth-web's: reset password's large block Update password while the form is incomplete,
|
|
5
|
+
// and the profile menu's avatar trigger, with the name and, as on phones, as an icon button.
|
|
6
|
+
const VARIANTS = Object.freeze(["flat", "tonal", "elevated", "outlined", "text"]);
|
|
7
|
+
const STATES = Object.freeze(["rest", "active", "disabled"]);
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<section class="d-flex flex-column ga-4 pa-4">
|
|
12
|
+
<div v-for="state in STATES" :key="state" class="d-flex flex-wrap ga-2">
|
|
13
|
+
<v-btn
|
|
14
|
+
v-for="variant in VARIANTS"
|
|
15
|
+
:key="variant"
|
|
16
|
+
:variant="variant"
|
|
17
|
+
:active="state === 'active'"
|
|
18
|
+
:disabled="state === 'disabled'"
|
|
19
|
+
:data-testid="`state-${variant}-${state}`"
|
|
20
|
+
>
|
|
21
|
+
{{ variant }}
|
|
22
|
+
</v-btn>
|
|
23
|
+
<v-btn
|
|
24
|
+
icon="$edit"
|
|
25
|
+
variant="tonal"
|
|
26
|
+
:active="state === 'active'"
|
|
27
|
+
:disabled="state === 'disabled'"
|
|
28
|
+
:aria-label="`Edit, ${state}`"
|
|
29
|
+
:data-testid="`state-icon-${state}`"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
<v-pagination :length="5" :model-value="2" data-testid="state-pagination" />
|
|
33
|
+
<v-btn block color="primary" size="large" disabled data-testid="state-block-disabled">Update password</v-btn>
|
|
34
|
+
<div class="d-flex align-center ga-2">
|
|
35
|
+
<v-menu location="bottom end">
|
|
36
|
+
<template #activator="{ props: menu }">
|
|
37
|
+
<v-btn v-bind="menu" variant="text" class="text-none pl-1 pr-2" data-testid="state-profile">
|
|
38
|
+
<v-avatar size="32" color="primary" variant="tonal">
|
|
39
|
+
<span class="text-body-small font-weight-medium">AL</span>
|
|
40
|
+
</v-avatar>
|
|
41
|
+
<span class="ml-2 text-body-medium">Ada Lovelace</span>
|
|
42
|
+
</v-btn>
|
|
43
|
+
</template>
|
|
44
|
+
<v-list><v-list-item title="Account" /></v-list>
|
|
45
|
+
</v-menu>
|
|
46
|
+
<v-menu location="bottom end">
|
|
47
|
+
<template #activator="{ props: menu }">
|
|
48
|
+
<v-btn v-bind="menu" icon variant="text" aria-label="Ada Lovelace" data-testid="state-profile-icon">
|
|
49
|
+
<v-avatar size="32" color="primary" variant="tonal">
|
|
50
|
+
<span class="text-body-small font-weight-medium">AL</span>
|
|
51
|
+
</v-avatar>
|
|
52
|
+
</v-btn>
|
|
53
|
+
</template>
|
|
54
|
+
<v-list><v-list-item title="Account" /></v-list>
|
|
55
|
+
</v-menu>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="d-flex flex-wrap ga-2">
|
|
58
|
+
<v-chip link variant="tonal" data-testid="state-chip-tonal">Tonal chip</v-chip>
|
|
59
|
+
<v-chip link data-testid="state-chip-link">Assist chip</v-chip>
|
|
60
|
+
<v-chip link disabled data-testid="state-chip-disabled">Disabled chip</v-chip>
|
|
61
|
+
</div>
|
|
62
|
+
</section>
|
|
63
|
+
</template>
|
|
@@ -1,15 +1,45 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
|
|
2
4
|
// Every button size with its 48dp touch target, a label longer than its button, a small button in the corner of a
|
|
3
|
-
// scroll container, the FAB sizes and cards by variant.
|
|
5
|
+
// scroll container, rows of adjacent icon buttons, the FAB sizes and cards by variant.
|
|
4
6
|
const sizes = ["x-small", "small", "default", "large"];
|
|
7
|
+
const pressed = ref("");
|
|
5
8
|
</script>
|
|
6
9
|
|
|
7
10
|
<template>
|
|
8
11
|
<section class="d-flex flex-column align-start ga-8 pa-6">
|
|
9
12
|
<template v-for="size in sizes" :key="size">
|
|
10
|
-
<v-btn :size="size" variant="tonal" :data-testid="`fixture-button-${size}`">Size {{ size }}</v-btn>
|
|
11
|
-
<v-btn :size="size" icon="$close" :aria-label="`Close ${size}`" :data-testid="`fixture-icon-button-${size}`"
|
|
13
|
+
<div><v-btn :size="size" variant="tonal" :data-testid="`fixture-button-${size}`">Size {{ size }}</v-btn></div>
|
|
14
|
+
<div><v-btn :size="size" icon="$close" :aria-label="`Close ${size}`" :data-testid="`fixture-icon-button-${size}`" /></div>
|
|
12
15
|
</template>
|
|
16
|
+
<!-- A table row's compact actions, touching, and a selected tab's comfortable pair, 2px apart. -->
|
|
17
|
+
<div class="d-flex" data-testid="fixture-adjacent-compact">
|
|
18
|
+
<v-btn
|
|
19
|
+
v-for="name in ['history', 'edit', 'more']"
|
|
20
|
+
:key="name"
|
|
21
|
+
density="compact"
|
|
22
|
+
variant="text"
|
|
23
|
+
:icon="name === 'more' ? '$moreVert' : `$${name}`"
|
|
24
|
+
:aria-label="name"
|
|
25
|
+
:data-testid="`fixture-adjacent-${name}`"
|
|
26
|
+
@click="pressed = name"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="d-flex ga-0" :style="{ columnGap: '2px' }" data-testid="fixture-adjacent-comfortable">
|
|
30
|
+
<v-btn
|
|
31
|
+
v-for="name in ['info', 'archive']"
|
|
32
|
+
:key="name"
|
|
33
|
+
density="comfortable"
|
|
34
|
+
size="small"
|
|
35
|
+
variant="text"
|
|
36
|
+
:icon="name === 'info' ? '$info' : '$inbox'"
|
|
37
|
+
:aria-label="name"
|
|
38
|
+
:data-testid="`fixture-adjacent-${name}`"
|
|
39
|
+
@click="pressed = name"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
<output data-testid="fixture-adjacent-pressed">{{ pressed }}</output>
|
|
13
43
|
<div :style="{ width: '160px' }">
|
|
14
44
|
<v-btn variant="tonal" data-testid="fixture-long-label">A label far longer than the room it has</v-btn>
|
|
15
45
|
</div>
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { nextTick, ref } from "vue";
|
|
3
|
+
import { usePaths } from "../../../src/client/navigation/usePaths.js";
|
|
4
|
+
|
|
5
|
+
// Material 3 components as JSKIT's defaults draw them: a segmented button, filter chips (in a chip group and toggled
|
|
6
|
+
// with aria-pressed), fixed tabs that share a phone's width or scroll, a menu's own list beside a list in a rich menu
|
|
7
|
+
// panel, dialog actions, a disabled filled button, a card and expansion panels at rest, a pagination's current page,
|
|
8
|
+
// placeholders, a button to the page above this one, which isn't active here, and a segmented button and a button
|
|
9
|
+
// group in the narrow `auto` column of a filter row, beside wide fields, and a dialog holding a virtual-scroll list
|
|
10
|
+
// that jumps to its last item as the expansion panel around it re-renders.
|
|
11
|
+
const paths = usePaths();
|
|
12
|
+
const page = ref(2);
|
|
13
|
+
const view = ref("day");
|
|
14
|
+
const target = ref("pet");
|
|
15
|
+
const statuses = ref(["open"]);
|
|
16
|
+
const starred = ref(true);
|
|
17
|
+
const tab = ref("mon");
|
|
18
|
+
const longTab = ref("everything");
|
|
19
|
+
const dialog = ref(false);
|
|
20
|
+
const bookingsDialog = ref(false);
|
|
21
|
+
const bookings = Array.from({ length: 40 }, (_, index) => `Booking ${index + 1}`);
|
|
22
|
+
const bookingsScroll = ref(null);
|
|
23
|
+
const pageRenders = ref(0);
|
|
24
|
+
// The panel around the dialog re-renders first (as a form does when a field changes), then the list scrolls to its
|
|
25
|
+
// last item.
|
|
26
|
+
function jumpToLastBooking() {
|
|
27
|
+
pageRenders.value += 1;
|
|
28
|
+
nextTick(() => bookingsScroll.value?.scrollToIndex(bookings.length - 1));
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<section class="d-flex flex-column align-start ga-6 py-4">
|
|
34
|
+
<v-btn-toggle v-model="view" mandatory data-testid="fixture-segmented">
|
|
35
|
+
<v-btn value="day">Day</v-btn>
|
|
36
|
+
<v-btn value="week">Week</v-btn>
|
|
37
|
+
<v-btn value="month" prepend-icon="$calendar">Month</v-btn>
|
|
38
|
+
</v-btn-toggle>
|
|
39
|
+
|
|
40
|
+
<div class="fixture-filter-row align-self-stretch" data-testid="fixture-filter-row">
|
|
41
|
+
<v-btn-toggle v-model="target" mandatory color="primary" divided data-testid="fixture-segmented-two">
|
|
42
|
+
<v-btn value="pet">Pet</v-btn>
|
|
43
|
+
<v-btn value="contact">Customer</v-btn>
|
|
44
|
+
</v-btn-toggle>
|
|
45
|
+
<v-text-field label="Customer" hide-details />
|
|
46
|
+
<v-text-field label="Search history" hide-details />
|
|
47
|
+
<v-text-field label="From" hide-details />
|
|
48
|
+
<v-text-field label="To" hide-details />
|
|
49
|
+
<v-text-field label="Kind" hide-details />
|
|
50
|
+
<v-btn-group divided data-testid="fixture-button-group">
|
|
51
|
+
<v-btn>Day</v-btn>
|
|
52
|
+
<v-btn>Week</v-btn>
|
|
53
|
+
<v-btn>Month</v-btn>
|
|
54
|
+
</v-btn-group>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<v-chip-group v-model="statuses" multiple column data-testid="fixture-chip-group">
|
|
58
|
+
<v-chip value="open" data-testid="fixture-chip-open">Open</v-chip>
|
|
59
|
+
<v-chip value="closed" data-testid="fixture-chip-closed">Closed</v-chip>
|
|
60
|
+
</v-chip-group>
|
|
61
|
+
<div class="d-flex ga-2">
|
|
62
|
+
<v-chip
|
|
63
|
+
tag="button"
|
|
64
|
+
type="button"
|
|
65
|
+
:aria-pressed="starred ? 'true' : 'false'"
|
|
66
|
+
data-testid="fixture-pressed-chip"
|
|
67
|
+
@click="starred = !starred"
|
|
68
|
+
>
|
|
69
|
+
Starred
|
|
70
|
+
</v-chip>
|
|
71
|
+
<v-chip variant="outlined" data-testid="fixture-outlined-chip">Assist</v-chip>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<v-tabs v-model="tab" grow class="align-self-stretch" data-testid="fixture-grow-tabs">
|
|
75
|
+
<v-tab value="mon">Mon</v-tab>
|
|
76
|
+
<v-tab value="tue">Tue</v-tab>
|
|
77
|
+
<v-tab value="wed">Wed</v-tab>
|
|
78
|
+
<v-tab value="thu">Thu</v-tab>
|
|
79
|
+
<v-tab value="fri">Fri</v-tab>
|
|
80
|
+
</v-tabs>
|
|
81
|
+
<v-tabs v-model="longTab" grow class="align-self-stretch" data-testid="fixture-long-tabs">
|
|
82
|
+
<v-tab value="everything">Everything on the account</v-tab>
|
|
83
|
+
<v-tab value="bookings">Bookings and their invoices</v-tab>
|
|
84
|
+
<v-tab value="team">Settings for the whole team</v-tab>
|
|
85
|
+
<v-tab value="alerts">Notifications</v-tab>
|
|
86
|
+
</v-tabs>
|
|
87
|
+
|
|
88
|
+
<div class="d-flex ga-2">
|
|
89
|
+
<v-menu>
|
|
90
|
+
<template #activator="{ props: menu }">
|
|
91
|
+
<v-btn variant="text" v-bind="menu">Plain menu</v-btn>
|
|
92
|
+
</template>
|
|
93
|
+
<v-list data-testid="fixture-menu-list">
|
|
94
|
+
<v-list-item title="First" />
|
|
95
|
+
</v-list>
|
|
96
|
+
</v-menu>
|
|
97
|
+
<v-menu>
|
|
98
|
+
<template #activator="{ props: menu }">
|
|
99
|
+
<v-btn variant="text" v-bind="menu">Rich menu</v-btn>
|
|
100
|
+
</template>
|
|
101
|
+
<v-card data-testid="fixture-menu-panel">
|
|
102
|
+
<v-card-text>A rich menu panel.</v-card-text>
|
|
103
|
+
<v-list data-testid="fixture-panel-list">
|
|
104
|
+
<v-list-item title="Inside the panel" />
|
|
105
|
+
</v-list>
|
|
106
|
+
</v-card>
|
|
107
|
+
</v-menu>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<v-btn disabled data-testid="fixture-disabled-button">Update password</v-btn>
|
|
111
|
+
<v-btn :to="paths.page('/')" data-testid="fixture-home-button">Start your first session</v-btn>
|
|
112
|
+
<v-pagination v-model="page" :length="5" data-testid="fixture-pagination" />
|
|
113
|
+
<v-text-field placeholder="Search contacts" class="align-self-stretch" data-testid="fixture-placeholder" />
|
|
114
|
+
<v-text-field label="Name" placeholder="Ada Lovelace" class="align-self-stretch" data-testid="fixture-labelled" />
|
|
115
|
+
<v-card class="align-self-stretch" data-testid="fixture-card">
|
|
116
|
+
<v-card-text>A card at rest.</v-card-text>
|
|
117
|
+
</v-card>
|
|
118
|
+
<v-expansion-panels data-testid="fixture-expansion-panels">
|
|
119
|
+
<v-expansion-panel title="Delivery" text="Delivered on Tuesdays." />
|
|
120
|
+
<v-expansion-panel title="Returns" text="Returned within 30 days." />
|
|
121
|
+
</v-expansion-panels>
|
|
122
|
+
|
|
123
|
+
<v-btn variant="text" @click="dialog = true">Open dialog</v-btn>
|
|
124
|
+
<!-- An expansion panel draws its content in a defaults provider it rebuilds whenever it re-renders, here when its
|
|
125
|
+
title changes, so the dialog inside it receives new defaults, and the list its items anew, as a list mapped
|
|
126
|
+
or filtered in a template does. -->
|
|
127
|
+
<v-expansion-panels :model-value="['bookings']" multiple>
|
|
128
|
+
<v-expansion-panel value="bookings" :title="`Bookings, changed ${pageRenders} times`">
|
|
129
|
+
<v-expansion-panel-text>
|
|
130
|
+
<v-btn variant="text" @click="bookingsDialog = true">Open bookings</v-btn>
|
|
131
|
+
<output data-testid="fixture-page-renders">{{ pageRenders }}</output>
|
|
132
|
+
<v-dialog v-model="bookingsDialog" max-width="400">
|
|
133
|
+
<v-virtual-scroll
|
|
134
|
+
ref="bookingsScroll"
|
|
135
|
+
:items="bookings.map((title) => ({ title }))"
|
|
136
|
+
height="240"
|
|
137
|
+
data-testid="fixture-bookings-scroll"
|
|
138
|
+
>
|
|
139
|
+
<template #default="{ item }">
|
|
140
|
+
<v-list-item :title="item.title" />
|
|
141
|
+
</template>
|
|
142
|
+
</v-virtual-scroll>
|
|
143
|
+
<v-btn @click="jumpToLastBooking">Last booking</v-btn>
|
|
144
|
+
</v-dialog>
|
|
145
|
+
</v-expansion-panel-text>
|
|
146
|
+
</v-expansion-panel>
|
|
147
|
+
</v-expansion-panels>
|
|
148
|
+
<v-dialog v-model="dialog" max-width="400">
|
|
149
|
+
<v-card title="Discard draft?" text="The draft is not saved." data-testid="fixture-dialog">
|
|
150
|
+
<v-card-actions>
|
|
151
|
+
<v-btn @click="dialog = false">Cancel</v-btn>
|
|
152
|
+
<v-btn @click="dialog = false">Discard</v-btn>
|
|
153
|
+
</v-card-actions>
|
|
154
|
+
</v-card>
|
|
155
|
+
</v-dialog>
|
|
156
|
+
</section>
|
|
157
|
+
</template>
|
|
158
|
+
|
|
159
|
+
<style scoped>
|
|
160
|
+
/* A filter row as an app lays one out: the segmented button and the button group in `auto` columns beside wide
|
|
161
|
+
fields, so their segments get only the room their own padding and labels need. At 1440 the row is 1032px and the
|
|
162
|
+
fields' minimums (34rem) leave the two auto columns 416px: whole labels need 381px with 12dp segments and 501px
|
|
163
|
+
with a common button's 24dp sides. One column on a narrow window. */
|
|
164
|
+
.fixture-filter-row {
|
|
165
|
+
align-items: end;
|
|
166
|
+
display: grid;
|
|
167
|
+
gap: 12px;
|
|
168
|
+
grid-template-columns: auto minmax(8rem, 1.2fr) minmax(8rem, 1.2fr) minmax(6rem, 0.7fr) minmax(6rem, 0.7fr) minmax(6rem, 1fr) auto;
|
|
169
|
+
max-width: 1100px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media (max-width: 1279px) {
|
|
173
|
+
.fixture-filter-row {
|
|
174
|
+
grid-template-columns: minmax(0, 1fr);
|
|
175
|
+
justify-items: start;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactive } from "vue";
|
|
3
|
+
import ShellPageAction from "@jskit-ai/shell-web/client/components/ShellPageAction";
|
|
4
|
+
import ShellPageActions from "@jskit-ai/shell-web/client/components/ShellPageActions";
|
|
5
|
+
import { useShellWebErrorRuntime } from "@jskit-ai/shell-web/client/error";
|
|
6
|
+
|
|
7
|
+
// Every press reports a success snackbar, as a saved form does, and counts, so a test sees each press that landed.
|
|
8
|
+
// The form's Save sits at the bottom end of the content, right above the FAB, where a snackbar could cover them.
|
|
9
|
+
const errorRuntime = useShellWebErrorRuntime();
|
|
10
|
+
const presses = reactive({ bar: 0, form: 0, fab: 0 });
|
|
11
|
+
|
|
12
|
+
function press(name) {
|
|
13
|
+
presses[name] += 1;
|
|
14
|
+
errorRuntime.report({
|
|
15
|
+
source: `fixture.feedback.${name}`,
|
|
16
|
+
message: "Integration configuration saved.",
|
|
17
|
+
intent: "action-feedback",
|
|
18
|
+
severity: "success",
|
|
19
|
+
channel: "snackbar"
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<section class="feedback-page" data-testid="fixture-feedback">
|
|
26
|
+
<ShellPageActions>
|
|
27
|
+
<ShellPageAction primary label="Save" data-testid="fixture-bar-save" @click="press('bar')" />
|
|
28
|
+
</ShellPageActions>
|
|
29
|
+
<output class="text-body-medium pa-4" data-testid="fixture-presses">{{ presses.bar }} {{ presses.form }} {{ presses.fab }}</output>
|
|
30
|
+
<v-card class="ma-4">
|
|
31
|
+
<v-card-text>
|
|
32
|
+
<v-text-field label="Name" model-value="Ada" hide-details />
|
|
33
|
+
</v-card-text>
|
|
34
|
+
<v-card-actions class="justify-end">
|
|
35
|
+
<v-btn color="primary" variant="flat" data-testid="fixture-form-save" @click="press('form')">Save</v-btn>
|
|
36
|
+
</v-card-actions>
|
|
37
|
+
</v-card>
|
|
38
|
+
<v-fab
|
|
39
|
+
app
|
|
40
|
+
layout
|
|
41
|
+
extended
|
|
42
|
+
location="bottom end"
|
|
43
|
+
order="1"
|
|
44
|
+
prepend-icon="$add"
|
|
45
|
+
text="New"
|
|
46
|
+
data-testid="fixture-feedback-fab"
|
|
47
|
+
@click="press('fab')"
|
|
48
|
+
/>
|
|
49
|
+
</section>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.feedback-page {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
justify-content: space-between;
|
|
57
|
+
min-height: calc(100dvh - var(--v-layout-top, 0px) - var(--v-layout-bottom, 0px));
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useRoute } from "vue-router";
|
|
4
|
+
import ShellOutlet from "@jskit-ai/shell-web/client/components/ShellOutlet";
|
|
5
|
+
|
|
6
|
+
const route = useRoute();
|
|
7
|
+
const section = computed(() => String(route.params.section || ""));
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<section class="reports-page" data-testid="fixture-reports">
|
|
12
|
+
<!-- Material 3 primary tabs: one row over a divider, scrolling sideways when the tabs don't fit. -->
|
|
13
|
+
<nav class="reports-page__tabs" aria-label="Report sections" data-testid="fixture-section-tabs">
|
|
14
|
+
<ShellOutlet target="reports:section-nav" />
|
|
15
|
+
</nav>
|
|
16
|
+
<nav class="reports-page__tabs" aria-label="Report views" data-testid="fixture-bar-items-in-page">
|
|
17
|
+
<ShellOutlet target="reports-views:section-nav" />
|
|
18
|
+
</nav>
|
|
19
|
+
<p class="text-body-medium pa-4" data-testid="fixture-report-section">{{ section }}</p>
|
|
20
|
+
</section>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.reports-page__tabs {
|
|
25
|
+
border-bottom: 1px solid rgb(var(--v-theme-outline-variant));
|
|
26
|
+
display: flex;
|
|
27
|
+
overflow-x: auto;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
// One of the top app bar's own items (an app's tools, status or avatar), from a top-right placement.
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
icon: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: true
|
|
7
|
+
},
|
|
8
|
+
label: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<v-btn :icon="props.icon" variant="text" color="on-surface-variant" :aria-label="props.label" data-testid="fixture-status" />
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useShellPageTitle } from "../../../src/client/composables/useShellPageTitle.js";
|
|
3
|
+
|
|
4
|
+
// A nested component that claims the app bar title while it lives.
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
title: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
useShellPageTitle(() => props.title);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<p data-testid="fixture-title-claim">{{ props.title }}</p>
|
|
17
|
+
</template>
|