@algolia/satellite 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/Actions/Button/PolymorphicIconButton.d.ts +10 -2
- package/dist/cjs/Actions/Button/PolymorphicIconButton.js +8 -2
- package/dist/cjs/Actions/IconButtonWithFeedback/IconButtonWithFeedback.d.ts +68 -0
- package/dist/cjs/Actions/IconButtonWithFeedback/IconButtonWithFeedback.js +209 -0
- package/dist/cjs/Actions/SegmentedControl/SegmentedControl.d.ts +4 -4
- package/dist/cjs/Actions/index.d.ts +2 -0
- package/dist/cjs/Actions/index.js +19 -0
- package/dist/cjs/Fields/AutoComplete/AutoComplete.js +18 -5
- package/dist/cjs/Fields/AutoComplete/types.d.ts +6 -2
- package/dist/cjs/Fields/AutoComplete/types.js +4 -1
- package/dist/cjs/Fields/FilePicker/FilePicker.d.ts +10 -0
- package/dist/cjs/Fields/FilePicker/FilePicker.js +9 -2
- package/dist/cjs/Fields/Input/Input.js +1 -1
- package/dist/cjs/Fields/Input/Input.tailwind.js +7 -7
- package/dist/cjs/Fields/TextArea/TextArea.tailwind.js +7 -7
- package/dist/cjs/Overlay/MenuButton/MenuButton.d.ts +1 -1
- package/dist/cjs/Overlay/MenuButton/components/items/Item.d.ts +1 -1
- package/dist/cjs/Overlay/Modal/Modal.d.ts +1 -1
- package/dist/cjs/Overlay/Modal/Modal.js +17 -11
- package/dist/cjs/Overlay/Modal/Modal.tailwind.js +3 -0
- package/dist/cjs/Satellite/locale.d.ts +2 -0
- package/dist/cjs/Typography/Typography.tailwind.js +1 -1
- package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/cjs/utils/prefersReducedMotion.js +1 -1
- package/dist/cjs/utils/useTimeoutFn.d.ts +2 -0
- package/dist/cjs/utils/useTimeoutFn.js +44 -0
- package/dist/esm/Actions/Button/PolymorphicIconButton.d.ts +10 -2
- package/dist/esm/Actions/Button/PolymorphicIconButton.js +8 -2
- package/dist/esm/Actions/IconButtonWithFeedback/IconButtonWithFeedback.d.ts +68 -0
- package/dist/esm/Actions/IconButtonWithFeedback/IconButtonWithFeedback.js +202 -0
- package/dist/esm/Actions/SegmentedControl/SegmentedControl.d.ts +4 -4
- package/dist/esm/Actions/index.d.ts +2 -0
- package/dist/esm/Actions/index.js +2 -2
- package/dist/esm/Fields/AutoComplete/AutoComplete.js +18 -5
- package/dist/esm/Fields/AutoComplete/types.d.ts +6 -2
- package/dist/esm/Fields/AutoComplete/types.js +2 -1
- package/dist/esm/Fields/FilePicker/FilePicker.d.ts +10 -0
- package/dist/esm/Fields/FilePicker/FilePicker.js +9 -2
- package/dist/esm/Fields/Input/Input.js +1 -1
- package/dist/esm/Fields/Input/Input.tailwind.js +7 -9
- package/dist/esm/Fields/TextArea/TextArea.tailwind.js +7 -9
- package/dist/esm/Overlay/MenuButton/MenuButton.d.ts +1 -1
- package/dist/esm/Overlay/MenuButton/components/items/Item.d.ts +1 -1
- package/dist/esm/Overlay/Modal/Modal.d.ts +1 -1
- package/dist/esm/Overlay/Modal/Modal.js +17 -11
- package/dist/esm/Overlay/Modal/Modal.tailwind.js +3 -0
- package/dist/esm/Satellite/locale.d.ts +2 -0
- package/dist/esm/Typography/Typography.tailwind.js +1 -1
- package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/esm/utils/prefersReducedMotion.js +1 -1
- package/dist/esm/utils/useTimeoutFn.d.ts +2 -0
- package/dist/esm/utils/useTimeoutFn.js +38 -0
- package/dist/satellite.min.css +1 -1
- package/package.json +2 -1
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.FilePicker = void 0;
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
10
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
12
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
@@ -18,12 +19,14 @@ var _Satellite = require("./../../Satellite");
|
|
18
19
|
var _satellitePrefixer = _interopRequireDefault(require("./../../styles/helpers/satellitePrefixer"));
|
19
20
|
var _formatters = require("./../../utils/formatters");
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
22
|
+
var _excluded = ["clearable"];
|
21
23
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
22
24
|
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; }
|
23
25
|
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; }
|
24
26
|
var FileCard = function FileCard(_ref) {
|
25
27
|
var file = _ref.file,
|
26
28
|
errors = _ref.errors,
|
29
|
+
clearable = _ref.clearable,
|
27
30
|
removeFileTooltip = _ref.removeFileTooltip,
|
28
31
|
onDelete = _ref.onDelete;
|
29
32
|
var FileIcon = errors ? _Icons.AlertTriangleIcon : _Icons.FileTextIcon;
|
@@ -47,7 +50,7 @@ var FileCard = function FileCard(_ref) {
|
|
47
50
|
children: (0, _formatters.formatHumanSize)(file.size)
|
48
51
|
})]
|
49
52
|
})]
|
50
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.IconButton, {
|
53
|
+
}), clearable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.IconButton, {
|
51
54
|
icon: _Icons.TrashIcon,
|
52
55
|
title: removeFileTooltip,
|
53
56
|
size: "medium",
|
@@ -67,6 +70,9 @@ var DEFAULT_FILE_PICKER_LOCALE = {
|
|
67
70
|
var FilePicker = exports.FilePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
68
71
|
var contextLocale = (0, _Satellite.useLocale)("filePicker");
|
69
72
|
var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_FILE_PICKER_LOCALE), contextLocale), props.locale);
|
73
|
+
var _props$clearable = props.clearable,
|
74
|
+
clearable = _props$clearable === void 0 ? true : _props$clearable,
|
75
|
+
dropzoneProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
70
76
|
var _useState = (0, _react.useState)([]),
|
71
77
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
72
78
|
files = _useState2[0],
|
@@ -117,7 +123,7 @@ var FilePicker = exports.FilePicker = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
117
123
|
};
|
118
124
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
119
125
|
className: (0, _satellitePrefixer["default"])(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-4"]))),
|
120
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropzone.Dropzone, _objectSpread(_objectSpread({},
|
126
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropzone.Dropzone, _objectSpread(_objectSpread({}, dropzoneProps), {}, {
|
121
127
|
ref: ref,
|
122
128
|
onDrop: onDrop,
|
123
129
|
hideFiles: true
|
@@ -128,6 +134,7 @@ var FilePicker = exports.FilePicker = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
128
134
|
errors = _ref5.errors;
|
129
135
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FileCard, {
|
130
136
|
file: file,
|
137
|
+
clearable: clearable,
|
131
138
|
errors: errors,
|
132
139
|
removeFileTooltip: locale.removeFile,
|
133
140
|
onDelete: function onDelete() {
|
@@ -123,7 +123,7 @@ var Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
|
|
123
123
|
}
|
124
124
|
},
|
125
125
|
children: [Icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
|
126
|
-
className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["ml-4 shrink-0 ", ""])), disabled ? "text-grey-
|
126
|
+
className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["ml-4 shrink-0 ", ""])), disabled ? "text-grey-300" : focused ? "text-accent-600" : "text-grey-500"),
|
127
127
|
width: iconSize,
|
128
128
|
height: iconSize
|
129
129
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
// @ts-check
|
4
4
|
var plugin = require("tailwindcss/plugin");
|
5
|
-
var disabledColor = require("../../styles/disabledColor");
|
6
|
-
var rgba = require("../../styles/rgba");
|
7
5
|
var inputPlugin = plugin(function (_ref) {
|
8
6
|
var addComponents = _ref.addComponents,
|
9
7
|
theme = _ref.theme;
|
@@ -18,7 +16,6 @@ var inputPlugin = plugin(function (_ref) {
|
|
18
16
|
backgroundColor: theme("colors.white"),
|
19
17
|
border: "1px solid ".concat(theme("colors.grey.500")),
|
20
18
|
borderRadius: theme("borderRadius.DEFAULT"),
|
21
|
-
boxShadow: "inset 0px 1px 4px 0px ".concat(rgba(theme("colors.grey.500"), 0.3)),
|
22
19
|
overflow: "hidden",
|
23
20
|
transition: "all 100ms ease-in-out",
|
24
21
|
"&:not(.input-disabled, .focusable-show):hover": {
|
@@ -46,15 +43,18 @@ var inputPlugin = plugin(function (_ref) {
|
|
46
43
|
"&::placeholder": {
|
47
44
|
color: theme("colors.grey.600")
|
48
45
|
}
|
46
|
+
},
|
47
|
+
"&:has(input:read-only:not(input:disabled))": {
|
48
|
+
backgroundColor: theme("colors.grey.100"),
|
49
|
+
borderColor: "transparent"
|
49
50
|
}
|
50
51
|
},
|
51
52
|
".input-disabled": {
|
52
53
|
cursor: "not-allowed",
|
53
|
-
background:
|
54
|
-
borderColor:
|
55
|
-
boxShadow: "none",
|
54
|
+
background: theme("colors.grey.100"),
|
55
|
+
borderColor: theme("colors.grey.200"),
|
56
56
|
"input, input::placeholder": {
|
57
|
-
color: theme("colors.grey.
|
57
|
+
color: theme("colors.grey.600"),
|
58
58
|
pointerEvents: "none"
|
59
59
|
}
|
60
60
|
},
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
// @ts-check
|
4
4
|
var plugin = require("tailwindcss/plugin");
|
5
|
-
var disabledColor = require("../../styles/disabledColor");
|
6
|
-
var rgba = require("../../styles/rgba");
|
7
5
|
var textAreaPlugin = plugin(function (_ref) {
|
8
6
|
var addComponents = _ref.addComponents,
|
9
7
|
theme = _ref.theme;
|
@@ -14,7 +12,6 @@ var textAreaPlugin = plugin(function (_ref) {
|
|
14
12
|
backgroundColor: theme("colors.white"),
|
15
13
|
border: "1px solid ".concat(theme("colors.grey.500")),
|
16
14
|
borderRadius: theme("borderRadius.DEFAULT"),
|
17
|
-
boxShadow: "inset 0px 1px 4px 0px ".concat(rgba(theme("colors.grey.500"), 0.3)),
|
18
15
|
transition: "all 100ms ease-in-out",
|
19
16
|
fontSize: theme("fontSize.base"),
|
20
17
|
lineHeight: theme("lineHeight.base"),
|
@@ -25,8 +22,11 @@ var textAreaPlugin = plugin(function (_ref) {
|
|
25
22
|
borderColor: theme("colors.grey.600")
|
26
23
|
},
|
27
24
|
"&:has(textarea:disabled)": {
|
28
|
-
borderColor:
|
29
|
-
|
25
|
+
borderColor: theme("colors.grey.200")
|
26
|
+
},
|
27
|
+
"&:has(textarea:read-only:not(textarea:disabled))": {
|
28
|
+
backgroundColor: theme("colors.grey.100"),
|
29
|
+
borderColor: "transparent"
|
30
30
|
}
|
31
31
|
},
|
32
32
|
".text-area-invalid": {
|
@@ -55,8 +55,8 @@ var textAreaPlugin = plugin(function (_ref) {
|
|
55
55
|
},
|
56
56
|
"&:disabled": {
|
57
57
|
cursor: "not-allowed",
|
58
|
-
color: theme("colors.grey.
|
59
|
-
background:
|
58
|
+
color: theme("colors.grey.600"),
|
59
|
+
background: theme("colors.grey.100")
|
60
60
|
}
|
61
61
|
},
|
62
62
|
".text-area-invalid:not(.text-area:disabled)": {
|
@@ -19,7 +19,7 @@ export declare const MenuButton: {
|
|
19
19
|
Divider: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
|
20
20
|
Item: import("react").ForwardRefExoticComponent<import("./useMenuItemProps").BaseItemProps<HTMLDivElement> & DropdownMenu.DropdownMenuItemProps & {
|
21
21
|
startIcon?: import("../..").IconComponentType | undefined;
|
22
|
-
variant?: "
|
22
|
+
variant?: "destructive" | "default" | undefined;
|
23
23
|
} & {
|
24
24
|
children?: import("react").ReactNode;
|
25
25
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
@@ -19,7 +19,7 @@ export declare const Item: import("react").ForwardRefExoticComponent<BaseItemPro
|
|
19
19
|
* Variant of the item
|
20
20
|
* @default "default"
|
21
21
|
*/
|
22
|
-
variant?: "
|
22
|
+
variant?: "destructive" | "default" | undefined;
|
23
23
|
} & {
|
24
24
|
children?: import("react").ReactNode;
|
25
25
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
@@ -2,7 +2,7 @@ import type { FC, ReactNode } from "react";
|
|
2
2
|
import { ModalFooter } from "./components/ModalFooter";
|
3
3
|
import { ModalSection } from "./components/ModalSection";
|
4
4
|
import type { XOR } from "../../types";
|
5
|
-
export declare type ModalSizeVariant = "medium" | "large";
|
5
|
+
export declare type ModalSizeVariant = "small" | "medium" | "large";
|
6
6
|
export declare type ModalLocale = {
|
7
7
|
dismissText?: string;
|
8
8
|
modalTitle?: string;
|
@@ -21,7 +21,7 @@ var _Satellite = require("./../../Satellite");
|
|
21
21
|
var _satellitePrefixer = _interopRequireDefault(require("./../../styles/helpers/satellitePrefixer"));
|
22
22
|
var _prefersReducedMotion = require("./../../utils/prefersReducedMotion");
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
24
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
|
24
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
|
25
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
26
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
27
27
|
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; }
|
@@ -31,8 +31,14 @@ var DEFAULT_MODAL_LOCALE = {
|
|
31
31
|
modalTitle: "Modal"
|
32
32
|
};
|
33
33
|
var SIZE_CLASSNAMES = {
|
34
|
-
|
35
|
-
|
34
|
+
small: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["modal-dialog-small"]))),
|
35
|
+
medium: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["modal-dialog-medium"]))),
|
36
|
+
large: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["modal-dialog-large"])))
|
37
|
+
};
|
38
|
+
var SIZE_PADDING_CLASSNAMES = {
|
39
|
+
small: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["p-6"]))),
|
40
|
+
medium: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["p-8"]))),
|
41
|
+
large: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["p-10"])))
|
36
42
|
};
|
37
43
|
|
38
44
|
/**
|
@@ -80,10 +86,10 @@ var Modal = exports.Modal = function Modal(_ref) {
|
|
80
86
|
asChild: true,
|
81
87
|
children: triggerButton
|
82
88
|
}), createPortal( /*#__PURE__*/(0, _jsxRuntime.jsx)(Dialog.Overlay, {
|
83
|
-
className: (0, _clsx["default"])(animate && !_prefersReducedMotion.prefersReducedMotion && (0, _satellitePrefixer["default"])(
|
89
|
+
className: (0, _clsx["default"])(animate && !_prefersReducedMotion.prefersReducedMotion && (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["modal-animated"]))), (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["modal-overlay bg-grey-900/30 z-modalOverlay inset-0 fixed w-full h-full flex items-start justify-center overflow-x-hidden overflow-y-auto px-4 py-10"])))),
|
84
90
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Dialog.Content, {
|
85
91
|
ref: dialogContentRef,
|
86
|
-
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(
|
92
|
+
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["modal-content"]))), SIZE_CLASSNAMES[size], centerY && (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["flex m-auto"])))),
|
87
93
|
"aria-describedby": undefined,
|
88
94
|
onOpenAutoFocus: function onOpenAutoFocus(e) {
|
89
95
|
var _closeButtonRef$curre;
|
@@ -101,28 +107,28 @@ var Modal = exports.Modal = function Modal(_ref) {
|
|
101
107
|
}
|
102
108
|
},
|
103
109
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
104
|
-
className: (0, _satellitePrefixer["default"])(
|
110
|
+
className: (0, _satellitePrefixer["default"])(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["modal-container"]))),
|
105
111
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Layout.Card, {
|
106
112
|
as: "div",
|
107
113
|
elevation: "500",
|
108
|
-
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(
|
114
|
+
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["relative"]))), className),
|
109
115
|
fullBleed: true,
|
110
116
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("header", {
|
111
|
-
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(
|
117
|
+
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["min-h-14 flex items-center justify-between space-x-2"]))), title ? (0, _satellitePrefixer["default"])(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["border-b border-grey-100 pl-8 pr-16"]))) : (0, _satellitePrefixer["default"])(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["justify-end px-8"]))), !title && hideCloseIcon && (0, _satellitePrefixer["default"])(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["hidden"])))),
|
112
118
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Dialog.Title, {
|
113
119
|
asChild: true,
|
114
120
|
children: title ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
115
|
-
className: (0, _satellitePrefixer["default"])(
|
121
|
+
className: (0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["flex-1 display-heading truncate"]))),
|
116
122
|
children: title
|
117
123
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactVisuallyHidden.VisuallyHidden, {
|
118
124
|
children: locale.modalTitle
|
119
125
|
})
|
120
126
|
})
|
121
127
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
122
|
-
className: (0, _clsx["default"])(!fullBleed &&
|
128
|
+
className: (0, _clsx["default"])(!fullBleed && SIZE_PADDING_CLASSNAMES[size]),
|
123
129
|
children: children
|
124
130
|
}), !hideCloseIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
125
|
-
className: (0, _satellitePrefixer["default"])(
|
131
|
+
className: (0, _satellitePrefixer["default"])(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["-mr-2 absolute top-3 right-8"]))),
|
126
132
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Dialog.Close, {
|
127
133
|
ref: closeButtonRef,
|
128
134
|
asChild: true,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { IconButtonWithFeedbackLocale } from "../Actions";
|
1
2
|
import type { AutoCompleteLocale, DateInputLocale, DatePickerLocale, DropzoneLocale, ExperimentalDateRangeInputLocale, ExperimentalFormLocale, FilePickerLocale, InputPropsLocale } from "../Fields";
|
2
3
|
import type { AnnouncementBadgeLocale, TagLocale, ToastLocale, ToastsLocale } from "../Indicators";
|
3
4
|
import type { UserAvatarLocale } from "../Indicators/Avatars";
|
@@ -17,6 +18,7 @@ export declare type ComponentsLocales = {
|
|
17
18
|
filePicker?: FilePickerLocale;
|
18
19
|
form?: ExperimentalFormLocale;
|
19
20
|
input?: InputPropsLocale;
|
21
|
+
iconButtonWithFeedback?: IconButtonWithFeedbackLocale;
|
20
22
|
modal?: ModalLocale;
|
21
23
|
pagination?: PaginationLocale;
|
22
24
|
popover?: PopoverLocale;
|
@@ -83,7 +83,7 @@ var typographyPlugin = plugin(function (_ref) {
|
|
83
83
|
"display-small": {
|
84
84
|
fontSize: theme("fontSize.lg"),
|
85
85
|
lineHeight: theme("lineHeight.lg"),
|
86
|
-
fontWeight: theme("fontWeight.
|
86
|
+
fontWeight: theme("fontWeight.semibold")
|
87
87
|
},
|
88
88
|
"display-heading": {
|
89
89
|
fontSize: theme("fontSize.md"),
|
@@ -1 +1 @@
|
|
1
|
-
export declare const isCssPropertySupported: <P extends number | typeof Symbol.iterator | "filter" | "fill" | "width" | "height" | "color" | "alignmentBaseline" | "baselineShift" | "clip" | "clipPath" | "clipRule" | "colorInterpolation" | "colorInterpolationFilters" | "cursor" | "direction" | "display" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "imageRendering" | "letterSpacing" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "offset" | "opacity" | "order" | "overflow" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "textDecoration" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "wordSpacing" | "writingMode" | "grid" | "
|
1
|
+
export declare const isCssPropertySupported: <P extends number | typeof Symbol.iterator | "filter" | "fill" | "width" | "height" | "color" | "alignmentBaseline" | "baselineShift" | "clip" | "clipPath" | "clipRule" | "colorInterpolation" | "colorInterpolationFilters" | "cursor" | "direction" | "display" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "imageRendering" | "letterSpacing" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "offset" | "opacity" | "order" | "overflow" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "textDecoration" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "wordSpacing" | "writingMode" | "grid" | "marker" | "translate" | "content" | "item" | "all" | "border" | "left" | "right" | "columns" | "top" | "bottom" | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "animation" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "appearance" | "aspectRatio" | "backfaceVisibility" | "background" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockSize" | "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" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "clear" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRule" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "contain" | "counterIncrement" | "counterReset" | "counterSet" | "cssFloat" | "cssText" | "emptyCells" | "flex" | "flexBasis" | "flexDirection" | "flexFlow" | "flexGrow" | "flexShrink" | "flexWrap" | "float" | "font" | "fontFeatureSettings" | "fontKerning" | "fontOpticalSizing" | "fontSynthesis" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontVariationSettings" | "gap" | "gridArea" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumn" | "gridColumnEnd" | "gridColumnGap" | "gridColumnStart" | "gridGap" | "gridRow" | "gridRowEnd" | "gridRowGap" | "gridRowStart" | "gridTemplate" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hyphens" | "imageOrientation" | "inlineSize" | "inset" | "insetBlock" | "insetBlockEnd" | "insetBlockStart" | "insetInline" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "lineBreak" | "lineHeight" | "listStyle" | "listStyleImage" | "listStylePosition" | "listStyleType" | "margin" | "marginBlock" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInline" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetDistance" | "offsetPath" | "offsetRotate" | "orphans" | "outline" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflowAnchor" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "padding" | "paddingBlock" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInline" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "perspective" | "perspectiveOrigin" | "placeContent" | "placeItems" | "placeSelf" | "position" | "printColorAdjust" | "quotes" | "resize" | "rowGap" | "rubyPosition" | "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" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasis" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textOrientation" | "textOverflow" | "textShadow" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transformBox" | "transformOrigin" | "transformStyle" | "transition" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "userSelect" | "verticalAlign" | "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" | "webkitTextSizeAdjust" | "webkitTextStroke" | "webkitTextStrokeColor" | "webkitTextStrokeWidth" | "webkitTransform" | "webkitTransformOrigin" | "webkitTransformStyle" | "webkitTransition" | "webkitTransitionDelay" | "webkitTransitionDuration" | "webkitTransitionProperty" | "webkitTransitionTimingFunction" | "webkitUserSelect" | "whiteSpace" | "widows" | "willChange" | "wordBreak" | "wordWrap" | "zIndex" | "getPropertyPriority" | "getPropertyValue" | "removeProperty" | "setProperty">(prop: P, value: CSSStyleDeclaration[P]) => boolean;
|
@@ -10,4 +10,4 @@ var _window$matchMedia, _window;
|
|
10
10
|
*
|
11
11
|
* @returns {boolean}
|
12
12
|
*/
|
13
|
-
var prefersReducedMotion = exports.prefersReducedMotion = typeof window !== "undefined" && ((_window$matchMedia = (_window = window).matchMedia) === null || _window$matchMedia === void 0
|
13
|
+
var prefersReducedMotion = exports.prefersReducedMotion = typeof window !== "undefined" && ((_window$matchMedia = (_window = window).matchMedia) === null || _window$matchMedia === void 0 || (_window$matchMedia = _window$matchMedia.call(_window, "(prefers-reduced-motion: reduce)")) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.matches) === true;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useTimeoutFn = useTimeoutFn;
|
7
|
+
var _react = require("react");
|
8
|
+
// Taken from: https://github.com/streamich/react-use/blob/master/src/useTimeoutFn.ts
|
9
|
+
// `setOnMount` has been added compared to the original implementation.
|
10
|
+
function useTimeoutFn(fn) {
|
11
|
+
var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
12
|
+
var setOnMount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
13
|
+
var ready = (0, _react.useRef)(false);
|
14
|
+
var timeout = (0, _react.useRef)();
|
15
|
+
var callback = (0, _react.useRef)(fn);
|
16
|
+
var isReady = (0, _react.useCallback)(function () {
|
17
|
+
return ready.current;
|
18
|
+
}, []);
|
19
|
+
var set = (0, _react.useCallback)(function () {
|
20
|
+
ready.current = false;
|
21
|
+
timeout.current && clearTimeout(timeout.current);
|
22
|
+
timeout.current = setTimeout(function () {
|
23
|
+
ready.current = true;
|
24
|
+
callback.current();
|
25
|
+
}, ms);
|
26
|
+
}, [ms]);
|
27
|
+
var clear = (0, _react.useCallback)(function () {
|
28
|
+
ready.current = null;
|
29
|
+
timeout.current && clearTimeout(timeout.current);
|
30
|
+
}, []);
|
31
|
+
|
32
|
+
// update ref when function changes
|
33
|
+
(0, _react.useEffect)(function () {
|
34
|
+
callback.current = fn;
|
35
|
+
}, [fn]);
|
36
|
+
|
37
|
+
// set on mount, clear on unmount
|
38
|
+
(0, _react.useEffect)(function () {
|
39
|
+
if (setOnMount) set();
|
40
|
+
return clear;
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
42
|
+
}, [setOnMount, ms]);
|
43
|
+
return [isReady, clear, set];
|
44
|
+
}
|
@@ -15,7 +15,6 @@ export interface IconButtonBaseProps {
|
|
15
15
|
size?: ButtonSize;
|
16
16
|
/**
|
17
17
|
* Whether the `IconButton` is disabled.
|
18
|
-
* @default false
|
19
18
|
*/
|
20
19
|
disabled?: boolean;
|
21
20
|
/**
|
@@ -28,7 +27,6 @@ export interface IconButtonBaseProps {
|
|
28
27
|
title: string;
|
29
28
|
/**
|
30
29
|
* Whether to show the tooltip.
|
31
|
-
* @default false
|
32
30
|
*/
|
33
31
|
showTooltip?: boolean;
|
34
32
|
/**
|
@@ -36,6 +34,16 @@ export interface IconButtonBaseProps {
|
|
36
34
|
* @default top
|
37
35
|
*/
|
38
36
|
tooltipSide?: TooltipWrapperBaseProps["side"];
|
37
|
+
/**
|
38
|
+
* The delay before showing the tooltip.
|
39
|
+
* @default 500
|
40
|
+
*/
|
41
|
+
tooltipDelay?: TooltipWrapperBaseProps["delay"];
|
42
|
+
/**
|
43
|
+
* The delay before hiding the tooltip.
|
44
|
+
* @default 500
|
45
|
+
*/
|
46
|
+
tooltipHideDelay?: TooltipWrapperBaseProps["hideDelay"];
|
39
47
|
/**
|
40
48
|
* Whether the `IconButton` is loading.
|
41
49
|
* @default false
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
4
|
-
var _excluded = ["as", "className", "variant", "size", "icon", "title", "showTooltip", "tooltipSide", "loading"];
|
4
|
+
var _excluded = ["as", "className", "variant", "size", "icon", "title", "showTooltip", "tooltipSide", "tooltipDelay", "tooltipHideDelay", "loading"];
|
5
5
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
6
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
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; }
|
@@ -40,6 +40,10 @@ export var PolymorphicIconButton = /*#__PURE__*/forwardRef(function (props, ref)
|
|
40
40
|
showTooltip = props.showTooltip,
|
41
41
|
_props$tooltipSide = props.tooltipSide,
|
42
42
|
tooltipSide = _props$tooltipSide === void 0 ? "top" : _props$tooltipSide,
|
43
|
+
_props$tooltipDelay = props.tooltipDelay,
|
44
|
+
tooltipDelay = _props$tooltipDelay === void 0 ? 500 : _props$tooltipDelay,
|
45
|
+
_props$tooltipHideDel = props.tooltipHideDelay,
|
46
|
+
tooltipHideDelay = _props$tooltipHideDel === void 0 ? 500 : _props$tooltipHideDel,
|
43
47
|
_props$loading = props.loading,
|
44
48
|
loading = _props$loading === void 0 ? false : _props$loading,
|
45
49
|
cleanedProps = _objectWithoutProperties(props, _excluded);
|
@@ -54,12 +58,14 @@ export var PolymorphicIconButton = /*#__PURE__*/forwardRef(function (props, ref)
|
|
54
58
|
cleanedProps.type = "button";
|
55
59
|
}
|
56
60
|
return /*#__PURE__*/_jsx(TooltipWrapper, {
|
57
|
-
delay:
|
61
|
+
delay: tooltipDelay,
|
62
|
+
hideDelay: tooltipHideDelay,
|
58
63
|
show: showTooltip,
|
59
64
|
side: tooltipSide,
|
60
65
|
content: title,
|
61
66
|
children: /*#__PURE__*/_jsx(Tag, _objectSpread(_objectSpread({}, cleanedProps), {}, {
|
62
67
|
className: iconButtonClassName,
|
68
|
+
"aria-busy": loading,
|
63
69
|
"aria-label": title,
|
64
70
|
ref: ref,
|
65
71
|
children: /*#__PURE__*/_jsxs(_Fragment, {
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import type { FC, MouseEvent } from "react";
|
2
|
+
import type { IconButtonProps } from "../../Actions/IconButton/IconButton";
|
3
|
+
import type { IconComponentType } from "../../Icons";
|
4
|
+
export declare const RESET_STATUS_DELAY = 100;
|
5
|
+
export declare type IconButtonWithFeedbackLocale = {
|
6
|
+
/**
|
7
|
+
* The tooltip message shown after a successful click.
|
8
|
+
* @default "Success"
|
9
|
+
*/
|
10
|
+
success?: string;
|
11
|
+
/**
|
12
|
+
* The tooltip message shown after an error occurs in the `onClick` handler.
|
13
|
+
* @default "Something went wrong"
|
14
|
+
*/
|
15
|
+
error?: string;
|
16
|
+
/**
|
17
|
+
* The tooltip message shown while the action is loading.
|
18
|
+
* @default "Loading..."
|
19
|
+
*/
|
20
|
+
loading?: string;
|
21
|
+
};
|
22
|
+
export declare type IconButtonWithFeedbackProps = Omit<IconButtonProps, "title" | "showTooltip" | "loading" | "onClick"> & {
|
23
|
+
/**
|
24
|
+
* The icon to display when the action succeeds.
|
25
|
+
* Set to `false` to disable the success icon.
|
26
|
+
* @default CheckIcon
|
27
|
+
*/
|
28
|
+
successIcon?: IconComponentType | false;
|
29
|
+
/**
|
30
|
+
* The icon to display when the action fails.
|
31
|
+
* Set to `false` to disable the error icon.
|
32
|
+
* @default AlertTriangleIcon
|
33
|
+
*/
|
34
|
+
errorIcon?: IconComponentType | false;
|
35
|
+
/**
|
36
|
+
* The tooltip message shown by default.
|
37
|
+
*/
|
38
|
+
message: string;
|
39
|
+
/**
|
40
|
+
* The locale for the tooltip messages.
|
41
|
+
*/
|
42
|
+
locale?: IconButtonWithFeedbackLocale;
|
43
|
+
/**
|
44
|
+
* How long to show the success message tooltip (ms).
|
45
|
+
* @default 1000
|
46
|
+
*/
|
47
|
+
tooltipSuccessMessageDuration?: number;
|
48
|
+
/**
|
49
|
+
* How long to show the error message tooltip (ms).
|
50
|
+
* @default 2000
|
51
|
+
*/
|
52
|
+
tooltipErrorMessageDuration?: number;
|
53
|
+
/**
|
54
|
+
* Called when the button is clicked.
|
55
|
+
* Can be async.
|
56
|
+
*/
|
57
|
+
onClick?: (evt: MouseEvent<HTMLButtonElement>) => Promise<void> | void;
|
58
|
+
/**
|
59
|
+
* Called when an error occurs during `onClick`.
|
60
|
+
*/
|
61
|
+
onError?: (error: unknown) => void;
|
62
|
+
};
|
63
|
+
/**
|
64
|
+
* A compact, icon-only button that displays contextual tooltips on hover and click, enhancing user understanding and confirmation.
|
65
|
+
*
|
66
|
+
* See the [IconButtonWithFeedback documentation page](https://zeroheight.com/8261d6576/p/70da74-icon-button-with-feedback) for more information.
|
67
|
+
*/
|
68
|
+
export declare const IconButtonWithFeedback: FC<IconButtonWithFeedbackProps>;
|