@unofficialbox/box-open-elements 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +125 -0
- package/dist/components/actions/button-group.d.ts +22 -0
- package/dist/components/actions/button-group.js +255 -0
- package/dist/components/actions/button.d.ts +16 -0
- package/dist/components/actions/button.js +190 -0
- package/dist/components/actions/icon-button.d.ts +20 -0
- package/dist/components/actions/icon-button.js +187 -0
- package/dist/components/actions/link-button.d.ts +14 -0
- package/dist/components/actions/link-button.js +137 -0
- package/dist/components/actions/menu-item.d.ts +17 -0
- package/dist/components/actions/menu-item.js +137 -0
- package/dist/components/actions/menu.d.ts +22 -0
- package/dist/components/actions/menu.js +178 -0
- package/dist/components/actions/segmented-control.d.ts +27 -0
- package/dist/components/actions/segmented-control.js +273 -0
- package/dist/components/collections/card.d.ts +13 -0
- package/dist/components/collections/card.js +110 -0
- package/dist/components/collections/carousel.d.ts +40 -0
- package/dist/components/collections/carousel.js +406 -0
- package/dist/components/collections/datalist-item.d.ts +32 -0
- package/dist/components/collections/datalist-item.js +196 -0
- package/dist/components/collections/draggable-list.d.ts +33 -0
- package/dist/components/collections/draggable-list.js +306 -0
- package/dist/components/collections/grid-view.d.ts +38 -0
- package/dist/components/collections/grid-view.js +321 -0
- package/dist/components/collections/pagination.d.ts +19 -0
- package/dist/components/collections/pagination.js +147 -0
- package/dist/components/collections/tree-grid.d.ts +47 -0
- package/dist/components/collections/tree-grid.js +593 -0
- package/dist/components/collections/tree.d.ts +37 -0
- package/dist/components/collections/tree.js +526 -0
- package/dist/components/feedback/alert.d.ts +27 -0
- package/dist/components/feedback/alert.js +263 -0
- package/dist/components/feedback/badge.d.ts +12 -0
- package/dist/components/feedback/badge.js +99 -0
- package/dist/components/feedback/chip.d.ts +33 -0
- package/dist/components/feedback/chip.js +261 -0
- package/dist/components/feedback/empty-state.d.ts +19 -0
- package/dist/components/feedback/empty-state.js +137 -0
- package/dist/components/feedback/error-mask.d.ts +25 -0
- package/dist/components/feedback/error-mask.js +199 -0
- package/dist/components/feedback/help-text.d.ts +22 -0
- package/dist/components/feedback/help-text.js +176 -0
- package/dist/components/feedback/nudge.d.ts +32 -0
- package/dist/components/feedback/nudge.js +299 -0
- package/dist/components/feedback/progress-bar.d.ts +18 -0
- package/dist/components/feedback/progress-bar.js +128 -0
- package/dist/components/feedback/progress-ring.d.ts +21 -0
- package/dist/components/feedback/progress-ring.js +155 -0
- package/dist/components/feedback/progress-steps.d.ts +25 -0
- package/dist/components/feedback/progress-steps.js +276 -0
- package/dist/components/feedback/skeleton.d.ts +14 -0
- package/dist/components/feedback/skeleton.js +95 -0
- package/dist/components/feedback/spinner.d.ts +10 -0
- package/dist/components/feedback/spinner.js +80 -0
- package/dist/components/feedback/toast.d.ts +26 -0
- package/dist/components/feedback/toast.js +205 -0
- package/dist/components/files/drop-zone.d.ts +19 -0
- package/dist/components/files/drop-zone.js +169 -0
- package/dist/components/forms/calendar.d.ts +47 -0
- package/dist/components/forms/calendar.js +499 -0
- package/dist/components/forms/category-selector.d.ts +35 -0
- package/dist/components/forms/category-selector.js +269 -0
- package/dist/components/forms/checkbox-group.d.ts +31 -0
- package/dist/components/forms/checkbox-group.js +267 -0
- package/dist/components/forms/checkbox.d.ts +28 -0
- package/dist/components/forms/checkbox.js +250 -0
- package/dist/components/forms/color-picker.d.ts +34 -0
- package/dist/components/forms/color-picker.js +314 -0
- package/dist/components/forms/combobox.d.ts +37 -0
- package/dist/components/forms/combobox.js +234 -0
- package/dist/components/forms/date-field.d.ts +27 -0
- package/dist/components/forms/date-field.js +187 -0
- package/dist/components/forms/dropdown.d.ts +38 -0
- package/dist/components/forms/dropdown.js +405 -0
- package/dist/components/forms/dual-listbox.d.ts +44 -0
- package/dist/components/forms/dual-listbox.js +484 -0
- package/dist/components/forms/fieldset.d.ts +32 -0
- package/dist/components/forms/fieldset.js +168 -0
- package/dist/components/forms/multi-select.d.ts +30 -0
- package/dist/components/forms/multi-select.js +264 -0
- package/dist/components/forms/number-input.d.ts +32 -0
- package/dist/components/forms/number-input.js +245 -0
- package/dist/components/forms/pill-cloud.d.ts +35 -0
- package/dist/components/forms/pill-cloud.js +230 -0
- package/dist/components/forms/pill-selector-dropdown.d.ts +55 -0
- package/dist/components/forms/pill-selector-dropdown.js +499 -0
- package/dist/components/forms/radio-group.d.ts +32 -0
- package/dist/components/forms/radio-group.js +285 -0
- package/dist/components/forms/range-slider.d.ts +36 -0
- package/dist/components/forms/range-slider.js +294 -0
- package/dist/components/forms/rating.d.ts +31 -0
- package/dist/components/forms/rating.js +302 -0
- package/dist/components/forms/rich-text-input.d.ts +32 -0
- package/dist/components/forms/rich-text-input.js +403 -0
- package/dist/components/forms/search-field.d.ts +27 -0
- package/dist/components/forms/search-field.js +293 -0
- package/dist/components/forms/select.d.ts +30 -0
- package/dist/components/forms/select.js +198 -0
- package/dist/components/forms/slider.d.ts +31 -0
- package/dist/components/forms/slider.js +221 -0
- package/dist/components/forms/spin-button.d.ts +33 -0
- package/dist/components/forms/spin-button.js +352 -0
- package/dist/components/forms/switch.d.ts +32 -0
- package/dist/components/forms/switch.js +302 -0
- package/dist/components/forms/tag-input.d.ts +46 -0
- package/dist/components/forms/tag-input.js +420 -0
- package/dist/components/forms/text-area.d.ts +26 -0
- package/dist/components/forms/text-area.js +188 -0
- package/dist/components/forms/text-field.d.ts +24 -0
- package/dist/components/forms/text-field.js +151 -0
- package/dist/components/forms/time-field.d.ts +29 -0
- package/dist/components/forms/time-field.js +203 -0
- package/dist/components/identity/avatar.d.ts +21 -0
- package/dist/components/identity/avatar.js +191 -0
- package/dist/components/identity/contact-datalist-item.d.ts +31 -0
- package/dist/components/identity/contact-datalist-item.js +235 -0
- package/dist/components/identity/persona.d.ts +28 -0
- package/dist/components/identity/persona.js +272 -0
- package/dist/components/layout/app-shell.d.ts +26 -0
- package/dist/components/layout/app-shell.js +258 -0
- package/dist/components/layout/divider.d.ts +12 -0
- package/dist/components/layout/divider.js +119 -0
- package/dist/components/layout/nav-sidebar.d.ts +23 -0
- package/dist/components/layout/nav-sidebar.js +167 -0
- package/dist/components/layout/section.d.ts +20 -0
- package/dist/components/layout/section.js +143 -0
- package/dist/components/layout/sidebar-toggle-button.d.ts +26 -0
- package/dist/components/layout/sidebar-toggle-button.js +137 -0
- package/dist/components/layout/split-view.d.ts +19 -0
- package/dist/components/layout/split-view.js +157 -0
- package/dist/components/navigation/accordion.d.ts +25 -0
- package/dist/components/navigation/accordion.js +253 -0
- package/dist/components/navigation/tabs.d.ts +27 -0
- package/dist/components/navigation/tabs.js +289 -0
- package/dist/components/overlays/dialog.d.ts +26 -0
- package/dist/components/overlays/dialog.js +267 -0
- package/dist/components/overlays/drawer.d.ts +32 -0
- package/dist/components/overlays/drawer.js +323 -0
- package/dist/components/overlays/popover.d.ts +35 -0
- package/dist/components/overlays/popover.js +317 -0
- package/dist/components/overlays/tooltip.d.ts +26 -0
- package/dist/components/overlays/tooltip.js +204 -0
- package/dist/components/visuals/illustration.d.ts +26 -0
- package/dist/components/visuals/illustration.js +319 -0
- package/dist/core/controller.d.ts +11 -0
- package/dist/core/controller.js +23 -0
- package/dist/core/element.d.ts +22 -0
- package/dist/core/element.js +28 -0
- package/dist/core/event-emitter.d.ts +9 -0
- package/dist/core/event-emitter.js +33 -0
- package/dist/core/form-associated.d.ts +63 -0
- package/dist/core/form-associated.js +218 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +4 -0
- package/dist/core/json-schema.d.ts +1 -0
- package/dist/core/json-schema.js +1 -0
- package/dist/foundations/a11y/focus.d.ts +17 -0
- package/dist/foundations/a11y/focus.js +94 -0
- package/dist/foundations/a11y/heading.d.ts +26 -0
- package/dist/foundations/a11y/heading.js +40 -0
- package/dist/foundations/a11y/index.d.ts +5 -0
- package/dist/foundations/a11y/index.js +3 -0
- package/dist/foundations/a11y/keyboard.d.ts +28 -0
- package/dist/foundations/a11y/keyboard.js +77 -0
- package/dist/foundations/geometry/index.d.ts +1 -0
- package/dist/foundations/geometry/index.js +1 -0
- package/dist/foundations/geometry/tokens.d.ts +123 -0
- package/dist/foundations/geometry/tokens.js +154 -0
- package/dist/foundations/icons/box-iconography.d.ts +479 -0
- package/dist/foundations/icons/box-iconography.generated.d.ts +2370 -0
- package/dist/foundations/icons/box-iconography.generated.js +4010 -0
- package/dist/foundations/icons/box-iconography.js +39 -0
- package/dist/foundations/icons/index.d.ts +1 -0
- package/dist/foundations/icons/index.js +1 -0
- package/dist/foundations/motion/index.d.ts +2 -0
- package/dist/foundations/motion/index.js +1 -0
- package/dist/foundations/motion/tokens.d.ts +39 -0
- package/dist/foundations/motion/tokens.js +43 -0
- package/dist/foundations/tokens/box-dark.d.ts +11 -0
- package/dist/foundations/tokens/box-dark.js +46 -0
- package/dist/foundations/tokens/box-defaults.d.ts +5 -0
- package/dist/foundations/tokens/box-defaults.js +52 -0
- package/dist/foundations/tokens/index.d.ts +5 -0
- package/dist/foundations/tokens/index.js +4 -0
- package/dist/foundations/tokens/interaction.d.ts +28 -0
- package/dist/foundations/tokens/interaction.js +72 -0
- package/dist/foundations/tokens/registry.d.ts +14 -0
- package/dist/foundations/tokens/registry.js +92 -0
- package/dist/foundations/tokens/types.d.ts +16 -0
- package/dist/foundations/tokens/types.js +1 -0
- package/dist/foundations/typography/index.d.ts +2 -0
- package/dist/foundations/typography/index.js +1 -0
- package/dist/foundations/typography/tokens.d.ts +76 -0
- package/dist/foundations/typography/tokens.js +27 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +98 -0
- package/dist/patterns/content-explorer/actions/controller.d.ts +12 -0
- package/dist/patterns/content-explorer/actions/controller.js +36 -0
- package/dist/patterns/content-explorer/actions/index.d.ts +2 -0
- package/dist/patterns/content-explorer/actions/index.js +1 -0
- package/dist/patterns/content-explorer/actions/types.d.ts +13 -0
- package/dist/patterns/content-explorer/actions/types.js +1 -0
- package/dist/patterns/content-explorer/adapters/action-menu.d.ts +24 -0
- package/dist/patterns/content-explorer/adapters/action-menu.js +312 -0
- package/dist/patterns/content-explorer/adapters/breadcrumbs.d.ts +15 -0
- package/dist/patterns/content-explorer/adapters/breadcrumbs.js +161 -0
- package/dist/patterns/content-explorer/adapters/item-summary.d.ts +11 -0
- package/dist/patterns/content-explorer/adapters/item-summary.js +72 -0
- package/dist/patterns/content-explorer/adapters/items.d.ts +4 -0
- package/dist/patterns/content-explorer/adapters/items.js +12 -0
- package/dist/patterns/content-explorer/adapters/list.d.ts +28 -0
- package/dist/patterns/content-explorer/adapters/list.js +527 -0
- package/dist/patterns/content-explorer/adapters/table.d.ts +23 -0
- package/dist/patterns/content-explorer/adapters/table.js +467 -0
- package/dist/patterns/content-explorer/adapters/toolbar.d.ts +19 -0
- package/dist/patterns/content-explorer/adapters/toolbar.js +234 -0
- package/dist/patterns/content-explorer/box-transport.d.ts +44 -0
- package/dist/patterns/content-explorer/box-transport.js +229 -0
- package/dist/patterns/content-explorer/collection/controller.d.ts +17 -0
- package/dist/patterns/content-explorer/collection/controller.js +67 -0
- package/dist/patterns/content-explorer/collection/index.d.ts +2 -0
- package/dist/patterns/content-explorer/collection/index.js +1 -0
- package/dist/patterns/content-explorer/collection/types.d.ts +20 -0
- package/dist/patterns/content-explorer/collection/types.js +1 -0
- package/dist/patterns/content-explorer/content-explorer.d.ts +85 -0
- package/dist/patterns/content-explorer/content-explorer.js +745 -0
- package/dist/patterns/content-explorer/contracts.d.ts +32 -0
- package/dist/patterns/content-explorer/contracts.js +114 -0
- package/dist/patterns/content-explorer/controller.d.ts +34 -0
- package/dist/patterns/content-explorer/controller.js +399 -0
- package/dist/patterns/content-explorer/host-bindings.d.ts +50 -0
- package/dist/patterns/content-explorer/host-bindings.js +76 -0
- package/dist/patterns/content-explorer/index.d.ts +18 -0
- package/dist/patterns/content-explorer/index.js +24 -0
- package/dist/patterns/content-explorer/navigation/controller.d.ts +10 -0
- package/dist/patterns/content-explorer/navigation/controller.js +48 -0
- package/dist/patterns/content-explorer/navigation/index.d.ts +2 -0
- package/dist/patterns/content-explorer/navigation/index.js +1 -0
- package/dist/patterns/content-explorer/navigation/types.d.ts +20 -0
- package/dist/patterns/content-explorer/navigation/types.js +1 -0
- package/dist/patterns/content-explorer/schemas.d.ts +6 -0
- package/dist/patterns/content-explorer/schemas.js +120 -0
- package/dist/patterns/content-explorer/selection/controller.d.ts +12 -0
- package/dist/patterns/content-explorer/selection/controller.js +54 -0
- package/dist/patterns/content-explorer/selection/index.d.ts +2 -0
- package/dist/patterns/content-explorer/selection/index.js +1 -0
- package/dist/patterns/content-explorer/selection/types.d.ts +14 -0
- package/dist/patterns/content-explorer/selection/types.js +1 -0
- package/dist/patterns/content-explorer/types.d.ts +209 -0
- package/dist/patterns/content-explorer/types.js +10 -0
- package/dist/patterns/file-request/file-request-builder.d.ts +36 -0
- package/dist/patterns/file-request/file-request-builder.js +344 -0
- package/dist/patterns/file-request/index.d.ts +1 -0
- package/dist/patterns/file-request/index.js +1 -0
- package/dist/patterns/governance/governance-panel.d.ts +40 -0
- package/dist/patterns/governance/governance-panel.js +351 -0
- package/dist/patterns/governance/index.d.ts +1 -0
- package/dist/patterns/governance/index.js +1 -0
- package/dist/patterns/insights/bar-chart.d.ts +43 -0
- package/dist/patterns/insights/bar-chart.js +462 -0
- package/dist/patterns/insights/chart-panel.d.ts +43 -0
- package/dist/patterns/insights/chart-panel.js +436 -0
- package/dist/patterns/insights/donut-chart.d.ts +43 -0
- package/dist/patterns/insights/donut-chart.js +535 -0
- package/dist/patterns/insights/index.d.ts +5 -0
- package/dist/patterns/insights/index.js +5 -0
- package/dist/patterns/insights/line-chart.d.ts +46 -0
- package/dist/patterns/insights/line-chart.js +511 -0
- package/dist/patterns/insights/metric-card.d.ts +36 -0
- package/dist/patterns/insights/metric-card.js +278 -0
- package/dist/patterns/item/bulk-action-bar.d.ts +35 -0
- package/dist/patterns/item/bulk-action-bar.js +325 -0
- package/dist/patterns/item/index.d.ts +4 -0
- package/dist/patterns/item/index.js +4 -0
- package/dist/patterns/item/item-details-panel.d.ts +61 -0
- package/dist/patterns/item/item-details-panel.js +429 -0
- package/dist/patterns/item/item-form.d.ts +54 -0
- package/dist/patterns/item/item-form.js +485 -0
- package/dist/patterns/item/preview-header.d.ts +46 -0
- package/dist/patterns/item/preview-header.js +323 -0
- package/dist/patterns/metadata/contracts.d.ts +75 -0
- package/dist/patterns/metadata/contracts.js +91 -0
- package/dist/patterns/metadata/index.d.ts +4 -0
- package/dist/patterns/metadata/index.js +4 -0
- package/dist/patterns/metadata/metadata-filter-builder.d.ts +43 -0
- package/dist/patterns/metadata/metadata-filter-builder.js +362 -0
- package/dist/patterns/metadata/metadata-inspector.d.ts +31 -0
- package/dist/patterns/metadata/metadata-inspector.js +245 -0
- package/dist/patterns/metadata/schemas.d.ts +5 -0
- package/dist/patterns/metadata/schemas.js +66 -0
- package/dist/patterns/preview/annotation-inspector.d.ts +44 -0
- package/dist/patterns/preview/annotation-inspector.js +380 -0
- package/dist/patterns/preview/annotation-thread.d.ts +37 -0
- package/dist/patterns/preview/annotation-thread.js +338 -0
- package/dist/patterns/preview/annotation-toolbar.d.ts +42 -0
- package/dist/patterns/preview/annotation-toolbar.js +393 -0
- package/dist/patterns/preview/content-preview-adapter.d.ts +13 -0
- package/dist/patterns/preview/content-preview-adapter.js +30 -0
- package/dist/patterns/preview/index.d.ts +6 -0
- package/dist/patterns/preview/index.js +6 -0
- package/dist/patterns/preview/preview-element.d.ts +41 -0
- package/dist/patterns/preview/preview-element.js +429 -0
- package/dist/patterns/preview/provider-adapter.d.ts +36 -0
- package/dist/patterns/preview/provider-adapter.js +29 -0
- package/dist/patterns/search/filter-bar.d.ts +50 -0
- package/dist/patterns/search/filter-bar.js +379 -0
- package/dist/patterns/search/index.d.ts +3 -0
- package/dist/patterns/search/index.js +3 -0
- package/dist/patterns/search/saved-view-picker.d.ts +25 -0
- package/dist/patterns/search/saved-view-picker.js +239 -0
- package/dist/patterns/search/search-results-header.d.ts +34 -0
- package/dist/patterns/search/search-results-header.js +288 -0
- package/dist/patterns/share/access-stats.d.ts +19 -0
- package/dist/patterns/share/access-stats.js +204 -0
- package/dist/patterns/share/collaborator-avatars.d.ts +22 -0
- package/dist/patterns/share/collaborator-avatars.js +214 -0
- package/dist/patterns/share/contracts.d.ts +65 -0
- package/dist/patterns/share/contracts.js +75 -0
- package/dist/patterns/share/index.d.ts +14 -0
- package/dist/patterns/share/index.js +14 -0
- package/dist/patterns/share/invite-collaborators-contracts.d.ts +38 -0
- package/dist/patterns/share/invite-collaborators-contracts.js +1 -0
- package/dist/patterns/share/invite-collaborators-controller.d.ts +40 -0
- package/dist/patterns/share/invite-collaborators-controller.js +86 -0
- package/dist/patterns/share/invite-collaborators-modal.d.ts +46 -0
- package/dist/patterns/share/invite-collaborators-modal.js +465 -0
- package/dist/patterns/share/permission-matrix.d.ts +37 -0
- package/dist/patterns/share/permission-matrix.js +360 -0
- package/dist/patterns/share/presence-contracts.d.ts +26 -0
- package/dist/patterns/share/presence-contracts.js +1 -0
- package/dist/patterns/share/presence-controller.d.ts +31 -0
- package/dist/patterns/share/presence-controller.js +47 -0
- package/dist/patterns/share/presence.d.ts +32 -0
- package/dist/patterns/share/presence.js +255 -0
- package/dist/patterns/share/schemas.d.ts +4 -0
- package/dist/patterns/share/schemas.js +41 -0
- package/dist/patterns/share/share-panel.d.ts +75 -0
- package/dist/patterns/share/share-panel.js +565 -0
- package/dist/patterns/share/unified-share-controller.d.ts +52 -0
- package/dist/patterns/share/unified-share-controller.js +97 -0
- package/dist/patterns/share/unified-share-modal.d.ts +50 -0
- package/dist/patterns/share/unified-share-modal.js +646 -0
- package/dist/patterns/task/index.d.ts +2 -0
- package/dist/patterns/task/index.js +2 -0
- package/dist/patterns/task/review-queue-item.d.ts +45 -0
- package/dist/patterns/task/review-queue-item.js +403 -0
- package/dist/patterns/task/task-assignment-panel.d.ts +50 -0
- package/dist/patterns/task/task-assignment-panel.js +450 -0
- package/package.json +151 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { BaseElement } from "../../core/index.js";
|
|
2
|
+
import { boeRadius } from "../../foundations/geometry/index.js";
|
|
3
|
+
const DEFAULT_TAG_NAME = "box-app-shell";
|
|
4
|
+
const appShellStyles = `
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
color: inherit;
|
|
8
|
+
font: inherit;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[part="shell"] {
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-rows: auto 1fr auto;
|
|
14
|
+
min-height: 100%;
|
|
15
|
+
border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 82%, transparent);
|
|
16
|
+
border-radius: ${boeRadius.large};
|
|
17
|
+
background: var(--boe-token-surface-surface, #ffffff);
|
|
18
|
+
color: var(--boe-token-text-text, #222222);
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
container-type: inline-size;
|
|
21
|
+
container-name: boe-app-shell;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[part="header"] {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-wrap: wrap;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
gap: 0.6rem;
|
|
30
|
+
padding: 0.65rem 0.75rem;
|
|
31
|
+
border-bottom: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 68%, transparent);
|
|
32
|
+
background: color-mix(in srgb, var(--boe-token-surface-surface-secondary, #fbfbfb) 94%, var(--boe-token-surface-surface, #ffffff) 6%);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[part="header-main"] {
|
|
36
|
+
display: grid;
|
|
37
|
+
gap: 0.2rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[part="header-main"] ::slotted([slot="eyebrow"]) {
|
|
41
|
+
font-size: 0.8rem;
|
|
42
|
+
font-weight: 700;
|
|
43
|
+
letter-spacing: 0.08em;
|
|
44
|
+
text-transform: uppercase;
|
|
45
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[part="title"] {
|
|
49
|
+
margin: 0;
|
|
50
|
+
font: inherit;
|
|
51
|
+
font-size: 1.1rem;
|
|
52
|
+
font-weight: 700;
|
|
53
|
+
line-height: 1.2;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
[part="header-actions"] {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 0.55rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[part="frame"] {
|
|
64
|
+
display: grid;
|
|
65
|
+
grid-template-columns: minmax(11rem, auto) 1fr minmax(11rem, auto);
|
|
66
|
+
align-items: stretch;
|
|
67
|
+
min-height: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[part="nav"] {
|
|
71
|
+
padding: 0.65rem;
|
|
72
|
+
border-right: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 68%, transparent);
|
|
73
|
+
background: color-mix(in srgb, var(--boe-token-surface-surface-secondary, #fbfbfb) 94%, var(--boe-token-surface-surface, #ffffff) 6%);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[part="main"] {
|
|
77
|
+
min-width: 0;
|
|
78
|
+
padding: 0.7rem;
|
|
79
|
+
background: var(--boe-token-surface-surface, #ffffff);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[part="aside"] {
|
|
83
|
+
padding: 0.65rem;
|
|
84
|
+
border-left: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 68%, transparent);
|
|
85
|
+
background: color-mix(in srgb, var(--boe-token-surface-surface-secondary, #fbfbfb) 94%, var(--boe-token-surface-surface, #ffffff) 6%);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[part="nav"][hidden],
|
|
89
|
+
[part="aside"][hidden],
|
|
90
|
+
[part="footer"][hidden] {
|
|
91
|
+
display: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[part="frame"]:not(:has([part="nav"]:not([hidden]))):not(:has([part="aside"]:not([hidden]))) {
|
|
95
|
+
grid-template-columns: 1fr;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
[part="frame"]:has([part="nav"]:not([hidden])):not(:has([part="aside"]:not([hidden]))) {
|
|
99
|
+
grid-template-columns: minmax(11rem, auto) 1fr;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
[part="frame"]:not(:has([part="nav"]:not([hidden]))):has([part="aside"]:not([hidden])) {
|
|
103
|
+
grid-template-columns: 1fr minmax(11rem, auto);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[part="footer"] {
|
|
107
|
+
padding: 0.55rem 0.75rem;
|
|
108
|
+
border-top: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 68%, transparent);
|
|
109
|
+
background: color-mix(in srgb, var(--boe-token-surface-surface-secondary, #fbfbfb) 94%, var(--boe-token-surface-surface, #ffffff) 6%);
|
|
110
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
111
|
+
font-size: 0.86rem;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Narrow shells stack nav → main → aside instead of a three-column frame. */
|
|
115
|
+
@container boe-app-shell (max-width: 48rem) {
|
|
116
|
+
[part="frame"] {
|
|
117
|
+
grid-template-columns: 1fr;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
[part="frame"]:has([part="nav"]:not([hidden])):not(:has([part="aside"]:not([hidden]))),
|
|
121
|
+
[part="frame"]:not(:has([part="nav"]:not([hidden]))):has([part="aside"]:not([hidden])),
|
|
122
|
+
[part="frame"]:has([part="nav"]:not([hidden])):has([part="aside"]:not([hidden])) {
|
|
123
|
+
grid-template-columns: 1fr;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[part="nav"] {
|
|
127
|
+
border-right: 0;
|
|
128
|
+
border-bottom: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 68%, transparent);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
[part="aside"] {
|
|
132
|
+
border-left: 0;
|
|
133
|
+
border-top: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 68%, transparent);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
export class BoxAppShellElement extends BaseElement {
|
|
138
|
+
static get observedAttributes() {
|
|
139
|
+
return ["heading", "nav-label", "aside-label"];
|
|
140
|
+
}
|
|
141
|
+
shellEl;
|
|
142
|
+
titleEl;
|
|
143
|
+
navEl;
|
|
144
|
+
asideEl;
|
|
145
|
+
footerEl;
|
|
146
|
+
navSlot;
|
|
147
|
+
asideSlot;
|
|
148
|
+
footerSlot;
|
|
149
|
+
slotObserver = null;
|
|
150
|
+
get heading() {
|
|
151
|
+
return this.getAttribute("heading") ?? "App Shell";
|
|
152
|
+
}
|
|
153
|
+
set heading(value) {
|
|
154
|
+
this.setAttribute("heading", value);
|
|
155
|
+
}
|
|
156
|
+
get navLabel() {
|
|
157
|
+
return this.getAttribute("nav-label") ?? "Primary";
|
|
158
|
+
}
|
|
159
|
+
set navLabel(value) {
|
|
160
|
+
this.setAttribute("nav-label", value);
|
|
161
|
+
}
|
|
162
|
+
get asideLabel() {
|
|
163
|
+
return this.getAttribute("aside-label") ?? "Context";
|
|
164
|
+
}
|
|
165
|
+
set asideLabel(value) {
|
|
166
|
+
this.setAttribute("aside-label", value);
|
|
167
|
+
}
|
|
168
|
+
renderTemplate() {
|
|
169
|
+
if (!this.shadowRoot) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
this.shadowRoot.innerHTML = `
|
|
173
|
+
<style>${appShellStyles}</style>
|
|
174
|
+
<section part="shell">
|
|
175
|
+
<header part="header">
|
|
176
|
+
<div part="header-main">
|
|
177
|
+
<slot name="eyebrow"></slot>
|
|
178
|
+
<h2 part="title"></h2>
|
|
179
|
+
</div>
|
|
180
|
+
<div part="header-actions">
|
|
181
|
+
<slot name="header-actions"></slot>
|
|
182
|
+
</div>
|
|
183
|
+
</header>
|
|
184
|
+
<div part="frame">
|
|
185
|
+
<nav part="nav" aria-label="Primary">
|
|
186
|
+
<slot name="nav"></slot>
|
|
187
|
+
</nav>
|
|
188
|
+
<main part="main">
|
|
189
|
+
<slot></slot>
|
|
190
|
+
</main>
|
|
191
|
+
<aside part="aside" aria-label="Context">
|
|
192
|
+
<slot name="aside"></slot>
|
|
193
|
+
</aside>
|
|
194
|
+
</div>
|
|
195
|
+
<footer part="footer">
|
|
196
|
+
<slot name="footer"></slot>
|
|
197
|
+
</footer>
|
|
198
|
+
</section>
|
|
199
|
+
`;
|
|
200
|
+
this.shellEl = this.shadowRoot.querySelector('[part="shell"]');
|
|
201
|
+
this.titleEl = this.shadowRoot.querySelector('[part="title"]');
|
|
202
|
+
this.navEl = this.shadowRoot.querySelector('[part="nav"]');
|
|
203
|
+
this.asideEl = this.shadowRoot.querySelector('[part="aside"]');
|
|
204
|
+
this.footerEl = this.shadowRoot.querySelector('[part="footer"]');
|
|
205
|
+
this.navSlot = this.shadowRoot.querySelector('slot[name="nav"]');
|
|
206
|
+
this.asideSlot = this.shadowRoot.querySelector('slot[name="aside"]');
|
|
207
|
+
this.footerSlot = this.shadowRoot.querySelector('slot[name="footer"]');
|
|
208
|
+
}
|
|
209
|
+
setupListeners() {
|
|
210
|
+
this.navSlot.addEventListener("slotchange", () => this.syncLandmarkVisibility());
|
|
211
|
+
this.asideSlot.addEventListener("slotchange", () => this.syncLandmarkVisibility());
|
|
212
|
+
this.footerSlot.addEventListener("slotchange", () => this.syncLandmarkVisibility());
|
|
213
|
+
// Cover hosts (incl. jsdom) that do not emit slotchange for light-DOM appends.
|
|
214
|
+
this.slotObserver = new MutationObserver(() => this.syncLandmarkVisibility());
|
|
215
|
+
this.slotObserver.observe(this, {
|
|
216
|
+
childList: true,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
disconnectedCallback() {
|
|
220
|
+
this.slotObserver?.disconnect();
|
|
221
|
+
this.slotObserver = null;
|
|
222
|
+
}
|
|
223
|
+
hasNamedSlotContent(name, slot) {
|
|
224
|
+
// Prefer direct light-DOM children — jsdom often leaves slot.assignedNodes() empty
|
|
225
|
+
// even when slotted children are present.
|
|
226
|
+
if (Array.from(this.children).some(el => el.getAttribute("slot") === name)) {
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
return slot.assignedNodes({ flatten: true }).length > 0;
|
|
230
|
+
}
|
|
231
|
+
syncLandmarkVisibility() {
|
|
232
|
+
if (!this.navEl || !this.asideEl || !this.footerEl) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
this.navEl.hidden = !this.hasNamedSlotContent("nav", this.navSlot);
|
|
236
|
+
this.asideEl.hidden = !this.hasNamedSlotContent("aside", this.asideSlot);
|
|
237
|
+
this.footerEl.hidden = !this.hasNamedSlotContent("footer", this.footerSlot);
|
|
238
|
+
}
|
|
239
|
+
update() {
|
|
240
|
+
if (!this.shellEl || !this.titleEl || !this.navEl || !this.asideEl) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const heading = this.heading;
|
|
244
|
+
this.shellEl.setAttribute("aria-label", heading);
|
|
245
|
+
this.titleEl.textContent = heading;
|
|
246
|
+
this.navEl.setAttribute("aria-label", this.navLabel);
|
|
247
|
+
this.asideEl.setAttribute("aria-label", this.asideLabel);
|
|
248
|
+
this.syncLandmarkVisibility();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
export const defineBoxAppShellElement = (tagName = DEFAULT_TAG_NAME) => {
|
|
252
|
+
const existingElement = customElements.get(tagName);
|
|
253
|
+
if (existingElement) {
|
|
254
|
+
return existingElement;
|
|
255
|
+
}
|
|
256
|
+
customElements.define(tagName, BoxAppShellElement);
|
|
257
|
+
return BoxAppShellElement;
|
|
258
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseElement } from "../../core/index.js";
|
|
2
|
+
export declare class BoxDividerElement extends BaseElement {
|
|
3
|
+
static get observedAttributes(): string[];
|
|
4
|
+
private dividerEl;
|
|
5
|
+
get label(): string;
|
|
6
|
+
set label(value: string);
|
|
7
|
+
get orientation(): string;
|
|
8
|
+
set orientation(value: string);
|
|
9
|
+
protected renderTemplate(): void;
|
|
10
|
+
protected update(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const defineBoxDividerElement: (tagName?: string) => typeof BoxDividerElement;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { BaseElement } from "../../core/index.js";
|
|
2
|
+
const DEFAULT_TAG_NAME = "box-divider";
|
|
3
|
+
const escapeHtml = (value) => value
|
|
4
|
+
.replaceAll("&", "&")
|
|
5
|
+
.replaceAll("<", "<")
|
|
6
|
+
.replaceAll(">", ">")
|
|
7
|
+
.replaceAll('"', """)
|
|
8
|
+
.replaceAll("'", "'");
|
|
9
|
+
const dividerStyles = `
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
/* A horizontal divider spans its container even when placed as a flex item. */
|
|
13
|
+
inline-size: 100%;
|
|
14
|
+
color: inherit;
|
|
15
|
+
font: inherit;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([orientation="vertical"]) {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
inline-size: auto;
|
|
21
|
+
block-size: 100%;
|
|
22
|
+
vertical-align: middle;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[part="divider"] {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 0.55rem;
|
|
29
|
+
inline-size: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([orientation="vertical"]) [part="divider"] {
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
inline-size: auto;
|
|
35
|
+
block-size: 100%;
|
|
36
|
+
min-block-size: 1rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[part~="line"] {
|
|
40
|
+
flex: 1 1 0%;
|
|
41
|
+
block-size: 1px;
|
|
42
|
+
border: 0;
|
|
43
|
+
background: var(--boe-token-stroke-stroke, #e8e8e8);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([orientation="vertical"]) [part~="line"] {
|
|
47
|
+
inline-size: 1px;
|
|
48
|
+
block-size: auto;
|
|
49
|
+
align-self: stretch;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[part="label"] {
|
|
53
|
+
flex: 0 0 auto;
|
|
54
|
+
font-size: 0.72rem;
|
|
55
|
+
font-weight: 700;
|
|
56
|
+
letter-spacing: 0.08em;
|
|
57
|
+
text-transform: uppercase;
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
export class BoxDividerElement extends BaseElement {
|
|
63
|
+
static get observedAttributes() {
|
|
64
|
+
return ["label", "orientation"];
|
|
65
|
+
}
|
|
66
|
+
dividerEl;
|
|
67
|
+
get label() {
|
|
68
|
+
return this.getAttribute("label") ?? "";
|
|
69
|
+
}
|
|
70
|
+
set label(value) {
|
|
71
|
+
this.setAttribute("label", value);
|
|
72
|
+
}
|
|
73
|
+
get orientation() {
|
|
74
|
+
return this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal";
|
|
75
|
+
}
|
|
76
|
+
set orientation(value) {
|
|
77
|
+
this.setAttribute("orientation", value);
|
|
78
|
+
}
|
|
79
|
+
renderTemplate() {
|
|
80
|
+
if (!this.shadowRoot) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.shadowRoot.innerHTML = `
|
|
84
|
+
<style>${dividerStyles}</style>
|
|
85
|
+
<div part="divider" role="separator"></div>
|
|
86
|
+
`;
|
|
87
|
+
this.dividerEl = this.shadowRoot.querySelector('[part="divider"]');
|
|
88
|
+
}
|
|
89
|
+
update() {
|
|
90
|
+
if (!this.dividerEl) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const orientation = this.orientation;
|
|
94
|
+
const label = this.label;
|
|
95
|
+
// A vertical divider never carries a label; only horizontal section dividers do.
|
|
96
|
+
const hasLabel = orientation === "horizontal" && label.length > 0;
|
|
97
|
+
this.dividerEl.setAttribute("aria-orientation", orientation);
|
|
98
|
+
if (hasLabel) {
|
|
99
|
+
this.dividerEl.setAttribute("aria-label", label);
|
|
100
|
+
this.dividerEl.innerHTML = `
|
|
101
|
+
<span part="line line-start"></span>
|
|
102
|
+
<span part="label">${escapeHtml(label)}</span>
|
|
103
|
+
<span part="line line-end"></span>
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.dividerEl.removeAttribute("aria-label");
|
|
108
|
+
this.dividerEl.innerHTML = `<span part="line"></span>`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export const defineBoxDividerElement = (tagName = DEFAULT_TAG_NAME) => {
|
|
113
|
+
const existingElement = customElements.get(tagName);
|
|
114
|
+
if (existingElement) {
|
|
115
|
+
return existingElement;
|
|
116
|
+
}
|
|
117
|
+
customElements.define(tagName, BoxDividerElement);
|
|
118
|
+
return BoxDividerElement;
|
|
119
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseElement } from "../../core/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* A collapsible navigation rail for the explorer/workspace shell. It owns no
|
|
4
|
+
* transport and no routing: it is structure (a labelled `<nav>` with header,
|
|
5
|
+
* body, and footer slots) plus a reflected `collapsed` state that narrows the
|
|
6
|
+
* rail to its icon strip. Pair it with `box-sidebar-toggle-button`, wiring the
|
|
7
|
+
* button's `toggle` event to this element's `collapsed` property.
|
|
8
|
+
*
|
|
9
|
+
* Collapsed icon contract: slot `a`/`button` rows with an icon and a
|
|
10
|
+
* `[data-nav-label]` span. Host exposes `--boe-nav-label-display` (`none` when
|
|
11
|
+
* collapsed) so light-DOM CSS can hide labels without piercing the shadow tree.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BoxNavSidebarElement extends BaseElement {
|
|
14
|
+
static get observedAttributes(): string[];
|
|
15
|
+
private sidebarEl;
|
|
16
|
+
get collapsed(): boolean;
|
|
17
|
+
set collapsed(value: boolean);
|
|
18
|
+
get label(): string;
|
|
19
|
+
set label(value: string);
|
|
20
|
+
protected renderTemplate(): void;
|
|
21
|
+
protected update(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const defineBoxNavSidebarElement: (tagName?: string) => typeof BoxNavSidebarElement;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { BaseElement } from "../../core/index.js";
|
|
2
|
+
import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
|
|
3
|
+
import { boeRadius } from "../../foundations/geometry/index.js";
|
|
4
|
+
const DEFAULT_TAG_NAME = "box-nav-sidebar";
|
|
5
|
+
const navSidebarStyles = `
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
color: inherit;
|
|
9
|
+
font: inherit;
|
|
10
|
+
/* Consumers hide label spans with: [data-nav-label] { display: var(--boe-nav-label-display, inline); } */
|
|
11
|
+
--boe-nav-label-display: inline;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host([collapsed]) {
|
|
15
|
+
--boe-nav-label-display: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[part="sidebar"] {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: 0.55rem;
|
|
22
|
+
block-size: 100%;
|
|
23
|
+
inline-size: 14rem;
|
|
24
|
+
padding: 0.65rem 0.6rem;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 82%, transparent);
|
|
27
|
+
border-radius: ${boeRadius.large};
|
|
28
|
+
background: color-mix(in srgb, var(--boe-token-surface-surface-secondary, #fbfbfb) 94%, var(--boe-token-surface-surface, #ffffff) 6%);
|
|
29
|
+
color: var(--boe-token-text-text, #222222);
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
transition: inline-size ${boeMotionDuration.medium} ${boeMotionEasing.standard};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Collapsed: shrink to an icon strip. The header and footer usually hold
|
|
35
|
+
branding and labels, so they hide; the body (icon nav) stays. */
|
|
36
|
+
[part="sidebar"][data-collapsed="true"] {
|
|
37
|
+
inline-size: 3.75rem;
|
|
38
|
+
padding-inline: 0.55rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[part="header"],
|
|
42
|
+
[part="footer"] {
|
|
43
|
+
display: block;
|
|
44
|
+
min-block-size: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[part="sidebar"][data-collapsed="true"] [part="header"],
|
|
48
|
+
[part="sidebar"][data-collapsed="true"] [part="footer"] {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[part="body"] {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
gap: 0.15rem;
|
|
56
|
+
flex: 1 1 auto;
|
|
57
|
+
min-block-size: 0;
|
|
58
|
+
overflow-y: auto;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Icon-strip contract: slotted anchors/buttons lay out as nav rows. Pair with
|
|
62
|
+
[data-nav-icon] / [data-nav-label] in light DOM (see docs example). */
|
|
63
|
+
[part="body"] ::slotted(a),
|
|
64
|
+
[part="body"] ::slotted(button) {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: 0.55rem;
|
|
68
|
+
min-block-size: 1.9rem;
|
|
69
|
+
padding: 0.3rem 0.45rem;
|
|
70
|
+
border-radius: ${boeRadius.nav};
|
|
71
|
+
color: inherit;
|
|
72
|
+
text-decoration: none;
|
|
73
|
+
font: inherit;
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
[part="body"] ::slotted(button) {
|
|
78
|
+
appearance: none;
|
|
79
|
+
border: 0;
|
|
80
|
+
background: transparent;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
text-align: start;
|
|
83
|
+
width: 100%;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[part="body"] ::slotted(a:hover),
|
|
87
|
+
[part="body"] ::slotted(button:hover) {
|
|
88
|
+
background: color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 8%, var(--boe-token-surface-surface, #ffffff) 92%);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
[part="sidebar"][data-collapsed="true"] ::slotted(a),
|
|
92
|
+
[part="sidebar"][data-collapsed="true"] ::slotted(button) {
|
|
93
|
+
justify-content: center;
|
|
94
|
+
padding-inline: 0.25rem;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
[part="footer"] {
|
|
98
|
+
padding-block-start: 0.75rem;
|
|
99
|
+
border-top: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 68%, transparent);
|
|
100
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
101
|
+
font-size: 0.86rem;
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
/**
|
|
105
|
+
* A collapsible navigation rail for the explorer/workspace shell. It owns no
|
|
106
|
+
* transport and no routing: it is structure (a labelled `<nav>` with header,
|
|
107
|
+
* body, and footer slots) plus a reflected `collapsed` state that narrows the
|
|
108
|
+
* rail to its icon strip. Pair it with `box-sidebar-toggle-button`, wiring the
|
|
109
|
+
* button's `toggle` event to this element's `collapsed` property.
|
|
110
|
+
*
|
|
111
|
+
* Collapsed icon contract: slot `a`/`button` rows with an icon and a
|
|
112
|
+
* `[data-nav-label]` span. Host exposes `--boe-nav-label-display` (`none` when
|
|
113
|
+
* collapsed) so light-DOM CSS can hide labels without piercing the shadow tree.
|
|
114
|
+
*/
|
|
115
|
+
export class BoxNavSidebarElement extends BaseElement {
|
|
116
|
+
static get observedAttributes() {
|
|
117
|
+
return ["collapsed", "label"];
|
|
118
|
+
}
|
|
119
|
+
sidebarEl;
|
|
120
|
+
get collapsed() {
|
|
121
|
+
return this.hasAttribute("collapsed");
|
|
122
|
+
}
|
|
123
|
+
set collapsed(value) {
|
|
124
|
+
this.toggleAttribute("collapsed", value);
|
|
125
|
+
}
|
|
126
|
+
get label() {
|
|
127
|
+
return this.getAttribute("label") ?? "Sidebar";
|
|
128
|
+
}
|
|
129
|
+
set label(value) {
|
|
130
|
+
this.setAttribute("label", value);
|
|
131
|
+
}
|
|
132
|
+
renderTemplate() {
|
|
133
|
+
if (!this.shadowRoot) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
this.shadowRoot.innerHTML = `
|
|
137
|
+
<style>${navSidebarStyles}</style>
|
|
138
|
+
<nav part="sidebar">
|
|
139
|
+
<div part="header">
|
|
140
|
+
<slot name="header"></slot>
|
|
141
|
+
</div>
|
|
142
|
+
<div part="body">
|
|
143
|
+
<slot></slot>
|
|
144
|
+
</div>
|
|
145
|
+
<div part="footer">
|
|
146
|
+
<slot name="footer"></slot>
|
|
147
|
+
</div>
|
|
148
|
+
</nav>
|
|
149
|
+
`;
|
|
150
|
+
this.sidebarEl = this.shadowRoot.querySelector('[part="sidebar"]');
|
|
151
|
+
}
|
|
152
|
+
update() {
|
|
153
|
+
if (!this.sidebarEl) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.sidebarEl.dataset.collapsed = this.collapsed ? "true" : "false";
|
|
157
|
+
this.sidebarEl.setAttribute("aria-label", this.label);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
export const defineBoxNavSidebarElement = (tagName = DEFAULT_TAG_NAME) => {
|
|
161
|
+
const existingElement = customElements.get(tagName);
|
|
162
|
+
if (existingElement) {
|
|
163
|
+
return existingElement;
|
|
164
|
+
}
|
|
165
|
+
customElements.define(tagName, BoxNavSidebarElement);
|
|
166
|
+
return BoxNavSidebarElement;
|
|
167
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseElement } from "../../core/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* A titled content region: an optional eyebrow, a heading, an optional
|
|
4
|
+
* description, an `actions` slot for header controls, and a default slot for
|
|
5
|
+
* content. The `<section>` is labelled by its heading via `aria-labelledby` so
|
|
6
|
+
* it is announced as a named region. Layout-only — it owns no behavior.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BoxSectionElement extends BaseElement {
|
|
9
|
+
static get observedAttributes(): string[];
|
|
10
|
+
private headerMainEl;
|
|
11
|
+
get heading(): string;
|
|
12
|
+
set heading(value: string);
|
|
13
|
+
get eyebrow(): string;
|
|
14
|
+
set eyebrow(value: string);
|
|
15
|
+
get description(): string;
|
|
16
|
+
set description(value: string);
|
|
17
|
+
protected renderTemplate(): void;
|
|
18
|
+
protected update(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare const defineBoxSectionElement: (tagName?: string) => typeof BoxSectionElement;
|