@design.estate/dees-catalog 1.0.173
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/dist_bundle/bundle.js +2704 -0
- package/dist_bundle/bundle.js.map +7 -0
- package/dist_ts_web/00_commitinfo_data.d.ts +8 -0
- package/dist_ts_web/00_commitinfo_data.js +9 -0
- package/dist_ts_web/elements/dees-button-exit.d.ts +7 -0
- package/dist_ts_web/elements/dees-button-exit.js +52 -0
- package/dist_ts_web/elements/dees-button.d.ts +20 -0
- package/dist_ts_web/elements/dees-button.js +215 -0
- package/dist_ts_web/elements/dees-chips.d.ts +18 -0
- package/dist_ts_web/elements/dees-chips.js +124 -0
- package/dist_ts_web/elements/dees-contextmenu.d.ts +18 -0
- package/dist_ts_web/elements/dees-contextmenu.js +173 -0
- package/dist_ts_web/elements/dees-dataview-codebox.d.ts +15 -0
- package/dist_ts_web/elements/dees-dataview-codebox.js +177 -0
- package/dist_ts_web/elements/dees-dataview-statusobject.d.ts +14 -0
- package/dist_ts_web/elements/dees-dataview-statusobject.js +163 -0
- package/dist_ts_web/elements/dees-form-submit.d.ts +17 -0
- package/dist_ts_web/elements/dees-form-submit.js +68 -0
- package/dist_ts_web/elements/dees-form.d.ts +29 -0
- package/dist_ts_web/elements/dees-form.js +173 -0
- package/dist_ts_web/elements/dees-icon.d.ts +76 -0
- package/dist_ts_web/elements/dees-icon.js +153 -0
- package/dist_ts_web/elements/dees-input-checkbox.d.ts +18 -0
- package/dist_ts_web/elements/dees-input-checkbox.js +178 -0
- package/dist_ts_web/elements/dees-input-dropdown.d.ts +30 -0
- package/dist_ts_web/elements/dees-input-dropdown.js +185 -0
- package/dist_ts_web/elements/dees-input-fileupload.d.ts +24 -0
- package/dist_ts_web/elements/dees-input-fileupload.js +196 -0
- package/dist_ts_web/elements/dees-input-quantityselector.d.ts +19 -0
- package/dist_ts_web/elements/dees-input-quantityselector.js +122 -0
- package/dist_ts_web/elements/dees-input-radio.d.ts +19 -0
- package/dist_ts_web/elements/dees-input-radio.js +136 -0
- package/dist_ts_web/elements/dees-input-text.d.ts +26 -0
- package/dist_ts_web/elements/dees-input-text.js +183 -0
- package/dist_ts_web/elements/dees-mobilenavigation.d.ts +27 -0
- package/dist_ts_web/elements/dees-mobilenavigation.js +185 -0
- package/dist_ts_web/elements/dees-pdf.d.ts +17 -0
- package/dist_ts_web/elements/dees-pdf.js +108 -0
- package/dist_ts_web/elements/dees-preview.d.ts +1 -0
- package/dist_ts_web/elements/dees-preview.js +2 -0
- package/dist_ts_web/elements/dees-search.d.ts +1 -0
- package/dist_ts_web/elements/dees-search.js +2 -0
- package/dist_ts_web/elements/dees-searchbox.d.ts +1 -0
- package/dist_ts_web/elements/dees-searchbox.js +2 -0
- package/dist_ts_web/elements/dees-speechbubble.d.ts +18 -0
- package/dist_ts_web/elements/dees-speechbubble.js +153 -0
- package/dist_ts_web/elements/dees-spinner.d.ts +15 -0
- package/dist_ts_web/elements/dees-spinner.js +130 -0
- package/dist_ts_web/elements/dees-stepper.d.ts +29 -0
- package/dist_ts_web/elements/dees-stepper.js +231 -0
- package/dist_ts_web/elements/dees-table.d.ts +28 -0
- package/dist_ts_web/elements/dees-table.js +348 -0
- package/dist_ts_web/elements/dees-toast.d.ts +10 -0
- package/dist_ts_web/elements/dees-toast.js +29 -0
- package/dist_ts_web/elements/dees-tooltip.d.ts +1 -0
- package/dist_ts_web/elements/dees-tooltip.js +2 -0
- package/dist_ts_web/elements/dees-updater.d.ts +16 -0
- package/dist_ts_web/elements/dees-updater.js +91 -0
- package/dist_ts_web/elements/dees-windowlayer.d.ts +17 -0
- package/dist_ts_web/elements/dees-windowlayer.js +85 -0
- package/dist_ts_web/elements/index.d.ts +24 -0
- package/dist_ts_web/elements/index.js +25 -0
- package/dist_ts_web/elements/plugins.d.ts +4 -0
- package/dist_ts_web/elements/plugins.js +7 -0
- package/dist_ts_web/index.d.ts +2 -0
- package/dist_ts_web/index.js +3 -0
- package/license +22 -0
- package/npmextra.json +18 -0
- package/package.json +55 -0
- package/readme.md +39 -0
- package/ts_web/00_commitinfo_data.ts +8 -0
- package/ts_web/elements/dees-button-exit.ts +48 -0
- package/ts_web/elements/dees-button.ts +218 -0
- package/ts_web/elements/dees-chips.ts +124 -0
- package/ts_web/elements/dees-contextmenu.ts +181 -0
- package/ts_web/elements/dees-dataview-codebox.ts +178 -0
- package/ts_web/elements/dees-dataview-statusobject.ts +170 -0
- package/ts_web/elements/dees-form-submit.ts +70 -0
- package/ts_web/elements/dees-form.ts +191 -0
- package/ts_web/elements/dees-icon.ts +204 -0
- package/ts_web/elements/dees-input-checkbox.ts +175 -0
- package/ts_web/elements/dees-input-dropdown.ts +173 -0
- package/ts_web/elements/dees-input-fileupload.ts +195 -0
- package/ts_web/elements/dees-input-quantityselector.ts +113 -0
- package/ts_web/elements/dees-input-radio.ts +125 -0
- package/ts_web/elements/dees-input-text.ts +171 -0
- package/ts_web/elements/dees-mobilenavigation.ts +189 -0
- package/ts_web/elements/dees-pdf.ts +119 -0
- package/ts_web/elements/dees-preview.ts +0 -0
- package/ts_web/elements/dees-search.ts +0 -0
- package/ts_web/elements/dees-searchbox.ts +0 -0
- package/ts_web/elements/dees-speechbubble.ts +157 -0
- package/ts_web/elements/dees-spinner.ts +131 -0
- package/ts_web/elements/dees-stepper.ts +262 -0
- package/ts_web/elements/dees-table.ts +360 -0
- package/ts_web/elements/dees-toast.ts +26 -0
- package/ts_web/elements/dees-tooltip.ts +1 -0
- package/ts_web/elements/dees-updater.ts +90 -0
- package/ts_web/elements/dees-windowlayer.ts +85 -0
- package/ts_web/elements/index.ts +24 -0
- package/ts_web/elements/plugins.ts +13 -0
- package/ts_web/index.ts +2 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DeesElement,
|
|
3
|
+
html,
|
|
4
|
+
customElement,
|
|
5
|
+
type TemplateResult,
|
|
6
|
+
property,
|
|
7
|
+
state,
|
|
8
|
+
cssManager,
|
|
9
|
+
css,
|
|
10
|
+
type CSSResult,
|
|
11
|
+
} from '@design.estate/dees-element';
|
|
12
|
+
|
|
13
|
+
import * as tsclass from '@tsclass/tsclass';
|
|
14
|
+
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'dees-dataview-statusobject': DeesDataviewStatusobject;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@customElement('dees-dataview-statusobject')
|
|
22
|
+
export class DeesDataviewStatusobject extends DeesElement {
|
|
23
|
+
public static demo = () => html`<dees-dataview-statusobject
|
|
24
|
+
.statusObject=${{
|
|
25
|
+
id: '1',
|
|
26
|
+
name: 'Demo Item',
|
|
27
|
+
combinedStatus: 'partly_ok',
|
|
28
|
+
combinedStatusText: 'partly_ok',
|
|
29
|
+
details: [
|
|
30
|
+
{
|
|
31
|
+
name: 'Detail 1',
|
|
32
|
+
value: 'Value 1',
|
|
33
|
+
status: 'ok',
|
|
34
|
+
statusText: 'OK',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Detail 2',
|
|
38
|
+
value: 'Value 2',
|
|
39
|
+
status: 'partly_ok',
|
|
40
|
+
statusText: 'partly_ok',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Detail 3',
|
|
44
|
+
value: 'Value 3',
|
|
45
|
+
status: 'not_ok',
|
|
46
|
+
statusText: 'not_ok',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'Detail 4',
|
|
50
|
+
value: 'Value 4 jhdkfjhalskdfjhfdjskalsdkfjhfdjskalskdjfhjdkslaksjdhfjdkslaskdfjhfjdkslaskdjfhjdskalskdjhfdjskalskdjfhdjskl',
|
|
51
|
+
status: 'ok',
|
|
52
|
+
statusText: 'OK',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
</dees-dataview-statusobject>`;
|
|
58
|
+
|
|
59
|
+
@property({ type: Object }) statusObject: tsclass.code.IStatusObject;
|
|
60
|
+
|
|
61
|
+
public static styles = [
|
|
62
|
+
cssManager.defaultStyles,
|
|
63
|
+
css`
|
|
64
|
+
.mainbox {
|
|
65
|
+
border-radius: 3px;
|
|
66
|
+
background: ${cssManager.bdTheme('#fff', '#1b1b1b')};
|
|
67
|
+
box-shadow: 0px 1px 3px #00000030;
|
|
68
|
+
min-height: 48px;
|
|
69
|
+
color: ${cssManager.bdTheme('#000', '#fff')};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.heading {
|
|
73
|
+
display: grid;
|
|
74
|
+
align-items: center;
|
|
75
|
+
grid-template-columns: 40px auto 120px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
h1 {
|
|
79
|
+
display: block;
|
|
80
|
+
margin: 0px;
|
|
81
|
+
padding: 0px;
|
|
82
|
+
height: 48px;
|
|
83
|
+
text-transform: uppercase;
|
|
84
|
+
font-size: 12px;
|
|
85
|
+
line-height: 48px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.statusdot {
|
|
89
|
+
height: 8px;
|
|
90
|
+
width: 8px;
|
|
91
|
+
border-radius: 6px;
|
|
92
|
+
background: grey;
|
|
93
|
+
margin: auto;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.copyMain {
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
font-size: 8px;
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
text-transform: uppercase;
|
|
101
|
+
border: 1px solid ${cssManager.bdTheme('#999', '#444')};
|
|
102
|
+
text-align: center;
|
|
103
|
+
padding: 4px;
|
|
104
|
+
border-radius: 3px;
|
|
105
|
+
margin-right: 16px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.statusdot.ok {
|
|
109
|
+
background: green;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.statusdot.not_ok{
|
|
113
|
+
background: red;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.statusdot.partly_ok {
|
|
117
|
+
background: orange;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.detail {
|
|
121
|
+
minheight: 60px;
|
|
122
|
+
align-items: center;
|
|
123
|
+
display: grid;
|
|
124
|
+
grid-template-columns: 40px auto;
|
|
125
|
+
border-top: 1px dotted ${cssManager.bdTheme('#999', '#444')};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.detail .detailsText {
|
|
129
|
+
padding-top: 8px;
|
|
130
|
+
padding-bottom: 8px;
|
|
131
|
+
padding-right: 8px;
|
|
132
|
+
word-break: break-all;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.detail .detailsText .label {
|
|
136
|
+
font-size: 12px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.detail .detailsText .value {
|
|
140
|
+
font-size: 16px;
|
|
141
|
+
font-family: 'Intel One Mono';
|
|
142
|
+
}
|
|
143
|
+
`,
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
render(): TemplateResult {
|
|
147
|
+
return html`
|
|
148
|
+
<div class="mainbox">
|
|
149
|
+
<div class="heading">
|
|
150
|
+
<div class="statusdot ${this.statusObject?.combinedStatus}"></div>
|
|
151
|
+
<h1>${this.statusObject?.name || 'no status object assigned'}</h1>
|
|
152
|
+
<div class="copyMain">Copy as JSON</div>
|
|
153
|
+
</div>
|
|
154
|
+
${this.statusObject?.details?.map((detailArg) => {
|
|
155
|
+
return html`
|
|
156
|
+
<div class="detail">
|
|
157
|
+
<div class="statusdot ${detailArg.status}"></div>
|
|
158
|
+
<div class="detailsText">
|
|
159
|
+
<div class="label">${detailArg.name}</div>
|
|
160
|
+
<div class="value">${detailArg.value}</div>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
`;
|
|
164
|
+
})}
|
|
165
|
+
</div>
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async firstUpdated() {}
|
|
170
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
customElement,
|
|
3
|
+
html,
|
|
4
|
+
DeesElement,
|
|
5
|
+
css,
|
|
6
|
+
cssManager,
|
|
7
|
+
property,
|
|
8
|
+
type CSSResult,
|
|
9
|
+
} from '@design.estate/dees-element';
|
|
10
|
+
import { DeesForm } from './dees-form.js';
|
|
11
|
+
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
'dees-form-submit': DeesFormSubmit;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@customElement('dees-form-submit')
|
|
19
|
+
export class DeesFormSubmit extends DeesElement {
|
|
20
|
+
public static demo = () => html`<dees-form-submit>This is a sloted text</dees-form-submit>`;
|
|
21
|
+
|
|
22
|
+
@property({
|
|
23
|
+
type: Boolean,
|
|
24
|
+
})
|
|
25
|
+
public disabled = false;
|
|
26
|
+
|
|
27
|
+
@property({
|
|
28
|
+
type: String,
|
|
29
|
+
})
|
|
30
|
+
public text: string;
|
|
31
|
+
|
|
32
|
+
@property({
|
|
33
|
+
type: String,
|
|
34
|
+
})
|
|
35
|
+
public status: 'normal' | 'pending' | 'success' | 'error' = 'normal';
|
|
36
|
+
|
|
37
|
+
constructor() {
|
|
38
|
+
super();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public static styles = [cssManager.defaultStyles, css``];
|
|
42
|
+
|
|
43
|
+
public render() {
|
|
44
|
+
return html`
|
|
45
|
+
<dees-button
|
|
46
|
+
status=${this.status}
|
|
47
|
+
@click=${this.submit}
|
|
48
|
+
.disabled=${this.disabled}
|
|
49
|
+
.text=${this.text ? this.text : this.textContent}
|
|
50
|
+
>
|
|
51
|
+
</dees-button>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public async submit() {
|
|
56
|
+
if (this.disabled) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const parentElement: DeesForm = this.parentElement as DeesForm;
|
|
60
|
+
parentElement.gatherAndDispatch();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public async focus() {
|
|
64
|
+
const domtools = await this.domtoolsPromise;
|
|
65
|
+
if (!this.disabled) {
|
|
66
|
+
domtools.convenience.smartdelay.delayFor(0);
|
|
67
|
+
this.submit();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { customElement, html, type TemplateResult, DeesElement, type CSSResult, } from '@design.estate/dees-element';
|
|
2
|
+
import * as domtools from '@design.estate/dees-domtools';
|
|
3
|
+
|
|
4
|
+
import { DeesInputCheckbox } from './dees-input-checkbox.js';
|
|
5
|
+
import { DeesInputText } from './dees-input-text.js';
|
|
6
|
+
import { DeesInputQuantitySelector } from './dees-input-quantityselector.js';
|
|
7
|
+
import { DeesInputRadio } from './dees-input-radio.js';
|
|
8
|
+
import { DeesFormSubmit } from './dees-form-submit.js';
|
|
9
|
+
|
|
10
|
+
export type TFormElement = Array<
|
|
11
|
+
DeesInputCheckbox | DeesInputText | DeesInputQuantitySelector | DeesInputRadio
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
declare global {
|
|
15
|
+
interface HTMLElementTagNameMap {
|
|
16
|
+
'dees-form': DeesForm;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@customElement('dees-form')
|
|
21
|
+
export class DeesForm extends DeesElement {
|
|
22
|
+
public static demo = () => html`
|
|
23
|
+
<dees-form
|
|
24
|
+
style="display: block; margin:auto; max-width: 500px; padding: 20px"
|
|
25
|
+
@formData=${async (eventArg) => {
|
|
26
|
+
const form: DeesForm = eventArg.currentTarget;
|
|
27
|
+
form.setStatus('pending', 'authenticating...');
|
|
28
|
+
await domtools.plugins.smartdelay.delayFor(1000);
|
|
29
|
+
form.setStatus('success', 'authenticated!');
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<dees-input-text .required="${true}" key="hello1" label="a text"></dees-input-text>
|
|
33
|
+
<dees-input-text .required="${true}" key="hello2" label="also a text"></dees-input-text>
|
|
34
|
+
<dees-input-checkbox
|
|
35
|
+
.required="${true}"
|
|
36
|
+
key="hello3"
|
|
37
|
+
label="another text"
|
|
38
|
+
></dees-input-checkbox>
|
|
39
|
+
<dees-form-submit>Submit</dees-form-submit>
|
|
40
|
+
</dees-form>
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
public name: string = 'myform';
|
|
44
|
+
public changeSubject = new domtools.rxjs.Subject();
|
|
45
|
+
|
|
46
|
+
public render(): TemplateResult {
|
|
47
|
+
return html`
|
|
48
|
+
<style>
|
|
49
|
+
:host {
|
|
50
|
+
display: contents;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
53
|
+
<slot></slot>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public async firstUpdated() {
|
|
58
|
+
const formChildren = this.getFormChildren();
|
|
59
|
+
this.checkRequiredStatus();
|
|
60
|
+
for (const child of formChildren) {
|
|
61
|
+
child.changeSubject.subscribe(async (elementArg: TFormElement) => {
|
|
62
|
+
const valueObject = await this.gatherData();
|
|
63
|
+
this.changeSubject.next(valueObject);
|
|
64
|
+
console.log(valueObject);
|
|
65
|
+
this.checkRequiredStatus();
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
await this.instrumentBehaviours();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public getFormChildren() {
|
|
72
|
+
const children: Array<DeesElement> = this.children as any;
|
|
73
|
+
const formChildren: TFormElement = [];
|
|
74
|
+
|
|
75
|
+
for (const child of children) {
|
|
76
|
+
if (
|
|
77
|
+
child instanceof DeesInputCheckbox ||
|
|
78
|
+
child instanceof DeesInputText ||
|
|
79
|
+
child instanceof DeesInputQuantitySelector
|
|
80
|
+
) {
|
|
81
|
+
formChildren.push(child);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return formChildren;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public getSubmitButton() {
|
|
88
|
+
const children: Array<DeesElement> = this.children as any;
|
|
89
|
+
let submitButton: DeesFormSubmit;
|
|
90
|
+
for (const childArg of children) {
|
|
91
|
+
if (childArg instanceof DeesFormSubmit) {
|
|
92
|
+
submitButton = childArg;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return submitButton;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public async checkRequiredStatus() {
|
|
99
|
+
console.log('checking the required status.');
|
|
100
|
+
|
|
101
|
+
let requiredOK = true;
|
|
102
|
+
for (const childArg of this.getFormChildren()) {
|
|
103
|
+
if (childArg.required && !childArg.value) {
|
|
104
|
+
requiredOK = false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (this.getSubmitButton()) {
|
|
108
|
+
this.getSubmitButton().disabled = !requiredOK;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public async gatherData() {
|
|
113
|
+
const children = this.getFormChildren();
|
|
114
|
+
const valueObject: { [key: string]: string | number | boolean } = {};
|
|
115
|
+
for (const child of children) {
|
|
116
|
+
valueObject[child.key] = child.value;
|
|
117
|
+
}
|
|
118
|
+
return valueObject;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public async gatherAndDispatch() {
|
|
122
|
+
const valueObject = await this.gatherData();
|
|
123
|
+
const formDataEvent = new CustomEvent('formData', {
|
|
124
|
+
detail: {
|
|
125
|
+
data: valueObject,
|
|
126
|
+
},
|
|
127
|
+
bubbles: true,
|
|
128
|
+
});
|
|
129
|
+
this.dispatchEvent(formDataEvent);
|
|
130
|
+
console.log('dispatched data:');
|
|
131
|
+
console.log(valueObject);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public setStatus(
|
|
135
|
+
visualStateArg: 'normal' | 'pending' | 'error' | 'success',
|
|
136
|
+
textStateArg: string
|
|
137
|
+
) {
|
|
138
|
+
const inputChildren = this.getFormChildren();
|
|
139
|
+
const submitButton = this.getSubmitButton();
|
|
140
|
+
|
|
141
|
+
switch (visualStateArg) {
|
|
142
|
+
case 'normal':
|
|
143
|
+
submitButton.disabled = false;
|
|
144
|
+
submitButton.status = 'normal';
|
|
145
|
+
for (const inputChild of inputChildren) {
|
|
146
|
+
inputChild.disabled = false;
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
case 'pending':
|
|
150
|
+
submitButton.disabled = true;
|
|
151
|
+
submitButton.status = 'pending';
|
|
152
|
+
for (const inputChild of inputChildren) {
|
|
153
|
+
inputChild.disabled = true;
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
case 'success':
|
|
157
|
+
submitButton.disabled = true;
|
|
158
|
+
submitButton.status = 'success';
|
|
159
|
+
for (const inputChild of inputChildren) {
|
|
160
|
+
inputChild.disabled = true;
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
163
|
+
case 'error':
|
|
164
|
+
submitButton.disabled = true;
|
|
165
|
+
submitButton.status = 'error';
|
|
166
|
+
for (const inputChild of inputChildren) {
|
|
167
|
+
inputChild.disabled = true;
|
|
168
|
+
}
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
submitButton.text = textStateArg;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
public async instrumentBehaviours() {
|
|
176
|
+
const children = this.getFormChildren();
|
|
177
|
+
for (const child of children) {
|
|
178
|
+
child.addEventListener('keydown', (eventArg) => {
|
|
179
|
+
if (eventArg.key === 'Enter') {
|
|
180
|
+
const currentIndex = children.indexOf(child);
|
|
181
|
+
if (currentIndex < children.length - 1) {
|
|
182
|
+
children[currentIndex + 1].focus();
|
|
183
|
+
} else {
|
|
184
|
+
children[currentIndex].blur();
|
|
185
|
+
this.getSubmitButton().focus();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DeesElement,
|
|
3
|
+
html,
|
|
4
|
+
property,
|
|
5
|
+
customElement,
|
|
6
|
+
cssManager,
|
|
7
|
+
css,
|
|
8
|
+
type CSSResult,
|
|
9
|
+
} from '@design.estate/dees-element';
|
|
10
|
+
|
|
11
|
+
import * as domtools from '@design.estate/dees-domtools';
|
|
12
|
+
|
|
13
|
+
import { icon, type IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
14
|
+
import {
|
|
15
|
+
faFacebook,
|
|
16
|
+
faGoogle,
|
|
17
|
+
faLinkedin,
|
|
18
|
+
faMedium,
|
|
19
|
+
faSlackHash,
|
|
20
|
+
faTwitter,
|
|
21
|
+
faInstagram,
|
|
22
|
+
faTiktok,
|
|
23
|
+
} from '@fortawesome/free-brands-svg-icons';
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
faCopy as faCopyRegular,
|
|
27
|
+
faCircleCheck as faCircleCheckRegular,
|
|
28
|
+
faCircleXmark as faCircleXmarkRegular,
|
|
29
|
+
faMessage as faMessageRegular,
|
|
30
|
+
faPaste as faPasteRegular,
|
|
31
|
+
faSun as faSunRegular,
|
|
32
|
+
} from '@fortawesome/free-regular-svg-icons';
|
|
33
|
+
import {
|
|
34
|
+
faArrowRight as faArrowRightSolid,
|
|
35
|
+
faArrowUpRightFromSquare as faArrowUpRightFromSquareSolid,
|
|
36
|
+
faBell as faBellSolid,
|
|
37
|
+
faBug as faBugSolid,
|
|
38
|
+
faBuilding as faBuildingSolid,
|
|
39
|
+
faCaretLeft as faCaretLeftSolid,
|
|
40
|
+
faCaretRight as faCaretRightSolid,
|
|
41
|
+
faCheck as faCheckSolid,
|
|
42
|
+
faCircleInfo as faCircleInfoSolid,
|
|
43
|
+
faCircleCheck as faCircleCheckSolid,
|
|
44
|
+
faCircleXmark as faCircleXmarkSolid,
|
|
45
|
+
faCopy as faCopySolid,
|
|
46
|
+
faDesktop as faDesktopSolid,
|
|
47
|
+
faEye as faEyeSolid,
|
|
48
|
+
faEyeSlash as faEyeSlashSolid,
|
|
49
|
+
faGrip as faGripSolid,
|
|
50
|
+
faMessage as faMessageSolid,
|
|
51
|
+
faMugHot as faMugHotSolid,
|
|
52
|
+
faMinus as faMinusSolid,
|
|
53
|
+
faPaste as faPasteSolid,
|
|
54
|
+
faPenToSquare as faPenToSquareSolid,
|
|
55
|
+
faRss as faRssSolid,
|
|
56
|
+
faUsers as faUsersSolid,
|
|
57
|
+
faShare as faShareSolid,
|
|
58
|
+
faSun as faSunSolid,
|
|
59
|
+
faXmark as faXmarkSolid,
|
|
60
|
+
} from '@fortawesome/free-solid-svg-icons';
|
|
61
|
+
|
|
62
|
+
export const faIcons = {
|
|
63
|
+
// normal
|
|
64
|
+
arrowRight: faArrowRightSolid,
|
|
65
|
+
arrowUpRightFromSquare: faArrowUpRightFromSquareSolid,
|
|
66
|
+
arrowUpRightFromSquareSolid: faArrowUpRightFromSquareSolid,
|
|
67
|
+
bell: faBellSolid,
|
|
68
|
+
bellSolid: faBellSolid,
|
|
69
|
+
bug: faBugSolid,
|
|
70
|
+
bugSolid: faBugSolid,
|
|
71
|
+
building: faBuildingSolid,
|
|
72
|
+
buildingSolid: faBuildingSolid,
|
|
73
|
+
caretLeft: faCaretLeftSolid,
|
|
74
|
+
caretLeftSolid: faCaretLeftSolid,
|
|
75
|
+
caretRight: faCaretRightSolid,
|
|
76
|
+
caretRightSolid: faCaretRightSolid,
|
|
77
|
+
check: faCheckSolid,
|
|
78
|
+
checkSolid: faCheckSolid,
|
|
79
|
+
circleInfo: faCircleInfoSolid,
|
|
80
|
+
circleInfoSolid: faCircleInfoSolid,
|
|
81
|
+
circleCheck: faCircleCheckRegular,
|
|
82
|
+
circleCheckSolid: faCircleCheckSolid,
|
|
83
|
+
circleXmark: faCircleXmarkRegular,
|
|
84
|
+
circleXmarkSolid: faCircleXmarkSolid,
|
|
85
|
+
copy: faCopyRegular,
|
|
86
|
+
copySolid: faCopySolid,
|
|
87
|
+
desktop: faDesktopSolid,
|
|
88
|
+
desktopSolid: faDesktopSolid,
|
|
89
|
+
eye: faEyeSolid,
|
|
90
|
+
eyeSolid: faEyeSolid,
|
|
91
|
+
eyeSlash: faEyeSlashSolid,
|
|
92
|
+
eyeSlashSolid: faEyeSlashSolid,
|
|
93
|
+
grip: faGripSolid,
|
|
94
|
+
gripSolid: faGripSolid,
|
|
95
|
+
message: faMessageRegular,
|
|
96
|
+
messageSolid: faMessageSolid,
|
|
97
|
+
mugHot: faMugHotSolid,
|
|
98
|
+
faMugHotSolid: faMugHotSolid,
|
|
99
|
+
minus: faMinusSolid,
|
|
100
|
+
minusSolid: faMinusSolid,
|
|
101
|
+
paste: faPasteRegular,
|
|
102
|
+
pasteSolid: faPasteSolid,
|
|
103
|
+
penToSquare: faPenToSquareSolid,
|
|
104
|
+
penToSquareSolid: faPenToSquareSolid,
|
|
105
|
+
rss: faRssSolid,
|
|
106
|
+
rssSolid: faRssSolid,
|
|
107
|
+
share: faShareSolid,
|
|
108
|
+
shareSolid: faShareSolid,
|
|
109
|
+
sun: faSunRegular,
|
|
110
|
+
sunSolid: faSunSolid,
|
|
111
|
+
xmark: faXmarkSolid,
|
|
112
|
+
xmarkSolid: faXmarkSolid,
|
|
113
|
+
// brands
|
|
114
|
+
facebook: faFacebook,
|
|
115
|
+
google: faGoogle,
|
|
116
|
+
instagram: faInstagram,
|
|
117
|
+
linkedin: faLinkedin,
|
|
118
|
+
medium: faMedium,
|
|
119
|
+
slack: faSlackHash,
|
|
120
|
+
tiktok: faTiktok,
|
|
121
|
+
twitter: faTwitter,
|
|
122
|
+
users: faUsersSolid,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
declare global {
|
|
126
|
+
interface HTMLElementTagNameMap {
|
|
127
|
+
'dees-icon': DeesIcon;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@customElement('dees-icon')
|
|
132
|
+
export class DeesIcon extends DeesElement {
|
|
133
|
+
public static demo = () => html`
|
|
134
|
+
<dees-icon iconName="visibility"></dees-icon>
|
|
135
|
+
<div style="background: #fff; padding: 10px; font-size: 30px">
|
|
136
|
+
<style>
|
|
137
|
+
dees-icon {
|
|
138
|
+
transition: color 0.05s;
|
|
139
|
+
}
|
|
140
|
+
dees-icon:hover {
|
|
141
|
+
color: #e4002b;
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
144
|
+
<dees-icon .iconFA=${'messageSolid'}></dees-icon>
|
|
145
|
+
<dees-icon .iconFA=${'sun'}></dees-icon>
|
|
146
|
+
<dees-icon .iconFA=${'sunSolid'}></dees-icon>
|
|
147
|
+
<dees-icon .iconFA=${'facebook'}></dees-icon>
|
|
148
|
+
<dees-icon .iconFA=${'arrowUpRightFromSquare'}></dees-icon>
|
|
149
|
+
</div>
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
@property({
|
|
153
|
+
type: String
|
|
154
|
+
})
|
|
155
|
+
public iconFA: keyof typeof faIcons;
|
|
156
|
+
|
|
157
|
+
@property()
|
|
158
|
+
public iconSize: number;
|
|
159
|
+
|
|
160
|
+
constructor() {
|
|
161
|
+
super();
|
|
162
|
+
domtools.elementBasic.setup();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
public static styles = [
|
|
166
|
+
cssManager.defaultStyles,
|
|
167
|
+
css`
|
|
168
|
+
:host {
|
|
169
|
+
display: block;
|
|
170
|
+
white-space: nowrap;
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
}
|
|
175
|
+
* {
|
|
176
|
+
transition: inherit !important;
|
|
177
|
+
}
|
|
178
|
+
`,
|
|
179
|
+
];
|
|
180
|
+
|
|
181
|
+
public render() {
|
|
182
|
+
return html`
|
|
183
|
+
${domtools.elementBasic.styles}
|
|
184
|
+
<style>
|
|
185
|
+
#iconContainer svg {
|
|
186
|
+
display: block;
|
|
187
|
+
height: ${this.iconSize}px;
|
|
188
|
+
}
|
|
189
|
+
</style>
|
|
190
|
+
<div id="iconContainer"></div>
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
public async updated() {
|
|
195
|
+
if (!this.iconSize) {
|
|
196
|
+
this.iconSize = parseInt(globalThis.getComputedStyle(this).fontSize.replace(/\D/g,''));
|
|
197
|
+
}
|
|
198
|
+
if (this.iconFA) {
|
|
199
|
+
this.shadowRoot.querySelector('#iconContainer').innerHTML = this.iconFA
|
|
200
|
+
? icon(faIcons[this.iconFA]).html[0]
|
|
201
|
+
: 'icon not found';
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|