@watermarkinsights/ripple 3.0.1 → 3.0.2-0
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/cjs/{global-ccb9500c.js → global-1e540de6.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/priv-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/ripple.cjs.js +2 -2
- package/dist/cjs/wm-datepicker.cjs.entry.js +25 -30
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.css +9 -0
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +26 -32
- package/dist/esm/{global-4f914bb2.js → global-d6b49e98.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/priv-datepicker.entry.js +1 -1
- package/dist/esm/ripple.js +2 -2
- package/dist/esm/wm-datepicker.entry.js +25 -30
- package/dist/ripple/p-129d94fa.entry.js +1 -0
- package/dist/ripple/{p-454ad552.entry.js → p-c0fe5201.entry.js} +1 -1
- package/dist/ripple/{p-69a73e86.js → p-e3843249.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +3 -3
- package/package.json +1 -1
- package/dist/cjs/app-globals-a07327ae.js +0 -47
- package/dist/cjs/css-shim-a7379e2b.js +0 -6
- package/dist/cjs/dom-3e7d9c3b.js +0 -75
- package/dist/cjs/functions-65513c61.js +0 -8360
- package/dist/cjs/global-06317e3f.js +0 -36
- package/dist/cjs/global-f6930bb0.js +0 -38
- package/dist/cjs/index-8dea8c13.js +0 -2976
- package/dist/cjs/shadow-css-09555044.js +0 -391
- package/dist/esm/app-globals-f62991a4.js +0 -45
- package/dist/esm/css-shim-bbdf0cc6.js +0 -4
- package/dist/esm/dom-1f98a75f.js +0 -73
- package/dist/esm/functions-316c1b23.js +0 -8340
- package/dist/esm/global-03372f70.js +0 -34
- package/dist/esm/global-fedbc323.js +0 -36
- package/dist/esm/index-e34aa595.js +0 -2938
- package/dist/esm/shadow-css-67b66845.js +0 -389
- package/dist/ripple/app-globals-b5693c90.js +0 -45
- package/dist/ripple/app-globals-d72c2d3c.js +0 -45
- package/dist/ripple/app-globals-f62991a4.js +0 -45
- package/dist/ripple/css-shim-bbdf0cc6.js +0 -4
- package/dist/ripple/dom-1f98a75f.js +0 -73
- package/dist/ripple/functions-316c1b23.js +0 -8340
- package/dist/ripple/http-service-5d037e16.js +0 -52
- package/dist/ripple/index-20b65f86.js +0 -2938
- package/dist/ripple/index-e34aa595.js +0 -2938
- package/dist/ripple/interfaces-50753346.js +0 -51
- package/dist/ripple/p-0c2498f4.js +0 -1
- package/dist/ripple/p-42ca2e15.entry.js +0 -1
- package/dist/ripple/p-e91befe3.js +0 -1
- package/dist/ripple/priv-chart-popover.entry.js +0 -85
- package/dist/ripple/priv-datepicker.entry.js +0 -668
- package/dist/ripple/priv-navigator-button.entry.js +0 -25
- package/dist/ripple/priv-navigator-item.entry.js +0 -30
- package/dist/ripple/ripple.css +0 -84
- package/dist/ripple/shadow-css-67b66845.js +0 -389
- package/dist/ripple/wm-action-menu.entry.js +0 -202
- package/dist/ripple/wm-button.entry.js +0 -148
- package/dist/ripple/wm-chart-slice.entry.js +0 -18
- package/dist/ripple/wm-chart.entry.js +0 -504
- package/dist/ripple/wm-datepicker.entry.js +0 -258
- package/dist/ripple/wm-input.entry.js +0 -106
- package/dist/ripple/wm-menuitem.entry.js +0 -114
- package/dist/ripple/wm-modal-footer.entry.js +0 -39
- package/dist/ripple/wm-modal-header.entry.js +0 -41
- package/dist/ripple/wm-modal.entry.js +0 -145
- package/dist/ripple/wm-navigator.entry.js +0 -275
- package/dist/ripple/wm-network-uploader.entry.js +0 -427
- package/dist/ripple/wm-option.entry.js +0 -119
- package/dist/ripple/wm-pagination.entry.js +0 -172
- package/dist/ripple/wm-search.entry.js +0 -227
- package/dist/ripple/wm-select.entry.js +0 -362
- package/dist/ripple/wm-snackbar.entry.js +0 -156
- package/dist/ripple/wm-tab-item.entry.js +0 -78
- package/dist/ripple/wm-tab-list.entry.js +0 -201
- package/dist/ripple/wm-tab-panel.entry.js +0 -38
- package/dist/ripple/wm-tag-input.entry.js +0 -534
- package/dist/ripple/wm-timepicker.entry.js +0 -382
- package/dist/ripple/wm-toggletip.entry.js +0 -124
- package/dist/ripple/wm-uploader.entry.js +0 -338
- package/dist/ripple/wm-wrapper.entry.js +0 -17
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts~ds312_tagInputMaxTags +0 -87
- package/dist/types/components.d.ts~ds312_tagInputMaxTags +0 -879
- package/dist/types/stencil-public-runtime.d.ts~ds312_tagInputMaxTags +0 -1555
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, f as Host, g as getElement } from './index-e34aa595.js';
|
|
2
|
-
import { i as intl, h as isRelatedTarget, j as checkForFocusableElInShadow, g as generateId } from './functions-316c1b23.js';
|
|
3
|
-
|
|
4
|
-
const wmDatepickerCss = "@charset \"UTF-8\";:host,wm-datepicker{font-family:inherit}:host *,wm-datepicker *{box-sizing:border-box}:host .wrapper,wm-datepicker .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-datepicker .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-datepicker .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-datepicker .wrapper.label-left{flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-datepicker .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-datepicker .wrapper.label-left .label-wrapper .label{display:flex;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-datepicker .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-datepicker .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-datepicker .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-datepicker .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-datepicker .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper,wm-datepicker .wrapper{position:relative}:host .wrapper .required,wm-datepicker .wrapper .required{color:#c4431c}:host .wrapper .inner-wrapper,wm-datepicker .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;align-items:center;height:2.5rem;border:1px solid;border-color:rgba(35, 35, 35, 0.6);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper .date-input,wm-datepicker .wrapper .inner-wrapper .date-input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;flex:1;margin:0}:host .wrapper .inner-wrapper .date-input:disabled,wm-datepicker .wrapper .inner-wrapper .date-input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper .inner-wrapper .date-input:focus,wm-datepicker .wrapper .inner-wrapper .date-input:focus{outline:none}:host .wrapper.invalid .inner-wrapper,wm-datepicker .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error,wm-datepicker .wrapper.invalid .error{margin-top:4px;margin-bottom:4px;display:block;top:100%;left:0;font-style:italic;font-size:0.875rem;color:#c0392b}:host .wrapper.focus .inner-wrapper,wm-datepicker .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}:host .user-is-tabbing .toggle:focus:not(:active),wm-datepicker .user-is-tabbing .toggle:focus:not(:active){border:none;z-index:11}";
|
|
5
|
-
|
|
6
|
-
const DatePicker = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.value = "";
|
|
10
|
-
this.disabled = false;
|
|
11
|
-
this.dateFormat = "US";
|
|
12
|
-
this.errorMessage = "";
|
|
13
|
-
this.labelPosition = "top";
|
|
14
|
-
this.label = "";
|
|
15
|
-
this.requiredField = false;
|
|
16
|
-
this.displayError = "";
|
|
17
|
-
// 1, 2, or 4 digits, separator, 1 or 2 digits, separator, then 1 or 2 or 4 digits
|
|
18
|
-
this.parsableEntry = /^(\d{1}|\d{2}|\d{4})[\-\.\/]\d{1,2}[\-\.\/](\d{1}|\d{2}|\d{4})$/;
|
|
19
|
-
this.isoEntry = /^\d\d\d\d[-]\d\d[-]\d\d$/;
|
|
20
|
-
this.eightDigitsEntry = /^\d{8}$/;
|
|
21
|
-
this.dateFormats = {
|
|
22
|
-
US: intl.formatMessage({
|
|
23
|
-
id: "date.formatUS",
|
|
24
|
-
defaultMessage: "mm/dd/yyyy",
|
|
25
|
-
}),
|
|
26
|
-
INT: intl.formatMessage({
|
|
27
|
-
id: "date.formatINT",
|
|
28
|
-
defaultMessage: "dd/mm/yyyy",
|
|
29
|
-
}),
|
|
30
|
-
ISO: intl.formatMessage({
|
|
31
|
-
id: "date.formatISO",
|
|
32
|
-
defaultMessage: "yyyy/mm/dd",
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
handleTabbingOn() {
|
|
37
|
-
this.dpWrapper && this.dpWrapper.classList.add("user-is-tabbing");
|
|
38
|
-
}
|
|
39
|
-
handleTabbingOff() {
|
|
40
|
-
this.dpWrapper && this.dpWrapper.classList.remove("user-is-tabbing");
|
|
41
|
-
}
|
|
42
|
-
handleError() {
|
|
43
|
-
if (this.errorMessage) {
|
|
44
|
-
this.generateError();
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
this.clearError();
|
|
48
|
-
this.processInput();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
handleValue() {
|
|
52
|
-
if (this.value && this.isValidDate(this.value)) {
|
|
53
|
-
this.inputEl.value = this.reformatDate(this.value, this.dateFormat);
|
|
54
|
-
this.lastValidValue = this.value;
|
|
55
|
-
}
|
|
56
|
-
else if (!this.value) {
|
|
57
|
-
this.inputEl.value = "";
|
|
58
|
-
}
|
|
59
|
-
this.processInput();
|
|
60
|
-
}
|
|
61
|
-
handleBlur(ev) {
|
|
62
|
-
// do not validate if clicking to an element that should prevent validation (e.g. close button on modal)
|
|
63
|
-
const shouldPreventValidation = this.preventValidation && isRelatedTarget(ev, this.preventValidation);
|
|
64
|
-
this.value = this.reformatDate(this.inputEl.value, "ISO");
|
|
65
|
-
if (!shouldPreventValidation) {
|
|
66
|
-
this.processInput();
|
|
67
|
-
}
|
|
68
|
-
this.dpWrapper.classList.remove("focus");
|
|
69
|
-
}
|
|
70
|
-
generateBlur() {
|
|
71
|
-
this.el.tabIndex = 0;
|
|
72
|
-
this.el.focus();
|
|
73
|
-
this.el.blur();
|
|
74
|
-
}
|
|
75
|
-
generateBlurAndFocusButton() {
|
|
76
|
-
this.generateBlur();
|
|
77
|
-
}
|
|
78
|
-
getActiveElement() {
|
|
79
|
-
return checkForFocusableElInShadow(document.activeElement);
|
|
80
|
-
}
|
|
81
|
-
/* End blur stuff. Back to our normal programming :) */
|
|
82
|
-
handleCellTriggered(ev) {
|
|
83
|
-
let dateElement = ev.detail;
|
|
84
|
-
let isoDate = dateElement.getAttribute("data-year") +
|
|
85
|
-
"-" +
|
|
86
|
-
dateElement.getAttribute("data-month") +
|
|
87
|
-
"-" +
|
|
88
|
-
dateElement.textContent;
|
|
89
|
-
this.inputEl.value = this.reformatDate(isoDate, this.dateFormat);
|
|
90
|
-
this.processInput();
|
|
91
|
-
}
|
|
92
|
-
focusHandler() {
|
|
93
|
-
this.dpWrapper.classList.add("focus");
|
|
94
|
-
}
|
|
95
|
-
processInput() {
|
|
96
|
-
//Clear error in case the user was correcting a date
|
|
97
|
-
let isoDate = "";
|
|
98
|
-
//If input is 8 digits, add slashes as a courtesy and process anyway
|
|
99
|
-
if (this.eightDigitsEntry.test(this.inputEl.value)) {
|
|
100
|
-
this.inputEl.value = this.addSlashes(this.inputEl.value);
|
|
101
|
-
}
|
|
102
|
-
// if we don't have 2 separators we can't reformat so we'll return what was passed in
|
|
103
|
-
if (this.parsableEntry.test(this.inputEl.value)) {
|
|
104
|
-
//ISO format for submission
|
|
105
|
-
isoDate = this.reformatDate(this.inputEl.value, "ISO");
|
|
106
|
-
//User-specific format for display
|
|
107
|
-
this.inputEl.value = this.reformatDate(isoDate, this.dateFormat);
|
|
108
|
-
if (this.isValidDate(isoDate)) {
|
|
109
|
-
//If there's no errorMessage on state, all errors can be cleared. If there IS an error message, it will clear any internal validation errors by overriding them.
|
|
110
|
-
if (this.errorMessage) {
|
|
111
|
-
this.generateError();
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
this.clearError();
|
|
115
|
-
}
|
|
116
|
-
//Update prop passed into calendar and current value to valid date
|
|
117
|
-
this.value = this.lastValidValue = isoDate;
|
|
118
|
-
//Create event to trigger onInput function on host element, to get the updated value
|
|
119
|
-
var event;
|
|
120
|
-
if (typeof Event === "function") {
|
|
121
|
-
event = new Event("input");
|
|
122
|
-
//IE doesn't support the "new" constructor for creating an event
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
event = document.createEvent("Event");
|
|
126
|
-
event.initEvent("input", true, true);
|
|
127
|
-
}
|
|
128
|
-
this.el.dispatchEvent(event);
|
|
129
|
-
//Prevents error from appearing if input field is empty
|
|
130
|
-
}
|
|
131
|
-
else if (this.inputEl.value.length) {
|
|
132
|
-
this.generateError();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
else if (this.inputEl.value.length || this.requiredField || this.errorMessage) {
|
|
136
|
-
this.generateError();
|
|
137
|
-
}
|
|
138
|
-
else if (!this.inputEl.value.length && !this.requiredField) {
|
|
139
|
-
this.clearError();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// this function reformats date strings to/from the storage format ONLY. US -> INT and vice versa is not supported.
|
|
143
|
-
reformatDate(date, toFormat) {
|
|
144
|
-
if (!this.parsableEntry.test(date)) {
|
|
145
|
-
return date;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
let dateArr = date.replace(/[\-\.]/gi, "/").split("/");
|
|
149
|
-
switch (toFormat) {
|
|
150
|
-
case "US":
|
|
151
|
-
case this.dateFormats["US"]:
|
|
152
|
-
return dateArr[1].padStart(2, "0") + "/" + dateArr[2].padStart(2, "0") + "/" + dateArr[0].padStart(4, "20");
|
|
153
|
-
case "INT":
|
|
154
|
-
case this.dateFormats["INT"]:
|
|
155
|
-
return dateArr[2].padStart(2, "0") + "/" + dateArr[1].padStart(2, "0") + "/" + dateArr[0].padStart(4, "20");
|
|
156
|
-
case "ISO":
|
|
157
|
-
case this.dateFormats["ISO"]:
|
|
158
|
-
if (this.dateFormat === "US" || this.dateFormat === this.dateFormats["US"]) {
|
|
159
|
-
return dateArr[2].padStart(4, "20") + "-" + dateArr[0].padStart(2, "0") + "-" + dateArr[1].padStart(2, "0");
|
|
160
|
-
}
|
|
161
|
-
else if (this.dateFormat === "INT" || this.dateFormat === this.dateFormats["INT"]) {
|
|
162
|
-
return dateArr[2].padStart(4, "20") + "-" + dateArr[1].padStart(2, "0") + "-" + dateArr[0].padStart(2, "0");
|
|
163
|
-
}
|
|
164
|
-
else if (this.dateFormat === "ISO" || this.dateFormat === this.dateFormats["ISO"]) {
|
|
165
|
-
return dateArr[0].padStart(4, "20") + "-" + dateArr[1].padStart(2, "0") + "-" + dateArr[2].padStart(2, "0");
|
|
166
|
-
}
|
|
167
|
-
default:
|
|
168
|
-
return dateArr.join("/");
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
isValidDate(input) {
|
|
173
|
-
// if it's not ISO it's not valid
|
|
174
|
-
if (!this.isoEntry.test(input)) {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
// Parse the ISO date parts to integers
|
|
179
|
-
let parts = input.split("-");
|
|
180
|
-
let day = parseInt(parts[2], 10);
|
|
181
|
-
let month = parseInt(parts[1], 10);
|
|
182
|
-
let year = parseInt(parts[0], 10);
|
|
183
|
-
// Check the ranges of month and year
|
|
184
|
-
if (year < 1000 || year > 3000 || month == 0 || month > 12)
|
|
185
|
-
return false;
|
|
186
|
-
let monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
187
|
-
// Adjust for leap years
|
|
188
|
-
if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0))
|
|
189
|
-
monthLength[1] = 29;
|
|
190
|
-
// Check the range of the day
|
|
191
|
-
return day > 0 && day <= monthLength[month - 1];
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
generateError() {
|
|
195
|
-
const requiredDateErr = intl.formatMessage({
|
|
196
|
-
id: "date.requiredDateError",
|
|
197
|
-
defaultMessage: "A date is required.",
|
|
198
|
-
});
|
|
199
|
-
const validDateErr = intl.formatMessage({
|
|
200
|
-
id: "date.invalidDate",
|
|
201
|
-
defaultMessage: "Please enter a valid date in the format {dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} iso {yyyy/mm/dd}}.",
|
|
202
|
-
}, { dateFormat: this.dateFormat.toLowerCase() });
|
|
203
|
-
if (this.errorMessage) {
|
|
204
|
-
this.displayError = this.errorMessage;
|
|
205
|
-
}
|
|
206
|
-
else if (this.inputEl.value.length) {
|
|
207
|
-
this.displayError = validDateErr;
|
|
208
|
-
}
|
|
209
|
-
else if (!this.inputEl.value.length && this.requiredField) {
|
|
210
|
-
this.displayError = requiredDateErr;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
clearError() {
|
|
214
|
-
this.displayError = "";
|
|
215
|
-
}
|
|
216
|
-
addSlashes(input) {
|
|
217
|
-
if (this.dateFormat === "ISO" || this.dateFormat === this.dateFormats["ISO"]) {
|
|
218
|
-
return input.substring(0, 4) + "/" + input.substring(4, 6) + "/" + input.substring(6);
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
return input.substring(0, 2) + "/" + input.substring(2, 4) + "/" + input.substring(4);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
componentWillLoad() {
|
|
225
|
-
if (this.label === "") {
|
|
226
|
-
throw new Error("You must include a label prop for the datepicker input (for accessibility reasons), even if the label position is none.");
|
|
227
|
-
}
|
|
228
|
-
if (this.errorMessage) {
|
|
229
|
-
this.generateError();
|
|
230
|
-
}
|
|
231
|
-
this.uid = this.el.id ? this.el.id : generateId();
|
|
232
|
-
}
|
|
233
|
-
componentDidLoad() {
|
|
234
|
-
// convert passed-in starting date from ISO to locale format, update displayed input to proper format,
|
|
235
|
-
// and update value passed into calendar so that it opens on the specified date
|
|
236
|
-
if (this.value && this.isValidDate(this.value)) {
|
|
237
|
-
this.lastValidValue = this.value;
|
|
238
|
-
this.inputEl.value = this.reformatDate(this.value, this.dateFormat);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
render() {
|
|
242
|
-
const dateFormat = intl.formatMessage({
|
|
243
|
-
id: "date.format",
|
|
244
|
-
defaultMessage: "{dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} iso {yyyy/mm/dd}}",
|
|
245
|
-
}, { dateFormat: this.dateFormat.toLowerCase() });
|
|
246
|
-
return (h(Host, { id: this.uid, onBlur: () => {
|
|
247
|
-
this.el.removeAttribute("tabindex");
|
|
248
|
-
}, "aria-busy": "false", class: `${this.displayError ? "invalid" : ""}`, invalid: this.displayError ? "true" : null }, h("div", { ref: (d) => (this.dpWrapper = d), class: `wrapper label-${this.labelPosition} ${this.displayError ? "invalid" : ""}` }, h("div", { class: "label-wrapper" }, this.labelPosition !== "none" && (h("label", { id: `datepickerLabel-${this.uid}`, htmlFor: `date-input-${this.uid}`, class: "label", title: `${this.label} (${dateFormat})` }, this.label, this.requiredField && (h("span", { "aria-hidden": "true", class: "required" }, "*"))))), h("div", null, h("div", { class: "inner-wrapper" }, h("input", { disabled: this.disabled, type: "text", id: `date-input-${this.uid}`, class: "date-input", name: "date", placeholder: dateFormat, onFocus: this.focusHandler.bind(this), onBlur: (ev) => this.handleBlur(ev), ref: (input) => (this.inputEl = input), "aria-describedby": `error-${this.uid}`, "aria-controls": `popup-${this.uid}`, "aria-label": this.label, required: this.requiredField }), h("priv-datepicker", { disabled: this.disabled, date: this.lastValidValue ? new Date(this.lastValidValue) : new Date(), parentId: this.uid })), h("div", { id: `error-${this.uid}`, class: "error", "aria-live": "assertive", "aria-atomic": "true" }, this.displayError)))));
|
|
249
|
-
}
|
|
250
|
-
get el() { return getElement(this); }
|
|
251
|
-
static get watchers() { return {
|
|
252
|
-
"errorMessage": ["handleError"],
|
|
253
|
-
"value": ["handleValue"]
|
|
254
|
-
}; }
|
|
255
|
-
};
|
|
256
|
-
DatePicker.style = wmDatepickerCss;
|
|
257
|
-
|
|
258
|
-
export { DatePicker as wm_datepicker };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, f as Host, g as getElement } from './index-e34aa595.js';
|
|
2
|
-
import { i as intl, g as generateId, h as isRelatedTarget } from './functions-316c1b23.js';
|
|
3
|
-
|
|
4
|
-
const wmInputCss = "@charset \"UTF-8\";:host,wm-input{font-family:inherit;width:100%}:host *,wm-input *{box-sizing:border-box}:host .wrapper,wm-input .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-input .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-input .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-input .wrapper.label-left{flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-input .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-input .wrapper.label-left .label-wrapper .label{display:flex;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-input .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-input .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-input .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-input .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-input .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper,wm-input .wrapper .inner-wrapper{width:100%}:host .wrapper .inputfield-wrapper,wm-input .wrapper .inputfield-wrapper{height:2.5rem;border:1px solid #4a4a4a;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;display:flex}:host .wrapper .character-count,wm-input .wrapper .character-count{display:flex;align-items:center;justify-content:center;min-width:5rem;background-color:rgba(74, 74, 74, 0.05);font-size:0.875rem;font-weight:500;align-self:stretch}:host .wrapper input,wm-input .wrapper input{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:none;font-family:inherit;font-size:0.875rem;height:100%;flex:1;padding:0.75rem 1rem;width:100%}:host .wrapper input:disabled,wm-input .wrapper input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper input:focus,wm-input .wrapper input:focus{outline:none}:host .wrapper .info,wm-input .wrapper .info{font-style:italic;line-height:100%;margin:4px 0}:host .wrapper.invalid .inputfield-wrapper,wm-input .wrapper.invalid .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error-message,wm-input .wrapper.invalid .error-message{color:#c0392b;margin:4px 0;display:block;font-style:italic;line-height:100%}:host .wrapper:focus .inputfield-wrapper,:host .wrapper.focus .inputfield-wrapper,wm-input .wrapper:focus .inputfield-wrapper,wm-input .wrapper.focus .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}:host .sr-only,wm-input .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}";
|
|
5
|
-
|
|
6
|
-
const Input = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.labelPosition = "top";
|
|
10
|
-
this.value = "";
|
|
11
|
-
this.disabled = false;
|
|
12
|
-
this.placeholder = "";
|
|
13
|
-
this.requiredField = false;
|
|
14
|
-
this.charCount = 0;
|
|
15
|
-
this.announcement = "";
|
|
16
|
-
this.uid = "";
|
|
17
|
-
this.requiredErrorMessage = intl.formatMessage({
|
|
18
|
-
id: "global.requiredError",
|
|
19
|
-
defaultMessage: "This field is required.",
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
componentWillLoad() {
|
|
23
|
-
this.uid = this.el.id ? this.el.id : generateId();
|
|
24
|
-
this.el.focus = function () {
|
|
25
|
-
if (!this.disabled) {
|
|
26
|
-
this.shadowRoot.querySelector("input").focus();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
if (!this.label) {
|
|
30
|
-
console.error("wm-input requires the label property");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
componentDidLoad() {
|
|
34
|
-
if (this.value) {
|
|
35
|
-
this.inputEl.value = this.value;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
handleKeyDown(ev) {
|
|
39
|
-
// in most browsers, onInput doesn't fire if the input's maxLength is reached
|
|
40
|
-
// to handle the case where a user continues to type after reaching the character limit, the keyDown event must be used
|
|
41
|
-
const isModifierKey = ev.ctrlKey || ev.metaKey || ev.altKey;
|
|
42
|
-
const isCharacter = /^.$/.test(ev.key) && !isModifierKey;
|
|
43
|
-
const hasReachedCharacterLimit = isCharacter && this.characterLimit && this.inputEl.value.length >= this.characterLimit;
|
|
44
|
-
if (hasReachedCharacterLimit) {
|
|
45
|
-
this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
handleBlur(ev) {
|
|
49
|
-
// do not validate if clicking to an element that should prevent validation (e.g. close button on modal)
|
|
50
|
-
const shouldPreventValidation = this.preventValidation && isRelatedTarget(ev, this.preventValidation);
|
|
51
|
-
if (this.requiredField && !shouldPreventValidation) {
|
|
52
|
-
this.errorMessage = this.updateRequiredError(this.errorMessage, this.requiredErrorMessage, this.value);
|
|
53
|
-
}
|
|
54
|
-
this.inputWrapperEl.classList.remove("focus");
|
|
55
|
-
}
|
|
56
|
-
handleInput(ev) {
|
|
57
|
-
this.value = ev.target.value;
|
|
58
|
-
this.charCount = this.value.length;
|
|
59
|
-
if (this.characterLimit && this.charCount >= this.characterLimit - 5) {
|
|
60
|
-
this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
handleFocus() {
|
|
64
|
-
this.inputWrapperEl.classList.add("focus");
|
|
65
|
-
}
|
|
66
|
-
updateRequiredError(errorMessage, requiredErrorMessage, value) {
|
|
67
|
-
const errorPresent = !!errorMessage && errorMessage !== "";
|
|
68
|
-
let newErrorMessage = errorMessage || "";
|
|
69
|
-
// no error and empty value generates required error message
|
|
70
|
-
if (!errorPresent && value === "") {
|
|
71
|
-
newErrorMessage = requiredErrorMessage;
|
|
72
|
-
}
|
|
73
|
-
// if there is an error and a value, clear error message
|
|
74
|
-
// unless it's a custom error set by the dev
|
|
75
|
-
else if (errorPresent && value !== "") {
|
|
76
|
-
if (errorMessage === requiredErrorMessage) {
|
|
77
|
-
newErrorMessage = "";
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return newErrorMessage;
|
|
81
|
-
}
|
|
82
|
-
announce(message) {
|
|
83
|
-
if (this.liveRegionEl.textContent === message) {
|
|
84
|
-
message += "\u00A0";
|
|
85
|
-
}
|
|
86
|
-
this.announcement = message;
|
|
87
|
-
}
|
|
88
|
-
generateCharacterLimitWarning(charCount, charLimit) {
|
|
89
|
-
const charactersEnteredMessage = intl.formatMessage({
|
|
90
|
-
id: "input.charactersEntered",
|
|
91
|
-
defaultMessage: "{x, number} of {y, number} characters entered.",
|
|
92
|
-
}, { x: charCount, y: charLimit });
|
|
93
|
-
const characterLimitReachedMessage = intl.formatMessage({
|
|
94
|
-
id: "input.characterLimitReached",
|
|
95
|
-
defaultMessage: "No additional characters will be entered.",
|
|
96
|
-
});
|
|
97
|
-
return `${charactersEnteredMessage}${charCount >= charLimit ? " " + characterLimitReachedMessage : ""}`;
|
|
98
|
-
}
|
|
99
|
-
render() {
|
|
100
|
-
return (h(Host, { id: this.uid }, h("div", { class: `wrapper label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}`, ref: (el) => (this.inputWrapperEl = el) }, h("div", { class: "label-wrapper" }, this.labelPosition !== "none" && (h("label", { htmlFor: `inputfield-${this.uid}`, class: "label" }, this.label, this.requiredField && (h("span", { class: "required", "aria-hidden": "true" }, "*"))))), h("div", { class: "inner-wrapper" }, h("div", { class: "inputfield-wrapper" }, h("input", { ref: (el) => (this.inputEl = el), id: `inputfield-${this.uid}`, disabled: this.disabled, "aria-label": this.label, "aria-describedby": `info-${this.uid} error-${this.uid}`, onInput: (ev) => this.handleInput(ev), onKeyDown: (ev) => this.handleKeyDown(ev), onBlur: (ev) => this.handleBlur(ev), onFocus: this.handleFocus.bind(this), placeholder: this.placeholder, autocomplete: "off", required: this.requiredField, maxLength: this.characterLimit || undefined }), this.characterLimit && typeof this.characterLimit === "number" ? (h("div", { class: "character-count" }, this.charCount, "/", this.characterLimit)) : ("")), this.info && (h("div", { id: `info-${this.uid}`, class: "info" }, this.info)), h("div", { id: `error-${this.uid}`, "aria-live": "assertive", class: "error-message", "aria-atomic": "true" }, this.errorMessage), h("div", { class: "sr-only", "aria-live": "polite", "aria-atomic": "true", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
|
|
101
|
-
}
|
|
102
|
-
get el() { return getElement(this); }
|
|
103
|
-
};
|
|
104
|
-
Input.style = wmInputCss;
|
|
105
|
-
|
|
106
|
-
export { Input as wm_input };
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-e34aa595.js';
|
|
2
|
-
import { g as getIconCodeFromName } from './interfaces-50753346.js';
|
|
3
|
-
|
|
4
|
-
const wmMenuitemCss = ":host,wm-menuitem{contain:content;font-family:inherit}:host .wrapper,wm-menuitem .wrapper{display:block;min-width:8.75rem;cursor:pointer;padding:1.25rem;border-radius:0px 0px 0px 0px;background:#fff;font-family:inherit;font-weight:500;list-style:none;border-bottom:2px solid rgba(46, 27, 70, 0.05);color:#575195;font-weight:700}:host .wrapper:focus,:host .wrapper.focus,wm-menuitem .wrapper:focus,wm-menuitem .wrapper.focus{outline:none;background:#f4f3f6}:host .wrapper:hover,wm-menuitem .wrapper:hover{background:#f4f3f6;outline:none}:host .wrapper .description,wm-menuitem .wrapper .description{color:#4a4a4a;font-size:0.875rem;padding-top:0.5rem;white-space:normal;font-weight:400}:host .wrapper[aria-disabled=true],wm-menuitem .wrapper[aria-disabled=true]{font-style:italic;color:#6b6b6b}:host .wrapper:not(:last-child),wm-menuitem .wrapper:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host ::slotted,wm-menuitem ::slotted{font-family:inherit}:host .mdi,wm-menuitem .mdi{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;margin-right:0.625rem;pointer-events:none}:host(:focus),wm-menuitem:focus{outline:none;background:#f4f3f6}:host([aria-disabled=true]),wm-menuitem[aria-disabled=true]{pointer-events:none}";
|
|
5
|
-
|
|
6
|
-
const Menuitem = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.wmMenuitemClicked = createEvent(this, "wmMenuitemClicked", 7);
|
|
10
|
-
this.wmKeyUpPressed = createEvent(this, "wmKeyUpPressed", 7);
|
|
11
|
-
this.wmKeyDownPressed = createEvent(this, "wmKeyDownPressed", 7);
|
|
12
|
-
this.wmEscKeyPressed = createEvent(this, "wmEscKeyPressed", 7);
|
|
13
|
-
this.wmHomeKeyPressed = createEvent(this, "wmHomeKeyPressed", 7);
|
|
14
|
-
this.wmEndKeyPressed = createEvent(this, "wmEndKeyPressed", 7);
|
|
15
|
-
this.wmPageDownItems = createEvent(this, "wmPageDownItems", 7);
|
|
16
|
-
this.wmPageUpItems = createEvent(this, "wmPageUpItems", 7);
|
|
17
|
-
this.wmTabKeyPressed = createEvent(this, "wmTabKeyPressed", 7);
|
|
18
|
-
this.wmLetterPressed = createEvent(this, "wmLetterPressed", 7);
|
|
19
|
-
this.disabled = false;
|
|
20
|
-
this.focused = false;
|
|
21
|
-
this.icon = undefined;
|
|
22
|
-
this.description = undefined;
|
|
23
|
-
this.descriptionCharLimit = 100;
|
|
24
|
-
this.isKeying = false;
|
|
25
|
-
}
|
|
26
|
-
toggleKeyingOn() {
|
|
27
|
-
this.isKeying = true;
|
|
28
|
-
}
|
|
29
|
-
toggleKeyingOff() {
|
|
30
|
-
this.isKeying = false;
|
|
31
|
-
}
|
|
32
|
-
handleKeydown(ev) {
|
|
33
|
-
switch (ev.key) {
|
|
34
|
-
case "ArrowUp":
|
|
35
|
-
ev.preventDefault();
|
|
36
|
-
this.wmKeyUpPressed.emit(this.el);
|
|
37
|
-
break;
|
|
38
|
-
case "ArrowDown":
|
|
39
|
-
ev.preventDefault();
|
|
40
|
-
this.wmKeyDownPressed.emit(this.el);
|
|
41
|
-
break;
|
|
42
|
-
case "Enter":
|
|
43
|
-
ev.preventDefault();
|
|
44
|
-
if (!this.disabled) {
|
|
45
|
-
this.el.click();
|
|
46
|
-
}
|
|
47
|
-
break;
|
|
48
|
-
case "Escape":
|
|
49
|
-
ev.preventDefault();
|
|
50
|
-
ev.stopPropagation(); // prevents closing of parent modal
|
|
51
|
-
this.wmEscKeyPressed.emit();
|
|
52
|
-
break;
|
|
53
|
-
case "Home":
|
|
54
|
-
ev.preventDefault();
|
|
55
|
-
this.wmHomeKeyPressed.emit();
|
|
56
|
-
break;
|
|
57
|
-
case "End":
|
|
58
|
-
ev.preventDefault();
|
|
59
|
-
this.wmEndKeyPressed.emit();
|
|
60
|
-
break;
|
|
61
|
-
case "Tab":
|
|
62
|
-
this.wmTabKeyPressed.emit();
|
|
63
|
-
break;
|
|
64
|
-
default:
|
|
65
|
-
ev.preventDefault();
|
|
66
|
-
this.wmLetterPressed.emit(ev.key);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
handleClick() {
|
|
70
|
-
if (!this.disabled) {
|
|
71
|
-
this.wmMenuitemClicked.emit();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
setOnClick() {
|
|
75
|
-
if (this.disabled && this.el.onclick) {
|
|
76
|
-
this.onClickFunc = this.el.onclick;
|
|
77
|
-
this.el.onclick = null;
|
|
78
|
-
}
|
|
79
|
-
else if (!this.disabled && this.onClickFunc) {
|
|
80
|
-
this.el.onclick = this.onClickFunc;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
componentWillLoad() {
|
|
84
|
-
if (this.icon) {
|
|
85
|
-
// in case a name was passed instead of a code, convert it to code (for backwards compatibility)
|
|
86
|
-
this.icon = getIconCodeFromName(this.icon);
|
|
87
|
-
}
|
|
88
|
-
if (this.description) {
|
|
89
|
-
if (this.description.length > this.descriptionCharLimit) {
|
|
90
|
-
console.error(`wm-menuitem description is above the character limit of ${this.descriptionCharLimit}`);
|
|
91
|
-
}
|
|
92
|
-
if (this.icon) {
|
|
93
|
-
console.error("wm-menuitems with descriptions do not support the use of icons");
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
this.setOnClick();
|
|
97
|
-
}
|
|
98
|
-
componentDidLoad() {
|
|
99
|
-
if (this.icon) {
|
|
100
|
-
this.iconEl.classList.add("mdi");
|
|
101
|
-
this.iconEl.innerHTML = `&#x${this.icon};`;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
render() {
|
|
105
|
-
return (h(Host, { tabindex: -1, role: "menuitem", "aria-disabled": this.disabled ? "true" : null }, h("div", { class: `wrapper ${this.focused && this.isKeying ? "focus" : ""}`, "aria-disabled": this.disabled ? "true" : null }, h("span", { ref: (el) => (this.iconEl = el) }), h("slot", null), this.description ? h("div", { class: "description" }, this.description) : "")));
|
|
106
|
-
}
|
|
107
|
-
get el() { return getElement(this); }
|
|
108
|
-
static get watchers() { return {
|
|
109
|
-
"disabled": ["setOnClick"]
|
|
110
|
-
}; }
|
|
111
|
-
};
|
|
112
|
-
Menuitem.style = wmMenuitemCss;
|
|
113
|
-
|
|
114
|
-
export { Menuitem as wm_menuitem };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-e34aa595.js';
|
|
2
|
-
import { j as checkForFocusableElInShadow } from './functions-316c1b23.js';
|
|
3
|
-
|
|
4
|
-
const wmModalFooterCss = "wm-modal-footer{-webkit-border-radius:0px 0px 5px 5px;-moz-border-radius:0px 0px 5px 5px;-ms-border-radius:0px 0px 5px 5px;border-radius:0px 0px 5px 5px;margin-top:-1px}wm-modal-footer .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper.footer-text{flex-direction:column;align-items:flex-start}}wm-modal-footer .wm-wrapper wm-button+wm-button{margin-left:1rem}wm-modal-footer .wm-wrapper .wm-info{font-size:0.875rem;font-style:italic}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper .wm-info{padding-bottom:0.625rem}}wm-modal-footer .wm-wrapper .wm-info:focus{outline:none}";
|
|
5
|
-
|
|
6
|
-
const ModalFooter = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.secondaryText = "";
|
|
10
|
-
this.primaryText = "";
|
|
11
|
-
this.infoText = "";
|
|
12
|
-
this.primaryActionDisabled = false;
|
|
13
|
-
this.deleteStyle = false;
|
|
14
|
-
}
|
|
15
|
-
//Trap focus when user tabs past first element in modal
|
|
16
|
-
focusLastEl() {
|
|
17
|
-
checkForFocusableElInShadow(this.lastElement).focus();
|
|
18
|
-
}
|
|
19
|
-
componentWillLoad() {
|
|
20
|
-
this.uid = this.el.parentElement.uid;
|
|
21
|
-
}
|
|
22
|
-
emitParentPrimaryEvent() {
|
|
23
|
-
const parentModal = this.el.parentElement;
|
|
24
|
-
//@ts-ignore
|
|
25
|
-
parentModal.emitPrimaryEvent();
|
|
26
|
-
}
|
|
27
|
-
emitParentSecondaryEvent() {
|
|
28
|
-
const parentModal = this.el.parentElement;
|
|
29
|
-
//@ts-ignore
|
|
30
|
-
parentModal.emitSecondaryEvent();
|
|
31
|
-
}
|
|
32
|
-
render() {
|
|
33
|
-
return (h("div", { class: `wm-wrapper ${this.infoText ? " footer-text" : ""}` }, h("div", { class: "wm-info" }, this.infoText), h("div", { class: "wm-button-collection" }, this.secondaryText && (h("wm-button", { onClick: () => this.emitParentSecondaryEvent(), id: `wm-secondary-${this.uid}`, ref: (el) => (this.primaryActionDisabled ? (this.lastElement = el) : null) }, this.secondaryText)), h("wm-button", { buttonStyle: this.deleteStyle ? "secondary" : "primary", permanentlyDelete: this.deleteStyle, onClick: () => this.emitParentPrimaryEvent(), disabled: this.primaryActionDisabled, id: `wm-primary-${this.uid}`, ref: (el) => (!this.primaryActionDisabled ? (this.lastElement = el) : null) }, this.primaryText))));
|
|
34
|
-
}
|
|
35
|
-
get el() { return getElement(this); }
|
|
36
|
-
};
|
|
37
|
-
ModalFooter.style = wmModalFooterCss;
|
|
38
|
-
|
|
39
|
-
export { ModalFooter as wm_modal_footer };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, f as Host, g as getElement } from './index-e34aa595.js';
|
|
2
|
-
import { i as intl, j as checkForFocusableElInShadow } from './functions-316c1b23.js';
|
|
3
|
-
|
|
4
|
-
const wmModalHeaderCss = "wm-modal-header{-webkit-border-radius:5px 5px 0 0px;-moz-border-radius:5px 5px 0 0px;-ms-border-radius:5px 5px 0 0px;border-radius:5px 5px 0 0px;margin-bottom:-1px}wm-modal-header .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}wm-modal-header .wm-wrapper .title{margin:0;font-weight:600;font-size:1.125rem;color:#4a4a4a;line-height:normal}wm-modal-header .wm-wrapper .title .subtitle{display:block;font-size:0.875rem;font-weight:normal}wm-modal-header .wm-wrapper .title:focus{outline:none}";
|
|
5
|
-
|
|
6
|
-
const ModalHeader = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.heading = "";
|
|
10
|
-
this.subheading = "";
|
|
11
|
-
this.closeTooltip = intl.formatMessage({
|
|
12
|
-
id: "global.closeVerb",
|
|
13
|
-
defaultMessage: "Close",
|
|
14
|
-
description: "For a button, to close a user interface element",
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
//Trap focus when user tabs past last element in modal
|
|
18
|
-
focusFirstEl() {
|
|
19
|
-
checkForFocusableElInShadow(this.firstElement).focus();
|
|
20
|
-
}
|
|
21
|
-
componentWillLoad() {
|
|
22
|
-
this.uid = this.el.parentElement.uid;
|
|
23
|
-
}
|
|
24
|
-
emitParentCloseEvent() {
|
|
25
|
-
const parentModal = this.el.parentElement;
|
|
26
|
-
//@ts-ignore
|
|
27
|
-
parentModal.emitCloseEvent();
|
|
28
|
-
}
|
|
29
|
-
// @Listen("click")
|
|
30
|
-
// directFocusOnClick() {
|
|
31
|
-
// this.headingElement.tabIndex = 0;
|
|
32
|
-
// this.headingElement.focus();
|
|
33
|
-
// }
|
|
34
|
-
render() {
|
|
35
|
-
return (h(Host, null, h("div", { class: "wm-wrapper" }, h("div", null, h("h2", { class: "title", id: `wm-modal-heading-text-${this.uid}` }, this.heading, h("span", { class: "subtitle" }, this.subheading))), h("wm-button", { "button-style": "navigational", icon: "f156", tooltip: this.closeTooltip, "tooltip-position": "left", id: `wm-modal-close-${this.uid}`, ref: (el) => (this.firstElement = el), onClick: () => this.emitParentCloseEvent() }))));
|
|
36
|
-
}
|
|
37
|
-
get el() { return getElement(this); }
|
|
38
|
-
};
|
|
39
|
-
ModalHeader.style = wmModalHeaderCss;
|
|
40
|
-
|
|
41
|
-
export { ModalHeader as wm_modal_header };
|