@justeattakeaway/pie-tag 0.5.0 → 0.6.1
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/custom-elements.json +18 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +30 -25
- package/dist/react.d.ts +5 -0
- package/package.json +3 -2
- package/src/defs.ts +5 -0
- package/src/index.ts +5 -0
- package/src/tag.scss +4 -1
package/custom-elements.json
CHANGED
|
@@ -96,6 +96,16 @@
|
|
|
96
96
|
"privacy": "public",
|
|
97
97
|
"default": "false",
|
|
98
98
|
"attribute": "isStrong"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"kind": "field",
|
|
102
|
+
"name": "isDimmed",
|
|
103
|
+
"type": {
|
|
104
|
+
"text": "boolean"
|
|
105
|
+
},
|
|
106
|
+
"privacy": "public",
|
|
107
|
+
"default": "false",
|
|
108
|
+
"attribute": "isDimmed"
|
|
99
109
|
}
|
|
100
110
|
],
|
|
101
111
|
"attributes": [
|
|
@@ -122,6 +132,14 @@
|
|
|
122
132
|
},
|
|
123
133
|
"default": "false",
|
|
124
134
|
"fieldName": "isStrong"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "isDimmed",
|
|
138
|
+
"type": {
|
|
139
|
+
"text": "boolean"
|
|
140
|
+
},
|
|
141
|
+
"default": "false",
|
|
142
|
+
"fieldName": "isDimmed"
|
|
125
143
|
}
|
|
126
144
|
],
|
|
127
145
|
"superclass": {
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class PieTag extends LitElement implements TagProps {
|
|
|
11
11
|
variant: TagProps['variant'];
|
|
12
12
|
size: TagProps['size'];
|
|
13
13
|
isStrong: boolean;
|
|
14
|
+
isDimmed: boolean;
|
|
14
15
|
render(): TemplateResult<1>;
|
|
15
16
|
static styles: CSSResult;
|
|
16
17
|
}
|
|
@@ -26,6 +27,10 @@ export declare interface TagProps {
|
|
|
26
27
|
* When true, the 'green', "yellow", "red", "blue" and "neutral" variants change their styles and become bolder
|
|
27
28
|
*/
|
|
28
29
|
isStrong?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* When `true`, lowers the tag opacity.
|
|
32
|
+
*/
|
|
33
|
+
isDimmed?: boolean;
|
|
29
34
|
/**
|
|
30
35
|
* What size the tag should be.
|
|
31
36
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,52 +1,57 @@
|
|
|
1
|
-
import { unsafeCSS as p, LitElement as u, html as
|
|
2
|
-
import { property as
|
|
3
|
-
import { validPropertyValues as v, defineCustomElement as
|
|
4
|
-
const
|
|
5
|
-
`,
|
|
6
|
-
var z = Object.defineProperty, x = Object.getOwnPropertyDescriptor,
|
|
7
|
-
for (var t = o > 1 ? void 0 : o ? x(a, r) : a,
|
|
8
|
-
(
|
|
1
|
+
import { unsafeCSS as p, LitElement as u, html as d, nothing as h } from "lit";
|
|
2
|
+
import { property as n } from "lit/decorators.js";
|
|
3
|
+
import { validPropertyValues as v, defineCustomElement as f } from "@justeattakeaway/pie-webc-core";
|
|
4
|
+
const b = `.c-tag{--tag-bg-color: var(--dt-color-container-inverse);--tag-color: var(--dt-color-content-inverse);--tag-padding: 2px var(--dt-spacing-b);--tag-height: 24px;--tag-border-radius: var(--dt-radius-rounded-b);--tag-font-family: var(--dt-font-body-s-family);--tag-font-weight: var(--dt-font-body-s-weight);--tag-font-size: calc(var(--dt-font-body-s-size) * 1px);--tag-line-height: calc(var(--dt-font-body-s-line-height) * 1px);--tag-transparent-bg-color: transparent;--tag-height-large: 24px;--tag-height-small: 16px;--icon-display-override: block;--icon-size-override: 16px;display:inline-flex;vertical-align:middle;align-items:center;justify-content:center;gap:var(--dt-spacing-a);height:var(--tag-height);padding:var(--tag-padding);border:none;border-radius:var(--tag-border-radius);background-color:var(--tag-bg-color);color:var(--tag-color);font-family:var(--tag-font-family);font-weight:var(--tag-font-weight);font-size:var(--tag-font-size);line-height:var(--tag-line-height)}.c-tag[size=small]{--tag-height: var(--tag-height-small);--tag-padding: 0 var(--dt-spacing-a);--tag-border-radius: var(--dt-radius-rounded-a);--tag-font-size: calc(var(--dt-font-caption-size) * 1px);--tag-line-height: calc(var(--dt-font-caption-line-height) * 1px)}.c-tag[size=large]{--tag-height: var(--tag-height-large);--tag-padding: 2px var(--dt-spacing-b);--tag-border-radius: var(--dt-radius-rounded-b);--tag-font-size: calc(var(--dt-font-body-s-size) * 1px);--tag-line-height: calc(var(--dt-font-body-s-line-height) * 1px)}.c-tag[variant=neutral]{--tag-bg-color: var(--dt-color-container-strong);--tag-color: var(--dt-color-content-default)}.c-tag[variant=neutral][isStrong]{--tag-bg-color: var(--dt-color-container-inverse);--tag-color: var(--dt-color-content-inverse)}.c-tag[variant=blue]{--tag-bg-color: var(--dt-color-support-info-02);--tag-color: var(--dt-color-content-default)}.c-tag[variant=blue][isStrong]{--tag-bg-color: var(--dt-color-support-info);--tag-color: var(--dt-color-content-inverse)}.c-tag[variant=green]{--tag-bg-color: var(--dt-color-support-positive-02);--tag-color: var(--dt-color-content-default)}.c-tag[variant=green][isStrong]{--tag-bg-color: var(--dt-color-support-positive);--tag-color: var(--dt-color-content-inverse)}.c-tag[variant=yellow]{--tag-bg-color: var(--dt-color-support-warning-02);--tag-color: var(--dt-color-content-default)}.c-tag[variant=yellow][isStrong]{--tag-bg-color: var(--dt-color-support-warning);--tag-color: var(--dt-color-content-dark)}.c-tag[variant=red]{--tag-bg-color: var(--dt-color-support-error-02);--tag-color: var(--dt-color-content-default)}.c-tag[variant=red][isStrong]{--tag-bg-color: var(--dt-color-support-error);--tag-color: var(--dt-color-content-inverse)}.c-tag[variant=brand]{--tag-bg-color: var(--dt-color-support-brand-02);--tag-color: var(--dt-color-content-default)}.c-tag[variant=neutral-alternative]{--tag-bg-color: var(--dt-color-container-default);--tag-color: var(--dt-color-content-default)}.c-tag[variant=outline]{--tag-bg-color: var(--tag-transparent-bg-color);--tag-color: var(--dt-color-content-default);border:1px solid var(--dt-color-border-strong)}.c-tag[variant=outline][size=small]{--tag-padding: 0 3px}.c-tag[variant=outline][size=large]{--tag-padding: 1px 7px}.c-tag[variant=ghost]{--tag-bg-color: var(--tag-transparent-bg-color);--tag-color: var(--dt-color-content-default)}.c-tag[isDimmed]{opacity:.5}::slotted(svg){display:block;height:var(--icon-size-override);width:var(--icon-size-override)}
|
|
5
|
+
`, m = ["neutral-alternative", "neutral", "outline", "ghost", "blue", "green", "yellow", "red", "brand"], y = ["small", "large"];
|
|
6
|
+
var z = Object.defineProperty, x = Object.getOwnPropertyDescriptor, i = (g, a, r, o) => {
|
|
7
|
+
for (var t = o > 1 ? void 0 : o ? x(a, r) : a, l = g.length - 1, c; l >= 0; l--)
|
|
8
|
+
(c = g[l]) && (t = (o ? c(a, r, t) : c(t)) || t);
|
|
9
9
|
return o && t && z(a, r, t), t;
|
|
10
10
|
};
|
|
11
|
-
const
|
|
11
|
+
const s = "pie-tag";
|
|
12
12
|
class e extends u {
|
|
13
13
|
constructor() {
|
|
14
|
-
super(...arguments), this.variant = "neutral", this.size = "large", this.isStrong = !1;
|
|
14
|
+
super(...arguments), this.variant = "neutral", this.size = "large", this.isStrong = !1, this.isDimmed = !1;
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
17
|
const {
|
|
18
18
|
variant: a,
|
|
19
19
|
size: r,
|
|
20
|
-
isStrong: o
|
|
20
|
+
isStrong: o,
|
|
21
|
+
isDimmed: t
|
|
21
22
|
} = this;
|
|
22
|
-
return
|
|
23
|
+
return d`
|
|
23
24
|
<div
|
|
24
25
|
class="c-tag"
|
|
25
26
|
variant=${a || "neutral"}
|
|
26
27
|
size=${r || "large"}
|
|
27
28
|
?isStrong=${o}
|
|
29
|
+
?isDimmed=${t}
|
|
28
30
|
data-test-id="pie-tag"
|
|
29
31
|
>
|
|
30
|
-
${r === "large" ?
|
|
32
|
+
${r === "large" ? d`<slot name="icon"></slot>` : h}
|
|
31
33
|
<slot></slot>
|
|
32
34
|
</div>`;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
e.styles = p(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
v(
|
|
37
|
+
e.styles = p(b);
|
|
38
|
+
i([
|
|
39
|
+
n({ type: String }),
|
|
40
|
+
v(s, m, "neutral")
|
|
39
41
|
], e.prototype, "variant", 2);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
v(
|
|
42
|
+
i([
|
|
43
|
+
n({ type: String }),
|
|
44
|
+
v(s, y, "large")
|
|
43
45
|
], e.prototype, "size", 2);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
i([
|
|
47
|
+
n({ type: Boolean })
|
|
46
48
|
], e.prototype, "isStrong", 2);
|
|
47
|
-
|
|
49
|
+
i([
|
|
50
|
+
n({ type: Boolean })
|
|
51
|
+
], e.prototype, "isDimmed", 2);
|
|
52
|
+
f(s, e);
|
|
48
53
|
export {
|
|
49
54
|
e as PieTag,
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
y as sizes,
|
|
56
|
+
m as variants
|
|
52
57
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare class PieTag_2 extends LitElement implements TagProps {
|
|
|
14
14
|
variant: TagProps['variant'];
|
|
15
15
|
size: TagProps['size'];
|
|
16
16
|
isStrong: boolean;
|
|
17
|
+
isDimmed: boolean;
|
|
17
18
|
render(): TemplateResult<1>;
|
|
18
19
|
static styles: CSSResult;
|
|
19
20
|
}
|
|
@@ -31,6 +32,10 @@ export declare interface TagProps {
|
|
|
31
32
|
* When true, the 'green', "yellow", "red", "blue" and "neutral" variants change their styles and become bolder
|
|
32
33
|
*/
|
|
33
34
|
isStrong?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* When `true`, lowers the tag opacity.
|
|
37
|
+
*/
|
|
38
|
+
isDimmed?: boolean;
|
|
34
39
|
/**
|
|
35
40
|
* What size the tag should be.
|
|
36
41
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-tag",
|
|
3
3
|
"description": "PIE Design System Tag built using Web Components",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
35
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
35
|
+
"@justeattakeaway/pie-components-config": "0.11.0",
|
|
36
|
+
"@justeattakeaway/pie-icons-webc": "0.17.2",
|
|
36
37
|
"@justeattakeaway/pie-wrapper-react": "0.14.0",
|
|
37
38
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
38
39
|
},
|
package/src/defs.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -28,11 +28,15 @@ export class PieTag extends LitElement implements TagProps {
|
|
|
28
28
|
@property({ type: Boolean })
|
|
29
29
|
public isStrong = false;
|
|
30
30
|
|
|
31
|
+
@property({ type: Boolean })
|
|
32
|
+
public isDimmed = false;
|
|
33
|
+
|
|
31
34
|
render () {
|
|
32
35
|
const {
|
|
33
36
|
variant,
|
|
34
37
|
size,
|
|
35
38
|
isStrong,
|
|
39
|
+
isDimmed,
|
|
36
40
|
} = this;
|
|
37
41
|
return html`
|
|
38
42
|
<div
|
|
@@ -40,6 +44,7 @@ export class PieTag extends LitElement implements TagProps {
|
|
|
40
44
|
variant=${variant || 'neutral'}
|
|
41
45
|
size=${size || 'large'}
|
|
42
46
|
?isStrong=${isStrong}
|
|
47
|
+
?isDimmed=${isDimmed}
|
|
43
48
|
data-test-id="pie-tag"
|
|
44
49
|
>
|
|
45
50
|
${size === 'large' ? html`<slot name="icon"></slot>` : nothing}
|
package/src/tag.scss
CHANGED
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
font-weight: var(--tag-font-weight);
|
|
40
40
|
font-size: var(--tag-font-size);
|
|
41
41
|
line-height: var(--tag-line-height);
|
|
42
|
-
opacity: var(--tag-opacity, 1); // we don't specify --tag-opacity variable here to let consumers override a default value that we set
|
|
43
42
|
|
|
44
43
|
// Size
|
|
45
44
|
&[size='small'] {
|
|
@@ -137,6 +136,10 @@
|
|
|
137
136
|
--tag-bg-color: var(--tag-transparent-bg-color);
|
|
138
137
|
--tag-color: var(--dt-color-content-default);
|
|
139
138
|
}
|
|
139
|
+
|
|
140
|
+
&[isDimmed] {
|
|
141
|
+
opacity: 0.5;
|
|
142
|
+
}
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
// Used to size an SVG if one is passed in (when not using the component icons)
|