@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.
- package/CHANGELOG.md +15 -0
- package/DOM/Class.ts +10 -12
- package/DOM/DocumentSize.ts +3 -1
- package/DOM/Filter.ts +0 -2
- package/DOM/Index.ts +1 -3
- package/DOM/Manipulation.ts +0 -3
- package/DOM/Matrix.ts +12 -12
- package/DOM/Offset.ts +4 -5
- package/DOM/OuterSize.ts +12 -12
- package/DOM/PageToDOM.ts +2 -2
- package/DOM/Position.ts +3 -3
- package/DOM/Size.ts +3 -7
- package/DOM/StrToDOM.ts +0 -1
- package/DOM/Styles.ts +3 -12
- package/DOM/Traversing.ts +0 -6
- package/DOM/WindowScroll.ts +3 -1
- package/DOM/WindowSize.ts +3 -1
- package/DOM/Wrap.ts +0 -1
- package/Events/DeviceOrientation.ts +27 -31
- package/Events/EventsManager.ts +10 -25
- package/Events/Gesture.ts +36 -37
- package/Events/HistoryController.ts +11 -17
- package/Events/ImageLoad.ts +35 -19
- package/Events/IntersectObserver.ts +15 -19
- package/Events/KeyboardHandler.ts +10 -8
- package/Events/MediaQueriesEvents.ts +53 -51
- package/Events/OnAnimationEnd.ts +2 -3
- package/Events/OnTransitionEnd.ts +3 -3
- package/Events/PubSub.ts +5 -8
- package/Events/TouchHover.ts +18 -21
- package/Events/WindowEvents.ts +26 -30
- package/Helpers/Colors.ts +7 -23
- package/Helpers/Cookie.ts +5 -12
- package/Helpers/Coordinates.ts +0 -7
- package/Helpers/Debounce.ts +3 -7
- package/Helpers/Defer.ts +1 -1
- package/Helpers/GetValue.ts +0 -2
- package/Helpers/Insert.ts +0 -1
- package/Helpers/Sequential.ts +0 -2
- package/Helpers/Slice.ts +0 -3
- package/Helpers/Throttle.ts +0 -1
- package/Helpers/TransitionHelpers.ts +8 -6
- package/Helpers/Type.ts +1 -14
- package/Helpers/Unique.ts +3 -3
- package/Helpers/UrlParser.ts +13 -22
- package/Helpers/Wait.ts +1 -1
- package/Modules/Accordion/Tab.ts +18 -16
- package/Modules/Accordion/index.ts +24 -16
- package/Modules/Autocomplete.ts +95 -101
- package/Modules/DragSlider.ts +72 -63
- package/Modules/GlobalState.ts +60 -53
- package/Modules/LoadGMap.ts +4 -7
- package/Modules/Notifications/Notification.ts +28 -32
- package/Modules/Notifications/index.ts +43 -36
- package/Modules/Popin/Popin.ts +100 -110
- package/Modules/Popin/PopinAccessibility.ts +8 -8
- package/Modules/Popin/PopinBackground.ts +11 -11
- package/Modules/Popin/PopinController.ts +23 -29
- package/Modules/Popin/Tools.ts +18 -19
- package/Modules/QuickTemplate.ts +4 -6
- package/Modules/ScrollSnap.ts +110 -104
- package/Modules/SkinCheckbox.ts +51 -37
- package/Modules/SkinFile.ts +62 -52
- package/Modules/SkinRadio.ts +62 -42
- package/Modules/SkinSelect.ts +116 -100
- package/Modules/Slider/Slide.ts +49 -52
- package/Modules/Slider/Slider.ts +100 -136
- package/Modules/Slider/SliderControls.ts +60 -59
- package/Modules/Tabs/Tab.ts +27 -23
- package/Modules/Tabs/index.ts +35 -25
- package/Modules/Validator/Date.ts +2 -1
- package/Modules/Validator/Equals.ts +1 -1
- package/Modules/Validator/Internal/Input.ts +370 -0
- package/Modules/Validator/Internal/InputValidator.ts +99 -0
- package/Modules/Validator/Internal/ValidatorFunctionsController.ts +58 -0
- package/Modules/Validator/Max.ts +1 -1
- package/Modules/Validator/Min.ts +1 -1
- package/Modules/Validator/MultiRequired.ts +5 -5
- package/Modules/Validator/Number.ts +1 -0
- package/Modules/Validator/Pattern.ts +1 -1
- package/Modules/Validator/Recaptcha.ts +1 -0
- package/Modules/Validator/Required.ts +3 -2
- package/Modules/Validator/ServerCheck.ts +23 -15
- package/Modules/Validator/Tools/GetQueryFromForm.ts +1 -6
- package/Modules/Validator/Tools/IsDate.ts +2 -3
- package/Modules/Validator/Tools/IsEmail.ts +2 -5
- package/Modules/Validator/Tools/IsEmpty.ts +0 -2
- package/Modules/Validator/Tools/IsNumber.ts +0 -2
- package/Modules/Validator/Tools/IsUrl.ts +1 -3
- package/Modules/Validator/Tools/Label.ts +5 -15
- package/Modules/Validator/Tools/RadioButton.ts +4 -10
- package/Modules/Validator/Url.ts +1 -0
- package/Modules/Validator/index.ts +36 -36
- package/Modules/YouTubePlayer.ts +18 -16
- package/README.md +1 -1
- package/Types/Accordion.d.ts +36 -0
- package/Types/Autocomplete.d.ts +95 -0
- package/Types/DOM.d.ts +69 -0
- package/Types/DragSlider.d.ts +56 -0
- package/Types/EventsHelpers.d.ts +390 -0
- package/Types/GLImageTransition.d.ts +47 -43
- package/Types/GlobalState.d.ts +9 -0
- package/Types/Helpers.d.ts +30 -0
- package/Types/Notifications.d.ts +48 -44
- package/Types/Popin.d.ts +95 -0
- package/Types/ScrollSnap.d.ts +66 -0
- package/Types/SkinCheckbox.d.ts +26 -0
- package/Types/SkinFile.d.ts +38 -0
- package/Types/SkinRadio.d.ts +28 -0
- package/Types/SkinSelect.d.ts +59 -0
- package/Types/Slider.d.ts +106 -0
- package/Types/Tabs.d.ts +26 -0
- package/Types/Validator.d.ts +72 -0
- package/Types/YouTubePlayer.d.ts +27 -0
- package/Types/index.d.ts +22 -21
- package/WebGL/GLImageTransition/GLImageTransition.ts +83 -80
- package/WebGL/GLImageTransition/Presets/Cellular.ts +11 -11
- package/WebGL/GLImageTransition/Presets/Fade.ts +2 -3
- package/WebGL/GLImageTransition/Presets/HorizontalMovingGrid.ts +9 -9
- package/WebGL/GLImageTransition/Presets/PresetSample.ts +11 -9
- package/WebGL/GLImageTransition/Presets/Solarisation.ts +7 -12
- package/package.json +1 -1
- package/Modules/Template.ts +0 -209
- package/Types/AccordionTypes.d.ts +0 -29
- package/Types/AutocompleteTypes.d.ts +0 -85
- package/Types/DOMTypes.d.ts +0 -62
- package/Types/DragSliderTypes.d.ts +0 -52
- package/Types/EventsHelpersTypes.d.ts +0 -370
- package/Types/GlobalStateTypes.d.ts +0 -5
- package/Types/HelpersTypes.d.ts +0 -23
- package/Types/MediaPreloaderTypes.d.ts +0 -12
- package/Types/PopinTypes.d.ts +0 -83
- package/Types/ScrollSnapTypes.d.ts +0 -62
- package/Types/SkinCheckboxTypes.d.ts +0 -23
- package/Types/SkinFileTypes.d.ts +0 -34
- package/Types/SkinRadioTypes.d.ts +0 -24
- package/Types/SkinSelectTypes.d.ts +0 -48
- package/Types/SliderTypes.d.ts +0 -97
- package/Types/TabsTypes.d.ts +0 -22
- package/Types/ValidatorTypes.d.ts +0 -61
- package/Types/YouTubePlayerTypes.d.ts +0 -23
package/Modules/SkinRadio.ts
CHANGED
|
@@ -16,24 +16,26 @@ const defaultOptions = {
|
|
|
16
16
|
* You can access the skin API in the __skinAPI property of the $radio HTMLElement or its wrapper.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
|
+
* ```ts
|
|
19
20
|
* // Call with default options:
|
|
20
21
|
* skinRadio( $radio, {
|
|
21
|
-
* "wrap": "
|
|
22
|
+
* "wrap": "<span class=\"rb-skin\"></span>",
|
|
22
23
|
* "invalidClass": "invalid",
|
|
23
24
|
* "disabledClass": "disabled",
|
|
24
25
|
* "checkedClass": "checked"
|
|
25
26
|
* } );
|
|
27
|
+
* ```
|
|
26
28
|
*/
|
|
27
29
|
export default class SkinRadioButton {
|
|
28
|
-
#$radio!:
|
|
29
|
-
#options!:
|
|
30
|
-
#$parent!:
|
|
31
|
-
#$rdGroup!:
|
|
30
|
+
#$radio!: FLib.SkinRadio.CustomRadioButton;
|
|
31
|
+
#options!: FLib.SkinRadio.Options;
|
|
32
|
+
#$parent!: FLib.SkinRadio.CustomRadioButtonParent;
|
|
33
|
+
#$rdGroup!: NodeListOf<FLib.SkinRadio.CustomRadioButton>;
|
|
32
34
|
|
|
33
|
-
constructor( $radio: HTMLInputElement, userOptions?:
|
|
35
|
+
constructor( $radio: HTMLInputElement, userOptions?: Partial<FLib.SkinRadio.Options> ) {
|
|
34
36
|
|
|
35
37
|
// Already skinned
|
|
36
|
-
if ( ($radio as
|
|
38
|
+
if ( ($radio as FLib.SkinRadio.CustomRadioButton).__skinAPI ) {
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -45,20 +47,20 @@ export default class SkinRadioButton {
|
|
|
45
47
|
|
|
46
48
|
// Store all radio with same name
|
|
47
49
|
|
|
48
|
-
if ( !this.#$radio.__$
|
|
49
|
-
this.#$rdGroup = document.querySelectorAll( `input[type="radio"][name="${ rdName }"]` )
|
|
50
|
+
if ( !this.#$radio.__$radioGroup ) {
|
|
51
|
+
this.#$rdGroup = document.querySelectorAll( `input[type="radio"][name="${ rdName }"]` ) as NodeListOf<FLib.SkinRadio.CustomRadioButton>;
|
|
50
52
|
|
|
51
53
|
this.#$rdGroup.forEach( $r => {
|
|
52
|
-
($r as
|
|
54
|
+
($r as FLib.SkinRadio.CustomRadioButton).__$radioGroup = this.#$rdGroup;
|
|
53
55
|
} );
|
|
54
56
|
}
|
|
55
57
|
else {
|
|
56
|
-
this.#$rdGroup = this.#$radio.__$
|
|
58
|
+
this.#$rdGroup = this.#$radio.__$radioGroup;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
|
|
60
|
-
wrap( this.#$radio, this.#options.wrap
|
|
61
|
-
this.#$parent = this.#$radio.parentNode as
|
|
62
|
+
wrap( this.#$radio, this.#options.wrap );
|
|
63
|
+
this.#$parent = this.#$radio.parentNode as FLib.SkinRadio.CustomRadioButtonParent;
|
|
62
64
|
|
|
63
65
|
this.#$parent.__skinAPI = this.#$radio.__skinAPI = this;
|
|
64
66
|
|
|
@@ -68,22 +70,22 @@ export default class SkinRadioButton {
|
|
|
68
70
|
|
|
69
71
|
this.#$radio.addEventListener( 'click', this.#changeHandler );
|
|
70
72
|
|
|
71
|
-
this
|
|
73
|
+
this.#update( this.#$radio );
|
|
72
74
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
#update = ( $rd: FLib.SkinRadio.CustomRadioButton ): void => {
|
|
77
79
|
$rd.__skinAPI[ $rd.checked ? 'check' : 'uncheck' ]();
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
|
|
81
|
-
#changeHandler = () => {
|
|
82
|
-
this.#$rdGroup.forEach( $rd => this
|
|
83
|
+
#changeHandler = (): void => {
|
|
84
|
+
this.#$rdGroup.forEach( $rd => this.#update( $rd ) );
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
#enableDisable = ( fnName: string, disabled: boolean ): void => {
|
|
87
89
|
this.#$rdGroup.forEach( ( $r: Node ) => {
|
|
88
90
|
($r as HTMLInputElement).disabled = disabled;
|
|
89
91
|
($r.parentNode as HTMLElement).classList[ fnName ]( this.#options.disabledClass );
|
|
@@ -91,7 +93,7 @@ export default class SkinRadioButton {
|
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
#validInvalid = ( fnName: string ): void => {
|
|
95
97
|
this.#$rdGroup.forEach( ( $r: Node ) => {
|
|
96
98
|
($r.parentNode as HTMLElement).classList[ fnName ]( this.#options.invalidClass );
|
|
97
99
|
} );
|
|
@@ -101,53 +103,65 @@ export default class SkinRadioButton {
|
|
|
101
103
|
/**
|
|
102
104
|
* Force the radio button to be check
|
|
103
105
|
*/
|
|
104
|
-
check() {
|
|
106
|
+
check(): this {
|
|
105
107
|
this.#$rdGroup.forEach( ( $r: Node ) => {
|
|
106
108
|
($r as HTMLInputElement).checked = $r === this.#$radio;
|
|
107
|
-
($r.parentNode as HTMLElement).classList[ $r === this.#$radio ? 'add' : 'remove' ]( this.#options.checkedClass
|
|
109
|
+
($r.parentNode as HTMLElement).classList[ $r === this.#$radio ? 'add' : 'remove' ]( this.#options.checkedClass );
|
|
108
110
|
} );
|
|
109
|
-
|
|
111
|
+
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
110
114
|
|
|
111
115
|
|
|
112
116
|
/**
|
|
113
117
|
* Force the radio button to be uncheck
|
|
114
118
|
*/
|
|
115
|
-
uncheck() {
|
|
119
|
+
uncheck(): this {
|
|
116
120
|
this.#$radio.checked = false;
|
|
117
|
-
this.#$parent.classList.remove( this.#options.checkedClass
|
|
118
|
-
|
|
121
|
+
this.#$parent.classList.remove( this.#options.checkedClass );
|
|
122
|
+
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
119
125
|
|
|
120
126
|
|
|
121
127
|
/**
|
|
122
128
|
* Force the radio button to be enable
|
|
123
129
|
*/
|
|
124
|
-
enable() {
|
|
125
|
-
this
|
|
126
|
-
|
|
130
|
+
enable(): this {
|
|
131
|
+
this.#enableDisable( 'remove', false );
|
|
132
|
+
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
127
135
|
|
|
128
136
|
|
|
129
137
|
/**
|
|
130
138
|
* Force the radio button to be disable
|
|
131
139
|
*/
|
|
132
|
-
disable() {
|
|
133
|
-
this
|
|
134
|
-
|
|
140
|
+
disable(): this {
|
|
141
|
+
this.#enableDisable( 'add', true );
|
|
142
|
+
|
|
143
|
+
return this;
|
|
144
|
+
}
|
|
135
145
|
|
|
136
146
|
|
|
137
147
|
/**
|
|
138
148
|
* Force the state of the radio button to invalid
|
|
139
149
|
*/
|
|
140
|
-
setInvalid() {
|
|
141
|
-
this
|
|
142
|
-
|
|
150
|
+
setInvalid(): this {
|
|
151
|
+
this.#validInvalid( 'add' );
|
|
152
|
+
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
143
155
|
|
|
144
156
|
|
|
145
157
|
/**
|
|
146
158
|
* Force the state of the radio button to valid
|
|
147
159
|
*/
|
|
148
|
-
setValid() {
|
|
149
|
-
this
|
|
150
|
-
|
|
160
|
+
setValid(): this {
|
|
161
|
+
this.#validInvalid( 'remove' );
|
|
162
|
+
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
151
165
|
}
|
|
152
166
|
|
|
153
167
|
|
|
@@ -155,15 +169,17 @@ export default class SkinRadioButton {
|
|
|
155
169
|
* Skin a radio input
|
|
156
170
|
*
|
|
157
171
|
* @example
|
|
172
|
+
* ```ts
|
|
158
173
|
* // Call with default options:
|
|
159
174
|
* skinRadio( $radio, {
|
|
160
|
-
* "wrap": "
|
|
175
|
+
* "wrap": "<span class=\"rb-skin\"></span>",
|
|
161
176
|
* "invalidClass": "invalid",
|
|
162
177
|
* "disabledClass": "disabled",
|
|
163
178
|
* "checkedClass": "checked"
|
|
164
179
|
* } );
|
|
180
|
+
* ```
|
|
165
181
|
*/
|
|
166
|
-
export function skinRadio( $radio: HTMLInputElement, options:
|
|
182
|
+
export function skinRadio( $radio: HTMLInputElement, options: Partial<FLib.SkinRadio.Options> ): SkinRadioButton {
|
|
167
183
|
return new SkinRadioButton( $radio, options );
|
|
168
184
|
}
|
|
169
185
|
|
|
@@ -172,16 +188,18 @@ export function skinRadio( $radio: HTMLInputElement, options: SkinRadioOptionsTy
|
|
|
172
188
|
* Select all radio input in a $wrapper
|
|
173
189
|
*
|
|
174
190
|
* @example
|
|
191
|
+
* ```ts
|
|
175
192
|
* // Call with default options:
|
|
176
193
|
* skinRadioAll( $wrapper, {
|
|
177
|
-
* "wrap": "
|
|
194
|
+
* "wrap": "<span class=\"rb-skin\"></span>",
|
|
178
195
|
* "selector": "input[type=\"radio\"]",
|
|
179
196
|
* "invalidClass": "invalid",
|
|
180
197
|
* "disabledClass": "disabled",
|
|
181
198
|
* "checkedClass": "checked"
|
|
182
199
|
* } );
|
|
200
|
+
* ```
|
|
183
201
|
*/
|
|
184
|
-
export function skinRadioAll( $wrapper: HTMLElement, options:
|
|
202
|
+
export function skinRadioAll( $wrapper: HTMLElement, options: Partial<FLib.SkinRadio.AllOptions> = {} ): SkinRadioButton[] {
|
|
185
203
|
|
|
186
204
|
const $radioButtons = $wrapper.querySelectorAll( options.selector || 'input[type="radio"]' );
|
|
187
205
|
const skinList: SkinRadioButton[] = [];
|
|
@@ -196,6 +214,7 @@ export function skinRadioAll( $wrapper: HTMLElement, options: SkinRadioAllOption
|
|
|
196
214
|
* Select all radio input of the same group (same name)
|
|
197
215
|
*
|
|
198
216
|
* @example
|
|
217
|
+
* ```ts
|
|
199
218
|
* // Call with default options:
|
|
200
219
|
* skinRadioGroup( $radio, {
|
|
201
220
|
* "wrap": "<span class=\"rb-skin\"></span>",
|
|
@@ -203,8 +222,9 @@ export function skinRadioAll( $wrapper: HTMLElement, options: SkinRadioAllOption
|
|
|
203
222
|
* "disabledClass": "disabled",
|
|
204
223
|
* "checkedClass": "checked"
|
|
205
224
|
* } );
|
|
225
|
+
* ```
|
|
206
226
|
*/
|
|
207
|
-
export function skinRadioGroup( $radioButtonOrInputName: HTMLInputElement | string, options:
|
|
227
|
+
export function skinRadioGroup( $radioButtonOrInputName: HTMLInputElement | string, options: FLib.SkinRadio.Options ): SkinRadioButton[] {
|
|
208
228
|
|
|
209
229
|
const inputName = isString( $radioButtonOrInputName ) ? $radioButtonOrInputName : ($radioButtonOrInputName as HTMLInputElement).getAttribute( 'name' );
|
|
210
230
|
|