@warp-ds/elements 2.9.0-next.5 → 2.9.0-next.6
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/custom-elements.json +159 -97
- package/dist/docs/affix/affix.md +25 -23
- package/dist/docs/affix/api.md +25 -23
- package/dist/docs/alert/alert.md +12 -12
- package/dist/docs/alert/api.md +12 -12
- package/dist/docs/attention/api.md +46 -46
- package/dist/docs/attention/attention.md +46 -46
- package/dist/docs/badge/accessibility.md +44 -0
- package/dist/docs/badge/api.md +12 -8
- package/dist/docs/badge/badge.md +191 -10
- package/dist/docs/badge/examples.md +82 -0
- package/dist/docs/badge/usage.md +53 -0
- package/dist/docs/button/api.md +46 -42
- package/dist/docs/button/button.md +46 -42
- package/dist/docs/card/api.md +11 -11
- package/dist/docs/card/card.md +11 -11
- package/dist/docs/combobox/api.md +62 -62
- package/dist/docs/combobox/combobox.md +62 -62
- package/dist/docs/datepicker/api.md +74 -66
- package/dist/docs/datepicker/datepicker.md +74 -66
- package/dist/docs/expandable/api.md +26 -26
- package/dist/docs/expandable/expandable.md +26 -26
- package/dist/docs/link/api.md +28 -28
- package/dist/docs/link/link.md +28 -28
- package/dist/docs/page-indicator/api.md +6 -6
- package/dist/docs/page-indicator/page-indicator.md +6 -6
- package/dist/docs/pagination/api.md +3 -3
- package/dist/docs/pagination/pagination.md +3 -3
- package/dist/docs/pill/api.md +19 -15
- package/dist/docs/pill/pill.md +19 -15
- package/dist/docs/select/api.md +44 -44
- package/dist/docs/select/select.md +44 -44
- package/dist/docs/slider/api.md +80 -78
- package/dist/docs/slider/slider.md +80 -78
- package/dist/docs/slider-thumb/api.md +28 -76
- package/dist/docs/slider-thumb/slider-thumb.md +28 -76
- package/dist/docs/switch/api.md +16 -16
- package/dist/docs/switch/switch.md +16 -16
- package/dist/docs/tab/api.md +26 -40
- package/dist/docs/tab/tab.md +26 -40
- package/dist/docs/tab-panel/api.md +1 -17
- package/dist/docs/tab-panel/tab-panel.md +1 -17
- package/dist/docs/tabs/api.md +3 -3
- package/dist/docs/tabs/tabs.md +3 -3
- package/dist/docs/textarea/api.md +42 -40
- package/dist/docs/textarea/textarea.md +42 -40
- package/dist/docs/textfield/accessibility.md +15 -0
- package/dist/docs/textfield/api.md +86 -83
- package/dist/docs/textfield/examples.md +147 -0
- package/dist/docs/textfield/textfield.md +279 -86
- package/dist/docs/textfield/usage.md +30 -0
- package/dist/index.d.ts +220 -196
- package/dist/packages/badge/badge.d.ts +7 -5
- package/dist/packages/badge/badge.js.map +2 -2
- package/dist/packages/datepicker/datepicker.js +1 -1
- package/dist/packages/datepicker/datepicker.js.map +2 -2
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +9 -1
- package/dist/packages/datepicker/react.d.ts +4 -0
- package/dist/packages/datepicker/react.js +4 -0
- package/dist/packages/textfield/textfield.d.ts +57 -60
- package/dist/packages/textfield/textfield.js +5 -5
- package/dist/packages/textfield/textfield.js.map +2 -2
- package/dist/packages/textfield/textfield.react.stories.d.ts +1 -1
- package/dist/web-types.json +392 -116
- package/package.json +1 -1
|
@@ -3,13 +3,21 @@ import React from 'react';
|
|
|
3
3
|
import { DatePicker } from './react';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
|
-
render(args: Omit<React.HTMLAttributes<import("./datepicker").WarpDatepicker>, "value" | "input" | "form" | "label" | "name" | "locale" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onchange" | "updated" | "resetFormControl" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "onChange" | "month" | "calendar" | "wrapper" | "headerFormat" | "weekdayFormat" | "isDayDisabled" | "dayFormat" | "isCalendarOpen" | "navigationDate" | "selectedDate" | "weeks" | "toggleButton" | "previousMonthButton" | "todayCell" | "selectedCell"> & {
|
|
6
|
+
render(args: Omit<React.HTMLAttributes<import("./datepicker").WarpDatepicker>, "value" | "input" | "form" | "label" | "name" | "locale" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onblur" | "onchange" | "oninput" | "updated" | "resetFormControl" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "onBlur" | "onChange" | "onInput" | "month" | "calendar" | "wrapper" | "headerFormat" | "weekdayFormat" | "isDayDisabled" | "dayFormat" | "isCalendarOpen" | "navigationDate" | "selectedDate" | "weeks" | "toggleButton" | "previousMonthButton" | "todayCell" | "selectedCell"> & {
|
|
7
7
|
onChange?: (e: Event) => void;
|
|
8
8
|
onchange?: (e: Event) => void;
|
|
9
|
+
onBlur?: (e: Event) => void;
|
|
10
|
+
onblur?: (e: Event) => void;
|
|
11
|
+
onInput?: (e: Event) => void;
|
|
12
|
+
oninput?: (e: Event) => void;
|
|
9
13
|
} & Partial<Omit<import("./datepicker").WarpDatepicker, keyof HTMLElement>> & React.RefAttributes<import("./datepicker").WarpDatepicker>): React.JSX.Element;
|
|
10
14
|
component: import("@lit/react").ReactWebComponent<import("./datepicker").WarpDatepicker, {
|
|
11
15
|
onChange: string;
|
|
12
16
|
onchange: string;
|
|
17
|
+
onBlur: string;
|
|
18
|
+
onblur: string;
|
|
19
|
+
onInput: string;
|
|
20
|
+
oninput: string;
|
|
13
21
|
}>;
|
|
14
22
|
};
|
|
15
23
|
export default _default;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
2
|
declare const WarpTextField_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & typeof LitElement;
|
|
3
3
|
/**
|
|
4
|
-
* A single
|
|
4
|
+
* A single-line input component used for entering and editing textual or numeric data.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* @slot suffix - Use with `<w-affix>` to include a suffix, for example the unit for a number (e. g. km or sek).
|
|
7
|
+
* @slot prefix - Use with `<w-affix>` to include a prefix, for example a search icon.
|
|
7
8
|
*/
|
|
8
9
|
declare class WarpTextField extends WarpTextField_base {
|
|
9
10
|
#private;
|
|
11
|
+
/** @internal */
|
|
10
12
|
static shadowRootOptions: {
|
|
11
13
|
delegatesFocus: boolean;
|
|
12
14
|
mode: ShadowRootMode;
|
|
@@ -14,129 +16,124 @@ declare class WarpTextField extends WarpTextField_base {
|
|
|
14
16
|
slotAssignment?: SlotAssignmentMode;
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
+
* Keep in mind that using disabled in its current form is an anti-pattern.
|
|
20
|
+
*
|
|
21
|
+
* There will always be users who don't understand why an element is disabled, or users who can't even see that it is disabled because of poor lighting conditions or other reasons.
|
|
22
|
+
*
|
|
23
|
+
* Please consider more informative alternatives before choosing to use disabled on an element.
|
|
24
|
+
*
|
|
25
|
+
* @summary Makes the element not focusable and hides it from form submits
|
|
19
26
|
*/
|
|
20
27
|
disabled: boolean;
|
|
21
28
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
29
|
+
* Mark the form field as invalid. Make sure to also set a `help-text` to help users fix the validation problem.
|
|
30
|
+
*
|
|
31
|
+
* @summary Mark the form field as invalid.
|
|
24
32
|
*/
|
|
25
33
|
invalid: boolean;
|
|
26
34
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @description
|
|
29
|
-
*/
|
|
30
|
-
id: string;
|
|
31
|
-
/**
|
|
32
|
-
* @summary
|
|
33
|
-
* @description
|
|
35
|
+
* Either a `label` or an `aria-label` must be provided.
|
|
34
36
|
*/
|
|
35
37
|
label: string;
|
|
36
38
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
+
* Use in combination with `invalid` to show as a validation error message,
|
|
40
|
+
* or on its own to show a help text.
|
|
41
|
+
*
|
|
42
|
+
* @summary Description shown below the input field
|
|
39
43
|
*/
|
|
40
44
|
helpText: string;
|
|
41
45
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @description
|
|
46
|
+
* Sets the [size](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#size) (width) of the input field to fit the expected length of inputs.
|
|
44
47
|
*/
|
|
45
48
|
size: string;
|
|
46
49
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @description
|
|
50
|
+
* Use with `type="number"` to set the [maximum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength).
|
|
49
51
|
*/
|
|
50
52
|
max: number;
|
|
51
53
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @description
|
|
54
|
+
* Use with `type="number"` to set the [minimum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#minlength).
|
|
54
55
|
*/
|
|
55
56
|
min: number;
|
|
56
57
|
/**
|
|
57
|
-
* @
|
|
58
|
-
* @description
|
|
58
|
+
* @deprecated Use the native `minlength` attribute
|
|
59
59
|
*/
|
|
60
60
|
minLength: number;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
|
|
62
|
+
* For `text`, `search`, `url`, `tel`, `email` and `password` fields, sets the [minimum string length](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#minlength) required.
|
|
63
|
+
*/
|
|
64
|
+
minlength: number;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated Use the native `maxlength` attribute
|
|
64
67
|
*/
|
|
65
68
|
maxLength: number;
|
|
66
69
|
/**
|
|
67
|
-
*
|
|
68
|
-
|
|
70
|
+
* For `text`, `search`, `url`, `tel`, `email` and `password` fields, sets the [maximum string length](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength) allowed.
|
|
71
|
+
*/
|
|
72
|
+
maxlength: number;
|
|
73
|
+
/**
|
|
74
|
+
* Sets a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) that the input's value must [match to pass validation](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#pattern)
|
|
69
75
|
*/
|
|
70
76
|
pattern: string;
|
|
71
77
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
78
|
+
* Set a text that is shown in the textfield when it doesn't have a value.
|
|
79
|
+
*
|
|
80
|
+
* Placeholder text should not be used as a substitute for labeling the element with a visible label.
|
|
81
|
+
*
|
|
82
|
+
* @summary Shown in the textfield when it doesn't have a value
|
|
74
83
|
*/
|
|
75
84
|
placeholder: string;
|
|
76
|
-
/**
|
|
77
|
-
* @
|
|
78
|
-
* @description
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated Use the native readonly attribute instead.
|
|
79
87
|
*/
|
|
80
88
|
readOnly: boolean;
|
|
81
89
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @description
|
|
90
|
+
* Whether the input can be selected but not changed by the user.
|
|
84
91
|
*/
|
|
85
92
|
readonly: boolean;
|
|
86
93
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @description
|
|
94
|
+
* Whether user input is required on the input before form submission.
|
|
89
95
|
*/
|
|
90
96
|
required: boolean;
|
|
91
97
|
/**
|
|
92
|
-
*
|
|
93
|
-
* @description
|
|
98
|
+
* The [type of input](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types).
|
|
94
99
|
*/
|
|
95
100
|
type: string;
|
|
96
101
|
/**
|
|
97
|
-
*
|
|
98
|
-
* @description
|
|
102
|
+
* Lets you set the current value.
|
|
99
103
|
*/
|
|
100
104
|
value: string;
|
|
101
105
|
/**
|
|
102
|
-
*
|
|
103
|
-
* @description
|
|
106
|
+
* The [name](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#name) of the input field when submitting the form.
|
|
104
107
|
*/
|
|
105
108
|
name: string;
|
|
106
109
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
110
|
+
* When used with `number` this attribute forces inputs to be a whole number of `step`.
|
|
111
|
+
*
|
|
112
|
+
* For example with a `step="5"` only values that divide evenly on 5 are allowed.
|
|
113
|
+
* Using arrow up and down in the input field increments and decrements by 5.
|
|
114
|
+
*
|
|
115
|
+
* @summary Forces `number` inputs to be a whole number of `step`
|
|
109
116
|
*/
|
|
110
117
|
step: number;
|
|
111
118
|
/**
|
|
112
|
-
*
|
|
113
|
-
* @description
|
|
119
|
+
* A space-separated string that hints to browsers [what type of content it can suggest](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete#value) to autofill.
|
|
114
120
|
*/
|
|
115
121
|
autocomplete?: string;
|
|
116
122
|
/**
|
|
117
123
|
* Function to format value when the input field.
|
|
118
124
|
*
|
|
119
125
|
* Only active when the input field does not have focus,
|
|
120
|
-
* similar to the accessible input masking example from Filament Group
|
|
126
|
+
* similar to the accessible input [masking example from Filament Group](https://filamentgroup.github.io/politespace/demo/demo.html).
|
|
121
127
|
*
|
|
122
|
-
*
|
|
123
|
-
* https://
|
|
124
|
-
|
|
125
|
-
* @summary
|
|
126
|
-
* @description
|
|
128
|
+
* @summary Function to format value when the input field
|
|
129
|
+
* @link https://css-tricks.com/input-masking/
|
|
127
130
|
*/
|
|
128
131
|
formatter: (value: string) => string;
|
|
129
132
|
/** @internal */
|
|
130
133
|
mask: HTMLDivElement;
|
|
131
|
-
/** @internal
|
|
132
|
-
* @summary
|
|
133
|
-
* @description
|
|
134
|
-
*/
|
|
134
|
+
/** @internal */
|
|
135
135
|
_hasPrefix: boolean;
|
|
136
|
-
/** @internal
|
|
137
|
-
* @summary
|
|
138
|
-
* @description
|
|
139
|
-
*/
|
|
136
|
+
/** @internal */
|
|
140
137
|
_hasSuffix: boolean;
|
|
141
138
|
updated(changedProperties: PropertyValues<this>): void;
|
|
142
139
|
firstUpdated(changedProps: Map<string, unknown>): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{throw TypeError(a)};var d=(a,e,r,o)=>{for(var l=o>1?void 0:o?ae(e,r):e,u=a.length-1,w;u>=0;u--)(w=a[u])&&(l=(o?w(e,r,l):w(l))||l);return o&&l&&te(e,r,l),l};var U=(a,e,r)=>e.has(a)||R("Cannot "+r);var H=(a,e,r)=>(U(a,e,"read from private field"),r?r.call(a):e.get(a)),D=(a,e,r)=>e.has(a)?R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,r),G=(a,e,r,o)=>(U(a,e,"write to private field"),o?o.call(a,r):e.set(a,r),r);var j=function(){for(var a=[],e=arguments.length;e--;)a[e]=arguments[e];return a.reduce(function(r,o){return r.concat(typeof o=="string"?o:Array.isArray(o)?j.apply(void 0,o):typeof o=="object"&&o?Object.keys(o).map(function(l){return o[l]?l:""}):"")},[]).join(" ")};var
|
|
1
|
+
var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{throw TypeError(a)};var d=(a,e,r,o)=>{for(var l=o>1?void 0:o?ae(e,r):e,u=a.length-1,w;u>=0;u--)(w=a[u])&&(l=(o?w(e,r,l):w(l))||l);return o&&l&&te(e,r,l),l};var U=(a,e,r)=>e.has(a)||R("Cannot "+r);var H=(a,e,r)=>(U(a,e,"read from private field"),r?r.call(a):e.get(a)),D=(a,e,r)=>e.has(a)?R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,r),G=(a,e,r,o)=>(U(a,e,"write to private field"),o?o.call(a,r):e.set(a,r),r);var j=function(){for(var a=[],e=arguments.length;e--;)a[e]=arguments[e];return a.reduce(function(r,o){return r.concat(typeof o=="string"?o:Array.isArray(o)?j.apply(void 0,o):typeof o=="object"&&o?Object.keys(o).map(function(l){return o[l]?l:""}):"")},[]).join(" ")};var s=function(a,e,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?a!==e||!o:!e.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(a):o?o.value:e.get(a)},h=function(a,e,r,o,l){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!l)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?a!==e||!l:!e.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?l.call(a,r):l?l.value=r:e.set(a,r),r};function J(a){var e,r,o,l,u,w,k,re,_,A,F,L,E,z,Y,f,X,N,O;class oe extends a{constructor(...t){var n,b,p;super(...t),e.add(this),this.internals=this.attachInternals(),r.set(this,!1),o.set(this,!1),l.set(this,!1),u.set(this,void 0),w.set(this,void 0),k.set(this,!0),_.set(this,""),A.set(this,()=>{h(this,l,!0,"f"),h(this,r,!0,"f"),s(this,e,"m",f).call(this)}),F.set(this,()=>{h(this,r,!1,"f"),s(this,e,"m",X).call(this,this.shouldFormValueUpdate()?s(this,_,"f"):""),!this.validity.valid&&s(this,l,"f")&&h(this,o,!0,"f");let m=s(this,e,"m",f).call(this);this.validationMessageCallback&&this.validationMessageCallback(m?this.internals.validationMessage:"")}),L.set(this,()=>{var m;s(this,k,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),h(this,k,!1,"f")),h(this,l,!0,"f"),h(this,o,!0,"f"),s(this,e,"m",f).call(this),(m=this===null||this===void 0?void 0:this.validationMessageCallback)===null||m===void 0||m.call(this,this.showError?this.internals.validationMessage:"")}),E.set(this,void 0),z.set(this,!1),Y.set(this,Promise.resolve()),(n=this.addEventListener)===null||n===void 0||n.call(this,"focus",s(this,A,"f")),(b=this.addEventListener)===null||b===void 0||b.call(this,"blur",s(this,F,"f")),(p=this.addEventListener)===null||p===void 0||p.call(this,"invalid",s(this,L,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let t=this.validators.map(p=>p.attribute).flat(),n=super.observedAttributes||[];return[...new Set([...n,...t])]}static getValidator(t){return this.validators.find(n=>n.attribute===t)||null}static getValidators(t){return this.validators.filter(n=>{var b;if(n.attribute===t||!((b=n.attribute)===null||b===void 0)&&b.includes(t))return!0})}get form(){return this.internals.form}get showError(){return s(this,e,"m",f).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(t,n,b){var p;(p=super.attributeChangedCallback)===null||p===void 0||p.call(this,t,n,b);let $=this.constructor.getValidators(t);$!=null&&$.length&&this.validationTarget&&this.setValue(s(this,_,"f"))}setValue(t){var n;h(this,o,!1,"f"),(n=this.validationMessageCallback)===null||n===void 0||n.call(this,""),h(this,_,t,"f");let p=this.shouldFormValueUpdate()?t:null;this.internals.setFormValue(p),s(this,e,"m",X).call(this,p),this.valueChangedCallback&&this.valueChangedCallback(p),s(this,e,"m",f).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(t=>t(s(this,Y,"f")))}formResetCallback(){var t,n;h(this,l,!1,"f"),h(this,o,!1,"f"),s(this,e,"m",f).call(this),(t=this.resetFormControl)===null||t===void 0||t.call(this),(n=this.validationMessageCallback)===null||n===void 0||n.call(this,s(this,e,"m",f).call(this)?this.validationMessage:"")}}return r=new WeakMap,o=new WeakMap,l=new WeakMap,u=new WeakMap,w=new WeakMap,k=new WeakMap,_=new WeakMap,A=new WeakMap,F=new WeakMap,L=new WeakMap,E=new WeakMap,z=new WeakMap,Y=new WeakMap,e=new WeakSet,re=function(){let t=this.getRootNode(),n=`${this.localName}[name="${this.getAttribute("name")}"]`;return t.querySelectorAll(n)},f=function(){if(this.hasAttribute("disabled"))return!1;let t=s(this,o,"f")||s(this,l,"f")&&!this.validity.valid&&!s(this,r,"f");return t&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),t},X=function(t){let n=this.constructor,b={},p=n.validators,m=[],$=p.some(v=>v.isValid instanceof Promise);s(this,z,"f")||(h(this,Y,new Promise(v=>{h(this,E,v,"f")}),"f"),h(this,z,!0,"f")),s(this,u,"f")&&(s(this,u,"f").abort(),h(this,w,s(this,u,"f"),"f"));let M=new AbortController;h(this,u,M,"f");let S,B=!1;p.length&&(p.forEach(v=>{let Z=v.key||"customError",y=v.isValid(this,t,M.signal);y instanceof Promise?(m.push(y),y.then(I=>{I!=null&&(b[Z]=!I,S=s(this,e,"m",O).call(this,v,t),s(this,e,"m",N).call(this,b,S))})):(b[Z]=!y,this.validity[Z]!==!y&&(B=!0),!y&&!S&&(S=s(this,e,"m",O).call(this,v,t)))}),Promise.allSettled(m).then(()=>{var v;M!=null&&M.signal.aborted||(h(this,z,!1,"f"),(v=s(this,E,"f"))===null||v===void 0||v.call(this))}),(B||!$)&&s(this,e,"m",N).call(this,b,S))},N=function(t,n){if(this.validationTarget)this.internals.setValidity(t,n,this.validationTarget),h(this,k,!1,"f");else{if(this.internals.setValidity(t,n),this.internals.validity.valid)return;h(this,k,!0,"f")}},O=function(t,n){if(this.validityCallback){let b=this.validityCallback(t.key||"customError");if(b)return b}return t.message instanceof Function?t.message(this,n):t.message},oe}import{html as P,LitElement as ee,nothing as se}from"lit";import{property as c,query as le}from"lit/decorators.js";import{classMap as de}from"lit/directives/class-map.js";import{ifDefined as g}from"lit/directives/if-defined.js";import{css as K}from"lit";var Q=K`
|
|
2
2
|
*,
|
|
3
3
|
:before,
|
|
4
4
|
:after {
|
|
@@ -2495,7 +2495,7 @@ var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{th
|
|
|
2495
2495
|
text-overflow: ellipsis;
|
|
2496
2496
|
z-index: 1;
|
|
2497
2497
|
}
|
|
2498
|
-
`;import{css as ne}from"lit";var W=ne`*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.focus\\:\\[--w-outline-offset\\:-2px\\]:focus{--w-outline-offset:-2px}.bg-transparent{background-color:#0000}.border-1{border-width:1px}.rounded-4{border-radius:4px}.caret-current{caret-color:currentColor}.block{display:block}.focusable:focus{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:focus-visible{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:not(:focus-visible){outline:none}.outline-\\[--w-s-color-border-negative\\]\\!{outline-color:var(--w-s-color-border-negative)!important}.relative{position:relative}.static{position:static}.s-bg{background-color:var(--w-s-color-background)}.s-bg-disabled-subtle{background-color:var(--w-s-color-background-disabled-subtle)}.s-text{color:var(--w-s-color-text)}.s-text-disabled{color:var(--w-s-color-text-disabled)}.s-text-negative{color:var(--w-s-color-text-negative)}.s-text-subtle{color:var(--w-s-color-text-subtle)}.placeholder\\:s-text-placeholder::placeholder{color:var(--w-s-color-text-placeholder)}.s-border-disabled{border-color:var(--w-s-color-border-disabled)}.s-border-negative{border-color:var(--w-s-color-border-negative)}.s-border-strong{border-color:var(--w-s-color-border-strong)}.hover\\:s-border-negative-hover:hover{border-color:var(--w-s-color-border-negative-hover)}.hover\\:s-border-strong-hover:hover{border-color:var(--w-s-color-border-strong-hover)}.active\\:s-border-selected:active{border-color:var(--w-s-color-border-selected)}.w-full{width:100%}.min-h-\\[42\\]{min-height:4.2rem}.mb-0{margin-bottom:0}.mt-4{margin-top:.4rem}.px-8{padding-left:.8rem;padding-right:.8rem}.py-12{padding-top:1.2rem;padding-bottom:1.2rem}.pb-4{padding-bottom:.4rem}.pl-0{padding-left:0}.pl-8{padding-left:.8rem}.pr-40{padding-right:4rem}.pl-\\[var\\(--w-prefix-width\\,_40px\\)\\]{padding-left:var(--w-prefix-width,40px)}.cursor-pointer{cursor:pointer}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:grayscale}.font-bold{font-weight:700}.font-normal{font-weight:400}.pointer-events-none{pointer-events:none}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.text-m{font-size:var(--w-font-size-m);line-height:var(--w-line-height-m)}.text-s{font-size:var(--w-font-size-s);line-height:var(--w-line-height-s)}.text-xs{font-size:var(--w-font-size-xs);line-height:var(--w-line-height-xs)}.leading-m{line-height:var(--w-line-height-m)}@media (min-width:480px){.sm\\:min-h-\\[45\\]{min-height:4.5rem}}`;var x={base:"block text-m leading-m mb-0 px-8 py-12 rounded-4 w-full focusable focus:[--w-outline-offset:-2px] caret-current",default:"border-1 s-text s-bg s-border-strong hover:s-border-strong-hover active:s-border-selected",disabled:"border-1 s-text-disabled s-bg-disabled-subtle s-border-disabled pointer-events-none",invalid:"border-1 s-text-negative s-bg s-border-negative hover:s-border-negative-hover outline-[--w-s-color-border-negative]!",readOnly:"pl-0 bg-transparent pointer-events-none",placeholder:"placeholder:s-text-placeholder",suffix:"pr-40",prefix:"pl-[var(--w-prefix-width,_40px)]",textArea:"min-h-[42] sm:min-h-[45]"},ce={base:"antialiased block relative text-s font-bold pb-4 cursor-pointer s-text",optional:"pl-8 font-normal text-s s-text-subtle"},q={base:"text-xs mt-4 block",color:"s-text-subtle",colorInvalid:"s-text-negative"},V,
|
|
2498
|
+
`;import{css as ne}from"lit";var W=ne`*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.focus\\:\\[--w-outline-offset\\:-2px\\]:focus{--w-outline-offset:-2px}.bg-transparent{background-color:#0000}.border-1{border-width:1px}.rounded-4{border-radius:4px}.caret-current{caret-color:currentColor}.block{display:block}.focusable:focus{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:focus-visible{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:not(:focus-visible){outline:none}.outline-\\[--w-s-color-border-negative\\]\\!{outline-color:var(--w-s-color-border-negative)!important}.relative{position:relative}.static{position:static}.s-bg{background-color:var(--w-s-color-background)}.s-bg-disabled-subtle{background-color:var(--w-s-color-background-disabled-subtle)}.s-text{color:var(--w-s-color-text)}.s-text-disabled{color:var(--w-s-color-text-disabled)}.s-text-negative{color:var(--w-s-color-text-negative)}.s-text-subtle{color:var(--w-s-color-text-subtle)}.placeholder\\:s-text-placeholder::placeholder{color:var(--w-s-color-text-placeholder)}.s-border-disabled{border-color:var(--w-s-color-border-disabled)}.s-border-negative{border-color:var(--w-s-color-border-negative)}.s-border-strong{border-color:var(--w-s-color-border-strong)}.hover\\:s-border-negative-hover:hover{border-color:var(--w-s-color-border-negative-hover)}.hover\\:s-border-strong-hover:hover{border-color:var(--w-s-color-border-strong-hover)}.active\\:s-border-selected:active{border-color:var(--w-s-color-border-selected)}.w-full{width:100%}.min-h-\\[42\\]{min-height:4.2rem}.mb-0{margin-bottom:0}.mt-4{margin-top:.4rem}.px-8{padding-left:.8rem;padding-right:.8rem}.py-12{padding-top:1.2rem;padding-bottom:1.2rem}.pb-4{padding-bottom:.4rem}.pl-0{padding-left:0}.pl-8{padding-left:.8rem}.pr-40{padding-right:4rem}.pl-\\[var\\(--w-prefix-width\\,_40px\\)\\]{padding-left:var(--w-prefix-width,40px)}.cursor-pointer{cursor:pointer}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:grayscale}.font-bold{font-weight:700}.font-normal{font-weight:400}.pointer-events-none{pointer-events:none}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.text-m{font-size:var(--w-font-size-m);line-height:var(--w-line-height-m)}.text-s{font-size:var(--w-font-size-s);line-height:var(--w-line-height-s)}.text-xs{font-size:var(--w-font-size-xs);line-height:var(--w-line-height-xs)}.leading-m{line-height:var(--w-line-height-m)}@media (min-width:480px){.sm\\:min-h-\\[45\\]{min-height:4.5rem}}`;var x={base:"block text-m leading-m mb-0 px-8 py-12 rounded-4 w-full focusable focus:[--w-outline-offset:-2px] caret-current",default:"border-1 s-text s-bg s-border-strong hover:s-border-strong-hover active:s-border-selected",disabled:"border-1 s-text-disabled s-bg-disabled-subtle s-border-disabled pointer-events-none",invalid:"border-1 s-text-negative s-bg s-border-negative hover:s-border-negative-hover outline-[--w-s-color-border-negative]!",readOnly:"pl-0 bg-transparent pointer-events-none",placeholder:"placeholder:s-text-placeholder",suffix:"pr-40",prefix:"pl-[var(--w-prefix-width,_40px)]",textArea:"min-h-[42] sm:min-h-[45]"},ce={base:"antialiased block relative text-s font-bold pb-4 cursor-pointer s-text",optional:"pl-8 font-normal text-s s-text-subtle"},q={base:"text-xs mt-4 block",color:"s-text-subtle",colorInvalid:"s-text-negative"},V,i=class extends J(ee){constructor(){super(...arguments);this.disabled=!1;this.invalid=!1;this.readOnly=!1;this.readonly=!1;this.required=!1;this._hasPrefix=!1;this._hasSuffix=!1;D(this,V,null)}updated(r){r.has("value")&&(this.setValue(this.value),this.formatter&&(this.mask.innerText=this.formatter(this.value)))}firstUpdated(r){G(this,V,this.value)}resetFormControl(){this.value=H(this,V)}get _inputstyles(){return j([x.base,this._hasSuffix&&x.suffix,this._hasPrefix&&x.prefix,!this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&x.default,this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&x.invalid,!this.invalid&&this.disabled&&!(this.readonly||this.readOnly)&&x.disabled,!this.invalid&&!this.disabled&&(this.readonly||this.readOnly)&&x.readOnly])}get _helptextstyles(){return j([q.base,this.invalid?q.colorInvalid:q.color])}get _label(){if(this.label)return P`<label for="${this._id}" class=${ce.base}>${this.label}</label>`}get _helpId(){if(this.helpText)return`${this._id}__hint`}get _id(){return"textfield"}get _error(){if(this.invalid&&this._helpId)return this._helpId}handler(r){let{name:o,value:l}=r.currentTarget;this.value=l;let u=new CustomEvent(r.type,{detail:{name:o,value:l,target:r.target}});this.dispatchEvent(u)}prefixSlotChange(){this.renderRoot.querySelector("slot[name=prefix]").assignedElements().length&&(this._hasPrefix=!0)}suffixSlotChange(){this.renderRoot.querySelector("slot[name=suffix]").assignedElements().length&&(this._hasSuffix=!0)}render(){return P`
|
|
2499
2499
|
${this._label}
|
|
2500
2500
|
<div
|
|
2501
2501
|
class="${de({"w-textfield":!0,"w-textfield--has-prefix":this._hasPrefix,"w-textfield--has-suffix":this._hasSuffix})}">
|
|
@@ -2507,8 +2507,8 @@ var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{th
|
|
|
2507
2507
|
min="${g(this.min)}"
|
|
2508
2508
|
max="${g(this.max)}"
|
|
2509
2509
|
size="${g(this.size)}"
|
|
2510
|
-
minlength="${g(this.minLength)}"
|
|
2511
|
-
maxlength="${g(this.maxLength)}"
|
|
2510
|
+
minlength="${g(this.minLength||this.minlength)}"
|
|
2511
|
+
maxlength="${g(this.maxLength||this.maxlength)}"
|
|
2512
2512
|
name="${g(this.name)}"
|
|
2513
2513
|
pattern="${g(this.pattern)}"
|
|
2514
2514
|
placeholder="${g(this.placeholder)}"
|
|
@@ -2532,5 +2532,5 @@ var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{th
|
|
|
2532
2532
|
</div>
|
|
2533
2533
|
<span class="sr-only" id="aria-description">${this.ariaDescription}</span>
|
|
2534
2534
|
${this.helpText&&P`<div class="${this._helptextstyles}" id="${this._helpId}">${this.helpText}</div>`}
|
|
2535
|
-
`}};V=new WeakMap,
|
|
2535
|
+
`}};V=new WeakMap,i.shadowRootOptions={...ee.shadowRootOptions,delegatesFocus:!0},i.styles=[Q,W,T],d([c({type:Boolean,reflect:!0})],i.prototype,"disabled",2),d([c({type:Boolean,reflect:!0})],i.prototype,"invalid",2),d([c({type:String,reflect:!0})],i.prototype,"label",2),d([c({type:String,reflect:!0,attribute:"help-text"})],i.prototype,"helpText",2),d([c({type:String,reflect:!0})],i.prototype,"size",2),d([c({type:Number,reflect:!0})],i.prototype,"max",2),d([c({type:Number,reflect:!0})],i.prototype,"min",2),d([c({type:Number,reflect:!0,attribute:"min-length"})],i.prototype,"minLength",2),d([c({type:Number,reflect:!0})],i.prototype,"minlength",2),d([c({type:Number,reflect:!0,attribute:"max-length"})],i.prototype,"maxLength",2),d([c({type:Number,reflect:!0})],i.prototype,"maxlength",2),d([c({type:String,reflect:!0})],i.prototype,"pattern",2),d([c({type:String,reflect:!0})],i.prototype,"placeholder",2),d([c({type:Boolean,reflect:!0,attribute:"read-only"})],i.prototype,"readOnly",2),d([c({type:Boolean,reflect:!0})],i.prototype,"readonly",2),d([c({type:Boolean,reflect:!0})],i.prototype,"required",2),d([c({type:String,reflect:!0})],i.prototype,"type",2),d([c({type:String,reflect:!0})],i.prototype,"value",2),d([c({type:String,reflect:!0})],i.prototype,"name",2),d([c({type:Number,reflect:!0})],i.prototype,"step",2),d([c({type:String,reflect:!0})],i.prototype,"autocomplete",2),d([c({attribute:!1})],i.prototype,"formatter",2),d([le(".w-textfield__mask")],i.prototype,"mask",2),d([c({type:Boolean})],i.prototype,"_hasPrefix",2),d([c({type:Boolean})],i.prototype,"_hasSuffix",2);customElements.get("w-textfield")||customElements.define("w-textfield",i);export{i as WarpTextField};
|
|
2536
2536
|
//# sourceMappingURL=textfield.js.map
|