@agentero/design-system 0.20.2 → 0.22.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.20.2",
3
+ "version": "0.22.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",
@@ -33,6 +33,10 @@
33
33
  "types": "./src/avatar/index.d.ts",
34
34
  "import": "./src/avatar/index.js"
35
35
  },
36
+ "./avatar-group": {
37
+ "types": "./src/avatar-group/index.d.ts",
38
+ "import": "./src/avatar-group/index.js"
39
+ },
36
40
  "./button": {
37
41
  "types": "./src/button/index.d.ts",
38
42
  "import": "./src/button/index.js"
@@ -101,6 +105,10 @@
101
105
  "types": "./src/tooltip/index.d.ts",
102
106
  "import": "./src/tooltip/index.js"
103
107
  },
108
+ "./validation-list": {
109
+ "types": "./src/validation-list/index.d.ts",
110
+ "import": "./src/validation-list/index.js"
111
+ },
104
112
  "./lib": {
105
113
  "types": "./lib/index.d.ts",
106
114
  "import": "./lib/index.js"
@@ -0,0 +1,117 @@
1
+ import { ComponentProps, ComponentPropsWithRef, ReactNode } from 'react';
2
+ import { Avatar } from '../avatar';
3
+ type AvatarSize = ComponentProps<typeof Avatar>['size'];
4
+ type AvatarVariant = ComponentProps<typeof Avatar>['variant'];
5
+ export declare const avatarGroupRecipe: import('tailwind-variants').TVReturnType<{
6
+ size: {
7
+ xs: {
8
+ item: string;
9
+ };
10
+ sm: {
11
+ item: string;
12
+ };
13
+ md: {
14
+ item: string;
15
+ };
16
+ lg: {
17
+ item: string;
18
+ };
19
+ xl: {
20
+ item: string;
21
+ };
22
+ '2xl': {
23
+ item: string;
24
+ };
25
+ '3xl': {
26
+ item: string;
27
+ };
28
+ '4xl': {
29
+ item: string;
30
+ };
31
+ };
32
+ }, {
33
+ root: string;
34
+ item: string;
35
+ }, undefined, {
36
+ size: {
37
+ xs: {
38
+ item: string;
39
+ };
40
+ sm: {
41
+ item: string;
42
+ };
43
+ md: {
44
+ item: string;
45
+ };
46
+ lg: {
47
+ item: string;
48
+ };
49
+ xl: {
50
+ item: string;
51
+ };
52
+ '2xl': {
53
+ item: string;
54
+ };
55
+ '3xl': {
56
+ item: string;
57
+ };
58
+ '4xl': {
59
+ item: string;
60
+ };
61
+ };
62
+ }, {
63
+ root: string;
64
+ item: string;
65
+ }, import('tailwind-variants').TVReturnType<{
66
+ size: {
67
+ xs: {
68
+ item: string;
69
+ };
70
+ sm: {
71
+ item: string;
72
+ };
73
+ md: {
74
+ item: string;
75
+ };
76
+ lg: {
77
+ item: string;
78
+ };
79
+ xl: {
80
+ item: string;
81
+ };
82
+ '2xl': {
83
+ item: string;
84
+ };
85
+ '3xl': {
86
+ item: string;
87
+ };
88
+ '4xl': {
89
+ item: string;
90
+ };
91
+ };
92
+ }, {
93
+ root: string;
94
+ item: string;
95
+ }, undefined, unknown, unknown, undefined>>;
96
+ export type AvatarGroupProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
97
+ children?: ReactNode;
98
+ max?: number;
99
+ size?: AvatarSize;
100
+ /** Shape applied uniformly to every avatar and the `+N` bubble. Defaults to `circle`. */
101
+ variant?: AvatarVariant;
102
+ };
103
+ /**
104
+ * Stacks `<Avatar>` children into an overlapping row, collapsing everything past
105
+ * `max` (default 3) into a trailing `+N` bubble. Pass `<Avatar>` elements
106
+ * directly — the group clones each to force a uniform `size`/`variant` and the
107
+ * overlap, so wrapped children won't pick those up.
108
+ *
109
+ * @example
110
+ * <AvatarGroup size="sm" max={3}>
111
+ * <Avatar fallback="AL" colorize="Ada Lovelace" />
112
+ * <Avatar fallback="GH" colorize="Grace Hopper" />
113
+ * <Avatar fallback="MK" colorize="Mary Kom" />
114
+ * </AvatarGroup>
115
+ */
116
+ export declare const AvatarGroup: ({ children, max, size, variant, className, ref, ...props }: AvatarGroupProps) => import("react/jsx-runtime").JSX.Element;
117
+ export {};
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { Avatar as t } from "../avatar/avatar.js";
4
+ import { tv as n } from "tailwind-variants";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
+ import { Children as a, cloneElement as o, isValidElement as s } from "react";
7
+ //#region src/avatar-group/avatar-group.tsx
8
+ var c = n({
9
+ slots: {
10
+ root: "inline-flex items-center",
11
+ item: "relative first:ms-0 [--avatar-border-color:var(--color-bg-default-base-primary)] [--avatar-border-width:0.125rem]"
12
+ },
13
+ variants: { size: {
14
+ xs: { item: "-ms-1.5" },
15
+ sm: { item: "-ms-2" },
16
+ md: { item: "-ms-2.5" },
17
+ lg: { item: "-ms-3" },
18
+ xl: { item: "-ms-3.5" },
19
+ "2xl": { item: "-ms-4" },
20
+ "3xl": { item: "-ms-4.5" },
21
+ "4xl": { item: "-ms-5" }
22
+ } },
23
+ defaultVariants: { size: "md" }
24
+ }), l = ({ children: n, max: l = 3, size: u = "md", variant: d, className: f, ref: p, ...m }) => {
25
+ let h = c({ size: u }), g = h.item(), _ = a.toArray(n).filter(s), v = _.slice(0, Math.max(0, l)), y = _.length - v.length;
26
+ return /* @__PURE__ */ i("div", {
27
+ ref: p,
28
+ "data-slot": "avatar-group",
29
+ ...m,
30
+ className: e(h.root(), f),
31
+ children: [v.map((t) => o(t, {
32
+ size: u,
33
+ variant: d,
34
+ className: e(g, t.props.className)
35
+ })), y > 0 && /* @__PURE__ */ r(t, {
36
+ "data-slot": "avatar-group-overflow",
37
+ size: u,
38
+ variant: d,
39
+ fallback: `+${y}`,
40
+ className: g
41
+ })]
42
+ });
43
+ };
44
+ //#endregion
45
+ export { l as AvatarGroup, c as avatarGroupRecipe };
@@ -0,0 +1,2 @@
1
+ export { AvatarGroup, avatarGroupRecipe } from './avatar-group';
2
+ export type { AvatarGroupProps } from './avatar-group';
@@ -0,0 +1,2 @@
1
+ import { AvatarGroup as e, avatarGroupRecipe as t } from "./avatar-group.js";
2
+ export { e as AvatarGroup, t as avatarGroupRecipe };
@@ -0,0 +1,2 @@
1
+ export { ValidationList, validationListRecipe } from './validation-list';
2
+ export type { ValidationListProps, ValidationListVariants, ValidationRule } from './validation-list';
@@ -0,0 +1,2 @@
1
+ import { ValidationList as e, validationListRecipe as t } from "./validation-list.js";
2
+ export { e as ValidationList, t as validationListRecipe };
@@ -0,0 +1,60 @@
1
+ import { ComponentPropsWithRef } from 'react';
2
+ import { VariantProps } from 'tailwind-variants';
3
+ export type ValidationRule = {
4
+ text: string;
5
+ pattern: RegExp | ((value: string) => boolean);
6
+ };
7
+ export declare const validationListRecipe: import('tailwind-variants').TVReturnType<{
8
+ active: {
9
+ true: {
10
+ item: string;
11
+ };
12
+ false: {
13
+ item: string;
14
+ };
15
+ };
16
+ }, {
17
+ root: string;
18
+ item: string;
19
+ }, undefined, {
20
+ active: {
21
+ true: {
22
+ item: string;
23
+ };
24
+ false: {
25
+ item: string;
26
+ };
27
+ };
28
+ }, {
29
+ root: string;
30
+ item: string;
31
+ }, import('tailwind-variants').TVReturnType<{
32
+ active: {
33
+ true: {
34
+ item: string;
35
+ };
36
+ false: {
37
+ item: string;
38
+ };
39
+ };
40
+ }, {
41
+ root: string;
42
+ item: string;
43
+ }, undefined, unknown, unknown, undefined>>;
44
+ export type ValidationListVariants = VariantProps<typeof validationListRecipe>;
45
+ export type ValidationListProps = Omit<ComponentPropsWithRef<'ul'>, 'children'> & {
46
+ value: string;
47
+ rules: ValidationRule[];
48
+ };
49
+ /**
50
+ * A checklist of rules that turn active as `value` satisfies them — one `<li>`
51
+ * per rule, each matched via a `RegExp` or a `(value) => boolean` predicate.
52
+ * Presentational only; pair it with your form validation.
53
+ *
54
+ * @example
55
+ * <ValidationList
56
+ * value={password}
57
+ * rules={[{ text: 'At least 10 characters', pattern: value => value.length >= 10 }]}
58
+ * />
59
+ */
60
+ export declare const ValidationList: ({ value, rules, className, ...props }: ValidationListProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { tv as e } from "tailwind-variants";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ //#region src/validation-list/validation-list.tsx
5
+ var n = e({
6
+ slots: {
7
+ root: "ml-4 flex list-inside list-disc flex-col gap-1 text-left",
8
+ item: "text-sm"
9
+ },
10
+ variants: { active: {
11
+ true: { item: "text-text-default-base-primary" },
12
+ false: { item: "text-text-default-base-tertiary" }
13
+ } },
14
+ defaultVariants: { active: !1 }
15
+ }), r = n(), i = (e, t) => e instanceof RegExp ? new RegExp(e).test(t) : e(t), a = ({ value: e, rules: n, className: a, ...o }) => /* @__PURE__ */ t("ul", {
16
+ "data-slot": "validation-list",
17
+ className: r.root({ className: a }),
18
+ ...o,
19
+ children: n.map(({ text: n, pattern: a }) => {
20
+ let o = i(a, e);
21
+ return /* @__PURE__ */ t("li", {
22
+ "data-slot": "validation-list-item",
23
+ "data-active": o,
24
+ className: r.item({ active: o }),
25
+ children: n
26
+ }, n);
27
+ })
28
+ });
29
+ //#endregion
30
+ export { a as ValidationList, n as validationListRecipe };