@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,912 @@
|
|
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 { f as filter } from './filter.js';
|
8
|
+
import { d as defaultMenuPlacement, f as filterComputedPlacements, c as connectFloatingUI, u as updateAfterClose, r as reposition, a as disconnectFloatingUI, F as FloatingCSS } from './floating-ui.js';
|
9
|
+
import { g as guid } from './guid.js';
|
10
|
+
import { T as TEXT, C as ComboboxItemGroup, b as ComboboxChildSelector, c as getItemAncestors, d as getItemChildren, h as hasActiveChildren, e as ComboboxItem } from './utils2.js';
|
11
|
+
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from './label2.js';
|
12
|
+
import { s as submitForm, c as connectForm, a as afterConnectDefaultValueSet, d as disconnectForm, H as HiddenFormInputSlot } from './form.js';
|
13
|
+
import { c as createObserver } from './observers.js';
|
14
|
+
import { u as updateHostInteraction } from './interactive.js';
|
15
|
+
import { i as isPrimaryPointerButton, t as toAriaBoolean } from './dom.js';
|
16
|
+
import { c as connectOpenCloseComponent, d as disconnectOpenCloseComponent } from './openCloseComponent.js';
|
17
|
+
import { d as defineCustomElement$2 } from './chip.js';
|
18
|
+
import { d as defineCustomElement$1 } from './icon.js';
|
19
|
+
import { d as debounce } from './debounce.js';
|
20
|
+
|
21
|
+
const comboboxCss = "@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{position:relative;display:block}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([scale=s]){font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:2rem}:host([scale=l]){font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:2.75rem}.wrapper{display:flex;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);outline-color:transparent;padding-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}:host(:focus-within) .wrapper,.wrapper--active{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.wrapper--single{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;flex-wrap:nowrap}.grid-input{display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px}.input{flex-grow:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-ui-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);min-inline-size:120px;-webkit-margin-after:var(--calcite-combobox-item-spacing-unit-s);margin-block-end:var(--calcite-combobox-item-spacing-unit-s)}.input:focus{outline:2px solid transparent;outline-offset:2px}.input--transparent{opacity:0}.input--single{margin-block:0px;padding:0px}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;inline-size:0px;min-inline-size:0px;opacity:0}.input--icon{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.input-wrap{display:flex;flex-grow:1}.input-wrap--single{flex:1 1 0%;overflow:hidden}.label{pointer-events:none;display:flex;max-inline-size:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--icon{padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.icon-end,.icon-start{display:flex;inline-size:1rem;cursor:pointer;align-items:center}.icon-end{flex:none}.floating-ui-container{display:block;position:absolute;z-index:900;visibility:hidden;pointer-events:none;inline-size:0;block-size:0;overflow:hidden}.floating-ui-container .calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;visibility:visible;transform:translate(0)}.floating-ui-container--active{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}@media (forced-colors: active){.wrapper,.floating-ui-container--active{border:1px solid canvasText}}.screen-readers-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.list-container{max-block-size:45vh;overflow-y:auto;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}.list{margin:0px;display:block;padding:0px}.list--hide{block-size:0px;overflow:hidden}.chip{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);margin-inline:0 var(--calcite-combobox-item-spacing-unit-s);max-inline-size:100%}.chip--active{background-color:var(--calcite-ui-foreground-3)}.item{display:block}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
|
22
|
+
|
23
|
+
const isGroup = (el) => el.tagName === ComboboxItemGroup;
|
24
|
+
const itemUidPrefix = "combobox-item-";
|
25
|
+
const chipUidPrefix = "combobox-chip-";
|
26
|
+
const labelUidPrefix = "combobox-label-";
|
27
|
+
const listboxUidPrefix = "combobox-listbox-";
|
28
|
+
const inputUidPrefix = "combobox-input-";
|
29
|
+
const Combobox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
30
|
+
constructor() {
|
31
|
+
super();
|
32
|
+
this.__registerHost();
|
33
|
+
this.__attachShadow();
|
34
|
+
this.calciteLookupChange = createEvent(this, "calciteLookupChange", 6);
|
35
|
+
this.calciteComboboxChange = createEvent(this, "calciteComboboxChange", 6);
|
36
|
+
this.calciteComboboxFilterChange = createEvent(this, "calciteComboboxFilterChange", 6);
|
37
|
+
this.calciteComboboxChipDismiss = createEvent(this, "calciteComboboxChipDismiss", 6);
|
38
|
+
this.calciteComboboxBeforeClose = createEvent(this, "calciteComboboxBeforeClose", 6);
|
39
|
+
this.calciteComboboxClose = createEvent(this, "calciteComboboxClose", 6);
|
40
|
+
this.calciteComboboxBeforeOpen = createEvent(this, "calciteComboboxBeforeOpen", 6);
|
41
|
+
this.calciteComboboxOpen = createEvent(this, "calciteComboboxOpen", 6);
|
42
|
+
//--------------------------------------------------------------------------
|
43
|
+
//
|
44
|
+
// Public Properties
|
45
|
+
//
|
46
|
+
//--------------------------------------------------------------------------
|
47
|
+
/**
|
48
|
+
* When `true`, displays and positions the component.
|
49
|
+
*
|
50
|
+
* @deprecated use `open` instead.
|
51
|
+
*/
|
52
|
+
this.active = false;
|
53
|
+
/**When `true`, displays and positions the component. */
|
54
|
+
this.open = false;
|
55
|
+
/** When `true`, interaction is prevented and the component is displayed with lower opacity. */
|
56
|
+
this.disabled = false;
|
57
|
+
/** Specifies the maximum number of `calcite-combobox-item`s (including nested children) to display before displaying a scrollbar. */
|
58
|
+
this.maxItems = 0;
|
59
|
+
/**
|
60
|
+
* Determines the type of positioning to use for the overlaid content.
|
61
|
+
*
|
62
|
+
* Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
|
63
|
+
*
|
64
|
+
* `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
|
65
|
+
*
|
66
|
+
*/
|
67
|
+
this.overlayPositioning = "absolute";
|
68
|
+
/**
|
69
|
+
* When `true`, the component must have a value in order for the form to submit.
|
70
|
+
*
|
71
|
+
* @internal
|
72
|
+
*/
|
73
|
+
this.required = false;
|
74
|
+
/**
|
75
|
+
* Specifies the selection mode -
|
76
|
+
* `"multi"` (allow any number of selected items),
|
77
|
+
* `"single"` (allow only one selection), or
|
78
|
+
* `"ancestors"` (like `"multi"`, but show ancestors of selected items as selected. Only the deepest children are shown in `calcite-chip`s).
|
79
|
+
*/
|
80
|
+
this.selectionMode = "multi";
|
81
|
+
/** Specifies the size of the component. */
|
82
|
+
this.scale = "m";
|
83
|
+
/** The component's value(s) from the selected `calcite-combobox-item`(s). */
|
84
|
+
this.value = null;
|
85
|
+
/**
|
86
|
+
* Accessible name for the component's remove tag when a `calcite-combobox-item` is selected.
|
87
|
+
*
|
88
|
+
* @default "Remove tag"
|
89
|
+
*/
|
90
|
+
this.intlRemoveTag = TEXT.removeTag;
|
91
|
+
//--------------------------------------------------------------------------
|
92
|
+
//
|
93
|
+
// Private State/Props
|
94
|
+
//
|
95
|
+
//--------------------------------------------------------------------------
|
96
|
+
this.placement = defaultMenuPlacement;
|
97
|
+
this.internalValueChangeFlag = false;
|
98
|
+
this.items = [];
|
99
|
+
this.groupItems = [];
|
100
|
+
this.selectedItems = [];
|
101
|
+
this.visibleItems = [];
|
102
|
+
this.activeItemIndex = -1;
|
103
|
+
this.activeChipIndex = -1;
|
104
|
+
this.activeDescendant = "";
|
105
|
+
this.text = "";
|
106
|
+
this.textInput = null;
|
107
|
+
this.mutationObserver = createObserver("mutation", () => this.updateItems());
|
108
|
+
this.resizeObserver = createObserver("resize", () => this.setMaxScrollerHeight());
|
109
|
+
this.guid = guid();
|
110
|
+
this.inputHeight = 0;
|
111
|
+
this.ignoreSelectedEventsFlag = false;
|
112
|
+
this.openTransitionProp = "opacity";
|
113
|
+
// --------------------------------------------------------------------------
|
114
|
+
//
|
115
|
+
// Private Methods
|
116
|
+
//
|
117
|
+
// --------------------------------------------------------------------------
|
118
|
+
this.setFilteredPlacements = () => {
|
119
|
+
const { el, flipPlacements } = this;
|
120
|
+
this.filteredFlipPlacements = flipPlacements
|
121
|
+
? filterComputedPlacements(flipPlacements, el)
|
122
|
+
: null;
|
123
|
+
};
|
124
|
+
this.getValue = () => {
|
125
|
+
const items = this.selectedItems.map((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.toString(); });
|
126
|
+
return (items === null || items === void 0 ? void 0 : items.length) ? (items.length > 1 ? items : items[0]) : "";
|
127
|
+
};
|
128
|
+
this.onLabelClick = () => {
|
129
|
+
this.setFocus();
|
130
|
+
};
|
131
|
+
this.keydownHandler = (event) => {
|
132
|
+
const { key } = event;
|
133
|
+
switch (key) {
|
134
|
+
case "Tab":
|
135
|
+
this.activeChipIndex = -1;
|
136
|
+
this.activeItemIndex = -1;
|
137
|
+
if (this.allowCustomValues && this.text) {
|
138
|
+
this.addCustomChip(this.text, true);
|
139
|
+
event.preventDefault();
|
140
|
+
}
|
141
|
+
else if (this.open) {
|
142
|
+
this.open = false;
|
143
|
+
event.preventDefault();
|
144
|
+
}
|
145
|
+
break;
|
146
|
+
case "ArrowLeft":
|
147
|
+
this.previousChip();
|
148
|
+
event.preventDefault();
|
149
|
+
break;
|
150
|
+
case "ArrowRight":
|
151
|
+
this.nextChip();
|
152
|
+
event.preventDefault();
|
153
|
+
break;
|
154
|
+
case "ArrowUp":
|
155
|
+
event.preventDefault();
|
156
|
+
this.shiftActiveItemIndex(-1);
|
157
|
+
if (!this.comboboxInViewport()) {
|
158
|
+
this.el.scrollIntoView();
|
159
|
+
}
|
160
|
+
break;
|
161
|
+
case "ArrowDown":
|
162
|
+
event.preventDefault();
|
163
|
+
if (!this.open) {
|
164
|
+
this.open = true;
|
165
|
+
}
|
166
|
+
this.shiftActiveItemIndex(1);
|
167
|
+
if (!this.comboboxInViewport()) {
|
168
|
+
this.el.scrollIntoView();
|
169
|
+
}
|
170
|
+
break;
|
171
|
+
case " ":
|
172
|
+
if (!this.textInput.value) {
|
173
|
+
event.preventDefault();
|
174
|
+
this.open = true;
|
175
|
+
this.shiftActiveItemIndex(1);
|
176
|
+
}
|
177
|
+
break;
|
178
|
+
case "Home":
|
179
|
+
if (!this.open) {
|
180
|
+
return;
|
181
|
+
}
|
182
|
+
event.preventDefault();
|
183
|
+
this.updateActiveItemIndex(0);
|
184
|
+
this.scrollToActiveItem();
|
185
|
+
if (!this.comboboxInViewport()) {
|
186
|
+
this.el.scrollIntoView();
|
187
|
+
}
|
188
|
+
break;
|
189
|
+
case "End":
|
190
|
+
if (!this.open) {
|
191
|
+
return;
|
192
|
+
}
|
193
|
+
event.preventDefault();
|
194
|
+
this.updateActiveItemIndex(this.visibleItems.length - 1);
|
195
|
+
this.scrollToActiveItem();
|
196
|
+
if (!this.comboboxInViewport()) {
|
197
|
+
this.el.scrollIntoView();
|
198
|
+
}
|
199
|
+
break;
|
200
|
+
case "Escape":
|
201
|
+
this.open = false;
|
202
|
+
event.preventDefault();
|
203
|
+
break;
|
204
|
+
case "Enter":
|
205
|
+
if (this.activeItemIndex > -1) {
|
206
|
+
this.toggleSelection(this.visibleItems[this.activeItemIndex]);
|
207
|
+
event.preventDefault();
|
208
|
+
}
|
209
|
+
else if (this.activeChipIndex > -1) {
|
210
|
+
this.removeActiveChip();
|
211
|
+
event.preventDefault();
|
212
|
+
}
|
213
|
+
else if (this.allowCustomValues && this.text) {
|
214
|
+
this.addCustomChip(this.text, true);
|
215
|
+
event.preventDefault();
|
216
|
+
}
|
217
|
+
else if (!event.defaultPrevented) {
|
218
|
+
if (submitForm(this)) {
|
219
|
+
event.preventDefault();
|
220
|
+
}
|
221
|
+
}
|
222
|
+
break;
|
223
|
+
case "Delete":
|
224
|
+
case "Backspace":
|
225
|
+
if (this.activeChipIndex > -1) {
|
226
|
+
event.preventDefault();
|
227
|
+
this.removeActiveChip();
|
228
|
+
}
|
229
|
+
else if (!this.text && this.isMulti()) {
|
230
|
+
event.preventDefault();
|
231
|
+
this.removeLastChip();
|
232
|
+
}
|
233
|
+
break;
|
234
|
+
}
|
235
|
+
};
|
236
|
+
this.toggleCloseEnd = () => {
|
237
|
+
this.open = false;
|
238
|
+
this.el.removeEventListener("calciteComboboxClose", this.toggleCloseEnd);
|
239
|
+
};
|
240
|
+
this.toggleOpenEnd = () => {
|
241
|
+
this.open = false;
|
242
|
+
this.el.removeEventListener("calciteComboboxOpen", this.toggleOpenEnd);
|
243
|
+
};
|
244
|
+
this.setMaxScrollerHeight = async () => {
|
245
|
+
const { listContainerEl, open, referenceEl } = this;
|
246
|
+
if (!listContainerEl || !open) {
|
247
|
+
return;
|
248
|
+
}
|
249
|
+
await this.reposition(true);
|
250
|
+
const maxScrollerHeight = this.getMaxScrollerHeight();
|
251
|
+
listContainerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
|
252
|
+
listContainerEl.style.minWidth = `${referenceEl.clientWidth}px`;
|
253
|
+
await this.reposition(true);
|
254
|
+
};
|
255
|
+
this.calciteChipDismissHandler = (event, comboboxItem) => {
|
256
|
+
this.open = false;
|
257
|
+
const selection = this.items.find((item) => item === comboboxItem);
|
258
|
+
if (selection) {
|
259
|
+
this.toggleSelection(selection, false);
|
260
|
+
}
|
261
|
+
this.calciteComboboxChipDismiss.emit(event.detail);
|
262
|
+
};
|
263
|
+
this.clickHandler = (event) => {
|
264
|
+
if (event.composedPath().some((node) => node.tagName === "CALCITE-CHIP")) {
|
265
|
+
return;
|
266
|
+
}
|
267
|
+
this.open = !this.open;
|
268
|
+
this.updateActiveItemIndex(0);
|
269
|
+
this.setFocus();
|
270
|
+
};
|
271
|
+
this.setInactiveIfNotContained = (event) => {
|
272
|
+
const composedPath = event.composedPath();
|
273
|
+
if (!this.open || composedPath.includes(this.el) || composedPath.includes(this.referenceEl)) {
|
274
|
+
return;
|
275
|
+
}
|
276
|
+
if (this.allowCustomValues && this.text.trim().length) {
|
277
|
+
this.addCustomChip(this.text);
|
278
|
+
}
|
279
|
+
if (this.selectionMode === "single") {
|
280
|
+
if (this.textInput) {
|
281
|
+
this.textInput.value = "";
|
282
|
+
}
|
283
|
+
this.text = "";
|
284
|
+
this.filterItems("");
|
285
|
+
this.updateActiveItemIndex(-1);
|
286
|
+
}
|
287
|
+
this.open = false;
|
288
|
+
};
|
289
|
+
this.setFloatingEl = (el) => {
|
290
|
+
this.floatingEl = el;
|
291
|
+
connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
292
|
+
};
|
293
|
+
this.setContainerEl = (el) => {
|
294
|
+
this.resizeObserver.observe(el);
|
295
|
+
this.listContainerEl = el;
|
296
|
+
this.transitionEl = el;
|
297
|
+
connectOpenCloseComponent(this);
|
298
|
+
};
|
299
|
+
this.setReferenceEl = (el) => {
|
300
|
+
this.referenceEl = el;
|
301
|
+
connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
302
|
+
};
|
303
|
+
this.inputHandler = (event) => {
|
304
|
+
const value = event.target.value;
|
305
|
+
this.text = value;
|
306
|
+
this.filterItems(value);
|
307
|
+
if (value) {
|
308
|
+
this.activeChipIndex = -1;
|
309
|
+
}
|
310
|
+
};
|
311
|
+
this.filterItems = (() => {
|
312
|
+
const find = (item, filteredData) => item &&
|
313
|
+
filteredData.some(({ label, value }) => {
|
314
|
+
if (isGroup(item)) {
|
315
|
+
return value === item.label;
|
316
|
+
}
|
317
|
+
return (value === item.textLabel ||
|
318
|
+
value === item.value ||
|
319
|
+
label === item.textLabel ||
|
320
|
+
label === item.value);
|
321
|
+
});
|
322
|
+
return debounce((text) => {
|
323
|
+
const filteredData = filter(this.data, text);
|
324
|
+
const items = this.getCombinedItems();
|
325
|
+
items.forEach((item) => {
|
326
|
+
const hidden = !find(item, filteredData);
|
327
|
+
item.hidden = hidden;
|
328
|
+
const [parent, grandparent] = item.ancestors;
|
329
|
+
if (find(parent, filteredData) || find(grandparent, filteredData)) {
|
330
|
+
item.hidden = false;
|
331
|
+
}
|
332
|
+
if (!hidden) {
|
333
|
+
item.ancestors.forEach((ancestor) => (ancestor.hidden = false));
|
334
|
+
}
|
335
|
+
});
|
336
|
+
this.visibleItems = this.getVisibleItems();
|
337
|
+
this.calciteComboboxFilterChange.emit({ visibleItems: [...this.visibleItems], text: text });
|
338
|
+
}, 100);
|
339
|
+
})();
|
340
|
+
this.internalCalciteLookupChangeEvent = () => {
|
341
|
+
this.calciteLookupChange.emit(this.selectedItems);
|
342
|
+
};
|
343
|
+
this.emitCalciteLookupChange = debounce(this.internalCalciteLookupChangeEvent, 0);
|
344
|
+
this.internalComboboxChangeEvent = () => {
|
345
|
+
const { selectedItems } = this;
|
346
|
+
this.calciteComboboxChange.emit({ selectedItems });
|
347
|
+
};
|
348
|
+
this.emitComboboxChange = debounce(this.internalComboboxChangeEvent, 0);
|
349
|
+
this.updateItems = () => {
|
350
|
+
this.items = this.getItems();
|
351
|
+
this.groupItems = this.getGroupItems();
|
352
|
+
this.data = this.getData();
|
353
|
+
this.selectedItems = this.getSelectedItems();
|
354
|
+
this.visibleItems = this.getVisibleItems();
|
355
|
+
this.needsIcon = this.getNeedsIcon();
|
356
|
+
if (!this.allowCustomValues) {
|
357
|
+
this.setMaxScrollerHeight();
|
358
|
+
}
|
359
|
+
};
|
360
|
+
this.scrollToActiveItem = () => {
|
361
|
+
const activeItem = this.visibleItems[this.activeItemIndex];
|
362
|
+
const height = this.calculateSingleItemHeight(activeItem);
|
363
|
+
const { offsetHeight, scrollTop } = this.listContainerEl;
|
364
|
+
if (offsetHeight + scrollTop < activeItem.offsetTop + height) {
|
365
|
+
this.listContainerEl.scrollTop = activeItem.offsetTop - offsetHeight + height;
|
366
|
+
}
|
367
|
+
else if (activeItem.offsetTop < scrollTop) {
|
368
|
+
this.listContainerEl.scrollTop = activeItem.offsetTop;
|
369
|
+
}
|
370
|
+
};
|
371
|
+
this.comboboxFocusHandler = () => {
|
372
|
+
var _a;
|
373
|
+
(_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
|
374
|
+
};
|
375
|
+
this.comboboxBlurHandler = (event) => {
|
376
|
+
this.setInactiveIfNotContained(event);
|
377
|
+
};
|
378
|
+
}
|
379
|
+
activeHandler(value) {
|
380
|
+
if (this.disabled) {
|
381
|
+
this.active = false;
|
382
|
+
this.open = false;
|
383
|
+
return;
|
384
|
+
}
|
385
|
+
this.open = value;
|
386
|
+
}
|
387
|
+
openHandler(value) {
|
388
|
+
if (!value) {
|
389
|
+
updateAfterClose(this.floatingEl);
|
390
|
+
}
|
391
|
+
if (this.disabled) {
|
392
|
+
this.active = false;
|
393
|
+
this.open = false;
|
394
|
+
return;
|
395
|
+
}
|
396
|
+
this.active = value;
|
397
|
+
this.setMaxScrollerHeight();
|
398
|
+
}
|
399
|
+
handleDisabledChange(value) {
|
400
|
+
if (!value) {
|
401
|
+
this.active = false;
|
402
|
+
this.open = false;
|
403
|
+
}
|
404
|
+
}
|
405
|
+
maxItemsHandler() {
|
406
|
+
this.setMaxScrollerHeight();
|
407
|
+
}
|
408
|
+
overlayPositioningHandler() {
|
409
|
+
this.reposition(true);
|
410
|
+
}
|
411
|
+
valueHandler(value) {
|
412
|
+
if (!this.internalValueChangeFlag) {
|
413
|
+
const items = this.getItems();
|
414
|
+
if (Array.isArray(value)) {
|
415
|
+
items.forEach((item) => (item.selected = value.includes(item.value)));
|
416
|
+
}
|
417
|
+
else if (value) {
|
418
|
+
items.forEach((item) => (item.selected = value === item.value));
|
419
|
+
}
|
420
|
+
else {
|
421
|
+
items.forEach((item) => (item.selected = false));
|
422
|
+
}
|
423
|
+
this.updateItems();
|
424
|
+
}
|
425
|
+
}
|
426
|
+
flipPlacementsHandler() {
|
427
|
+
this.setFilteredPlacements();
|
428
|
+
this.reposition(true);
|
429
|
+
}
|
430
|
+
//--------------------------------------------------------------------------
|
431
|
+
//
|
432
|
+
// Event Listeners
|
433
|
+
//
|
434
|
+
//--------------------------------------------------------------------------
|
435
|
+
documentClickHandler(event) {
|
436
|
+
if (!isPrimaryPointerButton(event)) {
|
437
|
+
return;
|
438
|
+
}
|
439
|
+
this.setInactiveIfNotContained(event);
|
440
|
+
}
|
441
|
+
calciteComboboxItemChangeHandler(event) {
|
442
|
+
if (this.ignoreSelectedEventsFlag) {
|
443
|
+
return;
|
444
|
+
}
|
445
|
+
const target = event.target;
|
446
|
+
const newIndex = this.visibleItems.indexOf(target);
|
447
|
+
this.updateActiveItemIndex(newIndex);
|
448
|
+
this.toggleSelection(target, target.selected);
|
449
|
+
}
|
450
|
+
//--------------------------------------------------------------------------
|
451
|
+
//
|
452
|
+
// Public Methods
|
453
|
+
//
|
454
|
+
//--------------------------------------------------------------------------
|
455
|
+
/**
|
456
|
+
* Updates the position of the component.
|
457
|
+
*
|
458
|
+
* @param delayed
|
459
|
+
*/
|
460
|
+
async reposition(delayed = false) {
|
461
|
+
const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
|
462
|
+
return reposition(this, {
|
463
|
+
floatingEl,
|
464
|
+
referenceEl,
|
465
|
+
overlayPositioning,
|
466
|
+
placement,
|
467
|
+
flipPlacements: filteredFlipPlacements,
|
468
|
+
type: "menu"
|
469
|
+
}, delayed);
|
470
|
+
}
|
471
|
+
/** Sets focus on the component. */
|
472
|
+
async setFocus() {
|
473
|
+
var _a;
|
474
|
+
(_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
|
475
|
+
this.activeChipIndex = -1;
|
476
|
+
this.activeItemIndex = -1;
|
477
|
+
}
|
478
|
+
// --------------------------------------------------------------------------
|
479
|
+
//
|
480
|
+
// Lifecycle
|
481
|
+
//
|
482
|
+
// --------------------------------------------------------------------------
|
483
|
+
connectedCallback() {
|
484
|
+
var _a;
|
485
|
+
this.internalValueChangeFlag = true;
|
486
|
+
this.value = this.getValue();
|
487
|
+
this.internalValueChangeFlag = false;
|
488
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
|
489
|
+
connectLabel(this);
|
490
|
+
connectForm(this);
|
491
|
+
connectOpenCloseComponent(this);
|
492
|
+
this.setFilteredPlacements();
|
493
|
+
this.reposition(true);
|
494
|
+
if (this.active) {
|
495
|
+
this.activeHandler(this.active);
|
496
|
+
}
|
497
|
+
if (this.open) {
|
498
|
+
this.openHandler(this.open);
|
499
|
+
}
|
500
|
+
}
|
501
|
+
componentWillLoad() {
|
502
|
+
this.updateItems();
|
503
|
+
}
|
504
|
+
componentDidLoad() {
|
505
|
+
afterConnectDefaultValueSet(this, this.getValue());
|
506
|
+
this.reposition(true);
|
507
|
+
}
|
508
|
+
componentDidRender() {
|
509
|
+
if (this.el.offsetHeight !== this.inputHeight) {
|
510
|
+
this.reposition(true);
|
511
|
+
this.inputHeight = this.el.offsetHeight;
|
512
|
+
}
|
513
|
+
updateHostInteraction(this);
|
514
|
+
}
|
515
|
+
disconnectedCallback() {
|
516
|
+
var _a, _b;
|
517
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
518
|
+
(_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
519
|
+
disconnectLabel(this);
|
520
|
+
disconnectForm(this);
|
521
|
+
disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
|
522
|
+
disconnectOpenCloseComponent(this);
|
523
|
+
}
|
524
|
+
selectedItemsHandler() {
|
525
|
+
this.internalValueChangeFlag = true;
|
526
|
+
this.value = this.getValue();
|
527
|
+
this.internalValueChangeFlag = false;
|
528
|
+
}
|
529
|
+
/** when search text is cleared, reset active to */
|
530
|
+
textHandler() {
|
531
|
+
this.updateActiveItemIndex(-1);
|
532
|
+
}
|
533
|
+
comboboxInViewport() {
|
534
|
+
const bounding = this.el.getBoundingClientRect();
|
535
|
+
return (bounding.top >= 0 &&
|
536
|
+
bounding.left >= 0 &&
|
537
|
+
bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
|
538
|
+
bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight));
|
539
|
+
}
|
540
|
+
onBeforeOpen() {
|
541
|
+
this.calciteComboboxBeforeOpen.emit();
|
542
|
+
}
|
543
|
+
onOpen() {
|
544
|
+
this.calciteComboboxOpen.emit();
|
545
|
+
}
|
546
|
+
onBeforeClose() {
|
547
|
+
this.calciteComboboxBeforeClose.emit();
|
548
|
+
}
|
549
|
+
onClose() {
|
550
|
+
this.calciteComboboxClose.emit();
|
551
|
+
}
|
552
|
+
getMaxScrollerHeight() {
|
553
|
+
const items = this.getCombinedItems().filter((item) => !item.hidden);
|
554
|
+
const { maxItems } = this;
|
555
|
+
let itemsToProcess = 0;
|
556
|
+
let maxScrollerHeight = 0;
|
557
|
+
if (items.length > maxItems) {
|
558
|
+
items.forEach((item) => {
|
559
|
+
if (itemsToProcess < maxItems && maxItems > 0) {
|
560
|
+
const height = this.calculateSingleItemHeight(item);
|
561
|
+
if (height > 0) {
|
562
|
+
maxScrollerHeight += height;
|
563
|
+
itemsToProcess++;
|
564
|
+
}
|
565
|
+
}
|
566
|
+
});
|
567
|
+
}
|
568
|
+
return maxScrollerHeight;
|
569
|
+
}
|
570
|
+
calculateSingleItemHeight(item) {
|
571
|
+
let height = item.offsetHeight;
|
572
|
+
// if item has children items, don't count their height twice
|
573
|
+
const children = Array.from(item.querySelectorAll(ComboboxChildSelector));
|
574
|
+
children
|
575
|
+
.map((child) => child === null || child === void 0 ? void 0 : child.offsetHeight)
|
576
|
+
.forEach((offsetHeight) => {
|
577
|
+
height -= offsetHeight;
|
578
|
+
});
|
579
|
+
return height;
|
580
|
+
}
|
581
|
+
getCombinedItems() {
|
582
|
+
return [...this.groupItems, ...this.items];
|
583
|
+
}
|
584
|
+
toggleSelection(item, value = !item.selected) {
|
585
|
+
if (!item) {
|
586
|
+
return;
|
587
|
+
}
|
588
|
+
if (this.isMulti()) {
|
589
|
+
item.selected = value;
|
590
|
+
this.updateAncestors(item);
|
591
|
+
this.selectedItems = this.getSelectedItems();
|
592
|
+
this.emitCalciteLookupChange();
|
593
|
+
this.emitComboboxChange();
|
594
|
+
this.resetText();
|
595
|
+
this.filterItems("");
|
596
|
+
}
|
597
|
+
else {
|
598
|
+
this.ignoreSelectedEventsFlag = true;
|
599
|
+
this.items.forEach((el) => (el.selected = el === item ? value : false));
|
600
|
+
this.ignoreSelectedEventsFlag = false;
|
601
|
+
this.selectedItems = this.getSelectedItems();
|
602
|
+
this.emitComboboxChange();
|
603
|
+
if (this.textInput) {
|
604
|
+
this.textInput.value = item.textLabel;
|
605
|
+
}
|
606
|
+
this.open = false;
|
607
|
+
this.updateActiveItemIndex(-1);
|
608
|
+
this.resetText();
|
609
|
+
this.filterItems("");
|
610
|
+
}
|
611
|
+
}
|
612
|
+
updateAncestors(item) {
|
613
|
+
if (this.selectionMode !== "ancestors") {
|
614
|
+
return;
|
615
|
+
}
|
616
|
+
const ancestors = getItemAncestors(item);
|
617
|
+
const children = getItemChildren(item);
|
618
|
+
if (item.selected) {
|
619
|
+
ancestors.forEach((el) => {
|
620
|
+
el.selected = true;
|
621
|
+
});
|
622
|
+
}
|
623
|
+
else {
|
624
|
+
children.forEach((el) => (el.selected = false));
|
625
|
+
[...ancestors].forEach((el) => {
|
626
|
+
if (!hasActiveChildren(el)) {
|
627
|
+
el.selected = false;
|
628
|
+
}
|
629
|
+
});
|
630
|
+
}
|
631
|
+
}
|
632
|
+
getVisibleItems() {
|
633
|
+
return this.items.filter((item) => !item.hidden);
|
634
|
+
}
|
635
|
+
getSelectedItems() {
|
636
|
+
if (!this.isMulti()) {
|
637
|
+
const match = this.items.find(({ selected }) => selected);
|
638
|
+
return match ? [match] : [];
|
639
|
+
}
|
640
|
+
return (this.items
|
641
|
+
.filter((item) => item.selected && (this.selectionMode !== "ancestors" || !hasActiveChildren(item)))
|
642
|
+
/** Preserve order of entered tags */
|
643
|
+
.sort((a, b) => {
|
644
|
+
const aIdx = this.selectedItems.indexOf(a);
|
645
|
+
const bIdx = this.selectedItems.indexOf(b);
|
646
|
+
if (aIdx > -1 && bIdx > -1) {
|
647
|
+
return aIdx - bIdx;
|
648
|
+
}
|
649
|
+
return bIdx - aIdx;
|
650
|
+
}));
|
651
|
+
}
|
652
|
+
getData() {
|
653
|
+
return this.items.map((item) => ({
|
654
|
+
constant: item.constant,
|
655
|
+
filterDisabled: item.filterDisabled,
|
656
|
+
value: item.value,
|
657
|
+
label: item.textLabel
|
658
|
+
}));
|
659
|
+
}
|
660
|
+
getNeedsIcon() {
|
661
|
+
return this.selectionMode === "single" && this.items.some((item) => item.icon);
|
662
|
+
}
|
663
|
+
resetText() {
|
664
|
+
if (this.textInput) {
|
665
|
+
this.textInput.value = "";
|
666
|
+
}
|
667
|
+
this.text = "";
|
668
|
+
}
|
669
|
+
getItems() {
|
670
|
+
const items = Array.from(this.el.querySelectorAll(ComboboxItem));
|
671
|
+
return items.filter((item) => !item.disabled);
|
672
|
+
}
|
673
|
+
getGroupItems() {
|
674
|
+
return Array.from(this.el.querySelectorAll(ComboboxItemGroup));
|
675
|
+
}
|
676
|
+
addCustomChip(value, focus) {
|
677
|
+
const existingItem = this.items.find((el) => el.textLabel === value);
|
678
|
+
if (existingItem) {
|
679
|
+
this.toggleSelection(existingItem, true);
|
680
|
+
}
|
681
|
+
else {
|
682
|
+
if (!this.isMulti()) {
|
683
|
+
this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
|
684
|
+
}
|
685
|
+
const item = document.createElement(ComboboxItem);
|
686
|
+
item.value = value;
|
687
|
+
item.textLabel = value;
|
688
|
+
item.selected = true;
|
689
|
+
this.el.appendChild(item);
|
690
|
+
this.resetText();
|
691
|
+
if (focus) {
|
692
|
+
this.setFocus();
|
693
|
+
}
|
694
|
+
this.updateItems();
|
695
|
+
this.filterItems("");
|
696
|
+
this.emitCalciteLookupChange();
|
697
|
+
this.emitComboboxChange();
|
698
|
+
}
|
699
|
+
}
|
700
|
+
removeActiveChip() {
|
701
|
+
this.toggleSelection(this.selectedItems[this.activeChipIndex], false);
|
702
|
+
this.setFocus();
|
703
|
+
}
|
704
|
+
removeLastChip() {
|
705
|
+
this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
|
706
|
+
this.setFocus();
|
707
|
+
}
|
708
|
+
previousChip() {
|
709
|
+
if (this.text) {
|
710
|
+
return;
|
711
|
+
}
|
712
|
+
const length = this.selectedItems.length - 1;
|
713
|
+
const active = this.activeChipIndex;
|
714
|
+
this.activeChipIndex = active === -1 ? length : Math.max(active - 1, 0);
|
715
|
+
this.updateActiveItemIndex(-1);
|
716
|
+
this.focusChip();
|
717
|
+
}
|
718
|
+
nextChip() {
|
719
|
+
if (this.text || this.activeChipIndex === -1) {
|
720
|
+
return;
|
721
|
+
}
|
722
|
+
const last = this.selectedItems.length - 1;
|
723
|
+
const newIndex = this.activeChipIndex + 1;
|
724
|
+
if (newIndex > last) {
|
725
|
+
this.activeChipIndex = -1;
|
726
|
+
this.setFocus();
|
727
|
+
}
|
728
|
+
else {
|
729
|
+
this.activeChipIndex = newIndex;
|
730
|
+
this.focusChip();
|
731
|
+
}
|
732
|
+
this.updateActiveItemIndex(-1);
|
733
|
+
}
|
734
|
+
focusChip() {
|
735
|
+
var _a;
|
736
|
+
const guid = (_a = this.selectedItems[this.activeChipIndex]) === null || _a === void 0 ? void 0 : _a.guid;
|
737
|
+
const chip = guid
|
738
|
+
? this.referenceEl.querySelector(`#${chipUidPrefix}${guid}`)
|
739
|
+
: null;
|
740
|
+
chip === null || chip === void 0 ? void 0 : chip.setFocus();
|
741
|
+
}
|
742
|
+
shiftActiveItemIndex(delta) {
|
743
|
+
const { length } = this.visibleItems;
|
744
|
+
const newIndex = (this.activeItemIndex + length + delta) % length;
|
745
|
+
this.updateActiveItemIndex(newIndex);
|
746
|
+
this.scrollToActiveItem();
|
747
|
+
}
|
748
|
+
updateActiveItemIndex(index) {
|
749
|
+
var _a;
|
750
|
+
this.activeItemIndex = index;
|
751
|
+
let activeDescendant = null;
|
752
|
+
this.visibleItems.forEach((el, i) => {
|
753
|
+
if (i === index) {
|
754
|
+
el.active = true;
|
755
|
+
activeDescendant = `${itemUidPrefix}${el.guid}`;
|
756
|
+
}
|
757
|
+
else {
|
758
|
+
el.active = false;
|
759
|
+
}
|
760
|
+
});
|
761
|
+
this.activeDescendant = activeDescendant;
|
762
|
+
if (this.activeItemIndex > -1) {
|
763
|
+
this.activeChipIndex = -1;
|
764
|
+
(_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
|
765
|
+
}
|
766
|
+
}
|
767
|
+
isMulti() {
|
768
|
+
return this.selectionMode !== "single";
|
769
|
+
}
|
770
|
+
//--------------------------------------------------------------------------
|
771
|
+
//
|
772
|
+
// Render Methods
|
773
|
+
//
|
774
|
+
//--------------------------------------------------------------------------
|
775
|
+
renderChips() {
|
776
|
+
const { activeChipIndex, scale, selectionMode, intlRemoveTag } = this;
|
777
|
+
return this.selectedItems.map((item, i) => {
|
778
|
+
const chipClasses = {
|
779
|
+
chip: true,
|
780
|
+
"chip--active": activeChipIndex === i
|
781
|
+
};
|
782
|
+
const ancestors = [...getItemAncestors(item)].reverse();
|
783
|
+
const pathLabel = [...ancestors, item].map((el) => el.textLabel);
|
784
|
+
const label = selectionMode !== "ancestors" ? item.textLabel : pathLabel.join(" / ");
|
785
|
+
return (h("calcite-chip", { class: chipClasses, dismissLabel: intlRemoveTag, dismissible: true, icon: item.icon, id: item.guid ? `${chipUidPrefix}${item.guid}` : null, key: item.textLabel, onCalciteChipDismiss: (event) => this.calciteChipDismissHandler(event, item), scale: scale, title: label, value: item.value }, label));
|
786
|
+
});
|
787
|
+
}
|
788
|
+
renderInput() {
|
789
|
+
const { guid, active, disabled, placeholder, selectionMode, selectedItems, open } = this;
|
790
|
+
const single = selectionMode === "single";
|
791
|
+
const selectedItem = selectedItems[0];
|
792
|
+
const showLabel = !(open || active) && single && !!selectedItem;
|
793
|
+
return (h("span", { class: {
|
794
|
+
"input-wrap": true,
|
795
|
+
"input-wrap--single": single
|
796
|
+
} }, showLabel && (h("span", { class: {
|
797
|
+
label: true,
|
798
|
+
"label--icon": !!(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon)
|
799
|
+
}, key: "label" }, selectedItem.textLabel)), h("input", { "aria-activedescendant": this.activeDescendant, "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-label": getLabelText(this), class: {
|
800
|
+
input: true,
|
801
|
+
"input--single": true,
|
802
|
+
"input--transparent": this.activeChipIndex > -1,
|
803
|
+
"input--hidden": showLabel,
|
804
|
+
"input--icon": !!this.placeholderIcon
|
805
|
+
}, disabled: disabled, id: `${inputUidPrefix}${guid}`, key: "input", onBlur: this.comboboxBlurHandler, onFocus: this.comboboxFocusHandler, onInput: this.inputHandler, placeholder: placeholder, ref: (el) => (this.textInput = el), type: "text" })));
|
806
|
+
}
|
807
|
+
renderListBoxOptions() {
|
808
|
+
return this.visibleItems.map((item) => (h("li", { "aria-selected": toAriaBoolean(item.selected), id: item.guid ? `${itemUidPrefix}${item.guid}` : null, role: "option", tabindex: "-1" }, item.textLabel)));
|
809
|
+
}
|
810
|
+
renderFloatingUIContainer() {
|
811
|
+
const { active, setFloatingEl, setContainerEl, open } = this;
|
812
|
+
const classes = {
|
813
|
+
"list-container": true,
|
814
|
+
[FloatingCSS.animation]: true,
|
815
|
+
[FloatingCSS.animationActive]: open || active
|
816
|
+
};
|
817
|
+
return (h("div", { "aria-hidden": "true", class: {
|
818
|
+
"floating-ui-container": true,
|
819
|
+
"floating-ui-container--active": open || active
|
820
|
+
}, ref: setFloatingEl }, h("div", { class: classes, ref: setContainerEl }, h("ul", { class: { list: true, "list--hide": !(open || active) } }, h("slot", null)))));
|
821
|
+
}
|
822
|
+
renderIconStart() {
|
823
|
+
const { selectedItems, placeholderIcon, selectionMode } = this;
|
824
|
+
const selectedItem = selectedItems[0];
|
825
|
+
const selectedIcon = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon;
|
826
|
+
const singleSelectionMode = selectionMode === "single";
|
827
|
+
const iconAtStart = !this.open && selectedItem
|
828
|
+
? !!selectedIcon && singleSelectionMode
|
829
|
+
: !!this.placeholderIcon && (!selectedItem || singleSelectionMode);
|
830
|
+
return (iconAtStart && (h("span", { class: "icon-start" }, h("calcite-icon", { class: "selected-icon", icon: !this.open && selectedItem ? selectedIcon : placeholderIcon, scale: "s" }))));
|
831
|
+
}
|
832
|
+
renderIconEnd() {
|
833
|
+
const { active, open } = this;
|
834
|
+
return (h("span", { class: "icon-end" }, h("calcite-icon", { icon: active || open ? "chevron-up" : "chevron-down", scale: "s" })));
|
835
|
+
}
|
836
|
+
render() {
|
837
|
+
const { active, guid, label, open } = this;
|
838
|
+
const single = this.selectionMode === "single";
|
839
|
+
return (h(Host, null, h("div", { "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-expanded": toAriaBoolean(open || active), "aria-haspopup": "listbox", "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-live": "polite", "aria-owns": `${listboxUidPrefix}${guid}`, class: {
|
840
|
+
wrapper: true,
|
841
|
+
"wrapper--single": single || !this.selectedItems.length,
|
842
|
+
"wrapper--active": open || active
|
843
|
+
}, onClick: this.clickHandler, onKeyDown: this.keydownHandler, ref: this.setReferenceEl, role: "combobox" }, h("div", { class: "grid-input" }, this.renderIconStart(), !single && this.renderChips(), h("label", { class: "screen-readers-only", htmlFor: `${inputUidPrefix}${guid}`, id: `${labelUidPrefix}${guid}` }, label), this.renderInput()), this.renderIconEnd()), h("ul", { "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-multiselectable": "true", class: "screen-readers-only", id: `${listboxUidPrefix}${guid}`, role: "listbox", tabIndex: -1 }, this.renderListBoxOptions()), this.renderFloatingUIContainer(), h(HiddenFormInputSlot, { component: this })));
|
844
|
+
}
|
845
|
+
get el() { return this; }
|
846
|
+
static get watchers() { return {
|
847
|
+
"active": ["activeHandler"],
|
848
|
+
"open": ["openHandler"],
|
849
|
+
"disabled": ["handleDisabledChange"],
|
850
|
+
"maxItems": ["maxItemsHandler"],
|
851
|
+
"overlayPositioning": ["overlayPositioningHandler"],
|
852
|
+
"value": ["valueHandler"],
|
853
|
+
"flipPlacements": ["flipPlacementsHandler"],
|
854
|
+
"selectedItems": ["selectedItemsHandler"],
|
855
|
+
"text": ["textHandler"]
|
856
|
+
}; }
|
857
|
+
static get style() { return comboboxCss; }
|
858
|
+
}, [1, "calcite-combobox", {
|
859
|
+
"active": [1540],
|
860
|
+
"open": [1540],
|
861
|
+
"disabled": [516],
|
862
|
+
"label": [1],
|
863
|
+
"placeholder": [1],
|
864
|
+
"placeholderIcon": [513, "placeholder-icon"],
|
865
|
+
"maxItems": [514, "max-items"],
|
866
|
+
"name": [513],
|
867
|
+
"allowCustomValues": [516, "allow-custom-values"],
|
868
|
+
"overlayPositioning": [513, "overlay-positioning"],
|
869
|
+
"required": [516],
|
870
|
+
"selectionMode": [513, "selection-mode"],
|
871
|
+
"scale": [513],
|
872
|
+
"value": [1025],
|
873
|
+
"intlRemoveTag": [1, "intl-remove-tag"],
|
874
|
+
"flipPlacements": [16],
|
875
|
+
"items": [32],
|
876
|
+
"groupItems": [32],
|
877
|
+
"selectedItems": [32],
|
878
|
+
"visibleItems": [32],
|
879
|
+
"needsIcon": [32],
|
880
|
+
"activeItemIndex": [32],
|
881
|
+
"activeChipIndex": [32],
|
882
|
+
"activeDescendant": [32],
|
883
|
+
"text": [32],
|
884
|
+
"reposition": [64],
|
885
|
+
"setFocus": [64]
|
886
|
+
}, [[5, "pointerdown", "documentClickHandler"], [0, "calciteComboboxItemChange", "calciteComboboxItemChangeHandler"]]]);
|
887
|
+
function defineCustomElement() {
|
888
|
+
if (typeof customElements === "undefined") {
|
889
|
+
return;
|
890
|
+
}
|
891
|
+
const components = ["calcite-combobox", "calcite-chip", "calcite-icon"];
|
892
|
+
components.forEach(tagName => { switch (tagName) {
|
893
|
+
case "calcite-combobox":
|
894
|
+
if (!customElements.get(tagName)) {
|
895
|
+
customElements.define(tagName, Combobox);
|
896
|
+
}
|
897
|
+
break;
|
898
|
+
case "calcite-chip":
|
899
|
+
if (!customElements.get(tagName)) {
|
900
|
+
defineCustomElement$2();
|
901
|
+
}
|
902
|
+
break;
|
903
|
+
case "calcite-icon":
|
904
|
+
if (!customElements.get(tagName)) {
|
905
|
+
defineCustomElement$1();
|
906
|
+
}
|
907
|
+
break;
|
908
|
+
} });
|
909
|
+
}
|
910
|
+
defineCustomElement();
|
911
|
+
|
912
|
+
export { Combobox as C, defineCustomElement as d };
|