@esri/solutions-components 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/buffer-tools_6.cjs.entry.js +8 -5
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +2 -2
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +6 -4
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/{csvUtils-83af7ae1.js → csvUtils-34666909.js} +1 -1
- package/dist/cjs/{interfaces-772edf61.js → interfaces-17c631bf.js} +1 -1
- package/dist/cjs/layer-table.cjs.entry.js +3 -3
- package/dist/cjs/map-card.cjs.entry.js +1 -1
- package/dist/cjs/{mapViewUtils-55ac76cb.js → mapViewUtils-24d1d859.js} +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +16 -10
- package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
- package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
- package/dist/cjs/{solution-store-39726b81.js → solution-store-2dbab624.js} +1 -1
- package/dist/collection/components/buffer-tools/buffer-tools.js +2 -2
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +2 -1
- package/dist/collection/components/public-notification/public-notification.js +14 -8
- package/dist/collection/components/refine-selection/refine-selection.js +4 -2
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.css +1 -0
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +3 -1
- package/dist/collection/demos/new-public-notification.html +2 -1
- package/dist/collection/utils/interfaces.js +1 -1
- package/dist/collection/utils/interfaces.ts +2 -2
- package/dist/components/interfaces3.js +1 -1
- package/dist/components/map-draw-tools2.js +2 -1
- package/dist/components/public-notification.js +14 -8
- package/dist/components/refine-selection-tools2.js +4 -2
- package/dist/components/refine-selection2.js +4 -2
- package/dist/esm/buffer-tools_6.entry.js +8 -5
- package/dist/esm/calcite-combobox_3.entry.js +2 -2
- package/dist/esm/calcite-input-message_5.entry.js +6 -4
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/{csvUtils-eb231cfb.js → csvUtils-ae3004b9.js} +1 -1
- package/dist/esm/{interfaces-3b23a5f9.js → interfaces-d0d83efa.js} +1 -1
- package/dist/esm/layer-table.entry.js +3 -3
- package/dist/esm/map-card.entry.js +1 -1
- package/dist/esm/{mapViewUtils-e5d8a1e1.js → mapViewUtils-541e7a3c.js} +1 -1
- package/dist/esm/public-notification.entry.js +16 -10
- package/dist/esm/solution-configuration.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-c0bf9200.js → solution-store-41e15f1c.js} +1 -1
- package/dist/solutions-components/demos/new-public-notification.html +2 -1
- package/dist/solutions-components/p-05e64bd1.js +498 -2
- package/dist/solutions-components/p-08a95b33.entry.js +138 -0
- package/dist/solutions-components/p-0da5bbdf.entry.js +91 -0
- package/dist/solutions-components/p-0ef91144.entry.js +913 -0
- package/dist/solutions-components/p-0f523243.entry.js +1916 -0
- package/dist/solutions-components/p-11b9510e.entry.js +173 -0
- package/dist/solutions-components/p-1b875d94.entry.js +58 -0
- package/dist/solutions-components/p-1c567f3a.js +23 -16
- package/dist/solutions-components/p-1c883db9.entry.js +43 -0
- package/dist/solutions-components/p-1f225056.js +322 -0
- package/dist/solutions-components/p-1f499e67.entry.js +72 -0
- package/dist/solutions-components/p-20d3d758.entry.js +881 -0
- package/dist/solutions-components/p-2274ac9e.entry.js +160 -0
- package/dist/solutions-components/p-23ec5ac5.entry.js +93 -0
- package/dist/solutions-components/p-2447798c.entry.js +155 -0
- package/dist/solutions-components/p-2525e691.entry.js +432 -0
- package/dist/solutions-components/p-2561f5b5.js +4092 -0
- package/dist/solutions-components/p-29f887c0.entry.js +234 -0
- package/dist/solutions-components/p-2a0d8047.entry.js +345 -0
- package/dist/solutions-components/p-2c177e6a.entry.js +101 -0
- package/dist/solutions-components/p-2e9ed892.js +46 -1
- package/dist/solutions-components/p-316f56db.js +219 -2
- package/dist/solutions-components/p-327f3ebf.entry.js +98 -0
- package/dist/solutions-components/p-356f8b54.entry.js +138 -0
- package/dist/solutions-components/p-359c58de.entry.js +172 -0
- package/dist/solutions-components/p-37336c0d.entry.js +116 -0
- package/dist/solutions-components/p-374a5031.js +105 -2
- package/dist/solutions-components/p-39ea6ef4.entry.js +71 -0
- package/dist/solutions-components/p-3b010ce1.js +17 -1
- package/dist/solutions-components/p-4307dacd.js +194 -1
- package/dist/solutions-components/p-44da2507.js +405 -14
- package/dist/solutions-components/p-46bdffe8.entry.js +54 -0
- package/dist/solutions-components/p-4894bbeb.js +53 -2
- package/dist/solutions-components/p-4cd569f1.entry.js +1298 -0
- package/dist/solutions-components/p-4d4160f9.entry.js +121 -0
- package/dist/solutions-components/p-4e32bf8c.js +482 -1
- package/dist/solutions-components/p-4e9cbd32.entry.js +184 -0
- package/dist/solutions-components/p-508317b3.js +13 -2
- package/dist/solutions-components/p-54697d58.entry.js +198 -0
- package/dist/solutions-components/p-55c79103.entry.js +311 -0
- package/dist/solutions-components/p-57fd19c0.entry.js +706 -0
- package/dist/solutions-components/p-59b48fde.entry.js +443 -0
- package/dist/solutions-components/p-60e0e6a0.entry.js +214 -0
- package/dist/solutions-components/p-621d0534.entry.js +123 -0
- package/dist/solutions-components/p-63f6e8f1.js +14 -1
- package/dist/solutions-components/p-66aeec57.entry.js +61 -0
- package/dist/solutions-components/p-69834f46.entry.js +618 -0
- package/dist/solutions-components/p-6d9da8e5.entry.js +21530 -0
- package/dist/solutions-components/p-6e0da576.js +13 -1
- package/dist/solutions-components/p-6ec3f294.entry.js +106 -0
- package/dist/solutions-components/p-6fe17794.js +9 -1
- package/dist/solutions-components/p-7024cb16.entry.js +72 -0
- package/dist/solutions-components/p-70535506.entry.js +226 -0
- package/dist/solutions-components/p-708a63a8.js +12 -1
- package/dist/solutions-components/p-729708a3.js +14 -1
- package/dist/solutions-components/p-73e23995.js +6 -1
- package/dist/solutions-components/p-74b29d75.entry.js +231 -0
- package/dist/solutions-components/p-74b7ee25.entry.js +711 -0
- package/dist/solutions-components/p-77182c3a.js +3015 -1
- package/dist/solutions-components/p-78b3ef80.entry.js +456 -0
- package/dist/solutions-components/p-79709c19.js +60 -3
- package/dist/solutions-components/p-7a46ef97.js +181 -2
- package/dist/solutions-components/p-7be159e6.entry.js +175 -0
- package/dist/solutions-components/p-7d4451c2.entry.js +71 -0
- package/dist/solutions-components/p-7daea1df.js +41 -1
- package/dist/solutions-components/p-7e39e5ad.entry.js +102 -0
- package/dist/solutions-components/p-7fb45059.entry.js +43 -0
- package/dist/solutions-components/p-815533de.js +306 -3
- package/dist/solutions-components/p-816622ca.entry.js +248 -0
- package/dist/solutions-components/p-83166522.js +205 -2
- package/dist/solutions-components/p-83bd1991.entry.js +36 -0
- package/dist/solutions-components/p-856464d7.entry.js +572 -0
- package/dist/solutions-components/p-8c349bad.entry.js +347 -0
- package/dist/solutions-components/p-8dccb390.entry.js +1986 -0
- package/dist/solutions-components/p-904c185a.entry.js +228 -0
- package/dist/solutions-components/p-9092f8b3.entry.js +156 -0
- package/dist/solutions-components/p-9371145a.entry.js +477 -0
- package/dist/solutions-components/p-93d3119d.js +1948 -1
- package/dist/solutions-components/p-95ec8062.entry.js +173 -0
- package/dist/solutions-components/p-991ee695.js +109 -1
- package/dist/solutions-components/p-9a57dab7.entry.js +213 -0
- package/dist/solutions-components/p-9a9955db.js +41 -1
- package/dist/solutions-components/p-9c1ebc90.js +35 -16
- package/dist/solutions-components/p-9eba5c66.js +399 -3
- package/dist/solutions-components/p-a033a507.entry.js +252 -0
- package/dist/solutions-components/p-a3773415.entry.js +1132 -0
- package/dist/solutions-components/p-a44fe40f.entry.js +94 -0
- package/dist/solutions-components/p-a5b1ab03.js +33 -3
- package/dist/solutions-components/p-a5b2c13d.entry.js +723 -0
- package/dist/solutions-components/p-a6d729b7.entry.js +85 -0
- package/dist/solutions-components/p-a8005026.entry.js +565 -0
- package/dist/solutions-components/p-a80b3880.js +14 -1
- package/dist/solutions-components/p-a89198a3.entry.js +2620 -0
- package/dist/solutions-components/p-aa04bd1f.entry.js +95 -0
- package/dist/solutions-components/p-aa0a0922.entry.js +80 -0
- package/dist/solutions-components/p-ae1fd76b.js +11 -1
- package/dist/solutions-components/p-b2cf435e.entry.js +87 -0
- package/dist/solutions-components/p-b359dc78.js +41 -1
- package/dist/solutions-components/p-b57bc4eb.entry.js +71 -0
- package/dist/solutions-components/p-b75cc407.entry.js +145 -0
- package/dist/solutions-components/p-b911cb75.entry.js +71 -0
- package/dist/solutions-components/p-b965e177.entry.js +335 -0
- package/dist/solutions-components/p-b978636e.js +14 -1
- package/dist/solutions-components/p-ba10a5c8.entry.js +42 -0
- package/dist/solutions-components/p-bd67334c.js +122 -2
- package/dist/solutions-components/p-bde20dba.entry.js +212 -0
- package/dist/solutions-components/p-be0b5a94.entry.js +248 -0
- package/dist/solutions-components/p-c023e6a1.js +2028 -2
- package/dist/solutions-components/p-c27b0c2d.entry.js +150 -0
- package/dist/solutions-components/p-c579ed60.entry.js +447 -0
- package/dist/solutions-components/p-c92bc231.js +101 -2
- package/dist/solutions-components/p-cc815aca.js +839 -16
- package/dist/solutions-components/p-cc8beabb.entry.js +695 -0
- package/dist/solutions-components/p-cdc46c0c.js +1751 -2
- package/dist/solutions-components/p-d12e6992.entry.js +118 -0
- package/dist/solutions-components/p-d1dfed6b.entry.js +179 -0
- package/dist/solutions-components/p-d48a24e6.js +754 -2
- package/dist/solutions-components/p-d96ee3ef.entry.js +579 -0
- package/dist/solutions-components/p-dbc9a5a8.js +80 -0
- package/dist/solutions-components/p-dcdbe712.entry.js +278 -0
- package/dist/solutions-components/p-de39206f.entry.js +113 -0
- package/dist/solutions-components/p-de5416e8.js +28 -1
- package/dist/solutions-components/p-df420d54.entry.js +213 -0
- package/dist/solutions-components/p-e3138cf0.entry.js +20 -0
- package/dist/solutions-components/p-e4845fec.entry.js +152 -0
- package/dist/solutions-components/p-e611d8c8.js +28 -1
- package/dist/solutions-components/p-e947d3b0.js +5 -1
- package/dist/solutions-components/p-ea534300.js +41 -2
- package/dist/solutions-components/p-ec84ee85.entry.js +55 -0
- package/dist/solutions-components/p-ed36c637.entry.js +85 -0
- package/dist/solutions-components/p-f0add71c.js +74 -0
- package/dist/solutions-components/p-f42e014b.js +171 -2
- package/dist/solutions-components/p-fc02e7de.entry.js +308 -0
- package/dist/solutions-components/p-fc884dd6.js +28 -16
- package/dist/solutions-components/p-fcbfa59c.entry.js +181 -0
- package/dist/solutions-components/p-fdc5cf5f.entry.js +138 -0
- package/dist/solutions-components/solutions-components.esm.js +20 -1
- package/dist/solutions-components/utils/interfaces.ts +2 -2
- package/dist/types/components/buffer-tools/buffer-tools.d.ts +2 -2
- package/dist/types/components/public-notification/public-notification.d.ts +9 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/solutions-components/p-021432b8.entry.js +0 -12
- package/dist/solutions-components/p-03440b1e.entry.js +0 -11
- package/dist/solutions-components/p-0512635b.entry.js +0 -6
- package/dist/solutions-components/p-086ef115.entry.js +0 -29
- package/dist/solutions-components/p-0b4bf57f.entry.js +0 -6
- package/dist/solutions-components/p-0c088725.entry.js +0 -6
- package/dist/solutions-components/p-0f820c08.entry.js +0 -6
- package/dist/solutions-components/p-164780a0.entry.js +0 -6
- package/dist/solutions-components/p-179a68a0.entry.js +0 -6
- package/dist/solutions-components/p-184b5005.entry.js +0 -11
- package/dist/solutions-components/p-1d082fee.entry.js +0 -11
- package/dist/solutions-components/p-1e6c02a2.entry.js +0 -11
- package/dist/solutions-components/p-20a58e62.entry.js +0 -17
- package/dist/solutions-components/p-20b2458c.entry.js +0 -11
- package/dist/solutions-components/p-245d47c1.entry.js +0 -6
- package/dist/solutions-components/p-2cb057a9.entry.js +0 -11
- package/dist/solutions-components/p-2cc72806.entry.js +0 -23
- package/dist/solutions-components/p-2de1db9c.entry.js +0 -11
- package/dist/solutions-components/p-2e9c7055.entry.js +0 -11
- package/dist/solutions-components/p-2ed5e6c8.entry.js +0 -11
- package/dist/solutions-components/p-3109d940.entry.js +0 -6
- package/dist/solutions-components/p-31a8bcfa.entry.js +0 -6
- package/dist/solutions-components/p-3649acb3.entry.js +0 -18
- package/dist/solutions-components/p-3f88ba73.entry.js +0 -6
- package/dist/solutions-components/p-3fa9b3c8.js +0 -36
- package/dist/solutions-components/p-40c41709.entry.js +0 -6
- package/dist/solutions-components/p-40e963c7.entry.js +0 -11
- package/dist/solutions-components/p-40f480da.entry.js +0 -11
- package/dist/solutions-components/p-49d5d2d3.entry.js +0 -11
- package/dist/solutions-components/p-4f7049a4.entry.js +0 -11
- package/dist/solutions-components/p-506e4d78.entry.js +0 -6
- package/dist/solutions-components/p-576fdcab.entry.js +0 -6
- package/dist/solutions-components/p-5bd0cf34.entry.js +0 -23
- package/dist/solutions-components/p-65e177f1.entry.js +0 -6
- package/dist/solutions-components/p-67d710c2.entry.js +0 -6
- package/dist/solutions-components/p-7268b445.entry.js +0 -11
- package/dist/solutions-components/p-75ea4667.entry.js +0 -6
- package/dist/solutions-components/p-778c0a36.entry.js +0 -17
- package/dist/solutions-components/p-7a22509b.entry.js +0 -12
- package/dist/solutions-components/p-7bff51db.entry.js +0 -6
- package/dist/solutions-components/p-7d2d0d5d.entry.js +0 -6
- package/dist/solutions-components/p-7f0036f1.entry.js +0 -11
- package/dist/solutions-components/p-8060fb94.entry.js +0 -6
- package/dist/solutions-components/p-80a1b305.entry.js +0 -6
- package/dist/solutions-components/p-81eae877.entry.js +0 -12
- package/dist/solutions-components/p-84e86b8b.entry.js +0 -6
- package/dist/solutions-components/p-851e04ae.entry.js +0 -6
- package/dist/solutions-components/p-9106950a.entry.js +0 -11
- package/dist/solutions-components/p-979804a4.entry.js +0 -11
- package/dist/solutions-components/p-9862baa8.entry.js +0 -11
- package/dist/solutions-components/p-9b5a9117.entry.js +0 -12
- package/dist/solutions-components/p-9deff0c2.entry.js +0 -6
- package/dist/solutions-components/p-9f400eeb.entry.js +0 -6
- package/dist/solutions-components/p-a0639ad1.entry.js +0 -11
- package/dist/solutions-components/p-a33c044e.entry.js +0 -6
- package/dist/solutions-components/p-a516c658.entry.js +0 -6
- package/dist/solutions-components/p-aa0ef36d.entry.js +0 -11
- package/dist/solutions-components/p-aaccbdf3.entry.js +0 -18
- package/dist/solutions-components/p-ab03a5c9.entry.js +0 -11
- package/dist/solutions-components/p-ad469b92.entry.js +0 -11
- package/dist/solutions-components/p-adc86ac3.entry.js +0 -6
- package/dist/solutions-components/p-addc1156.entry.js +0 -11
- package/dist/solutions-components/p-ae846934.entry.js +0 -11
- package/dist/solutions-components/p-b0572fc4.entry.js +0 -37
- package/dist/solutions-components/p-b4e476b7.js +0 -257
- package/dist/solutions-components/p-b668daf8.js +0 -21
- package/dist/solutions-components/p-b6e6eae1.entry.js +0 -6
- package/dist/solutions-components/p-bc317a7f.entry.js +0 -6
- package/dist/solutions-components/p-be41429f.js +0 -21
- package/dist/solutions-components/p-bf6b6353.entry.js +0 -11
- package/dist/solutions-components/p-c2e3dfbb.entry.js +0 -11
- package/dist/solutions-components/p-c4afae53.entry.js +0 -12
- package/dist/solutions-components/p-c9da1c26.entry.js +0 -6
- package/dist/solutions-components/p-cbf8cd49.entry.js +0 -6
- package/dist/solutions-components/p-cc1a064a.entry.js +0 -11
- package/dist/solutions-components/p-d09a168c.entry.js +0 -6
- package/dist/solutions-components/p-d377f913.entry.js +0 -11
- package/dist/solutions-components/p-d4cefead.entry.js +0 -37
- package/dist/solutions-components/p-d7bc0baf.entry.js +0 -16
- package/dist/solutions-components/p-d8968487.entry.js +0 -11
- package/dist/solutions-components/p-e00a0b86.entry.js +0 -11
- package/dist/solutions-components/p-e9a7ed49.entry.js +0 -11
- package/dist/solutions-components/p-ec27e493.entry.js +0 -11
- package/dist/solutions-components/p-ed6404eb.entry.js +0 -6
- package/dist/solutions-components/p-ef21e195.entry.js +0 -23
- package/dist/solutions-components/p-f6068a2d.entry.js +0 -11
- package/dist/solutions-components/p-f6c4cff3.entry.js +0 -11
- package/dist/solutions-components/p-f847291f.entry.js +0 -6
- package/dist/solutions-components/p-f90fd262.entry.js +0 -11
- package/dist/solutions-components/p-fc973005.entry.js +0 -6
- package/dist/solutions-components/p-ff9fb6bc.entry.js +0 -11
@@ -0,0 +1,706 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './p-c023e6a1.js';
|
7
|
+
import { a as getSlotted, i as isPrimaryPointerButton, s as setRequestedIcon, g as getElementProp, b as getElementDir } from './p-83166522.js';
|
8
|
+
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from './p-bd67334c.js';
|
9
|
+
import { s as submitForm, c as connectForm, d as disconnectForm, H as HiddenFormInputSlot } from './p-316f56db.js';
|
10
|
+
import { n as numberStringFormatter, i as isValidNumber, p as parseNumberString, a as defaultNumberingSystem, s as sanitizeNumberString, u as updateEffectiveLocale, c as connectLocalized, d as disconnectLocalized } from './p-9eba5c66.js';
|
11
|
+
import { n as numberKeys } from './p-73e23995.js';
|
12
|
+
import { T as TEXT$1, C as CSS_UTILITY } from './p-729708a3.js';
|
13
|
+
import { d as decimalPlaces } from './p-63f6e8f1.js';
|
14
|
+
import { c as createObserver } from './p-9a9955db.js';
|
15
|
+
import { u as updateHostInteraction } from './p-7daea1df.js';
|
16
|
+
import './p-a80b3880.js';
|
17
|
+
|
18
|
+
/*!
|
19
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
20
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
21
|
+
* v1.0.0-beta.97
|
22
|
+
*/
|
23
|
+
const CSS = {
|
24
|
+
loader: "loader",
|
25
|
+
clearButton: "clear-button",
|
26
|
+
editingEnabled: "editing-enabled",
|
27
|
+
inlineChild: "inline-child",
|
28
|
+
inputIcon: "icon",
|
29
|
+
prefix: "prefix",
|
30
|
+
suffix: "suffix",
|
31
|
+
numberButtonWrapper: "number-button-wrapper",
|
32
|
+
buttonItemHorizontal: "number-button-item--horizontal",
|
33
|
+
wrapper: "element-wrapper",
|
34
|
+
inputWrapper: "wrapper",
|
35
|
+
actionWrapper: "action-wrapper",
|
36
|
+
resizeIconWrapper: "resize-icon-wrapper",
|
37
|
+
numberButtonItem: "number-button-item"
|
38
|
+
};
|
39
|
+
const INPUT_TYPE_ICONS = {
|
40
|
+
tel: "phone",
|
41
|
+
password: "lock",
|
42
|
+
email: "email-address",
|
43
|
+
date: "calendar",
|
44
|
+
time: "clock",
|
45
|
+
search: "search"
|
46
|
+
};
|
47
|
+
const SLOTS = {
|
48
|
+
action: "action"
|
49
|
+
};
|
50
|
+
const TEXT = {
|
51
|
+
clear: "Clear value"
|
52
|
+
};
|
53
|
+
|
54
|
+
const inputCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:block}:host([scale=s]) input,:host([scale=s]) .prefix,:host([scale=s]) .suffix{block-size:1.5rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=s]) textarea{block-size:1.5rem;min-block-size:1.5rem}:host([scale=s]) .number-button-wrapper,:host([scale=s]) .action-wrapper calcite-button,:host([scale=s]) .action-wrapper calcite-button button{block-size:1.5rem}:host([scale=s]) input[type=file]{block-size:1.5rem}:host([scale=s]) .clear-button{min-block-size:1.5rem;min-inline-size:1.5rem}:host([scale=s]) textarea{block-size:auto;padding-block:0.25rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=m]) input,:host([scale=m]) .prefix,:host([scale=m]) .suffix{block-size:2rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=m]) textarea{min-block-size:2rem}:host([scale=m]) .number-button-wrapper,:host([scale=m]) .action-wrapper calcite-button,:host([scale=m]) .action-wrapper calcite-button button{block-size:2rem}:host([scale=m]) input[type=file]{block-size:2rem}:host([scale=m]) .clear-button{min-block-size:2rem;min-inline-size:2rem}:host([scale=m]) textarea{block-size:auto;padding-block:0.5rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=l]) input,:host([scale=l]) .prefix,:host([scale=l]) .suffix{block-size:2.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([scale=l]) textarea{min-block-size:2.75rem}:host([scale=l]) .number-button-wrapper,:host([scale=l]) .action-wrapper calcite-button,:host([scale=l]) .action-wrapper calcite-button button{block-size:2.75rem}:host([scale=l]) input[type=file]{block-size:2.75rem}:host([scale=l]) .clear-button{min-block-size:2.75rem;min-inline-size:2.75rem}:host([scale=l]) textarea{block-size:auto;padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([disabled]) textarea{resize:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host textarea,:host input{transition:var(--calcite-animation-timing), block-size 0, outline-offset 0s;-webkit-appearance:none;position:relative;margin:0px;box-sizing:border-box;display:flex;max-block-size:100%;inline-size:100%;max-inline-size:100%;flex:1 1 0%;border-radius:0px;background-color:var(--calcite-ui-foreground-1);font-family:inherit;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1)}:host input[type=search]::-webkit-search-decoration{-webkit-appearance:none}:host input,:host textarea{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);color:var(--calcite-ui-text-1)}: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{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}: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-color:transparent}: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{inset-inline-start:0.5rem}:host([scale=m]) .icon{inset-inline-start:0.75rem}:host([scale=l]) .icon{inset-inline-start:1rem}:host([icon][scale=s]) input{-webkit-padding-start:2rem;padding-inline-start:2rem}:host([icon][scale=m]) input{-webkit-padding-start:2.5rem;padding-inline-start:2.5rem}:host([icon][scale=l]) input{-webkit-padding-start:3rem;padding-inline-start:3rem}.element-wrapper{position:relative;order:3;display:inline-flex;flex:1 1 0%;align-items:center}.icon{pointer-events:none;position:absolute;display:block;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.icon,.resize-icon-wrapper{z-index:1}input[type=text]::-ms-clear,input[type=text]::-ms-reveal{display:none;block-size:0px;inline-size:0px}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;order:4;margin:0px;box-sizing:border-box;display:flex;min-block-size:100%;cursor:pointer;align-items:center;justify-content:center;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-color:transparent;border-inline-start-width:0px}.clear-button:hover{background-color:var(--calcite-ui-foreground-2);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.clear-button:hover calcite-icon{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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)}.loader{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}.action-wrapper{order:7;display:flex}.prefix,.suffix{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-content:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}.prefix{order:2;border-inline-end-width:0px}.suffix{order:5;border-inline-start-width:0px}:host([alignment=start]) textarea,:host([alignment=start]) input{text-align:start}:host([alignment=end]) textarea,:host([alignment=end]) input{text-align:end}: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:0px}.number-button-wrapper{pointer-events:none;order:6;box-sizing:border-box;display:flex;flex-direction:column;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host([number-button-type=vertical]) .wrapper{flex-direction:row;display:flex}:host([number-button-type=vertical]) input,:host([number-button-type=vertical]) textarea{order:2}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon{transform:rotate(-90deg)}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon{transform:rotate(-90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down],.number-button-item.number-button-item--horizontal[data-adjustment=up]{order:1;max-block-size:100%;min-block-size:100%;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{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-inline-end-width:0px}.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]{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)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]{border-block-start-width:0px}.number-button-item{max-block-size:50%;min-block-size:50%;pointer-events:initial;margin:0px;box-sizing:border-box;display:flex;cursor:pointer;align-items:center;align-self:center;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);padding-block:0px;padding-inline:0.5rem;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline-start-width:0px}.number-button-item calcite-icon{pointer-events:none;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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)}.number-button-item:disabled{pointer-events:none}.wrapper{position:relative;display:flex;flex-direction:row;align-items:center}:host input::-webkit-calendar-picker-indicator{display:none}:host input[type=date]::-webkit-input-placeholder{visibility:hidden !important}:host textarea::-webkit-resizer{position:absolute;inset-block-end:0px;box-sizing:border-box;padding-block:0px;padding-inline:0.25rem;inset-inline-end:0}.resize-icon-wrapper{inset-block-end:2px;inset-inline-end:2px;pointer-events:none;position:absolute;block-size:0.75rem;inline-size:0.75rem;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3)}.resize-icon-wrapper calcite-icon{inset-block-end:0.25rem;inset-inline-end:0.25rem;transform:rotate(-45deg)}.calcite--rtl .resize-icon-wrapper calcite-icon{transform:rotate(45deg)}:host([type=color]) input{padding:0.25rem}:host([type=file]) input{cursor:pointer;border-width:1px;border-style:dashed;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);text-align:center}:host([type=file][scale=s]) input{padding-block:1px;padding-inline:0.5rem}:host([type=file][scale=m]) input{padding-block:0.25rem;padding-inline:0.75rem}:host([type=file][scale=l]) input{padding-block:0.5rem;padding-inline:1rem}:host(.no-bottom-border) input{border-block-end-width:0px}:host(.border-top-color-one) input{border-block-start-color:var(--calcite-ui-border-1)}:host .inline-child{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host .inline-child .editing-enabled{background-color:inherit}:host .inline-child:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;-webkit-padding-start:0;padding-inline-start:0}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
|
55
|
+
|
56
|
+
const Input = class {
|
57
|
+
constructor(hostRef) {
|
58
|
+
registerInstance(this, hostRef);
|
59
|
+
this.calciteInternalInputFocus = createEvent(this, "calciteInternalInputFocus", 6);
|
60
|
+
this.calciteInternalInputBlur = createEvent(this, "calciteInternalInputBlur", 6);
|
61
|
+
this.calciteInputInput = createEvent(this, "calciteInputInput", 7);
|
62
|
+
this.calciteInputChange = createEvent(this, "calciteInputChange", 6);
|
63
|
+
//--------------------------------------------------------------------------
|
64
|
+
//
|
65
|
+
// Properties
|
66
|
+
//
|
67
|
+
//--------------------------------------------------------------------------
|
68
|
+
/** Specifies the text alignment of the component's value. */
|
69
|
+
this.alignment = "start";
|
70
|
+
/**
|
71
|
+
* When `true`, the component is focused on page load.
|
72
|
+
*
|
73
|
+
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
74
|
+
*/
|
75
|
+
this.autofocus = false;
|
76
|
+
/**
|
77
|
+
* When `true`, a clear button is displayed when the component has a value. The clear button shows by default for `"search"`, `"time"`, and `"date"` types, and will not display for the `"textarea"` type.
|
78
|
+
*/
|
79
|
+
this.clearable = false;
|
80
|
+
/**
|
81
|
+
* When `true`, interaction is prevented and the component is displayed with lower opacity.
|
82
|
+
*
|
83
|
+
* @mdn [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled)
|
84
|
+
*/
|
85
|
+
this.disabled = false;
|
86
|
+
/**
|
87
|
+
* When `true`, number values are displayed with a group separator corresponding to the language and country format.
|
88
|
+
*/
|
89
|
+
this.groupSeparator = false;
|
90
|
+
/**
|
91
|
+
* When `true`, the component will not be visible.
|
92
|
+
*
|
93
|
+
* @mdn [hidden](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden)
|
94
|
+
*/
|
95
|
+
this.hidden = false;
|
96
|
+
/**
|
97
|
+
* Accessible name when the component is loading.
|
98
|
+
*
|
99
|
+
* @default "Loading"
|
100
|
+
*/
|
101
|
+
this.intlLoading = TEXT$1.loading;
|
102
|
+
/** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
|
103
|
+
this.iconFlipRtl = false;
|
104
|
+
/** When `true`, a busy indicator is displayed. */
|
105
|
+
this.loading = false;
|
106
|
+
/**
|
107
|
+
* When `true`, uses locale formatting for numbers.
|
108
|
+
*
|
109
|
+
* @internal
|
110
|
+
*/
|
111
|
+
this.localeFormat = false;
|
112
|
+
/** Specifies the placement of the buttons for `type="number"`. */
|
113
|
+
this.numberButtonType = "vertical";
|
114
|
+
/**
|
115
|
+
* When `true`, the component's value can be read, but cannot be modified.
|
116
|
+
*
|
117
|
+
* @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
|
118
|
+
*/
|
119
|
+
this.readOnly = false;
|
120
|
+
/** When `true`, the component must have a value in order for the form to submit. */
|
121
|
+
this.required = false;
|
122
|
+
/** Specifies the size of the component. */
|
123
|
+
this.scale = "m";
|
124
|
+
/** Specifies the status of the input field, which determines message and icons. */
|
125
|
+
this.status = "idle";
|
126
|
+
/**
|
127
|
+
* @internal
|
128
|
+
*/
|
129
|
+
this.editingEnabled = false;
|
130
|
+
/**
|
131
|
+
* Specifies the component type.
|
132
|
+
*
|
133
|
+
* Note that the following `type`s add type-specific icons by default: `"date"`, `"email"`, `"password"`, `"search"`, `"tel"`, `"time"`.
|
134
|
+
*/
|
135
|
+
this.type = "text";
|
136
|
+
/** The component's value. */
|
137
|
+
this.value = "";
|
138
|
+
/** keep track of the rendered child type */
|
139
|
+
this.childElType = "input";
|
140
|
+
this.previousValueOrigin = "initial";
|
141
|
+
this.mutationObserver = createObserver("mutation", () => this.setDisabledAction());
|
142
|
+
this.userChangedValue = false;
|
143
|
+
//--------------------------------------------------------------------------
|
144
|
+
//
|
145
|
+
// State
|
146
|
+
//
|
147
|
+
//--------------------------------------------------------------------------
|
148
|
+
this.effectiveLocale = "";
|
149
|
+
//--------------------------------------------------------------------------
|
150
|
+
//
|
151
|
+
// Private Methods
|
152
|
+
//
|
153
|
+
//--------------------------------------------------------------------------
|
154
|
+
this.keyDownHandler = (event) => {
|
155
|
+
if (this.readOnly || this.disabled) {
|
156
|
+
return;
|
157
|
+
}
|
158
|
+
if (this.isClearable && event.key === "Escape") {
|
159
|
+
this.clearInputValue(event);
|
160
|
+
event.preventDefault();
|
161
|
+
}
|
162
|
+
if (event.key === "Enter" && !event.defaultPrevented) {
|
163
|
+
if (submitForm(this)) {
|
164
|
+
event.preventDefault();
|
165
|
+
}
|
166
|
+
}
|
167
|
+
};
|
168
|
+
this.clearInputValue = (nativeEvent) => {
|
169
|
+
this.setValue({
|
170
|
+
committing: true,
|
171
|
+
nativeEvent,
|
172
|
+
origin: "user",
|
173
|
+
value: ""
|
174
|
+
});
|
175
|
+
};
|
176
|
+
this.emitChangeIfUserModified = () => {
|
177
|
+
if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
|
178
|
+
this.calciteInputChange.emit();
|
179
|
+
}
|
180
|
+
this.previousEmittedValue = this.value;
|
181
|
+
};
|
182
|
+
this.inputBlurHandler = () => {
|
183
|
+
this.calciteInternalInputBlur.emit();
|
184
|
+
this.emitChangeIfUserModified();
|
185
|
+
};
|
186
|
+
this.inputFocusHandler = (event) => {
|
187
|
+
const slottedActionEl = getSlotted(this.el, "action");
|
188
|
+
if (event.target !== slottedActionEl) {
|
189
|
+
this.setFocus();
|
190
|
+
}
|
191
|
+
this.calciteInternalInputFocus.emit();
|
192
|
+
};
|
193
|
+
this.inputInputHandler = (nativeEvent) => {
|
194
|
+
if (this.disabled || this.readOnly) {
|
195
|
+
return;
|
196
|
+
}
|
197
|
+
this.setValue({
|
198
|
+
nativeEvent,
|
199
|
+
origin: "user",
|
200
|
+
value: nativeEvent.target.value
|
201
|
+
});
|
202
|
+
};
|
203
|
+
this.inputKeyDownHandler = (event) => {
|
204
|
+
if (this.disabled || this.readOnly) {
|
205
|
+
return;
|
206
|
+
}
|
207
|
+
if (event.key === "Enter") {
|
208
|
+
this.emitChangeIfUserModified();
|
209
|
+
}
|
210
|
+
};
|
211
|
+
this.inputNumberInputHandler = (nativeEvent) => {
|
212
|
+
if (this.disabled || this.readOnly) {
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
const value = nativeEvent.target.value;
|
216
|
+
numberStringFormatter.numberFormatOptions = {
|
217
|
+
locale: this.effectiveLocale,
|
218
|
+
numberingSystem: this.numberingSystem,
|
219
|
+
useGrouping: this.groupSeparator
|
220
|
+
};
|
221
|
+
const delocalizedValue = numberStringFormatter.delocalize(value);
|
222
|
+
if (nativeEvent.inputType === "insertFromPaste") {
|
223
|
+
if (!isValidNumber(delocalizedValue)) {
|
224
|
+
nativeEvent.preventDefault();
|
225
|
+
}
|
226
|
+
this.setValue({
|
227
|
+
nativeEvent,
|
228
|
+
origin: "user",
|
229
|
+
value: parseNumberString(delocalizedValue)
|
230
|
+
});
|
231
|
+
this.childNumberEl.value = this.localizedValue;
|
232
|
+
}
|
233
|
+
else {
|
234
|
+
this.setValue({
|
235
|
+
nativeEvent,
|
236
|
+
origin: "user",
|
237
|
+
value: delocalizedValue
|
238
|
+
});
|
239
|
+
}
|
240
|
+
};
|
241
|
+
this.inputNumberKeyDownHandler = (event) => {
|
242
|
+
if (this.type !== "number" || this.disabled || this.readOnly) {
|
243
|
+
return;
|
244
|
+
}
|
245
|
+
if (event.key === "ArrowUp") {
|
246
|
+
/* prevent default behavior of moving cursor to the beginning of the input when holding down ArrowUp */
|
247
|
+
event.preventDefault();
|
248
|
+
this.nudgeNumberValue("up", event);
|
249
|
+
return;
|
250
|
+
}
|
251
|
+
if (event.key === "ArrowDown") {
|
252
|
+
this.nudgeNumberValue("down", event);
|
253
|
+
return;
|
254
|
+
}
|
255
|
+
const supportedKeys = [
|
256
|
+
...numberKeys,
|
257
|
+
"ArrowLeft",
|
258
|
+
"ArrowRight",
|
259
|
+
"Backspace",
|
260
|
+
"Delete",
|
261
|
+
"Enter",
|
262
|
+
"Escape",
|
263
|
+
"Tab"
|
264
|
+
];
|
265
|
+
if (event.altKey || event.ctrlKey || event.metaKey) {
|
266
|
+
return;
|
267
|
+
}
|
268
|
+
const isShiftTabEvent = event.shiftKey && event.key === "Tab";
|
269
|
+
if (supportedKeys.includes(event.key) && (!event.shiftKey || isShiftTabEvent)) {
|
270
|
+
if (event.key === "Enter") {
|
271
|
+
this.emitChangeIfUserModified();
|
272
|
+
}
|
273
|
+
return;
|
274
|
+
}
|
275
|
+
numberStringFormatter.numberFormatOptions = {
|
276
|
+
locale: this.effectiveLocale,
|
277
|
+
numberingSystem: this.numberingSystem,
|
278
|
+
useGrouping: this.groupSeparator
|
279
|
+
};
|
280
|
+
if (event.key === numberStringFormatter.decimal) {
|
281
|
+
if (!this.value && !this.childNumberEl.value) {
|
282
|
+
return;
|
283
|
+
}
|
284
|
+
if (this.value && this.childNumberEl.value.indexOf(numberStringFormatter.decimal) === -1) {
|
285
|
+
return;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
if (/[eE]/.test(event.key)) {
|
289
|
+
if (!this.value && !this.childNumberEl.value) {
|
290
|
+
return;
|
291
|
+
}
|
292
|
+
if (this.value && !/[eE]/.test(this.childNumberEl.value)) {
|
293
|
+
return;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
if (event.key === "-") {
|
297
|
+
if (!this.value && !this.childNumberEl.value) {
|
298
|
+
return;
|
299
|
+
}
|
300
|
+
if (this.value && this.childNumberEl.value.split("-").length <= 2) {
|
301
|
+
return;
|
302
|
+
}
|
303
|
+
}
|
304
|
+
event.preventDefault();
|
305
|
+
};
|
306
|
+
this.nudgeNumberValue = (direction, nativeEvent) => {
|
307
|
+
if ((nativeEvent instanceof KeyboardEvent && nativeEvent.repeat) || this.type !== "number") {
|
308
|
+
return;
|
309
|
+
}
|
310
|
+
const inputMax = this.maxString ? parseFloat(this.maxString) : null;
|
311
|
+
const inputMin = this.minString ? parseFloat(this.minString) : null;
|
312
|
+
const valueNudgeDelayInMs = 100;
|
313
|
+
this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
|
314
|
+
if (this.nudgeNumberValueIntervalId) {
|
315
|
+
window.clearInterval(this.nudgeNumberValueIntervalId);
|
316
|
+
}
|
317
|
+
let firstValueNudge = true;
|
318
|
+
this.nudgeNumberValueIntervalId = window.setInterval(() => {
|
319
|
+
if (firstValueNudge) {
|
320
|
+
firstValueNudge = false;
|
321
|
+
return;
|
322
|
+
}
|
323
|
+
this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
|
324
|
+
}, valueNudgeDelayInMs);
|
325
|
+
};
|
326
|
+
this.numberButtonPointerUpAndOutHandler = () => {
|
327
|
+
window.clearInterval(this.nudgeNumberValueIntervalId);
|
328
|
+
};
|
329
|
+
this.numberButtonPointerDownHandler = (event) => {
|
330
|
+
if (!isPrimaryPointerButton(event)) {
|
331
|
+
return;
|
332
|
+
}
|
333
|
+
event.preventDefault();
|
334
|
+
const direction = event.target.dataset.adjustment;
|
335
|
+
if (!this.disabled) {
|
336
|
+
this.nudgeNumberValue(direction, event);
|
337
|
+
}
|
338
|
+
};
|
339
|
+
this.hiddenInputChangeHandler = (event) => {
|
340
|
+
if (event.target.name === this.name) {
|
341
|
+
const hiddenInputValue = event.target.value;
|
342
|
+
const value = this.type === "number"
|
343
|
+
? isValidNumber(hiddenInputValue)
|
344
|
+
? hiddenInputValue
|
345
|
+
: ""
|
346
|
+
: hiddenInputValue;
|
347
|
+
this.setValue({
|
348
|
+
value,
|
349
|
+
origin: "direct"
|
350
|
+
});
|
351
|
+
}
|
352
|
+
event.stopPropagation();
|
353
|
+
};
|
354
|
+
this.setChildElRef = (el) => {
|
355
|
+
this.childEl = el;
|
356
|
+
};
|
357
|
+
this.setChildNumberElRef = (el) => {
|
358
|
+
this.childNumberEl = el;
|
359
|
+
};
|
360
|
+
this.setInputValue = (newInputValue) => {
|
361
|
+
if (this.type === "text" && !this.childEl) {
|
362
|
+
return;
|
363
|
+
}
|
364
|
+
if (this.type === "number" && !this.childNumberEl) {
|
365
|
+
return;
|
366
|
+
}
|
367
|
+
this[`child${this.type === "number" ? "Number" : ""}El`].value = newInputValue;
|
368
|
+
};
|
369
|
+
this.setPreviousEmittedValue = (newPreviousEmittedValue) => {
|
370
|
+
this.previousEmittedValue =
|
371
|
+
this.type === "number"
|
372
|
+
? isValidNumber(newPreviousEmittedValue)
|
373
|
+
? newPreviousEmittedValue
|
374
|
+
: ""
|
375
|
+
: newPreviousEmittedValue;
|
376
|
+
};
|
377
|
+
this.setPreviousValue = (newPreviousValue) => {
|
378
|
+
this.previousValue =
|
379
|
+
this.type === "number"
|
380
|
+
? isValidNumber(newPreviousValue)
|
381
|
+
? newPreviousValue
|
382
|
+
: ""
|
383
|
+
: newPreviousValue;
|
384
|
+
};
|
385
|
+
this.setValue = ({ committing = false, nativeEvent, origin, previousValue, value }) => {
|
386
|
+
numberStringFormatter.numberFormatOptions = {
|
387
|
+
locale: this.effectiveLocale,
|
388
|
+
numberingSystem: this.numberingSystem,
|
389
|
+
useGrouping: this.groupSeparator
|
390
|
+
};
|
391
|
+
if (this.type === "number") {
|
392
|
+
const delocalizedValue = (this.numberingSystem && this.numberingSystem !== "latn") ||
|
393
|
+
defaultNumberingSystem !== "latn"
|
394
|
+
? numberStringFormatter.delocalize(value)
|
395
|
+
: value;
|
396
|
+
const sanitizedValue = sanitizeNumberString(delocalizedValue);
|
397
|
+
const newValue = (value && !sanitizedValue) || [".", "-"].includes(sanitizedValue)
|
398
|
+
? isValidNumber(this.previousValue)
|
399
|
+
? this.previousValue
|
400
|
+
: ""
|
401
|
+
: sanitizedValue;
|
402
|
+
const newLocalizedValue = numberStringFormatter.localize(newValue);
|
403
|
+
this.localizedValue = newLocalizedValue;
|
404
|
+
this.userChangedValue = origin === "user" && this.value !== newValue;
|
405
|
+
this.value = newValue;
|
406
|
+
origin === "direct" && this.setInputValue(newLocalizedValue);
|
407
|
+
}
|
408
|
+
else {
|
409
|
+
this.userChangedValue = origin === "user" && this.value !== value;
|
410
|
+
this.value = value;
|
411
|
+
origin === "direct" && this.setInputValue(value);
|
412
|
+
}
|
413
|
+
this.setPreviousValue(previousValue || this.value);
|
414
|
+
this.previousValueOrigin = origin;
|
415
|
+
if (nativeEvent) {
|
416
|
+
const calciteInputInputEvent = this.calciteInputInput.emit({
|
417
|
+
element: this.childEl,
|
418
|
+
nativeEvent,
|
419
|
+
value: this.value
|
420
|
+
});
|
421
|
+
if (calciteInputInputEvent.defaultPrevented) {
|
422
|
+
this.value = this.previousValue;
|
423
|
+
this.localizedValue =
|
424
|
+
this.type === "number"
|
425
|
+
? numberStringFormatter.localize(this.previousValue)
|
426
|
+
: this.previousValue;
|
427
|
+
}
|
428
|
+
else if (committing) {
|
429
|
+
this.emitChangeIfUserModified();
|
430
|
+
}
|
431
|
+
}
|
432
|
+
};
|
433
|
+
this.inputKeyUpHandler = () => {
|
434
|
+
window.clearInterval(this.nudgeNumberValueIntervalId);
|
435
|
+
};
|
436
|
+
}
|
437
|
+
disabledWatcher() {
|
438
|
+
this.setDisabledAction();
|
439
|
+
}
|
440
|
+
localeChanged() {
|
441
|
+
updateEffectiveLocale(this);
|
442
|
+
}
|
443
|
+
/** watcher to update number-to-string for max */
|
444
|
+
maxWatcher() {
|
445
|
+
var _a;
|
446
|
+
this.maxString = ((_a = this.max) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
447
|
+
}
|
448
|
+
/** watcher to update number-to-string for min */
|
449
|
+
minWatcher() {
|
450
|
+
var _a;
|
451
|
+
this.minString = ((_a = this.min) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
452
|
+
}
|
453
|
+
valueWatcher(newValue, previousValue) {
|
454
|
+
if (!this.userChangedValue) {
|
455
|
+
this.setValue({
|
456
|
+
origin: "direct",
|
457
|
+
previousValue,
|
458
|
+
value: newValue == null || newValue == ""
|
459
|
+
? ""
|
460
|
+
: this.type === "number"
|
461
|
+
? isValidNumber(newValue)
|
462
|
+
? newValue
|
463
|
+
: this.previousValue || ""
|
464
|
+
: newValue
|
465
|
+
});
|
466
|
+
this.warnAboutInvalidNumberValue(newValue);
|
467
|
+
}
|
468
|
+
this.userChangedValue = false;
|
469
|
+
}
|
470
|
+
updateRequestedIcon() {
|
471
|
+
this.requestedIcon = setRequestedIcon(INPUT_TYPE_ICONS, this.icon, this.type);
|
472
|
+
}
|
473
|
+
get isClearable() {
|
474
|
+
return !this.isTextarea && (this.clearable || this.type === "search") && this.value.length > 0;
|
475
|
+
}
|
476
|
+
get isTextarea() {
|
477
|
+
return this.childElType === "textarea";
|
478
|
+
}
|
479
|
+
//--------------------------------------------------------------------------
|
480
|
+
//
|
481
|
+
// Lifecycle
|
482
|
+
//
|
483
|
+
//--------------------------------------------------------------------------
|
484
|
+
connectedCallback() {
|
485
|
+
var _a;
|
486
|
+
connectLocalized(this);
|
487
|
+
this.scale = getElementProp(this.el, "scale", this.scale);
|
488
|
+
this.status = getElementProp(this.el, "status", this.status);
|
489
|
+
this.inlineEditableEl = this.el.closest("calcite-inline-editable");
|
490
|
+
if (this.inlineEditableEl) {
|
491
|
+
this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
|
492
|
+
}
|
493
|
+
connectLabel(this);
|
494
|
+
connectForm(this);
|
495
|
+
this.setPreviousEmittedValue(this.value);
|
496
|
+
this.setPreviousValue(this.value);
|
497
|
+
if (this.type === "number") {
|
498
|
+
this.warnAboutInvalidNumberValue(this.value);
|
499
|
+
this.setValue({
|
500
|
+
origin: "connected",
|
501
|
+
value: isValidNumber(this.value) ? this.value : ""
|
502
|
+
});
|
503
|
+
}
|
504
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
|
505
|
+
this.setDisabledAction();
|
506
|
+
this.el.addEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
|
507
|
+
}
|
508
|
+
disconnectedCallback() {
|
509
|
+
var _a;
|
510
|
+
disconnectLabel(this);
|
511
|
+
disconnectForm(this);
|
512
|
+
disconnectLocalized(this);
|
513
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
514
|
+
this.el.removeEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
|
515
|
+
}
|
516
|
+
componentWillLoad() {
|
517
|
+
var _a, _b;
|
518
|
+
this.childElType = this.type === "textarea" ? "textarea" : "input";
|
519
|
+
this.maxString = (_a = this.max) === null || _a === void 0 ? void 0 : _a.toString();
|
520
|
+
this.minString = (_b = this.min) === null || _b === void 0 ? void 0 : _b.toString();
|
521
|
+
this.requestedIcon = setRequestedIcon(INPUT_TYPE_ICONS, this.icon, this.type);
|
522
|
+
}
|
523
|
+
componentShouldUpdate(newValue, oldValue, property) {
|
524
|
+
if (this.type === "number" && property === "value" && newValue && !isValidNumber(newValue)) {
|
525
|
+
this.setValue({
|
526
|
+
origin: "reset",
|
527
|
+
value: oldValue
|
528
|
+
});
|
529
|
+
return false;
|
530
|
+
}
|
531
|
+
return true;
|
532
|
+
}
|
533
|
+
componentDidRender() {
|
534
|
+
updateHostInteraction(this);
|
535
|
+
}
|
536
|
+
//--------------------------------------------------------------------------
|
537
|
+
//
|
538
|
+
// Public Methods
|
539
|
+
//
|
540
|
+
//--------------------------------------------------------------------------
|
541
|
+
/** Sets focus on the component. */
|
542
|
+
async setFocus() {
|
543
|
+
var _a, _b;
|
544
|
+
if (this.type === "number") {
|
545
|
+
(_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.focus();
|
546
|
+
}
|
547
|
+
else {
|
548
|
+
(_b = this.childEl) === null || _b === void 0 ? void 0 : _b.focus();
|
549
|
+
}
|
550
|
+
}
|
551
|
+
/** Selects all text of the component's `value`. */
|
552
|
+
async selectText() {
|
553
|
+
var _a, _b;
|
554
|
+
if (this.type === "number") {
|
555
|
+
(_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.select();
|
556
|
+
}
|
557
|
+
else {
|
558
|
+
(_b = this.childEl) === null || _b === void 0 ? void 0 : _b.select();
|
559
|
+
}
|
560
|
+
}
|
561
|
+
onLabelClick() {
|
562
|
+
this.setFocus();
|
563
|
+
}
|
564
|
+
incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent) {
|
565
|
+
const { value } = this;
|
566
|
+
const inputStep = this.step === "any" ? 1 : Math.abs(this.step || 1);
|
567
|
+
const inputVal = value && value !== "" ? parseFloat(value) : 0;
|
568
|
+
const adjustment = direction === "up" ? 1 : -1;
|
569
|
+
const nudgedValue = inputVal + inputStep * adjustment;
|
570
|
+
const finalValue = (typeof inputMin === "number" && !isNaN(inputMin) && nudgedValue < inputMin) ||
|
571
|
+
(typeof inputMax === "number" && !isNaN(inputMax) && nudgedValue > inputMax)
|
572
|
+
? inputVal
|
573
|
+
: nudgedValue;
|
574
|
+
const inputValPlaces = decimalPlaces(inputVal);
|
575
|
+
const inputStepPlaces = decimalPlaces(inputStep);
|
576
|
+
this.setValue({
|
577
|
+
committing: true,
|
578
|
+
nativeEvent,
|
579
|
+
origin: "user",
|
580
|
+
value: finalValue.toFixed(Math.max(inputValPlaces, inputStepPlaces))
|
581
|
+
});
|
582
|
+
}
|
583
|
+
onFormReset() {
|
584
|
+
this.setValue({
|
585
|
+
origin: "reset",
|
586
|
+
value: this.defaultValue
|
587
|
+
});
|
588
|
+
}
|
589
|
+
syncHiddenFormInput(input) {
|
590
|
+
var _a, _b, _c, _d;
|
591
|
+
if (this.type === "number") {
|
592
|
+
input.type = "number";
|
593
|
+
input.min = (_b = (_a = this.min) === null || _a === void 0 ? void 0 : _a.toString(10)) !== null && _b !== void 0 ? _b : "";
|
594
|
+
input.max = (_d = (_c = this.max) === null || _c === void 0 ? void 0 : _c.toString(10)) !== null && _d !== void 0 ? _d : "";
|
595
|
+
}
|
596
|
+
else if (this.type === "text") {
|
597
|
+
input.type = "text";
|
598
|
+
if (this.minLength != null) {
|
599
|
+
input.minLength = this.minLength;
|
600
|
+
}
|
601
|
+
if (this.maxLength != null) {
|
602
|
+
input.maxLength = this.maxLength;
|
603
|
+
}
|
604
|
+
}
|
605
|
+
else if (this.type === "password") {
|
606
|
+
input.type = "password";
|
607
|
+
}
|
608
|
+
}
|
609
|
+
setDisabledAction() {
|
610
|
+
const slottedActionEl = getSlotted(this.el, "action");
|
611
|
+
if (!slottedActionEl) {
|
612
|
+
return;
|
613
|
+
}
|
614
|
+
this.disabled
|
615
|
+
? slottedActionEl.setAttribute("disabled", "")
|
616
|
+
: slottedActionEl.removeAttribute("disabled");
|
617
|
+
}
|
618
|
+
warnAboutInvalidNumberValue(value) {
|
619
|
+
if (this.type === "number" && value && !isValidNumber(value)) {
|
620
|
+
console.warn(`The specified value "${value}" cannot be parsed, or is out of range.`);
|
621
|
+
}
|
622
|
+
}
|
623
|
+
// --------------------------------------------------------------------------
|
624
|
+
//
|
625
|
+
// Render Methods
|
626
|
+
//
|
627
|
+
// --------------------------------------------------------------------------
|
628
|
+
render() {
|
629
|
+
const dir = getElementDir(this.el);
|
630
|
+
const loader = (h("div", { class: CSS.loader }, h("calcite-progress", { label: this.intlLoading, type: "indeterminate" })));
|
631
|
+
const inputClearButton = (h("button", { "aria-label": this.intlClear || TEXT.clear, class: CSS.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputValue, tabIndex: -1, type: "button" }, h("calcite-icon", { icon: "x", scale: "s" })));
|
632
|
+
const iconEl = (h("calcite-icon", { class: CSS.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: "s" }));
|
633
|
+
const isHorizontalNumberButton = this.numberButtonType === "horizontal";
|
634
|
+
const numberButtonsHorizontalUp = (h("button", { "aria-hidden": "true", class: {
|
635
|
+
[CSS.numberButtonItem]: true,
|
636
|
+
[CSS.buttonItemHorizontal]: isHorizontalNumberButton
|
637
|
+
}, "data-adjustment": "up", disabled: this.disabled || this.readOnly, onPointerDown: this.numberButtonPointerDownHandler, onPointerOut: this.numberButtonPointerUpAndOutHandler, onPointerUp: this.numberButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, h("calcite-icon", { icon: "chevron-up", scale: "s" })));
|
638
|
+
const numberButtonsHorizontalDown = (h("button", { "aria-hidden": "true", class: {
|
639
|
+
[CSS.numberButtonItem]: true,
|
640
|
+
[CSS.buttonItemHorizontal]: isHorizontalNumberButton
|
641
|
+
}, "data-adjustment": "down", disabled: this.disabled || this.readOnly, onPointerDown: this.numberButtonPointerDownHandler, onPointerOut: this.numberButtonPointerUpAndOutHandler, onPointerUp: this.numberButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, h("calcite-icon", { icon: "chevron-down", scale: "s" })));
|
642
|
+
const numberButtonsVertical = (h("div", { class: CSS.numberButtonWrapper }, numberButtonsHorizontalUp, numberButtonsHorizontalDown));
|
643
|
+
const prefixText = h("div", { class: CSS.prefix }, this.prefixText);
|
644
|
+
const suffixText = h("div", { class: CSS.suffix }, this.suffixText);
|
645
|
+
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;
|
646
|
+
const childEl = this.type !== "number"
|
647
|
+
? [
|
648
|
+
h(this.childElType, { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, class: {
|
649
|
+
[CSS.editingEnabled]: this.editingEnabled,
|
650
|
+
[CSS.inlineChild]: !!this.inlineEditableEl
|
651
|
+
}, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, max: this.maxString, maxLength: this.maxLength, min: this.minString, minLength: this.minLength, name: this.name, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputInputHandler, onKeyDown: this.inputKeyDownHandler, onKeyUp: this.inputKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildElRef, required: this.required ? true : null, step: this.step, tabIndex: this.disabled || (this.inlineEditableEl && !this.editingEnabled) ? -1 : null, type: this.type, value: this.value }),
|
652
|
+
this.isTextarea ? (h("div", { class: CSS.resizeIconWrapper }, h("calcite-icon", { icon: "chevron-down", scale: "s" }))) : null
|
653
|
+
]
|
654
|
+
: null;
|
655
|
+
return (h(Host, { onClick: this.inputFocusHandler, onKeyDown: this.keyDownHandler }, h("div", { class: { [CSS.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
|
656
|
+
? numberButtonsHorizontalDown
|
657
|
+
: 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
|
658
|
+
? numberButtonsVertical
|
659
|
+
: null, this.suffixText ? suffixText : null, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
|
660
|
+
? numberButtonsHorizontalUp
|
661
|
+
: null, h(HiddenFormInputSlot, { component: this }))));
|
662
|
+
}
|
663
|
+
get el() { return getElement(this); }
|
664
|
+
static get watchers() { return {
|
665
|
+
"disabled": ["disabledWatcher"],
|
666
|
+
"locale": ["localeChanged"],
|
667
|
+
"max": ["maxWatcher"],
|
668
|
+
"min": ["minWatcher"],
|
669
|
+
"value": ["valueWatcher"],
|
670
|
+
"icon": ["updateRequestedIcon"],
|
671
|
+
"type": ["updateRequestedIcon"]
|
672
|
+
}; }
|
673
|
+
};
|
674
|
+
Input.style = inputCss;
|
675
|
+
|
676
|
+
const progressCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{position:relative;display:block;inline-size:100%}.track,.bar{position:absolute;inset-block-start:0px;block-size:2px}.track{z-index:1;inline-size:100%;overflow:hidden;background:var(--calcite-ui-border-3)}.bar{z-index:1;background-color:var(--calcite-ui-brand)}@media (forced-colors: active){.track{background-color:highlightText}.bar{background-color:linkText}}.indeterminate{inline-size:20%;animation:looping-progress-bar-ani calc(var(--calcite-internal-animation-timing-medium) * 11) linear infinite}.reversed{animation-direction:reverse}.text{padding-inline:0px;padding-block:1rem 0px;text-align:center;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}@keyframes looping-progress-bar-ani{0%{transform:translate3d(-100%, 0, 0)}50%{inline-size:40%}100%{transform:translate3d(600%, 0, 0)}}";
|
677
|
+
|
678
|
+
const Progress = class {
|
679
|
+
constructor(hostRef) {
|
680
|
+
registerInstance(this, hostRef);
|
681
|
+
/**
|
682
|
+
* Specifies the component type.
|
683
|
+
*
|
684
|
+
* Use `"indeterminate"` if finding actual progress value is impossible.
|
685
|
+
*
|
686
|
+
*/
|
687
|
+
this.type = "determinate";
|
688
|
+
/** The component's progress value, with a range of 0.0 - 1.0. */
|
689
|
+
this.value = 0;
|
690
|
+
/** When `true` and for `"indeterminate"` progress bars, reverses the animation direction. */
|
691
|
+
this.reversed = false;
|
692
|
+
}
|
693
|
+
render() {
|
694
|
+
const isDeterminate = this.type === "determinate";
|
695
|
+
const barStyles = isDeterminate ? { width: `${this.value * 100}%` } : {};
|
696
|
+
return (h("div", { "aria-label": this.label || this.text, "aria-valuemax": 1, "aria-valuemin": 0, "aria-valuenow": this.value, role: "progressbar" }, h("div", { class: "track" }, h("div", { class: {
|
697
|
+
bar: true,
|
698
|
+
indeterminate: this.type === "indeterminate",
|
699
|
+
reversed: this.reversed
|
700
|
+
}, style: barStyles })), this.text ? h("div", { class: "text" }, this.text) : null));
|
701
|
+
}
|
702
|
+
get el() { return getElement(this); }
|
703
|
+
};
|
704
|
+
Progress.style = progressCss;
|
705
|
+
|
706
|
+
export { Input as calcite_input, Progress as calcite_progress };
|