@agentero/design-system 0.15.0 → 0.16.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.15.0",
3
+ "version": "0.16.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",
@@ -37,6 +37,10 @@
37
37
  "types": "./src/button/index.d.ts",
38
38
  "import": "./src/button/index.js"
39
39
  },
40
+ "./check-list": {
41
+ "types": "./src/check-list/index.d.ts",
42
+ "import": "./src/check-list/index.js"
43
+ },
40
44
  "./data-table": {
41
45
  "types": "./src/data-table/index.d.ts",
42
46
  "import": "./src/data-table/index.js"
@@ -0,0 +1,65 @@
1
+ import { ComponentProps } from 'react';
2
+ export declare const checkListRecipe: import('tailwind-variants').TVReturnType<{
3
+ [key: string]: {
4
+ [key: string]: import('tailwind-merge').ClassNameValue | {
5
+ icon?: import('tailwind-merge').ClassNameValue;
6
+ root?: import('tailwind-merge').ClassNameValue;
7
+ item?: import('tailwind-merge').ClassNameValue;
8
+ };
9
+ };
10
+ } | {
11
+ [x: string]: {
12
+ [x: string]: import('tailwind-merge').ClassNameValue | {
13
+ icon?: import('tailwind-merge').ClassNameValue;
14
+ root?: import('tailwind-merge').ClassNameValue;
15
+ item?: import('tailwind-merge').ClassNameValue;
16
+ };
17
+ };
18
+ } | {}, {
19
+ root: string;
20
+ item: string;
21
+ icon: string;
22
+ }, undefined, {
23
+ [key: string]: {
24
+ [key: string]: import('tailwind-merge').ClassNameValue | {
25
+ icon?: import('tailwind-merge').ClassNameValue;
26
+ root?: import('tailwind-merge').ClassNameValue;
27
+ item?: import('tailwind-merge').ClassNameValue;
28
+ };
29
+ };
30
+ } | {}, {
31
+ root: string;
32
+ item: string;
33
+ icon: string;
34
+ }, import('tailwind-variants').TVReturnType<unknown, {
35
+ root: string;
36
+ item: string;
37
+ icon: string;
38
+ }, undefined, unknown, unknown, undefined>>;
39
+ type RootProps = ComponentProps<'ul'>;
40
+ type ItemProps = ComponentProps<'li'>;
41
+ /**
42
+ * CheckList renders a vertical list where every row is marked with a check
43
+ * icon — feature lists, benefits, availability summaries. Purely
44
+ * presentational: for interactive selection use a checkbox group instead.
45
+ *
46
+ * @summary Vertical list of check-marked rows
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * <CheckList.Root>
51
+ * <CheckList.Item>Instant appointment</CheckList.Item>
52
+ * </CheckList.Root>
53
+ * ```
54
+ */
55
+ export declare const CheckList: {
56
+ Root: {
57
+ ({ className, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
58
+ displayName: string;
59
+ };
60
+ Item: {
61
+ ({ className, children, ...props }: ItemProps): import("react/jsx-runtime").JSX.Element;
62
+ displayName: string;
63
+ };
64
+ };
65
+ export {};
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { IconCheck as e } from "./icons.js";
3
+ import { tv as t } from "tailwind-variants";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ //#region src/check-list/check-list.tsx
6
+ var i = t({ slots: {
7
+ root: "flex flex-col gap-1.5 text-sm text-text-default-base-primary",
8
+ item: "flex items-start gap-2",
9
+ icon: "relative top-[0.125em] size-[1.25em] shrink-0"
10
+ } }), a = i(), o = ({ className: e, ...t }) => /* @__PURE__ */ n("ul", {
11
+ "data-slot": "check-list",
12
+ className: a.root({ className: e }),
13
+ ...t
14
+ });
15
+ o.displayName = "CheckList.Root";
16
+ var s = ({ className: t, children: i, ...o }) => /* @__PURE__ */ r("li", {
17
+ "data-slot": "check-list-item",
18
+ className: a.item({ className: t }),
19
+ ...o,
20
+ children: [/* @__PURE__ */ n(e, {
21
+ className: a.icon(),
22
+ "aria-hidden": !0
23
+ }), i]
24
+ });
25
+ s.displayName = "CheckList.Item";
26
+ var c = {
27
+ Root: o,
28
+ Item: s
29
+ };
30
+ //#endregion
31
+ export { c as CheckList, i as checkListRecipe };
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare const IconCheck: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ //#region src/check-list/icons.tsx
3
+ var t = (t) => /* @__PURE__ */ e("svg", {
4
+ width: "24",
5
+ height: "24",
6
+ viewBox: "0 0 24 24",
7
+ fill: "none",
8
+ xmlns: "http://www.w3.org/2000/svg",
9
+ ...t,
10
+ children: /* @__PURE__ */ e("path", {
11
+ fill: "currentColor",
12
+ d: "M9.54988 15.5154L18.1884 6.87695C18.3371 6.72824 18.5137 6.65227 18.7182 6.64905C18.9226 6.64585 19.1024 6.72182 19.2576 6.87695C19.4127 7.03207 19.4903 7.21027 19.4903 7.41155C19.4903 7.61282 19.4127 7.79102 19.2576 7.94615L10.1826 17.0211C10.0018 17.2019 9.7909 17.2923 9.54988 17.2923C9.30887 17.2923 9.09798 17.2019 8.91721 17.0211L4.74221 12.8462C4.59349 12.6974 4.52009 12.5208 4.52201 12.3164C4.52394 12.1119 4.60247 11.9321 4.75758 11.777C4.91272 11.6218 5.09092 11.5443 5.29218 11.5443C5.49347 11.5443 5.67167 11.6218 5.82678 11.777L9.54988 15.5154Z"
13
+ })
14
+ });
15
+ //#endregion
16
+ export { t as IconCheck };
@@ -0,0 +1 @@
1
+ export { CheckList, checkListRecipe } from './check-list';
@@ -0,0 +1,2 @@
1
+ import { CheckList as e, checkListRecipe as t } from "./check-list.js";
2
+ export { e as CheckList, t as checkListRecipe };
@@ -12,9 +12,16 @@ export declare const switchRecipe: import('tailwind-variants').TVReturnType<{
12
12
  thumb: string;
13
13
  };
14
14
  };
15
+ reverse: {
16
+ true: {
17
+ wrapper: string;
18
+ };
19
+ };
15
20
  }, {
21
+ wrapper: string;
16
22
  root: string[];
17
23
  thumb: string;
24
+ label: string[];
18
25
  }, undefined, {
19
26
  size: {
20
27
  sm: {
@@ -26,9 +33,16 @@ export declare const switchRecipe: import('tailwind-variants').TVReturnType<{
26
33
  thumb: string;
27
34
  };
28
35
  };
36
+ reverse: {
37
+ true: {
38
+ wrapper: string;
39
+ };
40
+ };
29
41
  }, {
42
+ wrapper: string;
30
43
  root: string[];
31
44
  thumb: string;
45
+ label: string[];
32
46
  }, import('tailwind-variants').TVReturnType<{
33
47
  size: {
34
48
  sm: {
@@ -40,20 +54,39 @@ export declare const switchRecipe: import('tailwind-variants').TVReturnType<{
40
54
  thumb: string;
41
55
  };
42
56
  };
57
+ reverse: {
58
+ true: {
59
+ wrapper: string;
60
+ };
61
+ };
43
62
  }, {
63
+ wrapper: string;
44
64
  root: string[];
45
65
  thumb: string;
66
+ label: string[];
46
67
  }, undefined, unknown, unknown, undefined>>;
47
68
  export type SwitchSize = NonNullable<VariantProps<typeof switchRecipe>['size']>;
48
- export type SwitchProps = ComponentPropsWithRef<typeof SwitchPrimitive.Root> & VariantProps<typeof switchRecipe>;
69
+ export type SwitchProps = ComponentPropsWithRef<typeof SwitchPrimitive.Root> & VariantProps<typeof switchRecipe> & {
70
+ /**
71
+ * Optional text rendered beside the toggle and associated with it via
72
+ * `htmlFor`. Provide an `id` so the association resolves. Omit it to keep
73
+ * the toggle headless and supply your own `<label htmlFor>`.
74
+ */
75
+ label?: string;
76
+ };
49
77
  /**
50
78
  * 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.
79
+ * Checkbox when flipping a single boolean that applies immediately.
80
+ *
81
+ * Renders only the toggle by default — pair it with a `<label htmlFor>` for an
82
+ * accessible name. Pass `label` (with an `id`) to render an associated text
83
+ * label beside the toggle; `reverse` places the label before it.
53
84
  *
54
85
  * @summary Instant-effect on/off toggle built on Radix Switch
55
86
  *
56
87
  * @example
57
88
  * <Switch checked={enabled} onCheckedChange={setEnabled} />
89
+ * @example
90
+ * <Switch id="email-notifications" label="Email" checked={on} onCheckedChange={setOn} />
58
91
  */
59
- export declare const Switch: ({ className, size, ref, ...props }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
92
+ export declare const Switch: ({ className, size, reverse, label, id, ref, ...props }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,42 +1,61 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../lib/utils.js";
3
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";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ import { useId as i } from "react";
6
+ import * as a from "@radix-ui/react-switch";
6
7
  //#region src/switch/switch.tsx
7
- var i = t({
8
+ var o = t({
8
9
  slots: {
10
+ wrapper: "inline-flex items-center gap-2.5",
9
11
  root: [
10
- "inline-flex shrink-0 cursor-pointer items-center rounded-full transition-colors",
12
+ "peer inline-flex shrink-0 cursor-pointer items-center rounded-full transition-colors",
11
13
  "bg-bg-default-base-tertiary data-[state=checked]:bg-bg-default-base-inverse-primary",
12
14
  "focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring-button-primary",
13
15
  "disabled:cursor-not-allowed disabled:opacity-50"
14
16
  ],
15
- thumb: "block translate-x-0 rounded-full bg-bg-default-base-primary shadow-sm transition-transform"
17
+ thumb: "block translate-x-0 rounded-full bg-bg-default-base-primary shadow-sm transition-transform",
18
+ label: ["cursor-pointer text-sm text-text-default-base-primary select-none", "peer-disabled:cursor-not-allowed peer-disabled:opacity-50"]
16
19
  },
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"
20
+ variants: {
21
+ size: {
22
+ sm: {
23
+ root: "h-4 w-7.5 p-0.5",
24
+ thumb: "size-3 data-[state=checked]:translate-x-3.5"
25
+ },
26
+ md: {
27
+ root: "h-6 w-12 p-0.75",
28
+ thumb: "size-4.5 data-[state=checked]:translate-x-6"
29
+ }
21
30
  },
22
- md: {
23
- root: "h-6 w-12 p-0.75",
24
- thumb: "size-4.5 data-[state=checked]:translate-x-6"
25
- }
26
- } },
31
+ reverse: { true: { wrapper: "flex-row-reverse" } }
32
+ },
27
33
  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,
34
+ }), s = ({ className: t, size: s, reverse: c, label: l, id: u, ref: d, ...f }) => {
35
+ let p = i(), m = u ?? (l ? p : void 0), h = o({
36
+ size: s,
37
+ reverse: c
38
+ }), g = /* @__PURE__ */ n(a.Root, {
39
+ ref: d,
40
+ id: m,
32
41
  "data-slot": "switch",
33
- className: e(c.root(), t),
34
- ...s,
35
- children: /* @__PURE__ */ n(r.Thumb, {
42
+ className: e(h.root(), t),
43
+ ...f,
44
+ children: /* @__PURE__ */ n(a.Thumb, {
36
45
  "data-slot": "switch-thumb",
37
- className: c.thumb()
46
+ className: h.thumb()
38
47
  })
39
48
  });
49
+ return l ? /* @__PURE__ */ r("span", {
50
+ "data-slot": "switch-wrapper",
51
+ className: h.wrapper(),
52
+ children: [g, /* @__PURE__ */ n("label", {
53
+ htmlFor: m,
54
+ "data-slot": "switch-label",
55
+ className: h.label(),
56
+ children: l
57
+ })]
58
+ }) : g;
40
59
  };
41
60
  //#endregion
42
- export { a as Switch, i as switchRecipe };
61
+ export { s as Switch, o as switchRecipe };