@adia-ai/web-components 0.8.6 → 0.8.8
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 +14 -0
- package/README.md +3 -3
- package/dist/host.min.css +1 -1
- package/dist/host.sheet.js +1 -1
- package/dist/theme-provider.min.js +2 -2
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +1 -1
- package/dist/web-components.sheet.js +1 -1
- package/package.json +2 -1
- package/patterns/access-requests/access-requests.examples.html +132 -0
- package/patterns/access-requests/access-requests.html +60 -0
- package/patterns/admin-keys-and-export/admin-keys-and-export.examples.html +236 -0
- package/patterns/admin-keys-and-export/admin-keys-and-export.html +64 -0
- package/patterns/admin-shell/admin-shell.examples.html +327 -0
- package/patterns/admin-shell/admin-shell.html +44 -0
- package/patterns/agent-cost/agent-cost.examples.html +111 -0
- package/patterns/agent-cost/agent-cost.html +62 -0
- package/patterns/agent-memory/agent-memory.examples.html +155 -0
- package/patterns/agent-memory/agent-memory.html +64 -0
- package/patterns/agent-prompt-library/agent-prompt-library.examples.html +181 -0
- package/patterns/agent-prompt-library/agent-prompt-library.html +64 -0
- package/patterns/agent-tool-call/agent-tool-call.examples.html +123 -0
- package/patterns/agent-tool-call/agent-tool-call.html +60 -0
- package/patterns/alert-dialog/alert-dialog.examples.html +105 -0
- package/patterns/alert-dialog/alert-dialog.html +57 -0
- package/patterns/app-nav/app-nav.examples.html +421 -0
- package/patterns/app-nav/app-nav.html +50 -0
- package/patterns/approvals/approvals.examples.html +131 -0
- package/patterns/approvals/approvals.html +58 -0
- package/patterns/audit-log/audit-log.examples.html +74 -0
- package/patterns/audit-log/audit-log.examples.js +60 -0
- package/patterns/audit-log/audit-log.html +63 -0
- package/patterns/bulk-action-toolbar/bulk-action-toolbar.examples.html +89 -0
- package/patterns/bulk-action-toolbar/bulk-action-toolbar.examples.js +69 -0
- package/patterns/bulk-action-toolbar/bulk-action-toolbar.html +62 -0
- package/patterns/changelog-feed/changelog-feed.examples.html +151 -0
- package/patterns/changelog-feed/changelog-feed.html +57 -0
- package/patterns/chart-in-card/chart-in-card.examples.html +193 -0
- package/patterns/chart-in-card/chart-in-card.examples.js +46 -0
- package/patterns/chart-in-card/chart-in-card.html +66 -0
- package/patterns/chat-shell/chat-shell.examples.html +129 -0
- package/patterns/chat-shell/chat-shell.html +46 -0
- package/patterns/comments-and-collaboration/comments-and-collaboration.examples.html +241 -0
- package/patterns/comments-and-collaboration/comments-and-collaboration.html +66 -0
- package/patterns/component-tokens/component-tokens.examples.html +483 -0
- package/patterns/component-tokens/component-tokens.html +42 -0
- package/patterns/conversion-funnel/conversion-funnel.examples.html +158 -0
- package/patterns/conversion-funnel/conversion-funnel.examples.js +4 -0
- package/patterns/conversion-funnel/conversion-funnel.html +64 -0
- package/patterns/data-tables-inline-edit-and-tree/data-tables-inline-edit-and-tree.examples.html +196 -0
- package/patterns/data-tables-inline-edit-and-tree/data-tables-inline-edit-and-tree.html +58 -0
- package/patterns/diff-review/diff-review.examples.html +147 -0
- package/patterns/diff-review/diff-review.html +56 -0
- package/patterns/editor-shell/editor-shell.examples.html +139 -0
- package/patterns/editor-shell/editor-shell.html +62 -0
- package/patterns/export-flow/export-flow.examples.html +152 -0
- package/patterns/export-flow/export-flow.examples.js +37 -0
- package/patterns/export-flow/export-flow.html +65 -0
- package/patterns/filter-bar/filter-bar.examples.html +116 -0
- package/patterns/filter-bar/filter-bar.examples.js +23 -0
- package/patterns/filter-bar/filter-bar.html +70 -0
- package/patterns/form-drawer/form-drawer.examples.html +210 -0
- package/patterns/form-drawer/form-drawer.html +64 -0
- package/patterns/form-system/form-system.examples.html +383 -0
- package/patterns/form-system/form-system.html +48 -0
- package/patterns/forms-conditional-and-autocomplete/forms-conditional-and-autocomplete.examples.html +189 -0
- package/patterns/forms-conditional-and-autocomplete/forms-conditional-and-autocomplete.html +64 -0
- package/patterns/inline-dialog/inline-dialog.examples.html +143 -0
- package/patterns/inline-dialog/inline-dialog.html +59 -0
- package/patterns/kanban-board/kanban-board.examples.html +224 -0
- package/patterns/kanban-board/kanban-board.html +58 -0
- package/patterns/layout/layout.examples.html +365 -0
- package/patterns/layout/layout.html +54 -0
- package/patterns/marketing-engagement/marketing-engagement.examples.html +280 -0
- package/patterns/marketing-engagement/marketing-engagement.html +64 -0
- package/patterns/notifications-bell-and-digest/notifications-bell-and-digest.examples.html +213 -0
- package/patterns/notifications-bell-and-digest/notifications-bell-and-digest.html +58 -0
- package/patterns/overview/overview.examples.html +119 -0
- package/patterns/overview/overview.html +42 -0
- package/patterns/permissions-matrix/permissions-matrix.examples.html +91 -0
- package/patterns/permissions-matrix/permissions-matrix.examples.js +28 -0
- package/patterns/permissions-matrix/permissions-matrix.html +56 -0
- package/patterns/permissions-role-picker/permissions-role-picker.examples.html +81 -0
- package/patterns/permissions-role-picker/permissions-role-picker.html +56 -0
- package/patterns/permissions-sharing/permissions-sharing.examples.html +175 -0
- package/patterns/permissions-sharing/permissions-sharing.html +66 -0
- package/patterns/profile-public-and-verification/profile-public-and-verification.examples.html +227 -0
- package/patterns/profile-public-and-verification/profile-public-and-verification.html +70 -0
- package/patterns/record-detail-drawer/record-detail-drawer.examples.html +164 -0
- package/patterns/record-detail-drawer/record-detail-drawer.html +64 -0
- package/patterns/responsive-shell-sidebar/README.md +37 -0
- package/patterns/responsive-shell-sidebar/responsive-shell-sidebar.css +39 -0
- package/patterns/responsive-shell-sidebar/responsive-shell-sidebar.examples.html +208 -0
- package/patterns/responsive-shell-sidebar/responsive-shell-sidebar.html +47 -0
- package/patterns/retention-cohort/retention-cohort.examples.html +149 -0
- package/patterns/retention-cohort/retention-cohort.examples.js +37 -0
- package/patterns/retention-cohort/retention-cohort.html +62 -0
- package/patterns/search-discovery/search-discovery.examples.html +263 -0
- package/patterns/search-discovery/search-discovery.html +58 -0
- package/patterns/system-banners/system-banners.examples.html +150 -0
- package/patterns/system-banners/system-banners.html +52 -0
- package/patterns/timezone-selector/timezone-selector.examples.html +82 -0
- package/patterns/timezone-selector/timezone-selector.examples.js +72 -0
- package/patterns/timezone-selector/timezone-selector.html +57 -0
- package/patterns/wizard-drawer/wizard-drawer.examples.html +144 -0
- package/patterns/wizard-drawer/wizard-drawer.examples.js +33 -0
- package/patterns/wizard-drawer/wizard-drawer.html +72 -0
- package/styles/type/roles.css +8 -8
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Filter bar pattern — populate demo table */
|
|
2
|
+
|
|
3
|
+
const columns = [
|
|
4
|
+
{ key: 'name', label: 'Name' },
|
|
5
|
+
{ key: 'owner', label: 'Owner' },
|
|
6
|
+
{ key: 'status', label: 'Status', render: (val) => {
|
|
7
|
+
const v = { Active: 'success', Draft: 'muted' }[val] || '';
|
|
8
|
+
return `<badge-ui text="${val}" variant="${v}"></badge-ui>`;
|
|
9
|
+
}},
|
|
10
|
+
{ key: 'updated', label: 'Updated' },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const data = [
|
|
14
|
+
{ name: 'Q4 roadmap', owner: 'Alex Chen', status: 'Active', updated: '2h ago' },
|
|
15
|
+
{ name: 'Design review', owner: 'Alex Chen', status: 'Active', updated: '5h ago' },
|
|
16
|
+
{ name: 'API v2 spec', owner: 'Alex Chen', status: 'Active', updated: '1w ago' },
|
|
17
|
+
{ name: 'Brand guidelines',owner: 'Alex Chen', status: 'Draft', updated: '3d ago' },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export default function setup(router) {
|
|
21
|
+
const table = router.querySelector('#pat-filter-table');
|
|
22
|
+
if (table) { table.columns = columns; table.data = data; }
|
|
23
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" theme="auto">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Filter Bar (pattern) — AdiaUI</title>
|
|
7
|
+
|
|
8
|
+
<!-- Token base -->
|
|
9
|
+
<link rel="stylesheet" href="../../styles/resets.css">
|
|
10
|
+
<link rel="stylesheet" href="../../styles/tokens.css">
|
|
11
|
+
|
|
12
|
+
<!-- Component CSS — primitives this pattern composes -->
|
|
13
|
+
<link rel="stylesheet" href="../../components/action-list/action-list.css">
|
|
14
|
+
<link rel="stylesheet" href="../../components/button/button.css">
|
|
15
|
+
<link rel="stylesheet" href="../../components/card/card.css">
|
|
16
|
+
<link rel="stylesheet" href="../../components/code/code.css">
|
|
17
|
+
<link rel="stylesheet" href="../../components/popover/popover.css">
|
|
18
|
+
<link rel="stylesheet" href="../../components/row/row.css">
|
|
19
|
+
<link rel="stylesheet" href="../../components/search/search.css">
|
|
20
|
+
<link rel="stylesheet" href="../../components/segment/segment.css">
|
|
21
|
+
<link rel="stylesheet" href="../../components/segmented/segmented.css">
|
|
22
|
+
<link rel="stylesheet" href="../../components/table/table.css">
|
|
23
|
+
<link rel="stylesheet" href="../../components/tag/tag.css">
|
|
24
|
+
<link rel="stylesheet" href="../../components/text/text.css">
|
|
25
|
+
<link rel="stylesheet" href="../../components/toolbar/toolbar.css">
|
|
26
|
+
|
|
27
|
+
<!-- Component JS -->
|
|
28
|
+
<script type="module" src="../../components/action-list/action-list.js"></script>
|
|
29
|
+
<script type="module" src="../../components/button/button.js"></script>
|
|
30
|
+
<script type="module" src="../../components/card/card.js"></script>
|
|
31
|
+
<script type="module" src="../../components/code/code.js"></script>
|
|
32
|
+
<script type="module" src="../../components/popover/popover.js"></script>
|
|
33
|
+
<script type="module" src="../../components/row/row.js"></script>
|
|
34
|
+
<script type="module" src="../../components/search/search.js"></script>
|
|
35
|
+
<script type="module" src="../../components/segment/segment.js"></script>
|
|
36
|
+
<script type="module" src="../../components/segmented/segmented.js"></script>
|
|
37
|
+
<script type="module" src="../../components/table/table.js"></script>
|
|
38
|
+
<script type="module" src="../../components/tag/tag.js"></script>
|
|
39
|
+
<script type="module" src="../../components/text/text.js"></script>
|
|
40
|
+
<script type="module" src="../../components/toolbar/toolbar.js"></script>
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
:where(html, body) { margin: 0; min-height: 100vh; background: var(--md-sys-color-neutral-background); color: var(--md-sys-color-neutral-on-surface); font-family: var(--a-font-family); }
|
|
44
|
+
main { max-width: 960px; margin-inline: auto; padding: var(--a-space-6) var(--a-space-5); }
|
|
45
|
+
</style>
|
|
46
|
+
</head>
|
|
47
|
+
<body>
|
|
48
|
+
|
|
49
|
+
<main id="demo-root">
|
|
50
|
+
<p>Loading examples…</p>
|
|
51
|
+
</main>
|
|
52
|
+
|
|
53
|
+
<script type="module">
|
|
54
|
+
const root = document.getElementById('demo-root');
|
|
55
|
+
try {
|
|
56
|
+
const res = await fetch('./filter-bar.examples.html');
|
|
57
|
+
if (!res.ok) throw new Error(`fetch failed (${res.status})`);
|
|
58
|
+
root.innerHTML = await res.text();
|
|
59
|
+
try {
|
|
60
|
+
const mod = await import(/* @vite-ignore */ './filter-bar.examples.js');
|
|
61
|
+
mod.default?.(root);
|
|
62
|
+
} catch (e) { console.error('[filter-bar.html] setup failed:', e); }
|
|
63
|
+
} catch (err) {
|
|
64
|
+
root.innerHTML = `<p style="color:var(--a-danger-strong);">Failed to load filter-bar.examples.html — ${err.message}</p>`;
|
|
65
|
+
console.error('[filter-bar.html]', err);
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
</body>
|
|
70
|
+
</html>
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
<header>
|
|
2
|
+
<div>
|
|
3
|
+
<h1>Form Drawer</h1>
|
|
4
|
+
<div data-actions>
|
|
5
|
+
<tag-ui size="sm">drawer-ui</tag-ui> <tag-ui size="sm">header</tag-ui> <tag-ui size="sm">body</tag-ui> <tag-ui size="sm">footer</tag-ui>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
<p>Side-opening drawer with a sticky action row. The most common drawer shape in admin tools: header names the task, body scrolls the form, footer pins Cancel/Save so they stay reachable without scrolling.</p>
|
|
9
|
+
</header>
|
|
10
|
+
|
|
11
|
+
<section data-section data-property="when-to-use">
|
|
12
|
+
<h2 variant="section">When to use</h2>
|
|
13
|
+
<p data-note>
|
|
14
|
+
Create/edit flows that fit in one screen's worth of fields. A modal is fine for
|
|
15
|
+
2–3 fields, a full page for 20+ fields. The drawer occupies the middle ground and
|
|
16
|
+
keeps the list context visible behind it.
|
|
17
|
+
</p>
|
|
18
|
+
</section>
|
|
19
|
+
|
|
20
|
+
<section data-section data-property="simple-form">
|
|
21
|
+
<h2 variant="section">Simple create form</h2>
|
|
22
|
+
<p data-note>3–5 fields with primary + cancel actions. The default shape for "+ New X" triggers.</p>
|
|
23
|
+
<div data-artifact-container>
|
|
24
|
+
<div data-artifact-item data-artifact-label="create form">
|
|
25
|
+
<button-ui data-chunk="form-drawer-simple-form" text="+ New project" variant="primary" onclick="this.nextElementSibling.open=true"></button-ui>
|
|
26
|
+
<drawer-ui text="New project" side="right" size="md">
|
|
27
|
+
<section slot="body">
|
|
28
|
+
<col-ui gap="3">
|
|
29
|
+
<field-ui label="Name">
|
|
30
|
+
<input-ui placeholder="My awesome project" required></input-ui>
|
|
31
|
+
</field-ui>
|
|
32
|
+
<field-ui label="Description">
|
|
33
|
+
<textarea-ui placeholder="What is this project for?" rows="3"></textarea-ui>
|
|
34
|
+
</field-ui>
|
|
35
|
+
<field-ui label="Visibility">
|
|
36
|
+
<select-ui placeholder="Select visibility">
|
|
37
|
+
<option value="public">Public</option>
|
|
38
|
+
<option value="team">Team only</option>
|
|
39
|
+
<option value="private">Private</option>
|
|
40
|
+
</select-ui>
|
|
41
|
+
</field-ui>
|
|
42
|
+
</col-ui>
|
|
43
|
+
</section>
|
|
44
|
+
<footer slot="footer">
|
|
45
|
+
<span slot="action">
|
|
46
|
+
<button-ui text="Cancel" variant="ghost" onclick="this.closest('drawer-ui').open=false"></button-ui>
|
|
47
|
+
<button-ui text="Create" variant="primary" onclick="this.closest('drawer-ui').open=false"></button-ui>
|
|
48
|
+
</span>
|
|
49
|
+
</footer>
|
|
50
|
+
</drawer-ui>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</section>
|
|
54
|
+
|
|
55
|
+
<section data-section data-property="edit-form">
|
|
56
|
+
<h2 variant="section">Edit form with destructive action</h2>
|
|
57
|
+
<p data-note>Edit drawers pair a primary action with a destructive one in the footer. Delete sits on the left, Save on the right — separated by the spacer.</p>
|
|
58
|
+
<div data-artifact-container>
|
|
59
|
+
<div data-artifact-item data-artifact-label="edit form">
|
|
60
|
+
<button-ui data-chunk="form-drawer-edit-form" text="Edit project" icon="pencil" variant="outline" onclick="this.nextElementSibling.open=true"></button-ui>
|
|
61
|
+
<drawer-ui text="Edit project" side="right" size="md">
|
|
62
|
+
<section slot="body">
|
|
63
|
+
<col-ui gap="3">
|
|
64
|
+
<field-ui label="Name">
|
|
65
|
+
<input-ui value="Q4 roadmap"></input-ui>
|
|
66
|
+
</field-ui>
|
|
67
|
+
<field-ui label="Description">
|
|
68
|
+
<textarea-ui rows="3">Quarterly planning doc</textarea-ui>
|
|
69
|
+
</field-ui>
|
|
70
|
+
<field-ui label="Status">
|
|
71
|
+
<select-ui>
|
|
72
|
+
<option value="active" selected>Active</option>
|
|
73
|
+
<option value="archived">Archived</option>
|
|
74
|
+
</select-ui>
|
|
75
|
+
</field-ui>
|
|
76
|
+
<field-ui label="Notify team members" inline>
|
|
77
|
+
<switch-ui checked></switch-ui>
|
|
78
|
+
</field-ui>
|
|
79
|
+
</col-ui>
|
|
80
|
+
</section>
|
|
81
|
+
<footer slot="footer">
|
|
82
|
+
<span slot="action-leading">
|
|
83
|
+
<button-ui text="Delete" icon="trash" color="danger"></button-ui>
|
|
84
|
+
</span>
|
|
85
|
+
<span slot="action">
|
|
86
|
+
<button-ui text="Cancel" variant="ghost" onclick="this.closest('drawer-ui').open=false"></button-ui>
|
|
87
|
+
<button-ui text="Save changes" variant="primary" onclick="this.closest('drawer-ui').open=false"></button-ui>
|
|
88
|
+
</span>
|
|
89
|
+
</footer>
|
|
90
|
+
</drawer-ui>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</section>
|
|
94
|
+
|
|
95
|
+
<section data-section data-property="tall-form">
|
|
96
|
+
<h2 variant="section">Long form — scroll body, sticky footer</h2>
|
|
97
|
+
<p data-note>The footer stays visible even when the form body overflows. This is why the sticky-footer pattern matters — users shouldn't have to scroll to find "Save".</p>
|
|
98
|
+
<div data-artifact-container>
|
|
99
|
+
<div data-artifact-item data-artifact-label="long form">
|
|
100
|
+
<button-ui data-chunk="form-drawer-tall-form" text="Advanced settings" icon="gear" variant="outline" onclick="this.nextElementSibling.open=true"></button-ui>
|
|
101
|
+
<drawer-ui text="Advanced settings" side="right" size="lg">
|
|
102
|
+
<section slot="body">
|
|
103
|
+
<col-ui gap="4">
|
|
104
|
+
<col-ui gap="3">
|
|
105
|
+
<h4>General</h4>
|
|
106
|
+
<field-ui label="Name">
|
|
107
|
+
<input-ui value="Production API"></input-ui>
|
|
108
|
+
</field-ui>
|
|
109
|
+
<field-ui label="Slug">
|
|
110
|
+
<input-ui prefix="/" value="production-api"></input-ui>
|
|
111
|
+
</field-ui>
|
|
112
|
+
<field-ui label="Description">
|
|
113
|
+
<textarea-ui rows="2"></textarea-ui>
|
|
114
|
+
</field-ui>
|
|
115
|
+
</col-ui>
|
|
116
|
+
<col-ui gap="3">
|
|
117
|
+
<h4>Limits</h4>
|
|
118
|
+
<range-ui label="Max concurrent requests" value="100" min="10" max="1000"></range-ui>
|
|
119
|
+
<range-ui label="Timeout (seconds)" value="30" min="5" max="300"></range-ui>
|
|
120
|
+
<range-ui label="Retry attempts" value="3" min="0" max="10"></range-ui>
|
|
121
|
+
</col-ui>
|
|
122
|
+
<col-ui gap="3">
|
|
123
|
+
<h4>Access</h4>
|
|
124
|
+
<field-ui label="Require authentication" inline>
|
|
125
|
+
<switch-ui checked></switch-ui>
|
|
126
|
+
</field-ui>
|
|
127
|
+
<field-ui label="Allow CORS" inline>
|
|
128
|
+
<switch-ui checked></switch-ui>
|
|
129
|
+
</field-ui>
|
|
130
|
+
<field-ui label="Rate limit by IP" inline>
|
|
131
|
+
<switch-ui></switch-ui>
|
|
132
|
+
</field-ui>
|
|
133
|
+
<field-ui label="Log all requests" inline>
|
|
134
|
+
<switch-ui></switch-ui>
|
|
135
|
+
</field-ui>
|
|
136
|
+
</col-ui>
|
|
137
|
+
<col-ui gap="3">
|
|
138
|
+
<h4>Notifications</h4>
|
|
139
|
+
<field-ui label="Email on errors" inline>
|
|
140
|
+
<check-ui checked></check-ui>
|
|
141
|
+
</field-ui>
|
|
142
|
+
<field-ui label="Slack on deploys" inline>
|
|
143
|
+
<check-ui></check-ui>
|
|
144
|
+
</field-ui>
|
|
145
|
+
<field-ui label="PagerDuty on outages" inline>
|
|
146
|
+
<check-ui></check-ui>
|
|
147
|
+
</field-ui>
|
|
148
|
+
</col-ui>
|
|
149
|
+
</col-ui>
|
|
150
|
+
</section>
|
|
151
|
+
<footer slot="footer">
|
|
152
|
+
<span slot="action">
|
|
153
|
+
<button-ui text="Cancel" variant="ghost" onclick="this.closest('drawer-ui').open=false"></button-ui>
|
|
154
|
+
<button-ui text="Save settings" variant="primary" onclick="this.closest('drawer-ui').open=false"></button-ui>
|
|
155
|
+
</span>
|
|
156
|
+
</footer>
|
|
157
|
+
</drawer-ui>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</section>
|
|
161
|
+
|
|
162
|
+
<section data-section data-property="anatomy">
|
|
163
|
+
<h2 variant="section">Anatomy</h2>
|
|
164
|
+
<code-ui language="html"><drawer-ui text="New project" side="right" size="md">
|
|
165
|
+
|
|
166
|
+
<!-- scrollable body -->
|
|
167
|
+
<section slot="body">
|
|
168
|
+
<col-ui gap="3">
|
|
169
|
+
<field-ui label="Name">
|
|
170
|
+
<input-ui required></input-ui>
|
|
171
|
+
</field-ui>
|
|
172
|
+
<field-ui label="Description">
|
|
173
|
+
<textarea-ui></textarea-ui>
|
|
174
|
+
</field-ui>
|
|
175
|
+
</col-ui>
|
|
176
|
+
</section>
|
|
177
|
+
|
|
178
|
+
<!-- sticky footer — single-cluster -->
|
|
179
|
+
<footer slot="footer">
|
|
180
|
+
<span slot="action">
|
|
181
|
+
<button-ui text="Cancel" variant="ghost"></button-ui>
|
|
182
|
+
<button-ui text="Create" variant="primary"></button-ui>
|
|
183
|
+
</span>
|
|
184
|
+
</footer>
|
|
185
|
+
|
|
186
|
+
<!-- sticky footer — dual-cluster (destructive left, primary right) -->
|
|
187
|
+
<footer slot="footer">
|
|
188
|
+
<span slot="action-leading">
|
|
189
|
+
<button-ui text="Delete" color="danger"></button-ui>
|
|
190
|
+
</span>
|
|
191
|
+
<span slot="action">
|
|
192
|
+
<button-ui text="Cancel" variant="ghost"></button-ui>
|
|
193
|
+
<button-ui text="Save changes" variant="primary"></button-ui>
|
|
194
|
+
</span>
|
|
195
|
+
</footer>
|
|
196
|
+
|
|
197
|
+
</drawer-ui></code-ui>
|
|
198
|
+
</section>
|
|
199
|
+
|
|
200
|
+
<section data-section data-property="rules">
|
|
201
|
+
<h2 variant="section">Rules</h2>
|
|
202
|
+
<ul>
|
|
203
|
+
<li>The footer is <strong>opt-in</strong> — drawer-ui only mounts a footer slot when the author supplies one. Drawers without forms shouldn't add an empty one.</li>
|
|
204
|
+
<li>For a single right-aligned action cluster, wrap the buttons in <code><span slot="action"></code> — drawer's footer CSS self-aligns the slot to the end, no spacer needed.</li>
|
|
205
|
+
<li>For a <strong>dual cluster</strong> (destructive action on the left + primary on the right), pair <code><span slot="action-leading"></code> with <code><span slot="action"></code>. The leading slot gets <code>margin-inline-end: auto</code> and pushes the trailing cluster to the opposite edge — no spacer required.</li>
|
|
206
|
+
<li>Primary action last (right-most) — follows OS conventions.</li>
|
|
207
|
+
<li>Wire close via <code>onclick="this.closest('drawer-ui').open=false"</code> on Cancel and on successful submit.</li>
|
|
208
|
+
<li>If the form has unsaved changes, trap close via the <code>close</code> event and show a confirm — don't rely on the user remembering.</li>
|
|
209
|
+
</ul>
|
|
210
|
+
</section>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" theme="auto">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Form Drawer (pattern) — AdiaUI</title>
|
|
7
|
+
|
|
8
|
+
<!-- Token base -->
|
|
9
|
+
<link rel="stylesheet" href="../../styles/resets.css">
|
|
10
|
+
<link rel="stylesheet" href="../../styles/tokens.css">
|
|
11
|
+
|
|
12
|
+
<!-- Component CSS — primitives this pattern composes -->
|
|
13
|
+
<link rel="stylesheet" href="../../components/button/button.css">
|
|
14
|
+
<link rel="stylesheet" href="../../components/check/check.css">
|
|
15
|
+
<link rel="stylesheet" href="../../components/code/code.css">
|
|
16
|
+
<link rel="stylesheet" href="../../components/col/col.css">
|
|
17
|
+
<link rel="stylesheet" href="../../components/drawer/drawer.css">
|
|
18
|
+
<link rel="stylesheet" href="../../components/field/field.css">
|
|
19
|
+
<link rel="stylesheet" href="../../components/input/input.css">
|
|
20
|
+
<link rel="stylesheet" href="../../components/range/range.css">
|
|
21
|
+
<link rel="stylesheet" href="../../components/select/select.css">
|
|
22
|
+
<link rel="stylesheet" href="../../components/switch/switch.css">
|
|
23
|
+
<link rel="stylesheet" href="../../components/tag/tag.css">
|
|
24
|
+
<link rel="stylesheet" href="../../components/textarea/textarea.css">
|
|
25
|
+
|
|
26
|
+
<!-- Component JS -->
|
|
27
|
+
<script type="module" src="../../components/button/button.js"></script>
|
|
28
|
+
<script type="module" src="../../components/check/check.js"></script>
|
|
29
|
+
<script type="module" src="../../components/code/code.js"></script>
|
|
30
|
+
<script type="module" src="../../components/col/col.js"></script>
|
|
31
|
+
<script type="module" src="../../components/drawer/drawer.js"></script>
|
|
32
|
+
<script type="module" src="../../components/field/field.js"></script>
|
|
33
|
+
<script type="module" src="../../components/input/input.js"></script>
|
|
34
|
+
<script type="module" src="../../components/range/range.js"></script>
|
|
35
|
+
<script type="module" src="../../components/select/select.js"></script>
|
|
36
|
+
<script type="module" src="../../components/switch/switch.js"></script>
|
|
37
|
+
<script type="module" src="../../components/tag/tag.js"></script>
|
|
38
|
+
<script type="module" src="../../components/textarea/textarea.js"></script>
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
:where(html, body) { margin: 0; min-height: 100vh; background: var(--md-sys-color-neutral-background); color: var(--md-sys-color-neutral-on-surface); font-family: var(--a-font-family); }
|
|
42
|
+
main { max-width: 960px; margin-inline: auto; padding: var(--a-space-6) var(--a-space-5); }
|
|
43
|
+
</style>
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
<main id="demo-root">
|
|
48
|
+
<p>Loading examples…</p>
|
|
49
|
+
</main>
|
|
50
|
+
|
|
51
|
+
<script type="module">
|
|
52
|
+
const root = document.getElementById('demo-root');
|
|
53
|
+
try {
|
|
54
|
+
const res = await fetch('./form-drawer.examples.html');
|
|
55
|
+
if (!res.ok) throw new Error(`fetch failed (${res.status})`);
|
|
56
|
+
root.innerHTML = await res.text();
|
|
57
|
+
} catch (err) {
|
|
58
|
+
root.innerHTML = `<p style="color:var(--a-danger-strong);">Failed to load form-drawer.examples.html — ${err.message}</p>`;
|
|
59
|
+
console.error('[form-drawer.html]', err);
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
</body>
|
|
64
|
+
</html>
|