@whity/ui 0.5.0 → 1.0.1
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/README.md +107 -107
- package/package.json +223 -192
- package/src/access-denied.stories.tsx +179 -179
- package/src/access-denied.tsx +305 -305
- package/src/action-proposal.tsx +338 -302
- package/src/actor-chip.tsx +71 -71
- package/src/agent-activity.tsx +163 -163
- package/src/agent-collaboration.stories.tsx +156 -156
- package/src/agent-run-status.tsx +196 -196
- package/src/alert-dialog.stories.tsx +45 -45
- package/src/alert-dialog.tsx +147 -147
- package/src/alert.stories.tsx +91 -91
- package/src/alert.tsx +89 -89
- package/src/app-sidebar.stories.tsx +195 -195
- package/src/app-sidebar.tsx +604 -500
- package/src/approval-queue.tsx +109 -108
- package/src/audience-group-picker.stories.tsx +198 -198
- package/src/audience-group-picker.tsx +362 -362
- package/src/audience-people-picker.stories.tsx +102 -102
- package/src/audience-people-picker.tsx +279 -279
- package/src/avatar-pattern.ts +138 -0
- package/src/avatar.tsx +125 -83
- package/src/badge.stories.tsx +105 -105
- package/src/badge.tsx +68 -68
- package/src/beta-warning.stories.tsx +79 -79
- package/src/beta-warning.tsx +189 -189
- package/src/bilingual-input.stories.tsx +82 -82
- package/src/bilingual-input.tsx +188 -183
- package/src/board.tsx +216 -0
- package/src/breadcrumb.stories.tsx +51 -51
- package/src/breadcrumb.tsx +90 -90
- package/src/built-on-whity.tsx +52 -0
- package/src/button.stories.tsx +87 -87
- package/src/button.tsx +125 -118
- package/src/card.stories.tsx +423 -423
- package/src/card.tsx +180 -180
- package/src/chart.stories.tsx +66 -66
- package/src/chart.tsx +228 -228
- package/src/checkbox.stories.tsx +62 -62
- package/src/checkbox.tsx +54 -54
- package/src/collapsible.stories.tsx +48 -48
- package/src/collapsible.tsx +34 -34
- package/src/color-card.stories.tsx +61 -61
- package/src/color-card.tsx +270 -270
- package/src/color-picker.stories.tsx +65 -65
- package/src/color-picker.tsx +425 -425
- package/src/column-matcher.tsx +84 -0
- package/src/command-palette.tsx +399 -306
- package/src/confirm-action.tsx +98 -0
- package/src/copy-block.stories.tsx +38 -38
- package/src/copy-block.tsx +85 -85
- package/src/data-table.stories.tsx +200 -200
- package/src/data-table.tsx +1687 -1106
- package/src/date-picker.stories.tsx +61 -61
- package/src/date-picker.tsx +457 -422
- package/src/design-cards.stories.tsx +551 -458
- package/src/dialog.stories.tsx +48 -48
- package/src/dialog.tsx +179 -166
- package/src/display-preferences.tsx +59 -0
- package/src/documents/barcode-svg.stories.tsx +72 -72
- package/src/documents/barcode-svg.tsx +79 -79
- package/src/dropdown-menu.stories.tsx +77 -77
- package/src/dropdown-menu.tsx +271 -271
- package/src/editor/agent-panel.tsx +222 -0
- package/src/editor/agents.stories.tsx +81 -0
- package/src/editor/agents.ts +55 -0
- package/src/editor/behaviour.ts +279 -279
- package/src/editor/block-ids.ts +44 -44
- package/src/editor/block-list.tsx +104 -101
- package/src/editor/block-toolbar.tsx +490 -477
- package/src/editor/bubble.tsx +119 -93
- package/src/editor/catalogue.ts +169 -103
- package/src/editor/collab-rail.tsx +746 -746
- package/src/editor/collab.stories.tsx +207 -207
- package/src/editor/collab.ts +87 -87
- package/src/editor/contract.ts +476 -408
- package/src/editor/convert.ts +414 -362
- package/src/editor/doc-editor.stories.tsx +98 -98
- package/src/editor/doc-editor.tsx +1492 -1287
- package/src/editor/editor.css +636 -536
- package/src/editor/extensions.ts +86 -86
- package/src/editor/field-bar.tsx +154 -0
- package/src/editor/field-picker.tsx +109 -107
- package/src/editor/fields.ts +100 -100
- package/src/editor/gutter.tsx +443 -367
- package/src/editor/index.ts +23 -22
- package/src/editor/label-sheet.tsx +289 -289
- package/src/editor/labels.ts +394 -310
- package/src/editor/link-tools.tsx +141 -141
- package/src/editor/node-views.tsx +461 -450
- package/src/editor/page-view.tsx +372 -353
- package/src/editor/phone.tsx +310 -0
- package/src/editor/plugin-block-view.tsx +230 -0
- package/src/editor/plugin-blocks.stories.tsx +96 -0
- package/src/editor/plugin-blocks.ts +52 -0
- package/src/editor/publish-check.tsx +201 -182
- package/src/editor/rich-blocks.stories.tsx +146 -146
- package/src/editor/sample.ts +40 -40
- package/src/editor/save-block-dialog.tsx +141 -0
- package/src/editor/saved-block-view.tsx +205 -0
- package/src/editor/saved-blocks.stories.tsx +105 -0
- package/src/editor/saved-parts.ts +192 -0
- package/src/editor/schema-rich.ts +156 -150
- package/src/editor/schema.ts +368 -315
- package/src/editor/services.tsx +205 -127
- package/src/editor/slash.ts +64 -64
- package/src/editor/suggesting.ts +372 -372
- package/src/editor/suggestions.ts +763 -763
- package/src/editor/table-keys.ts +66 -66
- package/src/editor/templates.stories.tsx +324 -324
- package/src/editor/toolbar.tsx +364 -358
- package/src/empty-state.stories.tsx +51 -51
- package/src/empty-state.tsx +126 -100
- package/src/empty-state.usage-notes.md +30 -30
- package/src/form.stories.tsx +112 -112
- package/src/form.tsx +176 -176
- package/src/globals.css +20 -20
- package/src/icon-button.tsx +85 -85
- package/src/icon-map.ts +335 -244
- package/src/icon.tsx +41 -41
- package/src/index.ts +92 -67
- package/src/input.stories.tsx +157 -157
- package/src/input.tsx +768 -759
- package/src/kpi-strip.tsx +47 -0
- package/src/localized-text.ts +76 -0
- package/src/locked-screen.stories.tsx +29 -29
- package/src/locked-screen.tsx +75 -61
- package/src/lockup.tsx +42 -0
- package/src/lottie.tsx +441 -0
- package/src/mark.tsx +62 -62
- package/src/math-text.stories.tsx +33 -33
- package/src/math-text.tsx +43 -43
- package/src/menu-bar.stories.tsx +198 -198
- package/src/menu-bar.tsx +373 -373
- package/src/message-thread.tsx +181 -0
- package/src/money/currency.ts +244 -230
- package/src/money/money-input.tsx +131 -0
- package/src/money/money.tsx +33 -0
- package/src/open-on-computer.tsx +150 -0
- package/src/otp-input.tsx +161 -0
- package/src/page-header.stories.tsx +95 -95
- package/src/page-header.tsx +122 -122
- package/src/page-shell.stories.tsx +42 -42
- package/src/page-shell.tsx +32 -32
- package/src/page-states.tsx +277 -0
- package/src/pagination.stories.tsx +45 -45
- package/src/pagination.tsx +98 -98
- package/src/paper-sheet.stories.tsx +88 -0
- package/src/paper-sheet.tsx +85 -0
- package/src/phone-input.tsx +252 -0
- package/src/phone-tab-bar.tsx +152 -0
- package/src/plugin-card.stories.tsx +208 -180
- package/src/plugin-card.tsx +931 -848
- package/src/popover.stories.tsx +48 -48
- package/src/popover.tsx +55 -55
- package/src/radio-group.stories.tsx +26 -26
- package/src/radio-group.tsx +44 -44
- package/src/role-summary.stories.tsx +143 -0
- package/src/role-summary.tsx +120 -0
- package/src/route-flow/editor.tsx +1087 -1014
- package/src/route-flow/model.ts +771 -716
- package/src/save-bar.tsx +94 -0
- package/src/scope-grant.tsx +139 -139
- package/src/screen-too-small.stories.tsx +61 -61
- package/src/screen-too-small.tsx +104 -104
- package/src/search-field.tsx +65 -0
- package/src/select.stories.tsx +44 -44
- package/src/select.tsx +197 -197
- package/src/separator.stories.tsx +34 -34
- package/src/separator.tsx +34 -34
- package/src/sheet.stories.tsx +49 -49
- package/src/sheet.tsx +168 -168
- package/src/skeleton.stories.tsx +28 -28
- package/src/skeleton.tsx +19 -19
- package/src/slider.stories.tsx +78 -78
- package/src/slider.tsx +300 -300
- package/src/spinner.stories.tsx +33 -33
- package/src/spinner.tsx +55 -55
- package/src/stepper.tsx +85 -0
- package/src/switch.stories.tsx +42 -42
- package/src/switch.tsx +41 -41
- package/src/switcher.stories.tsx +111 -111
- package/src/switcher.tsx +131 -131
- package/src/system-state.tsx +55 -0
- package/src/table.stories.tsx +48 -48
- package/src/table.tsx +121 -121
- package/src/tabs.stories.tsx +74 -74
- package/src/tabs.tsx +90 -90
- package/src/tag-input.stories.tsx +67 -67
- package/src/tag-input.tsx +117 -117
- package/src/tenant-logo.tsx +63 -63
- package/src/tenant-switcher.stories.tsx +38 -38
- package/src/tenant-switcher.tsx +185 -164
- package/src/textarea.stories.tsx +27 -27
- package/src/textarea.tsx +18 -18
- package/src/theme-mode.ts +74 -52
- package/src/time-grid.tsx +163 -0
- package/src/time-picker.stories.tsx +62 -62
- package/src/time-picker.tsx +616 -615
- package/src/toggle-group.tsx +139 -138
- package/src/tooltip.stories.tsx +43 -43
- package/src/tooltip.tsx +73 -73
- package/src/top-nav.stories.tsx +58 -58
- package/src/top-nav.tsx +324 -324
- package/src/undo-bar.tsx +107 -107
- package/src/utils.ts +45 -45
- package/src/view-toggle.stories.tsx +84 -84
- package/src/view-toggle.tsx +111 -110
package/src/select.tsx
CHANGED
|
@@ -1,197 +1,197 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { Select as SelectPrimitive } from "radix-ui"
|
|
5
|
-
|
|
6
|
-
import { cn, useIsDarkMode } from "./utils"
|
|
7
|
-
import { IconSelector, IconCheck, IconChevronUp, IconChevronDown } from "@tabler/icons-react"
|
|
8
|
-
|
|
9
|
-
function Select({
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
12
|
-
return <SelectPrimitive.Root data-slot="select" {...props} />
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function SelectGroup({
|
|
16
|
-
className,
|
|
17
|
-
...props
|
|
18
|
-
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
19
|
-
return (
|
|
20
|
-
<SelectPrimitive.Group
|
|
21
|
-
data-slot="select-group"
|
|
22
|
-
className={cn("scroll-my-1 p-1", className)}
|
|
23
|
-
{...props}
|
|
24
|
-
/>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function SelectValue({
|
|
29
|
-
...props
|
|
30
|
-
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
31
|
-
return <SelectPrimitive.Value data-slot="select-value" {...props} />
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function SelectTrigger({
|
|
35
|
-
className,
|
|
36
|
-
size = "default",
|
|
37
|
-
children,
|
|
38
|
-
...props
|
|
39
|
-
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
40
|
-
size?: "sm" | "default"
|
|
41
|
-
}) {
|
|
42
|
-
return (
|
|
43
|
-
<SelectPrimitive.Trigger
|
|
44
|
-
data-slot="select-trigger"
|
|
45
|
-
data-size={size}
|
|
46
|
-
className={cn(
|
|
47
|
-
"flex w-fit items-center justify-between gap-1.5 rounded-
|
|
48
|
-
className
|
|
49
|
-
)}
|
|
50
|
-
{...props}
|
|
51
|
-
>
|
|
52
|
-
{children}
|
|
53
|
-
<SelectPrimitive.Icon asChild>
|
|
54
|
-
<IconSelector className="pointer-events-none size-3.5 text-muted-foreground" />
|
|
55
|
-
</SelectPrimitive.Icon>
|
|
56
|
-
</SelectPrimitive.Trigger>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function SelectContent({
|
|
61
|
-
className,
|
|
62
|
-
children,
|
|
63
|
-
position = "item-aligned",
|
|
64
|
-
align = "center",
|
|
65
|
-
...props
|
|
66
|
-
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
67
|
-
const isDark = useIsDarkMode()
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<SelectPrimitive.Portal>
|
|
71
|
-
<SelectPrimitive.Content
|
|
72
|
-
data-slot="select-content"
|
|
73
|
-
data-align-trigger={position === "item-aligned"}
|
|
74
|
-
className={cn(isDark && "dark", "relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-border bg-popover text-popover-foreground shadow-md duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", position ==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 rtl:data-[side=left]:translate-x-1 data-[side=right]:translate-x-1 rtl:data-[side=right]:-translate-x-1 data-[side=top]:-translate-y-1", className )}
|
|
75
|
-
position={position}
|
|
76
|
-
align={align}
|
|
77
|
-
{...props}
|
|
78
|
-
>
|
|
79
|
-
<SelectScrollUpButton />
|
|
80
|
-
<SelectPrimitive.Viewport
|
|
81
|
-
data-position={position}
|
|
82
|
-
className={cn(
|
|
83
|
-
"data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",
|
|
84
|
-
position === "popper" && ""
|
|
85
|
-
)}
|
|
86
|
-
>
|
|
87
|
-
{children}
|
|
88
|
-
</SelectPrimitive.Viewport>
|
|
89
|
-
<SelectScrollDownButton />
|
|
90
|
-
</SelectPrimitive.Content>
|
|
91
|
-
</SelectPrimitive.Portal>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function SelectLabel({
|
|
96
|
-
className,
|
|
97
|
-
...props
|
|
98
|
-
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
99
|
-
return (
|
|
100
|
-
<SelectPrimitive.Label
|
|
101
|
-
data-slot="select-label"
|
|
102
|
-
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function SelectItem({
|
|
109
|
-
className,
|
|
110
|
-
children,
|
|
111
|
-
...props
|
|
112
|
-
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
113
|
-
return (
|
|
114
|
-
<SelectPrimitive.Item
|
|
115
|
-
data-slot="select-item"
|
|
116
|
-
className={cn(
|
|
117
|
-
"relative flex min-h-
|
|
118
|
-
className
|
|
119
|
-
)}
|
|
120
|
-
{...props}
|
|
121
|
-
>
|
|
122
|
-
<span className="pointer-events-none absolute end-2 flex items-center justify-center">
|
|
123
|
-
<SelectPrimitive.ItemIndicator>
|
|
124
|
-
<IconCheck className="pointer-events-none" />
|
|
125
|
-
</SelectPrimitive.ItemIndicator>
|
|
126
|
-
</span>
|
|
127
|
-
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
128
|
-
</SelectPrimitive.Item>
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function SelectSeparator({
|
|
133
|
-
className,
|
|
134
|
-
...props
|
|
135
|
-
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
136
|
-
return (
|
|
137
|
-
<SelectPrimitive.Separator
|
|
138
|
-
data-slot="select-separator"
|
|
139
|
-
className={cn(
|
|
140
|
-
"pointer-events-none -mx-1 my-1 h-px bg-border/50",
|
|
141
|
-
className
|
|
142
|
-
)}
|
|
143
|
-
{...props}
|
|
144
|
-
/>
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function SelectScrollUpButton({
|
|
149
|
-
className,
|
|
150
|
-
...props
|
|
151
|
-
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
152
|
-
return (
|
|
153
|
-
<SelectPrimitive.ScrollUpButton
|
|
154
|
-
data-slot="select-scroll-up-button"
|
|
155
|
-
className={cn(
|
|
156
|
-
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
157
|
-
className
|
|
158
|
-
)}
|
|
159
|
-
{...props}
|
|
160
|
-
>
|
|
161
|
-
<IconChevronUp
|
|
162
|
-
/>
|
|
163
|
-
</SelectPrimitive.ScrollUpButton>
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function SelectScrollDownButton({
|
|
168
|
-
className,
|
|
169
|
-
...props
|
|
170
|
-
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
171
|
-
return (
|
|
172
|
-
<SelectPrimitive.ScrollDownButton
|
|
173
|
-
data-slot="select-scroll-down-button"
|
|
174
|
-
className={cn(
|
|
175
|
-
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
176
|
-
className
|
|
177
|
-
)}
|
|
178
|
-
{...props}
|
|
179
|
-
>
|
|
180
|
-
<IconChevronDown
|
|
181
|
-
/>
|
|
182
|
-
</SelectPrimitive.ScrollDownButton>
|
|
183
|
-
)
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export {
|
|
187
|
-
Select,
|
|
188
|
-
SelectContent,
|
|
189
|
-
SelectGroup,
|
|
190
|
-
SelectItem,
|
|
191
|
-
SelectLabel,
|
|
192
|
-
SelectScrollDownButton,
|
|
193
|
-
SelectScrollUpButton,
|
|
194
|
-
SelectSeparator,
|
|
195
|
-
SelectTrigger,
|
|
196
|
-
SelectValue,
|
|
197
|
-
}
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Select as SelectPrimitive } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
import { cn, useIsDarkMode } from "./utils"
|
|
7
|
+
import { IconSelector, IconCheck, IconChevronUp, IconChevronDown } from "@tabler/icons-react"
|
|
8
|
+
|
|
9
|
+
function Select({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
12
|
+
return <SelectPrimitive.Root data-slot="select" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function SelectGroup({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
19
|
+
return (
|
|
20
|
+
<SelectPrimitive.Group
|
|
21
|
+
data-slot="select-group"
|
|
22
|
+
className={cn("scroll-my-1 p-1", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function SelectValue({
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
31
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function SelectTrigger({
|
|
35
|
+
className,
|
|
36
|
+
size = "default",
|
|
37
|
+
children,
|
|
38
|
+
...props
|
|
39
|
+
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
40
|
+
size?: "sm" | "default"
|
|
41
|
+
}) {
|
|
42
|
+
return (
|
|
43
|
+
<SelectPrimitive.Trigger
|
|
44
|
+
data-slot="select-trigger"
|
|
45
|
+
data-size={size}
|
|
46
|
+
className={cn(
|
|
47
|
+
"flex w-fit items-center justify-between gap-1.5 rounded-control border border-input bg-card px-2.5 text-sm whitespace-nowrap data-[size=default]:h-10 data-[size=sm]:h-8 data-[size=sm]:rounded-control-sm transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:hover:bg-muted/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
48
|
+
className
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
<SelectPrimitive.Icon asChild>
|
|
54
|
+
<IconSelector className="pointer-events-none size-3.5 text-muted-foreground" />
|
|
55
|
+
</SelectPrimitive.Icon>
|
|
56
|
+
</SelectPrimitive.Trigger>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function SelectContent({
|
|
61
|
+
className,
|
|
62
|
+
children,
|
|
63
|
+
position = "item-aligned",
|
|
64
|
+
align = "center",
|
|
65
|
+
...props
|
|
66
|
+
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
67
|
+
const isDark = useIsDarkMode()
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<SelectPrimitive.Portal>
|
|
71
|
+
<SelectPrimitive.Content
|
|
72
|
+
data-slot="select-content"
|
|
73
|
+
data-align-trigger={position === "item-aligned"}
|
|
74
|
+
className={cn(isDark && "dark", "relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-border bg-popover text-popover-foreground shadow-md duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", position ==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 rtl:data-[side=left]:translate-x-1 data-[side=right]:translate-x-1 rtl:data-[side=right]:-translate-x-1 data-[side=top]:-translate-y-1", className )}
|
|
75
|
+
position={position}
|
|
76
|
+
align={align}
|
|
77
|
+
{...props}
|
|
78
|
+
>
|
|
79
|
+
<SelectScrollUpButton />
|
|
80
|
+
<SelectPrimitive.Viewport
|
|
81
|
+
data-position={position}
|
|
82
|
+
className={cn(
|
|
83
|
+
"data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",
|
|
84
|
+
position === "popper" && ""
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
87
|
+
{children}
|
|
88
|
+
</SelectPrimitive.Viewport>
|
|
89
|
+
<SelectScrollDownButton />
|
|
90
|
+
</SelectPrimitive.Content>
|
|
91
|
+
</SelectPrimitive.Portal>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function SelectLabel({
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
99
|
+
return (
|
|
100
|
+
<SelectPrimitive.Label
|
|
101
|
+
data-slot="select-label"
|
|
102
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function SelectItem({
|
|
109
|
+
className,
|
|
110
|
+
children,
|
|
111
|
+
...props
|
|
112
|
+
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
113
|
+
return (
|
|
114
|
+
<SelectPrimitive.Item
|
|
115
|
+
data-slot="select-item"
|
|
116
|
+
className={cn(
|
|
117
|
+
"relative flex min-h-9 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
118
|
+
className
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
>
|
|
122
|
+
<span className="pointer-events-none absolute end-2 flex items-center justify-center">
|
|
123
|
+
<SelectPrimitive.ItemIndicator>
|
|
124
|
+
<IconCheck className="pointer-events-none" />
|
|
125
|
+
</SelectPrimitive.ItemIndicator>
|
|
126
|
+
</span>
|
|
127
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
128
|
+
</SelectPrimitive.Item>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function SelectSeparator({
|
|
133
|
+
className,
|
|
134
|
+
...props
|
|
135
|
+
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
136
|
+
return (
|
|
137
|
+
<SelectPrimitive.Separator
|
|
138
|
+
data-slot="select-separator"
|
|
139
|
+
className={cn(
|
|
140
|
+
"pointer-events-none -mx-1 my-1 h-px bg-border/50",
|
|
141
|
+
className
|
|
142
|
+
)}
|
|
143
|
+
{...props}
|
|
144
|
+
/>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function SelectScrollUpButton({
|
|
149
|
+
className,
|
|
150
|
+
...props
|
|
151
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
152
|
+
return (
|
|
153
|
+
<SelectPrimitive.ScrollUpButton
|
|
154
|
+
data-slot="select-scroll-up-button"
|
|
155
|
+
className={cn(
|
|
156
|
+
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
157
|
+
className
|
|
158
|
+
)}
|
|
159
|
+
{...props}
|
|
160
|
+
>
|
|
161
|
+
<IconChevronUp
|
|
162
|
+
/>
|
|
163
|
+
</SelectPrimitive.ScrollUpButton>
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function SelectScrollDownButton({
|
|
168
|
+
className,
|
|
169
|
+
...props
|
|
170
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
171
|
+
return (
|
|
172
|
+
<SelectPrimitive.ScrollDownButton
|
|
173
|
+
data-slot="select-scroll-down-button"
|
|
174
|
+
className={cn(
|
|
175
|
+
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
176
|
+
className
|
|
177
|
+
)}
|
|
178
|
+
{...props}
|
|
179
|
+
>
|
|
180
|
+
<IconChevronDown
|
|
181
|
+
/>
|
|
182
|
+
</SelectPrimitive.ScrollDownButton>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export {
|
|
187
|
+
Select,
|
|
188
|
+
SelectContent,
|
|
189
|
+
SelectGroup,
|
|
190
|
+
SelectItem,
|
|
191
|
+
SelectLabel,
|
|
192
|
+
SelectScrollDownButton,
|
|
193
|
+
SelectScrollUpButton,
|
|
194
|
+
SelectSeparator,
|
|
195
|
+
SelectTrigger,
|
|
196
|
+
SelectValue,
|
|
197
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
-
|
|
3
|
-
import { Separator } from "./separator"
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: "Primitives/Separator",
|
|
7
|
-
component: Separator,
|
|
8
|
-
tags: ["autodocs"],
|
|
9
|
-
} satisfies Meta<typeof Separator>
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
type Story = StoryObj<typeof meta>
|
|
13
|
-
|
|
14
|
-
export const Horizontal: Story = {
|
|
15
|
-
render: () => (
|
|
16
|
-
<div className="w-64">
|
|
17
|
-
<div className="text-sm text-foreground">Section one</div>
|
|
18
|
-
<Separator className="my-4" />
|
|
19
|
-
<div className="text-sm text-foreground">Section two</div>
|
|
20
|
-
</div>
|
|
21
|
-
),
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const Vertical: Story = {
|
|
25
|
-
render: () => (
|
|
26
|
-
<div className="flex h-8 items-center gap-4 text-sm text-foreground">
|
|
27
|
-
<span>Blog</span>
|
|
28
|
-
<Separator orientation="vertical" />
|
|
29
|
-
<span>Docs</span>
|
|
30
|
-
<Separator orientation="vertical" />
|
|
31
|
-
<span>Source</span>
|
|
32
|
-
</div>
|
|
33
|
-
),
|
|
34
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
+
|
|
3
|
+
import { Separator } from "./separator"
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Primitives/Separator",
|
|
7
|
+
component: Separator,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
} satisfies Meta<typeof Separator>
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Horizontal: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<div className="w-64">
|
|
17
|
+
<div className="text-sm text-foreground">Section one</div>
|
|
18
|
+
<Separator className="my-4" />
|
|
19
|
+
<div className="text-sm text-foreground">Section two</div>
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const Vertical: Story = {
|
|
25
|
+
render: () => (
|
|
26
|
+
<div className="flex h-8 items-center gap-4 text-sm text-foreground">
|
|
27
|
+
<span>Blog</span>
|
|
28
|
+
<Separator orientation="vertical" />
|
|
29
|
+
<span>Docs</span>
|
|
30
|
+
<Separator orientation="vertical" />
|
|
31
|
+
<span>Source</span>
|
|
32
|
+
</div>
|
|
33
|
+
),
|
|
34
|
+
}
|
package/src/separator.tsx
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { Separator as SeparatorPrimitive } from "radix-ui"
|
|
3
|
-
|
|
4
|
-
import { cn } from "./utils"
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Thin horizontal/vertical divider. Replaces the repeated hand-rolled
|
|
8
|
-
* `border-t`/`border-b`/`divide-y divide-border` idiom used across
|
|
9
|
-
* web/app and web/components (onboarding, branding settings, admin pages,
|
|
10
|
-
* etc.) with a single accessible primitive (decorative by default —
|
|
11
|
-
* `role="none"` — so it doesn't clutter the a11y tree of the many pages
|
|
12
|
-
* that already convey structure via headings).
|
|
13
|
-
*/
|
|
14
|
-
function Separator({
|
|
15
|
-
className,
|
|
16
|
-
orientation = "horizontal",
|
|
17
|
-
decorative = true,
|
|
18
|
-
...props
|
|
19
|
-
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
20
|
-
return (
|
|
21
|
-
<SeparatorPrimitive.Root
|
|
22
|
-
data-slot="separator"
|
|
23
|
-
decorative={decorative}
|
|
24
|
-
orientation={orientation}
|
|
25
|
-
className={cn(
|
|
26
|
-
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
27
|
-
className
|
|
28
|
-
)}
|
|
29
|
-
{...props}
|
|
30
|
-
/>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { Separator }
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Separator as SeparatorPrimitive } from "radix-ui"
|
|
3
|
+
|
|
4
|
+
import { cn } from "./utils"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Thin horizontal/vertical divider. Replaces the repeated hand-rolled
|
|
8
|
+
* `border-t`/`border-b`/`divide-y divide-border` idiom used across
|
|
9
|
+
* web/app and web/components (onboarding, branding settings, admin pages,
|
|
10
|
+
* etc.) with a single accessible primitive (decorative by default —
|
|
11
|
+
* `role="none"` — so it doesn't clutter the a11y tree of the many pages
|
|
12
|
+
* that already convey structure via headings).
|
|
13
|
+
*/
|
|
14
|
+
function Separator({
|
|
15
|
+
className,
|
|
16
|
+
orientation = "horizontal",
|
|
17
|
+
decorative = true,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
20
|
+
return (
|
|
21
|
+
<SeparatorPrimitive.Root
|
|
22
|
+
data-slot="separator"
|
|
23
|
+
decorative={decorative}
|
|
24
|
+
orientation={orientation}
|
|
25
|
+
className={cn(
|
|
26
|
+
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Separator }
|
package/src/sheet.stories.tsx
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Sheet,
|
|
5
|
-
SheetTrigger,
|
|
6
|
-
SheetContent,
|
|
7
|
-
SheetHeader,
|
|
8
|
-
SheetTitle,
|
|
9
|
-
SheetDescription,
|
|
10
|
-
SheetClose,
|
|
11
|
-
} from "./sheet"
|
|
12
|
-
import { Button } from "./button"
|
|
13
|
-
|
|
14
|
-
const meta = {
|
|
15
|
-
title: "Overlays/Sheet",
|
|
16
|
-
component: Sheet,
|
|
17
|
-
tags: ["autodocs"],
|
|
18
|
-
} satisfies Meta<typeof Sheet>
|
|
19
|
-
|
|
20
|
-
export default meta
|
|
21
|
-
type Story = StoryObj<typeof meta>
|
|
22
|
-
|
|
23
|
-
const sides = ["right", "left", "top", "bottom"] as const
|
|
24
|
-
|
|
25
|
-
export const Sides: Story = {
|
|
26
|
-
render: () => (
|
|
27
|
-
<div className="flex flex-wrap gap-3">
|
|
28
|
-
{sides.map((side) => (
|
|
29
|
-
<Sheet key={side}>
|
|
30
|
-
<SheetTrigger asChild>
|
|
31
|
-
<Button variant="outline">{side}</Button>
|
|
32
|
-
</SheetTrigger>
|
|
33
|
-
<SheetContent side={side}>
|
|
34
|
-
<SheetHeader>
|
|
35
|
-
<SheetTitle>Tenant details</SheetTitle>
|
|
36
|
-
<SheetDescription>Opens from the {side} edge.</SheetDescription>
|
|
37
|
-
</SheetHeader>
|
|
38
|
-
<div className="text-muted-foreground text-xs">
|
|
39
|
-
Panel body content goes here.
|
|
40
|
-
</div>
|
|
41
|
-
<SheetClose asChild>
|
|
42
|
-
<Button variant="outline" className="mt-auto">Close</Button>
|
|
43
|
-
</SheetClose>
|
|
44
|
-
</SheetContent>
|
|
45
|
-
</Sheet>
|
|
46
|
-
))}
|
|
47
|
-
</div>
|
|
48
|
-
),
|
|
49
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Sheet,
|
|
5
|
+
SheetTrigger,
|
|
6
|
+
SheetContent,
|
|
7
|
+
SheetHeader,
|
|
8
|
+
SheetTitle,
|
|
9
|
+
SheetDescription,
|
|
10
|
+
SheetClose,
|
|
11
|
+
} from "./sheet"
|
|
12
|
+
import { Button } from "./button"
|
|
13
|
+
|
|
14
|
+
const meta = {
|
|
15
|
+
title: "Overlays/Sheet",
|
|
16
|
+
component: Sheet,
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
} satisfies Meta<typeof Sheet>
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof meta>
|
|
22
|
+
|
|
23
|
+
const sides = ["right", "left", "top", "bottom"] as const
|
|
24
|
+
|
|
25
|
+
export const Sides: Story = {
|
|
26
|
+
render: () => (
|
|
27
|
+
<div className="flex flex-wrap gap-3">
|
|
28
|
+
{sides.map((side) => (
|
|
29
|
+
<Sheet key={side}>
|
|
30
|
+
<SheetTrigger asChild>
|
|
31
|
+
<Button variant="outline">{side}</Button>
|
|
32
|
+
</SheetTrigger>
|
|
33
|
+
<SheetContent side={side}>
|
|
34
|
+
<SheetHeader>
|
|
35
|
+
<SheetTitle>Tenant details</SheetTitle>
|
|
36
|
+
<SheetDescription>Opens from the {side} edge.</SheetDescription>
|
|
37
|
+
</SheetHeader>
|
|
38
|
+
<div className="text-muted-foreground text-xs">
|
|
39
|
+
Panel body content goes here.
|
|
40
|
+
</div>
|
|
41
|
+
<SheetClose asChild>
|
|
42
|
+
<Button variant="outline" className="mt-auto">Close</Button>
|
|
43
|
+
</SheetClose>
|
|
44
|
+
</SheetContent>
|
|
45
|
+
</Sheet>
|
|
46
|
+
))}
|
|
47
|
+
</div>
|
|
48
|
+
),
|
|
49
|
+
}
|