@eduardoalvarez/arrecife 0.5.0 → 0.6.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/CHANGELOG.md +52 -0
- package/README.md +706 -470
- package/dist/brand/index.cjs +112 -95
- package/dist/brand/index.d.cts +40 -39
- package/dist/brand/index.d.ts +40 -39
- package/dist/brand/index.js +5 -4
- package/dist/catalog-D13txprv.d.cts +78 -0
- package/dist/catalog-D13txprv.d.ts +78 -0
- package/dist/chart/index.cjs +100 -83
- package/dist/chart/index.d.cts +66 -66
- package/dist/chart/index.d.ts +66 -66
- package/dist/chart/index.js +14 -12
- package/dist/chunk-25YNFCIF.js +141 -0
- package/dist/{chunk-YZ2SDOVZ.js → chunk-6O3KWB6P.js} +30 -30
- package/dist/chunk-CKRSQPTX.js +36 -0
- package/dist/{chunk-ZEOQKRQ7.js → chunk-DKCN7BAL.js} +1 -1
- package/dist/chunk-GCRII2KQ.js +86 -0
- package/dist/chunk-JMOOFZ3B.js +42 -0
- package/dist/chunk-O4TAH7YJ.js +276 -0
- package/dist/chunk-ODBFN44D.js +45 -0
- package/dist/{chunk-VPT32GPG.js → chunk-PMN7NR3G.js} +2 -2
- package/dist/chunk-XKYHTOUJ.js +27 -0
- package/dist/form/index.cjs +109 -92
- package/dist/form/index.d.cts +43 -42
- package/dist/form/index.d.ts +43 -42
- package/dist/form/index.js +25 -23
- package/dist/index.cjs +1068 -929
- package/dist/index.d.cts +770 -773
- package/dist/index.d.ts +770 -773
- package/dist/index.js +629 -675
- package/dist/{label-DuTvJGxD.d.ts → label-MgHFKnFy.d.cts} +3 -3
- package/dist/{label-DuTvJGxD.d.cts → label-MgHFKnFy.d.ts} +3 -3
- package/dist/og/index.cjs +130 -130
- package/dist/og/index.d.cts +93 -89
- package/dist/og/index.d.ts +93 -89
- package/dist/og/index.js +106 -106
- package/dist/shiki/index.cjs +28 -30
- package/dist/shiki/index.d.cts +4 -4
- package/dist/shiki/index.d.ts +4 -4
- package/dist/shiki/index.js +12 -12
- package/dist/theme/index.cjs +97 -0
- package/dist/theme/index.d.cts +144 -0
- package/dist/theme/index.d.ts +144 -0
- package/dist/theme/index.js +2 -0
- package/dist/tokens/index.cjs +133 -86
- package/dist/tokens/index.d.cts +246 -161
- package/dist/tokens/index.d.ts +246 -161
- package/dist/tokens/index.js +2 -2
- package/dist/tokens/theme.css +133 -98
- package/dist/variants/index.cjs +192 -0
- package/dist/variants/index.d.cts +192 -0
- package/dist/variants/index.d.ts +192 -0
- package/dist/variants/index.js +3 -0
- package/llms.txt +810 -744
- package/package.json +20 -11
- package/dist/catalogo-Du5ID-Hi.d.cts +0 -77
- package/dist/catalogo-Du5ID-Hi.d.ts +0 -77
- package/dist/chunk-E3OMP2DL.js +0 -36
- package/dist/chunk-KPZNNMV5.js +0 -83
- package/dist/chunk-NHS7ETKJ.js +0 -27
- package/dist/chunk-TSPJOM6K.js +0 -229
- package/dist/chunk-UOWIDFCB.js +0 -81
- package/dist/tema/index.cjs +0 -94
- package/dist/tema/index.d.cts +0 -110
- package/dist/tema/index.d.ts +0 -110
- package/dist/tema/index.js +0 -2
package/dist/form/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import '../chunk-
|
|
1
|
+
'use client';
|
|
2
|
+
import { Label } from '../chunk-DKCN7BAL.js';
|
|
3
|
+
import { Text } from '../chunk-JMOOFZ3B.js';
|
|
4
|
+
import '../chunk-ODBFN44D.js';
|
|
5
|
+
import { cn } from '../chunk-XKYHTOUJ.js';
|
|
6
|
+
import '../chunk-O4TAH7YJ.js';
|
|
5
7
|
import '../chunk-MLKGABMK.js';
|
|
6
8
|
import { createContext, useContext, useId } from 'react';
|
|
7
9
|
import { FormProvider, Controller, useFormContext, useFormState } from 'react-hook-form';
|
|
@@ -9,24 +11,24 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
9
11
|
import { jsx } from 'react/jsx-runtime';
|
|
10
12
|
|
|
11
13
|
var Form = FormProvider;
|
|
12
|
-
var
|
|
14
|
+
var Field = createContext(null);
|
|
13
15
|
var Item = createContext(null);
|
|
14
16
|
function FormField(props) {
|
|
15
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
+
return /* @__PURE__ */ jsx(Field.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
16
18
|
}
|
|
17
19
|
function useFormField() {
|
|
18
|
-
const
|
|
20
|
+
const field = useContext(Field);
|
|
19
21
|
const item = useContext(Item);
|
|
20
22
|
const { getFieldState } = useFormContext();
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
23
|
-
if (!item) throw new Error("useFormField
|
|
23
|
+
const state = useFormState({ name: field?.name ?? "" });
|
|
24
|
+
if (!field) throw new Error("useFormField must be used inside a <FormField>.");
|
|
25
|
+
if (!item) throw new Error("useFormField must be used inside a <FormItem>.");
|
|
24
26
|
return {
|
|
25
|
-
name:
|
|
27
|
+
name: field.name,
|
|
26
28
|
id: item.id,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...getFieldState(
|
|
29
|
+
descriptionId: `${item.id}-descripcion`,
|
|
30
|
+
messageId: `${item.id}-mensaje`,
|
|
31
|
+
...getFieldState(field.name, state)
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
function FormItem({ className, ...props }) {
|
|
@@ -38,45 +40,45 @@ function FormLabel({ className, ...props }) {
|
|
|
38
40
|
return /* @__PURE__ */ jsx(Label, { htmlFor: id, className, ...props });
|
|
39
41
|
}
|
|
40
42
|
function FormControl({ ...props }) {
|
|
41
|
-
const { error, id,
|
|
43
|
+
const { error, id, descriptionId, messageId } = useFormField();
|
|
42
44
|
return /* @__PURE__ */ jsx(
|
|
43
45
|
Slot,
|
|
44
46
|
{
|
|
45
47
|
id,
|
|
46
|
-
"aria-describedby": error ? `${
|
|
48
|
+
"aria-describedby": error ? `${descriptionId} ${messageId}` : descriptionId,
|
|
47
49
|
"aria-invalid": error ? true : void 0,
|
|
48
50
|
...props
|
|
49
51
|
}
|
|
50
52
|
);
|
|
51
53
|
}
|
|
52
54
|
function FormDescription({ className, ...props }) {
|
|
53
|
-
const {
|
|
55
|
+
const { descriptionId } = useFormField();
|
|
54
56
|
return /* @__PURE__ */ jsx(
|
|
55
57
|
Text,
|
|
56
58
|
{
|
|
57
59
|
as: "p",
|
|
58
60
|
variant: "label",
|
|
59
61
|
tone: "muted",
|
|
60
|
-
id:
|
|
62
|
+
id: descriptionId,
|
|
61
63
|
className: cn("font-normal", className),
|
|
62
64
|
...props
|
|
63
65
|
}
|
|
64
66
|
);
|
|
65
67
|
}
|
|
66
68
|
function FormMessage({ className, children, ...props }) {
|
|
67
|
-
const { error,
|
|
68
|
-
const
|
|
69
|
-
if (!
|
|
69
|
+
const { error, messageId } = useFormField();
|
|
70
|
+
const body = error?.message ? String(error.message) : children;
|
|
71
|
+
if (!body) return null;
|
|
70
72
|
return /* @__PURE__ */ jsx(
|
|
71
73
|
Text,
|
|
72
74
|
{
|
|
73
75
|
as: "p",
|
|
74
76
|
variant: "label",
|
|
75
77
|
tone: "error",
|
|
76
|
-
id:
|
|
78
|
+
id: messageId,
|
|
77
79
|
className,
|
|
78
80
|
...props,
|
|
79
|
-
children:
|
|
81
|
+
children: body
|
|
80
82
|
}
|
|
81
83
|
);
|
|
82
84
|
}
|