@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/definition52.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { l as limit } from './numbers.js';
|
|
1
|
+
import { i as iconDefinition } from './definition28.js';
|
|
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';
|
|
7
6
|
import { c as classNames } from './class-names.js';
|
|
8
|
-
import { r as ref } from './ref.js';
|
|
9
|
-
import { s as slotted } from './slotted.js';
|
|
10
|
-
import { w as when } from './when.js';
|
|
11
7
|
|
|
12
|
-
const styles = ":host{
|
|
8
|
+
const styles = ":host{--_vvd-tab-accent-firm-wrapper: var( --vvd-tab-accent-firm );--_vvd-tab-cta-firm-wrapper: var( --vvd-tab-cta-firm )}.base{--vvd-tab-accent-firm: var( --_vvd-tab-accent-firm-wrapper, var(--vvd-tab-accent-primary) );--vvd-tab-cta-firm: var( --_vvd-tab-cta-firm-wrapper, var(--vvd-tab-cta-primary) )}:host(.vertical){justify-content:end;grid-column:1/auto}:host([disabled]){cursor:not-allowed}:host([removable]){position:relative}:host(:focus-visible){outline:none}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base.connotation-cta{--_connotation-color-primary-text: var(--vvd-tab-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-firm: var(--vvd-tab-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-tab-cta-faint, var(--vvd-color-cta-50));--_connotation-color-fierce: var(--vvd-tab-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-pale: var(--vvd-tab-cta-pale, var(--vvd-color-cta-300));--_connotation-color-soft: var(--vvd-tab-cta-soft, var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-primary-text: var(--vvd-tab-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-firm: var(--vvd-tab-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-tab-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-fierce: var(--vvd-tab-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-pale: var(--vvd-tab-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-soft: var(--vvd-tab-accent-soft, var(--vvd-color-neutral-100))}.base{position:relative;display:flex;box-sizing:border-box;align-items:center;justify-content:var(--_tab-justify-content);padding:var(--_tabs-tablist-gutter);background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base-bold);gap:var(--_tabs-tablist-gutter);min-block-size:40px;vertical-align:middle;white-space:nowrap}@supports (user-select: none){.base{user-select:none}}.base:not(.shape-sharp){border-radius:8px}.base:not(.disabled){cursor:pointer}.base.disabled{pointer-events:none}.base.removable{padding-inline-end:40px}:host(:focus-visible) .base{--focus-stroke-gap-color: transparent;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))}:host(.vertical) .base{margin-inline-start:var(--_tabs-active-indicator-stroke-width)}slot[name=icon]{font-size:20px;line-height:1}.icon-trailing slot[name=icon]{display:inline-block;order:1;margin-inline-start:auto}.close{position:absolute;display:flex;align-items:center;justify-content:center;block-size:24px;inline-size:24px;inset-block-start:50%;inset-inline-end:4px;transform:translateY(-50%)}.close vwc-icon{font-size:12px}.close .icon{display:flex;align-items:center;justify-content:center}";
|
|
13
9
|
|
|
14
10
|
var __defProp = Object.defineProperty;
|
|
15
11
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -20,508 +16,105 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
20
16
|
if (result) __defProp(target, key, result);
|
|
21
17
|
return result;
|
|
22
18
|
};
|
|
23
|
-
|
|
24
|
-
const TABLIST_COLUMN = "--_tabs-tablist-column";
|
|
25
|
-
const TabsOrientation = {
|
|
26
|
-
vertical: "vertical",
|
|
27
|
-
horizontal: "horizontal"
|
|
28
|
-
};
|
|
29
|
-
class Tabs extends VividElement {
|
|
19
|
+
class Tab extends VividElement {
|
|
30
20
|
constructor() {
|
|
31
21
|
super(...arguments);
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
this
|
|
35
|
-
return oldValue.length > newValue.length && this.activetab.id === oldValue[oldValue.length - 1].getAttribute(
|
|
36
|
-
isTab ? "id" : "aria-labelledby"
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
40
|
-
this.activeindicator = true;
|
|
41
|
-
this.showActiveIndicator = true;
|
|
42
|
-
this.prevActiveTabIndex = 0;
|
|
43
|
-
this.activeTabIndex = 0;
|
|
44
|
-
this.tabIds = [];
|
|
45
|
-
this.tabpanelIds = [];
|
|
46
|
-
this.change = () => {
|
|
47
|
-
this.$emit("change", this.activetab);
|
|
48
|
-
};
|
|
49
|
-
this.isDisabledElement = (el) => {
|
|
50
|
-
return el.getAttribute("aria-disabled") === "true";
|
|
51
|
-
};
|
|
52
|
-
this.isHiddenElement = (el) => {
|
|
53
|
-
return el.hasAttribute("hidden");
|
|
54
|
-
};
|
|
55
|
-
this.isFocusableElement = (el) => {
|
|
56
|
-
return !this.isDisabledElement(el) && !this.isHiddenElement(el);
|
|
57
|
-
};
|
|
58
|
-
this.setTabs = () => {
|
|
59
|
-
const gridHorizontalProperty = "gridColumn";
|
|
60
|
-
const gridVerticalProperty = "gridRow";
|
|
61
|
-
const gridProperty = this.#isHorizontal() ? gridHorizontalProperty : gridVerticalProperty;
|
|
62
|
-
this.activeTabIndex = this.getActiveIndex();
|
|
63
|
-
this.showActiveIndicator = false;
|
|
64
|
-
if (this.#isHorizontal()) {
|
|
65
|
-
this.tablist.style.setProperty(
|
|
66
|
-
"grid-template-columns",
|
|
67
|
-
`repeat(${this.tabs.length}, var(${TABLIST_COLUMN}))`
|
|
68
|
-
);
|
|
69
|
-
} else {
|
|
70
|
-
this.tablist.style.removeProperty("grid-template-columns");
|
|
71
|
-
}
|
|
72
|
-
this.tabs.forEach((tab, index) => {
|
|
73
|
-
if (tab.slot === "tab") {
|
|
74
|
-
const isActiveTab = this.activeTabIndex === index && this.isFocusableElement(tab);
|
|
75
|
-
if (this.activeindicator && this.isFocusableElement(tab)) {
|
|
76
|
-
this.showActiveIndicator = true;
|
|
77
|
-
}
|
|
78
|
-
const tabId = this.tabIds[index];
|
|
79
|
-
const tabpanelId = this.tabpanelIds[index];
|
|
80
|
-
tab.setAttribute("id", tabId);
|
|
81
|
-
tab.setAttribute("aria-selected", isActiveTab ? "true" : "false");
|
|
82
|
-
tab.setAttribute("aria-controls", tabpanelId);
|
|
83
|
-
tab.addEventListener("click", this.handleTabClick);
|
|
84
|
-
tab.addEventListener("keydown", this.#handleTabKeyDown);
|
|
85
|
-
tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
|
|
86
|
-
if (isActiveTab) {
|
|
87
|
-
this.activetab = tab;
|
|
88
|
-
this.activeid = tabId;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
tab.style[gridHorizontalProperty] = "";
|
|
92
|
-
tab.style[gridVerticalProperty] = "";
|
|
93
|
-
tab.style[gridProperty] = `${index + 1}`;
|
|
94
|
-
!this.#isHorizontal() ? tab.classList.add("vertical") : tab.classList.remove("vertical");
|
|
95
|
-
});
|
|
96
|
-
this.#updateTabsConnotation();
|
|
97
|
-
};
|
|
98
|
-
this.setTabPanels = () => {
|
|
99
|
-
this.tabpanels.forEach((tabpanel, index) => {
|
|
100
|
-
const tabId = this.tabIds[index];
|
|
101
|
-
const tabpanelId = this.tabpanelIds[index];
|
|
102
|
-
tabpanel.setAttribute("id", tabpanelId);
|
|
103
|
-
tabpanel.setAttribute("aria-labelledby", tabId);
|
|
104
|
-
this.activeTabIndex !== index ? tabpanel.setAttribute("hidden", "") : tabpanel.removeAttribute("hidden");
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
this.handleTabClick = (event) => {
|
|
108
|
-
const selectedTab = event.currentTarget;
|
|
109
|
-
if (selectedTab.nodeType === 1 && this.isFocusableElement(selectedTab)) {
|
|
110
|
-
this.prevActiveTabIndex = this.activeTabIndex;
|
|
111
|
-
this.activeTabIndex = this.tabs.indexOf(selectedTab);
|
|
112
|
-
this.setComponent();
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
this.#isHorizontal = () => {
|
|
116
|
-
return this.orientation === TabsOrientation.horizontal;
|
|
117
|
-
};
|
|
118
|
-
this.#handleTabKeyDown = (event) => {
|
|
119
|
-
if (this.#isHorizontal()) {
|
|
120
|
-
switch (event.key) {
|
|
121
|
-
case keyArrowLeft:
|
|
122
|
-
event.preventDefault();
|
|
123
|
-
this.adjustBackward(event);
|
|
124
|
-
break;
|
|
125
|
-
case keyArrowRight:
|
|
126
|
-
event.preventDefault();
|
|
127
|
-
this.adjustForward(event);
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
switch (event.key) {
|
|
132
|
-
case keyArrowUp:
|
|
133
|
-
event.preventDefault();
|
|
134
|
-
this.adjustBackward(event);
|
|
135
|
-
break;
|
|
136
|
-
case keyArrowDown:
|
|
137
|
-
event.preventDefault();
|
|
138
|
-
this.adjustForward(event);
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
switch (event.key) {
|
|
143
|
-
case keyHome:
|
|
144
|
-
event.preventDefault();
|
|
145
|
-
this.adjust(-this.activeTabIndex);
|
|
146
|
-
break;
|
|
147
|
-
case keyEnd:
|
|
148
|
-
event.preventDefault();
|
|
149
|
-
this.adjust(this.tabs.length - this.activeTabIndex - 1);
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
this.adjustForward = (_) => {
|
|
154
|
-
this.#moveToNextTab(1);
|
|
155
|
-
};
|
|
156
|
-
this.adjustBackward = (_) => {
|
|
157
|
-
this.#moveToNextTab(-1);
|
|
158
|
-
};
|
|
159
|
-
this.#moveToTabByIndex = (group, index) => {
|
|
160
|
-
const tab = group[index];
|
|
161
|
-
this.activetab = tab;
|
|
162
|
-
this.prevActiveTabIndex = this.activeTabIndex;
|
|
163
|
-
this.activeTabIndex = index;
|
|
164
|
-
tab.focus();
|
|
165
|
-
this.setComponent();
|
|
166
|
-
};
|
|
167
|
-
this.scrollablePanel = false;
|
|
168
|
-
this._actionItemsSlottedContent = [];
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* @internal
|
|
172
|
-
*/
|
|
173
|
-
orientationChanged() {
|
|
174
|
-
if (this.$fastController.isConnected) {
|
|
175
|
-
this.setTabs();
|
|
176
|
-
this.setTabPanels();
|
|
177
|
-
this.#handleActiveIndicatorPosition();
|
|
178
|
-
}
|
|
179
|
-
this.#patchIndicatorStyleTransition();
|
|
180
|
-
if (!this.activeIndicatorRef) return;
|
|
181
|
-
if (this.orientation === TabsOrientation.vertical) {
|
|
182
|
-
this.activeIndicatorRef.style.removeProperty(ACTIVE_TAB_WIDTH);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* @internal
|
|
187
|
-
*/
|
|
188
|
-
activeidChanged(oldValue, _) {
|
|
189
|
-
if (this.$fastController.isConnected && this.tabs.length <= this.tabpanels.length) {
|
|
190
|
-
this.prevActiveTabIndex = this.tabs.findIndex(
|
|
191
|
-
(item) => item.id === oldValue
|
|
192
|
-
);
|
|
193
|
-
this.setTabs();
|
|
194
|
-
this.setTabPanels();
|
|
195
|
-
this.#handleActiveIndicatorPosition();
|
|
196
|
-
}
|
|
197
|
-
this.#patchIndicatorStyleTransition();
|
|
198
|
-
this.#scrollToIndex(this.activeTabIndex);
|
|
199
|
-
}
|
|
200
|
-
#isLastTabSelectedAfterRemove;
|
|
201
|
-
/**
|
|
202
|
-
* @internal
|
|
203
|
-
*/
|
|
204
|
-
tabsChanged(oldValue, newValue) {
|
|
205
|
-
if (this.$fastController.isConnected && this.tabs.length <= this.tabpanels.length) {
|
|
206
|
-
this.tabIds = this.getTabIds();
|
|
207
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
208
|
-
this.setTabs();
|
|
209
|
-
this.setTabPanels();
|
|
210
|
-
this.#handleActiveIndicatorPosition(
|
|
211
|
-
!this.#isLastTabSelectedAfterRemove(oldValue, newValue)
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
this.#patchIndicatorStyleTransition();
|
|
215
|
-
this.#updateScrollStatus();
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* @internal
|
|
219
|
-
*/
|
|
220
|
-
tabpanelsChanged(oldValue, newValue) {
|
|
221
|
-
if (this.$fastController.isConnected && this.tabpanels.length <= this.tabs.length) {
|
|
222
|
-
this.tabIds = this.getTabIds();
|
|
223
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
224
|
-
this.setTabs();
|
|
225
|
-
this.setTabPanels();
|
|
226
|
-
this.#handleActiveIndicatorPosition(
|
|
227
|
-
!this.#isLastTabSelectedAfterRemove(oldValue, newValue, false)
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
this.#patchIndicatorStyleTransition();
|
|
231
|
-
}
|
|
232
|
-
getActiveIndex() {
|
|
233
|
-
const id = this.activeid;
|
|
234
|
-
if (id !== void 0) {
|
|
235
|
-
return this.tabIds.indexOf(this.activeid) === -1 ? 0 : this.tabIds.indexOf(this.activeid);
|
|
236
|
-
} else {
|
|
237
|
-
return 0;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
getTabIds() {
|
|
241
|
-
return this.tabs.map((tab) => {
|
|
242
|
-
return tab.getAttribute("id") ?? `tab-${uniqueId()}`;
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
getTabPanelIds() {
|
|
246
|
-
return this.tabpanels.map((tabPanel) => {
|
|
247
|
-
return tabPanel.getAttribute("id") ?? `panel-${uniqueId()}`;
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
setComponent() {
|
|
251
|
-
if (this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
252
|
-
this.activeid = this.tabIds[this.activeTabIndex];
|
|
253
|
-
this.focusTab();
|
|
254
|
-
this.change();
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
#isHorizontal;
|
|
258
|
-
#handleTabKeyDown;
|
|
259
|
-
/**
|
|
260
|
-
* The adjust method for FASTTabs
|
|
261
|
-
* @public
|
|
262
|
-
* @remarks
|
|
263
|
-
* This method allows the active index to be adjusted by numerical increments
|
|
264
|
-
*/
|
|
265
|
-
adjust(adjustment) {
|
|
266
|
-
const focusableTabs = this.tabs.filter((t) => this.isFocusableElement(t));
|
|
267
|
-
const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
|
|
268
|
-
const nextTabIndex = limit(
|
|
269
|
-
0,
|
|
270
|
-
focusableTabs.length - 1,
|
|
271
|
-
currentActiveTabIndex + adjustment
|
|
272
|
-
);
|
|
273
|
-
const nextIndex = this.tabs.indexOf(focusableTabs[nextTabIndex]);
|
|
274
|
-
if (nextIndex > -1) {
|
|
275
|
-
this.#moveToTabByIndex(this.tabs, nextIndex);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
#moveToNextTab(direction) {
|
|
279
|
-
const activeIndex = this.tabs.indexOf(this.activetab);
|
|
280
|
-
for (let offset = 1; offset < this.tabs.length; offset++) {
|
|
281
|
-
const index = (activeIndex + direction * offset + this.tabs.length) % this.tabs.length;
|
|
282
|
-
if (this.isFocusableElement(this.tabs[index])) {
|
|
283
|
-
this.#moveToTabByIndex(this.tabs, index);
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
#moveToTabByIndex;
|
|
289
|
-
focusTab() {
|
|
290
|
-
this.tabs[this.activeTabIndex].focus();
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* @internal
|
|
294
|
-
*/
|
|
295
|
-
connotationChanged() {
|
|
296
|
-
this.#updateTabsConnotation();
|
|
297
|
-
}
|
|
298
|
-
#updateScrollStatus() {
|
|
299
|
-
this.tablist.parentElement.dispatchEvent(new Event("scroll"));
|
|
300
|
-
}
|
|
301
|
-
get #shouldMoveIndicator() {
|
|
302
|
-
return !(!this.activetab || !this.activeIndicatorRef || this.orientation === TabsOrientation.vertical || !this.showActiveIndicator);
|
|
303
|
-
}
|
|
304
|
-
#patchIndicatorStyleTransition() {
|
|
305
|
-
if (!this.#shouldMoveIndicator) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
const width = this.activetab.getBoundingClientRect().width;
|
|
309
|
-
this.activeIndicatorRef.style.setProperty(ACTIVE_TAB_WIDTH, `${width}px`);
|
|
310
|
-
}
|
|
311
|
-
connectedCallback() {
|
|
312
|
-
super.connectedCallback();
|
|
313
|
-
this.tabIds = this.getTabIds();
|
|
314
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
315
|
-
this.activeTabIndex = this.getActiveIndex();
|
|
316
|
-
requestAnimationFrame(() => this.#updateScrollStatus());
|
|
317
|
-
const scrollWrapper = this.tablist.parentElement;
|
|
318
|
-
this.#resizeObserver = new ResizeObserver(() => {
|
|
319
|
-
this.#updateScrollStatus();
|
|
320
|
-
this.#patchIndicatorStyleTransition();
|
|
321
|
-
});
|
|
322
|
-
this.#resizeObserver.observe(scrollWrapper);
|
|
323
|
-
}
|
|
324
|
-
#resizeObserver;
|
|
325
|
-
disconnectedCallback() {
|
|
326
|
-
super.disconnectedCallback();
|
|
327
|
-
this.#resizeObserver.disconnect();
|
|
328
|
-
}
|
|
329
|
-
#updateTabsConnotation() {
|
|
330
|
-
if (this.tabs) {
|
|
331
|
-
this.tabs.forEach((tab) => {
|
|
332
|
-
if (tab.getAttribute("aria-selected") === "true") {
|
|
333
|
-
tab.setAttribute("connotation", this.connotation);
|
|
334
|
-
} else {
|
|
335
|
-
tab.removeAttribute("connotation");
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
get #tabListWrapper() {
|
|
341
|
-
return this.shadowRoot.querySelector(".tablist-wrapper");
|
|
342
|
-
}
|
|
343
|
-
#scrollToIndex(index) {
|
|
344
|
-
const tab = this.tabs?.[index];
|
|
345
|
-
if (!tab) return;
|
|
346
|
-
let left = 0;
|
|
347
|
-
let top = 0;
|
|
348
|
-
if (this.orientation === TabsOrientation.vertical) {
|
|
349
|
-
if (index === this.tabs.length - 1) {
|
|
350
|
-
top = this.#tabListWrapper.scrollHeight;
|
|
351
|
-
}
|
|
352
|
-
if (index > 0 && index < this.tabs.length - 1) {
|
|
353
|
-
top = tab.offsetTop - this.#tabListWrapper.offsetHeight / 2 + tab.offsetHeight / 2;
|
|
354
|
-
}
|
|
355
|
-
} else {
|
|
356
|
-
if (index === this.tabs.length - 1) {
|
|
357
|
-
left = this.#tabListWrapper.scrollWidth;
|
|
358
|
-
}
|
|
359
|
-
if (index > 0 && index < this.tabs.length - 1) {
|
|
360
|
-
left = tab.offsetLeft - this.#tabListWrapper.offsetWidth / 2 + tab.offsetWidth / 2;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
this.#tabListWrapper.scrollTo({ top, left, behavior: "smooth" });
|
|
22
|
+
this.removable = false;
|
|
23
|
+
this.tabIndex = "-1";
|
|
24
|
+
this.ariaSelected = null;
|
|
364
25
|
}
|
|
365
|
-
|
|
366
|
-
|
|
26
|
+
_handleCloseClick(e) {
|
|
27
|
+
e.stopImmediatePropagation();
|
|
28
|
+
this.$emit("close");
|
|
367
29
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
this.#animateActiveIndicator(animate);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
#animateActiveIndicator(animate) {
|
|
377
|
-
const offsetProperty = this.#isHorizontal() ? "offsetLeft" : "offsetTop";
|
|
378
|
-
const currentOffset = this.activeIndicatorRef[offsetProperty];
|
|
379
|
-
const currentGridValue = this.activeIndicatorRef.style[this.#getGridProperty()];
|
|
380
|
-
this.activeIndicatorRef.style[this.#getGridProperty()] = `${this.activeTabIndex + 1}`;
|
|
381
|
-
const targetOffset = this.activeIndicatorRef[offsetProperty];
|
|
382
|
-
this.activeIndicatorRef.style[this.#getGridProperty()] = currentGridValue;
|
|
383
|
-
const relativeOffset = targetOffset - currentOffset;
|
|
384
|
-
this.activeIndicatorRef.style.transform = `${this.#getTranslateProperty()}(${relativeOffset}px)`;
|
|
385
|
-
if (animate) {
|
|
386
|
-
this.activeIndicatorRef.classList.add("activeIndicatorTransition");
|
|
387
|
-
} else {
|
|
388
|
-
this.activeIndicatorRef.classList.remove("activeIndicatorTransition");
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* @internal
|
|
393
|
-
*/
|
|
394
|
-
activeIndicatorRefChanged() {
|
|
395
|
-
this.activeIndicatorRef.addEventListener("transitionend", () => {
|
|
396
|
-
this.activeIndicatorRef.style[this.#getGridProperty()] = `${this.activeTabIndex + 1}`;
|
|
397
|
-
this.activeIndicatorRef.style.transform = `${this.#getTranslateProperty()}(0px)`;
|
|
398
|
-
this.activeIndicatorRef.classList.remove("activeIndicatorTransition");
|
|
399
|
-
});
|
|
30
|
+
_onKeyDown(e) {
|
|
31
|
+
if (!this.removable || e.key !== "Delete") return true;
|
|
32
|
+
e.stopImmediatePropagation();
|
|
33
|
+
this.$emit("close");
|
|
34
|
+
return false;
|
|
400
35
|
}
|
|
401
36
|
}
|
|
402
|
-
__decorateClass([
|
|
403
|
-
attr
|
|
404
|
-
], Tabs.prototype, "orientation");
|
|
405
|
-
__decorateClass([
|
|
406
|
-
attr
|
|
407
|
-
], Tabs.prototype, "activeid");
|
|
408
|
-
__decorateClass([
|
|
409
|
-
observable
|
|
410
|
-
], Tabs.prototype, "tabs");
|
|
411
|
-
__decorateClass([
|
|
412
|
-
observable
|
|
413
|
-
], Tabs.prototype, "tabpanels");
|
|
414
37
|
__decorateClass([
|
|
415
38
|
attr({ mode: "boolean" })
|
|
416
|
-
],
|
|
417
|
-
__decorateClass([
|
|
418
|
-
observable
|
|
419
|
-
], Tabs.prototype, "activeIndicatorRef");
|
|
39
|
+
], Tab.prototype, "disabled");
|
|
420
40
|
__decorateClass([
|
|
421
|
-
|
|
422
|
-
],
|
|
423
|
-
__decorateClass([
|
|
424
|
-
observable
|
|
425
|
-
], Tabs.prototype, "tablist");
|
|
41
|
+
attr
|
|
42
|
+
], Tab.prototype, "connotation");
|
|
426
43
|
__decorateClass([
|
|
427
44
|
attr
|
|
428
|
-
],
|
|
45
|
+
], Tab.prototype, "shape");
|
|
429
46
|
__decorateClass([
|
|
430
47
|
attr
|
|
431
|
-
],
|
|
48
|
+
], Tab.prototype, "label");
|
|
432
49
|
__decorateClass([
|
|
433
|
-
attr({ mode: "boolean"
|
|
434
|
-
],
|
|
50
|
+
attr({ mode: "boolean" })
|
|
51
|
+
], Tab.prototype, "removable");
|
|
435
52
|
__decorateClass([
|
|
436
|
-
attr({
|
|
437
|
-
],
|
|
53
|
+
attr({ mode: "fromView" })
|
|
54
|
+
], Tab.prototype, "tabIndex");
|
|
438
55
|
__decorateClass([
|
|
439
|
-
|
|
440
|
-
],
|
|
56
|
+
attr({ attribute: "aria-selected" })
|
|
57
|
+
], Tab.prototype, "ariaSelected");
|
|
58
|
+
applyMixins(Tab, AffixIconWithTrailing);
|
|
59
|
+
applyMixins(Tab, Localized);
|
|
441
60
|
|
|
442
61
|
const getClasses = ({
|
|
443
62
|
connotation,
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
63
|
+
disabled,
|
|
64
|
+
ariaSelected,
|
|
65
|
+
iconTrailing,
|
|
66
|
+
shape,
|
|
67
|
+
removable
|
|
449
68
|
}) => classNames(
|
|
450
69
|
"base",
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
[
|
|
456
|
-
["
|
|
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]
|
|
457
79
|
);
|
|
458
|
-
function
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
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>`;
|
|
468
90
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
addEndShadow(scrollShadow, scrollWrapper);
|
|
483
|
-
}
|
|
484
|
-
const TabsTemplate = html`
|
|
485
|
-
<template>
|
|
486
|
-
<div class="${getClasses}">
|
|
487
|
-
<div class="tabs">
|
|
488
|
-
<div class="scroll-shadow">
|
|
489
|
-
<div class="tablist-wrapper" @scroll="${setShadowWhenScrollTabs}">
|
|
490
|
-
<div class="tablist" role="tablist" ${ref("tablist")}>
|
|
491
|
-
<slot name="tab" ${slotted("tabs")}></slot>
|
|
492
|
-
${when(
|
|
493
|
-
(x) => x.showActiveIndicator,
|
|
494
|
-
html`
|
|
495
|
-
<div
|
|
496
|
-
${ref("activeIndicatorRef")}
|
|
497
|
-
class="active-indicator"
|
|
498
|
-
></div>
|
|
499
|
-
`
|
|
500
|
-
)}
|
|
501
|
-
</div>
|
|
502
|
-
</div>
|
|
503
|
-
</div>
|
|
504
|
-
<slot
|
|
505
|
-
name="action-items"
|
|
506
|
-
${slotted("_actionItemsSlottedContent")}
|
|
507
|
-
></slot>
|
|
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}
|
|
508
104
|
</div>
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
</div>
|
|
513
|
-
</template>
|
|
514
|
-
`;
|
|
105
|
+
</template>
|
|
106
|
+
`;
|
|
107
|
+
};
|
|
515
108
|
|
|
516
|
-
const
|
|
517
|
-
"
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
[
|
|
109
|
+
const tabDefinition = defineVividComponent(
|
|
110
|
+
"tab",
|
|
111
|
+
Tab,
|
|
112
|
+
TabTemplate,
|
|
113
|
+
[iconDefinition],
|
|
521
114
|
{
|
|
522
115
|
styles
|
|
523
116
|
}
|
|
524
117
|
);
|
|
525
|
-
const
|
|
118
|
+
const registerTab = createRegisterFunction(tabDefinition);
|
|
526
119
|
|
|
527
|
-
export {
|
|
120
|
+
export { Tab as T, registerTab as r, tabDefinition as t };
|