blip-ds 1.201.0 → 1.201.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/dist/blip-ds/bds-input-chips.entry.js +81 -19
- package/dist/blip-ds/bds-input-chips.system.entry.js +1 -1
- package/dist/blip-ds/blip-ds.esm.js +1 -1
- package/dist/blip-ds/blip-ds.system.js +1 -1
- package/dist/blip-ds/p-1b6a0428.system.entry.js +1 -0
- package/dist/blip-ds/p-985db29e.entry.js +1 -0
- package/dist/blip-ds/p-9f0f4014.entry.js +1 -0
- package/dist/blip-ds/p-a4ac8b27.system.js +1 -1
- package/dist/blip-ds/p-baae2137.entry.js +1 -0
- package/dist/blip-ds/p-d4db97e2.system.entry.js +1 -0
- package/dist/blip-ds/p-e864be08.system.entry.js +1 -0
- package/dist/cjs/{bds-datepicker-period_2.cjs.entry.js → bds-datepicker-period_3.cjs.entry.js} +301 -0
- package/dist/cjs/bds-input-chips.cjs.entry.js +81 -19
- package/dist/cjs/blip-ds.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/input-chips/input-chips.css +268 -0
- package/dist/collection/components/input-chips/input-chips.js +125 -21
- package/dist/esm/{bds-datepicker-period_2.entry.js → bds-datepicker-period_3.entry.js} +302 -2
- package/dist/esm/bds-input-chips.entry.js +81 -19
- package/dist/esm/blip-ds.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/bds-chip-clickable.entry.js +1 -0
- package/dist/esm-es5/bds-datepicker-period_3.entry.js +1 -0
- package/dist/esm-es5/bds-input-chips.entry.js +1 -1
- package/dist/esm-es5/blip-ds.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/types/components/input-chips/input-chips.d.ts +27 -2
- package/dist/types/components.d.ts +8 -0
- package/package.json +1 -1
- package/dist/blip-ds/p-10838d95.system.entry.js +0 -1
- package/dist/blip-ds/p-10b51cad.entry.js +0 -1
- package/dist/blip-ds/p-1243ceee.system.entry.js +0 -1
- package/dist/blip-ds/p-211e7782.system.entry.js +0 -1
- package/dist/blip-ds/p-a4c3aa6b.entry.js +0 -1
- package/dist/blip-ds/p-f3b2d52a.entry.js +0 -1
- package/dist/cjs/bds-chip-clickable_2.cjs.entry.js +0 -391
- package/dist/esm/bds-chip-clickable_2.entry.js +0 -386
- package/dist/esm-es5/bds-chip-clickable_2.entry.js +0 -1
- package/dist/esm-es5/bds-datepicker-period_2.entry.js +0 -1
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-5e324e44.js');
|
|
6
|
-
const validations = require('./validations-431d75ca.js');
|
|
7
|
-
|
|
8
|
-
const chipClickableCss = ":host{display:block;height:-webkit-max-content;height:-moz-max-content;height:max-content;border-radius:4px;-webkit-box-sizing:border-box;box-sizing:border-box}:host .chip_clickable{display:-ms-flexbox;display:flex;min-width:32px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;height:32px;border-radius:16px;padding:2px 4px;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-pack:center;justify-content:center;position:relative;z-index:0}:host .chip_clickable--hide{display:none;padding:0;border:none}:host .chip_clickable .chip_focus:focus{position:absolute;width:100%;height:100%;padding:2px;border-radius:4px;outline:#c226fb solid 2px}:host .chip_clickable--click{cursor:pointer}:host .chip_clickable--click .chip_darker{opacity:0;position:absolute;width:100%;height:100%;border-radius:inherit;z-index:1;-webkit-backdrop-filter:brightness(1);backdrop-filter:brightness(1);-webkit-box-sizing:border-box;box-sizing:border-box}:host .chip_clickable--click:hover .chip_darker{opacity:1;-webkit-backdrop-filter:brightness(0.9);backdrop-filter:brightness(0.9)}:host .chip_clickable--click:active .chip_darker{opacity:1;-webkit-backdrop-filter:brightness(0.8);backdrop-filter:brightness(0.8)}:host .chip_clickable--disabled{cursor:default;background-color:#f3f6fa}:host .chip_clickable--disabled .chip_clickable--icon{color:#505f79}:host .chip_clickable--disabled .chip_clickable--text{color:#505f79}:host .chip_clickable--disabled .chip_clickable--close{cursor:default}:host .chip_clickable--icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:20px;padding-left:4px;color:#202c44;z-index:2}:host .chip_clickable--close{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:20px;padding-right:4px;mix-blend-mode:hard-light;color:#202c44;opacity:0.7;z-index:2;position:relative;cursor:pointer}:host .chip_clickable--close .close_focus:focus{position:absolute;width:100%;height:100%;left:-2px;border-radius:4px;outline:#c226fb solid 2px}:host .chip_clickable--text{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:-webkit-max-content;width:-moz-max-content;width:max-content;height:20px;margin:0 8px;z-index:2;color:#202c44;font-family:\"Nunito Sans\", \"Tahoma\", \"Helvetica\", \"Arial\", sans-serif}:host .chip_clickable--tall{height:40px;border-radius:24px}:host .chip_clickable--default{background-color:#b3d4ff}:host .chip_clickable--info{background-color:#80e3eb}:host .chip_clickable--success{background-color:#90e6bc}:host .chip_clickable--warning{background-color:#fff6a8}:host .chip_clickable--danger{background-color:#ffa5a5}:host .chip_clickable--outline{background-color:#ffffff;border:1px solid #b9cbd3}:host .chip_clickable:focus-visible{outline:none}";
|
|
9
|
-
|
|
10
|
-
const ChipClickable = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.chipClickableClose = index.createEvent(this, "chipClickableClose", 7);
|
|
14
|
-
this.chipClickableClick = index.createEvent(this, "chipClickableClick", 7);
|
|
15
|
-
this.visible = true;
|
|
16
|
-
/**
|
|
17
|
-
* used for change the color. Uses one of them.
|
|
18
|
-
*/
|
|
19
|
-
this.color = 'default';
|
|
20
|
-
/**
|
|
21
|
-
* used for change the size chip. Uses one of them.
|
|
22
|
-
*/
|
|
23
|
-
this.size = 'standard';
|
|
24
|
-
/**
|
|
25
|
-
* it makes the chip clickable.
|
|
26
|
-
*/
|
|
27
|
-
this.clickable = false;
|
|
28
|
-
/**
|
|
29
|
-
* used for delete the chip.
|
|
30
|
-
*/
|
|
31
|
-
this.close = false;
|
|
32
|
-
/**
|
|
33
|
-
* the chip gone stay disabled while this prop be true.
|
|
34
|
-
*/
|
|
35
|
-
this.disabled = false;
|
|
36
|
-
/**
|
|
37
|
-
* Data test is the prop to specifically test the component action object.
|
|
38
|
-
*/
|
|
39
|
-
this.dataTest = null;
|
|
40
|
-
}
|
|
41
|
-
handleClickKey(event) {
|
|
42
|
-
if ((event.key === 'Enter' || event.key === ' ') && !this.disabled) {
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
this.chipClickableClick.emit();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
handleClick(event) {
|
|
48
|
-
if (!this.disabled) {
|
|
49
|
-
event.preventDefault();
|
|
50
|
-
this.chipClickableClick.emit();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
handleCloseChip(event) {
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
this.chipClickableClose.emit({ id: this.element.id });
|
|
56
|
-
}
|
|
57
|
-
handleCloseKey(event) {
|
|
58
|
-
if ((event.key === 'Enter' || event.key === ' ') && !this.disabled) {
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
this.chipClickableClose.emit({ id: this.element.id });
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
getSizeAvatarChip() {
|
|
64
|
-
if (this.size === 'tall') {
|
|
65
|
-
return 'extra-small';
|
|
66
|
-
}
|
|
67
|
-
else
|
|
68
|
-
return 'micro';
|
|
69
|
-
}
|
|
70
|
-
getSizeIconChip() {
|
|
71
|
-
if (this.size === 'tall') {
|
|
72
|
-
return 'medium';
|
|
73
|
-
}
|
|
74
|
-
else
|
|
75
|
-
return 'x-small';
|
|
76
|
-
}
|
|
77
|
-
render() {
|
|
78
|
-
return (index.h(index.Host, null, index.h("div", { class: {
|
|
79
|
-
chip_clickable: true,
|
|
80
|
-
[`chip_clickable--${this.color}`]: !this.disabled,
|
|
81
|
-
[`chip_clickable--${this.size}`]: true,
|
|
82
|
-
'chip_clickable--hide': !this.visible,
|
|
83
|
-
'chip_clickable--click': this.clickable,
|
|
84
|
-
'chip_clickable--disabled': this.disabled,
|
|
85
|
-
}, onClick: this.handleClick.bind(this), "data-test": this.dataTest }, this.clickable && !this.disabled && (index.h("div", { class: "chip_focus", onKeyDown: this.handleClickKey.bind(this), tabindex: "0" })), this.clickable && !this.disabled && index.h("div", { class: "chip_darker" }), this.icon && !this.avatar && (index.h("div", { class: "chip_clickable--icon" }, index.h("bds-icon", { size: this.getSizeIconChip(), name: this.icon }))), this.avatar && (index.h("div", { class: "chip_clickable--avatar" }, index.h("bds-avatar", { size: this.getSizeAvatarChip(), thumbnail: this.avatar }))), index.h("bds-typo", { class: "chip_clickable--text", variant: "fs-12", bold: "bold" }, index.h("slot", null)), this.close && (index.h("div", { class: "chip_clickable--close", onClick: this.handleCloseChip.bind(this) }, !this.disabled && (index.h("div", { class: "close_focus", onKeyDown: this.handleCloseKey.bind(this), tabindex: "0" })), index.h("bds-icon", { size: "x-small", theme: "solid", name: "error" }))))));
|
|
86
|
-
}
|
|
87
|
-
get element() { return index.getElement(this); }
|
|
88
|
-
};
|
|
89
|
-
ChipClickable.style = chipClickableCss;
|
|
90
|
-
|
|
91
|
-
const inputCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%}:host input,:host textarea{-webkit-box-shadow:inherit;box-shadow:inherit}:host input::-webkit-input-placeholder,:host textarea::-webkit-input-placeholder{color:#b9cbd3;opacity:1}:host input::-moz-placeholder,:host textarea::-moz-placeholder{color:#b9cbd3;opacity:1}:host input:-ms-input-placeholder,:host textarea:-ms-input-placeholder{color:#b9cbd3;opacity:1}:host input::-ms-input-placeholder,:host textarea::-ms-input-placeholder{color:#b9cbd3;opacity:1}:host input::placeholder,:host textarea::placeholder{color:#b9cbd3;opacity:1}:host input::-webkit-input-placeholder,:host textarea::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.input{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:8px 4px 9px 12px;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;background:#ffffff}.input--state-primary{border:1px solid #d2dfe6;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary:hover{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.input--pressed{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4);box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4)}.input--state-primary .input__icon{color:#3f7de8;background-color:#e8f2ff}.input--state-primary .input__container__label{color:#8ca0b3}.input--state-primary .input__container__label--pressed{color:#3f7de8}.input--state-primary .input__container__text{caret-color:#3f7de8;color:#202c44}.input--state-danger{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger:hover{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.input--pressed{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #ffa5a5;box-shadow:0 0 0 2px #ffa5a5}.input--state-danger .input__icon{color:#ff4c4c;background-color:#ffa5a5}.input--state-danger .input__container__label{color:#8ca0b3}.input--state-danger .input__container__label--pressed{color:#ff4c4c}.input--state-danger .input__container__text{caret-color:#ff4c4c;color:#202c44}.input--state-disabled{cursor:not-allowed;border:1px solid #e7edf4;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;background:#f3f6fa}.input--state-disabled:hover{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;border:1px solid #e7edf4;box-sizing:border-box;border-radius:8px}.input--state-disabled.input--pressed{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #e7edf4;box-shadow:0 0 0 2px #e7edf4}.input--state-disabled .input__icon{color:#b9cbd3;background-color:#f8fbfb}.input--state-disabled .input__container__label{color:#b9cbd3}.input--state-disabled .input__container__label--pressed{color:#b9cbd3}.input--state-disabled .input__container__text{caret-color:#b9cbd3;color:#b9cbd3}.input--label{padding:7px 4px 8px 12px}.input__icon{cursor:inherit;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;margin-right:8px;padding:2.5px}.input__icon--large{padding:4px}.input__container{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%}.input__container__wrapper{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.input__container__wrapper__chips{display:inline;max-height:100px;overflow:auto}.input__container__wrapper__chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__wrapper__chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__container__label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input__container__text{display:inline-block;margin:0;border:0;padding:0;width:auto;vertical-align:middle;white-space:normal;line-height:inherit;background:none;color:inherit;font-size:inherit;font-family:inherit;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;font-family:\"Nunito Sans\", \"Tahoma\", \"Helvetica\", \"Arial\", sans-serif;font-size:0.875rem;line-height:150%;resize:none;cursor:inherit}.input__container__text:focus{outline:0}.input__container__text::-webkit-file-upload-button{padding:0;border:0;background:none}.input__container__text:focus{outline:0}.input__container__text[type=checkbox],.input__container__text[type=radio]{width:13px;height:13px}.input__container__text[type=search]{-webkit-appearance:textfield;-webkit-box-sizing:content-box}::-webkit-search-decoration{display:none}.input__container__text[type=reset],.input__container__text[type=button],.input__container__text[type=submit]{overflow:visible}.input__container__text::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__text::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__message{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;height:20px;margin:3.7px 2.5px;-webkit-transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);color:#8ca0b3;word-break:break-word;height:auto;min-height:20px}.input__message bds-typo{margin-top:0px;-ms-flex-item-align:self-start;align-self:self-start}.input__message__icon{display:-ms-flexbox;display:flex;padding-right:4px;margin-top:0px;padding-top:2px}.input__message--danger{color:#ff4c4c}.input__container{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%}.input__container__label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input__container__wrapper{display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.input__container__text{display:inline-block;margin:0;border:0;padding:0;width:auto;vertical-align:middle;white-space:normal;line-height:inherit;background:none;color:inherit;font-size:inherit;font-family:inherit;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;font-family:\"Nunito Sans\", \"Tahoma\", \"Helvetica\", \"Arial\", sans-serif;font-size:0.875rem;line-height:150%;width:100%;resize:none;cursor:inherit}.input__container__text:focus{outline:0}.input__container__text::-webkit-file-upload-button{padding:0;border:0;background:none}.input__container__text:focus{outline:0}.input__container__text[type=checkbox],.input__container__text[type=radio]{width:13px;height:13px}.input__container__text[type=search]{-webkit-appearance:textfield;-webkit-box-sizing:content-box}::-webkit-search-decoration{display:none}.input__container__text[type=reset],.input__container__text[type=button],.input__container__text[type=submit]{overflow:visible}.input__container__text__chips{width:auto;min-width:216px;max-width:216px}";
|
|
92
|
-
|
|
93
|
-
const Input = class {
|
|
94
|
-
constructor(hostRef) {
|
|
95
|
-
index.registerInstance(this, hostRef);
|
|
96
|
-
this.bdsChange = index.createEvent(this, "bdsChange", 7);
|
|
97
|
-
this.bdsInput = index.createEvent(this, "bdsInput", 7);
|
|
98
|
-
this.bdsOnBlur = index.createEvent(this, "bdsOnBlur", 7);
|
|
99
|
-
this.bdsFocus = index.createEvent(this, "bdsFocus", 7);
|
|
100
|
-
this.bdsSubmit = index.createEvent(this, "bdsSubmit", 7);
|
|
101
|
-
this.bdsKeyDownBackspace = index.createEvent(this, "bdsKeyDownBackspace", 7);
|
|
102
|
-
/**
|
|
103
|
-
* Conditions the element to say whether it is pressed or not, to add styles.
|
|
104
|
-
*/
|
|
105
|
-
this.isPressed = false;
|
|
106
|
-
/**
|
|
107
|
-
* Indicates if the input is password, adding the eye icon.
|
|
108
|
-
*/
|
|
109
|
-
this.isPassword = false;
|
|
110
|
-
/**
|
|
111
|
-
* Used to set the error message setted by the internal validators
|
|
112
|
-
*/
|
|
113
|
-
this.validationMesage = '';
|
|
114
|
-
/**
|
|
115
|
-
* Used to set the danger behavior by the internal validators
|
|
116
|
-
*/
|
|
117
|
-
this.validationDanger = false;
|
|
118
|
-
/**
|
|
119
|
-
* Input Name
|
|
120
|
-
*/
|
|
121
|
-
this.inputName = '';
|
|
122
|
-
/**
|
|
123
|
-
* Input type. Can be one of: "text", "password", "number" or "email".
|
|
124
|
-
*/
|
|
125
|
-
this.type = 'text';
|
|
126
|
-
/**
|
|
127
|
-
* label in input, with he the input size increases.
|
|
128
|
-
*/
|
|
129
|
-
this.label = '';
|
|
130
|
-
/**
|
|
131
|
-
* A tip for the user who can enter no controls.
|
|
132
|
-
*/
|
|
133
|
-
this.placeholder = '';
|
|
134
|
-
/**
|
|
135
|
-
* Capitalizes every word's second character.
|
|
136
|
-
*/
|
|
137
|
-
this.autoCapitalize = 'off';
|
|
138
|
-
/**
|
|
139
|
-
* Hint for form autofill feature
|
|
140
|
-
*/
|
|
141
|
-
this.autoComplete = 'off';
|
|
142
|
-
/**
|
|
143
|
-
* If `true`, the user cannot modify the value.
|
|
144
|
-
*/
|
|
145
|
-
this.readonly = false;
|
|
146
|
-
/**
|
|
147
|
-
* Indicated to pass a help the user in complex filling.
|
|
148
|
-
*/
|
|
149
|
-
this.helperMessage = '';
|
|
150
|
-
/**
|
|
151
|
-
* Indicated to pass an feeback to user.
|
|
152
|
-
*/
|
|
153
|
-
this.errorMessage = '';
|
|
154
|
-
/**
|
|
155
|
-
* used for add icon in input left. Uses the bds-icon component.
|
|
156
|
-
*/
|
|
157
|
-
this.icon = '';
|
|
158
|
-
/**
|
|
159
|
-
* Disabled input.
|
|
160
|
-
*/
|
|
161
|
-
this.disabled = false;
|
|
162
|
-
/**
|
|
163
|
-
* Add state danger on input, use for use feedback.
|
|
164
|
-
*/
|
|
165
|
-
this.danger = false;
|
|
166
|
-
/**
|
|
167
|
-
* The value of the input.
|
|
168
|
-
*/
|
|
169
|
-
this.value = '';
|
|
170
|
-
/**
|
|
171
|
-
* Passing true to display a counter of available size, it is necessary to
|
|
172
|
-
* pass another maxlength property.
|
|
173
|
-
*/
|
|
174
|
-
this.counterLength = false;
|
|
175
|
-
/**
|
|
176
|
-
* Make it possible to pass the base values to the warning level and exclude,
|
|
177
|
-
* using the values between min and max.
|
|
178
|
-
*/
|
|
179
|
-
this.counterLengthRule = null;
|
|
180
|
-
/**
|
|
181
|
-
* If `true`, the user cannot modify the value.
|
|
182
|
-
*/
|
|
183
|
-
this.isSubmit = false;
|
|
184
|
-
/**
|
|
185
|
-
* if `true` input switched to textarea
|
|
186
|
-
*/
|
|
187
|
-
this.isTextarea = false;
|
|
188
|
-
/**
|
|
189
|
-
* The rows and cols attributes allow you to specify an exact size for the <textarea> to get. Setting this is a good idea for consistency, as the browser defaults may differ.
|
|
190
|
-
*/
|
|
191
|
-
this.rows = 1;
|
|
192
|
-
/**
|
|
193
|
-
* The rows and cols attributes allow you to specify an exact size for the <textarea> to get. Setting this is a good idea for consistency, as the browser defaults may differ.
|
|
194
|
-
*/
|
|
195
|
-
this.cols = 0;
|
|
196
|
-
/**
|
|
197
|
-
* Id to support Cypress.
|
|
198
|
-
*/
|
|
199
|
-
this.dataTest = null;
|
|
200
|
-
this.keyPressWrapper = (event) => {
|
|
201
|
-
switch (event.key) {
|
|
202
|
-
case 'Enter':
|
|
203
|
-
this.bdsSubmit.emit({ event, value: this.value });
|
|
204
|
-
if (this.isSubmit) {
|
|
205
|
-
this.clearTextInput();
|
|
206
|
-
event.preventDefault();
|
|
207
|
-
}
|
|
208
|
-
break;
|
|
209
|
-
case 'Backspace' :
|
|
210
|
-
this.bdsKeyDownBackspace.emit({ event, value: this.value });
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
this.onInput = (ev) => {
|
|
215
|
-
this.onBdsInputValidations();
|
|
216
|
-
const input = ev.target;
|
|
217
|
-
if (input) {
|
|
218
|
-
this.value = input.value || '';
|
|
219
|
-
}
|
|
220
|
-
this.bdsInput.emit(ev);
|
|
221
|
-
};
|
|
222
|
-
this.onBlur = () => {
|
|
223
|
-
this.onBlurValidations();
|
|
224
|
-
this.isPressed = false;
|
|
225
|
-
this.bdsOnBlur.emit();
|
|
226
|
-
};
|
|
227
|
-
this.onFocus = () => {
|
|
228
|
-
this.isPressed = true;
|
|
229
|
-
this.bdsFocus.emit();
|
|
230
|
-
};
|
|
231
|
-
this.onClickWrapper = () => {
|
|
232
|
-
this.onFocus();
|
|
233
|
-
if (this.nativeInput) {
|
|
234
|
-
this.nativeInput.focus();
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
this.clearTextInput = (ev) => {
|
|
238
|
-
if (!this.readonly && !this.disabled && ev) {
|
|
239
|
-
ev.preventDefault();
|
|
240
|
-
ev.stopPropagation();
|
|
241
|
-
}
|
|
242
|
-
this.value = '';
|
|
243
|
-
/**
|
|
244
|
-
* This is needed for clearOnEdit
|
|
245
|
-
* Otherwise the value will not be cleared
|
|
246
|
-
* if user is inside the input
|
|
247
|
-
*/
|
|
248
|
-
if (this.nativeInput) {
|
|
249
|
-
this.nativeInput.value = '';
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Update the native input element when the value changes
|
|
255
|
-
*/
|
|
256
|
-
valueChanged() {
|
|
257
|
-
this.bdsChange.emit({ value: this.value == null ? this.value : this.value.toString() });
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Sets focus on the specified `ion-input`. Use this method instead of the global
|
|
261
|
-
* `input.focus()`.
|
|
262
|
-
*/
|
|
263
|
-
async setFocus() {
|
|
264
|
-
this.onClickWrapper();
|
|
265
|
-
}
|
|
266
|
-
async removeFocus() {
|
|
267
|
-
this.onBlur();
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Returns the native `<input>` element used under the hood.
|
|
271
|
-
*/
|
|
272
|
-
async getInputElement() {
|
|
273
|
-
return this.nativeInput;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Return the validity of the input.
|
|
277
|
-
*/
|
|
278
|
-
async isValid() {
|
|
279
|
-
return this.nativeInput.validity.valid;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Return the validity of the input.
|
|
283
|
-
*/
|
|
284
|
-
async clear() {
|
|
285
|
-
this.value = '';
|
|
286
|
-
}
|
|
287
|
-
renderIcon() {
|
|
288
|
-
return (this.icon && (index.h("div", { class: {
|
|
289
|
-
input__icon: true,
|
|
290
|
-
'input__icon--large': !!this.label,
|
|
291
|
-
} }, index.h("bds-icon", { size: this.label ? 'medium' : 'small', name: this.icon, color: "inherit" }))));
|
|
292
|
-
}
|
|
293
|
-
renderLabel() {
|
|
294
|
-
return (this.label && (index.h("label", { class: {
|
|
295
|
-
input__container__label: true,
|
|
296
|
-
'input__container__label--pressed': this.isPressed && !this.disabled,
|
|
297
|
-
} }, index.h("bds-typo", { variant: "fs-12", bold: "bold" }, this.label))));
|
|
298
|
-
}
|
|
299
|
-
renderMessage() {
|
|
300
|
-
const icon = this.danger ? 'error' : 'info';
|
|
301
|
-
let message = this.danger ? this.errorMessage : this.helperMessage;
|
|
302
|
-
if (!message && this.validationDanger)
|
|
303
|
-
message = this.validationMesage;
|
|
304
|
-
const styles = this.danger || this.validationDanger ? 'input__message input__message--danger' : 'input__message';
|
|
305
|
-
if (message) {
|
|
306
|
-
return (index.h("div", { class: styles, part: "input__message" }, index.h("div", { class: "input__message__icon" }, index.h("bds-icon", { size: "x-small", name: icon, theme: "solid", color: "inherit" })), index.h("bds-typo", { variant: "fs-12" }, message)));
|
|
307
|
-
}
|
|
308
|
-
return undefined;
|
|
309
|
-
}
|
|
310
|
-
onBlurValidations() {
|
|
311
|
-
this.required && this.requiredValidation();
|
|
312
|
-
(this.minlength || this.maxlength) && this.lengthValidation();
|
|
313
|
-
(this.min || this.max) && this.minMaxValidation();
|
|
314
|
-
this.checkValidity();
|
|
315
|
-
}
|
|
316
|
-
onBdsInputValidations() {
|
|
317
|
-
this.type === 'email' && this.emailValidation();
|
|
318
|
-
this.type === 'phonenumber' && this.numberValidation();
|
|
319
|
-
this.checkValidity();
|
|
320
|
-
}
|
|
321
|
-
requiredValidation() {
|
|
322
|
-
if (this.nativeInput.validity.valueMissing) {
|
|
323
|
-
this.validationMesage = this.requiredErrorMessage;
|
|
324
|
-
this.validationDanger = true;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
lengthValidation() {
|
|
328
|
-
if (this.nativeInput.validity.tooShort) {
|
|
329
|
-
this.validationMesage = this.minlengthErrorMessage;
|
|
330
|
-
this.validationDanger = true;
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
if (this.nativeInput.validity.tooLong) {
|
|
334
|
-
this.validationDanger = true;
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
minMaxValidation() {
|
|
339
|
-
if (this.nativeInput.validity.rangeUnderflow) {
|
|
340
|
-
this.validationMesage = this.minErrorMessage;
|
|
341
|
-
this.validationDanger = true;
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
if (this.nativeInput.validity.rangeOverflow) {
|
|
345
|
-
this.validationMesage = this.maxErrorMessage;
|
|
346
|
-
this.validationDanger = true;
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
emailValidation() {
|
|
351
|
-
if (validations.emailValidation(this.nativeInput.value)) {
|
|
352
|
-
this.validationMesage = this.emailErrorMessage;
|
|
353
|
-
this.validationDanger = true;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
numberValidation() {
|
|
357
|
-
if (validations.numberValidation(this.nativeInput.value)) {
|
|
358
|
-
this.validationMesage = this.numberErrorMessage;
|
|
359
|
-
this.validationDanger = true;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
checkValidity() {
|
|
363
|
-
if (this.nativeInput.validity.valid) {
|
|
364
|
-
this.validationDanger = false;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
componentDidUpdate() {
|
|
368
|
-
if (this.nativeInput && this.value != this.nativeInput.value) {
|
|
369
|
-
this.nativeInput.value = this.value;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
render() {
|
|
373
|
-
const isPressed = this.isPressed && !this.disabled;
|
|
374
|
-
const Element = this.isTextarea ? 'textarea' : 'input';
|
|
375
|
-
return (index.h(index.Host, { "aria-disabled": this.disabled ? 'true' : null }, index.h("div", { class: {
|
|
376
|
-
input: true,
|
|
377
|
-
'input--state-primary': !this.danger && !this.validationDanger,
|
|
378
|
-
'input--state-danger': this.danger || this.validationDanger,
|
|
379
|
-
'input--state-disabled': this.disabled,
|
|
380
|
-
'input--label': !!this.label,
|
|
381
|
-
'input--pressed': isPressed,
|
|
382
|
-
}, onClick: this.onClickWrapper, onKeyDown: this.keyPressWrapper, part: "input-container" }, this.renderIcon(), index.h("slot", { name: "input-left" }), index.h("div", { class: "input__container" }, this.renderLabel(), index.h("div", { class: { input__container__wrapper: !this.chips, input__container__wrapper__chips: this.chips } }, index.h("slot", { name: "inside-input-left" }), index.h(Element, { class: { input__container__text: true, input__container__text__chips: this.chips }, ref: (input) => (this.nativeInput = input), rows: this.rows, cols: this.cols, autocapitalize: this.autoCapitalize, autocomplete: this.autoComplete, disabled: this.disabled, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, name: this.inputName, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, readOnly: this.readonly, type: this.type, value: this.value, pattern: this.pattern, required: this.required, part: "input", "data-test": this.dataTest }))), this.counterLength && (index.h("bds-counter-text", Object.assign({ length: this.value.length, max: this.maxlength, active: isPressed }, this.counterLengthRule))), index.h("slot", { name: "input-right" })), this.renderMessage()));
|
|
383
|
-
}
|
|
384
|
-
static get watchers() { return {
|
|
385
|
-
"value": ["valueChanged"]
|
|
386
|
-
}; }
|
|
387
|
-
};
|
|
388
|
-
Input.style = inputCss;
|
|
389
|
-
|
|
390
|
-
exports.bds_chip_clickable = ChipClickable;
|
|
391
|
-
exports.bds_input = Input;
|