@health-samurai/react-components 0.0.0-alpha.4 → 0.0.0-alpha.5
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/dist/bundle.css +687 -446
- package/dist/src/components/code-editor/http/grammar/http.d.ts +3 -0
- package/dist/src/components/code-editor/http/grammar/http.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/dist/src/components/code-editor/http/grammar/http.js +38 -0
- package/dist/src/components/code-editor/http/grammar/http.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts +2 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js +4 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.test.d.ts +2 -0
- package/dist/src/components/code-editor/http/grammar/http.test.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js +80 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js.map +1 -0
- package/dist/src/components/code-editor/http/index.d.ts +4 -0
- package/dist/src/components/code-editor/http/index.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/index.js +66 -0
- package/dist/src/components/code-editor/http/index.js.map +1 -0
- package/dist/src/components/code-editor/index.d.ts +13 -2
- package/dist/src/components/code-editor/index.d.ts.map +1 -1
- package/dist/src/components/code-editor/index.js +161 -20
- package/dist/src/components/code-editor/index.js.map +1 -1
- package/dist/src/components/code-editor.stories.js +3 -1
- package/dist/src/components/code-editor.stories.js.map +1 -1
- package/dist/src/components/request-line-editor.d.ts +11 -35
- package/dist/src/components/request-line-editor.d.ts.map +1 -1
- package/dist/src/components/request-line-editor.js +51 -49
- package/dist/src/components/request-line-editor.js.map +1 -1
- package/dist/src/components/request-line-editor.stories.d.ts.map +1 -1
- package/dist/src/components/request-line-editor.stories.js +17 -53
- package/dist/src/components/request-line-editor.stories.js.map +1 -1
- package/dist/src/components/tree-view.d.ts +16 -0
- package/dist/src/components/tree-view.d.ts.map +1 -0
- package/dist/src/components/tree-view.js +67 -0
- package/dist/src/components/tree-view.js.map +1 -0
- package/dist/src/components/tree-view.stories.d.ts +13 -0
- package/dist/src/components/tree-view.stories.d.ts.map +1 -0
- package/dist/src/components/tree-view.stories.js +274 -0
- package/dist/src/components/tree-view.stories.js.map +1 -0
- package/dist/src/icons.d.ts +3 -0
- package/dist/src/icons.d.ts.map +1 -0
- package/dist/src/icons.js +47 -0
- package/dist/src/icons.js.map +1 -0
- package/dist/src/index.css +42 -3
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.js +23 -5
- package/dist/src/shadcn/components/ui/accordion.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert.js +12 -5
- package/dist/src/shadcn/components/ui/alert.js.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.js +4 -3
- package/dist/src/shadcn/components/ui/avatar.js.map +1 -1
- package/dist/src/shadcn/components/ui/badge.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/badge.js +16 -5
- package/dist/src/shadcn/components/ui/badge.js.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.js +6 -6
- package/dist/src/shadcn/components/ui/breadcrumb.js.map +1 -1
- package/dist/src/shadcn/components/ui/button.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/button.js +19 -11
- package/dist/src/shadcn/components/ui/button.js.map +1 -1
- package/dist/src/shadcn/components/ui/card.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/card.js +14 -6
- package/dist/src/shadcn/components/ui/card.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.js +20 -5
- package/dist/src/shadcn/components/ui/checkbox.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.js +44 -35
- package/dist/src/shadcn/components/ui/checkbox.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/combobox.d.ts +18 -0
- package/dist/src/shadcn/components/ui/combobox.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.js +121 -0
- package/dist/src/shadcn/components/ui/combobox.js.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.stories.d.ts +11 -0
- package/dist/src/shadcn/components/ui/combobox.stories.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js +16 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js.map +1 -0
- package/dist/src/shadcn/components/ui/command.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/command.js +73 -12
- package/dist/src/shadcn/components/ui/command.js.map +1 -1
- package/dist/src/shadcn/components/ui/command.stories.js +0 -1
- package/dist/src/shadcn/components/ui/command.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.js +35 -7
- package/dist/src/shadcn/components/ui/dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.js +26 -5
- package/dist/src/shadcn/components/ui/drawer.js.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.js +12 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.js.map +1 -1
- package/dist/src/shadcn/components/ui/form.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/form.js +12 -4
- package/dist/src/shadcn/components/ui/form.js.map +1 -1
- package/dist/src/shadcn/components/ui/input.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/input.js +87 -16
- package/dist/src/shadcn/components/ui/input.js.map +1 -1
- package/dist/src/shadcn/components/ui/label.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/label.js +8 -1
- package/dist/src/shadcn/components/ui/label.js.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.js +35 -13
- package/dist/src/shadcn/components/ui/menubar.js.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.js +6 -6
- package/dist/src/shadcn/components/ui/pagination.js.map +1 -1
- package/dist/src/shadcn/components/ui/popover.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/popover.js +12 -1
- package/dist/src/shadcn/components/ui/popover.js.map +1 -1
- package/dist/src/shadcn/components/ui/progress.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/progress.js +6 -2
- package/dist/src/shadcn/components/ui/progress.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.js +11 -6
- package/dist/src/shadcn/components/ui/radio-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.js +57 -34
- package/dist/src/shadcn/components/ui/radio-group.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.js +9 -3
- package/dist/src/shadcn/components/ui/scroll-area.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/select.js +49 -14
- package/dist/src/shadcn/components/ui/select.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/select.stories.js +1 -4
- package/dist/src/shadcn/components/ui/select.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/separator.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/separator.js +7 -1
- package/dist/src/shadcn/components/ui/separator.js.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.js +20 -6
- package/dist/src/shadcn/components/ui/sidebar.js.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.js +3 -1
- package/dist/src/shadcn/components/ui/skeleton.js.map +1 -1
- package/dist/src/shadcn/components/ui/slider.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/slider.js +34 -4
- package/dist/src/shadcn/components/ui/slider.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.d.ts +16 -1
- package/dist/src/shadcn/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.js +23 -3
- package/dist/src/shadcn/components/ui/sonner.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.stories.js +19 -11
- package/dist/src/shadcn/components/ui/sonner.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/switch.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/switch.js +18 -2
- package/dist/src/shadcn/components/ui/switch.js.map +1 -1
- package/dist/src/shadcn/components/ui/table.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/table.js +12 -8
- package/dist/src/shadcn/components/ui/table.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.d.ts +21 -3
- package/dist/src/shadcn/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.js +314 -9
- package/dist/src/shadcn/components/ui/tabs.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.stories.js +50 -1
- package/dist/src/shadcn/components/ui/tabs.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.js +15 -1
- package/dist/src/shadcn/components/ui/textarea.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.js +6 -2
- package/dist/src/shadcn/components/ui/toggle-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.js +18 -6
- package/dist/src/shadcn/components/ui/toggle.js.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.js +11 -1
- package/dist/src/shadcn/components/ui/tooltip.js.map +1 -1
- package/dist/src/shadcn/components/ui/tree.d.ts +20 -0
- package/dist/src/shadcn/components/ui/tree.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/tree.js +111 -0
- package/dist/src/shadcn/components/ui/tree.js.map +1 -0
- package/package.json +9 -2
- package/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/src/components/code-editor/http/grammar/http.terms.ts +9 -0
- package/src/components/code-editor/http/grammar/http.test.ts +110 -0
- package/src/components/code-editor/http/grammar/http.ts +21 -0
- package/src/components/code-editor/http/index.ts +87 -0
- package/src/components/code-editor/index.tsx +182 -21
- package/src/components/code-editor.stories.tsx +1 -1
- package/src/components/request-line-editor.stories.tsx +17 -27
- package/src/components/request-line-editor.tsx +72 -61
- package/src/components/tree-view.stories.tsx +260 -0
- package/src/components/tree-view.tsx +101 -0
- package/src/icons.tsx +45 -0
- package/src/index.css +42 -3
- package/src/index.tsx +1 -1
- package/src/shadcn/components/ui/accordion.tsx +66 -8
- package/src/shadcn/components/ui/alert.tsx +53 -15
- package/src/shadcn/components/ui/avatar.tsx +17 -6
- package/src/shadcn/components/ui/badge.tsx +67 -18
- package/src/shadcn/components/ui/breadcrumb.tsx +35 -7
- package/src/shadcn/components/ui/button.tsx +118 -57
- package/src/shadcn/components/ui/card.tsx +44 -13
- package/src/shadcn/components/ui/checkbox.stories.tsx +20 -24
- package/src/shadcn/components/ui/checkbox.tsx +45 -4
- package/src/shadcn/components/ui/combobox.stories.tsx +19 -0
- package/src/shadcn/components/ui/combobox.tsx +142 -0
- package/src/shadcn/components/ui/command.stories.tsx +1 -1
- package/src/shadcn/components/ui/command.tsx +192 -36
- package/src/shadcn/components/ui/dialog.tsx +101 -13
- package/src/shadcn/components/ui/drawer.tsx +93 -18
- package/src/shadcn/components/ui/dropdown-menu.tsx +38 -9
- package/src/shadcn/components/ui/form.tsx +16 -4
- package/src/shadcn/components/ui/input.tsx +281 -29
- package/src/shadcn/components/ui/label.tsx +21 -4
- package/src/shadcn/components/ui/menubar.tsx +188 -43
- package/src/shadcn/components/ui/pagination.tsx +12 -6
- package/src/shadcn/components/ui/popover.tsx +35 -4
- package/src/shadcn/components/ui/progress.tsx +21 -5
- package/src/shadcn/components/ui/radio-group.stories.tsx +22 -14
- package/src/shadcn/components/ui/radio-group.tsx +42 -5
- package/src/shadcn/components/ui/scroll-area.tsx +33 -5
- package/src/shadcn/components/ui/select.stories.tsx +0 -2
- package/src/shadcn/components/ui/select.tsx +184 -33
- package/src/shadcn/components/ui/separator.tsx +15 -5
- package/src/shadcn/components/ui/sidebar.tsx +68 -26
- package/src/shadcn/components/ui/skeleton.tsx +4 -1
- package/src/shadcn/components/ui/slider.tsx +82 -11
- package/src/shadcn/components/ui/sonner.stories.tsx +19 -15
- package/src/shadcn/components/ui/sonner.tsx +53 -3
- package/src/shadcn/components/ui/switch.tsx +53 -7
- package/src/shadcn/components/ui/table.tsx +38 -11
- package/src/shadcn/components/ui/tabs.stories.tsx +32 -0
- package/src/shadcn/components/ui/tabs.tsx +455 -17
- package/src/shadcn/components/ui/textarea.tsx +42 -4
- package/src/shadcn/components/ui/toggle-group.tsx +27 -5
- package/src/shadcn/components/ui/toggle.tsx +59 -18
- package/src/shadcn/components/ui/tooltip.tsx +33 -8
- package/src/shadcn/components/ui/tree.tsx +200 -0
|
@@ -477,35 +477,77 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
|
477
477
|
);
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
480
|
+
// Base sidebar menu button styles
|
|
481
|
+
const baseSidebarMenuButtonStyles = cn(
|
|
482
|
+
// Layout
|
|
483
|
+
"flex",
|
|
484
|
+
"items-center",
|
|
485
|
+
"gap-2",
|
|
486
|
+
"w-full",
|
|
487
|
+
"overflow-hidden",
|
|
488
|
+
// Shape
|
|
489
|
+
"rounded-lg",
|
|
490
|
+
// Spacing
|
|
491
|
+
"py-2",
|
|
492
|
+
"px-[0.44rem]",
|
|
493
|
+
// Typography
|
|
494
|
+
"typo-body",
|
|
495
|
+
"text-text-secondary",
|
|
496
|
+
// Interaction
|
|
497
|
+
"outline-hidden",
|
|
498
|
+
"transition-all",
|
|
499
|
+
"cursor-pointer",
|
|
500
|
+
// Focus
|
|
501
|
+
"focus-visible:ring-2",
|
|
502
|
+
"focus-visible:ring-utility-blue/70",
|
|
503
|
+
// Hover
|
|
504
|
+
"hover:bg-bg-secondary",
|
|
505
|
+
"hover:text-text-primary",
|
|
506
|
+
// Active
|
|
507
|
+
"active:bg-bg-quaternary",
|
|
508
|
+
"data-[active=true]:bg-bg-brand-secondary",
|
|
509
|
+
"data-[active=true]:text-text-primary",
|
|
510
|
+
"data-[active=true]:[&>svg]:text-text-brand-primary",
|
|
511
|
+
// Open state
|
|
512
|
+
"data-[state=open]:hover:bg-bg-secondary",
|
|
513
|
+
"data-[state=open]:hover:text-text-primary",
|
|
514
|
+
// Disabled
|
|
515
|
+
"disabled:pointer-events-none",
|
|
516
|
+
"disabled:opacity-50",
|
|
517
|
+
"aria-disabled:pointer-events-none",
|
|
518
|
+
"aria-disabled:opacity-50",
|
|
519
|
+
// Group styles
|
|
520
|
+
"group-has-data-[sidebar=menu-action]/menu-item:pr-8",
|
|
521
|
+
"group-data-[collapsible=icon]:py-2!",
|
|
522
|
+
"group-data-[collapsible=icon]:px-[0.44rem]!",
|
|
523
|
+
// Content styles
|
|
524
|
+
"[&>span:last-child]:truncate",
|
|
525
|
+
"[&>svg]:size-5",
|
|
526
|
+
"[&>svg]:shrink-0",
|
|
527
|
+
);
|
|
528
|
+
|
|
529
|
+
const sidebarMenuButtonVariants = cva(baseSidebarMenuButtonStyles, {
|
|
530
|
+
variants: {
|
|
531
|
+
variant: {
|
|
532
|
+
default: cn(""),
|
|
533
|
+
outline: cn(
|
|
534
|
+
"shadow-[0_0_0_1px_hsl(var(--sidebar-border))]",
|
|
535
|
+
"hover:bg-bg-secondary",
|
|
536
|
+
"hover:text-text-primary",
|
|
537
|
+
"hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
|
|
538
|
+
),
|
|
502
539
|
},
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
540
|
+
size: {
|
|
541
|
+
default: cn(""),
|
|
542
|
+
sm: cn(""),
|
|
543
|
+
lg: cn("h-12", "text-sm", "group-data-[collapsible=icon]:p-0!"),
|
|
506
544
|
},
|
|
507
545
|
},
|
|
508
|
-
|
|
546
|
+
defaultVariants: {
|
|
547
|
+
variant: "default",
|
|
548
|
+
size: "default",
|
|
549
|
+
},
|
|
550
|
+
});
|
|
509
551
|
|
|
510
552
|
function SidebarMenuButton({
|
|
511
553
|
asChild = false,
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { cn } from "#shadcn/lib/utils";
|
|
2
2
|
|
|
3
|
+
// Skeleton styles
|
|
4
|
+
const skeletonStyles = cn("bg-bg-tertiary", "animate-pulse", "rounded-md");
|
|
5
|
+
|
|
3
6
|
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
4
7
|
return (
|
|
5
8
|
<div
|
|
6
9
|
data-slot="skeleton"
|
|
7
|
-
className={cn(
|
|
10
|
+
className={cn(skeletonStyles, className)}
|
|
8
11
|
{...props}
|
|
9
12
|
/>
|
|
10
13
|
);
|
|
@@ -4,6 +4,84 @@ import * as React from "react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "#shadcn/lib/utils";
|
|
6
6
|
|
|
7
|
+
// Slider root styles
|
|
8
|
+
const sliderRootStyles = cn(
|
|
9
|
+
// Layout
|
|
10
|
+
"relative",
|
|
11
|
+
"flex",
|
|
12
|
+
"w-full",
|
|
13
|
+
"items-center",
|
|
14
|
+
// Interaction
|
|
15
|
+
"touch-none",
|
|
16
|
+
"select-none",
|
|
17
|
+
// Disabled
|
|
18
|
+
"data-[disabled]:opacity-50",
|
|
19
|
+
// Vertical orientation
|
|
20
|
+
"data-[orientation=vertical]:h-full",
|
|
21
|
+
"data-[orientation=vertical]:min-h-44",
|
|
22
|
+
"data-[orientation=vertical]:w-auto",
|
|
23
|
+
"data-[orientation=vertical]:flex-col",
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Slider track styles
|
|
27
|
+
const sliderTrackStyles = cn(
|
|
28
|
+
// Background
|
|
29
|
+
"bg-bg-quaternary",
|
|
30
|
+
// Layout
|
|
31
|
+
"relative",
|
|
32
|
+
"grow",
|
|
33
|
+
"overflow-hidden",
|
|
34
|
+
// Shape
|
|
35
|
+
"rounded-full",
|
|
36
|
+
// Horizontal orientation
|
|
37
|
+
"data-[orientation=horizontal]:h-1.5",
|
|
38
|
+
"data-[orientation=horizontal]:w-full",
|
|
39
|
+
// Vertical orientation
|
|
40
|
+
"data-[orientation=vertical]:h-full",
|
|
41
|
+
"data-[orientation=vertical]:w-1.5",
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// Slider range styles
|
|
45
|
+
const sliderRangeStyles = cn(
|
|
46
|
+
// Background
|
|
47
|
+
"bg-bg-link",
|
|
48
|
+
// Layout
|
|
49
|
+
"absolute",
|
|
50
|
+
// Horizontal orientation
|
|
51
|
+
"data-[orientation=horizontal]:h-full",
|
|
52
|
+
// Vertical orientation
|
|
53
|
+
"data-[orientation=vertical]:w-full",
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Slider thumb styles
|
|
57
|
+
const sliderThumbStyles = cn(
|
|
58
|
+
// Layout
|
|
59
|
+
"block",
|
|
60
|
+
"size-4",
|
|
61
|
+
"shrink-0",
|
|
62
|
+
// Shape
|
|
63
|
+
"rounded-full",
|
|
64
|
+
// Borders
|
|
65
|
+
"border",
|
|
66
|
+
"border-border-link",
|
|
67
|
+
// Background
|
|
68
|
+
"bg-bg-primary",
|
|
69
|
+
// Shadow
|
|
70
|
+
"shadow-sm",
|
|
71
|
+
// Transitions
|
|
72
|
+
"transition-[color,box-shadow]",
|
|
73
|
+
// Hover
|
|
74
|
+
"hover:ring-4",
|
|
75
|
+
"hover:ring-utility-blue/70",
|
|
76
|
+
// Focus
|
|
77
|
+
"focus-visible:ring-4",
|
|
78
|
+
"focus-visible:ring-utility-blue/70",
|
|
79
|
+
"focus-visible:outline-hidden",
|
|
80
|
+
// Disabled
|
|
81
|
+
"disabled:pointer-events-none",
|
|
82
|
+
"disabled:opacity-50",
|
|
83
|
+
);
|
|
84
|
+
|
|
7
85
|
function Slider({
|
|
8
86
|
className,
|
|
9
87
|
defaultValue,
|
|
@@ -29,23 +107,16 @@ function Slider({
|
|
|
29
107
|
{...(value !== undefined ? { value } : {})}
|
|
30
108
|
min={min}
|
|
31
109
|
max={max}
|
|
32
|
-
className={cn(
|
|
33
|
-
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
34
|
-
className,
|
|
35
|
-
)}
|
|
110
|
+
className={cn(sliderRootStyles, className)}
|
|
36
111
|
{...props}
|
|
37
112
|
>
|
|
38
113
|
<SliderPrimitive.Track
|
|
39
114
|
data-slot="slider-track"
|
|
40
|
-
className={
|
|
41
|
-
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5",
|
|
42
|
-
)}
|
|
115
|
+
className={sliderTrackStyles}
|
|
43
116
|
>
|
|
44
117
|
<SliderPrimitive.Range
|
|
45
118
|
data-slot="slider-range"
|
|
46
|
-
className={
|
|
47
|
-
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full",
|
|
48
|
-
)}
|
|
119
|
+
className={sliderRangeStyles}
|
|
49
120
|
/>
|
|
50
121
|
</SliderPrimitive.Track>
|
|
51
122
|
{Array.from({ length: _values.length }, (_, index) => (
|
|
@@ -53,7 +124,7 @@ function Slider({
|
|
|
53
124
|
data-slot="slider-thumb"
|
|
54
125
|
// biome-ignore lint/suspicious/noArrayIndexKey: FIXME: unchanged shadcn
|
|
55
126
|
key={index}
|
|
56
|
-
className=
|
|
127
|
+
className={sliderThumbStyles}
|
|
57
128
|
/>
|
|
58
129
|
))}
|
|
59
130
|
</SliderPrimitive.Root>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { toast } from "sonner";
|
|
3
2
|
import { Button } from "#shadcn/components/ui/button";
|
|
3
|
+
import { Toaster, toast } from "#shadcn/components/ui/sonner";
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
6
|
title: "Component/Sonner",
|
|
@@ -11,19 +11,23 @@ type Story = StoryObj<typeof meta>;
|
|
|
11
11
|
|
|
12
12
|
export const Demo = {
|
|
13
13
|
render: () => (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
<div>
|
|
15
|
+
<Button
|
|
16
|
+
variant="secondary"
|
|
17
|
+
onClick={() =>
|
|
18
|
+
toast("Event has been created", {
|
|
19
|
+
description: "Sunday, December 03, 2023 at 9:00 AM",
|
|
20
|
+
action: {
|
|
21
|
+
label: "Undo",
|
|
22
|
+
variant: "primary",
|
|
23
|
+
onClick: () => console.log("Undo"),
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
>
|
|
28
|
+
Show Toast
|
|
29
|
+
</Button>
|
|
30
|
+
<Toaster position="top-center" />
|
|
31
|
+
</div>
|
|
28
32
|
),
|
|
29
33
|
} satisfies Story;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { VariantProps } from "class-variance-authority";
|
|
1
4
|
import { useTheme } from "next-themes";
|
|
2
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Toaster as Sonner,
|
|
7
|
+
toast as sonnerToast,
|
|
8
|
+
type ToasterProps,
|
|
9
|
+
} from "sonner";
|
|
10
|
+
import { Button, type buttonVariants } from "./button";
|
|
3
11
|
|
|
4
12
|
const Toaster = ({ ...props }: ToasterProps) => {
|
|
5
13
|
const { theme = "system" } = useTheme();
|
|
6
14
|
|
|
7
15
|
return (
|
|
8
16
|
<Sonner
|
|
9
|
-
theme={
|
|
17
|
+
theme={
|
|
18
|
+
theme === "system" ? "system" : theme === "dark" ? "dark" : "light"
|
|
19
|
+
}
|
|
10
20
|
className="toaster group"
|
|
11
21
|
style={
|
|
12
22
|
{
|
|
@@ -20,4 +30,44 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
|
|
20
30
|
);
|
|
21
31
|
};
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
// Custom toast wrapper with our buttons
|
|
34
|
+
const toast = (
|
|
35
|
+
message: string,
|
|
36
|
+
options?: {
|
|
37
|
+
description?: string;
|
|
38
|
+
action?: {
|
|
39
|
+
label: string;
|
|
40
|
+
onClick: () => void;
|
|
41
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
42
|
+
};
|
|
43
|
+
cancel?: {
|
|
44
|
+
label: string;
|
|
45
|
+
onClick: () => void;
|
|
46
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
) => {
|
|
50
|
+
return sonnerToast(message, {
|
|
51
|
+
...options,
|
|
52
|
+
action: options?.action ? (
|
|
53
|
+
<Button
|
|
54
|
+
variant={options.action.variant || "secondary"}
|
|
55
|
+
size="small"
|
|
56
|
+
onClick={options.action.onClick}
|
|
57
|
+
>
|
|
58
|
+
{options.action.label}
|
|
59
|
+
</Button>
|
|
60
|
+
) : undefined,
|
|
61
|
+
cancel: options?.cancel ? (
|
|
62
|
+
<Button
|
|
63
|
+
variant={options.cancel.variant || "ghost"}
|
|
64
|
+
size="small"
|
|
65
|
+
onClick={options.cancel.onClick}
|
|
66
|
+
>
|
|
67
|
+
{options.cancel.label}
|
|
68
|
+
</Button>
|
|
69
|
+
) : undefined,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { Toaster, toast };
|
|
@@ -4,6 +4,57 @@ import type * as React from "react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "#shadcn/lib/utils";
|
|
6
6
|
|
|
7
|
+
// Switch root styles
|
|
8
|
+
const switchRootStyles = cn(
|
|
9
|
+
// Layout
|
|
10
|
+
"peer",
|
|
11
|
+
"inline-flex",
|
|
12
|
+
"items-center",
|
|
13
|
+
"shrink-0",
|
|
14
|
+
// Size
|
|
15
|
+
"h-[1.15rem]",
|
|
16
|
+
"w-8",
|
|
17
|
+
// Shape
|
|
18
|
+
"rounded-full",
|
|
19
|
+
"border",
|
|
20
|
+
"border-transparent",
|
|
21
|
+
// Interaction
|
|
22
|
+
"transition-all",
|
|
23
|
+
"outline-none",
|
|
24
|
+
"cursor-pointer",
|
|
25
|
+
// States
|
|
26
|
+
"data-[state=unchecked]:bg-bg-quaternary",
|
|
27
|
+
"data-[state=checked]:bg-bg-link",
|
|
28
|
+
"hover:data-[state=unchecked]:bg-bg-tertiary",
|
|
29
|
+
"hover:data-[state=checked]:bg-bg-link_hover",
|
|
30
|
+
// Focus
|
|
31
|
+
"focus-visible:ring-2",
|
|
32
|
+
"focus-visible:ring-utility-blue/70",
|
|
33
|
+
// Disabled
|
|
34
|
+
"disabled:cursor-not-allowed",
|
|
35
|
+
"disabled:opacity-50",
|
|
36
|
+
"disabled:data-[state=checked]:bg-bg-disabled",
|
|
37
|
+
"disabled:data-[state=unchecked]:bg-bg-disabled",
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// Switch thumb styles
|
|
41
|
+
const switchThumbStyles = cn(
|
|
42
|
+
// Layout
|
|
43
|
+
"pointer-events-none",
|
|
44
|
+
"block",
|
|
45
|
+
// Size
|
|
46
|
+
"size-4",
|
|
47
|
+
// Shape
|
|
48
|
+
"rounded-full",
|
|
49
|
+
"ring-0",
|
|
50
|
+
// Color
|
|
51
|
+
"bg-bg-primary",
|
|
52
|
+
// Animation
|
|
53
|
+
"transition-transform",
|
|
54
|
+
"data-[state=checked]:translate-x-[calc(100%-2px)]",
|
|
55
|
+
"data-[state=unchecked]:translate-x-0",
|
|
56
|
+
);
|
|
57
|
+
|
|
7
58
|
function Switch({
|
|
8
59
|
className,
|
|
9
60
|
...props
|
|
@@ -11,17 +62,12 @@ function Switch({
|
|
|
11
62
|
return (
|
|
12
63
|
<SwitchPrimitive.Root
|
|
13
64
|
data-slot="switch"
|
|
14
|
-
className={cn(
|
|
15
|
-
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
-
className,
|
|
17
|
-
)}
|
|
65
|
+
className={cn(switchRootStyles, className)}
|
|
18
66
|
{...props}
|
|
19
67
|
>
|
|
20
68
|
<SwitchPrimitive.Thumb
|
|
21
69
|
data-slot="switch-thumb"
|
|
22
|
-
className={
|
|
23
|
-
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0",
|
|
24
|
-
)}
|
|
70
|
+
className={switchThumbStyles}
|
|
25
71
|
/>
|
|
26
72
|
</SwitchPrimitive.Root>
|
|
27
73
|
);
|
|
@@ -2,15 +2,18 @@ import type * as React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "#shadcn/lib/utils";
|
|
4
4
|
|
|
5
|
+
// Table container styles
|
|
6
|
+
const tableContainerStyles = cn("relative", "w-full", "overflow-x-auto");
|
|
7
|
+
|
|
8
|
+
// Table styles
|
|
9
|
+
const tableStyles = cn("w-full", "caption-bottom", "text-sm");
|
|
10
|
+
|
|
5
11
|
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
|
6
12
|
return (
|
|
7
|
-
<div
|
|
8
|
-
data-slot="table-container"
|
|
9
|
-
className="relative w-full overflow-x-auto"
|
|
10
|
-
>
|
|
13
|
+
<div data-slot="table-container" className={tableContainerStyles}>
|
|
11
14
|
<table
|
|
12
15
|
data-slot="table"
|
|
13
|
-
className={cn(
|
|
16
|
+
className={cn(tableStyles, className)}
|
|
14
17
|
{...props}
|
|
15
18
|
/>
|
|
16
19
|
</div>
|
|
@@ -21,7 +24,11 @@ function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
|
|
21
24
|
return (
|
|
22
25
|
<thead
|
|
23
26
|
data-slot="table-header"
|
|
24
|
-
className={cn(
|
|
27
|
+
className={cn(
|
|
28
|
+
"[&_tr]:border-b",
|
|
29
|
+
"[&_tr]:border-border-primary",
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
25
32
|
{...props}
|
|
26
33
|
/>
|
|
27
34
|
);
|
|
@@ -42,7 +49,11 @@ function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
|
|
42
49
|
<tfoot
|
|
43
50
|
data-slot="table-footer"
|
|
44
51
|
className={cn(
|
|
45
|
-
"bg-
|
|
52
|
+
"bg-bg-tertiary/50",
|
|
53
|
+
"border-t",
|
|
54
|
+
"border-border-primary",
|
|
55
|
+
"font-medium",
|
|
56
|
+
"[&>tr]:last:border-b-0",
|
|
46
57
|
className,
|
|
47
58
|
)}
|
|
48
59
|
{...props}
|
|
@@ -55,7 +66,11 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
|
|
55
66
|
<tr
|
|
56
67
|
data-slot="table-row"
|
|
57
68
|
className={cn(
|
|
58
|
-
"hover:bg-
|
|
69
|
+
"hover:bg-bg-tertiary/50",
|
|
70
|
+
"data-[state=selected]:bg-bg-tertiary",
|
|
71
|
+
"border-b",
|
|
72
|
+
"border-border-primary",
|
|
73
|
+
"transition-colors",
|
|
59
74
|
className,
|
|
60
75
|
)}
|
|
61
76
|
{...props}
|
|
@@ -68,7 +83,15 @@ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
|
|
68
83
|
<th
|
|
69
84
|
data-slot="table-head"
|
|
70
85
|
className={cn(
|
|
71
|
-
"text-
|
|
86
|
+
"text-text-primary",
|
|
87
|
+
"h-10",
|
|
88
|
+
"px-2",
|
|
89
|
+
"text-left",
|
|
90
|
+
"align-middle",
|
|
91
|
+
"font-medium",
|
|
92
|
+
"whitespace-nowrap",
|
|
93
|
+
"[&:has([role=checkbox])]:pr-0",
|
|
94
|
+
"[&>[role=checkbox]]:translate-y-[2px]",
|
|
72
95
|
className,
|
|
73
96
|
)}
|
|
74
97
|
{...props}
|
|
@@ -81,7 +104,11 @@ function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
|
|
81
104
|
<td
|
|
82
105
|
data-slot="table-cell"
|
|
83
106
|
className={cn(
|
|
84
|
-
"p-2
|
|
107
|
+
"p-2",
|
|
108
|
+
"align-middle",
|
|
109
|
+
"whitespace-nowrap",
|
|
110
|
+
"[&:has([role=checkbox])]:pr-0",
|
|
111
|
+
"[&>[role=checkbox]]:translate-y-[2px]",
|
|
85
112
|
className,
|
|
86
113
|
)}
|
|
87
114
|
{...props}
|
|
@@ -96,7 +123,7 @@ function TableCaption({
|
|
|
96
123
|
return (
|
|
97
124
|
<caption
|
|
98
125
|
data-slot="table-caption"
|
|
99
|
-
className={cn("text-
|
|
126
|
+
className={cn("text-text-secondary", "mt-4", "text-sm", className)}
|
|
100
127
|
{...props}
|
|
101
128
|
/>
|
|
102
129
|
);
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
TabsAddButton,
|
|
17
17
|
TabsContent,
|
|
18
18
|
TabsList,
|
|
19
|
+
TabsListDropdown,
|
|
19
20
|
TabsTrigger,
|
|
20
21
|
} from "#shadcn/components/ui/tabs";
|
|
21
22
|
|
|
@@ -144,6 +145,37 @@ export const Browser = {
|
|
|
144
145
|
</TabsTrigger>
|
|
145
146
|
</TabsList>
|
|
146
147
|
<TabsAddButton onClick={BrowserTabOnAdd} />
|
|
148
|
+
<TabsListDropdown
|
|
149
|
+
tabs={[
|
|
150
|
+
{
|
|
151
|
+
id: "first",
|
|
152
|
+
content: (
|
|
153
|
+
<span className="flex items-center gap-1">
|
|
154
|
+
<span className="text-utility-green">GET</span>
|
|
155
|
+
<span>/fhir/Patient</span>
|
|
156
|
+
</span>
|
|
157
|
+
),
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "second",
|
|
161
|
+
content: (
|
|
162
|
+
<span className="flex items-center gap-1">
|
|
163
|
+
<span className="text-utility-yellow">POST</span>
|
|
164
|
+
<span>/fhir</span>
|
|
165
|
+
</span>
|
|
166
|
+
),
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "third",
|
|
170
|
+
content: (
|
|
171
|
+
<span className="flex items-center gap-1">
|
|
172
|
+
<span className="text-utility-yellow">POST</span>
|
|
173
|
+
<span>/$graphql</span>
|
|
174
|
+
</span>
|
|
175
|
+
),
|
|
176
|
+
},
|
|
177
|
+
]}
|
|
178
|
+
/>
|
|
147
179
|
</Tabs>
|
|
148
180
|
),
|
|
149
181
|
} satisfies Story;
|