@algolia/satellite 1.0.0-beta.122 → 1.0.0-beta.126

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.
Files changed (59) hide show
  1. package/cjs/Banner/Banner.d.ts +3 -0
  2. package/cjs/Banner/Banner.js +13 -5
  3. package/cjs/Banners/Alert/Alert.d.ts +69 -0
  4. package/cjs/Banners/Alert/Alert.js +144 -0
  5. package/cjs/Banners/Alert/index.d.ts +2 -0
  6. package/cjs/Banners/Alert/index.js +32 -0
  7. package/cjs/Banners/BigBertha/BigBertha.d.ts +40 -0
  8. package/cjs/Banners/BigBertha/BigBertha.js +68 -0
  9. package/cjs/Banners/BigBertha/index.d.ts +2 -0
  10. package/cjs/Banners/BigBertha/index.js +32 -0
  11. package/cjs/Banners/Promote/Promote.d.ts +56 -0
  12. package/cjs/Banners/Promote/Promote.js +113 -0
  13. package/cjs/Banners/Promote/index.d.ts +2 -0
  14. package/cjs/Banners/Promote/index.js +32 -0
  15. package/cjs/Banners/index.d.ts +3 -0
  16. package/cjs/Banners/index.js +44 -0
  17. package/cjs/Button/Button.tailwind.js +1 -1
  18. package/cjs/Insert/Insert.d.ts +43 -0
  19. package/cjs/Insert/Insert.js +80 -0
  20. package/cjs/Insert/index.d.ts +2 -0
  21. package/cjs/Insert/index.js +32 -0
  22. package/cjs/Tables/DataTable/DataTable.d.ts +14 -5
  23. package/cjs/Tables/DataTable/DataTable.js +22 -25
  24. package/cjs/Tables/DataTable/components/Header.js +2 -2
  25. package/cjs/Tables/DataTable/components/HeaderCell.js +1 -1
  26. package/cjs/Tables/DataTable/types.d.ts +1 -1
  27. package/cjs/index.d.ts +2 -0
  28. package/cjs/index.js +28 -0
  29. package/esm/Banner/Banner.d.ts +3 -0
  30. package/esm/Banner/Banner.js +12 -5
  31. package/esm/Banners/Alert/Alert.d.ts +69 -0
  32. package/esm/Banners/Alert/Alert.js +127 -0
  33. package/esm/Banners/Alert/index.d.ts +2 -0
  34. package/esm/Banners/Alert/index.js +2 -0
  35. package/esm/Banners/BigBertha/BigBertha.d.ts +40 -0
  36. package/esm/Banners/BigBertha/BigBertha.js +54 -0
  37. package/esm/Banners/BigBertha/index.d.ts +2 -0
  38. package/esm/Banners/BigBertha/index.js +2 -0
  39. package/esm/Banners/Promote/Promote.d.ts +56 -0
  40. package/esm/Banners/Promote/Promote.js +95 -0
  41. package/esm/Banners/Promote/index.d.ts +2 -0
  42. package/esm/Banners/Promote/index.js +2 -0
  43. package/esm/Banners/index.d.ts +3 -0
  44. package/esm/Banners/index.js +3 -0
  45. package/esm/Button/Button.tailwind.js +1 -1
  46. package/esm/Insert/Insert.d.ts +43 -0
  47. package/esm/Insert/Insert.js +66 -0
  48. package/esm/Insert/index.d.ts +2 -0
  49. package/esm/Insert/index.js +2 -0
  50. package/esm/Tables/DataTable/DataTable.d.ts +14 -5
  51. package/esm/Tables/DataTable/DataTable.js +22 -25
  52. package/esm/Tables/DataTable/components/Header.js +2 -2
  53. package/esm/Tables/DataTable/components/HeaderCell.js +1 -1
  54. package/esm/Tables/DataTable/types.d.ts +1 -1
  55. package/esm/index.d.ts +2 -0
  56. package/esm/index.js +2 -0
  57. package/package.json +1 -1
  58. package/satellite.css +1 -1
  59. package/satellite.min.css +1 -1
@@ -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 _Promote["default"];
13
+ }
14
+ });
15
+
16
+ var _Promote = _interopRequireWildcard(require("./Promote"));
17
+
18
+ Object.keys(_Promote).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] === _Promote[key]) return;
22
+ Object.defineProperty(exports, key, {
23
+ enumerable: true,
24
+ get: function get() {
25
+ return _Promote[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,3 @@
1
+ export * from "./Alert";
2
+ export * from "./BigBertha";
3
+ export * from "./Promote";
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _Alert = require("./Alert");
8
+
9
+ Object.keys(_Alert).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _Alert[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _Alert[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _BigBertha = require("./BigBertha");
21
+
22
+ Object.keys(_BigBertha).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _BigBertha[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _BigBertha[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _Promote = require("./Promote");
34
+
35
+ Object.keys(_Promote).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _Promote[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _Promote[key];
42
+ }
43
+ });
44
+ });
@@ -31,7 +31,7 @@ var buttonPlugin = function buttonPlugin(_ref) {
31
31
  ".btn-subtle": {
32
32
  color: theme("colors.grey.600"),
33
33
  "&:hover": {
34
- background: theme("colors.grey.100")
34
+ background: rgba(theme("colors.grey.300"), 0.15)
35
35
  },
36
36
  "&:focus": {
37
37
  boxShadow: "0 0 0 1px ".concat(theme("colors.accent.600"))
@@ -0,0 +1,43 @@
1
+ import React, { FC } from "react";
2
+ import { BadgeVariants } from "../Badge";
3
+ declare type InsertContext = {
4
+ label: string;
5
+ variant?: BadgeVariants;
6
+ };
7
+ export interface InsertProps {
8
+ title: React.ReactNode;
9
+ contexts?: Array<string | InsertContext>;
10
+ }
11
+ /**
12
+ * Put more emphasis on side content.
13
+
14
+ * ## Examples
15
+ * [See the component in Figma](https://www.figma.com/file/99l59il97k2n5y4n6Jucal/%5BSatellite%5D-Components?node-id=2912%3A279499)
16
+
17
+ * ## Current Status
18
+ * - [x] Figma
19
+ * - [x] React
20
+ * - [ ] Documentation
21
+
22
+ * ## Component structure
23
+ * The component is a simple and flexible container. It should include a Title and a short text. To give more context you can use optional badges and an optional link to forward users in the right direction.
24
+
25
+ * ## Guidelines
26
+
27
+ * ### How to use it?
28
+ * Use the `Insert` if you want to give extra information to the user about the flow they are in or to highlight and define some terms used. This component can be use on the side of existing content or as a block.
29
+
30
+ * ### How to NOT use it?
31
+ * - Don't use this component to display temporary and/or critical information, use an Alert instead.
32
+
33
+ * ### Variants
34
+ * - Grey background
35
+
36
+ * ### Do's and Don't
37
+ * TODO
38
+
39
+ * ## Accessibility
40
+ * TODO
41
+ */
42
+ export declare const Insert: FC<InsertProps>;
43
+ export default Insert;
@@ -0,0 +1,80 @@
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.Insert = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _Badge = _interopRequireDefault(require("../Badge"));
15
+
16
+ var _satellitePrefixer = _interopRequireDefault(require("../styles/helpers/satellitePrefixer"));
17
+
18
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
19
+
20
+ /**
21
+ * Put more emphasis on side content.
22
+
23
+ * ## Examples
24
+ * [See the component in Figma](https://www.figma.com/file/99l59il97k2n5y4n6Jucal/%5BSatellite%5D-Components?node-id=2912%3A279499)
25
+
26
+ * ## Current Status
27
+ * - [x] Figma
28
+ * - [x] React
29
+ * - [ ] Documentation
30
+
31
+ * ## Component structure
32
+ * The component is a simple and flexible container. It should include a Title and a short text. To give more context you can use optional badges and an optional link to forward users in the right direction.
33
+
34
+ * ## Guidelines
35
+
36
+ * ### How to use it?
37
+ * Use the `Insert` if you want to give extra information to the user about the flow they are in or to highlight and define some terms used. This component can be use on the side of existing content or as a block.
38
+
39
+ * ### How to NOT use it?
40
+ * - Don't use this component to display temporary and/or critical information, use an Alert instead.
41
+
42
+ * ### Variants
43
+ * - Grey background
44
+
45
+ * ### Do's and Don't
46
+ * TODO
47
+
48
+ * ## Accessibility
49
+ * TODO
50
+ */
51
+ var Insert = function Insert(_ref) {
52
+ var title = _ref.title,
53
+ contexts = _ref.contexts,
54
+ children = _ref.children;
55
+ return /*#__PURE__*/_react["default"].createElement("aside", {
56
+ className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["inline-flex flex-col self-start p-4 bg-grey-100 rounded"])))
57
+ }, contexts ? /*#__PURE__*/_react["default"].createElement("span", {
58
+ className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["block space-x-2 mb-4"])))
59
+ }, contexts.map(function (context, idx) {
60
+ var _ref2 = typeof context === "string" ? {
61
+ label: context
62
+ } : context,
63
+ label = _ref2.label,
64
+ _ref2$variant = _ref2.variant,
65
+ variant = _ref2$variant === void 0 ? "grey" : _ref2$variant;
66
+
67
+ return /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
68
+ key: idx,
69
+ variant: variant
70
+ }, label);
71
+ })) : null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", {
72
+ className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["display-heading mb-2"])))
73
+ }, title), /*#__PURE__*/_react["default"].createElement("span", {
74
+ className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["display-body typo-subdued"])))
75
+ }, children)));
76
+ };
77
+
78
+ exports.Insert = Insert;
79
+ var _default = Insert;
80
+ exports["default"] = _default;
@@ -0,0 +1,2 @@
1
+ export * from "./Insert";
2
+ export { default } from "./Insert";
@@ -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 _Insert["default"];
13
+ }
14
+ });
15
+
16
+ var _Insert = _interopRequireWildcard(require("./Insert"));
17
+
18
+ Object.keys(_Insert).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] === _Insert[key]) return;
22
+ Object.defineProperty(exports, key, {
23
+ enumerable: true,
24
+ get: function get() {
25
+ return _Insert[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; }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import type { ColumnDefinition, Row, Status, SelectMode, PaginationConfiguration, Sorting, DataConfiguration, GetItemId } from "./types";
3
3
  declare type CanSelectItem<Item> = (item: Item, idx: number) => boolean;
4
- export interface DataTableProps<Item> {
4
+ interface BaseDataTableProps<Item> {
5
5
  data: Item[];
6
6
  itemId?: GetItemId<Item>;
7
7
  pagination?: PaginationConfiguration;
@@ -11,13 +11,22 @@ export interface DataTableProps<Item> {
11
11
  noDataContent?: React.ReactNode;
12
12
  errorContent?: React.ReactNode;
13
13
  columns: ColumnDefinition<Item>[];
14
- selectMode?: SelectMode;
15
- selection?: string[];
16
- onSelectionChange?(rowId: string[]): void;
17
- canSelectItem?: CanSelectItem<Item>;
18
14
  canHoverRow?(row: Row<Item>): boolean;
19
15
  onRowHoveredChanged?(row: Row<Item> | null): void;
20
16
  }
17
+ declare type DataTableWithSelectMode<Item> = {
18
+ selectMode: Exclude<SelectMode, "none">;
19
+ selection?: string[];
20
+ onSelectionChange?(rowId: string[]): void;
21
+ canSelectItem?: CanSelectItem<Item>;
22
+ };
23
+ declare type DataTableWithoutSelectMode = {
24
+ selectMode?: Extract<SelectMode, "none">;
25
+ selection?: never;
26
+ onSelectionChange?: never;
27
+ canSelectItem?: never;
28
+ };
29
+ export declare type DataTableProps<Item> = BaseDataTableProps<Item> & (DataTableWithSelectMode<Item> | DataTableWithoutSelectMode);
21
30
  /**
22
31
  * Tables are used to structure content in a grid to make it easier to see relationships and to facilitate understanding.
23
32
  *
@@ -41,7 +41,7 @@ var _Body = _interopRequireDefault(require("./components/Body"));
41
41
 
42
42
  var _Loader = _interopRequireDefault(require("./components/Loader"));
43
43
 
44
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
44
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
45
45
 
46
46
  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); }
47
47
 
@@ -122,11 +122,9 @@ var DataTable = function DataTable(_ref) {
122
122
  setHoveredRowId(undefined);
123
123
  }, [data]);
124
124
  var computedColumns = (0, _compact["default"])([selectMode === "single" && {
125
- id: "singleSelect",
126
- accessor: "singleSelect",
127
- Header: function Header() {
128
- return null;
129
- },
125
+ id: "_internal_singleSelect",
126
+ accessor: "_internal_singleSelect",
127
+ Header: false,
130
128
  Cell: function Cell(_ref2) {
131
129
  var row = _ref2.row;
132
130
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -139,11 +137,11 @@ var DataTable = function DataTable(_ref) {
139
137
  },
140
138
  className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["w-3"])))
141
139
  }, selectMode === "multi" && {
142
- id: "multiSelect",
143
- accessor: "multiSelect",
140
+ id: "_internal_multiSelect",
141
+ accessor: "_internal_multiSelect",
144
142
  Header: function Header() {
145
143
  var unselectableRows = rows.filter(function (row) {
146
- return !row.selectable;
144
+ return !row.selectable && row.selected;
147
145
  }).map(function (r) {
148
146
  return r.id;
149
147
  });
@@ -155,39 +153,38 @@ var DataTable = function DataTable(_ref) {
155
153
  var selectionLength = (selection !== null && selection !== void 0 ? selection : []).length;
156
154
  var dataLength = pagination ? pagination.itemsPerPage : data.length;
157
155
  var isChecked = selectionLength === dataLength;
156
+ var isIndeterminate = selectionLength > 0 && selectionLength !== dataLength;
158
157
  return /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
159
- "aria-label": "Select all",
158
+ "aria-label": "Select all" // Small hack to position the checkbox in the center of the header
159
+ ,
160
+ className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["absolute mb-2.5"]))),
160
161
  checked: isChecked,
161
- indeterminate: selectionLength > 0 && selectionLength !== dataLength,
162
+ indeterminate: isIndeterminate,
162
163
  onClick: function onClick() {
163
- return isChecked ? onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(unselectableRows) : onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange([].concat((0, _toConsumableArray2["default"])(unselectableRows), (0, _toConsumableArray2["default"])(selectableRows)));
164
+ return isChecked ? onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(unselectableRows) : isIndeterminate ? onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(selectionLength === selectableRows.length + unselectableRows.length ? unselectableRows : [].concat((0, _toConsumableArray2["default"])(unselectableRows), (0, _toConsumableArray2["default"])(selectableRows))) : onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange([].concat((0, _toConsumableArray2["default"])(unselectableRows), (0, _toConsumableArray2["default"])(selectableRows)));
164
165
  }
165
166
  });
166
167
  },
167
168
  Cell: function Cell(_ref3) {
168
169
  var row = _ref3.row;
169
170
  return /*#__PURE__*/_react["default"].createElement("div", {
170
- className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["flex"])))
171
+ className: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["flex"])))
171
172
  }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
172
173
  checked: row.selected,
173
174
  disabled: !row.selectable,
174
- className: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["", ""])), row.hovered || row.selected ? "opacity-100" : "opacity-0 select-none")
175
+ className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["", ""])), row.hovered || row.selected ? "opacity-100" : "opacity-0 select-none")
175
176
  }));
176
177
  },
177
- className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["w-3"])))
178
+ className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["w-3"])))
178
179
  }].concat((0, _toConsumableArray2["default"])(columns.map(function (c) {
179
180
  var _c$Header;
180
181
 
181
182
  return typeof c === "string" ? {
182
183
  id: c,
183
184
  accessor: c,
184
- Header: function Header() {
185
- return /*#__PURE__*/_react["default"].createElement("span", null, (0, _utils.toSentenceCase)(c));
186
- }
185
+ Header: (0, _utils.toSentenceCase)(c)
187
186
  } : _objectSpread(_objectSpread({}, c), {}, {
188
- Header: (_c$Header = c.Header) !== null && _c$Header !== void 0 ? _c$Header : function () {
189
- return /*#__PURE__*/_react["default"].createElement("span", null, (0, _utils.toSentenceCase)(c.id));
190
- }
187
+ Header: (_c$Header = c.Header) !== null && _c$Header !== void 0 ? _c$Header : (0, _utils.toSentenceCase)(c.id)
191
188
  });
192
189
  }))));
193
190
  var getItemIdInternal = itemId || DEFAULT_GET_ITEM_ID;
@@ -242,13 +239,13 @@ var DataTable = function DataTable(_ref) {
242
239
  };
243
240
 
244
241
  return /*#__PURE__*/_react["default"].createElement("div", {
245
- className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["relative"])))
242
+ className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["relative"])))
246
243
  }, status === "loading" && /*#__PURE__*/_react["default"].createElement("div", {
247
- className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["absolute bg-white z-10 bg-opacity-50 w-full h-full flex items-center justify-center"])))
244
+ className: (0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["absolute bg-white z-10 bg-opacity-50 w-full h-full flex items-center justify-center"])))
248
245
  }, /*#__PURE__*/_react["default"].createElement(_Loader["default"], {
249
- className: (0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["-mt-12"])))
246
+ className: (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["-mt-12"])))
250
247
  })), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
251
- className: (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["datatable ", " ", ""])), status === "loading" && "pointer-events-none select-none", status === "loading" && data.length === 0 && "h-48"),
248
+ className: (0, _satellitePrefixer["default"])(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["datatable ", " ", ""])), status === "loading" && "pointer-events-none select-none", status === "loading" && data.length === 0 && "h-48"),
252
249
  highlight: false,
253
250
  footer: pagination !== false && /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
254
251
  pagination: pagination,
@@ -33,9 +33,9 @@ var Header = function Header(_ref) {
33
33
  disabled: disabled,
34
34
  sortingDirection: sortingDirection[1],
35
35
  onToggleSort: onToggleSort
36
- }, Header ? /*#__PURE__*/_react["default"].createElement(Header, {
36
+ }, !Header ? null : typeof Header === "string" ? Header : /*#__PURE__*/_react["default"].createElement(Header, {
37
37
  column: column
38
- }) : Header);
38
+ }));
39
39
  })));
40
40
  };
41
41
 
@@ -46,7 +46,7 @@ var HeaderCell = function HeaderCell(_ref) {
46
46
  },
47
47
  className: (0, _classnames["default"])(className, (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["group ", ""])), sort && (disabled ? "cursor-not-allowed" : "cursor-pointer")))
48
48
  }), /*#__PURE__*/_react["default"].createElement("span", {
49
- className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["flex items-center"])))
49
+ className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["inline-flex items-center"])))
50
50
  }, children, sort ? sortingDirection === "desc" ? /*#__PURE__*/_react["default"].createElement(_reactFeather.ChevronDown, {
51
51
  className: iconClassName
52
52
  }) : sortingDirection === "asc" ? /*#__PURE__*/_react["default"].createElement(_reactFeather.ChevronUp, {
@@ -25,7 +25,7 @@ export interface AdvancedColumnDefinition<Item> {
25
25
  /** A string or a function which determines how to get the column data */
26
26
  accessor: string | ((item: Item) => any);
27
27
  sort?: boolean;
28
- Header?: React.ComponentType<HeaderProps<Item>>;
28
+ Header?: React.ComponentType<HeaderProps<Item>> | string | false;
29
29
  Cell?: React.ComponentType<CellProps<Item>>;
30
30
  className?: string;
31
31
  }
package/cjs/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from "./AutoComplete";
9
9
  export * from "./Avatars";
10
10
  export * from "./Badge";
11
11
  export * from "./Banner";
12
+ export * from "./Banners";
12
13
  export * from "./Button";
13
14
  export * from "./Card";
14
15
  export * from "./Checkbox";
@@ -21,6 +22,7 @@ export * from "./Flag";
21
22
  export * from "./FlexGrid";
22
23
  export * from "./HelpUnderline";
23
24
  export * from "./Input";
25
+ export * from "./Insert";
24
26
  export * from "./Link";
25
27
  export * from "./Medallion";
26
28
  export * from "./Modal";
package/cjs/index.js CHANGED
@@ -142,6 +142,20 @@ Object.keys(_Banner).forEach(function (key) {
142
142
  });
143
143
  });
144
144
 
145
+ var _Banners = require("./Banners");
146
+
147
+ Object.keys(_Banners).forEach(function (key) {
148
+ if (key === "default" || key === "__esModule") return;
149
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
150
+ if (key in exports && exports[key] === _Banners[key]) return;
151
+ Object.defineProperty(exports, key, {
152
+ enumerable: true,
153
+ get: function get() {
154
+ return _Banners[key];
155
+ }
156
+ });
157
+ });
158
+
145
159
  var _Button = require("./Button");
146
160
 
147
161
  Object.keys(_Button).forEach(function (key) {
@@ -310,6 +324,20 @@ Object.keys(_Input).forEach(function (key) {
310
324
  });
311
325
  });
312
326
 
327
+ var _Insert = require("./Insert");
328
+
329
+ Object.keys(_Insert).forEach(function (key) {
330
+ if (key === "default" || key === "__esModule") return;
331
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
332
+ if (key in exports && exports[key] === _Insert[key]) return;
333
+ Object.defineProperty(exports, key, {
334
+ enumerable: true,
335
+ get: function get() {
336
+ return _Insert[key];
337
+ }
338
+ });
339
+ });
340
+
313
341
  var _Link = require("./Link");
314
342
 
315
343
  Object.keys(_Link).forEach(function (key) {
@@ -25,7 +25,10 @@ export interface BannerDefaultProps extends BannerPropsBase {
25
25
  title?: React.ReactNode;
26
26
  }
27
27
  export declare type BannerProps = BannerPageProps | BannerDefaultProps;
28
+ /** @deprecated use the new `Alert` component instead */
28
29
  /**
30
+ * <p className="stl-space-x-2"><span className="stl-bg-orange-200 stl-font-bold stl-text-orange-800 stl-px-2 stl-py-1.5 stl-rounded">🌇 Sunsetting</span><span>use the new `Alert` component instead</span></p>
31
+ *
29
32
  * Banners inform users about important changes or persistent conditions. Use this component if you need
30
33
  * to communicate to users in a prominent way. Take in consideration 3 levels of hierarchy when deciding
31
34
  * on the appropriate banner to use:
@@ -5,6 +5,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
5
5
  import React from "react";
6
6
  import cx from "classnames";
7
7
  import { AlertCircle, AlertTriangle, AlertOctagon, CheckCircle, X } from "react-feather";
8
+ import { IconButton } from "../Button";
8
9
  import stl from "../styles/helpers/satellitePrefixer";
9
10
 
10
11
  function isBannerDefaultProps(props) {
@@ -58,7 +59,11 @@ var TITLE_CLASSNAME_VARIANTS = {
58
59
  orange: stl(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["text-orange-900"]))),
59
60
  red: stl(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["text-red-900"])))
60
61
  };
62
+ /** @deprecated use the new `Alert` component instead */
63
+
61
64
  /**
65
+ * <p className="stl-space-x-2"><span className="stl-bg-orange-200 stl-font-bold stl-text-orange-800 stl-px-2 stl-py-1.5 stl-rounded">🌇 Sunsetting</span><span>use the new `Alert` component instead</span></p>
66
+ *
62
67
  * Banners inform users about important changes or persistent conditions. Use this component if you need
63
68
  * to communicate to users in a prominent way. Take in consideration 3 levels of hierarchy when deciding
64
69
  * on the appropriate banner to use:
@@ -134,15 +139,17 @@ export var Banner = function Banner(props) {
134
139
  className: cx(stl(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["display-heading mb-1"]))), TITLE_CLASSNAME_VARIANTS[variant])
135
140
  }, props.title), /*#__PURE__*/React.createElement("div", {
136
141
  className: stl(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["", " ", ""])), usageContext === "page" && "text-center", subduedContent && "text-grey-600")
137
- }, children)), onDismiss && /*#__PURE__*/React.createElement("button", {
138
- className: stl(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["absolute top-0 right-0 mt-2 mr-2"]))),
139
- "aria-label": "Close banner",
142
+ }, children)), onDismiss && /*#__PURE__*/React.createElement("span", {
143
+ className: stl(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["absolute top-2 right-2"])))
144
+ }, /*#__PURE__*/React.createElement(IconButton, {
145
+ title: "Close banner",
146
+ variant: "subtle",
147
+ size: "small",
148
+ icon: X,
140
149
  onClick: function onClick(evt) {
141
150
  evt.stopPropagation();
142
151
  onDismiss();
143
152
  }
144
- }, /*#__PURE__*/React.createElement(X, {
145
- size: "1rem"
146
153
  })));
147
154
  };
148
155
  export default Banner;
@@ -0,0 +1,69 @@
1
+ import React, { FunctionComponent } from "react";
2
+ import { ColorVariant, IconComponentType } from "../../types";
3
+ export declare type AlertContextType = "page" | "section";
4
+ declare type AlertColorVariant = Exclude<ColorVariant, "blue">;
5
+ export interface AlertProps {
6
+ /** @ignore */
7
+ className?: string;
8
+ /** @ignore */
9
+ style?: React.CSSProperties;
10
+ title?: React.ReactNode;
11
+ /** @default grey */
12
+ variant?: AlertColorVariant;
13
+ /** @default section */
14
+ usageContext?: AlertContextType;
15
+ icon?: IconComponentType;
16
+ onDismiss?(): void;
17
+ }
18
+ /**
19
+ * Alerts inform users about important changes or temporally conditions. Use this component if you need to communicate something to users in a prominent way.
20
+
21
+ * ## Examples
22
+ * [See the component in Figma](https://www.figma.com/file/99l59il97k2n5y4n6Jucal/%5BSatellite%5D-Components?node-id=2912%3A262266)
23
+
24
+ * ## Current Status
25
+ * - [x] Figma
26
+ * - [x] React
27
+ * - [ ] Documentation
28
+
29
+ * ## Component structure
30
+ * This component uses a common banner structure. It uses an icon that should match the intent of the message, an optional title _(Highly recommended)_, a short paragraph of text and optional buttons for follow up actions. The `Alert` is dismissible by default, to do so a cross icon is displayed on the top-right corner.
31
+
32
+ * ## Guidelines
33
+ * ### How to use it?
34
+ * Use the `Alert` if you want to inform the user about a specific action they need to do after something happened.
35
+
36
+ * ### How to NOT use it?
37
+ * Do not use the component to give higher visibility to trivial information, use the [Insert](https://algolia-satellite.netlify.app/?path=/docs/indicators-banners-insert--basic) component instead.
38
+ * Make sure that alerts are not stacking, We highly recommend to have only one per page if possible, though we understand that sometimes this is not possible.
39
+ * Do not use a product wide `Alert` to display features information.
40
+
41
+ * ### Variants
42
+ * This component comes with two sets of Variants:
43
+
44
+ * #### Color
45
+ * - `Grey` `Default`
46
+ * Use this as your default Alert if no other color matches your use-case.
47
+ * - `Accent` `Primary`
48
+ * Use this to represent something that is currently happening with no level of severity.
49
+ * - `Green` `Success`
50
+ * Use this to inform the user that an action has been completed in the background while the user wasn't on that page and/or needs further exploration from the user. For smaller and quick processes use the [Flag](https://algolia-satellite.netlify.app/?path=/docs/indicators-flag--basic) instead.
51
+ * - `Orange` `Warning`
52
+ * Use this to show the user that something important requires their attention. The warning should be used for low to medium errors.
53
+ * - `Red` `Failure`
54
+ * Use this to show the user that something requires their full attention and actions. Only use red for critical warnings that will result in a loss of data of production down time.
55
+
56
+ * #### Usage Context
57
+ * - `Page`
58
+ * This is for global and product wide alerts, use that with extreme caution as it's will impact every page and every feature.
59
+ * - `Section`
60
+ * This alert should be inside the frame of a section and linked to the content it impacts
61
+
62
+ * ### Do's and Don't
63
+ * TODO
64
+
65
+ * ## Accessibility
66
+ * TODO
67
+ */
68
+ export declare const Alert: FunctionComponent<AlertProps>;
69
+ export default Alert;