@editora/ui-core 0.2.1 → 0.3.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/dist/{ElementBase-DxbvhLJs.js → ElementBase-CbUsP3D6.js} +1 -1
- package/dist/{ElementBase-BeZT54Hj.mjs → ElementBase-D5QsC5Vw.mjs} +10 -1
- package/dist/ElementBase.d.ts +7 -0
- package/dist/ElementBase.d.ts.map +1 -1
- package/dist/accordion.cjs.js +1 -1
- package/dist/accordion.esm.js +1 -1
- package/dist/add-icons-CVeHOsWl.js +1 -0
- package/dist/add-icons-DBUZJ0g7.mjs +14 -0
- package/dist/add-icons.cjs.js +1 -0
- package/dist/add-icons.d.ts +16 -0
- package/dist/add-icons.d.ts.map +1 -0
- package/dist/add-icons.esm.js +4 -0
- package/dist/alert-dialog.cjs.js +24 -24
- package/dist/alert-dialog.esm.js +112 -107
- package/dist/alert.cjs.js +8 -8
- package/dist/alert.esm.js +22 -22
- package/dist/animated-beam.cjs.js +1 -1
- package/dist/animated-beam.esm.js +1 -1
- package/dist/animated-list.cjs.js +1 -1
- package/dist/animated-list.esm.js +1 -1
- package/dist/animated-text.cjs.js +1 -1
- package/dist/animated-text.esm.js +1 -1
- package/dist/app-header.cjs.js +15 -3
- package/dist/app-header.esm.js +31 -4
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +1 -1
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +1 -1
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +1 -1
- package/dist/block-controls.cjs.js +1 -1
- package/dist/block-controls.esm.js +1 -1
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +1 -1
- package/dist/breadcrumb.cjs.js +4 -4
- package/dist/breadcrumb.esm.js +93 -84
- package/dist/button.cjs.js +520 -1
- package/dist/button.esm.js +682 -2
- package/dist/{calendar-CzpWDxLc.js → calendar-BsVqtpjM.js} +6 -6
- package/dist/{calendar-DkSDFg33.mjs → calendar-CFafqZVA.mjs} +6 -6
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +6 -5
- package/dist/card.esm.js +52 -39
- package/dist/chart.cjs.js +2 -2
- package/dist/chart.esm.js +2 -2
- package/dist/checkbox.cjs.js +4 -4
- package/dist/checkbox.esm.js +36 -15
- package/dist/clone-source-BxK2pEVw.mjs +11 -0
- package/dist/clone-source-C7E_ri5f.js +1 -0
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +1 -1
- package/dist/color-picker.cjs.js +2 -2
- package/dist/color-picker.esm.js +3 -3
- package/dist/combobox.cjs.js +4 -4
- package/dist/combobox.esm.js +22 -19
- package/dist/command-palette.cjs.js +1 -1
- package/dist/command-palette.esm.js +1 -1
- package/dist/command.cjs.js +1 -1
- package/dist/command.esm.js +1 -1
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-alert.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts +1 -0
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-breadcrumb.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts +7 -0
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts +6 -0
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +1 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-empty-state.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-icon.d.ts +1 -0
- package/dist/components/ui-icon.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts +16 -0
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-layout.d.ts +20 -0
- package/dist/components/ui-layout.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts +1 -0
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts +6 -0
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts +6 -0
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-pagination.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts +11 -0
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-popover.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-radio-group.d.ts +6 -0
- package/dist/components/ui-radio-group.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts +7 -0
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-sidebar.d.ts +1 -0
- package/dist/components/ui-sidebar.d.ts.map +1 -1
- package/dist/components/ui-slider.d.ts +6 -0
- package/dist/components/ui-slider.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +1 -0
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts +6 -0
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts +2 -0
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts +6 -0
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-toast.d.ts.map +1 -1
- package/dist/components/ui-tooltip.d.ts.map +1 -1
- package/dist/container.cjs.js +1 -1
- package/dist/container.esm.js +1 -1
- package/dist/context-menu.cjs.js +2 -2
- package/dist/context-menu.esm.js +2 -2
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +1 -1
- package/dist/data-table.cjs.js +5 -5
- package/dist/data-table.esm.js +7 -7
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +3 -3
- package/dist/date-picker.cjs.js +2 -2
- package/dist/date-picker.esm.js +17 -17
- package/dist/date-range-picker.cjs.js +2 -2
- package/dist/date-range-picker.esm.js +4 -4
- package/dist/date-range-time-picker.cjs.js +3 -3
- package/dist/date-range-time-picker.esm.js +16 -16
- package/dist/date-time-picker.cjs.js +26 -23
- package/dist/date-time-picker.esm.js +49 -46
- package/dist/{date-time-utils-zAx4ghvC.mjs → date-time-utils-CJUksWj3.mjs} +1 -1
- package/dist/{date-time-utils-C-4eHTyy.js → date-time-utils-D3hQQ5Om.js} +1 -1
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +1 -1
- package/dist/dialog.cjs.js +7 -7
- package/dist/dialog.esm.js +51 -47
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +1 -1
- package/dist/dismissable-layer.cjs.js +1 -1
- package/dist/dismissable-layer.esm.js +1 -1
- package/dist/dock.cjs.js +1 -1
- package/dist/dock.esm.js +1 -1
- package/dist/drawer.cjs.js +5 -5
- package/dist/drawer.esm.js +18 -17
- package/dist/dropdown.cjs.js +7 -7
- package/dist/dropdown.esm.js +39 -38
- package/dist/empty-state.cjs.js +12 -2
- package/dist/empty-state.esm.js +17 -7
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +1 -1
- package/dist/field.cjs.js +2 -2
- package/dist/field.esm.js +2 -2
- package/dist/fieldset.cjs.js +1 -1
- package/dist/fieldset.esm.js +1 -1
- package/dist/file-upload.cjs.js +1 -1
- package/dist/file-upload.esm.js +1 -1
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +1 -1
- package/dist/floating-toolbar.cjs.js +2 -2
- package/dist/floating-toolbar.esm.js +2 -2
- package/dist/focus-scope-Dl0qk5GP.mjs +177 -0
- package/dist/focus-scope-Doz0bnE1.js +1 -0
- package/dist/focus-scope.cjs.js +1 -1
- package/dist/focus-scope.esm.js +2 -2
- package/dist/form-control-B90_3kYN.js +1 -0
- package/dist/form-control-D9wWUMBl.mjs +86 -0
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +2 -2
- package/dist/gantt.cjs.js +2 -2
- package/dist/gantt.esm.js +2 -2
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +1 -1
- package/dist/hover-card.cjs.js +5 -5
- package/dist/hover-card.esm.js +19 -18
- package/dist/icon-cloud.cjs.js +1 -1
- package/dist/icon-cloud.esm.js +1 -1
- package/dist/icon.cjs.js +207 -1
- package/dist/icon.esm.js +294 -2
- package/dist/icons-CpCpPXV5.js +1 -0
- package/dist/icons-DWYbbhb0.mjs +115 -0
- package/dist/icons.d.ts +11 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/implicit-submit-B6M5Uc56.js +1 -0
- package/dist/implicit-submit-Lr0-q2LR.mjs +44 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +309 -299
- package/dist/inline-edit.cjs.js +1 -1
- package/dist/inline-edit.esm.js +1 -1
- package/dist/input.cjs.js +62 -20
- package/dist/input.esm.js +164 -58
- package/dist/label.cjs.js +1 -1
- package/dist/label.esm.js +1 -1
- package/dist/layout.cjs.js +145 -4
- package/dist/layout.esm.js +278 -40
- package/dist/marquee.cjs.js +1 -1
- package/dist/marquee.esm.js +1 -1
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +1 -1
- package/dist/menu.cjs.js +8 -8
- package/dist/menu.esm.js +51 -47
- package/dist/menubar.cjs.js +9 -9
- package/dist/menubar.esm.js +41 -40
- package/dist/meter.cjs.js +1 -1
- package/dist/meter.esm.js +1 -1
- package/dist/multi-select.cjs.js +7 -7
- package/dist/multi-select.esm.js +55 -34
- package/dist/navigate-CXebafwF.mjs +18 -0
- package/dist/navigate-ChJVIIuS.js +1 -0
- package/dist/navigation-menu.cjs.js +1 -1
- package/dist/navigation-menu.esm.js +1 -1
- package/dist/number-attribute-BAF07JrU.mjs +8 -0
- package/dist/number-attribute-C4Rrl7d3.js +1 -0
- package/dist/number-field.cjs.js +8 -8
- package/dist/number-field.esm.js +90 -69
- package/dist/number-ticker.cjs.js +1 -1
- package/dist/number-ticker.esm.js +1 -1
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +1 -1
- package/dist/orbiter.cjs.js +1 -1
- package/dist/orbiter.esm.js +1 -1
- package/dist/pagination.cjs.js +24 -23
- package/dist/pagination.esm.js +61 -46
- package/dist/{panel-group-BVHJEdfx.js → panel-group-BIzzpQ5i.js} +1 -1
- package/dist/{panel-group-BxO_eNW6.mjs → panel-group-CFLjzRWI.mjs} +1 -1
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +1 -1
- package/dist/panel.cjs.js +1 -1
- package/dist/panel.esm.js +1 -1
- package/dist/password-field.cjs.js +36 -16
- package/dist/password-field.esm.js +113 -44
- package/dist/pin-input.cjs.js +1 -1
- package/dist/pin-input.esm.js +1 -1
- package/dist/placement-grid.cjs.js +1 -1
- package/dist/placement-grid.esm.js +1 -1
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +28 -26
- package/dist/portal.cjs.js +1 -1
- package/dist/portal.esm.js +1 -1
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +35 -38
- package/dist/preload.cjs.js +221 -0
- package/dist/preload.css +220 -0
- package/dist/preload.d.ts +17 -0
- package/dist/preload.d.ts.map +1 -0
- package/dist/preload.esm.js +224 -0
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +1 -1
- package/dist/primitives/clone-source.d.ts +3 -0
- package/dist/primitives/clone-source.d.ts.map +1 -0
- package/dist/primitives/focus-scope.d.ts +6 -0
- package/dist/primitives/focus-scope.d.ts.map +1 -1
- package/dist/primitives/form-control.d.ts +68 -0
- package/dist/primitives/form-control.d.ts.map +1 -0
- package/dist/primitives/implicit-submit.d.ts +17 -0
- package/dist/primitives/implicit-submit.d.ts.map +1 -0
- package/dist/primitives/navigate.d.ts +27 -0
- package/dist/primitives/navigate.d.ts.map +1 -0
- package/dist/primitives/number-attribute.d.ts +7 -0
- package/dist/primitives/number-attribute.d.ts.map +1 -0
- package/dist/primitives/slotted-input.d.ts +19 -0
- package/dist/primitives/slotted-input.d.ts.map +1 -0
- package/dist/progress.cjs.js +3 -3
- package/dist/progress.esm.js +3 -3
- package/dist/quick-actions.cjs.js +5 -5
- package/dist/quick-actions.esm.js +3 -3
- package/dist/radio-group.cjs.js +9 -9
- package/dist/radio-group.esm.js +47 -24
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +1 -1
- package/dist/rating.cjs.js +6 -6
- package/dist/rating.esm.js +21 -10
- package/dist/{runtime-BRT7E4A8.mjs → runtime-CORXjP7e.mjs} +379 -357
- package/dist/runtime-uCly3ECd.js +5 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +1 -1
- package/dist/scroll-area.cjs.js +1 -1
- package/dist/scroll-area.esm.js +1 -1
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +21 -21
- package/dist/select.esm.js +111 -71
- package/dist/selection-popup.cjs.js +2 -2
- package/dist/selection-popup.esm.js +2 -2
- package/dist/semantic-tokens.d.ts.map +1 -1
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +15 -15
- package/dist/sidebar.esm.js +48 -42
- package/dist/skeleton.cjs.js +1 -1
- package/dist/skeleton.esm.js +1 -1
- package/dist/slider.cjs.js +11 -11
- package/dist/slider.esm.js +40 -23
- package/dist/slot.cjs.js +1 -1
- package/dist/slot.esm.js +1 -1
- package/dist/slotted-input-BVq2QQg2.js +1 -0
- package/dist/slotted-input-atWznLfm.mjs +13 -0
- package/dist/sortable.cjs.js +25 -25
- package/dist/sortable.esm.js +29 -21
- package/dist/spinning-text.cjs.js +1 -1
- package/dist/spinning-text.esm.js +1 -1
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +1 -1
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/standalone/add-icons.d.ts +2 -0
- package/dist/standalone/add-icons.d.ts.map +1 -0
- package/dist/standalone/preload.d.ts +2 -0
- package/dist/standalone/preload.d.ts.map +1 -0
- package/dist/stepper.cjs.js +3 -3
- package/dist/stepper.esm.js +3 -3
- package/dist/switch.cjs.js +9 -9
- package/dist/switch.esm.js +56 -35
- package/dist/table.cjs.js +1 -1
- package/dist/table.esm.js +1 -1
- package/dist/tabs.cjs.js +14 -14
- package/dist/tabs.esm.js +129 -115
- package/dist/tags-input.cjs.js +1 -1
- package/dist/tags-input.esm.js +1 -1
- package/dist/textarea.cjs.js +33 -11
- package/dist/textarea.esm.js +74 -35
- package/dist/theme.d.ts +6 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +2 -2
- package/dist/time-picker.cjs.js +1 -1
- package/dist/time-picker.esm.js +3 -3
- package/dist/timeline.cjs.js +2 -2
- package/dist/timeline.esm.js +2 -2
- package/dist/toast.cjs.js +4 -4
- package/dist/toast.esm.js +17 -16
- package/dist/toggle-group.cjs.js +1 -1
- package/dist/toggle-group.esm.js +1 -1
- package/dist/toggle.cjs.js +3 -3
- package/dist/toggle.esm.js +9 -9
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +1 -1
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +12 -14
- package/dist/transfer-list.cjs.js +1 -1
- package/dist/transfer-list.esm.js +1 -1
- package/dist/{tree-33fVNnaf.mjs → tree-CD2k2lIC.mjs} +1 -1
- package/dist/{tree-Dc02MChE.js → tree-ChQfhxya.js} +1 -1
- package/dist/tree-item.cjs.js +1 -1
- package/dist/tree-item.esm.js +1 -1
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +4 -4
- package/dist/wizard.esm.js +4 -4
- package/package.json +3 -2
- package/dist/focus-scope-Bwug2gDv.js +0 -1
- package/dist/focus-scope-CmEsG5UZ.mjs +0 -138
- package/dist/runtime-CXw4SGV9.js +0 -5
- package/dist/ui-button-C3OmI7Sn.mjs +0 -684
- package/dist/ui-button-CnLwXBnx.js +0 -520
- package/dist/ui-icon-D3avtxX_.js +0 -207
- package/dist/ui-icon-DLhB08Fo.mjs +0 -361
package/dist/tabs.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("./ElementBase-CbUsP3D6.js"),_=require("./navigate-ChJVIIuS.js"),d=require("./roving-focus-group-BdJ_4Njm.js"),w=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-tabs-nav-bg: var(--ui-color-surface, #ffffff);
|
|
4
4
|
--ui-tabs-panel-bg: var(--ui-color-surface, #ffffff);
|
|
@@ -497,10 +497,10 @@
|
|
|
497
497
|
--ui-tabs-muted: #94a3b8;
|
|
498
498
|
--ui-tabs-accent: var(--ui-tabs-active-bg, #93c5fd);
|
|
499
499
|
--ui-tabs-active-text: #dbeafe;
|
|
500
|
-
--ui-tabs-focus: #93c5fd;
|
|
501
|
-
--ui-tabs-indicator-bg: color-mix(in srgb, #93c5fd 24%, transparent);
|
|
502
|
-
--ui-tabs-indicator-border: color-mix(in srgb, #93c5fd 46%, transparent);
|
|
503
|
-
--ui-tabs-indicator-shadow: 0 0 0 1px
|
|
500
|
+
--ui-tabs-focus: var(--ui-color-accent-on-dark, #93c5fd);
|
|
501
|
+
--ui-tabs-indicator-bg: color-mix(in srgb, var(--ui-color-accent-on-dark, #93c5fd) 24%, transparent);
|
|
502
|
+
--ui-tabs-indicator-border: color-mix(in srgb, var(--ui-color-accent-on-dark, #93c5fd) 46%, transparent);
|
|
503
|
+
--ui-tabs-indicator-shadow: 0 0 0 1px color-mix(in srgb, var(--ui-color-accent-on-dark, #93c5fd) 24%, transparent);
|
|
504
504
|
--ui-tabs-shadow: 0 16px 34px rgba(2, 6, 23, 0.42), 0 32px 54px rgba(2, 6, 23, 0.4);
|
|
505
505
|
}
|
|
506
506
|
|
|
@@ -558,7 +558,7 @@
|
|
|
558
558
|
border-color: Highlight;
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
`,f="data-ui-tabs-auto-label";function p(v){return String(v).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function g(v){if(v==null)return!1;const t=String(v).toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}const w=new Set(["aria-label","aria-labelledby","orientation","activation","headless","variant","size","density","tone","stretched","shape","elevation","bare"]);class x extends y.ElementBase{constructor(){super(),this._uid=`ui-tabs-${Math.random().toString(36).slice(2,9)}`,this._observer=null,this._resizeObserver=null,this._isSyncing=!1,this._isSyncingSelectionAttributes=!1,this._focusIndex=-1,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onWindowResize=this._onWindowResize.bind(this)}static get observedAttributes(){return["selected","value","orientation","activation","headless","variant","size","density","tone","stretched","shape","elevation","loop","bare","aria-label","aria-labelledby"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this._observer=new MutationObserver(()=>{this._isSyncing||this.requestRender()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["slot","data-label","data-value","data-icon","data-disabled","disabled","data-active"]}),typeof ResizeObserver<"u"?(this._resizeObserver=new ResizeObserver(()=>this._syncSelectionUi()),this._resizeObserver.observe(this)):window.addEventListener("resize",this._onWindowResize),this._syncSelectionUi()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this._observer&&(this._observer.disconnect(),this._observer=null),this._resizeObserver?(this._resizeObserver.disconnect(),this._resizeObserver=null):window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}attributeChangedCallback(t,e,r){if(e!==r){if(t==="selected"||t==="value"){this._isSyncingSelectionAttributes||this._syncSelectionUi();return}w.has(t)&&this.isConnected&&this.requestRender()}}get selected(){return this.getAttribute("selected")||"0"}set selected(t){const e=String(t);e?this.setAttribute("selected",e):this.removeAttribute("selected")}_sourceTabs(){return Array.from(this.querySelectorAll('[slot="tab"]'))}_sourcePanels(){return Array.from(this.querySelectorAll('[slot="panel"]'))}_tabsModel(){return this._sourceTabs().map((t,e)=>{const r=t.getAttribute("data-value")||t.getAttribute("value")||String(e),a=t.getAttribute("data-label")||t.textContent?.trim()||`Tab ${e+1}`,i=t.getAttribute("data-icon")||"",s=t.hasAttribute("disabled")||g(t.getAttribute("data-disabled")),l=`${this._uid}-tab-${e}`,c=`${this._uid}-panel-${e}`;return{index:e,value:r,label:a,icon:i,disabled:s,tabId:l,panelId:c}})}_resolveSelectedIndex(t){if(!t.length)return-1;const e=this.getAttribute("selected"),r=this.getAttribute("value"),a=this._sourceTabs();let i=-1;if(e!=null&&e!==""){const s=Number(e);Number.isFinite(s)?i=Math.trunc(s):i=t.findIndex(l=>l.value===e)}return i<0&&r&&(i=t.findIndex(s=>s.value===r)),i<0&&(i=t.findIndex((s,l)=>!!a[l]?.hasAttribute("data-active")&&!s.disabled)),(i<0||!t[i]||t[i].disabled)&&(i=t.findIndex(s=>!s.disabled)),i}_syncSelectedAttributes(t,e){const r=t[e];this._isSyncingSelectionAttributes=!0;try{if(!r){this.removeAttribute("selected"),this.removeAttribute("value");return}this.getAttribute("selected")!==String(e)&&this.setAttribute("selected",String(e)),this.getAttribute("value")!==r.value&&this.setAttribute("value",r.value)}finally{this._isSyncingSelectionAttributes=!1}}_emit(t,e,r){const a=e[r];if(!a)return;const i={selected:r,index:r,value:a.value,label:a.label,tabId:a.tabId,panelId:a.panelId};this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}_setSelectedByIndex(t,e,r){const a=t[e];if(!a||a.disabled)return;if(this._resolveSelectedIndex(t)===e){this._focusTab(e);return}this._focusIndex=e,this.setAttribute("selected",String(e)),this.setAttribute("value",a.value),r&&(this._emit("change",t,e),this._emit("select",t,e))}_syncSelectionUi(){if(!this.isConnected)return;if(!this.root.querySelector(".nav")){this.requestRender();return}const t=this._tabsModel();if(!t.length)return;const e=this._resolveSelectedIndex(t),r=this._resolveFocusIndex(t,e);this._syncSelectedAttributes(t,e);const a=Array.from(this.root.querySelectorAll(".tab"));a.forEach((s,l)=>{const c=t[l];if(!c)return;const n=l===e;s.setAttribute("aria-selected",n?"true":"false"),s.setAttribute("aria-disabled",c.disabled?"true":"false"),c.disabled?s.setAttribute("disabled",""):s.removeAttribute("disabled")}),d.syncRovingTabStops(a,a[r]||null,{activeAttribute:null});const i=t[e];this._syncIndicator(e),this._clearCrossRootReferences(),i&&this._scrollSelectedTabIntoView(e),this._syncPanels(t,e)}_syncIndicator(t){const e=this.root.querySelector(".nav");if(!e)return;const r=this.getAttribute("variant")||"default",a=r==="indicator";if(!a&&!(r==="indicator-line")){e.removeAttribute("data-indicator-ready"),e.style.removeProperty("--ui-tabs-indicator-x"),e.style.removeProperty("--ui-tabs-indicator-y"),e.style.removeProperty("--ui-tabs-indicator-w"),e.style.removeProperty("--ui-tabs-indicator-h");return}const s=this.root.querySelector(`.tab[data-index="${t}"]`);if(!s){e.removeAttribute("data-indicator-ready");return}const l=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal",c=getComputedStyle(this).direction==="rtl";let n=s.offsetLeft,u=s.offsetTop,o=s.offsetWidth,b=s.offsetHeight;a?(n+=2,u+=2,o=Math.max(0,o-4),b=Math.max(0,b-4)):l==="vertical"?(u+=5,b=Math.max(8,b-10),o=3,n+=c?s.offsetWidth-3-2:2):(n+=8,o=Math.max(12,o-16),b=2,u+=s.offsetHeight-2-2),e.style.setProperty("--ui-tabs-indicator-x",`${n}px`),e.style.setProperty("--ui-tabs-indicator-y",`${u}px`),e.style.setProperty("--ui-tabs-indicator-w",`${o}px`),e.style.setProperty("--ui-tabs-indicator-h",`${b}px`),e.setAttribute("data-indicator-ready","true")}_clearCrossRootReferences(){this.removeAttribute("aria-activedescendant"),this.removeAttribute("aria-controls")}_syncPanels(t,e){const r=this._sourcePanels(),a=this.root.querySelector(".panel-wrap");a&&(r.length?a.removeAttribute("hidden"):a.setAttribute("hidden","")),this._isSyncing=!0;try{r.forEach((i,s)=>{const l=t[s],c=s===e;i.id=l?.panelId||`${this._uid}-panel-${s}`,i.setAttribute("role","tabpanel"),i.setAttribute("tabindex",c?"0":"-1"),i.setAttribute("aria-hidden",c?"false":"true"),l&&(i.getAttribute("aria-labelledby")===l.tabId&&i.removeAttribute("aria-labelledby"),i.hasAttribute("aria-labelledby")||i.hasAttribute("aria-label")&&!i.hasAttribute(f)||(i.setAttribute("aria-label",l.label),i.setAttribute(f,""))),c?i.removeAttribute("hidden"):i.setAttribute("hidden","")})}finally{this._isSyncing=!1}}_enabledIndices(t){return t.filter(e=>!e.disabled).map(e=>e.index)}_resolveFocusIndex(t,e){const r=d.resolveRovingFocusIndex(t,{activeIndex:this._focusIndex,selectedIndex:e,getDisabled:a=>a.disabled});return this._focusIndex=r,r}_onWindowResize(){this._syncSelectionUi()}_focusTab(t){this._focusIndex=t;const e=this.root.querySelector(`.tab[data-index="${t}"]`),r=Array.from(this.root.querySelectorAll(".tab"));d.syncRovingTabStops(r,e,{activeAttribute:null}),d.focusRovingItem(e)}_scrollSelectedTabIntoView(t){const e=this.root.querySelector(".nav"),r=this.root.querySelector(`.tab[data-index="${t}"]`);if(!e||!r)return;const a=this.getAttribute("orientation")!=="vertical",i=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;typeof r.scrollIntoView=="function"&&r.scrollIntoView({behavior:i?"auto":"smooth",block:"nearest",inline:a?"center":"nearest"})}_onClick(t){const r=t.target?.closest(".tab");if(!r||r.disabled)return;const a=Number(r.getAttribute("data-index"));if(!Number.isFinite(a))return;const i=this._tabsModel();this._setSelectedByIndex(i,a,!0)}_onKeyDown(t){const r=t.target?.closest(".tab");if(!r)return;const a=this._tabsModel();if(!a.length)return;const i=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal",s=this.getAttribute("activation")==="manual"?"manual":"auto",l=!this.hasAttribute("loop")||g(this.getAttribute("loop")),c=getComputedStyle(this).direction==="rtl",n=Number(r.getAttribute("data-index"));if(!Number.isFinite(n))return;const u=o=>{const b=d.moveRovingFocusIndex(a,n,o,{wrap:l,fallbackIndex:this._resolveFocusIndex(a,this._resolveSelectedIndex(a)),getDisabled:h=>h.disabled});b!=null&&(this._focusTab(b),s==="auto"?this._setSelectedByIndex(a,b,!0):this._emit("focus",a,b))};if(i==="horizontal"&&(t.key==="ArrowRight"&&!c||t.key==="ArrowLeft"&&c)||i==="vertical"&&t.key==="ArrowDown"){t.preventDefault(),u(1);return}if(i==="horizontal"&&(t.key==="ArrowLeft"&&!c||t.key==="ArrowRight"&&c)||i==="vertical"&&t.key==="ArrowUp"){t.preventDefault(),u(-1);return}if(t.key==="Home"){t.preventDefault();const o=d.getRovingFocusBoundaryIndex(a,"first",b=>b.disabled);if(o<0)return;this._focusTab(o),s==="auto"?this._setSelectedByIndex(a,o,!0):this._emit("focus",a,o);return}if(t.key==="End"){t.preventDefault();const o=d.getRovingFocusBoundaryIndex(a,"last",b=>b.disabled);if(o<0)return;this._focusTab(o),s==="auto"?this._setSelectedByIndex(a,o,!0):this._emit("focus",a,o);return}(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._setSelectedByIndex(a,n,!0))}render(){const t=this._tabsModel(),e=this._resolveSelectedIndex(t),r=this._resolveFocusIndex(t,e);this._syncSelectedAttributes(t,e);const a=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal",i=(this.getAttribute("aria-label")||"").trim(),s=(this.getAttribute("aria-labelledby")||"").trim(),l=(i?` aria-label="${p(i)}"`:"")+(s?` aria-labelledby="${p(s)}"`:""),c=t.map(n=>{const u=n.index===e,o=n.icon?`<span class="tab-icon" aria-hidden="true">${p(n.icon)}</span>`:"";return`
|
|
561
|
+
`,p="data-ui-tabs-auto-label";function f(h){return String(h).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function g(h){if(h==null)return!1;const t=String(h).toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}const A=new Set(["aria-label","aria-labelledby","orientation","activation","headless","variant","size","density","tone","stretched","shape","elevation","bare"]);class x extends y.ElementBase{constructor(){super(),this._uid=`ui-tabs-${Math.random().toString(36).slice(2,9)}`,this._observer=null,this._resizeObserver=null,this._isSyncing=!1,this._isSyncingSelectionAttributes=!1,this._focusIndex=-1,this._renderedSignature=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onWindowResize=this._onWindowResize.bind(this)}static get observedAttributes(){return["selected","value","orientation","activation","headless","variant","size","density","tone","stretched","shape","elevation","loop","bare","aria-label","aria-labelledby"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this._observer=new MutationObserver(()=>{if(!this._isSyncing){if(this._renderedSignature!=null&&this._modelSignature(this._tabsModel())===this._renderedSignature){this._syncSelectionUi();return}this.requestRender()}}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["slot","data-label","data-value","data-icon","data-disabled","disabled","data-active","data-href"]}),typeof ResizeObserver<"u"?(this._resizeObserver=new ResizeObserver(()=>this._syncSelectionUi()),this._resizeObserver.observe(this)):window.addEventListener("resize",this._onWindowResize),this._syncSelectionUi()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this._observer&&(this._observer.disconnect(),this._observer=null),this._resizeObserver?(this._resizeObserver.disconnect(),this._resizeObserver=null):window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}attributeChangedCallback(t,e,r){if(e!==r){if(t==="selected"||t==="value"){this._isSyncingSelectionAttributes||this._syncSelectionUi();return}A.has(t)&&this.isConnected&&this.requestRender()}}get selected(){return this.getAttribute("selected")||"0"}set selected(t){const e=String(t);e?this.setAttribute("selected",e):this.removeAttribute("selected")}_sourceTabs(){return Array.from(this.children).filter(t=>t.getAttribute("slot")==="tab")}_sourcePanels(){return Array.from(this.children).filter(t=>t.getAttribute("slot")==="panel")}_modelSignature(t){return JSON.stringify(t.map(e=>[e.value,e.label,e.icon,e.disabled]))}_tabsModel(){return this._sourceTabs().map((t,e)=>{const r=t.getAttribute("data-value")||t.getAttribute("value")||String(e),a=t.getAttribute("data-label")||t.textContent?.trim()||`Tab ${e+1}`,i=t.getAttribute("data-icon")||"",s=t.hasAttribute("disabled")||g(t.getAttribute("data-disabled")),o=`${this._uid}-tab-${e}`,c=`${this._uid}-panel-${e}`,b=t.getAttribute("data-href")||t.getAttribute("href")||"";return{index:e,value:r,label:a,icon:i,disabled:s,tabId:o,panelId:c,href:b}})}_resolveSelectedIndex(t){if(!t.length)return-1;const e=this.getAttribute("selected"),r=this.getAttribute("value"),a=this._sourceTabs();let i=-1;if(e!=null&&e!==""){const s=Number(e);Number.isFinite(s)?i=Math.trunc(s):i=t.findIndex(o=>o.value===e)}return i<0&&r&&(i=t.findIndex(s=>s.value===r)),i<0&&(i=t.findIndex((s,o)=>!!a[o]?.hasAttribute("data-active")&&!s.disabled)),(i<0||!t[i]||t[i].disabled)&&(i=t.findIndex(s=>!s.disabled)),i}_syncSelectedAttributes(t,e){const r=t[e];this._isSyncingSelectionAttributes=!0;try{if(!r){this.removeAttribute("selected"),this.removeAttribute("value");return}this.getAttribute("selected")!==String(e)&&this.setAttribute("selected",String(e)),this.getAttribute("value")!==r.value&&this.setAttribute("value",r.value)}finally{this._isSyncingSelectionAttributes=!1}}_emit(t,e,r){const a=e[r];if(!a)return;const i={selected:r,index:r,value:a.value,label:a.label,tabId:a.tabId,panelId:a.panelId};this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}_setSelectedByIndex(t,e,r){const a=t[e];if(!a||a.disabled)return;if(this._resolveSelectedIndex(t)===e){this._focusTab(e);return}this._focusIndex=e,this.setAttribute("selected",String(e)),this.setAttribute("value",a.value),r&&(this._emit("change",t,e),this._emit("select",t,e),a.href&&_.navigateTo(this,{href:a.href,index:e,value:a.value,label:a.label}))}_syncSelectionUi(){if(!this.isConnected)return;if(!this.root.querySelector(".nav")){this.requestRender();return}const t=this._tabsModel();if(!t.length)return;const e=this._resolveSelectedIndex(t),r=this._resolveFocusIndex(t,e);this._syncSelectedAttributes(t,e);const a=Array.from(this.root.querySelectorAll(".tab"));a.forEach((s,o)=>{const c=t[o];if(!c)return;const b=o===e;s.setAttribute("aria-selected",b?"true":"false"),s.setAttribute("aria-disabled",c.disabled?"true":"false"),c.disabled?s.setAttribute("disabled",""):s.removeAttribute("disabled")}),d.syncRovingTabStops(a,a[r]||null,{activeAttribute:null});const i=t[e];this._syncIndicator(e),this._clearCrossRootReferences(),i&&this._scrollSelectedTabIntoView(e),this._syncPanels(t,e)}_syncIndicator(t){const e=this.root.querySelector(".nav");if(!e)return;const r=this.getAttribute("variant")||"default",a=r==="indicator";if(!a&&!(r==="indicator-line")){e.removeAttribute("data-indicator-ready"),e.style.removeProperty("--ui-tabs-indicator-x"),e.style.removeProperty("--ui-tabs-indicator-y"),e.style.removeProperty("--ui-tabs-indicator-w"),e.style.removeProperty("--ui-tabs-indicator-h");return}const s=this.root.querySelector(`.tab[data-index="${t}"]`);if(!s){e.removeAttribute("data-indicator-ready");return}const o=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal",c=getComputedStyle(this).direction==="rtl";let b=s.offsetLeft,u=s.offsetTop,n=s.offsetWidth,l=s.offsetHeight;a?(b+=2,u+=2,n=Math.max(0,n-4),l=Math.max(0,l-4)):o==="vertical"?(u+=5,l=Math.max(8,l-10),n=3,b+=c?s.offsetWidth-3-2:2):(b+=8,n=Math.max(12,n-16),l=2,u+=s.offsetHeight-2-2),e.style.setProperty("--ui-tabs-indicator-x",`${b}px`),e.style.setProperty("--ui-tabs-indicator-y",`${u}px`),e.style.setProperty("--ui-tabs-indicator-w",`${n}px`),e.style.setProperty("--ui-tabs-indicator-h",`${l}px`),e.setAttribute("data-indicator-ready","true")}_clearCrossRootReferences(){this.removeAttribute("aria-activedescendant"),this.removeAttribute("aria-controls")}_syncPanels(t,e){const r=this._sourcePanels(),a=this.root.querySelector(".panel-wrap");a&&(r.length?a.removeAttribute("hidden"):a.setAttribute("hidden","")),this._isSyncing=!0;try{r.forEach((i,s)=>{const o=t[s],c=s===e;(!i.id||i.id.startsWith(`${this._uid}-panel-`))&&(i.id=o?.panelId||`${this._uid}-panel-${s}`),i.setAttribute("role","tabpanel"),i.setAttribute("tabindex",c?"0":"-1"),i.setAttribute("aria-hidden",c?"false":"true"),o&&(i.getAttribute("aria-labelledby")===o.tabId&&i.removeAttribute("aria-labelledby"),i.hasAttribute("aria-labelledby")||i.hasAttribute("aria-label")&&!i.hasAttribute(p)||(i.setAttribute("aria-label",o.label),i.setAttribute(p,""))),c?i.removeAttribute("hidden"):i.setAttribute("hidden","")})}finally{this._isSyncing=!1}}_enabledIndices(t){return t.filter(e=>!e.disabled).map(e=>e.index)}_resolveFocusIndex(t,e){const r=d.resolveRovingFocusIndex(t,{activeIndex:this._focusIndex,selectedIndex:e,getDisabled:a=>a.disabled});return this._focusIndex=r,r}_onWindowResize(){this._syncSelectionUi()}_focusTab(t){this._focusIndex=t;const e=this.root.querySelector(`.tab[data-index="${t}"]`),r=Array.from(this.root.querySelectorAll(".tab"));d.syncRovingTabStops(r,e,{activeAttribute:null}),d.focusRovingItem(e)}_scrollSelectedTabIntoView(t){const e=this.root.querySelector(".nav"),r=this.root.querySelector(`.tab[data-index="${t}"]`);if(!e||!r)return;const a=this.getAttribute("orientation")!=="vertical",i=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;typeof r.scrollIntoView=="function"&&r.scrollIntoView({behavior:i?"auto":"smooth",block:"nearest",inline:a?"center":"nearest"})}_onClick(t){const r=t.target?.closest(".tab");if(!r||r.disabled)return;const a=Number(r.getAttribute("data-index"));if(!Number.isFinite(a))return;const i=this._tabsModel();this._setSelectedByIndex(i,a,!0)}_onKeyDown(t){const r=t.target?.closest(".tab");if(!r)return;const a=this._tabsModel();if(!a.length)return;const i=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal",s=this.getAttribute("activation")==="manual"?"manual":"auto",o=!this.hasAttribute("loop")||g(this.getAttribute("loop")),c=getComputedStyle(this).direction==="rtl",b=Number(r.getAttribute("data-index"));if(!Number.isFinite(b))return;const u=n=>{const l=d.moveRovingFocusIndex(a,b,n,{wrap:o,fallbackIndex:this._resolveFocusIndex(a,this._resolveSelectedIndex(a)),getDisabled:v=>v.disabled});l!=null&&(this._focusTab(l),s==="auto"?this._setSelectedByIndex(a,l,!0):this._emit("focus",a,l))};if(i==="horizontal"&&(t.key==="ArrowRight"&&!c||t.key==="ArrowLeft"&&c)||i==="vertical"&&t.key==="ArrowDown"){t.preventDefault(),u(1);return}if(i==="horizontal"&&(t.key==="ArrowLeft"&&!c||t.key==="ArrowRight"&&c)||i==="vertical"&&t.key==="ArrowUp"){t.preventDefault(),u(-1);return}if(t.key==="Home"){t.preventDefault();const n=d.getRovingFocusBoundaryIndex(a,"first",l=>l.disabled);if(n<0)return;this._focusTab(n),s==="auto"?this._setSelectedByIndex(a,n,!0):this._emit("focus",a,n);return}if(t.key==="End"){t.preventDefault();const n=d.getRovingFocusBoundaryIndex(a,"last",l=>l.disabled);if(n<0)return;this._focusTab(n),s==="auto"?this._setSelectedByIndex(a,n,!0):this._emit("focus",a,n);return}(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._setSelectedByIndex(a,b,!0))}render(){const t=this._tabsModel(),r=!!this.root.activeElement?.classList?.contains("tab");this._renderedSignature=this._modelSignature(t);const a=this._resolveSelectedIndex(t),i=this._resolveFocusIndex(t,a);this._syncSelectedAttributes(t,a);const s=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal",o=(this.getAttribute("aria-label")||"").trim(),c=(this.getAttribute("aria-labelledby")||"").trim(),b=(o?` aria-label="${f(o)}"`:"")+(c?` aria-labelledby="${f(c)}"`:""),u=t.map(n=>{const l=n.index===a,v=n.icon?`<span class="tab-icon" aria-hidden="true">${f(n.icon)}</span>`:"";return`
|
|
562
562
|
<button
|
|
563
563
|
type="button"
|
|
564
564
|
class="tab"
|
|
@@ -566,24 +566,24 @@
|
|
|
566
566
|
id="${n.tabId}"
|
|
567
567
|
role="tab"
|
|
568
568
|
data-index="${n.index}"
|
|
569
|
-
aria-selected="${
|
|
569
|
+
aria-selected="${l?"true":"false"}"
|
|
570
570
|
aria-disabled="${n.disabled?"true":"false"}"
|
|
571
|
-
tabindex="${n.index===
|
|
571
|
+
tabindex="${n.index===i&&!n.disabled?"0":"-1"}"
|
|
572
572
|
${n.disabled?"disabled":""}
|
|
573
573
|
>
|
|
574
|
-
${
|
|
575
|
-
<span class="tab-label">${
|
|
574
|
+
${v}
|
|
575
|
+
<span class="tab-label">${f(n.label)}</span>
|
|
576
576
|
</button>
|
|
577
577
|
`}).join("");this.setContent(`
|
|
578
|
-
<style>${
|
|
578
|
+
<style>${w}</style>
|
|
579
579
|
<section class="shell" part="shell">
|
|
580
|
-
<div class="nav" role="tablist" aria-orientation="${
|
|
580
|
+
<div class="nav" role="tablist" aria-orientation="${s}"${b} part="nav">
|
|
581
581
|
<span class="indicator" part="indicator" aria-hidden="true"></span>
|
|
582
|
-
${
|
|
582
|
+
${u}
|
|
583
583
|
</div>
|
|
584
584
|
<div class="panel-wrap" part="panel-wrap" aria-live="polite">
|
|
585
585
|
<slot name="panel"></slot>
|
|
586
586
|
</div>
|
|
587
587
|
</section>
|
|
588
588
|
<slot class="source-tabs" name="tab"></slot>
|
|
589
|
-
`),this._clearCrossRootReferences(),this._syncIndicator(
|
|
589
|
+
`),this._clearCrossRootReferences(),this._syncIndicator(a),this._syncPanels(t,a),r&&this.root.querySelector(`.tab[data-index="${i}"]`)?.focus({preventScroll:!0})}}typeof customElements<"u"&&!customElements.get("ui-tabs")&&customElements.define("ui-tabs",x);exports.UITabs=x;
|
package/dist/tabs.esm.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { E as y } from "./ElementBase-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { E as y } from "./ElementBase-D5QsC5Vw.mjs";
|
|
2
|
+
import { n as _ } from "./navigate-CXebafwF.mjs";
|
|
3
|
+
import { s as f, r as w, f as A, g as p, m as k } from "./roving-focus-group-Dbm1Jko_.mjs";
|
|
4
|
+
const S = `
|
|
4
5
|
:host {
|
|
5
6
|
--ui-tabs-nav-bg: var(--ui-color-surface, #ffffff);
|
|
6
7
|
--ui-tabs-panel-bg: var(--ui-color-surface, #ffffff);
|
|
@@ -499,10 +500,10 @@ const k = `
|
|
|
499
500
|
--ui-tabs-muted: #94a3b8;
|
|
500
501
|
--ui-tabs-accent: var(--ui-tabs-active-bg, #93c5fd);
|
|
501
502
|
--ui-tabs-active-text: #dbeafe;
|
|
502
|
-
--ui-tabs-focus: #93c5fd;
|
|
503
|
-
--ui-tabs-indicator-bg: color-mix(in srgb, #93c5fd 24%, transparent);
|
|
504
|
-
--ui-tabs-indicator-border: color-mix(in srgb, #93c5fd 46%, transparent);
|
|
505
|
-
--ui-tabs-indicator-shadow: 0 0 0 1px
|
|
503
|
+
--ui-tabs-focus: var(--ui-color-accent-on-dark, #93c5fd);
|
|
504
|
+
--ui-tabs-indicator-bg: color-mix(in srgb, var(--ui-color-accent-on-dark, #93c5fd) 24%, transparent);
|
|
505
|
+
--ui-tabs-indicator-border: color-mix(in srgb, var(--ui-color-accent-on-dark, #93c5fd) 46%, transparent);
|
|
506
|
+
--ui-tabs-indicator-shadow: 0 0 0 1px color-mix(in srgb, var(--ui-color-accent-on-dark, #93c5fd) 24%, transparent);
|
|
506
507
|
--ui-tabs-shadow: 0 16px 34px rgba(2, 6, 23, 0.42), 0 32px 54px rgba(2, 6, 23, 0.4);
|
|
507
508
|
}
|
|
508
509
|
|
|
@@ -561,15 +562,15 @@ const k = `
|
|
|
561
562
|
}
|
|
562
563
|
}
|
|
563
564
|
`, g = "data-ui-tabs-auto-label";
|
|
564
|
-
function h(
|
|
565
|
-
return String(
|
|
565
|
+
function h(v) {
|
|
566
|
+
return String(v).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
566
567
|
}
|
|
567
|
-
function x(
|
|
568
|
-
if (
|
|
569
|
-
const t = String(
|
|
568
|
+
function x(v) {
|
|
569
|
+
if (v == null) return !1;
|
|
570
|
+
const t = String(v).toLowerCase();
|
|
570
571
|
return t !== "false" && t !== "0" && t !== "off";
|
|
571
572
|
}
|
|
572
|
-
const
|
|
573
|
+
const I = /* @__PURE__ */ new Set([
|
|
573
574
|
"aria-label",
|
|
574
575
|
"aria-labelledby",
|
|
575
576
|
"orientation",
|
|
@@ -584,9 +585,9 @@ const S = /* @__PURE__ */ new Set([
|
|
|
584
585
|
"elevation",
|
|
585
586
|
"bare"
|
|
586
587
|
]);
|
|
587
|
-
class
|
|
588
|
+
class z extends y {
|
|
588
589
|
constructor() {
|
|
589
|
-
super(), this._uid = `ui-tabs-${Math.random().toString(36).slice(2, 9)}`, this._observer = null, this._resizeObserver = null, this._isSyncing = !1, this._isSyncingSelectionAttributes = !1, this._focusIndex = -1, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onWindowResize = this._onWindowResize.bind(this);
|
|
590
|
+
super(), this._uid = `ui-tabs-${Math.random().toString(36).slice(2, 9)}`, this._observer = null, this._resizeObserver = null, this._isSyncing = !1, this._isSyncingSelectionAttributes = !1, this._focusIndex = -1, this._renderedSignature = null, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onWindowResize = this._onWindowResize.bind(this);
|
|
590
591
|
}
|
|
591
592
|
static get observedAttributes() {
|
|
592
593
|
return [
|
|
@@ -610,90 +611,101 @@ class I extends y {
|
|
|
610
611
|
}
|
|
611
612
|
connectedCallback() {
|
|
612
613
|
super.connectedCallback(), this.root.addEventListener("click", this._onClick), this.root.addEventListener("keydown", this._onKeyDown), this._observer = new MutationObserver(() => {
|
|
613
|
-
this._isSyncing
|
|
614
|
+
if (!this._isSyncing) {
|
|
615
|
+
if (this._renderedSignature != null && this._modelSignature(this._tabsModel()) === this._renderedSignature) {
|
|
616
|
+
this._syncSelectionUi();
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
this.requestRender();
|
|
620
|
+
}
|
|
614
621
|
}), this._observer.observe(this, {
|
|
615
622
|
childList: !0,
|
|
616
623
|
subtree: !0,
|
|
617
624
|
characterData: !0,
|
|
618
625
|
attributes: !0,
|
|
619
|
-
attributeFilter: ["slot", "data-label", "data-value", "data-icon", "data-disabled", "disabled", "data-active"]
|
|
626
|
+
attributeFilter: ["slot", "data-label", "data-value", "data-icon", "data-disabled", "disabled", "data-active", "data-href"]
|
|
620
627
|
}), typeof ResizeObserver < "u" ? (this._resizeObserver = new ResizeObserver(() => this._syncSelectionUi()), this._resizeObserver.observe(this)) : window.addEventListener("resize", this._onWindowResize), this._syncSelectionUi();
|
|
621
628
|
}
|
|
622
629
|
disconnectedCallback() {
|
|
623
630
|
this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this._observer && (this._observer.disconnect(), this._observer = null), this._resizeObserver ? (this._resizeObserver.disconnect(), this._resizeObserver = null) : window.removeEventListener("resize", this._onWindowResize), super.disconnectedCallback();
|
|
624
631
|
}
|
|
625
|
-
attributeChangedCallback(t,
|
|
626
|
-
if (
|
|
632
|
+
attributeChangedCallback(t, e, r) {
|
|
633
|
+
if (e !== r) {
|
|
627
634
|
if (t === "selected" || t === "value") {
|
|
628
635
|
this._isSyncingSelectionAttributes || this._syncSelectionUi();
|
|
629
636
|
return;
|
|
630
637
|
}
|
|
631
|
-
|
|
638
|
+
I.has(t) && this.isConnected && this.requestRender();
|
|
632
639
|
}
|
|
633
640
|
}
|
|
634
641
|
get selected() {
|
|
635
642
|
return this.getAttribute("selected") || "0";
|
|
636
643
|
}
|
|
637
644
|
set selected(t) {
|
|
638
|
-
const
|
|
639
|
-
|
|
645
|
+
const e = String(t);
|
|
646
|
+
e ? this.setAttribute("selected", e) : this.removeAttribute("selected");
|
|
640
647
|
}
|
|
648
|
+
// Direct children only: a slot only takes the host's own children, and a descendant query also
|
|
649
|
+
// picked up the tabs and panels of a ui-tabs nested inside one of this element's panels.
|
|
641
650
|
_sourceTabs() {
|
|
642
|
-
return Array.from(this.
|
|
651
|
+
return Array.from(this.children).filter((t) => t.getAttribute("slot") === "tab");
|
|
643
652
|
}
|
|
644
653
|
_sourcePanels() {
|
|
645
|
-
return Array.from(this.
|
|
654
|
+
return Array.from(this.children).filter((t) => t.getAttribute("slot") === "panel");
|
|
655
|
+
}
|
|
656
|
+
_modelSignature(t) {
|
|
657
|
+
return JSON.stringify(t.map((e) => [e.value, e.label, e.icon, e.disabled]));
|
|
646
658
|
}
|
|
647
659
|
_tabsModel() {
|
|
648
|
-
return this._sourceTabs().map((t,
|
|
649
|
-
const r = t.getAttribute("data-value") || t.getAttribute("value") || String(
|
|
650
|
-
return { index:
|
|
660
|
+
return this._sourceTabs().map((t, e) => {
|
|
661
|
+
const r = t.getAttribute("data-value") || t.getAttribute("value") || String(e), a = t.getAttribute("data-label") || t.textContent?.trim() || `Tab ${e + 1}`, i = t.getAttribute("data-icon") || "", s = t.hasAttribute("disabled") || x(t.getAttribute("data-disabled")), o = `${this._uid}-tab-${e}`, c = `${this._uid}-panel-${e}`, b = t.getAttribute("data-href") || t.getAttribute("href") || "";
|
|
662
|
+
return { index: e, value: r, label: a, icon: i, disabled: s, tabId: o, panelId: c, href: b };
|
|
651
663
|
});
|
|
652
664
|
}
|
|
653
665
|
_resolveSelectedIndex(t) {
|
|
654
666
|
if (!t.length) return -1;
|
|
655
|
-
const
|
|
667
|
+
const e = this.getAttribute("selected"), r = this.getAttribute("value"), a = this._sourceTabs();
|
|
656
668
|
let i = -1;
|
|
657
|
-
if (
|
|
658
|
-
const s = Number(
|
|
659
|
-
Number.isFinite(s) ? i = Math.trunc(s) : i = t.findIndex((
|
|
669
|
+
if (e != null && e !== "") {
|
|
670
|
+
const s = Number(e);
|
|
671
|
+
Number.isFinite(s) ? i = Math.trunc(s) : i = t.findIndex((o) => o.value === e);
|
|
660
672
|
}
|
|
661
|
-
return i < 0 && r && (i = t.findIndex((s) => s.value === r)), i < 0 && (i = t.findIndex((s,
|
|
673
|
+
return i < 0 && r && (i = t.findIndex((s) => s.value === r)), i < 0 && (i = t.findIndex((s, o) => !!a[o]?.hasAttribute("data-active") && !s.disabled)), (i < 0 || !t[i] || t[i].disabled) && (i = t.findIndex((s) => !s.disabled)), i;
|
|
662
674
|
}
|
|
663
|
-
_syncSelectedAttributes(t,
|
|
664
|
-
const r = t[
|
|
675
|
+
_syncSelectedAttributes(t, e) {
|
|
676
|
+
const r = t[e];
|
|
665
677
|
this._isSyncingSelectionAttributes = !0;
|
|
666
678
|
try {
|
|
667
679
|
if (!r) {
|
|
668
680
|
this.removeAttribute("selected"), this.removeAttribute("value");
|
|
669
681
|
return;
|
|
670
682
|
}
|
|
671
|
-
this.getAttribute("selected") !== String(
|
|
683
|
+
this.getAttribute("selected") !== String(e) && this.setAttribute("selected", String(e)), this.getAttribute("value") !== r.value && this.setAttribute("value", r.value);
|
|
672
684
|
} finally {
|
|
673
685
|
this._isSyncingSelectionAttributes = !1;
|
|
674
686
|
}
|
|
675
687
|
}
|
|
676
|
-
_emit(t,
|
|
677
|
-
const
|
|
678
|
-
if (!
|
|
688
|
+
_emit(t, e, r) {
|
|
689
|
+
const a = e[r];
|
|
690
|
+
if (!a) return;
|
|
679
691
|
const i = {
|
|
680
692
|
selected: r,
|
|
681
693
|
index: r,
|
|
682
|
-
value:
|
|
683
|
-
label:
|
|
684
|
-
tabId:
|
|
685
|
-
panelId:
|
|
694
|
+
value: a.value,
|
|
695
|
+
label: a.label,
|
|
696
|
+
tabId: a.tabId,
|
|
697
|
+
panelId: a.panelId
|
|
686
698
|
};
|
|
687
699
|
this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
|
|
688
700
|
}
|
|
689
|
-
_setSelectedByIndex(t,
|
|
690
|
-
const
|
|
691
|
-
if (!
|
|
692
|
-
if (this._resolveSelectedIndex(t) ===
|
|
693
|
-
this._focusTab(
|
|
701
|
+
_setSelectedByIndex(t, e, r) {
|
|
702
|
+
const a = t[e];
|
|
703
|
+
if (!a || a.disabled) return;
|
|
704
|
+
if (this._resolveSelectedIndex(t) === e) {
|
|
705
|
+
this._focusTab(e);
|
|
694
706
|
return;
|
|
695
707
|
}
|
|
696
|
-
this._focusIndex =
|
|
708
|
+
this._focusIndex = e, this.setAttribute("selected", String(e)), this.setAttribute("value", a.value), r && (this._emit("change", t, e), this._emit("select", t, e), a.href && _(this, { href: a.href, index: e, value: a.value, label: a.label }));
|
|
697
709
|
}
|
|
698
710
|
_syncSelectionUi() {
|
|
699
711
|
if (!this.isConnected) return;
|
|
@@ -703,58 +715,58 @@ class I extends y {
|
|
|
703
715
|
}
|
|
704
716
|
const t = this._tabsModel();
|
|
705
717
|
if (!t.length) return;
|
|
706
|
-
const
|
|
707
|
-
this._syncSelectedAttributes(t,
|
|
708
|
-
const
|
|
709
|
-
|
|
710
|
-
const c = t[
|
|
718
|
+
const e = this._resolveSelectedIndex(t), r = this._resolveFocusIndex(t, e);
|
|
719
|
+
this._syncSelectedAttributes(t, e);
|
|
720
|
+
const a = Array.from(this.root.querySelectorAll(".tab"));
|
|
721
|
+
a.forEach((s, o) => {
|
|
722
|
+
const c = t[o];
|
|
711
723
|
if (!c) return;
|
|
712
|
-
const
|
|
713
|
-
s.setAttribute("aria-selected",
|
|
714
|
-
}),
|
|
715
|
-
const i = t[
|
|
716
|
-
this._syncIndicator(
|
|
724
|
+
const b = o === e;
|
|
725
|
+
s.setAttribute("aria-selected", b ? "true" : "false"), s.setAttribute("aria-disabled", c.disabled ? "true" : "false"), c.disabled ? s.setAttribute("disabled", "") : s.removeAttribute("disabled");
|
|
726
|
+
}), f(a, a[r] || null, { activeAttribute: null });
|
|
727
|
+
const i = t[e];
|
|
728
|
+
this._syncIndicator(e), this._clearCrossRootReferences(), i && this._scrollSelectedTabIntoView(e), this._syncPanels(t, e);
|
|
717
729
|
}
|
|
718
730
|
_syncIndicator(t) {
|
|
719
|
-
const
|
|
720
|
-
if (!
|
|
721
|
-
const r = this.getAttribute("variant") || "default",
|
|
722
|
-
if (!
|
|
723
|
-
|
|
731
|
+
const e = this.root.querySelector(".nav");
|
|
732
|
+
if (!e) return;
|
|
733
|
+
const r = this.getAttribute("variant") || "default", a = r === "indicator";
|
|
734
|
+
if (!a && !(r === "indicator-line")) {
|
|
735
|
+
e.removeAttribute("data-indicator-ready"), e.style.removeProperty("--ui-tabs-indicator-x"), e.style.removeProperty("--ui-tabs-indicator-y"), e.style.removeProperty("--ui-tabs-indicator-w"), e.style.removeProperty("--ui-tabs-indicator-h");
|
|
724
736
|
return;
|
|
725
737
|
}
|
|
726
738
|
const s = this.root.querySelector(`.tab[data-index="${t}"]`);
|
|
727
739
|
if (!s) {
|
|
728
|
-
|
|
740
|
+
e.removeAttribute("data-indicator-ready");
|
|
729
741
|
return;
|
|
730
742
|
}
|
|
731
|
-
const
|
|
732
|
-
let
|
|
733
|
-
|
|
743
|
+
const o = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", c = getComputedStyle(this).direction === "rtl";
|
|
744
|
+
let b = s.offsetLeft, u = s.offsetTop, n = s.offsetWidth, l = s.offsetHeight;
|
|
745
|
+
a ? (b += 2, u += 2, n = Math.max(0, n - 4), l = Math.max(0, l - 4)) : o === "vertical" ? (u += 5, l = Math.max(8, l - 10), n = 3, b += c ? s.offsetWidth - 3 - 2 : 2) : (b += 8, n = Math.max(12, n - 16), l = 2, u += s.offsetHeight - 2 - 2), e.style.setProperty("--ui-tabs-indicator-x", `${b}px`), e.style.setProperty("--ui-tabs-indicator-y", `${u}px`), e.style.setProperty("--ui-tabs-indicator-w", `${n}px`), e.style.setProperty("--ui-tabs-indicator-h", `${l}px`), e.setAttribute("data-indicator-ready", "true");
|
|
734
746
|
}
|
|
735
747
|
_clearCrossRootReferences() {
|
|
736
748
|
this.removeAttribute("aria-activedescendant"), this.removeAttribute("aria-controls");
|
|
737
749
|
}
|
|
738
|
-
_syncPanels(t,
|
|
739
|
-
const r = this._sourcePanels(),
|
|
740
|
-
|
|
750
|
+
_syncPanels(t, e) {
|
|
751
|
+
const r = this._sourcePanels(), a = this.root.querySelector(".panel-wrap");
|
|
752
|
+
a && (r.length ? a.removeAttribute("hidden") : a.setAttribute("hidden", "")), this._isSyncing = !0;
|
|
741
753
|
try {
|
|
742
754
|
r.forEach((i, s) => {
|
|
743
|
-
const
|
|
744
|
-
i.id =
|
|
755
|
+
const o = t[s], c = s === e;
|
|
756
|
+
(!i.id || i.id.startsWith(`${this._uid}-panel-`)) && (i.id = o?.panelId || `${this._uid}-panel-${s}`), i.setAttribute("role", "tabpanel"), i.setAttribute("tabindex", c ? "0" : "-1"), i.setAttribute("aria-hidden", c ? "false" : "true"), o && (i.getAttribute("aria-labelledby") === o.tabId && i.removeAttribute("aria-labelledby"), i.hasAttribute("aria-labelledby") || i.hasAttribute("aria-label") && !i.hasAttribute(g) || (i.setAttribute("aria-label", o.label), i.setAttribute(g, ""))), c ? i.removeAttribute("hidden") : i.setAttribute("hidden", "");
|
|
745
757
|
});
|
|
746
758
|
} finally {
|
|
747
759
|
this._isSyncing = !1;
|
|
748
760
|
}
|
|
749
761
|
}
|
|
750
762
|
_enabledIndices(t) {
|
|
751
|
-
return t.filter((
|
|
763
|
+
return t.filter((e) => !e.disabled).map((e) => e.index);
|
|
752
764
|
}
|
|
753
|
-
_resolveFocusIndex(t,
|
|
754
|
-
const r =
|
|
765
|
+
_resolveFocusIndex(t, e) {
|
|
766
|
+
const r = w(t, {
|
|
755
767
|
activeIndex: this._focusIndex,
|
|
756
|
-
selectedIndex:
|
|
757
|
-
getDisabled: (
|
|
768
|
+
selectedIndex: e,
|
|
769
|
+
getDisabled: (a) => a.disabled
|
|
758
770
|
});
|
|
759
771
|
return this._focusIndex = r, r;
|
|
760
772
|
}
|
|
@@ -763,41 +775,41 @@ class I extends y {
|
|
|
763
775
|
}
|
|
764
776
|
_focusTab(t) {
|
|
765
777
|
this._focusIndex = t;
|
|
766
|
-
const
|
|
767
|
-
|
|
778
|
+
const e = this.root.querySelector(`.tab[data-index="${t}"]`), r = Array.from(this.root.querySelectorAll(".tab"));
|
|
779
|
+
f(r, e, { activeAttribute: null }), A(e);
|
|
768
780
|
}
|
|
769
781
|
_scrollSelectedTabIntoView(t) {
|
|
770
|
-
const
|
|
771
|
-
if (!
|
|
772
|
-
const
|
|
782
|
+
const e = this.root.querySelector(".nav"), r = this.root.querySelector(`.tab[data-index="${t}"]`);
|
|
783
|
+
if (!e || !r) return;
|
|
784
|
+
const a = this.getAttribute("orientation") !== "vertical", i = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
773
785
|
typeof r.scrollIntoView == "function" && r.scrollIntoView({
|
|
774
786
|
behavior: i ? "auto" : "smooth",
|
|
775
787
|
block: "nearest",
|
|
776
|
-
inline:
|
|
788
|
+
inline: a ? "center" : "nearest"
|
|
777
789
|
});
|
|
778
790
|
}
|
|
779
791
|
_onClick(t) {
|
|
780
792
|
const r = t.target?.closest(".tab");
|
|
781
793
|
if (!r || r.disabled) return;
|
|
782
|
-
const
|
|
783
|
-
if (!Number.isFinite(
|
|
794
|
+
const a = Number(r.getAttribute("data-index"));
|
|
795
|
+
if (!Number.isFinite(a)) return;
|
|
784
796
|
const i = this._tabsModel();
|
|
785
|
-
this._setSelectedByIndex(i,
|
|
797
|
+
this._setSelectedByIndex(i, a, !0);
|
|
786
798
|
}
|
|
787
799
|
_onKeyDown(t) {
|
|
788
800
|
const r = t.target?.closest(".tab");
|
|
789
801
|
if (!r) return;
|
|
790
|
-
const
|
|
791
|
-
if (!
|
|
792
|
-
const i = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", s = this.getAttribute("activation") === "manual" ? "manual" : "auto",
|
|
793
|
-
if (!Number.isFinite(
|
|
794
|
-
const u = (
|
|
795
|
-
const
|
|
796
|
-
wrap:
|
|
797
|
-
fallbackIndex: this._resolveFocusIndex(
|
|
798
|
-
getDisabled: (
|
|
802
|
+
const a = this._tabsModel();
|
|
803
|
+
if (!a.length) return;
|
|
804
|
+
const i = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", s = this.getAttribute("activation") === "manual" ? "manual" : "auto", o = !this.hasAttribute("loop") || x(this.getAttribute("loop")), c = getComputedStyle(this).direction === "rtl", b = Number(r.getAttribute("data-index"));
|
|
805
|
+
if (!Number.isFinite(b)) return;
|
|
806
|
+
const u = (n) => {
|
|
807
|
+
const l = k(a, b, n, {
|
|
808
|
+
wrap: o,
|
|
809
|
+
fallbackIndex: this._resolveFocusIndex(a, this._resolveSelectedIndex(a)),
|
|
810
|
+
getDisabled: (d) => d.disabled
|
|
799
811
|
});
|
|
800
|
-
|
|
812
|
+
l != null && (this._focusTab(l), s === "auto" ? this._setSelectedByIndex(a, l, !0) : this._emit("focus", a, l));
|
|
801
813
|
};
|
|
802
814
|
if (i === "horizontal" && (t.key === "ArrowRight" && !c || t.key === "ArrowLeft" && c) || i === "vertical" && t.key === "ArrowDown") {
|
|
803
815
|
t.preventDefault(), u(1);
|
|
@@ -809,25 +821,27 @@ class I extends y {
|
|
|
809
821
|
}
|
|
810
822
|
if (t.key === "Home") {
|
|
811
823
|
t.preventDefault();
|
|
812
|
-
const
|
|
813
|
-
if (
|
|
814
|
-
this._focusTab(
|
|
824
|
+
const n = p(a, "first", (l) => l.disabled);
|
|
825
|
+
if (n < 0) return;
|
|
826
|
+
this._focusTab(n), s === "auto" ? this._setSelectedByIndex(a, n, !0) : this._emit("focus", a, n);
|
|
815
827
|
return;
|
|
816
828
|
}
|
|
817
829
|
if (t.key === "End") {
|
|
818
830
|
t.preventDefault();
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
821
|
-
this._focusTab(
|
|
831
|
+
const n = p(a, "last", (l) => l.disabled);
|
|
832
|
+
if (n < 0) return;
|
|
833
|
+
this._focusTab(n), s === "auto" ? this._setSelectedByIndex(a, n, !0) : this._emit("focus", a, n);
|
|
822
834
|
return;
|
|
823
835
|
}
|
|
824
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this._setSelectedByIndex(
|
|
836
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this._setSelectedByIndex(a, b, !0));
|
|
825
837
|
}
|
|
826
838
|
render() {
|
|
827
|
-
const t = this._tabsModel(),
|
|
839
|
+
const t = this._tabsModel(), r = !!this.root.activeElement?.classList?.contains("tab");
|
|
840
|
+
this._renderedSignature = this._modelSignature(t);
|
|
841
|
+
const a = this._resolveSelectedIndex(t), i = this._resolveFocusIndex(t, a);
|
|
828
842
|
this._syncSelectedAttributes(t, a);
|
|
829
|
-
const
|
|
830
|
-
const
|
|
843
|
+
const s = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", o = (this.getAttribute("aria-label") || "").trim(), c = (this.getAttribute("aria-labelledby") || "").trim(), b = (o ? ` aria-label="${h(o)}"` : "") + (c ? ` aria-labelledby="${h(c)}"` : ""), u = t.map((n) => {
|
|
844
|
+
const l = n.index === a, d = n.icon ? `<span class="tab-icon" aria-hidden="true">${h(n.icon)}</span>` : "";
|
|
831
845
|
return `
|
|
832
846
|
<button
|
|
833
847
|
type="button"
|
|
@@ -836,32 +850,32 @@ class I extends y {
|
|
|
836
850
|
id="${n.tabId}"
|
|
837
851
|
role="tab"
|
|
838
852
|
data-index="${n.index}"
|
|
839
|
-
aria-selected="${
|
|
853
|
+
aria-selected="${l ? "true" : "false"}"
|
|
840
854
|
aria-disabled="${n.disabled ? "true" : "false"}"
|
|
841
|
-
tabindex="${n.index ===
|
|
855
|
+
tabindex="${n.index === i && !n.disabled ? "0" : "-1"}"
|
|
842
856
|
${n.disabled ? "disabled" : ""}
|
|
843
857
|
>
|
|
844
|
-
${
|
|
858
|
+
${d}
|
|
845
859
|
<span class="tab-label">${h(n.label)}</span>
|
|
846
860
|
</button>
|
|
847
861
|
`;
|
|
848
862
|
}).join("");
|
|
849
863
|
this.setContent(`
|
|
850
|
-
<style>${
|
|
864
|
+
<style>${S}</style>
|
|
851
865
|
<section class="shell" part="shell">
|
|
852
|
-
<div class="nav" role="tablist" aria-orientation="${
|
|
866
|
+
<div class="nav" role="tablist" aria-orientation="${s}"${b} part="nav">
|
|
853
867
|
<span class="indicator" part="indicator" aria-hidden="true"></span>
|
|
854
|
-
${
|
|
868
|
+
${u}
|
|
855
869
|
</div>
|
|
856
870
|
<div class="panel-wrap" part="panel-wrap" aria-live="polite">
|
|
857
871
|
<slot name="panel"></slot>
|
|
858
872
|
</div>
|
|
859
873
|
</section>
|
|
860
874
|
<slot class="source-tabs" name="tab"></slot>
|
|
861
|
-
`), this._clearCrossRootReferences(), this._syncIndicator(a), this._syncPanels(t, a);
|
|
875
|
+
`), this._clearCrossRootReferences(), this._syncIndicator(a), this._syncPanels(t, a), r && this.root.querySelector(`.tab[data-index="${i}"]`)?.focus({ preventScroll: !0 });
|
|
862
876
|
}
|
|
863
877
|
}
|
|
864
|
-
typeof customElements < "u" && !customElements.get("ui-tabs") && customElements.define("ui-tabs",
|
|
878
|
+
typeof customElements < "u" && !customElements.get("ui-tabs") && customElements.define("ui-tabs", z);
|
|
865
879
|
export {
|
|
866
|
-
|
|
880
|
+
z as UITabs
|
|
867
881
|
};
|
package/dist/tags-input.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("./ElementBase-CbUsP3D6.js"),m=require("./control-name-BmoI1m3a.js"),k=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-tags-input-padding: 10px 12px;
|
|
4
4
|
--ui-tags-input-border-color: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
package/dist/tags-input.esm.js
CHANGED