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

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 (87) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +0 -0
  3. package/dist/assets/translations.d.ts +0 -0
  4. package/dist/assets/translations.js +0 -0
  5. package/dist/form-attachments-popup/form-attachments-popup.d.ts +10 -12
  6. package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +0 -0
  7. package/dist/form-attachments-popup/form-attachments-popup.helper.js +0 -0
  8. package/dist/form-attachments-popup/form-attachments-popup.js +22 -28
  9. package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +4 -0
  10. package/dist/form-attachments-popup/form-attachments-popup.tpl.js +19 -8
  11. package/dist/form-attachments-popup/index.d.ts +0 -0
  12. package/dist/form-attachments-popup/index.js +0 -0
  13. package/dist/form-fields/abstract-field-base.class.d.ts +1 -1
  14. package/dist/form-fields/abstract-field-base.class.js +16 -20
  15. package/dist/form-fields/field-renderer-component.d.ts +1 -1
  16. package/dist/form-fields/field-renderer-component.js +3 -7
  17. package/dist/form-fields/index.d.ts +0 -0
  18. package/dist/form-fields/index.js +0 -0
  19. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +4 -2
  20. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +19 -16
  21. package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +2 -1
  22. package/dist/form-fields/repeatable-fields/repeatable-base-field.js +9 -12
  23. package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +2 -2
  24. package/dist/form-fields/repeatable-fields/repeatable-number-field.js +6 -10
  25. package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +5 -5
  26. package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +22 -24
  27. package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +2 -2
  28. package/dist/form-fields/repeatable-fields/repeatable-text-field.js +6 -10
  29. package/dist/form-fields/single-fields/attachment-field.d.ts +2 -2
  30. package/dist/form-fields/single-fields/attachment-field.js +4 -8
  31. package/dist/form-fields/single-fields/base-field.d.ts +1 -1
  32. package/dist/form-fields/single-fields/base-field.js +2 -7
  33. package/dist/form-fields/single-fields/boolean-field.d.ts +2 -2
  34. package/dist/form-fields/single-fields/boolean-field.js +7 -11
  35. package/dist/form-fields/single-fields/number-field.d.ts +2 -2
  36. package/dist/form-fields/single-fields/number-field.js +6 -10
  37. package/dist/form-fields/single-fields/scale-field.d.ts +6 -6
  38. package/dist/form-fields/single-fields/scale-field.js +26 -25
  39. package/dist/form-fields/single-fields/text-field.d.ts +2 -2
  40. package/dist/form-fields/single-fields/text-field.js +8 -13
  41. package/dist/form-groups/form-abstract-group.d.ts +2 -2
  42. package/dist/form-groups/form-abstract-group.js +22 -24
  43. package/dist/form-groups/form-card.d.ts +5 -2
  44. package/dist/form-groups/form-card.js +16 -14
  45. package/dist/form-groups/form-collapsed-card.d.ts +3 -3
  46. package/dist/form-groups/form-collapsed-card.js +34 -28
  47. package/dist/form-groups/index.d.ts +0 -0
  48. package/dist/form-groups/index.js +0 -0
  49. package/dist/index.d.ts +0 -0
  50. package/dist/index.js +0 -0
  51. package/dist/lib/additional-components/confirmation-dialog.d.ts +1 -1
  52. package/dist/lib/additional-components/confirmation-dialog.js +9 -13
  53. package/dist/lib/additional-components/etools-fb-card.d.ts +2 -2
  54. package/dist/lib/additional-components/etools-fb-card.js +40 -37
  55. package/dist/lib/styles/attachments.styles.d.ts +1 -1
  56. package/dist/lib/styles/attachments.styles.js +1 -1
  57. package/dist/lib/styles/card-styles.d.ts +1 -1
  58. package/dist/lib/styles/card-styles.js +1 -1
  59. package/dist/lib/styles/dialog.styles.d.ts +1 -1
  60. package/dist/lib/styles/dialog.styles.js +1 -1
  61. package/dist/lib/styles/elevation-styles.d.ts +1 -1
  62. package/dist/lib/styles/elevation-styles.js +1 -1
  63. package/dist/lib/styles/flex-layout-classes.d.ts +1 -1
  64. package/dist/lib/styles/flex-layout-classes.js +1 -1
  65. package/dist/lib/styles/form-builder-card.styles.d.ts +1 -1
  66. package/dist/lib/styles/form-builder-card.styles.js +1 -1
  67. package/dist/lib/styles/input-styles.d.ts +1 -1
  68. package/dist/lib/styles/input-styles.js +1 -1
  69. package/dist/lib/styles/page-layout-styles.d.ts +1 -1
  70. package/dist/lib/styles/page-layout-styles.js +1 -1
  71. package/dist/lib/styles/shared-styles.d.ts +1 -1
  72. package/dist/lib/styles/shared-styles.js +1 -1
  73. package/dist/lib/types/form-builder.interfaces.d.ts +1 -1
  74. package/dist/lib/types/form-builder.interfaces.js +1 -0
  75. package/dist/lib/types/form-builder.types.d.ts +7 -7
  76. package/dist/lib/types/form-builder.types.js +1 -0
  77. package/dist/lib/types/global.types.d.ts +2 -2
  78. package/dist/lib/types/global.types.js +1 -0
  79. package/dist/lib/utils/dialog.d.ts +0 -0
  80. package/dist/lib/utils/dialog.js +0 -0
  81. package/dist/lib/utils/fire-custom-event.d.ts +0 -0
  82. package/dist/lib/utils/fire-custom-event.js +0 -0
  83. package/dist/lib/utils/translate.d.ts +0 -0
  84. package/dist/lib/utils/translate.js +0 -0
  85. package/dist/lib/utils/validations.helper.d.ts +5 -5
  86. package/dist/lib/utils/validations.helper.js +0 -0
  87. package/package.json +20 -25
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
File without changes
File without changes
@@ -1,12 +1,10 @@
1
- import '@unicef-polymer/etools-dialog/etools-dialog';
2
- import '@unicef-polymer/etools-upload/etools-upload-multi';
3
- import '@unicef-polymer/etools-dropdown/etools-dropdown';
4
- import '@polymer/paper-button/paper-button';
5
- import '@polymer/iron-icons/iron-icons';
6
- import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
1
+ import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog';
2
+ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
3
+ import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown';
4
+ import { CSSResultArray, LitElement, TemplateResult } from 'lit';
7
5
  import { GenericObject } from '../lib/types/global.types';
8
6
  import { BlueprintMetadata } from '../lib/types/form-builder.types';
9
- export declare type FormBuilderAttachmentsPopupData = {
7
+ export type FormBuilderAttachmentsPopupData = {
10
8
  attachments: StoredAttachment[];
11
9
  metadata: BlueprintMetadata;
12
10
  title: string;
@@ -14,14 +12,14 @@ export declare type FormBuilderAttachmentsPopupData = {
14
12
  computedPath: string[];
15
13
  errors: GenericObject[];
16
14
  };
17
- export declare type StoredAttachment = {
15
+ export type StoredAttachment = {
18
16
  attachment: string | number;
19
17
  filename: string;
20
18
  file_type: number | null;
21
19
  url?: string;
22
20
  composedPath?: string[];
23
21
  };
24
- export declare type UploadedAttachment = {
22
+ export type UploadedAttachment = {
25
23
  id: number;
26
24
  object_link: string;
27
25
  file_type: string;
@@ -31,18 +29,18 @@ export declare type UploadedAttachment = {
31
29
  created: string;
32
30
  attachment: number;
33
31
  };
34
- export declare type OfflineSavedAttachment = {
32
+ export type OfflineSavedAttachment = {
35
33
  id: string;
36
34
  filetype: string;
37
35
  filename: string;
38
36
  extraInfo: string[];
39
37
  unsynced: boolean;
40
38
  };
41
- export declare type UploadFinishedDetails = {
39
+ export type UploadFinishedDetails = {
42
40
  success: (UploadedAttachment | OfflineSavedAttachment)[];
43
41
  error: any[];
44
42
  };
45
- export declare type SingleUploadFinishedDetails = {
43
+ export type SingleUploadFinishedDetails = {
46
44
  success: UploadedAttachment | OfflineSavedAttachment;
47
45
  error: any[];
48
46
  };
@@ -1,24 +1,33 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import '@unicef-polymer/etools-dialog/etools-dialog';
8
- import '@unicef-polymer/etools-upload/etools-upload-multi';
9
- import '@unicef-polymer/etools-dropdown/etools-dropdown';
10
- import '@polymer/paper-button/paper-button';
11
- import '@polymer/iron-icons/iron-icons';
12
- import { css, customElement, LitElement, property, query } from 'lit-element';
1
+ import { __decorate } from "tslib";
2
+ import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog';
3
+ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
4
+ import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown';
5
+ import { deleteFileFromDexie } from '@unicef-polymer/etools-unicef/src/etools-upload/offline/dexie-operations';
6
+ import { css, LitElement } from 'lit';
7
+ import { property, query, customElement } from 'lit/decorators.js';
13
8
  import { clone, equals } from 'ramda';
14
9
  import { template } from './form-attachments-popup.tpl';
15
10
  import { fireEvent } from '../lib/utils/fire-custom-event';
16
11
  import { SharedStyles } from '../lib/styles/shared-styles';
17
12
  import { AttachmentsStyles } from '../lib/styles/attachments.styles';
18
13
  import { AttachmentsHelper } from './form-attachments-popup.helper';
19
- import { deleteFileFromDexie } from '@unicef-polymer/etools-upload/offline/dexie-operations';
20
14
  import { getTranslation } from '../lib/utils/translate';
21
15
  let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
16
+ set dialogData({ attachments, title, metadata, readonly, computedPath, errors }) {
17
+ this.popupTitle = title;
18
+ this.attachments = clone(attachments) || [];
19
+ this.originalAttachments = clone(attachments) || [];
20
+ this.metadata = clone(metadata);
21
+ this.readonly = Boolean(readonly);
22
+ this.computedPath = computedPath;
23
+ this.errors = clone(errors) || [];
24
+ }
25
+ get uploadUrl() {
26
+ return AttachmentsHelper.uploadUrl;
27
+ }
28
+ get jwtLocalStorageKey() {
29
+ return AttachmentsHelper.jwtLocalStorageKey;
30
+ }
22
31
  constructor() {
23
32
  super();
24
33
  this.dialogOpened = true;
@@ -41,21 +50,6 @@ let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
41
50
  this.language = window.localStorage.defaultLanguage || 'en';
42
51
  }
43
52
  }
44
- set dialogData({ attachments, title, metadata, readonly, computedPath, errors }) {
45
- this.popupTitle = title;
46
- this.attachments = clone(attachments) || [];
47
- this.originalAttachments = clone(attachments) || [];
48
- this.metadata = clone(metadata);
49
- this.readonly = Boolean(readonly);
50
- this.computedPath = computedPath;
51
- this.errors = clone(errors) || [];
52
- }
53
- get uploadUrl() {
54
- return AttachmentsHelper.uploadUrl;
55
- }
56
- get jwtLocalStorageKey() {
57
- return AttachmentsHelper.jwtLocalStorageKey;
58
- }
59
53
  render() {
60
54
  return template.call(this);
61
55
  }
@@ -1,3 +1,7 @@
1
1
  import { FormAttachmentsPopup } from './form-attachments-popup';
2
2
  import { TemplateResult } from 'lit-html';
3
+ import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog.js';
4
+ import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown.js';
5
+ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
6
+ import '@shoelace-style/shoelace/dist/components/button/button.js';
3
7
  export declare function template(this: FormAttachmentsPopup): TemplateResult;
@@ -2,10 +2,18 @@ import { html } from 'lit-html';
2
2
  import { InputStyles } from '../lib/styles/input-styles';
3
3
  import { DialogStyles } from '../lib/styles/dialog.styles';
4
4
  import { getTranslation } from '../lib/utils/translate';
5
+ import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog.js';
6
+ import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown.js';
7
+ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
8
+ import '@shoelace-style/shoelace/dist/components/button/button.js';
9
+ import { buttonsStyles } from '@unicef-polymer/etools-unicef/src/styles/button-styles';
5
10
  export function template() {
6
11
  var _a;
7
12
  return html `
8
13
  ${InputStyles} ${DialogStyles}
14
+ <style>
15
+ ${buttonsStyles}
16
+ </style>
9
17
  <etools-dialog
10
18
  id="form-attachments-dialog"
11
19
  size="md"
@@ -49,28 +57,31 @@ export function template() {
49
57
 
50
58
  <!-- File name component -->
51
59
  <div class="filename-container file-selector__filename">
52
- <iron-icon class="file-icon" icon="attachment"></iron-icon>
60
+ <etools-icon class="file-icon" name="attachment"></etools-icon>
53
61
  <span class="filename" title="${attachment.filename}">${attachment.filename}</span>
54
62
  </div>
55
63
 
56
64
  <!-- Download Button -->
57
- <paper-button
65
+ <sl-button
66
+ class="neutral"
67
+ variant="text"
58
68
  ?hidden="${!attachment.url}"
59
69
  class="download-button file-selector__download"
60
- @tap="${() => this.downloadFile(attachment)}"
70
+ @click="${this.downloadFile(attachment)}"
61
71
  >
62
- <iron-icon icon="cloud-download" class="dw-icon"></iron-icon>
72
+ <etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
63
73
  ${getTranslation(this.language, 'DOWNLOAD')}
64
- </paper-button>
74
+ </sl-button>
65
75
 
66
76
  <!-- Delete Button -->
67
- <paper-button
77
+ <sl-button
78
+ variant="danger"
68
79
  class="delete-button file-selector__delete"
69
80
  ?hidden="${this.readonly}"
70
- @tap="${() => this.deleteAttachment(index)}"
81
+ @click="${this.deleteAttachment(index)}"
71
82
  >
72
83
  ${getTranslation(this.language, 'DELETE')}
73
- </paper-button>
84
+ </sl-button>
74
85
  </div>
75
86
  `;
76
87
  })}
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
1
+ import { CSSResultArray, LitElement, TemplateResult } from 'lit';
2
2
  import { FieldValidator } from '../lib/utils/validations.helper';
3
3
  /**
4
4
  * Class that contains common properties and methods for single and repeatable fields
@@ -1,16 +1,25 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { LitElement, property, css, html } from 'lit-element';
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { property } from 'lit/decorators.js';
8
4
  import { validate } from '../lib/utils/validations.helper';
9
5
  import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
10
6
  /**
11
7
  * Class that contains common properties and methods for single and repeatable fields
12
8
  */
13
9
  export class AbstractFieldBaseClass extends LitElement {
10
+ set isReadonly(readonly) {
11
+ this._readonly = readonly;
12
+ this.setDefaultValue(readonly, this._defaultValue);
13
+ this.requestUpdate();
14
+ }
15
+ get isReadonly() {
16
+ return this._readonly;
17
+ }
18
+ set defaultValue(value) {
19
+ this._defaultValue = value;
20
+ this.setDefaultValue(this._readonly, value);
21
+ this.requestUpdate();
22
+ }
14
23
  constructor() {
15
24
  super();
16
25
  this.questionText = '';
@@ -25,19 +34,6 @@ export class AbstractFieldBaseClass extends LitElement {
25
34
  }
26
35
  this.handleLanguageChange = this.handleLanguageChange.bind(this);
27
36
  }
28
- set isReadonly(readonly) {
29
- this._readonly = readonly;
30
- this.setDefaultValue(readonly, this._defaultValue);
31
- this.requestUpdate();
32
- }
33
- get isReadonly() {
34
- return this._readonly;
35
- }
36
- set defaultValue(value) {
37
- this._defaultValue = value;
38
- this.setDefaultValue(this._readonly, value);
39
- this.requestUpdate();
40
- }
41
37
  connectedCallback() {
42
38
  super.connectedCallback();
43
39
  document.addEventListener('language-changed', this.handleLanguageChange.bind(this));
@@ -1,4 +1,4 @@
1
- import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
1
+ import { CSSResultArray, LitElement, TemplateResult } from 'lit';
2
2
  import { BlueprintField } from '../lib/types/form-builder.types';
3
3
  import { FieldValidator } from '../lib/utils/validations.helper';
4
4
  import { FieldOption } from './single-fields/scale-field';
@@ -1,10 +1,6 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { css, customElement, html, LitElement, property } from 'lit-element';
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
8
4
  import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
9
5
  import { FieldTypes, StructureTypes } from '../form-groups';
10
6
  import { FormBuilderCardStyles } from '../lib/styles/form-builder-card.styles';
File without changes
File without changes
@@ -1,7 +1,9 @@
1
- import '@unicef-polymer/etools-upload/etools-upload';
1
+ 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
- import { TemplateResult, CSSResultArray } from 'lit-element';
4
+ import { CSSResultArray, TemplateResult } from 'lit';
5
+ import '@shoelace-style/shoelace/dist/components/button/button.js';
6
+ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
5
7
  export declare class RepeatableAttachmentField extends RepeatableBaseField<StoredAttachment> {
6
8
  get uploadUrl(): string;
7
9
  get jwtLocalStorageKey(): string;
@@ -1,17 +1,16 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import '@unicef-polymer/etools-upload/etools-upload';
1
+ import { __decorate } from "tslib";
2
+ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload';
8
3
  import { RepeatableBaseField } from './repeatable-base-field';
9
4
  import { AttachmentsHelper } from '../../form-attachments-popup';
10
- import { html, css, customElement } from 'lit-element';
5
+ import { css, html } from 'lit';
6
+ import { customElement } from 'lit/decorators.js';
11
7
  import { fireEvent } from '../../lib/utils/fire-custom-event';
12
8
  import { SharedStyles } from '../../lib/styles/shared-styles';
13
9
  import { AttachmentsStyles } from '../../lib/styles/attachments.styles';
14
10
  import { getTranslation } from '../../lib/utils/translate';
11
+ import '@shoelace-style/shoelace/dist/components/button/button.js';
12
+ import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
13
+ import { buttonsStyles } from '@unicef-polymer/etools-unicef/src/styles/button-styles';
15
14
  let RepeatableAttachmentField = class RepeatableAttachmentField extends RepeatableBaseField {
16
15
  constructor() {
17
16
  super(...arguments);
@@ -35,28 +34,31 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
35
34
  <div class="layout horizontal file-container">
36
35
  <!-- File name component -->
37
36
  <div class="filename-container file-selector__filename">
38
- <iron-icon class="file-icon" icon="attachment"></iron-icon>
37
+ <etools-icon class="file-icon" name="attachment"></etools-icon>
39
38
  <span class="filename" title="${value.filename}">${value.filename}</span>
40
39
  </div>
41
40
 
42
41
  <!-- Download Button -->
43
- <paper-button
42
+ <sl-button
43
+ class="neutral"
44
+ variant="text"
44
45
  ?hidden="${!value.url}"
45
46
  class="download-button file-selector__download"
46
- @tap="${() => this.downloadFile(value)}"
47
+ @click="${this.downloadFile(value)}"
47
48
  >
48
- <iron-icon icon="cloud-download" class="dw-icon"></iron-icon>
49
+ <etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
49
50
  ${getTranslation(this.language, 'DOWNLOAD')}
50
- </paper-button>
51
+ </sl-button>
51
52
 
52
53
  <!-- Delete Button -->
53
- <paper-button
54
+ <sl-button
55
+ variant="danger"
54
56
  class="delete-button file-selector__delete"
55
57
  ?hidden="${this.isReadonly}"
56
- @tap="${() => this.removeControl(index)}"
58
+ @click="${this.removeControl(index)}"
57
59
  >
58
60
  ${getTranslation(this.language, 'DELETE')}
59
- </paper-button>
61
+ </sl-button>
60
62
  </div>
61
63
  `
62
64
  : '')}
@@ -135,6 +137,7 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
135
137
  ...RepeatableBaseField.styles,
136
138
  SharedStyles,
137
139
  AttachmentsStyles,
140
+ buttonsStyles,
138
141
  css `
139
142
  .file-selector__type-dropdown {
140
143
  flex-basis: 25%;
@@ -1,4 +1,5 @@
1
- import { CSSResultArray, TemplateResult } from 'lit-element';
1
+ import { CSSResultArray, TemplateResult } from 'lit';
2
+ import '@unicef-polymer/etools-unicef/src/etools-icon-button/etools-icon-button';
2
3
  import { AbstractFieldBaseClass } from '../abstract-field-base.class';
3
4
  export declare abstract class RepeatableBaseField<T> extends AbstractFieldBaseClass<T[]> {
4
5
  set errorMessage(messages: (string | null)[]);
@@ -1,10 +1,7 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { css, html, property } from 'lit-element';
1
+ import { __decorate } from "tslib";
2
+ import { css, html } from 'lit';
3
+ import { property } from 'lit/decorators.js';
4
+ import '@unicef-polymer/etools-unicef/src/etools-icon-button/etools-icon-button';
8
5
  import { AbstractFieldBaseClass } from '../abstract-field-base.class';
9
6
  import { fireEvent } from '../../lib/utils/fire-custom-event';
10
7
  import { getTranslation } from '../../lib/utils/translate';
@@ -28,15 +25,15 @@ export class RepeatableBaseField extends AbstractFieldBaseClass {
28
25
  <div class="question-control layout vertical center-justified start">
29
26
  ${values.map((value, index) => html `<div class="layout horizontal center full-width">
30
27
  ${this.controlTemplate(value, index)}
31
- <iron-icon
32
- icon="close"
28
+ <etools-icon-button
29
+ name="close"
33
30
  ?hidden="${this.isReadonly || values.length < 2}"
34
31
  @click="${() => this.removeControl(index)}"
35
- ></iron-icon>
32
+ ></etools-icon-button>
36
33
  </div>`)}
37
- <paper-button class="add-button" ?hidden="${this.isReadonly}" @click="${() => this.addNewField()}">
34
+ <sl-button variant="primary" class="add-button" ?hidden="${this.isReadonly}" @click="${this.addNewField}">
38
35
  ${getTranslation(this.language, 'ADD')}
39
- </paper-button>
36
+ </sl-button>
40
37
  </div>
41
38
  </div>
42
39
  `;
@@ -1,5 +1,5 @@
1
- import { CSSResultArray, TemplateResult } from 'lit-element';
2
- import '@polymer/paper-input/paper-input';
1
+ import { CSSResultArray, TemplateResult } from 'lit';
2
+ import '@unicef-polymer/etools-unicef/src/etools-input/etools-input';
3
3
  import { RepeatableBaseField } from './repeatable-base-field';
4
4
  export declare class RepeatableNumberField extends RepeatableBaseField<number> {
5
5
  isInteger: boolean;
@@ -1,11 +1,7 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { css, customElement, html } from 'lit-element';
8
- import '@polymer/paper-input/paper-input';
1
+ import { __decorate } from "tslib";
2
+ import { css, html } from 'lit';
3
+ import { customElement } from 'lit/decorators.js';
4
+ import '@unicef-polymer/etools-unicef/src/etools-input/etools-input';
9
5
  import { InputStyles } from '../../lib/styles/input-styles';
10
6
  import { RepeatableBaseField } from './repeatable-base-field';
11
7
  import { AbstractFieldBaseClass } from '../abstract-field-base.class';
@@ -18,7 +14,7 @@ let RepeatableNumberField = class RepeatableNumberField extends RepeatableBaseFi
18
14
  controlTemplate(value, index) {
19
15
  return html `
20
16
  ${InputStyles}
21
- <paper-input
17
+ <etools-input
22
18
  class="no-padding-left"
23
19
  no-label-float
24
20
  placeholder="${this.isReadonly ? '—' : this.placeholder}"
@@ -29,7 +25,7 @@ let RepeatableNumberField = class RepeatableNumberField extends RepeatableBaseFi
29
25
  error-message="${this.errorMessage[index]}"
30
26
  ?readonly="${this.isReadonly}"
31
27
  >
32
- </paper-input>
28
+ </etools-input>
33
29
  `;
34
30
  }
35
31
  valueChanged(newValue, index) {
@@ -1,13 +1,13 @@
1
- import { TemplateResult, CSSResultArray } from 'lit-element';
2
- import '@polymer/paper-radio-group/paper-radio-group';
3
- import '@polymer/paper-radio-button/paper-radio-button';
4
- import { PaperRadioButtonElement } from '@polymer/paper-radio-button/paper-radio-button';
1
+ import { CSSResultArray, TemplateResult } from 'lit';
2
+ import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
3
+ import '@shoelace-style/shoelace/dist/components/radio/radio.js';
4
+ import '@shoelace-style/shoelace/dist/components/button/button.js';
5
5
  import { RepeatableBaseField } from './repeatable-base-field';
6
6
  import { FieldOption } from '..';
7
7
  export declare class RepeatableScaleField extends RepeatableBaseField<string | number | null> {
8
8
  options: (FieldOption | string | number)[];
9
9
  protected controlTemplate(value: string | null, index: number): TemplateResult;
10
- protected onSelect(item: PaperRadioButtonElement, index: number): void;
10
+ protected onSelect(itemValue: string, index: number): void;
11
11
  protected getLabel(option: FieldOption | string | number): unknown;
12
12
  protected getValue(option: FieldOption | string | number): unknown;
13
13
  protected customValidation(): string | null;
@@ -1,15 +1,14 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { html, property, css, customElement } from 'lit-element';
8
- import { repeat } from 'lit-html/directives/repeat';
9
- import '@polymer/paper-radio-group/paper-radio-group';
10
- import '@polymer/paper-radio-button/paper-radio-button';
1
+ import { __decorate } from "tslib";
2
+ import { css, html } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
4
+ import { repeat } from 'lit/directives/repeat.js';
5
+ import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
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';
11
9
  import { InputStyles } from '../../lib/styles/input-styles';
12
10
  import { RepeatableBaseField } from './repeatable-base-field';
11
+ import { getTranslation } from '../../lib/utils/translate';
13
12
  import { AbstractFieldBaseClass } from '../abstract-field-base.class';
14
13
  let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseField {
15
14
  constructor() {
@@ -20,31 +19,29 @@ let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseFiel
20
19
  return html `
21
20
  ${InputStyles}
22
21
  <div class="container">
23
- <paper-radio-group
22
+ <sl-radio-group
24
23
  class="radio-group"
25
- selected="${value}"
26
- @iron-select="${({ detail }) => this.onSelect(detail.item, index)}"
24
+ .value="${value}"
25
+ @sl-change="${(e) => this.onSelect(e.target.value, index)}"
27
26
  >
28
27
  ${repeat(this.options, (option) => html `
29
- <paper-radio-button class="radio-button" name="${this.getValue(option)}">
30
- ${this.getLabel(option)}
31
- </paper-radio-button>
28
+ <sl-radio class="radio-button" value="${this.getValue(option)}"> ${this.getLabel(option)} </sl-radio>
32
29
  `)}
33
- </paper-radio-group>
34
-
35
- <paper-button
30
+ </sl-radio-group>
31
+ <sl-button
32
+ variant="primary"
36
33
  ?hidden="${this.isReadonly}"
37
34
  @click="${() => this.valueChanged(null, index)}"
38
35
  class="clear-button"
39
36
  >
40
- <iron-icon icon="clear"></iron-icon>Clear
41
- </paper-button>
37
+ <etools-icon name="clear" slot="prefix"></etools-icon>
38
+ ${getTranslation(this.language, 'CLEAR')}
39
+ </sl-button>
42
40
  </div>
43
41
  `;
44
42
  }
45
- onSelect(item, index) {
46
- const newValue = item.get('name');
47
- this.valueChanged(newValue, index);
43
+ onSelect(itemValue, index) {
44
+ this.valueChanged(itemValue, index);
48
45
  }
49
46
  getLabel(option) {
50
47
  return typeof option === 'object' ? option.label : option;
@@ -59,6 +56,7 @@ let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseFiel
59
56
  // language=CSS
60
57
  return [
61
58
  ...AbstractFieldBaseClass.styles,
59
+ buttonsStyles,
62
60
  css `
63
61
  .container {
64
62
  position: relative;
@@ -1,5 +1,5 @@
1
- import { CSSResultArray, TemplateResult } from 'lit-element';
2
- import '@polymer/paper-input/paper-textarea';
1
+ import { CSSResultArray, TemplateResult } from 'lit';
2
+ import '@unicef-polymer/etools-unicef/src/etools-input/etools-textarea';
3
3
  import { RepeatableBaseField } from './repeatable-base-field';
4
4
  export declare class RepeatableTextField extends RepeatableBaseField<string> {
5
5
  protected controlTemplate(value: string | null, index: number): TemplateResult;
@@ -1,11 +1,7 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { css, customElement, html } from 'lit-element';
8
- import '@polymer/paper-input/paper-textarea';
1
+ import { __decorate } from "tslib";
2
+ import { css, html } from 'lit';
3
+ import { customElement } from 'lit/decorators.js';
4
+ import '@unicef-polymer/etools-unicef/src/etools-input/etools-textarea';
9
5
  import { InputStyles } from '../../lib/styles/input-styles';
10
6
  import { RepeatableBaseField } from './repeatable-base-field';
11
7
  import { AbstractFieldBaseClass } from '../abstract-field-base.class';
@@ -13,7 +9,7 @@ let RepeatableTextField = class RepeatableTextField extends RepeatableBaseField
13
9
  controlTemplate(value, index) {
14
10
  return html `
15
11
  ${InputStyles}
16
- <paper-textarea
12
+ <etools-textarea
17
13
  id="textarea"
18
14
  class="no-padding-left"
19
15
  no-label-float
@@ -24,7 +20,7 @@ let RepeatableTextField = class RepeatableTextField extends RepeatableBaseField
24
20
  ?invalid="${this.errorMessage[index]}"
25
21
  error-message="${this.errorMessage[index]}"
26
22
  >
27
- </paper-textarea>
23
+ </etools-textarea>
28
24
  `;
29
25
  }
30
26
  customValidation() {