Skip to content

Commit 91d5df6

Browse files
committed
feat: select
1 parent c5cf6d2 commit 91d5df6

File tree

5 files changed

+191
-131
lines changed

5 files changed

+191
-131
lines changed

example/src/stories/Select.stories.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Select } from '@solved-ac/ui-react'
1+
import { Centering, Select } from '@solved-ac/ui-react'
22
import { ComponentMeta, ComponentStory } from '@storybook/react'
33
import React from 'react'
44

@@ -18,25 +18,41 @@ export default {
1818
description:
1919
'Whether the selector should take up the full width of its container',
2020
},
21+
disableEllipsis: {
22+
control: 'boolean',
23+
description: 'Whether the selector should disable ellipsis',
24+
},
2125
},
2226
} as ComponentMeta<typeof Select>
2327

24-
const Template: ComponentStory<typeof Select> = (args) => <Select {...args} />
28+
const Template: ComponentStory<typeof Select> = (args) => (
29+
<Centering>
30+
<Select {...args} />
31+
</Centering>
32+
)
2533

2634
export const Default = Template.bind({})
2735
Default.args = {
2836
value: 'Select',
2937
items: Array(10)
3038
.fill(undefined)
31-
.map((_, i) => `Item ${i}`),
39+
.map((_, i) => `Item ${i + 1}`),
3240
}
3341

3442
export const LongEntries = Template.bind({})
3543
LongEntries.args = {
3644
value: 'Select',
3745
items: Array(256)
3846
.fill(undefined)
39-
.map((_, i) => `Item ${i}`),
47+
.map((_, i) => `Item ${i + 1}`),
48+
}
49+
50+
export const LongContents = Template.bind({})
51+
LongContents.args = {
52+
value: 'Select',
53+
items: Array(256)
54+
.fill(undefined)
55+
.map((_, i) => `Item ${i + 1} `.repeat(i + 1)),
4056
}
4157

4258
export const CustomRender = Template.bind({})

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"peerDependencies": {
3232
"@emotion/react": ">=11",
3333
"@emotion/styled": ">=11",
34-
"@floating-ui/react-dom-interactions": "^0.8.0",
34+
"@floating-ui/react-dom-interactions": "^0.13.3",
3535
"framer-motion": "6.x",
3636
"react": ">=17",
3737
"react-dom": ">=17"
@@ -41,7 +41,7 @@
4141
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
4242
"@emotion/react": "^11.1.5",
4343
"@emotion/styled": "^11.1.5",
44-
"@floating-ui/react-dom-interactions": "^0.8.0",
44+
"@floating-ui/react-dom-interactions": "^0.13.3",
4545
"@testing-library/jest-dom": "^4.2.4",
4646
"@testing-library/react": "^9.5.0",
4747
"@testing-library/user-event": "^7.2.1",

src/components/$List/ListItem.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,7 @@ export const ListItem: PC<'div', ListItemProps> = React.forwardRef(
8383
hoverColor || (backgroundColor && computeHoverColor(backgroundColor))
8484

8585
return (
86-
<ListItemWrapper
87-
style={{
88-
[vars.backgroundColor]: backgroundColor,
89-
[vars.hoverBackgroundColor]: computedHoverColor,
90-
[vars.textColor]:
91-
backgroundColor && readableColor(backgroundColor, solvedTheme),
92-
[vars.hoverTextColor]:
93-
computedHoverColor &&
94-
readableColor(computedHoverColor, solvedTheme),
95-
}}
96-
>
86+
<ListItemWrapper>
9787
<ListItemContainer
9888
ref={ref}
9989
as={as}
@@ -102,7 +92,16 @@ export const ListItem: PC<'div', ListItemProps> = React.forwardRef(
10292
disabled={disabled && clickable}
10393
clickable={clickable}
10494
padding={padding}
105-
style={style}
95+
style={{
96+
[vars.backgroundColor]: backgroundColor,
97+
[vars.hoverBackgroundColor]: computedHoverColor,
98+
[vars.textColor]:
99+
backgroundColor && readableColor(backgroundColor, solvedTheme),
100+
[vars.hoverTextColor]:
101+
computedHoverColor &&
102+
readableColor(computedHoverColor, solvedTheme),
103+
...style,
104+
}}
106105
{...rest}
107106
>
108107
{children}

0 commit comments

Comments
 (0)