@unicef-polymer/etools-form-builder 3.0.0-rc.2 → 3.0.0-rc.20

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 (38) hide show
  1. package/dist/assets/translations.js +64 -0
  2. package/dist/form-attachments-popup/form-attachments-popup.d.ts +4 -0
  3. package/dist/form-attachments-popup/form-attachments-popup.js +108 -5
  4. package/dist/form-fields/abstract-field-base.class.js +6 -20
  5. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +1 -1
  6. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +10 -13
  7. package/dist/form-fields/repeatable-fields/repeatable-base-field.js +2 -2
  8. package/dist/form-fields/repeatable-fields/repeatable-number-field.js +0 -2
  9. package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +2 -2
  10. package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +9 -13
  11. package/dist/form-fields/repeatable-fields/repeatable-text-field.js +0 -5
  12. package/dist/form-fields/single-fields/attachment-field.d.ts +1 -1
  13. package/dist/form-fields/single-fields/attachment-field.js +1 -1
  14. package/dist/form-fields/single-fields/boolean-field.js +0 -5
  15. package/dist/form-fields/single-fields/number-field.js +1 -3
  16. package/dist/form-fields/single-fields/scale-field.d.ts +2 -2
  17. package/dist/form-fields/single-fields/scale-field.js +9 -13
  18. package/dist/form-fields/single-fields/text-field.js +0 -2
  19. package/dist/form-groups/form-abstract-group.d.ts +2 -1
  20. package/dist/form-groups/form-abstract-group.js +17 -12
  21. package/dist/form-groups/form-card.js +15 -4
  22. package/dist/form-groups/form-collapsed-card.d.ts +2 -2
  23. package/dist/form-groups/form-collapsed-card.js +10 -10
  24. package/dist/lib/additional-components/confirmation-dialog.js +1 -1
  25. package/dist/lib/additional-components/etools-fb-card.js +16 -27
  26. package/dist/lib/styles/attachments.styles.js +2 -10
  27. package/dist/lib/styles/card-styles.js +5 -9
  28. package/dist/lib/styles/dialog.styles.js +2 -1
  29. package/dist/lib/styles/elevation-styles.d.ts +2 -2
  30. package/dist/lib/styles/elevation-styles.js +2 -2
  31. package/dist/lib/styles/form-builder-card.styles.js +10 -3
  32. package/dist/lib/styles/shared-styles.js +3 -9
  33. package/dist/lib/types/form-builder.interfaces.d.ts +1 -0
  34. package/package.json +13 -6
  35. package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +0 -7
  36. package/dist/form-attachments-popup/form-attachments-popup.tpl.js +0 -102
  37. package/dist/lib/styles/input-styles.d.ts +0 -2
  38. package/dist/lib/styles/input-styles.js +0 -138
@@ -62,6 +62,70 @@ const translations = {
62
62
  NUMBER_MUST_BE_LOWER_THAN: 'Le nombre doit être inférieur à {0}',
63
63
  DOCUMENT_TYPE: 'Type de document',
64
64
  SELECT_DOCUMENT_TYPE: 'Sélectionnez le type de document'
65
+ },
66
+ ar: {
67
+ SAVE: 'يحفظ',
68
+ DOWNLOAD: 'تحميل',
69
+ CHANGE: 'يتغير',
70
+ DELETE: 'يمسح',
71
+ CANCEL: 'يلغي',
72
+ OK: 'نعم',
73
+ ADD: 'يضيف',
74
+ UPLOAD_ATTACHMENTS_FAILED: 'لا يمكن تحميل المرفقات. الرجاء معاودة المحاولة في وقت لاحق',
75
+ REQUIRED_FIELD: 'هذه الخانة مطلوبه',
76
+ MUST_BE_INTEGER: 'يجب أن يكون صحيحا',
77
+ MUST_BE_NUMBER: 'يجب أن يكون رقما',
78
+ CLEAR: 'واضح',
79
+ GROUP_REQUIRED: 'المجموعة مطلوبة. يجب أن تكون هناك مجموعة واحدة على الأقل',
80
+ GROUP: 'مجموعة',
81
+ THIS_GROUP: 'هذه المجموعة',
82
+ CHECK_FIELDS_TRY_AGAIN: 'يرجى التحقق من كافة الحقول والمحاولة مرة أخرى',
83
+ CONFIRM_DELETE: 'هل أنت متأكد أنك تريد حذف',
84
+ UPLOAD_FILES: 'تحميل الملفات',
85
+ FILE: 'ملف',
86
+ FILES: 'ملفات',
87
+ ATTACHMENTS_FOR: 'المرفقات ل',
88
+ PARTNER: 'شريك',
89
+ CP_OUTPUT: 'إخراج سي بي',
90
+ PD_SPD: 'بي دي/SPD',
91
+ TEXT_MUST_BE_LESS_CHARS: 'يجب أن يكون النص أقل من {0} حرف',
92
+ DOES_NOT_MATCH_PATTERN: 'لا يتطابق مع النمط المسموح به',
93
+ NUMBER_MUST_BE_GREATER_THAN: 'يجب أن يكون الرقم أكبر من {0}',
94
+ NUMBER_MUST_BE_LOWER_THAN: 'يجب أن يكون الرقم أقل من {0}',
95
+ DOCUMENT_TYPE: 'نوع الوثيقة',
96
+ SELECT_DOCUMENT_TYPE: 'حدد نوع المستند'
97
+ },
98
+ es: {
99
+ SAVE: 'Guardar',
100
+ DOWNLOAD: 'Descargar',
101
+ CHANGE: 'Cambia',
102
+ DELETE: 'Eliminar',
103
+ CANCEL: 'Cancelar',
104
+ OK: 'Biean',
105
+ ADD: 'Añadir',
106
+ UPLOAD_ATTACHMENTS_FAILED: 'No se pueden cargar archivos adjuntos. Por favor, inténtelo de nuevo más tarde',
107
+ REQUIRED_FIELD: 'Este campo es obligatorio',
108
+ MUST_BE_INTEGER: 'Debe ser un entero',
109
+ MUST_BE_NUMBER: 'Tiene que ser un número',
110
+ CLEAR: 'Claro',
111
+ GROUP_REQUIRED: 'Se requiere grupo. Debe existir al menos un grupo.',
112
+ GROUP: 'grupo',
113
+ THIS_GROUP: 'este grupo',
114
+ CHECK_FIELDS_TRY_AGAIN: 'Por favor revisa todos los campos y vuelve a intentarlo.',
115
+ CONFIRM_DELETE: '¿Estás seguro de que quieres eliminar?',
116
+ UPLOAD_FILES: 'Subir archivos',
117
+ FILE: 'Archivo',
118
+ FILES: 'Archivos',
119
+ ATTACHMENTS_FOR: 'Adjuntos para',
120
+ PARTNER: 'Pareja',
121
+ CP_OUTPUT: 'Salida CP',
122
+ PD_SPD: 'PD/SPD',
123
+ TEXT_MUST_BE_LESS_CHARS: 'El texto debe tener menos de {0} caracteres',
124
+ DOES_NOT_MATCH_PATTERN: 'No coincide con el patrón permitido',
125
+ NUMBER_MUST_BE_GREATER_THAN: 'El número debe ser mayor que {0}',
126
+ NUMBER_MUST_BE_LOWER_THAN: 'El número debe ser inferior a {0}',
127
+ DOCUMENT_TYPE: 'Tipo de Documento',
128
+ SELECT_DOCUMENT_TYPE: 'Seleccionar tipo de documento'
65
129
  }
66
130
  };
67
131
  export default translations;
@@ -1,6 +1,7 @@
1
1
  import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog';
2
2
  import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
3
3
  import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown';
4
+ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
4
5
  import { CSSResultArray, LitElement, TemplateResult } from 'lit';
5
6
  import { GenericObject } from '../lib/types/global.types';
6
7
  import { BlueprintMetadata } from '../lib/types/form-builder.types';
@@ -65,6 +66,9 @@ export declare class FormAttachmentsPopup extends LitElement {
65
66
  get uploadUrl(): string;
66
67
  get jwtLocalStorageKey(): string;
67
68
  constructor();
69
+ connectedCallback(): void;
70
+ disconnectedCallback(): void;
71
+ handleLanguageChange(e: CustomEvent): void;
68
72
  render(): TemplateResult | void;
69
73
  /**
70
74
  * on Cancel button click
@@ -2,16 +2,17 @@ import { __decorate } from "tslib";
2
2
  import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog';
3
3
  import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
4
4
  import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown';
5
+ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
5
6
  import { deleteFileFromDexie } from '@unicef-polymer/etools-unicef/src/etools-upload/offline/dexie-operations';
6
- import { css, LitElement } from 'lit';
7
+ import { css, html, LitElement } from 'lit';
7
8
  import { property, query, customElement } from 'lit/decorators.js';
8
9
  import { clone, equals } from 'ramda';
9
- import { template } from './form-attachments-popup.tpl';
10
10
  import { fireEvent } from '../lib/utils/fire-custom-event';
11
11
  import { SharedStyles } from '../lib/styles/shared-styles';
12
12
  import { AttachmentsStyles } from '../lib/styles/attachments.styles';
13
13
  import { AttachmentsHelper } from './form-attachments-popup.helper';
14
14
  import { getTranslation } from '../lib/utils/translate';
15
+ import { DialogStyles } from '../lib/styles/dialog.styles';
15
16
  let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
16
17
  set dialogData({ attachments, title, metadata, readonly, computedPath, errors }) {
17
18
  this.popupTitle = title;
@@ -47,11 +48,113 @@ let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
47
48
  throw new Error('Please initialize attachments popup before use');
48
49
  }
49
50
  if (!this.language) {
50
- this.language = window.localStorage.defaultLanguage || 'en';
51
+ this.language = window.EtoolsLanguage || 'en';
51
52
  }
52
53
  }
54
+ connectedCallback() {
55
+ super.connectedCallback();
56
+ document.addEventListener('language-changed', this.handleLanguageChange.bind(this));
57
+ }
58
+ disconnectedCallback() {
59
+ super.disconnectedCallback();
60
+ document.removeEventListener('language-changed', this.handleLanguageChange.bind(this));
61
+ }
62
+ handleLanguageChange(e) {
63
+ this.language = e.detail.language;
64
+ }
53
65
  render() {
54
- return template.call(this);
66
+ var _a;
67
+ return html `
68
+ ${DialogStyles}
69
+ <style>
70
+ etools-icon[name='error-outline'] {
71
+ color: var(--etools-upload-danger-color, #ea4022);
72
+ }
73
+ </style>
74
+ <etools-dialog
75
+ id="form-attachments-dialog"
76
+ size="md"
77
+ no-padding
78
+ keep-dialog-open
79
+ ?opened="${this.dialogOpened}"
80
+ .okBtnText="${getTranslation(this.language, 'SAVE')}"
81
+ .cancelBtnText="${getTranslation(this.language, 'CANCEL')}"
82
+ .hideConfirmBtn="${this.readonly}"
83
+ dialog-title="${this.popupTitle}"
84
+ @close="${this.onClose}"
85
+ @confirm-btn-clicked="${() => this.saveChanges()}"
86
+ >
87
+ <!-- Link is used to download attachments -->
88
+ <a id="link" target="_blank" hidden></a>
89
+
90
+ <div class="popup-container">
91
+ ${(_a = this.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment, index) => {
92
+ var _a, _b;
93
+ return html `
94
+ <div class="file-selector-container with-type-dropdown">
95
+ <!-- Type select Dropdown -->
96
+ <etools-dropdown
97
+ class="type-dropdown file-selector__type-dropdown"
98
+ .selected="${attachment.file_type}"
99
+ @etools-selected-item-changed="${({ detail }) => { var _a; return this.changeFileType(attachment, (_a = detail.selectedItem) === null || _a === void 0 ? void 0 : _a.value, index); }}"
100
+ trigger-value-change-event
101
+ label="${getTranslation(this.language, 'DOCUMENT_TYPE')}"
102
+ placeholder="${getTranslation(this.language, 'SELECT_DOCUMENT_TYPE')}"
103
+ required
104
+ ?readonly="${this.readonly}"
105
+ hide-search
106
+ .options="${(_b = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.options.target_attachments_file_types) === null || _b === void 0 ? void 0 : _b.values}"
107
+ option-label="label"
108
+ option-value="value"
109
+ ?invalid="${this.checkFileType(index)}"
110
+ .errorMessage="${this.retrieveErrorMessage(index)}"
111
+ allow-outside-scroll
112
+ dynamic-align
113
+ ></etools-dropdown>
114
+
115
+ <!-- File name component -->
116
+ <div class="filename-container file-selector__filename">
117
+ <etools-icon class="file-icon" name="attachment"></etools-icon>
118
+ <span class="filename" title="${attachment.filename}">${attachment.filename}</span>
119
+ </div>
120
+
121
+ <!-- Download Button -->
122
+ <etools-button
123
+ variant="text"
124
+ ?hidden="${!attachment.url}"
125
+ class="download-button file-selector__download"
126
+ @click="${() => this.downloadFile(attachment)}"
127
+ >
128
+ <etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
129
+ ${getTranslation(this.language, 'DOWNLOAD')}
130
+ </etools-button>
131
+
132
+ <!-- Delete Button -->
133
+ <etools-button
134
+ variant="text"
135
+ class="danger delete-button file-selector__delete"
136
+ ?hidden="${this.readonly}"
137
+ @click="${() => this.deleteAttachment(index)}"
138
+ >
139
+ ${getTranslation(this.language, 'DELETE')}
140
+ </etools-button>
141
+ </div>
142
+ `;
143
+ })}
144
+
145
+ <!-- Upload button -->
146
+ <etools-upload-multi
147
+ class="with-padding"
148
+ activate-offline
149
+ ?hidden="${this.readonly}"
150
+ @upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
151
+ .endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
152
+ .jwtLocalStorageKey="${this.jwtLocalStorageKey}"
153
+ >
154
+ </etools-upload-multi>
155
+ </div>
156
+ </etools-dialog>
157
+ `;
55
158
  }
56
159
  /**
57
160
  * on Cancel button click
@@ -73,7 +176,7 @@ let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
73
176
  this.attachments.forEach((attachment, index) => {
74
177
  if (!attachment.file_type) {
75
178
  fileTypeNotSelected = true;
76
- this.errors[index] = { file_type: ['This field is required'] };
179
+ this.errors[index] = { file_type: [getTranslation(this.language, 'REQUIRED_FIELD')] };
77
180
  }
78
181
  else {
79
182
  this.errors[index] = [];
@@ -30,7 +30,7 @@ export class AbstractFieldBaseClass extends LitElement {
30
30
  this.touched = false;
31
31
  this._readonly = false;
32
32
  if (!this.language) {
33
- this.language = window.localStorage.defaultLanguage || 'en';
33
+ this.language = window.EtoolsLanguage || 'en';
34
34
  }
35
35
  this.handleLanguageChange = this.handleLanguageChange.bind(this);
36
36
  }
@@ -121,37 +121,23 @@ export class AbstractFieldBaseClass extends LitElement {
121
121
  border: 1px solid;
122
122
  }
123
123
 
124
- .full-width,
125
- paper-input,
126
- paper-textarea {
124
+ .full-width {
127
125
  width: 100%;
128
126
  }
129
127
 
130
128
  .question-text {
131
129
  font-weight: 500;
132
- font-size: 13px;
130
+ font-size: var(--etools-font-size-13, 13px);
133
131
  color: var(--primary-text-color);
134
132
  }
135
133
 
136
- paper-input,
137
- paper-textarea {
138
- outline: none !important;
139
- }
140
- paper-input[required],
141
- paper-textarea[required] {
142
- --paper-input-container-label_-_background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%221235%22%20height%3D%221175%22%3E%3Cpath%20fill%3D%22%23de0000%22%20d%3D%22M0%2C449h1235l-999%2C726%20382-1175%20382%2C1175z%22%2F%3E%3C%2Fsvg%3E')
143
- no-repeat 98% 14%/7px;
144
- --paper-input-container-label_-_max-width: max-content;
145
- --paper-input-container-label_-_padding-right: 15px;
146
- }
147
-
148
- iron-icon[icon='close'] {
134
+ etools-icon[name='close'] {
149
135
  cursor: pointer;
150
136
  }
151
137
 
152
138
  .error-text {
153
139
  color: var(--error-color);
154
- font-size: 12px;
140
+ font-size: var(--etools-font-size-12, 12px);
155
141
  }
156
142
 
157
143
  @media (max-width: 1080px) {
@@ -176,7 +162,7 @@ export class AbstractFieldBaseClass extends LitElement {
176
162
  min-height: 150px;
177
163
  }
178
164
 
179
- .question-control .container paper-radio-group {
165
+ .question-control .container etools-radio-group {
180
166
  flex-direction: column;
181
167
  opacity: 1 !important;
182
168
  }
@@ -2,7 +2,7 @@ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload';
2
2
  import { RepeatableBaseField } from './repeatable-base-field';
3
3
  import { StoredAttachment, UploadFinishedDetails } from '../../form-attachments-popup';
4
4
  import { CSSResultArray, TemplateResult } from 'lit';
5
- import '@shoelace-style/shoelace/dist/components/button/button.js';
5
+ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
6
6
  import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
7
7
  export declare class RepeatableAttachmentField extends RepeatableBaseField<StoredAttachment> {
8
8
  get uploadUrl(): string;
@@ -8,9 +8,8 @@ import { fireEvent } from '../../lib/utils/fire-custom-event';
8
8
  import { SharedStyles } from '../../lib/styles/shared-styles';
9
9
  import { AttachmentsStyles } from '../../lib/styles/attachments.styles';
10
10
  import { getTranslation } from '../../lib/utils/translate';
11
- import '@shoelace-style/shoelace/dist/components/button/button.js';
11
+ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
12
12
  import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
13
- import { buttonsStyles } from '@unicef-polymer/etools-unicef/src/styles/button-styles';
14
13
  let RepeatableAttachmentField = class RepeatableAttachmentField extends RepeatableBaseField {
15
14
  constructor() {
16
15
  super(...arguments);
@@ -39,26 +38,25 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
39
38
  </div>
40
39
 
41
40
  <!-- Download Button -->
42
- <sl-button
43
- class="neutral"
41
+ <etools-button
42
+ class="neutral download-button file-selector__download"
44
43
  variant="text"
45
44
  ?hidden="${!value.url}"
46
- class="download-button file-selector__download"
47
- @click="${this.downloadFile(value)}"
45
+ @click="${() => this.downloadFile(value)}"
48
46
  >
49
47
  <etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
50
48
  ${getTranslation(this.language, 'DOWNLOAD')}
51
- </sl-button>
49
+ </etools-button>
52
50
 
53
51
  <!-- Delete Button -->
54
- <sl-button
52
+ <etools-button
55
53
  variant="danger"
56
- class="delete-button file-selector__delete"
54
+ class="file-selector__delete"
57
55
  ?hidden="${this.isReadonly}"
58
- @click="${this.removeControl(index)}"
56
+ @click="${() => this.removeControl(index)}"
59
57
  >
60
58
  ${getTranslation(this.language, 'DELETE')}
61
- </sl-button>
59
+ </etools-button>
62
60
  </div>
63
61
  `
64
62
  : '')}
@@ -109,7 +107,7 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
109
107
  });
110
108
  if (error && error.length) {
111
109
  console.error(error);
112
- fireEvent(this, 'toast', { text: 'Can not upload attachments. Please try again later' });
110
+ fireEvent(this, 'toast', { text: getTranslation(this.language, 'UPLOAD_ATTACHMENTS_FAILED') });
113
111
  }
114
112
  }
115
113
  downloadFile(attachment) {
@@ -137,7 +135,6 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
137
135
  ...RepeatableBaseField.styles,
138
136
  SharedStyles,
139
137
  AttachmentsStyles,
140
- buttonsStyles,
141
138
  css `
142
139
  .file-selector__type-dropdown {
143
140
  flex-basis: 25%;
@@ -31,9 +31,9 @@ export class RepeatableBaseField extends AbstractFieldBaseClass {
31
31
  @click="${() => this.removeControl(index)}"
32
32
  ></etools-icon-button>
33
33
  </div>`)}
34
- <sl-button variant="primary" class="add-button" ?hidden="${this.isReadonly}" @click="${this.addNewField}">
34
+ <etools-button variant="primary" class="add-button" ?hidden="${this.isReadonly}" @click="${this.addNewField}">
35
35
  ${getTranslation(this.language, 'ADD')}
36
- </sl-button>
36
+ </etools-button>
37
37
  </div>
38
38
  </div>
39
39
  `;
@@ -2,7 +2,6 @@ import { __decorate } from "tslib";
2
2
  import { css, html } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
4
  import '@unicef-polymer/etools-unicef/src/etools-input/etools-input';
5
- import { InputStyles } from '../../lib/styles/input-styles';
6
5
  import { RepeatableBaseField } from './repeatable-base-field';
7
6
  import { AbstractFieldBaseClass } from '../abstract-field-base.class';
8
7
  import { getTranslation } from '../../lib/utils/translate';
@@ -13,7 +12,6 @@ let RepeatableNumberField = class RepeatableNumberField extends RepeatableBaseFi
13
12
  }
14
13
  controlTemplate(value, index) {
15
14
  return html `
16
- ${InputStyles}
17
15
  <etools-input
18
16
  class="no-padding-left"
19
17
  no-label-float
@@ -1,7 +1,7 @@
1
1
  import { CSSResultArray, TemplateResult } from 'lit';
2
- import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
2
+ import '@unicef-polymer/etools-unicef/src/etools-radio/etools-radio-group';
3
3
  import '@shoelace-style/shoelace/dist/components/radio/radio.js';
4
- import '@shoelace-style/shoelace/dist/components/button/button.js';
4
+ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
5
5
  import { RepeatableBaseField } from './repeatable-base-field';
6
6
  import { FieldOption } from '..';
7
7
  export declare class RepeatableScaleField extends RepeatableBaseField<string | number | null> {
@@ -2,11 +2,9 @@ import { __decorate } from "tslib";
2
2
  import { css, html } from 'lit';
3
3
  import { property, customElement } from 'lit/decorators.js';
4
4
  import { repeat } from 'lit/directives/repeat.js';
5
- import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
5
+ import '@unicef-polymer/etools-unicef/src/etools-radio/etools-radio-group';
6
6
  import '@shoelace-style/shoelace/dist/components/radio/radio.js';
7
- import '@shoelace-style/shoelace/dist/components/button/button.js';
8
- import { buttonsStyles } from '@unicef-polymer/etools-unicef/src/styles/button-styles';
9
- import { InputStyles } from '../../lib/styles/input-styles';
7
+ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
10
8
  import { RepeatableBaseField } from './repeatable-base-field';
11
9
  import { getTranslation } from '../../lib/utils/translate';
12
10
  import { AbstractFieldBaseClass } from '../abstract-field-base.class';
@@ -17,9 +15,8 @@ let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseFiel
17
15
  }
18
16
  controlTemplate(value, index) {
19
17
  return html `
20
- ${InputStyles}
21
18
  <div class="container">
22
- <sl-radio-group
19
+ <etools-radio-group
23
20
  class="radio-group"
24
21
  .value="${value}"
25
22
  @sl-change="${(e) => this.onSelect(e.target.value, index)}"
@@ -27,16 +24,16 @@ let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseFiel
27
24
  ${repeat(this.options, (option) => html `
28
25
  <sl-radio class="radio-button" value="${this.getValue(option)}"> ${this.getLabel(option)} </sl-radio>
29
26
  `)}
30
- </sl-radio-group>
31
- <sl-button
32
- variant="primary"
27
+ </etools-radio-group>
28
+ <etools-button
29
+ class="neutral clear-button"
30
+ variant="text"
33
31
  ?hidden="${this.isReadonly}"
34
32
  @click="${() => this.valueChanged(null, index)}"
35
- class="clear-button"
36
33
  >
37
34
  <etools-icon name="clear" slot="prefix"></etools-icon>
38
35
  ${getTranslation(this.language, 'CLEAR')}
39
- </sl-button>
36
+ </etools-button>
40
37
  </div>
41
38
  `;
42
39
  }
@@ -56,7 +53,6 @@ let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseFiel
56
53
  // language=CSS
57
54
  return [
58
55
  ...AbstractFieldBaseClass.styles,
59
- buttonsStyles,
60
56
  css `
61
57
  .container {
62
58
  position: relative;
@@ -72,7 +68,7 @@ let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseFiel
72
68
  flex-wrap: wrap;
73
69
  }
74
70
 
75
- :host([is-readonly]) paper-radio-group {
71
+ :host([is-readonly]) etools-radio-group {
76
72
  pointer-events: none;
77
73
  opacity: 0.55;
78
74
  }
@@ -2,13 +2,11 @@ import { __decorate } from "tslib";
2
2
  import { css, html } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
4
  import '@unicef-polymer/etools-unicef/src/etools-input/etools-textarea';
5
- import { InputStyles } from '../../lib/styles/input-styles';
6
5
  import { RepeatableBaseField } from './repeatable-base-field';
7
6
  import { AbstractFieldBaseClass } from '../abstract-field-base.class';
8
7
  let RepeatableTextField = class RepeatableTextField extends RepeatableBaseField {
9
8
  controlTemplate(value, index) {
10
9
  return html `
11
- ${InputStyles}
12
10
  <etools-textarea
13
11
  id="textarea"
14
12
  class="no-padding-left"
@@ -31,9 +29,6 @@ let RepeatableTextField = class RepeatableTextField extends RepeatableBaseField
31
29
  return [
32
30
  ...AbstractFieldBaseClass.styles,
33
31
  css `
34
- :host(.wide) paper-textarea {
35
- padding-left: 0;
36
- }
37
32
  @media (max-width: 380px) {
38
33
  .no-padding-left {
39
34
  padding-left: 0;
@@ -1,4 +1,4 @@
1
- import '@unicef-polymer/etools-unicef/scr/etools-upload/etools-upload';
1
+ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload';
2
2
  import { BaseField } from './base-field';
3
3
  import { SingleUploadFinishedDetails, StoredAttachment } from '../../form-attachments-popup';
4
4
  import { CSSResultArray, TemplateResult } from 'lit';
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import '@unicef-polymer/etools-unicef/scr/etools-upload/etools-upload';
2
+ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload';
3
3
  import { BaseField } from './base-field';
4
4
  import { AttachmentsHelper } from '../../form-attachments-popup';
5
5
  import { html } from 'lit';
@@ -2,12 +2,10 @@ import { __decorate } from "tslib";
2
2
  import { css, html } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
4
  import { BaseField } from './base-field';
5
- import { InputStyles } from '../../lib/styles/input-styles';
6
5
  import '@shoelace-style/shoelace/dist/components/switch/switch.js';
7
6
  let BooleanField = class BooleanField extends BaseField {
8
7
  controlTemplate() {
9
8
  return html `
10
- ${InputStyles}
11
9
  <sl-switch
12
10
  class="no-padding-left"
13
11
  ?checked="${this.value}"
@@ -27,9 +25,6 @@ let BooleanField = class BooleanField extends BaseField {
27
25
  return [
28
26
  ...BaseField.styles,
29
27
  css `
30
- :host(.wide) paper-textarea {
31
- padding-left: 0;
32
- }
33
28
  @media (max-width: 380px) {
34
29
  .no-padding-left {
35
30
  padding-left: 0;
@@ -3,7 +3,6 @@ import { css, html } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
4
  import { BaseField } from './base-field';
5
5
  import '@unicef-polymer/etools-unicef/src/etools-input/etools-input';
6
- import { InputStyles } from '../../lib/styles/input-styles';
7
6
  import { getTranslation } from '../../lib/utils/translate';
8
7
  let NumberField = class NumberField extends BaseField {
9
8
  constructor() {
@@ -12,7 +11,6 @@ let NumberField = class NumberField extends BaseField {
12
11
  }
13
12
  controlTemplate() {
14
13
  return html `
15
- ${InputStyles}
16
14
  <etools-input
17
15
  class="no-padding-left"
18
16
  no-label-float
@@ -38,7 +36,7 @@ let NumberField = class NumberField extends BaseField {
38
36
  return null;
39
37
  }
40
38
  if (isNaN(value)) {
41
- return 'Must be a number';
39
+ return getTranslation(this.language, 'MUST_BE_NUMBER');
42
40
  }
43
41
  const integerValidation = !this.isInteger || value - Math.floor(value) === 0;
44
42
  return integerValidation ? null : getTranslation(this.language, 'MUST_BE_INTEGER');
@@ -1,8 +1,8 @@
1
1
  import { CSSResultArray, TemplateResult } from 'lit';
2
2
  import { BaseField } from './base-field';
3
- import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
3
+ import '@unicef-polymer/etools-unicef/src/etools-radio/etools-radio-group';
4
4
  import '@shoelace-style/shoelace/dist/components/radio/radio.js';
5
- import '@shoelace-style/shoelace/dist/components/button/button.js';
5
+ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
6
6
  export type FieldOption = {
7
7
  value: any;
8
8
  label: string;
@@ -3,11 +3,9 @@ import { css, html } from 'lit';
3
3
  import { property, customElement } from 'lit/decorators.js';
4
4
  import { BaseField } from './base-field';
5
5
  import { repeat } from 'lit/directives/repeat.js';
6
- import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
7
- import { buttonsStyles } from '@unicef-polymer/etools-unicef/src/styles/button-styles';
6
+ import '@unicef-polymer/etools-unicef/src/etools-radio/etools-radio-group';
8
7
  import '@shoelace-style/shoelace/dist/components/radio/radio.js';
9
- import '@shoelace-style/shoelace/dist/components/button/button.js';
10
- import { InputStyles } from '../../lib/styles/input-styles';
8
+ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
11
9
  import { getTranslation } from '../../lib/utils/translate';
12
10
  let ScaleField = class ScaleField extends BaseField {
13
11
  constructor() {
@@ -16,9 +14,8 @@ let ScaleField = class ScaleField extends BaseField {
16
14
  }
17
15
  controlTemplate() {
18
16
  return html `
19
- ${InputStyles}
20
17
  <div class="container">
21
- <sl-radio-group
18
+ <etools-radio-group
22
19
  class="radio-group"
23
20
  .value="${this.value}"
24
21
  @sl-change="${(e) => this.onSelect(e.target.value)}"
@@ -26,16 +23,16 @@ let ScaleField = class ScaleField extends BaseField {
26
23
  ${repeat(this.options, (option) => html `
27
24
  <sl-radio class="radio-button" value="${this.getValue(option)}">${this.getLabel(option)}</sl-radio>
28
25
  `)}
29
- </sl-radio-group>
30
- <sl-button
31
- variant="primary"
26
+ </etools-radio-group>
27
+ <etools-button
28
+ class="neutral clear-button"
29
+ variant="text"
32
30
  ?hidden="${this.isReadonly}"
33
31
  @click="${() => this.valueChanged(null)}"
34
- class="clear-button"
35
32
  >
36
33
  <etools-icon name="clear" slot="prefix"></etools-icon>
37
34
  ${getTranslation(this.language, 'CLEAR')}
38
- </sl-button>
35
+ </etools-button>
39
36
  </div>
40
37
  <div ?hidden="${!this.errorMessage}" class="error-text">${this.errorMessage}</div>
41
38
  `;
@@ -59,7 +56,6 @@ let ScaleField = class ScaleField extends BaseField {
59
56
  // language=CSS
60
57
  return [
61
58
  ...BaseField.styles,
62
- buttonsStyles,
63
59
  css `
64
60
  .container {
65
61
  position: relative;
@@ -75,7 +71,7 @@ let ScaleField = class ScaleField extends BaseField {
75
71
  flex-wrap: wrap;
76
72
  }
77
73
 
78
- :host([is-readonly]) paper-radio-group {
74
+ :host([is-readonly]) etools-radio-group {
79
75
  pointer-events: none;
80
76
  opacity: 0.55;
81
77
  }
@@ -3,11 +3,9 @@ import { css, html } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
4
  import { BaseField } from './base-field';
5
5
  import '@unicef-polymer/etools-unicef/src/etools-input/etools-textarea';
6
- import { InputStyles } from '../../lib/styles/input-styles';
7
6
  let TextField = class TextField extends BaseField {
8
7
  controlTemplate() {
9
8
  return html `
10
- ${InputStyles}
11
9
  <etools-textarea
12
10
  id="otherInfo"
13
11
  class="no-padding-left"