@true-engineering/true-react-common-ui-kit 4.0.0-alpha13 → 4.0.0-alpha15
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/TextArea/TextArea.styles.d.ts +0 -1
- package/dist/true-react-common-ui-kit.js +10 -25
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +9 -24
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ControlWrapper/ControlWrapper.styles.ts +1 -1
- package/src/components/ControlWrapper/types.ts +1 -0
- package/src/components/Input/InputBase.tsx +3 -2
- package/src/components/NumberInput/NumberInput.stories.tsx +5 -1
- package/src/components/SearchInput/SearchInput.tsx +1 -5
- package/src/components/TextArea/TextArea.styles.ts +0 -6
- package/src/components/TextArea/TextArea.tsx +2 -2
- package/src/components/TextButton/TextButton.styles.ts +1 -0
package/package.json
CHANGED
|
@@ -44,7 +44,7 @@ export const useStyles = createThemedStyles('ControlWrapper', {
|
|
|
44
44
|
position: 'absolute',
|
|
45
45
|
pointerEvents: 'none',
|
|
46
46
|
left: 'var(--control-padding)',
|
|
47
|
-
top: '
|
|
47
|
+
top: 'calc(var(--control-height) / 2)',
|
|
48
48
|
transformOrigin: 'top left',
|
|
49
49
|
transform: 'translateY(-50%)',
|
|
50
50
|
transition: animations.defaultTransition,
|
|
@@ -15,6 +15,7 @@ import InputMask, { Props as ReactInputMaskBaseProps } from 'react-input-mask';
|
|
|
15
15
|
import clsx from 'clsx';
|
|
16
16
|
import {
|
|
17
17
|
addDataTestId,
|
|
18
|
+
isArrayLikeNotEmpty,
|
|
18
19
|
isNotEmpty,
|
|
19
20
|
isReactNodeNotEmpty,
|
|
20
21
|
isStringNotEmpty,
|
|
@@ -127,7 +128,7 @@ export const InputBase = forwardRef<HTMLInputElement, IInputBaseProps>(
|
|
|
127
128
|
(['email', 'tel', 'url'].includes(type) ? (type as 'email' | 'tel' | 'url') : undefined);
|
|
128
129
|
|
|
129
130
|
const hasFocus = isFocused || isActive;
|
|
130
|
-
const hasValue =
|
|
131
|
+
const hasValue = isArrayLikeNotEmpty(value);
|
|
131
132
|
const hasUnits = isReactNodeNotEmpty(units);
|
|
132
133
|
const hasPlaceholder =
|
|
133
134
|
(!isReactNodeNotEmpty(label) || hasFocus || shouldAlwaysShowPlaceholder) &&
|
|
@@ -231,7 +232,7 @@ export const InputBase = forwardRef<HTMLInputElement, IInputBaseProps>(
|
|
|
231
232
|
isDisabled={isDisabled}
|
|
232
233
|
isFocused={hasFocus}
|
|
233
234
|
isInvalid={isInvalid}
|
|
234
|
-
hasValue={hasValue
|
|
235
|
+
hasValue={hasValue}
|
|
235
236
|
isFullWidth={!isAutoSized}
|
|
236
237
|
tweakStyles={tweakControlWrapperStyles}
|
|
237
238
|
onClear={isClearable && hasValue ? handleInputClear : undefined}
|
|
@@ -9,7 +9,11 @@ export default {
|
|
|
9
9
|
|
|
10
10
|
const Template: ComponentStory<typeof NumberInput> = (args) => {
|
|
11
11
|
const [value, setValue] = useState<number>();
|
|
12
|
-
return
|
|
12
|
+
return (
|
|
13
|
+
<div style={{ width: 300 }}>
|
|
14
|
+
<NumberInput {...args} value={value} onChange={(v) => setValue(v)} />
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
13
17
|
};
|
|
14
18
|
|
|
15
19
|
export const Default = Template.bind({});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import { getTestId } from '@true-engineering/true-react-platform-helpers';
|
|
3
2
|
import { useTweakStyles } from '../../hooks';
|
|
4
3
|
import { ICommonProps } from '../../types';
|
|
5
4
|
import { IInputProps, Input } from '../Input';
|
|
@@ -12,7 +11,7 @@ export type ISearchInputProps = Omit<
|
|
|
12
11
|
ICommonProps<ISearchInputStyles>;
|
|
13
12
|
|
|
14
13
|
export const SearchInput = forwardRef<HTMLInputElement, ISearchInputProps>(
|
|
15
|
-
({ isClearable = true,
|
|
14
|
+
({ isClearable = true, tweakStyles, ...props }, ref) => {
|
|
16
15
|
const tweakInputStyles = useTweakStyles({
|
|
17
16
|
innerStyles: inputStyles,
|
|
18
17
|
tweakStyles,
|
|
@@ -23,11 +22,8 @@ export const SearchInput = forwardRef<HTMLInputElement, ISearchInputProps>(
|
|
|
23
22
|
return (
|
|
24
23
|
<Input
|
|
25
24
|
ref={ref}
|
|
26
|
-
value={value}
|
|
27
|
-
placeholder={placeholder}
|
|
28
25
|
icon="search"
|
|
29
26
|
isClearable={isClearable}
|
|
30
|
-
testId={getTestId(testId, 'input')}
|
|
31
27
|
tweakStyles={tweakInputStyles}
|
|
32
28
|
{...props}
|
|
33
29
|
/>
|
|
@@ -69,12 +69,6 @@ export const useStyles = createThemedStyles('TextArea', {
|
|
|
69
69
|
withLabel: {},
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
export const controlWrapperStyles: IControlWrapperStyles = {
|
|
73
|
-
label: {
|
|
74
|
-
top: 16,
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
|
|
78
72
|
export type ITextAreaStyles = ITweakStyles<
|
|
79
73
|
typeof useStyles,
|
|
80
74
|
{
|
|
@@ -19,7 +19,7 @@ import { useTweakStyles } from '../../hooks';
|
|
|
19
19
|
import { ICommonProps } from '../../types';
|
|
20
20
|
import { ControlWrapper, IControlWrapperProps } from '../ControlWrapper';
|
|
21
21
|
import { IWithMessagesProps, WithMessages } from '../WithMessages';
|
|
22
|
-
import {
|
|
22
|
+
import { ITextAreaStyles, useStyles } from './TextArea.styles';
|
|
23
23
|
|
|
24
24
|
export interface ITextAreaProps
|
|
25
25
|
extends ICommonProps<ITextAreaStyles>,
|
|
@@ -93,7 +93,6 @@ export const TextArea = forwardRef<HTMLTextAreaElement, ITextAreaProps>(
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
const tweakControlWrapperStyles = useTweakStyles({
|
|
96
|
-
innerStyles: controlWrapperStyles,
|
|
97
96
|
tweakStyles,
|
|
98
97
|
className: 'tweakControlWrapper',
|
|
99
98
|
currentComponentName: 'TextArea',
|
|
@@ -159,6 +158,7 @@ export const TextArea = forwardRef<HTMLTextAreaElement, ITextAreaProps>(
|
|
|
159
158
|
onFocus={handleFocus}
|
|
160
159
|
onBlur={handleBlur}
|
|
161
160
|
onChange={handleChange}
|
|
161
|
+
autoFocus={shouldFocusOnMount}
|
|
162
162
|
{...addDataAttributes(data, testId)}
|
|
163
163
|
{...textAreaProps}
|
|
164
164
|
/>
|