@dreamworld/dw-chip-select 1.1.1 → 1.1.2
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/demo/dw-chip-select-demo.js +19 -4
- package/dw-chip-select.js +6 -5
- package/dw-chip.js +12 -5
- package/package.json +2 -2
- package/web-dev-server.config.mjs +1 -0
|
@@ -27,14 +27,21 @@ export class DwChipSelectDemo extends LitElement {
|
|
|
27
27
|
|
|
28
28
|
static get properties() {
|
|
29
29
|
return {
|
|
30
|
-
paymentTypes: { type: Array}
|
|
31
|
-
|
|
30
|
+
paymentTypes: { type: Array },
|
|
31
|
+
|
|
32
|
+
filterValue: { type: Array },
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
this.filterValue = ["India", "Norway"];
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
firstUpdated() {
|
|
35
42
|
setTimeout(() => {
|
|
36
|
-
this.paymentTypes = PaymentTypes
|
|
37
|
-
}, 1000)
|
|
43
|
+
this.paymentTypes = PaymentTypes;
|
|
44
|
+
}, 1000);
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
render() {
|
|
@@ -46,6 +53,14 @@ export class DwChipSelectDemo extends LitElement {
|
|
|
46
53
|
.valueTextProvider=${(item) => item.label}
|
|
47
54
|
@change=${this._onChange}
|
|
48
55
|
></dw-chip-select>
|
|
56
|
+
|
|
57
|
+
<dw-chip-select
|
|
58
|
+
label="Filter With Value"
|
|
59
|
+
.value="${this.filterValue}"
|
|
60
|
+
.items=${country_list}
|
|
61
|
+
@change=${this._onChange}
|
|
62
|
+
></dw-chip-select>
|
|
63
|
+
|
|
49
64
|
<dw-chip-select
|
|
50
65
|
type="choice"
|
|
51
66
|
label="Choice"
|
package/dw-chip-select.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css, html, LitElement, nothing } from "lit";
|
|
1
|
+
import { css, html, LitElement, nothing } from "@dreamworld/pwa-helpers/lit.js";
|
|
2
2
|
import { repeat } from "lit/directives/repeat.js";
|
|
3
3
|
|
|
4
4
|
// View Elements
|
|
@@ -8,8 +8,7 @@ import "./dw-chip.js";
|
|
|
8
8
|
import * as TypographyLiterals from "@dreamworld/material-styles/typography-literals.js";
|
|
9
9
|
|
|
10
10
|
// Utils
|
|
11
|
-
import cloneDeep from "lodash-es
|
|
12
|
-
import isEqual from "lodash-es/isEqual.js";
|
|
11
|
+
import { cloneDeep, isEqual } from "lodash-es";
|
|
13
12
|
import { ChipTypes, KeyCode } from "./utils";
|
|
14
13
|
|
|
15
14
|
const shimmerData = Array(2).fill({});
|
|
@@ -135,7 +134,9 @@ export class DwChipSelect extends LitElement {
|
|
|
135
134
|
|
|
136
135
|
get _renderChipList() {
|
|
137
136
|
if (!this.items) {
|
|
138
|
-
return html`<div class="chip-wrapper"
|
|
137
|
+
return html`<div class="chip-wrapper">
|
|
138
|
+
${repeat(shimmerData, () => html`<dw-chip shimmer></dw-chip>`)}
|
|
139
|
+
</div>`;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
if (this.items.length === 0) {
|
|
@@ -187,7 +188,7 @@ export class DwChipSelect extends LitElement {
|
|
|
187
188
|
_onChipToggle(item, selected, index) {
|
|
188
189
|
this._activatedIndex = index;
|
|
189
190
|
const oItem = this._valueProvider(item);
|
|
190
|
-
let oValue = this.value;
|
|
191
|
+
let oValue = cloneDeep(this.value);
|
|
191
192
|
const previousValue = cloneDeep(oValue);
|
|
192
193
|
|
|
193
194
|
switch (this.type) {
|
package/dw-chip.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { css, html, LitElement, nothing } from "@dreamworld/pwa-helpers/lit.js";
|
|
2
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
3
|
+
|
|
4
|
+
// View Elements
|
|
1
5
|
import "@dreamworld/dw-icon";
|
|
2
6
|
import "@dreamworld/dw-ripple";
|
|
3
|
-
|
|
7
|
+
|
|
8
|
+
// Utils
|
|
4
9
|
import { ChipTypes } from "./utils";
|
|
5
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
6
|
-
import { animate } from "@lit-labs/motion";
|
|
7
10
|
|
|
8
11
|
// Styles
|
|
9
12
|
import { body2 } from "@dreamworld/material-styles/typography-literals.js";
|
|
13
|
+
import { animate } from "@lit-labs/motion";
|
|
10
14
|
|
|
11
15
|
export class DwChip extends LitElement {
|
|
12
16
|
static get styles() {
|
|
@@ -26,7 +30,7 @@ export class DwChip extends LitElement {
|
|
|
26
30
|
box-sizing: border-box;
|
|
27
31
|
cursor: pointer;
|
|
28
32
|
}
|
|
29
|
-
|
|
33
|
+
|
|
30
34
|
:host(:not([selected])) {
|
|
31
35
|
border: 1px solid var(--mdc-theme-divider-color, rgba(0, 0, 0, 0.12));
|
|
32
36
|
}
|
|
@@ -55,7 +59,10 @@ export class DwChip extends LitElement {
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
.shimmer {
|
|
58
|
-
background: var(
|
|
62
|
+
background: var(
|
|
63
|
+
--dw-chip-select-shimmer-gradiant,
|
|
64
|
+
linear-gradient(to right, #f1efef, #f9f8f8, #e7e5e5)
|
|
65
|
+
);
|
|
59
66
|
height: 20px;
|
|
60
67
|
width: 64px;
|
|
61
68
|
flex: 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamworld/dw-chip-select",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Chips are compact elements that represent an input, attribute, or action.",
|
|
5
5
|
"main": "dw-chip-select.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@dreamworld/dw-icon": "^4.1.1",
|
|
33
33
|
"@dreamworld/dw-ripple": "^3.1.3",
|
|
34
34
|
"@dreamworld/material-styles": "^3.2.2",
|
|
35
|
+
"@dreamworld/pwa-helpers": "^1.17.2",
|
|
35
36
|
"@lit-labs/motion": "^1.0.3",
|
|
36
|
-
"lit": "^2.7.0",
|
|
37
37
|
"lodash-es": "^4.17.21"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|