@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.
Files changed (141) hide show
  1. package/dist/calcite/assets/calcite-icon/rightAlign16.json +1 -0
  2. package/dist/calcite/assets/calcite-icon/rightAlign24.json +1 -0
  3. package/dist/calcite/assets/calcite-icon/rightAlign32.json +1 -0
  4. package/dist/calcite/calcite.esm.js +1 -1
  5. package/dist/calcite/calcite.js +1 -1
  6. package/dist/calcite/{p-3e308abf.system.entry.js → p-019c8036.system.entry.js} +1 -1
  7. package/dist/calcite/{p-5044316a.system.entry.js → p-0ac72794.system.entry.js} +1 -1
  8. package/dist/calcite/{p-1d59e70a.system.entry.js → p-0b187e6a.system.entry.js} +1 -1
  9. package/dist/calcite/p-12c57970.js +5 -0
  10. package/dist/calcite/{p-2787571e.system.entry.js → p-2c3bbbb4.system.entry.js} +2 -2
  11. package/dist/calcite/{p-b57ddca8.entry.js → p-3366ef60.entry.js} +1 -1
  12. package/dist/calcite/p-3c34f20d.system.js +5 -0
  13. package/dist/calcite/{p-be8c7dbb.system.entry.js → p-3f51ac4b.system.entry.js} +1 -1
  14. package/dist/calcite/{p-52966b4c.js → p-4f9b0b0f.js} +1 -1
  15. package/dist/calcite/{p-d6e20af1.system.entry.js → p-4fee156d.system.entry.js} +1 -1
  16. package/dist/calcite/{p-c25f34d6.entry.js → p-55e6b0b2.entry.js} +1 -1
  17. package/dist/calcite/{p-7f68da96.entry.js → p-5d9fe852.entry.js} +1 -1
  18. package/dist/calcite/p-5f285d1d.entry.js +5 -0
  19. package/dist/calcite/p-6173cf08.system.js +5 -0
  20. package/dist/calcite/{p-a7f8b343.entry.js → p-634115dd.entry.js} +1 -1
  21. package/dist/calcite/{p-23a085a3.system.entry.js → p-748c198c.system.entry.js} +1 -1
  22. package/dist/calcite/p-83d41684.entry.js +5 -0
  23. package/dist/calcite/{p-cf9debce.entry.js → p-92ad7d95.entry.js} +1 -1
  24. package/dist/calcite/p-99d32fc3.system.js +5 -0
  25. package/dist/calcite/{p-eca26cba.system.entry.js → p-9a0a29a7.system.entry.js} +1 -1
  26. package/dist/calcite/p-a07e9c46.system.entry.js +5 -0
  27. package/dist/calcite/p-ad81283a.entry.js +5 -0
  28. package/dist/calcite/p-bc00846c.entry.js +5 -0
  29. package/dist/calcite/{p-6c453fd0.system.entry.js → p-c13560e5.system.entry.js} +1 -1
  30. package/dist/calcite/{p-da3b96f9.entry.js → p-d00fbd1e.entry.js} +1 -1
  31. package/dist/calcite/{p-834ec82a.system.js → p-d4bafc77.system.js} +1 -1
  32. package/dist/calcite/{p-a918eec6.entry.js → p-d8653ba3.entry.js} +1 -1
  33. package/dist/calcite/p-dd9f2e61.js +5 -0
  34. package/dist/calcite/{p-15bc7ccd.system.entry.js → p-e8270c76.system.entry.js} +1 -1
  35. package/dist/calcite/p-f3d02833.js +5 -0
  36. package/dist/calcite/p-fcde21ce.system.js +5 -0
  37. package/dist/cjs/calcite-alert.cjs.entry.js +7 -4
  38. package/dist/cjs/calcite-color-picker_3.cjs.entry.js +1 -1
  39. package/dist/cjs/calcite-combobox_3.cjs.entry.js +1 -1
  40. package/dist/cjs/calcite-date-picker_4.cjs.entry.js +3 -3
  41. package/dist/cjs/calcite-dropdown_3.cjs.entry.js +1 -1
  42. package/dist/cjs/calcite-input-date-picker.cjs.entry.js +4 -4
  43. package/dist/cjs/calcite-input-time-picker_2.cjs.entry.js +4 -4
  44. package/dist/cjs/calcite-input.cjs.entry.js +19 -4
  45. package/dist/cjs/calcite-popover_2.cjs.entry.js +1 -1
  46. package/dist/cjs/calcite-tooltip_2.cjs.entry.js +1 -1
  47. package/dist/cjs/calcite-tree_2.cjs.entry.js +0 -1
  48. package/dist/cjs/calcite.cjs.js +2 -2
  49. package/dist/cjs/loader.cjs.js +2 -2
  50. package/dist/cjs/locale-b9b153dd.js +127 -0
  51. package/dist/cjs/number-e813e801.js +84 -0
  52. package/dist/cjs/{popper-ccef76e3.js → popper-adfdc032.js} +28 -9
  53. package/dist/cjs/{resources-d3c42dc4.js → resources-c524c005.js} +1 -1
  54. package/dist/collection/collection-manifest.json +1 -1
  55. package/dist/collection/components/calcite-alert/calcite-alert.css +28 -6
  56. package/dist/collection/components/calcite-alert/calcite-alert.js +30 -4
  57. package/dist/collection/components/calcite-color-picker-swatch/resources.js +1 -1
  58. package/dist/collection/components/calcite-icon/assets/calcite-icon/rightAlign16.json +1 -0
  59. package/dist/collection/components/calcite-icon/assets/calcite-icon/rightAlign24.json +1 -0
  60. package/dist/collection/components/calcite-icon/assets/calcite-icon/rightAlign32.json +1 -0
  61. package/dist/collection/components/calcite-input/calcite-input.js +17 -2
  62. package/dist/collection/components/calcite-input-time-picker/calcite-input-time-picker.js +2 -2
  63. package/dist/collection/components/calcite-time-picker/calcite-time-picker.js +4 -4
  64. package/dist/collection/components/calcite-tree-item/calcite-tree-item.js +0 -1
  65. package/dist/collection/utils/locale.js +42 -38
  66. package/dist/collection/utils/number.js +41 -23
  67. package/dist/components/calcite-alert.js +8 -4
  68. package/dist/components/calcite-color-picker-swatch2.js +1 -1
  69. package/dist/components/calcite-input-time-picker.js +1 -1
  70. package/dist/components/calcite-input2.js +17 -2
  71. package/dist/components/calcite-time-picker2.js +3 -3
  72. package/dist/components/calcite-tree-item.js +0 -1
  73. package/dist/components/locale.js +42 -38
  74. package/dist/components/number.js +42 -24
  75. package/dist/components/popper.js +28 -9
  76. package/dist/custom-elements/index.js +139 -81
  77. package/dist/esm/calcite-alert.entry.js +7 -4
  78. package/dist/esm/calcite-color-picker_3.entry.js +1 -1
  79. package/dist/esm/calcite-combobox_3.entry.js +1 -1
  80. package/dist/esm/calcite-date-picker_4.entry.js +3 -3
  81. package/dist/esm/calcite-dropdown_3.entry.js +1 -1
  82. package/dist/esm/calcite-input-date-picker.entry.js +4 -4
  83. package/dist/esm/calcite-input-time-picker_2.entry.js +4 -4
  84. package/dist/esm/calcite-input.entry.js +19 -4
  85. package/dist/esm/calcite-popover_2.entry.js +1 -1
  86. package/dist/esm/calcite-tooltip_2.entry.js +1 -1
  87. package/dist/esm/calcite-tree_2.entry.js +0 -1
  88. package/dist/esm/calcite.js +2 -2
  89. package/dist/esm/loader.js +2 -2
  90. package/dist/esm/locale-1b48f64f.js +122 -0
  91. package/dist/esm/number-8779395f.js +76 -0
  92. package/dist/esm/{popper-405efdae.js → popper-1814b3c1.js} +28 -9
  93. package/dist/esm/{resources-421133b2.js → resources-74c807b4.js} +1 -1
  94. package/dist/esm-es5/calcite-alert.entry.js +1 -1
  95. package/dist/esm-es5/calcite-color-picker_3.entry.js +1 -1
  96. package/dist/esm-es5/calcite-combobox_3.entry.js +1 -1
  97. package/dist/esm-es5/calcite-date-picker_4.entry.js +2 -2
  98. package/dist/esm-es5/calcite-dropdown_3.entry.js +1 -1
  99. package/dist/esm-es5/calcite-input-date-picker.entry.js +1 -1
  100. package/dist/esm-es5/calcite-input-time-picker_2.entry.js +1 -1
  101. package/dist/esm-es5/calcite-input.entry.js +1 -1
  102. package/dist/esm-es5/calcite-popover_2.entry.js +2 -2
  103. package/dist/esm-es5/calcite-tooltip_2.entry.js +1 -1
  104. package/dist/esm-es5/calcite-tree_2.entry.js +1 -1
  105. package/dist/esm-es5/calcite.js +1 -1
  106. package/dist/esm-es5/loader.js +1 -1
  107. package/dist/esm-es5/locale-1b48f64f.js +5 -0
  108. package/dist/esm-es5/number-8779395f.js +5 -0
  109. package/dist/esm-es5/popper-1814b3c1.js +5 -0
  110. package/dist/esm-es5/{resources-421133b2.js → resources-74c807b4.js} +1 -1
  111. package/dist/extras/docs-json.json +44 -6
  112. package/dist/types/components/calcite-alert/calcite-alert.d.ts +4 -2
  113. package/dist/types/components/calcite-alert/interfaces.d.ts +1 -0
  114. package/dist/types/components/calcite-input-time-picker/calcite-input-time-picker.d.ts +1 -1
  115. package/dist/types/components/calcite-pick-list/shared-list-render.d.ts +2 -2
  116. package/dist/types/components/calcite-time-picker/calcite-time-picker.d.ts +2 -2
  117. package/dist/types/components.d.ts +17 -9
  118. package/dist/types/stencil-public-runtime.d.ts +6 -4
  119. package/dist/types/utils/number.d.ts +2 -1
  120. package/hydrate/index.js +140 -81
  121. package/package.json +17 -17
  122. package/readme.md +2 -2
  123. package/dist/calcite/p-0140ba79.entry.js +0 -5
  124. package/dist/calcite/p-11b9e4bb.system.js +0 -5
  125. package/dist/calcite/p-18c4af8f.system.js +0 -5
  126. package/dist/calcite/p-18d9a261.system.js +0 -5
  127. package/dist/calcite/p-22523fc5.entry.js +0 -5
  128. package/dist/calcite/p-54e07c75.entry.js +0 -5
  129. package/dist/calcite/p-6d0d9bba.js +0 -5
  130. package/dist/calcite/p-732a0005.system.entry.js +0 -5
  131. package/dist/calcite/p-8396a2d2.js +0 -5
  132. package/dist/calcite/p-91300144.js +0 -5
  133. package/dist/calcite/p-db85eed9.entry.js +0 -5
  134. package/dist/calcite/p-fc998713.system.js +0 -5
  135. package/dist/cjs/locale-ccfa66f6.js +0 -123
  136. package/dist/cjs/number-f57fd111.js +0 -65
  137. package/dist/esm/locale-86b789f9.js +0 -118
  138. package/dist/esm/number-eb92427e.js +0 -58
  139. package/dist/esm-es5/locale-86b789f9.js +0 -5
  140. package/dist/esm-es5/number-eb92427e.js +0 -5
  141. 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 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
494
- _ref3$x = _ref3.x,
495
- x = _ref3$x === void 0 ? 0 : _ref3$x,
496
- _ref3$y = _ref3.y,
497
- y = _ref3$y === void 0 ? 0 : _ref3$y;
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(_ref4) {
553
- var state = _ref4.state,
554
- options = _ref4.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' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
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
@@ -5,7 +5,7 @@
5
5
  'use strict';
6
6
 
7
7
  const index = require('./index-6b5d2de5.js');
8
- const locale = require('./locale-ccfa66f6.js');
8
+ const locale = require('./locale-b9b153dd.js');
9
9
 
10
10
  /**
11
11
  * Get supported locale code from raw user input
@@ -93,7 +93,7 @@
93
93
  ],
94
94
  "compiler": {
95
95
  "name": "@stencil/core",
96
- "version": "2.12.0",
96
+ "version": "2.12.1",
97
97
  "typescriptVersion": "4.3.5"
98
98
  },
99
99
  "collections": [],
@@ -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: 90%;
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 scale of the button, defaults to m */
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 button, defaults to m"
377
+ "text": "specify the scale of the alert, defaults to m"
352
378
  },
353
379
  "attribute": "scale",
354
380
  "reflect": true,
@@ -7,6 +7,6 @@ export const CSS = {
7
7
  noColorIcon: "no-color-icon"
8
8
  };
9
9
  export const COLORS = {
10
- borderLight: "rgba(0, 0, 0, 0.15)",
10
+ borderLight: "rgba(0, 0, 0, 0.3)",
11
11
  borderDark: "rgba(255, 255, 255, 0.15)"
12
12
  };
@@ -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
- if (numberString) {
64
- const groupSeparator = getGroupSeparator(locale);
65
- const decimalSeparator = getDecimalSeparator(locale);
66
- const splitNumberString = numberString.split("");
67
- const decimalIndex = splitNumberString.lastIndexOf(decimalSeparator);
68
- const delocalizedNumberString = splitNumberString
69
- .map((value, index) => {
70
- if (value === groupSeparator || (value === decimalSeparator && index !== decimalIndex)) {
71
- return "";
72
- }
73
- return value;
74
- })
75
- .reduce((string, part) => string + part)
76
- .replace(decimalSeparator, ".");
77
- return isNaN(Number(delocalizedNumberString)) ? numberString : delocalizedNumberString;
78
- }
79
- return numberString;
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
- if (numberString) {
95
- const number = Number(sanitizeDecimalString(numberString));
96
- if (!isNaN(number)) {
97
- const formatter = createLocaleNumberFormatter(locale);
98
- const parts = formatter.formatToParts(number);
99
- const localizedNumberString = parts
100
- .map(({ type, value }) => {
101
- switch (type) {
102
- case "group":
103
- return displayGroupSeparator ? getGroupSeparator(locale) : "";
104
- case "decimal":
105
- return getDecimalSeparator(locale);
106
- default:
107
- return value;
108
- }
109
- })
110
- .reduce((string, part) => string + part);
111
- return localizedNumberString;
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
- let containsDecimal = false;
14
- const result = numberString
15
- .split("")
16
- .filter((value, i) => {
17
- if (value.match(/\./g) && !containsDecimal) {
18
- containsDecimal = true;
19
- return true;
20
- }
21
- if (value.match(/\-/g) && i === 0) {
22
- return true;
23
- }
24
- return numberKeys.includes(value);
25
- })
26
- .reduce((string, part) => string + part);
27
- return isValidNumber(result) ? Number(result).toString() : null;
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(value) {
42
- const sanitizedValue = sanitizeNegativeString(sanitizeDecimalString(sanitizeLeadingZeroString(value)));
43
- const isNegativeDecimalOnlyZeros = /^-\b0\b\.?0*$/;
44
- return isValidNumber(sanitizedValue)
45
- ? isNegativeDecimalOnlyZeros.test(sanitizedValue)
46
- ? sanitizedValue
47
- : Number(sanitizedValue).toString()
48
- : value;
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));