@spectrum-web-components/field-label
Advanced tools
Comparing version 0.37.0 to 0.38.0
{ | ||
"name": "@spectrum-web-components/field-label", | ||
"version": "0.37.0", | ||
"version": "0.38.0", | ||
"publishConfig": { | ||
@@ -60,7 +60,7 @@ "access": "public" | ||
"dependencies": { | ||
"@spectrum-web-components/base": "^0.37.0", | ||
"@spectrum-web-components/icon": "^0.37.0", | ||
"@spectrum-web-components/icons-ui": "^0.37.0", | ||
"@spectrum-web-components/reactive-controllers": "^0.37.0", | ||
"@spectrum-web-components/shared": "^0.37.0" | ||
"@spectrum-web-components/base": "^0.38.0", | ||
"@spectrum-web-components/icon": "^0.38.0", | ||
"@spectrum-web-components/icons-ui": "^0.38.0", | ||
"@spectrum-web-components/reactive-controllers": "^0.38.0", | ||
"@spectrum-web-components/shared": "^0.38.0" | ||
}, | ||
@@ -76,3 +76,3 @@ "devDependencies": { | ||
], | ||
"gitHead": "d771f62f0d8063070af43283bb0fd5e3400bad06" | ||
"gitHead": "9a099b7543672f2fd4030833ab813b16c2cad62e" | ||
} |
"use strict"; | ||
import { css } from "@spectrum-web-components/base"; | ||
const styles = css` | ||
:host{--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-color:var( | ||
:host{--spectrum-fieldlabel-color:var( | ||
--spectrum-neutral-subdued-content-color-default | ||
);--spectrum-field-label-top-to-asterisk:var( | ||
--spectrum-field-label-top-to-asterisk-medium | ||
);--spectrum-field-label-text-to-asterisk:var( | ||
--spectrum-field-label-text-to-asterisk-medium | ||
);--spectrum-fieldlabel-font-weight:var(--spectrum-regular-font-weight);--spectrum-fieldlabel-line-height:var(--spectrum-line-height-100);--spectrum-fieldlabel-line-height-cjk:var(--spectrum-cjk-line-height-100)}:host([size=s]){--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
@@ -18,3 +14,3 @@ --spectrum-component-bottom-to-text-75 | ||
--spectrum-field-label-text-to-asterisk-small | ||
)}:host([size=m]){--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
)}:host{--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
--spectrum-component-bottom-to-text-75 | ||
@@ -21,0 +17,0 @@ );--spectrum-fieldlabel-font-size:var(--spectrum-font-size-75);--spectrum-fieldlabel-side-padding-top:var( |
"use strict";import{css as e}from"@spectrum-web-components/base";const t=e` | ||
:host{--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-color:var( | ||
:host{--spectrum-fieldlabel-color:var( | ||
--spectrum-neutral-subdued-content-color-default | ||
);--spectrum-field-label-top-to-asterisk:var( | ||
--spectrum-field-label-top-to-asterisk-medium | ||
);--spectrum-field-label-text-to-asterisk:var( | ||
--spectrum-field-label-text-to-asterisk-medium | ||
);--spectrum-fieldlabel-font-weight:var(--spectrum-regular-font-weight);--spectrum-fieldlabel-line-height:var(--spectrum-line-height-100);--spectrum-fieldlabel-line-height-cjk:var(--spectrum-cjk-line-height-100)}:host([size=s]){--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
@@ -16,3 +12,3 @@ --spectrum-component-bottom-to-text-75 | ||
--spectrum-field-label-text-to-asterisk-small | ||
)}:host([size=m]){--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
)}:host{--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
--spectrum-component-bottom-to-text-75 | ||
@@ -19,0 +15,0 @@ );--spectrum-fieldlabel-font-size:var(--spectrum-font-size-75);--spectrum-fieldlabel-side-padding-top:var( |
@@ -15,2 +15,3 @@ "use strict"; | ||
html, | ||
nothing, | ||
SizedMixin, | ||
@@ -34,3 +35,5 @@ SpectrumElement | ||
import styles from "./field-label.css.js"; | ||
const _FieldLabel = class _FieldLabel extends SizedMixin(SpectrumElement) { | ||
const _FieldLabel = class _FieldLabel extends SizedMixin(SpectrumElement, { | ||
noDefaultSize: true | ||
}) { | ||
constructor() { | ||
@@ -115,3 +118,3 @@ super(...arguments); | ||
></sp-icon-asterisk100> | ||
` : html``} | ||
` : nothing} | ||
</label> | ||
@@ -118,0 +121,0 @@ `; |
@@ -1,11 +0,11 @@ | ||
"use strict";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=(p,l,e,s)=>{for(var t=s>1?void 0:s?u(l,e):l,r=p.length-1,o;r>=0;r--)(o=p[r])&&(t=(s?o(l,e,t):o(t))||t);return s&&t&&d(l,e,t),t};import{html as c,SizedMixin as m,SpectrumElement as b}from"@spectrum-web-components/base";import{property as n,query as f}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-asterisk100.js";import h from"@spectrum-web-components/icon/src/spectrum-icon-asterisk.css.js";import{conditionAttributeWithId as g,conditionAttributeWithoutId as y}from"@spectrum-web-components/base/src/condition-attribute-with-id.js";import{ElementResolutionController as v,elementResolverUpdatedSymbol as E}from"@spectrum-web-components/reactive-controllers/src/ElementResolution.js";import T from"./field-label.css.js";const i=class i extends m(b){constructor(){super(...arguments);this.disabled=!1;this.id="";this.for="";this.required=!1;this.resolvedElement=new v(this)}static get styles(){return[T,h]}handleClick(e){if(!this.target||this.disabled||e.defaultPrevented)return;this.target.focus();const s=this.getRootNode(),t=this.target,r=t.getRootNode(),o=r.host;r===s&&t.forceFocusVisible?t.forceFocusVisible():o&&o.forceFocusVisible&&o.forceFocusVisible()}applyTargetLabel(e){if(this.target=e||this.target,this.target){const s=this.target.applyFocusElementLabel,t=this.target.focusElement||this.target,r=t.getRootNode();typeof s!="undefined"?s(this.labelText):r===this.getRootNode()?(e?g:y)(t,"aria-labelledby",[this.id]):e?t.setAttribute("aria-label",this.labelText):t.removeAttribute("aria-label")}}async manageTarget(){this.applyTargetLabel();const e=this.resolvedElement.element;if(!e){this.target=e;return}e.localName.search("-")>0&&await customElements.whenDefined(e.localName),typeof e.updateComplete!="undefined"&&await e.updateComplete,this.applyTargetLabel(e)}get labelText(){const e=this.slotEl.assignedNodes({flatten:!0});return e.length?e.map(t=>(t.textContent||"").trim()).join(" "):""}render(){return c` | ||
"use strict";var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var a=(c,l,e,i)=>{for(var t=i>1?void 0:i?d(l,e):l,r=c.length-1,o;r>=0;r--)(o=c[r])&&(t=(i?o(l,e,t):o(t))||t);return i&&t&&u(l,e,t),t};import{html as p,nothing as m,SizedMixin as b,SpectrumElement as f}from"@spectrum-web-components/base";import{property as n,query as h}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-asterisk100.js";import g from"@spectrum-web-components/icon/src/spectrum-icon-asterisk.css.js";import{conditionAttributeWithId as y,conditionAttributeWithoutId as v}from"@spectrum-web-components/base/src/condition-attribute-with-id.js";import{ElementResolutionController as E,elementResolverUpdatedSymbol as T}from"@spectrum-web-components/reactive-controllers/src/ElementResolution.js";import A from"./field-label.css.js";const s=class s extends b(f,{noDefaultSize:!0}){constructor(){super(...arguments);this.disabled=!1;this.id="";this.for="";this.required=!1;this.resolvedElement=new E(this)}static get styles(){return[A,g]}handleClick(e){if(!this.target||this.disabled||e.defaultPrevented)return;this.target.focus();const i=this.getRootNode(),t=this.target,r=t.getRootNode(),o=r.host;r===i&&t.forceFocusVisible?t.forceFocusVisible():o&&o.forceFocusVisible&&o.forceFocusVisible()}applyTargetLabel(e){if(this.target=e||this.target,this.target){const i=this.target.applyFocusElementLabel,t=this.target.focusElement||this.target,r=t.getRootNode();typeof i!="undefined"?i(this.labelText):r===this.getRootNode()?(e?y:v)(t,"aria-labelledby",[this.id]):e?t.setAttribute("aria-label",this.labelText):t.removeAttribute("aria-label")}}async manageTarget(){this.applyTargetLabel();const e=this.resolvedElement.element;if(!e){this.target=e;return}e.localName.search("-")>0&&await customElements.whenDefined(e.localName),typeof e.updateComplete!="undefined"&&await e.updateComplete,this.applyTargetLabel(e)}get labelText(){const e=this.slotEl.assignedNodes({flatten:!0});return e.length?e.map(t=>(t.textContent||"").trim()).join(" "):""}render(){return p` | ||
<label> | ||
<slot></slot> | ||
${this.required?c` | ||
${this.required?p` | ||
<sp-icon-asterisk100 | ||
class="required-icon spectrum-UIIcon-Asterisk100" | ||
></sp-icon-asterisk100> | ||
`:c``} | ||
`:m} | ||
</label> | ||
`}firstUpdated(e){super.firstUpdated(e),this.addEventListener("click",this.handleClick)}willUpdate(e){this.hasAttribute("id")||this.setAttribute("id",`${this.tagName.toLowerCase()}-${i.instanceCount++}`),e.has("for")&&(this.resolvedElement.selector=this.for?`#${this.for}`:""),(e.has("id")||e.has(E))&&this.manageTarget()}};i.instanceCount=0,a([n({type:Boolean,reflect:!0})],i.prototype,"disabled",2),a([n({type:String})],i.prototype,"id",2),a([n({type:String})],i.prototype,"for",2),a([n({type:Boolean,reflect:!0})],i.prototype,"required",2),a([f("slot")],i.prototype,"slotEl",2),a([n({type:String,reflect:!0,attribute:"side-aligned"})],i.prototype,"sideAligned",2);export let FieldLabel=i; | ||
`}firstUpdated(e){super.firstUpdated(e),this.addEventListener("click",this.handleClick)}willUpdate(e){this.hasAttribute("id")||this.setAttribute("id",`${this.tagName.toLowerCase()}-${s.instanceCount++}`),e.has("for")&&(this.resolvedElement.selector=this.for?`#${this.for}`:""),(e.has("id")||e.has(T))&&this.manageTarget()}};s.instanceCount=0,a([n({type:Boolean,reflect:!0})],s.prototype,"disabled",2),a([n({type:String})],s.prototype,"id",2),a([n({type:String})],s.prototype,"for",2),a([n({type:Boolean,reflect:!0})],s.prototype,"required",2),a([h("slot")],s.prototype,"slotEl",2),a([n({type:String,reflect:!0,attribute:"side-aligned"})],s.prototype,"sideAligned",2);export let FieldLabel=s; | ||
//# sourceMappingURL=FieldLabel.js.map |
@@ -40,6 +40,7 @@ // @ts-check | ||
), | ||
// Default to `size='m'` without needing the attribute | ||
converter.classToHost('spectrum-FieldLabel--sizeM'), | ||
...converter.enumerateAttributes( | ||
[ | ||
['spectrum-FieldLabel--sizeS', 's'], | ||
['spectrum-FieldLabel--sizeM', 'm'], | ||
['spectrum-FieldLabel--sizeL', 'l'], | ||
@@ -46,0 +47,0 @@ ['spectrum-FieldLabel--sizeXL', 'xl'], |
"use strict"; | ||
import { css } from "@spectrum-web-components/base"; | ||
const styles = css` | ||
:host{--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-color:var( | ||
:host{--spectrum-fieldlabel-color:var( | ||
--spectrum-neutral-subdued-content-color-default | ||
);--spectrum-field-label-top-to-asterisk:var( | ||
--spectrum-field-label-top-to-asterisk-medium | ||
);--spectrum-field-label-text-to-asterisk:var( | ||
--spectrum-field-label-text-to-asterisk-medium | ||
);--spectrum-fieldlabel-font-weight:var(--spectrum-regular-font-weight);--spectrum-fieldlabel-line-height:var(--spectrum-line-height-100);--spectrum-fieldlabel-line-height-cjk:var(--spectrum-cjk-line-height-100)}:host([size=s]){--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
@@ -18,3 +14,3 @@ --spectrum-component-bottom-to-text-75 | ||
--spectrum-field-label-text-to-asterisk-small | ||
)}:host([size=m]){--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
)}:host{--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
--spectrum-component-bottom-to-text-75 | ||
@@ -21,0 +17,0 @@ );--spectrum-fieldlabel-font-size:var(--spectrum-font-size-75);--spectrum-fieldlabel-side-padding-top:var( |
"use strict";import{css as e}from"@spectrum-web-components/base";const t=e` | ||
:host{--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-color:var( | ||
:host{--spectrum-fieldlabel-color:var( | ||
--spectrum-neutral-subdued-content-color-default | ||
);--spectrum-field-label-top-to-asterisk:var( | ||
--spectrum-field-label-top-to-asterisk-medium | ||
);--spectrum-field-label-text-to-asterisk:var( | ||
--spectrum-field-label-text-to-asterisk-medium | ||
);--spectrum-fieldlabel-font-weight:var(--spectrum-regular-font-weight);--spectrum-fieldlabel-line-height:var(--spectrum-line-height-100);--spectrum-fieldlabel-line-height-cjk:var(--spectrum-cjk-line-height-100)}:host([size=s]){--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
@@ -16,3 +12,3 @@ --spectrum-component-bottom-to-text-75 | ||
--spectrum-field-label-text-to-asterisk-small | ||
)}:host([size=m]){--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
)}:host{--spectrum-fieldlabel-min-height:var(--spectrum-component-height-75);--spectrum-fieldlabel-top-to-text:var(--spectrum-component-top-to-text-75);--spectrum-fieldlabel-bottom-to-text:var( | ||
--spectrum-component-bottom-to-text-75 | ||
@@ -19,0 +15,0 @@ );--spectrum-fieldlabel-font-size:var(--spectrum-font-size-75);--spectrum-fieldlabel-side-padding-top:var( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138477
1196
1
+ Added@spectrum-web-components/base@0.38.0(transitive)
+ Added@spectrum-web-components/icon@0.38.0(transitive)
+ Added@spectrum-web-components/icons-ui@0.38.0(transitive)
+ Added@spectrum-web-components/iconset@0.38.0(transitive)
+ Added@spectrum-web-components/reactive-controllers@0.38.0(transitive)
+ Added@spectrum-web-components/shared@0.38.0(transitive)
- Removed@spectrum-web-components/base@0.37.0(transitive)
- Removed@spectrum-web-components/icon@0.37.0(transitive)
- Removed@spectrum-web-components/icons-ui@0.37.0(transitive)
- Removed@spectrum-web-components/iconset@0.37.0(transitive)
- Removed@spectrum-web-components/reactive-controllers@0.37.0(transitive)
- Removed@spectrum-web-components/shared@0.37.0(transitive)
Updated@spectrum-web-components/reactive-controllers@^0.38.0