@ptengine/design-components 0.6.0 → 0.7.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/CHANGELOG.md +119 -0
- package/COMPONENTS-DESIGN-SYSTEM.md +14 -2
- package/README.md +32 -13
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/input-otp.d.ts.map +1 -1
- package/dist/components/ui/prompt-picker.d.ts +2 -2
- package/dist/components/ui/search-input.d.ts +3 -3
- package/dist/components/ui/select.d.ts +2 -2
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +472 -467
- package/dist/style.css +398 -0
- package/package.json +8 -4
- package/src/components/ui/accordion.tsx +6 -6
- package/src/components/ui/alert-dialog.tsx +9 -7
- package/src/components/ui/alert.tsx +5 -5
- package/src/components/ui/attachment.tsx +15 -15
- package/src/components/ui/avatar.tsx +6 -6
- package/src/components/ui/badge.tsx +8 -8
- package/src/components/ui/breadcrumb.tsx +8 -8
- package/src/components/ui/bubble.tsx +15 -15
- package/src/components/ui/button-group.tsx +5 -5
- package/src/components/ui/button.tsx +16 -16
- package/src/components/ui/calendar.tsx +23 -23
- package/src/components/ui/card.tsx +6 -6
- package/src/components/ui/carousel.tsx +16 -16
- package/src/components/ui/chart.tsx +21 -21
- package/src/components/ui/checkbox.tsx +3 -3
- package/src/components/ui/command.tsx +12 -12
- package/src/components/ui/context-menu.tsx +16 -16
- package/src/components/ui/dialog.tsx +12 -10
- package/src/components/ui/drawer.tsx +9 -7
- package/src/components/ui/dropdown-menu.tsx +17 -17
- package/src/components/ui/empty.tsx +7 -7
- package/src/components/ui/field.tsx +18 -18
- package/src/components/ui/hover-card.tsx +1 -1
- package/src/components/ui/input-group.tsx +11 -11
- package/src/components/ui/input-otp.tsx +9 -9
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/item.tsx +18 -18
- package/src/components/ui/kbd.tsx +2 -2
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/marker.tsx +5 -5
- package/src/components/ui/menubar.tsx +18 -18
- package/src/components/ui/message-scroller.tsx +6 -6
- package/src/components/ui/message.tsx +6 -6
- package/src/components/ui/native-select.tsx +3 -3
- package/src/components/ui/navigation-menu.tsx +9 -9
- package/src/components/ui/pagination.tsx +9 -9
- package/src/components/ui/popover.tsx +1 -1
- package/src/components/ui/progress.tsx +2 -2
- package/src/components/ui/prompt-picker.tsx +25 -25
- package/src/components/ui/radio-group.tsx +4 -4
- package/src/components/ui/resizable.tsx +4 -4
- package/src/components/ui/scroll-area.tsx +6 -6
- package/src/components/ui/search-input.tsx +12 -12
- package/src/components/ui/select.tsx +17 -17
- package/src/components/ui/separator.tsx +2 -2
- package/src/components/ui/sheet.tsx +15 -13
- package/src/components/ui/sidebar.tsx +70 -70
- package/src/components/ui/skeleton.tsx +12 -1
- package/src/components/ui/slider.tsx +4 -4
- package/src/components/ui/sonner.tsx +4 -4
- package/src/components/ui/spinner.tsx +1 -1
- package/src/components/ui/switch.tsx +2 -2
- package/src/components/ui/table.tsx +9 -9
- package/src/components/ui/tabs.tsx +16 -16
- package/src/components/ui/textarea.tsx +1 -1
- package/src/components/ui/toggle-group.tsx +1 -1
- package/src/components/ui/toggle.tsx +6 -6
- package/src/components/ui/tooltip.tsx +1 -1
|
@@ -122,7 +122,7 @@ const SidebarProvider = React.forwardRef<
|
|
|
122
122
|
} as React.CSSProperties
|
|
123
123
|
}
|
|
124
124
|
className={cn(
|
|
125
|
-
'group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar',
|
|
125
|
+
'group/sidebar-wrapper ptx-flex ptx-min-h-svh ptx-w-full has-[[data-variant=inset]]:ptx-bg-sidebar',
|
|
126
126
|
className
|
|
127
127
|
)}
|
|
128
128
|
ref={ref}
|
|
@@ -155,7 +155,7 @@ const Sidebar = React.forwardRef<
|
|
|
155
155
|
return (
|
|
156
156
|
<div
|
|
157
157
|
className={cn(
|
|
158
|
-
'flex h-full w-[--pt-sidebar-width] flex-col bg-sidebar text-sidebar-foreground',
|
|
158
|
+
'ptx-flex ptx-h-full ptx-w-[--pt-sidebar-width] ptx-flex-col ptx-bg-sidebar ptx-text-sidebar-foreground',
|
|
159
159
|
className
|
|
160
160
|
)}
|
|
161
161
|
ref={ref}
|
|
@@ -172,7 +172,7 @@ const Sidebar = React.forwardRef<
|
|
|
172
172
|
<SheetContent
|
|
173
173
|
data-sidebar="sidebar"
|
|
174
174
|
data-mobile="true"
|
|
175
|
-
className="w-[--pt-sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
175
|
+
className="ptx-w-[--pt-sidebar-width] ptx-bg-sidebar ptx-p-0 ptx-text-sidebar-foreground [&>button]:ptx-hidden"
|
|
176
176
|
style={
|
|
177
177
|
{
|
|
178
178
|
'--pt-sidebar-width': SIDEBAR_WIDTH_MOBILE
|
|
@@ -180,11 +180,11 @@ const Sidebar = React.forwardRef<
|
|
|
180
180
|
}
|
|
181
181
|
side={side}
|
|
182
182
|
>
|
|
183
|
-
<SheetHeader className="sr-only">
|
|
183
|
+
<SheetHeader className="ptx-sr-only">
|
|
184
184
|
<SheetTitle>Sidebar</SheetTitle>
|
|
185
185
|
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
|
186
186
|
</SheetHeader>
|
|
187
|
-
<div className="flex h-full w-full flex-col">{children}</div>
|
|
187
|
+
<div className="ptx-flex ptx-h-full ptx-w-full ptx-flex-col">{children}</div>
|
|
188
188
|
</SheetContent>
|
|
189
189
|
</Sheet>
|
|
190
190
|
);
|
|
@@ -193,7 +193,7 @@ const Sidebar = React.forwardRef<
|
|
|
193
193
|
return (
|
|
194
194
|
<div
|
|
195
195
|
ref={ref}
|
|
196
|
-
className="group peer hidden text-sidebar-foreground md:block"
|
|
196
|
+
className="group peer ptx-hidden ptx-text-sidebar-foreground md:ptx-block"
|
|
197
197
|
data-state={state}
|
|
198
198
|
data-collapsible={state === 'collapsed' ? collapsible : ''}
|
|
199
199
|
data-variant={variant}
|
|
@@ -201,29 +201,29 @@ const Sidebar = React.forwardRef<
|
|
|
201
201
|
>
|
|
202
202
|
<div
|
|
203
203
|
className={cn(
|
|
204
|
-
'relative w-[--pt-sidebar-width] bg-transparent transition-[width] duration-200 ease-linear',
|
|
205
|
-
'group-data-[collapsible=offcanvas]:w-0',
|
|
206
|
-
'group-data-[side=right]:rotate-180',
|
|
204
|
+
'ptx-relative ptx-w-[--pt-sidebar-width] ptx-bg-transparent ptx-transition-[width] ptx-duration-200 ptx-ease-linear',
|
|
205
|
+
'group-data-[collapsible=offcanvas]:ptx-w-0',
|
|
206
|
+
'group-data-[side=right]:ptx-rotate-180',
|
|
207
207
|
variant === 'floating' || variant === 'inset'
|
|
208
|
-
? 'group-data-[collapsible=icon]:w-[calc(var(--pt-sidebar-width-icon)_+_theme(spacing.4))]'
|
|
209
|
-
: 'group-data-[collapsible=icon]:w-[--pt-sidebar-width-icon]'
|
|
208
|
+
? 'group-data-[collapsible=icon]:ptx-w-[calc(var(--pt-sidebar-width-icon)_+_theme(spacing.4))]'
|
|
209
|
+
: 'group-data-[collapsible=icon]:ptx-w-[--pt-sidebar-width-icon]'
|
|
210
210
|
)}
|
|
211
211
|
/>
|
|
212
212
|
<div
|
|
213
213
|
className={cn(
|
|
214
|
-
'fixed inset-y-0 z-10 hidden h-svh w-[--pt-sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex',
|
|
214
|
+
'ptx-fixed ptx-inset-y-0 ptx-z-10 ptx-hidden ptx-h-svh ptx-w-[--pt-sidebar-width] ptx-transition-[left,right,width] ptx-duration-200 ptx-ease-linear md:ptx-flex',
|
|
215
215
|
side === 'left'
|
|
216
|
-
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--pt-sidebar-width)*-1)]'
|
|
217
|
-
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--pt-sidebar-width)*-1)]',
|
|
216
|
+
? 'ptx-left-0 group-data-[collapsible=offcanvas]:ptx-left-[calc(var(--pt-sidebar-width)*-1)]'
|
|
217
|
+
: 'ptx-right-0 group-data-[collapsible=offcanvas]:ptx-right-[calc(var(--pt-sidebar-width)*-1)]',
|
|
218
218
|
variant === 'floating' || variant === 'inset'
|
|
219
|
-
? 'p-[8px] group-data-[collapsible=icon]:w-[calc(var(--pt-sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
|
|
220
|
-
: 'group-data-[collapsible=icon]:w-[--pt-sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l',
|
|
219
|
+
? 'ptx-p-[8px] group-data-[collapsible=icon]:ptx-w-[calc(var(--pt-sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
|
|
220
|
+
: 'group-data-[collapsible=icon]:ptx-w-[--pt-sidebar-width-icon] group-data-[side=left]:ptx-border-r group-data-[side=right]:ptx-border-l',
|
|
221
221
|
className
|
|
222
222
|
)}
|
|
223
223
|
{...props}
|
|
224
224
|
data-sidebar="sidebar"
|
|
225
225
|
>
|
|
226
|
-
<div className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-[var(--
|
|
226
|
+
<div className="ptx-flex ptx-h-full ptx-w-full ptx-flex-col ptx-bg-sidebar group-data-[variant=floating]:ptx-rounded-[var(--ptx-radius)] group-data-[variant=floating]:ptx-border group-data-[variant=floating]:ptx-border-sidebar-border">
|
|
227
227
|
{children}
|
|
228
228
|
</div>
|
|
229
229
|
</div>
|
|
@@ -246,7 +246,7 @@ const SidebarTrigger = React.forwardRef<
|
|
|
246
246
|
data-sidebar="trigger"
|
|
247
247
|
variant="ghost"
|
|
248
248
|
size="icon"
|
|
249
|
-
className={cn('h-[28px] w-[28px]', className)}
|
|
249
|
+
className={cn('ptx-h-[28px] ptx-w-[28px]', className)}
|
|
250
250
|
onClick={event => {
|
|
251
251
|
onClick?.(event);
|
|
252
252
|
toggleSidebar();
|
|
@@ -254,7 +254,7 @@ const SidebarTrigger = React.forwardRef<
|
|
|
254
254
|
{...props}
|
|
255
255
|
>
|
|
256
256
|
<PanelLeft />
|
|
257
|
-
<span className="sr-only">{label}</span>
|
|
257
|
+
<span className="ptx-sr-only">{label}</span>
|
|
258
258
|
</Button>
|
|
259
259
|
);
|
|
260
260
|
});
|
|
@@ -275,12 +275,12 @@ const SidebarRail = React.forwardRef<
|
|
|
275
275
|
onClick={toggleSidebar}
|
|
276
276
|
title={label}
|
|
277
277
|
className={cn(
|
|
278
|
-
'absolute inset-y-0 z-20 hidden w-[16px] -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-[16px] group-data-[side=right]:left-0 sm:flex',
|
|
279
|
-
'[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize',
|
|
280
|
-
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
|
|
281
|
-
'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar',
|
|
282
|
-
'[[data-side=left][data-collapsible=offcanvas]_&]:-right-[8px]',
|
|
283
|
-
'[[data-side=right][data-collapsible=offcanvas]_&]:-left-[8px]',
|
|
278
|
+
'ptx-absolute ptx-inset-y-0 ptx-z-20 ptx-hidden ptx-w-[16px] -ptx-translate-x-1/2 ptx-transition-all ptx-ease-linear after:ptx-absolute after:ptx-inset-y-0 after:ptx-left-1/2 after:ptx-w-[2px] hover:after:ptx-bg-sidebar-border group-data-[side=left]:-ptx-right-[16px] group-data-[side=right]:ptx-left-0 sm:ptx-flex',
|
|
279
|
+
'[[data-side=left]_&]:ptx-cursor-w-resize [[data-side=right]_&]:ptx-cursor-e-resize',
|
|
280
|
+
'[[data-side=left][data-state=collapsed]_&]:ptx-cursor-e-resize [[data-side=right][data-state=collapsed]_&]:ptx-cursor-w-resize',
|
|
281
|
+
'group-data-[collapsible=offcanvas]:ptx-translate-x-0 group-data-[collapsible=offcanvas]:after:ptx-left-full group-data-[collapsible=offcanvas]:hover:ptx-bg-sidebar',
|
|
282
|
+
'[[data-side=left][data-collapsible=offcanvas]_&]:-ptx-right-[8px]',
|
|
283
|
+
'[[data-side=right][data-collapsible=offcanvas]_&]:-ptx-left-[8px]',
|
|
284
284
|
className
|
|
285
285
|
)}
|
|
286
286
|
{...props}
|
|
@@ -296,8 +296,8 @@ const SidebarInset = React.forwardRef<HTMLDivElement, React.ComponentProps<'main
|
|
|
296
296
|
<main
|
|
297
297
|
ref={ref}
|
|
298
298
|
className={cn(
|
|
299
|
-
'relative flex w-full flex-1 flex-col bg-background',
|
|
300
|
-
'md:peer-data-[variant=inset]:m-[8px] md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-[8px] md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-12',
|
|
299
|
+
'ptx-relative ptx-flex ptx-w-full ptx-flex-1 ptx-flex-col ptx-bg-background',
|
|
300
|
+
'md:peer-data-[variant=inset]:ptx-m-[8px] md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ptx-ml-[8px] md:peer-data-[variant=inset]:ptx-ml-0 md:peer-data-[variant=inset]:ptx-rounded-12',
|
|
301
301
|
className
|
|
302
302
|
)}
|
|
303
303
|
{...props}
|
|
@@ -315,7 +315,7 @@ const SidebarInput = React.forwardRef<
|
|
|
315
315
|
<Input
|
|
316
316
|
ref={ref}
|
|
317
317
|
data-sidebar="input"
|
|
318
|
-
className={cn('h-[32px] w-full bg-background', className)}
|
|
318
|
+
className={cn('ptx-h-[32px] ptx-w-full ptx-bg-background', className)}
|
|
319
319
|
{...props}
|
|
320
320
|
/>
|
|
321
321
|
);
|
|
@@ -328,7 +328,7 @@ const SidebarHeader = React.forwardRef<HTMLDivElement, React.ComponentProps<'div
|
|
|
328
328
|
<div
|
|
329
329
|
ref={ref}
|
|
330
330
|
data-sidebar="header"
|
|
331
|
-
className={cn('flex flex-col gap-[8px] p-[8px]', className)}
|
|
331
|
+
className={cn('ptx-flex ptx-flex-col ptx-gap-[8px] ptx-p-[8px]', className)}
|
|
332
332
|
{...props}
|
|
333
333
|
/>
|
|
334
334
|
);
|
|
@@ -342,7 +342,7 @@ const SidebarFooter = React.forwardRef<HTMLDivElement, React.ComponentProps<'div
|
|
|
342
342
|
<div
|
|
343
343
|
ref={ref}
|
|
344
344
|
data-sidebar="footer"
|
|
345
|
-
className={cn('flex flex-col gap-[8px] p-[8px]', className)}
|
|
345
|
+
className={cn('ptx-flex ptx-flex-col ptx-gap-[8px] ptx-p-[8px]', className)}
|
|
346
346
|
{...props}
|
|
347
347
|
/>
|
|
348
348
|
);
|
|
@@ -358,7 +358,7 @@ const SidebarSeparator = React.forwardRef<
|
|
|
358
358
|
<Separator
|
|
359
359
|
ref={ref}
|
|
360
360
|
data-sidebar="separator"
|
|
361
|
-
className={cn('mx-[8px] w-auto bg-sidebar-border', className)}
|
|
361
|
+
className={cn('ptx-mx-[8px] ptx-w-auto ptx-bg-sidebar-border', className)}
|
|
362
362
|
{...props}
|
|
363
363
|
/>
|
|
364
364
|
);
|
|
@@ -372,7 +372,7 @@ const SidebarContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'di
|
|
|
372
372
|
ref={ref}
|
|
373
373
|
data-sidebar="content"
|
|
374
374
|
className={cn(
|
|
375
|
-
'flex min-h-0 flex-1 flex-col gap-[8px] overflow-auto group-data-[collapsible=icon]:overflow-hidden',
|
|
375
|
+
'ptx-flex ptx-min-h-0 ptx-flex-1 ptx-flex-col ptx-gap-[8px] ptx-overflow-auto group-data-[collapsible=icon]:ptx-overflow-hidden',
|
|
376
376
|
className
|
|
377
377
|
)}
|
|
378
378
|
{...props}
|
|
@@ -388,7 +388,7 @@ const SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'
|
|
|
388
388
|
<div
|
|
389
389
|
ref={ref}
|
|
390
390
|
data-sidebar="group"
|
|
391
|
-
className={cn('relative flex w-full min-w-0 flex-col p-[8px]', className)}
|
|
391
|
+
className={cn('ptx-relative ptx-flex ptx-w-full ptx-min-w-0 ptx-flex-col ptx-p-[8px]', className)}
|
|
392
392
|
{...props}
|
|
393
393
|
/>
|
|
394
394
|
);
|
|
@@ -407,8 +407,8 @@ const SidebarGroupLabel = React.forwardRef<
|
|
|
407
407
|
ref={ref}
|
|
408
408
|
data-sidebar="group-label"
|
|
409
409
|
className={cn(
|
|
410
|
-
'flex h-[32px] shrink-0 items-center rounded-[var(--
|
|
411
|
-
'group-data-[collapsible=icon]:-mt-[32px] group-data-[collapsible=icon]:opacity-0',
|
|
410
|
+
'ptx-flex ptx-h-[32px] ptx-shrink-0 ptx-items-center ptx-rounded-[var(--ptx-radius-md)] ptx-px-[8px] ptx-text-xs ptx-font-medium ptx-text-sidebar-foreground/70 ptx-outline-none ptx-ring-sidebar-ring ptx-transition-[margin,opacity] ptx-duration-200 ptx-ease-linear focus-visible:ptx-ring-2 [&>svg]:ptx-size-[16px] [&>svg]:ptx-shrink-0',
|
|
411
|
+
'group-data-[collapsible=icon]:-ptx-mt-[32px] group-data-[collapsible=icon]:ptx-opacity-0',
|
|
412
412
|
className
|
|
413
413
|
)}
|
|
414
414
|
{...props}
|
|
@@ -428,9 +428,9 @@ const SidebarGroupAction = React.forwardRef<
|
|
|
428
428
|
ref={ref}
|
|
429
429
|
data-sidebar="group-action"
|
|
430
430
|
className={cn(
|
|
431
|
-
'absolute right-[12px] top-[14px] flex aspect-square w-[20px] items-center justify-center rounded-[var(--
|
|
432
|
-
'after:absolute after:-inset-[8px] after:md:hidden',
|
|
433
|
-
'group-data-[collapsible=icon]:hidden',
|
|
431
|
+
'ptx-absolute ptx-right-[12px] ptx-top-[14px] ptx-flex ptx-aspect-square ptx-w-[20px] ptx-items-center ptx-justify-center ptx-rounded-[var(--ptx-radius-md)] ptx-p-0 ptx-text-sidebar-foreground ptx-outline-none ptx-ring-sidebar-ring ptx-transition-transform hover:ptx-bg-sidebar-accent hover:ptx-text-sidebar-accent-foreground focus-visible:ptx-ring-2 [&>svg]:ptx-size-[16px] [&>svg]:ptx-shrink-0',
|
|
432
|
+
'after:ptx-absolute after:-ptx-inset-[8px] after:md:ptx-hidden',
|
|
433
|
+
'group-data-[collapsible=icon]:ptx-hidden',
|
|
434
434
|
className
|
|
435
435
|
)}
|
|
436
436
|
{...props}
|
|
@@ -444,7 +444,7 @@ const SidebarGroupContent = React.forwardRef<HTMLDivElement, React.ComponentProp
|
|
|
444
444
|
<div
|
|
445
445
|
ref={ref}
|
|
446
446
|
data-sidebar="group-content"
|
|
447
|
-
className={cn('w-full text-sm', className)}
|
|
447
|
+
className={cn('ptx-w-full ptx-text-sm', className)}
|
|
448
448
|
{...props}
|
|
449
449
|
/>
|
|
450
450
|
)
|
|
@@ -456,7 +456,7 @@ const SidebarMenu = React.forwardRef<HTMLUListElement, React.ComponentProps<'ul'
|
|
|
456
456
|
<ul
|
|
457
457
|
ref={ref}
|
|
458
458
|
data-sidebar="menu"
|
|
459
|
-
className={cn('flex w-full min-w-0 flex-col gap-[4px]', className)}
|
|
459
|
+
className={cn('ptx-flex ptx-w-full ptx-min-w-0 ptx-flex-col ptx-gap-[4px]', className)}
|
|
460
460
|
{...props}
|
|
461
461
|
/>
|
|
462
462
|
)
|
|
@@ -468,7 +468,7 @@ const SidebarMenuItem = React.forwardRef<HTMLLIElement, React.ComponentProps<'li
|
|
|
468
468
|
<li
|
|
469
469
|
ref={ref}
|
|
470
470
|
data-sidebar="menu-item"
|
|
471
|
-
className={cn('group/menu-item relative', className)}
|
|
471
|
+
className={cn('group/menu-item ptx-relative', className)}
|
|
472
472
|
{...props}
|
|
473
473
|
/>
|
|
474
474
|
)
|
|
@@ -476,18 +476,18 @@ const SidebarMenuItem = React.forwardRef<HTMLLIElement, React.ComponentProps<'li
|
|
|
476
476
|
SidebarMenuItem.displayName = 'SidebarMenuItem';
|
|
477
477
|
|
|
478
478
|
const sidebarMenuButtonVariants = cva(
|
|
479
|
-
'peer/menu-button flex w-full items-center gap-[8px] overflow-hidden rounded-[var(--
|
|
479
|
+
'peer/menu-button ptx-flex ptx-w-full ptx-items-center ptx-gap-[8px] ptx-overflow-hidden ptx-rounded-[var(--ptx-radius-md)] ptx-p-[8px] ptx-text-left ptx-text-sm ptx-text-sidebar-foreground ptx-outline-none ptx-ring-sidebar-ring ptx-transition-[width,height,padding] hover:ptx-bg-sidebar-accent hover:ptx-text-sidebar-accent-foreground focus-visible:ptx-ring-2 active:ptx-bg-sidebar-accent active:ptx-text-sidebar-accent-foreground disabled:ptx-pointer-events-none disabled:ptx-opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:ptx-pr-[32px] aria-disabled:ptx-pointer-events-none aria-disabled:ptx-opacity-50 data-[active=true]:ptx-bg-selected data-[active=true]:ptx-font-medium data-[active=true]:ptx-text-sidebar-accent-foreground data-[state=open]:hover:ptx-bg-sidebar-accent data-[state=open]:hover:ptx-text-sidebar-accent-foreground group-data-[collapsible=icon]:!ptx-size-[32px] group-data-[collapsible=icon]:!ptx-p-[8px] [&>span:last-child]:ptx-truncate [&>svg]:ptx-size-[16px] [&>svg]:ptx-shrink-0',
|
|
480
480
|
{
|
|
481
481
|
variants: {
|
|
482
482
|
variant: {
|
|
483
|
-
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
483
|
+
default: 'hover:ptx-bg-sidebar-accent hover:ptx-text-sidebar-accent-foreground',
|
|
484
484
|
outline:
|
|
485
|
-
'bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground'
|
|
485
|
+
'ptx-bg-background hover:ptx-bg-sidebar-accent hover:ptx-text-sidebar-accent-foreground'
|
|
486
486
|
},
|
|
487
487
|
size: {
|
|
488
|
-
default: 'h-[32px] text-sm',
|
|
489
|
-
sm: 'h-[28px] text-xs',
|
|
490
|
-
lg: 'h-[48px] text-sm group-data-[collapsible=icon]:!p-0'
|
|
488
|
+
default: 'ptx-h-[32px] ptx-text-sm',
|
|
489
|
+
sm: 'ptx-h-[28px] ptx-text-xs',
|
|
490
|
+
lg: 'ptx-h-[48px] ptx-text-sm group-data-[collapsible=icon]:!ptx-p-0'
|
|
491
491
|
}
|
|
492
492
|
},
|
|
493
493
|
defaultVariants: {
|
|
@@ -557,14 +557,14 @@ const SidebarMenuAction = React.forwardRef<
|
|
|
557
557
|
ref={ref}
|
|
558
558
|
data-sidebar="menu-action"
|
|
559
559
|
className={cn(
|
|
560
|
-
'absolute right-[4px] top-[6px] flex aspect-square w-[20px] items-center justify-center rounded-[var(--
|
|
561
|
-
'after:absolute after:-inset-[8px] after:md:hidden',
|
|
562
|
-
'peer-data-[size=sm]/menu-button:top-[4px]',
|
|
563
|
-
'peer-data-[size=default]/menu-button:top-[6px]',
|
|
564
|
-
'peer-data-[size=lg]/menu-button:top-[10px]',
|
|
565
|
-
'group-data-[collapsible=icon]:hidden',
|
|
560
|
+
'ptx-absolute ptx-right-[4px] ptx-top-[6px] ptx-flex ptx-aspect-square ptx-w-[20px] ptx-items-center ptx-justify-center ptx-rounded-[var(--ptx-radius-md)] ptx-p-0 ptx-text-sidebar-foreground ptx-outline-none ptx-ring-sidebar-ring ptx-transition-transform hover:ptx-bg-sidebar-accent hover:ptx-text-sidebar-accent-foreground focus-visible:ptx-ring-2 peer-hover/menu-button:ptx-text-sidebar-accent-foreground [&>svg]:ptx-size-[16px] [&>svg]:ptx-shrink-0',
|
|
561
|
+
'after:ptx-absolute after:-ptx-inset-[8px] after:md:ptx-hidden',
|
|
562
|
+
'peer-data-[size=sm]/menu-button:ptx-top-[4px]',
|
|
563
|
+
'peer-data-[size=default]/menu-button:ptx-top-[6px]',
|
|
564
|
+
'peer-data-[size=lg]/menu-button:ptx-top-[10px]',
|
|
565
|
+
'group-data-[collapsible=icon]:ptx-hidden',
|
|
566
566
|
showOnHover &&
|
|
567
|
-
'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0',
|
|
567
|
+
'group-focus-within/menu-item:ptx-opacity-100 group-hover/menu-item:ptx-opacity-100 data-[state=open]:ptx-opacity-100 peer-data-[active=true]/menu-button:ptx-text-sidebar-accent-foreground md:ptx-opacity-0',
|
|
568
568
|
className
|
|
569
569
|
)}
|
|
570
570
|
{...props}
|
|
@@ -579,12 +579,12 @@ const SidebarMenuBadge = React.forwardRef<HTMLDivElement, React.ComponentProps<'
|
|
|
579
579
|
ref={ref}
|
|
580
580
|
data-sidebar="menu-badge"
|
|
581
581
|
className={cn(
|
|
582
|
-
'pointer-events-none absolute right-[4px] flex h-[20px] min-w-[20px] select-none items-center justify-center rounded-[var(--
|
|
583
|
-
'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
|
|
584
|
-
'peer-data-[size=sm]/menu-button:top-[4px]',
|
|
585
|
-
'peer-data-[size=default]/menu-button:top-[6px]',
|
|
586
|
-
'peer-data-[size=lg]/menu-button:top-[10px]',
|
|
587
|
-
'group-data-[collapsible=icon]:hidden',
|
|
582
|
+
'ptx-pointer-events-none ptx-absolute ptx-right-[4px] ptx-flex ptx-h-[20px] ptx-min-w-[20px] ptx-select-none ptx-items-center ptx-justify-center ptx-rounded-[var(--ptx-radius-md)] ptx-px-[4px] ptx-text-xs ptx-font-medium ptx-tabular-nums ptx-text-sidebar-foreground',
|
|
583
|
+
'peer-hover/menu-button:ptx-text-sidebar-accent-foreground peer-data-[active=true]/menu-button:ptx-text-sidebar-accent-foreground',
|
|
584
|
+
'peer-data-[size=sm]/menu-button:ptx-top-[4px]',
|
|
585
|
+
'peer-data-[size=default]/menu-button:ptx-top-[6px]',
|
|
586
|
+
'peer-data-[size=lg]/menu-button:ptx-top-[10px]',
|
|
587
|
+
'group-data-[collapsible=icon]:ptx-hidden',
|
|
588
588
|
className
|
|
589
589
|
)}
|
|
590
590
|
{...props}
|
|
@@ -607,12 +607,12 @@ const SidebarMenuSkeleton = React.forwardRef<
|
|
|
607
607
|
<div
|
|
608
608
|
ref={ref}
|
|
609
609
|
data-sidebar="menu-skeleton"
|
|
610
|
-
className={cn('flex h-[32px] items-center gap-[8px] rounded-[var(--
|
|
610
|
+
className={cn('ptx-flex ptx-h-[32px] ptx-items-center ptx-gap-[8px] ptx-rounded-[var(--ptx-radius-md)] ptx-px-[8px]', className)}
|
|
611
611
|
{...props}
|
|
612
612
|
>
|
|
613
|
-
{showIcon && <Skeleton className="size-[16px] rounded-[var(--
|
|
613
|
+
{showIcon && <Skeleton className="ptx-size-[16px] ptx-rounded-[var(--ptx-radius-md)]" data-sidebar="menu-skeleton-icon" />}
|
|
614
614
|
<Skeleton
|
|
615
|
-
className="h-[16px] max-w-[--skeleton-width] flex-1"
|
|
615
|
+
className="ptx-h-[16px] ptx-max-w-[--skeleton-width] ptx-flex-1"
|
|
616
616
|
data-sidebar="menu-skeleton-text"
|
|
617
617
|
style={
|
|
618
618
|
{
|
|
@@ -631,8 +631,8 @@ const SidebarMenuSub = React.forwardRef<HTMLUListElement, React.ComponentProps<'
|
|
|
631
631
|
ref={ref}
|
|
632
632
|
data-sidebar="menu-sub"
|
|
633
633
|
className={cn(
|
|
634
|
-
'mx-[14px] flex min-w-0 translate-x-px flex-col gap-[4px] border-l border-sidebar-border px-[10px] py-[2px]',
|
|
635
|
-
'group-data-[collapsible=icon]:hidden',
|
|
634
|
+
'ptx-mx-[14px] ptx-flex ptx-min-w-0 ptx-translate-x-px ptx-flex-col ptx-gap-[4px] ptx-border-l ptx-border-sidebar-border ptx-px-[10px] ptx-py-[2px]',
|
|
635
|
+
'group-data-[collapsible=icon]:ptx-hidden',
|
|
636
636
|
className
|
|
637
637
|
)}
|
|
638
638
|
{...props}
|
|
@@ -663,11 +663,11 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
663
663
|
data-size={size}
|
|
664
664
|
data-active={isActive}
|
|
665
665
|
className={cn(
|
|
666
|
-
'flex h-[28px] min-w-0 -translate-x-px items-center gap-[8px] overflow-hidden rounded-[var(--
|
|
667
|
-
'data-[active=true]:bg-selected data-[active=true]:text-sidebar-accent-foreground',
|
|
668
|
-
size === 'sm' && 'text-xs',
|
|
669
|
-
size === 'md' && 'text-sm',
|
|
670
|
-
'group-data-[collapsible=icon]:hidden',
|
|
666
|
+
'ptx-flex ptx-h-[28px] ptx-min-w-0 -ptx-translate-x-px ptx-items-center ptx-gap-[8px] ptx-overflow-hidden ptx-rounded-[var(--ptx-radius-md)] ptx-px-[8px] ptx-text-sidebar-foreground ptx-outline-none ptx-ring-sidebar-ring hover:ptx-bg-sidebar-accent hover:ptx-text-sidebar-accent-foreground focus-visible:ptx-ring-2 active:ptx-bg-sidebar-accent active:ptx-text-sidebar-accent-foreground disabled:ptx-pointer-events-none disabled:ptx-opacity-50 aria-disabled:ptx-pointer-events-none aria-disabled:ptx-opacity-50 [&>span:last-child]:ptx-truncate [&>svg]:ptx-size-[16px] [&>svg]:ptx-shrink-0 [&>svg]:ptx-text-sidebar-accent-foreground',
|
|
667
|
+
'data-[active=true]:ptx-bg-selected data-[active=true]:ptx-text-sidebar-accent-foreground',
|
|
668
|
+
size === 'sm' && 'ptx-text-xs',
|
|
669
|
+
size === 'md' && 'ptx-text-sm',
|
|
670
|
+
'group-data-[collapsible=icon]:ptx-hidden',
|
|
671
671
|
className
|
|
672
672
|
)}
|
|
673
673
|
{...props}
|
|
@@ -3,7 +3,18 @@ import * as React from 'react';
|
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
4
|
|
|
5
5
|
function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
6
|
-
return
|
|
6
|
+
return (
|
|
7
|
+
/* `data-slot` 是本库的稳定钩子(沿用 shadcn 上游约定,另有 8 个组件在用)。
|
|
8
|
+
消费方的测试请查它,**不要查 class 名** —— 类名带 `ptx-` 前缀且随构建变化,
|
|
9
|
+
按类名查会在前缀调整时静默失配(选不到元素,断言变成假通过或假失败)。
|
|
10
|
+
(注释里也别写出具体类名:Tailwind 连注释都当候选扫,会凭空生成一条
|
|
11
|
+
不带前缀的规则,check:css 会报出来。) */
|
|
12
|
+
<div
|
|
13
|
+
data-slot="skeleton"
|
|
14
|
+
className={cn('ptx-animate-pulse ptx-rounded-[var(--ptx-radius-md)] ptx-bg-muted', className)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
7
18
|
}
|
|
8
19
|
|
|
9
20
|
export { Skeleton };
|
|
@@ -19,18 +19,18 @@ const Slider = React.forwardRef<
|
|
|
19
19
|
value={value}
|
|
20
20
|
min={min}
|
|
21
21
|
className={cn(
|
|
22
|
-
'relative flex w-full touch-none select-none items-center data-[disabled]:cursor-not-allowed',
|
|
22
|
+
'ptx-relative ptx-flex ptx-w-full ptx-touch-none ptx-select-none ptx-items-center data-[disabled]:ptx-cursor-not-allowed',
|
|
23
23
|
className
|
|
24
24
|
)}
|
|
25
25
|
{...props}
|
|
26
26
|
>
|
|
27
|
-
<SliderPrimitive.Track className="relative h-[6px] w-full grow overflow-hidden rounded-full bg-secondary">
|
|
28
|
-
<SliderPrimitive.Range className="absolute h-full bg-primary" />
|
|
27
|
+
<SliderPrimitive.Track className="ptx-relative ptx-h-[6px] ptx-w-full ptx-grow ptx-overflow-hidden ptx-rounded-full ptx-bg-secondary">
|
|
28
|
+
<SliderPrimitive.Range className="ptx-absolute ptx-h-full ptx-bg-primary" />
|
|
29
29
|
</SliderPrimitive.Track>
|
|
30
30
|
{values.map((_, index) => (
|
|
31
31
|
<SliderPrimitive.Thumb
|
|
32
32
|
key={index}
|
|
33
|
-
className="block h-[16px] w-[16px] shrink-0 rounded-full border border-neutral bg-background transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring data-[disabled]:opacity-50"
|
|
33
|
+
className="ptx-block ptx-h-[16px] ptx-w-[16px] ptx-shrink-0 ptx-rounded-full ptx-border ptx-border-neutral ptx-bg-background ptx-transition-colors focus-visible:ptx-outline-none focus-visible:ptx-ring-1 focus-visible:ptx-ring-ring data-[disabled]:ptx-opacity-50"
|
|
34
34
|
/>
|
|
35
35
|
))}
|
|
36
36
|
</SliderPrimitive.Root>
|
|
@@ -31,10 +31,10 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
|
|
31
31
|
className="toaster group"
|
|
32
32
|
toastOptions={{
|
|
33
33
|
classNames: {
|
|
34
|
-
toast: 'group toast group-[.toaster]:bg-popover group-[.toaster]:text-popover-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg',
|
|
35
|
-
description: 'group-[.toast]:text-muted-foreground',
|
|
36
|
-
actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',
|
|
37
|
-
cancelButton: 'group-[.toast]:bg-secondary group-[.toast]:text-secondary-foreground'
|
|
34
|
+
toast: 'group toast group-[.toaster]:ptx-bg-popover group-[.toaster]:ptx-text-popover-foreground group-[.toaster]:ptx-border-border group-[.toaster]:ptx-shadow-lg',
|
|
35
|
+
description: 'group-[.toast]:ptx-text-muted-foreground',
|
|
36
|
+
actionButton: 'group-[.toast]:ptx-bg-primary group-[.toast]:ptx-text-primary-foreground',
|
|
37
|
+
cancelButton: 'group-[.toast]:ptx-bg-secondary group-[.toast]:ptx-text-secondary-foreground'
|
|
38
38
|
}
|
|
39
39
|
}}
|
|
40
40
|
{...props}
|
|
@@ -9,7 +9,7 @@ const Switch = React.forwardRef<
|
|
|
9
9
|
>(({ className, ...props }, ref) => (
|
|
10
10
|
<SwitchPrimitives.Root
|
|
11
11
|
className={cn(
|
|
12
|
-
'peer state-layer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input [--pt-state-layer-border:2px]',
|
|
12
|
+
'peer ptx-state-layer ptx-inline-flex ptx-h-[20px] ptx-w-[36px] ptx-shrink-0 ptx-cursor-pointer ptx-items-center ptx-rounded-full ptx-border-2 ptx-border-transparent ptx-transition-colors focus-visible:ptx-outline-none focus-visible:ptx-ring-2 focus-visible:ptx-ring-ring focus-visible:ptx-ring-offset-2 focus-visible:ptx-ring-offset-background disabled:ptx-cursor-not-allowed disabled:ptx-opacity-50 data-[state=checked]:ptx-bg-primary data-[state=unchecked]:ptx-bg-input [--pt-state-layer-border:2px]',
|
|
13
13
|
className
|
|
14
14
|
)}
|
|
15
15
|
{...props}
|
|
@@ -17,7 +17,7 @@ const Switch = React.forwardRef<
|
|
|
17
17
|
>
|
|
18
18
|
<SwitchPrimitives.Thumb
|
|
19
19
|
className={cn(
|
|
20
|
-
'pointer-events-none block h-[16px] w-[16px] rounded-full border border-neutral bg-background ring-0 transition-transform data-[state=checked]:translate-x-[16px] data-[state=unchecked]:translate-x-0'
|
|
20
|
+
'ptx-pointer-events-none ptx-block ptx-h-[16px] ptx-w-[16px] ptx-rounded-full ptx-border ptx-border-neutral ptx-bg-background ptx-ring-0 ptx-transition-transform data-[state=checked]:ptx-translate-x-[16px] data-[state=unchecked]:ptx-translate-x-0'
|
|
21
21
|
)}
|
|
22
22
|
/>
|
|
23
23
|
</SwitchPrimitives.Root>
|
|
@@ -4,10 +4,10 @@ import { cn } from '../../lib/utils';
|
|
|
4
4
|
|
|
5
5
|
const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
|
|
6
6
|
({ className, ...props }, ref) => (
|
|
7
|
-
<div className="relative w-full overflow-auto">
|
|
7
|
+
<div className="ptx-relative ptx-w-full ptx-overflow-auto">
|
|
8
8
|
<table
|
|
9
9
|
ref={ref}
|
|
10
|
-
className={cn('w-full caption-bottom text-sm text-foreground', className)}
|
|
10
|
+
className={cn('ptx-w-full ptx-caption-bottom ptx-text-sm ptx-text-foreground', className)}
|
|
11
11
|
{...props}
|
|
12
12
|
/>
|
|
13
13
|
</div>
|
|
@@ -19,7 +19,7 @@ const TableHeader = React.forwardRef<
|
|
|
19
19
|
HTMLTableSectionElement,
|
|
20
20
|
React.HTMLAttributes<HTMLTableSectionElement>
|
|
21
21
|
>(({ className, ...props }, ref) => (
|
|
22
|
-
<thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props} />
|
|
22
|
+
<thead ref={ref} className={cn('[&_tr]:ptx-border-b', className)} {...props} />
|
|
23
23
|
));
|
|
24
24
|
TableHeader.displayName = 'TableHeader';
|
|
25
25
|
|
|
@@ -27,7 +27,7 @@ const TableBody = React.forwardRef<
|
|
|
27
27
|
HTMLTableSectionElement,
|
|
28
28
|
React.HTMLAttributes<HTMLTableSectionElement>
|
|
29
29
|
>(({ className, ...props }, ref) => (
|
|
30
|
-
<tbody ref={ref} className={cn('[&_tr:last-child]:border-0', className)} {...props} />
|
|
30
|
+
<tbody ref={ref} className={cn('[&_tr:last-child]:ptx-border-0', className)} {...props} />
|
|
31
31
|
));
|
|
32
32
|
TableBody.displayName = 'TableBody';
|
|
33
33
|
|
|
@@ -37,7 +37,7 @@ const TableFooter = React.forwardRef<
|
|
|
37
37
|
>(({ className, ...props }, ref) => (
|
|
38
38
|
<tfoot
|
|
39
39
|
ref={ref}
|
|
40
|
-
className={cn('border-t bg-secondary font-medium [&>tr]:last:border-b-0', className)}
|
|
40
|
+
className={cn('ptx-border-t ptx-bg-secondary ptx-font-medium [&>tr]:last:ptx-border-b-0', className)}
|
|
41
41
|
{...props}
|
|
42
42
|
/>
|
|
43
43
|
));
|
|
@@ -48,7 +48,7 @@ const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTML
|
|
|
48
48
|
<tr
|
|
49
49
|
ref={ref}
|
|
50
50
|
className={cn(
|
|
51
|
-
'state-layer border-b transition-colors data-[state=selected]:bg-selected',
|
|
51
|
+
'ptx-state-layer ptx-border-b ptx-transition-colors data-[state=selected]:ptx-bg-selected',
|
|
52
52
|
className
|
|
53
53
|
)}
|
|
54
54
|
{...props}
|
|
@@ -64,7 +64,7 @@ const TableHead = React.forwardRef<
|
|
|
64
64
|
<th
|
|
65
65
|
ref={ref}
|
|
66
66
|
className={cn(
|
|
67
|
-
'h-[40px] px-[12px] text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0',
|
|
67
|
+
'ptx-h-[40px] ptx-px-[12px] ptx-text-left ptx-align-middle ptx-font-medium ptx-text-muted-foreground [&:has([role=checkbox])]:ptx-pr-0',
|
|
68
68
|
className
|
|
69
69
|
)}
|
|
70
70
|
{...props}
|
|
@@ -78,7 +78,7 @@ const TableCell = React.forwardRef<
|
|
|
78
78
|
>(({ className, ...props }, ref) => (
|
|
79
79
|
<td
|
|
80
80
|
ref={ref}
|
|
81
|
-
className={cn('p-[12px] align-middle [&:has([role=checkbox])]:pr-0', className)}
|
|
81
|
+
className={cn('ptx-p-[12px] ptx-align-middle [&:has([role=checkbox])]:ptx-pr-0', className)}
|
|
82
82
|
{...props}
|
|
83
83
|
/>
|
|
84
84
|
));
|
|
@@ -88,7 +88,7 @@ const TableCaption = React.forwardRef<
|
|
|
88
88
|
HTMLTableCaptionElement,
|
|
89
89
|
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
90
90
|
>(({ className, ...props }, ref) => (
|
|
91
|
-
<caption ref={ref} className={cn('mt-[16px] text-sm text-muted-foreground', className)} {...props} />
|
|
91
|
+
<caption ref={ref} className={cn('ptx-mt-[16px] ptx-text-sm ptx-text-muted-foreground', className)} {...props} />
|
|
92
92
|
));
|
|
93
93
|
TableCaption.displayName = 'TableCaption';
|
|
94
94
|
|
|
@@ -20,21 +20,21 @@ const TabsContext = React.createContext<{ variant: TabsVariant; size: TabsSize }
|
|
|
20
20
|
|
|
21
21
|
const LIST_SIZE: Record<TabsVariant, Record<TabsSize, string>> = {
|
|
22
22
|
segmented: {
|
|
23
|
-
sm: 'h-[24px] p-[2px]',
|
|
24
|
-
default: 'h-[32px] p-[4px]',
|
|
25
|
-
lg: 'h-[40px] p-[4px]'
|
|
23
|
+
sm: 'ptx-h-[24px] ptx-p-[2px]',
|
|
24
|
+
default: 'ptx-h-[32px] ptx-p-[4px]',
|
|
25
|
+
lg: 'ptx-h-[40px] ptx-p-[4px]'
|
|
26
26
|
},
|
|
27
27
|
line: {
|
|
28
|
-
sm: 'h-[24px] gap-[12px]',
|
|
29
|
-
default: 'h-[32px] gap-[16px]',
|
|
30
|
-
lg: 'h-[40px] gap-[20px]'
|
|
28
|
+
sm: 'ptx-h-[24px] ptx-gap-[12px]',
|
|
29
|
+
default: 'ptx-h-[32px] ptx-gap-[16px]',
|
|
30
|
+
lg: 'ptx-h-[40px] ptx-gap-[20px]'
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const TRIGGER_TEXT: Record<TabsSize, string> = {
|
|
35
|
-
sm: 'text-2xs',
|
|
36
|
-
default: 'text-xs',
|
|
37
|
-
lg: 'text-sm'
|
|
35
|
+
sm: 'ptx-text-2xs',
|
|
36
|
+
default: 'ptx-text-xs',
|
|
37
|
+
lg: 'ptx-text-sm'
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const Tabs = React.forwardRef<
|
|
@@ -62,10 +62,10 @@ const TabsList = React.forwardRef<
|
|
|
62
62
|
<TabsPrimitive.List
|
|
63
63
|
ref={ref}
|
|
64
64
|
className={cn(
|
|
65
|
-
'inline-flex items-center text-muted-foreground',
|
|
66
|
-
variant === 'segmented' && 'justify-center rounded-[var(--
|
|
65
|
+
'ptx-inline-flex ptx-items-center ptx-text-muted-foreground',
|
|
66
|
+
variant === 'segmented' && 'ptx-justify-center ptx-rounded-[var(--ptx-radius)] ptx-bg-muted',
|
|
67
67
|
/* line:整宽 + 底部分隔线,标签左对齐 */
|
|
68
|
-
variant === 'line' && 'w-full justify-start border-b border-border',
|
|
68
|
+
variant === 'line' && 'ptx-w-full ptx-justify-start ptx-border-b ptx-border-border',
|
|
69
69
|
LIST_SIZE[variant][size],
|
|
70
70
|
className
|
|
71
71
|
)}
|
|
@@ -84,15 +84,15 @@ const TabsTrigger = React.forwardRef<
|
|
|
84
84
|
<TabsPrimitive.Trigger
|
|
85
85
|
ref={ref}
|
|
86
86
|
className={cn(
|
|
87
|
-
'inline-flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
87
|
+
'ptx-inline-flex ptx-items-center ptx-justify-center ptx-whitespace-nowrap ptx-font-medium ptx-ring-offset-background ptx-transition-colors hover:ptx-text-foreground focus-visible:ptx-outline-none focus-visible:ptx-ring-2 focus-visible:ptx-ring-ring focus-visible:ptx-ring-offset-2 disabled:ptx-pointer-events-none disabled:ptx-opacity-50',
|
|
88
88
|
TRIGGER_TEXT[size],
|
|
89
89
|
/* segmented:选中项白底浮起。按设计铁律不加阴影——白底与灰底容器的
|
|
90
90
|
明度差已足够表达选中,阴影在暗色模式下还会失效。 */
|
|
91
91
|
variant === 'segmented' &&
|
|
92
|
-
'h-full rounded-[var(--
|
|
92
|
+
'ptx-h-full ptx-rounded-[var(--ptx-radius-sm)] ptx-px-[12px] data-[state=active]:ptx-bg-background data-[state=active]:ptx-text-foreground',
|
|
93
93
|
/* line:选中项底部 2px 实线,-mb-px 让它压住 List 的分隔线 */
|
|
94
94
|
variant === 'line' &&
|
|
95
|
-
'-mb-px h-full border-b-2 border-transparent px-[2px] data-[state=active]:border-foreground data-[state=active]:text-foreground',
|
|
95
|
+
'-ptx-mb-px ptx-h-full ptx-border-b-2 ptx-border-transparent ptx-px-[2px] data-[state=active]:ptx-border-foreground data-[state=active]:ptx-text-foreground',
|
|
96
96
|
className
|
|
97
97
|
)}
|
|
98
98
|
{...props}
|
|
@@ -108,7 +108,7 @@ const TabsContent = React.forwardRef<
|
|
|
108
108
|
<TabsPrimitive.Content
|
|
109
109
|
ref={ref}
|
|
110
110
|
className={cn(
|
|
111
|
-
'mt-[8px] ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
111
|
+
'ptx-mt-[8px] ptx-ring-offset-background focus-visible:ptx-outline-none focus-visible:ptx-ring-2 focus-visible:ptx-ring-ring focus-visible:ptx-ring-offset-2',
|
|
112
112
|
className
|
|
113
113
|
)}
|
|
114
114
|
{...props}
|
|
@@ -9,7 +9,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
9
9
|
return (
|
|
10
10
|
<textarea
|
|
11
11
|
className={cn(
|
|
12
|
-
'flex min-h-[60px] w-full rounded-[var(--
|
|
12
|
+
'ptx-flex ptx-min-h-[60px] ptx-w-full ptx-rounded-[var(--ptx-radius-md)] ptx-border ptx-border-input ptx-bg-transparent ptx-px-[12px] ptx-py-[8px] ptx-text-sm placeholder:ptx-text-muted-foreground ptx-transition-colors enabled:hover:ptx-border-neutral focus-visible:ptx-outline-none focus-visible:ptx-ring-1 focus-visible:ptx-ring-ring disabled:ptx-cursor-not-allowed disabled:ptx-opacity-50 aria-[invalid=true]:ptx-border-destructive aria-[invalid=true]:enabled:hover:ptx-border-destructive aria-[invalid=true]:focus-visible:ptx-ring-destructive/30',
|
|
13
13
|
className
|
|
14
14
|
)}
|
|
15
15
|
ref={ref}
|
|
@@ -17,7 +17,7 @@ const ToggleGroup = React.forwardRef<
|
|
|
17
17
|
>(({ className, variant, size, children, ...props }, ref) => (
|
|
18
18
|
<ToggleGroupPrimitive.Root
|
|
19
19
|
ref={ref}
|
|
20
|
-
className={cn('flex items-center justify-center gap-[4px]', className)}
|
|
20
|
+
className={cn('ptx-flex ptx-items-center ptx-justify-center ptx-gap-[4px]', className)}
|
|
21
21
|
{...props}
|
|
22
22
|
>
|
|
23
23
|
<ToggleGroupContext.Provider value={{ variant, size }}>
|