@esri/calcite-components 1.0.0-next.307 → 1.0.0-next.310
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/calcite/calcite.esm.js +1 -1
- package/dist/calcite/p-0f014648.entry.js +5 -0
- package/dist/calcite/p-0fa1ba75.entry.js +5 -0
- package/dist/calcite/p-362cb320.entry.js +5 -0
- package/dist/calcite/p-688f06b9.entry.js +5 -0
- package/dist/calcite/p-8e252799.system.js +1 -1
- package/dist/calcite/p-a46c3870.system.entry.js +5 -0
- package/dist/calcite/{p-243d95ab.system.entry.js → p-a5e8f022.system.entry.js} +2 -2
- package/dist/calcite/p-ca6025ab.system.entry.js +5 -0
- package/dist/calcite/p-f1e111f4.system.entry.js +5 -0
- package/dist/cjs/calcite-alert.cjs.entry.js +22 -5
- package/dist/cjs/calcite-color-picker_3.cjs.entry.js +19 -11
- package/dist/cjs/calcite-input.cjs.entry.js +21 -19
- package/dist/cjs/calcite-shell_3.cjs.entry.js +156 -5
- package/dist/cjs/calcite.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/calcite-alert/calcite-alert.js +23 -4
- package/dist/collection/components/calcite-input/calcite-input.css +2 -0
- package/dist/collection/components/calcite-input/calcite-input.js +20 -18
- package/dist/collection/components/calcite-shell-panel/calcite-shell-panel.css +43 -0
- package/dist/collection/components/calcite-shell-panel/calcite-shell-panel.js +194 -5
- package/dist/collection/components/calcite-shell-panel/resources.js +5 -1
- package/dist/components/calcite-alert.js +22 -5
- package/dist/components/calcite-color-picker-swatch2.js +19 -11
- package/dist/components/calcite-input2.js +21 -19
- package/dist/components/calcite-shell-panel.js +161 -7
- package/dist/custom-elements/index.js +311 -134
- package/dist/esm/calcite-alert.entry.js +22 -5
- package/dist/esm/calcite-color-picker_3.entry.js +19 -11
- package/dist/esm/calcite-input.entry.js +21 -19
- package/dist/esm/calcite-shell_3.entry.js +157 -6
- package/dist/esm/calcite.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/calcite-alert.entry.js +2 -2
- package/dist/esm-es5/calcite-color-picker_3.entry.js +1 -1
- package/dist/esm-es5/calcite-input.entry.js +1 -1
- package/dist/esm-es5/calcite-shell_3.entry.js +1 -1
- package/dist/esm-es5/calcite.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/extras/docs-json.json +40 -1
- package/dist/types/components/calcite-alert/calcite-alert.d.ts +3 -0
- package/dist/types/components/calcite-input/calcite-input.d.ts +1 -1
- package/dist/types/components/calcite-shell-panel/calcite-shell-panel.d.ts +31 -0
- package/dist/types/components/calcite-shell-panel/resources.d.ts +4 -0
- package/dist/types/components.d.ts +18 -0
- package/hydrate/index.js +315 -135
- package/package.json +6 -6
- package/readme.md +2 -2
- package/dist/calcite/p-5c0c29bc.entry.js +0 -5
- package/dist/calcite/p-5f817b79.entry.js +0 -5
- package/dist/calcite/p-737fb960.entry.js +0 -5
- package/dist/calcite/p-7cbc72b6.system.entry.js +0 -5
- package/dist/calcite/p-88b875d3.system.entry.js +0 -5
- package/dist/calcite/p-aa47308a.entry.js +0 -5
- package/dist/calcite/p-b1a96c72.system.entry.js +0 -5
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
4
|
*/
|
|
5
|
-
import { Component, Element, Event, Prop, Watch, h } from "@stencil/core";
|
|
6
|
-
import { CSS, SLOTS } from "./resources";
|
|
5
|
+
import { Component, Element, Event, Prop, Watch, h, State, forceUpdate } from "@stencil/core";
|
|
6
|
+
import { CSS, SLOTS, TEXT } from "./resources";
|
|
7
7
|
import { getSlotted } from "../../utils/dom";
|
|
8
|
+
import { clamp } from "../../utils/math";
|
|
8
9
|
/**
|
|
9
10
|
* @slot - A slot for adding content to the shell panel.
|
|
10
11
|
* @slot action-bar - A slot for adding a `calcite-action-bar` to the panel.
|
|
@@ -32,10 +33,121 @@ export class CalciteShellPanel {
|
|
|
32
33
|
* This sets width of the content area.
|
|
33
34
|
*/
|
|
34
35
|
this.widthScale = "m";
|
|
36
|
+
/**
|
|
37
|
+
* Accessible label for resize separator.
|
|
38
|
+
* @default "Resize"
|
|
39
|
+
*/
|
|
40
|
+
this.intlResize = TEXT.resize;
|
|
41
|
+
/**
|
|
42
|
+
* This property makes the content area resizable if the calcite-shell-panel is not 'detached'.
|
|
43
|
+
*/
|
|
44
|
+
this.resizable = false;
|
|
45
|
+
this.contentWidth = null;
|
|
46
|
+
this.initialContentWidth = null;
|
|
47
|
+
this.initialClientX = null;
|
|
48
|
+
this.contentWidthMax = null;
|
|
49
|
+
this.contentWidthMin = null;
|
|
50
|
+
this.step = 1;
|
|
51
|
+
this.stepMultiplier = 10;
|
|
52
|
+
this.storeContentEl = (contentEl) => {
|
|
53
|
+
this.contentEl = contentEl;
|
|
54
|
+
};
|
|
55
|
+
this.getKeyAdjustedWidth = (event) => {
|
|
56
|
+
const { key } = event;
|
|
57
|
+
const { step, stepMultiplier, contentWidthMin, contentWidthMax, initialContentWidth, position } = this;
|
|
58
|
+
const multipliedStep = step * stepMultiplier;
|
|
59
|
+
const MOVEMENT_KEYS = [
|
|
60
|
+
"ArrowUp",
|
|
61
|
+
"ArrowDown",
|
|
62
|
+
"ArrowLeft",
|
|
63
|
+
"ArrowRight",
|
|
64
|
+
"Home",
|
|
65
|
+
"End",
|
|
66
|
+
"PageUp",
|
|
67
|
+
"PageDown"
|
|
68
|
+
];
|
|
69
|
+
if (MOVEMENT_KEYS.indexOf(key) > -1) {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
const increaseKeys = key === "ArrowUp" || (position === "end" ? key === "ArrowLeft" : key === "ArrowRight");
|
|
73
|
+
if (increaseKeys) {
|
|
74
|
+
const stepValue = event.shiftKey ? multipliedStep : step;
|
|
75
|
+
return initialContentWidth + stepValue;
|
|
76
|
+
}
|
|
77
|
+
const decreaseKeys = key === "ArrowDown" || (position === "end" ? key === "ArrowRight" : key === "ArrowLeft");
|
|
78
|
+
if (decreaseKeys) {
|
|
79
|
+
const stepValue = event.shiftKey ? multipliedStep : step;
|
|
80
|
+
return initialContentWidth - stepValue;
|
|
81
|
+
}
|
|
82
|
+
if (typeof contentWidthMin === "number" && key === "Home") {
|
|
83
|
+
return contentWidthMin;
|
|
84
|
+
}
|
|
85
|
+
if (typeof contentWidthMax === "number" && key === "End") {
|
|
86
|
+
return contentWidthMax;
|
|
87
|
+
}
|
|
88
|
+
if (key === "PageDown") {
|
|
89
|
+
return initialContentWidth - multipliedStep;
|
|
90
|
+
}
|
|
91
|
+
if (key === "PageUp") {
|
|
92
|
+
return initialContentWidth + multipliedStep;
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
this.separatorKeyDown = (event) => {
|
|
97
|
+
this.setInitialContentWidth();
|
|
98
|
+
const width = this.getKeyAdjustedWidth(event);
|
|
99
|
+
if (typeof width === "number") {
|
|
100
|
+
this.setContentWidth(width);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
this.separatorPointerMove = (event) => {
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
const { initialContentWidth, position, initialClientX } = this;
|
|
106
|
+
const offset = event.clientX - initialClientX;
|
|
107
|
+
this.setContentWidth(position === "end" ? initialContentWidth - offset : initialContentWidth + offset);
|
|
108
|
+
};
|
|
109
|
+
this.separatorPointerUp = (event) => {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
document.removeEventListener("pointerup", this.separatorPointerUp);
|
|
112
|
+
document.removeEventListener("pointermove", this.separatorPointerMove);
|
|
113
|
+
};
|
|
114
|
+
this.setInitialContentWidth = () => {
|
|
115
|
+
var _a;
|
|
116
|
+
this.initialContentWidth = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
|
|
117
|
+
};
|
|
118
|
+
this.separatorPointerDown = (event) => {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
const { separatorEl } = this;
|
|
121
|
+
separatorEl && document.activeElement !== separatorEl && separatorEl.focus();
|
|
122
|
+
this.setInitialContentWidth();
|
|
123
|
+
this.initialClientX = event.clientX;
|
|
124
|
+
document.addEventListener("pointerup", this.separatorPointerUp);
|
|
125
|
+
document.addEventListener("pointermove", this.separatorPointerMove);
|
|
126
|
+
};
|
|
127
|
+
this.connectSeparator = (separatorEl) => {
|
|
128
|
+
this.disconnectSeparator();
|
|
129
|
+
this.separatorEl = separatorEl;
|
|
130
|
+
separatorEl.addEventListener("pointerdown", this.separatorPointerDown);
|
|
131
|
+
};
|
|
132
|
+
this.disconnectSeparator = () => {
|
|
133
|
+
var _a;
|
|
134
|
+
(_a = this.separatorEl) === null || _a === void 0 ? void 0 : _a.removeEventListener("pointerdown", this.separatorPointerDown);
|
|
135
|
+
};
|
|
35
136
|
}
|
|
36
137
|
watchHandler() {
|
|
37
138
|
this.calciteShellPanelToggle.emit();
|
|
38
139
|
}
|
|
140
|
+
//--------------------------------------------------------------------------
|
|
141
|
+
//
|
|
142
|
+
// Lifecycle
|
|
143
|
+
//
|
|
144
|
+
//--------------------------------------------------------------------------
|
|
145
|
+
disconnectedCallback() {
|
|
146
|
+
this.disconnectSeparator();
|
|
147
|
+
}
|
|
148
|
+
componentDidLoad() {
|
|
149
|
+
this.updateAriaValues();
|
|
150
|
+
}
|
|
39
151
|
// --------------------------------------------------------------------------
|
|
40
152
|
//
|
|
41
153
|
// Render Methods
|
|
@@ -48,18 +160,53 @@ export class CalciteShellPanel {
|
|
|
48
160
|
h("slot", { name: SLOTS.header }))) : null;
|
|
49
161
|
}
|
|
50
162
|
render() {
|
|
51
|
-
const { collapsed, detached, position } = this;
|
|
52
|
-
const
|
|
163
|
+
const { collapsed, detached, position, initialContentWidth, contentWidth, contentWidthMax, contentWidthMin, intlResize, resizable } = this;
|
|
164
|
+
const allowResizing = !detached && resizable;
|
|
165
|
+
const contentNode = (h("div", { class: { [CSS.content]: true, [CSS.contentDetached]: detached }, hidden: collapsed, ref: this.storeContentEl, style: allowResizing && contentWidth ? { width: `${contentWidth}px` } : null },
|
|
53
166
|
this.renderHeader(),
|
|
54
167
|
h("div", { class: CSS.contentBody },
|
|
55
168
|
h("slot", null))));
|
|
169
|
+
const separatorNode = allowResizing ? (h("div", { "aria-label": intlResize, "aria-orientation": "horizontal", "aria-valuemax": contentWidthMax, "aria-valuemin": contentWidthMin, "aria-valuenow": contentWidth !== null && contentWidth !== void 0 ? contentWidth : initialContentWidth, class: CSS.separator, onKeyDown: this.separatorKeyDown, ref: this.connectSeparator, role: "separator", tabIndex: 0, "touch-action": "none" })) : null;
|
|
56
170
|
const actionBarNode = h("slot", { name: SLOTS.actionBar });
|
|
57
|
-
const mainNodes = [actionBarNode, contentNode];
|
|
171
|
+
const mainNodes = [actionBarNode, contentNode, separatorNode];
|
|
58
172
|
if (position === "end") {
|
|
59
173
|
mainNodes.reverse();
|
|
60
174
|
}
|
|
61
175
|
return h("div", { class: { [CSS.container]: true } }, mainNodes);
|
|
62
176
|
}
|
|
177
|
+
// --------------------------------------------------------------------------
|
|
178
|
+
//
|
|
179
|
+
// private Methods
|
|
180
|
+
//
|
|
181
|
+
// --------------------------------------------------------------------------
|
|
182
|
+
setContentWidth(width) {
|
|
183
|
+
const { contentWidthMax, contentWidthMin } = this;
|
|
184
|
+
const roundedWidth = Math.round(width);
|
|
185
|
+
this.contentWidth =
|
|
186
|
+
typeof contentWidthMax === "number" && typeof contentWidthMin === "number"
|
|
187
|
+
? clamp(roundedWidth, contentWidthMin, contentWidthMax)
|
|
188
|
+
: roundedWidth;
|
|
189
|
+
}
|
|
190
|
+
updateAriaValues() {
|
|
191
|
+
const { contentEl } = this;
|
|
192
|
+
const computedStyle = contentEl && getComputedStyle(contentEl);
|
|
193
|
+
if (!computedStyle) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const max = parseInt(computedStyle.getPropertyValue("max-width"), 10);
|
|
197
|
+
const min = parseInt(computedStyle.getPropertyValue("min-width"), 10);
|
|
198
|
+
const valueNow = parseInt(computedStyle.getPropertyValue("width"), 10);
|
|
199
|
+
if (typeof valueNow === "number" && !isNaN(valueNow)) {
|
|
200
|
+
this.initialContentWidth = valueNow;
|
|
201
|
+
}
|
|
202
|
+
if (typeof max === "number" && !isNaN(max)) {
|
|
203
|
+
this.contentWidthMax = max;
|
|
204
|
+
}
|
|
205
|
+
if (typeof min === "number" && !isNaN(min)) {
|
|
206
|
+
this.contentWidthMin = min;
|
|
207
|
+
}
|
|
208
|
+
forceUpdate(this);
|
|
209
|
+
}
|
|
63
210
|
static get is() { return "calcite-shell-panel"; }
|
|
64
211
|
static get encapsulation() { return "shadow"; }
|
|
65
212
|
static get originalStyleUrls() { return {
|
|
@@ -172,8 +319,50 @@ export class CalciteShellPanel {
|
|
|
172
319
|
},
|
|
173
320
|
"attribute": "position",
|
|
174
321
|
"reflect": true
|
|
322
|
+
},
|
|
323
|
+
"intlResize": {
|
|
324
|
+
"type": "string",
|
|
325
|
+
"mutable": false,
|
|
326
|
+
"complexType": {
|
|
327
|
+
"original": "string",
|
|
328
|
+
"resolved": "string",
|
|
329
|
+
"references": {}
|
|
330
|
+
},
|
|
331
|
+
"required": false,
|
|
332
|
+
"optional": false,
|
|
333
|
+
"docs": {
|
|
334
|
+
"tags": [{
|
|
335
|
+
"name": "default",
|
|
336
|
+
"text": "\"Resize\""
|
|
337
|
+
}],
|
|
338
|
+
"text": "Accessible label for resize separator."
|
|
339
|
+
},
|
|
340
|
+
"attribute": "intl-resize",
|
|
341
|
+
"reflect": false,
|
|
342
|
+
"defaultValue": "TEXT.resize"
|
|
343
|
+
},
|
|
344
|
+
"resizable": {
|
|
345
|
+
"type": "boolean",
|
|
346
|
+
"mutable": false,
|
|
347
|
+
"complexType": {
|
|
348
|
+
"original": "boolean",
|
|
349
|
+
"resolved": "boolean",
|
|
350
|
+
"references": {}
|
|
351
|
+
},
|
|
352
|
+
"required": false,
|
|
353
|
+
"optional": false,
|
|
354
|
+
"docs": {
|
|
355
|
+
"tags": [],
|
|
356
|
+
"text": "This property makes the content area resizable if the calcite-shell-panel is not 'detached'."
|
|
357
|
+
},
|
|
358
|
+
"attribute": "resizable",
|
|
359
|
+
"reflect": true,
|
|
360
|
+
"defaultValue": "false"
|
|
175
361
|
}
|
|
176
362
|
}; }
|
|
363
|
+
static get states() { return {
|
|
364
|
+
"contentWidth": {}
|
|
365
|
+
}; }
|
|
177
366
|
static get events() { return [{
|
|
178
367
|
"method": "calciteShellPanelToggle",
|
|
179
368
|
"name": "calciteShellPanelToggle",
|
|
@@ -7,9 +7,13 @@ export const CSS = {
|
|
|
7
7
|
content: "content",
|
|
8
8
|
contentHeader: "content__header",
|
|
9
9
|
contentBody: "content__body",
|
|
10
|
-
contentDetached: "content--detached"
|
|
10
|
+
contentDetached: "content--detached",
|
|
11
|
+
separator: "separator"
|
|
11
12
|
};
|
|
12
13
|
export const SLOTS = {
|
|
13
14
|
actionBar: "action-bar",
|
|
14
15
|
header: "header"
|
|
15
16
|
};
|
|
17
|
+
export const TEXT = {
|
|
18
|
+
resize: "Resize"
|
|
19
|
+
};
|
|
@@ -63,8 +63,13 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
63
63
|
this.queueLength = 0;
|
|
64
64
|
/** is the alert queued */
|
|
65
65
|
this.queued = false;
|
|
66
|
+
this.autoDismissTimeout = null;
|
|
67
|
+
this.trackTimer = new Date();
|
|
66
68
|
/** close and emit the closed alert and the queue */
|
|
67
69
|
this.closeAlert = () => {
|
|
70
|
+
if (this.autoDismissTimeout) {
|
|
71
|
+
this.autoDismissTimeout = null;
|
|
72
|
+
}
|
|
68
73
|
this.queued = false;
|
|
69
74
|
this.active = false;
|
|
70
75
|
this.queue = this.queue.filter((e) => e !== this.el);
|
|
@@ -88,6 +93,12 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
88
93
|
updateRequestedIcon() {
|
|
89
94
|
this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
|
|
90
95
|
}
|
|
96
|
+
updateDuration(newDuration, prevDuration) {
|
|
97
|
+
if (this.autoDismiss && prevDuration !== newDuration && this.autoDismissTimeout) {
|
|
98
|
+
window.clearTimeout(this.autoDismissTimeout);
|
|
99
|
+
this.autoDismissTimeout = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration] - (new Date().valueOf() - this.trackTimer.valueOf()));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
91
102
|
//--------------------------------------------------------------------------
|
|
92
103
|
//
|
|
93
104
|
// Lifecycle
|
|
@@ -104,20 +115,25 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
104
115
|
componentDidLoad() {
|
|
105
116
|
this.alertLinkEl = this.el.querySelectorAll("calcite-link")[0];
|
|
106
117
|
}
|
|
118
|
+
disconnectedCallback() {
|
|
119
|
+
if (this.autoDismissTimeout) {
|
|
120
|
+
window.clearTimeout(this.autoDismissTimeout);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
107
123
|
render() {
|
|
108
124
|
const dir = getElementDir(this.el);
|
|
109
125
|
const closeButton = (h("button", { "aria-label": this.intlClose, class: "alert-close", onClick: this.closeAlert, ref: (el) => (this.closeButton = el), type: "button" }, h("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
|
|
110
126
|
const queueText = `+${this.queueLength > 2 ? this.queueLength - 1 : 1}`;
|
|
111
127
|
const queueCount = (h("div", { class: `${this.queueLength > 1 ? "active " : ""}alert-queue-count` }, h("calcite-chip", { scale: this.scale, value: queueText }, queueText)));
|
|
112
128
|
const { active, autoDismiss, label, queued, requestedIcon } = this;
|
|
113
|
-
const
|
|
129
|
+
const progressBar = h("div", { class: "alert-dismiss-progress" });
|
|
114
130
|
const role = autoDismiss ? "alert" : "alertdialog";
|
|
115
131
|
const hidden = !active;
|
|
116
132
|
return (h(Host, { "aria-hidden": hidden.toString(), "aria-label": label, "calcite-hydrated-hidden": hidden, role: role }, h("div", { class: {
|
|
117
133
|
container: true,
|
|
118
134
|
queued,
|
|
119
135
|
[CSS_UTILITY.rtl]: dir === "rtl"
|
|
120
|
-
} }, requestedIcon ? (h("div", { class: "alert-icon" }, h("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h("div", { class: "alert-content" }, h("slot", { name: SLOTS.title }), h("slot", { name: SLOTS.message }), h("slot", { name: SLOTS.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ?
|
|
136
|
+
} }, requestedIcon ? (h("div", { class: "alert-icon" }, h("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h("div", { class: "alert-content" }, h("slot", { name: SLOTS.title }), h("slot", { name: SLOTS.message }), h("slot", { name: SLOTS.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ? progressBar : null)));
|
|
121
137
|
}
|
|
122
138
|
// when an alert is opened or closed, update queue and determine active alert
|
|
123
139
|
alertSync(event) {
|
|
@@ -163,8 +179,8 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
163
179
|
var _a;
|
|
164
180
|
if (((_a = this.queue) === null || _a === void 0 ? void 0 : _a[0]) === this.el) {
|
|
165
181
|
this.openAlert();
|
|
166
|
-
|
|
167
|
-
|
|
182
|
+
if (this.autoDismiss && !this.autoDismissTimeout) {
|
|
183
|
+
this.trackTimer = new Date();
|
|
168
184
|
this.autoDismissTimeout = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration]);
|
|
169
185
|
}
|
|
170
186
|
}
|
|
@@ -185,7 +201,8 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
185
201
|
static get watchers() { return {
|
|
186
202
|
"active": ["watchActive"],
|
|
187
203
|
"icon": ["updateRequestedIcon"],
|
|
188
|
-
"color": ["updateRequestedIcon"]
|
|
204
|
+
"color": ["updateRequestedIcon"],
|
|
205
|
+
"autoDismissDuration": ["updateDuration"]
|
|
189
206
|
}; }
|
|
190
207
|
static get style() { return calciteAlertCss; }
|
|
191
208
|
};
|
|
@@ -215,12 +215,13 @@ var colorString = createCommonjsModule(function (module) {
|
|
|
215
215
|
/* MIT license */
|
|
216
216
|
|
|
217
217
|
|
|
218
|
+
var hasOwnProperty = Object.hasOwnProperty;
|
|
218
219
|
|
|
219
220
|
var reverseNames = {};
|
|
220
221
|
|
|
221
222
|
// create a list of reverse color names
|
|
222
223
|
for (var name in colorName$1) {
|
|
223
|
-
if (colorName$1
|
|
224
|
+
if (hasOwnProperty.call(colorName$1, name)) {
|
|
224
225
|
reverseNames[colorName$1[name]] = name;
|
|
225
226
|
}
|
|
226
227
|
}
|
|
@@ -263,9 +264,9 @@ cs.get.rgb = function (string) {
|
|
|
263
264
|
|
|
264
265
|
var abbr = /^#([a-f0-9]{3,4})$/i;
|
|
265
266
|
var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
|
|
266
|
-
var rgba = /^rgba?\(\s*([+-]?\d+)\s
|
|
267
|
-
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s
|
|
268
|
-
var keyword =
|
|
267
|
+
var rgba = /^rgba?\(\s*([+-]?\d+)\s*,?\s*([+-]?\d+)\s*,?\s*([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
268
|
+
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
269
|
+
var keyword = /^(\w+)$/;
|
|
269
270
|
|
|
270
271
|
var rgb = [0, 0, 0, 1];
|
|
271
272
|
var match;
|
|
@@ -302,7 +303,11 @@ cs.get.rgb = function (string) {
|
|
|
302
303
|
}
|
|
303
304
|
|
|
304
305
|
if (match[4]) {
|
|
305
|
-
|
|
306
|
+
if (match[5]) {
|
|
307
|
+
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
308
|
+
} else {
|
|
309
|
+
rgb[3] = parseFloat(match[4]);
|
|
310
|
+
}
|
|
306
311
|
}
|
|
307
312
|
} else if (match = string.match(per)) {
|
|
308
313
|
for (i = 0; i < 3; i++) {
|
|
@@ -310,19 +315,22 @@ cs.get.rgb = function (string) {
|
|
|
310
315
|
}
|
|
311
316
|
|
|
312
317
|
if (match[4]) {
|
|
313
|
-
|
|
318
|
+
if (match[5]) {
|
|
319
|
+
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
320
|
+
} else {
|
|
321
|
+
rgb[3] = parseFloat(match[4]);
|
|
322
|
+
}
|
|
314
323
|
}
|
|
315
324
|
} else if (match = string.match(keyword)) {
|
|
316
325
|
if (match[1] === 'transparent') {
|
|
317
326
|
return [0, 0, 0, 0];
|
|
318
327
|
}
|
|
319
328
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (!rgb) {
|
|
329
|
+
if (!hasOwnProperty.call(colorName$1, match[1])) {
|
|
323
330
|
return null;
|
|
324
331
|
}
|
|
325
332
|
|
|
333
|
+
rgb = colorName$1[match[1]];
|
|
326
334
|
rgb[3] = 1;
|
|
327
335
|
|
|
328
336
|
return rgb;
|
|
@@ -348,7 +356,7 @@ cs.get.hsl = function (string) {
|
|
|
348
356
|
|
|
349
357
|
if (match) {
|
|
350
358
|
var alpha = parseFloat(match[4]);
|
|
351
|
-
var h = (parseFloat(match[1]) + 360) % 360;
|
|
359
|
+
var h = ((parseFloat(match[1]) % 360) + 360) % 360;
|
|
352
360
|
var s = clamp(parseFloat(match[2]), 0, 100);
|
|
353
361
|
var l = clamp(parseFloat(match[3]), 0, 100);
|
|
354
362
|
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
@@ -443,7 +451,7 @@ function clamp(num, min, max) {
|
|
|
443
451
|
}
|
|
444
452
|
|
|
445
453
|
function hexDouble(num) {
|
|
446
|
-
var str = num.toString(16).toUpperCase();
|
|
454
|
+
var str = Math.round(num).toString(16).toUpperCase();
|
|
447
455
|
return (str.length < 2) ? '0' + str : str;
|
|
448
456
|
}
|
|
449
457
|
});
|
|
@@ -41,7 +41,7 @@ const SLOTS = {
|
|
|
41
41
|
action: "action"
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
const calciteInputCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:300ms}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host([scale=s]) input,:host([scale=s]) .prefix,:host([scale=s]) .suffix{font-size:var(--calcite-font-size--2);line-height:1rem;padding:0.5rem;height:1.5rem}:host([scale=s]) textarea{height:1.5rem;min-height:1.5rem}:host([scale=s]) .number-button-wrapper,:host([scale=s]) .action-wrapper calcite-button,:host([scale=s]) .action-wrapper calcite-button button{height:1.5rem}:host([scale=s]) input[type=file]{height:1.5rem}:host([scale=s]) .clear-button{min-height:1.5rem;min-width:1.5rem}:host([scale=s]) textarea{font-size:var(--calcite-font-size--2);line-height:1rem;padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.5rem;padding-right:0.5rem;height:auto}:host([scale=m]) input,:host([scale=m]) .prefix,:host([scale=m]) .suffix{font-size:var(--calcite-font-size--1);line-height:1rem;padding:0.75rem;height:2rem}:host([scale=m]) textarea{min-height:2rem}:host([scale=m]) .number-button-wrapper,:host([scale=m]) .action-wrapper calcite-button,:host([scale=m]) .action-wrapper calcite-button button{height:2rem}:host([scale=m]) input[type=file]{height:2rem}:host([scale=m]) .clear-button{min-height:2rem;min-width:2rem}:host([scale=m]) textarea{font-size:var(--calcite-font-size--1);line-height:1rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;height:auto}:host([scale=l]) input,:host([scale=l]) .prefix,:host([scale=l]) .suffix{font-size:var(--calcite-font-size-0);line-height:1.25rem;padding:1rem;height:2.75rem}:host([scale=l]) textarea{min-height:2.75rem}:host([scale=l]) .number-button-wrapper,:host([scale=l]) .action-wrapper calcite-button,:host([scale=l]) .action-wrapper calcite-button button{height:2.75rem}:host([scale=l]) input[type=file]{height:2.75rem}:host([scale=l]) .clear-button{min-height:2.75rem;min-width:2.75rem}:host([scale=l]) textarea{font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-top:0.75rem;padding-bottom:0.75rem;padding-left:1rem;padding-right:1rem;height:auto}:host([disabled]){pointer-events:none}:host([disabled]) .wrapper{pointer-events:none;--text-opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) button,:host([disabled]) textarea,:host([disabled]) input{pointer-events:none}:host([disabled]) textarea{resize:none}:host textarea,:host input{-webkit-transition:150ms ease-in-out, height 0s;transition:150ms ease-in-out, height 0s;-webkit-appearance:none;width:100%;border-radius:0;position:relative;max-height:100%;max-width:100%;margin:0;font-weight:var(--calcite-font-weight-normal);font-family:inherit;-ms-flex:1 1 0%;flex:1 1 0%;display:-ms-flexbox;display:flex;color:var(--calcite-ui-text-1);-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1)}:host input[type=search]::-webkit-search-decoration{-webkit-appearance:none}:host input,:host textarea{color:var(--calcite-ui-text-1);border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input)}:host input:-ms-input-placeholder,:host textarea:-ms-input-placeholder{color:var(--calcite-ui-text-3);font-weight:var(--calcite-font-weight-normal)}:host input::-ms-input-placeholder,:host textarea::-ms-input-placeholder{color:var(--calcite-ui-text-3);font-weight:var(--calcite-font-weight-normal)}:host input::placeholder,:host input:-ms-input-placeholder,:host input::-ms-input-placeholder,:host textarea::placeholder,:host textarea:-ms-input-placeholder,:host textarea::-ms-input-placeholder{color:var(--calcite-ui-text-3);font-weight:var(--calcite-font-weight-normal)}:host input:focus,:host textarea:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}:host input[readonly],:host textarea[readonly]{background-color:var(--calcite-ui-background)}:host input[readonly]:focus,:host textarea[readonly]:focus{color:var(--calcite-ui-text-1)}:host calcite-icon{color:var(--calcite-ui-text-3)}:host textarea,:host input{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}:host textarea:focus,:host input:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host([status=invalid]) input,:host([status=invalid]) textarea{border-color:var(--calcite-ui-danger)}:host([status=invalid]) input:focus,:host([status=invalid]) textarea:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}:host([scale=s]) .icon{left:0.5rem}:host([scale=s]) .calcite--rtl .icon{left:unset;right:0.5rem}:host([scale=m]) .icon{left:0.75rem}:host([scale=m]) .calcite--rtl .icon{left:unset;right:0.75rem}:host([scale=l]) .icon{left:1rem}:host([scale=l]) .calcite--rtl .icon{left:unset;right:1rem}:host([icon][scale=s]) input{padding-left:2rem}:host([icon][scale=s]) .calcite--rtl input{padding-right:2rem;padding-left:0.5rem}:host([icon][scale=m]) input{padding-left:2.5rem}:host([icon][scale=m]) .calcite--rtl input{padding-right:2.5rem;padding-left:0.5rem}:host([icon][scale=l]) input{padding-left:3rem}:host([icon][scale=l]) .calcite--rtl input{padding-right:3rem;padding-left:0.5rem}.element-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex:1 1 0%;flex:1 1 0%;position:relative;-ms-flex-order:3;order:3}.icon{display:block;position:absolute;pointer-events:none;z-index:10;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}input[type=text]::-ms-clear,input[type=text]::-ms-reveal{display:none;width:0;height:0}input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration,input[type=date]::-webkit-clear-button,input[type=time]::-webkit-clear-button{display:none}.clear-button{pointer-events:initial;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;display:-ms-flexbox;display:flex;-ms-flex-item-align:stretch;align-self:stretch;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;min-height:100%;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);border-left-width:0;-ms-flex-order:4;order:4;margin:0}.clear-button:hover{background-color:var(--calcite-ui-foreground-2);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}.clear-button:hover calcite-icon{color:var(--calcite-ui-text-1);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}.clear-button:active{background-color:var(--calcite-ui-foreground-3)}.clear-button:active calcite-icon{color:var(--calcite-ui-text-1)}.clear-button:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.clear-button:disabled{opacity:var(--calcite-ui-opacity-disabled)}.calcite--rtl .clear-button{border-left-color:var(--calcite-ui-border-input);border-width:1px;border-right-width:0}.loader{top:1px;left:1px;right:1px;display:block;pointer-events:none;position:absolute}.action-wrapper{display:-ms-flexbox;display:flex;-ms-flex-order:7;order:7}.prefix,.suffix{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:center;align-content:center;height:auto;min-height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:border-box;box-sizing:border-box;font-weight:var(--calcite-font-weight-medium);border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);color:var(--calcite-ui-text-2);line-height:1;word-wrap:break-word;overflow-wrap:break-word}.prefix{-ms-flex-order:2;order:2;border-right-width:0}.suffix{-ms-flex-order:5;order:5;border-left-width:0}.calcite--rtl .prefix{border-right-width:1px;border-left-width:0}.calcite--rtl .suffix{border-left-width:1px;border-right-width:0}:host([alignment=start]) textarea,:host([alignment=start]) input{text-align:left}:host([alignment=start]) .calcite--rtl textarea,:host([alignment=start]) .calcite--rtl input{text-align:right}:host([alignment=end]) textarea,:host([alignment=end]) input{text-align:right}:host([alignment=end]) .calcite--rtl textarea,:host([alignment=end]) .calcite--rtl input{text-align:left}:host input[type=number]{-moz-appearance:textfield}:host input[type=number]::-webkit-inner-spin-button,:host input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield;margin:0}.number-button-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;pointer-events:none;-ms-flex-order:6;order:6;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}:host([number-button-type=vertical]) .wrapper{-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex}:host([number-button-type=vertical]) input,:host([number-button-type=vertical]) textarea{-ms-flex-order:2;order:2}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down],.number-button-item.number-button-item--horizontal[data-adjustment=up]{min-height:100%;max-height:100%;-ms-flex-order:1;order:1;-ms-flex-item-align:stretch;align-self:stretch}.number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon,.number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down]{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-right-width:0}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item.number-button-item--horizontal[data-adjustment=up]{-ms-flex-order:5;order:5}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}.calcite--rtl .number-button-item.number-button-item--horizontal[data-adjustment=down]{border-width:1px;border-left-width:0;border-color:var(--calcite-ui-border-input)}.calcite--rtl .number-button-item.number-button-item--horizontal[data-adjustment=up]{border-width:1px;border-right-width:0;border-color:var(--calcite-ui-border-input)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down],:host([number-button-type=vertical]) .calcite--rtl .number-button-item[data-adjustment=down]{border-top-width:0}.number-button-item{max-height:50%;min-height:50%;pointer-events:initial;display:-ms-flexbox;display:flex;-ms-flex-item-align:center;align-self:center;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;padding-top:0;padding-bottom:0;padding-left:0.5rem;padding-right:0.5rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);border-left-width:0;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;margin:0}.number-button-item calcite-icon{pointer-events:none;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}.number-button-item:focus{background-color:var(--calcite-ui-foreground-2)}.number-button-item:focus calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item:active{background-color:var(--calcite-ui-foreground-3)}:host([number-button-type=vertical]) .calcite--rtl .number-button-item{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-right-width:0}.wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;position:relative}:host input::-webkit-calendar-picker-indicator{display:none}:host input[type=date]::-webkit-input-placeholder{visibility:hidden !important}:host textarea::-webkit-resizer{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;bottom:0;right:0;padding-top:0;padding-bottom:0;padding-left:0.25rem;padding-right:0.25rem}@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){.resize-icon-wrapper{display:none}}.resize-icon-wrapper{bottom:2px;right:2px;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3);position:absolute;z-index:10;pointer-events:none;width:0.75rem;height:0.75rem}.resize-icon-wrapper calcite-icon{bottom:0.25rem;right:0.25rem;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.calcite--rtl textarea::-webkit-resizer{right:unset;left:0}.calcite--rtl .resize-icon-wrapper{left:2px;right:unset}.calcite--rtl .resize-icon-wrapper calcite-icon{bottom:0.25rem;right:0.25rem;-webkit-transform:rotate(45deg);transform:rotate(45deg)}:host([type=color]) input{padding:0.25rem}:host([type=file]) input{background-color:var(--calcite-ui-foreground-1);cursor:pointer;border-width:1px;border-style:dashed;border-color:var(--calcite-ui-border-input);text-align:center}:host([type=file][scale=s]) input{padding-top:1px;padding-bottom:1px;padding-left:0.5rem;padding-right:0.5rem}:host([type=file][scale=m]) input{padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}:host([type=file][scale=l]) input{padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem}:host(.no-bottom-border) input{border-bottom-width:0}:host(.border-t-color-1) input{border-top-color:var(--calcite-ui-border-1)}:host .inline-child{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;background-color:transparent}:host .inline-child .editing-enabled{background-color:inherit}:host .inline-child:not(.editing-enabled){display:-ms-flexbox;display:flex;cursor:pointer;border-color:transparent;-webkit-padding-start:0;padding-inline-start:0}::slotted(input[slot=hidden-form-input]){bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
|
|
44
|
+
const calciteInputCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:300ms}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host([scale=s]) input,:host([scale=s]) .prefix,:host([scale=s]) .suffix{font-size:var(--calcite-font-size--2);line-height:1rem;padding:0.5rem;height:1.5rem}:host([scale=s]) textarea{height:1.5rem;min-height:1.5rem}:host([scale=s]) .number-button-wrapper,:host([scale=s]) .action-wrapper calcite-button,:host([scale=s]) .action-wrapper calcite-button button{height:1.5rem}:host([scale=s]) input[type=file]{height:1.5rem}:host([scale=s]) .clear-button{min-height:1.5rem;min-width:1.5rem}:host([scale=s]) textarea{font-size:var(--calcite-font-size--2);line-height:1rem;padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.5rem;padding-right:0.5rem;height:auto}:host([scale=m]) input,:host([scale=m]) .prefix,:host([scale=m]) .suffix{font-size:var(--calcite-font-size--1);line-height:1rem;padding:0.75rem;height:2rem}:host([scale=m]) textarea{min-height:2rem}:host([scale=m]) .number-button-wrapper,:host([scale=m]) .action-wrapper calcite-button,:host([scale=m]) .action-wrapper calcite-button button{height:2rem}:host([scale=m]) input[type=file]{height:2rem}:host([scale=m]) .clear-button{min-height:2rem;min-width:2rem}:host([scale=m]) textarea{font-size:var(--calcite-font-size--1);line-height:1rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;height:auto}:host([scale=l]) input,:host([scale=l]) .prefix,:host([scale=l]) .suffix{font-size:var(--calcite-font-size-0);line-height:1.25rem;padding:1rem;height:2.75rem}:host([scale=l]) textarea{min-height:2.75rem}:host([scale=l]) .number-button-wrapper,:host([scale=l]) .action-wrapper calcite-button,:host([scale=l]) .action-wrapper calcite-button button{height:2.75rem}:host([scale=l]) input[type=file]{height:2.75rem}:host([scale=l]) .clear-button{min-height:2.75rem;min-width:2.75rem}:host([scale=l]) textarea{font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-top:0.75rem;padding-bottom:0.75rem;padding-left:1rem;padding-right:1rem;height:auto}:host([disabled]){pointer-events:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) .wrapper{pointer-events:none;--text-opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) button,:host([disabled]) textarea,:host([disabled]) input{pointer-events:none}:host([disabled]) textarea{resize:none}:host textarea,:host input{-webkit-transition:150ms ease-in-out, height 0s;transition:150ms ease-in-out, height 0s;-webkit-appearance:none;width:100%;border-radius:0;position:relative;max-height:100%;max-width:100%;margin:0;font-weight:var(--calcite-font-weight-normal);font-family:inherit;-ms-flex:1 1 0%;flex:1 1 0%;display:-ms-flexbox;display:flex;color:var(--calcite-ui-text-1);-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1)}:host input[type=search]::-webkit-search-decoration{-webkit-appearance:none}:host input,:host textarea{color:var(--calcite-ui-text-1);border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input)}:host input:-ms-input-placeholder,:host textarea:-ms-input-placeholder{color:var(--calcite-ui-text-3);font-weight:var(--calcite-font-weight-normal)}:host input::-ms-input-placeholder,:host textarea::-ms-input-placeholder{color:var(--calcite-ui-text-3);font-weight:var(--calcite-font-weight-normal)}:host input::placeholder,:host input:-ms-input-placeholder,:host input::-ms-input-placeholder,:host textarea::placeholder,:host textarea:-ms-input-placeholder,:host textarea::-ms-input-placeholder{color:var(--calcite-ui-text-3);font-weight:var(--calcite-font-weight-normal)}:host input:focus,:host textarea:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}:host input[readonly],:host textarea[readonly]{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}:host input[readonly]:focus,:host textarea[readonly]:focus{color:var(--calcite-ui-text-1)}:host calcite-icon{color:var(--calcite-ui-text-3)}:host textarea,:host input{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}:host textarea:focus,:host input:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host([status=invalid]) input,:host([status=invalid]) textarea{border-color:var(--calcite-ui-danger)}:host([status=invalid]) input:focus,:host([status=invalid]) textarea:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}:host([scale=s]) .icon{left:0.5rem}:host([scale=s]) .calcite--rtl .icon{left:unset;right:0.5rem}:host([scale=m]) .icon{left:0.75rem}:host([scale=m]) .calcite--rtl .icon{left:unset;right:0.75rem}:host([scale=l]) .icon{left:1rem}:host([scale=l]) .calcite--rtl .icon{left:unset;right:1rem}:host([icon][scale=s]) input{padding-left:2rem}:host([icon][scale=s]) .calcite--rtl input{padding-right:2rem;padding-left:0.5rem}:host([icon][scale=m]) input{padding-left:2.5rem}:host([icon][scale=m]) .calcite--rtl input{padding-right:2.5rem;padding-left:0.5rem}:host([icon][scale=l]) input{padding-left:3rem}:host([icon][scale=l]) .calcite--rtl input{padding-right:3rem;padding-left:0.5rem}.element-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex:1 1 0%;flex:1 1 0%;position:relative;-ms-flex-order:3;order:3}.icon{display:block;position:absolute;pointer-events:none;z-index:10;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}input[type=text]::-ms-clear,input[type=text]::-ms-reveal{display:none;width:0;height:0}input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration,input[type=date]::-webkit-clear-button,input[type=time]::-webkit-clear-button{display:none}.clear-button{pointer-events:initial;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;display:-ms-flexbox;display:flex;-ms-flex-item-align:stretch;align-self:stretch;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;min-height:100%;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);border-left-width:0;-ms-flex-order:4;order:4;margin:0}.clear-button:hover{background-color:var(--calcite-ui-foreground-2);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}.clear-button:hover calcite-icon{color:var(--calcite-ui-text-1);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}.clear-button:active{background-color:var(--calcite-ui-foreground-3)}.clear-button:active calcite-icon{color:var(--calcite-ui-text-1)}.clear-button:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.clear-button:disabled{opacity:var(--calcite-ui-opacity-disabled)}.calcite--rtl .clear-button{border-left-color:var(--calcite-ui-border-input);border-width:1px;border-right-width:0}.loader{top:1px;left:1px;right:1px;display:block;pointer-events:none;position:absolute}.action-wrapper{display:-ms-flexbox;display:flex;-ms-flex-order:7;order:7}.prefix,.suffix{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:center;align-content:center;height:auto;min-height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:border-box;box-sizing:border-box;font-weight:var(--calcite-font-weight-medium);border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);color:var(--calcite-ui-text-2);line-height:1;word-wrap:break-word;overflow-wrap:break-word}.prefix{-ms-flex-order:2;order:2;border-right-width:0}.suffix{-ms-flex-order:5;order:5;border-left-width:0}.calcite--rtl .prefix{border-right-width:1px;border-left-width:0}.calcite--rtl .suffix{border-left-width:1px;border-right-width:0}:host([alignment=start]) textarea,:host([alignment=start]) input{text-align:left}:host([alignment=start]) .calcite--rtl textarea,:host([alignment=start]) .calcite--rtl input{text-align:right}:host([alignment=end]) textarea,:host([alignment=end]) input{text-align:right}:host([alignment=end]) .calcite--rtl textarea,:host([alignment=end]) .calcite--rtl input{text-align:left}:host input[type=number]{-moz-appearance:textfield}:host input[type=number]::-webkit-inner-spin-button,:host input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield;margin:0}.number-button-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;pointer-events:none;-ms-flex-order:6;order:6;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}:host([number-button-type=vertical]) .wrapper{-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex}:host([number-button-type=vertical]) input,:host([number-button-type=vertical]) textarea{-ms-flex-order:2;order:2}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down],.number-button-item.number-button-item--horizontal[data-adjustment=up]{min-height:100%;max-height:100%;-ms-flex-order:1;order:1;-ms-flex-item-align:stretch;align-self:stretch}.number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon,.number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down]{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-right-width:0}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item.number-button-item--horizontal[data-adjustment=up]{-ms-flex-order:5;order:5}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}.calcite--rtl .number-button-item.number-button-item--horizontal[data-adjustment=down]{border-width:1px;border-left-width:0;border-color:var(--calcite-ui-border-input)}.calcite--rtl .number-button-item.number-button-item--horizontal[data-adjustment=up]{border-width:1px;border-right-width:0;border-color:var(--calcite-ui-border-input)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down],:host([number-button-type=vertical]) .calcite--rtl .number-button-item[data-adjustment=down]{border-top-width:0}.number-button-item{max-height:50%;min-height:50%;pointer-events:initial;display:-ms-flexbox;display:flex;-ms-flex-item-align:center;align-self:center;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;padding-top:0;padding-bottom:0;padding-left:0.5rem;padding-right:0.5rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);border-left-width:0;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;margin:0}.number-button-item calcite-icon{pointer-events:none;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}.number-button-item:focus{background-color:var(--calcite-ui-foreground-2)}.number-button-item:focus calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item:active{background-color:var(--calcite-ui-foreground-3)}:host([number-button-type=vertical]) .calcite--rtl .number-button-item{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-right-width:0}.wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;position:relative}:host input::-webkit-calendar-picker-indicator{display:none}:host input[type=date]::-webkit-input-placeholder{visibility:hidden !important}:host textarea::-webkit-resizer{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;bottom:0;right:0;padding-top:0;padding-bottom:0;padding-left:0.25rem;padding-right:0.25rem}@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){.resize-icon-wrapper{display:none}}.resize-icon-wrapper{bottom:2px;right:2px;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3);position:absolute;z-index:10;pointer-events:none;width:0.75rem;height:0.75rem}.resize-icon-wrapper calcite-icon{bottom:0.25rem;right:0.25rem;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.calcite--rtl textarea::-webkit-resizer{right:unset;left:0}.calcite--rtl .resize-icon-wrapper{left:2px;right:unset}.calcite--rtl .resize-icon-wrapper calcite-icon{bottom:0.25rem;right:0.25rem;-webkit-transform:rotate(45deg);transform:rotate(45deg)}:host([type=color]) input{padding:0.25rem}:host([type=file]) input{background-color:var(--calcite-ui-foreground-1);cursor:pointer;border-width:1px;border-style:dashed;border-color:var(--calcite-ui-border-input);text-align:center}:host([type=file][scale=s]) input{padding-top:1px;padding-bottom:1px;padding-left:0.5rem;padding-right:0.5rem}:host([type=file][scale=m]) input{padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}:host([type=file][scale=l]) input{padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem}:host(.no-bottom-border) input{border-bottom-width:0}:host(.border-t-color-1) input{border-top-color:var(--calcite-ui-border-1)}:host .inline-child{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;background-color:transparent}:host .inline-child .editing-enabled{background-color:inherit}:host .inline-child:not(.editing-enabled){display:-ms-flexbox;display:flex;cursor:pointer;border-color:transparent;-webkit-padding-start:0;padding-inline-start:0}::slotted(input[slot=hidden-form-input]){bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
|
|
45
45
|
|
|
46
46
|
let CalciteInput = class extends HTMLElement {
|
|
47
47
|
constructor() {
|
|
@@ -233,12 +233,13 @@ let CalciteInput = class extends HTMLElement {
|
|
|
233
233
|
const inputMin = this.minString ? parseFloat(this.minString) : null;
|
|
234
234
|
const valueNudgeDelayInMs = 100;
|
|
235
235
|
this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
|
|
236
|
-
let
|
|
236
|
+
let firstValueNudge = true;
|
|
237
237
|
this.nudgeNumberValueIntervalId = setInterval(() => {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
if (firstValueNudge) {
|
|
239
|
+
firstValueNudge = false;
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
|
|
242
243
|
}, valueNudgeDelayInMs);
|
|
243
244
|
};
|
|
244
245
|
this.numberButtonMouseUpAndMouseOutHandler = () => {
|
|
@@ -383,17 +384,18 @@ let CalciteInput = class extends HTMLElement {
|
|
|
383
384
|
this.setFocus();
|
|
384
385
|
}
|
|
385
386
|
incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent) {
|
|
386
|
-
const value = this
|
|
387
|
+
const { value } = this;
|
|
387
388
|
const inputStep = this.step === "any" ? 1 : Math.abs(this.step || 1);
|
|
388
389
|
const inputVal = value && value !== "" ? parseFloat(value) : 0;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
390
|
+
const adjustment = direction === "up" ? 1 : -1;
|
|
391
|
+
const nudgedValue = inputVal + inputStep * adjustment;
|
|
392
|
+
const finalValue = (typeof inputMin === "number" && !isNaN(inputMin) && nudgedValue < inputMin) ||
|
|
393
|
+
(typeof inputMax === "number" && !isNaN(inputMax) && nudgedValue > inputMax)
|
|
394
|
+
? inputVal
|
|
395
|
+
: nudgedValue;
|
|
396
|
+
const inputValPlaces = decimalPlaces(inputVal);
|
|
397
|
+
const inputStepPlaces = decimalPlaces(inputStep);
|
|
398
|
+
this.setValue(finalValue.toFixed(Math.max(inputValPlaces, inputStepPlaces)), nativeEvent, true);
|
|
397
399
|
}
|
|
398
400
|
onFormReset() {
|
|
399
401
|
this.setValue(this.defaultValue);
|
|
@@ -449,7 +451,7 @@ let CalciteInput = class extends HTMLElement {
|
|
|
449
451
|
const numberButtonsVertical = (h("div", { class: CSS.numberButtonWrapper }, numberButtonsHorizontalUp, numberButtonsHorizontalDown));
|
|
450
452
|
const prefixText = h("div", { class: CSS.prefix }, this.prefixText);
|
|
451
453
|
const suffixText = h("div", { class: CSS.suffix }, this.suffixText);
|
|
452
|
-
const localeNumberInput = this.type === "number" ? (h("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, key: "localized-input", maxLength: this.maxLength, minLength: this.minLength, name: undefined, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef,
|
|
454
|
+
const localeNumberInput = this.type === "number" ? (h("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, key: "localized-input", maxLength: this.maxLength, minLength: this.minLength, name: undefined, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef, type: "text", value: this.localizedValue })) : null;
|
|
453
455
|
const childEl = this.type !== "number"
|
|
454
456
|
? [
|
|
455
457
|
h(this.childElType, { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, class: {
|
|
@@ -459,11 +461,11 @@ let CalciteInput = class extends HTMLElement {
|
|
|
459
461
|
this.isTextarea ? (h("div", { class: CSS.resizeIconWrapper }, h("calcite-icon", { icon: "chevron-down", scale: "s" }))) : null
|
|
460
462
|
]
|
|
461
463
|
: null;
|
|
462
|
-
return (h(Host, { onClick: this.inputFocusHandler, onKeyDown: this.keyDownHandler }, h("div", { class: { [CSS.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" }, dir: dir }, this.type === "number" && this.numberButtonType === "horizontal"
|
|
464
|
+
return (h(Host, { onClick: this.inputFocusHandler, onKeyDown: this.keyDownHandler }, h("div", { class: { [CSS.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" }, dir: dir }, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
|
|
463
465
|
? numberButtonsHorizontalDown
|
|
464
|
-
: null, this.prefixText ? prefixText : null, h("div", { class: CSS.wrapper }, localeNumberInput, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), h("div", { class: CSS.actionWrapper }, h("slot", { name: SLOTS.action })), this.type === "number" && this.numberButtonType === "vertical"
|
|
466
|
+
: null, this.prefixText ? prefixText : null, h("div", { class: CSS.wrapper }, localeNumberInput, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), h("div", { class: CSS.actionWrapper }, h("slot", { name: SLOTS.action })), this.type === "number" && this.numberButtonType === "vertical" && !this.readOnly
|
|
465
467
|
? numberButtonsVertical
|
|
466
|
-
: null, this.suffixText ? suffixText : null, this.type === "number" && this.numberButtonType === "horizontal"
|
|
468
|
+
: null, this.suffixText ? suffixText : null, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
|
|
467
469
|
? numberButtonsHorizontalUp
|
|
468
470
|
: null, h(HiddenFormInputSlot, { component: this }))));
|
|
469
471
|
}
|