@buffercreations/levelsui 0.1.4 → 0.1.5

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.
Files changed (63) hide show
  1. package/01. Elements/navigation/items/navigation-item/docs/README.md +4 -0
  2. package/01. Elements/navigation/items/navigation-item/src/navigation-item.scss +6 -3
  3. package/02. Layouts/application/app-shell/docs/README.md +4 -0
  4. package/02. Layouts/application/app-shell/docs/api.json +20 -1
  5. package/02. Layouts/application/app-shell/src/app-shell.scss +14 -2
  6. package/03. Components/navigation/bars/bottom-navigation-bar/bottom-navigation-bar.definition.json +35 -0
  7. package/03. Components/navigation/bars/bottom-navigation-bar/docs/README.md +9 -0
  8. package/03. Components/navigation/bars/bottom-navigation-bar/docs/api.json +31 -0
  9. package/03. Components/navigation/bars/bottom-navigation-bar/examples/index.json +10 -0
  10. package/03. Components/navigation/bars/bottom-navigation-bar/examples/standard/code.html +9 -0
  11. package/03. Components/navigation/bars/bottom-navigation-bar/examples/standard/preview.html +9 -0
  12. package/03. Components/navigation/bars/bottom-navigation-bar/src/bottom-navigation-bar.scss +38 -0
  13. package/03. Components/navigation/drawers/navigation-drawer/docs/README.md +5 -0
  14. package/03. Components/navigation/drawers/navigation-drawer/docs/api.json +36 -0
  15. package/03. Components/navigation/drawers/navigation-drawer/examples/index.json +10 -0
  16. package/03. Components/navigation/drawers/navigation-drawer/examples/standard/code.html +9 -0
  17. package/03. Components/navigation/drawers/navigation-drawer/examples/standard/preview.html +9 -0
  18. package/03. Components/navigation/drawers/navigation-drawer/navigation-drawer.definition.json +36 -0
  19. package/03. Components/navigation/drawers/navigation-drawer/src/navigation-drawer.scss +25 -0
  20. package/03. Components/navigation/rails/global-navigation-rail/docs/README.md +11 -0
  21. package/03. Components/navigation/rails/global-navigation-rail/docs/api.json +51 -0
  22. package/03. Components/navigation/rails/global-navigation-rail/examples/basic/code.html +21 -0
  23. package/03. Components/navigation/rails/global-navigation-rail/examples/basic/preview.html +21 -0
  24. package/03. Components/navigation/rails/global-navigation-rail/examples/horizontal/code.html +21 -0
  25. package/03. Components/navigation/rails/global-navigation-rail/examples/horizontal/preview.html +21 -0
  26. package/03. Components/navigation/rails/global-navigation-rail/examples/index.json +17 -0
  27. package/03. Components/navigation/rails/global-navigation-rail/global-navigation-rail.definition.json +37 -0
  28. package/03. Components/navigation/rails/global-navigation-rail/src/global-navigation-rail.scss +74 -0
  29. package/03. Components/navigation/sidebars/floating-contextual-navigation/docs/README.md +41 -0
  30. package/03. Components/navigation/sidebars/floating-contextual-navigation/docs/api.json +71 -0
  31. package/03. Components/navigation/sidebars/floating-contextual-navigation/examples/closed/code.html +74 -0
  32. package/03. Components/navigation/sidebars/floating-contextual-navigation/examples/closed/preview.html +74 -0
  33. package/03. Components/navigation/sidebars/floating-contextual-navigation/examples/index.json +24 -0
  34. package/03. Components/navigation/sidebars/floating-contextual-navigation/examples/joined/code.html +74 -0
  35. package/03. Components/navigation/sidebars/floating-contextual-navigation/examples/joined/preview.html +74 -0
  36. package/03. Components/navigation/sidebars/floating-contextual-navigation/examples/pinned/code.html +74 -0
  37. package/03. Components/navigation/sidebars/floating-contextual-navigation/examples/pinned/preview.html +74 -0
  38. package/03. Components/navigation/sidebars/floating-contextual-navigation/floating-contextual-navigation.definition.json +42 -0
  39. package/03. Components/navigation/sidebars/floating-contextual-navigation/src/floating-contextual-navigation.js +227 -0
  40. package/03. Components/navigation/sidebars/floating-contextual-navigation/src/floating-contextual-navigation.scss +85 -0
  41. package/03. Components/navigation/sidebars/floating-sidebar/docs/README.md +4 -0
  42. package/03. Components/navigation/sidebars/floating-sidebar/src/floating-sidebar.js +14 -9
  43. package/03. Components/navigation/sidebars/floating-sidebar/src/floating-sidebar.scss +30 -1
  44. package/03. Components/navigation/sidebars/responsive-navigation/docs/README.md +25 -0
  45. package/03. Components/navigation/sidebars/responsive-navigation/docs/api.json +51 -0
  46. package/03. Components/navigation/sidebars/responsive-navigation/examples/drawer-only/code.html +95 -0
  47. package/03. Components/navigation/sidebars/responsive-navigation/examples/drawer-only/preview.html +95 -0
  48. package/03. Components/navigation/sidebars/responsive-navigation/examples/index.json +17 -0
  49. package/03. Components/navigation/sidebars/responsive-navigation/examples/standard/code.html +95 -0
  50. package/03. Components/navigation/sidebars/responsive-navigation/examples/standard/preview.html +95 -0
  51. package/03. Components/navigation/sidebars/responsive-navigation/responsive-navigation.definition.json +37 -0
  52. package/03. Components/navigation/sidebars/responsive-navigation/src/responsive-navigation.js +152 -0
  53. package/03. Components/navigation/sidebars/responsive-navigation/src/responsive-navigation.scss +82 -0
  54. package/dist/catalogue.json +88 -0
  55. package/dist/components/app-shell.css +10 -2
  56. package/dist/components/bottom-navigation-bar.css +44 -0
  57. package/dist/components/floating-contextual-navigation.css +84 -0
  58. package/dist/components/floating-sidebar.css +27 -1
  59. package/dist/components/global-navigation-rail.css +75 -0
  60. package/dist/components/navigation-drawer.css +23 -0
  61. package/dist/components/navigation-item.css +5 -3
  62. package/dist/components/responsive-navigation.css +92 -0
  63. package/package.json +1 -1
@@ -0,0 +1,74 @@
1
+ <div class="bcc-floating-contextual-navigation" data-state="pinned" data-hub="clients">
2
+ <aside class="bcc-global-navigation-rail bcc-floating-contextual-navigation__global" aria-label="Atlas Hubs">
3
+ <nav class="bcc-navigation-menu" aria-label="Hubs">
4
+ <ul class="bcc-navigation-menu__list">
5
+ <li class="bcc-navigation-menu__item">
6
+ <button type="button" class="bce-navigation-item bce-navigation-item--icon-only" data-contextual-hub="home" aria-label="Home" aria-pressed="false" aria-expanded="false" aria-controls="atlas-context-panel">
7
+ <span class="bce-navigation-item__icon" aria-hidden="true"><iconify-icon icon="hugeicons:home-01"></iconify-icon></span>
8
+ </button>
9
+ </li>
10
+ <li class="bcc-navigation-menu__item">
11
+ <button type="button" class="bce-navigation-item bce-navigation-item--icon-only" data-contextual-hub="clients" aria-label="Clients" aria-pressed="true" aria-expanded="true" aria-controls="atlas-context-panel">
12
+ <span class="bce-navigation-item__icon" aria-hidden="true"><iconify-icon icon="hugeicons:user-group"></iconify-icon></span>
13
+ </button>
14
+ </li>
15
+ <li class="bcc-navigation-menu__item">
16
+ <button type="button" class="bce-navigation-item bce-navigation-item--icon-only" data-contextual-hub="creative" aria-label="Creative" aria-pressed="false" aria-expanded="false" aria-controls="atlas-context-panel">
17
+ <span class="bce-navigation-item__icon" aria-hidden="true"><iconify-icon icon="hugeicons:folder-01"></iconify-icon></span>
18
+ </button>
19
+ </li>
20
+ </ul>
21
+ </nav>
22
+ </aside>
23
+ <aside class="bcc-floating-contextual-navigation__panel" id="atlas-context-panel" aria-label="Hub navigation" aria-hidden="false">
24
+ <div class="bcl-sidebar bcc-floating-sidebar bcc-floating-sidebar--embedded">
25
+ <div class="bcl-sidebar__aside bcc-floating-sidebar__rail">
26
+ <div class="bcc-floating-contextual-navigation__panel-header">
27
+ <strong data-contextual-title>Clients</strong>
28
+ <button class="bce-button bce-button--ghost bce-button--icon-only bcc-floating-contextual-navigation__close" type="button" data-contextual-close aria-label="Close contextual navigation">
29
+ <iconify-icon icon="hugeicons:arrow-left-01" aria-hidden="true"></iconify-icon>
30
+ </button>
31
+ </div>
32
+ <section data-contextual-content="home" hidden>
33
+ <nav class="bcc-navigation-menu" aria-label="Home workspaces">
34
+ <h3 class="bcc-navigation-menu__heading">Workspace</h3>
35
+ <ul class="bcc-navigation-menu__list">
36
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#home-dashboard"><span class="bce-navigation-item__label">Dashboard</span></a></li>
37
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#home-activity"><span class="bce-navigation-item__label">Activity</span></a></li>
38
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#home-settings"><span class="bce-navigation-item__label">Settings</span></a></li>
39
+ </ul>
40
+ </nav>
41
+ </section>
42
+ <section data-contextual-content="clients">
43
+ <nav class="bcc-navigation-menu" aria-label="Clients workspaces">
44
+ <h3 class="bcc-navigation-menu__heading">Workspace</h3>
45
+ <ul class="bcc-navigation-menu__list">
46
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-overview"><span class="bce-navigation-item__label">Overview</span></a></li>
47
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-client-directory"><span class="bce-navigation-item__label">Client Directory</span></a></li>
48
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-projects"><span class="bce-navigation-item__label">Projects</span></a></li>
49
+ </ul>
50
+ <h3 class="bcc-navigation-menu__heading">Management</h3>
51
+ <ul class="bcc-navigation-menu__list">
52
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-agreements"><span class="bce-navigation-item__label">Agreements</span></a></li>
53
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-settings"><span class="bce-navigation-item__label">Settings</span></a></li>
54
+ </ul>
55
+ </nav>
56
+ </section>
57
+ <section data-contextual-content="creative" hidden>
58
+ <nav class="bcc-navigation-menu" aria-label="Creative workspaces">
59
+ <h3 class="bcc-navigation-menu__heading">Workspace</h3>
60
+ <ul class="bcc-navigation-menu__list">
61
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#creative-overview"><span class="bce-navigation-item__label">Overview</span></a></li>
62
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#creative-design-studio"><span class="bce-navigation-item__label">Design Studio</span></a></li>
63
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#creative-assets"><span class="bce-navigation-item__label">Assets</span></a></li>
64
+ </ul>
65
+ </nav>
66
+ </section>
67
+ </div>
68
+ </div>
69
+ </aside>
70
+ <main class="bcc-floating-contextual-navigation__workspace bc-p-sm">
71
+ <h2>Workspace</h2>
72
+ <p>Hover a Hub icon for a temporary preview. Click it to pin its navigation; click again to close.</p>
73
+ </main>
74
+ </div>
@@ -0,0 +1,74 @@
1
+ <div class="bcc-floating-contextual-navigation" data-state="pinned" data-hub="clients">
2
+ <aside class="bcc-global-navigation-rail bcc-floating-contextual-navigation__global" aria-label="Atlas Hubs">
3
+ <nav class="bcc-navigation-menu" aria-label="Hubs">
4
+ <ul class="bcc-navigation-menu__list">
5
+ <li class="bcc-navigation-menu__item">
6
+ <button type="button" class="bce-navigation-item bce-navigation-item--icon-only" data-contextual-hub="home" aria-label="Home" aria-pressed="false" aria-expanded="false" aria-controls="atlas-context-panel">
7
+ <span class="bce-navigation-item__icon" aria-hidden="true"><iconify-icon icon="hugeicons:home-01"></iconify-icon></span>
8
+ </button>
9
+ </li>
10
+ <li class="bcc-navigation-menu__item">
11
+ <button type="button" class="bce-navigation-item bce-navigation-item--icon-only" data-contextual-hub="clients" aria-label="Clients" aria-pressed="true" aria-expanded="true" aria-controls="atlas-context-panel">
12
+ <span class="bce-navigation-item__icon" aria-hidden="true"><iconify-icon icon="hugeicons:user-group"></iconify-icon></span>
13
+ </button>
14
+ </li>
15
+ <li class="bcc-navigation-menu__item">
16
+ <button type="button" class="bce-navigation-item bce-navigation-item--icon-only" data-contextual-hub="creative" aria-label="Creative" aria-pressed="false" aria-expanded="false" aria-controls="atlas-context-panel">
17
+ <span class="bce-navigation-item__icon" aria-hidden="true"><iconify-icon icon="hugeicons:folder-01"></iconify-icon></span>
18
+ </button>
19
+ </li>
20
+ </ul>
21
+ </nav>
22
+ </aside>
23
+ <aside class="bcc-floating-contextual-navigation__panel" id="atlas-context-panel" aria-label="Hub navigation" aria-hidden="false">
24
+ <div class="bcl-sidebar bcc-floating-sidebar bcc-floating-sidebar--embedded">
25
+ <div class="bcl-sidebar__aside bcc-floating-sidebar__rail">
26
+ <div class="bcc-floating-contextual-navigation__panel-header">
27
+ <strong data-contextual-title>Clients</strong>
28
+ <button class="bce-button bce-button--ghost bce-button--icon-only bcc-floating-contextual-navigation__close" type="button" data-contextual-close aria-label="Close contextual navigation">
29
+ <iconify-icon icon="hugeicons:arrow-left-01" aria-hidden="true"></iconify-icon>
30
+ </button>
31
+ </div>
32
+ <section data-contextual-content="home" hidden>
33
+ <nav class="bcc-navigation-menu" aria-label="Home workspaces">
34
+ <h3 class="bcc-navigation-menu__heading">Workspace</h3>
35
+ <ul class="bcc-navigation-menu__list">
36
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#home-dashboard"><span class="bce-navigation-item__label">Dashboard</span></a></li>
37
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#home-activity"><span class="bce-navigation-item__label">Activity</span></a></li>
38
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#home-settings"><span class="bce-navigation-item__label">Settings</span></a></li>
39
+ </ul>
40
+ </nav>
41
+ </section>
42
+ <section data-contextual-content="clients">
43
+ <nav class="bcc-navigation-menu" aria-label="Clients workspaces">
44
+ <h3 class="bcc-navigation-menu__heading">Workspace</h3>
45
+ <ul class="bcc-navigation-menu__list">
46
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-overview"><span class="bce-navigation-item__label">Overview</span></a></li>
47
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-client-directory"><span class="bce-navigation-item__label">Client Directory</span></a></li>
48
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-projects"><span class="bce-navigation-item__label">Projects</span></a></li>
49
+ </ul>
50
+ <h3 class="bcc-navigation-menu__heading">Management</h3>
51
+ <ul class="bcc-navigation-menu__list">
52
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-agreements"><span class="bce-navigation-item__label">Agreements</span></a></li>
53
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#clients-settings"><span class="bce-navigation-item__label">Settings</span></a></li>
54
+ </ul>
55
+ </nav>
56
+ </section>
57
+ <section data-contextual-content="creative" hidden>
58
+ <nav class="bcc-navigation-menu" aria-label="Creative workspaces">
59
+ <h3 class="bcc-navigation-menu__heading">Workspace</h3>
60
+ <ul class="bcc-navigation-menu__list">
61
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#creative-overview"><span class="bce-navigation-item__label">Overview</span></a></li>
62
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#creative-design-studio"><span class="bce-navigation-item__label">Design Studio</span></a></li>
63
+ <li class="bcc-navigation-menu__item"><a class="bce-navigation-item" href="#creative-assets"><span class="bce-navigation-item__label">Assets</span></a></li>
64
+ </ul>
65
+ </nav>
66
+ </section>
67
+ </div>
68
+ </div>
69
+ </aside>
70
+ <main class="bcc-floating-contextual-navigation__workspace bc-p-sm">
71
+ <h2>Workspace</h2>
72
+ <p>Hover a Hub icon for a temporary preview. Click it to pin its navigation; click again to close.</p>
73
+ </main>
74
+ </div>
@@ -0,0 +1,42 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "kind": "authored",
4
+ "id": "floating-contextual-navigation",
5
+ "displayName": "Floating Contextual Navigation",
6
+ "description": "Global Hub rail with click-to-pin selection, temporary per-Hub hover preview and a fully hideable Floating Sidebar panel.",
7
+ "level": "components",
8
+ "category": [
9
+ "navigation",
10
+ "sidebars"
11
+ ],
12
+ "className": "bcc-floating-contextual-navigation",
13
+ "source": {
14
+ "scss": "03. Components/navigation/sidebars/floating-contextual-navigation/src/floating-contextual-navigation.scss",
15
+ "css": "dist/components/floating-contextual-navigation.css",
16
+ "js": "03. Components/navigation/sidebars/floating-contextual-navigation/src/floating-contextual-navigation.js"
17
+ },
18
+ "dependencies": {
19
+ "css": [
20
+ "foundations"
21
+ ],
22
+ "components": [
23
+ "global-navigation-rail",
24
+ "floating-sidebar"
25
+ ]
26
+ },
27
+ "documentation": {
28
+ "guide": "docs/README.md",
29
+ "api": "docs/api.json",
30
+ "examples": "examples/index.json"
31
+ },
32
+ "mount": {
33
+ "export": "mountFloatingContextualNavigation",
34
+ "selector": ".bcc-floating-contextual-navigation"
35
+ },
36
+ "customisation": {
37
+ "variables": [
38
+ "--bcc-floating-contextual-navigation-panel-width",
39
+ "--bcc-floating-contextual-navigation-gap"
40
+ ]
41
+ }
42
+ }
@@ -0,0 +1,227 @@
1
+ // Floating Contextual Navigation — Level 03 / Components.
2
+ import {registerDismissal} from '@buffercreations/buffercore/behaviours/dismiss';
3
+ // The rail selects a Hub; the single contextual panel previews or pins its content.
4
+ const instances = new WeakMap();
5
+
6
+ /**
7
+ * Mount independent hover-preview and pinned-Hub navigation states.
8
+ * @param {HTMLElement} root - Contextual navigation root.
9
+ * @returns {{selectHub: (id: string) => void, close: () => void, pin: (id?: string) => void, unpin: () => void, destroy: () => void}}
10
+ */
11
+ export function mountFloatingContextualNavigation(root) {
12
+ if (!root?.querySelector) throw new TypeError('Floating Contextual Navigation requires an element root');
13
+ if (instances.has(root)) return instances.get(root);
14
+
15
+ const rail = root.querySelector('.bcc-floating-contextual-navigation__global');
16
+ const panel = root.querySelector('.bcc-floating-contextual-navigation__panel');
17
+ const triggers = [...(rail?.querySelectorAll('[data-contextual-hub]') ?? [])];
18
+ const closeButton = panel?.querySelector('[data-contextual-close]');
19
+ const sections = [...(panel?.querySelectorAll('[data-contextual-content]') ?? [])];
20
+ if (!rail || !panel || !closeButton || !triggers.length || !sections.length) {
21
+ throw new Error('Contextual navigation requires Hub controls, one panel, a close control and Hub content');
22
+ }
23
+
24
+ const hubs = new Map();
25
+ for (const trigger of triggers) {
26
+ const id = trigger.getAttribute('data-contextual-hub');
27
+ if (!id || hubs.has(id)) throw new Error('Hub identifiers must be present and unique');
28
+ hubs.set(id, trigger);
29
+ }
30
+ const content = new Map();
31
+ for (const section of sections) {
32
+ const id = section.getAttribute('data-contextual-content');
33
+ if (!hubs.has(id) || content.has(id)) throw new Error(`Unknown or duplicate contextual Hub content: ${id}`);
34
+ content.set(id, section);
35
+ }
36
+ if (hubs.size !== content.size) throw new Error('Every contextual Hub requires a matching content section');
37
+
38
+ const initialHub = root.getAttribute('data-hub') || hubs.keys().next().value;
39
+ if (!hubs.has(initialHub)) throw new Error(`Unknown initial contextual Hub: ${initialHub}`);
40
+ let pinnedHub = root.dataset.state === 'pinned' ? initialHub : null;
41
+ let hoveredHub = null;
42
+ let activeHub = null;
43
+ let destroyed = false;
44
+ let exitTimer;
45
+ let suppressFocusPreview = false;
46
+ let pointerInside = false;
47
+ let blockedPreview = false;
48
+ let releaseDismissal = null;
49
+ const doc = root.ownerDocument;
50
+ const getState = () => pinnedHub ? 'pinned' : hoveredHub ? 'preview' : 'closed';
51
+ const clearExit = () => { clearTimeout(exitTimer); exitTimer = undefined; };
52
+
53
+ function render() {
54
+ if (destroyed) return;
55
+ const state = getState();
56
+ const nextHub = hoveredHub || pinnedHub;
57
+ const changed = state !== root.dataset.state || nextHub !== activeHub;
58
+ activeHub = nextHub;
59
+ root.dataset.state = state;
60
+ if (nextHub) root.dataset.hub = nextHub;
61
+ else delete root.dataset.hub;
62
+
63
+ panel.inert = !nextHub;
64
+ panel.setAttribute('aria-hidden', String(!nextHub));
65
+ for (const [id, trigger] of hubs) {
66
+ trigger.setAttribute('aria-pressed', String(pinnedHub === id));
67
+ trigger.setAttribute('aria-expanded', String(nextHub === id));
68
+ trigger.setAttribute('aria-controls', panel.id);
69
+ }
70
+ for (const [id, section] of content) section.hidden = id !== nextHub;
71
+ closeButton.setAttribute('aria-label', 'Close contextual navigation');
72
+ if (nextHub) {
73
+ const label = hubs.get(nextHub).getAttribute('aria-label') || nextHub;
74
+ panel.setAttribute('aria-label', `${label} navigation`);
75
+ const title = panel.querySelector('[data-contextual-title]');
76
+ if (title) title.textContent = label;
77
+ }
78
+ // Core owns Escape arbitration across independent panels. Register only while
79
+ // visible; never keep a closed contextual panel on the dismissal stack.
80
+ if (!nextHub && releaseDismissal) {
81
+ releaseDismissal();
82
+ releaseDismissal = null;
83
+ } else if (nextHub && !releaseDismissal) {
84
+ releaseDismissal = registerDismissal({
85
+ panel,
86
+ closeOnOutside: false,
87
+ onDismiss(reason) {
88
+ if (reason !== 'escape') return;
89
+ const focus = activeHub;
90
+ close();
91
+ restoreRailFocus(focus);
92
+ },
93
+ });
94
+ }
95
+ if (changed) root.dispatchEvent(new doc.defaultView.CustomEvent('contextualnavigationchange', {
96
+ bubbles: true,
97
+ detail: {state, hub: nextHub, pinnedHub},
98
+ }));
99
+ }
100
+
101
+ function preview(id) {
102
+ if (!hubs.has(id)) throw new Error(`Unknown Hub: ${id}`);
103
+ clearExit();
104
+ hoveredHub = id;
105
+ render();
106
+ }
107
+ function restoreRailFocus(id) {
108
+ const trigger = hubs.get(id);
109
+ if (!trigger) return;
110
+ // A programmatic focus restore must not count as a new Hub preview.
111
+ suppressFocusPreview = true;
112
+ try { trigger.focus({preventScroll: true}); }
113
+ finally { suppressFocusPreview = false; }
114
+ }
115
+ function closePreview() {
116
+ clearExit();
117
+ const focus = activeHub;
118
+ hoveredHub = null;
119
+ if (!pinnedHub && panel.contains(doc.activeElement)) restoreRailFocus(focus);
120
+ render();
121
+ }
122
+ function close() {
123
+ clearExit();
124
+ // A deliberate close wins over hover until the pointer leaves navigation.
125
+ blockedPreview = true;
126
+ const focus = activeHub;
127
+ hoveredHub = null;
128
+ pinnedHub = null;
129
+ if (panel.contains(doc.activeElement)) restoreRailFocus(focus);
130
+ render();
131
+ }
132
+ function pin(id = activeHub || initialHub) {
133
+ if (!hubs.has(id)) throw new Error(`Unknown Hub: ${id}`);
134
+ clearExit();
135
+ blockedPreview = false;
136
+ pinnedHub = id;
137
+ hoveredHub = null;
138
+ render();
139
+ }
140
+ function selectHub(id) {
141
+ if (!hubs.has(id)) throw new Error(`Unknown Hub: ${id}`);
142
+ if (pinnedHub === id) close();
143
+ else pin(id);
144
+ }
145
+ function unpin() { close(); }
146
+ function onClick(event) {
147
+ const trigger = event.currentTarget;
148
+ selectHub(trigger.getAttribute('data-contextual-hub'));
149
+ }
150
+ function onEnter(event) {
151
+ if ((event.pointerType === 'mouse' || event.pointerType === 'pen') && !blockedPreview) {
152
+ pointerInside = true;
153
+ preview(event.currentTarget.getAttribute('data-contextual-hub'));
154
+ }
155
+ }
156
+ function leftNavigation(event) {
157
+ const target = event.relatedTarget;
158
+ if (target && (rail.contains(target) || panel.contains(target))) return false;
159
+ pointerInside = false;
160
+ // Only leaving navigation itself can re-arm hover after an explicit close.
161
+ blockedPreview = false;
162
+ return true;
163
+ }
164
+ function onRailLeave(event) {
165
+ if (!leftNavigation(event)) return;
166
+ scheduleExit();
167
+ }
168
+ function onPanelEnter() { pointerInside = true; clearExit(); }
169
+ function onPanelLeave(event) {
170
+ if (!leftNavigation(event)) return;
171
+ scheduleExit();
172
+ }
173
+ function scheduleExit() {
174
+ clearExit();
175
+ // Crossing an optional rail-to-panel gap should not flash the panel closed.
176
+ exitTimer = setTimeout(() => {
177
+ // Mouse previews should restore the pinned Hub even if a clicked rail
178
+ // button retains focus; focused panel controls remain accessible.
179
+ if (!panel.contains(doc.activeElement)) closePreview();
180
+ }, 130);
181
+ }
182
+ function onFocusIn(event) {
183
+ clearExit();
184
+ if (!suppressFocusPreview && !pointerInside && event.target.closest('[data-contextual-hub]')) {
185
+ preview(event.target.closest('[data-contextual-hub]').getAttribute('data-contextual-hub'));
186
+ }
187
+ }
188
+ function onFocusOut(event) {
189
+ if (event.relatedTarget && root.contains(event.relatedTarget)) return;
190
+ scheduleExit();
191
+ }
192
+ for (const trigger of triggers) {
193
+ trigger.addEventListener('click', onClick);
194
+ trigger.addEventListener('pointerenter', onEnter);
195
+ }
196
+ rail.addEventListener('pointerleave', onRailLeave);
197
+ panel.addEventListener('pointerenter', onPanelEnter);
198
+ panel.addEventListener('pointerleave', onPanelLeave);
199
+ root.addEventListener('focusin', onFocusIn);
200
+ root.addEventListener('focusout', onFocusOut);
201
+ closeButton.addEventListener('click', close);
202
+ render();
203
+
204
+ const controller = {
205
+ selectHub, close, pin, unpin, preview, endPreview: closePreview,
206
+ destroy() {
207
+ if (destroyed) return;
208
+ clearExit();
209
+ releaseDismissal?.();
210
+ releaseDismissal = null;
211
+ for (const trigger of triggers) {
212
+ trigger.removeEventListener('click', onClick);
213
+ trigger.removeEventListener('pointerenter', onEnter);
214
+ }
215
+ rail.removeEventListener('pointerleave', onRailLeave);
216
+ panel.removeEventListener('pointerenter', onPanelEnter);
217
+ panel.removeEventListener('pointerleave', onPanelLeave);
218
+ root.removeEventListener('focusin', onFocusIn);
219
+ root.removeEventListener('focusout', onFocusOut);
220
+ closeButton.removeEventListener('click', close);
221
+ instances.delete(root);
222
+ destroyed = true;
223
+ },
224
+ };
225
+ instances.set(root, controller);
226
+ return controller;
227
+ }
@@ -0,0 +1,85 @@
1
+ // Floating Contextual Navigation — Level 03 / Components.
2
+ // Compose existing Global Navigation Rail and Floating Sidebar; own only placement and state.
3
+ .bcc-floating-contextual-navigation {
4
+ --bcc-floating-contextual-navigation-panel-width: var(--bc-size-ui-256);
5
+ --bcc-floating-contextual-navigation-gap: var(--bc-fluid-2xs);
6
+
7
+ position: relative;
8
+ display: grid;
9
+ grid-template-columns: var(--bcc-global-navigation-rail-width, var(--bc-size-ui-64)) 0px minmax(0, 1fr);
10
+ align-items: start;
11
+ column-gap: 0;
12
+ min-inline-size: 0;
13
+ min-block-size: 100%;
14
+ transition: grid-template-columns var(--bc-motion-interaction);
15
+ }
16
+
17
+ // Opt-in joined treatment. Consumers can also override the gap token.
18
+ .bcc-floating-contextual-navigation--joined {
19
+ --bcc-floating-contextual-navigation-gap: 0px;
20
+ }
21
+
22
+ .bcc-floating-contextual-navigation[data-state="pinned"] {
23
+ grid-template-columns: var(--bcc-global-navigation-rail-width, var(--bc-size-ui-64)) calc(var(--bcc-floating-contextual-navigation-panel-width) + var(--bcc-floating-contextual-navigation-gap)) minmax(0, 1fr);
24
+ }
25
+
26
+ .bcc-floating-contextual-navigation__global,
27
+ .bcc-floating-contextual-navigation__workspace { min-inline-size: 0; }
28
+
29
+ .bcc-floating-contextual-navigation__global {
30
+ grid-column: 1;
31
+ grid-row: 1;
32
+ block-size: 100%;
33
+ min-block-size: 100svh;
34
+ }
35
+
36
+ .bcc-floating-contextual-navigation__workspace {
37
+ grid-column: 3;
38
+ grid-row: 1;
39
+ min-inline-size: 0;
40
+ }
41
+
42
+ // This header already owns Asset-specific anatomy: keep its related layout
43
+ // declarations together instead of stacking presentation utilities in markup.
44
+ .bcc-floating-contextual-navigation__panel-header {
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: space-between;
48
+ gap: var(--bc-fluid-2xs);
49
+ margin-block-end: var(--bc-fluid-xs);
50
+ }
51
+
52
+ .bcc-floating-contextual-navigation__close { flex: none; }
53
+
54
+ // One contextual panel for every Hub. Hover overlays the workspace; pinning
55
+ // reserves the panel and the optional gap without re-mounting its content.
56
+ .bcc-floating-contextual-navigation__panel {
57
+ position: absolute;
58
+ z-index: 5;
59
+ inset-block-start: 0;
60
+ inset-inline-start: calc(var(--bcc-global-navigation-rail-width, var(--bc-size-ui-64)) + var(--bcc-floating-contextual-navigation-gap));
61
+ inline-size: var(--bcc-floating-contextual-navigation-panel-width);
62
+ block-size: 100%;
63
+ max-inline-size: calc(100% - var(--bcc-global-navigation-rail-width, var(--bc-size-ui-64)) - var(--bcc-floating-contextual-navigation-gap));
64
+ opacity: 0;
65
+ visibility: hidden;
66
+ pointer-events: none;
67
+ transform: translateX(calc(0px - var(--bc-size-ui-16)));
68
+ transition: opacity var(--bc-motion-interaction), transform var(--bc-motion-interaction), visibility 0s linear var(--bc-motion-interaction-duration);
69
+ }
70
+
71
+ .bcc-floating-contextual-navigation:is([data-state="preview"], [data-state="pinned"]) > .bcc-floating-contextual-navigation__panel {
72
+ opacity: 1;
73
+ visibility: visible;
74
+ pointer-events: auto;
75
+ transform: translateX(0);
76
+ transition: opacity var(--bc-motion-interaction), transform var(--bc-motion-interaction), visibility 0s;
77
+ }
78
+
79
+ .bcc-floating-contextual-navigation__panel > .bcc-floating-sidebar { block-size: 100%; }
80
+
81
+
82
+ @media (prefers-reduced-motion: reduce) {
83
+ .bcc-floating-contextual-navigation,
84
+ .bcc-floating-contextual-navigation__panel { transition: none; }
85
+ }
@@ -46,3 +46,7 @@ Iconify/Hugeicons spans (`--collapse` and `--expand`), which now crossfade rathe
46
46
  than disappearing instantly. Replace those Iconify names to customise the control.
47
47
 
48
48
  For reduced-motion users, transitions are disabled.
49
+
50
+ ## Embedded composition
51
+
52
+ `bcc-floating-sidebar--embedded` reuses the same floating rail canvas, rounded shape, navigation and scroll treatment as a panel within Floating Contextual Navigation. This mode has no independent collapse control or duplicate state controller. Standalone Floating Sidebar behaviour remains unchanged.
@@ -12,6 +12,13 @@ export function mountFloatingSidebar(root) {
12
12
  if (!root?.querySelector) throw new TypeError('Floating Sidebar requires an element root');
13
13
  if (instances.has(root)) return instances.get(root);
14
14
 
15
+ // A composed, panel-only Sidebar has no independent expand/collapse control.
16
+ if (root.classList.contains('bcc-floating-sidebar--embedded')) {
17
+ const controller = { destroy() { instances.delete(root); } };
18
+ instances.set(root, controller);
19
+ return controller;
20
+ }
21
+
15
22
  const toggle = root.querySelector('.bcc-floating-sidebar__toggle');
16
23
  const rail = root.querySelector('.bcc-floating-sidebar__rail');
17
24
  const nav = root.querySelector('.bcc-navigation-menu');
@@ -22,15 +29,14 @@ export function mountFloatingSidebar(root) {
22
29
  throw new Error('Floating Sidebar toggle must belong to this instance');
23
30
  }
24
31
 
25
- // Reuse Navigation Item's existing reversible transition. The Sidebar
26
- // opts in once; callers don't need to mark every navigation link.
27
- const addedMotionClasses = [];
32
+ // Opt into the Navigation Item's existing collapse transition only for this
33
+ // animated instance. Keep track of ownership so teardown preserves consumer classes.
34
+ const animatedItems = [];
28
35
  if (root.classList.contains('bcc-floating-sidebar--animated')) {
29
36
  for (const item of nav.querySelectorAll('.bce-navigation-item--collapsible')) {
30
- if (!item.classList.contains('bce-navigation-item--animated')) {
31
- item.classList.add('bce-navigation-item--animated');
32
- addedMotionClasses.push(item);
33
- }
37
+ if (item.classList.contains('bce-navigation-item--animated')) continue;
38
+ item.classList.add('bce-navigation-item--animated');
39
+ animatedItems.push(item);
34
40
  }
35
41
  }
36
42
 
@@ -63,8 +69,7 @@ export function mountFloatingSidebar(root) {
63
69
  if (destroyed) return;
64
70
  destroyed = true;
65
71
  toggle.removeEventListener('click', onClick);
66
- // Restore any classes that this controller added during mounting.
67
- for (const item of addedMotionClasses) item.classList.remove('bce-navigation-item--animated');
72
+ for (const item of animatedItems) item.classList.remove('bce-navigation-item--animated');
68
73
  instances.delete(root);
69
74
  },
70
75
  };
@@ -3,7 +3,11 @@
3
3
  // own link presentation. This Asset owns floating treatment and rail state only.
4
4
  .bcc-floating-sidebar {
5
5
  --bcc-floating-sidebar-width: var(--bc-size-ui-256);
6
- --bcc-floating-sidebar-rail-width: var(--bc-size-ui-96);
6
+ --bcc-floating-sidebar-rail-width: calc(
7
+ var(--bcc-floating-sidebar-padding) * 2 +
8
+ var(--bc-size-ui-16) * 2 +
9
+ var(--bc-size-ui-20)
10
+ );
7
11
  --bcc-floating-sidebar-gap: var(--bc-fluid-md);
8
12
  --bcc-floating-sidebar-padding: var(--bc-fluid-xs);
9
13
  --bcc-floating-sidebar-surface: var(--bc-color-canvas-secondary);
@@ -108,6 +112,7 @@
108
112
  .bcc-floating-sidebar[data-collapsed="true"] > .bcc-floating-sidebar__rail {
109
113
  flex-basis: var(--bcc-floating-sidebar-rail-width);
110
114
  inline-size: var(--bcc-floating-sidebar-rail-width);
115
+ scrollbar-width: none;
111
116
  }
112
117
  .bcc-floating-sidebar[data-collapsed="true"] .bcc-floating-sidebar__brand,
113
118
  .bcc-floating-sidebar[data-collapsed="true"] .bcc-floating-sidebar__footer {
@@ -122,6 +127,10 @@
122
127
  transform: translateX(0);
123
128
  }
124
129
 
130
+ .bcc-floating-sidebar[data-collapsed="true"] > .bcc-floating-sidebar__rail::-webkit-scrollbar {
131
+ display: none;
132
+ }
133
+
125
134
  // Keep group headings in document flow while their space collapses.
126
135
  // This prevents an instantaneous vertical jump in Navigation Items.
127
136
  .bcc-floating-sidebar .bcc-navigation-menu__heading {
@@ -161,3 +170,23 @@
161
170
  .bcc-floating-sidebar--animated .bcc-navigation-menu__heading,
162
171
  .bcc-floating-sidebar--animated .bcc-floating-sidebar__toggle-icon { transition: none; }
163
172
  }
173
+
174
+ // Reuse the floating rail surface within a larger navigation Component.
175
+ // This mode has no independent sidebar main region or collapse controller.
176
+ .bcc-floating-sidebar--embedded {
177
+ display: block;
178
+ inline-size: 100%;
179
+ block-size: 100%;
180
+ min-inline-size: 0;
181
+ --bcc-floating-sidebar-width: 100%;
182
+ --bcc-floating-sidebar-gap: 0px;
183
+ --bcc-floating-sidebar-height: 100%;
184
+ }
185
+
186
+ .bcc-floating-sidebar--embedded > .bcc-floating-sidebar__rail {
187
+ position: static;
188
+ flex: none;
189
+ inline-size: 100%;
190
+ block-size: 100%;
191
+ max-block-size: none;
192
+ }
@@ -0,0 +1,25 @@
1
+ # Responsive Navigation
2
+
3
+ Composes Floating Contextual Navigation with the same Global Navigation Rail in horizontal presentation and a contextual Navigation Drawer. It does not duplicate Rail or Sidebar styling.
4
+
5
+ ## Responsive presentation
6
+
7
+ Set `data-small-pattern="drawer"` on the root to use a menu-launcher and drawer without the bottom bar. Omit this attribute (or use `bottom-drawer`) for the default bottom bar plus drawer.
8
+
9
+ At or below 48rem, the Small presentation activates and the Large presentation becomes inert. The horizontal Rail switches Hubs directly; a separate labelled control opens the selected Hub's Navigation Menu in the Drawer. Above 48rem the contextual navigation is active. Hover previews are capability-sensitive and never the only navigation interaction.
10
+
11
+ `mountResponsiveNavigation(root)` supplies `selectHub(id)`, `openMenu()`, `closeMenu()` and `destroy()`. All Hub IDs must correspond to one large Hub, one small Rail control and one mobile content section. Routing and page content remain the consuming application's responsibility.
12
+
13
+ The 48rem breakpoint is deliberately shared between CSS and the default JavaScript media query. An application needing different thresholds must override both styles and `data-responsive-query` together; changing only one will make inert state and visual state disagree.
14
+
15
+ ## Behaviour ownership
16
+
17
+ BufferCore Disclosure owns drawer visibility, Escape and ARIA; Focus Trap and Scroll Lock manage the modal overlay. The composition coordinates presentation, selected Hub, backdrop and focus restoration. The standalone Navigation Drawer owns only its surface. All styling uses BufferCore Semantics rather than Primitives.
18
+
19
+ ## Updated responsive contract
20
+
21
+ Use **Small / Medium / Large** for presentation size, not device names. Small (at or below 48rem) uses the existing Global Navigation Rail in horizontal orientation plus a contextual Drawer; `data-small-pattern="drawer"` provides a launcher-only alternative. Medium (above 48rem up to 64rem) retains the vertical Rail and a floating Sidebar overlay without consuming workspace width. Large uses the original contextual pinning and reserved space. These are initial defaults, not device or input-method detection.
22
+
23
+ The controller uses one matchMedia boundary for the Small presentation; Medium and Large share the same underlying contextual controller. CSS owns the Medium overlay track. CSS and JavaScript query thresholds must agree. A wide touch device can still use click/tap; hover preview is optional and never the sole way to navigate.
24
+
25
+ The Bottom Navigation Bar Asset remains independently available for backwards compatibility, but Responsive Navigation no longer depends on it: the Global Navigation Rail handles horizontal layout and shares the same visual system.