@genexus/genexus-ide-ui 0.0.41 → 0.0.42

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 (88) hide show
  1. package/dist/cjs/ch-icon.cjs.entry.js +116 -0
  2. package/dist/cjs/{form-validation-f8e709d0.js → common-facb7f18.js} +0 -19
  3. package/dist/cjs/constants-e63c0ad9.js +10 -0
  4. package/dist/cjs/form-validation-b7fb4ca8.js +21 -0
  5. package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
  6. package/dist/cjs/gx-ide-create-kb-from-server.cjs.entry.js +4 -3
  7. package/dist/cjs/{gxg-date-picker.cjs.entry.js → gx-ide-entity-selector_2.cjs.entry.js} +81 -0
  8. package/dist/cjs/gx-ide-new-environment.cjs.entry.js +3 -2
  9. package/dist/cjs/gx-ide-new-kb.cjs.entry.js +6 -5
  10. package/dist/cjs/gx-ide-object-selector.cjs.entry.js +30 -24
  11. package/dist/cjs/gx-ide-ww-images.cjs.entry.js +229 -0
  12. package/dist/cjs/{gxg-button.cjs.entry.js → gxg-button_2.cjs.entry.js} +61 -0
  13. package/dist/cjs/gxg-combo-box_2.cjs.entry.js +705 -0
  14. package/dist/cjs/{gxg-combo-box_6.cjs.entry.js → gxg-tab_4.cjs.entry.js} +1 -698
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/collection/collection-manifest.json +1 -0
  17. package/dist/collection/common/constants.js +6 -0
  18. package/dist/collection/components/object-selector/gx-ide-assets/object-selector/langs/object-selector.lang.en.json +1 -1
  19. package/dist/collection/components/object-selector/object-selector.js +33 -26
  20. package/dist/collection/components/ww-images/gx-ide-assets/ww-images/langs/ww-images.lang.en.json +47 -0
  21. package/dist/collection/components/ww-images/gx-ide-assets/ww-images/langs/ww-images.lang.ja.json +3 -0
  22. package/dist/collection/components/ww-images/gx-ide-assets/ww-images/langs/ww-images.lang.zh.json +3 -0
  23. package/dist/collection/components/ww-images/ww-images.css +229 -0
  24. package/dist/collection/components/ww-images/ww-images.js +674 -0
  25. package/dist/collection/pages/assets/common.js +20 -0
  26. package/dist/components/common.js +46 -0
  27. package/dist/components/constants.js +8 -0
  28. package/dist/components/form-validation.js +1 -46
  29. package/dist/components/gx-ide-create-kb-from-server.js +2 -1
  30. package/dist/components/gx-ide-new-environment.js +2 -1
  31. package/dist/components/gx-ide-new-kb.js +2 -1
  32. package/dist/components/gx-ide-object-selector.js +30 -24
  33. package/dist/components/gx-ide-ww-images.d.ts +11 -0
  34. package/dist/components/gx-ide-ww-images.js +421 -0
  35. package/dist/components/index.d.ts +1 -0
  36. package/dist/components/index.js +1 -0
  37. package/dist/esm/ch-icon.entry.js +112 -0
  38. package/dist/esm/{form-validation-cdb16431.js → common-a3df0966.js} +1 -19
  39. package/dist/esm/constants-7882d1a8.js +8 -0
  40. package/dist/esm/form-validation-09bd4504.js +19 -0
  41. package/dist/esm/genexus-ide-ui.js +1 -1
  42. package/dist/esm/gx-ide-create-kb-from-server.entry.js +2 -1
  43. package/dist/esm/{gxg-date-picker.entry.js → gx-ide-entity-selector_2.entry.js} +81 -1
  44. package/dist/esm/gx-ide-new-environment.entry.js +2 -1
  45. package/dist/esm/gx-ide-new-kb.entry.js +2 -1
  46. package/dist/esm/gx-ide-object-selector.entry.js +30 -24
  47. package/dist/esm/gx-ide-ww-images.entry.js +225 -0
  48. package/dist/esm/{gxg-button.entry.js → gxg-button_2.entry.js} +62 -2
  49. package/dist/esm/gxg-combo-box_2.entry.js +700 -0
  50. package/dist/esm/{gxg-combo-box_6.entry.js → gxg-tab_4.entry.js} +3 -698
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
  53. package/dist/genexus-ide-ui/gx-ide-assets/object-selector/langs/object-selector.lang.en.json +1 -1
  54. package/dist/genexus-ide-ui/gx-ide-assets/ww-images/langs/ww-images.lang.en.json +47 -0
  55. package/dist/genexus-ide-ui/gx-ide-assets/ww-images/langs/ww-images.lang.ja.json +3 -0
  56. package/dist/genexus-ide-ui/gx-ide-assets/ww-images/langs/ww-images.lang.zh.json +3 -0
  57. package/dist/genexus-ide-ui/p-07e89cdd.entry.js +1 -0
  58. package/dist/genexus-ide-ui/p-35fc1102.entry.js +1 -0
  59. package/dist/genexus-ide-ui/p-44964acf.js +1 -0
  60. package/dist/genexus-ide-ui/p-4b7f7425.entry.js +1 -0
  61. package/dist/genexus-ide-ui/p-4d39c34a.entry.js +1 -0
  62. package/dist/genexus-ide-ui/p-5ad757f4.entry.js +1 -0
  63. package/dist/genexus-ide-ui/p-6010dc9d.js +1 -0
  64. package/dist/genexus-ide-ui/p-764ab316.entry.js +1 -0
  65. package/dist/genexus-ide-ui/p-7a83018d.entry.js +1 -0
  66. package/dist/genexus-ide-ui/p-7a90def4.entry.js +1 -0
  67. package/dist/genexus-ide-ui/p-8bf7f0e1.entry.js +1 -0
  68. package/dist/genexus-ide-ui/p-daf4eb69.js +1 -0
  69. package/dist/genexus-ide-ui/p-fcdcb919.entry.js +1 -0
  70. package/dist/types/common/constants.d.ts +6 -0
  71. package/dist/types/components/object-selector/object-selector.d.ts +5 -7
  72. package/dist/types/components/ww-images/ww-images.d.ts +191 -0
  73. package/dist/types/components.d.ts +184 -2
  74. package/package.json +1 -1
  75. package/dist/cjs/ch-icon_2.cjs.entry.js +0 -177
  76. package/dist/cjs/gx-ide-entity-selector.cjs.entry.js +0 -87
  77. package/dist/esm/ch-icon_2.entry.js +0 -172
  78. package/dist/esm/gx-ide-entity-selector.entry.js +0 -83
  79. package/dist/genexus-ide-ui/p-2ebd392f.entry.js +0 -1
  80. package/dist/genexus-ide-ui/p-34721f1c.entry.js +0 -1
  81. package/dist/genexus-ide-ui/p-5c560dd0.entry.js +0 -1
  82. package/dist/genexus-ide-ui/p-a708db45.entry.js +0 -1
  83. package/dist/genexus-ide-ui/p-c304345f.entry.js +0 -1
  84. package/dist/genexus-ide-ui/p-c38c6957.entry.js +0 -1
  85. package/dist/genexus-ide-ui/p-cf41f154.entry.js +0 -1
  86. package/dist/genexus-ide-ui/p-db945a17.js +0 -1
  87. package/dist/genexus-ide-ui/p-e1fea866.entry.js +0 -1
  88. package/dist/genexus-ide-ui/p-f9731b7c.entry.js +0 -1
@@ -0,0 +1,705 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-5a32426a.js');
6
+ const form = require('./form-a22de8f3.js');
7
+ const repositionScroll = require('./reposition-scroll-accee84c.js');
8
+ const types = require('./types-e04c9098.js');
9
+ const exportParts = require('./export-parts-931a23ad.js');
10
+ const store = require('./store-0866de9f.js');
11
+ const classesNames = require('./classesNames-5b7c6ad4.js');
12
+
13
+ function mutationObserverRemoved(target, ref) {
14
+ const observer = new MutationObserver((mutationsList) => {
15
+ for (const mutation of mutationsList) {
16
+ if (mutation.type === "childList") {
17
+ const removedNodesArray = Array.from(mutation.removedNodes);
18
+ for (const removedNode of removedNodesArray) {
19
+ if (removedNode.nodeType === Node.ELEMENT_NODE) {
20
+ ref.removedItem = removedNode;
21
+ }
22
+ }
23
+ }
24
+ }
25
+ });
26
+ observer.observe(target, { childList: true });
27
+ return observer; // Return the observer instance if needed
28
+ }
29
+
30
+ const comboBoxCss = "/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0;}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px;}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}:root{--ui-animaton-speed:0.2s}.gxg-title-01{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em}.gxg-title-01--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-on-primary)}.gxg-title-02{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em}.gxg-title-02--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em;color:var(--color-on-primary)}.gxg-title-03{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-xs);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em}.gxg-title-03--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-xs);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em;color:var(--color-on-primary)}.gxg-title-04{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em}.gxg-title-04--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-on-primary)}.gxg-title-05{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;line-height:1.556em}.gxg-title-05--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;line-height:1.556em;color:var(--color-on-primary)}.gxg-text{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em}.gxg-text--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-on-primary)}.gxg-text--gray{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--gray-05)}.gxg-quote{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;font-style:italic}.gxg-quote--negative{color:var(--color-on-primary)}.gxg-link{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-primary);text-decoration:underline;cursor:pointer;display:inline-block}.gxg-link:hover{color:var(--color-primary-hover)}.gxg-link:active{color:var(--color-primary-active)}.gxg-link-gray{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-primary);text-decoration:underline;cursor:pointer;display:inline-block;color:var(--gray-04)}.gxg-link-gray:hover{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-primary);text-decoration:underline;cursor:pointer;display:inline-block;color:var(--gray-04);color:var(--gray-06)}.gxg-alert-error{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-error-dark);display:inline-block}.gxg-alert-warning{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-warning-dark);display:inline-block}.gxg-alert-success{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-success-dark);display:inline-block}.gxg-tab--disabled{color:var(--color-primary-disabled);pointer-events:none}.gxg-tab--disabled[disabled]{color:var(--color-primary-disabled);pointer-events:none}.gxg-label{font-family:var(--font-family-primary) !important;font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm) !important;letter-spacing:var(--letter-spacing-xs);color:var(--color-primary-enabled);text-align:center;line-height:1.455em}.gxg-label:hover{color:var(--color-primary-hover)}.gxg-label:focus{color:var(--color-primary-active)}.gxg-label:active{color:var(--color-primary-active)}.gxg-label[disabled]{color:var(--color-primary-disabled)}.gxg-label--negative{color:var(--color-on-primary)}.gxg-label--negative[disabled]{color:var(--color-on-disabled)}.gxg-button-styles{font-family:var(--font-family-primary) !important;font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm) !important;letter-spacing:var(--letter-spacing-xs);color:var(--color-primary-enabled);text-align:center;line-height:1.455em}.gxg-scrollbar{}.gxg-scrollbar::-webkit-scrollbar{width:6px;height:6px}.gxg-scrollbar::-webkit-scrollbar-track{background-color:var(--gray-02);border-radius:10px}.gxg-scrollbar::-webkit-scrollbar-thumb{background:var(--gray-05);border-radius:10px}.gxg-scrollbar::-webkit-scrollbar-thumb:hover{background:var(--gray-04);cursor:pointer}:host{font-family:var(--font-family-primary);display:block}:host gxg-form-text::part(input){padding-inline-end:var(--spacing-comp-05)}:host gxg-form-text.clear-icon::part(input){padding-inline-end:calc(var(--spacing-comp-05) * 2)}:host .main-container{width:100%;position:relative;}:host .main-container .label{font-size:var(--font-size-sm);margin-bottom:var(--spacing-lay-xs)}:host .main-container .search-container{flex:1;position:relative}:host .main-container .search-container .buttons-wrapper{position:absolute;top:2px;height:calc(100% - 4px);display:flex;align-items:center;padding-inline-start:var(--spacing-comp-01);inset-inline-end:2px}:host .main-container .search-container .buttons-wrapper .button-icon{height:20px;width:20px}:host .main-container .items-container{border:var(--border-width-sm) solid var(--gxg-border-color--regular);border-radius:var(--border-radius-md);border-top-left-radius:0;border-top-right-radius:0;border-top-width:0;overflow-y:auto;overscroll-behavior:contain;background-color:var(--color-background);position:fixed;width:inherit;box-sizing:border-box;z-index:999;display:none;}:host .main-container .items-container::-webkit-scrollbar{width:6px;height:6px}:host .main-container .items-container::-webkit-scrollbar-track{background-color:var(--gray-02);border-radius:10px}:host .main-container .items-container::-webkit-scrollbar-thumb{background:var(--gray-05);border-radius:10px}:host .main-container .items-container::-webkit-scrollbar-thumb:hover{background:var(--gray-04);cursor:pointer}:host .main-container .items-container--show{display:block}:host .main-container .items-container--no-match{display:none}:host .main-container .items-container .no-ocurrences-found{font-family:var(--font-family-primary);font-size:var(--font-size-sm);color:var(--color-on-background);padding:var(--spacing-comp-01);background-color:var(--color-background)}:host .main-container .items-container .no-ocurrences-found span{display:block;color:var(--gray-04)}:host .main-container .items-container.exact-match{overflow-y:hidden}:host .main-container .items-container--above{transform:translateY(calc(-100% - 24px));border-top-width:1px;border-bottom-width:0;border-top-left-radius:var(--border-radius-md);border-top-right-radius:var(--border-radius-md);border-bottom-right-radius:0;border-bottom-left-radius:0}:host .search-and-items-container{flex:1}:host([label-position=start]) .main-container{display:flex;flex-direction:row}.messages-wrapper{margin-top:var(--spacing-comp-02);display:flex;gap:var(--spacing-comp-01);flex-direction:column}:host(.large) .main-container .label{display:flex;font-size:var(--font-size-lg);margin-bottom:var(--spacing-lay-xs);line-height:1.455em}:host(.large) .main-container .items-container .no-ocurrences-found{font-size:var(--font-size-lg)}";
31
+
32
+ const GxgComboBox = class {
33
+ constructor(hostRef) {
34
+ index.registerInstance(this, hostRef);
35
+ this.valueChanged = index.createEvent(this, "valueChanged", 7);
36
+ this.opened = index.createEvent(this, "opened", 7);
37
+ this.closed = index.createEvent(this, "closed", 7);
38
+ this.toggled = index.createEvent(this, "toggled", 7);
39
+ this.parts = {
40
+ input: "input",
41
+ clearButton: "clear-button",
42
+ toggleButton: "toggle-button",
43
+ };
44
+ this.setInitialValueTimes = 0;
45
+ /**
46
+ * The presence of this attribute makes the input disabled
47
+ */
48
+ this.disabled = false;
49
+ /**
50
+ * The combo label
51
+ */
52
+ this.label = undefined;
53
+ /**
54
+ * The input label
55
+ */
56
+ this.labelPosition = "above";
57
+ /**
58
+ * The combo min-width
59
+ */
60
+ this.minWidth = "0";
61
+ /**
62
+ * The combo max-width
63
+ */
64
+ this.maxWidth = "100%";
65
+ /**
66
+ * The combo list max height
67
+ */
68
+ this.listMaxHeight = "244px";
69
+ /**
70
+ * The combo placeholder
71
+ */
72
+ this.placeholder = "Search item";
73
+ /**
74
+ * The presence of this attribute disables the filter
75
+ */
76
+ this.disableFilter = false;
77
+ /**
78
+ * The presence of this attribute disables the clear button
79
+ */
80
+ this.disableClear = false;
81
+ /**
82
+ * If this attribute is present, "value" will only return something if a comboItem is selected, otherwise it will return undefined.
83
+ * if this attribute is not present, "value" will return the value of the actual comboItem, or whatever text the comboItem has.
84
+ */
85
+ this.strict = false;
86
+ /**
87
+ * The presence of this attribute with make the filter search for values with case sensitive distinction
88
+ */
89
+ this.caseSensitive = false;
90
+ /**
91
+ * The container 'items container' position
92
+ */
93
+ this.listPosition = "below";
94
+ /**
95
+ * Centers the label
96
+ */
97
+ this.centerLabel = false;
98
+ /*VALIDATION*/
99
+ /**
100
+ * The presence of this attribute makes the commbo required
101
+ */
102
+ this.required = false;
103
+ /**
104
+ * The validation status
105
+ *
106
+ */
107
+ this.validationStatus = "indeterminate";
108
+ /**
109
+ * If true, it will position the cursor at the end when the input is focused.
110
+ */
111
+ this.cursorEnd = false;
112
+ this.userTyped = false;
113
+ this.formMessageLogic = form.formMessageLogic;
114
+ this.inputTextValue = "";
115
+ this.listIsOpen = false;
116
+ this.inputTextIcon = undefined;
117
+ this.inputTextIconPosition = null;
118
+ this.noMatch = false;
119
+ this.lastAllowedValue = undefined;
120
+ this.slottedContent = null;
121
+ this.selectionProgramatic = true;
122
+ this.myObserver = null;
123
+ this.detectClickOutsideCombo = this.detectClickOutsideComboFunc.bind(this);
124
+ this.detectMouseScroll = this.detectMouseScrollFunc.bind(this);
125
+ this.attachExportParts = () => {
126
+ const part = this.el.getAttribute("part");
127
+ const exportPartsResult = exportParts.exportParts(part, this.parts);
128
+ exportPartsResult.length && (this.exportparts = exportPartsResult);
129
+ };
130
+ this.mutationRemoveObserver = () => {
131
+ this._mo = mutationObserverRemoved(this.el, this);
132
+ };
133
+ /*********************************
134
+ HANDLERS
135
+ *********************************/
136
+ this.inputHandler = (e) => {
137
+ this.userTyped = true;
138
+ const value = this.sanitizeString(e.detail);
139
+ const filteredItems = this.filterList(value);
140
+ if (!this.strict) {
141
+ this.value = value;
142
+ }
143
+ else if (filteredItems.length === 1) {
144
+ /*on strict mode, only set value if there is an exact match*/
145
+ this.value = filteredItems[0].value;
146
+ }
147
+ };
148
+ this.keyDownHandler = (e) => {
149
+ if (e.code === types.KeyboardKeys.ARROW_DOWN || e.code === types.KeyboardKeys.ARROW_UP) {
150
+ e.preventDefault();
151
+ }
152
+ let newItem;
153
+ if (e.code === types.KeyboardKeys.ARROW_DOWN) {
154
+ newItem = this.getNewItem("next");
155
+ (newItem === null || newItem === void 0 ? void 0 : newItem.value) && (this.value = newItem === null || newItem === void 0 ? void 0 : newItem.value);
156
+ repositionScroll.repositionScroll(this.itemsContainer, this.selectedItem, types.KeyboardKeys.ARROW_DOWN);
157
+ e.altKey && this.showList();
158
+ }
159
+ else if (e.code === types.KeyboardKeys.ARROW_UP) {
160
+ newItem = this.getNewItem("prev");
161
+ (newItem === null || newItem === void 0 ? void 0 : newItem.value) && (this.value = newItem === null || newItem === void 0 ? void 0 : newItem.value);
162
+ repositionScroll.repositionScroll(this.itemsContainer, this.selectedItem, types.KeyboardKeys.ARROW_UP);
163
+ }
164
+ else if (e.code === types.KeyboardKeys.ENTER) {
165
+ this.hideList();
166
+ this.showAllItems();
167
+ }
168
+ else if (e.code === types.KeyboardKeys.SPACE) {
169
+ this.showList();
170
+ }
171
+ else if (e.code === types.KeyboardKeys.ESCAPE) {
172
+ this.showAllItems();
173
+ this.hideList();
174
+ }
175
+ else if (e.code === types.KeyboardKeys.TAB && this.showList) {
176
+ this.hideList();
177
+ }
178
+ };
179
+ this.handleValueChangeFormText = (e) => {
180
+ this.value = e.detail;
181
+ };
182
+ /*********************************
183
+ PRIVATE METHODS
184
+ *********************************/
185
+ this.filterList = (text) => {
186
+ text = this.sanitizeString(text);
187
+ !this.caseSensitive && (text = text.toLowerCase());
188
+ const enabledItems = this.getEnabledItems();
189
+ const filteredItems = [];
190
+ if (enabledItems.length) {
191
+ enabledItems.forEach((item) => {
192
+ const itemText = !this.caseSensitive
193
+ ? item.textContent.toLocaleLowerCase()
194
+ : item.textContent;
195
+ if (!item.disabled && itemText.includes(text)) {
196
+ filteredItems.push(item);
197
+ item.hidden = false;
198
+ }
199
+ else {
200
+ item.hidden = true;
201
+ }
202
+ });
203
+ }
204
+ if (filteredItems.length >= 1) {
205
+ this.showList();
206
+ }
207
+ else {
208
+ this.hideList();
209
+ }
210
+ return filteredItems;
211
+ };
212
+ this.showAllItems = () => {
213
+ const enabledItems = this.getEnabledItems();
214
+ enabledItems === null || enabledItems === void 0 ? void 0 : enabledItems.forEach((item) => {
215
+ (item === null || item === void 0 ? void 0 : item.hidden) && (item.hidden = false);
216
+ });
217
+ };
218
+ this.cleanup = () => {
219
+ this.myObserver.unobserve(document.body);
220
+ document.removeEventListener("click", this.detectClickOutsideCombo, true);
221
+ document.removeEventListener("scroll", this.detectMouseScroll, true);
222
+ this._mo.disconnect();
223
+ };
224
+ this.setup = () => {
225
+ this.setIndexes();
226
+ this.setInitialValue();
227
+ };
228
+ this.setIndexes = () => {
229
+ const allItems = this.getAllItems();
230
+ allItems.forEach((item, i) => {
231
+ item.index = i;
232
+ });
233
+ };
234
+ this.getEnabledItems = () => {
235
+ const enabledItems = [];
236
+ const allItems = this.getAllItems();
237
+ allItems.forEach((item) => {
238
+ !item.disabled && enabledItems.push(item);
239
+ });
240
+ return enabledItems;
241
+ };
242
+ this.getFilteredItems = () => {
243
+ const enabledItems = this.getEnabledItems();
244
+ const filteredItems = [];
245
+ enabledItems.forEach((item) => {
246
+ !item.hidden && filteredItems.push(item);
247
+ });
248
+ return filteredItems;
249
+ };
250
+ this.getAllItems = () => {
251
+ const allItems = [];
252
+ const allItemsNodeList = this.el.querySelectorAll("gxg-combo-box-item");
253
+ allItemsNodeList.forEach((item) => {
254
+ allItems.push(item);
255
+ });
256
+ return allItems;
257
+ };
258
+ this.getItemByValue = (value) => {
259
+ let item;
260
+ if (value) {
261
+ const enabledItems = this.getEnabledItems();
262
+ item = enabledItems.find((item) => {
263
+ return !item.disabled && (item === null || item === void 0 ? void 0 : item.value) && item.value === value;
264
+ });
265
+ }
266
+ return item;
267
+ };
268
+ this.clearSelectedItem = () => {
269
+ const enabledItems = this.getEnabledItems();
270
+ enabledItems === null || enabledItems === void 0 ? void 0 : enabledItems.forEach((item) => {
271
+ item.selected && (item.selected = false);
272
+ });
273
+ this.selectedItem = undefined;
274
+ this.clearIcon();
275
+ };
276
+ this.getValueByText = (text) => {
277
+ !this.caseSensitive && (text = text.toLowerCase());
278
+ const enabledItems = this.getEnabledItems();
279
+ const item = enabledItems === null || enabledItems === void 0 ? void 0 : enabledItems.find((item) => {
280
+ const itemText = !this.caseSensitive
281
+ ? item.textContent.toLocaleLowerCase()
282
+ : item.textContent;
283
+ return !item.disabled && itemText === text;
284
+ });
285
+ return item === null || item === void 0 ? void 0 : item.value;
286
+ };
287
+ this.getNewItem = (direction) => {
288
+ const filteredItems = this.getFilteredItems();
289
+ const indexInFiltered = filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.findIndex((item) => {
290
+ return item === this.selectedItem;
291
+ });
292
+ if (direction === "next") {
293
+ if (indexInFiltered === -1) {
294
+ /*no selectedItem at the time*/
295
+ return filteredItems[0];
296
+ }
297
+ return filteredItems[indexInFiltered + 1];
298
+ }
299
+ else if (direction === "prev") {
300
+ if (indexInFiltered !== -1) {
301
+ return filteredItems[indexInFiltered - 1];
302
+ }
303
+ }
304
+ };
305
+ this.setSelectedItem = (item) => {
306
+ if (item) {
307
+ this.selectedItem && (this.selectedItem.selected = false);
308
+ item.selected = true;
309
+ this.selectedItem = item;
310
+ return true;
311
+ }
312
+ return false;
313
+ };
314
+ this.sanitizeString = (value) => {
315
+ if (typeof value === "string") {
316
+ return value.replace(/\s+/g, " ").trim();
317
+ }
318
+ return value;
319
+ };
320
+ this.setInitialValue = () => {
321
+ this.setInitialValueTimes++;
322
+ const firstItem = this.getEnabledItems()[0];
323
+ if (!this.value || this.removedItem !== undefined) {
324
+ if (firstItem) {
325
+ this.value = firstItem.value;
326
+ this.text = firstItem.innerText;
327
+ }
328
+ else {
329
+ if (this.strict) {
330
+ this.value = undefined;
331
+ }
332
+ }
333
+ }
334
+ else {
335
+ const item = this.getItemByValue(this.value);
336
+ if (item) {
337
+ this.text = item.innerText;
338
+ }
339
+ else {
340
+ if (this.strict) {
341
+ this.value = undefined;
342
+ }
343
+ else {
344
+ this.text = this.value.toString();
345
+ }
346
+ }
347
+ }
348
+ };
349
+ this.toggleListButtonClickHandler = () => {
350
+ if (!this.disabled) {
351
+ this.showAllItems();
352
+ this.toggleList();
353
+ this.focus();
354
+ }
355
+ };
356
+ this.inputTextClickHandler = () => {
357
+ if (!this.disabled) {
358
+ this.disableFilter && this.toggleList();
359
+ }
360
+ };
361
+ this.toggleList = () => {
362
+ if (!this.disabled) {
363
+ this.listIsOpen = !this.listIsOpen;
364
+ }
365
+ };
366
+ this.showList = () => {
367
+ if (!this.disabled) {
368
+ this.listIsOpen = true;
369
+ }
370
+ };
371
+ this.hideList = () => {
372
+ if (!this.disabled) {
373
+ this.listIsOpen = false;
374
+ }
375
+ };
376
+ this.clearIcon = () => {
377
+ if (!this.disabled) {
378
+ this.inputTextIcon = null;
379
+ this.inputTextIconPosition = null;
380
+ }
381
+ };
382
+ }
383
+ disabledHandler(newValue) {
384
+ if (newValue === true) {
385
+ this.valueBeforeDisabled = this.value;
386
+ this.textBeforeDisabled = this.text;
387
+ this.iconBeforeDisabled = this.inputTextIcon;
388
+ this.iconPositionBeforeDisabled = this.inputTextIconPosition;
389
+ this.value = null;
390
+ this.inputTextIcon = null;
391
+ this.inputTextIconPosition = null;
392
+ }
393
+ else {
394
+ this.value = this.valueBeforeDisabled;
395
+ this.text = this.textBeforeDisabled;
396
+ this.inputTextIcon = this.iconBeforeDisabled;
397
+ this.inputTextIconPosition = this.iconPositionBeforeDisabled;
398
+ }
399
+ }
400
+ componentDidUpdate() {
401
+ const itemsContainerIsOverflowing = this.itemsContainerBottomOverflows();
402
+ itemsContainerIsOverflowing
403
+ ? (this.listPosition = "above")
404
+ : (this.listPosition = "below");
405
+ }
406
+ componentWillLoad() {
407
+ this.setup();
408
+ this.attachExportParts();
409
+ this.mutationRemoveObserver();
410
+ }
411
+ componentDidLoad() {
412
+ this.resizeObserver();
413
+ }
414
+ disconnectedCallback() {
415
+ this.cleanup();
416
+ }
417
+ /*********************************
418
+ METHODS
419
+ *********************************/
420
+ async open() {
421
+ this.listIsOpen = true;
422
+ }
423
+ async close() {
424
+ this.listIsOpen = false;
425
+ }
426
+ async getValueByIndex(index) {
427
+ const enabledItems = this.getEnabledItems();
428
+ const foundItem = enabledItems.filter((item) => item.index === index)[0];
429
+ return foundItem === null || foundItem === void 0 ? void 0 : foundItem.value;
430
+ }
431
+ async setValueByIndex(index) {
432
+ const enabledItems = this.getEnabledItems();
433
+ const foundItem = enabledItems.filter((item) => item.index === index)[0];
434
+ if (foundItem && foundItem.value) {
435
+ this.value = foundItem.value;
436
+ return true;
437
+ }
438
+ return false;
439
+ }
440
+ async selectInputText() {
441
+ this.inputText.selectInputText();
442
+ }
443
+ /*********************************
444
+ LISTEN
445
+ *********************************/
446
+ itemSelectedHandler(event) {
447
+ this.value = event.detail.value;
448
+ this.inputText.focus();
449
+ }
450
+ itemDidLoadHandler() {
451
+ this.setIndexes();
452
+ this.setInitialValue();
453
+ }
454
+ keyDownComboItemHandler(event) {
455
+ event.stopPropagation();
456
+ if (event.detail === "ArrowUp") {
457
+ this.inputText.focus();
458
+ }
459
+ else if (event.detail === "Tab" || event.detail === "Escape") {
460
+ this.listIsOpen = false;
461
+ this.inputText.focus();
462
+ }
463
+ }
464
+ /*********************************
465
+ WATCH
466
+ *********************************/
467
+ onValueChanged(newValue) {
468
+ if (this.setInitialValueTimes > 1) {
469
+ this.valueChanged.emit(newValue);
470
+ }
471
+ this.clearSelectedItem();
472
+ let value;
473
+ let newItem = undefined;
474
+ if (this.userTyped) {
475
+ value = this.getValueByText(newValue);
476
+ }
477
+ else {
478
+ !this.listIsOpen && this.showAllItems();
479
+ value = newValue;
480
+ }
481
+ newItem = this.getItemByValue(value);
482
+ if (newItem) {
483
+ this.setSelectedItem(newItem);
484
+ this.setIcon(newItem.icon);
485
+ (newItem === null || newItem === void 0 ? void 0 : newItem.textContent) && (this.text = newItem.textContent);
486
+ }
487
+ else {
488
+ //this.setIcon(undefined);
489
+ if (this.strict) {
490
+ this.text = undefined;
491
+ this.value = undefined;
492
+ }
493
+ else {
494
+ this.text = newValue;
495
+ }
496
+ }
497
+ this.userTyped = false;
498
+ }
499
+ listIsOpenHandler(newValue) {
500
+ let isOpen = false;
501
+ if (newValue) {
502
+ //list is open
503
+ isOpen = true;
504
+ document.addEventListener("click", this.detectClickOutsideCombo, true);
505
+ document.addEventListener("scroll", this.detectMouseScroll, true);
506
+ this.opened.emit();
507
+ //Reposition .items-container, since it has fixed position
508
+ this.repositionItemsContainer();
509
+ }
510
+ else {
511
+ //list is closed
512
+ document.removeEventListener("click", this.detectClickOutsideCombo, true);
513
+ document.removeEventListener("scroll", this.detectMouseScroll, true);
514
+ this.closed.emit();
515
+ }
516
+ this.toggled.emit(isOpen);
517
+ }
518
+ selectedItemHandler(newItem) {
519
+ newItem && (newItem.selected = true);
520
+ }
521
+ removedItemHandler(removedItem) {
522
+ const value = removedItem.value;
523
+ if (value === this.value) {
524
+ /*The removed item was the one selected on the combo. Re-evaluation of new value is needed*/
525
+ this.setup();
526
+ }
527
+ }
528
+ setIcon(icon) {
529
+ if (icon) {
530
+ this.inputTextIcon = icon;
531
+ this.inputTextIconPosition = "start";
532
+ }
533
+ else {
534
+ this.inputTextIcon = null;
535
+ this.inputTextIconPosition = null;
536
+ }
537
+ }
538
+ focus() {
539
+ this.inputText.focus();
540
+ }
541
+ detectClickOutsideComboFunc(event) {
542
+ const comboMainContainer = this.el.shadowRoot.querySelector(".main-container");
543
+ const x = event.x;
544
+ const y = event.y;
545
+ //Contextual menu coordinates
546
+ const comboMainContainerArea = comboMainContainer.getBoundingClientRect();
547
+ if ((x > comboMainContainerArea.left &&
548
+ x < comboMainContainerArea.right &&
549
+ y > comboMainContainerArea.top &&
550
+ y < comboMainContainerArea.bottom) ||
551
+ (event.screenX === 0 &&
552
+ event.screenY === 0 &&
553
+ event.clientX === 0 &&
554
+ event.clientY === 0)) ;
555
+ else {
556
+ this.listIsOpen = false;
557
+ //Click happened outside the combo
558
+ }
559
+ }
560
+ detectMouseScrollFunc() {
561
+ this.listIsOpen = false;
562
+ }
563
+ clearCombo() {
564
+ if (!this.disabled) {
565
+ this.value = undefined;
566
+ this.listIsOpen = true;
567
+ this.focus();
568
+ }
569
+ }
570
+ resizeObserver() {
571
+ this.myObserver = new ResizeObserver((entries) => {
572
+ entries.forEach(() => {
573
+ this.repositionItemsContainer();
574
+ });
575
+ });
576
+ this.myObserver.observe(document.body);
577
+ this.myObserver.observe(this.el);
578
+ }
579
+ repositionItemsContainer() {
580
+ //redefine .main-container width
581
+ const inputText = this.inputText;
582
+ const inputTextWidth = inputText.clientWidth;
583
+ this.itemsContainer.style.width = inputTextWidth + "px";
584
+ //redefine .items-container "top" value
585
+ const inputTextBoundingClient = inputText.getBoundingClientRect();
586
+ const inputTextY = inputTextBoundingClient.y;
587
+ const inputTextHeight = inputTextBoundingClient.height;
588
+ this.itemsContainer.style.top = inputTextY + inputTextHeight + "px";
589
+ }
590
+ itemsContainerBottomOverflows() {
591
+ const viewportHeight = window.innerHeight;
592
+ const comboBottom = this.el.getBoundingClientRect().bottom;
593
+ const itemsContainerHeight = this.itemsContainer.clientHeight;
594
+ const result = comboBottom + itemsContainerHeight;
595
+ const itOverflows = result > viewportHeight ;
596
+ return itOverflows;
597
+ }
598
+ render() {
599
+ const clearIcon = this.value && !this.disableFilter && !this.disableClear;
600
+ return (index.h(index.Host, { class: {
601
+ "gxg-combo-box--disabled": this.disableFilter,
602
+ large: store.state.large,
603
+ }, style: { maxWidth: this.maxWidth, minWidth: this.minWidth }, exportParts: this.exportparts ? this.exportparts : null }, index.h("div", { class: {
604
+ "main-container": true,
605
+ }, ref: (el) => (this.mainContainer = el) }, this.label ? (index.h("gxg-label", { labelPosition: this.labelPosition, center: this.centerLabel, width: this.labelWidth }, this.label)) : null, index.h("div", { class: "search-and-items-container", ref: (el) => (this.searchItemsContainer = el) }, index.h("div", { class: { "search-container": true } }, index.h("gxg-form-text", { placeholder: this.placeholder, onInput: this.inputHandler.bind(this), onKeyDown: this.keyDownHandler, onClick: this.inputTextClickHandler, value: this.text, icon: this.fixedIcon || this.inputTextIcon, iconPosition: this.fixedIcon ? "start" : this.inputTextIconPosition, readonly: this.disableFilter, ref: (el) => (this.inputText = el), validationStatus: this.validationStatus, disabled: this.disabled, onValueChanged: this.handleValueChangeFormText, cursorEnd: this.cursorEnd, preventValueChangedEmit: true, preventValueChangeOnDisabled: true, class: { "clear-icon": clearIcon }, part: this.parts.input }), index.h("div", { class: "buttons-wrapper" }, clearIcon ? (index.h("gxg-button", { class: { "button-icon delete-icon": true }, icon: "menus/delete", type: "tertiary", onClick: () => this.clearCombo(), tabindex: "-1", fit: true, disabled: this.disabled, part: this.parts.clearButton })) : null, index.h("gxg-button", { class: { "button-icon": true }, icon: "navigation/arrow-down", type: "secondary-icon-only", onClick: this.toggleListButtonClickHandler, fit: true, disabled: this.disabled, tabindex: "-1", part: this.parts.toggleButton }))), index.h("div", { class: {
606
+ "items-container": true,
607
+ "items-container--show": this.listIsOpen,
608
+ "items-container--no-match": this.noMatch,
609
+ "items-container--below": this.listPosition === "below",
610
+ "items-container--above": this.listPosition === "above",
611
+ }, style: { maxHeight: this.listMaxHeight }, ref: (el) => (this.itemsContainer = el) }, index.h("slot", null), this.noMatch && this.strict ? (index.h("div", { class: "no-ocurrences-found" }, "No occurrences found", index.h("span", null, "ctrl/cmd + backspace to erase"))) : null))), this.formMessageLogic(this)));
612
+ }
613
+ static get delegatesFocus() { return true; }
614
+ get el() { return index.getElement(this); }
615
+ static get watchers() { return {
616
+ "disabled": ["disabledHandler"],
617
+ "value": ["onValueChanged"],
618
+ "listIsOpen": ["listIsOpenHandler"],
619
+ "selectedItem": ["selectedItemHandler"],
620
+ "removedItem": ["removedItemHandler"]
621
+ }; }
622
+ };
623
+ GxgComboBox.style = comboBoxCss;
624
+
625
+ const comboBoxItemCss = ":host(.gxg--disabled) .form-element,:host(.gxg--disabled.form-element){pointer-events:none;background-color:var(--color-background-disabled) !important;color:var(--color-on-background--disabled) !important;border-color:var(--gxg-border-color--disabled) !important;cursor:default !important}:host{display:block;cursor:pointer;box-sizing:border-box;display:flex;align-items:center;font-family:var(--font-family-primary);font-size:var(--font-size-sm);background-color:var(--color-background);color:var(--color-on-background);opacity:1;overflow:hidden}:host .container{display:flex;align-items:center;padding:var(--spacing-comp-00) var(--spacing-comp-01);width:100%;height:var(--gxg-list-item-height);box-sizing:border-box;}:host gxg-icon{flex-shrink:0}.description{white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis}:host(.no-icon) .container{padding-left:var(--spacing-comp-02)}:host([hidden]){display:none}:host(.display-none){display:none}:host(:hover){background-color:var(--gxg-background-color-item-hover)}:host([selected]){background-color:var(--gxg-background-color-item-selected);color:var(--gxg-color-selected)}:host(.large){font-size:var(--font-size-lg);min-height:auto}:host(.large) gxg-icon{margin-right:var(--spacing-comp-01)}";
626
+
627
+ const GxgComboBoxItem = class {
628
+ constructor(hostRef) {
629
+ index.registerInstance(this, hostRef);
630
+ this.itemSelected = index.createEvent(this, "itemSelected", 7);
631
+ this.itemDidLoad = index.createEvent(this, "itemDidLoad", 7);
632
+ this.keyDownPressed = index.createEvent(this, "keyDownPressed", 7);
633
+ /**
634
+ * Any icon that belongs to Gemini icon library: https://gx-gemini.netlify.app/?path=/story/icons
635
+ */
636
+ this.icon = undefined;
637
+ /**
638
+ * The presence of this attribute makes this combo-item disabled and not interactive.
639
+ */
640
+ this.disabled = false;
641
+ /**
642
+ * The presence of this attribute makes this combo-item selected.
643
+ */
644
+ this.selected = false;
645
+ /**
646
+ * True if the text typed on the combo box input is equal to this combo box item text
647
+ */
648
+ this.exactMatch = false;
649
+ /**
650
+ * This property hides the combo box item
651
+ */
652
+ this.hidden = false;
653
+ /*********************************
654
+ WATCH
655
+ *********************************/
656
+ this.setup = () => {
657
+ if (!this.value) {
658
+ this.value = this.el.innerHTML;
659
+ }
660
+ };
661
+ this.clickHandler = () => {
662
+ this.itemSelected.emit({
663
+ el: this.el,
664
+ index: this.index,
665
+ value: this.value,
666
+ icon: this.icon,
667
+ });
668
+ };
669
+ }
670
+ componentWillLoad() {
671
+ this.setup();
672
+ this.disabled ? (this.iconColor = "ondisabled") : (this.iconColor = "auto");
673
+ }
674
+ componentDidLoad() {
675
+ this.itemDidLoad.emit({
676
+ el: this.el,
677
+ index: this.index,
678
+ value: this.value,
679
+ icon: this.icon,
680
+ });
681
+ }
682
+ iconColorHandler() {
683
+ if (this.disabled) {
684
+ return "disabled";
685
+ }
686
+ else if (this.selected) {
687
+ return "auto";
688
+ }
689
+ else {
690
+ return "auto";
691
+ }
692
+ }
693
+ render() {
694
+ return (index.h(index.Host, { onClick: this.clickHandler, class: {
695
+ large: store.state.large,
696
+ "no-icon": !this.icon,
697
+ [classesNames.commonClassesNames["DISABLED_CLASS"]]: this.disabled,
698
+ } }, index.h("div", { class: { container: true, "form-element": true } }, this.icon ? (index.h("gxg-icon", { color: this.iconColorHandler(), size: store.state.large ? "regular" : "small", type: this.icon })) : null, index.h("div", { class: "description" }, index.h("slot", null)))));
699
+ }
700
+ get el() { return index.getElement(this); }
701
+ };
702
+ GxgComboBoxItem.style = comboBoxItemCss;
703
+
704
+ exports.gxg_combo_box = GxgComboBox;
705
+ exports.gxg_combo_box_item = GxgComboBoxItem;