@justeattakeaway/pie-spinner
Advanced tools
Comparing version 0.6.7 to 0.7.0
@@ -80,3 +80,3 @@ { | ||
"type": { | ||
"text": "AriaProps | undefined" | ||
"text": "SpinnerProps['aria']" | ||
}, | ||
@@ -89,5 +89,2 @@ "privacy": "public", | ||
"name": "size", | ||
"type": { | ||
"text": "SpinnerProps['size'] | undefined" | ||
}, | ||
"privacy": "public", | ||
@@ -99,7 +96,9 @@ "attribute": "size" | ||
"name": "variant", | ||
"type": { | ||
"text": "SpinnerProps['variant'] | undefined" | ||
}, | ||
"privacy": "public", | ||
"attribute": "variant" | ||
}, | ||
{ | ||
"kind": "method", | ||
"name": "renderAriaLabel", | ||
"privacy": "private" | ||
} | ||
@@ -111,3 +110,3 @@ ], | ||
"type": { | ||
"text": "AriaProps | undefined" | ||
"text": "SpinnerProps['aria']" | ||
}, | ||
@@ -118,5 +117,2 @@ "fieldName": "aria" | ||
"name": "size", | ||
"type": { | ||
"text": "SpinnerProps['size'] | undefined" | ||
}, | ||
"fieldName": "size" | ||
@@ -126,5 +122,2 @@ }, | ||
"name": "variant", | ||
"type": { | ||
"text": "SpinnerProps['variant'] | undefined" | ||
}, | ||
"fieldName": "variant" | ||
@@ -131,0 +124,0 @@ } |
@@ -6,3 +6,3 @@ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core'; | ||
export declare type AriaProps = { | ||
declare type AriaProps = { | ||
label?: string; | ||
@@ -19,6 +19,7 @@ }; | ||
export declare class PieSpinner extends LitElement implements SpinnerProps { | ||
aria?: AriaProps; | ||
size?: SpinnerProps['size']; | ||
variant?: SpinnerProps['variant']; | ||
aria: SpinnerProps['aria']; | ||
size: "xsmall" | "small" | "medium" | "large" | "xlarge"; | ||
variant: "brand" | "secondary" | "inverse"; | ||
render(): TemplateResult<1>; | ||
private renderAriaLabel; | ||
static styles: CSSResult; | ||
@@ -25,0 +26,0 @@ } |
@@ -1,13 +0,14 @@ | ||
import { unsafeCSS as h, LitElement as m, html as d, nothing as z } from "lit"; | ||
import { unsafeCSS as h, LitElement as m, html as d, nothing as f } from "lit"; | ||
import { property as p } from "lit/decorators.js"; | ||
import { validPropertyValues as b, defineCustomElement as f } from "@justeattakeaway/pie-webc-core"; | ||
const u = `*,*:after,*:before{box-sizing:inherit}@keyframes rotate360{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.c-spinner{--spinner-size: 24px;--spinner-left-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), 1);--spinner-right-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), .35);block-size:var(--spinner-size);inline-size:var(--spinner-size);border-radius:var(--dt-radius-rounded-e);border-width:calc(var(--spinner-size) / 8);border-style:solid;border-color:var(--spinner-left-color) var(--spinner-right-color) var(--spinner-right-color) var(--spinner-left-color);will-change:transform;animation:rotate360 1.15s linear infinite;--spinner-base-color-h: var(--dt-color-content-brand-h);--spinner-base-color-s: var(--dt-color-content-brand-s);--spinner-base-color-l: var(--dt-color-content-brand-l)}.c-spinner[variant=secondary]{--spinner-base-color-h: var(--dt-color-content-interactive-secondary-h);--spinner-base-color-s: var(--dt-color-content-interactive-secondary-s);--spinner-base-color-l: var(--dt-color-content-interactive-secondary-l)}.c-spinner[variant=inverse]{--spinner-base-color-h: var(--dt-color-content-inverse-h);--spinner-base-color-s: var(--dt-color-content-inverse-s);--spinner-base-color-l: var(--dt-color-content-inverse-l)}.c-spinner[size=xsmall]{--spinner-size: 16px}.c-spinner[size=small]{--spinner-size: 20px}.c-spinner[size=large]{--spinner-size: 32px}.c-spinner[size=xlarge]{--spinner-size: 48px}.c-spinner-label{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap} | ||
`, y = ["xsmall", "small", "medium", "large", "xlarge"], x = ["brand", "secondary", "inverse"], o = { | ||
import { classMap as u } from "lit/directives/class-map.js"; | ||
import { validPropertyValues as b, defineCustomElement as z } from "@justeattakeaway/pie-webc-core"; | ||
const y = `*,*:after,*:before{box-sizing:inherit}@keyframes rotate360{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.c-spinner{--spinner-size: 24px;--spinner-left-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), 1);--spinner-right-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), .35);block-size:var(--spinner-size);inline-size:var(--spinner-size);border-radius:var(--dt-radius-rounded-e);border-width:calc(var(--spinner-size) / 8);border-style:solid;border-color:var(--spinner-left-color) var(--spinner-right-color) var(--spinner-right-color) var(--spinner-left-color);will-change:transform;animation:rotate360 1.15s linear infinite;--spinner-base-color-h: var(--dt-color-content-brand-h);--spinner-base-color-s: var(--dt-color-content-brand-s);--spinner-base-color-l: var(--dt-color-content-brand-l)}.c-spinner.c-spinner--secondary{--spinner-base-color-h: var(--dt-color-content-interactive-secondary-h);--spinner-base-color-s: var(--dt-color-content-interactive-secondary-s);--spinner-base-color-l: var(--dt-color-content-interactive-secondary-l)}.c-spinner.c-spinner--inverse{--spinner-base-color-h: var(--dt-color-content-inverse-h);--spinner-base-color-s: var(--dt-color-content-inverse-s);--spinner-base-color-l: var(--dt-color-content-inverse-l)}.c-spinner.c-spinner--xsmall{--spinner-size: 16px}.c-spinner.c-spinner--small{--spinner-size: 20px}.c-spinner.c-spinner--large{--spinner-size: 32px}.c-spinner.c-spinner--xlarge{--spinner-size: 48px}.c-spinner-label{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap} | ||
`, x = ["xsmall", "small", "medium", "large", "xlarge"], g = ["brand", "secondary", "inverse"], o = { | ||
size: "medium", | ||
variant: "brand" | ||
}; | ||
var g = Object.defineProperty, w = Object.getOwnPropertyDescriptor, c = (a, n, s, e) => { | ||
for (var r = e > 1 ? void 0 : e ? w(n, s) : n, t = a.length - 1, l; t >= 0; t--) | ||
(l = a[t]) && (r = (e ? l(n, s, r) : l(r)) || r); | ||
return e && r && g(n, s, r), r; | ||
var w = Object.defineProperty, P = Object.getOwnPropertyDescriptor, c = (a, r, s, n) => { | ||
for (var e = n > 1 ? void 0 : n ? P(r, s) : r, t = a.length - 1, l; t >= 0; t--) | ||
(l = a[t]) && (e = (n ? l(r, s, e) : l(e)) || e); | ||
return n && e && w(r, s, e), e; | ||
}; | ||
@@ -20,16 +21,25 @@ const v = "pie-spinner"; | ||
render() { | ||
const { variant: n, size: s, aria: e } = this; | ||
const { variant: r, size: s } = this, n = { | ||
"c-spinner": !0, | ||
[`c-spinner--${s}`]: !0, | ||
[`c-spinner--${r}`]: !0 | ||
}; | ||
return d` | ||
<div | ||
data-test-id="pie-spinner" | ||
class="c-spinner" | ||
class="${u(n)}" | ||
role="status" | ||
aria-live="polite" | ||
size="${s}" | ||
variant="${n}"> | ||
${e != null && e.label ? d`<span class="c-spinner-label">${e.label}</span>` : z} | ||
</div>`; | ||
aria-live="polite"> | ||
${this.renderAriaLabel()} | ||
</div>`; | ||
} | ||
renderAriaLabel() { | ||
var r; | ||
return (r = this.aria) != null && r.label ? d` | ||
<span class="c-spinner-label"> | ||
${this.aria.label} | ||
</span>` : f; | ||
} | ||
} | ||
i.styles = h(u); | ||
i.styles = h(y); | ||
c([ | ||
@@ -40,14 +50,14 @@ p({ type: Object }) | ||
p(), | ||
b(v, y, o.size) | ||
b(v, x, o.size) | ||
], i.prototype, "size", 2); | ||
c([ | ||
p(), | ||
b(v, x, o.variant) | ||
b(v, g, o.variant) | ||
], i.prototype, "variant", 2); | ||
f(v, i); | ||
z(v, i); | ||
export { | ||
i as PieSpinner, | ||
o as defaultProps, | ||
y as sizes, | ||
x as variants | ||
x as sizes, | ||
g as variants | ||
}; |
@@ -7,3 +7,3 @@ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core'; | ||
export declare type AriaProps = { | ||
declare type AriaProps = { | ||
label?: string; | ||
@@ -22,6 +22,7 @@ }; | ||
declare class PieSpinner_2 extends LitElement implements SpinnerProps { | ||
aria?: AriaProps; | ||
size?: SpinnerProps['size']; | ||
variant?: SpinnerProps['variant']; | ||
aria: SpinnerProps['aria']; | ||
size: "xsmall" | "small" | "medium" | "large" | "xlarge"; | ||
variant: "brand" | "secondary" | "inverse"; | ||
render(): TemplateResult<1>; | ||
private renderAriaLabel; | ||
static styles: CSSResult; | ||
@@ -28,0 +29,0 @@ } |
import * as e from "react"; | ||
import { createComponent as r } from "@lit/react"; | ||
import { PieSpinner as i } from "./index.js"; | ||
import { defaultProps as f, sizes as S, variants as l } from "./index.js"; | ||
import { defaultProps as S, sizes as l, variants as d } from "./index.js"; | ||
import "lit"; | ||
import "lit/decorators.js"; | ||
import "lit/directives/class-map.js"; | ||
import "@justeattakeaway/pie-webc-core"; | ||
@@ -14,8 +15,8 @@ const t = r({ | ||
events: {} | ||
}), s = t; | ||
}), c = t; | ||
export { | ||
s as PieSpinner, | ||
f as defaultProps, | ||
S as sizes, | ||
l as variants | ||
c as PieSpinner, | ||
S as defaultProps, | ||
l as sizes, | ||
d as variants | ||
}; |
{ | ||
"name": "@justeattakeaway/pie-spinner", | ||
"description": "PIE Design System Spinner built using Web Components", | ||
"version": "0.6.7", | ||
"version": "0.7.0", | ||
"type": "module", | ||
@@ -39,3 +39,3 @@ "main": "dist/index.js", | ||
"@custom-elements-manifest/analyzer": "0.9.0", | ||
"@justeattakeaway/pie-components-config": "0.17.0", | ||
"@justeattakeaway/pie-components-config": "0.18.0", | ||
"@justeattakeaway/pie-css": "0.12.1", | ||
@@ -42,0 +42,0 @@ "@justeattakeaway/pie-wrapper-react": "0.14.1", |
@@ -1,3 +0,3 @@ | ||
import React from 'react'; | ||
import type React from 'react'; | ||
export type ReactBaseType = React.HTMLAttributes<HTMLDivElement> |
@@ -6,3 +6,3 @@ import { type ComponentDefaultProps } from '@justeattakeaway/pie-webc-core'; | ||
export type AriaProps = { | ||
type AriaProps = { | ||
label?: string; | ||
@@ -9,0 +9,0 @@ }; |
@@ -5,9 +5,9 @@ import { | ||
import { property } from 'lit/decorators.js'; | ||
import { classMap } from 'lit/directives/class-map.js'; | ||
import { validPropertyValues, defineCustomElement } from '@justeattakeaway/pie-webc-core'; | ||
import styles from './spinner.scss?inline'; | ||
import { | ||
SpinnerProps, | ||
type SpinnerProps, | ||
sizes, | ||
variants, | ||
type AriaProps, | ||
defaultProps, | ||
@@ -26,27 +26,40 @@ } from './defs'; | ||
@property({ type: Object }) | ||
public aria?: AriaProps; | ||
public aria: SpinnerProps['aria']; | ||
@property() | ||
@validPropertyValues(componentSelector, sizes, defaultProps.size) | ||
public size?: SpinnerProps['size'] = defaultProps.size; | ||
public size = defaultProps.size; | ||
@property() | ||
@validPropertyValues(componentSelector, variants, defaultProps.variant) | ||
public variant?: SpinnerProps['variant'] = defaultProps.variant; | ||
public variant = defaultProps.variant; | ||
render () { | ||
const { variant, size, aria } = this; | ||
const { variant, size } = this; | ||
const classes = { | ||
'c-spinner': true, | ||
[`c-spinner--${size}`]: true, | ||
[`c-spinner--${variant}`]: true, | ||
}; | ||
return html` | ||
<div | ||
data-test-id="pie-spinner" | ||
class="c-spinner" | ||
class="${classMap(classes)}" | ||
role="status" | ||
aria-live="polite" | ||
size="${size}" | ||
variant="${variant}"> | ||
${aria?.label ? html`<span class="c-spinner-label">${aria.label}</span>` : nothing} | ||
</div>`; | ||
aria-live="polite"> | ||
${this.renderAriaLabel()} | ||
</div>`; | ||
} | ||
private renderAriaLabel () { | ||
if (!this.aria?.label) return nothing; | ||
return html` | ||
<span class="c-spinner-label"> | ||
${this.aria.label} | ||
</span>`; | ||
} | ||
// Renders a `CSSResult` generated from SCSS by Vite | ||
@@ -53,0 +66,0 @@ static styles = unsafeCSS(styles); |
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
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
20950
423