@vonage/vivid 3.0.0-next.9 → 3.0.0-next.90
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 +141 -4
- package/accordion/index.js +3 -12
- package/accordion-item/index.js +30 -38
- package/action-group/index.js +41 -0
- package/avatar/index.js +60 -0
- package/badge/index.js +16 -30
- package/banner/index.js +25 -111
- package/breadcrumb/index.js +21 -18
- package/breadcrumb-item/index.js +23 -20
- package/button/index.js +19 -757
- package/calendar/index.js +72 -67
- package/calendar-event/index.js +112 -0
- package/card/index.js +113 -0
- package/checkbox/index.js +176 -0
- package/dialog/index.js +229 -0
- package/divider/index.js +4 -0
- package/elevation/index.js +3 -31
- package/fab/index.js +99 -0
- package/focus/index.js +18 -3
- package/header/index.js +61 -0
- package/icon/index.js +10 -9
- package/index.js +57 -20
- package/layout/index.js +5 -15
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/accordion-item/index.d.ts +2 -1
- package/lib/action-group/action-group.d.ts +10 -0
- package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
- package/lib/{sidenav-item → action-group}/index.d.ts +1 -2
- package/lib/avatar/avatar.d.ts +15 -0
- package/lib/avatar/avatar.template.d.ts +4 -0
- package/lib/avatar/index.d.ts +3 -0
- package/lib/badge/badge.d.ts +3 -5
- package/lib/badge/index.d.ts +1 -1
- package/lib/banner/banner.d.ts +1 -1
- package/lib/banner/banner.template.d.ts +0 -2
- package/lib/banner/index.d.ts +1 -0
- package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/breadcrumb-item/index.d.ts +1 -0
- package/lib/button/button.d.ts +6 -5
- package/lib/button/index.d.ts +2 -19
- package/lib/calendar/calendar.d.ts +3 -1
- package/lib/calendar/index.d.ts +0 -1
- package/lib/calendar-event/calendar-event.d.ts +14 -0
- package/lib/calendar-event/calendar-event.template.d.ts +4 -0
- package/lib/calendar-event/index.d.ts +2 -0
- package/lib/card/card.d.ts +10 -0
- package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
- package/lib/card/index.d.ts +4 -0
- package/lib/checkbox/checkbox.d.ts +5 -0
- package/lib/checkbox/checkbox.template.d.ts +4 -0
- package/lib/checkbox/index.d.ts +4 -0
- package/lib/components.d.ts +29 -10
- package/lib/dialog/dialog.d.ts +20 -0
- package/lib/dialog/dialog.template.d.ts +4 -0
- package/lib/dialog/index.d.ts +5 -0
- package/lib/divider/divider.d.ts +3 -0
- package/lib/divider/divider.template.d.ts +4 -0
- package/lib/divider/index.d.ts +2 -0
- package/lib/elevation/elevation.d.ts +1 -0
- package/lib/elevation/index.d.ts +1 -1
- package/lib/enums.d.ts +11 -6
- package/lib/fab/fab.d.ts +13 -0
- package/lib/fab/fab.template.d.ts +4 -0
- package/lib/fab/index.d.ts +4 -0
- package/lib/focus/index.d.ts +1 -1
- package/lib/header/header.d.ts +5 -0
- package/lib/header/header.template.d.ts +4 -0
- package/lib/header/index.d.ts +3 -0
- package/lib/icon/icon.d.ts +4 -3
- package/lib/layout/index.d.ts +1 -1
- package/lib/layout/layout.d.ts +3 -3
- package/lib/listbox-option/index.d.ts +4 -0
- package/lib/listbox-option/listbox-option.d.ts +7 -0
- package/lib/listbox-option/listbox-option.template.d.ts +4 -0
- package/lib/menu/index.d.ts +12 -0
- package/lib/menu/menu.d.ts +10 -0
- package/lib/menu/menu.template.d.ts +3 -0
- package/lib/menu-item/index.d.ts +3 -0
- package/lib/menu-item/menu-item.d.ts +7 -0
- package/lib/menu-item/menu-item.template.d.ts +5 -0
- package/lib/nav/index.d.ts +2 -0
- package/lib/nav/nav.d.ts +3 -0
- package/lib/nav/nav.template.d.ts +4 -0
- package/lib/nav-disclosure/index.d.ts +4 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
- package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
- package/lib/nav-item/index.d.ts +4 -0
- package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
- package/lib/nav-item/nav-item.template.d.ts +4 -0
- package/lib/{text → note}/index.d.ts +1 -1
- package/lib/note/note.d.ts +10 -0
- package/lib/note/note.template.d.ts +5 -0
- package/lib/number-field/index.d.ts +4 -0
- package/lib/number-field/number-field.d.ts +14 -0
- package/lib/number-field/number-field.template.d.ts +4 -0
- package/lib/popup/index.d.ts +1 -1
- package/lib/popup/popup.d.ts +2 -1
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +2 -1
- package/lib/radio/index.d.ts +3 -0
- package/lib/radio/radio.d.ts +4 -0
- package/lib/radio/radio.template.d.ts +4 -0
- package/lib/radio-group/index.d.ts +10 -0
- package/lib/radio-group/radio-group.d.ts +4 -0
- package/lib/radio-group/radio-group.template.d.ts +4 -0
- package/lib/side-drawer/index.d.ts +1 -1
- package/lib/side-drawer/side-drawer.d.ts +3 -2
- package/lib/text-anchor/text-anchor.d.ts +1 -1
- package/lib/text-area/index.d.ts +4 -0
- package/lib/text-area/text-area.d.ts +9 -0
- package/lib/text-area/text-area.template.d.ts +4 -0
- package/lib/text-field/index.d.ts +4 -0
- package/lib/text-field/text-field.d.ts +14 -0
- package/lib/text-field/text-field.template.d.ts +5 -0
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/listbox-option/index.js +248 -0
- package/menu/index.js +376 -0
- package/menu-item/index.js +20 -0
- package/nav/index.js +17 -0
- package/nav-disclosure/index.js +81 -0
- package/nav-item/index.js +45 -0
- package/note/index.js +58 -0
- package/number-field/index.js +516 -0
- package/package.json +58 -10
- package/popup/index.js +22 -2061
- package/progress/index.js +35 -36
- package/progress-ring/index.js +11 -11
- package/radio/index.js +50 -0
- package/radio-group/index.js +435 -0
- package/shared/affix.js +1 -6
- package/shared/anchor.js +10 -2
- package/shared/apply-mixins.js +5 -4
- package/shared/aria-global.js +2 -86
- package/shared/aria.js +9 -0
- package/shared/base-progress.js +5 -0
- package/shared/breadcrumb-item.js +1 -1
- package/shared/button.js +200 -0
- package/shared/calendar-event.js +19 -0
- package/shared/dialog-polyfill.esm.js +858 -0
- package/shared/direction.js +20 -0
- package/shared/enums.js +62 -0
- package/shared/es.object.assign.js +3 -2
- package/shared/export.js +1017 -0
- package/shared/focus.js +5 -0
- package/shared/focus2.js +11 -0
- package/shared/form-associated.js +466 -0
- package/shared/form-elements.js +331 -0
- package/shared/icon.js +534 -531
- package/shared/index.js +108 -79
- package/shared/index2.js +100 -14
- package/shared/index3.js +31 -0
- package/shared/index4.js +77 -0
- package/shared/index5.js +1525 -0
- package/shared/index6.js +349 -0
- package/shared/iterators.js +61 -0
- package/shared/key-codes.js +96 -0
- package/shared/object-keys.js +13 -0
- package/shared/patterns/focus.d.ts +3 -0
- package/shared/patterns/form-elements/form-elements.d.ts +28 -0
- package/shared/patterns/form-elements/index.d.ts +1 -0
- package/shared/patterns/index.d.ts +2 -0
- package/shared/radio.js +127 -0
- package/shared/ref.js +41 -0
- package/shared/slotted.js +1 -1
- package/shared/start-end.js +50 -0
- package/shared/text-anchor.js +2 -13
- package/shared/text-anchor.template.js +6 -5
- package/shared/to-string.js +51 -0
- package/shared/web.dom-collections.iterator.js +74 -1081
- package/side-drawer/index.js +41 -33
- package/styles/core/all.css +75 -0
- package/styles/core/theme.css +11 -0
- package/styles/core/typography.css +69 -0
- package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
- package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
- package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
- package/styles/fonts/spezia.css +9 -12
- package/styles/tokens/theme-dark.css +230 -0
- package/styles/tokens/theme-light.css +230 -0
- package/text-anchor/index.js +9 -1
- package/text-area/index.js +288 -0
- package/text-field/index.js +129 -0
- package/tooltip/index.js +23 -24
- package/lib/text/text.d.ts +0 -10
- package/shared/style-inject.es.js +0 -28
- package/sidenav-item/index.js +0 -38
- package/styles/themes/dark.css +0 -205
- package/styles/themes/light.css +0 -205
- package/text/index.js +0 -45
package/progress/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import '../shared/web.dom-collections.iterator.js';
|
|
3
|
+
import { c as classofRaw, _ as _export, f as functionUncurryThis } from '../shared/export.js';
|
|
4
4
|
import { B as BaseProgress } from '../shared/base-progress.js';
|
|
5
5
|
import { w as when } from '../shared/when.js';
|
|
6
6
|
import { c as classNames } from '../shared/class-names.js';
|
|
7
|
+
import '../shared/object-keys.js';
|
|
8
|
+
import '../shared/iterators.js';
|
|
7
9
|
|
|
8
|
-
var css_248z = ".base {\n height: 6px;\n align-items: center;\n margin: 0;\n outline: none;\n}\n.base.connotation-cta {\n --
|
|
9
|
-
styleInject(css_248z);
|
|
10
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 03 Nov 2022 17:18:46 GMT\n */\n.base {\n height: 6px;\n align-items: center;\n margin: 0;\n outline: none;\n}\n.base:not(.connotation-pacific).connotation-cta {\n --_connotation-color-primary: var(--vvd-color-cta-500);\n}\n.base:not(.connotation-pacific).connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n}\n.base:not(.connotation-pacific).connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n}\n.base:not(.connotation-pacific):not(.connotation-cta, .connotation-alert, .connotation-success) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n}\n.base.connotation-pacific {\n --_connotation-color-primary: linear-gradient(to right, var(--vvd-color-information-200), var(--vvd-color-cta-600));\n}\n\n.progress {\n position: relative;\n display: flex;\n overflow: hidden;\n align-items: center;\n background-color: var(--vvd-color-neutral-100);\n block-size: 100%;\n inline-size: 100%;\n /* Shape */\n}\n.base:not(.shape-sharp) .progress {\n border-radius: 3px;\n}\n\n.indeterminate {\n display: flex;\n background-color: var(--_connotation-color-primary);\n block-size: 100%;\n border-radius: inherit;\n inline-size: 100%;\n}\n\n.determinate {\n background-color: var(--_connotation-color-primary);\n block-size: 100%;\n border-radius: inherit;\n transition: all 0.2s ease-in-out;\n}\n.connotation-pacific .determinate {\n background-image: var(--_connotation-color-primary);\n}\n.reverse .determinate {\n position: absolute;\n right: 0;\n}\n.paused .determinate {\n background-color: var(--vvd-color-neutral-300);\n}\n\n.indicator-1 {\n animation: indeterminate-1 2s infinite;\n inline-size: 30%;\n}\n\n.indicator-2 {\n animation: indeterminate-2 2s infinite;\n inline-size: 60%;\n}\n\n.indicator-1,\n.indicator-2 {\n position: absolute;\n animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);\n background-color: var(--vvd-color-neutral-100);\n block-size: 100%;\n opacity: 0;\n}\n.connotation-pacific .indicator-1,\n.connotation-pacific .indicator-2 {\n background-image: var(--_connotation-color-primary);\n}\n.paused .indicator-1,\n.paused .indicator-2 {\n animation-play-state: paused;\n background-color: var(--_connotation-color-primary);\n}\n.reverse .indicator-1,\n.reverse .indicator-2 {\n animation-direction: reverse;\n}\n\n@keyframes indeterminate-1 {\n 0% {\n opacity: 1;\n transform: translateX(-100%);\n }\n 70% {\n opacity: 1;\n transform: translateX(300%);\n }\n 70.01% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n transform: translateX(300%);\n }\n}\n@keyframes indeterminate-2 {\n 0% {\n opacity: 0;\n transform: translateX(-150%);\n }\n 29.99% {\n opacity: 0;\n }\n 30% {\n opacity: 1;\n transform: translateX(-150%);\n }\n 100% {\n opacity: 1;\n transform: translateX(166.66%);\n }\n}";
|
|
10
11
|
|
|
11
12
|
var classof = classofRaw;
|
|
12
13
|
|
|
@@ -21,7 +22,7 @@ var $ = _export;
|
|
|
21
22
|
var uncurryThis = functionUncurryThis;
|
|
22
23
|
var isArray = isArray$1;
|
|
23
24
|
|
|
24
|
-
var
|
|
25
|
+
var nativeReverse = uncurryThis([].reverse);
|
|
25
26
|
var test = [1, 2];
|
|
26
27
|
|
|
27
28
|
// `Array.prototype.reverse` method
|
|
@@ -32,7 +33,7 @@ $({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()
|
|
|
32
33
|
reverse: function reverse() {
|
|
33
34
|
// eslint-disable-next-line no-self-assign -- dirty hack
|
|
34
35
|
if (isArray(this)) this.length = this.length;
|
|
35
|
-
return
|
|
36
|
+
return nativeReverse(this);
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
39
|
|
|
@@ -41,51 +42,49 @@ class Progress extends BaseProgress {
|
|
|
41
42
|
super(...arguments);
|
|
42
43
|
this.reverse = false;
|
|
43
44
|
}
|
|
44
|
-
|
|
45
45
|
}
|
|
46
|
-
|
|
47
46
|
__decorate([attr(), __metadata("design:type", String)], Progress.prototype, "shape", void 0);
|
|
48
|
-
|
|
49
47
|
__decorate([attr(), __metadata("design:type", String)], Progress.prototype, "connotation", void 0);
|
|
50
|
-
|
|
51
48
|
__decorate([attr({
|
|
52
49
|
mode: 'boolean'
|
|
53
50
|
}), __metadata("design:type", Object)], Progress.prototype, "reverse", void 0);
|
|
54
51
|
|
|
55
52
|
let _2 = t => t,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
_t,
|
|
54
|
+
_t2,
|
|
55
|
+
_t3;
|
|
56
|
+
const getClasses = ({
|
|
57
|
+
connotation,
|
|
58
|
+
shape,
|
|
59
|
+
reverse,
|
|
60
|
+
paused
|
|
61
|
+
}) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`shape-${shape}`, Boolean(shape)], ['reverse', Boolean(reverse)], ['paused', Boolean(paused)]);
|
|
62
|
+
function determinate() {
|
|
63
63
|
return html(_t || (_t = _2`
|
|
64
|
+
<span class="determinate" style="width: ${0}%"></span>`), x => x.percentComplete);
|
|
65
|
+
}
|
|
66
|
+
function indeterminate() {
|
|
67
|
+
return html(_t2 || (_t2 = _2`
|
|
68
|
+
<span class="indeterminate" name="indeterminate">
|
|
69
|
+
<span class="indicator-1"></span>
|
|
70
|
+
<span class="indicator-2"></span>
|
|
71
|
+
</span>`));
|
|
72
|
+
}
|
|
73
|
+
const ProgressTemplate = _ => {
|
|
74
|
+
return html(_t3 || (_t3 = _2`
|
|
64
75
|
<div
|
|
65
76
|
role="progressbar"
|
|
66
77
|
aria-valuenow="${0}"
|
|
67
78
|
aria-valuemin="${0}"
|
|
68
79
|
aria-valuemax="${0}"
|
|
69
|
-
class="${0}
|
|
80
|
+
class="${0}"
|
|
70
81
|
>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
class="determinate"
|
|
78
|
-
style="width: ${0}%"
|
|
79
|
-
></div>
|
|
80
|
-
</div>
|
|
81
|
-
`), x => x.percentComplete)), when(x => typeof x.value !== 'number', html(_t3 || (_t3 = _2`
|
|
82
|
-
<div class="progress indeterminate">
|
|
83
|
-
<span class="indeterminate" name="indeterminate">
|
|
84
|
-
<span class="indeterminate-indicator-1"></span>
|
|
85
|
-
<span class="indeterminate-indicator-2"></span>
|
|
86
|
-
</span>
|
|
87
|
-
</div>
|
|
88
|
-
`))));
|
|
82
|
+
<div class="progress">
|
|
83
|
+
${0}
|
|
84
|
+
${0}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
`), x => x.value, x => x.min, x => x.max, getClasses, when(x => typeof x.value === 'number', determinate()), when(x => typeof x.value !== 'number', indeterminate()));
|
|
89
88
|
};
|
|
90
89
|
|
|
91
90
|
const vividProgress = Progress.compose({
|
package/progress-ring/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
|
|
2
|
-
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
3
2
|
import { B as BaseProgress } from '../shared/base-progress.js';
|
|
4
3
|
import { w as when } from '../shared/when.js';
|
|
5
4
|
import { c as classNames } from '../shared/class-names.js';
|
|
6
5
|
|
|
7
|
-
var css_248z = ".base {\n
|
|
8
|
-
styleInject(css_248z);
|
|
6
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 03 Nov 2022 17:18:46 GMT\n */\n.base {\n align-items: center;\n block-size: var(--_density);\n color: var(--_appearance-color-text);\n inline-size: var(--_density);\n outline: none;\n}\n.base.connotation-cta {\n --_connotation-color-primary: var(--vvd-color-cta-500);\n}\n.base.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n}\n.base.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n}\n.base:not(.connotation-cta, .connotation-alert, .connotation-success) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.density--5 {\n --_density: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) - 20));\n}\n.base.density--4 {\n --_density: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) - 16));\n}\n.base.density--3 {\n --_density: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) - 12));\n}\n.base.density--2 {\n --_density: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) - 8));\n}\n.base.density--1 {\n --_density: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) - 4));\n}\n.base.density-1 {\n --_density: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) + 4));\n}\n.base.density-2 {\n --_density: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) + 8));\n}\n.base.density-3 {\n --_density: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) + 12));\n}\n.base:not(.density--5, .density--4, .density--3, .density--2, .density--1, .density-1, .density-2, .density-3) {\n --_density: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1)));\n}\n\n.progress {\n width: 100%;\n height: 100%;\n}\n\n.background {\n fill: none;\n stroke: transparent;\n stroke-width: 2px;\n}\n\n.determinate {\n fill: none;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-width: 2px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.indeterminate-indicator-1 {\n animation: spin-infinite 2s linear infinite;\n fill: none;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-width: 2px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.base.paused .indeterminate-indicator-1 {\n animation-play-state: paused;\n}\n\n@keyframes spin-infinite {\n 0% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(0deg);\n }\n 50% {\n stroke-dasharray: 21.99px 21.99px;\n transform: rotate(450deg);\n }\n 100% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(1080deg);\n }\n}";
|
|
9
7
|
|
|
10
8
|
class ProgressRing extends BaseProgress {}
|
|
11
|
-
|
|
12
|
-
__decorate([attr
|
|
9
|
+
__decorate([attr, __metadata("design:type", String)], ProgressRing.prototype, "connotation", void 0);
|
|
10
|
+
__decorate([attr, __metadata("design:type", Number)], ProgressRing.prototype, "density", void 0);
|
|
13
11
|
|
|
14
12
|
let _2 = t => t,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
_t,
|
|
14
|
+
_t2,
|
|
15
|
+
_t3;
|
|
16
|
+
const getClasses = ({
|
|
17
|
+
connotation,
|
|
18
|
+
density,
|
|
19
|
+
paused
|
|
20
|
+
}) => classNames('base', ['disabled', !!paused], [`connotation-${connotation}`, !!connotation], [`density-${density}`, !!density]);
|
|
21
21
|
const progressSegments = 44;
|
|
22
22
|
const ProgressRingTemplate = _ => html(_t || (_t = _2`
|
|
23
23
|
<div
|
package/radio/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import '../focus/index.js';
|
|
2
|
+
import { h as html, d as designSystem } from '../shared/index.js';
|
|
3
|
+
import { R as Radio } from '../shared/radio.js';
|
|
4
|
+
import { f as focusTemplateFactory } from '../shared/focus2.js';
|
|
5
|
+
import { w as when } from '../shared/when.js';
|
|
6
|
+
import { c as classNames } from '../shared/class-names.js';
|
|
7
|
+
import '../shared/focus.js';
|
|
8
|
+
import '../shared/form-associated.js';
|
|
9
|
+
import '../shared/key-codes.js';
|
|
10
|
+
|
|
11
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 03 Nov 2022 17:18:46 GMT\n */\n.base {\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n gap: 8px;\n}\n.base {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.base {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-canvas);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-canvas);\n --_appearance-color-outline: var(--vvd-color-canvas-text);\n}\n.base:where(:checked, .checked):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: var(--_connotation-color-primary);\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n@supports selector(:focus-visible) {\n .base:focus {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base.disabled {\n cursor: not-allowed;\n}\n\n.control {\n position: relative;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n background-color: var(--vvd-color-canvas);\n border-radius: 50%;\n box-shadow: inset 0 0 0 2px var(--_appearance-color-outline);\n}\n.control::after {\n position: absolute;\n background-color: var(--_appearance-color-outline);\n border-radius: inherit;\n content: \"\";\n inset: 5px;\n}\n.base:not(.checked) .control::after {\n display: none;\n}\n\nlabel {\n color: var(--vvd-color-canvas-text);\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n.base.disabled label {\n color: var(--vvd-color-neutral-400);\n cursor: not-allowed;\n}\n\n.focus-indicator {\n --focus-inset: -3px;\n --focus-stroke-gap-color: transparent;\n border-radius: 50%;\n}\n.base:not(:focus-visible) .focus-indicator {\n display: none;\n}";
|
|
12
|
+
|
|
13
|
+
let _ = t => t,
|
|
14
|
+
_t,
|
|
15
|
+
_t2;
|
|
16
|
+
const getClasses = ({
|
|
17
|
+
checked,
|
|
18
|
+
disabled
|
|
19
|
+
}) => classNames('base', ['checked', Boolean(checked)], ['disabled', Boolean(disabled)]);
|
|
20
|
+
const RadioTemplate = context => {
|
|
21
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
22
|
+
return html(_t || (_t = _`
|
|
23
|
+
<span class="${0}"
|
|
24
|
+
role="radio"
|
|
25
|
+
aria-checked="${0}"
|
|
26
|
+
aria-required="${0}"
|
|
27
|
+
aria-disabled="${0}"
|
|
28
|
+
tabindex="${0}"
|
|
29
|
+
@keypress="${0}"
|
|
30
|
+
@click="${0}"
|
|
31
|
+
>
|
|
32
|
+
<div class="control">
|
|
33
|
+
${0}
|
|
34
|
+
</div>
|
|
35
|
+
${0}
|
|
36
|
+
</span>
|
|
37
|
+
`), getClasses, x => x.checked, x => x.required, x => x.disabled, 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 = _`<label class="label">${0}</label>`), x => x.label)));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const vividRadio = Radio.compose({
|
|
41
|
+
baseName: 'radio',
|
|
42
|
+
template: RadioTemplate,
|
|
43
|
+
styles: css_248z,
|
|
44
|
+
shadowOptions: {
|
|
45
|
+
delegatesFocus: true
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
designSystem.register(vividRadio());
|
|
49
|
+
|
|
50
|
+
export { vividRadio };
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
|
|
2
|
+
import { D as Direction, g as getDirection } from '../shared/direction.js';
|
|
3
|
+
import { h as keyArrowRight, g as keyArrowLeft, A as ArrowKeys, d as keyArrowUp, e as keyArrowDown, k as keyEnter } from '../shared/key-codes.js';
|
|
4
|
+
import { O as Orientation } from '../shared/aria.js';
|
|
5
|
+
import { R as Radio } from '../shared/radio.js';
|
|
6
|
+
import { s as slotted, e as elements } from '../shared/slotted.js';
|
|
7
|
+
import { w as when } from '../shared/when.js';
|
|
8
|
+
import '../shared/form-associated.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Radio Group Custom HTML Element.
|
|
12
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#radiogroup | ARIA radiogroup }.
|
|
13
|
+
*
|
|
14
|
+
* @slot label - The slot for the label
|
|
15
|
+
* @slot - The default slot for radio buttons
|
|
16
|
+
* @csspart positioning-region - The positioning region for laying out the radios
|
|
17
|
+
* @fires change - Fires a custom 'change' event when the value changes
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
class RadioGroup$1 extends FoundationElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
/**
|
|
25
|
+
* The orientation of the group
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @remarks
|
|
29
|
+
* HTML Attribute: orientation
|
|
30
|
+
*/
|
|
31
|
+
this.orientation = Orientation.horizontal;
|
|
32
|
+
this.radioChangeHandler = (e) => {
|
|
33
|
+
const changedRadio = e.target;
|
|
34
|
+
if (changedRadio.checked) {
|
|
35
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
36
|
+
if (radio !== changedRadio) {
|
|
37
|
+
radio.checked = false;
|
|
38
|
+
if (!this.isInsideFoundationToolbar) {
|
|
39
|
+
radio.setAttribute("tabindex", "-1");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
this.selectedRadio = changedRadio;
|
|
44
|
+
this.value = changedRadio.value;
|
|
45
|
+
changedRadio.setAttribute("tabindex", "0");
|
|
46
|
+
this.focusedRadio = changedRadio;
|
|
47
|
+
}
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
};
|
|
50
|
+
this.moveToRadioByIndex = (group, index) => {
|
|
51
|
+
const radio = group[index];
|
|
52
|
+
if (!this.isInsideToolbar) {
|
|
53
|
+
radio.setAttribute("tabindex", "0");
|
|
54
|
+
if (radio.readOnly) {
|
|
55
|
+
this.slottedRadioButtons.forEach((nextRadio) => {
|
|
56
|
+
if (nextRadio !== radio) {
|
|
57
|
+
nextRadio.setAttribute("tabindex", "-1");
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
radio.checked = true;
|
|
63
|
+
this.selectedRadio = radio;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this.focusedRadio = radio;
|
|
67
|
+
radio.focus();
|
|
68
|
+
};
|
|
69
|
+
this.moveRightOffGroup = () => {
|
|
70
|
+
var _a;
|
|
71
|
+
(_a = this.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
72
|
+
};
|
|
73
|
+
this.moveLeftOffGroup = () => {
|
|
74
|
+
var _a;
|
|
75
|
+
(_a = this.previousElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
this.focusOutHandler = (e) => {
|
|
81
|
+
const group = this.slottedRadioButtons;
|
|
82
|
+
const radio = e.target;
|
|
83
|
+
const index = radio !== null ? group.indexOf(radio) : 0;
|
|
84
|
+
const focusedIndex = this.focusedRadio
|
|
85
|
+
? group.indexOf(this.focusedRadio)
|
|
86
|
+
: -1;
|
|
87
|
+
if ((focusedIndex === 0 && index === focusedIndex) ||
|
|
88
|
+
(focusedIndex === group.length - 1 && focusedIndex === index)) {
|
|
89
|
+
if (!this.selectedRadio) {
|
|
90
|
+
this.focusedRadio = group[0];
|
|
91
|
+
this.focusedRadio.setAttribute("tabindex", "0");
|
|
92
|
+
group.forEach((nextRadio) => {
|
|
93
|
+
if (nextRadio !== this.focusedRadio) {
|
|
94
|
+
nextRadio.setAttribute("tabindex", "-1");
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.focusedRadio = this.selectedRadio;
|
|
100
|
+
if (!this.isInsideFoundationToolbar) {
|
|
101
|
+
this.selectedRadio.setAttribute("tabindex", "0");
|
|
102
|
+
group.forEach((nextRadio) => {
|
|
103
|
+
if (nextRadio !== this.selectedRadio) {
|
|
104
|
+
nextRadio.setAttribute("tabindex", "-1");
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return true;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
this.clickHandler = (e) => {
|
|
116
|
+
const radio = e.target;
|
|
117
|
+
if (radio) {
|
|
118
|
+
const group = this.slottedRadioButtons;
|
|
119
|
+
if (radio.checked || group.indexOf(radio) === 0) {
|
|
120
|
+
radio.setAttribute("tabindex", "0");
|
|
121
|
+
this.selectedRadio = radio;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
radio.setAttribute("tabindex", "-1");
|
|
125
|
+
this.selectedRadio = null;
|
|
126
|
+
}
|
|
127
|
+
this.focusedRadio = radio;
|
|
128
|
+
}
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
};
|
|
131
|
+
this.shouldMoveOffGroupToTheRight = (index, group, key) => {
|
|
132
|
+
return index === group.length && this.isInsideToolbar && key === keyArrowRight;
|
|
133
|
+
};
|
|
134
|
+
this.shouldMoveOffGroupToTheLeft = (group, key) => {
|
|
135
|
+
const index = this.focusedRadio ? group.indexOf(this.focusedRadio) - 1 : 0;
|
|
136
|
+
return index < 0 && this.isInsideToolbar && key === keyArrowLeft;
|
|
137
|
+
};
|
|
138
|
+
this.checkFocusedRadio = () => {
|
|
139
|
+
if (this.focusedRadio !== null &&
|
|
140
|
+
!this.focusedRadio.readOnly &&
|
|
141
|
+
!this.focusedRadio.checked) {
|
|
142
|
+
this.focusedRadio.checked = true;
|
|
143
|
+
this.focusedRadio.setAttribute("tabindex", "0");
|
|
144
|
+
this.focusedRadio.focus();
|
|
145
|
+
this.selectedRadio = this.focusedRadio;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
this.moveRight = (e) => {
|
|
149
|
+
const group = this.slottedRadioButtons;
|
|
150
|
+
let index = 0;
|
|
151
|
+
index = this.focusedRadio ? group.indexOf(this.focusedRadio) + 1 : 1;
|
|
152
|
+
if (this.shouldMoveOffGroupToTheRight(index, group, e.key)) {
|
|
153
|
+
this.moveRightOffGroup();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
else if (index === group.length) {
|
|
157
|
+
index = 0;
|
|
158
|
+
}
|
|
159
|
+
/* looping to get to next radio that is not disabled */
|
|
160
|
+
/* matching native radio/radiogroup which does not select an item if there is only 1 in the group */
|
|
161
|
+
while (index < group.length && group.length > 1) {
|
|
162
|
+
if (!group[index].disabled) {
|
|
163
|
+
this.moveToRadioByIndex(group, index);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
else if (this.focusedRadio && index === group.indexOf(this.focusedRadio)) {
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
else if (index + 1 >= group.length) {
|
|
170
|
+
if (this.isInsideToolbar) {
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
index = 0;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
index += 1;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
this.moveLeft = (e) => {
|
|
183
|
+
const group = this.slottedRadioButtons;
|
|
184
|
+
let index = 0;
|
|
185
|
+
index = this.focusedRadio ? group.indexOf(this.focusedRadio) - 1 : 0;
|
|
186
|
+
index = index < 0 ? group.length - 1 : index;
|
|
187
|
+
if (this.shouldMoveOffGroupToTheLeft(group, e.key)) {
|
|
188
|
+
this.moveLeftOffGroup();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
/* looping to get to next radio that is not disabled */
|
|
192
|
+
while (index >= 0 && group.length > 1) {
|
|
193
|
+
if (!group[index].disabled) {
|
|
194
|
+
this.moveToRadioByIndex(group, index);
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
else if (this.focusedRadio && index === group.indexOf(this.focusedRadio)) {
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
else if (index - 1 < 0) {
|
|
201
|
+
index = group.length - 1;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
index -= 1;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* keyboard handling per https://w3c.github.io/aria-practices/#for-radio-groups-not-contained-in-a-toolbar
|
|
210
|
+
* navigation is different when there is an ancestor with role='toolbar'
|
|
211
|
+
*
|
|
212
|
+
* @internal
|
|
213
|
+
*/
|
|
214
|
+
this.keydownHandler = (e) => {
|
|
215
|
+
const key = e.key;
|
|
216
|
+
if (key in ArrowKeys && this.isInsideFoundationToolbar) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
switch (key) {
|
|
220
|
+
case keyEnter: {
|
|
221
|
+
this.checkFocusedRadio();
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
case keyArrowRight:
|
|
225
|
+
case keyArrowDown: {
|
|
226
|
+
if (this.direction === Direction.ltr) {
|
|
227
|
+
this.moveRight(e);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
this.moveLeft(e);
|
|
231
|
+
}
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
case keyArrowLeft:
|
|
235
|
+
case keyArrowUp: {
|
|
236
|
+
if (this.direction === Direction.ltr) {
|
|
237
|
+
this.moveLeft(e);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
this.moveRight(e);
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
default: {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
readOnlyChanged() {
|
|
251
|
+
if (this.slottedRadioButtons !== undefined) {
|
|
252
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
253
|
+
if (this.readOnly) {
|
|
254
|
+
radio.readOnly = true;
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
radio.readOnly = false;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
disabledChanged() {
|
|
263
|
+
if (this.slottedRadioButtons !== undefined) {
|
|
264
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
265
|
+
if (this.disabled) {
|
|
266
|
+
radio.disabled = true;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
radio.disabled = false;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
nameChanged() {
|
|
275
|
+
if (this.slottedRadioButtons) {
|
|
276
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
277
|
+
radio.setAttribute("name", this.name);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
valueChanged() {
|
|
282
|
+
if (this.slottedRadioButtons) {
|
|
283
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
284
|
+
if (radio.value === this.value) {
|
|
285
|
+
radio.checked = true;
|
|
286
|
+
this.selectedRadio = radio;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
this.$emit("change");
|
|
291
|
+
}
|
|
292
|
+
slottedRadioButtonsChanged(oldValue, newValue) {
|
|
293
|
+
if (this.slottedRadioButtons && this.slottedRadioButtons.length > 0) {
|
|
294
|
+
this.setupRadioButtons();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
get parentToolbar() {
|
|
298
|
+
return this.closest('[role="toolbar"]');
|
|
299
|
+
}
|
|
300
|
+
get isInsideToolbar() {
|
|
301
|
+
var _a;
|
|
302
|
+
return ((_a = this.parentToolbar) !== null && _a !== void 0 ? _a : false);
|
|
303
|
+
}
|
|
304
|
+
get isInsideFoundationToolbar() {
|
|
305
|
+
var _a;
|
|
306
|
+
return !!((_a = this.parentToolbar) === null || _a === void 0 ? void 0 : _a["$fastController"]);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* @internal
|
|
310
|
+
*/
|
|
311
|
+
connectedCallback() {
|
|
312
|
+
super.connectedCallback();
|
|
313
|
+
this.direction = getDirection(this);
|
|
314
|
+
this.setupRadioButtons();
|
|
315
|
+
}
|
|
316
|
+
disconnectedCallback() {
|
|
317
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
318
|
+
radio.removeEventListener("change", this.radioChangeHandler);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
setupRadioButtons() {
|
|
322
|
+
const checkedRadios = this.slottedRadioButtons.filter((radio) => {
|
|
323
|
+
return radio.hasAttribute("checked");
|
|
324
|
+
});
|
|
325
|
+
const numberOfCheckedRadios = checkedRadios ? checkedRadios.length : 0;
|
|
326
|
+
if (numberOfCheckedRadios > 1) {
|
|
327
|
+
const lastCheckedRadio = checkedRadios[numberOfCheckedRadios - 1];
|
|
328
|
+
lastCheckedRadio.checked = true;
|
|
329
|
+
}
|
|
330
|
+
let foundMatchingVal = false;
|
|
331
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
332
|
+
if (this.name !== undefined) {
|
|
333
|
+
radio.setAttribute("name", this.name);
|
|
334
|
+
}
|
|
335
|
+
if (this.disabled) {
|
|
336
|
+
radio.disabled = true;
|
|
337
|
+
}
|
|
338
|
+
if (this.readOnly) {
|
|
339
|
+
radio.readOnly = true;
|
|
340
|
+
}
|
|
341
|
+
if (this.value && this.value === radio.value) {
|
|
342
|
+
this.selectedRadio = radio;
|
|
343
|
+
this.focusedRadio = radio;
|
|
344
|
+
radio.checked = true;
|
|
345
|
+
radio.setAttribute("tabindex", "0");
|
|
346
|
+
foundMatchingVal = true;
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
if (!this.isInsideFoundationToolbar) {
|
|
350
|
+
radio.setAttribute("tabindex", "-1");
|
|
351
|
+
}
|
|
352
|
+
radio.checked = false;
|
|
353
|
+
}
|
|
354
|
+
radio.addEventListener("change", this.radioChangeHandler);
|
|
355
|
+
});
|
|
356
|
+
if (this.value === undefined && this.slottedRadioButtons.length > 0) {
|
|
357
|
+
const checkedRadios = this.slottedRadioButtons.filter((radio) => {
|
|
358
|
+
return radio.hasAttribute("checked");
|
|
359
|
+
});
|
|
360
|
+
const numberOfCheckedRadios = checkedRadios !== null ? checkedRadios.length : 0;
|
|
361
|
+
if (numberOfCheckedRadios > 0 && !foundMatchingVal) {
|
|
362
|
+
const lastCheckedRadio = checkedRadios[numberOfCheckedRadios - 1];
|
|
363
|
+
lastCheckedRadio.checked = true;
|
|
364
|
+
this.focusedRadio = lastCheckedRadio;
|
|
365
|
+
lastCheckedRadio.setAttribute("tabindex", "0");
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
this.slottedRadioButtons[0].setAttribute("tabindex", "0");
|
|
369
|
+
this.focusedRadio = this.slottedRadioButtons[0];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
__decorate([
|
|
375
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
376
|
+
], RadioGroup$1.prototype, "readOnly", void 0);
|
|
377
|
+
__decorate([
|
|
378
|
+
attr({ attribute: "disabled", mode: "boolean" })
|
|
379
|
+
], RadioGroup$1.prototype, "disabled", void 0);
|
|
380
|
+
__decorate([
|
|
381
|
+
attr
|
|
382
|
+
], RadioGroup$1.prototype, "name", void 0);
|
|
383
|
+
__decorate([
|
|
384
|
+
attr
|
|
385
|
+
], RadioGroup$1.prototype, "value", void 0);
|
|
386
|
+
__decorate([
|
|
387
|
+
attr
|
|
388
|
+
], RadioGroup$1.prototype, "orientation", void 0);
|
|
389
|
+
__decorate([
|
|
390
|
+
observable
|
|
391
|
+
], RadioGroup$1.prototype, "childItems", void 0);
|
|
392
|
+
__decorate([
|
|
393
|
+
observable
|
|
394
|
+
], RadioGroup$1.prototype, "slottedRadioButtons", void 0);
|
|
395
|
+
|
|
396
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 03 Nov 2022 17:18:46 GMT\n */\n.positioning-region {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.positioning-region.vertical {\n flex-direction: column;\n}\nlabel + .positioning-region {\n margin-block-start: 8px;\n}\n\nlabel {\n color: var(--vvd-color-canvas-text);\n font: var(--vvd-typography-base);\n}";
|
|
397
|
+
|
|
398
|
+
class RadioGroup extends RadioGroup$1 {}
|
|
399
|
+
__decorate([attr, __metadata("design:type", String)], RadioGroup.prototype, "label", void 0);
|
|
400
|
+
|
|
401
|
+
let _ = t => t,
|
|
402
|
+
_t,
|
|
403
|
+
_t2;
|
|
404
|
+
const RadioGroupTemplate = context => {
|
|
405
|
+
return html(_t || (_t = _`
|
|
406
|
+
<div
|
|
407
|
+
role="radiogroup"
|
|
408
|
+
aria-disabled="${0}"
|
|
409
|
+
aria-readonly="${0}"
|
|
410
|
+
aria-orientation="${0}"
|
|
411
|
+
@click="${0}"
|
|
412
|
+
@keydown="${0}"
|
|
413
|
+
@focusout="${0}"
|
|
414
|
+
>
|
|
415
|
+
|
|
416
|
+
${0}
|
|
417
|
+
|
|
418
|
+
<div class="positioning-region ${0}">
|
|
419
|
+
<slot ${0}></slot>
|
|
420
|
+
</div>
|
|
421
|
+
</div>
|
|
422
|
+
`), x => x.disabled, x => x.readOnly, x => x.orientation, (x, c) => x.clickHandler(c.event), (x, c) => x.keydownHandler(c.event), (x, c) => x.focusOutHandler(c.event), when(x => x.label, html(_t2 || (_t2 = _`<label>${0}</label>`), x => x.label)), x => x.orientation === Orientation.horizontal ? 'horizontal' : 'vertical', slotted({
|
|
423
|
+
property: 'slottedRadioButtons',
|
|
424
|
+
filter: elements(context.tagFor(Radio))
|
|
425
|
+
}));
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
const vividRadioGroup = RadioGroup.compose({
|
|
429
|
+
baseName: 'radio-group',
|
|
430
|
+
template: RadioGroupTemplate,
|
|
431
|
+
styles: css_248z
|
|
432
|
+
});
|
|
433
|
+
designSystem.register(vividRadioGroup());
|
|
434
|
+
|
|
435
|
+
export { vividRadioGroup };
|