@warp-ds/elements 2.10.0-next.18 → 2.10.0-next.19
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 +179 -159
- package/dist/docs/affix/affix.md +117 -0
- package/dist/docs/affix/styling.md +107 -0
- package/dist/docs/breadcrumbs/breadcrumbs.md +67 -4
- package/dist/docs/breadcrumbs/styling.md +67 -4
- package/dist/docs/index.md +1 -1
- package/dist/docs/select/select.md +91 -0
- package/dist/docs/select/styling.md +91 -0
- package/dist/docs/textarea/styling.md +91 -0
- package/dist/docs/textarea/textarea.md +91 -0
- package/dist/docs/textfield/api.md +8 -0
- package/dist/docs/textfield/styling.md +95 -0
- package/dist/docs/textfield/textfield.md +103 -0
- package/dist/index.d.ts +90 -64
- package/dist/packages/affix/affix-styles.d.ts +8 -0
- package/dist/packages/affix/affix-styles.js +108 -0
- package/dist/packages/affix/affix.d.ts +11 -8
- package/dist/packages/affix/affix.js +118 -17
- package/dist/packages/affix/affix.js.map +4 -4
- package/dist/packages/affix/affix.react.stories.d.ts +1 -1
- package/dist/packages/affix/react.d.ts +1 -1
- package/dist/packages/alert/alert.js.map +1 -1
- package/dist/packages/attention/attention.js.map +1 -1
- package/dist/packages/breadcrumb-item/breadcrumb-item.js +16 -7
- package/dist/packages/breadcrumb-item/breadcrumb-item.js.map +2 -2
- package/dist/packages/breadcrumb-item/styles.js +14 -5
- package/dist/packages/button/button.react.stories.d.ts +2 -2
- package/dist/packages/button/react.d.ts +1 -1
- package/dist/packages/checkbox-group/react.d.ts +1 -1
- package/dist/packages/combobox/combobox.react.stories.d.ts +2 -2
- package/dist/packages/combobox/react.d.ts +1 -1
- package/dist/packages/datepicker/datepicker.js.map +1 -1
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +2 -2
- package/dist/packages/datepicker/react.d.ts +1 -1
- package/dist/packages/expandable/expandable.js.map +1 -1
- package/dist/packages/icon/icon.js +2 -2
- package/dist/packages/icon/icon.js.map +1 -1
- package/dist/packages/icon/icon.react.stories.d.ts +2 -1
- package/dist/packages/icon/icon.react.stories.js +1 -1
- package/dist/packages/modal-header/modal-header.js.map +1 -1
- package/dist/packages/pagination/pagination.js.map +1 -1
- package/dist/packages/pill/pill.js.map +1 -1
- package/dist/packages/radio-group/react.d.ts +1 -1
- package/dist/packages/select/input-styles.d.ts +11 -0
- package/dist/packages/select/input-styles.js +88 -0
- package/dist/packages/select/react.d.ts +1 -1
- package/dist/packages/select/select.js +96 -19
- package/dist/packages/select/select.js.map +4 -4
- package/dist/packages/select/select.react.stories.d.ts +2 -2
- package/dist/packages/slider/react.d.ts +1 -1
- package/dist/packages/slider/slider.react.stories.d.ts +1 -1
- package/dist/packages/slider-thumb/react.d.ts +1 -1
- package/dist/packages/snackbar/snackbar.d.ts +2 -2
- package/dist/packages/snackbar/snackbar.js +1 -1
- package/dist/packages/snackbar/snackbar.js.map +2 -2
- package/dist/packages/step/step.js.map +1 -1
- package/dist/packages/textarea/input-styles.d.ts +11 -0
- package/dist/packages/textarea/input-styles.js +88 -0
- package/dist/packages/textarea/react.d.ts +1 -1
- package/dist/packages/textarea/textarea.js +99 -20
- package/dist/packages/textarea/textarea.js.map +4 -4
- package/dist/packages/textarea/textarea.react.stories.d.ts +2 -2
- package/dist/packages/textfield/input-styles.d.ts +11 -0
- package/dist/packages/textfield/input-styles.js +88 -0
- package/dist/packages/textfield/locales/da/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/da/messages.mjs +1 -0
- package/dist/packages/textfield/locales/en/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/en/messages.mjs +1 -0
- package/dist/packages/textfield/locales/fi/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/fi/messages.mjs +1 -0
- package/dist/packages/textfield/locales/nb/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/nb/messages.mjs +1 -0
- package/dist/packages/textfield/locales/sv/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/sv/messages.mjs +1 -0
- package/dist/packages/textfield/react.d.ts +1 -1
- package/dist/packages/textfield/textfield.d.ts +11 -1
- package/dist/packages/textfield/textfield.js +111 -24
- package/dist/packages/textfield/textfield.js.map +4 -4
- package/dist/packages/textfield/textfield.react.stories.d.ts +2 -2
- package/dist/packages/toast/toast.js.map +1 -1
- package/dist/web-types.json +60 -50
- package/eik/index.js +20 -20
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Shared styles for input components (textfield, textarea, select)
|
|
4
|
+
* using the internal token pattern with a public styling API.
|
|
5
|
+
*
|
|
6
|
+
* Public API tokens (customizable):
|
|
7
|
+
* - Label: --w-c-input-label-*
|
|
8
|
+
* - Help text: --w-c-input-help-text-*
|
|
9
|
+
* - Optional indicator: --w-c-input-optional-*
|
|
10
|
+
*/
|
|
11
|
+
export const inputLabelStyles = css `
|
|
12
|
+
/* Label component tokens with semantic fallbacks */
|
|
13
|
+
label {
|
|
14
|
+
/* Internal tokens - not part of public API */
|
|
15
|
+
--_color: var(--w-c-input-label-color, var(--w-s-color-text));
|
|
16
|
+
--_font-size: var(--w-c-input-label-font-size, var(--w-font-size-s));
|
|
17
|
+
--_line-height: var(--w-c-input-label-line-height, var(--w-line-height-s));
|
|
18
|
+
--_font-weight: var(--w-c-input-label-font-weight, 700);
|
|
19
|
+
--_padding-bottom: var(--w-c-input-label-padding-bottom, 0.4rem);
|
|
20
|
+
--_cursor: var(--w-c-input-label-cursor, pointer);
|
|
21
|
+
--_display: var(--w-c-input-label-display, block);
|
|
22
|
+
|
|
23
|
+
/* Apply styles */
|
|
24
|
+
display: var(--_display);
|
|
25
|
+
position: relative;
|
|
26
|
+
font-size: var(--_font-size);
|
|
27
|
+
line-height: var(--_line-height);
|
|
28
|
+
font-weight: var(--_font-weight);
|
|
29
|
+
padding-bottom: var(--_padding-bottom);
|
|
30
|
+
cursor: var(--_cursor);
|
|
31
|
+
color: var(--_color);
|
|
32
|
+
-webkit-font-smoothing: antialiased;
|
|
33
|
+
-moz-osx-font-smoothing: grayscale;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Optional text styling */
|
|
37
|
+
label span {
|
|
38
|
+
--_padding-left: var(--w-c-input-optional-padding-left, 0.8rem);
|
|
39
|
+
--_font-weight: var(--w-c-input-optional-font-weight, 400);
|
|
40
|
+
--_font-size: var(--w-c-input-optional-font-size, var(--w-font-size-s));
|
|
41
|
+
--_line-height: var(
|
|
42
|
+
--w-c-input-optional-line-height,
|
|
43
|
+
var(--w-line-height-s)
|
|
44
|
+
);
|
|
45
|
+
--_color: var(--w-c-input-optional-color, var(--w-s-color-text-subtle));
|
|
46
|
+
|
|
47
|
+
padding-left: var(--_padding-left);
|
|
48
|
+
font-weight: var(--_font-weight);
|
|
49
|
+
font-size: var(--_font-size);
|
|
50
|
+
line-height: var(--_line-height);
|
|
51
|
+
color: var(--_color);
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
export const inputHelpTextStyles = css `
|
|
55
|
+
/* Help text component tokens with semantic fallbacks */
|
|
56
|
+
:host {
|
|
57
|
+
--_help-text-color: var(
|
|
58
|
+
--w-c-input-help-text-color,
|
|
59
|
+
var(--w-s-color-text-subtle)
|
|
60
|
+
);
|
|
61
|
+
--_help-text-font-size: var(
|
|
62
|
+
--w-c-input-help-text-font-size,
|
|
63
|
+
var(--w-font-size-xs)
|
|
64
|
+
);
|
|
65
|
+
--_help-text-line-height: var(
|
|
66
|
+
--w-c-input-help-text-line-height,
|
|
67
|
+
var(--w-line-height-xs)
|
|
68
|
+
);
|
|
69
|
+
--_help-text-margin-top: var(--w-c-input-help-text-margin-top, 0.4rem);
|
|
70
|
+
--_help-text-display: var(--w-c-input-help-text-display, block);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Invalid state overrides color */
|
|
74
|
+
:host([invalid]) {
|
|
75
|
+
--_help-text-color: var(
|
|
76
|
+
--w-c-input-help-text-color-invalid,
|
|
77
|
+
var(--w-s-color-text-negative)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.help-text {
|
|
82
|
+
font-size: var(--_help-text-font-size);
|
|
83
|
+
line-height: var(--_help-text-line-height);
|
|
84
|
+
margin-top: var(--_help-text-margin-top);
|
|
85
|
+
display: var(--_help-text-display);
|
|
86
|
+
color: var(--_help-text-color);
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { WarpTextarea } from "./textarea.js";
|
|
3
|
-
export declare const Textarea: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<WarpTextarea>, "value" | "form" | "label" | "name" | "disabled" | "invalid" | "helpText" | "placeholder" | "readOnly" | "readonly" | "required" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onblur" | "onchange" | "onfocus" | "oninput" | "updated" | "firstUpdated" | "resetFormControl" | "_helptextstyles" | "_helpId" | "_id" | "_error" | "handler" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "onFocus" | "onBlur" | "onChange" | "onInput" | "reportValidity" | "
|
|
3
|
+
export declare const Textarea: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<WarpTextarea>, "value" | "form" | "label" | "name" | "disabled" | "invalid" | "helpText" | "optional" | "placeholder" | "readOnly" | "readonly" | "required" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onblur" | "onchange" | "onfocus" | "oninput" | "updated" | "firstUpdated" | "resetFormControl" | "_helptextstyles" | "_helpId" | "_id" | "_error" | "handler" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "onFocus" | "onBlur" | "onChange" | "onInput" | "reportValidity" | "minHeight" | "setCustomValidity" | "maxRows" | "minRows" | "maxHeight" | "_textareaStyles"> & {
|
|
4
4
|
onBlur?: ((e: Event) => void) | undefined;
|
|
5
5
|
onblur?: ((e: Event) => void) | undefined;
|
|
6
6
|
onChange?: ((e: Event) => void) | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var je=Object.defineProperty;var
|
|
1
|
+
var je=Object.defineProperty;var Ne=Object.getOwnPropertyDescriptor;var ge=o=>{throw TypeError(o)};var f=(o,e,r,t)=>{for(var i=t>1?void 0:t?Ne(e,r):e,c=o.length-1,s;c>=0;c--)(s=o[c])&&(i=(t?s(e,r,i):s(i))||i);return t&&i&&je(e,r,i),i};var ae=(o,e,r)=>e.has(o)||ge("Cannot "+r);var M=(o,e,r)=>(ae(o,e,"read from private field"),r?r.call(o):e.get(o)),P=(o,e,r)=>e.has(o)?ge("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,r),F=(o,e,r,t)=>(ae(o,e,"write to private field"),t?t.call(o,r):e.set(o,r),r),v=(o,e,r)=>(ae(o,e,"access private method"),r);var ne=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)?ne.apply(void 0,t):typeof t=="object"&&t?Object.keys(t).map(function(i){return t[i]?i:""}):"")},[]).join(" ")};var I=o=>typeof o=="string",Ye=o=>typeof o=="function",ve=new Map,fe="en";function ce(o){return[...Array.isArray(o)?o:[o],fe]}function he(o,e,r){let t=ce(o);r||(r="default");let i;if(typeof r=="string")switch(i={day:"numeric",month:"short",year:"numeric"},r){case"full":i.weekday="long";case"long":i.month="long";break;case"short":i.month="numeric";break}else i=r;return K(()=>J("date",t,r),()=>new Intl.DateTimeFormat(t,i)).format(I(e)?new Date(e):e)}function Oe(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 he(o,e,t)}function se(o,e,r){let t=ce(o);return K(()=>J("number",t,r),()=>new Intl.NumberFormat(t,r)).format(e)}function me(o,e,r,{offset:t=0,...i}){let c=ce(o),s=e?K(()=>J("plural-ordinal",c),()=>new Intl.PluralRules(c,{type:"ordinal"})):K(()=>J("plural-cardinal",c),()=>new Intl.PluralRules(c,{type:"cardinal"}));return i[r]??i[s.select(r-t)]??i.other}function K(o,e){let r=o(),t=ve.get(r);return t||(t=e(),ve.set(r,t)),t}function J(o,e,r){let t=e.join("-");return`${o}-${t}-${JSON.stringify(r)}`}var we=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,xe=o=>o.replace(/\\u([a-fA-F0-9]{4})|\\x([a-fA-F0-9]{2})/g,(e,r,t)=>{if(r){let i=parseInt(r,16);return String.fromCharCode(i)}else{let i=parseInt(t,16);return String.fromCharCode(i)}}),ye="%__lingui_octothorpe__%",Re=(o,e,r={})=>{let t=e||o,i=s=>typeof s=="object"?s:r[s],c=(s,a)=>{let h=Object.keys(r).length?i("number"):void 0,w=se(t,s,h);return a.replace(new RegExp(ye,"g"),w)};return{plural:(s,a)=>{let{offset:h=0}=a,w=me(t,!1,s,a);return c(s-h,w)},selectordinal:(s,a)=>{let{offset:h=0}=a,w=me(t,!0,s,a);return c(s-h,w)},select:Te,number:(s,a)=>se(t,s,i(a)||{style:a}),date:(s,a)=>he(t,s,i(a)||a),time:(s,a)=>Oe(t,s,i(a)||a)}},Te=(o,e)=>e[o]??e.other;function He(o,e,r){return(t={},i)=>{let c=Re(e,r,i),s=(h,w=!1)=>Array.isArray(h)?h.reduce((z,C)=>{if(C==="#"&&w)return z+ye;if(I(C))return z+C;let[O,k,A]=C,S={};k==="plural"||k==="selectordinal"||k==="select"?Object.entries(A).forEach(([j,H])=>{S[j]=s(H,k==="plural"||k==="selectordinal")}):S=A;let x;if(k){let j=c[k];x=j(t[O],S)}else x=t[O];return x==null?z:z+x},""):h,a=s(o);return I(a)&&we.test(a)?xe(a):I(a)?a:a?String(a):""}}var De=Object.defineProperty,Xe=(o,e,r)=>e in o?De(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,qe=(o,e,r)=>(Xe(o,typeof e!="symbol"?e+"":e,r),r),le=class{constructor(){qe(this,"_events",{})}on(e,r){var t;return(t=this._events)[e]??(t[e]=[]),this._events[e].push(r),()=>this.removeListener(e,r)}removeListener(e,r){let t=this._getListeners(e);if(!t)return;let i=t.indexOf(r);~i&&t.splice(i,1)}emit(e,...r){let t=this._getListeners(e);t&&t.map(i=>i.apply(this,r))}_getListeners(e){let r=this._events[e];return Array.isArray(r)?r:!1}},Ue=Object.defineProperty,Ze=(o,e,r)=>e in o?Ue(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,N=(o,e,r)=>(Ze(o,typeof e!="symbol"?e+"":e,r),r),de=class extends le{constructor(e){super(),N(this,"_locale",""),N(this,"_locales"),N(this,"_localeData",{}),N(this,"_messages",{}),N(this,"_missing"),N(this,"_messageCompiler"),N(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(e.locale??fe,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_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,i])=>this._load(t,i)),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 i=t?.message;e||(e=""),I(e)||(r=e.values||r,i=e.message,e=e.id);let c=this.messages[e],s=c===void 0,a=this._missing;if(a&&s)return Ye(a)?a(this._locale,e):a;s&&this.emit("missing",{id:e,locale:this._locale});let h=c||i||e;return I(h)&&(this._messageCompiler?h=this._messageCompiler(h):console.warn(`Uncompiled message detected! Message:
|
|
2
2
|
|
|
3
3
|
> ${h}
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ That means you use raw catalog or your catalog doesn't have a translation for th
|
|
|
6
6
|
ICU features such as interpolation and plurals will not work properly for that message.
|
|
7
7
|
|
|
8
8
|
Please compile your catalog first.
|
|
9
|
-
`))
|
|
9
|
+
`)),I(h)&&we.test(h)?xe(h):I(h)?h:He(h,this._locale,this._locales)(r,t?.formats)}date(e,r){return he(this._locales||this._locale,e,r)}number(e,r){return se(this._locales||this._locale,e,r)}};function Be(o={}){return new de(o)}var ke=Be();var d=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)},g=function(o,e,r,t,i){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?o!==e||!i:!e.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?i.call(o,r):i?i.value=r:e.set(o,r),r};function _e(o){var e,r,t,i,c,s,a,h,w,z,C,O,k,A,S,x,j,H,te;class Le extends o{constructor(...n){var l,u,m;super(...n),e.add(this),this.internals=this.attachInternals(),r.set(this,!1),t.set(this,!1),i.set(this,!1),c.set(this,void 0),s.set(this,void 0),a.set(this,!0),w.set(this,""),z.set(this,()=>{g(this,i,!0,"f"),g(this,r,!0,"f"),d(this,e,"m",x).call(this)}),C.set(this,()=>{g(this,r,!1,"f"),d(this,e,"m",j).call(this,this.shouldFormValueUpdate()?d(this,w,"f"):""),!this.validity.valid&&d(this,i,"f")&&g(this,t,!0,"f");let V=d(this,e,"m",x).call(this);this.validationMessageCallback&&this.validationMessageCallback(V?this.internals.validationMessage:"")}),O.set(this,()=>{var V;d(this,a,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),g(this,a,!1,"f")),g(this,i,!0,"f"),g(this,t,!0,"f"),d(this,e,"m",x).call(this),(V=this===null||this===void 0?void 0:this.validationMessageCallback)===null||V===void 0||V.call(this,this.showError?this.internals.validationMessage:"")}),k.set(this,void 0),A.set(this,!1),S.set(this,Promise.resolve()),(l=this.addEventListener)===null||l===void 0||l.call(this,"focus",d(this,z,"f")),(u=this.addEventListener)===null||u===void 0||u.call(this,"blur",d(this,C,"f")),(m=this.addEventListener)===null||m===void 0||m.call(this,"invalid",d(this,O,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let n=this.validators.map(m=>m.attribute).flat(),l=super.observedAttributes||[];return[...new Set([...l,...n])]}static getValidator(n){return this.validators.find(l=>l.attribute===n)||null}static getValidators(n){return this.validators.filter(l=>{var u;if(l.attribute===n||!((u=l.attribute)===null||u===void 0)&&u.includes(n))return!0})}get form(){return this.internals.form}get showError(){return d(this,e,"m",x).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(n,l,u){var m;(m=super.attributeChangedCallback)===null||m===void 0||m.call(this,n,l,u);let X=this.constructor.getValidators(n);X?.length&&this.validationTarget&&this.setValue(d(this,w,"f"))}setValue(n){var l;g(this,t,!1,"f"),(l=this.validationMessageCallback)===null||l===void 0||l.call(this,""),g(this,w,n,"f");let m=this.shouldFormValueUpdate()?n:null;this.internals.setFormValue(m),d(this,e,"m",j).call(this,m),this.valueChangedCallback&&this.valueChangedCallback(m),d(this,e,"m",x).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(n=>n(d(this,S,"f")))}formResetCallback(){var n,l;g(this,i,!1,"f"),g(this,t,!1,"f"),d(this,e,"m",x).call(this),(n=this.resetFormControl)===null||n===void 0||n.call(this),(l=this.validationMessageCallback)===null||l===void 0||l.call(this,d(this,e,"m",x).call(this)?this.validationMessage:"")}}return r=new WeakMap,t=new WeakMap,i=new WeakMap,c=new WeakMap,s=new WeakMap,a=new WeakMap,w=new WeakMap,z=new WeakMap,C=new WeakMap,O=new WeakMap,k=new WeakMap,A=new WeakMap,S=new WeakMap,e=new WeakSet,h=function(){let n=this.getRootNode(),l=`${this.localName}[name="${this.getAttribute("name")}"]`;return n.querySelectorAll(l)},x=function(){if(this.hasAttribute("disabled"))return!1;let n=d(this,t,"f")||d(this,i,"f")&&!this.validity.valid&&!d(this,r,"f");return n&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),n},j=function(n){let l=this.constructor,u={},m=l.validators,V=[],X=m.some(_=>_.isValid instanceof Promise);d(this,A,"f")||(g(this,S,new Promise(_=>{g(this,k,_,"f")}),"f"),g(this,A,!0,"f")),d(this,c,"f")&&(d(this,c,"f").abort(),g(this,s,d(this,c,"f"),"f"));let q=new AbortController;g(this,c,q,"f");let U,ue=!1;m.length&&(m.forEach(_=>{let oe=_.key||"customError",R=_.isValid(this,n,q.signal);R instanceof Promise?(V.push(R),R.then(ie=>{ie!=null&&(u[oe]=!ie,U=d(this,e,"m",te).call(this,_,n),d(this,e,"m",H).call(this,u,U))})):(u[oe]=!R,this.validity[oe]!==!R&&(ue=!0),!R&&!U&&(U=d(this,e,"m",te).call(this,_,n)))}),Promise.allSettled(V).then(()=>{var _;q?.signal.aborted||(g(this,A,!1,"f"),(_=d(this,k,"f"))===null||_===void 0||_.call(this))}),(ue||!X)&&d(this,e,"m",H).call(this,u,U))},H=function(n,l){if(this.validationTarget)this.internals.setValidity(n,l,this.validationTarget),g(this,a,!1,"f");else{if(this.internals.setValidity(n,l),this.internals.validity.valid)return;g(this,a,!0,"f")}},te=function(n,l){if(this.validityCallback){let u=this.validityCallback(n.key||"customError");if(u)return u}return n.message instanceof Function?n.message(this,l):n.message},Le}import{html as Q,LitElement as Pe,nothing as W}from"lit";import{property as y,query as Qe,state as Ie}from"lit/decorators.js";import{ifDefined as ee}from"lit/directives/if-defined.js";import{css as Ge}from"lit";import{unsafeCSS as Ke}from"lit";var ze=Ge`
|
|
10
10
|
*,
|
|
11
11
|
:before,
|
|
12
12
|
:after {
|
|
@@ -279,7 +279,7 @@ Please compile your catalog first.
|
|
|
279
279
|
svg {
|
|
280
280
|
pointer-events: none;
|
|
281
281
|
}
|
|
282
|
-
`,
|
|
282
|
+
`,nr=Ke(`*, :before, :after {
|
|
283
283
|
--w-rotate: 0;
|
|
284
284
|
--w-rotate-x: 0;
|
|
285
285
|
--w-rotate-y: 0;
|
|
@@ -2445,24 +2445,103 @@ Please compile your catalog first.
|
|
|
2445
2445
|
display: none
|
|
2446
2446
|
}
|
|
2447
2447
|
}
|
|
2448
|
-
`);var
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2448
|
+
`);var Ce="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Fe=(o=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(o|=0));for(;o--;)e+=Ce[r[o]&63];return e};function Ve(o=""){return`${o}${Fe()}`}import{unsafeCSS as Je}from"lit";var Me=Je("*,: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)}.visible{visibility:visible}.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}}");import{css as Ee}from"lit";var Ae=Ee`
|
|
2449
|
+
/* Label component tokens with semantic fallbacks */
|
|
2450
|
+
label {
|
|
2451
|
+
/* Internal tokens - not part of public API */
|
|
2452
|
+
--_color: var(--w-c-input-label-color, var(--w-s-color-text));
|
|
2453
|
+
--_font-size: var(--w-c-input-label-font-size, var(--w-font-size-s));
|
|
2454
|
+
--_line-height: var(--w-c-input-label-line-height, var(--w-line-height-s));
|
|
2455
|
+
--_font-weight: var(--w-c-input-label-font-weight, 700);
|
|
2456
|
+
--_padding-bottom: var(--w-c-input-label-padding-bottom, 0.4rem);
|
|
2457
|
+
--_cursor: var(--w-c-input-label-cursor, pointer);
|
|
2458
|
+
--_display: var(--w-c-input-label-display, block);
|
|
2459
|
+
|
|
2460
|
+
/* Apply styles */
|
|
2461
|
+
display: var(--_display);
|
|
2462
|
+
position: relative;
|
|
2463
|
+
font-size: var(--_font-size);
|
|
2464
|
+
line-height: var(--_line-height);
|
|
2465
|
+
font-weight: var(--_font-weight);
|
|
2466
|
+
padding-bottom: var(--_padding-bottom);
|
|
2467
|
+
cursor: var(--_cursor);
|
|
2468
|
+
color: var(--_color);
|
|
2469
|
+
-webkit-font-smoothing: antialiased;
|
|
2470
|
+
-moz-osx-font-smoothing: grayscale;
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
/* Optional text styling */
|
|
2474
|
+
label span {
|
|
2475
|
+
--_padding-left: var(--w-c-input-optional-padding-left, 0.8rem);
|
|
2476
|
+
--_font-weight: var(--w-c-input-optional-font-weight, 400);
|
|
2477
|
+
--_font-size: var(--w-c-input-optional-font-size, var(--w-font-size-s));
|
|
2478
|
+
--_line-height: var(
|
|
2479
|
+
--w-c-input-optional-line-height,
|
|
2480
|
+
var(--w-line-height-s)
|
|
2481
|
+
);
|
|
2482
|
+
--_color: var(--w-c-input-optional-color, var(--w-s-color-text-subtle));
|
|
2483
|
+
|
|
2484
|
+
padding-left: var(--_padding-left);
|
|
2485
|
+
font-weight: var(--_font-weight);
|
|
2486
|
+
font-size: var(--_font-size);
|
|
2487
|
+
line-height: var(--_line-height);
|
|
2488
|
+
color: var(--_color);
|
|
2489
|
+
}
|
|
2490
|
+
`,Se=Ee`
|
|
2491
|
+
/* Help text component tokens with semantic fallbacks */
|
|
2492
|
+
:host {
|
|
2493
|
+
--_help-text-color: var(
|
|
2494
|
+
--w-c-input-help-text-color,
|
|
2495
|
+
var(--w-s-color-text-subtle)
|
|
2496
|
+
);
|
|
2497
|
+
--_help-text-font-size: var(
|
|
2498
|
+
--w-c-input-help-text-font-size,
|
|
2499
|
+
var(--w-font-size-xs)
|
|
2500
|
+
);
|
|
2501
|
+
--_help-text-line-height: var(
|
|
2502
|
+
--w-c-input-help-text-line-height,
|
|
2503
|
+
var(--w-line-height-xs)
|
|
2504
|
+
);
|
|
2505
|
+
--_help-text-margin-top: var(--w-c-input-help-text-margin-top, 0.4rem);
|
|
2506
|
+
--_help-text-display: var(--w-c-input-help-text-display, block);
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
/* Invalid state overrides color */
|
|
2510
|
+
:host([invalid]) {
|
|
2511
|
+
--_help-text-color: var(
|
|
2512
|
+
--w-c-input-help-text-color-invalid,
|
|
2513
|
+
var(--w-s-color-text-negative)
|
|
2514
|
+
);
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
.help-text {
|
|
2518
|
+
font-size: var(--_help-text-font-size);
|
|
2519
|
+
line-height: var(--_help-text-line-height);
|
|
2520
|
+
margin-top: var(--_help-text-margin-top);
|
|
2521
|
+
display: var(--_help-text-display);
|
|
2522
|
+
color: var(--_help-text-color);
|
|
2523
|
+
}
|
|
2524
|
+
`;var $={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"},B,re,Y,T,L,b,be,Z,E,$e,G,pe,p=class extends _e(Pe){constructor(){super(...arguments);P(this,b);this.disabled=!1;this.invalid=!1;this.readOnly=!1;this.readonly=!1;this.required=!1;this.optional=!1;this.minHeight=Number.NEGATIVE_INFINITY;this.maxHeight=Number.POSITIVE_INFINITY;P(this,B);P(this,re,Ve("textarea-"));P(this,Y,!1);P(this,T);P(this,L,!1);P(this,G,r=>{r.preventDefault(),F(this,L,!0),v(this,b,E).call(this)})}updated(r){r.has("value")&&typeof this.value<"u"&&this.setValue(this.value),(r.has("value")||r.has("required")||r.has("disabled"))&&v(this,b,E).call(this)}resetFormControl(){this.value=M(this,B),F(this,L,!1),v(this,b,Z).call(this),v(this,b,E).call(this)}get validationMessage(){return this.internals.validationMessage}get validity(){return this.internals.validity}checkValidity(){return v(this,b,E).call(this),this.internals.checkValidity()}reportValidity(){return F(this,L,!0),v(this,b,E).call(this),this.internals.checkValidity()}setCustomValidity(r){r?(this.internals.setValidity({customError:!0},r,this._textarea),v(this,b,be).call(this,r)):(v(this,b,Z).call(this),v(this,b,E).call(this))}get _textareaStyles(){return ne([$.base,$.textArea,!!this.placeholder&&$.placeholder,!this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&$.default,this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&$.invalid,!this.invalid&&this.disabled&&!(this.readonly||this.readOnly)&&$.disabled,!this.invalid&&!this.disabled&&(this.readonly||this.readOnly)&&$.readOnly,this.maxRows&&$.fixed])}get _helptextstyles(){return"help-text"}get _helpId(){if(this.helpText)return`${this._id}__hint`}get _id(){return M(this,re)}get _error(){if(this.invalid&&this._helpId)return this._helpId}async connectedCallback(){if(super.connectedCallback(),F(this,B,this.value),typeof this.value<"u"&&this.setValue(this.value),this.addEventListener("invalid",M(this,G)),await this.updateComplete,this.value||this.minRows){let r=this.shadowRoot?.querySelector("textarea");r&&v(this,b,pe).call(this,r)}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",M(this,G))}firstUpdated(r){super.firstUpdated(r),v(this,b,E).call(this)}handler(r){let t=r.currentTarget;this.value=t.value,v(this,b,pe).call(this,t)}render(){return Q`
|
|
2525
|
+
${this.label?Q`
|
|
2526
|
+
<label for="${this._id}">
|
|
2527
|
+
${this.label}
|
|
2528
|
+
${this.optional?Q`
|
|
2529
|
+
<span>
|
|
2530
|
+
${ke._({id:"textarea.label.optional",message:"(optional)",comment:"Shown behind label when marked as optional"})}
|
|
2531
|
+
</span>
|
|
2532
|
+
`:W}
|
|
2533
|
+
</label>
|
|
2534
|
+
`:W}
|
|
2457
2535
|
<textarea
|
|
2536
|
+
part="input"
|
|
2458
2537
|
id="${this._id}"
|
|
2459
2538
|
class="${this._textareaStyles}"
|
|
2460
|
-
name="${
|
|
2461
|
-
placeholder="${
|
|
2539
|
+
name="${ee(this.name)}"
|
|
2540
|
+
placeholder="${ee(this.placeholder)}"
|
|
2462
2541
|
.value="${this.value||""}"
|
|
2463
|
-
aria-describedby="${
|
|
2464
|
-
aria-errormessage="${
|
|
2465
|
-
aria-invalid=${this.invalid?"true":
|
|
2542
|
+
aria-describedby="${ee(this._helpId||(this.ariaDescription?"aria-description":void 0))}"
|
|
2543
|
+
aria-errormessage="${ee(this._error)}"
|
|
2544
|
+
aria-invalid=${this.invalid?"true":W}
|
|
2466
2545
|
?disabled="${this.disabled}"
|
|
2467
2546
|
?readonly="${this.readonly||this.readOnly}"
|
|
2468
2547
|
?required="${this.required}"
|
|
@@ -2470,8 +2549,8 @@ Please compile your catalog first.
|
|
|
2470
2549
|
@blur="${v(this,b,$e)}"
|
|
2471
2550
|
>
|
|
2472
2551
|
</textarea>
|
|
2473
|
-
${this.helpText?
|
|
2552
|
+
${this.helpText?Q`<div class="${this._helptextstyles}" id="${this._helpId}">
|
|
2474
2553
|
${this.helpText}
|
|
2475
|
-
</div>`:
|
|
2476
|
-
`}};B=new WeakMap,
|
|
2554
|
+
</div>`:W}
|
|
2555
|
+
`}};B=new WeakMap,re=new WeakMap,Y=new WeakMap,T=new WeakMap,L=new WeakMap,b=new WeakSet,be=function(r){M(this,Y)||F(this,T,this.helpText),F(this,Y,!0),this.invalid=!0,this.helpText=r},Z=function(){M(this,Y)&&(this.invalid=!1,this.helpText=M(this,T),F(this,T,void 0),F(this,Y,!1))},E=function(){if(this.disabled){this.internals.setValidity({}),v(this,b,Z).call(this);return}if(this.required&&!this.value){let r=this._textarea?.validationMessage||"";this.internals.setValidity({valueMissing:!0},r,this._textarea),M(this,L)&&v(this,b,be).call(this,r);return}this.internals.setValidity({}),v(this,b,Z).call(this)},$e=function(){F(this,L,!0),v(this,b,E).call(this)},G=new WeakMap,pe=function(r){let t=getComputedStyle(r),i=Number.parseFloat(t.getPropertyValue("border-top-width")),c=Number.parseFloat(t.getPropertyValue("border-bottom-width")),s=Number.parseFloat(t.getPropertyValue("line-height")),a=Number.parseFloat(t.getPropertyValue("padding-top")),h=Number.parseFloat(t.getPropertyValue("padding-bottom")),w=a+h+c+i;this.minRows&&(this.minHeight=s*this.minRows+w),this.maxRows&&(this.maxHeight=s*this.maxRows+w);let z=r.scrollHeight+i+c,C=Math.min(this.maxHeight,Math.max(this.minHeight,z));r.style.setProperty("height",C+"px")},p.shadowRootOptions={...Pe.shadowRootOptions,delegatesFocus:!0},p.styles=[ze,Me,Ae,Se],f([y({type:Boolean,reflect:!0})],p.prototype,"disabled",2),f([y({type:Boolean,reflect:!0})],p.prototype,"invalid",2),f([y({type:String,reflect:!0})],p.prototype,"label",2),f([y({type:String,reflect:!0,attribute:"help-text"})],p.prototype,"helpText",2),f([y({type:Number,reflect:!0,attribute:"maximum-rows"})],p.prototype,"maxRows",2),f([y({type:Number,reflect:!0,attribute:"minimum-rows"})],p.prototype,"minRows",2),f([y({type:String,reflect:!0})],p.prototype,"name",2),f([y({type:String,reflect:!0})],p.prototype,"placeholder",2),f([y({type:Boolean,reflect:!0,attribute:"read-only"})],p.prototype,"readOnly",2),f([y({type:Boolean,reflect:!0})],p.prototype,"readonly",2),f([y({type:Boolean,reflect:!0})],p.prototype,"required",2),f([y({type:String,reflect:!0})],p.prototype,"value",2),f([y({type:Boolean,reflect:!0})],p.prototype,"optional",2),f([Ie()],p.prototype,"minHeight",2),f([Ie()],p.prototype,"maxHeight",2),f([Qe("textarea")],p.prototype,"_textarea",2);customElements.get("w-textarea")||customElements.define("w-textarea",p);export{p as WarpTextarea};
|
|
2477
2556
|
//# sourceMappingURL=textarea.js.map
|