@nectary/labs 1.0.1 → 1.0.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/lib/color-select.d.ts +14 -0
- package/lib/color-select.js +77 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +7 -11
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '@nectary/components/color-menu';
|
|
2
|
+
import '@nectary/components/color-menu-option';
|
|
3
|
+
import '@nectary/components/color-swatch';
|
|
4
|
+
import '@nectary/components/popover';
|
|
5
|
+
import '@nectary/components/select-button';
|
|
6
|
+
import { LitElement } from 'lit';
|
|
7
|
+
export declare class ColorSelect extends LitElement {
|
|
8
|
+
open: boolean;
|
|
9
|
+
value: string;
|
|
10
|
+
onClose(): void;
|
|
11
|
+
onOpen(): void;
|
|
12
|
+
onChange(e: CustomEvent<string>): void;
|
|
13
|
+
render(): import("lit").TemplateResult<1>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import '@nectary/components/color-menu';
|
|
8
|
+
import '@nectary/components/color-menu-option';
|
|
9
|
+
import '@nectary/components/color-swatch';
|
|
10
|
+
import '@nectary/components/popover';
|
|
11
|
+
import '@nectary/components/select-button';
|
|
12
|
+
import { html, LitElement } from 'lit';
|
|
13
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
14
|
+
const vibrantColorNames = [
|
|
15
|
+
'violet',
|
|
16
|
+
'blue',
|
|
17
|
+
'green',
|
|
18
|
+
'yellow',
|
|
19
|
+
'orange',
|
|
20
|
+
'red',
|
|
21
|
+
'pink',
|
|
22
|
+
'brown',
|
|
23
|
+
'gray',
|
|
24
|
+
];
|
|
25
|
+
let ColorSelect = class ColorSelect extends LitElement {
|
|
26
|
+
open = false;
|
|
27
|
+
value = '';
|
|
28
|
+
onClose() {
|
|
29
|
+
this.open = false;
|
|
30
|
+
}
|
|
31
|
+
onOpen() {
|
|
32
|
+
this.open = true;
|
|
33
|
+
}
|
|
34
|
+
onChange(e) {
|
|
35
|
+
this.value = e.detail;
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
return html `
|
|
39
|
+
<sinch-popover
|
|
40
|
+
open=${this.open}
|
|
41
|
+
aria-label="Select color"
|
|
42
|
+
orientation="bottom-right"
|
|
43
|
+
modal
|
|
44
|
+
@close=${this.onClose}
|
|
45
|
+
>
|
|
46
|
+
<sinch-select-button
|
|
47
|
+
slot="target"
|
|
48
|
+
text=${this.value}
|
|
49
|
+
placeholder="Select color"
|
|
50
|
+
aria-label="Open color select"
|
|
51
|
+
@click=${this.onOpen}
|
|
52
|
+
>
|
|
53
|
+
<sinch-color-swatch slot="icon" name="${this.value}" />
|
|
54
|
+
</sinch-select-button>
|
|
55
|
+
<sinch-color-menu
|
|
56
|
+
slot="content"
|
|
57
|
+
value=${this.value}
|
|
58
|
+
aria-label="Color menu"
|
|
59
|
+
@change=${this.onChange}
|
|
60
|
+
>
|
|
61
|
+
${vibrantColorNames.map((c) => html `<sinch-color-menu-option value=${c} />`)}
|
|
62
|
+
</sinch-color-menu>
|
|
63
|
+
</sinch-popover>
|
|
64
|
+
</sinch-color-menu></sinch-popover>
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
__decorate([
|
|
69
|
+
property({ type: 'boolean' })
|
|
70
|
+
], ColorSelect.prototype, "open", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
property()
|
|
73
|
+
], ColorSelect.prototype, "value", void 0);
|
|
74
|
+
ColorSelect = __decorate([
|
|
75
|
+
customElement('sinch-color-select')
|
|
76
|
+
], ColorSelect);
|
|
77
|
+
export { ColorSelect };
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nectary/labs",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"files": [
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"files": [
|
|
5
|
+
"lib/"
|
|
6
|
+
],
|
|
5
7
|
"publishConfig": {
|
|
6
8
|
"access": "public"
|
|
7
9
|
},
|
|
8
10
|
"scripts": {
|
|
9
|
-
"build": "NODE_ENV=production
|
|
11
|
+
"build": "NODE_ENV=production && rimraf lib/ && tsc --outDir lib/"
|
|
10
12
|
},
|
|
11
13
|
"dependencies": {
|
|
12
|
-
"@babel/runtime": "^7.22.15",
|
|
13
14
|
"@nectary/components": "2.9.0"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
|
-
"@babel/cli": "^7.22.15",
|
|
17
|
-
"@babel/core": "^7.22.20",
|
|
18
|
-
"@babel/plugin-transform-runtime": "^7.22.15",
|
|
19
|
-
"@babel/preset-env": "^7.22.20",
|
|
20
|
-
"@babel/preset-typescript": "^7.22.15",
|
|
21
17
|
"@types/node": "^18.17.17",
|
|
22
18
|
"@types/react": "^18.2.21",
|
|
23
|
-
"
|
|
19
|
+
"lit": "^3.1.2",
|
|
24
20
|
"ts-node": "^10.9.1",
|
|
25
21
|
"typescript": "^5.2.2",
|
|
26
|
-
"
|
|
22
|
+
"rimraf": "^3.0.2"
|
|
27
23
|
}
|
|
28
24
|
}
|