Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spectrum-web-components/alert-dialog

Package Overview
Dependencies
Maintainers
7
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spectrum-web-components/alert-dialog - npm Package Compare versions

Comparing version 0.39.0 to 0.39.1

6

custom-elements.json

@@ -47,2 +47,8 @@ {

"kind": "field",
"name": "resizeController",
"privacy": "private",
"default": "new ResizeController(this, {\n callback: () => {\n this.shouldManageTabOrderForScrolling();\n },\n })"
},
{
"kind": "field",
"name": "_variant",

@@ -49,0 +55,0 @@ "type": {

17

package.json
{
"name": "@spectrum-web-components/alert-dialog",
"version": "0.39.0",
"version": "0.39.1",
"publishConfig": {

@@ -60,8 +60,9 @@ "access": "public"

"dependencies": {
"@spectrum-web-components/base": "^0.39.0",
"@spectrum-web-components/button": "^0.39.0",
"@spectrum-web-components/button-group": "^0.39.0",
"@spectrum-web-components/divider": "^0.39.0",
"@spectrum-web-components/icons-workflow": "^0.39.0",
"@spectrum-web-components/shared": "^0.39.0"
"@lit-labs/observers": "^2.0.0",
"@spectrum-web-components/base": "^0.39.1",
"@spectrum-web-components/button": "^0.39.1",
"@spectrum-web-components/button-group": "^0.39.1",
"@spectrum-web-components/divider": "^0.39.1",
"@spectrum-web-components/icons-workflow": "^0.39.1",
"@spectrum-web-components/shared": "^0.39.1"
},

@@ -78,3 +79,3 @@ "devDependencies": {

],
"gitHead": "2acc8390ef0ac6cc940958d4da705c9859155c0d"
"gitHead": "d374f8645b54b978d830c95ff777b5b1e9172ac7"
}

@@ -9,2 +9,3 @@ import { CSSResultArray, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';

private contentElement;
private resizeController;
_variant: AlertDialogVariants;

@@ -28,5 +29,3 @@ set variant(variant: AlertDialogVariants);

protected render(): TemplateResult;
connectedCallback(): void;
disconnectedCallback(): void;
}
export {};

@@ -22,5 +22,6 @@ "use strict";

import "@spectrum-web-components/button/sp-button.js";
import alertStyles from "./alert-dialog.css.js";
import { FocusVisiblePolyfillMixin } from "@spectrum-web-components/shared";
import { conditionAttributeWithId } from "@spectrum-web-components/base/src/condition-attribute-with-id.js";
import { ResizeController } from "@lit-labs/observers/resize-controller.js";
import alertStyles from "./alert-dialog.css.js";
export const alertDialogVariants = [

@@ -52,5 +53,12 @@ "confirmation",

super(...arguments);
this.resizeController = new ResizeController(this, {
callback: () => {
this.shouldManageTabOrderForScrolling();
}
});
this._variant = "";
this.labelledbyId = `sp-dialog-label-${_AlertDialog.instanceCount++}`;
this.shouldManageTabOrderForScrolling = () => {
if (!this.contentElement)
return;
const { offsetHeight, scrollHeight } = this.contentElement;

@@ -131,3 +139,4 @@ if (offsetHeight < scrollHeight) {

requestAnimationFrame(() => {
this.shouldManageTabOrderForScrolling();
this.resizeController.unobserve(this.contentElement);
this.resizeController.observe(this.contentElement);
});

@@ -183,16 +192,2 @@ if (this.conditionDescribedby) {

}
connectedCallback() {
super.connectedCallback();
window.addEventListener(
"resize",
this.shouldManageTabOrderForScrolling
);
}
disconnectedCallback() {
window.removeEventListener(
"resize",
this.shouldManageTabOrderForScrolling
);
super.disconnectedCallback();
}
};

@@ -199,0 +194,0 @@ _AlertDialog.instanceCount = 0;

@@ -1,2 +0,2 @@

"use strict";var h=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=(d,r,t,e)=>{for(var i=e>1?void 0:e?u(r,t):r,n=d.length-1,a;n>=0;n--)(a=d[n])&&(i=(e?a(r,t,i):a(i))||i);return e&&i&&h(r,t,i),i};import{html as o,SpectrumElement as p}from"@spectrum-web-components/base";import{property as g,query as v}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/button/sp-button.js";import m from"./alert-dialog.css.js";import{FocusVisiblePolyfillMixin as y}from"@spectrum-web-components/shared";import{conditionAttributeWithId as c}from"@spectrum-web-components/base/src/condition-attribute-with-id.js";export const alertDialogVariants=["confirmation","information","warning","error","destructive","secondary"];let f=0;function b(d,r){const t=d.assignedElements(),e=[];return t.forEach(i=>{if(i.id)e.push(i.id);else{const n=r+`-${f++}`;i.id=n,e.push(n)}}),e}const s=class s extends y(p){constructor(){super(...arguments);this._variant="";this.labelledbyId=`sp-dialog-label-${s.instanceCount++}`;this.shouldManageTabOrderForScrolling=()=>{const{offsetHeight:t,scrollHeight:e}=this.contentElement;t<e?this.contentElement.tabIndex=0:this.contentElement.removeAttribute("tabindex")};this.describedbyId=`sp-dialog-description-${s.instanceCount++}`}static get styles(){return[m]}set variant(t){if(t===this.variant)return;const e=this.variant;alertDialogVariants.includes(t)?(this.setAttribute("variant",t),this._variant=t):(this.removeAttribute("variant"),this._variant=""),this.requestUpdate("variant",e)}get variant(){return this._variant}renderIcon(){switch(this.variant){case"warning":case"error":return o`
"use strict";var b=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var d=(l,r,e,t)=>{for(var i=t>1?void 0:t?p(r,e):r,n=l.length-1,a;n>=0;n--)(a=l[n])&&(i=(t?a(r,e,i):a(i))||i);return t&&i&&b(r,e,i),i};import{html as o,SpectrumElement as u}from"@spectrum-web-components/base";import{property as m,query as g}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/button/sp-button.js";import{FocusVisiblePolyfillMixin as v}from"@spectrum-web-components/shared";import{conditionAttributeWithId as c}from"@spectrum-web-components/base/src/condition-attribute-with-id.js";import{ResizeController as y}from"@lit-labs/observers/resize-controller.js";import f from"./alert-dialog.css.js";export const alertDialogVariants=["confirmation","information","warning","error","destructive","secondary"];let E=0;function h(l,r){const e=l.assignedElements(),t=[];return e.forEach(i=>{if(i.id)t.push(i.id);else{const n=r+`-${E++}`;i.id=n,t.push(n)}}),t}const s=class s extends v(u){constructor(){super(...arguments);this.resizeController=new y(this,{callback:()=>{this.shouldManageTabOrderForScrolling()}});this._variant="";this.labelledbyId=`sp-dialog-label-${s.instanceCount++}`;this.shouldManageTabOrderForScrolling=()=>{if(!this.contentElement)return;const{offsetHeight:e,scrollHeight:t}=this.contentElement;e<t?this.contentElement.tabIndex=0:this.contentElement.removeAttribute("tabindex")};this.describedbyId=`sp-dialog-description-${s.instanceCount++}`}static get styles(){return[f]}set variant(e){if(e===this.variant)return;const t=this.variant;alertDialogVariants.includes(e)?(this.setAttribute("variant",e),this._variant=e):(this.removeAttribute("variant"),this._variant=""),this.requestUpdate("variant",t)}get variant(){return this._variant}renderIcon(){switch(this.variant){case"warning":case"error":return o`
<sp-icon-alert class="icon"></sp-icon-alert>

@@ -9,3 +9,3 @@ `;default:return o``}}renderHeading(){return o`

</div>
`}onHeadingSlotchange({target:t}){this.conditionLabelledby&&(this.conditionLabelledby(),delete this.conditionLabelledby);const e=b(t,this.labelledbyId);e.length&&(this.conditionLabelledby=c(this,"aria-labelledby",e))}onContentSlotChange({target:t}){requestAnimationFrame(()=>{this.shouldManageTabOrderForScrolling()}),this.conditionDescribedby&&(this.conditionDescribedby(),delete this.conditionDescribedby);const e=b(t,this.describedbyId);if(e.length&&e.length<4)this.conditionDescribedby=c(this,"aria-describedby",e);else if(!e.length){const i=!!this.id;i||(this.id=this.describedbyId);const n=c(this,"aria-describedby",this.id);this.conditionDescribedby=()=>{n(),i||this.removeAttribute("id")}}}renderButtons(){return o`
`}onHeadingSlotchange({target:e}){this.conditionLabelledby&&(this.conditionLabelledby(),delete this.conditionLabelledby);const t=h(e,this.labelledbyId);t.length&&(this.conditionLabelledby=c(this,"aria-labelledby",t))}onContentSlotChange({target:e}){requestAnimationFrame(()=>{this.resizeController.unobserve(this.contentElement),this.resizeController.observe(this.contentElement)}),this.conditionDescribedby&&(this.conditionDescribedby(),delete this.conditionDescribedby);const t=h(e,this.describedbyId);if(t.length&&t.length<4)this.conditionDescribedby=c(this,"aria-describedby",t);else if(!t.length){const i=!!this.id;i||(this.id=this.describedbyId);const n=c(this,"aria-describedby",this.id);this.conditionDescribedby=()=>{n(),i||this.removeAttribute("id")}}}renderButtons(){return o`
<sp-button-group class="button-group">

@@ -22,3 +22,3 @@ <slot name="button"></slot>

</div>
`}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.shouldManageTabOrderForScrolling)}disconnectedCallback(){window.removeEventListener("resize",this.shouldManageTabOrderForScrolling),super.disconnectedCallback()}};s.instanceCount=0,l([v(".content")],s.prototype,"contentElement",2),l([g({type:String,reflect:!0})],s.prototype,"variant",1);export let AlertDialog=s;
`}};s.instanceCount=0,d([g(".content")],s.prototype,"contentElement",2),d([m({type:String,reflect:!0})],s.prototype,"variant",1);export let AlertDialog=s;
//# sourceMappingURL=AlertDialog.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc