@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,565 @@
|
|
|
1
|
+
import { BaseElement } from "../../core/index.js";
|
|
2
|
+
import { boePanel, boeRadius } from "../../foundations/geometry/index.js";
|
|
3
|
+
import { boeBrandInteractiveStyles, boeNeutralInteractiveStyles, } from "../../foundations/tokens/index.js";
|
|
4
|
+
const DEFAULT_TAG_NAME = "box-share-panel";
|
|
5
|
+
const escapeHtml = (value) => value
|
|
6
|
+
.replaceAll("&", "&")
|
|
7
|
+
.replaceAll("<", "<")
|
|
8
|
+
.replaceAll(">", ">")
|
|
9
|
+
.replaceAll('"', """)
|
|
10
|
+
.replaceAll("'", "'");
|
|
11
|
+
const escapeSelectorValue = (value) => value.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
12
|
+
const elementStyles = `
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
color: inherit;
|
|
16
|
+
font: inherit;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[part="panel"] {
|
|
20
|
+
display: grid;
|
|
21
|
+
gap: ${boePanel.gap};
|
|
22
|
+
padding: ${boePanel.padding};
|
|
23
|
+
border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 82%, transparent);
|
|
24
|
+
border-radius: ${boePanel.radius};
|
|
25
|
+
background: ${boePanel.background};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[part="header"] {
|
|
29
|
+
display: grid;
|
|
30
|
+
gap: 0.45rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[part="title"] {
|
|
34
|
+
font-size: 1.1rem;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
line-height: 1.15;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[part="message"] {
|
|
40
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
41
|
+
line-height: 1.55;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[part="shared-link"],
|
|
45
|
+
[part="settings"],
|
|
46
|
+
[part="collaborators"] {
|
|
47
|
+
display: grid;
|
|
48
|
+
gap: ${boePanel.gap};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[part="shared-link"] {
|
|
52
|
+
padding: 0.65rem;
|
|
53
|
+
border-radius: ${boePanel.radius};
|
|
54
|
+
background: var(--boe-token-surface-surface, #ffffff);
|
|
55
|
+
border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 48%, transparent);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[part="shared-link-header"] {
|
|
59
|
+
display: flex;
|
|
60
|
+
gap: ${boePanel.gap};
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[part="shared-link-label"],
|
|
66
|
+
[part="section-title"] {
|
|
67
|
+
font-size: 0.8rem;
|
|
68
|
+
font-weight: 700;
|
|
69
|
+
letter-spacing: 0.08em;
|
|
70
|
+
text-transform: uppercase;
|
|
71
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[part="shared-link-access"] {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
padding: 0.35rem 0.6rem;
|
|
77
|
+
border-radius: 999px;
|
|
78
|
+
background: color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 12%, var(--boe-token-surface-surface, #ffffff) 88%);
|
|
79
|
+
color: var(--boe-token-surface-surface-brand, #0061d5);
|
|
80
|
+
font-size: 0.8rem;
|
|
81
|
+
font-weight: 700;
|
|
82
|
+
letter-spacing: 0.05em;
|
|
83
|
+
text-transform: uppercase;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[part="shared-link-url"] {
|
|
87
|
+
appearance: none;
|
|
88
|
+
width: 100%;
|
|
89
|
+
text-align: left;
|
|
90
|
+
border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 52%, transparent);
|
|
91
|
+
border-radius: ${boeRadius.control};
|
|
92
|
+
background: color-mix(in srgb, var(--boe-token-surface-surface-secondary, #fbfbfb) 82%, var(--boe-token-surface-surface, #ffffff) 18%);
|
|
93
|
+
color: var(--boe-token-text-text, #1f1e1b);
|
|
94
|
+
font: inherit;
|
|
95
|
+
padding: 0.55rem 0.7rem;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[part="shared-link-meta"] {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-wrap: wrap;
|
|
102
|
+
gap: 0.6rem;
|
|
103
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
104
|
+
font-size: 0.92rem;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[part="shared-link-status"] {
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
color: color-mix(in srgb, var(--boe-token-surface-status-surface-success, #26c281) 70%, var(--boe-token-text-text, #222222));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[part="settings-list"] {
|
|
113
|
+
display: grid;
|
|
114
|
+
gap: ${boePanel.gap};
|
|
115
|
+
margin: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[part="setting"] {
|
|
119
|
+
display: flex;
|
|
120
|
+
gap: ${boePanel.gap};
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: space-between;
|
|
123
|
+
padding: 0.55rem 0.7rem;
|
|
124
|
+
border-radius: ${boeRadius.med};
|
|
125
|
+
background: var(--boe-token-surface-surface, #ffffff);
|
|
126
|
+
border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 42%, transparent);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
[part="setting-label"] {
|
|
130
|
+
margin: 0;
|
|
131
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
132
|
+
font-weight: 600;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
[part="setting-value"] {
|
|
136
|
+
margin: 0;
|
|
137
|
+
font-weight: 600;
|
|
138
|
+
color: var(--boe-token-text-text, #1f1e1b);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
[part="setting-value"][data-tone="success"] {
|
|
142
|
+
color: color-mix(in srgb, var(--boe-token-surface-status-surface-success, #26c281) 70%, var(--boe-token-text-text, #222222));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
[part="setting-value"][data-tone="accent"] {
|
|
146
|
+
color: var(--boe-token-surface-surface-brand, #0061d5);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
[part="collaborator-list"] {
|
|
150
|
+
display: grid;
|
|
151
|
+
gap: ${boePanel.gap};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
[part="collaborator"] {
|
|
155
|
+
display: grid;
|
|
156
|
+
grid-template-columns: auto 1fr;
|
|
157
|
+
gap: ${boePanel.gap};
|
|
158
|
+
align-items: center;
|
|
159
|
+
width: 100%;
|
|
160
|
+
text-align: left;
|
|
161
|
+
border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 52%, transparent);
|
|
162
|
+
border-radius: ${boePanel.radius};
|
|
163
|
+
padding: 0.55rem 0.7rem;
|
|
164
|
+
background: var(--boe-token-surface-surface, #ffffff);
|
|
165
|
+
color: inherit;
|
|
166
|
+
font: inherit;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
[part="collaborator-avatar"] {
|
|
171
|
+
inline-size: 2.5rem;
|
|
172
|
+
block-size: 2.5rem;
|
|
173
|
+
display: grid;
|
|
174
|
+
place-items: center;
|
|
175
|
+
border-radius: 999px;
|
|
176
|
+
background: rgba(0, 97, 213, 0.12);
|
|
177
|
+
color: var(--boe-token-surface-surface-brand, #0061d5);
|
|
178
|
+
font-weight: 700;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
[part="collaborator-meta"] {
|
|
182
|
+
display: grid;
|
|
183
|
+
gap: 0.15rem;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
[part="collaborator-name"] {
|
|
187
|
+
font-weight: 600;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
[part="collaborator-role"] {
|
|
191
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
[part="collaborator-description"] {
|
|
195
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
196
|
+
font-size: 0.94rem;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
[part="actions"] {
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-wrap: wrap;
|
|
202
|
+
gap: ${boePanel.gap};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
[part="action"] {
|
|
206
|
+
appearance: none;
|
|
207
|
+
border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 70%, transparent);
|
|
208
|
+
border-radius: 999px;
|
|
209
|
+
background: var(--boe-token-surface-surface, #ffffff);
|
|
210
|
+
color: inherit;
|
|
211
|
+
font: inherit;
|
|
212
|
+
font-weight: 600;
|
|
213
|
+
padding: 0.4rem 0.7rem;
|
|
214
|
+
cursor: pointer;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
${boeNeutralInteractiveStyles('[part="shared-link-url"]')}
|
|
218
|
+
${boeNeutralInteractiveStyles('[part="collaborator"]')}
|
|
219
|
+
${boeNeutralInteractiveStyles('[part="action"]')}
|
|
220
|
+
${boeBrandInteractiveStyles('[part="action"][data-tone="primary"]')}
|
|
221
|
+
|
|
222
|
+
[part="action"][data-tone="primary"] {
|
|
223
|
+
background: var(--boe-token-surface-surface-brand, #0061d5);
|
|
224
|
+
border-color: var(--boe-token-text-text, #1f1e1b);
|
|
225
|
+
color: var(--boe-token-text-text-on-brand, #ffffff);
|
|
226
|
+
}
|
|
227
|
+
`;
|
|
228
|
+
export class BoxSharePanelElement extends BaseElement {
|
|
229
|
+
static get observedAttributes() {
|
|
230
|
+
return ["actions", "collaborators", "message", "settings", "shared-link", "heading"];
|
|
231
|
+
}
|
|
232
|
+
titleEl;
|
|
233
|
+
messageEl;
|
|
234
|
+
sharedLinkEl;
|
|
235
|
+
sharedLinkLabelEl;
|
|
236
|
+
sharedLinkAccessEl;
|
|
237
|
+
sharedLinkUrlEl;
|
|
238
|
+
sharedLinkStatusEl;
|
|
239
|
+
sharedLinkExpiryEl;
|
|
240
|
+
settingsSectionEl;
|
|
241
|
+
settingsListEl;
|
|
242
|
+
collaboratorsSectionEl;
|
|
243
|
+
collaboratorListEl;
|
|
244
|
+
actionsEl;
|
|
245
|
+
settingsSignature = "";
|
|
246
|
+
collaboratorsSignature = "";
|
|
247
|
+
actionsSignature = "";
|
|
248
|
+
get actions() {
|
|
249
|
+
return this.parseJsonAttribute("actions", []);
|
|
250
|
+
}
|
|
251
|
+
set actions(value) {
|
|
252
|
+
this.setAttribute("actions", JSON.stringify(value));
|
|
253
|
+
}
|
|
254
|
+
get collaborators() {
|
|
255
|
+
return this.parseJsonAttribute("collaborators", []);
|
|
256
|
+
}
|
|
257
|
+
set collaborators(value) {
|
|
258
|
+
this.setAttribute("collaborators", JSON.stringify(value));
|
|
259
|
+
}
|
|
260
|
+
get message() {
|
|
261
|
+
return this.getAttribute("message") ?? "";
|
|
262
|
+
}
|
|
263
|
+
set message(value) {
|
|
264
|
+
this.setAttribute("message", value);
|
|
265
|
+
}
|
|
266
|
+
get settings() {
|
|
267
|
+
return this.parseJsonAttribute("settings", []);
|
|
268
|
+
}
|
|
269
|
+
set settings(value) {
|
|
270
|
+
this.setAttribute("settings", JSON.stringify(value));
|
|
271
|
+
}
|
|
272
|
+
get sharedLink() {
|
|
273
|
+
return this.parseJsonAttribute("shared-link", null);
|
|
274
|
+
}
|
|
275
|
+
set sharedLink(value) {
|
|
276
|
+
if (!value) {
|
|
277
|
+
this.removeAttribute("shared-link");
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
this.setAttribute("shared-link", JSON.stringify(value));
|
|
281
|
+
}
|
|
282
|
+
get heading() {
|
|
283
|
+
return this.getAttribute("heading") ?? "Share";
|
|
284
|
+
}
|
|
285
|
+
set heading(value) {
|
|
286
|
+
this.setAttribute("heading", value);
|
|
287
|
+
}
|
|
288
|
+
connectedCallback() {
|
|
289
|
+
super.connectedCallback();
|
|
290
|
+
}
|
|
291
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
292
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
293
|
+
}
|
|
294
|
+
parseJsonAttribute(name, fallback) {
|
|
295
|
+
const raw = this.getAttribute(name);
|
|
296
|
+
if (!raw) {
|
|
297
|
+
return fallback;
|
|
298
|
+
}
|
|
299
|
+
try {
|
|
300
|
+
return JSON.parse(raw);
|
|
301
|
+
}
|
|
302
|
+
catch {
|
|
303
|
+
return fallback;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
emitAction(actionId) {
|
|
307
|
+
this.dispatchEvent(new CustomEvent("action", {
|
|
308
|
+
bubbles: true,
|
|
309
|
+
composed: true,
|
|
310
|
+
detail: { action: actionId },
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
emitCollaboratorSelected(collaborator) {
|
|
314
|
+
this.dispatchEvent(new CustomEvent("collaborator-selected", {
|
|
315
|
+
bubbles: true,
|
|
316
|
+
composed: true,
|
|
317
|
+
detail: collaborator,
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
settingsKey() {
|
|
321
|
+
return JSON.stringify(this.settings.map(setting => setting.label));
|
|
322
|
+
}
|
|
323
|
+
collaboratorsKey() {
|
|
324
|
+
return JSON.stringify(this.collaborators.map(collaborator => collaborator.id ?? collaborator.name));
|
|
325
|
+
}
|
|
326
|
+
actionsKey() {
|
|
327
|
+
return JSON.stringify(this.actions.map(action => ({ id: action.id, tone: action.tone ?? "neutral" })));
|
|
328
|
+
}
|
|
329
|
+
rebuildSettings() {
|
|
330
|
+
this.settingsListEl.innerHTML = this.settings
|
|
331
|
+
.map(setting => `
|
|
332
|
+
<div part="setting">
|
|
333
|
+
<dt part="setting-label">${escapeHtml(setting.label)}</dt>
|
|
334
|
+
<dd part="setting-value" data-tone="${escapeHtml(setting.tone ?? "neutral")}">${escapeHtml(setting.value)}</dd>
|
|
335
|
+
</div>
|
|
336
|
+
`)
|
|
337
|
+
.join("");
|
|
338
|
+
}
|
|
339
|
+
patchSettings() {
|
|
340
|
+
const rows = this.settingsListEl.querySelectorAll('[part="setting"]');
|
|
341
|
+
this.settings.forEach((setting, index) => {
|
|
342
|
+
const row = rows[index];
|
|
343
|
+
if (!row) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const labelEl = row.querySelector('[part="setting-label"]');
|
|
347
|
+
const valueEl = row.querySelector('[part="setting-value"]');
|
|
348
|
+
if (labelEl) {
|
|
349
|
+
labelEl.textContent = setting.label;
|
|
350
|
+
}
|
|
351
|
+
if (valueEl) {
|
|
352
|
+
valueEl.textContent = setting.value;
|
|
353
|
+
valueEl.dataset.tone = setting.tone ?? "neutral";
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
rebuildCollaborators() {
|
|
358
|
+
this.collaboratorListEl.innerHTML = this.collaborators
|
|
359
|
+
.map(collaborator => `
|
|
360
|
+
<button
|
|
361
|
+
type="button"
|
|
362
|
+
part="collaborator"
|
|
363
|
+
data-collaborator-name="${escapeHtml(collaborator.name)}"
|
|
364
|
+
data-collaborator-role="${escapeHtml(collaborator.role)}"
|
|
365
|
+
data-collaborator-description="${escapeHtml(collaborator.description ?? "")}"
|
|
366
|
+
data-collaborator-id="${escapeHtml(collaborator.id ?? "")}"
|
|
367
|
+
>
|
|
368
|
+
<span part="collaborator-avatar">${escapeHtml(collaborator.initials ?? collaborator.name.slice(0, 2).toUpperCase())}</span>
|
|
369
|
+
<span part="collaborator-meta">
|
|
370
|
+
<span part="collaborator-name">${escapeHtml(collaborator.name)}</span>
|
|
371
|
+
<span part="collaborator-role">${escapeHtml(collaborator.role)}</span>
|
|
372
|
+
<span part="collaborator-description" ${collaborator.description ? "" : "hidden"}>${escapeHtml(collaborator.description ?? "")}</span>
|
|
373
|
+
</span>
|
|
374
|
+
</button>
|
|
375
|
+
`)
|
|
376
|
+
.join("");
|
|
377
|
+
}
|
|
378
|
+
patchCollaborators() {
|
|
379
|
+
this.collaborators.forEach(collaborator => {
|
|
380
|
+
const button = this.collaboratorListEl.querySelector(collaborator.id
|
|
381
|
+
? `[data-collaborator-id="${escapeSelectorValue(collaborator.id)}"]`
|
|
382
|
+
: `[data-collaborator-name="${escapeSelectorValue(collaborator.name)}"]`);
|
|
383
|
+
if (!button) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
button.dataset.collaboratorName = collaborator.name;
|
|
387
|
+
button.dataset.collaboratorRole = collaborator.role;
|
|
388
|
+
button.dataset.collaboratorDescription = collaborator.description ?? "";
|
|
389
|
+
button.dataset.collaboratorId = collaborator.id ?? "";
|
|
390
|
+
const avatar = button.querySelector('[part="collaborator-avatar"]');
|
|
391
|
+
const nameEl = button.querySelector('[part="collaborator-name"]');
|
|
392
|
+
const roleEl = button.querySelector('[part="collaborator-role"]');
|
|
393
|
+
const descriptionEl = button.querySelector('[part="collaborator-description"]');
|
|
394
|
+
if (avatar) {
|
|
395
|
+
avatar.textContent = collaborator.initials ?? collaborator.name.slice(0, 2).toUpperCase();
|
|
396
|
+
}
|
|
397
|
+
if (nameEl) {
|
|
398
|
+
nameEl.textContent = collaborator.name;
|
|
399
|
+
}
|
|
400
|
+
if (roleEl) {
|
|
401
|
+
roleEl.textContent = collaborator.role;
|
|
402
|
+
}
|
|
403
|
+
if (descriptionEl) {
|
|
404
|
+
descriptionEl.hidden = !collaborator.description;
|
|
405
|
+
descriptionEl.textContent = collaborator.description ?? "";
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
rebuildActions() {
|
|
410
|
+
this.actionsEl.innerHTML = this.actions
|
|
411
|
+
.map(action => `
|
|
412
|
+
<button
|
|
413
|
+
type="button"
|
|
414
|
+
part="action"
|
|
415
|
+
data-action-id="${escapeHtml(action.id)}"
|
|
416
|
+
data-tone="${escapeHtml(action.tone ?? "neutral")}"
|
|
417
|
+
>
|
|
418
|
+
${escapeHtml(action.label)}
|
|
419
|
+
</button>
|
|
420
|
+
`)
|
|
421
|
+
.join("");
|
|
422
|
+
}
|
|
423
|
+
patchActionLabels() {
|
|
424
|
+
this.actions.forEach(action => {
|
|
425
|
+
const button = this.actionsEl.querySelector(`[data-action-id="${escapeSelectorValue(action.id)}"]`);
|
|
426
|
+
if (!button) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
button.textContent = action.label;
|
|
430
|
+
button.dataset.tone = action.tone ?? "neutral";
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
renderTemplate() {
|
|
434
|
+
if (!this.shadowRoot) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
this.shadowRoot.innerHTML = `
|
|
438
|
+
<style>${elementStyles}</style>
|
|
439
|
+
<section part="panel">
|
|
440
|
+
<header part="header">
|
|
441
|
+
<h2 part="title"></h2>
|
|
442
|
+
<div part="message" hidden></div>
|
|
443
|
+
</header>
|
|
444
|
+
<section part="shared-link" hidden>
|
|
445
|
+
<div part="shared-link-header">
|
|
446
|
+
<div part="shared-link-label"></div>
|
|
447
|
+
<div part="shared-link-access"></div>
|
|
448
|
+
</div>
|
|
449
|
+
<button type="button" part="shared-link-url" data-action-id="copy-link"></button>
|
|
450
|
+
<div part="shared-link-meta">
|
|
451
|
+
<span part="shared-link-status" hidden></span>
|
|
452
|
+
<span part="shared-link-expiry" hidden></span>
|
|
453
|
+
</div>
|
|
454
|
+
</section>
|
|
455
|
+
<section part="settings" hidden>
|
|
456
|
+
<div part="section-title">Settings</div>
|
|
457
|
+
<dl part="settings-list"></dl>
|
|
458
|
+
</section>
|
|
459
|
+
<section part="collaborators" hidden>
|
|
460
|
+
<div part="section-title">Collaborators</div>
|
|
461
|
+
<div part="collaborator-list"></div>
|
|
462
|
+
</section>
|
|
463
|
+
<div part="actions" hidden></div>
|
|
464
|
+
</section>
|
|
465
|
+
`;
|
|
466
|
+
this.titleEl = this.shadowRoot.querySelector('[part="title"]');
|
|
467
|
+
this.messageEl = this.shadowRoot.querySelector('[part="message"]');
|
|
468
|
+
this.sharedLinkEl = this.shadowRoot.querySelector('[part="shared-link"]');
|
|
469
|
+
this.sharedLinkLabelEl = this.shadowRoot.querySelector('[part="shared-link-label"]');
|
|
470
|
+
this.sharedLinkAccessEl = this.shadowRoot.querySelector('[part="shared-link-access"]');
|
|
471
|
+
this.sharedLinkUrlEl = this.shadowRoot.querySelector('[part="shared-link-url"]');
|
|
472
|
+
this.sharedLinkStatusEl = this.shadowRoot.querySelector('[part="shared-link-status"]');
|
|
473
|
+
this.sharedLinkExpiryEl = this.shadowRoot.querySelector('[part="shared-link-expiry"]');
|
|
474
|
+
this.settingsSectionEl = this.shadowRoot.querySelector('[part="settings"]');
|
|
475
|
+
this.settingsListEl = this.shadowRoot.querySelector('[part="settings-list"]');
|
|
476
|
+
this.collaboratorsSectionEl = this.shadowRoot.querySelector('[part="collaborators"]');
|
|
477
|
+
this.collaboratorListEl = this.shadowRoot.querySelector('[part="collaborator-list"]');
|
|
478
|
+
this.actionsEl = this.shadowRoot.querySelector('[part="actions"]');
|
|
479
|
+
}
|
|
480
|
+
setupListeners() {
|
|
481
|
+
this.sharedLinkUrlEl.addEventListener("click", () => {
|
|
482
|
+
this.emitAction("copy-link");
|
|
483
|
+
});
|
|
484
|
+
this.actionsEl.addEventListener("click", event => {
|
|
485
|
+
const button = event.target.closest('[part="action"]');
|
|
486
|
+
if (!button || !this.actionsEl.contains(button)) {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const actionId = button.dataset.actionId ?? "";
|
|
490
|
+
if (actionId) {
|
|
491
|
+
this.emitAction(actionId);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
this.collaboratorListEl.addEventListener("click", event => {
|
|
495
|
+
const button = event.target.closest('[part="collaborator"]');
|
|
496
|
+
if (!button || !this.collaboratorListEl.contains(button)) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
this.emitCollaboratorSelected({
|
|
500
|
+
id: button.dataset.collaboratorId || undefined,
|
|
501
|
+
name: button.dataset.collaboratorName ?? "",
|
|
502
|
+
role: button.dataset.collaboratorRole ?? "",
|
|
503
|
+
description: button.dataset.collaboratorDescription || undefined,
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
update() {
|
|
508
|
+
if (!this.titleEl || !this.actionsEl) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
this.titleEl.textContent = this.heading;
|
|
512
|
+
this.messageEl.hidden = !this.message;
|
|
513
|
+
this.messageEl.textContent = this.message;
|
|
514
|
+
const sharedLink = this.sharedLink;
|
|
515
|
+
this.sharedLinkEl.hidden = !sharedLink;
|
|
516
|
+
if (sharedLink) {
|
|
517
|
+
this.sharedLinkLabelEl.textContent = sharedLink.label ?? "Shared link";
|
|
518
|
+
this.sharedLinkAccessEl.textContent = sharedLink.access;
|
|
519
|
+
this.sharedLinkUrlEl.textContent = sharedLink.url;
|
|
520
|
+
this.sharedLinkStatusEl.hidden = !sharedLink.status;
|
|
521
|
+
this.sharedLinkStatusEl.textContent = sharedLink.status ?? "";
|
|
522
|
+
this.sharedLinkExpiryEl.hidden = !sharedLink.expiresAt;
|
|
523
|
+
this.sharedLinkExpiryEl.textContent = sharedLink.expiresAt ? `Expires ${sharedLink.expiresAt}` : "";
|
|
524
|
+
}
|
|
525
|
+
const settings = this.settings;
|
|
526
|
+
this.settingsSectionEl.hidden = settings.length === 0;
|
|
527
|
+
const nextSettings = this.settingsKey();
|
|
528
|
+
if (nextSettings !== this.settingsSignature || this.settingsListEl.childElementCount === 0) {
|
|
529
|
+
this.settingsSignature = nextSettings;
|
|
530
|
+
this.rebuildSettings();
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
this.patchSettings();
|
|
534
|
+
}
|
|
535
|
+
const collaborators = this.collaborators;
|
|
536
|
+
this.collaboratorsSectionEl.hidden = collaborators.length === 0;
|
|
537
|
+
const nextCollaborators = this.collaboratorsKey();
|
|
538
|
+
if (nextCollaborators !== this.collaboratorsSignature ||
|
|
539
|
+
this.collaboratorListEl.childElementCount === 0) {
|
|
540
|
+
this.collaboratorsSignature = nextCollaborators;
|
|
541
|
+
this.rebuildCollaborators();
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
this.patchCollaborators();
|
|
545
|
+
}
|
|
546
|
+
const actions = this.actions;
|
|
547
|
+
this.actionsEl.hidden = actions.length === 0;
|
|
548
|
+
const nextActions = this.actionsKey();
|
|
549
|
+
if (nextActions !== this.actionsSignature || this.actionsEl.childElementCount === 0) {
|
|
550
|
+
this.actionsSignature = nextActions;
|
|
551
|
+
this.rebuildActions();
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
this.patchActionLabels();
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
export const defineBoxSharePanelElement = (tagName = DEFAULT_TAG_NAME) => {
|
|
559
|
+
const existingElement = customElements.get(tagName);
|
|
560
|
+
if (existingElement) {
|
|
561
|
+
return existingElement;
|
|
562
|
+
}
|
|
563
|
+
customElements.define(tagName, BoxSharePanelElement);
|
|
564
|
+
return BoxSharePanelElement;
|
|
565
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Controller } from "../../core/index.js";
|
|
2
|
+
import type { CollaboratorSummary, ShareDataSource, SharedLinkState } from "./contracts.js";
|
|
3
|
+
export interface UnifiedShareControllerConfig {
|
|
4
|
+
itemId: string;
|
|
5
|
+
itemType?: "file" | "folder";
|
|
6
|
+
dataSource: ShareDataSource;
|
|
7
|
+
}
|
|
8
|
+
export type UnifiedShareTab = "link" | "people";
|
|
9
|
+
export type UnifiedShareStatus = "idle" | "loading" | "ready" | "error";
|
|
10
|
+
export interface UnifiedShareState {
|
|
11
|
+
status: UnifiedShareStatus;
|
|
12
|
+
sharedLink: SharedLinkState | null;
|
|
13
|
+
collaborators: CollaboratorSummary[];
|
|
14
|
+
activeTab: UnifiedShareTab;
|
|
15
|
+
updatingLink: boolean;
|
|
16
|
+
error: string | null;
|
|
17
|
+
}
|
|
18
|
+
type UnifiedShareEvents = {
|
|
19
|
+
stateChanged: {
|
|
20
|
+
state: UnifiedShareState;
|
|
21
|
+
};
|
|
22
|
+
loaded: {
|
|
23
|
+
sharedLink: SharedLinkState | null;
|
|
24
|
+
collaborators: CollaboratorSummary[];
|
|
25
|
+
};
|
|
26
|
+
linkChanged: {
|
|
27
|
+
sharedLink: SharedLinkState | null;
|
|
28
|
+
};
|
|
29
|
+
error: {
|
|
30
|
+
error: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The orchestration behind the unified share surface. It loads the item's share
|
|
35
|
+
* state (shared link + collaborators) from a `ShareDataSource`, drives shared-
|
|
36
|
+
* link access changes back through the same source, and tracks the active tab.
|
|
37
|
+
* Purely headless — the modal element renders `getState()` and reacts to
|
|
38
|
+
* `stateChanged`.
|
|
39
|
+
*/
|
|
40
|
+
export declare class UnifiedShareController extends Controller<UnifiedShareState, UnifiedShareEvents> {
|
|
41
|
+
private readonly config;
|
|
42
|
+
private inFlight;
|
|
43
|
+
constructor(config: UnifiedShareControllerConfig);
|
|
44
|
+
private update;
|
|
45
|
+
private toMessage;
|
|
46
|
+
/** Load the item's shared link and collaborators. No-op while any request is in flight. */
|
|
47
|
+
load(): Promise<void>;
|
|
48
|
+
/** Change the shared-link access level through the data source. No-op while any request is in flight. */
|
|
49
|
+
setAccess(access: NonNullable<SharedLinkState["access"]>): Promise<void>;
|
|
50
|
+
setActiveTab(tab: UnifiedShareTab): void;
|
|
51
|
+
}
|
|
52
|
+
export {};
|