@pdg/react-form 1.0.34 → 1.0.35
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/FormLayout/FormBlock/FormBlock.types.d.ts +1 -0
- package/dist/FormLayout/FormDivider/FormDivider.style.d.ts +16 -1
- package/dist/FormLayout/FormDivider/FormDivider.types.d.ts +1 -0
- package/dist/index.esm.js +20 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,5 +4,6 @@ import { FormContextValue } from '../../FormContext';
|
|
|
4
4
|
export interface FormBlockProps extends CommonSxProps, PartialPick<FormContextValue, 'variant' | 'size' | 'color' | 'spacing' | 'focused' | 'labelShrink' | 'fullWidth'>, PartialPick<FormDividerProps, 'icon' | 'label' | 'line' | 'lineVerticalMargin' | 'hidden'> {
|
|
5
5
|
collapse?: boolean;
|
|
6
6
|
collapseIn?: boolean;
|
|
7
|
+
error?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare const FormBlockDefaultProps: {};
|
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const StyledLineBox: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
component?: import("react").ElementType<any> | undefined;
|
|
5
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
6
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
7
|
+
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
8
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
9
|
+
}, ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "ref" | "children" | "component" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
10
|
+
export declare const StyledErrorLineBox: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
component?: import("react").ElementType<any> | undefined;
|
|
13
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
14
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
+
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
16
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
17
|
+
}, ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "ref" | "children" | "component" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -12,6 +12,7 @@ export interface FormDividerProps extends CommonSxProps {
|
|
|
12
12
|
hidden?: boolean;
|
|
13
13
|
collapse?: boolean;
|
|
14
14
|
collapseIn?: boolean;
|
|
15
|
+
error?: boolean;
|
|
15
16
|
onCollapseChange?(collapseIn: boolean): void;
|
|
16
17
|
}
|
|
17
18
|
export declare const FormDividerDefaultProps: FormDividerProps;
|
package/dist/index.esm.js
CHANGED
|
@@ -872,13 +872,24 @@ var templateObject_1$5, templateObject_2$1;var FormLabel = React__default.forwar
|
|
|
872
872
|
FormLabel.displayName = 'FormLabel';
|
|
873
873
|
FormLabel.defaultProps = FormLabelDefaultProps;var FormBlockDefaultProps = {};var FormDividerDefaultProps = {
|
|
874
874
|
lineVerticalMargin: 9,
|
|
875
|
-
};var
|
|
875
|
+
};var StyledLineBox = styled(Box)(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n border-bottom: thin solid #dfdfdf;\n position: absolute;\n left: 0;\n top: 50%;\n width: 100%;\n"], ["\n border-bottom: thin solid #dfdfdf;\n position: absolute;\n left: 0;\n top: 50%;\n width: 100%;\n"])));
|
|
876
|
+
var StyledErrorLineBox = styled(Box)(function (_a) {
|
|
877
|
+
var theme = _a.theme;
|
|
878
|
+
return ({
|
|
879
|
+
borderBottom: "thin solid ".concat(theme.palette.error.main),
|
|
880
|
+
position: 'absolute',
|
|
881
|
+
left: 0,
|
|
882
|
+
top: '50%',
|
|
883
|
+
width: '100%',
|
|
884
|
+
opacity: 0.4,
|
|
885
|
+
});
|
|
886
|
+
});
|
|
876
887
|
var templateObject_1$4;var DEFAULT_LINE_STYLE = { flex: 1, position: 'relative' };
|
|
877
888
|
var FormDivider = React__default.forwardRef(function (_a, ref) {
|
|
878
889
|
// FormState -------------------------------------------------------------------------------------------------------
|
|
879
890
|
var initSize = _a.size,
|
|
880
891
|
//----------------------------------------------------------------------------------------------------------------
|
|
881
|
-
icon = _a.icon, label = _a.label, line = _a.line, lineVerticalMargin = _a.lineVerticalMargin, hidden = _a.hidden, collapse = _a.collapse, collapseIn = _a.collapseIn, onCollapseChange = _a.onCollapseChange,
|
|
892
|
+
icon = _a.icon, label = _a.label, line = _a.line, lineVerticalMargin = _a.lineVerticalMargin, hidden = _a.hidden, collapse = _a.collapse, collapseIn = _a.collapseIn, error = _a.error, onCollapseChange = _a.onCollapseChange,
|
|
882
893
|
//----------------------------------------------------------------------------------------------------------------
|
|
883
894
|
className = _a.className, initStyle = _a.style, sx = _a.sx;
|
|
884
895
|
var formSize = useFormState().size;
|
|
@@ -917,16 +928,15 @@ var FormDivider = React__default.forwardRef(function (_a, ref) {
|
|
|
917
928
|
padding: 0,
|
|
918
929
|
cursor: collapse ? 'pointer' : undefined,
|
|
919
930
|
}, onClick: handleClick },
|
|
920
|
-
icon && (React__default.createElement(FormIcon, { style: { opacity: 0.54, marginRight: 5 }, fontSize: size }, icon)),
|
|
931
|
+
icon && (React__default.createElement(FormIcon, { style: { opacity: 0.54, marginRight: 5 }, color: error ? 'error' : undefined, fontSize: size }, icon)),
|
|
921
932
|
label && (React__default.createElement(Box, { sx: {
|
|
922
933
|
paddingRight: '10px',
|
|
923
|
-
color: 'text.secondary',
|
|
934
|
+
color: error ? 'error.main' : 'text.secondary',
|
|
924
935
|
fontWeight: 700,
|
|
925
936
|
fontSize: size === 'small' ? '11.5px' : '12px',
|
|
926
937
|
} }, label)),
|
|
927
|
-
(line || collapse) &&
|
|
928
|
-
|
|
929
|
-
collapse && (React__default.createElement(FormIcon, { sx: { opacity: 0.6, ml: 1 } }, collapseIn ? 'KeyboardDoubleArrowUp' : 'KeyboardDoubleArrowDown')))));
|
|
938
|
+
(line || collapse) && React__default.createElement("div", { style: lineStyle }, error ? React__default.createElement(StyledErrorLineBox, null) : React__default.createElement(StyledLineBox, null)),
|
|
939
|
+
collapse && (React__default.createElement(FormIcon, { sx: { opacity: 0.6, ml: 1 }, color: error ? 'error' : undefined }, collapseIn ? 'KeyboardDoubleArrowUp' : 'KeyboardDoubleArrowDown')))));
|
|
930
940
|
});
|
|
931
941
|
FormDivider.displayName = 'FormDivider.';
|
|
932
942
|
FormDivider.defaultProps = FormDividerDefaultProps;function useFirstSkipEffect$1(effect, deps) {
|
|
@@ -996,7 +1006,7 @@ var templateObject_1$3;var FormBlock = React__default.forwardRef(function (_a, r
|
|
|
996
1006
|
// FormState -------------------------------------------------------------------------------------------------------
|
|
997
1007
|
var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initSpacing = _a.spacing, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth,
|
|
998
1008
|
//----------------------------------------------------------------------------------------------------------------
|
|
999
|
-
icon = _a.icon, label = _a.label, line = _a.line, lineVerticalMargin = _a.lineVerticalMargin,
|
|
1009
|
+
icon = _a.icon, label = _a.label, line = _a.line, lineVerticalMargin = _a.lineVerticalMargin, error = _a.error,
|
|
1000
1010
|
//----------------------------------------------------------------------------------------------------------------
|
|
1001
1011
|
hidden = _a.hidden, collapse = _a.collapse, initCollapseIn = _a.collapseIn,
|
|
1002
1012
|
//----------------------------------------------------------------------------------------------------------------
|
|
@@ -1036,7 +1046,7 @@ var templateObject_1$3;var FormBlock = React__default.forwardRef(function (_a, r
|
|
|
1036
1046
|
return (React__default.createElement(FormContext.Provider, { value: __assign$6({ variant: variant, size: size, color: color, spacing: spacing, focused: focused, labelShrink: labelShrink, fullWidth: fullWidth }, otherFormState) },
|
|
1037
1047
|
React__default.createElement(Grid, { item: true, ref: ref, xs: 12, className: classNames$1(className, 'FormBlock'), style: style, sx: sx },
|
|
1038
1048
|
React__default.createElement(Grid, { container: true, spacing: spacing },
|
|
1039
|
-
(icon || label || line || collapse) && (React__default.createElement(FormDivider, { className: 'FormBlock-header', collapse: collapse, collapseIn: collapseIn, size: size, icon: icon, color: color, label: label, line: line, lineVerticalMargin: lineVerticalMargin, hidden: hidden, onCollapseChange: collapse ? function (newCollapseIn) { return setCollapseIn(newCollapseIn); } : undefined })),
|
|
1049
|
+
(icon || label || line || collapse) && (React__default.createElement(FormDivider, { className: 'FormBlock-header', collapse: collapse, collapseIn: collapseIn, size: size, icon: icon, color: color, label: label, line: line, error: error, lineVerticalMargin: lineVerticalMargin, hidden: hidden, onCollapseChange: collapse ? function (newCollapseIn) { return setCollapseIn(newCollapseIn); } : undefined })),
|
|
1040
1050
|
React__default.createElement(StyledWrapGrid$1, { item: true, xs: 12 },
|
|
1041
1051
|
React__default.createElement(Container, __assign$6({}, containerProps),
|
|
1042
1052
|
React__default.createElement(Grid, { container: true, spacing: spacing },
|
|
@@ -1101,7 +1111,7 @@ var templateObject_1$2;var FormRow = React__default.forwardRef(function (_a, ref
|
|
|
1101
1111
|
return (React__default.createElement(FormContext.Provider, { value: __assign$6({ variant: variant, size: size, color: color, spacing: spacing, focused: focused, labelShrink: labelShrink, fullWidth: fullWidth, formColAutoXs: formColAutoXs, onAddFormCol: handleAddFormCol, onRemoveFormCol: handleRemoveFormCol }, otherFormState) },
|
|
1102
1112
|
React__default.createElement(Grid, { item: true, ref: ref, xs: 12, className: classNames$1(className, 'FormRow'), style: style, sx: sx },
|
|
1103
1113
|
React__default.createElement(Grid, { container: true, spacing: spacing },
|
|
1104
|
-
(icon || label || line) && (React__default.createElement(FormDivider, { className: classNames$1(className, 'FormRow-header'), size: size, icon: icon, color: color, label: label, line: line, lineVerticalMargin: lineVerticalMargin, hidden: hidden })),
|
|
1114
|
+
(icon || label || line) && (React__default.createElement(FormDivider, { className: classNames$1(className, 'FormRow-header'), size: size, icon: icon, color: color, label: label, line: line, error: error, lineVerticalMargin: lineVerticalMargin, hidden: hidden })),
|
|
1105
1115
|
React__default.createElement(StyledWrapGrid, { item: true, xs: 12, className: 'FormRow-body' },
|
|
1106
1116
|
React__default.createElement(Grid, { className: 'FormRow-content', container: true, spacing: spacing, direction: 'row', style: { flexWrap: 'nowrap' } }, children),
|
|
1107
1117
|
helperText && (React__default.createElement(FormHelperText, { className: 'FormRow-helper-text', component: 'div', error: error }, helperText)))))));
|