Skip to content

Commit a74add4

Browse files
committed
fix: correct issues with select
1 parent 0c74bd0 commit a74add4

File tree

2 files changed

+38
-11
lines changed

2 files changed

+38
-11
lines changed

packages/ui-react/src/components/select/select.stories.tsx

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ export default {
2424

2525
export const Simple = {
2626
args: {
27-
placeholder: "Välj ett alternativ",
27+
items: [
28+
{ value: null, label: "Välj ett alternativ" },
29+
{ value: "option1", label: "Option 1" },
30+
{ value: "option2", label: "Option 2" },
31+
{ value: "option3", label: "Option 3" },
32+
],
2833
children: (
2934
<>
35+
<Select.Item value={null}>Välj ett alternativ</Select.Item>
3036
<Select.Item value="option1">Option 1</Select.Item>
3137
<Select.Item value="option2">Option 2</Select.Item>
3238
<Select.Item value="option3">Option 3</Select.Item>
@@ -37,7 +43,26 @@ export const Simple = {
3743

3844
export const WithGroups = {
3945
args: {
40-
placeholder: "Välj ett alternativ",
46+
items: [
47+
{ value: "option1-1", label: "Råbandsknop", group: "Symmetriska knopar" },
48+
{
49+
value: "option1-2",
50+
label: "Dubbelt halvslag",
51+
group: "Symmetriska knopar",
52+
},
53+
{ value: "option1-3", label: "Trumpetstek", group: "Symmetriska knopar" },
54+
{ value: "option2-1", label: "Skotstek", group: "Osymmetriska knopar" },
55+
{
56+
value: "option2-2",
57+
label: "Smugglarstek",
58+
group: "Osymmetriska knopar",
59+
},
60+
{
61+
value: "option2-3",
62+
label: "Tältlineknop",
63+
group: "Osymmetriska knopar",
64+
},
65+
],
4166
children: (
4267
<>
4368
<Select.Group>
@@ -60,7 +85,14 @@ export const WithGroups = {
6085

6186
export const WithDisabledItems = {
6287
args: {
63-
placeholder: "Välj ett alternativ",
88+
items: [
89+
{ value: "option1", label: "Option 1" },
90+
{ value: "option2", label: "Option 2" },
91+
{ value: "option3", label: "Option 3" },
92+
{ value: "option4", label: "Option 4" },
93+
{ value: "option5", label: "Option 5" },
94+
{ value: "option6", label: "Option 6" },
95+
],
6496
children: (
6597
<>
6698
<Select.Item value="option1">Option 1</Select.Item>

packages/ui-react/src/components/select/select.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@ import { cn } from "../../lib/utils.js";
55

66
const Root = <TValue,>({
77
children,
8-
placeholder,
98
...props
10-
}: SelectPrimitive.Root.Props<TValue> & {
11-
placeholder?: string;
12-
}) => (
9+
}: SelectPrimitive.Root.Props<TValue>) => (
1310
<SelectPrimitive.Root {...props}>
1411
<Trigger>
15-
<Value placeholder={placeholder} />
12+
<SelectPrimitive.Value />
1613
</Trigger>
1714
<Positioner className="text-gray-dark">{children}</Positioner>
1815
</SelectPrimitive.Root>
1916
);
2017

2118
const Group = SelectPrimitive.Group;
2219

23-
const Value = SelectPrimitive.Value;
24-
2520
const Trigger = ({
2621
className,
2722
children,
@@ -152,4 +147,4 @@ const Separator = ({
152147
/>
153148
);
154149

155-
export { Root, Group, Value, GroupLabel, Item, Separator };
150+
export { Root, Group, GroupLabel, Item, Separator };

0 commit comments

Comments
 (0)