@oc-digital/react-component-library 5.2.0-beta.9 → 6.0.0-beta.10
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/build/EditableTable/EditableTable.types.d.ts +2 -2
- package/build/EditableTable/components/TableTextInput.d.ts +8 -5
- package/build/EditableTable/components/utils/getTextWidth.d.ts +8 -1
- package/build/EditableTable/defaultCells.d.ts +1 -0
- package/build/TextField/TextField.d.ts +2 -2
- package/build/assets/index-DCUzKTQq.css +78 -0
- package/build/index.js +1 -10
- package/build/index.js.map +1 -1
- package/build/styles/layout.d.ts +1 -1
- package/package.json +7 -5
|
@@ -70,8 +70,8 @@ export interface IEssentialRenderFnProps {
|
|
|
70
70
|
value: TableCellValues;
|
|
71
71
|
onChange: (e: any) => void;
|
|
72
72
|
onBlur: any;
|
|
73
|
-
prefix?: React.ReactNode | React.JSXElementConstructor<any
|
|
74
|
-
suffix?: React.ReactNode | React.JSXElementConstructor<any
|
|
73
|
+
prefix?: React.ReactNode | React.JSXElementConstructor<any> | Element;
|
|
74
|
+
suffix?: React.ReactNode | React.JSXElementConstructor<any> | Element;
|
|
75
75
|
numberField?: boolean;
|
|
76
76
|
textAlign?: IAlignment;
|
|
77
77
|
fixedDecimalScale?: boolean;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { PureComponent } from "react";
|
|
2
2
|
export interface ITableTextInputProps {
|
|
3
3
|
name?: string;
|
|
4
4
|
value: string | number | null | undefined;
|
|
5
5
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
6
6
|
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
7
|
-
prefix?: string | JSX.Element | null;
|
|
8
|
-
suffix?: string | JSX.Element | null;
|
|
9
|
-
textAlign?: "left" | "right" | "center";
|
|
7
|
+
prefix?: string | React.ReactElement | JSX.Element | null;
|
|
8
|
+
suffix?: string | React.ReactElement | JSX.Element | null;
|
|
9
|
+
textAlign?: "start" | "end" | "left" | "right" | "center" | "justify" | "match-parent" | "inherit";
|
|
10
10
|
numberField?: boolean;
|
|
11
11
|
fixedDecimalScale?: boolean;
|
|
12
12
|
error?: string | false;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare class TableTextInput extends PureComponent<ITableTextInputProps> {
|
|
17
|
+
render(): JSX.Element;
|
|
14
18
|
}
|
|
15
|
-
export declare const TableTextInput: ({ name, value, onChange, onBlur, prefix, suffix, textAlign, numberField, fixedDecimalScale, error, disabled, }: ITableTextInputProps) => JSX.Element;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optimised for TableTextField.
|
|
3
|
+
*
|
|
4
|
+
* Instead of accepting a HTMLElement, which would require a re-render to get the correct width,
|
|
5
|
+
* this function is oprimised to accept only the text and max width.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getTableTextInputTextWidth(text: string, maxWidth?: number): string;
|
|
1
8
|
/**
|
|
2
9
|
* Calculates the width of a given string in pixels (perfect result)
|
|
3
10
|
*
|
|
4
11
|
* When using this to size inputs, the input must have CSS box-sizing: content-box
|
|
5
12
|
*/
|
|
6
|
-
export declare function getTextWidth(text: string, element: HTMLElement): string;
|
|
13
|
+
export declare function getTextWidth(text: string, element: HTMLElement, maxWidth?: number): string;
|
|
@@ -10,6 +10,7 @@ interface INonEditableField extends Pick<IEssentialRenderFnProps, "numberField"
|
|
|
10
10
|
styling?: string;
|
|
11
11
|
inputStyling?: string;
|
|
12
12
|
widthOverride?: string | undefined;
|
|
13
|
+
fullWidth?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare const NonEditableField: React.FC<INonEditableField>;
|
|
15
16
|
interface ITableSelect extends IEssentialRenderFnProps {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { NumericFormatProps } from "react-number-format";
|
|
3
3
|
import { ITextFieldProps } from "./TextField.types";
|
|
4
4
|
declare const TextField: React.FC<ITextFieldProps>;
|
|
5
5
|
export default TextField;
|
|
6
|
-
interface INumberFormatProps extends Omit<
|
|
6
|
+
interface INumberFormatProps extends Omit<NumericFormatProps, "onChange"> {
|
|
7
7
|
onChange: (event: {
|
|
8
8
|
target: {
|
|
9
9
|
name: string;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
.input {
|
|
2
|
+
background: transparent;
|
|
3
|
+
border: 0;
|
|
4
|
+
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
|
5
|
+
transition: border-bottom 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
6
|
+
margin-top 200ms cubic-bezier(0.4, 0, 0.2, 1) 0m;
|
|
7
|
+
margin-top: 0;
|
|
8
|
+
min-width: 3ch;
|
|
9
|
+
max-width: 20ch;
|
|
10
|
+
box-sizing: content-box;
|
|
11
|
+
|
|
12
|
+
&:hover {
|
|
13
|
+
border-bottom: 1px solid rgb(158, 158, 158);
|
|
14
|
+
margin-top: 1px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:focus {
|
|
18
|
+
outline: none;
|
|
19
|
+
border-bottom: 2px solid rgb(115, 196, 202);
|
|
20
|
+
margin-top: 2px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&[data-valid="false"] {
|
|
24
|
+
border-bottom-color: #d32f2f !important;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.wrapper {
|
|
29
|
+
display: grid;
|
|
30
|
+
grid-template-columns: auto 1fr auto;
|
|
31
|
+
align-items: center;
|
|
32
|
+
width: fit-content;
|
|
33
|
+
margin: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.error {
|
|
37
|
+
color: #d32f2f;
|
|
38
|
+
display: block;
|
|
39
|
+
text-align: center;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.checkbox {
|
|
43
|
+
accent-color: rgb(115, 196, 202);
|
|
44
|
+
margin: 0;
|
|
45
|
+
width: 15px;
|
|
46
|
+
height: 15px;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.label {
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
align-items: center;
|
|
54
|
+
margin: auto;
|
|
55
|
+
border-radius: 5rem;
|
|
56
|
+
width: 38px;
|
|
57
|
+
height: 38px;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: background 0.2s ease;
|
|
60
|
+
|
|
61
|
+
&:hover {
|
|
62
|
+
background: rgba(0, 0, 0, 0.03);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:active {
|
|
66
|
+
background: rgba(0, 0, 0, 0.1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.disabled.label {
|
|
71
|
+
&:hover {
|
|
72
|
+
background: unset;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&:active {
|
|
76
|
+
background: unset;
|
|
77
|
+
}
|
|
78
|
+
}
|