@vonage/vivid 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +98 -81
- package/bundled/calendar-picker.template.cjs +1 -1
- package/bundled/calendar-picker.template.js +2 -2
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/definition10.cjs +1 -1
- package/bundled/definition10.js +2 -2
- package/bundled/definition11.cjs +12 -19
- package/bundled/definition11.js +73 -204
- package/bundled/definition12.cjs +19 -10
- package/bundled/definition12.js +217 -36
- package/bundled/definition13.cjs +10 -1
- package/bundled/definition13.js +38 -14
- package/bundled/definition14.cjs +1 -5
- package/bundled/definition14.js +15 -24
- package/bundled/definition15.cjs +5 -30
- package/bundled/definition15.js +22 -73
- package/bundled/definition16.cjs +30 -19
- package/bundled/definition16.js +74 -97
- package/bundled/definition17.cjs +19 -13
- package/bundled/definition17.js +83 -117
- package/bundled/definition18.cjs +13 -12
- package/bundled/definition18.js +114 -71
- package/bundled/definition19.cjs +16 -16
- package/bundled/definition19.js +87 -84
- package/bundled/definition2.cjs +9 -9
- package/bundled/definition2.js +84 -129
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +1 -1
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +48 -35
- package/bundled/mixins.cjs +1 -1
- package/bundled/mixins.js +1 -1
- package/bundled/picker-field.template.cjs +14 -14
- package/bundled/picker-field.template.js +35 -56
- package/bundled/time-selection-picker.template.cjs +12 -12
- package/bundled/time-selection-picker.template.js +13 -12
- package/bundled/trapped-focus.cjs +1 -0
- package/bundled/trapped-focus.js +26 -0
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +172 -144
- package/color-picker/definition.cjs +208 -112
- package/color-picker/definition.js +208 -112
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +412 -326
- package/combobox/index.cjs +1 -1
- package/combobox/index.js +1 -1
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +49 -0
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +139 -0
- package/dial-pad/definition.js +139 -0
- package/dial-pad/index.cjs +27 -20
- package/dial-pad/index.js +177 -100
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/icon/definition.cjs +56 -22
- package/icon/definition.js +56 -22
- package/lib/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/date-picker/date-picker.d.ts +38 -38
- package/lib/date-range-picker/date-range-picker.d.ts +20 -20
- package/lib/date-time-picker/date-time-picker.d.ts +40 -40
- package/lib/dial-pad/dial-pad.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -0
- package/lib/simple-color-picker/simple-color-picker.d.ts +2 -1
- package/lib/time-picker/time-picker.d.ts +20 -20
- package/locales/de-DE.cjs +16 -3
- package/locales/de-DE.js +16 -3
- package/locales/en-GB.cjs +17 -4
- package/locales/en-GB.js +17 -4
- package/locales/en-US.cjs +17 -4
- package/locales/en-US.js +17 -4
- package/locales/ja-JP.cjs +16 -3
- package/locales/ja-JP.js +16 -3
- package/locales/zh-CN.cjs +15 -2
- package/locales/zh-CN.js +15 -2
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +3 -3
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +3 -3
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +3 -3
- package/select/definition.cjs +6 -3
- package/select/definition.js +6 -3
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/color-picker/base-color-picker.d.ts +2 -1
- package/shared/picker-field/mixins/calendar-picker.d.ts +10 -10
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +10 -10
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +20 -20
- package/shared/picker-field/mixins/single-date-picker.d.ts +28 -28
- package/shared/picker-field/mixins/single-value-picker.d.ts +8 -8
- package/shared/picker-field/mixins/time-selection-picker.d.ts +20 -20
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +20 -20
- package/simple-color-picker/definition.cjs +8 -6
- package/simple-color-picker/definition.js +8 -6
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +41 -39
- 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/styles/tokens/vivid-2-compat.css +1 -1
- package/tag/definition.cjs +34 -14
- package/tag/definition.js +34 -14
- package/tag/index.cjs +25 -12
- package/tag/index.js +64 -47
- package/tag-group/definition.cjs +1 -2
- package/tag-group/definition.js +1 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +11 -12
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +2 -2
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +2 -2
- package/tooltip/definition.js +2 -2
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/unbundled/base-color-picker.cjs +36 -18
- package/unbundled/base-color-picker.js +36 -18
- package/unbundled/calendar-picker.template.cjs +1 -1
- package/unbundled/calendar-picker.template.js +1 -1
- package/unbundled/picker-field.template.cjs +2 -35
- package/unbundled/picker-field.template.js +2 -34
- package/unbundled/time-selection-picker.template.cjs +2 -1
- package/unbundled/time-selection-picker.template.js +2 -1
- package/unbundled/trapped-focus.cjs +37 -0
- package/unbundled/trapped-focus.js +34 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
package/bundled/localized.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { o as J } from "./vivid-element.js";
|
|
2
|
-
const
|
|
2
|
+
const n = "Play", l = "Pause", c = "Replay", d = "Duration", u = "LIVE", p = "Loaded", b = "Progress", g = "Fullscreen", m = "Mute", h = "Unmute", y = "Subtitles", L = "Captions", f = "Chapters", S = "Descriptions", P = "Close", T = "Text", w = "White", k = "Black", v = "Red", C = "Green", M = "Blue", D = "Yellow", B = "Magenta", E = "Cyan", x = "Background", $ = "Window", A = "Transparent", F = "Opaque", R = "None", O = "Raised", I = "Depressed", Y = "Uniform", N = "Casual", W = "Script", U = "Reset", z = "Done", V = "Color", G = "Opacity", H = {
|
|
3
3
|
"Audio Player": "Audio Player",
|
|
4
4
|
"Video Player": "Video Player",
|
|
5
|
-
Play:
|
|
5
|
+
Play: n,
|
|
6
6
|
Pause: l,
|
|
7
7
|
Replay: c,
|
|
8
8
|
"Current Time": "Current Time",
|
|
@@ -50,23 +50,23 @@ const s = "Play", l = "Pause", c = "Replay", d = "Duration", u = "LIVE", p = "Lo
|
|
|
50
50
|
"subtitles settings": "subtitles settings",
|
|
51
51
|
"descriptions settings": "descriptions settings",
|
|
52
52
|
Text: T,
|
|
53
|
-
White:
|
|
54
|
-
Black:
|
|
55
|
-
Red:
|
|
56
|
-
Green:
|
|
53
|
+
White: w,
|
|
54
|
+
Black: k,
|
|
55
|
+
Red: v,
|
|
56
|
+
Green: C,
|
|
57
57
|
Blue: M,
|
|
58
58
|
Yellow: D,
|
|
59
59
|
Magenta: B,
|
|
60
60
|
Cyan: E,
|
|
61
61
|
Background: x,
|
|
62
|
-
Window:
|
|
63
|
-
Transparent:
|
|
62
|
+
Window: $,
|
|
63
|
+
Transparent: A,
|
|
64
64
|
"Semi-Transparent": "Semi-Transparent",
|
|
65
|
-
Opaque:
|
|
65
|
+
Opaque: F,
|
|
66
66
|
"Font Size": "Font Size",
|
|
67
67
|
"Text Edge Style": "Text Edge Style",
|
|
68
|
-
None:
|
|
69
|
-
Raised:
|
|
68
|
+
None: R,
|
|
69
|
+
Raised: O,
|
|
70
70
|
Depressed: I,
|
|
71
71
|
Uniform: Y,
|
|
72
72
|
"Drop shadow": "Drop shadow",
|
|
@@ -98,7 +98,7 @@ const s = "Play", l = "Pause", c = "Replay", d = "Duration", u = "LIVE", p = "Lo
|
|
|
98
98
|
}, j = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
99
99
|
__proto__: null,
|
|
100
100
|
Background: x,
|
|
101
|
-
Black:
|
|
101
|
+
Black: k,
|
|
102
102
|
Blue: M,
|
|
103
103
|
Captions: L,
|
|
104
104
|
Casual: N,
|
|
@@ -111,29 +111,29 @@ const s = "Play", l = "Pause", c = "Replay", d = "Duration", u = "LIVE", p = "Lo
|
|
|
111
111
|
Done: z,
|
|
112
112
|
Duration: d,
|
|
113
113
|
Fullscreen: g,
|
|
114
|
-
Green:
|
|
114
|
+
Green: C,
|
|
115
115
|
LIVE: u,
|
|
116
116
|
Loaded: p,
|
|
117
117
|
Magenta: B,
|
|
118
118
|
Mute: m,
|
|
119
|
-
None:
|
|
119
|
+
None: R,
|
|
120
120
|
Opacity: G,
|
|
121
|
-
Opaque:
|
|
121
|
+
Opaque: F,
|
|
122
122
|
Pause: l,
|
|
123
|
-
Play:
|
|
123
|
+
Play: n,
|
|
124
124
|
Progress: b,
|
|
125
|
-
Raised:
|
|
126
|
-
Red:
|
|
125
|
+
Raised: O,
|
|
126
|
+
Red: v,
|
|
127
127
|
Replay: c,
|
|
128
128
|
Reset: U,
|
|
129
129
|
Script: W,
|
|
130
130
|
Subtitles: y,
|
|
131
131
|
Text: T,
|
|
132
|
-
Transparent:
|
|
132
|
+
Transparent: A,
|
|
133
133
|
Uniform: Y,
|
|
134
134
|
Unmute: h,
|
|
135
|
-
White:
|
|
136
|
-
Window:
|
|
135
|
+
White: w,
|
|
136
|
+
Window: $,
|
|
137
137
|
Yellow: D,
|
|
138
138
|
default: H
|
|
139
139
|
}, Symbol.toStringTag, { value: "Module" })), q = {
|
|
@@ -355,7 +355,7 @@ const s = "Play", l = "Pause", c = "Replay", d = "Duration", u = "LIVE", p = "Lo
|
|
|
355
355
|
),
|
|
356
356
|
optionFocusedMessage: (
|
|
357
357
|
/* istanbul ignore next */
|
|
358
|
-
(e, o,
|
|
358
|
+
(e, o, a, r) => `Option ${e} focused, ${r ? "selected, " : ""}${o} of ${a}.`
|
|
359
359
|
),
|
|
360
360
|
maxSelectedMessage: (
|
|
361
361
|
/* istanbul ignore next */
|
|
@@ -427,9 +427,9 @@ const s = "Play", l = "Pause", c = "Replay", d = "Duration", u = "LIVE", p = "Lo
|
|
|
427
427
|
baseColorPicker: {
|
|
428
428
|
colorSwatchLabel: (
|
|
429
429
|
/* istanbul ignore next */
|
|
430
|
-
(e, o,
|
|
430
|
+
(e, o, a) => {
|
|
431
431
|
let r = o ? `Select ${o}, hex: ${e}` : `Select ${e}`;
|
|
432
|
-
return
|
|
432
|
+
return a && (r += ", selected."), r;
|
|
433
433
|
}
|
|
434
434
|
)
|
|
435
435
|
},
|
|
@@ -438,34 +438,47 @@ const s = "Play", l = "Pause", c = "Replay", d = "Duration", u = "LIVE", p = "Lo
|
|
|
438
438
|
},
|
|
439
439
|
colorPicker: {
|
|
440
440
|
popupLabel: "Color Picker",
|
|
441
|
-
swatchesLabel: "Saved colors
|
|
442
|
-
pickerButtonLabel: "
|
|
441
|
+
swatchesLabel: "Saved colors",
|
|
442
|
+
pickerButtonLabel: "Color Picker",
|
|
443
|
+
hexInputLabel: "HEX color code",
|
|
443
444
|
saveButtonLabel: "Save current color",
|
|
444
445
|
closeButtonLabel: "Close Color Picker",
|
|
445
|
-
copyButtonLabel: "Copy
|
|
446
|
-
copyErrorText: "Copy failed. Clipboard access was blocked. Try again."
|
|
446
|
+
copyButtonLabel: "Copy color to clipboard",
|
|
447
|
+
copyErrorText: "Copy failed. Clipboard access was blocked. Try again.",
|
|
448
|
+
copySuccessMessage: (
|
|
449
|
+
/* istanbul ignore next */
|
|
450
|
+
(e) => `Color ${e} copied to clipboard.`
|
|
451
|
+
),
|
|
452
|
+
selectionSuccessMessage: (
|
|
453
|
+
/* istanbul ignore next */
|
|
454
|
+
(e) => `Color ${e} selected.`
|
|
455
|
+
),
|
|
456
|
+
maxSwatchesMessage: (
|
|
457
|
+
/* istanbul ignore next */
|
|
458
|
+
(e, o) => `${e} of ${o} colors saved.`
|
|
459
|
+
)
|
|
447
460
|
}
|
|
448
461
|
};
|
|
449
|
-
var K = Object.defineProperty,
|
|
450
|
-
for (var
|
|
451
|
-
(
|
|
452
|
-
return
|
|
462
|
+
var K = Object.defineProperty, X = (e, o, a, r) => {
|
|
463
|
+
for (var t = void 0, s = e.length - 1, i; s >= 0; s--)
|
|
464
|
+
(i = e[s]) && (t = i(o, a, t) || t);
|
|
465
|
+
return t && K(o, a, t), t;
|
|
453
466
|
};
|
|
454
467
|
class _ {
|
|
455
468
|
constructor() {
|
|
456
469
|
this.locale = q;
|
|
457
470
|
}
|
|
458
471
|
}
|
|
459
|
-
|
|
472
|
+
X([
|
|
460
473
|
J
|
|
461
474
|
], _.prototype, "locale");
|
|
462
|
-
const
|
|
475
|
+
const Z = new _(), ee = (e) => {
|
|
463
476
|
class o extends e {
|
|
464
477
|
/**
|
|
465
478
|
* @internal
|
|
466
479
|
*/
|
|
467
480
|
get locale() {
|
|
468
|
-
return
|
|
481
|
+
return Z.locale;
|
|
469
482
|
}
|
|
470
483
|
}
|
|
471
484
|
return o;
|
package/bundled/mixins.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const _=require("./normalize.cjs"),a=require("./vivid-element.cjs"),y=require("./definition2.cjs"),$=require("./
|
|
1
|
+
"use strict";const _=require("./normalize.cjs"),a=require("./vivid-element.cjs"),y=require("./definition2.cjs"),$=require("./definition14.cjs"),m=require("./when.cjs"),F=require("./class-names.cjs"),I=require("./localized.cjs"),f=require("./slotted.cjs"),D=":host{display:contents}.message{display:flex;contain:inline-size;font:var(--vvd-typography-base-condensed);gap:4px;grid-column:1/-1}.message.none-message{display:none}.message.helper-message{color:var(--_low-ink-color)}.message.error-message,.message.success-message{color:var(--vvd-color-canvas-text)}slot{display:inline}.icon{font-size:16px}.error-message .icon{color:var(--vvd-color-alert-500)}.success-message .icon{color:var(--vvd-color-success-500)}.announcement{display:contents}";var w=Object.defineProperty,C=(t,e,i,s)=>{for(var n=void 0,r=t.length-1,c;r>=0;r--)(c=t[r])&&(n=c(e,i,n)||n);return n&&w(e,i,n),n};class l extends I.Localized(a.VividElement){constructor(){super(...arguments),this.type="none"}}C([a.attr],l.prototype,"type");function g(t,e,i){const s=t.tagFor(y.Icon);return a.html`<${s} class="icon" name="${e}" label="${n=>n.locale.feedbackMessage[i]}"></${s}>`}function B(t){const e={none:"",helper:"",error:g(t,"info-line","errorIconText"),success:g(t,"check-circle-line","successIconText")};return a.html`${i=>e[i.type]}`}const b=t=>t==="error",M=t=>{const e=a.html`<div
|
|
2
2
|
class="${i=>F.classNames("message",`${i.type}-message`)}"
|
|
3
3
|
>
|
|
4
4
|
${B(t)}<slot></slot>
|
package/bundled/mixins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as k } from "./normalize.js";
|
|
2
2
|
import { d as _, h as d, V as $, a as y, M as F, H as I, o as f } from "./vivid-element.js";
|
|
3
3
|
import { i as w, I as D } from "./definition2.js";
|
|
4
|
-
import { v as C } from "./
|
|
4
|
+
import { v as C } from "./definition14.js";
|
|
5
5
|
import { w as m } from "./when.js";
|
|
6
6
|
import { c as B } from "./class-names.js";
|
|
7
7
|
import { L as H } from "./localized.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";const _=require("./index.cjs"),
|
|
2
|
-
<div class='base' @keydown='${(e,{event:
|
|
3
|
-
<${
|
|
1
|
+
"use strict";const _=require("./index.cjs"),f=require("./mixins.cjs"),$=require("./form-associated.cjs"),n=require("./vivid-element.cjs"),v=require("./trapped-focus.cjs"),x=require("./with-contextual-help.cjs"),g=require("./with-error-text.cjs"),m=require("./form-element.cjs"),k=require("./localized.cjs"),C=require("./definition9.cjs"),y=require("./definition10.cjs"),F=require("./definition3.cjs"),p=require("./ref.cjs"),h=require("./slotted.cjs"),b=require("./class-names.cjs"),O=":host{display:inline-block}.base{display:inline-block;inline-size:100%}.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog--padded{padding:12px;gap:12px}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;gap:8px}.dialog .footer--with-separator{border-top:1px solid var(--vvd-color-neutral-200)}";var E=Object.defineProperty,u=(s,t,o,d)=>{for(var i=void 0,a=s.length-1,l;a>=0;a--)(l=s[a])&&(i=l(t,o,i)||i);return i&&E(t,o,i),i};class r extends x.WithContextualHelp(f.WithFeedback(g.WithErrorText(m.FormElement(v.TrappedFocus(k.Localized($.FormAssociated(n.VividElement))))))){constructor(){super(),this.readOnly=!1,this.#e=()=>{this.$emit("focus",void 0,{bubbles:!1})},this.#t=()=>{this.$emit("blur",void 0,{bubbles:!1})},this.proxy=document.createElement("input"),this.#o={handleChange:()=>{this._updatePresentationValue()}},this._popupOpen=!1,this.#l=t=>{if(!this._popupOpen)return;const o=t.composedPath();[this._dialogEl,this._pickerButtonEl].some(i=>o.includes(i))||this._closePopup(!1)},this._presentationValue="",this.value=""}readOnlyChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.readOnly=this.readOnly,this.validate())}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#l),this.addEventListener("focusin",this.#e),this.addEventListener("focusout",this.#t),this.#s()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.#l),this.removeEventListener("focusin",this.#e),this.removeEventListener("focusout",this.#t),this.#n()}#e;#t;validate(){this.proxy&&this.proxy.setCustomValidity(this._getCustomValidationError()??""),super.validate(this._textFieldEl?.querySelector("input")??void 0)}#o;#i;#s(){this.#i=n.Observable.binding(()=>this.locale,this.#o),this.#i.observe(this,n.ExecutionContext.default)}#n(){this.#i.dispose()}#l;#a(){this.readOnly||(this._popupOpen=!0)}_closePopup(t=!0){this._popupOpen=!1,t&&this._textFieldEl.focus()}_onBaseKeyDown(t){return this._popupOpen&&_.handleEscapeKeyAndStopPropogation(t)?(this._closePopup(),!1):!this._trappedFocus(t,()=>this._focusableElsWithinDialog())}_presentationValueChanged(){this.dirtyValue=!0,this.validate()}_onTextFieldInput(t){const o=t.currentTarget;this._presentationValue=o.value}_onPickerButtonClick(){this._popupOpen?this._closePopup():this.#a()}_onOkClick(){this._closePopup()}_onClearClick(){this.$emit("clear-click")}}u([n.attr({attribute:"readonly",mode:"boolean"})],r.prototype,"readOnly");u([n.observable],r.prototype,"_popupOpen");u([n.observable],r.prototype,"_presentationValue");const T=(s,t,{withSeparator:o,padded:d})=>{const i=s.tagFor(C.Popup),a=s.tagFor(y.TextField),l=s.tagFor(F.Button);return n.html`
|
|
2
|
+
<div class='base' @keydown='${(e,{event:c})=>e._onBaseKeyDown(c)}'>
|
|
3
|
+
<${a} id='text-field'
|
|
4
4
|
${p.ref("_textFieldEl")}
|
|
5
5
|
class='control'
|
|
6
6
|
label='${e=>e.label}'
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
current-value='${e=>e._presentationValue}'
|
|
12
12
|
?disabled='${e=>e.disabled}'
|
|
13
13
|
?readonly='${e=>e.readOnly}'
|
|
14
|
-
@input='${(e,
|
|
14
|
+
@input='${(e,c)=>e._onTextFieldInput(c.event)}'
|
|
15
15
|
@change='${e=>e._onTextFieldChange()}'
|
|
16
16
|
>
|
|
17
17
|
<slot
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
name='contextual-help'
|
|
25
25
|
${h.slotted("_contextualHelpSlottedContent")}
|
|
26
26
|
></slot>
|
|
27
|
-
<${
|
|
27
|
+
<${l}
|
|
28
28
|
id='picker-button'
|
|
29
29
|
${p.ref("_pickerButtonEl")}
|
|
30
30
|
slot='action-items'
|
|
@@ -34,34 +34,34 @@
|
|
|
34
34
|
?disabled='${e=>e.disabled||e.readOnly}'
|
|
35
35
|
aria-label='${e=>e._pickerButtonLabel}'
|
|
36
36
|
@click='${e=>e._onPickerButtonClick()}'
|
|
37
|
-
></${
|
|
38
|
-
</${
|
|
37
|
+
></${l}>
|
|
38
|
+
</${a}>
|
|
39
39
|
<${i}
|
|
40
40
|
?open='${e=>e._popupOpen}'
|
|
41
41
|
:anchor='${e=>e._textFieldEl}'
|
|
42
42
|
offset='${e=>e._helperTextSlottedContent?.length||e.helperText||e.errorValidationMessage?8:null}'
|
|
43
43
|
placement='bottom-start'
|
|
44
44
|
class='popup'>
|
|
45
|
-
<div class="${()=>
|
|
45
|
+
<div class="${()=>b.classNames("dialog",["dialog--padded",d])}" role='dialog' ${p.ref("_dialogEl")} aria-modal='true' aria-label='${e=>e._dialogLabel}'>
|
|
46
46
|
${()=>t}
|
|
47
|
-
<div class="${()=>
|
|
48
|
-
<${
|
|
47
|
+
<div class="${()=>b.classNames("footer",["footer--with-separator",o])}">
|
|
48
|
+
<${l}
|
|
49
49
|
id='clear-button'
|
|
50
50
|
tabindex='3'
|
|
51
51
|
class='vwc-button'
|
|
52
52
|
size='condensed'
|
|
53
53
|
label='${e=>e.locale.pickerField.clearLabel}'
|
|
54
54
|
@click='${e=>e._onClearClick()}'
|
|
55
|
-
></${
|
|
56
|
-
<${
|
|
55
|
+
></${l}>
|
|
56
|
+
<${l}
|
|
57
57
|
tabindex='3'
|
|
58
58
|
class='vwc-button'
|
|
59
59
|
size='condensed'
|
|
60
60
|
appearance='filled'
|
|
61
61
|
label='${e=>e.locale.pickerField.okLabel}'
|
|
62
62
|
@click='${e=>e._onOkClick()}'
|
|
63
|
-
></${
|
|
63
|
+
></${l}>
|
|
64
64
|
</div>
|
|
65
65
|
</div>
|
|
66
66
|
</${i}>
|
|
67
|
-
</div>`};exports.PickerField=
|
|
67
|
+
</div>`};exports.PickerField=r;exports.PickerFieldTemplate=T;exports.pickerFieldStyles=O;
|
|
@@ -1,48 +1,28 @@
|
|
|
1
|
-
import { h as
|
|
1
|
+
import { h as f } from "./index.js";
|
|
2
2
|
import { W as _ } from "./mixins.js";
|
|
3
|
-
import { F as
|
|
4
|
-
import { V as
|
|
3
|
+
import { F as b } from "./form-associated.js";
|
|
4
|
+
import { V as $, O as g, E as v, a as x, o as m, h as k } from "./vivid-element.js";
|
|
5
|
+
import { T as C } from "./trapped-focus.js";
|
|
5
6
|
import { W as y } from "./with-contextual-help.js";
|
|
6
|
-
import { W as
|
|
7
|
-
import { F as
|
|
8
|
-
import { L as
|
|
7
|
+
import { W as F } from "./with-error-text.js";
|
|
8
|
+
import { F as O } from "./form-element.js";
|
|
9
|
+
import { L as E } from "./localized.js";
|
|
9
10
|
import { P as T } from "./definition9.js";
|
|
10
11
|
import { T as P } from "./definition10.js";
|
|
11
12
|
import { B as L } from "./definition3.js";
|
|
12
13
|
import { r as p } from "./ref.js";
|
|
13
14
|
import { s as u } from "./slotted.js";
|
|
14
15
|
import { c as h } from "./class-names.js";
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* @returns Whether focus was trapped.
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
_trappedFocus(n, o) {
|
|
24
|
-
if (!m.has(n) && n.key === "Tab") {
|
|
25
|
-
const l = o(), i = l[0], e = l[l.length - 1];
|
|
26
|
-
if (n.shiftKey) {
|
|
27
|
-
if (this.shadowRoot.activeElement === i)
|
|
28
|
-
return e.focus(), !0;
|
|
29
|
-
} else if (this.shadowRoot.activeElement === e)
|
|
30
|
-
return i.focus(), !0;
|
|
31
|
-
}
|
|
32
|
-
return !1;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return t;
|
|
36
|
-
}, J = ":host{display:inline-block}.base{display:inline-block;inline-size:100%}.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog--padded{padding:12px;gap:12px}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;gap:8px}.dialog .footer--with-separator{border-top:1px solid var(--vvd-color-neutral-200)}";
|
|
37
|
-
var w = Object.defineProperty, d = (s, t, a, n) => {
|
|
38
|
-
for (var o = void 0, l = s.length - 1, i; l >= 0; l--)
|
|
39
|
-
(i = s[l]) && (o = i(t, a, o) || o);
|
|
40
|
-
return o && w(t, a, o), o;
|
|
16
|
+
const J = ":host{display:inline-block}.base{display:inline-block;inline-size:100%}.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog--padded{padding:12px;gap:12px}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;gap:8px}.dialog .footer--with-separator{border-top:1px solid var(--vvd-color-neutral-200)}";
|
|
17
|
+
var V = Object.defineProperty, d = (s, t, l, n) => {
|
|
18
|
+
for (var o = void 0, a = s.length - 1, i; a >= 0; a--)
|
|
19
|
+
(i = s[a]) && (o = i(t, l, o) || o);
|
|
20
|
+
return o && V(t, l, o), o;
|
|
41
21
|
};
|
|
42
22
|
class c extends y(
|
|
43
23
|
_(
|
|
44
|
-
|
|
45
|
-
|
|
24
|
+
F(
|
|
25
|
+
O(C(E(b($))))
|
|
46
26
|
)
|
|
47
27
|
)
|
|
48
28
|
) {
|
|
@@ -52,15 +32,15 @@ class c extends y(
|
|
|
52
32
|
this.$emit("focus", void 0, { bubbles: !1 });
|
|
53
33
|
}, this.#t = () => {
|
|
54
34
|
this.$emit("blur", void 0, { bubbles: !1 });
|
|
55
|
-
}, this.proxy = document.createElement("input"), this.#
|
|
35
|
+
}, this.proxy = document.createElement("input"), this.#l = {
|
|
56
36
|
handleChange: () => {
|
|
57
37
|
this._updatePresentationValue();
|
|
58
38
|
}
|
|
59
39
|
}, this._popupOpen = !1, this.#i = (t) => {
|
|
60
40
|
if (!this._popupOpen)
|
|
61
41
|
return;
|
|
62
|
-
const
|
|
63
|
-
[this._dialogEl, this._pickerButtonEl].some((o) =>
|
|
42
|
+
const l = t.composedPath();
|
|
43
|
+
[this._dialogEl, this._pickerButtonEl].some((o) => l.includes(o)) || this._closePopup(!1);
|
|
64
44
|
}, this._presentationValue = "", this.value = "";
|
|
65
45
|
}
|
|
66
46
|
/**
|
|
@@ -73,7 +53,7 @@ class c extends y(
|
|
|
73
53
|
* @internal
|
|
74
54
|
*/
|
|
75
55
|
connectedCallback() {
|
|
76
|
-
super.connectedCallback(), document.addEventListener("click", this.#i), this.addEventListener("focusin", this.#e), this.addEventListener("focusout", this.#t), this.#
|
|
56
|
+
super.connectedCallback(), document.addEventListener("click", this.#i), this.addEventListener("focusin", this.#e), this.addEventListener("focusout", this.#t), this.#s();
|
|
77
57
|
}
|
|
78
58
|
/**
|
|
79
59
|
* @internal
|
|
@@ -89,13 +69,13 @@ class c extends y(
|
|
|
89
69
|
validate() {
|
|
90
70
|
this.proxy && this.proxy.setCustomValidity(this._getCustomValidationError() ?? ""), super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
|
|
91
71
|
}
|
|
92
|
-
#
|
|
72
|
+
#l;
|
|
93
73
|
#o;
|
|
94
|
-
#
|
|
95
|
-
this.#o =
|
|
74
|
+
#s() {
|
|
75
|
+
this.#o = g.binding(
|
|
96
76
|
() => this.locale,
|
|
97
|
-
this.#
|
|
98
|
-
), this.#o.observe(this,
|
|
77
|
+
this.#l
|
|
78
|
+
), this.#o.observe(this, v.default);
|
|
99
79
|
}
|
|
100
80
|
#a() {
|
|
101
81
|
this.#o.dispose();
|
|
@@ -115,7 +95,7 @@ class c extends y(
|
|
|
115
95
|
* @internal
|
|
116
96
|
*/
|
|
117
97
|
_onBaseKeyDown(t) {
|
|
118
|
-
return this._popupOpen &&
|
|
98
|
+
return this._popupOpen && f(t) ? (this._closePopup(), !1) : !this._trappedFocus(t, () => this._focusableElsWithinDialog());
|
|
119
99
|
}
|
|
120
100
|
/**
|
|
121
101
|
* @internal
|
|
@@ -127,8 +107,8 @@ class c extends y(
|
|
|
127
107
|
* @internal
|
|
128
108
|
*/
|
|
129
109
|
_onTextFieldInput(t) {
|
|
130
|
-
const
|
|
131
|
-
this._presentationValue =
|
|
110
|
+
const l = t.currentTarget;
|
|
111
|
+
this._presentationValue = l.value;
|
|
132
112
|
}
|
|
133
113
|
/**
|
|
134
114
|
* @internal
|
|
@@ -151,19 +131,19 @@ class c extends y(
|
|
|
151
131
|
}
|
|
152
132
|
}
|
|
153
133
|
d([
|
|
154
|
-
|
|
134
|
+
x({ attribute: "readonly", mode: "boolean" })
|
|
155
135
|
], c.prototype, "readOnly");
|
|
156
136
|
d([
|
|
157
|
-
|
|
137
|
+
m
|
|
158
138
|
], c.prototype, "_popupOpen");
|
|
159
139
|
d([
|
|
160
|
-
|
|
140
|
+
m
|
|
161
141
|
], c.prototype, "_presentationValue");
|
|
162
|
-
const Q = (s, t, { withSeparator:
|
|
163
|
-
const o = s.tagFor(T),
|
|
164
|
-
return
|
|
142
|
+
const Q = (s, t, { withSeparator: l, padded: n }) => {
|
|
143
|
+
const o = s.tagFor(T), a = s.tagFor(P), i = s.tagFor(L);
|
|
144
|
+
return k`
|
|
165
145
|
<div class='base' @keydown='${(e, { event: r }) => e._onBaseKeyDown(r)}'>
|
|
166
|
-
<${
|
|
146
|
+
<${a} id='text-field'
|
|
167
147
|
${p("_textFieldEl")}
|
|
168
148
|
class='control'
|
|
169
149
|
label='${(e) => e.label}'
|
|
@@ -198,7 +178,7 @@ const Q = (s, t, { withSeparator: a, padded: n }) => {
|
|
|
198
178
|
aria-label='${(e) => e._pickerButtonLabel}'
|
|
199
179
|
@click='${(e) => e._onPickerButtonClick()}'
|
|
200
180
|
></${i}>
|
|
201
|
-
</${
|
|
181
|
+
</${a}>
|
|
202
182
|
<${o}
|
|
203
183
|
?open='${(e) => e._popupOpen}'
|
|
204
184
|
:anchor='${(e) => e._textFieldEl}'
|
|
@@ -212,7 +192,7 @@ const Q = (s, t, { withSeparator: a, padded: n }) => {
|
|
|
212
192
|
"_dialogEl"
|
|
213
193
|
)} aria-modal='true' aria-label='${(e) => e._dialogLabel}'>
|
|
214
194
|
${() => t}
|
|
215
|
-
<div class="${() => h("footer", ["footer--with-separator",
|
|
195
|
+
<div class="${() => h("footer", ["footer--with-separator", l])}">
|
|
216
196
|
<${i}
|
|
217
197
|
id='clear-button'
|
|
218
198
|
tabindex='3'
|
|
@@ -237,6 +217,5 @@ const Q = (s, t, { withSeparator: a, padded: n }) => {
|
|
|
237
217
|
export {
|
|
238
218
|
c as P,
|
|
239
219
|
Q as a,
|
|
240
|
-
G as i,
|
|
241
220
|
J as p
|
|
242
221
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("./vivid-element.cjs"),
|
|
1
|
+
"use strict";const l=require("./vivid-element.cjs"),A=require("./picker-field.template.cjs"),D=require("./single-value-picker.cjs"),N=require("./scrollIntoView.cjs"),C=require("./when.cjs"),H=require("./trapped-focus.cjs"),R=require("./repeat.cjs"),j=require("./class-names.cjs"),z=require("./localized.cjs"),B=require("./ref.cjs"),S=e=>{const t=e.split(":");if(t.length!==3)return!1;const[o,i,r]=t;if(o.length!==2||i.length!==2||r.length!==2)return!1;const n=parseInt(o,10),s=parseInt(i,10),a=parseInt(r,10);return!(isNaN(n)||isNaN(s)||isNaN(a)||n<0||n>23||s<0||s>59||a<0||a>59)},g=e=>Number.parseInt(e,10),m=e=>e.toString().padStart(2,"0"),c=e=>{const[t,o,i]=e.split(":"),r=g(t),n=g(o),s=g(i);return{hourStr:t,hours:r,minuteStr:o,minutes:n,secondStr:i,seconds:s,meridiem:r<12?"AM":"PM"}},U=(e,t)=>e>t?1:e<t?-1:0,O=e=>e%12||12,W=(e,t)=>e==="AM"&&t<12||e==="PM"&&t>=12,K=(e,t,o)=>{const i=[],r=e?c(e).hours:0,n=t?c(t).hours:23;for(let s=r;s<=n;s++)o&&!W(o,s)||i.push({value:m(s),label:m(o?O(s):s)});return i},G=(e,t,o,i)=>{const r=[];let n=0,s=59;if(o){const{hourStr:a,minutes:p}=c(o);t&&c(t).hourStr===a&&(n=p)}if(i){const{hourStr:a,minutes:p}=c(i);t&&c(t).hourStr===a&&(s=p)}for(let a=n;a<=s;a+=Math.max(1,e??1)){const p=m(a);r.push({value:p,label:p})}return r},J=(e,t,o,i)=>{const r=[];let n=0,s=59;if(o){const a=c(o);t&&(c(t).hourStr===a.hourStr&&c(t).minuteStr)===a.minuteStr&&(n=a.seconds)}if(i){const a=c(i);t&&(c(t).hourStr===a.hourStr&&c(t).minuteStr)===a.minuteStr&&(s=a.seconds)}for(let a=n;a<=s;a+=Math.max(1,e)){const p=m(a);r.push({value:p,label:p})}return r},Q=(e,t)=>{const o=[];return(e?c(e).meridiem==="PM":!1)||o.push({value:"AM",label:"AM"}),(t?c(t).meridiem==="AM":!1)||o.push({value:"PM",label:"PM"}),o},P={id:"hours",getLabel:e=>e.locale.timePicker.hoursLabel,getOptions:e=>K(e.min,e.max,e.clock==="12h"?f.getSelectedOptionValue(e)??f.getOptions(e)[0].value:void 0),getSelectedOptionValue:e=>e.value?c(e.value).hourStr:void 0,updatedValue:(e,t)=>{if(e.value){const{minuteStr:o,secondStr:i}=c(e.value);return`${t}:${o}:${i}`}else return`${t}:00:00`}},w={id:"minutes",getLabel:e=>e.locale.timePicker.minutesLabel,getOptions:e=>G(e.minutesStep,e.value,e.min,e.max),getSelectedOptionValue:e=>e.value?c(e.value).minuteStr:void 0,updatedValue:(e,t)=>{if(e.value){const{hourStr:o,secondStr:i}=c(e.value);return`${o}:${t}:${i}`}else return`00:${t}:00`}},x={id:"seconds",getLabel:e=>e.locale.timePicker.secondsLabel,getOptions:e=>J(e.secondsStep,e.value,e.min,e.max),getSelectedOptionValue:e=>e.value?c(e.value).secondStr:void 0,updatedValue:(e,t)=>{if(e.value){const{hourStr:o,minuteStr:i}=c(e.value);return`${o}:${i}:${t}`}else return`00:00:${t}`}},f={id:"meridies",getLabel:e=>e.locale.timePicker.meridiesLabel,getOptions:e=>Q(e.min,e.max),getSelectedOptionValue:e=>e.value?c(e.value).meridiem:void 0,updatedValue:(e,t)=>{if(e.value){const{hours:o,minuteStr:i,secondStr:r}=c(e.value);let n=o;return t==="AM"&&o>=12?n-=12:t==="PM"&&o<12&&(n+=12),`${m(n)}:${i}:${r}`}else return t==="AM"?"00:00:00":"12:00:00"}},V=e=>e.secondsStep!==void 0,M=e=>e.clock==="12h",X=(e,t,o)=>{E(e,t.updatedValue(e,o)),h(e,t.id,o,"start");const n=e.shadowRoot.querySelector(`#${t.id}`)?.closest(".picker-wrapper")?.nextElementSibling?.querySelector(".picker");n?n.focus():e.$emit("last-column-selected",void 0,{bubbles:!1})},Y=(e,t,o)=>{const i=t.getOptions(e),r=t.getSelectedOptionValue(e),n={ArrowUp:-1,ArrowDown:1}[o.key];if(n){o.preventDefault();const s=i.findIndex(k=>k.value===r),p=((s===-1?0:s+n)+i.length)%i.length,d=i[p].value;E(e,t.updatedValue(e,d)),h(e,t.id,d,"nearest"),e._clearFocusedClasses()}return!0},h=(e,t,o,i)=>{const r=e.shadowRoot.querySelector(`#${t}-${o}`);r&&N.scrollIntoView(r,r.parentElement,i)},Z=(e,t)=>{if(t.key==="Tab"){const o=e.shadowRoot.querySelectorAll(".picker"),i=t.shiftKey?o[0]:o[o.length-1];e.shadowRoot.activeElement!==i&&H.ignoreEventInFocusTraps(t),e._applyFocusedClass()}return!0},E=(e,t)=>{e.$emit("change",t,{bubbles:!1,composed:!1})},_=e=>l.html`<div class="picker-wrapper">
|
|
2
2
|
<ul
|
|
3
3
|
id="${e.id}"
|
|
4
4
|
class="picker"
|
|
@@ -6,31 +6,31 @@
|
|
|
6
6
|
tabindex="0"
|
|
7
7
|
aria-label="${e.getLabel}"
|
|
8
8
|
aria-activedescendant="${t=>e.getSelectedOptionValue(t)?`${e.id}-${e.getSelectedOptionValue(t)}`:void 0}"
|
|
9
|
-
@keydown="${(t,o)=>
|
|
9
|
+
@keydown="${(t,o)=>Y(t,e,o.event)}"
|
|
10
10
|
>
|
|
11
|
-
${
|
|
11
|
+
${R.repeat(t=>e.getOptions(t),l.html`<li
|
|
12
12
|
id="${t=>`${e.id}-${t.value}`}"
|
|
13
|
-
class="${(t,o)=>
|
|
13
|
+
class="${(t,o)=>j.classNames("option",["selected",e.getSelectedOptionValue(o.parent)===t.value])}"
|
|
14
14
|
aria-selected="${(t,o)=>e.getSelectedOptionValue(o.parent)===t.value}"
|
|
15
15
|
role="option"
|
|
16
|
-
@click="${(t,o)=>
|
|
16
|
+
@click="${(t,o)=>X(o.parent,e,t.value)}"
|
|
17
17
|
>
|
|
18
18
|
${t=>t.label}
|
|
19
19
|
</li>`)}
|
|
20
20
|
</ul>
|
|
21
|
-
</div>`,
|
|
21
|
+
</div>`,ee=()=>l.html`<div
|
|
22
22
|
class="time-pickers"
|
|
23
|
-
@keydown="${(e,{event:t})=>
|
|
23
|
+
@keydown="${(e,{event:t})=>Z(e,t)}"
|
|
24
24
|
@focusout="${e=>e._onFocusOut()}"
|
|
25
25
|
@pointerdown="${e=>e._onPointerDown()}"
|
|
26
26
|
>
|
|
27
27
|
${_(P)} ${_(w)}
|
|
28
|
-
${C.when(
|
|
29
|
-
${C.when(
|
|
30
|
-
</div>`;var ee=Object.defineProperty,v=(e,t,o,i)=>{for(var r=void 0,n=e.length-1,s;n>=0;n--)(s=e[n])&&(r=s(t,o,r)||r);return r&&ee(t,o,r),r};class u extends j.Localized(l.VividElement){constructor(){super(...arguments),this.minutesStep=1,this.clock="24h",this.focusedPickerClass="focused",this._onFocusOut=()=>{this._clearFocusedClasses()},this._onPointerDown=()=>{this._clearFocusedClasses()}}valueChanged(t,o){o!==void 0&&!S(o)&&(this.value=void 0)}scrollSelectedOptionsToTop(){P.getSelectedOptionValue(this)&&h(this,"hours",P.getSelectedOptionValue(this),"start"),w.getSelectedOptionValue(this)&&h(this,"minutes",w.getSelectedOptionValue(this),"start"),M(this)&&x.getSelectedOptionValue(this)&&h(this,"seconds",x.getSelectedOptionValue(this),"start"),E(this)&&f.getSelectedOptionValue(this)&&h(this,"meridies",f.getSelectedOptionValue(this),"start")}focus(t){this.shadowRoot.querySelector(".picker").focus(t),this._applyFocusedClass()}_applyFocusedClass(){const t=this.shadowRoot.querySelectorAll(".picker");requestAnimationFrame(()=>{const o=this.shadowRoot.activeElement;t.forEach(i=>{i===o?i.parentElement?.classList.add(this.focusedPickerClass):i.parentElement?.classList.remove(this.focusedPickerClass)})})}_clearFocusedClasses(){this.shadowRoot.querySelectorAll(".picker").forEach(o=>{o.parentElement?.classList.remove(this.focusedPickerClass)})}}v([l.observable],u.prototype,"value");v([l.observable],u.prototype,"minutesStep");v([l.observable],u.prototype,"secondsStep");v([l.observable],u.prototype,"clock");v([l.observable],u.prototype,"min");v([l.observable],u.prototype,"max");const te=':host{display:inline-block}.time-pickers{display:flex;overflow:hidden;justify-content:center;padding:4px;block-size:calc(28px * var(--_inline-time-picker-num-options-visible) + 4px * (var(--_inline-time-picker-num-options-visible) - 1));gap:4px}.time-pickers .picker-wrapper{position:relative;display:flex;flex-direction:column;border-radius:4px}.time-pickers .picker-wrapper.focused:has(.picker:focus-visible){--focus-stroke-gap-color: transparent;--focus-inset: -2px;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.time-pickers .picker{position:relative;display:flex;overflow:hidden scroll;flex-direction:column;padding:0 4px;border-radius:4px;margin:0 -4px;gap:4px;inline-size:50px;list-style:none;scrollbar-width:none}@media (hover: hover){.time-pickers .picker:hover{scrollbar-width:auto}}.time-pickers .picker:after{display:block;flex-shrink:0;block-size:calc(28px * (var(--_inline-time-picker-num-options-visible) - 1) + 4px * (var(--_inline-time-picker-num-options-visible) - 1 - 1));content:""}.time-pickers .picker:focus-visible{outline:none}.time-pickers .option{--_connotation-color-primary: var(--vvd-time-picker-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-firm: var(--vvd-time-picker-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-time-picker-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-time-picker-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-dim: var(--vvd-time-picker-accent-dim, var(--vvd-color-neutral-200));--_connotation-color-pale: var(--vvd-time-picker-accent-pale, var(--vvd-color-neutral-300))}.time-pickers .option{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media (hover: hover){.time-pickers .option:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.time-pickers .option.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.time-pickers .option:active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .option.active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .option.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}@media (hover: hover){.time-pickers .option.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}}.time-pickers .option.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.time-pickers .option.selected:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}.time-pickers .option.selected.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}.time-pickers .option{display:flex;flex-shrink:0;align-items:center;justify-content:center;border-radius:4px;background-color:var(--_appearance-color-fill);block-size:28px;color:var(--_appearance-color-text);cursor:pointer;font:var(--vvd-typography-base);inline-size:50px}.time-pickers .picker-wrapper:not(.focused) .picker:focus-visible .option.selected{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}',oe=l.defineVividComponent("inline-time-picker",u,Z,[],{styles:te,shadowOptions:{delegatesFocus:!0}}),L=(e,t,o)=>{const i=c(e);let n=`${m(o?V(i.hours):i.hours)}:${i.minuteStr}`;return t&&(n+=`:${i.secondStr}`),o&&(n+=` ${i.meridiem}`),n},T=e=>e>="0"&&e<="9",F=(e,t)=>{const o=e.toLowerCase(),i=[];let r;for(let p=0;p<o.length;p++){const d=o[p];if(d==="a"&&o[p+1]==="m"&&(p++,r="AM"),d==="p"&&o[p+1]==="m"&&(p++,r="PM"),T(d)){let k=d;for(;T(o[p+1]);)p++,k+=o[p];i.push(Number.parseInt(k,10))}}if(i.length===0||i.length>3)throw new Error("Invalid time format");if(r&&(i[0]<1||i[0]>12))throw new Error("Invalid time format");(r||t)&&i[0]===12&&(i[0]=0),r==="PM"&&(i[0]=i[0]+12);const[n,s=0,a=0]=i;if(n>23||s>59||a>59)throw new Error("Invalid value");return[n,s,a].map(m).join(":")};var ie=Object.defineProperty,re=Object.getOwnPropertyDescriptor,b=(e,t,o,i)=>{for(var r=i>1?void 0:i?re(t,o):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(r=(i?s(t,o,r):s(r))||r);return i&&r&&ie(t,o,r),r};const q=e=>{class t extends e{constructor(){super(...arguments),this.minutesStep=null,this.secondsStep=null,this.#t={handleChange:()=>{this.value&&(this._presentationValue=this._toPresentationValue(this.value))}}}get _displaySeconds(){return this.secondsStep!==null}get _use12hClock(){return this.clock?this.clock==="12h":this.locale.timePicker.defaultTo12HourClock}get _timePlaceholder(){let i="hh:mm";return this._displaySeconds&&(i+=":ss"),this._use12hClock&&(i+=" aa"),i}#t;#e;#o(){this.#e=l.Observable.binding(()=>this._use12hClock,this.#t),this.#e.observe(this,l.ExecutionContext.default)}#i(){this.#e.dispose()}connectedCallback(){super.connectedCallback(),this.#o()}disconnectedCallback(){super.disconnectedCallback(),this.#i()}_onPickerButtonClick(){super._onPickerButtonClick(),this._popupOpen&&(l.Updates.process(),this._inlineTimePickerEl.scrollSelectedOptionsToTop())}_onInlineTimePickerChange(i){this._updateValueDueToUserInteraction(this._withUpdatedTime(i.detail),!1)}_onInlineTimePickerLastColumnSelected(){this._closePopup()}}return b([l.attr({attribute:"minutes-step",converter:l.nullableNumberConverter})],t.prototype,"minutesStep",2),b([l.attr({attribute:"seconds-step",converter:l.nullableNumberConverter})],t.prototype,"secondsStep",2),b([l.attr],t.prototype,"clock",2),b([l.volatile],t.prototype,"_use12hClock",1),t};var ne=Object.defineProperty,A=(e,t,o,i)=>{for(var r=void 0,n=e.length-1,s;n>=0;n--)(s=e[n])&&(r=s(t,o,r)||r);return r&&ne(t,o,r),r};const y={fromView:e=>e&&S(e)?e:"",toView(e){return e}};class $ extends q(D.SingleValuePicker(O.PickerField)){constructor(){super(),this._isValidValue=S,this.min="",this.max="",this.proxy.type="time",this.proxy.step="1"}_toPresentationValue(t){return L(t,this._displaySeconds,this._use12hClock)}_parsePresentationValue(t){return F(t,this._use12hClock)}get _timeValue(){return this.value}_withUpdatedTime(t){return t}get _resolvedMinTime(){return this.min||null}get _resolvedMaxTime(){return this.max||null}minChanged(t,o){this.proxy instanceof HTMLInputElement&&(this.proxy.min=o,this.validate())}maxChanged(t,o){this.proxy instanceof HTMLInputElement&&(this.proxy.max=o,this.validate())}get _textFieldPlaceholder(){return this._timePlaceholder}get _pickerButtonIcon(){return"clock-line"}get _pickerButtonLabel(){return this.value?this.locale.timePicker.changeTimeLabel(this._toPresentationValue(this.value)):this.locale.timePicker.chooseTimeLabel}_onPickerButtonClick(){super._onPickerButtonClick(),this._popupOpen&&(l.Updates.process(),this._focusableElsWithinDialog()[0]?.focus())}get _dialogLabel(){return this.locale.timePicker.chooseTimeLabel}_focusableElsWithinDialog(){return this._dialogEl.querySelectorAll("#inline-time-picker, .vwc-button")}_getCustomValidationError(){return this._isPresentationValueInvalid()?this.locale.timePicker.invalidTimeError:null}}A([l.attr({converter:y})],$.prototype,"min");A([l.attr({converter:y})],$.prototype,"max");const se=(e,t)=>{const o=e.tagFor(u);return l.html`
|
|
28
|
+
${C.when(V,_(x))}
|
|
29
|
+
${C.when(M,_(f))}
|
|
30
|
+
</div>`;var te=Object.defineProperty,v=(e,t,o,i)=>{for(var r=void 0,n=e.length-1,s;n>=0;n--)(s=e[n])&&(r=s(t,o,r)||r);return r&&te(t,o,r),r};class u extends z.Localized(l.VividElement){constructor(){super(...arguments),this.minutesStep=1,this.clock="24h",this.focusedPickerClass="focused",this._onFocusOut=()=>{this._clearFocusedClasses()},this._onPointerDown=()=>{this._clearFocusedClasses()}}valueChanged(t,o){o!==void 0&&!S(o)&&(this.value=void 0)}scrollSelectedOptionsToTop(){P.getSelectedOptionValue(this)&&h(this,"hours",P.getSelectedOptionValue(this),"start"),w.getSelectedOptionValue(this)&&h(this,"minutes",w.getSelectedOptionValue(this),"start"),V(this)&&x.getSelectedOptionValue(this)&&h(this,"seconds",x.getSelectedOptionValue(this),"start"),M(this)&&f.getSelectedOptionValue(this)&&h(this,"meridies",f.getSelectedOptionValue(this),"start")}focus(t){this.shadowRoot.querySelector(".picker").focus(t),this._applyFocusedClass()}_applyFocusedClass(){const t=this.shadowRoot.querySelectorAll(".picker");requestAnimationFrame(()=>{const o=this.shadowRoot.activeElement;t.forEach(i=>{i===o?i.parentElement?.classList.add(this.focusedPickerClass):i.parentElement?.classList.remove(this.focusedPickerClass)})})}_clearFocusedClasses(){this.shadowRoot.querySelectorAll(".picker").forEach(o=>{o.parentElement?.classList.remove(this.focusedPickerClass)})}}v([l.observable],u.prototype,"value");v([l.observable],u.prototype,"minutesStep");v([l.observable],u.prototype,"secondsStep");v([l.observable],u.prototype,"clock");v([l.observable],u.prototype,"min");v([l.observable],u.prototype,"max");const oe=':host{display:inline-block}.time-pickers{display:flex;overflow:hidden;justify-content:center;padding:4px;block-size:calc(28px * var(--_inline-time-picker-num-options-visible) + 4px * (var(--_inline-time-picker-num-options-visible) - 1));gap:4px}.time-pickers .picker-wrapper{position:relative;display:flex;flex-direction:column;border-radius:4px}.time-pickers .picker-wrapper.focused:has(.picker:focus-visible){--focus-stroke-gap-color: transparent;--focus-inset: -2px;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.time-pickers .picker{position:relative;display:flex;overflow:hidden scroll;flex-direction:column;padding:0 4px;border-radius:4px;margin:0 -4px;gap:4px;inline-size:50px;list-style:none;scrollbar-width:none}@media (hover: hover){.time-pickers .picker:hover{scrollbar-width:auto}}.time-pickers .picker:after{display:block;flex-shrink:0;block-size:calc(28px * (var(--_inline-time-picker-num-options-visible) - 1) + 4px * (var(--_inline-time-picker-num-options-visible) - 1 - 1));content:""}.time-pickers .picker:focus-visible{outline:none}.time-pickers .option{--_connotation-color-primary: var(--vvd-time-picker-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-firm: var(--vvd-time-picker-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-time-picker-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-time-picker-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-dim: var(--vvd-time-picker-accent-dim, var(--vvd-color-neutral-200));--_connotation-color-pale: var(--vvd-time-picker-accent-pale, var(--vvd-color-neutral-300))}.time-pickers .option{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media (hover: hover){.time-pickers .option:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.time-pickers .option.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.time-pickers .option:active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .option.active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .option.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}@media (hover: hover){.time-pickers .option.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}}.time-pickers .option.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.time-pickers .option.selected:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}.time-pickers .option.selected.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}.time-pickers .option{display:flex;flex-shrink:0;align-items:center;justify-content:center;border-radius:4px;background-color:var(--_appearance-color-fill);block-size:28px;color:var(--_appearance-color-text);cursor:pointer;font:var(--vvd-typography-base);inline-size:50px}.time-pickers .picker-wrapper:not(.focused) .picker:focus-visible .option.selected{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}',ie=l.defineVividComponent("inline-time-picker",u,ee,[],{styles:oe,shadowOptions:{delegatesFocus:!0}}),I=(e,t,o)=>{const i=c(e);let n=`${m(o?O(i.hours):i.hours)}:${i.minuteStr}`;return t&&(n+=`:${i.secondStr}`),o&&(n+=` ${i.meridiem}`),n},T=e=>e>="0"&&e<="9",L=(e,t)=>{const o=e.toLowerCase(),i=[];let r;for(let p=0;p<o.length;p++){const d=o[p];if(d==="a"&&o[p+1]==="m"&&(p++,r="AM"),d==="p"&&o[p+1]==="m"&&(p++,r="PM"),T(d)){let k=d;for(;T(o[p+1]);)p++,k+=o[p];i.push(Number.parseInt(k,10))}}if(i.length===0||i.length>3)throw new Error("Invalid time format");if(r&&(i[0]<1||i[0]>12))throw new Error("Invalid time format");(r||t)&&i[0]===12&&(i[0]=0),r==="PM"&&(i[0]=i[0]+12);const[n,s=0,a=0]=i;if(n>23||s>59||a>59)throw new Error("Invalid value");return[n,s,a].map(m).join(":")};var re=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,b=(e,t,o,i)=>{for(var r=i>1?void 0:i?ne(t,o):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(r=(i?s(t,o,r):s(r))||r);return i&&r&&re(t,o,r),r};const F=e=>{class t extends e{constructor(){super(...arguments),this.minutesStep=null,this.secondsStep=null,this.#t={handleChange:()=>{this.value&&(this._presentationValue=this._toPresentationValue(this.value))}}}get _displaySeconds(){return this.secondsStep!==null}get _use12hClock(){return this.clock?this.clock==="12h":this.locale.timePicker.defaultTo12HourClock}get _timePlaceholder(){let i="hh:mm";return this._displaySeconds&&(i+=":ss"),this._use12hClock&&(i+=" aa"),i}#t;#e;#o(){this.#e=l.Observable.binding(()=>this._use12hClock,this.#t),this.#e.observe(this,l.ExecutionContext.default)}#i(){this.#e.dispose()}connectedCallback(){super.connectedCallback(),this.#o()}disconnectedCallback(){super.disconnectedCallback(),this.#i()}_onPickerButtonClick(){super._onPickerButtonClick(),this._popupOpen&&(l.Updates.process(),this._inlineTimePickerEl.scrollSelectedOptionsToTop())}_onInlineTimePickerChange(i){this._updateValueDueToUserInteraction(this._withUpdatedTime(i.detail),!1)}_onInlineTimePickerLastColumnSelected(){this._closePopup()}}return b([l.attr({attribute:"minutes-step",converter:l.nullableNumberConverter})],t.prototype,"minutesStep",2),b([l.attr({attribute:"seconds-step",converter:l.nullableNumberConverter})],t.prototype,"secondsStep",2),b([l.attr],t.prototype,"clock",2),b([l.volatile],t.prototype,"_use12hClock",1),t};var se=Object.defineProperty,q=(e,t,o,i)=>{for(var r=void 0,n=e.length-1,s;n>=0;n--)(s=e[n])&&(r=s(t,o,r)||r);return r&&se(t,o,r),r};const y={fromView:e=>e&&S(e)?e:"",toView(e){return e}};class $ extends F(D.SingleValuePicker(A.PickerField)){constructor(){super(),this._isValidValue=S,this.min="",this.max="",this.proxy.type="time",this.proxy.step="1"}_toPresentationValue(t){return I(t,this._displaySeconds,this._use12hClock)}_parsePresentationValue(t){return L(t,this._use12hClock)}get _timeValue(){return this.value}_withUpdatedTime(t){return t}get _resolvedMinTime(){return this.min||null}get _resolvedMaxTime(){return this.max||null}minChanged(t,o){this.proxy instanceof HTMLInputElement&&(this.proxy.min=o,this.validate())}maxChanged(t,o){this.proxy instanceof HTMLInputElement&&(this.proxy.max=o,this.validate())}get _textFieldPlaceholder(){return this._timePlaceholder}get _pickerButtonIcon(){return"clock-line"}get _pickerButtonLabel(){return this.value?this.locale.timePicker.changeTimeLabel(this._toPresentationValue(this.value)):this.locale.timePicker.chooseTimeLabel}_onPickerButtonClick(){super._onPickerButtonClick(),this._popupOpen&&(l.Updates.process(),this._focusableElsWithinDialog()[0]?.focus())}get _dialogLabel(){return this.locale.timePicker.chooseTimeLabel}_focusableElsWithinDialog(){return this._dialogEl.querySelectorAll("#inline-time-picker, .vwc-button")}_getCustomValidationError(){return this._isPresentationValueInvalid()?this.locale.timePicker.invalidTimeError:null}}q([l.attr({converter:y})],$.prototype,"min");q([l.attr({converter:y})],$.prototype,"max");const ae=(e,t)=>{const o=e.tagFor(u);return l.html`
|
|
31
31
|
<${o}
|
|
32
32
|
id='inline-time-picker'
|
|
33
|
-
${
|
|
33
|
+
${B.ref("_inlineTimePickerEl")}
|
|
34
34
|
style="--_inline-time-picker-num-options-visible: ${()=>t}"
|
|
35
35
|
tabindex='1'
|
|
36
36
|
:value='${i=>i._timeValue||void 0}'
|
|
@@ -43,4 +43,4 @@
|
|
|
43
43
|
@last-column-selected='${i=>i._onInlineTimePickerLastColumnSelected()}'
|
|
44
44
|
>
|
|
45
45
|
</${o}>
|
|
46
|
-
`};exports.TimePicker=$;exports.TimeSelectionPicker=
|
|
46
|
+
`};exports.TimePicker=$;exports.TimeSelectionPicker=F;exports.TimeSelectionPickerTemplate=ae;exports.ValidTimeFilter=y;exports.compareTimeStr=U;exports.formatPresentationTime=I;exports.inlineTimePickerDefinition=ie;exports.isValidTimeStr=S;exports.parsePresentationTime=L;
|