@nationaldesignstudio/react 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -2
- package/src/App.css +0 -0
- package/src/App.tsx +0 -7
- package/src/assets/fonts/PPNeueMontreal-Variable.woff2 +0 -0
- package/src/assets/react.svg +0 -1
- package/src/components/atoms/accordion/accordion.stories.tsx +0 -228
- package/src/components/atoms/accordion/accordion.test.tsx +0 -231
- package/src/components/atoms/accordion/index.ts +0 -6
- package/src/components/atoms/background/background.test.tsx +0 -213
- package/src/components/atoms/background/index.ts +0 -22
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-linux.png +0 -0
- package/src/components/atoms/button/button.stories.tsx +0 -289
- package/src/components/atoms/button/button.test.tsx +0 -419
- package/src/components/atoms/button/button.visual.test.tsx +0 -98
- package/src/components/atoms/button/icon-button.stories.tsx +0 -260
- package/src/components/atoms/button/icon-button.test.tsx +0 -186
- package/src/components/atoms/button/index.ts +0 -6
- package/src/components/atoms/input/index.ts +0 -17
- package/src/components/atoms/input/input-group.stories.tsx +0 -646
- package/src/components/atoms/input/input-group.test.tsx +0 -362
- package/src/components/atoms/input/input.stories.tsx +0 -228
- package/src/components/atoms/input/input.test.tsx +0 -167
- package/src/components/atoms/ndstudio-footer/index.ts +0 -1
- package/src/components/atoms/pager-control/index.ts +0 -5
- package/src/components/atoms/pager-control/pager-control.stories.tsx +0 -207
- package/src/components/atoms/pager-control/pager-control.test.tsx +0 -130
- package/src/components/atoms/popover/index.ts +0 -30
- package/src/components/atoms/popover/popover.stories.tsx +0 -531
- package/src/components/atoms/popover/popover.test.tsx +0 -486
- package/src/components/atoms/select/index.ts +0 -18
- package/src/components/atoms/select/select.stories.tsx +0 -455
- package/src/components/atoms/tooltip/index.ts +0 -24
- package/src/components/atoms/tooltip/tooltip.stories.tsx +0 -348
- package/src/components/atoms/tooltip/tooltip.test.tsx +0 -363
- package/src/components/dev-tools/dev-toolbar/dev-toolbar.stories.tsx +0 -73
- package/src/components/dev-tools/dev-toolbar/index.ts +0 -1
- package/src/components/dev-tools/grid-overlay/index.ts +0 -1
- package/src/components/dev-tools/index.ts +0 -2
- package/src/components/foundation/typography/typography.stories.tsx +0 -401
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-linux.png +0 -0
- package/src/components/organisms/card/card.stories.tsx +0 -293
- package/src/components/organisms/card/card.test.tsx +0 -247
- package/src/components/organisms/card/card.visual.test.tsx +0 -197
- package/src/components/organisms/card/index.ts +0 -26
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-darwin.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-linux.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-darwin.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-linux.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-darwin.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-linux.png +0 -0
- package/src/components/organisms/navbar/index.ts +0 -18
- package/src/components/organisms/navbar/navbar.stories.tsx +0 -313
- package/src/components/organisms/navbar/navbar.test.tsx +0 -190
- package/src/components/organisms/navbar/navbar.visual.test.tsx +0 -85
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-icon-chromium-darwin.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-icon-chromium-linux.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-darwin.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-linux.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-darwin.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-linux.png +0 -0
- package/src/components/organisms/us-gov-banner/index.ts +0 -5
- package/src/components/organisms/us-gov-banner/us-gov-banner.stories.tsx +0 -35
- package/src/components/organisms/us-gov-banner/us-gov-banner.test.tsx +0 -107
- package/src/components/organisms/us-gov-banner/us-gov-banner.visual.test.tsx +0 -46
- package/src/components/sections/banner/banner.stories.tsx +0 -150
- package/src/components/sections/banner/banner.test.tsx +0 -185
- package/src/components/sections/banner/index.ts +0 -2
- package/src/components/sections/card-grid/card-grid.stories.tsx +0 -351
- package/src/components/sections/card-grid/index.ts +0 -1
- package/src/components/sections/faq-section/faq-section.stories.tsx +0 -453
- package/src/components/sections/faq-section/index.ts +0 -2
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-default-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-linux.png +0 -0
- package/src/components/sections/hero/hero.stories.tsx +0 -397
- package/src/components/sections/hero/hero.test.tsx +0 -138
- package/src/components/sections/hero/hero.visual.test.tsx +0 -140
- package/src/components/sections/hero/index.ts +0 -23
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-linux.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-linux.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-linux.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-linux.png +0 -0
- package/src/components/sections/prose/index.ts +0 -6
- package/src/components/sections/prose/prose.stories.tsx +0 -144
- package/src/components/sections/prose/prose.test.tsx +0 -178
- package/src/components/sections/prose/prose.visual.test.tsx +0 -105
- package/src/components/sections/quote-block/index.ts +0 -5
- package/src/components/sections/river/index.ts +0 -1
- package/src/components/sections/river/river.stories.tsx +0 -237
- package/src/components/sections/river/river.test.tsx +0 -268
- package/src/components/sections/tout/index.ts +0 -1
- package/src/components/sections/tout/tout.stories.tsx +0 -171
- package/src/components/sections/tout/tout.test.tsx +0 -242
- package/src/components/sections/two-column-section/index.ts +0 -5
- package/src/components/sections/two-column-section/two-column-section.stories.tsx +0 -285
- package/src/components/shared/index.ts +0 -5
- package/src/index.ts +0 -293
- package/src/main.tsx +0 -13
- package/src/stories/grid-system.stories.tsx +0 -309
- package/src/stories/introduction.mdx +0 -128
- package/src/stories/theme-provider.stories.tsx +0 -349
- package/src/stories/token-showcase.stories.tsx +0 -73
- package/src/stories/token-showcase.tsx +0 -777
- package/src/styles.css +0 -14
- package/src/tests/token-resolution.test.tsx +0 -298
- package/src/theme/theme-provider.test.tsx +0 -270
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { Button } from "../button";
|
|
4
|
-
import {
|
|
5
|
-
Popover,
|
|
6
|
-
PopoverArrow,
|
|
7
|
-
PopoverBackdrop,
|
|
8
|
-
PopoverClose,
|
|
9
|
-
PopoverDescription,
|
|
10
|
-
PopoverParts,
|
|
11
|
-
PopoverPopup,
|
|
12
|
-
PopoverPortal,
|
|
13
|
-
PopoverPositioner,
|
|
14
|
-
PopoverTitle,
|
|
15
|
-
PopoverTrigger,
|
|
16
|
-
} from ".";
|
|
17
|
-
|
|
18
|
-
const meta: Meta<typeof Popover> = {
|
|
19
|
-
title: "Atoms/Popover",
|
|
20
|
-
component: Popover,
|
|
21
|
-
argTypes: {
|
|
22
|
-
side: {
|
|
23
|
-
control: { type: "select" },
|
|
24
|
-
options: ["top", "bottom", "left", "right"],
|
|
25
|
-
},
|
|
26
|
-
align: {
|
|
27
|
-
control: { type: "select" },
|
|
28
|
-
options: ["start", "center", "end"],
|
|
29
|
-
},
|
|
30
|
-
sideOffset: {
|
|
31
|
-
control: { type: "number" },
|
|
32
|
-
},
|
|
33
|
-
showArrow: {
|
|
34
|
-
control: { type: "boolean" },
|
|
35
|
-
},
|
|
36
|
-
showClose: {
|
|
37
|
-
control: { type: "boolean" },
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
args: {
|
|
41
|
-
side: "bottom",
|
|
42
|
-
align: "center",
|
|
43
|
-
sideOffset: 8,
|
|
44
|
-
showArrow: true,
|
|
45
|
-
showClose: false,
|
|
46
|
-
},
|
|
47
|
-
decorators: [
|
|
48
|
-
(Story) => (
|
|
49
|
-
<div className="flex min-h-[300px] items-center justify-center p-48">
|
|
50
|
-
<Story />
|
|
51
|
-
</div>
|
|
52
|
-
),
|
|
53
|
-
],
|
|
54
|
-
} satisfies Meta<typeof Popover>;
|
|
55
|
-
|
|
56
|
-
export default meta;
|
|
57
|
-
type Story = StoryObj<typeof Popover>;
|
|
58
|
-
|
|
59
|
-
// =============================================================================
|
|
60
|
-
// Playground
|
|
61
|
-
// =============================================================================
|
|
62
|
-
|
|
63
|
-
export const Playground: Story = {
|
|
64
|
-
render: (args) => (
|
|
65
|
-
<Popover
|
|
66
|
-
{...args}
|
|
67
|
-
trigger={<Button>Click me</Button>}
|
|
68
|
-
title="Popover Title"
|
|
69
|
-
>
|
|
70
|
-
This is the popover content. You can put any content here including text,
|
|
71
|
-
forms, or other components.
|
|
72
|
-
</Popover>
|
|
73
|
-
),
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// =============================================================================
|
|
77
|
-
// Basic Examples
|
|
78
|
-
// =============================================================================
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Basic popover with title and description.
|
|
82
|
-
*/
|
|
83
|
-
export const Default: Story = {
|
|
84
|
-
render: () => (
|
|
85
|
-
<Popover trigger={<Button>Open Popover</Button>} title="Information">
|
|
86
|
-
This popover provides additional context about the action.
|
|
87
|
-
</Popover>
|
|
88
|
-
),
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Popover without title - just content.
|
|
93
|
-
*/
|
|
94
|
-
export const NoTitle: Story = {
|
|
95
|
-
render: () => (
|
|
96
|
-
<Popover trigger={<Button>Open Popover</Button>}>
|
|
97
|
-
<p className="typography-body-sm-md">
|
|
98
|
-
Simple popover content without a title.
|
|
99
|
-
</p>
|
|
100
|
-
</Popover>
|
|
101
|
-
),
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Popover without arrow.
|
|
106
|
-
*/
|
|
107
|
-
export const NoArrow: Story = {
|
|
108
|
-
render: () => (
|
|
109
|
-
<Popover
|
|
110
|
-
trigger={<Button>Open Popover</Button>}
|
|
111
|
-
title="No Arrow"
|
|
112
|
-
showArrow={false}
|
|
113
|
-
>
|
|
114
|
-
This popover has no arrow pointing to the trigger.
|
|
115
|
-
</Popover>
|
|
116
|
-
),
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Popover with close button.
|
|
121
|
-
*/
|
|
122
|
-
export const WithCloseButton: Story = {
|
|
123
|
-
render: () => (
|
|
124
|
-
<Popover
|
|
125
|
-
trigger={<Button>Open Popover</Button>}
|
|
126
|
-
title="Closeable"
|
|
127
|
-
showClose={true}
|
|
128
|
-
>
|
|
129
|
-
Click the X button or click outside to close.
|
|
130
|
-
</Popover>
|
|
131
|
-
),
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
// =============================================================================
|
|
135
|
-
// Positioning
|
|
136
|
-
// =============================================================================
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Popover positioned on all four sides.
|
|
140
|
-
*/
|
|
141
|
-
export const AllPositions: Story = {
|
|
142
|
-
render: () => (
|
|
143
|
-
<div className="flex flex-col items-center gap-48">
|
|
144
|
-
<Popover
|
|
145
|
-
trigger={<Button variant="outline">Top</Button>}
|
|
146
|
-
side="top"
|
|
147
|
-
title="Top Position"
|
|
148
|
-
>
|
|
149
|
-
Popover above the trigger
|
|
150
|
-
</Popover>
|
|
151
|
-
<div className="flex items-center gap-48">
|
|
152
|
-
<Popover
|
|
153
|
-
trigger={<Button variant="outline">Left</Button>}
|
|
154
|
-
side="left"
|
|
155
|
-
title="Left Position"
|
|
156
|
-
>
|
|
157
|
-
Popover to the left
|
|
158
|
-
</Popover>
|
|
159
|
-
<Popover
|
|
160
|
-
trigger={<Button variant="outline">Right</Button>}
|
|
161
|
-
side="right"
|
|
162
|
-
title="Right Position"
|
|
163
|
-
>
|
|
164
|
-
Popover to the right
|
|
165
|
-
</Popover>
|
|
166
|
-
</div>
|
|
167
|
-
<Popover
|
|
168
|
-
trigger={<Button variant="outline">Bottom</Button>}
|
|
169
|
-
side="bottom"
|
|
170
|
-
title="Bottom Position"
|
|
171
|
-
>
|
|
172
|
-
Popover below the trigger
|
|
173
|
-
</Popover>
|
|
174
|
-
</div>
|
|
175
|
-
),
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
export const Top: Story = {
|
|
179
|
-
render: () => (
|
|
180
|
-
<Popover
|
|
181
|
-
trigger={<Button>Top Position</Button>}
|
|
182
|
-
side="top"
|
|
183
|
-
title="Top Popover"
|
|
184
|
-
>
|
|
185
|
-
This popover appears above the trigger.
|
|
186
|
-
</Popover>
|
|
187
|
-
),
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export const Bottom: Story = {
|
|
191
|
-
render: () => (
|
|
192
|
-
<Popover
|
|
193
|
-
trigger={<Button>Bottom Position</Button>}
|
|
194
|
-
side="bottom"
|
|
195
|
-
title="Bottom Popover"
|
|
196
|
-
>
|
|
197
|
-
This popover appears below the trigger.
|
|
198
|
-
</Popover>
|
|
199
|
-
),
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export const Left: Story = {
|
|
203
|
-
render: () => (
|
|
204
|
-
<Popover
|
|
205
|
-
trigger={<Button>Left Position</Button>}
|
|
206
|
-
side="left"
|
|
207
|
-
title="Left Popover"
|
|
208
|
-
>
|
|
209
|
-
This popover appears to the left.
|
|
210
|
-
</Popover>
|
|
211
|
-
),
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
export const Right: Story = {
|
|
215
|
-
render: () => (
|
|
216
|
-
<Popover
|
|
217
|
-
trigger={<Button>Right Position</Button>}
|
|
218
|
-
side="right"
|
|
219
|
-
title="Right Popover"
|
|
220
|
-
>
|
|
221
|
-
This popover appears to the right.
|
|
222
|
-
</Popover>
|
|
223
|
-
),
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
// =============================================================================
|
|
227
|
-
// Alignment
|
|
228
|
-
// =============================================================================
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Popover alignment options.
|
|
232
|
-
*/
|
|
233
|
-
export const Alignment: Story = {
|
|
234
|
-
render: () => (
|
|
235
|
-
<div className="flex flex-col gap-24">
|
|
236
|
-
<div className="flex items-center gap-24">
|
|
237
|
-
<Popover
|
|
238
|
-
trigger={
|
|
239
|
-
<Button variant="secondary" className="w-144">
|
|
240
|
-
Start
|
|
241
|
-
</Button>
|
|
242
|
-
}
|
|
243
|
-
side="bottom"
|
|
244
|
-
align="start"
|
|
245
|
-
title="Start Aligned"
|
|
246
|
-
>
|
|
247
|
-
Popover aligned to start
|
|
248
|
-
</Popover>
|
|
249
|
-
<Popover
|
|
250
|
-
trigger={
|
|
251
|
-
<Button variant="secondary" className="w-144">
|
|
252
|
-
Center
|
|
253
|
-
</Button>
|
|
254
|
-
}
|
|
255
|
-
side="bottom"
|
|
256
|
-
align="center"
|
|
257
|
-
title="Center Aligned"
|
|
258
|
-
>
|
|
259
|
-
Popover aligned to center
|
|
260
|
-
</Popover>
|
|
261
|
-
<Popover
|
|
262
|
-
trigger={
|
|
263
|
-
<Button variant="secondary" className="w-144">
|
|
264
|
-
End
|
|
265
|
-
</Button>
|
|
266
|
-
}
|
|
267
|
-
side="bottom"
|
|
268
|
-
align="end"
|
|
269
|
-
title="End Aligned"
|
|
270
|
-
>
|
|
271
|
-
Popover aligned to end
|
|
272
|
-
</Popover>
|
|
273
|
-
</div>
|
|
274
|
-
</div>
|
|
275
|
-
),
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
// =============================================================================
|
|
279
|
-
// Rich Content
|
|
280
|
-
// =============================================================================
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Popover with form content.
|
|
284
|
-
*/
|
|
285
|
-
export const WithForm: Story = {
|
|
286
|
-
render: () => (
|
|
287
|
-
<Popover trigger={<Button>Edit Settings</Button>} showClose={true}>
|
|
288
|
-
<div className="flex flex-col gap-spatial-component-overlay-gap">
|
|
289
|
-
<h3 className="typography-body-md-md font-semibold">Quick Settings</h3>
|
|
290
|
-
<div className="flex flex-col gap-8">
|
|
291
|
-
<label className="typography-body-sm-md">
|
|
292
|
-
Name
|
|
293
|
-
<input
|
|
294
|
-
type="text"
|
|
295
|
-
placeholder="Enter name"
|
|
296
|
-
className="mt-4 w-full rounded-surface-ui-small border border-overlay-border bg-overlay-background px-12 py-8 typography-body-sm-md focus:outline-none focus:ring-2 focus:ring-border-focus"
|
|
297
|
-
/>
|
|
298
|
-
</label>
|
|
299
|
-
<label className="typography-body-sm-md">
|
|
300
|
-
Email
|
|
301
|
-
<input
|
|
302
|
-
type="email"
|
|
303
|
-
placeholder="Enter email"
|
|
304
|
-
className="mt-4 w-full rounded-surface-ui-small border border-overlay-border bg-overlay-background px-12 py-8 typography-body-sm-md focus:outline-none focus:ring-2 focus:ring-border-focus"
|
|
305
|
-
/>
|
|
306
|
-
</label>
|
|
307
|
-
</div>
|
|
308
|
-
<div className="flex justify-end gap-8">
|
|
309
|
-
<Button variant="secondary" size="sm">
|
|
310
|
-
Cancel
|
|
311
|
-
</Button>
|
|
312
|
-
<Button size="sm">Save</Button>
|
|
313
|
-
</div>
|
|
314
|
-
</div>
|
|
315
|
-
</Popover>
|
|
316
|
-
),
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Popover with list content.
|
|
321
|
-
*/
|
|
322
|
-
export const WithList: Story = {
|
|
323
|
-
render: () => (
|
|
324
|
-
<Popover trigger={<Button variant="outline">Options</Button>}>
|
|
325
|
-
<div className="flex flex-col gap-4">
|
|
326
|
-
<button
|
|
327
|
-
type="button"
|
|
328
|
-
className="w-full rounded-surface-ui-small px-12 py-8 text-left typography-body-sm-md hover:bg-bg-section"
|
|
329
|
-
>
|
|
330
|
-
Edit profile
|
|
331
|
-
</button>
|
|
332
|
-
<button
|
|
333
|
-
type="button"
|
|
334
|
-
className="w-full rounded-surface-ui-small px-12 py-8 text-left typography-body-sm-md hover:bg-bg-section"
|
|
335
|
-
>
|
|
336
|
-
Settings
|
|
337
|
-
</button>
|
|
338
|
-
<button
|
|
339
|
-
type="button"
|
|
340
|
-
className="w-full rounded-surface-ui-small px-12 py-8 text-left typography-body-sm-md hover:bg-bg-section"
|
|
341
|
-
>
|
|
342
|
-
Help & support
|
|
343
|
-
</button>
|
|
344
|
-
<hr className="border-overlay-border" />
|
|
345
|
-
<button
|
|
346
|
-
type="button"
|
|
347
|
-
className="w-full rounded-surface-ui-small px-12 py-8 text-left typography-body-sm-md text-button-destructive-bg hover:bg-bg-section"
|
|
348
|
-
>
|
|
349
|
-
Sign out
|
|
350
|
-
</button>
|
|
351
|
-
</div>
|
|
352
|
-
</Popover>
|
|
353
|
-
),
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Popover with media content.
|
|
358
|
-
*/
|
|
359
|
-
export const WithMedia: Story = {
|
|
360
|
-
render: () => (
|
|
361
|
-
<Popover trigger={<Button>View Profile</Button>} showClose={true}>
|
|
362
|
-
<div className="flex gap-16">
|
|
363
|
-
<div className="size-48 shrink-0 rounded-full bg-bg-section-secondary" />
|
|
364
|
-
<div className="flex flex-col gap-4">
|
|
365
|
-
<h3 className="typography-body-md-md font-semibold">Jane Smith</h3>
|
|
366
|
-
<p className="typography-body-sm-md text-overlay-text-muted">
|
|
367
|
-
Product Designer
|
|
368
|
-
</p>
|
|
369
|
-
<p className="typography-body-sm-md text-overlay-text-muted">
|
|
370
|
-
San Francisco, CA
|
|
371
|
-
</p>
|
|
372
|
-
</div>
|
|
373
|
-
</div>
|
|
374
|
-
</Popover>
|
|
375
|
-
),
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
// =============================================================================
|
|
379
|
-
// Compound Component API
|
|
380
|
-
// =============================================================================
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Using the compound component API for full control.
|
|
384
|
-
*/
|
|
385
|
-
export const CompoundAPI: Story = {
|
|
386
|
-
render: () => (
|
|
387
|
-
<PopoverParts>
|
|
388
|
-
<PopoverTrigger>
|
|
389
|
-
<Button variant="primary">Custom Popover</Button>
|
|
390
|
-
</PopoverTrigger>
|
|
391
|
-
<PopoverPortal>
|
|
392
|
-
<PopoverPositioner side="bottom" sideOffset={12}>
|
|
393
|
-
<PopoverPopup>
|
|
394
|
-
<PopoverArrow />
|
|
395
|
-
<PopoverClose>
|
|
396
|
-
<svg
|
|
397
|
-
width="12"
|
|
398
|
-
height="12"
|
|
399
|
-
viewBox="0 0 12 12"
|
|
400
|
-
fill="none"
|
|
401
|
-
aria-hidden="true"
|
|
402
|
-
>
|
|
403
|
-
<path
|
|
404
|
-
d="M1.5 1.5L10.5 10.5M1.5 10.5L10.5 1.5"
|
|
405
|
-
stroke="currentColor"
|
|
406
|
-
strokeWidth="1.5"
|
|
407
|
-
strokeLinecap="round"
|
|
408
|
-
/>
|
|
409
|
-
</svg>
|
|
410
|
-
<span className="sr-only">Close</span>
|
|
411
|
-
</PopoverClose>
|
|
412
|
-
<PopoverTitle>Custom Title</PopoverTitle>
|
|
413
|
-
<PopoverDescription>
|
|
414
|
-
Built with compound components for maximum flexibility.
|
|
415
|
-
</PopoverDescription>
|
|
416
|
-
</PopoverPopup>
|
|
417
|
-
</PopoverPositioner>
|
|
418
|
-
</PopoverPortal>
|
|
419
|
-
</PopoverParts>
|
|
420
|
-
),
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Compound API with backdrop.
|
|
425
|
-
*/
|
|
426
|
-
export const WithBackdrop: Story = {
|
|
427
|
-
render: () => (
|
|
428
|
-
<PopoverParts>
|
|
429
|
-
<PopoverTrigger>
|
|
430
|
-
<Button>With Backdrop</Button>
|
|
431
|
-
</PopoverTrigger>
|
|
432
|
-
<PopoverPortal>
|
|
433
|
-
<PopoverBackdrop className="bg-alpha-black-20" />
|
|
434
|
-
<PopoverPositioner side="bottom">
|
|
435
|
-
<PopoverPopup>
|
|
436
|
-
<PopoverArrow />
|
|
437
|
-
<PopoverTitle>Modal-like Popover</PopoverTitle>
|
|
438
|
-
<PopoverDescription>
|
|
439
|
-
This popover has a backdrop that dims the background.
|
|
440
|
-
</PopoverDescription>
|
|
441
|
-
</PopoverPopup>
|
|
442
|
-
</PopoverPositioner>
|
|
443
|
-
</PopoverPortal>
|
|
444
|
-
</PopoverParts>
|
|
445
|
-
),
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
// =============================================================================
|
|
449
|
-
// Controlled
|
|
450
|
-
// =============================================================================
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Controlled popover with external state management.
|
|
454
|
-
*/
|
|
455
|
-
export const Controlled: Story = {
|
|
456
|
-
render: function ControlledStory() {
|
|
457
|
-
const [open, setOpen] = React.useState(false);
|
|
458
|
-
|
|
459
|
-
return (
|
|
460
|
-
<div className="flex flex-col items-center gap-16">
|
|
461
|
-
<Popover
|
|
462
|
-
trigger={<Button>Controlled Popover</Button>}
|
|
463
|
-
title="Controlled"
|
|
464
|
-
open={open}
|
|
465
|
-
onOpenChange={setOpen}
|
|
466
|
-
>
|
|
467
|
-
This popover is controlled externally.
|
|
468
|
-
</Popover>
|
|
469
|
-
<Button variant="outline" onClick={() => setOpen(!open)}>
|
|
470
|
-
{open ? "Close popover" : "Open popover"}
|
|
471
|
-
</Button>
|
|
472
|
-
</div>
|
|
473
|
-
);
|
|
474
|
-
},
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
// =============================================================================
|
|
478
|
-
// On Different Elements
|
|
479
|
-
// =============================================================================
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* Popover on various trigger elements.
|
|
483
|
-
*/
|
|
484
|
-
export const OnDifferentElements: Story = {
|
|
485
|
-
render: () => (
|
|
486
|
-
<div className="flex items-center gap-24">
|
|
487
|
-
<Popover trigger={<Button>Button</Button>} title="Button Trigger">
|
|
488
|
-
Triggered by a button
|
|
489
|
-
</Popover>
|
|
490
|
-
|
|
491
|
-
<Popover
|
|
492
|
-
trigger={
|
|
493
|
-
<button
|
|
494
|
-
type="button"
|
|
495
|
-
className="flex size-36 items-center justify-center rounded-surface-ui-small bg-bg-section text-text-primary hover:bg-bg-section-secondary"
|
|
496
|
-
>
|
|
497
|
-
<svg
|
|
498
|
-
className="size-20"
|
|
499
|
-
fill="none"
|
|
500
|
-
viewBox="0 0 24 24"
|
|
501
|
-
stroke="currentColor"
|
|
502
|
-
aria-hidden="true"
|
|
503
|
-
>
|
|
504
|
-
<path
|
|
505
|
-
strokeLinecap="round"
|
|
506
|
-
strokeLinejoin="round"
|
|
507
|
-
strokeWidth={2}
|
|
508
|
-
d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
|
|
509
|
-
/>
|
|
510
|
-
</svg>
|
|
511
|
-
<span className="sr-only">More options</span>
|
|
512
|
-
</button>
|
|
513
|
-
}
|
|
514
|
-
title="Icon Trigger"
|
|
515
|
-
>
|
|
516
|
-
Triggered by an icon button
|
|
517
|
-
</Popover>
|
|
518
|
-
|
|
519
|
-
<Popover
|
|
520
|
-
trigger={
|
|
521
|
-
<span className="cursor-pointer border-b border-dashed border-fg-muted text-text-secondary">
|
|
522
|
-
Click this text
|
|
523
|
-
</span>
|
|
524
|
-
}
|
|
525
|
-
title="Text Trigger"
|
|
526
|
-
>
|
|
527
|
-
Triggered by text
|
|
528
|
-
</Popover>
|
|
529
|
-
</div>
|
|
530
|
-
),
|
|
531
|
-
};
|