@lumx/core 3.20.1-alpha.20 → 3.20.1-alpha.21
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/js/constants/design-tokens.js +2294 -5389
- package/js/constants/design-tokens.min.js +1 -0
- package/js/constants/index.js +134 -107
- package/js/constants/index.min.js +1 -0
- package/js/constants/keycodes.js +13 -9
- package/js/constants/keycodes.min.js +1 -0
- package/js/custom-colors.js +22 -17
- package/js/custom-colors.min.js +1 -0
- package/js/types/Callback.js +1 -0
- package/js/types/Callback.min.js +1 -0
- package/js/types/Falsy.js +1 -0
- package/js/types/Falsy.min.js +1 -0
- package/js/types/GenericProps.js +1 -0
- package/js/types/GenericProps.min.js +1 -0
- package/js/types/HasAriaLabelOrLabelledBy.js +1 -0
- package/js/types/HasAriaLabelOrLabelledBy.min.js +1 -0
- package/js/types/HasClassName.js +1 -0
- package/js/types/HasClassName.min.js +1 -0
- package/js/types/HasCloseMode.js +1 -0
- package/js/types/HasCloseMode.min.js +1 -0
- package/js/types/HasTheme.js +1 -0
- package/js/types/HasTheme.min.js +1 -0
- package/js/types/HeadingElement.js +1 -0
- package/js/types/HeadingElement.min.js +1 -0
- package/js/types/Point.js +1 -0
- package/js/types/Point.min.js +1 -0
- package/js/types/Predicate.js +1 -0
- package/js/types/Predicate.min.js +1 -0
- package/js/types/RectSize.js +1 -0
- package/js/types/RectSize.min.js +1 -0
- package/js/types/TextElement.js +1 -0
- package/js/types/TextElement.min.js +1 -0
- package/js/types/ValueOf.js +1 -0
- package/js/types/ValueOf.min.js +1 -0
- package/js/types/index.js +1 -0
- package/js/types/index.min.js +1 -0
- package/js/utils/className/fontColorClass.js +12 -7
- package/js/utils/className/fontColorClass.min.js +1 -0
- package/js/utils/className/fontColorClass.test.js +16 -14
- package/js/utils/className/fontColorClass.test.min.js +1 -0
- package/js/utils/className/getBasicClass.js +24 -19
- package/js/utils/className/getBasicClass.min.js +1 -0
- package/js/utils/className/getBasicClass.test.js +19 -55
- package/js/utils/className/getBasicClass.test.min.js +1 -0
- package/js/utils/className/getRootClassName.js +17 -10
- package/js/utils/className/getRootClassName.min.js +1 -0
- package/js/utils/className/getRootClassName.test.js +13 -11
- package/js/utils/className/getRootClassName.test.min.js +1 -0
- package/js/utils/className/getTypographyClassName.js +7 -3
- package/js/utils/className/getTypographyClassName.min.js +1 -0
- package/js/utils/className/getTypographyClassName.test.js +7 -5
- package/js/utils/className/getTypographyClassName.test.min.js +1 -0
- package/js/utils/className/handleBasicClasses.js +31 -27
- package/js/utils/className/handleBasicClasses.min.js +1 -0
- package/js/utils/className/handleBasicClasses.test.js +32 -30
- package/js/utils/className/handleBasicClasses.test.min.js +1 -0
- package/js/utils/className/index.js +25 -12
- package/js/utils/className/index.min.js +1 -0
- package/js/utils/className/resolveColorWithVariants.js +9 -4
- package/js/utils/className/resolveColorWithVariants.min.js +1 -0
- package/js/utils/className/resolveColorWithVariants.test.js +28 -26
- package/js/utils/className/resolveColorWithVariants.test.min.js +1 -0
- package/js/utils/index.js +174 -161
- package/js/utils/index.min.js +1 -0
- package/lumx.min.css +1 -0
- package/package.json +3 -5
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
1
5
|
/** Resolve color & color variant from a `ColorWithVariants` and optionally a `ColorVariant`. */
|
|
2
6
|
function resolveColorWithVariants(colorWithVariants, colorVariant) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
if (!colorWithVariants)
|
|
8
|
+
return [undefined, colorVariant];
|
|
9
|
+
const [color, baseColorVariant] = colorWithVariants.split('-');
|
|
10
|
+
return [color, (colorVariant || baseColorVariant)];
|
|
6
11
|
}
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
exports.resolveColorWithVariants = resolveColorWithVariants;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveColorWithVariants=function(e,t){if(!e)return[void 0,t];const[r,o]=e.split("-");return[r,t||o]};
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
3
|
+
var js_utils_className_resolveColorWithVariants = require('./resolveColorWithVariants.js');
|
|
4
|
+
|
|
5
|
+
describe(js_utils_className_resolveColorWithVariants.resolveColorWithVariants, () => {
|
|
6
|
+
it('should handle undefined color', () => {
|
|
7
|
+
const result = js_utils_className_resolveColorWithVariants.resolveColorWithVariants(undefined);
|
|
8
|
+
expect(result).toEqual([undefined, undefined]);
|
|
9
|
+
});
|
|
10
|
+
it('should handle undefined color with variant', () => {
|
|
11
|
+
const result = js_utils_className_resolveColorWithVariants.resolveColorWithVariants(undefined, 'L2');
|
|
12
|
+
expect(result).toEqual([undefined, 'L2']);
|
|
13
|
+
});
|
|
14
|
+
it('should handle color with undefined variant', () => {
|
|
15
|
+
const result = js_utils_className_resolveColorWithVariants.resolveColorWithVariants('primary');
|
|
16
|
+
expect(result).toEqual(['primary', undefined]);
|
|
17
|
+
});
|
|
18
|
+
it('should handle color & variant separated', () => {
|
|
19
|
+
const result = js_utils_className_resolveColorWithVariants.resolveColorWithVariants('primary', 'L2');
|
|
20
|
+
expect(result).toEqual(['primary', 'L2']);
|
|
21
|
+
});
|
|
22
|
+
it('should handle color with variant all in one', () => {
|
|
23
|
+
const result = js_utils_className_resolveColorWithVariants.resolveColorWithVariants('primary-L2');
|
|
24
|
+
expect(result).toEqual(['primary', 'L2']);
|
|
25
|
+
});
|
|
26
|
+
it('should override color variant with the given color variant', () => {
|
|
27
|
+
const result = js_utils_className_resolveColorWithVariants.resolveColorWithVariants('primary-L2', 'D2');
|
|
28
|
+
expect(result).toEqual(['primary', 'D2']);
|
|
29
|
+
});
|
|
28
30
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=require("./resolveColorWithVariants.min.js");describe(o.resolveColorWithVariants,()=>{it("should handle undefined color",()=>{const r=o.resolveColorWithVariants(void 0);expect(r).toEqual([void 0,void 0])}),it("should handle undefined color with variant",()=>{const r=o.resolveColorWithVariants(void 0,"L2");expect(r).toEqual([void 0,"L2"])}),it("should handle color with undefined variant",()=>{const r=o.resolveColorWithVariants("primary");expect(r).toEqual(["primary",void 0])}),it("should handle color & variant separated",()=>{const r=o.resolveColorWithVariants("primary","L2");expect(r).toEqual(["primary","L2"])}),it("should handle color with variant all in one",()=>{const r=o.resolveColorWithVariants("primary-L2");expect(r).toEqual(["primary","L2"])}),it("should override color variant with the given color variant",()=>{const r=o.resolveColorWithVariants("primary-L2","D2");expect(r).toEqual(["primary","D2"])})});
|
package/js/utils/index.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var noop = require('lodash/noop');
|
|
6
|
+
var js_utils_className_handleBasicClasses = require('./className/handleBasicClasses.js');
|
|
7
|
+
var js_utils_className_getBasicClass = require('./className/getBasicClass.js');
|
|
8
|
+
var js_utils_className_getRootClassName = require('./className/getRootClassName.js');
|
|
9
|
+
var js_utils_className_getTypographyClassName = require('./className/getTypographyClassName.js');
|
|
10
|
+
var js_utils_className_fontColorClass = require('./className/fontColorClass.js');
|
|
11
|
+
var js_utils_className_resolveColorWithVariants = require('./className/resolveColorWithVariants.js');
|
|
12
|
+
require('classnames');
|
|
13
|
+
require('lodash/isBoolean');
|
|
14
|
+
require('lodash/isEmpty');
|
|
15
|
+
require('lodash/kebabCase');
|
|
16
|
+
require('../constants/index.js');
|
|
17
|
+
require('../constants/keycodes.js');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
+
|
|
21
|
+
var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
|
|
14
22
|
|
|
15
23
|
/**
|
|
16
24
|
* Make sure the pressed key is the enter key before calling the callback.
|
|
@@ -19,14 +27,13 @@ import '../constants/keycodes.js';
|
|
|
19
27
|
* @return The decorated function.
|
|
20
28
|
*/
|
|
21
29
|
function onEnterPressed(handler) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
return (evt) => {
|
|
31
|
+
if (evt.key !== 'Enter') {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
handler(evt);
|
|
35
|
+
};
|
|
28
36
|
}
|
|
29
|
-
|
|
30
37
|
/**
|
|
31
38
|
* Make sure the pressed key is the escape key before calling the callback.
|
|
32
39
|
*
|
|
@@ -34,14 +41,13 @@ function onEnterPressed(handler) {
|
|
|
34
41
|
* @return The decorated function.
|
|
35
42
|
*/
|
|
36
43
|
function onEscapePressed(handler) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
return (evt) => {
|
|
45
|
+
if (evt.key !== 'Escape') {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
handler(evt);
|
|
49
|
+
};
|
|
43
50
|
}
|
|
44
|
-
|
|
45
51
|
/**
|
|
46
52
|
* Handle button key pressed (Enter + Space).
|
|
47
53
|
*
|
|
@@ -49,12 +55,12 @@ function onEscapePressed(handler) {
|
|
|
49
55
|
* @return The decorated function.
|
|
50
56
|
*/
|
|
51
57
|
function onButtonPressed(handler) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
return (evt) => {
|
|
59
|
+
if (evt.key !== 'Enter' && evt.key !== ' ') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
handler(evt);
|
|
63
|
+
};
|
|
58
64
|
}
|
|
59
65
|
/**
|
|
60
66
|
* Detects swipe direction.
|
|
@@ -65,146 +71,153 @@ function onButtonPressed(handler) {
|
|
|
65
71
|
* @param handleSwipe Callback function.
|
|
66
72
|
* @return Function to remove listeners.
|
|
67
73
|
*/
|
|
68
|
-
function detectSwipe(touchSurface, handleSwipe =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
74
|
+
function detectSwipe(touchSurface, handleSwipe = noop__default["default"]) {
|
|
75
|
+
let distX;
|
|
76
|
+
let distY;
|
|
77
|
+
let startX;
|
|
78
|
+
let startY;
|
|
79
|
+
let direction;
|
|
80
|
+
// Required min distance traveled to be considered swipe.
|
|
81
|
+
const threshold = 150;
|
|
82
|
+
// Maximum distance allowed at the same time in perpendicular direction.
|
|
83
|
+
const restraint = 100;
|
|
84
|
+
// Maximum time allowed to travel that distance.
|
|
85
|
+
const allowedTime = 300;
|
|
86
|
+
let elapsedTime;
|
|
87
|
+
let startTime;
|
|
88
|
+
const onTouchStart = (evt) => {
|
|
89
|
+
const [touch] = Array.from(evt.changedTouches);
|
|
90
|
+
direction = 'none';
|
|
91
|
+
// Const dist = 0;
|
|
92
|
+
startX = touch.pageX;
|
|
93
|
+
startY = touch.pageY;
|
|
94
|
+
// Record time when finger first makes contact with surface.
|
|
95
|
+
startTime = new Date().getTime();
|
|
96
|
+
evt.preventDefault();
|
|
97
|
+
};
|
|
98
|
+
const onTouchMove = (evt) => {
|
|
99
|
+
// Prevent scrolling when inside DIV.
|
|
100
|
+
evt.preventDefault();
|
|
101
|
+
};
|
|
102
|
+
const onTouchEnd = (evt) => {
|
|
103
|
+
const [touch] = Array.from(evt.changedTouches);
|
|
104
|
+
// Get horizontal dist traveled by finger while in contact with surface.
|
|
105
|
+
distX = touch.pageX - startX;
|
|
106
|
+
// Get vertical dist traveled by finger while in contact with surface.
|
|
107
|
+
distY = touch.pageY - startY;
|
|
108
|
+
// Get time elapsed.
|
|
109
|
+
elapsedTime = new Date().getTime() - startTime;
|
|
110
|
+
if (elapsedTime <= allowedTime) {
|
|
111
|
+
// First condition for awipe met.
|
|
112
|
+
if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint) {
|
|
113
|
+
// 2nd condition for horizontal swipe met.
|
|
114
|
+
// If dist traveled is negative, it indicates left swipe.
|
|
115
|
+
direction = distX < 0 ? 'left' : 'right';
|
|
116
|
+
}
|
|
117
|
+
else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint) {
|
|
118
|
+
// 2nd condition for vertical swipe met.
|
|
119
|
+
// If dist traveled is negative, it indicates up swipe.
|
|
120
|
+
direction = distY < 0 ? 'up' : 'down';
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
handleSwipe(direction);
|
|
124
|
+
evt.preventDefault();
|
|
125
|
+
};
|
|
126
|
+
touchSurface.addEventListener('touchstart', onTouchStart, false);
|
|
127
|
+
touchSurface.addEventListener('touchmove', onTouchMove, false);
|
|
128
|
+
touchSurface.addEventListener('touchend', onTouchEnd, false);
|
|
129
|
+
return () => {
|
|
130
|
+
touchSurface.removeEventListener('touchstart', onTouchStart, false);
|
|
131
|
+
touchSurface.removeEventListener('touchmove', onTouchMove, false);
|
|
132
|
+
touchSurface.removeEventListener('touchend', onTouchEnd, false);
|
|
133
|
+
};
|
|
127
134
|
}
|
|
128
|
-
|
|
129
135
|
/**
|
|
130
136
|
* Checks whether or not the browser support passive events.
|
|
131
137
|
* @see https://github.com/Modernizr/Modernizr/blob/6d56d814b9682843313b16060adb25a58d83a317/feature-detects/dom/passiveeventlisteners.js
|
|
132
138
|
*/
|
|
133
139
|
function isPassiveEventAvailable() {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
let supportsPassiveOption = false;
|
|
141
|
+
try {
|
|
142
|
+
const opts = Object.defineProperty({}, 'passive', {
|
|
143
|
+
get() {
|
|
144
|
+
supportsPassiveOption = true;
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
window.addEventListener('testPassiveEventSupport', noop__default["default"], opts);
|
|
148
|
+
window.removeEventListener('testPassiveEventSupport', noop__default["default"], opts);
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
// ignored
|
|
152
|
+
}
|
|
153
|
+
return supportsPassiveOption;
|
|
147
154
|
}
|
|
148
|
-
|
|
149
155
|
/**
|
|
150
156
|
* Detects horizontal swipe direction without blocking the browser scroll using passive event.
|
|
151
157
|
* @see http://javascriptkit.com/javatutors/touchevents2.shtml
|
|
152
158
|
* @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
|
153
159
|
*/
|
|
154
160
|
function detectHorizontalSwipe(touchSurface, handleSwipe) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
touchSurface.removeEventListener('touchstart', onTouchStart, eventOptions);
|
|
206
|
-
touchSurface.removeEventListener('touchmove', onTouchMove, eventOptions);
|
|
207
|
-
};
|
|
161
|
+
let startX;
|
|
162
|
+
let startY;
|
|
163
|
+
// Required min distance traveled to be considered swipe.
|
|
164
|
+
const threshold = 150;
|
|
165
|
+
// Maximum distance allowed at the same time in perpendicular direction.
|
|
166
|
+
const restraint = 150;
|
|
167
|
+
// Maximum time allowed to travel that distance.
|
|
168
|
+
const allowedTime = 300;
|
|
169
|
+
let elapsedTime;
|
|
170
|
+
let startTime;
|
|
171
|
+
let finished;
|
|
172
|
+
const onTouchStart = (evt) => {
|
|
173
|
+
const [touch] = Array.from(evt.changedTouches);
|
|
174
|
+
startX = touch.pageX;
|
|
175
|
+
startY = touch.pageY;
|
|
176
|
+
// Record time when finger first makes contact with surface.
|
|
177
|
+
startTime = new Date().getTime();
|
|
178
|
+
finished = false;
|
|
179
|
+
};
|
|
180
|
+
const onTouchMove = (evt) => {
|
|
181
|
+
if (finished) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
elapsedTime = new Date().getTime() - startTime;
|
|
185
|
+
if (elapsedTime > allowedTime) {
|
|
186
|
+
// Touch swipe too long to be considered.
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const [touch] = Array.from(evt.changedTouches);
|
|
190
|
+
// Get horizontal dist traveled by finger while in contact with surface.
|
|
191
|
+
const distX = touch.pageX - startX;
|
|
192
|
+
// Get vertical dist traveled by finger while in contact with surface.
|
|
193
|
+
const distY = touch.pageY - startY;
|
|
194
|
+
if (!(Math.abs(distX) >= threshold && Math.abs(distY) <= restraint)) {
|
|
195
|
+
// Swipe is not horizontal.
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
// Swipe direction.
|
|
199
|
+
const direction = distX < 0 ? 'left' : 'right';
|
|
200
|
+
handleSwipe(direction);
|
|
201
|
+
finished = true;
|
|
202
|
+
};
|
|
203
|
+
// Activate passive event if possible for better scrolling performance.
|
|
204
|
+
const eventOptions = isPassiveEventAvailable() ? { passive: true } : false;
|
|
205
|
+
touchSurface.addEventListener('touchstart', onTouchStart, eventOptions);
|
|
206
|
+
touchSurface.addEventListener('touchmove', onTouchMove, eventOptions);
|
|
207
|
+
return () => {
|
|
208
|
+
touchSurface.removeEventListener('touchstart', onTouchStart, eventOptions);
|
|
209
|
+
touchSurface.removeEventListener('touchmove', onTouchMove, eventOptions);
|
|
210
|
+
};
|
|
208
211
|
}
|
|
209
212
|
|
|
210
|
-
|
|
213
|
+
exports.handleBasicClasses = js_utils_className_handleBasicClasses.handleBasicClasses;
|
|
214
|
+
exports.getBasicClass = js_utils_className_getBasicClass.getBasicClass;
|
|
215
|
+
exports.getRootClassName = js_utils_className_getRootClassName.getRootClassName;
|
|
216
|
+
exports.getTypographyClassName = js_utils_className_getTypographyClassName.getTypographyClassName;
|
|
217
|
+
exports.fontColorClass = js_utils_className_fontColorClass.fontColorClass;
|
|
218
|
+
exports.resolveColorWithVariants = js_utils_className_resolveColorWithVariants.resolveColorWithVariants;
|
|
219
|
+
exports.detectHorizontalSwipe = detectHorizontalSwipe;
|
|
220
|
+
exports.detectSwipe = detectSwipe;
|
|
221
|
+
exports.onButtonPressed = onButtonPressed;
|
|
222
|
+
exports.onEnterPressed = onEnterPressed;
|
|
223
|
+
exports.onEscapePressed = onEscapePressed;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("lodash/noop"),t=require("./className/handleBasicClasses.min.js"),s=require("./className/getBasicClass.min.js"),r=require("./className/getRootClassName.min.js"),a=require("./className/getTypographyClassName.min.js"),n=require("./className/fontColorClass.min.js"),o=require("./className/resolveColorWithVariants.min.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("classnames"),require("lodash/isBoolean"),require("lodash/isEmpty"),require("lodash/kebabCase"),require("../constants/index.min.js"),require("../constants/keycodes.min.js");var u=i(e);exports.handleBasicClasses=t.handleBasicClasses,exports.getBasicClass=s.getBasicClass,exports.getRootClassName=r.getRootClassName,exports.getTypographyClassName=a.getTypographyClassName,exports.fontColorClass=n.fontColorClass,exports.resolveColorWithVariants=o.resolveColorWithVariants,exports.detectHorizontalSwipe=function(e,t){let s,r,a,n,o;const i=e=>{const[t]=Array.from(e.changedTouches);s=t.pageX,r=t.pageY,n=(new Date).getTime(),o=!1},c=e=>{if(o)return;if(a=(new Date).getTime()-n,a>300)return;const[i]=Array.from(e.changedTouches),u=i.pageX-s,c=i.pageY-r;if(!(Math.abs(u)>=150&&Math.abs(c)<=150))return;t(u<0?"left":"right"),o=!0},l=!!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get(){e=!0}});window.addEventListener("testPassiveEventSupport",u.default,t),window.removeEventListener("testPassiveEventSupport",u.default,t)}catch(e){}return e}()&&{passive:!0};return e.addEventListener("touchstart",i,l),e.addEventListener("touchmove",c,l),()=>{e.removeEventListener("touchstart",i,l),e.removeEventListener("touchmove",c,l)}},exports.detectSwipe=function(e,t=u.default){let s,r,a,n,o,i,c;const l=e=>{const[t]=Array.from(e.changedTouches);o="none",a=t.pageX,n=t.pageY,c=(new Date).getTime(),e.preventDefault()},p=e=>{e.preventDefault()},d=e=>{const[u]=Array.from(e.changedTouches);s=u.pageX-a,r=u.pageY-n,i=(new Date).getTime()-c,i<=300&&(Math.abs(s)>=150&&Math.abs(r)<=100?o=s<0?"left":"right":Math.abs(r)>=150&&Math.abs(s)<=100&&(o=r<0?"up":"down")),t(o),e.preventDefault()};return e.addEventListener("touchstart",l,!1),e.addEventListener("touchmove",p,!1),e.addEventListener("touchend",d,!1),()=>{e.removeEventListener("touchstart",l,!1),e.removeEventListener("touchmove",p,!1),e.removeEventListener("touchend",d,!1)}},exports.onButtonPressed=function(e){return t=>{"Enter"!==t.key&&" "!==t.key||e(t)}},exports.onEnterPressed=function(e){return t=>{"Enter"===t.key&&e(t)}},exports.onEscapePressed=function(e){return t=>{"Escape"===t.key&&e(t)}};
|