@vonage/vivid 3.0.0-next.119 → 3.0.0-next.120
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/README.md +11 -6
- package/accordion/index.js +4 -51
- package/accordion-item/index.js +11 -109
- package/action-group/index.js +4 -36
- package/avatar/index.js +8 -64
- package/badge/index.js +9 -48
- package/banner/index.js +15 -117
- package/breadcrumb/index.js +5 -97
- package/breadcrumb-item/index.js +14 -53
- package/button/index.js +14 -92
- package/calendar/index.js +5 -1520
- package/calendar-event/index.js +7 -107
- package/card/index.js +10 -117
- package/checkbox/index.js +13 -175
- package/custom-elements.json +1827 -8
- package/dialog/index.js +14 -227
- package/divider/index.js +4 -25
- package/elevation/index.js +4 -24
- package/fab/index.js +13 -89
- package/focus/index.js +4 -17
- package/header/index.js +7 -12
- package/icon/index.js +7 -28
- package/index.js +49 -55
- package/layout/index.js +4 -42
- package/lib/accordion/definition.d.ts +3 -0
- package/lib/accordion/index.d.ts +1 -2
- package/lib/accordion-item/definition.d.ts +3 -0
- package/lib/accordion-item/index.d.ts +1 -2
- package/lib/action-group/definition.d.ts +3 -0
- package/lib/action-group/index.d.ts +1 -2
- package/lib/avatar/definition.d.ts +3 -0
- package/lib/avatar/index.d.ts +1 -2
- package/lib/badge/definition.d.ts +3 -0
- package/lib/badge/index.d.ts +1 -2
- package/lib/banner/definition.d.ts +3 -0
- package/lib/banner/index.d.ts +1 -2
- package/lib/breadcrumb/definition.d.ts +3 -0
- package/lib/breadcrumb/index.d.ts +1 -2
- package/lib/breadcrumb-item/definition.d.ts +3 -0
- package/lib/breadcrumb-item/index.d.ts +1 -2
- package/lib/button/definition.d.ts +3 -0
- package/lib/calendar/definition.d.ts +3 -0
- package/lib/calendar/index.d.ts +1 -2
- package/lib/calendar-event/definition.d.ts +3 -0
- package/lib/calendar-event/index.d.ts +1 -2
- package/lib/card/definition.d.ts +3 -0
- package/lib/card/index.d.ts +1 -2
- package/lib/checkbox/definition.d.ts +3 -0
- package/lib/checkbox/index.d.ts +1 -2
- package/lib/components.d.ts +38 -38
- package/lib/dialog/definition.d.ts +3 -0
- package/lib/dialog/index.d.ts +1 -2
- package/lib/divider/definition.d.ts +3 -0
- package/lib/divider/index.d.ts +1 -2
- package/lib/elevation/definition.d.ts +3 -0
- package/lib/elevation/index.d.ts +1 -2
- package/lib/fab/definition.d.ts +3 -0
- package/lib/fab/index.d.ts +1 -2
- package/lib/focus/definition.d.ts +3 -0
- package/lib/focus/index.d.ts +1 -2
- package/lib/header/definition.d.ts +3 -0
- package/lib/header/index.d.ts +1 -2
- package/lib/icon/definition.d.ts +3 -0
- package/lib/icon/index.d.ts +1 -2
- package/lib/layout/definition.d.ts +3 -0
- package/lib/layout/index.d.ts +1 -2
- package/lib/listbox/definition.d.ts +3 -0
- package/lib/menu/definition.d.ts +7 -0
- package/lib/menu/index.d.ts +1 -10
- package/lib/menu-item/definition.d.ts +3 -0
- package/lib/menu-item/index.d.ts +1 -2
- package/lib/nav/definition.d.ts +3 -0
- package/lib/nav/index.d.ts +1 -2
- package/lib/nav-disclosure/definition.d.ts +3 -0
- package/lib/nav-disclosure/index.d.ts +1 -2
- package/lib/nav-item/definition.d.ts +3 -0
- package/lib/nav-item/index.d.ts +1 -2
- package/lib/note/definition.d.ts +3 -0
- package/lib/note/index.d.ts +1 -2
- package/lib/number-field/definition.d.ts +3 -0
- package/lib/number-field/index.d.ts +1 -2
- package/lib/option/definition.d.ts +3 -0
- package/lib/option/index.d.ts +1 -2
- package/lib/popup/definition.d.ts +4 -0
- package/lib/popup/index.d.ts +1 -2
- package/lib/progress/definition.d.ts +3 -0
- package/lib/progress/index.d.ts +1 -2
- package/lib/progress-ring/definition.d.ts +3 -0
- package/lib/progress-ring/index.d.ts +1 -2
- package/lib/radio/definition.d.ts +3 -0
- package/lib/radio/index.d.ts +1 -2
- package/lib/radio-group/definition.d.ts +7 -0
- package/lib/radio-group/index.d.ts +1 -10
- package/lib/side-drawer/definition.d.ts +3 -0
- package/lib/side-drawer/index.d.ts +1 -2
- package/lib/slider/definition.d.ts +3 -0
- package/lib/slider/index.d.ts +1 -2
- package/lib/switch/definition.d.ts +3 -0
- package/lib/switch/index.d.ts +1 -2
- package/lib/text-anchor/definition.d.ts +3 -0
- package/lib/text-anchor/index.d.ts +1 -2
- package/lib/text-area/definition.d.ts +3 -0
- package/lib/text-area/index.d.ts +1 -2
- package/lib/text-field/definition.d.ts +3 -0
- package/lib/text-field/index.d.ts +1 -2
- package/lib/tooltip/definition.d.ts +3 -0
- package/lib/tooltip/index.d.ts +1 -2
- package/listbox/index.js +18 -1080
- package/menu/index.js +27 -354
- package/menu-item/index.js +11 -81
- package/nav/index.js +3 -16
- package/nav-disclosure/index.js +13 -77
- package/nav-item/index.js +13 -35
- package/note/index.js +13 -60
- package/number-field/index.js +14 -16
- package/option/index.js +13 -68
- package/package.json +2 -2
- package/popup/index.js +17 -55
- package/progress/index.js +6 -92
- package/progress-ring/index.js +6 -75
- package/radio/index.js +8 -48
- package/radio-group/index.js +9 -433
- package/shared/anchor.js +1 -1
- package/shared/apply-mixins.js +1 -1
- package/shared/base-progress.js +1 -1
- package/shared/breadcrumb-item.js +1 -1
- package/shared/button.js +195 -18
- package/shared/calendar-event.js +1 -1
- package/shared/definition.js +53 -0
- package/shared/definition10.js +99 -0
- package/shared/definition11.js +48 -0
- package/shared/definition12.js +1523 -0
- package/shared/definition13.js +111 -0
- package/shared/definition14.js +114 -0
- package/shared/definition15.js +32 -0
- package/shared/definition16.js +172 -0
- package/shared/definition17.js +223 -0
- package/shared/{divider.js → definition18.js} +25 -2
- package/shared/definition19.js +87 -0
- package/shared/definition2.js +106 -0
- package/shared/definition20.js +44 -0
- package/shared/definition21.js +1078 -0
- package/shared/{listbox-option.js → definition22.js} +71 -11
- package/shared/definition23.js +348 -0
- package/shared/{popup.js → definition24.js} +46 -3
- package/shared/{menu-item.js → definition25.js} +87 -13
- package/shared/definition26.js +18 -0
- package/shared/definition27.js +75 -0
- package/shared/definition28.js +31 -0
- package/shared/definition29.js +56 -0
- package/shared/definition3.js +29 -0
- package/shared/definition30.js +94 -0
- package/shared/definition31.js +77 -0
- package/shared/definition32.js +45 -0
- package/shared/definition33.js +435 -0
- package/shared/definition34.js +86 -0
- package/shared/definition35.js +592 -0
- package/shared/definition36.js +147 -0
- package/shared/definition37.js +279 -0
- package/shared/definition38.js +119 -0
- package/shared/definition39.js +77 -0
- package/shared/definition4.js +19 -0
- package/shared/definition5.js +38 -0
- package/shared/definition6.js +60 -0
- package/shared/definition7.js +45 -0
- package/shared/definition8.js +113 -0
- package/shared/definition9.js +107 -0
- package/shared/design-system/index.d.ts +1 -2
- package/shared/es.object.assign.js +58 -1
- package/shared/es.regexp.to-string.js +2 -1
- package/shared/focus.js +3 -9
- package/shared/focus2.js +9 -3
- package/shared/form-associated.js +1 -1
- package/shared/form-elements.js +2 -2
- package/shared/icon.js +1096 -9
- package/shared/index.js +385 -2501
- package/shared/patterns/form-elements/form-elements.d.ts +2 -2
- package/shared/radio.js +1 -1
- package/shared/ref.js +1 -1
- package/shared/slotted.js +1 -1
- package/shared/string-trim.js +2 -1
- package/shared/text-anchor.template.js +1 -1
- package/shared/to-string.js +51 -0
- package/side-drawer/index.js +5 -84
- package/slider/index.js +14 -593
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/switch/index.js +13 -149
- package/text-anchor/index.js +8 -7
- package/text-area/index.js +16 -282
- package/text-field/index.js +14 -121
- package/tooltip/index.js +24 -82
- package/vivid.api.json +1640 -850
- package/shared/button2.js +0 -200
- package/shared/elevation.js +0 -10
- package/shared/es.promise.resolve.js +0 -944
- package/shared/index2.js +0 -9
- package/shared/utils/index.d.ts +0 -1
package/switch/index.js
CHANGED
|
@@ -1,153 +1,17 @@
|
|
|
1
|
-
import '../shared/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { C as CheckableFormAssociated } from '../shared/form-associated.js';
|
|
5
|
-
import { a as keySpace, k as keyEnter } from '../shared/key-codes.js';
|
|
6
|
-
import '../shared/affix.js';
|
|
7
|
-
import { f as focusTemplateFactory } from '../shared/focus.js';
|
|
1
|
+
import { r as registerSwitch } from '../shared/definition36.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition3.js';
|
|
8
4
|
import '../shared/icon.js';
|
|
9
|
-
import
|
|
10
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
11
|
-
import '../shared/focus2.js';
|
|
5
|
+
import '../shared/to-string.js';
|
|
12
6
|
import '../shared/string-trim.js';
|
|
13
7
|
import '../shared/_has.js';
|
|
8
|
+
import '../shared/when.js';
|
|
9
|
+
import '../shared/class-names.js';
|
|
10
|
+
import '../shared/definition4.js';
|
|
11
|
+
import '../shared/focus.js';
|
|
12
|
+
import '../shared/form-associated.js';
|
|
13
|
+
import '../shared/key-codes.js';
|
|
14
|
+
import '../shared/affix.js';
|
|
15
|
+
import '../shared/focus2.js';
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(Switch:class)} component.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.proxy = document.createElement("input");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* A Switch Custom HTML Element.
|
|
31
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
|
|
32
|
-
*
|
|
33
|
-
* @slot - The deafult slot for the label
|
|
34
|
-
* @slot checked-message - The message when in a checked state
|
|
35
|
-
* @slot unchecked-message - The message when in an unchecked state
|
|
36
|
-
* @csspart label - The label
|
|
37
|
-
* @csspart switch - The element representing the switch, which wraps the indicator
|
|
38
|
-
* @csspart status-message - The wrapper for the status messages
|
|
39
|
-
* @csspart checked-message - The checked message
|
|
40
|
-
* @csspart unchecked-message - The unchecked message
|
|
41
|
-
* @fires change - Emits a custom change event when the checked state changes
|
|
42
|
-
*
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
class Switch$1 extends FormAssociatedSwitch {
|
|
46
|
-
constructor() {
|
|
47
|
-
super();
|
|
48
|
-
/**
|
|
49
|
-
* The element's value to be included in form submission when checked.
|
|
50
|
-
* Default to "on" to reach parity with input[type="checkbox"]
|
|
51
|
-
*
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
this.initialValue = "on";
|
|
55
|
-
/**
|
|
56
|
-
* @internal
|
|
57
|
-
*/
|
|
58
|
-
this.keypressHandler = (e) => {
|
|
59
|
-
if (this.readOnly) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
switch (e.key) {
|
|
63
|
-
case keyEnter:
|
|
64
|
-
case keySpace:
|
|
65
|
-
this.checked = !this.checked;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
this.clickHandler = (e) => {
|
|
73
|
-
if (!this.disabled && !this.readOnly) {
|
|
74
|
-
this.checked = !this.checked;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
this.proxy.setAttribute("type", "checkbox");
|
|
78
|
-
}
|
|
79
|
-
readOnlyChanged() {
|
|
80
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
81
|
-
this.proxy.readOnly = this.readOnly;
|
|
82
|
-
}
|
|
83
|
-
this.readOnly
|
|
84
|
-
? this.classList.add("readonly")
|
|
85
|
-
: this.classList.remove("readonly");
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
checkedChanged(prev, next) {
|
|
91
|
-
super.checkedChanged(prev, next);
|
|
92
|
-
/**
|
|
93
|
-
* @deprecated - this behavior already exists in the template and should not exist in the class.
|
|
94
|
-
*/
|
|
95
|
-
this.checked ? this.classList.add("checked") : this.classList.remove("checked");
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
__decorate([
|
|
99
|
-
attr({ attribute: "readonly", mode: "boolean" })
|
|
100
|
-
], Switch$1.prototype, "readOnly", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
observable
|
|
103
|
-
], Switch$1.prototype, "defaultSlottedNodes", void 0);
|
|
104
|
-
|
|
105
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 14 Dec 2022 14:20:57 GMT\n */\n.control {\n display: inline-flex;\n gap: 8px;\n}\n.control.connotation-cta {\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-cta-500);\n --_connotation-color-primary-increment: var(--vvd-color-cta-600);\n --_connotation-color-backdrop: var(--vvd-color-cta-50);\n --_connotation-color-firm: var(--vvd-color-cta-600);\n --_connotation-color-intermediate: var(--vvd-color-cta-500);\n}\n.control.connotation-alert {\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-primary-increment: var(--vvd-color-alert-600);\n --_connotation-color-backdrop: var(--vvd-color-alert-50);\n --_connotation-color-firm: var(--vvd-color-alert-600);\n --_connotation-color-intermediate: var(--vvd-color-alert-500);\n}\n.control.connotation-success {\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-primary-increment: var(--vvd-color-success-600);\n --_connotation-color-backdrop: var(--vvd-color-success-50);\n --_connotation-color-firm: var(--vvd-color-success-600);\n --_connotation-color-intermediate: var(--vvd-color-success-500);\n}\n.control:not(.connotation-cta, .connotation-alert, .connotation-success) {\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-increment: var(--vvd-color-neutral-800);\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\n --_connotation-color-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-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.control:where(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-500);\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 {\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}\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}";
|
|
106
|
-
|
|
107
|
-
class Switch extends Switch$1 {}
|
|
108
|
-
__decorate([attr, __metadata("design:type", String)], Switch.prototype, "label", void 0);
|
|
109
|
-
__decorate([attr, __metadata("design:type", String)], Switch.prototype, "connotation", void 0);
|
|
110
|
-
|
|
111
|
-
let _2 = t => t,
|
|
112
|
-
_t,
|
|
113
|
-
_t2;
|
|
114
|
-
const getClasses = _ => classNames('control', ['appearance-filled', _.checked && !_.disabled && !_.readOnly], ['checked', _.checked], ['disabled', _.disabled], ['readonly', _.readOnly], [`connotation-${_.connotation}`, Boolean(_.checked) && Boolean(_.connotation)]);
|
|
115
|
-
const SwitchTemplate = context => {
|
|
116
|
-
const focusTemplate = focusTemplateFactory(context);
|
|
117
|
-
return html(_t || (_t = _2`
|
|
118
|
-
<div
|
|
119
|
-
class="${0}"
|
|
120
|
-
role="switch"
|
|
121
|
-
aria-checked="${0}"
|
|
122
|
-
aria-disabled="${0}"
|
|
123
|
-
aria-readonly="${0}"
|
|
124
|
-
tabindex="${0}"
|
|
125
|
-
@keypress="${0}"
|
|
126
|
-
@click="${0}"
|
|
127
|
-
>
|
|
128
|
-
<div class="switch">
|
|
129
|
-
<span class="checked-indicator"></span>
|
|
130
|
-
${0}
|
|
131
|
-
</div>
|
|
132
|
-
${0}
|
|
133
|
-
</div>
|
|
134
|
-
`), getClasses, x => x.checked, x => x.disabled, x => x.readOnly, x => x.disabled ? null : 0, (x, c) => x.keypressHandler(c.event), (x, c) => x.clickHandler(c.event), () => focusTemplate, when(x => x.label, html(_t2 || (_t2 = _2`<div class="label">
|
|
135
|
-
${0}
|
|
136
|
-
</div>`), x => x.label)));
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const prefix = getPrefix(import.meta.url);
|
|
140
|
-
const vividSwitch = Switch.compose({
|
|
141
|
-
baseName: 'switch',
|
|
142
|
-
template: SwitchTemplate,
|
|
143
|
-
styles: css_248z,
|
|
144
|
-
shadowOptions: {
|
|
145
|
-
delegatesFocus: true
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
(async () => {
|
|
149
|
-
await loadComponentsModules(['icon', 'focus'], prefix);
|
|
150
|
-
designSystem.withPrefix(prefix).register(vividSwitch());
|
|
151
|
-
})();
|
|
152
|
-
|
|
153
|
-
export { vividSwitch };
|
|
17
|
+
registerSwitch();
|
package/text-anchor/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as registerFactorial } from '../shared/index.js';
|
|
2
2
|
import { T as TextAnchor } from '../shared/text-anchor.js';
|
|
3
3
|
import { t as textAnchorTemplate } from '../shared/text-anchor.template.js';
|
|
4
4
|
import '../shared/affix.js';
|
|
5
5
|
import '../shared/icon.js';
|
|
6
|
-
import '../shared/
|
|
6
|
+
import '../shared/to-string.js';
|
|
7
7
|
import '../shared/string-trim.js';
|
|
8
8
|
import '../shared/_has.js';
|
|
9
9
|
import '../shared/anchor.js';
|
|
@@ -11,14 +11,15 @@ import '../shared/apply-mixins.js';
|
|
|
11
11
|
import '../shared/aria-global.js';
|
|
12
12
|
import '../shared/start-end.js';
|
|
13
13
|
import '../shared/ref.js';
|
|
14
|
-
import '../shared/focus.js';
|
|
15
14
|
import '../shared/focus2.js';
|
|
15
|
+
import '../shared/focus.js';
|
|
16
16
|
import '../shared/class-names.js';
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const textAnchor = TextAnchor.compose({
|
|
19
19
|
baseName: 'text-anchor',
|
|
20
20
|
template: textAnchorTemplate
|
|
21
|
-
});
|
|
22
|
-
|
|
21
|
+
})();
|
|
22
|
+
const textAnchorElements = [textAnchor];
|
|
23
|
+
const registerTextAnchor = registerFactorial(textAnchorElements);
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
registerTextAnchor();
|
package/text-area/index.js
CHANGED
|
@@ -1,288 +1,22 @@
|
|
|
1
|
-
import '../shared/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import '../shared/affix.js';
|
|
5
|
-
import '../shared/focus2.js';
|
|
6
|
-
import { D as DelegatesARIATextbox, f as formElements, g as getFeedbackTemplate } from '../shared/form-elements.js';
|
|
7
|
-
import { a as applyMixins } from '../shared/apply-mixins.js';
|
|
8
|
-
import { F as FormAssociated } from '../shared/form-associated.js';
|
|
9
|
-
import { f as focusTemplateFactory } from '../shared/focus.js';
|
|
10
|
-
import { w as when } from '../shared/when.js';
|
|
11
|
-
import { r as ref } from '../shared/ref.js';
|
|
12
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
1
|
+
import { r as registerTextArea } from '../shared/definition37.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition3.js';
|
|
13
4
|
import '../shared/icon.js';
|
|
5
|
+
import '../shared/to-string.js';
|
|
14
6
|
import '../shared/string-trim.js';
|
|
15
7
|
import '../shared/_has.js';
|
|
8
|
+
import '../shared/when.js';
|
|
9
|
+
import '../shared/class-names.js';
|
|
10
|
+
import '../shared/definition4.js';
|
|
11
|
+
import '../shared/focus.js';
|
|
12
|
+
import '../shared/affix.js';
|
|
13
|
+
import '../shared/form-elements.js';
|
|
14
|
+
import '../shared/apply-mixins.js';
|
|
15
|
+
import '../shared/form-associated.js';
|
|
16
|
+
import '../shared/key-codes.js';
|
|
16
17
|
import '../shared/aria-global.js';
|
|
17
18
|
import '../shared/start-end.js';
|
|
18
|
-
import '../shared/
|
|
19
|
-
|
|
20
|
-
class _TextArea extends FoundationElement {
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(TextArea:class)} component.
|
|
24
|
-
*
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
class FormAssociatedTextArea extends FormAssociated(_TextArea) {
|
|
28
|
-
constructor() {
|
|
29
|
-
super(...arguments);
|
|
30
|
-
this.proxy = document.createElement("textarea");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Resize mode for a TextArea
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
const TextAreaResize = {
|
|
39
|
-
/**
|
|
40
|
-
* No resize.
|
|
41
|
-
*/
|
|
42
|
-
none: "none",
|
|
43
|
-
/**
|
|
44
|
-
* Resize vertically and horizontally.
|
|
45
|
-
*/
|
|
46
|
-
both: "both",
|
|
47
|
-
/**
|
|
48
|
-
* Resize horizontally.
|
|
49
|
-
*/
|
|
50
|
-
horizontal: "horizontal",
|
|
51
|
-
/**
|
|
52
|
-
* Resize vertically.
|
|
53
|
-
*/
|
|
54
|
-
vertical: "vertical",
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* A Text Area Custom HTML Element.
|
|
59
|
-
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea | <textarea> element }.
|
|
60
|
-
*
|
|
61
|
-
* @slot - The default slot for the label
|
|
62
|
-
* @csspart label - The label
|
|
63
|
-
* @csspart root - The element wrapping the control
|
|
64
|
-
* @csspart control - The textarea element
|
|
65
|
-
* @fires change - Emits a custom 'change' event when the textarea emits a change event
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
class TextArea$1 extends FormAssociatedTextArea {
|
|
70
|
-
constructor() {
|
|
71
|
-
super(...arguments);
|
|
72
|
-
/**
|
|
73
|
-
* The resize mode of the element.
|
|
74
|
-
* @public
|
|
75
|
-
* @remarks
|
|
76
|
-
* HTML Attribute: resize
|
|
77
|
-
*/
|
|
78
|
-
this.resize = TextAreaResize.none;
|
|
79
|
-
/**
|
|
80
|
-
* Sizes the element horizontally by a number of character columns.
|
|
81
|
-
*
|
|
82
|
-
* @public
|
|
83
|
-
* @remarks
|
|
84
|
-
* HTML Attribute: cols
|
|
85
|
-
*/
|
|
86
|
-
this.cols = 20;
|
|
87
|
-
/**
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
this.handleTextInput = () => {
|
|
91
|
-
this.value = this.control.value;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
readOnlyChanged() {
|
|
95
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
96
|
-
this.proxy.readOnly = this.readOnly;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
autofocusChanged() {
|
|
100
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
101
|
-
this.proxy.autofocus = this.autofocus;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
listChanged() {
|
|
105
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
106
|
-
this.proxy.setAttribute("list", this.list);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
maxlengthChanged() {
|
|
110
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
111
|
-
this.proxy.maxLength = this.maxlength;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
minlengthChanged() {
|
|
115
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
116
|
-
this.proxy.minLength = this.minlength;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
spellcheckChanged() {
|
|
120
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
121
|
-
this.proxy.spellcheck = this.spellcheck;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Selects all the text in the text area
|
|
126
|
-
*
|
|
127
|
-
* @public
|
|
128
|
-
*/
|
|
129
|
-
select() {
|
|
130
|
-
this.control.select();
|
|
131
|
-
/**
|
|
132
|
-
* The select event does not permeate the shadow DOM boundary.
|
|
133
|
-
* This fn effectively proxies the select event,
|
|
134
|
-
* emitting a `select` event whenever the internal
|
|
135
|
-
* control emits a `select` event
|
|
136
|
-
*/
|
|
137
|
-
this.$emit("select");
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Change event handler for inner control.
|
|
141
|
-
* @remarks
|
|
142
|
-
* "Change" events are not `composable` so they will not
|
|
143
|
-
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
144
|
-
* the change event, emitting a `change` event whenever the internal
|
|
145
|
-
* control emits a `change` event
|
|
146
|
-
* @internal
|
|
147
|
-
*/
|
|
148
|
-
handleChange() {
|
|
149
|
-
this.$emit("change");
|
|
150
|
-
}
|
|
151
|
-
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
152
|
-
validate() {
|
|
153
|
-
super.validate(this.control);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
__decorate([
|
|
157
|
-
attr({ mode: "boolean" })
|
|
158
|
-
], TextArea$1.prototype, "readOnly", void 0);
|
|
159
|
-
__decorate([
|
|
160
|
-
attr
|
|
161
|
-
], TextArea$1.prototype, "resize", void 0);
|
|
162
|
-
__decorate([
|
|
163
|
-
attr({ mode: "boolean" })
|
|
164
|
-
], TextArea$1.prototype, "autofocus", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
attr({ attribute: "form" })
|
|
167
|
-
], TextArea$1.prototype, "formId", void 0);
|
|
168
|
-
__decorate([
|
|
169
|
-
attr
|
|
170
|
-
], TextArea$1.prototype, "list", void 0);
|
|
171
|
-
__decorate([
|
|
172
|
-
attr({ converter: nullableNumberConverter })
|
|
173
|
-
], TextArea$1.prototype, "maxlength", void 0);
|
|
174
|
-
__decorate([
|
|
175
|
-
attr({ converter: nullableNumberConverter })
|
|
176
|
-
], TextArea$1.prototype, "minlength", void 0);
|
|
177
|
-
__decorate([
|
|
178
|
-
attr
|
|
179
|
-
], TextArea$1.prototype, "name", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
attr
|
|
182
|
-
], TextArea$1.prototype, "placeholder", void 0);
|
|
183
|
-
__decorate([
|
|
184
|
-
attr({ converter: nullableNumberConverter, mode: "fromView" })
|
|
185
|
-
], TextArea$1.prototype, "cols", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
attr({ converter: nullableNumberConverter, mode: "fromView" })
|
|
188
|
-
], TextArea$1.prototype, "rows", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
attr({ mode: "boolean" })
|
|
191
|
-
], TextArea$1.prototype, "spellcheck", void 0);
|
|
192
|
-
__decorate([
|
|
193
|
-
observable
|
|
194
|
-
], TextArea$1.prototype, "defaultSlottedNodes", void 0);
|
|
195
|
-
applyMixins(TextArea$1, DelegatesARIATextbox);
|
|
196
|
-
|
|
197
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 14 Dec 2022 14:20:57 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n display: inline-grid;\n width: 100%;\n gap: 4px;\n grid-template-columns: 1fr max-content;\n}\n.base {\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.base.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base: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.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-500);\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-backdrop: var(--vvd-color-success-50);\n --_connotation-color-intermediate: var(--vvd-color-success-500);\n --_connotation-color-firm: var(--vvd-color-success-600);\n}\n.base.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-backdrop: var(--vvd-color-alert-50);\n --_connotation-color-intermediate: var(--vvd-color-alert-500);\n --_connotation-color-firm: var(--vvd-color-alert-600);\n}\n.base:not(.connotation-success, .connotation-alert) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n --_low-ink-color: var(--vvd-color-neutral-600);\n}\n.base.disabled {\n --_low-ink-color: var(--_appearance-color-text);\n pointer-events: none;\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n contain: inline-size;\n font: var(--vvd-typography-base);\n grid-column: 1/3;\n grid-row: 1;\n line-height: 20px;\n}\n\n.fieldset {\n position: relative;\n display: flex;\n align-items: center;\n border-radius: 6px;\n grid-column: 1/3;\n}\n\n.control {\n width: 100%;\n padding: 8px 16px;\n border: 0 none;\n background-color: var(--_appearance-color-fill);\n border-radius: inherit;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n font: var(--vvd-typography-base);\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n transition: box-shadow 0.2s, background-color 0.2s, color 0.2s;\n}\n.control:disabled {\n cursor: not-allowed;\n opacity: 1; /* 2. correct opacity on iOS */\n -webkit-text-fill-color: var(--_appearance-color-text); /* 1. sets text fill to current `color` for safari */\n}\n.control::placeholder, .control:disabled::placeholder {\n opacity: 1; /* 2. correct opacity on iOS */\n -webkit-text-fill-color: var(--_low-ink-color); /* 1. sets text fill to current `color` for safari */\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n\n.focus-indicator {\n --focus-stroke-gap-color: transparent;\n pointer-events: none;\n}\n.fieldset:not(:focus-visible, :focus-within) > .focus-indicator {\n display: none;\n}";
|
|
198
|
-
|
|
199
|
-
let TextArea = class TextArea extends TextArea$1 {};
|
|
200
|
-
__decorate([attr, __metadata("design:type", String)], TextArea.prototype, "wrap", void 0);
|
|
201
|
-
TextArea = __decorate([formElements], TextArea);
|
|
202
|
-
|
|
203
|
-
let _ = t => t,
|
|
204
|
-
_t,
|
|
205
|
-
_t2;
|
|
206
|
-
const getClasses = ({
|
|
207
|
-
value,
|
|
208
|
-
errorValidationMessage,
|
|
209
|
-
disabled,
|
|
210
|
-
placeholder,
|
|
211
|
-
readOnly,
|
|
212
|
-
successText
|
|
213
|
-
}) => classNames('base', ['readonly', readOnly], ['placeholder', Boolean(placeholder)], ['disabled', disabled], ['error connotation-alert', Boolean(errorValidationMessage)], ['has-value', Boolean(value)], ['success connotation-success', !!successText]);
|
|
214
|
-
function renderLabel() {
|
|
215
|
-
return html(_t || (_t = _`
|
|
216
|
-
<label for="control" class="label">
|
|
217
|
-
${0}
|
|
218
|
-
</label>`), x => x.label);
|
|
219
|
-
}
|
|
220
|
-
const TextAreaTemplate = context => {
|
|
221
|
-
const focusTemplate = focusTemplateFactory(context);
|
|
222
|
-
return html(_t2 || (_t2 = _`
|
|
223
|
-
<div class="${0}">
|
|
224
|
-
${0}
|
|
225
|
-
<div class="fieldset">
|
|
226
|
-
<textarea class="control"
|
|
227
|
-
?autofocus="${0}"
|
|
228
|
-
placeholder="${0}"
|
|
229
|
-
name="${0}"
|
|
230
|
-
maxlength="${0}"
|
|
231
|
-
rows="${0}"
|
|
232
|
-
cols="${0}"
|
|
233
|
-
wrap="${0}"
|
|
234
|
-
?readonly="${0}"
|
|
235
|
-
?required="${0}"
|
|
236
|
-
?spellcheck="${0}"
|
|
237
|
-
:value="${0}"
|
|
238
|
-
aria-atomic="${0}"
|
|
239
|
-
aria-busy="${0}"
|
|
240
|
-
aria-controls="${0}"
|
|
241
|
-
aria-current="${0}"
|
|
242
|
-
aria-describedby="${0}"
|
|
243
|
-
aria-details="${0}"
|
|
244
|
-
aria-disabled="${0}"
|
|
245
|
-
aria-errormessage="${0}"
|
|
246
|
-
aria-flowto="${0}"
|
|
247
|
-
aria-haspopup="${0}"
|
|
248
|
-
aria-hidden="${0}"
|
|
249
|
-
aria-invalid="${0}"
|
|
250
|
-
aria-keyshortcuts="${0}"
|
|
251
|
-
aria-label="${0}"
|
|
252
|
-
aria-labelledby="${0}"
|
|
253
|
-
aria-live="${0}"
|
|
254
|
-
aria-owns="${0}"
|
|
255
|
-
aria-relevant="${0}"
|
|
256
|
-
aria-roledescription="${0}"
|
|
257
|
-
@input="${0}"
|
|
258
|
-
@change="${0}"
|
|
259
|
-
${0}
|
|
260
|
-
>
|
|
261
|
-
</textarea>
|
|
262
|
-
${0}
|
|
263
|
-
</div>
|
|
264
|
-
${0}
|
|
265
|
-
${0}
|
|
266
|
-
${0}
|
|
267
|
-
</div>
|
|
268
|
-
`), getClasses, when(x => x.label, renderLabel()), x => x.autofocus, x => x.placeholder ? x.placeholder : null, x => x.name ? x.name : null, x => x.maxlength ? x.maxlength : null, x => x.rows ? x.rows : null, x => x.cols ? x.cols : null, x => x.wrap ? x.wrap : null, x => x.readOnly, x => x.required, x => x.spellcheck, x => x.value, x => x.ariaAtomic, x => x.ariaBusy, x => x.ariaControls, x => x.ariaCurrent, x => x.ariaDescribedby, x => x.ariaDetails, x => x.ariaDisabled, x => x.ariaErrormessage, x => x.ariaFlowto, x => x.ariaHaspopup, x => x.ariaHidden, x => x.ariaInvalid, x => x.ariaKeyshortcuts, x => x.ariaLabel, x => x.ariaLabelledby, x => x.ariaLive, x => x.ariaOwns, x => x.ariaRelevant, x => x.ariaRoledescription, x => x.handleTextInput(), x => x.handleChange(), ref('control'), () => focusTemplate, when(x => {
|
|
269
|
-
var _a;
|
|
270
|
-
return !x.successText && !x.errorValidationMessage && ((_a = x.helperText) === null || _a === void 0 ? void 0 : _a.length);
|
|
271
|
-
}, getFeedbackTemplate('helper', context)), when(x => !x.successText && x.errorValidationMessage, getFeedbackTemplate('error', context)), when(x => x.successText, getFeedbackTemplate('success', context)));
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
const prefix = getPrefix(import.meta.url);
|
|
275
|
-
const vividTextArea = TextArea.compose({
|
|
276
|
-
baseName: 'text-area',
|
|
277
|
-
template: TextAreaTemplate,
|
|
278
|
-
styles: css_248z,
|
|
279
|
-
shadowOptions: {
|
|
280
|
-
delegatesFocus: true
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
(async () => {
|
|
284
|
-
await loadComponentsModules(['icon', 'focus'], prefix);
|
|
285
|
-
designSystem.withPrefix(prefix).register(vividTextArea());
|
|
286
|
-
})();
|
|
19
|
+
import '../shared/ref.js';
|
|
20
|
+
import '../shared/focus2.js';
|
|
287
21
|
|
|
288
|
-
|
|
22
|
+
registerTextArea();
|
package/text-field/index.js
CHANGED
|
@@ -1,129 +1,22 @@
|
|
|
1
|
-
import '../shared/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import '../shared/
|
|
6
|
-
import { T as TextField$1, f as formElements, g as getFeedbackTemplate } from '../shared/form-elements.js';
|
|
7
|
-
import { a as applyMixins } from '../shared/apply-mixins.js';
|
|
8
|
-
import { f as focusTemplateFactory } from '../shared/focus.js';
|
|
9
|
-
import { w as when } from '../shared/when.js';
|
|
10
|
-
import { r as ref } from '../shared/ref.js';
|
|
11
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
1
|
+
import { r as registerTextField } from '../shared/definition38.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition4.js';
|
|
4
|
+
import '../shared/focus.js';
|
|
5
|
+
import '../shared/definition3.js';
|
|
12
6
|
import '../shared/icon.js';
|
|
7
|
+
import '../shared/to-string.js';
|
|
13
8
|
import '../shared/string-trim.js';
|
|
14
9
|
import '../shared/_has.js';
|
|
10
|
+
import '../shared/when.js';
|
|
11
|
+
import '../shared/class-names.js';
|
|
12
|
+
import '../shared/affix.js';
|
|
13
|
+
import '../shared/form-elements.js';
|
|
14
|
+
import '../shared/apply-mixins.js';
|
|
15
15
|
import '../shared/form-associated.js';
|
|
16
16
|
import '../shared/key-codes.js';
|
|
17
17
|
import '../shared/aria-global.js';
|
|
18
18
|
import '../shared/start-end.js';
|
|
19
|
+
import '../shared/ref.js';
|
|
20
|
+
import '../shared/focus2.js';
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
__decorate([attr, __metadata("design:type", String)], TextField.prototype, "appearance", void 0);
|
|
22
|
-
__decorate([attr, __metadata("design:type", String)], TextField.prototype, "shape", void 0);
|
|
23
|
-
__decorate([attr, __metadata("design:type", String)], TextField.prototype, "autoComplete", void 0);
|
|
24
|
-
TextField = __decorate([formElements], TextField);
|
|
25
|
-
applyMixins(TextField, AffixIcon);
|
|
26
|
-
|
|
27
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 14 Dec 2022 14:20:57 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n display: inline-grid;\n width: 100%;\n gap: 4px;\n grid-template-columns: min-content 1fr max-content;\n}\n.base {\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.base.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base: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.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-500);\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-backdrop: var(--vvd-color-success-50);\n --_connotation-color-intermediate: var(--vvd-color-success-500);\n --_connotation-color-firm: var(--vvd-color-success-600);\n}\n.base.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-backdrop: var(--vvd-color-alert-50);\n --_connotation-color-intermediate: var(--vvd-color-alert-500);\n --_connotation-color-firm: var(--vvd-color-alert-600);\n}\n.base:not(.connotation-success, .connotation-alert) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n --_low-ink-color: var(--vvd-color-neutral-600);\n}\n.base.disabled {\n --_low-ink-color: var(--_appearance-color-text);\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n contain: inline-size;\n font: var(--vvd-typography-base);\n grid-column: 1/4;\n grid-row: 1;\n}\n.char-count + .label {\n grid-column: 1/3;\n}\n\n.char-count {\n color: var(--_low-ink-color);\n font: var(--vvd-typography-base);\n grid-column: 3/4;\n}\n\n.fieldset {\n position: relative;\n display: flex;\n align-items: center;\n grid-column: 1/4;\n transition: color 0.2s;\n /* Shape */\n}\n.base > .fieldset {\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n.base:not(.shape-pill) .fieldset {\n border-radius: 6px;\n}\n.base.shape-pill .fieldset {\n border-radius: 24px;\n}\n\n.control {\n width: 100%;\n border: 0 none;\n background-color: var(--_appearance-color-fill);\n block-size: 100%;\n border-radius: inherit;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n font: var(--vvd-typography-base);\n padding-inline-end: 16px;\n padding-inline-start: 16px;\n transition: box-shadow 0.2s, background-color 0.2s;\n}\n.control:disabled {\n cursor: not-allowed;\n opacity: 1; /* 2. correct opacity on iOS */\n -webkit-text-fill-color: var(--_appearance-color-text); /* 1. sets text fill to current `color` for safari */\n}\n.control::placeholder, .control:disabled::placeholder {\n opacity: 1; /* 2. correct opacity on iOS */\n -webkit-text-fill-color: var(--_low-ink-color); /* 1. sets text fill to current `color` for safari */\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n\n.icon {\n position: absolute;\n z-index: 1;\n color: var(--_low-ink-color);\n font-size: 20px;\n inset-inline-start: 16px;\n}\n.icon + .control {\n padding-inline-start: 44px;\n}\n\n.focus-indicator {\n --focus-stroke-gap-color: transparent;\n pointer-events: none;\n}\n.fieldset:not(:focus-visible, :focus-within) > .focus-indicator {\n display: none;\n}";
|
|
28
|
-
|
|
29
|
-
let _ = t => t,
|
|
30
|
-
_t,
|
|
31
|
-
_t2,
|
|
32
|
-
_t3;
|
|
33
|
-
const getStateClasses = ({
|
|
34
|
-
errorValidationMessage,
|
|
35
|
-
disabled,
|
|
36
|
-
value,
|
|
37
|
-
readOnly,
|
|
38
|
-
placeholder,
|
|
39
|
-
appearance,
|
|
40
|
-
shape,
|
|
41
|
-
label,
|
|
42
|
-
successText
|
|
43
|
-
}) => classNames(['error connotation-alert', Boolean(errorValidationMessage)], ['disabled', disabled], ['has-value', Boolean(value)], ['readonly', readOnly], ['placeholder', Boolean(placeholder)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ['no-label', !label], ['success connotation-success', Boolean(successText)]);
|
|
44
|
-
function renderLabel() {
|
|
45
|
-
return html(_t || (_t = _`
|
|
46
|
-
<label for="control" class="label">
|
|
47
|
-
${0}
|
|
48
|
-
</label>`), x => x.label);
|
|
49
|
-
}
|
|
50
|
-
function renderCharCount() {
|
|
51
|
-
return html(_t2 || (_t2 = _`
|
|
52
|
-
<span class="char-count">${0} / ${0}</span>
|
|
53
|
-
`), x => x.value ? x.value.length : 0, x => x.maxlength);
|
|
54
|
-
}
|
|
55
|
-
const TextfieldTemplate = context => {
|
|
56
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
57
|
-
const focusTemplate = focusTemplateFactory(context);
|
|
58
|
-
return html(_t3 || (_t3 = _`
|
|
59
|
-
<div class="base ${0}">
|
|
60
|
-
${0}
|
|
61
|
-
${0}
|
|
62
|
-
<div class="fieldset">
|
|
63
|
-
${0}
|
|
64
|
-
<input class="control"
|
|
65
|
-
id="control"
|
|
66
|
-
@input="${0}"
|
|
67
|
-
@change="${0}"
|
|
68
|
-
?autofocus="${0}"
|
|
69
|
-
?disabled="${0}"
|
|
70
|
-
list="${0}"
|
|
71
|
-
maxlength="${0}"
|
|
72
|
-
minlength="${0}"
|
|
73
|
-
pattern="${0}"
|
|
74
|
-
placeholder="${0}"
|
|
75
|
-
?readonly="${0}"
|
|
76
|
-
?required="${0}"
|
|
77
|
-
size="${0}"
|
|
78
|
-
autocomplete="${0}"
|
|
79
|
-
name="${0}"
|
|
80
|
-
?spellcheck="${0}"
|
|
81
|
-
:value="${0}"
|
|
82
|
-
type="${0}"
|
|
83
|
-
aria-atomic="${0}"
|
|
84
|
-
aria-busy="${0}"
|
|
85
|
-
aria-controls="${0}"
|
|
86
|
-
aria-current="${0}"
|
|
87
|
-
aria-describedby="${0}"
|
|
88
|
-
aria-details="${0}"
|
|
89
|
-
aria-disabled="${0}"
|
|
90
|
-
aria-errormessage="${0}"
|
|
91
|
-
aria-flowto="${0}"
|
|
92
|
-
aria-haspopup="${0}"
|
|
93
|
-
aria-hidden="${0}"
|
|
94
|
-
aria-invalid="${0}"
|
|
95
|
-
aria-keyshortcuts="${0}"
|
|
96
|
-
aria-label="${0}"
|
|
97
|
-
aria-labelledby="${0}"
|
|
98
|
-
aria-live="${0}"
|
|
99
|
-
aria-owns="${0}"
|
|
100
|
-
aria-relevant="${0}"
|
|
101
|
-
aria-roledescription="${0}"
|
|
102
|
-
${0}
|
|
103
|
-
/>
|
|
104
|
-
${0}
|
|
105
|
-
</div>
|
|
106
|
-
${0}
|
|
107
|
-
${0}
|
|
108
|
-
${0}
|
|
109
|
-
</div>`), getStateClasses, when(x => x.charCount && x.maxlength, renderCharCount()), when(x => x.label, renderLabel()), x => affixIconTemplate(x.icon), x => x.handleTextInput(), x => x.handleChange(), x => x.autofocus, x => x.disabled, x => x.list, x => x.maxlength, x => x.minlength, x => x.pattern, x => x.placeholder, x => x.readOnly, x => x.required, x => x.size, x => x.autoComplete, x => x.name, x => x.spellcheck, x => x.value, x => x.type, x => x.ariaAtomic, x => x.ariaBusy, x => x.ariaControls, x => x.ariaCurrent, x => x.ariaDescribedby, x => x.ariaDetails, x => x.ariaDisabled, x => x.ariaErrormessage, x => x.ariaFlowto, x => x.ariaHaspopup, x => x.ariaHidden, x => x.ariaInvalid, x => x.ariaKeyshortcuts, x => x.ariaLabel, x => x.ariaLabelledby, x => x.ariaLive, x => x.ariaOwns, x => x.ariaRelevant, x => x.ariaRoledescription, ref('control'), () => focusTemplate, when(x => {
|
|
110
|
-
var _a;
|
|
111
|
-
return !x.successText && !x.errorValidationMessage && ((_a = x.helperText) === null || _a === void 0 ? void 0 : _a.length);
|
|
112
|
-
}, getFeedbackTemplate('helper', context)), when(x => !x.successText && x.errorValidationMessage, getFeedbackTemplate('error', context)), when(x => x.successText, getFeedbackTemplate('success', context)));
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const prefix = getPrefix(import.meta.url);
|
|
116
|
-
const vividTextfield = TextField.compose({
|
|
117
|
-
baseName: 'text-field',
|
|
118
|
-
template: TextfieldTemplate,
|
|
119
|
-
styles: css_248z,
|
|
120
|
-
shadowOptions: {
|
|
121
|
-
delegatesFocus: true
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
(async () => {
|
|
125
|
-
await loadComponentsModules(['icon', 'focus'], prefix);
|
|
126
|
-
designSystem.withPrefix(prefix).register(vividTextfield());
|
|
127
|
-
})();
|
|
128
|
-
|
|
129
|
-
export { vividTextfield };
|
|
22
|
+
registerTextField();
|