@elliemae/ds-comments 2.3.0-alpha.9 → 2.3.0-next.3
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/cjs/components/CommentCard.js +150 -0
- package/cjs/components/DSComments.js +12 -0
- package/cjs/components/blocks.js +72 -0
- package/cjs/components/helper.js +25 -0
- package/cjs/index.js +14 -0
- package/esm/components/CommentCard.js +138 -0
- package/esm/components/DSComments.js +8 -0
- package/esm/components/blocks.js +52 -0
- package/esm/components/helper.js +15 -0
- package/esm/index.js +8 -0
- package/package.json +29 -31
- package/{dist/types → types}/components/CommentCard.d.ts +0 -0
- package/{dist/types → types}/components/DSComments.d.ts +0 -0
- package/{dist/types → types}/components/blocks.d.ts +0 -0
- package/{dist/types → types}/components/helper.d.ts +0 -0
- package/{dist/types → types}/index.d.ts +0 -0
- package/dist/cjs/components/CommentCard.js +0 -118
- package/dist/cjs/components/CommentCard.js.map +0 -7
- package/dist/cjs/components/DSComments.js +0 -39
- package/dist/cjs/components/DSComments.js.map +0 -7
- package/dist/cjs/components/blocks.js +0 -75
- package/dist/cjs/components/blocks.js.map +0 -7
- package/dist/cjs/components/helper.js +0 -46
- package/dist/cjs/components/helper.js.map +0 -7
- package/dist/cjs/index.js +0 -39
- package/dist/cjs/index.js.map +0 -7
- package/dist/esm/components/CommentCard.js +0 -97
- package/dist/esm/components/CommentCard.js.map +0 -7
- package/dist/esm/components/DSComments.js +0 -10
- package/dist/esm/components/DSComments.js.map +0 -7
- package/dist/esm/components/blocks.js +0 -46
- package/dist/esm/components/blocks.js.map +0 -7
- package/dist/esm/components/helper.js +0 -17
- package/dist/esm/components/helper.js.map +0 -7
- package/dist/esm/index.js +0 -10
- package/dist/esm/index.js.map +0 -7
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
var react = require('react');
|
|
13
|
+
var reactDesc = require('react-desc');
|
|
14
|
+
var DSButton = require('@elliemae/ds-button');
|
|
15
|
+
var dsReadMore = require('@elliemae/ds-read-more');
|
|
16
|
+
var DSDropdownMenu = require('@elliemae/ds-dropdownmenu');
|
|
17
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
18
|
+
var blocks = require('./blocks.js');
|
|
19
|
+
var helper = require('./helper.js');
|
|
20
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
21
|
+
|
|
22
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
+
|
|
24
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
25
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
|
+
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
27
|
+
var DSDropdownMenu__default = /*#__PURE__*/_interopDefaultLegacy(DSDropdownMenu);
|
|
28
|
+
|
|
29
|
+
var _span, _span2, _MoreOptionsVert;
|
|
30
|
+
|
|
31
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
32
|
+
|
|
33
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
34
|
+
|
|
35
|
+
const CommentCard = _ref => {
|
|
36
|
+
let {
|
|
37
|
+
containerProps = {},
|
|
38
|
+
name = '',
|
|
39
|
+
date = new Date(),
|
|
40
|
+
type = '',
|
|
41
|
+
content = '',
|
|
42
|
+
style = {},
|
|
43
|
+
options = [],
|
|
44
|
+
selection = {
|
|
45
|
+
'single-selection-internal-external': ['set-as-internal']
|
|
46
|
+
},
|
|
47
|
+
customDropdownMenuProps = {
|
|
48
|
+
focusOnOpen: true
|
|
49
|
+
},
|
|
50
|
+
borderBottom,
|
|
51
|
+
dateFormat = 'MM/DD/YYYY',
|
|
52
|
+
timeFormat = 'hh:mm a',
|
|
53
|
+
maxLines = 2
|
|
54
|
+
} = _ref;
|
|
55
|
+
const ref = react.useRef();
|
|
56
|
+
const displayDate = date ? helper.getDisplayDate(date, dateFormat) : null;
|
|
57
|
+
const displayTime = date ? helper.getTime(date, timeFormat) : null;
|
|
58
|
+
const handleCloseMenu = react.useCallback(() => {
|
|
59
|
+
ref.current.focus();
|
|
60
|
+
}, []);
|
|
61
|
+
return /*#__PURE__*/jsxRuntime.jsxs(blocks.CommentCardWrapper, _objectSpread(_objectSpread({
|
|
62
|
+
classProps: {
|
|
63
|
+
borderBottom
|
|
64
|
+
},
|
|
65
|
+
tabIndex: 0
|
|
66
|
+
}, containerProps), {}, {
|
|
67
|
+
style: _objectSpread(_objectSpread({}, style), containerProps.style || {}),
|
|
68
|
+
children: [/*#__PURE__*/_jsx__default["default"](blocks.CommentCardHeader, {
|
|
69
|
+
classProps: {
|
|
70
|
+
borderBottom
|
|
71
|
+
}
|
|
72
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](blocks.CommentCardLeft, {}, void 0, /*#__PURE__*/_jsx__default["default"](blocks.CommentCardName, {}, void 0, name), /*#__PURE__*/_jsx__default["default"](blocks.CommentCardData, {}, void 0, displayDate, displayTime && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
73
|
+
children: [_span || (_span = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, "\u2022")), displayTime]
|
|
74
|
+
}), type && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
75
|
+
children: [_span2 || (_span2 = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, "\u2022")), type]
|
|
76
|
+
}))), options && options.length > 0 && /*#__PURE__*/_jsx__default["default"](blocks.CommentCardMenu, {}, void 0, /*#__PURE__*/jsxRuntime.jsx(DSDropdownMenu__default["default"], _objectSpread(_objectSpread({}, customDropdownMenuProps), {}, {
|
|
77
|
+
onClose: handleCloseMenu,
|
|
78
|
+
options: options,
|
|
79
|
+
selection: selection,
|
|
80
|
+
triggerComponent: /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
81
|
+
buttonType: "text",
|
|
82
|
+
icon: _MoreOptionsVert || (_MoreOptionsVert = /*#__PURE__*/_jsx__default["default"](dsIcons.MoreOptionsVert, {})),
|
|
83
|
+
innerRef: ref
|
|
84
|
+
}),
|
|
85
|
+
zIndex: "11" // https://jira.elliemae.io/browse/PUI-1664
|
|
86
|
+
|
|
87
|
+
})))), /*#__PURE__*/_jsx__default["default"](blocks.CommentCardContent, {}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, /*#__PURE__*/_jsx__default["default"](dsReadMore.DSReadMore, {
|
|
88
|
+
lines: maxLines,
|
|
89
|
+
content: "".concat(content, " "),
|
|
90
|
+
more: "MORE",
|
|
91
|
+
less: "LESS",
|
|
92
|
+
buttonType: "text",
|
|
93
|
+
size: "m",
|
|
94
|
+
ellipsis: "... "
|
|
95
|
+
})))]
|
|
96
|
+
}));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const props = {
|
|
100
|
+
/** props to inject to comment card wrapper */
|
|
101
|
+
containerProps: reactDesc.PropTypes.shape({
|
|
102
|
+
id: reactDesc.PropTypes.string,
|
|
103
|
+
'data-testid': reactDesc.PropTypes.string
|
|
104
|
+
}).description('props to inject to comment card wrapper'),
|
|
105
|
+
|
|
106
|
+
/** form name */
|
|
107
|
+
name: reactDesc.PropTypes.string.description('form name'),
|
|
108
|
+
|
|
109
|
+
/** style object */
|
|
110
|
+
style: reactDesc.PropTypes.object.description(' style object '),
|
|
111
|
+
|
|
112
|
+
/** date object */
|
|
113
|
+
date: reactDesc.PropTypes.instanceOf(Date).description('date object'),
|
|
114
|
+
|
|
115
|
+
/** comment type string */
|
|
116
|
+
type: reactDesc.PropTypes.string.description('comment type string'),
|
|
117
|
+
|
|
118
|
+
/** comment content */
|
|
119
|
+
content: reactDesc.PropTypes.string.description('comment content'),
|
|
120
|
+
|
|
121
|
+
/** dropdown menu options */
|
|
122
|
+
options: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.object).description('dropdown menu options'),
|
|
123
|
+
|
|
124
|
+
/** dropdown selection */
|
|
125
|
+
selection: reactDesc.PropTypes.object.description('dropdown selection'),
|
|
126
|
+
|
|
127
|
+
/** pass down props to dropdown */
|
|
128
|
+
customDropdownMenuProps: reactDesc.PropTypes.shape({
|
|
129
|
+
focusOnOpen: reactDesc.PropTypes.bool
|
|
130
|
+
}).description('pass down props to dropdown'),
|
|
131
|
+
|
|
132
|
+
/** toggle border bottom for card */
|
|
133
|
+
borderBottom: reactDesc.PropTypes.bool.description('toggle border bottom for card'),
|
|
134
|
+
|
|
135
|
+
/** moment Year, month, and day tokens https://momentjs.com/docs/#/parsing/string-format/ */
|
|
136
|
+
dateFormat: reactDesc.PropTypes.oneOf(['MM/DD/YYYY', 'MM DD YYYY']).description('moment Year, month, and day tokens https://momentjs.com/docs/#/parsing/string-format/'),
|
|
137
|
+
|
|
138
|
+
/** moment Hour, minute, second, millisecond, and offset tokens https://momentjs.com/docs/#/parsing/string-format/ */
|
|
139
|
+
timeFormat: reactDesc.PropTypes.oneOf(['hh:mm a', 'HH:mm']).description('moment Hour, minute, second, millisecond, and offset tokens https://momentjs.com/docs/#/parsing/string-format/'),
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Max lines
|
|
143
|
+
*/
|
|
144
|
+
maxLines: reactDesc.PropTypes.number.description('Max lines')
|
|
145
|
+
};
|
|
146
|
+
const DSCommentCardWithSchema = reactDesc.describe(CommentCard);
|
|
147
|
+
DSCommentCardWithSchema.propTypes = props;
|
|
148
|
+
|
|
149
|
+
exports.DSCommentCardWithSchema = DSCommentCardWithSchema;
|
|
150
|
+
exports["default"] = CommentCard;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var CommentCard = require('./CommentCard.js');
|
|
6
|
+
|
|
7
|
+
var DSComments = {
|
|
8
|
+
DSCommentCard: CommentCard["default"]
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.DSCommentCardWithSchema = CommentCard.DSCommentCardWithSchema;
|
|
12
|
+
exports["default"] = DSComments;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dsClassnames = require('@elliemae/ds-classnames');
|
|
6
|
+
|
|
7
|
+
const blockName = 'comments';
|
|
8
|
+
const WrapperArea = dsClassnames.aggregatedClasses('div')(blockName, 'area', () => ({}));
|
|
9
|
+
const WrapperComments = dsClassnames.aggregatedClasses('div')(blockName, 'comments', _ref => {
|
|
10
|
+
let {
|
|
11
|
+
hasScroll
|
|
12
|
+
} = _ref;
|
|
13
|
+
return {
|
|
14
|
+
hasScroll,
|
|
15
|
+
'not-scroll': !hasScroll
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
const WrapperCommentsScroll = dsClassnames.aggregatedClasses('div')(blockName, 'comments-scroll', _ref2 => {
|
|
19
|
+
let {
|
|
20
|
+
hasScroll
|
|
21
|
+
} = _ref2;
|
|
22
|
+
return {
|
|
23
|
+
hasScroll,
|
|
24
|
+
'not-scroll': !hasScroll
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
const Counter = dsClassnames.aggregatedClasses('div')(blockName, 'counter', () => ({}));
|
|
28
|
+
const SubmitWrapper = dsClassnames.aggregatedClasses('div')(blockName, 'submit-wrapper', () => ({}));
|
|
29
|
+
const SubmitExternal = dsClassnames.aggregatedClasses('div')(blockName, 'submit-external', () => ({}));
|
|
30
|
+
const SubmitButton = dsClassnames.aggregatedClasses('div')(blockName, 'submit-btn', () => ({}));
|
|
31
|
+
const CommentCardWrapper = dsClassnames.aggregatedClasses('div')(blockName, 'comment-card-wrapper', _ref3 => {
|
|
32
|
+
let {
|
|
33
|
+
borderBottom
|
|
34
|
+
} = _ref3;
|
|
35
|
+
return {
|
|
36
|
+
borderBottom
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
const CommentCardHeader = dsClassnames.aggregatedClasses('div')(blockName, 'comment-card-header', _ref4 => {
|
|
40
|
+
let {
|
|
41
|
+
borderBottom
|
|
42
|
+
} = _ref4;
|
|
43
|
+
return {
|
|
44
|
+
borderBottom
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const CommentCardContent = dsClassnames.aggregatedClasses('div')(blockName, 'comment-card-content', () => ({}));
|
|
48
|
+
const CommentCardLeft = dsClassnames.aggregatedClasses('div')(blockName, 'comment-card-left', () => ({}));
|
|
49
|
+
const CommentCardName = dsClassnames.aggregatedClasses('div')(blockName, 'comment-card-name', () => ({}));
|
|
50
|
+
const CommentCardData = dsClassnames.aggregatedClasses('div')(blockName, 'comment-card-data', () => ({}));
|
|
51
|
+
const CommentCardMenu = dsClassnames.aggregatedClasses('div')(blockName, 'comment-card-menu', () => ({}));
|
|
52
|
+
const CommentEmptyWrapper = dsClassnames.aggregatedClasses('div')(blockName, 'comment-empty', () => ({}));
|
|
53
|
+
const CommentEmptyIcon = dsClassnames.aggregatedClasses('div')(blockName, 'comment-empty-icon', () => ({}));
|
|
54
|
+
const CommentEmptyLabel = dsClassnames.aggregatedClasses('div')(blockName, 'comment-empty-label', () => ({}));
|
|
55
|
+
|
|
56
|
+
exports.CommentCardContent = CommentCardContent;
|
|
57
|
+
exports.CommentCardData = CommentCardData;
|
|
58
|
+
exports.CommentCardHeader = CommentCardHeader;
|
|
59
|
+
exports.CommentCardLeft = CommentCardLeft;
|
|
60
|
+
exports.CommentCardMenu = CommentCardMenu;
|
|
61
|
+
exports.CommentCardName = CommentCardName;
|
|
62
|
+
exports.CommentCardWrapper = CommentCardWrapper;
|
|
63
|
+
exports.CommentEmptyIcon = CommentEmptyIcon;
|
|
64
|
+
exports.CommentEmptyLabel = CommentEmptyLabel;
|
|
65
|
+
exports.CommentEmptyWrapper = CommentEmptyWrapper;
|
|
66
|
+
exports.Counter = Counter;
|
|
67
|
+
exports.SubmitButton = SubmitButton;
|
|
68
|
+
exports.SubmitExternal = SubmitExternal;
|
|
69
|
+
exports.SubmitWrapper = SubmitWrapper;
|
|
70
|
+
exports.WrapperArea = WrapperArea;
|
|
71
|
+
exports.WrapperComments = WrapperComments;
|
|
72
|
+
exports.WrapperCommentsScroll = WrapperCommentsScroll;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var moment = require('moment');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
10
|
+
|
|
11
|
+
function getMaxSize() {
|
|
12
|
+
return 113;
|
|
13
|
+
}
|
|
14
|
+
function getTime(date) {
|
|
15
|
+
let formatString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'hh:mm a';
|
|
16
|
+
return moment__default["default"](date).format(formatString);
|
|
17
|
+
}
|
|
18
|
+
function getDisplayDate(date) {
|
|
19
|
+
let formatString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'MM/DD/YYYY';
|
|
20
|
+
return moment__default["default"](date).format(formatString);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.getDisplayDate = getDisplayDate;
|
|
24
|
+
exports.getMaxSize = getMaxSize;
|
|
25
|
+
exports.getTime = getTime;
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var DSComments = require('./components/DSComments.js');
|
|
6
|
+
var CommentCard = require('./components/CommentCard.js');
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
DSCommentCard
|
|
10
|
+
} = DSComments["default"];
|
|
11
|
+
|
|
12
|
+
exports.DSCommentCardWithSchema = CommentCard.DSCommentCardWithSchema;
|
|
13
|
+
exports.DSCommentCard = DSCommentCard;
|
|
14
|
+
exports["default"] = DSCommentCard;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import { useRef, useCallback } from 'react';
|
|
9
|
+
import { PropTypes, describe } from 'react-desc';
|
|
10
|
+
import DSButton from '@elliemae/ds-button';
|
|
11
|
+
import { DSReadMore } from '@elliemae/ds-read-more';
|
|
12
|
+
import DSDropdownMenu from '@elliemae/ds-dropdownmenu';
|
|
13
|
+
import { MoreOptionsVert } from '@elliemae/ds-icons';
|
|
14
|
+
import { CommentCardWrapper, CommentCardHeader, CommentCardLeft, CommentCardName, CommentCardData, CommentCardMenu, CommentCardContent } from './blocks.js';
|
|
15
|
+
import { getDisplayDate, getTime } from './helper.js';
|
|
16
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
17
|
+
|
|
18
|
+
var _span, _span2, _MoreOptionsVert;
|
|
19
|
+
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
|
|
24
|
+
const CommentCard = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
containerProps = {},
|
|
27
|
+
name = '',
|
|
28
|
+
date = new Date(),
|
|
29
|
+
type = '',
|
|
30
|
+
content = '',
|
|
31
|
+
style = {},
|
|
32
|
+
options = [],
|
|
33
|
+
selection = {
|
|
34
|
+
'single-selection-internal-external': ['set-as-internal']
|
|
35
|
+
},
|
|
36
|
+
customDropdownMenuProps = {
|
|
37
|
+
focusOnOpen: true
|
|
38
|
+
},
|
|
39
|
+
borderBottom,
|
|
40
|
+
dateFormat = 'MM/DD/YYYY',
|
|
41
|
+
timeFormat = 'hh:mm a',
|
|
42
|
+
maxLines = 2
|
|
43
|
+
} = _ref;
|
|
44
|
+
const ref = useRef();
|
|
45
|
+
const displayDate = date ? getDisplayDate(date, dateFormat) : null;
|
|
46
|
+
const displayTime = date ? getTime(date, timeFormat) : null;
|
|
47
|
+
const handleCloseMenu = useCallback(() => {
|
|
48
|
+
ref.current.focus();
|
|
49
|
+
}, []);
|
|
50
|
+
return /*#__PURE__*/jsxs(CommentCardWrapper, _objectSpread(_objectSpread({
|
|
51
|
+
classProps: {
|
|
52
|
+
borderBottom
|
|
53
|
+
},
|
|
54
|
+
tabIndex: 0
|
|
55
|
+
}, containerProps), {}, {
|
|
56
|
+
style: _objectSpread(_objectSpread({}, style), containerProps.style || {}),
|
|
57
|
+
children: [/*#__PURE__*/_jsx(CommentCardHeader, {
|
|
58
|
+
classProps: {
|
|
59
|
+
borderBottom
|
|
60
|
+
}
|
|
61
|
+
}, void 0, /*#__PURE__*/_jsx(CommentCardLeft, {}, void 0, /*#__PURE__*/_jsx(CommentCardName, {}, void 0, name), /*#__PURE__*/_jsx(CommentCardData, {}, void 0, displayDate, displayTime && /*#__PURE__*/jsxs(Fragment, {
|
|
62
|
+
children: [_span || (_span = /*#__PURE__*/_jsx("span", {}, void 0, "\u2022")), displayTime]
|
|
63
|
+
}), type && /*#__PURE__*/jsxs(Fragment, {
|
|
64
|
+
children: [_span2 || (_span2 = /*#__PURE__*/_jsx("span", {}, void 0, "\u2022")), type]
|
|
65
|
+
}))), options && options.length > 0 && /*#__PURE__*/_jsx(CommentCardMenu, {}, void 0, /*#__PURE__*/jsx(DSDropdownMenu, _objectSpread(_objectSpread({}, customDropdownMenuProps), {}, {
|
|
66
|
+
onClose: handleCloseMenu,
|
|
67
|
+
options: options,
|
|
68
|
+
selection: selection,
|
|
69
|
+
triggerComponent: /*#__PURE__*/_jsx(DSButton, {
|
|
70
|
+
buttonType: "text",
|
|
71
|
+
icon: _MoreOptionsVert || (_MoreOptionsVert = /*#__PURE__*/_jsx(MoreOptionsVert, {})),
|
|
72
|
+
innerRef: ref
|
|
73
|
+
}),
|
|
74
|
+
zIndex: "11" // https://jira.elliemae.io/browse/PUI-1664
|
|
75
|
+
|
|
76
|
+
})))), /*#__PURE__*/_jsx(CommentCardContent, {}, void 0, /*#__PURE__*/_jsx("div", {}, void 0, /*#__PURE__*/_jsx(DSReadMore, {
|
|
77
|
+
lines: maxLines,
|
|
78
|
+
content: "".concat(content, " "),
|
|
79
|
+
more: "MORE",
|
|
80
|
+
less: "LESS",
|
|
81
|
+
buttonType: "text",
|
|
82
|
+
size: "m",
|
|
83
|
+
ellipsis: "... "
|
|
84
|
+
})))]
|
|
85
|
+
}));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const props = {
|
|
89
|
+
/** props to inject to comment card wrapper */
|
|
90
|
+
containerProps: PropTypes.shape({
|
|
91
|
+
id: PropTypes.string,
|
|
92
|
+
'data-testid': PropTypes.string
|
|
93
|
+
}).description('props to inject to comment card wrapper'),
|
|
94
|
+
|
|
95
|
+
/** form name */
|
|
96
|
+
name: PropTypes.string.description('form name'),
|
|
97
|
+
|
|
98
|
+
/** style object */
|
|
99
|
+
style: PropTypes.object.description(' style object '),
|
|
100
|
+
|
|
101
|
+
/** date object */
|
|
102
|
+
date: PropTypes.instanceOf(Date).description('date object'),
|
|
103
|
+
|
|
104
|
+
/** comment type string */
|
|
105
|
+
type: PropTypes.string.description('comment type string'),
|
|
106
|
+
|
|
107
|
+
/** comment content */
|
|
108
|
+
content: PropTypes.string.description('comment content'),
|
|
109
|
+
|
|
110
|
+
/** dropdown menu options */
|
|
111
|
+
options: PropTypes.arrayOf(PropTypes.object).description('dropdown menu options'),
|
|
112
|
+
|
|
113
|
+
/** dropdown selection */
|
|
114
|
+
selection: PropTypes.object.description('dropdown selection'),
|
|
115
|
+
|
|
116
|
+
/** pass down props to dropdown */
|
|
117
|
+
customDropdownMenuProps: PropTypes.shape({
|
|
118
|
+
focusOnOpen: PropTypes.bool
|
|
119
|
+
}).description('pass down props to dropdown'),
|
|
120
|
+
|
|
121
|
+
/** toggle border bottom for card */
|
|
122
|
+
borderBottom: PropTypes.bool.description('toggle border bottom for card'),
|
|
123
|
+
|
|
124
|
+
/** moment Year, month, and day tokens https://momentjs.com/docs/#/parsing/string-format/ */
|
|
125
|
+
dateFormat: PropTypes.oneOf(['MM/DD/YYYY', 'MM DD YYYY']).description('moment Year, month, and day tokens https://momentjs.com/docs/#/parsing/string-format/'),
|
|
126
|
+
|
|
127
|
+
/** moment Hour, minute, second, millisecond, and offset tokens https://momentjs.com/docs/#/parsing/string-format/ */
|
|
128
|
+
timeFormat: PropTypes.oneOf(['hh:mm a', 'HH:mm']).description('moment Hour, minute, second, millisecond, and offset tokens https://momentjs.com/docs/#/parsing/string-format/'),
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Max lines
|
|
132
|
+
*/
|
|
133
|
+
maxLines: PropTypes.number.description('Max lines')
|
|
134
|
+
};
|
|
135
|
+
const DSCommentCardWithSchema = describe(CommentCard);
|
|
136
|
+
DSCommentCardWithSchema.propTypes = props;
|
|
137
|
+
|
|
138
|
+
export { DSCommentCardWithSchema, CommentCard as default };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
2
|
+
|
|
3
|
+
const blockName = 'comments';
|
|
4
|
+
const WrapperArea = aggregatedClasses('div')(blockName, 'area', () => ({}));
|
|
5
|
+
const WrapperComments = aggregatedClasses('div')(blockName, 'comments', _ref => {
|
|
6
|
+
let {
|
|
7
|
+
hasScroll
|
|
8
|
+
} = _ref;
|
|
9
|
+
return {
|
|
10
|
+
hasScroll,
|
|
11
|
+
'not-scroll': !hasScroll
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
const WrapperCommentsScroll = aggregatedClasses('div')(blockName, 'comments-scroll', _ref2 => {
|
|
15
|
+
let {
|
|
16
|
+
hasScroll
|
|
17
|
+
} = _ref2;
|
|
18
|
+
return {
|
|
19
|
+
hasScroll,
|
|
20
|
+
'not-scroll': !hasScroll
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
const Counter = aggregatedClasses('div')(blockName, 'counter', () => ({}));
|
|
24
|
+
const SubmitWrapper = aggregatedClasses('div')(blockName, 'submit-wrapper', () => ({}));
|
|
25
|
+
const SubmitExternal = aggregatedClasses('div')(blockName, 'submit-external', () => ({}));
|
|
26
|
+
const SubmitButton = aggregatedClasses('div')(blockName, 'submit-btn', () => ({}));
|
|
27
|
+
const CommentCardWrapper = aggregatedClasses('div')(blockName, 'comment-card-wrapper', _ref3 => {
|
|
28
|
+
let {
|
|
29
|
+
borderBottom
|
|
30
|
+
} = _ref3;
|
|
31
|
+
return {
|
|
32
|
+
borderBottom
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
const CommentCardHeader = aggregatedClasses('div')(blockName, 'comment-card-header', _ref4 => {
|
|
36
|
+
let {
|
|
37
|
+
borderBottom
|
|
38
|
+
} = _ref4;
|
|
39
|
+
return {
|
|
40
|
+
borderBottom
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
const CommentCardContent = aggregatedClasses('div')(blockName, 'comment-card-content', () => ({}));
|
|
44
|
+
const CommentCardLeft = aggregatedClasses('div')(blockName, 'comment-card-left', () => ({}));
|
|
45
|
+
const CommentCardName = aggregatedClasses('div')(blockName, 'comment-card-name', () => ({}));
|
|
46
|
+
const CommentCardData = aggregatedClasses('div')(blockName, 'comment-card-data', () => ({}));
|
|
47
|
+
const CommentCardMenu = aggregatedClasses('div')(blockName, 'comment-card-menu', () => ({}));
|
|
48
|
+
const CommentEmptyWrapper = aggregatedClasses('div')(blockName, 'comment-empty', () => ({}));
|
|
49
|
+
const CommentEmptyIcon = aggregatedClasses('div')(blockName, 'comment-empty-icon', () => ({}));
|
|
50
|
+
const CommentEmptyLabel = aggregatedClasses('div')(blockName, 'comment-empty-label', () => ({}));
|
|
51
|
+
|
|
52
|
+
export { CommentCardContent, CommentCardData, CommentCardHeader, CommentCardLeft, CommentCardMenu, CommentCardName, CommentCardWrapper, CommentEmptyIcon, CommentEmptyLabel, CommentEmptyWrapper, Counter, SubmitButton, SubmitExternal, SubmitWrapper, WrapperArea, WrapperComments, WrapperCommentsScroll };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
|
|
3
|
+
function getMaxSize() {
|
|
4
|
+
return 113;
|
|
5
|
+
}
|
|
6
|
+
function getTime(date) {
|
|
7
|
+
let formatString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'hh:mm a';
|
|
8
|
+
return moment(date).format(formatString);
|
|
9
|
+
}
|
|
10
|
+
function getDisplayDate(date) {
|
|
11
|
+
let formatString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'MM/DD/YYYY';
|
|
12
|
+
return moment(date).format(formatString);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { getDisplayDate, getMaxSize, getTime };
|
package/esm/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-comments",
|
|
3
|
-
"version": "2.3.0-
|
|
3
|
+
"version": "2.3.0-next.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Comments",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"module": "./dist/esm/index.js",
|
|
10
|
-
"main": "./dist/cjs/index.js",
|
|
11
|
-
"types": "./dist/types/index.d.ts",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"main": "./cjs/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
12
9
|
"exports": {
|
|
13
10
|
".": {
|
|
14
|
-
"import": "./
|
|
15
|
-
"require": "./
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"require": "./cjs/index.js"
|
|
16
13
|
},
|
|
17
14
|
"./components/helper": {
|
|
18
|
-
"import": "./
|
|
19
|
-
"require": "./
|
|
15
|
+
"import": "./esm/components/helper.js",
|
|
16
|
+
"require": "./cjs/components/helper.js"
|
|
20
17
|
},
|
|
21
18
|
"./components/DSComments": {
|
|
22
|
-
"import": "./
|
|
23
|
-
"require": "./
|
|
19
|
+
"import": "./esm/components/DSComments.js",
|
|
20
|
+
"require": "./cjs/components/DSComments.js"
|
|
24
21
|
},
|
|
25
22
|
"./components/CommentCard": {
|
|
26
|
-
"import": "./
|
|
27
|
-
"require": "./
|
|
23
|
+
"import": "./esm/components/CommentCard.js",
|
|
24
|
+
"require": "./cjs/components/CommentCard.js"
|
|
28
25
|
},
|
|
29
26
|
"./components/blocks": {
|
|
30
|
-
"import": "./
|
|
31
|
-
"require": "./
|
|
27
|
+
"import": "./esm/components/blocks.js",
|
|
28
|
+
"require": "./cjs/components/blocks.js"
|
|
32
29
|
}
|
|
33
30
|
},
|
|
34
31
|
"sideEffects": [
|
|
@@ -40,16 +37,22 @@
|
|
|
40
37
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
41
38
|
},
|
|
42
39
|
"engines": {
|
|
43
|
-
"
|
|
44
|
-
"node": ">=
|
|
40
|
+
"npm": ">=7",
|
|
41
|
+
"node": ">=14"
|
|
45
42
|
},
|
|
46
43
|
"author": "ICE MT",
|
|
44
|
+
"scripts": {
|
|
45
|
+
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
46
|
+
"prebuild": "exit 0",
|
|
47
|
+
"predev": "exit 0",
|
|
48
|
+
"build": "node ../../scripts/build/build.js"
|
|
49
|
+
},
|
|
47
50
|
"dependencies": {
|
|
48
|
-
"@elliemae/ds-button": "2.3.0-
|
|
49
|
-
"@elliemae/ds-classnames": "2.3.0-
|
|
50
|
-
"@elliemae/ds-dropdownmenu": "2.3.0-
|
|
51
|
-
"@elliemae/ds-icons": "2.3.0-
|
|
52
|
-
"@elliemae/ds-read-more": "2.3.0-
|
|
51
|
+
"@elliemae/ds-button": "2.3.0-next.3",
|
|
52
|
+
"@elliemae/ds-classnames": "2.3.0-next.3",
|
|
53
|
+
"@elliemae/ds-dropdownmenu": "2.3.0-next.3",
|
|
54
|
+
"@elliemae/ds-icons": "2.3.0-next.3",
|
|
55
|
+
"@elliemae/ds-read-more": "2.3.0-next.3",
|
|
53
56
|
"moment": "~2.29.1",
|
|
54
57
|
"prop-types": "~15.7.2",
|
|
55
58
|
"react-desc": "~4.1.3"
|
|
@@ -65,12 +68,7 @@
|
|
|
65
68
|
},
|
|
66
69
|
"publishConfig": {
|
|
67
70
|
"access": "public",
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
"scripts": {
|
|
71
|
-
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
72
|
-
"prebuild": "exit 0",
|
|
73
|
-
"predev": "exit 0",
|
|
74
|
-
"build": "node ../../scripts/build/build.js"
|
|
71
|
+
"directory": "dist",
|
|
72
|
+
"generateSubmodules": true
|
|
75
73
|
}
|
|
76
74
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|