Skip to content

Commit 00d74d6

Browse files
authored
[MP-917] Support size in Autocomplete props (#4687)
1 parent 2662821 commit 00d74d6

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

.changeset/honest-pumas-roll.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@toptal/picasso-autocomplete': minor
3+
---
4+
5+
### Autocomplete
6+
7+
- add `size` property to control input size

packages/base/Autocomplete/src/Autocomplete/Autocomplete.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {
1111
Ref,
1212
} from 'react'
1313
import React, { forwardRef, useRef } from 'react'
14-
import type { BaseProps } from '@toptal/picasso-shared'
14+
import type { BaseProps, SizeType } from '@toptal/picasso-shared'
1515
import { isForwardRef } from '@toptal/picasso-shared'
1616
import type { PopperOptions } from 'popper.js'
1717
import { Input } from '@toptal/picasso-input'
@@ -118,6 +118,8 @@ export interface Props
118118
disableAutofillInput?: string
119119
}
120120
highlight?: 'autofill'
121+
/** Component size */
122+
size?: SizeType<'medium' | 'large'>
121123
}
122124

123125
const getItemText = (item: Item | null) =>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react'
2+
import { Autocomplete } from '@toptal/picasso'
3+
4+
const options = [
5+
{ text: 'Belarus' },
6+
{ text: 'Croatia' },
7+
{ text: 'Lithuania' },
8+
{ text: 'Slovakia' },
9+
{ text: 'Ukraine' },
10+
]
11+
12+
const Example = () => (
13+
<div>
14+
<Autocomplete
15+
placeholder='Start typing country...'
16+
options={options}
17+
value=''
18+
size='large'
19+
/>
20+
</div>
21+
)
22+
23+
export default Example

packages/base/Autocomplete/src/Autocomplete/story/index.jsx

+8
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ page
9898
},
9999
'base/Autocomplete'
100100
)
101+
.addExample(
102+
'Autocomplete/story/LargeSize.example.tsx',
103+
{
104+
title: 'Large size',
105+
takeScreenshot: false,
106+
},
107+
'base/Autocomplete'
108+
)
101109
.addExample(
102110
'Autocomplete/story/Loading.example.tsx',
103111
'Loading',

0 commit comments

Comments
 (0)