@factorearth/component-library 5.7.2-y.0 → 5.7.2-y.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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Colors } from "../../Theme/types";
|
|
3
|
-
|
|
3
|
+
import { TextareaAutosizeProps } from "react-textarea-autosize";
|
|
4
|
+
interface NoteFieldTextAreaProps extends TextareaAutosizeProps {
|
|
4
5
|
colorPalette: Colors;
|
|
5
6
|
moreHorizon?: JSX.Element;
|
|
6
7
|
label: string;
|
|
7
8
|
placeholder?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare const NoteFieldTextArea: React.ForwardRefExoticComponent<
|
|
10
|
+
export declare const NoteFieldTextArea: React.ForwardRefExoticComponent<NoteFieldTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
10
11
|
export {};
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
3
|
import { FiMaximize, FiMinimize } from "react-icons/fi";
|
|
4
4
|
import { Typography } from "../Typography/Typography";
|
|
5
|
+
import TextAreaAutosize from "react-textarea-autosize";
|
|
5
6
|
const NoteContainer = styled.div `
|
|
6
7
|
display: flex;
|
|
7
8
|
width: 100%;
|
|
@@ -17,7 +18,7 @@ const NoteContainer = styled.div `
|
|
|
17
18
|
box-sizing: border-box;
|
|
18
19
|
overflow: hidden;
|
|
19
20
|
background: ${colorPalette.background.primary};
|
|
20
|
-
height:
|
|
21
|
+
height: 100dvh;
|
|
21
22
|
`}
|
|
22
23
|
`;
|
|
23
24
|
const NoteSection = styled.div `
|
|
@@ -39,12 +40,6 @@ const IconContainer = styled.div `
|
|
|
39
40
|
border-style: solid;
|
|
40
41
|
border-right: none;
|
|
41
42
|
border-color: ${({ colorPalette }) => colorPalette.border.primary};
|
|
42
|
-
${({ isFullScreen }) => isFullScreen && `
|
|
43
|
-
position: fixed;
|
|
44
|
-
top: 2px;
|
|
45
|
-
left: 36px;
|
|
46
|
-
z-index: 100000;
|
|
47
|
-
`}
|
|
48
43
|
|
|
49
44
|
|
|
50
45
|
`;
|
|
@@ -56,40 +51,26 @@ const MinimizeIcon = styled(FiMinimize) `
|
|
|
56
51
|
width: 20px;
|
|
57
52
|
height: 20px;
|
|
58
53
|
`;
|
|
59
|
-
const NoteArea = styled
|
|
54
|
+
const NoteArea = styled(TextAreaAutosize) `
|
|
60
55
|
border-color: ${({ colorPalette }) => colorPalette.border.primary};
|
|
61
56
|
border-style: solid;
|
|
62
57
|
border-width: 1px;
|
|
63
58
|
padding: 8px 16px 0px 16px;
|
|
64
59
|
${({ isFullScreen }) => !isFullScreen && `height: 30px;`};
|
|
65
60
|
width: 100%;
|
|
66
|
-
min-height: 30px;
|
|
67
|
-
resize:
|
|
61
|
+
min-height: 30px;
|
|
62
|
+
resize: vertical;
|
|
68
63
|
color: ${({ colorPalette }) => colorPalette.text.primary};
|
|
69
64
|
background: ${({ colorPalette }) => colorPalette.background.primary};
|
|
70
65
|
border-top-left-radius: 0px;
|
|
71
66
|
border-bottom-left-radius: 0px;
|
|
72
67
|
font-size: 16px;
|
|
73
68
|
overflow: scroll;
|
|
74
|
-
${({ isFullScreen }) => isFullScreen &&
|
|
75
|
-
`
|
|
76
|
-
flex-grow: 1;
|
|
77
|
-
overflow: scroll;
|
|
78
|
-
position: fixed;
|
|
79
|
-
top: 64px;
|
|
80
|
-
left: 0;
|
|
81
|
-
|
|
82
|
-
`}
|
|
83
69
|
:focus-visible {
|
|
84
|
-
flex-grow: 1;
|
|
85
70
|
outline: none;
|
|
86
71
|
border-color: ${({ colorPalette }) => colorPalette.border.secondary};
|
|
87
72
|
border-width: 2px;
|
|
88
73
|
}
|
|
89
|
-
:empty::before {
|
|
90
|
-
content: attr(placeholder);
|
|
91
|
-
color: ${({ colorPalette }) => colorPalette.text.secondary};
|
|
92
|
-
}
|
|
93
74
|
${({ moreHorizon }) => moreHorizon &&
|
|
94
75
|
`border-top-right-radius: 0px; border-bottom-right-radius: 0px;`}
|
|
95
76
|
`;
|
|
@@ -97,12 +78,12 @@ export const NoteFieldTextArea = forwardRef((props, ref) => {
|
|
|
97
78
|
const { colorPalette, moreHorizon, label, ...textAreaProps } = props;
|
|
98
79
|
const [isFullScreen, setIsFullScreen] = React.useState(false);
|
|
99
80
|
return (React.createElement(NoteContainer, { colorPalette: colorPalette, isFullScreen: isFullScreen },
|
|
100
|
-
isFullScreen && (React.createElement(Typography, { variant: "Heading 5", textColor: colorPalette.text.primary
|
|
81
|
+
isFullScreen && (React.createElement(Typography, { variant: "Heading 5", textColor: colorPalette.text.primary }, label)),
|
|
101
82
|
React.createElement(NoteSection, { colorPalette: colorPalette, isFullScreen: isFullScreen },
|
|
102
83
|
isFullScreen ? (React.createElement(IconContainer, { colorPalette: colorPalette, onClick: () => setIsFullScreen(false) },
|
|
103
84
|
React.createElement(MinimizeIcon, { color: colorPalette.utils.icon }))) : (React.createElement(IconContainer, { colorPalette: colorPalette, onClick: () => setIsFullScreen(true) },
|
|
104
85
|
React.createElement(MaximizeIcon, { color: colorPalette.utils.icon }))),
|
|
105
|
-
React.createElement(NoteArea, { ...textAreaProps, "data-test": isFullScreen ? "note-area-expanded" : "note-area-collapsed", ref: ref, colorPalette: colorPalette, moreHorizon: moreHorizon ? true : false, isFullScreen: isFullScreen,
|
|
86
|
+
React.createElement(NoteArea, { ...textAreaProps, "data-test": isFullScreen ? "note-area-expanded" : "note-area-collapsed", ref: ref, colorPalette: colorPalette, moreHorizon: moreHorizon ? true : false, isFullScreen: isFullScreen, maxRows: isFullScreen ? undefined : 1, autoFocus: true }),
|
|
106
87
|
moreHorizon && moreHorizon)));
|
|
107
88
|
});
|
|
108
89
|
//# sourceMappingURL=NoteField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoteField.js","sourceRoot":"","sources":["../../../lib/Atoms/NoteField/NoteField.tsx"],"names":[],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AG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;gBAErC,oBAAC,YAAY,IAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,GAAI,CACjC,CAChB,CAAC,CAAC,CAAC,CACH,oBAAC,aAAa,IACb,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC;gBAEpC,oBAAC,YAAY,IAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,GAAI,CACjC,CAChB;YACD,oBAAC,QAAQ,OACJ,aAAa,eACN,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,qBAAqB,EACtE,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EACvC,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EACrC,SAAS,SACR;YACD,WAAW,IAAI,WAAW,CACd,CACC,CAChB,CAAC;AACH,CAAC,CACD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorearth/component-library",
|
|
3
|
-
"version": "5.7.2-y.
|
|
3
|
+
"version": "5.7.2-y.1",
|
|
4
4
|
"description": " A storybook component library for FactorEarth",
|
|
5
5
|
"author": "madtrx <marlin.makori@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/FactorEarth/RecordMiddleware#readme",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"access": "public",
|
|
47
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "4c8383c96c8711c6d5a470a9ab9752043f49a09b",
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@emotion/react": "^11.13.0",
|
|
52
52
|
"@emotion/styled": "^11.13.0",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"libphonenumber-js": "^1.11.11",
|
|
56
56
|
"react-datepicker": "^7.3.0",
|
|
57
57
|
"react-icons": "^5.3.0",
|
|
58
|
-
"react-select": "^5.8.0"
|
|
58
|
+
"react-select": "^5.8.0",
|
|
59
|
+
"react-textarea-autosize": "^8.5.9"
|
|
59
60
|
}
|
|
60
61
|
}
|