@yoobic/yobi 8.2.0-17 → 8.2.0-18

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.
Files changed (35) hide show
  1. package/dist/cjs/design-system.cjs.js +1 -1
  2. package/dist/cjs/{form-choice-helpers-e5394fc2.js → form-choice-helpers-da1c35a3.js} +4 -4
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/yoo-form-choice-button.cjs.entry.js +1 -1
  5. package/dist/cjs/yoo-form-choice-card.cjs.entry.js +1 -1
  6. package/dist/cjs/yoo-form-choice-chat.cjs.entry.js +1 -1
  7. package/dist/cjs/yoo-form-choice-image.cjs.entry.js +1 -1
  8. package/dist/cjs/yoo-form-choice-radio.cjs.entry.js +1 -1
  9. package/dist/cjs/yoo-form-input.cjs.entry.js +27 -23
  10. package/dist/cjs/yoo-form-multi-input.cjs.entry.js +4 -3
  11. package/dist/collection/components/form/form-choice/form-choice-helpers.js +4 -4
  12. package/dist/collection/components/form/form-input/form-input.js +46 -24
  13. package/dist/collection/components/form/form-multi-input/form-multi-input.js +4 -3
  14. package/dist/design-system/design-system.esm.js +1 -1
  15. package/dist/design-system/{form-choice-helpers-62cf0a50.js → form-choice-helpers-7f7bf83b.js} +4 -4
  16. package/dist/design-system/yoo-form-choice-button.entry.js +1 -1
  17. package/dist/design-system/yoo-form-choice-card.entry.js +1 -1
  18. package/dist/design-system/yoo-form-choice-chat.entry.js +1 -1
  19. package/dist/design-system/yoo-form-choice-image.entry.js +1 -1
  20. package/dist/design-system/yoo-form-choice-radio.entry.js +1 -1
  21. package/dist/design-system/yoo-form-input.entry.js +28 -24
  22. package/dist/design-system/yoo-form-multi-input.entry.js +5 -4
  23. package/dist/esm/design-system.js +1 -1
  24. package/dist/esm/{form-choice-helpers-62cf0a50.js → form-choice-helpers-7f7bf83b.js} +4 -4
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/esm/yoo-form-choice-button.entry.js +1 -1
  27. package/dist/esm/yoo-form-choice-card.entry.js +1 -1
  28. package/dist/esm/yoo-form-choice-chat.entry.js +1 -1
  29. package/dist/esm/yoo-form-choice-image.entry.js +1 -1
  30. package/dist/esm/yoo-form-choice-radio.entry.js +1 -1
  31. package/dist/esm/yoo-form-input.entry.js +28 -24
  32. package/dist/esm/yoo-form-multi-input.entry.js +5 -4
  33. package/dist/types/components/form/form-input/form-input.d.ts +1 -1
  34. package/dist/types/components.d.ts +2 -0
  35. package/package.json +1 -1
@@ -26,11 +26,11 @@ function onItemSelect(item, choiceElement, preventSetValue = false) {
26
26
  }
27
27
  }
28
28
  function getColor(value, valuesColor, selection) {
29
- if (valuesColor && value) {
30
- if (!isSelected(value, selection))
31
- return '';
32
- return valuesColor.find(valueColor => valueColor.key === value).value || '';
29
+ var _a;
30
+ if ((valuesColor === null || valuesColor === void 0 ? void 0 : valuesColor.length) && value) {
31
+ return isSelected(value, selection) ? ((_a = valuesColor.find(({ key }) => key === value)) === null || _a === void 0 ? void 0 : _a.value) || '' : '';
33
32
  }
33
+ return '';
34
34
  }
35
35
  function updateValue(newVal, oldVal, choiceElement, onSelectCall) {
36
36
  if (!isEqual(oldVal, newVal)) {
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, i as createEvent, h, e as Host, g as getElement } from './index-019c1b1a.js';
2
2
  import { t as translate, T as translateMulti } from './index-31fcf34b.js';
3
- import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, i as isSelected, g as getColor, o as onItemSelect } from './form-choice-helpers-62cf0a50.js';
3
+ import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, i as isSelected, g as getColor, o as onItemSelect } from './form-choice-helpers-7f7bf83b.js';
4
4
  import { R as ReadonlyCard } from './readonly-card-7ac5609f.js';
5
5
  import './lodash-b0ad17f3.js';
6
6
  import './_commonjsHelpers-f4d11124.js';
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, i as createEvent, h, e as Host, g as getElement } from './index-019c1b1a.js';
2
2
  import { i as isChromatic, t as translate, T as translateMulti } from './index-31fcf34b.js';
3
3
  import { s as setColorSVG } from './common-helpers-cd0eef7a.js';
4
- import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, i as isSelected, o as onItemSelect } from './form-choice-helpers-62cf0a50.js';
4
+ import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, i as isSelected, o as onItemSelect } from './form-choice-helpers-7f7bf83b.js';
5
5
  import { R as ReadonlyCard } from './readonly-card-7ac5609f.js';
6
6
  import './lodash-b0ad17f3.js';
7
7
  import './_commonjsHelpers-f4d11124.js';
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, i as createEvent, h, e as Host, g as getElement } from './index-019c1b1a.js';
2
2
  import { M as MessageType } from './index-161cea2b.js';
3
3
  import { t as translate, T as translateMulti } from './index-31fcf34b.js';
4
- import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, i as isSelected, o as onItemSelect } from './form-choice-helpers-62cf0a50.js';
4
+ import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, i as isSelected, o as onItemSelect } from './form-choice-helpers-7f7bf83b.js';
5
5
  import { R as ReadonlyCard } from './readonly-card-7ac5609f.js';
6
6
  import './lodash-b0ad17f3.js';
7
7
  import './_commonjsHelpers-f4d11124.js';
@@ -2,7 +2,7 @@ import { r as registerInstance, i as createEvent, h, e as Host, g as getElement
2
2
  import { T as translateMulti } from './index-31fcf34b.js';
3
3
  import { y as isEqual, p as isString } from './lodash-b0ad17f3.js';
4
4
  import { c as showSlidesMedia } from './common-helpers-cd0eef7a.js';
5
- import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, o as onItemSelect, i as isSelected } from './form-choice-helpers-62cf0a50.js';
5
+ import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, o as onItemSelect, i as isSelected } from './form-choice-helpers-7f7bf83b.js';
6
6
  import './_commonjsHelpers-f4d11124.js';
7
7
  import './index-161cea2b.js';
8
8
  import './draggable-tags-helpers-e5a59085.js';
@@ -2,7 +2,7 @@ import { r as registerInstance, i as createEvent, h, e as Host, g as getElement
2
2
  import { t as translate, T as translateMulti } from './index-31fcf34b.js';
3
3
  import { c as compact, p as isString } from './lodash-b0ad17f3.js';
4
4
  import { a as setValueAndValidateInput } from './form-input-helpers-eba381d1.js';
5
- import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, o as onItemSelect } from './form-choice-helpers-62cf0a50.js';
5
+ import { u as updateValues, a as updateValue, p as prepareChoice, h as hasWarnings, o as onItemSelect } from './form-choice-helpers-7f7bf83b.js';
6
6
  import { R as ReadonlyCard } from './readonly-card-7ac5609f.js';
7
7
  import './_commonjsHelpers-f4d11124.js';
8
8
  import './index-161cea2b.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, i as createEvent, h, e as Host, g as getElement } from './index-019c1b1a.js';
2
- import { dk as isKeyboardResizeModeInactive, o as isWeb, R as isNullOrUndefined, p as debounce, v as isIOS, ab as enableKeyboardResize, aE as isPresent, aa as disableKeyboardResize, d as isNativeMobile, bG as isSafari, e as isAndroid, dt as isHTML, fw as extractTextFromStringHTML, an as copyToClipboard, aZ as showToast, t as translate, dm as resizeObserve, c$ as isAnimationsDisabled } from './index-31fcf34b.js';
2
+ import { dk as isKeyboardResizeModeInactive, o as isWeb, R as isNullOrUndefined, p as debounce, v as isIOS, ab as enableKeyboardResize, aa as disableKeyboardResize, d as isNativeMobile, bG as isSafari, e as isAndroid, dt as isHTML, fw as extractTextFromStringHTML, an as copyToClipboard, aZ as showToast, t as translate, dm as resizeObserve, c$ as isAnimationsDisabled } from './index-31fcf34b.js';
3
3
  import { p as isString, i as isFunction, l as isNumber } from './lodash-b0ad17f3.js';
4
4
  import { b as getAppContext } from './common-helpers-cd0eef7a.js';
5
5
  import { v as validate, i as initNumber, a as setValueAndValidateInput, s as setValidator, c as convertValueForInputType, h as onIconClicked, o as onInputClear, b as onInputBlurred, d as onInputFocused } from './form-input-helpers-eba381d1.js';
@@ -38,6 +38,7 @@ const YooFormInputComponent = class {
38
38
  this.size = 'large';
39
39
  this.initialCheckboxParams = null;
40
40
  this.fireInputChangeEvent = false;
41
+ this.allowDecimals = false;
41
42
  this.checkboxParams = null;
42
43
  this.hostWidth = 0;
43
44
  this.isKeyboardResizeModeInactive = isKeyboardResizeModeInactive();
@@ -153,6 +154,7 @@ const YooFormInputComponent = class {
153
154
  break;
154
155
  case 'number':
155
156
  this.finalIconPrefix = this.iconPrefix ? this.iconPrefix : 'ranking';
157
+ !this.allowDecimals && this.step == undefined && (this.step = 1);
156
158
  break;
157
159
  case 'password':
158
160
  this.finalIconPrefix = 'password';
@@ -194,7 +196,6 @@ const YooFormInputComponent = class {
194
196
  this.internalPlaceholder = ((_b = this.checkboxParams) === null || _b === void 0 ? void 0 : _b.value) ? null : this.placeholder;
195
197
  this.inputType = this.type;
196
198
  this.setLocalValue(true);
197
- this.inputHasValue = isPresent(this.value);
198
199
  }
199
200
  disconnectedCallback() {
200
201
  if (isIOS()) {
@@ -222,30 +223,34 @@ const YooFormInputComponent = class {
222
223
  el.value = this.localValue + '.';
223
224
  }
224
225
  if (!isNumberInput || el.value || ev.data !== '-') {
225
- if (isNumberInput && ['e', '+'].includes(ev.data)) {
226
- el.value = this.value;
227
- }
228
- value = convertValueForInputType(el.value, type);
229
- this.wasPreviousKeyPressMinus = ev.data === '-';
230
- this.inputHasValue = value === '' ? false : isPresent(value);
231
- if (this.maxCharacters) {
232
- if (this.maxCharacters - el.value.length < 0) {
233
- value = value.substring(0, this.maxCharacters);
234
- el.value = value;
235
- this.remainingCharacters = 0;
226
+ if (!(isNumberInput && (el.value.length === 1 && el.value[0] === '-'))) {
227
+ if (isNumberInput && ['e', '+'].includes(ev.data)) {
228
+ el.value = this.value;
236
229
  }
237
- else {
238
- this.remainingCharacters = this.maxCharacters - el.value.length;
230
+ value = convertValueForInputType(el.value, type);
231
+ if (this.maxCharacters) {
232
+ if (this.maxCharacters - el.value.length < 0) {
233
+ value = value.substring(0, this.maxCharacters);
234
+ el.value = value;
235
+ this.remainingCharacters = 0;
236
+ }
237
+ else {
238
+ this.remainingCharacters = this.maxCharacters - el.value.length;
239
+ }
239
240
  }
241
+ const skipValueAssignment = !((this.localValue === null && value) || (this.localValue && (!isNullOrUndefined(value) || value === '')));
242
+ this.emitValueAndSetValidity(value, skipValueAssignment);
243
+ this.localValue = value;
240
244
  }
241
- const skipValueAssignment = !((this.localValue === null && value) || (this.localValue && (!isNullOrUndefined(value) || value === '')));
242
- this.emitValueAndSetValidity(value, skipValueAssignment);
243
- this.localValue = value;
245
+ }
246
+ if (isNumberInput && (ev.data === '-' || !el.value)) {
247
+ this.wasPreviousKeyPressMinus = ev.data === '-';
244
248
  }
245
249
  }
246
250
  }
247
251
  onKeyPress(ev) {
248
252
  const keycode = ev.keyCode;
253
+ const inputValue = ev.target.value;
249
254
  const BACKSPACE_KEYCODE = 8;
250
255
  if (keycode !== BACKSPACE_KEYCODE && this.maxCharacters && this.remainingCharacters < 1) {
251
256
  ev.preventDefault();
@@ -260,9 +265,9 @@ const YooFormInputComponent = class {
260
265
  if (ev.key === 'Tab') {
261
266
  this.tabPressed.emit(true);
262
267
  }
263
- if (this.type === 'number') {
264
- // prevent decimal point if minimal step is 1
265
- if (this.step && Number.isInteger(this.step) && ev.key === '.') {
268
+ if (this.isNumberInput(this.type)) {
269
+ // prevent decimal point if not allowed
270
+ if (!this.allowDecimals && ev.key === '.') {
266
271
  ev.preventDefault();
267
272
  }
268
273
  const MINUS_KEYCODE = 189;
@@ -272,7 +277,7 @@ const YooFormInputComponent = class {
272
277
  * For example '222-2', as this will return a value of null which leads to validation issues in an
273
278
  * optional field.
274
279
  */
275
- if ((this.inputHasValue || this.wasPreviousKeyPressMinus) && keycode === MINUS_KEYCODE) {
280
+ if ((inputValue || this.wasPreviousKeyPressMinus) && keycode === MINUS_KEYCODE) {
276
281
  ev.preventDefault();
277
282
  }
278
283
  // This only allows the keycodes of numbers 0-9
@@ -324,7 +329,6 @@ const YooFormInputComponent = class {
324
329
  }
325
330
  clearInput() {
326
331
  this.localValue = null;
327
- this.inputHasValue = false;
328
332
  if (this.inputElement) {
329
333
  this.inputElement.value = null;
330
334
  this.updateRemainingCharacters(true);
@@ -338,7 +342,7 @@ const YooFormInputComponent = class {
338
342
  }
339
343
  getPattern() {
340
344
  if (this.isNumberInput(this.inputType)) {
341
- return '[+-]?[0-9]+[,.]?([0-9]+)?';
345
+ return `^([+-]{1})?[0-9]+${this.allowDecimals ? '[,.]?([0-9]+)?' : ''}`;
342
346
  }
343
347
  }
344
348
  isTextInput(inputType) {
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, i as createEvent, f as forceUpdate, h, e as Host, g as getElement } from './index-019c1b1a.js';
2
- import { p as debounce, aI as getUUID, o as isWeb, t as translate, b7 as isValueATranslationKey } from './index-31fcf34b.js';
2
+ import { aI as getUUID, p as debounce, o as isWeb, t as translate, b7 as isValueATranslationKey } from './index-31fcf34b.js';
3
3
  import { y as isEqual } from './lodash-b0ad17f3.js';
4
4
  import { S as Sortable } from './sortable.esm-f788d1ca.js';
5
5
  import { b as getAppContext } from './common-helpers-cd0eef7a.js';
@@ -46,13 +46,13 @@ const YooFormMultiInputComponent = class {
46
46
  this.dragAndDropPendingEvent = null;
47
47
  this.dragAndDropPendingEventTimeout = null;
48
48
  this.sortables = [];
49
- this.setValueAndEmitChanges = debounce((value, skipValueAssignment = false) => {
49
+ this.setValueAndEmitChanges = (value, skipValueAssignment = false) => {
50
50
  if (!skipValueAssignment) {
51
51
  this.value = value;
52
52
  }
53
53
  const finalValue = this.isSimpleArray ? this.value[0] : this.value;
54
54
  setValueAndValidateInput(finalValue, this, false, true, true);
55
- }, 500);
55
+ };
56
56
  }
57
57
  async reset(keys) {
58
58
  this.cells = this.getCells();
@@ -418,7 +418,8 @@ const YooFormMultiInputComponent = class {
418
418
  if (this.reverseValueDimensions) {
419
419
  values = this.arrayTransposing(values);
420
420
  }
421
- this.setValueAndEmitChanges(values);
421
+ // use debounce to prevent performance issue while typing
422
+ debounce(this.setValueAndEmitChanges.bind(this), 500)(values);
422
423
  }
423
424
  onTranslationValueUpdated(ev) {
424
425
  ev.stopPropagation();