@esri/calcite-components 1.0.0-next.355 → 1.0.0-next.359
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/assets/calcite-icon/rightAlign16.json +1 -0
- package/dist/calcite/assets/calcite-icon/rightAlign24.json +1 -0
- package/dist/calcite/assets/calcite-icon/rightAlign32.json +1 -0
- package/dist/calcite/calcite.esm.js +1 -1
- package/dist/calcite/calcite.js +1 -1
- package/dist/calcite/{p-3e308abf.system.entry.js → p-019c8036.system.entry.js} +1 -1
- package/dist/calcite/{p-5044316a.system.entry.js → p-0ac72794.system.entry.js} +1 -1
- package/dist/calcite/{p-1d59e70a.system.entry.js → p-0b187e6a.system.entry.js} +1 -1
- package/dist/calcite/p-12c57970.js +5 -0
- package/dist/calcite/{p-2787571e.system.entry.js → p-2c3bbbb4.system.entry.js} +2 -2
- package/dist/calcite/{p-b57ddca8.entry.js → p-3366ef60.entry.js} +1 -1
- package/dist/calcite/p-3c34f20d.system.js +5 -0
- package/dist/calcite/{p-be8c7dbb.system.entry.js → p-3f51ac4b.system.entry.js} +1 -1
- package/dist/calcite/{p-52966b4c.js → p-4f9b0b0f.js} +1 -1
- package/dist/calcite/{p-d6e20af1.system.entry.js → p-4fee156d.system.entry.js} +1 -1
- package/dist/calcite/{p-c25f34d6.entry.js → p-55e6b0b2.entry.js} +1 -1
- package/dist/calcite/{p-7f68da96.entry.js → p-5d9fe852.entry.js} +1 -1
- package/dist/calcite/p-5f285d1d.entry.js +5 -0
- package/dist/calcite/p-6173cf08.system.js +5 -0
- package/dist/calcite/{p-a7f8b343.entry.js → p-634115dd.entry.js} +1 -1
- package/dist/calcite/{p-23a085a3.system.entry.js → p-748c198c.system.entry.js} +1 -1
- package/dist/calcite/p-83d41684.entry.js +5 -0
- package/dist/calcite/{p-cf9debce.entry.js → p-92ad7d95.entry.js} +1 -1
- package/dist/calcite/p-99d32fc3.system.js +5 -0
- package/dist/calcite/{p-eca26cba.system.entry.js → p-9a0a29a7.system.entry.js} +1 -1
- package/dist/calcite/p-a07e9c46.system.entry.js +5 -0
- package/dist/calcite/p-ad81283a.entry.js +5 -0
- package/dist/calcite/p-bc00846c.entry.js +5 -0
- package/dist/calcite/{p-6c453fd0.system.entry.js → p-c13560e5.system.entry.js} +1 -1
- package/dist/calcite/{p-da3b96f9.entry.js → p-d00fbd1e.entry.js} +1 -1
- package/dist/calcite/{p-834ec82a.system.js → p-d4bafc77.system.js} +1 -1
- package/dist/calcite/{p-a918eec6.entry.js → p-d8653ba3.entry.js} +1 -1
- package/dist/calcite/p-dd9f2e61.js +5 -0
- package/dist/calcite/{p-15bc7ccd.system.entry.js → p-e8270c76.system.entry.js} +1 -1
- package/dist/calcite/p-f3d02833.js +5 -0
- package/dist/calcite/p-fcde21ce.system.js +5 -0
- package/dist/cjs/calcite-alert.cjs.entry.js +7 -4
- package/dist/cjs/calcite-color-picker_3.cjs.entry.js +1 -1
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +1 -1
- package/dist/cjs/calcite-date-picker_4.cjs.entry.js +3 -3
- package/dist/cjs/calcite-dropdown_3.cjs.entry.js +1 -1
- package/dist/cjs/calcite-input-date-picker.cjs.entry.js +4 -4
- package/dist/cjs/calcite-input-time-picker_2.cjs.entry.js +4 -4
- package/dist/cjs/calcite-input.cjs.entry.js +19 -4
- package/dist/cjs/calcite-popover_2.cjs.entry.js +1 -1
- package/dist/cjs/calcite-tooltip_2.cjs.entry.js +1 -1
- package/dist/cjs/calcite-tree_2.cjs.entry.js +0 -1
- package/dist/cjs/calcite.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/locale-b9b153dd.js +127 -0
- package/dist/cjs/number-e813e801.js +84 -0
- package/dist/cjs/{popper-ccef76e3.js → popper-adfdc032.js} +28 -9
- package/dist/cjs/{resources-d3c42dc4.js → resources-c524c005.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/calcite-alert/calcite-alert.css +28 -6
- package/dist/collection/components/calcite-alert/calcite-alert.js +30 -4
- package/dist/collection/components/calcite-color-picker-swatch/resources.js +1 -1
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rightAlign16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rightAlign24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rightAlign32.json +1 -0
- package/dist/collection/components/calcite-input/calcite-input.js +17 -2
- package/dist/collection/components/calcite-input-time-picker/calcite-input-time-picker.js +2 -2
- package/dist/collection/components/calcite-time-picker/calcite-time-picker.js +4 -4
- package/dist/collection/components/calcite-tree-item/calcite-tree-item.js +0 -1
- package/dist/collection/utils/locale.js +42 -38
- package/dist/collection/utils/number.js +41 -23
- package/dist/components/calcite-alert.js +8 -4
- package/dist/components/calcite-color-picker-swatch2.js +1 -1
- package/dist/components/calcite-input-time-picker.js +1 -1
- package/dist/components/calcite-input2.js +17 -2
- package/dist/components/calcite-time-picker2.js +3 -3
- package/dist/components/calcite-tree-item.js +0 -1
- package/dist/components/locale.js +42 -38
- package/dist/components/number.js +42 -24
- package/dist/components/popper.js +28 -9
- package/dist/custom-elements/index.js +139 -81
- package/dist/esm/calcite-alert.entry.js +7 -4
- package/dist/esm/calcite-color-picker_3.entry.js +1 -1
- package/dist/esm/calcite-combobox_3.entry.js +1 -1
- package/dist/esm/calcite-date-picker_4.entry.js +3 -3
- package/dist/esm/calcite-dropdown_3.entry.js +1 -1
- package/dist/esm/calcite-input-date-picker.entry.js +4 -4
- package/dist/esm/calcite-input-time-picker_2.entry.js +4 -4
- package/dist/esm/calcite-input.entry.js +19 -4
- package/dist/esm/calcite-popover_2.entry.js +1 -1
- package/dist/esm/calcite-tooltip_2.entry.js +1 -1
- package/dist/esm/calcite-tree_2.entry.js +0 -1
- package/dist/esm/calcite.js +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/locale-1b48f64f.js +122 -0
- package/dist/esm/number-8779395f.js +76 -0
- package/dist/esm/{popper-405efdae.js → popper-1814b3c1.js} +28 -9
- package/dist/esm/{resources-421133b2.js → resources-74c807b4.js} +1 -1
- package/dist/esm-es5/calcite-alert.entry.js +1 -1
- package/dist/esm-es5/calcite-color-picker_3.entry.js +1 -1
- package/dist/esm-es5/calcite-combobox_3.entry.js +1 -1
- package/dist/esm-es5/calcite-date-picker_4.entry.js +2 -2
- package/dist/esm-es5/calcite-dropdown_3.entry.js +1 -1
- package/dist/esm-es5/calcite-input-date-picker.entry.js +1 -1
- package/dist/esm-es5/calcite-input-time-picker_2.entry.js +1 -1
- package/dist/esm-es5/calcite-input.entry.js +1 -1
- package/dist/esm-es5/calcite-popover_2.entry.js +2 -2
- package/dist/esm-es5/calcite-tooltip_2.entry.js +1 -1
- package/dist/esm-es5/calcite-tree_2.entry.js +1 -1
- package/dist/esm-es5/calcite.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/locale-1b48f64f.js +5 -0
- package/dist/esm-es5/number-8779395f.js +5 -0
- package/dist/esm-es5/popper-1814b3c1.js +5 -0
- package/dist/esm-es5/{resources-421133b2.js → resources-74c807b4.js} +1 -1
- package/dist/extras/docs-json.json +44 -6
- package/dist/types/components/calcite-alert/calcite-alert.d.ts +4 -2
- package/dist/types/components/calcite-alert/interfaces.d.ts +1 -0
- package/dist/types/components/calcite-input-time-picker/calcite-input-time-picker.d.ts +1 -1
- package/dist/types/components/calcite-pick-list/shared-list-render.d.ts +2 -2
- package/dist/types/components/calcite-time-picker/calcite-time-picker.d.ts +2 -2
- package/dist/types/components.d.ts +17 -9
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/utils/number.d.ts +2 -1
- package/hydrate/index.js +140 -81
- package/package.json +17 -17
- package/readme.md +2 -2
- package/dist/calcite/p-0140ba79.entry.js +0 -5
- package/dist/calcite/p-11b9e4bb.system.js +0 -5
- package/dist/calcite/p-18c4af8f.system.js +0 -5
- package/dist/calcite/p-18d9a261.system.js +0 -5
- package/dist/calcite/p-22523fc5.entry.js +0 -5
- package/dist/calcite/p-54e07c75.entry.js +0 -5
- package/dist/calcite/p-6d0d9bba.js +0 -5
- package/dist/calcite/p-732a0005.system.entry.js +0 -5
- package/dist/calcite/p-8396a2d2.js +0 -5
- package/dist/calcite/p-91300144.js +0 -5
- package/dist/calcite/p-db85eed9.entry.js +0 -5
- package/dist/calcite/p-fc998713.system.js +0 -5
- package/dist/cjs/locale-ccfa66f6.js +0 -123
- package/dist/cjs/number-f57fd111.js +0 -65
- package/dist/esm/locale-86b789f9.js +0 -118
- package/dist/esm/number-eb92427e.js +0 -58
- package/dist/esm-es5/locale-86b789f9.js +0 -5
- package/dist/esm-es5/number-eb92427e.js +0 -5
- package/dist/esm-es5/popper-405efdae.js +0 -5
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
function isActivationKey(key) {
|
|
8
|
+
return key === "Enter" || key === " ";
|
|
9
|
+
}
|
|
10
|
+
const numberKeys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
11
|
+
|
|
12
|
+
function isValidNumber(numberString) {
|
|
13
|
+
return !(!numberString || isNaN(Number(numberString)));
|
|
14
|
+
}
|
|
15
|
+
function parseNumberString(numberString) {
|
|
16
|
+
if (!numberString || !stringContainsNumbers(numberString)) {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
20
|
+
let containsDecimal = false;
|
|
21
|
+
const result = nonExpoNumString
|
|
22
|
+
.split("")
|
|
23
|
+
.filter((value, i) => {
|
|
24
|
+
if (value.match(/\./g) && !containsDecimal) {
|
|
25
|
+
containsDecimal = true;
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (value.match(/\-/g) && i === 0) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
return numberKeys.includes(value);
|
|
32
|
+
})
|
|
33
|
+
.reduce((string, part) => string + part);
|
|
34
|
+
return isValidNumber(result) ? Number(result).toString() : null;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function sanitizeDecimalString(decimalString) {
|
|
38
|
+
const decimalAtEndOfStringButNotStart = /(?!^\.)\.$/;
|
|
39
|
+
return decimalString.replace(decimalAtEndOfStringButNotStart, "");
|
|
40
|
+
}
|
|
41
|
+
function sanitizeNegativeString(negativeString) {
|
|
42
|
+
const allHyphensExceptTheStart = /(?!^-)-/g;
|
|
43
|
+
return negativeString.replace(allHyphensExceptTheStart, "");
|
|
44
|
+
}
|
|
45
|
+
function sanitizeLeadingZeroString(zeroString) {
|
|
46
|
+
const allLeadingZerosOptionallyNegative = /^([-0])0+(?=\d)/;
|
|
47
|
+
return zeroString.replace(allLeadingZerosOptionallyNegative, "$1");
|
|
48
|
+
}
|
|
49
|
+
function sanitizeNumberString(numberString) {
|
|
50
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
51
|
+
const sanitizedValue = sanitizeNegativeString(sanitizeDecimalString(sanitizeLeadingZeroString(nonExpoNumString)));
|
|
52
|
+
const isNegativeDecimalOnlyZeros = /^-\b0\b\.?0*$/;
|
|
53
|
+
return isValidNumber(sanitizedValue)
|
|
54
|
+
? isNegativeDecimalOnlyZeros.test(sanitizedValue)
|
|
55
|
+
? sanitizedValue
|
|
56
|
+
: Number(sanitizedValue).toString()
|
|
57
|
+
: nonExpoNumString;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function sanitizeExponentialNumberString(numberString, func) {
|
|
61
|
+
if (!numberString) {
|
|
62
|
+
return numberString;
|
|
63
|
+
}
|
|
64
|
+
const firstE = numberString.toLowerCase().indexOf("e") + 1;
|
|
65
|
+
return numberString
|
|
66
|
+
.replace(/[eE]*$/g, "")
|
|
67
|
+
.substring(0, firstE)
|
|
68
|
+
.concat(numberString.slice(firstE).replace(/[eE]/g, ""))
|
|
69
|
+
.split(/[eE]/)
|
|
70
|
+
.map((section, i) => (i === 1 ? func(section.replace(/\./g, "")) : func(section)))
|
|
71
|
+
.join("e")
|
|
72
|
+
.replace(/^e/, "1e");
|
|
73
|
+
}
|
|
74
|
+
function stringContainsNumbers(string) {
|
|
75
|
+
return numberKeys.some((number) => string.includes(number));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
exports.isActivationKey = isActivationKey;
|
|
79
|
+
exports.isValidNumber = isValidNumber;
|
|
80
|
+
exports.numberKeys = numberKeys;
|
|
81
|
+
exports.parseNumberString = parseNumberString;
|
|
82
|
+
exports.sanitizeDecimalString = sanitizeDecimalString;
|
|
83
|
+
exports.sanitizeExponentialNumberString = sanitizeExponentialNumberString;
|
|
84
|
+
exports.sanitizeNumberString = sanitizeNumberString;
|
|
@@ -489,13 +489,21 @@ function mapToStyles(_ref2) {
|
|
|
489
489
|
adaptive = _ref2.adaptive,
|
|
490
490
|
roundOffsets = _ref2.roundOffsets,
|
|
491
491
|
isFixed = _ref2.isFixed;
|
|
492
|
+
var _offsets$x = offsets.x,
|
|
493
|
+
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
|
494
|
+
_offsets$y = offsets.y,
|
|
495
|
+
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
492
496
|
|
|
493
|
-
var _ref3 =
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
497
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
|
498
|
+
x: x,
|
|
499
|
+
y: y
|
|
500
|
+
}) : {
|
|
501
|
+
x: x,
|
|
502
|
+
y: y
|
|
503
|
+
};
|
|
498
504
|
|
|
505
|
+
x = _ref3.x;
|
|
506
|
+
y = _ref3.y;
|
|
499
507
|
var hasX = offsets.hasOwnProperty('x');
|
|
500
508
|
var hasY = offsets.hasOwnProperty('y');
|
|
501
509
|
var sideX = left;
|
|
@@ -540,6 +548,17 @@ function mapToStyles(_ref2) {
|
|
|
540
548
|
position: position
|
|
541
549
|
}, adaptive && unsetSides);
|
|
542
550
|
|
|
551
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
552
|
+
x: x,
|
|
553
|
+
y: y
|
|
554
|
+
}) : {
|
|
555
|
+
x: x,
|
|
556
|
+
y: y
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
x = _ref4.x;
|
|
560
|
+
y = _ref4.y;
|
|
561
|
+
|
|
543
562
|
if (gpuAcceleration) {
|
|
544
563
|
var _Object$assign;
|
|
545
564
|
|
|
@@ -549,9 +568,9 @@ function mapToStyles(_ref2) {
|
|
|
549
568
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
550
569
|
}
|
|
551
570
|
|
|
552
|
-
function computeStyles(
|
|
553
|
-
var state =
|
|
554
|
-
options =
|
|
571
|
+
function computeStyles(_ref5) {
|
|
572
|
+
var state = _ref5.state,
|
|
573
|
+
options = _ref5.options;
|
|
555
574
|
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
556
575
|
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
557
576
|
_options$adaptive = options.adaptive,
|
|
@@ -840,7 +859,7 @@ function getClippingParents(element) {
|
|
|
840
859
|
|
|
841
860
|
|
|
842
861
|
return clippingParents.filter(function (clippingParent) {
|
|
843
|
-
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'
|
|
862
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
|
844
863
|
});
|
|
845
864
|
} // Gets the maximum area that the element is visible in due to any number of
|
|
846
865
|
// clipping parents
|
|
@@ -165,14 +165,12 @@
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
:host {
|
|
168
|
+
--calcite-alert-edge-distance: 2rem;
|
|
168
169
|
display: block;
|
|
169
170
|
}
|
|
170
171
|
:host .container {
|
|
171
172
|
pointer-events: none;
|
|
172
173
|
position: fixed;
|
|
173
|
-
left: 0px;
|
|
174
|
-
right: 0px;
|
|
175
|
-
bottom: 0px;
|
|
176
174
|
margin-top: 0px;
|
|
177
175
|
margin-bottom: 0px;
|
|
178
176
|
margin-left: auto;
|
|
@@ -192,12 +190,31 @@
|
|
|
192
190
|
border-bottom: 1px solid var(--calcite-ui-border-3);
|
|
193
191
|
min-height: var(--calcite-alert-min-height);
|
|
194
192
|
width: var(--calcite-alert-width);
|
|
195
|
-
max-width:
|
|
193
|
+
max-width: calc(100% - (var(--calcite-alert-edge-distance) * 2 + 2px));
|
|
196
194
|
max-height: 0;
|
|
197
195
|
z-index: 101;
|
|
198
|
-
transform: translate3d(0, 1.5rem, 0);
|
|
199
196
|
transition: var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out;
|
|
200
197
|
}
|
|
198
|
+
:host .container.bottom, :host .container.top {
|
|
199
|
+
inset-inline-end: 0;
|
|
200
|
+
inset-inline-start: 0;
|
|
201
|
+
}
|
|
202
|
+
:host .container[class*=bottom] {
|
|
203
|
+
transform: translate3d(0, var(--calcite-alert-edge-distance), 0);
|
|
204
|
+
inset-block-end: var(--calcite-alert-edge-distance);
|
|
205
|
+
}
|
|
206
|
+
:host .container[class*=top] {
|
|
207
|
+
transform: translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), 0);
|
|
208
|
+
inset-block-start: var(--calcite-alert-edge-distance);
|
|
209
|
+
}
|
|
210
|
+
:host .container[class*=-start] {
|
|
211
|
+
inset-inline-start: var(--calcite-alert-edge-distance);
|
|
212
|
+
inset-inline-end: auto;
|
|
213
|
+
}
|
|
214
|
+
:host .container[class*=-end] {
|
|
215
|
+
inset-inline-end: var(--calcite-alert-edge-distance);
|
|
216
|
+
inset-inline-start: auto;
|
|
217
|
+
}
|
|
201
218
|
|
|
202
219
|
.container {
|
|
203
220
|
display: flex;
|
|
@@ -220,9 +237,14 @@
|
|
|
220
237
|
max-height: 100%;
|
|
221
238
|
border-top-width: 2px;
|
|
222
239
|
opacity: 1;
|
|
223
|
-
transform: translate3d(0, -1.5rem, 0);
|
|
224
240
|
pointer-events: initial;
|
|
225
241
|
}
|
|
242
|
+
:host([active]) .container:not(.queued)[class*=bottom] {
|
|
243
|
+
transform: translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), inherit);
|
|
244
|
+
}
|
|
245
|
+
:host([active]) .container:not(.queued)[class*=top] {
|
|
246
|
+
transform: translate3d(0, var(--calcite-alert-edge-distance), inherit);
|
|
247
|
+
}
|
|
226
248
|
|
|
227
249
|
slot[name=title]::slotted(*), *::slotted([slot=title]) {
|
|
228
250
|
font-size: var(--calcite-font-size-0);
|
|
@@ -33,7 +33,9 @@ export class CalciteAlert {
|
|
|
33
33
|
* @default "Close"
|
|
34
34
|
*/
|
|
35
35
|
this.intlClose = TEXT.intlClose;
|
|
36
|
-
/** specify the
|
|
36
|
+
/** specify the placement of the alert */
|
|
37
|
+
this.placement = "bottom";
|
|
38
|
+
/** specify the scale of the alert, defaults to m */
|
|
37
39
|
this.scale = "m";
|
|
38
40
|
//--------------------------------------------------------------------------
|
|
39
41
|
//
|
|
@@ -105,13 +107,14 @@ export class CalciteAlert {
|
|
|
105
107
|
const queueText = `+${this.queueLength > 2 ? this.queueLength - 1 : 1}`;
|
|
106
108
|
const queueCount = (h("div", { class: `${this.queueLength > 1 ? "active " : ""}alert-queue-count` },
|
|
107
109
|
h("calcite-chip", { scale: this.scale, value: queueText }, queueText)));
|
|
108
|
-
const { active, autoDismiss, label, queued, requestedIcon } = this;
|
|
110
|
+
const { active, autoDismiss, label, placement, queued, requestedIcon } = this;
|
|
109
111
|
const role = autoDismiss ? "alert" : "alertdialog";
|
|
110
112
|
const hidden = !active;
|
|
111
113
|
return (h(Host, { "aria-hidden": hidden.toString(), "aria-label": label, "calcite-hydrated-hidden": hidden, role: role },
|
|
112
114
|
h("div", { class: {
|
|
113
115
|
container: true,
|
|
114
|
-
queued
|
|
116
|
+
queued,
|
|
117
|
+
[placement]: true
|
|
115
118
|
} },
|
|
116
119
|
requestedIcon ? (h("div", { class: "alert-icon" },
|
|
117
120
|
h("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null,
|
|
@@ -331,6 +334,29 @@ export class CalciteAlert {
|
|
|
331
334
|
"attribute": "label",
|
|
332
335
|
"reflect": false
|
|
333
336
|
},
|
|
337
|
+
"placement": {
|
|
338
|
+
"type": "string",
|
|
339
|
+
"mutable": false,
|
|
340
|
+
"complexType": {
|
|
341
|
+
"original": "AlertPlacement",
|
|
342
|
+
"resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
343
|
+
"references": {
|
|
344
|
+
"AlertPlacement": {
|
|
345
|
+
"location": "import",
|
|
346
|
+
"path": "./interfaces"
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
"required": false,
|
|
351
|
+
"optional": false,
|
|
352
|
+
"docs": {
|
|
353
|
+
"tags": [],
|
|
354
|
+
"text": "specify the placement of the alert"
|
|
355
|
+
},
|
|
356
|
+
"attribute": "placement",
|
|
357
|
+
"reflect": false,
|
|
358
|
+
"defaultValue": "\"bottom\""
|
|
359
|
+
},
|
|
334
360
|
"scale": {
|
|
335
361
|
"type": "string",
|
|
336
362
|
"mutable": false,
|
|
@@ -348,7 +374,7 @@ export class CalciteAlert {
|
|
|
348
374
|
"optional": false,
|
|
349
375
|
"docs": {
|
|
350
376
|
"tags": [],
|
|
351
|
-
"text": "specify the scale of the
|
|
377
|
+
"text": "specify the scale of the alert, defaults to m"
|
|
352
378
|
},
|
|
353
379
|
"attribute": "scale",
|
|
354
380
|
"reflect": true,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"M1 2h14v1H1zm6 5h8V6H7zm-6 4h14v-1H1zm6 4h8v-1H7z"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"M2 3h20v1H2zm8 7h12V9H10zm-8 6h20v-1H2zm8 6h12v-1H10z"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"M2 4h28v1H2zm12 9h16v-1H14zM2 21h28v-1H2zm12 8h16v-1H14z"
|
|
@@ -168,8 +168,7 @@ export class CalciteInput {
|
|
|
168
168
|
"Delete",
|
|
169
169
|
"Enter",
|
|
170
170
|
"Escape",
|
|
171
|
-
"Tab"
|
|
172
|
-
"-"
|
|
171
|
+
"Tab"
|
|
173
172
|
];
|
|
174
173
|
if (event.altKey || event.ctrlKey || event.metaKey) {
|
|
175
174
|
return;
|
|
@@ -190,6 +189,22 @@ export class CalciteInput {
|
|
|
190
189
|
return;
|
|
191
190
|
}
|
|
192
191
|
}
|
|
192
|
+
if (/[eE]/.test(event.key)) {
|
|
193
|
+
if (!this.value && !this.childNumberEl.value) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (this.value && !/[eE]/.test(this.childNumberEl.value)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (event.key === "-") {
|
|
201
|
+
if (!this.value && !this.childNumberEl.value) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (this.value && this.childNumberEl.value.split("-").length <= 2) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
193
208
|
event.preventDefault();
|
|
194
209
|
};
|
|
195
210
|
this.nudgeNumberValue = (direction, nativeEvent) => {
|
|
@@ -33,7 +33,7 @@ export class CalciteInputTimePicker {
|
|
|
33
33
|
this.scale = "m";
|
|
34
34
|
/** number (seconds) that specifies the granularity that the value must adhere to */
|
|
35
35
|
this.step = 60;
|
|
36
|
-
/** The selected time (always 24-hour format)*/
|
|
36
|
+
/** The selected time in UTC (always 24-hour format) */
|
|
37
37
|
this.value = null;
|
|
38
38
|
/** whether the value of the input was changed as a result of user typing or not */
|
|
39
39
|
this.internalValueChange = false;
|
|
@@ -559,7 +559,7 @@ export class CalciteInputTimePicker {
|
|
|
559
559
|
"optional": false,
|
|
560
560
|
"docs": {
|
|
561
561
|
"tags": [],
|
|
562
|
-
"text": "The selected time (always 24-hour format)"
|
|
562
|
+
"text": "The selected time in UTC (always 24-hour format)"
|
|
563
563
|
},
|
|
564
564
|
"attribute": "value",
|
|
565
565
|
"reflect": false,
|
|
@@ -72,9 +72,9 @@ export class CalciteTimePicker {
|
|
|
72
72
|
this.locale = document.documentElement.lang || navigator.language || "en";
|
|
73
73
|
/** The scale (size) of the time picker */
|
|
74
74
|
this.scale = "m";
|
|
75
|
-
/** number that specifies the granularity that the value must adhere to */
|
|
75
|
+
/** number (seconds) that specifies the granularity that the value must adhere to */
|
|
76
76
|
this.step = 60;
|
|
77
|
-
/** The selected time in UTC */
|
|
77
|
+
/** The selected time in UTC (always 24-hour format) */
|
|
78
78
|
this.value = null;
|
|
79
79
|
this.showSecond = this.step < 60;
|
|
80
80
|
this.decrementHour = () => {
|
|
@@ -910,7 +910,7 @@ export class CalciteTimePicker {
|
|
|
910
910
|
"optional": false,
|
|
911
911
|
"docs": {
|
|
912
912
|
"tags": [],
|
|
913
|
-
"text": "number that specifies the granularity that the value must adhere to"
|
|
913
|
+
"text": "number (seconds) that specifies the granularity that the value must adhere to"
|
|
914
914
|
},
|
|
915
915
|
"attribute": "step",
|
|
916
916
|
"reflect": false,
|
|
@@ -928,7 +928,7 @@ export class CalciteTimePicker {
|
|
|
928
928
|
"optional": false,
|
|
929
929
|
"docs": {
|
|
930
930
|
"tags": [],
|
|
931
|
-
"text": "The selected time in UTC"
|
|
931
|
+
"text": "The selected time in UTC (always 24-hour format)"
|
|
932
932
|
},
|
|
933
933
|
"attribute": "value",
|
|
934
934
|
"reflect": false,
|
|
@@ -155,7 +155,6 @@ export class CalciteTreeItem {
|
|
|
155
155
|
const target = link.target === "" ? "_self" : link.target;
|
|
156
156
|
window.open(link.href, target);
|
|
157
157
|
}
|
|
158
|
-
this.expanded = !this.expanded;
|
|
159
158
|
this.calciteTreeItemSelect.emit({
|
|
160
159
|
modifyCurrentSelection: e.shiftKey || this.selectionMode === TreeSelectionMode.Ancestors,
|
|
161
160
|
forceToggle: false
|
|
@@ -2,7 +2,7 @@
|
|
|
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 { sanitizeDecimalString } from "./number";
|
|
5
|
+
import { sanitizeDecimalString, sanitizeExponentialNumberString } from "./number";
|
|
6
6
|
export const locales = [
|
|
7
7
|
"ar",
|
|
8
8
|
"bs",
|
|
@@ -60,23 +60,25 @@ function createLocaleNumberFormatter(locale) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
export function delocalizeNumberString(numberString, locale) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
64
|
+
if (nonExpoNumString) {
|
|
65
|
+
const groupSeparator = getGroupSeparator(locale);
|
|
66
|
+
const decimalSeparator = getDecimalSeparator(locale);
|
|
67
|
+
const splitNumberString = nonExpoNumString.split("");
|
|
68
|
+
const decimalIndex = splitNumberString.lastIndexOf(decimalSeparator);
|
|
69
|
+
const delocalizedNumberString = splitNumberString
|
|
70
|
+
.map((value, index) => {
|
|
71
|
+
if (value === groupSeparator || (value === decimalSeparator && index !== decimalIndex)) {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
return value;
|
|
75
|
+
})
|
|
76
|
+
.reduce((string, part) => string + part)
|
|
77
|
+
.replace(decimalSeparator, ".");
|
|
78
|
+
return isNaN(Number(delocalizedNumberString)) ? nonExpoNumString : delocalizedNumberString;
|
|
79
|
+
}
|
|
80
|
+
return nonExpoNumString;
|
|
81
|
+
});
|
|
80
82
|
}
|
|
81
83
|
export function getGroupSeparator(locale) {
|
|
82
84
|
const formatter = createLocaleNumberFormatter(locale);
|
|
@@ -91,25 +93,27 @@ export function getDecimalSeparator(locale) {
|
|
|
91
93
|
return value.trim().length === 0 ? " " : value;
|
|
92
94
|
}
|
|
93
95
|
export function localizeNumberString(numberString, locale, displayGroupSeparator = false) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
96
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
97
|
+
if (nonExpoNumString) {
|
|
98
|
+
const number = Number(sanitizeDecimalString(nonExpoNumString));
|
|
99
|
+
if (!isNaN(number)) {
|
|
100
|
+
const formatter = createLocaleNumberFormatter(locale);
|
|
101
|
+
const parts = formatter.formatToParts(number);
|
|
102
|
+
const localizedNumberString = parts
|
|
103
|
+
.map(({ type, value }) => {
|
|
104
|
+
switch (type) {
|
|
105
|
+
case "group":
|
|
106
|
+
return displayGroupSeparator ? getGroupSeparator(locale) : "";
|
|
107
|
+
case "decimal":
|
|
108
|
+
return getDecimalSeparator(locale);
|
|
109
|
+
default:
|
|
110
|
+
return value;
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
.reduce((string, part) => string + part);
|
|
114
|
+
return localizedNumberString;
|
|
115
|
+
}
|
|
116
|
+
return nonExpoNumString;
|
|
112
117
|
}
|
|
113
|
-
}
|
|
114
|
-
return numberString;
|
|
118
|
+
});
|
|
115
119
|
}
|
|
@@ -10,21 +10,23 @@ export function parseNumberString(numberString) {
|
|
|
10
10
|
if (!numberString || !stringContainsNumbers(numberString)) {
|
|
11
11
|
return "";
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
containsDecimal
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
14
|
+
let containsDecimal = false;
|
|
15
|
+
const result = nonExpoNumString
|
|
16
|
+
.split("")
|
|
17
|
+
.filter((value, i) => {
|
|
18
|
+
if (value.match(/\./g) && !containsDecimal) {
|
|
19
|
+
containsDecimal = true;
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (value.match(/\-/g) && i === 0) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return numberKeys.includes(value);
|
|
26
|
+
})
|
|
27
|
+
.reduce((string, part) => string + part);
|
|
28
|
+
return isValidNumber(result) ? Number(result).toString() : null;
|
|
29
|
+
});
|
|
28
30
|
}
|
|
29
31
|
export function sanitizeDecimalString(decimalString) {
|
|
30
32
|
const decimalAtEndOfStringButNotStart = /(?!^\.)\.$/;
|
|
@@ -38,14 +40,30 @@ export function sanitizeLeadingZeroString(zeroString) {
|
|
|
38
40
|
const allLeadingZerosOptionallyNegative = /^([-0])0+(?=\d)/;
|
|
39
41
|
return zeroString.replace(allLeadingZerosOptionallyNegative, "$1");
|
|
40
42
|
}
|
|
41
|
-
export function sanitizeNumberString(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
? sanitizedValue
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
export function sanitizeNumberString(numberString) {
|
|
44
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
45
|
+
const sanitizedValue = sanitizeNegativeString(sanitizeDecimalString(sanitizeLeadingZeroString(nonExpoNumString)));
|
|
46
|
+
const isNegativeDecimalOnlyZeros = /^-\b0\b\.?0*$/;
|
|
47
|
+
return isValidNumber(sanitizedValue)
|
|
48
|
+
? isNegativeDecimalOnlyZeros.test(sanitizedValue)
|
|
49
|
+
? sanitizedValue
|
|
50
|
+
: Number(sanitizedValue).toString()
|
|
51
|
+
: nonExpoNumString;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export function sanitizeExponentialNumberString(numberString, func) {
|
|
55
|
+
if (!numberString) {
|
|
56
|
+
return numberString;
|
|
57
|
+
}
|
|
58
|
+
const firstE = numberString.toLowerCase().indexOf("e") + 1;
|
|
59
|
+
return numberString
|
|
60
|
+
.replace(/[eE]*$/g, "")
|
|
61
|
+
.substring(0, firstE)
|
|
62
|
+
.concat(numberString.slice(firstE).replace(/[eE]/g, ""))
|
|
63
|
+
.split(/[eE]/)
|
|
64
|
+
.map((section, i) => (i === 1 ? func(section.replace(/\./g, "")) : func(section)))
|
|
65
|
+
.join("e")
|
|
66
|
+
.replace(/^e/, "1e");
|
|
49
67
|
}
|
|
50
68
|
function stringContainsNumbers(string) {
|
|
51
69
|
return numberKeys.some((number) => string.includes(number));
|