@rededor/cura 1.0.0-alpha.5 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-bcffd819.js.map +1 -1
- package/dist/cjs/{cura-button-transparent_2.cjs.entry.js → cura-accordion_12.cjs.entry.js} +814 -40
- package/dist/cjs/cura-accordion_12.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-button-transparent.cjs.entry.js +103 -0
- package/dist/cjs/cura-button-transparent.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-dropdown-search.cjs.entry.js +5 -3
- package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -1
- package/dist/cjs/cura.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.css +3 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +22 -2
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/cura-input-text.css +10 -43
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js +3 -2
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js +1 -5
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js.map +1 -1
- package/dist/collection/components/forms/cura-select/cura-select.css +11 -44
- package/dist/collection/components/forms/cura-select/cura-select.js +68 -44
- package/dist/collection/components/forms/cura-select/cura-select.js.map +1 -1
- package/dist/components/cura-dropdown-search.js +6 -3
- package/dist/components/cura-dropdown-search.js.map +1 -1
- package/dist/components/cura-input-text2.js +4 -7
- package/dist/components/cura-input-text2.js.map +1 -1
- package/dist/components/cura-select2.js +67 -45
- package/dist/components/cura-select2.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/cura.esm.js.map +1 -1
- package/dist/cura/p-0b1829ed.entry.js +2 -0
- package/dist/cura/p-0b1829ed.entry.js.map +1 -0
- package/dist/cura/p-335323b5.entry.js +2 -0
- package/dist/cura/p-335323b5.entry.js.map +1 -0
- package/dist/cura/p-70c369b1.js.map +1 -1
- package/dist/cura/p-89014323.entry.js +2 -0
- package/dist/cura/p-89014323.entry.js.map +1 -0
- package/dist/esm/app-globals-f2da2b14.js.map +1 -1
- package/dist/esm/{cura-button-transparent_2.entry.js → cura-accordion_12.entry.js} +804 -40
- package/dist/esm/cura-accordion_12.entry.js.map +1 -0
- package/dist/esm/cura-button-transparent.entry.js +99 -0
- package/dist/esm/cura-button-transparent.entry.js.map +1 -0
- package/dist/esm/cura-dropdown-search.entry.js +5 -3
- package/dist/esm/cura-dropdown-search.entry.js.map +1 -1
- package/dist/esm/cura.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +6 -0
- package/dist/types/components/forms/cura-select/cura-select.d.ts +8 -11
- package/dist/types/components.d.ts +8 -0
- package/package.json +2 -2
- package/dist/cjs/cura-accordion_9.cjs.entry.js +0 -545
- package/dist/cjs/cura-accordion_9.cjs.entry.js.map +0 -1
- package/dist/cjs/cura-button-transparent_2.cjs.entry.js.map +0 -1
- package/dist/cjs/cura-select_2.cjs.entry.js +0 -325
- package/dist/cjs/cura-select_2.cjs.entry.js.map +0 -1
- package/dist/cura/p-11e828b5.entry.js +0 -2
- package/dist/cura/p-11e828b5.entry.js.map +0 -1
- package/dist/cura/p-25de72c5.entry.js +0 -2
- package/dist/cura/p-25de72c5.entry.js.map +0 -1
- package/dist/cura/p-539fce94.entry.js +0 -2
- package/dist/cura/p-539fce94.entry.js.map +0 -1
- package/dist/cura/p-a5e53dd4.entry.js +0 -2
- package/dist/cura/p-a5e53dd4.entry.js.map +0 -1
- package/dist/esm/cura-accordion_9.entry.js +0 -533
- package/dist/esm/cura-accordion_9.entry.js.map +0 -1
- package/dist/esm/cura-button-transparent_2.entry.js.map +0 -1
- package/dist/esm/cura-select_2.entry.js +0 -320
- package/dist/esm/cura-select_2.entry.js.map +0 -1
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-98e7ba54.js');
|
|
6
|
-
|
|
7
|
-
const curaSelectCss = ":host{display:block;position:relative;font-family:var(--font-family)}.wrapper{width:100%;user-select:none;text-align:left !important}.wrapper cura-label{margin-bottom:8px}.wrapper .helper-text{margin-top:8px;color:var(--neutral-dark)}.wrapper .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper .cura-input-field .feedback-icon{padding-left:12px}.wrapper .cura-input-field .up-down-icon{order:3;padding-right:12px;cursor:pointer;pointer-events:all}.wrapper .cura-input-field input{padding:0px 12px 0px 8px}.wrapper .cura-input-field.open{border-radius:4px 4px 0 0 !important}.wrapper.transparent{background-color:transparent;padding:0px;max-height:80px}.wrapper.transparent .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;background-color:transparent !important;border:none !important;border-radius:0;height:27px}.wrapper.transparent .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.transparent .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.transparent .cura-input-field .feedback-icon{padding-left:12px}.wrapper.transparent .cura-input-field input{color:var(--neutral-black) !important;font-size:16px;font-weight:var(--font-weight-bold) !important;padding:0}.wrapper.transparent .cura-input-field input::placeholder{color:var(--neutral-black)}.wrapper.transparent .cura-input-field .feedback-icon{order:3;margin:0 20px 0 0}.wrapper.transparent:focus-within .cura-input-field{border:none !important;background-color:transparent !important}.wrapper.transparent:focus-within .cura-input-field input{border:none !important;outline:none}.wrapper.transparent .helper-text{margin-top:0px}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field{border-color:var(--neutral-dark)}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field input{color:var(--neutral-dark)}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper:focus-within .cura-input-field{border:2px solid var(--info-base) !important;background-color:var(--neutral-purewhite);outline:none}.wrapper:focus-within .cura-input-field input{color:var(--neutral-black) !important}.wrapper.success .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.success .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.success .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.success .cura-input-field .feedback-icon{padding-left:12px}.wrapper.success .cura-input-field input{color:var(--success-darker) !important}.wrapper.success .cura-input-field input::placeholder{color:var(--success-darker) !important}.wrapper.success:not(.transparent) .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;border:2px solid var(--success-dark) !important;background-color:var(--success-lighter) !important}.wrapper.success:not(.transparent) .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.success:not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.success:not(.transparent) .cura-input-field .feedback-icon{padding-left:12px}.wrapper.error .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.error .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.error .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.error .cura-input-field .feedback-icon{padding-left:12px}.wrapper.error .cura-input-field input{color:var(--error-darker) !important}.wrapper.error .cura-input-field input::placeholder{color:var(--error-darker) !important}.wrapper.error:not(.transparent) .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;border:2px solid var(--error-dark) !important;background-color:var(--error-lighter) !important}.wrapper.error:not(.transparent) .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.error:not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.error:not(.transparent) .cura-input-field .feedback-icon{padding-left:12px}.wrapper.disabled .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;background-color:var(--neutral-white);border:2px solid var(--neutral-base)}.wrapper.disabled .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.disabled .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.disabled .cura-input-field .feedback-icon{padding-left:12px}.wrapper.disabled .cura-input-field input{color:var(--neutral-medium)}.wrapper.disabled .cura-input-field input::placeholder{color:var(--neutral-medium)}.wrapper.small .cura-input-field{width:100%;height:32px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.small .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:12px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.small .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.small .cura-input-field .feedback-icon{padding-left:12px}.wrapper.small .cura-input-field input{line-height:13px;letter-spacing:0.72px}.wrapper.small .helper-text{margin-top:8px;color:var(--neutral-dark);font-weight:var(--font-weight-regular)}.wrapper.small.label .menu{top:53px}.wrapper.small .menu{top:33px}.wrapper.medium .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.medium .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.medium .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.medium .cura-input-field .feedback-icon{padding-left:12px}.wrapper.medium .cura-input-field input{line-height:16px;letter-spacing:0.56px}.wrapper.medium .helper-text{margin-top:8px;color:var(--neutral-dark);font-weight:var(--font-weight-regular)}.wrapper.medium.label .menu{top:61px}.wrapper.medium .menu{top:40px}.wrapper.large .cura-input-field{width:100%;height:44px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.large .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:16px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.large .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.large .cura-input-field .feedback-icon{padding-left:12px}.wrapper.large .helper-text{margin-top:8px;color:var(--neutral-dark);font-weight:var(--font-weight-bold)}.wrapper.large.label .menu{top:69px}.wrapper.large .menu{top:47px}.required{color:red}.menu{position:absolute;left:0;right:-1px;background:#fff;border:2px solid var(--neutral-light);border-radius:4px;z-index:1000;max-height:285px;overflow:hidden;border-top:transparent;align-items:center;scrollbar-color:var(--neutral-medium) var(--neutral-black-20);overflow-y:scroll;box-shadow:0px 4px 8px 0px rgba(38, 38, 38, 0.16)}.menu.open{border-radius:0 !important}";
|
|
8
|
-
const CuraSelectStyle0 = curaSelectCss;
|
|
9
|
-
|
|
10
|
-
const CuraSelect = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.selected = index.createEvent(this, "selected", 7);
|
|
14
|
-
if (hostRef.$hostElement$["s-ei"]) {
|
|
15
|
-
this.internals = hostRef.$hostElement$["s-ei"];
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
this.internals = hostRef.$hostElement$.attachInternals();
|
|
19
|
-
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Styles to be applied to the component.
|
|
23
|
-
*/
|
|
24
|
-
this.styles = {};
|
|
25
|
-
/**
|
|
26
|
-
* Theme object containing font and color information.
|
|
27
|
-
*/
|
|
28
|
-
this.theme = window.CuraAPI.theme;
|
|
29
|
-
/**
|
|
30
|
-
* Handles mutations observed by the MutationObserver.
|
|
31
|
-
* Updates the selected option or filters options based on the mutation type.
|
|
32
|
-
*/
|
|
33
|
-
this.handleMutations = (mutations) => {
|
|
34
|
-
mutations.forEach(mutation => {
|
|
35
|
-
if (mutation.type === 'attributes') {
|
|
36
|
-
if (mutation.attributeName === 'selected')
|
|
37
|
-
this.updateSelectedOption();
|
|
38
|
-
if (mutation.attributeName === 'value')
|
|
39
|
-
this.filterOptions();
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Handles the selection of an option.
|
|
45
|
-
*/
|
|
46
|
-
this.onOptiselected = (event) => {
|
|
47
|
-
const selectedOption = event.target;
|
|
48
|
-
this.clearSelectedAttributes();
|
|
49
|
-
selectedOption.setAttribute('selected', 'true');
|
|
50
|
-
};
|
|
51
|
-
this.handleKeyDown = (event) => {
|
|
52
|
-
var _a;
|
|
53
|
-
if (!this.isOpen)
|
|
54
|
-
return;
|
|
55
|
-
const { key } = event;
|
|
56
|
-
if (key === 'ArrowDown') {
|
|
57
|
-
event.preventDefault();
|
|
58
|
-
this.updateActiveIndex(1);
|
|
59
|
-
}
|
|
60
|
-
if (key === 'ArrowUp') {
|
|
61
|
-
event.preventDefault();
|
|
62
|
-
this.updateActiveIndex(-1);
|
|
63
|
-
}
|
|
64
|
-
if (key === 'Enter') {
|
|
65
|
-
(_a = this.options[this.activeIndex]) === null || _a === void 0 ? void 0 : _a.click();
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
this.handleInputChange = (e) => {
|
|
69
|
-
this.value = e.target.value;
|
|
70
|
-
this.isOpen = !!this.value.length;
|
|
71
|
-
this.internals.setFormValue(this.value);
|
|
72
|
-
};
|
|
73
|
-
this.handleClick = (event) => {
|
|
74
|
-
if (this.disabled)
|
|
75
|
-
return event.preventDefault();
|
|
76
|
-
const target = event.target;
|
|
77
|
-
if (target.tagName === 'CURA-SELECT-OPTION')
|
|
78
|
-
return this.onOptiselected(event);
|
|
79
|
-
this.isOpen = !this.isOpen;
|
|
80
|
-
};
|
|
81
|
-
this.label = '';
|
|
82
|
-
this.placeholder = '';
|
|
83
|
-
this.value = '';
|
|
84
|
-
this.mode = 'default';
|
|
85
|
-
this.size = 'medium';
|
|
86
|
-
this.status = 'default';
|
|
87
|
-
this.disabled = false;
|
|
88
|
-
this.required = false;
|
|
89
|
-
this.isHovered = false;
|
|
90
|
-
this.isFocused = false;
|
|
91
|
-
this.isOpen = false;
|
|
92
|
-
this.options = undefined;
|
|
93
|
-
this.activeIndex = -1;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Callback for form association.
|
|
97
|
-
*/
|
|
98
|
-
formAssociatedCallback(form) {
|
|
99
|
-
form.ariaLabel = this.label;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Callback to restore the switch state from the form.
|
|
103
|
-
*/
|
|
104
|
-
formStateRestoreCallback(state) {
|
|
105
|
-
this.value = state.value;
|
|
106
|
-
this.updateSelectedOption();
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Callback to reset the switch state when the form is reset.
|
|
110
|
-
*/
|
|
111
|
-
formResetCallback() {
|
|
112
|
-
this.value = '';
|
|
113
|
-
this.clearSelectedAttributes();
|
|
114
|
-
this.internals.setFormValue(this.value);
|
|
115
|
-
this.internals.setValidity({});
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Callback to update the switch's disabled state when the form's disabled state changes.
|
|
119
|
-
*/
|
|
120
|
-
formDisabledCallback(disabled) {
|
|
121
|
-
this.disabled = disabled;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Lifecycle method called before the component is rendered.
|
|
125
|
-
* Initializes the options for the select component.
|
|
126
|
-
*/
|
|
127
|
-
componentWillLoad() {
|
|
128
|
-
this.initializeOptions();
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Lifecycle method called after the component is rendered.
|
|
132
|
-
* Initializes select-related functionality.
|
|
133
|
-
*/
|
|
134
|
-
componentDidLoad() {
|
|
135
|
-
this.setupMutationObserver();
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Lifecycle method called when the component is connected to the DOM.
|
|
139
|
-
* Applies styles based on the theme.
|
|
140
|
-
*/
|
|
141
|
-
connectedCallback() {
|
|
142
|
-
this.applyStyles();
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Lifecycle method called when the component is disconnected from the DOM.
|
|
146
|
-
* Disconnects the MutationObserver if it exists.
|
|
147
|
-
*/
|
|
148
|
-
disconnectedCallback() {
|
|
149
|
-
var _a;
|
|
150
|
-
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
151
|
-
}
|
|
152
|
-
initializeOptions() {
|
|
153
|
-
this.options = this.host.querySelectorAll('cura-select-option');
|
|
154
|
-
this.options.forEach(option => {
|
|
155
|
-
option.setAttribute('size', this.size);
|
|
156
|
-
option.setAttribute('selected', 'false');
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Applies styles to the component based on the theme.
|
|
161
|
-
*/
|
|
162
|
-
applyStyles() {
|
|
163
|
-
const { fonts, colors } = this.theme;
|
|
164
|
-
const fontWeights = fonts.getWeights();
|
|
165
|
-
this.styles = Object.assign(Object.assign({}, this.styles), { '--font-weight-medium': fontWeights.medium, '--font-weight-bold': fontWeights.bold, '--font-weight-regular': fontWeights.regular, '--font-color': fonts.getColor(), '--font-family': fonts.getFamily(), '--font-size': fonts.getSize() });
|
|
166
|
-
const colorKeys = [
|
|
167
|
-
'primary-base', 'neutral-purewhite', 'neutral-white', 'neutral-black', 'neutral-medium', 'neutral-light',
|
|
168
|
-
'neutral-base', 'neutral-dark', 'success-dark', 'success-darker', 'success-lighter',
|
|
169
|
-
'error-lighter', 'error-dark', 'error-darker', 'error-base', 'info-base'
|
|
170
|
-
];
|
|
171
|
-
colorKeys.forEach(key => {
|
|
172
|
-
this.styles[`--${key}`] = colors.getColor(key);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Sets up a MutationObserver to watch for changes in the component.
|
|
177
|
-
*/
|
|
178
|
-
setupMutationObserver() {
|
|
179
|
-
this.mutationObserver = new MutationObserver(this.handleMutations);
|
|
180
|
-
this.mutationObserver.observe(this.host, { attributes: true, subtree: true, attributeFilter: ['selected', 'value'] });
|
|
181
|
-
}
|
|
182
|
-
updateSelectedOption() {
|
|
183
|
-
const selectedOption = this.host.querySelector('cura-select-option[selected]');
|
|
184
|
-
if (selectedOption) {
|
|
185
|
-
const selectedValue = selectedOption.textContent;
|
|
186
|
-
if (this.value !== selectedValue) {
|
|
187
|
-
this.value = selectedValue;
|
|
188
|
-
this.isOpen = false;
|
|
189
|
-
this.internals.setFormValue(this.value);
|
|
190
|
-
this.selected.emit({ value: this.value, selected: true });
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Clears the 'selected' attribute from all options.
|
|
196
|
-
*/
|
|
197
|
-
clearSelectedAttributes() {
|
|
198
|
-
this.options.forEach(option => option.removeAttribute('selected'));
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Filters the options based on the current input value.
|
|
202
|
-
*/
|
|
203
|
-
filterOptions() {
|
|
204
|
-
const inputValue = this.value.toLowerCase();
|
|
205
|
-
this.options.forEach(option => {
|
|
206
|
-
var _a;
|
|
207
|
-
const optionValue = ((_a = option.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
208
|
-
const isVisible = this.isOpen ? optionValue.includes(inputValue) : true;
|
|
209
|
-
option.style.display = isVisible ? 'block' : 'none';
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
updateActiveIndex(direction) {
|
|
213
|
-
if (this.options.length === 0)
|
|
214
|
-
return;
|
|
215
|
-
this.activeIndex = (this.activeIndex + direction + this.options.length) % this.options.length;
|
|
216
|
-
this.updateOptionHighlights();
|
|
217
|
-
}
|
|
218
|
-
updateOptionHighlights() {
|
|
219
|
-
this.options.forEach((option, index) => option.active = index === this.activeIndex);
|
|
220
|
-
}
|
|
221
|
-
getClasses() {
|
|
222
|
-
return {
|
|
223
|
-
wrapper: true,
|
|
224
|
-
label: !!this.label,
|
|
225
|
-
disabled: this.disabled,
|
|
226
|
-
transparent: this.mode === 'transparent',
|
|
227
|
-
[this.size.toLowerCase()]: true,
|
|
228
|
-
[this.status.toLowerCase()]: true,
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Determines the color based on the item type and component state.
|
|
233
|
-
*/
|
|
234
|
-
getColor(item) {
|
|
235
|
-
if (this.disabled)
|
|
236
|
-
return 'neutral-medium';
|
|
237
|
-
const isStatusDefault = this.status === 'default';
|
|
238
|
-
const isHoveredOrFocused = this.isFocused || this.isHovered;
|
|
239
|
-
if (item === 'label') {
|
|
240
|
-
if (!isStatusDefault || isHoveredOrFocused)
|
|
241
|
-
return 'neutral-black';
|
|
242
|
-
return 'neutral-dark';
|
|
243
|
-
}
|
|
244
|
-
if (isHoveredOrFocused && isStatusDefault)
|
|
245
|
-
return 'neutral-black';
|
|
246
|
-
if (this.status === 'success')
|
|
247
|
-
return 'success-dark';
|
|
248
|
-
if (this.status === 'error')
|
|
249
|
-
return 'error-dark';
|
|
250
|
-
return 'neutral-dark';
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Renders the icon based on the component's status.
|
|
254
|
-
*/
|
|
255
|
-
renderIcon() {
|
|
256
|
-
if (this.status === 'default')
|
|
257
|
-
return null;
|
|
258
|
-
const icon = { success: 'checkCircle', error: 'alertCircle' }[this.status];
|
|
259
|
-
return (index.h("cura-icon", { class: 'feedback-icon', name: icon, iconset: 'default', size: this.size === 'large' ? 20 : 16, color: this.getColor('icon'), style: this.styles }));
|
|
260
|
-
}
|
|
261
|
-
render() {
|
|
262
|
-
return (index.h(index.Host, { key: '35fd5d99705c940578485552a50bcec54efe036e', style: this.styles }, index.h("div", { key: '1903a7b03e32215678670a2d7d8b49643cc2086b', class: this.getClasses(), tabIndex: 0, ref: (el) => (this.selectRef = el), onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), onKeyDown: this.handleKeyDown, onClick: this.handleClick }, this.label && (index.h("cura-label", { key: '99aeba22f4b6204d936b6a9dcf6affa29e9411a8', class: 'label', weight: 'bold', size: this.size === 'large' ? 'small' : 'xsmall', color: this.getColor('label') }, this.label, " ", this.required && index.h("span", { key: '7e335f6fdb0ee6d9e987fba8ec245006f02761b5', class: 'required' }, "* "))), index.h("div", { key: 'c9ba61c15951f6689724025778fe8a933ab5b9bd', class: {
|
|
263
|
-
'cura-input-field': true,
|
|
264
|
-
'open': this.isOpen
|
|
265
|
-
} }, this.renderIcon(), index.h("input", { key: '0c1369e661fc6e34c8bf75f5ef4b977e749dc0b5', tabIndex: 0, type: "text", autocomplete: 'off', onFocus: () => (this.isFocused = true), onBlur: () => (this.isFocused = false), "aria-required": String(this.required), "aria-disabled": String(this.disabled), "aria-invalid": String(this.status === 'error'), onInput: this.handleInputChange, style: this.styles, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value }), index.h("cura-icon", { key: '95b5105660bcfc0c1562955449a1fc737048e8c2', name: this.isOpen ? 'up' : 'down', class: "up-down-icon", color: this.disabled ? 'neutral-dark' : 'primary-base', size: 16, iconset: 'default' })), index.h("cura-label", { key: 'b5565e686989fe0c1e62f6c01fef52b2829bf4f5', class: "helper-text", size: 'xsmall', color: this.getColor('text'), weight: this.mode === 'transparent' ? 'bold' : 'regular' }, index.h("slot", { key: '4a265609d8742b7e736920d54525cb2405785ea6' })), this.isOpen && (index.h("div", { key: '8f0609c7c2e709506ea4bdeeebdb1aae8abde1df', class: {
|
|
266
|
-
'menu': true,
|
|
267
|
-
'open': this.isOpen
|
|
268
|
-
} }, index.h("slot", { key: 'b6f84b885909ea1a9213cb3d590a02d736320228', name: 'option' }))))));
|
|
269
|
-
}
|
|
270
|
-
static get formAssociated() { return true; }
|
|
271
|
-
get host() { return index.getElement(this); }
|
|
272
|
-
};
|
|
273
|
-
CuraSelect.style = CuraSelectStyle0;
|
|
274
|
-
|
|
275
|
-
const curaSelectOptionCss = ":host{display:block}.item{display:flex;padding:12px 8px;cursor:pointer;justify-content:space-between;align-items:center;box-sizing:border-box;background:var(--neutral-purewhite)}.item.selected{background-color:var(--primary-lighter-50);border-bottom:1px solid var(--primary-light)}.item:hover:not(.selected){background:var(--neutral-white);box-shadow:0 2px 0 0 var(--neutral-light)}.item.active{background:var(--neutral-white) !important}.item.selected.active{background-color:var(--primary-lighter-50) !important;box-shadow:none}";
|
|
276
|
-
const CuraSelectOptionStyle0 = curaSelectOptionCss;
|
|
277
|
-
|
|
278
|
-
const CuraSelectOption = class {
|
|
279
|
-
constructor(hostRef) {
|
|
280
|
-
index.registerInstance(this, hostRef);
|
|
281
|
-
this.theme = window.CuraAPI.theme;
|
|
282
|
-
this.value = undefined;
|
|
283
|
-
this.selected = false;
|
|
284
|
-
this.active = false;
|
|
285
|
-
this.size = 'small';
|
|
286
|
-
this.styles = {};
|
|
287
|
-
}
|
|
288
|
-
connectedCallback() {
|
|
289
|
-
const colors = [
|
|
290
|
-
{ name: '--primary-lighter-50', theme: 'primary-lighter', opacity: 0.5 },
|
|
291
|
-
{ name: '--primary-light', theme: 'primary-light' },
|
|
292
|
-
{ name: '--neutral-light', theme: 'neutral-light' },
|
|
293
|
-
{ name: '--neutral-purewhite', theme: 'neutral-purewhite' },
|
|
294
|
-
];
|
|
295
|
-
colors.forEach(color => this.styles = Object.assign(Object.assign({}, this.styles), { [color.name]: this.theme.colors.getColor(color.theme, color === null || color === void 0 ? void 0 : color.opacity) }));
|
|
296
|
-
}
|
|
297
|
-
getSize(element) {
|
|
298
|
-
const sizeMap = {
|
|
299
|
-
large: element === 'label' ? 'medium' : 20,
|
|
300
|
-
medium: element === 'label' ? 'small' : 16,
|
|
301
|
-
small: element === 'label' ? 'xsmall' : 'micro',
|
|
302
|
-
};
|
|
303
|
-
return sizeMap[this.size] || sizeMap['medium'];
|
|
304
|
-
}
|
|
305
|
-
getClasses() {
|
|
306
|
-
return {
|
|
307
|
-
'item': true,
|
|
308
|
-
'selected': this.selected,
|
|
309
|
-
'active': this.active
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
render() {
|
|
313
|
-
return (index.h(index.Host, { key: '231c03411af0a5639358ff232e4a81287a8571f0', slot: "option" }, index.h("div", { key: 'b5baa8f7c4a4e863b96ffda1454a8c339d4b2656', class: this.getClasses(), style: this.styles }, index.h("cura-label", { key: '36d3381260263303242c443004f7e201c2683d4e', color: `${this.selected ? 'primary-base' : 'neutral-black'}`, size: this.getSize('label'), "margin-block": "0" }, index.h("slot", { key: 'cc72fed8c51592c8fd076d091272879c7572a181' })), this.selected && index.h("cura-icon", { key: 'e118108f84d49b3d6574a143f09b2c43d43d11a8', name: 'check', size: this.getSize('icon'), color: "primary-base" }))));
|
|
314
|
-
}
|
|
315
|
-
get host() { return index.getElement(this); }
|
|
316
|
-
static get watchers() { return {
|
|
317
|
-
"size": ["getSize"]
|
|
318
|
-
}; }
|
|
319
|
-
};
|
|
320
|
-
CuraSelectOption.style = CuraSelectOptionStyle0;
|
|
321
|
-
|
|
322
|
-
exports.cura_select = CuraSelect;
|
|
323
|
-
exports.cura_select_option = CuraSelectOption;
|
|
324
|
-
|
|
325
|
-
//# sourceMappingURL=cura-select_2.cjs.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"cura-select.cura-select-option.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,aAAa,GAAG,s+VAAs+V,CAAC;AAC7/V,yBAAe,aAAa;;MCOf,UAAU;;;;;;;;;;;;;;QAkGrB,WAAM,GAAG,EAAE,CAAC;;;;QAKZ,UAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;;;;;QA8G7B,oBAAe,GAAG,CAAC,SAA2B;YAC5C,SAAS,CAAC,OAAO,CAAC,QAAQ;gBACxB,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY,EAAE;oBAClC,IAAI,QAAQ,CAAC,aAAa,KAAK,UAAU;wBAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC;oBACvE,IAAI,QAAQ,CAAC,aAAa,KAAK,OAAO;wBAAE,IAAI,CAAC,aAAa,EAAE,CAAC;iBAC9D;aACF,CAAC,CAAC;SACJ,CAAC;;;;QAIF,mBAAc,GAAG,CAAC,KAAY;YAC5B,MAAM,cAAc,GAAG,KAAK,CAAC,MAAqB,CAAC;YACnD,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC/B,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;SACjD,CAAC;QAoCF,kBAAa,GAAG,CAAC,KAAoB;;YACnC,IAAI,CAAC,IAAI,CAAC,MAAM;gBAAE,OAAO;YACzB,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAA;YAErB,IAAI,GAAG,KAAK,WAAW,EAAE;gBACvB,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,IAAI,CAAC,iBAAiB,CAAC,CA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IAAI,EAAC,OAAO,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAC,cAAc,GAAa,CACnG,CACD,EACP;KACH;;;;;;;;;;;","names":["h","Host"],"sources":["src/components/forms/cura-select/cura-select.scss?tag=cura-select&encapsulation=shadow","src/components/forms/cura-select/cura-select.tsx","src/components/forms/cura-select-options/cura-select-option.scss?tag=cura-select-option&encapsulation=shadow","src/components/forms/cura-select-options/cura-select-option.tsx"],"sourcesContent":["@import \"../../../scss/mixins/forms.scss\";\n\n:host {\n display: block;\n position: relative;\n font-family: var(--font-family);\n}\n\n.wrapper {\n width: 100%;\n user-select: none;\n text-align: left !important;\n\n @include cura-label();\n @include helper-text();\n\n @include cura-input-field() {\n .up-down-icon {\n order: 3;\n padding-right: 12px;\n cursor: pointer;\n pointer-events: all;\n }\n\n input {\n padding: 0px 12px 0px 8px;\n }\n\n &.open {\n border-radius: 4px 4px 0 0 !important;\n }\n\n\n }\n\n @include cura-input-transparent();\n\n @include cura-forms-hover();\n @include cura-forms-focused();\n\n\n @include cura-forms-success();\n @include cura-forms-error();\n @include cura-forms-disabled();\n\n @include cura-forms-small() {\n &.label {.menu {top: 53px;} }\n .menu { top: 33px; }\n }\n\n @include cura-forms-medium() {\n &.label {.menu { top: 61px;} }\n .menu { top: 40px; }\n }\n\n @include cura-forms-large() {\n &.label {.menu { top: 69px } }\n .menu {top: 47px; }\n }\n}\n\n.required {\n color: red;\n}\n\n.menu {\n position: absolute;\n left: 0;\n right: -1px;\n background: #fff;\n border: 2px solid var(--neutral-light);\n border-radius: 4px;\n z-index: 1000;\n max-height: 285px;\n overflow: hidden;\n border-top: transparent;\n align-items: center;\n\n scrollbar-color: var(--neutral-medium) var(--neutral-black-20);\n overflow-y: scroll;\n box-shadow: 0px 4px 8px 0px rgba(38, 38, 38, 0.16);\n\n &.open {\n border-radius: 0 !important;\n }\n}\n\n","import { Component, Element, Host, Prop, State, h, Event, EventEmitter, AttachInternals } from '@stencil/core';\n\n@Component({\n tag: 'cura-select',\n styleUrl: 'cura-select.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class CuraSelect {\n /**\n * The label text for the select component.\n * Reflects as an attribute in the DOM.\n */\n @Prop({ reflect: true }) label: string = '';\n\n /**\n * Placeholder text for the input field.\n * Reflects as an attribute in the DOM.\n */\n @Prop({ reflect: true }) placeholder: string = '';\n\n /**\n * Current value of the select component.\n * Reflects as an attribute in the DOM and is mutable.\n */\n @Prop({ reflect: true, mutable: true }) value: string = '';\n\n /**\n * Display mode of the select component.\n * Can be 'default' or 'transparent'.\n */\n @Prop({ reflect: true }) mode: 'default' | 'transparent' = 'default';\n\n /**\n * Size of the select component.\n * Can be 'small', 'medium', or 'large'.\n */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Status of the select component.\n * Can be 'success', 'error', or 'default'.\n */\n @Prop({ reflect: true, mutable: true }) status: 'success' | 'error' | 'default' = 'default';\n\n /**\n * Whether the select component is disabled.\n * Reflects as an attribute in the DOM.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * Whether the select component is required.\n * Reflects as an attribute in the DOM.\n */\n @Prop({ reflect: true }) required: boolean = false;\n\n /**\n * Internal state: Whether the input is hovered.\n * Default: false\n */\n @State() isHovered: boolean = false;\n\n /**\n * Internal state: Whether the input is focused.\n * Default: false\n */\n @State() isFocused: boolean = false;\n\n /**\n * Internal state: Whether the dropdown menu is open.\n * Default: false\n */\n @State() isOpen: boolean = false;\n\n /**\n * Internal state: Collection of options for the select component.\n */\n @State() options: NodeListOf<HTMLElement>;\n\n\n @State() activeIndex: number = -1\n\n /**\n * Reference to the host element of the component.\n */\n @Element() host: HTMLElement;\n\n /**\n * Event emitted when an option is selected.\n */\n @Event() selected: EventEmitter;\n\n /**\n * Reference to the select component element.\n */\n selectRef: HTMLElement;\n\n /**\n * MutationObserver to watch changes in the component.\n */\n mutationObserver: MutationObserver;\n\n /**\n * Styles to be applied to the component.\n */\n styles = {};\n\n /**\n * Theme object containing font and color information.\n */\n theme = window.CuraAPI.theme;\n\n @AttachInternals() internals: ElementInternals;\n\n /**\n * Callback for form association.\n */\n formAssociatedCallback(form: { ariaLabel: string; }) {\n form.ariaLabel = this.label;\n }\n\n /**\n * Callback to restore the switch state from the form.\n */\n formStateRestoreCallback(state: { value: string }) {\n this.value = state.value;\n this.updateSelectedOption();\n }\n\n /**\n * Callback to reset the switch state when the form is reset.\n */\n formResetCallback() {\n this.value = '';\n this.clearSelectedAttributes()\n this.internals.setFormValue(this.value);\n this.internals.setValidity({});\n }\n\n /**\n * Callback to update the switch's disabled state when the form's disabled state changes.\n */\n formDisabledCallback(disabled: boolean) {\n this.disabled = disabled;\n }\n\n /**\n * Lifecycle method called before the component is rendered.\n * Initializes the options for the select component.\n */\n componentWillLoad() {\n this.initializeOptions();\n }\n /**\n * Lifecycle method called after the component is rendered.\n * Initializes select-related functionality.\n */\n componentDidLoad() {\n this.setupMutationObserver();\n }\n /**\n * Lifecycle method called when the component is connected to the DOM.\n * Applies styles based on the theme.\n */\n connectedCallback() {\n this.applyStyles();\n }\n /**\n * Lifecycle method called when the component is disconnected from the DOM.\n * Disconnects the MutationObserver if it exists.\n */\n disconnectedCallback() {\n this.mutationObserver?.disconnect();\n }\n\n initializeOptions() {\n this.options = this.host.querySelectorAll('cura-select-option');\n this.options.forEach(option => {\n option.setAttribute('size', this.size);\n option.setAttribute('selected', 'false');\n });\n }\n /**\n * Applies styles to the component based on the theme.\n */\n applyStyles() {\n const { fonts, colors } = this.theme;\n const fontWeights = fonts.getWeights();\n\n this.styles = {\n ...this.styles,\n '--font-weight-medium': fontWeights.medium,\n '--font-weight-bold': fontWeights.bold,\n '--font-weight-regular': fontWeights.regular,\n '--font-color': fonts.getColor(),\n '--font-family': fonts.getFamily(),\n '--font-size': fonts.getSize(),\n };\n\n const colorKeys = [\n 'primary-base', 'neutral-purewhite', 'neutral-white', 'neutral-black', 'neutral-medium', 'neutral-light',\n 'neutral-base', 'neutral-dark', 'success-dark', 'success-darker', 'success-lighter',\n 'error-lighter', 'error-dark', 'error-darker', 'error-base', 'info-base'\n ];\n\n colorKeys.forEach(key => {\n this.styles[`--${key}`] = colors.getColor(key);\n });\n }\n /**\n * Sets up a MutationObserver to watch for changes in the component.\n */\n setupMutationObserver() {\n this.mutationObserver = new MutationObserver(this.handleMutations);\n this.mutationObserver.observe(this.host, { attributes: true, subtree: true, attributeFilter: ['selected', 'value'] });\n }\n /**\n * Handles mutations observed by the MutationObserver.\n * Updates the selected option or filters options based on the mutation type.\n */\n handleMutations = (mutations: MutationRecord[]) => {\n mutations.forEach(mutation => {\n if (mutation.type === 'attributes') {\n if (mutation.attributeName === 'selected') this.updateSelectedOption();\n if (mutation.attributeName === 'value') this.filterOptions();\n }\n });\n };\n /**\n * Handles the selection of an option.\n */\n onOptiselected = (event: Event) => {\n const selectedOption = event.target as HTMLElement;\n this.clearSelectedAttributes();\n selectedOption.setAttribute('selected', 'true');\n };\n\n updateSelectedOption() {\n const selectedOption = this.host.querySelector('cura-select-option[selected]');\n\n if (selectedOption) {\n const selectedValue = selectedOption.textContent;\n if (this.value !== selectedValue) {\n this.value = selectedValue ;\n this.isOpen = false;\n this.internals.setFormValue(this.value);\n this.selected.emit({ value: this.value, selected: true });\n }\n }\n }\n\n /**\n * Clears the 'selected' attribute from all options.\n */\n clearSelectedAttributes() {\n this.options.forEach(option => option.removeAttribute('selected'));\n }\n\n /**\n * Filters the options based on the current input value.\n */\n filterOptions() {\n const inputValue = this.value.toLowerCase();\n\n this.options.forEach(option => {\n const optionValue = option.textContent?.toLowerCase() || '';\n const isVisible = this.isOpen ? optionValue.includes(inputValue) : true;\n option.style.display = isVisible ? 'block' : 'none';\n });\n }\n\n handleKeyDown = (event: KeyboardEvent) => {\n if (!this.isOpen) return;\n const { key } = event\n\n if (key === 'ArrowDown') {\n event.preventDefault();\n this.updateActiveIndex(1);\n }\n\n if (key === 'ArrowUp') {\n event.preventDefault();\n this.updateActiveIndex(-1);\n }\n\n if (key === 'Enter') {\n this.options[this.activeIndex]?.click();\n }\n }\n\n updateActiveIndex(direction: number) {\n if (this.options.length === 0) return;\n this.activeIndex = (this.activeIndex + direction + this.options.length) % this.options.length;\n this.updateOptionHighlights()\n }\n\n updateOptionHighlights() {\n this.options.forEach((option, index) => (option as any).active = index === this.activeIndex);\n }\n\n\n handleInputChange = (e: Event) => {\n this.value = (e.target as HTMLInputElement).value;\n this.isOpen = !!this.value.length;\n this.internals.setFormValue(this.value);\n };\n\n\n getClasses() {\n return {\n wrapper: true,\n label: !!this.label,\n disabled: this.disabled,\n transparent: this.mode === 'transparent',\n [this.size.toLowerCase()]: true,\n [this.status.toLowerCase()]: true,\n };\n }\n\n /**\n * Determines the color based on the item type and component state.\n */\n getColor(item: 'label' | 'text' | 'icon') {\n if (this.disabled) return 'neutral-medium';\n\n const isStatusDefault = this.status === 'default';\n const isHoveredOrFocused = this.isFocused || this.isHovered;\n\n if (item === 'label') {\n if (!isStatusDefault || isHoveredOrFocused) return 'neutral-black';\n return 'neutral-dark';\n }\n\n if (isHoveredOrFocused && isStatusDefault) return 'neutral-black';\n if (this.status === 'success') return 'success-dark';\n if (this.status === 'error') return 'error-dark';\n\n return 'neutral-dark';\n }\n\n /**\n * Renders the icon based on the component's status.\n */\n renderIcon() {\n if (this.status === 'default') return null;\n const icon = { success: 'checkCircle', error: 'alertCircle' }[this.status];\n return (\n <cura-icon\n class='feedback-icon'\n name={icon}\n iconset='default'\n size={this.size === 'large' ? 20 : 16}\n color={this.getColor('icon')}\n style={this.styles}\n />\n );\n }\n\n handleClick = (event: MouseEvent) => {\n if (this.disabled) return event.preventDefault();\n const target = event.target as HTMLElement;\n\n if (target.tagName === 'CURA-SELECT-OPTION') return this.onOptiselected(event);\n this.isOpen = !this.isOpen;\n };\n\n\n render() {\n return (\n <Host style={this.styles}>\n <div\n class={this.getClasses()}\n tabIndex={0}\n ref={(el) => (this.selectRef = el as HTMLElement)}\n onMouseEnter={() => (this.isHovered = true)}\n onMouseLeave={() => (this.isHovered = false)}\n onKeyDown={this.handleKeyDown}\n onClick={this.handleClick}\n >\n {this.label && (\n <cura-label\n class='label'\n weight='bold'\n size={this.size === 'large' ? 'small' : 'xsmall'}\n color={this.getColor('label')}\n >\n {this.label} {this.required && <span class='required'>* </span>}\n </cura-label>\n )}\n\n <div class={{\n 'cura-input-field': true,\n 'open': this.isOpen\n }}>\n {this.renderIcon()}\n <input\n tabIndex={0}\n type=\"text\"\n autocomplete='off'\n onFocus={() => (this.isFocused = true)}\n onBlur={() => (this.isFocused = false)}\n aria-required={String(this.required)}\n aria-disabled={String(this.disabled)}\n aria-invalid={String(this.status === 'error')}\n onInput={this.handleInputChange}\n style={this.styles}\n placeholder={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n value={this.value}\n />\n <cura-icon\n name={this.isOpen ? 'up' : 'down'}\n class=\"up-down-icon\"\n color={this.disabled ? 'neutral-dark' : 'primary-base'}\n size={16}\n iconset='default'\n />\n </div>\n <cura-label\n class=\"helper-text\"\n size='xsmall'\n color={this.getColor('text')}\n weight={this.mode === 'transparent' ? 'bold' : 'regular'} >\n <slot></slot>\n </cura-label>\n {this.isOpen && (\n <div class={{\n 'menu': true,\n 'open': this.isOpen\n }}>\n <slot name='option'></slot>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n",":host {\n display: block;\n}\n\n.item {\n display: flex;\n padding: 12px 8px;\n cursor: pointer;\n justify-content: space-between;\n align-items: center;\n box-sizing: border-box;\n background: var(--neutral-purewhite);\n\n &.selected {\n background-color: var(--primary-lighter-50);\n border-bottom: 1px solid var(--primary-light);\n }\n\n &:hover:not(.selected) {\n background: var(--neutral-white);\n box-shadow: 0 2px 0 0 var(--neutral-light);\n }\n\n &.active {\n background: var(--neutral-white) !important;\n }\n\n &.selected.active {\n background-color: var(--primary-lighter-50) !important;\n box-shadow: none;\n }\n}\n","import { Component, h, Host, Prop, State, Element, Watch } from '@stencil/core';\n\n@Component({\n tag: 'cura-select-option',\n styleUrl: 'cura-select-option.scss',\n shadow: true,\n})\nexport class CuraSelectOption {\n @Prop({ reflect: true }) value: string;\n @Prop({ reflect: true }) selected: boolean = false;\n @Prop({ reflect: true }) active: boolean = false;\n @Prop() size: 'xsmall' | 'small' | 'medium' | 'large' = 'small'\n @State() styles = {};\n @Element() host: HTMLElement;\n\n theme = window.CuraAPI.theme;\n\n connectedCallback() {\n const colors = [\n { name: '--primary-lighter-50', theme: 'primary-lighter', opacity: 0.5 },\n { name: '--primary-light', theme: 'primary-light' },\n { name: '--neutral-light', theme: 'neutral-light' },\n { name: '--neutral-purewhite', theme: 'neutral-purewhite' },\n ];\n\n colors.forEach(color => this.styles = { ...this.styles, [color.name]: this.theme.colors.getColor(color.theme, color?.opacity) });\n }\n\n @Watch('size')\n getSize(element: string) {\n const sizeMap = {\n large: element === 'label' ? 'medium' : 20,\n medium: element === 'label' ? 'small' : 16,\n small: element === 'label' ? 'xsmall' : 'micro',\n };\n\n return sizeMap[this.size] || sizeMap['medium'];\n }\n\n getClasses() {\n return {\n 'item': true,\n 'selected': this.selected,\n 'active':this.active\n };\n }\n\n render() {\n return (\n <Host slot=\"option\">\n <div class={this.getClasses()} style={this.styles}>\n <cura-label color={`${this.selected ? 'primary-base' : 'neutral-black'}`} size={this.getSize('label')} margin-block=\"0\">\n <slot></slot>\n </cura-label>\n {this.selected && <cura-icon name='check' size={this.getSize('icon')} color=\"primary-base\"></cura-icon>}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as e,H as o,g as s}from"./p-312791fb.js";const r=":host{display:block;width:100%;box-sizing:border-box}.dropdown{display:flex;position:relative;flex-direction:column;width:inherit}.dropdown-input-search{width:100%;display:flex;justify-content:center;align-items:center;background:transparent}.dropdown-input-search.dropdown-open ::part(cura-input-field){border-radius:4px 4px 0px 0px}.dropdown-input-search.dropdown-open ::slotted([slot=helperText]){display:none}.dropdown-input-search.dropdown-open cura-input-text ::slotted([slot=helperText]){display:none}.dropdown-search-list{position:absolute;top:calc(100% - 8px);width:100%;max-height:var(--dropdown-max-height);padding:12px 12px;margin:0;box-sizing:border-box;box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16));border-radius:0px 0px 4px 4px;border-top:0 var(--neutral-light);border-right:2px solid var(--neutral-light);border-bottom:2px solid var(--neutral-light);border-left:2px solid var(--neutral-light);background-color:var(--neutral-purewhite);list-style:none;overflow-y:auto;display:none}.dropdown-search-list.visible{display:block}.dropdown-search-list-input-search{width:inherit;display:flex;justify-content:center;align-items:center;padding:16px 8px;border-bottom:2px solid var(--info-base);background-color:var(--neutral-purewhite)}.dropdown-search-list-input-search cura-input-text{width:inherit}.dropdown-search-list-input-search.error{background-color:var(--error-lighter);border-bottom:2px solid var(--error-dark)}.dropdown-mobile{position:fixed;top:0;left:0;right:0;width:100%;z-index:10000}.dropdown-mobile .dropdown-input-search{display:flex;gap:4px;padding:12px 8px;background-color:var(--neutral-purewhite);border-bottom:2px solid var(--info-base);z-index:10000}.dropdown-mobile .dropdown-input-search cura-button-transparent{display:flex}.dropdown-mobile .dropdown-input-search.error{background-color:var(--error-lighter);border-bottom:2px solid var(--error-dark)}.dropdown-mobile .dropdown-input-search.dropdown-open{display:flex}.dropdown-mobile .dropdown-input-search.dropdown-open ::slotted([slot=helperText]){display:block}.dropdown-mobile .dropdown-search-list{position:static;width:100%;height:100%;max-height:none;padding:12px 12px;margin:0;box-sizing:border-box;box-shadow:none;border:none;background-color:var(--neutral-purewhite);list-style:none;overflow-y:auto;z-index:10000}";const d=r;const n=class{constructor(e){t(this,e);this.valueChanged=i(this,"valueChanged",7);this.onselect=i(this,"onselect",7);this.overlayElement=null;this.handleSlotChange=()=>{this.options=Array.from(this.host.querySelectorAll("cura-dropdown-search-option"));this.addClickListenersToOptions();this.updateHoveredIndex()};this.handleInputChange=t=>{const i=t.target;this.value=i.value;this.onValueChange(this.value)};this.handleKeyDown=t=>{if(t.key==="ArrowDown"){t.preventDefault();this.moveHighlight(1)}else if(t.key==="ArrowUp"){t.preventDefault();this.moveHighlight(-1)}else if(t.key==="Enter"){t.preventDefault();if(this.hoveredIndex>-1){this.handleOnBlur();this.onSelectedOption(this.hoveredIndex)}}};this.handleResize=()=>{this.isMobile=window.innerWidth<768;if(this.isDropdownOpen){if(this.isMobile){this.showOverlay()}else{this.removeOverlay()}}};this.status="default";this.name=undefined;this.required=false;this.selected=false;this.value="";this.placeholder="";this.label="";this.iconName="search";this.dropdownMaxHeight="630px";this.overlayVisible=false;this.isDropdownOpen=false;this.styles={};this.isMobile=window.innerWidth<768;this.mode="default";this.inputTextRef=undefined;this.isOnBlurInput=true;this.hoveredIndex=-1;this.options=[]}connectedCallback(){this.weights=window.CuraAPI.theme.fonts.getWeights();this.styles["--info-base"]=window.CuraAPI.theme.colors.getColor("info-base");this.styles["--neutral-purewhite"]=window.CuraAPI.theme.colors.getColor("neutral-purewhite");this.styles["--neutral-light"]=window.CuraAPI.theme.colors.getColor("neutral-light");this.styles["--neutral-dark"]=window.CuraAPI.theme.colors.getColor("neutral-dark");this.styles["--neutral-black-shadow"]=window.CuraAPI.theme.colors.getColor(`neutral-black`,.16);this.styles["--error-dark"]=window.CuraAPI.theme.colors.getColor("error-dark");this.styles["--error-lighter"]=window.CuraAPI.theme.colors.getColor("error-lighter");this.styles["--breakpoints"]=window.CuraAPI.theme.breakpoints.get();this.styles["--font-size"]=window.CuraAPI.theme.fonts.getSize();this.styles["--font-family"]=window.CuraAPI.theme.fonts.getFamily();this.styles["--font-weight-medium"]=this.weights.medium}onValueChange(t){this.updateSelectedOption(t);this.valueChanged.emit(t)}componentWillLoad(){this.updateSelectedOption(this.value)}componentDidRender(){if(this.isDropdownOpen&&this.isMobile){this.showOverlay()}else{this.removeOverlay()}}componentDidLoad(){window.addEventListener("resize",this.handleResize)}disconnectedCallback(){window.removeEventListener("resize",this.handleResize)}showOverlay(){if(!this.overlayElement){this.overlayElement=document.createElement("div");this.overlayElement.className="dropdown-overlay";this.overlayElement.style.position="fixed";this.overlayElement.style.top="0";this.overlayElement.style.left="0";this.overlayElement.style.width="100%";this.overlayElement.style.height="100%";this.overlayElement.style.zIndex="9999";this.overlayElement.style.backgroundColor="white";document.body.appendChild(this.overlayElement)}}removeOverlay(){if(this.overlayElement&&this.overlayElement.parentNode===document.body){document.body.removeChild(this.overlayElement);this.overlayElement=null}}addClickListenersToOptions(){this.options.forEach(((t,i)=>{t.addEventListener("click",(()=>this.onSelectedOption(i)))}))}updateSelectedOption(t){const i=this.options.findIndex((i=>i.getAttribute("value")===t));this.hoveredIndex=i;this.updateOptionAttribute("hovered",this.hoveredIndex);this.updateOptionAttribute("selected",this.hoveredIndex);this.scrollIntoView()}onSelectedOption(t){const i=this.options[t];if(i.selectable){const t=i.getAttribute("value")||i.textContent;this.value=t||"";this.updateSelectedOption(this.value);this.isDropdownOpen=false;this.isOnBlurInput=true;this.removeOverlay()}}moveHighlight(t){const i=this.options;const e=(this.hoveredIndex+t+i.length)%i.length;this.hoveredIndex=e;this.updateOptionAttribute("hovered",this.hoveredIndex);this.scrollIntoView()}updateOptionAttribute(t,i){this.options.forEach(((e,o)=>{e[t]=o===i}))}updateHoveredIndex(){const t=this.options;const i=this.value;this.hoveredIndex=t.findIndex((t=>t.getAttribute("value")===i))}scrollIntoView(){var t;const i=(t=this.host.shadowRoot)===null||t===void 0?void 0:t.querySelector(".dropdown-search-list");const e=this.options[this.hoveredIndex];if(i&&e){const t=e.getBoundingClientRect();const o=i.getBoundingClientRect();if(t.bottom>o.bottom){i.scrollTop+=t.bottom-o.bottom}if(t.top<o.top){i.scrollTop-=o.top-t.top}}}handleOnBlur(){if(this.isOnBlurInput===true){setTimeout((()=>{this.isDropdownOpen=false;this.removeOverlay()}),200)}}getClasses(){return{"dropdown-input-search":true,"dropdown-open":this.isDropdownOpen,[this.status]:true}}getDropdownClasses(){return{"dropdown-search-list":true,visible:this.options.length&&this.isDropdownOpen?true:false}}hostCSSProperties(){return{"--dropdown-max-height":this.dropdownMaxHeight}}render(){const t=this.isMobile&&this.isDropdownOpen;return e(o,{key:"cd5ac8a26a4b24d0d934f8f2123829ea4528ed35",style:this.hostCSSProperties(),class:"dropdown-overlay"},e("div",{key:"484ec486d6acf9b783897a8b4999a3c3cf934315",class:`dropdown ${t?"dropdown-mobile":""}`,style:this.styles},e("div",{key:"c55468c7c5121524c8dd7548e9883d6e83edde0b",class:this.getClasses()},this.isMobile&&this.isDropdownOpen&&e("cura-button-transparent",{key:"4f132fcd11d1d2fc32786c57fe742813725e8d60",fontColor:"dark",onClick:()=>this.isMobile=false,iconName:"arrowLeft",size:"medium",iconOnly:true,color:"primary"}),e("cura-input-text",{key:"490781c1c112752698dc9f8a830ffe6fe117fa0c",label:this.label,part:"cura-input-field",mode:t?"transparent":"default",required:this.required,hideErrorIcon:this.status==="error",iconName:this.iconName||"search",value:this.value,status:this.status,onValueChange:t=>this.onValueChange(t.target.value),onInput:t=>this.handleInputChange(t),onFocus:()=>this.isDropdownOpen=true,onClick:()=>window.innerWidth<768?this.isMobile=true:null,onBlur:()=>{this.handleOnBlur()},placeholder:this.placeholder,size:"large",onKeyDown:this.handleKeyDown},e("slot",{key:"96afbcfbe7001df78068971daddfcd63e847522d",name:"helperText"}))),e("div",{key:"9289a631932a6eb61de8fa64ecfac169fc4bda77",id:"dropdown-search-list",class:this.getDropdownClasses()},e("slot",{key:"e07a80200dcdf181d1112a6074702aba449d2c16",name:"dropdown-search-option",onSlotchange:this.handleSlotChange}))))}get host(){return s(this)}static get watchers(){return{value:["onValueChange"]}}};n.style=d;export{n as cura_dropdown_search};
|
|
2
|
-
//# sourceMappingURL=p-11e828b5.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["curaDropdownSearchCss","CuraDropdownSearchStyle0","CuraDropdownSearch","this","overlayElement","handleSlotChange","options","Array","from","host","querySelectorAll","addClickListenersToOptions","updateHoveredIndex","handleInputChange","event","input","target","value","onValueChange","handleKeyDown","key","preventDefault","moveHighlight","hoveredIndex","handleOnBlur","onSelectedOption","handleResize","isMobile","window","innerWidth","isDropdownOpen","showOverlay","removeOverlay","connectedCallback","weights","CuraAPI","theme","fonts","getWeights","styles","colors","getColor","breakpoints","get","getSize","getFamily","medium","newValue","updateSelectedOption","valueChanged","emit","componentWillLoad","componentDidRender","componentDidLoad","addEventListener","disconnectedCallback","removeEventListener","document","createElement","className","style","position","top","left","width","height","zIndex","backgroundColor","body","appendChild","parentNode","removeChild","forEach","option","index","selectedOptionIndex","findIndex","getAttribute","updateOptionAttribute","scrollIntoView","selectedOption","selectable","selectedValue","textContent","isOnBlurInput","direction","visibleOptions","newIndex","length","attribute","indexToUpdate","currentValue","container","_a","shadowRoot","querySelector","hoveredOption","optionRect","getBoundingClientRect","containerRect","bottom","scrollTop","setTimeout","getClasses","status","getDropdownClasses","visible","hostCSSProperties","dropdownMaxHeight","render","isMobileDropdown","h","Host","class","fontColor","onClick","iconName","size","iconOnly","color","label","part","mode","required","hideErrorIcon","e","onInput","onFocus","onBlur","placeholder","onKeyDown","name","id","onSlotchange"],"sources":["src/components/forms/cura-dropdown-search/cura-dropdown-search.scss?tag=cura-dropdown-search&encapsulation=shadow","src/components/forms/cura-dropdown-search/cura-dropdown-search.tsx"],"sourcesContent":["@import '../../../scss/mixins/shadows.scss';\n\n:host {\n display: block;\n width: 100%;\n box-sizing: border-box;\n}\n\n.dropdown {\n display: flex;\n position: relative;\n\n flex-direction: column;\n width: inherit;\n\n &-input-search {\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n background: transparent;\n\n\n &.dropdown-open {\n ::part(cura-input-field) {\n border-radius: 4px 4px 0px 0px;\n }\n ::slotted([slot='helperText']) {\n display: none;\n }\n\n cura-input-text {\n ::slotted([slot='helperText']) {\n display: none;\n }\n }\n }\n }\n\n &-search-list {\n position: absolute;\n top: calc(100% - 8px);\n width: 100%;\n max-height: var(--dropdown-max-height);\n padding: 12px 12px;\n margin: 0;\n box-sizing: border-box;\n @include shadow-level3(--neutral-black-shadow);\n border-radius: 0px 0px 4px 4px;\n border-top: 0 var(--neutral-light);\n border-right: 2px solid var(--neutral-light);\n border-bottom: 2px solid var(--neutral-light);\n border-left: 2px solid var(--neutral-light);\n background-color: var(--neutral-purewhite);\n list-style: none;\n overflow-y: auto;\n display: none;\n\n &.visible {\n display: block;\n }\n\n &-input-search {\n width: inherit;\n\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 16px 8px;\n border-bottom: 2px solid var(--info-base);\n background-color: var(--neutral-purewhite);\n\n cura-input-text {\n width: inherit;\n }\n\n &.error {\n background-color: var(--error-lighter);\n border-bottom: 2px solid var(--error-dark);\n }\n }\n }\n\n &-mobile {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n width: 100%;\n\n z-index: 10000;\n .dropdown-input-search {\n display: flex;\n gap: 4px;\n padding: 12px 8px;\n background-color: var(--neutral-purewhite);\n border-bottom: 2px solid var(--info-base);\n z-index: 10000;\n cura-button-transparent {\n display: flex;\n }\n &.error {\n background-color: var(--error-lighter);\n border-bottom: 2px solid var(--error-dark);\n }\n &.dropdown-open {\n display: flex;\n\n ::slotted([slot='helperText']) {\n display: block;\n }\n }\n }\n .dropdown-search-list {\n position: static;\n width: 100%;\n height: 100%;\n max-height: none;\n padding: 12px 12px;\n margin: 0;\n box-sizing: border-box;\n box-shadow: none;\n border: none;\n background-color: var(--neutral-purewhite);\n list-style: none;\n overflow-y: auto;\n z-index: 10000;\n }\n }\n}\n","import { Component, Host, Prop, State, Event, EventEmitter, Element, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-dropdown-search',\n styleUrl: 'cura-dropdown-search.scss',\n shadow: true,\n})\nexport class CuraDropdownSearch {\n /**\n * Define the status of the dropdown search.\n */\n @Prop({ reflect: true }) status: 'error' | 'default' = 'default';\n\n /**\n * The name of the dropdown search component.\n */\n @Prop({ reflect: true }) name: string;\n\n /**\n * Indicates if the dropdown search is required.\n */\n @Prop({ reflect: true, mutable: true }) required: boolean = false;\n\n /**\n * Indicates if the dropdown search is selected.\n */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false;\n\n /**\n * The value of the dropdown search.\n */\n @Prop({ reflect: true, mutable: true }) value: string = '';\n\n /**\n * The placeholder text for the dropdown search.\n */\n @Prop({ reflect: true, mutable: true }) placeholder: string = '';\n\n /**\n * The label for the dropdown search.\n */\n @Prop({ reflect: true, mutable: true }) label: string = '';\n\n /**\n * Custom icon name. Default: search.\n */\n @Prop({reflect: true}) iconName = 'search';\n\n /**\n * CSS max-height property for dropdown item.\n * Default to 630px\n */\n @Prop({reflect: true}) dropdownMaxHeight = '630px';\n\n /**\n * Reference to the host element.\n */\n @Element() host: HTMLElement;\n\n /**\n * Indicates if the overlay is visible.\n */\n @State() overlayVisible: boolean = false;\n\n /**\n * Event emitted when the value changes.\n */\n @Event() valueChanged: EventEmitter<string>;\n\n /**\n * Indicates if the dropdown is open.\n */\n @State() isDropdownOpen: boolean = false;\n\n /**\n * Styles for the component.\n\n */\n @State() styles = {};\n\n /**\n * Indicates if the component is being viewed on a mobile device.\n */\n @State() isMobile: boolean = window.innerWidth < 768;\n\n /**\n * The mode of the dropdown search.\n */\n @State() mode: 'default' | 'transparent' = 'default';\n\n @Event() onselect: EventEmitter;\n\n @State() inputTextRef!: HTMLCuraInputTextElement;\n\n /**\n * Indicates if the input is on blur.\n */\n @State() isOnBlurInput: boolean = true;\n\n /**\n * The index of the currently hovered option.\n */\n @State() hoveredIndex: number = -1;\n\n /**\n * The options for the dropdown search.\n * @type {HTMLCuraDropdownSearchOptionElement[]}\n */\n\n weights;\n\n private overlayElement: HTMLDivElement | null = null;\n\n @State() options: HTMLCuraDropdownSearchOptionElement[] = [];\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--info-base'] = window.CuraAPI.theme.colors.getColor('info-base');\n this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor('neutral-purewhite');\n this.styles['--neutral-light'] = window.CuraAPI.theme.colors.getColor('neutral-light');\n this.styles['--neutral-dark'] = window.CuraAPI.theme.colors.getColor('neutral-dark');\n this.styles['--neutral-black-shadow'] = window.CuraAPI.theme.colors.getColor(`neutral-black`, 0.16);\n this.styles['--error-dark'] = window.CuraAPI.theme.colors.getColor('error-dark');\n this.styles['--error-lighter'] = window.CuraAPI.theme.colors.getColor('error-lighter');\n this.styles['--breakpoints'] = window.CuraAPI.theme.breakpoints.get();\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-medium'] = this.weights.medium;\n }\n\n @Watch('value')\n onValueChange(newValue: string) {\n this.updateSelectedOption(newValue);\n this.valueChanged.emit(newValue);\n }\n\n componentWillLoad() {\n this.updateSelectedOption(this.value);\n }\n\n componentDidRender() {\n if (this.isDropdownOpen && this.isMobile) {\n this.showOverlay();\n } else {\n this.removeOverlay();\n }\n }\n componentDidLoad() {\n window.addEventListener('resize', this.handleResize);\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize);\n }\n\n private showOverlay() {\n if (!this.overlayElement) {\n this.overlayElement = document.createElement('div');\n this.overlayElement.className = 'dropdown-overlay';\n this.overlayElement.style.position = 'fixed';\n this.overlayElement.style.top = '0';\n this.overlayElement.style.left = '0';\n this.overlayElement.style.width = '100%';\n this.overlayElement.style.height = '100%';\n this.overlayElement.style.zIndex = '9999';\n this.overlayElement.style.backgroundColor = 'white';\n document.body.appendChild(this.overlayElement);\n }\n }\n\n private removeOverlay() {\n if (this.overlayElement && this.overlayElement.parentNode === document.body) {\n document.body.removeChild(this.overlayElement);\n this.overlayElement = null;\n }\n }\n\n private handleSlotChange = () => {\n this.options = Array.from(this.host.querySelectorAll('cura-dropdown-search-option'));\n this.addClickListenersToOptions();\n this.updateHoveredIndex();\n };\n\n private addClickListenersToOptions() {\n this.options.forEach((option, index) => {\n option.addEventListener('click', () => this.onSelectedOption(index));\n });\n }\n\n private updateSelectedOption(value: string) {\n const selectedOptionIndex = this.options.findIndex(option => option.getAttribute('value') === value);\n this.hoveredIndex = selectedOptionIndex;\n this.updateOptionAttribute('hovered', this.hoveredIndex);\n this.updateOptionAttribute('selected', this.hoveredIndex);\n\n this.scrollIntoView();\n }\n\n private handleInputChange = (event: Event) => {\n const input = event.target as HTMLInputElement;\n this.value = input.value;\n this.onValueChange(this.value);\n // this.valueChanged.emit(this.value);\n };\n\n private onSelectedOption(index: number) {\n const selectedOption = this.options[index];\n if(selectedOption.selectable) {\n const selectedValue = selectedOption.getAttribute('value') || selectedOption.textContent;\n\n this.value = selectedValue || '';\n this.updateSelectedOption(this.value);\n\n this.isDropdownOpen = false;\n this.isOnBlurInput = true;\n this.removeOverlay();\n }\n }\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.moveHighlight(1);\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.moveHighlight(-1);\n } else if (event.key === 'Enter') {\n event.preventDefault();\n if (this.hoveredIndex > -1) {\n this.handleOnBlur();\n this.onSelectedOption(this.hoveredIndex);\n }\n }\n };\n\n private moveHighlight(direction: number) {\n const visibleOptions = this.options;\n const newIndex = (this.hoveredIndex + direction + visibleOptions.length) % visibleOptions.length;\n this.hoveredIndex = newIndex;\n this.updateOptionAttribute('hovered', this.hoveredIndex);\n this.scrollIntoView();\n }\n\n private updateOptionAttribute(attribute: string, indexToUpdate: number) {\n this.options.forEach((option, index) => {\n (option as any)[attribute] = index === indexToUpdate;\n });\n }\n\n private updateHoveredIndex() {\n const visibleOptions = this.options;\n const currentValue = this.value;\n this.hoveredIndex = visibleOptions.findIndex(option => option.getAttribute('value') === currentValue);\n }\n\n private scrollIntoView() {\n const container = this.host.shadowRoot?.querySelector('.dropdown-search-list');\n const hoveredOption = this.options[this.hoveredIndex];\n\n if (container && hoveredOption) {\n const optionRect = hoveredOption.getBoundingClientRect();\n const containerRect = container.getBoundingClientRect();\n\n if (optionRect.bottom > containerRect.bottom) {\n container.scrollTop += optionRect.bottom - containerRect.bottom;\n }\n\n if (optionRect.top < containerRect.top) {\n container.scrollTop -= containerRect.top - optionRect.top;\n }\n }\n }\n\n private handleResize = () => {\n this.isMobile = window.innerWidth < 768;\n if (this.isDropdownOpen) {\n if (this.isMobile) {\n this.showOverlay();\n } else {\n this.removeOverlay();\n }\n }\n };\n\n handleOnBlur() {\n if (this.isOnBlurInput === true) {\n setTimeout(() => {\n this.isDropdownOpen = false;\n this.removeOverlay();\n }, 200);\n }\n }\n getClasses() {\n return {\n 'dropdown-input-search': true,\n 'dropdown-open': this.isDropdownOpen,\n [this.status]: true,\n };\n }\n\n getDropdownClasses() {\n return {\n 'dropdown-search-list': true,\n 'visible': this.options.length && this.isDropdownOpen ? true : false\n };\n }\n\n hostCSSProperties() {\n return {\n '--dropdown-max-height': this.dropdownMaxHeight,\n };\n }\n\n render() {\n const isMobileDropdown = this.isMobile && this.isDropdownOpen;\n return (\n <Host style={this.hostCSSProperties()} class=\"dropdown-overlay\">\n <div class={`dropdown ${isMobileDropdown ? 'dropdown-mobile' : ''}`} style={this.styles}>\n <div class={this.getClasses()}>\n {this.isMobile && this.isDropdownOpen && (\n <cura-button-transparent\n fontColor=\"dark\"\n onClick={() => (this.isMobile = false)}\n iconName=\"arrowLeft\"\n size=\"medium\"\n iconOnly\n color=\"primary\"\n ></cura-button-transparent>\n )}\n <cura-input-text\n label={this.label}\n part=\"cura-input-field\"\n mode={isMobileDropdown ? 'transparent' : 'default'}\n required={this.required}\n hideErrorIcon={this.status === 'error'}\n iconName={this.iconName || 'search'}\n value={this.value}\n status={this.status}\n onValueChange={e => this.onValueChange(e.target.value as string)}\n onInput={e => this.handleInputChange(e)}\n onFocus={() => (this.isDropdownOpen = true)}\n onClick={() => (window.innerWidth < 768 ? (this.isMobile = true) : null)}\n onBlur={() => {\n this.handleOnBlur();\n }}\n placeholder={this.placeholder}\n size=\"large\"\n onKeyDown={this.handleKeyDown}\n >\n <slot name=\"helperText\"></slot>\n </cura-input-text>\n </div>\n <div id=\"dropdown-search-list\" class={this.getDropdownClasses()}>\n <slot name=\"dropdown-search-option\" onSlotchange={this.handleSlotChange}></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"gEAAA,MAAMA,EAAwB,yyEAC9B,MAAAC,EAAeD,E,MCMFE,EAAkB,M,uGAwGrBC,KAAAC,eAAwC,KAkExCD,KAAAE,iBAAmB,KACzBF,KAAKG,QAAUC,MAAMC,KAAKL,KAAKM,KAAKC,iBAAiB,gCACrDP,KAAKQ,6BACLR,KAAKS,oBAAoB,EAkBnBT,KAAAU,kBAAqBC,IAC3B,MAAMC,EAAQD,EAAME,OACpBb,KAAKc,MAAQF,EAAME,MACnBd,KAAKe,cAAcf,KAAKc,MAAM,EAkBxBd,KAAAgB,cAAiBL,IACvB,GAAIA,EAAMM,MAAQ,YAAa,CAC7BN,EAAMO,iBACNlB,KAAKmB,cAAc,E,MACd,GAAIR,EAAMM,MAAQ,UAAW,CAClCN,EAAMO,iBACNlB,KAAKmB,eAAe,E,MACf,GAAIR,EAAMM,MAAQ,QAAS,CAChCN,EAAMO,iBACN,GAAIlB,KAAKoB,cAAgB,EAAG,CAC1BpB,KAAKqB,eACLrB,KAAKsB,iBAAiBtB,KAAKoB,a,IA2CzBpB,KAAAuB,aAAe,KACrBvB,KAAKwB,SAAWC,OAAOC,WAAa,IACpC,GAAI1B,KAAK2B,eAAgB,CACvB,GAAI3B,KAAKwB,SAAU,CACjBxB,KAAK4B,a,KACA,CACL5B,KAAK6B,e,gBA5Q4C,U,kCAUK,M,cAKA,M,WAKJ,G,iBAKM,G,WAKN,G,cAKtB,S,uBAMS,Q,oBAUR,M,oBAUA,M,YAMjB,G,cAKWJ,OAAOC,WAAa,I,UAKN,U,+CAST,K,mBAKD,E,aAWyB,E,CAE1D,iBAAAI,GACE9B,KAAK+B,QAAUN,OAAOO,QAA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