@dile/ui 2.0.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/LICENSE +7 -0
- package/README.md +3 -0
- package/components/app-drawer/app-drawer.js +3 -0
- package/components/app-drawer/index.js +1 -0
- package/components/app-drawer/src/DileAppDrawer.js +153 -0
- package/components/avatar/avatar.js +3 -0
- package/components/avatar/index.js +1 -0
- package/components/avatar/src/DileAvatar.js +78 -0
- package/components/breadcrumbs/breadcrumbs-item.js +3 -0
- package/components/breadcrumbs/breadcrumbs.js +4 -0
- package/components/breadcrumbs/index.js +2 -0
- package/components/breadcrumbs/src/DileBreadcrumbs.js +76 -0
- package/components/breadcrumbs/src/DileBreadcrumbsItem.js +51 -0
- package/components/button/button-icon.js +3 -0
- package/components/button/button.js +3 -0
- package/components/button/index.js +2 -0
- package/components/button/src/DileButton.js +86 -0
- package/components/button/src/DileButtonIcon.js +38 -0
- package/components/card/card.js +3 -0
- package/components/card/index.js +1 -0
- package/components/card/src/DileCard.js +111 -0
- package/components/checkbox/checkbox.js +3 -0
- package/components/checkbox/index.js +1 -0
- package/components/checkbox/src/DileCheckbox.js +154 -0
- package/components/confirm/confirm.js +3 -0
- package/components/confirm/index.js +1 -0
- package/components/confirm/src/DileConfirm.js +121 -0
- package/components/datepicker/calendar.js +3 -0
- package/components/datepicker/datepicker.js +4 -0
- package/components/datepicker/index.js +2 -0
- package/components/datepicker/src/DileCalendar.js +72 -0
- package/components/datepicker/src/DileDatepicker.js +114 -0
- package/components/hamburger/hamburger.js +3 -0
- package/components/hamburger/index.js +1 -0
- package/components/hamburger/src/DileHamburger.js +129 -0
- package/components/icon/icon.js +3 -0
- package/components/icon/index.js +1 -0
- package/components/icon/src/DileIcon.js +40 -0
- package/components/icon-switch/icon-switch-group.js +3 -0
- package/components/icon-switch/icon-switch.js +3 -0
- package/components/icon-switch/index.js +1 -0
- package/components/icon-switch/src/DileIconSwitch.js +54 -0
- package/components/icon-switch/src/DileIconSwitchGroup.js +38 -0
- package/components/info-box/index.js +1 -0
- package/components/info-box/info-box.js +3 -0
- package/components/info-box/src/DileInfoBox.js +118 -0
- package/components/inline-feedback/index.js +1 -0
- package/components/inline-feedback/inline-feedback.js +3 -0
- package/components/inline-feedback/src/DileInlineFeedback.js +96 -0
- package/components/input/index.js +9 -0
- package/components/input/input-integer.js +3 -0
- package/components/input/input-message.js +3 -0
- package/components/input/input-money.js +3 -0
- package/components/input/input-number-mask.js +3 -0
- package/components/input/input-percentage.js +3 -0
- package/components/input/input-search.js +3 -0
- package/components/input/input.js +3 -0
- package/components/input/src/DileInput.js +245 -0
- package/components/input/src/DileInputInteger.js +45 -0
- package/components/input/src/DileInputMessage.js +12 -0
- package/components/input/src/DileInputMoney.js +72 -0
- package/components/input/src/DileInputNumberMask.js +83 -0
- package/components/input/src/DileInputPercentage.js +57 -0
- package/components/input/src/DileInputSearch.js +145 -0
- package/components/input/src/Mask.js +37 -0
- package/components/input/src/message-styles.js +14 -0
- package/components/menu-hamburger/index.js +1 -0
- package/components/menu-hamburger/menu-hamburger.js +3 -0
- package/components/menu-hamburger/src/DileMenuHamburger.js +89 -0
- package/components/menu-overlay/index.js +1 -0
- package/components/menu-overlay/menu-overlay.js +3 -0
- package/components/menu-overlay/src/DileMenuOverlay.js +71 -0
- package/components/message/index.js +1 -0
- package/components/message/message.js +3 -0
- package/components/message/src/DileMessage.js +166 -0
- package/components/modal/index.js +1 -0
- package/components/modal/modal.js +3 -0
- package/components/modal/src/DileModal.js +194 -0
- package/components/nav/index.js +1 -0
- package/components/nav/nav.js +3 -0
- package/components/nav/src/DileNav.js +68 -0
- package/components/order-switch/index.js +1 -0
- package/components/order-switch/order-switch.js +3 -0
- package/components/order-switch/src/DileOrderSwitch.js +74 -0
- package/components/pages/index.js +1 -0
- package/components/pages/pages.js +3 -0
- package/components/pages/src/DilePages.js +178 -0
- package/components/password/index.js +1 -0
- package/components/password/password.js +3 -0
- package/components/password/src/DilePassword.js +34 -0
- package/components/progress-bar/index.js +1 -0
- package/components/progress-bar/progress-bar.js +3 -0
- package/components/progress-bar/src/DileProgressBar.js +89 -0
- package/components/radio-group/index.js +2 -0
- package/components/radio-group/radio-group.js +3 -0
- package/components/radio-group/radio.js +3 -0
- package/components/radio-group/src/DileRadio.js +79 -0
- package/components/radio-group/src/DileRadioGroup.js +102 -0
- package/components/range/index.js +1 -0
- package/components/range/range.js +3 -0
- package/components/range/src/DileRange.js +119 -0
- package/components/rating/index.js +1 -0
- package/components/rating/rating.js +4 -0
- package/components/rating/src/DileRating.js +119 -0
- package/components/rating/src/DileStar.js +63 -0
- package/components/rating/star.js +3 -0
- package/components/rating-scale-question/index.js +2 -0
- package/components/rating-scale-question/rating-scale-option.js +3 -0
- package/components/rating-scale-question/rating-scale-question.js +3 -0
- package/components/rating-scale-question/src/DileRatingScaleOption.js +184 -0
- package/components/rating-scale-question/src/DileRatingScaleQuestion.js +252 -0
- package/components/select/index.js +1 -0
- package/components/select/select-ajax.js +4 -0
- package/components/select/select.js +3 -0
- package/components/select/src/DileSelect.js +172 -0
- package/components/select/src/DileSelectAjax.js +338 -0
- package/components/selector/index.js +2 -0
- package/components/selector/selector-item.js +3 -0
- package/components/selector/selector.js +3 -0
- package/components/selector/src/DileSelector.js +12 -0
- package/components/selector/src/DileSelectorItem.js +94 -0
- package/components/slide-show/index.js +1 -0
- package/components/slide-show/slide-show.js +3 -0
- package/components/slide-show/src/DileSlideShow.js +111 -0
- package/components/social-icon/index.js +1 -0
- package/components/social-icon/social-icon.js +3 -0
- package/components/social-icon/src/DileSocialIcon.js +63 -0
- package/components/social-icon/src/icons.js +103 -0
- package/components/spinner/index.js +1 -0
- package/components/spinner/spinner-horizontal.js +3 -0
- package/components/spinner/spinner-modal.js +4 -0
- package/components/spinner/spinner.js +3 -0
- package/components/spinner/src/DileSpinner.js +116 -0
- package/components/spinner/src/DileSpinnerHorizontal.js +64 -0
- package/components/spinner/src/DileSpinnerMixin.js +13 -0
- package/components/spinner/src/DileSpinnerModal.js +51 -0
- package/components/tabs/index.js +2 -0
- package/components/tabs/src/DileTab.js +60 -0
- package/components/tabs/src/DileTabs.js +12 -0
- package/components/tabs/tab.js +3 -0
- package/components/tabs/tabs.js +4 -0
- package/components/textarea/index.js +1 -0
- package/components/textarea/src/DileTextarea.js +166 -0
- package/components/textarea/textarea.js +3 -0
- package/components/toast/index.js +3 -0
- package/components/toast/src/DileToast.js +95 -0
- package/components/toast/src/DileToastItem.js +92 -0
- package/components/toast/src/DileToastPersistent.js +100 -0
- package/components/toast/toast-item.js +3 -0
- package/components/toast/toast-persistent.js +3 -0
- package/components/toast/toast.js +4 -0
- package/components/tooltip/chip-tooltip.js +3 -0
- package/components/tooltip/index.js +1 -0
- package/components/tooltip/src/DileChipTooltip.js +86 -0
- package/components/tooltip/src/DileTooltip.js +195 -0
- package/components/tooltip/tooltip.js +3 -0
- package/mixins/close-document-click/index.js +1 -0
- package/mixins/close-document-click/src/DileCloseDocumentClick.js +67 -0
- package/mixins/close-on-esc-pressed/index.js +1 -0
- package/mixins/close-on-esc-pressed/src/DileCloseOnEscPressed.js +31 -0
- package/mixins/form/index.js +3 -0
- package/mixins/form/src/DileEmmitChange.js +22 -0
- package/mixins/form/src/DileForm.js +116 -0
- package/mixins/form/src/DileFormChangeDetect.js +34 -0
- package/mixins/overlay/index.js +1 -0
- package/mixins/overlay/src/DileOverlay.js +171 -0
- package/mixins/selectable/index.js +2 -0
- package/mixins/selectable/src/DileSelectable.js +154 -0
- package/mixins/selectable/src/DileSelectableItem.js +30 -0
- package/mixins/slide-down/index.js +1 -0
- package/mixins/slide-down/src/DileSlideDown.js +40 -0
- package/package.json +29 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { messageStyles } from '../../input/index.js';
|
|
3
|
+
|
|
4
|
+
export class DileTextarea extends LitElement {
|
|
5
|
+
|
|
6
|
+
static get styles() {
|
|
7
|
+
return [
|
|
8
|
+
messageStyles,
|
|
9
|
+
css`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
margin-bottom: 10px;
|
|
13
|
+
}
|
|
14
|
+
label {
|
|
15
|
+
margin-bottom: var(--dile-textarea-label-margin-bottom, 4px);
|
|
16
|
+
color: var(--dile-textarea-label-color, #59e);
|
|
17
|
+
font-size: var(--dile-textarea-label-font-size, 1em);
|
|
18
|
+
font-weight: var(--dile-textarea-label-font-weight, normal);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
textarea {
|
|
22
|
+
border: var(--dile-textarea-border, 1px solid #888);
|
|
23
|
+
border-radius: var(--dile-textarea-border-radius, 5px);
|
|
24
|
+
padding: var(--dile-textarea-padding, 5px);
|
|
25
|
+
background-color: var(--dile-textarea-background-color, #fff);
|
|
26
|
+
color: var(--dile-textarea-color, #000);
|
|
27
|
+
font-size: var(--dile-textarea-font-size, 1em);
|
|
28
|
+
font-family: var(--dile-textarea-font-family, sans-serif);
|
|
29
|
+
width: 100%;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
line-height: 1.5rem;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
textarea::placeholder {
|
|
35
|
+
color: var(--dile-textarea-placeholder-color, #999);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host([disabled]) textarea {
|
|
39
|
+
background-color: var(--dile-textarea-disabled-background-color, #ebebeb);
|
|
40
|
+
border-color: var(--dile-textarea-disabled-border-color, #ccc);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.errored {
|
|
44
|
+
border-color: var(--dile-input-error-border-color, #c00);
|
|
45
|
+
}
|
|
46
|
+
.for-input {
|
|
47
|
+
display: flex;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
`];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static get properties() {
|
|
54
|
+
return {
|
|
55
|
+
name: { type: String },
|
|
56
|
+
label: { type: String },
|
|
57
|
+
errored: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
reflect: true
|
|
60
|
+
},
|
|
61
|
+
message: { type: String },
|
|
62
|
+
hideErrorOnInput: { type: Boolean },
|
|
63
|
+
value: { type: String },
|
|
64
|
+
placeholder: { type: String },
|
|
65
|
+
rows: { type: Number },
|
|
66
|
+
maxRows: { type: Number },
|
|
67
|
+
readonly: { type: Boolean },
|
|
68
|
+
disabled: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
reflect: true,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
constructor() {
|
|
76
|
+
super();
|
|
77
|
+
this.errored = false;
|
|
78
|
+
this.hideErrorOnInput = false;
|
|
79
|
+
this.value = '';
|
|
80
|
+
this.rows = 3;
|
|
81
|
+
this.maxRows = 10;
|
|
82
|
+
this._maxHeight = 100;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
firstUpdated() {
|
|
86
|
+
this.eltextarea = this.shadowRoot.getElementById('textArea');
|
|
87
|
+
this.resizeTextarea();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
placeCursorAtEnd() {
|
|
91
|
+
this.eltextarea.setSelectionRange(this.eltextarea.value.length, this.eltextarea.value.length);
|
|
92
|
+
this.eltextarea.focus();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
updated(changedProperties) {
|
|
96
|
+
if(changedProperties.has('maxRows')) {
|
|
97
|
+
this.calculateMaxHeight();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
render() {
|
|
102
|
+
return html`
|
|
103
|
+
<main>
|
|
104
|
+
${this.label
|
|
105
|
+
? html`<label for="textArea">${this.label}</label>`
|
|
106
|
+
: ""}
|
|
107
|
+
<section class="for-input">
|
|
108
|
+
<textarea
|
|
109
|
+
rows="${this.rows}"
|
|
110
|
+
id="textArea"
|
|
111
|
+
name="${this.name}"
|
|
112
|
+
placeholder="${this.placeholder}"
|
|
113
|
+
?disabled="${this.disabled}"
|
|
114
|
+
?readonly="${this.readonly}"
|
|
115
|
+
autocomplete="${this.disableAutocomplete ? "off" : "on"}"
|
|
116
|
+
.value="${this.value}"
|
|
117
|
+
class="${this.errored ? 'errored' : ''}"
|
|
118
|
+
@keypress="${this._lookForEnter}"
|
|
119
|
+
@input="${this.onInput}"
|
|
120
|
+
@blur="${this.doBlur}"
|
|
121
|
+
@focus="${this.doFocus}"
|
|
122
|
+
></textarea>
|
|
123
|
+
${this.labelRight
|
|
124
|
+
? html`<span class="labelright">${this.labelRight}</span>`
|
|
125
|
+
: ''
|
|
126
|
+
}
|
|
127
|
+
</section>
|
|
128
|
+
${this.message
|
|
129
|
+
? html`<div class="message ${this.errored ? 'errored-msg' : ''}"><span>${this.message}</span></div>`
|
|
130
|
+
: ''
|
|
131
|
+
}
|
|
132
|
+
</main>
|
|
133
|
+
`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
onInput(e) {
|
|
137
|
+
if(this.hideErrorOnInput && this.errored) {
|
|
138
|
+
this.errored = false;
|
|
139
|
+
this.message = '';
|
|
140
|
+
}
|
|
141
|
+
this._resizeTextarea();
|
|
142
|
+
this.value = this.eltextarea.value;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
_resizeTextarea() {
|
|
146
|
+
this.eltextarea.style.height = 'auto';
|
|
147
|
+
let scrollHeight = this.eltextarea.scrollHeight;
|
|
148
|
+
if(scrollHeight == 0) {
|
|
149
|
+
scrollHeight = this.lineHeight * this.rows;
|
|
150
|
+
}
|
|
151
|
+
let height = Math.min(scrollHeight, this._maxHeight);
|
|
152
|
+
this.eltextarea.style.height = height + 'px';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
resizeTextarea() {
|
|
156
|
+
this.updateComplete.then(() => this._resizeTextarea());
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
get lineHeight() {
|
|
160
|
+
return parseInt(getComputedStyle(this.eltextarea).lineHeight, 10);
|
|
161
|
+
}
|
|
162
|
+
calculateMaxHeight() {
|
|
163
|
+
this._maxHeight = this.lineHeight * this.maxRows;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
|
|
3
|
+
export class DileToast extends LitElement {
|
|
4
|
+
static get properties() {
|
|
5
|
+
return {
|
|
6
|
+
/* Messages array: Array of objects. You usually will not touch directly this array, instead of it, use the open() method */
|
|
7
|
+
messages: { type: Array },
|
|
8
|
+
/* Miliseconds the feedback message remains on the screen */
|
|
9
|
+
duration: { type: Number },
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.messages = [];
|
|
16
|
+
this.duration = 3000;
|
|
17
|
+
this.cleanTimeout = false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static get styles() {
|
|
21
|
+
return css`
|
|
22
|
+
:host {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column-reverse;
|
|
25
|
+
position: fixed;
|
|
26
|
+
bottom: 20px;
|
|
27
|
+
left: 15px;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
return html`
|
|
34
|
+
${this.messages.map(
|
|
35
|
+
(msg) => html`
|
|
36
|
+
<dile-toast-item
|
|
37
|
+
.msg="${msg}"
|
|
38
|
+
duration="${this.duration}"
|
|
39
|
+
></dile-toast-item>
|
|
40
|
+
`
|
|
41
|
+
)}
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Send a message to show in the screen
|
|
47
|
+
* @param text the text of the message
|
|
48
|
+
* @param toastType the status of the message (success, error, neutral)
|
|
49
|
+
*/
|
|
50
|
+
open(text, toastType = "neutral") {
|
|
51
|
+
this.messages = [
|
|
52
|
+
...this.messages,
|
|
53
|
+
{
|
|
54
|
+
text,
|
|
55
|
+
toastType,
|
|
56
|
+
hidden: false,
|
|
57
|
+
opening: true,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
this._programMessageClean();
|
|
61
|
+
this._programMessageHide();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Programs the hiding of the last message, after it's duration time
|
|
66
|
+
*/
|
|
67
|
+
_programMessageHide() {
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
let foundItemToHide = false;
|
|
70
|
+
this.messages = this.messages.map((item) => {
|
|
71
|
+
if (!foundItemToHide && !item.hidden) {
|
|
72
|
+
foundItemToHide = true;
|
|
73
|
+
return {
|
|
74
|
+
...item,
|
|
75
|
+
hidden: true,
|
|
76
|
+
};
|
|
77
|
+
} else {
|
|
78
|
+
return item;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}, this.duration);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Programs the cleaning of the array of messages, removing the hidden messages elements
|
|
86
|
+
*/
|
|
87
|
+
_programMessageClean() {
|
|
88
|
+
if (this.cleanTimeout) {
|
|
89
|
+
clearTimeout(this.cleanTimeout);
|
|
90
|
+
}
|
|
91
|
+
this.cleanTimeout = setTimeout(() => {
|
|
92
|
+
this.messages = this.messages.filter((item) => !item.hidden);
|
|
93
|
+
}, this.duration + 1000);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
|
|
3
|
+
export class DileToastItem extends LitElement {
|
|
4
|
+
static get properties() {
|
|
5
|
+
return {
|
|
6
|
+
msg: { type: Object },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.msg = {
|
|
13
|
+
msg: "",
|
|
14
|
+
toastType: "neutral",
|
|
15
|
+
hidden: false,
|
|
16
|
+
opening: true,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static get styles() {
|
|
21
|
+
return css`
|
|
22
|
+
* {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
}
|
|
25
|
+
:host {
|
|
26
|
+
display: block;
|
|
27
|
+
}
|
|
28
|
+
div {
|
|
29
|
+
color: var(--dile-toast-text-color, #fff);
|
|
30
|
+
padding: var(--dile-toast-padding, 10px 15px);
|
|
31
|
+
margin-top: 10px;
|
|
32
|
+
position: relative;
|
|
33
|
+
top: 0;
|
|
34
|
+
opacity: 1;
|
|
35
|
+
width: var(--dile-toast-width, 280px);
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
transition: all 0.4s ease;
|
|
38
|
+
z-index: var(--dile-toast-z-index, 1001);
|
|
39
|
+
font-size: var(--dile-toast-font-size, 1em);
|
|
40
|
+
font-weight: var(--dile-toast-font-weight, normal);
|
|
41
|
+
border-radius: var(--dile-toast-border-radius, 0);
|
|
42
|
+
}
|
|
43
|
+
.hidden {
|
|
44
|
+
top: 20px;
|
|
45
|
+
opacity: 0;
|
|
46
|
+
height: 0;
|
|
47
|
+
padding: 0;
|
|
48
|
+
}
|
|
49
|
+
.error {
|
|
50
|
+
background-color: var(--dile-toast-error-color, #e74c3c);
|
|
51
|
+
}
|
|
52
|
+
.success {
|
|
53
|
+
background-color: var(--dile-toast-success-color, #27ae60);
|
|
54
|
+
}
|
|
55
|
+
.neutral {
|
|
56
|
+
background-color: var(--dile-toast-neutral-color, #303030);
|
|
57
|
+
}
|
|
58
|
+
.opening {
|
|
59
|
+
top: -20px;
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
render() {
|
|
65
|
+
return html`
|
|
66
|
+
<div
|
|
67
|
+
class="${this.msg.hidden ? "hidden" : ""} ${this.msg.opening
|
|
68
|
+
? "opening"
|
|
69
|
+
: ""} ${this.getClassType(this.msg.toastType)}"
|
|
70
|
+
>
|
|
71
|
+
${this.msg.text}
|
|
72
|
+
</div>
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
firstUpdated() {
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
this.msg.opening = false;
|
|
79
|
+
this.requestUpdate();
|
|
80
|
+
}, 20);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
getClassType(toastType) {
|
|
84
|
+
switch (toastType) {
|
|
85
|
+
case "error":
|
|
86
|
+
case "success":
|
|
87
|
+
return toastType;
|
|
88
|
+
default:
|
|
89
|
+
return "neutral";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { DileOverlay } from "../../../mixins/overlay/index.js"
|
|
3
|
+
|
|
4
|
+
export class DileToastPersistent extends DileOverlay(LitElement) {
|
|
5
|
+
static get styles() {
|
|
6
|
+
return css`
|
|
7
|
+
:host {
|
|
8
|
+
display: inline;
|
|
9
|
+
position: relative;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
}
|
|
12
|
+
span {
|
|
13
|
+
position: fixed;
|
|
14
|
+
bottom: 0px;
|
|
15
|
+
left: 0px;
|
|
16
|
+
|
|
17
|
+
width: 0;
|
|
18
|
+
height: 0;
|
|
19
|
+
}
|
|
20
|
+
:host([opened]) section {
|
|
21
|
+
transform: translateX(0);
|
|
22
|
+
}
|
|
23
|
+
:host([right]) span {
|
|
24
|
+
right: 0px;
|
|
25
|
+
left: auto;
|
|
26
|
+
}
|
|
27
|
+
#overlay {
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
color: var(--dile-toast-persistent-color, #fff);
|
|
30
|
+
z-index: var(--dile-toast-persistent-z-index, 999);
|
|
31
|
+
background-color: var(--dile-toast-persistent-background-color, #0e6ff6);
|
|
32
|
+
border-radius: var(--dile-toast-persistent-border-radius, 0);
|
|
33
|
+
width: var(--dile-toast-persistent-width, 300px);
|
|
34
|
+
max-width: var(--dile-toast-persistent-max-width, 300px);
|
|
35
|
+
box-shadow: var(--dile-toast-persistent-box-shadow, 0 0 2px rgba(200, 200, 200, 0.5));
|
|
36
|
+
padding: var(--dile-toast-persistent-padding, 1px);
|
|
37
|
+
display: none;
|
|
38
|
+
position: absolute;
|
|
39
|
+
opacity: 0;
|
|
40
|
+
transition: var(--dile-toast-persistent-transition, ease 0.5s);
|
|
41
|
+
transition-property: transform, opacity;
|
|
42
|
+
transform: translateY(-10px);
|
|
43
|
+
}
|
|
44
|
+
#overlay.opened {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
transform: translateY(0);
|
|
47
|
+
}
|
|
48
|
+
#trigger {
|
|
49
|
+
display: flex;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static get properties() {
|
|
55
|
+
return {
|
|
56
|
+
right: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
reflect: true
|
|
59
|
+
},
|
|
60
|
+
openOnInit: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
constructor() {
|
|
67
|
+
super();
|
|
68
|
+
this.horizontalAlign = 'left';
|
|
69
|
+
this.verticalAlign = 'top';
|
|
70
|
+
this.moveLeft = -10;
|
|
71
|
+
this.moveTop = -16;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
firstUpdated() {
|
|
75
|
+
super.firstUpdated();
|
|
76
|
+
if(this.openOnInit) {
|
|
77
|
+
setTimeout( () => this.open(), 200);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
updated(changedProperties) {
|
|
82
|
+
if(changedProperties.has('right') && this.right !== undefined) {
|
|
83
|
+
this.horizontalAlign = this.right ? 'left' : 'right';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
render() {
|
|
88
|
+
return html`
|
|
89
|
+
<span id="trigger">
|
|
90
|
+
<div
|
|
91
|
+
id="overlay"
|
|
92
|
+
class="${this._overlayClass}"
|
|
93
|
+
>
|
|
94
|
+
<slot></slot>
|
|
95
|
+
</div>
|
|
96
|
+
</span>
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DileTooltip } from './src/DileTooltip';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import '../tooltip.js';
|
|
3
|
+
import '../../icon/icon.js';
|
|
4
|
+
import { infoIcon } from '@dile/icons/index.js';
|
|
5
|
+
|
|
6
|
+
export class DileChipTooltip extends LitElement {
|
|
7
|
+
|
|
8
|
+
static get styles() {
|
|
9
|
+
return css`
|
|
10
|
+
:host {
|
|
11
|
+
display: inline-block;
|
|
12
|
+
--dile-tooltip-width: var(--dile-chip-tooltip-width, 165px);
|
|
13
|
+
--dile-tooltip-time-transition: 0.3s;
|
|
14
|
+
}
|
|
15
|
+
.box {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
.chip {
|
|
20
|
+
font-size: var(--dile-chip-tooltip-font-size, 0.9rem);
|
|
21
|
+
font-weight: bold;
|
|
22
|
+
display: flex;
|
|
23
|
+
padding: var(--dile-chip-tooltip-padding, 0.2rem 0.7rem);
|
|
24
|
+
border-radius: 1rem;
|
|
25
|
+
background-color: var(--dile-chip-tooltip-background-color, #7BB93D);
|
|
26
|
+
color: var(--dile-chip-tooltip-text-color, #fff);
|
|
27
|
+
--dile-icon-color: var(--dile-chip-tooltip-icon-color, #fff);
|
|
28
|
+
--dile-icon-size: var(--dile-chip-tooltip-icon-size, 22px);
|
|
29
|
+
transition: background-color 0.3s ease-in-out;
|
|
30
|
+
}
|
|
31
|
+
.chip:hover {
|
|
32
|
+
background-color: var(--dile-chip-tooltip-hover-background-color, #303030);
|
|
33
|
+
}
|
|
34
|
+
.label {
|
|
35
|
+
display: inline-block;
|
|
36
|
+
position: relative;
|
|
37
|
+
top: 1px;
|
|
38
|
+
margin-right: 0.3rem;
|
|
39
|
+
}
|
|
40
|
+
@media(min-width: 350px) {
|
|
41
|
+
:host {
|
|
42
|
+
--dile-tooltip-width: var(--dile-chip-tooltip-width, 190px);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
@media(min-width: 490px) {
|
|
46
|
+
:host {
|
|
47
|
+
--dile-tooltip-width: var(--dile-chip-tooltip-width, 240px);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static get properties() {
|
|
54
|
+
return {
|
|
55
|
+
label: { type: String },
|
|
56
|
+
message: { type: String },
|
|
57
|
+
position: { type: String },
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
constructor() {
|
|
62
|
+
super();
|
|
63
|
+
this.position = "bottom";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
render() {
|
|
67
|
+
return html`
|
|
68
|
+
<div class="box">
|
|
69
|
+
<dile-tooltip
|
|
70
|
+
tooltip="${this.message}"
|
|
71
|
+
position="${this.position}"
|
|
72
|
+
fadeIn
|
|
73
|
+
|
|
74
|
+
>
|
|
75
|
+
<span class="chip">
|
|
76
|
+
${this.label
|
|
77
|
+
? html`<span class="label">${this.label}</span>`
|
|
78
|
+
: ''
|
|
79
|
+
}
|
|
80
|
+
<dile-icon .icon=${infoIcon} class="info"></dile-icon>
|
|
81
|
+
</span>
|
|
82
|
+
</dile-tooltip>
|
|
83
|
+
</div>
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
}
|