@agentero/design-system 0.11.0 → 0.13.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentero/design-system",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "A React component library built with Tailwind CSS v4 and Radix UI primitives",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -57,6 +57,10 @@
57
57
  "types": "./src/pagination/index.d.ts",
58
58
  "import": "./src/pagination/index.js"
59
59
  },
60
+ "./switch": {
61
+ "types": "./src/switch/index.d.ts",
62
+ "import": "./src/switch/index.js"
63
+ },
60
64
  "./tag": {
61
65
  "types": "./src/tag/index.d.ts",
62
66
  "import": "./src/tag/index.js"
@@ -65,6 +69,10 @@
65
69
  "types": "./src/toast/index.d.ts",
66
70
  "import": "./src/toast/index.js"
67
71
  },
72
+ "./tooltip": {
73
+ "types": "./src/tooltip/index.d.ts",
74
+ "import": "./src/tooltip/index.js"
75
+ },
68
76
  "./lib": {
69
77
  "types": "./lib/index.d.ts",
70
78
  "import": "./lib/index.js"
@@ -88,6 +96,8 @@
88
96
  "@radix-ui/react-dropdown-menu": "^2.1.16",
89
97
  "@radix-ui/react-separator": "^1.1.8",
90
98
  "@radix-ui/react-slot": "^1.2.4",
99
+ "@radix-ui/react-switch": "^1.3.2",
100
+ "@radix-ui/react-tooltip": "^1.2.11",
91
101
  "clsx": "^2.1.1",
92
102
  "sonner": "^2.0.7",
93
103
  "tailwind-merge": "^3.5.0",
@@ -0,0 +1,2 @@
1
+ export { Switch, switchRecipe } from './switch';
2
+ export type { SwitchProps, SwitchSize } from './switch';
@@ -0,0 +1,2 @@
1
+ import { Switch as e, switchRecipe as t } from "./switch.js";
2
+ export { e as Switch, t as switchRecipe };
@@ -0,0 +1,59 @@
1
+ import { ComponentPropsWithRef } from 'react';
2
+ import { VariantProps } from 'tailwind-variants';
3
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
4
+ export declare const switchRecipe: import('tailwind-variants').TVReturnType<{
5
+ size: {
6
+ sm: {
7
+ root: string;
8
+ thumb: string;
9
+ };
10
+ md: {
11
+ root: string;
12
+ thumb: string;
13
+ };
14
+ };
15
+ }, {
16
+ root: string[];
17
+ thumb: string;
18
+ }, undefined, {
19
+ size: {
20
+ sm: {
21
+ root: string;
22
+ thumb: string;
23
+ };
24
+ md: {
25
+ root: string;
26
+ thumb: string;
27
+ };
28
+ };
29
+ }, {
30
+ root: string[];
31
+ thumb: string;
32
+ }, import('tailwind-variants').TVReturnType<{
33
+ size: {
34
+ sm: {
35
+ root: string;
36
+ thumb: string;
37
+ };
38
+ md: {
39
+ root: string;
40
+ thumb: string;
41
+ };
42
+ };
43
+ }, {
44
+ root: string[];
45
+ thumb: string;
46
+ }, undefined, unknown, unknown, undefined>>;
47
+ export type SwitchSize = NonNullable<VariantProps<typeof switchRecipe>['size']>;
48
+ export type SwitchProps = ComponentPropsWithRef<typeof SwitchPrimitive.Root> & VariantProps<typeof switchRecipe>;
49
+ /**
50
+ * Instant-effect on/off toggle built on Radix Switch. Reach for it over a
51
+ * Checkbox when flipping a single boolean that applies immediately. Renders
52
+ * only the toggle — pair it with a `<label htmlFor>` for an accessible name.
53
+ *
54
+ * @summary Instant-effect on/off toggle built on Radix Switch
55
+ *
56
+ * @example
57
+ * <Switch checked={enabled} onCheckedChange={setEnabled} />
58
+ */
59
+ export declare const Switch: ({ className, size, ref, ...props }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { tv as t } from "tailwind-variants";
4
+ import { jsx as n } from "react/jsx-runtime";
5
+ import * as r from "@radix-ui/react-switch";
6
+ //#region src/switch/switch.tsx
7
+ var i = t({
8
+ slots: {
9
+ root: [
10
+ "inline-flex shrink-0 cursor-pointer items-center rounded-full transition-colors",
11
+ "bg-bg-default-base-tertiary data-[state=checked]:bg-bg-default-base-inverse-primary",
12
+ "focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring-button-primary",
13
+ "disabled:cursor-not-allowed disabled:opacity-50"
14
+ ],
15
+ thumb: "block translate-x-0 rounded-full bg-bg-default-base-primary shadow-sm transition-transform"
16
+ },
17
+ variants: { size: {
18
+ sm: {
19
+ root: "h-4 w-7.5 p-0.5",
20
+ thumb: "size-3 data-[state=checked]:translate-x-3.5"
21
+ },
22
+ md: {
23
+ root: "h-6 w-12 p-0.75",
24
+ thumb: "size-4.5 data-[state=checked]:translate-x-6"
25
+ }
26
+ } },
27
+ defaultVariants: { size: "md" }
28
+ }), a = ({ className: t, size: a, ref: o, ...s }) => {
29
+ let c = i({ size: a });
30
+ return /* @__PURE__ */ n(r.Root, {
31
+ ref: o,
32
+ "data-slot": "switch",
33
+ className: e(c.root(), t),
34
+ ...s,
35
+ children: /* @__PURE__ */ n(r.Thumb, {
36
+ "data-slot": "switch-thumb",
37
+ className: c.thumb()
38
+ })
39
+ });
40
+ };
41
+ //#endregion
42
+ export { a as Switch, i as switchRecipe };
@@ -0,0 +1,2 @@
1
+ export { Tooltip, tooltipRecipe } from './tooltip';
2
+ export type { TooltipProps } from './tooltip';
@@ -0,0 +1,2 @@
1
+ import { Tooltip as e, tooltipRecipe as t } from "./tooltip.js";
2
+ export { e as Tooltip, t as tooltipRecipe };
@@ -0,0 +1,45 @@
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
3
+ export declare const tooltipRecipe: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
4
+ type RootProps = ComponentProps<typeof TooltipPrimitive.Root>;
5
+ export type TooltipProps = {
6
+ /** The trigger element. Hovering or focusing it reveals the tooltip. */
7
+ children: ReactNode;
8
+ /** The floating hint. Keep it short — labels or hints, not paragraphs. */
9
+ content: ReactNode;
10
+ /** Preferred side of the trigger; flips on collision. Defaults to `'top'`. */
11
+ side?: TooltipPrimitive.TooltipContentProps['side'];
12
+ /** Preferred alignment against the trigger. Defaults to `'center'`. */
13
+ align?: TooltipPrimitive.TooltipContentProps['align'];
14
+ /** Distance in pixels between the tooltip and its trigger. Defaults to `4`. */
15
+ sideOffset?: number;
16
+ /** Merge Radix's behavior onto an already-interactive child instead of wrapping it in a `<button>`. Defaults to `false`. */
17
+ asChild?: boolean;
18
+ /** Hide the tooltip when the trigger is clipped away (e.g. scrolled out of an `overflow` container). */
19
+ hideWhenDetached?: boolean;
20
+ /** Delay in ms before opening on hover. Defaults to `0`; focus always opens instantly. */
21
+ delayDuration?: number;
22
+ /** Extra classes for the content surface, merged last. */
23
+ className?: string;
24
+ } & Pick<RootProps, 'open' | 'defaultOpen' | 'onOpenChange'>;
25
+ /**
26
+ * Tooltip reveals a short, non-essential hint anchored to a trigger element on
27
+ * hover or focus. Pass the trigger as `children` and the hint as `content`; use
28
+ * `asChild` when the trigger is already interactive (a button or link) to avoid
29
+ * nesting interactive elements. Don't put essential or interactive content
30
+ * inside it — hover-only content is inaccessible to touch and keyboard users.
31
+ *
32
+ * @summary Hover/focus hint anchored to a trigger element
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * <Tooltip content="Archive this carrier" asChild>
37
+ * <IconButton aria-label="Archive"><IconArchive /></IconButton>
38
+ * </Tooltip>
39
+ * ```
40
+ */
41
+ export declare const Tooltip: {
42
+ ({ children, content, side, align, sideOffset, asChild, hideWhenDetached, delayDuration, open, defaultOpen, onOpenChange, className }: TooltipProps): import("react/jsx-runtime").JSX.Element;
43
+ displayName: string;
44
+ };
45
+ export {};
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { tv as e } from "tailwind-variants";
3
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
+ import * as r from "@radix-ui/react-tooltip";
5
+ //#region src/tooltip/tooltip.tsx
6
+ var i = e({ base: [
7
+ "z-(--z-index-tooltip) max-w-[32ch] px-3 py-2",
8
+ "rounded-sm border border-border-default-base-primary bg-bg-default-base-primary shadow-sm",
9
+ "text-xs text-pretty text-text-default-base-secondary select-none",
10
+ "will-change-[transform,opacity]",
11
+ "data-[side=bottom]:animate-tooltip-slide-in-from-top",
12
+ "data-[side=top]:animate-tooltip-slide-in-from-bottom",
13
+ "data-[side=left]:animate-tooltip-slide-in-from-right",
14
+ "data-[side=right]:animate-tooltip-slide-in-from-left",
15
+ "motion-reduce:animate-none!"
16
+ ] }), a = ({ children: e, content: a, side: o = "top", align: s, sideOffset: c = 4, asChild: l = !1, hideWhenDetached: u, delayDuration: d = 0, open: f, defaultOpen: p, onOpenChange: m, className: h }) => /* @__PURE__ */ t(r.Provider, {
17
+ delayDuration: d,
18
+ skipDelayDuration: 0,
19
+ children: /* @__PURE__ */ n(r.Root, {
20
+ open: f,
21
+ defaultOpen: p,
22
+ onOpenChange: m,
23
+ children: [/* @__PURE__ */ t(r.Trigger, {
24
+ asChild: l,
25
+ "data-slot": "tooltip-trigger",
26
+ "data-testid": "tooltip-trigger",
27
+ className: "align-middle",
28
+ children: e
29
+ }), /* @__PURE__ */ t(r.Portal, { children: /* @__PURE__ */ t(r.Content, {
30
+ "data-slot": "tooltip-content",
31
+ side: o,
32
+ align: s,
33
+ sideOffset: c,
34
+ collisionPadding: 8,
35
+ hideWhenDetached: u,
36
+ className: i({ className: h }),
37
+ children: a
38
+ }) })]
39
+ })
40
+ });
41
+ a.displayName = "Tooltip";
42
+ //#endregion
43
+ export { a as Tooltip, i as tooltipRecipe };
package/theme/base.css CHANGED
@@ -804,6 +804,10 @@
804
804
  --animate-dropdown-slide-in-from-bottom: dropdownSlideInFromBottom 200ms ease-out;
805
805
  --animate-dropdown-slide-in-from-left: dropdownSlideInFromLeft 200ms ease-out;
806
806
  --animate-dropdown-slide-in-from-right: dropdownSlideInFromRight 200ms ease-out;
807
+ --animate-tooltip-slide-in-from-top: tooltipSlideInFromTop 200ms ease-out;
808
+ --animate-tooltip-slide-in-from-bottom: tooltipSlideInFromBottom 200ms ease-out;
809
+ --animate-tooltip-slide-in-from-left: tooltipSlideInFromLeft 200ms ease-out;
810
+ --animate-tooltip-slide-in-from-right: tooltipSlideInFromRight 200ms ease-out;
807
811
 
808
812
  /* ========================================
809
813
  * Z-INDEX
@@ -996,6 +1000,50 @@
996
1000
  }
997
1001
  }
998
1002
 
1003
+ @keyframes tooltipSlideInFromTop {
1004
+ 0% {
1005
+ opacity: 0;
1006
+ transform: translateY(-0.25rem);
1007
+ }
1008
+ 100% {
1009
+ opacity: 1;
1010
+ transform: translateY(0);
1011
+ }
1012
+ }
1013
+
1014
+ @keyframes tooltipSlideInFromBottom {
1015
+ 0% {
1016
+ opacity: 0;
1017
+ transform: translateY(0.25rem);
1018
+ }
1019
+ 100% {
1020
+ opacity: 1;
1021
+ transform: translateY(0);
1022
+ }
1023
+ }
1024
+
1025
+ @keyframes tooltipSlideInFromLeft {
1026
+ 0% {
1027
+ opacity: 0;
1028
+ transform: translateX(-0.25rem);
1029
+ }
1030
+ 100% {
1031
+ opacity: 1;
1032
+ transform: translateX(0);
1033
+ }
1034
+ }
1035
+
1036
+ @keyframes tooltipSlideInFromRight {
1037
+ 0% {
1038
+ opacity: 0;
1039
+ transform: translateX(0.25rem);
1040
+ }
1041
+ 100% {
1042
+ opacity: 1;
1043
+ transform: translateX(0);
1044
+ }
1045
+ }
1046
+
999
1047
  @keyframes accordionDown {
1000
1048
  from {
1001
1049
  height: 0;