Bin
2025-12-16 9e0b2ba2c317b1a86212f24cbae3195ad1f3dbfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import type { Meta, StoryObj } from "@storybook/react";
import { Popover } from "./popover";
import { Button } from "@humansignal/ui";
 
const meta = {
  title: "UI/Popover",
  component: Popover,
  parameters: {
    layout: "centered",
  },
} satisfies Meta<typeof Popover>;
 
export default meta;
type Story = StoryObj<typeof Popover>;
 
export const Default: Story = {
  args: {
    trigger: <Button>Click me</Button>,
    children: <div className="p-4">Popover content</div>,
  },
};
 
export const WithForm: Story = {
  args: {
    trigger: <Button>Open Form</Button>,
    children: (
      <div className="p-4 w-80">
        <h4 className="mb-4 font-medium">Settings</h4>
        <div className="space-y-4">
          <div>
            <label className="text-sm font-medium">Name</label>
            <input type="text" className="w-full mt-1 px-3 py-2 border rounded-md" placeholder="Enter your name" />
          </div>
          <div>
            <label className="text-sm font-medium">Email</label>
            <input type="email" className="w-full mt-1 px-3 py-2 border rounded-md" placeholder="Enter your email" />
          </div>
          <Button className="w-full">Save</Button>
        </div>
      </div>
    ),
  },
};
 
export const WithList: Story = {
  args: {
    trigger: <Button>View Options</Button>,
    children: (
      <div className="p-2 w-48">
        <ul className="space-y-1">
          <li>
            <span className="block w-full px-2 py-1.5 text-left hover:bg-accent rounded-sm cursor-pointer">
              Option 1
            </span>
          </li>
          <li>
            <span className="block w-full px-2 py-1.5 text-left hover:bg-accent rounded-sm cursor-pointer">
              Option 2
            </span>
          </li>
          <li>
            <span className="block w-full px-2 py-1.5 text-left hover:bg-accent rounded-sm cursor-pointer">
              Option 3
            </span>
          </li>
        </ul>
      </div>
    ),
  },
};
 
export const WithCustomAlignment: Story = {
  args: {
    trigger: <Button>Custom Alignment</Button>,
    align: "start",
    sideOffset: 8,
    children: (
      <div className="p-4">
        <p>This popover is aligned to the start and has a larger offset.</p>
      </div>
    ),
  },
};