carbon-react 91.2.1 → 93.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 (182) hide show
  1. package/lib/__internal__/checkable-input/checkable-input.component.js +1 -1
  2. package/lib/{utils/helpers → __internal__}/date/date.d.ts +0 -0
  3. package/lib/{utils/helpers → __internal__}/date/date.js +0 -0
  4. package/lib/{utils/helpers → __internal__}/date/index.js +0 -0
  5. package/lib/{utils/helpers → __internal__}/filter-object-properties/filter-object-properties.js +0 -0
  6. package/lib/{utils/helpers → __internal__}/filter-object-properties/index.js +0 -0
  7. package/lib/__internal__/form-field/form-field.component.js +1 -1
  8. package/lib/__internal__/full-screen-heading/full-screen-heading.component.js +1 -1
  9. package/lib/{utils/helpers → __internal__/input}/extract-props/extract-props.js +0 -0
  10. package/lib/{utils/helpers → __internal__/input}/extract-props/index.js +0 -0
  11. package/lib/__internal__/utils/ether/ether.js +33 -0
  12. package/lib/__internal__/utils/ether/index.js +18 -0
  13. package/lib/{utils → __internal__/utils}/helpers/browser/browser.js +0 -0
  14. package/lib/{utils/helpers/warn-as-deprecated → __internal__/utils/helpers/browser}/index.js +2 -2
  15. package/lib/{utils → __internal__/utils}/helpers/browser-type-check/browser-type-check.js +0 -0
  16. package/lib/{utils → __internal__/utils}/helpers/browser-type-check/index.js +0 -0
  17. package/lib/{utils → __internal__/utils}/helpers/events/composedPath.js +0 -0
  18. package/lib/{utils → __internal__/utils}/helpers/events/events.js +0 -0
  19. package/lib/__internal__/utils/helpers/events/index.js +15 -0
  20. package/lib/{utils → __internal__/utils}/helpers/guid/guid.js +0 -0
  21. package/lib/{utils → __internal__/utils}/helpers/guid/package.json +0 -0
  22. package/lib/{utils → __internal__/utils}/helpers/immutable/immutable.js +0 -0
  23. package/lib/{utils → __internal__/utils}/helpers/immutable/package.json +0 -0
  24. package/lib/__internal__/utils/helpers/tags/index.js +15 -0
  25. package/lib/__internal__/utils/helpers/tags/tags-specs/index.js +19 -0
  26. package/lib/{utils → __internal__/utils}/helpers/tags/tags-specs/tags-specs.js +0 -0
  27. package/lib/{utils → __internal__/utils}/helpers/tags/tags.js +0 -0
  28. package/lib/{utils → __internal__/utils}/helpers/with-unique-id-props/index.js +0 -0
  29. package/lib/{utils → __internal__/utils}/helpers/with-unique-id-props/with-unique-id-props.hoc.d.ts +0 -0
  30. package/lib/{utils → __internal__/utils}/helpers/with-unique-id-props/with-unique-id-props.hoc.js +0 -0
  31. package/lib/__internal__/utils/logger/index.js +15 -0
  32. package/lib/{utils → __internal__/utils}/logger/logger.js +0 -9
  33. package/lib/__spec_helper__/mock-date-helper.js +2 -2
  34. package/lib/components/accordion/accordion-group/accordion-group.component.js +1 -1
  35. package/lib/components/accordion/accordion.component.js +2 -2
  36. package/lib/components/action-popover/action-popover-item/action-popover-item.component.js +2 -2
  37. package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.js +1 -1
  38. package/lib/components/action-popover/action-popover.component.js +2 -2
  39. package/lib/components/action-popover/action-popover.style.js +1 -1
  40. package/lib/components/action-toolbar/action-toolbar.component.js +2 -2
  41. package/lib/components/advanced-color-picker/advanced-color-picker.component.js +1 -1
  42. package/lib/components/anchor-navigation/anchor-navigation.component.js +1 -1
  43. package/lib/components/app-wrapper/app-wrapper.component.js +2 -2
  44. package/lib/components/button/button.component.js +1 -1
  45. package/lib/components/button-toggle/button-toggle.component.js +1 -1
  46. package/lib/components/carousel/carousel.component.js +2 -2
  47. package/lib/components/carousel/slide/slide.component.js +1 -1
  48. package/lib/components/checkbox/checkbox-group.component.js +1 -1
  49. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.component.js +1 -1
  50. package/lib/components/configurable-items/configurable-items.component.js +2 -2
  51. package/lib/components/confirm/confirm.component.js +1 -1
  52. package/lib/components/date/date-picker.component.js +1 -1
  53. package/lib/components/date/date.component.js +4 -4
  54. package/lib/components/date-range/date-range.component.js +2 -2
  55. package/lib/components/detail/detail.component.js +1 -1
  56. package/lib/components/dialog/dialog.style.js +10 -2
  57. package/lib/components/dialog-full-screen/content.style.js +45 -0
  58. package/lib/components/dialog-full-screen/dialog-full-screen.component.js +19 -2
  59. package/lib/components/drag-and-drop/__internal__/item-target/index.js +15 -0
  60. package/lib/{utils/helpers/dnd → components/drag-and-drop/__internal__}/item-target/item-target.js +0 -0
  61. package/lib/components/drag-and-drop/__internal__/item-types/index.js +15 -0
  62. package/lib/{utils/helpers/dnd → components/drag-and-drop/__internal__}/item-types/item-types.js +0 -0
  63. package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/index.js +15 -0
  64. package/lib/{utils/helpers → components/drag-and-drop/draggable-context/__internal__}/scrollable-parent/scrollable-parent.js +1 -1
  65. package/lib/components/drag-and-drop/draggable-context/draggable-context.js +4 -4
  66. package/lib/components/drag-and-drop/with-drag/with-drag.js +2 -2
  67. package/lib/components/drag-and-drop/with-drop/with-drop.js +11 -6
  68. package/lib/components/drawer/drawer.component.js +1 -1
  69. package/lib/components/duelling-picklist/picklist/picklist.component.js +1 -1
  70. package/lib/components/duelling-picklist/picklist-group/picklist-group.component.js +3 -3
  71. package/lib/components/duelling-picklist/picklist-group/picklist-group.style.js +1 -1
  72. package/lib/components/duelling-picklist/picklist-item/picklist-item.component.js +1 -1
  73. package/lib/components/fieldset/fieldset.component.js +2 -2
  74. package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +1 -1
  75. package/lib/components/flat-table/sort/sort.component.js +2 -2
  76. package/lib/components/form/form.component.js +15 -51
  77. package/lib/components/form/form.d.ts +2 -0
  78. package/lib/components/form/form.style.js +40 -15
  79. package/lib/components/heading/heading.component.js +1 -1
  80. package/lib/components/help/help.component.js +2 -2
  81. package/lib/components/icon/icon.component.js +2 -2
  82. package/lib/components/icon/icon.style.js +1 -1
  83. package/lib/components/icon-button/icon-button.component.js +1 -1
  84. package/lib/components/inline-inputs/inline-inputs.component.js +1 -1
  85. package/lib/components/link/link.component.js +2 -2
  86. package/lib/components/loader/loader.component.js +1 -1
  87. package/lib/components/loader-bar/loader-bar.component.js +1 -1
  88. package/lib/components/menu/__internal__/keyboard-navigation/index.js +1 -1
  89. package/lib/components/menu/__internal__/submenu/submenu.component.js +1 -1
  90. package/lib/components/menu/menu-item/menu-item.component.js +1 -1
  91. package/lib/components/menu/menu.component.js +1 -1
  92. package/lib/components/menu/submenu-block/submenu-block.component.js +1 -1
  93. package/lib/components/message/message.component.js +1 -1
  94. package/lib/components/modal/modal.component.js +1 -1
  95. package/lib/components/mount-in-app/mount-in-app.js +1 -1
  96. package/lib/components/multi-action-button/multi-action-button.component.js +1 -1
  97. package/lib/components/multi-step-wizard/multi-step-wizard.js +1 -1
  98. package/lib/components/numeral-date/numeral-date.component.js +2 -2
  99. package/lib/components/pager/__internal__/pager-navigation.component.js +2 -2
  100. package/lib/components/pager/pager.component.js +1 -1
  101. package/lib/components/pages/page/page.component.js +1 -1
  102. package/lib/components/pages/pages.component.js +1 -1
  103. package/lib/components/pill/pill.component.js +1 -1
  104. package/lib/components/pod/pod.component.js +2 -2
  105. package/lib/components/popover-container/popover-container.component.js +1 -1
  106. package/lib/components/portal/portal.js +2 -2
  107. package/lib/components/portrait/portrait-initials.component.js +1 -1
  108. package/lib/components/portrait/portrait.component.js +1 -1
  109. package/lib/components/preview/preview.component.js +1 -1
  110. package/lib/components/profile/profile.component.js +9 -4
  111. package/lib/components/radio-button/radio-button-group.component.js +1 -1
  112. package/lib/components/row/column/column.component.js +1 -1
  113. package/lib/components/row/row.component.js +1 -1
  114. package/lib/components/scrollable-list/scrollable-list.component.js +3 -3
  115. package/lib/components/search/search.component.js +2 -2
  116. package/lib/components/select/filterable-select/filterable-select.component.js +1 -1
  117. package/lib/components/select/multi-select/multi-select.component.js +1 -1
  118. package/lib/components/select/simple-select/simple-select.component.js +1 -1
  119. package/lib/components/settings-row/settings-row.component.js +1 -1
  120. package/lib/components/show-edit-pod/show-edit-pod.component.js +3 -3
  121. package/lib/components/sidebar/__internal__/sidebar-header/sidebar-header.component.js +1 -1
  122. package/lib/components/simple-color-picker/simple-color/simple-color.component.js +1 -1
  123. package/lib/components/simple-color-picker/simple-color-picker.component.js +2 -2
  124. package/lib/components/split-button/split-button.component.js +2 -2
  125. package/lib/components/table/table-cell/table-cell.component.js +2 -2
  126. package/lib/components/table/table-header/table-header.component.js +1 -1
  127. package/lib/components/table/table-row/table-row.component.js +3 -3
  128. package/lib/components/table/table.component.js +1 -1
  129. package/lib/{utils/helpers → components/table-ajax/__internal__}/serialize/package.json +0 -0
  130. package/lib/{utils/helpers → components/table-ajax/__internal__}/serialize/serialize.js +0 -0
  131. package/lib/components/table-ajax/table-ajax.component.js +2 -2
  132. package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +3 -3
  133. package/lib/components/tabs/tab/tab.component.js +1 -1
  134. package/lib/components/tabs/tabs.component.js +2 -2
  135. package/lib/components/text-editor/__internal__/toolbar/toolbar.component.js +1 -1
  136. package/lib/components/text-editor/text-editor.component.js +2 -2
  137. package/lib/components/text-editor/text-editor.style.js +1 -1
  138. package/lib/components/textarea/textarea.component.js +1 -1
  139. package/lib/components/textbox/textbox.component.js +1 -1
  140. package/lib/components/tile-select/tile-select-group.component.js +1 -1
  141. package/lib/components/tile-select/tile-select.component.js +2 -2
  142. package/lib/components/toast/toast.component.js +2 -2
  143. package/lib/components/tooltip/tooltip.component.js +1 -1
  144. package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js +1 -1
  145. package/lib/patterns/configurable-items/configurable-items.js +1 -1
  146. package/lib/patterns/configurable-items/store/store.js +1 -1
  147. package/lib/style/utils/filter-styled-system-margin-props.js +1 -1
  148. package/lib/style/utils/filter-styled-system-padding-props.js +1 -1
  149. package/package.json +1 -2
  150. package/lib/utils/decorators/should-component-update/package.json +0 -4
  151. package/lib/utils/decorators/should-component-update/should-component-update.js +0 -104
  152. package/lib/utils/ether/ether.js +0 -107
  153. package/lib/utils/ether/package.json +0 -3
  154. package/lib/utils/handlers/base-registry/base-registry.js +0 -68
  155. package/lib/utils/handlers/base-registry/package.json +0 -3
  156. package/lib/utils/helpers/auto-focus/auto-focus.js +0 -22
  157. package/lib/utils/helpers/auto-focus/package.json +0 -3
  158. package/lib/utils/helpers/browser/package.json +0 -4
  159. package/lib/utils/helpers/chain-functions/chain-functions.js +0 -29
  160. package/lib/utils/helpers/chain-functions/package.json +0 -4
  161. package/lib/utils/helpers/dnd/item-target/package.json +0 -3
  162. package/lib/utils/helpers/dnd/item-types/package.json +0 -3
  163. package/lib/utils/helpers/events/package.json +0 -3
  164. package/lib/utils/helpers/poller/package.json +0 -3
  165. package/lib/utils/helpers/poller/poller.js +0 -181
  166. package/lib/utils/helpers/prop-types/package.json +0 -3
  167. package/lib/utils/helpers/prop-types/prop-types.js +0 -42
  168. package/lib/utils/helpers/scrollable-parent/package.json +0 -3
  169. package/lib/utils/helpers/should-component-update/package.json +0 -3
  170. package/lib/utils/helpers/should-component-update/should-component-update.js +0 -56
  171. package/lib/utils/helpers/tags/package.json +0 -3
  172. package/lib/utils/helpers/tags/tags-specs/package.json +0 -3
  173. package/lib/utils/helpers/text/package.json +0 -3
  174. package/lib/utils/helpers/text/text.js +0 -47
  175. package/lib/utils/helpers/to-array/package.json +0 -3
  176. package/lib/utils/helpers/to-array/to-array.js +0 -44
  177. package/lib/utils/helpers/validations/package.json +0 -4
  178. package/lib/utils/helpers/validations/validations.js +0 -27
  179. package/lib/utils/helpers/warn-as-deprecated/warn-as-deprecated.js +0 -23
  180. package/lib/utils/logger/package.json +0 -3
  181. package/lib/utils/service/package.json +0 -3
  182. package/lib/utils/service/service.js +0 -326
@@ -1,181 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _superagent = _interopRequireDefault(require("superagent"));
9
-
10
- var _logger = _interopRequireDefault(require("../../logger"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- /**
15
- * A helper to make poll an endpoint with a GET request
16
- *
17
- * The helper takes the following params
18
- *
19
- * - queryOptions:
20
- * -- url - the url to make the GET request to
21
- * -- data - any data you wish to pass with the request
22
- * -- headers - any header you wish to pass with the request
23
- *
24
- * - functions: An object containing the custom functions
25
- * -- conditionMet: Use this to test a desired condition in the response and return a boolean.
26
- * If the condition is true, the callback will be executed.
27
- * -- conditionNotMetCallback: Called when condition not met and poller will retry
28
- * -- callback: A callback function to call when the conditionMet returns true
29
- * -- handleError: a callback function that takes an error and handles it
30
- * -- terminate: Use this to test a desired condition in the response and return a boolean.
31
- * If the condition is true, the polling will end.
32
- * -- onMaxRetries: Use this to do something when the max retries are met
33
- * options:
34
- * -- interval - the interval after which the request is re-submitted
35
- * -- retries - number of times to re-submit the request before giving up
36
- * -- endTime - a time period after which to end the polling
37
- *
38
- * ===Example Usage===
39
- *
40
- * import Poller from 'carbon-react/lib/utils/helpers/poller';
41
- *
42
- * let queryOptions = { url: '/foo/bar/1' }
43
- * let options = { interval: 5000 };
44
- * let functions = {
45
- * conditionMet: function(response) => { return response.body.status === 'complete' };
46
- * conditionNotMetCallback: function(response) => { notYetFunction(response) };
47
- * callback: function(response) => { doSomethingFancy(reponse) };
48
- * handleError: function(err) => { FlashMessage("Failed", err) };
49
- * }
50
- *
51
- * Poller(queryOptions, functions);
52
- */
53
- var _default = (queryOptions, functions, options) => {
54
- if (!setupValid(queryOptions, functions)) {
55
- return;
56
- } // set default options for unprovided options
57
-
58
-
59
- const queryOpts = getQueryOptions(queryOptions);
60
- const funcs = getFunctions(functions);
61
- const opts = getOptions(options); // pollCount for use if retries option passed
62
-
63
- let pollCount = 1;
64
-
65
- (function poll() {
66
- const now = Date.now();
67
-
68
- if (pollCount > opts.retries || now > opts.endTime) {
69
- funcs.onMaxRetries();
70
- return;
71
- }
72
-
73
- _superagent.default.get(queryOpts.url).query(queryOpts.data).set(queryOpts.headers).end((err, response) => {
74
- let result;
75
-
76
- if (err) {
77
- if (funcs.handleError) {
78
- result = funcs.handleError(err);
79
- } else {
80
- result = _logger.default.error(err.message); // eslint-disable-line no-console
81
- }
82
- } else if (funcs.terminate(response)) {
83
- result = response;
84
- } else if (funcs.conditionMet(response)) {
85
- result = funcs.callback(response);
86
- } else {
87
- funcs.conditionNotMetCallback(response);
88
- pollCount += 1;
89
- setTimeout(poll, opts.interval);
90
- }
91
-
92
- return result;
93
- });
94
- })();
95
- };
96
- /**
97
- * Sets default queryOptions
98
- *
99
- * @method getQueryOptions
100
- * @return {Object} queryOptions
101
- */
102
-
103
-
104
- exports.default = _default;
105
-
106
- function getQueryOptions(queryOptions) {
107
- return {
108
- url: queryOptions.url,
109
- data: queryOptions.data || {},
110
- headers: queryOptions.headers || {}
111
- };
112
- }
113
- /**
114
- * Sets default Options for poller
115
- *
116
- * @method getOptions
117
- * @return {Object} options
118
- */
119
-
120
-
121
- function getOptions(options) {
122
- return {
123
- interval: options.interval || 3000,
124
- endTime: Date.now() + options.endTime || Infinity,
125
- retries: options.retries || Infinity
126
- };
127
- }
128
- /**
129
- * Sets default functions for poller
130
- *
131
- * @method getFunctions
132
- * @return {Object} functions
133
- */
134
-
135
-
136
- function getFunctions(functions) {
137
- return {
138
- callback: functions.callback || null,
139
- handleError: functions.handleError || null,
140
- conditionMet: functions.conditionMet || (() => {
141
- return false;
142
- }),
143
- conditionNotMetCallback: functions.conditionNotMetCallback || (() => {
144
- return false;
145
- }),
146
- terminate: functions.terminate || (() => {
147
- return false;
148
- }),
149
- onMaxRetries: functions.onMaxRetries || (() => {
150
- _logger.default.warn("The poller has made too many requests - terminating poll"); // eslint-disable-line no-console
151
-
152
- })
153
- };
154
- }
155
- /**
156
- * Checks that required params are present
157
- *
158
- * @method setupValid
159
- * @return {Boolean}
160
- */
161
-
162
-
163
- function setupValid(queryOptions, functions) {
164
- if (queryOptions === null || typeof queryOptions.url === "undefined") {
165
- _logger.default.error("You must provide a url to the poller"); // eslint-disable-line no-console
166
-
167
-
168
- return false;
169
- }
170
-
171
- if (typeof functions.conditionMet !== "undefined" && typeof functions.callback === "undefined") {
172
- const msg = "You must provide a callback function if you are testing a condition with conditionMet";
173
-
174
- _logger.default.error(msg); // eslint-disable-line no-console
175
-
176
-
177
- return false;
178
- }
179
-
180
- return true;
181
- }
@@ -1,3 +0,0 @@
1
- {
2
- "main": "./prop-types.js"
3
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- const valueInRange = (value, min, max) => {
9
- return value >= min && value <= max;
10
- };
11
-
12
- const buildErrorString = (propName, componentName, error) => {
13
- return `${propName} in ${componentName} ${error}`;
14
- };
15
-
16
- const throwError = (propName, componentName, error) => {
17
- return new Error(buildErrorString(propName, componentName, error));
18
- };
19
-
20
- const isTypeOfNumberOrString = value => {
21
- return typeof value === "string" || typeof value === "number";
22
- };
23
-
24
- const PropTypesHelper = {
25
- inValidRange: (props, propName, componentName, min, max) => {
26
- if (props[propName]) {
27
- const value = props[propName];
28
-
29
- if (isTypeOfNumberOrString(value)) {
30
- if (!valueInRange(value, min, max)) {
31
- return throwError(propName, componentName, `must be between ${min} and ${max}`);
32
- }
33
- } else {
34
- return throwError(propName, componentName, "must be a String or Integer");
35
- }
36
- }
37
-
38
- return null;
39
- }
40
- };
41
- var _default = PropTypesHelper;
42
- exports.default = _default;
@@ -1,3 +0,0 @@
1
- {
2
- "main": "./scrollable-parent.js"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "main": "./should-component-update.js"
3
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = _default;
7
-
8
- var _immutable = _interopRequireDefault(require("immutable"));
9
-
10
- var _lodash = require("lodash");
11
-
12
- var _logger = _interopRequireDefault(require("../../logger/logger"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- /**
17
- * A shouldComponentUpdate helper. Run this method with your instance, nextProps and nextState
18
- * and it will perform a deep comparison of the properties - handling immutable objects.
19
- *
20
- * @method
21
- * @param {Object} scope
22
- * @param {Object} nextProps
23
- * @param {Object} nextState
24
- * @return {Boolean}
25
- */
26
- let deprecatedWarnTriggered = false;
27
-
28
- function _default(scope, nextProps, nextState) {
29
- if (!deprecatedWarnTriggered) {
30
- deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
31
-
32
- _logger.default.deprecate("`ShouldComponentUpdate` helper is deprecated and will soon be removed");
33
- }
34
-
35
- return !(0, _lodash.isEqualWith)(scope.props, nextProps, customCheck) || !(0, _lodash.isEqualWith)(scope.state, nextState, customCheck);
36
- }
37
- /**
38
- * Performs a custom check of parameters from the isEqual method.
39
- *
40
- * @method customCheck
41
- * @param current - could be any type
42
- * @param next - could be any type
43
- * @param {String} key
44
- * @private
45
- */
46
-
47
-
48
- function customCheck(current, next) {
49
- // if immutable object, do custom comparison. otherwise return undefined to
50
- // allow isEqual to continue as normal
51
- if (_immutable.default.Iterable.isIterable(current)) {
52
- return _immutable.default.is(current, next);
53
- }
54
-
55
- return undefined;
56
- }
@@ -1,3 +0,0 @@
1
- {
2
- "main": "./tags"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "main": "./tags-specs.js"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "main": "./text"
3
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _browser = _interopRequireDefault(require("../browser"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- /**
13
- * Text utility methods
14
- *
15
- */
16
- const Text = {
17
- /**
18
- * Clears any selected text from the current page
19
- */
20
- clearSelection() {
21
- const document = _browser.default.getDocument();
22
-
23
- const window = _browser.default.getWindow();
24
-
25
- if (document.body.createTextRange) {
26
- // IE
27
- const range = document.body.createTextRange();
28
- range.collapse();
29
- range.select();
30
- } else {
31
- // Chrome, Firefox, Safari, Edge
32
- window.getSelection().removeAllRanges();
33
- }
34
- },
35
-
36
- /**
37
- * Capitalises the first letter of string paramater
38
- */
39
- titleCase(str) {
40
- return str.replace(/\w\S*/g, txt => {
41
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
42
- });
43
- }
44
-
45
- };
46
- var _default = Text;
47
- exports.default = _default;
@@ -1,3 +0,0 @@
1
- {
2
- "main": "./to-array.js"
3
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = _default;
7
-
8
- /**
9
- * Converts a string of a given format into an array.
10
- *
11
- * For example:
12
- *
13
- * "foo[bar][baz]"
14
- *
15
- * Will be converted to:
16
- *
17
- * ["foo", "bar", "baz"]
18
- *
19
- * @method toArray
20
- * @param {String}
21
- * @return {Array}
22
- */
23
- function _default(str) {
24
- let result = [];
25
- const index = str.indexOf("[");
26
-
27
- if (index === -1) {
28
- // if there are no square brackets
29
- result.push(str);
30
- } else {
31
- if (index > 0) {
32
- // if the square bracket is not the first character, add the name at the
33
- // start of the string (not in brackets)
34
- const name = str.slice(0, index);
35
- result.push(name);
36
- } // pull out the names in brackets and add to the array
37
-
38
-
39
- const nestedNames = str.match(/[^[\]]+(?=])/g);
40
- result = result.concat(nestedNames);
41
- }
42
-
43
- return result;
44
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "validations",
3
- "main": "./validations.js"
4
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- const ValidationsHelper = {
8
- /**
9
- * Return the comparison type depending on params
10
- *
11
- * @method comparisonType
12
- * @param {Object} params
13
- * @return {String} function type to call
14
- */
15
- comparisonType: params => {
16
- const is = typeof params.is !== "undefined",
17
- max = typeof params.max !== "undefined",
18
- min = typeof params.min !== "undefined";
19
- if (is && !max && !min) return "Exact";
20
- if (!is && max && !min) return "Less";
21
- if (!is && min && !max) return "Greater";
22
- if (!is && min && max) return "Range";
23
- return null;
24
- }
25
- };
26
- var _default = ValidationsHelper;
27
- exports.default = _default;
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _logger = _interopRequireDefault(require("../../logger"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- /**
13
- * A function to display a warning in the console when a deprecated component is being used in developpment
14
- */
15
- var _default = (oldName, newName) => {
16
- if (process.env.NODE_ENV === "development" && oldName.length && newName.length) {
17
- const warnMessage = `${oldName} is marked as deprecated, it will soon be moved to "carbon-graveyard" and be replaced by ${newName}`;
18
-
19
- _logger.default.deprecate(warnMessage);
20
- }
21
- };
22
-
23
- exports.default = _default;
@@ -1,3 +0,0 @@
1
- {
2
- "main": "./logger.js"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "main": "./service.js"
3
- }