@algolia/satellite 1.0.0-beta.156 → 1.0.0-beta.158

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 (86) hide show
  1. package/cjs/Avatars/UserAvatar.d.ts +7 -3
  2. package/cjs/Avatars/UserAvatar.js +28 -28
  3. package/cjs/Badge/Badge.d.ts +2 -2
  4. package/cjs/Badge/Badge.js +7 -6
  5. package/cjs/Banners/Alert/Alert.js +1 -1
  6. package/cjs/Button/Button.d.ts +3 -5
  7. package/cjs/Button/Button.js +8 -51
  8. package/cjs/Button/Button.tailwind.js +0 -2
  9. package/cjs/Button/IconButton.d.ts +3 -15
  10. package/cjs/Button/IconButton.js +8 -62
  11. package/cjs/Button/PolymorphicButton.d.ts +11 -0
  12. package/cjs/Button/PolymorphicButton.js +76 -0
  13. package/cjs/Button/PolymorphicIconButton.d.ts +24 -0
  14. package/cjs/Button/PolymorphicIconButton.js +84 -0
  15. package/cjs/Button/index.d.ts +1 -1
  16. package/cjs/Button/index.js +16 -12
  17. package/cjs/Button/types.d.ts +11 -6
  18. package/cjs/Button/types.js +3 -1
  19. package/cjs/Dropdown/DropdownButton.d.ts +3 -3
  20. package/cjs/Dropdown/DropdownButton.js +5 -2
  21. package/cjs/FlexGrid/FlexGrid.js +1 -1
  22. package/cjs/Link/ButtonLink.d.ts +5 -3
  23. package/cjs/Link/ButtonLink.js +9 -6
  24. package/cjs/Link/IconButtonLink.d.ts +5 -4
  25. package/cjs/Link/IconButtonLink.js +8 -5
  26. package/cjs/Medallion/Medallion.js +1 -1
  27. package/cjs/Modal/Modal.d.ts +35 -11
  28. package/cjs/Modal/Modal.js +131 -95
  29. package/cjs/Modal/Modal.tailwind.js +7 -0
  30. package/cjs/RangeSlider/RangeSlider.js +1 -1
  31. package/cjs/Satellite/Satellite.d.ts +2 -1
  32. package/cjs/Satellite/Satellite.js +26 -2
  33. package/cjs/Satellite/locale.d.ts +2 -0
  34. package/cjs/Tables/DataTable/DataTable.js +12 -12
  35. package/cjs/Tag/Tag.d.ts +26 -6
  36. package/cjs/Tag/Tag.js +51 -19
  37. package/cjs/Tag/Tag.tailwind.js +17 -1
  38. package/cjs/Tooltip/Tooltip.tailwind.js +2 -1
  39. package/cjs/styles/colors.d.ts +18 -0
  40. package/cjs/styles/colors.js +33 -15
  41. package/cjs/types.d.ts +9 -0
  42. package/cjs/utils/isCssPropertySupported.d.ts +1 -1
  43. package/esm/Avatars/UserAvatar.d.ts +7 -3
  44. package/esm/Avatars/UserAvatar.js +28 -28
  45. package/esm/Badge/Badge.d.ts +2 -2
  46. package/esm/Badge/Badge.js +7 -6
  47. package/esm/Banners/Alert/Alert.js +1 -1
  48. package/esm/Button/Button.d.ts +3 -5
  49. package/esm/Button/Button.js +8 -52
  50. package/esm/Button/Button.tailwind.js +0 -2
  51. package/esm/Button/IconButton.d.ts +3 -15
  52. package/esm/Button/IconButton.js +8 -64
  53. package/esm/Button/PolymorphicButton.d.ts +11 -0
  54. package/esm/Button/PolymorphicButton.js +66 -0
  55. package/esm/Button/PolymorphicIconButton.d.ts +24 -0
  56. package/esm/Button/PolymorphicIconButton.js +78 -0
  57. package/esm/Button/index.d.ts +1 -1
  58. package/esm/Button/index.js +1 -1
  59. package/esm/Button/types.d.ts +11 -6
  60. package/esm/Button/types.js +3 -1
  61. package/esm/Dropdown/DropdownButton.d.ts +3 -3
  62. package/esm/Dropdown/DropdownButton.js +5 -2
  63. package/esm/Link/ButtonLink.d.ts +5 -3
  64. package/esm/Link/ButtonLink.js +9 -6
  65. package/esm/Link/IconButtonLink.d.ts +5 -4
  66. package/esm/Link/IconButtonLink.js +8 -5
  67. package/esm/Medallion/Medallion.js +1 -1
  68. package/esm/Modal/Modal.d.ts +35 -11
  69. package/esm/Modal/Modal.js +129 -96
  70. package/esm/Modal/Modal.tailwind.js +7 -0
  71. package/esm/RangeSlider/RangeSlider.js +2 -0
  72. package/esm/Satellite/Satellite.d.ts +2 -1
  73. package/esm/Satellite/Satellite.js +24 -1
  74. package/esm/Satellite/locale.d.ts +2 -0
  75. package/esm/Tables/DataTable/DataTable.js +12 -12
  76. package/esm/Tag/Tag.d.ts +26 -6
  77. package/esm/Tag/Tag.js +52 -20
  78. package/esm/Tag/Tag.tailwind.js +17 -1
  79. package/esm/Tooltip/Tooltip.tailwind.js +2 -1
  80. package/esm/styles/colors.d.ts +18 -0
  81. package/esm/styles/colors.js +33 -15
  82. package/esm/types.d.ts +9 -0
  83. package/esm/utils/isCssPropertySupported.d.ts +1 -1
  84. package/package.json +8 -4
  85. package/satellite.min.css +1 -1
  86. package/scss/colors.scss +27 -10
@@ -14,7 +14,7 @@ var _colors = _interopRequireDefault(require("../styles/colors"));
14
14
  var _satellitePrefixer = _interopRequireDefault(require("../styles/helpers/satellitePrefixer"));
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
16
  var _excluded = ["className", "value", "defaultValue", "onChange", "onCommit", "disabled", "min", "max", "track1Color", "track2Color"];
17
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
17
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8; // Prevents unwanted number narrowing
18
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
19
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
20
  var TRACK_SHADOWS_CLASSNAME = (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["shadow-[inset_0_1px_3px_0_rgb(0_0_0_/_10%),0_0.5px_0_0_rgb(255_255_255_/_5%)]"])));
@@ -1,4 +1,4 @@
1
- import type { FunctionComponent, ReactNode } from "react";
1
+ import { type FunctionComponent, type ReactNode } from "react";
2
2
  import type { ComponentsLocales } from "./locale";
3
3
  import type { SatelliteRouter } from "./SatelliteRouter";
4
4
  export interface SatelliteProps {
@@ -7,5 +7,6 @@ export interface SatelliteProps {
7
7
  portalTarget?: HTMLElement;
8
8
  children: ReactNode;
9
9
  }
10
+ export declare const DEFAULT_PORTAL_TARGET_ID = "satellite-portal";
10
11
  export declare const Satellite: FunctionComponent<SatelliteProps>;
11
12
  export default Satellite;
@@ -4,16 +4,40 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports["default"] = exports.Satellite = void 0;
7
+ exports["default"] = exports.Satellite = exports.DEFAULT_PORTAL_TARGET_ID = void 0;
8
+ var _react = require("react");
8
9
  var _SatelliteContext = _interopRequireDefault(require("./SatelliteContext"));
9
10
  var _SatelliteRouter = require("./SatelliteRouter");
10
11
  var _jsxRuntime = require("react/jsx-runtime");
12
+ var DEFAULT_PORTAL_TARGET_ID = "satellite-portal";
13
+ exports.DEFAULT_PORTAL_TARGET_ID = DEFAULT_PORTAL_TARGET_ID;
14
+ var portalElement;
15
+ var getPortalElement = function getPortalElement() {
16
+ if (typeof document === "undefined") return;
17
+ if (!portalElement) {
18
+ var element = document.createElement("div");
19
+ element.setAttribute("id", DEFAULT_PORTAL_TARGET_ID);
20
+ document.body.appendChild(element);
21
+ portalElement = element;
22
+ }
23
+ return portalElement;
24
+ };
11
25
  var Satellite = function Satellite(_ref) {
12
26
  var _ref$router = _ref.router,
13
27
  router = _ref$router === void 0 ? _SatelliteRouter.router : _ref$router,
14
28
  locales = _ref.locales,
15
- portalTarget = _ref.portalTarget,
29
+ _ref$portalTarget = _ref.portalTarget,
30
+ portalTarget = _ref$portalTarget === void 0 ? getPortalElement() : _ref$portalTarget,
16
31
  children = _ref.children;
32
+ (0, _react.useEffect)(function () {
33
+ if (!portalTarget) return;
34
+ if (portalTarget === document.body) {
35
+ console.warn("Avoid using the document body as a portal target.");
36
+ }
37
+
38
+ // Radix adds pointer-events: none; on the body for its modal, so we need to reenable it for other portaled elements (tooltips, menus, autocomplete)
39
+ portalTarget.style.pointerEvents = "auto";
40
+ }, [portalTarget]);
17
41
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SatelliteContext["default"].Provider, {
18
42
  value: {
19
43
  router: router,
@@ -1,5 +1,6 @@
1
1
  import type { AnnouncementBadgeLocale } from "../AnnouncementBadge";
2
2
  import type { AutoCompleteLocale } from "../AutoComplete";
3
+ import type { UserAvatarLocale } from "../Avatars/UserAvatar";
3
4
  import type { DatePickerLocale } from "../DatePicker/types";
4
5
  import type { DropzoneLocale } from "../Dropzone";
5
6
  import type { FlagLocale } from "../Flag";
@@ -25,5 +26,6 @@ export declare type ComponentsLocales = {
25
26
  pagination?: PaginationLocale;
26
27
  sidebar?: SidebarLocale;
27
28
  tag?: TagLocale;
29
+ userAvatar?: UserAvatarLocale;
28
30
  };
29
31
  export declare const useLocale: <ComponentKey extends keyof ComponentsLocales>(componentKey: ComponentKey) => ComponentsLocales[ComponentKey];
@@ -24,7 +24,7 @@ var _Header = _interopRequireDefault(require("./components/Header"));
24
24
  var _Loader = _interopRequireDefault(require("./components/Loader"));
25
25
  var _utils2 = require("./utils");
26
26
  var _jsxRuntime = require("react/jsx-runtime");
27
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
27
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
28
28
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
29
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
30
30
  var DEFAULT_DATATABLE_LOCALE = {
@@ -36,6 +36,9 @@ var DEFAULT_DATATABLE_LOCALE = {
36
36
  errorTitle: "Error",
37
37
  errorDescription: "An error occurred while loading data."
38
38
  };
39
+
40
+ // Selection
41
+
39
42
  var DEFAULT_GET_ITEM_ID = function DEFAULT_GET_ITEM_ID(_, idx) {
40
43
  return String(idx);
41
44
  };
@@ -139,10 +142,7 @@ var DataTable = function DataTable(_ref) {
139
142
  var isChecked = selectionLength === dataLength;
140
143
  var isIndeterminate = selectionLength > 0 && selectionLength !== dataLength;
141
144
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox["default"], {
142
- "aria-label": locale.selectAllButton
143
- // Small hack to position the checkbox in the center of the header
144
- ,
145
- className: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["absolute mb-2.5"]))),
145
+ "aria-label": locale.selectAllButton,
146
146
  checked: isChecked,
147
147
  indeterminate: isIndeterminate,
148
148
  onClick: function onClick() {
@@ -153,15 +153,15 @@ var DataTable = function DataTable(_ref) {
153
153
  Cell: function Cell(_ref3) {
154
154
  var row = _ref3.row;
155
155
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
156
- className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["flex"]))),
156
+ className: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["flex"]))),
157
157
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox["default"], {
158
158
  checked: row.selected,
159
159
  disabled: !row.selectable,
160
- className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["", ""])), row.hovered || row.selected ? "opacity-100" : "opacity-0 select-none")
160
+ className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["", ""])), row.hovered || row.selected ? "opacity-100" : "opacity-0 select-none")
161
161
  })
162
162
  });
163
163
  },
164
- className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["w-3"])))
164
+ className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["w-3"])))
165
165
  }].concat((0, _toConsumableArray2["default"])(columns.map(function (c) {
166
166
  var _c$Header;
167
167
  return typeof c === "string" ? {
@@ -221,15 +221,15 @@ var DataTable = function DataTable(_ref) {
221
221
  return onChange === null || onChange === void 0 ? void 0 : onChange(dataConfiguration);
222
222
  };
223
223
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
224
- className: (0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["relative"]))),
224
+ className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["relative"]))),
225
225
  children: [status === "loading" && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
226
- className: (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["absolute bg-white/50 z-10 w-full h-full flex items-center justify-center"]))),
226
+ className: (0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["absolute bg-white/50 z-10 w-full h-full flex items-center justify-center"]))),
227
227
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loader["default"], {
228
- className: (0, _satellitePrefixer["default"])(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["-mt-12"]))),
228
+ className: (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["-mt-12"]))),
229
229
  locale: locale
230
230
  })
231
231
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Table["default"], {
232
- className: (0, _satellitePrefixer["default"])(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["datatable ", " ", ""])), status === "loading" && "pointer-events-none select-none", status === "loading" && data.length === 0 && "h-48"),
232
+ className: (0, _satellitePrefixer["default"])(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["datatable ", " ", ""])), status === "loading" && "pointer-events-none select-none", status === "loading" && data.length === 0 && "h-48"),
233
233
  highlight: false,
234
234
  footer: shouldRenderPagination() && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Footer["default"], {
235
235
  pagination: pagination,
package/cjs/Tag/Tag.d.ts CHANGED
@@ -2,20 +2,40 @@ import type { DetailedHTMLProps, HTMLAttributes, MouseEventHandler } from "react
2
2
  import type { ColorVariant } from "../types";
3
3
  export declare type TagVariants = ColorVariant | "pink";
4
4
  export declare type TagLocale = {
5
- removeButton?: string | ((title: string) => string);
5
+ addButton?: string | ((title: string) => string);
6
+ deleteButton?: string | ((title: string) => string);
6
7
  };
7
8
  export interface TagProps extends DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> {
8
9
  /**
9
10
  * The "pink" variant should only be used for **Algolia admin** related things.
10
11
  * @default "grey"
11
- * */
12
+ */
12
13
  variant?: TagVariants;
14
+ /**
15
+ * Handler function called when the "add" button is clicked.
16
+ */
17
+ onAdd?: MouseEventHandler<HTMLElement>;
18
+ /**
19
+ * The tooltip text to display when hovering over the "add" button.
20
+ */
21
+ addTooltip?: string;
22
+ /**
23
+ * Handler function called when the "delete" button is clicked.
24
+ */
13
25
  onDelete?: MouseEventHandler<HTMLElement>;
26
+ /**
27
+ * The tooltip text to display when hovering over the "delete" button.
28
+ */
29
+ deleteTooltip?: string;
30
+ /**
31
+ * Customize the text describing the "add" and "delete" buttons.
32
+ * If not provided, default values will be used.
33
+ */
14
34
  locale?: TagLocale;
15
35
  }
16
36
  /**
17
- * Use tags to visually label UI objects for quick recognition and navigation. (!) **Tags can be added or removed from an object by users**.
18
- * Keep in mind that tags increase the amount of visual noise, particularly when combined with other visual labelling elements, so use them in moderation. Tags can be added or removed from an object by users.
37
+ * Use tags to visually label UI objects for quick recognition and navigation. (!) **Tags can be added or deleted from an object by users**.
38
+ * Keep in mind that tags increase the amount of visual noise, particularly when combined with other visual labelling elements, so use them in moderation. Tags can be added or deleted from an object by users.
19
39
  *
20
40
  * - For status information, use badges instead
21
41
  * - For tallies or counts, use badges
@@ -30,9 +50,9 @@ export interface TagProps extends DetailedHTMLProps<HTMLAttributes<HTMLSpanEleme
30
50
  * - **Error**: `variant="red"`
31
51
  *
32
52
  * ## Usability best practices
33
- * - Present tags close to or within the input control to allow users to add and remove tags
53
+ * - Present tags close to or within the input control to allow users to add and delete tags
34
54
  * - When writing tags, avoid line-wrapping
35
55
  * - Define the max width of text within a tag. Once the text reaches the max, truncate with ellipses
36
56
  */
37
- export declare const Tag: import("react").ForwardRefExoticComponent<Pick<TagProps, "key" | "id" | "color" | "translate" | "hidden" | "dir" | "slot" | "style" | "title" | "accessKey" | "draggable" | "lang" | "className" | "prefix" | "children" | "contentEditable" | "inputMode" | "tabIndex" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "locale" | "onDelete"> & import("react").RefAttributes<HTMLSpanElement>>;
57
+ export declare const Tag: import("react").ForwardRefExoticComponent<Pick<TagProps, "key" | "id" | "color" | "translate" | "hidden" | "dir" | "slot" | "style" | "title" | "accessKey" | "draggable" | "lang" | "className" | "prefix" | "children" | "contentEditable" | "inputMode" | "tabIndex" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "locale" | "onAdd" | "addTooltip" | "onDelete" | "deleteTooltip"> & import("react").RefAttributes<HTMLSpanElement>>;
38
58
  export default Tag;
package/cjs/Tag/Tag.js CHANGED
@@ -13,14 +13,18 @@ var _react = require("react");
13
13
  var _reactFeather = require("react-feather");
14
14
  var _Satellite = require("../Satellite");
15
15
  var _satellitePrefixer = _interopRequireDefault(require("../styles/helpers/satellitePrefixer"));
16
+ var _Tooltip = require("../Tooltip");
16
17
  var _jsxRuntime = require("react/jsx-runtime");
17
- var _excluded = ["children", "variant", "className", "onDelete", "locale"];
18
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
18
+ var _excluded = ["children", "variant", "className", "onAdd", "addTooltip", "onDelete", "deleteTooltip", "locale"];
19
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21;
19
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
21
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
22
  var DEFAULT_TAG_LOCALE = {
22
- removeButton: function removeButton(title) {
23
- return "Remove ".concat(title);
23
+ addButton: function addButton(title) {
24
+ return "Add ".concat(title);
25
+ },
26
+ deleteButton: function deleteButton(title) {
27
+ return "Delete ".concat(title);
24
28
  }
25
29
  };
26
30
  var VARIANT_CLASSNAMES = {
@@ -32,7 +36,7 @@ var VARIANT_CLASSNAMES = {
32
36
  red: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["bg-red-100 border-red-200 text-red-700"]))),
33
37
  pink: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["bg-pink-100 border-pink-200 text-pink-700"])))
34
38
  };
35
- var BUTTON_CLOSE_VARIANT_CLASSNAMES = {
39
+ var BUTTON_VARIANT_CLASSNAMES = {
36
40
  accent: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["border-accent-200 hover:bg-accent-200 focus:bg-accent-200"]))),
37
41
  grey: (0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["border-grey-200 hover:bg-grey-200 focus:bg-grey-200"]))),
38
42
  blue: (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["border-blue-200 hover:bg-blue-200 focus:bg-blue-200"]))),
@@ -43,8 +47,8 @@ var BUTTON_CLOSE_VARIANT_CLASSNAMES = {
43
47
  };
44
48
 
45
49
  /**
46
- * Use tags to visually label UI objects for quick recognition and navigation. (!) **Tags can be added or removed from an object by users**.
47
- * Keep in mind that tags increase the amount of visual noise, particularly when combined with other visual labelling elements, so use them in moderation. Tags can be added or removed from an object by users.
50
+ * Use tags to visually label UI objects for quick recognition and navigation. (!) **Tags can be added or deleted from an object by users**.
51
+ * Keep in mind that tags increase the amount of visual noise, particularly when combined with other visual labelling elements, so use them in moderation. Tags can be added or deleted from an object by users.
48
52
  *
49
53
  * - For status information, use badges instead
50
54
  * - For tallies or counts, use badges
@@ -59,7 +63,7 @@ var BUTTON_CLOSE_VARIANT_CLASSNAMES = {
59
63
  * - **Error**: `variant="red"`
60
64
  *
61
65
  * ## Usability best practices
62
- * - Present tags close to or within the input control to allow users to add and remove tags
66
+ * - Present tags close to or within the input control to allow users to add and delete tags
63
67
  * - When writing tags, avoid line-wrapping
64
68
  * - Define the max width of text within a tag. Once the text reaches the max, truncate with ellipses
65
69
  */
@@ -68,31 +72,59 @@ var Tag = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
68
72
  _ref$variant = _ref.variant,
69
73
  variant = _ref$variant === void 0 ? "grey" : _ref$variant,
70
74
  className = _ref.className,
75
+ onAdd = _ref.onAdd,
76
+ addTooltip = _ref.addTooltip,
71
77
  onDelete = _ref.onDelete,
78
+ deleteTooltip = _ref.deleteTooltip,
72
79
  propsLocale = _ref.locale,
73
80
  props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
74
81
  var title = typeof children === "string" ? children : "tag";
75
82
  var contextLocale = (0, _Satellite.useLocale)("tag");
76
83
  var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_TAG_LOCALE), contextLocale), propsLocale);
77
84
  var tagClassName = (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["tag"]))), VARIANT_CLASSNAMES[variant], className);
78
- var editable = Boolean(onDelete);
85
+ var addable = Boolean(onAdd);
86
+ var deletable = Boolean(onDelete);
87
+ var handleAdd = function handleAdd(evt) {
88
+ evt.stopPropagation();
89
+ onAdd === null || onAdd === void 0 ? void 0 : onAdd(evt);
90
+ };
79
91
  var handleDelete = function handleDelete(evt) {
80
92
  evt.stopPropagation();
81
93
  onDelete === null || onDelete === void 0 ? void 0 : onDelete(evt);
82
94
  };
95
+ var content = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
96
+ className: (0, _satellitePrefixer["default"])(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["truncate flex-1 leading-base"]))),
97
+ children: children
98
+ });
83
99
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", _objectSpread(_objectSpread({}, props), {}, {
84
100
  className: tagClassName,
85
101
  ref: ref,
86
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
87
- className: (0, _satellitePrefixer["default"])(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["truncate flex-1"]))),
88
- children: children
89
- }), editable && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
90
- className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["tag-close-button"]))), BUTTON_CLOSE_VARIANT_CLASSNAMES[variant]),
91
- type: "button",
92
- onClick: handleDelete,
93
- "aria-label": typeof locale.removeButton === "function" ? locale.removeButton(title) : locale.removeButton,
94
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFeather.X, {
95
- size: "1em"
102
+ children: [addable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.TooltipWrapper, {
103
+ content: addTooltip,
104
+ hideDelay: 0,
105
+ placement: "bottom",
106
+ wrapperClassName: (0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["h-full"]))),
107
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
108
+ className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["tag-add-button"]))), !deletable && (0, _satellitePrefixer["default"])(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2["default"])(["-mr-2"]))), BUTTON_VARIANT_CLASSNAMES[variant]),
109
+ type: "button",
110
+ onClick: handleAdd,
111
+ "aria-label": typeof locale.addButton === "function" ? locale.addButton(title) : locale.addButton,
112
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFeather.Plus, {
113
+ size: "1em"
114
+ }), content]
115
+ })
116
+ }) : content, deletable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.TooltipWrapper, {
117
+ content: deleteTooltip,
118
+ hideDelay: 0,
119
+ placement: "bottom-start",
120
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
121
+ className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2["default"])(["tag-close-button p-1"]))), !addable && (0, _satellitePrefixer["default"])(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2["default"])(["ml-2"]))), BUTTON_VARIANT_CLASSNAMES[variant]),
122
+ type: "button",
123
+ onClick: handleDelete,
124
+ "aria-label": typeof locale.deleteButton === "function" ? locale.deleteButton(title) : locale.deleteButton,
125
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFeather.X, {
126
+ size: "1em"
127
+ })
96
128
  })
97
129
  })]
98
130
  }));
@@ -17,11 +17,27 @@ var tagPlugin = plugin(function (_ref) {
17
17
  fontSize: theme("fontSize.base"),
18
18
  lineHeight: theme("lineHeight.sm")
19
19
  },
20
+ ".tag-add-button": {
21
+ display: "inline-flex",
22
+ alignItems: "center",
23
+ height: "100%",
24
+ paddingLeft: theme("spacing.2"),
25
+ paddingRight: theme("spacing.2"),
26
+ marginLeft: "-".concat(theme("spacing.2")),
27
+ columnGap: theme("spacing.2"),
28
+ "&, &:focus": {
29
+ outlineWidth: "0px"
30
+ },
31
+ "&:focus-visible": {
32
+ outlineOffset: "-2px",
33
+ outlineWidth: "3px",
34
+ outlineColor: theme("colors.accent.600")
35
+ }
36
+ },
20
37
  ".tag-close-button": {
21
38
  height: "100%",
22
39
  paddingLeft: theme("spacing.1"),
23
40
  paddingRight: theme("spacing.1"),
24
- marginLeft: theme("spacing.2"),
25
41
  marginRight: "-".concat(theme("spacing.2")),
26
42
  borderLeft: "1px solid transparent",
27
43
  "&, &:focus": {
@@ -29,7 +29,8 @@ var tooltipPlugin = plugin(function (_ref) {
29
29
  },
30
30
  ".tooltip-dark": {
31
31
  ".typo-link": {
32
- color: theme("colors.accent.300")
32
+ color: theme("colors.accent.300"),
33
+ textDecoration: "underline"
33
34
  }
34
35
  },
35
36
  ".tooltip-light": {
@@ -23,6 +23,7 @@ export const pink: {
23
23
  300: string;
24
24
  200: string;
25
25
  100: string;
26
+ 50: string;
26
27
  };
27
28
  export const nebula: {
28
29
  900: string;
@@ -45,6 +46,7 @@ export const xenon: {
45
46
  300: string;
46
47
  200: string;
47
48
  100: string;
49
+ 50: string;
48
50
  };
49
51
  export const blue: {
50
52
  900: string;
@@ -56,6 +58,7 @@ export const blue: {
56
58
  300: string;
57
59
  200: string;
58
60
  100: string;
61
+ 50: string;
59
62
  };
60
63
  export const green: {
61
64
  900: string;
@@ -67,6 +70,7 @@ export const green: {
67
70
  300: string;
68
71
  200: string;
69
72
  100: string;
73
+ 50: string;
70
74
  };
71
75
  export const orange: {
72
76
  900: string;
@@ -78,6 +82,7 @@ export const orange: {
78
82
  300: string;
79
83
  200: string;
80
84
  100: string;
85
+ 50: string;
81
86
  };
82
87
  export const red: {
83
88
  900: string;
@@ -89,4 +94,17 @@ export const red: {
89
94
  300: string;
90
95
  200: string;
91
96
  100: string;
97
+ 50: string;
98
+ };
99
+ export const purple: {
100
+ 900: string;
101
+ 800: string;
102
+ 700: string;
103
+ 600: string;
104
+ 500: string;
105
+ 400: string;
106
+ 300: string;
107
+ 200: string;
108
+ 100: string;
109
+ 50: string;
92
110
  };
@@ -26,7 +26,8 @@ var colors = {
26
26
  400: "#fb5abc",
27
27
  300: "#fd89ce",
28
28
  200: "#feb9e2",
29
- 100: "#ffeaf6"
29
+ 100: "#ffeaf6",
30
+ 50: "#fff5fb"
30
31
  },
31
32
  nebula: {
32
33
  900: "#141d61",
@@ -48,7 +49,8 @@ var colors = {
48
49
  400: "#457aff",
49
50
  300: "#76a0ff",
50
51
  200: "#bbd1ff",
51
- 100: "#f2f4ff"
52
+ 100: "#f2f4ff",
53
+ 50: "#f9f9ff"
52
54
  },
53
55
  blue: {
54
56
  900: "#00526c",
@@ -59,18 +61,20 @@ var colors = {
59
61
  400: "#5adaff",
60
62
  300: "#89e5ff",
61
63
  200: "#b9efff",
62
- 100: "#e8faff"
64
+ 100: "#e8faff",
65
+ 50: "#f3fdff"
63
66
  },
64
67
  green: {
65
- 900: "#005e36",
66
- 800: "#028950",
67
- 700: "#06b66c",
68
- 600: "#0de589",
69
- 500: "#5feb9e",
70
- 400: "#88f0b3",
71
- 300: "#aaf4c8",
72
- 200: "#c9f8de",
73
- 100: "#e6fcf3"
68
+ 900: "#005d43",
69
+ 800: "#007046",
70
+ 700: "#008b4a",
71
+ 600: "#00a648",
72
+ 500: "#00c241",
73
+ 400: "#4ade6d",
74
+ 300: "#86f195",
75
+ 200: "#bffbc2",
76
+ 100: "#e5fde4",
77
+ 50: "#f2fef1"
74
78
  },
75
79
  orange: {
76
80
  900: "#963209",
@@ -81,18 +85,32 @@ var colors = {
81
85
  400: "#fcbc73",
82
86
  300: "#fed59a",
83
87
  200: "#ffe9c3",
84
- 100: "#fff9ec"
88
+ 100: "#fff9ec",
89
+ 50: "#fffcf5"
85
90
  },
86
91
  red: {
87
92
  900: "#83111e",
88
93
  800: "#ab1325",
89
94
  700: "#d4142a",
90
- 600: "#ee243c",
95
+ 600: "#e9122c",
91
96
  500: "#f4495d",
92
97
  400: "#f86e7e",
93
98
  300: "#fc95a1",
94
99
  200: "#febdc5",
95
- 100: "#ffe6e9"
100
+ 100: "#ffe6e9",
101
+ 50: "#fff3f4"
102
+ },
103
+ purple: {
104
+ 900: "#3c0b93",
105
+ 800: "#5612b7",
106
+ 700: "#731adb",
107
+ 600: "#9524ff",
108
+ 500: "#b75aff",
109
+ 400: "#cc7bff",
110
+ 300: "#e2a7ff",
111
+ 200: "#f2d3ff",
112
+ 100: "#fcf4ff",
113
+ 50: "#fdf9ff"
96
114
  }
97
115
  };
98
116
  module.exports = colors;
package/cjs/types.d.ts CHANGED
@@ -17,3 +17,12 @@ export declare type AtLeastOne<T, U = {
17
17
  export declare type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
18
18
  [Property in Key]-?: Type[Property];
19
19
  };
20
+ declare type Without<T, U> = {
21
+ [P in Exclude<keyof T, keyof U>]?: never;
22
+ };
23
+ /**
24
+ * Makes two types mutually exclusive
25
+ * https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types
26
+ */
27
+ export declare type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
28
+ export {};
@@ -1,2 +1,2 @@
1
- declare const isCssPropertySupported: <P extends number | "filter" | "fill" | "animationName" | "all" | "offset" | "height" | "width" | "left" | "top" | "item" | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignmentBaseline" | "animation" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationPlayState" | "animationTimingFunction" | "appearance" | "aspectRatio" | "backfaceVisibility" | "background" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "baselineShift" | "blockSize" | "border" | "borderBlock" | "borderBlockColor" | "borderBlockEnd" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStart" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBlockStyle" | "borderBlockWidth" | "borderBottom" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderColor" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImage" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInline" | "borderInlineColor" | "borderInlineEnd" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStart" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderInlineStyle" | "borderInlineWidth" | "borderLeft" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRadius" | "borderRight" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderStyle" | "borderTop" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "borderWidth" | "bottom" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "clear" | "clip" | "clipPath" | "clipRule" | "color" | "colorInterpolation" | "colorInterpolationFilters" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRule" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "columns" | "contain" | "content" | "counterIncrement" | "counterReset" | "counterSet" | "cssFloat" | "cssText" | "cursor" | "direction" | "display" | "dominantBaseline" | "emptyCells" | "fillOpacity" | "fillRule" | "flex" | "flexBasis" | "flexDirection" | "flexFlow" | "flexGrow" | "flexShrink" | "flexWrap" | "float" | "floodColor" | "floodOpacity" | "font" | "fontFamily" | "fontFeatureSettings" | "fontKerning" | "fontOpticalSizing" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontVariationSettings" | "fontWeight" | "gap" | "grid" | "gridArea" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumn" | "gridColumnEnd" | "gridColumnGap" | "gridColumnStart" | "gridGap" | "gridRow" | "gridRowEnd" | "gridRowGap" | "gridRowStart" | "gridTemplate" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hyphens" | "imageOrientation" | "imageRendering" | "inlineSize" | "inset" | "insetBlock" | "insetBlockEnd" | "insetBlockStart" | "insetInline" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lightingColor" | "lineBreak" | "lineHeight" | "listStyle" | "listStyleImage" | "listStylePosition" | "listStyleType" | "margin" | "marginBlock" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInline" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marker" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "maskType" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetRotate" | "opacity" | "order" | "orphans" | "outline" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "padding" | "paddingBlock" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInline" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "placeContent" | "placeItems" | "placeSelf" | "pointerEvents" | "position" | "quotes" | "resize" | "right" | "rotate" | "rowGap" | "rubyPosition" | "scale" | "scrollBehavior" | "scrollMargin" | "scrollMarginBlock" | "scrollMarginBlockEnd" | "scrollMarginBlockStart" | "scrollMarginBottom" | "scrollMarginInline" | "scrollMarginInlineEnd" | "scrollMarginInlineStart" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPadding" | "scrollPaddingBlock" | "scrollPaddingBlockEnd" | "scrollPaddingBlockStart" | "scrollPaddingBottom" | "scrollPaddingInline" | "scrollPaddingInlineEnd" | "scrollPaddingInlineStart" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapStop" | "scrollSnapType" | "scrollbarGutter" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textAnchor" | "textCombineUpright" | "textDecoration" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasis" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transition" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "visibility" | "webkitAlignContent" | "webkitAlignItems" | "webkitAlignSelf" | "webkitAnimation" | "webkitAnimationDelay" | "webkitAnimationDirection" | "webkitAnimationDuration" | "webkitAnimationFillMode" | "webkitAnimationIterationCount" | "webkitAnimationName" | "webkitAnimationPlayState" | "webkitAnimationTimingFunction" | "webkitAppearance" | "webkitBackfaceVisibility" | "webkitBackgroundClip" | "webkitBackgroundOrigin" | "webkitBackgroundSize" | "webkitBorderBottomLeftRadius" | "webkitBorderBottomRightRadius" | "webkitBorderRadius" | "webkitBorderTopLeftRadius" | "webkitBorderTopRightRadius" | "webkitBoxAlign" | "webkitBoxFlex" | "webkitBoxOrdinalGroup" | "webkitBoxOrient" | "webkitBoxPack" | "webkitBoxShadow" | "webkitBoxSizing" | "webkitFilter" | "webkitFlex" | "webkitFlexBasis" | "webkitFlexDirection" | "webkitFlexFlow" | "webkitFlexGrow" | "webkitFlexShrink" | "webkitFlexWrap" | "webkitJustifyContent" | "webkitLineClamp" | "webkitMask" | "webkitMaskBoxImage" | "webkitMaskBoxImageOutset" | "webkitMaskBoxImageRepeat" | "webkitMaskBoxImageSlice" | "webkitMaskBoxImageSource" | "webkitMaskBoxImageWidth" | "webkitMaskClip" | "webkitMaskComposite" | "webkitMaskImage" | "webkitMaskOrigin" | "webkitMaskPosition" | "webkitMaskRepeat" | "webkitMaskSize" | "webkitOrder" | "webkitPerspective" | "webkitPerspectiveOrigin" | "webkitTextFillColor" | "webkitTextStroke" | "webkitTextStrokeColor" | "webkitTextStrokeWidth" | "webkitTransform" | "webkitTransformOrigin" | "webkitTransformStyle" | "webkitTransition" | "webkitTransitionDelay" | "webkitTransitionDuration" | "webkitTransitionProperty" | "webkitTransitionTimingFunction" | "webkitUserSelect" | "whiteSpace" | "widows" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex" | "getPropertyPriority" | "getPropertyValue" | "removeProperty" | "setProperty">(prop: P, value: CSSStyleDeclaration[P]) => boolean;
1
+ declare const isCssPropertySupported: <P extends number | typeof Symbol.iterator | "filter" | "fill" | "animationName" | "all" | "offset" | "height" | "width" | "left" | "top" | "item" | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignmentBaseline" | "animation" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationPlayState" | "animationTimingFunction" | "appearance" | "aspectRatio" | "backfaceVisibility" | "background" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "baselineShift" | "blockSize" | "border" | "borderBlock" | "borderBlockColor" | "borderBlockEnd" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStart" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBlockStyle" | "borderBlockWidth" | "borderBottom" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderColor" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImage" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInline" | "borderInlineColor" | "borderInlineEnd" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStart" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderInlineStyle" | "borderInlineWidth" | "borderLeft" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRadius" | "borderRight" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderStyle" | "borderTop" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "borderWidth" | "bottom" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "clear" | "clip" | "clipPath" | "clipRule" | "color" | "colorInterpolation" | "colorInterpolationFilters" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRule" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "columns" | "contain" | "content" | "counterIncrement" | "counterReset" | "counterSet" | "cssFloat" | "cssText" | "cursor" | "direction" | "display" | "dominantBaseline" | "emptyCells" | "fillOpacity" | "fillRule" | "flex" | "flexBasis" | "flexDirection" | "flexFlow" | "flexGrow" | "flexShrink" | "flexWrap" | "float" | "floodColor" | "floodOpacity" | "font" | "fontFamily" | "fontFeatureSettings" | "fontKerning" | "fontOpticalSizing" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontVariationSettings" | "fontWeight" | "gap" | "grid" | "gridArea" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumn" | "gridColumnEnd" | "gridColumnGap" | "gridColumnStart" | "gridGap" | "gridRow" | "gridRowEnd" | "gridRowGap" | "gridRowStart" | "gridTemplate" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hyphens" | "imageOrientation" | "imageRendering" | "inlineSize" | "inset" | "insetBlock" | "insetBlockEnd" | "insetBlockStart" | "insetInline" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lightingColor" | "lineBreak" | "lineHeight" | "listStyle" | "listStyleImage" | "listStylePosition" | "listStyleType" | "margin" | "marginBlock" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInline" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marker" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "maskType" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetRotate" | "opacity" | "order" | "orphans" | "outline" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "padding" | "paddingBlock" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInline" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "placeContent" | "placeItems" | "placeSelf" | "pointerEvents" | "position" | "quotes" | "resize" | "right" | "rotate" | "rowGap" | "rubyPosition" | "scale" | "scrollBehavior" | "scrollMargin" | "scrollMarginBlock" | "scrollMarginBlockEnd" | "scrollMarginBlockStart" | "scrollMarginBottom" | "scrollMarginInline" | "scrollMarginInlineEnd" | "scrollMarginInlineStart" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPadding" | "scrollPaddingBlock" | "scrollPaddingBlockEnd" | "scrollPaddingBlockStart" | "scrollPaddingBottom" | "scrollPaddingInline" | "scrollPaddingInlineEnd" | "scrollPaddingInlineStart" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapStop" | "scrollSnapType" | "scrollbarGutter" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textAnchor" | "textCombineUpright" | "textDecoration" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasis" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transition" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "visibility" | "webkitAlignContent" | "webkitAlignItems" | "webkitAlignSelf" | "webkitAnimation" | "webkitAnimationDelay" | "webkitAnimationDirection" | "webkitAnimationDuration" | "webkitAnimationFillMode" | "webkitAnimationIterationCount" | "webkitAnimationName" | "webkitAnimationPlayState" | "webkitAnimationTimingFunction" | "webkitAppearance" | "webkitBackfaceVisibility" | "webkitBackgroundClip" | "webkitBackgroundOrigin" | "webkitBackgroundSize" | "webkitBorderBottomLeftRadius" | "webkitBorderBottomRightRadius" | "webkitBorderRadius" | "webkitBorderTopLeftRadius" | "webkitBorderTopRightRadius" | "webkitBoxAlign" | "webkitBoxFlex" | "webkitBoxOrdinalGroup" | "webkitBoxOrient" | "webkitBoxPack" | "webkitBoxShadow" | "webkitBoxSizing" | "webkitFilter" | "webkitFlex" | "webkitFlexBasis" | "webkitFlexDirection" | "webkitFlexFlow" | "webkitFlexGrow" | "webkitFlexShrink" | "webkitFlexWrap" | "webkitJustifyContent" | "webkitLineClamp" | "webkitMask" | "webkitMaskBoxImage" | "webkitMaskBoxImageOutset" | "webkitMaskBoxImageRepeat" | "webkitMaskBoxImageSlice" | "webkitMaskBoxImageSource" | "webkitMaskBoxImageWidth" | "webkitMaskClip" | "webkitMaskComposite" | "webkitMaskImage" | "webkitMaskOrigin" | "webkitMaskPosition" | "webkitMaskRepeat" | "webkitMaskSize" | "webkitOrder" | "webkitPerspective" | "webkitPerspectiveOrigin" | "webkitTextFillColor" | "webkitTextStroke" | "webkitTextStrokeColor" | "webkitTextStrokeWidth" | "webkitTransform" | "webkitTransformOrigin" | "webkitTransformStyle" | "webkitTransition" | "webkitTransitionDelay" | "webkitTransitionDuration" | "webkitTransitionProperty" | "webkitTransitionTimingFunction" | "webkitUserSelect" | "whiteSpace" | "widows" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex" | "getPropertyPriority" | "getPropertyValue" | "removeProperty" | "setProperty">(prop: P, value: CSSStyleDeclaration[P]) => boolean;
2
2
  export default isCssPropertySupported;