@vonage/vivid 4.17.0 → 4.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +3903 -3860
- package/date-time-picker/index.cjs +5 -0
- package/date-time-picker/index.js +3 -0
- package/dial-pad/index.cjs +1 -1
- package/dial-pad/index.js +1 -1
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.cjs +1 -1
- package/empty-state/index.js +1 -1
- package/fab/index.cjs +1 -1
- package/fab/index.js +1 -1
- package/file-picker/index.cjs +1 -1
- package/file-picker/index.js +1 -1
- package/header/index.cjs +1 -1
- package/header/index.js +1 -1
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -1
- package/index.cjs +136 -133
- package/index.js +45 -44
- package/layout/index.cjs +1 -1
- package/layout/index.js +1 -1
- package/lib/action-group/action-group.d.ts +449 -3
- package/lib/banner/banner.d.ts +449 -3
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +449 -1
- package/lib/checkbox/checkbox.d.ts +449 -4
- package/lib/components.d.ts +1 -0
- package/lib/date-picker/date-picker.d.ts +2182 -4
- package/lib/date-picker/date-picker.template.d.ts +2 -0
- package/lib/date-range-picker/date-range-picker.d.ts +1110 -4
- package/lib/date-range-picker/date-range-picker.template.d.ts +2 -0
- package/lib/date-time-picker/date-time-picker.d.ts +2175 -0
- package/lib/date-time-picker/date-time-picker.template.d.ts +2 -0
- package/lib/date-time-picker/definition.d.ts +1 -0
- package/lib/date-time-picker/locale.d.ts +9 -0
- package/lib/dialog/dialog.d.ts +449 -2
- package/lib/divider/divider.d.ts +448 -1
- package/lib/menu/menu.d.ts +446 -1
- package/lib/nav-disclosure/nav-disclosure.d.ts +449 -2
- package/lib/number-field/number-field.d.ts +450 -3
- package/lib/option/option.d.ts +1 -11
- package/lib/progress/progress.d.ts +449 -2
- package/lib/progress-ring/progress-ring.d.ts +449 -2
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +1 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +7 -4
- package/lib/select/select.d.ts +1 -5
- package/lib/selectable-box/selectable-box.d.ts +449 -2
- package/lib/slider/slider.d.ts +449 -3
- package/lib/split-button/split-button.d.ts +449 -3
- package/lib/switch/switch.d.ts +449 -2
- package/lib/tag-group/tag-group.d.ts +449 -2
- package/lib/text-anchor/text-anchor.d.ts +449 -1
- package/lib/text-area/text-area.d.ts +450 -3
- package/lib/text-field/text-field.d.ts +450 -7
- package/lib/time-picker/locale.d.ts +0 -2
- package/lib/time-picker/time-picker.d.ts +1053 -9
- package/lib/time-picker/time-picker.template.d.ts +2 -1
- package/locales/de-DE.cjs +29 -5
- package/locales/de-DE.js +29 -5
- package/locales/en-GB.cjs +29 -5
- package/locales/en-GB.js +29 -5
- package/locales/en-US.cjs +29 -5
- package/locales/en-US.js +29 -5
- package/locales/ja-JP.cjs +29 -5
- package/locales/ja-JP.js +29 -5
- package/locales/zh-CN.cjs +29 -5
- package/locales/zh-CN.js +29 -5
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +1 -1
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.cjs +1 -1
- package/note/index.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +1 -1
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/Reflector.cjs +71 -0
- package/shared/Reflector.js +69 -0
- package/shared/affix.cjs +1 -1
- package/shared/affix.js +1 -1
- package/shared/anchor.cjs +0 -10
- package/shared/anchor.js +0 -10
- package/shared/aria/delegates-aria.d.ts +454 -0
- package/shared/base-progress.js +1 -1
- package/shared/breadcrumb-item.cjs +2 -1
- package/shared/breadcrumb-item.js +2 -1
- package/shared/button.cjs +2 -13
- package/shared/button.js +2 -13
- package/shared/{presentationDate.cjs → calendar-picker.template.cjs} +730 -900
- package/shared/{presentationDate.js → calendar-picker.template.js} +672 -845
- package/shared/datetime/dateTimeStr.d.ts +6 -0
- package/shared/datetime/presentationDate.d.ts +4 -0
- package/shared/{date-picker/calendar → datetime}/presentationDateRange.d.ts +3 -3
- package/shared/datetime/presentationDateTime.d.ts +4 -0
- package/{lib/time-picker/time → shared/datetime}/time.d.ts +1 -0
- package/shared/definition.cjs +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition11.cjs +8 -11
- package/shared/definition11.js +8 -11
- package/shared/definition14.cjs +2 -2
- package/shared/definition14.js +2 -2
- package/shared/definition15.cjs +3 -10
- package/shared/definition15.js +3 -10
- package/shared/definition16.cjs +29 -33
- package/shared/definition16.js +29 -33
- package/shared/definition17.cjs +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition18.cjs +56 -91
- package/shared/definition18.js +56 -91
- package/shared/definition19.cjs +68 -32
- package/shared/definition19.js +58 -22
- package/shared/definition20.cjs +253 -220
- package/shared/definition20.js +254 -220
- package/shared/definition21.cjs +200 -286
- package/shared/definition21.js +198 -284
- package/shared/definition22.cjs +302 -31
- package/shared/definition22.js +301 -30
- package/shared/definition23.cjs +37 -58
- package/shared/definition23.js +36 -57
- package/shared/definition24.cjs +50 -70
- package/shared/definition24.js +49 -69
- package/shared/definition25.cjs +75 -2475
- package/shared/definition25.js +74 -2475
- package/shared/definition26.cjs +2480 -50
- package/shared/definition26.js +2479 -48
- package/shared/definition27.cjs +53 -271
- package/shared/definition27.js +52 -269
- package/shared/definition28.cjs +271 -48
- package/shared/definition28.js +269 -47
- package/shared/definition29.cjs +37 -764
- package/shared/definition29.js +36 -758
- package/shared/definition3.cjs +2 -9
- package/shared/definition3.js +2 -9
- package/shared/definition30.cjs +739 -57
- package/shared/definition30.js +733 -56
- package/shared/definition31.cjs +93 -22
- package/shared/definition31.js +92 -21
- package/shared/definition32.cjs +28 -10
- package/shared/definition32.js +27 -9
- package/shared/definition33.cjs +10 -52
- package/shared/definition33.js +9 -51
- package/shared/definition34.cjs +30 -411
- package/shared/definition34.js +30 -412
- package/shared/definition35.cjs +422 -52
- package/shared/definition35.js +423 -53
- package/shared/definition36.cjs +53 -216
- package/shared/definition36.js +53 -215
- package/shared/definition37.cjs +201 -71
- package/shared/definition37.js +200 -70
- package/shared/definition38.cjs +53 -48
- package/shared/definition38.js +51 -46
- package/shared/definition39.cjs +57 -263
- package/shared/definition39.js +56 -262
- package/shared/definition4.cjs +2 -2
- package/shared/definition4.js +2 -2
- package/shared/definition40.cjs +220 -148
- package/shared/definition40.js +220 -148
- package/shared/definition41.cjs +143 -567
- package/shared/definition41.js +143 -568
- package/shared/definition42.cjs +596 -12573
- package/shared/definition42.js +596 -12573
- package/shared/definition43.cjs +13489 -1058
- package/shared/definition43.js +13489 -1059
- package/shared/definition44.cjs +936 -698
- package/shared/definition44.js +937 -698
- package/shared/definition45.cjs +850 -105
- package/shared/definition45.js +850 -104
- package/shared/definition46.cjs +110 -90
- package/shared/definition46.js +108 -88
- package/shared/definition47.cjs +88 -464
- package/shared/definition47.js +87 -463
- package/shared/definition48.cjs +457 -111
- package/shared/definition48.js +456 -110
- package/shared/definition49.cjs +103 -109
- package/shared/definition49.js +102 -108
- package/shared/definition5.cjs +3 -3
- package/shared/definition5.js +3 -3
- package/shared/definition50.cjs +136 -14
- package/shared/definition50.js +135 -13
- package/shared/definition51.cjs +16 -115
- package/shared/definition51.js +15 -114
- package/shared/definition52.cjs +79 -486
- package/shared/definition52.js +78 -485
- package/shared/definition53.cjs +503 -24
- package/shared/definition53.js +502 -23
- package/shared/definition54.cjs +23 -137
- package/shared/definition54.js +22 -136
- package/shared/definition55.cjs +96 -241
- package/shared/definition55.js +95 -241
- package/shared/definition56.cjs +261 -61
- package/shared/definition56.js +260 -60
- package/shared/definition57.cjs +419 -788
- package/shared/definition57.js +420 -789
- package/shared/definition58.cjs +27 -144
- package/shared/definition58.js +27 -143
- package/shared/definition59.cjs +83 -54
- package/shared/definition59.js +82 -53
- package/shared/definition6.cjs +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition60.cjs +80 -165
- package/shared/definition60.js +79 -163
- package/shared/definition61.cjs +143 -230
- package/shared/definition61.js +141 -229
- package/shared/definition62.cjs +233 -69344
- package/shared/definition62.js +232 -69343
- package/shared/definition63.cjs +69381 -28
- package/shared/definition63.js +69379 -26
- package/shared/definition64.cjs +28 -2168
- package/shared/definition64.js +27 -2166
- package/shared/definition65.cjs +2195 -0
- package/shared/definition65.js +2190 -0
- package/shared/definition7.cjs +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +3 -9
- package/shared/definition8.js +3 -9
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +1 -1
- package/shared/delegates-aria.cjs +69 -0
- package/shared/delegates-aria.js +67 -0
- package/shared/form-associated.js +1 -1
- package/shared/form-elements.cjs +1 -1
- package/shared/form-elements.js +1 -1
- package/shared/foundation/anchor/anchor.d.ts +0 -8
- package/shared/foundation/button/button.d.ts +449 -7
- package/shared/foundation/listbox/listbox.d.ts +0 -9
- package/shared/listbox.cjs +4 -30
- package/shared/listbox.js +4 -30
- package/shared/localization/Locale.d.ts +6 -2
- package/shared/option.cjs +1 -38
- package/shared/option.js +1 -38
- package/shared/picker-field/locale.d.ts +4 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +558 -0
- package/shared/{date-picker/locale.d.ts → picker-field/mixins/calendar-picker.locale.d.ts} +1 -3
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +555 -0
- package/shared/picker-field/mixins/calendar-segments/calendarGrid.d.ts +17 -0
- package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/monthPickerGrid.d.ts +3 -3
- package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/columns.d.ts +1 -1
- package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/inline-time-picker.d.ts +2 -2
- package/{lib/time-picker/time/picker.d.ts → shared/picker-field/mixins/inline-time-picker/picker-option.d.ts} +1 -1
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1110 -0
- package/shared/picker-field/mixins/single-date-picker.d.ts +1626 -0
- package/shared/picker-field/mixins/single-value-picker.d.ts +518 -0
- package/shared/picker-field/mixins/time-selection-picker.d.ts +1053 -0
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +1050 -0
- package/shared/picker-field/picker-field.d.ts +11 -0
- package/shared/picker-field/picker-field.form-associated.d.ts +11 -0
- package/shared/picker-field/picker-field.template.d.ts +7 -0
- package/shared/picker-field.template.cjs +315 -0
- package/shared/picker-field.template.js +310 -0
- package/shared/single-date-picker.cjs +46 -0
- package/shared/single-date-picker.js +44 -0
- package/shared/single-value-picker.cjs +77 -0
- package/shared/single-value-picker.js +75 -0
- package/shared/slider.template.cjs +3 -3
- package/shared/slider.template.js +3 -3
- package/shared/text-anchor.cjs +2 -1
- package/shared/text-anchor.js +2 -1
- package/shared/text-anchor.template.cjs +3 -5
- package/shared/text-anchor.template.js +3 -5
- package/shared/text-field.cjs +2 -555
- package/shared/text-field.js +2 -554
- package/shared/time-selection-picker.template.cjs +776 -0
- package/shared/time-selection-picker.template.js +767 -0
- package/shared/vivid-element.cjs +1 -1
- package/shared/vivid-element.js +1 -1
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-anchor/index.cjs +1 -1
- package/text-anchor/index.js +1 -1
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +105 -1152
- package/lib/time-picker/time-picker.form-associated.d.ts +0 -11
- package/shared/aria-global.cjs +0 -93
- package/shared/aria-global.js +0 -91
- package/shared/date-picker/calendar/calendarGrid.d.ts +0 -17
- package/shared/date-picker/calendar/presentationDate.d.ts +0 -4
- package/shared/date-picker/date-picker-base.d.ts +0 -21
- package/shared/date-picker/date-picker-base.form-associated.d.ts +0 -11
- package/shared/date-picker/date-picker-base.template.d.ts +0 -3
- package/shared/foundation/patterns/aria-global.d.ts +0 -21
- package/shared/foundation/patterns/index.d.ts +0 -1
- package/shared/text-field2.cjs +0 -5
- package/shared/text-field2.js +0 -3
- package/shared/trapped-focus.cjs +0 -35
- package/shared/trapped-focus.js +0 -33
- /package/shared/{date-picker/calendar → datetime}/dateRange.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/dateStr.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/month.d.ts +0 -0
- /package/{lib/time-picker/time → shared/datetime}/presentationTime.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/year.d.ts +0 -0
- /package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/segment.d.ts +0 -0
- /package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/definition.d.ts +0 -0
- /package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/inline-time-picker.template.d.ts +0 -0
package/shared/definition50.cjs
CHANGED
|
@@ -1,25 +1,147 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const definition = require('./definition28.cjs');
|
|
3
4
|
const vividElement = require('./vivid-element.cjs');
|
|
5
|
+
const delegatesAria = require('./delegates-aria.cjs');
|
|
6
|
+
const formAssociated = require('./form-associated.cjs');
|
|
7
|
+
const keyCodes = require('./key-codes.cjs');
|
|
8
|
+
const classNames = require('./class-names.cjs');
|
|
9
|
+
const when = require('./when.cjs');
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
const styles = ":host(.disabled){cursor:not-allowed}.control.connotation-cta{--_connotation-color-primary-text: var(--vvd-switch-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-increment: var(--vvd-switch-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-switch-cta-firm, var(--vvd-color-cta-600));--_connotation-color-intermediate: var(--vvd-switch-cta-intermediate, var(--vvd-color-cta-500));--_connotation-color-fierce: var(--vvd-switch-cta-fierce, var(--vvd-color-cta-700))}.control.connotation-alert{--_connotation-color-primary-text: var(--vvd-switch-alert-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-alert-primary, var(--vvd-color-alert-500));--_connotation-color-primary-increment: var(--vvd-switch-alert-primary-increment, var(--vvd-color-alert-600));--_connotation-color-firm: var(--vvd-switch-alert-firm, var(--vvd-color-alert-600));--_connotation-color-intermediate: var(--vvd-switch-alert-intermediate, var(--vvd-color-alert-500));--_connotation-color-fierce: var(--vvd-switch-alert-fierce, var(--vvd-color-alert-700))}.control.connotation-success{--_connotation-color-primary-text: var(--vvd-switch-success-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-success-primary, var(--vvd-color-success-500));--_connotation-color-primary-increment: var(--vvd-switch-success-primary-increment, var(--vvd-color-success-600));--_connotation-color-firm: var(--vvd-switch-success-firm, var(--vvd-color-success-600));--_connotation-color-intermediate: var(--vvd-switch-success-intermediate, var(--vvd-color-success-500));--_connotation-color-fierce: var(--vvd-switch-success-fierce, var(--vvd-color-success-700))}.control.connotation-announcement{--_connotation-color-primary-text: var(--vvd-switch-announcement-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-announcement-primary, var(--vvd-color-announcement-500));--_connotation-color-primary-increment: var(--vvd-switch-announcement-primary-increment, var(--vvd-color-announcement-600));--_connotation-color-firm: var(--vvd-switch-announcement-firm, var(--vvd-color-announcement-600));--_connotation-color-intermediate: var(--vvd-switch-announcement-intermediate, var(--vvd-color-announcement-500));--_connotation-color-fierce: var(--vvd-switch-announcement-fierce, var(--vvd-color-announcement-700))}.control:not(.connotation-cta,.connotation-alert,.connotation-success,.connotation-announcement){--_connotation-color-primary-text: var(--vvd-switch-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-increment: var(--vvd-switch-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-switch-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-intermediate: var(--vvd-switch-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-fierce: var(--vvd-switch-accent-fierce, var(--vvd-color-neutral-700))}.control{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.control.appearance-filled{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-filled{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: transparent}.control:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.control:where(.disabled,:disabled).appearance-filled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: transparent}.control:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.control:where(.readonly):where(:not(.disabled,:disabled)).appearance-filled{--_appearance-color-text: var(--vvd-color-neutral-800);--_appearance-color-fill: var(--vvd-color-neutral-500);--_appearance-color-outline: transparent}.control{display:inline-flex;border-radius:16px;gap:8px;--focus-inset: -4px;--focus-stroke-gap-color: transparent}.control:focus-visible{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}@supports (user-select: none){.control{user-select:none}}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.switch{--_switch-inline-size: calc(1px*(20 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*1.8) ;display:flex;box-sizing:border-box;align-items:center;border-radius:40px;background-color:var(--_appearance-color-fill);block-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)));box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);inline-size:var(--_switch-inline-size);transition:all .2s ease-in-out 0s}.checked-indicator{--_switch-checked-indicator-size: calc( calc(1px*(20 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) / 1.6667);--_switch-gutter: calc(var(--_switch-checked-indicator-size) / 3);border-radius:inherit;block-size:var(--_switch-checked-indicator-size);inline-size:var(--_switch-checked-indicator-size);margin-inline-start:auto;transition:all .2s ease-in-out 0s}.control:not(.appearance-filled) .checked-indicator{background-color:var(--_appearance-color-outline)}.control:not(.appearance-filled):where(.readonly) .checked-indicator{background-color:var(--vvd-color-neutral-600)}.control.appearance-filled .checked-indicator{background-color:var(--vvd-color-neutral-100)}.control:not(.checked) .checked-indicator{transform:translate(calc(-1 * var(--_switch-inline-size) + var(--_switch-checked-indicator-size) + var(--_switch-gutter)))}.control.checked .checked-indicator{transform:translate(calc(-1 * var(--_switch-gutter)))}.control.appearance-filled.disabled .checked-indicator{background-color:var(--_appearance-color-text)}.control.appearance-filled.readonly .checked-indicator{background-color:var(--vvd-color-neutral-50)}.label{color:var(--vvd-color-canvas-text);cursor:pointer;font:var(--vvd-typography-base)}";
|
|
12
|
+
|
|
13
|
+
class _Switch extends vividElement.VividElement {
|
|
14
|
+
}
|
|
15
|
+
class FormAssociatedSwitch extends formAssociated.CheckableFormAssociated(_Switch) {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.proxy = document.createElement("input");
|
|
19
|
+
}
|
|
6
20
|
}
|
|
7
21
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
22
|
+
var __defProp = Object.defineProperty;
|
|
23
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
24
|
+
var result = void 0 ;
|
|
25
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
26
|
+
if (decorator = decorators[i])
|
|
27
|
+
result = (decorator(target, key, result) ) || result;
|
|
28
|
+
if (result) __defProp(target, key, result);
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
class Switch extends delegatesAria.DelegatesAria(FormAssociatedSwitch) {
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
/**
|
|
35
|
+
* The element's value to be included in form submission when checked.
|
|
36
|
+
* Default to "on" to reach parity with input[type="checkbox"]
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
this.initialValue = "on";
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
this.keypressHandler = (e) => {
|
|
45
|
+
if (e.key === keyCodes.keySpace || e.key === keyCodes.keyEnter) {
|
|
46
|
+
this.checked = !this.checked;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
this.clickHandler = () => {
|
|
53
|
+
if (!this.disabled && !this.readOnly) {
|
|
54
|
+
this.checked = !this.checked;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
this.defaultChecked = !!this.checkedAttribute;
|
|
58
|
+
this.checked = this.defaultChecked;
|
|
59
|
+
}
|
|
60
|
+
// Map to proxy element
|
|
61
|
+
/**
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
readOnlyChanged() {
|
|
65
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
66
|
+
this.proxy.readOnly = this.readOnly;
|
|
67
|
+
}
|
|
68
|
+
this.readOnly ? this.classList.add("readonly") : this.classList.remove("readonly");
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
super.connectedCallback();
|
|
75
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
76
|
+
this.updateForm();
|
|
77
|
+
}
|
|
78
|
+
updateForm() {
|
|
79
|
+
const value = this.checked ? this.value : null;
|
|
80
|
+
this.setFormValue(value, value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
__decorateClass([
|
|
84
|
+
vividElement.attr
|
|
85
|
+
], Switch.prototype, "label");
|
|
86
|
+
__decorateClass([
|
|
87
|
+
vividElement.attr
|
|
88
|
+
], Switch.prototype, "connotation");
|
|
89
|
+
__decorateClass([
|
|
90
|
+
vividElement.attr({ attribute: "readonly", mode: "boolean" })
|
|
91
|
+
], Switch.prototype, "readOnly");
|
|
92
|
+
__decorateClass([
|
|
93
|
+
vividElement.observable
|
|
94
|
+
], Switch.prototype, "defaultSlottedNodes");
|
|
95
|
+
|
|
96
|
+
const getClasses = (_) => classNames.classNames(
|
|
97
|
+
"control",
|
|
98
|
+
["appearance-filled", _.checked],
|
|
99
|
+
["checked", _.checked],
|
|
100
|
+
["disabled", _.disabled],
|
|
101
|
+
["readonly", _.readOnly],
|
|
102
|
+
[
|
|
103
|
+
`connotation-${_.connotation}`,
|
|
104
|
+
Boolean(_.checked) && Boolean(_.connotation)
|
|
105
|
+
]
|
|
106
|
+
);
|
|
107
|
+
const SwitchTemplate = vividElement.html`
|
|
108
|
+
<template role="${(x) => x.ariaLabel ? "presentation" : null}">
|
|
109
|
+
<div
|
|
110
|
+
class="${getClasses}"
|
|
111
|
+
role="switch"
|
|
112
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
113
|
+
aria-checked="${(x) => x.checked}"
|
|
114
|
+
aria-disabled="${(x) => x.disabled}"
|
|
115
|
+
aria-readonly="${(x) => x.readOnly}"
|
|
116
|
+
tabindex="${(x) => x.disabled ? null : 0}"
|
|
117
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
118
|
+
@click="${(x) => x.clickHandler()}"
|
|
119
|
+
>
|
|
120
|
+
<div class="switch">
|
|
121
|
+
<span class="checked-indicator"></span>
|
|
122
|
+
</div>
|
|
123
|
+
${when.when(
|
|
124
|
+
(x) => x.label,
|
|
125
|
+
vividElement.html`<div class="label">${(x) => x.label}</div>`
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
11
128
|
</template>
|
|
12
129
|
`;
|
|
13
130
|
|
|
14
|
-
const
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
[],
|
|
19
|
-
{
|
|
131
|
+
const switchDefinition = vividElement.defineVividComponent(
|
|
132
|
+
"switch",
|
|
133
|
+
Switch,
|
|
134
|
+
SwitchTemplate,
|
|
135
|
+
[definition.iconDefinition],
|
|
136
|
+
{
|
|
137
|
+
styles,
|
|
138
|
+
shadowOptions: {
|
|
139
|
+
delegatesFocus: true
|
|
140
|
+
}
|
|
141
|
+
}
|
|
20
142
|
);
|
|
21
|
-
const
|
|
143
|
+
const registerSwitch = vividElement.createRegisterFunction(switchDefinition);
|
|
22
144
|
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
145
|
+
exports.Switch = Switch;
|
|
146
|
+
exports.registerSwitch = registerSwitch;
|
|
147
|
+
exports.switchDefinition = switchDefinition;
|
package/shared/definition50.js
CHANGED
|
@@ -1,21 +1,143 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as iconDefinition } from './definition28.js';
|
|
2
|
+
import { V as VividElement, a as attr, o as observable, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
|
|
3
|
+
import { D as DelegatesAria } from './delegates-aria.js';
|
|
4
|
+
import { C as CheckableFormAssociated } from './form-associated.js';
|
|
5
|
+
import { a as keySpace, k as keyEnter } from './key-codes.js';
|
|
6
|
+
import { c as classNames } from './class-names.js';
|
|
7
|
+
import { w as when } from './when.js';
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
const styles = ":host(.disabled){cursor:not-allowed}.control.connotation-cta{--_connotation-color-primary-text: var(--vvd-switch-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-increment: var(--vvd-switch-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-switch-cta-firm, var(--vvd-color-cta-600));--_connotation-color-intermediate: var(--vvd-switch-cta-intermediate, var(--vvd-color-cta-500));--_connotation-color-fierce: var(--vvd-switch-cta-fierce, var(--vvd-color-cta-700))}.control.connotation-alert{--_connotation-color-primary-text: var(--vvd-switch-alert-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-alert-primary, var(--vvd-color-alert-500));--_connotation-color-primary-increment: var(--vvd-switch-alert-primary-increment, var(--vvd-color-alert-600));--_connotation-color-firm: var(--vvd-switch-alert-firm, var(--vvd-color-alert-600));--_connotation-color-intermediate: var(--vvd-switch-alert-intermediate, var(--vvd-color-alert-500));--_connotation-color-fierce: var(--vvd-switch-alert-fierce, var(--vvd-color-alert-700))}.control.connotation-success{--_connotation-color-primary-text: var(--vvd-switch-success-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-success-primary, var(--vvd-color-success-500));--_connotation-color-primary-increment: var(--vvd-switch-success-primary-increment, var(--vvd-color-success-600));--_connotation-color-firm: var(--vvd-switch-success-firm, var(--vvd-color-success-600));--_connotation-color-intermediate: var(--vvd-switch-success-intermediate, var(--vvd-color-success-500));--_connotation-color-fierce: var(--vvd-switch-success-fierce, var(--vvd-color-success-700))}.control.connotation-announcement{--_connotation-color-primary-text: var(--vvd-switch-announcement-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-announcement-primary, var(--vvd-color-announcement-500));--_connotation-color-primary-increment: var(--vvd-switch-announcement-primary-increment, var(--vvd-color-announcement-600));--_connotation-color-firm: var(--vvd-switch-announcement-firm, var(--vvd-color-announcement-600));--_connotation-color-intermediate: var(--vvd-switch-announcement-intermediate, var(--vvd-color-announcement-500));--_connotation-color-fierce: var(--vvd-switch-announcement-fierce, var(--vvd-color-announcement-700))}.control:not(.connotation-cta,.connotation-alert,.connotation-success,.connotation-announcement){--_connotation-color-primary-text: var(--vvd-switch-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary: var(--vvd-switch-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-increment: var(--vvd-switch-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-switch-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-intermediate: var(--vvd-switch-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-fierce: var(--vvd-switch-accent-fierce, var(--vvd-color-neutral-700))}.control{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.control.appearance-filled{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-filled{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: transparent}.control:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.control:where(.disabled,:disabled).appearance-filled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: transparent}.control:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.control:where(.readonly):where(:not(.disabled,:disabled)).appearance-filled{--_appearance-color-text: var(--vvd-color-neutral-800);--_appearance-color-fill: var(--vvd-color-neutral-500);--_appearance-color-outline: transparent}.control{display:inline-flex;border-radius:16px;gap:8px;--focus-inset: -4px;--focus-stroke-gap-color: transparent}.control:focus-visible{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}@supports (user-select: none){.control{user-select:none}}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.switch{--_switch-inline-size: calc(1px*(20 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*1.8) ;display:flex;box-sizing:border-box;align-items:center;border-radius:40px;background-color:var(--_appearance-color-fill);block-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)));box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);inline-size:var(--_switch-inline-size);transition:all .2s ease-in-out 0s}.checked-indicator{--_switch-checked-indicator-size: calc( calc(1px*(20 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) / 1.6667);--_switch-gutter: calc(var(--_switch-checked-indicator-size) / 3);border-radius:inherit;block-size:var(--_switch-checked-indicator-size);inline-size:var(--_switch-checked-indicator-size);margin-inline-start:auto;transition:all .2s ease-in-out 0s}.control:not(.appearance-filled) .checked-indicator{background-color:var(--_appearance-color-outline)}.control:not(.appearance-filled):where(.readonly) .checked-indicator{background-color:var(--vvd-color-neutral-600)}.control.appearance-filled .checked-indicator{background-color:var(--vvd-color-neutral-100)}.control:not(.checked) .checked-indicator{transform:translate(calc(-1 * var(--_switch-inline-size) + var(--_switch-checked-indicator-size) + var(--_switch-gutter)))}.control.checked .checked-indicator{transform:translate(calc(-1 * var(--_switch-gutter)))}.control.appearance-filled.disabled .checked-indicator{background-color:var(--_appearance-color-text)}.control.appearance-filled.readonly .checked-indicator{background-color:var(--vvd-color-neutral-50)}.label{color:var(--vvd-color-canvas-text);cursor:pointer;font:var(--vvd-typography-base)}";
|
|
10
|
+
|
|
11
|
+
class _Switch extends VividElement {
|
|
12
|
+
}
|
|
13
|
+
class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.proxy = document.createElement("input");
|
|
17
|
+
}
|
|
4
18
|
}
|
|
5
19
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
20
|
+
var __defProp = Object.defineProperty;
|
|
21
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
22
|
+
var result = void 0 ;
|
|
23
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
24
|
+
if (decorator = decorators[i])
|
|
25
|
+
result = (decorator(target, key, result) ) || result;
|
|
26
|
+
if (result) __defProp(target, key, result);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
class Switch extends DelegatesAria(FormAssociatedSwitch) {
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
/**
|
|
33
|
+
* The element's value to be included in form submission when checked.
|
|
34
|
+
* Default to "on" to reach parity with input[type="checkbox"]
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
this.initialValue = "on";
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
this.keypressHandler = (e) => {
|
|
43
|
+
if (e.key === keySpace || e.key === keyEnter) {
|
|
44
|
+
this.checked = !this.checked;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
this.clickHandler = () => {
|
|
51
|
+
if (!this.disabled && !this.readOnly) {
|
|
52
|
+
this.checked = !this.checked;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
this.defaultChecked = !!this.checkedAttribute;
|
|
56
|
+
this.checked = this.defaultChecked;
|
|
57
|
+
}
|
|
58
|
+
// Map to proxy element
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
readOnlyChanged() {
|
|
63
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
64
|
+
this.proxy.readOnly = this.readOnly;
|
|
65
|
+
}
|
|
66
|
+
this.readOnly ? this.classList.add("readonly") : this.classList.remove("readonly");
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
connectedCallback() {
|
|
72
|
+
super.connectedCallback();
|
|
73
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
74
|
+
this.updateForm();
|
|
75
|
+
}
|
|
76
|
+
updateForm() {
|
|
77
|
+
const value = this.checked ? this.value : null;
|
|
78
|
+
this.setFormValue(value, value);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
__decorateClass([
|
|
82
|
+
attr
|
|
83
|
+
], Switch.prototype, "label");
|
|
84
|
+
__decorateClass([
|
|
85
|
+
attr
|
|
86
|
+
], Switch.prototype, "connotation");
|
|
87
|
+
__decorateClass([
|
|
88
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
89
|
+
], Switch.prototype, "readOnly");
|
|
90
|
+
__decorateClass([
|
|
91
|
+
observable
|
|
92
|
+
], Switch.prototype, "defaultSlottedNodes");
|
|
93
|
+
|
|
94
|
+
const getClasses = (_) => classNames(
|
|
95
|
+
"control",
|
|
96
|
+
["appearance-filled", _.checked],
|
|
97
|
+
["checked", _.checked],
|
|
98
|
+
["disabled", _.disabled],
|
|
99
|
+
["readonly", _.readOnly],
|
|
100
|
+
[
|
|
101
|
+
`connotation-${_.connotation}`,
|
|
102
|
+
Boolean(_.checked) && Boolean(_.connotation)
|
|
103
|
+
]
|
|
104
|
+
);
|
|
105
|
+
const SwitchTemplate = html`
|
|
106
|
+
<template role="${(x) => x.ariaLabel ? "presentation" : null}">
|
|
107
|
+
<div
|
|
108
|
+
class="${getClasses}"
|
|
109
|
+
role="switch"
|
|
110
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
111
|
+
aria-checked="${(x) => x.checked}"
|
|
112
|
+
aria-disabled="${(x) => x.disabled}"
|
|
113
|
+
aria-readonly="${(x) => x.readOnly}"
|
|
114
|
+
tabindex="${(x) => x.disabled ? null : 0}"
|
|
115
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
116
|
+
@click="${(x) => x.clickHandler()}"
|
|
117
|
+
>
|
|
118
|
+
<div class="switch">
|
|
119
|
+
<span class="checked-indicator"></span>
|
|
120
|
+
</div>
|
|
121
|
+
${when(
|
|
122
|
+
(x) => x.label,
|
|
123
|
+
html`<div class="label">${(x) => x.label}</div>`
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
9
126
|
</template>
|
|
10
127
|
`;
|
|
11
128
|
|
|
12
|
-
const
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[],
|
|
17
|
-
{
|
|
129
|
+
const switchDefinition = defineVividComponent(
|
|
130
|
+
"switch",
|
|
131
|
+
Switch,
|
|
132
|
+
SwitchTemplate,
|
|
133
|
+
[iconDefinition],
|
|
134
|
+
{
|
|
135
|
+
styles,
|
|
136
|
+
shadowOptions: {
|
|
137
|
+
delegatesFocus: true
|
|
138
|
+
}
|
|
139
|
+
}
|
|
18
140
|
);
|
|
19
|
-
const
|
|
141
|
+
const registerSwitch = createRegisterFunction(switchDefinition);
|
|
20
142
|
|
|
21
|
-
export {
|
|
143
|
+
export { Switch as S, registerSwitch as r, switchDefinition as s };
|
package/shared/definition51.cjs
CHANGED
|
@@ -1,124 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const definition = require('./definition27.cjs');
|
|
4
3
|
const vividElement = require('./vivid-element.cjs');
|
|
5
|
-
const applyMixins = require('./apply-mixins.cjs');
|
|
6
|
-
const affix = require('./affix.cjs');
|
|
7
|
-
const localized = require('./localized.cjs');
|
|
8
|
-
const classNames = require('./class-names.cjs');
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var __defProp = Object.defineProperty;
|
|
13
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
14
|
-
var result = void 0 ;
|
|
15
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16
|
-
if (decorator = decorators[i])
|
|
17
|
-
result = (decorator(target, key, result) ) || result;
|
|
18
|
-
if (result) __defProp(target, key, result);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
class Tab extends vividElement.VividElement {
|
|
22
|
-
constructor() {
|
|
23
|
-
super(...arguments);
|
|
24
|
-
this.removable = false;
|
|
25
|
-
this.tabIndex = "-1";
|
|
26
|
-
this.ariaSelected = null;
|
|
27
|
-
}
|
|
28
|
-
_handleCloseClick(e) {
|
|
29
|
-
e.stopImmediatePropagation();
|
|
30
|
-
this.$emit("close");
|
|
31
|
-
}
|
|
32
|
-
_onKeyDown(e) {
|
|
33
|
-
if (!this.removable || e.key !== "Delete") return true;
|
|
34
|
-
e.stopImmediatePropagation();
|
|
35
|
-
this.$emit("close");
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
5
|
+
class TabPanel extends vividElement.VividElement {
|
|
38
6
|
}
|
|
39
|
-
__decorateClass([
|
|
40
|
-
vividElement.attr({ mode: "boolean" })
|
|
41
|
-
], Tab.prototype, "disabled");
|
|
42
|
-
__decorateClass([
|
|
43
|
-
vividElement.attr
|
|
44
|
-
], Tab.prototype, "connotation");
|
|
45
|
-
__decorateClass([
|
|
46
|
-
vividElement.attr
|
|
47
|
-
], Tab.prototype, "shape");
|
|
48
|
-
__decorateClass([
|
|
49
|
-
vividElement.attr
|
|
50
|
-
], Tab.prototype, "label");
|
|
51
|
-
__decorateClass([
|
|
52
|
-
vividElement.attr({ mode: "boolean" })
|
|
53
|
-
], Tab.prototype, "removable");
|
|
54
|
-
__decorateClass([
|
|
55
|
-
vividElement.attr({ mode: "fromView" })
|
|
56
|
-
], Tab.prototype, "tabIndex");
|
|
57
|
-
__decorateClass([
|
|
58
|
-
vividElement.attr({ attribute: "aria-selected" })
|
|
59
|
-
], Tab.prototype, "ariaSelected");
|
|
60
|
-
applyMixins.applyMixins(Tab, affix.AffixIconWithTrailing);
|
|
61
|
-
applyMixins.applyMixins(Tab, localized.Localized);
|
|
62
7
|
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
shape,
|
|
69
|
-
removable
|
|
70
|
-
}) => classNames.classNames(
|
|
71
|
-
"base",
|
|
72
|
-
[
|
|
73
|
-
`connotation-${connotation}`,
|
|
74
|
-
Boolean(connotation) && ariaSelected === "true"
|
|
75
|
-
],
|
|
76
|
-
[`shape-${shape}`, Boolean(shape)],
|
|
77
|
-
["disabled", Boolean(disabled)],
|
|
78
|
-
["selected", ariaSelected === "true"],
|
|
79
|
-
["icon-trailing", iconTrailing],
|
|
80
|
-
["removable", removable]
|
|
81
|
-
);
|
|
82
|
-
function renderDismissButton(context) {
|
|
83
|
-
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
84
|
-
return vividElement.html` <span
|
|
85
|
-
aria-label="${(x) => x.locale.tab.dismissButtonLabel}"
|
|
86
|
-
class="close"
|
|
87
|
-
id="close-btn"
|
|
88
|
-
@click="${(x, c) => x._handleCloseClick(c.event)}"
|
|
89
|
-
>
|
|
90
|
-
${() => affixIconTemplate("close-line", affix.IconWrapper.Span)}
|
|
91
|
-
</span>`;
|
|
92
|
-
}
|
|
93
|
-
const TabTemplate = (context) => {
|
|
94
|
-
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
95
|
-
return vividElement.html`
|
|
96
|
-
<template
|
|
97
|
-
slot="tab"
|
|
98
|
-
role="tab"
|
|
99
|
-
aria-disabled="${(x) => x.disabled}"
|
|
100
|
-
aria-selected="${(x) => x.ariaSelected}"
|
|
101
|
-
@keydown="${(x, c) => x._onKeyDown(c.event)}"
|
|
102
|
-
>
|
|
103
|
-
<div class="${getClasses}">
|
|
104
|
-
${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)} ${(x) => x.label}
|
|
105
|
-
${(x) => x.removable ? renderDismissButton(context) : null}
|
|
106
|
-
</div>
|
|
107
|
-
</template>
|
|
108
|
-
`;
|
|
109
|
-
};
|
|
8
|
+
const TabPanelTemplate = vividElement.html`
|
|
9
|
+
<template slot="tabpanel" role="tabpanel">
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</template>
|
|
12
|
+
`;
|
|
110
13
|
|
|
111
|
-
const
|
|
112
|
-
"tab",
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
[
|
|
116
|
-
{
|
|
117
|
-
styles
|
|
118
|
-
}
|
|
14
|
+
const tabPanelDefinition = vividElement.defineVividComponent(
|
|
15
|
+
"tab-panel",
|
|
16
|
+
TabPanel,
|
|
17
|
+
TabPanelTemplate,
|
|
18
|
+
[],
|
|
19
|
+
{}
|
|
119
20
|
);
|
|
120
|
-
const
|
|
21
|
+
const registerTabPanel = vividElement.createRegisterFunction(tabPanelDefinition);
|
|
121
22
|
|
|
122
|
-
exports.
|
|
123
|
-
exports.
|
|
124
|
-
exports.
|
|
23
|
+
exports.TabPanel = TabPanel;
|
|
24
|
+
exports.registerTabPanel = registerTabPanel;
|
|
25
|
+
exports.tabPanelDefinition = tabPanelDefinition;
|
package/shared/definition51.js
CHANGED
|
@@ -1,120 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { V as VividElement, a as attr, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
|
|
3
|
-
import { a as applyMixins } from './apply-mixins.js';
|
|
4
|
-
import { A as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
5
|
-
import { L as Localized } from './localized.js';
|
|
6
|
-
import { c as classNames } from './class-names.js';
|
|
1
|
+
import { V as VividElement, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
12
|
-
var result = void 0 ;
|
|
13
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14
|
-
if (decorator = decorators[i])
|
|
15
|
-
result = (decorator(target, key, result) ) || result;
|
|
16
|
-
if (result) __defProp(target, key, result);
|
|
17
|
-
return result;
|
|
18
|
-
};
|
|
19
|
-
class Tab extends VividElement {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.removable = false;
|
|
23
|
-
this.tabIndex = "-1";
|
|
24
|
-
this.ariaSelected = null;
|
|
25
|
-
}
|
|
26
|
-
_handleCloseClick(e) {
|
|
27
|
-
e.stopImmediatePropagation();
|
|
28
|
-
this.$emit("close");
|
|
29
|
-
}
|
|
30
|
-
_onKeyDown(e) {
|
|
31
|
-
if (!this.removable || e.key !== "Delete") return true;
|
|
32
|
-
e.stopImmediatePropagation();
|
|
33
|
-
this.$emit("close");
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
3
|
+
class TabPanel extends VividElement {
|
|
36
4
|
}
|
|
37
|
-
__decorateClass([
|
|
38
|
-
attr({ mode: "boolean" })
|
|
39
|
-
], Tab.prototype, "disabled");
|
|
40
|
-
__decorateClass([
|
|
41
|
-
attr
|
|
42
|
-
], Tab.prototype, "connotation");
|
|
43
|
-
__decorateClass([
|
|
44
|
-
attr
|
|
45
|
-
], Tab.prototype, "shape");
|
|
46
|
-
__decorateClass([
|
|
47
|
-
attr
|
|
48
|
-
], Tab.prototype, "label");
|
|
49
|
-
__decorateClass([
|
|
50
|
-
attr({ mode: "boolean" })
|
|
51
|
-
], Tab.prototype, "removable");
|
|
52
|
-
__decorateClass([
|
|
53
|
-
attr({ mode: "fromView" })
|
|
54
|
-
], Tab.prototype, "tabIndex");
|
|
55
|
-
__decorateClass([
|
|
56
|
-
attr({ attribute: "aria-selected" })
|
|
57
|
-
], Tab.prototype, "ariaSelected");
|
|
58
|
-
applyMixins(Tab, AffixIconWithTrailing);
|
|
59
|
-
applyMixins(Tab, Localized);
|
|
60
5
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
shape,
|
|
67
|
-
removable
|
|
68
|
-
}) => classNames(
|
|
69
|
-
"base",
|
|
70
|
-
[
|
|
71
|
-
`connotation-${connotation}`,
|
|
72
|
-
Boolean(connotation) && ariaSelected === "true"
|
|
73
|
-
],
|
|
74
|
-
[`shape-${shape}`, Boolean(shape)],
|
|
75
|
-
["disabled", Boolean(disabled)],
|
|
76
|
-
["selected", ariaSelected === "true"],
|
|
77
|
-
["icon-trailing", iconTrailing],
|
|
78
|
-
["removable", removable]
|
|
79
|
-
);
|
|
80
|
-
function renderDismissButton(context) {
|
|
81
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
82
|
-
return html` <span
|
|
83
|
-
aria-label="${(x) => x.locale.tab.dismissButtonLabel}"
|
|
84
|
-
class="close"
|
|
85
|
-
id="close-btn"
|
|
86
|
-
@click="${(x, c) => x._handleCloseClick(c.event)}"
|
|
87
|
-
>
|
|
88
|
-
${() => affixIconTemplate("close-line", IconWrapper.Span)}
|
|
89
|
-
</span>`;
|
|
90
|
-
}
|
|
91
|
-
const TabTemplate = (context) => {
|
|
92
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
93
|
-
return html`
|
|
94
|
-
<template
|
|
95
|
-
slot="tab"
|
|
96
|
-
role="tab"
|
|
97
|
-
aria-disabled="${(x) => x.disabled}"
|
|
98
|
-
aria-selected="${(x) => x.ariaSelected}"
|
|
99
|
-
@keydown="${(x, c) => x._onKeyDown(c.event)}"
|
|
100
|
-
>
|
|
101
|
-
<div class="${getClasses}">
|
|
102
|
-
${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)} ${(x) => x.label}
|
|
103
|
-
${(x) => x.removable ? renderDismissButton(context) : null}
|
|
104
|
-
</div>
|
|
105
|
-
</template>
|
|
106
|
-
`;
|
|
107
|
-
};
|
|
6
|
+
const TabPanelTemplate = html`
|
|
7
|
+
<template slot="tabpanel" role="tabpanel">
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</template>
|
|
10
|
+
`;
|
|
108
11
|
|
|
109
|
-
const
|
|
110
|
-
"tab",
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
[
|
|
114
|
-
{
|
|
115
|
-
styles
|
|
116
|
-
}
|
|
12
|
+
const tabPanelDefinition = defineVividComponent(
|
|
13
|
+
"tab-panel",
|
|
14
|
+
TabPanel,
|
|
15
|
+
TabPanelTemplate,
|
|
16
|
+
[],
|
|
17
|
+
{}
|
|
117
18
|
);
|
|
118
|
-
const
|
|
19
|
+
const registerTabPanel = createRegisterFunction(tabPanelDefinition);
|
|
119
20
|
|
|
120
|
-
export {
|
|
21
|
+
export { TabPanel as T, registerTabPanel as r, tabPanelDefinition as t };
|