@vonage/vivid 5.23.1 → 5.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +1 -1
- package/audio-player/index.cjs +2 -2
- package/audio-player/index.js +3 -3
- package/badge/index.cjs +1 -1
- package/badge/index.js +1 -1
- package/bundled/definition15.cjs +8 -7
- package/bundled/definition15.js +26 -24
- package/bundled/definition17.cjs +2 -2
- package/bundled/definition17.js +2 -2
- package/bundled/definition18.cjs +12 -83
- package/bundled/definition18.js +35 -419
- package/bundled/definition19.cjs +87 -7
- package/bundled/definition19.js +432 -16
- package/bundled/definition20.cjs +7 -37
- package/bundled/definition20.js +17 -172
- package/bundled/definition21.cjs +35 -27
- package/bundled/definition21.js +154 -154
- package/bundled/definition22.cjs +29 -6
- package/bundled/definition22.js +172 -20
- package/bundled/definition23.cjs +6 -12
- package/bundled/definition23.js +17 -32
- package/bundled/definition24.cjs +12 -39
- package/bundled/definition24.js +32 -67
- package/bundled/definition25.cjs +44 -0
- package/bundled/definition25.js +77 -0
- package/bundled/extractOptions.cjs +1 -0
- package/bundled/extractOptions.js +11 -0
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +24 -11
- package/bundled/render-in-light-dom.cjs +1 -1
- package/bundled/render-in-light-dom.js +16 -19
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +9 -1
- package/combobox/definition.cjs +1 -1
- package/combobox/definition.js +1 -1
- package/combobox/index.cjs +7 -7
- package/combobox/index.js +29 -21
- package/country/definition.cjs +1 -1
- package/country/definition.js +1 -1
- package/country/index.cjs +1 -1
- package/country/index.js +1 -1
- package/country-group/definition.cjs +1 -1
- package/country-group/definition.js +1 -1
- package/country-group/index.cjs +1 -1
- package/country-group/index.js +2 -2
- package/custom-elements.json +3102 -2842
- package/data-grid/definition.cjs +1 -1
- package/data-grid/definition.js +1 -1
- package/data-grid/index.cjs +4 -4
- package/data-grid/index.js +5 -5
- package/date-picker/definition.cjs +1 -1
- package/date-picker/definition.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +1 -1
- package/date-range-picker/definition.cjs +1 -1
- package/date-range-picker/definition.js +1 -1
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +1 -1
- package/date-time-picker/definition.cjs +1 -1
- package/date-time-picker/definition.js +1 -1
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +1 -1
- package/dial-pad/definition.cjs +1 -1
- package/dial-pad/definition.js +1 -1
- package/dial-pad/index.cjs +24 -24
- package/dial-pad/index.js +120 -51
- package/dialog/definition.cjs +1 -1
- package/dialog/definition.js +1 -1
- package/divider/definition.cjs +1 -1
- package/divider/definition.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/empty-state/definition.cjs +1 -1
- package/empty-state/definition.js +1 -1
- package/fab/definition.cjs +1 -1
- package/fab/definition.js +1 -1
- package/file-picker/definition.cjs +1 -1
- package/file-picker/definition.js +1 -1
- package/flag/definition.cjs +1 -1
- package/flag/definition.js +1 -1
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/header/index.cjs +3 -3
- package/header/index.js +3 -3
- package/index.cjs +200 -196
- package/index.js +53 -52
- package/kbd-key/definition.cjs +1 -1
- package/kbd-key/definition.js +1 -1
- package/kbd-shortcut/definition.cjs +1 -1
- package/kbd-shortcut/definition.js +1 -1
- package/layout/definition.cjs +1 -1
- package/layout/definition.js +1 -1
- package/lib/accordion-item/accordion-item.d.ts +2 -1
- package/lib/action-group/action-group.d.ts +1 -1
- package/lib/alert/alert.d.ts +2 -2
- package/lib/audio-player/audio-player.d.ts +1 -1
- package/lib/avatar/avatar.d.ts +1 -1
- package/lib/badge/badge.d.ts +1 -1
- package/lib/banner/banner.d.ts +3 -3
- package/lib/breadcrumb/breadcrumb.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/button/button.d.ts +3 -3
- package/lib/calendar-event/calendar-event.d.ts +1 -1
- package/lib/card/card.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +6 -6
- package/lib/color-picker/color-picker.d.ts +7 -7
- package/lib/combobox/combobox.d.ts +7 -7
- package/lib/components.d.ts +1 -0
- package/lib/country-group/country-group.d.ts +2 -2
- package/lib/data-grid/data-grid-cell.d.ts +4 -3
- package/lib/data-grid/data-grid-row.d.ts +3 -2
- package/lib/data-grid/data-grid.options.d.ts +5 -0
- package/lib/date-picker/date-picker.d.ts +8 -8
- package/lib/date-range-picker/date-range-picker.d.ts +4 -4
- package/lib/date-time-picker/date-time-picker.d.ts +8 -8
- package/lib/dial-pad/dial-pad.d.ts +2 -1
- package/lib/dialog/dialog.d.ts +2 -2
- package/lib/divider/divider.d.ts +1 -1
- package/lib/fab/fab.d.ts +1 -1
- package/lib/file-picker/file-picker.d.ts +7 -7
- package/lib/header/header.d.ts +1 -1
- package/lib/menu/menu.d.ts +2 -2
- package/lib/menu-item/menu-item.d.ts +3 -3
- package/lib/nav/nav.d.ts +1 -1
- package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
- package/lib/nav-item/nav-item.d.ts +2 -2
- package/lib/note/note.d.ts +1 -1
- package/lib/number-field/number-field.d.ts +9 -9
- package/lib/optgroup/definition.d.ts +3 -0
- package/lib/optgroup/index.d.ts +1 -0
- package/lib/optgroup/optgroup.d.ts +430 -0
- package/lib/optgroup/optgroup.template.d.ts +2 -0
- package/lib/optgroup/variations.browser-spec.d.ts +1 -0
- package/lib/option/option.d.ts +2 -2
- package/lib/pagination/pagination.d.ts +1 -1
- package/lib/popover/popover.d.ts +2 -2
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/radio/radio.d.ts +3 -3
- package/lib/radio-group/radio-group.d.ts +1 -1
- package/lib/range-slider/range-slider.d.ts +3 -3
- package/lib/rich-text-editor/rich-text-editor.d.ts +1 -1
- package/lib/searchable-select/option-tag.d.ts +1 -1
- package/lib/searchable-select/searchable-select.d.ts +47 -47
- package/lib/select/select.d.ts +9 -9
- package/lib/selectable-box/selectable-box.d.ts +1 -1
- package/lib/simple-color-picker/simple-color-picker.d.ts +2 -2
- package/lib/slider/slider.d.ts +3 -3
- package/lib/split-button/split-button.d.ts +3 -3
- package/lib/status/status.d.ts +1 -1
- package/lib/switch/switch.d.ts +2 -2
- package/lib/tab/tab.d.ts +3 -3
- package/lib/tab-panel/tab-panel.d.ts +1 -1
- package/lib/table/table-cell.d.ts +1 -1
- package/lib/table/table-header-cell.d.ts +1 -1
- package/lib/table/table-row.d.ts +1 -1
- package/lib/table/table-sorting-button.d.ts +1 -1
- package/lib/tag/tag.d.ts +3 -3
- package/lib/tag-group/tag-group.d.ts +1 -1
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/text-area/text-area.d.ts +8 -8
- package/lib/text-field/text-field.d.ts +9 -9
- package/lib/time-picker/time-picker.d.ts +4 -4
- package/lib/toggletip/toggletip.d.ts +2 -2
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/lib/tree-item/tree-item.d.ts +2 -2
- package/lib/tree-view/tree-view.d.ts +1 -1
- package/lib/video-player/video-player.d.ts +1 -1
- 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/definition.cjs +1 -1
- package/nav/definition.js +1 -1
- package/nav-disclosure/definition.cjs +1 -1
- package/nav-disclosure/definition.js +1 -1
- package/nav-item/definition.cjs +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.cjs +1 -1
- package/note/definition.js +1 -1
- package/number-field/definition.cjs +1 -1
- package/number-field/definition.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/optgroup/definition.cjs +5 -0
- package/optgroup/definition.js +2 -0
- package/optgroup/index.cjs +1 -0
- package/optgroup/index.js +4 -0
- package/package.json +6 -6
- package/pagination/definition.cjs +1 -1
- package/pagination/definition.js +1 -1
- package/platform-switch/definition.cjs +1 -1
- package/platform-switch/definition.js +1 -1
- package/popover/definition.cjs +1 -1
- package/popover/definition.js +1 -1
- package/progress/definition.cjs +1 -1
- package/progress/definition.js +1 -1
- package/radio/definition.cjs +1 -1
- package/radio/definition.js +1 -1
- package/radio-group/definition.cjs +1 -1
- package/radio-group/definition.js +1 -1
- package/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/rich-text-editor/definition.cjs +1 -1
- package/rich-text-editor/definition.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +4 -4
- package/rich-text-view/definition.cjs +1 -1
- package/rich-text-view/definition.js +1 -1
- package/searchable-select/definition.cjs +1 -1
- package/searchable-select/definition.js +1 -1
- package/searchable-select/index.cjs +19 -19
- package/searchable-select/index.js +60 -45
- package/select/definition.cjs +1 -1
- package/select/definition.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/shared/aria/delegates-aria.d.ts +1 -1
- package/shared/aria/host-semantics.d.ts +1 -1
- package/shared/color-picker/base-color-picker.d.ts +1 -1
- package/shared/feedback/feedback-message.d.ts +1 -1
- package/shared/feedback/mixins.d.ts +2 -2
- package/shared/foundation/button/button.d.ts +2 -2
- package/shared/foundation/form-associated/form-associated.d.ts +2 -2
- package/shared/foundation/listbox/extractOptions.d.ts +2 -0
- package/shared/foundation/listbox/listbox.d.ts +2 -0
- package/shared/patterns/affix.d.ts +2 -2
- package/shared/patterns/anchored.d.ts +2 -2
- package/shared/patterns/char-count/char-count.d.ts +1 -1
- package/shared/patterns/form-elements/form-element.d.ts +1 -1
- package/shared/patterns/form-elements/with-contextual-help.d.ts +1 -1
- package/shared/patterns/form-elements/with-error-text.d.ts +1 -1
- package/shared/patterns/form-elements/with-success-text.d.ts +1 -1
- package/shared/patterns/kbd-shortcut.d.ts +1 -1
- package/shared/patterns/linkable.d.ts +1 -1
- package/shared/patterns/localized.d.ts +2 -2
- package/shared/patterns/trapped-focus.d.ts +1 -1
- package/shared/picker-field/mixins/calendar-picker.d.ts +2 -2
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +2 -2
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +1 -1
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +2 -2
- package/shared/picker-field/mixins/single-date-picker.d.ts +2 -2
- package/shared/picker-field/mixins/single-value-picker.d.ts +2 -2
- package/shared/picker-field/mixins/time-selection-picker.d.ts +2 -2
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +4 -4
- package/shared/picker-field/picker-field.d.ts +7 -7
- package/side-drawer/definition.cjs +1 -1
- package/side-drawer/definition.js +1 -1
- package/simple-color-picker/definition.cjs +1 -1
- package/simple-color-picker/definition.js +1 -1
- package/split-button/definition.cjs +1 -1
- package/split-button/definition.js +1 -1
- package/split-button/index.cjs +1 -0
- package/split-button/index.js +1 -0
- package/status/definition.cjs +1 -1
- package/status/definition.js +1 -1
- package/switch/definition.cjs +1 -1
- package/switch/definition.js +1 -1
- package/switch/index.cjs +6 -5
- package/switch/index.js +16 -14
- package/tab/definition.cjs +1 -1
- package/tab/definition.js +1 -1
- package/tab-panel/definition.cjs +1 -1
- package/tab-panel/definition.js +1 -1
- package/table/definition.cjs +1 -1
- package/table/definition.js +1 -1
- package/tabs/definition.cjs +1 -1
- package/tabs/definition.js +1 -1
- package/tag/definition.cjs +1 -1
- package/tag/definition.js +1 -1
- package/tag-group/definition.cjs +1 -1
- package/tag-group/definition.js +1 -1
- package/text-area/definition.cjs +1 -1
- package/text-area/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +1 -1
- package/unbundled/definition13.cjs +1 -1
- package/unbundled/definition13.js +1 -1
- package/unbundled/definition2.cjs +9 -3
- package/unbundled/definition2.js +9 -3
- package/unbundled/definition23.cjs +1 -0
- package/unbundled/definition23.js +2 -1
- package/unbundled/definition29.cjs +2 -2
- package/unbundled/definition29.js +2 -2
- package/unbundled/definition30.cjs +65 -484
- package/unbundled/definition30.js +57 -482
- package/unbundled/definition31.cjs +501 -39
- package/unbundled/definition31.js +499 -37
- package/unbundled/definition32.cjs +38 -239
- package/unbundled/definition32.js +35 -236
- package/unbundled/definition33.cjs +236 -74
- package/unbundled/definition33.js +233 -71
- package/unbundled/definition34.cjs +74 -1968
- package/unbundled/definition34.js +70 -1940
- package/unbundled/definition35.cjs +1992 -26
- package/unbundled/definition35.js +1964 -27
- package/unbundled/definition36.cjs +26 -111
- package/unbundled/definition36.js +23 -103
- package/unbundled/definition37.cjs +53 -294
- package/unbundled/definition37.js +50 -291
- package/unbundled/definition38.cjs +282 -132
- package/unbundled/definition38.js +279 -129
- package/unbundled/definition39.cjs +165 -339
- package/unbundled/definition39.js +163 -337
- package/unbundled/definition40.cjs +394 -228
- package/unbundled/definition40.js +391 -225
- package/unbundled/definition41.cjs +263 -46
- package/unbundled/definition41.js +258 -41
- package/unbundled/definition42.cjs +47 -67
- package/unbundled/definition42.js +45 -65
- package/unbundled/definition43.cjs +56 -383
- package/unbundled/definition43.js +55 -382
- package/unbundled/definition44.cjs +386 -44
- package/unbundled/definition44.js +382 -40
- package/unbundled/definition45.cjs +53 -45
- package/unbundled/definition45.js +49 -41
- package/unbundled/definition46.cjs +40 -164
- package/unbundled/definition46.js +36 -160
- package/unbundled/definition47.cjs +171 -31
- package/unbundled/definition47.js +168 -22
- package/unbundled/definition48.cjs +30 -89
- package/unbundled/definition48.js +22 -87
- package/unbundled/definition49.cjs +70 -33
- package/unbundled/definition49.js +67 -30
- package/unbundled/definition50.cjs +54 -23
- package/unbundled/definition50.js +52 -18
- package/unbundled/definition51.cjs +23 -39
- package/unbundled/definition51.js +17 -36
- package/unbundled/definition52.cjs +29 -314
- package/unbundled/definition52.js +27 -312
- package/unbundled/definition53.cjs +301 -195
- package/unbundled/definition53.js +297 -191
- package/unbundled/definition54.cjs +210 -40
- package/unbundled/definition54.js +206 -36
- package/unbundled/definition55.cjs +42 -266
- package/unbundled/definition55.js +38 -262
- package/unbundled/definition56.cjs +266 -50
- package/unbundled/definition56.js +263 -46
- package/unbundled/definition57.cjs +48 -146
- package/unbundled/definition57.js +47 -143
- package/unbundled/definition58.cjs +127 -225
- package/unbundled/definition58.js +122 -223
- package/unbundled/definition59.cjs +199 -418
- package/unbundled/definition59.js +196 -415
- package/unbundled/definition60.cjs +441 -3738
- package/unbundled/definition60.js +431 -3565
- package/unbundled/definition61.cjs +3712 -728
- package/unbundled/definition61.js +3538 -717
- package/unbundled/definition62.cjs +769 -97
- package/unbundled/definition62.js +766 -94
- package/unbundled/definition63.cjs +100 -981
- package/unbundled/definition63.js +98 -976
- package/unbundled/definition64.cjs +988 -93
- package/unbundled/definition64.js +982 -90
- package/unbundled/definition65.cjs +109 -73
- package/unbundled/definition65.js +105 -63
- package/unbundled/definition66.cjs +69 -155
- package/unbundled/definition66.js +60 -152
- package/unbundled/definition67.cjs +154 -118
- package/unbundled/definition67.js +151 -115
- package/unbundled/definition68.cjs +124 -49
- package/unbundled/definition68.js +120 -45
- package/unbundled/definition69.cjs +51 -84
- package/unbundled/definition69.js +50 -80
- package/unbundled/definition70.cjs +91 -19
- package/unbundled/definition70.js +86 -14
- package/unbundled/definition71.cjs +20 -87
- package/unbundled/definition71.js +14 -84
- package/unbundled/definition72.cjs +76 -294
- package/unbundled/definition72.js +71 -217
- package/unbundled/definition73.cjs +288 -311
- package/unbundled/definition73.js +218 -306
- package/unbundled/definition74.cjs +326 -26
- package/unbundled/definition74.js +317 -23
- package/unbundled/definition75.cjs +27 -122
- package/unbundled/definition75.js +22 -118
- package/unbundled/definition76.cjs +103 -232
- package/unbundled/definition76.js +99 -228
- package/unbundled/definition77.cjs +259 -26
- package/unbundled/definition77.js +249 -23
- package/unbundled/definition78.cjs +29 -148
- package/unbundled/definition78.js +27 -133
- package/unbundled/definition79.cjs +117 -173
- package/unbundled/definition79.js +108 -169
- package/unbundled/definition80.cjs +181 -477
- package/unbundled/definition80.js +176 -471
- package/unbundled/definition81.cjs +517 -0
- package/unbundled/definition81.js +497 -0
- package/unbundled/extractOptions.cjs +21 -0
- package/unbundled/extractOptions.js +16 -0
- package/unbundled/listbox.cjs +23 -6
- package/unbundled/listbox.js +23 -6
- package/unbundled/vivid-element.cjs +10 -1
- package/unbundled/vivid-element.js +10 -1
- package/video-player/definition.cjs +1 -1
- package/video-player/definition.js +1 -1
- package/vivid.api.json +194 -0
|
@@ -4,200 +4,350 @@ import { t as buttonDefinition } from "./definition6.js";
|
|
|
4
4
|
import { t as popupDefinition } from "./definition9.js";
|
|
5
5
|
import { n as visuallyHiddenDefinition } from "./definition22.js";
|
|
6
6
|
import { n as textFieldDefinition } from "./definition26.js";
|
|
7
|
-
import { t as dividerDefinition } from "./
|
|
7
|
+
import { t as dividerDefinition } from "./definition36.js";
|
|
8
8
|
import { n as PickerField, r as picker_field_default, t as PickerFieldTemplate } from "./picker-field.template.js";
|
|
9
|
-
import { a as formatPresentationDate,
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//#region src/lib/date-time-picker/date-time-picker.scss?inline
|
|
15
|
-
var date_time_picker_default = ".date-time-picker{gap:28px;padding-inline-start:12px;display:flex}.time-picker{padding-block:4px 12px}";
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/shared/datetime/dateTimeStr.ts
|
|
18
|
-
var extractDatePart = (dateTimeStr) => dateTimeStr.split("T")[0] || "";
|
|
19
|
-
var extractTimePart = (dateTimeStr) => dateTimeStr.split("T")[1] || "";
|
|
20
|
-
var isValidDateTimeStr = (string) => {
|
|
21
|
-
const [dateStr = "", timeStr = ""] = string.split("T");
|
|
22
|
-
return isValidDateStr(dateStr) && isValidTimeStr(timeStr);
|
|
9
|
+
import { a as formatPresentationDate, i as CalendarPicker, l as isValidDateStr, n as MinMaxCalendarPicker, o as parsePresentationDate, s as compareDateStr, t as CalendarPickerTemplate, u as calendar_picker_default } from "./calendar-picker.template.js";
|
|
10
|
+
import { attr, observable, volatile } from "@microsoft/fast-element";
|
|
11
|
+
//#region src/shared/datetime/presentationDateRange.ts
|
|
12
|
+
var formatRange = (from, to) => {
|
|
13
|
+
return `${from} – ${to}`;
|
|
23
14
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var formatPresentationDateTime = (dateTimeStr, locale, includeSeconds, use12HourClock) => {
|
|
27
|
-
const [dateStr, timeStr] = dateTimeStr.split("T");
|
|
28
|
-
return `${formatPresentationDate(dateStr, locale)} ${formatPresentationTime(timeStr, includeSeconds, use12HourClock)}`;
|
|
15
|
+
var formatPresentationDateRange = (dateRange, locale) => {
|
|
16
|
+
return formatRange(formatPresentationDate(dateRange.start, locale), formatPresentationDate(dateRange.end, locale));
|
|
29
17
|
};
|
|
30
18
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
19
|
+
* Parse a presentation date range, which combines two presentation dates with a dash.
|
|
20
|
+
* Will throw if the range can't be parsed
|
|
33
21
|
*/
|
|
34
|
-
var
|
|
35
|
-
const
|
|
36
|
-
|
|
22
|
+
var parsePresentationDateRange = (presentationDateRange, locale) => {
|
|
23
|
+
const fragments = presentationDateRange.trim().split(/[\s—–-]+/);
|
|
24
|
+
if (fragments.length !== 2) throw new Error(`Invalid date range: ${presentationDateRange}`);
|
|
25
|
+
const [start, end] = fragments.map((fragment) => parsePresentationDate(fragment, locale));
|
|
26
|
+
return {
|
|
27
|
+
start,
|
|
28
|
+
end
|
|
29
|
+
};
|
|
37
30
|
};
|
|
38
31
|
//#endregion
|
|
39
|
-
//#region src/lib/date-
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
toView(value) {
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
32
|
+
//#region src/lib/date-range-picker/date-range-picker.ts
|
|
33
|
+
var isFormAssociatedTryingToSetFormValue = (value) => typeof value === "string";
|
|
34
|
+
function isDefined(value) {
|
|
35
|
+
return !!value;
|
|
36
|
+
}
|
|
49
37
|
/**
|
|
50
|
-
* Single date picker component.
|
|
51
|
-
*
|
|
52
38
|
* @public
|
|
53
|
-
* @component date-
|
|
54
|
-
* @slot helper-text - Describes how to use the date-picker. Alternative to the `helper-text` attribute.
|
|
55
|
-
* @event {CustomEvent<undefined>} input -
|
|
56
|
-
* @event {CustomEvent<undefined>}
|
|
57
|
-
* @
|
|
58
|
-
* @
|
|
39
|
+
* @component date-range-picker
|
|
40
|
+
* @slot helper-text - Describes how to use the date-range-picker. Alternative to the `helper-text` attribute.
|
|
41
|
+
* @event {CustomEvent<undefined>} input:start - Event emitted when the start value changes
|
|
42
|
+
* @event {CustomEvent<undefined>} input:end - Event emitted when the end value changes
|
|
43
|
+
* @event {CustomEvent<undefined>} input - Emitted when either the start or end value changes
|
|
44
|
+
* @event {CustomEvent<undefined>} change - Emitted when either the start or end value changes
|
|
45
|
+
* @vueModel start start input:start `event.currentTarget.start`
|
|
46
|
+
* @vueModel end end input:end `event.currentTarget.end`
|
|
47
|
+
* @testAction selectDateRange selectDateRange
|
|
48
|
+
* @testQuery range range
|
|
59
49
|
*/
|
|
60
|
-
var
|
|
50
|
+
var DateRangePicker = class extends MinMaxCalendarPicker(CalendarPicker(PickerField)) {
|
|
51
|
+
constructor(..._args) {
|
|
52
|
+
super(..._args);
|
|
53
|
+
this.initialStart = "";
|
|
54
|
+
this.initialEnd = "";
|
|
55
|
+
this.#isInternalValueUpdate = false;
|
|
56
|
+
this.start = "";
|
|
57
|
+
this.end = "";
|
|
58
|
+
this.setFormValue = (value, state) => {
|
|
59
|
+
if (isFormAssociatedTryingToSetFormValue(value)) return;
|
|
60
|
+
super.setFormValue(value, state);
|
|
61
|
+
};
|
|
62
|
+
this._numCalendars = 2;
|
|
63
|
+
this._hideDatesOutsideMonth = true;
|
|
64
|
+
this._textFieldSize = "30";
|
|
65
|
+
}
|
|
66
|
+
/** @internal */
|
|
67
|
+
initialStartChanged() {
|
|
68
|
+
if (!this.dirtyValue) {
|
|
69
|
+
this.start = this.initialStart;
|
|
70
|
+
this.dirtyValue = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** @internal */
|
|
74
|
+
initialEndChanged() {
|
|
75
|
+
if (!this.dirtyValue) {
|
|
76
|
+
this.end = this.initialEnd;
|
|
77
|
+
this.dirtyValue = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
#isInternalValueUpdate;
|
|
61
81
|
/** @internal */
|
|
62
|
-
|
|
63
|
-
|
|
82
|
+
startChanged() {
|
|
83
|
+
if (this.start && !isValidDateStr(this.start)) {
|
|
84
|
+
this.start = "";
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.currentStart = this.start;
|
|
88
|
+
this.dirtyValue = true;
|
|
89
|
+
if (!this.#isInternalValueUpdate) this.#handleChangedValues();
|
|
64
90
|
}
|
|
65
91
|
/** @internal */
|
|
66
|
-
|
|
67
|
-
|
|
92
|
+
endChanged() {
|
|
93
|
+
if (this.end && !isValidDateStr(this.end)) {
|
|
94
|
+
this.end = "";
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this.currentEnd = this.end;
|
|
98
|
+
this.dirtyValue = true;
|
|
99
|
+
if (!this.#isInternalValueUpdate) this.#handleChangedValues();
|
|
68
100
|
}
|
|
69
101
|
/** @internal */
|
|
70
|
-
|
|
71
|
-
|
|
102
|
+
currentStartChanged() {
|
|
103
|
+
this.start = this.currentStart;
|
|
72
104
|
}
|
|
73
105
|
/** @internal */
|
|
74
|
-
|
|
75
|
-
|
|
106
|
+
currentEndChanged() {
|
|
107
|
+
this.end = this.currentEnd;
|
|
108
|
+
}
|
|
109
|
+
#updateValues(range) {
|
|
110
|
+
this.#isInternalValueUpdate = true;
|
|
111
|
+
if (range.start !== void 0) {
|
|
112
|
+
this.start = range.start;
|
|
113
|
+
this.$emit("input:start");
|
|
114
|
+
}
|
|
115
|
+
if (range.end !== void 0) {
|
|
116
|
+
this.end = range.end;
|
|
117
|
+
this.$emit("input:end");
|
|
118
|
+
}
|
|
119
|
+
this.#isInternalValueUpdate = false;
|
|
120
|
+
this.$emit("input");
|
|
121
|
+
this.$emit("change");
|
|
122
|
+
this.#handleChangedValues();
|
|
123
|
+
}
|
|
124
|
+
#handleChangedValues() {
|
|
125
|
+
if (this.start && this.end) {
|
|
126
|
+
if (compareDateStr(this.start, this.end) > 0) {
|
|
127
|
+
this.#updateValues({
|
|
128
|
+
start: this.end,
|
|
129
|
+
end: this.start
|
|
130
|
+
});
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
this.value = formatRange(this.start, this.end);
|
|
134
|
+
} else this.value = "";
|
|
135
|
+
this._updatePresentationValue();
|
|
136
|
+
const dateToEnsureVisibilityOf = this.start || this.end;
|
|
137
|
+
if (dateToEnsureVisibilityOf) this._adjustSelectedMonthToEnsureVisibilityOf(dateToEnsureVisibilityOf);
|
|
138
|
+
this.#updateFormValue();
|
|
76
139
|
}
|
|
77
140
|
/** @internal */
|
|
78
|
-
|
|
79
|
-
|
|
141
|
+
_updatePresentationValue() {
|
|
142
|
+
if (this.start && this.end) this._presentationValue = formatPresentationDateRange({
|
|
143
|
+
start: this.start,
|
|
144
|
+
end: this.end
|
|
145
|
+
}, this.locale.calendarPicker);
|
|
146
|
+
else this._presentationValue = "";
|
|
80
147
|
}
|
|
81
148
|
/** @internal */
|
|
82
|
-
|
|
83
|
-
|
|
149
|
+
nameChanged(previous, next) {
|
|
150
|
+
super.nameChanged(previous, next);
|
|
151
|
+
this.#updateFormValue();
|
|
152
|
+
}
|
|
153
|
+
#updateFormValue() {
|
|
154
|
+
if (!this.name || !this.start || !this.end) this.setFormValue(null);
|
|
155
|
+
else {
|
|
156
|
+
const formData = new FormData();
|
|
157
|
+
formData.append(this.name, this.start);
|
|
158
|
+
formData.append(this.name, this.end);
|
|
159
|
+
this.setFormValue(formData);
|
|
160
|
+
}
|
|
84
161
|
}
|
|
85
162
|
/** @internal */
|
|
86
|
-
|
|
87
|
-
|
|
163
|
+
connectedCallback() {
|
|
164
|
+
super.connectedCallback();
|
|
165
|
+
/* v8 ignore else -- @preserve */
|
|
166
|
+
if (!this.start) this.start = this.initialStart;
|
|
167
|
+
/* v8 ignore else -- @preserve */
|
|
168
|
+
if (!this.end) this.end = this.initialEnd;
|
|
169
|
+
}
|
|
170
|
+
#getVisibleRange() {
|
|
171
|
+
const candidates = [this.start, this.end].filter(isDefined);
|
|
172
|
+
const isPartialRange = candidates.length === 1;
|
|
173
|
+
if (this._hoverDate && isPartialRange) candidates.push(this._hoverDate);
|
|
174
|
+
const [start, end] = candidates.sort(compareDateStr);
|
|
175
|
+
return {
|
|
176
|
+
start,
|
|
177
|
+
end
|
|
178
|
+
};
|
|
88
179
|
}
|
|
89
180
|
/** @internal */
|
|
90
|
-
|
|
91
|
-
return
|
|
181
|
+
_isDateAriaSelected(date) {
|
|
182
|
+
return this._isDateInSelectedRange(date);
|
|
92
183
|
}
|
|
93
184
|
/** @internal */
|
|
94
|
-
|
|
95
|
-
|
|
185
|
+
_isDateInSelectedRange(date) {
|
|
186
|
+
const { start, end } = this.#getVisibleRange();
|
|
187
|
+
if (start && end) return compareDateStr(date, start) >= 0 && compareDateStr(date, end) <= 0;
|
|
188
|
+
return false;
|
|
96
189
|
}
|
|
97
190
|
/** @internal */
|
|
98
|
-
|
|
99
|
-
return
|
|
191
|
+
_isDateRangeStart(date) {
|
|
192
|
+
return date === this.#getVisibleRange().start;
|
|
100
193
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
194
|
+
/** @internal */
|
|
195
|
+
_isDateRangeEnd(date) {
|
|
196
|
+
return date === this.#getVisibleRange().end;
|
|
197
|
+
}
|
|
198
|
+
/** @internal */
|
|
199
|
+
_getSelectedDates() {
|
|
200
|
+
const dates = [];
|
|
201
|
+
if (this.start) dates.push(this.start);
|
|
202
|
+
if (this.end) dates.push(this.end);
|
|
203
|
+
return dates;
|
|
204
|
+
}
|
|
205
|
+
/** @internal */
|
|
206
|
+
_onDateClick(date) {
|
|
207
|
+
if (this.start && this.end) this.#updateValues({
|
|
208
|
+
start: date,
|
|
209
|
+
end: ""
|
|
210
|
+
});
|
|
211
|
+
else if (this.start) {
|
|
212
|
+
this.#updateValues({ end: date });
|
|
213
|
+
this._closePopup();
|
|
214
|
+
} else if (this.end) {
|
|
215
|
+
this.#updateValues({ start: date });
|
|
216
|
+
this._closePopup();
|
|
217
|
+
} else this.#updateValues({ start: date });
|
|
218
|
+
}
|
|
219
|
+
/** @internal */
|
|
220
|
+
get _textFieldPlaceholder() {
|
|
221
|
+
return formatRange(this.locale.calendarPicker.dateFormatPlaceholder, this.locale.calendarPicker.dateFormatPlaceholder);
|
|
222
|
+
}
|
|
223
|
+
/** @internal */
|
|
224
|
+
_onTextFieldChange() {
|
|
225
|
+
if (this._presentationValue === "") {
|
|
226
|
+
this.#updateValues({
|
|
227
|
+
start: "",
|
|
228
|
+
end: ""
|
|
229
|
+
});
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
const { start, end } = parsePresentationDateRange(this._presentationValue, this.locale.calendarPicker);
|
|
234
|
+
this.#updateValues({
|
|
235
|
+
start,
|
|
236
|
+
end
|
|
237
|
+
});
|
|
238
|
+
} catch (_) {
|
|
239
|
+
const invalidPresentationValue = this._presentationValue;
|
|
240
|
+
this.#updateValues({
|
|
241
|
+
start: "",
|
|
242
|
+
end: ""
|
|
243
|
+
});
|
|
244
|
+
this._presentationValue = invalidPresentationValue;
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/** @internal */
|
|
249
|
+
_onDateMouseEnter(date) {
|
|
250
|
+
this._hoverDate = date;
|
|
251
|
+
}
|
|
252
|
+
/** @internal */
|
|
253
|
+
_onDateMouseLeave() {
|
|
254
|
+
this._hoverDate = void 0;
|
|
113
255
|
}
|
|
114
256
|
/** @internal */
|
|
115
257
|
_getCustomValidationError() {
|
|
116
|
-
if (this._isPresentationValueInvalid()) return this.locale.
|
|
117
|
-
if (this.
|
|
118
|
-
if (this.
|
|
119
|
-
if (this._timeValue && this._resolvedMinTime && compareTimeStr(this._timeValue, this._resolvedMinTime) < 0) return this.locale.dateTimePicker.timeBeforeMinTimeError(formatPresentationTime(this._resolvedMinTime, this._displaySeconds, this._use12hClock));
|
|
120
|
-
if (this._timeValue && this._resolvedMaxTime && compareTimeStr(this._timeValue, this._resolvedMaxTime) > 0) return this.locale.dateTimePicker.timeAfterMaxTimeError(formatPresentationTime(this._resolvedMaxTime, this._displaySeconds, this._use12hClock));
|
|
258
|
+
if (this._isPresentationValueInvalid()) return this.locale.calendarPicker.invalidDateRangeError;
|
|
259
|
+
if (this.min && this.start && compareDateStr(this.start, this.min) < 0) return this.locale.calendarPicker.startDateAfterMinDateError(formatPresentationDate(this.min, this.locale.calendarPicker));
|
|
260
|
+
if (this.max && this.end && compareDateStr(this.end, this.max) > 0) return this.locale.calendarPicker.endDateBeforeMaxDateError(formatPresentationDate(this.max, this.locale.calendarPicker));
|
|
121
261
|
return null;
|
|
122
262
|
}
|
|
123
263
|
/** @internal */
|
|
124
|
-
|
|
125
|
-
|
|
264
|
+
_isPresentationValueInvalid() {
|
|
265
|
+
if (this._presentationValue === "") return false;
|
|
266
|
+
try {
|
|
267
|
+
parsePresentationDateRange(this._presentationValue, this.locale.calendarPicker);
|
|
268
|
+
return false;
|
|
269
|
+
} catch (_) {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
126
272
|
}
|
|
127
273
|
/** @internal */
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
274
|
+
_onClearClick() {
|
|
275
|
+
this.#updateValues({
|
|
276
|
+
start: "",
|
|
277
|
+
end: ""
|
|
278
|
+
});
|
|
279
|
+
super._onClearClick();
|
|
131
280
|
}
|
|
132
281
|
/** @internal */
|
|
133
|
-
|
|
134
|
-
|
|
282
|
+
formResetCallback() {
|
|
283
|
+
this.#updateValues({
|
|
284
|
+
start: this.initialStart,
|
|
285
|
+
end: this.initialEnd
|
|
286
|
+
});
|
|
287
|
+
super.formResetCallback();
|
|
135
288
|
}
|
|
136
289
|
/** @internal */
|
|
137
|
-
get
|
|
138
|
-
return
|
|
290
|
+
get _pickerButtonLabel() {
|
|
291
|
+
if (this.start && this.end) return this.locale.calendarPicker.changeDatesLabel(formatPresentationDateRange({
|
|
292
|
+
start: this.start,
|
|
293
|
+
end: this.end
|
|
294
|
+
}, this.locale.calendarPicker));
|
|
295
|
+
else return this.locale.calendarPicker.chooseDatesLabel;
|
|
139
296
|
}
|
|
140
297
|
/** @internal */
|
|
141
298
|
get _dialogLabel() {
|
|
142
|
-
return this.locale.
|
|
299
|
+
return this.locale.calendarPicker.chooseDatesLabel;
|
|
300
|
+
}
|
|
301
|
+
/** @internal */
|
|
302
|
+
_focusableElsWithinDialog() {
|
|
303
|
+
return this._dialogEl.querySelectorAll("button, .vwc-button");
|
|
304
|
+
}
|
|
305
|
+
/** @internal */
|
|
306
|
+
get _pickerButtonIcon() {
|
|
307
|
+
return "calendar-line";
|
|
143
308
|
}
|
|
144
309
|
};
|
|
145
|
-
__decorate([attr({ converter: ValidDateTimeFilter })], DateTimePicker.prototype, "min", void 0);
|
|
146
|
-
__decorate([attr({
|
|
147
|
-
converter: ValidTimeFilter,
|
|
148
|
-
attribute: "min-time"
|
|
149
|
-
})], DateTimePicker.prototype, "minTime", void 0);
|
|
150
|
-
__decorate([attr({
|
|
151
|
-
converter: ValidDateFilter,
|
|
152
|
-
attribute: "min-date"
|
|
153
|
-
})], DateTimePicker.prototype, "minDate", void 0);
|
|
154
|
-
__decorate([attr({ converter: ValidDateTimeFilter })], DateTimePicker.prototype, "max", void 0);
|
|
155
310
|
__decorate([attr({
|
|
156
|
-
|
|
157
|
-
attribute: "
|
|
158
|
-
})],
|
|
311
|
+
mode: "fromView",
|
|
312
|
+
attribute: "start"
|
|
313
|
+
})], DateRangePicker.prototype, "initialStart", void 0);
|
|
159
314
|
__decorate([attr({
|
|
160
|
-
|
|
161
|
-
attribute: "
|
|
162
|
-
})],
|
|
315
|
+
mode: "fromView",
|
|
316
|
+
attribute: "end"
|
|
317
|
+
})], DateRangePicker.prototype, "initialEnd", void 0);
|
|
318
|
+
__decorate([observable], DateRangePicker.prototype, "start", void 0);
|
|
319
|
+
__decorate([observable], DateRangePicker.prototype, "end", void 0);
|
|
320
|
+
__decorate([attr({ attribute: "current-start" })], DateRangePicker.prototype, "currentStart", void 0);
|
|
321
|
+
__decorate([attr({ attribute: "current-end" })], DateRangePicker.prototype, "currentEnd", void 0);
|
|
322
|
+
__decorate([observable], DateRangePicker.prototype, "_numCalendars", void 0);
|
|
323
|
+
__decorate([observable], DateRangePicker.prototype, "_hoverDate", void 0);
|
|
324
|
+
__decorate([volatile], DateRangePicker.prototype, "_pickerButtonLabel", null);
|
|
163
325
|
//#endregion
|
|
164
|
-
//#region src/lib/date-
|
|
165
|
-
var
|
|
166
|
-
return PickerFieldTemplate(context,
|
|
167
|
-
<div class="date-time-picker">
|
|
168
|
-
${() => CalendarPickerTemplate(context)}
|
|
169
|
-
<div class="time-picker">
|
|
170
|
-
${() => TimeSelectionPickerTemplate(context, 9)}
|
|
171
|
-
</div>
|
|
172
|
-
</div>
|
|
173
|
-
`, {
|
|
326
|
+
//#region src/lib/date-range-picker/date-range-picker.template.ts
|
|
327
|
+
var DateRangePickerTemplate = (context) => {
|
|
328
|
+
return PickerFieldTemplate(context, CalendarPickerTemplate(context), {
|
|
174
329
|
withSeparator: false,
|
|
175
|
-
padded:
|
|
330
|
+
padded: true
|
|
176
331
|
});
|
|
177
332
|
};
|
|
178
333
|
//#endregion
|
|
179
|
-
//#region src/lib/date-
|
|
334
|
+
//#region src/lib/date-range-picker/definition.ts
|
|
180
335
|
/** @internal */
|
|
181
|
-
var
|
|
336
|
+
var dateRangePickerDefinition = defineVividComponent("date-range-picker", DateRangePicker, DateRangePickerTemplate, [
|
|
182
337
|
buttonDefinition,
|
|
183
338
|
popupDefinition,
|
|
184
339
|
textFieldDefinition,
|
|
185
340
|
dividerDefinition,
|
|
186
|
-
inlineTimePickerDefinition,
|
|
187
341
|
visuallyHiddenDefinition
|
|
188
342
|
], {
|
|
189
|
-
styles: [
|
|
190
|
-
picker_field_default,
|
|
191
|
-
calendar_picker_default,
|
|
192
|
-
date_time_picker_default
|
|
193
|
-
],
|
|
343
|
+
styles: [picker_field_default, calendar_picker_default],
|
|
194
344
|
shadowOptions: { delegatesFocus: true }
|
|
195
345
|
});
|
|
196
346
|
/**
|
|
197
|
-
* Registers the date-
|
|
347
|
+
* Registers the date-range-picker element with the design system.
|
|
198
348
|
*
|
|
199
349
|
* @param prefix - the prefix to use for the component name
|
|
200
350
|
*/
|
|
201
|
-
var
|
|
351
|
+
var registerDateRangePicker = createRegisterFunction(dateRangePickerDefinition);
|
|
202
352
|
//#endregion
|
|
203
|
-
export {
|
|
353
|
+
export { registerDateRangePicker as n, DateRangePicker as r, dateRangePickerDefinition as t };
|