@activecollab/components 1.0.217 → 1.0.218
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/dist/cjs/components/EditableContent/EditableContent.js +1 -7
- package/dist/cjs/components/EditableContent/EditableContent.js.map +1 -1
- package/dist/esm/components/EditableContent/EditableContent.d.ts.map +1 -1
- package/dist/esm/components/EditableContent/EditableContent.js +2 -7
- package/dist/esm/components/EditableContent/EditableContent.js.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.EditableContent = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _useForkRef = _interopRequireDefault(require("../../utils/useForkRef"));
|
|
10
9
|
var _Styles = require("./Styles");
|
|
11
10
|
var _excluded = ["className", "variant", "weight", "disabled", "inputProps", "wrapRef"];
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
13
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -25,11 +23,7 @@ var EditableContent = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
25
23
|
inputProps = _ref.inputProps,
|
|
26
24
|
wrapRef = _ref.wrapRef,
|
|
27
25
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
-
var intInputRef = (0, _react.useRef)(null);
|
|
29
|
-
var handleRef = (0, _useForkRef.default)(ref, intInputRef);
|
|
30
26
|
var handleBlur = (0, _react.useCallback)(function (evt) {
|
|
31
|
-
var _intInputRef$current;
|
|
32
|
-
intInputRef === null || intInputRef === void 0 ? void 0 : (_intInputRef$current = intInputRef.current) === null || _intInputRef$current === void 0 ? void 0 : _intInputRef$current.setSelectionRange(0, 0);
|
|
33
27
|
typeof (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === "function" && (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur(evt));
|
|
34
28
|
}, [inputProps]);
|
|
35
29
|
return /*#__PURE__*/_react.default.createElement(_Styles.StyledDiv, _extends({
|
|
@@ -41,7 +35,7 @@ var EditableContent = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
41
35
|
weight: weight,
|
|
42
36
|
$disabled: disabled
|
|
43
37
|
}, inputProps === null || inputProps === void 0 ? void 0 : inputProps.value), /*#__PURE__*/_react.default.createElement(_Styles.StyledInput, _extends({}, inputProps, {
|
|
44
|
-
ref:
|
|
38
|
+
ref: ref,
|
|
45
39
|
forwardedAs: "input",
|
|
46
40
|
variant: variant,
|
|
47
41
|
weight: weight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableContent.js","names":["EditableContent","forwardRef","ref","className","variant","weight","disabled","inputProps","wrapRef","props","
|
|
1
|
+
{"version":3,"file":"EditableContent.js","names":["EditableContent","forwardRef","ref","className","variant","weight","disabled","inputProps","wrapRef","props","handleBlur","useCallback","evt","onBlur","value","displayName"],"sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"sourcesContent":["import React, { forwardRef, Ref, useCallback } from \"react\";\nimport { Variant } from \"../Typography/Typography\";\nimport { StyledDiv, StyledInput, StyledSpan } from \"./Styles\";\n\nexport interface EditableContentInterface {\n /** Typography variant. */\n variant?: Variant;\n /** Typography weight. */\n weight?: \"light\" | \"regular\" | \"bold\" | \"medium\";\n /** Input props. */\n inputProps?: Partial<React.ComponentPropsWithoutRef<\"input\">>;\n /** Disable edit mode. */\n disabled?: boolean;\n /** Wrapper reference. */\n wrapRef?: Ref<HTMLDivElement>;\n}\n\nexport const EditableContent = forwardRef<\n HTMLDivElement,\n EditableContentInterface &\n Omit<React.ComponentPropsWithoutRef<\"div\">, keyof EditableContentInterface>\n>(\n (\n {\n className,\n variant = \"Body 2\",\n weight,\n disabled = false,\n inputProps,\n wrapRef,\n ...props\n },\n ref\n ) => {\n const handleBlur = useCallback(\n (evt) => {\n typeof inputProps?.onBlur === `function` && inputProps?.onBlur(evt);\n },\n [inputProps]\n );\n\n return (\n <StyledDiv className={className} ref={wrapRef} {...props}>\n <StyledSpan\n variant={variant}\n forwardedAs=\"span\"\n weight={weight}\n $disabled={disabled}\n >\n {inputProps?.value}\n </StyledSpan>\n <StyledInput\n {...inputProps}\n ref={ref}\n forwardedAs=\"input\"\n variant={variant}\n weight={weight}\n value={inputProps?.value}\n onBlur={handleBlur}\n disabled={disabled}\n />\n </StyledDiv>\n );\n }\n);\n\nEditableContent.displayName = \"EditableContent\";\n"],"mappings":";;;;;;;AAAA;AAEA;AAA8D;AAAA;AAAA;AA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ableContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"EditableContent.d.ts","sourceRoot":"","sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,GAAG,EAAe,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,MAAM,WAAW,wBAAwB;IAEvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;IAEjD,UAAU,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC;IAE9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,OAAO,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe,yuJA+C3B,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
var _excluded = ["className", "variant", "weight", "disabled", "inputProps", "wrapRef"];
|
|
4
|
-
import React, { forwardRef,
|
|
5
|
-
import useForkRef from "../../utils/useForkRef";
|
|
4
|
+
import React, { forwardRef, useCallback } from "react";
|
|
6
5
|
import { StyledDiv, StyledInput, StyledSpan } from "./Styles";
|
|
7
6
|
export var EditableContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
8
7
|
var className = _ref.className,
|
|
@@ -14,11 +13,7 @@ export var EditableContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
14
13
|
inputProps = _ref.inputProps,
|
|
15
14
|
wrapRef = _ref.wrapRef,
|
|
16
15
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
17
|
-
var intInputRef = useRef(null);
|
|
18
|
-
var handleRef = useForkRef(ref, intInputRef);
|
|
19
16
|
var handleBlur = useCallback(function (evt) {
|
|
20
|
-
var _intInputRef$current;
|
|
21
|
-
intInputRef == null ? void 0 : (_intInputRef$current = intInputRef.current) == null ? void 0 : _intInputRef$current.setSelectionRange(0, 0);
|
|
22
17
|
typeof (inputProps == null ? void 0 : inputProps.onBlur) === "function" && (inputProps == null ? void 0 : inputProps.onBlur(evt));
|
|
23
18
|
}, [inputProps]);
|
|
24
19
|
return /*#__PURE__*/React.createElement(StyledDiv, _extends({
|
|
@@ -30,7 +25,7 @@ export var EditableContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
30
25
|
weight: weight,
|
|
31
26
|
$disabled: disabled
|
|
32
27
|
}, inputProps == null ? void 0 : inputProps.value), /*#__PURE__*/React.createElement(StyledInput, _extends({}, inputProps, {
|
|
33
|
-
ref:
|
|
28
|
+
ref: ref,
|
|
34
29
|
forwardedAs: "input",
|
|
35
30
|
variant: variant,
|
|
36
31
|
weight: weight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableContent.js","names":["React","forwardRef","
|
|
1
|
+
{"version":3,"file":"EditableContent.js","names":["React","forwardRef","useCallback","StyledDiv","StyledInput","StyledSpan","EditableContent","ref","className","variant","weight","disabled","inputProps","wrapRef","props","handleBlur","evt","onBlur","value","displayName"],"sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"sourcesContent":["import React, { forwardRef, Ref, useCallback } from \"react\";\nimport { Variant } from \"../Typography/Typography\";\nimport { StyledDiv, StyledInput, StyledSpan } from \"./Styles\";\n\nexport interface EditableContentInterface {\n /** Typography variant. */\n variant?: Variant;\n /** Typography weight. */\n weight?: \"light\" | \"regular\" | \"bold\" | \"medium\";\n /** Input props. */\n inputProps?: Partial<React.ComponentPropsWithoutRef<\"input\">>;\n /** Disable edit mode. */\n disabled?: boolean;\n /** Wrapper reference. */\n wrapRef?: Ref<HTMLDivElement>;\n}\n\nexport const EditableContent = forwardRef<\n HTMLDivElement,\n EditableContentInterface &\n Omit<React.ComponentPropsWithoutRef<\"div\">, keyof EditableContentInterface>\n>(\n (\n {\n className,\n variant = \"Body 2\",\n weight,\n disabled = false,\n inputProps,\n wrapRef,\n ...props\n },\n ref\n ) => {\n const handleBlur = useCallback(\n (evt) => {\n typeof inputProps?.onBlur === `function` && inputProps?.onBlur(evt);\n },\n [inputProps]\n );\n\n return (\n <StyledDiv className={className} ref={wrapRef} {...props}>\n <StyledSpan\n variant={variant}\n forwardedAs=\"span\"\n weight={weight}\n $disabled={disabled}\n >\n {inputProps?.value}\n </StyledSpan>\n <StyledInput\n {...inputProps}\n ref={ref}\n forwardedAs=\"input\"\n variant={variant}\n weight={weight}\n value={inputProps?.value}\n onBlur={handleBlur}\n disabled={disabled}\n />\n </StyledDiv>\n );\n }\n);\n\nEditableContent.displayName = \"EditableContent\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAOC,WAAW,QAAQ,OAAO;AAE3D,SAASC,SAAS,EAAEC,WAAW,EAAEC,UAAU,QAAQ,UAAU;AAe7D,OAAO,IAAMC,eAAe,gBAAGL,UAAU,CAKvC,gBAUEM,GAAG,EACA;EAAA,IATDC,SAAS,QAATA,SAAS;IAAA,oBACTC,OAAO;IAAPA,OAAO,6BAAG,QAAQ;IAClBC,MAAM,QAANA,MAAM;IAAA,qBACNC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;IAChBC,UAAU,QAAVA,UAAU;IACVC,OAAO,QAAPA,OAAO;IACJC,KAAK;EAIV,IAAMC,UAAU,GAAGb,WAAW,CAC5B,UAACc,GAAG,EAAK;IACP,QAAOJ,UAAU,oBAAVA,UAAU,CAAEK,MAAM,gBAAe,KAAIL,UAAU,oBAAVA,UAAU,CAAEK,MAAM,CAACD,GAAG,CAAC;EACrE,CAAC,EACD,CAACJ,UAAU,CAAC,CACb;EAED,oBACE,oBAAC,SAAS;IAAC,SAAS,EAAEJ,SAAU;IAAC,GAAG,EAAEK;EAAQ,GAAKC,KAAK,gBACtD,oBAAC,UAAU;IACT,OAAO,EAAEL,OAAQ;IACjB,WAAW,EAAC,MAAM;IAClB,MAAM,EAAEC,MAAO;IACf,SAAS,EAAEC;EAAS,GAEnBC,UAAU,oBAAVA,UAAU,CAAEM,KAAK,CACP,eACb,oBAAC,WAAW,eACNN,UAAU;IACd,GAAG,EAAEL,GAAI;IACT,WAAW,EAAC,OAAO;IACnB,OAAO,EAAEE,OAAQ;IACjB,MAAM,EAAEC,MAAO;IACf,KAAK,EAAEE,UAAU,oBAAVA,UAAU,CAAEM,KAAM;IACzB,MAAM,EAAEH,UAAW;IACnB,QAAQ,EAAEJ;EAAS,GACnB,CACQ;AAEhB,CAAC,CACF;AAEDL,eAAe,CAACa,WAAW,GAAG,iBAAiB"}
|
package/dist/index.js
CHANGED
|
@@ -11600,11 +11600,7 @@
|
|
|
11600
11600
|
inputProps = _ref.inputProps,
|
|
11601
11601
|
wrapRef = _ref.wrapRef,
|
|
11602
11602
|
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
11603
|
-
var intInputRef = React.useRef(null);
|
|
11604
|
-
var handleRef = useForkRef(ref, intInputRef);
|
|
11605
11603
|
var handleBlur = React.useCallback(function (evt) {
|
|
11606
|
-
var _intInputRef$current;
|
|
11607
|
-
intInputRef === null || intInputRef === void 0 ? void 0 : (_intInputRef$current = intInputRef.current) === null || _intInputRef$current === void 0 ? void 0 : _intInputRef$current.setSelectionRange(0, 0);
|
|
11608
11604
|
typeof (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === "function" && (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur(evt));
|
|
11609
11605
|
}, [inputProps]);
|
|
11610
11606
|
return /*#__PURE__*/React__default["default"].createElement(StyledDiv, _extends({
|
|
@@ -11616,7 +11612,7 @@
|
|
|
11616
11612
|
weight: weight,
|
|
11617
11613
|
$disabled: disabled
|
|
11618
11614
|
}, inputProps === null || inputProps === void 0 ? void 0 : inputProps.value), /*#__PURE__*/React__default["default"].createElement(StyledInput, _extends({}, inputProps, {
|
|
11619
|
-
ref:
|
|
11615
|
+
ref: ref,
|
|
11620
11616
|
forwardedAs: "input",
|
|
11621
11617
|
variant: variant,
|
|
11622
11618
|
weight: weight,
|