@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,72 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { DileInput } from './DileInput';
|
|
3
|
+
|
|
4
|
+
export class DileInputMoney extends DileInput {
|
|
5
|
+
static styles = [
|
|
6
|
+
DileInput.styles,
|
|
7
|
+
css`
|
|
8
|
+
:host {
|
|
9
|
+
display: block;
|
|
10
|
+
}
|
|
11
|
+
input {
|
|
12
|
+
text-align: var(--dile-input-money-text-align, var(--dile-input-text-align, right));
|
|
13
|
+
}
|
|
14
|
+
`
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
static get properties() {
|
|
18
|
+
return {
|
|
19
|
+
decimalSeparator: { type: String }
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.decimalSeparator = '.';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
doBlur(e) {
|
|
29
|
+
let num = e.target.value;
|
|
30
|
+
if(num.length > 0) {
|
|
31
|
+
num = this.formatMoney(num);
|
|
32
|
+
}
|
|
33
|
+
if(num != e.target.value || this.changed) {
|
|
34
|
+
this.value = num;
|
|
35
|
+
this.emmitChange();
|
|
36
|
+
this.changed = false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
set(value) {
|
|
41
|
+
this.value = value;
|
|
42
|
+
this.doFormat();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
doFormat() {
|
|
46
|
+
this.value = this.formatMoney(this.value.toString());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
formatMoney(num) {
|
|
50
|
+
num = num.replace(this.decimalSeparator, '.');
|
|
51
|
+
num = parseFloat(num);
|
|
52
|
+
if(isNaN(num)) {
|
|
53
|
+
return '0.00';
|
|
54
|
+
} else {
|
|
55
|
+
return num.toFixed(2);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
updated(changedProperties) {
|
|
60
|
+
if(changedProperties.has('value') && this.value) {
|
|
61
|
+
this.changed = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
computeValue(value) {
|
|
66
|
+
if(value) {
|
|
67
|
+
value = value.toString();
|
|
68
|
+
return value.replace('.', this.decimalSeparator);
|
|
69
|
+
}
|
|
70
|
+
return '';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { LitElement, html } from 'lit';
|
|
2
|
+
import { DileInput } from '../../input/index.js';
|
|
3
|
+
import { Mask } from './Mask';
|
|
4
|
+
|
|
5
|
+
export class DileInputNumberMask extends DileInput {
|
|
6
|
+
|
|
7
|
+
static get properties() {
|
|
8
|
+
return {
|
|
9
|
+
mask: { type: String },
|
|
10
|
+
maskedValue: { type: String },
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.mask = '';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
firstUpdated() {
|
|
20
|
+
this.content = '';
|
|
21
|
+
this.maskedValue = '';
|
|
22
|
+
this.createMaskController(this.mask);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
createMaskController(mask) {
|
|
26
|
+
this.maskController = new Mask(mask);
|
|
27
|
+
this.maxChars = this.maskController.getNumberCharactersOnPattern();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
updated(changedProperties) {
|
|
31
|
+
if (changedProperties.has('mask')) {
|
|
32
|
+
this.maskController.setPattern(this.mask);
|
|
33
|
+
this.updateValue();
|
|
34
|
+
}
|
|
35
|
+
if (changedProperties.has('value')) {
|
|
36
|
+
this.content = this.value.slice(0, this.maxChars);
|
|
37
|
+
this.updateValue();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
updateValue() {
|
|
42
|
+
this.maskedValue = this.maskController.maskIt(this.content);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
render() {
|
|
46
|
+
return html`
|
|
47
|
+
<div>
|
|
48
|
+
${this.label
|
|
49
|
+
? html`<label for="textField">${this.label}</label>`
|
|
50
|
+
: ''
|
|
51
|
+
}
|
|
52
|
+
<input
|
|
53
|
+
type="text"
|
|
54
|
+
id="textField"
|
|
55
|
+
name="${this.name}"
|
|
56
|
+
placeholder="${this.placeholder}"
|
|
57
|
+
?disabled="${this.disabled}"
|
|
58
|
+
@keypress="${this._lookForEnter}"
|
|
59
|
+
@keydown="${this.doKeyDown}"
|
|
60
|
+
.value="${this.maskedValue}"
|
|
61
|
+
class="${ this.errored ? 'errored' : '' }">
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
doKeyDown(e) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
if (this.isNumeric(e.key) && this.content.length < this.maxChars) {
|
|
69
|
+
this.content += e.key;
|
|
70
|
+
}
|
|
71
|
+
if (e.keyCode == 8) {
|
|
72
|
+
if (this.content.length > 0) {
|
|
73
|
+
this.content = this.content.substr(0, this.content.length - 1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.updateValue();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
isNumeric(char) {
|
|
80
|
+
return !isNaN(char - parseInt(char));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { DileInput } from './DileInput';
|
|
3
|
+
|
|
4
|
+
export class DileInputPercentage extends DileInput {
|
|
5
|
+
static styles = [
|
|
6
|
+
DileInput.styles,
|
|
7
|
+
css`
|
|
8
|
+
:host {
|
|
9
|
+
display: block;
|
|
10
|
+
}
|
|
11
|
+
`
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
static get properties() {
|
|
15
|
+
return {
|
|
16
|
+
decimalSeparator: { type: String }
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.labelRight = '%';
|
|
23
|
+
this.decimalSeparator = '.';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
doBlur(e) {
|
|
27
|
+
let num = e.target.value;
|
|
28
|
+
if(num.length > 0) {
|
|
29
|
+
num = this.formatFloat(num);
|
|
30
|
+
}
|
|
31
|
+
if(num != e.target.value || this.changed) {
|
|
32
|
+
this.value = num;
|
|
33
|
+
this.emmitChange();
|
|
34
|
+
this.changed = false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
doFormat() {
|
|
39
|
+
this.value = this.formatFloat(this.value);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
formatFloat(num) {
|
|
43
|
+
num = num.replace(this.decimalSeparator, '.');
|
|
44
|
+
num = parseFloat(num);
|
|
45
|
+
return isNaN(num) ? '0' : num;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
updated(changedProperties) {
|
|
49
|
+
if(changedProperties.has('value') && this.value) {
|
|
50
|
+
this.changed = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
computeValue(value) {
|
|
55
|
+
return value.toString().replace('.', this.decimalSeparator);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import '../../icon/icon.js';
|
|
3
|
+
import { searchIcon, clearIcon } from '@dile/icons/index.js';
|
|
4
|
+
|
|
5
|
+
export class DileInputSearch extends LitElement {
|
|
6
|
+
static styles = [
|
|
7
|
+
css`
|
|
8
|
+
:host {
|
|
9
|
+
display: block;
|
|
10
|
+
}
|
|
11
|
+
div {
|
|
12
|
+
display: flex;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
border-radius: var(--dile-input-border-radius, 5px);
|
|
15
|
+
border: var(--dile-input-border-width, 1px) solid var(--dile-input-border-color, #888);
|
|
16
|
+
padding: var(--dile-input-padding, 5px);
|
|
17
|
+
width: var(--dile-input-width, 100%);
|
|
18
|
+
background-color: var(--dile-input-background-color, #fff);
|
|
19
|
+
}
|
|
20
|
+
div:focus-within {
|
|
21
|
+
border-color: var(--dile-input-focus-border-color, #6af);
|
|
22
|
+
}
|
|
23
|
+
input {
|
|
24
|
+
flex-grow: 1;
|
|
25
|
+
border: none;
|
|
26
|
+
outline: none;
|
|
27
|
+
color: var(--dile-input-color, #303030);
|
|
28
|
+
font-size: var(--dile-input-font-size, 1em);
|
|
29
|
+
line-height: var(--dile-input-line-height, 1.5em);
|
|
30
|
+
background-color: var(--dile-input-background-color, #fff);
|
|
31
|
+
}
|
|
32
|
+
input::placeholder {
|
|
33
|
+
color: var(--dile-input-placeholder-color, #ccc);
|
|
34
|
+
}
|
|
35
|
+
dile-icon {
|
|
36
|
+
margin-left: 1px;
|
|
37
|
+
display: flex;
|
|
38
|
+
}
|
|
39
|
+
:host([disabled]) {
|
|
40
|
+
opacity: 0.5;
|
|
41
|
+
}
|
|
42
|
+
.errored {
|
|
43
|
+
border-color: var(--dile-input-error-border-color, #c00);
|
|
44
|
+
}
|
|
45
|
+
`
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
static get properties() {
|
|
49
|
+
return {
|
|
50
|
+
delay: { type: Number },
|
|
51
|
+
placeholder: { type: String },
|
|
52
|
+
value: { type: String },
|
|
53
|
+
disabled: { type: Boolean },
|
|
54
|
+
readOnly: { type: Boolean },
|
|
55
|
+
errored: { type: Boolean },
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
constructor() {
|
|
60
|
+
super();
|
|
61
|
+
this.delay = 300;
|
|
62
|
+
this.timeout = null;
|
|
63
|
+
this.value = '';
|
|
64
|
+
this.readOnly = false;
|
|
65
|
+
this.errored = false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
firstUpdated() {
|
|
69
|
+
this.input = this.shadowRoot.getElementById('elinput');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
render() {
|
|
73
|
+
return html`
|
|
74
|
+
<div class="${this.errored ? "errored" : ""}">
|
|
75
|
+
<input
|
|
76
|
+
id="elinput"
|
|
77
|
+
type="text"
|
|
78
|
+
placeholder="${this.placeholder}"
|
|
79
|
+
@input=${this.inputHandler}
|
|
80
|
+
autocomplete="off"
|
|
81
|
+
.value="${this.value}"
|
|
82
|
+
?disabled="${this.disabled}"
|
|
83
|
+
?readonly="${this.readOnly}"
|
|
84
|
+
>
|
|
85
|
+
<dile-icon
|
|
86
|
+
@click=${this.iconClick}
|
|
87
|
+
.icon="${this.value.length ? clearIcon : searchIcon}"
|
|
88
|
+
></dile-icon>
|
|
89
|
+
</div>
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
inputHandler(e) {
|
|
94
|
+
this.value = e.target.value;
|
|
95
|
+
if (this.timeout) {
|
|
96
|
+
clearTimeout(this.timeout);
|
|
97
|
+
}
|
|
98
|
+
this.timeout = setTimeout(() => {
|
|
99
|
+
this.dispatchSearch(this.value);
|
|
100
|
+
}, this.delay);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
iconClick(e) {
|
|
104
|
+
this.clear();
|
|
105
|
+
this.input.focus();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
dispatchSearch(key) {
|
|
109
|
+
this.dispatchEvent(new CustomEvent('dile-input-search', {
|
|
110
|
+
bubbles: true,
|
|
111
|
+
composed: true,
|
|
112
|
+
detail: {
|
|
113
|
+
keyword: key
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
dispatchClear() {
|
|
119
|
+
this.dispatchEvent(new CustomEvent('dile-input-search-cleared', {
|
|
120
|
+
bubbles: true,
|
|
121
|
+
composed: true,
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
clear() {
|
|
126
|
+
if(this.value.length) {
|
|
127
|
+
this.value = '';
|
|
128
|
+
this.dispatchSearch(this.value);
|
|
129
|
+
this.dispatchClear();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
focus() {
|
|
134
|
+
this.input.focus();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
set(value) {
|
|
138
|
+
if (this.input) {
|
|
139
|
+
this.value = value;
|
|
140
|
+
this.dispatchSearch(value);
|
|
141
|
+
} else {
|
|
142
|
+
setTimeout( () => this.set(value), 200);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class Mask {
|
|
2
|
+
constructor(pattern) {
|
|
3
|
+
this.pattern = pattern;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
setPattern(newPattern) {
|
|
7
|
+
this.pattern = newPattern;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
maskIt(value) {
|
|
11
|
+
let position = 0;
|
|
12
|
+
let masked = '';
|
|
13
|
+
let currentChar = 0;
|
|
14
|
+
while (position < this.pattern.length && currentChar < value.length) {
|
|
15
|
+
if (this.pattern[position] === '0') {
|
|
16
|
+
masked += value[currentChar];
|
|
17
|
+
currentChar++;
|
|
18
|
+
} else {
|
|
19
|
+
masked += this.pattern[position];
|
|
20
|
+
}
|
|
21
|
+
position++;
|
|
22
|
+
}
|
|
23
|
+
return masked;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getNumberCharactersOnPattern() {
|
|
27
|
+
let numberChars = 0;
|
|
28
|
+
for (let i = 0; i < this.pattern.length; i++) {
|
|
29
|
+
if (this.pattern[i] === '0') {
|
|
30
|
+
numberChars++;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return numberChars;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export const messageStyles = css`
|
|
4
|
+
.message span {
|
|
5
|
+
display: block;
|
|
6
|
+
padding-top: var(--dile-input-message-padding-top, 4px);
|
|
7
|
+
font-size: var(--dile-input-message-font-size, 0.875rem);
|
|
8
|
+
color: var(--dile-input-message-color, #888);
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
.errored-msg span {
|
|
12
|
+
color: var(--dile-input-message-error-color, #c00);
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DileMenuHamburger } from './src/DileMenuHamburger.js';
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { html, css, LitElement } from "lit";
|
|
2
|
+
import '../../app-drawer/app-drawer.js';
|
|
3
|
+
import '../../hamburger/hamburger.js';
|
|
4
|
+
|
|
5
|
+
export class DileMenuHamburger extends LitElement {
|
|
6
|
+
static get properties() {
|
|
7
|
+
return {
|
|
8
|
+
direction: {
|
|
9
|
+
type: String,
|
|
10
|
+
reflect: true
|
|
11
|
+
},
|
|
12
|
+
opened: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
reflect: true
|
|
15
|
+
},
|
|
16
|
+
hamburgerAlwaysVisible: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
reflect: true
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static get styles() {
|
|
24
|
+
return css`
|
|
25
|
+
:host {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
:host([hamburgerAlwaysVisible]) dile-hamburger {
|
|
30
|
+
position: relative;
|
|
31
|
+
z-index: 100020;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
this.direction = 'top';
|
|
39
|
+
this.opened = false;
|
|
40
|
+
this.hamburgerAlwaysVisible = false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
firstUpdated() {
|
|
44
|
+
this.drawer = this.shadowRoot.getElementById('drawer');
|
|
45
|
+
let menu = this.querySelector('[dile-cloak]');
|
|
46
|
+
if(menu) {
|
|
47
|
+
menu.removeAttribute('dile-cloak');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
updated(changedProperties) {
|
|
52
|
+
if(changedProperties.has('opened')) {
|
|
53
|
+
let theEvent = this.opened ? 'dile-menu-hamburger-opened' : 'dile-menu-hamburger-closed';
|
|
54
|
+
this.dispatchEvent(new CustomEvent(theEvent, {
|
|
55
|
+
bubbles: true,
|
|
56
|
+
composed: true,
|
|
57
|
+
detail: {
|
|
58
|
+
opened: this.opened,
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
render() {
|
|
65
|
+
return html`
|
|
66
|
+
<dile-hamburger @click="${this.toggle}" ?active="${this.opened}"></dile-hamburger>
|
|
67
|
+
<dile-app-drawer
|
|
68
|
+
id="drawer"
|
|
69
|
+
?opened="${this.opened}"
|
|
70
|
+
direction="${this.direction}"
|
|
71
|
+
@dile-app-drawer-closed="${this.close}"
|
|
72
|
+
>
|
|
73
|
+
<slot name="menu"></slot>
|
|
74
|
+
</dile-app-drawer>
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
toggle() {
|
|
79
|
+
this.opened = ! this.opened;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
open() {
|
|
83
|
+
this.opened = true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
close() {
|
|
87
|
+
this.opened = false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DileMenuOverlay } from './src/DileMenuOverlay.js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { DileOverlay } from "../../../mixins/overlay/index.js"
|
|
3
|
+
import { DileCloseDocumentClick } from "../../../mixins/close-document-click";
|
|
4
|
+
|
|
5
|
+
export class DileMenuOverlay extends DileOverlay(DileCloseDocumentClick(LitElement)) {
|
|
6
|
+
static get styles() {
|
|
7
|
+
return css`
|
|
8
|
+
:host {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
position: relative;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
#overlay {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
color: var(--dile-menu-overlay-color, #303030);
|
|
16
|
+
z-index: var(--dile-menu-overlay-z-index, 999);
|
|
17
|
+
background-color: var(--dile-menu-overlay-background-color, #fff);
|
|
18
|
+
border-radius: var(--dile-menu-overlay-border-radius, 5px);
|
|
19
|
+
width: var(--dile-menu-overlay-width, 280px);
|
|
20
|
+
max-width: var(--dile-menu-overlay-max-width, 300px);
|
|
21
|
+
box-shadow: var(--dile-menu-overlay-box-shadow, 0 0 20px rgba(102, 102, 102, 0.5));
|
|
22
|
+
padding: var(--dile-menu-overlay-padding, 1px);
|
|
23
|
+
display: none;
|
|
24
|
+
position: absolute;
|
|
25
|
+
opacity: 0;
|
|
26
|
+
transition: var(--dile-menu-overlay-transition, ease 0.5s);
|
|
27
|
+
transition-property: transform, opacity;
|
|
28
|
+
transform: translateY(-10px);
|
|
29
|
+
}
|
|
30
|
+
#overlay.opened {
|
|
31
|
+
opacity: 1;
|
|
32
|
+
transform: translateY(0);
|
|
33
|
+
}
|
|
34
|
+
#trigger {
|
|
35
|
+
display: flex;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static get properties() {
|
|
41
|
+
return {
|
|
42
|
+
closeOnClickInside: { type: Boolean },
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
constructor() {
|
|
47
|
+
super();
|
|
48
|
+
this.closeOnClickInside = false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
render() {
|
|
52
|
+
return html`
|
|
53
|
+
<span @click="${this.toggle}" id="trigger">
|
|
54
|
+
<slot name="trigger"></slot>
|
|
55
|
+
</span>
|
|
56
|
+
<div
|
|
57
|
+
id="overlay"
|
|
58
|
+
class="${this._overlayClass}"
|
|
59
|
+
@click="${this.clickHandler}"
|
|
60
|
+
>
|
|
61
|
+
<slot name="content"></slot>
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
clickHandler(e) {
|
|
67
|
+
if(! this.closeOnClickInside) {
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DileMessage } from './src/DileMessage.js';
|