@vonage/vivid 5.8.0 → 5.10.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/bundled/affix.js +1 -1
- package/bundled/anchored.cjs +1 -1
- package/bundled/anchored.js +6 -6
- package/bundled/data-grid.options.cjs +1 -0
- package/bundled/data-grid.options.js +29 -0
- package/bundled/definition10.js +4 -4
- package/bundled/definition2.cjs +1 -1
- package/bundled/definition2.js +1 -1
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/definition7.js +3 -3
- package/bundled/definition9.cjs +9 -9
- package/bundled/definition9.js +113 -1342
- package/bundled/floating-ui.dom.cjs +1 -0
- package/bundled/floating-ui.dom.js +1242 -0
- package/bundled/host-semantics.js +4 -4
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +21 -16
- package/bundled/mixins.cjs +2 -2
- package/bundled/mixins.js +6 -6
- package/bundled/slottable-request.cjs +4 -0
- package/bundled/slottable-request.js +2907 -0
- package/bundled/vivid-element.cjs +3 -3
- package/bundled/vivid-element.js +89 -69
- package/card/definition.cjs +1 -1
- package/card/definition.js +1 -1
- package/card/index.cjs +10 -10
- package/card/index.js +42 -42
- package/combobox/definition.cjs +14 -15
- package/combobox/definition.js +15 -16
- package/combobox/index.cjs +4 -4
- package/combobox/index.js +82 -87
- package/country/definition.cjs +340 -0
- package/country/definition.js +334 -0
- package/country/index.cjs +12 -0
- package/country/index.js +317 -0
- package/custom-elements.json +4835 -613
- package/data-grid/definition.cjs +23 -49
- package/data-grid/definition.js +1 -27
- package/data-grid/index.cjs +27 -27
- package/data-grid/index.js +44 -64
- package/file-picker/definition.cjs +10 -8
- package/file-picker/definition.js +10 -8
- package/file-picker/index.cjs +5 -5
- package/file-picker/index.js +12 -12
- package/icon/definition.cjs +1 -1
- package/icon/definition.js +1 -1
- package/index.cjs +38 -4
- package/index.js +7 -2
- package/lib/components.d.ts +6 -1
- package/lib/country/countries-data.d.ts +6 -0
- package/lib/country/country-code-to-flag-icon.d.ts +5 -0
- package/lib/country/country.d.ts +5 -0
- package/lib/country/country.template.d.ts +3 -0
- package/lib/country/definition.d.ts +3 -0
- package/lib/popover/definition.d.ts +4 -0
- package/lib/popover/locale.d.ts +3 -0
- package/lib/popover/popover.d.ts +781 -0
- package/lib/popover/popover.template.d.ts +3 -0
- package/lib/rich-text-editor/locale.d.ts +2 -0
- package/lib/rich-text-editor/popover.d.ts +1 -0
- package/lib/rich-text-editor/rte/config.d.ts +5 -1
- package/lib/rich-text-editor/rte/document.d.ts +2 -0
- package/lib/rich-text-editor/rte/exports.d.ts +5 -0
- package/lib/rich-text-editor/rte/feature.d.ts +7 -1
- package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/internal/foreign-html.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/internal/history.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/internal/input-rules.d.ts +15 -0
- package/lib/rich-text-editor/rte/instance.d.ts +4 -2
- package/lib/rich-text-editor/rte/utils/feature-state.d.ts +8 -0
- package/lib/rich-text-editor/rte/utils/text-before-cursor.d.ts +2 -0
- package/lib/rich-text-editor/rte/utils/ui.d.ts +2 -0
- package/lib/rich-text-editor/rte/view.d.ts +30 -0
- package/lib/rich-text-view/definition.d.ts +5 -0
- package/lib/rich-text-view/rich-text-view.d.ts +19 -0
- package/lib/rich-text-view/rich-text-view.template.d.ts +3 -0
- package/lib/selectable-box/selectable-box.d.ts +1 -0
- package/lib/status/definition.d.ts +4 -0
- package/lib/status/status.d.ts +388 -0
- package/lib/status/status.template.d.ts +3 -0
- package/lib/table/definition.d.ts +8 -0
- package/lib/table/table-body.d.ts +3 -0
- package/lib/table/table-body.template.d.ts +3 -0
- package/lib/table/table-cell.d.ts +381 -0
- package/lib/table/table-cell.template.d.ts +3 -0
- package/lib/table/table-head.d.ts +3 -0
- package/lib/table/table-head.template.d.ts +3 -0
- package/lib/table/table-header-cell.d.ts +381 -0
- package/lib/table/table-header-cell.template.d.ts +3 -0
- package/lib/table/table-row.d.ts +381 -0
- package/lib/table/table-row.template.d.ts +3 -0
- package/lib/table/table.d.ts +3 -0
- package/lib/table/table.template.d.ts +3 -0
- package/lib/tag/tag.d.ts +1 -1
- package/lib/tag-name-map.d.ts +11 -1
- package/locales/de-DE.cjs +6 -1
- package/locales/de-DE.js +6 -1
- package/locales/en-GB.cjs +6 -1
- package/locales/en-GB.js +6 -1
- package/locales/en-US.cjs +6 -1
- package/locales/en-US.js +6 -1
- package/locales/ja-JP.cjs +6 -1
- package/locales/ja-JP.js +6 -1
- package/locales/zh-CN.cjs +6 -1
- package/locales/zh-CN.js +6 -1
- package/package.json +10 -9
- package/popover/definition.cjs +363 -0
- package/popover/definition.js +357 -0
- package/popover/index.cjs +27 -0
- package/popover/index.js +263 -0
- package/rich-text-editor/definition.cjs +12125 -14657
- package/rich-text-editor/definition.js +8876 -11412
- package/rich-text-editor/index.cjs +20 -22
- package/rich-text-editor/index.js +5046 -7096
- package/rich-text-view/definition.cjs +171 -0
- package/rich-text-view/definition.js +165 -0
- package/rich-text-view/index.cjs +1 -0
- package/rich-text-view/index.js +103 -0
- package/selectable-box/definition.cjs +16 -5
- package/selectable-box/definition.js +16 -5
- package/selectable-box/index.cjs +11 -9
- package/selectable-box/index.js +86 -78
- package/shared/localization/Locale.d.ts +2 -0
- package/shared/utils/slottable-request.d.ts +7 -0
- package/status/definition.cjs +76 -0
- package/status/definition.js +70 -0
- package/status/index.cjs +11 -0
- package/status/index.js +55 -0
- package/styles/core/all.css +2 -2
- package/styles/core/theme.css +2 -2
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/table/definition.cjs +168 -0
- package/table/definition.js +152 -0
- package/table/index.cjs +37 -0
- package/table/index.js +107 -0
- package/tag/definition.cjs +1 -1
- package/tag/definition.js +1 -1
- package/tag/index.cjs +24 -24
- package/tag/index.js +89 -89
- package/unbundled/_commonjsHelpers.cjs +26 -0
- package/unbundled/_commonjsHelpers.js +26 -1
- package/unbundled/data-grid.options.cjs +34 -0
- package/unbundled/data-grid.options.js +28 -0
- package/unbundled/definition.cjs +1 -1
- package/unbundled/definition.js +1 -1
- package/unbundled/slottable-request.cjs +3702 -0
- package/unbundled/slottable-request.js +3684 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +11 -1
- package/video-player/definition.js +12 -2
- package/video-player/index.cjs +30 -30
- package/video-player/index.js +705 -702
- package/vivid.api.json +1957 -143
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const vividElement = require('../unbundled/vivid-element.cjs');
|
|
6
|
+
const fastElement = require('@microsoft/fast-element');
|
|
7
|
+
const slottableRequest = require('../unbundled/slottable-request.cjs');
|
|
8
|
+
|
|
9
|
+
const styles = ":host{display:contents}.content{display:contents;overflow-wrap:break-word;white-space:break-spaces}";
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
13
|
+
var result = void 0 ;
|
|
14
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
15
|
+
if (decorator = decorators[i])
|
|
16
|
+
result = (decorator(target, key, result) ) || result;
|
|
17
|
+
if (result) __defProp(target, key, result);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
class RichTextView extends vividElement.VividElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this._slotCounter = 0;
|
|
24
|
+
this._slottedChildren = /* @__PURE__ */ new Set();
|
|
25
|
+
this._slotRequests = /* @__PURE__ */ new Set();
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
this._contentElement = null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
viewChanged(oldView, newView) {
|
|
35
|
+
if (oldView) {
|
|
36
|
+
this._removeStyles();
|
|
37
|
+
}
|
|
38
|
+
if (newView) {
|
|
39
|
+
this._addStyles(newView);
|
|
40
|
+
}
|
|
41
|
+
this._updateView();
|
|
42
|
+
}
|
|
43
|
+
_addStyles(view) {
|
|
44
|
+
const config = view[slottableRequest.impl].config[slottableRequest.impl];
|
|
45
|
+
this._styles = new fastElement.ElementStyles(
|
|
46
|
+
slottableRequest.sortedContributions(config.features.flatMap((f) => f.getStyles()))
|
|
47
|
+
);
|
|
48
|
+
this._styles.addStylesTo(this.shadowRoot);
|
|
49
|
+
}
|
|
50
|
+
_removeStyles() {
|
|
51
|
+
if (this._styles) {
|
|
52
|
+
this._styles.removeStylesFrom(this.shadowRoot);
|
|
53
|
+
this._styles = void 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
_cleanupLightDom() {
|
|
57
|
+
for (const el of this._slottedChildren) {
|
|
58
|
+
this.removeChild(el);
|
|
59
|
+
}
|
|
60
|
+
for (const slotName of this._slotRequests) {
|
|
61
|
+
slottableRequest.dispatchSlottableRequest(this, "child", slotName, slottableRequest.removeSymbol);
|
|
62
|
+
}
|
|
63
|
+
this._slottedChildren.clear();
|
|
64
|
+
this._slotRequests.clear();
|
|
65
|
+
this._slotCounter = 0;
|
|
66
|
+
}
|
|
67
|
+
_updateView() {
|
|
68
|
+
if (!this._contentElement) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this._contentElement.innerHTML = "";
|
|
72
|
+
this._cleanupLightDom();
|
|
73
|
+
if (this.view) {
|
|
74
|
+
this._contentElement.appendChild(this._renderView(this.view));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
_renderView(rteView) {
|
|
78
|
+
const ctx = rteView[slottableRequest.impl];
|
|
79
|
+
if (rteView.type === "node" && rteView.node.type === "doc") {
|
|
80
|
+
rteView = rteView.children;
|
|
81
|
+
}
|
|
82
|
+
if (rteView.type === "fragment") {
|
|
83
|
+
const frag = document.createDocumentFragment();
|
|
84
|
+
for (const child of rteView.content) {
|
|
85
|
+
frag.appendChild(this._renderView(child));
|
|
86
|
+
}
|
|
87
|
+
return frag;
|
|
88
|
+
}
|
|
89
|
+
const customRenderedView = ctx.options.renderChildView?.(rteView) ?? false;
|
|
90
|
+
if (customRenderedView) {
|
|
91
|
+
return this._handleCustomRender(rteView, customRenderedView);
|
|
92
|
+
} else {
|
|
93
|
+
return this._renderDefault(rteView);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
_handleCustomRender(rteView, customResult) {
|
|
97
|
+
const slotName = `child-view-${this._slotCounter++}`;
|
|
98
|
+
const slot = document.createElement("slot");
|
|
99
|
+
slot.setAttribute("name", slotName);
|
|
100
|
+
if (customResult === true) {
|
|
101
|
+
this._slotRequests.add(slotName);
|
|
102
|
+
slottableRequest.dispatchSlottableRequest(this, "child", slotName, {
|
|
103
|
+
view: rteView
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
const { dom, contentDom = dom } = customResult;
|
|
107
|
+
const nestedView = document.createElement(this.tagName);
|
|
108
|
+
nestedView.view = rteView.children;
|
|
109
|
+
contentDom.appendChild(nestedView);
|
|
110
|
+
dom.setAttribute("slot", slotName);
|
|
111
|
+
this.appendChild(dom);
|
|
112
|
+
this._slottedChildren.add(dom);
|
|
113
|
+
}
|
|
114
|
+
return slot;
|
|
115
|
+
}
|
|
116
|
+
_renderDefault(view) {
|
|
117
|
+
const ctx = view[slottableRequest.impl];
|
|
118
|
+
const config = ctx.config[slottableRequest.impl];
|
|
119
|
+
const schema = config.schema;
|
|
120
|
+
if (view.type === "node" && view.node.type === "text") {
|
|
121
|
+
return document.createTextNode(view.node.text);
|
|
122
|
+
}
|
|
123
|
+
const item = view.type === "node" ? view.node : view.mark;
|
|
124
|
+
const pmItem = view.type === "node" ? slottableRequest.Node.fromJSON(schema, item) : slottableRequest.Mark.fromJSON(schema, item);
|
|
125
|
+
const spec = pmItem instanceof slottableRequest.Node ? pmItem.type.spec.toDOM(pmItem) : pmItem.type.spec.toDOM(pmItem, true);
|
|
126
|
+
const { dom, contentDOM = dom } = slottableRequest.DOMSerializer.renderSpec(document, spec);
|
|
127
|
+
const childrenRendered = this._renderView(view.children);
|
|
128
|
+
contentDOM.appendChild(childrenRendered);
|
|
129
|
+
return dom;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
connectedCallback() {
|
|
135
|
+
super.connectedCallback();
|
|
136
|
+
this._updateView();
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @internal
|
|
140
|
+
*/
|
|
141
|
+
disconnectedCallback() {
|
|
142
|
+
super.disconnectedCallback();
|
|
143
|
+
this._removeStyles();
|
|
144
|
+
this._cleanupLightDom();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
__decorateClass([
|
|
148
|
+
fastElement.observable
|
|
149
|
+
], RichTextView.prototype, "view");
|
|
150
|
+
|
|
151
|
+
const RichTextViewTemplate = () => fastElement.html`<div class="content rich-text" ${fastElement.ref("_contentElement")}></div>`;
|
|
152
|
+
|
|
153
|
+
const richTextViewDefinition = vividElement.defineVividComponent(
|
|
154
|
+
"rich-text-view",
|
|
155
|
+
RichTextView,
|
|
156
|
+
RichTextViewTemplate,
|
|
157
|
+
[],
|
|
158
|
+
{
|
|
159
|
+
styles,
|
|
160
|
+
shadowOptions: {
|
|
161
|
+
delegatesFocus: true
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
const registerRichTextView = vividElement.createRegisterFunction(
|
|
166
|
+
richTextViewDefinition
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
exports.VwcRichTextViewElement = RichTextView;
|
|
170
|
+
exports.registerRichTextView = registerRichTextView;
|
|
171
|
+
exports.richTextViewDefinition = richTextViewDefinition;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
2
|
+
import { ElementStyles, observable, ref, html } from '@microsoft/fast-element';
|
|
3
|
+
import { i as impl, s as sortedContributions, d as dispatchSlottableRequest, N as Node, M as Mark, D as DOMSerializer, r as removeSymbol } from '../unbundled/slottable-request.js';
|
|
4
|
+
|
|
5
|
+
const styles = ":host{display:contents}.content{display:contents;overflow-wrap:break-word;white-space:break-spaces}";
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = void 0 ;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (decorator(target, key, result) ) || result;
|
|
13
|
+
if (result) __defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
class RichTextView extends VividElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this._slotCounter = 0;
|
|
20
|
+
this._slottedChildren = /* @__PURE__ */ new Set();
|
|
21
|
+
this._slotRequests = /* @__PURE__ */ new Set();
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
this._contentElement = null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
viewChanged(oldView, newView) {
|
|
31
|
+
if (oldView) {
|
|
32
|
+
this._removeStyles();
|
|
33
|
+
}
|
|
34
|
+
if (newView) {
|
|
35
|
+
this._addStyles(newView);
|
|
36
|
+
}
|
|
37
|
+
this._updateView();
|
|
38
|
+
}
|
|
39
|
+
_addStyles(view) {
|
|
40
|
+
const config = view[impl].config[impl];
|
|
41
|
+
this._styles = new ElementStyles(
|
|
42
|
+
sortedContributions(config.features.flatMap((f) => f.getStyles()))
|
|
43
|
+
);
|
|
44
|
+
this._styles.addStylesTo(this.shadowRoot);
|
|
45
|
+
}
|
|
46
|
+
_removeStyles() {
|
|
47
|
+
if (this._styles) {
|
|
48
|
+
this._styles.removeStylesFrom(this.shadowRoot);
|
|
49
|
+
this._styles = void 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
_cleanupLightDom() {
|
|
53
|
+
for (const el of this._slottedChildren) {
|
|
54
|
+
this.removeChild(el);
|
|
55
|
+
}
|
|
56
|
+
for (const slotName of this._slotRequests) {
|
|
57
|
+
dispatchSlottableRequest(this, "child", slotName, removeSymbol);
|
|
58
|
+
}
|
|
59
|
+
this._slottedChildren.clear();
|
|
60
|
+
this._slotRequests.clear();
|
|
61
|
+
this._slotCounter = 0;
|
|
62
|
+
}
|
|
63
|
+
_updateView() {
|
|
64
|
+
if (!this._contentElement) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this._contentElement.innerHTML = "";
|
|
68
|
+
this._cleanupLightDom();
|
|
69
|
+
if (this.view) {
|
|
70
|
+
this._contentElement.appendChild(this._renderView(this.view));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_renderView(rteView) {
|
|
74
|
+
const ctx = rteView[impl];
|
|
75
|
+
if (rteView.type === "node" && rteView.node.type === "doc") {
|
|
76
|
+
rteView = rteView.children;
|
|
77
|
+
}
|
|
78
|
+
if (rteView.type === "fragment") {
|
|
79
|
+
const frag = document.createDocumentFragment();
|
|
80
|
+
for (const child of rteView.content) {
|
|
81
|
+
frag.appendChild(this._renderView(child));
|
|
82
|
+
}
|
|
83
|
+
return frag;
|
|
84
|
+
}
|
|
85
|
+
const customRenderedView = ctx.options.renderChildView?.(rteView) ?? false;
|
|
86
|
+
if (customRenderedView) {
|
|
87
|
+
return this._handleCustomRender(rteView, customRenderedView);
|
|
88
|
+
} else {
|
|
89
|
+
return this._renderDefault(rteView);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
_handleCustomRender(rteView, customResult) {
|
|
93
|
+
const slotName = `child-view-${this._slotCounter++}`;
|
|
94
|
+
const slot = document.createElement("slot");
|
|
95
|
+
slot.setAttribute("name", slotName);
|
|
96
|
+
if (customResult === true) {
|
|
97
|
+
this._slotRequests.add(slotName);
|
|
98
|
+
dispatchSlottableRequest(this, "child", slotName, {
|
|
99
|
+
view: rteView
|
|
100
|
+
});
|
|
101
|
+
} else {
|
|
102
|
+
const { dom, contentDom = dom } = customResult;
|
|
103
|
+
const nestedView = document.createElement(this.tagName);
|
|
104
|
+
nestedView.view = rteView.children;
|
|
105
|
+
contentDom.appendChild(nestedView);
|
|
106
|
+
dom.setAttribute("slot", slotName);
|
|
107
|
+
this.appendChild(dom);
|
|
108
|
+
this._slottedChildren.add(dom);
|
|
109
|
+
}
|
|
110
|
+
return slot;
|
|
111
|
+
}
|
|
112
|
+
_renderDefault(view) {
|
|
113
|
+
const ctx = view[impl];
|
|
114
|
+
const config = ctx.config[impl];
|
|
115
|
+
const schema = config.schema;
|
|
116
|
+
if (view.type === "node" && view.node.type === "text") {
|
|
117
|
+
return document.createTextNode(view.node.text);
|
|
118
|
+
}
|
|
119
|
+
const item = view.type === "node" ? view.node : view.mark;
|
|
120
|
+
const pmItem = view.type === "node" ? Node.fromJSON(schema, item) : Mark.fromJSON(schema, item);
|
|
121
|
+
const spec = pmItem instanceof Node ? pmItem.type.spec.toDOM(pmItem) : pmItem.type.spec.toDOM(pmItem, true);
|
|
122
|
+
const { dom, contentDOM = dom } = DOMSerializer.renderSpec(document, spec);
|
|
123
|
+
const childrenRendered = this._renderView(view.children);
|
|
124
|
+
contentDOM.appendChild(childrenRendered);
|
|
125
|
+
return dom;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
connectedCallback() {
|
|
131
|
+
super.connectedCallback();
|
|
132
|
+
this._updateView();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
137
|
+
disconnectedCallback() {
|
|
138
|
+
super.disconnectedCallback();
|
|
139
|
+
this._removeStyles();
|
|
140
|
+
this._cleanupLightDom();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
__decorateClass([
|
|
144
|
+
observable
|
|
145
|
+
], RichTextView.prototype, "view");
|
|
146
|
+
|
|
147
|
+
const RichTextViewTemplate = () => html`<div class="content rich-text" ${ref("_contentElement")}></div>`;
|
|
148
|
+
|
|
149
|
+
const richTextViewDefinition = defineVividComponent(
|
|
150
|
+
"rich-text-view",
|
|
151
|
+
RichTextView,
|
|
152
|
+
RichTextViewTemplate,
|
|
153
|
+
[],
|
|
154
|
+
{
|
|
155
|
+
styles,
|
|
156
|
+
shadowOptions: {
|
|
157
|
+
delegatesFocus: true
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
const registerRichTextView = createRegisterFunction(
|
|
162
|
+
richTextViewDefinition
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
export { RichTextView as VwcRichTextViewElement, registerRichTextView, richTextViewDefinition };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../bundled/vivid-element.cjs"),o=require("../bundled/slottable-request.cjs"),_=require("../bundled/ref.cjs"),f=":host{display:contents}.content{display:contents;overflow-wrap:break-word;white-space:break-spaces}";var y=Object.defineProperty,C=(d,e,s,i)=>{for(var t=void 0,n=d.length-1,l;n>=0;n--)(l=d[n])&&(t=l(e,s,t)||t);return t&&y(e,s,t),t};class h extends c.VividElement{constructor(){super(...arguments),this._slotCounter=0,this._slottedChildren=new Set,this._slotRequests=new Set,this._contentElement=null}viewChanged(e,s){e&&this._removeStyles(),s&&this._addStyles(s),this._updateView()}_addStyles(e){const s=e[o.impl].config[o.impl];this._styles=new c.ElementStyles(o.sortedContributions(s.features.flatMap(i=>i.getStyles()))),this._styles.addStylesTo(this.shadowRoot)}_removeStyles(){this._styles&&(this._styles.removeStylesFrom(this.shadowRoot),this._styles=void 0)}_cleanupLightDom(){for(const e of this._slottedChildren)this.removeChild(e);for(const e of this._slotRequests)o.dispatchSlottableRequest(this,"child",e,o.removeSymbol);this._slottedChildren.clear(),this._slotRequests.clear(),this._slotCounter=0}_updateView(){this._contentElement&&(this._contentElement.innerHTML="",this._cleanupLightDom(),this.view&&this._contentElement.appendChild(this._renderView(this.view)))}_renderView(e){const s=e[o.impl];if(e.type==="node"&&e.node.type==="doc"&&(e=e.children),e.type==="fragment"){const t=document.createDocumentFragment();for(const n of e.content)t.appendChild(this._renderView(n));return t}const i=s.options.renderChildView?.(e)??!1;return i?this._handleCustomRender(e,i):this._renderDefault(e)}_handleCustomRender(e,s){const i=`child-view-${this._slotCounter++}`,t=document.createElement("slot");if(t.setAttribute("name",i),s===!0)this._slotRequests.add(i),o.dispatchSlottableRequest(this,"child",i,{view:e});else{const{dom:n,contentDom:l=n}=s,r=document.createElement(this.tagName);r.view=e.children,l.appendChild(r),n.setAttribute("slot",i),this.appendChild(n),this._slottedChildren.add(n)}return t}_renderDefault(e){const t=e[o.impl].config[o.impl].schema;if(e.type==="node"&&e.node.type==="text")return document.createTextNode(e.node.text);const n=e.type==="node"?e.node:e.mark,l=e.type==="node"?o.Node.fromJSON(t,n):o.Mark.fromJSON(t,n),r=l instanceof o.Node?l.type.spec.toDOM(l):l.type.spec.toDOM(l,!0),{dom:a,contentDOM:p=a}=o.DOMSerializer.renderSpec(document,r),u=this._renderView(e.children);return p.appendChild(u),a}connectedCallback(){super.connectedCallback(),this._updateView()}disconnectedCallback(){super.disconnectedCallback(),this._removeStyles(),this._cleanupLightDom()}}C([c.observable],h.prototype,"view");const g=()=>c.html`<div class="content rich-text" ${_.ref("_contentElement")}></div>`,v=c.defineVividComponent("rich-text-view",h,g,[],{styles:f,shadowOptions:{delegatesFocus:!0}}),m=c.createRegisterFunction(v);m();exports.RichTextView=h;exports.registerRichTextView=m;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { V as _, w as f, o as y, h as C, c as g, d as v } from "../bundled/vivid-element.js";
|
|
2
|
+
import { i as r, s as S, h as a, N as h, M as b, D as x, r as R } from "../bundled/slottable-request.js";
|
|
3
|
+
import { r as w } from "../bundled/ref.js";
|
|
4
|
+
const D = ":host{display:contents}.content{display:contents;overflow-wrap:break-word;white-space:break-spaces}";
|
|
5
|
+
var E = Object.defineProperty, k = (d, e, s, o) => {
|
|
6
|
+
for (var t = void 0, n = d.length - 1, i; n >= 0; n--)
|
|
7
|
+
(i = d[n]) && (t = i(e, s, t) || t);
|
|
8
|
+
return t && E(e, s, t), t;
|
|
9
|
+
};
|
|
10
|
+
class m extends _ {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this._slotCounter = 0, this._slottedChildren = /* @__PURE__ */ new Set(), this._slotRequests = /* @__PURE__ */ new Set(), this._contentElement = null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
viewChanged(e, s) {
|
|
18
|
+
e && this._removeStyles(), s && this._addStyles(s), this._updateView();
|
|
19
|
+
}
|
|
20
|
+
_addStyles(e) {
|
|
21
|
+
const s = e[r].config[r];
|
|
22
|
+
this._styles = new f(
|
|
23
|
+
S(s.features.flatMap((o) => o.getStyles()))
|
|
24
|
+
), this._styles.addStylesTo(this.shadowRoot);
|
|
25
|
+
}
|
|
26
|
+
_removeStyles() {
|
|
27
|
+
this._styles && (this._styles.removeStylesFrom(this.shadowRoot), this._styles = void 0);
|
|
28
|
+
}
|
|
29
|
+
_cleanupLightDom() {
|
|
30
|
+
for (const e of this._slottedChildren)
|
|
31
|
+
this.removeChild(e);
|
|
32
|
+
for (const e of this._slotRequests)
|
|
33
|
+
a(this, "child", e, R);
|
|
34
|
+
this._slottedChildren.clear(), this._slotRequests.clear(), this._slotCounter = 0;
|
|
35
|
+
}
|
|
36
|
+
_updateView() {
|
|
37
|
+
this._contentElement && (this._contentElement.innerHTML = "", this._cleanupLightDom(), this.view && this._contentElement.appendChild(this._renderView(this.view)));
|
|
38
|
+
}
|
|
39
|
+
_renderView(e) {
|
|
40
|
+
const s = e[r];
|
|
41
|
+
if (e.type === "node" && e.node.type === "doc" && (e = e.children), e.type === "fragment") {
|
|
42
|
+
const t = document.createDocumentFragment();
|
|
43
|
+
for (const n of e.content)
|
|
44
|
+
t.appendChild(this._renderView(n));
|
|
45
|
+
return t;
|
|
46
|
+
}
|
|
47
|
+
const o = s.options.renderChildView?.(e) ?? !1;
|
|
48
|
+
return o ? this._handleCustomRender(e, o) : this._renderDefault(e);
|
|
49
|
+
}
|
|
50
|
+
_handleCustomRender(e, s) {
|
|
51
|
+
const o = `child-view-${this._slotCounter++}`, t = document.createElement("slot");
|
|
52
|
+
if (t.setAttribute("name", o), s === !0)
|
|
53
|
+
this._slotRequests.add(o), a(this, "child", o, {
|
|
54
|
+
view: e
|
|
55
|
+
});
|
|
56
|
+
else {
|
|
57
|
+
const { dom: n, contentDom: i = n } = s, c = document.createElement(this.tagName);
|
|
58
|
+
c.view = e.children, i.appendChild(c), n.setAttribute("slot", o), this.appendChild(n), this._slottedChildren.add(n);
|
|
59
|
+
}
|
|
60
|
+
return t;
|
|
61
|
+
}
|
|
62
|
+
_renderDefault(e) {
|
|
63
|
+
const t = e[r].config[r].schema;
|
|
64
|
+
if (e.type === "node" && e.node.type === "text")
|
|
65
|
+
return document.createTextNode(e.node.text);
|
|
66
|
+
const n = e.type === "node" ? e.node : e.mark, i = e.type === "node" ? h.fromJSON(t, n) : b.fromJSON(t, n), c = i instanceof h ? i.type.spec.toDOM(i) : i.type.spec.toDOM(i, !0), { dom: l, contentDOM: p = l } = x.renderSpec(document, c), u = this._renderView(e.children);
|
|
67
|
+
return p.appendChild(u), l;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
connectedCallback() {
|
|
73
|
+
super.connectedCallback(), this._updateView();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
disconnectedCallback() {
|
|
79
|
+
super.disconnectedCallback(), this._removeStyles(), this._cleanupLightDom();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
k([
|
|
83
|
+
y
|
|
84
|
+
], m.prototype, "view");
|
|
85
|
+
const M = () => C`<div class="content rich-text" ${w("_contentElement")}></div>`, N = v(
|
|
86
|
+
"rich-text-view",
|
|
87
|
+
m,
|
|
88
|
+
M,
|
|
89
|
+
[],
|
|
90
|
+
{
|
|
91
|
+
styles: D,
|
|
92
|
+
shadowOptions: {
|
|
93
|
+
delegatesFocus: !0
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
), O = g(
|
|
97
|
+
N
|
|
98
|
+
);
|
|
99
|
+
O();
|
|
100
|
+
export {
|
|
101
|
+
m as RichTextView,
|
|
102
|
+
O as registerRichTextView
|
|
103
|
+
};
|
|
@@ -10,7 +10,7 @@ const delegatesAria = require('../unbundled/delegates-aria.cjs');
|
|
|
10
10
|
const fastWebUtilities = require('@microsoft/fast-web-utilities');
|
|
11
11
|
const enums = require('../unbundled/enums.cjs');
|
|
12
12
|
|
|
13
|
-
const styles = ":host{display:flex}.base.connotation-cta{--_connotation-color-firm-all: var(--vvd-selectable-box-cta-firm-all, var(--vvd-color-cta-600));--_connotation-color-pale: var(--vvd-selectable-box-cta-pale, var(--vvd-color-cta-300));--_connotation-color-fierce: var(--vvd-selectable-box-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-faint: var(--vvd-selectable-box-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-selectable-box-cta-soft, var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-firm-all: var(--vvd-selectable-box-accent-firm-all, var(--vvd-color-neutral-600));--_connotation-color-pale: var(--vvd-selectable-box-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-fierce: var(--vvd-selectable-box-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-selectable-box-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-selectable-box-accent-soft, var(--vvd-color-neutral-100))}.base{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-pale)}@media (hover: hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: var(--_connotation-color-pale)}@media (hover: hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}.base{--control-offset: calc(var(--selectable-box-spacing, 16px) + 36px)}.base{position:relative;padding:var(--selectable-box-spacing, 16px);border:1px solid var(--_appearance-color-outline);border-radius:8px;background-color:var(--_appearance-color-fill);inline-size:100%;text-align:start}.base.control-placement-end-stacked,.base.control-placement-start-stacked{padding-block-start:var(--control-offset)}.base.control-placement-start{padding-inline-start:var(--control-offset)}.base.control-placement-end{padding-inline-end:var(--control-offset)}.base:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--focus-stroke-color, var(--vvd-color-cta-500)),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.base.tight{overflow:hidden;min-height:calc(var(--selectable-box-spacing, 16px) * 2 + 22px);padding:0}.base.selected{background-color:var(--selectable-box-checked-bg, var(--_appearance-color-fill))}.base.clickable{cursor:pointer}.control{position:absolute;inset-block-start:var(--selectable-box-spacing, 16px)}.control.start-stacked,.control.start{inset-inline-start:var(--selectable-box-spacing, 16px)}.control.end-stacked,.control.end{inset-inline-end:var(--selectable-box-spacing, 16px)}";
|
|
13
|
+
const styles = ":host{display:flex}.base.connotation-cta{--_connotation-color-firm-all: var(--vvd-selectable-box-cta-firm-all, var(--vvd-color-cta-600));--_connotation-color-pale: var(--vvd-selectable-box-cta-pale, var(--vvd-color-cta-300));--_connotation-color-fierce: var(--vvd-selectable-box-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-faint: var(--vvd-selectable-box-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-selectable-box-cta-soft, var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-firm-all: var(--vvd-selectable-box-accent-firm-all, var(--vvd-color-neutral-600));--_connotation-color-pale: var(--vvd-selectable-box-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-fierce: var(--vvd-selectable-box-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-selectable-box-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-selectable-box-accent-soft, var(--vvd-color-neutral-100))}.base{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-pale)}@media (hover: hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: var(--_connotation-color-pale)}@media (hover: hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}.base:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--vvd-color-neutral-100)}.base.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--vvd-color-neutral-100)}.base{--control-offset: calc(var(--selectable-box-spacing, 16px) + 36px)}.base{position:relative;padding:var(--selectable-box-spacing, 16px);border:1px solid var(--_appearance-color-outline);border-radius:8px;background-color:var(--_appearance-color-fill);inline-size:100%;text-align:start}.base.control-placement-end-stacked,.base.control-placement-start-stacked{padding-block-start:var(--control-offset)}.base.control-placement-start{padding-inline-start:var(--control-offset)}.base.control-placement-end{padding-inline-end:var(--control-offset)}.base:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--focus-stroke-color, var(--vvd-color-cta-500)),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.base.tight{overflow:hidden;min-height:calc(var(--selectable-box-spacing, 16px) * 2 + 22px);padding:0}.base.selected{background-color:var(--selectable-box-checked-bg, var(--_appearance-color-fill))}.base.clickable{cursor:pointer}.control{position:absolute;inset-block-start:var(--selectable-box-spacing, 16px)}.control.start-stacked,.control.start{inset-inline-start:var(--selectable-box-spacing, 16px)}.control.end-stacked,.control.end{inset-inline-end:var(--selectable-box-spacing, 16px)}";
|
|
14
14
|
|
|
15
15
|
var __defProp = Object.defineProperty;
|
|
16
16
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -28,11 +28,13 @@ class SelectableBox extends delegatesAria.DelegatesAria(vividElement.VividElemen
|
|
|
28
28
|
this.clickableBox = false;
|
|
29
29
|
this.controlPlacement = "end-stacked";
|
|
30
30
|
this.tight = false;
|
|
31
|
+
this.disabled = false;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* @internal
|
|
34
35
|
*/
|
|
35
36
|
_handleCheckedChange() {
|
|
37
|
+
if (this.disabled) return;
|
|
36
38
|
if (this.controlType === "radio" && this.checked) return;
|
|
37
39
|
this.checked = !this.checked;
|
|
38
40
|
if (this.clickableBox) this.$emit("change");
|
|
@@ -41,6 +43,7 @@ class SelectableBox extends delegatesAria.DelegatesAria(vividElement.VividElemen
|
|
|
41
43
|
* @internal
|
|
42
44
|
*/
|
|
43
45
|
_handleKeydown(event) {
|
|
46
|
+
if (this.disabled) return true;
|
|
44
47
|
if ((event.code === "Space" || event.code === "Enter") && this.clickableBox)
|
|
45
48
|
return this._handleCheckedChange();
|
|
46
49
|
return true;
|
|
@@ -64,13 +67,17 @@ __decorateClass([
|
|
|
64
67
|
__decorateClass([
|
|
65
68
|
fastElement.attr({ mode: "boolean" })
|
|
66
69
|
], SelectableBox.prototype, "tight");
|
|
70
|
+
__decorateClass([
|
|
71
|
+
fastElement.attr({ mode: "boolean" })
|
|
72
|
+
], SelectableBox.prototype, "disabled");
|
|
67
73
|
|
|
68
74
|
const getClasses = ({
|
|
69
75
|
connotation,
|
|
70
76
|
tight,
|
|
71
77
|
checked,
|
|
72
78
|
clickableBox,
|
|
73
|
-
controlPlacement
|
|
79
|
+
controlPlacement,
|
|
80
|
+
disabled
|
|
74
81
|
}) => fastWebUtilities.classNames(
|
|
75
82
|
"base",
|
|
76
83
|
[`connotation-${connotation}`, Boolean(connotation)],
|
|
@@ -78,7 +85,8 @@ const getClasses = ({
|
|
|
78
85
|
["selected", checked],
|
|
79
86
|
["clickable", clickableBox],
|
|
80
87
|
["readonly", !clickableBox],
|
|
81
|
-
[`control-placement-${controlPlacement}`, Boolean(controlPlacement)]
|
|
88
|
+
[`control-placement-${controlPlacement}`, Boolean(controlPlacement)],
|
|
89
|
+
["disabled", disabled]
|
|
82
90
|
);
|
|
83
91
|
function handleControlChange(x) {
|
|
84
92
|
if (!x.clickableBox) x._handleCheckedChange();
|
|
@@ -99,6 +107,7 @@ function checkbox(context) {
|
|
|
99
107
|
class="control checkbox ${(x) => x.controlPlacement}"
|
|
100
108
|
connotation="${(x) => x.connotation === "cta" ? enums.Connotation.CTA : enums.Connotation.Accent}"
|
|
101
109
|
:checked="${(x) => x.checked}"
|
|
110
|
+
?disabled="${(x) => x.disabled}"
|
|
102
111
|
inert="${(x) => x.clickableBox ? true : null}"
|
|
103
112
|
></${checkboxTag}>`
|
|
104
113
|
)} `;
|
|
@@ -119,6 +128,7 @@ function radio(context) {
|
|
|
119
128
|
class="control radio ${(x) => x.controlPlacement}"
|
|
120
129
|
connotation="${(x) => x.connotation === "cta" ? enums.Connotation.CTA : enums.Connotation.Accent}"
|
|
121
130
|
:checked="${(x) => x.checked}"
|
|
131
|
+
?disabled="${(x) => x.disabled}"
|
|
122
132
|
inert="${(x) => x.clickableBox ? true : null}"
|
|
123
133
|
></${radioTag}>`
|
|
124
134
|
)} `;
|
|
@@ -127,11 +137,12 @@ const SelectableBoxTemplate = (context) => {
|
|
|
127
137
|
return fastElement.html`<template>
|
|
128
138
|
<div
|
|
129
139
|
class="${getClasses}"
|
|
130
|
-
tabindex="${(x) => x.clickableBox ? "0" : null}"
|
|
140
|
+
tabindex="${(x) => x.clickableBox && !x.disabled ? "0" : null}"
|
|
131
141
|
${delegatesAria.delegateAria({
|
|
132
142
|
role: (x) => x.clickableBox ? "button" : null,
|
|
133
143
|
ariaPressed: (x) => x.clickableBox ? x.checked ? "true" : "false" : null,
|
|
134
|
-
ariaLabel: (x) => x.clickableBox ? x.ariaLabel : null
|
|
144
|
+
ariaLabel: (x) => x.clickableBox ? x.ariaLabel : null,
|
|
145
|
+
ariaDisabled: (x) => x.clickableBox && x.disabled ? "true" : null
|
|
135
146
|
})}
|
|
136
147
|
@keydown="${(x, c) => x._handleKeydown(c.event)}"
|
|
137
148
|
@click="${(x) => x.clickableBox ? x._handleCheckedChange() : null}"
|
|
@@ -6,7 +6,7 @@ import { D as DelegatesAria, d as delegateAria } from '../unbundled/delegates-ar
|
|
|
6
6
|
import { classNames } from '@microsoft/fast-web-utilities';
|
|
7
7
|
import { C as Connotation } from '../unbundled/enums.js';
|
|
8
8
|
|
|
9
|
-
const styles = ":host{display:flex}.base.connotation-cta{--_connotation-color-firm-all: var(--vvd-selectable-box-cta-firm-all, var(--vvd-color-cta-600));--_connotation-color-pale: var(--vvd-selectable-box-cta-pale, var(--vvd-color-cta-300));--_connotation-color-fierce: var(--vvd-selectable-box-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-faint: var(--vvd-selectable-box-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-selectable-box-cta-soft, var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-firm-all: var(--vvd-selectable-box-accent-firm-all, var(--vvd-color-neutral-600));--_connotation-color-pale: var(--vvd-selectable-box-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-fierce: var(--vvd-selectable-box-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-selectable-box-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-selectable-box-accent-soft, var(--vvd-color-neutral-100))}.base{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-pale)}@media (hover: hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: var(--_connotation-color-pale)}@media (hover: hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}.base{--control-offset: calc(var(--selectable-box-spacing, 16px) + 36px)}.base{position:relative;padding:var(--selectable-box-spacing, 16px);border:1px solid var(--_appearance-color-outline);border-radius:8px;background-color:var(--_appearance-color-fill);inline-size:100%;text-align:start}.base.control-placement-end-stacked,.base.control-placement-start-stacked{padding-block-start:var(--control-offset)}.base.control-placement-start{padding-inline-start:var(--control-offset)}.base.control-placement-end{padding-inline-end:var(--control-offset)}.base:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--focus-stroke-color, var(--vvd-color-cta-500)),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.base.tight{overflow:hidden;min-height:calc(var(--selectable-box-spacing, 16px) * 2 + 22px);padding:0}.base.selected{background-color:var(--selectable-box-checked-bg, var(--_appearance-color-fill))}.base.clickable{cursor:pointer}.control{position:absolute;inset-block-start:var(--selectable-box-spacing, 16px)}.control.start-stacked,.control.start{inset-inline-start:var(--selectable-box-spacing, 16px)}.control.end-stacked,.control.end{inset-inline-end:var(--selectable-box-spacing, 16px)}";
|
|
9
|
+
const styles = ":host{display:flex}.base.connotation-cta{--_connotation-color-firm-all: var(--vvd-selectable-box-cta-firm-all, var(--vvd-color-cta-600));--_connotation-color-pale: var(--vvd-selectable-box-cta-pale, var(--vvd-color-cta-300));--_connotation-color-fierce: var(--vvd-selectable-box-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-faint: var(--vvd-selectable-box-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-selectable-box-cta-soft, var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-firm-all: var(--vvd-selectable-box-accent-firm-all, var(--vvd-color-neutral-600));--_connotation-color-pale: var(--vvd-selectable-box-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-fierce: var(--vvd-selectable-box-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-selectable-box-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-selectable-box-accent-soft, var(--vvd-color-neutral-100))}.base{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-pale)}@media (hover: hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: var(--_connotation-color-pale)}@media (hover: hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}.base:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--vvd-color-neutral-100)}.base.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--vvd-color-neutral-100)}.base{--control-offset: calc(var(--selectable-box-spacing, 16px) + 36px)}.base{position:relative;padding:var(--selectable-box-spacing, 16px);border:1px solid var(--_appearance-color-outline);border-radius:8px;background-color:var(--_appearance-color-fill);inline-size:100%;text-align:start}.base.control-placement-end-stacked,.base.control-placement-start-stacked{padding-block-start:var(--control-offset)}.base.control-placement-start{padding-inline-start:var(--control-offset)}.base.control-placement-end{padding-inline-end:var(--control-offset)}.base:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--focus-stroke-color, var(--vvd-color-cta-500)),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.base.tight{overflow:hidden;min-height:calc(var(--selectable-box-spacing, 16px) * 2 + 22px);padding:0}.base.selected{background-color:var(--selectable-box-checked-bg, var(--_appearance-color-fill))}.base.clickable{cursor:pointer}.control{position:absolute;inset-block-start:var(--selectable-box-spacing, 16px)}.control.start-stacked,.control.start{inset-inline-start:var(--selectable-box-spacing, 16px)}.control.end-stacked,.control.end{inset-inline-end:var(--selectable-box-spacing, 16px)}";
|
|
10
10
|
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
12
12
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -24,11 +24,13 @@ class SelectableBox extends DelegatesAria(VividElement) {
|
|
|
24
24
|
this.clickableBox = false;
|
|
25
25
|
this.controlPlacement = "end-stacked";
|
|
26
26
|
this.tight = false;
|
|
27
|
+
this.disabled = false;
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
30
|
* @internal
|
|
30
31
|
*/
|
|
31
32
|
_handleCheckedChange() {
|
|
33
|
+
if (this.disabled) return;
|
|
32
34
|
if (this.controlType === "radio" && this.checked) return;
|
|
33
35
|
this.checked = !this.checked;
|
|
34
36
|
if (this.clickableBox) this.$emit("change");
|
|
@@ -37,6 +39,7 @@ class SelectableBox extends DelegatesAria(VividElement) {
|
|
|
37
39
|
* @internal
|
|
38
40
|
*/
|
|
39
41
|
_handleKeydown(event) {
|
|
42
|
+
if (this.disabled) return true;
|
|
40
43
|
if ((event.code === "Space" || event.code === "Enter") && this.clickableBox)
|
|
41
44
|
return this._handleCheckedChange();
|
|
42
45
|
return true;
|
|
@@ -60,13 +63,17 @@ __decorateClass([
|
|
|
60
63
|
__decorateClass([
|
|
61
64
|
attr({ mode: "boolean" })
|
|
62
65
|
], SelectableBox.prototype, "tight");
|
|
66
|
+
__decorateClass([
|
|
67
|
+
attr({ mode: "boolean" })
|
|
68
|
+
], SelectableBox.prototype, "disabled");
|
|
63
69
|
|
|
64
70
|
const getClasses = ({
|
|
65
71
|
connotation,
|
|
66
72
|
tight,
|
|
67
73
|
checked,
|
|
68
74
|
clickableBox,
|
|
69
|
-
controlPlacement
|
|
75
|
+
controlPlacement,
|
|
76
|
+
disabled
|
|
70
77
|
}) => classNames(
|
|
71
78
|
"base",
|
|
72
79
|
[`connotation-${connotation}`, Boolean(connotation)],
|
|
@@ -74,7 +81,8 @@ const getClasses = ({
|
|
|
74
81
|
["selected", checked],
|
|
75
82
|
["clickable", clickableBox],
|
|
76
83
|
["readonly", !clickableBox],
|
|
77
|
-
[`control-placement-${controlPlacement}`, Boolean(controlPlacement)]
|
|
84
|
+
[`control-placement-${controlPlacement}`, Boolean(controlPlacement)],
|
|
85
|
+
["disabled", disabled]
|
|
78
86
|
);
|
|
79
87
|
function handleControlChange(x) {
|
|
80
88
|
if (!x.clickableBox) x._handleCheckedChange();
|
|
@@ -95,6 +103,7 @@ function checkbox(context) {
|
|
|
95
103
|
class="control checkbox ${(x) => x.controlPlacement}"
|
|
96
104
|
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
97
105
|
:checked="${(x) => x.checked}"
|
|
106
|
+
?disabled="${(x) => x.disabled}"
|
|
98
107
|
inert="${(x) => x.clickableBox ? true : null}"
|
|
99
108
|
></${checkboxTag}>`
|
|
100
109
|
)} `;
|
|
@@ -115,6 +124,7 @@ function radio(context) {
|
|
|
115
124
|
class="control radio ${(x) => x.controlPlacement}"
|
|
116
125
|
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
117
126
|
:checked="${(x) => x.checked}"
|
|
127
|
+
?disabled="${(x) => x.disabled}"
|
|
118
128
|
inert="${(x) => x.clickableBox ? true : null}"
|
|
119
129
|
></${radioTag}>`
|
|
120
130
|
)} `;
|
|
@@ -123,11 +133,12 @@ const SelectableBoxTemplate = (context) => {
|
|
|
123
133
|
return html`<template>
|
|
124
134
|
<div
|
|
125
135
|
class="${getClasses}"
|
|
126
|
-
tabindex="${(x) => x.clickableBox ? "0" : null}"
|
|
136
|
+
tabindex="${(x) => x.clickableBox && !x.disabled ? "0" : null}"
|
|
127
137
|
${delegateAria({
|
|
128
138
|
role: (x) => x.clickableBox ? "button" : null,
|
|
129
139
|
ariaPressed: (x) => x.clickableBox ? x.checked ? "true" : "false" : null,
|
|
130
|
-
ariaLabel: (x) => x.clickableBox ? x.ariaLabel : null
|
|
140
|
+
ariaLabel: (x) => x.clickableBox ? x.ariaLabel : null,
|
|
141
|
+
ariaDisabled: (x) => x.clickableBox && x.disabled ? "true" : null
|
|
131
142
|
})}
|
|
132
143
|
@keydown="${(x, c) => x._handleKeydown(c.event)}"
|
|
133
144
|
@click="${(x) => x.clickableBox ? x._handleCheckedChange() : null}"
|