@warp-ds/elements 2.2.0-next.2 → 2.2.0-next.3
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/index.js +3426 -444
- package/dist/index.js.map +4 -4
- package/dist/packages/affix/index.d.ts +1 -1
- package/dist/packages/affix/index.js +6 -6
- package/dist/packages/affix/index.js.map +2 -2
- package/dist/packages/alert/index.d.ts +3 -4
- package/dist/packages/alert/index.js +8 -8
- package/dist/packages/alert/index.js.map +1 -1
- package/dist/packages/attention/index.d.ts +1 -1
- package/dist/packages/attention/index.js +4 -4
- package/dist/packages/attention/index.js.map +2 -2
- package/dist/packages/badge/index.d.ts +3 -2
- package/dist/packages/badge/index.js +1 -1
- package/dist/packages/badge/index.js.map +1 -1
- package/dist/packages/box/index.d.ts +5 -3
- package/dist/packages/box/index.js +1 -1
- package/dist/packages/box/index.js.map +1 -1
- package/dist/packages/breadcrumbs/index.d.ts +1 -1
- package/dist/packages/breadcrumbs/index.js +3 -3
- package/dist/packages/breadcrumbs/index.js.map +2 -2
- package/dist/packages/button/button.test.d.ts +1 -0
- package/dist/packages/button/index.d.ts +28 -52
- package/dist/packages/button/index.js +302 -6
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/card/index.d.ts +3 -2
- package/dist/packages/card/index.js +3 -3
- package/dist/packages/card/index.js.map +1 -1
- package/dist/packages/expandable/index.d.ts +1 -1
- package/dist/packages/expandable/index.js +6 -6
- package/dist/packages/expandable/index.js.map +2 -2
- package/dist/packages/modal/index.d.ts +3 -3
- package/dist/packages/modal/index.js +299 -348
- package/dist/packages/modal/index.js.map +4 -4
- package/dist/packages/modal/modal-footer.d.ts +2 -2
- package/dist/packages/modal/modal-header.d.ts +12 -20
- package/dist/packages/modal/modal-main.d.ts +14 -24
- package/dist/packages/pill/index.d.ts +1 -1
- package/dist/packages/pill/index.js +5 -5
- package/dist/packages/pill/index.js.map +2 -2
- package/dist/packages/select/index.d.ts +12 -2
- package/dist/packages/select/index.js +304 -7
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/styles.d.ts +2 -0
- package/dist/packages/textfield/index.d.ts +5 -5
- package/dist/packages/textfield/index.js +289 -3
- package/dist/packages/textfield/index.js.map +4 -4
- package/dist/packages/toast/index.d.ts +3 -0
- package/dist/packages/toast/index.js +7 -7
- package/dist/packages/toast/index.js.map +1 -1
- package/dist/packages/toast/toast-container.d.ts +3 -4
- package/dist/packages/toast/toast.d.ts +4 -6
- package/dist/packages/utils/expand-transition.d.ts +3 -2
- package/dist/packages/utils/index.d.ts +1 -1
- package/dist/packages/utils/unstyled-heading.d.ts +4 -3
- package/package.json +10 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const WarpTextField_base: {
|
|
1
|
+
declare const WarpTextField_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & {
|
|
2
2
|
new (): {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
};
|
|
@@ -37,9 +37,6 @@ export class WarpTextField extends WarpTextField_base {
|
|
|
37
37
|
maxLength: {
|
|
38
38
|
type: NumberConstructor;
|
|
39
39
|
};
|
|
40
|
-
name: {
|
|
41
|
-
type: StringConstructor;
|
|
42
|
-
};
|
|
43
40
|
pattern: {
|
|
44
41
|
type: StringConstructor;
|
|
45
42
|
};
|
|
@@ -58,6 +55,9 @@ export class WarpTextField extends WarpTextField_base {
|
|
|
58
55
|
value: {
|
|
59
56
|
type: StringConstructor;
|
|
60
57
|
};
|
|
58
|
+
name: {
|
|
59
|
+
type: StringConstructor;
|
|
60
|
+
};
|
|
61
61
|
_hasPrefix: {
|
|
62
62
|
state: boolean;
|
|
63
63
|
};
|
|
@@ -65,7 +65,7 @@ export class WarpTextField extends WarpTextField_base {
|
|
|
65
65
|
state: boolean;
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
static styles:
|
|
68
|
+
static styles: (import("lit").CSSResult | (import("lit").CSSResult | CSSStyleSheet | import("lit").CSSResultArray)[])[];
|
|
69
69
|
type: string;
|
|
70
70
|
get _inputStyles(): string;
|
|
71
71
|
get _helpTextStyles(): string;
|
|
@@ -15,7 +15,292 @@ var r = function() {
|
|
|
15
15
|
}, []).join(" ");
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// node_modules/.pnpm/@
|
|
18
|
+
// node_modules/.pnpm/@open-wc+form-control@1.0.0/node_modules/@open-wc/form-control/src/FormControlMixin.js
|
|
19
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
20
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
21
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
22
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
23
|
+
};
|
|
24
|
+
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
25
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
26
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
27
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
28
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
29
|
+
};
|
|
30
|
+
function FormControlMixin(SuperClass) {
|
|
31
|
+
var _FormControl_instances, _FormControl_focused, _FormControl_forceError, _FormControl_touched, _FormControl_abortController, _FormControl_previousAbortController, _FormControl_awaitingValidationTarget, _FormControl_formValidationGroup_get, _FormControl_value, _FormControl_onFocus, _FormControl_onBlur, _FormControl_onInvalid, _FormControl_validationCompleteResolver, _FormControl_isValidationPending, _FormControl_validationComplete, _FormControl_shouldShowError, _FormControl_runValidators, _FormControl_setValidityWithOptionalTarget, _FormControl_getValidatorMessageForValue;
|
|
32
|
+
class FormControl extends SuperClass {
|
|
33
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
34
|
+
constructor(...args) {
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
super(...args);
|
|
37
|
+
_FormControl_instances.add(this);
|
|
38
|
+
this.internals = this.attachInternals();
|
|
39
|
+
_FormControl_focused.set(this, false);
|
|
40
|
+
_FormControl_forceError.set(this, false);
|
|
41
|
+
_FormControl_touched.set(this, false);
|
|
42
|
+
_FormControl_abortController.set(this, void 0);
|
|
43
|
+
_FormControl_previousAbortController.set(this, void 0);
|
|
44
|
+
_FormControl_awaitingValidationTarget.set(this, true);
|
|
45
|
+
_FormControl_value.set(this, "");
|
|
46
|
+
_FormControl_onFocus.set(this, () => {
|
|
47
|
+
__classPrivateFieldSet(this, _FormControl_touched, true, "f");
|
|
48
|
+
__classPrivateFieldSet(this, _FormControl_focused, true, "f");
|
|
49
|
+
__classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
|
|
50
|
+
});
|
|
51
|
+
_FormControl_onBlur.set(this, () => {
|
|
52
|
+
__classPrivateFieldSet(this, _FormControl_focused, false, "f");
|
|
53
|
+
__classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_runValidators).call(this, this.shouldFormValueUpdate() ? __classPrivateFieldGet(this, _FormControl_value, "f") : "");
|
|
54
|
+
if (!this.validity.valid && __classPrivateFieldGet(this, _FormControl_touched, "f")) {
|
|
55
|
+
__classPrivateFieldSet(this, _FormControl_forceError, true, "f");
|
|
56
|
+
}
|
|
57
|
+
const showError = __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
|
|
58
|
+
if (this.validationMessageCallback) {
|
|
59
|
+
this.validationMessageCallback(showError ? this.internals.validationMessage : "");
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
_FormControl_onInvalid.set(this, () => {
|
|
63
|
+
var _a2;
|
|
64
|
+
if (__classPrivateFieldGet(this, _FormControl_awaitingValidationTarget, "f") && this.validationTarget) {
|
|
65
|
+
this.internals.setValidity(this.validity, this.validationMessage, this.validationTarget);
|
|
66
|
+
__classPrivateFieldSet(this, _FormControl_awaitingValidationTarget, false, "f");
|
|
67
|
+
}
|
|
68
|
+
__classPrivateFieldSet(this, _FormControl_touched, true, "f");
|
|
69
|
+
__classPrivateFieldSet(this, _FormControl_forceError, true, "f");
|
|
70
|
+
__classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
|
|
71
|
+
(_a2 = this === null || this === void 0 ? void 0 : this.validationMessageCallback) === null || _a2 === void 0 ? void 0 : _a2.call(this, this.showError ? this.internals.validationMessage : "");
|
|
72
|
+
});
|
|
73
|
+
_FormControl_validationCompleteResolver.set(this, void 0);
|
|
74
|
+
_FormControl_isValidationPending.set(this, false);
|
|
75
|
+
_FormControl_validationComplete.set(this, Promise.resolve());
|
|
76
|
+
(_a = this.addEventListener) === null || _a === void 0 ? void 0 : _a.call(this, "focus", __classPrivateFieldGet(this, _FormControl_onFocus, "f"));
|
|
77
|
+
(_b = this.addEventListener) === null || _b === void 0 ? void 0 : _b.call(this, "blur", __classPrivateFieldGet(this, _FormControl_onBlur, "f"));
|
|
78
|
+
(_c = this.addEventListener) === null || _c === void 0 ? void 0 : _c.call(this, "invalid", __classPrivateFieldGet(this, _FormControl_onInvalid, "f"));
|
|
79
|
+
this.setValue(null);
|
|
80
|
+
}
|
|
81
|
+
/** Wires up control instances to be form associated */
|
|
82
|
+
static get formAssociated() {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
static get validators() {
|
|
86
|
+
return this.formControlValidators || [];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Allows the FormControl instance to respond to Validator attributes.
|
|
90
|
+
* For instance, if a given Validator has a `required` attribute, that
|
|
91
|
+
* validator will be evaluated whenever the host's required attribute
|
|
92
|
+
* is updated.
|
|
93
|
+
*/
|
|
94
|
+
static get observedAttributes() {
|
|
95
|
+
const validatorAttributes = this.validators.map((validator) => validator.attribute).flat();
|
|
96
|
+
const observedAttributes = super.observedAttributes || [];
|
|
97
|
+
const attributeSet = /* @__PURE__ */ new Set([...observedAttributes, ...validatorAttributes]);
|
|
98
|
+
return [...attributeSet];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Return the validator associated with a given attribute. If no
|
|
102
|
+
* Validator is associated with the attribute, it will return null.
|
|
103
|
+
*/
|
|
104
|
+
static getValidator(attribute) {
|
|
105
|
+
return this.validators.find((validator) => validator.attribute === attribute) || null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get all validators that are set to react to a given attribute
|
|
109
|
+
* @param {string} attribute - The attribute that has changed
|
|
110
|
+
* @returns {Validator[]}
|
|
111
|
+
*/
|
|
112
|
+
static getValidators(attribute) {
|
|
113
|
+
return this.validators.filter((validator) => {
|
|
114
|
+
var _a;
|
|
115
|
+
if (validator.attribute === attribute || ((_a = validator.attribute) === null || _a === void 0 ? void 0 : _a.includes(attribute))) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/** Return a reference to the control's form */
|
|
121
|
+
get form() {
|
|
122
|
+
return this.internals.form;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Will return true if it is recommended that the control shows an internal
|
|
126
|
+
* error. If using this property, it is wise to listen for 'invalid' events
|
|
127
|
+
* on the element host and call preventDefault on the event. Doing this will
|
|
128
|
+
* prevent browsers from showing a validation popup.
|
|
129
|
+
*/
|
|
130
|
+
get showError() {
|
|
131
|
+
return __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Forward the internals checkValidity method
|
|
135
|
+
* will return the valid state of the control.
|
|
136
|
+
*/
|
|
137
|
+
checkValidity() {
|
|
138
|
+
return this.internals.checkValidity();
|
|
139
|
+
}
|
|
140
|
+
/** The element's validity state */
|
|
141
|
+
get validity() {
|
|
142
|
+
return this.internals.validity;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The validation message shown by a given Validator object. If the control
|
|
146
|
+
* is in a valid state this should be falsy.
|
|
147
|
+
*/
|
|
148
|
+
get validationMessage() {
|
|
149
|
+
return this.internals.validationMessage;
|
|
150
|
+
}
|
|
151
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
152
|
+
var _a;
|
|
153
|
+
(_a = super.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.call(this, name, oldValue, newValue);
|
|
154
|
+
const proto = this.constructor;
|
|
155
|
+
const validators = proto.getValidators(name);
|
|
156
|
+
if ((validators === null || validators === void 0 ? void 0 : validators.length) && this.validationTarget) {
|
|
157
|
+
this.setValue(__classPrivateFieldGet(this, _FormControl_value, "f"));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** PUBLIC LIFECYCLE METHODS */
|
|
161
|
+
/**
|
|
162
|
+
* Sets the control's form value if the call to `shouldFormValueUpdate`
|
|
163
|
+
* returns `true`.
|
|
164
|
+
* @param value {FormValue} - The value to pass to the form
|
|
165
|
+
*/
|
|
166
|
+
setValue(value) {
|
|
167
|
+
var _a;
|
|
168
|
+
__classPrivateFieldSet(this, _FormControl_forceError, false, "f");
|
|
169
|
+
(_a = this.validationMessageCallback) === null || _a === void 0 ? void 0 : _a.call(this, "");
|
|
170
|
+
__classPrivateFieldSet(this, _FormControl_value, value, "f");
|
|
171
|
+
const valueShouldUpdate = this.shouldFormValueUpdate();
|
|
172
|
+
const valueToUpdate = valueShouldUpdate ? value : null;
|
|
173
|
+
this.internals.setFormValue(valueToUpdate);
|
|
174
|
+
__classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_runValidators).call(this, valueToUpdate);
|
|
175
|
+
if (this.valueChangedCallback) {
|
|
176
|
+
this.valueChangedCallback(valueToUpdate);
|
|
177
|
+
}
|
|
178
|
+
__classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* This method can be overridden to determine if the control's form value
|
|
182
|
+
* should be set on a call to `setValue`. An example of when a user might want
|
|
183
|
+
* to skip this step is when implementing checkbox-like behavior, first checking
|
|
184
|
+
* to see if `this.checked` is set to a truthy value. By default this returns
|
|
185
|
+
* `true`.
|
|
186
|
+
*/
|
|
187
|
+
shouldFormValueUpdate() {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
/** A promise that will resolve when all pending validations are complete */
|
|
191
|
+
get validationComplete() {
|
|
192
|
+
return new Promise((resolve) => resolve(__classPrivateFieldGet(this, _FormControl_validationComplete, "f")));
|
|
193
|
+
}
|
|
194
|
+
/** Reset control state when the form is reset */
|
|
195
|
+
formResetCallback() {
|
|
196
|
+
var _a, _b;
|
|
197
|
+
__classPrivateFieldSet(this, _FormControl_touched, false, "f");
|
|
198
|
+
__classPrivateFieldSet(this, _FormControl_forceError, false, "f");
|
|
199
|
+
__classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
|
|
200
|
+
(_a = this.resetFormControl) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
201
|
+
(_b = this.validationMessageCallback) === null || _b === void 0 ? void 0 : _b.call(this, __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this) ? this.validationMessage : "");
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
_FormControl_focused = /* @__PURE__ */ new WeakMap(), _FormControl_forceError = /* @__PURE__ */ new WeakMap(), _FormControl_touched = /* @__PURE__ */ new WeakMap(), _FormControl_abortController = /* @__PURE__ */ new WeakMap(), _FormControl_previousAbortController = /* @__PURE__ */ new WeakMap(), _FormControl_awaitingValidationTarget = /* @__PURE__ */ new WeakMap(), _FormControl_value = /* @__PURE__ */ new WeakMap(), _FormControl_onFocus = /* @__PURE__ */ new WeakMap(), _FormControl_onBlur = /* @__PURE__ */ new WeakMap(), _FormControl_onInvalid = /* @__PURE__ */ new WeakMap(), _FormControl_validationCompleteResolver = /* @__PURE__ */ new WeakMap(), _FormControl_isValidationPending = /* @__PURE__ */ new WeakMap(), _FormControl_validationComplete = /* @__PURE__ */ new WeakMap(), _FormControl_instances = /* @__PURE__ */ new WeakSet(), _FormControl_formValidationGroup_get = function _FormControl_formValidationGroup_get2() {
|
|
205
|
+
const rootNode = this.getRootNode();
|
|
206
|
+
const selector = `${this.localName}[name="${this.getAttribute("name")}"]`;
|
|
207
|
+
return rootNode.querySelectorAll(selector);
|
|
208
|
+
}, _FormControl_shouldShowError = function _FormControl_shouldShowError2() {
|
|
209
|
+
if (this.hasAttribute("disabled")) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
const showError = __classPrivateFieldGet(this, _FormControl_forceError, "f") || __classPrivateFieldGet(this, _FormControl_touched, "f") && !this.validity.valid && !__classPrivateFieldGet(this, _FormControl_focused, "f");
|
|
213
|
+
if (showError && this.internals.states) {
|
|
214
|
+
this.internals.states.add("--show-error");
|
|
215
|
+
} else if (this.internals.states) {
|
|
216
|
+
this.internals.states.delete("--show-error");
|
|
217
|
+
}
|
|
218
|
+
return showError;
|
|
219
|
+
}, _FormControl_runValidators = function _FormControl_runValidators2(value) {
|
|
220
|
+
const proto = this.constructor;
|
|
221
|
+
const validity = {};
|
|
222
|
+
const validators = proto.validators;
|
|
223
|
+
const asyncValidators = [];
|
|
224
|
+
const hasAsyncValidators = validators.some((validator) => validator.isValid instanceof Promise);
|
|
225
|
+
if (!__classPrivateFieldGet(this, _FormControl_isValidationPending, "f")) {
|
|
226
|
+
__classPrivateFieldSet(this, _FormControl_validationComplete, new Promise((resolve) => {
|
|
227
|
+
__classPrivateFieldSet(this, _FormControl_validationCompleteResolver, resolve, "f");
|
|
228
|
+
}), "f");
|
|
229
|
+
__classPrivateFieldSet(this, _FormControl_isValidationPending, true, "f");
|
|
230
|
+
}
|
|
231
|
+
if (__classPrivateFieldGet(this, _FormControl_abortController, "f")) {
|
|
232
|
+
__classPrivateFieldGet(this, _FormControl_abortController, "f").abort();
|
|
233
|
+
__classPrivateFieldSet(this, _FormControl_previousAbortController, __classPrivateFieldGet(this, _FormControl_abortController, "f"), "f");
|
|
234
|
+
}
|
|
235
|
+
const abortController = new AbortController();
|
|
236
|
+
__classPrivateFieldSet(this, _FormControl_abortController, abortController, "f");
|
|
237
|
+
let validationMessage = void 0;
|
|
238
|
+
let hasChange = false;
|
|
239
|
+
if (!validators.length) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
validators.forEach((validator) => {
|
|
243
|
+
const key = validator.key || "customError";
|
|
244
|
+
const isValid = validator.isValid(this, value, abortController.signal);
|
|
245
|
+
const isAsyncValidator = isValid instanceof Promise;
|
|
246
|
+
if (isAsyncValidator) {
|
|
247
|
+
asyncValidators.push(isValid);
|
|
248
|
+
isValid.then((isValidatorValid) => {
|
|
249
|
+
if (isValidatorValid === void 0 || isValidatorValid === null) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
validity[key] = !isValidatorValid;
|
|
253
|
+
validationMessage = __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_getValidatorMessageForValue).call(this, validator, value);
|
|
254
|
+
__classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_setValidityWithOptionalTarget).call(this, validity, validationMessage);
|
|
255
|
+
});
|
|
256
|
+
} else {
|
|
257
|
+
validity[key] = !isValid;
|
|
258
|
+
if (this.validity[key] !== !isValid) {
|
|
259
|
+
hasChange = true;
|
|
260
|
+
}
|
|
261
|
+
if (!isValid && !validationMessage) {
|
|
262
|
+
validationMessage = __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_getValidatorMessageForValue).call(this, validator, value);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
Promise.allSettled(asyncValidators).then(() => {
|
|
267
|
+
var _a;
|
|
268
|
+
if (!(abortController === null || abortController === void 0 ? void 0 : abortController.signal.aborted)) {
|
|
269
|
+
__classPrivateFieldSet(this, _FormControl_isValidationPending, false, "f");
|
|
270
|
+
(_a = __classPrivateFieldGet(this, _FormControl_validationCompleteResolver, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
if (hasChange || !hasAsyncValidators) {
|
|
274
|
+
__classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_setValidityWithOptionalTarget).call(this, validity, validationMessage);
|
|
275
|
+
}
|
|
276
|
+
}, _FormControl_setValidityWithOptionalTarget = function _FormControl_setValidityWithOptionalTarget2(validity, validationMessage) {
|
|
277
|
+
if (this.validationTarget) {
|
|
278
|
+
this.internals.setValidity(validity, validationMessage, this.validationTarget);
|
|
279
|
+
__classPrivateFieldSet(this, _FormControl_awaitingValidationTarget, false, "f");
|
|
280
|
+
} else {
|
|
281
|
+
this.internals.setValidity(validity, validationMessage);
|
|
282
|
+
if (this.internals.validity.valid) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
__classPrivateFieldSet(this, _FormControl_awaitingValidationTarget, true, "f");
|
|
286
|
+
}
|
|
287
|
+
}, _FormControl_getValidatorMessageForValue = function _FormControl_getValidatorMessageForValue2(validator, value) {
|
|
288
|
+
if (this.validityCallback) {
|
|
289
|
+
const message = this.validityCallback(validator.key || "customError");
|
|
290
|
+
if (message) {
|
|
291
|
+
return message;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (validator.message instanceof Function) {
|
|
295
|
+
return validator.message(this, value);
|
|
296
|
+
} else {
|
|
297
|
+
return validator.message;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
return FormControl;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// node_modules/.pnpm/@warp-ds+css@2.1.1_@warp-ds+uno@2.1.0_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5._43dfacbc4a7d78ad84ef685a7085e344/node_modules/@warp-ds/css/component-classes/index.js
|
|
19
304
|
var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
|
|
20
305
|
var buttonColors = {
|
|
21
306
|
primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
|
|
@@ -295,7 +580,7 @@ function kebabCaseAttributes(constructor) {
|
|
|
295
580
|
}
|
|
296
581
|
|
|
297
582
|
// packages/textfield/index.js
|
|
298
|
-
var WarpTextField = class extends kebabCaseAttributes(WarpElement) {
|
|
583
|
+
var WarpTextField = class extends FormControlMixin(kebabCaseAttributes(WarpElement)) {
|
|
299
584
|
constructor() {
|
|
300
585
|
super();
|
|
301
586
|
this.type = "text";
|
|
@@ -330,6 +615,7 @@ var WarpTextField = class extends kebabCaseAttributes(WarpElement) {
|
|
|
330
615
|
}
|
|
331
616
|
handler(e) {
|
|
332
617
|
const { name, value } = e.target;
|
|
618
|
+
this.setValue(value);
|
|
333
619
|
const event = new CustomEvent(e.type, {
|
|
334
620
|
detail: {
|
|
335
621
|
name,
|
|
@@ -393,13 +679,13 @@ __publicField(WarpTextField, "properties", {
|
|
|
393
679
|
min: { type: Number },
|
|
394
680
|
minLength: { type: Number },
|
|
395
681
|
maxLength: { type: Number },
|
|
396
|
-
name: { type: String },
|
|
397
682
|
pattern: { type: String },
|
|
398
683
|
placeholder: { type: String },
|
|
399
684
|
readOnly: { type: Boolean },
|
|
400
685
|
required: { type: Boolean },
|
|
401
686
|
type: { type: String },
|
|
402
687
|
value: { type: String },
|
|
688
|
+
name: { type: String },
|
|
403
689
|
_hasPrefix: { state: true },
|
|
404
690
|
_hasSuffix: { state: true }
|
|
405
691
|
});
|