@lumx/core 3.18.2-alpha.4 → 3.19.1-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 (89) hide show
  1. package/js/constants/index.js +167 -0
  2. package/js/constants/index.min.js +1 -1
  3. package/js/constants/index.ts +195 -0
  4. package/js/types/Callback.js +2 -0
  5. package/js/types/Callback.min.js +1 -0
  6. package/js/types/Callback.ts +4 -0
  7. package/js/types/Falsy.js +2 -0
  8. package/js/types/Falsy.min.js +1 -0
  9. package/js/types/Falsy.ts +5 -0
  10. package/js/types/GenericProps.js +2 -0
  11. package/js/types/GenericProps.min.js +1 -0
  12. package/js/types/GenericProps.ts +11 -0
  13. package/js/types/HasAriaLabelOrLabelledBy.js +2 -0
  14. package/js/types/HasAriaLabelOrLabelledBy.min.js +1 -0
  15. package/js/types/HasAriaLabelOrLabelledBy.ts +19 -0
  16. package/js/types/HasClassName.js +2 -0
  17. package/js/types/HasClassName.min.js +1 -0
  18. package/js/types/HasClassName.ts +6 -0
  19. package/js/types/HasCloseMode.js +2 -0
  20. package/js/types/HasCloseMode.min.js +1 -0
  21. package/js/types/HasCloseMode.ts +7 -0
  22. package/js/types/HasTheme.js +2 -0
  23. package/js/types/HasTheme.min.js +1 -0
  24. package/js/types/HasTheme.ts +8 -0
  25. package/js/types/HeadingElement.js +2 -0
  26. package/js/types/HeadingElement.min.js +1 -0
  27. package/js/types/HeadingElement.ts +2 -0
  28. package/js/types/Point.js +2 -0
  29. package/js/types/Point.min.js +1 -0
  30. package/js/types/Point.ts +4 -0
  31. package/js/types/Predicate.js +2 -0
  32. package/js/types/Predicate.min.js +1 -0
  33. package/js/types/Predicate.ts +2 -0
  34. package/js/types/RectSize.js +2 -0
  35. package/js/types/RectSize.min.js +1 -0
  36. package/js/types/RectSize.ts +4 -0
  37. package/js/types/TextElement.js +2 -0
  38. package/js/types/TextElement.min.js +1 -0
  39. package/js/types/TextElement.ts +4 -0
  40. package/js/types/ValueOf.js +2 -0
  41. package/js/types/ValueOf.min.js +1 -0
  42. package/js/types/ValueOf.ts +2 -0
  43. package/js/types/index.js +2 -0
  44. package/js/types/index.min.js +1 -0
  45. package/js/types/index.ts +13 -0
  46. package/js/utils/className/fontColorClass.js +20 -0
  47. package/js/utils/className/fontColorClass.min.js +1 -0
  48. package/js/utils/className/fontColorClass.test.js +18 -0
  49. package/js/utils/className/fontColorClass.test.min.js +1 -0
  50. package/js/utils/className/fontColorClass.test.ts +15 -0
  51. package/js/utils/className/fontColorClass.ts +12 -0
  52. package/js/utils/className/getBasicClass.js +36 -0
  53. package/js/utils/className/getBasicClass.min.js +1 -0
  54. package/js/utils/className/getBasicClass.test.js +22 -0
  55. package/js/utils/className/getBasicClass.test.min.js +1 -0
  56. package/js/utils/className/getBasicClass.test.ts +20 -0
  57. package/js/utils/className/getBasicClass.ts +36 -0
  58. package/js/utils/className/getRootClassName.js +33 -0
  59. package/js/utils/className/getRootClassName.min.js +1 -0
  60. package/js/utils/className/getRootClassName.test.js +15 -0
  61. package/js/utils/className/getRootClassName.test.min.js +1 -0
  62. package/js/utils/className/getRootClassName.test.ts +11 -0
  63. package/js/utils/className/getRootClassName.ts +25 -0
  64. package/js/utils/className/getTypographyClassName.js +13 -0
  65. package/js/utils/className/getTypographyClassName.min.js +1 -0
  66. package/js/utils/className/getTypographyClassName.test.js +9 -0
  67. package/js/utils/className/getTypographyClassName.test.min.js +1 -0
  68. package/js/utils/className/getTypographyClassName.test.ts +7 -0
  69. package/js/utils/className/getTypographyClassName.ts +9 -0
  70. package/js/utils/className/handleBasicClasses.js +52 -0
  71. package/js/utils/className/handleBasicClasses.min.js +1 -0
  72. package/js/utils/className/handleBasicClasses.test.js +35 -0
  73. package/js/utils/className/handleBasicClasses.test.min.js +1 -0
  74. package/js/utils/className/handleBasicClasses.test.ts +28 -0
  75. package/js/utils/className/handleBasicClasses.ts +44 -0
  76. package/js/utils/className/index.js +25 -0
  77. package/js/utils/className/index.min.js +1 -0
  78. package/js/utils/className/index.ts +6 -0
  79. package/js/utils/className/resolveColorWithVariants.js +13 -0
  80. package/js/utils/className/resolveColorWithVariants.min.js +1 -0
  81. package/js/utils/className/resolveColorWithVariants.test.js +30 -0
  82. package/js/utils/className/resolveColorWithVariants.test.min.js +1 -0
  83. package/js/utils/className/resolveColorWithVariants.test.ts +33 -0
  84. package/js/utils/className/resolveColorWithVariants.ts +11 -0
  85. package/js/{utils.js → utils/index.js} +48 -96
  86. package/js/utils/index.min.js +1 -0
  87. package/js/{utils.ts → utils/index.ts} +41 -116
  88. package/package.json +2 -1
  89. package/js/utils.min.js +0 -1
@@ -2,75 +2,65 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var classNames = require('classnames');
6
- var isBoolean = require('lodash/isBoolean');
7
- var isEmpty = require('lodash/isEmpty');
8
- var kebabCase = require('lodash/kebabCase');
9
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');
10
18
 
11
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
20
 
13
- var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
14
- var isBoolean__default = /*#__PURE__*/_interopDefaultLegacy(isBoolean);
15
- var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
16
- var kebabCase__default = /*#__PURE__*/_interopDefaultLegacy(kebabCase);
17
21
  var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
18
22
 
19
23
  /**
20
- * Enhance isEmpty method to also works with numbers.
24
+ * Make sure the pressed key is the enter key before calling the callback.
21
25
  *
22
- * @param value The value to check.
23
- * @return Whether the input value is empty or != 0.
26
+ * @param handler The handler to call on enter/return press.
27
+ * @return The decorated function.
24
28
  */
25
- const _isEmpty = (value) => {
26
- if (typeof value === 'number') {
27
- return value === 0;
28
- }
29
- return isEmpty__default["default"](value);
30
- };
29
+ function onEnterPressed(handler) {
30
+ return (evt) => {
31
+ if (evt.key !== 'Enter') {
32
+ return;
33
+ }
34
+ handler(evt);
35
+ };
36
+ }
31
37
  /**
32
- * Get the basic CSS class for the given type.
38
+ * Make sure the pressed key is the escape key before calling the callback.
33
39
  *
34
- * @param prefix The class name prefix for the generated CSS class.
35
- * @param type The type of CSS class we want to generate (e.g.: 'color', 'variant', ...).
36
- * @param value The value of the type of the CSS class (e.g.: 'primary', 'button', ...).
37
- * @return The basic CSS class.
40
+ * @param handler The handler to call on enter/return press.
41
+ * @return The decorated function.
38
42
  */
39
- function getBasicClass({ prefix, type, value, }) {
40
- if (isBoolean__default["default"](value)) {
41
- if (!value) {
42
- // False value should not return a class.
43
- return '';
44
- }
45
- const booleanPrefixes = ['has', 'is'];
46
- if (booleanPrefixes.some((booleanPrefix) => type.toString().startsWith(booleanPrefix))) {
47
- return `${prefix}--${kebabCase__default["default"](type)}`;
43
+ function onEscapePressed(handler) {
44
+ return (evt) => {
45
+ if (evt.key !== 'Escape') {
46
+ return;
48
47
  }
49
- return `${prefix}--is-${kebabCase__default["default"](type)}`;
50
- }
51
- return `${prefix}--${kebabCase__default["default"](type)}-${value}`;
48
+ handler(evt);
49
+ };
52
50
  }
53
51
  /**
54
- * Return all basic LumX CSS classes which are available for every components.
55
- *
56
- * @see {@link /src/components/index.d.ts} for the possible values of each parameter.
52
+ * Handle button key pressed (Enter + Space).
57
53
  *
58
- * @param prefix The class name prefix for the generated CSS class.
59
- * @param props All the other props you want to generate a class.
60
- * The rule of thumb: the key is the name of the prop in the class, the value a string that will
61
- * be used in the classname to represent the value of the given prop.
62
- * @return All LumX basic CSS classes.
54
+ * @param handler The handler to call.
55
+ * @return The decorated function.
63
56
  */
64
- function handleBasicClasses({ prefix, ...props }) {
65
- const otherClasses = {};
66
- if (!isEmpty__default["default"](props)) {
67
- Object.keys(props).forEach((prop) => {
68
- otherClasses[getBasicClass({ prefix, type: prop, value: props[prop] })] = isBoolean__default["default"](props[prop])
69
- ? props[prop]
70
- : !_isEmpty(props[prop]);
71
- });
72
- }
73
- return classNames__default["default"](prefix, otherClasses);
57
+ function onButtonPressed(handler) {
58
+ return (evt) => {
59
+ if (evt.key !== 'Enter' && evt.key !== ' ') {
60
+ return;
61
+ }
62
+ handler(evt);
63
+ };
74
64
  }
75
65
  /**
76
66
  * Detects swipe direction.
@@ -219,53 +209,15 @@ function detectHorizontalSwipe(touchSurface, handleSwipe) {
219
209
  touchSurface.removeEventListener('touchmove', onTouchMove, eventOptions);
220
210
  };
221
211
  }
222
- /**
223
- * Make sure the pressed key is the enter key before calling the callback.
224
- *
225
- * @param handler The handler to call on enter/return press.
226
- * @return The decorated function.
227
- */
228
- function onEnterPressed(handler) {
229
- return (evt) => {
230
- if (evt.key !== 'Enter') {
231
- return;
232
- }
233
- handler(evt);
234
- };
235
- }
236
- /**
237
- * Make sure the pressed key is the escape key before calling the callback.
238
- *
239
- * @param handler The handler to call on enter/return press.
240
- * @return The decorated function.
241
- */
242
- function onEscapePressed(handler) {
243
- return (evt) => {
244
- if (evt.key !== 'Escape') {
245
- return;
246
- }
247
- handler(evt);
248
- };
249
- }
250
- /**
251
- * Handle button key pressed (Enter + Space).
252
- *
253
- * @param handler The handler to call.
254
- * @return The decorated function.
255
- */
256
- function onButtonPressed(handler) {
257
- return (evt) => {
258
- if (evt.key !== 'Enter' && evt.key !== ' ') {
259
- return;
260
- }
261
- handler(evt);
262
- };
263
- }
264
212
 
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;
265
219
  exports.detectHorizontalSwipe = detectHorizontalSwipe;
266
220
  exports.detectSwipe = detectSwipe;
267
- exports.getBasicClass = getBasicClass;
268
- exports.handleBasicClasses = handleBasicClasses;
269
221
  exports.onButtonPressed = onButtonPressed;
270
222
  exports.onEnterPressed = onEnterPressed;
271
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)}};
@@ -1,82 +1,60 @@
1
- import classNames from 'classnames';
2
- // eslint-disable-next-line import/no-extraneous-dependencies
3
- import React from 'react';
1
+ import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
4
2
 
5
- import isBoolean from 'lodash/isBoolean';
6
- import isEmpty from 'lodash/isEmpty';
7
- import kebabCase from 'lodash/kebabCase';
8
3
  import noop from 'lodash/noop';
9
4
 
10
- /**
11
- * Enhance isEmpty method to also works with numbers.
12
- *
13
- * @param value The value to check.
14
- * @return Whether the input value is empty or != 0.
15
- */
16
- const _isEmpty = (value: any) => {
17
- if (typeof value === 'number') {
18
- return value === 0;
19
- }
5
+ export * from './className';
20
6
 
21
- return isEmpty(value);
22
- };
7
+ type KeyboardEventHandler<E extends KeyboardEvent | ReactKeyboardEvent> = (event: E) => void;
23
8
 
24
9
  /**
25
- * Get the basic CSS class for the given type.
10
+ * Make sure the pressed key is the enter key before calling the callback.
26
11
  *
27
- * @param prefix The class name prefix for the generated CSS class.
28
- * @param type The type of CSS class we want to generate (e.g.: 'color', 'variant', ...).
29
- * @param value The value of the type of the CSS class (e.g.: 'primary', 'button', ...).
30
- * @return The basic CSS class.
12
+ * @param handler The handler to call on enter/return press.
13
+ * @return The decorated function.
31
14
  */
32
- export function getBasicClass({
33
- prefix,
34
- type,
35
- value,
36
- }: {
37
- prefix: string;
38
- type: string;
39
- value: string | number | boolean | undefined;
40
- }): string {
41
- if (isBoolean(value)) {
42
- if (!value) {
43
- // False value should not return a class.
44
- return '';
15
+ export function onEnterPressed<E extends KeyboardEvent | ReactKeyboardEvent>(
16
+ handler: KeyboardEventHandler<E>,
17
+ ): KeyboardEventHandler<E> {
18
+ return (evt) => {
19
+ if (evt.key !== 'Enter') {
20
+ return;
45
21
  }
46
- const booleanPrefixes = ['has', 'is'];
22
+ handler(evt);
23
+ };
24
+ }
47
25
 
48
- if (booleanPrefixes.some((booleanPrefix) => type.toString().startsWith(booleanPrefix))) {
49
- return `${prefix}--${kebabCase(type)}`;
26
+ /**
27
+ * Make sure the pressed key is the escape key before calling the callback.
28
+ *
29
+ * @param handler The handler to call on enter/return press.
30
+ * @return The decorated function.
31
+ */
32
+ export function onEscapePressed<E extends KeyboardEvent | ReactKeyboardEvent>(
33
+ handler: KeyboardEventHandler<E>,
34
+ ): KeyboardEventHandler<E> {
35
+ return (evt) => {
36
+ if (evt.key !== 'Escape') {
37
+ return;
50
38
  }
51
-
52
- return `${prefix}--is-${kebabCase(type)}`;
53
- }
54
-
55
- return `${prefix}--${kebabCase(type)}-${value}`;
39
+ handler(evt);
40
+ };
56
41
  }
57
42
 
58
43
  /**
59
- * Return all basic LumX CSS classes which are available for every components.
60
- *
61
- * @see {@link /src/components/index.d.ts} for the possible values of each parameter.
44
+ * Handle button key pressed (Enter + Space).
62
45
  *
63
- * @param prefix The class name prefix for the generated CSS class.
64
- * @param props All the other props you want to generate a class.
65
- * The rule of thumb: the key is the name of the prop in the class, the value a string that will
66
- * be used in the classname to represent the value of the given prop.
67
- * @return All LumX basic CSS classes.
46
+ * @param handler The handler to call.
47
+ * @return The decorated function.
68
48
  */
69
- export function handleBasicClasses({ prefix, ...props }: { prefix: string; [prop: string]: any }): string {
70
- const otherClasses: any = {};
71
- if (!isEmpty(props)) {
72
- Object.keys(props).forEach((prop) => {
73
- otherClasses[getBasicClass({ prefix, type: prop, value: props[prop] })] = isBoolean(props[prop])
74
- ? props[prop]
75
- : !_isEmpty(props[prop]);
76
- });
77
- }
78
-
79
- return classNames(prefix, otherClasses);
49
+ export function onButtonPressed<E extends KeyboardEvent | ReactKeyboardEvent>(
50
+ handler: KeyboardEventHandler<E>,
51
+ ): KeyboardEventHandler<E> {
52
+ return (evt) => {
53
+ if (evt.key !== 'Enter' && evt.key !== ' ') {
54
+ return;
55
+ }
56
+ handler(evt);
57
+ };
80
58
  }
81
59
 
82
60
  declare type SwipeDirection = 'none' | 'up' | 'down' | 'left' | 'right';
@@ -241,56 +219,3 @@ export function detectHorizontalSwipe(touchSurface: Element, handleSwipe: (direc
241
219
  touchSurface.removeEventListener('touchmove', onTouchMove, eventOptions);
242
220
  };
243
221
  }
244
-
245
- type KeyboardEventHandler<E extends KeyboardEvent | React.KeyboardEvent> = (event: E) => void;
246
-
247
- /**
248
- * Make sure the pressed key is the enter key before calling the callback.
249
- *
250
- * @param handler The handler to call on enter/return press.
251
- * @return The decorated function.
252
- */
253
- export function onEnterPressed<E extends KeyboardEvent | React.KeyboardEvent>(
254
- handler: KeyboardEventHandler<E>,
255
- ): KeyboardEventHandler<E> {
256
- return (evt) => {
257
- if (evt.key !== 'Enter') {
258
- return;
259
- }
260
- handler(evt);
261
- };
262
- }
263
-
264
- /**
265
- * Make sure the pressed key is the escape key before calling the callback.
266
- *
267
- * @param handler The handler to call on enter/return press.
268
- * @return The decorated function.
269
- */
270
- export function onEscapePressed<E extends KeyboardEvent | React.KeyboardEvent>(
271
- handler: KeyboardEventHandler<E>,
272
- ): KeyboardEventHandler<E> {
273
- return (evt) => {
274
- if (evt.key !== 'Escape') {
275
- return;
276
- }
277
- handler(evt);
278
- };
279
- }
280
-
281
- /**
282
- * Handle button key pressed (Enter + Space).
283
- *
284
- * @param handler The handler to call.
285
- * @return The decorated function.
286
- */
287
- export function onButtonPressed<E extends KeyboardEvent | React.KeyboardEvent>(
288
- handler: KeyboardEventHandler<E>,
289
- ): KeyboardEventHandler<E> {
290
- return (evt) => {
291
- if (evt.key !== 'Enter' && evt.key !== ' ') {
292
- return;
293
- }
294
- handler(evt);
295
- };
296
- }
package/package.json CHANGED
@@ -33,11 +33,12 @@
33
33
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
34
34
  },
35
35
  "sideEffects": false,
36
- "version": "3.18.2-alpha.4",
36
+ "version": "3.19.1-alpha.0",
37
37
  "devDependencies": {
38
38
  "@rollup/plugin-commonjs": "^19.0.2",
39
39
  "@rollup/plugin-terser": "^0.4.4",
40
40
  "@rollup/plugin-typescript": "^12.1.4",
41
+ "@types/react": "^17.0.2",
41
42
  "autoprefixer": "^9.7.4",
42
43
  "glob": "^7.1.6",
43
44
  "postcss": "^8.5.6",
package/js/utils.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("classnames"),t=require("lodash/isBoolean"),r=require("lodash/isEmpty"),n=require("lodash/kebabCase"),a=require("lodash/noop");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(e),u=s(t),i=s(r),c=s(n),d=s(a);function f({prefix:e,type:t,value:r}){if(u.default(r)){if(!r)return"";return["has","is"].some(e=>t.toString().startsWith(e))?`${e}--${c.default(t)}`:`${e}--is-${c.default(t)}`}return`${e}--${c.default(t)}-${r}`}exports.detectHorizontalSwipe=function(e,t){let r,n,a,s,o;const u=e=>{const[t]=Array.from(e.changedTouches);r=t.pageX,n=t.pageY,s=(new Date).getTime(),o=!1},i=e=>{if(o)return;if(a=(new Date).getTime()-s,a>300)return;const[u]=Array.from(e.changedTouches),i=u.pageX-r,c=u.pageY-n;if(!(Math.abs(i)>=150&&Math.abs(c)<=150))return;t(i<0?"left":"right"),o=!0},c=!!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get(){e=!0}});window.addEventListener("testPassiveEventSupport",d.default,t),window.removeEventListener("testPassiveEventSupport",d.default,t)}catch(e){}return e}()&&{passive:!0};return e.addEventListener("touchstart",u,c),e.addEventListener("touchmove",i,c),()=>{e.removeEventListener("touchstart",u,c),e.removeEventListener("touchmove",i,c)}},exports.detectSwipe=function(e,t=d.default){let r,n,a,s,o,u,i;const c=e=>{const[t]=Array.from(e.changedTouches);o="none",a=t.pageX,s=t.pageY,i=(new Date).getTime(),e.preventDefault()},f=e=>{e.preventDefault()},p=e=>{const[c]=Array.from(e.changedTouches);r=c.pageX-a,n=c.pageY-s,u=(new Date).getTime()-i,u<=300&&(Math.abs(r)>=150&&Math.abs(n)<=100?o=r<0?"left":"right":Math.abs(n)>=150&&Math.abs(r)<=100&&(o=n<0?"up":"down")),t(o),e.preventDefault()};return e.addEventListener("touchstart",c,!1),e.addEventListener("touchmove",f,!1),e.addEventListener("touchend",p,!1),()=>{e.removeEventListener("touchstart",c,!1),e.removeEventListener("touchmove",f,!1),e.removeEventListener("touchend",p,!1)}},exports.getBasicClass=f,exports.handleBasicClasses=function({prefix:e,...t}){const r={};return i.default(t)||Object.keys(t).forEach(n=>{var a;r[f({prefix:e,type:n,value:t[n]})]=u.default(t[n])?t[n]:!("number"==typeof(a=t[n])?0===a:i.default(a))}),o.default(e,r)},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)}};