@dreamworld/dw-chip-select 1.0.0-create-chip.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/.circleci/config.yml +41 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/demo/dw-chip-select-demo.js +36 -0
- package/demo/index.html +34 -0
- package/dw-chip-select.js +11 -0
- package/dw-chip.js +118 -0
- package/index.html +5 -0
- package/package.json +54 -0
- package/web-dev-server.config.mjs +12 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
jobs:
|
|
3
|
+
release-snapshot:
|
|
4
|
+
docker:
|
|
5
|
+
- image: circleci/node:lts
|
|
6
|
+
steps:
|
|
7
|
+
- checkout
|
|
8
|
+
- run: yarn install --frozen-lockfile --non-interactive
|
|
9
|
+
- run:
|
|
10
|
+
name: Deploy
|
|
11
|
+
command: |
|
|
12
|
+
export NPM_TOKEN=${SNAPSHOT_NPM_TOKEN}
|
|
13
|
+
npm config set ${NPM_PACKAGE_SCOPE}:registry ${NPM_SNAPSHOT_REPO}
|
|
14
|
+
npx semantic-release
|
|
15
|
+
release:
|
|
16
|
+
docker:
|
|
17
|
+
- image: circleci/node:lts
|
|
18
|
+
steps:
|
|
19
|
+
- checkout
|
|
20
|
+
- run: yarn install --frozen-lockfile --non-interactive
|
|
21
|
+
- run: echo "Running release job"
|
|
22
|
+
- run:
|
|
23
|
+
name: Deploy
|
|
24
|
+
command: npx semantic-release
|
|
25
|
+
|
|
26
|
+
workflows:
|
|
27
|
+
version: 2
|
|
28
|
+
release:
|
|
29
|
+
jobs:
|
|
30
|
+
- release-snapshot:
|
|
31
|
+
context: Dreamworld
|
|
32
|
+
filters:
|
|
33
|
+
branches:
|
|
34
|
+
only:
|
|
35
|
+
- /^feature\/.+$/
|
|
36
|
+
- release:
|
|
37
|
+
context: Dreamworld
|
|
38
|
+
filters:
|
|
39
|
+
branches:
|
|
40
|
+
only:
|
|
41
|
+
- main
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Hiten Bhayani
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { css, html, LitElement } from "lit";
|
|
2
|
+
import "../dw-chip-select.js";
|
|
3
|
+
import "../dw-chip.js";
|
|
4
|
+
import { ThemeStyle } from "@dreamworld/material-styles/theme.js";
|
|
5
|
+
|
|
6
|
+
const componentName = "dw-chip-select-demo";
|
|
7
|
+
|
|
8
|
+
export class DwChipSelectDemo extends LitElement {
|
|
9
|
+
static get styles() {
|
|
10
|
+
return [
|
|
11
|
+
ThemeStyle,
|
|
12
|
+
css`
|
|
13
|
+
dw-chip {
|
|
14
|
+
margin-top: 16px;
|
|
15
|
+
margin-right: 8px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.wrapper {
|
|
19
|
+
display: flex;
|
|
20
|
+
}
|
|
21
|
+
`,
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html`
|
|
26
|
+
<dw-chip-select></dw-chip-select> <br />
|
|
27
|
+
<div class="wrapper">
|
|
28
|
+
<dw-chip .value=${"Chip View"}></dw-chip>
|
|
29
|
+
|
|
30
|
+
<dw-chip .value=${"Selected"} selected></dw-chip>
|
|
31
|
+
</div>
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
customElements.define(componentName, DwChipSelectDemo);
|
package/demo/index.html
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>Chip demo</title>
|
|
7
|
+
<script type="module" src="./dw-chip-select-demo.js"></script>
|
|
8
|
+
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
10
|
+
|
|
11
|
+
<!-- Material filled icons. -->
|
|
12
|
+
<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=Material+Icons&display=block&display=swap">
|
|
13
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons&display=block&display=swap" media="print" onload="this.media='all'">
|
|
14
|
+
|
|
15
|
+
<!-- Material outlined icons -->
|
|
16
|
+
<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=Material+Icons+Outlined&display=block&display=swap">
|
|
17
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons+Outlined&display=block&display=swap" media="print" onload="this.media='all'">
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
body {
|
|
21
|
+
margin: 24px;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
(window.process = window.process || {}).env = {};
|
|
27
|
+
</script>
|
|
28
|
+
</head>
|
|
29
|
+
|
|
30
|
+
<body>
|
|
31
|
+
<dw-chip-select-demo></dw-chip-select-demo>
|
|
32
|
+
</body>
|
|
33
|
+
|
|
34
|
+
</html>
|
package/dw-chip.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { html, LitElement, css, nothing } from "lit";
|
|
2
|
+
import "@dreamworld/dw-ripple";
|
|
3
|
+
import "@dreamworld/dw-icon";
|
|
4
|
+
|
|
5
|
+
// Styles
|
|
6
|
+
import * as TypographyLiterals from "@dreamworld/material-styles/typography-literals.js";
|
|
7
|
+
|
|
8
|
+
const componentName = "dw-chip";
|
|
9
|
+
const Types = {
|
|
10
|
+
filter: "filter",
|
|
11
|
+
choice: "choice",
|
|
12
|
+
input: "input",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export class DwChip extends LitElement {
|
|
16
|
+
static get styles() {
|
|
17
|
+
return css`
|
|
18
|
+
:host {
|
|
19
|
+
position: relative;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
padding-left: 12px;
|
|
23
|
+
padding-right: 12px;
|
|
24
|
+
height: var(--dw-chip-height, 32px);
|
|
25
|
+
border-radius: calc(var(--dw-chip-height, 32px) / 2);
|
|
26
|
+
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host(:not([selected])) {
|
|
32
|
+
border: 1px solid var(--mdc-theme-divider-color, rgba(0, 0, 0, 0.12));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([selected]) {
|
|
36
|
+
color: var(--mdc-theme-primary, #02afcd);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
dw-ripple {
|
|
40
|
+
position: absolute;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([selected]) dw-icon {
|
|
44
|
+
padding-right: 8px;
|
|
45
|
+
--dw-icon-color: var(--mdc-theme-primary, #02afcd);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.value {
|
|
49
|
+
${TypographyLiterals.body2};
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static get properties() {
|
|
55
|
+
return {
|
|
56
|
+
/**
|
|
57
|
+
* Determines the type of chip view to be rendered.
|
|
58
|
+
* Possible values: 'filter', 'choice', and 'input'
|
|
59
|
+
* Default value: 'filter'
|
|
60
|
+
*/
|
|
61
|
+
type: { type: String },
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Indicates whether the chip is selected or not.
|
|
65
|
+
*/
|
|
66
|
+
selected: { type: Boolean },
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Indicates whether the chip is activated or not.
|
|
70
|
+
*/
|
|
71
|
+
activated: { type: Boolean },
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Specifies the value to be shown as text in the chip.
|
|
75
|
+
*/
|
|
76
|
+
value: { type: String },
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Indicates whether the chip is disabled or not.
|
|
80
|
+
*/
|
|
81
|
+
disabled: { type: Boolean },
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Specifies the material icon name to be shown as the leading icon in the chip.
|
|
85
|
+
* Default: 'done'
|
|
86
|
+
*/
|
|
87
|
+
icon: { type: String },
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
constructor() {
|
|
92
|
+
super();
|
|
93
|
+
this.icon = "done";
|
|
94
|
+
this.type = Types.filter;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
render() {
|
|
98
|
+
return html`
|
|
99
|
+
<dw-ripple
|
|
100
|
+
primary
|
|
101
|
+
?activated=${this.activated}
|
|
102
|
+
?selected=${this.selected}
|
|
103
|
+
?disabled=${this.disabled}
|
|
104
|
+
></dw-ripple>
|
|
105
|
+
${this._renderLeadingIcon}
|
|
106
|
+
<div class="value">${this.value}</div>
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
get _renderLeadingIcon() {
|
|
111
|
+
if (this.selected && this.type === Types.filter) {
|
|
112
|
+
return html`<dw-icon name=${this.icon}></dw-icon>`;
|
|
113
|
+
}
|
|
114
|
+
return nothing;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
customElements.define(componentName, DwChip);
|
package/index.html
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dreamworld/dw-chip-select",
|
|
3
|
+
"version": "1.0.0-create-chip.1",
|
|
4
|
+
"description": "Chips are compact elements that represent an input, attribute, or action.",
|
|
5
|
+
"main": "dw-chip-select.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "web-dev-server"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git@github.com:DreamworldSolutions/dw-chip-select.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/DreamworldSolutions/dw-chip-select/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/DreamworldSolutions/dw-chip-select",
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "Hiten Bhayani",
|
|
19
|
+
"email": "hiten@hisab.co",
|
|
20
|
+
"url": "https://github.com/hitendreamworld"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"lit",
|
|
28
|
+
"chip",
|
|
29
|
+
"web components"
|
|
30
|
+
],
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@dreamworld/dw-icon": "^4.1.1",
|
|
33
|
+
"@dreamworld/dw-ripple": "^3.1.3-fix-package-json.1",
|
|
34
|
+
"@dreamworld/material-styles": "^3.2.2",
|
|
35
|
+
"lit": "^2.7.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@open-wc/building-rollup": "^2.2.2",
|
|
39
|
+
"@rollup/plugin-commonjs": "^24.0.1",
|
|
40
|
+
"@web/dev-server": "^0.1.36",
|
|
41
|
+
"semantic-release": "^19.0.5"
|
|
42
|
+
},
|
|
43
|
+
"release": {
|
|
44
|
+
"branches": [
|
|
45
|
+
"+([0-9])?(.{+([0-9]),x}).x",
|
|
46
|
+
"main",
|
|
47
|
+
{
|
|
48
|
+
"name": "feature/*",
|
|
49
|
+
"prerelease": "${name.replace(/^feature\\//g, \"\")}",
|
|
50
|
+
"channel": "${name.replace(/^feature\\//g, \"\")}"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import rollupCommonjs from '@rollup/plugin-commonjs';
|
|
2
|
+
import { fromRollup } from '@web/dev-server-rollup';
|
|
3
|
+
|
|
4
|
+
const commonjs = fromRollup(rollupCommonjs);
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
appIndex: 'demo/index.html',
|
|
8
|
+
open: true,
|
|
9
|
+
nodeResolve: true,
|
|
10
|
+
// esbuildTarget: "auto",
|
|
11
|
+
plugins: [commonjs()]
|
|
12
|
+
};
|