@desynova-digital/components 9.0.26 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_helpers/globals.js +9 -10
- package/_helpers/pagination.js +10 -15
- package/_helpers/story-example.js +16 -39
- package/_helpers/story-helpers.js +15 -14
- package/_helpers/story-stack.js +22 -43
- package/_helpers/uniqueId.js +2 -5
- package/_helpers/utils.js +28 -4
- package/atoms/avatar/avatar.js +19 -42
- package/atoms/avatar/avatar.story.js +25 -58
- package/atoms/avatar/index.js +13 -11
- package/atoms/badge/badge.js +14 -37
- package/atoms/badge/badge.story.js +45 -103
- package/atoms/badge/index.js +12 -10
- package/atoms/button/button.js +85 -161
- package/atoms/button/button.story.js +354 -508
- package/atoms/button/index.js +5 -9
- package/atoms/card/card.js +26 -55
- package/atoms/card/card.story.js +39 -88
- package/atoms/card/index.js +12 -10
- package/atoms/cardStack/cardStack.js +88 -147
- package/atoms/cardStack/cardStack.story.js +106 -210
- package/atoms/cardStack/index.js +12 -10
- package/atoms/cardV2/cardV2.js +57 -106
- package/atoms/cardV2/cardV2.story.js +184 -232
- package/atoms/cardV2/content.js +154 -256
- package/atoms/cardV2/index.js +4 -8
- package/atoms/cardV2/thumbnail.js +138 -208
- package/atoms/cardV2/timeline.js +167 -123
- package/atoms/checkbox/checkbox.js +85 -157
- package/atoms/checkbox/checkbox.story.js +237 -365
- package/atoms/checkbox/index.js +4 -9
- package/atoms/customSelect/customSelect.js +136 -215
- package/atoms/customSelect/customSelect.story.js +745 -851
- package/atoms/customSelect/index.js +4 -8
- package/atoms/datePicker/datePicker.js +299 -431
- package/atoms/datePicker/datePicker.story.js +453 -501
- package/atoms/datePicker/index.js +4 -8
- package/atoms/dateTime/dateTime.js +3 -6
- package/atoms/dateTime/dateTime.story.js +17 -63
- package/atoms/dateTime/index.js +5 -9
- package/atoms/draftInputText/draftInputText.js +121 -189
- package/atoms/draftInputText/draftInputText.story.js +200 -249
- package/atoms/draftInputText/index.js +5 -9
- package/atoms/dropdown/dropdown.js +38 -66
- package/atoms/dropdown/dropdown.story.js +102 -262
- package/atoms/dropdown/index.js +4 -8
- package/atoms/dropdownList/dropdownList.js +78 -108
- package/atoms/dropdownList/dropdownList.story.js +1546 -1621
- package/atoms/dropdownList/index.js +4 -8
- package/atoms/graphs/barGraph/barGraph.js +95 -146
- package/atoms/graphs/barGraph/barGraph.story.js +65 -87
- package/atoms/graphs/barGraph/index.js +4 -8
- package/atoms/graphs/circleDonut/circleDonut.js +177 -229
- package/atoms/graphs/circleDonut/circleDonut.story.js +328 -394
- package/atoms/graphs/circleDonut/index.js +5 -9
- package/atoms/graphs/circleGraph/circleGraph.js +60 -90
- package/atoms/graphs/circleGraph/circleGraph.story.js +36 -54
- package/atoms/graphs/circleGraph/index.js +4 -8
- package/atoms/graphs/circleNested/circleNested.js +216 -262
- package/atoms/graphs/circleNested/circleNested.story.js +91 -116
- package/atoms/graphs/circleNested/index.js +5 -9
- package/atoms/graphs/pieChart/index.js +4 -8
- package/atoms/graphs/pieChart/pieChart.js +162 -191
- package/atoms/graphs/pieChart/pieChart.story.js +147 -176
- package/atoms/graphs/verticalBarGraph/index.js +5 -9
- package/atoms/graphs/verticalBarGraph/verticalBarGraph.js +75 -98
- package/atoms/graphs/verticalBarGraph/verticalBarGraph.story.js +26 -45
- package/atoms/icon/icon.js +41 -72
- package/atoms/icon/icon.story.js +831 -260
- package/atoms/icon/index.js +19 -12
- package/atoms/image/image.js +18 -32
- package/atoms/image/image.story.js +10 -19
- package/atoms/image/index.js +4 -8
- package/atoms/inputText/index.js +4 -8
- package/atoms/inputText/inputText.js +86 -131
- package/atoms/inputText/inputText.story.js +191 -255
- package/atoms/label/index.js +4 -8
- package/atoms/label/label.js +25 -50
- package/atoms/label/label.story.js +42 -83
- package/atoms/loader/CircleLoader.js +29 -63
- package/atoms/loader/ShimmerComponent/CollabShimmerCard.js +39 -50
- package/atoms/loader/ShimmerComponent/CollabShimmerCardTray.js +41 -42
- package/atoms/loader/ShimmerComponent/FiltersShimmer.js +30 -30
- package/atoms/loader/ShimmerComponent/GraphDetailShimmer.js +21 -34
- package/atoms/loader/ShimmerComponent/GraphTitleShimmer.js +30 -34
- package/atoms/loader/ShimmerComponent/GraphsComponentShimmer.js +23 -32
- package/atoms/loader/ShimmerComponent/Shimmer.js +24 -32
- package/atoms/loader/ThreeDotLoader.js +14 -29
- package/atoms/loader/index.js +13 -11
- package/atoms/loader/loader.js +34 -58
- package/atoms/loader/loader.story.js +48 -52
- package/atoms/loader/spinningLoader.js +23 -34
- package/atoms/popup/index.js +5 -9
- package/atoms/popup/popup.js +123 -208
- package/atoms/popup/popup.story.js +97 -131
- package/atoms/radio/index.js +18 -11
- package/atoms/radio/radio.js +58 -112
- package/atoms/radio/radio.story.js +197 -420
- package/atoms/select/index.js +4 -8
- package/atoms/select/select.js +48 -86
- package/atoms/sideBar/index.js +5 -9
- package/atoms/sideBar/sidebar.js +89 -140
- package/atoms/switch/index.js +4 -8
- package/atoms/switch/switch.js +56 -86
- package/atoms/switch/switch.story.js +268 -415
- package/atoms/tag/index.js +12 -10
- package/atoms/tag/tag.js +29 -63
- package/atoms/tag/tag.story.js +135 -209
- package/atoms/textarea/index.js +5 -9
- package/atoms/textarea/textarea.js +55 -99
- package/atoms/textarea/textarea.story.js +48 -41
- package/atoms/thematicBreak/index.js +12 -10
- package/atoms/thematicBreak/thematicBreak.js +20 -38
- package/atoms/thematicBreak/thematicBreak.story.js +25 -37
- package/atoms/timeCodeInput/index.js +4 -8
- package/atoms/timeCodeInput/timCodeInput.story.js +21 -35
- package/atoms/timeCodeInput/timeCodeInput.js +33 -51
- package/atoms/timer/index.js +5 -9
- package/atoms/timer/timer.js +57 -108
- package/atoms/timer/timer.story.js +13 -26
- package/atoms/toast/index.js +5 -9
- package/atoms/toast/toast.js +81 -116
- package/atoms/toast/toast.story.js +50 -76
- package/atoms/videoCard/index.js +12 -10
- package/atoms/videoCard/videoCard.js +265 -447
- package/atoms/videoCard/videoCard.story.js +495 -710
- package/components.js +411 -294
- package/index.js +350 -61
- package/molecules/carousel/carousel.js +121 -207
- package/molecules/carousel/carousel.story.js +240 -223
- package/molecules/carousel/index.js +5 -9
- package/molecules/errorScreen/CollabErrorScreen.js +35 -66
- package/molecules/errorScreen/TableErrorScreen.js +109 -102
- package/molecules/errorScreen/TableErrorScreen.jsx +7 -6
- package/molecules/errorScreen/errorScreen.js +41 -94
- package/molecules/filter/constants.js +1 -0
- package/molecules/filter/filter.js +378 -562
- package/molecules/filter/filter.story.js +79 -104
- package/molecules/filter/index.js +5 -9
- package/molecules/graphCard/graphCard.js +97 -193
- package/molecules/graphCard/graphCard.story.js +159 -191
- package/molecules/graphCard/index.js +4 -8
- package/molecules/graphCard/loader.js +28 -68
- package/molecules/graphDetailCard/graphDetailCard.js +115 -183
- package/molecules/graphDetailCard/graphDetailCard.story.js +218 -254
- package/molecules/graphDetailCard/index.js +5 -9
- package/molecules/pageHeader/index.js +12 -10
- package/molecules/pageHeader/pageHeader.js +38 -79
- package/molecules/pageHeader/pageHeader.story.js +34 -55
- package/molecules/pagination/index.js +4 -8
- package/molecules/pagination/pagination.js +126 -202
- package/molecules/pagination/pagination.story.js +40 -52
- package/molecules/richTextInput/RichTextInput.js +354 -0
- package/molecules/richTextInput/RichTextInput.story.js +50 -0
- package/molecules/richTextInput/index.js +9 -0
- package/molecules/table/index.js +4 -8
- package/molecules/table/table-column.js +10 -16
- package/molecules/table/table-header.js +31 -72
- package/molecules/table/table.js +743 -1075
- package/molecules/table/table.story.js +274 -304
- package/molecules/tabs/index.js +4 -8
- package/molecules/tabs/tabs.js +112 -184
- package/molecules/tabs/tabs.story.js +66 -133
- package/molecules/videoCardList/index.js +4 -8
- package/molecules/videoCardList/videoCardList.js +24 -41
- package/molecules/videoCardList/videoCardList.story.js +449 -664
- package/molecules/videoPlayer/index.js +4 -8
- package/molecules/videoPlayer/videoPlayer.js +1019 -1097
- package/molecules/videoPlayer/videoPlayer.story.js +10 -21
- package/package.json +2 -2
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
var _datePicker = require("./datePicker");
|
|
8
|
-
|
|
9
|
-
var _datePicker2 = _interopRequireDefault(_datePicker);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
exports.default = _datePicker2.default;
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _datePicker = _interopRequireDefault(require("./datePicker"));
|
|
9
|
+
var _default = exports["default"] = _datePicker["default"];
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports["default"] = void 0;
|
|
6
7
|
var monthName = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
7
8
|
var DateTime = {
|
|
8
9
|
toDateString: function toDateString(date, format) {
|
|
@@ -16,24 +17,20 @@ var DateTime = {
|
|
|
16
17
|
;
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
|
-
|
|
20
20
|
toTimeString: function toTimeString(date, format) {
|
|
21
21
|
if (typeof date === "number") {
|
|
22
22
|
date = new Date(date);
|
|
23
23
|
}
|
|
24
24
|
var hrs = date.getHours(),
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
mins = date.getMinutes();
|
|
27
26
|
if (format === "HH:MM AP") {
|
|
28
27
|
return (hrs < 12 ? hrs === 0 ? "12" : hrs < 10 ? "0" + hrs : hrs : hrs === 12 ? "12" : hrs < 22 ? "0" + (hrs - 12) : hrs - 12) + ":" + (mins < 10 ? "0" + mins : mins) + " " + (hrs < 12 ? "AM" : "PM");
|
|
29
28
|
} else {
|
|
30
29
|
return (hrs < 10 ? "0" + hrs : hrs) + ":" + (mins < 10 ? "0" + mins : mins);
|
|
31
30
|
}
|
|
32
31
|
},
|
|
33
|
-
|
|
34
32
|
toDateTimeString: function toDateTimeString(date) {
|
|
35
33
|
return DateTime.toDateString(date) + " - " + DateTime.toTimeString(date, "HH:MM AP");
|
|
36
34
|
}
|
|
37
35
|
};
|
|
38
|
-
|
|
39
|
-
exports.default = DateTime;
|
|
36
|
+
var _default = exports["default"] = DateTime;
|
|
@@ -1,65 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var _react2 =
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _dateTime2 = _interopRequireDefault(_dateTime);
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
(0, _react3.storiesOf)('DateTime').add('light theme', function () {
|
|
18
|
-
return _react2.default.createElement(
|
|
19
|
-
_storyHelpers.Example,
|
|
20
|
-
{ title: 'DateTime', background: 'light' },
|
|
21
|
-
_react2.default.createElement(
|
|
22
|
-
_storyHelpers.Stack,
|
|
23
|
-
null,
|
|
24
|
-
_react2.default.createElement(
|
|
25
|
-
'div',
|
|
26
|
-
null,
|
|
27
|
-
_react2.default.createElement(
|
|
28
|
-
'h1',
|
|
29
|
-
null,
|
|
30
|
-
_dateTime2.default.toDateString(1579176064345, 'mmm DD, YYYY')
|
|
31
|
-
),
|
|
32
|
-
_react2.default.createElement(
|
|
33
|
-
'h1',
|
|
34
|
-
null,
|
|
35
|
-
_dateTime2.default.toTimeString(1579176064345, 'HH:MM AP')
|
|
36
|
-
)
|
|
37
|
-
)
|
|
38
|
-
)
|
|
39
|
-
);
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@storybook/react");
|
|
6
|
+
var _storyHelpers = require("../../_helpers/story-helpers");
|
|
7
|
+
var _dateTime = _interopRequireDefault(require("./dateTime"));
|
|
8
|
+
(0, _react2.storiesOf)('DateTime').add('light theme', function () {
|
|
9
|
+
return /*#__PURE__*/_react["default"].createElement(_storyHelpers.Example, {
|
|
10
|
+
title: "DateTime",
|
|
11
|
+
background: "light"
|
|
12
|
+
}, /*#__PURE__*/_react["default"].createElement(_storyHelpers.Stack, null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("h1", null, _dateTime["default"].toDateString(1579176064345, 'mmm DD, YYYY')), /*#__PURE__*/_react["default"].createElement("h1", null, _dateTime["default"].toTimeString(1579176064345, 'HH:MM AP')))));
|
|
40
13
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_react2.default.createElement(
|
|
47
|
-
_storyHelpers.Stack,
|
|
48
|
-
null,
|
|
49
|
-
_react2.default.createElement(
|
|
50
|
-
'div',
|
|
51
|
-
null,
|
|
52
|
-
_react2.default.createElement(
|
|
53
|
-
'h1',
|
|
54
|
-
null,
|
|
55
|
-
_dateTime2.default.toDateString(1579176064345, 'mmm DD, YYYY')
|
|
56
|
-
),
|
|
57
|
-
_react2.default.createElement(
|
|
58
|
-
'h1',
|
|
59
|
-
null,
|
|
60
|
-
_dateTime2.default.toTimeString(1579176064345, 'HH:MM AP')
|
|
61
|
-
)
|
|
62
|
-
)
|
|
63
|
-
)
|
|
64
|
-
);
|
|
14
|
+
(0, _react2.storiesOf)('DateTime').add('dark theme', function () {
|
|
15
|
+
return /*#__PURE__*/_react["default"].createElement(_storyHelpers.Example, {
|
|
16
|
+
title: "DateTime",
|
|
17
|
+
background: "dark"
|
|
18
|
+
}, /*#__PURE__*/_react["default"].createElement(_storyHelpers.Stack, null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("h1", null, _dateTime["default"].toDateString(1579176064345, 'mmm DD, YYYY')), /*#__PURE__*/_react["default"].createElement("h1", null, _dateTime["default"].toTimeString(1579176064345, 'HH:MM AP')))));
|
|
65
19
|
});
|
package/atoms/dateTime/index.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
var _dateTime = require(
|
|
8
|
-
|
|
9
|
-
var _dateTime2 = _interopRequireDefault(_dateTime);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
exports.default = _dateTime2.default;
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _dateTime = _interopRequireDefault(require("./dateTime"));
|
|
9
|
+
var _default = exports["default"] = _dateTime["default"];
|
|
@@ -1,112 +1,76 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
var _styledComponents = require('styled-components');
|
|
28
|
-
|
|
29
|
-
var _styledComponents2 = _interopRequireDefault(_styledComponents);
|
|
30
|
-
|
|
31
|
-
var _tokens = require('@desynova-digital/tokens');
|
|
32
|
-
|
|
33
|
-
var _draftConvert = require('draft-convert');
|
|
34
|
-
|
|
35
|
-
var _icon = require('../icon');
|
|
36
|
-
|
|
37
|
-
var _icon2 = _interopRequireDefault(_icon);
|
|
38
|
-
|
|
39
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
40
|
-
|
|
41
|
-
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
42
|
-
|
|
43
|
-
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
44
|
-
|
|
45
|
-
var DraftInputTextDiv = _styledComponents2.default.div(_templateObject);
|
|
46
|
-
|
|
47
|
-
var PasswordToggleButton = _styledComponents2.default.div(_templateObject2);
|
|
48
|
-
|
|
49
|
-
var CountWrappper = _styledComponents2.default.div(_templateObject3);
|
|
50
|
-
|
|
51
|
-
var DraftInputError = _styledComponents2.default.span(_templateObject4, function (props) {
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _draftJs = require("draft-js");
|
|
15
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
|
+
var _tokens = require("@desynova-digital/tokens");
|
|
18
|
+
var _draftConvert = require("draft-convert");
|
|
19
|
+
var _icon = _interopRequireDefault(require("../icon"));
|
|
20
|
+
var _excluded = ["maxLength", "defaultValue", "type", "showLengthCount", "label", "value", "autoFocus", "isFocused"];
|
|
21
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
22
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
24
|
+
var DraftInputTextDiv = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n background: transparent;\n font-family: 'SFUIText-Medium';\n position: relative;\n width:92%;\n margin-bottom:10px;\n margin-top:10px\n display: block;\n > label {\n color: #999999;\n font-size: 14px;\n font-family: inherit;\n position: absolute;\n pointer-events: none;\n left: 0px;\n top: 5px;\n transition: 0.2s ease all;\n -moz-transition: 0.2s ease all;\n -webkit-transition: 0.2s ease all;\n }\n > div:focus ~ label {\n top: -10px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n > div ~ label.floaton {\n top: -10px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n"])));
|
|
25
|
+
var PasswordToggleButton = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n background: none;\n border: none;\n cursor: pointer;\n position: absolute;\n right: 0;\n top: 5px;\n &:focus {\n outline: none;\n }\n"])));
|
|
26
|
+
var CountWrappper = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n right: 0px;\n top: 0px;\n background-color: #303f51;\n border-radius: 12px;\n font-size: 12px;\n padding: 5px 10px;\n color: #ffffff;\n"])));
|
|
27
|
+
var DraftInputError = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n padding-top: 5px;\n display: inline-block;\n font-size: 12px;\n font-family: inherit;\n width: 100%;\n text-align: left;\n"])), function (props) {
|
|
52
28
|
return _tokens.colors[props.theme].inputError.color;
|
|
53
29
|
});
|
|
54
|
-
|
|
55
30
|
var DraftInputText = function DraftInputText(_ref) {
|
|
56
31
|
var maxLength = _ref.maxLength,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
32
|
+
defaultValue = _ref.defaultValue,
|
|
33
|
+
type = _ref.type,
|
|
34
|
+
showLengthCount = _ref.showLengthCount,
|
|
35
|
+
label = _ref.label,
|
|
36
|
+
value = _ref.value,
|
|
37
|
+
autoFocus = _ref.autoFocus,
|
|
38
|
+
isFocused = _ref.isFocused,
|
|
39
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
66
40
|
var _useState = (0, _react.useState)(true),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
41
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
42
|
+
hidden = _useState2[0],
|
|
43
|
+
togglePassword = _useState2[1];
|
|
71
44
|
var _useState3 = (0, _react.useState)(true),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
45
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
46
|
+
diff = _useState4[0],
|
|
47
|
+
setDiff = _useState4[1];
|
|
76
48
|
var _useState5 = (0, _react.useState)(false),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
49
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
50
|
+
focus = _useState6[0],
|
|
51
|
+
setFocus = _useState6[1];
|
|
81
52
|
var _useState7 = (0, _react.useState)(function () {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
53
|
+
return _draftJs.EditorState.createEmpty();
|
|
54
|
+
}),
|
|
55
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
56
|
+
editorState = _useState8[0],
|
|
57
|
+
setEditorState = _useState8[1];
|
|
88
58
|
var editorRef = (0, _react.useRef)(null);
|
|
89
|
-
|
|
90
59
|
var _useState9 = (0, _react.useState)(null),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
60
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
61
|
+
listScrollTop = _useState10[0],
|
|
62
|
+
setListScrollTop = _useState10[1];
|
|
95
63
|
var contentLength = editorState.getCurrentContent().getPlainText('').length;
|
|
96
64
|
var scrollObject = localStorage.getItem('scrollObject');
|
|
97
|
-
|
|
98
65
|
if (scrollObject && JSON.parse(scrollObject).tableListScrollTop !== listScrollTop) {
|
|
99
66
|
setListScrollTop(JSON.parse(scrollObject).tableListScrollTop);
|
|
100
67
|
}
|
|
101
|
-
|
|
102
68
|
if (props.error && props.error.length > 0) {
|
|
103
69
|
var errorMesssage = props.error;
|
|
104
70
|
}
|
|
105
|
-
|
|
106
71
|
if (props.readOnly) {
|
|
107
72
|
props.disabled = true;
|
|
108
73
|
}
|
|
109
|
-
|
|
110
74
|
if (props.passwordButton) {
|
|
111
75
|
var passwordButton = props.passwordButton;
|
|
112
76
|
}
|
|
@@ -119,7 +83,6 @@ var DraftInputText = function DraftInputText(_ref) {
|
|
|
119
83
|
*/
|
|
120
84
|
var handleKeyCommand = function handleKeyCommand(command, editorState) {
|
|
121
85
|
var newState = _draftJs.RichUtils.handleKeyCommand(editorState, command);
|
|
122
|
-
|
|
123
86
|
if (newState) {
|
|
124
87
|
setEditorState(newState);
|
|
125
88
|
return 'handled';
|
|
@@ -134,9 +97,7 @@ var DraftInputText = function DraftInputText(_ref) {
|
|
|
134
97
|
var _getLengthOfSelectedText = function _getLengthOfSelectedText() {
|
|
135
98
|
var currentSelection = editorState.getSelection();
|
|
136
99
|
var isCollapsed = currentSelection.isCollapsed();
|
|
137
|
-
|
|
138
100
|
var length = 0;
|
|
139
|
-
|
|
140
101
|
if (!isCollapsed) {
|
|
141
102
|
var currentContent = editorState.getCurrentContent();
|
|
142
103
|
var startKey = currentSelection.getStartKey();
|
|
@@ -147,12 +108,10 @@ var DraftInputText = function DraftInputText(_ref) {
|
|
|
147
108
|
var startSelectedTextLength = startBlockTextLength - currentSelection.getStartOffset();
|
|
148
109
|
var endSelectedTextLength = currentSelection.getEndOffset();
|
|
149
110
|
var keyAfterEnd = currentContent.getKeyAfter(endKey);
|
|
150
|
-
|
|
151
111
|
if (isStartAndEndBlockAreTheSame) {
|
|
152
112
|
length += currentSelection.getEndOffset() - currentSelection.getStartOffset();
|
|
153
113
|
} else {
|
|
154
114
|
var currentKey = startKey;
|
|
155
|
-
|
|
156
115
|
while (currentKey && currentKey !== keyAfterEnd) {
|
|
157
116
|
if (currentKey === startKey) {
|
|
158
117
|
length += startSelectedTextLength + 1;
|
|
@@ -161,12 +120,10 @@ var DraftInputText = function DraftInputText(_ref) {
|
|
|
161
120
|
} else {
|
|
162
121
|
length += currentContent.getBlockForKey(currentKey).getLength() + 1;
|
|
163
122
|
}
|
|
164
|
-
|
|
165
123
|
currentKey = currentContent.getKeyAfter(currentKey);
|
|
166
124
|
}
|
|
167
125
|
}
|
|
168
126
|
}
|
|
169
|
-
|
|
170
127
|
return length;
|
|
171
128
|
};
|
|
172
129
|
|
|
@@ -180,7 +137,6 @@ var DraftInputText = function DraftInputText(_ref) {
|
|
|
180
137
|
var currentContent = editorState.getCurrentContent();
|
|
181
138
|
var currentContentLength = currentContent.getPlainText('').length;
|
|
182
139
|
var selectedTextLength = _getLengthOfSelectedText();
|
|
183
|
-
|
|
184
140
|
if (position === 'before') {
|
|
185
141
|
if (currentContentLength - selectedTextLength + text.length > maxLength - 1) {
|
|
186
142
|
console.log('You can type a maximum of ten characters');
|
|
@@ -219,7 +175,6 @@ var DraftInputText = function DraftInputText(_ref) {
|
|
|
219
175
|
var _handleChange = function _handleChange(newEditorState) {
|
|
220
176
|
var contentState = newEditorState.getCurrentContent();
|
|
221
177
|
var text = contentState.getPlainText();
|
|
222
|
-
|
|
223
178
|
if (text.length <= maxLength) {
|
|
224
179
|
setEditorState(newEditorState);
|
|
225
180
|
} else {
|
|
@@ -237,7 +192,6 @@ var DraftInputText = function DraftInputText(_ref) {
|
|
|
237
192
|
var match = htmlString.match(regex);
|
|
238
193
|
return match ? match[1] : htmlString;
|
|
239
194
|
};
|
|
240
|
-
|
|
241
195
|
var changeEmToI = function changeEmToI(str) {
|
|
242
196
|
return str.replace(/<[/]?em>/g, function (match) {
|
|
243
197
|
return match === '<em>' ? '<i>' : '</i>';
|
|
@@ -282,7 +236,6 @@ var DraftInputText = function DraftInputText(_ref) {
|
|
|
282
236
|
setDiff(false);
|
|
283
237
|
var dummy = (0, _draftConvert.convertFromHTML)(value);
|
|
284
238
|
var newState = _draftJs.EditorState.createWithContent(dummy);
|
|
285
|
-
|
|
286
239
|
if (focus) {
|
|
287
240
|
isFocused = true;
|
|
288
241
|
}
|
|
@@ -318,81 +271,64 @@ var DraftInputText = function DraftInputText(_ref) {
|
|
|
318
271
|
editorRef.current.focus();
|
|
319
272
|
}
|
|
320
273
|
}, [autoFocus]);
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
),
|
|
374
|
-
type == 'password' || passwordButton ? _react2.default.createElement(
|
|
375
|
-
PasswordToggleButton,
|
|
376
|
-
{
|
|
377
|
-
type: 'button',
|
|
378
|
-
className: 'password-toggle',
|
|
379
|
-
onClick: function onClick() {
|
|
380
|
-
return togglePassword(!hidden);
|
|
381
|
-
},
|
|
382
|
-
hiddenEye: errorMesssage ? true : false
|
|
383
|
-
},
|
|
384
|
-
hidden ? _react2.default.createElement(_icon2.default, { name: 'show-password', width: 18, height: 15, color: '#999' }) : _react2.default.createElement(_icon2.default, { name: 'hide-password', width: 18, height: 15, color: '#999' })
|
|
385
|
-
) : ''
|
|
386
|
-
);
|
|
274
|
+
return /*#__PURE__*/_react["default"].createElement(DraftInputTextDiv, {
|
|
275
|
+
theme: props.theme,
|
|
276
|
+
inputWidth: props.inputWidth
|
|
277
|
+
}, /*#__PURE__*/_react["default"].createElement(RichTextEditorContainer, (0, _extends2["default"])({
|
|
278
|
+
type: hidden ? type : 'text',
|
|
279
|
+
value: value,
|
|
280
|
+
defaultValue: defaultValue
|
|
281
|
+
}, props, {
|
|
282
|
+
maxLength: maxLength || '',
|
|
283
|
+
showLengthCount: showLengthCount || false
|
|
284
|
+
}), /*#__PURE__*/_react["default"].createElement(_draftJs.Editor, {
|
|
285
|
+
ref: editorRef,
|
|
286
|
+
editorState: editorState,
|
|
287
|
+
onChange: _handleChange,
|
|
288
|
+
handleBeforeInput: _handleBeforeInput,
|
|
289
|
+
handlePastedText: _handlePastedText,
|
|
290
|
+
handleKeyCommand: handleKeyCommand,
|
|
291
|
+
onFocus: function onFocus() {
|
|
292
|
+
return setFocus(true);
|
|
293
|
+
},
|
|
294
|
+
onBlur: function onBlur() {
|
|
295
|
+
return setFocus(false);
|
|
296
|
+
},
|
|
297
|
+
handleReturn: function handleReturn(e) {
|
|
298
|
+
props.onKeyDownFn();
|
|
299
|
+
return 'handled';
|
|
300
|
+
}
|
|
301
|
+
})), label && /*#__PURE__*/_react["default"].createElement("label", {
|
|
302
|
+
htmlFor: props.id,
|
|
303
|
+
className: editorState.getCurrentContent().hasText() || focus ? 'floaton' : ''
|
|
304
|
+
}, "".concat(label).concat(props.isRequired ? '*' : '')), errorMesssage ? /*#__PURE__*/_react["default"].createElement(DraftInputError, {
|
|
305
|
+
value: value,
|
|
306
|
+
theme: props.theme,
|
|
307
|
+
error: props.error
|
|
308
|
+
}, errorMesssage) : '', maxLength && showLengthCount && /*#__PURE__*/_react["default"].createElement(CountWrappper, null, contentLength, "/", maxLength), type == 'password' || passwordButton ? /*#__PURE__*/_react["default"].createElement(PasswordToggleButton, {
|
|
309
|
+
type: "button",
|
|
310
|
+
className: "password-toggle",
|
|
311
|
+
onClick: function onClick() {
|
|
312
|
+
return togglePassword(!hidden);
|
|
313
|
+
},
|
|
314
|
+
hiddenEye: errorMesssage ? true : false
|
|
315
|
+
}, hidden ? /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
316
|
+
name: "show-password",
|
|
317
|
+
width: 18,
|
|
318
|
+
height: 15,
|
|
319
|
+
color: "#999"
|
|
320
|
+
}) : /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
321
|
+
name: "hide-password",
|
|
322
|
+
width: 18,
|
|
323
|
+
height: 15,
|
|
324
|
+
color: "#999"
|
|
325
|
+
})) : '');
|
|
387
326
|
};
|
|
388
|
-
|
|
389
327
|
var returnPadding = function returnPadding(props) {
|
|
390
328
|
var digitCount = props.maxLength.toString().length;
|
|
391
|
-
|
|
392
329
|
if (props.type === 'password') {
|
|
393
330
|
return '7px 23px 2px 0px';
|
|
394
331
|
}
|
|
395
|
-
|
|
396
332
|
switch (digitCount) {
|
|
397
333
|
case 0:
|
|
398
334
|
return '7px 0px 2px 0px';
|
|
@@ -410,8 +346,7 @@ var returnPadding = function returnPadding(props) {
|
|
|
410
346
|
return '7px 0px 2px 0px';
|
|
411
347
|
}
|
|
412
348
|
};
|
|
413
|
-
|
|
414
|
-
var RichTextEditorContainer = _styledComponents2.default.div(_templateObject5, function (props) {
|
|
349
|
+
var RichTextEditorContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\nmax-height:48px;\n overflow-y:scroll;\n::-webkit-scrollbar {\n width: 0; /* Remove scrollbar space */\n background: transparent; /* Optional: just make scrollbar invisible */\n }\nwhite-space: nowrap;\n width:100%\n box-sizing: border-box;\n border-bottom: 1px solid ", ";\n \n\n font-family: \"SFUIText-Medium\";\n font-size: 14px;\n color: ", ";\n\n display: inline-block;\n position: relative;\n padding: ", ";\n &:hover {\n border-color: ", ";\n }\n\n &:focus-within {\n border-color: ", ";\n }\n\n &::placeholder {\n color: ", ";\n opacity: ", ";\n transition: 0.2s ease all;\n }\n\n &:focus-within::placeholder {\n color: ", ";\n opacity: ", ";\n }\n\n"])), function (props) {
|
|
415
350
|
return props.theme === 'light' ? _tokens.colors.light.inputCommon.border : _tokens.colors.dark.inputCommon.border;
|
|
416
351
|
}, function (props) {
|
|
417
352
|
return props.theme === 'light' ? _tokens.colors.light.inputCommon.color : _tokens.colors.dark.inputCommon.color;
|
|
@@ -430,38 +365,36 @@ var RichTextEditorContainer = _styledComponents2.default.div(_templateObject5, f
|
|
|
430
365
|
}, function (props) {
|
|
431
366
|
return props.label ? '1' : '1';
|
|
432
367
|
});
|
|
433
|
-
|
|
434
368
|
DraftInputText.propTypes = {
|
|
435
|
-
masked:
|
|
369
|
+
masked: _propTypes["default"].bool,
|
|
436
370
|
/** Make input readOnly if it does not validate constraint */
|
|
437
|
-
readOnly:
|
|
371
|
+
readOnly: _propTypes["default"].bool,
|
|
438
372
|
/** Use when the expected input is code */
|
|
439
|
-
code:
|
|
373
|
+
code: _propTypes["default"].bool,
|
|
440
374
|
/** Pass hasError to show error state */
|
|
441
|
-
hasError:
|
|
375
|
+
hasError: _propTypes["default"].bool,
|
|
442
376
|
/** Pass error string directly to show error state */
|
|
443
|
-
error:
|
|
377
|
+
error: _propTypes["default"].string,
|
|
444
378
|
/** onChange transparently passed to the input */
|
|
445
|
-
onChange:
|
|
446
|
-
onKeyDownFn:
|
|
379
|
+
onChange: _propTypes["default"].func,
|
|
380
|
+
onKeyDownFn: _propTypes["default"].func,
|
|
447
381
|
/** Text to display when the input is empty */
|
|
448
|
-
placeholder:
|
|
382
|
+
placeholder: _propTypes["default"].string,
|
|
449
383
|
/** The default value for the field */
|
|
450
|
-
defaultValue:
|
|
384
|
+
defaultValue: _propTypes["default"].string,
|
|
451
385
|
/** The (HTML) type for the input. */
|
|
452
|
-
type:
|
|
453
|
-
value:
|
|
386
|
+
type: _propTypes["default"].string,
|
|
387
|
+
value: _propTypes["default"].string,
|
|
454
388
|
/** The (HTML) maxLength for the input. */
|
|
455
|
-
maxLength:
|
|
456
|
-
inputWidth:
|
|
457
|
-
showLengthCount:
|
|
458
|
-
simpleEdit:
|
|
459
|
-
autoFocus:
|
|
460
|
-
isFocused:
|
|
461
|
-
theme:
|
|
462
|
-
fieldType:
|
|
389
|
+
maxLength: _propTypes["default"].number,
|
|
390
|
+
inputWidth: _propTypes["default"].number,
|
|
391
|
+
showLengthCount: _propTypes["default"].bool,
|
|
392
|
+
simpleEdit: _propTypes["default"].bool,
|
|
393
|
+
autoFocus: _propTypes["default"].bool,
|
|
394
|
+
isFocused: _propTypes["default"].bool,
|
|
395
|
+
theme: _propTypes["default"].oneOf(['light', 'dark', 'nexc']),
|
|
396
|
+
fieldType: _propTypes["default"].oneOf(['inputField', 'textArea'])
|
|
463
397
|
};
|
|
464
|
-
|
|
465
398
|
DraftInputText.defaultProps = {
|
|
466
399
|
isFocused: false,
|
|
467
400
|
autoFocus: false,
|
|
@@ -475,5 +408,4 @@ DraftInputText.defaultProps = {
|
|
|
475
408
|
showLengthCount: false,
|
|
476
409
|
simpleEdit: false
|
|
477
410
|
};
|
|
478
|
-
|
|
479
|
-
exports.default = DraftInputText;
|
|
411
|
+
var _default = exports["default"] = DraftInputText;
|