@orangelogic/design-system 2.60.0 → 2.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library/apps/cortex/src/types.d.ts +2 -0
- package/library/chunks/_baseRest.ClTMQtN1.js +67 -0
- package/library/chunks/{_baseUniq.BUihBa8c.js → _baseUniq.Df-fLIBx.js} +53 -56
- package/library/chunks/{amazon_s3.DeaMdPPn.js → amazon_s3.BEMtqafk.js} +1 -1
- package/library/chunks/animate.El-MpOws.js +37 -0
- package/library/chunks/animation-registry.HmpwNuGH.js +34 -0
- package/library/chunks/{animation.B7d72NVK.js → animation.DfUHRQry.js} +10 -8
- package/library/chunks/array.DCtvHiLS.js +81 -0
- package/library/chunks/asset.CG_yXtWK.js +288 -0
- package/library/chunks/{browser.Va59Ix3P.js → browser.BHOCIF_A.js} +18 -16
- package/library/chunks/{button.CtCSNRB3.js → button.P71VJ5xh.js} +75 -74
- package/library/chunks/{button.styles.C8AIO8fd.js → button.styles.Dl5IQLHU.js} +1 -1
- package/library/chunks/{capitalize.CNStXZBq.js → capitalize.WSkCXkNE.js} +1 -1
- package/library/chunks/{chatbot.sm4Rph1v.js → chatbot.BmpIu59L.js} +2 -2
- package/library/chunks/{class-map.CoZTSvbM.js → class-map.BiVq-cVR.js} +1 -1
- package/library/chunks/{color-swatch-group.qJevXs50.js → color-swatch-group.DlLmydlB.js} +116 -127
- package/library/chunks/color-swatch.Bpb_hW2H.js +407 -0
- package/library/chunks/color.vLD2sNTs.js +164 -0
- package/library/chunks/{component.styles.CI-v8BZa.js → component.styles.DMSLciL5.js} +1 -1
- package/library/chunks/{confirm-popover.D2TF1x6K.js → confirm-popover.C1uA36JR.js} +15 -13
- package/library/chunks/{content-builder.WranV3P4.js → content-builder.Bf7kqzDI.js} +1 -1
- package/library/chunks/converters.DkDtLstb.js +11 -0
- package/library/chunks/{cropper.aA0v16xS.js → cropper.BraEEykE.js} +5004 -5024
- package/library/chunks/custom-element.L4WJXn1j.js +14 -0
- package/library/chunks/debounce.DaHuiSGU.js +15 -0
- package/library/chunks/{default-value.CIKAvD5l.js → default-value.COZopaet.js} +1 -1
- package/library/chunks/{dialog.B1TORO6S.js → dialog.C_75RVVz.js} +52 -49
- package/library/chunks/{directive-helpers.DBHob-_L.js → directive-helpers.Dm4rc594.js} +1 -1
- package/library/chunks/dom.CZrJ64Dm.js +92 -0
- package/library/chunks/{dot-pagination.8f2oX_ge.js → dot-pagination.CoCIJsHC.js} +24 -22
- package/library/chunks/{endpoints.BgyupJys.js → endpoints.B7lcoc1N.js} +1 -3
- package/library/chunks/{file-on-demand.Cwgabdyw.js → file-on-demand.B2jNilAj.js} +1829 -1544
- package/library/chunks/{folder-select.DiWCwR-T.js → folder-select.CSEQxIXF.js} +380 -255
- package/library/chunks/{form-control.styles.NE2Q-quE.js → form-control.styles.CUGhvlfT.js} +1 -1
- package/library/chunks/{form.B8u0ywni.js → form.CO12-VK0.js} +1 -1
- package/library/chunks/{guard.BDP4A85K.js → guard.D4axKaMo.js} +1 -1
- package/library/chunks/{header.B_FD8uLt.js → header.Bd3G0-oA.js} +11 -9
- package/library/chunks/{hub-connection.CxfaT11o.js → hub-connection.BxT2b7Nq.js} +4 -3
- package/library/chunks/{i18n.BP2FRO1v.js → i18n.DrzK7TPf.js} +54 -7
- package/library/chunks/identity.ByMq8VxU.js +6 -0
- package/library/chunks/{if-defined.MfEgpxEN.js → if-defined.BRoBj_Rp.js} +1 -1
- package/library/chunks/{iframe.DZm7FiCl.js → iframe.UCj6Ze2A.js} +18 -16
- package/library/chunks/{image.Ycf8RudS.js → image.DZCRhE3G.js} +82 -79
- package/library/chunks/image.mbpyiQpQ.js +82 -0
- package/library/chunks/index.S0wy3rzm.js +373 -0
- package/library/chunks/isObjectLike.D3cpZO39.js +81 -0
- package/library/chunks/{isSymbol.L0C2ND_U.js → isSymbol.huJ_Cvxt.js} +1 -1
- package/library/chunks/lib-cortex-element.CVMmyPMC.js +146 -0
- package/library/chunks/{list-editor.COkw5JKG.js → list-editor.CrLntuM7.js} +75 -79
- package/library/chunks/{custom-element.vnXBMQxc.js → lit-element.jLBm65_O.js} +123 -277
- package/library/chunks/{live.LdB9xEhp.js → live.SCz6M8Gs.js} +2 -2
- package/library/chunks/{mailchimp.BjbPJfd-.js → mailchimp.Bs6uJVsf.js} +1 -1
- package/library/chunks/{modal.BqNLxgs1.js → modal.U1QltQKe.js} +25 -19
- package/library/chunks/{option.D9KJhzHs.js → option.D1u5-cTt.js} +21 -19
- package/library/chunks/{orangelogic.BgbQXkBv.js → orangelogic.TdFfoPUN.js} +1 -1
- package/library/chunks/{overlayscrollbars.aFuRG5Rs.js → overlayscrollbars.XhGWx9Zk.js} +1 -1
- package/library/chunks/{pagination.C2FN4fmO.js → pagination.BI3LONVU.js} +17 -15
- package/library/chunks/{ref.BaCjlzLO.js → ref.bzeTdX0K.js} +2 -2
- package/library/chunks/{repeat.CauKaXyy.js → repeat.DbF2p5ae.js} +2 -2
- package/library/chunks/responsive.CA6dcNiM.js +17 -0
- package/library/chunks/{scroll.DwPiX2Ox.js → scroll.xtO5yojm.js} +3 -2
- package/library/chunks/{slot.DJLm4Dig.js → slot.j5oheLJC.js} +12 -4
- package/library/chunks/{state.Cw55xXlb.js → state.CSDxrqLd.js} +1 -1
- package/library/chunks/{static.BjNkqt7_.js → static.UA3G1Deq.js} +1 -1
- package/library/chunks/string.Cp_XNbnV.js +160 -0
- package/library/chunks/{style-map.CZovMmo_.js → style-map.llVFPd__.js} +1 -1
- package/library/chunks/{tab-group.5fLnWflv.js → tab-group.DxSlcWK0.js} +20 -18
- package/library/chunks/{table.BAr8KKc6.js → table.CY-iMTWV.js} +457 -505
- package/library/chunks/template.CsJd8Pb_.js +20 -0
- package/library/chunks/time.D_uFZqqe.js +118 -0
- package/library/chunks/{toString.CL_lYXbK.js → toString.CRT5zqEU.js} +3 -3
- package/library/chunks/toast.BXNbwZV8.js +25 -0
- package/library/chunks/{tree.CUfvIDyA.js → tree.CNbrP8cY.js} +33 -36
- package/library/chunks/{typography.BFpl0WMA.js → typography.oDzoLbZS.js} +16 -14
- package/library/chunks/{unsafe-html.DyO9_Rsq.js → unsafe-html.Dff7-rCx.js} +1 -1
- package/library/chunks/url.LjsR2sB5.js +15 -0
- package/library/chunks/user-agent.D9aPuOyL.js +4 -0
- package/library/chunks/watch.q1sEjPWL.js +501 -0
- package/library/components/alert.js +38 -35
- package/library/components/animated-image.js +25 -23
- package/library/components/animation.js +7 -5
- package/library/components/array-line-clamp.d.ts +3 -0
- package/library/components/array-line-clamp.js +195 -0
- package/library/components/asset-link-format.js +223 -212
- package/library/components/atoms.js +164 -162
- package/library/components/avatar.js +28 -26
- package/library/components/badge.js +10 -8
- package/library/components/bicolor-picker.js +21 -19
- package/library/components/border-input-group.js +11 -9
- package/library/components/breadcrumb-item.js +14 -12
- package/library/components/breadcrumb.js +24 -22
- package/library/components/button-group.js +26 -24
- package/library/components/button.js +14 -13
- package/library/components/card.js +28 -19
- package/library/components/checkbox.js +29 -23
- package/library/components/color-picker.js +19 -17
- package/library/components/color-swatch-group.js +20 -17
- package/library/components/color-swatch.js +16 -13
- package/library/components/confirm-popover.js +11 -9
- package/library/components/copy-button.js +15 -13
- package/library/components/corner-position-input-group.js +13 -11
- package/library/components/cortex-element.d.ts +3 -0
- package/library/components/cortex-element.js +5 -0
- package/library/components/cropper.js +7 -5
- package/library/components/details.js +23 -20
- package/library/components/dialog.js +19 -16
- package/library/components/divider.js +13 -11
- package/library/components/dot-pagination.js +11 -9
- package/library/components/dot-status.js +10 -8
- package/library/components/drawer.js +63 -51
- package/library/components/dropdown.js +29 -26
- package/library/components/dynamic-select.js +12 -10
- package/library/components/element-clamp.js +28 -25
- package/library/components/file-on-demand.js +21 -20
- package/library/components/folder-select.js +12 -10
- package/library/components/format-bytes.js +11 -10
- package/library/components/format-date.js +11 -9
- package/library/components/format-number.js +16 -15
- package/library/components/format-time.js +118 -9
- package/library/components/grid-item.js +48 -46
- package/library/components/grid.js +31 -29
- package/library/components/header.js +10 -9
- package/library/components/hub-connection.js +6 -5
- package/library/components/icon-button.js +20 -18
- package/library/components/icon.js +17 -15
- package/library/components/iframe.js +10 -8
- package/library/components/image-comparer.js +27 -25
- package/library/components/image.js +14 -11
- package/library/components/include.js +26 -24
- package/library/components/input-group.js +15 -13
- package/library/components/input.js +23 -21
- package/library/components/line-clamp.js +12 -10
- package/library/components/list-editor.js +17 -15
- package/library/components/markdown.js +80 -78
- package/library/components/masonry.js +46 -44
- package/library/components/menu-item.js +151 -136
- package/library/components/menu-label.js +15 -13
- package/library/components/menu-section.js +18 -16
- package/library/components/menu.js +10 -8
- package/library/components/molecules.js +5 -5
- package/library/components/mutation-observer.js +12 -10
- package/library/components/option.js +10 -8
- package/library/components/organisms.js +2 -2
- package/library/components/padding-input-group.js +30 -28
- package/library/components/pagination.js +14 -12
- package/library/components/popup.js +3296 -9
- package/library/components/position-picker.js +12 -10
- package/library/components/progress-bar.js +13 -11
- package/library/components/progress-ring.js +15 -13
- package/library/components/qr-code.js +54 -52
- package/library/components/radio-button.js +19 -17
- package/library/components/radio-card.js +14 -12
- package/library/components/radio-group.js +20 -18
- package/library/components/radio.js +15 -13
- package/library/components/range.js +25 -23
- package/library/components/rating.js +17 -15
- package/library/components/relative-time.js +16 -14
- package/library/components/resize-observer.js +21 -19
- package/library/components/select.js +1442 -25
- package/library/components/shadow-input-group.js +19 -17
- package/library/components/share-option-list.js +20 -18
- package/library/components/sidebar.js +14 -12
- package/library/components/size-input-group.js +35 -33
- package/library/components/skeleton.js +12 -10
- package/library/components/space.js +12 -10
- package/library/components/spinner.js +17 -15
- package/library/components/split-panel.js +15 -13
- package/library/components/step.js +18 -16
- package/library/components/stepper-wizard.js +11 -9
- package/library/components/stepper.js +13 -11
- package/library/components/switch.js +21 -19
- package/library/components/tab-group.js +15 -13
- package/library/components/tab-panel.js +20 -18
- package/library/components/tab.js +18 -16
- package/library/components/table.js +69 -67
- package/library/components/tag.js +11 -9
- package/library/components/textarea.js +20 -18
- package/library/components/timecode.js +98 -8
- package/library/components/tooltip.js +24 -21
- package/library/components/tree-item.js +14 -11
- package/library/components/tree.js +12 -10
- package/library/components/typeface.js +13 -11
- package/library/components/types.js +15487 -15444
- package/library/components/typography.js +6 -4
- package/library/components/video.js +13 -11
- package/library/components/visually-hidden.js +15 -13
- package/library/events.d.ts +1 -0
- package/library/events.js +1 -0
- package/library/package.json +11 -2
- package/library/packages/atoms/src/components/array-line-clamp/array-line-clamp.d.ts +45 -0
- package/library/packages/atoms/src/components/array-line-clamp/array-line-clamp.styles.d.ts +2 -0
- package/library/packages/atoms/src/components/checkbox/checkbox.d.ts +2 -0
- package/library/packages/atoms/src/components/drawer/drawer.d.ts +7 -1
- package/library/packages/atoms/src/components/include/include.d.ts +1 -0
- package/library/packages/atoms/src/components/menu-item/menu-item.d.ts +2 -0
- package/library/packages/atoms/src/components/tree/tree.d.ts +0 -4
- package/library/packages/atoms/src/index.d.ts +1 -0
- package/library/packages/events/src/cx-file-on-demand-load-more.d.ts +8 -0
- package/library/packages/events/src/cx-file-on-demand-pin.d.ts +8 -0
- package/library/packages/events/src/cx-file-on-demand-unpin.d.ts +8 -0
- package/library/packages/events/src/cx-folder-select-search-term-change.d.ts +8 -0
- package/library/packages/events/src/cx-share-option-list-item-selected.d.ts +8 -0
- package/library/packages/events/src/events.d.ts +6 -2
- package/library/packages/molecules/src/asset-picker/asset-picker.d.ts +2 -0
- package/library/packages/molecules/src/cropper/cropper.d.ts +1 -0
- package/library/packages/molecules/src/cropper/react/Cropper.d.ts +1 -0
- package/library/packages/molecules/src/download-format-picker/download-format-picker.d.ts +1 -0
- package/library/packages/molecules/src/folder-select/components/folder-select-tree/folder-select-tree.d.ts +8 -0
- package/library/packages/molecules/src/folder-select/components/folder-select-tree-item/folder-select-tree-item.d.ts +1 -0
- package/library/packages/molecules/src/folder-select/folder-select.d.ts +6 -1
- package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +3 -7
- package/library/packages/organisms/src/content-builder/styleController.d.ts +8 -8
- package/library/packages/organisms/src/file-on-demand/components/file-on-demand-asset/file-on-demand-asset.d.ts +80 -0
- package/library/packages/organisms/src/file-on-demand/components/file-on-demand-asset/file-on-demand-asset.styles.d.ts +2 -0
- package/library/packages/organisms/src/file-on-demand/components/file-on-demand-pinned-status.ts/file-on-demand-pinned-status.d.ts +44 -0
- package/library/packages/organisms/src/file-on-demand/file-on-demand.constants.d.ts +1 -0
- package/library/packages/organisms/src/file-on-demand/file-on-demand.d.ts +11 -18
- package/library/packages/organisms/src/file-on-demand/file-on-demand.utils.d.ts +6 -0
- package/library/packages/services/src/api/folder/folder.d.ts +4 -8
- package/library/packages/services/src/api/folder/folder.types.d.ts +2 -1
- package/library/packages/types/src/file-on-demand.d.ts +4 -0
- package/library/packages/types/src/folder-select.d.ts +9 -2
- package/library/packages/utils/src/custom-element/i18n.d.ts +40 -2
- package/library/packages/utils/src/drag-scroll/drag-scroll.d.ts +22 -0
- package/library/packages/utils/src/drag-scroll/index.d.ts +1 -0
- package/library/packages/utils/src/font/font.d.ts +26 -0
- package/library/packages/utils/src/font/index.d.ts +1 -0
- package/library/packages/utils/src/history-manager/history-manager.d.ts +13 -0
- package/library/packages/utils/src/history-manager/index.d.ts +1 -0
- package/library/packages/utils/src/index.d.ts +45 -0
- package/library/packages/utils/src/template/index.d.ts +1 -0
- package/library/packages/utils/src/template/template.d.ts +3 -0
- package/library/react-web-component.d.ts +418 -360
- package/library/utils.d.ts +1 -0
- package/library/utils.js +180 -0
- package/package.json +11 -2
- package/library/chunks/animation-registry.DavRkTTr.js +0 -69
- package/library/chunks/asset.Ba-CxnNM.js +0 -309
- package/library/chunks/color-swatch.DUe3iLLo.js +0 -558
- package/library/chunks/dom.C0OFx7ND.js +0 -78
- package/library/chunks/format-time.BW6-ZWCX.js +0 -226
- package/library/chunks/isObjectLike.z36Fu426.js +0 -34
- package/library/chunks/popup._w5T7x8f.js +0 -3307
- package/library/chunks/select.DfO4de04.js +0 -1441
- package/library/chunks/string.BCk3SmdZ.js +0 -144
- package/library/chunks/timecode.D7XTiQ_3.js +0 -105
- package/library/chunks/watch.BCJD77bD.js +0 -547
- package/library/packages/events/src/cx-load-more.d.ts +0 -8
|
@@ -1,27 +1,1444 @@
|
|
|
1
|
-
import "./line-clamp.js";
|
|
2
|
-
import "../chunks/typography.
|
|
3
|
-
import "../chunks/
|
|
4
|
-
import "../chunks/component.styles.
|
|
5
|
-
import "../chunks/form-control.styles.
|
|
6
|
-
import "../chunks/
|
|
7
|
-
import "../chunks/
|
|
8
|
-
import "../chunks/
|
|
9
|
-
import "../chunks/
|
|
10
|
-
import "../chunks/
|
|
11
|
-
import "../chunks/
|
|
12
|
-
import "../chunks/
|
|
13
|
-
import {
|
|
14
|
-
import "../chunks/
|
|
15
|
-
import "../chunks/
|
|
16
|
-
import "../chunks/
|
|
17
|
-
import "../chunks/
|
|
18
|
-
import "../chunks/
|
|
19
|
-
import "../chunks/
|
|
20
|
-
import "
|
|
21
|
-
import "../chunks/
|
|
22
|
-
import "../chunks/
|
|
23
|
-
import "./
|
|
24
|
-
import "
|
|
1
|
+
import O from "./line-clamp.js";
|
|
2
|
+
import { C } from "../chunks/typography.oDzoLbZS.js";
|
|
3
|
+
import { n as o, C as S } from "../chunks/lib-cortex-element.CVMmyPMC.js";
|
|
4
|
+
import { c as k } from "../chunks/component.styles.DMSLciL5.js";
|
|
5
|
+
import { f as z } from "../chunks/form-control.styles.CUGhvlfT.js";
|
|
6
|
+
import { s as x, a as y } from "../chunks/animate.El-MpOws.js";
|
|
7
|
+
import { c as D } from "../chunks/custom-element.L4WJXn1j.js";
|
|
8
|
+
import { d as I } from "../chunks/default-value.COZopaet.js";
|
|
9
|
+
import { w as v } from "../chunks/event.mFzZi4sr.js";
|
|
10
|
+
import { F as L } from "../chunks/form.CO12-VK0.js";
|
|
11
|
+
import { L as $ } from "../chunks/i18n.DrzK7TPf.js";
|
|
12
|
+
import { s as T } from "../chunks/scroll.xtO5yojm.js";
|
|
13
|
+
import { H as E } from "../chunks/slot.j5oheLJC.js";
|
|
14
|
+
import { i as B } from "../chunks/user-agent.D9aPuOyL.js";
|
|
15
|
+
import { w as h } from "../chunks/watch.q1sEjPWL.js";
|
|
16
|
+
import { i as F, x as p, E as A } from "../chunks/lit-element.jLBm65_O.js";
|
|
17
|
+
import { r as f } from "../chunks/state.CSDxrqLd.js";
|
|
18
|
+
import { e as u } from "../chunks/query.BBf1UFkC.js";
|
|
19
|
+
import { e as b } from "../chunks/class-map.BiVq-cVR.js";
|
|
20
|
+
import { o as V } from "../chunks/unsafe-html.Dff7-rCx.js";
|
|
21
|
+
import { n as m } from "../chunks/when.Dr1es41R.js";
|
|
22
|
+
import { s as w, g as _ } from "../chunks/animation-registry.HmpwNuGH.js";
|
|
23
|
+
import P from "./icon.js";
|
|
24
|
+
import { C as d } from "../chunks/option.D1u5-cTt.js";
|
|
25
|
+
import M from "./popup.js";
|
|
26
|
+
import U from "./spinner.js";
|
|
27
|
+
import N from "./tag.js";
|
|
28
|
+
const R = (e) => !(document.createElement(e.tagName).constructor === HTMLElement || customElements.get(e.tagName.toLowerCase())), W = F`
|
|
29
|
+
:host {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([data-user-invalid])::part(combobox) {
|
|
34
|
+
border-color: var(--cx-input-invalid-border-color);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([data-user-invalid]:focus-within)::part(combobox) {
|
|
38
|
+
border-color: var(--cx-input-invalid-border-color);
|
|
39
|
+
box-shadow: var(--cx-input-invalid-shadow);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The popup */
|
|
43
|
+
.select {
|
|
44
|
+
flex: 1 1 auto;
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
width: 100%;
|
|
47
|
+
position: relative;
|
|
48
|
+
vertical-align: middle;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.select::part(popup) {
|
|
52
|
+
z-index: var(--cx-z-index-dropdown);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.select[data-current-placement^='top']::part(popup) {
|
|
56
|
+
transform-origin: bottom;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.select[data-current-placement^='bottom']::part(popup) {
|
|
60
|
+
transform-origin: top;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Combobox */
|
|
64
|
+
.select__combobox {
|
|
65
|
+
flex: 1;
|
|
66
|
+
display: flex;
|
|
67
|
+
position: relative;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: start;
|
|
70
|
+
font-family: var(--cx-input-font-family);
|
|
71
|
+
font-weight: var(--cx-input-font-weight);
|
|
72
|
+
letter-spacing: var(--cx-input-letter-spacing);
|
|
73
|
+
vertical-align: middle;
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
transition:
|
|
77
|
+
var(--cx-transition-fast) color,
|
|
78
|
+
var(--cx-transition-fast) border,
|
|
79
|
+
var(--cx-transition-fast) box-shadow,
|
|
80
|
+
var(--cx-transition-fast) background-color;
|
|
81
|
+
/*
|
|
82
|
+
match default width of HTMLInputElement, so that in multiselect mode,
|
|
83
|
+
when display input gets hidden, the select doesn't shrink
|
|
84
|
+
*/
|
|
85
|
+
width: 20ch;
|
|
86
|
+
min-width: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.select__display-input {
|
|
90
|
+
position: relative;
|
|
91
|
+
width: 100%;
|
|
92
|
+
font: inherit;
|
|
93
|
+
border: none;
|
|
94
|
+
background: none;
|
|
95
|
+
color: var(--cx-input-color);
|
|
96
|
+
cursor: inherit;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
margin: 0;
|
|
99
|
+
padding: 0;
|
|
100
|
+
-webkit-appearance: none;
|
|
101
|
+
text-overflow: ellipsis;
|
|
102
|
+
transition: padding-top 0.2s ease-in-out;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.select__tags + .select__display-input {
|
|
106
|
+
padding-top: var(--cx-spacing-2x-small);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.select__display-input--small {
|
|
110
|
+
line-height: var(--cx-line-height-small);
|
|
111
|
+
}
|
|
112
|
+
.select__display-input--medium {
|
|
113
|
+
line-height: var(--cx-line-height-medium);
|
|
114
|
+
}
|
|
115
|
+
.select__display-input--large {
|
|
116
|
+
line-height: var(--cx-line-height-large);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.select__display-input--hidden {
|
|
120
|
+
/**
|
|
121
|
+
* Use visibility instead of overflow hidden since browser force input to be overflow clip
|
|
122
|
+
* Use height 0 instead of display none for smoother transition
|
|
123
|
+
*/
|
|
124
|
+
height: 0;
|
|
125
|
+
padding-top: 0 !important;
|
|
126
|
+
visibility: hidden;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.form-control--has-label .select__display-input {
|
|
130
|
+
padding-top: var(--cx-spacing-x-small);
|
|
131
|
+
padding-bottom: var(--cx-spacing-2x-small);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.select__display-input::placeholder {
|
|
135
|
+
color: var(--cx-input-placeholder-color);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.select:not(.select--disabled):hover .select__display-input {
|
|
139
|
+
color: var(--cx-input-color-hover);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.select:not(.select--disabled):hover .select__combobox {
|
|
143
|
+
border-color: var(--cx-input-border-color-hover);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.select__display-input:focus {
|
|
147
|
+
outline: none;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.select__value-input {
|
|
151
|
+
position: absolute;
|
|
152
|
+
top: 0;
|
|
153
|
+
left: 0;
|
|
154
|
+
width: 100%;
|
|
155
|
+
height: 100%;
|
|
156
|
+
padding: 0;
|
|
157
|
+
margin: 0;
|
|
158
|
+
opacity: 0;
|
|
159
|
+
z-index: -1;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.select__tags {
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
flex-wrap: wrap;
|
|
166
|
+
max-width: 100%;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.form-control--has-label .select__tags {
|
|
170
|
+
margin-top: var(--cx-spacing-x-small);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** In multiple mode, select__tags is displayed instead of display__input
|
|
174
|
+
* Make sure select__tags have the same height as a display__input of the same size
|
|
175
|
+
*/
|
|
176
|
+
.select--small:not(.select--placeholder-visible) .select__tags {
|
|
177
|
+
min-height: var(--cx-line-height-medium);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.select--medium:not(.select--placeholder-visible) .select__tags {
|
|
181
|
+
min-height: var(--cx-line-height-medium);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.select--large:not(.select--placeholder-visible) .select__tags {
|
|
185
|
+
min-height: var(--cx-line-height-medium);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.select__tags::slotted(cx-tag) {
|
|
189
|
+
cursor: pointer !important;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.select--disabled .select__tags,
|
|
193
|
+
.select--disabled .select__tags::slotted(cx-tag) {
|
|
194
|
+
cursor: default !important;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.select__tag-wrapper {
|
|
198
|
+
line-height: 1;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* Standard selects */
|
|
202
|
+
.select--standard .select__combobox {
|
|
203
|
+
background-color: var(--cx-input-background-color);
|
|
204
|
+
border: solid var(--cx-input-border-width) var(--cx-input-border-color);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.select--standard.select--disabled .select__combobox {
|
|
208
|
+
background-color: var(--cx-input-background-color-disabled);
|
|
209
|
+
border-color: var(--cx-input-border-color-disabled);
|
|
210
|
+
color: var(--cx-input-color-disabled);
|
|
211
|
+
opacity: 0.5;
|
|
212
|
+
cursor: default;
|
|
213
|
+
outline: none;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.select--standard:not(.select--disabled).select--open .select__combobox,
|
|
217
|
+
.select--standard:not(.select--disabled).select--focused .select__combobox {
|
|
218
|
+
background-color: var(--cx-input-background-color-focus);
|
|
219
|
+
border-color: var(--cx-input-border-color-focus);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* Filled selects */
|
|
223
|
+
.select--filled .select__combobox {
|
|
224
|
+
border: none;
|
|
225
|
+
background-color: var(--cx-input-filled-background-color);
|
|
226
|
+
color: var(--cx-input-color);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.select--filled:hover:not(.select--disabled) .select__combobox {
|
|
230
|
+
background-color: var(--cx-input-filled-background-color-hover);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.select--filled.select--disabled .select__combobox {
|
|
234
|
+
background-color: var(--cx-input-filled-background-color-disabled);
|
|
235
|
+
opacity: 0.5;
|
|
236
|
+
cursor: default;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.select--filled:not(.select--disabled).select--open .select__combobox,
|
|
240
|
+
.select--filled:not(.select--disabled).select--focused .select__combobox {
|
|
241
|
+
background-color: var(--cx-input-filled-background-color-focus);
|
|
242
|
+
outline: var(--cx-focus-ring);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* Sizes */
|
|
246
|
+
.select--small .select__combobox {
|
|
247
|
+
border-radius: var(--cx-input-border-radius-small);
|
|
248
|
+
font-size: var(--cx-input-font-size-small);
|
|
249
|
+
min-height: var(--cx-input-height-small);
|
|
250
|
+
padding-block: 0;
|
|
251
|
+
padding-inline: var(--cx-input-spacing-small);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.form-control:not(.form-control--has-label)
|
|
255
|
+
.select--small.select--multiple
|
|
256
|
+
.select__combobox {
|
|
257
|
+
padding-block: 2px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.form-control:not(.form-control--has-label)
|
|
261
|
+
.select--multiple
|
|
262
|
+
.select__display-input {
|
|
263
|
+
margin-top: 0;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.form-control:not(.form-control--has-label) .input-container {
|
|
267
|
+
justify-content: center;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.form-control:not(.form-control--has-label)
|
|
271
|
+
.input-container
|
|
272
|
+
.select__display-input {
|
|
273
|
+
margin-top: 0;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.select--small .select__clear {
|
|
277
|
+
margin-inline-start: var(--cx-input-spacing-small);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.select--small .select__prefix::slotted(*) {
|
|
281
|
+
margin-inline-end: var(--cx-input-spacing-small);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.select--small .select__tags {
|
|
285
|
+
gap: 2px;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.select--medium .select__combobox {
|
|
289
|
+
border-radius: var(--cx-input-border-radius-medium);
|
|
290
|
+
font-size: var(--cx-input-font-size-small);
|
|
291
|
+
min-height: var(--cx-input-height-medium);
|
|
292
|
+
padding-block: 0;
|
|
293
|
+
padding-inline: var(--cx-input-spacing-medium);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.form-control:not(.form-control--has-label)
|
|
297
|
+
.select--medium.select--multiple
|
|
298
|
+
.select__combobox {
|
|
299
|
+
padding-block: 3px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.select--medium .select__clear {
|
|
303
|
+
margin-inline-start: var(--cx-input-spacing-medium);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.select--medium .select__prefix::slotted(*) {
|
|
307
|
+
margin-inline-end: var(--cx-input-spacing-medium);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.select--medium .select__tags {
|
|
311
|
+
gap: 3px;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.select--large .select__combobox {
|
|
315
|
+
border-radius: var(--cx-input-border-radius-large);
|
|
316
|
+
font-size: var(--cx-input-font-size-small);
|
|
317
|
+
min-height: var(--cx-input-height-large);
|
|
318
|
+
padding-block: 0;
|
|
319
|
+
padding-inline: var(--cx-input-spacing-large);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.form-control:not(.form-control--has-label)
|
|
323
|
+
.select--large.select--multiple
|
|
324
|
+
.select__combobox {
|
|
325
|
+
padding-block: 4px;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.select--large .select__clear {
|
|
329
|
+
margin-inline-start: var(--cx-input-spacing-large);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.select--large .select__prefix::slotted(*) {
|
|
333
|
+
margin-inline-end: var(--cx-input-spacing-large);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.select--large .select__tags {
|
|
337
|
+
gap: 4px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* Pills */
|
|
341
|
+
.select--pill.select--small .select__combobox {
|
|
342
|
+
border-radius: var(--cx-input-height-small);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.select--pill.select--medium .select__combobox {
|
|
346
|
+
border-radius: var(--cx-input-height-medium);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.select--pill.select--large .select__combobox {
|
|
350
|
+
border-radius: var(--cx-input-height-large);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/* Prefix */
|
|
354
|
+
.select__prefix {
|
|
355
|
+
flex: 0;
|
|
356
|
+
display: inline-flex;
|
|
357
|
+
align-items: center;
|
|
358
|
+
color: var(--cx-input-placeholder-color);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/* Suffix */
|
|
362
|
+
.select__suffix {
|
|
363
|
+
flex: 0;
|
|
364
|
+
display: inline-flex;
|
|
365
|
+
align-items: center;
|
|
366
|
+
color: var(--cx-input-placeholder-color);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/* Clear button */
|
|
370
|
+
.select__clear {
|
|
371
|
+
display: inline-flex;
|
|
372
|
+
align-items: center;
|
|
373
|
+
justify-content: center;
|
|
374
|
+
font-size: inherit;
|
|
375
|
+
color: var(--cx-input-icon-color);
|
|
376
|
+
border: none;
|
|
377
|
+
background: none;
|
|
378
|
+
padding: 0;
|
|
379
|
+
transition: var(--cx-transition-fast) color;
|
|
380
|
+
cursor: pointer;
|
|
381
|
+
z-index: 1;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.select__clear:hover {
|
|
385
|
+
color: var(--cx-input-icon-color-hover);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.select__clear:focus {
|
|
389
|
+
outline: none;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/* Expand icon */
|
|
393
|
+
.select__expand-icon {
|
|
394
|
+
flex: 0 0 auto;
|
|
395
|
+
display: flex;
|
|
396
|
+
align-items: center;
|
|
397
|
+
transition: var(--cx-transition-medium) rotate ease;
|
|
398
|
+
rotate: 0;
|
|
399
|
+
margin-inline-start: var(--cx-spacing-small);
|
|
400
|
+
font-size: var(--cx-font-size-large);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.select--open .select__expand-icon {
|
|
404
|
+
rotate: -180deg;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* Listbox */
|
|
408
|
+
.select__listbox {
|
|
409
|
+
display: block;
|
|
410
|
+
position: relative;
|
|
411
|
+
font-family: var(--cx-font-sans);
|
|
412
|
+
font-size: var(--cx-font-size-medium);
|
|
413
|
+
font-weight: var(--cx-font-weight-regular);
|
|
414
|
+
box-shadow: var(--cx-shadow-large);
|
|
415
|
+
background: var(--cx-panel-background-color);
|
|
416
|
+
border: solid var(--cx-panel-border-width) var(--cx-panel-border-color);
|
|
417
|
+
border-radius: var(--cx-border-radius-large);
|
|
418
|
+
padding-block: var(--cx-spacing-x-small);
|
|
419
|
+
padding-inline: 0;
|
|
420
|
+
overflow: auto;
|
|
421
|
+
overscroll-behavior: none;
|
|
422
|
+
|
|
423
|
+
/* Make sure it adheres to the popup's auto size */
|
|
424
|
+
max-width: var(--auto-size-available-width);
|
|
425
|
+
max-height: var(--auto-size-available-height);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.select__listbox ::slotted(cx-divider) {
|
|
429
|
+
--spacing: var(--cx-spacing-x-small);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.select__listbox ::slotted(small) {
|
|
433
|
+
display: block;
|
|
434
|
+
font-size: var(--cx-font-size-small);
|
|
435
|
+
color: var(--cx-color-neutral-500);
|
|
436
|
+
padding-block: var(--cx-spacing-2x-small);
|
|
437
|
+
padding-inline: var(--cx-spacing-small);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.select__no-options {
|
|
441
|
+
display: block;
|
|
442
|
+
font-size: var(--cx-font-size-small);
|
|
443
|
+
color: var(--cx-color-neutral-500);
|
|
444
|
+
padding-block: var(--cx-spacing-2x-small);
|
|
445
|
+
padding-inline: var(--cx-spacing-small);
|
|
446
|
+
text-align: left;
|
|
447
|
+
cursor: default;
|
|
448
|
+
user-select: none;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/*
|
|
452
|
+
* Adapt label to be inside select
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
.input-container {
|
|
456
|
+
position: relative;
|
|
457
|
+
display: inline-flex;
|
|
458
|
+
flex-direction: column;
|
|
459
|
+
flex: 1;
|
|
460
|
+
width: 0;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.input-container__display-value {
|
|
464
|
+
display: flex;
|
|
465
|
+
flex-direction: row;
|
|
466
|
+
flex-wrap: wrap;
|
|
467
|
+
column-gap: var(--cx-spacing-small);
|
|
468
|
+
row-gap: var(--cx-spacing-3x-small);
|
|
469
|
+
height: 100%;
|
|
470
|
+
width: 100%;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/* Center label vertically + same style as input value */
|
|
474
|
+
.form-control__label {
|
|
475
|
+
position: relative;
|
|
476
|
+
-webkit-transition: transform 0.2s ease-in-out;
|
|
477
|
+
-moz-transition: transform 0.2s ease-in-out;
|
|
478
|
+
transition: transform 0.2s ease-in-out;
|
|
479
|
+
pointer-events: none;
|
|
480
|
+
width: fit-content;
|
|
481
|
+
line-height: 1; /* use line-height: 1 for easier transform calculation */
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/* when empty with no placeholder (initial state), transform label to vertical center
|
|
485
|
+
= (input height - label height) / 2
|
|
486
|
+
*/
|
|
487
|
+
.select--small .form-control__label {
|
|
488
|
+
transform: translateY(
|
|
489
|
+
calc(
|
|
490
|
+
(
|
|
491
|
+
var(--cx-input-height-small) +
|
|
492
|
+
1.25rem - var(--cx-input-font-size-small)
|
|
493
|
+
) /
|
|
494
|
+
2
|
|
495
|
+
)
|
|
496
|
+
);
|
|
497
|
+
margin: 0;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.select--medium .form-control__label {
|
|
501
|
+
transform: translateY(
|
|
502
|
+
calc(
|
|
503
|
+
(
|
|
504
|
+
var(--cx-input-height-medium) / 2 +
|
|
505
|
+
1rem - var(--cx-input-font-size-medium)
|
|
506
|
+
)
|
|
507
|
+
)
|
|
508
|
+
);
|
|
509
|
+
margin: 0;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.select--large .form-control__label {
|
|
513
|
+
transform: translateY(
|
|
514
|
+
calc(
|
|
515
|
+
(
|
|
516
|
+
var(--cx-input-height-large) +
|
|
517
|
+
1rem - var(--cx-input-font-size-large)
|
|
518
|
+
) /
|
|
519
|
+
2
|
|
520
|
+
)
|
|
521
|
+
);
|
|
522
|
+
margin: 0;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/* Increase input height if there's a label */
|
|
526
|
+
.form-control--has-label .select--small {
|
|
527
|
+
min-height: calc(var(--cx-input-height-small) + 1rem);
|
|
528
|
+
}
|
|
529
|
+
.form-control--has-label .select--medium {
|
|
530
|
+
min-height: calc(var(--cx-input-height-medium) + 1rem);
|
|
531
|
+
}
|
|
532
|
+
.form-control--has-label .select--large {
|
|
533
|
+
min-height: calc(var(--cx-input-height-large) + 1rem);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/* When focused or not empty, transform label to top
|
|
537
|
+
Instead of 0, use var(--cx-spacing-2x-small) to have a distance from top
|
|
538
|
+
*/
|
|
539
|
+
.form-control--has-label .select--focused .form-control__label,
|
|
540
|
+
.form-control--has-label .select--placeholder-visible .form-control__label,
|
|
541
|
+
.form-control--has-label .select:not(.select--empty) .form-control__label {
|
|
542
|
+
transform: translateY(
|
|
543
|
+
calc(var(--cx-spacing-2x-small) + var(--cx-spacing-3x-small))
|
|
544
|
+
); /* distance from top */
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/* Display options in vertical direction */
|
|
548
|
+
.select__listbox slot {
|
|
549
|
+
display: flex;
|
|
550
|
+
flex-direction: column;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/*
|
|
554
|
+
* Input groups support a variety of input types (e.g. inputs with tooltips, inputs as dropdown triggers, etc.).
|
|
555
|
+
* This means inputs aren't always direct descendants of the input group, thus we can't target them with the
|
|
556
|
+
* ::slotted selector. To work around this, the input group component does some magic to add these special classes to
|
|
557
|
+
* inputs and we style them here instead.
|
|
558
|
+
*/
|
|
559
|
+
|
|
560
|
+
:host(
|
|
561
|
+
[data-cx-input-group__input--first]:not(
|
|
562
|
+
[data-cx-input-group__input--last]
|
|
563
|
+
)
|
|
564
|
+
)
|
|
565
|
+
.select__combobox {
|
|
566
|
+
border-start-end-radius: 0;
|
|
567
|
+
border-end-end-radius: 0;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
:host([data-cx-input-group__input--inner]) .select__combobox {
|
|
571
|
+
border-radius: 0;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
:host(
|
|
575
|
+
[data-cx-input-group__input--last]:not(
|
|
576
|
+
[data-cx-input-group__input--first]
|
|
577
|
+
)
|
|
578
|
+
)
|
|
579
|
+
.select__combobox {
|
|
580
|
+
border-start-start-radius: 0;
|
|
581
|
+
border-end-start-radius: 0;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/* All except the first */
|
|
585
|
+
:host([data-cx-input-group__input]:not([data-cx-input-group__input--first])) {
|
|
586
|
+
margin-inline-start: calc(-1 * var(--cx-input-border-width));
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/* Bump hovered, focused, and checked inputs up so their focus ring isn't clipped */
|
|
590
|
+
:host([data-cx-input-group__input--hover]) {
|
|
591
|
+
z-index: 1;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/* Focus and checked are always on top */
|
|
595
|
+
:host([data-cx-input-group__input--focus]),
|
|
596
|
+
:host([data-cx-input-group__input][checked]) {
|
|
597
|
+
z-index: 2;
|
|
598
|
+
}
|
|
599
|
+
`;
|
|
600
|
+
var H = Object.defineProperty, q = Object.getOwnPropertyDescriptor, s = (e, t, l, n) => {
|
|
601
|
+
for (var a = n > 1 ? void 0 : n ? q(t, l) : t, r = e.length - 1, c; r >= 0; r--)
|
|
602
|
+
(c = e[r]) && (a = (n ? c(t, l, a) : c(a)) || a);
|
|
603
|
+
return n && a && H(t, l, a), a;
|
|
604
|
+
};
|
|
605
|
+
let i = class extends S {
|
|
606
|
+
constructor() {
|
|
607
|
+
super(...arguments), this.formControlController = new L(this, {
|
|
608
|
+
assumeInteractionOn: ["cx-input"]
|
|
609
|
+
}), this.hasSlotController = new E(
|
|
610
|
+
this,
|
|
611
|
+
"help-text",
|
|
612
|
+
"label"
|
|
613
|
+
), this.localize = new $(this), this.typeToSelectString = "", this.hasFocus = !1, this.displayLabel = "", this.selectedOptions = [], this.name = "", this.value = "", this.defaultValue = "", this.size = "medium", this.placeholder = "", this.allowFreetext = !1, this.multiple = !1, this.maxOptionsVisible = 3, this.disabled = !1, this.clearable = !1, this.open = !1, this.hoist = !1, this.noFlip = !1, this.freeWidth = !1, this.autosizePadding = 10, this.filled = !1, this.pill = !1, this.label = "", this.placement = "bottom", this.helpText = "", this.form = void 0, this.required = !1, this.useTag = !1, this.noSelectOnEnter = !1, this.noResetCurrent = !1, this.noDropdown = !1, this.loading = !1, this.getTag = (e) => {
|
|
614
|
+
const t = this.hasSlotController.test("label"), n = (this.label ? !0 : !!t) ? this.size === "large" ? "medium" : "small" : this.size, a = (r) => {
|
|
615
|
+
this.handleTagRemove(r, e);
|
|
616
|
+
};
|
|
617
|
+
return p`
|
|
618
|
+
<cx-tag
|
|
619
|
+
part="tag"
|
|
620
|
+
exportparts="
|
|
621
|
+
base:tag__base,
|
|
622
|
+
content:tag__content,
|
|
623
|
+
remove-button:tag__remove-button,
|
|
624
|
+
remove-button__base:tag__remove-button__base
|
|
625
|
+
"
|
|
626
|
+
?pill=${this.pill}
|
|
627
|
+
size=${n}
|
|
628
|
+
?removable=${this.multiple}
|
|
629
|
+
@cx-remove=${a}
|
|
630
|
+
>
|
|
631
|
+
<cx-line-clamp lines="1">
|
|
632
|
+
${this.getOptionLabel(e)}
|
|
633
|
+
</cx-line-clamp>
|
|
634
|
+
</cx-tag>
|
|
635
|
+
`;
|
|
636
|
+
}, this.inputBehavior = "filter", this.getOptionValue = (e) => !e || !(e instanceof d) ? "" : e.value, this.getOptionLabel = (e) => !e || !(e instanceof d) ? "" : e.getTextLabel(), this.getOptionSelected = (e) => {
|
|
637
|
+
if (!(!e || !(e instanceof d)))
|
|
638
|
+
return e.selected;
|
|
639
|
+
}, this.getOptionDisabled = (e) => {
|
|
640
|
+
if (!(!e || !(e instanceof d)))
|
|
641
|
+
return e.disabled;
|
|
642
|
+
}, this.stayOpenOnSelect = !1, this.forceOnChange = !1, this.allowDefaultMouseDown = !1, this.noOptionText = "", this.handleDocumentFocusIn = (e) => {
|
|
643
|
+
const t = e.composedPath();
|
|
644
|
+
this && !t.includes(this) && !this.stayOpenOnSelect && this.hide();
|
|
645
|
+
}, this.handleDocumentKeyDown = (e) => {
|
|
646
|
+
const t = e.target, l = t.closest(".select__clear") !== null, n = t.closest("cx-icon-button") !== null;
|
|
647
|
+
if (!(l || n)) {
|
|
648
|
+
if (e.key === "Escape" && this.open && !this.closeWatcher) {
|
|
649
|
+
(this.shouldShowNoOptionsMessage || this.getVisibleOptions().length > 0) && e.stopPropagation(), e.preventDefault(), this.hide(), this.displayInput.focus({ preventScroll: !0 });
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
if (e.key === "Enter") {
|
|
653
|
+
if (e.preventDefault(), e.stopImmediatePropagation(), this.emit("cx-enter", {
|
|
654
|
+
detail: {
|
|
655
|
+
value: this.displayInput.value
|
|
656
|
+
}
|
|
657
|
+
}), !this.open) {
|
|
658
|
+
this.show();
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
if (this.currentOption && !this.getOptionDisabled(this.currentOption)) {
|
|
662
|
+
if (!this.noSelectOnEnter) {
|
|
663
|
+
if (this.multiple)
|
|
664
|
+
switch (this.toggleOptionSelection(this.currentOption), this.displayLabel = "", this.displayInput.value = "", this.typeToSelectString = "", this.inputBehavior) {
|
|
665
|
+
case "filter": {
|
|
666
|
+
this.filterOptionsByInput();
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
case "select":
|
|
670
|
+
this.selectOptionByInput();
|
|
671
|
+
}
|
|
672
|
+
else
|
|
673
|
+
this.setSelectedOptions(this.currentOption);
|
|
674
|
+
this.updateComplete.then(() => {
|
|
675
|
+
this.emit("cx-input"), this.emit("cx-change");
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
!this.multiple && !this.stayOpenOnSelect && (this.hide(), this.displayInput.focus({ preventScroll: !0 }));
|
|
679
|
+
}
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
if (["ArrowUp", "ArrowDown", "Home", "End"].includes(e.key)) {
|
|
683
|
+
const a = this.getAllOptions().filter((g) => this.inputBehavior === "filter" ? !g.hidden : !0), r = this.currentOption ? a.indexOf(this.currentOption) : -1;
|
|
684
|
+
let c = Math.max(0, r);
|
|
685
|
+
if (e.preventDefault(), !this.open && (this.show(), this.currentOption))
|
|
686
|
+
return;
|
|
687
|
+
e.key === "ArrowDown" ? (c = r + 1, c > a.length - 1 && (c = 0)) : e.key === "ArrowUp" ? (c = r - 1, c < 0 && (c = a.length - 1)) : e.key === "Home" ? c = 0 : e.key === "End" && (c = a.length - 1), this.setCurrentOption(a[c]);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}, this.handleDocumentMouseDown = (e) => {
|
|
691
|
+
const t = e.composedPath();
|
|
692
|
+
this && !t.includes(this) && !this.stayOpenOnSelect && this.hide();
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Gets whether to show the no options message
|
|
697
|
+
*/
|
|
698
|
+
get shouldShowNoOptionsMessage() {
|
|
699
|
+
return !!this.noOptionText && this.getVisibleOptions().length === 0;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Gets the validity state object
|
|
703
|
+
*/
|
|
704
|
+
get validity() {
|
|
705
|
+
return this.valueInput.validity;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Gets the validation message
|
|
709
|
+
*/
|
|
710
|
+
get validationMessage() {
|
|
711
|
+
return this.valueInput.validationMessage;
|
|
712
|
+
}
|
|
713
|
+
// #region Overridable methods
|
|
714
|
+
/**
|
|
715
|
+
*
|
|
716
|
+
* @param option The option to update the selected state
|
|
717
|
+
* @param selected If undefined, the option will be toggled. If true, the option will be selected. If false, the option will be unselected.
|
|
718
|
+
* @returns
|
|
719
|
+
*/
|
|
720
|
+
setOptionSelected(e, t) {
|
|
721
|
+
if (!(!(e instanceof d) || e.getAttribute("role") !== "option")) {
|
|
722
|
+
if (t === void 0) {
|
|
723
|
+
e.selected = !e.selected;
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
e.selected = t, t && this.setCurrentOption(e);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
*
|
|
731
|
+
* current = whether the option is currently focused on e.g via keyboard
|
|
732
|
+
* @param option The option to update the current state
|
|
733
|
+
* @param current If undefined, the option will be toggled. If true, the option will be set as current. If false, the option will be unset.
|
|
734
|
+
* @returns
|
|
735
|
+
*/
|
|
736
|
+
setOptionCurrent(e, t) {
|
|
737
|
+
if (e instanceof d) {
|
|
738
|
+
if (t === void 0) {
|
|
739
|
+
e.current = !e.current;
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
e.current = t;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* For each option, this function is called to determine if the option should be displayed based on the input string
|
|
747
|
+
* @param option
|
|
748
|
+
* @param value The current input string
|
|
749
|
+
* @returns Whether this option should be displayed
|
|
750
|
+
*/
|
|
751
|
+
filterCallback(e, t) {
|
|
752
|
+
return this.getOptionLabel(e).toLowerCase().includes(t);
|
|
753
|
+
}
|
|
754
|
+
// #endregion
|
|
755
|
+
connectedCallback() {
|
|
756
|
+
super.connectedCallback(), this.stayOpenOnSelect || (this.open = !1);
|
|
757
|
+
}
|
|
758
|
+
runFirstUpdated() {
|
|
759
|
+
B() && (this.contentEditable = "true");
|
|
760
|
+
}
|
|
761
|
+
addOpenListeners() {
|
|
762
|
+
document.addEventListener(
|
|
763
|
+
"focusin",
|
|
764
|
+
this.handleDocumentFocusIn
|
|
765
|
+
), document.addEventListener(
|
|
766
|
+
"keydown",
|
|
767
|
+
this.handleDocumentKeyDown
|
|
768
|
+
), document.addEventListener(
|
|
769
|
+
"mousedown",
|
|
770
|
+
this.handleDocumentMouseDown
|
|
771
|
+
), this.getRootNode() !== document && this.getRootNode().addEventListener(
|
|
772
|
+
"focusin",
|
|
773
|
+
this.handleDocumentFocusIn
|
|
774
|
+
), "CloseWatcher" in window && (this.closeWatcher?.destroy(), this.closeWatcher = new CloseWatcher(), this.closeWatcher.onclose = () => {
|
|
775
|
+
this.open && (this.hide(), this.displayInput.focus({ preventScroll: !0 }));
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
removeOpenListeners() {
|
|
779
|
+
document.removeEventListener(
|
|
780
|
+
"focusin",
|
|
781
|
+
this.handleDocumentFocusIn
|
|
782
|
+
), document.removeEventListener(
|
|
783
|
+
"keydown",
|
|
784
|
+
this.handleDocumentKeyDown
|
|
785
|
+
), document.removeEventListener(
|
|
786
|
+
"mousedown",
|
|
787
|
+
this.handleDocumentMouseDown
|
|
788
|
+
), this.getRootNode() !== document && this.getRootNode().removeEventListener(
|
|
789
|
+
"focusin",
|
|
790
|
+
this.handleDocumentFocusIn
|
|
791
|
+
), this.closeWatcher?.destroy();
|
|
792
|
+
}
|
|
793
|
+
handleFocus() {
|
|
794
|
+
this.hasFocus = !0, this.displayInput.setSelectionRange(0, this.displayInput.value.length), this.emit("cx-focus"), setTimeout(() => this.displayInput.focus(), 0);
|
|
795
|
+
}
|
|
796
|
+
handleBlur(e) {
|
|
797
|
+
const t = e.relatedTarget;
|
|
798
|
+
t && this.contains(t) || (this.hasFocus = !1, this.allowFreetext || (this.displayInput.value = this.displayLabel, this.typeToSelectString = ""), this.emit("cx-blur"));
|
|
799
|
+
}
|
|
800
|
+
handleInput(e) {
|
|
801
|
+
if (!this.open && (this.show(), e.data === " "))
|
|
802
|
+
return;
|
|
803
|
+
const t = e.target, l = [
|
|
804
|
+
"ArrowUp",
|
|
805
|
+
"ArrowDown",
|
|
806
|
+
"Enter",
|
|
807
|
+
"Escape",
|
|
808
|
+
"Tab",
|
|
809
|
+
"Home",
|
|
810
|
+
"End"
|
|
811
|
+
];
|
|
812
|
+
if (!(e.data && l.includes(e.data)))
|
|
813
|
+
switch (this.typeToSelectString = t.value.toLowerCase(), this.displayLabel = t.value, this.emit("cx-input"), this.inputBehavior) {
|
|
814
|
+
case "filter": {
|
|
815
|
+
this.filterOptionsByInput();
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
case "select":
|
|
819
|
+
this.selectOptionByInput();
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
handleComboboxMouseDown(e) {
|
|
823
|
+
const t = e.composedPath();
|
|
824
|
+
let l = !1, n = !1;
|
|
825
|
+
t.forEach((a) => {
|
|
826
|
+
if (a instanceof HTMLElement && a.classList.contains("select__expand-icon")) {
|
|
827
|
+
n = !0;
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
a instanceof HTMLElement && a.tagName.toLowerCase() === "cx-icon-button" && (l = !0);
|
|
831
|
+
}), !(this.disabled || l) && (n || this.inputBehavior !== "filter" || !this.open) && (this.allowDefaultMouseDown ? requestAnimationFrame(() => {
|
|
832
|
+
this.displayInput.focus({ preventScroll: !0 });
|
|
833
|
+
}) : (e.preventDefault(), this.displayInput.focus({ preventScroll: !0 })), this.open = !this.open);
|
|
834
|
+
}
|
|
835
|
+
handleComboboxKeyDown(e) {
|
|
836
|
+
e.key !== "Tab" && ((e.key !== "Escape" || this.open && (this.shouldShowNoOptionsMessage || this.getVisibleOptions().length > 0)) && e.stopPropagation(), this.handleDocumentKeyDown(e));
|
|
837
|
+
}
|
|
838
|
+
handleClearClick(e) {
|
|
839
|
+
e.stopPropagation(), (this.value !== "" || this.displayLabel !== "") && (this.setSelectedOptions([]), this.displayInput.focus({ preventScroll: !0 }), this.typeToSelectString = "", this.displayLabel = "", this.displayInput.value = "", this.inputBehavior === "filter" && this.filterOptionsByInput(), this.updateComplete.then(() => {
|
|
840
|
+
this.emit("cx-clear"), this.emit("cx-input"), this.emit("cx-change");
|
|
841
|
+
}));
|
|
842
|
+
}
|
|
843
|
+
handleClearMouseDown(e) {
|
|
844
|
+
e.stopPropagation(), e.preventDefault();
|
|
845
|
+
}
|
|
846
|
+
handleOptionClick(e) {
|
|
847
|
+
const l = e.target.closest('[role="option"], cx-option'), n = this.value, a = e.composedPath().some(
|
|
848
|
+
(c) => c?.classList?.contains("tree-item__expand-button")
|
|
849
|
+
), r = e.composedPath().some(
|
|
850
|
+
(c) => c?.classList?.contains("tree-item__actions")
|
|
851
|
+
);
|
|
852
|
+
l && !this.getOptionDisabled(l) && !a && !r && (this.multiple ? this.toggleOptionSelection(l) : this.setSelectedOptions(l), this.updateComplete.then(
|
|
853
|
+
() => this.displayInput.focus({ preventScroll: !0 })
|
|
854
|
+
), (this.value !== n || this.forceOnChange) && this.updateComplete.then(() => {
|
|
855
|
+
this.emit("cx-input"), this.emit("cx-change");
|
|
856
|
+
}), !this.multiple && !this.stayOpenOnSelect && (this.hide(), this.displayInput.focus({ preventScroll: !0 })));
|
|
857
|
+
}
|
|
858
|
+
handleDefaultSlotChange() {
|
|
859
|
+
const e = this.getAllOptions(), t = Array.isArray(this.value) ? this.value : [this.value], l = [];
|
|
860
|
+
for (const n of e) {
|
|
861
|
+
const a = this.getOptionValue(n);
|
|
862
|
+
if (!a && !(n instanceof d))
|
|
863
|
+
return;
|
|
864
|
+
l.push(a);
|
|
865
|
+
const r = n.tagName.toLowerCase();
|
|
866
|
+
if (!R(n) && !customElements.get(r)) {
|
|
867
|
+
customElements.whenDefined(r).then(() => this.handleDefaultSlotChange());
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
e.forEach((n) => l.push(this.getOptionValue(n))), this.setSelectedOptions(
|
|
872
|
+
e.filter((n) => t.includes(this.getOptionValue(n)))
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
handleTagRemove(e, t) {
|
|
876
|
+
e.stopPropagation(), this.disabled || (this.toggleOptionSelection(t, !1), this.updateComplete.then(() => {
|
|
877
|
+
this.emit("cx-input"), this.emit("cx-change");
|
|
878
|
+
}));
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Gets an array of all <cx-option> elements
|
|
882
|
+
*/
|
|
883
|
+
getAllOptions() {
|
|
884
|
+
return [
|
|
885
|
+
...this.querySelectorAll('[role="option"], cx-option')
|
|
886
|
+
];
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Gets the first <cx-option> element
|
|
890
|
+
*/
|
|
891
|
+
getFirstOption() {
|
|
892
|
+
return this.querySelector("cx-option");
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Gets an array of all visible <cx-option> elements
|
|
896
|
+
*/
|
|
897
|
+
getVisibleOptions() {
|
|
898
|
+
return this.getAllOptions().filter((e) => !e.hidden);
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Sets the current option, which is the option the user is currently interacting with (e.g. via keyboard). Only one
|
|
902
|
+
* option may be "current" at a time.
|
|
903
|
+
*/
|
|
904
|
+
setCurrentOption(e) {
|
|
905
|
+
this.getAllOptions().forEach((l) => {
|
|
906
|
+
this.setOptionCurrent(l, !1), l.tabIndex = -1;
|
|
907
|
+
}), e && (this.currentOption = e, this.setOptionCurrent(e, !0), e.tabIndex = 0, e.scrollIntoView({ block: "nearest" }));
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Sets the selected option(s)
|
|
911
|
+
*/
|
|
912
|
+
setSelectedOptions(e) {
|
|
913
|
+
const t = this.getAllOptions(), l = Array.isArray(e) ? e : [e];
|
|
914
|
+
t.forEach((n) => this.setOptionSelected(n, !1)), l.length && l.forEach((n) => this.setOptionSelected(n, !0)), this.selectionChanged();
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Toggles an option's selected state
|
|
918
|
+
*/
|
|
919
|
+
toggleOptionSelection(e, t) {
|
|
920
|
+
this.setOptionSelected(e, t), this.selectionChanged();
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* This method must be called whenever the selection changes. It will update the selected options cache, the current
|
|
924
|
+
* value, and the display value
|
|
925
|
+
*/
|
|
926
|
+
selectionChanged() {
|
|
927
|
+
this.selectedOptions = this.getAllOptions().filter(
|
|
928
|
+
(e) => this.getOptionSelected(e)
|
|
929
|
+
), this.multiple ? (this.value = this.selectedOptions.map((e) => this.getOptionValue(e)), this.displayLabel = "") : (this.value = this.getOptionValue(this.selectedOptions[0]) ?? "", this.displayLabel = this.getOptionLabel(this.selectedOptions[0]) ?? ""), this.updateComplete.then(() => {
|
|
930
|
+
this.formControlController.updateValidity();
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
get tags() {
|
|
934
|
+
const e = this.hasSlotController.test("label"), l = (this.label ? !0 : !!e) ? this.size === "large" ? "medium" : "small" : this.size;
|
|
935
|
+
return this.selectedOptions.map((n, a) => {
|
|
936
|
+
if (a < this.maxOptionsVisible || this.maxOptionsVisible <= 0) {
|
|
937
|
+
const r = this.getTag(n, a);
|
|
938
|
+
return p`${typeof r == "string" ? V(r) : r}`;
|
|
939
|
+
} else if (a === this.maxOptionsVisible)
|
|
940
|
+
return p`<cx-tag ?pill=${this.pill} size=${l}>
|
|
941
|
+
+${this.selectedOptions.length - a}
|
|
942
|
+
</cx-tag>`;
|
|
943
|
+
return A;
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
handleInvalid(e) {
|
|
947
|
+
this.formControlController.setValidity(!1), this.formControlController.emitInvalidEvent(e);
|
|
948
|
+
}
|
|
949
|
+
handleDisabledChange() {
|
|
950
|
+
this.disabled && (this.open = !1, this.handleOpenChange());
|
|
951
|
+
}
|
|
952
|
+
handleValueChange() {
|
|
953
|
+
const e = this.getAllOptions(), t = Array.isArray(this.value) ? this.value : [this.value];
|
|
954
|
+
this.setSelectedOptions(
|
|
955
|
+
e.filter((l) => t.includes(this.getOptionValue(l)))
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
async handleNoDropdownChange() {
|
|
959
|
+
await this.updateComplete, this.noDropdown ? this.open = !1 : this.handleOpenChange();
|
|
960
|
+
}
|
|
961
|
+
async handleOpenChange() {
|
|
962
|
+
if (this.open && !this.disabled) {
|
|
963
|
+
if (this.noDropdown)
|
|
964
|
+
return;
|
|
965
|
+
this.inputBehavior === "filter" && this.filterOptionsByInput(), this.noResetCurrent || this.setCurrentOption(this.selectedOptions[0] || this.getFirstOption()), this.emit("cx-show"), this.addOpenListeners(), await x(this), this.listbox.hidden = !1, this.popup.active = !0, requestAnimationFrame(() => {
|
|
966
|
+
this.currentOption && this.setCurrentOption(this.currentOption);
|
|
967
|
+
});
|
|
968
|
+
const { keyframes: e, options: t } = _(this, "select.show", {
|
|
969
|
+
dir: this.localize.dir()
|
|
970
|
+
});
|
|
971
|
+
await y(this.popup.popup, e, t), this.currentOption && T(this.currentOption, this.listbox, "vertical", "auto"), this.emit("cx-after-show");
|
|
972
|
+
} else {
|
|
973
|
+
this.emit("cx-hide"), this.removeOpenListeners(), await x(this);
|
|
974
|
+
const { keyframes: e, options: t } = _(this, "select.hide", {
|
|
975
|
+
dir: this.localize.dir()
|
|
976
|
+
});
|
|
977
|
+
await y(this.popup.popup, e, t), this.listbox.hidden = !0, this.popup.active = !1, this.emit("cx-after-hide");
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
selectOptionByInput() {
|
|
981
|
+
const e = this.getAllOptions();
|
|
982
|
+
for (const t of e)
|
|
983
|
+
if (this.getOptionLabel(t).toLowerCase().startsWith(this.typeToSelectString)) {
|
|
984
|
+
this.setCurrentOption(t);
|
|
985
|
+
break;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
filterOptionsByInput() {
|
|
989
|
+
const e = this.getAllOptions();
|
|
990
|
+
for (const t of e)
|
|
991
|
+
this.filterCallback(t, this.typeToSelectString) ? (t.hidden = !1, t.style.display = "") : (t.hidden = !0, t.style.display = "none");
|
|
992
|
+
this.popup.style.removeProperty("--auto-size-available-width"), this.popup.style.removeProperty("--auto-size-available-height");
|
|
993
|
+
}
|
|
994
|
+
/** Shows the listbox. */
|
|
995
|
+
async show() {
|
|
996
|
+
if (this.open || this.disabled) {
|
|
997
|
+
this.open = !1;
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
return this.open = !0, v(this, "cx-after-show");
|
|
1001
|
+
}
|
|
1002
|
+
/** Hides the listbox. */
|
|
1003
|
+
async hide() {
|
|
1004
|
+
if (!this.open || this.disabled) {
|
|
1005
|
+
this.open = !1;
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
return this.open = !1, v(this, "cx-after-hide");
|
|
1009
|
+
}
|
|
1010
|
+
/** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
1011
|
+
checkValidity() {
|
|
1012
|
+
return this.valueInput.checkValidity();
|
|
1013
|
+
}
|
|
1014
|
+
/** Gets the associated form, if one exists. */
|
|
1015
|
+
getForm() {
|
|
1016
|
+
return this.formControlController.getForm();
|
|
1017
|
+
}
|
|
1018
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
1019
|
+
reportValidity() {
|
|
1020
|
+
return this.valueInput.reportValidity();
|
|
1021
|
+
}
|
|
1022
|
+
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
1023
|
+
setCustomValidity(e) {
|
|
1024
|
+
this.valueInput.setCustomValidity(e), this.formControlController.updateValidity();
|
|
1025
|
+
}
|
|
1026
|
+
/** Sets focus on the control. */
|
|
1027
|
+
focus(e) {
|
|
1028
|
+
this.displayInput.focus(e);
|
|
1029
|
+
}
|
|
1030
|
+
/** Removes focus from the control. */
|
|
1031
|
+
blur() {
|
|
1032
|
+
this.displayInput.blur();
|
|
1033
|
+
}
|
|
1034
|
+
render() {
|
|
1035
|
+
const e = this.hasSlotController.test("label"), t = this.hasSlotController.test("help-text"), l = this.label ? !0 : !!e, n = this.helpText ? !0 : !!t, a = this.clearable && !this.disabled && (this.displayLabel.length > 0 || this.selectedOptions.length > 0), r = this.placeholder && this.value.length === 0 && this.displayLabel.length === 0, c = this.value.length === 0 && this.displayLabel.length === 0 || (this.multiple || this.useTag) && this.tags.length === 0, g = (this.multiple || this.useTag) && this.selectedOptions.length > 0;
|
|
1036
|
+
return p`
|
|
1037
|
+
<div
|
|
1038
|
+
part="form-control"
|
|
1039
|
+
class=${b({
|
|
1040
|
+
"form-control": !0,
|
|
1041
|
+
"form-control--has-help-text": n,
|
|
1042
|
+
"form-control--has-label": l,
|
|
1043
|
+
"form-control--large": this.size === "large",
|
|
1044
|
+
"form-control--medium": this.size === "medium",
|
|
1045
|
+
"form-control--small": this.size === "small"
|
|
1046
|
+
})}
|
|
1047
|
+
>
|
|
1048
|
+
<div part="form-control-input" class="form-control-input">
|
|
1049
|
+
<cx-popup
|
|
1050
|
+
.active=${this.open && this.stayOpenOnSelect}
|
|
1051
|
+
.syncElement=${this.syncElement}
|
|
1052
|
+
class=${b({
|
|
1053
|
+
select: !0,
|
|
1054
|
+
"select--bottom": this.placement === "bottom",
|
|
1055
|
+
"select--disabled": this.disabled,
|
|
1056
|
+
"select--empty": c,
|
|
1057
|
+
"select--filled": this.filled,
|
|
1058
|
+
"select--focused": this.hasFocus || this.open,
|
|
1059
|
+
"select--large": this.size === "large",
|
|
1060
|
+
"select--medium": this.size === "medium",
|
|
1061
|
+
"select--multiple": this.multiple || this.useTag,
|
|
1062
|
+
"select--open": this.open,
|
|
1063
|
+
"select--pill": this.pill,
|
|
1064
|
+
"select--placeholder-visible": r,
|
|
1065
|
+
"select--small": this.size === "small",
|
|
1066
|
+
"select--standard": !0,
|
|
1067
|
+
"select--top": this.placement === "top"
|
|
1068
|
+
})}
|
|
1069
|
+
placement=${this.placement}
|
|
1070
|
+
strategy=${this.hoist ? "overlay" : "absolute"}
|
|
1071
|
+
?flip=${!this.noFlip}
|
|
1072
|
+
shift
|
|
1073
|
+
sync=${this.freeWidth ? void 0 : "width"}
|
|
1074
|
+
auto-size="both"
|
|
1075
|
+
auto-size-padding=${this.autosizePadding}
|
|
1076
|
+
flip-padding="10"
|
|
1077
|
+
>
|
|
1078
|
+
<div
|
|
1079
|
+
part="combobox"
|
|
1080
|
+
class="select__combobox"
|
|
1081
|
+
slot="anchor"
|
|
1082
|
+
@keydown=${this.handleComboboxKeyDown}
|
|
1083
|
+
@mousedown=${this.handleComboboxMouseDown}
|
|
1084
|
+
>
|
|
1085
|
+
<slot part="prefix" name="prefix" class="select__prefix"></slot>
|
|
1086
|
+
|
|
1087
|
+
<span class="input-container" @click=${this.handleFocus}>
|
|
1088
|
+
<label
|
|
1089
|
+
id="label"
|
|
1090
|
+
part="form-control-label"
|
|
1091
|
+
class="form-control__label"
|
|
1092
|
+
aria-hidden=${l ? "false" : "true"}
|
|
1093
|
+
>
|
|
1094
|
+
<slot name="label">${this.label}</slot>
|
|
1095
|
+
</label>
|
|
1096
|
+
${m(
|
|
1097
|
+
g,
|
|
1098
|
+
() => p`
|
|
1099
|
+
<div
|
|
1100
|
+
part="tags"
|
|
1101
|
+
class="select__tags"
|
|
1102
|
+
@cx-remove=${this.handleTagRemove}
|
|
1103
|
+
>
|
|
1104
|
+
${this.tags}
|
|
1105
|
+
</div>
|
|
1106
|
+
`
|
|
1107
|
+
)}
|
|
1108
|
+
<input
|
|
1109
|
+
part="display-input"
|
|
1110
|
+
class=${b({
|
|
1111
|
+
"select__display-input": !0,
|
|
1112
|
+
"select__display-input--hidden": (this.multiple || this.useTag) && !this.hasFocus && !c,
|
|
1113
|
+
"select__display-input--large": this.size === "large",
|
|
1114
|
+
"select__display-input--medium": this.size === "medium",
|
|
1115
|
+
"select__display-input--small": this.size === "small"
|
|
1116
|
+
})}
|
|
1117
|
+
type="text"
|
|
1118
|
+
placeholder=${this.placeholder}
|
|
1119
|
+
.disabled=${this.disabled}
|
|
1120
|
+
?readonly=${this.inputBehavior === "none" && !this.allowFreetext}
|
|
1121
|
+
.value=${this.displayLabel}
|
|
1122
|
+
autocomplete="off"
|
|
1123
|
+
spellcheck="false"
|
|
1124
|
+
autocapitalize="off"
|
|
1125
|
+
aria-controls="listbox"
|
|
1126
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
1127
|
+
aria-haspopup="listbox"
|
|
1128
|
+
aria-label=${l ? void 0 : this.dataset.label}
|
|
1129
|
+
aria-labelledby="label"
|
|
1130
|
+
aria-disabled=${this.disabled ? "true" : "false"}
|
|
1131
|
+
aria-describedby="help-text"
|
|
1132
|
+
role="combobox"
|
|
1133
|
+
tabindex="0"
|
|
1134
|
+
@input=${this.handleInput}
|
|
1135
|
+
@blur=${this.handleBlur}
|
|
1136
|
+
/>
|
|
1137
|
+
</span>
|
|
1138
|
+
|
|
1139
|
+
<input
|
|
1140
|
+
class="select__value-input"
|
|
1141
|
+
type="text"
|
|
1142
|
+
?disabled=${this.disabled}
|
|
1143
|
+
?required=${this.required}
|
|
1144
|
+
.value=${Array.isArray(this.value) ? this.value.join(", ") : this.value}
|
|
1145
|
+
tabindex="-1"
|
|
1146
|
+
aria-hidden="true"
|
|
1147
|
+
@focus=${this.focus}
|
|
1148
|
+
@invalid=${this.handleInvalid}
|
|
1149
|
+
/>
|
|
1150
|
+
|
|
1151
|
+
${m(
|
|
1152
|
+
this.loading,
|
|
1153
|
+
() => p`
|
|
1154
|
+
<cx-spinner
|
|
1155
|
+
part="spinner"
|
|
1156
|
+
role="status"
|
|
1157
|
+
aria-live="polite"
|
|
1158
|
+
></cx-spinner>
|
|
1159
|
+
`
|
|
1160
|
+
)}
|
|
1161
|
+
${m(
|
|
1162
|
+
a,
|
|
1163
|
+
() => p`
|
|
1164
|
+
<button
|
|
1165
|
+
part="clear-button"
|
|
1166
|
+
class="select__clear"
|
|
1167
|
+
type="button"
|
|
1168
|
+
aria-label=${this.localize.term("clearEntry")}
|
|
1169
|
+
@mousedown=${this.handleClearMouseDown}
|
|
1170
|
+
@click=${this.handleClearClick}
|
|
1171
|
+
tabindex="-1"
|
|
1172
|
+
>
|
|
1173
|
+
<slot name="clear-icon">
|
|
1174
|
+
<cx-icon name="cancel"></cx-icon>
|
|
1175
|
+
</slot>
|
|
1176
|
+
</button>
|
|
1177
|
+
`
|
|
1178
|
+
)}
|
|
1179
|
+
|
|
1180
|
+
<slot name="suffix" part="suffix" class="select__suffix"></slot>
|
|
1181
|
+
|
|
1182
|
+
<slot
|
|
1183
|
+
name="expand-icon"
|
|
1184
|
+
part="expand-icon"
|
|
1185
|
+
class="select__expand-icon"
|
|
1186
|
+
>
|
|
1187
|
+
<cx-icon name="arrow_drop_down"></cx-icon>
|
|
1188
|
+
</slot>
|
|
1189
|
+
</div>
|
|
1190
|
+
|
|
1191
|
+
<div
|
|
1192
|
+
id="listbox"
|
|
1193
|
+
role="listbox"
|
|
1194
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
1195
|
+
aria-multiselectable=${this.multiple ? "true" : "false"}
|
|
1196
|
+
aria-labelledby="label"
|
|
1197
|
+
part="listbox"
|
|
1198
|
+
class="select__listbox"
|
|
1199
|
+
tabindex="-1"
|
|
1200
|
+
@mouseup=${this.handleOptionClick}
|
|
1201
|
+
@slotchange=${this.handleDefaultSlotChange}
|
|
1202
|
+
>
|
|
1203
|
+
<slot></slot>
|
|
1204
|
+
${m(
|
|
1205
|
+
this.shouldShowNoOptionsMessage,
|
|
1206
|
+
() => p`
|
|
1207
|
+
<cx-typography
|
|
1208
|
+
variant="body3"
|
|
1209
|
+
class="select__no-options"
|
|
1210
|
+
role="option"
|
|
1211
|
+
>
|
|
1212
|
+
${this.noOptionText}
|
|
1213
|
+
</cx-typography>
|
|
1214
|
+
`
|
|
1215
|
+
)}
|
|
1216
|
+
</div>
|
|
1217
|
+
</cx-popup>
|
|
1218
|
+
</div>
|
|
1219
|
+
|
|
1220
|
+
<div
|
|
1221
|
+
part="form-control-help-text"
|
|
1222
|
+
id="help-text"
|
|
1223
|
+
class="form-control__help-text"
|
|
1224
|
+
aria-hidden=${n ? "false" : "true"}
|
|
1225
|
+
>
|
|
1226
|
+
<slot name="help-text">${this.helpText}</slot>
|
|
1227
|
+
</div>
|
|
1228
|
+
</div>
|
|
1229
|
+
`;
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
i.styles = [
|
|
1233
|
+
k,
|
|
1234
|
+
z,
|
|
1235
|
+
W
|
|
1236
|
+
];
|
|
1237
|
+
i.dependencies = {
|
|
1238
|
+
"cx-icon": P,
|
|
1239
|
+
"cx-line-clamp": O,
|
|
1240
|
+
"cx-popup": M,
|
|
1241
|
+
"cx-spinner": U,
|
|
1242
|
+
"cx-tag": N,
|
|
1243
|
+
"cx-typography": C
|
|
1244
|
+
};
|
|
1245
|
+
s([
|
|
1246
|
+
u(".select")
|
|
1247
|
+
], i.prototype, "popup", 2);
|
|
1248
|
+
s([
|
|
1249
|
+
u(".select__combobox")
|
|
1250
|
+
], i.prototype, "combobox", 2);
|
|
1251
|
+
s([
|
|
1252
|
+
u(".select__display-input")
|
|
1253
|
+
], i.prototype, "displayInput", 2);
|
|
1254
|
+
s([
|
|
1255
|
+
u(".select__value-input")
|
|
1256
|
+
], i.prototype, "valueInput", 2);
|
|
1257
|
+
s([
|
|
1258
|
+
u(".select__listbox")
|
|
1259
|
+
], i.prototype, "listbox", 2);
|
|
1260
|
+
s([
|
|
1261
|
+
f()
|
|
1262
|
+
], i.prototype, "hasFocus", 2);
|
|
1263
|
+
s([
|
|
1264
|
+
f()
|
|
1265
|
+
], i.prototype, "displayLabel", 2);
|
|
1266
|
+
s([
|
|
1267
|
+
f()
|
|
1268
|
+
], i.prototype, "currentOption", 2);
|
|
1269
|
+
s([
|
|
1270
|
+
f()
|
|
1271
|
+
], i.prototype, "selectedOptions", 2);
|
|
1272
|
+
s([
|
|
1273
|
+
o()
|
|
1274
|
+
], i.prototype, "name", 2);
|
|
1275
|
+
s([
|
|
1276
|
+
o({
|
|
1277
|
+
converter: {
|
|
1278
|
+
fromAttribute: (e) => e.split(" "),
|
|
1279
|
+
toAttribute: (e) => Array.isArray(e) ? e.join(" ") : e
|
|
1280
|
+
}
|
|
1281
|
+
})
|
|
1282
|
+
], i.prototype, "value", 2);
|
|
1283
|
+
s([
|
|
1284
|
+
I()
|
|
1285
|
+
], i.prototype, "defaultValue", 2);
|
|
1286
|
+
s([
|
|
1287
|
+
o({ reflect: !0 })
|
|
1288
|
+
], i.prototype, "size", 2);
|
|
1289
|
+
s([
|
|
1290
|
+
o()
|
|
1291
|
+
], i.prototype, "placeholder", 2);
|
|
1292
|
+
s([
|
|
1293
|
+
o({ attribute: "allow-freetext", reflect: !0, type: Boolean })
|
|
1294
|
+
], i.prototype, "allowFreetext", 2);
|
|
1295
|
+
s([
|
|
1296
|
+
o({ reflect: !0, type: Boolean })
|
|
1297
|
+
], i.prototype, "multiple", 2);
|
|
1298
|
+
s([
|
|
1299
|
+
o({ attribute: "max-options-visible", type: Number })
|
|
1300
|
+
], i.prototype, "maxOptionsVisible", 2);
|
|
1301
|
+
s([
|
|
1302
|
+
o({ reflect: !0, type: Boolean })
|
|
1303
|
+
], i.prototype, "disabled", 2);
|
|
1304
|
+
s([
|
|
1305
|
+
o({ type: Boolean })
|
|
1306
|
+
], i.prototype, "clearable", 2);
|
|
1307
|
+
s([
|
|
1308
|
+
o({ reflect: !0, type: Boolean })
|
|
1309
|
+
], i.prototype, "open", 2);
|
|
1310
|
+
s([
|
|
1311
|
+
o({ type: Boolean })
|
|
1312
|
+
], i.prototype, "hoist", 2);
|
|
1313
|
+
s([
|
|
1314
|
+
o({ attribute: "no-flip", reflect: !0, type: Boolean })
|
|
1315
|
+
], i.prototype, "noFlip", 2);
|
|
1316
|
+
s([
|
|
1317
|
+
o({ attribute: "sync-element" })
|
|
1318
|
+
], i.prototype, "syncElement", 2);
|
|
1319
|
+
s([
|
|
1320
|
+
o({ attribute: "free-width", reflect: !0, type: Boolean })
|
|
1321
|
+
], i.prototype, "freeWidth", 2);
|
|
1322
|
+
s([
|
|
1323
|
+
o({ attribute: "auto-size-padding", type: Number })
|
|
1324
|
+
], i.prototype, "autosizePadding", 2);
|
|
1325
|
+
s([
|
|
1326
|
+
o({ reflect: !0, type: Boolean })
|
|
1327
|
+
], i.prototype, "filled", 2);
|
|
1328
|
+
s([
|
|
1329
|
+
o({ reflect: !0, type: Boolean })
|
|
1330
|
+
], i.prototype, "pill", 2);
|
|
1331
|
+
s([
|
|
1332
|
+
o()
|
|
1333
|
+
], i.prototype, "label", 2);
|
|
1334
|
+
s([
|
|
1335
|
+
o({ reflect: !0 })
|
|
1336
|
+
], i.prototype, "placement", 2);
|
|
1337
|
+
s([
|
|
1338
|
+
o({ attribute: "help-text" })
|
|
1339
|
+
], i.prototype, "helpText", 2);
|
|
1340
|
+
s([
|
|
1341
|
+
o({ reflect: !1 })
|
|
1342
|
+
], i.prototype, "form", 2);
|
|
1343
|
+
s([
|
|
1344
|
+
o({ reflect: !0, type: Boolean })
|
|
1345
|
+
], i.prototype, "required", 2);
|
|
1346
|
+
s([
|
|
1347
|
+
o({ attribute: "use-tag", reflect: !0, type: Boolean })
|
|
1348
|
+
], i.prototype, "useTag", 2);
|
|
1349
|
+
s([
|
|
1350
|
+
o({
|
|
1351
|
+
attribute: "no-select-on-enter",
|
|
1352
|
+
reflect: !0,
|
|
1353
|
+
type: Boolean
|
|
1354
|
+
})
|
|
1355
|
+
], i.prototype, "noSelectOnEnter", 2);
|
|
1356
|
+
s([
|
|
1357
|
+
o({
|
|
1358
|
+
attribute: "no-reset-current",
|
|
1359
|
+
reflect: !0,
|
|
1360
|
+
type: Boolean
|
|
1361
|
+
})
|
|
1362
|
+
], i.prototype, "noResetCurrent", 2);
|
|
1363
|
+
s([
|
|
1364
|
+
o({
|
|
1365
|
+
attribute: "no-dropdown",
|
|
1366
|
+
reflect: !0,
|
|
1367
|
+
type: Boolean
|
|
1368
|
+
})
|
|
1369
|
+
], i.prototype, "noDropdown", 2);
|
|
1370
|
+
s([
|
|
1371
|
+
o({
|
|
1372
|
+
attribute: "loading",
|
|
1373
|
+
reflect: !0,
|
|
1374
|
+
type: Boolean
|
|
1375
|
+
})
|
|
1376
|
+
], i.prototype, "loading", 2);
|
|
1377
|
+
s([
|
|
1378
|
+
o({ attribute: "get-tag" })
|
|
1379
|
+
], i.prototype, "getTag", 2);
|
|
1380
|
+
s([
|
|
1381
|
+
o({ attribute: "input-behavior" })
|
|
1382
|
+
], i.prototype, "inputBehavior", 2);
|
|
1383
|
+
s([
|
|
1384
|
+
o({ attribute: "get-option-value" })
|
|
1385
|
+
], i.prototype, "getOptionValue", 2);
|
|
1386
|
+
s([
|
|
1387
|
+
o({ attribute: "get-option-label" })
|
|
1388
|
+
], i.prototype, "getOptionLabel", 2);
|
|
1389
|
+
s([
|
|
1390
|
+
o({ attribute: "get-option-selected" })
|
|
1391
|
+
], i.prototype, "getOptionSelected", 2);
|
|
1392
|
+
s([
|
|
1393
|
+
o({ attribute: "get-option-disabled" })
|
|
1394
|
+
], i.prototype, "getOptionDisabled", 2);
|
|
1395
|
+
s([
|
|
1396
|
+
o({ attribute: "stay-open-on-select", type: Boolean })
|
|
1397
|
+
], i.prototype, "stayOpenOnSelect", 2);
|
|
1398
|
+
s([
|
|
1399
|
+
o({ attribute: "force-on-change", type: Boolean })
|
|
1400
|
+
], i.prototype, "forceOnChange", 2);
|
|
1401
|
+
s([
|
|
1402
|
+
o({ attribute: "allow-default-mouse-down", type: Boolean })
|
|
1403
|
+
], i.prototype, "allowDefaultMouseDown", 2);
|
|
1404
|
+
s([
|
|
1405
|
+
o({ attribute: "no-option-text", type: String })
|
|
1406
|
+
], i.prototype, "noOptionText", 2);
|
|
1407
|
+
s([
|
|
1408
|
+
h("getOptionValue", { waitUntilFirstUpdate: !0 }),
|
|
1409
|
+
h("getOptionLabel", { waitUntilFirstUpdate: !0 }),
|
|
1410
|
+
h("getOptionSelected", { waitUntilFirstUpdate: !0 }),
|
|
1411
|
+
h("getOptionDisabled", { waitUntilFirstUpdate: !0 })
|
|
1412
|
+
], i.prototype, "handleDefaultSlotChange", 1);
|
|
1413
|
+
s([
|
|
1414
|
+
h("disabled", { waitUntilFirstUpdate: !0 })
|
|
1415
|
+
], i.prototype, "handleDisabledChange", 1);
|
|
1416
|
+
s([
|
|
1417
|
+
h("value", { waitUntilFirstUpdate: !0 })
|
|
1418
|
+
], i.prototype, "handleValueChange", 1);
|
|
1419
|
+
s([
|
|
1420
|
+
h("noDropdown", { waitUntilFirstUpdate: !0 })
|
|
1421
|
+
], i.prototype, "handleNoDropdownChange", 1);
|
|
1422
|
+
s([
|
|
1423
|
+
h("open", { waitUntilFirstUpdate: !0 })
|
|
1424
|
+
], i.prototype, "handleOpenChange", 1);
|
|
1425
|
+
i = s([
|
|
1426
|
+
D("cx-select")
|
|
1427
|
+
], i);
|
|
1428
|
+
w("select.show", {
|
|
1429
|
+
keyframes: [
|
|
1430
|
+
{ opacity: 0, scale: 0.9 },
|
|
1431
|
+
{ opacity: 1, scale: 1 }
|
|
1432
|
+
],
|
|
1433
|
+
options: { duration: 100, easing: "ease" }
|
|
1434
|
+
});
|
|
1435
|
+
w("select.hide", {
|
|
1436
|
+
keyframes: [
|
|
1437
|
+
{ opacity: 1, scale: 1 },
|
|
1438
|
+
{ opacity: 0, scale: 0.9 }
|
|
1439
|
+
],
|
|
1440
|
+
options: { duration: 100, easing: "ease" }
|
|
1441
|
+
});
|
|
25
1442
|
export {
|
|
26
|
-
|
|
1443
|
+
i as default
|
|
27
1444
|
};
|