@vonage/vivid 4.23.0 → 4.25.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 +21830 -14295
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/index.cjs +112 -150
- package/index.js +37 -35
- package/lib/accordion-item/accordion-item.d.ts +6 -0
- package/lib/action-group/action-group.d.ts +6 -0
- package/lib/alert/alert.d.ts +20 -0
- package/lib/audio-player/audio-player.d.ts +6 -0
- package/lib/badge/badge.d.ts +9 -1
- package/lib/banner/banner.d.ts +25 -0
- package/lib/breadcrumb/breadcrumb.d.ts +6 -0
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +63 -7
- package/lib/button/button.d.ts +732 -7
- package/lib/button/locale.d.ts +3 -0
- package/lib/calendar-event/calendar-event.d.ts +6 -0
- package/lib/card/card.d.ts +394 -2
- package/lib/card/card.template.d.ts +2 -1
- package/lib/checkbox/checkbox.d.ts +1822 -5
- package/lib/combobox/combobox.d.ts +1827 -20
- package/lib/data-grid/data-grid-cell.d.ts +339 -1
- package/lib/data-grid/locale.d.ts +5 -0
- package/lib/date-picker/date-picker.d.ts +1676 -207
- package/lib/date-range-picker/date-range-picker.d.ts +840 -107
- package/lib/date-time-picker/date-time-picker.d.ts +1678 -209
- package/lib/dial-pad/dial-pad.d.ts +8 -0
- package/lib/dialog/dialog.d.ts +12 -0
- package/lib/divider/divider.d.ts +6 -0
- package/lib/fab/fab.d.ts +6 -0
- package/lib/file-picker/file-picker.d.ts +1510 -32
- package/lib/file-picker/locale.d.ts +1 -0
- package/lib/header/header.d.ts +6 -0
- package/lib/icon/icon.d.ts +1 -0
- package/lib/icon/icon.template.d.ts +2 -1
- package/lib/menu/menu.d.ts +16 -7
- package/lib/menu/name.d.ts +1 -0
- package/lib/menu-item/menu-item.d.ts +14 -2
- package/lib/nav/nav.d.ts +6 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +13 -0
- package/lib/nav-item/nav-item.d.ts +405 -3
- package/lib/note/note.d.ts +6 -0
- package/lib/number-field/number-field.d.ts +1857 -36
- package/lib/option/option.d.ts +12 -0
- package/lib/progress/progress.d.ts +6 -0
- package/lib/progress-ring/progress-ring.d.ts +6 -0
- package/lib/radio/radio.d.ts +1137 -4
- package/lib/radio-group/radio-group.d.ts +20 -2
- package/lib/range-slider/range-slider.d.ts +752 -5
- package/lib/rich-text-editor/definition.d.ts +2 -2
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +3 -1
- package/lib/rich-text-editor/locale.d.ts +10 -0
- package/lib/rich-text-editor/menubar/menubar.d.ts +340 -1
- package/lib/rich-text-editor/rich-text-editor.d.ts +352 -2
- package/lib/searchable-select/locale.d.ts +1 -0
- package/lib/searchable-select/option-tag.d.ts +6 -0
- package/lib/searchable-select/searchable-select.d.ts +1857 -35
- package/lib/select/select.d.ts +1843 -28
- package/lib/selectable-box/selectable-box.d.ts +6 -0
- package/lib/slider/slider.d.ts +384 -2
- package/lib/split-button/split-button.d.ts +18 -0
- package/lib/switch/switch.d.ts +386 -3
- package/lib/tab/tab.d.ts +18 -1
- package/lib/tab-panel/tab-panel.d.ts +6 -0
- package/lib/tabs/tabs.d.ts +5 -21
- package/lib/tag/tag.d.ts +12 -0
- package/lib/tag-group/tag-group.d.ts +6 -0
- package/lib/text-area/text-area.d.ts +2174 -19
- package/lib/text-field/text-field.d.ts +2195 -31
- package/lib/time-picker/time-picker.d.ts +839 -106
- package/lib/toggletip/toggletip.d.ts +10 -4
- package/lib/tooltip/tooltip.d.ts +10 -4
- package/lib/tree-item/tree-item.d.ts +12 -0
- package/lib/tree-view/tree-view.d.ts +6 -0
- package/lib/video-player/video-player.d.ts +6 -0
- package/lib/visually-hidden/definition.d.ts +4 -0
- package/lib/visually-hidden/visually-hidden.d.ts +3 -0
- package/lib/visually-hidden/visually-hidden.template.d.ts +3 -0
- package/locales/de-DE.cjs +47 -1
- package/locales/de-DE.js +47 -1
- package/locales/en-GB.cjs +47 -1
- package/locales/en-GB.js +47 -1
- package/locales/en-US.cjs +47 -1
- package/locales/en-US.js +47 -1
- package/locales/ja-JP.cjs +47 -1
- package/locales/ja-JP.js +47 -1
- package/locales/zh-CN.cjs +47 -1
- package/locales/zh-CN.js +47 -1
- package/menu/index.cjs +1 -1
- package/menu/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/affix.cjs +13 -7
- package/shared/affix.js +13 -8
- package/shared/aria/delegates-aria.d.ts +6 -0
- package/shared/aria/host-semantics.d.ts +6 -0
- package/shared/breadcrumb-item.cjs +2 -5
- package/shared/breadcrumb-item.js +2 -5
- package/shared/button.cjs +19 -14
- package/shared/button.js +19 -14
- package/shared/calendar-picker.template.cjs +3 -3
- package/shared/calendar-picker.template.js +1 -1
- package/shared/char-count.cjs +92 -0
- package/shared/char-count.js +90 -0
- package/shared/definition.js +1 -1
- package/shared/definition10.js +1 -1
- package/shared/definition11.cjs +27 -44
- package/shared/definition11.js +28 -45
- package/shared/definition12.cjs +1 -1
- package/shared/definition12.js +2 -2
- package/shared/definition13.js +1 -1
- package/shared/definition14.cjs +53 -22
- package/shared/definition14.js +54 -23
- package/shared/definition15.cjs +31 -36
- package/shared/definition15.js +30 -36
- package/shared/definition16.cjs +43 -63
- package/shared/definition16.js +42 -63
- package/shared/definition17.cjs +12 -5
- package/shared/definition17.js +12 -5
- package/shared/definition18.cjs +10 -14
- package/shared/definition18.js +9 -14
- package/shared/definition19.cjs +85 -100
- package/shared/definition19.js +75 -91
- package/shared/definition2.js +1 -1
- package/shared/definition20.cjs +15 -20
- package/shared/definition20.js +14 -20
- package/shared/definition21.cjs +22 -3
- package/shared/definition21.js +23 -4
- package/shared/definition22.cjs +12 -6
- package/shared/definition22.js +13 -7
- package/shared/definition23.cjs +5 -38
- package/shared/definition23.js +5 -37
- package/shared/definition24.cjs +2 -7
- package/shared/definition24.js +3 -8
- package/shared/definition25.js +1 -1
- package/shared/definition26.cjs +160 -163
- package/shared/definition26.js +159 -163
- package/shared/definition27.cjs +1 -1
- package/shared/definition27.js +2 -2
- package/shared/definition28.cjs +32 -17
- package/shared/definition28.js +33 -18
- package/shared/definition29.js +1 -1
- package/shared/definition3.js +1 -1
- package/shared/definition30.cjs +96 -482
- package/shared/definition30.js +99 -482
- package/shared/definition31.cjs +334 -57
- package/shared/definition31.js +333 -56
- package/shared/definition32.cjs +104 -19
- package/shared/definition32.js +105 -20
- package/shared/definition33.cjs +67 -15
- package/shared/definition33.js +66 -14
- package/shared/definition34.cjs +15 -50
- package/shared/definition34.js +14 -49
- package/shared/definition35.cjs +28 -397
- package/shared/definition35.js +27 -397
- package/shared/definition36.cjs +404 -54
- package/shared/definition36.js +404 -55
- package/shared/definition37.cjs +57 -234
- package/shared/definition37.js +57 -233
- package/shared/definition38.cjs +221 -66
- package/shared/definition38.js +220 -65
- package/shared/definition39.cjs +52 -44
- package/shared/definition39.js +51 -43
- package/shared/definition4.cjs +31 -24
- package/shared/definition4.js +33 -26
- package/shared/definition40.cjs +56 -266
- package/shared/definition40.js +55 -265
- package/shared/definition41.cjs +285 -142
- package/shared/definition41.js +285 -142
- package/shared/definition42.cjs +156 -564
- package/shared/definition42.js +156 -565
- package/shared/definition43.cjs +557 -14317
- package/shared/definition43.js +556 -14316
- package/shared/definition44.cjs +14418 -1085
- package/shared/definition44.js +14416 -1085
- package/shared/definition45.cjs +1049 -671
- package/shared/definition45.js +1050 -672
- package/shared/definition46.cjs +848 -113
- package/shared/definition46.js +847 -112
- package/shared/definition47.cjs +125 -90
- package/shared/definition47.js +124 -89
- package/shared/definition48.cjs +88 -455
- package/shared/definition48.js +87 -454
- package/shared/definition49.cjs +466 -109
- package/shared/definition49.js +466 -109
- package/shared/definition5.cjs +8 -7
- package/shared/definition5.js +6 -5
- package/shared/definition50.cjs +106 -106
- package/shared/definition50.js +105 -105
- package/shared/definition51.cjs +136 -15
- package/shared/definition51.js +135 -14
- package/shared/definition52.cjs +16 -115
- package/shared/definition52.js +15 -114
- package/shared/definition53.cjs +78 -490
- package/shared/definition53.js +77 -488
- package/shared/definition54.cjs +445 -23
- package/shared/definition54.js +443 -22
- package/shared/definition55.cjs +22 -136
- package/shared/definition55.js +21 -135
- package/shared/definition56.cjs +95 -291
- package/shared/definition56.js +95 -292
- package/shared/definition57.cjs +192 -480
- package/shared/definition57.js +190 -479
- package/shared/definition58.cjs +411 -24
- package/shared/definition58.js +410 -24
- package/shared/definition59.cjs +27 -144
- package/shared/definition59.js +27 -143
- package/shared/definition6.js +1 -1
- package/shared/definition60.cjs +83 -54
- package/shared/definition60.js +82 -53
- package/shared/definition61.cjs +78 -166
- package/shared/definition61.js +77 -164
- package/shared/definition62.cjs +143 -232
- package/shared/definition62.js +141 -231
- package/shared/definition63.cjs +234 -69417
- package/shared/definition63.js +233 -69416
- package/shared/definition64.cjs +69454 -28
- package/shared/definition64.js +69453 -27
- package/shared/definition65.cjs +28 -2168
- package/shared/definition65.js +27 -2166
- package/shared/definition66.cjs +27 -0
- package/shared/definition66.js +23 -0
- package/shared/definition67.cjs +2195 -0
- package/shared/definition67.js +2190 -0
- package/shared/definition7.cjs +11 -2
- package/shared/definition7.js +12 -3
- package/shared/definition8.cjs +24 -11
- package/shared/definition8.js +26 -13
- package/shared/definition9.cjs +1 -2
- package/shared/definition9.js +2 -3
- package/shared/delegates-aria.js +1 -1
- package/shared/deprecation/replaced-props.d.ts +20 -0
- package/shared/divider.cjs +41 -0
- package/shared/divider.js +38 -0
- package/shared/feedback/feedback-message.d.ts +345 -0
- package/shared/feedback/locale.d.ts +4 -0
- package/{lib/text-anchor/text-anchor.d.ts → shared/feedback/mixins.d.ts} +62 -39
- package/shared/form-associated.cjs +124 -100
- package/shared/form-associated.js +125 -101
- package/shared/form-element.cjs +84 -0
- package/shared/form-element.js +82 -0
- package/shared/foundation/button/button.d.ts +378 -2
- package/shared/foundation/form-associated/form-associated.d.ts +753 -49
- package/shared/foundation/listbox/listbox.d.ts +1 -1
- package/shared/foundation/vivid-element/vivid-element.d.ts +14 -0
- package/shared/host-semantics.js +1 -1
- package/shared/key-codes.js +1 -1
- package/shared/linkable.cjs +70 -0
- package/shared/linkable.js +68 -0
- package/shared/localization/Locale.d.ts +16 -0
- package/shared/mixins.cjs +306 -0
- package/shared/mixins.js +300 -0
- package/shared/patterns/affix.d.ts +16 -1
- package/shared/patterns/anchored.d.ts +20 -8
- package/shared/patterns/char-count/char-count.d.ts +351 -0
- package/shared/patterns/char-count/index.d.ts +1 -0
- package/shared/patterns/char-count/locale.d.ts +4 -0
- package/shared/patterns/form-elements/form-element.d.ts +744 -0
- package/shared/patterns/form-elements/index.d.ts +3 -1
- package/shared/patterns/form-elements/with-error-text.d.ts +1122 -0
- package/shared/patterns/form-elements/with-success-text.d.ts +341 -0
- package/shared/patterns/index.d.ts +2 -0
- package/shared/patterns/linkable.d.ts +394 -0
- package/shared/patterns/localized.d.ts +6 -0
- package/shared/patterns/trapped-focus.d.ts +6 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +420 -52
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +420 -52
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +6 -0
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +843 -107
- package/shared/picker-field/mixins/single-date-picker.d.ts +1259 -155
- package/shared/picker-field/mixins/single-value-picker.d.ts +417 -49
- package/shared/picker-field/mixins/time-selection-picker.d.ts +842 -106
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +839 -103
- package/shared/picker-field/picker-field.d.ts +1491 -15
- package/shared/picker-field.template.cjs +13 -22
- package/shared/picker-field.template.js +14 -23
- package/shared/repeat.js +1 -1
- package/shared/slider.template.cjs +1 -1
- package/shared/slider.template.js +1 -1
- package/shared/time-selection-picker.template.cjs +10 -15
- package/shared/time-selection-picker.template.js +10 -16
- package/shared/vivid-element.cjs +53 -4
- package/shared/vivid-element.js +53 -3
- package/shared/with-error-text.cjs +56 -0
- package/shared/with-error-text.js +54 -0
- package/shared/with-success-text.cjs +23 -0
- package/shared/with-success-text.js +21 -0
- 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-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/visually-hidden/index.cjs +5 -0
- package/visually-hidden/index.js +3 -0
- package/vivid.api.json +762 -1478
- package/lib/checkbox/checkbox.form-associated.d.ts +0 -11
- package/lib/file-picker/file-picker.form-associated.d.ts +0 -11
- package/lib/number-field/number-field.form-associated.d.ts +0 -11
- package/lib/radio/radio.form-associated.d.ts +0 -13
- package/lib/range-slider/range-slider.form-associated.d.ts +0 -11
- package/lib/searchable-select/searchable-select.form-associated.d.ts +0 -11
- package/lib/select/select.form-associated.d.ts +0 -11
- package/lib/slider/slider.form-associated.d.ts +0 -11
- package/lib/switch/switch.form-associated.d.ts +0 -11
- package/lib/text-anchor/definition.d.ts +0 -2
- package/lib/text-anchor/text-anchor.template.d.ts +0 -3
- package/lib/text-area/text-area.form-associated.d.ts +0 -11
- package/lib/text-field/text-field.form-associated.d.ts +0 -11
- package/shared/anchor.cjs +0 -49
- package/shared/anchor.js +0 -47
- package/shared/apply-mixins.cjs +0 -23
- package/shared/apply-mixins.js +0 -21
- package/shared/applyMixinsWithObservables.cjs +0 -15
- package/shared/applyMixinsWithObservables.js +0 -13
- package/shared/direction.cjs +0 -17
- package/shared/direction.js +0 -15
- package/shared/form-elements.cjs +0 -209
- package/shared/form-elements.js +0 -202
- package/shared/foundation/anchor/anchor.d.ts +0 -11
- package/shared/foundation/utilities/apply-mixins.d.ts +0 -1
- package/shared/patterns/form-elements/form-elements.d.ts +0 -58
- package/shared/picker-field/picker-field.form-associated.d.ts +0 -11
- package/shared/text-anchor.cjs +0 -38
- package/shared/text-anchor.js +0 -36
- package/shared/text-anchor.template.cjs +0 -35
- package/shared/text-anchor.template.js +0 -33
- package/shared/utils/applyMixinsWithObservables.d.ts +0 -1
- package/text-anchor/index.cjs +0 -17
- package/text-anchor/index.js +0 -15
package/shared/definition54.js
CHANGED
|
@@ -1,34 +1,455 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { T as Tab, t as tabDefinition } from './definition53.js';
|
|
2
|
+
import { t as tabPanelDefinition } from './definition52.js';
|
|
3
|
+
import { V as VividElement, D as DOM, a as attr, o as observable, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
|
|
4
|
+
import { i as keyArrowLeft, h as keyArrowRight, e as keyArrowUp, f as keyArrowDown, d as keyEnd, g as keyHome } from './key-codes.js';
|
|
5
|
+
import { u as uniqueId } from './strings.js';
|
|
6
|
+
import { l as limit } from './numbers.js';
|
|
3
7
|
import { c as classNames } from './class-names.js';
|
|
8
|
+
import { r as ref } from './ref.js';
|
|
9
|
+
import { s as slotted } from './slotted.js';
|
|
4
10
|
|
|
5
|
-
const styles = ".base{display:flex;flex-
|
|
11
|
+
const styles = ":host{display:block}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base.connotation-cta{--_connotation-color-firm: var(--vvd-tabs-cta-firm, var(--vvd-color-cta-600))}.base:not(.connotation-cta){--_connotation-color-firm: var(--vvd-tabs-accent-firm, var(--vvd-color-canvas-text))}.base{--_tabs-tablist-gutter: 8px;--_tabs-active-indicator-stroke-width: 2px;display:grid;box-sizing:border-box}.base.orientation-vertical{overflow:hidden;block-size:inherit;grid-template-columns:auto 1fr;grid-template-rows:1fr}.base:not(.orientation-vertical){block-size:var(--tabs-block-size, auto);grid-template-columns:1fr;grid-template-rows:auto 1fr;max-block-size:100%}.base.layout-stretch .scroll-shadow{flex:1}.base:not(.orientation-vertical) .scroll-shadow{position:relative;overflow:hidden;isolation:isolate}.base:not(.orientation-vertical) .scroll-shadow.start-scroll:before,.base:not(.orientation-vertical) .scroll-shadow.start-scroll:after,.base:not(.orientation-vertical) .scroll-shadow.end-scroll:before,.base:not(.orientation-vertical) .scroll-shadow.end-scroll:after{position:absolute;content:\"\";inline-size:10px;inset-block:0;opacity:0;transition:opacity .1s}.base:not(.orientation-vertical) .scroll-shadow.start-scroll:before{z-index:1;box-shadow:inset 7px 1px 5px -3px var(--vvd-color-neutral-950);inset-inline-start:0;opacity:.2}.base:not(.orientation-vertical) .scroll-shadow.end-scroll:after{box-shadow:inset -7px 1px 5px -3px var(--vvd-color-neutral-950);inset-inline-end:0;opacity:.2}.tabs{display:flex;overflow:hidden}.base.orientation-vertical .tabs{flex-direction:column;box-shadow:1px 0 0 0 var(--vvd-color-neutral-300)}.base.orientation-horizontal .tabs{flex-direction:row;border-bottom:1px solid var(--vvd-color-neutral-300)}.tablist{position:relative;display:grid;overflow:hidden;box-sizing:border-box;color:var(--_appearance-color-text)}.base.layout-stretch .tablist{--_tab-justify-content: center;--_tabs-tablist-column: 1fr}.tablist .base:not(.layout-stretch){--_tabs-tablist-column: auto}.base.orientation-vertical .tablist{padding:var(--_tabs-tablist-gutter);block-size:fit-content;grid-row:1/2;grid-template-columns:auto 1fr;grid-template-rows:auto;inline-size:100%;min-block-size:100%;place-self:flex-start end;row-gap:var(--_tabs-tablist-gutter)}.base:not(.orientation-vertical) .tablist{justify-content:flex-start;column-gap:var(--_tabs-tablist-gutter);grid-auto-columns:var(--_tabs-tablist-column);grid-auto-flow:column;grid-template-rows:auto auto;inline-size:fit-content;min-inline-size:100%;padding-inline:var(--_tabs-tablist-gutter)}.base.has-action-items.orientation-vertical .tablist{padding-block-end:0}.base.has-action-items:not(.orientation-vertical) .tablist{padding-inline-end:0}.tablist-wrapper{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.tablist-wrapper{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.tablist-wrapper ::-webkit-scrollbar{width:4px}.tablist-wrapper ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.tablist-wrapper ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.base:not(.orientation-vertical) .tablist-wrapper{overflow:auto hidden;align-self:end;inline-size:100%}.base.orientation-vertical .tablist-wrapper{overflow:hidden auto;block-size:100%}.tablist-wrapper::-webkit-scrollbar{display:none}slot[name=action-items]{display:flex}.base.has-action-items.orientation-horizontal slot[name=action-items]{align-items:center;margin-inline:var(--_tabs-tablist-gutter)}.base.has-action-items.orientation-vertical slot[name=action-items]{margin-block:var(--_tabs-tablist-gutter)}.tabpanel{box-sizing:border-box;block-size:100%;min-block-size:0;min-inline-size:0}.base.scroll .tabpanel{overflow-y:auto;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.base.scroll .tabpanel{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.base.scroll .tabpanel ::-webkit-scrollbar{width:4px}.base.scroll .tabpanel ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.base.scroll .tabpanel ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.base.gutters-small .tabpanel{padding:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)) - (1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))))}.active-indicator{background:currentColor;margin-inline-start:calc(var(--_tabs-tablist-gutter) * -1)}.base.orientation-vertical .active-indicator{align-self:center;border-radius:2px;block-size:80%;grid-area:1/1;inline-size:var(--_tabs-active-indicator-stroke-width)}.base:not(.orientation-vertical) .active-indicator{position:absolute;z-index:1;border-radius:2px;block-size:var(--_tabs-active-indicator-stroke-width);grid-area:2/1;inline-size:calc(var(--_tabs-active-tab-inline-size));inset-block-end:0;inset-inline-start:8px}.activeIndicatorTransition{transition:transform .2s ease-out 0s,inline-size .2s ease-out 0s}";
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
+
var result = void 0 ;
|
|
16
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
+
if (decorator = decorators[i])
|
|
18
|
+
result = (decorator(target, key, result) ) || result;
|
|
19
|
+
if (result) __defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
const ACTIVE_TAB_WIDTH = "--_tabs-active-tab-inline-size";
|
|
23
|
+
const TabsGutters = {
|
|
24
|
+
None: "none",
|
|
25
|
+
Small: "small"
|
|
26
|
+
};
|
|
27
|
+
const TabsOrientation = {
|
|
28
|
+
vertical: "vertical",
|
|
29
|
+
horizontal: "horizontal"
|
|
30
|
+
};
|
|
31
|
+
const oppositeOrientation = (orientation) => orientation === TabsOrientation.horizontal ? TabsOrientation.vertical : TabsOrientation.horizontal;
|
|
32
|
+
const gridProperty = (orientation) => orientation === TabsOrientation.horizontal ? "gridColumn" : "gridRow";
|
|
33
|
+
const translateProperty = (orientation) => orientation === TabsOrientation.horizontal ? "translateX" : "translateY";
|
|
34
|
+
const offsetProperty = (orientation) => orientation === TabsOrientation.horizontal ? "offsetLeft" : "offsetTop";
|
|
35
|
+
const isFocusableElement = (el) => el.getAttribute("aria-disabled") !== "true" && !el.hasAttribute("hidden");
|
|
36
|
+
class Tabs extends VividElement {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
40
|
+
this.orientation = TabsOrientation.horizontal;
|
|
41
|
+
this.tabs = [];
|
|
42
|
+
this.tabpanels = [];
|
|
43
|
+
this.#isTabsChangeQueued = false;
|
|
44
|
+
this.#lastActiveId = void 0;
|
|
45
|
+
this.#onTabClick = (event) => {
|
|
46
|
+
const selectedTab = event.currentTarget;
|
|
47
|
+
if (this._validTabs.includes(selectedTab)) {
|
|
48
|
+
this.#setActiveTabDueToUserInteraction(selectedTab);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
this.#onTabKeyDown = (event) => {
|
|
52
|
+
const tabs = this._validTabs;
|
|
53
|
+
const activeTab = this.activetab;
|
|
54
|
+
if (!activeTab) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const [arrowKeyPrev, arrowKeyNext] = this.orientation === TabsOrientation.horizontal ? [keyArrowLeft, keyArrowRight] : [keyArrowUp, keyArrowDown];
|
|
58
|
+
const keyToNextTab = {
|
|
59
|
+
[arrowKeyPrev]: () => tabs[(tabs.indexOf(activeTab) - 1 + tabs.length) % tabs.length],
|
|
60
|
+
[arrowKeyNext]: () => tabs[(tabs.indexOf(activeTab) + 1) % tabs.length],
|
|
61
|
+
[keyHome]: () => tabs[0],
|
|
62
|
+
[keyEnd]: () => tabs[tabs.length - 1]
|
|
63
|
+
};
|
|
64
|
+
if (keyToNextTab[event.key]) {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
this.#setActiveTabDueToUserInteraction(keyToNextTab[event.key]());
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
this.#isTransitioningTransform = false;
|
|
70
|
+
this.scrollablePanel = false;
|
|
71
|
+
this._actionItemsSlottedContent = [];
|
|
72
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
73
|
+
this.activeindicator = true;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
orientationChanged() {
|
|
79
|
+
this._registerTabsChange();
|
|
80
|
+
if (this.$fastController.isConnected) {
|
|
81
|
+
DOM.queueUpdate(() => this.#moveActiveIndicator(false));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
tabsChanged() {
|
|
88
|
+
for (const tab of this.tabs) {
|
|
89
|
+
if (!tab.id) {
|
|
90
|
+
tab.id = `tab-${uniqueId()}`;
|
|
91
|
+
}
|
|
92
|
+
tab.addEventListener("click", this.#onTabClick);
|
|
93
|
+
tab.addEventListener("keydown", this.#onTabKeyDown);
|
|
94
|
+
}
|
|
95
|
+
this._registerTabsChange();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
tabpanelsChanged() {
|
|
101
|
+
for (const panel of this.tabpanels) {
|
|
102
|
+
if (!panel.id) {
|
|
103
|
+
panel.id = `panel-${uniqueId()}`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
this._registerTabsChange();
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Tabs that are paired with a tabpanel. Ignore any excess tabs or panels.
|
|
110
|
+
*/
|
|
111
|
+
get _pairedTabs() {
|
|
112
|
+
return this.tabs.slice(
|
|
113
|
+
0,
|
|
114
|
+
Math.min(this.tabs.length, this.tabpanels.length)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Tabs that are eligible to become active.
|
|
119
|
+
*/
|
|
120
|
+
get _validTabs() {
|
|
121
|
+
return this._pairedTabs.filter(isFocusableElement);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
activeidChanged() {
|
|
127
|
+
this._registerTabsChange();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A reference to the active tab
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
get activetab() {
|
|
134
|
+
return this._validTabs.find((tab) => tab.id === this.activeid) ?? null;
|
|
135
|
+
}
|
|
136
|
+
#setActiveTabDueToUserInteraction(tab) {
|
|
137
|
+
this.activeid = tab.id;
|
|
138
|
+
tab.focus();
|
|
139
|
+
this.$emit("change", tab);
|
|
140
|
+
}
|
|
141
|
+
#isTabsChangeQueued;
|
|
142
|
+
/**
|
|
143
|
+
* Defer actual processing of changes into a microtask to wait for all DOM changes to complete. E.g. when tabs and
|
|
144
|
+
* active id are updated at the same time.
|
|
145
|
+
*/
|
|
146
|
+
_registerTabsChange() {
|
|
147
|
+
if (this.#isTabsChangeQueued) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.#isTabsChangeQueued = true;
|
|
151
|
+
window.queueMicrotask(() => {
|
|
152
|
+
if (this.$fastController.isConnected) {
|
|
153
|
+
this.#handleTabsChange();
|
|
154
|
+
}
|
|
155
|
+
this.#isTabsChangeQueued = false;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
#lastActiveId;
|
|
159
|
+
#handleTabsChange() {
|
|
160
|
+
const validTabs = this._validTabs;
|
|
161
|
+
let newActiveId = this.activeid;
|
|
162
|
+
if (!validTabs.length || newActiveId && !validTabs.find((t) => t.id === newActiveId)) {
|
|
163
|
+
newActiveId = void 0;
|
|
164
|
+
}
|
|
165
|
+
if (!newActiveId && validTabs.length) {
|
|
166
|
+
newActiveId = validTabs[0].id;
|
|
167
|
+
}
|
|
168
|
+
if (this.activeid !== newActiveId) {
|
|
169
|
+
this.activeid = newActiveId;
|
|
170
|
+
this.$emit("change", this.activetab);
|
|
171
|
+
}
|
|
172
|
+
this.#updateSlottedChildren();
|
|
173
|
+
if (this.activeid !== this.#lastActiveId) {
|
|
174
|
+
if (this.activetab) {
|
|
175
|
+
const shouldAnimate = this.#lastActiveId !== void 0;
|
|
176
|
+
this.#scrollToTab(this.activetab, shouldAnimate);
|
|
177
|
+
this.#moveActiveIndicator(shouldAnimate);
|
|
178
|
+
}
|
|
179
|
+
this.#lastActiveId = this.activeid;
|
|
180
|
+
} else {
|
|
181
|
+
this.#moveActiveIndicator(this.#isTransitioningTransform);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Updates the tabs and their panels according to the current state of the component.
|
|
186
|
+
*/
|
|
187
|
+
#updateSlottedChildren() {
|
|
188
|
+
for (const [index, tab] of this._pairedTabs.entries()) {
|
|
189
|
+
const panel = this.tabpanels[index];
|
|
190
|
+
const isActiveTab = tab.id === this.activeid;
|
|
191
|
+
if (tab instanceof Tab) {
|
|
192
|
+
tab.active = isActiveTab;
|
|
193
|
+
}
|
|
194
|
+
tab.setAttribute("aria-controls", panel.id);
|
|
195
|
+
tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
|
|
196
|
+
if (isActiveTab && this.connotation) {
|
|
197
|
+
tab.setAttribute("connotation", this.connotation);
|
|
198
|
+
} else {
|
|
199
|
+
tab.removeAttribute("connotation");
|
|
200
|
+
}
|
|
201
|
+
tab.classList.toggle(
|
|
202
|
+
"vertical",
|
|
203
|
+
this.orientation === TabsOrientation.vertical
|
|
204
|
+
);
|
|
205
|
+
tab.style[gridProperty(oppositeOrientation(this.orientation))] = "";
|
|
206
|
+
tab.style[gridProperty(this.orientation)] = `${index + 1}`;
|
|
207
|
+
panel.setAttribute("aria-labelledby", tab.id);
|
|
208
|
+
panel.hidden = !isActiveTab;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
#onTabClick;
|
|
212
|
+
#onTabKeyDown;
|
|
213
|
+
/**
|
|
214
|
+
* Adjusts the active index by numerical increments.
|
|
215
|
+
* Only enabled tabs are considered.
|
|
216
|
+
* @public
|
|
217
|
+
* @remarks
|
|
218
|
+
*/
|
|
219
|
+
adjust(adjustment) {
|
|
220
|
+
const focusableTabs = this._validTabs;
|
|
221
|
+
const currentActiveTabIndex = focusableTabs.findIndex(
|
|
222
|
+
(t) => t.id === this.activeid
|
|
223
|
+
);
|
|
224
|
+
if (currentActiveTabIndex === -1) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const nextTabIndex = limit(
|
|
228
|
+
0,
|
|
229
|
+
focusableTabs.length - 1,
|
|
230
|
+
currentActiveTabIndex + adjustment
|
|
231
|
+
);
|
|
232
|
+
this.#setActiveTabDueToUserInteraction(focusableTabs[nextTabIndex]);
|
|
233
|
+
}
|
|
234
|
+
#isTransitioningTransform;
|
|
235
|
+
/**
|
|
236
|
+
* @internal
|
|
237
|
+
*/
|
|
238
|
+
_onActiveIndicatorTransitionend(event) {
|
|
239
|
+
if (event.propertyName === "transform") {
|
|
240
|
+
this.#isTransitioningTransform = false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
#cancelAnimationIfNeeded() {
|
|
244
|
+
this.#isTransitioningTransform = false;
|
|
245
|
+
this.activeIndicatorRef.classList.remove("activeIndicatorTransition");
|
|
246
|
+
}
|
|
247
|
+
#moveActiveIndicator(shouldAnimate) {
|
|
248
|
+
const activeTabIndex = this._pairedTabs.findIndex(
|
|
249
|
+
(tab) => tab.id === this.activeid
|
|
250
|
+
);
|
|
251
|
+
if (activeTabIndex === -1) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const indicatorEl = this.activeIndicatorRef;
|
|
255
|
+
const currentOffset = indicatorEl[offsetProperty(this.orientation)];
|
|
256
|
+
indicatorEl.style[gridProperty(this.orientation)] = `${activeTabIndex + 1}`;
|
|
257
|
+
const targetOffset = indicatorEl[offsetProperty(this.orientation)];
|
|
258
|
+
indicatorEl.style[gridProperty(this.orientation)] = "";
|
|
259
|
+
const relativeOffset = targetOffset - currentOffset;
|
|
260
|
+
const currentTransform = indicatorEl.style.transform;
|
|
261
|
+
const targetTransform = `${translateProperty(
|
|
262
|
+
this.orientation
|
|
263
|
+
)}(${relativeOffset}px)`;
|
|
264
|
+
if (shouldAnimate) {
|
|
265
|
+
indicatorEl.classList.add("activeIndicatorTransition");
|
|
266
|
+
if (currentTransform !== targetTransform) {
|
|
267
|
+
this.#isTransitioningTransform = true;
|
|
268
|
+
}
|
|
269
|
+
} else {
|
|
270
|
+
this.#cancelAnimationIfNeeded();
|
|
271
|
+
}
|
|
272
|
+
indicatorEl.style.transform = targetTransform;
|
|
273
|
+
indicatorEl.style.setProperty(
|
|
274
|
+
ACTIVE_TAB_WIDTH,
|
|
275
|
+
this.tabs[activeTabIndex].getBoundingClientRect().width + "px"
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* @internal
|
|
280
|
+
*/
|
|
281
|
+
connotationChanged() {
|
|
282
|
+
this._registerTabsChange();
|
|
283
|
+
}
|
|
284
|
+
#updateScrollStatus() {
|
|
285
|
+
this.#tabListScrollWrapper.dispatchEvent(new Event("scroll"));
|
|
286
|
+
}
|
|
287
|
+
#resizeObserver;
|
|
288
|
+
connectedCallback() {
|
|
289
|
+
super.connectedCallback();
|
|
290
|
+
this._registerTabsChange();
|
|
291
|
+
requestAnimationFrame(() => this.#updateScrollStatus());
|
|
292
|
+
this.#resizeObserver = new ResizeObserver(() => {
|
|
293
|
+
this.#moveActiveIndicator(this.#isTransitioningTransform);
|
|
294
|
+
this.#updateScrollStatus();
|
|
295
|
+
});
|
|
296
|
+
this.#resizeObserver.observe(this.#tabListScrollWrapper);
|
|
297
|
+
this.#resizeObserver.observe(this.tablist);
|
|
298
|
+
}
|
|
299
|
+
disconnectedCallback() {
|
|
300
|
+
super.disconnectedCallback();
|
|
301
|
+
this.#resizeObserver.disconnect();
|
|
302
|
+
}
|
|
303
|
+
get #tabListWrapper() {
|
|
304
|
+
return this.shadowRoot.querySelector(".tablist-wrapper");
|
|
305
|
+
}
|
|
306
|
+
get #tabListScrollWrapper() {
|
|
307
|
+
return this.tablist.parentElement;
|
|
308
|
+
}
|
|
309
|
+
#scrollToTab(tab, shouldAnimate = true) {
|
|
310
|
+
const index = this.tabs.findIndex((t) => t === tab);
|
|
311
|
+
let left = 0;
|
|
312
|
+
let top = 0;
|
|
313
|
+
if (this.orientation === TabsOrientation.vertical) {
|
|
314
|
+
if (index === this.tabs.length - 1) {
|
|
315
|
+
top = this.#tabListWrapper.scrollHeight;
|
|
316
|
+
}
|
|
317
|
+
if (index > 0 && index < this.tabs.length - 1) {
|
|
318
|
+
top = tab.offsetTop - this.#tabListWrapper.offsetHeight / 2 + tab.offsetHeight / 2;
|
|
319
|
+
}
|
|
320
|
+
} else {
|
|
321
|
+
if (index === this.tabs.length - 1) {
|
|
322
|
+
left = this.#tabListWrapper.scrollWidth;
|
|
323
|
+
}
|
|
324
|
+
if (index > 0 && index < this.tabs.length - 1) {
|
|
325
|
+
left = tab.offsetLeft - this.#tabListWrapper.offsetWidth / 2 + tab.offsetWidth / 2;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
this.#tabListWrapper.scrollTo({
|
|
329
|
+
top,
|
|
330
|
+
left,
|
|
331
|
+
behavior: shouldAnimate ? "smooth" : "instant"
|
|
332
|
+
});
|
|
333
|
+
}
|
|
8
334
|
}
|
|
335
|
+
__decorateClass([
|
|
336
|
+
attr
|
|
337
|
+
], Tabs.prototype, "orientation");
|
|
338
|
+
__decorateClass([
|
|
339
|
+
observable
|
|
340
|
+
], Tabs.prototype, "tabs");
|
|
341
|
+
__decorateClass([
|
|
342
|
+
observable
|
|
343
|
+
], Tabs.prototype, "tabpanels");
|
|
344
|
+
__decorateClass([
|
|
345
|
+
attr
|
|
346
|
+
], Tabs.prototype, "activeid");
|
|
347
|
+
__decorateClass([
|
|
348
|
+
observable
|
|
349
|
+
], Tabs.prototype, "activeIndicatorRef");
|
|
350
|
+
__decorateClass([
|
|
351
|
+
observable
|
|
352
|
+
], Tabs.prototype, "tablist");
|
|
353
|
+
__decorateClass([
|
|
354
|
+
attr
|
|
355
|
+
], Tabs.prototype, "connotation");
|
|
356
|
+
__decorateClass([
|
|
357
|
+
attr
|
|
358
|
+
], Tabs.prototype, "gutters");
|
|
359
|
+
__decorateClass([
|
|
360
|
+
attr({ mode: "boolean", attribute: "scrollable-panel" })
|
|
361
|
+
], Tabs.prototype, "scrollablePanel");
|
|
362
|
+
__decorateClass([
|
|
363
|
+
attr({ attribute: "tabs-layout" })
|
|
364
|
+
], Tabs.prototype, "tabsLayout");
|
|
365
|
+
__decorateClass([
|
|
366
|
+
observable
|
|
367
|
+
], Tabs.prototype, "_actionItemsSlottedContent");
|
|
368
|
+
__decorateClass([
|
|
369
|
+
attr({ mode: "boolean" })
|
|
370
|
+
], Tabs.prototype, "activeindicator");
|
|
9
371
|
|
|
10
|
-
const getClasses = (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
372
|
+
const getClasses = ({
|
|
373
|
+
connotation,
|
|
374
|
+
orientation,
|
|
375
|
+
gutters,
|
|
376
|
+
scrollablePanel,
|
|
377
|
+
tabsLayout,
|
|
378
|
+
_actionItemsSlottedContent
|
|
379
|
+
}) => classNames(
|
|
380
|
+
"base",
|
|
381
|
+
`layout-${tabsLayout ?? "align-start"}`,
|
|
382
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
383
|
+
[`orientation-${orientation}`, Boolean(orientation)],
|
|
384
|
+
`gutters-${gutters ?? "small"}`,
|
|
385
|
+
["scroll", Boolean(scrollablePanel)],
|
|
386
|
+
["has-action-items", Boolean(_actionItemsSlottedContent.length)]
|
|
387
|
+
);
|
|
388
|
+
function setNoScrollState(scrollShadow, scrollWrapper) {
|
|
389
|
+
if (scrollWrapper.scrollWidth <= scrollWrapper.clientWidth) {
|
|
390
|
+
scrollShadow.classList.toggle("start-scroll", false);
|
|
391
|
+
scrollShadow.classList.toggle("end-scroll", false);
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
function addStartShadow(scrollShadow, scrollWrapper) {
|
|
397
|
+
scrollShadow.classList.toggle("start-scroll", scrollWrapper.scrollLeft > 0);
|
|
398
|
+
}
|
|
399
|
+
function addEndShadow(scrollShadow, scrollWrapper) {
|
|
400
|
+
scrollShadow.classList.toggle(
|
|
401
|
+
"end-scroll",
|
|
402
|
+
scrollWrapper.scrollLeft + 1 < scrollWrapper.scrollWidth - scrollWrapper.clientWidth
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
function setShadowWhenScrollTabs(_, { event }) {
|
|
406
|
+
const scrollWrapper = event.currentTarget;
|
|
407
|
+
const scrollShadow = scrollWrapper.parentElement;
|
|
408
|
+
if (setNoScrollState(scrollShadow, scrollWrapper)) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
addStartShadow(scrollShadow, scrollWrapper);
|
|
412
|
+
addEndShadow(scrollShadow, scrollWrapper);
|
|
413
|
+
}
|
|
414
|
+
const TabsTemplate = html`
|
|
415
|
+
<template>
|
|
416
|
+
<div class="${getClasses}">
|
|
417
|
+
<div class="tabs">
|
|
418
|
+
<div class="scroll-shadow">
|
|
419
|
+
<div class="tablist-wrapper" @scroll="${setShadowWhenScrollTabs}">
|
|
420
|
+
<div class="tablist" role="tablist" ${ref("tablist")}>
|
|
421
|
+
<slot name="tab" ${slotted("tabs")}></slot>
|
|
422
|
+
<div
|
|
423
|
+
${ref("activeIndicatorRef")}
|
|
424
|
+
class="active-indicator"
|
|
425
|
+
@transitionend="${(x, c) => x._onActiveIndicatorTransitionend(
|
|
426
|
+
c.event
|
|
427
|
+
)}"
|
|
428
|
+
></div>
|
|
429
|
+
</div>
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
<slot
|
|
433
|
+
name="action-items"
|
|
434
|
+
${slotted("_actionItemsSlottedContent")}
|
|
435
|
+
></slot>
|
|
436
|
+
</div>
|
|
437
|
+
<div class="tabpanel" part="tab-panel">
|
|
438
|
+
<slot name="tabpanel" ${slotted("tabpanels")}></slot>
|
|
439
|
+
</div>
|
|
440
|
+
</div>
|
|
441
|
+
</template>
|
|
21
442
|
`;
|
|
22
443
|
|
|
23
|
-
const
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
[],
|
|
444
|
+
const tabsDefinition = defineVividComponent(
|
|
445
|
+
"tabs",
|
|
446
|
+
Tabs,
|
|
447
|
+
TabsTemplate,
|
|
448
|
+
[tabDefinition, tabPanelDefinition],
|
|
28
449
|
{
|
|
29
450
|
styles
|
|
30
451
|
}
|
|
31
452
|
);
|
|
32
|
-
const
|
|
453
|
+
const registerTabs = createRegisterFunction(tabsDefinition);
|
|
33
454
|
|
|
34
|
-
export {
|
|
455
|
+
export { Tabs as T, TabsGutters as a, registerTabs as r, tabsDefinition as t };
|
package/shared/definition55.cjs
CHANGED
|
@@ -1,152 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const definition = require('./definition28.cjs');
|
|
4
3
|
const vividElement = require('./vivid-element.cjs');
|
|
5
|
-
const affix = require('./affix.cjs');
|
|
6
4
|
const delegatesAria = require('./delegates-aria.cjs');
|
|
7
5
|
const classNames = require('./class-names.cjs');
|
|
8
|
-
const when = require('./when.cjs');
|
|
9
6
|
|
|
10
|
-
|
|
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 Tag extends delegatesAria.DelegatesAria(affix.AffixIcon(vividElement.VividElement)) {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.removable = false;
|
|
23
|
-
this.disabled = false;
|
|
24
|
-
this.selectable = false;
|
|
25
|
-
this.selected = false;
|
|
26
|
-
this.#select = () => {
|
|
27
|
-
if (!this.selectable || this.disabled) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
this.selected = !this.selected;
|
|
31
|
-
this.$emit("selected-change");
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
remove() {
|
|
35
|
-
if (!this.removable || this.selectable) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
this.$emit("removed");
|
|
39
|
-
this.parentElement && this.parentElement.removeChild(this);
|
|
40
|
-
}
|
|
41
|
-
#select;
|
|
42
|
-
handleKeydown(e) {
|
|
43
|
-
if (e.key === "Enter") {
|
|
44
|
-
this.#select();
|
|
45
|
-
}
|
|
46
|
-
if (e.key === "Delete" || e.key === "Backspace") {
|
|
47
|
-
this.remove();
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
handleClick() {
|
|
52
|
-
this.#select();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
__decorateClass([
|
|
56
|
-
vividElement.attr
|
|
57
|
-
], Tag.prototype, "connotation");
|
|
58
|
-
__decorateClass([
|
|
59
|
-
vividElement.attr
|
|
60
|
-
], Tag.prototype, "shape");
|
|
61
|
-
__decorateClass([
|
|
62
|
-
vividElement.attr
|
|
63
|
-
], Tag.prototype, "appearance");
|
|
64
|
-
__decorateClass([
|
|
65
|
-
vividElement.attr
|
|
66
|
-
], Tag.prototype, "label");
|
|
67
|
-
__decorateClass([
|
|
68
|
-
vividElement.attr({ mode: "boolean" })
|
|
69
|
-
], Tag.prototype, "removable");
|
|
70
|
-
__decorateClass([
|
|
71
|
-
vividElement.attr({ mode: "boolean" })
|
|
72
|
-
], Tag.prototype, "disabled");
|
|
73
|
-
__decorateClass([
|
|
74
|
-
vividElement.attr({ mode: "boolean" })
|
|
75
|
-
], Tag.prototype, "selectable");
|
|
76
|
-
__decorateClass([
|
|
77
|
-
vividElement.attr({ mode: "boolean" })
|
|
78
|
-
], Tag.prototype, "selected");
|
|
79
|
-
|
|
80
|
-
const styles = ".base.connotation-cta{--_connotation-color-contrast: var(--vvd-tag-cta-contrast, var(--vvd-color-cta-800));--_connotation-color-soft: var(--vvd-tag-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-tag-cta-pale, var(--vvd-color-cta-300));--_connotation-color-fierce: var(--vvd-tag-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-firm-all: var(--vvd-tag-cta-firm-all, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-tag-cta-faint, var(--vvd-color-cta-50));--_connotation-color-dim: var(--vvd-tag-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-contrast: var(--vvd-tag-accent-contrast, var(--vvd-color-neutral-800));--_connotation-color-soft: var(--vvd-tag-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-tag-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-fierce: var(--vvd-tag-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-firm-all: var(--vvd-tag-accent-firm-all, var(--vvd-color-neutral-600));--_connotation-color-faint: var(--vvd-tag-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-dim: var(--vvd-tag-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-contrast);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base.appearance-duotone{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-pale)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-contrast);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-duotone{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-contrast);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)).appearance-duotone{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-pale)}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled).appearance-duotone{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--vvd-color-neutral-100)}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-contrast);--_appearance-color-fill: var(--_connotation-color-pale);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)).appearance-duotone{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: var(--_connotation-color-pale)}.base{--tag-block-size: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;position:relative;display:inline-flex;box-sizing:border-box;align-items:center;background-color:var(--_appearance-color-fill);block-size:var(--tag-block-size);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);column-gap:8px;font:var(--vvd-typography-base-bold);max-inline-size:100%;padding-inline:8px;vertical-align:middle}.base:not(.shape-pill){border-radius:4px}.base.shape-pill{border-radius:16px}.base:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){cursor:pointer}.base.disabled{cursor:not-allowed;pointer-events:none}.base.removable{cursor:auto}.label{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis;white-space:nowrap}slot[name=icon]{font-size:calc(var(--tag-block-size) / 1.5);line-height:1}.dismiss-button{display:flex;align-items:center;border-radius:inherit;background-color:var(--_appearance-color-fill);cursor:pointer}";
|
|
7
|
+
const styles = ".base{display:flex;flex-wrap:wrap;gap:8px}";
|
|
81
8
|
|
|
82
|
-
|
|
83
|
-
connotation,
|
|
84
|
-
appearance,
|
|
85
|
-
shape,
|
|
86
|
-
disabled,
|
|
87
|
-
selectable,
|
|
88
|
-
removable,
|
|
89
|
-
selected
|
|
90
|
-
}) => classNames.classNames(
|
|
91
|
-
"base",
|
|
92
|
-
["disabled", disabled],
|
|
93
|
-
["selectable", selectable],
|
|
94
|
-
["selected", selectable && selected],
|
|
95
|
-
["removable", removable && !selectable],
|
|
96
|
-
[`connotation-${connotation}`, Boolean(connotation)],
|
|
97
|
-
[`appearance-${appearance}`, Boolean(appearance)],
|
|
98
|
-
[`shape-${shape}`, Boolean(shape)]
|
|
99
|
-
);
|
|
100
|
-
function renderDismissButton(iconTag) {
|
|
101
|
-
return vividElement.html`
|
|
102
|
-
<span
|
|
103
|
-
aria-hidden="true"
|
|
104
|
-
class="dismiss-button"
|
|
105
|
-
@click="${(x) => x.remove()}">
|
|
106
|
-
<${iconTag} name="close-line"></${iconTag}>
|
|
107
|
-
</span>`;
|
|
9
|
+
class TagGroup extends delegatesAria.DelegatesAria(vividElement.VividElement) {
|
|
108
10
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
11
|
+
|
|
12
|
+
const getClasses = (_) => classNames.classNames("base");
|
|
13
|
+
const TagGroupTemplate = vividElement.html`
|
|
14
|
+
<div
|
|
113
15
|
class="${getClasses}"
|
|
114
16
|
${delegatesAria.delegateAria({
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
})}
|
|
119
|
-
tabindex="${(x) => x.disabled ? null : 0}"
|
|
120
|
-
@keydown="${(x, c) => x.handleKeydown(c.event)}"
|
|
121
|
-
@click="${(x) => x.handleClick()}"
|
|
17
|
+
role: "listbox",
|
|
18
|
+
ariaOrientation: "horizontal"
|
|
19
|
+
})}
|
|
122
20
|
>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
(x) => vividElement.html`<span class="label">${x.label}</span>`
|
|
127
|
-
)}
|
|
128
|
-
${when.when((x) => x.removable && !x.selectable, renderDismissButton(iconTag))}
|
|
129
|
-
${when.when(
|
|
130
|
-
(x) => x.selectable && x.selected,
|
|
131
|
-
vividElement.html`<${iconTag} class="selectable-icon" name="check-circle-solid"></${iconTag}>`
|
|
132
|
-
)}
|
|
133
|
-
</span>`;
|
|
134
|
-
};
|
|
21
|
+
<slot></slot>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
135
24
|
|
|
136
|
-
const
|
|
137
|
-
"tag",
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
[
|
|
25
|
+
const tagGroupDefinition = vividElement.defineVividComponent(
|
|
26
|
+
"tag-group",
|
|
27
|
+
TagGroup,
|
|
28
|
+
TagGroupTemplate,
|
|
29
|
+
[],
|
|
141
30
|
{
|
|
142
|
-
styles
|
|
143
|
-
shadowOptions: {
|
|
144
|
-
delegatesFocus: true
|
|
145
|
-
}
|
|
31
|
+
styles
|
|
146
32
|
}
|
|
147
33
|
);
|
|
148
|
-
const
|
|
34
|
+
const registerTagGroup = vividElement.createRegisterFunction(tagGroupDefinition);
|
|
149
35
|
|
|
150
|
-
exports.
|
|
151
|
-
exports.
|
|
152
|
-
exports.
|
|
36
|
+
exports.TagGroup = TagGroup;
|
|
37
|
+
exports.registerTagGroup = registerTagGroup;
|
|
38
|
+
exports.tagGroupDefinition = tagGroupDefinition;
|