@esri/solutions-components 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/deduct-calculator.cjs.entry.js +1 -1
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/{pciUtils-6a806ba4.js → pciUtils-423cfc68.js} +25 -7
- package/dist/collection/demos/deduct-calculator.html +2 -5
- package/dist/collection/demos/new-public-notification.html +6 -4
- package/dist/collection/utils/pciUtils.js +25 -7
- package/dist/collection/utils/pciUtils.ts +30 -7
- package/dist/components/ExpandToggle.js +110 -0
- package/dist/components/Heading.js +22 -0
- package/dist/components/_commonjsHelpers.js +22 -0
- package/dist/components/action-bar.js +276 -0
- package/dist/components/action-group.js +149 -0
- package/dist/components/action-menu.js +356 -0
- package/dist/components/action.js +214 -0
- package/dist/components/add-record-modal.d.ts +11 -0
- package/dist/components/add-record-modal.js +171 -0
- package/dist/components/array.js +15 -0
- package/dist/components/block.js +272 -0
- package/dist/components/buffer-tools.d.ts +11 -0
- package/dist/components/buffer-tools.js +11 -0
- package/dist/components/buffer-tools2.js +262 -0
- package/dist/components/button.js +263 -0
- package/dist/components/calcite-accordion-item.js +244 -0
- package/dist/components/calcite-accordion.js +180 -0
- package/dist/components/calcite-action-bar.js +11 -0
- package/dist/components/calcite-action-group.js +11 -0
- package/dist/components/calcite-action-menu.js +11 -0
- package/dist/components/calcite-action-pad.js +197 -0
- package/dist/components/calcite-action.js +11 -0
- package/dist/components/calcite-alert.js +297 -0
- package/dist/components/calcite-avatar.js +182 -0
- package/dist/components/calcite-block-section.js +155 -0
- package/dist/components/calcite-block.js +11 -0
- package/dist/components/calcite-button.js +11 -0
- package/dist/components/calcite-card.js +187 -0
- package/dist/components/calcite-checkbox.js +11 -0
- package/dist/components/calcite-chip.js +11 -0
- package/dist/components/calcite-color-picker-hex-input.js +11 -0
- package/dist/components/calcite-color-picker-swatch.js +11 -0
- package/dist/components/calcite-color-picker.js +1036 -0
- package/dist/components/calcite-combobox-item-group.js +75 -0
- package/dist/components/calcite-combobox-item.js +11 -0
- package/dist/components/calcite-combobox.js +11 -0
- package/dist/components/calcite-date-picker-day.js +11 -0
- package/dist/components/calcite-date-picker-month-header.js +11 -0
- package/dist/components/calcite-date-picker-month.js +11 -0
- package/dist/components/calcite-date-picker.js +11 -0
- package/dist/components/calcite-dropdown-group.js +11 -0
- package/dist/components/calcite-dropdown-item.js +11 -0
- package/dist/components/calcite-dropdown.js +11 -0
- package/dist/components/calcite-fab.js +144 -0
- package/dist/components/calcite-filter.js +195 -0
- package/dist/components/calcite-flow-item.js +243 -0
- package/dist/components/calcite-flow.js +147 -0
- package/dist/components/calcite-graph.js +11 -0
- package/dist/components/calcite-handle.js +11 -0
- package/dist/components/calcite-icon.js +11 -0
- package/dist/components/calcite-inline-editable.js +294 -0
- package/dist/components/calcite-input-date-picker.js +713 -0
- package/dist/components/calcite-input-message.js +11 -0
- package/dist/components/calcite-input-number.js +637 -0
- package/dist/components/calcite-input-text.js +400 -0
- package/dist/components/calcite-input-time-picker.js +434 -0
- package/dist/components/calcite-input.js +11 -0
- package/dist/components/calcite-label.js +11 -0
- package/dist/components/calcite-link.js +11 -0
- package/dist/components/calcite-list-item-group.js +65 -0
- package/dist/components/calcite-list-item.js +11 -0
- package/dist/components/calcite-list.js +11 -0
- package/dist/components/calcite-loader.js +11 -0
- package/dist/components/calcite-modal.js +11 -0
- package/dist/components/calcite-notice.js +11 -0
- package/dist/components/calcite-option-group.js +64 -0
- package/dist/components/calcite-option.js +11 -0
- package/dist/components/calcite-pagination.js +258 -0
- package/dist/components/calcite-panel.js +11 -0
- package/dist/components/calcite-pick-list-group.js +74 -0
- package/dist/components/calcite-pick-list-item.js +11 -0
- package/dist/components/calcite-pick-list.js +11 -0
- package/dist/components/calcite-popover-manager.js +94 -0
- package/dist/components/calcite-popover.js +11 -0
- package/dist/components/calcite-progress.js +11 -0
- package/dist/components/calcite-radio-button-group.js +132 -0
- package/dist/components/calcite-radio-button.js +310 -0
- package/dist/components/calcite-radio-group-item.js +11 -0
- package/dist/components/calcite-radio-group.js +11 -0
- package/dist/components/calcite-rating.js +201 -0
- package/dist/components/calcite-scrim.js +11 -0
- package/dist/components/calcite-select.js +11 -0
- package/dist/components/calcite-shell-center-row.js +100 -0
- package/dist/components/calcite-shell-panel.js +11 -0
- package/dist/components/calcite-shell.js +11 -0
- package/dist/components/calcite-slider.js +11 -0
- package/dist/components/calcite-sortable-list.js +202 -0
- package/dist/components/calcite-split-button.js +11 -0
- package/dist/components/calcite-stepper-item.js +271 -0
- package/dist/components/calcite-stepper.js +256 -0
- package/dist/components/calcite-switch.js +11 -0
- package/dist/components/calcite-tab-nav.js +11 -0
- package/dist/components/calcite-tab-title.js +11 -0
- package/dist/components/calcite-tab.js +11 -0
- package/dist/components/calcite-tabs.js +11 -0
- package/dist/components/calcite-tile-select-group.js +65 -0
- package/dist/components/calcite-tile-select.js +266 -0
- package/dist/components/calcite-tile.js +11 -0
- package/dist/components/calcite-time-picker.js +11 -0
- package/dist/components/calcite-tip-group.js +41 -0
- package/dist/components/calcite-tip-manager.js +223 -0
- package/dist/components/calcite-tip.js +162 -0
- package/dist/components/calcite-tooltip-manager.js +57 -0
- package/dist/components/calcite-tooltip.js +11 -0
- package/dist/components/calcite-tree-item.js +11 -0
- package/dist/components/calcite-tree.js +11 -0
- package/dist/components/calcite-value-list-item.js +11 -0
- package/dist/components/calcite-value-list.js +11 -0
- package/dist/components/card-manager.d.ts +11 -0
- package/dist/components/card-manager.js +143 -0
- package/dist/components/check-list.d.ts +11 -0
- package/dist/components/check-list.js +11 -0
- package/dist/components/check-list2.js +131 -0
- package/dist/components/checkbox.js +165 -0
- package/dist/components/chip.js +170 -0
- package/dist/components/color-picker-hex-input.js +363 -0
- package/dist/components/color-picker-swatch.js +2034 -0
- package/dist/components/combobox-item.js +182 -0
- package/dist/components/combobox.js +912 -0
- package/dist/components/comment-card.d.ts +11 -0
- package/dist/components/comment-card.js +90 -0
- package/dist/components/conditionalSlot.js +50 -0
- package/dist/components/config-buffer-tools.d.ts +11 -0
- package/dist/components/config-buffer-tools.js +187 -0
- package/dist/components/config-draw-tools.d.ts +11 -0
- package/dist/components/config-draw-tools.js +121 -0
- package/dist/components/config-layer-picker.d.ts +11 -0
- package/dist/components/config-layer-picker.js +163 -0
- package/dist/components/config-pdf-download.d.ts +11 -0
- package/dist/components/config-pdf-download.js +154 -0
- package/dist/components/crowdsource-manager.d.ts +11 -0
- package/dist/components/crowdsource-manager.js +90 -0
- package/dist/components/crowdsource-reporter.d.ts +11 -0
- package/dist/components/crowdsource-reporter.js +90 -0
- package/dist/components/csvUtils.js +74 -0
- package/dist/components/date-picker-day.js +111 -0
- package/dist/components/date-picker-month-header.js +224 -0
- package/dist/components/date-picker-month.js +344 -0
- package/dist/components/date-picker.js +575 -0
- package/dist/components/date.js +180 -0
- package/dist/components/debounce.js +487 -0
- package/dist/components/deduct-calculator.d.ts +11 -0
- package/dist/components/deduct-calculator.js +11 -0
- package/dist/components/deduct-calculator2.js +1002 -0
- package/dist/components/dom.js +231 -0
- package/dist/components/dropdown-group.js +96 -0
- package/dist/components/dropdown-item.js +232 -0
- package/dist/components/dropdown.js +505 -0
- package/dist/components/edit-record-modal.d.ts +11 -0
- package/dist/components/edit-record-modal.js +11 -0
- package/dist/components/edit-record-modal2.js +161 -0
- package/dist/components/filter.js +763 -0
- package/dist/components/floating-ui.js +1768 -0
- package/dist/components/form.js +228 -0
- package/dist/components/graph.js +254 -0
- package/dist/components/guid.js +24 -0
- package/dist/components/handle.js +119 -0
- package/dist/components/icon.js +202 -0
- package/dist/components/index.d.ts +61 -0
- package/dist/components/index.js +196 -0
- package/dist/components/index2.js +199 -0
- package/dist/components/info-card.d.ts +11 -0
- package/dist/components/info-card.js +11 -0
- package/dist/components/info-card2.js +97 -0
- package/dist/components/input-message.js +101 -0
- package/dist/components/input.js +740 -0
- package/dist/components/interactive.js +51 -0
- package/dist/components/interfaces.js +19 -0
- package/dist/components/interfaces2.js +21 -0
- package/dist/components/interfaces3.js +80 -0
- package/dist/components/json-editor.d.ts +11 -0
- package/dist/components/json-editor.js +11 -0
- package/dist/components/json-editor2.js +441 -0
- package/dist/components/key.js +16 -0
- package/dist/components/label.js +106 -0
- package/dist/components/label2.js +131 -0
- package/dist/components/labelFormats.js +210 -0
- package/dist/components/layer-table.d.ts +11 -0
- package/dist/components/layer-table.js +453 -0
- package/dist/components/link.js +123 -0
- package/dist/components/list-item.d.ts +11 -0
- package/dist/components/list-item.js +90 -0
- package/dist/components/list-item2.js +149 -0
- package/dist/components/list.js +83 -0
- package/dist/components/loadModules.js +28 -0
- package/dist/components/loader.js +116 -0
- package/dist/components/locale.js +412 -0
- package/dist/components/locale2.js +413 -0
- package/dist/components/map-card.d.ts +11 -0
- package/dist/components/map-card.js +354 -0
- package/dist/components/map-draw-tools.d.ts +11 -0
- package/dist/components/map-draw-tools.js +11 -0
- package/dist/components/map-draw-tools2.js +228 -0
- package/dist/components/map-layer-picker.d.ts +11 -0
- package/dist/components/map-layer-picker.js +11 -0
- package/dist/components/map-layer-picker2.js +188 -0
- package/dist/components/map-search.d.ts +11 -0
- package/dist/components/map-search.js +155 -0
- package/dist/components/map-select-tools.d.ts +11 -0
- package/dist/components/map-select-tools.js +11 -0
- package/dist/components/map-select-tools2.js +588 -0
- package/dist/components/mapViewUtils.js +129 -0
- package/dist/components/math.js +24 -0
- package/dist/components/media-card.d.ts +11 -0
- package/dist/components/media-card.js +11 -0
- package/dist/components/media-card2.js +177 -0
- package/dist/components/modal.js +495 -0
- package/dist/components/nonChromiumPlatformUtils.js +503 -0
- package/dist/components/notice.js +192 -0
- package/dist/components/observers.js +56 -0
- package/dist/components/openCloseComponent.js +56 -0
- package/dist/components/option.js +109 -0
- package/dist/components/panel.js +459 -0
- package/dist/components/pci-calculator.d.ts +11 -0
- package/dist/components/pci-calculator.js +193 -0
- package/dist/components/pdf-download.d.ts +11 -0
- package/dist/components/pdf-download.js +11 -0
- package/dist/components/pdf-download2.js +189 -0
- package/dist/components/pick-list-item.js +255 -0
- package/dist/components/pick-list.js +170 -0
- package/dist/components/popover.js +500 -0
- package/dist/components/progress.js +60 -0
- package/dist/components/public-notification.d.ts +11 -0
- package/dist/components/public-notification.js +825 -0
- package/dist/components/publicNotificationStore.js +38 -0
- package/dist/components/queryUtils.js +187 -0
- package/dist/components/radio-group-item.js +101 -0
- package/dist/components/radio-group.js +235 -0
- package/dist/components/refine-selection-tools.d.ts +11 -0
- package/dist/components/refine-selection-tools.js +11 -0
- package/dist/components/refine-selection-tools2.js +492 -0
- package/dist/components/refine-selection.d.ts +11 -0
- package/dist/components/refine-selection.js +11 -0
- package/dist/components/refine-selection2.js +376 -0
- package/dist/components/resources.js +24 -0
- package/dist/components/resources2.js +21 -0
- package/dist/components/resources3.js +38 -0
- package/dist/components/scrim.js +83 -0
- package/dist/components/select.js +259 -0
- package/dist/components/shared-list-render.js +319 -0
- package/dist/components/shell-panel.js +281 -0
- package/dist/components/shell.js +121 -0
- package/dist/components/slider.js +896 -0
- package/dist/components/solution-configuration.d.ts +11 -0
- package/dist/components/solution-configuration.js +2233 -0
- package/dist/components/solution-contents.d.ts +11 -0
- package/dist/components/solution-contents.js +11 -0
- package/dist/components/solution-contents2.js +128 -0
- package/dist/components/solution-item-details.d.ts +11 -0
- package/dist/components/solution-item-details.js +11 -0
- package/dist/components/solution-item-details2.js +234 -0
- package/dist/components/solution-item-icon.d.ts +11 -0
- package/dist/components/solution-item-icon.js +11 -0
- package/dist/components/solution-item-icon2.js +342 -0
- package/dist/components/solution-item-sharing.d.ts +11 -0
- package/dist/components/solution-item-sharing.js +11 -0
- package/dist/components/solution-item-sharing2.js +167 -0
- package/dist/components/solution-item.d.ts +11 -0
- package/dist/components/solution-item.js +11 -0
- package/dist/components/solution-item2.js +315 -0
- package/dist/components/solution-organization-variables.d.ts +11 -0
- package/dist/components/solution-organization-variables.js +11 -0
- package/dist/components/solution-organization-variables2.js +132 -0
- package/dist/components/solution-resource-item.d.ts +11 -0
- package/dist/components/solution-resource-item.js +11 -0
- package/dist/components/solution-resource-item2.js +356 -0
- package/dist/components/solution-spatial-ref.d.ts +11 -0
- package/dist/components/solution-spatial-ref.js +11 -0
- package/dist/components/solution-spatial-ref2.js +21446 -0
- package/dist/components/solution-store.js +4092 -0
- package/dist/components/solution-template-data.d.ts +11 -0
- package/dist/components/solution-template-data.js +11 -0
- package/dist/components/solution-template-data2.js +233 -0
- package/dist/components/solution-variables.d.ts +11 -0
- package/dist/components/solution-variables.js +11 -0
- package/dist/components/solution-variables2.js +150 -0
- package/dist/components/sortable.esm.js +3026 -0
- package/dist/components/split-button.js +165 -0
- package/dist/components/store-manager.d.ts +11 -0
- package/dist/components/store-manager.js +83 -0
- package/dist/components/switch.js +139 -0
- package/dist/components/tab-nav.js +241 -0
- package/dist/components/tab-title.js +276 -0
- package/dist/components/tab.js +154 -0
- package/dist/components/tabs.js +188 -0
- package/dist/components/tile.js +129 -0
- package/dist/components/time-picker.js +943 -0
- package/dist/components/tooltip.js +399 -0
- package/dist/components/tree-item.js +294 -0
- package/dist/components/tree.js +327 -0
- package/dist/components/utils.js +119 -0
- package/dist/components/utils2.js +51 -0
- package/dist/components/value-list-item.js +204 -0
- package/dist/components/value-list.js +333 -0
- package/dist/esm/deduct-calculator.entry.js +1 -1
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/{pciUtils-e3007a1c.js → pciUtils-ecda46e5.js} +25 -7
- package/dist/solutions-components/demos/deduct-calculator.html +2 -5
- package/dist/solutions-components/demos/new-public-notification.html +6 -4
- package/dist/solutions-components/{p-ff80ffbb.entry.js → p-0512635b.entry.js} +1 -1
- package/dist/solutions-components/{p-5ec407c2.entry.js → p-0c088725.entry.js} +1 -1
- package/dist/solutions-components/p-cc815aca.js +21 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/pciUtils.ts +30 -7
- package/dist/types/utils/pciUtils.d.ts +2 -1
- package/package.json +4 -3
- package/dist/solutions-components/p-647bbd18.js +0 -21
@@ -0,0 +1,276 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { proxyCustomElement, HTMLElement, createEvent, Build, h, Host } from '@stencil/core/internal/client';
|
7
|
+
import { g as guid } from './guid.js';
|
8
|
+
import { g as getElementProp, t as toAriaBoolean, c as getElementDir } from './dom.js';
|
9
|
+
import { c as createObserver } from './observers.js';
|
10
|
+
import { u as updateHostInteraction } from './interactive.js';
|
11
|
+
import { d as defineCustomElement$1 } from './icon.js';
|
12
|
+
|
13
|
+
const tabTitleCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:block;flex:0 1 auto;outline:2px solid transparent;outline-offset:2px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:1.25rem;margin-inline-end:1.25rem}:host([layout=center]){margin-block:0px;margin-inline:1.25rem;text-align:center;flex-basis:12rem;margin:auto}:host([position=below]) .container{border-block-end-width:0px;border-block-start-width:2px;border-block-start-color:transparent;border-block-start-style:solid}:host([position=bottom]) .container{border-block-end-width:0px;border-block-start-width:2px;border-block-start-color:transparent;border-block-start-style:solid}:host .container{outline-color:transparent}:host(:focus) .container{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host(:active) a,:host(:focus) a,:host(:hover) a{border-color:var(--calcite-ui-border-2);color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none}:host([selected]) .container{border-color:transparent;color:var(--calcite-ui-text-1)}:host([disabled]) .container{pointer-events:none;opacity:0.5}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([scale=s]){-webkit-margin-end:1rem;margin-inline-end:1rem}:host([scale=s]) .container{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=m]) .container{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=l]){-webkit-margin-end:1.5rem;margin-inline-end:1.5rem}:host([scale=l]) .container{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}.container{box-sizing:border-box;display:flex;block-size:100%;inline-size:100%;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;justify-content:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-block-end-width:2px;padding-inline:0px;padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-3);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-block-end-color:transparent;border-block-end-style:solid}.calcite-tab-title--icon{position:relative;margin:0px;display:inline-flex;align-self:center}.calcite-tab-title--icon svg{transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.container--has-text{padding:0.25rem}.container--has-text .calcite-tab-title--icon.icon-start{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}.container--has-text .calcite-tab-title--icon.icon-end{-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}:host([icon-start][icon-end]) .calcite-tab-title--icon:first-child{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}:host([bordered]){-webkit-margin-end:0;margin-inline-end:0}:host([bordered][selected]){box-shadow:inset 0px -2px var(--calcite-ui-foreground-1)}:host([bordered][selected][position=below]){box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1)}:host([bordered][selected][position=bottom]){box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1)}:host([bordered]:hover) .container,:host([bordered]:focus) .container,:host([bordered]:active) .container{position:relative}:host([bordered]:hover) .container{background-color:var(--calcite-button-transparent-hover)}:host([bordered]) .container{border-block-end-style:unset;-webkit-border-start:1px solid transparent;border-inline-start:1px solid transparent;-webkit-border-end:1px solid transparent;border-inline-end:1px solid transparent}:host([bordered][position=below]) .container{border-block-start-style:unset}:host([bordered][position=bottom]) .container{border-block-start-style:unset}:host([selected][bordered]) .container{border-inline-start-color:var(--calcite-ui-border-1);border-inline-end-color:var(--calcite-ui-border-1)}:host([bordered]) .container{padding-inline:0.75rem}:host([bordered][scale=s]) .container{padding-inline:0.5rem}:host([bordered][scale=l]) .container{padding-inline:1rem}@media (forced-colors: active){:host{outline-width:0;outline-offset:0}:host(:focus) .container{outline-color:highlight}:host([bordered]) .container{border-block-end-style:solid}:host([bordered][position=below]) .container{border-block-start-style:solid}:host([bordered][position=bottom]) .container{border-block-start-style:solid}:host([bordered][selected]) .container{border-block-end-style:none}:host([bordered][position=below][selected]) .container{border-block-start-style:none}:host([bordered][position=bottom][selected]) .container{border-block-start-style:none}}";
|
14
|
+
|
15
|
+
const TabTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
16
|
+
constructor() {
|
17
|
+
super();
|
18
|
+
this.__registerHost();
|
19
|
+
this.__attachShadow();
|
20
|
+
this.calciteTabsActivate = createEvent(this, "calciteTabsActivate", 6);
|
21
|
+
this.calciteInternalTabsActivate = createEvent(this, "calciteInternalTabsActivate", 6);
|
22
|
+
this.calciteInternalTabsFocusNext = createEvent(this, "calciteInternalTabsFocusNext", 6);
|
23
|
+
this.calciteInternalTabsFocusPrevious = createEvent(this, "calciteInternalTabsFocusPrevious", 6);
|
24
|
+
this.calciteInternalTabTitleRegister = createEvent(this, "calciteInternalTabTitleRegister", 6);
|
25
|
+
this.calciteInternalTabIconChanged = createEvent(this, "calciteInternalTabIconChanged", 6);
|
26
|
+
//--------------------------------------------------------------------------
|
27
|
+
//
|
28
|
+
// Properties
|
29
|
+
//
|
30
|
+
//--------------------------------------------------------------------------
|
31
|
+
/**
|
32
|
+
* When `true`, the component and its respective `calcite-tab` contents are selected.
|
33
|
+
*
|
34
|
+
* Only one tab can be selected within the `calcite-tabs` parent.
|
35
|
+
*
|
36
|
+
* @deprecated Use `selected` instead.
|
37
|
+
*/
|
38
|
+
this.active = false;
|
39
|
+
/**
|
40
|
+
* When `true`, the component and its respective `calcite-tab` contents are selected.
|
41
|
+
*
|
42
|
+
* Only one tab can be selected within the `calcite-tabs` parent.
|
43
|
+
*/
|
44
|
+
this.selected = false;
|
45
|
+
/** When `true`, interaction is prevented and the component is displayed with lower opacity. */
|
46
|
+
this.disabled = false;
|
47
|
+
/**
|
48
|
+
* @internal
|
49
|
+
*/
|
50
|
+
this.bordered = false;
|
51
|
+
//--------------------------------------------------------------------------
|
52
|
+
//
|
53
|
+
// Private State/Props
|
54
|
+
//
|
55
|
+
//--------------------------------------------------------------------------
|
56
|
+
/** watches for changing text content */
|
57
|
+
this.mutationObserver = createObserver("mutation", () => this.updateHasText());
|
58
|
+
/** determine if there is slotted text for styling purposes */
|
59
|
+
this.hasText = false;
|
60
|
+
this.resizeObserver = createObserver("resize", () => {
|
61
|
+
this.calciteInternalTabIconChanged.emit();
|
62
|
+
});
|
63
|
+
this.guid = `calcite-tab-title-${guid()}`;
|
64
|
+
}
|
65
|
+
activeHandler(value) {
|
66
|
+
this.selected = value;
|
67
|
+
}
|
68
|
+
selectedHandler(value) {
|
69
|
+
this.active = value;
|
70
|
+
if (this.selected) {
|
71
|
+
this.emitActiveTab(false);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
//--------------------------------------------------------------------------
|
75
|
+
//
|
76
|
+
// Lifecycle
|
77
|
+
//
|
78
|
+
//--------------------------------------------------------------------------
|
79
|
+
connectedCallback() {
|
80
|
+
const { selected, active } = this;
|
81
|
+
if (selected) {
|
82
|
+
this.active = selected;
|
83
|
+
}
|
84
|
+
else if (active) {
|
85
|
+
this.activeHandler(active);
|
86
|
+
}
|
87
|
+
this.setupTextContentObserver();
|
88
|
+
this.parentTabNavEl = this.el.closest("calcite-tab-nav");
|
89
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
90
|
+
}
|
91
|
+
disconnectedCallback() {
|
92
|
+
var _a, _b, _c;
|
93
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
94
|
+
// Dispatching to body in order to be listened by other elements that are still connected to the DOM.
|
95
|
+
(_b = document.body) === null || _b === void 0 ? void 0 : _b.dispatchEvent(new CustomEvent("calciteTabTitleUnregister", {
|
96
|
+
detail: this.el
|
97
|
+
}));
|
98
|
+
(_c = this.resizeObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
|
99
|
+
}
|
100
|
+
componentWillLoad() {
|
101
|
+
if (Build.isBrowser) {
|
102
|
+
this.updateHasText();
|
103
|
+
}
|
104
|
+
if (this.tab && this.selected) {
|
105
|
+
this.emitActiveTab(false);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
componentWillRender() {
|
109
|
+
if (this.parentTabsEl) {
|
110
|
+
this.layout = this.parentTabsEl.layout;
|
111
|
+
this.position = this.parentTabsEl.position;
|
112
|
+
this.scale = this.parentTabsEl.scale;
|
113
|
+
this.bordered = this.parentTabsEl.bordered;
|
114
|
+
}
|
115
|
+
// handle case when tab-nav is only parent
|
116
|
+
if (!this.parentTabsEl && this.parentTabNavEl) {
|
117
|
+
this.position = getElementProp(this.parentTabNavEl, "position", this.position);
|
118
|
+
this.scale = getElementProp(this.parentTabNavEl, "scale", this.scale);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
render() {
|
122
|
+
const id = this.el.id || this.guid;
|
123
|
+
const iconStartEl = (h("calcite-icon", { class: "calcite-tab-title--icon icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
|
124
|
+
const iconEndEl = (h("calcite-icon", { class: "calcite-tab-title--icon icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
|
125
|
+
return (h(Host, { "aria-controls": this.controls, "aria-selected": toAriaBoolean(this.selected), id: id, role: "tab", tabIndex: this.selected ? 0 : -1 }, h("div", { class: {
|
126
|
+
container: true,
|
127
|
+
"container--has-text": this.hasText
|
128
|
+
}, ref: (el) => { var _a; return (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el); } }, this.iconStart ? iconStartEl : null, h("slot", null), this.iconEnd ? iconEndEl : null)));
|
129
|
+
}
|
130
|
+
async componentDidLoad() {
|
131
|
+
this.calciteInternalTabTitleRegister.emit(await this.getTabIdentifier());
|
132
|
+
}
|
133
|
+
componentDidRender() {
|
134
|
+
updateHostInteraction(this, () => {
|
135
|
+
return this.selected;
|
136
|
+
});
|
137
|
+
}
|
138
|
+
//--------------------------------------------------------------------------
|
139
|
+
//
|
140
|
+
// Event Listeners
|
141
|
+
//
|
142
|
+
//--------------------------------------------------------------------------
|
143
|
+
internalTabChangeHandler(event) {
|
144
|
+
const targetTabsEl = event
|
145
|
+
.composedPath()
|
146
|
+
.find((el) => el.tagName === "CALCITE-TABS");
|
147
|
+
if (targetTabsEl !== this.parentTabsEl) {
|
148
|
+
return;
|
149
|
+
}
|
150
|
+
if (this.tab) {
|
151
|
+
this.selected = this.tab === event.detail.tab;
|
152
|
+
}
|
153
|
+
else {
|
154
|
+
this.getTabIndex().then((index) => {
|
155
|
+
this.selected = index === event.detail.tab;
|
156
|
+
});
|
157
|
+
}
|
158
|
+
event.stopPropagation();
|
159
|
+
}
|
160
|
+
onClick() {
|
161
|
+
this.emitActiveTab();
|
162
|
+
}
|
163
|
+
keyDownHandler(event) {
|
164
|
+
switch (event.key) {
|
165
|
+
case " ":
|
166
|
+
case "Enter":
|
167
|
+
this.emitActiveTab();
|
168
|
+
event.preventDefault();
|
169
|
+
break;
|
170
|
+
case "ArrowRight":
|
171
|
+
event.preventDefault();
|
172
|
+
if (getElementDir(this.el) === "ltr") {
|
173
|
+
this.calciteInternalTabsFocusNext.emit();
|
174
|
+
}
|
175
|
+
else {
|
176
|
+
this.calciteInternalTabsFocusPrevious.emit();
|
177
|
+
}
|
178
|
+
break;
|
179
|
+
case "ArrowLeft":
|
180
|
+
event.preventDefault();
|
181
|
+
if (getElementDir(this.el) === "ltr") {
|
182
|
+
this.calciteInternalTabsFocusPrevious.emit();
|
183
|
+
}
|
184
|
+
else {
|
185
|
+
this.calciteInternalTabsFocusNext.emit();
|
186
|
+
}
|
187
|
+
break;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
//--------------------------------------------------------------------------
|
191
|
+
//
|
192
|
+
// Public Methods
|
193
|
+
//
|
194
|
+
//--------------------------------------------------------------------------
|
195
|
+
/**
|
196
|
+
* Returns the index of the title within the `calcite-tab-nav`.
|
197
|
+
*/
|
198
|
+
async getTabIndex() {
|
199
|
+
return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-tab-title"), this.el);
|
200
|
+
}
|
201
|
+
/**
|
202
|
+
* @internal
|
203
|
+
*/
|
204
|
+
async getTabIdentifier() {
|
205
|
+
return this.tab ? this.tab : this.getTabIndex();
|
206
|
+
}
|
207
|
+
/**
|
208
|
+
* @param tabIds
|
209
|
+
* @param titleIds
|
210
|
+
* @internal
|
211
|
+
*/
|
212
|
+
async updateAriaInfo(tabIds = [], titleIds = []) {
|
213
|
+
this.controls = tabIds[titleIds.indexOf(this.el.id)] || null;
|
214
|
+
}
|
215
|
+
updateHasText() {
|
216
|
+
this.hasText = this.el.textContent.trim().length > 0;
|
217
|
+
}
|
218
|
+
setupTextContentObserver() {
|
219
|
+
var _a;
|
220
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
|
221
|
+
}
|
222
|
+
emitActiveTab(userTriggered = true) {
|
223
|
+
if (this.disabled) {
|
224
|
+
return;
|
225
|
+
}
|
226
|
+
const payload = { tab: this.tab };
|
227
|
+
this.calciteInternalTabsActivate.emit(payload);
|
228
|
+
if (userTriggered) {
|
229
|
+
this.calciteTabsActivate.emit(payload);
|
230
|
+
}
|
231
|
+
}
|
232
|
+
get el() { return this; }
|
233
|
+
static get watchers() { return {
|
234
|
+
"active": ["activeHandler"],
|
235
|
+
"selected": ["selectedHandler"]
|
236
|
+
}; }
|
237
|
+
static get style() { return tabTitleCss; }
|
238
|
+
}, [1, "calcite-tab-title", {
|
239
|
+
"active": [1540],
|
240
|
+
"selected": [1540],
|
241
|
+
"disabled": [516],
|
242
|
+
"iconEnd": [513, "icon-end"],
|
243
|
+
"iconFlipRtl": [513, "icon-flip-rtl"],
|
244
|
+
"iconStart": [513, "icon-start"],
|
245
|
+
"layout": [1537],
|
246
|
+
"position": [1537],
|
247
|
+
"scale": [1537],
|
248
|
+
"bordered": [1540],
|
249
|
+
"tab": [513],
|
250
|
+
"controls": [32],
|
251
|
+
"hasText": [32],
|
252
|
+
"getTabIndex": [64],
|
253
|
+
"getTabIdentifier": [64],
|
254
|
+
"updateAriaInfo": [64]
|
255
|
+
}, [[16, "calciteInternalTabChange", "internalTabChangeHandler"], [0, "click", "onClick"], [0, "keydown", "keyDownHandler"]]]);
|
256
|
+
function defineCustomElement() {
|
257
|
+
if (typeof customElements === "undefined") {
|
258
|
+
return;
|
259
|
+
}
|
260
|
+
const components = ["calcite-tab-title", "calcite-icon"];
|
261
|
+
components.forEach(tagName => { switch (tagName) {
|
262
|
+
case "calcite-tab-title":
|
263
|
+
if (!customElements.get(tagName)) {
|
264
|
+
customElements.define(tagName, TabTitle);
|
265
|
+
}
|
266
|
+
break;
|
267
|
+
case "calcite-icon":
|
268
|
+
if (!customElements.get(tagName)) {
|
269
|
+
defineCustomElement$1();
|
270
|
+
}
|
271
|
+
break;
|
272
|
+
} });
|
273
|
+
}
|
274
|
+
defineCustomElement();
|
275
|
+
|
276
|
+
export { TabTitle as T, defineCustomElement as d };
|
@@ -0,0 +1,154 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
7
|
+
import { g as guid } from './guid.js';
|
8
|
+
import { n as nodeListToArray } from './dom.js';
|
9
|
+
|
10
|
+
const tabCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([selected]) section,:host([selected]) .container{display:block}:host{display:none;block-size:100%;inline-size:100%}:host([selected]){display:block;block-size:100%;inline-size:100%;overflow:auto}section,.container{display:none;block-size:100%;inline-size:100%}:host([scale=s]){padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=m]){padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=l]){padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}";
|
11
|
+
|
12
|
+
const Tab = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
13
|
+
constructor() {
|
14
|
+
super();
|
15
|
+
this.__registerHost();
|
16
|
+
this.__attachShadow();
|
17
|
+
this.calciteInternalTabRegister = createEvent(this, "calciteInternalTabRegister", 6);
|
18
|
+
/**
|
19
|
+
* When `true`, the component's contents are selected.
|
20
|
+
*
|
21
|
+
* Only one tab can be selected within the `calcite-tabs` parent.
|
22
|
+
*
|
23
|
+
* @deprecated Use `selected` instead.
|
24
|
+
*/
|
25
|
+
this.active = false;
|
26
|
+
/**
|
27
|
+
* When `true`, the component's contents are selected.
|
28
|
+
*
|
29
|
+
* Only one tab can be selected within the `calcite-tabs` parent.
|
30
|
+
*/
|
31
|
+
this.selected = false;
|
32
|
+
/**
|
33
|
+
* @internal
|
34
|
+
*/
|
35
|
+
this.scale = "m";
|
36
|
+
this.guid = `calcite-tab-title-${guid()}`;
|
37
|
+
}
|
38
|
+
activeHandler(value) {
|
39
|
+
this.selected = value;
|
40
|
+
}
|
41
|
+
selectedHandler(value) {
|
42
|
+
this.active = value;
|
43
|
+
}
|
44
|
+
//--------------------------------------------------------------------------
|
45
|
+
//
|
46
|
+
// Lifecycle
|
47
|
+
//
|
48
|
+
//--------------------------------------------------------------------------
|
49
|
+
render() {
|
50
|
+
const id = this.el.id || this.guid;
|
51
|
+
return (h(Host, { "aria-labelledby": this.labeledBy, id: id }, h("div", { class: "container", role: "tabpanel", tabIndex: this.selected ? 0 : -1 }, h("section", null, h("slot", null)))));
|
52
|
+
}
|
53
|
+
connectedCallback() {
|
54
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
55
|
+
const isSelected = this.selected || this.active;
|
56
|
+
if (isSelected) {
|
57
|
+
this.activeHandler(isSelected);
|
58
|
+
this.selectedHandler(isSelected);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
componentDidLoad() {
|
62
|
+
this.calciteInternalTabRegister.emit();
|
63
|
+
}
|
64
|
+
componentWillRender() {
|
65
|
+
var _a;
|
66
|
+
this.scale = (_a = this.parentTabsEl) === null || _a === void 0 ? void 0 : _a.scale;
|
67
|
+
}
|
68
|
+
disconnectedCallback() {
|
69
|
+
var _a;
|
70
|
+
// Dispatching to body in order to be listened by other elements that are still connected to the DOM.
|
71
|
+
(_a = document.body) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent("calciteTabUnregister", {
|
72
|
+
detail: this.el
|
73
|
+
}));
|
74
|
+
}
|
75
|
+
//--------------------------------------------------------------------------
|
76
|
+
//
|
77
|
+
// Event Listeners
|
78
|
+
//
|
79
|
+
//--------------------------------------------------------------------------
|
80
|
+
internalTabChangeHandler(event) {
|
81
|
+
const targetTabsEl = event
|
82
|
+
.composedPath()
|
83
|
+
.find((el) => el.tagName === "CALCITE-TABS");
|
84
|
+
// to allow `<calcite-tabs>` to be nested we need to make sure this
|
85
|
+
// `calciteTabChange` event was actually fired from a within the same
|
86
|
+
// `<calcite-tabs>` that is the a parent of this tab.
|
87
|
+
if (targetTabsEl !== this.parentTabsEl) {
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
if (this.tab) {
|
91
|
+
this.selected = this.tab === event.detail.tab;
|
92
|
+
}
|
93
|
+
else {
|
94
|
+
this.getTabIndex().then((index) => {
|
95
|
+
this.selected = index === event.detail.tab;
|
96
|
+
});
|
97
|
+
}
|
98
|
+
event.stopPropagation();
|
99
|
+
}
|
100
|
+
//--------------------------------------------------------------------------
|
101
|
+
//
|
102
|
+
// Public Methods
|
103
|
+
//
|
104
|
+
//--------------------------------------------------------------------------
|
105
|
+
/**
|
106
|
+
* Returns the index of the component item within the tab array.
|
107
|
+
*/
|
108
|
+
async getTabIndex() {
|
109
|
+
return Array.prototype.indexOf.call(nodeListToArray(this.el.parentElement.children).filter((el) => el.matches("calcite-tab")), this.el);
|
110
|
+
}
|
111
|
+
//--------------------------------------------------------------------------
|
112
|
+
//
|
113
|
+
// Private Methods
|
114
|
+
//
|
115
|
+
//--------------------------------------------------------------------------
|
116
|
+
/**
|
117
|
+
* @param tabIds
|
118
|
+
* @param titleIds
|
119
|
+
* @internal
|
120
|
+
*/
|
121
|
+
async updateAriaInfo(tabIds = [], titleIds = []) {
|
122
|
+
this.labeledBy = titleIds[tabIds.indexOf(this.el.id)] || null;
|
123
|
+
}
|
124
|
+
get el() { return this; }
|
125
|
+
static get watchers() { return {
|
126
|
+
"active": ["activeHandler"],
|
127
|
+
"selected": ["selectedHandler"]
|
128
|
+
}; }
|
129
|
+
static get style() { return tabCss; }
|
130
|
+
}, [1, "calcite-tab", {
|
131
|
+
"tab": [513],
|
132
|
+
"active": [1540],
|
133
|
+
"selected": [1540],
|
134
|
+
"scale": [1537],
|
135
|
+
"labeledBy": [32],
|
136
|
+
"getTabIndex": [64],
|
137
|
+
"updateAriaInfo": [64]
|
138
|
+
}, [[16, "calciteInternalTabChange", "internalTabChangeHandler"]]]);
|
139
|
+
function defineCustomElement() {
|
140
|
+
if (typeof customElements === "undefined") {
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
const components = ["calcite-tab"];
|
144
|
+
components.forEach(tagName => { switch (tagName) {
|
145
|
+
case "calcite-tab":
|
146
|
+
if (!customElements.get(tagName)) {
|
147
|
+
customElements.define(tagName, Tab);
|
148
|
+
}
|
149
|
+
break;
|
150
|
+
} });
|
151
|
+
}
|
152
|
+
defineCustomElement();
|
153
|
+
|
154
|
+
export { Tab as T, defineCustomElement as d };
|
@@ -0,0 +1,188 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { proxyCustomElement, HTMLElement, h, Fragment } from '@stencil/core/internal/client';
|
7
|
+
|
8
|
+
/*!
|
9
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
10
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
11
|
+
* v1.0.0-beta.97
|
12
|
+
*/
|
13
|
+
const SLOTS = {
|
14
|
+
tabNav: "tab-nav"
|
15
|
+
};
|
16
|
+
|
17
|
+
const tabsCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:flex;flex-direction:column}:host([bordered]){box-shadow:inset 0 1px 0 var(--calcite-ui-border-1);background-color:var(--calcite-ui-foreground-1)}:host([bordered]:not([position=below])) ::slotted(calcite-tab-nav){-webkit-margin-after:-1px;margin-block-end:-1px}:host([bordered]:not([position=bottom])) ::slotted(calcite-tab-nav){-webkit-margin-after:-1px;margin-block-end:-1px}:host([bordered][position=below]) ::slotted(calcite-tab-nav){-webkit-margin-before:-1px;margin-block-start:-1px}:host([bordered][position=below]){box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1)}:host([bordered][position=bottom]){box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1)}:host([bordered]) section{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1)}:host([bordered][scale=s]) section{padding:0.75rem}:host([bordered][scale=m]) section{padding:0.5rem}:host([bordered][scale=l]) section{padding:1rem}:host([position=below]){flex-direction:column-reverse}:host([position=bottom]){flex-direction:column-reverse}section{display:flex;flex-grow:1;overflow:hidden;border-block-start-width:1px;border-block-start-color:var(--calcite-ui-border-1);border-block-start-style:solid}:host([position=below]) section{flex-direction:column-reverse;border-block-start-width:0px;border-block-end-width:1px;border-block-end-color:var(--calcite-ui-border-1)}:host([position=bottom]) section{flex-direction:column-reverse;border-block-start-width:0px;border-block-end-width:1px;border-block-end-color:var(--calcite-ui-border-1)}:host([position=below]:not([bordered])) section{border-block-end-style:solid}:host([position=bottom]:not([bordered])) section{border-block-end-style:solid}@media (forced-colors: active){:host([bordered]) section{border-block-start-width:0px;border-block-end-width:1px}:host([position=below][bordered]) section{border-block-start-width:1px;border-block-end-width:0px}:host([position=bottom][bordered]) section{border-block-start-width:1px;border-block-end-width:0px}}";
|
18
|
+
|
19
|
+
const Tabs = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
20
|
+
constructor() {
|
21
|
+
super();
|
22
|
+
this.__registerHost();
|
23
|
+
this.__attachShadow();
|
24
|
+
//--------------------------------------------------------------------------
|
25
|
+
//
|
26
|
+
// Public Properties
|
27
|
+
//
|
28
|
+
//--------------------------------------------------------------------------
|
29
|
+
/**
|
30
|
+
* Specifies the layout of the `calcite-tab-nav`, justifying the `calcite-tab-title`s to the start (`"inline"`), or across and centered (`"center"`).
|
31
|
+
*/
|
32
|
+
this.layout = "inline";
|
33
|
+
/**
|
34
|
+
* Specifies the position of the component in relation to the `calcite-tab`s. The `"above"` and `"below"` values are deprecated.
|
35
|
+
*
|
36
|
+
*/
|
37
|
+
this.position = "top";
|
38
|
+
/**
|
39
|
+
* Specifies the size of the component.
|
40
|
+
*/
|
41
|
+
this.scale = "m";
|
42
|
+
/**
|
43
|
+
* When `true`, the component will display with a folder style menu.
|
44
|
+
*/
|
45
|
+
this.bordered = false;
|
46
|
+
//--------------------------------------------------------------------------
|
47
|
+
//
|
48
|
+
// Events
|
49
|
+
//
|
50
|
+
//--------------------------------------------------------------------------
|
51
|
+
//--------------------------------------------------------------------------
|
52
|
+
//
|
53
|
+
// Private State/Props
|
54
|
+
//
|
55
|
+
//--------------------------------------------------------------------------
|
56
|
+
/**
|
57
|
+
*
|
58
|
+
* Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
|
59
|
+
* attributes.
|
60
|
+
*/
|
61
|
+
this.titles = [];
|
62
|
+
/**
|
63
|
+
*
|
64
|
+
* Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
|
65
|
+
*/
|
66
|
+
this.tabs = [];
|
67
|
+
}
|
68
|
+
//--------------------------------------------------------------------------
|
69
|
+
//
|
70
|
+
// Lifecycle
|
71
|
+
//
|
72
|
+
//--------------------------------------------------------------------------
|
73
|
+
render() {
|
74
|
+
return (h(Fragment, null, h("slot", { name: SLOTS.tabNav }), h("section", null, h("slot", null))));
|
75
|
+
}
|
76
|
+
//--------------------------------------------------------------------------
|
77
|
+
//
|
78
|
+
// Event Listeners
|
79
|
+
//
|
80
|
+
//--------------------------------------------------------------------------
|
81
|
+
/**
|
82
|
+
* @param event
|
83
|
+
* @internal
|
84
|
+
*/
|
85
|
+
calciteInternalTabTitleRegister(event) {
|
86
|
+
this.titles = [...this.titles, event.target];
|
87
|
+
this.registryHandler();
|
88
|
+
event.stopPropagation();
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* @param event
|
92
|
+
* @internal
|
93
|
+
*/
|
94
|
+
calciteTabTitleUnregister(event) {
|
95
|
+
this.titles = this.titles.filter((el) => el !== event.detail);
|
96
|
+
this.registryHandler();
|
97
|
+
event.stopPropagation();
|
98
|
+
}
|
99
|
+
/**
|
100
|
+
* @param event
|
101
|
+
* @internal
|
102
|
+
*/
|
103
|
+
calciteInternalTabRegister(event) {
|
104
|
+
this.tabs = [...this.tabs, event.target];
|
105
|
+
this.registryHandler();
|
106
|
+
event.stopPropagation();
|
107
|
+
}
|
108
|
+
/**
|
109
|
+
* @param event
|
110
|
+
* @internal
|
111
|
+
*/
|
112
|
+
calciteTabUnregister(event) {
|
113
|
+
this.tabs = this.tabs.filter((el) => el !== event.detail);
|
114
|
+
this.registryHandler();
|
115
|
+
event.stopPropagation();
|
116
|
+
}
|
117
|
+
//--------------------------------------------------------------------------
|
118
|
+
//
|
119
|
+
// Private Methods
|
120
|
+
//
|
121
|
+
//--------------------------------------------------------------------------
|
122
|
+
/**
|
123
|
+
*
|
124
|
+
* Matches up elements from the internal `tabs` and `titles` to automatically
|
125
|
+
* update the ARIA attributes and link `<calcite-tab>` and
|
126
|
+
* `<calcite-tab-title>` components.
|
127
|
+
*/
|
128
|
+
async registryHandler() {
|
129
|
+
let tabIds;
|
130
|
+
let titleIds;
|
131
|
+
// determine if we are using `tab` based or `index` based tab identifiers.
|
132
|
+
if (this.tabs.some((el) => el.tab) || this.titles.some((el) => el.tab)) {
|
133
|
+
// if we are using `tab` based identifiers sort by `tab` to account for
|
134
|
+
// possible out of order tabs and get the id of each tab
|
135
|
+
tabIds = this.tabs.sort((a, b) => a.tab.localeCompare(b.tab)).map((el) => el.id);
|
136
|
+
titleIds = this.titles.sort((a, b) => a.tab.localeCompare(b.tab)).map((el) => el.id);
|
137
|
+
}
|
138
|
+
else {
|
139
|
+
// if we are using index based tabs then the `<calcite-tab>` and
|
140
|
+
// `<calcite-tab-title>` might have been rendered out of order so the
|
141
|
+
// order of `this.tabs` and `this.titles` might not reflect the DOM state,
|
142
|
+
// and might not match each other so we need to get the index of all the
|
143
|
+
// tabs and titles in the DOM order to match them up as a source of truth
|
144
|
+
const tabDomIndexes = await Promise.all(this.tabs.map((el) => el.getTabIndex()));
|
145
|
+
const titleDomIndexes = await Promise.all(this.titles.map((el) => el.getTabIndex()));
|
146
|
+
// once we have the DOM order as a source of truth we can build the
|
147
|
+
// matching tabIds and titleIds arrays
|
148
|
+
tabIds = tabDomIndexes.reduce((ids, indexInDOM, registryIndex) => {
|
149
|
+
ids[indexInDOM] = this.tabs[registryIndex].id;
|
150
|
+
return ids;
|
151
|
+
}, []);
|
152
|
+
titleIds = titleDomIndexes.reduce((ids, indexInDOM, registryIndex) => {
|
153
|
+
ids[indexInDOM] = this.titles[registryIndex].id;
|
154
|
+
return ids;
|
155
|
+
}, []);
|
156
|
+
}
|
157
|
+
// pass all our new aria information to each `<calcite-tab>` and
|
158
|
+
// `<calcite-tab-title>` which will check if they can update their internal
|
159
|
+
// `controlled` or `labeledBy` states and re-render if necessary
|
160
|
+
this.tabs.forEach((el) => el.updateAriaInfo(tabIds, titleIds));
|
161
|
+
this.titles.forEach((el) => el.updateAriaInfo(tabIds, titleIds));
|
162
|
+
}
|
163
|
+
get el() { return this; }
|
164
|
+
static get style() { return tabsCss; }
|
165
|
+
}, [1, "calcite-tabs", {
|
166
|
+
"layout": [513],
|
167
|
+
"position": [513],
|
168
|
+
"scale": [513],
|
169
|
+
"bordered": [1540],
|
170
|
+
"titles": [32],
|
171
|
+
"tabs": [32]
|
172
|
+
}, [[0, "calciteInternalTabTitleRegister", "calciteInternalTabTitleRegister"], [16, "calciteTabTitleUnregister", "calciteTabTitleUnregister"], [0, "calciteInternalTabRegister", "calciteInternalTabRegister"], [16, "calciteTabUnregister", "calciteTabUnregister"]]]);
|
173
|
+
function defineCustomElement() {
|
174
|
+
if (typeof customElements === "undefined") {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
const components = ["calcite-tabs"];
|
178
|
+
components.forEach(tagName => { switch (tagName) {
|
179
|
+
case "calcite-tabs":
|
180
|
+
if (!customElements.get(tagName)) {
|
181
|
+
customElements.define(tagName, Tabs);
|
182
|
+
}
|
183
|
+
break;
|
184
|
+
} });
|
185
|
+
}
|
186
|
+
defineCustomElement();
|
187
|
+
|
188
|
+
export { Tabs as T, defineCustomElement as d };
|