@vonage/vivid 3.36.0 → 3.38.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/accordion/index.js +3 -4
- package/accordion-item/index.js +3 -2
- package/alert/index.js +5 -4
- package/avatar/index.js +1 -1
- package/badge/index.js +2 -1
- package/banner/index.js +4 -3
- package/breadcrumb/index.js +0 -1
- package/breadcrumb-item/index.js +3 -2
- package/button/index.js +4 -3
- package/card/index.js +2 -3
- package/checkbox/index.js +3 -4
- package/combobox/index.js +7 -8
- package/custom-elements.json +386 -758
- package/data-grid/index.js +2 -3
- package/date-picker/index.js +10 -9
- package/date-range-picker/index.js +36 -0
- package/dialog/index.js +6 -7
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -3
- package/fab/index.js +4 -3
- package/file-picker/index.js +6 -4
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +44 -42
- package/layout/index.js +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/date-picker/date-picker.d.ts +5 -15
- package/lib/date-range-picker/date-range-picker.d.ts +16 -0
- package/lib/date-range-picker/definition.d.ts +3 -0
- package/lib/file-picker/file-picker.d.ts +8 -5
- package/lib/file-picker/file-picker.form-associated.d.ts +10 -0
- package/lib/file-picker/locale.d.ts +6 -0
- package/lib/number-field/number-field.d.ts +6 -2
- package/lib/tag-group/tag-group.d.ts +1 -0
- package/lib/tree-item/tree-item.template.d.ts +1 -1
- package/listbox/index.js +4 -5
- package/locales/en-GB.js +27 -3
- package/locales/en-US.js +27 -3
- package/locales/ja-JP.js +25 -1
- package/locales/zh-CN.js +25 -1
- package/menu/index.js +8 -9
- package/menu-item/index.js +4 -5
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +4 -3
- package/nav-item/index.js +4 -3
- package/note/index.js +3 -2
- package/number-field/index.js +6 -5
- package/option/index.js +4 -3
- package/package.json +1 -1
- package/pagination/index.js +5 -5
- package/popup/index.js +6 -5
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +2 -3
- package/select/index.js +8 -9
- package/shared/affix.js +5 -1
- package/shared/apply-mixins.js +1 -1
- package/shared/children.js +2 -2
- package/shared/date-picker/calendar/dateRange.d.ts +5 -0
- package/shared/date-picker/calendar/presentationDateRange.d.ts +5 -0
- package/shared/date-picker/date-picker-base.d.ts +20 -0
- package/shared/date-picker/date-picker-base.form-associated.d.ts +10 -0
- package/shared/date-picker/date-picker-base.template.d.ts +4 -0
- package/{lib → shared}/date-picker/locale.d.ts +6 -0
- package/shared/definition.js +5 -5
- package/shared/definition10.js +9 -14
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +3 -3
- package/shared/definition14.js +3 -3
- package/shared/definition15.js +5 -5
- package/shared/definition16.js +4 -5
- package/shared/definition17.js +59 -6016
- package/shared/definition18.js +350 -213
- package/shared/definition19.js +251 -67
- package/shared/definition2.js +2 -3
- package/shared/definition20.js +66 -58
- package/shared/definition21.js +43 -83
- package/shared/definition22.js +75 -2298
- package/shared/definition23.js +2361 -45
- package/shared/definition24.js +63 -27
- package/shared/definition25.js +24 -51
- package/shared/definition26.js +36 -806
- package/shared/definition27.js +820 -49
- package/shared/definition28.js +52 -89
- package/shared/definition29.js +88 -24
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +25 -12
- package/shared/definition31.js +12 -53
- package/shared/definition32.js +29 -441
- package/shared/definition33.js +427 -197
- package/shared/definition34.js +260 -174
- package/shared/definition35.js +187 -69
- package/shared/definition36.js +68 -55
- package/shared/definition37.js +61 -422
- package/shared/definition38.js +435 -35
- package/shared/definition39.js +30 -679
- package/shared/definition4.js +3 -3
- package/shared/definition40.js +661 -77
- package/shared/definition41.js +77 -557
- package/shared/definition42.js +559 -106
- package/shared/definition43.js +105 -136
- package/shared/definition44.js +153 -17
- package/shared/definition45.js +16 -79
- package/shared/definition46.js +53 -475
- package/shared/definition47.js +506 -20
- package/shared/definition48.js +22 -121
- package/shared/definition49.js +115 -262
- package/shared/definition5.js +2 -2
- package/shared/definition50.js +248 -120
- package/shared/definition51.js +139 -123
- package/shared/definition52.js +84 -74
- package/shared/definition53.js +114 -70
- package/shared/definition54.js +81 -292
- package/shared/definition55.js +302 -13
- package/shared/definition56.js +11 -41
- package/shared/definition57.js +20 -154
- package/shared/definition58.js +181 -0
- package/shared/definition6.js +5 -5
- package/shared/definition7.js +4 -4
- package/shared/definition8.js +3 -3
- package/shared/definition9.js +1 -2
- package/shared/index.js +1 -1
- package/shared/index2.js +1 -1
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +3 -1
- package/shared/localized.js +9 -0
- package/shared/patterns/affix.d.ts +3 -1
- package/shared/presentationDate.js +6133 -0
- package/shared/ref.js +1 -1
- package/shared/slotted.js +73 -3
- package/shared/text-anchor.template.js +4 -4
- package/shared/text-field.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +4 -3
- package/style.css +265 -197
- package/styles/core/all.css +44 -13
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +44 -13
- 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/switch/index.js +4 -3
- package/tab/index.js +4 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +6 -7
- package/tag/index.js +4 -3
- package/tag-group/index.js +1 -1
- package/text-anchor/index.js +1 -0
- package/text-area/index.js +4 -3
- package/text-field/index.js +4 -5
- package/toggletip/index.js +7 -6
- package/tooltip/index.js +7 -6
- package/tree-item/index.js +4 -5
- package/tree-view/index.js +1 -2
- package/vivid.api.json +105 -0
- package/lib/date-picker/date-picker.template.d.ts +0 -4
- package/shared/node-observation.js +0 -74
- /package/{lib → shared}/date-picker/calendar/calendarGrid.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/dateStr.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/month.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/monthPickerGrid.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/presentationDate.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/year.d.ts +0 -0
package/shared/definition43.js
CHANGED
|
@@ -1,106 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as iconRegistries } from './
|
|
3
|
-
import { f as focusRegistries } from './
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import './affix.js';
|
|
1
|
+
import { a as attr, F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { a as iconRegistries } from './definition25.js';
|
|
3
|
+
import { f as focusRegistries } from './definition56.js';
|
|
4
|
+
import { A as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
|
|
5
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
7
6
|
import { f as focusTemplateFactory } from './focus2.js';
|
|
8
|
-
import './
|
|
9
|
-
import { w as when } from './when.js';
|
|
7
|
+
import { r as ref } from './ref.js';
|
|
10
8
|
import { c as classNames } from './class-names.js';
|
|
11
9
|
|
|
12
|
-
class _Switch extends FoundationElement {
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(Switch:class)} component.
|
|
16
|
-
*
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.proxy = document.createElement("input");
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* A Switch Custom HTML Element.
|
|
28
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
|
|
29
|
-
*
|
|
30
|
-
* @slot - The deafult slot for the label
|
|
31
|
-
* @slot checked-message - The message when in a checked state
|
|
32
|
-
* @slot unchecked-message - The message when in an unchecked state
|
|
33
|
-
* @csspart label - The label
|
|
34
|
-
* @csspart switch - The element representing the switch, which wraps the indicator
|
|
35
|
-
* @csspart status-message - The wrapper for the status messages
|
|
36
|
-
* @csspart checked-message - The checked message
|
|
37
|
-
* @csspart unchecked-message - The unchecked message
|
|
38
|
-
* @fires change - Emits a custom change event when the checked state changes
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
let Switch$1 = class Switch extends FormAssociatedSwitch {
|
|
43
|
-
constructor() {
|
|
44
|
-
super();
|
|
45
|
-
/**
|
|
46
|
-
* The element's value to be included in form submission when checked.
|
|
47
|
-
* Default to "on" to reach parity with input[type="checkbox"]
|
|
48
|
-
*
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
this.initialValue = "on";
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
this.keypressHandler = (e) => {
|
|
56
|
-
if (this.readOnly) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
switch (e.key) {
|
|
60
|
-
case keyEnter:
|
|
61
|
-
case keySpace:
|
|
62
|
-
this.checked = !this.checked;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
|
-
this.clickHandler = (e) => {
|
|
70
|
-
if (!this.disabled && !this.readOnly) {
|
|
71
|
-
this.checked = !this.checked;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
this.proxy.setAttribute("type", "checkbox");
|
|
75
|
-
}
|
|
76
|
-
readOnlyChanged() {
|
|
77
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
78
|
-
this.proxy.readOnly = this.readOnly;
|
|
79
|
-
}
|
|
80
|
-
this.readOnly
|
|
81
|
-
? this.classList.add("readonly")
|
|
82
|
-
: this.classList.remove("readonly");
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* @internal
|
|
86
|
-
*/
|
|
87
|
-
checkedChanged(prev, next) {
|
|
88
|
-
super.checkedChanged(prev, next);
|
|
89
|
-
/**
|
|
90
|
-
* @deprecated - this behavior already exists in the template and should not exist in the class.
|
|
91
|
-
*/
|
|
92
|
-
this.checked ? this.classList.add("checked") : this.classList.remove("checked");
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
__decorate([
|
|
96
|
-
attr({ attribute: "readonly", mode: "boolean" })
|
|
97
|
-
], Switch$1.prototype, "readOnly", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
observable
|
|
100
|
-
], Switch$1.prototype, "defaultSlottedNodes", void 0);
|
|
101
|
-
|
|
102
|
-
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 13 Sep 2023 10:58:27 GMT\n */\n.control {\n display: inline-flex;\n gap: 8px;\n}\n.control.connotation-cta {\n /* @cssprop [--vvd-switch-cta-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-cta-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-switch-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-switch-cta-primary-increment=var(--vvd-color-cta-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-cta-primary-increment, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-backdrop=var(--vvd-color-cta-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-cta-backdrop, var(--vvd-color-cta-50));\n /* @cssprop [--vvd-switch-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-switch-cta-firm, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-intermediate=var(--vvd-color-cta-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-cta-intermediate, var(--vvd-color-cta-500));\n}\n.control.connotation-alert {\n /* @cssprop [--vvd-switch-alert-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-alert-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-switch-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-switch-alert-primary-increment=var(--vvd-color-alert-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-alert-primary-increment, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-backdrop=var(--vvd-color-alert-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-alert-backdrop, var(--vvd-color-alert-50));\n /* @cssprop [--vvd-switch-alert-firm=var(--vvd-color-alert-600)] */\n --_connotation-color-firm: var(--vvd-switch-alert-firm, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-intermediate=var(--vvd-color-alert-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-alert-intermediate, var(--vvd-color-alert-500));\n}\n.control.connotation-success {\n /* @cssprop [--vvd-switch-success-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-success-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-switch-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-switch-success-primary-increment=var(--vvd-color-success-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-success-primary-increment, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-backdrop=var(--vvd-color-success-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-success-backdrop, var(--vvd-color-success-50));\n /* @cssprop [--vvd-switch-success-firm=var(--vvd-color-success-600)] */\n --_connotation-color-firm: var(--vvd-switch-success-firm, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-intermediate=var(--vvd-color-success-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-success-intermediate, var(--vvd-color-success-500));\n}\n.control:not(.connotation-cta, .connotation-alert, .connotation-success) {\n /* @cssprop [--vvd-switch-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-switch-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-switch-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-switch-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-switch-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-switch-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-accent-intermediate, var(--vvd-color-neutral-500));\n}\n.control {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.control.appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.control:where(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: transparent;\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n@supports selector(:focus-visible) {\n .control:focus-visible {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .control {\n user-select: none;\n }\n}\n.control:not(.disabled) {\n cursor: pointer;\n}\n.control.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.switch {\n --_switch-inline-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) * 1.8);\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n border-radius: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / .5);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n inline-size: var(--_switch-inline-size);\n transition: all 0.2s ease-in-out 0s;\n}\n\n.checked-indicator {\n --_switch-checked-indicator-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / 1.6667);\n --_switch-gutter: calc(var(--_switch-checked-indicator-size) / 3);\n block-size: var(--_switch-checked-indicator-size);\n border-radius: inherit;\n inline-size: var(--_switch-checked-indicator-size);\n margin-inline-start: auto;\n transition: all 0.2s ease-in-out 0s;\n}\n.control.appearance-filled .checked-indicator {\n background-color: var(--vvd-color-neutral-100);\n}\n.control:not(.appearance-filled) .checked-indicator {\n background-color: var(--_appearance-color-outline);\n}\n.control:not(.checked) .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-inline-size) + var(--_switch-checked-indicator-size) + var(--_switch-gutter)));\n}\n.control.checked .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-gutter)));\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n\n.focus-indicator {\n --focus-inset: -4px;\n --focus-stroke-gap-color: transparent;\n border-radius: 14px;\n}\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}";
|
|
103
|
-
|
|
104
10
|
var __defProp = Object.defineProperty;
|
|
105
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
106
12
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -112,56 +18,119 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
112
18
|
__defProp(target, key, result);
|
|
113
19
|
return result;
|
|
114
20
|
};
|
|
115
|
-
class
|
|
21
|
+
class SplitButton extends FoundationElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.splitIndicator = "chevron-down-line";
|
|
25
|
+
this.disabled = false;
|
|
26
|
+
this.ariaLabel = null;
|
|
27
|
+
this.ariaExpanded = null;
|
|
28
|
+
}
|
|
29
|
+
get action() {
|
|
30
|
+
return this._action;
|
|
31
|
+
}
|
|
32
|
+
get indicator() {
|
|
33
|
+
return this._indicator;
|
|
34
|
+
}
|
|
116
35
|
}
|
|
117
36
|
__decorateClass([
|
|
118
37
|
attr
|
|
119
|
-
],
|
|
38
|
+
], SplitButton.prototype, "connotation", 2);
|
|
39
|
+
__decorateClass([
|
|
40
|
+
attr
|
|
41
|
+
], SplitButton.prototype, "shape", 2);
|
|
120
42
|
__decorateClass([
|
|
121
43
|
attr
|
|
122
|
-
],
|
|
44
|
+
], SplitButton.prototype, "appearance", 2);
|
|
45
|
+
__decorateClass([
|
|
46
|
+
attr
|
|
47
|
+
], SplitButton.prototype, "size", 2);
|
|
48
|
+
__decorateClass([
|
|
49
|
+
attr
|
|
50
|
+
], SplitButton.prototype, "label", 2);
|
|
51
|
+
__decorateClass([
|
|
52
|
+
attr
|
|
53
|
+
], SplitButton.prototype, "icon", 2);
|
|
54
|
+
__decorateClass([
|
|
55
|
+
attr({ attribute: "split-indicator", mode: "fromView" })
|
|
56
|
+
], SplitButton.prototype, "splitIndicator", 2);
|
|
57
|
+
__decorateClass([
|
|
58
|
+
attr({ attribute: "disabled", mode: "boolean" })
|
|
59
|
+
], SplitButton.prototype, "disabled", 2);
|
|
60
|
+
__decorateClass([
|
|
61
|
+
attr({ attribute: "aria-label" })
|
|
62
|
+
], SplitButton.prototype, "ariaLabel", 2);
|
|
63
|
+
__decorateClass([
|
|
64
|
+
attr({ attribute: "aria-expanded" })
|
|
65
|
+
], SplitButton.prototype, "ariaExpanded", 2);
|
|
66
|
+
applyMixins(SplitButton, AffixIcon);
|
|
123
67
|
|
|
124
|
-
const getClasses = (_) => classNames(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
68
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Fri, 13 Oct 2023 14:45:50 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n display: inline-flex;\n justify-content: flex-start;\n inline-size: inherit;\n}\n\n.control,\n.indicator {\n position: relative;\n display: inline-flex;\n box-sizing: border-box;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n padding: 0;\n border: 1px solid var(--_appearance-color-outline);\n margin: 0;\n background-color: var(--_appearance-color-fill);\n block-size: var(--_split-button-block-size);\n color: var(--_appearance-color-text);\n vertical-align: middle;\n}\n.control.connotation-cta,\n.indicator.connotation-cta {\n /* @cssprop [--vvd-split-button-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-split-button-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-split-button-cta-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-split-button-cta-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-split-button-cta-primary-increment=var(--vvd-color-cta-600)] */\n --_connotation-color-primary-increment: var(--vvd-split-button-cta-primary-increment, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-split-button-cta-contrast=var(--vvd-color-cta-800)] */\n --_connotation-color-contrast: var(--vvd-split-button-cta-contrast, var(--vvd-color-cta-800));\n /* @cssprop [--vvd-split-button-cta-fierce=var(--vvd-color-cta-700)] */\n --_connotation-color-fierce: var(--vvd-split-button-cta-fierce, var(--vvd-color-cta-700));\n /* @cssprop [--vvd-split-button-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-split-button-cta-firm, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-split-button-cta-soft=var(--vvd-color-cta-100)] */\n --_connotation-color-soft: var(--vvd-split-button-cta-soft, var(--vvd-color-cta-100));\n /* @cssprop [--vvd-split-button-cta-faint=var(--vvd-color-cta-50)] */\n --_connotation-color-faint: var(--vvd-split-button-cta-faint, var(--vvd-color-cta-50));\n}\n.control:not(.connotation-cta),\n.indicator:not(.connotation-cta) {\n /* @cssprop [--vvd-split-button-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-split-button-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-split-button-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-split-button-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-split-button-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-split-button-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-split-button-accent-contrast=var(--vvd-color-neutral-800)] */\n --_connotation-color-contrast: var(--vvd-split-button-accent-contrast, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-split-button-accent-fierce=var(--vvd-color-neutral-700)] */\n --_connotation-color-fierce: var(--vvd-split-button-accent-fierce, var(--vvd-color-neutral-700));\n /* @cssprop [--vvd-split-button-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-split-button-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-split-button-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-split-button-accent-soft, var(--vvd-color-neutral-100));\n /* @cssprop [--vvd-split-button-accent-faint=var(--vvd-color-neutral-50)] */\n --_connotation-color-faint: var(--vvd-split-button-accent-faint, var(--vvd-color-neutral-50));\n}\n.control.appearance-filled,\n.indicator.appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control.appearance-outlined,\n.indicator.appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control,\n.indicator {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled,\n.indicator:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-outlined,\n.indicator:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)),\n.indicator:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled).appearance-filled,\n.indicator:where(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled).appearance-outlined,\n.indicator:where(:disabled, .disabled).appearance-outlined {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.control:where(:disabled, .disabled),\n.indicator:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.control:where(:active, .active):where(:not(:disabled, .disabled)).appearance-filled,\n.indicator:where(:active, .active):where(:not(:disabled, .disabled)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-fierce);\n --_appearance-color-outline: transparent;\n}\n.control:where(:active, .active):where(:not(:disabled, .disabled)).appearance-outlined,\n.indicator:where(:active, .active):where(:not(:disabled, .disabled)).appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:active, .active):where(:not(:disabled, .disabled)),\n.indicator:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n@supports (user-select: none) {\n .control,\n .indicator {\n user-select: none;\n }\n}\n\n.control {\n border-inline-end: 0;\n gap: var(--_split-button-icon-gap);\n isolation: isolate;\n /* Disabled */\n /* shape */\n /* size */\n}\n.control:focus-visible {\n outline: none;\n}\n.control:not(:disabled) {\n cursor: pointer;\n}\n.control:disabled {\n cursor: not-allowed;\n}\n.control.icon-only {\n contain: size;\n place-content: center;\n}\n@supports (aspect-ratio: 1) {\n .control.icon-only {\n aspect-ratio: 1;\n }\n}\n@supports not (aspect-ratio: 1) {\n .control.icon-only {\n inline-size: var(--_split-button-block-size);\n }\n}\n.control:not(.icon-only) {\n flex-grow: 1;\n inline-size: inherit;\n}\n.control:not(.shape-pill) {\n border-radius: 6px 0 0 6px;\n}\n.control.shape-pill {\n border-radius: 24px 0 0 24px;\n}\n.control.size-super-condensed {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n font: var(--vvd-typography-base-condensed-bold);\n}\n.control.size-super-condensed:not(.icon-only) {\n --_split-button-icon-gap: 4px;\n padding-inline: 8px;\n}\n.control.size-condensed {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n font: var(--vvd-typography-base-condensed-bold);\n}\n.control.size-condensed:not(.icon-only) {\n --_split-button-icon-gap: 8px;\n padding-inline: 12px;\n}\n.control.size-expanded {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8));\n font: var(--vvd-typography-base-extended-bold);\n}\n.control.size-expanded:not(.icon-only) {\n --_split-button-icon-gap: 10px;\n padding-inline: 20px;\n}\n.control:not(.size-condensed, .size-expanded, .size-super-condensed) {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n font: var(--vvd-typography-base-bold);\n}\n.control:not(.size-condensed, .size-expanded, .size-super-condensed):not(.icon-only) {\n --_split-button-icon-gap: 8px;\n padding-inline: 16px;\n}\n.control .text {\n overflow: hidden;\n max-inline-size: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.indicator {\n border-inline-start: 0;\n inline-size: var(--_split-button-inline-size);\n /* Disabled */\n /* Shape */\n /* size */\n}\n.indicator:focus-visible {\n outline: none;\n}\n.indicator:not(:disabled) {\n cursor: pointer;\n}\n.indicator:disabled {\n cursor: not-allowed;\n}\n.indicator:not(.shape-pill) {\n border-radius: 0 6px 6px 0;\n}\n.indicator.shape-pill {\n border-radius: 0 24px 24px 0;\n}\n.indicator::before {\n position: absolute;\n background-color: var(--_appearance-color-text);\n content: \"\";\n inline-size: 1px;\n inset-inline-start: 0;\n opacity: 0.35;\n}\n.indicator:not(.appearance-filled, .appearance-outlined)::before {\n block-size: 50%;\n}\n.indicator:is(.appearance-filled, .appearance-outlined)::before {\n block-size: 100%;\n}\n.indicator.size-super-condensed {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n --_split-button-inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n font: var(--vvd-typography-base-condensed);\n}\n.indicator.size-condensed {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n --_split-button-inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 12));\n font: var(--vvd-typography-base-condensed);\n}\n.indicator.size-expanded {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8));\n --_split-button-inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n font: var(--vvd-typography-base-extended);\n}\n.indicator:not(.size-condensed, .size-expanded, .size-super-condensed) {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n --_split-button-inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n font: var(--vvd-typography-base-extended);\n}\n\n/* Icon */\n.icon {\n line-height: 1;\n}\n.icon-trailing .icon {\n order: 1;\n}\n.control > .icon {\n font-size: calc(var(--_split-button-block-size) / 2);\n}\n\n/* Focus */\n:not(:focus-visible) > .focus-indicator {\n display: none;\n}\n.control:not(.appearance-filled) .focus-indicator, .indicator:not(.appearance-filled) .focus-indicator {\n --focus-stroke-gap-color: transparent;\n}\n.control.appearance-outlined .focus-indicator, .indicator.appearance-outlined .focus-indicator {\n --focus-inset: -1px;\n}";
|
|
69
|
+
|
|
70
|
+
const getClasses = ({
|
|
71
|
+
connotation,
|
|
72
|
+
appearance,
|
|
73
|
+
shape,
|
|
74
|
+
disabled,
|
|
75
|
+
size
|
|
76
|
+
}) => classNames(
|
|
77
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
78
|
+
["disabled", disabled],
|
|
79
|
+
[`shape-${shape}`, Boolean(shape)],
|
|
80
|
+
[`appearance-${appearance}`, Boolean(appearance)],
|
|
81
|
+
[`size-${size}`, Boolean(size)]
|
|
131
82
|
);
|
|
132
|
-
|
|
83
|
+
function actionButton(context) {
|
|
84
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
85
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
86
|
+
return html`
|
|
87
|
+
<button
|
|
88
|
+
${ref("_action")}
|
|
89
|
+
class="control ${getClasses} ${(x) => !x.label && !!x.icon ? "icon-only" : ""}"
|
|
90
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
91
|
+
?disabled="${(x) => x.disabled}"
|
|
92
|
+
aria-disabled="${(x) => x.disabled}">
|
|
93
|
+
${() => focusTemplate}
|
|
94
|
+
${(x) => affixIconTemplate(x.icon)}
|
|
95
|
+
<span class="text">${(x) => x.label}</span>
|
|
96
|
+
</button>
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
function indicatorButton(context) {
|
|
100
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
133
101
|
const focusTemplate = focusTemplateFactory(context);
|
|
134
102
|
return html`
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
103
|
+
<button
|
|
104
|
+
${ref("_indicator")}
|
|
105
|
+
class="indicator ${getClasses}"
|
|
106
|
+
?disabled="${(x) => x.disabled}"
|
|
107
|
+
aria-disabled="${(x) => x.disabled}"
|
|
108
|
+
aria-label="Open for more actions"
|
|
109
|
+
aria-haspopup="true"
|
|
110
|
+
aria-expanded="${(x) => x.ariaExpanded}">
|
|
111
|
+
${() => focusTemplate}
|
|
112
|
+
${(x) => affixIconTemplate(x.splitIndicator)}
|
|
113
|
+
</button>
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
116
|
+
const SplitButtonTemplate = (context) => {
|
|
117
|
+
return html`
|
|
118
|
+
<div class="base" role="group">
|
|
119
|
+
${actionButton(context)}
|
|
120
|
+
${indicatorButton(context)}
|
|
121
|
+
<slot></slot>
|
|
122
|
+
</div>`;
|
|
154
123
|
};
|
|
155
124
|
|
|
156
|
-
const
|
|
157
|
-
baseName: "
|
|
158
|
-
template:
|
|
125
|
+
const splitButtonDefinition = SplitButton.compose({
|
|
126
|
+
baseName: "split-button",
|
|
127
|
+
template: SplitButtonTemplate,
|
|
159
128
|
styles,
|
|
160
129
|
shadowOptions: {
|
|
161
130
|
delegatesFocus: true
|
|
162
131
|
}
|
|
163
132
|
});
|
|
164
|
-
const
|
|
165
|
-
const
|
|
133
|
+
const splitButtonRegistries = [splitButtonDefinition(), ...iconRegistries, ...focusRegistries];
|
|
134
|
+
const registerSplitButton = registerFactory(splitButtonRegistries);
|
|
166
135
|
|
|
167
|
-
export {
|
|
136
|
+
export { splitButtonRegistries as a, registerSplitButton as r, splitButtonDefinition as s };
|
package/shared/definition44.js
CHANGED
|
@@ -1,31 +1,167 @@
|
|
|
1
|
-
import { F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { a as iconRegistries } from './definition25.js';
|
|
3
|
+
import { f as focusRegistries } from './definition56.js';
|
|
4
|
+
import { C as CheckableFormAssociated } from './form-associated.js';
|
|
5
|
+
import { a as keySpace, k as keyEnter } from './key-codes.js';
|
|
6
|
+
import './affix.js';
|
|
7
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
8
|
+
import './index2.js';
|
|
9
|
+
import { w as when } from './when.js';
|
|
10
|
+
import { c as classNames } from './class-names.js';
|
|
11
|
+
|
|
12
|
+
class _Switch extends FoundationElement {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(Switch:class)} component.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.proxy = document.createElement("input");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
2
25
|
|
|
3
26
|
/**
|
|
4
|
-
* A
|
|
27
|
+
* A Switch Custom HTML Element.
|
|
28
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
|
|
5
29
|
*
|
|
6
|
-
* @slot - The
|
|
30
|
+
* @slot - The deafult slot for the label
|
|
31
|
+
* @slot checked-message - The message when in a checked state
|
|
32
|
+
* @slot unchecked-message - The message when in an unchecked state
|
|
33
|
+
* @csspart label - The label
|
|
34
|
+
* @csspart switch - The element representing the switch, which wraps the indicator
|
|
35
|
+
* @csspart status-message - The wrapper for the status messages
|
|
36
|
+
* @csspart checked-message - The checked message
|
|
37
|
+
* @csspart unchecked-message - The unchecked message
|
|
38
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
7
39
|
*
|
|
8
40
|
* @public
|
|
9
41
|
*/
|
|
10
|
-
let
|
|
42
|
+
let Switch$1 = class Switch extends FormAssociatedSwitch {
|
|
43
|
+
constructor() {
|
|
44
|
+
super();
|
|
45
|
+
/**
|
|
46
|
+
* The element's value to be included in form submission when checked.
|
|
47
|
+
* Default to "on" to reach parity with input[type="checkbox"]
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
this.initialValue = "on";
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
this.keypressHandler = (e) => {
|
|
56
|
+
if (this.readOnly) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
switch (e.key) {
|
|
60
|
+
case keyEnter:
|
|
61
|
+
case keySpace:
|
|
62
|
+
this.checked = !this.checked;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
this.clickHandler = (e) => {
|
|
70
|
+
if (!this.disabled && !this.readOnly) {
|
|
71
|
+
this.checked = !this.checked;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
75
|
+
}
|
|
76
|
+
readOnlyChanged() {
|
|
77
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
78
|
+
this.proxy.readOnly = this.readOnly;
|
|
79
|
+
}
|
|
80
|
+
this.readOnly
|
|
81
|
+
? this.classList.add("readonly")
|
|
82
|
+
: this.classList.remove("readonly");
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
checkedChanged(prev, next) {
|
|
88
|
+
super.checkedChanged(prev, next);
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated - this behavior already exists in the template and should not exist in the class.
|
|
91
|
+
*/
|
|
92
|
+
this.checked ? this.classList.add("checked") : this.classList.remove("checked");
|
|
93
|
+
}
|
|
11
94
|
};
|
|
95
|
+
__decorate([
|
|
96
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
97
|
+
], Switch$1.prototype, "readOnly", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
observable
|
|
100
|
+
], Switch$1.prototype, "defaultSlottedNodes", void 0);
|
|
101
|
+
|
|
102
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Fri, 13 Oct 2023 14:45:50 GMT\n */\n:host(.disabled) {\n cursor: not-allowed;\n}\n\n.control {\n display: inline-flex;\n gap: 8px;\n}\n.control.connotation-cta {\n /* @cssprop [--vvd-switch-cta-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-cta-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-switch-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-switch-cta-primary-increment=var(--vvd-color-cta-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-cta-primary-increment, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-backdrop=var(--vvd-color-cta-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-cta-backdrop, var(--vvd-color-cta-50));\n /* @cssprop [--vvd-switch-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-switch-cta-firm, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-intermediate=var(--vvd-color-cta-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-cta-intermediate, var(--vvd-color-cta-500));\n}\n.control.connotation-alert {\n /* @cssprop [--vvd-switch-alert-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-alert-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-switch-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-switch-alert-primary-increment=var(--vvd-color-alert-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-alert-primary-increment, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-backdrop=var(--vvd-color-alert-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-alert-backdrop, var(--vvd-color-alert-50));\n /* @cssprop [--vvd-switch-alert-firm=var(--vvd-color-alert-600)] */\n --_connotation-color-firm: var(--vvd-switch-alert-firm, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-intermediate=var(--vvd-color-alert-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-alert-intermediate, var(--vvd-color-alert-500));\n}\n.control.connotation-success {\n /* @cssprop [--vvd-switch-success-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-success-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-switch-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-switch-success-primary-increment=var(--vvd-color-success-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-success-primary-increment, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-backdrop=var(--vvd-color-success-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-success-backdrop, var(--vvd-color-success-50));\n /* @cssprop [--vvd-switch-success-firm=var(--vvd-color-success-600)] */\n --_connotation-color-firm: var(--vvd-switch-success-firm, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-intermediate=var(--vvd-color-success-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-success-intermediate, var(--vvd-color-success-500));\n}\n.control:not(.connotation-cta, .connotation-alert, .connotation-success) {\n /* @cssprop [--vvd-switch-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-switch-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-switch-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-switch-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-switch-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-switch-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-accent-intermediate, var(--vvd-color-neutral-500));\n}\n.control {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.control.appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.control:where(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: transparent;\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n@supports selector(:focus-visible) {\n .control:focus-visible {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .control {\n user-select: none;\n }\n}\n.control:not(.disabled) {\n cursor: pointer;\n}\n.control.disabled {\n pointer-events: none;\n}\n\n.switch {\n --_switch-inline-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) * 1.8);\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n border-radius: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / .5);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n inline-size: var(--_switch-inline-size);\n transition: all 0.2s ease-in-out 0s;\n}\n\n.checked-indicator {\n --_switch-checked-indicator-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / 1.6667);\n --_switch-gutter: calc(var(--_switch-checked-indicator-size) / 3);\n block-size: var(--_switch-checked-indicator-size);\n border-radius: inherit;\n inline-size: var(--_switch-checked-indicator-size);\n margin-inline-start: auto;\n transition: all 0.2s ease-in-out 0s;\n}\n.control.appearance-filled .checked-indicator {\n background-color: var(--vvd-color-neutral-100);\n}\n.control:not(.appearance-filled) .checked-indicator {\n background-color: var(--_appearance-color-outline);\n}\n.control:not(.checked) .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-inline-size) + var(--_switch-checked-indicator-size) + var(--_switch-gutter)));\n}\n.control.checked .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-gutter)));\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n\n.focus-indicator {\n --focus-inset: -4px;\n --focus-stroke-gap-color: transparent;\n border-radius: 14px;\n}\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}";
|
|
12
103
|
|
|
13
|
-
|
|
104
|
+
var __defProp = Object.defineProperty;
|
|
105
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
106
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
107
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
108
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
109
|
+
if (decorator = decorators[i])
|
|
110
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
111
|
+
if (kind && result)
|
|
112
|
+
__defProp(target, key, result);
|
|
113
|
+
return result;
|
|
114
|
+
};
|
|
115
|
+
class Switch extends Switch$1 {
|
|
14
116
|
}
|
|
117
|
+
__decorateClass([
|
|
118
|
+
attr
|
|
119
|
+
], Switch.prototype, "label", 2);
|
|
120
|
+
__decorateClass([
|
|
121
|
+
attr
|
|
122
|
+
], Switch.prototype, "connotation", 2);
|
|
15
123
|
|
|
16
|
-
|
|
124
|
+
const getClasses = (_) => classNames(
|
|
125
|
+
"control",
|
|
126
|
+
["appearance-filled", _.checked && !_.disabled && !_.readOnly],
|
|
127
|
+
["checked", _.checked],
|
|
128
|
+
["disabled", _.disabled],
|
|
129
|
+
["readonly", _.readOnly],
|
|
130
|
+
[`connotation-${_.connotation}`, Boolean(_.checked) && Boolean(_.connotation)]
|
|
131
|
+
);
|
|
132
|
+
const SwitchTemplate = (context) => {
|
|
133
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
17
134
|
return html`
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
135
|
+
<div
|
|
136
|
+
class="${getClasses}"
|
|
137
|
+
role="switch"
|
|
138
|
+
aria-checked="${(x) => x.checked}"
|
|
139
|
+
aria-disabled="${(x) => x.disabled}"
|
|
140
|
+
aria-readonly="${(x) => x.readOnly}"
|
|
141
|
+
tabindex="${(x) => x.disabled ? null : 0}"
|
|
142
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
143
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
144
|
+
>
|
|
145
|
+
<div class="switch">
|
|
146
|
+
<span class="checked-indicator"></span>
|
|
147
|
+
${() => focusTemplate}
|
|
148
|
+
</div>
|
|
149
|
+
${when((x) => x.label, html`<div class="label">
|
|
150
|
+
${(x) => x.label}
|
|
151
|
+
</div>`)}
|
|
152
|
+
</div>
|
|
153
|
+
`;
|
|
154
|
+
};
|
|
23
155
|
|
|
24
|
-
const
|
|
25
|
-
baseName: "
|
|
26
|
-
template:
|
|
156
|
+
const switchDefinition = Switch.compose({
|
|
157
|
+
baseName: "switch",
|
|
158
|
+
template: SwitchTemplate,
|
|
159
|
+
styles,
|
|
160
|
+
shadowOptions: {
|
|
161
|
+
delegatesFocus: true
|
|
162
|
+
}
|
|
27
163
|
});
|
|
28
|
-
const
|
|
29
|
-
const
|
|
164
|
+
const switchRegistries = [switchDefinition(), ...iconRegistries, ...focusRegistries];
|
|
165
|
+
const registerSwitch = registerFactory(switchRegistries);
|
|
30
166
|
|
|
31
|
-
export {
|
|
167
|
+
export { switchRegistries as a, registerSwitch as r, switchDefinition as s };
|
package/shared/definition45.js
CHANGED
|
@@ -1,94 +1,31 @@
|
|
|
1
|
-
import { F as FoundationElement,
|
|
2
|
-
import { a as iconRegistries } from './definition24.js';
|
|
3
|
-
import { f as focusRegistries } from './definition55.js';
|
|
4
|
-
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
5
|
-
import { a as applyMixins } from './apply-mixins.js';
|
|
6
|
-
import { f as focusTemplateFactory } from './focus2.js';
|
|
7
|
-
import { c as classNames } from './class-names.js';
|
|
1
|
+
import { F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
8
2
|
|
|
9
3
|
/**
|
|
10
|
-
* A
|
|
4
|
+
* A TabPanel Component to be used with {@link @microsoft/fast-foundation#(Tabs:class)}
|
|
11
5
|
*
|
|
12
|
-
* @slot - The default slot for the
|
|
6
|
+
* @slot - The default slot for the tabpanel content
|
|
13
7
|
*
|
|
14
8
|
* @public
|
|
15
9
|
*/
|
|
16
|
-
let
|
|
10
|
+
let TabPanel$1 = class TabPanel extends FoundationElement {
|
|
17
11
|
};
|
|
18
|
-
__decorate([
|
|
19
|
-
attr({ mode: "boolean" })
|
|
20
|
-
], Tab$1.prototype, "disabled", void 0);
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var __defProp = Object.defineProperty;
|
|
25
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
26
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
27
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
28
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
29
|
-
if (decorator = decorators[i])
|
|
30
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
31
|
-
if (kind && result)
|
|
32
|
-
__defProp(target, key, result);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
class Tab extends Tab$1 {
|
|
36
|
-
constructor() {
|
|
37
|
-
super(...arguments);
|
|
38
|
-
this.tabIndex = "-1";
|
|
39
|
-
this.ariaSelected = null;
|
|
40
|
-
}
|
|
13
|
+
class TabPanel extends TabPanel$1 {
|
|
41
14
|
}
|
|
42
|
-
__decorateClass([
|
|
43
|
-
attr
|
|
44
|
-
], Tab.prototype, "connotation", 2);
|
|
45
|
-
__decorateClass([
|
|
46
|
-
attr
|
|
47
|
-
], Tab.prototype, "shape", 2);
|
|
48
|
-
__decorateClass([
|
|
49
|
-
attr
|
|
50
|
-
], Tab.prototype, "label", 2);
|
|
51
|
-
__decorateClass([
|
|
52
|
-
attr({ mode: "fromView" })
|
|
53
|
-
], Tab.prototype, "tabIndex", 2);
|
|
54
|
-
__decorateClass([
|
|
55
|
-
attr({ attribute: "aria-selected" })
|
|
56
|
-
], Tab.prototype, "ariaSelected", 2);
|
|
57
|
-
applyMixins(Tab, AffixIconWithTrailing);
|
|
58
15
|
|
|
59
|
-
|
|
60
|
-
connotation,
|
|
61
|
-
disabled,
|
|
62
|
-
ariaSelected,
|
|
63
|
-
iconTrailing,
|
|
64
|
-
shape
|
|
65
|
-
}) => classNames(
|
|
66
|
-
"base",
|
|
67
|
-
[`connotation-${connotation}`, Boolean(connotation) && ariaSelected === "true"],
|
|
68
|
-
[`shape-${shape}`, Boolean(shape)],
|
|
69
|
-
["disabled", Boolean(disabled)],
|
|
70
|
-
["selected", ariaSelected === "true"],
|
|
71
|
-
["icon-trailing", iconTrailing]
|
|
72
|
-
);
|
|
73
|
-
function TabTemplate(context) {
|
|
74
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
75
|
-
const focusTemplate = focusTemplateFactory(context);
|
|
16
|
+
function TabPanelTemplate() {
|
|
76
17
|
return html`
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
${(x) => x.label}
|
|
82
|
-
</div>
|
|
83
|
-
</template>`;
|
|
18
|
+
<template slot="tabpanel" role="tabpanel">
|
|
19
|
+
<slot></slot>
|
|
20
|
+
</template>
|
|
21
|
+
`;
|
|
84
22
|
}
|
|
85
23
|
|
|
86
|
-
const
|
|
87
|
-
baseName: "tab",
|
|
88
|
-
template:
|
|
89
|
-
styles
|
|
24
|
+
const tabPanelDefinition = TabPanel.compose({
|
|
25
|
+
baseName: "tab-panel",
|
|
26
|
+
template: TabPanelTemplate
|
|
90
27
|
});
|
|
91
|
-
const
|
|
92
|
-
const
|
|
28
|
+
const tabPanelRegistries = [tabPanelDefinition()];
|
|
29
|
+
const registerTabPanel = registerFactory(tabPanelRegistries);
|
|
93
30
|
|
|
94
|
-
export {
|
|
31
|
+
export { tabPanelRegistries as a, registerTabPanel as r, tabPanelDefinition as t };
|