@lumx/core 3.20.1-alpha.5 → 3.20.1-alpha.50

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 (156) hide show
  1. package/CONTRIBUTING.md +1 -5
  2. package/{js/utils/className/resolveColorWithVariants.js → _internal/DPnPEC08.js} +1 -5
  3. package/js/constants/_internal/design-tokens.d.ts +5421 -0
  4. package/js/constants/className/index.d.ts +4 -0
  5. package/js/constants/className/index.js +6 -0
  6. package/js/constants/components/index.d.ts +24 -0
  7. package/js/constants/components/index.js +26 -0
  8. package/js/constants/enums/index.d.ts +200 -0
  9. package/js/constants/enums/index.js +155 -0
  10. package/js/constants/index.d.ts +4 -0
  11. package/js/constants/index.js +4 -218
  12. package/js/constants/keycodes/index.d.ts +36 -0
  13. package/js/constants/{keycodes.js → keycodes/index.js} +1 -13
  14. package/js/types/Direction.d.ts +1 -0
  15. package/js/types/{GenericProps.ts → GenericProps.d.ts} +0 -1
  16. package/js/types/HasAriaLabelOrLabelledBy.d.ts +17 -0
  17. package/js/types/{HasTheme.ts → HasTheme.d.ts} +0 -1
  18. package/js/types/KebabCase.d.ts +2 -0
  19. package/js/types/LumxClassName.d.ts +3 -0
  20. package/js/types/Point.d.ts +7 -0
  21. package/js/types/RectSize.d.ts +7 -0
  22. package/js/types/Spacing.d.ts +1 -0
  23. package/js/types/{TextElement.ts → TextElement.d.ts} +0 -1
  24. package/js/types/{index.ts → index.d.ts} +4 -0
  25. package/js/types/index.js +0 -1
  26. package/js/utils/_internal/color/index.d.ts +1 -0
  27. package/js/utils/_internal/color/resolveColorWithVariants.d.ts +3 -0
  28. package/js/utils/classNames/bem/block.d.ts +18 -0
  29. package/js/utils/classNames/bem/block.js +20 -0
  30. package/js/utils/classNames/bem/element.d.ts +19 -0
  31. package/js/utils/classNames/bem/element.js +21 -0
  32. package/js/utils/classNames/bem/generateBEMClass.d.ts +27 -0
  33. package/js/utils/classNames/bem/generateBEMClass.js +48 -0
  34. package/js/utils/classNames/bem/index.d.ts +2 -0
  35. package/js/utils/classNames/bem/index.js +2 -0
  36. package/js/utils/classNames/color/index.d.ts +43 -0
  37. package/js/utils/classNames/color/index.js +50 -0
  38. package/js/utils/classNames/index.d.ts +6 -0
  39. package/js/utils/classNames/index.js +7 -0
  40. package/js/utils/classNames/spacing/index.d.ts +70 -0
  41. package/js/utils/classNames/spacing/index.js +74 -0
  42. package/js/utils/classNames/typography/index.d.ts +6 -0
  43. package/js/utils/classNames/typography/index.js +9 -0
  44. package/js/utils/classNames/visually-hidden/index.d.ts +5 -0
  45. package/js/utils/classNames/visually-hidden/index.js +10 -0
  46. package/js/utils/events/index.d.ts +2 -0
  47. package/js/utils/events/index.js +2 -0
  48. package/js/utils/events/keyboard.d.ts +24 -0
  49. package/js/utils/events/keyboard.js +44 -0
  50. package/js/utils/events/swipe.d.ts +6 -0
  51. package/js/utils/events/swipe.js +79 -0
  52. package/js/utils/index.d.ts +2 -0
  53. package/js/utils/index.js +4 -223
  54. package/lumx.css +18 -17
  55. package/package.json +11 -15
  56. package/scss/components/list/_index.scss +10 -4
  57. package/scss/components/text-field/_index.scss +4 -6
  58. package/js/components/Icon/Stories.js +0 -40
  59. package/js/components/Icon/Tests.tsx +0 -120
  60. package/js/components/Icon/index.tsx +0 -134
  61. package/js/constants/design-tokens.js +0 -2329
  62. package/js/constants/design-tokens.min.js +0 -1
  63. package/js/constants/design-tokens.ts +0 -2324
  64. package/js/constants/index.min.js +0 -1
  65. package/js/constants/index.ts +0 -231
  66. package/js/constants/keycodes.min.js +0 -1
  67. package/js/constants/keycodes.ts +0 -44
  68. package/js/custom-colors.js +0 -48
  69. package/js/custom-colors.min.js +0 -1
  70. package/js/custom-colors.ts +0 -56
  71. package/js/date-picker.js +0 -71
  72. package/js/date-picker.min.js +0 -1
  73. package/js/date-picker.ts +0 -77
  74. package/js/types/Callback.js +0 -2
  75. package/js/types/Callback.min.js +0 -1
  76. package/js/types/Falsy.js +0 -2
  77. package/js/types/Falsy.min.js +0 -1
  78. package/js/types/GenericProps.js +0 -2
  79. package/js/types/GenericProps.min.js +0 -1
  80. package/js/types/HasAriaLabelOrLabelledBy.js +0 -2
  81. package/js/types/HasAriaLabelOrLabelledBy.min.js +0 -1
  82. package/js/types/HasAriaLabelOrLabelledBy.ts +0 -19
  83. package/js/types/HasClassName.js +0 -2
  84. package/js/types/HasClassName.min.js +0 -1
  85. package/js/types/HasCloseMode.js +0 -2
  86. package/js/types/HasCloseMode.min.js +0 -1
  87. package/js/types/HasTheme.js +0 -2
  88. package/js/types/HasTheme.min.js +0 -1
  89. package/js/types/HeadingElement.js +0 -2
  90. package/js/types/HeadingElement.min.js +0 -1
  91. package/js/types/Point.js +0 -2
  92. package/js/types/Point.min.js +0 -1
  93. package/js/types/Point.ts +0 -4
  94. package/js/types/Predicate.js +0 -2
  95. package/js/types/Predicate.min.js +0 -1
  96. package/js/types/RectSize.js +0 -2
  97. package/js/types/RectSize.min.js +0 -1
  98. package/js/types/RectSize.ts +0 -4
  99. package/js/types/TextElement.js +0 -2
  100. package/js/types/TextElement.min.js +0 -1
  101. package/js/types/ValueOf.js +0 -2
  102. package/js/types/ValueOf.min.js +0 -1
  103. package/js/types/index.min.js +0 -1
  104. package/js/utils/className/fontColorClass.js +0 -20
  105. package/js/utils/className/fontColorClass.min.js +0 -1
  106. package/js/utils/className/fontColorClass.test.js +0 -18
  107. package/js/utils/className/fontColorClass.test.min.js +0 -1
  108. package/js/utils/className/fontColorClass.test.ts +0 -15
  109. package/js/utils/className/fontColorClass.ts +0 -12
  110. package/js/utils/className/getBasicClass.js +0 -36
  111. package/js/utils/className/getBasicClass.min.js +0 -1
  112. package/js/utils/className/getBasicClass.test.js +0 -22
  113. package/js/utils/className/getBasicClass.test.min.js +0 -1
  114. package/js/utils/className/getBasicClass.test.ts +0 -20
  115. package/js/utils/className/getBasicClass.ts +0 -36
  116. package/js/utils/className/getRootClassName.js +0 -33
  117. package/js/utils/className/getRootClassName.min.js +0 -1
  118. package/js/utils/className/getRootClassName.test.js +0 -15
  119. package/js/utils/className/getRootClassName.test.min.js +0 -1
  120. package/js/utils/className/getRootClassName.test.ts +0 -11
  121. package/js/utils/className/getRootClassName.ts +0 -25
  122. package/js/utils/className/getTypographyClassName.js +0 -13
  123. package/js/utils/className/getTypographyClassName.min.js +0 -1
  124. package/js/utils/className/getTypographyClassName.test.js +0 -9
  125. package/js/utils/className/getTypographyClassName.test.min.js +0 -1
  126. package/js/utils/className/getTypographyClassName.test.ts +0 -7
  127. package/js/utils/className/getTypographyClassName.ts +0 -9
  128. package/js/utils/className/handleBasicClasses.js +0 -52
  129. package/js/utils/className/handleBasicClasses.min.js +0 -1
  130. package/js/utils/className/handleBasicClasses.test.js +0 -35
  131. package/js/utils/className/handleBasicClasses.test.min.js +0 -1
  132. package/js/utils/className/handleBasicClasses.test.ts +0 -28
  133. package/js/utils/className/handleBasicClasses.ts +0 -44
  134. package/js/utils/className/index.js +0 -25
  135. package/js/utils/className/index.min.js +0 -1
  136. package/js/utils/className/index.ts +0 -6
  137. package/js/utils/className/resolveColorWithVariants.min.js +0 -1
  138. package/js/utils/className/resolveColorWithVariants.test.js +0 -30
  139. package/js/utils/className/resolveColorWithVariants.test.min.js +0 -1
  140. package/js/utils/className/resolveColorWithVariants.test.ts +0 -33
  141. package/js/utils/className/resolveColorWithVariants.ts +0 -11
  142. package/js/utils/index.min.js +0 -1
  143. package/js/utils/index.ts +0 -221
  144. package/lumx.min.css +0 -1
  145. package/stories/controls/color.ts +0 -7
  146. package/stories/controls/icons.ts +0 -126
  147. package/stories/controls/selectArgType.ts +0 -8
  148. package/stories/controls/withUndefined.ts +0 -1
  149. package/testing/utils/queries.ts +0 -19
  150. /package/js/types/{Callback.ts → Callback.d.ts} +0 -0
  151. /package/js/types/{Falsy.ts → Falsy.d.ts} +0 -0
  152. /package/js/types/{HasClassName.ts → HasClassName.d.ts} +0 -0
  153. /package/js/types/{HasCloseMode.ts → HasCloseMode.d.ts} +0 -0
  154. /package/js/types/{HeadingElement.ts → HeadingElement.d.ts} +0 -0
  155. /package/js/types/{Predicate.ts → Predicate.d.ts} +0 -0
  156. /package/js/types/{ValueOf.ts → ValueOf.d.ts} +0 -0
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Make sure the pressed key is the enter key before calling the callback.
3
+ *
4
+ * @param handler The handler to call on enter/return press.
5
+ * @return The decorated function.
6
+ */
7
+ function onEnterPressed(handler) {
8
+ return (evt) => {
9
+ if (evt.key !== 'Enter') {
10
+ return;
11
+ }
12
+ handler(evt);
13
+ };
14
+ }
15
+ /**
16
+ * Make sure the pressed key is the escape key before calling the callback.
17
+ *
18
+ * @param handler The handler to call on enter/return press.
19
+ * @return The decorated function.
20
+ */
21
+ function onEscapePressed(handler) {
22
+ return (evt) => {
23
+ if (evt.key !== 'Escape') {
24
+ return;
25
+ }
26
+ handler(evt);
27
+ };
28
+ }
29
+ /**
30
+ * Handle button key pressed (Enter + Space).
31
+ *
32
+ * @param handler The handler to call.
33
+ * @return The decorated function.
34
+ */
35
+ function onButtonPressed(handler) {
36
+ return (evt) => {
37
+ if (evt.key !== 'Enter' && evt.key !== ' ') {
38
+ return;
39
+ }
40
+ handler(evt);
41
+ };
42
+ }
43
+
44
+ export { onButtonPressed, onEnterPressed, onEscapePressed };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Detects horizontal swipe direction without blocking the browser scroll using passive event.
3
+ * @see http://javascriptkit.com/javatutors/touchevents2.shtml
4
+ * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
5
+ */
6
+ export declare function detectHorizontalSwipe(touchSurface: Element, handleSwipe: (direction: 'right' | 'left') => void): () => void;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Checks whether the browser support passive events.
3
+ * @see https://github.com/Modernizr/Modernizr/blob/6d56d814b9682843313b16060adb25a58d83a317/feature-detects/dom/passiveeventlisteners.js
4
+ */
5
+ function isPassiveEventAvailable() {
6
+ let supportsPassiveOption = false;
7
+ try {
8
+ const opts = Object.defineProperty({}, 'passive', {
9
+ get() {
10
+ supportsPassiveOption = true;
11
+ },
12
+ });
13
+ window.addEventListener('testPassiveEventSupport', () => { }, opts);
14
+ window.removeEventListener('testPassiveEventSupport', () => { }, opts);
15
+ }
16
+ catch (e) {
17
+ // ignored
18
+ }
19
+ return supportsPassiveOption;
20
+ }
21
+ /**
22
+ * Detects horizontal swipe direction without blocking the browser scroll using passive event.
23
+ * @see http://javascriptkit.com/javatutors/touchevents2.shtml
24
+ * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
25
+ */
26
+ function detectHorizontalSwipe(touchSurface, handleSwipe) {
27
+ let startX;
28
+ let startY;
29
+ // Required min distance traveled to be considered swipe.
30
+ const threshold = 150;
31
+ // Maximum distance allowed at the same time in perpendicular direction.
32
+ const restraint = 150;
33
+ // Maximum time allowed to travel that distance.
34
+ const allowedTime = 300;
35
+ let elapsedTime;
36
+ let startTime;
37
+ let finished;
38
+ const onTouchStart = (evt) => {
39
+ const [touch] = Array.from(evt.changedTouches);
40
+ startX = touch.pageX;
41
+ startY = touch.pageY;
42
+ // Record time when finger first makes contact with surface.
43
+ startTime = new Date().getTime();
44
+ finished = false;
45
+ };
46
+ const onTouchMove = (evt) => {
47
+ if (finished) {
48
+ return;
49
+ }
50
+ elapsedTime = new Date().getTime() - startTime;
51
+ if (elapsedTime > allowedTime) {
52
+ // Touch swipe too long to be considered.
53
+ return;
54
+ }
55
+ const [touch] = Array.from(evt.changedTouches);
56
+ // Get horizontal dist traveled by finger while in contact with surface.
57
+ const distX = touch.pageX - startX;
58
+ // Get vertical dist traveled by finger while in contact with surface.
59
+ const distY = touch.pageY - startY;
60
+ if (!(Math.abs(distX) >= threshold && Math.abs(distY) <= restraint)) {
61
+ // Swipe is not horizontal.
62
+ return;
63
+ }
64
+ // Swipe direction.
65
+ const direction = distX < 0 ? 'left' : 'right';
66
+ handleSwipe(direction);
67
+ finished = true;
68
+ };
69
+ // Activate passive event if possible for better scrolling performance.
70
+ const eventOptions = isPassiveEventAvailable() ? { passive: true } : false;
71
+ touchSurface.addEventListener('touchstart', onTouchStart, eventOptions);
72
+ touchSurface.addEventListener('touchmove', onTouchMove, eventOptions);
73
+ return () => {
74
+ touchSurface.removeEventListener('touchstart', onTouchStart, eventOptions);
75
+ touchSurface.removeEventListener('touchmove', onTouchMove, eventOptions);
76
+ };
77
+ }
78
+
79
+ export { detectHorizontalSwipe };
@@ -0,0 +1,2 @@
1
+ export * as classNames from './classNames';
2
+ export * from './events';
package/js/utils/index.js CHANGED
@@ -1,223 +1,4 @@
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);
22
-
23
- /**
24
- * Make sure the pressed key is the enter key before calling the callback.
25
- *
26
- * @param handler The handler to call on enter/return press.
27
- * @return The decorated function.
28
- */
29
- function onEnterPressed(handler) {
30
- return (evt) => {
31
- if (evt.key !== 'Enter') {
32
- return;
33
- }
34
- handler(evt);
35
- };
36
- }
37
- /**
38
- * Make sure the pressed key is the escape key before calling the callback.
39
- *
40
- * @param handler The handler to call on enter/return press.
41
- * @return The decorated function.
42
- */
43
- function onEscapePressed(handler) {
44
- return (evt) => {
45
- if (evt.key !== 'Escape') {
46
- return;
47
- }
48
- handler(evt);
49
- };
50
- }
51
- /**
52
- * Handle button key pressed (Enter + Space).
53
- *
54
- * @param handler The handler to call.
55
- * @return The decorated function.
56
- */
57
- function onButtonPressed(handler) {
58
- return (evt) => {
59
- if (evt.key !== 'Enter' && evt.key !== ' ') {
60
- return;
61
- }
62
- handler(evt);
63
- };
64
- }
65
- /**
66
- * Detects swipe direction.
67
- * Credits: http://javascriptkit.com/javatutors/touchevents2.shtml.
68
- *
69
- * @deprecated use `detectHorizontalSwipe` instead if possible (better performance and does not block scroll)
70
- * @param touchSurface Element that will hold touch events.
71
- * @param handleSwipe Callback function.
72
- * @return Function to remove listeners.
73
- */
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
- };
134
- }
135
- /**
136
- * Checks whether or not the browser support passive events.
137
- * @see https://github.com/Modernizr/Modernizr/blob/6d56d814b9682843313b16060adb25a58d83a317/feature-detects/dom/passiveeventlisteners.js
138
- */
139
- function isPassiveEventAvailable() {
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;
154
- }
155
- /**
156
- * Detects horizontal swipe direction without blocking the browser scroll using passive event.
157
- * @see http://javascriptkit.com/javatutors/touchevents2.shtml
158
- * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
159
- */
160
- function detectHorizontalSwipe(touchSurface, handleSwipe) {
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
- };
211
- }
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;
219
- exports.detectHorizontalSwipe = detectHorizontalSwipe;
220
- exports.detectSwipe = detectSwipe;
221
- exports.onButtonPressed = onButtonPressed;
222
- exports.onEnterPressed = onEnterPressed;
223
- exports.onEscapePressed = onEscapePressed;
1
+ import * as index from './classNames/index.js';
2
+ export { index as classNames };
3
+ export { onButtonPressed, onEnterPressed, onEscapePressed } from './events/keyboard.js';
4
+ export { detectHorizontalSwipe } from './events/swipe.js';
package/lumx.css CHANGED
@@ -8733,13 +8733,14 @@ table {
8733
8733
 
8734
8734
  /* Item spacing
8735
8735
  ========================================================================== */
8736
- .lumx-list--item-padding-big .lumx-list-item__link,
8737
- .lumx-list--item-padding-big .lumx-list-item__wrapper {
8736
+ .lumx-list:has(.lumx-list-item__link) .lumx-list-item__link, .lumx-list.lumx-list--item-padding-big .lumx-list-item__link,
8737
+ .lumx-list:has(.lumx-list-item__link) .lumx-list-item__wrapper,
8738
+ .lumx-list.lumx-list--item-padding-big .lumx-list-item__wrapper {
8738
8739
  padding-right: 16px;
8739
8740
  padding-left: 16px;
8740
8741
  }
8741
- .lumx-list--item-padding-huge .lumx-list-item__link,
8742
- .lumx-list--item-padding-huge .lumx-list-item__wrapper {
8742
+ .lumx-list.lumx-list--item-padding-huge .lumx-list-item__link,
8743
+ .lumx-list.lumx-list--item-padding-huge .lumx-list-item__wrapper {
8743
8744
  padding-right: 24px;
8744
8745
  padding-left: 24px;
8745
8746
  }
@@ -8772,11 +8773,11 @@ table {
8772
8773
  line-height: 14px;
8773
8774
  margin-right: 8px;
8774
8775
  }
8775
- .lumx-list--item-padding-big .lumx-list-subheader {
8776
+ .lumx-list:has(.lumx-list-item__link) .lumx-list-subheader, .lumx-list.lumx-list--item-padding-big .lumx-list-subheader {
8776
8777
  padding-right: 16px;
8777
8778
  padding-left: 16px;
8778
8779
  }
8779
- .lumx-list--item-padding-huge .lumx-list-subheader {
8780
+ .lumx-list.lumx-list--item-padding-huge .lumx-list-subheader {
8780
8781
  padding-right: 24px;
8781
8782
  padding-left: 24px;
8782
8783
  }
@@ -12055,7 +12056,10 @@ table {
12055
12056
  flex: 1 1 auto;
12056
12057
  padding: var(--lumx-text-field-wrapper-padding-vertical) 0;
12057
12058
  }
12058
- .lumx-text-field--theme-light .lumx-text-field__input-native {
12059
+ .lumx-text-field__input-native {
12060
+ resize: none;
12061
+ }
12062
+ .lumx-text-field--theme-light .lumx-text-field__input-native, .lumx-text-field__input-native--theme-light {
12059
12063
  display: block;
12060
12064
  width: 100%;
12061
12065
  padding: 0;
@@ -12068,16 +12072,16 @@ table {
12068
12072
  color: var(--lumx-color-dark-N);
12069
12073
  color: var(--lumx-text-field-state-default-theme-light-input-content-color);
12070
12074
  }
12071
- .lumx-text-field--theme-light .lumx-text-field__input-native[type=number]::-webkit-inner-spin-button, .lumx-text-field--theme-light .lumx-text-field__input-native[type=number]::-webkit-outer-spin-button {
12075
+ .lumx-text-field--theme-light .lumx-text-field__input-native[type=number]::-webkit-inner-spin-button, .lumx-text-field--theme-light .lumx-text-field__input-native[type=number]::-webkit-outer-spin-button, .lumx-text-field__input-native--theme-light[type=number]::-webkit-inner-spin-button, .lumx-text-field__input-native--theme-light[type=number]::-webkit-outer-spin-button {
12072
12076
  opacity: 1;
12073
12077
  }
12074
- .lumx-text-field--theme-light .lumx-text-field__input-native::-moz-placeholder {
12078
+ .lumx-text-field--theme-light .lumx-text-field__input-native::-moz-placeholder, .lumx-text-field__input-native--theme-light::-moz-placeholder {
12075
12079
  color: var(--lumx-text-field-state-default-theme-light-input-placeholder-color);
12076
12080
  }
12077
- .lumx-text-field--theme-light .lumx-text-field__input-native::placeholder {
12081
+ .lumx-text-field--theme-light .lumx-text-field__input-native::placeholder, .lumx-text-field__input-native--theme-light::placeholder {
12078
12082
  color: var(--lumx-text-field-state-default-theme-light-input-placeholder-color);
12079
12083
  }
12080
- .lumx-text-field--theme-dark .lumx-text-field__input-native {
12084
+ .lumx-text-field--theme-dark .lumx-text-field__input-native, .lumx-text-field__input-native--theme-dark {
12081
12085
  display: block;
12082
12086
  width: 100%;
12083
12087
  padding: 0;
@@ -12090,13 +12094,13 @@ table {
12090
12094
  color: var(--lumx-color-light-N);
12091
12095
  color: var(--lumx-text-field-state-default-theme-dark-input-content-color);
12092
12096
  }
12093
- .lumx-text-field--theme-dark .lumx-text-field__input-native[type=number]::-webkit-inner-spin-button, .lumx-text-field--theme-dark .lumx-text-field__input-native[type=number]::-webkit-outer-spin-button {
12097
+ .lumx-text-field--theme-dark .lumx-text-field__input-native[type=number]::-webkit-inner-spin-button, .lumx-text-field--theme-dark .lumx-text-field__input-native[type=number]::-webkit-outer-spin-button, .lumx-text-field__input-native--theme-dark[type=number]::-webkit-inner-spin-button, .lumx-text-field__input-native--theme-dark[type=number]::-webkit-outer-spin-button {
12094
12098
  opacity: 1;
12095
12099
  }
12096
- .lumx-text-field--theme-dark .lumx-text-field__input-native::-moz-placeholder {
12100
+ .lumx-text-field--theme-dark .lumx-text-field__input-native::-moz-placeholder, .lumx-text-field__input-native--theme-dark::-moz-placeholder {
12097
12101
  color: var(--lumx-text-field-state-default-theme-dark-input-placeholder-color);
12098
12102
  }
12099
- .lumx-text-field--theme-dark .lumx-text-field__input-native::placeholder {
12103
+ .lumx-text-field--theme-dark .lumx-text-field__input-native::placeholder, .lumx-text-field__input-native--theme-dark::placeholder {
12100
12104
  color: var(--lumx-text-field-state-default-theme-dark-input-placeholder-color);
12101
12105
  }
12102
12106
  .lumx-text-field--has-chips .lumx-text-field__input-native {
@@ -12105,9 +12109,6 @@ table {
12105
12109
  min-width: 100px;
12106
12110
  line-height: var(--lumx-material-chip-size-s-height);
12107
12111
  }
12108
- .lumx-text-field__input-native--textarea {
12109
- resize: none;
12110
- }
12111
12112
  .lumx-text-field__input-clear, .lumx-text-field__after-element {
12112
12113
  flex-shrink: 0;
12113
12114
  margin: calc(var(--lumx-text-field-wrapper-padding-vertical) + (var(--lumx-material-text-field-input-content-line-height) - var(--lumx-button-height) / 1.5) / 2) 4px;
package/package.json CHANGED
@@ -6,7 +6,6 @@
6
6
  "url": "https://github.com/lumapps/design-system/issues"
7
7
  },
8
8
  "dependencies": {
9
- "@lumx/icons": "^3.20.1-alpha.5",
10
9
  "classnames": "^2.3.2",
11
10
  "focus-visible": "^5.0.2",
12
11
  "lodash": "4.17.21",
@@ -20,6 +19,7 @@
20
19
  "LumX"
21
20
  ],
22
21
  "license": "MIT",
22
+ "type": "module",
23
23
  "name": "@lumx/core",
24
24
  "publishConfig": {
25
25
  "directory": "dist"
@@ -29,33 +29,29 @@
29
29
  "url": "git+https://github.com/lumapps/design-system.git"
30
30
  },
31
31
  "scripts": {
32
- "generate:design-tokens": "yarn node style-dictionary",
32
+ "generate:design-tokens": "yarn node style-dictionary/index.cjs",
33
33
  "build": "rollup -c",
34
+ "test": "vitest run",
34
35
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
35
36
  },
36
37
  "sideEffects": false,
37
- "version": "3.20.1-alpha.5",
38
+ "version": "3.20.1-alpha.50",
38
39
  "devDependencies": {
39
- "@rollup/plugin-commonjs": "^19.0.2",
40
- "@rollup/plugin-terser": "^0.4.4",
41
- "@rollup/plugin-typescript": "^12.1.4",
42
- "@testing-library/dom": "^9.3.4",
43
- "@testing-library/jest-dom": "^5.16.4",
40
+ "@rollup/plugin-typescript": "^12.3.0",
44
41
  "@types/react": "^17.0.2",
45
42
  "autoprefixer": "^9.7.4",
46
43
  "glob": "^7.1.6",
47
44
  "postcss": "^8.5.6",
48
- "react": "^17.0.2",
49
- "rollup": "^2.79.1",
45
+ "rollup": "^4.53.3",
50
46
  "rollup-plugin-cleaner": "^1.0.0",
51
47
  "rollup-plugin-copy": "^3.5.0",
52
48
  "sass": "^1.54.0",
53
49
  "style-dictionary": "^3.9.0",
54
50
  "tinycolor2": "^1.4.1",
55
- "version-changelog": "^3.1.1"
56
- },
57
- "peerDependencies": {
58
- "moment": ">= 2",
59
- "moment-range": "^4.0.2"
51
+ "typescript": "^5.4.3",
52
+ "version-changelog": "^3.1.1",
53
+ "vite": "^6.3.5",
54
+ "vite-tsconfig-paths": "^5.1.4",
55
+ "vitest": "^3.0.0"
60
56
  }
61
57
  }
@@ -52,11 +52,14 @@
52
52
 
53
53
  .#{$lumx-base-prefix}-list-item__link,
54
54
  .#{$lumx-base-prefix}-list-item__wrapper {
55
- .#{$lumx-base-prefix}-list--item-padding-big & {
55
+ // Padding big (defaults when list contain clickable item)
56
+ .#{$lumx-base-prefix}-list:has(.#{$lumx-base-prefix}-list-item__link) &,
57
+ .#{$lumx-base-prefix}-list.#{$lumx-base-prefix}-list--item-padding-big & {
56
58
  @include lumx-list-item-padding("big");
57
59
  }
58
60
 
59
- .#{$lumx-base-prefix}-list--item-padding-huge & {
61
+ // Padding huge
62
+ .#{$lumx-base-prefix}-list.#{$lumx-base-prefix}-list--item-padding-huge & {
60
63
  @include lumx-list-item-padding("huge");
61
64
  }
62
65
  }
@@ -78,11 +81,14 @@
78
81
  @include lumx-list-subheader-icon;
79
82
  }
80
83
 
81
- .#{$lumx-base-prefix}-list--item-padding-big & {
84
+ // Padding big (defaults when list contain clickable item)
85
+ .#{$lumx-base-prefix}-list:has(.#{$lumx-base-prefix}-list-item__link) &,
86
+ .#{$lumx-base-prefix}-list.#{$lumx-base-prefix}-list--item-padding-big & {
82
87
  @include lumx-list-item-padding("big");
83
88
  }
84
89
 
85
- .#{$lumx-base-prefix}-list--item-padding-huge & {
90
+ // Padding huge
91
+ .#{$lumx-base-prefix}-list.#{$lumx-base-prefix}-list--item-padding-huge & {
86
92
  @include lumx-list-item-padding("huge");
87
93
  }
88
94
  }
@@ -104,7 +104,9 @@
104
104
  }
105
105
 
106
106
  &__input-native {
107
- #{$self}--theme-light & {
107
+ resize: none;
108
+
109
+ #{$self}--theme-light &, &--theme-light {
108
110
  @include lumx-text-field-input-native(lumx-base-const("theme", "LIGHT"));
109
111
  @include lumx-text-field-input-content-color(
110
112
  lumx-base-const("state", "DEFAULT"),
@@ -119,7 +121,7 @@
119
121
  }
120
122
  }
121
123
 
122
- #{$self}--theme-dark & {
124
+ #{$self}--theme-dark &, &--theme-dark {
123
125
  @include lumx-text-field-input-native(lumx-base-const("theme", "DARK"));
124
126
  @include lumx-text-field-input-content-color(
125
127
  lumx-base-const("state", "DEFAULT"),
@@ -140,10 +142,6 @@
140
142
  min-width: $lumx-text-field-min-width;
141
143
  line-height: var(--lumx-material-chip-size-s-height);
142
144
  }
143
-
144
- &--textarea {
145
- resize: none;
146
- }
147
145
  }
148
146
 
149
147
  &__input-clear,
@@ -1,40 +0,0 @@
1
- import { mdiEmail } from '@lumx/icons';
2
-
3
- import { Size } from '@lumx/core/js/constants';
4
- import { iconArgType } from '@lumx/core/stories/controls/icons';
5
- import { colorArgType, colorVariantArgType } from '@lumx/react/stories/controls/color';
6
- import { withUndefined } from '@lumx/react/stories/controls/withUndefined';
7
- import { Icon } from '.';
8
-
9
- const iconSizes = [Size.xxs, Size.xs, Size.s, Size.m, Size.l, Size.xl, Size.xxl];
10
-
11
- export default {
12
- argTypes: {
13
- icon: iconArgType,
14
- hasShape: { control: 'boolean' },
15
- color: colorArgType,
16
- colorVariant: colorVariantArgType,
17
- },
18
- args: Icon.defaultProps,
19
- };
20
-
21
- export const SizeAndShape = {
22
- args: {
23
- icon: mdiEmail,
24
- },
25
- argTypes: {
26
- hasShape: { control: false },
27
- size: { control: false },
28
- },
29
- getDecorators: ({ withCombinations }) => [
30
- withCombinations({
31
- combinations: {
32
- cols: { key: 'size', options: withUndefined(iconSizes) },
33
- rows: {
34
- Default: {},
35
- 'Has shape': { hasShape: true },
36
- },
37
- },
38
- }),
39
- ],
40
- };