@algolia/satellite 2.13.0 → 2.14.0

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.
@@ -20,6 +20,10 @@ export interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElemen
20
20
  * Whether the `TextArea` is disabled.
21
21
  */
22
22
  disabled?: boolean;
23
+ /**
24
+ * Whether the `TextArea` is in a loading state. When loading, the textarea is disabled and a spinner is shown.
25
+ */
26
+ loading?: boolean;
23
27
  }
24
28
  export type TextareaStatus = "default" | "validated" | "invalid";
25
29
  /**
@@ -12,10 +12,11 @@ var _clsx = _interopRequireDefault(require("clsx"));
12
12
  var _react = require("react");
13
13
  var _Field = require("./../Field");
14
14
  var _Icons = require("./../../Icons");
15
+ var _Indicators = require("./../../Indicators");
15
16
  var _satellitePrefixer = _interopRequireDefault(require("./../../styles/helpers/satellitePrefixer"));
16
17
  var _jsxRuntime = require("react/jsx-runtime");
17
- var _excluded = ["className", "placeholder", "required", "children"];
18
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
18
+ var _excluded = ["className", "placeholder", "required", "disabled", "loading", "children"];
19
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
19
20
  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
21
  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
22
  var STATUS_CLASSNAMES = {
@@ -44,6 +45,8 @@ var TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)(function (
44
45
  var className = _ref.className,
45
46
  placeholder = _ref.placeholder,
46
47
  required = _ref.required,
48
+ disabled = _ref.disabled,
49
+ loading = _ref.loading,
47
50
  children = _ref.children,
48
51
  textareaProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
49
52
  var _useField = (0, _Field.useField)({
@@ -53,6 +56,7 @@ var TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)(function (
53
56
  labelId = _useField.labelId,
54
57
  descriptionId = _useField.descriptionId,
55
58
  inputId = _useField.inputId;
59
+ var isDisabled = disabled || loading;
56
60
  var isInvalid = state.status === "invalid";
57
61
  var StatusIcon = isInvalid ? InvalidIcon : state.status === "validated" ? ValidatedIcon : _react.Fragment;
58
62
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -64,9 +68,13 @@ var TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)(function (
64
68
  id: (_textareaProps$id = textareaProps.id) !== null && _textareaProps$id !== void 0 ? _textareaProps$id : inputId,
65
69
  required: required,
66
70
  "aria-invalid": isInvalid,
71
+ disabled: isDisabled,
67
72
  ref: ref,
68
73
  placeholder: placeholder
69
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusIcon, {}), children]
74
+ })), loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Indicators.ProgressSpinner, {
75
+ className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["absolute top-4 right-4"]))),
76
+ size: 16
77
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusIcon, {}), children]
70
78
  });
71
79
  });
72
80
  TextArea.displayName = "TextArea";
@@ -32,7 +32,7 @@ var Item = exports.Item = /*#__PURE__*/(0, _react.forwardRef)(function (props, r
32
32
  className: (0, _clsx["default"])(mergedProps.className, (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["w-full"])))),
33
33
  ref: ref,
34
34
  children: [StartIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(StartIcon, {
35
- className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["mr-2 shrink-0 ", ""])), showDestructiveVariant ? "text-red-700" : "text-grey-500"),
35
+ className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["mr-2 shrink-0 ", ""])), mergedProps.disabled ? "text-grey-300" : showDestructiveVariant ? "text-red-700" : "text-grey-500"),
36
36
  width: "1rem",
37
37
  height: "1rem"
38
38
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
@@ -20,6 +20,10 @@ export interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElemen
20
20
  * Whether the `TextArea` is disabled.
21
21
  */
22
22
  disabled?: boolean;
23
+ /**
24
+ * Whether the `TextArea` is in a loading state. When loading, the textarea is disabled and a spinner is shown.
25
+ */
26
+ loading?: boolean;
23
27
  }
24
28
  export type TextareaStatus = "default" | "validated" | "invalid";
25
29
  /**
@@ -1,14 +1,15 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
- var _excluded = ["className", "placeholder", "required", "children"];
5
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
4
+ var _excluded = ["className", "placeholder", "required", "disabled", "loading", "children"];
5
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
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; }
8
8
  import cx from "clsx";
9
9
  import { forwardRef, Fragment } from "react";
10
10
  import { useField } from "./../Field";
11
11
  import { CheckIcon, XIcon } from "./../../Icons";
12
+ import { ProgressSpinner } from "./../../Indicators";
12
13
  import stl from "./../../styles/helpers/satellitePrefixer";
13
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
15
  var STATUS_CLASSNAMES = {
@@ -37,6 +38,8 @@ export var TextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
37
38
  var className = _ref.className,
38
39
  placeholder = _ref.placeholder,
39
40
  required = _ref.required,
41
+ disabled = _ref.disabled,
42
+ loading = _ref.loading,
40
43
  children = _ref.children,
41
44
  textareaProps = _objectWithoutProperties(_ref, _excluded);
42
45
  var _useField = useField({
@@ -46,6 +49,7 @@ export var TextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
46
49
  labelId = _useField.labelId,
47
50
  descriptionId = _useField.descriptionId,
48
51
  inputId = _useField.inputId;
52
+ var isDisabled = disabled || loading;
49
53
  var isInvalid = state.status === "invalid";
50
54
  var StatusIcon = isInvalid ? InvalidIcon : state.status === "validated" ? ValidatedIcon : Fragment;
51
55
  return /*#__PURE__*/_jsxs("div", {
@@ -57,9 +61,13 @@ export var TextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
57
61
  id: (_textareaProps$id = textareaProps.id) !== null && _textareaProps$id !== void 0 ? _textareaProps$id : inputId,
58
62
  required: required,
59
63
  "aria-invalid": isInvalid,
64
+ disabled: isDisabled,
60
65
  ref: ref,
61
66
  placeholder: placeholder
62
- })), /*#__PURE__*/_jsx(StatusIcon, {}), children]
67
+ })), loading ? /*#__PURE__*/_jsx(ProgressSpinner, {
68
+ className: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["absolute top-4 right-4"]))),
69
+ size: 16
70
+ }) : /*#__PURE__*/_jsx(StatusIcon, {}), children]
63
71
  });
64
72
  });
65
73
  TextArea.displayName = "TextArea";
@@ -23,7 +23,7 @@ export var Item = /*#__PURE__*/forwardRef(function (props, ref) {
23
23
  className: cx(mergedProps.className, stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["w-full"])))),
24
24
  ref: ref,
25
25
  children: [StartIcon && /*#__PURE__*/_jsx(StartIcon, {
26
- className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["mr-2 shrink-0 ", ""])), showDestructiveVariant ? "text-red-700" : "text-grey-500"),
26
+ className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["mr-2 shrink-0 ", ""])), mergedProps.disabled ? "text-grey-300" : showDestructiveVariant ? "text-red-700" : "text-grey-500"),
27
27
  width: "1rem",
28
28
  height: "1rem"
29
29
  }), /*#__PURE__*/_jsx("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/satellite",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "Algolia design system React components",
5
5
  "sideEffects": false,
6
6
  "scripts": {