Skip to content

Commit aee5482

Browse files
[UIK-3807][inline-input] removed some non-working properties (#2757)
<!--- Provide a general summary of your changes in the Title above --> ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> ## How has this been tested? <!--- Please describe in detail how you tested your changes. --> <!--- For example: --> <!--- I have added unit tests --> <!--- I have added Voice Over tests --> <!--- Code cannot be tested automatically so I have tested it only manually --> ## Screenshots (if appropriate): ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue). - [ ] New feature (non-breaking change which adds functionality). - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected). - [X] Nice improve. ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] I have updated the documentation accordingly. - [ ] I have added new tests on added of fixed functionality. --------- Co-authored-by: Valeryia Zimnitskaya <valeryia.zimnitskaya@semrush.com>
1 parent 87bc4af commit aee5482

File tree

5 files changed

+15
-40
lines changed

5 files changed

+15
-40
lines changed

semcore/inline-input/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { InlineInputProps } from './index.type';
1+
import type { InlineInputProps, InlineInputValueProps } from './index.type';
22
import InlineInputBase from './InlineInput';
33

44
export default InlineInputBase;
55

6-
export type { InlineInputProps };
6+
export type { InlineInputProps, InlineInputValueProps };

semcore/inline-input/src/index.type.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,6 @@ export type InlineInputProps = BoxProps & {
3434
prevValue: string,
3535
event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent,
3636
) => void;
37-
/**
38-
* Text value of input. Should be used with `onChange` property together
39-
*/
40-
value?: string;
41-
/**
42-
* Initial text value of input
43-
*/
44-
defaultValue?: string;
45-
/**
46-
* Makes component to catch browser focus on component mount
47-
* @default false
48-
*/
49-
autoFocus?: boolean;
50-
/**
51-
* Gray text displayed in empty input
52-
*/
53-
placeholder?: string;
5437
/**
5538
* defines callback (`onCancel` or `onConfirm`) triggered when `blur` event out of container fired
5639
* Triggered after all previous macrotasks completed (internally called inside of `setTimeout`)
@@ -83,14 +66,6 @@ export type InlineInputValueProps = BoxProps & {
8366
* callback invoked on every change of input tag value
8467
*/
8568
onChange?: (value: string, event: React.ChangeEvent) => void;
86-
/**
87-
* visual state of component
88-
*/
89-
state?: 'normal' | 'valid' | 'invalid';
90-
/**
91-
* shows spinner in `InlineInput.ConfirmControl` and disables other interactive elements
92-
*/
93-
loading?: boolean;
9469
/**
9570
* disables interactive elements
9671
*/

stories/components/inline-input/docs/examples/basic_usage.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import InlineInput from '@semcore/ui/inline-input';
2-
import type { InlineInputProps } from '@semcore/ui/inline-input';
2+
import type { InlineInputProps, InlineInputValueProps } from '@semcore/ui/inline-input';
33
import React from 'react';
44

5-
const BasicUsage = (props: InlineInputProps) => {
6-
const { disabled, loading, state, autoFocus, defaultValue } = props;
7-
5+
const BasicUsage = ({
6+
disabled = false,
7+
loading,
8+
state,
9+
autoFocus,
10+
defaultValue = 'John Doe',
11+
}: InlineInputProps & InlineInputValueProps): JSX.Element => {
812
return (
913
<InlineInput
1014
w={300}
@@ -26,14 +30,11 @@ const BasicUsage = (props: InlineInputProps) => {
2630
);
2731
};
2832

29-
export const basicUsageDefaultProps: InlineInputProps = {
33+
export const basicUsageDefaultProps: InlineInputProps & InlineInputValueProps = {
3034
disabled: false,
3135
loading: undefined,
3236
state: undefined,
33-
autoFocus: undefined,
3437
defaultValue: 'John Doe',
3538
};
3639

37-
BasicUsage.defaultProps = basicUsageDefaultProps;
38-
3940
export default BasicUsage;

stories/components/inline-input/docs/inline-input.stories.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const meta: Meta = {
1111
export default meta;
1212
type Story = StoryObj;
1313

14-
export const BasicUsage: StoryObj<typeof basicUsageDefaultProps> = {
14+
export const BasicUsage: Story = {
1515
render: BasicUsageExample,
1616
argTypes: {
1717
disabled: {
@@ -21,8 +21,7 @@ export const BasicUsage: StoryObj<typeof basicUsageDefaultProps> = {
2121
control: { type: 'boolean' },
2222
},
2323
autoFocus: {
24-
control: { type: 'select' },
25-
options: ['true', 'false', undefined],
24+
control: { type: 'boolean' },
2625
},
2726
state: {
2827
control: { type: 'select' },

stories/components/inline-input/tests/examples/styles.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import SerpM from '@semcore/icon/Serp/m';
22
import { Flex } from '@semcore/ui/base-components';
33
import InlineInput from '@semcore/ui/inline-input';
4-
import type { InlineInputProps } from '@semcore/ui/inline-input';
4+
import type { InlineInputProps, InlineInputValueProps } from '@semcore/ui/inline-input';
55
import type { InputNumberControlsProps } from '@semcore/ui/input-number';
66
import React from 'react';
77

8-
type ExampleInputTagsProps = InlineInputProps & InputNumberControlsProps;
8+
type ExampleInputTagsProps = InlineInputProps & InputNumberControlsProps & InlineInputValueProps;
99

1010
const Styles = (props: ExampleInputTagsProps) => {
1111
const { disabled, loading, state, autoFocus, defaultValue, placeholder, showControls, onBlurBehavior } = props;

0 commit comments

Comments
 (0)