pge-front-common 4.0.6 → 4.0.7
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/README.md +10 -4
- package/lib/components/Input/index.d.ts +3 -1
- package/lib/components/Input/index.types.d.ts +3 -1
- package/lib/components/Input/styles.d.ts +6 -3
- package/lib/components/Select/index.types.d.ts +1 -0
- package/lib/components/Select/styles.d.ts +1 -0
- package/lib/icons/index.d.ts +3 -1
- package/lib/icons/logo-rh-digital.d.ts +3 -0
- package/lib/icons/menu-icon.d.ts +3 -0
- package/lib/index.d.ts +5 -2
- package/lib/index.esm.js +23 -19
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +23 -19
- package/lib/index.js.map +1 -1
- package/lib/variables.css +6 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,19 +24,25 @@ npm i pge-front-common
|
|
|
24
24
|
|
|
25
25
|
Instale a biblioteca usando npm:
|
|
26
26
|
|
|
27
|
+
Importar o stykes global para em seu App or layout
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import "pge-front-common/lib/variables.css";
|
|
31
|
+
```
|
|
32
|
+
|
|
27
33
|
```typescript
|
|
28
|
-
import React from
|
|
29
|
-
import { Button } from
|
|
34
|
+
import React from "react";
|
|
35
|
+
import { Button } from "pge-front-common";
|
|
30
36
|
|
|
31
37
|
const App: React.FC = () => {
|
|
32
38
|
const handleClick = () => {
|
|
33
|
-
alert(
|
|
39
|
+
alert("Button clicked!");
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
return (
|
|
37
43
|
<div>
|
|
38
44
|
<h1>Hello, World!</h1>
|
|
39
|
-
|
|
45
|
+
<Button variant="secondary" text="Text" />
|
|
40
46
|
</div>
|
|
41
47
|
);
|
|
42
48
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import * as S from "./styles";
|
|
2
3
|
import { InputBaseProps } from "./index.types";
|
|
3
|
-
|
|
4
|
+
export type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "capture"> & S.StyledInputProps;
|
|
5
|
+
declare const InputBase: React.FC<InputBaseProps>;
|
|
4
6
|
export default InputBase;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
export type TextAlignType = "start" | "end" | "center";
|
|
2
3
|
export interface InputBaseProps extends Partial<HTMLInputElement> {
|
|
3
4
|
label: string;
|
|
4
5
|
hasError?: boolean;
|
|
6
|
+
hasIcon?: boolean;
|
|
5
7
|
textError?: string;
|
|
6
8
|
message?: string;
|
|
7
9
|
Icon?: React.ReactNode;
|
|
8
|
-
|
|
10
|
+
textAlign: TextAlignType;
|
|
9
11
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
12
|
onClick?: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
11
13
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TextAlignType } from "./index.types";
|
|
1
2
|
export declare const InputContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
2
3
|
width?: number;
|
|
3
4
|
}>> & string;
|
|
@@ -5,9 +6,11 @@ export declare const InputWrapper: import("styled-components/dist/types").IStyle
|
|
|
5
6
|
icon?: boolean;
|
|
6
7
|
hasError?: boolean;
|
|
7
8
|
}>> & string;
|
|
8
|
-
export
|
|
9
|
-
textAlign
|
|
10
|
-
|
|
9
|
+
export interface StyledInputProps {
|
|
10
|
+
textAlign: TextAlignType;
|
|
11
|
+
hasIcon?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const StyledInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, StyledInputProps>> & string;
|
|
11
14
|
export declare const Message: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
|
|
12
15
|
hasError?: boolean;
|
|
13
16
|
}>> & string;
|
|
@@ -7,6 +7,7 @@ export declare const InputWrapper: import("styled-components/dist/types").IStyle
|
|
|
7
7
|
}>> & string;
|
|
8
8
|
export declare const StyledInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
9
9
|
textAlign?: "start" | "end" | "center";
|
|
10
|
+
hasIcon?: boolean;
|
|
10
11
|
}>> & string;
|
|
11
12
|
export declare const Message: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
|
|
12
13
|
hasError?: boolean;
|
package/lib/icons/index.d.ts
CHANGED
|
@@ -21,4 +21,6 @@ import { IconTriangleExpand } from "./triangle-expand-icon";
|
|
|
21
21
|
import { IconTriangleRecall } from "./triangle-to-recall-icon";
|
|
22
22
|
import { IconSwap } from "./swap-icon";
|
|
23
23
|
import { IconAddCell } from "./add-cell-icon";
|
|
24
|
-
|
|
24
|
+
import { MenuIcon } from "./menu-icon";
|
|
25
|
+
import { LogoRhDigital } from "./logo-rh-digital";
|
|
26
|
+
export { IconDownload, IconVisibillity, IconEdit, IconDelete, IconCalendar, IconProfile, IconUpload, IconNewTab, IconWarning, IconCheckCircle, IconEventAvaliable, IconLogout, IconCLose, IconAdd, IconRemove, IconCircleExpland, IconCircleRecall, IconArrowExpland, IconArrowRecall, IconTriangleExpand, IconTriangleRecall, IconSwap, IconAddCell, MenuIcon, LogoRhDigital, };
|
package/lib/index.d.ts
CHANGED
|
@@ -7,18 +7,20 @@ interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
7
7
|
}
|
|
8
8
|
declare function Button({ variant, text, leftIcon, ...props }: ButtonProps): React$1.JSX.Element;
|
|
9
9
|
|
|
10
|
+
type TextAlignType = "start" | "end" | "center";
|
|
10
11
|
interface InputBaseProps extends Partial<HTMLInputElement> {
|
|
11
12
|
label: string;
|
|
12
13
|
hasError?: boolean;
|
|
14
|
+
hasIcon?: boolean;
|
|
13
15
|
textError?: string;
|
|
14
16
|
message?: string;
|
|
15
17
|
Icon?: React$1.ReactNode;
|
|
16
|
-
|
|
18
|
+
textAlign: TextAlignType;
|
|
17
19
|
onChange?: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
|
|
18
20
|
onClick?: (e: React$1.MouseEvent<HTMLInputElement>) => void;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
declare const InputBase: React$1.FC<
|
|
23
|
+
declare const InputBase: React$1.FC<InputBaseProps>;
|
|
22
24
|
|
|
23
25
|
interface ModalProps {
|
|
24
26
|
isModalOpen: boolean;
|
|
@@ -44,6 +46,7 @@ interface DropdownProps {
|
|
|
44
46
|
textError?: string;
|
|
45
47
|
message?: string;
|
|
46
48
|
placeholder?: string;
|
|
49
|
+
hasIcon?: boolean;
|
|
47
50
|
Icon?: string | React.ReactNode;
|
|
48
51
|
textAling?: "start" | "end" | "center";
|
|
49
52
|
width?: number;
|
package/lib/index.esm.js
CHANGED
|
@@ -955,15 +955,16 @@ var InputWrapper$1 = pt.div(templateObject_2$2 || (templateObject_2$2 = __makeTe
|
|
|
955
955
|
var hasError = _a.hasError;
|
|
956
956
|
return (hasError ? "#cb0a0a80" : "#0091ea80");
|
|
957
957
|
});
|
|
958
|
-
var StyledInput$1 = pt.input(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n color: #30303090;\n cursor: pointer;\n
|
|
959
|
-
var textAlign = _a.
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
958
|
+
var StyledInput$1 = pt.input(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n color: #30303090;\n cursor: pointer;\n width: 90%;\n border: none;\n\n ", "\n\n &::placeholder {\n color: #30303020;\n line-height: 20px;\n }\n\n &:focus,\n &:focus-visible,\n &:focus-within {\n outline: none;\n }\n"], ["\n color: #30303090;\n cursor: pointer;\n width: 90%;\n border: none;\n\n ", "\n\n &::placeholder {\n color: #30303020;\n line-height: 20px;\n }\n\n &:focus,\n &:focus-visible,\n &:focus-within {\n outline: none;\n }\n"])), function (_a) {
|
|
959
|
+
var _b = _a.textAlign, textAlign = _b === void 0 ? "start" : _b, _c = _a.hasIcon, hasIcon = _c === void 0 ? false : _c;
|
|
960
|
+
switch (textAlign) {
|
|
961
|
+
case "end":
|
|
962
|
+
return "\n text-align: right;\n margin-left: 25px;\n margin-right: 20px;\n ";
|
|
963
|
+
case "center":
|
|
964
|
+
return "\n text-align: center;\n margin: auto;\n padding-right: 10px;\n ";
|
|
965
|
+
default:
|
|
966
|
+
return "\n text-align: left;\n margin-left: ".concat(hasIcon ? "35px" : "8px", ";\n ");
|
|
965
967
|
}
|
|
966
|
-
return "\n text-align: left;\n margin-left: 25px;\n margin-right: 20px;\n ";
|
|
967
968
|
});
|
|
968
969
|
var Message$1 = pt.p(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n color: ", ";\n margin-left: 10px;\n margin-top: 4px;\n\n font-family: Open Sans;\n font-size: 10px;\n font-weight: 700;\n line-height: 15px;\n text-align: left;\n"], ["\n color: ", ";\n margin-left: 10px;\n margin-top: 4px;\n\n font-family: Open Sans;\n font-size: 10px;\n font-weight: 700;\n line-height: 15px;\n text-align: left;\n"])), function (_a) {
|
|
969
970
|
var hasError = _a.hasError;
|
|
@@ -974,13 +975,13 @@ var InputContent$1 = pt.div(templateObject_6$2 || (templateObject_6$2 = __makeTe
|
|
|
974
975
|
var templateObject_1$3, templateObject_2$2, templateObject_3$2, templateObject_4$2, templateObject_5$2, templateObject_6$2;
|
|
975
976
|
|
|
976
977
|
var InputBase = function (_a) {
|
|
977
|
-
var name = _a.name, label = _a.label, value = _a.value, type = _a.type, Icon = _a.Icon, placeholder = _a.placeholder, message = _a.message,
|
|
978
|
+
var name = _a.name, label = _a.label, value = _a.value, type = _a.type, Icon = _a.Icon, placeholder = _a.placeholder, message = _a.message, textAlign = _a.textAlign, textError = _a.textError, hasError = _a.hasError, width = _a.width, hasIcon = _a.hasIcon, props = __rest(_a, ["name", "label", "value", "type", "Icon", "placeholder", "message", "textAlign", "textError", "hasError", "width", "hasIcon"]);
|
|
978
979
|
return (React__default.createElement(InputContainer$1, { width: width },
|
|
979
980
|
React__default.createElement(Label$1, { htmlFor: name }, label),
|
|
980
981
|
React__default.createElement(InputWrapper$1, { icon: !!Icon, hasError: hasError },
|
|
981
982
|
React__default.createElement(InputContent$1, null,
|
|
982
983
|
Icon && Icon,
|
|
983
|
-
React__default.createElement(StyledInput$1, __assign({}, props, { id: name, type: type, placeholder: placeholder, value: value, textAlign:
|
|
984
|
+
React__default.createElement(StyledInput$1, __assign({}, props, { id: name, type: type, placeholder: placeholder, value: value, textAlign: textAlign, hasIcon: hasIcon })))),
|
|
984
985
|
textError && hasError && (React__default.createElement(Message$1, { hasError: !!textError }, textError)),
|
|
985
986
|
!hasError && message && React__default.createElement(Message$1, null, message)));
|
|
986
987
|
};
|
|
@@ -3171,14 +3172,14 @@ var InputWrapper = pt.div(templateObject_2 || (templateObject_2 = __makeTemplate
|
|
|
3171
3172
|
return (hasError ? "#cb0a0a80" : "#0091ea80");
|
|
3172
3173
|
});
|
|
3173
3174
|
var StyledInput = pt.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: #30303090;\n cursor: pointer;\n padding: 14px 0 14px 10px;\n width: 90%;\n\n border: none;\n\n display: flex;\n align-items: center;\n\n ", "\n\n &::placeholder {\n color: #30303020;\n line-height: 20px;\n }\n\n &:focus,\n &:focus-visible,\n &:focus-within {\n outline: none;\n }\n"], ["\n color: #30303090;\n cursor: pointer;\n padding: 14px 0 14px 10px;\n width: 90%;\n\n border: none;\n\n display: flex;\n align-items: center;\n\n ", "\n\n &::placeholder {\n color: #30303020;\n line-height: 20px;\n }\n\n &:focus,\n &:focus-visible,\n &:focus-within {\n outline: none;\n }\n"])), function (_a) {
|
|
3174
|
-
var textAlign = _a.textAlign;
|
|
3175
|
+
var textAlign = _a.textAlign, hasIcon = _a.hasIcon;
|
|
3175
3176
|
if (textAlign === "end") {
|
|
3176
3177
|
return "\n text-align: right;\n margin-left: 25px;\n margin-right: 20px;\n ";
|
|
3177
3178
|
}
|
|
3178
3179
|
if (textAlign === "center") {
|
|
3179
3180
|
return "\n text-align: center;\n margin:auto;\n padding-right: 10px;\n ";
|
|
3180
3181
|
}
|
|
3181
|
-
return "\n text-align: left;\n margin-left:
|
|
3182
|
+
return "\n text-align: left;\n margin-left: ".concat(hasIcon ? "35px" : "8px", ";\n \n ");
|
|
3182
3183
|
});
|
|
3183
3184
|
var Message = pt.p(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n margin-left: 10px;\n margin-top: 4px;\n\n font-family: Open Sans;\n font-size: 10px;\n font-weight: 700;\n line-height: 15px;\n text-align: left;\n"], ["\n color: ", ";\n margin-left: 10px;\n margin-top: 4px;\n\n font-family: Open Sans;\n font-size: 10px;\n font-weight: 700;\n line-height: 15px;\n text-align: left;\n"])), function (_a) {
|
|
3184
3185
|
var hasError = _a.hasError;
|
|
@@ -3186,7 +3187,7 @@ var Message = pt.p(templateObject_4 || (templateObject_4 = __makeTemplateObject(
|
|
|
3186
3187
|
});
|
|
3187
3188
|
var Label = pt.label(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: #303030;\n width: 100%;\n font-family: Open Sans;\n font-size: 14px;\n font-weight: 700;\n line-height: 21px;\n text-align: left;\n cursor: pointer;\n"], ["\n color: #303030;\n width: 100%;\n font-family: Open Sans;\n font-size: 14px;\n font-weight: 700;\n line-height: 21px;\n text-align: left;\n cursor: pointer;\n"])));
|
|
3188
3189
|
var InputContent = pt.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n height: 46px;\n & > svg {\n width: 20px;\n height: 20px;\n margin: 14px 8px;\n position: absolute;\n }\n"], ["\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n height: 46px;\n & > svg {\n width: 20px;\n height: 20px;\n margin: 14px 8px;\n position: absolute;\n }\n"])));
|
|
3189
|
-
var ArrowIcon = pt.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: absolute;\n
|
|
3190
|
+
var ArrowIcon = pt.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: absolute;\n margin: auto;\n margin-right: 8px;\n right: 6px;\n rotate: ", ";\n"], ["\n position: absolute;\n margin: auto;\n margin-right: 8px;\n right: 6px;\n rotate: ", ";\n"])), function (props) { return (props.open ? "180deg" : "0deg"); });
|
|
3190
3191
|
var DropDownContainer = pt.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n width: 100%;\n height: auto;\n\n background-color: #fff;\n margin-top: 5px;\n\n outline: solid #cfcfcffc 1.5px;\n box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;\n border-radius: 8px;\n\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n width: 100%;\n height: auto;\n\n background-color: #fff;\n margin-top: 5px;\n\n outline: solid #cfcfcffc 1.5px;\n box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;\n border-radius: 8px;\n\n ", "\n"])), function (_a) {
|
|
3191
3192
|
var open = _a.open;
|
|
3192
3193
|
return open
|
|
@@ -3257,8 +3258,11 @@ var IconArrowRecall = function (props) { return (React__default.createElement("s
|
|
|
3257
3258
|
var IconTriangleExpand = function (props) { return (React__default.createElement("svg", __assign({ width: "11", height: "6", viewBox: "0 0 11 6", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3258
3259
|
React__default.createElement("path", { d: "M0.666504 5.5L5.6665 0.5L10.6665 5.5H0.666504Z", fill: "black" }))); };
|
|
3259
3260
|
|
|
3260
|
-
var IconTriangleRecall = function (props) {
|
|
3261
|
-
|
|
3261
|
+
var IconTriangleRecall = function (props) {
|
|
3262
|
+
var _a, _b, _c;
|
|
3263
|
+
return (React__default.createElement("svg", __assign({ width: (_a = props === null || props === void 0 ? void 0 : props.width) !== null && _a !== void 0 ? _a : "11", height: (_b = props === null || props === void 0 ? void 0 : props.width) !== null && _b !== void 0 ? _b : "6", viewBox: "0 0 11 6", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3264
|
+
React__default.createElement("path", { d: "M5.6665 5.5L0.666504 0.5H10.6665L5.6665 5.5Z", fill: (_c = props === null || props === void 0 ? void 0 : props.fill) !== null && _c !== void 0 ? _c : "#4A4A4B" })));
|
|
3265
|
+
};
|
|
3262
3266
|
|
|
3263
3267
|
var IconSwap = function (props) { return (React__default.createElement("svg", __assign({ width: "17", height: "21", viewBox: "0 0 17 21", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3264
3268
|
React__default.createElement("path", { d: "M4.6665 11.5V4.325L2.0915 6.9L0.666504 5.5L5.6665 0.5L10.6665 5.5L9.2415 6.9L6.6665 4.325V11.5H4.6665ZM11.6665 20.5L6.6665 15.5L8.0915 14.1L10.6665 16.675V9.5H12.6665V16.675L15.2415 14.1L16.6665 15.5L11.6665 20.5Z", fill: "black" }))); };
|
|
@@ -3268,17 +3272,17 @@ var IconAddCell = function (props) { return (React__default.createElement("svg",
|
|
|
3268
3272
|
|
|
3269
3273
|
var Dropdown = function (_a) {
|
|
3270
3274
|
var _b;
|
|
3271
|
-
var name = _a.name; _a.type; var label = _a.label, Icon = _a.Icon, placeholder = _a.placeholder, message = _a.message, textAling = _a.textAling, textError = _a.textError, hasError = _a.hasError, width = _a.width, defaultValue = _a.defaultValue
|
|
3272
|
-
var
|
|
3275
|
+
var name = _a.name; _a.type; var label = _a.label, Icon = _a.Icon, placeholder = _a.placeholder, message = _a.message, textAling = _a.textAling, textError = _a.textError, hasError = _a.hasError, width = _a.width, defaultValue = _a.defaultValue, options = _a.options, onChange = _a.onChange, _c = _a.hasIcon, hasIcon = _c === void 0 ? false : _c, optionState = _a.value;
|
|
3276
|
+
var _d = React__default.useState(false), open = _d[0], setOpen = _d[1];
|
|
3273
3277
|
return (React__default.createElement(InputContainer, { width: width },
|
|
3274
3278
|
React__default.createElement(Label, { htmlFor: name }, label),
|
|
3275
3279
|
React__default.createElement(InputWrapper, { icon: !!Icon, hasError: hasError },
|
|
3276
3280
|
React__default.createElement(InputContent, { onClick: function () { return setOpen(!open); } },
|
|
3277
3281
|
typeof Icon === "string" && React__default.createElement("img", { src: Icon, alt: "Icone" }),
|
|
3278
3282
|
typeof Icon === "object" && Icon,
|
|
3279
|
-
React__default.createElement(StyledInput, { id: name, textAlign: textAling }, (_b = defaultValue !== null && defaultValue !== void 0 ? defaultValue : optionState === null || optionState === void 0 ? void 0 : optionState.label) !== null && _b !== void 0 ? _b : placeholder),
|
|
3283
|
+
React__default.createElement(StyledInput, { hasIcon: hasIcon, id: name, textAlign: textAling }, (_b = defaultValue !== null && defaultValue !== void 0 ? defaultValue : optionState === null || optionState === void 0 ? void 0 : optionState.label) !== null && _b !== void 0 ? _b : placeholder),
|
|
3280
3284
|
React__default.createElement(ArrowIcon, { open: open },
|
|
3281
|
-
React__default.createElement(
|
|
3285
|
+
React__default.createElement(IconTriangleRecall, null)))),
|
|
3282
3286
|
React__default.createElement(DropDownContainer, { open: open }, defaultValue ||
|
|
3283
3287
|
(options && (React__default.createElement(DropDownContent, null,
|
|
3284
3288
|
defaultValue && (React__default.createElement(DropDownItem, { key: "default", onClick: function (e) { return onChange && onChange(e); } }, defaultValue)), options === null || options === void 0 ? void 0 :
|