@sphereon/ui-components.ssi-react 0.4.1-next.179 → 0.4.1-next.181
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/components/fields/TextInputField/index.d.ts +5 -2
- package/dist/components/fields/TextInputField/index.js +14 -15
- package/dist/styles/components/components/TextInputField/index.d.ts +2 -0
- package/dist/styles/components/components/TextInputField/index.js +38 -16
- package/package.json +3 -3
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { CSSProperties, FC } from 'react';
|
|
2
2
|
type Props = {
|
|
3
|
+
label?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
type?: 'text' | 'password' | 'email';
|
|
3
6
|
initialValue?: string;
|
|
4
7
|
value?: string;
|
|
5
8
|
onChangeValue?: (value: string) => Promise<void>;
|
|
6
|
-
|
|
9
|
+
onChange?: (value: string) => void;
|
|
7
10
|
maxLength?: number;
|
|
8
|
-
|
|
11
|
+
disabled?: boolean;
|
|
9
12
|
style?: CSSProperties;
|
|
10
13
|
};
|
|
11
14
|
declare const TextInputField: FC<Props>;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { TextFieldInputContainerStyled as Container, TextFieldInputInputStyled as Input,
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { TextFieldInputContainerStyled as Container, TextFieldInputWrapperStyled as Wrapper, TextFieldInputInputStyled as Input, TextFieldInputLabelStyled as Label, } from '../../../styles';
|
|
4
4
|
const TextInputField = (props) => {
|
|
5
|
-
const {
|
|
6
|
-
const
|
|
7
|
-
const [
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const { label, placeholder, type = 'text', initialValue, maxLength, onChangeValue, onChange, disabled = false, style } = props;
|
|
6
|
+
const isControlled = props.value !== undefined;
|
|
7
|
+
const [internalValue, setInternalValue] = useState(initialValue ?? '');
|
|
8
|
+
const currentValue = isControlled ? props.value : internalValue;
|
|
9
|
+
const handleChange = async (event) => {
|
|
10
|
+
const newValue = event.target.value;
|
|
11
|
+
if (!isControlled) {
|
|
12
|
+
setInternalValue(newValue);
|
|
13
|
+
}
|
|
14
|
+
onChange?.(newValue);
|
|
15
|
+
await onChangeValue?.(newValue);
|
|
11
16
|
};
|
|
12
|
-
|
|
13
|
-
setIsFocused(true);
|
|
14
|
-
};
|
|
15
|
-
const onBlur = () => {
|
|
16
|
-
setIsFocused(false);
|
|
17
|
-
};
|
|
18
|
-
return (_jsxs(Container, { style: { ...style }, children: [label && _jsx(Label, { children: label }), _jsx(Input, { onChange: onChange, value: value, placeholder: isFocused ? '' : placeholder, type: 'text', onFocus: onFocus, onBlur: onBlur, maxLength: maxLength })] }));
|
|
17
|
+
return (_jsx(Container, { style: { ...style }, children: _jsxs(Wrapper, { children: [_jsx(Input, { type: type, value: currentValue, onChange: handleChange, placeholder: placeholder, maxLength: maxLength, disabled: disabled }), label && _jsx(Label, { children: label })] }) }));
|
|
19
18
|
};
|
|
20
19
|
export default TextInputField;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { IStyledComponent } from 'styled-components';
|
|
2
2
|
export declare const TextFieldInputContainerStyled: IStyledComponent<'web', React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
3
|
+
export declare const TextFieldInputWrapperStyled: IStyledComponent<'web', React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
3
4
|
export declare const TextFieldInputInputStyled: IStyledComponent<'web', React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>>;
|
|
5
|
+
export declare const TextFieldInputLabelStyled: IStyledComponent<'web', React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
@@ -1,27 +1,49 @@
|
|
|
1
|
-
import { borderColors, fontColors } from '@sphereon/ui-components.core';
|
|
1
|
+
import { backgroundColors, borderColors, elementColors, fontColors } from '@sphereon/ui-components.core';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import {
|
|
3
|
+
import { SSITextH3Css, SSITextH7RegularCss } from '../../../css';
|
|
4
4
|
export const TextFieldInputContainerStyled = styled.div `
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 56px;
|
|
7
8
|
`;
|
|
8
|
-
export const
|
|
9
|
-
|
|
9
|
+
export const TextFieldInputWrapperStyled = styled.div `
|
|
10
|
+
position: absolute;
|
|
11
|
+
inset: 0;
|
|
12
|
+
border: 1px solid ${elementColors.lightGrey};
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
background-color: ${backgroundColors.primaryLight};
|
|
15
|
+
|
|
16
|
+
&:focus-within {
|
|
17
|
+
border-color: ${borderColors.purple};
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
export const TextFieldInputInputStyled = styled.input `
|
|
21
|
+
${SSITextH3Css};
|
|
10
22
|
color: ${fontColors.dark};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
padding: 0 16px;
|
|
26
|
+
border: none;
|
|
14
27
|
border-radius: 4px;
|
|
15
|
-
border: 1px solid ${borderColors.lightGrey};
|
|
16
28
|
outline: none;
|
|
17
|
-
background-color:
|
|
18
|
-
font-family: Poppins, serif;
|
|
29
|
+
background-color: transparent;
|
|
30
|
+
font-family: Poppins, sans-serif;
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
&::placeholder {
|
|
33
|
+
color: #727272;
|
|
22
34
|
}
|
|
23
35
|
|
|
24
|
-
&:
|
|
25
|
-
|
|
36
|
+
&:disabled {
|
|
37
|
+
opacity: 0.5;
|
|
38
|
+
cursor: not-allowed;
|
|
26
39
|
}
|
|
27
40
|
`;
|
|
41
|
+
export const TextFieldInputLabelStyled = styled.div `
|
|
42
|
+
${SSITextH7RegularCss};
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: -10px;
|
|
45
|
+
left: 12px;
|
|
46
|
+
padding: 0 4px;
|
|
47
|
+
background-color: ${backgroundColors.primaryLight};
|
|
48
|
+
color: ${fontColors.dark};
|
|
49
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ui-components.ssi-react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.4.1-next.
|
|
4
|
+
"version": "0.4.1-next.181+028e087",
|
|
5
5
|
"description": "SSI UI components for React",
|
|
6
6
|
"repository": "git@github.com:Sphereon-Opensource/UI-Components.git",
|
|
7
7
|
"author": "Sphereon <dev@sphereon.com>",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@mui/x-date-pickers": "^8.18.0",
|
|
51
51
|
"@sphereon/ssi-sdk.data-store-types": "0.36.1-next.159",
|
|
52
52
|
"@sphereon/ssi-types": "0.36.1-next.159",
|
|
53
|
-
"@sphereon/ui-components.core": "0.4.1-next.
|
|
53
|
+
"@sphereon/ui-components.core": "0.4.1-next.181+028e087",
|
|
54
54
|
"@tanstack/react-table": "^8.9.3",
|
|
55
55
|
"ajv": "^8.17.1",
|
|
56
56
|
"ajv-formats": "^3.0.1",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"react": ">= 18"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "028e0879c0ce5b40610fedf5895b0252119d05b5"
|
|
76
76
|
}
|