carbon-react 105.2.0 → 106.0.2

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 (122) hide show
  1. package/esm/__internal__/tooltip-provider/index.js +1 -1
  2. package/esm/__internal__/utils/helpers/browser/index.d.ts +15 -1
  3. package/esm/__internal__/utils/helpers/browser/index.js +33 -1
  4. package/esm/__internal__/utils/helpers/browser-type-check/index.d.ts +7 -1
  5. package/esm/__internal__/utils/helpers/browser-type-check/index.js +8 -1
  6. package/esm/__internal__/utils/helpers/events/composedPath.d.ts +1 -1
  7. package/esm/__internal__/utils/helpers/events/events.d.ts +132 -31
  8. package/esm/__internal__/utils/helpers/events/events.js +10 -125
  9. package/esm/__internal__/utils/helpers/guid/index.d.ts +5 -0
  10. package/esm/__internal__/utils/helpers/guid/{guid.js → index.js} +0 -2
  11. package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +4 -2
  12. package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +2 -1
  13. package/esm/__internal__/utils/helpers/tags/tags.d.ts +10 -6
  14. package/esm/__internal__/utils/helpers/tags/tags.js +2 -6
  15. package/esm/__internal__/utils/helpers/useUniqueId/index.d.ts +2 -0
  16. package/esm/__internal__/utils/helpers/useUniqueId/index.js +7 -0
  17. package/esm/__internal__/utils/logger/index.d.ts +5 -1
  18. package/esm/__internal__/utils/logger/index.js +25 -1
  19. package/esm/components/app-wrapper/app-wrapper.component.js +5 -3
  20. package/esm/components/confirm/confirm.component.js +1 -1
  21. package/esm/components/dialog/dialog.component.js +1 -1
  22. package/esm/components/dialog-full-screen/dialog-full-screen.component.js +1 -1
  23. package/esm/components/fieldset/fieldset.component.d.ts +6 -1
  24. package/esm/components/fieldset/fieldset.component.js +14 -15
  25. package/esm/components/portrait/portrait-initials.component.js +1 -1
  26. package/esm/components/select/select-list/select-list.component.js +1 -1
  27. package/esm/components/select/select-textbox/select-textbox.component.js +1 -1
  28. package/esm/components/split-button/index.d.ts +1 -0
  29. package/esm/components/tabs/__internal__/tab-title/tab-title.style.js +3 -5
  30. package/esm/components/textbox/textbox.component.d.ts +1 -2
  31. package/esm/components/textbox/textbox.component.js +7 -6
  32. package/esm/style/{fonts → assets}/carbon-icons-webfont.woff +0 -0
  33. package/esm/style/fonts.css +30 -0
  34. package/esm/style/global-style.js +1 -1
  35. package/esm/style/themes/base/base-theme.config.d.ts +17 -8
  36. package/esm/style/themes/sage/index.d.ts +17 -8
  37. package/lib/__internal__/tooltip-provider/index.js +1 -1
  38. package/lib/__internal__/utils/helpers/browser/index.d.ts +15 -1
  39. package/lib/__internal__/utils/helpers/browser/index.js +33 -8
  40. package/lib/__internal__/utils/helpers/browser-type-check/index.d.ts +7 -1
  41. package/lib/__internal__/utils/helpers/browser-type-check/index.js +10 -21
  42. package/lib/__internal__/utils/helpers/events/composedPath.d.ts +1 -1
  43. package/lib/__internal__/utils/helpers/events/events.d.ts +132 -31
  44. package/lib/__internal__/utils/helpers/events/events.js +10 -125
  45. package/lib/__internal__/utils/helpers/guid/index.d.ts +5 -0
  46. package/lib/__internal__/utils/helpers/guid/{guid.js → index.js} +0 -2
  47. package/lib/__internal__/utils/helpers/guid/package.json +5 -2
  48. package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +4 -2
  49. package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +2 -1
  50. package/lib/__internal__/utils/helpers/tags/tags.d.ts +10 -6
  51. package/lib/__internal__/utils/helpers/tags/tags.js +2 -6
  52. package/lib/__internal__/utils/helpers/useUniqueId/index.d.ts +2 -0
  53. package/lib/__internal__/utils/helpers/useUniqueId/index.js +20 -0
  54. package/lib/__internal__/utils/helpers/useUniqueId/package.json +6 -0
  55. package/lib/__internal__/utils/logger/index.d.ts +5 -1
  56. package/lib/__internal__/utils/logger/index.js +26 -8
  57. package/lib/components/app-wrapper/app-wrapper.component.js +5 -4
  58. package/lib/components/confirm/confirm.component.js +1 -1
  59. package/lib/components/dialog/dialog.component.js +1 -1
  60. package/lib/components/dialog-full-screen/dialog-full-screen.component.js +1 -1
  61. package/lib/components/fieldset/fieldset.component.d.ts +6 -1
  62. package/lib/components/fieldset/fieldset.component.js +14 -16
  63. package/lib/components/portrait/portrait-initials.component.js +1 -1
  64. package/lib/components/select/select-list/select-list.component.js +1 -1
  65. package/lib/components/select/select-textbox/select-textbox.component.js +1 -1
  66. package/lib/components/split-button/index.d.ts +1 -0
  67. package/lib/components/tabs/__internal__/tab-title/tab-title.style.js +3 -5
  68. package/lib/components/textbox/textbox.component.d.ts +1 -2
  69. package/lib/components/textbox/textbox.component.js +7 -8
  70. package/lib/style/{fonts → assets}/carbon-icons-webfont.woff +0 -0
  71. package/lib/style/fonts.css +30 -0
  72. package/lib/style/global-style.js +1 -1
  73. package/lib/style/themes/base/base-theme.config.d.ts +17 -8
  74. package/lib/style/themes/sage/index.d.ts +17 -8
  75. package/package.json +4 -3
  76. package/esm/__internal__/utils/ether/ether.d.ts +0 -19
  77. package/esm/__internal__/utils/ether/ether.js +0 -29
  78. package/esm/__internal__/utils/ether/index.d.ts +0 -1
  79. package/esm/__internal__/utils/ether/index.js +0 -1
  80. package/esm/__internal__/utils/helpers/browser/browser.d.ts +0 -17
  81. package/esm/__internal__/utils/helpers/browser/browser.js +0 -198
  82. package/esm/__internal__/utils/helpers/browser-type-check/browser-type-check.d.ts +0 -7
  83. package/esm/__internal__/utils/helpers/browser-type-check/browser-type-check.js +0 -14
  84. package/esm/__internal__/utils/helpers/guid/__spec__.d.ts +0 -1
  85. package/esm/__internal__/utils/helpers/guid/__spec__.js +0 -10
  86. package/esm/__internal__/utils/helpers/guid/guid.d.ts +0 -2
  87. package/esm/__internal__/utils/helpers/guid/package.json +0 -3
  88. package/esm/__internal__/utils/helpers/immutable/__spec__.d.ts +0 -1
  89. package/esm/__internal__/utils/helpers/immutable/__spec__.js +0 -117
  90. package/esm/__internal__/utils/helpers/immutable/immutable.d.ts +0 -4
  91. package/esm/__internal__/utils/helpers/immutable/immutable.js +0 -36
  92. package/esm/__internal__/utils/helpers/immutable/package.json +0 -4
  93. package/esm/__internal__/utils/helpers/with-unique-id-props/index.d.ts +0 -1
  94. package/esm/__internal__/utils/helpers/with-unique-id-props/index.js +0 -1
  95. package/esm/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.d.ts +0 -7
  96. package/esm/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.js +0 -82
  97. package/esm/__internal__/utils/logger/logger.d.ts +0 -9
  98. package/esm/__internal__/utils/logger/logger.js +0 -71
  99. package/lib/__internal__/utils/ether/ether.d.ts +0 -19
  100. package/lib/__internal__/utils/ether/ether.js +0 -33
  101. package/lib/__internal__/utils/ether/index.d.ts +0 -1
  102. package/lib/__internal__/utils/ether/index.js +0 -18
  103. package/lib/__internal__/utils/ether/package.json +0 -6
  104. package/lib/__internal__/utils/helpers/browser/browser.d.ts +0 -17
  105. package/lib/__internal__/utils/helpers/browser/browser.js +0 -213
  106. package/lib/__internal__/utils/helpers/browser-type-check/browser-type-check.d.ts +0 -7
  107. package/lib/__internal__/utils/helpers/browser-type-check/browser-type-check.js +0 -26
  108. package/lib/__internal__/utils/helpers/guid/__spec__.d.ts +0 -1
  109. package/lib/__internal__/utils/helpers/guid/__spec__.js +0 -15
  110. package/lib/__internal__/utils/helpers/guid/guid.d.ts +0 -2
  111. package/lib/__internal__/utils/helpers/immutable/__spec__.d.ts +0 -1
  112. package/lib/__internal__/utils/helpers/immutable/__spec__.js +0 -135
  113. package/lib/__internal__/utils/helpers/immutable/immutable.d.ts +0 -4
  114. package/lib/__internal__/utils/helpers/immutable/immutable.js +0 -46
  115. package/lib/__internal__/utils/helpers/immutable/package.json +0 -4
  116. package/lib/__internal__/utils/helpers/with-unique-id-props/index.d.ts +0 -1
  117. package/lib/__internal__/utils/helpers/with-unique-id-props/index.js +0 -15
  118. package/lib/__internal__/utils/helpers/with-unique-id-props/package.json +0 -6
  119. package/lib/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.d.ts +0 -7
  120. package/lib/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.js +0 -96
  121. package/lib/__internal__/utils/logger/logger.d.ts +0 -9
  122. package/lib/__internal__/utils/logger/logger.js +0 -78
@@ -1,32 +1,133 @@
1
+ /**
2
+ * JavaScript Events
3
+ *
4
+ * A collection of functions to be used with events.
5
+ *
6
+ * E.g. The KeyPress event has different implementations accross browsers, so
7
+ * this class contains methods to polyfill this functionality to ensure a standardised
8
+ * implementation between browsers
9
+ *
10
+ */
11
+ declare const Events: {
12
+ /**
13
+ * A method to determine if an event is of a particular type
14
+ * */
15
+ isEventType: (ev: React.SyntheticEvent | Event, type: string) => boolean;
16
+ /**
17
+ * A method to determine whether a key down event was an arrow key
18
+ * */
19
+ isNavigationKeyup: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
20
+ /**
21
+ * A method to determine whether a key down event was an enter key
22
+ * */
23
+ isEnterKeyup: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
24
+ /**
25
+ * A method to determine whether a key up event is allowed or not.
26
+ * */
27
+ isValidKeypress: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
28
+ /**
29
+ * Determines if a number key along the top of the keyboard or a number key on the
30
+ * keypad is pressed
31
+ * */
32
+ isNumberKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
33
+ /**
34
+ * Determines if the key pressed is part of the numpad
35
+ * includes symbols
36
+ * */
37
+ isNumpadKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
38
+ /**
39
+ * Determines if the key pressed is a alphabet key
40
+ * Case insensitive
41
+ * */
42
+ isAlphabetKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
43
+ /**
44
+ * Determines if the key pressed is a valid symbol
45
+ * */
46
+ isSymbolKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
47
+ /**
48
+ * Determines if the key pressed is a navigation key
49
+ * */
50
+ isNavigationKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
51
+ /**
52
+ * Determines if the key pressed is a navigation left key
53
+ * */
54
+ isLeftKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
55
+ /**
56
+ * Determines if the key pressed is a navigation up key
57
+ * */
58
+ isUpKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
59
+ /**
60
+ * Determines if the key pressed is a navigation right key
61
+ * */
62
+ isRightKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
63
+ /**
64
+ * Determines if the key pressed is a navigation down key
65
+ * */
66
+ isDownKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
67
+ /**
68
+ * Determines if the key pressed is a meta key
69
+ * */
70
+ isMetaKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
71
+ /**
72
+ * Determines if the key pressed is the escape key
73
+ * */
74
+ isEscKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
75
+ /**
76
+ * Determines if the key pressed is the enter key
77
+ * */
78
+ isEnterKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
79
+ /**
80
+ * Determines if the key pressed is the tab key
81
+ * */
82
+ isTabKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
83
+ /**
84
+ * Determines if the key pressed is the backspace key
85
+ * */
86
+ isBackspaceKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
87
+ /**
88
+ * Determines if the key pressed is the delete key
89
+ * */
90
+ isDeleteKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
91
+ /**
92
+ * Determines if the key pressed is the backspace or delete key
93
+ * */
94
+ isDeletingKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
95
+ /**
96
+ * Determines if the key pressed is the shift key
97
+ * */
98
+ isShiftKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
99
+ /**
100
+ * Determines if the key pressed is the space key
101
+ * */
102
+ isSpaceKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
103
+ /**
104
+ * Determines if the key pressed is the space key or enter key
105
+ * */
106
+ isEnterOrSpaceKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
107
+ /**
108
+ * Determines if the key pressed is the period key
109
+ * */
110
+ isPeriodKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
111
+ /**
112
+ * Determines if the key pressed is the comma key
113
+ * */
114
+ isCommaKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
115
+ /**
116
+ * Determines if the key pressed is the minus key
117
+ * */
118
+ isMinusKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
119
+ /**
120
+ * Determines if the key pressed is the home key
121
+ * */
122
+ isHomeKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
123
+ /**
124
+ * Determines if the key pressed is the end key
125
+ * */
126
+ isEndKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
127
+ /**
128
+ * Gets the event's path which is an array of the objects on which listeners will be invoked.
129
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
130
+ */
131
+ composedPath: (ev: CustomEvent) => EventTarget[];
132
+ };
1
133
  export default Events;
2
- declare namespace Events {
3
- function isEventType(ev: Event, type: Type): boolean;
4
- function isNavigationKeyup(ev: Event): boolean;
5
- function isEnterKeyup(ev: Event): boolean;
6
- function isValidKeypress(ev: Event): boolean;
7
- function isNumberKey(ev: Event): boolean;
8
- function isNumpadKey(ev: Event): boolean;
9
- function isAlphabetKey(ev: Event): boolean;
10
- function isSymbolKey(ev: Event): boolean;
11
- function isNavigationKey(ev: Event): boolean;
12
- function isLeftKey(ev: Event): boolean;
13
- function isUpKey(ev: Event): boolean;
14
- function isRightKey(ev: Event): boolean;
15
- function isDownKey(ev: Event): boolean;
16
- function isMetaKey(ev: Event): boolean;
17
- function isEscKey(ev: Event): boolean;
18
- function isEnterKey(ev: Event): boolean;
19
- function isTabKey(ev: Event): boolean;
20
- function isBackspaceKey(ev: Event): boolean;
21
- function isDeleteKey(ev: Event): boolean;
22
- function isDeletingKey(ev: Event): boolean;
23
- function isShiftKey(ev: Event): boolean;
24
- function isSpaceKey(ev: Event): boolean;
25
- function isEnterOrSpaceKey(ev: Event): boolean;
26
- function isPeriodKey(ev: Event): boolean;
27
- function isCommaKey(ev: Event): boolean;
28
- function isMinusKey(ev: Event): boolean;
29
- function isHomeKey(ev: Event): boolean;
30
- function isEndKey(ev: Event): boolean;
31
- function composedPath(ev: Event): EventTarget[];
32
- }
@@ -18,16 +18,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
18
  * this class contains methods to polyfill this functionality to ensure a standardised
19
19
  * implementation between browsers
20
20
  *
21
- * @object Events
22
21
  */
23
22
  const Events = {
24
23
  /**
25
24
  * A method to determine if an event is of a particular type
26
- *
27
- * @method isEventType
28
- * @param {Event} ev A JavaScript event
29
- * @param {Type} type A JavaScript event type
30
- * @returns {Boolean} true if event type matches passed type
31
25
  * */
32
26
  isEventType: (ev, type) => {
33
27
  return ev.type === type;
@@ -35,10 +29,6 @@ const Events = {
35
29
 
36
30
  /**
37
31
  * A method to determine whether a key down event was an arrow key
38
- *
39
- * @method isNavigationKeyup
40
- * @param {Event} ev A JavaScript event
41
- * @returns {Boolean} true if key up event and a navigation key
42
32
  * */
43
33
  isNavigationKeyup: ev => {
44
34
  if (!Events.isEventType(ev, "keyup")) {
@@ -50,10 +40,6 @@ const Events = {
50
40
 
51
41
  /**
52
42
  * A method to determine whether a key down event was an enter key
53
- *
54
- * @method isEnterKeyup
55
- * @param {Event} ev A JavaScript event
56
- * @returns {Boolean} true if keyup event and enter key
57
43
  * */
58
44
  isEnterKeyup: ev => {
59
45
  if (!Events.isEventType(ev, "keyup")) {
@@ -65,10 +51,6 @@ const Events = {
65
51
 
66
52
  /**
67
53
  * A method to determine whether a key up event is allowed or not.
68
- *
69
- * @method isValidKeypress
70
- * @param {Event} ev A JavaScript event
71
- * @returns {Boolean} true if keyup and valid
72
54
  * */
73
55
  isValidKeypress: ev => {
74
56
  if (!Events.isEventType(ev, "keyup")) {
@@ -85,68 +67,46 @@ const Events = {
85
67
  /**
86
68
  * Determines if a number key along the top of the keyboard or a number key on the
87
69
  * keypad is pressed
88
- *
89
- * @method isNumberKey
90
- * @param {Event} ev A JavaScript event
91
- * @returns {Boolean} true if valid number key
92
70
  * */
93
71
  isNumberKey: ev => {
94
- const charCode = ev.key.charCodeAt(0);
95
- return charCode >= 48 && charCode <= 57;
72
+ var _ev$key;
73
+
74
+ const charCode = (_ev$key = ev.key) === null || _ev$key === void 0 ? void 0 : _ev$key.charCodeAt(0);
75
+ return charCode !== undefined && charCode >= 48 && charCode <= 57;
96
76
  },
97
77
 
98
78
  /**
99
79
  * Determines if the key pressed is part of the numpad
100
80
  * includes symbols
101
- *
102
- * @method isNumberKey
103
- * @param {Event} ev A JavaScript event
104
- * @returns {Boolean} true if key is part of numpad
105
81
  * */
106
82
  isNumpadKey: ev => {
107
- return ev.which >= 96 && ev.which <= 111;
83
+ return ev.which !== undefined && ev.which >= 96 && ev.which <= 111;
108
84
  },
109
85
 
110
86
  /**
111
87
  * Determines if the key pressed is a alphabet key
112
88
  * Case insensitive
113
- *
114
- * @method isAlphabetKey
115
- * @param {Event} ev A JavaScript event
116
- * @returns {Boolean} true if alphabet key is pressed
117
89
  * */
118
90
  isAlphabetKey: ev => {
119
- return ev.which >= 65 && ev.which <= 90;
91
+ return ev.which !== undefined && ev.which >= 65 && ev.which <= 90;
120
92
  },
121
93
 
122
94
  /**
123
95
  * Determines if the key pressed is a valid symbol
124
- *
125
- * @method isSymbolKey
126
- * @param {Event} ev A JavaScript event
127
- * @returns {Boolean} true if any symbol key is pressed
128
96
  * */
129
97
  isSymbolKey: ev => {
130
- return ev.which >= 58 && ev.which <= 64 || ev.which >= 106 && ev.which <= 107 || ev.which >= 186 && ev.which <= 192 || ev.which >= 219 && ev.which <= 222; // \ ]
98
+ return ev.which !== undefined && (ev.which >= 58 && ev.which <= 64 || ev.which >= 106 && ev.which <= 107 || ev.which >= 186 && ev.which <= 192 || ev.which >= 219 && ev.which <= 222);
131
99
  },
132
100
 
133
101
  /**
134
102
  * Determines if the key pressed is a navigation key
135
- *
136
- * @method isNavigationKey
137
- * @param {Event} ev A JavaScript event
138
- * @returns {Boolean} true if one of four arrow keys
139
103
  * */
140
104
  isNavigationKey: ev => {
141
- return ev.which >= 37 && ev.which <= 40;
105
+ return ev.which !== undefined && ev.which >= 37 && ev.which <= 40;
142
106
  },
143
107
 
144
108
  /**
145
109
  * Determines if the key pressed is a navigation left key
146
- *
147
- * @method isLeftKey
148
- * @param {Event} ev A JavaScript event
149
- * @returns {Boolean} true if left arrow key
150
110
  * */
151
111
  isLeftKey: ev => {
152
112
  return ev.which === 37;
@@ -154,10 +114,6 @@ const Events = {
154
114
 
155
115
  /**
156
116
  * Determines if the key pressed is a navigation up key
157
- *
158
- * @method isUpKey
159
- * @param {Event} ev A JavaScript event
160
- * @returns {Boolean} true if up arrow key
161
117
  * */
162
118
  isUpKey: ev => {
163
119
  return ev.which === 38;
@@ -165,10 +121,6 @@ const Events = {
165
121
 
166
122
  /**
167
123
  * Determines if the key pressed is a navigation right key
168
- *
169
- * @method isRightKey
170
- * @param {Event} ev A JavaScript event
171
- * @returns {Boolean} true if right arrow key
172
124
  * */
173
125
  isRightKey: ev => {
174
126
  return ev.which === 39;
@@ -176,10 +128,6 @@ const Events = {
176
128
 
177
129
  /**
178
130
  * Determines if the key pressed is a navigation down key
179
- *
180
- * @method isDownKey
181
- * @param {Event} ev A JavaScript event
182
- * @returns {Boolean} true if down arrow key
183
131
  * */
184
132
  isDownKey: ev => {
185
133
  return ev.which === 40;
@@ -187,21 +135,13 @@ const Events = {
187
135
 
188
136
  /**
189
137
  * Determines if the key pressed is a meta key
190
- *
191
- * @method isMetaKey
192
- * @param {Event} ev A JavaScript event
193
- * @returns {Boolean} true if any meta key is pressed
194
138
  * */
195
139
  isMetaKey: ev => {
196
- return ev.metaKey;
140
+ return !!ev.metaKey;
197
141
  },
198
142
 
199
143
  /**
200
144
  * Determines if the key pressed is the escape key
201
- *
202
- * @method isEscKey
203
- * @param {Event} ev A JavaScript event
204
- * @returns {Boolean} true if esc key
205
145
  * */
206
146
  isEscKey: ev => {
207
147
  return ev.which === 27;
@@ -209,10 +149,6 @@ const Events = {
209
149
 
210
150
  /**
211
151
  * Determines if the key pressed is the enter key
212
- *
213
- * @method isEnterKey
214
- * @param {Event} ev A JavaScript event
215
- * @returns {Boolean} true if enter key
216
152
  * */
217
153
  isEnterKey: ev => {
218
154
  return ev.which === 13;
@@ -220,10 +156,6 @@ const Events = {
220
156
 
221
157
  /**
222
158
  * Determines if the key pressed is the tab key
223
- *
224
- * @method isTabKey
225
- * @param {Event} ev A JavaScript event
226
- * @returns {Boolean} true if tab key
227
159
  * */
228
160
  isTabKey: ev => {
229
161
  return ev.which === 9;
@@ -231,10 +163,6 @@ const Events = {
231
163
 
232
164
  /**
233
165
  * Determines if the key pressed is the backspace key
234
- *
235
- * @method isBackspaceKey
236
- * @param {Event} ev A JavaScript event
237
- * @returns {Boolean} true if backspace key
238
166
  * */
239
167
  isBackspaceKey: ev => {
240
168
  return ev.key === "Backspace";
@@ -242,10 +170,6 @@ const Events = {
242
170
 
243
171
  /**
244
172
  * Determines if the key pressed is the delete key
245
- *
246
- * @method isDeleteKey
247
- * @param {Event} ev A JavaScript event
248
- * @returns {Boolean} true if delete key
249
173
  * */
250
174
  isDeleteKey: ev => {
251
175
  return ev.key === "Delete";
@@ -253,10 +177,6 @@ const Events = {
253
177
 
254
178
  /**
255
179
  * Determines if the key pressed is the backspace or delete key
256
- *
257
- * @method isDeletingKey
258
- * @param {Event} ev A JavaScript event
259
- * @returns {Boolean} true if is delete key or backspace key
260
180
  * */
261
181
  isDeletingKey: ev => {
262
182
  return Events.isDeleteKey(ev) || Events.isBackspaceKey(ev);
@@ -264,10 +184,6 @@ const Events = {
264
184
 
265
185
  /**
266
186
  * Determines if the key pressed is the shift key
267
- *
268
- * @method isShiftKey
269
- * @param {Event} ev A JavaScript event
270
- * @returns {Boolean} true if shift key
271
187
  * */
272
188
  isShiftKey: ev => {
273
189
  return ev.shiftKey || ev.which === 16;
@@ -275,10 +191,6 @@ const Events = {
275
191
 
276
192
  /**
277
193
  * Determines if the key pressed is the space key
278
- *
279
- * @method isSpaceKey
280
- * @param {Event} ev A JavaScript event
281
- * @returns {Boolean} true if space key
282
194
  * */
283
195
  isSpaceKey: ev => {
284
196
  return ev.which === 32;
@@ -286,10 +198,6 @@ const Events = {
286
198
 
287
199
  /**
288
200
  * Determines if the key pressed is the space key or enter key
289
- *
290
- * @method isEnterOrSpaceKey
291
- * @param {Event} ev A JavaScript event
292
- * @returns {Boolean} true if space key
293
201
  * */
294
202
  isEnterOrSpaceKey: ev => {
295
203
  return ev.which === 13 || ev.which === 32;
@@ -297,10 +205,6 @@ const Events = {
297
205
 
298
206
  /**
299
207
  * Determines if the key pressed is the period key
300
- *
301
- * @method isPeriodKey
302
- * @param {Event} ev A JavaScript event
303
- * @returns {Boolean} true if period key
304
208
  * */
305
209
  isPeriodKey: ev => {
306
210
  return ev.which === 190;
@@ -308,10 +212,6 @@ const Events = {
308
212
 
309
213
  /**
310
214
  * Determines if the key pressed is the comma key
311
- *
312
- * @method isCommaKey
313
- * @param {Event} ev A JavaScript event
314
- * @returns {Boolean} true if comma key
315
215
  * */
316
216
  isCommaKey: ev => {
317
217
  return ev.which === 188;
@@ -319,10 +219,6 @@ const Events = {
319
219
 
320
220
  /**
321
221
  * Determines if the key pressed is the minus key
322
- *
323
- * @method isMinusKey
324
- * @param {Event} ev A JavaScript event
325
- * @returns {Boolean} true if minus key
326
222
  * */
327
223
  isMinusKey: ev => {
328
224
  return ev.key === "-" || ev.key === "Subtract";
@@ -330,10 +226,6 @@ const Events = {
330
226
 
331
227
  /**
332
228
  * Determines if the key pressed is the home key
333
- *
334
- * @method isHomeKey
335
- * @param {Event} ev A JavaScript event
336
- * @returns {Boolean} true if home key
337
229
  * */
338
230
  isHomeKey: ev => {
339
231
  return ev.which === 36;
@@ -341,10 +233,6 @@ const Events = {
341
233
 
342
234
  /**
343
235
  * Determines if the key pressed is the end key
344
- *
345
- * @method isEndKey
346
- * @param {Event} ev A JavaScript event
347
- * @returns {Boolean} true if end key
348
236
  * */
349
237
  isEndKey: ev => {
350
238
  return ev.which === 35;
@@ -353,12 +241,9 @@ const Events = {
353
241
  /**
354
242
  * Gets the event's path which is an array of the objects on which listeners will be invoked.
355
243
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
356
- * @method composedPath
357
- * @param {Event} ev A Javascript event
358
- * @returns {EventTarget[]} objects representing the objects on which an event listener will be invoked
359
244
  */
360
245
  composedPath: ev => {
361
- return ev.path || ev.detail && ev.detail.enzymeTestingTarget && (0, _composedPath.default)(ev) || ev.composedPath && ev.composedPath() || (0, _composedPath.default)(ev);
246
+ return ev.detail && ev.detail.enzymeTestingTarget && (0, _composedPath.default)(ev) || ev.composedPath && ev.composedPath() || (0, _composedPath.default)(ev);
362
247
  }
363
248
  };
364
249
  var _default = Events;
@@ -0,0 +1,5 @@
1
+ declare const _default: () => string;
2
+ /**
3
+ * Generates a random guid, useful for creating unique IDs.
4
+ */
5
+ export default _default;
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  /**
9
9
  * Generates a random guid, useful for creating unique IDs.
10
- *
11
- * @method guid
12
10
  */
13
11
  var _default = () => {
14
12
  function s4() {
@@ -1,3 +1,6 @@
1
1
  {
2
- "main": "./guid.js"
3
- }
2
+ "sideEffects": false,
3
+ "module": "../../../../../esm/__internal__/utils/helpers/guid/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -1,2 +1,4 @@
1
- export function elementsTagTest(wrapper: any, elements: any): void;
2
- export function rootTagTest(rootNode: any, comp: any, elem: any, role: any): void;
1
+ import { ReactWrapper, ShallowWrapper } from "enzyme";
2
+ declare const elementsTagTest: (wrapper: ReactWrapper, elements: string[]) => void;
3
+ declare const rootTagTest: (rootNode: ReactWrapper | ShallowWrapper, comp: string, elem?: string | undefined, role?: string | undefined) => void;
4
+ export { elementsTagTest, rootTagTest };
@@ -21,6 +21,7 @@ const rootTagTest = (rootNode, comp, elem, role) => {
21
21
  expect(rootNode.prop("data-component")).toEqual(comp);
22
22
  expect(rootNode.prop("data-element")).toEqual(elem);
23
23
  expect(rootNode.prop("data-role")).toEqual(role);
24
- };
24
+ }; // eslint-disable-next-line jest/no-export
25
+
25
26
 
26
27
  exports.rootTagTest = rootTagTest;
@@ -1,9 +1,13 @@
1
- export default tagComponent;
1
+ interface DataProps {
2
+ "data-element"?: string;
3
+ "data-role"?: string;
4
+ [restKeys: string]: any;
5
+ }
6
+ export interface TagProps extends DataProps {
7
+ "data-component": string;
8
+ }
2
9
  /**
3
10
  * Builds props object containing top level data tags
4
- *
5
- * @param {String} name of component
6
- * @param {Object} component props
7
- * @return {Object} dataTagProps
8
11
  */
9
- declare function tagComponent(component: Object, props: any): Object;
12
+ declare function tagComponent(componentName: string, props: DataProps): TagProps;
13
+ export default tagComponent;
@@ -7,14 +7,10 @@ exports.default = void 0;
7
7
 
8
8
  /**
9
9
  * Builds props object containing top level data tags
10
- *
11
- * @param {String} name of component
12
- * @param {Object} component props
13
- * @return {Object} dataTagProps
14
10
  */
15
- function tagComponent(component, props) {
11
+ function tagComponent(componentName, props) {
16
12
  const tagProps = {
17
- "data-component": component
13
+ "data-component": componentName
18
14
  };
19
15
 
20
16
  if (props["data-element"]) {
@@ -0,0 +1,2 @@
1
+ declare const _default: (id?: string | undefined, name?: string | undefined) => string[];
2
+ export default _default;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _guid = _interopRequireDefault(require("../guid"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ var _default = (id, name) => {
15
+ const createdId = (0, _react.useRef)((0, _guid.default)());
16
+ const createdName = (0, _react.useRef)((0, _guid.default)());
17
+ return [id || createdId.current, name || createdName.current];
18
+ };
19
+
20
+ exports.default = _default;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../../../../../esm/__internal__/utils/helpers/useUniqueId/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -1 +1,5 @@
1
- export { default } from "./logger";
1
+ declare const Logger: {
2
+ setEnabledState: (newState: boolean) => void;
3
+ deprecate: (message: string) => void;
4
+ };
5
+ export default Logger;
@@ -3,13 +3,31 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function () {
9
- return _logger.default;
10
- }
11
- });
6
+ exports.default = void 0;
12
7
 
13
- var _logger = _interopRequireDefault(require("./logger"));
8
+ /* eslint-disable no-console */
9
+ // Globally enable the logger
10
+ let enabled = process.env.NODE_ENV !== "production";
11
+ /*
12
+ * Logger
13
+ *
14
+ * Logger function will only output when enabled. By default this
15
+ * enabled state is set when your NODE_ENV !== 'production'
16
+ *
17
+ * Methods
18
+ * deprecate - console.warn which prepends the message with [Deprecation]
19
+ *
20
+ */
14
21
 
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+ const Logger = {
23
+ setEnabledState: newState => {
24
+ enabled = newState;
25
+ },
26
+ deprecate: message => {
27
+ if (enabled) {
28
+ console.warn(`[Deprecation] ${message}`);
29
+ }
30
+ }
31
+ };
32
+ var _default = Logger;
33
+ exports.default = _default;
@@ -13,8 +13,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
13
13
 
14
14
  var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
15
15
 
16
- var _ether = require("../../__internal__/utils/ether");
17
-
18
16
  var _appWrapper = _interopRequireDefault(require("./app-wrapper.style"));
19
17
 
20
18
  var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
@@ -89,9 +87,12 @@ let AppWrapper = /*#__PURE__*/function (_React$Component) {
89
87
  }, {
90
88
  key: "render",
91
89
  value: function render() {
92
- return /*#__PURE__*/_react.default.createElement(_appWrapper.default, _extends({}, (0, _ether.validProps)(this), {
90
+ const {
91
+ children
92
+ } = this.props;
93
+ return /*#__PURE__*/_react.default.createElement(_appWrapper.default, _extends({}, this.props, {
93
94
  className: this.classes()
94
- }, (0, _tags.default)("app-wrapper", this.props)), this.props.children);
95
+ }, (0, _tags.default)("app-wrapper", this.props)), children);
95
96
  }
96
97
  }]);
97
98