Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
7f5e72c27f | |||
4311c0fff6 | |||
e028f37493 | |||
c6967156d6 | |||
efaf2a78df | |||
e6adbf9b6d | |||
e88605a4aa | |||
6a161982b7 | |||
22d7883c04 | |||
2a613c96a0 | |||
bdd766e4bc | |||
b1ce8f093f | |||
056090856e | |||
fef0705acc | |||
6eced2321f | |||
05a9042de8 | |||
d369805ee8 | |||
3a2f3500fd | |||
2f9711a094 | |||
cf80efd1ec | |||
cf5cd37ebc | |||
88554396a4 | |||
2f13311098 | |||
5407b158d0 |
20718
package-lock.json
generated
20718
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@ -1,30 +1,34 @@
|
|||||||
{
|
{
|
||||||
"name": "@designestate/dees-catalog",
|
"name": "@designestate/dees-catalog",
|
||||||
"version": "1.0.23",
|
"version": "1.0.35",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "website for lossless.com",
|
"description": "website for lossless.com",
|
||||||
"main": "dist_ts_web/index.js",
|
"main": "dist_ts_web/index.js",
|
||||||
"typings": "dist_ts_web/index.d.ts",
|
"typings": "dist_ts_web/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npm run build",
|
"test": "tstest test/ --web",
|
||||||
"build": "tsbuild element && tsbundle element --production",
|
"build": "tsbuild element && tsbundle element --production",
|
||||||
"watch": "tswatch element"
|
"watch": "tswatch element"
|
||||||
},
|
},
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@designestate/dees-domtools": "^1.0.79",
|
"@designestate/dees-domtools": "^1.0.88",
|
||||||
"@designestate/dees-wcctools": "^1.0.49",
|
"@designestate/dees-element": "^1.0.19",
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
"@designestate/dees-wcctools": "^1.0.57",
|
||||||
"@fortawesome/free-brands-svg-icons": "^5.15.1",
|
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
||||||
"lit-element": "^2.4.0",
|
"@fortawesome/free-brands-svg-icons": "^5.15.4",
|
||||||
"typescript": "^4.1.2"
|
"@fortawesome/free-regular-svg-icons": "^5.15.4",
|
||||||
|
"@fortawesome/free-solid-svg-icons": "^5.15.4",
|
||||||
|
"typescript": "^4.3.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.26",
|
||||||
"@gitzone/tsbundle": "^1.0.78",
|
"@gitzone/tsbundle": "^1.0.84",
|
||||||
"@gitzone/tswatch": "^1.0.50",
|
"@gitzone/tstest": "^1.0.54",
|
||||||
|
"@gitzone/tswatch": "^1.0.56",
|
||||||
"@pushrocks/projectinfo": "^4.0.5",
|
"@pushrocks/projectinfo": "^4.0.5",
|
||||||
|
"@pushrocks/tapbundle": "^3.2.14",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.17.0"
|
"tslint-config-prettier": "^1.17.0"
|
||||||
},
|
},
|
||||||
|
12
test/test.browser.ts
Normal file
12
test/test.browser.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { tap, expect, webhelpers } from '@pushrocks/tapbundle';
|
||||||
|
|
||||||
|
import * as deesCatalog from '../ts_web';
|
||||||
|
|
||||||
|
tap.test('should create a working button', async () => {
|
||||||
|
const button: deesCatalog.DeesButton = await webhelpers.fixture(
|
||||||
|
webhelpers.html`<dees-button></dees-button>`
|
||||||
|
);
|
||||||
|
expect(button).to.be.instanceOf(deesCatalog.DeesButton);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
@ -1,9 +1,26 @@
|
|||||||
import { customElement, html, LitElement, property, TemplateResult } from 'lit-element';
|
import {
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
DeesElement,
|
||||||
|
property,
|
||||||
|
TemplateResult,
|
||||||
|
cssManager,
|
||||||
|
css,
|
||||||
|
unsafeCSS,
|
||||||
|
} from '@designestate/dees-element';
|
||||||
|
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-button': DeesButton;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-button')
|
@customElement('dees-button')
|
||||||
export class DeesButton extends LitElement {
|
export class DeesButton extends DeesElement {
|
||||||
|
public static demo = () => html`<dees-button></dees-button>`;
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
text: string;
|
text: string;
|
||||||
|
|
||||||
@ -13,9 +30,6 @@ export class DeesButton extends LitElement {
|
|||||||
@property()
|
@property()
|
||||||
disabled = false;
|
disabled = false;
|
||||||
|
|
||||||
@property()
|
|
||||||
isQuote = false;
|
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
isHidden = false;
|
isHidden = false;
|
||||||
|
|
||||||
@ -26,80 +40,87 @@ export class DeesButton extends LitElement {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
|
css`
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
:host([hidden]) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
font-size: 14px;
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
background: ${cssManager.bdTheme('#eee', '#333')};
|
||||||
|
border-top: ${cssManager.bdTheme('1px solid #eee', '1px solid #444')};
|
||||||
|
border-radius: 2px;
|
||||||
|
line-height: 40px;
|
||||||
|
padding: 0px 10px;
|
||||||
|
min-width: 100px;
|
||||||
|
user-select: none;
|
||||||
|
color: ${cssManager.bdTheme('#333', ' #ccc')};
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
background: #039be5;
|
||||||
|
border-top: 1px solid #039be5;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:active {
|
||||||
|
background: #0277bd;
|
||||||
|
border-top: 1px solid #0277bd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button.disabled {
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #eeeff3;
|
||||||
|
color: #9b9b9e;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button.highlighted {
|
||||||
|
background: #e4002b;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button.discreet {
|
||||||
|
background: none;
|
||||||
|
border: 1px solid #9b9b9e;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button.discreet:hover {
|
||||||
|
background: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.big {
|
||||||
|
display: inline-block;
|
||||||
|
line-height: 48px;
|
||||||
|
font-size: 16px;
|
||||||
|
padding: 0px 48px;
|
||||||
|
margin-top: 36px;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
${domtools.elementBasic.styles}
|
<div
|
||||||
<style>
|
class="button ${this.isHidden ? 'hidden' : 'block'} ${this.type} ${this.disabled
|
||||||
:host {
|
? 'disabled'
|
||||||
display: block;
|
: null}"
|
||||||
box-sizing: border-box;
|
@click="${this.dispatchClick}"
|
||||||
}
|
>
|
||||||
:host([hidden]) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
font-size: 14px;
|
|
||||||
display: block;
|
|
||||||
text-align: center;
|
|
||||||
background: #333;
|
|
||||||
border-top: 1px solid #444;
|
|
||||||
border-radius: 2px;
|
|
||||||
line-height: 40px;
|
|
||||||
padding: 0px 10px;
|
|
||||||
min-width: 100px;
|
|
||||||
color: ${this.isQuote ? '#ffffff' : '#333333' };
|
|
||||||
user-select: none;
|
|
||||||
color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
background: #039BE5;
|
|
||||||
border-top: 1px solid #039BE5;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:active {
|
|
||||||
background: #0277BD;
|
|
||||||
border-top: 1px solid #0277BD;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button.disabled {
|
|
||||||
background: #fff;
|
|
||||||
border: 1px solid #eeeff3;
|
|
||||||
color: #9b9b9e;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button.highlighted {
|
|
||||||
background: #e4002b;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button.discreet {
|
|
||||||
background: none;
|
|
||||||
border: 1px solid #9b9b9e;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button.discreet:hover {
|
|
||||||
background: rgba(0,0,0,0.1)
|
|
||||||
}
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.big {
|
|
||||||
display: inline-block;
|
|
||||||
line-height: 48px;
|
|
||||||
font-size: 16px;
|
|
||||||
padding: 0px 48px;
|
|
||||||
margin-top: 36px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div class="button ${this.isHidden ? 'hidden' : 'block'} ${this.type} ${this.disabled ? 'disabled' : null}" @click="${this.dispatchClick}">
|
|
||||||
${this.text ? this.text : this.textContent}
|
${this.text ? this.text : this.textContent}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
@ -107,19 +128,20 @@ export class DeesButton extends LitElement {
|
|||||||
|
|
||||||
public async dispatchClick() {
|
public async dispatchClick() {
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dispatchEvent(new CustomEvent('clicked', {
|
this.dispatchEvent(
|
||||||
detail: {
|
new CustomEvent('clicked', {
|
||||||
data: this.eventDetailData
|
detail: {
|
||||||
},
|
data: this.eventDetailData,
|
||||||
bubbles: true
|
},
|
||||||
}));
|
bubbles: true,
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async firstUpdated () {
|
public async firstUpdated() {
|
||||||
if (!this.textContent) {
|
if (!this.textContent) {
|
||||||
this.textContent = 'Button';
|
this.textContent = 'Button';
|
||||||
this.performUpdate();
|
this.performUpdate();
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
import { customElement, html, LitElement } from 'lit-element';
|
import { customElement, html, DeesElement, css, cssManager } from '@designestate/dees-element';
|
||||||
|
import { DeesForm } from './dees-form';
|
||||||
|
|
||||||
import {DeesForm} from './dees-form';
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-form-submit': DeesFormSubmit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-form-submit')
|
@customElement('dees-form-submit')
|
||||||
export class DeesFormSubmit extends LitElement {
|
export class DeesFormSubmit extends DeesElement {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static styles = [cssManager.defaultStyles, css``];
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
return html`
|
return html` <dees-button @click="${this.submit}">${this.textContent}</dees-button> `;
|
||||||
<dees-button @click="${this.submit}">${this.textContent}</dees-button>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async submit() {
|
public async submit() {
|
||||||
|
@ -1,20 +1,32 @@
|
|||||||
import { customElement, html, TemplateResult, LitElement } from 'lit-element';
|
import { customElement, html, TemplateResult, DeesElement } from '@designestate/dees-element';
|
||||||
|
|
||||||
import { DeesInputCheckbox } from './dees-input-checkbox';
|
import { DeesInputCheckbox } from './dees-input-checkbox';
|
||||||
import { DeesInputText } from './dees-input-text';
|
import { DeesInputText } from './dees-input-text';
|
||||||
import { DeesInputQuantitySelector } from './dees-input-quantityselector';
|
import { DeesInputQuantitySelector } from './dees-input-quantityselector';
|
||||||
import { DeesInputRadio } from './dees-input-radio';
|
import { DeesInputRadio } from './dees-input-radio';
|
||||||
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
export type TFormElement = Array<DeesInputCheckbox | DeesInputText | DeesInputQuantitySelector | DeesInputRadio>;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-form': DeesForm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-form')
|
@customElement('dees-form')
|
||||||
export class DeesForm extends LitElement {
|
export class DeesForm extends DeesElement {
|
||||||
public static demo = () => html`
|
public static demo = () => html`
|
||||||
<dees-form style="display: block; margin:auto; width: 500px; padding: 20px; background: #111;">
|
<dees-form style="display: block; margin:auto; max-width: 500px; padding: 20px">
|
||||||
<dees-input-text key="hello1"></dees-input-text>
|
<dees-input-text key="hello1" label="a text"></dees-input-text>
|
||||||
<dees-input-text key="hello2"></dees-input-text>
|
<dees-input-text key="hello2" label="also a text"></dees-input-text>
|
||||||
|
<dees-input-checkbox key="hello3" label="another text"></dees-input-checkbox>
|
||||||
<dees-form-submit>Submit</dees-form-submit>
|
<dees-form-submit>Submit</dees-form-submit>
|
||||||
</dees-form>`;
|
</dees-form>
|
||||||
|
`;
|
||||||
|
|
||||||
public name: string = 'myform';
|
public name: string = 'myform';
|
||||||
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
@ -27,18 +39,40 @@ export class DeesForm extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async gatherAndDispatch() {
|
public firstUpdated() {
|
||||||
|
const formChildren = this.getFormChildren();
|
||||||
|
for (const child of formChildren) {
|
||||||
|
child.changeSubject.subscribe(async (elementArg: TFormElement) => {
|
||||||
|
const valueObject = await this.gatherData();
|
||||||
|
this.changeSubject.next(valueObject);
|
||||||
|
console.log(valueObject);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public getFormChildren() {
|
||||||
|
const children: Array<DeesElement> = this.children as any;
|
||||||
|
const formChildren: TFormElement = [];
|
||||||
|
|
||||||
const children: Array<DeesInputCheckbox | DeesInputText | DeesInputQuantitySelector | DeesInputRadio> = this.children as any;
|
|
||||||
const valueObject: { [key: string]: string | number | boolean} = {};
|
|
||||||
for (const child of children) {
|
for (const child of children) {
|
||||||
if (child instanceof DeesInputCheckbox || child instanceof DeesInputText || child instanceof DeesInputQuantitySelector) {
|
if (child instanceof DeesInputCheckbox || child instanceof DeesInputText || child instanceof DeesInputQuantitySelector) {
|
||||||
valueObject[child.key] = child.value;
|
formChildren.push(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return formChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async gatherData() {
|
||||||
|
const children = this.getFormChildren();
|
||||||
|
const valueObject: { [key: string]: string | number | boolean} = {};
|
||||||
|
for (const child of children) {
|
||||||
|
valueObject[child.key] = child.value;
|
||||||
|
}
|
||||||
|
return valueObject;
|
||||||
|
}
|
||||||
|
|
||||||
console.log(valueObject);
|
public async gatherAndDispatch() {
|
||||||
|
const valueObject = await this.gatherData();
|
||||||
const formDataEvent = new CustomEvent('formData', {
|
const formDataEvent = new CustomEvent('formData', {
|
||||||
detail: {
|
detail: {
|
||||||
data: valueObject
|
data: valueObject
|
||||||
|
@ -2,17 +2,51 @@ import { LitElement, html, property, customElement } from 'lit-element';
|
|||||||
|
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
import { icon, IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
import { icon, IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
||||||
import { faFacebook, faTwitter, faLinkedin, faMedium } from '@fortawesome/free-brands-svg-icons';
|
import {
|
||||||
|
faFacebook,
|
||||||
|
faGoogle,
|
||||||
|
faLinkedin,
|
||||||
|
faMedium,
|
||||||
|
faSlackHash,
|
||||||
|
faTwitter,
|
||||||
|
} from '@fortawesome/free-brands-svg-icons';
|
||||||
|
|
||||||
type TBrand = 'facebook' | 'twitter' | 'linkedin' | 'medium';
|
import {} from '@fortawesome/free-regular-svg-icons';
|
||||||
const brandIcons: {[key: string]: IconDefinition} = {
|
import { faDesktop, faRss, faUsers } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
|
type TFontAwesomeIcon =
|
||||||
|
// normal
|
||||||
|
| 'desktop'
|
||||||
|
| 'rss'
|
||||||
|
// brands
|
||||||
|
| 'facebook'
|
||||||
|
| 'google'
|
||||||
|
| 'twitter'
|
||||||
|
| 'linkedin'
|
||||||
|
| 'medium'
|
||||||
|
| 'slack'
|
||||||
|
| 'users';
|
||||||
|
const faIcons: { [key: string]: IconDefinition } = {
|
||||||
|
// normal
|
||||||
|
desktop: faDesktop,
|
||||||
|
rss: faRss,
|
||||||
|
// brands
|
||||||
facebook: faFacebook,
|
facebook: faFacebook,
|
||||||
twitter: faTwitter,
|
google: faGoogle,
|
||||||
linkedin: faLinkedin,
|
linkedin: faLinkedin,
|
||||||
medium: faMedium
|
medium: faMedium,
|
||||||
|
slack: faSlackHash,
|
||||||
|
twitter: faTwitter,
|
||||||
|
users: faUsers,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-icon': DeesIcon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-icon')
|
@customElement('dees-icon')
|
||||||
export class DeesIcon extends LitElement {
|
export class DeesIcon extends LitElement {
|
||||||
public static demo = () => html`
|
public static demo = () => html`
|
||||||
@ -20,14 +54,13 @@ export class DeesIcon extends LitElement {
|
|||||||
<dees-icon iconName="visibility"></dees-icon>
|
<dees-icon iconName="visibility"></dees-icon>
|
||||||
<dees-icon brandName="facebook"></dees-icon>
|
<dees-icon brandName="facebook"></dees-icon>
|
||||||
</div>
|
</div>
|
||||||
|
`;
|
||||||
`;
|
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public iconName: string;
|
public iconName: string;
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public brandName: TBrand;
|
public brandName: TFontAwesomeIcon;
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public svgSize: number = 20;
|
public svgSize: number = 20;
|
||||||
@ -83,7 +116,9 @@ export class DeesIcon extends LitElement {
|
|||||||
|
|
||||||
firstUpdated() {
|
firstUpdated() {
|
||||||
if (this.brandName && !this.iconName) {
|
if (this.brandName && !this.iconName) {
|
||||||
this.shadowRoot.querySelector('#iconContainer').innerHTML = icon(brandIcons[this.brandName]).html[0];
|
this.shadowRoot.querySelector('#iconContainer').innerHTML = icon(
|
||||||
|
faIcons[this.brandName]
|
||||||
|
).html[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,20 @@
|
|||||||
import { customElement, LitElement, TemplateResult, property, html } from 'lit-element';
|
import { customElement, DeesElement, TemplateResult, property, html } from '@designestate/dees-element';
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-input-checkbox': DeesInputCheckbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-input-checkbox')
|
@customElement('dees-input-checkbox')
|
||||||
export class DeesInputCheckbox extends LitElement {
|
export class DeesInputCheckbox extends DeesElement {
|
||||||
|
// STATIC
|
||||||
public static demo = () => html`<dees-input-checkbox></dees-input-checkbox>`;
|
public static demo = () => html`<dees-input-checkbox></dees-input-checkbox>`;
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public key: string;
|
public key: string;
|
||||||
|
|
||||||
@ -14,6 +24,7 @@ export class DeesInputCheckbox extends LitElement {
|
|||||||
@property()
|
@property()
|
||||||
public value: boolean = false;
|
public value: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
${domtools.elementBasic.styles}
|
${domtools.elementBasic.styles}
|
||||||
@ -33,11 +44,11 @@ export class DeesInputCheckbox extends LitElement {
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 25px auto;
|
grid-template-columns: 25px auto;
|
||||||
padding: 5px 0px;
|
padding: 5px 0px;
|
||||||
color: #ccc;
|
color: ${this.goBright ? '#333' : '#ccc'};
|
||||||
}
|
}
|
||||||
|
|
||||||
.maincontainer:hover {
|
.maincontainer:hover {
|
||||||
color: #fff;
|
${this.goBright ? '#000' : '#ccc'};
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
@ -55,12 +66,12 @@ export class DeesInputCheckbox extends LitElement {
|
|||||||
.checkbox {
|
.checkbox {
|
||||||
transition: all 0.1s;
|
transition: all 0.1s;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px solid #999;
|
border: 1px solid ${this.goBright ? '#CCC' : '#999'};
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: #222;
|
background: ${this.goBright ? '#fafafa' : '#222'};
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox.selected {
|
.checkbox.selected {
|
||||||
@ -123,5 +134,6 @@ export class DeesInputCheckbox extends LitElement {
|
|||||||
bubbles: true,
|
bubbles: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
this.changeSubject.next(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
import { customElement, LitElement, TemplateResult, property, html } from 'lit-element';
|
import { customElement, LitElement, TemplateResult, property, html } from 'lit-element';
|
||||||
|
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-input-dropdown': DeesInputDropdown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-input-dropdown')
|
@customElement('dees-input-dropdown')
|
||||||
export class DeesInputDropdown extends LitElement {
|
export class DeesInputDropdown extends LitElement {
|
||||||
|
public static demo = () => html`<dees-input-dropdown></dees-input-dropdown>`
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public label: string = 'Label';
|
public label: string = 'Label';
|
||||||
|
|
||||||
@ -108,6 +118,7 @@ export class DeesInputDropdown extends LitElement {
|
|||||||
bubbles: true
|
bubbles: true
|
||||||
}));
|
}));
|
||||||
this.toggleSelectionBox();
|
this.toggleSelectionBox();
|
||||||
|
this.changeSubject.next(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public toggleSelectionBox() {
|
public toggleSelectionBox() {
|
||||||
|
130
ts_web/elements/dees-input-fileupload.ts
Normal file
130
ts_web/elements/dees-input-fileupload.ts
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
import {
|
||||||
|
customElement,
|
||||||
|
DeesElement,
|
||||||
|
TemplateResult,
|
||||||
|
property,
|
||||||
|
html,
|
||||||
|
css,
|
||||||
|
unsafeCSS,
|
||||||
|
cssManager,
|
||||||
|
} from '@designestate/dees-element';
|
||||||
|
|
||||||
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-input-fileupload': DeesInputFileupload;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('dees-input-fileupload')
|
||||||
|
export class DeesInputFileupload extends DeesElement {
|
||||||
|
public static demo = () => html`<dees-input-fileupload></dees-input-fileupload>`;
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: String,
|
||||||
|
})
|
||||||
|
public label: string = null;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: String,
|
||||||
|
})
|
||||||
|
public key: string;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
attribute: false,
|
||||||
|
})
|
||||||
|
public value: File[] = [];
|
||||||
|
|
||||||
|
@property()
|
||||||
|
public state: 'idle' | 'dragOver' | 'dropped' | 'uploading' | 'completed' = 'idle';
|
||||||
|
|
||||||
|
public static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
|
css`
|
||||||
|
:host {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
margin: 10px 0px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maincontainer {
|
||||||
|
color: ${cssManager.bdTheme('#333', '#ccc')};
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uploadButton {
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 20px 20px;
|
||||||
|
max-width: 200px;
|
||||||
|
background: ${cssManager.bdTheme('#fafafa', '#333333')};
|
||||||
|
border-radius: 3px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.uploadButton::after {
|
||||||
|
top: 7px;
|
||||||
|
right: 7px;
|
||||||
|
left: 7px;
|
||||||
|
bottom: 7px;
|
||||||
|
transform: scale3d(0.9, 0.9, 1);
|
||||||
|
position: absolute;
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
border: 4px dashed rgba(255, 255, 255, 0);
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
.uploadButton.dragOver::after {
|
||||||
|
transform: scale3d(1, 1, 1);
|
||||||
|
border: 4px dashed rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
|
||||||
|
public render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
<div class="maincontainer">
|
||||||
|
${this.label ? html`<div class="label">${this.label}</div>` : null}
|
||||||
|
<div class="uploadButton ${this.state === 'dragOver' ? 'dragOver' : ''}">Upload File! (Drag/Drop enabled)</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async updateValue(eventArg: Event) {
|
||||||
|
const target: any = eventArg.target;
|
||||||
|
this.value = target.value;
|
||||||
|
this.changeSubject.next(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public firstUpdated() {
|
||||||
|
const dropArea = this.shadowRoot.querySelector('.uploadButton');
|
||||||
|
const handlerFunction = (eventArg: DragEvent) => {
|
||||||
|
eventArg.preventDefault();
|
||||||
|
switch(eventArg.type) {
|
||||||
|
case 'dragover':
|
||||||
|
this.state = 'dragOver';
|
||||||
|
break;
|
||||||
|
case 'dragleave':
|
||||||
|
this.state = 'idle';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
console.log(eventArg);
|
||||||
|
for (const file of Array.from(eventArg.dataTransfer.files)) {
|
||||||
|
this.value.push(file);
|
||||||
|
};
|
||||||
|
console.log(`Got ${this.value.length} files!`);
|
||||||
|
};
|
||||||
|
dropArea.addEventListener('dragenter', handlerFunction, false);
|
||||||
|
dropArea.addEventListener('dragleave', handlerFunction, false);
|
||||||
|
dropArea.addEventListener('dragover', handlerFunction, false);
|
||||||
|
dropArea.addEventListener('drop', handlerFunction, false);
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,19 @@
|
|||||||
import { customElement, property, html, TemplateResult, LitElement } from 'lit-element';
|
import { customElement, property, html, TemplateResult, DeesElement } from '@designestate/dees-element';
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-input-quantityselector': DeesInputQuantitySelector;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-input-quantityselector')
|
@customElement('dees-input-quantityselector')
|
||||||
export class DeesInputQuantitySelector extends LitElement {
|
export class DeesInputQuantitySelector extends DeesElement {
|
||||||
public static demo = () => html`<dees-input-quantityselector></dees-input-quantityselector>`;
|
public static demo = () => html`<dees-input-quantityselector></dees-input-quantityselector>`;
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public key: string;
|
public key: string;
|
||||||
|
|
||||||
@ -32,8 +41,13 @@ export class DeesInputQuantitySelector extends LitElement {
|
|||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
color: #CCC;
|
color: ${this.goBright ? '#666' : '#CCC'};
|
||||||
border: 1px solid #CCC;
|
border: ${this.goBright ? '1px solid #333' : '1px solid #CCC'};
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainContainer:hover {
|
||||||
|
color: ${this.goBright ? '#333' : '#fff'};
|
||||||
|
border: ${this.goBright ? '1px solid #333' : '1px solid #fff'};
|
||||||
}
|
}
|
||||||
|
|
||||||
.minus {
|
.minus {
|
||||||
@ -57,10 +71,7 @@ export class DeesInputQuantitySelector extends LitElement {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainContainer:hover {
|
|
||||||
color: #fff;
|
|
||||||
border: 1px solid #fff;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="maincontainer">
|
<div class="maincontainer">
|
||||||
@ -73,6 +84,7 @@ export class DeesInputQuantitySelector extends LitElement {
|
|||||||
|
|
||||||
public increase () {
|
public increase () {
|
||||||
this.value++;
|
this.value++;
|
||||||
|
this.changeSubject.next(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public decrease () {
|
public decrease () {
|
||||||
@ -81,5 +93,6 @@ export class DeesInputQuantitySelector extends LitElement {
|
|||||||
} else {
|
} else {
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
}
|
}
|
||||||
|
this.changeSubject.next(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
import {customElement, LitElement, TemplateResult, property, html} from 'lit-element';
|
import {customElement, LitElement, TemplateResult, property, html} from 'lit-element';
|
||||||
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-input-radio': DeesInputRadio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-input-radio')
|
@customElement('dees-input-radio')
|
||||||
export class DeesInputRadio extends LitElement {
|
export class DeesInputRadio extends LitElement {
|
||||||
public static demo = () => html`<dees-input-radio></dees-input-radio>`;
|
public static demo = () => html`<dees-input-radio></dees-input-radio>`;
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public key: string;
|
public key: string;
|
||||||
|
|
||||||
@ -96,5 +106,6 @@ export class DeesInputRadio extends LitElement {
|
|||||||
detail: this.value,
|
detail: this.value,
|
||||||
bubbles: true
|
bubbles: true
|
||||||
}));
|
}));
|
||||||
|
this.changeSubject.next(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,19 @@
|
|||||||
import {customElement, LitElement, TemplateResult, property, html} from 'lit-element';
|
import {customElement, DeesElement, TemplateResult, property, html} from '@designestate/dees-element';
|
||||||
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-input-text': DeesInputText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-input-text')
|
@customElement('dees-input-text')
|
||||||
export class DeesInputText extends LitElement {
|
export class DeesInputText extends DeesElement {
|
||||||
public static demo = () => html`<dees-input-text></dees-input-text>`;
|
public static demo = () => html`<dees-input-text></dees-input-text>`;
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public label: string = 'Label';
|
public label: string = 'Label';
|
||||||
|
|
||||||
@ -28,7 +38,7 @@ export class DeesInputText extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.maincontainer {
|
.maincontainer {
|
||||||
color: #ccc;
|
color: ${this.goBright ? '#333' : '#ccc'};
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
@ -38,10 +48,11 @@ export class DeesInputText extends LitElement {
|
|||||||
|
|
||||||
input {
|
input {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
background: #222;
|
background: ${this.goBright ? '#fafafa' : '#222'};
|
||||||
border: none;
|
border-top: ${this.goBright ? '1px solid #CCC' : '1px solid #444'};
|
||||||
border-top: 1px solid #444;
|
border-bottom: ${this.goBright ? '1px solid #CCC' : '1px solid #333'};
|
||||||
border-bottom: 1px solid #333;
|
border-right: ${this.goBright ? '1px solid #CCC' : 'none'};
|
||||||
|
border-left: ${this.goBright ? '1px solid #CCC' : 'none'};
|
||||||
padding-left:10px;
|
padding-left:10px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
@ -68,6 +79,6 @@ export class DeesInputText extends LitElement {
|
|||||||
public async updateValue(eventArg: Event) {
|
public async updateValue(eventArg: Event) {
|
||||||
const target: any = eventArg.target;
|
const target: any = eventArg.target;
|
||||||
this.value = target.value;
|
this.value = target.value;
|
||||||
|
this.changeSubject.next(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,12 @@ import { customElement, LitElement, TemplateResult, html } from 'lit-element';
|
|||||||
|
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-toast': DeesToast;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-toast')
|
@customElement('dees-toast')
|
||||||
export class DeesToast extends LitElement {
|
export class DeesToast extends LitElement {
|
||||||
|
|
||||||
|
47
ts_web/elements/dees-updater.ts
Normal file
47
ts_web/elements/dees-updater.ts
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import { customElement, LitElement, TemplateResult, html, property } from 'lit-element';
|
||||||
|
|
||||||
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
|
||||||
|
import './dees-windowlayer';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-updater': DeesUpdater;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('dees-updater')
|
||||||
|
export class DeesUpdater extends LitElement {
|
||||||
|
public static demo = () => html`<dees-updater ></dees-updater>`;
|
||||||
|
|
||||||
|
@property()
|
||||||
|
currentVersion: string;
|
||||||
|
|
||||||
|
@property()
|
||||||
|
updatedVersion: string;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
domtools.elementBasic.setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
${domtools.elementBasic.styles}
|
||||||
|
<style>
|
||||||
|
.modalContainer {
|
||||||
|
background: #333333;
|
||||||
|
margin: auto;
|
||||||
|
height: 200px;
|
||||||
|
width: 800px;
|
||||||
|
margin-top: 80px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<dees-windowlayer>
|
||||||
|
<div class="modalContainer"></div>
|
||||||
|
</dees-windowlayer>>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
50
ts_web/elements/dees-windowlayer.ts
Normal file
50
ts_web/elements/dees-windowlayer.ts
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import { customElement, LitElement, TemplateResult, html, property } from 'lit-element';
|
||||||
|
|
||||||
|
import * as domtools from '@designestate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-windowlayer': DeesWindowLayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('dees-windowlayer')
|
||||||
|
export class DeesWindowLayer extends LitElement {
|
||||||
|
public static demo = () => html`<dees-windowlayer></dees-windowlayer>`;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
domtools.elementBasic.setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
${domtools.elementBasic.styles}
|
||||||
|
<style>
|
||||||
|
.windowOverlay {
|
||||||
|
transition: all 1s;
|
||||||
|
position: fixed;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
background: rgba(0, 0, 0, 0.0);
|
||||||
|
backdrop-filter: blur(0px);
|
||||||
|
}
|
||||||
|
.visible {
|
||||||
|
background: rgba(0, 0, 0, 0.2);
|
||||||
|
backdrop-filter: blur(3px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="windowOverlay">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstUpdated() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.shadowRoot.querySelector('.windowOverlay').classList.add('visible');
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,10 @@ export * from './dees-form-submit';
|
|||||||
export * from './dees-icon';
|
export * from './dees-icon';
|
||||||
export * from './dees-input-checkbox';
|
export * from './dees-input-checkbox';
|
||||||
export * from './dees-input-dropdown';
|
export * from './dees-input-dropdown';
|
||||||
|
export * from './dees-input-fileupload';
|
||||||
export * from './dees-input-quantityselector';
|
export * from './dees-input-quantityselector';
|
||||||
export * from './dees-input-radio';
|
export * from './dees-input-radio';
|
||||||
export * from './dees-input-text';
|
export * from './dees-input-text';
|
||||||
export * from './dees-toast';
|
export * from './dees-toast';
|
||||||
|
export * from './dees-updater';
|
||||||
|
export * from './dees-windowlayer';
|
||||||
|
@ -1 +0,0 @@
|
|||||||
export {}
|
|
Reference in New Issue
Block a user