frontile 0.18.6 → 0.18.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/declarations/-private/icons.d.ts +4 -0
- package/declarations/-private/icons.d.ts.map +1 -1
- package/declarations/components/buttons/chip.d.ts +2 -3
- package/declarations/components/buttons/chip.d.ts.map +1 -1
- package/declarations/components/collections/dropdown/dropdown.d.ts +50 -53
- package/declarations/components/collections/dropdown/dropdown.d.ts.map +1 -1
- package/declarations/components/collections/listbox/item.d.ts +52 -1
- package/declarations/components/collections/listbox/item.d.ts.map +1 -1
- package/declarations/components/forms/form.d.ts +3 -2
- package/declarations/components/forms/form.d.ts.map +1 -1
- package/declarations/components/forms/native-select.d.ts.map +1 -1
- package/declarations/components/forms/select/select.d.ts +17 -0
- package/declarations/components/forms/select/select.d.ts.map +1 -1
- package/declarations/components/forms/select/trigger.d.ts +8 -0
- package/declarations/components/forms/select/trigger.d.ts.map +1 -1
- package/declarations/components/forms/select/types.d.ts +8 -4
- package/declarations/components/forms/select/types.d.ts.map +1 -1
- package/declarations/components/layout/app-layout-state.d.ts +32 -0
- package/declarations/components/layout/app-layout-state.d.ts.map +1 -0
- package/declarations/components/layout/app-layout.d.ts +1298 -0
- package/declarations/components/layout/app-layout.d.ts.map +1 -0
- package/declarations/components/layout/aside-toggle.d.ts +55 -0
- package/declarations/components/layout/aside-toggle.d.ts.map +1 -0
- package/declarations/components/layout/aside.d.ts +1055 -0
- package/declarations/components/layout/aside.d.ts.map +1 -0
- package/declarations/components/layout/bottom-nav-more.d.ts +123 -0
- package/declarations/components/layout/bottom-nav-more.d.ts.map +1 -0
- package/declarations/components/layout/bottom-nav.d.ts +60 -0
- package/declarations/components/layout/bottom-nav.d.ts.map +1 -0
- package/declarations/components/layout/context.d.ts +143 -0
- package/declarations/components/layout/context.d.ts.map +1 -0
- package/declarations/components/layout/index.d.ts +14 -0
- package/declarations/components/layout/index.d.ts.map +1 -0
- package/declarations/components/layout/main.d.ts +28 -0
- package/declarations/components/layout/main.d.ts.map +1 -0
- package/declarations/components/layout/menu-toggle.d.ts +58 -0
- package/declarations/components/layout/menu-toggle.d.ts.map +1 -0
- package/declarations/components/layout/nav-context.d.ts +45 -0
- package/declarations/components/layout/nav-context.d.ts.map +1 -0
- package/declarations/components/layout/nav-folder.d.ts +216 -0
- package/declarations/components/layout/nav-folder.d.ts.map +1 -0
- package/declarations/components/layout/nav-item.d.ts +220 -0
- package/declarations/components/layout/nav-item.d.ts.map +1 -0
- package/declarations/components/layout/nav-link.d.ts +67 -0
- package/declarations/components/layout/nav-link.d.ts.map +1 -0
- package/declarations/components/layout/navbar.d.ts +1028 -0
- package/declarations/components/layout/navbar.d.ts.map +1 -0
- package/declarations/components/layout/page-header.d.ts +40 -0
- package/declarations/components/layout/page-header.d.ts.map +1 -0
- package/declarations/components/layout/sidebar-group.d.ts +41 -0
- package/declarations/components/layout/sidebar-group.d.ts.map +1 -0
- package/declarations/components/layout/sidebar-toggle.d.ts +71 -0
- package/declarations/components/layout/sidebar-toggle.d.ts.map +1 -0
- package/declarations/components/layout/sidebar.d.ts +1215 -0
- package/declarations/components/layout/sidebar.d.ts.map +1 -0
- package/declarations/components/navigation/index.d.ts +1 -0
- package/declarations/components/navigation/index.d.ts.map +1 -1
- package/declarations/components/navigation/stepper/collapse-menu.d.ts +42 -0
- package/declarations/components/navigation/stepper/collapse-menu.d.ts.map +1 -0
- package/declarations/components/navigation/stepper/list.d.ts +24 -0
- package/declarations/components/navigation/stepper/list.d.ts.map +1 -0
- package/declarations/components/navigation/stepper/panel.d.ts +42 -0
- package/declarations/components/navigation/stepper/panel.d.ts.map +1 -0
- package/declarations/components/navigation/stepper/step.d.ts +123 -0
- package/declarations/components/navigation/stepper/step.d.ts.map +1 -0
- package/declarations/components/navigation/stepper/stepper.d.ts +947 -0
- package/declarations/components/navigation/stepper/stepper.d.ts.map +1 -0
- package/declarations/components/navigation/stepper.d.ts +6 -0
- package/declarations/components/navigation/stepper.d.ts.map +1 -0
- package/declarations/components/navigation/tab-nav/item.d.ts +2 -2
- package/declarations/components/navigation/tab-nav/item.d.ts.map +1 -1
- package/declarations/components/overlays/portal.d.ts.map +1 -1
- package/declarations/components/status/badge.d.ts +83 -0
- package/declarations/components/status/badge.d.ts.map +1 -0
- package/declarations/components/status/index.d.ts +1 -0
- package/declarations/components/status/index.d.ts.map +1 -1
- package/declarations/components/utilities/collapsible.d.ts +19 -2
- package/declarations/components/utilities/collapsible.d.ts.map +1 -1
- package/declarations/index.d.ts +1 -0
- package/declarations/index.d.ts.map +1 -1
- package/declarations/layout.d.ts +2 -0
- package/declarations/layout.d.ts.map +1 -0
- package/declarations/utils/breakpoint.d.ts +16 -0
- package/declarations/utils/breakpoint.d.ts.map +1 -0
- package/declarations/utils/document-listener.d.ts +6 -0
- package/declarations/utils/document-listener.d.ts.map +1 -0
- package/declarations/utils/listManager.d.ts +7 -1
- package/declarations/utils/listManager.d.ts.map +1 -1
- package/declarations/utils/route-active.d.ts +34 -0
- package/declarations/utils/route-active.d.ts.map +1 -0
- package/declarations/utils/selection-indicator.d.ts +7 -4
- package/declarations/utils/selection-indicator.d.ts.map +1 -1
- package/dist/components/buttons/chip.js +12 -1
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/collections/calendar/header.js +1 -1
- package/dist/components/collections/dropdown/dropdown.js +172 -48
- package/dist/components/collections/dropdown/dropdown.js.map +1 -1
- package/dist/components/collections/listbox/item.js +36 -2
- package/dist/components/collections/listbox/item.js.map +1 -1
- package/dist/components/collections/table/column-visibility.js +1 -1
- package/dist/components/collections/table/sort-button.js +1 -1
- package/dist/components/disclosure/accordion/item.js +1 -1
- package/dist/components/forms/autocomplete.js +1 -1
- package/dist/components/forms/date-picker/end-content.js +1 -1
- package/dist/components/forms/form.js.map +1 -1
- package/dist/components/forms/native-select.js +2 -2
- package/dist/components/forms/native-select.js.map +1 -1
- package/dist/components/forms/select/end-content.js +1 -1
- package/dist/components/forms/select/select.js +3 -2
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/forms/select/trigger.js +1 -1
- package/dist/components/forms/select/trigger.js.map +1 -1
- package/dist/components/layout/app-layout-state.js +64 -0
- package/dist/components/layout/app-layout-state.js.map +1 -0
- package/dist/components/layout/app-layout.js +441 -0
- package/dist/components/layout/app-layout.js.map +1 -0
- package/dist/components/layout/aside-toggle.js +55 -0
- package/dist/components/layout/aside-toggle.js.map +1 -0
- package/dist/components/layout/aside.js +98 -0
- package/dist/components/layout/aside.js.map +1 -0
- package/dist/components/layout/bottom-nav-more.js +150 -0
- package/dist/components/layout/bottom-nav-more.js.map +1 -0
- package/dist/components/layout/bottom-nav.js +65 -0
- package/dist/components/layout/bottom-nav.js.map +1 -0
- package/dist/components/layout/context.js +103 -0
- package/dist/components/layout/context.js.map +1 -0
- package/dist/components/layout/index.js +14 -0
- package/dist/components/layout/index.js.map +1 -0
- package/dist/components/layout/main.js +34 -0
- package/dist/components/layout/main.js.map +1 -0
- package/dist/components/layout/menu-toggle.js +61 -0
- package/dist/components/layout/menu-toggle.js.map +1 -0
- package/dist/components/layout/nav-context.js +85 -0
- package/dist/components/layout/nav-context.js.map +1 -0
- package/dist/components/layout/nav-folder.js +271 -0
- package/dist/components/layout/nav-folder.js.map +1 -0
- package/dist/components/layout/nav-item.js +192 -0
- package/dist/components/layout/nav-item.js.map +1 -0
- package/dist/components/layout/nav-link.js +58 -0
- package/dist/components/layout/nav-link.js.map +1 -0
- package/dist/components/layout/navbar.js +51 -0
- package/dist/components/layout/navbar.js.map +1 -0
- package/dist/components/layout/page-header.js +45 -0
- package/dist/components/layout/page-header.js.map +1 -0
- package/dist/components/layout/sidebar-group.js +41 -0
- package/dist/components/layout/sidebar-group.js.map +1 -0
- package/dist/components/layout/sidebar-toggle.js +82 -0
- package/dist/components/layout/sidebar-toggle.js.map +1 -0
- package/dist/components/layout/sidebar.js +252 -0
- package/dist/components/layout/sidebar.js.map +1 -0
- package/dist/components/navigation/breadcrumbs/separator.js +1 -1
- package/dist/components/navigation/index.js +4 -0
- package/dist/components/navigation/index.js.map +1 -1
- package/dist/components/navigation/pagination/pagination.js +1 -1
- package/dist/components/navigation/stepper/collapse-menu.js +128 -0
- package/dist/components/navigation/stepper/collapse-menu.js.map +1 -0
- package/dist/components/navigation/stepper/list.js +17 -0
- package/dist/components/navigation/stepper/list.js.map +1 -0
- package/dist/components/navigation/stepper/panel.js +26 -0
- package/dist/components/navigation/stepper/panel.js.map +1 -0
- package/dist/components/navigation/stepper/step.js +130 -0
- package/dist/components/navigation/stepper/step.js.map +1 -0
- package/dist/components/navigation/stepper/stepper.js +475 -0
- package/dist/components/navigation/stepper/stepper.js.map +1 -0
- package/dist/components/navigation/stepper.js +5 -0
- package/dist/components/navigation/stepper.js.map +1 -0
- package/dist/components/navigation/tab-nav/item.js +6 -40
- package/dist/components/navigation/tab-nav/item.js.map +1 -1
- package/dist/components/notifications/index.js +1 -1
- package/dist/components/notifications/notification-card.js +2 -2
- package/dist/components/notifications/notifications-container.js +1 -1
- package/dist/components/overlays/portal.js +11 -2
- package/dist/components/overlays/portal.js.map +1 -1
- package/dist/components/status/alert.js +1 -1
- package/dist/components/status/badge.js +52 -0
- package/dist/components/status/badge.js.map +1 -0
- package/dist/components/status/index.js +1 -0
- package/dist/components/status/index.js.map +1 -1
- package/dist/components/utilities/collapsible.js +33 -5
- package/dist/components/utilities/collapsible.js.map +1 -1
- package/dist/{icons-DZ61nCzv.js → icons-55dthVFk.js} +14 -2
- package/dist/{icons-DZ61nCzv.js.map → icons-55dthVFk.js.map} +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.js +14 -0
- package/dist/layout.js.map +1 -0
- package/dist/navigation.js +4 -0
- package/dist/navigation.js.map +1 -1
- package/dist/{notification-card-dz-eE6z9.js → notification-card-BPfDo-Gf.js} +2 -2
- package/dist/{notification-card-dz-eE6z9.js.map → notification-card-BPfDo-Gf.js.map} +1 -1
- package/dist/notifications.js +1 -1
- package/dist/status.js +1 -0
- package/dist/status.js.map +1 -1
- package/dist/utils/breakpoint.js +56 -0
- package/dist/utils/breakpoint.js.map +1 -0
- package/dist/utils/document-listener.js +10 -0
- package/dist/utils/document-listener.js.map +1 -0
- package/dist/utils/listManager.js +12 -2
- package/dist/utils/listManager.js.map +1 -1
- package/dist/utils/route-active.js +70 -0
- package/dist/utils/route-active.js.map +1 -0
- package/dist/utils/selection-indicator.js +25 -5
- package/dist/utils/selection-indicator.js.map +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked, cached } from '@glimmer/tracking';
|
|
3
|
+
import { hash } from '@ember/helper';
|
|
4
|
+
import { registerDestructor } from '@ember/destroyable';
|
|
5
|
+
import { guidFor } from '@ember/object/internals';
|
|
6
|
+
import { useStyles } from '@frontile/theme';
|
|
7
|
+
import Drawer from '../overlays/drawer.js';
|
|
8
|
+
import { NavItem } from './nav-item.js';
|
|
9
|
+
import { NavFolder } from './nav-folder.js';
|
|
10
|
+
import { SidebarGroup } from './sidebar-group.js';
|
|
11
|
+
import { SidebarToggle } from './sidebar-toggle.js';
|
|
12
|
+
import { layoutVariants } from './context.js';
|
|
13
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
14
|
+
import { setComponentTemplate } from '@ember/component';
|
|
15
|
+
import templateOnly from '@ember/component/template-only';
|
|
16
|
+
import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../../runtime--fcdnjmJ-BOdRhmsS.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The sidebar navigation: a full-height `nav` landmark that can collapse to
|
|
20
|
+
* an icon rail. Inside `AppLayout` it takes the first (or, with
|
|
21
|
+
* `@sidebarSide="end"`, the last) column. Below the layout's `@breakpoint`
|
|
22
|
+
* the same block renders inside a `Drawer` instead, opened by `MenuToggle`,
|
|
23
|
+
* so the sidebar is written once. It also works on its own, always inline,
|
|
24
|
+
* with `@collapsed` or its own state.
|
|
25
|
+
*/
|
|
26
|
+
class Sidebar extends Component {
|
|
27
|
+
static {
|
|
28
|
+
decorateFieldV2(this.prototype, "localCollapsed", [tracked]);
|
|
29
|
+
}
|
|
30
|
+
#localCollapsed = (initializeDeferredDecorator(this, "localCollapsed"), void 0);
|
|
31
|
+
constructor(owner, args) {
|
|
32
|
+
super(owner, args);
|
|
33
|
+
this.localCollapsed = args.defaultCollapsed ?? false;
|
|
34
|
+
const unregister = args.layout?.registerSidebar(this);
|
|
35
|
+
if (unregister) {
|
|
36
|
+
registerDestructor(this, unregister);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Below the breakpoint the content moves into the drawer. Only one of the
|
|
41
|
+
* two is rendered, so the block (and any ids in it) exists once.
|
|
42
|
+
*/
|
|
43
|
+
get inDrawer() {
|
|
44
|
+
return this.args.layout?.belowBreakpoint ?? false;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* `@mobileNav="bottom"` below the breakpoint: the layout's `BottomNav`
|
|
48
|
+
* replaces the sidebar, so nothing renders (no drawer, no block). The
|
|
49
|
+
* sidebar stays registered, so the layout still knows about it.
|
|
50
|
+
*/
|
|
51
|
+
get hiddenForBottomNav() {
|
|
52
|
+
return this.args.layout?.bottomNavMode ?? false;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `Drawer` placements are physical, so `start` is resolved against the
|
|
56
|
+
* layout's direction: left in a left-to-right document, right in RTL.
|
|
57
|
+
*/
|
|
58
|
+
get placement() {
|
|
59
|
+
const layout = this.args.layout;
|
|
60
|
+
const atEnd = layout?.config.sidebarSide === 'end';
|
|
61
|
+
const rtl = layout?.isRtl() ?? false;
|
|
62
|
+
return atEnd !== rtl ? 'right' : 'left';
|
|
63
|
+
}
|
|
64
|
+
/** Whether the phone drawer is open. */
|
|
65
|
+
get drawerOpen() {
|
|
66
|
+
return this.args.layout?.state.mobileSidebarOpen ?? false;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Closes the drawer. Also handed to each `Item` while the sidebar is in the
|
|
70
|
+
* drawer, so picking a destination closes it.
|
|
71
|
+
*/
|
|
72
|
+
closeDrawer = () => {
|
|
73
|
+
this.args.layout?.state.closeMobileSidebar();
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Return focus to the element that opened the drawer, `MenuToggle` or
|
|
77
|
+
* otherwise. With nothing focused (the body), fall back to the layout's
|
|
78
|
+
* `MenuToggle` when it is on screen.
|
|
79
|
+
*/
|
|
80
|
+
get focusTrapOptions() {
|
|
81
|
+
const toggleId = this.args.layout?.menuToggleId;
|
|
82
|
+
return {
|
|
83
|
+
setReturnFocus: previous => {
|
|
84
|
+
if (previous && previous !== document.body && previous.isConnected) {
|
|
85
|
+
return previous;
|
|
86
|
+
}
|
|
87
|
+
const toggle = toggleId ? document.getElementById(toggleId) : null;
|
|
88
|
+
return toggle && toggle.getClientRects().length > 0 ? toggle : previous;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The collapse asked for, before `@collapsible="none"` overrides it: the
|
|
94
|
+
* layout's state, `@collapsed`, or the sidebar's own.
|
|
95
|
+
*/
|
|
96
|
+
get collapseRequested() {
|
|
97
|
+
const layout = this.args.layout;
|
|
98
|
+
if (layout) return layout.state.sidebarCollapsed;
|
|
99
|
+
return this.args.collapsed ?? this.localCollapsed;
|
|
100
|
+
}
|
|
101
|
+
setCollapsed(collapsed) {
|
|
102
|
+
const layout = this.args.layout;
|
|
103
|
+
if (layout) {
|
|
104
|
+
if (collapsed) layout.state.collapseSidebar();else layout.state.expandSidebar();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (this.args.collapsed === undefined) this.localCollapsed = collapsed;
|
|
108
|
+
this.args.onCollapsedChange?.(collapsed);
|
|
109
|
+
}
|
|
110
|
+
toggle = () => {
|
|
111
|
+
this.setCollapsed(!this.collapseRequested);
|
|
112
|
+
};
|
|
113
|
+
collapse = () => {
|
|
114
|
+
this.setCollapsed(true);
|
|
115
|
+
};
|
|
116
|
+
expand = () => {
|
|
117
|
+
this.setCollapsed(false);
|
|
118
|
+
};
|
|
119
|
+
get collapsible() {
|
|
120
|
+
return this.args.collapsible ?? 'icon';
|
|
121
|
+
}
|
|
122
|
+
/** Collapse applies unless the sidebar opted out of it. */
|
|
123
|
+
get collapsed() {
|
|
124
|
+
return this.collapsible !== 'none' && this.collapseRequested;
|
|
125
|
+
}
|
|
126
|
+
/** As drawn: the drawer is always expanded. */
|
|
127
|
+
get isCollapsed() {
|
|
128
|
+
return !this.inDrawer && this.collapsed;
|
|
129
|
+
}
|
|
130
|
+
get size() {
|
|
131
|
+
return this.args.size ?? 'default';
|
|
132
|
+
}
|
|
133
|
+
get id() {
|
|
134
|
+
return this.args.layout?.sidebarId ?? `${guidFor(this)}-sidebar`;
|
|
135
|
+
}
|
|
136
|
+
get label() {
|
|
137
|
+
return this.args.label ?? 'Main';
|
|
138
|
+
}
|
|
139
|
+
get styles() {
|
|
140
|
+
const layout = this.args.layout;
|
|
141
|
+
return useStyles().appLayout({
|
|
142
|
+
...layoutVariants(layout?.config),
|
|
143
|
+
variant: layout?.config.variant ?? this.args.variant ?? 'attached',
|
|
144
|
+
color: this.args.color ?? layout?.config.color,
|
|
145
|
+
// Inside a layout the sidebar inherits the root's color unless it has
|
|
146
|
+
// its own; outside one there is no root to inherit from.
|
|
147
|
+
partColor: this.args.color ?? (layout ? undefined : 'neutral'),
|
|
148
|
+
sidebarSurface: this.args.surface ?? layout?.config.sidebarSurface,
|
|
149
|
+
standalone: !layout,
|
|
150
|
+
inDrawer: this.inDrawer,
|
|
151
|
+
collapsible: this.collapsible,
|
|
152
|
+
collapsed: this.collapsed,
|
|
153
|
+
sidebarSize: this.size
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
static {
|
|
157
|
+
decorateMethodV2(this.prototype, "styles", [cached]);
|
|
158
|
+
}
|
|
159
|
+
get classNames() {
|
|
160
|
+
const custom = [this.args.layout?.classes?.sidebar, this.args.class].filter(Boolean).join(' ');
|
|
161
|
+
return this.styles.sidebar({
|
|
162
|
+
class: custom || undefined
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
static {
|
|
166
|
+
decorateMethodV2(this.prototype, "classNames", [cached]);
|
|
167
|
+
}
|
|
168
|
+
get drawerCloseButtonClass() {
|
|
169
|
+
return this.styles.drawerCloseButton({
|
|
170
|
+
class: this.args.layout?.classes?.drawerCloseButton
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
static {
|
|
174
|
+
decorateMethodV2(this.prototype, "drawerCloseButtonClass", [cached]);
|
|
175
|
+
}
|
|
176
|
+
get mobileClassNames() {
|
|
177
|
+
return this.styles.mobileSidebar({
|
|
178
|
+
class: this.args.layout?.classes?.mobileSidebar
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
get slotClasses() {
|
|
182
|
+
const custom = this.args.layout?.classes;
|
|
183
|
+
return {
|
|
184
|
+
header: this.styles.sidebarHeader({
|
|
185
|
+
class: custom?.sidebarHeader
|
|
186
|
+
}),
|
|
187
|
+
body: this.styles.sidebarBody({
|
|
188
|
+
class: custom?.sidebarBody
|
|
189
|
+
}),
|
|
190
|
+
footer: this.styles.sidebarFooter({
|
|
191
|
+
class: custom?.sidebarFooter
|
|
192
|
+
}),
|
|
193
|
+
group: {
|
|
194
|
+
sidebarGroup: this.styles.sidebarGroup({
|
|
195
|
+
class: custom?.sidebarGroup
|
|
196
|
+
}),
|
|
197
|
+
sidebarGroupLabel: this.styles.sidebarGroupLabel({
|
|
198
|
+
class: custom?.sidebarGroupLabel
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Whether the block is drawn as the icon rail, where item labels become
|
|
205
|
+
* tooltips. Never in the drawer, which is always expanded.
|
|
206
|
+
*/
|
|
207
|
+
static {
|
|
208
|
+
decorateMethodV2(this.prototype, "slotClasses", [cached]);
|
|
209
|
+
}
|
|
210
|
+
get rail() {
|
|
211
|
+
return !this.inDrawer && this.collapsible === 'icon' && this.collapsed;
|
|
212
|
+
}
|
|
213
|
+
/** Rail tooltips open toward the content, away from the sidebar's edge. */
|
|
214
|
+
get tooltipPlacement() {
|
|
215
|
+
return this.placement === 'left' ? 'right' : 'left';
|
|
216
|
+
}
|
|
217
|
+
static {
|
|
218
|
+
setComponentTemplate(precompileTemplate("{{#if this.hiddenForBottomNav}}\n {{!-- Nothing: the BottomNav is the navigation here. --}}\n{{else if this.inDrawer}}\n <Drawer @isOpen={{this.drawerOpen}} @onClose={{this.closeDrawer}} @placement={{this.placement}} @size=\"xs\" @variant=\"flat\" @closeButtonSize=\"md\" @classes={{hash closeButton=this.drawerCloseButtonClass}} @focusTrapOptions={{this.focusTrapOptions}} id={{@layout.drawerId}} aria-label={{this.label}}>\n <nav id={{this.id}} aria-label={{this.label}} data-part=\"mobile-sidebar\" data-collapsible={{this.collapsible}} data-collapsed=\"false\" class={{this.mobileClassNames}} ...attributes>\n {{yield (hash Header=(component SidebarHeader class=this.slotClasses.header) Body=(component SidebarBody class=this.slotClasses.body) Footer=(component SidebarFooter class=this.slotClasses.footer) Item=(component NavItem rail=this.rail tooltipPlacement=this.tooltipPlacement onActivate=this.closeDrawer) Folder=(component NavFolder rail=this.rail tooltipPlacement=this.tooltipPlacement onActivate=this.closeDrawer) Group=(component SidebarGroup classes=this.slotClasses.group) Toggle=(component DrawerToggle) isCollapsed=false isInDrawer=true toggle=this.toggle collapse=this.collapse expand=this.expand)}}\n </nav>\n </Drawer>\n{{else}}\n <nav id={{this.id}} aria-label={{this.label}} data-part=\"sidebar\" data-collapsible={{this.collapsible}} data-collapsed={{if this.collapsed \"true\" \"false\"}} class={{this.classNames}} ...attributes>\n {{yield (hash Header=(component SidebarHeader class=this.slotClasses.header) Body=(component SidebarBody class=this.slotClasses.body) Footer=(component SidebarFooter class=this.slotClasses.footer) Item=(component NavItem rail=this.rail tooltipPlacement=this.tooltipPlacement) Folder=(component NavFolder rail=this.rail tooltipPlacement=this.tooltipPlacement) Group=(component SidebarGroup classes=this.slotClasses.group) Toggle=(component SidebarToggle layout=@layout collapsed=this.collapsed onToggle=this.toggle) isCollapsed=this.isCollapsed isInDrawer=false toggle=this.toggle collapse=this.collapse expand=this.expand)}}\n </nav>\n{{/if}}", {
|
|
219
|
+
strictMode: true,
|
|
220
|
+
scope: () => ({
|
|
221
|
+
Drawer,
|
|
222
|
+
hash,
|
|
223
|
+
SidebarHeader,
|
|
224
|
+
SidebarBody,
|
|
225
|
+
SidebarFooter,
|
|
226
|
+
NavItem,
|
|
227
|
+
NavFolder,
|
|
228
|
+
SidebarGroup,
|
|
229
|
+
DrawerToggle,
|
|
230
|
+
SidebarToggle
|
|
231
|
+
})
|
|
232
|
+
}), this);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// In the drawer there is nothing to collapse, so `Toggle` renders nothing.
|
|
236
|
+
// It takes `SidebarToggle`'s signature so the same invocation, arguments and
|
|
237
|
+
// attributes included, compiles in both places; they are dropped.
|
|
238
|
+
const DrawerToggle = setComponentTemplate(precompileTemplate("{{!-- No toggle in the drawer. --}}", {
|
|
239
|
+
strictMode: true
|
|
240
|
+
}), templateOnly());
|
|
241
|
+
const SidebarHeader = setComponentTemplate(precompileTemplate("<div data-part=\"sidebar-header\" class={{@class}} ...attributes>{{yield}}</div>", {
|
|
242
|
+
strictMode: true
|
|
243
|
+
}), templateOnly());
|
|
244
|
+
const SidebarBody = setComponentTemplate(precompileTemplate("<div data-part=\"sidebar-body\" class={{@class}} ...attributes>{{yield}}</div>", {
|
|
245
|
+
strictMode: true
|
|
246
|
+
}), templateOnly());
|
|
247
|
+
const SidebarFooter = setComponentTemplate(precompileTemplate("<div data-part=\"sidebar-footer\" class={{@class}} ...attributes>{{yield}}</div>", {
|
|
248
|
+
strictMode: true
|
|
249
|
+
}), templateOnly());
|
|
250
|
+
|
|
251
|
+
export { Sidebar, Sidebar as default };
|
|
252
|
+
//# sourceMappingURL=sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar.js","sources":["../../../src/components/layout/sidebar.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { registerDestructor } from '@ember/destroyable';\nimport { guidFor } from '@ember/object/internals';\nimport { useStyles } from '@frontile/theme';\nimport Drawer from '../overlays/drawer';\nimport NavItem from './nav-item';\nimport NavFolder from './nav-folder';\nimport SidebarGroup from './sidebar-group';\nimport SidebarToggle, { type SidebarToggleSignature } from './sidebar-toggle';\nimport { layoutVariants, type AppLayoutContext } from './context';\nimport type Owner from '@ember/owner';\nimport type { AppLayoutVariants } from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\nimport type { TOC } from '@ember/component/template-only';\n\ninterface SidebarSectionSignature {\n Args: { class?: string };\n Blocks: { default: [] };\n Element: HTMLElement;\n}\n\ninterface SidebarArgs {\n /**\n * How the sidebar collapses. `icon` shrinks it to a rail where item labels\n * are visually hidden but stay available to assistive technology;\n * `offcanvas` hides it entirely while collapsed; `none` ignores collapse.\n *\n * @defaultValue 'icon'\n */\n collapsible?: 'icon' | 'offcanvas' | 'none';\n\n /**\n * The sidebar's width preset. `default` is the standard sidebar; `rail` is\n * a narrow column (80px) for a stack of icon-over-label items, usually with\n * `@collapsible=\"none\"`. It is a named preset, not a length: for any other\n * width, pass a width utility as `@class` (and set `--app-sidebar-width`\n * yourself if you read the token).\n *\n * @defaultValue 'default'\n */\n size?: 'default' | 'rail';\n\n /**\n * Classes for the sidebar, merged with the theme's so a conflicting class\n * wins: `@class=\"w-72\"` replaces the width. A width given this way applies\n * whether or not the sidebar is collapsed, so pair it with\n * `@collapsible=\"none\"`. Applies to the inline sidebar, not the drawer.\n */\n class?: string;\n\n /**\n * The accessible name of the sidebar's `nav` landmark. Give each navigation\n * on the page a distinct name.\n *\n * @defaultValue 'Main'\n */\n label?: string;\n\n /**\n * The layout variant, `inset` or `attached`, which sets the sidebar's\n * widths and the gutter around its rows. Only used when the sidebar is\n * rendered outside an `AppLayout`; inside one it follows the layout.\n *\n * @defaultValue 'attached'\n */\n variant?: AppLayoutVariants['variant'];\n\n /**\n * The sidebar's color, one of the theme's semantic categories. Inside an\n * `AppLayout` it defaults to the layout's `@color`.\n *\n * @defaultValue 'neutral'\n */\n color?: AppLayoutVariants['color'];\n\n /**\n * How the sidebar wears its color: `plain` keeps its ground and tints its\n * rows (hover and the current page); `solid` fills the sidebar with the\n * color, with rows in its contrast color. In the phone drawer the rows are\n * always tinted. Inside an `AppLayout` it defaults to the layout's\n * `@sidebarSurface`.\n *\n * @defaultValue 'plain'\n */\n surface?: AppLayoutVariants['sidebarSurface'];\n\n /**\n * Whether the sidebar is collapsed, for a sidebar you control. `Toggle`\n * and the yielded actions then call `@onCollapsedChange` and leave the\n * change to you. Without it the sidebar keeps its own state, starting from\n * `@defaultCollapsed`. Only used outside an `AppLayout`; inside one, use the\n * layout's `@sidebarCollapsed`.\n */\n collapsed?: boolean;\n\n /**\n * Whether the sidebar starts collapsed when it keeps its own state (no\n * `@collapsed`). Only used outside an `AppLayout`.\n *\n * @defaultValue false\n */\n defaultCollapsed?: boolean;\n\n /**\n * Called with the requested collapsed state when `Toggle` or a yielded\n * action changes it. Only used outside an `AppLayout`.\n */\n onCollapsedChange?: (collapsed: boolean) => void;\n\n /**\n * Supplied by `AppLayout`. Not part of the public API.\n *\n * @internal\n */\n layout?: AppLayoutContext;\n}\n\ninterface SidebarSignature {\n Args: SidebarArgs;\n Blocks: {\n /**\n * Yields `Header`, `Body` and `Footer` sections, `Item` links, `Folder`\n * for a collapsible set of items, `Group` to label a set of items, and\n * `Toggle`, the button that collapses and expands the sidebar. It also\n * yields the sidebar's state, `isCollapsed` and `isInDrawer`, and the\n * actions `toggle`, `collapse` and `expand`. Place\n * `Toggle` yourself, usually in `Header` or `Footer`; there is no default\n * toggle. In the phone drawer `Toggle` renders nothing (the drawer is\n * always expanded and has its own close button), so the same markup works\n * at every width. In the icon rail, `Item` labels are visually\n * hidden but still read by screen readers; for your own markup, wrap the\n * text in `<span data-sidebar-label>` to get the same behavior.\n */\n default: [\n {\n Header: WithBoundArgs<typeof SidebarHeader, 'class'>;\n Body: WithBoundArgs<typeof SidebarBody, 'class'>;\n Footer: WithBoundArgs<typeof SidebarFooter, 'class'>;\n Item: WithBoundArgs<typeof NavItem, 'rail' | 'tooltipPlacement'>;\n Folder: WithBoundArgs<\n typeof NavFolder,\n 'rail' | 'tooltipPlacement' | 'onActivate'\n >;\n Group: WithBoundArgs<typeof SidebarGroup, 'classes'>;\n Toggle: WithBoundArgs<\n typeof SidebarToggle,\n 'layout' | 'collapsed' | 'onToggle'\n >;\n /**\n * Whether the sidebar is drawn collapsed: the icon rail, or hidden\n * with `@collapsible=\"offcanvas\"`. Never in the drawer, which is\n * always expanded.\n */\n isCollapsed: boolean;\n /** Whether the sidebar is rendered in the phone drawer. */\n isInDrawer: boolean;\n /** Collapses an expanded sidebar and expands a collapsed one. */\n toggle: () => void;\n collapse: () => void;\n expand: () => void;\n }\n ];\n };\n Element: HTMLElement;\n}\n\n/**\n * The sidebar navigation: a full-height `nav` landmark that can collapse to\n * an icon rail. Inside `AppLayout` it takes the first (or, with\n * `@sidebarSide=\"end\"`, the last) column. Below the layout's `@breakpoint`\n * the same block renders inside a `Drawer` instead, opened by `MenuToggle`,\n * so the sidebar is written once. It also works on its own, always inline,\n * with `@collapsed` or its own state.\n */\nclass Sidebar extends Component<SidebarSignature> {\n @tracked localCollapsed: boolean;\n\n constructor(owner: Owner, args: SidebarArgs) {\n super(owner, args);\n this.localCollapsed = args.defaultCollapsed ?? false;\n const unregister = args.layout?.registerSidebar(this);\n if (unregister) {\n registerDestructor(this, unregister);\n }\n }\n\n /**\n * Below the breakpoint the content moves into the drawer. Only one of the\n * two is rendered, so the block (and any ids in it) exists once.\n */\n get inDrawer(): boolean {\n return this.args.layout?.belowBreakpoint ?? false;\n }\n\n /**\n * `@mobileNav=\"bottom\"` below the breakpoint: the layout's `BottomNav`\n * replaces the sidebar, so nothing renders (no drawer, no block). The\n * sidebar stays registered, so the layout still knows about it.\n */\n get hiddenForBottomNav(): boolean {\n return this.args.layout?.bottomNavMode ?? false;\n }\n\n /**\n * `Drawer` placements are physical, so `start` is resolved against the\n * layout's direction: left in a left-to-right document, right in RTL.\n */\n get placement(): 'left' | 'right' {\n const layout = this.args.layout;\n const atEnd = layout?.config.sidebarSide === 'end';\n const rtl = layout?.isRtl() ?? false;\n return atEnd !== rtl ? 'right' : 'left';\n }\n\n /** Whether the phone drawer is open. */\n get drawerOpen(): boolean {\n return this.args.layout?.state.mobileSidebarOpen ?? false;\n }\n\n /**\n * Closes the drawer. Also handed to each `Item` while the sidebar is in the\n * drawer, so picking a destination closes it.\n */\n closeDrawer = (): void => {\n this.args.layout?.state.closeMobileSidebar();\n };\n\n /**\n * Return focus to the element that opened the drawer, `MenuToggle` or\n * otherwise. With nothing focused (the body), fall back to the layout's\n * `MenuToggle` when it is on screen.\n */\n get focusTrapOptions() {\n const toggleId = this.args.layout?.menuToggleId;\n return {\n setReturnFocus: (previous: HTMLElement | SVGElement) => {\n if (previous && previous !== document.body && previous.isConnected) {\n return previous;\n }\n const toggle = toggleId ? document.getElementById(toggleId) : null;\n return toggle && toggle.getClientRects().length > 0 ? toggle : previous;\n }\n };\n }\n\n /**\n * The collapse asked for, before `@collapsible=\"none\"` overrides it: the\n * layout's state, `@collapsed`, or the sidebar's own.\n */\n get collapseRequested(): boolean {\n const layout = this.args.layout;\n if (layout) return layout.state.sidebarCollapsed;\n return this.args.collapsed ?? this.localCollapsed;\n }\n\n setCollapsed(collapsed: boolean): void {\n const layout = this.args.layout;\n if (layout) {\n if (collapsed) layout.state.collapseSidebar();\n else layout.state.expandSidebar();\n return;\n }\n if (this.args.collapsed === undefined) this.localCollapsed = collapsed;\n this.args.onCollapsedChange?.(collapsed);\n }\n\n toggle = (): void => {\n this.setCollapsed(!this.collapseRequested);\n };\n\n collapse = (): void => {\n this.setCollapsed(true);\n };\n\n expand = (): void => {\n this.setCollapsed(false);\n };\n\n get collapsible(): 'icon' | 'offcanvas' | 'none' {\n return this.args.collapsible ?? 'icon';\n }\n\n /** Collapse applies unless the sidebar opted out of it. */\n get collapsed(): boolean {\n return this.collapsible !== 'none' && this.collapseRequested;\n }\n\n /** As drawn: the drawer is always expanded. */\n get isCollapsed(): boolean {\n return !this.inDrawer && this.collapsed;\n }\n\n get size(): 'default' | 'rail' {\n return this.args.size ?? 'default';\n }\n\n get id(): string {\n return this.args.layout?.sidebarId ?? `${guidFor(this)}-sidebar`;\n }\n\n get label(): string {\n return this.args.label ?? 'Main';\n }\n\n @cached\n get styles() {\n const layout = this.args.layout;\n return useStyles().appLayout({\n ...layoutVariants(layout?.config),\n variant: layout?.config.variant ?? this.args.variant ?? 'attached',\n color: this.args.color ?? layout?.config.color,\n // Inside a layout the sidebar inherits the root's color unless it has\n // its own; outside one there is no root to inherit from.\n partColor: this.args.color ?? (layout ? undefined : 'neutral'),\n sidebarSurface: this.args.surface ?? layout?.config.sidebarSurface,\n standalone: !layout,\n inDrawer: this.inDrawer,\n collapsible: this.collapsible,\n collapsed: this.collapsed,\n sidebarSize: this.size\n });\n }\n\n @cached\n get classNames(): string {\n const custom = [this.args.layout?.classes?.sidebar, this.args.class]\n .filter(Boolean)\n .join(' ');\n return this.styles.sidebar({ class: custom || undefined });\n }\n\n @cached\n get drawerCloseButtonClass(): string {\n return this.styles.drawerCloseButton({\n class: this.args.layout?.classes?.drawerCloseButton\n });\n }\n\n get mobileClassNames(): string {\n return this.styles.mobileSidebar({\n class: this.args.layout?.classes?.mobileSidebar\n });\n }\n\n @cached\n get slotClasses() {\n const custom = this.args.layout?.classes;\n return {\n header: this.styles.sidebarHeader({ class: custom?.sidebarHeader }),\n body: this.styles.sidebarBody({ class: custom?.sidebarBody }),\n footer: this.styles.sidebarFooter({ class: custom?.sidebarFooter }),\n group: {\n sidebarGroup: this.styles.sidebarGroup({ class: custom?.sidebarGroup }),\n sidebarGroupLabel: this.styles.sidebarGroupLabel({\n class: custom?.sidebarGroupLabel\n })\n }\n };\n }\n\n /**\n * Whether the block is drawn as the icon rail, where item labels become\n * tooltips. Never in the drawer, which is always expanded.\n */\n get rail(): boolean {\n return !this.inDrawer && this.collapsible === 'icon' && this.collapsed;\n }\n\n /** Rail tooltips open toward the content, away from the sidebar's edge. */\n get tooltipPlacement(): 'left' | 'right' {\n return this.placement === 'left' ? 'right' : 'left';\n }\n\n <template>\n {{#if this.hiddenForBottomNav}}\n {{! Nothing: the BottomNav is the navigation here. }}\n {{else if this.inDrawer}}\n <Drawer\n @isOpen={{this.drawerOpen}}\n @onClose={{this.closeDrawer}}\n @placement={{this.placement}}\n @size=\"xs\"\n @variant=\"flat\"\n @closeButtonSize=\"md\"\n @classes={{hash closeButton=this.drawerCloseButtonClass}}\n @focusTrapOptions={{this.focusTrapOptions}}\n id={{@layout.drawerId}}\n aria-label={{this.label}}\n >\n <nav\n id={{this.id}}\n aria-label={{this.label}}\n data-part=\"mobile-sidebar\"\n data-collapsible={{this.collapsible}}\n data-collapsed=\"false\"\n class={{this.mobileClassNames}}\n ...attributes\n >\n {{yield\n (hash\n Header=(component SidebarHeader class=this.slotClasses.header)\n Body=(component SidebarBody class=this.slotClasses.body)\n Footer=(component SidebarFooter class=this.slotClasses.footer)\n Item=(component\n NavItem\n rail=this.rail\n tooltipPlacement=this.tooltipPlacement\n onActivate=this.closeDrawer\n )\n Folder=(component\n NavFolder\n rail=this.rail\n tooltipPlacement=this.tooltipPlacement\n onActivate=this.closeDrawer\n )\n Group=(component SidebarGroup classes=this.slotClasses.group)\n Toggle=(component DrawerToggle)\n isCollapsed=false\n isInDrawer=true\n toggle=this.toggle\n collapse=this.collapse\n expand=this.expand\n )\n }}\n </nav>\n </Drawer>\n {{else}}\n <nav\n id={{this.id}}\n aria-label={{this.label}}\n data-part=\"sidebar\"\n data-collapsible={{this.collapsible}}\n data-collapsed={{if this.collapsed \"true\" \"false\"}}\n class={{this.classNames}}\n ...attributes\n >\n {{yield\n (hash\n Header=(component SidebarHeader class=this.slotClasses.header)\n Body=(component SidebarBody class=this.slotClasses.body)\n Footer=(component SidebarFooter class=this.slotClasses.footer)\n Item=(component\n NavItem rail=this.rail tooltipPlacement=this.tooltipPlacement\n )\n Folder=(component\n NavFolder rail=this.rail tooltipPlacement=this.tooltipPlacement\n )\n Group=(component SidebarGroup classes=this.slotClasses.group)\n Toggle=(component\n SidebarToggle\n layout=@layout\n collapsed=this.collapsed\n onToggle=this.toggle\n )\n isCollapsed=this.isCollapsed\n isInDrawer=false\n toggle=this.toggle\n collapse=this.collapse\n expand=this.expand\n )\n }}\n </nav>\n {{/if}}\n </template>\n}\n\n// In the drawer there is nothing to collapse, so `Toggle` renders nothing.\n// It takes `SidebarToggle`'s signature so the same invocation, arguments and\n// attributes included, compiles in both places; they are dropped.\nconst DrawerToggle: TOC<SidebarToggleSignature> = <template>\n {{! No toggle in the drawer. }}\n</template>;\n\nconst SidebarHeader: TOC<SidebarSectionSignature> = <template>\n <div data-part=\"sidebar-header\" class={{@class}} ...attributes>{{yield}}</div>\n</template>;\n\nconst SidebarBody: TOC<SidebarSectionSignature> = <template>\n <div data-part=\"sidebar-body\" class={{@class}} ...attributes>{{yield}}</div>\n</template>;\n\nconst SidebarFooter: TOC<SidebarSectionSignature> = <template>\n <div data-part=\"sidebar-footer\" class={{@class}} ...attributes>{{yield}}</div>\n</template>;\n\nexport { Sidebar, type SidebarSignature, type SidebarArgs };\nexport default Sidebar;\n"],"names":["Sidebar","Component","g","prototype","tracked","i","constructor","owner","args","localCollapsed","defaultCollapsed","unregister","layout","registerSidebar","registerDestructor","inDrawer","belowBreakpoint","hiddenForBottomNav","bottomNavMode","placement","atEnd","config","sidebarSide","rtl","isRtl","drawerOpen","state","mobileSidebarOpen","closeDrawer","closeMobileSidebar","focusTrapOptions","toggleId","menuToggleId","setReturnFocus","previous","document","body","isConnected","toggle","getElementById","getClientRects","length","collapseRequested","sidebarCollapsed","collapsed","setCollapsed","collapseSidebar","expandSidebar","undefined","onCollapsedChange","collapse","expand","collapsible","isCollapsed","size","id","sidebarId","guidFor","label","styles","useStyles","appLayout","layoutVariants","variant","color","partColor","sidebarSurface","surface","standalone","sidebarSize","n","cached","classNames","custom","classes","sidebar","class","filter","Boolean","join","drawerCloseButtonClass","drawerCloseButton","mobileClassNames","mobileSidebar","slotClasses","header","sidebarHeader","sidebarBody","footer","sidebarFooter","group","sidebarGroup","sidebarGroupLabel","rail","tooltipPlacement","setComponentTemplate","precompileTemplate","strictMode","scope","Drawer","hash","SidebarHeader","SidebarBody","SidebarFooter","NavItem","NavFolder","SidebarGroup","DrawerToggle","SidebarToggle","templateOnly"],"mappings":";;;;;;;;;;;;;;;;;AAwKA;;;;;;;;AAQA,MAAMA,gBAAgBC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,gBAAA,EAAA,CAC7BC,OAAA,CAAA,CAAA;AAAA;EAAA,eAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,gBAAA,CAAA,EAAA,MAAA;AAEDC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAiB,EAAE;AAC3C,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;AACb,IAAA,IAAI,CAACC,cAAc,GAAGD,IAAA,CAAKE,gBAAgB,IAAI,KAAA;IAC/C,MAAMC,UAAA,GAAaH,IAAA,CAAKI,MAAM,EAAEC,gBAAgB,IAAI,CAAA;AACpD,IAAA,IAAIF,UAAA,EAAY;AACdG,MAAAA,kBAAA,CAAmB,IAAI,EAAEH,UAAA,CAAA;AAC3B,IAAA;AACF,EAAA;AAEA;;;;EAIA,IAAII,QAAAA,GAAoB;IACtB,OAAO,IAAI,CAACP,IAAI,CAACI,MAAM,EAAEI,eAAA,IA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AEA;AACA;AACA;AACA,MAAMD,YAAkB,GAAAZ,oBAAA,CAA0BC,kBAAA,CAAA,qCAAA,EAElD;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAY,YAAA,EAAA,CAAA;AAEV,MAAMR,aAAmB,GAAAN,oBAAA,CAA2BC,kBAAA,CAAA,kFAAA,EAEpD;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAY,YAAA,EAAA,CAAA;AAEV,MAAMP,WAAiB,GAAAP,oBAAA,CAA2BC,kBAAA,CAAA,gFAAA,EAElD;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAY,YAAA,EAAA,CAAA;AAEV,MAAMN,aAAmB,GAAAR,oBAAA,CAA2BC,kBAAA,CAAA,kFAAA,EAEpD;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAY,YAAA,EAAA,CAAA;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ChevronRightIcon } from '../../../icons-
|
|
1
|
+
import { c as ChevronRightIcon } from '../../../icons-55dthVFk.js';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
import templateOnly from '@ember/component/template-only';
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export { Stepper } from './stepper/stepper.js';
|
|
2
|
+
export { StepperList } from './stepper/list.js';
|
|
3
|
+
export { StepperStep } from './stepper/step.js';
|
|
4
|
+
export { StepperPanel } from './stepper/panel.js';
|
|
1
5
|
export { Tabs, TabsList } from './tabs/tabs.js';
|
|
2
6
|
export { TabsTab } from './tabs/tab.js';
|
|
3
7
|
export { TabsPanel } from './tabs/panel.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -6,7 +6,7 @@ import { useStyles } from '@frontile/theme';
|
|
|
6
6
|
import press from '../../../modifiers/press.js';
|
|
7
7
|
import { VisuallyHidden } from '../../utilities/visually-hidden.js';
|
|
8
8
|
import { paginationRange } from './range.js';
|
|
9
|
-
import {
|
|
9
|
+
import { g as ChevronDoubleRightIcon, c as ChevronRightIcon, d as ChevronLeftIcon, h as ChevronDoubleLeftIcon } from '../../../icons-55dthVFk.js';
|
|
10
10
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
11
11
|
import { setComponentTemplate } from '@ember/component';
|
|
12
12
|
import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { tracked } from '@glimmer/tracking';
|
|
2
|
+
import { schedule } from '@ember/runloop';
|
|
3
|
+
import { modifier } from 'ember-modifier';
|
|
4
|
+
import { autoUpdate, computePosition, offset, flip, shift } from '@floating-ui/dom';
|
|
5
|
+
import { d as decorateFieldV2, i as initializeDeferredDecorator } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
|
|
6
|
+
|
|
7
|
+
class CollapseMenu {
|
|
8
|
+
static {
|
|
9
|
+
decorateFieldV2(this.prototype, "isOpen", [tracked], function () {
|
|
10
|
+
return false;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
#isOpen = (initializeDeferredDecorator(this, "isOpen"), void 0);
|
|
14
|
+
/** Mirrors the popover's state, for the trigger's `aria-expanded`. */
|
|
15
|
+
#trigger;
|
|
16
|
+
#list;
|
|
17
|
+
|
|
18
|
+
/** Closes the menu if it is open. */
|
|
19
|
+
close() {
|
|
20
|
+
const list = this.#list;
|
|
21
|
+
if (list?.matches(':popover-open')) {
|
|
22
|
+
list.hidePopover();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Install on the trigger button. */
|
|
27
|
+
registerTrigger = modifier(element => {
|
|
28
|
+
this.#trigger = element;
|
|
29
|
+
return () => {
|
|
30
|
+
if (this.#trigger === element) {
|
|
31
|
+
this.#trigger = undefined;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Install on the list, passing whether the menu is active. While it is, the
|
|
38
|
+
* list becomes a popover; otherwise this does nothing.
|
|
39
|
+
*/
|
|
40
|
+
list = modifier((list, [active]) => {
|
|
41
|
+
if (!active || typeof list.showPopover !== 'function') {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.#list = list;
|
|
45
|
+
list.setAttribute('popover', 'auto');
|
|
46
|
+
let stopPositioning;
|
|
47
|
+
// `computePosition` resolves later; it must not write to a list that has
|
|
48
|
+
// since been torn down.
|
|
49
|
+
let isLive = true;
|
|
50
|
+
const place = () => {
|
|
51
|
+
const trigger = this.#trigger;
|
|
52
|
+
if (!trigger) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
void computePosition(trigger, list, {
|
|
56
|
+
strategy: 'fixed',
|
|
57
|
+
placement: 'bottom-start',
|
|
58
|
+
middleware: [offset(8), flip(), shift({
|
|
59
|
+
padding: 8
|
|
60
|
+
})]
|
|
61
|
+
}).then(({
|
|
62
|
+
x,
|
|
63
|
+
y
|
|
64
|
+
}) => {
|
|
65
|
+
if (!isLive) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
list.style.left = `${x}px`;
|
|
69
|
+
list.style.top = `${y}px`;
|
|
70
|
+
list.style.minWidth = `${trigger.offsetWidth}px`;
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const focusCurrent = () => {
|
|
74
|
+
const target = list.querySelector('[aria-current="step"]') ?? list.querySelector('[data-part="step"]:not([aria-disabled="true"])');
|
|
75
|
+
target?.focus();
|
|
76
|
+
};
|
|
77
|
+
const onBeforeToggle = event => {
|
|
78
|
+
const {
|
|
79
|
+
newState
|
|
80
|
+
} = event;
|
|
81
|
+
// Focus inside the panel is about to vanish with it; hand it back to the
|
|
82
|
+
// trigger, as a menu button does.
|
|
83
|
+
if (newState === 'closed' && list.contains(document.activeElement)) {
|
|
84
|
+
const trigger = this.#trigger;
|
|
85
|
+
queueMicrotask(() => trigger?.focus());
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const onToggle = event => {
|
|
89
|
+
const {
|
|
90
|
+
newState
|
|
91
|
+
} = event;
|
|
92
|
+
this.isOpen = newState === 'open';
|
|
93
|
+
stopPositioning?.();
|
|
94
|
+
stopPositioning = undefined;
|
|
95
|
+
if (newState === 'open' && this.#trigger) {
|
|
96
|
+
place();
|
|
97
|
+
stopPositioning = autoUpdate(this.#trigger, list, place);
|
|
98
|
+
focusCurrent();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
list.addEventListener('beforetoggle', onBeforeToggle);
|
|
102
|
+
list.addEventListener('toggle', onToggle);
|
|
103
|
+
return () => {
|
|
104
|
+
isLive = false;
|
|
105
|
+
stopPositioning?.();
|
|
106
|
+
list.removeEventListener('beforetoggle', onBeforeToggle);
|
|
107
|
+
list.removeEventListener('toggle', onToggle);
|
|
108
|
+
if (list.matches(':popover-open')) {
|
|
109
|
+
list.hidePopover();
|
|
110
|
+
}
|
|
111
|
+
list.removeAttribute('popover');
|
|
112
|
+
list.style.removeProperty('left');
|
|
113
|
+
list.style.removeProperty('top');
|
|
114
|
+
list.style.removeProperty('min-width');
|
|
115
|
+
if (this.#list === list) {
|
|
116
|
+
this.#list = undefined;
|
|
117
|
+
}
|
|
118
|
+
// Torn down inside the render transaction that read `isOpen`, so the
|
|
119
|
+
// write waits for `afterRender`.
|
|
120
|
+
schedule('afterRender', () => {
|
|
121
|
+
this.isOpen = false;
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { CollapseMenu };
|
|
128
|
+
//# sourceMappingURL=collapse-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapse-menu.js","sources":["../../../../src/components/navigation/stepper/collapse-menu.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { schedule } from '@ember/runloop';\nimport { modifier } from 'ember-modifier';\nimport {\n autoUpdate,\n computePosition,\n flip,\n offset,\n shift\n} from '@floating-ui/dom';\n\n/**\n * The floating menu a collapsed Stepper turns its list into: a native\n * `popover` (top layer, so no ancestor's `overflow` can clip it; Escape and\n * click-away come with it), positioned under a trigger button.\n *\n * Positioning uses `@floating-ui/dom` directly rather than the `Velcro`\n * modifier `Popover` uses: this list is already a native top-layer popover\n * whose open state comes from the browser's `toggle` event, and the position\n * only needs computing while it is open.\n *\n * It owns the two elements and the open state, and nothing about steps. The\n * list stays mounted whether or not the menu is active, which is why the steps\n * stay registered while it is closed.\n */\nclass CollapseMenu {\n /** Mirrors the popover's state, for the trigger's `aria-expanded`. */\n @tracked isOpen = false;\n\n #trigger: HTMLElement | undefined;\n #list: HTMLElement | undefined;\n\n /** Closes the menu if it is open. */\n close(): void {\n const list = this.#list;\n if (list?.matches(':popover-open')) {\n list.hidePopover();\n }\n }\n\n /** Install on the trigger button. */\n registerTrigger = modifier((element: HTMLElement) => {\n this.#trigger = element;\n\n return (): void => {\n if (this.#trigger === element) {\n this.#trigger = undefined;\n }\n };\n });\n\n /**\n * Install on the list, passing whether the menu is active. While it is, the\n * list becomes a popover; otherwise this does nothing.\n */\n list = modifier((list: HTMLElement, [active]: [boolean]) => {\n if (!active || typeof list.showPopover !== 'function') {\n return;\n }\n\n this.#list = list;\n list.setAttribute('popover', 'auto');\n\n let stopPositioning: (() => void) | undefined;\n // `computePosition` resolves later; it must not write to a list that has\n // since been torn down.\n let isLive = true;\n\n const place = (): void => {\n const trigger = this.#trigger;\n if (!trigger) {\n return;\n }\n void computePosition(trigger, list, {\n strategy: 'fixed',\n placement: 'bottom-start',\n middleware: [offset(8), flip(), shift({ padding: 8 })]\n }).then(({ x, y }) => {\n if (!isLive) {\n return;\n }\n list.style.left = `${x}px`;\n list.style.top = `${y}px`;\n list.style.minWidth = `${trigger.offsetWidth}px`;\n });\n };\n\n const focusCurrent = (): void => {\n const target =\n list.querySelector<HTMLElement>('[aria-current=\"step\"]') ??\n list.querySelector<HTMLElement>(\n '[data-part=\"step\"]:not([aria-disabled=\"true\"])'\n );\n target?.focus();\n };\n\n const onBeforeToggle = (event: Event): void => {\n const { newState } = event as Event & { newState?: string };\n // Focus inside the panel is about to vanish with it; hand it back to the\n // trigger, as a menu button does.\n if (newState === 'closed' && list.contains(document.activeElement)) {\n const trigger = this.#trigger;\n queueMicrotask(() => trigger?.focus());\n }\n };\n\n const onToggle = (event: Event): void => {\n const { newState } = event as Event & { newState?: string };\n this.isOpen = newState === 'open';\n\n stopPositioning?.();\n stopPositioning = undefined;\n\n if (newState === 'open' && this.#trigger) {\n place();\n stopPositioning = autoUpdate(this.#trigger, list, place);\n focusCurrent();\n }\n };\n\n list.addEventListener('beforetoggle', onBeforeToggle);\n list.addEventListener('toggle', onToggle);\n\n return (): void => {\n isLive = false;\n stopPositioning?.();\n list.removeEventListener('beforetoggle', onBeforeToggle);\n list.removeEventListener('toggle', onToggle);\n if (list.matches(':popover-open')) {\n list.hidePopover();\n }\n list.removeAttribute('popover');\n list.style.removeProperty('left');\n list.style.removeProperty('top');\n list.style.removeProperty('min-width');\n if (this.#list === list) {\n this.#list = undefined;\n }\n // Torn down inside the render transaction that read `isOpen`, so the\n // write waits for `afterRender`.\n schedule('afterRender', () => {\n this.isOpen = false;\n });\n };\n });\n}\n\nexport { CollapseMenu };\n"],"names":["CollapseMenu","g","prototype","tracked","i","close","list","matches","hidePopover","registerTrigger","modifier","element","undefined","active","showPopover","setAttribute","stopPositioning","isLive","place","trigger","computePosition","strategy","placement","middleware","offset","flip","shift","padding","then","x","y","style","left","top","minWidth","offsetWidth","focusCurrent","target","querySelector","focus","onBeforeToggle","event","newState","contains","document","activeElement","queueMicrotask","onToggle","isOpen","autoUpdate","addEventList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C/C,MAAAA,IAAI,CAACyB,KAAK,CAACsB,cAAc,CAAC,WAAW,CAAC;AACtC,MAAA,IAAI,IAAI,CAAC,KAAK,KAAK/C,IAAI,EAAE;AACvB,QAAA,IAAI,CAAC,KAAK,GAAGM,SAAS;AACxB,MAAA;AACA;AACA;MACA0C,QAAQ,CAAC,aAAa,EAAE,MAAM;QAC5B,IAAI,CAACN,MAAM,GAAG,KAAK;AACrB,MAAA,CAAC,CAAC;IACJ,CAAC;AACH,EAAA,CAAC,CAAC;AACJ;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
|
+
import { setComponentTemplate } from '@ember/component';
|
|
4
|
+
|
|
5
|
+
// A class rather than a template-only component, so that
|
|
6
|
+
// `WithBoundArgs<typeof StepperList<T>, 'context'>` can be parameterized, as
|
|
7
|
+
// `TabsList` is.
|
|
8
|
+
class StepperList extends Component {
|
|
9
|
+
static {
|
|
10
|
+
setComponentTemplate(precompileTemplate("{{#if @context.collapsed}}\n {{!-- The current step, as a button. The native popover on the list does\n the toggling, Escape and click-away; this only has to point at it. --}}\n <button type=\"button\" data-part=\"trigger\" class={{@context.triggerClass}} popovertarget={{@context.listId}} popovertargetaction=\"toggle\" aria-controls={{@context.listId}} aria-expanded=\"{{@context.isMenuOpen}}\" {{@context.registerTrigger}}>\n <span class={{@context.triggerLabelClass}}>\n <span class={{@context.summaryTextClass}}>{{if @context.summary @context.summary.label @label}}</span>\n {{#if @context.summary.title}}\n <span class={{@context.summaryTitleClass}}>\n {{@context.summary.title}}\n </span>\n {{/if}}\n </span>\n <svg viewBox=\"0 0 16 16\" class={{@context.chevronClass}} fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 6l4 4 4-4\" /></svg>\n </button>\n{{/if}}\n<ol id={{@context.listId}} data-part=\"list\" aria-label={{@label}} class={{@context.listClass}} {{@context.menuList @context.collapsed}} ...attributes>\n {{yield}}\n</ol>\n{{#if @context.showSummaryLine}}\n {{!-- Decorative: the active step is already announced through\n aria-current, so this must not be read a second time. --}}\n <p data-part=\"summary\" aria-hidden=\"true\" class={{@context.summaryClass}}>\n <span class={{@context.summaryTextClass}}>{{@context.summary.label}}</span>\n {{#if @context.summary.title}}\n <span class={{@context.summaryTitleClass}}>\n {{@context.summary.title}}\n </span>\n {{/if}}\n </p>\n{{/if}}", {
|
|
11
|
+
strictMode: true
|
|
12
|
+
}), this);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { StepperList, StepperList as default };
|
|
17
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sources":["../../../../src/components/navigation/stepper/list.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport type { StepperContext } from './stepper';\n\ninterface StepperListArgs<T> {\n /** Accessible name for the list of steps. */\n label?: string;\n\n /**\n * Supplied by Stepper. Not part of the public API.\n *\n * @internal\n */\n context: StepperContext<T>;\n}\n\ninterface StepperListSignature<T> {\n Args: StepperListArgs<T>;\n Blocks: { default: [] };\n Element: HTMLOListElement;\n}\n\n// A class rather than a template-only component, so that\n// `WithBoundArgs<typeof StepperList<T>, 'context'>` can be parameterized, as\n// `TabsList` is.\nclass StepperList<T> extends Component<StepperListSignature<T>> {\n <template>\n {{#if @context.collapsed}}\n {{! The current step, as a button. The native popover on the list does\n the toggling, Escape and click-away; this only has to point at it. }}\n <button\n type=\"button\"\n data-part=\"trigger\"\n class={{@context.triggerClass}}\n popovertarget={{@context.listId}}\n popovertargetaction=\"toggle\"\n aria-controls={{@context.listId}}\n aria-expanded=\"{{@context.isMenuOpen}}\"\n {{@context.registerTrigger}}\n >\n <span class={{@context.triggerLabelClass}}>\n <span class={{@context.summaryTextClass}}>{{if\n @context.summary\n @context.summary.label\n @label\n }}</span>\n {{#if @context.summary.title}}\n <span class={{@context.summaryTitleClass}}>\n {{@context.summary.title}}\n </span>\n {{/if}}\n </span>\n <svg\n viewBox=\"0 0 16 16\"\n class={{@context.chevronClass}}\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n ><path d=\"M4 6l4 4 4-4\" /></svg>\n </button>\n {{/if}}\n <ol\n id={{@context.listId}}\n data-part=\"list\"\n aria-label={{@label}}\n class={{@context.listClass}}\n {{@context.menuList @context.collapsed}}\n ...attributes\n >\n {{yield}}\n </ol>\n {{#if @context.showSummaryLine}}\n {{! Decorative: the active step is already announced through\n aria-current, so this must not be read a second time. }}\n <p data-part=\"summary\" aria-hidden=\"true\" class={{@context.summaryClass}}>\n <span\n class={{@context.summaryTextClass}}\n >{{@context.summary.label}}</span>\n {{#if @context.summary.title}}\n <span class={{@context.summaryTitleClass}}>\n {{@context.summary.title}}\n </span>\n {{/if}}\n </p>\n {{/if}}\n </template>\n}\n\nexport { StepperList, type StepperListSignature, type StepperListArgs };\nexport default StepperList;\n"],"names":["StepperList","Component","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;AAqBA;AACA;AACA;AACA,MAAMA,WAAA,SAAuBC,SAAA,CAA+B;AAC1D,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,gpDAAA,EA8DA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
|
+
import { setComponentTemplate } from '@ember/component';
|
|
4
|
+
|
|
5
|
+
class StepperPanel extends Component {
|
|
6
|
+
get isSelected() {
|
|
7
|
+
return this.args.context.isSelected(this.args.value);
|
|
8
|
+
}
|
|
9
|
+
get shouldRender() {
|
|
10
|
+
return this.isSelected || (this.args.keepMounted ?? false);
|
|
11
|
+
}
|
|
12
|
+
get id() {
|
|
13
|
+
return this.args.context.panelIdFor(this.args.value);
|
|
14
|
+
}
|
|
15
|
+
get stepId() {
|
|
16
|
+
return this.args.context.stepIdFor(this.args.value);
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
setComponentTemplate(precompileTemplate("{{#if this.shouldRender}}\n <div role=\"region\" data-part=\"panel\" id={{this.id}} aria-labelledby={{this.stepId}} hidden={{if this.isSelected false true}} class=\"{{@context.panelClass}} {{@class}}\" ...attributes>\n {{yield}}\n </div>\n{{/if}}", {
|
|
20
|
+
strictMode: true
|
|
21
|
+
}), this);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { StepperPanel, StepperPanel as default };
|
|
26
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.js","sources":["../../../../src/components/navigation/stepper/panel.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport type { StepperContext } from './stepper';\n\ninterface StepperPanelArgs<T> {\n /** The value this panel is paired with; must match a `Step`'s `@value`. */\n value: T;\n\n /**\n * Keeps the panel's content in the DOM, hidden, while its step is not the\n * selected one. Use it to preserve a form's local state across steps.\n * Without it only the selected step's panel renders.\n *\n * A kept-mounted panel keeps running its own effects while hidden, and\n * anything in it with an autofocus fires on mount whether or not the step\n * is selected.\n *\n * @defaultValue false\n */\n keepMounted?: boolean;\n\n /** Class names appended to this panel's theme classes. */\n class?: string;\n\n /**\n * Supplied by Stepper. Not part of the public API.\n *\n * @internal\n */\n context: StepperContext<T>;\n}\n\ninterface StepperPanelSignature<T> {\n Args: StepperPanelArgs<T>;\n Blocks: { default: [] };\n Element: HTMLDivElement;\n}\n\nclass StepperPanel<T> extends Component<StepperPanelSignature<T>> {\n get isSelected(): boolean {\n return this.args.context.isSelected(this.args.value);\n }\n\n get shouldRender(): boolean {\n return this.isSelected || (this.args.keepMounted ?? false);\n }\n\n get id(): string {\n return this.args.context.panelIdFor(this.args.value);\n }\n\n get stepId(): string | undefined {\n return this.args.context.stepIdFor(this.args.value);\n }\n\n <template>\n {{#if this.shouldRender}}\n <div\n role=\"region\"\n data-part=\"panel\"\n id={{this.id}}\n aria-labelledby={{this.stepId}}\n hidden={{if this.isSelected false true}}\n class=\"{{@context.panelClass}} {{@class}}\"\n ...attributes\n >\n {{yield}}\n </div>\n {{/if}}\n </template>\n}\n\nexport { StepperPanel, type StepperPanelSignature, type StepperPanelArgs };\nexport default StepperPanel;\n"],"names":["StepperPanel","Component","isSelected","args","context","value","shouldRender","keepMounted","id","panelIdFor","stepId","stepIdFor","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;AAqCA,MAAMA,YAAA,SAAwBC,SAAA,CAAgC;EAC5D,IAAIC,UAAAA,GAAsB;AACxB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,OAAO,CAACF,UAAU,CAAC,IAAI,CAACC,IAAI,CAACE,KAAK,CAAA;AACrD,EAAA;EAEA,IAAIC,YAAAA,GAAwB;IAC1B,OAAO,IAAI,CAACJ,UAAU,KAAK,IAAI,CAACC,IAAI,CAACI,WAAW,IAAI,KAAK,CAAA;AAC3D,EAAA;EAEA,IAAIC,EAAAA,GAAa;AACf,IAAA,OAAO,IAAI,CAACL,IAAI,CAACC,OAAO,CAACK,UAAU,CAAC,IAAI,CAACN,IAAI,CAACE,KAAK,CAAA;AACrD,EAAA;EAEA,IAAIK,MAAAA,GAA6B;AAC/B,IAAA,OAAO,IAAI,CAACP,IAAI,CAACC,OAAO,CAACO,SAAS,CAAC,IAAI,CAACR,IAAI,CAACE,KAAK,CAAA;AACpD,EAAA;AAEA,EAAA;IAAAO,oBAAA,CAAAC,kBAAA,CAAA,6PAAA,EAcA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|