@vonage/vivid 4.17.0 → 4.18.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/custom-elements.json +3903 -3860
- package/date-time-picker/index.cjs +5 -0
- package/date-time-picker/index.js +3 -0
- package/dial-pad/index.cjs +1 -1
- package/dial-pad/index.js +1 -1
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.cjs +1 -1
- package/empty-state/index.js +1 -1
- package/fab/index.cjs +1 -1
- package/fab/index.js +1 -1
- package/file-picker/index.cjs +1 -1
- package/file-picker/index.js +1 -1
- package/header/index.cjs +1 -1
- package/header/index.js +1 -1
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -1
- package/index.cjs +136 -133
- package/index.js +45 -44
- package/layout/index.cjs +1 -1
- package/layout/index.js +1 -1
- package/lib/action-group/action-group.d.ts +449 -3
- package/lib/banner/banner.d.ts +449 -3
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +449 -1
- package/lib/checkbox/checkbox.d.ts +449 -4
- package/lib/components.d.ts +1 -0
- package/lib/date-picker/date-picker.d.ts +2182 -4
- package/lib/date-picker/date-picker.template.d.ts +2 -0
- package/lib/date-range-picker/date-range-picker.d.ts +1110 -4
- package/lib/date-range-picker/date-range-picker.template.d.ts +2 -0
- package/lib/date-time-picker/date-time-picker.d.ts +2175 -0
- package/lib/date-time-picker/date-time-picker.template.d.ts +2 -0
- package/lib/date-time-picker/definition.d.ts +1 -0
- package/lib/date-time-picker/locale.d.ts +9 -0
- package/lib/dialog/dialog.d.ts +449 -2
- package/lib/divider/divider.d.ts +448 -1
- package/lib/menu/menu.d.ts +446 -1
- package/lib/nav-disclosure/nav-disclosure.d.ts +449 -2
- package/lib/number-field/number-field.d.ts +450 -3
- package/lib/option/option.d.ts +1 -11
- package/lib/progress/progress.d.ts +449 -2
- package/lib/progress-ring/progress-ring.d.ts +449 -2
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +1 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +7 -4
- package/lib/select/select.d.ts +1 -5
- package/lib/selectable-box/selectable-box.d.ts +449 -2
- package/lib/slider/slider.d.ts +449 -3
- package/lib/split-button/split-button.d.ts +449 -3
- package/lib/switch/switch.d.ts +449 -2
- package/lib/tag-group/tag-group.d.ts +449 -2
- package/lib/text-anchor/text-anchor.d.ts +449 -1
- package/lib/text-area/text-area.d.ts +450 -3
- package/lib/text-field/text-field.d.ts +450 -7
- package/lib/time-picker/locale.d.ts +0 -2
- package/lib/time-picker/time-picker.d.ts +1053 -9
- package/lib/time-picker/time-picker.template.d.ts +2 -1
- package/locales/de-DE.cjs +29 -5
- package/locales/de-DE.js +29 -5
- package/locales/en-GB.cjs +29 -5
- package/locales/en-GB.js +29 -5
- package/locales/en-US.cjs +29 -5
- package/locales/en-US.js +29 -5
- package/locales/ja-JP.cjs +29 -5
- package/locales/ja-JP.js +29 -5
- package/locales/zh-CN.cjs +29 -5
- package/locales/zh-CN.js +29 -5
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +1 -1
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.cjs +1 -1
- package/note/index.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/index.cjs +1 -1
- package/progress/index.js +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/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +1 -1
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/Reflector.cjs +71 -0
- package/shared/Reflector.js +69 -0
- package/shared/affix.cjs +1 -1
- package/shared/affix.js +1 -1
- package/shared/anchor.cjs +0 -10
- package/shared/anchor.js +0 -10
- package/shared/aria/delegates-aria.d.ts +454 -0
- package/shared/base-progress.js +1 -1
- package/shared/breadcrumb-item.cjs +2 -1
- package/shared/breadcrumb-item.js +2 -1
- package/shared/button.cjs +2 -13
- package/shared/button.js +2 -13
- package/shared/{presentationDate.cjs → calendar-picker.template.cjs} +730 -900
- package/shared/{presentationDate.js → calendar-picker.template.js} +672 -845
- package/shared/datetime/dateTimeStr.d.ts +6 -0
- package/shared/datetime/presentationDate.d.ts +4 -0
- package/shared/{date-picker/calendar → datetime}/presentationDateRange.d.ts +3 -3
- package/shared/datetime/presentationDateTime.d.ts +4 -0
- package/{lib/time-picker/time → shared/datetime}/time.d.ts +1 -0
- package/shared/definition.cjs +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition11.cjs +8 -11
- package/shared/definition11.js +8 -11
- package/shared/definition14.cjs +2 -2
- package/shared/definition14.js +2 -2
- package/shared/definition15.cjs +3 -10
- package/shared/definition15.js +3 -10
- package/shared/definition16.cjs +29 -33
- package/shared/definition16.js +29 -33
- package/shared/definition17.cjs +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition18.cjs +56 -91
- package/shared/definition18.js +56 -91
- package/shared/definition19.cjs +68 -32
- package/shared/definition19.js +58 -22
- package/shared/definition20.cjs +253 -220
- package/shared/definition20.js +254 -220
- package/shared/definition21.cjs +200 -286
- package/shared/definition21.js +198 -284
- package/shared/definition22.cjs +302 -31
- package/shared/definition22.js +301 -30
- package/shared/definition23.cjs +37 -58
- package/shared/definition23.js +36 -57
- package/shared/definition24.cjs +50 -70
- package/shared/definition24.js +49 -69
- package/shared/definition25.cjs +75 -2475
- package/shared/definition25.js +74 -2475
- package/shared/definition26.cjs +2480 -50
- package/shared/definition26.js +2479 -48
- package/shared/definition27.cjs +53 -271
- package/shared/definition27.js +52 -269
- package/shared/definition28.cjs +271 -48
- package/shared/definition28.js +269 -47
- package/shared/definition29.cjs +37 -764
- package/shared/definition29.js +36 -758
- package/shared/definition3.cjs +2 -9
- package/shared/definition3.js +2 -9
- package/shared/definition30.cjs +739 -57
- package/shared/definition30.js +733 -56
- package/shared/definition31.cjs +93 -22
- package/shared/definition31.js +92 -21
- package/shared/definition32.cjs +28 -10
- package/shared/definition32.js +27 -9
- package/shared/definition33.cjs +10 -52
- package/shared/definition33.js +9 -51
- package/shared/definition34.cjs +30 -411
- package/shared/definition34.js +30 -412
- package/shared/definition35.cjs +422 -52
- package/shared/definition35.js +423 -53
- package/shared/definition36.cjs +53 -216
- package/shared/definition36.js +53 -215
- package/shared/definition37.cjs +201 -71
- package/shared/definition37.js +200 -70
- package/shared/definition38.cjs +53 -48
- package/shared/definition38.js +51 -46
- package/shared/definition39.cjs +57 -263
- package/shared/definition39.js +56 -262
- package/shared/definition4.cjs +2 -2
- package/shared/definition4.js +2 -2
- package/shared/definition40.cjs +220 -148
- package/shared/definition40.js +220 -148
- package/shared/definition41.cjs +143 -567
- package/shared/definition41.js +143 -568
- package/shared/definition42.cjs +596 -12573
- package/shared/definition42.js +596 -12573
- package/shared/definition43.cjs +13489 -1058
- package/shared/definition43.js +13489 -1059
- package/shared/definition44.cjs +936 -698
- package/shared/definition44.js +937 -698
- package/shared/definition45.cjs +850 -105
- package/shared/definition45.js +850 -104
- package/shared/definition46.cjs +110 -90
- package/shared/definition46.js +108 -88
- package/shared/definition47.cjs +88 -464
- package/shared/definition47.js +87 -463
- package/shared/definition48.cjs +457 -111
- package/shared/definition48.js +456 -110
- package/shared/definition49.cjs +103 -109
- package/shared/definition49.js +102 -108
- package/shared/definition5.cjs +3 -3
- package/shared/definition5.js +3 -3
- package/shared/definition50.cjs +136 -14
- package/shared/definition50.js +135 -13
- package/shared/definition51.cjs +16 -115
- package/shared/definition51.js +15 -114
- package/shared/definition52.cjs +79 -486
- package/shared/definition52.js +78 -485
- package/shared/definition53.cjs +503 -24
- package/shared/definition53.js +502 -23
- package/shared/definition54.cjs +23 -137
- package/shared/definition54.js +22 -136
- package/shared/definition55.cjs +96 -241
- package/shared/definition55.js +95 -241
- package/shared/definition56.cjs +261 -61
- package/shared/definition56.js +260 -60
- package/shared/definition57.cjs +419 -788
- package/shared/definition57.js +420 -789
- package/shared/definition58.cjs +27 -144
- package/shared/definition58.js +27 -143
- package/shared/definition59.cjs +83 -54
- package/shared/definition59.js +82 -53
- package/shared/definition6.cjs +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition60.cjs +80 -165
- package/shared/definition60.js +79 -163
- package/shared/definition61.cjs +143 -230
- package/shared/definition61.js +141 -229
- package/shared/definition62.cjs +233 -69344
- package/shared/definition62.js +232 -69343
- package/shared/definition63.cjs +69381 -28
- package/shared/definition63.js +69379 -26
- package/shared/definition64.cjs +28 -2168
- package/shared/definition64.js +27 -2166
- package/shared/definition65.cjs +2195 -0
- package/shared/definition65.js +2190 -0
- package/shared/definition7.cjs +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +3 -9
- package/shared/definition8.js +3 -9
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +1 -1
- package/shared/delegates-aria.cjs +69 -0
- package/shared/delegates-aria.js +67 -0
- package/shared/form-associated.js +1 -1
- package/shared/form-elements.cjs +1 -1
- package/shared/form-elements.js +1 -1
- package/shared/foundation/anchor/anchor.d.ts +0 -8
- package/shared/foundation/button/button.d.ts +449 -7
- package/shared/foundation/listbox/listbox.d.ts +0 -9
- package/shared/listbox.cjs +4 -30
- package/shared/listbox.js +4 -30
- package/shared/localization/Locale.d.ts +6 -2
- package/shared/option.cjs +1 -38
- package/shared/option.js +1 -38
- package/shared/picker-field/locale.d.ts +4 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +558 -0
- package/shared/{date-picker/locale.d.ts → picker-field/mixins/calendar-picker.locale.d.ts} +1 -3
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +555 -0
- package/shared/picker-field/mixins/calendar-segments/calendarGrid.d.ts +17 -0
- package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/monthPickerGrid.d.ts +3 -3
- package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/columns.d.ts +1 -1
- package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/inline-time-picker.d.ts +2 -2
- package/{lib/time-picker/time/picker.d.ts → shared/picker-field/mixins/inline-time-picker/picker-option.d.ts} +1 -1
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1110 -0
- package/shared/picker-field/mixins/single-date-picker.d.ts +1626 -0
- package/shared/picker-field/mixins/single-value-picker.d.ts +518 -0
- package/shared/picker-field/mixins/time-selection-picker.d.ts +1053 -0
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +1050 -0
- package/shared/picker-field/picker-field.d.ts +11 -0
- package/shared/picker-field/picker-field.form-associated.d.ts +11 -0
- package/shared/picker-field/picker-field.template.d.ts +7 -0
- package/shared/picker-field.template.cjs +315 -0
- package/shared/picker-field.template.js +310 -0
- package/shared/single-date-picker.cjs +46 -0
- package/shared/single-date-picker.js +44 -0
- package/shared/single-value-picker.cjs +77 -0
- package/shared/single-value-picker.js +75 -0
- package/shared/slider.template.cjs +3 -3
- package/shared/slider.template.js +3 -3
- package/shared/text-anchor.cjs +2 -1
- package/shared/text-anchor.js +2 -1
- package/shared/text-anchor.template.cjs +3 -5
- package/shared/text-anchor.template.js +3 -5
- package/shared/text-field.cjs +2 -555
- package/shared/text-field.js +2 -554
- package/shared/time-selection-picker.template.cjs +776 -0
- package/shared/time-selection-picker.template.js +767 -0
- package/shared/vivid-element.cjs +1 -1
- package/shared/vivid-element.js +1 -1
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +1 -1
- 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/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-anchor/index.cjs +1 -1
- package/text-anchor/index.js +1 -1
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- 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/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +105 -1152
- package/lib/time-picker/time-picker.form-associated.d.ts +0 -11
- package/shared/aria-global.cjs +0 -93
- package/shared/aria-global.js +0 -91
- package/shared/date-picker/calendar/calendarGrid.d.ts +0 -17
- package/shared/date-picker/calendar/presentationDate.d.ts +0 -4
- package/shared/date-picker/date-picker-base.d.ts +0 -21
- package/shared/date-picker/date-picker-base.form-associated.d.ts +0 -11
- package/shared/date-picker/date-picker-base.template.d.ts +0 -3
- package/shared/foundation/patterns/aria-global.d.ts +0 -21
- package/shared/foundation/patterns/index.d.ts +0 -1
- package/shared/text-field2.cjs +0 -5
- package/shared/text-field2.js +0 -3
- package/shared/trapped-focus.cjs +0 -35
- package/shared/trapped-focus.js +0 -33
- /package/shared/{date-picker/calendar → datetime}/dateRange.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/dateStr.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/month.d.ts +0 -0
- /package/{lib/time-picker/time → shared/datetime}/presentationTime.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/year.d.ts +0 -0
- /package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/segment.d.ts +0 -0
- /package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/definition.d.ts +0 -0
- /package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/inline-time-picker.template.d.ts +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormElementHelperText, Localized, TrappedFocus } from '../patterns';
|
|
2
|
+
import { FormAssociatedPickerField } from './picker-field.form-associated';
|
|
3
|
+
export declare abstract class PickerField extends FormAssociatedPickerField {
|
|
4
|
+
#private;
|
|
5
|
+
initialValue: string;
|
|
6
|
+
currentValue: string;
|
|
7
|
+
readOnly: boolean;
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
10
|
+
export interface PickerField extends Localized, FormElementHelperText, TrappedFocus {
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormAssociated } from '../foundation/form-associated/form-associated';
|
|
2
|
+
import { VividElement } from '../foundation/vivid-element/vivid-element';
|
|
3
|
+
declare class _PickerField extends VividElement {
|
|
4
|
+
}
|
|
5
|
+
interface _PickerField extends FormAssociated {
|
|
6
|
+
}
|
|
7
|
+
declare const FormAssociatedPickerField_base: typeof _PickerField;
|
|
8
|
+
export declare class FormAssociatedPickerField extends FormAssociatedPickerField_base {
|
|
9
|
+
proxy: HTMLInputElement;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ViewTemplate } from '@microsoft/fast-element';
|
|
2
|
+
import type { VividElementDefinitionContext } from '../design-system/defineVividComponent';
|
|
3
|
+
import { PickerField } from './picker-field';
|
|
4
|
+
export declare const PickerFieldTemplate: (context: VividElementDefinitionContext, popupContentTemplate: ViewTemplate, { withSeparator, padded }: {
|
|
5
|
+
withSeparator: boolean;
|
|
6
|
+
padded: boolean;
|
|
7
|
+
}) => ViewTemplate<PickerField, any>;
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
|
|
5
|
+
const formAssociated = require('./form-associated.cjs');
|
|
6
|
+
const vividElement = require('./vivid-element.cjs');
|
|
7
|
+
const formElements = require('./form-elements.cjs');
|
|
8
|
+
const localized = require('./localized.cjs');
|
|
9
|
+
const definition = require('./definition65.cjs');
|
|
10
|
+
const definition$1 = require('./definition57.cjs');
|
|
11
|
+
const definition$2 = require('./definition11.cjs');
|
|
12
|
+
const ref = require('./ref.cjs');
|
|
13
|
+
const slotted = require('./slotted.cjs');
|
|
14
|
+
const classNames = require('./class-names.cjs');
|
|
15
|
+
|
|
16
|
+
class TrappedFocus {
|
|
17
|
+
static {
|
|
18
|
+
this.ignoredEvents = /* @__PURE__ */ new WeakSet();
|
|
19
|
+
}
|
|
20
|
+
static ignoreEvent(event) {
|
|
21
|
+
this.ignoredEvents.add(event);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @returns Whether focus was trapped.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
_trappedFocus(event, getFocusableEls) {
|
|
28
|
+
if (!TrappedFocus.ignoredEvents.has(event) && event.key === "Tab") {
|
|
29
|
+
const focusableEls = getFocusableEls();
|
|
30
|
+
const firstFocusableEl = focusableEls[0];
|
|
31
|
+
const lastFocusableEl = focusableEls[focusableEls.length - 1];
|
|
32
|
+
if (event.shiftKey) {
|
|
33
|
+
if (this.shadowRoot.activeElement === firstFocusableEl) {
|
|
34
|
+
lastFocusableEl.focus();
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
if (this.shadowRoot.activeElement === lastFocusableEl) {
|
|
39
|
+
firstFocusableEl.focus();
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const pickerFieldStyles = ":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)}";
|
|
49
|
+
|
|
50
|
+
class _PickerField extends vividElement.VividElement {
|
|
51
|
+
}
|
|
52
|
+
class FormAssociatedPickerField extends formAssociated.FormAssociated(_PickerField) {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(...arguments);
|
|
55
|
+
this.proxy = document.createElement("input");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var __defProp = Object.defineProperty;
|
|
60
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
61
|
+
var result = void 0 ;
|
|
62
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
63
|
+
if (decorator = decorators[i])
|
|
64
|
+
result = (decorator(target, key, result) ) || result;
|
|
65
|
+
if (result) __defProp(target, key, result);
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
68
|
+
class PickerField extends FormAssociatedPickerField {
|
|
69
|
+
// --- Core ---
|
|
70
|
+
constructor() {
|
|
71
|
+
super();
|
|
72
|
+
this.readOnly = false;
|
|
73
|
+
this.#onFocusIn = () => {
|
|
74
|
+
this.$emit("focus", void 0, { bubbles: false });
|
|
75
|
+
};
|
|
76
|
+
this.#onFocusOut = () => {
|
|
77
|
+
this.$emit("blur", void 0, { bubbles: false });
|
|
78
|
+
};
|
|
79
|
+
// Reformat the presentation value when the locale changes
|
|
80
|
+
this.#localeChangeHandler = {
|
|
81
|
+
handleChange: () => {
|
|
82
|
+
this._updatePresentationValue();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
this._popupOpen = false;
|
|
86
|
+
this.#dismissOnClickOutside = (event) => {
|
|
87
|
+
if (!this._popupOpen) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const path = event.composedPath();
|
|
91
|
+
const elementsToIgnoreClicksOn = [this._dialogEl, this._pickerButtonEl];
|
|
92
|
+
if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
|
|
93
|
+
this._closePopup(false);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
this._presentationValue = "";
|
|
97
|
+
this.value = "";
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
readOnlyChanged() {
|
|
103
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
104
|
+
this.proxy.readOnly = this.readOnly;
|
|
105
|
+
this.validate();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
connectedCallback() {
|
|
112
|
+
super.connectedCallback();
|
|
113
|
+
document.addEventListener("click", this.#dismissOnClickOutside);
|
|
114
|
+
this.addEventListener("focusin", this.#onFocusIn);
|
|
115
|
+
this.addEventListener("focusout", this.#onFocusOut);
|
|
116
|
+
this.#startObservingLocaleChanges();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
disconnectedCallback() {
|
|
122
|
+
super.disconnectedCallback();
|
|
123
|
+
document.removeEventListener("click", this.#dismissOnClickOutside);
|
|
124
|
+
this.removeEventListener("focusin", this.#onFocusIn);
|
|
125
|
+
this.removeEventListener("focusout", this.#onFocusOut);
|
|
126
|
+
this.#stopObservingLocaleChanges();
|
|
127
|
+
}
|
|
128
|
+
#onFocusIn;
|
|
129
|
+
#onFocusOut;
|
|
130
|
+
/**
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
validate() {
|
|
134
|
+
if (this.proxy) {
|
|
135
|
+
this.proxy.setCustomValidity(this._getCustomValidationError() ?? "");
|
|
136
|
+
}
|
|
137
|
+
super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
|
|
138
|
+
}
|
|
139
|
+
#localeChangeHandler;
|
|
140
|
+
#localeChangeObserver;
|
|
141
|
+
#startObservingLocaleChanges() {
|
|
142
|
+
this.#localeChangeObserver = vividElement.Observable.binding(
|
|
143
|
+
() => this.locale,
|
|
144
|
+
this.#localeChangeHandler
|
|
145
|
+
);
|
|
146
|
+
this.#localeChangeObserver.observe(this, vividElement.defaultExecutionContext);
|
|
147
|
+
}
|
|
148
|
+
#stopObservingLocaleChanges() {
|
|
149
|
+
this.#localeChangeObserver.disconnect();
|
|
150
|
+
}
|
|
151
|
+
#dismissOnClickOutside;
|
|
152
|
+
#openPopupIfPossible() {
|
|
153
|
+
if (!this.readOnly) {
|
|
154
|
+
this._popupOpen = true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* @internal
|
|
159
|
+
*/
|
|
160
|
+
_closePopup(restoreFocusToTextField = true) {
|
|
161
|
+
this._popupOpen = false;
|
|
162
|
+
if (restoreFocusToTextField) {
|
|
163
|
+
this._textFieldEl.focus();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* On keydown anywhere in the picker.
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
170
|
+
_onBaseKeyDown(event) {
|
|
171
|
+
if (this._popupOpen && index.handleEscapeKeyAndStopPropogation(event)) {
|
|
172
|
+
this._closePopup();
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
if (this._trappedFocus(event, () => this._focusableElsWithinDialog())) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
183
|
+
_presentationValueChanged() {
|
|
184
|
+
this.dirtyValue = true;
|
|
185
|
+
this.validate();
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
_onTextFieldInput(event) {
|
|
191
|
+
const textField = event.currentTarget;
|
|
192
|
+
this._presentationValue = textField.value;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
|
+
_onPickerButtonClick() {
|
|
198
|
+
if (this._popupOpen) {
|
|
199
|
+
this._closePopup();
|
|
200
|
+
} else {
|
|
201
|
+
this.#openPopupIfPossible();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// --- Dialog footer ---
|
|
205
|
+
/**
|
|
206
|
+
* @internal
|
|
207
|
+
*/
|
|
208
|
+
_onOkClick() {
|
|
209
|
+
this._closePopup();
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* @internal
|
|
213
|
+
*/
|
|
214
|
+
_onClearClick() {
|
|
215
|
+
this._closePopup();
|
|
216
|
+
this.$emit("clear-click");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
__decorateClass([
|
|
220
|
+
vividElement.attr({ attribute: "value" })
|
|
221
|
+
], PickerField.prototype, "initialValue");
|
|
222
|
+
__decorateClass([
|
|
223
|
+
vividElement.attr({ attribute: "current-value" })
|
|
224
|
+
], PickerField.prototype, "currentValue");
|
|
225
|
+
__decorateClass([
|
|
226
|
+
vividElement.attr({ attribute: "readonly", mode: "boolean" })
|
|
227
|
+
], PickerField.prototype, "readOnly");
|
|
228
|
+
__decorateClass([
|
|
229
|
+
vividElement.observable
|
|
230
|
+
], PickerField.prototype, "_popupOpen");
|
|
231
|
+
__decorateClass([
|
|
232
|
+
vividElement.observable
|
|
233
|
+
], PickerField.prototype, "_presentationValue");
|
|
234
|
+
applyMixinsWithObservables.applyMixinsWithObservables(
|
|
235
|
+
PickerField,
|
|
236
|
+
localized.Localized,
|
|
237
|
+
formElements.FormElementHelperText,
|
|
238
|
+
TrappedFocus
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
const PickerFieldTemplate = (context, popupContentTemplate, { withSeparator, padded }) => {
|
|
242
|
+
const popupTag = context.tagFor(definition.Popup);
|
|
243
|
+
const textFieldTag = context.tagFor(definition$1.TextField);
|
|
244
|
+
const buttonTag = context.tagFor(definition$2.Button);
|
|
245
|
+
return vividElement.html`
|
|
246
|
+
<div class='base' @keydown='${(x, { event }) => x._onBaseKeyDown(event)}'>
|
|
247
|
+
<${textFieldTag} id='text-field'
|
|
248
|
+
${ref.ref("_textFieldEl")}
|
|
249
|
+
class='control'
|
|
250
|
+
label='${(x) => x.label}'
|
|
251
|
+
helper-text='${(x) => x.helperText}'
|
|
252
|
+
error-text='${(x) => x.errorValidationMessage}'
|
|
253
|
+
placeholder='${(x) => x._textFieldPlaceholder}'
|
|
254
|
+
size='${(x) => x._textFieldSize}'
|
|
255
|
+
current-value='${(x) => x._presentationValue}'
|
|
256
|
+
?disabled='${(x) => x.disabled}'
|
|
257
|
+
?readonly='${(x) => x.readOnly}'
|
|
258
|
+
@input='${(x, c) => x._onTextFieldInput(c.event)}'
|
|
259
|
+
@change='${(x) => x._onTextFieldChange()}'
|
|
260
|
+
>
|
|
261
|
+
<slot
|
|
262
|
+
slot='${(x) => x._helperTextSlottedContent?.length ? "helper-text" : void 0}'
|
|
263
|
+
name='helper-text'
|
|
264
|
+
${slotted.slotted("_helperTextSlottedContent")}
|
|
265
|
+
></slot>
|
|
266
|
+
<${buttonTag}
|
|
267
|
+
id='picker-button'
|
|
268
|
+
${ref.ref("_pickerButtonEl")}
|
|
269
|
+
slot='action-items'
|
|
270
|
+
size='condensed'
|
|
271
|
+
icon='${(x) => x._pickerButtonIcon}'
|
|
272
|
+
appearance='ghost'
|
|
273
|
+
?disabled='${(x) => x.disabled || x.readOnly}'
|
|
274
|
+
aria-label='${(x) => x._pickerButtonLabel}'
|
|
275
|
+
@click='${(x) => x._onPickerButtonClick()}'
|
|
276
|
+
></${buttonTag}>
|
|
277
|
+
</${textFieldTag}>
|
|
278
|
+
<${popupTag}
|
|
279
|
+
?open='${(x) => x._popupOpen}'
|
|
280
|
+
:anchor='${(x) => x._textFieldEl}'
|
|
281
|
+
placement='bottom-start'
|
|
282
|
+
class='popup'>
|
|
283
|
+
<div class="${() => classNames.classNames("dialog", [
|
|
284
|
+
"dialog--padded",
|
|
285
|
+
padded
|
|
286
|
+
])}" role='dialog' ${ref.ref(
|
|
287
|
+
"_dialogEl"
|
|
288
|
+
)} aria-modal='true' aria-label='${(x) => x._dialogLabel}'>
|
|
289
|
+
${() => popupContentTemplate}
|
|
290
|
+
<div class="${() => classNames.classNames("footer", ["footer--with-separator", withSeparator])}">
|
|
291
|
+
<${buttonTag}
|
|
292
|
+
tabindex='3'
|
|
293
|
+
class='vwc-button'
|
|
294
|
+
size='condensed'
|
|
295
|
+
label='${(x) => x.locale.pickerField.clearLabel}'
|
|
296
|
+
@click='${(x) => x._onClearClick()}'
|
|
297
|
+
></${buttonTag}>
|
|
298
|
+
<${buttonTag}
|
|
299
|
+
tabindex='3'
|
|
300
|
+
class='vwc-button'
|
|
301
|
+
size='condensed'
|
|
302
|
+
appearance='filled'
|
|
303
|
+
label='${(x) => x.locale.pickerField.okLabel}'
|
|
304
|
+
@click='${(x) => x._onOkClick()}'
|
|
305
|
+
></${buttonTag}>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
</${popupTag}>
|
|
309
|
+
</div>`;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
exports.PickerField = PickerField;
|
|
313
|
+
exports.PickerFieldTemplate = PickerFieldTemplate;
|
|
314
|
+
exports.TrappedFocus = TrappedFocus;
|
|
315
|
+
exports.pickerFieldStyles = pickerFieldStyles;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { h as handleEscapeKeyAndStopPropogation } from './index.js';
|
|
2
|
+
import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
|
|
3
|
+
import { F as FormAssociated } from './form-associated.js';
|
|
4
|
+
import { V as VividElement, O as Observable, i as defaultExecutionContext, a as attr, o as observable, h as html } from './vivid-element.js';
|
|
5
|
+
import { a as FormElementHelperText } from './form-elements.js';
|
|
6
|
+
import { L as Localized } from './localized.js';
|
|
7
|
+
import { P as Popup } from './definition65.js';
|
|
8
|
+
import { T as TextField } from './definition57.js';
|
|
9
|
+
import { B as Button } from './definition11.js';
|
|
10
|
+
import { r as ref } from './ref.js';
|
|
11
|
+
import { s as slotted } from './slotted.js';
|
|
12
|
+
import { c as classNames } from './class-names.js';
|
|
13
|
+
|
|
14
|
+
class TrappedFocus {
|
|
15
|
+
static {
|
|
16
|
+
this.ignoredEvents = /* @__PURE__ */ new WeakSet();
|
|
17
|
+
}
|
|
18
|
+
static ignoreEvent(event) {
|
|
19
|
+
this.ignoredEvents.add(event);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @returns Whether focus was trapped.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
_trappedFocus(event, getFocusableEls) {
|
|
26
|
+
if (!TrappedFocus.ignoredEvents.has(event) && event.key === "Tab") {
|
|
27
|
+
const focusableEls = getFocusableEls();
|
|
28
|
+
const firstFocusableEl = focusableEls[0];
|
|
29
|
+
const lastFocusableEl = focusableEls[focusableEls.length - 1];
|
|
30
|
+
if (event.shiftKey) {
|
|
31
|
+
if (this.shadowRoot.activeElement === firstFocusableEl) {
|
|
32
|
+
lastFocusableEl.focus();
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
if (this.shadowRoot.activeElement === lastFocusableEl) {
|
|
37
|
+
firstFocusableEl.focus();
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const pickerFieldStyles = ":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)}";
|
|
47
|
+
|
|
48
|
+
class _PickerField extends VividElement {
|
|
49
|
+
}
|
|
50
|
+
class FormAssociatedPickerField extends FormAssociated(_PickerField) {
|
|
51
|
+
constructor() {
|
|
52
|
+
super(...arguments);
|
|
53
|
+
this.proxy = document.createElement("input");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var __defProp = Object.defineProperty;
|
|
58
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
59
|
+
var result = void 0 ;
|
|
60
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
61
|
+
if (decorator = decorators[i])
|
|
62
|
+
result = (decorator(target, key, result) ) || result;
|
|
63
|
+
if (result) __defProp(target, key, result);
|
|
64
|
+
return result;
|
|
65
|
+
};
|
|
66
|
+
class PickerField extends FormAssociatedPickerField {
|
|
67
|
+
// --- Core ---
|
|
68
|
+
constructor() {
|
|
69
|
+
super();
|
|
70
|
+
this.readOnly = false;
|
|
71
|
+
this.#onFocusIn = () => {
|
|
72
|
+
this.$emit("focus", void 0, { bubbles: false });
|
|
73
|
+
};
|
|
74
|
+
this.#onFocusOut = () => {
|
|
75
|
+
this.$emit("blur", void 0, { bubbles: false });
|
|
76
|
+
};
|
|
77
|
+
// Reformat the presentation value when the locale changes
|
|
78
|
+
this.#localeChangeHandler = {
|
|
79
|
+
handleChange: () => {
|
|
80
|
+
this._updatePresentationValue();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
this._popupOpen = false;
|
|
84
|
+
this.#dismissOnClickOutside = (event) => {
|
|
85
|
+
if (!this._popupOpen) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const path = event.composedPath();
|
|
89
|
+
const elementsToIgnoreClicksOn = [this._dialogEl, this._pickerButtonEl];
|
|
90
|
+
if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
|
|
91
|
+
this._closePopup(false);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
this._presentationValue = "";
|
|
95
|
+
this.value = "";
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
readOnlyChanged() {
|
|
101
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
102
|
+
this.proxy.readOnly = this.readOnly;
|
|
103
|
+
this.validate();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
connectedCallback() {
|
|
110
|
+
super.connectedCallback();
|
|
111
|
+
document.addEventListener("click", this.#dismissOnClickOutside);
|
|
112
|
+
this.addEventListener("focusin", this.#onFocusIn);
|
|
113
|
+
this.addEventListener("focusout", this.#onFocusOut);
|
|
114
|
+
this.#startObservingLocaleChanges();
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
disconnectedCallback() {
|
|
120
|
+
super.disconnectedCallback();
|
|
121
|
+
document.removeEventListener("click", this.#dismissOnClickOutside);
|
|
122
|
+
this.removeEventListener("focusin", this.#onFocusIn);
|
|
123
|
+
this.removeEventListener("focusout", this.#onFocusOut);
|
|
124
|
+
this.#stopObservingLocaleChanges();
|
|
125
|
+
}
|
|
126
|
+
#onFocusIn;
|
|
127
|
+
#onFocusOut;
|
|
128
|
+
/**
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
131
|
+
validate() {
|
|
132
|
+
if (this.proxy) {
|
|
133
|
+
this.proxy.setCustomValidity(this._getCustomValidationError() ?? "");
|
|
134
|
+
}
|
|
135
|
+
super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
|
|
136
|
+
}
|
|
137
|
+
#localeChangeHandler;
|
|
138
|
+
#localeChangeObserver;
|
|
139
|
+
#startObservingLocaleChanges() {
|
|
140
|
+
this.#localeChangeObserver = Observable.binding(
|
|
141
|
+
() => this.locale,
|
|
142
|
+
this.#localeChangeHandler
|
|
143
|
+
);
|
|
144
|
+
this.#localeChangeObserver.observe(this, defaultExecutionContext);
|
|
145
|
+
}
|
|
146
|
+
#stopObservingLocaleChanges() {
|
|
147
|
+
this.#localeChangeObserver.disconnect();
|
|
148
|
+
}
|
|
149
|
+
#dismissOnClickOutside;
|
|
150
|
+
#openPopupIfPossible() {
|
|
151
|
+
if (!this.readOnly) {
|
|
152
|
+
this._popupOpen = true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @internal
|
|
157
|
+
*/
|
|
158
|
+
_closePopup(restoreFocusToTextField = true) {
|
|
159
|
+
this._popupOpen = false;
|
|
160
|
+
if (restoreFocusToTextField) {
|
|
161
|
+
this._textFieldEl.focus();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* On keydown anywhere in the picker.
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
_onBaseKeyDown(event) {
|
|
169
|
+
if (this._popupOpen && handleEscapeKeyAndStopPropogation(event)) {
|
|
170
|
+
this._closePopup();
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
if (this._trappedFocus(event, () => this._focusableElsWithinDialog())) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @internal
|
|
180
|
+
*/
|
|
181
|
+
_presentationValueChanged() {
|
|
182
|
+
this.dirtyValue = true;
|
|
183
|
+
this.validate();
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @internal
|
|
187
|
+
*/
|
|
188
|
+
_onTextFieldInput(event) {
|
|
189
|
+
const textField = event.currentTarget;
|
|
190
|
+
this._presentationValue = textField.value;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
_onPickerButtonClick() {
|
|
196
|
+
if (this._popupOpen) {
|
|
197
|
+
this._closePopup();
|
|
198
|
+
} else {
|
|
199
|
+
this.#openPopupIfPossible();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// --- Dialog footer ---
|
|
203
|
+
/**
|
|
204
|
+
* @internal
|
|
205
|
+
*/
|
|
206
|
+
_onOkClick() {
|
|
207
|
+
this._closePopup();
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
212
|
+
_onClearClick() {
|
|
213
|
+
this._closePopup();
|
|
214
|
+
this.$emit("clear-click");
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
__decorateClass([
|
|
218
|
+
attr({ attribute: "value" })
|
|
219
|
+
], PickerField.prototype, "initialValue");
|
|
220
|
+
__decorateClass([
|
|
221
|
+
attr({ attribute: "current-value" })
|
|
222
|
+
], PickerField.prototype, "currentValue");
|
|
223
|
+
__decorateClass([
|
|
224
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
225
|
+
], PickerField.prototype, "readOnly");
|
|
226
|
+
__decorateClass([
|
|
227
|
+
observable
|
|
228
|
+
], PickerField.prototype, "_popupOpen");
|
|
229
|
+
__decorateClass([
|
|
230
|
+
observable
|
|
231
|
+
], PickerField.prototype, "_presentationValue");
|
|
232
|
+
applyMixinsWithObservables(
|
|
233
|
+
PickerField,
|
|
234
|
+
Localized,
|
|
235
|
+
FormElementHelperText,
|
|
236
|
+
TrappedFocus
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
const PickerFieldTemplate = (context, popupContentTemplate, { withSeparator, padded }) => {
|
|
240
|
+
const popupTag = context.tagFor(Popup);
|
|
241
|
+
const textFieldTag = context.tagFor(TextField);
|
|
242
|
+
const buttonTag = context.tagFor(Button);
|
|
243
|
+
return html`
|
|
244
|
+
<div class='base' @keydown='${(x, { event }) => x._onBaseKeyDown(event)}'>
|
|
245
|
+
<${textFieldTag} id='text-field'
|
|
246
|
+
${ref("_textFieldEl")}
|
|
247
|
+
class='control'
|
|
248
|
+
label='${(x) => x.label}'
|
|
249
|
+
helper-text='${(x) => x.helperText}'
|
|
250
|
+
error-text='${(x) => x.errorValidationMessage}'
|
|
251
|
+
placeholder='${(x) => x._textFieldPlaceholder}'
|
|
252
|
+
size='${(x) => x._textFieldSize}'
|
|
253
|
+
current-value='${(x) => x._presentationValue}'
|
|
254
|
+
?disabled='${(x) => x.disabled}'
|
|
255
|
+
?readonly='${(x) => x.readOnly}'
|
|
256
|
+
@input='${(x, c) => x._onTextFieldInput(c.event)}'
|
|
257
|
+
@change='${(x) => x._onTextFieldChange()}'
|
|
258
|
+
>
|
|
259
|
+
<slot
|
|
260
|
+
slot='${(x) => x._helperTextSlottedContent?.length ? "helper-text" : void 0}'
|
|
261
|
+
name='helper-text'
|
|
262
|
+
${slotted("_helperTextSlottedContent")}
|
|
263
|
+
></slot>
|
|
264
|
+
<${buttonTag}
|
|
265
|
+
id='picker-button'
|
|
266
|
+
${ref("_pickerButtonEl")}
|
|
267
|
+
slot='action-items'
|
|
268
|
+
size='condensed'
|
|
269
|
+
icon='${(x) => x._pickerButtonIcon}'
|
|
270
|
+
appearance='ghost'
|
|
271
|
+
?disabled='${(x) => x.disabled || x.readOnly}'
|
|
272
|
+
aria-label='${(x) => x._pickerButtonLabel}'
|
|
273
|
+
@click='${(x) => x._onPickerButtonClick()}'
|
|
274
|
+
></${buttonTag}>
|
|
275
|
+
</${textFieldTag}>
|
|
276
|
+
<${popupTag}
|
|
277
|
+
?open='${(x) => x._popupOpen}'
|
|
278
|
+
:anchor='${(x) => x._textFieldEl}'
|
|
279
|
+
placement='bottom-start'
|
|
280
|
+
class='popup'>
|
|
281
|
+
<div class="${() => classNames("dialog", [
|
|
282
|
+
"dialog--padded",
|
|
283
|
+
padded
|
|
284
|
+
])}" role='dialog' ${ref(
|
|
285
|
+
"_dialogEl"
|
|
286
|
+
)} aria-modal='true' aria-label='${(x) => x._dialogLabel}'>
|
|
287
|
+
${() => popupContentTemplate}
|
|
288
|
+
<div class="${() => classNames("footer", ["footer--with-separator", withSeparator])}">
|
|
289
|
+
<${buttonTag}
|
|
290
|
+
tabindex='3'
|
|
291
|
+
class='vwc-button'
|
|
292
|
+
size='condensed'
|
|
293
|
+
label='${(x) => x.locale.pickerField.clearLabel}'
|
|
294
|
+
@click='${(x) => x._onClearClick()}'
|
|
295
|
+
></${buttonTag}>
|
|
296
|
+
<${buttonTag}
|
|
297
|
+
tabindex='3'
|
|
298
|
+
class='vwc-button'
|
|
299
|
+
size='condensed'
|
|
300
|
+
appearance='filled'
|
|
301
|
+
label='${(x) => x.locale.pickerField.okLabel}'
|
|
302
|
+
@click='${(x) => x._onOkClick()}'
|
|
303
|
+
></${buttonTag}>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
</${popupTag}>
|
|
307
|
+
</div>`;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export { PickerFieldTemplate as P, TrappedFocus as T, PickerField as a, pickerFieldStyles as p };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SingleDatePickerMixin = (Base) => {
|
|
4
|
+
class SingleDatePicker extends Base {
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
valueChanged(previous, next) {
|
|
9
|
+
super.valueChanged(previous, next);
|
|
10
|
+
if (this.value) {
|
|
11
|
+
this._adjustSelectedMonthToEnsureVisibilityOf(this._dateValue());
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
_onDateClick(date) {
|
|
18
|
+
this._updateValueDueToUserInteraction(this._withUpdatedDate(date));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
_isDateSelected(date) {
|
|
24
|
+
return date === this._dateValue();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
_isDateAriaSelected(date) {
|
|
30
|
+
return this._isDateSelected(date);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
_getSelectedDates() {
|
|
36
|
+
const dates = [];
|
|
37
|
+
if (this.value) {
|
|
38
|
+
dates.push(this._dateValue());
|
|
39
|
+
}
|
|
40
|
+
return dates;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return SingleDatePicker;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.SingleDatePickerMixin = SingleDatePickerMixin;
|