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