@activecollab/components 1.0.218 → 1.0.219
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 +7 -1
- 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 +8 -2
- package/dist/esm/components/EditableContent/EditableContent.js.map +1 -1
- package/dist/index.js +6 -1
- 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,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.EditableContent = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _utils = require("../../utils");
|
|
9
10
|
var _Styles = require("./Styles");
|
|
10
11
|
var _excluded = ["className", "variant", "weight", "disabled", "inputProps", "wrapRef"];
|
|
11
12
|
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); }
|
|
@@ -23,7 +24,12 @@ var EditableContent = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
23
24
|
inputProps = _ref.inputProps,
|
|
24
25
|
wrapRef = _ref.wrapRef,
|
|
25
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
var intInputRef = (0, _react.useRef)(null);
|
|
28
|
+
var handleRef = (0, _utils.useForkRef)(ref, intInputRef);
|
|
26
29
|
var handleBlur = (0, _react.useCallback)(function (evt) {
|
|
30
|
+
if (intInputRef !== null && intInputRef !== void 0 && intInputRef.current) {
|
|
31
|
+
intInputRef.current.scrollLeft = 0;
|
|
32
|
+
}
|
|
27
33
|
typeof (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === "function" && (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur(evt));
|
|
28
34
|
}, [inputProps]);
|
|
29
35
|
return /*#__PURE__*/_react.default.createElement(_Styles.StyledDiv, _extends({
|
|
@@ -35,7 +41,7 @@ var EditableContent = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
35
41
|
weight: weight,
|
|
36
42
|
$disabled: disabled
|
|
37
43
|
}, inputProps === null || inputProps === void 0 ? void 0 : inputProps.value), /*#__PURE__*/_react.default.createElement(_Styles.StyledInput, _extends({}, inputProps, {
|
|
38
|
-
ref:
|
|
44
|
+
ref: handleRef,
|
|
39
45
|
forwardedAs: "input",
|
|
40
46
|
variant: variant,
|
|
41
47
|
weight: weight,
|
|
@@ -1 +1 @@
|
|
|
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={
|
|
1
|
+
{"version":3,"file":"EditableContent.js","names":["EditableContent","forwardRef","ref","className","variant","weight","disabled","inputProps","wrapRef","props","intInputRef","useRef","handleRef","useForkRef","handleBlur","useCallback","evt","current","scrollLeft","onBlur","value","displayName"],"sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"sourcesContent":["import React, { forwardRef, Ref, useCallback, useRef } from \"react\";\nimport { useForkRef } from \"../../utils\";\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 intInputRef = useRef<HTMLInputElement>(null);\n const handleRef = useForkRef(ref, intInputRef);\n\n const handleBlur = useCallback(\n (evt) => {\n if (intInputRef?.current) {\n intInputRef.current.scrollLeft = 0;\n }\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={handleRef}\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;AACA;AAEA;AAA8D;AAAA;AAAA;AAAA;AAAA;AAAA;AAevD,IAAMA,eAAe,gBAAG,IAAAC,iBAAU,EAKvC,gBAUEC,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,WAAW,GAAG,IAAAC,aAAM,EAAmB,IAAI,CAAC;EAClD,IAAMC,SAAS,GAAG,IAAAC,iBAAU,EAACX,GAAG,EAAEQ,WAAW,CAAC;EAE9C,IAAMI,UAAU,GAAG,IAAAC,kBAAW,EAC5B,UAACC,GAAG,EAAK;IACP,IAAIN,WAAW,aAAXA,WAAW,eAAXA,WAAW,CAAEO,OAAO,EAAE;MACxBP,WAAW,CAACO,OAAO,CAACC,UAAU,GAAG,CAAC;IACpC;IACA,QAAOX,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEY,MAAM,gBAAe,KAAIZ,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEY,MAAM,CAACH,GAAG,CAAC;EACrE,CAAC,EACD,CAACT,UAAU,CAAC,CACb;EAED,oBACE,6BAAC,iBAAS;IAAC,SAAS,EAAEJ,SAAU;IAAC,GAAG,EAAEK;EAAQ,GAAKC,KAAK,gBACtD,6BAAC,kBAAU;IACT,OAAO,EAAEL,OAAQ;IACjB,WAAW,EAAC,MAAM;IAClB,MAAM,EAAEC,MAAO;IACf,SAAS,EAAEC;EAAS,GAEnBC,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEa,KAAK,CACP,eACb,6BAAC,mBAAW,eACNb,UAAU;IACd,GAAG,EAAEK,SAAU;IACf,WAAW,EAAC,OAAO;IACnB,OAAO,EAAER,OAAQ;IACjB,MAAM,EAAEC,MAAO;IACf,KAAK,EAAEE,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEa,KAAM;IACzB,MAAM,EAAEN,UAAW;IACnB,QAAQ,EAAER;EAAS,GACnB,CACQ;AAEhB,CAAC,CACF;AAAC;AAEFN,eAAe,CAACqB,WAAW,GAAG,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableContent.d.ts","sourceRoot":"","sources":["../../../../src/components/EditableContent/EditableContent.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,EAAuB,MAAM,OAAO,CAAC;AAEpE,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,yuJAqD3B,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
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, useCallback } from "react";
|
|
4
|
+
import React, { forwardRef, useCallback, useRef } from "react";
|
|
5
|
+
import { useForkRef } from "../../utils";
|
|
5
6
|
import { StyledDiv, StyledInput, StyledSpan } from "./Styles";
|
|
6
7
|
export var EditableContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
7
8
|
var className = _ref.className,
|
|
@@ -13,7 +14,12 @@ export var EditableContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13
14
|
inputProps = _ref.inputProps,
|
|
14
15
|
wrapRef = _ref.wrapRef,
|
|
15
16
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
17
|
+
var intInputRef = useRef(null);
|
|
18
|
+
var handleRef = useForkRef(ref, intInputRef);
|
|
16
19
|
var handleBlur = useCallback(function (evt) {
|
|
20
|
+
if (intInputRef != null && intInputRef.current) {
|
|
21
|
+
intInputRef.current.scrollLeft = 0;
|
|
22
|
+
}
|
|
17
23
|
typeof (inputProps == null ? void 0 : inputProps.onBlur) === "function" && (inputProps == null ? void 0 : inputProps.onBlur(evt));
|
|
18
24
|
}, [inputProps]);
|
|
19
25
|
return /*#__PURE__*/React.createElement(StyledDiv, _extends({
|
|
@@ -25,7 +31,7 @@ export var EditableContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
25
31
|
weight: weight,
|
|
26
32
|
$disabled: disabled
|
|
27
33
|
}, inputProps == null ? void 0 : inputProps.value), /*#__PURE__*/React.createElement(StyledInput, _extends({}, inputProps, {
|
|
28
|
-
ref:
|
|
34
|
+
ref: handleRef,
|
|
29
35
|
forwardedAs: "input",
|
|
30
36
|
variant: variant,
|
|
31
37
|
weight: weight,
|
|
@@ -1 +1 @@
|
|
|
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={
|
|
1
|
+
{"version":3,"file":"EditableContent.js","names":["React","forwardRef","useCallback","useRef","useForkRef","StyledDiv","StyledInput","StyledSpan","EditableContent","ref","className","variant","weight","disabled","inputProps","wrapRef","props","intInputRef","handleRef","handleBlur","evt","current","scrollLeft","onBlur","value","displayName"],"sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"sourcesContent":["import React, { forwardRef, Ref, useCallback, useRef } from \"react\";\nimport { useForkRef } from \"../../utils\";\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 intInputRef = useRef<HTMLInputElement>(null);\n const handleRef = useForkRef(ref, intInputRef);\n\n const handleBlur = useCallback(\n (evt) => {\n if (intInputRef?.current) {\n intInputRef.current.scrollLeft = 0;\n }\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={handleRef}\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,EAAEC,MAAM,QAAQ,OAAO;AACnE,SAASC,UAAU,QAAQ,aAAa;AAExC,SAASC,SAAS,EAAEC,WAAW,EAAEC,UAAU,QAAQ,UAAU;AAe7D,OAAO,IAAMC,eAAe,gBAAGP,UAAU,CAKvC,gBAUEQ,GAAG,EACA;EAAA,IATDC,SAAS,QAATA,SAAS;IAAA,oBACTC,OAAO;IAAPA,OAA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11601
11601
|
wrapRef = _ref.wrapRef,
|
|
11602
11602
|
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
11603
|
+
var intInputRef = React.useRef(null);
|
|
11604
|
+
var handleRef = useForkRef(ref, intInputRef);
|
|
11603
11605
|
var handleBlur = React.useCallback(function (evt) {
|
|
11606
|
+
if (intInputRef !== null && intInputRef !== void 0 && intInputRef.current) {
|
|
11607
|
+
intInputRef.current.scrollLeft = 0;
|
|
11608
|
+
}
|
|
11604
11609
|
typeof (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === "function" && (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur(evt));
|
|
11605
11610
|
}, [inputProps]);
|
|
11606
11611
|
return /*#__PURE__*/React__default["default"].createElement(StyledDiv, _extends({
|
|
@@ -11612,7 +11617,7 @@
|
|
|
11612
11617
|
weight: weight,
|
|
11613
11618
|
$disabled: disabled
|
|
11614
11619
|
}, inputProps === null || inputProps === void 0 ? void 0 : inputProps.value), /*#__PURE__*/React__default["default"].createElement(StyledInput, _extends({}, inputProps, {
|
|
11615
|
-
ref:
|
|
11620
|
+
ref: handleRef,
|
|
11616
11621
|
forwardedAs: "input",
|
|
11617
11622
|
variant: variant,
|
|
11618
11623
|
weight: weight,
|