composite-select 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/commitlint.config.js +3 -0
- package/composition/composite-select/CompositeManager.js +43 -0
- package/composition/composite-select/composite-select.js +199 -0
- package/composition/composite-select/debounce.js +10 -0
- package/composition/composite-select/helpers.js +96 -0
- package/composition/composite-select/react.js +189 -0
- package/composition/container/ContainerManager.js +76 -0
- package/composition/img/ai.png +0 -0
- package/composition/img/chatgpt.png +0 -0
- package/composition/img/claude.png +0 -0
- package/composition/img/gemini.png +0 -0
- package/composition/img/gmail.png +0 -0
- package/composition/img/google_calendar.png +0 -0
- package/composition/img/google_drive.png +0 -0
- package/composition/img/google_keep.png +0 -0
- package/composition/img/img.json +5 -0
- package/composition/img/perplexity.png +0 -0
- package/composition/img/t3chat.png +0 -0
- package/composition/img/timeanddate.png +0 -0
- package/composition/img/tools.png +0 -0
- package/composition/img/youtube.png +0 -0
- package/composition/options-section/OptionsSectionManager.css +263 -0
- package/composition/options-section/OptionsSectionManager.js +486 -0
- package/composition/options-section/options-section.js +245 -0
- package/composition/options-section/react.js +90 -0
- package/composition/selected-section/SelectedSectionManager.css +214 -0
- package/composition/selected-section/SelectedSectionManager.js +336 -0
- package/composition/selected-section/react.js +91 -0
- package/composition/selected-section/selected-section.js +207 -0
- package/composition/unbind/clickOutside.js +17 -0
- package/diff/coreBundle.patch +13 -0
- package/diff/recorderApp.patch +13 -0
- package/dist/cjs/Module.cjs +15 -0
- package/dist/cjs/composite-select/CompositeManager.js +43 -0
- package/dist/cjs/composite-select/composite-select.js +199 -0
- package/dist/cjs/composite-select/debounce.js +10 -0
- package/dist/cjs/composite-select/helpers.js +96 -0
- package/dist/cjs/composite-select/react.js +189 -0
- package/dist/cjs/container/ContainerManager.js +76 -0
- package/dist/cjs/createSubscriber.cjs +48 -0
- package/dist/cjs/options-section/OptionsSectionManager.js +486 -0
- package/dist/cjs/options-section/options-section.js +245 -0
- package/dist/cjs/options-section/react.js +90 -0
- package/dist/cjs/selected-section/SelectedSectionManager.js +336 -0
- package/dist/cjs/selected-section/react.js +91 -0
- package/dist/cjs/selected-section/selected-section.js +207 -0
- package/dist/cjs/types.cjs +1 -0
- package/dist/cjs/unbind/clickOutside.js +17 -0
- package/dist/esm/Module.js +15 -0
- package/dist/esm/composite-select/CompositeManager.js +43 -0
- package/dist/esm/composite-select/composite-select.js +199 -0
- package/dist/esm/composite-select/debounce.js +10 -0
- package/dist/esm/composite-select/helpers.js +96 -0
- package/dist/esm/composite-select/react.js +189 -0
- package/dist/esm/container/ContainerManager.js +76 -0
- package/dist/esm/createSubscriber.js +48 -0
- package/dist/esm/options-section/OptionsSectionManager.js +486 -0
- package/dist/esm/options-section/options-section.js +245 -0
- package/dist/esm/options-section/react.js +90 -0
- package/dist/esm/selected-section/SelectedSectionManager.js +336 -0
- package/dist/esm/selected-section/react.js +91 -0
- package/dist/esm/selected-section/selected-section.js +207 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/unbind/clickOutside.js +17 -0
- package/dist/types/Module.d.ts +15 -0
- package/dist/types/composite-select/CompositeManager.d.ts +21 -0
- package/dist/types/composite-select/ContainerManager.html.d.ts +1 -0
- package/dist/types/composite-select/composite-select.d.ts +26 -0
- package/dist/types/composite-select/composite-select.html.d.ts +1 -0
- package/dist/types/composite-select/debounce.d.ts +1 -0
- package/dist/types/composite-select/helpers.d.ts +38 -0
- package/dist/types/composite-select/namesSource.d.ts +4 -0
- package/dist/types/composite-select/react.d.ts +61 -0
- package/dist/types/composite-select/urlManager.d.ts +49 -0
- package/dist/types/composite-select/urlManagerWc.d.ts +44 -0
- package/dist/types/container/ContainerManager.d.ts +33 -0
- package/dist/types/createSubscriber.d.ts +26 -0
- package/dist/types/options-section/OptionsSectionManager.d.ts +117 -0
- package/dist/types/options-section/OptionsSectionManager.html.d.ts +1 -0
- package/dist/types/options-section/OptionsSectionManagerWebComponent.attributes.html.d.ts +1 -0
- package/dist/types/options-section/OptionsSectionManagerWebComponent.html.d.ts +1 -0
- package/dist/types/options-section/OptionsSectionManagerWebComponent.nocssrequest.html.d.ts +1 -0
- package/dist/types/options-section/options-section.d.ts +67 -0
- package/dist/types/options-section/react.d.ts +27 -0
- package/dist/types/options-section/urlManager.d.ts +28 -0
- package/dist/types/selected-section/SelectedSectionManager.d.ts +89 -0
- package/dist/types/selected-section/SelectedSectionManager.html.d.ts +1 -0
- package/dist/types/selected-section/SelectedSectionManager.templates.html.d.ts +1 -0
- package/dist/types/selected-section/SelectedSectionManagerWebComponent.attributes.html.d.ts +1 -0
- package/dist/types/selected-section/SelectedSectionManagerWebComponent.html.d.ts +1 -0
- package/dist/types/selected-section/SelectedSectionManagerWebComponent.nocssrequest.html.d.ts +1 -0
- package/dist/types/selected-section/react.d.ts +32 -0
- package/dist/types/selected-section/selected-section.d.ts +54 -0
- package/dist/types/selected-section/urlManager.d.ts +25 -0
- package/dist/types/types.d.ts +9 -0
- package/dist/types/unbind/clickOutside.d.ts +1 -0
- package/floating-label-pattern.css +502 -0
- package/js/CenterAndHeightResizer.js +263 -0
- package/js/CenterResizer.js +190 -0
- package/madooei.tar.gz +0 -0
- package/package.json +28 -0
- package/release.config.js +3 -0
- package/test/lib.d.ts +6 -0
- package/test/lib.js +30 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { OptionsSectionManager } from "./OptionsSectionManager.js";
|
|
2
|
+
/**
|
|
3
|
+
* Injects CSS into the Shadow DOM.
|
|
4
|
+
* Priority:
|
|
5
|
+
* 1. OptionsSection.cssText (Bundler string injection)
|
|
6
|
+
* 2. <meta name="select-component" content="/path1.css, /path2.css"> (Global HTML declaration in main document)
|
|
7
|
+
* 3. OptionsSection.defaultCssUrls (Global JS property)
|
|
8
|
+
*
|
|
9
|
+
* Example of Global HTML Declaration in the main document <head>:
|
|
10
|
+
* <head>
|
|
11
|
+
* <meta name="select-component" content="OptionsSectionManager.css" />
|
|
12
|
+
* </head>
|
|
13
|
+
*/
|
|
14
|
+
export class OptionsSection extends HTMLElement {
|
|
15
|
+
/**
|
|
16
|
+
* Bundlers can inject raw CSS string here to avoid HTTP requests entirely.
|
|
17
|
+
* e.g., OptionsSection.cssText = import('./OptionsSectionManager.css?raw');
|
|
18
|
+
*/
|
|
19
|
+
static cssText = "";
|
|
20
|
+
static defaultCssUrls = [];
|
|
21
|
+
_manager = null;
|
|
22
|
+
_options = {};
|
|
23
|
+
_stylesInjected = false;
|
|
24
|
+
_mountPoint;
|
|
25
|
+
static get observedAttributes() {
|
|
26
|
+
return ["options", "loading", "value", "label", "disabled", "max-height", "show-footer", "show-filter"];
|
|
27
|
+
}
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
this.attachShadow({ mode: "open" });
|
|
31
|
+
this.shadowRoot.innerHTML = `<style></style><div></div>`;
|
|
32
|
+
this._mountPoint = this.shadowRoot.querySelector("div");
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
this._injectStyles();
|
|
36
|
+
if (this._manager)
|
|
37
|
+
return;
|
|
38
|
+
this._options = {
|
|
39
|
+
options: this._parseJSON(this.getAttribute("options")) ?? [],
|
|
40
|
+
loading: this.hasAttribute("loading"),
|
|
41
|
+
value: this.getAttribute("value") || "",
|
|
42
|
+
label: this.getAttribute("label") || "",
|
|
43
|
+
disabled: this.hasAttribute("disabled"),
|
|
44
|
+
maxHeight: this.getAttribute("max-height") || "",
|
|
45
|
+
showFooter: this.hasAttribute("show-footer"),
|
|
46
|
+
showFilter: this.hasAttribute("show-filter"),
|
|
47
|
+
};
|
|
48
|
+
this._manager = new OptionsSectionManager(this._mountPoint, this._options);
|
|
49
|
+
}
|
|
50
|
+
disconnectedCallback() {
|
|
51
|
+
this._manager?.destroy();
|
|
52
|
+
}
|
|
53
|
+
attributeChangedCallback(name, _oldValue, newValue) {
|
|
54
|
+
if (!this._manager)
|
|
55
|
+
return;
|
|
56
|
+
const isTrue = this.hasAttribute(name);
|
|
57
|
+
switch (name) {
|
|
58
|
+
case "options": {
|
|
59
|
+
const parsed = this._parseJSON(newValue);
|
|
60
|
+
if (parsed !== undefined) {
|
|
61
|
+
this._manager.setOptions(parsed);
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case "loading":
|
|
66
|
+
this._manager.setLoading(isTrue);
|
|
67
|
+
break;
|
|
68
|
+
case "value":
|
|
69
|
+
this._manager.setValue(newValue);
|
|
70
|
+
break;
|
|
71
|
+
case "label":
|
|
72
|
+
this._manager.setLabel(newValue);
|
|
73
|
+
break;
|
|
74
|
+
case "disabled":
|
|
75
|
+
this._manager.setDisabled(isTrue);
|
|
76
|
+
break;
|
|
77
|
+
case "max-height":
|
|
78
|
+
this._manager.setMaxHeight(newValue);
|
|
79
|
+
break;
|
|
80
|
+
case "show-footer":
|
|
81
|
+
this._manager.setShowFooter(isTrue);
|
|
82
|
+
break;
|
|
83
|
+
case "show-filter":
|
|
84
|
+
this._manager.setShowFilter(isTrue);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
_injectStyles() {
|
|
89
|
+
if (this._stylesInjected)
|
|
90
|
+
return;
|
|
91
|
+
this._stylesInjected = true;
|
|
92
|
+
const style = document.createElement("style");
|
|
93
|
+
// Scenario A: Bundler injected raw CSS string directly
|
|
94
|
+
if (OptionsSection.cssText) {
|
|
95
|
+
style.textContent = OptionsSection.cssText;
|
|
96
|
+
}
|
|
97
|
+
// Scenario B: Load from URLs (Global Meta Tag > Default Static Property)
|
|
98
|
+
else {
|
|
99
|
+
let urls = [];
|
|
100
|
+
const metaTag = document.querySelector('meta[name="select-component"]');
|
|
101
|
+
if (metaTag && metaTag.getAttribute("content")) {
|
|
102
|
+
urls = metaTag
|
|
103
|
+
.getAttribute("content")
|
|
104
|
+
.split(",")
|
|
105
|
+
.map((s) => s.trim());
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
urls = OptionsSection.defaultCssUrls;
|
|
109
|
+
}
|
|
110
|
+
urls.forEach((url) => {
|
|
111
|
+
if (!url)
|
|
112
|
+
return;
|
|
113
|
+
style.textContent += `@import url("${url}");\n`;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// Remove existing injected CSS if updating dynamically (e.g. css-urls changed)
|
|
117
|
+
const existingStyle = this.shadowRoot.querySelector("style");
|
|
118
|
+
if (existingStyle) {
|
|
119
|
+
existingStyle.remove();
|
|
120
|
+
}
|
|
121
|
+
this.shadowRoot.appendChild(style);
|
|
122
|
+
}
|
|
123
|
+
// Proxied methods
|
|
124
|
+
setMaxHeight(maxHeight) {
|
|
125
|
+
if (maxHeight)
|
|
126
|
+
this.setAttribute("max-height", maxHeight);
|
|
127
|
+
else
|
|
128
|
+
this.removeAttribute("max-height");
|
|
129
|
+
}
|
|
130
|
+
setDisabled(disabled) {
|
|
131
|
+
this.toggleAttribute("disabled", disabled);
|
|
132
|
+
}
|
|
133
|
+
setShowFooter(show) {
|
|
134
|
+
this.toggleAttribute("show-footer", show);
|
|
135
|
+
}
|
|
136
|
+
setShowFilter(show) {
|
|
137
|
+
this.toggleAttribute("show-filter", show);
|
|
138
|
+
}
|
|
139
|
+
setOptions(options) {
|
|
140
|
+
// we don't necessarily want to stringify options back to attribute for performance and avoiding circularity
|
|
141
|
+
// but we can if we want to stay in sync. SelectedSection doesn't seem to do it for 'list'.
|
|
142
|
+
// this.setAttribute("options", JSON.stringify(options));
|
|
143
|
+
this._manager?.setOptions(options);
|
|
144
|
+
}
|
|
145
|
+
setLoading(loading) {
|
|
146
|
+
this.toggleAttribute("loading", loading);
|
|
147
|
+
}
|
|
148
|
+
setValue(value) {
|
|
149
|
+
this.setAttribute("value", value);
|
|
150
|
+
}
|
|
151
|
+
setLabel(label) {
|
|
152
|
+
this.setAttribute("label", label);
|
|
153
|
+
}
|
|
154
|
+
setRenderEmpty(renderer) {
|
|
155
|
+
this._manager?.setRenderEmpty(renderer);
|
|
156
|
+
}
|
|
157
|
+
setRenderItem(renderer) {
|
|
158
|
+
this._manager?.setRenderItem(renderer);
|
|
159
|
+
}
|
|
160
|
+
setRenderList(renderer) {
|
|
161
|
+
this._manager?.setRenderList(renderer);
|
|
162
|
+
}
|
|
163
|
+
setFocus() {
|
|
164
|
+
this._manager?.setFocus();
|
|
165
|
+
}
|
|
166
|
+
setBlur() {
|
|
167
|
+
this._manager?.setBlur();
|
|
168
|
+
}
|
|
169
|
+
highlightAndScrollToElementOnTheList(id) {
|
|
170
|
+
this._manager?.highlightAndScrollToElementOnTheList(id);
|
|
171
|
+
}
|
|
172
|
+
render() {
|
|
173
|
+
this._manager?.render();
|
|
174
|
+
}
|
|
175
|
+
// Getters and setters
|
|
176
|
+
get options() {
|
|
177
|
+
return this._manager?.propOptions.options || [];
|
|
178
|
+
}
|
|
179
|
+
set options(val) {
|
|
180
|
+
this.setOptions(val);
|
|
181
|
+
}
|
|
182
|
+
get loading() {
|
|
183
|
+
return this.hasAttribute("loading");
|
|
184
|
+
}
|
|
185
|
+
set loading(val) {
|
|
186
|
+
this.setLoading(val);
|
|
187
|
+
}
|
|
188
|
+
get value() {
|
|
189
|
+
return this._manager?.propInputElement?.value ?? this.getAttribute("value") ?? "";
|
|
190
|
+
}
|
|
191
|
+
set value(val) {
|
|
192
|
+
this.setValue(val);
|
|
193
|
+
}
|
|
194
|
+
get label() {
|
|
195
|
+
return this.getAttribute("label") || "";
|
|
196
|
+
}
|
|
197
|
+
set label(val) {
|
|
198
|
+
this.setLabel(val);
|
|
199
|
+
}
|
|
200
|
+
get disabled() {
|
|
201
|
+
return this.hasAttribute("disabled");
|
|
202
|
+
}
|
|
203
|
+
set disabled(val) {
|
|
204
|
+
this.setDisabled(val);
|
|
205
|
+
}
|
|
206
|
+
get maxHeight() {
|
|
207
|
+
return this.getAttribute("max-height") || "";
|
|
208
|
+
}
|
|
209
|
+
set maxHeight(val) {
|
|
210
|
+
this.setMaxHeight(val);
|
|
211
|
+
}
|
|
212
|
+
get footer() {
|
|
213
|
+
return this.hasAttribute("show-footer") ? this.getAttribute("show-footer") !== "false" : true;
|
|
214
|
+
}
|
|
215
|
+
set footer(val) {
|
|
216
|
+
this.setShowFooter(val);
|
|
217
|
+
}
|
|
218
|
+
get filter() {
|
|
219
|
+
return this.hasAttribute("show-filter") ? this.getAttribute("show-filter") !== "false" : true;
|
|
220
|
+
}
|
|
221
|
+
set filter(val) {
|
|
222
|
+
this.setShowFilter(val);
|
|
223
|
+
}
|
|
224
|
+
get highlight() {
|
|
225
|
+
return this._manager?.propHighlightedId ?? null;
|
|
226
|
+
}
|
|
227
|
+
set highlight(val) {
|
|
228
|
+
this.highlightAndScrollToElementOnTheList(val);
|
|
229
|
+
}
|
|
230
|
+
getManager() {
|
|
231
|
+
return this._manager;
|
|
232
|
+
}
|
|
233
|
+
_parseJSON(val) {
|
|
234
|
+
if (!val)
|
|
235
|
+
return undefined;
|
|
236
|
+
try {
|
|
237
|
+
return JSON.parse(val);
|
|
238
|
+
}
|
|
239
|
+
catch (e) {
|
|
240
|
+
console.error(`OptionsSection: failed to parse JSON:`, val, e);
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
customElements.define("options-section", OptionsSection);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
import "./options-section.js";
|
|
4
|
+
export const OptionsSection = React.forwardRef((props, ref) => {
|
|
5
|
+
const { options: optionsOptions, loading, value, label, disabled, "max-height": maxHeight, "show-footer": setShowFooter, "show-filter": setShowFilter, children, onItemPick, onInputChange, onCancel, onOk, onHighlightChange, ...rest } = props;
|
|
6
|
+
const internalRef = React.useRef(null);
|
|
7
|
+
const setRef = React.useCallback((node) => {
|
|
8
|
+
internalRef.current = node;
|
|
9
|
+
if (typeof ref === "function") {
|
|
10
|
+
ref(node);
|
|
11
|
+
}
|
|
12
|
+
else if (ref) {
|
|
13
|
+
ref.current = node;
|
|
14
|
+
}
|
|
15
|
+
}, [ref]);
|
|
16
|
+
React.useLayoutEffect(() => {
|
|
17
|
+
const el = internalRef.current;
|
|
18
|
+
if (el && optionsOptions !== undefined) {
|
|
19
|
+
if (el.getManager && el.getManager()) {
|
|
20
|
+
el.getManager().setOptions(typeof optionsOptions === "string" ? JSON.parse(optionsOptions) : optionsOptions);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
el.setAttribute("options", typeof optionsOptions === "string" ? optionsOptions : JSON.stringify(optionsOptions));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, [optionsOptions]);
|
|
27
|
+
React.useLayoutEffect(() => {
|
|
28
|
+
const el = internalRef.current;
|
|
29
|
+
if (el && el.getManager && el.getManager()) {
|
|
30
|
+
const mgr = el.getManager();
|
|
31
|
+
const sub = mgr.getSubscriber();
|
|
32
|
+
if (sub) {
|
|
33
|
+
const unbinds = [];
|
|
34
|
+
if (onItemPick) {
|
|
35
|
+
unbinds.push(sub.bind("onItemPick", (...args) => {
|
|
36
|
+
return onItemPick?.(...args);
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
if (onInputChange) {
|
|
40
|
+
unbinds.push(sub.bind("onInputChange", onInputChange));
|
|
41
|
+
}
|
|
42
|
+
if (onCancel) {
|
|
43
|
+
unbinds.push(sub.bind("onCancel", onCancel));
|
|
44
|
+
}
|
|
45
|
+
if (onOk) {
|
|
46
|
+
unbinds.push(sub.bind("onOk", onOk));
|
|
47
|
+
}
|
|
48
|
+
if (onHighlightChange) {
|
|
49
|
+
unbinds.push(sub.bind("onHighlightChange", onHighlightChange));
|
|
50
|
+
}
|
|
51
|
+
return () => {
|
|
52
|
+
unbinds.forEach((u) => u());
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [onItemPick, onInputChange, onCancel, onOk, onHighlightChange]);
|
|
57
|
+
const wcProps = { ...rest, ref: setRef };
|
|
58
|
+
if (value !== undefined)
|
|
59
|
+
wcProps.value = value;
|
|
60
|
+
if (label !== undefined)
|
|
61
|
+
wcProps.label = label;
|
|
62
|
+
if (String(loading) === "true") {
|
|
63
|
+
wcProps.loading = "true";
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
delete wcProps.loading;
|
|
67
|
+
}
|
|
68
|
+
if (String(disabled) === "true") {
|
|
69
|
+
wcProps.disabled = "true";
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
delete wcProps.disabled;
|
|
73
|
+
}
|
|
74
|
+
if (maxHeight !== undefined)
|
|
75
|
+
wcProps["max-height"] = maxHeight;
|
|
76
|
+
if (String(setShowFooter) === "true") {
|
|
77
|
+
wcProps["show-footer"] = "true";
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
delete wcProps["show-footer"];
|
|
81
|
+
}
|
|
82
|
+
if (String(setShowFilter) === "true") {
|
|
83
|
+
wcProps["show-filter"] = "true";
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
delete wcProps["show-filter"];
|
|
87
|
+
}
|
|
88
|
+
return React.createElement("options-section", wcProps, children);
|
|
89
|
+
});
|
|
90
|
+
export default OptionsSection;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
@keyframes spin {
|
|
2
|
+
from {
|
|
3
|
+
transform: rotate(0deg);
|
|
4
|
+
}
|
|
5
|
+
to {
|
|
6
|
+
transform: rotate(360deg);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
.selected-section {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
padding: 0;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
font-family: inherit;
|
|
16
|
+
background: #fff;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
box-shadow: 0 0 0 1px var(--gcp-css-border, #99999b);
|
|
19
|
+
transition: box-shadow var(--gcp-css-transition, 150ms cubic-bezier(0.4, 0, 0.2, 1));
|
|
20
|
+
min-height: 36px;
|
|
21
|
+
cursor: text;
|
|
22
|
+
|
|
23
|
+
.floating-label {
|
|
24
|
+
position: absolute;
|
|
25
|
+
left: 0;
|
|
26
|
+
margin-left: 7px;
|
|
27
|
+
top: 9px;
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
color: var(--gcp-css-gray-text, #5f6368);
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
transition:
|
|
32
|
+
transform var(--gcp-css-transition, 150ms),
|
|
33
|
+
font-size var(--gcp-css-transition, 150ms),
|
|
34
|
+
color var(--gcp-css-transition, 150ms),
|
|
35
|
+
top var(--gcp-css-transition, 150ms);
|
|
36
|
+
background: #fff;
|
|
37
|
+
padding: 0 4px;
|
|
38
|
+
z-index: 3;
|
|
39
|
+
line-height: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Float condition */
|
|
43
|
+
&:has(input:focus),
|
|
44
|
+
&:has(.element),
|
|
45
|
+
&:has(input:not(:placeholder-shown)) {
|
|
46
|
+
.floating-label {
|
|
47
|
+
top: 0;
|
|
48
|
+
transform: translateY(-50%);
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&:focus-within .floating-label {
|
|
53
|
+
color: var(--gcp-css-primary, #1a73e8);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.error .floating-label {
|
|
57
|
+
color: var(--gcp-css-error, #d93025);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.disabled .floating-label {
|
|
61
|
+
color: var(--gcp-css-gray-text, #5f6368);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:focus-within {
|
|
66
|
+
box-shadow: 0 0 0 2px var(--gcp-css-primary, #1a73e8);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.error {
|
|
70
|
+
box-shadow: 0 0 0 2px var(--gcp-css-error, #d93025);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.disabled {
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
opacity: 0.6;
|
|
76
|
+
color: var(--gcp-css-gray-text, #5f6368);
|
|
77
|
+
|
|
78
|
+
.buttons-container .clear-btn {
|
|
79
|
+
opacity: 0.7;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.flex-list input,
|
|
83
|
+
.element {
|
|
84
|
+
color: #74797e;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
&.hide-delete {
|
|
88
|
+
.element {
|
|
89
|
+
padding-right: 8px;
|
|
90
|
+
[data-remove] {
|
|
91
|
+
display: none;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.flex-list {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-wrap: wrap;
|
|
99
|
+
flex-grow: 1;
|
|
100
|
+
row-gap: 0;
|
|
101
|
+
column-gap: 6px;
|
|
102
|
+
align-items: center;
|
|
103
|
+
z-index: 1;
|
|
104
|
+
min-width: 0;
|
|
105
|
+
padding: 0;
|
|
106
|
+
padding-left: 12px;
|
|
107
|
+
padding-top: 2px;
|
|
108
|
+
padding-bottom: 2px;
|
|
109
|
+
|
|
110
|
+
> * {
|
|
111
|
+
font-size: 16px;
|
|
112
|
+
line-height: 1.15;
|
|
113
|
+
padding-top: 3px;
|
|
114
|
+
padding-bottom: 3px;
|
|
115
|
+
box-sizing: border-box;
|
|
116
|
+
margin-top: 3px;
|
|
117
|
+
margin-bottom: 3px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
input {
|
|
121
|
+
border: none;
|
|
122
|
+
outline: none;
|
|
123
|
+
background: transparent;
|
|
124
|
+
field-sizing: content;
|
|
125
|
+
flex: 1 1 auto;
|
|
126
|
+
min-width: 50px;
|
|
127
|
+
max-width: 100%;
|
|
128
|
+
padding-left: 0;
|
|
129
|
+
padding-right: 0;
|
|
130
|
+
font-family: inherit;
|
|
131
|
+
color: inherit;
|
|
132
|
+
|
|
133
|
+
&::placeholder {
|
|
134
|
+
color: transparent;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.buttons-container {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
margin-left: auto;
|
|
143
|
+
padding-left: 4px;
|
|
144
|
+
z-index: 2;
|
|
145
|
+
flex-shrink: 0;
|
|
146
|
+
.loader {
|
|
147
|
+
width: 24px;
|
|
148
|
+
height: 24px;
|
|
149
|
+
margin-right: 5px;
|
|
150
|
+
background-image: url("data:image/svg+xml,%3Csvg fill='%231a73e8' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z'/%3E%3C/svg%3E");
|
|
151
|
+
background-repeat: no-repeat;
|
|
152
|
+
background-size: contain;
|
|
153
|
+
animation: spin 0.75s linear infinite;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
button.clear-btn {
|
|
157
|
+
background: none;
|
|
158
|
+
border: none;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
padding: 9px;
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
color: var(--gcp-css-gray-text, #5f6368);
|
|
166
|
+
line-height: 1;
|
|
167
|
+
margin-right: 3px;
|
|
168
|
+
&:hover {
|
|
169
|
+
color: #333;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.element {
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
background: rgb(0 0 0 / 12%);
|
|
178
|
+
border-radius: 2px;
|
|
179
|
+
padding-left: 6px;
|
|
180
|
+
padding-right: 5px;
|
|
181
|
+
color: rgba(0, 0, 0, 0.88);
|
|
182
|
+
margin-left: -4px;
|
|
183
|
+
margin-right: 5px;
|
|
184
|
+
|
|
185
|
+
[data-remove] {
|
|
186
|
+
cursor: pointer;
|
|
187
|
+
margin-left: 4px;
|
|
188
|
+
width: 14px;
|
|
189
|
+
height: 14px;
|
|
190
|
+
min-width: 14px;
|
|
191
|
+
min-height: 14px;
|
|
192
|
+
flex-shrink: 0;
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
justify-content: center;
|
|
196
|
+
border-radius: 50%;
|
|
197
|
+
|
|
198
|
+
&::before {
|
|
199
|
+
content: "✕";
|
|
200
|
+
font-size: 10px;
|
|
201
|
+
line-height: 1;
|
|
202
|
+
color: rgba(0, 0, 0, 0.45);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&:hover {
|
|
206
|
+
background-color: rgba(0, 0, 0, 0.08);
|
|
207
|
+
|
|
208
|
+
&::before {
|
|
209
|
+
color: rgba(0, 0, 0, 0.85);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|