sh-ui-cli 0.42.1 → 0.44.0

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.
Files changed (53) hide show
  1. package/README.md +6 -1
  2. package/data/changelog/versions.json +25 -0
  3. package/data/registry/flutter/registry.json +1 -1
  4. package/data/registry/react/components/accordion/index.tailwind.tsx +88 -0
  5. package/data/registry/react/components/avatar/index.tailwind.tsx +74 -0
  6. package/data/registry/react/components/badge/index.tailwind.tsx +47 -0
  7. package/data/registry/react/components/breadcrumb/index.tailwind.tsx +138 -0
  8. package/data/registry/react/components/button/index.tailwind.tsx +70 -0
  9. package/data/registry/react/components/card/index.tailwind.tsx +111 -0
  10. package/data/registry/react/components/checkbox/index.tailwind.tsx +72 -0
  11. package/data/registry/react/components/code-panel/index.tailwind.tsx +107 -0
  12. package/data/registry/react/components/combobox/index.tailwind.tsx +160 -0
  13. package/data/registry/react/components/context-menu/index.tailwind.tsx +170 -0
  14. package/data/registry/react/components/date-picker/index.tailwind.tsx +294 -0
  15. package/data/registry/react/components/dialog/index.tailwind.tsx +96 -0
  16. package/data/registry/react/components/dropdown-menu/index.tailwind.tsx +205 -0
  17. package/data/registry/react/components/input/index.tailwind.tsx +405 -0
  18. package/data/registry/react/components/label/index.tailwind.tsx +78 -0
  19. package/data/registry/react/components/menubar/index.tailwind.tsx +32 -0
  20. package/data/registry/react/components/numeric-input/index.tailwind.tsx +113 -0
  21. package/data/registry/react/components/page-toc/index.tailwind.tsx +149 -0
  22. package/data/registry/react/components/pagination/index.tailwind.tsx +148 -0
  23. package/data/registry/react/components/popover/index.tailwind.tsx +77 -0
  24. package/data/registry/react/components/progress/index.tailwind.tsx +60 -0
  25. package/data/registry/react/components/radio/index.tailwind.tsx +54 -0
  26. package/data/registry/react/components/select/index.tailwind.tsx +199 -0
  27. package/data/registry/react/components/separator/index.tailwind.tsx +42 -0
  28. package/data/registry/react/components/skeleton/index.tailwind.tsx +39 -0
  29. package/data/registry/react/components/slider/index.tailwind.tsx +255 -0
  30. package/data/registry/react/components/spinner/index.tailwind.tsx +63 -0
  31. package/data/registry/react/components/switch/index.tailwind.tsx +62 -0
  32. package/data/registry/react/components/tabs/index.tailwind.tsx +113 -0
  33. package/data/registry/react/components/textarea/index.tailwind.tsx +21 -0
  34. package/data/registry/react/components/toggle/index.tailwind.tsx +111 -0
  35. package/data/registry/react/components/tooltip/index.tailwind.tsx +55 -0
  36. package/data/registry/react/peer-versions.json +1 -0
  37. package/data/registry/react/registry.json +530 -72
  38. package/data/tokens/build.mjs +66 -0
  39. package/package.json +1 -1
  40. package/src/add.mjs +54 -6
  41. package/src/api.d.ts +14 -0
  42. package/src/api.js +4 -0
  43. package/src/constants.js +19 -0
  44. package/src/create/cli-args.js +18 -2
  45. package/src/create/generator.js +55 -6
  46. package/src/create/index.mjs +3 -1
  47. package/src/init.mjs +25 -7
  48. package/src/mcp.mjs +13 -2
  49. package/templates/flutter-standalone/sh-ui.config.json +1 -1
  50. package/templates/nextjs-standalone/app/globals.css +1 -21
  51. package/templates/nextjs-standalone/sh-ui.config.json +1 -1
  52. package/templates/ui-app-template/sh-ui.config.json +1 -1
  53. package/templates/ui-app-template/src/styles/globals.css +1 -21
@@ -0,0 +1,111 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { Toggle as BaseToggle } from "@base-ui/react/toggle";
5
+ import { ToggleGroup as BaseToggleGroup } from "@base-ui/react/toggle-group";
6
+ import { cva, type VariantProps } from "class-variance-authority";
7
+
8
+ function cx(...args: (string | undefined | false)[]) {
9
+ return args.filter(Boolean).join(" ");
10
+ }
11
+
12
+ const toggleVariants = cva(
13
+ "inline-flex items-center justify-center gap-1.5 border border-transparent rounded-[var(--radius)] font-medium leading-none cursor-pointer text-foreground-muted bg-transparent transition-[background-color,color,border-color] duration-[var(--duration-fast)] select-none focus-visible:outline-[length:var(--border-width-strong)] focus-visible:outline-foreground focus-visible:outline-offset-2 disabled:opacity-[var(--opacity-disabled)] disabled:pointer-events-none data-[pressed]:bg-background-muted data-[pressed]:text-foreground motion-reduce:transition-none",
14
+ {
15
+ variants: {
16
+ variant: {
17
+ outline:
18
+ "border-border hover:not-disabled:not-data-[pressed]:bg-background-muted hover:not-disabled:not-data-[pressed]:text-foreground data-[pressed]:border-border-strong",
19
+ ghost:
20
+ "hover:not-disabled:not-data-[pressed]:bg-background-muted hover:not-disabled:not-data-[pressed]:text-foreground",
21
+ },
22
+ size: {
23
+ sm: "h-[var(--control-sm)] px-2.5 text-[length:var(--text-sm)] [@media(hover:none)_and_(pointer:coarse)]:h-9",
24
+ md: "h-[var(--control-md)] px-[var(--space-3)] text-[length:var(--text-sm)] [@media(hover:none)_and_(pointer:coarse)]:h-11",
25
+ lg: "h-[var(--control-lg)] px-[var(--space-4)] text-[length:var(--text-base)]",
26
+ },
27
+ },
28
+ defaultVariants: { variant: "ghost", size: "md" },
29
+ },
30
+ );
31
+
32
+ export type ToggleVariant = NonNullable<VariantProps<typeof toggleVariants>["variant"]>;
33
+ export type ToggleSize = NonNullable<VariantProps<typeof toggleVariants>["size"]>;
34
+
35
+ export type ToggleProps = Omit<
36
+ React.ComponentPropsWithoutRef<typeof BaseToggle>,
37
+ "className"
38
+ > & {
39
+ className?: string;
40
+ variant?: ToggleVariant;
41
+ size?: ToggleSize;
42
+ };
43
+
44
+ export const Toggle = React.forwardRef<HTMLButtonElement, ToggleProps>(
45
+ ({ className, variant = "ghost", size = "md", ...props }, ref) => (
46
+ <BaseToggle
47
+ ref={ref}
48
+ className={cx(toggleVariants({ variant, size }), className)}
49
+ {...props}
50
+ />
51
+ ),
52
+ );
53
+ Toggle.displayName = "Toggle";
54
+
55
+ export type ToggleGroupProps = Omit<
56
+ React.ComponentPropsWithoutRef<typeof BaseToggleGroup>,
57
+ "className"
58
+ > & {
59
+ className?: string;
60
+ variant?: ToggleVariant;
61
+ size?: ToggleSize;
62
+ };
63
+
64
+ interface ToggleGroupContextValue {
65
+ variant: ToggleVariant;
66
+ size: ToggleSize;
67
+ }
68
+
69
+ const ToggleGroupContext = React.createContext<ToggleGroupContextValue>({
70
+ variant: "ghost",
71
+ size: "md",
72
+ });
73
+
74
+ export const useToggleGroupStyle = () => React.useContext(ToggleGroupContext);
75
+
76
+ export const ToggleGroup = React.forwardRef<HTMLDivElement, ToggleGroupProps>(
77
+ ({ className, variant = "ghost", size = "md", ...props }, ref) => (
78
+ <ToggleGroupContext.Provider value={{ variant, size }}>
79
+ <BaseToggleGroup
80
+ ref={ref}
81
+ className={cx(
82
+ "inline-flex items-center gap-[var(--space-1)] data-[orientation=vertical]:flex-col",
83
+ className,
84
+ )}
85
+ {...props}
86
+ />
87
+ </ToggleGroupContext.Provider>
88
+ ),
89
+ );
90
+ ToggleGroup.displayName = "ToggleGroup";
91
+
92
+ export type ToggleGroupItemProps = Omit<
93
+ React.ComponentPropsWithoutRef<typeof BaseToggle>,
94
+ "className"
95
+ > & {
96
+ className?: string;
97
+ };
98
+
99
+ export const ToggleGroupItem = React.forwardRef<HTMLButtonElement, ToggleGroupItemProps>(
100
+ ({ className, ...props }, ref) => {
101
+ const { variant, size } = useToggleGroupStyle();
102
+ return (
103
+ <BaseToggle
104
+ ref={ref}
105
+ className={cx(toggleVariants({ variant, size }), className)}
106
+ {...props}
107
+ />
108
+ );
109
+ },
110
+ );
111
+ ToggleGroupItem.displayName = "ToggleGroupItem";
@@ -0,0 +1,55 @@
1
+ import * as React from "react";
2
+ import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
3
+
4
+ type WithStringClassName<T> = Omit<T, "className"> & { className?: string };
5
+
6
+ function cx(...args: (string | undefined | false | null)[]) {
7
+ return args.filter(Boolean).join(" ");
8
+ }
9
+
10
+ export const TooltipProvider = BaseTooltip.Provider;
11
+ export const Tooltip = BaseTooltip.Root;
12
+ export const TooltipTrigger = BaseTooltip.Trigger;
13
+
14
+ export interface TooltipContentProps
15
+ extends WithStringClassName<
16
+ React.ComponentPropsWithoutRef<typeof BaseTooltip.Popup>
17
+ > {
18
+ side?: "top" | "right" | "bottom" | "left";
19
+ align?: "start" | "center" | "end";
20
+ sideOffset?: number;
21
+ showArrow?: boolean;
22
+ container?: React.ComponentPropsWithoutRef<
23
+ typeof BaseTooltip.Portal
24
+ >["container"];
25
+ }
26
+
27
+ export const TooltipContent = React.forwardRef<HTMLDivElement, TooltipContentProps>(
28
+ function TooltipContent(
29
+ { className, children, side, align, sideOffset = 6, showArrow, container, ...props },
30
+ ref,
31
+ ) {
32
+ return (
33
+ <BaseTooltip.Portal container={container}>
34
+ <BaseTooltip.Positioner
35
+ className="z-[var(--z-tooltip,var(--z-popover))] outline-none"
36
+ side={side}
37
+ align={align}
38
+ sideOffset={sideOffset}
39
+ >
40
+ <BaseTooltip.Popup
41
+ ref={ref}
42
+ className={cx(
43
+ "px-2.5 py-1.5 bg-foreground text-background rounded-[calc(var(--radius)-2px)] text-[length:var(--text-xs)] leading-snug max-w-xs shadow-[0_4px_12px_rgba(0,0,0,0.12)] origin-[var(--transform-origin)] outline-none transition-[opacity,transform] duration-[120ms] ease-out motion-reduce:transition-none data-[starting-style]:opacity-0 data-[starting-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:scale-95 motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
44
+ className,
45
+ )}
46
+ {...props}
47
+ >
48
+ {showArrow && <BaseTooltip.Arrow className="text-foreground [&_svg]:block" />}
49
+ {children}
50
+ </BaseTooltip.Popup>
51
+ </BaseTooltip.Positioner>
52
+ </BaseTooltip.Portal>
53
+ );
54
+ },
55
+ );
@@ -3,6 +3,7 @@
3
3
  "versions": {
4
4
  "@base-ui/react": "^1.4.1",
5
5
  "@tanstack/react-form": "^1.29.1",
6
+ "class-variance-authority": "^0.7.1",
6
7
  "lucide-react": "^1.11.0",
7
8
  "react-hook-form": "^7.74.0",
8
9
  "shiki": "^4.0.2"