@algolia/satellite 1.0.0-beta.115 → 1.0.0-beta.119
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/AnnouncementBadge/AnnouncementBadge.d.ts +1 -1
- package/cjs/AutoComplete/AutoComplete.tailwind.js +1 -1
- package/cjs/AutoComplete/components/AutoCompleteEmptyState.d.ts +1 -1
- package/cjs/Avatars/ApplicationAvatar.d.ts +13 -0
- package/cjs/Avatars/ApplicationAvatar.js +43 -0
- package/cjs/Avatars/UserAvatar.d.ts +13 -0
- package/cjs/Avatars/UserAvatar.js +64 -0
- package/cjs/Avatars/index.d.ts +3 -0
- package/cjs/Avatars/index.js +46 -0
- package/cjs/Avatars/types.d.ts +17 -0
- package/cjs/Avatars/types.js +5 -0
- package/cjs/Avatars/utils.d.ts +6 -0
- package/cjs/Avatars/utils.js +82 -0
- package/cjs/Card/Card.tailwind.js +2 -1
- package/cjs/Dropdown/Dropdown.d.ts +2 -2
- package/cjs/Dropdown/Dropdown.js +1 -1
- package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItem.js +1 -1
- package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroup.d.ts +1 -1
- package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsMultiGroup.d.ts +1 -1
- package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsSingleGroup.d.ts +1 -1
- package/cjs/Dropdown/useDropdownItemProps.js +1 -1
- package/cjs/Modal/Modal.d.ts +1 -1
- package/cjs/Modal/Modal.js +10 -7
- package/cjs/Modal/Modal.tailwind.js +0 -5
- package/cjs/Modal/components/ModalSection.d.ts +10 -0
- package/cjs/Modal/components/ModalSection.js +32 -0
- package/cjs/Modal/index.d.ts +2 -0
- package/cjs/Modal/index.js +28 -0
- package/cjs/Pagination/CompactPagination/CompactPagination.d.ts +21 -0
- package/cjs/Pagination/CompactPagination/CompactPagination.js +78 -0
- package/cjs/Pagination/CompactPagination/index.d.ts +2 -0
- package/cjs/Pagination/CompactPagination/index.js +32 -0
- package/cjs/Pagination/DotPagination/DotPagination.d.ts +9 -0
- package/cjs/Pagination/DotPagination/DotPagination.js +40 -0
- package/cjs/Pagination/DotPagination/index.d.ts +2 -0
- package/cjs/Pagination/DotPagination/index.js +32 -0
- package/cjs/Pagination/{Pagination.d.ts → Pagination/Pagination.d.ts} +1 -1
- package/cjs/Pagination/{Pagination.js → Pagination/Pagination.js} +3 -3
- package/cjs/Pagination/Pagination/index.d.ts +2 -0
- package/cjs/Pagination/Pagination/index.js +32 -0
- package/cjs/Pagination/index.d.ts +2 -0
- package/cjs/Pagination/index.js +28 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +14 -0
- package/cjs/utils/hashCode.d.ts +2 -0
- package/cjs/utils/hashCode.js +28 -0
- package/esm/AnnouncementBadge/AnnouncementBadge.d.ts +1 -1
- package/esm/AutoComplete/AutoComplete.tailwind.js +1 -1
- package/esm/AutoComplete/components/AutoCompleteEmptyState.d.ts +1 -1
- package/esm/Avatars/ApplicationAvatar.d.ts +13 -0
- package/esm/Avatars/ApplicationAvatar.js +27 -0
- package/esm/Avatars/UserAvatar.d.ts +13 -0
- package/esm/Avatars/UserAvatar.js +42 -0
- package/esm/Avatars/index.d.ts +3 -0
- package/esm/Avatars/index.js +3 -0
- package/esm/Avatars/types.d.ts +17 -0
- package/esm/Avatars/types.js +1 -0
- package/esm/Avatars/utils.d.ts +6 -0
- package/esm/Avatars/utils.js +56 -0
- package/esm/Card/Card.tailwind.js +2 -1
- package/esm/Dropdown/Dropdown.d.ts +2 -2
- package/esm/Dropdown/Dropdown.js +1 -1
- package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItem.js +1 -1
- package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroup.d.ts +1 -1
- package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsMultiGroup.d.ts +1 -1
- package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsSingleGroup.d.ts +1 -1
- package/esm/Dropdown/useDropdownItemProps.js +1 -1
- package/esm/Modal/Modal.d.ts +1 -1
- package/esm/Modal/Modal.js +10 -7
- package/esm/Modal/Modal.tailwind.js +0 -5
- package/esm/Modal/components/ModalSection.d.ts +10 -0
- package/esm/Modal/components/ModalSection.js +17 -0
- package/esm/Modal/index.d.ts +2 -0
- package/esm/Modal/index.js +2 -0
- package/esm/Pagination/CompactPagination/CompactPagination.d.ts +21 -0
- package/esm/Pagination/CompactPagination/CompactPagination.js +56 -0
- package/esm/Pagination/CompactPagination/index.d.ts +2 -0
- package/esm/Pagination/CompactPagination/index.js +2 -0
- package/esm/Pagination/DotPagination/DotPagination.d.ts +9 -0
- package/esm/Pagination/DotPagination/DotPagination.js +26 -0
- package/esm/Pagination/DotPagination/index.d.ts +2 -0
- package/esm/Pagination/DotPagination/index.js +2 -0
- package/esm/Pagination/{Pagination.d.ts → Pagination/Pagination.d.ts} +1 -1
- package/esm/Pagination/{Pagination.js → Pagination/Pagination.js} +3 -3
- package/esm/Pagination/Pagination/index.d.ts +2 -0
- package/esm/Pagination/Pagination/index.js +2 -0
- package/esm/Pagination/index.d.ts +2 -0
- package/esm/Pagination/index.js +2 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/utils/hashCode.d.ts +2 -0
- package/esm/utils/hashCode.js +18 -0
- package/package.json +2 -1
- package/satellite.css +2 -5
- package/satellite.min.css +1 -1
@@ -0,0 +1,78 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports["default"] = exports.CompactPagination = exports.isIndeterminateCompactPaginationProps = exports.isDeterminateCompactPaginationProps = void 0;
|
9
|
+
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
11
|
+
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
13
|
+
|
14
|
+
var _reactFeather = require("react-feather");
|
15
|
+
|
16
|
+
var _satellitePrefixer = _interopRequireDefault(require("../../styles/helpers/satellitePrefixer"));
|
17
|
+
|
18
|
+
var _Button = require("../../Button");
|
19
|
+
|
20
|
+
var _templateObject, _templateObject2;
|
21
|
+
|
22
|
+
var isDeterminateCompactPaginationProps = function isDeterminateCompactPaginationProps(props) {
|
23
|
+
return "nbPages" in props;
|
24
|
+
};
|
25
|
+
|
26
|
+
exports.isDeterminateCompactPaginationProps = isDeterminateCompactPaginationProps;
|
27
|
+
|
28
|
+
var isIndeterminateCompactPaginationProps = function isIndeterminateCompactPaginationProps(props) {
|
29
|
+
return !isDeterminateCompactPaginationProps(props);
|
30
|
+
};
|
31
|
+
|
32
|
+
exports.isIndeterminateCompactPaginationProps = isIndeterminateCompactPaginationProps;
|
33
|
+
|
34
|
+
var CompactPagination = function CompactPagination(props) {
|
35
|
+
var _props$label;
|
36
|
+
|
37
|
+
var labelType = (_props$label = props.label) !== null && _props$label !== void 0 ? _props$label : isDeterminateCompactPaginationProps(props) ? "complete" : "compact";
|
38
|
+
var label = labelType === "none" ? null : labelType === "compact" ? "".concat(props.currentPage) : isDeterminateCompactPaginationProps(props) ? "Page ".concat(props.currentPage, " of ").concat(props.nbPages) : "Page ".concat(props.currentPage, " of many");
|
39
|
+
var isFirstPage = props.currentPage === 1;
|
40
|
+
var isLastPage = isDeterminateCompactPaginationProps(props) ? props.currentPage === props.nbPages : !!props.nextDisabled;
|
41
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
42
|
+
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["flex items-center space-x-2"])))
|
43
|
+
}, props.showGoToFirstPage && /*#__PURE__*/_react["default"].createElement(_Button.IconButton, {
|
44
|
+
icon: _reactFeather.ChevronsLeft,
|
45
|
+
title: "Go to first page",
|
46
|
+
onClick: function onClick() {
|
47
|
+
return props.onChange(1);
|
48
|
+
},
|
49
|
+
disabled: isFirstPage
|
50
|
+
}), /*#__PURE__*/_react["default"].createElement(_Button.IconButton, {
|
51
|
+
icon: _reactFeather.ArrowLeft,
|
52
|
+
title: "Go to previous page",
|
53
|
+
onClick: function onClick() {
|
54
|
+
return props.onChange(props.currentPage - 1);
|
55
|
+
},
|
56
|
+
disabled: isFirstPage
|
57
|
+
}), label && /*#__PURE__*/_react["default"].createElement("span", {
|
58
|
+
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["inline-block text-center tabular-nums px-2"])))
|
59
|
+
}, label), /*#__PURE__*/_react["default"].createElement(_Button.IconButton, {
|
60
|
+
icon: _reactFeather.ArrowRight,
|
61
|
+
title: "Go to next page",
|
62
|
+
onClick: function onClick() {
|
63
|
+
return props.onChange(props.currentPage + 1);
|
64
|
+
},
|
65
|
+
disabled: isLastPage
|
66
|
+
}), isDeterminateCompactPaginationProps(props) && props.showGoToLastPage && /*#__PURE__*/_react["default"].createElement(_Button.IconButton, {
|
67
|
+
icon: _reactFeather.ChevronsRight,
|
68
|
+
title: "Go to last page",
|
69
|
+
onClick: function onClick() {
|
70
|
+
return props.onChange(props.nbPages);
|
71
|
+
},
|
72
|
+
disabled: isLastPage
|
73
|
+
}));
|
74
|
+
};
|
75
|
+
|
76
|
+
exports.CompactPagination = CompactPagination;
|
77
|
+
var _default = CompactPagination;
|
78
|
+
exports["default"] = _default;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
var _exportNames = {};
|
9
|
+
Object.defineProperty(exports, "default", {
|
10
|
+
enumerable: true,
|
11
|
+
get: function get() {
|
12
|
+
return _CompactPagination["default"];
|
13
|
+
}
|
14
|
+
});
|
15
|
+
|
16
|
+
var _CompactPagination = _interopRequireWildcard(require("./CompactPagination"));
|
17
|
+
|
18
|
+
Object.keys(_CompactPagination).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
21
|
+
if (key in exports && exports[key] === _CompactPagination[key]) return;
|
22
|
+
Object.defineProperty(exports, key, {
|
23
|
+
enumerable: true,
|
24
|
+
get: function get() {
|
25
|
+
return _CompactPagination[key];
|
26
|
+
}
|
27
|
+
});
|
28
|
+
});
|
29
|
+
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
31
|
+
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare type DotPaginationProps = {
|
3
|
+
/** Currently selected page (1 based index) */
|
4
|
+
currentPage: number;
|
5
|
+
onChange: (page: number) => void;
|
6
|
+
nbPages: number;
|
7
|
+
};
|
8
|
+
export declare const DotPagination: ({ currentPage, onChange, nbPages }: DotPaginationProps) => JSX.Element;
|
9
|
+
export default DotPagination;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports["default"] = exports.DotPagination = void 0;
|
9
|
+
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
11
|
+
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
13
|
+
|
14
|
+
var _satellitePrefixer = _interopRequireDefault(require("../../styles/helpers/satellitePrefixer"));
|
15
|
+
|
16
|
+
var _templateObject, _templateObject2;
|
17
|
+
|
18
|
+
var DotPagination = function DotPagination(_ref) {
|
19
|
+
var currentPage = _ref.currentPage,
|
20
|
+
onChange = _ref.onChange,
|
21
|
+
nbPages = _ref.nbPages;
|
22
|
+
return /*#__PURE__*/_react["default"].createElement("ul", {
|
23
|
+
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["flex"])))
|
24
|
+
}, new Array(nbPages).fill(undefined).map(function (_, idx) {
|
25
|
+
var pageIdx = idx + 1;
|
26
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
27
|
+
key: idx
|
28
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
29
|
+
"aria-label": "Go to page ".concat(pageIdx),
|
30
|
+
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n h-3 w-3 rounded-full mx-1\n ", "\n "])), currentPage === pageIdx ? "bg-accent-600" : "bg-grey-200"),
|
31
|
+
onClick: function onClick() {
|
32
|
+
return onChange(pageIdx);
|
33
|
+
}
|
34
|
+
}));
|
35
|
+
}));
|
36
|
+
};
|
37
|
+
|
38
|
+
exports.DotPagination = DotPagination;
|
39
|
+
var _default = DotPagination;
|
40
|
+
exports["default"] = _default;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
var _exportNames = {};
|
9
|
+
Object.defineProperty(exports, "default", {
|
10
|
+
enumerable: true,
|
11
|
+
get: function get() {
|
12
|
+
return _DotPagination["default"];
|
13
|
+
}
|
14
|
+
});
|
15
|
+
|
16
|
+
var _DotPagination = _interopRequireWildcard(require("./DotPagination"));
|
17
|
+
|
18
|
+
Object.keys(_DotPagination).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
21
|
+
if (key in exports && exports[key] === _DotPagination[key]) return;
|
22
|
+
Object.defineProperty(exports, key, {
|
23
|
+
enumerable: true,
|
24
|
+
get: function get() {
|
25
|
+
return _DotPagination[key];
|
26
|
+
}
|
27
|
+
});
|
28
|
+
});
|
29
|
+
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
31
|
+
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -12,5 +12,5 @@ export interface PaginationProps {
|
|
12
12
|
* - Don't use on list with less than 20 items
|
13
13
|
* - Place the pagination at the bottom of the split item
|
14
14
|
*/
|
15
|
-
export declare const Pagination: ({ currentPage, nbPages, onChange, maxButtons: maxButtonsParam }: PaginationProps) => JSX.Element;
|
15
|
+
export declare const Pagination: ({ currentPage, nbPages, onChange, maxButtons: maxButtonsParam, }: PaginationProps) => JSX.Element;
|
16
16
|
export default Pagination;
|
@@ -15,11 +15,11 @@ var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
|
16
16
|
var _reactFeather = require("react-feather");
|
17
17
|
|
18
|
-
var _satellitePrefixer = _interopRequireDefault(require("
|
18
|
+
var _satellitePrefixer = _interopRequireDefault(require("../../styles/helpers/satellitePrefixer"));
|
19
19
|
|
20
|
-
var _range = _interopRequireDefault(require("
|
20
|
+
var _range = _interopRequireDefault(require("../../utils/range"));
|
21
21
|
|
22
|
-
var _Button = _interopRequireWildcard(require("
|
22
|
+
var _Button = _interopRequireWildcard(require("../../Button"));
|
23
23
|
|
24
24
|
var _templateObject;
|
25
25
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
var _exportNames = {};
|
9
|
+
Object.defineProperty(exports, "default", {
|
10
|
+
enumerable: true,
|
11
|
+
get: function get() {
|
12
|
+
return _Pagination["default"];
|
13
|
+
}
|
14
|
+
});
|
15
|
+
|
16
|
+
var _Pagination = _interopRequireWildcard(require("./Pagination"));
|
17
|
+
|
18
|
+
Object.keys(_Pagination).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
21
|
+
if (key in exports && exports[key] === _Pagination[key]) return;
|
22
|
+
Object.defineProperty(exports, key, {
|
23
|
+
enumerable: true,
|
24
|
+
get: function get() {
|
25
|
+
return _Pagination[key];
|
26
|
+
}
|
27
|
+
});
|
28
|
+
});
|
29
|
+
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
31
|
+
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
package/cjs/Pagination/index.js
CHANGED
@@ -27,6 +27,34 @@ Object.keys(_Pagination).forEach(function (key) {
|
|
27
27
|
});
|
28
28
|
});
|
29
29
|
|
30
|
+
var _DotPagination = require("./DotPagination");
|
31
|
+
|
32
|
+
Object.keys(_DotPagination).forEach(function (key) {
|
33
|
+
if (key === "default" || key === "__esModule") return;
|
34
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
35
|
+
if (key in exports && exports[key] === _DotPagination[key]) return;
|
36
|
+
Object.defineProperty(exports, key, {
|
37
|
+
enumerable: true,
|
38
|
+
get: function get() {
|
39
|
+
return _DotPagination[key];
|
40
|
+
}
|
41
|
+
});
|
42
|
+
});
|
43
|
+
|
44
|
+
var _CompactPagination = require("./CompactPagination");
|
45
|
+
|
46
|
+
Object.keys(_CompactPagination).forEach(function (key) {
|
47
|
+
if (key === "default" || key === "__esModule") return;
|
48
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
49
|
+
if (key in exports && exports[key] === _CompactPagination[key]) return;
|
50
|
+
Object.defineProperty(exports, key, {
|
51
|
+
enumerable: true,
|
52
|
+
get: function get() {
|
53
|
+
return _CompactPagination[key];
|
54
|
+
}
|
55
|
+
});
|
56
|
+
});
|
57
|
+
|
30
58
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
31
59
|
|
32
60
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
package/cjs/index.d.ts
CHANGED
@@ -6,6 +6,7 @@ export { default as makePurgeCssExtractor } from "./styles/helpers/makePurgeCssE
|
|
6
6
|
export * from "./utils/parseUrl";
|
7
7
|
export * from "./AnnouncementBadge";
|
8
8
|
export * from "./AutoComplete";
|
9
|
+
export * from "./Avatars";
|
9
10
|
export * from "./Badge";
|
10
11
|
export * from "./Banner";
|
11
12
|
export * from "./Button";
|
package/cjs/index.js
CHANGED
@@ -100,6 +100,20 @@ Object.keys(_AutoComplete).forEach(function (key) {
|
|
100
100
|
});
|
101
101
|
});
|
102
102
|
|
103
|
+
var _Avatars = require("./Avatars");
|
104
|
+
|
105
|
+
Object.keys(_Avatars).forEach(function (key) {
|
106
|
+
if (key === "default" || key === "__esModule") return;
|
107
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
108
|
+
if (key in exports && exports[key] === _Avatars[key]) return;
|
109
|
+
Object.defineProperty(exports, key, {
|
110
|
+
enumerable: true,
|
111
|
+
get: function get() {
|
112
|
+
return _Avatars[key];
|
113
|
+
}
|
114
|
+
});
|
115
|
+
});
|
116
|
+
|
103
117
|
var _Badge = require("./Badge");
|
104
118
|
|
105
119
|
Object.keys(_Badge).forEach(function (key) {
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports["default"] = exports.hashCode = void 0;
|
7
|
+
|
8
|
+
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript?rq=1
|
9
|
+
var hashCode = function hashCode(value) {
|
10
|
+
var hash = 0;
|
11
|
+
|
12
|
+
if (value.length === 0) {
|
13
|
+
return hash;
|
14
|
+
}
|
15
|
+
|
16
|
+
for (var i = 0; i < value.length; i++) {
|
17
|
+
var _char = value.charCodeAt(i);
|
18
|
+
|
19
|
+
hash = (hash << 5) - hash + _char;
|
20
|
+
hash = hash & hash; // Convert to 32bit integer
|
21
|
+
}
|
22
|
+
|
23
|
+
return hash;
|
24
|
+
};
|
25
|
+
|
26
|
+
exports.hashCode = hashCode;
|
27
|
+
var _default = hashCode;
|
28
|
+
exports["default"] = _default;
|
@@ -2,7 +2,7 @@ import React, { FunctionComponent } from "react";
|
|
2
2
|
export declare type AnnouncementBadgeSizes = "default" | "small";
|
3
3
|
export interface AnnouncementBadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
4
4
|
size?: AnnouncementBadgeSizes;
|
5
|
-
text?: "new" | "beta" | "internal";
|
5
|
+
text?: "new" | "beta" | "internal" | "pilot";
|
6
6
|
variant?: "accent" | "red";
|
7
7
|
children?: never;
|
8
8
|
}
|
@@ -7,5 +7,5 @@ export interface AutoCompleteEmptyStateProps {
|
|
7
7
|
title: React.ReactNode;
|
8
8
|
description?: React.ReactNode;
|
9
9
|
}
|
10
|
-
export declare const AutoCompleteEmptyState: ({ icon, variant, title, description }: AutoCompleteEmptyStateProps) => JSX.Element;
|
10
|
+
export declare const AutoCompleteEmptyState: ({ icon, variant, title, description, }: AutoCompleteEmptyStateProps) => JSX.Element;
|
11
11
|
export default AutoCompleteEmptyState;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { ApplicationAvatarSize, MinimalApplication } from "./types";
|
3
|
+
interface ApplicationAvatarProps {
|
4
|
+
/** A minimal application object containing `applicationID` and `name`. */
|
5
|
+
application: MinimalApplication;
|
6
|
+
/** @default "medium" */
|
7
|
+
size?: ApplicationAvatarSize;
|
8
|
+
/** @ignore */
|
9
|
+
className?: string;
|
10
|
+
}
|
11
|
+
/** The `ApplicationAvatar` is used as a visual representation of an application. */
|
12
|
+
export declare const ApplicationAvatar: ({ className, application, size }: ApplicationAvatarProps) => JSX.Element;
|
13
|
+
export default ApplicationAvatar;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
2
|
+
|
3
|
+
var _templateObject, _templateObject2, _templateObject3;
|
4
|
+
|
5
|
+
import React from "react";
|
6
|
+
import cx from "classnames";
|
7
|
+
import stl from "../styles/helpers/satellitePrefixer";
|
8
|
+
import { getApplicationInitials, pickApplicationColors } from "./utils";
|
9
|
+
var SIZE_CLASSNAMES = {
|
10
|
+
small: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["w-4 h-4"]))),
|
11
|
+
medium: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["w-8 h-8"])))
|
12
|
+
};
|
13
|
+
|
14
|
+
/** The `ApplicationAvatar` is used as a visual representation of an application. */
|
15
|
+
export var ApplicationAvatar = function ApplicationAvatar(_ref) {
|
16
|
+
var className = _ref.className,
|
17
|
+
application = _ref.application,
|
18
|
+
_ref$size = _ref.size,
|
19
|
+
size = _ref$size === void 0 ? "medium" : _ref$size;
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
21
|
+
className: cx(stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["rounded inline-flex flex-shrink-0 items-center justify-center uppercase"]))), pickApplicationColors(application.applicationId), SIZE_CLASSNAMES[size], className),
|
22
|
+
style: size === "small" ? {
|
23
|
+
fontSize: "8px"
|
24
|
+
} : {}
|
25
|
+
}, getApplicationInitials(application));
|
26
|
+
};
|
27
|
+
export default ApplicationAvatar;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { MinimalUser } from "./types";
|
3
|
+
export declare type UserAvatarProps = {
|
4
|
+
/** A minimal user object containing `name`, `email` and `avatar`. */
|
5
|
+
user: MinimalUser;
|
6
|
+
/** @default 32 */
|
7
|
+
size?: number;
|
8
|
+
/** @ignore */
|
9
|
+
className?: string;
|
10
|
+
};
|
11
|
+
/** The `UserAvatar` is used as a visual representation of a user. */
|
12
|
+
export declare const UserAvatar: ({ className, user, size }: UserAvatarProps) => JSX.Element;
|
13
|
+
export default UserAvatar;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
|
4
|
+
var _templateObject, _templateObject2;
|
5
|
+
|
6
|
+
import React, { useState } from "react";
|
7
|
+
import cx from "classnames";
|
8
|
+
import stl from "../styles/helpers/satellitePrefixer";
|
9
|
+
import { getUserInitials, getUserBackgroundClassName } from "./utils";
|
10
|
+
|
11
|
+
/** The `UserAvatar` is used as a visual representation of a user. */
|
12
|
+
export var UserAvatar = function UserAvatar(_ref) {
|
13
|
+
var _user$email;
|
14
|
+
|
15
|
+
var className = _ref.className,
|
16
|
+
user = _ref.user,
|
17
|
+
_ref$size = _ref.size,
|
18
|
+
size = _ref$size === void 0 ? 32 : _ref$size;
|
19
|
+
|
20
|
+
var _useState = useState(false),
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
22
|
+
failedToLoadAvatar = _useState2[0],
|
23
|
+
setFailedToLoadAvatar = _useState2[1];
|
24
|
+
|
25
|
+
var initials = getUserInitials(user);
|
26
|
+
var hasValidAvatar = user.avatar && !failedToLoadAvatar;
|
27
|
+
return /*#__PURE__*/React.createElement("div", {
|
28
|
+
className: cx(stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["relative overflow-hidden flex justify-center items-center rounded-full text-white uppercase"]))), !hasValidAvatar && getUserBackgroundClassName((_user$email = user.email) !== null && _user$email !== void 0 ? _user$email : "no-email"), className),
|
29
|
+
style: {
|
30
|
+
width: size,
|
31
|
+
height: size
|
32
|
+
}
|
33
|
+
}, /*#__PURE__*/React.createElement("span", null, initials), hasValidAvatar && /*#__PURE__*/React.createElement("img", {
|
34
|
+
className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["w-full absolute top-0 left-0"]))),
|
35
|
+
src: user.avatar,
|
36
|
+
alt: "".concat(user.name || user.email, "'s avatar"),
|
37
|
+
onError: function onError() {
|
38
|
+
return setFailedToLoadAvatar(true);
|
39
|
+
}
|
40
|
+
}));
|
41
|
+
};
|
42
|
+
export default UserAvatar;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export declare type ApplicationAvatarSize = "small" | "medium";
|
2
|
+
export declare type MinimalApplication = {
|
3
|
+
applicationId: string;
|
4
|
+
name?: string;
|
5
|
+
};
|
6
|
+
declare type UserAvatarWithName = {
|
7
|
+
name: string;
|
8
|
+
email?: string;
|
9
|
+
};
|
10
|
+
declare type UserAvatarWithEmail = {
|
11
|
+
email: string;
|
12
|
+
name?: string;
|
13
|
+
};
|
14
|
+
export declare type MinimalUser = (UserAvatarWithName | UserAvatarWithEmail) & {
|
15
|
+
avatar?: string;
|
16
|
+
};
|
17
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { MinimalApplication, MinimalUser } from "./types";
|
2
|
+
export declare const pickApplicationColors: (applicationId: string) => string;
|
3
|
+
export declare const getApplicationIdInitial: (applicationId: string) => string;
|
4
|
+
export declare const getApplicationInitials: ({ name, applicationId }: MinimalApplication) => string;
|
5
|
+
export declare const getUserBackgroundClassName: (email: string) => string;
|
6
|
+
export declare const getUserInitials: (user: MinimalUser) => string;
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
2
|
+
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28;
|
4
|
+
|
5
|
+
import { remove as removeDiacritics } from "diacritics";
|
6
|
+
import stl from "../styles/helpers/satellitePrefixer";
|
7
|
+
import hashCode from "../utils/hashCode";
|
8
|
+
|
9
|
+
/** APPLICATION */
|
10
|
+
var APPLICATION_COLORS_CLASSNAMES = [stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["bg-grey-200 text-grey-800"]))), stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["bg-nebula-200 text-nebula-800"]))), stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["bg-blue-200 text-blue-800"]))), stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["bg-green-200 text-green-800"]))), stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["bg-pink-200 text-pink-800"]))), stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["bg-red-200 text-red-800"]))), stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["bg-orange-200 text-orange-800"]))), // Darker variants
|
11
|
+
stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["bg-grey-300 text-grey-900"]))), stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["bg-nebula-300 text-nebula-900"]))), stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["bg-blue-300 text-blue-900"]))), stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["bg-green-300 text-green-900"]))), stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["bg-pink-300 text-pink-900"]))), stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["bg-red-300 text-red-900"]))), stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["bg-orange-300 text-orange-900"])))];
|
12
|
+
export var pickApplicationColors = function pickApplicationColors(applicationId) {
|
13
|
+
var _APPLICATION_COLORS_C;
|
14
|
+
|
15
|
+
return (_APPLICATION_COLORS_C = APPLICATION_COLORS_CLASSNAMES[Math.abs(hashCode(applicationId)) % APPLICATION_COLORS_CLASSNAMES.length]) !== null && _APPLICATION_COLORS_C !== void 0 ? _APPLICATION_COLORS_C : APPLICATION_COLORS_CLASSNAMES[0];
|
16
|
+
};
|
17
|
+
export var getApplicationIdInitial = function getApplicationIdInitial(applicationId) {
|
18
|
+
return applicationId.startsWith("beta") ? applicationId.slice(4, 6) : applicationId.slice(0, 2);
|
19
|
+
};
|
20
|
+
export var getApplicationInitials = function getApplicationInitials(_ref) {
|
21
|
+
var name = _ref.name,
|
22
|
+
applicationId = _ref.applicationId;
|
23
|
+
|
24
|
+
if (!name) {
|
25
|
+
return getApplicationIdInitial(applicationId);
|
26
|
+
}
|
27
|
+
|
28
|
+
var words = removeDiacritics(name.trim()).toLocaleUpperCase().split(/\W+/).filter(function (word) {
|
29
|
+
return word.length >= 1;
|
30
|
+
});
|
31
|
+
|
32
|
+
if (words.length === 0 || words.length === 1 && words[0].length < 2) {
|
33
|
+
return getApplicationIdInitial(applicationId);
|
34
|
+
} else if (words.length === 1) {
|
35
|
+
return words[0].slice(0, 2);
|
36
|
+
}
|
37
|
+
|
38
|
+
return "".concat(words[0][0]).concat(words[1][0]);
|
39
|
+
};
|
40
|
+
/** USER */
|
41
|
+
|
42
|
+
var USER_COLORS_CLASSNAMES = [stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["bg-grey-400"]))), stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["bg-nebula-400"]))), stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["bg-blue-400"]))), stl(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["bg-green-400"]))), stl(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["bg-pink-400"]))), stl(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["bg-red-400"]))), stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["bg-orange-400"]))), // Darker variants
|
43
|
+
stl(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["bg-grey-700"]))), stl(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["bg-nebula-700"]))), stl(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["bg-blue-700"]))), stl(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["bg-green-700"]))), stl(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["bg-pink-700"]))), stl(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["bg-red-700"]))), stl(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["bg-orange-700"])))];
|
44
|
+
export var getUserBackgroundClassName = function getUserBackgroundClassName(email) {
|
45
|
+
var _USER_COLORS_CLASSNAM;
|
46
|
+
|
47
|
+
return (_USER_COLORS_CLASSNAM = USER_COLORS_CLASSNAMES[Math.abs(hashCode(email)) % USER_COLORS_CLASSNAMES.length]) !== null && _USER_COLORS_CLASSNAM !== void 0 ? _USER_COLORS_CLASSNAM : USER_COLORS_CLASSNAMES[0];
|
48
|
+
};
|
49
|
+
export var getUserInitials = function getUserInitials(user) {
|
50
|
+
var _user$email, _user$email$match;
|
51
|
+
|
52
|
+
var words = user.name ? user.name.trim().split(/\s+/) : (_user$email = user.email) === null || _user$email === void 0 ? void 0 : (_user$email$match = _user$email.match(/^(.+)(?:\+.+?)?@.+$/)) === null || _user$email$match === void 0 ? void 0 : _user$email$match[1].split(".");
|
53
|
+
return words ? words.slice(0, 2).map(function (w) {
|
54
|
+
return w.toLocaleLowerCase()[0];
|
55
|
+
}).join("") : "??";
|
56
|
+
};
|
@@ -28,7 +28,7 @@ export declare const DEFAULT_DROPDOWN_POPPER_MODIFIERS: StrictModifier[];
|
|
28
28
|
* - Make sure the most common options are listed. These can be grouped into sub-categories under headings
|
29
29
|
*/
|
30
30
|
export declare const Dropdown: {
|
31
|
-
({ placement, menuClassName, modifiers, renderTarget, renderFooter, children }: DropdownProps): JSX.Element;
|
31
|
+
({ placement, menuClassName, modifiers, renderTarget, renderFooter, children, }: DropdownProps): JSX.Element;
|
32
32
|
ButtonItem: {
|
33
33
|
(props: import("./components/DropdownButtonItem").DropdownButtonItemProps): JSX.Element;
|
34
34
|
defaultProps: {
|
@@ -39,7 +39,7 @@ export declare const Dropdown: {
|
|
39
39
|
(props: import("./components/DropdownLinkItem").DropdownLinkItemProps): JSX.Element;
|
40
40
|
defaultProps: {
|
41
41
|
toggle: boolean;
|
42
|
-
};
|
42
|
+
};
|
43
43
|
};
|
44
44
|
RadioItem: {
|
45
45
|
(props: import("./components/DropdownRadioItem").DropdownRadioItemProps): JSX.Element;
|