@algolia/satellite 1.0.0-beta.174 → 1.0.0-beta.176

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 (181) hide show
  1. package/cjs/AutoComplete/AutoComplete.js +4 -9
  2. package/cjs/AutoComplete/components/AutoCompleteContext.d.ts +10 -0
  3. package/cjs/AutoComplete/components/AutoCompleteContext.js +29 -0
  4. package/cjs/AutoComplete/components/DefaultOptionItem.js +8 -2
  5. package/cjs/AutoComplete/index.d.ts +1 -1
  6. package/cjs/AutoComplete/index.js +4 -4
  7. package/cjs/Button/Button.tailwind.js +1 -0
  8. package/cjs/Button/PolymorphicButton.js +1 -1
  9. package/cjs/Dropdown/Dropdown.d.ts +1 -5
  10. package/cjs/Dropdown/Dropdown.js +12 -15
  11. package/cjs/Dropdown/DropdownButton.d.ts +3 -0
  12. package/cjs/Dropdown/DropdownButton.js +3 -0
  13. package/cjs/Dropdown/components/DropdownButtonItem.d.ts +1 -0
  14. package/cjs/Dropdown/components/DropdownButtonItem.js +5 -2
  15. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItem.d.ts +1 -0
  16. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItem.js +1 -0
  17. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroup.d.ts +1 -0
  18. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroup.js +1 -0
  19. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroupContext.d.ts +1 -0
  20. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroupContext.js +2 -0
  21. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsMultiGroup.d.ts +1 -0
  22. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsMultiGroup.js +1 -0
  23. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsSingleGroup.d.ts +1 -0
  24. package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsSingleGroup.js +1 -0
  25. package/cjs/Dropdown/components/DropdownDivider.d.ts +1 -0
  26. package/cjs/Dropdown/components/DropdownDivider.js +1 -0
  27. package/cjs/Dropdown/components/DropdownFooterItem.d.ts +1 -0
  28. package/cjs/Dropdown/components/DropdownFooterItem.js +1 -0
  29. package/cjs/Dropdown/components/DropdownLinkItem.d.ts +1 -0
  30. package/cjs/Dropdown/components/DropdownLinkItem.js +5 -2
  31. package/cjs/Dropdown/components/DropdownRadioItem.d.ts +1 -0
  32. package/cjs/Dropdown/components/DropdownRadioItem.js +6 -2
  33. package/cjs/Dropdown/components/DropdownTitle.d.ts +1 -0
  34. package/cjs/Dropdown/components/DropdownTitle.js +1 -0
  35. package/cjs/Dropdown/components/DropdownToggleItem.d.ts +1 -0
  36. package/cjs/Dropdown/components/DropdownToggleItem.js +6 -2
  37. package/cjs/EmptyState/EmptyState.js +4 -9
  38. package/cjs/MenuButton/MenuButton.d.ts +13 -11
  39. package/cjs/MenuButton/MenuButton.js +15 -39
  40. package/cjs/MenuButton/components/Content.d.ts +4 -0
  41. package/cjs/MenuButton/components/Content.js +39 -0
  42. package/cjs/MenuButton/components/DefaultTrigger.d.ts +2 -2
  43. package/cjs/MenuButton/components/DefaultTrigger.js +5 -2
  44. package/cjs/MenuButton/components/items/Item.d.ts +15 -0
  45. package/cjs/MenuButton/components/items/{ButtonItem.js → Item.js} +14 -17
  46. package/cjs/MenuButton/components/items/index.d.ts +1 -1
  47. package/cjs/MenuButton/components/items/index.js +4 -4
  48. package/cjs/MenuButton/index.d.ts +1 -1
  49. package/cjs/MenuButton/index.js +11 -8
  50. package/cjs/MenuButton/useMenuItemProps.d.ts +3 -3
  51. package/cjs/MenuButton/useMenuItemProps.js +1 -1
  52. package/cjs/Satellite/locale.d.ts +6 -2
  53. package/cjs/Stepper/Step.d.ts +7 -0
  54. package/cjs/Stepper/Step.js +116 -0
  55. package/cjs/Stepper/Stepper.d.ts +42 -0
  56. package/cjs/Stepper/Stepper.js +146 -0
  57. package/cjs/Stepper/StepperContext.d.ts +12 -0
  58. package/cjs/Stepper/StepperContext.js +15 -0
  59. package/cjs/Stepper/index.d.ts +4 -0
  60. package/cjs/Stepper/index.js +51 -0
  61. package/cjs/Stepper/types.d.ts +26 -0
  62. package/cjs/Stepper/utils.d.ts +5 -0
  63. package/cjs/Stepper/utils.js +67 -0
  64. package/cjs/Tag/Tag.js +2 -2
  65. package/cjs/Toast/Toast.d.ts +6 -0
  66. package/cjs/{Flag/Flag.js → Toast/Toast.js} +50 -63
  67. package/cjs/{Flag/Flag.tailwind.d.ts → Toast/Toast.tailwind.d.ts} +2 -2
  68. package/cjs/{Flag/Flag.tailwind.js → Toast/Toast.tailwind.js} +7 -7
  69. package/cjs/Toast/Toasts.d.ts +21 -0
  70. package/cjs/Toast/Toasts.js +102 -0
  71. package/cjs/Toast/index.d.ts +4 -0
  72. package/cjs/{Flag → Toast}/index.js +9 -9
  73. package/cjs/Toast/types.d.ts +34 -0
  74. package/cjs/Toast/types.js +5 -0
  75. package/cjs/index.d.ts +1 -1
  76. package/cjs/index.js +4 -4
  77. package/cjs/styles/tailwind.config.js +1 -1
  78. package/cjs/types.d.ts +3 -3
  79. package/cjs/utils/getTextFromReactNode.d.ts +4 -0
  80. package/cjs/utils/getTextFromReactNode.js +20 -0
  81. package/esm/AutoComplete/AutoComplete.js +4 -9
  82. package/esm/AutoComplete/components/AutoCompleteContext.d.ts +10 -0
  83. package/esm/AutoComplete/components/AutoCompleteContext.js +23 -0
  84. package/esm/AutoComplete/components/DefaultOptionItem.js +8 -2
  85. package/esm/AutoComplete/index.d.ts +1 -1
  86. package/esm/AutoComplete/index.js +1 -1
  87. package/esm/Button/Button.tailwind.js +1 -0
  88. package/esm/Button/PolymorphicButton.js +1 -1
  89. package/esm/Dropdown/Dropdown.d.ts +1 -5
  90. package/esm/Dropdown/Dropdown.js +12 -15
  91. package/esm/Dropdown/DropdownButton.d.ts +3 -0
  92. package/esm/Dropdown/DropdownButton.js +3 -0
  93. package/esm/Dropdown/components/DropdownButtonItem.d.ts +1 -0
  94. package/esm/Dropdown/components/DropdownButtonItem.js +5 -2
  95. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItem.d.ts +1 -0
  96. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItem.js +1 -0
  97. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroup.d.ts +1 -0
  98. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroup.js +1 -0
  99. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroupContext.d.ts +1 -0
  100. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroupContext.js +2 -0
  101. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsMultiGroup.d.ts +1 -0
  102. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsMultiGroup.js +1 -0
  103. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsSingleGroup.d.ts +1 -0
  104. package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsSingleGroup.js +1 -0
  105. package/esm/Dropdown/components/DropdownDivider.d.ts +1 -0
  106. package/esm/Dropdown/components/DropdownDivider.js +2 -0
  107. package/esm/Dropdown/components/DropdownFooterItem.d.ts +1 -0
  108. package/esm/Dropdown/components/DropdownFooterItem.js +1 -0
  109. package/esm/Dropdown/components/DropdownLinkItem.d.ts +1 -0
  110. package/esm/Dropdown/components/DropdownLinkItem.js +5 -2
  111. package/esm/Dropdown/components/DropdownRadioItem.d.ts +1 -0
  112. package/esm/Dropdown/components/DropdownRadioItem.js +6 -2
  113. package/esm/Dropdown/components/DropdownTitle.d.ts +1 -0
  114. package/esm/Dropdown/components/DropdownTitle.js +1 -0
  115. package/esm/Dropdown/components/DropdownToggleItem.d.ts +1 -0
  116. package/esm/Dropdown/components/DropdownToggleItem.js +6 -2
  117. package/esm/EmptyState/EmptyState.js +4 -9
  118. package/esm/MenuButton/MenuButton.d.ts +13 -11
  119. package/esm/MenuButton/MenuButton.js +15 -39
  120. package/esm/MenuButton/components/Content.d.ts +4 -0
  121. package/esm/MenuButton/components/Content.js +32 -0
  122. package/esm/MenuButton/components/DefaultTrigger.d.ts +2 -2
  123. package/esm/MenuButton/components/DefaultTrigger.js +5 -2
  124. package/esm/MenuButton/components/items/Item.d.ts +15 -0
  125. package/esm/MenuButton/components/items/{ButtonItem.js → Item.js} +13 -16
  126. package/esm/MenuButton/components/items/index.d.ts +1 -1
  127. package/esm/MenuButton/components/items/index.js +1 -1
  128. package/esm/MenuButton/index.d.ts +1 -1
  129. package/esm/MenuButton/index.js +1 -1
  130. package/esm/MenuButton/useMenuItemProps.d.ts +3 -3
  131. package/esm/MenuButton/useMenuItemProps.js +1 -1
  132. package/esm/Satellite/locale.d.ts +6 -2
  133. package/esm/Stepper/Step.d.ts +7 -0
  134. package/esm/Stepper/Step.js +110 -0
  135. package/esm/Stepper/Stepper.d.ts +42 -0
  136. package/esm/Stepper/Stepper.js +139 -0
  137. package/esm/Stepper/StepperContext.d.ts +12 -0
  138. package/esm/Stepper/StepperContext.js +9 -0
  139. package/esm/Stepper/index.d.ts +4 -0
  140. package/esm/Stepper/index.js +4 -0
  141. package/esm/Stepper/types.d.ts +26 -0
  142. package/esm/Stepper/utils.d.ts +5 -0
  143. package/esm/Stepper/utils.js +61 -0
  144. package/esm/Tag/Tag.js +3 -3
  145. package/esm/Toast/Toast.d.ts +6 -0
  146. package/esm/{Flag/Flag.js → Toast/Toast.js} +46 -62
  147. package/esm/{Flag/Flag.tailwind.d.ts → Toast/Toast.tailwind.d.ts} +2 -2
  148. package/esm/{Flag/Flag.tailwind.js → Toast/Toast.tailwind.js} +7 -7
  149. package/esm/Toast/Toasts.d.ts +21 -0
  150. package/esm/Toast/Toasts.js +93 -0
  151. package/esm/Toast/index.d.ts +4 -0
  152. package/esm/Toast/index.js +4 -0
  153. package/esm/Toast/types.d.ts +34 -0
  154. package/esm/Toast/types.js +1 -0
  155. package/esm/index.d.ts +1 -1
  156. package/esm/index.js +1 -1
  157. package/esm/styles/tailwind.config.js +1 -1
  158. package/esm/types.d.ts +3 -3
  159. package/esm/utils/getTextFromReactNode.d.ts +4 -0
  160. package/esm/utils/getTextFromReactNode.js +15 -0
  161. package/package.json +2 -1
  162. package/satellite.min.css +1 -1
  163. package/cjs/AutoComplete/components/AutocompleteContext.d.ts +0 -5
  164. package/cjs/AutoComplete/components/AutocompleteContext.js +0 -19
  165. package/cjs/Flag/Flag.d.ts +0 -11
  166. package/cjs/Flag/Flags.d.ts +0 -48
  167. package/cjs/Flag/Flags.js +0 -90
  168. package/cjs/Flag/index.d.ts +0 -4
  169. package/cjs/Flag/types.d.ts +0 -27
  170. package/cjs/MenuButton/components/items/ButtonItem.d.ts +0 -14
  171. package/esm/AutoComplete/components/AutocompleteContext.d.ts +0 -5
  172. package/esm/AutoComplete/components/AutocompleteContext.js +0 -13
  173. package/esm/Flag/Flag.d.ts +0 -11
  174. package/esm/Flag/Flags.d.ts +0 -48
  175. package/esm/Flag/Flags.js +0 -83
  176. package/esm/Flag/index.d.ts +0 -4
  177. package/esm/Flag/index.js +0 -4
  178. package/esm/Flag/types.d.ts +0 -27
  179. package/esm/MenuButton/components/items/ButtonItem.d.ts +0 -14
  180. /package/cjs/{Flag → Stepper}/types.js +0 -0
  181. /package/esm/{Flag → Stepper}/types.js +0 -0
@@ -1,11 +0,0 @@
1
- import type { VFC } from "react";
2
- import type { Notification } from "./types";
3
- export declare type FlagLocale = Notification["locale"];
4
- export declare type FlagProps = Omit<Notification, "id" | "content">;
5
- /**
6
- * The `Toast` component is a brief notification that providing timely feedback to users before vanishing after a short duration.
7
- *
8
- * See the [Toast documentation page](https://satellite.algolia.com/components/feedback/toast) for more information.
9
- */
10
- export declare const Flag: VFC<FlagProps>;
11
- export default Flag;
@@ -1,48 +0,0 @@
1
- import type { VFC } from "react";
2
- import type { Notification } from "./types";
3
- export interface FlagsProps {
4
- /**
5
- * Array of notifications
6
- * @example [{ id: "test", title: "Test", content: "Example" }]
7
- */
8
- notifications: Notification[];
9
- }
10
- /**
11
- * Use flags for messages containing confirmations, alerts, and acknowledgments that require minimal user interaction. These event-driven messages appear at the bottom of the screen and overlay any content.
12
- * For critical messaging about loss of data or functionality, please use banners.
13
- *
14
- * ## Structure
15
- *
16
- * - **Icon (or avatar) and title**: flag messages should always contain a concise title and an appropriate icon
17
- * - **Message (optional)**: If the text overflows, truncate using an ellipsis
18
- * - **Actions (optional)**: two links max that enable users to act on the flag's content
19
- * - **Dismiss**: use to close the flag
20
- *
21
- * ## Variations
22
- *
23
- * ### Warning
24
- *
25
- * Warning messages appear before we request the user to take action. This is usually in anticipation of a significant change. Have empathy for the user. Inform, but don't alarm. If the warning comes before an action, clearly communicate what will happen if the they proceed, and provide an alternative where possible.
26
- *
27
- * ### Error
28
- *
29
- * Error messages let the user know that something has gone wrong after they've tried to do something. Explain the problem and provide the user with a next step or an alternative. Keep the message simple and direct, avoid blame and accept if something is our fault.
30
- *
31
- * ### Success
32
- *
33
- * Success messages let the user know that they have completed an action. For these messages, it's best to reaffirm the outcome and get out of the user's way. If they have just created something, give them an option to view it.
34
- *
35
- * ### Info / Loading
36
- *
37
- * Info messages alert the user to additional information without requiring an action. Inform the user about something that might help or impact them.
38
- *
39
- * ## Interaction
40
- *
41
- * Flags can be dismissed by selecting the 'x' or will fade away after X seconds. The user can pause the auto-dismiss by hovering over the flag.
42
- *
43
- * ## Multiple flags
44
- *
45
- * When there are multiple flags, they will stack on top of one another with the most recent flag on top. When a user dismisses a flag, any older flags 'below' will come to the top. Careful consideration should be taken to take into account the ordering and priority of flags in the stack. Never use dismissible and non-dismissible flags in a stack as flags that automatically dismiss can do so and not be visible to the user.
46
- */
47
- export declare const Flags: VFC<FlagsProps>;
48
- export default Flags;
package/cjs/Flag/Flags.js DELETED
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = exports.Flags = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
- var _reactTransitionGroup = require("react-transition-group");
12
- var _Satellite = require("../Satellite");
13
- var _satellitePrefixer = _interopRequireDefault(require("../styles/helpers/satellitePrefixer"));
14
- var _prefersReducedMotion = require("../utils/prefersReducedMotion");
15
- var _Flag = _interopRequireDefault(require("./Flag"));
16
- var _jsxRuntime = require("react/jsx-runtime");
17
- var _excluded = ["content", "id"];
18
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
19
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
- var TRANSITION_TIMEOUT = 500;
22
-
23
- /**
24
- * Use flags for messages containing confirmations, alerts, and acknowledgments that require minimal user interaction. These event-driven messages appear at the bottom of the screen and overlay any content.
25
- * For critical messaging about loss of data or functionality, please use banners.
26
- *
27
- * ## Structure
28
- *
29
- * - **Icon (or avatar) and title**: flag messages should always contain a concise title and an appropriate icon
30
- * - **Message (optional)**: If the text overflows, truncate using an ellipsis
31
- * - **Actions (optional)**: two links max that enable users to act on the flag's content
32
- * - **Dismiss**: use to close the flag
33
- *
34
- * ## Variations
35
- *
36
- * ### Warning
37
- *
38
- * Warning messages appear before we request the user to take action. This is usually in anticipation of a significant change. Have empathy for the user. Inform, but don't alarm. If the warning comes before an action, clearly communicate what will happen if the they proceed, and provide an alternative where possible.
39
- *
40
- * ### Error
41
- *
42
- * Error messages let the user know that something has gone wrong after they've tried to do something. Explain the problem and provide the user with a next step or an alternative. Keep the message simple and direct, avoid blame and accept if something is our fault.
43
- *
44
- * ### Success
45
- *
46
- * Success messages let the user know that they have completed an action. For these messages, it's best to reaffirm the outcome and get out of the user's way. If they have just created something, give them an option to view it.
47
- *
48
- * ### Info / Loading
49
- *
50
- * Info messages alert the user to additional information without requiring an action. Inform the user about something that might help or impact them.
51
- *
52
- * ## Interaction
53
- *
54
- * Flags can be dismissed by selecting the 'x' or will fade away after X seconds. The user can pause the auto-dismiss by hovering over the flag.
55
- *
56
- * ## Multiple flags
57
- *
58
- * When there are multiple flags, they will stack on top of one another with the most recent flag on top. When a user dismisses a flag, any older flags 'below' will come to the top. Careful consideration should be taken to take into account the ordering and priority of flags in the stack. Never use dismissible and non-dismissible flags in a stack as flags that automatically dismiss can do so and not be visible to the user.
59
- */
60
- var Flags = exports.Flags = function Flags(_ref) {
61
- var _ref$notifications = _ref.notifications,
62
- notifications = _ref$notifications === void 0 ? [] : _ref$notifications;
63
- var createPortal = (0, _Satellite.useCreatePortal)();
64
- return createPortal( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.TransitionGroup, {
65
- className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["z-notification bottom-0 right-0 fixed flex flex-col items-end p-4"]))),
66
- component: "ul",
67
- children: notifications.map(function (_ref2) {
68
- var content = _ref2.content,
69
- id = _ref2.id,
70
- rest = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
71
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
72
- classNames: !_prefersReducedMotion.prefersReducedMotion ? {
73
- enter: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["flags_item-enter"]))),
74
- enterActive: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["flags_item-enter-active"]))),
75
- exit: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["flags_item-exit"]))),
76
- exitActive: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["flags_item-exit-active"])))
77
- } : {},
78
- timeout: !_prefersReducedMotion.prefersReducedMotion ? TRANSITION_TIMEOUT : 0,
79
- appear: true,
80
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
81
- className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["mt-4"]))),
82
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Flag["default"], _objectSpread(_objectSpread({}, rest), {}, {
83
- children: content
84
- }))
85
- })
86
- }, id);
87
- })
88
- }));
89
- };
90
- var _default = exports["default"] = Flags;
@@ -1,4 +0,0 @@
1
- export * from "./Flag";
2
- export * from "./Flags";
3
- export * from "./types";
4
- export { default } from "./Flag";
@@ -1,27 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import type { IconComponentType } from "../Icons";
3
- import type { ColorVariant } from "../types";
4
- export interface Notification {
5
- /** Unique notification ID */
6
- id: string;
7
- title?: string;
8
- /** Content goes here */
9
- content: ReactNode;
10
- /** Icon to accompany the notification */
11
- icon?: IconComponentType;
12
- /** @default false */
13
- loading?: boolean;
14
- /** @default "blue" */
15
- variant?: ColorVariant;
16
- /**
17
- * Function triggered when the dismiss button is clicked.
18
- * Dismiss button won't be rendered if absent.
19
- * */
20
- onDismiss?: () => void;
21
- /** Defines if and how long before the notification should be dismissed (in ms) */
22
- autoDismissAfter?: number;
23
- locale?: {
24
- dismissText?: string;
25
- };
26
- children?: ReactNode;
27
- }
@@ -1,14 +0,0 @@
1
- import type { IconComponentType } from "Icons";
2
- import type { FC } from "react";
3
- import type { BaseItemProps } from "../../useMenuItemProps";
4
- export declare type ButtonItemProps = BaseItemProps<HTMLButtonElement> & JSX.IntrinsicElements["button"] & {
5
- /** Left aligned icon */
6
- startIcon?: IconComponentType;
7
- /**
8
- * Variant of the item
9
- * @default "default"
10
- */
11
- variant?: "default" | "destructive";
12
- };
13
- export declare const ButtonItem: FC<ButtonItemProps>;
14
- export default ButtonItem;
@@ -1,5 +0,0 @@
1
- import type { ReactNode, VFC } from "react";
2
- export declare const AutocompleteProvider: VFC<{
3
- children: ReactNode;
4
- }>;
5
- export declare const useIsInsideAutocomplete: () => boolean;
@@ -1,13 +0,0 @@
1
- import { createContext, useContext } from "react";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- var AutocompleteContext = /*#__PURE__*/createContext(false);
4
- export var AutocompleteProvider = function AutocompleteProvider(_ref) {
5
- var children = _ref.children;
6
- return /*#__PURE__*/_jsx(AutocompleteContext.Provider, {
7
- value: true,
8
- children: children
9
- });
10
- };
11
- export var useIsInsideAutocomplete = function useIsInsideAutocomplete() {
12
- return useContext(AutocompleteContext);
13
- };
@@ -1,11 +0,0 @@
1
- import type { VFC } from "react";
2
- import type { Notification } from "./types";
3
- export declare type FlagLocale = Notification["locale"];
4
- export declare type FlagProps = Omit<Notification, "id" | "content">;
5
- /**
6
- * The `Toast` component is a brief notification that providing timely feedback to users before vanishing after a short duration.
7
- *
8
- * See the [Toast documentation page](https://satellite.algolia.com/components/feedback/toast) for more information.
9
- */
10
- export declare const Flag: VFC<FlagProps>;
11
- export default Flag;
@@ -1,48 +0,0 @@
1
- import type { VFC } from "react";
2
- import type { Notification } from "./types";
3
- export interface FlagsProps {
4
- /**
5
- * Array of notifications
6
- * @example [{ id: "test", title: "Test", content: "Example" }]
7
- */
8
- notifications: Notification[];
9
- }
10
- /**
11
- * Use flags for messages containing confirmations, alerts, and acknowledgments that require minimal user interaction. These event-driven messages appear at the bottom of the screen and overlay any content.
12
- * For critical messaging about loss of data or functionality, please use banners.
13
- *
14
- * ## Structure
15
- *
16
- * - **Icon (or avatar) and title**: flag messages should always contain a concise title and an appropriate icon
17
- * - **Message (optional)**: If the text overflows, truncate using an ellipsis
18
- * - **Actions (optional)**: two links max that enable users to act on the flag's content
19
- * - **Dismiss**: use to close the flag
20
- *
21
- * ## Variations
22
- *
23
- * ### Warning
24
- *
25
- * Warning messages appear before we request the user to take action. This is usually in anticipation of a significant change. Have empathy for the user. Inform, but don't alarm. If the warning comes before an action, clearly communicate what will happen if the they proceed, and provide an alternative where possible.
26
- *
27
- * ### Error
28
- *
29
- * Error messages let the user know that something has gone wrong after they've tried to do something. Explain the problem and provide the user with a next step or an alternative. Keep the message simple and direct, avoid blame and accept if something is our fault.
30
- *
31
- * ### Success
32
- *
33
- * Success messages let the user know that they have completed an action. For these messages, it's best to reaffirm the outcome and get out of the user's way. If they have just created something, give them an option to view it.
34
- *
35
- * ### Info / Loading
36
- *
37
- * Info messages alert the user to additional information without requiring an action. Inform the user about something that might help or impact them.
38
- *
39
- * ## Interaction
40
- *
41
- * Flags can be dismissed by selecting the 'x' or will fade away after X seconds. The user can pause the auto-dismiss by hovering over the flag.
42
- *
43
- * ## Multiple flags
44
- *
45
- * When there are multiple flags, they will stack on top of one another with the most recent flag on top. When a user dismisses a flag, any older flags 'below' will come to the top. Careful consideration should be taken to take into account the ordering and priority of flags in the stack. Never use dismissible and non-dismissible flags in a stack as flags that automatically dismiss can do so and not be visible to the user.
46
- */
47
- export declare const Flags: VFC<FlagsProps>;
48
- export default Flags;
package/esm/Flag/Flags.js DELETED
@@ -1,83 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
- var _excluded = ["content", "id"];
5
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
6
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
- import { CSSTransition, TransitionGroup } from "react-transition-group";
9
- import { useCreatePortal } from "../Satellite";
10
- import stl from "../styles/helpers/satellitePrefixer";
11
- import { prefersReducedMotion } from "../utils/prefersReducedMotion";
12
- import Flag from "./Flag";
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- var TRANSITION_TIMEOUT = 500;
15
-
16
- /**
17
- * Use flags for messages containing confirmations, alerts, and acknowledgments that require minimal user interaction. These event-driven messages appear at the bottom of the screen and overlay any content.
18
- * For critical messaging about loss of data or functionality, please use banners.
19
- *
20
- * ## Structure
21
- *
22
- * - **Icon (or avatar) and title**: flag messages should always contain a concise title and an appropriate icon
23
- * - **Message (optional)**: If the text overflows, truncate using an ellipsis
24
- * - **Actions (optional)**: two links max that enable users to act on the flag's content
25
- * - **Dismiss**: use to close the flag
26
- *
27
- * ## Variations
28
- *
29
- * ### Warning
30
- *
31
- * Warning messages appear before we request the user to take action. This is usually in anticipation of a significant change. Have empathy for the user. Inform, but don't alarm. If the warning comes before an action, clearly communicate what will happen if the they proceed, and provide an alternative where possible.
32
- *
33
- * ### Error
34
- *
35
- * Error messages let the user know that something has gone wrong after they've tried to do something. Explain the problem and provide the user with a next step or an alternative. Keep the message simple and direct, avoid blame and accept if something is our fault.
36
- *
37
- * ### Success
38
- *
39
- * Success messages let the user know that they have completed an action. For these messages, it's best to reaffirm the outcome and get out of the user's way. If they have just created something, give them an option to view it.
40
- *
41
- * ### Info / Loading
42
- *
43
- * Info messages alert the user to additional information without requiring an action. Inform the user about something that might help or impact them.
44
- *
45
- * ## Interaction
46
- *
47
- * Flags can be dismissed by selecting the 'x' or will fade away after X seconds. The user can pause the auto-dismiss by hovering over the flag.
48
- *
49
- * ## Multiple flags
50
- *
51
- * When there are multiple flags, they will stack on top of one another with the most recent flag on top. When a user dismisses a flag, any older flags 'below' will come to the top. Careful consideration should be taken to take into account the ordering and priority of flags in the stack. Never use dismissible and non-dismissible flags in a stack as flags that automatically dismiss can do so and not be visible to the user.
52
- */
53
- export var Flags = function Flags(_ref) {
54
- var _ref$notifications = _ref.notifications,
55
- notifications = _ref$notifications === void 0 ? [] : _ref$notifications;
56
- var createPortal = useCreatePortal();
57
- return createPortal( /*#__PURE__*/_jsx(TransitionGroup, {
58
- className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["z-notification bottom-0 right-0 fixed flex flex-col items-end p-4"]))),
59
- component: "ul",
60
- children: notifications.map(function (_ref2) {
61
- var content = _ref2.content,
62
- id = _ref2.id,
63
- rest = _objectWithoutProperties(_ref2, _excluded);
64
- return /*#__PURE__*/_jsx(CSSTransition, {
65
- classNames: !prefersReducedMotion ? {
66
- enter: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flags_item-enter"]))),
67
- enterActive: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flags_item-enter-active"]))),
68
- exit: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["flags_item-exit"]))),
69
- exitActive: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["flags_item-exit-active"])))
70
- } : {},
71
- timeout: !prefersReducedMotion ? TRANSITION_TIMEOUT : 0,
72
- appear: true,
73
- children: /*#__PURE__*/_jsx("li", {
74
- className: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["mt-4"]))),
75
- children: /*#__PURE__*/_jsx(Flag, _objectSpread(_objectSpread({}, rest), {}, {
76
- children: content
77
- }))
78
- })
79
- }, id);
80
- })
81
- }));
82
- };
83
- export default Flags;
@@ -1,4 +0,0 @@
1
- export * from "./Flag";
2
- export * from "./Flags";
3
- export * from "./types";
4
- export { default } from "./Flag";
package/esm/Flag/index.js DELETED
@@ -1,4 +0,0 @@
1
- export * from "./Flag";
2
- export * from "./Flags";
3
- export * from "./types";
4
- export { default } from "./Flag";
@@ -1,27 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import type { IconComponentType } from "../Icons";
3
- import type { ColorVariant } from "../types";
4
- export interface Notification {
5
- /** Unique notification ID */
6
- id: string;
7
- title?: string;
8
- /** Content goes here */
9
- content: ReactNode;
10
- /** Icon to accompany the notification */
11
- icon?: IconComponentType;
12
- /** @default false */
13
- loading?: boolean;
14
- /** @default "blue" */
15
- variant?: ColorVariant;
16
- /**
17
- * Function triggered when the dismiss button is clicked.
18
- * Dismiss button won't be rendered if absent.
19
- * */
20
- onDismiss?: () => void;
21
- /** Defines if and how long before the notification should be dismissed (in ms) */
22
- autoDismissAfter?: number;
23
- locale?: {
24
- dismissText?: string;
25
- };
26
- children?: ReactNode;
27
- }
@@ -1,14 +0,0 @@
1
- import type { IconComponentType } from "Icons";
2
- import type { FC } from "react";
3
- import type { BaseItemProps } from "../../useMenuItemProps";
4
- export declare type ButtonItemProps = BaseItemProps<HTMLButtonElement> & JSX.IntrinsicElements["button"] & {
5
- /** Left aligned icon */
6
- startIcon?: IconComponentType;
7
- /**
8
- * Variant of the item
9
- * @default "default"
10
- */
11
- variant?: "default" | "destructive";
12
- };
13
- export declare const ButtonItem: FC<ButtonItemProps>;
14
- export default ButtonItem;
File without changes
File without changes