@creative-web-solution/front-library 7.0.7 → 7.1.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 (141) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/DOM/Class.ts +10 -12
  3. package/DOM/DocumentSize.ts +3 -1
  4. package/DOM/Filter.ts +0 -2
  5. package/DOM/Index.ts +1 -3
  6. package/DOM/Manipulation.ts +0 -3
  7. package/DOM/Matrix.ts +12 -12
  8. package/DOM/Offset.ts +4 -5
  9. package/DOM/OuterSize.ts +12 -12
  10. package/DOM/PageToDOM.ts +2 -2
  11. package/DOM/Position.ts +3 -3
  12. package/DOM/Size.ts +3 -7
  13. package/DOM/StrToDOM.ts +0 -1
  14. package/DOM/Styles.ts +3 -12
  15. package/DOM/Traversing.ts +0 -6
  16. package/DOM/WindowScroll.ts +3 -1
  17. package/DOM/WindowSize.ts +3 -1
  18. package/DOM/Wrap.ts +0 -1
  19. package/Events/DeviceOrientation.ts +27 -31
  20. package/Events/EventsManager.ts +10 -25
  21. package/Events/Gesture.ts +36 -37
  22. package/Events/HistoryController.ts +11 -17
  23. package/Events/ImageLoad.ts +35 -19
  24. package/Events/IntersectObserver.ts +15 -19
  25. package/Events/KeyboardHandler.ts +10 -8
  26. package/Events/MediaQueriesEvents.ts +53 -51
  27. package/Events/OnAnimationEnd.ts +2 -3
  28. package/Events/OnTransitionEnd.ts +3 -3
  29. package/Events/PubSub.ts +5 -8
  30. package/Events/TouchHover.ts +18 -21
  31. package/Events/WindowEvents.ts +26 -30
  32. package/Helpers/Colors.ts +7 -23
  33. package/Helpers/Cookie.ts +5 -12
  34. package/Helpers/Coordinates.ts +0 -7
  35. package/Helpers/Debounce.ts +3 -7
  36. package/Helpers/Defer.ts +1 -1
  37. package/Helpers/GetValue.ts +0 -2
  38. package/Helpers/Insert.ts +0 -1
  39. package/Helpers/Sequential.ts +0 -2
  40. package/Helpers/Slice.ts +0 -3
  41. package/Helpers/Throttle.ts +0 -1
  42. package/Helpers/TransitionHelpers.ts +8 -6
  43. package/Helpers/Type.ts +1 -14
  44. package/Helpers/Unique.ts +3 -3
  45. package/Helpers/UrlParser.ts +13 -22
  46. package/Helpers/Wait.ts +1 -1
  47. package/Modules/Accordion/Tab.ts +18 -16
  48. package/Modules/Accordion/index.ts +24 -16
  49. package/Modules/Autocomplete.ts +95 -101
  50. package/Modules/DragSlider.ts +72 -63
  51. package/Modules/GlobalState.ts +60 -53
  52. package/Modules/LoadGMap.ts +4 -7
  53. package/Modules/Notifications/Notification.ts +28 -32
  54. package/Modules/Notifications/index.ts +43 -36
  55. package/Modules/Popin/Popin.ts +100 -110
  56. package/Modules/Popin/PopinAccessibility.ts +8 -8
  57. package/Modules/Popin/PopinBackground.ts +11 -11
  58. package/Modules/Popin/PopinController.ts +23 -29
  59. package/Modules/Popin/Tools.ts +18 -19
  60. package/Modules/QuickTemplate.ts +4 -6
  61. package/Modules/ScrollSnap.ts +110 -104
  62. package/Modules/SkinCheckbox.ts +51 -37
  63. package/Modules/SkinFile.ts +62 -52
  64. package/Modules/SkinRadio.ts +62 -42
  65. package/Modules/SkinSelect.ts +116 -100
  66. package/Modules/Slider/Slide.ts +49 -52
  67. package/Modules/Slider/Slider.ts +100 -136
  68. package/Modules/Slider/SliderControls.ts +60 -59
  69. package/Modules/Tabs/Tab.ts +27 -23
  70. package/Modules/Tabs/index.ts +35 -25
  71. package/Modules/Validator/Date.ts +2 -1
  72. package/Modules/Validator/Equals.ts +1 -1
  73. package/Modules/Validator/Internal/Input.ts +370 -0
  74. package/Modules/Validator/Internal/InputValidator.ts +99 -0
  75. package/Modules/Validator/Internal/ValidatorFunctionsController.ts +58 -0
  76. package/Modules/Validator/Max.ts +1 -1
  77. package/Modules/Validator/Min.ts +1 -1
  78. package/Modules/Validator/MultiRequired.ts +5 -5
  79. package/Modules/Validator/Number.ts +1 -0
  80. package/Modules/Validator/Pattern.ts +1 -1
  81. package/Modules/Validator/Recaptcha.ts +1 -0
  82. package/Modules/Validator/Required.ts +3 -2
  83. package/Modules/Validator/ServerCheck.ts +23 -15
  84. package/Modules/Validator/Tools/GetQueryFromForm.ts +1 -6
  85. package/Modules/Validator/Tools/IsDate.ts +2 -3
  86. package/Modules/Validator/Tools/IsEmail.ts +2 -5
  87. package/Modules/Validator/Tools/IsEmpty.ts +0 -2
  88. package/Modules/Validator/Tools/IsNumber.ts +0 -2
  89. package/Modules/Validator/Tools/IsUrl.ts +1 -3
  90. package/Modules/Validator/Tools/Label.ts +5 -15
  91. package/Modules/Validator/Tools/RadioButton.ts +4 -10
  92. package/Modules/Validator/Url.ts +1 -0
  93. package/Modules/Validator/index.ts +36 -36
  94. package/Modules/YouTubePlayer.ts +18 -16
  95. package/README.md +1 -1
  96. package/Types/Accordion.d.ts +36 -0
  97. package/Types/Autocomplete.d.ts +95 -0
  98. package/Types/DOM.d.ts +69 -0
  99. package/Types/DragSlider.d.ts +56 -0
  100. package/Types/EventsHelpers.d.ts +390 -0
  101. package/Types/GLImageTransition.d.ts +47 -43
  102. package/Types/GlobalState.d.ts +9 -0
  103. package/Types/Helpers.d.ts +30 -0
  104. package/Types/Notifications.d.ts +48 -44
  105. package/Types/Popin.d.ts +95 -0
  106. package/Types/ScrollSnap.d.ts +66 -0
  107. package/Types/SkinCheckbox.d.ts +26 -0
  108. package/Types/SkinFile.d.ts +38 -0
  109. package/Types/SkinRadio.d.ts +28 -0
  110. package/Types/SkinSelect.d.ts +59 -0
  111. package/Types/Slider.d.ts +106 -0
  112. package/Types/Tabs.d.ts +26 -0
  113. package/Types/Validator.d.ts +72 -0
  114. package/Types/YouTubePlayer.d.ts +27 -0
  115. package/Types/index.d.ts +22 -21
  116. package/WebGL/GLImageTransition/GLImageTransition.ts +83 -80
  117. package/WebGL/GLImageTransition/Presets/Cellular.ts +11 -11
  118. package/WebGL/GLImageTransition/Presets/Fade.ts +2 -3
  119. package/WebGL/GLImageTransition/Presets/HorizontalMovingGrid.ts +9 -9
  120. package/WebGL/GLImageTransition/Presets/PresetSample.ts +11 -9
  121. package/WebGL/GLImageTransition/Presets/Solarisation.ts +7 -12
  122. package/package.json +1 -1
  123. package/Modules/Template.ts +0 -209
  124. package/Types/AccordionTypes.d.ts +0 -29
  125. package/Types/AutocompleteTypes.d.ts +0 -85
  126. package/Types/DOMTypes.d.ts +0 -62
  127. package/Types/DragSliderTypes.d.ts +0 -52
  128. package/Types/EventsHelpersTypes.d.ts +0 -370
  129. package/Types/GlobalStateTypes.d.ts +0 -5
  130. package/Types/HelpersTypes.d.ts +0 -23
  131. package/Types/MediaPreloaderTypes.d.ts +0 -12
  132. package/Types/PopinTypes.d.ts +0 -83
  133. package/Types/ScrollSnapTypes.d.ts +0 -62
  134. package/Types/SkinCheckboxTypes.d.ts +0 -23
  135. package/Types/SkinFileTypes.d.ts +0 -34
  136. package/Types/SkinRadioTypes.d.ts +0 -24
  137. package/Types/SkinSelectTypes.d.ts +0 -48
  138. package/Types/SliderTypes.d.ts +0 -97
  139. package/Types/TabsTypes.d.ts +0 -22
  140. package/Types/ValidatorTypes.d.ts +0 -61
  141. package/Types/YouTubePlayerTypes.d.ts +0 -23
@@ -2,7 +2,7 @@ import { extend } from '../Helpers/Extend';
2
2
  import { wrap } from '../DOM/Wrap';
3
3
 
4
4
 
5
- const defaultOptions: SkinCheckboxOptionsType = {
5
+ const defaultOptions: FLib.SkinCheckbox.Options = {
6
6
  "wrap": "<span class=\"cb-skin\"></span>",
7
7
  "invalidClass": "invalid",
8
8
  "disabledClass": "disabled",
@@ -16,15 +16,15 @@ const defaultOptions: SkinCheckboxOptionsType = {
16
16
  */
17
17
  export default class SkinCheckbox {
18
18
 
19
- #$checkbox!: CustomCheckboxType;
20
- #options!: SkinCheckboxOptionsType;
21
- #$parent!: CustomCheckboxParentType;
19
+ #$checkbox!: FLib.SkinCheckbox.CustomCheckbox;
20
+ #options!: FLib.SkinCheckbox.Options;
21
+ #$parent!: FLib.SkinCheckbox.CustomCheckboxParent;
22
22
 
23
23
 
24
- constructor( $checkbox: HTMLInputElement, userOptions: SkinCheckboxOptionsType = {} ) {
24
+ constructor( $checkbox: HTMLInputElement, userOptions: Partial<FLib.SkinCheckbox.Options> = {} ) {
25
25
 
26
26
  // Already skinned
27
- if ( ($checkbox as CustomCheckboxType).__skinAPI ) {
27
+ if ( ($checkbox as FLib.SkinCheckbox.CustomCheckbox).__skinAPI ) {
28
28
  return;
29
29
  }
30
30
 
@@ -33,9 +33,9 @@ const defaultOptions: SkinCheckboxOptionsType = {
33
33
  this.#options = extend( defaultOptions, userOptions );
34
34
 
35
35
  // Add the skin
36
- wrap( this.#$checkbox, this.#options.wrap! );
36
+ wrap( this.#$checkbox, this.#options.wrap );
37
37
 
38
- this.#$parent = this.#$checkbox.parentNode as CustomCheckboxParentType;
38
+ this.#$parent = this.#$checkbox.parentNode as FLib.SkinCheckbox.CustomCheckboxParent;
39
39
 
40
40
  this.#$parent.__skinAPI = this.#$checkbox.__skinAPI = this;
41
41
 
@@ -45,34 +45,34 @@ const defaultOptions: SkinCheckboxOptionsType = {
45
45
 
46
46
  this.#$checkbox.addEventListener( 'click', this.#changeHandler );
47
47
 
48
- this.update();
48
+ this.#update();
49
49
  }
50
50
 
51
51
 
52
52
  // Change the display
53
- private update() {
53
+ #update = (): void => {
54
54
  this.#$checkbox.__skinAPI?.[ this.#$checkbox.checked ? 'check' : 'uncheck' ]();
55
55
  }
56
56
 
57
57
 
58
- #changeHandler = () => {
59
- this.update();
58
+ #changeHandler = (): void => {
59
+ this.#update();
60
60
  }
61
61
 
62
62
 
63
- private checkUncheck( fnName: string, checked: boolean ) {
63
+ #checkUncheck = ( fnName: string, checked: boolean ): void => {
64
64
  this.#$checkbox.checked = checked;
65
65
  this.#$parent.classList[ fnName ]( this.#options.checkedClass );
66
66
  }
67
67
 
68
68
 
69
- private enableDisable( fnName: string, disabled: boolean ) {
69
+ #enableDisable = ( fnName: string, disabled: boolean ): void => {
70
70
  this.#$checkbox.disabled = disabled;
71
71
  this.#$parent.classList[ fnName ]( this.#options.disabledClass );
72
72
  }
73
73
 
74
74
 
75
- private validInvalid( fnName: string ) {
75
+ #validInvalid = ( fnName: string ): void => {
76
76
  this.#$parent.classList[ fnName ]( this.#options.invalidClass );
77
77
  }
78
78
 
@@ -80,49 +80,61 @@ const defaultOptions: SkinCheckboxOptionsType = {
80
80
  /**
81
81
  * Force the checkbox to be check
82
82
  */
83
- check() {
84
- this.checkUncheck( 'add', true );
83
+ check(): this {
84
+ this.#checkUncheck( 'add', true );
85
+
86
+ return this;
85
87
  }
86
88
 
87
89
 
88
90
  /**
89
91
  * Force the checkbox to be uncheck
90
92
  */
91
- uncheck() {
92
- this.checkUncheck( 'remove', false );
93
+ uncheck(): this {
94
+ this.#checkUncheck( 'remove', false );
95
+
96
+ return this;
93
97
  }
94
98
 
95
99
 
96
100
  /**
97
101
  * Force the checkbox to be enable
98
102
  */
99
- enable() {
100
- this.enableDisable( 'remove', false );
101
- };
103
+ enable(): this {
104
+ this.#enableDisable( 'remove', false );
105
+
106
+ return this;
107
+ }
102
108
 
103
109
 
104
110
  /**
105
111
  * Force the checkbox to be disable
106
112
  */
107
- disable() {
108
- this.enableDisable( 'add', true );
109
- };
113
+ disable(): this {
114
+ this.#enableDisable( 'add', true );
115
+
116
+ return this;
117
+ }
110
118
 
111
119
 
112
120
  /**
113
121
  * Force the state of the checkbox to invalid
114
122
  */
115
- setInvalid() {
116
- this.validInvalid( 'add' );
117
- };
123
+ setInvalid(): this {
124
+ this.#validInvalid( 'add' );
125
+
126
+ return this;
127
+ }
118
128
 
119
129
 
120
130
  /**
121
131
  * Force the state of the checkbox to valid
122
132
  */
123
- setValid() {
124
- this.validInvalid( 'remove' );
125
- };
133
+ setValid(): this {
134
+ this.#validInvalid( 'remove' );
135
+
136
+ return this;
137
+ }
126
138
  }
127
139
 
128
140
 
@@ -130,17 +142,17 @@ const defaultOptions: SkinCheckboxOptionsType = {
130
142
  * Skin a checkbox DOM element
131
143
  *
132
144
  * @example
145
+ * ```ts
133
146
  * // Call with default options:
134
147
  * skinCheckbox( $input, {
135
- * "wrap": "<span class=\"cb-skin\"></span>",
148
+ * "wrap": "&lt;span class=\"cb-skin\"&gt;&lt;/span&gt;",
136
149
  * "invalidClass": "invalid",
137
150
  * "disabledClass": "disabled",
138
151
  * "checkedClass": "checked"
139
152
  * });
140
- *
141
- * @returns {SkinCheckbox}
153
+ * ```
142
154
  */
143
- export function skinCheckbox( $checkbox: HTMLInputElement, options?: SkinCheckboxOptionsType ): SkinCheckbox {
155
+ export function skinCheckbox( $checkbox: HTMLInputElement, options?: Partial<FLib.SkinCheckbox.Options> ): SkinCheckbox {
144
156
  return new SkinCheckbox( $checkbox, options );
145
157
  }
146
158
 
@@ -149,16 +161,18 @@ export function skinCheckbox( $checkbox: HTMLInputElement, options?: SkinCheckbo
149
161
  * Skin all checkbox DOM element in a wrapper
150
162
  *
151
163
  * @example
164
+ * ```ts
152
165
  * // Call with default options:
153
166
  * skinCheckboxAll( $wrapper,
154
167
  * "selector": "input[type="checkbox"]",
155
- * "wrap": "<span class=\"cb-skin\"></span>",
168
+ * "wrap": "&lt;span class=\"cb-skin\"&gt;&lt;/span&gt;",
156
169
  * "invalidClass": "invalid",
157
170
  * "disabledClass": "disabled",
158
171
  * "checkedClass": "checked"
159
172
  * });
173
+ * ```
160
174
  */
161
- export function skinCheckboxAll( $wrapper: HTMLElement, options: SkinCheckboxAllOptionsType = {} ): SkinCheckbox[] {
175
+ export function skinCheckboxAll( $wrapper: HTMLElement, options: Partial<FLib.SkinCheckbox.AllOptions> = {} ): SkinCheckbox[] {
162
176
 
163
177
  const $checkboxes = $wrapper.querySelectorAll( options.selector || 'input[type="checkbox"]' );
164
178
 
@@ -4,7 +4,7 @@ import { insertAfter, append } from '../DOM/Manipulation';
4
4
  import { on } from '../Events/EventsManager';
5
5
 
6
6
 
7
- const defaultOptions: SkinFileOptionsType = {
7
+ const defaultOptions: FLib.SkinFile.Options = {
8
8
  "selector": ".file-skin",
9
9
  "wrap": "<div class=\"file-skin\"></div>",
10
10
  "fileInfoSelector": ".file-info",
@@ -20,36 +20,35 @@ const defaultOptions: SkinFileOptionsType = {
20
20
 
21
21
  /**
22
22
  * Skin an HTML input file element.
23
- * @class
24
23
  */
25
24
  export default class SkinFile {
26
25
 
27
- #options: SkinFileOptionsType;
28
- #$parent: CustomInputFileParentType;
29
- #$resetButton!: HTMLElement | null;
30
- #$fileInfo!: HTMLElement | null;
31
- #fileInfoId: string = '';
32
- #$input: CustomInputFileType;
26
+ #options: FLib.SkinFile.Options;
27
+ #$parent: FLib.SkinFile.CustomInputFileParent;
28
+ #$resetButton: HTMLElement | undefined;
29
+ #$fileInfo: HTMLElement | undefined;
30
+ #fileInfoId = '';
31
+ #$input: FLib.SkinFile.CustomInputFile;
33
32
 
34
33
  #originalFileInfoText = '';
35
34
 
36
35
 
37
- constructor( $input: HTMLInputElement, userOptions?: SkinFileOptionsType ) {
36
+ constructor( $input: HTMLInputElement, userOptions?: Partial<FLib.SkinFile.Options> ) {
38
37
 
39
38
  this.#$input = $input;
40
39
  this.#options = extend( defaultOptions, userOptions );
41
40
 
42
- const $PARENT = this.#$input.closest( this.#options.selector! );
41
+ const $PARENT = this.#$input.closest( this.#options.selector );
43
42
 
44
43
  // The html skin is already done. Just selecting elements for the initialistion
45
44
  if ( $PARENT ) {
46
- this.#$parent = $PARENT as CustomInputFileParentType;
47
- this.#$resetButton = this.#$parent.querySelector( this.#options.resetButtonSelector! );
45
+ this.#$parent = $PARENT as FLib.SkinFile.CustomInputFileParent;
46
+ this.#$resetButton = this.#$parent.querySelector( this.#options.resetButtonSelector ) as HTMLElement;
48
47
  if ( !this.#$resetButton ) {
49
48
  throw `[SkinFile]: "${ this.#options.resetButtonSelector }" not found`;
50
49
  }
51
50
 
52
- this.#$fileInfo = this.#$parent.querySelector( this.#options.fileInfoSelector! );
51
+ this.#$fileInfo = this.#$parent.querySelector( this.#options.fileInfoSelector ) as HTMLElement;
53
52
  if ( !this.#$fileInfo ) {
54
53
  throw `[SkinFile]: "${ this.#options.fileInfoSelector }" not found`;
55
54
  }
@@ -59,7 +58,7 @@ const defaultOptions: SkinFileOptionsType = {
59
58
  }
60
59
  // No HTML skin, just input:file alone. Create the whole skin here:
61
60
  else {
62
- this.#$parent = strToDOM( this.#options.wrap! ) as HTMLElement;
61
+ this.#$parent = strToDOM( this.#options.wrap ) as HTMLElement;
63
62
 
64
63
  insertAfter( this.#$parent, this.#$input );
65
64
 
@@ -67,15 +66,15 @@ const defaultOptions: SkinFileOptionsType = {
67
66
 
68
67
  if ( this.#$input.hasAttribute( 'data-file-info' ) ) {
69
68
  this.#fileInfoId = this.#$input.getAttribute( 'data-file-info' ) || '';
70
- this.#$fileInfo = document.getElementById( this.#fileInfoId );
69
+ this.#$fileInfo = document.getElementById( this.#fileInfoId ) as HTMLElement;
71
70
  }
72
71
 
73
- if ( this.#$fileInfo !== null ) {
72
+ if ( this.#$fileInfo ) {
74
73
  this.#originalFileInfoText = this.#$fileInfo.innerHTML;
75
74
  this.#originalFileInfoText = this.#originalFileInfoText.trim();
76
75
  }
77
76
  else {
78
- this.#$fileInfo = strToDOM( this.#options.fileInfo! ) as HTMLElement;
77
+ this.#$fileInfo = strToDOM( this.#options.fileInfo ) as HTMLElement;
79
78
  append( this.#$fileInfo, this.#$parent );
80
79
  }
81
80
 
@@ -105,56 +104,55 @@ const defaultOptions: SkinFileOptionsType = {
105
104
  } );
106
105
  }
107
106
 
108
- this.changeState();
107
+ this.#changeState();
109
108
 
110
109
  this.#$input.__skinAPI = this.#$parent.__skinAPI = this;
111
110
  }
112
111
 
113
112
 
114
- private changeState() {
115
- let aValue;
113
+ #changeState = (): void => {
116
114
 
117
115
  if ( !this.#$input.value ) {
118
- this.#$fileInfo!.innerHTML = this.#originalFileInfoText;
116
+ ( this.#$fileInfo as HTMLElement ).innerHTML = this.#originalFileInfoText;
119
117
 
120
118
  if ( this.#options.autoHideFileInfo && !this.#originalFileInfoText ) {
121
- this.#$fileInfo!.style.display = 'none';
119
+ ( this.#$fileInfo as HTMLElement ).style.display = 'none';
122
120
  }
123
121
 
124
- this.#$parent.classList.remove( this.#options.selectedClass! );
122
+ this.#$parent.classList.remove( this.#options.selectedClass );
125
123
 
126
124
  return;
127
125
  }
128
126
 
129
- aValue = this.#$input.value.split( /(\\|\/)/ );
127
+ const aValue = this.#$input.value.split( /(\\|\/)/ );
130
128
 
131
- this.#$fileInfo!.innerHTML = aValue[ aValue.length - 1 ];
129
+ ( this.#$fileInfo as HTMLElement ).innerHTML = aValue[ aValue.length - 1 ];
132
130
 
133
- this.#$parent.classList.add( this.#options.selectedClass! );
131
+ this.#$parent.classList.add( this.#options.selectedClass );
134
132
 
135
133
  if ( this.#options.autoHideFileInfo ) {
136
- this.#$fileInfo!.style.display = '';
134
+ ( this.#$fileInfo as HTMLElement ).style.display = '';
137
135
  }
138
136
  }
139
137
 
140
138
 
141
- #changeHandler = () => {
142
- this.changeState();
139
+ #changeHandler = (): void => {
140
+ this.#changeState();
143
141
  }
144
142
 
145
143
 
146
- #clickHandler = () => {
144
+ #clickHandler = (): void => {
147
145
  this.#$input.click();
148
146
  }
149
147
 
150
148
 
151
- #resetHandler = () => {
149
+ #resetHandler = (): void => {
152
150
  this.#$input.value = '';
153
- this.changeState();
151
+ this.#changeState();
154
152
  }
155
153
 
156
154
 
157
- private enableDisable( fnName: string, disabled: boolean ) {
155
+ #enableDisable = ( fnName: string, disabled: boolean ): void => {
158
156
  this.#$input.disabled = disabled;
159
157
  this.#$parent.classList[ fnName ]( this.#options.disabledClass );
160
158
  }
@@ -163,20 +161,24 @@ const defaultOptions: SkinFileOptionsType = {
163
161
  /**
164
162
  * Force the select to be enable
165
163
  */
166
- enable() {
167
- this.enableDisable( 'remove', false );
164
+ enable(): this {
165
+ this.#enableDisable( 'remove', false );
166
+
167
+ return this;
168
168
  }
169
169
 
170
170
 
171
171
  /**
172
172
  * Force the select to be disable
173
173
  */
174
- disable() {
175
- this.enableDisable( 'add', true );
174
+ disable(): this {
175
+ this.#enableDisable( 'add', true );
176
+
177
+ return this;
176
178
  }
177
179
 
178
180
 
179
- private validInvalid( fnName: string ) {
181
+ #validInvalid = ( fnName: string ): void => {
180
182
  this.#$parent.classList[ fnName ]( this.#options.invalidClass );
181
183
  }
182
184
 
@@ -184,17 +186,21 @@ const defaultOptions: SkinFileOptionsType = {
184
186
  /**
185
187
  * Force the state of the select to invalid
186
188
  */
187
- setInvalid() {
188
- this.validInvalid( 'add' );
189
- };
189
+ setInvalid(): this {
190
+ this.#validInvalid( 'add' );
191
+
192
+ return this;
193
+ }
190
194
 
191
195
 
192
196
  /**
193
197
  * Force the state of the select to valid
194
198
  */
195
- setValid() {
196
- this.validInvalid( 'remove' );
197
- };
199
+ setValid(): this {
200
+ this.#validInvalid( 'remove' );
201
+
202
+ return this;
203
+ }
198
204
  }
199
205
 
200
206
 
@@ -203,21 +209,23 @@ const defaultOptions: SkinFileOptionsType = {
203
209
  *
204
210
  *
205
211
  * @example
212
+ * ```ts
206
213
  * // Call with default options:
207
214
  * skinInputFile( $input, {
208
215
  * "selector": ".file-skin",
209
- * "wrap": "<div class=\"file-skin\"></div>",
216
+ * "wrap": "&lt;div class=\"file-skin\"&gt;&lt;/div&gt;",
210
217
  * "fileInfoSelector": ".file-info",
211
- * "fileInfo": "<div class=\"file-info\"></div>",
218
+ * "fileInfo": "&lt;div class=\"file-info\"&gt;&lt;/div&gt;",
212
219
  * "autoHideFileInfo": true,
213
220
  * "resetButtonSelector": ".file-reset",
214
- * "resetButton": "<span class=\"file-reset\">&times;</span>",
221
+ * "resetButton": "&lt;span class=\"file-reset\"&gt;&times;&lt;/span&gt;",
215
222
  * "disabledClass": "disabled",
216
223
  * "invalidClass": "invalid",
217
224
  * "selectedClass": "selected"
218
225
  * } );
226
+ * ```
219
227
  */
220
- export function skinInputFile( $input: HTMLInputElement, options: SkinFileOptionsType ): SkinFile {
228
+ export function skinInputFile( $input: HTMLInputElement, options: Partial<FLib.SkinFile.Options> ): SkinFile {
221
229
  return new SkinFile( $input, options );
222
230
  }
223
231
 
@@ -226,21 +234,23 @@ export function skinInputFile( $input: HTMLInputElement, options: SkinFileOption
226
234
  * Skin all input file DOM element in a wrapper
227
235
  *
228
236
  * @example
237
+ * ```ts
229
238
  * // Call with default options:
230
239
  * skinInputFileAll( $wrapper, {
231
240
  * "selector": ".file-skin",
232
- * "wrap": "<div class=\"file-skin\"></div>",
241
+ * "wrap": "&lt;div class=\"file-skin\"&gt;&lt;/div&gt;",
233
242
  * "fileInfoSelector": ".file-info",
234
- * "fileInfo": "<div class=\"file-info\"></div>",
243
+ * "fileInfo": "&lt;div class=\"file-info\"&gt;&lt;/div&gt;",
235
244
  * "autoHideFileInfo": true,
236
245
  * "resetButtonSelector": ".file-reset",
237
- * "resetButton": "<span class=\"file-reset\">&times;</span>",
246
+ * "resetButton": "&lt;span class=\"file-reset\"&gt;&times;&lt;/span&gt;",
238
247
  * "disabledClass": "disabled",
239
248
  * "invalidClass": "invalid",
240
249
  * "selectedClass": "selected"
241
250
  * } );
251
+ * ```
242
252
  */
243
- export function skinInputFileAll( $wrapper: HTMLElement, options: SkinFileAllOptionsType = {} ): SkinFile[] {
253
+ export function skinInputFileAll( $wrapper: HTMLElement, options: Partial<FLib.SkinFile.AllOptions> = {} ): SkinFile[] {
244
254
  const skinList: SkinFile[] = [];
245
255
 
246
256
  const $inputs = $wrapper.querySelectorAll( options.selector || 'input[type="file"]' );