@sbb-esta/lyne-elements 2.2.0 → 2.4.1
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.js +6 -6
- package/alert/alert-group.js +4 -4
- package/alert/alert.js +9 -9
- package/autocomplete/autocomplete-base-element.d.ts +1 -0
- package/autocomplete/autocomplete-base-element.d.ts.map +1 -1
- package/autocomplete/autocomplete.d.ts.map +1 -1
- package/autocomplete-grid/autocomplete-grid/autocomplete-grid.d.ts.map +1 -1
- package/autocomplete-grid/autocomplete-grid-button.js +4 -4
- package/autocomplete-grid/autocomplete-grid-optgroup.js +4 -4
- package/autocomplete-grid/autocomplete-grid-row.js +4 -4
- package/autocomplete-grid/autocomplete-grid.js +0 -1
- package/autocomplete.js +29 -29
- package/badge.css +31 -0
- package/breadcrumb/breadcrumb-group.js +4 -4
- package/breadcrumb/breadcrumb.js +19 -19
- package/button/accent-button-link.js +9 -9
- package/button/accent-button-static.js +6 -6
- package/button/accent-button.js +6 -6
- package/button/button-link.js +7 -7
- package/button/button-static.js +7 -7
- package/button/button.js +8 -8
- package/button/common/button-common.d.ts.map +1 -1
- package/button/common.js +1 -1
- package/button/mini-button-group.js +8 -8
- package/button/secondary-button-link.js +7 -7
- package/button/secondary-button-static.js +7 -7
- package/button/secondary-button.js +3 -3
- package/button/transparent-button-link.js +6 -6
- package/button/transparent-button-static.js +5 -5
- package/button/transparent-button.js +6 -6
- package/calendar/calendar.d.ts +55 -11
- package/calendar/calendar.d.ts.map +1 -1
- package/calendar.js +374 -224
- package/card/card-badge.js +9 -9
- package/card/card-button.js +5 -5
- package/card/card-link.js +7 -7
- package/card/card.js +1 -1
- package/card/common/card-action-common.d.ts.map +1 -1
- package/checkbox/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/checkbox/checkbox-group.js +1 -1
- package/checkbox/checkbox-panel.js +16 -16
- package/checkbox/checkbox.js +15 -15
- package/checkbox/common/checkbox-common.d.ts.map +1 -1
- package/checkbox/common.js +3 -3
- package/clock.js +8 -8
- package/container/container.js +4 -4
- package/core/base-elements.js +10 -10
- package/core/controllers/escapable-overlay-controller.d.ts +11 -0
- package/core/controllers/escapable-overlay-controller.d.ts.map +1 -0
- package/core/controllers.d.ts +1 -0
- package/core/controllers.d.ts.map +1 -1
- package/core/controllers.js +73 -47
- package/core/datetime/date-adapter.d.ts +4 -2
- package/core/datetime/date-adapter.d.ts.map +1 -1
- package/core/datetime/native-date-adapter.d.ts +1 -1
- package/core/datetime/native-date-adapter.d.ts.map +1 -1
- package/core/datetime.js +51 -43
- package/core/decorators/date-converter.d.ts +8 -0
- package/core/decorators/date-converter.d.ts.map +1 -0
- package/core/decorators/date-only-type.d.ts +8 -0
- package/core/decorators/date-only-type.d.ts.map +1 -0
- package/core/decorators/get-override.d.ts.map +1 -1
- package/core/decorators/handle-distinct-change.d.ts.map +1 -1
- package/core/decorators/host-attributes.d.ts.map +1 -1
- package/core/decorators/slot-state.d.ts.map +1 -1
- package/core/decorators.d.ts +2 -0
- package/core/decorators.d.ts.map +1 -1
- package/core/decorators.js +52 -31
- package/core/dom/input-element.d.ts +1 -1
- package/core/dom/input-element.d.ts.map +1 -1
- package/core/dom.js +5 -5
- package/core/eventing/throttle.d.ts.map +1 -1
- package/core/eventing.js +4 -4
- package/core/i18n/i18n.d.ts +6 -0
- package/core/i18n/i18n.d.ts.map +1 -1
- package/core/i18n.js +106 -70
- package/core/mixins/disabled-mixin.d.ts.map +1 -1
- package/core/mixins/form-associated-checkbox-mixin.d.ts.map +1 -1
- package/core/mixins/form-associated-input-mixin.d.ts +25 -0
- package/core/mixins/form-associated-input-mixin.d.ts.map +1 -0
- package/core/mixins/form-associated-mixin.d.ts +16 -0
- package/core/mixins/form-associated-mixin.d.ts.map +1 -1
- package/core/mixins/form-associated-radio-button-mixin.d.ts.map +1 -1
- package/core/mixins/hydration-mixin.d.ts.map +1 -1
- package/core/mixins/named-slot-list-mixin.d.ts.map +1 -1
- package/core/mixins/negative-mixin.d.ts.map +1 -1
- package/core/mixins/panel-mixin.d.ts.map +1 -1
- package/core/mixins/required-mixin.d.ts.map +1 -1
- package/core/mixins/update-scheduler-mixin.d.ts.map +1 -1
- package/core/mixins.d.ts +1 -0
- package/core/mixins.d.ts.map +1 -1
- package/core/mixins.js +574 -295
- package/core/styles/badge.scss +3 -0
- package/core/styles/core.scss +3 -1
- package/core/styles/mixins/badge.scss +26 -1
- package/core/styles/mixins/font-face.scss +12 -12
- package/core/styles/mixins/link.scss +32 -8
- package/core/styles/standard-theme.scss +1 -0
- package/core/testing/mocha-extensions.d.ts.map +1 -1
- package/core/testing/wait-for-render.d.ts.map +1 -1
- package/core/testing.js +14 -14
- package/core.css +5 -5
- package/custom-elements.json +28284 -17221
- package/date-input/date-input.d.ts +67 -0
- package/date-input/date-input.d.ts.map +1 -0
- package/date-input.d.ts +2 -0
- package/date-input.d.ts.map +1 -0
- package/date-input.js +149 -0
- package/datepicker/common/datepicker-button.d.ts.map +1 -1
- package/datepicker/common.js +49 -45
- package/datepicker/datepicker/datepicker.d.ts +16 -6
- package/datepicker/datepicker/datepicker.d.ts.map +1 -1
- package/datepicker/datepicker-toggle/datepicker-toggle.d.ts.map +1 -1
- package/datepicker/datepicker-toggle.js +43 -40
- package/datepicker/datepicker.js +94 -76
- package/development/alert/alert-group.js +1 -1
- package/development/alert/alert.js +1 -1
- package/development/autocomplete/autocomplete-base-element.d.ts +1 -0
- package/development/autocomplete/autocomplete-base-element.d.ts.map +1 -1
- package/development/autocomplete/autocomplete.d.ts.map +1 -1
- package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.d.ts.map +1 -1
- package/development/autocomplete-grid/autocomplete-grid.js +1 -2
- package/development/autocomplete.js +10 -5
- package/development/breadcrumb/breadcrumb.js +5 -2
- package/development/button/common/button-common.d.ts.map +1 -1
- package/development/button/common.js +18 -14
- package/development/calendar/calendar.d.ts +55 -11
- package/development/calendar/calendar.d.ts.map +1 -1
- package/development/calendar.js +302 -88
- package/development/card/card.js +1 -1
- package/development/card/common/card-action-common.d.ts.map +1 -1
- package/development/checkbox/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/development/checkbox/checkbox-group.js +2 -2
- package/development/checkbox/checkbox-panel.js +1 -1
- package/development/checkbox/common/checkbox-common.d.ts.map +1 -1
- package/development/core/controllers/escapable-overlay-controller.d.ts +11 -0
- package/development/core/controllers/escapable-overlay-controller.d.ts.map +1 -0
- package/development/core/controllers.d.ts +1 -0
- package/development/core/controllers.d.ts.map +1 -1
- package/development/core/controllers.js +36 -1
- package/development/core/datetime/date-adapter.d.ts +4 -2
- package/development/core/datetime/date-adapter.d.ts.map +1 -1
- package/development/core/datetime/native-date-adapter.d.ts +1 -1
- package/development/core/datetime/native-date-adapter.d.ts.map +1 -1
- package/development/core/datetime.js +14 -2
- package/development/core/decorators/date-converter.d.ts +8 -0
- package/development/core/decorators/date-converter.d.ts.map +1 -0
- package/development/core/decorators/date-only-type.d.ts +8 -0
- package/development/core/decorators/date-only-type.d.ts.map +1 -0
- package/development/core/decorators/get-override.d.ts.map +1 -1
- package/development/core/decorators/handle-distinct-change.d.ts.map +1 -1
- package/development/core/decorators/host-attributes.d.ts.map +1 -1
- package/development/core/decorators/slot-state.d.ts.map +1 -1
- package/development/core/decorators.d.ts +2 -0
- package/development/core/decorators.d.ts.map +1 -1
- package/development/core/decorators.js +23 -2
- package/development/core/dom/input-element.d.ts +1 -1
- package/development/core/dom/input-element.d.ts.map +1 -1
- package/development/core/dom.js +3 -3
- package/development/core/eventing/throttle.d.ts.map +1 -1
- package/development/core/i18n/i18n.d.ts +6 -0
- package/development/core/i18n/i18n.d.ts.map +1 -1
- package/development/core/i18n.js +43 -1
- package/development/core/mixins/disabled-mixin.d.ts.map +1 -1
- package/development/core/mixins/form-associated-checkbox-mixin.d.ts.map +1 -1
- package/development/core/mixins/form-associated-input-mixin.d.ts +25 -0
- package/development/core/mixins/form-associated-input-mixin.d.ts.map +1 -0
- package/development/core/mixins/form-associated-mixin.d.ts +16 -0
- package/development/core/mixins/form-associated-mixin.d.ts.map +1 -1
- package/development/core/mixins/form-associated-radio-button-mixin.d.ts.map +1 -1
- package/development/core/mixins/hydration-mixin.d.ts.map +1 -1
- package/development/core/mixins/named-slot-list-mixin.d.ts.map +1 -1
- package/development/core/mixins/negative-mixin.d.ts.map +1 -1
- package/development/core/mixins/panel-mixin.d.ts.map +1 -1
- package/development/core/mixins/required-mixin.d.ts.map +1 -1
- package/development/core/mixins/update-scheduler-mixin.d.ts.map +1 -1
- package/development/core/mixins.d.ts +1 -0
- package/development/core/mixins.d.ts.map +1 -1
- package/development/core/mixins.js +460 -32
- package/development/core/testing/mocha-extensions.d.ts.map +1 -1
- package/development/core/testing/wait-for-render.d.ts.map +1 -1
- package/development/date-input/date-input.d.ts +67 -0
- package/development/date-input/date-input.d.ts.map +1 -0
- package/development/date-input.d.ts +2 -0
- package/development/date-input.d.ts.map +1 -0
- package/development/date-input.js +259 -0
- package/development/datepicker/common/datepicker-button.d.ts.map +1 -1
- package/development/datepicker/common.js +11 -2
- package/development/datepicker/datepicker/datepicker.d.ts +16 -6
- package/development/datepicker/datepicker/datepicker.d.ts.map +1 -1
- package/development/datepicker/datepicker-toggle/datepicker-toggle.d.ts.map +1 -1
- package/development/datepicker/datepicker-toggle.js +13 -4
- package/development/datepicker/datepicker.js +65 -39
- package/development/dialog/dialog/dialog.d.ts.map +1 -1
- package/development/dialog/dialog-title.js +1 -1
- package/development/dialog/dialog.js +3 -1
- package/development/expansion-panel/expansion-panel/expansion-panel.d.ts.map +1 -1
- package/development/expansion-panel/expansion-panel-header.js +1 -1
- package/development/expansion-panel/expansion-panel.js +3 -3
- package/development/file-selector/common/file-selector-common.d.ts.map +1 -1
- package/development/file-selector/common.js +1 -1
- package/development/footer.js +1 -1
- package/development/form-field/form-field/form-field.d.ts +1 -1
- package/development/form-field/form-field/form-field.d.ts.map +1 -1
- package/development/form-field/form-field.js +23 -14
- package/development/header/common/header-action-common.d.ts.map +1 -1
- package/development/icon/icon-name-mixin.d.ts.map +1 -1
- package/development/icon/icon-request.d.ts.map +1 -1
- package/development/icon/icon-validate.d.ts.map +1 -1
- package/development/image.js +1 -1
- package/development/journey-header.js +1 -1
- package/development/link/common/block-link-common.d.ts.map +1 -1
- package/development/link/common/inline-link-common.d.ts.map +1 -1
- package/development/link/common/link-common.d.ts.map +1 -1
- package/development/link/common.js +19 -7
- package/development/link-list/common.js +1 -1
- package/development/map-container.js +1 -1
- package/development/menu/common/menu-action-common.d.ts +3 -0
- package/development/menu/common/menu-action-common.d.ts.map +1 -1
- package/development/menu/common.js +35 -12
- package/development/menu/menu/menu.d.ts +1 -1
- package/development/menu/menu/menu.d.ts.map +1 -1
- package/development/menu/menu.js +5 -15
- package/development/navigation/common/navigation-action-common.d.ts.map +1 -1
- package/development/navigation/navigation/navigation.d.ts +1 -3
- package/development/navigation/navigation/navigation.d.ts.map +1 -1
- package/development/navigation/navigation-section.js +1 -1
- package/development/navigation/navigation.js +8 -21
- package/development/notification.js +1 -1
- package/development/overlay/overlay-base-element.d.ts +2 -2
- package/development/overlay/overlay-base-element.d.ts.map +1 -1
- package/development/overlay/overlay.d.ts.map +1 -1
- package/development/overlay.js +7 -14
- package/development/paginator/common/paginator-common.d.ts.map +1 -1
- package/development/popover/popover/popover.d.ts +1 -1
- package/development/popover/popover/popover.d.ts.map +1 -1
- package/development/popover/popover.js +5 -15
- package/development/radio-button/common/radio-button-common.d.ts.map +1 -1
- package/development/radio-button/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/development/radio-button/radio-button-group.js +2 -2
- package/development/radio-button/radio-button-panel.js +1 -1
- package/development/select/select.d.ts +6 -1
- package/development/select/select.d.ts.map +1 -1
- package/development/select.js +28 -6
- package/development/selection-expansion-panel/selection-expansion-panel.d.ts.map +1 -1
- package/development/selection-expansion-panel.js +2 -2
- package/development/skiplink-list.js +1 -1
- package/development/slider.js +1 -1
- package/development/stepper/step/step.d.ts +0 -2
- package/development/stepper/step/step.d.ts.map +1 -1
- package/development/stepper/step.js +1 -16
- package/development/stepper/stepper/stepper.d.ts +11 -0
- package/development/stepper/stepper/stepper.d.ts.map +1 -1
- package/development/stepper/stepper.js +30 -3
- package/development/tabs/tab-label.js +1 -1
- package/development/tag/tag/tag.d.ts +11 -0
- package/development/tag/tag/tag.d.ts.map +1 -1
- package/development/tag/tag-group/tag-group.d.ts +1 -1
- package/development/tag/tag-group/tag-group.d.ts.map +1 -1
- package/development/tag/tag-group.js +9 -3
- package/development/tag/tag.js +37 -10
- package/development/teaser-product/common/teaser-product-common.d.ts.map +1 -1
- package/development/timetable-occupancy.js +1 -1
- package/development/toast.js +1 -1
- package/development/toggle/toggle/toggle.d.ts +25 -6
- package/development/toggle/toggle/toggle.d.ts.map +1 -1
- package/development/toggle/toggle-option/toggle-option.d.ts +2 -6
- package/development/toggle/toggle-option/toggle-option.d.ts.map +1 -1
- package/development/toggle/toggle-option.js +21 -39
- package/development/toggle/toggle.js +57 -39
- package/development/train/train-formation.js +1 -1
- package/development/train/train.js +1 -1
- package/development/visual-checkbox.js +1 -1
- package/dialog/dialog/dialog.d.ts.map +1 -1
- package/dialog/dialog-content.js +3 -3
- package/dialog/dialog-title.js +8 -8
- package/dialog/dialog.js +2 -2
- package/divider.js +12 -12
- package/expansion-panel/expansion-panel/expansion-panel.d.ts.map +1 -1
- package/expansion-panel/expansion-panel-header.js +1 -1
- package/expansion-panel/expansion-panel.js +2 -2
- package/file-selector/common/file-selector-common.d.ts.map +1 -1
- package/file-selector/common.js +9 -9
- package/file-selector/file-selector-dropzone.js +5 -5
- package/file-selector/file-selector.js +6 -6
- package/flip-card/flip-card-details.js +4 -4
- package/flip-card/flip-card-summary.js +9 -9
- package/font-characters-extension.css +3 -3
- package/footer.js +4 -4
- package/form-field/form-field/form-field.d.ts +1 -1
- package/form-field/form-field/form-field.d.ts.map +1 -1
- package/form-field/form-field.js +32 -24
- package/header/common/header-action-common.d.ts.map +1 -1
- package/header/header-button.js +5 -5
- package/header/header-link.js +5 -5
- package/icon/icon-name-mixin.d.ts.map +1 -1
- package/icon/icon-request.d.ts.map +1 -1
- package/icon/icon-validate.d.ts.map +1 -1
- package/icon.js +36 -36
- package/image.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/journey-header.js +5 -5
- package/link/block-link-button.js +4 -4
- package/link/block-link-static.js +9 -9
- package/link/block-link.js +4 -4
- package/link/common/block-link-common.d.ts.map +1 -1
- package/link/common/inline-link-common.d.ts.map +1 -1
- package/link/common/link-common.d.ts.map +1 -1
- package/link/common.js +28 -28
- package/link/link-button.js +7 -7
- package/link/link-static.js +7 -7
- package/link/link.js +4 -4
- package/link-list/common.js +15 -15
- package/loading-indicator-circle.js +11 -11
- package/map-container.js +5 -5
- package/menu/common/menu-action-common.d.ts +3 -0
- package/menu/common/menu-action-common.d.ts.map +1 -1
- package/menu/common.js +34 -30
- package/menu/menu/menu.d.ts +1 -1
- package/menu/menu/menu.d.ts.map +1 -1
- package/menu/menu-button.js +8 -8
- package/menu/menu-link.js +6 -6
- package/menu/menu.js +29 -38
- package/navigation/common/navigation-action-common.d.ts.map +1 -1
- package/navigation/navigation/navigation.d.ts +1 -3
- package/navigation/navigation/navigation.d.ts.map +1 -1
- package/navigation/navigation-button.js +4 -4
- package/navigation/navigation-link.js +7 -7
- package/navigation/navigation-list.js +4 -4
- package/navigation/navigation-marker.js +3 -3
- package/navigation/navigation-section.js +1 -1
- package/navigation/navigation.js +45 -54
- package/notification.js +18 -18
- package/option/optgroup.js +11 -11
- package/overlay/overlay-base-element.d.ts +2 -2
- package/overlay/overlay-base-element.d.ts.map +1 -1
- package/overlay/overlay.d.ts.map +1 -1
- package/overlay.js +57 -63
- package/package.json +11 -2
- package/paginator/common/paginator-common.d.ts.map +1 -1
- package/paginator/common.js +6 -6
- package/popover/popover/popover.d.ts +1 -1
- package/popover/popover/popover.d.ts.map +1 -1
- package/popover/popover.js +105 -114
- package/radio-button/common/radio-button-common.d.ts.map +1 -1
- package/radio-button/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/radio-button/radio-button-group.js +1 -1
- package/radio-button/radio-button-panel.js +6 -6
- package/screen-reader-only.js +5 -5
- package/select/select.d.ts +6 -1
- package/select/select.d.ts.map +1 -1
- package/select.js +52 -43
- package/selection-expansion-panel/selection-expansion-panel.d.ts.map +1 -1
- package/selection-expansion-panel.js +1 -1
- package/skiplink-list.js +3 -3
- package/slider.js +13 -13
- package/standard-theme.css +37 -5
- package/status.js +3 -3
- package/stepper/step/step.d.ts +0 -2
- package/stepper/step/step.d.ts.map +1 -1
- package/stepper/step-label.js +4 -4
- package/stepper/step.js +24 -36
- package/stepper/stepper/stepper.d.ts +11 -0
- package/stepper/stepper/stepper.d.ts.map +1 -1
- package/stepper/stepper.js +59 -41
- package/table/table-wrapper.js +4 -4
- package/tabs/tab-group.js +24 -24
- package/tabs/tab-label.js +1 -1
- package/tabs/tab.js +4 -4
- package/tag/tag/tag.d.ts +11 -0
- package/tag/tag/tag.d.ts.map +1 -1
- package/tag/tag-group/tag-group.d.ts +1 -1
- package/tag/tag-group/tag-group.d.ts.map +1 -1
- package/tag/tag-group.js +34 -31
- package/tag/tag.js +60 -41
- package/teaser-product/common/teaser-product-common.d.ts.map +1 -1
- package/teaser-product/common.js +5 -5
- package/teaser-product/teaser-product-static.js +2 -2
- package/timetable-occupancy-icon.js +3 -3
- package/timetable-occupancy.js +6 -6
- package/toast.js +5 -5
- package/toggle/toggle/toggle.d.ts +25 -6
- package/toggle/toggle/toggle.d.ts.map +1 -1
- package/toggle/toggle-option/toggle-option.d.ts +2 -6
- package/toggle/toggle-option/toggle-option.d.ts.map +1 -1
- package/toggle/toggle-option.js +44 -52
- package/toggle/toggle.js +103 -83
- package/toggle-check.js +5 -5
- package/train/train-formation.js +1 -1
- package/train/train.js +29 -29
- package/visual-checkbox.js +1 -1
package/calendar.js
CHANGED
|
@@ -1,57 +1,64 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var ge = (h) => {
|
|
2
|
+
throw TypeError(h);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __esDecorate as
|
|
7
|
-
import { css as
|
|
8
|
-
import { customElement as
|
|
9
|
-
import { classMap as
|
|
10
|
-
import { sbbInputModalityDetector as
|
|
11
|
-
import { readConfig as
|
|
12
|
-
import { SbbLanguageController as
|
|
13
|
-
import { defaultDateAdapter as
|
|
14
|
-
import { forceType as
|
|
15
|
-
import { EventEmitter as
|
|
16
|
-
import { i18nPreviousMonth as
|
|
17
|
-
import { SbbHydrationMixin as
|
|
4
|
+
var pe = (h, _, g) => _.has(h) || ge("Cannot " + g);
|
|
5
|
+
var y = (h, _, g) => (pe(h, _, "read from private field"), g ? g.call(h) : _.get(h)), D = (h, _, g) => _.has(h) ? ge("Cannot add the same private member more than once") : _ instanceof WeakSet ? _.add(h) : _.set(h, g), b = (h, _, g, v) => (pe(h, _, "write to private field"), v ? v.call(h, g) : _.set(h, g), g);
|
|
6
|
+
import { __esDecorate as u, __runInitializers as c } from "tslib";
|
|
7
|
+
import { css as ye, LitElement as De, isServer as me, nothing as m, html as l } from "lit";
|
|
8
|
+
import { customElement as Ae, property as A, state as N } from "lit/decorators.js";
|
|
9
|
+
import { classMap as C } from "lit/directives/class-map.js";
|
|
10
|
+
import { sbbInputModalityDetector as xe, isArrowKeyOrPageKeysPressed as Ve } from "./core/a11y.js";
|
|
11
|
+
import { readConfig as ke } from "./core/config.js";
|
|
12
|
+
import { SbbLanguageController as $e, SbbMediaMatcherController as Me, SbbMediaQueryBreakpointMediumAndAbove as we } from "./core/controllers.js";
|
|
13
|
+
import { defaultDateAdapter as Ye, YEARS_PER_PAGE as w, DAYS_PER_ROW as f, MONTHS_PER_ROW as S, YEARS_PER_ROW as T, MONTHS_PER_PAGE as ze } from "./core/datetime.js";
|
|
14
|
+
import { forceType as Fe } from "./core/decorators.js";
|
|
15
|
+
import { EventEmitter as Re } from "./core/eventing.js";
|
|
16
|
+
import { i18nPreviousMonth as Ie, i18nNextMonth as Oe, i18nYearMonthSelection as Ne, i18nPreviousYear as Ce, i18nNextYear as Se, i18nCalendarDateSelection as ve, i18nPreviousYearRange as Te, i18nNextYearRange as Pe } from "./core/i18n.js";
|
|
17
|
+
import { SbbHydrationMixin as We } from "./core/mixins.js";
|
|
18
18
|
import "./button/secondary-button.js";
|
|
19
19
|
import "./icon.js";
|
|
20
20
|
import "./screen-reader-only.js";
|
|
21
|
-
const
|
|
22
|
-
let
|
|
23
|
-
var
|
|
24
|
-
let
|
|
25
|
-
var
|
|
21
|
+
const Ee = ye`*,:before,:after{box-sizing:border-box}:host{display:block;width:max-content;--sbb-calendar-cell-size: 2.5rem;--sbb-calendar-hover-shift: .0625rem;--sbb-calendar-wide-cell-size: 4.375rem;--sbb-calendar-cell-disabled-color: var(--sbb-color-granite);--sbb-calendar-header-color: var(--sbb-color-granite);--sbb-calendar-cell-background-color: transparent;--sbb-calendar-cell-padding: .125rem;--sbb-calendar-cell-color: var(--sbb-color-charcoal);--sbb-calendar-cell-selected-color: var(--sbb-color-white);--sbb-calendar-cell-selected-background-color: var(--sbb-color-charcoal);--sbb-calendar-cell-disabled-height: .09375rem;--sbb-calendar-cell-disabled-width: 1.59375rem;--sbb-calendar-cell-transition-duration: var( --sbb-disable-animation-duration, var(--sbb-animation-duration-2x) );--sbb-calendar-cell-transition-easing-function: var(--sbb-animation-easing);--sbb-calendar-tables-gap: var(--sbb-spacing-fixed-10x);--sbb-calendar-table-animation-shift: .00625rem;--sbb-calendar-table-animation-duration: .1ms;--sbb-calendar-table-column-spaces: 12;--sbb-calendar-control-view-change-height: 2.75rem;--sbb-calendar-control-view-change-color: var(--sbb-color-charcoal);--sbb-calendar-control-view-change-background: var(--sbb-color-white)}@media (min-width: 22.5rem){:host{--sbb-calendar-cell-size: 2.75rem;--sbb-calendar-wide-cell-size: 4.8125rem;--sbb-calendar-control-view-change-height: 3rem}}.sbb-calendar__wrapper{width:100%;display:block;transition-duration:var(--sbb-calendar-cell-transition-duration)}.sbb-calendar__controls{width:100%;display:inline-flex;align-items:center;gap:var(--sbb-spacing-fixed-2x);margin-block-end:var(--sbb-spacing-fixed-4x)}.sbb-calendar__controls-month{width:100%;display:flex;gap:var(--sbb-calendar-tables-gap)}#sbb-calendar__controls-previous,#sbb-calendar__controls-next{-webkit-tap-highlight-color:transparent}.sbb-calendar__controls-change-date{-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;outline:none;border:none;border-radius:0;padding:0;background:none;-webkit-tap-highlight-color:transparent;color:inherit;--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);display:flex;align-items:center;margin:auto;height:var(--sbb-calendar-control-view-change-height);text-transform:capitalize;cursor:pointer;padding-inline:var(--sbb-spacing-fixed-5x) var(--sbb-spacing-fixed-2x);border-radius:var(--sbb-border-radius-infinity);background-color:var(--sbb-calendar-control-view-change-background);color:var(--sbb-calendar-control-view-change-color);transition-duration:var(--sbb-calendar-cell-transition-duration);transition-timing-function:var(--sbb-calendar-cell-transition-easing-function);transition-property:background-color,padding-block-end}.sbb-calendar__controls-change-date:disabled{--sbb-calendar-control-view-change-background: var(--sbb-color-milk);--sbb-calendar-control-view-change-color: var(--sbb-calendar-cell-disabled-color);cursor:unset}.sbb-calendar__controls-change-date:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch]){outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width);outline-offset:var(--sbb-spacing-fixed-1x)}@media (any-hover: hover){.sbb-calendar__controls-change-date:not(:active,:disabled):hover{padding-block-end:var(--sbb-calendar-hover-shift)}}.sbb-calendar__controls-change-date:not(:disabled):active{--sbb-calendar-control-view-change-background: var(--sbb-color-milk)}.sbb-calendar__table-month-view,.sbb-calendar__table-year-view{--sbb-calendar-table-column-spaces: 6}.sbb-calendar__table-container{display:flex;gap:var(--sbb-calendar-tables-gap);margin-inline:var(--sbb-calendar-margin);--sbb-calendar-min-width: calc(7 * var(--sbb-calendar-cell-size));--sbb-calendar-overflow: calc(100% - var(--sbb-calendar-min-width));--sbb-calendar-start-offset: min( 0px, -1 * (var(--sbb-calendar-overflow) / var(--sbb-calendar-table-column-spaces)) );--sbb-calendar-margin: var(--sbb-calendar-start-offset)}:host([data-wide]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc( 2 * 7 * var(--sbb-calendar-cell-size) + var(--sbb-calendar-tables-gap) );--sbb-calendar-margin: calc(.5 * var(--sbb-calendar-start-offset))}:host([orientation=vertical]) .sbb-calendar__table-container{min-width:var(--sbb-calendar-min-width);--sbb-calendar-start-offset: 0}:host([orientation=vertical][data-wide]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc( 13 * var(--sbb-calendar-cell-size) + var(--sbb-calendar-tables-gap) )}.sbb-calendar__table{width:100%;border-collapse:collapse;height:max-content;animation-name:show;animation-duration:var(--sbb-calendar-table-animation-duration)}.sbb-calendar__table.sbb-calendar__table-hide{--sbb-calendar-cell-transition-duration: 0ms;animation-name:hide;animation-duration:var(--sbb-calendar-table-animation-duration)}:host(:not([data-wide])) .sbb-calendar__table{min-width:100%}.sbb-calendar__table-header{--sbb-text-font-size: var(--sbb-font-size-text-xs);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);color:var(--sbb-calendar-header-color);width:var(--sbb-calendar-cell-size);padding:0;text-align:center}:host([orientation=horizontal]) .sbb-calendar__table-header{padding-block-end:var(--sbb-spacing-fixed-4x)}:host([orientation=vertical]) .sbb-calendar__table-header{padding-inline-end:var(--sbb-spacing-fixed-1x)}.sbb-calendar__table-data{position:relative;padding:0;text-align:center}.sbb-calendar__cell{-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;margin:0;outline:none;border:none;border-radius:0;padding:0;background:none;-webkit-tap-highlight-color:transparent;color:inherit;--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);height:var(--sbb-calendar-cell-size);color:var(--sbb-calendar-cell-color);cursor:pointer;position:relative;z-index:0}.sbb-calendar__cell:before{content:"";position:absolute;inset:var(--sbb-calendar-cell-padding);background-color:var(--sbb-calendar-cell-background-color);border-radius:50%;z-index:-1;transition-duration:var(--sbb-calendar-cell-transition-duration);transition-timing-function:var(--sbb-calendar-cell-transition-easing-function);transition-property:background-color}@media (any-hover: hover){.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover{--sbb-calendar-cell-background-color: var(--sbb-color-milk);padding-block-end:var(--sbb-calendar-hover-shift)}}@media (any-hover: hover) and (forced-colors: active){.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}}.sbb-calendar__cell:disabled{--sbb-calendar-cell-color: var(--sbb-calendar-cell-disabled-color);cursor:unset}.sbb-calendar__cell:focus-visible:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active{--sbb-calendar-cell-background-color: var(--sbb-color-cloud)}@media (forced-colors: active){.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}}.sbb-calendar__day{border-radius:50%;width:var(--sbb-calendar-cell-size)}.sbb-calendar__day:before{border-radius:50%}.sbb-calendar__pill{width:var(--sbb-calendar-wide-cell-size);border-radius:var(--sbb-border-radius-infinity)}.sbb-calendar__pill:before{border-radius:var(--sbb-border-radius-infinity)}.sbb-calendar__crossed-out:after{content:"";height:var(--sbb-calendar-cell-disabled-height);width:var(--sbb-calendar-cell-disabled-width);position:absolute;background-color:var(--sbb-calendar-cell-disabled-color);top:50%;left:50%;transform:translate(-50%,-50%) rotate(-45deg)}.sbb-calendar__cell-current{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);font-weight:700}.sbb-calendar__selected{--sbb-calendar-cell-color: var(--sbb-calendar-cell-selected-color);--sbb-calendar-cell-background-color: var(--sbb-calendar-cell-selected-background-color)}@media (forced-colors: active){.sbb-calendar__selected{--sbb-calendar-cell-background-color: ButtonText !important}}@keyframes show{0%{opacity:0;transform:translateY(var(--sbb-calendar-table-animation-shift))}to{opacity:1;transform:translateY(0)}}@keyframes hide{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(var(--sbb-calendar-table-animation-shift))}}`;
|
|
22
|
+
let rt = (() => {
|
|
23
|
+
var V, k, $, M, Y, z, F, R, d;
|
|
24
|
+
let h = [Ae("sbb-calendar")], _, g = [], v, W = We(De), x = [], E, L = [], B = [], q, K = [], U = [], H, j, G, Q, J, X = [], Z = [], ee, te = [], ae = [], se, ie = [], re = [], ne, le = [], oe = [], de, ce, he = [], be = [], _e, ue = [], fe = [];
|
|
25
|
+
var P = (d = class extends W {
|
|
26
26
|
constructor() {
|
|
27
27
|
var e;
|
|
28
28
|
super();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
D(this, V);
|
|
30
|
+
D(this, k);
|
|
31
|
+
D(this, $);
|
|
32
|
+
D(this, M);
|
|
33
|
+
D(this, Y);
|
|
34
|
+
D(this, z);
|
|
35
|
+
D(this, F);
|
|
36
|
+
D(this, R);
|
|
37
|
+
b(this, V, (c(this, x), c(this, L, !1))), b(this, k, (c(this, B), c(this, K, "day"))), this._min = c(this, U), this._now = null, b(this, $, c(this, X, null)), b(this, M, (c(this, Z), c(this, te, "horizontal"))), this._dateAdapter = (c(this, ae), ((e = ke().datetime) == null ? void 0 : e.dateAdapter) ?? Ye), this._dateSelected = new Re(this, P.events.dateSelected), b(this, Y, c(this, ie, this.now)), b(this, z, (c(this, re), c(this, le, void 0))), b(this, F, (c(this, oe), c(this, he, "day"))), this._nextCalendarView = (c(this, be), "day"), this._keyboardNavigationDayViewParameters = {
|
|
38
|
+
firstDayInView: null,
|
|
39
|
+
lastDayInView: null,
|
|
40
|
+
firstMonthOffset: 0,
|
|
41
|
+
firstMonthLength: 0,
|
|
42
|
+
secondMonthOffset: 0
|
|
43
|
+
}, this._weeks = [], this._monthNames = this._dateAdapter.getMonthNames("long"), this._resetFocus = !1, b(this, R, c(this, ue, !1)), this._language = (c(this, fe), new $e(this).withHandler(() => {
|
|
37
44
|
this._monthNames = this._dateAdapter.getMonthNames("long"), this._createMonthRows();
|
|
38
|
-
})), this._mediaMatcher = new
|
|
39
|
-
[
|
|
45
|
+
})), this._mediaMatcher = new Me(this, {
|
|
46
|
+
[we]: () => this._init()
|
|
40
47
|
}), this._createMonthRows(), this._setWeekdays();
|
|
41
48
|
}
|
|
42
49
|
/** If set to true, two months are displayed */
|
|
43
50
|
get wide() {
|
|
44
|
-
return
|
|
51
|
+
return y(this, V);
|
|
45
52
|
}
|
|
46
53
|
set wide(e) {
|
|
47
|
-
|
|
54
|
+
b(this, V, e);
|
|
48
55
|
}
|
|
49
56
|
/** The initial view of the calendar which should be displayed on opening. */
|
|
50
57
|
get view() {
|
|
51
|
-
return
|
|
58
|
+
return y(this, k);
|
|
52
59
|
}
|
|
53
60
|
set view(e) {
|
|
54
|
-
|
|
61
|
+
b(this, k, e);
|
|
55
62
|
}
|
|
56
63
|
/** The minimum valid date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970). */
|
|
57
64
|
set min(e) {
|
|
@@ -83,24 +90,31 @@ let et = (() => {
|
|
|
83
90
|
}
|
|
84
91
|
/** A function used to filter out dates. */
|
|
85
92
|
get dateFilter() {
|
|
86
|
-
return
|
|
93
|
+
return y(this, $);
|
|
87
94
|
}
|
|
88
95
|
set dateFilter(e) {
|
|
89
|
-
|
|
96
|
+
b(this, $, e);
|
|
97
|
+
}
|
|
98
|
+
/** The orientation of days in the calendar. */
|
|
99
|
+
get orientation() {
|
|
100
|
+
return y(this, M);
|
|
101
|
+
}
|
|
102
|
+
set orientation(e) {
|
|
103
|
+
b(this, M, e);
|
|
90
104
|
}
|
|
91
105
|
/** The currently active date. */
|
|
92
106
|
get _activeDate() {
|
|
93
|
-
return
|
|
107
|
+
return y(this, Y);
|
|
94
108
|
}
|
|
95
109
|
set _activeDate(e) {
|
|
96
|
-
|
|
110
|
+
b(this, Y, e);
|
|
97
111
|
}
|
|
98
112
|
/** The selected date as ISOString. */
|
|
99
113
|
get _selected() {
|
|
100
|
-
return
|
|
114
|
+
return y(this, z);
|
|
101
115
|
}
|
|
102
116
|
set _selected(e) {
|
|
103
|
-
|
|
117
|
+
b(this, z, e);
|
|
104
118
|
}
|
|
105
119
|
/** The current wide property considering property value and breakpoints. From zero to small `wide` has always to be false. */
|
|
106
120
|
set _wide(e) {
|
|
@@ -110,20 +124,20 @@ let et = (() => {
|
|
|
110
124
|
return this.hasAttribute("data-wide");
|
|
111
125
|
}
|
|
112
126
|
get _calendarView() {
|
|
113
|
-
return
|
|
127
|
+
return y(this, F);
|
|
114
128
|
}
|
|
115
129
|
set _calendarView(e) {
|
|
116
|
-
|
|
130
|
+
b(this, F, e);
|
|
117
131
|
}
|
|
118
132
|
/** A list of buttons corresponding to days, months or years depending on the view. */
|
|
119
133
|
get _cells() {
|
|
120
134
|
return Array.from(this.shadowRoot.querySelectorAll(".sbb-calendar__cell") ?? []);
|
|
121
135
|
}
|
|
122
136
|
get _initialized() {
|
|
123
|
-
return
|
|
137
|
+
return y(this, R);
|
|
124
138
|
}
|
|
125
139
|
set _initialized(e) {
|
|
126
|
-
|
|
140
|
+
b(this, R, e);
|
|
127
141
|
}
|
|
128
142
|
_dateFilter(e) {
|
|
129
143
|
var t;
|
|
@@ -139,21 +153,21 @@ let et = (() => {
|
|
|
139
153
|
};
|
|
140
154
|
}
|
|
141
155
|
willUpdate(e) {
|
|
142
|
-
super.willUpdate(e), this._initialized && (e.has("wide") && this.resetPosition(), e.has("view") && (this._setChosenYear(), this._chosenMonth = void 0, this._nextCalendarView = this._calendarView = this.view));
|
|
156
|
+
super.willUpdate(e), this._initialized && ((e.has("wide") || e.has("orientation")) && this.resetPosition(), e.has("view") && (this._setChosenYear(), this._chosenMonth = void 0, this._nextCalendarView = this._calendarView = this.view));
|
|
143
157
|
}
|
|
144
158
|
updated(e) {
|
|
145
|
-
super.updated(e), this._setTabIndex(),
|
|
159
|
+
super.updated(e), this._setTabIndex(), xe.mostRecentModality === "keyboard" && this._focusCell();
|
|
146
160
|
}
|
|
147
161
|
/** Initializes the component. */
|
|
148
162
|
_init(e) {
|
|
149
|
-
if (!
|
|
163
|
+
if (!me) {
|
|
150
164
|
if (this.hydrationRequired) {
|
|
151
165
|
this.hydrationComplete.then(() => this._init());
|
|
152
166
|
return;
|
|
153
167
|
}
|
|
154
|
-
if (e && this._assignActiveDate(e), this._wide = (this._mediaMatcher.matches(
|
|
168
|
+
if (e && this._assignActiveDate(e), this._wide = (this._mediaMatcher.matches(we) ?? !1) && this.wide, this._weeks = this._createWeekRows(this._activeDate), this._years = this._createYearRows(), this._nextMonthWeeks = [[]], this._nextMonthYears = [[]], this._wide) {
|
|
155
169
|
const t = this._dateAdapter.addCalendarMonths(this._activeDate, 1);
|
|
156
|
-
this._nextMonthWeeks = this._createWeekRows(t), this._nextMonthYears = this._createYearRows(
|
|
170
|
+
this._nextMonthWeeks = this._createWeekRows(t, !0), this._nextMonthYears = this._createYearRows(w);
|
|
157
171
|
}
|
|
158
172
|
this._initialized = !0;
|
|
159
173
|
}
|
|
@@ -171,20 +185,62 @@ let et = (() => {
|
|
|
171
185
|
})), s = this._dateAdapter.getFirstDayOfWeek();
|
|
172
186
|
this._weekdays = a.slice(s).concat(a.slice(0, s));
|
|
173
187
|
}
|
|
174
|
-
/** Creates the rows for each week. */
|
|
175
|
-
_createWeekRows(e) {
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
188
|
+
/** Creates the rows for each week and sets the parameters used in keyboard navigation. */
|
|
189
|
+
_createWeekRows(e, t = !1) {
|
|
190
|
+
const a = this._dateAdapter.getDateNames(), s = this._dateAdapter.getNumDaysInMonth(e), i = this._dateAdapter.getFirstWeekOffset(e);
|
|
191
|
+
return t ? (this._keyboardNavigationDayViewParameters.secondMonthOffset = i, this._keyboardNavigationDayViewParameters.lastDayInView = this._dateAdapter.toIso8601(this._dateAdapter.createDate(this._dateAdapter.getYear(e), this._dateAdapter.getMonth(e), s))) : (this._keyboardNavigationDayViewParameters.firstMonthLength = s, this._keyboardNavigationDayViewParameters.firstMonthOffset = i, this._keyboardNavigationDayViewParameters.firstDayInView = this._dateAdapter.toIso8601(this._dateAdapter.createDate(this._dateAdapter.getYear(e), this._dateAdapter.getMonth(e), 1)), this._keyboardNavigationDayViewParameters.lastDayInView = this._dateAdapter.toIso8601(this._dateAdapter.createDate(this._dateAdapter.getYear(e), this._dateAdapter.getMonth(e), s))), this.orientation === "horizontal" ? this._createWeekRowsHorizontal(e, a, s, i) : this._createWeekRowsVertical(e, a, s, i);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Creates the rows for each week in orientation='horizontal'.
|
|
195
|
+
*
|
|
196
|
+
* Iterates through the days of the months, creates a Day object for each and pushes it into and array.
|
|
197
|
+
* Each seven days (considering the offset at the beginning of the month) restarts from an empty array.
|
|
198
|
+
*
|
|
199
|
+
* The result is a matrix in which every row is a week (or part of it, considering offset).
|
|
200
|
+
*/
|
|
201
|
+
_createWeekRowsHorizontal(e, t, a, s) {
|
|
202
|
+
const i = [[]];
|
|
203
|
+
for (let r = 0, n = s; r < a; r++, n++) {
|
|
204
|
+
n === f && (i.push([]), n = 0);
|
|
205
|
+
const o = this._dateAdapter.createDate(this._dateAdapter.getYear(e), this._dateAdapter.getMonth(e), r + 1);
|
|
206
|
+
i[i.length - 1].push({
|
|
207
|
+
value: this._dateAdapter.toIso8601(o),
|
|
208
|
+
dateValue: o,
|
|
209
|
+
dayValue: t[r],
|
|
210
|
+
monthValue: String(this._dateAdapter.getMonth(o)),
|
|
211
|
+
yearValue: String(this._dateAdapter.getYear(o))
|
|
185
212
|
});
|
|
186
213
|
}
|
|
187
|
-
return
|
|
214
|
+
return i;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Creates the rows for each week in orientation='vertical'.
|
|
218
|
+
*
|
|
219
|
+
* Creates a matrix with seven empty rows.
|
|
220
|
+
* Iterates through the days of the months, creates a Day object for each
|
|
221
|
+
* and pushes it into the correct array considering the offset at the beginning of the month.
|
|
222
|
+
* Each seven days (including offset) restarts from the first.
|
|
223
|
+
*
|
|
224
|
+
* The result is a matrix in which every row is a set of weekdays, so:
|
|
225
|
+
* - row 0: all the Mondays;
|
|
226
|
+
* - row 1: all the Tuesdays;
|
|
227
|
+
* - ...
|
|
228
|
+
* - row 7: all the Sundays.
|
|
229
|
+
*/
|
|
230
|
+
_createWeekRowsVertical(e, t, a, s) {
|
|
231
|
+
const i = Array.from({ length: f }, () => []);
|
|
232
|
+
for (let r = 0, n = s; r < a; r++, n++) {
|
|
233
|
+
n === f && (n = 0);
|
|
234
|
+
const o = this._dateAdapter.createDate(this._dateAdapter.getYear(e), this._dateAdapter.getMonth(e), r + 1);
|
|
235
|
+
i[n].push({
|
|
236
|
+
value: this._dateAdapter.toIso8601(o),
|
|
237
|
+
dateValue: o,
|
|
238
|
+
dayValue: t[r],
|
|
239
|
+
monthValue: String(this._dateAdapter.getMonth(o)),
|
|
240
|
+
yearValue: String(this._dateAdapter.getYear(o))
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return i;
|
|
188
244
|
}
|
|
189
245
|
/** Creates the rows for the month selection view. */
|
|
190
246
|
_createMonthRows() {
|
|
@@ -192,16 +248,16 @@ let et = (() => {
|
|
|
192
248
|
value: e[r],
|
|
193
249
|
longValue: this._monthNames[r],
|
|
194
250
|
monthValue: r + 1
|
|
195
|
-
})), a = 12 /
|
|
251
|
+
})), a = 12 / S, s = [];
|
|
196
252
|
for (let i = 0; i < a; i++)
|
|
197
|
-
s.push(t.slice(
|
|
253
|
+
s.push(t.slice(S * i, S * (i + 1)));
|
|
198
254
|
this._months = s;
|
|
199
255
|
}
|
|
200
256
|
/** Creates the rows for the year selection view. */
|
|
201
257
|
_createYearRows(e = 0) {
|
|
202
|
-
const t = this._getStartValueYearView(), a = new Array(
|
|
258
|
+
const t = this._getStartValueYearView(), a = new Array(w).fill(0).map((r, n) => t + e + n), s = w / T, i = [];
|
|
203
259
|
for (let r = 0; r < s; r++)
|
|
204
|
-
i.push(a.slice(
|
|
260
|
+
i.push(a.slice(T * r, T * (r + 1)));
|
|
205
261
|
return i;
|
|
206
262
|
}
|
|
207
263
|
/**
|
|
@@ -216,9 +272,9 @@ let et = (() => {
|
|
|
216
272
|
*/
|
|
217
273
|
_getStartValueYearView() {
|
|
218
274
|
let e = 0;
|
|
219
|
-
this.max ? e = this._dateAdapter.getYear(this.max) -
|
|
275
|
+
this.max ? e = this._dateAdapter.getYear(this.max) - w + 1 : this.min && (e = this._dateAdapter.getYear(this.min));
|
|
220
276
|
const t = this._dateAdapter.getYear(this._activeDate);
|
|
221
|
-
return t - ((t - e) %
|
|
277
|
+
return t - ((t - e) % w + w) % w;
|
|
222
278
|
}
|
|
223
279
|
/** Checks if date is within the min-max range. */
|
|
224
280
|
_isDayInRange(e) {
|
|
@@ -227,12 +283,14 @@ let et = (() => {
|
|
|
227
283
|
const t = this._dateAdapter.isValid(this.min) && this._dateAdapter.compareDate(this.min, this._dateAdapter.deserialize(e)) > 0, a = this._dateAdapter.isValid(this.max) && this._dateAdapter.compareDate(this.max, this._dateAdapter.deserialize(e)) < 0;
|
|
228
284
|
return !(t || a);
|
|
229
285
|
}
|
|
286
|
+
/** Checks if date is within the min-max range in month view. */
|
|
230
287
|
_isMonthInRange(e, t) {
|
|
231
288
|
if (!this.min && !this.max)
|
|
232
289
|
return !0;
|
|
233
290
|
const a = this._dateAdapter.isValid(this.min) && (t < this._dateAdapter.getYear(this.min) || t === this._dateAdapter.getYear(this.min) && e < this._dateAdapter.getMonth(this.min)), s = this._dateAdapter.isValid(this.max) && (t > this._dateAdapter.getYear(this.max) || t === this._dateAdapter.getYear(this.max) && e > this._dateAdapter.getMonth(this.max));
|
|
234
291
|
return !(a || s);
|
|
235
292
|
}
|
|
293
|
+
/** Checks if date is within the min-max range in year view. */
|
|
236
294
|
_isYearInRange(e) {
|
|
237
295
|
if (!this.min && !this.max)
|
|
238
296
|
return !0;
|
|
@@ -303,18 +361,22 @@ let et = (() => {
|
|
|
303
361
|
let e = this._dateAdapter.addCalendarMonths(this._activeDate, this._wide ? 2 : 1);
|
|
304
362
|
return e = this._dateAdapter.createDate(this._dateAdapter.getYear(e), this._dateAdapter.getMonth(e), 1), this._nextDisabled(e);
|
|
305
363
|
}
|
|
364
|
+
/** Checks if the "previous year" button should be disabled. */
|
|
306
365
|
_previousYearDisabled() {
|
|
307
366
|
const e = this._dateAdapter.createDate(this._dateAdapter.getYear(this._activeDate) - 1, 12, 31);
|
|
308
367
|
return this._prevDisabled(e);
|
|
309
368
|
}
|
|
369
|
+
/** Checks if the "next year" button should be disabled. */
|
|
310
370
|
_nextYearDisabled() {
|
|
311
371
|
const e = this._dateAdapter.createDate(this._dateAdapter.getYear(this._activeDate) + (this._wide ? 2 : 1), 1, 1);
|
|
312
372
|
return this._nextDisabled(e);
|
|
313
373
|
}
|
|
374
|
+
/** Checks if the "previous year" button should be disabled in year view. */
|
|
314
375
|
_previousYearRangeDisabled() {
|
|
315
376
|
const e = this._dateAdapter.createDate(this._years[0][0] - 1, 12, 31);
|
|
316
377
|
return this._prevDisabled(e);
|
|
317
378
|
}
|
|
379
|
+
/** Checks if the "next year" button should be disabled in year view. */
|
|
318
380
|
_nextYearRangeDisabled() {
|
|
319
381
|
const e = this._wide ? this._nextMonthYears : this._years, t = e[e.length - 1], a = t[t.length - 1], s = this._dateAdapter.createDate(a + 1, 1, 1);
|
|
320
382
|
return this._nextDisabled(s);
|
|
@@ -327,82 +389,146 @@ let et = (() => {
|
|
|
327
389
|
const e = this._getFirstFocusable();
|
|
328
390
|
e && (e.tabIndex = 0);
|
|
329
391
|
}
|
|
392
|
+
/** Get the element in the calendar to assign focus. */
|
|
330
393
|
_getFirstFocusable() {
|
|
331
394
|
const e = this._selected ? this._dateAdapter.deserialize(this._selected) : this.now;
|
|
332
|
-
let t = this.shadowRoot.querySelector(".sbb-calendar__selected") ?? this.shadowRoot.querySelector(`[
|
|
333
|
-
return (!t || t != null && t.disabled) && (t = this.shadowRoot.querySelector(".sbb-calendar__cell:not([disabled])")), t || null;
|
|
395
|
+
let t = this.shadowRoot.querySelector(".sbb-calendar__selected") ?? this.shadowRoot.querySelector(`[value="${this._dateAdapter.toIso8601(e)}"]`) ?? this.shadowRoot.querySelector(`[data-month="${this._dateAdapter.getMonth(e)}"]`) ?? this.shadowRoot.querySelector(`[data-year="${this._dateAdapter.getYear(e)}"]`);
|
|
396
|
+
return (!t || t != null && t.disabled) && (t = this._calendarView === "day" ? this._getFirstFocusableDay() : this.shadowRoot.querySelector(".sbb-calendar__cell:not([disabled])")), t || null;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* In `day` view in `vertical` orientation,
|
|
400
|
+
* if the first of the month is not a Monday, it is not the first rendered element in the table,
|
|
401
|
+
* so `this.shadowRoot!.querySelector('.sbb-calendar__cell:not([disabled])')` will return a wrong value.
|
|
402
|
+
*
|
|
403
|
+
* To solve this, the element with the lowest `value` is taken (ISO String are ordered).
|
|
404
|
+
*/
|
|
405
|
+
_getFirstFocusableDay() {
|
|
406
|
+
const e = Array.from(this.shadowRoot.querySelectorAll(".sbb-calendar__cell:not([disabled])"));
|
|
407
|
+
if (!e || e.length === 0)
|
|
408
|
+
return null;
|
|
409
|
+
{
|
|
410
|
+
const t = e.map((a) => a.value).sort()[0];
|
|
411
|
+
return this.shadowRoot.querySelector(`.sbb-calendar__cell[value="${t}"]`);
|
|
412
|
+
}
|
|
334
413
|
}
|
|
335
414
|
_handleKeyboardEvent(e, t) {
|
|
336
|
-
|
|
337
|
-
const a = this._cells, s = a.findIndex((
|
|
415
|
+
Ve(e) && e.preventDefault();
|
|
416
|
+
const a = this._cells, s = a.findIndex((n) => n === e.target);
|
|
417
|
+
let i;
|
|
418
|
+
t ? i = this._navigateByKeyboardDayView(e, s, a, t) : i = this._navigateByKeyboard(e, s, a);
|
|
419
|
+
const r = this.shadowRoot.activeElement;
|
|
338
420
|
i !== r && (i.tabIndex = 0, i == null || i.focus(), r.tabIndex = -1);
|
|
339
421
|
}
|
|
422
|
+
_navigateByKeyboardDayView(e, t, a, s) {
|
|
423
|
+
const i = this.orientation === "horizontal" ? { leftRight: 1, upDown: f } : { leftRight: f, upDown: 1 }, r = t < this._keyboardNavigationDayViewParameters.firstMonthLength ? this._keyboardNavigationDayViewParameters.firstMonthOffset : this._keyboardNavigationDayViewParameters.secondMonthOffset;
|
|
424
|
+
switch (e.key) {
|
|
425
|
+
case "ArrowUp":
|
|
426
|
+
return this._findDayArrows(a, t, s.dateValue, -i.upDown);
|
|
427
|
+
case "ArrowDown":
|
|
428
|
+
return this._findDayArrows(a, t, s.dateValue, i.upDown);
|
|
429
|
+
case "ArrowLeft":
|
|
430
|
+
return this._findDayArrows(a, t, s.dateValue, -i.leftRight);
|
|
431
|
+
case "ArrowRight":
|
|
432
|
+
return this._findDayArrows(a, t, s.dateValue, i.leftRight);
|
|
433
|
+
case "PageUp":
|
|
434
|
+
if (this.orientation === "horizontal") {
|
|
435
|
+
const o = (+s.dayValue % f || f) - +s.dayValue;
|
|
436
|
+
return this._findDayPageUpDown(a, t, s, o, i.upDown);
|
|
437
|
+
} else {
|
|
438
|
+
const p = (Math.ceil((+s.dayValue + r) / f) - 1) * f - r + 1 - +s.dayValue;
|
|
439
|
+
return this._findDayPageUpDown(a, t, s, p, i.upDown);
|
|
440
|
+
}
|
|
441
|
+
case "PageDown":
|
|
442
|
+
if (this.orientation === "horizontal") {
|
|
443
|
+
const n = +s.monthValue + 1 > 12 ? 1 : +s.monthValue + 1, o = +s.monthValue + 1 > 12 ? +s.yearValue + 1 : +s.yearValue, p = this._dateAdapter.createDate(o, n, 1), I = this._dateAdapter.getDate(this._dateAdapter.addCalendarDays(p, -1)), O = Math.trunc((I - +s.dayValue) / f) * f;
|
|
444
|
+
return this._findDayPageUpDown(a, t, s, O, -i.upDown);
|
|
445
|
+
} else {
|
|
446
|
+
const p = Math.ceil((+s.dayValue + r) / f) * f - r - +s.dayValue;
|
|
447
|
+
return this._findDayPageUpDown(a, t, s, p, -i.upDown);
|
|
448
|
+
}
|
|
449
|
+
case "Home":
|
|
450
|
+
return this._findDayFirst(a, t, s, 1);
|
|
451
|
+
case "End": {
|
|
452
|
+
const n = +s.monthValue + 1 > 12 ? 1 : +s.monthValue + 1, o = +s.monthValue + 1 > 12 ? +s.yearValue + 1 : +s.yearValue, p = this._dateAdapter.createDate(o, n, 1);
|
|
453
|
+
return this._findDayLast(a, t, p);
|
|
454
|
+
}
|
|
455
|
+
default:
|
|
456
|
+
return a[t];
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
_isDayOutOfView(e) {
|
|
460
|
+
return e < this._keyboardNavigationDayViewParameters.firstDayInView || e > this._keyboardNavigationDayViewParameters.lastDayInView;
|
|
461
|
+
}
|
|
462
|
+
_findDayArrows(e, t, a, s) {
|
|
463
|
+
const i = this._dateAdapter.toIso8601(this._dateAdapter.addCalendarDays(a, s));
|
|
464
|
+
if (this._isDayOutOfView(i))
|
|
465
|
+
return e[t];
|
|
466
|
+
const r = e.find((n) => n.value === i);
|
|
467
|
+
return !r || r.disabled ? this._findDayArrows(e, t, this._dateAdapter.deserialize(i), s) : r;
|
|
468
|
+
}
|
|
469
|
+
_findDayPageUpDown(e, t, a, s, i) {
|
|
470
|
+
const r = this._dateAdapter.toIso8601(this._dateAdapter.addCalendarDays(a.dateValue, s));
|
|
471
|
+
if (this._isDayOutOfView(r))
|
|
472
|
+
return e[t];
|
|
473
|
+
const n = e.find((o) => o.value === r);
|
|
474
|
+
return !n || n.disabled ? this._findDayPageUpDown(e, t, a, s + i, i) : n;
|
|
475
|
+
}
|
|
476
|
+
_findDayFirst(e, t, a, s) {
|
|
477
|
+
const i = this._dateAdapter.toIso8601(this._dateAdapter.createDate(+a.yearValue, +a.monthValue, s));
|
|
478
|
+
if (this._isDayOutOfView(i))
|
|
479
|
+
return e[t];
|
|
480
|
+
const r = e.find((n) => n.value === i);
|
|
481
|
+
return !r || r.disabled ? this._findDayFirst(e, t, a, s + 1) : r;
|
|
482
|
+
}
|
|
483
|
+
_findDayLast(e, t, a) {
|
|
484
|
+
const s = this._dateAdapter.toIso8601(this._dateAdapter.addCalendarDays(a, -1));
|
|
485
|
+
if (this._isDayOutOfView(s))
|
|
486
|
+
return e[t];
|
|
487
|
+
const i = e.find((r) => r.value === s);
|
|
488
|
+
return !i || i.disabled ? this._findDayLast(e, t, this._dateAdapter.deserialize(s)) : i;
|
|
489
|
+
}
|
|
340
490
|
/**
|
|
341
491
|
* Gets the index of the element to move to, based on a list of elements (which can be potentially disabled),
|
|
342
492
|
* the keyboard input and the position of the current element in the list.
|
|
343
493
|
* In the day view, the `day?: Day` parameter is mandatory for calculation,
|
|
344
494
|
* while in month and year view it's not due to the fixed amount of rendered cells.
|
|
345
495
|
*/
|
|
346
|
-
_navigateByKeyboard(e, t, a
|
|
347
|
-
const { elementIndexForWideMode:
|
|
496
|
+
_navigateByKeyboard(e, t, a) {
|
|
497
|
+
const { elementIndexForWideMode: s, offsetForWideMode: i, lastElementIndexForWideMode: r, verticalOffset: n } = this._calculateParametersForKeyboardNavigation(t, this._calendarView === "year");
|
|
348
498
|
switch (e.key) {
|
|
349
499
|
case "ArrowUp":
|
|
350
|
-
return this._findNext(a, t, -
|
|
500
|
+
return this._findNext(a, t, -n);
|
|
351
501
|
case "ArrowDown":
|
|
352
|
-
return this._findNext(a, t,
|
|
502
|
+
return this._findNext(a, t, n);
|
|
353
503
|
case "ArrowLeft":
|
|
354
504
|
return this._findNext(a, t, -1);
|
|
355
505
|
case "ArrowRight":
|
|
356
506
|
return this._findNext(a, t, 1);
|
|
357
507
|
case "Home":
|
|
358
|
-
return this._findFirst(a,
|
|
508
|
+
return this._findFirst(a, i);
|
|
359
509
|
case "PageUp":
|
|
360
|
-
return this._findFirstOnColumn(a,
|
|
510
|
+
return this._findFirstOnColumn(a, s, i, n);
|
|
361
511
|
case "PageDown":
|
|
362
|
-
return this._findLastOnColumn(a, t,
|
|
512
|
+
return this._findLastOnColumn(a, t, r, n);
|
|
363
513
|
case "End":
|
|
364
|
-
return this._findLast(a,
|
|
514
|
+
return this._findLast(a, r - 1);
|
|
365
515
|
default:
|
|
366
516
|
return a[t];
|
|
367
517
|
}
|
|
368
518
|
}
|
|
369
519
|
/**
|
|
370
|
-
* Calculates the
|
|
371
|
-
* Since three views are now available, the function creates and returns the correct parameters for each of them
|
|
372
|
-
* by considering the number of cells per each row and the correction for the wide mode.
|
|
373
|
-
* @param cells The array of rendered table cells; they are buttons that can represent days, months or years.
|
|
520
|
+
* Calculates the parameters needed in keyboard navigation in year and month view.
|
|
374
521
|
* @param index The starting element's index in the cell array.
|
|
375
|
-
* @param
|
|
522
|
+
* @param isYearView Whether the displayed `view` is the year one.
|
|
376
523
|
*/
|
|
377
|
-
_calculateParametersForKeyboardNavigation(e, t
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
lastElementIndexForWideMode: t === s ? this._dateAdapter.getNumDaysInMonth(this._dateAdapter.addCalendarMonths(this._dateAdapter.deserialize(a.value), -1)) : e.length
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
// Month view is not dependent from `wide` value, so some parameters are fixed.
|
|
389
|
-
case "month":
|
|
390
|
-
return {
|
|
391
|
-
verticalOffset: I,
|
|
392
|
-
elementIndexForWideMode: t,
|
|
393
|
-
offsetForWideMode: 0,
|
|
394
|
-
lastElementIndexForWideMode: 12
|
|
395
|
-
};
|
|
396
|
-
case "year": {
|
|
397
|
-
const s = Math.trunc(t / b) * b, i = s === 0 ? t : t - b;
|
|
398
|
-
return {
|
|
399
|
-
verticalOffset: C,
|
|
400
|
-
elementIndexForWideMode: i,
|
|
401
|
-
offsetForWideMode: t - i,
|
|
402
|
-
lastElementIndexForWideMode: s === 0 ? b : b * 2
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
}
|
|
524
|
+
_calculateParametersForKeyboardNavigation(e, t) {
|
|
525
|
+
const a = t ? w : ze, s = Math.trunc(e / a) * a, i = s === 0 ? e : e - a;
|
|
526
|
+
return {
|
|
527
|
+
verticalOffset: t ? T : S,
|
|
528
|
+
elementIndexForWideMode: i,
|
|
529
|
+
offsetForWideMode: e - i,
|
|
530
|
+
lastElementIndexForWideMode: s === 0 ? a : a * 2
|
|
531
|
+
};
|
|
406
532
|
}
|
|
407
533
|
/**
|
|
408
534
|
* Gets the next element of the provided array starting from `index` by adding `delta`.
|
|
@@ -439,32 +565,37 @@ let et = (() => {
|
|
|
439
565
|
/** Render the view for the day selection. */
|
|
440
566
|
_renderDayView() {
|
|
441
567
|
const e = this._wide ? this._dateAdapter.addCalendarMonths(this._activeDate, 1) : void 0;
|
|
442
|
-
return
|
|
568
|
+
return l`
|
|
443
569
|
<div class="sbb-calendar__controls">
|
|
444
|
-
${this._getArrow("left", () => this._goToDifferentMonth(-1),
|
|
570
|
+
${this._getArrow("left", () => this._goToDifferentMonth(-1), Ie[this._language.current], this._previousMonthDisabled())}
|
|
445
571
|
<div class="sbb-calendar__controls-month">
|
|
446
572
|
${this._createLabelForDayView(this._activeDate)}
|
|
447
|
-
${this._wide ? this._createLabelForDayView(e) :
|
|
573
|
+
${this._wide ? this._createLabelForDayView(e) : m}
|
|
448
574
|
<sbb-screen-reader-only role="status">
|
|
449
575
|
${this._createAriaLabelForDayView(this._activeDate, e)}
|
|
450
576
|
</sbb-screen-reader-only>
|
|
451
577
|
</div>
|
|
452
|
-
${this._getArrow("right", () => this._goToDifferentMonth(1),
|
|
578
|
+
${this._getArrow("right", () => this._goToDifferentMonth(1), Oe[this._language.current], this._nextMonthDisabled())}
|
|
453
579
|
</div>
|
|
454
580
|
<div class="sbb-calendar__table-container sbb-calendar__table-day-view">
|
|
455
|
-
${this.
|
|
456
|
-
|
|
581
|
+
${this.orientation === "horizontal" ? l`
|
|
582
|
+
${this._createDayTable(this._weeks)}
|
|
583
|
+
${this._wide ? this._createDayTable(this._nextMonthWeeks) : m}
|
|
584
|
+
` : l`
|
|
585
|
+
${this._createDayTableVertical(this._weeks)}
|
|
586
|
+
${this._wide ? this._createDayTableVertical(this._nextMonthWeeks, e) : m}
|
|
587
|
+
`}
|
|
457
588
|
</div>
|
|
458
589
|
`;
|
|
459
590
|
}
|
|
460
591
|
/** Creates the label with the month for the daily view. */
|
|
461
592
|
_createLabelForDayView(e) {
|
|
462
593
|
const t = `${this._monthNames[this._dateAdapter.getMonth(e) - 1]} ${this._dateAdapter.getYear(e)}`;
|
|
463
|
-
return
|
|
594
|
+
return l`
|
|
464
595
|
<button
|
|
465
596
|
type="button"
|
|
466
597
|
class="sbb-calendar__date-selection sbb-calendar__controls-change-date"
|
|
467
|
-
aria-label="${
|
|
598
|
+
aria-label="${Ne[this._language.current]} ${t}"
|
|
468
599
|
@click=${() => {
|
|
469
600
|
this._resetFocus = !0, this._nextCalendarView = "year", this._startTableTransition();
|
|
470
601
|
}}
|
|
@@ -483,78 +614,95 @@ let et = (() => {
|
|
|
483
614
|
}
|
|
484
615
|
/** Creates the calendar table for the daily view. */
|
|
485
616
|
_createDayTable(e) {
|
|
486
|
-
|
|
617
|
+
const t = this._dateAdapter.toIso8601(this.now);
|
|
618
|
+
return l`
|
|
487
619
|
<table
|
|
488
620
|
class="sbb-calendar__table"
|
|
489
|
-
@focusout=${(
|
|
490
|
-
@animationend=${(
|
|
621
|
+
@focusout=${(a) => this._handleTableBlur(a.relatedTarget)}
|
|
622
|
+
@animationend=${(a) => this._tableAnimationEnd(a)}
|
|
491
623
|
>
|
|
492
624
|
<thead class="sbb-calendar__table-header">
|
|
493
625
|
<tr class="sbb-calendar__table-header-row">
|
|
494
|
-
${this.
|
|
626
|
+
${this._weekdays.map((a) => l`
|
|
627
|
+
<th class="sbb-calendar__table-header">
|
|
628
|
+
<sbb-screen-reader-only>${a.long}</sbb-screen-reader-only>
|
|
629
|
+
<span aria-hidden="true">${a.narrow}</span>
|
|
630
|
+
</th>
|
|
631
|
+
`)}
|
|
495
632
|
</tr>
|
|
496
633
|
</thead>
|
|
497
634
|
<tbody class="sbb-calendar__table-body">
|
|
498
|
-
${
|
|
635
|
+
${e.map((a, s) => {
|
|
636
|
+
const i = f - a.length;
|
|
637
|
+
return s === 0 && i ? l`
|
|
638
|
+
<tr>
|
|
639
|
+
${[...Array(i).keys()].map(() => l`<td class="sbb-calendar__table-data"></td>`)}
|
|
640
|
+
${this._createDayCells(a, t)}
|
|
641
|
+
</tr>
|
|
642
|
+
` : l`<tr>
|
|
643
|
+
${this._createDayCells(a, t)}
|
|
644
|
+
</tr>`;
|
|
645
|
+
})}
|
|
499
646
|
</tbody>
|
|
500
647
|
</table>
|
|
501
648
|
`;
|
|
502
649
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
</
|
|
528
|
-
|
|
650
|
+
/* Creates the table in orientation='vertical'. */
|
|
651
|
+
_createDayTableVertical(e, t) {
|
|
652
|
+
const a = this._dateAdapter.toIso8601(this.now), s = this._dateAdapter.getFirstWeekOffset(t ?? this._activeDate);
|
|
653
|
+
return l`
|
|
654
|
+
<table
|
|
655
|
+
class="sbb-calendar__table"
|
|
656
|
+
@focusout=${(i) => this._handleTableBlur(i.relatedTarget)}
|
|
657
|
+
@animationend=${(i) => this._tableAnimationEnd(i)}
|
|
658
|
+
>
|
|
659
|
+
<tbody class="sbb-calendar__table-body">
|
|
660
|
+
${e.map((i, r) => {
|
|
661
|
+
const n = this._weekdays[r];
|
|
662
|
+
return l`
|
|
663
|
+
<tr>
|
|
664
|
+
${t ? m : l` <td class="sbb-calendar__table-header">
|
|
665
|
+
<sbb-screen-reader-only>${n.long}</sbb-screen-reader-only>
|
|
666
|
+
<span aria-hidden="true">${n.narrow}</span>
|
|
667
|
+
</td>`}
|
|
668
|
+
${r < s ? l`<td class="sbb-calendar__table-data"></td>` : m}
|
|
669
|
+
${this._createDayCells(i, a)}
|
|
670
|
+
</tr>
|
|
671
|
+
`;
|
|
672
|
+
})}
|
|
673
|
+
</tbody>
|
|
674
|
+
</table>
|
|
675
|
+
`;
|
|
529
676
|
}
|
|
530
677
|
/** Creates the cells for the daily view. */
|
|
531
678
|
_createDayCells(e, t) {
|
|
532
679
|
return e.map((a) => {
|
|
533
|
-
const s = !this._isDayInRange(a.value), i = !this._dateFilter(this._dateAdapter.deserialize(a.value)), r = !!this._selected && a.value === this._selected,
|
|
534
|
-
return
|
|
680
|
+
const s = !this._isDayInRange(a.value), i = !this._dateFilter(this._dateAdapter.deserialize(a.value)), r = !!this._selected && a.value === this._selected, n = a.value === t;
|
|
681
|
+
return l`
|
|
535
682
|
<td
|
|
536
|
-
class=${
|
|
683
|
+
class=${C({
|
|
537
684
|
"sbb-calendar__table-data": !0,
|
|
538
685
|
"sbb-calendar__table-data-selected": r
|
|
539
686
|
})}
|
|
540
687
|
>
|
|
541
688
|
<button
|
|
542
|
-
class=${
|
|
689
|
+
class=${C({
|
|
543
690
|
"sbb-calendar__cell": !0,
|
|
544
691
|
"sbb-calendar__day": !0,
|
|
545
|
-
"sbb-calendar__cell-current":
|
|
692
|
+
"sbb-calendar__cell-current": n,
|
|
546
693
|
"sbb-calendar__selected": r,
|
|
547
694
|
"sbb-calendar__crossed-out": !s && i
|
|
548
695
|
})}
|
|
549
696
|
@click=${() => this._selectDate(a.value)}
|
|
550
697
|
?disabled=${s || i}
|
|
698
|
+
value=${a.value}
|
|
699
|
+
type="button"
|
|
551
700
|
aria-label=${this._dateAdapter.getAccessibilityFormatDate(a.value)}
|
|
552
701
|
aria-pressed=${r}
|
|
553
702
|
aria-disabled=${s || i}
|
|
554
|
-
aria-current=${
|
|
555
|
-
data-day=${d || g}
|
|
703
|
+
aria-current=${n ? "date" : m}
|
|
556
704
|
tabindex="-1"
|
|
557
|
-
@keydown=${(
|
|
705
|
+
@keydown=${(o) => this._handleKeyboardEvent(o, a)}
|
|
558
706
|
sbb-popover-close
|
|
559
707
|
>
|
|
560
708
|
${a.dayValue}
|
|
@@ -565,71 +713,71 @@ let et = (() => {
|
|
|
565
713
|
}
|
|
566
714
|
/** Render the view for the month selection. */
|
|
567
715
|
_renderMonthView() {
|
|
568
|
-
return
|
|
716
|
+
return l`
|
|
569
717
|
<div class="sbb-calendar__controls">
|
|
570
|
-
${this._getArrow("left", () => this._goToDifferentYear(-1),
|
|
718
|
+
${this._getArrow("left", () => this._goToDifferentYear(-1), Ce[this._language.current], this._previousYearDisabled())}
|
|
571
719
|
<div class="sbb-calendar__controls-month">${this._createLabelForMonthView()}</div>
|
|
572
|
-
${this._getArrow("right", () => this._goToDifferentYear(1),
|
|
720
|
+
${this._getArrow("right", () => this._goToDifferentYear(1), Se[this._language.current], this._nextYearDisabled())}
|
|
573
721
|
</div>
|
|
574
722
|
<div class="sbb-calendar__table-container sbb-calendar__table-month-view">
|
|
575
723
|
${this._createMonthTable(this._months, this._chosenYear)}
|
|
576
|
-
${this._wide ? this._createMonthTable(this._months, this._chosenYear + 1) :
|
|
724
|
+
${this._wide ? this._createMonthTable(this._months, this._chosenYear + 1) : m}
|
|
577
725
|
</div>
|
|
578
726
|
`;
|
|
579
727
|
}
|
|
580
728
|
/** Creates the label with the year for the monthly view. */
|
|
581
729
|
_createLabelForMonthView() {
|
|
582
|
-
return
|
|
730
|
+
return l` <button
|
|
583
731
|
type="button"
|
|
584
732
|
id="sbb-calendar__month-selection"
|
|
585
733
|
class="sbb-calendar__controls-change-date"
|
|
586
|
-
aria-label=${`${
|
|
734
|
+
aria-label=${`${ve[this._language.current]} ${this._chosenYear}`}
|
|
587
735
|
@click=${() => this._resetCalendarView(!0)}
|
|
588
736
|
>
|
|
589
|
-
${this._chosenYear} ${this._wide ? ` - ${this._chosenYear + 1}` :
|
|
737
|
+
${this._chosenYear} ${this._wide ? ` - ${this._chosenYear + 1}` : m}
|
|
590
738
|
<sbb-icon name="chevron-small-up-small"></sbb-icon>
|
|
591
739
|
</button>
|
|
592
740
|
<sbb-screen-reader-only role="status"> ${this._chosenYear} </sbb-screen-reader-only>`;
|
|
593
741
|
}
|
|
594
742
|
/** Creates the table for the month selection view. */
|
|
595
743
|
_createMonthTable(e, t) {
|
|
596
|
-
return
|
|
744
|
+
return l`
|
|
597
745
|
<table
|
|
598
746
|
class="sbb-calendar__table"
|
|
599
747
|
@animationend=${(a) => this._tableAnimationEnd(a)}
|
|
600
748
|
>
|
|
601
|
-
${this._wide ?
|
|
749
|
+
${this._wide ? l`<thead class="sbb-calendar__table-header" aria-hidden="true">
|
|
602
750
|
<tr class="sbb-calendar__table-header-row">
|
|
603
|
-
<th class="sbb-calendar__table-header" colspan=${
|
|
751
|
+
<th class="sbb-calendar__table-header" colspan=${S}>${t}</th>
|
|
604
752
|
</tr>
|
|
605
|
-
</thead>` :
|
|
753
|
+
</thead>` : m}
|
|
606
754
|
<tbody class="sbb-calendar__table-body">
|
|
607
|
-
${e.map((a) =>
|
|
755
|
+
${e.map((a) => l`
|
|
608
756
|
<tr>
|
|
609
757
|
${a.map((s) => {
|
|
610
|
-
const i = !this._isMonthInRange(s.monthValue, t), r = !this._isMonthFilteredOut(s.monthValue, t),
|
|
611
|
-
return
|
|
612
|
-
class=${
|
|
758
|
+
const i = !this._isMonthInRange(s.monthValue, t), r = !this._isMonthFilteredOut(s.monthValue, t), n = this._selected ? this._dateAdapter.getMonth(this._dateAdapter.deserialize(this._selected)) : void 0, o = this._selected ? this._dateAdapter.getYear(this._dateAdapter.deserialize(this._selected)) : void 0, p = !!this._selected && t === o && s.monthValue === n, I = t === this._dateAdapter.getYear(this.now) && this._dateAdapter.getMonth(this.now) === s.monthValue;
|
|
759
|
+
return l` <td
|
|
760
|
+
class=${C({
|
|
613
761
|
"sbb-calendar__table-data": !0,
|
|
614
762
|
"sbb-calendar__table-month": !0
|
|
615
763
|
})}
|
|
616
764
|
>
|
|
617
765
|
<button
|
|
618
|
-
class=${
|
|
766
|
+
class=${C({
|
|
619
767
|
"sbb-calendar__cell": !0,
|
|
620
768
|
"sbb-calendar__pill": !0,
|
|
621
|
-
"sbb-calendar__cell-current":
|
|
769
|
+
"sbb-calendar__cell-current": I,
|
|
622
770
|
"sbb-calendar__crossed-out": !i && r,
|
|
623
|
-
"sbb-calendar__selected":
|
|
771
|
+
"sbb-calendar__selected": p
|
|
624
772
|
})}
|
|
625
773
|
@click=${() => this._onMonthSelection(s.monthValue, t)}
|
|
626
774
|
?disabled=${i || r}
|
|
627
775
|
aria-label=${`${s.longValue} ${t}`}
|
|
628
|
-
aria-pressed=${
|
|
776
|
+
aria-pressed=${p}
|
|
629
777
|
aria-disabled=${String(i || r)}
|
|
630
778
|
tabindex="-1"
|
|
631
|
-
data-month=${s.monthValue ||
|
|
632
|
-
@keydown=${(
|
|
779
|
+
data-month=${s.monthValue || m}
|
|
780
|
+
@keydown=${(O) => this._handleKeyboardEvent(O)}
|
|
633
781
|
>
|
|
634
782
|
${s.value}
|
|
635
783
|
</button>
|
|
@@ -647,21 +795,21 @@ let et = (() => {
|
|
|
647
795
|
}
|
|
648
796
|
/** Render the view for the year selection. */
|
|
649
797
|
_renderYearView() {
|
|
650
|
-
return
|
|
798
|
+
return l`
|
|
651
799
|
<div class="sbb-calendar__controls">
|
|
652
|
-
${this._getArrow("left", () => this._goToDifferentYearRange(-
|
|
800
|
+
${this._getArrow("left", () => this._goToDifferentYearRange(-w), Te(w)[this._language.current], this._previousYearRangeDisabled())}
|
|
653
801
|
<div class="sbb-calendar__controls-month">${this._createLabelForYearView()}</div>
|
|
654
|
-
${this._getArrow("right", () => this._goToDifferentYearRange(
|
|
802
|
+
${this._getArrow("right", () => this._goToDifferentYearRange(w), Pe(w)[this._language.current], this._nextYearRangeDisabled())}
|
|
655
803
|
</div>
|
|
656
804
|
<div class="sbb-calendar__table-container sbb-calendar__table-year-view">
|
|
657
805
|
${this._createYearTable(this._years)}
|
|
658
|
-
${this._wide ? this._createYearTable(this._nextMonthYears, !0) :
|
|
806
|
+
${this._wide ? this._createYearTable(this._nextMonthYears, !0) : m}
|
|
659
807
|
</div>
|
|
660
808
|
`;
|
|
661
809
|
}
|
|
662
810
|
/** Creates the button arrow for all the views. */
|
|
663
811
|
_getArrow(e, t, a, s) {
|
|
664
|
-
return
|
|
812
|
+
return l`<sbb-secondary-button
|
|
665
813
|
size="m"
|
|
666
814
|
icon-name="chevron-small-${e}-small"
|
|
667
815
|
aria-label=${a}
|
|
@@ -673,12 +821,12 @@ let et = (() => {
|
|
|
673
821
|
/** Creates the label with the year range for the yearly view. */
|
|
674
822
|
_createLabelForYearView() {
|
|
675
823
|
const e = this._years.flat()[0], t = (this._wide ? this._nextMonthYears : this._years).flat(), a = t[t.length - 1], s = `${e} - ${a}`;
|
|
676
|
-
return
|
|
824
|
+
return l`
|
|
677
825
|
<button
|
|
678
826
|
type="button"
|
|
679
827
|
id="sbb-calendar__year-selection"
|
|
680
828
|
class="sbb-calendar__controls-change-date"
|
|
681
|
-
aria-label="${
|
|
829
|
+
aria-label="${ve[this._language.current]} ${s}"
|
|
682
830
|
@click=${() => this._resetCalendarView(!0)}
|
|
683
831
|
>
|
|
684
832
|
${s}
|
|
@@ -690,31 +838,31 @@ let et = (() => {
|
|
|
690
838
|
/** Creates the table for the year selection view. */
|
|
691
839
|
_createYearTable(e, t = !1) {
|
|
692
840
|
const a = this.now;
|
|
693
|
-
return
|
|
841
|
+
return l` <table
|
|
694
842
|
class="sbb-calendar__table"
|
|
695
843
|
@animationend=${(s) => this._tableAnimationEnd(s)}
|
|
696
844
|
>
|
|
697
845
|
<tbody class="sbb-calendar__table-body">
|
|
698
|
-
${e.map((s) =>
|
|
846
|
+
${e.map((s) => l` <tr>
|
|
699
847
|
${s.map((i) => {
|
|
700
|
-
const r = !this._isYearInRange(i),
|
|
701
|
-
return
|
|
848
|
+
const r = !this._isYearInRange(i), n = !this._isYearFilteredOut(i), o = this._selected ? this._dateAdapter.getYear(this._dateAdapter.deserialize(this._selected)) : void 0, p = !!this._selected && i === o, I = this._dateAdapter.getYear(a) === i;
|
|
849
|
+
return l` <td class="sbb-calendar__table-data sbb-calendar__table-year">
|
|
702
850
|
<button
|
|
703
|
-
class=${
|
|
851
|
+
class=${C({
|
|
704
852
|
"sbb-calendar__cell": !0,
|
|
705
853
|
"sbb-calendar__pill": !0,
|
|
706
|
-
"sbb-calendar__cell-current":
|
|
707
|
-
"sbb-calendar__crossed-out": !r &&
|
|
708
|
-
"sbb-calendar__selected":
|
|
854
|
+
"sbb-calendar__cell-current": I,
|
|
855
|
+
"sbb-calendar__crossed-out": !r && n,
|
|
856
|
+
"sbb-calendar__selected": p
|
|
709
857
|
})}
|
|
710
858
|
@click=${() => this._onYearSelection(i, t)}
|
|
711
|
-
?disabled=${r ||
|
|
859
|
+
?disabled=${r || n}
|
|
712
860
|
aria-label=${i}
|
|
713
|
-
aria-pressed=${
|
|
714
|
-
aria-disabled=${String(r ||
|
|
861
|
+
aria-pressed=${p}
|
|
862
|
+
aria-disabled=${String(r || n)}
|
|
715
863
|
tabindex="-1"
|
|
716
|
-
data-year=${i ||
|
|
717
|
-
@keydown=${(
|
|
864
|
+
data-year=${i || m}
|
|
865
|
+
@keydown=${(O) => this._handleKeyboardEvent(O)}
|
|
718
866
|
>
|
|
719
867
|
${i}
|
|
720
868
|
</button>
|
|
@@ -729,8 +877,8 @@ let et = (() => {
|
|
|
729
877
|
this._chosenYear = t ? e - 1 : e, this._nextCalendarView = "month", this._assignActiveDate(this._dateAdapter.createDate(this._chosenYear, this._dateAdapter.getMonth(this._activeDate), this._dateAdapter.getDate(this._activeDate))), this._startTableTransition();
|
|
730
878
|
}
|
|
731
879
|
_getView() {
|
|
732
|
-
if (
|
|
733
|
-
return
|
|
880
|
+
if (me || this.hydrationRequired)
|
|
881
|
+
return l`${m}`;
|
|
734
882
|
switch (this._calendarView) {
|
|
735
883
|
case "year":
|
|
736
884
|
return this._renderYearView();
|
|
@@ -750,40 +898,42 @@ let et = (() => {
|
|
|
750
898
|
this.toggleAttribute("data-transition", !0), (t = (e = this.shadowRoot) == null ? void 0 : e.querySelectorAll("table")) == null || t.forEach((a) => a.classList.toggle("sbb-calendar__table-hide"));
|
|
751
899
|
}
|
|
752
900
|
render() {
|
|
753
|
-
return
|
|
901
|
+
return l`<div class="sbb-calendar__wrapper">${this._getView()}</div>`;
|
|
754
902
|
}
|
|
755
|
-
},
|
|
756
|
-
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
757
|
-
|
|
903
|
+
}, V = new WeakMap(), k = new WeakMap(), $ = new WeakMap(), M = new WeakMap(), Y = new WeakMap(), z = new WeakMap(), F = new WeakMap(), R = new WeakMap(), v = d, (() => {
|
|
904
|
+
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(W[Symbol.metadata] ?? null) : void 0;
|
|
905
|
+
E = [Fe(), A({ type: Boolean })], q = [A()], H = [A()], j = [A()], G = [A()], Q = [A()], J = [A({ attribute: "date-filter" })], ee = [A({ reflect: !0 })], se = [N()], ne = [N()], de = [N()], ce = [N()], _e = [N()], u(d, null, E, { kind: "accessor", name: "wide", static: !1, private: !1, access: { has: (t) => "wide" in t, get: (t) => t.wide, set: (t, a) => {
|
|
758
906
|
t.wide = a;
|
|
759
|
-
} }, metadata: e }, L,
|
|
907
|
+
} }, metadata: e }, L, B), u(d, null, q, { kind: "accessor", name: "view", static: !1, private: !1, access: { has: (t) => "view" in t, get: (t) => t.view, set: (t, a) => {
|
|
760
908
|
t.view = a;
|
|
761
|
-
} }, metadata: e },
|
|
909
|
+
} }, metadata: e }, K, U), u(d, null, H, { kind: "setter", name: "min", static: !1, private: !1, access: { has: (t) => "min" in t, set: (t, a) => {
|
|
762
910
|
t.min = a;
|
|
763
|
-
} }, metadata: e }, null, x),
|
|
911
|
+
} }, metadata: e }, null, x), u(d, null, j, { kind: "setter", name: "max", static: !1, private: !1, access: { has: (t) => "max" in t, set: (t, a) => {
|
|
764
912
|
t.max = a;
|
|
765
|
-
} }, metadata: e }, null, x),
|
|
913
|
+
} }, metadata: e }, null, x), u(d, null, G, { kind: "setter", name: "now", static: !1, private: !1, access: { has: (t) => "now" in t, set: (t, a) => {
|
|
766
914
|
t.now = a;
|
|
767
|
-
} }, metadata: e }, null, x),
|
|
915
|
+
} }, metadata: e }, null, x), u(d, null, Q, { kind: "setter", name: "selected", static: !1, private: !1, access: { has: (t) => "selected" in t, set: (t, a) => {
|
|
768
916
|
t.selected = a;
|
|
769
|
-
} }, metadata: e }, null, x),
|
|
917
|
+
} }, metadata: e }, null, x), u(d, null, J, { kind: "accessor", name: "dateFilter", static: !1, private: !1, access: { has: (t) => "dateFilter" in t, get: (t) => t.dateFilter, set: (t, a) => {
|
|
770
918
|
t.dateFilter = a;
|
|
771
|
-
} }, metadata: e },
|
|
919
|
+
} }, metadata: e }, X, Z), u(d, null, ee, { kind: "accessor", name: "orientation", static: !1, private: !1, access: { has: (t) => "orientation" in t, get: (t) => t.orientation, set: (t, a) => {
|
|
920
|
+
t.orientation = a;
|
|
921
|
+
} }, metadata: e }, te, ae), u(d, null, se, { kind: "accessor", name: "_activeDate", static: !1, private: !1, access: { has: (t) => "_activeDate" in t, get: (t) => t._activeDate, set: (t, a) => {
|
|
772
922
|
t._activeDate = a;
|
|
773
|
-
} }, metadata: e },
|
|
923
|
+
} }, metadata: e }, ie, re), u(d, null, ne, { kind: "accessor", name: "_selected", static: !1, private: !1, access: { has: (t) => "_selected" in t, get: (t) => t._selected, set: (t, a) => {
|
|
774
924
|
t._selected = a;
|
|
775
|
-
} }, metadata: e },
|
|
925
|
+
} }, metadata: e }, le, oe), u(d, null, de, { kind: "setter", name: "_wide", static: !1, private: !1, access: { has: (t) => "_wide" in t, set: (t, a) => {
|
|
776
926
|
t._wide = a;
|
|
777
|
-
} }, metadata: e }, null, x),
|
|
927
|
+
} }, metadata: e }, null, x), u(d, null, ce, { kind: "accessor", name: "_calendarView", static: !1, private: !1, access: { has: (t) => "_calendarView" in t, get: (t) => t._calendarView, set: (t, a) => {
|
|
778
928
|
t._calendarView = a;
|
|
779
|
-
} }, metadata: e },
|
|
929
|
+
} }, metadata: e }, he, be), u(d, null, _e, { kind: "accessor", name: "_initialized", static: !1, private: !1, access: { has: (t) => "_initialized" in t, get: (t) => t._initialized, set: (t, a) => {
|
|
780
930
|
t._initialized = a;
|
|
781
|
-
} }, metadata: e },
|
|
782
|
-
})(),
|
|
931
|
+
} }, metadata: e }, ue, fe), u(null, _ = { value: v }, h, { kind: "class", name: v.name, metadata: e }, null, g), P = v = _.value, e && Object.defineProperty(v, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
932
|
+
})(), d.styles = Ee, d.events = {
|
|
783
933
|
dateSelected: "dateSelected"
|
|
784
|
-
}, c(
|
|
785
|
-
return
|
|
934
|
+
}, c(v, g), d);
|
|
935
|
+
return P = v;
|
|
786
936
|
})();
|
|
787
937
|
export {
|
|
788
|
-
|
|
938
|
+
rt as SbbCalendarElement
|
|
789
939
|
};
|