@sproutsocial/racine 23.2.1 → 24.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/CHANGELOG.md +37 -0
- package/__flow__/Avatar/Avatar.flow.js +0 -2
- package/commonjs/Avatar/Avatar.js +11 -17
- package/commonjs/Duration/Duration.js +129 -0
- package/commonjs/Duration/DurationTypes.js +5 -0
- package/commonjs/Duration/constants.js +8 -0
- package/commonjs/Duration/index.js +39 -0
- package/commonjs/Duration/styles.js +13 -0
- package/commonjs/Message/styles.js +1 -3
- package/commonjs/index.js +12 -0
- package/dist/types/Avatar/Avatar.d.ts +2 -2
- package/dist/types/Avatar/Avatar.d.ts.map +1 -1
- package/dist/types/Avatar/AvatarTypes.d.ts +5 -10
- package/dist/types/Avatar/AvatarTypes.d.ts.map +1 -1
- package/dist/types/Duration/Duration.d.ts +6 -0
- package/dist/types/Duration/Duration.d.ts.map +1 -0
- package/dist/types/Duration/DurationTypes.d.ts +14 -0
- package/dist/types/Duration/DurationTypes.d.ts.map +1 -0
- package/dist/types/Duration/__tests__/Duration.typetest.d.ts +2 -0
- package/dist/types/Duration/__tests__/Duration.typetest.d.ts.map +1 -0
- package/dist/types/Duration/__tests__/features/testDuration.d.ts +3 -0
- package/dist/types/Duration/__tests__/features/testDuration.d.ts.map +1 -0
- package/dist/types/Duration/constants.d.ts +3 -0
- package/dist/types/Duration/constants.d.ts.map +1 -0
- package/dist/types/Duration/index.d.ts +6 -0
- package/dist/types/Duration/index.d.ts.map +1 -0
- package/dist/types/Duration/styles.d.ts +11 -0
- package/dist/types/Duration/styles.d.ts.map +1 -0
- package/dist/types/Message/styles.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/lib/Avatar/Avatar.js +11 -17
- package/lib/Duration/Duration.js +122 -0
- package/lib/Duration/DurationTypes.js +1 -0
- package/lib/Duration/constants.js +2 -0
- package/lib/Duration/index.js +5 -0
- package/lib/Duration/styles.js +6 -0
- package/lib/Message/styles.js +1 -3
- package/lib/index.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 24.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 25d94a2: Racine now includes a new Duration component. It is a primitive component used to format durations of time according to our date & time formatting guidelines Additionally, the package includes a formatDuration helper, which can be used to get a stringified version of a duration.
|
|
8
|
+
- bd3fc39: ### Deprecation Notice: Flow Type System
|
|
9
|
+
|
|
10
|
+
We are officially deprecating the use of the Flow type system in `@sproutsocial/racine`. This change affects all Flow types used in this library. Flow support will be discontinued entirely on **October 24th**.
|
|
11
|
+
|
|
12
|
+
To ensure a smooth transition, please migrate your projects away from Flow types and start using TypeScript as soon as possible.
|
|
13
|
+
|
|
14
|
+
If you have any questions or need assistance, feel free to reach out to the team.
|
|
15
|
+
|
|
16
|
+
Thank you for your understanding and cooperation as we work towards improving our codebase.
|
|
17
|
+
|
|
18
|
+
## 24.0.0
|
|
19
|
+
|
|
20
|
+
### Major Changes
|
|
21
|
+
|
|
22
|
+
- e8cb094: Remove negative margin in Message.Footer to allow web-app-core to control this style.
|
|
23
|
+
- 7e82fee: Removes deprecated `variant` prop from Avatar
|
|
24
|
+
- The `variant` prop has been deprecated for over a year, and is no longer necessary due to built-in theme support in the Avatar component.
|
|
25
|
+
- This change removes all references to the `variant` prop from the Avatar component and its documentation.
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- 7e82fee: Adds `initials` prop to Avatar
|
|
30
|
+
- The new prop allows consumers to manually define the initials displayed on the Avatar component when an image is not provided or fails to load.
|
|
31
|
+
- The existing automatic initials generation (which uses the first character of the first 1-2 words of the `name` prop) will still be used if an `initials` prop is not provided.
|
|
32
|
+
- Also adds test cases for the new prop to ensure it functions as expected.
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 7e82fee: Removes background color while Avatar image is loading
|
|
37
|
+
- Before this change, an Avatar's background color would briefly appear while an Image-based Avatar was loading.
|
|
38
|
+
- After this change, an Avatar will not have its background color set until the image has failed to load, or if no `src` prop is provided.
|
|
39
|
+
|
|
3
40
|
## 23.2.1
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
|
@@ -8,8 +8,6 @@ export type TypeAvatarProps = {
|
|
|
8
8
|
/** URL of the avatar image. If a URL is not provided, the component will fall back to showing the user's initials */
|
|
9
9
|
src?: string,
|
|
10
10
|
type?: "neutral" | "purple" | "green" | "blue" | "yellow" | "red" | "orange",
|
|
11
|
-
/** @deprecated Avatar now uses the theme by default and using `variant` is no longer needed */
|
|
12
|
-
variant?: "dark" | "light",
|
|
13
11
|
bg?: string,
|
|
14
12
|
color?: string,
|
|
15
13
|
size?: string,
|
|
@@ -8,13 +8,12 @@ exports.getAvatarColor = exports.default = exports.Avatar = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var React = _react;
|
|
10
10
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
11
|
var _Box = _interopRequireDefault(require("../Box"));
|
|
13
12
|
var _Image = _interopRequireDefault(require("../Image"));
|
|
14
13
|
var _Text = _interopRequireDefault(require("../Text"));
|
|
15
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
15
|
var _excluded = ["fontSize"],
|
|
17
|
-
_excluded2 = ["appearance", "name", "src", "
|
|
16
|
+
_excluded2 = ["appearance", "name", "src", "type", "size", "bg", "color", "initials"];
|
|
18
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
18
|
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); }
|
|
20
19
|
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 && Object.prototype.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; }
|
|
@@ -54,12 +53,11 @@ var Container = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
|
54
53
|
componentId: "sc-1ffu253-1"
|
|
55
54
|
})(["", ""], function (_ref3) {
|
|
56
55
|
var theme = _ref3.theme,
|
|
57
|
-
type = _ref3
|
|
56
|
+
$type = _ref3.$type,
|
|
58
57
|
bg = _ref3.bg,
|
|
59
|
-
$src = _ref3.$src,
|
|
60
58
|
borderColor = _ref3.borderColor,
|
|
61
|
-
|
|
62
|
-
return (0, _styledComponents.css)(["background:", ";border:", ";border-color:", ";color:", ";"], bg ? bg : theme.colors.container.background.decorative[type], $
|
|
59
|
+
$displayFallback = _ref3.$displayFallback;
|
|
60
|
+
return (0, _styledComponents.css)(["background:", ";border:", ";border-color:", ";color:", ";"], $displayFallback ? bg ? bg : theme.colors.container.background.decorative[$type] : "none", $displayFallback ? "1px solid" : "none", borderColor ? borderColor : theme.colors.container.border.decorative[$type], theme.colors.text.decorative[$type]);
|
|
63
61
|
});
|
|
64
62
|
var getInitials = function getInitials(name) {
|
|
65
63
|
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "?";
|
|
@@ -92,23 +90,22 @@ var Avatar = exports.Avatar = function Avatar(_ref4) {
|
|
|
92
90
|
_ref4$name = _ref4.name,
|
|
93
91
|
name = _ref4$name === void 0 ? "" : _ref4$name,
|
|
94
92
|
src = _ref4.src,
|
|
95
|
-
_ref4$variant = _ref4.variant,
|
|
96
|
-
variant = _ref4$variant === void 0 ? "light" : _ref4$variant,
|
|
97
93
|
_ref4$type = _ref4.type,
|
|
98
94
|
type = _ref4$type === void 0 ? defaultType : _ref4$type,
|
|
99
95
|
_ref4$size = _ref4.size,
|
|
100
96
|
size = _ref4$size === void 0 ? "40px" : _ref4$size,
|
|
101
97
|
bg = _ref4.bg,
|
|
102
98
|
color = _ref4.color,
|
|
99
|
+
initials = _ref4.initials,
|
|
103
100
|
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
104
101
|
var colorType = getAvatarColor(name, type);
|
|
105
102
|
var _useState = (0, _react.useState)(false),
|
|
106
103
|
_useState2 = _slicedToArray(_useState, 2),
|
|
107
104
|
imageFailedLoading = _useState2[0],
|
|
108
105
|
setImageFailedLoading = _useState2[1];
|
|
109
|
-
var
|
|
110
|
-
return getInitials(name);
|
|
111
|
-
}, [name]);
|
|
106
|
+
var displayInitials = (0, _react.useMemo)(function () {
|
|
107
|
+
return initials || getInitials(name);
|
|
108
|
+
}, [initials, name]);
|
|
112
109
|
var handleError = (0, _react.useCallback)(function () {
|
|
113
110
|
setImageFailedLoading(true);
|
|
114
111
|
}, [setImageFailedLoading]);
|
|
@@ -116,7 +113,6 @@ var Avatar = exports.Avatar = function Avatar(_ref4) {
|
|
|
116
113
|
// Font size for initials is half the size of the avatar, rounded down.
|
|
117
114
|
var fontSize = Math.floor(Number(size.replace("px", "")) * 0.4);
|
|
118
115
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, _objectSpread(_objectSpread({
|
|
119
|
-
className: (0, _classnames.default)(variant),
|
|
120
116
|
size: size,
|
|
121
117
|
overflow: "hidden",
|
|
122
118
|
borderRadius: appearance === "leaf" ? "40% 0 40% 0" : "50%",
|
|
@@ -127,11 +123,9 @@ var Avatar = exports.Avatar = function Avatar(_ref4) {
|
|
|
127
123
|
alignItems: "center",
|
|
128
124
|
title: name,
|
|
129
125
|
bg: bg,
|
|
130
|
-
|
|
131
|
-
type: colorType,
|
|
126
|
+
$type: colorType,
|
|
132
127
|
"data-qa-user-avatar": name,
|
|
133
|
-
$
|
|
134
|
-
imageFailedLoading: imageFailedLoading
|
|
128
|
+
$displayFallback: !src || imageFailedLoading
|
|
135
129
|
}, rest), {}, {
|
|
136
130
|
children: !src || imageFailedLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AvatarText, {
|
|
137
131
|
lineHeight: size,
|
|
@@ -139,7 +133,7 @@ var Avatar = exports.Avatar = function Avatar(_ref4) {
|
|
|
139
133
|
fontSize: fontSize,
|
|
140
134
|
type: colorType,
|
|
141
135
|
color: color,
|
|
142
|
-
children:
|
|
136
|
+
children: displayInitials
|
|
143
137
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.default, {
|
|
144
138
|
alt: name,
|
|
145
139
|
width: "auto",
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.formatDuration = exports.default = void 0;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _lruMemoize = _interopRequireDefault(require("lru-memoize"));
|
|
10
|
+
var _constants = require("../utils/constants");
|
|
11
|
+
var _VisuallyHidden = require("../VisuallyHidden");
|
|
12
|
+
var _constants2 = require("./constants");
|
|
13
|
+
var _styles = require("./styles");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
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); }
|
|
17
|
+
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 && Object.prototype.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; }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
24
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
26
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
27
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
28
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
+
var getDivisionAndRemainder = function getDivisionAndRemainder(numerator, denominator) {
|
|
30
|
+
return [Math.floor(numerator / denominator), numerator % denominator];
|
|
31
|
+
};
|
|
32
|
+
var _createDurationFormatter = function _createDurationFormatter(locale, unitDisplay) {
|
|
33
|
+
var timeUnitFormatter = function timeUnitFormatter(locale, unit, unitDisplay) {
|
|
34
|
+
return Intl.NumberFormat(locale, {
|
|
35
|
+
style: "unit",
|
|
36
|
+
unit: unit,
|
|
37
|
+
unitDisplay: unitDisplay
|
|
38
|
+
}).format;
|
|
39
|
+
};
|
|
40
|
+
var formatDays = timeUnitFormatter(locale, "day", unitDisplay);
|
|
41
|
+
var formatHours = timeUnitFormatter(locale, "hour", unitDisplay);
|
|
42
|
+
var formatMinutes = timeUnitFormatter(locale, "minute", unitDisplay);
|
|
43
|
+
var formatSeconds = timeUnitFormatter(locale, "second", unitDisplay);
|
|
44
|
+
var formatMilliseconds = timeUnitFormatter(locale, "millisecond", unitDisplay);
|
|
45
|
+
var formatList = new Intl.ListFormat(locale, {
|
|
46
|
+
style: "narrow",
|
|
47
|
+
type: "unit"
|
|
48
|
+
});
|
|
49
|
+
return function (milliseconds) {
|
|
50
|
+
if (milliseconds <= 0) {
|
|
51
|
+
return formatMilliseconds(0);
|
|
52
|
+
}
|
|
53
|
+
var days;
|
|
54
|
+
var hours;
|
|
55
|
+
var minutes;
|
|
56
|
+
var seconds;
|
|
57
|
+
var _getDivisionAndRemain = getDivisionAndRemainder(milliseconds, 86400000);
|
|
58
|
+
var _getDivisionAndRemain2 = _slicedToArray(_getDivisionAndRemain, 2);
|
|
59
|
+
days = _getDivisionAndRemain2[0];
|
|
60
|
+
milliseconds = _getDivisionAndRemain2[1];
|
|
61
|
+
var _getDivisionAndRemain3 = getDivisionAndRemainder(milliseconds, 3600000);
|
|
62
|
+
var _getDivisionAndRemain4 = _slicedToArray(_getDivisionAndRemain3, 2);
|
|
63
|
+
hours = _getDivisionAndRemain4[0];
|
|
64
|
+
milliseconds = _getDivisionAndRemain4[1];
|
|
65
|
+
var _getDivisionAndRemain5 = getDivisionAndRemainder(milliseconds, 60000);
|
|
66
|
+
var _getDivisionAndRemain6 = _slicedToArray(_getDivisionAndRemain5, 2);
|
|
67
|
+
minutes = _getDivisionAndRemain6[0];
|
|
68
|
+
milliseconds = _getDivisionAndRemain6[1];
|
|
69
|
+
var _getDivisionAndRemain7 = getDivisionAndRemainder(milliseconds, 1000);
|
|
70
|
+
var _getDivisionAndRemain8 = _slicedToArray(_getDivisionAndRemain7, 2);
|
|
71
|
+
seconds = _getDivisionAndRemain8[0];
|
|
72
|
+
milliseconds = _getDivisionAndRemain8[1];
|
|
73
|
+
var list = [days ? formatDays(days) : null, hours ? formatHours(hours) : null, minutes ? formatMinutes(minutes) : null, seconds ? formatSeconds(seconds) : null, milliseconds ? formatMilliseconds(milliseconds) : null].filter(function (listItem) {
|
|
74
|
+
return listItem !== null;
|
|
75
|
+
});
|
|
76
|
+
return formatList.format(list);
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Memoize to reduce the energy of creating new instances of Intl.NumberFormat
|
|
81
|
+
var memoizer = (0, _lruMemoize.default)(_constants2.MEMO_CACHE_SIZE, _constants2.COMPARE_OBJECTS);
|
|
82
|
+
var createDurationFormatter = memoizer(_createDurationFormatter);
|
|
83
|
+
var isValidNumber = function isValidNumber(value) {
|
|
84
|
+
return typeof value === "number" && isFinite(value);
|
|
85
|
+
};
|
|
86
|
+
var getDuration = function getDuration(_ref) {
|
|
87
|
+
var returnType = _ref.returnType,
|
|
88
|
+
props = _ref.props;
|
|
89
|
+
var _props$display = props.display,
|
|
90
|
+
display = _props$display === void 0 ? "long" : _props$display,
|
|
91
|
+
invalidMillisecondsLabel = props.invalidMillisecondsLabel,
|
|
92
|
+
_props$locale = props.locale,
|
|
93
|
+
locale = _props$locale === void 0 ? "en-US" : _props$locale,
|
|
94
|
+
_props$milliseconds = props.milliseconds,
|
|
95
|
+
milliseconds = _props$milliseconds === void 0 ? null : _props$milliseconds,
|
|
96
|
+
qa = props.qa;
|
|
97
|
+
var isReturnTypeString = returnType === "string";
|
|
98
|
+
if (!isValidNumber(milliseconds)) {
|
|
99
|
+
return isReturnTypeString ? _constants.EM_DASH : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
100
|
+
children: [invalidMillisecondsLabel ?
|
|
101
|
+
/*#__PURE__*/
|
|
102
|
+
// Give screen readers something useful to read off + hide the em dash
|
|
103
|
+
(0, _jsxRuntime.jsx)(_VisuallyHidden.VisuallyHidden, {
|
|
104
|
+
children: invalidMillisecondsLabel
|
|
105
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, _objectSpread(_objectSpread({
|
|
106
|
+
"aria-hidden": true
|
|
107
|
+
}, qa), {}, {
|
|
108
|
+
children: _constants.EM_DASH
|
|
109
|
+
}))]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
var fullText = createDurationFormatter(locale, display)(milliseconds);
|
|
113
|
+
return isReturnTypeString ? fullText : /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, _objectSpread(_objectSpread({}, qa), {}, {
|
|
114
|
+
children: fullText
|
|
115
|
+
}));
|
|
116
|
+
};
|
|
117
|
+
var formatDuration = exports.formatDuration = function formatDuration(props) {
|
|
118
|
+
return getDuration({
|
|
119
|
+
returnType: "string",
|
|
120
|
+
props: props
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var Duration = function Duration(props) {
|
|
124
|
+
return getDuration({
|
|
125
|
+
returnType: "component",
|
|
126
|
+
props: props
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
var _default = exports.default = Duration;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
Duration: true,
|
|
9
|
+
formatDuration: true
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "Duration", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function get() {
|
|
14
|
+
return _Duration.default;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
exports.default = void 0;
|
|
18
|
+
Object.defineProperty(exports, "formatDuration", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _Duration.formatDuration;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _Duration = _interopRequireWildcard(require("./Duration"));
|
|
25
|
+
var _DurationTypes = require("./DurationTypes");
|
|
26
|
+
Object.keys(_DurationTypes).forEach(function (key) {
|
|
27
|
+
if (key === "default" || key === "__esModule") return;
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
29
|
+
if (key in exports && exports[key] === _DurationTypes[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _DurationTypes[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
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); }
|
|
38
|
+
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 && Object.prototype.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; }
|
|
39
|
+
var _default = exports.default = _Duration.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Container = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _seedsReactText = _interopRequireDefault(require("@sproutsocial/seeds-react-text"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
var Container = exports.Container = (0, _styledComponents.default)(_seedsReactText.default).withConfig({
|
|
11
|
+
displayName: "styles__Container",
|
|
12
|
+
componentId: "sc-6o8ar7-0"
|
|
13
|
+
})(["font-variant-numeric:tabular-nums;"]);
|
|
@@ -87,7 +87,7 @@ var MessageBody = exports.MessageBody = (0, _styledComponents.default)(_Box.defa
|
|
|
87
87
|
var MessageFooter = exports.MessageFooter = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
88
88
|
displayName: "styles__MessageFooter",
|
|
89
89
|
componentId: "sc-161ezbx-3"
|
|
90
|
-
})(["padding-bottom:", ";padding-left:", ";padding-right:", ";border-radius:0 0 ", " ", ";display:flex;justify-content:space-between;align-items:center;flex-wrap:", "
|
|
90
|
+
})(["padding-bottom:", ";padding-left:", ";padding-right:", ";border-radius:0 0 ", " ", ";display:flex;justify-content:space-between;align-items:center;flex-wrap:", ";"], function (props) {
|
|
91
91
|
return props.density === _constants.MESSAGE_DENSITIES.CONDENSED ? 0 : props.theme.space[300];
|
|
92
92
|
}, function (props) {
|
|
93
93
|
return getContentPadding(props);
|
|
@@ -99,8 +99,6 @@ var MessageFooter = exports.MessageFooter = (0, _styledComponents.default)(_Box.
|
|
|
99
99
|
return props.theme.radii.outer;
|
|
100
100
|
}, function (props) {
|
|
101
101
|
return props.density === _constants.MESSAGE_DENSITIES.CONDENSED ? "nowrap" : "wrap";
|
|
102
|
-
}, function (props) {
|
|
103
|
-
return props.theme.space[350];
|
|
104
102
|
});
|
|
105
103
|
var MessageMeta = exports.MessageMeta = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
106
104
|
displayName: "styles__MessageMeta",
|
package/commonjs/index.js
CHANGED
|
@@ -264,6 +264,18 @@ Object.keys(_Drawer).forEach(function (key) {
|
|
|
264
264
|
}
|
|
265
265
|
});
|
|
266
266
|
});
|
|
267
|
+
var _Duration = require("./Duration");
|
|
268
|
+
Object.keys(_Duration).forEach(function (key) {
|
|
269
|
+
if (key === "default" || key === "__esModule") return;
|
|
270
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
271
|
+
if (key in exports && exports[key] === _Duration[key]) return;
|
|
272
|
+
Object.defineProperty(exports, key, {
|
|
273
|
+
enumerable: true,
|
|
274
|
+
get: function get() {
|
|
275
|
+
return _Duration[key];
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
});
|
|
267
279
|
var _EmptyState = require("./EmptyState");
|
|
268
280
|
Object.keys(_EmptyState).forEach(function (key) {
|
|
269
281
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { TypeAvatarProps, TypeAvatarType } from "./AvatarTypes";
|
|
3
3
|
export declare const getAvatarColor: (name: string, type: TypeAvatarType) => TypeAvatarType;
|
|
4
|
-
export declare const Avatar: ({ appearance, name, src,
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({ appearance, name, src,
|
|
4
|
+
export declare const Avatar: ({ appearance, name, src, type, size, bg, color, initials, ...rest }: TypeAvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const _default: React.MemoExoticComponent<({ appearance, name, src, type, size, bg, color, initials, ...rest }: TypeAvatarProps) => import("react/jsx-runtime").JSX.Element>;
|
|
6
6
|
export default _default;
|
|
7
7
|
//# sourceMappingURL=Avatar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EACV,eAAe,EAEf,cAAc,EACf,MAAM,eAAe,CAAC;AAoCvB,eAAO,MAAM,cAAc,SACnB,MAAM,QACN,cAAc,KACnB,cAuBF,CAAC;AAEF,eAAO,MAAM,MAAM,wEAUhB,eAAe,4CAqDjB,CAAC;wHArDC,eAAe;AAsDlB,wBAA4B"}
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import { TypeContainerProps as TypeBoxContainerProps } from "../Box";
|
|
2
2
|
import { AvatarColorOptions } from "./constants";
|
|
3
3
|
export type TypeAvatarType = keyof typeof AvatarColorOptions;
|
|
4
|
-
export type TypeAvatarVariant = "dark" | "light";
|
|
5
4
|
export interface TypeAvatarProps extends TypeBoxContainerProps {
|
|
6
5
|
/** Circles are used for social profile avatars, leaf is for internal Sprout user avatars */
|
|
7
6
|
appearance?: "circle" | "leaf";
|
|
8
7
|
/** The name of the user that the avatar represents */
|
|
9
8
|
name?: string;
|
|
9
|
+
/** The initials of the user that the avatar represents.
|
|
10
|
+
* If not provided, the first letter of the first 1-2 words of the `name` prop will be used. */
|
|
11
|
+
initials?: string;
|
|
10
12
|
/** URL of the avatar image. If a URL is not provided, the component will fall back to showing the user's initials */
|
|
11
13
|
src?: string;
|
|
12
14
|
type?: TypeAvatarType;
|
|
13
|
-
/** @deprecated Avatar now uses the theme by default and using `variant` is no longer needed */
|
|
14
|
-
variant?: TypeAvatarVariant;
|
|
15
|
-
bg?: string;
|
|
16
|
-
color?: string;
|
|
17
15
|
size?: string;
|
|
18
16
|
}
|
|
19
17
|
export interface TypeAvatarContainerProps extends TypeBoxContainerProps {
|
|
20
|
-
type: TypeAvatarType;
|
|
21
|
-
|
|
22
|
-
bg?: string;
|
|
23
|
-
$src?: TypeAvatarProps["src"];
|
|
24
|
-
imageFailedLoading?: boolean;
|
|
18
|
+
$type: TypeAvatarType;
|
|
19
|
+
$displayFallback: boolean;
|
|
25
20
|
}
|
|
26
21
|
//# sourceMappingURL=AvatarTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarTypes.d.ts","sourceRoot":"","sources":["../../../src/Avatar/AvatarTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"AvatarTypes.d.ts","sourceRoot":"","sources":["../../../src/Avatar/AvatarTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAG7D,MAAM,WAAW,eAAgB,SAAQ,qBAAqB;IAC5D,4FAA4F;IAC5F,UAAU,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAE/B,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;oGACgG;IAChG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,qHAAqH;IACrH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB;IACrE,KAAK,EAAE,cAAc,CAAC;IACtB,gBAAgB,EAAE,OAAO,CAAC;CAC3B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { TypeDurationProps } from "./DurationTypes";
|
|
3
|
+
export declare const formatDuration: (props: TypeDurationProps) => string;
|
|
4
|
+
declare const Duration: (props: TypeDurationProps) => React.ReactNode;
|
|
5
|
+
export default Duration;
|
|
6
|
+
//# sourceMappingURL=Duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Duration.d.ts","sourceRoot":"","sources":["../../../src/Duration/Duration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AA+GzD,eAAO,MAAM,cAAc,UAAW,iBAAiB,KAAG,MAEzD,CAAC;AAEF,QAAA,MAAM,QAAQ,UAAW,iBAAiB,oBAEzC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TypeTextProps } from "@sproutsocial/seeds-react-text";
|
|
2
|
+
import { TypeQaProps } from "../types/shared";
|
|
3
|
+
export interface TypeDurationProps extends Omit<TypeTextProps, "children"> {
|
|
4
|
+
/** The style of the formatted milliseconds */
|
|
5
|
+
milliseconds: number | null;
|
|
6
|
+
/** Locale to format. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument */
|
|
7
|
+
locale?: Intl.LocalesArgument;
|
|
8
|
+
/** The style of the formatted duration */
|
|
9
|
+
display?: "long" | "narrow";
|
|
10
|
+
/** Text to be read off by screen readers for invalid values (i.e., any value rendered as '—' (em dash)) */
|
|
11
|
+
invalidMillisecondsLabel?: string;
|
|
12
|
+
qa?: TypeQaProps;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=DurationTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurationTypes.d.ts","sourceRoot":"","sources":["../../../src/Duration/DurationTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;IACxE,8CAA8C;IAC9C,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,mIAAmI;IACnI,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC;IAE9B,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAE5B,2GAA2G;IAC3G,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC,EAAE,CAAC,EAAE,WAAW,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Duration.typetest.d.ts","sourceRoot":"","sources":["../../../../src/Duration/__tests__/Duration.typetest.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,+CAoB5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testDuration.d.ts","sourceRoot":"","sources":["../../../../../src/Duration/__tests__/features/testDuration.tsx"],"names":[],"mappings":"AAWA,QAAA,MAAM,YAAY,kEAsBjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/Duration/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Duration/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEtD,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const Container: import("styled-components").StyledComponent<{
|
|
2
|
+
({ fontSize, children, qa, color, ...rest }: import("@sproutsocial/seeds-react-text").TypeTextProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
Headline: import("styled-components").StyledComponent<"span", any, import("@sproutsocial/seeds-react-text").TypeTextProps, never>;
|
|
4
|
+
SubHeadline: import("styled-components").StyledComponent<"span", any, import("@sproutsocial/seeds-react-text").TypeTextProps, never>;
|
|
5
|
+
SmallSubHeadline: import("styled-components").StyledComponent<"span", any, import("@sproutsocial/seeds-react-text").TypeTextProps, never>;
|
|
6
|
+
Byline: import("styled-components").StyledComponent<"span", any, import("@sproutsocial/seeds-react-text").TypeTextProps, never>;
|
|
7
|
+
SmallByline: import("styled-components").StyledComponent<"span", any, import("@sproutsocial/seeds-react-text").TypeTextProps, never>;
|
|
8
|
+
BodyCopy: import("styled-components").StyledComponent<"span", any, import("@sproutsocial/seeds-react-text").TypeTextProps, never>;
|
|
9
|
+
SmallBodyCopy: import("styled-components").StyledComponent<"span", any, import("@sproutsocial/seeds-react-text").TypeTextProps, never>;
|
|
10
|
+
}, import("styled-components").DefaultTheme, {}, never>;
|
|
11
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Duration/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS;;;;;;;;;uDAErB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Message/styles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,QAAA,MAAM,SAAS;QACT,MAAM;SASX,CAAC;AAIF,eAAO,MAAM,aAAa,8RAgBxB,CAAC;AAiDH,eAAO,MAAM,WAAW,yPASvB,CAAC;AAEF,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Message/styles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,QAAA,MAAM,SAAS;QACT,MAAM;SASX,CAAC;AAIF,eAAO,MAAM,aAAa,8RAgBxB,CAAC;AAiDH,eAAO,MAAM,WAAW,yPASvB,CAAC;AAEF,eAAO,MAAM,aAAa,yPAazB,CAAC;AAEF,eAAO,MAAM,WAAW,yPAsBvB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from "@sproutsocial/seeds-react-checkbox";
|
|
|
21
21
|
export * from "./Collapsible";
|
|
22
22
|
export * from "./DatePicker";
|
|
23
23
|
export * from "./Drawer";
|
|
24
|
+
export * from "./Duration";
|
|
24
25
|
export * from "./EmptyState";
|
|
25
26
|
export * from "./Fieldset";
|
|
26
27
|
export * from "./FormField";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,YAAY,EAAE,4BAA4B,IAAI,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvG,OAAO,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,wBAAwB,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGjG,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAGpF,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,UAAU,EACV,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,cAAc,kCAAkC,CAAC;AAGjD,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,cAAc,CAAC;AAC7B,cAAc,kCAAkC,CAAC;AACjD,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oCAAoC,CAAC;AACnD,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,iCAAiC,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,kCAAkC,CAAC;AACjD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC;AACvB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AAEjC;;GAEG;AACH,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,YAAY,EAAE,4BAA4B,IAAI,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvG,OAAO,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,wBAAwB,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGjG,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAGpF,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,UAAU,EACV,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,cAAc,kCAAkC,CAAC;AAGjD,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,cAAc,CAAC;AAC7B,cAAc,kCAAkC,CAAC;AACjD,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oCAAoC,CAAC;AACnD,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,iCAAiC,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,kCAAkC,CAAC;AACjD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC;AACvB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AAEjC;;GAEG;AACH,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,UAAU,CAAC"}
|
package/lib/Avatar/Avatar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["fontSize"],
|
|
3
|
-
_excluded2 = ["appearance", "name", "src", "
|
|
3
|
+
_excluded2 = ["appearance", "name", "src", "type", "size", "bg", "color", "initials"];
|
|
4
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -17,7 +17,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
17
17
|
import * as React from "react";
|
|
18
18
|
import { useState, useCallback, useMemo, memo } from "react";
|
|
19
19
|
import styled, { css } from "styled-components";
|
|
20
|
-
import classnames from "classnames";
|
|
21
20
|
import Box from "../Box";
|
|
22
21
|
import Image from "../Image";
|
|
23
22
|
import Text from "../Text";
|
|
@@ -45,12 +44,11 @@ var Container = styled(Box).withConfig({
|
|
|
45
44
|
componentId: "sc-1ffu253-1"
|
|
46
45
|
})(["", ""], function (_ref3) {
|
|
47
46
|
var theme = _ref3.theme,
|
|
48
|
-
type = _ref3
|
|
47
|
+
$type = _ref3.$type,
|
|
49
48
|
bg = _ref3.bg,
|
|
50
|
-
$src = _ref3.$src,
|
|
51
49
|
borderColor = _ref3.borderColor,
|
|
52
|
-
|
|
53
|
-
return css(["background:", ";border:", ";border-color:", ";color:", ";"], bg ? bg : theme.colors.container.background.decorative[type], $
|
|
50
|
+
$displayFallback = _ref3.$displayFallback;
|
|
51
|
+
return css(["background:", ";border:", ";border-color:", ";color:", ";"], $displayFallback ? bg ? bg : theme.colors.container.background.decorative[$type] : "none", $displayFallback ? "1px solid" : "none", borderColor ? borderColor : theme.colors.container.border.decorative[$type], theme.colors.text.decorative[$type]);
|
|
54
52
|
});
|
|
55
53
|
var getInitials = function getInitials(name) {
|
|
56
54
|
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "?";
|
|
@@ -83,23 +81,22 @@ export var Avatar = function Avatar(_ref4) {
|
|
|
83
81
|
_ref4$name = _ref4.name,
|
|
84
82
|
name = _ref4$name === void 0 ? "" : _ref4$name,
|
|
85
83
|
src = _ref4.src,
|
|
86
|
-
_ref4$variant = _ref4.variant,
|
|
87
|
-
variant = _ref4$variant === void 0 ? "light" : _ref4$variant,
|
|
88
84
|
_ref4$type = _ref4.type,
|
|
89
85
|
type = _ref4$type === void 0 ? defaultType : _ref4$type,
|
|
90
86
|
_ref4$size = _ref4.size,
|
|
91
87
|
size = _ref4$size === void 0 ? "40px" : _ref4$size,
|
|
92
88
|
bg = _ref4.bg,
|
|
93
89
|
color = _ref4.color,
|
|
90
|
+
initials = _ref4.initials,
|
|
94
91
|
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
95
92
|
var colorType = getAvatarColor(name, type);
|
|
96
93
|
var _useState = useState(false),
|
|
97
94
|
_useState2 = _slicedToArray(_useState, 2),
|
|
98
95
|
imageFailedLoading = _useState2[0],
|
|
99
96
|
setImageFailedLoading = _useState2[1];
|
|
100
|
-
var
|
|
101
|
-
return getInitials(name);
|
|
102
|
-
}, [name]);
|
|
97
|
+
var displayInitials = useMemo(function () {
|
|
98
|
+
return initials || getInitials(name);
|
|
99
|
+
}, [initials, name]);
|
|
103
100
|
var handleError = useCallback(function () {
|
|
104
101
|
setImageFailedLoading(true);
|
|
105
102
|
}, [setImageFailedLoading]);
|
|
@@ -107,7 +104,6 @@ export var Avatar = function Avatar(_ref4) {
|
|
|
107
104
|
// Font size for initials is half the size of the avatar, rounded down.
|
|
108
105
|
var fontSize = Math.floor(Number(size.replace("px", "")) * 0.4);
|
|
109
106
|
return /*#__PURE__*/_jsx(Container, _objectSpread(_objectSpread({
|
|
110
|
-
className: classnames(variant),
|
|
111
107
|
size: size,
|
|
112
108
|
overflow: "hidden",
|
|
113
109
|
borderRadius: appearance === "leaf" ? "40% 0 40% 0" : "50%",
|
|
@@ -118,11 +114,9 @@ export var Avatar = function Avatar(_ref4) {
|
|
|
118
114
|
alignItems: "center",
|
|
119
115
|
title: name,
|
|
120
116
|
bg: bg,
|
|
121
|
-
|
|
122
|
-
type: colorType,
|
|
117
|
+
$type: colorType,
|
|
123
118
|
"data-qa-user-avatar": name,
|
|
124
|
-
$
|
|
125
|
-
imageFailedLoading: imageFailedLoading
|
|
119
|
+
$displayFallback: !src || imageFailedLoading
|
|
126
120
|
}, rest), {}, {
|
|
127
121
|
children: !src || imageFailedLoading ? /*#__PURE__*/_jsx(AvatarText, {
|
|
128
122
|
lineHeight: size,
|
|
@@ -130,7 +124,7 @@ export var Avatar = function Avatar(_ref4) {
|
|
|
130
124
|
fontSize: fontSize,
|
|
131
125
|
type: colorType,
|
|
132
126
|
color: color,
|
|
133
|
-
children:
|
|
127
|
+
children: displayInitials
|
|
134
128
|
}) : /*#__PURE__*/_jsx(Image, {
|
|
135
129
|
alt: name,
|
|
136
130
|
width: "auto",
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import memoize from "lru-memoize";
|
|
15
|
+
import { EM_DASH } from "../utils/constants";
|
|
16
|
+
import { VisuallyHidden } from "../VisuallyHidden";
|
|
17
|
+
import { MEMO_CACHE_SIZE, COMPARE_OBJECTS } from "./constants";
|
|
18
|
+
import { Container } from "./styles";
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
var getDivisionAndRemainder = function getDivisionAndRemainder(numerator, denominator) {
|
|
23
|
+
return [Math.floor(numerator / denominator), numerator % denominator];
|
|
24
|
+
};
|
|
25
|
+
var _createDurationFormatter = function _createDurationFormatter(locale, unitDisplay) {
|
|
26
|
+
var timeUnitFormatter = function timeUnitFormatter(locale, unit, unitDisplay) {
|
|
27
|
+
return Intl.NumberFormat(locale, {
|
|
28
|
+
style: "unit",
|
|
29
|
+
unit: unit,
|
|
30
|
+
unitDisplay: unitDisplay
|
|
31
|
+
}).format;
|
|
32
|
+
};
|
|
33
|
+
var formatDays = timeUnitFormatter(locale, "day", unitDisplay);
|
|
34
|
+
var formatHours = timeUnitFormatter(locale, "hour", unitDisplay);
|
|
35
|
+
var formatMinutes = timeUnitFormatter(locale, "minute", unitDisplay);
|
|
36
|
+
var formatSeconds = timeUnitFormatter(locale, "second", unitDisplay);
|
|
37
|
+
var formatMilliseconds = timeUnitFormatter(locale, "millisecond", unitDisplay);
|
|
38
|
+
var formatList = new Intl.ListFormat(locale, {
|
|
39
|
+
style: "narrow",
|
|
40
|
+
type: "unit"
|
|
41
|
+
});
|
|
42
|
+
return function (milliseconds) {
|
|
43
|
+
if (milliseconds <= 0) {
|
|
44
|
+
return formatMilliseconds(0);
|
|
45
|
+
}
|
|
46
|
+
var days;
|
|
47
|
+
var hours;
|
|
48
|
+
var minutes;
|
|
49
|
+
var seconds;
|
|
50
|
+
var _getDivisionAndRemain = getDivisionAndRemainder(milliseconds, 86400000);
|
|
51
|
+
var _getDivisionAndRemain2 = _slicedToArray(_getDivisionAndRemain, 2);
|
|
52
|
+
days = _getDivisionAndRemain2[0];
|
|
53
|
+
milliseconds = _getDivisionAndRemain2[1];
|
|
54
|
+
var _getDivisionAndRemain3 = getDivisionAndRemainder(milliseconds, 3600000);
|
|
55
|
+
var _getDivisionAndRemain4 = _slicedToArray(_getDivisionAndRemain3, 2);
|
|
56
|
+
hours = _getDivisionAndRemain4[0];
|
|
57
|
+
milliseconds = _getDivisionAndRemain4[1];
|
|
58
|
+
var _getDivisionAndRemain5 = getDivisionAndRemainder(milliseconds, 60000);
|
|
59
|
+
var _getDivisionAndRemain6 = _slicedToArray(_getDivisionAndRemain5, 2);
|
|
60
|
+
minutes = _getDivisionAndRemain6[0];
|
|
61
|
+
milliseconds = _getDivisionAndRemain6[1];
|
|
62
|
+
var _getDivisionAndRemain7 = getDivisionAndRemainder(milliseconds, 1000);
|
|
63
|
+
var _getDivisionAndRemain8 = _slicedToArray(_getDivisionAndRemain7, 2);
|
|
64
|
+
seconds = _getDivisionAndRemain8[0];
|
|
65
|
+
milliseconds = _getDivisionAndRemain8[1];
|
|
66
|
+
var list = [days ? formatDays(days) : null, hours ? formatHours(hours) : null, minutes ? formatMinutes(minutes) : null, seconds ? formatSeconds(seconds) : null, milliseconds ? formatMilliseconds(milliseconds) : null].filter(function (listItem) {
|
|
67
|
+
return listItem !== null;
|
|
68
|
+
});
|
|
69
|
+
return formatList.format(list);
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// Memoize to reduce the energy of creating new instances of Intl.NumberFormat
|
|
74
|
+
var memoizer = memoize(MEMO_CACHE_SIZE, COMPARE_OBJECTS);
|
|
75
|
+
var createDurationFormatter = memoizer(_createDurationFormatter);
|
|
76
|
+
var isValidNumber = function isValidNumber(value) {
|
|
77
|
+
return typeof value === "number" && isFinite(value);
|
|
78
|
+
};
|
|
79
|
+
var getDuration = function getDuration(_ref) {
|
|
80
|
+
var returnType = _ref.returnType,
|
|
81
|
+
props = _ref.props;
|
|
82
|
+
var _props$display = props.display,
|
|
83
|
+
display = _props$display === void 0 ? "long" : _props$display,
|
|
84
|
+
invalidMillisecondsLabel = props.invalidMillisecondsLabel,
|
|
85
|
+
_props$locale = props.locale,
|
|
86
|
+
locale = _props$locale === void 0 ? "en-US" : _props$locale,
|
|
87
|
+
_props$milliseconds = props.milliseconds,
|
|
88
|
+
milliseconds = _props$milliseconds === void 0 ? null : _props$milliseconds,
|
|
89
|
+
qa = props.qa;
|
|
90
|
+
var isReturnTypeString = returnType === "string";
|
|
91
|
+
if (!isValidNumber(milliseconds)) {
|
|
92
|
+
return isReturnTypeString ? EM_DASH : /*#__PURE__*/_jsxs(_Fragment, {
|
|
93
|
+
children: [invalidMillisecondsLabel ?
|
|
94
|
+
/*#__PURE__*/
|
|
95
|
+
// Give screen readers something useful to read off + hide the em dash
|
|
96
|
+
_jsx(VisuallyHidden, {
|
|
97
|
+
children: invalidMillisecondsLabel
|
|
98
|
+
}) : null, /*#__PURE__*/_jsx(Container, _objectSpread(_objectSpread({
|
|
99
|
+
"aria-hidden": true
|
|
100
|
+
}, qa), {}, {
|
|
101
|
+
children: EM_DASH
|
|
102
|
+
}))]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
var fullText = createDurationFormatter(locale, display)(milliseconds);
|
|
106
|
+
return isReturnTypeString ? fullText : /*#__PURE__*/_jsx(Container, _objectSpread(_objectSpread({}, qa), {}, {
|
|
107
|
+
children: fullText
|
|
108
|
+
}));
|
|
109
|
+
};
|
|
110
|
+
export var formatDuration = function formatDuration(props) {
|
|
111
|
+
return getDuration({
|
|
112
|
+
returnType: "string",
|
|
113
|
+
props: props
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
var Duration = function Duration(props) {
|
|
117
|
+
return getDuration({
|
|
118
|
+
returnType: "component",
|
|
119
|
+
props: props
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
export default Duration;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/Message/styles.js
CHANGED
|
@@ -80,7 +80,7 @@ export var MessageBody = styled(Box).withConfig({
|
|
|
80
80
|
export var MessageFooter = styled(Box).withConfig({
|
|
81
81
|
displayName: "styles__MessageFooter",
|
|
82
82
|
componentId: "sc-161ezbx-3"
|
|
83
|
-
})(["padding-bottom:", ";padding-left:", ";padding-right:", ";border-radius:0 0 ", " ", ";display:flex;justify-content:space-between;align-items:center;flex-wrap:", "
|
|
83
|
+
})(["padding-bottom:", ";padding-left:", ";padding-right:", ";border-radius:0 0 ", " ", ";display:flex;justify-content:space-between;align-items:center;flex-wrap:", ";"], function (props) {
|
|
84
84
|
return props.density === MESSAGE_DENSITIES.CONDENSED ? 0 : props.theme.space[300];
|
|
85
85
|
}, function (props) {
|
|
86
86
|
return getContentPadding(props);
|
|
@@ -92,8 +92,6 @@ export var MessageFooter = styled(Box).withConfig({
|
|
|
92
92
|
return props.theme.radii.outer;
|
|
93
93
|
}, function (props) {
|
|
94
94
|
return props.density === MESSAGE_DENSITIES.CONDENSED ? "nowrap" : "wrap";
|
|
95
|
-
}, function (props) {
|
|
96
|
-
return props.theme.space[350];
|
|
97
95
|
});
|
|
98
96
|
export var MessageMeta = styled(Box).withConfig({
|
|
99
97
|
displayName: "styles__MessageMeta",
|
package/lib/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export * from "@sproutsocial/seeds-react-checkbox";
|
|
|
26
26
|
export * from "./Collapsible";
|
|
27
27
|
export * from "./DatePicker";
|
|
28
28
|
export * from "./Drawer";
|
|
29
|
+
export * from "./Duration";
|
|
29
30
|
export * from "./EmptyState";
|
|
30
31
|
export * from "./Fieldset";
|
|
31
32
|
export * from "./FormField";
|