@warp-ds/elements 2.5.1-next.3 → 2.5.1-next.5
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 +100 -0
- package/dist/index.d.ts +10 -0
- package/dist/packages/textarea/textarea.d.ts +13 -0
- package/dist/packages/textarea/textarea.js +21 -20
- package/dist/packages/textarea/textarea.js.map +3 -3
- package/dist/packages/textarea/textarea.react.stories.d.ts +1 -1
- package/dist/packages/textarea/textarea.stories.d.ts +1 -0
- package/dist/packages/textarea/textarea.stories.js +28 -0
- package/dist/packages/textarea/textarea.test.js +92 -4
- package/dist/web-types.json +13 -3
- package/package.json +1 -1
|
@@ -5132,6 +5132,14 @@
|
|
|
5132
5132
|
"kind": "field",
|
|
5133
5133
|
"name": "maxHeight"
|
|
5134
5134
|
},
|
|
5135
|
+
{
|
|
5136
|
+
"kind": "field",
|
|
5137
|
+
"name": "_textarea",
|
|
5138
|
+
"type": {
|
|
5139
|
+
"text": "HTMLTextAreaElement"
|
|
5140
|
+
},
|
|
5141
|
+
"privacy": "private"
|
|
5142
|
+
},
|
|
5135
5143
|
{
|
|
5136
5144
|
"kind": "field",
|
|
5137
5145
|
"name": "#initialValue",
|
|
@@ -5146,6 +5154,33 @@
|
|
|
5146
5154
|
"name": "#uniqueId",
|
|
5147
5155
|
"privacy": "private"
|
|
5148
5156
|
},
|
|
5157
|
+
{
|
|
5158
|
+
"kind": "field",
|
|
5159
|
+
"name": "#validationActive",
|
|
5160
|
+
"privacy": "private",
|
|
5161
|
+
"type": {
|
|
5162
|
+
"text": "boolean"
|
|
5163
|
+
},
|
|
5164
|
+
"default": "false"
|
|
5165
|
+
},
|
|
5166
|
+
{
|
|
5167
|
+
"kind": "field",
|
|
5168
|
+
"name": "#originalHelpText",
|
|
5169
|
+
"privacy": "private",
|
|
5170
|
+
"type": {
|
|
5171
|
+
"text": "string | undefined"
|
|
5172
|
+
},
|
|
5173
|
+
"default": "undefined"
|
|
5174
|
+
},
|
|
5175
|
+
{
|
|
5176
|
+
"kind": "field",
|
|
5177
|
+
"name": "#hasInteracted",
|
|
5178
|
+
"privacy": "private",
|
|
5179
|
+
"type": {
|
|
5180
|
+
"text": "boolean"
|
|
5181
|
+
},
|
|
5182
|
+
"default": "false"
|
|
5183
|
+
},
|
|
5149
5184
|
{
|
|
5150
5185
|
"kind": "method",
|
|
5151
5186
|
"name": "resetFormControl",
|
|
@@ -5158,6 +5193,71 @@
|
|
|
5158
5193
|
"text": "resetFormControl() => void"
|
|
5159
5194
|
}
|
|
5160
5195
|
},
|
|
5196
|
+
{
|
|
5197
|
+
"kind": "field",
|
|
5198
|
+
"name": "validationMessage",
|
|
5199
|
+
"type": {
|
|
5200
|
+
"text": "string"
|
|
5201
|
+
},
|
|
5202
|
+
"description": "Returns the validation message if the textarea is invalid, otherwise an empty string",
|
|
5203
|
+
"readonly": true
|
|
5204
|
+
},
|
|
5205
|
+
{
|
|
5206
|
+
"kind": "field",
|
|
5207
|
+
"name": "validity",
|
|
5208
|
+
"type": {
|
|
5209
|
+
"text": "ValidityState"
|
|
5210
|
+
},
|
|
5211
|
+
"description": "Returns the validity state of the textarea",
|
|
5212
|
+
"readonly": true
|
|
5213
|
+
},
|
|
5214
|
+
{
|
|
5215
|
+
"kind": "method",
|
|
5216
|
+
"name": "checkValidity",
|
|
5217
|
+
"return": {
|
|
5218
|
+
"type": {
|
|
5219
|
+
"text": "boolean"
|
|
5220
|
+
}
|
|
5221
|
+
},
|
|
5222
|
+
"description": "Checks whether the textarea passes constraint validation",
|
|
5223
|
+
"type": {
|
|
5224
|
+
"text": "checkValidity() => boolean"
|
|
5225
|
+
}
|
|
5226
|
+
},
|
|
5227
|
+
{
|
|
5228
|
+
"kind": "method",
|
|
5229
|
+
"name": "reportValidity",
|
|
5230
|
+
"return": {
|
|
5231
|
+
"type": {
|
|
5232
|
+
"text": "boolean"
|
|
5233
|
+
}
|
|
5234
|
+
},
|
|
5235
|
+
"description": "Checks validity and shows the browser's validation message if invalid",
|
|
5236
|
+
"type": {
|
|
5237
|
+
"text": "reportValidity() => boolean"
|
|
5238
|
+
}
|
|
5239
|
+
},
|
|
5240
|
+
{
|
|
5241
|
+
"kind": "method",
|
|
5242
|
+
"name": "setCustomValidity",
|
|
5243
|
+
"return": {
|
|
5244
|
+
"type": {
|
|
5245
|
+
"text": "void"
|
|
5246
|
+
}
|
|
5247
|
+
},
|
|
5248
|
+
"parameters": [
|
|
5249
|
+
{
|
|
5250
|
+
"name": "message",
|
|
5251
|
+
"type": {
|
|
5252
|
+
"text": "string"
|
|
5253
|
+
}
|
|
5254
|
+
}
|
|
5255
|
+
],
|
|
5256
|
+
"description": "Sets a custom validation message. Pass an empty string to clear.",
|
|
5257
|
+
"type": {
|
|
5258
|
+
"text": "setCustomValidity(message: string) => void"
|
|
5259
|
+
}
|
|
5260
|
+
},
|
|
5161
5261
|
{
|
|
5162
5262
|
"kind": "method",
|
|
5163
5263
|
"name": "handler",
|
package/dist/index.d.ts
CHANGED
|
@@ -2092,12 +2092,17 @@ export type CustomElements = {
|
|
|
2092
2092
|
* - `optional`: undefined
|
|
2093
2093
|
* - `minHeight`: undefined (property only)
|
|
2094
2094
|
* - `maxHeight`: undefined (property only)
|
|
2095
|
+
* - `validationMessage`: Returns the validation message if the textarea is invalid, otherwise an empty string (property only) (readonly)
|
|
2096
|
+
* - `validity`: Returns the validity state of the textarea (property only) (readonly)
|
|
2095
2097
|
*
|
|
2096
2098
|
* ## Methods
|
|
2097
2099
|
*
|
|
2098
2100
|
* Methods that can be called to access component functionality.
|
|
2099
2101
|
*
|
|
2100
2102
|
* - `resetFormControl() => void`: undefined
|
|
2103
|
+
* - `checkValidity() => boolean`: Checks whether the textarea passes constraint validation
|
|
2104
|
+
* - `reportValidity() => boolean`: Checks validity and shows the browser's validation message if invalid
|
|
2105
|
+
* - `setCustomValidity(message: string) => void`: Sets a custom validation message. Pass an empty string to clear.
|
|
2101
2106
|
* - `handler(e: InputEvent) => void`: undefined
|
|
2102
2107
|
*/
|
|
2103
2108
|
"w-textarea": Partial<
|
|
@@ -2869,12 +2874,17 @@ export type CustomElementsSolidJs = {
|
|
|
2869
2874
|
* - `optional`: undefined
|
|
2870
2875
|
* - `minHeight`: undefined (property only)
|
|
2871
2876
|
* - `maxHeight`: undefined (property only)
|
|
2877
|
+
* - `validationMessage`: Returns the validation message if the textarea is invalid, otherwise an empty string (property only) (readonly)
|
|
2878
|
+
* - `validity`: Returns the validity state of the textarea (property only) (readonly)
|
|
2872
2879
|
*
|
|
2873
2880
|
* ## Methods
|
|
2874
2881
|
*
|
|
2875
2882
|
* Methods that can be called to access component functionality.
|
|
2876
2883
|
*
|
|
2877
2884
|
* - `resetFormControl() => void`: undefined
|
|
2885
|
+
* - `checkValidity() => boolean`: Checks whether the textarea passes constraint validation
|
|
2886
|
+
* - `reportValidity() => boolean`: Checks validity and shows the browser's validation message if invalid
|
|
2887
|
+
* - `setCustomValidity(message: string) => void`: Sets a custom validation message. Pass an empty string to clear.
|
|
2878
2888
|
* - `handler(e: InputEvent) => void`: undefined
|
|
2879
2889
|
*/
|
|
2880
2890
|
"w-textarea": Partial<
|
|
@@ -29,8 +29,19 @@ declare class WarpTextarea extends WarpTextarea_base {
|
|
|
29
29
|
optional: boolean;
|
|
30
30
|
minHeight: number;
|
|
31
31
|
maxHeight: number;
|
|
32
|
+
private _textarea;
|
|
32
33
|
updated(changedProperties: PropertyValues<this>): void;
|
|
33
34
|
resetFormControl(): void;
|
|
35
|
+
/** Returns the validation message if the textarea is invalid, otherwise an empty string */
|
|
36
|
+
get validationMessage(): string;
|
|
37
|
+
/** Returns the validity state of the textarea */
|
|
38
|
+
get validity(): ValidityState;
|
|
39
|
+
/** Checks whether the textarea passes constraint validation */
|
|
40
|
+
checkValidity(): boolean;
|
|
41
|
+
/** Checks validity and shows the browser's validation message if invalid */
|
|
42
|
+
reportValidity(): boolean;
|
|
43
|
+
/** Sets a custom validation message. Pass an empty string to clear. */
|
|
44
|
+
setCustomValidity(message: string): void;
|
|
34
45
|
static styles: import("lit").CSSResult[];
|
|
35
46
|
/** @internal */
|
|
36
47
|
get _textareaStyles(): string;
|
|
@@ -43,6 +54,8 @@ declare class WarpTextarea extends WarpTextarea_base {
|
|
|
43
54
|
/** @internal */
|
|
44
55
|
get _error(): string;
|
|
45
56
|
connectedCallback(): Promise<void>;
|
|
57
|
+
disconnectedCallback(): void;
|
|
58
|
+
firstUpdated(changedProperties: PropertyValues<this>): void;
|
|
46
59
|
handler(e: InputEvent): void;
|
|
47
60
|
render(): import("lit").TemplateResult<1>;
|
|
48
61
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function
|
|
1
|
+
var Be=Object.create;var he=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Je=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var _e=o=>{throw TypeError(o)};var Ce=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var Qe=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ge(e))!Ke.call(o,a)&&a!==r&&he(o,a,{get:()=>e[a],enumerable:!(t=ke(e,a))||t.enumerable});return o};var We=(o,e,r)=>(r=o!=null?Be(Je(o)):{},Qe(e||!o||!o.__esModule?he(r,"default",{value:o,enumerable:!0}):r,o));var w=(o,e,r,t)=>{for(var a=t>1?void 0:t?ke(e,r):e,l=o.length-1,n;l>=0;l--)(n=o[l])&&(a=(t?n(e,r,a):n(a))||a);return t&&a&&he(e,r,a),a};var be=(o,e,r)=>e.has(o)||_e("Cannot "+r);var V=(o,e,r)=>(be(o,e,"read from private field"),r?r.call(o):e.get(o)),I=(o,e,r)=>e.has(o)?_e("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,r),E=(o,e,r,t)=>(be(o,e,"write to private field"),t?t.call(o,r):e.set(o,r),r),m=(o,e,r)=>(be(o,e,"access private method"),r);var ze=Ce(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.errorMessages=j.ErrorType=void 0;var U;(function(o){o.MalformedUnicode="MALFORMED_UNICODE",o.MalformedHexadecimal="MALFORMED_HEXADECIMAL",o.CodePointLimit="CODE_POINT_LIMIT",o.OctalDeprecation="OCTAL_DEPRECATION",o.EndOfString="END_OF_STRING"})(U=j.ErrorType||(j.ErrorType={}));j.errorMessages=new Map([[U.MalformedUnicode,"malformed Unicode character escape sequence"],[U.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[U.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[U.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[U.EndOfString,"malformed escape sequence at end of string"]])});var Fe=Ce(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.unraw=S.errorMessages=S.ErrorType=void 0;var x=ze();Object.defineProperty(S,"ErrorType",{enumerable:!0,get:function(){return x.ErrorType}});Object.defineProperty(S,"errorMessages",{enumerable:!0,get:function(){return x.errorMessages}});function er(o){return!o.match(/[^a-f0-9]/i)?parseInt(o,16):NaN}function re(o,e,r){let t=er(o);if(Number.isNaN(t)||r!==void 0&&r!==o.length)throw new SyntaxError(x.errorMessages.get(e));return t}function rr(o){let e=re(o,x.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(e)}function Me(o,e){let r=re(o,x.ErrorType.MalformedUnicode,4);if(e!==void 0){let t=re(e,x.ErrorType.MalformedUnicode,4);return String.fromCharCode(r,t)}return String.fromCharCode(r)}function or(o){return o.charAt(0)==="{"&&o.charAt(o.length-1)==="}"}function tr(o){if(!or(o))throw new SyntaxError(x.errorMessages.get(x.ErrorType.MalformedUnicode));let e=o.slice(1,-1),r=re(e,x.ErrorType.MalformedUnicode);try{return String.fromCodePoint(r)}catch(t){throw t instanceof RangeError?new SyntaxError(x.errorMessages.get(x.ErrorType.CodePointLimit)):t}}function ar(o,e=!1){if(e)throw new SyntaxError(x.errorMessages.get(x.ErrorType.OctalDeprecation));let r=parseInt(o,8);return String.fromCharCode(r)}var ir=new Map([["b","\b"],["f","\f"],["n",`
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function nr(o){return ir.get(o)||o}var sr=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function Ee(o,e=!1){return o.replace(sr,function(r,t,a,l,n,i,d,p,y){if(t!==void 0)return"\\";if(a!==void 0)return rr(a);if(l!==void 0)return tr(l);if(n!==void 0)return Me(n,i);if(d!==void 0)return Me(d);if(p==="0")return"\0";if(p!==void 0)return ar(p,!e);if(y!==void 0)return nr(y);throw new SyntaxError(x.errorMessages.get(x.ErrorType.EndOfString))})}S.unraw=Ee;S.default=Ee});var ee=function(){for(var o=[],e=arguments.length;e--;)o[e]=arguments[e];return o.reduce(function(r,t){return r.concat(typeof t=="string"?t:Array.isArray(t)?ee.apply(void 0,t):typeof t=="object"&&t?Object.keys(t).map(function(a){return t[a]?a:""}):"")},[]).join(" ")};var Oe=We(Fe(),1);var N=o=>typeof o=="string",lr=o=>typeof o=="function",Ve=new Map,Ae="en";function ve(o){return[...Array.isArray(o)?o:[o],Ae]}function me(o,e,r){let t=ve(o);r||(r="default");let a;if(typeof r=="string")switch(a={day:"numeric",month:"short",year:"numeric"},r){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=r;return oe(()=>te("date",t,r),()=>new Intl.DateTimeFormat(t,a)).format(N(e)?new Date(e):e)}function dr(o,e,r){let t;if(r||(r="default"),typeof r=="string")switch(t={second:"numeric",minute:"numeric",hour:"numeric"},r){case"full":case"long":t.timeZoneName="short";break;case"short":delete t.second}else t=r;return me(o,e,t)}function ue(o,e,r){let t=ve(o);return oe(()=>te("number",t,r),()=>new Intl.NumberFormat(t,r)).format(e)}function Se(o,e,r,{offset:t=0,...a}){var i,d;let l=ve(o),n=e?oe(()=>te("plural-ordinal",l),()=>new Intl.PluralRules(l,{type:"ordinal"})):oe(()=>te("plural-cardinal",l),()=>new Intl.PluralRules(l,{type:"cardinal"}));return(d=(i=a[r])!=null?i:a[n.select(r-t)])!=null?d:a.other}function oe(o,e){let r=o(),t=Ve.get(r);return t||(t=e(),Ve.set(r,t)),t}function te(o,e,r){let t=e.join("-");return`${o}-${t}-${JSON.stringify(r)}`}var Pe=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,Ie="%__lingui_octothorpe__%",cr=(o,e,r={})=>{let t=e||o,a=n=>typeof n=="object"?n:r[n],l=(n,i)=>{let d=Object.keys(r).length?a("number"):void 0,p=ue(t,n,d);return i.replace(new RegExp(Ie,"g"),p)};return{plural:(n,i)=>{let{offset:d=0}=i,p=Se(t,!1,n,i);return l(n-d,p)},selectordinal:(n,i)=>{let{offset:d=0}=i,p=Se(t,!0,n,i);return l(n-d,p)},select:hr,number:(n,i)=>ue(t,n,a(i)||{style:i}),date:(n,i)=>me(t,n,a(i)||i),time:(n,i)=>dr(t,n,a(i)||i)}},hr=(o,e)=>{var r;return(r=e[o])!=null?r:e.other};function br(o,e,r){return(t={},a)=>{let l=cr(e,r,a),n=(d,p=!1)=>Array.isArray(d)?d.reduce((y,M)=>{if(M==="#"&&p)return y+Ie;if(N(M))return y+M;let[R,C,A]=M,P={};C==="plural"||C==="selectordinal"||C==="select"?Object.entries(A).forEach(([L,X])=>{P[L]=n(X,C==="plural"||C==="selectordinal")}):P=A;let k;if(C){let L=l[C];k=L(t[R],P)}else k=t[R];return k==null?y:y+k},""):d,i=n(o);return N(i)&&Pe.test(i)?(0,Oe.unraw)(i):N(i)?i:i?String(i):""}}var ur=Object.defineProperty,pr=(o,e,r)=>e in o?ur(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,gr=(o,e,r)=>(pr(o,typeof e!="symbol"?e+"":e,r),r),pe=class{constructor(){gr(this,"_events",{})}on(e,r){var a;var t;return(a=(t=this._events)[e])!=null||(t[e]=[]),this._events[e].push(r),()=>this.removeListener(e,r)}removeListener(e,r){let t=this._getListeners(e);if(!t)return;let a=t.indexOf(r);~a&&t.splice(a,1)}emit(e,...r){let t=this._getListeners(e);t&&t.map(a=>a.apply(this,r))}_getListeners(e){let r=this._events[e];return Array.isArray(r)?r:!1}},vr=Object.defineProperty,mr=(o,e,r)=>e in o?vr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,Y=(o,e,r)=>(mr(o,typeof e!="symbol"?e+"":e,r),r),ge=class extends pe{constructor(e){var r;super(),Y(this,"_locale",""),Y(this,"_locales"),Y(this,"_localeData",{}),Y(this,"_messages",{}),Y(this,"_missing"),Y(this,"_messageCompiler"),Y(this,"t",this._.bind(this)),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(typeof e.locale=="string"||e.locales)&&this.activate((r=e.locale)!=null?r:Ae,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){var e;return(e=this._messages[this._locale])!=null?e:{}}get localeData(){var e;return(e=this._localeData[this._locale])!=null?e:{}}_loadLocaleData(e,r){let t=this._localeData[e];t?Object.assign(t,r):this._localeData[e]=r}setMessagesCompiler(e){return this._messageCompiler=e,this}loadLocaleData(e,r){typeof e=="string"?this._loadLocaleData(e,r):Object.keys(e).forEach(t=>this._loadLocaleData(t,e[t])),this.emit("change")}_load(e,r){let t=this._messages[e];t?Object.assign(t,r):this._messages[e]=r}load(e,r){typeof e=="string"&&typeof r=="object"?this._load(e,r):Object.entries(e).forEach(([t,a])=>this._load(t,a)),this.emit("change")}loadAndActivate({locale:e,locales:r,messages:t}){this._locale=e,this._locales=r||void 0,this._messages[this._locale]=t,this.emit("change")}activate(e,r){this._locale=e,this._locales=r,this.emit("change")}_(e,r,t){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let a=t==null?void 0:t.message;e||(e=""),N(e)||(r=e.values||r,a=e.message,e=e.id);let l=this.messages[e],n=l===void 0,i=this._missing;if(i&&n)return lr(i)?i(this._locale,e):i;n&&this.emit("missing",{id:e,locale:this._locale});let d=l||a||e;return N(d)&&(this._messageCompiler?d=this._messageCompiler(d):console.warn(`Uncompiled message detected! Message:
|
|
3
3
|
|
|
4
4
|
> ${d}
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ That means you use raw catalog or your catalog doesn't have a translation for th
|
|
|
7
7
|
ICU features such as interpolation and plurals will not work properly for that message.
|
|
8
8
|
|
|
9
9
|
Please compile your catalog first.
|
|
10
|
-
`)),
|
|
10
|
+
`)),N(d)&&Pe.test(d)?JSON.parse(`"${d}"`):N(d)?d:br(d,this._locale,this._locales)(r,t==null?void 0:t.formats)}date(e,r){return me(this._locales||this._locale,e,r)}number(e,r){return ue(this._locales||this._locale,e,r)}};function fr(o={}){return new ge(o)}var Ne=fr();var h=function(o,e,r,t){if(r==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?o!==e||!t:!e.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?t:r==="a"?t.call(o):t?t.value:e.get(o)},v=function(o,e,r,t,a){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?o!==e||!a:!e.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?a.call(o,r):a?a.value=r:e.set(o,r),r};function Te(o){var e,r,t,a,l,n,i,d,p,y,M,R,C,A,P,k,L,X,le;class Ze extends o{constructor(...s){var c,g,f;super(...s),e.add(this),this.internals=this.attachInternals(),r.set(this,!1),t.set(this,!1),a.set(this,!1),l.set(this,void 0),n.set(this,void 0),i.set(this,!0),p.set(this,""),y.set(this,()=>{v(this,a,!0,"f"),v(this,r,!0,"f"),h(this,e,"m",k).call(this)}),M.set(this,()=>{v(this,r,!1,"f"),h(this,e,"m",L).call(this,this.shouldFormValueUpdate()?h(this,p,"f"):""),!this.validity.valid&&h(this,a,"f")&&v(this,t,!0,"f");let F=h(this,e,"m",k).call(this);this.validationMessageCallback&&this.validationMessageCallback(F?this.internals.validationMessage:"")}),R.set(this,()=>{var F;h(this,i,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),v(this,i,!1,"f")),v(this,a,!0,"f"),v(this,t,!0,"f"),h(this,e,"m",k).call(this),(F=this===null||this===void 0?void 0:this.validationMessageCallback)===null||F===void 0||F.call(this,this.showError?this.internals.validationMessage:"")}),C.set(this,void 0),A.set(this,!1),P.set(this,Promise.resolve()),(c=this.addEventListener)===null||c===void 0||c.call(this,"focus",h(this,y,"f")),(g=this.addEventListener)===null||g===void 0||g.call(this,"blur",h(this,M,"f")),(f=this.addEventListener)===null||f===void 0||f.call(this,"invalid",h(this,R,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let s=this.validators.map(f=>f.attribute).flat(),c=super.observedAttributes||[];return[...new Set([...c,...s])]}static getValidator(s){return this.validators.find(c=>c.attribute===s)||null}static getValidators(s){return this.validators.filter(c=>{var g;if(c.attribute===s||!((g=c.attribute)===null||g===void 0)&&g.includes(s))return!0})}get form(){return this.internals.form}get showError(){return h(this,e,"m",k).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(s,c,g){var f;(f=super.attributeChangedCallback)===null||f===void 0||f.call(this,s,c,g);let B=this.constructor.getValidators(s);B!=null&&B.length&&this.validationTarget&&this.setValue(h(this,p,"f"))}setValue(s){var c;v(this,t,!1,"f"),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,""),v(this,p,s,"f");let f=this.shouldFormValueUpdate()?s:null;this.internals.setFormValue(f),h(this,e,"m",L).call(this,f),this.valueChangedCallback&&this.valueChangedCallback(f),h(this,e,"m",k).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(s=>s(h(this,P,"f")))}formResetCallback(){var s,c;v(this,a,!1,"f"),v(this,t,!1,"f"),h(this,e,"m",k).call(this),(s=this.resetFormControl)===null||s===void 0||s.call(this),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,h(this,e,"m",k).call(this)?this.validationMessage:"")}}return r=new WeakMap,t=new WeakMap,a=new WeakMap,l=new WeakMap,n=new WeakMap,i=new WeakMap,p=new WeakMap,y=new WeakMap,M=new WeakMap,R=new WeakMap,C=new WeakMap,A=new WeakMap,P=new WeakMap,e=new WeakSet,d=function(){let s=this.getRootNode(),c=`${this.localName}[name="${this.getAttribute("name")}"]`;return s.querySelectorAll(c)},k=function(){if(this.hasAttribute("disabled"))return!1;let s=h(this,t,"f")||h(this,a,"f")&&!this.validity.valid&&!h(this,r,"f");return s&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),s},L=function(s){let c=this.constructor,g={},f=c.validators,F=[],B=f.some(z=>z.isValid instanceof Promise);h(this,A,"f")||(v(this,P,new Promise(z=>{v(this,C,z,"f")}),"f"),v(this,A,!0,"f")),h(this,l,"f")&&(h(this,l,"f").abort(),v(this,n,h(this,l,"f"),"f"));let G=new AbortController;v(this,l,G,"f");let J,ye=!1;f.length&&(f.forEach(z=>{let de=z.key||"customError",H=z.isValid(this,s,G.signal);H instanceof Promise?(F.push(H),H.then(ce=>{ce!=null&&(g[de]=!ce,J=h(this,e,"m",le).call(this,z,s),h(this,e,"m",X).call(this,g,J))})):(g[de]=!H,this.validity[de]!==!H&&(ye=!0),!H&&!J&&(J=h(this,e,"m",le).call(this,z,s)))}),Promise.allSettled(F).then(()=>{var z;G!=null&&G.signal.aborted||(v(this,A,!1,"f"),(z=h(this,C,"f"))===null||z===void 0||z.call(this))}),(ye||!B)&&h(this,e,"m",X).call(this,g,J))},X=function(s,c){if(this.validationTarget)this.internals.setValidity(s,c,this.validationTarget),v(this,i,!1,"f");else{if(this.internals.setValidity(s,c),this.internals.validity.valid)return;v(this,i,!0,"f")}},le=function(s,c){if(this.validityCallback){let g=this.validityCallback(s.key||"customError");if(g)return g}return s.message instanceof Function?s.message(this,c):s.message},Ze}import{html as ae,LitElement as He,nothing as ie}from"lit";import{property as _,query as xr,state as Ue}from"lit/decorators.js";import{ifDefined as ne}from"lit/directives/if-defined.js";var $e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Le=(o=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(o|=0));for(;o--;)e+=$e[r[o]&63];return e};function je(o=""){return`${o}${Le()}`}import{css as Ye}from"lit";var De=Ye`
|
|
11
11
|
*,
|
|
12
12
|
:before,
|
|
13
13
|
:after {
|
|
@@ -280,7 +280,7 @@ Please compile your catalog first.
|
|
|
280
280
|
svg {
|
|
281
281
|
pointer-events: none;
|
|
282
282
|
}
|
|
283
|
-
`,
|
|
283
|
+
`,Ir=Ye`*, :before, :after {
|
|
284
284
|
--w-rotate: 0;
|
|
285
285
|
--w-rotate-x: 0;
|
|
286
286
|
--w-rotate-y: 0;
|
|
@@ -2446,30 +2446,31 @@ Please compile your catalog first.
|
|
|
2446
2446
|
display: none
|
|
2447
2447
|
}
|
|
2448
2448
|
}
|
|
2449
|
-
`;import{css as
|
|
2450
|
-
${this.label?
|
|
2451
|
-
<label for="${this._id}" class=${
|
|
2449
|
+
`;import{css as wr}from"lit";var Re=wr`*,: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}.flex{display:flex}.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}.fixed{position:fixed}.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}.resize{resize:both}.resize-none{resize:none}.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 T={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]",fixed:"resize-none"},qe={base:"antialiased block relative text-s font-bold pb-4 cursor-pointer s-text flex",optional:"pl-8 font-normal text-s s-text-subtle"},fe={base:"text-xs mt-4 block",color:"s-text-subtle",colorInvalid:"s-text-negative"},Q,se,D,q,$,b,we,K,O,Xe,W,xe,u=class extends Te(He){constructor(){super(...arguments);I(this,b);this.minHeight=Number.NEGATIVE_INFINITY;this.maxHeight=Number.POSITIVE_INFINITY;I(this,Q,null);I(this,se,je("textarea-"));I(this,D,!1);I(this,q);I(this,$,!1);I(this,W,r=>{r.preventDefault(),E(this,$,!0),m(this,b,O).call(this)})}updated(r){r.has("value")&&this.setValue(this.value),(r.has("value")||r.has("required")||r.has("disabled"))&&m(this,b,O).call(this)}resetFormControl(){this.value=V(this,Q),E(this,$,!1),m(this,b,K).call(this),m(this,b,O).call(this)}get validationMessage(){return this.internals.validationMessage}get validity(){return this.internals.validity}checkValidity(){return m(this,b,O).call(this),this.internals.checkValidity()}reportValidity(){return E(this,$,!0),m(this,b,O).call(this),this.internals.checkValidity()}setCustomValidity(r){r?(this.internals.setValidity({customError:!0},r,this._textarea),m(this,b,we).call(this,r)):(m(this,b,K).call(this),m(this,b,O).call(this))}get _textareaStyles(){return ee([T.base,T.textArea,!!this.placeholder&&T.placeholder,!this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&T.default,this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&T.invalid,!this.invalid&&this.disabled&&!(this.readonly||this.readOnly)&&T.disabled,!this.invalid&&!this.disabled&&(this.readonly||this.readOnly)&&T.readOnly,this.maxRows&&T.fixed])}get _helptextstyles(){return ee([fe.base,this.invalid?fe.colorInvalid:fe.color])}get _helpId(){if(this.helpText)return`${this._id}__hint`}get _id(){return V(this,se)}get _error(){if(this.invalid&&this._helpId)return this._helpId}async connectedCallback(){var r;if(super.connectedCallback(),E(this,Q,this.value),this.setValue(this.value),this.addEventListener("invalid",V(this,W)),await this.updateComplete,this.value||this.minRows){let t=(r=this.shadowRoot)==null?void 0:r.querySelector("textarea");t&&m(this,b,xe).call(this,t)}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",V(this,W))}firstUpdated(r){super.firstUpdated(r),m(this,b,O).call(this)}handler(r){let t=r.currentTarget;this.value=t.value,m(this,b,xe).call(this,t)}render(){return ae`
|
|
2450
|
+
${this.label?ae`
|
|
2451
|
+
<label for="${this._id}" class=${qe.base}>
|
|
2452
2452
|
${this.label}
|
|
2453
|
-
${this.optional?
|
|
2454
|
-
<span class="${
|
|
2455
|
-
${
|
|
2453
|
+
${this.optional?ae`
|
|
2454
|
+
<span class="${qe.optional}">
|
|
2455
|
+
${Ne._({id:"textarea.label.optional",message:"(optional)",comment:"Shown behind label when marked as optional"})}
|
|
2456
2456
|
</span>
|
|
2457
|
-
`:
|
|
2458
|
-
</label>`:
|
|
2457
|
+
`:ie}
|
|
2458
|
+
</label>`:ie}
|
|
2459
2459
|
<textarea
|
|
2460
2460
|
id="${this._id}"
|
|
2461
2461
|
class="${this._textareaStyles}"
|
|
2462
|
-
name="${
|
|
2463
|
-
placeholder="${
|
|
2462
|
+
name="${ne(this.name)}"
|
|
2463
|
+
placeholder="${ne(this.placeholder)}"
|
|
2464
2464
|
.value="${this.value||""}"
|
|
2465
|
-
aria-describedby="${
|
|
2466
|
-
aria-errormessage="${
|
|
2467
|
-
aria-invalid=${this.invalid?"true":
|
|
2465
|
+
aria-describedby="${ne(this._helpId||(this.ariaDescription?"aria-description":void 0))}"
|
|
2466
|
+
aria-errormessage="${ne(this._error)}"
|
|
2467
|
+
aria-invalid=${this.invalid?"true":ie}
|
|
2468
2468
|
?disabled="${this.disabled}"
|
|
2469
2469
|
?readonly="${this.readonly||this.readOnly}"
|
|
2470
2470
|
?required="${this.required}"
|
|
2471
|
-
@input="${this.handler}"
|
|
2471
|
+
@input="${this.handler}"
|
|
2472
|
+
@blur="${m(this,b,Xe)}">
|
|
2472
2473
|
</textarea>
|
|
2473
|
-
${this.helpText?
|
|
2474
|
-
`}};D=new WeakMap,
|
|
2474
|
+
${this.helpText?ae`<div class="${this._helptextstyles}" id="${this._helpId}">${this.helpText}</div>`:ie}
|
|
2475
|
+
`}};Q=new WeakMap,se=new WeakMap,D=new WeakMap,q=new WeakMap,$=new WeakMap,b=new WeakSet,we=function(r){V(this,D)||E(this,q,this.helpText),E(this,D,!0),this.invalid=!0,this.helpText=r},K=function(){V(this,D)&&(this.invalid=!1,this.helpText=V(this,q),E(this,q,void 0),E(this,D,!1))},O=function(){var r;if(this.disabled){this.internals.setValidity({}),m(this,b,K).call(this);return}if(this.required&&!this.value){let t=((r=this._textarea)==null?void 0:r.validationMessage)||"";this.internals.setValidity({valueMissing:!0},t,this._textarea),V(this,$)&&m(this,b,we).call(this,t);return}this.internals.setValidity({}),m(this,b,K).call(this)},Xe=function(){E(this,$,!0),m(this,b,O).call(this)},W=new WeakMap,xe=function(r){let t=getComputedStyle(r),a=Number.parseFloat(t.getPropertyValue("border-top-width")),l=Number.parseFloat(t.getPropertyValue("border-bottom-width")),n=Number.parseFloat(t.getPropertyValue("line-height")),i=Number.parseFloat(t.getPropertyValue("padding-top")),d=Number.parseFloat(t.getPropertyValue("padding-bottom")),p=i+d+l+a;this.minRows&&(this.minHeight=n*this.minRows+p),this.maxRows&&(this.maxHeight=n*this.maxRows+p);let y=r.scrollHeight+a+l,M=Math.min(this.maxHeight,Math.max(this.minHeight,y));r.style.setProperty("height",M+"px")},u.shadowRootOptions={...He.shadowRootOptions,delegatesFocus:!0},u.styles=[De,Re],w([_({type:Boolean,reflect:!0})],u.prototype,"disabled",2),w([_({type:Boolean,reflect:!0})],u.prototype,"invalid",2),w([_({type:String,reflect:!0})],u.prototype,"label",2),w([_({type:String,reflect:!0,attribute:"help-text"})],u.prototype,"helpText",2),w([_({type:Number,reflect:!0,attribute:"maximum-rows"})],u.prototype,"maxRows",2),w([_({type:Number,reflect:!0,attribute:"minimum-rows"})],u.prototype,"minRows",2),w([_()],u.prototype,"name",2),w([_()],u.prototype,"placeholder",2),w([_({type:Boolean,reflect:!0,attribute:"read-only"})],u.prototype,"readOnly",2),w([_({type:Boolean,reflect:!0})],u.prototype,"readonly",2),w([_({type:Boolean,reflect:!0})],u.prototype,"required",2),w([_({type:String,reflect:!0})],u.prototype,"value",2),w([_({type:Boolean,reflect:!0})],u.prototype,"optional",2),w([Ue()],u.prototype,"minHeight",2),w([Ue()],u.prototype,"maxHeight",2),w([xr("textarea")],u.prototype,"_textarea",2);customElements.get("w-textarea")||customElements.define("w-textarea",u);export{u as WarpTextarea};
|
|
2475
2476
|
//# sourceMappingURL=textarea.js.map
|