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.
- package/lib/__internal__/checkable-input/checkable-input.component.js +1 -1
- package/lib/{utils/helpers → __internal__}/date/date.d.ts +0 -0
- package/lib/{utils/helpers → __internal__}/date/date.js +0 -0
- package/lib/{utils/helpers → __internal__}/date/index.js +0 -0
- package/lib/{utils/helpers → __internal__}/filter-object-properties/filter-object-properties.js +0 -0
- package/lib/{utils/helpers → __internal__}/filter-object-properties/index.js +0 -0
- package/lib/__internal__/form-field/form-field.component.js +1 -1
- package/lib/__internal__/full-screen-heading/full-screen-heading.component.js +1 -1
- package/lib/{utils/helpers → __internal__/input}/extract-props/extract-props.js +0 -0
- package/lib/{utils/helpers → __internal__/input}/extract-props/index.js +0 -0
- package/lib/__internal__/utils/ether/ether.js +33 -0
- package/lib/__internal__/utils/ether/index.js +18 -0
- package/lib/{utils → __internal__/utils}/helpers/browser/browser.js +0 -0
- package/lib/{utils/helpers/warn-as-deprecated → __internal__/utils/helpers/browser}/index.js +2 -2
- package/lib/{utils → __internal__/utils}/helpers/browser-type-check/browser-type-check.js +0 -0
- package/lib/{utils → __internal__/utils}/helpers/browser-type-check/index.js +0 -0
- package/lib/{utils → __internal__/utils}/helpers/events/composedPath.js +0 -0
- package/lib/{utils → __internal__/utils}/helpers/events/events.js +0 -0
- package/lib/__internal__/utils/helpers/events/index.js +15 -0
- package/lib/{utils → __internal__/utils}/helpers/guid/guid.js +0 -0
- package/lib/{utils → __internal__/utils}/helpers/guid/package.json +0 -0
- package/lib/{utils → __internal__/utils}/helpers/immutable/immutable.js +0 -0
- package/lib/{utils → __internal__/utils}/helpers/immutable/package.json +0 -0
- package/lib/__internal__/utils/helpers/tags/index.js +15 -0
- package/lib/__internal__/utils/helpers/tags/tags-specs/index.js +19 -0
- package/lib/{utils → __internal__/utils}/helpers/tags/tags-specs/tags-specs.js +0 -0
- package/lib/{utils → __internal__/utils}/helpers/tags/tags.js +0 -0
- package/lib/{utils → __internal__/utils}/helpers/with-unique-id-props/index.js +0 -0
- package/lib/{utils → __internal__/utils}/helpers/with-unique-id-props/with-unique-id-props.hoc.d.ts +0 -0
- package/lib/{utils → __internal__/utils}/helpers/with-unique-id-props/with-unique-id-props.hoc.js +0 -0
- package/lib/__internal__/utils/logger/index.js +15 -0
- package/lib/{utils → __internal__/utils}/logger/logger.js +0 -9
- package/lib/__spec_helper__/mock-date-helper.js +2 -2
- package/lib/components/accordion/accordion-group/accordion-group.component.js +1 -1
- package/lib/components/accordion/accordion.component.js +2 -2
- package/lib/components/action-popover/action-popover-item/action-popover-item.component.js +2 -2
- package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.js +1 -1
- package/lib/components/action-popover/action-popover.component.js +2 -2
- package/lib/components/action-popover/action-popover.style.js +1 -1
- package/lib/components/action-toolbar/action-toolbar.component.js +2 -2
- package/lib/components/advanced-color-picker/advanced-color-picker.component.js +1 -1
- package/lib/components/anchor-navigation/anchor-navigation.component.js +1 -1
- package/lib/components/app-wrapper/app-wrapper.component.js +2 -2
- package/lib/components/button/button.component.js +1 -1
- package/lib/components/button-toggle/button-toggle.component.js +1 -1
- package/lib/components/carousel/carousel.component.js +2 -2
- package/lib/components/carousel/slide/slide.component.js +1 -1
- package/lib/components/checkbox/checkbox-group.component.js +1 -1
- package/lib/components/configurable-items/configurable-item-row/configurable-item-row.component.js +1 -1
- package/lib/components/configurable-items/configurable-items.component.js +2 -2
- package/lib/components/confirm/confirm.component.js +1 -1
- package/lib/components/date/date-picker.component.js +1 -1
- package/lib/components/date/date.component.js +4 -4
- package/lib/components/date-range/date-range.component.js +2 -2
- package/lib/components/detail/detail.component.js +1 -1
- package/lib/components/dialog/dialog.style.js +10 -2
- package/lib/components/dialog-full-screen/content.style.js +45 -0
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +19 -2
- package/lib/components/drag-and-drop/__internal__/item-target/index.js +15 -0
- package/lib/{utils/helpers/dnd → components/drag-and-drop/__internal__}/item-target/item-target.js +0 -0
- package/lib/components/drag-and-drop/__internal__/item-types/index.js +15 -0
- package/lib/{utils/helpers/dnd → components/drag-and-drop/__internal__}/item-types/item-types.js +0 -0
- package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/index.js +15 -0
- package/lib/{utils/helpers → components/drag-and-drop/draggable-context/__internal__}/scrollable-parent/scrollable-parent.js +1 -1
- package/lib/components/drag-and-drop/draggable-context/draggable-context.js +4 -4
- package/lib/components/drag-and-drop/with-drag/with-drag.js +2 -2
- package/lib/components/drag-and-drop/with-drop/with-drop.js +11 -6
- package/lib/components/drawer/drawer.component.js +1 -1
- package/lib/components/duelling-picklist/picklist/picklist.component.js +1 -1
- package/lib/components/duelling-picklist/picklist-group/picklist-group.component.js +3 -3
- package/lib/components/duelling-picklist/picklist-group/picklist-group.style.js +1 -1
- package/lib/components/duelling-picklist/picklist-item/picklist-item.component.js +1 -1
- package/lib/components/fieldset/fieldset.component.js +2 -2
- package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +1 -1
- package/lib/components/flat-table/sort/sort.component.js +2 -2
- package/lib/components/form/form.component.js +15 -51
- package/lib/components/form/form.d.ts +2 -0
- package/lib/components/form/form.style.js +40 -15
- package/lib/components/heading/heading.component.js +1 -1
- package/lib/components/help/help.component.js +2 -2
- package/lib/components/icon/icon.component.js +2 -2
- package/lib/components/icon/icon.style.js +1 -1
- package/lib/components/icon-button/icon-button.component.js +1 -1
- package/lib/components/inline-inputs/inline-inputs.component.js +1 -1
- package/lib/components/link/link.component.js +2 -2
- package/lib/components/loader/loader.component.js +1 -1
- package/lib/components/loader-bar/loader-bar.component.js +1 -1
- package/lib/components/menu/__internal__/keyboard-navigation/index.js +1 -1
- package/lib/components/menu/__internal__/submenu/submenu.component.js +1 -1
- package/lib/components/menu/menu-item/menu-item.component.js +1 -1
- package/lib/components/menu/menu.component.js +1 -1
- package/lib/components/menu/submenu-block/submenu-block.component.js +1 -1
- package/lib/components/message/message.component.js +1 -1
- package/lib/components/modal/modal.component.js +1 -1
- package/lib/components/mount-in-app/mount-in-app.js +1 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +1 -1
- package/lib/components/multi-step-wizard/multi-step-wizard.js +1 -1
- package/lib/components/numeral-date/numeral-date.component.js +2 -2
- package/lib/components/pager/__internal__/pager-navigation.component.js +2 -2
- package/lib/components/pager/pager.component.js +1 -1
- package/lib/components/pages/page/page.component.js +1 -1
- package/lib/components/pages/pages.component.js +1 -1
- package/lib/components/pill/pill.component.js +1 -1
- package/lib/components/pod/pod.component.js +2 -2
- package/lib/components/popover-container/popover-container.component.js +1 -1
- package/lib/components/portal/portal.js +2 -2
- package/lib/components/portrait/portrait-initials.component.js +1 -1
- package/lib/components/portrait/portrait.component.js +1 -1
- package/lib/components/preview/preview.component.js +1 -1
- package/lib/components/profile/profile.component.js +9 -4
- package/lib/components/radio-button/radio-button-group.component.js +1 -1
- package/lib/components/row/column/column.component.js +1 -1
- package/lib/components/row/row.component.js +1 -1
- package/lib/components/scrollable-list/scrollable-list.component.js +3 -3
- package/lib/components/search/search.component.js +2 -2
- package/lib/components/select/filterable-select/filterable-select.component.js +1 -1
- package/lib/components/select/multi-select/multi-select.component.js +1 -1
- package/lib/components/select/simple-select/simple-select.component.js +1 -1
- package/lib/components/settings-row/settings-row.component.js +1 -1
- package/lib/components/show-edit-pod/show-edit-pod.component.js +3 -3
- package/lib/components/sidebar/__internal__/sidebar-header/sidebar-header.component.js +1 -1
- package/lib/components/simple-color-picker/simple-color/simple-color.component.js +1 -1
- package/lib/components/simple-color-picker/simple-color-picker.component.js +2 -2
- package/lib/components/split-button/split-button.component.js +2 -2
- package/lib/components/table/table-cell/table-cell.component.js +2 -2
- package/lib/components/table/table-header/table-header.component.js +1 -1
- package/lib/components/table/table-row/table-row.component.js +3 -3
- package/lib/components/table/table.component.js +1 -1
- package/lib/{utils/helpers → components/table-ajax/__internal__}/serialize/package.json +0 -0
- package/lib/{utils/helpers → components/table-ajax/__internal__}/serialize/serialize.js +0 -0
- package/lib/components/table-ajax/table-ajax.component.js +2 -2
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +3 -3
- package/lib/components/tabs/tab/tab.component.js +1 -1
- package/lib/components/tabs/tabs.component.js +2 -2
- package/lib/components/text-editor/__internal__/toolbar/toolbar.component.js +1 -1
- package/lib/components/text-editor/text-editor.component.js +2 -2
- package/lib/components/text-editor/text-editor.style.js +1 -1
- package/lib/components/textarea/textarea.component.js +1 -1
- package/lib/components/textbox/textbox.component.js +1 -1
- package/lib/components/tile-select/tile-select-group.component.js +1 -1
- package/lib/components/tile-select/tile-select.component.js +2 -2
- package/lib/components/toast/toast.component.js +2 -2
- package/lib/components/tooltip/tooltip.component.js +1 -1
- package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js +1 -1
- package/lib/patterns/configurable-items/configurable-items.js +1 -1
- package/lib/patterns/configurable-items/store/store.js +1 -1
- package/lib/style/utils/filter-styled-system-margin-props.js +1 -1
- package/lib/style/utils/filter-styled-system-padding-props.js +1 -1
- package/package.json +1 -2
- package/lib/utils/decorators/should-component-update/package.json +0 -4
- package/lib/utils/decorators/should-component-update/should-component-update.js +0 -104
- package/lib/utils/ether/ether.js +0 -107
- package/lib/utils/ether/package.json +0 -3
- package/lib/utils/handlers/base-registry/base-registry.js +0 -68
- package/lib/utils/handlers/base-registry/package.json +0 -3
- package/lib/utils/helpers/auto-focus/auto-focus.js +0 -22
- package/lib/utils/helpers/auto-focus/package.json +0 -3
- package/lib/utils/helpers/browser/package.json +0 -4
- package/lib/utils/helpers/chain-functions/chain-functions.js +0 -29
- package/lib/utils/helpers/chain-functions/package.json +0 -4
- package/lib/utils/helpers/dnd/item-target/package.json +0 -3
- package/lib/utils/helpers/dnd/item-types/package.json +0 -3
- package/lib/utils/helpers/events/package.json +0 -3
- package/lib/utils/helpers/poller/package.json +0 -3
- package/lib/utils/helpers/poller/poller.js +0 -181
- package/lib/utils/helpers/prop-types/package.json +0 -3
- package/lib/utils/helpers/prop-types/prop-types.js +0 -42
- package/lib/utils/helpers/scrollable-parent/package.json +0 -3
- package/lib/utils/helpers/should-component-update/package.json +0 -3
- package/lib/utils/helpers/should-component-update/should-component-update.js +0 -56
- package/lib/utils/helpers/tags/package.json +0 -3
- package/lib/utils/helpers/tags/tags-specs/package.json +0 -3
- package/lib/utils/helpers/text/package.json +0 -3
- package/lib/utils/helpers/text/text.js +0 -47
- package/lib/utils/helpers/to-array/package.json +0 -3
- package/lib/utils/helpers/to-array/to-array.js +0 -44
- package/lib/utils/helpers/validations/package.json +0 -4
- package/lib/utils/helpers/validations/validations.js +0 -27
- package/lib/utils/helpers/warn-as-deprecated/warn-as-deprecated.js +0 -23
- package/lib/utils/logger/package.json +0 -3
- package/lib/utils/service/package.json +0 -3
- package/lib/utils/service/service.js +0 -326
|
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
13
13
|
|
|
14
|
-
var _tags = _interopRequireDefault(require("../../utils/helpers/tags/tags"));
|
|
14
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
15
15
|
|
|
16
16
|
var _tileSelect = _interopRequireDefault(require("./tile-select.component"));
|
|
17
17
|
|
|
@@ -11,11 +11,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
13
13
|
|
|
14
|
-
var _tags = _interopRequireDefault(require("../../utils/helpers/tags/tags"));
|
|
14
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
15
15
|
|
|
16
16
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
17
17
|
|
|
18
|
-
var _guid = _interopRequireDefault(require("../../utils/helpers/guid"));
|
|
18
|
+
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
19
19
|
|
|
20
20
|
var _button = _interopRequireDefault(require("../button"));
|
|
21
21
|
|
|
@@ -15,7 +15,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
15
15
|
|
|
16
16
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
17
17
|
|
|
18
|
-
var _tags = _interopRequireDefault(require("../../utils/helpers/tags/tags"));
|
|
18
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
19
19
|
|
|
20
20
|
var _toast = require("./toast.style");
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ var _iconButton = _interopRequireDefault(require("../icon-button"));
|
|
|
23
23
|
|
|
24
24
|
var _modalManager = _interopRequireDefault(require("../modal/__internal__/modal-manager"));
|
|
25
25
|
|
|
26
|
-
var _events = _interopRequireDefault(require("../../utils/helpers/events
|
|
26
|
+
var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/events"));
|
|
27
27
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
@@ -15,7 +15,7 @@ var _tooltip = _interopRequireDefault(require("./tooltip.style"));
|
|
|
15
15
|
|
|
16
16
|
var _tooltipPointer = _interopRequireDefault(require("./tooltip-pointer.style"));
|
|
17
17
|
|
|
18
|
-
var _tags = _interopRequireDefault(require("../../utils/helpers/tags/tags"));
|
|
18
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js
CHANGED
|
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _configurableItems = require("../../../components/configurable-items");
|
|
13
13
|
|
|
14
|
-
var _tags = _interopRequireDefault(require("../../../utils/helpers/tags"));
|
|
14
|
+
var _tags = _interopRequireDefault(require("../../../__internal__/utils/helpers/tags/tags"));
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
@@ -13,7 +13,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _flux = require("carbon-state-management/lib/flux");
|
|
15
15
|
|
|
16
|
-
var _tags = _interopRequireDefault(require("../../utils/helpers/tags"));
|
|
16
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
17
17
|
|
|
18
18
|
var _dialog = _interopRequireDefault(require("../../components/dialog"));
|
|
19
19
|
|
|
@@ -9,7 +9,7 @@ var _flux = require("carbon-state-management/lib/flux");
|
|
|
9
9
|
|
|
10
10
|
var _store = _interopRequireDefault(require("carbon-state-management/lib/flux/store"));
|
|
11
11
|
|
|
12
|
-
var _immutable = _interopRequireDefault(require("../../../utils/helpers/immutable"));
|
|
12
|
+
var _immutable = _interopRequireDefault(require("../../../__internal__/utils/helpers/immutable/immutable"));
|
|
13
13
|
|
|
14
14
|
var _constants = _interopRequireDefault(require("../constants"));
|
|
15
15
|
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = filterStyledSystemMarginProps;
|
|
7
7
|
|
|
8
|
-
var _filterObjectProperties = _interopRequireDefault(require("../../
|
|
8
|
+
var _filterObjectProperties = _interopRequireDefault(require("../../__internal__/filter-object-properties"));
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = filterStyledSystemPaddingProps;
|
|
7
7
|
|
|
8
|
-
var _filterObjectProperties = _interopRequireDefault(require("../../
|
|
8
|
+
var _filterObjectProperties = _interopRequireDefault(require("../../__internal__/filter-object-properties"));
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "93.0.2",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"engineStrict": true,
|
|
6
6
|
"engines": {
|
|
@@ -138,7 +138,6 @@
|
|
|
138
138
|
"@popperjs/core": "^2.9.0",
|
|
139
139
|
"@styled-system/prop-types": "^5.1.5",
|
|
140
140
|
"@tippyjs/react": "^4.2.5",
|
|
141
|
-
"axios": "^0.21.1",
|
|
142
141
|
"bignumber.js": "^9.0.1",
|
|
143
142
|
"classnames": "~2.2.6",
|
|
144
143
|
"crypto-js": "~3.3.0",
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _shouldComponentUpdate = _interopRequireDefault(require("../../helpers/should-component-update"));
|
|
9
|
-
|
|
10
|
-
var _logger = _interopRequireDefault(require("../../logger/logger"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
17
|
-
|
|
18
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
19
|
-
|
|
20
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
-
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
-
|
|
24
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
25
|
-
|
|
26
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
27
|
-
|
|
28
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
-
|
|
30
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
-
|
|
32
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* ShouldComponentUpdate Decorator.
|
|
36
|
-
*
|
|
37
|
-
* This decorator provides useful should component update function.
|
|
38
|
-
*
|
|
39
|
-
* == How to use ShouldComponentUpdate decorator in a component:
|
|
40
|
-
*
|
|
41
|
-
* In your file:
|
|
42
|
-
*
|
|
43
|
-
* import ShouldComponentUpdate from 'carbon-react/lib/utils/decorators/should-component-update;
|
|
44
|
-
*
|
|
45
|
-
* To use the decorator, wrap your component with it:
|
|
46
|
-
*
|
|
47
|
-
* const MyComponent = ShouldComponentUpdate(
|
|
48
|
-
* class MyComponent extends React.Component {
|
|
49
|
-
* ...
|
|
50
|
-
* })
|
|
51
|
-
*
|
|
52
|
-
* Provided ShouldComponentUpdate Methods
|
|
53
|
-
* * `shouldComponentUpdate` - uses the shouldComponentUpdate Helper to compare props and state
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @method ShouldComponentUpdate
|
|
57
|
-
* @param {Class} ComposedComponent class to decorate
|
|
58
|
-
* @return {Object} Decorated Component
|
|
59
|
-
*/
|
|
60
|
-
let deprecatedWarnTriggered = false;
|
|
61
|
-
|
|
62
|
-
const ShouldComponentUpdate = ComposedComponent => {
|
|
63
|
-
if (!deprecatedWarnTriggered) {
|
|
64
|
-
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
65
|
-
|
|
66
|
-
_logger.default.deprecate("`ShouldComponentUpdate` decorator is deprecated and will soon be removed");
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
let Component = /*#__PURE__*/function (_ComposedComponent) {
|
|
70
|
-
_inherits(Component, _ComposedComponent);
|
|
71
|
-
|
|
72
|
-
var _super = _createSuper(Component);
|
|
73
|
-
|
|
74
|
-
function Component() {
|
|
75
|
-
_classCallCheck(this, Component);
|
|
76
|
-
|
|
77
|
-
return _super.apply(this, arguments);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
_createClass(Component, [{
|
|
81
|
-
key: "shouldComponentUpdate",
|
|
82
|
-
value:
|
|
83
|
-
/**
|
|
84
|
-
* Lifecycle hook to calculate if the component should re-render
|
|
85
|
-
*
|
|
86
|
-
* @method shouldComponentUpdate
|
|
87
|
-
* @param nextProps - The next props for component
|
|
88
|
-
* @param nextState - The next state for component
|
|
89
|
-
* @return {Boolean}
|
|
90
|
-
*/
|
|
91
|
-
function shouldComponentUpdate(nextProps, nextState) {
|
|
92
|
-
return (0, _shouldComponentUpdate.default)(this, nextProps, nextState);
|
|
93
|
-
}
|
|
94
|
-
}]);
|
|
95
|
-
|
|
96
|
-
return Component;
|
|
97
|
-
}(ComposedComponent);
|
|
98
|
-
|
|
99
|
-
Component.displayName = ComposedComponent.displayName || ComposedComponent.name;
|
|
100
|
-
return Component;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
var _default = ShouldComponentUpdate;
|
|
104
|
-
exports.default = _default;
|
package/lib/utils/ether/ether.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.acronymize = acronymize;
|
|
7
|
-
exports.append = append;
|
|
8
|
-
exports.insertAt = insertAt;
|
|
9
|
-
exports.styleElement = styleElement;
|
|
10
|
-
exports.validProps = validProps;
|
|
11
|
-
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Ether
|
|
16
|
-
*
|
|
17
|
-
* Ether provides functional-like helper methods for Carbon specific tasks.
|
|
18
|
-
* As we are dealing with stateful values (user input, browser state) Ether
|
|
19
|
-
* does not provide pure functions in all cases.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Creates an acronym from a given string.
|
|
24
|
-
*
|
|
25
|
-
* @method acronymize
|
|
26
|
-
* @param {String} str
|
|
27
|
-
* @return {String}
|
|
28
|
-
*/
|
|
29
|
-
function acronymize(str) {
|
|
30
|
-
if (!str) return "";
|
|
31
|
-
const matches = str.match(/\b\w/g);
|
|
32
|
-
if (!matches) return "";
|
|
33
|
-
return matches.join("");
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Stringifies and appends content to value.
|
|
37
|
-
*
|
|
38
|
-
* @method append
|
|
39
|
-
* @param {String} value
|
|
40
|
-
* @param {String} content
|
|
41
|
-
* @return {String}
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
function append(value, content) {
|
|
46
|
-
return `${value}${content}`;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Sets style on element
|
|
50
|
-
*
|
|
51
|
-
* @method styleElement
|
|
52
|
-
* @param {Object} element
|
|
53
|
-
* @param {String} attribute
|
|
54
|
-
* @param {Number} value
|
|
55
|
-
* @return {Object} Styled Element
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
function styleElement(element, attribute, value) {
|
|
60
|
-
if (element.style[attribute] !== value.toString()) {
|
|
61
|
-
element.style[attribute] = value.toString();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return element.style[attribute];
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Returns the props that were passed to a component but excludes the props listed in propTypes
|
|
68
|
-
*
|
|
69
|
-
* Optionally includes the safeProps which can be defined as a static property on a Class or passed as the second
|
|
70
|
-
* argument.
|
|
71
|
-
*
|
|
72
|
-
* @method validProps
|
|
73
|
-
* @param {Object} instance
|
|
74
|
-
* @param {Array?} safeProps
|
|
75
|
-
* @return {Object} props
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
function validProps(instance, safeProps) {
|
|
80
|
-
const component = instance.isReactComponent ? instance.constructor : instance;
|
|
81
|
-
const unsafeProps = (0, _lodash.difference)(Object.keys(component.propTypes), safeProps || component.safeProps || []);
|
|
82
|
-
return (0, _lodash.omit)(instance.props, unsafeProps);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Returns string with inserted character at specified indices
|
|
86
|
-
*
|
|
87
|
-
* @method insertAt
|
|
88
|
-
* @param {String} value - value without separators
|
|
89
|
-
* @param {Object} options
|
|
90
|
-
* * @param {String} separator - character to insert
|
|
91
|
-
* * @param {Array} insertionIndices - indices where separator will be inserted
|
|
92
|
-
* @return {String} result - formatted
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
function insertAt(value, options) {
|
|
97
|
-
const separator = options.separator || "-";
|
|
98
|
-
let result = value;
|
|
99
|
-
|
|
100
|
-
for (let i = 0; i < result.length; i++) {
|
|
101
|
-
if ((0, _lodash.includes)(options.insertionIndices, i)) {
|
|
102
|
-
result = result.substr(0, i) + separator + result.substr(i);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return result;
|
|
107
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
-
|
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Base Registry class, for building handler patterns.
|
|
14
|
-
*
|
|
15
|
-
* == How to create a handler pattern:
|
|
16
|
-
*
|
|
17
|
-
* In your file, create your own registry class which exports from the base
|
|
18
|
-
* registry class. Initialise your registry and export it.
|
|
19
|
-
*
|
|
20
|
-
* import BaseRegistry from 'carbon-react/lib/utils/handlers/base-registry';
|
|
21
|
-
*
|
|
22
|
-
* class MyRegistry extends BaseRegistry {};
|
|
23
|
-
*
|
|
24
|
-
* export default new MyRegistry;
|
|
25
|
-
*
|
|
26
|
-
* @class BaseRegistry
|
|
27
|
-
* @constructor
|
|
28
|
-
*/
|
|
29
|
-
let BaseRegistry = function BaseRegistry() {
|
|
30
|
-
_classCallCheck(this, BaseRegistry);
|
|
31
|
-
|
|
32
|
-
_defineProperty(this, "defaultHandler", {
|
|
33
|
-
call: data => {
|
|
34
|
-
return data;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
_defineProperty(this, "handlers", {});
|
|
39
|
-
|
|
40
|
-
_defineProperty(this, "register", (key, handler) => {
|
|
41
|
-
this.handlers[key] = handler;
|
|
42
|
-
return handler;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
_defineProperty(this, "unregister", key => {
|
|
46
|
-
delete this.handlers[key];
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
_defineProperty(this, "obtain", (...params) => {
|
|
50
|
-
const handlers = [];
|
|
51
|
-
Object.keys(this.handlers).forEach(key => {
|
|
52
|
-
const handler = this.handlers[key];
|
|
53
|
-
|
|
54
|
-
if (handler.check(...params)) {
|
|
55
|
-
handlers.push(handler);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
if (!handlers.length) {
|
|
60
|
-
handlers.push(this.defaultHandler);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return handlers;
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
var _default = BaseRegistry;
|
|
68
|
-
exports.default = _default;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _guid = _interopRequireDefault(require("../guid"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
const AutoFocus = {
|
|
13
|
-
getKey: (autoFocus, previous) => {
|
|
14
|
-
if (autoFocus !== undefined && previous !== undefined && previous.autoFocus === autoFocus) {
|
|
15
|
-
return previous.key;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (0, _guid.default)();
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var _default = AutoFocus;
|
|
22
|
-
exports.default = _default;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Chain Functions
|
|
10
|
-
*
|
|
11
|
-
* Takes two functions, and return a new function which will call the two functions
|
|
12
|
-
* in order.
|
|
13
|
-
*
|
|
14
|
-
* @method chainFunctions
|
|
15
|
-
* @param {Function} newFunction function to be performed second
|
|
16
|
-
* @param {Function} originalFunction function to be performed first
|
|
17
|
-
* @return {Function} new function that called the two passed functions
|
|
18
|
-
*/
|
|
19
|
-
var _default = (newFunction, originalFunction) => {
|
|
20
|
-
return (...args) => {
|
|
21
|
-
if (originalFunction) {
|
|
22
|
-
originalFunction(...args);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
newFunction(...args);
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
exports.default = _default;
|