@esri/calcite-components 1.0.0-next.318 → 1.0.0-next.321
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/centerAlign16.json +1 -0
- package/dist/calcite/assets/calcite-icon/centerAlign24.json +1 -0
- package/dist/calcite/assets/calcite-icon/centerAlign32.json +1 -0
- package/dist/calcite/assets/calcite-icon/convert16.json +1 -0
- package/dist/calcite/assets/calcite-icon/convert24.json +1 -0
- package/dist/calcite/assets/calcite-icon/convert32.json +1 -0
- package/dist/calcite/assets/calcite-icon/formDropdown16.json +1 -0
- package/dist/calcite/assets/calcite-icon/formDropdown24.json +1 -0
- package/dist/calcite/assets/calcite-icon/formDropdown32.json +1 -0
- package/dist/calcite/assets/calcite-icon/language16.json +1 -0
- package/dist/calcite/assets/calcite-icon/language24.json +1 -0
- package/dist/calcite/assets/calcite-icon/language32.json +1 -0
- package/dist/calcite/assets/calcite-icon/languageTranslate16.json +1 -0
- package/dist/calcite/assets/calcite-icon/languageTranslate24.json +1 -0
- package/dist/calcite/assets/calcite-icon/languageTranslate32.json +1 -0
- package/dist/calcite/assets/calcite-icon/leftAlign16.json +1 -0
- package/dist/calcite/assets/calcite-icon/leftAlign24.json +1 -0
- package/dist/calcite/assets/calcite-icon/leftAlign32.json +1 -0
- package/dist/calcite/assets/calcite-icon/terminal16.json +1 -0
- package/dist/calcite/assets/calcite-icon/terminal24.json +1 -0
- package/dist/calcite/assets/calcite-icon/terminal32.json +1 -0
- package/dist/calcite/assets/calcite-icon/touch16.json +1 -0
- package/dist/calcite/assets/calcite-icon/touch24.json +1 -0
- package/dist/calcite/assets/calcite-icon/touch32.json +1 -0
- package/dist/calcite/calcite.esm.js +1 -1
- package/dist/calcite/p-04bce033.entry.js +5 -0
- package/dist/calcite/p-1480eb2d.entry.js +5 -0
- package/dist/calcite/p-2cd9d307.entry.js +5 -0
- package/dist/calcite/{p-8b2d4eac.system.entry.js → p-4e95e13d.system.entry.js} +1 -1
- package/dist/calcite/p-58208234.system.entry.js +5 -0
- package/dist/calcite/p-6e050609.entry.js +5 -0
- package/dist/calcite/p-8e252799.system.js +1 -1
- package/dist/calcite/{p-f97e1a2d.entry.js → p-a57aa5d0.entry.js} +1 -1
- package/dist/calcite/p-ad617a5a.entry.js +5 -0
- package/dist/calcite/p-cb55c32c.system.entry.js +5 -0
- package/dist/calcite/p-ed82600e.system.entry.js +5 -0
- package/dist/calcite/{p-44a07313.system.entry.js → p-f7b5dd98.system.entry.js} +1 -1
- package/dist/calcite/p-fa9a1d8f.system.entry.js +5 -0
- package/dist/cjs/calcite-button.cjs.entry.js +2 -2
- package/dist/cjs/calcite-color-picker_3.cjs.entry.js +3 -3
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +4 -1
- package/dist/cjs/calcite-input-time-picker_2.cjs.entry.js +349 -223
- package/dist/cjs/calcite-option_3.cjs.entry.js +3 -1
- package/dist/cjs/calcite-panel.cjs.entry.js +3 -3
- package/dist/cjs/calcite.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/calcite-button/calcite-button.js +3 -2
- package/dist/collection/components/calcite-combobox/calcite-combobox.js +4 -1
- package/dist/collection/components/calcite-icon/assets/calcite-icon/centerAlign16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/centerAlign24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/centerAlign32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/convert16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/convert24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/convert32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/formDropdown16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/formDropdown24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/formDropdown32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/language16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/language24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/language32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/languageTranslate16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/languageTranslate24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/languageTranslate32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/leftAlign16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/leftAlign24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/leftAlign32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/terminal16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/terminal24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/terminal32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/touch16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/touch24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/touch32.json +1 -0
- package/dist/collection/components/calcite-input-time-picker/calcite-input-time-picker.js +81 -76
- package/dist/collection/components/calcite-option/calcite-option.js +3 -1
- package/dist/collection/components/calcite-panel/calcite-panel.js +3 -3
- package/dist/collection/components/calcite-time-picker/calcite-time-picker.css +56 -91
- package/dist/collection/components/calcite-time-picker/calcite-time-picker.js +254 -289
- package/dist/collection/components/calcite-time-picker/resources.js +15 -9
- package/dist/collection/utils/time.js +144 -36
- package/dist/components/calcite-button2.js +2 -2
- package/dist/components/calcite-color-picker-swatch2.js +3 -3
- package/dist/components/calcite-combobox.js +4 -1
- package/dist/components/calcite-input-time-picker.js +51 -48
- package/dist/components/calcite-option.js +3 -1
- package/dist/components/calcite-panel.js +3 -3
- package/dist/components/calcite-time-picker2.js +320 -187
- package/dist/custom-elements/index.js +366 -235
- package/dist/esm/calcite-button.entry.js +2 -2
- package/dist/esm/calcite-color-picker_3.entry.js +3 -3
- package/dist/esm/calcite-combobox_3.entry.js +4 -1
- package/dist/esm/calcite-input-time-picker_2.entry.js +349 -223
- package/dist/esm/calcite-option_3.entry.js +3 -1
- package/dist/esm/calcite-panel.entry.js +3 -3
- package/dist/esm/calcite.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/calcite-button.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-input-time-picker_2.entry.js +2 -2
- package/dist/esm-es5/calcite-option_3.entry.js +1 -1
- package/dist/esm-es5/calcite-panel.entry.js +1 -1
- package/dist/esm-es5/calcite.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/extras/docs-json.json +22 -100
- package/dist/types/components/calcite-input-time-picker/calcite-input-time-picker.d.ts +12 -4
- package/dist/types/components/calcite-panel/calcite-panel.d.ts +1 -1
- package/dist/types/components/calcite-time-picker/calcite-time-picker.d.ts +35 -23
- package/dist/types/components/calcite-time-picker/resources.d.ts +14 -8
- package/dist/types/components.d.ts +16 -40
- package/dist/types/utils/time.d.ts +18 -5
- package/hydrate/index.js +384 -243
- package/package.json +10 -10
- package/readme.md +2 -2
- package/dist/calcite/p-12a9599d.system.entry.js +0 -5
- package/dist/calcite/p-2b137143.system.entry.js +0 -5
- package/dist/calcite/p-35c5e6bd.entry.js +0 -5
- package/dist/calcite/p-88784777.system.entry.js +0 -5
- package/dist/calcite/p-9634f89d.entry.js +0 -5
- package/dist/calcite/p-a98e5444.system.entry.js +0 -5
- package/dist/calcite/p-e1da1646.entry.js +0 -5
- package/dist/calcite/p-e78e743b.entry.js +0 -5
- package/dist/calcite/p-fccc1605.entry.js +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"M15 1H1a1.002 1.002 0 0 0-1 1v12a1.001 1.001 0 0 0 1 1h14a1 1 0 0 0 1-1V2a1.001 1.001 0 0 0-1-1zm0 13H1V2h14zM3.318 10.328l-.707-.707L4.714 7.52 2.61 5.417l.707-.707 2.81 2.81zM11 10H7V9h4z"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"M21.5 3h-19A1.504 1.504 0 0 0 1 4.5v15A1.5 1.5 0 0 0 2.5 21h19a1.5 1.5 0 0 0 1.5-1.5v-15A1.504 1.504 0 0 0 21.5 3zm.5 16.5a.501.501 0 0 1-.5.5h-19a.501.501 0 0 1-.5-.5v-15a.506.506 0 0 1 .5-.5h19a.506.506 0 0 1 .5.5zM5.354 15.354l-.707-.707L7.793 11.5 4.646 8.354l.707-.707L9.207 11.5zM15 15h-5v-1h5z"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"M28 5H4a2.003 2.003 0 0 0-2 2v18a2.001 2.001 0 0 0 2 2h24a2.001 2.001 0 0 0 2-2V7a2.003 2.003 0 0 0-2-2zm1 20a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h24a1 1 0 0 1 1 1zM7.354 19.354l-.707-.707L9.793 15.5l-3.147-3.146.707-.707 3.854 3.853zM18 20h-6v-1h6z"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"M8 2.904H7V1.08h1zm3.048-.245l-.7-.713-1.373 1.349.701.713zm1.913 7.411a.935.935 0 0 0-1.011-.97 1.23 1.23 0 0 0-.397.066l-.026-.013a1.16 1.16 0 0 0-.827-.32 1.39 1.39 0 0 0-.211.034A1.098 1.098 0 0 0 9.35 8a1.47 1.47 0 0 0-.35.063V5.437a1.867 1.867 0 0 0-.42-1.377 1.645 1.645 0 0 0-2.147-.002A1.944 1.944 0 0 0 6 5.5v3.908L4.953 8.396a1.242 1.242 0 0 0-1.527-.303 1.11 1.11 0 0 0-.405 1.497l1.534 3.288 1.802 2.307.786-.62-1.706-2.162-1.53-3.274a.125.125 0 0 1 .02-.171c.106-.058.305.132.329.155L7 11.766V5.44a1.096 1.096 0 0 1 .142-.678.684.684 0 0 1 .725 0c.14.142.136.481.133.738V11h1V9.417C9 9 9.202 9 9.35 9c.174 0 .325 0 .325.417V10h.9v-.156a.654.654 0 0 1 .125-.011c.082 0 .125.022.125.042v.292h1c0-.037.22-.054.263-.06A25.262 25.262 0 0 1 12 13.594a12.327 12.327 0 0 1-.55 1.818l.858.287a15.775 15.775 0 0 0 .541-1.891A12.236 12.236 0 0 0 13 11.553a28.619 28.619 0 0 0-.04-1.483zM6.025 3.295L4.653 1.946l-.701.713 1.372 1.349z"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"M12.503 4.142l-.707-.707L13.3 1.932l.707.707zM10 1.134H9v2.833h1zm-2.86 2.3L5.637 1.933l-.707.707 1.503 1.503zm11.835 10.788a1.418 1.418 0 0 0-1.466-1.489 4.475 4.475 0 0 0-.693.064l-.042-.016A1.388 1.388 0 0 0 15.478 12a1.788 1.788 0 0 0-.587.064A1.84 1.84 0 0 0 13 11.06a2.768 2.768 0 0 0-1 .167V6.9a1.905 1.905 0 0 0-2-1.846A1.905 1.905 0 0 0 8 6.9v6.954L6.979 12.64a1.624 1.624 0 0 0-1.066-.733 1.775 1.775 0 0 0-1.264.161 1.478 1.478 0 0 0-.71.968 1.588 1.588 0 0 0 .167 1.137l2.154 4.38 3.32 4.064.773-.635-3.221-3.921-2.144-4.359a.619.619 0 0 1-.074-.446.485.485 0 0 1 .235-.322.796.796 0 0 1 .543-.051.708.708 0 0 1 .47.328L9 16.6V6.9a.908.908 0 0 1 1-.846.908.908 0 0 1 1 .846V14h1v-1.379c0-.373.336-.562 1-.562.374 0 1 .073 1 .562V14h1v-.563c0-.36.111-.47.478-.47.507 0 .522.684.522.762v1.063h1V13.76l-.005.002.005-.008v.006c.011-.005.362-.027.508-.027.129 0 .492.156.492.761.022.245 0 2.992 0 4.093a7.863 7.863 0 0 1-.463 2.657c-.16.421-.56 1.221-.56 1.221l.918.43s.272-.606.398-.925a7.32 7.32 0 0 0 .471-1.57A26.038 26.038 0 0 0 19 17.07z"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"M16.9 6.687l-.707-.707 1.99-1.99.706.707zM15 1h-1v3.953h1zm11 17.814A1.901 1.901 0 0 0 24.1 17a2.791 2.791 0 0 0-1.345.306l-.02-.015A1.903 1.903 0 0 0 20.94 16a2.54 2.54 0 0 0-1.083.207A2.02 2.02 0 0 0 18 15a2.045 2.045 0 0 0-1 .268V9.906a2.002 2.002 0 0 0-4 0v8.976l-2.242-2.993a1.957 1.957 0 0 0-2.657-.652 1.89 1.89 0 0 0-.655 2.573l3.4 6.963 3.45 5.288.839-.547-3.42-5.233-3.364-6.895a.931.931 0 0 1 .25-1.283.968.968 0 0 1 1.354.381L14 21.886V9.906a1.005 1.005 0 0 1 2 0v9.438h1v-2.456a1.005 1.005 0 0 1 2 0v2.456h1.034V17.52c0-.182 0-.521.906-.521a.907.907 0 0 1 .907.906v1.438H23v-.469c0-.505.596-.875 1.1-.875a.906.906 0 0 1 .902.874c.002.03-.002 5.427-.002 5.427a11.653 11.653 0 0 1-.188 2.523 7.87 7.87 0 0 1-1.869 3.586l.725.689a8.122 8.122 0 0 0 2.12-3.962 11.444 11.444 0 0 0 .178-1.24c.036-.417.034-.834.034-.834s.008-6.14 0-6.248zM12.811 5.84l-1.989-1.99-.707.708 1.989 1.989z"
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
4
|
*/
|
|
5
|
-
import { Component, Element, Host, h, Prop, Listen, Event, Method, Watch } from "@stencil/core";
|
|
5
|
+
import { Component, Element, Host, h, Prop, Listen, Event, Method, Watch, State } from "@stencil/core";
|
|
6
6
|
import { guid } from "../../utils/guid";
|
|
7
|
-
import {
|
|
7
|
+
import { formatTimeString, isValidTime, localizeTimeString } from "../../utils/time";
|
|
8
8
|
import { connectLabel, disconnectLabel, getLabelText } from "../../utils/label";
|
|
9
9
|
import { connectForm, disconnectForm, HiddenFormInputSlot } from "../../utils/form";
|
|
10
10
|
export class CalciteInputTimePicker {
|
|
@@ -18,8 +18,11 @@ export class CalciteInputTimePicker {
|
|
|
18
18
|
this.active = false;
|
|
19
19
|
/** The disabled state of the time input */
|
|
20
20
|
this.disabled = false;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* BCP 47 language tag for desired language and country format
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
this.locale = document.documentElement.lang || navigator.language || "en";
|
|
23
26
|
/**
|
|
24
27
|
* When true, makes the component required for form-submission.
|
|
25
28
|
*
|
|
@@ -43,56 +46,60 @@ export class CalciteInputTimePicker {
|
|
|
43
46
|
//--------------------------------------------------------------------------
|
|
44
47
|
this.calciteInputBlurHandler = () => {
|
|
45
48
|
this.active = false;
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
49
|
+
const shouldIncludeSeconds = this.shouldIncludeSeconds();
|
|
50
|
+
const localizedInputValue = localizeTimeString(this.calciteInputEl.value, this.locale, shouldIncludeSeconds);
|
|
51
|
+
this.setInputValue(localizedInputValue || localizeTimeString(this.value, this.locale, shouldIncludeSeconds));
|
|
50
52
|
};
|
|
51
53
|
this.calciteInputFocusHandler = () => {
|
|
52
54
|
this.active = true;
|
|
53
55
|
};
|
|
54
56
|
this.calciteInputInputHandler = (event) => {
|
|
55
|
-
|
|
57
|
+
const target = event.target;
|
|
58
|
+
this.setValue({ value: target.value });
|
|
59
|
+
};
|
|
60
|
+
this.timePickerChangeHandler = (event) => {
|
|
61
|
+
event.stopPropagation();
|
|
62
|
+
const target = event.target;
|
|
63
|
+
const value = target.value;
|
|
64
|
+
this.setValue({ value, origin: "time-picker" });
|
|
56
65
|
};
|
|
57
66
|
this.setCalciteInputEl = (el) => {
|
|
58
67
|
this.calciteInputEl = el;
|
|
59
68
|
};
|
|
69
|
+
this.setCalciteTimePickerEl = (el) => {
|
|
70
|
+
this.calciteTimePickerEl = el;
|
|
71
|
+
};
|
|
60
72
|
this.setInputValue = (newInputValue) => {
|
|
61
73
|
if (!this.calciteInputEl) {
|
|
62
74
|
return;
|
|
63
75
|
}
|
|
64
|
-
|
|
65
|
-
const { hour, minute, second } = parseTimeString(newInputValue);
|
|
66
|
-
this.calciteInputEl.value = newInputValue
|
|
67
|
-
? `${getMeridiemHour(hour)}:${minute}${this.step !== 60 ? ":" + second : ""} ${getMeridiem(hour)}`
|
|
68
|
-
: null;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this.calciteInputEl.value = newInputValue;
|
|
72
|
-
}
|
|
76
|
+
this.calciteInputEl.value = newInputValue;
|
|
73
77
|
};
|
|
74
78
|
this.setValue = ({ value, origin = "input" }) => {
|
|
75
79
|
const previousValue = this.value;
|
|
76
|
-
const
|
|
80
|
+
const newValue = formatTimeString(value);
|
|
81
|
+
const newLocalizedValue = localizeTimeString(newValue, this.locale, this.shouldIncludeSeconds());
|
|
77
82
|
this.internalValueChange = origin !== "external" && origin !== "loading";
|
|
78
83
|
const shouldEmit = origin !== "loading" &&
|
|
79
84
|
origin !== "external" &&
|
|
80
85
|
((value !== this.previousValidValue && !value) ||
|
|
81
|
-
!!(!this.previousValidValue &&
|
|
82
|
-
(
|
|
86
|
+
!!(!this.previousValidValue && newValue) ||
|
|
87
|
+
(newValue !== this.previousValidValue && newValue));
|
|
83
88
|
if (value) {
|
|
84
89
|
if (shouldEmit) {
|
|
85
|
-
this.previousValidValue =
|
|
90
|
+
this.previousValidValue = newValue;
|
|
86
91
|
}
|
|
87
|
-
if (
|
|
88
|
-
this.value =
|
|
92
|
+
if (newValue && newValue !== this.value) {
|
|
93
|
+
this.value = newValue;
|
|
89
94
|
}
|
|
95
|
+
this.localizedValue = newLocalizedValue;
|
|
90
96
|
}
|
|
91
97
|
else {
|
|
92
98
|
this.value = value;
|
|
99
|
+
this.localizedValue = null;
|
|
93
100
|
}
|
|
94
101
|
if (origin === "time-picker" || origin === "external") {
|
|
95
|
-
this.setInputValue(
|
|
102
|
+
this.setInputValue(newLocalizedValue);
|
|
96
103
|
}
|
|
97
104
|
if (shouldEmit) {
|
|
98
105
|
const changeEvent = this.calciteInputTimePickerChange.emit();
|
|
@@ -103,17 +110,26 @@ export class CalciteInputTimePicker {
|
|
|
103
110
|
this.previousValidValue = previousValue;
|
|
104
111
|
}
|
|
105
112
|
else {
|
|
106
|
-
this.previousValidValue =
|
|
113
|
+
this.previousValidValue = newValue;
|
|
107
114
|
}
|
|
108
115
|
}
|
|
109
116
|
};
|
|
110
117
|
}
|
|
118
|
+
localeWatcher(newLocale) {
|
|
119
|
+
this.setInputValue(localizeTimeString(this.value, newLocale, this.shouldIncludeSeconds()));
|
|
120
|
+
}
|
|
111
121
|
valueWatcher(newValue) {
|
|
112
122
|
if (!this.internalValueChange) {
|
|
113
123
|
this.setValue({ value: newValue, origin: "external" });
|
|
114
124
|
}
|
|
115
125
|
this.internalValueChange = false;
|
|
116
126
|
}
|
|
127
|
+
clickHandler(event) {
|
|
128
|
+
if (event.composedPath().includes(this.calciteTimePickerEl)) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.setFocus();
|
|
132
|
+
}
|
|
117
133
|
keyUpHandler(event) {
|
|
118
134
|
if (event.key === "Escape" && this.active) {
|
|
119
135
|
this.active = false;
|
|
@@ -124,21 +140,6 @@ export class CalciteInputTimePicker {
|
|
|
124
140
|
event.stopPropagation();
|
|
125
141
|
this.active = false;
|
|
126
142
|
}
|
|
127
|
-
timePickerChangeHandler(event) {
|
|
128
|
-
event.preventDefault();
|
|
129
|
-
event.stopPropagation();
|
|
130
|
-
if (event.detail) {
|
|
131
|
-
const { hour, minute, second } = event.detail;
|
|
132
|
-
let value;
|
|
133
|
-
if (hour && minute) {
|
|
134
|
-
value = second && this.step !== 60 ? `${hour}:${minute}:${second}` : `${hour}:${minute}`;
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
value = "";
|
|
138
|
-
}
|
|
139
|
-
this.setValue({ value, origin: "time-picker" });
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
143
|
timePickerFocusHandler(event) {
|
|
143
144
|
event.preventDefault();
|
|
144
145
|
event.stopPropagation();
|
|
@@ -161,6 +162,9 @@ export class CalciteInputTimePicker {
|
|
|
161
162
|
onLabelClick() {
|
|
162
163
|
this.setFocus();
|
|
163
164
|
}
|
|
165
|
+
shouldIncludeSeconds() {
|
|
166
|
+
return this.step < 60;
|
|
167
|
+
}
|
|
164
168
|
//--------------------------------------------------------------------------
|
|
165
169
|
//
|
|
166
170
|
// Lifecycle
|
|
@@ -168,15 +172,13 @@ export class CalciteInputTimePicker {
|
|
|
168
172
|
//--------------------------------------------------------------------------
|
|
169
173
|
connectedCallback() {
|
|
170
174
|
if (this.value) {
|
|
171
|
-
this.setValue({ value: this.value, origin: "loading" });
|
|
175
|
+
this.setValue({ value: isValidTime(this.value) ? this.value : undefined, origin: "loading" });
|
|
172
176
|
}
|
|
173
177
|
connectLabel(this);
|
|
174
178
|
connectForm(this);
|
|
175
179
|
}
|
|
176
180
|
componentDidLoad() {
|
|
177
|
-
|
|
178
|
-
this.setInputValue(this.value);
|
|
179
|
-
}
|
|
181
|
+
this.setInputValue(this.localizedValue);
|
|
180
182
|
}
|
|
181
183
|
disconnectedCallback() {
|
|
182
184
|
disconnectLabel(this);
|
|
@@ -188,13 +190,12 @@ export class CalciteInputTimePicker {
|
|
|
188
190
|
//
|
|
189
191
|
// --------------------------------------------------------------------------
|
|
190
192
|
render() {
|
|
191
|
-
const { hour, minute, second } = parseTimeString(this.value);
|
|
192
193
|
const popoverId = `${this.referenceElementId}-popover`;
|
|
193
194
|
return (h(Host, null,
|
|
194
195
|
h("div", { "aria-controls": popoverId, "aria-haspopup": "dialog", "aria-label": this.name, "aria-owns": popoverId, id: this.referenceElementId, role: "combobox" },
|
|
195
196
|
h("calcite-input", { disabled: this.disabled, icon: "clock", label: getLabelText(this), onCalciteInputBlur: this.calciteInputBlurHandler, onCalciteInputFocus: this.calciteInputFocusHandler, onCalciteInputInput: this.calciteInputInputHandler, ref: this.setCalciteInputEl, scale: this.scale, step: this.step })),
|
|
196
197
|
h("calcite-popover", { id: popoverId, label: "Time Picker", open: this.active || false, referenceElement: this.referenceElementId },
|
|
197
|
-
h("calcite-time-picker", {
|
|
198
|
+
h("calcite-time-picker", { intlHour: this.intlHour, intlHourDown: this.intlHourDown, intlHourUp: this.intlHourUp, intlMeridiem: this.intlMeridiem, intlMeridiemDown: this.intlMeridiemDown, intlMeridiemUp: this.intlMeridiemUp, intlMinute: this.intlMinute, intlMinuteDown: this.intlMinuteDown, intlMinuteUp: this.intlMinuteUp, intlSecond: this.intlSecond, intlSecondDown: this.intlSecondDown, intlSecondUp: this.intlSecondUp, lang: this.locale, onCalciteTimePickerChange: this.timePickerChangeHandler, ref: this.setCalciteTimePickerEl, scale: this.scale, step: this.step, value: this.value })),
|
|
198
199
|
h(HiddenFormInputSlot, { component: this })));
|
|
199
200
|
}
|
|
200
201
|
static get is() { return "calcite-input-time-picker"; }
|
|
@@ -242,29 +243,6 @@ export class CalciteInputTimePicker {
|
|
|
242
243
|
"reflect": true,
|
|
243
244
|
"defaultValue": "false"
|
|
244
245
|
},
|
|
245
|
-
"hourDisplayFormat": {
|
|
246
|
-
"type": "string",
|
|
247
|
-
"mutable": false,
|
|
248
|
-
"complexType": {
|
|
249
|
-
"original": "HourDisplayFormat",
|
|
250
|
-
"resolved": "\"12\" | \"24\"",
|
|
251
|
-
"references": {
|
|
252
|
-
"HourDisplayFormat": {
|
|
253
|
-
"location": "import",
|
|
254
|
-
"path": "../../utils/time"
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
"required": false,
|
|
259
|
-
"optional": false,
|
|
260
|
-
"docs": {
|
|
261
|
-
"tags": [],
|
|
262
|
-
"text": "Format of the hour value (12-hour or 24-hour) (this will be replaced by locale eventually)"
|
|
263
|
-
},
|
|
264
|
-
"attribute": "hour-display-format",
|
|
265
|
-
"reflect": false,
|
|
266
|
-
"defaultValue": "\"12\""
|
|
267
|
-
},
|
|
268
246
|
"intlHour": {
|
|
269
247
|
"type": "string",
|
|
270
248
|
"mutable": false,
|
|
@@ -469,6 +447,27 @@ export class CalciteInputTimePicker {
|
|
|
469
447
|
"attribute": "intl-second-up",
|
|
470
448
|
"reflect": false
|
|
471
449
|
},
|
|
450
|
+
"locale": {
|
|
451
|
+
"type": "string",
|
|
452
|
+
"mutable": true,
|
|
453
|
+
"complexType": {
|
|
454
|
+
"original": "string",
|
|
455
|
+
"resolved": "string",
|
|
456
|
+
"references": {}
|
|
457
|
+
},
|
|
458
|
+
"required": false,
|
|
459
|
+
"optional": false,
|
|
460
|
+
"docs": {
|
|
461
|
+
"tags": [{
|
|
462
|
+
"name": "internal",
|
|
463
|
+
"text": undefined
|
|
464
|
+
}],
|
|
465
|
+
"text": "BCP 47 language tag for desired language and country format"
|
|
466
|
+
},
|
|
467
|
+
"attribute": "lang",
|
|
468
|
+
"reflect": false,
|
|
469
|
+
"defaultValue": "document.documentElement.lang || navigator.language || \"en\""
|
|
470
|
+
},
|
|
472
471
|
"name": {
|
|
473
472
|
"type": "string",
|
|
474
473
|
"mutable": false,
|
|
@@ -567,6 +566,9 @@ export class CalciteInputTimePicker {
|
|
|
567
566
|
"defaultValue": "null"
|
|
568
567
|
}
|
|
569
568
|
}; }
|
|
569
|
+
static get states() { return {
|
|
570
|
+
"localizedValue": {}
|
|
571
|
+
}; }
|
|
570
572
|
static get events() { return [{
|
|
571
573
|
"method": "calciteInputTimePickerChange",
|
|
572
574
|
"name": "calciteInputTimePickerChange",
|
|
@@ -603,24 +605,27 @@ export class CalciteInputTimePicker {
|
|
|
603
605
|
}; }
|
|
604
606
|
static get elementRef() { return "el"; }
|
|
605
607
|
static get watchers() { return [{
|
|
608
|
+
"propName": "locale",
|
|
609
|
+
"methodName": "localeWatcher"
|
|
610
|
+
}, {
|
|
606
611
|
"propName": "value",
|
|
607
612
|
"methodName": "valueWatcher"
|
|
608
613
|
}]; }
|
|
609
614
|
static get listeners() { return [{
|
|
610
|
-
"name": "
|
|
611
|
-
"method": "
|
|
615
|
+
"name": "click",
|
|
616
|
+
"method": "clickHandler",
|
|
612
617
|
"target": undefined,
|
|
613
618
|
"capture": false,
|
|
614
619
|
"passive": false
|
|
615
620
|
}, {
|
|
616
|
-
"name": "
|
|
617
|
-
"method": "
|
|
621
|
+
"name": "keyup",
|
|
622
|
+
"method": "keyUpHandler",
|
|
618
623
|
"target": undefined,
|
|
619
624
|
"capture": false,
|
|
620
625
|
"passive": false
|
|
621
626
|
}, {
|
|
622
|
-
"name": "
|
|
623
|
-
"method": "
|
|
627
|
+
"name": "calciteTimePickerBlur",
|
|
628
|
+
"method": "timePickerBlurHandler",
|
|
624
629
|
"target": undefined,
|
|
625
630
|
"capture": false,
|
|
626
631
|
"passive": false
|
|
@@ -51,8 +51,10 @@ export class CalciteOption {
|
|
|
51
51
|
var _a;
|
|
52
52
|
this.ensureTextContentDependentProps();
|
|
53
53
|
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, {
|
|
54
|
+
attributeFilter: ["label", "value"],
|
|
55
|
+
characterData: true,
|
|
54
56
|
childList: true,
|
|
55
|
-
|
|
57
|
+
subtree: true
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
disconnectedCallback() {
|
|
@@ -63,7 +63,7 @@ export class CalcitePanel {
|
|
|
63
63
|
this.setBackRef = (node) => {
|
|
64
64
|
this.backButtonEl = node;
|
|
65
65
|
};
|
|
66
|
-
this.
|
|
66
|
+
this.panelKeyDownHandler = (event) => {
|
|
67
67
|
if (event.key === "Escape") {
|
|
68
68
|
this.dismiss();
|
|
69
69
|
}
|
|
@@ -200,12 +200,12 @@ export class CalcitePanel {
|
|
|
200
200
|
h("slot", { name: SLOTS.fab })));
|
|
201
201
|
}
|
|
202
202
|
render() {
|
|
203
|
-
const { dismissed, disabled, dismissible, el, loading,
|
|
203
|
+
const { dismissed, disabled, dismissible, el, loading, panelKeyDownHandler } = this;
|
|
204
204
|
const rtl = getElementDir(el) === "rtl";
|
|
205
205
|
const panelNode = (h("article", { "aria-busy": loading.toString(), class: {
|
|
206
206
|
[CSS.container]: true,
|
|
207
207
|
[CSS_UTILITY.rtl]: rtl
|
|
208
|
-
}, hidden: dismissible && dismissed,
|
|
208
|
+
}, hidden: dismissible && dismissed, onKeyDown: panelKeyDownHandler, ref: this.setContainerRef, tabIndex: dismissible ? 0 : -1 },
|
|
209
209
|
this.renderHeaderNode(),
|
|
210
210
|
this.renderContent(),
|
|
211
211
|
this.renderFooterSlottedContent() || this.renderFooterActions()));
|
|
@@ -85,162 +85,127 @@
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
:host {
|
|
88
|
-
color: var(--calcite-ui-text-1);
|
|
89
88
|
display: inline-block;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.time-picker {
|
|
92
|
+
background-color: var(--calcite-ui-foreground-1);
|
|
93
|
+
display: flex;
|
|
90
94
|
font-weight: var(--calcite-font-weight-medium);
|
|
95
|
+
align-items: center;
|
|
91
96
|
-webkit-user-select: none;
|
|
92
97
|
user-select: none;
|
|
98
|
+
box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);
|
|
99
|
+
color: var(--calcite-ui-text-1);
|
|
100
|
+
border-radius: var(--calcite-border-radius);
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
.time-picker {
|
|
96
|
-
box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);
|
|
97
|
-
align-items: center;
|
|
103
|
+
.time-picker .column {
|
|
98
104
|
display: flex;
|
|
99
|
-
|
|
105
|
+
flex-direction: column;
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
|
|
103
|
-
align-items: center;
|
|
108
|
+
.time-picker .button {
|
|
104
109
|
background-color: var(--calcite-ui-foreground-1);
|
|
110
|
+
cursor: pointer;
|
|
105
111
|
display: inline-flex;
|
|
112
|
+
align-items: center;
|
|
106
113
|
justify-content: center;
|
|
107
114
|
}
|
|
108
115
|
|
|
109
|
-
|
|
110
|
-
cursor: pointer;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
span.button:hover, span.button:focus {
|
|
116
|
+
.time-picker .button:hover, .time-picker .button:focus {
|
|
114
117
|
background-color: var(--calcite-ui-foreground-2);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
span.button:focus {
|
|
118
118
|
outline: 2px solid transparent;
|
|
119
119
|
outline-offset: 2px;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
.time-picker .button:active {
|
|
123
123
|
background-color: var(--calcite-ui-foreground-3);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
.time-picker .button.top-left {
|
|
127
127
|
border-top-left-radius: var(--calcite-border-radius);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
.time-picker .button.bottom-left {
|
|
131
131
|
border-bottom-left-radius: var(--calcite-border-radius);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
.time-picker .button.top-right {
|
|
135
135
|
border-top-right-radius: var(--calcite-border-radius);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
.time-picker .button.bottom-right {
|
|
139
139
|
border-bottom-right-radius: var(--calcite-border-radius);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
.time-picker .button calcite-icon {
|
|
143
143
|
color: var(--calcite-ui-text-3);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
.time-picker .input {
|
|
147
|
+
background-color: var(--calcite-ui-foreground-1);
|
|
148
|
+
cursor: pointer;
|
|
147
149
|
font-weight: var(--calcite-font-weight-medium);
|
|
148
|
-
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
149
153
|
}
|
|
150
154
|
|
|
151
|
-
|
|
155
|
+
.time-picker .input:hover {
|
|
152
156
|
box-shadow: inset 0 0 0 2px var(--calcite-ui-foreground-2);
|
|
153
157
|
}
|
|
154
158
|
|
|
155
|
-
|
|
159
|
+
.time-picker .input:focus, .time-picker .input:hover:focus {
|
|
156
160
|
outline: 2px solid transparent;
|
|
157
161
|
outline-offset: 2px;
|
|
158
162
|
box-shadow: inset 0 0 0 2px var(--calcite-ui-brand);
|
|
159
163
|
}
|
|
160
164
|
|
|
161
|
-
|
|
165
|
+
.time-picker.scale-s {
|
|
162
166
|
font-size: var(--calcite-font-size--1);
|
|
163
167
|
}
|
|
164
168
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
:
|
|
171
|
-
height: 72px;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
:host([scale=s][hour-display-format="12"]) .time-picker {
|
|
175
|
-
width: 124.2px;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
:host([scale=s][hour-display-format="12"]:not([step="60"])) .time-picker {
|
|
179
|
-
width: 168px;
|
|
169
|
+
.time-picker.scale-s .button,
|
|
170
|
+
.time-picker.scale-s .input {
|
|
171
|
+
padding-left: 0.75rem;
|
|
172
|
+
padding-right: 0.75rem;
|
|
173
|
+
padding-top: 0.25rem;
|
|
174
|
+
padding-bottom: 0.25rem;
|
|
180
175
|
}
|
|
181
176
|
|
|
182
|
-
:
|
|
183
|
-
|
|
177
|
+
.time-picker.scale-s:not(.show-meridiem) .delimiter:last-child {
|
|
178
|
+
padding-inline-end: 0.75rem;
|
|
184
179
|
}
|
|
185
180
|
|
|
186
|
-
|
|
187
|
-
width: 128.4px;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
:host([scale=m]) {
|
|
181
|
+
.time-picker.scale-m {
|
|
191
182
|
font-size: var(--calcite-font-size-0);
|
|
192
183
|
}
|
|
193
184
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
:
|
|
200
|
-
height: 96px;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
:host([scale=m][hour-display-format="12"]) .time-picker {
|
|
204
|
-
width: 136.8px;
|
|
185
|
+
.time-picker.scale-m .button,
|
|
186
|
+
.time-picker.scale-m .input {
|
|
187
|
+
padding-left: 1rem;
|
|
188
|
+
padding-right: 1rem;
|
|
189
|
+
padding-top: 0.5rem;
|
|
190
|
+
padding-bottom: 0.5rem;
|
|
205
191
|
}
|
|
206
192
|
|
|
207
|
-
|
|
208
|
-
|
|
193
|
+
.time-picker.scale-m:not(.show-meridiem) .delimiter:last-child {
|
|
194
|
+
padding-inline-end: 1rem;
|
|
209
195
|
}
|
|
210
196
|
|
|
211
|
-
|
|
212
|
-
width: 92.8px;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
:host([scale=m][hour-display-format="24"]:not([step="60"])) .time-picker {
|
|
216
|
-
width: 141.6px;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
:host([scale=l]) {
|
|
197
|
+
.time-picker.scale-l {
|
|
220
198
|
font-size: var(--calcite-font-size-1);
|
|
221
199
|
}
|
|
222
200
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
:
|
|
229
|
-
height: 144px;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
:host([scale=l][hour-display-format="12"]) .time-picker {
|
|
233
|
-
width: 198px;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
:host([scale=l][hour-display-format="12"]:not([step="60"])) .time-picker {
|
|
237
|
-
width: 268px;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
:host([scale=l][hour-display-format="24"]) .time-picker {
|
|
241
|
-
width: 134px;
|
|
201
|
+
.time-picker.scale-l .button,
|
|
202
|
+
.time-picker.scale-l .input {
|
|
203
|
+
padding-left: 1.25rem;
|
|
204
|
+
padding-right: 1.25rem;
|
|
205
|
+
padding-top: 0.75rem;
|
|
206
|
+
padding-bottom: 0.75rem;
|
|
242
207
|
}
|
|
243
208
|
|
|
244
|
-
|
|
245
|
-
|
|
209
|
+
.time-picker.scale-l:not(.show-meridiem) .delimiter:last-child {
|
|
210
|
+
padding-inline-end: 1.25rem;
|
|
246
211
|
}
|