@agentero/design-system 0.21.0 → 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/mcp/manifests/components.html +117 -2
- package/mcp/manifests/components.json +1 -1
- package/package.json +5 -1
- package/src/validation-list/index.d.ts +2 -0
- package/src/validation-list/index.js +2 -0
- package/src/validation-list/validation-list.d.ts +60 -0
- package/src/validation-list/validation-list.js +30 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentero/design-system",
|
|
3
|
-
"version": "0.
|
|
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",
|
|
@@ -105,6 +105,10 @@
|
|
|
105
105
|
"types": "./src/tooltip/index.d.ts",
|
|
106
106
|
"import": "./src/tooltip/index.js"
|
|
107
107
|
},
|
|
108
|
+
"./validation-list": {
|
|
109
|
+
"types": "./src/validation-list/index.d.ts",
|
|
110
|
+
"import": "./src/validation-list/index.js"
|
|
111
|
+
},
|
|
108
112
|
"./lib": {
|
|
109
113
|
"types": "./lib/index.d.ts",
|
|
110
114
|
"import": "./lib/index.js"
|
|
@@ -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 };
|