@refinitiv-ui/elements 5.6.0 → 5.8.2-alpha.0

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 (185) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/lib/accordion/custom-elements.md +18 -0
  3. package/lib/appstate-bar/custom-elements.md +22 -0
  4. package/lib/autosuggest/custom-elements.json +24 -4
  5. package/lib/autosuggest/custom-elements.md +54 -0
  6. package/lib/autosuggest/index.d.ts +4 -0
  7. package/lib/autosuggest/index.js +4 -0
  8. package/lib/button/custom-elements.json +2 -2
  9. package/lib/button/custom-elements.md +23 -0
  10. package/lib/button-bar/custom-elements.md +9 -0
  11. package/lib/calendar/custom-elements.json +8 -6
  12. package/lib/calendar/custom-elements.md +35 -0
  13. package/lib/calendar/index.d.ts +2 -0
  14. package/lib/calendar/index.js +2 -0
  15. package/lib/canvas/custom-elements.json +7 -5
  16. package/lib/canvas/custom-elements.md +27 -0
  17. package/lib/canvas/index.d.ts +1 -0
  18. package/lib/canvas/index.js +1 -0
  19. package/lib/card/custom-elements.json +3 -1
  20. package/lib/card/custom-elements.md +24 -0
  21. package/lib/card/index.d.ts +2 -0
  22. package/lib/card/index.js +2 -0
  23. package/lib/chart/custom-elements.json +1 -1
  24. package/lib/chart/custom-elements.md +16 -0
  25. package/lib/checkbox/custom-elements.json +12 -8
  26. package/lib/checkbox/custom-elements.md +18 -0
  27. package/lib/checkbox/index.d.ts +3 -1
  28. package/lib/checkbox/index.js +2 -0
  29. package/lib/clock/custom-elements.json +8 -4
  30. package/lib/clock/custom-elements.md +28 -0
  31. package/lib/clock/index.d.ts +2 -0
  32. package/lib/clock/index.js +2 -0
  33. package/lib/clock/themes/halo/dark/index.js +1 -1
  34. package/lib/clock/themes/halo/light/index.js +1 -1
  35. package/lib/clock/themes/solar/charcoal/index.js +1 -1
  36. package/lib/clock/themes/solar/pearl/index.js +1 -1
  37. package/lib/collapse/custom-elements.md +27 -0
  38. package/lib/color-dialog/custom-elements.json +29 -16
  39. package/lib/color-dialog/custom-elements.md +39 -0
  40. package/lib/color-dialog/index.d.ts +8 -8
  41. package/lib/color-dialog/index.js +8 -8
  42. package/lib/combo-box/custom-elements.json +28 -16
  43. package/lib/combo-box/custom-elements.md +35 -0
  44. package/lib/combo-box/index.d.ts +10 -2
  45. package/lib/combo-box/index.js +10 -1
  46. package/lib/combo-box/themes/halo/dark/index.js +1 -1
  47. package/lib/combo-box/themes/halo/light/index.js +1 -1
  48. package/lib/combo-box/themes/solar/charcoal/index.js +1 -1
  49. package/lib/combo-box/themes/solar/pearl/index.js +1 -1
  50. package/lib/counter/custom-elements.json +8 -4
  51. package/lib/counter/custom-elements.md +11 -0
  52. package/lib/counter/index.d.ts +2 -0
  53. package/lib/counter/index.js +2 -0
  54. package/lib/datetime-picker/custom-elements.json +52 -23
  55. package/lib/datetime-picker/custom-elements.md +57 -0
  56. package/lib/datetime-picker/index.d.ts +15 -4
  57. package/lib/datetime-picker/index.js +15 -4
  58. package/lib/dialog/custom-elements.json +34 -12
  59. package/lib/dialog/custom-elements.md +47 -0
  60. package/lib/dialog/index.d.ts +7 -10
  61. package/lib/dialog/index.js +7 -10
  62. package/lib/email-field/custom-elements.json +81 -94
  63. package/lib/email-field/custom-elements.md +37 -0
  64. package/lib/email-field/index.d.ts +43 -115
  65. package/lib/email-field/index.js +44 -244
  66. package/lib/flag/custom-elements.md +10 -0
  67. package/lib/flag/index.d.ts +2 -0
  68. package/lib/flag/index.js +2 -0
  69. package/lib/header/custom-elements.md +18 -0
  70. package/lib/heatmap/custom-elements.md +26 -0
  71. package/lib/icon/custom-elements.md +8 -0
  72. package/lib/icon/index.d.ts +2 -0
  73. package/lib/icon/index.js +2 -0
  74. package/lib/interactive-chart/custom-elements.json +6 -10
  75. package/lib/interactive-chart/custom-elements.md +31 -0
  76. package/lib/interactive-chart/index.d.ts +5 -2
  77. package/lib/interactive-chart/index.js +5 -2
  78. package/lib/item/custom-elements.json +4 -4
  79. package/lib/item/custom-elements.md +29 -0
  80. package/lib/item/index.d.ts +11 -2
  81. package/lib/item/index.js +25 -4
  82. package/lib/label/custom-elements.md +11 -0
  83. package/lib/layout/custom-elements.md +26 -0
  84. package/lib/led-gauge/custom-elements.json +4 -4
  85. package/lib/led-gauge/custom-elements.md +17 -0
  86. package/lib/led-gauge/index.d.ts +1 -0
  87. package/lib/led-gauge/index.js +1 -0
  88. package/lib/list/custom-elements.json +18 -5
  89. package/lib/list/custom-elements.md +32 -0
  90. package/lib/list/helpers/list-renderer.js +2 -0
  91. package/lib/list/index.d.ts +19 -2
  92. package/lib/list/index.js +34 -1
  93. package/lib/loader/custom-elements.md +5 -0
  94. package/lib/multi-input/custom-elements.json +7 -6
  95. package/lib/multi-input/custom-elements.md +43 -0
  96. package/lib/multi-input/index.d.ts +4 -0
  97. package/lib/multi-input/index.js +4 -0
  98. package/lib/notification/custom-elements.md +26 -0
  99. package/lib/number-field/custom-elements.json +99 -54
  100. package/lib/number-field/custom-elements.md +42 -0
  101. package/lib/number-field/index.d.ts +92 -47
  102. package/lib/number-field/index.js +113 -80
  103. package/lib/overlay/custom-elements.json +26 -13
  104. package/lib/overlay/custom-elements.md +54 -0
  105. package/lib/overlay/elements/overlay.d.ts +5 -0
  106. package/lib/overlay-menu/custom-elements.json +70 -20
  107. package/lib/overlay-menu/custom-elements.md +44 -0
  108. package/lib/overlay-menu/index.d.ts +13 -11
  109. package/lib/overlay-menu/index.js +13 -11
  110. package/lib/pagination/custom-elements.md +27 -0
  111. package/lib/panel/custom-elements.md +11 -0
  112. package/lib/password-field/custom-elements.json +62 -67
  113. package/lib/password-field/custom-elements.md +39 -0
  114. package/lib/password-field/index.d.ts +42 -94
  115. package/lib/password-field/index.js +48 -194
  116. package/lib/pill/custom-elements.json +8 -6
  117. package/lib/pill/custom-elements.md +22 -0
  118. package/lib/pill/index.d.ts +1 -1
  119. package/lib/pill/index.js +1 -1
  120. package/lib/progress-bar/custom-elements.md +18 -0
  121. package/lib/radio-button/custom-elements.json +8 -6
  122. package/lib/radio-button/custom-elements.md +19 -0
  123. package/lib/radio-button/index.d.ts +6 -5
  124. package/lib/radio-button/index.js +5 -4
  125. package/lib/rating/custom-elements.md +17 -0
  126. package/lib/search-field/custom-elements.json +70 -74
  127. package/lib/search-field/custom-elements.md +41 -0
  128. package/lib/search-field/index.d.ts +43 -100
  129. package/lib/search-field/index.js +46 -215
  130. package/lib/select/custom-elements.json +5 -4
  131. package/lib/select/custom-elements.md +24 -0
  132. package/lib/select/index.d.ts +11 -3
  133. package/lib/select/index.js +65 -26
  134. package/lib/sidebar-layout/custom-elements.json +2 -6
  135. package/lib/sidebar-layout/custom-elements.md +21 -0
  136. package/lib/sidebar-layout/index.d.ts +2 -1
  137. package/lib/slider/custom-elements.json +4 -4
  138. package/lib/slider/custom-elements.md +28 -0
  139. package/lib/slider/index.d.ts +1 -1
  140. package/lib/slider/index.js +1 -1
  141. package/lib/sparkline/custom-elements.json +4 -4
  142. package/lib/sparkline/custom-elements.md +16 -0
  143. package/lib/sparkline/index.d.ts +3 -1
  144. package/lib/sparkline/index.js +2 -0
  145. package/lib/swing-gauge/custom-elements.json +5 -3
  146. package/lib/swing-gauge/custom-elements.md +17 -0
  147. package/lib/swing-gauge/index.d.ts +3 -1
  148. package/lib/swing-gauge/index.js +3 -1
  149. package/lib/tab/custom-elements.json +2 -2
  150. package/lib/tab/custom-elements.md +22 -0
  151. package/lib/tab-bar/custom-elements.md +11 -0
  152. package/lib/text-field/custom-elements.json +78 -89
  153. package/lib/text-field/custom-elements.md +35 -0
  154. package/lib/text-field/index.d.ts +50 -92
  155. package/lib/text-field/index.js +81 -230
  156. package/lib/time-picker/custom-elements.json +4 -4
  157. package/lib/time-picker/custom-elements.md +28 -0
  158. package/lib/time-picker/index.d.ts +3 -0
  159. package/lib/time-picker/index.js +3 -0
  160. package/lib/toggle/custom-elements.json +8 -6
  161. package/lib/toggle/custom-elements.md +19 -0
  162. package/lib/toggle/index.d.ts +2 -1
  163. package/lib/toggle/index.js +1 -0
  164. package/lib/tooltip/custom-elements.md +14 -0
  165. package/lib/tornado-chart/custom-elements.md +18 -0
  166. package/lib/tree/custom-elements.json +4 -3
  167. package/lib/tree/custom-elements.md +32 -0
  168. package/lib/tree/elements/tree.d.ts +1 -0
  169. package/lib/tree/elements/tree.js +1 -0
  170. package/lib/tree/managers/tree-manager.d.ts +20 -2
  171. package/lib/tree/managers/tree-manager.js +55 -28
  172. package/lib/tree/themes/halo/dark/index.js +1 -1
  173. package/lib/tree/themes/halo/light/index.js +1 -1
  174. package/lib/tree/themes/solar/charcoal/index.js +1 -1
  175. package/lib/tree/themes/solar/pearl/index.js +1 -1
  176. package/lib/tree-select/custom-elements.json +10 -6
  177. package/lib/tree-select/custom-elements.md +26 -0
  178. package/lib/tree-select/index.d.ts +5 -3
  179. package/lib/tree-select/index.js +3 -2
  180. package/lib/tree-select/themes/halo/dark/index.js +1 -1
  181. package/lib/tree-select/themes/halo/light/index.js +1 -1
  182. package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
  183. package/lib/tree-select/themes/solar/pearl/index.js +1 -1
  184. package/lib/version.js +1 -1
  185. package/package.json +293 -12
@@ -1,76 +1,55 @@
1
1
  import { JSXInterface } from '../jsx';
2
- import { ControlElement, CSSResultGroup, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
2
+ import { PropertyValues, TemplateResult } from '@refinitiv-ui/core';
3
+ import { TemplateMap } from '@refinitiv-ui/core/lib/directives/template-map.js';
4
+ import { TextField } from '../text-field/index.js';
3
5
  import '../icon/index.js';
6
+ import '@refinitiv-ui/phrasebook/lib/locale/en/password-field.js';
7
+ import { Translate } from '@refinitiv-ui/translate';
4
8
  /**
5
- * A form control element for password
9
+ * A form control element for password.
6
10
  *
7
11
  * @fires value-changed - Dispatched when value changes
8
12
  * @fires error-changed - Dispatched when error state changes
13
+ * @fires icon-click - Dispatched when icon is clicked
9
14
  *
10
- * @attr {string} value - Input's value
11
- * @prop {string} [value=] - Input's value
15
+ * @attr {boolean} disabled - Set disabled state
16
+ * @prop {boolean} [disabled=false] - Set disabled state
17
+ *
18
+ * @attr {boolean} error - Set error state
19
+ * @prop {boolean} [error=false] - Set error state
20
+ *
21
+ * @attr {number} maxlength - Set character max limit
22
+ * @prop {number | null} [maxLength=null] - Set character max limit
23
+ *
24
+ * @attr {number} minlength - Set character min limit
25
+ * @prop {number | null} [minLength=null] - Set character min limit
26
+ *
27
+ * @prop {string} [pattern=""] - Set regular expression for input validation
28
+ *
29
+ * @attr {string} placeholder - Set placeholder text
30
+ * @prop {string} [placeholder=""] - Set placeholder text
12
31
  *
13
32
  * @attr {boolean} readonly - Set readonly state
14
33
  * @prop {boolean} [readonly=false] - Set readonly state
15
34
  *
16
- * @attr {boolean} disabled - Set disabled state
17
- * @prop {boolean} [disabled=false] - Set disabled state
35
+ * @attr {boolean} transparent - Disables all other states and border/background styles.
36
+ * @prop {boolean} [transparent=false] - Disables all other states and border/background styles.
37
+ *
38
+ * @attr {boolean} warning - Set warning state
39
+ * @prop {boolean} [warning=false] - Set warning state
40
+ *
41
+ * @attr {string} value - Input's value
42
+ * @prop {string} [value=""] - Input's value
18
43
  */
19
- export declare class PasswordField extends ControlElement {
20
- /**
21
- * Element version number
22
- * @returns version number
23
- */
24
- static get version(): string;
25
- /**
26
- * A `CSSResultGroup` that will be used to style the host,
27
- * slotted children and the internal template of the element.
28
- * @return CSS template
29
- */
30
- static get styles(): CSSResultGroup;
31
- /**
32
- * Set regular expression for input validation
33
- */
34
- pattern: string;
35
- /**
36
- * Set placeholder text
37
- */
38
- placeholder: string;
39
- /**
40
- * Set state to error
41
- */
42
- error: boolean;
43
- /**
44
- * Set state to warning
45
- */
46
- warning: boolean;
47
- /**
48
- * Disables all other states and border/background styles.
49
- * Use with advanced composite elements requiring e.g. multi selection in
50
- * combo-box when parent container handles element states.
51
- */
52
- transparent: boolean;
53
- /**
54
- * Set character minimum limit
55
- */
56
- minLength: number | null;
57
- /**
58
- * Set character maximum limit
59
- */
60
- maxLength: number | null;
44
+ export declare class PasswordField extends TextField {
61
45
  /**
62
- * Get native input element from shadow roots
46
+ * Used for translations
63
47
  */
64
- private inputElement;
48
+ protected t: Translate;
65
49
  /**
66
50
  * Defines whether password is visible or not
67
51
  */
68
52
  private isPasswordVisible;
69
- /**
70
- * Select the contents of input
71
- * @return void
72
- */
73
- select(): void;
74
53
  /**
75
54
  * Called when the element’s DOM has been updated and rendered for the first time
76
55
  * @param changedProperties Properties that has changed
@@ -78,52 +57,21 @@ export declare class PasswordField extends ControlElement {
78
57
  */
79
58
  protected firstUpdated(changedProperties: PropertyValues): void;
80
59
  /**
81
- * Called when the element’s DOM has been updated and rendered
82
- * @param changedProperties Properties that has changed
83
- * @return shouldUpdate
84
- */
85
- protected updated(changedProperties: PropertyValues): void;
86
- /**
87
- * A `TemplateResult` that will be used
88
- * to render the updated internal template.
89
- * @return Render template
90
- */
91
- protected render(): TemplateResult;
92
- /**
93
- * Check if input should be re-validated
94
- * True if value changed and pattern or minlength is present
95
- * True if pattern or minlength changed
96
- * @param changedProperties Properties that has changed
97
- * @return True if input should be re-validated
98
- */
99
- private shouldValidateInput;
100
- /**
101
- * check if value is changed and fire event
102
- * @return {void}
103
- */
104
- private onPossibleValueChange;
105
- /**
106
- * validate input according `pattern`, `min` and `max` properties
107
- * change state of `error` property according pattern validation
108
- * @return void
109
- */
110
- private validateInput;
111
- /**
112
- * @param error existing state of error
113
- * @returns true if there is no error and browser is IE11 and minLength more than 0 and value exists
60
+ * Decorate `<input>` element with common properties extended from text-field:
61
+ * type="text|password" - text if password is visible
62
+ * @returns template map
114
63
  */
115
- private shouldValidateForMinLength;
64
+ protected get decorateInputMap(): TemplateMap;
116
65
  /**
117
- * Detect `enter` and `space` keydown and fire
118
- * @param event keydown event
66
+ * Renders icon element
119
67
  * @returns {void}
120
68
  */
121
- private handleKeyDown;
69
+ protected renderIcon(): TemplateResult | null;
122
70
  /**
123
71
  * Toggles password visibility state
124
72
  * @return void
125
73
  */
126
- private togglePasswordVisibility;
74
+ protected togglePasswordVisibility(): void;
127
75
  }
128
76
 
129
77
  declare global {
@@ -133,7 +81,7 @@ declare global {
133
81
 
134
82
  namespace JSX {
135
83
  interface IntrinsicElements {
136
- 'ef-password-field': Partial<PasswordField> | JSXInterface.ControlHTMLAttributes<PasswordField>;
84
+ 'ef-password-field': Partial<PasswordField> | JSXInterface.HTMLAttributes<PasswordField>;
137
85
  }
138
86
  }
139
87
  }
@@ -1,146 +1,56 @@
1
1
  import { __decorate } from "tslib";
2
- import { ControlElement, css, html } from '@refinitiv-ui/core';
2
+ import { html } from '@refinitiv-ui/core';
3
3
  import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
4
- import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
5
- import { query } from '@refinitiv-ui/core/lib/decorators/query.js';
6
- import { ifDefined } from '@refinitiv-ui/core/lib/directives/if-defined.js';
7
- import { VERSION } from '../version.js';
8
- import { isIE } from '@refinitiv-ui/utils/lib/browser.js';
4
+ import { state } from '@refinitiv-ui/core/lib/decorators/state.js';
9
5
  import { preload } from '../icon/index.js';
6
+ import { TextField } from '../text-field/index.js';
10
7
  import '../icon/index.js';
11
- const hasChanged = (newVal, oldVal) => oldVal === undefined ? false : newVal !== oldVal;
8
+ import '@refinitiv-ui/phrasebook/lib/locale/en/password-field.js';
9
+ import { translate } from '@refinitiv-ui/translate';
12
10
  let isEyeOffPreloadRequested = false;
13
11
  /**
14
- * A form control element for password
12
+ * A form control element for password.
15
13
  *
16
14
  * @fires value-changed - Dispatched when value changes
17
15
  * @fires error-changed - Dispatched when error state changes
16
+ * @fires icon-click - Dispatched when icon is clicked
18
17
  *
19
- * @attr {string} value - Input's value
20
- * @prop {string} [value=] - Input's value
18
+ * @attr {boolean} disabled - Set disabled state
19
+ * @prop {boolean} [disabled=false] - Set disabled state
20
+ *
21
+ * @attr {boolean} error - Set error state
22
+ * @prop {boolean} [error=false] - Set error state
23
+ *
24
+ * @attr {number} maxlength - Set character max limit
25
+ * @prop {number | null} [maxLength=null] - Set character max limit
26
+ *
27
+ * @attr {number} minlength - Set character min limit
28
+ * @prop {number | null} [minLength=null] - Set character min limit
29
+ *
30
+ * @prop {string} [pattern=""] - Set regular expression for input validation
31
+ *
32
+ * @attr {string} placeholder - Set placeholder text
33
+ * @prop {string} [placeholder=""] - Set placeholder text
21
34
  *
22
35
  * @attr {boolean} readonly - Set readonly state
23
36
  * @prop {boolean} [readonly=false] - Set readonly state
24
37
  *
25
- * @attr {boolean} disabled - Set disabled state
26
- * @prop {boolean} [disabled=false] - Set disabled state
38
+ * @attr {boolean} transparent - Disables all other states and border/background styles.
39
+ * @prop {boolean} [transparent=false] - Disables all other states and border/background styles.
40
+ *
41
+ * @attr {boolean} warning - Set warning state
42
+ * @prop {boolean} [warning=false] - Set warning state
43
+ *
44
+ * @attr {string} value - Input's value
45
+ * @prop {string} [value=""] - Input's value
27
46
  */
28
- let PasswordField = class PasswordField extends ControlElement {
47
+ let PasswordField = class PasswordField extends TextField {
29
48
  constructor() {
30
49
  super(...arguments);
31
- /**
32
- * Set regular expression for input validation
33
- */
34
- this.pattern = '';
35
- /**
36
- * Set placeholder text
37
- */
38
- this.placeholder = '';
39
- /**
40
- * Set state to error
41
- */
42
- this.error = false;
43
- /**
44
- * Set state to warning
45
- */
46
- this.warning = false;
47
- /**
48
- * Disables all other states and border/background styles.
49
- * Use with advanced composite elements requiring e.g. multi selection in
50
- * combo-box when parent container handles element states.
51
- */
52
- this.transparent = false;
53
- /**
54
- * Set character minimum limit
55
- */
56
- this.minLength = null;
57
- /**
58
- * Set character maximum limit
59
- */
60
- this.maxLength = null;
61
50
  /**
62
51
  * Defines whether password is visible or not
63
52
  */
64
53
  this.isPasswordVisible = false;
65
- /**
66
- * check if value is changed and fire event
67
- * @return {void}
68
- */
69
- this.onPossibleValueChange = () => {
70
- const value = this.inputElement.value;
71
- this.setValueAndNotify(value);
72
- };
73
- /**
74
- * validate input according `pattern`, `min` and `max` properties
75
- * change state of `error` property according pattern validation
76
- * @return void
77
- */
78
- this.validateInput = () => {
79
- let error = !this.inputElement.checkValidity();
80
- if (this.shouldValidateForMinLength(error)) {
81
- error = !!this.minLength && (this.minLength > this.value.length);
82
- }
83
- if (this.error !== error) {
84
- this.error = error;
85
- this.notifyPropertyChange('error', this.error);
86
- }
87
- };
88
- /**
89
- * Detect `enter` and `space` keydown and fire
90
- * @param event keydown event
91
- * @returns {void}
92
- */
93
- this.handleKeyDown = (event) => {
94
- if (event.key === 'Spacebar' || event.key === ' ' || event.key === 'Enter') {
95
- this.togglePasswordVisibility();
96
- }
97
- };
98
- }
99
- /**
100
- * Element version number
101
- * @returns version number
102
- */
103
- static get version() {
104
- return VERSION;
105
- }
106
- /**
107
- * A `CSSResultGroup` that will be used to style the host,
108
- * slotted children and the internal template of the element.
109
- * @return CSS template
110
- */
111
- static get styles() {
112
- return css `
113
- :host {
114
- display: inline-block;
115
- }
116
- :host(:focus), :host input:focus {
117
- outline: none;
118
- }
119
- [part=input] {
120
- font: inherit;
121
- background: none;
122
- color: currentColor;
123
- border: none;
124
- text-align: inherit;
125
- }
126
- :host [part=icon]{
127
- display: flex;
128
- outline: none;
129
- }
130
- :host([transparent]) {
131
- background: none !important;
132
- border: none !important;
133
- }
134
- `;
135
- }
136
- /**
137
- * Select the contents of input
138
- * @return void
139
- */
140
- select() {
141
- if (!this.disabled && !this.readonly) {
142
- this.inputElement.select();
143
- }
144
54
  }
145
55
  /**
146
56
  * Called when the element’s DOM has been updated and rendered for the first time
@@ -155,101 +65,45 @@ let PasswordField = class PasswordField extends ControlElement {
155
65
  }
156
66
  }
157
67
  /**
158
- * Called when the element’s DOM has been updated and rendered
159
- * @param changedProperties Properties that has changed
160
- * @return shouldUpdate
68
+ * Decorate `<input>` element with common properties extended from text-field:
69
+ * type="text|password" - text if password is visible
70
+ * @returns template map
161
71
  */
162
- updated(changedProperties) {
163
- super.updated(changedProperties);
164
- if (this.inputElement.value !== this.value) {
165
- this.inputElement.value = this.value;
166
- }
167
- if (this.shouldValidateInput(changedProperties)) {
168
- this.validateInput();
169
- }
72
+ get decorateInputMap() {
73
+ return Object.assign(Object.assign({}, super.decorateInputMap), { 'type': this.isPasswordVisible ? 'text' : 'password' });
170
74
  }
171
75
  /**
172
- * A `TemplateResult` that will be used
173
- * to render the updated internal template.
174
- * @return Render template
76
+ * Renders icon element
77
+ * @returns {void}
175
78
  */
176
- render() {
79
+ renderIcon() {
177
80
  return html `
178
- <input
179
- type=${this.isPasswordVisible ? 'text' : 'password'}
180
- part="input"
181
- ?readonly="${this.readonly}"
182
- ?disabled="${this.disabled}"
183
- placeholder="${ifDefined(this.placeholder || undefined)}"
184
- minlength="${ifDefined(this.minLength || undefined)}"
185
- maxlength="${ifDefined(this.maxLength || undefined)}"
186
- pattern="${ifDefined(this.pattern || undefined)}"
187
- @input="${this.onPossibleValueChange}"
188
- @change="${this.onPossibleValueChange}"
189
- autocomplete="off"
190
- />
191
81
  <ef-icon
82
+ part="icon"
83
+ role="button"
84
+ tabindex="0"
85
+ aria-label="${this.isPasswordVisible ? this.t('HIDE_PASSWORD') : this.t('SHOW_PASSWORD')}"
192
86
  icon=${this.isPasswordVisible ? 'eye-off' : 'eye'}
193
87
  ?readonly="${this.readonly}"
194
88
  ?disabled="${this.disabled}"
195
89
  @tap="${this.togglePasswordVisibility}"
196
- @keydown="${this.handleKeyDown}"
197
- part="icon"
198
- tabindex="0"
199
90
  ></ef-icon>
200
91
  `;
201
92
  }
202
- /**
203
- * Check if input should be re-validated
204
- * True if value changed and pattern or minlength is present
205
- * True if pattern or minlength changed
206
- * @param changedProperties Properties that has changed
207
- * @return True if input should be re-validated
208
- */
209
- shouldValidateInput(changedProperties) {
210
- return (changedProperties.has('pattern') || !!(this.pattern && changedProperties.has('value')))
211
- || (changedProperties.has('minLength') || !!(this.minLength && changedProperties.has('value')));
212
- }
213
- /**
214
- * @param error existing state of error
215
- * @returns true if there is no error and browser is IE11 and minLength more than 0 and value exists
216
- */
217
- shouldValidateForMinLength(error) {
218
- return !!(!error && isIE && this.minLength && !!this.value);
219
- }
220
93
  /**
221
94
  * Toggles password visibility state
222
95
  * @return void
223
96
  */
224
97
  togglePasswordVisibility() {
225
98
  this.isPasswordVisible = !this.isPasswordVisible;
226
- this.requestUpdate();
227
99
  }
228
100
  };
229
101
  __decorate([
230
- property({ type: String, hasChanged })
231
- ], PasswordField.prototype, "pattern", void 0);
232
- __decorate([
233
- property({ type: String })
234
- ], PasswordField.prototype, "placeholder", void 0);
235
- __decorate([
236
- property({ type: Boolean, reflect: true })
237
- ], PasswordField.prototype, "error", void 0);
238
- __decorate([
239
- property({ type: Boolean, reflect: true })
240
- ], PasswordField.prototype, "warning", void 0);
241
- __decorate([
242
- property({ type: Boolean, reflect: true })
243
- ], PasswordField.prototype, "transparent", void 0);
244
- __decorate([
245
- property({ type: Number, attribute: 'minlength', reflect: true, hasChanged })
246
- ], PasswordField.prototype, "minLength", void 0);
247
- __decorate([
248
- property({ type: Number, attribute: 'maxlength', reflect: true })
249
- ], PasswordField.prototype, "maxLength", void 0);
102
+ translate({ scope: 'ef-password-field' })
103
+ ], PasswordField.prototype, "t", void 0);
250
104
  __decorate([
251
- query('[part="input"]')
252
- ], PasswordField.prototype, "inputElement", void 0);
105
+ state()
106
+ ], PasswordField.prototype, "isPasswordVisible", void 0);
253
107
  PasswordField = __decorate([
254
108
  customElement('ef-password-field', {
255
109
  alias: 'coral-password-field'
@@ -26,19 +26,20 @@
26
26
  {
27
27
  "name": "value",
28
28
  "description": "Value of pill",
29
- "type": "string"
29
+ "type": "string",
30
+ "default": "\"\""
30
31
  },
31
32
  {
32
33
  "name": "readonly",
33
34
  "description": "Set readonly state",
34
35
  "type": "boolean",
35
- "default": "\"false\""
36
+ "default": "false"
36
37
  },
37
38
  {
38
39
  "name": "disabled",
39
40
  "description": "Set disabled state",
40
41
  "type": "boolean",
41
- "default": "\"false\""
42
+ "default": "false"
42
43
  }
43
44
  ],
44
45
  "properties": [
@@ -67,21 +68,22 @@
67
68
  "name": "value",
68
69
  "attribute": "value",
69
70
  "description": "Value of pill",
70
- "type": "string"
71
+ "type": "string",
72
+ "default": "\"\""
71
73
  },
72
74
  {
73
75
  "name": "readonly",
74
76
  "attribute": "readonly",
75
77
  "description": "Set readonly state",
76
78
  "type": "boolean",
77
- "default": "\"false\""
79
+ "default": "false"
78
80
  },
79
81
  {
80
82
  "name": "disabled",
81
83
  "attribute": "disabled",
82
84
  "description": "Set disabled state",
83
85
  "type": "boolean",
84
- "default": "\"false\""
86
+ "default": "false"
85
87
  }
86
88
  ],
87
89
  "events": [
@@ -0,0 +1,22 @@
1
+ # ef-pill
2
+
3
+ A small button style component
4
+ which is used to show one or multiple selected item.
5
+ It is rarely used in the UI but inside other components to visualize multiple item selection item.
6
+
7
+ ## Properties
8
+
9
+ | Property | Attribute | Type | Default | Description |
10
+ |------------|------------|-----------|---------|------------------------------|
11
+ | `active` | `active` | `boolean` | false | Add to pill for active state |
12
+ | `clears` | `clears` | `boolean` | false | Set pill to clearable |
13
+ | `disabled` | `disabled` | `boolean` | false | Set disabled state |
14
+ | `readonly` | `readonly` | `boolean` | false | Set readonly state |
15
+ | `toggles` | `toggles` | `boolean` | false | Set pill to toggle mode |
16
+ | `value` | `value` | `string` | "" | Value of pill |
17
+
18
+ ## Events
19
+
20
+ | Event | Description |
21
+ |---------|----------------------------------------------|
22
+ | `clear` | Dispatched when click on cross button occurs |
@@ -6,7 +6,7 @@ import '../icon/index.js';
6
6
  * which is used to show one or multiple selected item.
7
7
  * It is rarely used in the UI but inside other components to visualize multiple item selection item.
8
8
  * @attr {string} value - Value of pill
9
- * @prop {string} value - Value of pill
9
+ * @prop {string} [value=""] - Value of pill
10
10
  *
11
11
  * @attr {boolean} readonly - Set readonly state
12
12
  * @prop {boolean} [readonly=false] - Set readonly state
package/lib/pill/index.js CHANGED
@@ -10,7 +10,7 @@ import '../icon/index.js';
10
10
  * which is used to show one or multiple selected item.
11
11
  * It is rarely used in the UI but inside other components to visualize multiple item selection item.
12
12
  * @attr {string} value - Value of pill
13
- * @prop {string} value - Value of pill
13
+ * @prop {string} [value=""] - Value of pill
14
14
  *
15
15
  * @attr {boolean} readonly - Set readonly state
16
16
  * @prop {boolean} [readonly=false] - Set readonly state
@@ -0,0 +1,18 @@
1
+ # ef-progress-bar
2
+
3
+ Data visualisation component,
4
+ showing a simple percentage bar.
5
+
6
+ ## Properties
7
+
8
+ | Property | Attribute | Type | Default | Description |
9
+ |-------------|-------------|----------|---------|--------------------------------------------------|
10
+ | `alignment` | `alignment` | `string` | "left" | The alignment of the bar.<br />The bar can either start from the `left` or `right`. |
11
+ | `label` | `label` | `string` | "" | The current label to be displayed next to the bar.<br />This is affixed to the end of the bar, so make sure to cater for this. |
12
+ | `value` | `value` | `string` | "100" | The current value of the bar.<br />This can range from `0-100` and<br />will be represented as a percentage bar |
13
+
14
+ ## Slots
15
+
16
+ | Name | Description |
17
+ |---------|--------------------------------------------------|
18
+ | `label` | Overrides the label property and places custom content. Useful for modifying the color, or, adding icons. |
@@ -8,7 +8,8 @@
8
8
  {
9
9
  "name": "checked",
10
10
  "description": "Radio button checked state",
11
- "type": "boolean"
11
+ "type": "boolean",
12
+ "default": "false"
12
13
  },
13
14
  {
14
15
  "name": "value",
@@ -26,13 +27,13 @@
26
27
  "name": "readonly",
27
28
  "description": "Set readonly state",
28
29
  "type": "boolean",
29
- "default": "\"false\""
30
+ "default": "false"
30
31
  },
31
32
  {
32
33
  "name": "disabled",
33
34
  "description": "Set disabled state",
34
35
  "type": "boolean",
35
- "default": "\"false\""
36
+ "default": "false"
36
37
  }
37
38
  ],
38
39
  "properties": [
@@ -40,7 +41,8 @@
40
41
  "name": "checked",
41
42
  "attribute": "checked",
42
43
  "description": "Radio button checked state",
43
- "type": "boolean"
44
+ "type": "boolean",
45
+ "default": "false"
44
46
  },
45
47
  {
46
48
  "name": "value",
@@ -61,14 +63,14 @@
61
63
  "attribute": "readonly",
62
64
  "description": "Set readonly state",
63
65
  "type": "boolean",
64
- "default": "\"false\""
66
+ "default": "false"
65
67
  },
66
68
  {
67
69
  "name": "disabled",
68
70
  "attribute": "disabled",
69
71
  "description": "Set disabled state",
70
72
  "type": "boolean",
71
- "default": "\"false\""
73
+ "default": "false"
72
74
  }
73
75
  ],
74
76
  "events": [
@@ -0,0 +1,19 @@
1
+ # ef-radio-button
2
+
3
+ Basic radio button
4
+
5
+ ## Properties
6
+
7
+ | Property | Attribute | Type | Default | Description |
8
+ |------------|------------|-----------|---------|--------------------------------------------------|
9
+ | `checked` | `checked` | `boolean` | false | Radio button checked state |
10
+ | `disabled` | `disabled` | `boolean` | false | Set disabled state |
11
+ | `name` | `name` | `string` | "" | Group multiple radio buttons by assigning the same name |
12
+ | `readonly` | `readonly` | `boolean` | false | Set readonly state |
13
+ | `value` | `value` | `string` | "" | Value of the radio button |
14
+
15
+ ## Events
16
+
17
+ | Event | Description |
18
+ |-------------------|--------------------------------------------|
19
+ | `checked-changed` | Fired when the `checked` property changes. |