@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,320 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-1ad98520.js';
|
|
2
|
-
|
|
3
|
-
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}";
|
|
4
|
-
const CuraSelectStyle0 = curaSelectCss;
|
|
5
|
-
|
|
6
|
-
const CuraSelect = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.selected = createEvent(this, "selected", 7);
|
|
10
|
-
if (hostRef.$hostElement$["s-ei"]) {
|
|
11
|
-
this.internals = hostRef.$hostElement$["s-ei"];
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
this.internals = hostRef.$hostElement$.attachInternals();
|
|
15
|
-
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Styles to be applied to the component.
|
|
19
|
-
*/
|
|
20
|
-
this.styles = {};
|
|
21
|
-
/**
|
|
22
|
-
* Theme object containing font and color information.
|
|
23
|
-
*/
|
|
24
|
-
this.theme = window.CuraAPI.theme;
|
|
25
|
-
/**
|
|
26
|
-
* Handles mutations observed by the MutationObserver.
|
|
27
|
-
* Updates the selected option or filters options based on the mutation type.
|
|
28
|
-
*/
|
|
29
|
-
this.handleMutations = (mutations) => {
|
|
30
|
-
mutations.forEach(mutation => {
|
|
31
|
-
if (mutation.type === 'attributes') {
|
|
32
|
-
if (mutation.attributeName === 'selected')
|
|
33
|
-
this.updateSelectedOption();
|
|
34
|
-
if (mutation.attributeName === 'value')
|
|
35
|
-
this.filterOptions();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Handles the selection of an option.
|
|
41
|
-
*/
|
|
42
|
-
this.onOptiselected = (event) => {
|
|
43
|
-
const selectedOption = event.target;
|
|
44
|
-
this.clearSelectedAttributes();
|
|
45
|
-
selectedOption.setAttribute('selected', 'true');
|
|
46
|
-
};
|
|
47
|
-
this.handleKeyDown = (event) => {
|
|
48
|
-
var _a;
|
|
49
|
-
if (!this.isOpen)
|
|
50
|
-
return;
|
|
51
|
-
const { key } = event;
|
|
52
|
-
if (key === 'ArrowDown') {
|
|
53
|
-
event.preventDefault();
|
|
54
|
-
this.updateActiveIndex(1);
|
|
55
|
-
}
|
|
56
|
-
if (key === 'ArrowUp') {
|
|
57
|
-
event.preventDefault();
|
|
58
|
-
this.updateActiveIndex(-1);
|
|
59
|
-
}
|
|
60
|
-
if (key === 'Enter') {
|
|
61
|
-
(_a = this.options[this.activeIndex]) === null || _a === void 0 ? void 0 : _a.click();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
this.handleInputChange = (e) => {
|
|
65
|
-
this.value = e.target.value;
|
|
66
|
-
this.isOpen = !!this.value.length;
|
|
67
|
-
this.internals.setFormValue(this.value);
|
|
68
|
-
};
|
|
69
|
-
this.handleClick = (event) => {
|
|
70
|
-
if (this.disabled)
|
|
71
|
-
return event.preventDefault();
|
|
72
|
-
const target = event.target;
|
|
73
|
-
if (target.tagName === 'CURA-SELECT-OPTION')
|
|
74
|
-
return this.onOptiselected(event);
|
|
75
|
-
this.isOpen = !this.isOpen;
|
|
76
|
-
};
|
|
77
|
-
this.label = '';
|
|
78
|
-
this.placeholder = '';
|
|
79
|
-
this.value = '';
|
|
80
|
-
this.mode = 'default';
|
|
81
|
-
this.size = 'medium';
|
|
82
|
-
this.status = 'default';
|
|
83
|
-
this.disabled = false;
|
|
84
|
-
this.required = false;
|
|
85
|
-
this.isHovered = false;
|
|
86
|
-
this.isFocused = false;
|
|
87
|
-
this.isOpen = false;
|
|
88
|
-
this.options = undefined;
|
|
89
|
-
this.activeIndex = -1;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Callback for form association.
|
|
93
|
-
*/
|
|
94
|
-
formAssociatedCallback(form) {
|
|
95
|
-
form.ariaLabel = this.label;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Callback to restore the switch state from the form.
|
|
99
|
-
*/
|
|
100
|
-
formStateRestoreCallback(state) {
|
|
101
|
-
this.value = state.value;
|
|
102
|
-
this.updateSelectedOption();
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Callback to reset the switch state when the form is reset.
|
|
106
|
-
*/
|
|
107
|
-
formResetCallback() {
|
|
108
|
-
this.value = '';
|
|
109
|
-
this.clearSelectedAttributes();
|
|
110
|
-
this.internals.setFormValue(this.value);
|
|
111
|
-
this.internals.setValidity({});
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Callback to update the switch's disabled state when the form's disabled state changes.
|
|
115
|
-
*/
|
|
116
|
-
formDisabledCallback(disabled) {
|
|
117
|
-
this.disabled = disabled;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Lifecycle method called before the component is rendered.
|
|
121
|
-
* Initializes the options for the select component.
|
|
122
|
-
*/
|
|
123
|
-
componentWillLoad() {
|
|
124
|
-
this.initializeOptions();
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Lifecycle method called after the component is rendered.
|
|
128
|
-
* Initializes select-related functionality.
|
|
129
|
-
*/
|
|
130
|
-
componentDidLoad() {
|
|
131
|
-
this.setupMutationObserver();
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Lifecycle method called when the component is connected to the DOM.
|
|
135
|
-
* Applies styles based on the theme.
|
|
136
|
-
*/
|
|
137
|
-
connectedCallback() {
|
|
138
|
-
this.applyStyles();
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Lifecycle method called when the component is disconnected from the DOM.
|
|
142
|
-
* Disconnects the MutationObserver if it exists.
|
|
143
|
-
*/
|
|
144
|
-
disconnectedCallback() {
|
|
145
|
-
var _a;
|
|
146
|
-
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
147
|
-
}
|
|
148
|
-
initializeOptions() {
|
|
149
|
-
this.options = this.host.querySelectorAll('cura-select-option');
|
|
150
|
-
this.options.forEach(option => {
|
|
151
|
-
option.setAttribute('size', this.size);
|
|
152
|
-
option.setAttribute('selected', 'false');
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Applies styles to the component based on the theme.
|
|
157
|
-
*/
|
|
158
|
-
applyStyles() {
|
|
159
|
-
const { fonts, colors } = this.theme;
|
|
160
|
-
const fontWeights = fonts.getWeights();
|
|
161
|
-
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() });
|
|
162
|
-
const colorKeys = [
|
|
163
|
-
'primary-base', 'neutral-purewhite', 'neutral-white', 'neutral-black', 'neutral-medium', 'neutral-light',
|
|
164
|
-
'neutral-base', 'neutral-dark', 'success-dark', 'success-darker', 'success-lighter',
|
|
165
|
-
'error-lighter', 'error-dark', 'error-darker', 'error-base', 'info-base'
|
|
166
|
-
];
|
|
167
|
-
colorKeys.forEach(key => {
|
|
168
|
-
this.styles[`--${key}`] = colors.getColor(key);
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Sets up a MutationObserver to watch for changes in the component.
|
|
173
|
-
*/
|
|
174
|
-
setupMutationObserver() {
|
|
175
|
-
this.mutationObserver = new MutationObserver(this.handleMutations);
|
|
176
|
-
this.mutationObserver.observe(this.host, { attributes: true, subtree: true, attributeFilter: ['selected', 'value'] });
|
|
177
|
-
}
|
|
178
|
-
updateSelectedOption() {
|
|
179
|
-
const selectedOption = this.host.querySelector('cura-select-option[selected]');
|
|
180
|
-
if (selectedOption) {
|
|
181
|
-
const selectedValue = selectedOption.textContent;
|
|
182
|
-
if (this.value !== selectedValue) {
|
|
183
|
-
this.value = selectedValue;
|
|
184
|
-
this.isOpen = false;
|
|
185
|
-
this.internals.setFormValue(this.value);
|
|
186
|
-
this.selected.emit({ value: this.value, selected: true });
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Clears the 'selected' attribute from all options.
|
|
192
|
-
*/
|
|
193
|
-
clearSelectedAttributes() {
|
|
194
|
-
this.options.forEach(option => option.removeAttribute('selected'));
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Filters the options based on the current input value.
|
|
198
|
-
*/
|
|
199
|
-
filterOptions() {
|
|
200
|
-
const inputValue = this.value.toLowerCase();
|
|
201
|
-
this.options.forEach(option => {
|
|
202
|
-
var _a;
|
|
203
|
-
const optionValue = ((_a = option.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
204
|
-
const isVisible = this.isOpen ? optionValue.includes(inputValue) : true;
|
|
205
|
-
option.style.display = isVisible ? 'block' : 'none';
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
updateActiveIndex(direction) {
|
|
209
|
-
if (this.options.length === 0)
|
|
210
|
-
return;
|
|
211
|
-
this.activeIndex = (this.activeIndex + direction + this.options.length) % this.options.length;
|
|
212
|
-
this.updateOptionHighlights();
|
|
213
|
-
}
|
|
214
|
-
updateOptionHighlights() {
|
|
215
|
-
this.options.forEach((option, index) => option.active = index === this.activeIndex);
|
|
216
|
-
}
|
|
217
|
-
getClasses() {
|
|
218
|
-
return {
|
|
219
|
-
wrapper: true,
|
|
220
|
-
label: !!this.label,
|
|
221
|
-
disabled: this.disabled,
|
|
222
|
-
transparent: this.mode === 'transparent',
|
|
223
|
-
[this.size.toLowerCase()]: true,
|
|
224
|
-
[this.status.toLowerCase()]: true,
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Determines the color based on the item type and component state.
|
|
229
|
-
*/
|
|
230
|
-
getColor(item) {
|
|
231
|
-
if (this.disabled)
|
|
232
|
-
return 'neutral-medium';
|
|
233
|
-
const isStatusDefault = this.status === 'default';
|
|
234
|
-
const isHoveredOrFocused = this.isFocused || this.isHovered;
|
|
235
|
-
if (item === 'label') {
|
|
236
|
-
if (!isStatusDefault || isHoveredOrFocused)
|
|
237
|
-
return 'neutral-black';
|
|
238
|
-
return 'neutral-dark';
|
|
239
|
-
}
|
|
240
|
-
if (isHoveredOrFocused && isStatusDefault)
|
|
241
|
-
return 'neutral-black';
|
|
242
|
-
if (this.status === 'success')
|
|
243
|
-
return 'success-dark';
|
|
244
|
-
if (this.status === 'error')
|
|
245
|
-
return 'error-dark';
|
|
246
|
-
return 'neutral-dark';
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Renders the icon based on the component's status.
|
|
250
|
-
*/
|
|
251
|
-
renderIcon() {
|
|
252
|
-
if (this.status === 'default')
|
|
253
|
-
return null;
|
|
254
|
-
const icon = { success: 'checkCircle', error: 'alertCircle' }[this.status];
|
|
255
|
-
return (h("cura-icon", { class: 'feedback-icon', name: icon, iconset: 'default', size: this.size === 'large' ? 20 : 16, color: this.getColor('icon'), style: this.styles }));
|
|
256
|
-
}
|
|
257
|
-
render() {
|
|
258
|
-
return (h(Host, { key: '35fd5d99705c940578485552a50bcec54efe036e', style: this.styles }, 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 && (h("cura-label", { key: '99aeba22f4b6204d936b6a9dcf6affa29e9411a8', class: 'label', weight: 'bold', size: this.size === 'large' ? 'small' : 'xsmall', color: this.getColor('label') }, this.label, " ", this.required && h("span", { key: '7e335f6fdb0ee6d9e987fba8ec245006f02761b5', class: 'required' }, "* "))), h("div", { key: 'c9ba61c15951f6689724025778fe8a933ab5b9bd', class: {
|
|
259
|
-
'cura-input-field': true,
|
|
260
|
-
'open': this.isOpen
|
|
261
|
-
} }, this.renderIcon(), 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 }), 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' })), h("cura-label", { key: 'b5565e686989fe0c1e62f6c01fef52b2829bf4f5', class: "helper-text", size: 'xsmall', color: this.getColor('text'), weight: this.mode === 'transparent' ? 'bold' : 'regular' }, h("slot", { key: '4a265609d8742b7e736920d54525cb2405785ea6' })), this.isOpen && (h("div", { key: '8f0609c7c2e709506ea4bdeeebdb1aae8abde1df', class: {
|
|
262
|
-
'menu': true,
|
|
263
|
-
'open': this.isOpen
|
|
264
|
-
} }, h("slot", { key: 'b6f84b885909ea1a9213cb3d590a02d736320228', name: 'option' }))))));
|
|
265
|
-
}
|
|
266
|
-
static get formAssociated() { return true; }
|
|
267
|
-
get host() { return getElement(this); }
|
|
268
|
-
};
|
|
269
|
-
CuraSelect.style = CuraSelectStyle0;
|
|
270
|
-
|
|
271
|
-
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}";
|
|
272
|
-
const CuraSelectOptionStyle0 = curaSelectOptionCss;
|
|
273
|
-
|
|
274
|
-
const CuraSelectOption = class {
|
|
275
|
-
constructor(hostRef) {
|
|
276
|
-
registerInstance(this, hostRef);
|
|
277
|
-
this.theme = window.CuraAPI.theme;
|
|
278
|
-
this.value = undefined;
|
|
279
|
-
this.selected = false;
|
|
280
|
-
this.active = false;
|
|
281
|
-
this.size = 'small';
|
|
282
|
-
this.styles = {};
|
|
283
|
-
}
|
|
284
|
-
connectedCallback() {
|
|
285
|
-
const colors = [
|
|
286
|
-
{ name: '--primary-lighter-50', theme: 'primary-lighter', opacity: 0.5 },
|
|
287
|
-
{ name: '--primary-light', theme: 'primary-light' },
|
|
288
|
-
{ name: '--neutral-light', theme: 'neutral-light' },
|
|
289
|
-
{ name: '--neutral-purewhite', theme: 'neutral-purewhite' },
|
|
290
|
-
];
|
|
291
|
-
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) }));
|
|
292
|
-
}
|
|
293
|
-
getSize(element) {
|
|
294
|
-
const sizeMap = {
|
|
295
|
-
large: element === 'label' ? 'medium' : 20,
|
|
296
|
-
medium: element === 'label' ? 'small' : 16,
|
|
297
|
-
small: element === 'label' ? 'xsmall' : 'micro',
|
|
298
|
-
};
|
|
299
|
-
return sizeMap[this.size] || sizeMap['medium'];
|
|
300
|
-
}
|
|
301
|
-
getClasses() {
|
|
302
|
-
return {
|
|
303
|
-
'item': true,
|
|
304
|
-
'selected': this.selected,
|
|
305
|
-
'active': this.active
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
render() {
|
|
309
|
-
return (h(Host, { key: '231c03411af0a5639358ff232e4a81287a8571f0', slot: "option" }, h("div", { key: 'b5baa8f7c4a4e863b96ffda1454a8c339d4b2656', class: this.getClasses(), style: this.styles }, h("cura-label", { key: '36d3381260263303242c443004f7e201c2683d4e', color: `${this.selected ? 'primary-base' : 'neutral-black'}`, size: this.getSize('label'), "margin-block": "0" }, h("slot", { key: 'cc72fed8c51592c8fd076d091272879c7572a181' })), this.selected && h("cura-icon", { key: 'e118108f84d49b3d6574a143f09b2c43d43d11a8', name: 'check', size: this.getSize('icon'), color: "primary-base" }))));
|
|
310
|
-
}
|
|
311
|
-
get host() { return getElement(this); }
|
|
312
|
-
static get watchers() { return {
|
|
313
|
-
"size": ["getSize"]
|
|
314
|
-
}; }
|
|
315
|
-
};
|
|
316
|
-
CuraSelectOption.style = CuraSelectOptionStyle0;
|
|
317
|
-
|
|
318
|
-
export { CuraSelect as cura_select, CuraSelectOption as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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}
|