@algolia/satellite 1.0.0-beta.123 → 1.0.0-beta.127

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 (69) 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/Dropzone/Dropzone.d.ts +16 -0
  19. package/cjs/Dropzone/Dropzone.js +179 -0
  20. package/cjs/Dropzone/index.d.ts +2 -0
  21. package/cjs/Dropzone/index.js +32 -0
  22. package/cjs/Insert/Insert.d.ts +43 -0
  23. package/cjs/Insert/Insert.js +80 -0
  24. package/cjs/Insert/index.d.ts +2 -0
  25. package/cjs/Insert/index.js +32 -0
  26. package/cjs/Tables/DataTable/DataTable.d.ts +14 -5
  27. package/cjs/Tables/DataTable/DataTable.js +11 -16
  28. package/cjs/Tables/DataTable/components/Header.js +2 -2
  29. package/cjs/Tables/DataTable/types.d.ts +1 -1
  30. package/cjs/index.d.ts +3 -0
  31. package/cjs/index.js +42 -0
  32. package/cjs/utils/formatters.d.ts +25 -0
  33. package/cjs/utils/formatters.js +51 -0
  34. package/esm/Banner/Banner.d.ts +3 -0
  35. package/esm/Banner/Banner.js +12 -5
  36. package/esm/Banners/Alert/Alert.d.ts +69 -0
  37. package/esm/Banners/Alert/Alert.js +127 -0
  38. package/esm/Banners/Alert/index.d.ts +2 -0
  39. package/esm/Banners/Alert/index.js +2 -0
  40. package/esm/Banners/BigBertha/BigBertha.d.ts +40 -0
  41. package/esm/Banners/BigBertha/BigBertha.js +54 -0
  42. package/esm/Banners/BigBertha/index.d.ts +2 -0
  43. package/esm/Banners/BigBertha/index.js +2 -0
  44. package/esm/Banners/Promote/Promote.d.ts +56 -0
  45. package/esm/Banners/Promote/Promote.js +95 -0
  46. package/esm/Banners/Promote/index.d.ts +2 -0
  47. package/esm/Banners/Promote/index.js +2 -0
  48. package/esm/Banners/index.d.ts +3 -0
  49. package/esm/Banners/index.js +3 -0
  50. package/esm/Button/Button.tailwind.js +1 -1
  51. package/esm/Dropzone/Dropzone.d.ts +16 -0
  52. package/esm/Dropzone/Dropzone.js +148 -0
  53. package/esm/Dropzone/index.d.ts +2 -0
  54. package/esm/Dropzone/index.js +2 -0
  55. package/esm/Insert/Insert.d.ts +43 -0
  56. package/esm/Insert/Insert.js +66 -0
  57. package/esm/Insert/index.d.ts +2 -0
  58. package/esm/Insert/index.js +2 -0
  59. package/esm/Tables/DataTable/DataTable.d.ts +14 -5
  60. package/esm/Tables/DataTable/DataTable.js +11 -16
  61. package/esm/Tables/DataTable/components/Header.js +2 -2
  62. package/esm/Tables/DataTable/types.d.ts +1 -1
  63. package/esm/index.d.ts +3 -0
  64. package/esm/index.js +3 -0
  65. package/esm/utils/formatters.d.ts +25 -0
  66. package/esm/utils/formatters.js +40 -0
  67. package/package.json +2 -1
  68. package/satellite.css +1 -1
  69. package/satellite.min.css +1 -1
@@ -0,0 +1,2 @@
1
+ export * from "./Promote";
2
+ export { default } from "./Promote";
@@ -0,0 +1,3 @@
1
+ export * from "./Alert";
2
+ export * from "./BigBertha";
3
+ export * from "./Promote";
@@ -0,0 +1,3 @@
1
+ export * from "./Alert";
2
+ export * from "./BigBertha";
3
+ export * from "./Promote";
@@ -29,7 +29,7 @@ var buttonPlugin = function buttonPlugin(_ref) {
29
29
  ".btn-subtle": {
30
30
  color: theme("colors.grey.600"),
31
31
  "&:hover": {
32
- background: theme("colors.grey.100")
32
+ background: rgba(theme("colors.grey.300"), 0.15)
33
33
  },
34
34
  "&:focus": {
35
35
  boxShadow: "0 0 0 1px ".concat(theme("colors.accent.600"))
@@ -0,0 +1,16 @@
1
+ import { FC } from "react";
2
+ import { DropzoneProps as ReactDropZoneProps, FileRejection } from "react-dropzone";
3
+ interface DropzoneBaseProps {
4
+ id?: string;
5
+ onChange?(acceptedFiles: File[], fileRejections: FileRejection[]): void;
6
+ placeholder?: string;
7
+ /** @default false */
8
+ clearable?: boolean;
9
+ /** @ignore */
10
+ className?: string;
11
+ /** @default false */
12
+ multiple?: boolean;
13
+ }
14
+ export declare type DropzoneProps = DropzoneBaseProps & Omit<ReactDropZoneProps, "onDrop" | "onDropAccepted" | "onDropRejected" | "multiple">;
15
+ export declare const Dropzone: FC<DropzoneProps>;
16
+ export default Dropzone;
@@ -0,0 +1,148 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
6
+ var _excluded = ["id", "placeholder", "disabled", "multiple", "clearable", "onChange", "className"];
7
+
8
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
9
+
10
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
11
+
12
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
13
+
14
+ import cx from "classnames";
15
+ import React, { useCallback, useMemo, useState } from "react";
16
+ import { useDropzone } from "react-dropzone";
17
+ import { Check, UploadCloud, X } from "react-feather";
18
+ import { IconButton } from "../Button";
19
+ import { useFieldState } from "../Field";
20
+ import stl from "../styles/helpers/satellitePrefixer";
21
+ import { formatHumanSize } from "../utils/formatters";
22
+ import { uniqueId } from "../utils/uniqueId";
23
+
24
+ var DropzoneFileItem = function DropzoneFileItem(_ref) {
25
+ var file = _ref.file;
26
+ return /*#__PURE__*/React.createElement("span", {
27
+ className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["truncate text-grey-900"])))
28
+ }, file.name, " - ", formatHumanSize(file.size));
29
+ };
30
+
31
+ var STATUS_CLASSNAMES = {
32
+ "default": "",
33
+ invalid: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["input-invalid"]))),
34
+ validated: ""
35
+ };
36
+
37
+ var InvalidIcon = function InvalidIcon() {
38
+ return /*#__PURE__*/React.createElement(X, {
39
+ className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["mr-4 h-4 w-4 text-white bg-red-700 p-px rounded-full"])))
40
+ });
41
+ };
42
+
43
+ var ValidatedIcon = function ValidatedIcon() {
44
+ return /*#__PURE__*/React.createElement(Check, {
45
+ className: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["mr-4 h-4 w-4 text-white bg-accent-700 p-px rounded-full"])))
46
+ });
47
+ };
48
+
49
+ export var Dropzone = function Dropzone(_ref2) {
50
+ var id = _ref2.id,
51
+ placeholder = _ref2.placeholder,
52
+ disabled = _ref2.disabled,
53
+ _ref2$multiple = _ref2.multiple,
54
+ multiple = _ref2$multiple === void 0 ? false : _ref2$multiple,
55
+ _ref2$clearable = _ref2.clearable,
56
+ clearable = _ref2$clearable === void 0 ? false : _ref2$clearable,
57
+ onChange = _ref2.onChange,
58
+ className = _ref2.className,
59
+ props = _objectWithoutProperties(_ref2, _excluded);
60
+
61
+ var _useState = useState([]),
62
+ _useState2 = _slicedToArray(_useState, 2),
63
+ files = _useState2[0],
64
+ setFiles = _useState2[1];
65
+
66
+ var _useState3 = useState(false),
67
+ _useState4 = _slicedToArray(_useState3, 2),
68
+ focused = _useState4[0],
69
+ setFocused = _useState4[1];
70
+
71
+ var _useFieldState = useFieldState(),
72
+ status = _useFieldState.status;
73
+
74
+ var onDrop = useCallback(function (acceptedFiles, fileRejections) {
75
+ setFiles([].concat(_toConsumableArray(files), _toConsumableArray(acceptedFiles)));
76
+ onChange === null || onChange === void 0 ? void 0 : onChange([].concat(_toConsumableArray(files), _toConsumableArray(acceptedFiles)), fileRejections);
77
+ }, [files, onChange]);
78
+
79
+ var handleClear = function handleClear(evt) {
80
+ evt.stopPropagation();
81
+ setFiles([]);
82
+ onChange === null || onChange === void 0 ? void 0 : onChange([], []);
83
+ };
84
+
85
+ var _useDropzone = useDropzone(_objectSpread(_objectSpread({
86
+ disabled: disabled,
87
+ multiple: multiple
88
+ }, props), {}, {
89
+ onDrop: onDrop
90
+ })),
91
+ getRootProps = _useDropzone.getRootProps,
92
+ getInputProps = _useDropzone.getInputProps,
93
+ isDragActive = _useDropzone.isDragActive,
94
+ isDragReject = _useDropzone.isDragReject;
95
+
96
+ var dropzoneId = useMemo(function () {
97
+ return id !== null && id !== void 0 ? id : uniqueId("dropzone");
98
+ }, [id]);
99
+ var isValueEmpty = files.length === 0;
100
+ var StatusIcon = status === "invalid" ? InvalidIcon : status === "validated" ? ValidatedIcon : React.Fragment;
101
+ return /*#__PURE__*/React.createElement("div", getRootProps({
102
+ "aria-controls": dropzoneId,
103
+ className: cx(stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n input group\n ", "\n ", "\n min-h-16 cursor-pointer\n ", ""])), focused && "input-focused", disabled && "input-disabled cursor-not-allowed", isDragReject ? "border-red-200 cursor-not-allowed" : isDragActive ? "border-nebula-500" : null), STATUS_CLASSNAMES[status], className),
104
+ onClick: function onClick(evt) {
105
+ // Helps with https://github.com/react-dropzone/react-dropzone/issues/182
106
+ if (evt.target.closest("label")) {
107
+ evt.stopPropagation();
108
+ }
109
+ }
110
+ }), /*#__PURE__*/React.createElement("input", getInputProps({
111
+ id: dropzoneId,
112
+ onFocus: function onFocus() {
113
+ return setFocused(true);
114
+ },
115
+ onBlur: function onBlur() {
116
+ return setFocused(false);
117
+ }
118
+ })), /*#__PURE__*/React.createElement("div", {
119
+ className: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["flex-1 flex items-center justify-center space-x-2 display-body"])))
120
+ }, files.length > 0 ? files.length > 1 ? /*#__PURE__*/React.createElement("ul", null, files.map(function (file) {
121
+ return /*#__PURE__*/React.createElement("li", {
122
+ key: file.name
123
+ }, /*#__PURE__*/React.createElement(DropzoneFileItem, {
124
+ file: file
125
+ }));
126
+ })) : /*#__PURE__*/React.createElement(DropzoneFileItem, {
127
+ file: files[0]
128
+ }) : /*#__PURE__*/React.createElement("div", {
129
+ className: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["flex items-center justify-center space-x-2 display-body"])))
130
+ }, /*#__PURE__*/React.createElement(UploadCloud, {
131
+ size: "1rem",
132
+ className: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["", ""])), disabled ? "text-grey-200" : "text-grey-500")
133
+ }), /*#__PURE__*/React.createElement("p", {
134
+ className: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["", ""])), disabled ? "text-grey-300" : "typo-subdued")
135
+ }, placeholder !== null && placeholder !== void 0 ? placeholder : "Drop ".concat(multiple ? "files" : "file", " here or click to select.")))), clearable && !disabled && !isValueEmpty && /*#__PURE__*/React.createElement("span", {
136
+ className: stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral([""])))
137
+ }, /*#__PURE__*/React.createElement(IconButton, {
138
+ className: stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["mr-2 ", ""])), focused ? "visible" : "invisible group-hover:visible"),
139
+ title: "Clear input",
140
+ icon: X,
141
+ variant: "subtle",
142
+ size: "small",
143
+ tabIndex: -1,
144
+ "aria-hidden": true,
145
+ onClick: handleClear
146
+ })), /*#__PURE__*/React.createElement(StatusIcon, null));
147
+ };
148
+ export default Dropzone;
@@ -0,0 +1,2 @@
1
+ export * from "./Dropzone";
2
+ export { default } from "./Dropzone";
@@ -0,0 +1,2 @@
1
+ export * from "./Dropzone";
2
+ export { default } from "./Dropzone";
@@ -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,66 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
+
5
+ import React from "react";
6
+ import Badge from "../Badge";
7
+ import stl from "../styles/helpers/satellitePrefixer";
8
+
9
+ /**
10
+ * Put more emphasis on side content.
11
+
12
+ * ## Examples
13
+ * [See the component in Figma](https://www.figma.com/file/99l59il97k2n5y4n6Jucal/%5BSatellite%5D-Components?node-id=2912%3A279499)
14
+
15
+ * ## Current Status
16
+ * - [x] Figma
17
+ * - [x] React
18
+ * - [ ] Documentation
19
+
20
+ * ## Component structure
21
+ * 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.
22
+
23
+ * ## Guidelines
24
+
25
+ * ### How to use it?
26
+ * 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.
27
+
28
+ * ### How to NOT use it?
29
+ * - Don't use this component to display temporary and/or critical information, use an Alert instead.
30
+
31
+ * ### Variants
32
+ * - Grey background
33
+
34
+ * ### Do's and Don't
35
+ * TODO
36
+
37
+ * ## Accessibility
38
+ * TODO
39
+ */
40
+ export var Insert = function Insert(_ref) {
41
+ var title = _ref.title,
42
+ contexts = _ref.contexts,
43
+ children = _ref.children;
44
+ return /*#__PURE__*/React.createElement("aside", {
45
+ className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["inline-flex flex-col self-start p-4 bg-grey-100 rounded"])))
46
+ }, contexts ? /*#__PURE__*/React.createElement("span", {
47
+ className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["block space-x-2 mb-4"])))
48
+ }, contexts.map(function (context, idx) {
49
+ var _ref2 = typeof context === "string" ? {
50
+ label: context
51
+ } : context,
52
+ label = _ref2.label,
53
+ _ref2$variant = _ref2.variant,
54
+ variant = _ref2$variant === void 0 ? "grey" : _ref2$variant;
55
+
56
+ return /*#__PURE__*/React.createElement(Badge, {
57
+ key: idx,
58
+ variant: variant
59
+ }, label);
60
+ })) : null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
61
+ className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["display-heading mb-2"])))
62
+ }, title), /*#__PURE__*/React.createElement("span", {
63
+ className: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["display-body typo-subdued"])))
64
+ }, children)));
65
+ };
66
+ export default Insert;
@@ -0,0 +1,2 @@
1
+ export * from "./Insert";
2
+ export { default } from "./Insert";
@@ -0,0 +1,2 @@
1
+ export * from "./Insert";
2
+ export { default } from "./Insert";
@@ -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
  *
@@ -93,11 +93,9 @@ export var DataTable = function DataTable(_ref) {
93
93
  setHoveredRowId(undefined);
94
94
  }, [data]);
95
95
  var computedColumns = compact([selectMode === "single" && {
96
- id: "singleSelect",
97
- accessor: "singleSelect",
98
- Header: function Header() {
99
- return null;
100
- },
96
+ id: "_internal_singleSelect",
97
+ accessor: "_internal_singleSelect",
98
+ Header: false,
101
99
  Cell: function Cell(_ref2) {
102
100
  var row = _ref2.row;
103
101
  return /*#__PURE__*/React.createElement("div", {
@@ -110,11 +108,11 @@ export var DataTable = function DataTable(_ref) {
110
108
  },
111
109
  className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["w-3"])))
112
110
  }, selectMode === "multi" && {
113
- id: "multiSelect",
114
- accessor: "multiSelect",
111
+ id: "_internal_multiSelect",
112
+ accessor: "_internal_multiSelect",
115
113
  Header: function Header() {
116
114
  var unselectableRows = rows.filter(function (row) {
117
- return !row.selectable;
115
+ return !row.selectable && row.selected;
118
116
  }).map(function (r) {
119
117
  return r.id;
120
118
  });
@@ -126,14 +124,15 @@ export var DataTable = function DataTable(_ref) {
126
124
  var selectionLength = (selection !== null && selection !== void 0 ? selection : []).length;
127
125
  var dataLength = pagination ? pagination.itemsPerPage : data.length;
128
126
  var isChecked = selectionLength === dataLength;
127
+ var isIndeterminate = selectionLength > 0 && selectionLength !== dataLength;
129
128
  return /*#__PURE__*/React.createElement(Checkbox, {
130
129
  "aria-label": "Select all" // Small hack to position the checkbox in the center of the header
131
130
  ,
132
131
  className: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["absolute mb-2.5"]))),
133
132
  checked: isChecked,
134
- indeterminate: selectionLength > 0 && selectionLength !== dataLength,
133
+ indeterminate: isIndeterminate,
135
134
  onClick: function onClick() {
136
- return isChecked ? onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(unselectableRows) : onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange([].concat(_toConsumableArray(unselectableRows), _toConsumableArray(selectableRows)));
135
+ 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(_toConsumableArray(unselectableRows), _toConsumableArray(selectableRows))) : onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange([].concat(_toConsumableArray(unselectableRows), _toConsumableArray(selectableRows)));
137
136
  }
138
137
  });
139
138
  },
@@ -154,13 +153,9 @@ export var DataTable = function DataTable(_ref) {
154
153
  return typeof c === "string" ? {
155
154
  id: c,
156
155
  accessor: c,
157
- Header: function Header() {
158
- return /*#__PURE__*/React.createElement("span", null, toSentenceCase(c));
159
- }
156
+ Header: toSentenceCase(c)
160
157
  } : _objectSpread(_objectSpread({}, c), {}, {
161
- Header: (_c$Header = c.Header) !== null && _c$Header !== void 0 ? _c$Header : function () {
162
- return /*#__PURE__*/React.createElement("span", null, toSentenceCase(c.id));
163
- }
158
+ Header: (_c$Header = c.Header) !== null && _c$Header !== void 0 ? _c$Header : toSentenceCase(c.id)
164
159
  });
165
160
  }))));
166
161
  var getItemIdInternal = itemId || DEFAULT_GET_ITEM_ID;
@@ -21,9 +21,9 @@ export var Header = function Header(_ref) {
21
21
  disabled: disabled,
22
22
  sortingDirection: sortingDirection[1],
23
23
  onToggleSort: onToggleSort
24
- }, Header ? /*#__PURE__*/React.createElement(Header, {
24
+ }, !Header ? null : typeof Header === "string" ? Header : /*#__PURE__*/React.createElement(Header, {
25
25
  column: column
26
- }) : Header);
26
+ }));
27
27
  })));
28
28
  };
29
29
  export default Header;
@@ -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/esm/index.d.ts CHANGED
@@ -9,18 +9,21 @@ 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";
15
16
  export * from "./ClickAwayContainer";
16
17
  export * from "./DatePicker";
17
18
  export * from "./Dropdown";
19
+ export * from "./Dropzone";
18
20
  export * from "./EmptyState";
19
21
  export * from "./Field";
20
22
  export * from "./Flag";
21
23
  export * from "./FlexGrid";
22
24
  export * from "./HelpUnderline";
23
25
  export * from "./Input";
26
+ export * from "./Insert";
24
27
  export * from "./Link";
25
28
  export * from "./Medallion";
26
29
  export * from "./Modal";
package/esm/index.js CHANGED
@@ -9,18 +9,21 @@ 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";
15
16
  export * from "./ClickAwayContainer";
16
17
  export * from "./DatePicker";
17
18
  export * from "./Dropdown";
19
+ export * from "./Dropzone";
18
20
  export * from "./EmptyState";
19
21
  export * from "./Field";
20
22
  export * from "./Flag";
21
23
  export * from "./FlexGrid";
22
24
  export * from "./HelpUnderline";
23
25
  export * from "./Input";
26
+ export * from "./Insert";
24
27
  export * from "./Link";
25
28
  export * from "./Medallion";
26
29
  export * from "./Modal";
@@ -0,0 +1,25 @@
1
+ declare const defaultHumanSizes: string[];
2
+ export declare function numberWithCommas(x: number | string, precision?: number): string;
3
+ export declare function formatHumanNumber(bytes: number, options?: {
4
+ /** @default 2 */
5
+ decimals?: number;
6
+ /** @default ['', 'K', 'M', 'B', 'T'] */
7
+ sizes?: typeof defaultHumanSizes;
8
+ /** @default 1000 */
9
+ divider?: number;
10
+ /**
11
+ * Hides the decimal points if they're 0
12
+ * @default false
13
+ */
14
+ prettyDecimals?: boolean;
15
+ }): string;
16
+ export declare function formatHumanSize(nb: number, options?: {
17
+ /** @default 2 */
18
+ decimals?: number;
19
+ /**
20
+ * Hides the decimal points if they're 0
21
+ * @default false
22
+ */
23
+ prettyDecimals?: boolean;
24
+ }): string;
25
+ export {};
@@ -0,0 +1,40 @@
1
+ var defaultHumanSizes = ["", "K", "M", "B", "T"];
2
+ export function numberWithCommas(x) {
3
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
4
+
5
+ if (typeof x !== "number") {
6
+ return x;
7
+ }
8
+
9
+ return (x || 0).toFixed(precision).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
10
+ }
11
+ export function formatHumanNumber(bytes, options) {
12
+ var _ref = options !== null && options !== void 0 ? options : {},
13
+ _ref$decimals = _ref.decimals,
14
+ decimals = _ref$decimals === void 0 ? 2 : _ref$decimals,
15
+ _ref$sizes = _ref.sizes,
16
+ sizes = _ref$sizes === void 0 ? defaultHumanSizes : _ref$sizes,
17
+ _ref$divider = _ref.divider,
18
+ divider = _ref$divider === void 0 ? 1000 : _ref$divider,
19
+ _ref$prettyDecimals = _ref.prettyDecimals,
20
+ prettyDecimals = _ref$prettyDecimals === void 0 ? false : _ref$prettyDecimals;
21
+
22
+ if (bytes === 0) return "0";
23
+ var i = Math.min(Math.max(0, Math.floor(Math.log(Math.abs(bytes)) / Math.log(divider))), sizes.length - 1);
24
+ var nb = bytes / Math.pow(divider, i);
25
+ return (Math.abs(nb) > 1000 ? numberWithCommas(nb, decimals) : prettyDecimals ? parseFloat(nb.toFixed(decimals)) : nb.toFixed(decimals)) + sizes[i];
26
+ }
27
+ export function formatHumanSize(nb, options) {
28
+ var _ref2 = options !== null && options !== void 0 ? options : {},
29
+ _ref2$decimals = _ref2.decimals,
30
+ decimals = _ref2$decimals === void 0 ? 2 : _ref2$decimals,
31
+ _ref2$prettyDecimals = _ref2.prettyDecimals,
32
+ prettyDecimals = _ref2$prettyDecimals === void 0 ? false : _ref2$prettyDecimals;
33
+
34
+ return formatHumanNumber(nb, {
35
+ decimals: decimals,
36
+ sizes: ["", "K", "M", "G", "T"],
37
+ divider: 1000,
38
+ prettyDecimals: prettyDecimals
39
+ }) + "B";
40
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/satellite",
3
- "version": "1.0.0-beta.123",
3
+ "version": "1.0.0-beta.127",
4
4
  "description": "Algolia design system React components",
5
5
  "scripts": {
6
6
  "clean": "del dist",
@@ -72,6 +72,7 @@
72
72
  "downshift": "^2.0.10",
73
73
  "lodash.throttle": "^4.1.1",
74
74
  "react-day-picker": "7.4.10",
75
+ "react-dropzone": "^11.5.1",
75
76
  "react-popper": "^2.2.5",
76
77
  "react-transition-group": "4.4.2",
77
78
  "react-use": "^15.3.8",
package/satellite.css CHANGED
@@ -1165,7 +1165,7 @@ html, body {
1165
1165
  }
1166
1166
 
1167
1167
  .stl-btn-subtle:hover {
1168
- background: #f5f5fa;
1168
+ background: rgba(182, 183, 213, 0.15);
1169
1169
  }
1170
1170
 
1171
1171
  .stl-btn-subtle:focus {