@factorearth/component-library 5.8.0 → 5.8.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.
|
@@ -59,7 +59,7 @@ const MoreHorizonMenu = styled.div `
|
|
|
59
59
|
background-color: ${({ colorPalette }) => colorPalette.highlight.secondary};
|
|
60
60
|
border-radius: 4px;
|
|
61
61
|
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
|
|
62
|
-
z-index:
|
|
62
|
+
z-index: 100002;
|
|
63
63
|
transform-origin: top left;
|
|
64
64
|
`;
|
|
65
65
|
export const MoreHorizonButton = (props) => {
|
|
@@ -1,9 +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
|
-
toggleFullScreenView: () => void;
|
|
6
6
|
moreHorizon?: React.JSX.Element;
|
|
7
|
+
label: string;
|
|
8
|
+
placeholder?: string;
|
|
7
9
|
}
|
|
8
|
-
export declare const NoteFieldTextArea: React.ForwardRefExoticComponent<
|
|
10
|
+
export declare const NoteFieldTextArea: React.ForwardRefExoticComponent<NoteFieldTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
9
11
|
export {};
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
|
-
import { FiMaximize } from "react-icons/fi";
|
|
3
|
+
import { FiMaximize, FiMinimize } from "react-icons/fi";
|
|
4
|
+
import { Typography } from "../Typography/Typography";
|
|
5
|
+
import TextAreaAutosize from "react-textarea-autosize";
|
|
4
6
|
const NoteContainer = styled.div `
|
|
7
|
+
display: flex;
|
|
8
|
+
width: 100%;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
${({ isFullScreen, colorPalette }) => isFullScreen &&
|
|
11
|
+
`position: fixed;
|
|
12
|
+
top: 0;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
left: 0;
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
z-index: 100003;
|
|
17
|
+
padding: 16px;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
overflow: auto;
|
|
20
|
+
background: ${colorPalette.background.primary};
|
|
21
|
+
height: 100dvh;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
`}
|
|
24
|
+
`;
|
|
25
|
+
const NoteSection = styled.div `
|
|
5
26
|
display: flex;
|
|
6
27
|
width: 100%;
|
|
7
28
|
justify-content: flex-end;
|
|
8
29
|
`;
|
|
9
|
-
const
|
|
30
|
+
const IconContainer = styled.div `
|
|
10
31
|
border-radius: 4px 0px 0px 4px;
|
|
11
32
|
height: 38px;
|
|
12
33
|
width: 40px;
|
|
@@ -18,38 +39,58 @@ const MaximizeIconContainer = styled.div `
|
|
|
18
39
|
background: ${({ colorPalette }) => colorPalette.background.primary};
|
|
19
40
|
border-width: 1px;
|
|
20
41
|
border-style: solid;
|
|
42
|
+
border-right: none;
|
|
21
43
|
border-color: ${({ colorPalette }) => colorPalette.border.primary};
|
|
22
44
|
`;
|
|
23
45
|
const MaximizeIcon = styled(FiMaximize) `
|
|
24
46
|
width: 20px;
|
|
25
47
|
height: 20px;
|
|
26
48
|
`;
|
|
27
|
-
const
|
|
49
|
+
const MinimizeIcon = styled(FiMinimize) `
|
|
50
|
+
width: 20px;
|
|
51
|
+
height: 20px;
|
|
52
|
+
`;
|
|
53
|
+
const NoteArea = styled(TextAreaAutosize) `
|
|
28
54
|
border-color: ${({ colorPalette }) => colorPalette.border.primary};
|
|
29
55
|
border-style: solid;
|
|
30
56
|
border-width: 1px;
|
|
31
57
|
padding: 8px 16px 0px 16px;
|
|
32
|
-
height: 30px;
|
|
33
58
|
width: 100%;
|
|
34
59
|
min-height: 30px;
|
|
35
60
|
resize: vertical;
|
|
61
|
+
${({ isFullScreen }) => !isFullScreen && `height: 30px !important; resize: none`};
|
|
62
|
+
${({ isFullScreen }) => isFullScreen && `max-height: calc(100vh - 120px);`};
|
|
36
63
|
color: ${({ colorPalette }) => colorPalette.text.primary};
|
|
37
64
|
background: ${({ colorPalette }) => colorPalette.background.primary};
|
|
38
|
-
border-left:
|
|
65
|
+
border-top-left-radius: 0px;
|
|
66
|
+
border-bottom-left-radius: 0px;
|
|
39
67
|
font-size: 16px;
|
|
40
68
|
:focus-visible {
|
|
41
|
-
|
|
69
|
+
outline: none;
|
|
70
|
+
border-color: ${({ colorPalette }) => colorPalette.highlight.primary};
|
|
71
|
+
border-width: 2px;
|
|
72
|
+
}
|
|
73
|
+
::-webkit-scrollbar {
|
|
74
|
+
display: block !important;
|
|
42
75
|
}
|
|
43
|
-
${({ moreHorizon }) => moreHorizon && `border-right: none;`}
|
|
44
76
|
${({ moreHorizon }) => moreHorizon &&
|
|
45
77
|
`border-top-right-radius: 0px; border-bottom-right-radius: 0px;`}
|
|
46
78
|
`;
|
|
47
79
|
export const NoteFieldTextArea = forwardRef((props, ref) => {
|
|
48
|
-
const { colorPalette,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
80
|
+
const { colorPalette, moreHorizon, label, ...textAreaProps } = props;
|
|
81
|
+
const [isFullScreen, setIsFullScreen] = React.useState(false);
|
|
82
|
+
const handleKeyDown = (event) => {
|
|
83
|
+
if (event.key === 'Tab' && isFullScreen) {
|
|
84
|
+
setIsFullScreen(false);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return (React.createElement(NoteContainer, { colorPalette: colorPalette, isFullScreen: isFullScreen },
|
|
88
|
+
isFullScreen && (React.createElement(Typography, { variant: "Heading 5", textColor: colorPalette.text.primary }, label)),
|
|
89
|
+
React.createElement(NoteSection, { colorPalette: colorPalette, isFullScreen: isFullScreen },
|
|
90
|
+
isFullScreen ? (React.createElement(IconContainer, { colorPalette: colorPalette, onClick: () => setIsFullScreen(false) },
|
|
91
|
+
React.createElement(MinimizeIcon, { color: colorPalette.utils.icon }))) : (React.createElement(IconContainer, { colorPalette: colorPalette, onClick: () => setIsFullScreen(true) },
|
|
92
|
+
React.createElement(MaximizeIcon, { color: colorPalette.utils.icon }))),
|
|
93
|
+
React.createElement(NoteArea, { "data-test": isFullScreen ? "note-area-expanded" : "note-area-collapsed", ref: ref, colorPalette: colorPalette, moreHorizon: moreHorizon ? true : false, isFullScreen: isFullScreen, tabIndex: isFullScreen ? -1 : 0, maxRows: isFullScreen ? 30 : 1, minRows: isFullScreen ? 10 : 1, onKeyDown: handleKeyDown, ...textAreaProps }),
|
|
94
|
+
moreHorizon && moreHorizon)));
|
|
54
95
|
});
|
|
55
96
|
//# sourceMappingURL=NoteField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoteField.js","sourceRoot":"","sources":["../../../lib/Atoms/NoteField/NoteField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"NoteField.js","sourceRoot":"","sources":["../../../lib/Atoms/NoteField/NoteField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,gBAEN,MAAM,yBAAyB,CAAC;AAEjC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAG9B;;;;GAIC,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,EAAE,CACpC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AG,EAAE,GAAG,EACR,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EACvC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/B,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAC9B,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAC9B,SAAS,EAAE,aAAa,KACpB,aAAa,GACf;YACF,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.8.
|
|
3
|
+
"version": "5.8.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": "280d2a18005dbc9474523b46035aa7f65a2063e9",
|
|
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
|
}
|