@zayne-labs/ui-react 0.3.0 → 0.4.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/dist/esm/{chunk-Y7TF3SRM.js → chunk-E42DOTGX.js} +4 -3
- package/dist/esm/chunk-E42DOTGX.js.map +1 -0
- package/dist/esm/{chunk-25V5NK2D.js → chunk-FFJY632O.js} +107 -84
- package/dist/esm/chunk-FFJY632O.js.map +1 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/ui/drag-scroll/index.js +1 -1
- package/dist/esm/ui/form/index.d.ts +45 -45
- package/dist/esm/ui/form/index.js +1 -1
- package/dist/esm/ui/index.d.ts +1 -1
- package/dist/esm/ui/index.js +3 -3
- package/package.json +7 -6
- package/dist/esm/chunk-25V5NK2D.js.map +0 -1
- package/dist/esm/chunk-Y7TF3SRM.js.map +0 -1
|
@@ -85,7 +85,8 @@ var useDragScroll = (props = {}) => {
|
|
|
85
85
|
return {
|
|
86
86
|
...mergedRootProps,
|
|
87
87
|
className: cnMerge(
|
|
88
|
-
`flex w-full cursor-grab snap-x snap-mandatory overflow-x-scroll overflow-y-clip
|
|
88
|
+
`flex w-full cursor-grab snap-x snap-mandatory overflow-x-scroll overflow-y-clip
|
|
89
|
+
[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,
|
|
89
90
|
orientation === "horizontal" && "flex-row",
|
|
90
91
|
orientation === "vertical" && "flex-col",
|
|
91
92
|
usage === "mobileAndTabletOnly" && "md:cursor-default md:flex-col",
|
|
@@ -114,5 +115,5 @@ var useDragScroll = (props = {}) => {
|
|
|
114
115
|
};
|
|
115
116
|
|
|
116
117
|
export { useDragScroll };
|
|
117
|
-
//# sourceMappingURL=chunk-
|
|
118
|
-
//# sourceMappingURL=chunk-
|
|
118
|
+
//# sourceMappingURL=chunk-E42DOTGX.js.map
|
|
119
|
+
//# sourceMappingURL=chunk-E42DOTG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AAA;AACjF,IAAM,MAAA,eAAA,GAAkB,aAAc,CAAA,cAAA,EAAgB,SAAS,CAAA;AAE/D,IAAO,OAAA;AAAA,MACN,GAAG,eAAA;AAAA,MACH,SAAW,EAAA,OAAA;AAAA,QACV,CAAA;AAAA,kFAAA,CAAA;AAAA,QAEA,gBAAgB,YAAgB,IAAA,UAAA;AAAA,QAChC,gBAAgB,UAAc,IAAA,UAAA;AAAA,QAC9B,UAAU,qBAAyB,IAAA,+BAAA;AAAA,QACnC,UAAU,aAAiB,IAAA,uCAAA;AAAA,QAC3B,UAAY,EAAA,IAAA;AAAA,QACZ,eAAgB,CAAA;AAAA,OACjB;AAAA,MACA,WAAa,EAAA,MAAA;AAAA,MACb,YAAc,EAAA,aAAA;AAAA,MACd,KAAK,WAAY,CAAA;AAAA,QAChB,WAAA;AAAA,QACC,eAA+D,EAAA;AAAA,OAChE;AAAA,KACF;AAAA,GACD;AAEA,EAAM,MAAA,YAAA,GAAe,CACpB,SACI,KAAA;AACJ,IAAM,MAAA,eAAA,GAAkB,aAAc,CAAA,cAAA,EAAgB,SAAS,CAAA;AAE/D,IAAO,OAAA;AAAA,MACN,GAAG,eAAA;AAAA,MACH,WAAW,OAAQ,CAAA,yBAAA,EAA2B,UAAY,EAAA,IAAA,EAAM,gBAAgB,SAAS,CAAA;AAAA,MACzF,WAAa,EAAA,MAAA;AAAA,MACb,YAAc,EAAA;AAAA,KACf;AAAA,GACD;AAEA,EAAO,OAAA,EAAE,cAAc,YAAa,EAAA;AACrC","file":"chunk-E42DOTGX.js","sourcesContent":["import { checkIsDeviceMobileOrTablet } from \"@zayne-labs/toolkit-core\";\n\n/* eslint-disable no-param-reassign -- Mutation is needed here since it's an element */\nexport const updateCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"grabbing\";\n\telement.style.userSelect = \"none\";\n};\n\nexport const onScrollSnap = <TElement extends HTMLElement>(\n\taction: \"remove\" | \"reset\",\n\telement: TElement\n) => {\n\tif (action === \"remove\") {\n\t\telement.style.scrollSnapType = \"none\";\n\t\treturn;\n\t}\n\n\telement.style.scrollSnapType = \"\";\n};\n\nexport const resetCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"\";\n\telement.style.userSelect = \"\";\n};\n/* eslint-enable no-param-reassign -- Mutation is needed here since it's an element */\n\nexport const handleScrollSnap = (dragContainer: HTMLElement) => {\n\tconst isMobileOrTablet = checkIsDeviceMobileOrTablet();\n\n\tif (!isMobileOrTablet) {\n\t\tonScrollSnap(\"remove\", dragContainer);\n\t} else {\n\t\tonScrollSnap(\"reset\", dragContainer);\n\t}\n};\n","import { cnMerge } from \"@/lib/utils/cn\";\nimport { off, on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { type InferProps, composeRefs, mergeTwoProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { type RefCallback, useRef } from \"react\";\nimport { handleScrollSnap, resetCursor, updateCursor } from \"./utils\";\n\ntype DragScrollProps<TElement extends HTMLElement> = {\n\tclassNames?: { base?: string; item?: string };\n\textraItemProps?: InferProps<HTMLElement>;\n\textraRootProps?: Omit<InferProps<TElement>, \"children\">;\n\torientation?: \"both\" | \"horizontal\" | \"vertical\";\n\tusage?: \"allScreens\" | \"desktopOnly\" | \"mobileAndTabletOnly\";\n};\n\nconst useDragScroll = <TElement extends HTMLElement>(props: DragScrollProps<TElement> = {}) => {\n\tconst {\n\t\tclassNames,\n\t\textraItemProps,\n\t\textraRootProps,\n\t\torientation = \"horizontal\",\n\t\tusage = \"allScreens\",\n\t} = props;\n\n\tconst dragContainerRef = useRef<TElement>(null);\n\n\tconst positionRef = useRef({ left: 0, top: 0, x: 0, y: 0 });\n\n\tconst handleMouseMove = useCallbackRef((event: MouseEvent) => {\n\t\tif (!dragContainerRef.current) return;\n\n\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\t// == calculate the current change in the horizontal scroll position based on the difference between the previous mouse position and the new mouse position\n\t\t\tconst dx = event.clientX - positionRef.current.x;\n\n\t\t\t// == Assign the scrollLeft of the container to the difference between its previous horizontal scroll position and the change in the mouse position\n\t\t\tdragContainerRef.current.scrollLeft = positionRef.current.left - dx;\n\t\t}\n\n\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\t// == calculate the current change in the vertical scroll position based on the difference between the previous mouse position and the new mouse position\n\t\t\tconst dy = event.clientY - positionRef.current.y;\n\n\t\t\t// == Assign the scrollTop of the container to the difference between its previous vertical scroll position and the change in the mouse position\n\t\t\tdragContainerRef.current.scrollTop = positionRef.current.top - dy;\n\t\t}\n\t});\n\n\tconst handleMouseUpOrLeave = useCallbackRef(() => {\n\t\tif (!dragContainerRef.current) return;\n\n\t\toff(\"mousemove\", dragContainerRef.current, handleMouseMove);\n\t\toff(\"mouseup\", dragContainerRef.current, handleMouseUpOrLeave);\n\t\toff(\"mouseleave\", dragContainerRef.current, handleMouseUpOrLeave);\n\n\t\tresetCursor(dragContainerRef.current);\n\t});\n\n\tconst handleMouseDown = useCallbackRef((event: MouseEvent) => {\n\t\tif (usage === \"mobileAndTabletOnly\" && window.innerWidth >= 768) return;\n\t\tif (usage === \"desktopOnly\" && window.innerWidth < 768) return;\n\n\t\tif (!dragContainerRef.current) return;\n\n\t\t// == Update all initial position properties stored in the positionRef\n\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\tpositionRef.current.x = event.clientX;\n\t\t\tpositionRef.current.left = dragContainerRef.current.scrollLeft;\n\t\t}\n\n\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\tpositionRef.current.y = event.clientY;\n\t\t\tpositionRef.current.top = dragContainerRef.current.scrollTop;\n\t\t}\n\n\t\tupdateCursor(dragContainerRef.current);\n\n\t\ton(\"mousemove\", dragContainerRef.current, handleMouseMove);\n\t\ton(\"mouseup\", dragContainerRef.current, handleMouseUpOrLeave);\n\t\ton(\"mouseleave\", dragContainerRef.current, handleMouseUpOrLeave);\n\t});\n\n\tconst refCallBack: RefCallback<TElement> = useCallbackRef((node) => {\n\t\tdragContainerRef.current = node;\n\n\t\tnode && handleScrollSnap(node);\n\n\t\tconst cleanup = on(\"mousedown\", dragContainerRef.current, handleMouseDown);\n\n\t\treturn cleanup;\n\t});\n\n\tconst getRootProps = (rootProps?: DragScrollProps<TElement>[\"extraRootProps\"]) => {\n\t\tconst mergedRootProps = mergeTwoProps(extraRootProps, rootProps);\n\n\t\treturn {\n\t\t\t...mergedRootProps,\n\t\t\tclassName: cnMerge(\n\t\t\t\t`flex w-full cursor-grab snap-x snap-mandatory overflow-x-scroll overflow-y-clip\n\t\t\t\t[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,\n\t\t\t\torientation === \"horizontal\" && \"flex-row\",\n\t\t\t\torientation === \"vertical\" && \"flex-col\",\n\t\t\t\tusage === \"mobileAndTabletOnly\" && \"md:cursor-default md:flex-col\",\n\t\t\t\tusage === \"desktopOnly\" && \"max-md:cursor-default max-md:flex-col\",\n\t\t\t\tclassNames?.base,\n\t\t\t\tmergedRootProps.className\n\t\t\t),\n\t\t\t\"data-part\": \"root\",\n\t\t\t\"data-scope\": \"drag-scroll\",\n\t\t\tref: composeRefs([\n\t\t\t\trefCallBack,\n\t\t\t\t(mergedRootProps as { ref?: React.Ref<TElement> } | undefined)?.ref,\n\t\t\t]),\n\t\t};\n\t};\n\n\tconst getItemProps = <TItemElement extends HTMLElement>(\n\t\titemProps?: DragScrollProps<TItemElement>[\"extraItemProps\"]\n\t) => {\n\t\tconst mergedItemProps = mergeTwoProps(extraItemProps, itemProps);\n\n\t\treturn {\n\t\t\t...mergedItemProps,\n\t\t\tclassName: cnMerge(\"snap-center snap-always\", classNames?.item, mergedItemProps.className),\n\t\t\t\"data-part\": \"item\",\n\t\t\t\"data-scope\": \"drag-scroll\",\n\t\t};\n\t};\n\n\treturn { getItemProps, getRootProps };\n};\n\nexport { useDragScroll };\n"]}
|
|
@@ -3,7 +3,7 @@ import { getElementList } from './chunk-DW3FXTFL.js';
|
|
|
3
3
|
import { Slot } from './chunk-ENDWJXPF.js';
|
|
4
4
|
import { __export } from './chunk-PZ5AY32C.js';
|
|
5
5
|
import * as React2 from 'react';
|
|
6
|
-
import { useId, useMemo,
|
|
6
|
+
import { Fragment, useId, useMemo, useRef, useEffect } from 'react';
|
|
7
7
|
import { toArray } from '@zayne-labs/toolkit-core';
|
|
8
8
|
import { createCustomContext, useToggle, ContextError } from '@zayne-labs/toolkit-react';
|
|
9
9
|
import { getSlotElement, getOtherChildren } from '@zayne-labs/toolkit-react/utils';
|
|
@@ -32,13 +32,23 @@ var useFormRootContext = () => {
|
|
|
32
32
|
}
|
|
33
33
|
return formContext;
|
|
34
34
|
};
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
var useLaxGetFieldState = (name) => {
|
|
36
|
+
const { formState, getFieldState } = useFormRootContext();
|
|
37
|
+
if (!name) return;
|
|
38
|
+
const fieldState = getFieldState(name, formState);
|
|
39
|
+
return fieldState;
|
|
40
|
+
};
|
|
41
|
+
var [StrictFormFieldProvider, useStrictFormFieldContext] = createCustomContext(
|
|
42
|
+
{
|
|
43
|
+
hookName: "useFormFieldContext",
|
|
44
|
+
name: "StrictFormFieldContext",
|
|
45
|
+
providerName: "FormField"
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
var [LaxFormFieldProvider, useLaxFormFieldContext] = createCustomContext({
|
|
49
|
+
hookName: "useLaxFormFieldContext",
|
|
50
|
+
name: "LaxFormFieldContext",
|
|
51
|
+
providerName: "FormField",
|
|
42
52
|
strict: false
|
|
43
53
|
});
|
|
44
54
|
|
|
@@ -56,33 +66,68 @@ function FormRoot(props) {
|
|
|
56
66
|
children
|
|
57
67
|
));
|
|
58
68
|
}
|
|
59
|
-
function
|
|
69
|
+
function FormField(props) {
|
|
60
70
|
const { children, className, name, withWrapper = true } = props;
|
|
61
71
|
const uniqueId = useId();
|
|
62
|
-
const
|
|
63
|
-
() => ({
|
|
72
|
+
const fieldContextValue = useMemo(
|
|
73
|
+
() => ({
|
|
74
|
+
formDescriptionId: `${name}-(${uniqueId})-form-item-description`,
|
|
75
|
+
formItemId: `${name}-(${uniqueId})-form-item`,
|
|
76
|
+
formMessageId: `${name}-(${uniqueId})-form-item-message`,
|
|
77
|
+
name
|
|
78
|
+
}),
|
|
64
79
|
[name, uniqueId]
|
|
65
80
|
);
|
|
66
81
|
const WrapperElement = withWrapper ? "div" : Fragment;
|
|
67
82
|
const wrapperElementProps = withWrapper && {
|
|
68
83
|
className: cnMerge("flex flex-col", className),
|
|
69
|
-
"data-part": "
|
|
84
|
+
"data-part": "field",
|
|
70
85
|
"data-scope": "form"
|
|
71
86
|
};
|
|
72
|
-
return /* @__PURE__ */ React2.createElement(
|
|
87
|
+
return /* @__PURE__ */ React2.createElement(StrictFormFieldProvider, { value: fieldContextValue }, /* @__PURE__ */ React2.createElement(LaxFormFieldProvider, { value: fieldContextValue }, /* @__PURE__ */ React2.createElement(WrapperElement, { ...wrapperElementProps }, children)));
|
|
88
|
+
}
|
|
89
|
+
function FormControlledField(props) {
|
|
90
|
+
const { name } = props;
|
|
91
|
+
const uniqueId = useId();
|
|
92
|
+
const fieldContextValue = useMemo(
|
|
93
|
+
() => ({
|
|
94
|
+
formDescriptionId: `${name}-(${uniqueId})-form-item-description`,
|
|
95
|
+
formItemId: `${name}-(${uniqueId})-form-item`,
|
|
96
|
+
formMessageId: `${name}-(${uniqueId})-form-item-message`,
|
|
97
|
+
name
|
|
98
|
+
}),
|
|
99
|
+
[name, uniqueId]
|
|
100
|
+
);
|
|
101
|
+
return /* @__PURE__ */ React2.createElement(StrictFormFieldProvider, { value: fieldContextValue }, /* @__PURE__ */ React2.createElement(LaxFormFieldProvider, { value: fieldContextValue }, /* @__PURE__ */ React2.createElement(Controller, { ...props })));
|
|
73
102
|
}
|
|
74
|
-
function
|
|
103
|
+
function FormFieldController(props) {
|
|
104
|
+
const { control } = useFormRootContext();
|
|
105
|
+
const { name } = useStrictFormFieldContext();
|
|
106
|
+
const { render, ...restOfProps } = props;
|
|
107
|
+
return /* @__PURE__ */ React2.createElement(Controller, { name, control, render, ...restOfProps });
|
|
108
|
+
}
|
|
109
|
+
function FormFieldContext(props) {
|
|
75
110
|
const { children, render } = props;
|
|
76
|
-
const
|
|
111
|
+
const fieldContextValues = useStrictFormFieldContext();
|
|
77
112
|
if (typeof children === "function") {
|
|
78
|
-
return children(
|
|
113
|
+
return children(fieldContextValues);
|
|
79
114
|
}
|
|
80
|
-
return render(
|
|
115
|
+
return render(fieldContextValues);
|
|
81
116
|
}
|
|
82
117
|
function FormLabel(props) {
|
|
83
|
-
const {
|
|
118
|
+
const { formItemId } = useStrictFormFieldContext();
|
|
84
119
|
const { children, className, ...restOfProps } = props;
|
|
85
|
-
return /* @__PURE__ */ React2.createElement(
|
|
120
|
+
return /* @__PURE__ */ React2.createElement(
|
|
121
|
+
"label",
|
|
122
|
+
{
|
|
123
|
+
"data-scope": "form",
|
|
124
|
+
"data-part": "label",
|
|
125
|
+
htmlFor: formItemId,
|
|
126
|
+
className,
|
|
127
|
+
...restOfProps
|
|
128
|
+
},
|
|
129
|
+
children
|
|
130
|
+
);
|
|
86
131
|
}
|
|
87
132
|
function FormInputGroup(props) {
|
|
88
133
|
const { children, className, ...restOfProps } = props;
|
|
@@ -132,31 +177,31 @@ function FormInputRightItem(props) {
|
|
|
132
177
|
FormInputRightItem.slot = Symbol.for("rightItem");
|
|
133
178
|
var inputTypesWithoutFullWith = /* @__PURE__ */ new Set(["checkbox", "radio"]);
|
|
134
179
|
function FormInputPrimitive(props) {
|
|
135
|
-
const
|
|
180
|
+
const fieldContextValues = useLaxFormFieldContext();
|
|
136
181
|
const {
|
|
137
182
|
className,
|
|
138
183
|
classNames,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
id = contextValues?.uniqueId,
|
|
142
|
-
name = contextValues?.name,
|
|
184
|
+
id = fieldContextValues?.formItemId,
|
|
185
|
+
name = fieldContextValues?.name,
|
|
143
186
|
type = "text",
|
|
144
187
|
withEyeIcon = true,
|
|
145
188
|
...restOfProps
|
|
146
189
|
} = props;
|
|
147
|
-
const
|
|
148
|
-
const
|
|
190
|
+
const fieldState = useLaxGetFieldState(name);
|
|
191
|
+
const fieldError = fieldState?.error;
|
|
149
192
|
const [isPasswordVisible, toggleVisibility] = useToggle(false);
|
|
150
193
|
const shouldHaveEyeIcon = withEyeIcon && type === "password";
|
|
151
194
|
const WrapperElement = shouldHaveEyeIcon ? FormInputGroup : Fragment;
|
|
152
195
|
const wrapperElementProps = shouldHaveEyeIcon && {
|
|
153
|
-
className: cnMerge("w-full", classNames?.inputGroup,
|
|
196
|
+
className: cnMerge("w-full", classNames?.inputGroup, fieldError && classNames?.error)
|
|
154
197
|
};
|
|
155
198
|
return /* @__PURE__ */ React2.createElement(WrapperElement, { ...wrapperElementProps }, /* @__PURE__ */ React2.createElement(
|
|
156
199
|
"input",
|
|
157
200
|
{
|
|
158
201
|
"data-scope": "form",
|
|
159
202
|
"data-part": "input",
|
|
203
|
+
"aria-describedby": !fieldError ? fieldContextValues?.formDescriptionId : `${fieldContextValues?.formDescriptionId} ${fieldContextValues?.formMessageId}`,
|
|
204
|
+
"aria-invalid": Boolean(fieldError),
|
|
160
205
|
id,
|
|
161
206
|
name,
|
|
162
207
|
type: type === "password" && isPasswordVisible ? "text" : type,
|
|
@@ -167,7 +212,7 @@ function FormInputPrimitive(props) {
|
|
|
167
212
|
disabled:cursor-not-allowed disabled:opacity-50`,
|
|
168
213
|
className,
|
|
169
214
|
classNames?.input,
|
|
170
|
-
type !== "password" &&
|
|
215
|
+
type !== "password" && fieldError && classNames?.error
|
|
171
216
|
),
|
|
172
217
|
...restOfProps
|
|
173
218
|
}
|
|
@@ -182,78 +227,55 @@ function FormInputPrimitive(props) {
|
|
|
182
227
|
isPasswordVisible ? /* @__PURE__ */ React2.createElement(EyeIconInvisible, { className: cnMerge("size-full", classNames?.eyeIcon) }) : /* @__PURE__ */ React2.createElement(EyeIconVisible, { className: cnMerge("size-full", classNames?.eyeIcon) })
|
|
183
228
|
));
|
|
184
229
|
}
|
|
185
|
-
function FormInput(props) {
|
|
186
|
-
const { rules, ...restOfProps } = props;
|
|
187
|
-
const { name } = useStrictFormItemContext();
|
|
188
|
-
const { control, register } = useFormRootContext();
|
|
189
|
-
const formState = useFormState({ control, name });
|
|
190
|
-
return /* @__PURE__ */ React2.createElement(
|
|
191
|
-
FormInputPrimitive,
|
|
192
|
-
{
|
|
193
|
-
name,
|
|
194
|
-
formState,
|
|
195
|
-
...Boolean(name) && register(name, rules),
|
|
196
|
-
...restOfProps
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
230
|
function FormTextAreaPrimitive(props) {
|
|
201
|
-
const
|
|
231
|
+
const fieldContextValues = useLaxFormFieldContext();
|
|
202
232
|
const {
|
|
203
233
|
className,
|
|
204
|
-
control,
|
|
205
234
|
errorClassName,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
name = contextValues?.name,
|
|
235
|
+
id = fieldContextValues?.formItemId,
|
|
236
|
+
name = fieldContextValues?.name,
|
|
209
237
|
...restOfProps
|
|
210
238
|
} = props;
|
|
211
|
-
const
|
|
212
|
-
const
|
|
239
|
+
const fieldState = useLaxGetFieldState(name);
|
|
240
|
+
const fieldError = fieldState?.error;
|
|
213
241
|
return /* @__PURE__ */ React2.createElement(
|
|
214
242
|
"textarea",
|
|
215
243
|
{
|
|
216
244
|
"data-scope": "form",
|
|
217
245
|
"data-part": "textarea",
|
|
246
|
+
"aria-describedby": !fieldError ? fieldContextValues?.formDescriptionId : `${fieldContextValues?.formDescriptionId} ${fieldContextValues?.formMessageId}`,
|
|
247
|
+
"aria-invalid": Boolean(fieldError),
|
|
218
248
|
id,
|
|
219
249
|
name,
|
|
220
250
|
className: cnMerge(
|
|
221
251
|
`w-full bg-transparent text-sm placeholder:text-shadcn-muted-foreground
|
|
222
252
|
focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,
|
|
223
253
|
className,
|
|
224
|
-
|
|
254
|
+
fieldError && errorClassName
|
|
225
255
|
),
|
|
226
256
|
...restOfProps
|
|
227
257
|
}
|
|
228
258
|
);
|
|
229
259
|
}
|
|
230
|
-
function
|
|
231
|
-
const { rules, ...restOfProps } = props;
|
|
232
|
-
const { name } =
|
|
233
|
-
const {
|
|
234
|
-
const
|
|
260
|
+
function FormInput(props) {
|
|
261
|
+
const { rules, type, ...restOfProps } = props;
|
|
262
|
+
const { name } = useStrictFormFieldContext();
|
|
263
|
+
const { register } = useFormRootContext();
|
|
264
|
+
const SelectedInput = type === "textarea" ? FormTextAreaPrimitive : FormInputPrimitive;
|
|
235
265
|
return /* @__PURE__ */ React2.createElement(
|
|
236
|
-
|
|
266
|
+
SelectedInput,
|
|
237
267
|
{
|
|
268
|
+
type,
|
|
238
269
|
name,
|
|
239
|
-
formState,
|
|
240
270
|
...Boolean(name) && register(name, rules),
|
|
241
271
|
...restOfProps
|
|
242
272
|
}
|
|
243
273
|
);
|
|
244
274
|
}
|
|
245
|
-
var FormControllerPrimitive = (props) => {
|
|
246
|
-
return /* @__PURE__ */ React2.createElement(Controller, { ...props });
|
|
247
|
-
};
|
|
248
|
-
function FormController(props) {
|
|
249
|
-
const { control } = useFormRootContext();
|
|
250
|
-
const { name } = useStrictFormItemContext();
|
|
251
|
-
const { render, ...restOfProps } = props;
|
|
252
|
-
return /* @__PURE__ */ React2.createElement(FormControllerPrimitive, { name, control, render, ...restOfProps });
|
|
253
|
-
}
|
|
254
275
|
function FormDescription(props) {
|
|
255
276
|
const { className, ...restOfProps } = props;
|
|
256
|
-
|
|
277
|
+
const { formDescriptionId } = useLaxFormFieldContext() ?? {};
|
|
278
|
+
return /* @__PURE__ */ React2.createElement("p", { id: formDescriptionId, className: cnMerge("text-[12px]", className), ...restOfProps });
|
|
257
279
|
}
|
|
258
280
|
var FormErrorMessagePrimitive = (props) => {
|
|
259
281
|
const {
|
|
@@ -267,6 +289,7 @@ var FormErrorMessagePrimitive = (props) => {
|
|
|
267
289
|
withAnimationOnInvalid = true
|
|
268
290
|
} = props;
|
|
269
291
|
const formState = useFormState({ control });
|
|
292
|
+
const { formMessageId } = useLaxFormFieldContext() ?? {};
|
|
270
293
|
const wrapperRef = useRef(null);
|
|
271
294
|
const errorAnimationClass = classNames?.errorMessageAnimation ?? "animate-shake";
|
|
272
295
|
useEffect(() => {
|
|
@@ -300,6 +323,7 @@ var FormErrorMessagePrimitive = (props) => {
|
|
|
300
323
|
"data-index": index,
|
|
301
324
|
"data-part": "error-message",
|
|
302
325
|
"data-scope": "form",
|
|
326
|
+
id: formMessageId,
|
|
303
327
|
onAnimationEnd
|
|
304
328
|
});
|
|
305
329
|
const getRenderState = ({ errorMessage, index }) => ({
|
|
@@ -324,8 +348,8 @@ var FormErrorMessagePrimitive = (props) => {
|
|
|
324
348
|
);
|
|
325
349
|
};
|
|
326
350
|
function FormErrorMessage(props) {
|
|
327
|
-
const
|
|
328
|
-
const { className, errorField =
|
|
351
|
+
const fieldContextValues = useLaxFormFieldContext();
|
|
352
|
+
const { className, errorField = fieldContextValues?.name, type = "regular" } = props;
|
|
329
353
|
const { control } = useFormRootContext();
|
|
330
354
|
return /* @__PURE__ */ React2.createElement(
|
|
331
355
|
FormErrorMessagePrimitive,
|
|
@@ -345,14 +369,14 @@ function FormErrorMessage(props) {
|
|
|
345
369
|
}
|
|
346
370
|
);
|
|
347
371
|
}
|
|
348
|
-
function
|
|
372
|
+
function FormSubmit(props) {
|
|
349
373
|
const { as: Element = "button", asChild, children, type = "submit", ...restOfProps } = props;
|
|
350
374
|
const Component = asChild ? Slot : Element;
|
|
351
375
|
return /* @__PURE__ */ React2.createElement(Component, { type, ...restOfProps }, children);
|
|
352
376
|
}
|
|
353
377
|
function FormFieldSubscribe(props) {
|
|
354
|
-
const
|
|
355
|
-
const { children, name =
|
|
378
|
+
const fieldContextValues = useLaxFormFieldContext();
|
|
379
|
+
const { children, name = fieldContextValues?.name, render } = props;
|
|
356
380
|
const { control } = useFormRootContext();
|
|
357
381
|
const formValue = useWatch({ control, name });
|
|
358
382
|
const fieldProps = { value: formValue };
|
|
@@ -362,8 +386,8 @@ function FormFieldSubscribe(props) {
|
|
|
362
386
|
return render(fieldProps);
|
|
363
387
|
}
|
|
364
388
|
function FormStateSubscribe(props) {
|
|
365
|
-
const
|
|
366
|
-
const { children, control, name =
|
|
389
|
+
const fieldContextValues = useLaxFormFieldContext();
|
|
390
|
+
const { children, control, name = fieldContextValues?.name, render } = props;
|
|
367
391
|
const formState = useFormState({ control, name });
|
|
368
392
|
if (typeof children === "function") {
|
|
369
393
|
return children(formState);
|
|
@@ -374,27 +398,26 @@ function FormStateSubscribe(props) {
|
|
|
374
398
|
// src/components/ui/form/form-parts.ts
|
|
375
399
|
var form_parts_exports = {};
|
|
376
400
|
__export(form_parts_exports, {
|
|
377
|
-
|
|
378
|
-
ControllerPrimitive: () => FormControllerPrimitive,
|
|
401
|
+
ControlledField: () => FormControlledField,
|
|
379
402
|
Description: () => FormDescription,
|
|
380
403
|
ErrorMessage: () => FormErrorMessage,
|
|
381
404
|
ErrorMessagePrimitive: () => FormErrorMessagePrimitive,
|
|
405
|
+
Field: () => FormField,
|
|
406
|
+
FieldContext: () => FormFieldContext,
|
|
407
|
+
FieldController: () => FormFieldController,
|
|
382
408
|
FieldSubscribe: () => FormFieldSubscribe,
|
|
383
409
|
Input: () => FormInput,
|
|
384
410
|
InputGroup: () => FormInputGroup,
|
|
385
411
|
InputLeftItem: () => FormInputLeftItem,
|
|
386
412
|
InputPrimitive: () => FormInputPrimitive,
|
|
387
413
|
InputRightItem: () => FormInputRightItem,
|
|
388
|
-
Item: () => FormItem,
|
|
389
|
-
ItemContext: () => FormItemContext,
|
|
390
414
|
Label: () => FormLabel,
|
|
391
415
|
Root: () => FormRoot,
|
|
392
416
|
StateSubscribe: () => FormStateSubscribe,
|
|
393
|
-
|
|
394
|
-
TextArea: () => FormTextArea,
|
|
417
|
+
Submit: () => FormSubmit,
|
|
395
418
|
TextAreaPrimitive: () => FormTextAreaPrimitive
|
|
396
419
|
});
|
|
397
420
|
|
|
398
|
-
export {
|
|
399
|
-
//# sourceMappingURL=chunk-
|
|
400
|
-
//# sourceMappingURL=chunk-
|
|
421
|
+
export { FormControlledField, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldController, FormFieldSubscribe, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormStateSubscribe, FormSubmit, FormTextAreaPrimitive, form_parts_exports, useStrictFormFieldContext };
|
|
422
|
+
//# sourceMappingURL=chunk-FFJY632O.js.map
|
|
423
|
+
//# sourceMappingURL=chunk-FFJY632O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/icons/EyeIcon.tsx","../../src/components/ui/form/form-context.ts","../../src/components/ui/form/form.tsx","../../src/components/ui/form/form-parts.ts"],"names":["React","HookFormProvider","ReactFragment"],"mappings":";;;;;;;;;;;AAEO,IAAM,gBAAmB,GAAA,CAAC,KAChC,qBAAAA,MAAA,CAAA,aAAA,CAAC,SAAI,KAAM,EAAA,4BAAA,EAA6B,KAAM,EAAA,KAAA,EAAM,MAAO,EAAA,KAAA,EAAM,OAAQ,EAAA,WAAA,EAAa,GAAG,KACxF,EAAA,kBAAAA,MAAA,CAAA,aAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACA,IAAK,EAAA,cAAA;AAAA,IACL,CAAE,EAAA;AAAA;AACH,CACD,CAAA;AAGM,IAAM,cAAiB,GAAA,CAAC,KAC9B,qBAAAA,MAAA,CAAA,aAAA,CAAC,SAAI,KAAM,EAAA,4BAAA,EAA6B,KAAM,EAAA,KAAA,EAAM,MAAO,EAAA,KAAA,EAAM,OAAQ,EAAA,WAAA,EAAa,GAAG,KACxF,EAAA,kBAAAA,MAAA,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VGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<path\n\t\t\tfill=\"currentColor\"\n\t\t\td=\"M15.175 8.325q.725.725 1.063 1.65t.237 1.9q0 .375-.275.638t-.65.262t-.638-.262t-.262-.638q.125-.65-.075-1.25T13.95 9.6t-1.025-.65t-1.275-.1q-.375 0-.638-.275t-.262-.65t.263-.637t.637-.263q.95-.1 1.875.238t1.65 1.062M12 6q-.475 0-.925.037t-.9.138q-.425.075-.763-.125t-.462-.6t.088-.775t.612-.45q.575-.125 1.163-.175T12 4q3.425 0 6.263 1.8t4.337 4.85q.1.2.15.413t.05.437t-.038.438t-.137.412q-.45 1-1.112 1.875t-1.463 1.6q-.3.275-.7.225t-.65-.4t-.212-.763t.337-.687q.6-.575 1.1-1.25t.875-1.45q-1.25-2.525-3.613-4.012T12 6m0 13q-3.35 0-6.125-1.812T1.5 12.425q-.125-.2-.187-.437T1.25 11.5t.05-.475t.175-.45q.5-1 1.163-1.912T4.15 7L2.075 4.9q-.275-.3-.262-.712T2.1 3.5t.7-.275t.7.275l17 17q.275.275.288.688t-.288.712q-.275.275-.7.275t-.7-.275l-3.5-3.45q-.875.275-1.775.413T12 19M5.55 8.4q-.725.65-1.325 1.425T3.2 11.5q1.25 2.525 3.613 4.013T12 17q.5 0 .975-.062t.975-.138l-.9-.95q-.275.075-.525.113T12 16q-1.875 0-3.188-1.312T7.5 11.5q0-.275.038-.525t.112-.525zm4.2 4.2\"\n\t\t/>\n\t</svg>\n);\n\nexport const EyeIconVisible = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<path\n\t\t\tfill=\"currentColor\"\n\t\t\td=\"M12 16q1.875 0 3.188-1.312T16.5 11.5t-1.312-3.187T12 7T8.813 8.313T7.5 11.5t1.313 3.188T12 16m0-1.8q-1.125 0-1.912-.788T9.3 11.5t.788-1.912T12 8.8t1.913.788t.787 1.912t-.787 1.913T12 14.2m0 4.8q-3.35 0-6.113-1.8t-4.362-4.75q-.125-.225-.187-.462t-.063-.488t.063-.488t.187-.462q1.6-2.95 4.363-4.75T12 4t6.113 1.8t4.362 4.75q.125.225.188.463t.062.487t-.062.488t-.188.462q-1.6 2.95-4.362 4.75T12 19m0-2q2.825 0 5.188-1.487T20.8 11.5q-1.25-2.525-3.613-4.012T12 6T6.813 7.488T3.2 11.5q1.25 2.525 3.613 4.013T12 17\"\n\t\t/>\n\t</svg>\n);\n","import { ContextError, createCustomContext } from \"@zayne-labs/toolkit-react\";\nimport type { DiscriminatedRenderProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { type UseFormReturn, useFormContext } from \"react-hook-form\";\nimport type { FieldValues } from \"./form\";\n\nexport const useFormRootContext = () => {\n\tconst formContext = useFormContext() as UseFormReturn<FieldValues> | null;\n\n\tif (!formContext) {\n\t\tthrow new ContextError(\n\t\t\t`useFormRootContext returned \"null\". Did you forget to wrap the necessary components within FormRoot?`\n\t\t);\n\t}\n\n\treturn formContext;\n};\n\nexport type FieldContextValue = {\n\tformDescriptionId: `${string}-(${string})-form-item-description`;\n\tformItemId: `${string}-(${string})-form-item`;\n\tformMessageId: `${string}-(${string})-form-item-message`;\n\tname: string;\n};\n\nexport type FormFieldContextProps = DiscriminatedRenderProps<\n\t(contextValue: FieldContextValue) => React.ReactNode\n>;\n\nexport const useStrictGetFieldState = () => {\n\tconst { name } = useStrictFormFieldContext();\n\n\tconst { formState, getFieldState } = useFormRootContext();\n\n\tconst fieldState = getFieldState(name, formState);\n\n\treturn fieldState;\n};\n\nexport const useLaxGetFieldState = (name: string | undefined) => {\n\tconst { formState, getFieldState } = useFormRootContext();\n\n\tif (!name) return;\n\n\tconst fieldState = getFieldState(name, formState);\n\n\treturn fieldState;\n};\n\nexport const [StrictFormFieldProvider, useStrictFormFieldContext] = createCustomContext<FieldContextValue>(\n\t{\n\t\thookName: \"useFormFieldContext\",\n\t\tname: \"StrictFormFieldContext\",\n\t\tproviderName: \"FormField\",\n\t}\n);\n\nexport const [LaxFormFieldProvider, useLaxFormFieldContext] = createCustomContext<\n\tFieldContextValue,\n\tfalse\n>({\n\thookName: \"useLaxFormFieldContext\",\n\tname: \"LaxFormFieldContext\",\n\tproviderName: \"FormField\",\n\tstrict: false,\n});\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { Slot } from \"@/components/common\";\nimport { getElementList } from \"@/components/common/for\";\nimport { EyeIconInvisible, EyeIconVisible } from \"@/components/icons\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport { toArray } from \"@zayne-labs/toolkit-core\";\nimport { useToggle } from \"@zayne-labs/toolkit-react\";\nimport {\n\ttype DiscriminatedRenderProps,\n\ttype InferProps,\n\ttype PolymorphicProps,\n\tgetOtherChildren,\n\tgetSlotElement,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport { Fragment as ReactFragment, useEffect, useId, useMemo, useRef } from \"react\";\nimport {\n\ttype Control,\n\tController,\n\ttype ControllerFieldState,\n\ttype ControllerProps,\n\ttype ControllerRenderProps,\n\ttype FieldPath,\n\ttype FieldPathValue,\n\ttype FieldPathValues,\n\tFormProvider as HookFormProvider,\n\ttype RegisterOptions,\n\ttype UseFormReturn,\n\ttype UseFormStateReturn,\n\tuseFormState,\n\tuseWatch,\n} from \"react-hook-form\";\nimport {\n\ttype FieldContextValue,\n\ttype FormFieldContextProps,\n\tLaxFormFieldProvider,\n\tStrictFormFieldProvider,\n\tuseFormRootContext,\n\tuseLaxFormFieldContext,\n\tuseLaxGetFieldState,\n\tuseStrictFormFieldContext,\n} from \"./form-context\";\n\nexport type FieldValues = Record<string, unknown>;\n\ntype FormRootProps<TFieldValues extends FieldValues> = React.ComponentPropsWithoutRef<\"form\"> & {\n\tchildren: React.ReactNode;\n\tmethods: UseFormReturn<TFieldValues>;\n};\n\nexport function FormRoot<TValues extends FieldValues>(props: FormRootProps<TValues>) {\n\tconst { children, className, methods, ...restOfProps } = props;\n\n\treturn (\n\t\t<HookFormProvider {...methods}>\n\t\t\t<form\n\t\t\t\tclassName={cnMerge(\"flex flex-col\", className)}\n\t\t\t\t{...restOfProps}\n\t\t\t\tdata-scope=\"form\"\n\t\t\t\tdata-part=\"root\"\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</form>\n\t\t</HookFormProvider>\n\t);\n}\n\ntype FormFieldProps<TControl, TFieldValues extends FieldValues> = (TControl extends Control<infer TValues>\n\t? {\n\t\t\tcontrol?: never;\n\t\t\tname: FieldPath<TValues>;\n\t\t}\n\t: {\n\t\t\tcontrol?: Control<TFieldValues>;\n\t\t\tname: FieldPath<TFieldValues>;\n\t\t})\n\t& (\n\t\t| (InferProps<\"div\"> & {\n\t\t\t\twithWrapper?: true;\n\t\t })\n\t\t| { children: React.ReactNode; className?: never; withWrapper: false }\n\t);\n\nexport function FormField<TControl, TFieldValues extends FieldValues = FieldValues>(\n\tprops: FormFieldProps<TControl, TFieldValues>\n) {\n\tconst { children, className, name, withWrapper = true } = props;\n\n\tconst uniqueId = useId();\n\n\tconst fieldContextValue = useMemo(\n\t\t() =>\n\t\t\t({\n\t\t\t\tformDescriptionId: `${name}-(${uniqueId})-form-item-description`,\n\t\t\t\tformItemId: `${name}-(${uniqueId})-form-item`,\n\t\t\t\tformMessageId: `${name}-(${uniqueId})-form-item-message`,\n\t\t\t\tname,\n\t\t\t}) satisfies FieldContextValue,\n\t\t[name, uniqueId]\n\t);\n\n\tconst WrapperElement = withWrapper ? \"div\" : ReactFragment;\n\n\tconst wrapperElementProps = withWrapper && {\n\t\tclassName: cnMerge(\"flex flex-col\", className),\n\t\t\"data-part\": \"field\",\n\t\t\"data-scope\": \"form\",\n\t};\n\n\treturn (\n\t\t<StrictFormFieldProvider value={fieldContextValue}>\n\t\t\t<LaxFormFieldProvider value={fieldContextValue}>\n\t\t\t\t<WrapperElement {...wrapperElementProps}>{children}</WrapperElement>\n\t\t\t</LaxFormFieldProvider>\n\t\t</StrictFormFieldProvider>\n\t);\n}\n\nexport function FormControlledField<TFieldValues extends FieldValues>(\n\tprops: ControllerProps<TFieldValues>\n) {\n\tconst { name } = props;\n\n\tconst uniqueId = useId();\n\n\tconst fieldContextValue = useMemo(\n\t\t() =>\n\t\t\t({\n\t\t\t\tformDescriptionId: `${name}-(${uniqueId})-form-item-description`,\n\t\t\t\tformItemId: `${name}-(${uniqueId})-form-item`,\n\t\t\t\tformMessageId: `${name}-(${uniqueId})-form-item-message`,\n\t\t\t\tname,\n\t\t\t}) satisfies FieldContextValue,\n\t\t[name, uniqueId]\n\t);\n\n\treturn (\n\t\t<StrictFormFieldProvider value={fieldContextValue}>\n\t\t\t<LaxFormFieldProvider value={fieldContextValue}>\n\t\t\t\t<Controller {...props} />\n\t\t\t</LaxFormFieldProvider>\n\t\t</StrictFormFieldProvider>\n\t);\n}\n\ntype FormFieldControllerRenderFn = (props: {\n\tfield: Omit<ControllerRenderProps, \"value\"> & {\n\t\tvalue: never;\n\t};\n\tfieldState: ControllerFieldState;\n\tformState: UseFormStateReturn<never>;\n}) => React.ReactElement;\n\ntype FormFieldControllerProps = Omit<\n\tControllerProps<FieldValues, FieldPath<FieldValues>>,\n\t\"control\" | \"name\" | \"render\"\n> & {\n\trender: FormFieldControllerRenderFn;\n};\n\nexport function FormFieldController(props: FormFieldControllerProps) {\n\tconst { control } = useFormRootContext();\n\tconst { name } = useStrictFormFieldContext();\n\tconst { render, ...restOfProps } = props;\n\n\treturn <Controller name={name} control={control} render={render as never} {...restOfProps} />;\n}\n\nexport function FormFieldContext(props: FormFieldContextProps) {\n\tconst { children, render } = props;\n\tconst fieldContextValues = useStrictFormFieldContext();\n\n\tif (typeof children === \"function\") {\n\t\treturn children(fieldContextValues);\n\t}\n\n\treturn render(fieldContextValues);\n}\n\nexport function FormLabel(props: InferProps<\"label\">) {\n\tconst { formItemId } = useStrictFormFieldContext();\n\tconst { children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<label\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"label\"\n\t\t\thtmlFor={formItemId}\n\t\t\tclassName={className}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</label>\n\t);\n}\n\nexport function FormInputGroup(props: React.ComponentPropsWithRef<\"div\">) {\n\tconst { children, className, ...restOfProps } = props;\n\tconst LeftItemSlot = getSlotElement(children, FormInputLeftItem);\n\tconst RightItemSlot = getSlotElement(children, FormInputRightItem);\n\n\tconst otherChildren = getOtherChildren(children, [FormInputLeftItem, FormInputRightItem]);\n\n\treturn (\n\t\t<div\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"input-group\"\n\t\t\tclassName={cnMerge(\"flex items-center justify-between gap-2\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{LeftItemSlot}\n\t\t\t{otherChildren}\n\t\t\t{RightItemSlot}\n\t\t</div>\n\t);\n}\n\ntype FormSideItemProps = {\n\tchildren?: React.ReactNode;\n\tclassName?: string;\n};\n\nexport function FormInputLeftItem<TElement extends React.ElementType = \"span\">(\n\tprops: PolymorphicProps<TElement, FormSideItemProps>\n) {\n\tconst { as: Element = \"span\", children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"left-item\"\n\t\t\tclassName={cnMerge(\"inline-flex items-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</Element>\n\t);\n}\nFormInputLeftItem.slot = Symbol.for(\"leftItem\");\n\nexport function FormInputRightItem<TElement extends React.ElementType = \"span\">(\n\tprops: PolymorphicProps<TElement, FormSideItemProps>\n) {\n\tconst { as: Element = \"span\", children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"right-item\"\n\t\t\tclassName={cnMerge(\"inline-flex items-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</Element>\n\t);\n}\nFormInputRightItem.slot = Symbol.for(\"rightItem\");\n\ntype FormInputPrimitiveProps<TFieldValues extends FieldValues = FieldValues> = Omit<\n\tReact.ComponentPropsWithRef<\"input\">,\n\t\"children\"\n> & {\n\tclassNames?: { error?: string; eyeIcon?: string; input?: string; inputGroup?: string };\n\tcontrol?: Control<TFieldValues>;\n\tname?: FieldPath<TFieldValues>;\n\twithEyeIcon?: boolean;\n};\n\ntype FormTextAreaPrimitiveProps<TFieldValues extends FieldValues = FieldValues> =\n\tReact.ComponentPropsWithRef<\"textarea\"> & {\n\t\tcontrol?: Control<TFieldValues>;\n\t\terrorClassName?: string;\n\t\tname?: FieldPath<TFieldValues>;\n\t\ttype: \"textarea\";\n\t};\n\nconst inputTypesWithoutFullWith = new Set<React.HTMLInputTypeAttribute>([\"checkbox\", \"radio\"]);\n\nexport function FormInputPrimitive<TFieldValues extends FieldValues>(\n\tprops: FormInputPrimitiveProps<TFieldValues>\n) {\n\tconst fieldContextValues = useLaxFormFieldContext();\n\n\tconst {\n\t\tclassName,\n\t\tclassNames,\n\t\tid = fieldContextValues?.formItemId,\n\t\tname = fieldContextValues?.name,\n\t\ttype = \"text\",\n\t\twithEyeIcon = true,\n\t\t...restOfProps\n\t} = props;\n\n\tconst fieldState = useLaxGetFieldState(name);\n\n\tconst fieldError = fieldState?.error;\n\n\tconst [isPasswordVisible, toggleVisibility] = useToggle(false);\n\n\tconst shouldHaveEyeIcon = withEyeIcon && type === \"password\";\n\n\tconst WrapperElement = shouldHaveEyeIcon ? FormInputGroup : ReactFragment;\n\n\tconst wrapperElementProps = shouldHaveEyeIcon && {\n\t\tclassName: cnMerge(\"w-full\", classNames?.inputGroup, fieldError && classNames?.error),\n\t};\n\n\treturn (\n\t\t<WrapperElement {...wrapperElementProps}>\n\t\t\t<input\n\t\t\t\tdata-scope=\"form\"\n\t\t\t\tdata-part=\"input\"\n\t\t\t\taria-describedby={\n\t\t\t\t\t!fieldError\n\t\t\t\t\t\t? fieldContextValues?.formDescriptionId\n\t\t\t\t\t\t: `${fieldContextValues?.formDescriptionId} ${fieldContextValues?.formMessageId}`\n\t\t\t\t}\n\t\t\t\taria-invalid={Boolean(fieldError)}\n\t\t\t\tid={id}\n\t\t\t\tname={name}\n\t\t\t\ttype={type === \"password\" && isPasswordVisible ? \"text\" : type}\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t!inputTypesWithoutFullWith.has(type) && \"flex w-full\",\n\t\t\t\t\t`bg-transparent text-sm file:border-0 file:bg-transparent\n\t\t\t\t\tplaceholder:text-shadcn-muted-foreground focus-visible:outline-none\n\t\t\t\t\tdisabled:cursor-not-allowed disabled:opacity-50`,\n\t\t\t\t\tclassName,\n\t\t\t\t\tclassNames?.input,\n\t\t\t\t\ttype !== \"password\" && fieldError && classNames?.error\n\t\t\t\t)}\n\t\t\t\t{...restOfProps}\n\t\t\t/>\n\n\t\t\t{shouldHaveEyeIcon && (\n\t\t\t\t<FormInputRightItem\n\t\t\t\t\tas=\"button\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={toggleVisibility}\n\t\t\t\t\tclassName=\"size-5 shrink-0 lg:size-6\"\n\t\t\t\t>\n\t\t\t\t\t{isPasswordVisible ? (\n\t\t\t\t\t\t<EyeIconInvisible className={cnMerge(\"size-full\", classNames?.eyeIcon)} />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EyeIconVisible className={cnMerge(\"size-full\", classNames?.eyeIcon)} />\n\t\t\t\t\t)}\n\t\t\t\t</FormInputRightItem>\n\t\t\t)}\n\t\t</WrapperElement>\n\t);\n}\n\nexport function FormTextAreaPrimitive<TFieldValues extends FieldValues>(\n\tprops: FormTextAreaPrimitiveProps<TFieldValues>\n) {\n\tconst fieldContextValues = useLaxFormFieldContext();\n\n\tconst {\n\t\tclassName,\n\t\terrorClassName,\n\t\tid = fieldContextValues?.formItemId,\n\t\tname = fieldContextValues?.name,\n\t\t...restOfProps\n\t} = props;\n\n\tconst fieldState = useLaxGetFieldState(name);\n\n\tconst fieldError = fieldState?.error;\n\n\treturn (\n\t\t<textarea\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"textarea\"\n\t\t\taria-describedby={\n\t\t\t\t!fieldError\n\t\t\t\t\t? fieldContextValues?.formDescriptionId\n\t\t\t\t\t: `${fieldContextValues?.formDescriptionId} ${fieldContextValues?.formMessageId}`\n\t\t\t}\n\t\t\taria-invalid={Boolean(fieldError)}\n\t\t\tid={id}\n\t\t\tname={name}\n\t\t\tclassName={cnMerge(\n\t\t\t\t`w-full bg-transparent text-sm placeholder:text-shadcn-muted-foreground\n\t\t\t\tfocus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,\n\t\t\t\tclassName,\n\t\t\t\tfieldError && errorClassName\n\t\t\t)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\ntype PrimitivePropsToOmit = \"control\" | \"formState\" | \"name\" | \"ref\";\ntype FormInputProps =\n\t| Omit<FormInputPrimitiveProps, PrimitivePropsToOmit>\n\t| Omit<FormTextAreaPrimitiveProps & { type: \"textarea\" }, PrimitivePropsToOmit>;\n\nexport function FormInput(props: FormInputProps & { rules?: RegisterOptions }) {\n\tconst { rules, type, ...restOfProps } = props;\n\n\tconst { name } = useStrictFormFieldContext();\n\tconst { register } = useFormRootContext();\n\n\tconst SelectedInput = type === \"textarea\" ? FormTextAreaPrimitive : FormInputPrimitive;\n\n\treturn (\n\t\t<SelectedInput\n\t\t\ttype={type as never}\n\t\t\tname={name}\n\t\t\t{...(Boolean(name) && register(name, rules))}\n\t\t\t{...(restOfProps as NonNullable<unknown>)}\n\t\t/>\n\t);\n}\n\nexport function FormDescription(props: InferProps<\"p\">) {\n\tconst { className, ...restOfProps } = props;\n\n\tconst { formDescriptionId } = useLaxFormFieldContext() ?? {};\n\n\treturn <p id={formDescriptionId} className={cnMerge(\"text-[12px]\", className)} {...restOfProps} />;\n}\n\ntype ErrorMessageRenderProps = {\n\tclassName: string;\n\t\"data-index\": number;\n\t\"data-part\": string;\n\t\"data-scope\": string;\n\tid: string | undefined;\n\tonAnimationEnd?: React.ReactEventHandler<HTMLElement>;\n};\n\ntype ErrorMessageRenderState = { errorMessage: string; errorMessageArray: string[]; index: number };\n\ntype ErrorMessageRenderFn = (context: {\n\tprops: ErrorMessageRenderProps;\n\tstate: ErrorMessageRenderState;\n}) => React.ReactNode;\n\ntype FormErrorMessagePrimitiveProps<TFieldValues extends FieldValues> =\n\tDiscriminatedRenderProps<ErrorMessageRenderFn> & {\n\t\tclassName?: string;\n\t\tclassNames?: {\n\t\t\tcontainer?: string;\n\t\t\terrorMessage?: string;\n\t\t\terrorMessageAnimation?: string;\n\t\t};\n\t\tcontrol: Control<TFieldValues>; // == Here for type inference of errorField prop\n\t\twithAnimationOnInvalid?: boolean;\n\t} & (\n\t\t\t| {\n\t\t\t\t\terrorField: FieldPath<TFieldValues>;\n\t\t\t\t\ttype?: \"regular\";\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\terrorField: string;\n\t\t\t\t\ttype: \"root\";\n\t\t\t }\n\t\t);\n\ntype FormErrorMessagePrimitiveType = {\n\t<TFieldValues extends FieldValues>(\n\t\tprops: Extract<FormErrorMessagePrimitiveProps<TFieldValues>, { type?: \"regular\" }>\n\t): React.ReactNode;\n\t<TFieldValues extends FieldValues>(\n\t\t// eslint-disable-next-line ts-eslint/unified-signatures -- Using overloads are better because it gives better error messages\n\t\tprops: Extract<FormErrorMessagePrimitiveProps<TFieldValues>, { type: \"root\" }>\n\t): React.ReactNode;\n};\n\nexport const FormErrorMessagePrimitive: FormErrorMessagePrimitiveType = (props) => {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tclassNames,\n\t\tcontrol,\n\t\terrorField,\n\t\trender,\n\t\ttype = \"regular\",\n\t\twithAnimationOnInvalid = true,\n\t} = props;\n\n\tconst formState = useFormState({ control });\n\n\tconst { formMessageId } = useLaxFormFieldContext() ?? {};\n\n\tconst wrapperRef = useRef<HTMLUListElement>(null);\n\n\tconst errorAnimationClass = classNames?.errorMessageAnimation ?? \"animate-shake\";\n\n\tuseEffect(() => {\n\t\tif (!withAnimationOnInvalid) return;\n\n\t\tconst errorMessageElements = wrapperRef.current?.children;\n\n\t\tif (!errorMessageElements) return;\n\n\t\tfor (const element of errorMessageElements) {\n\t\t\telement.classList.add(errorAnimationClass);\n\t\t}\n\t}, [errorAnimationClass, withAnimationOnInvalid]);\n\n\tuseEffect(() => {\n\t\tconst errorMessageElements = wrapperRef.current?.children;\n\n\t\tif (!errorMessageElements) return;\n\n\t\t// == Scroll to first error message\n\t\tif (Object.keys(formState.errors).indexOf(errorField as string) === 0) {\n\t\t\terrorMessageElements[0]?.scrollIntoView({\n\t\t\t\tbehavior: \"smooth\",\n\t\t\t\tblock: \"center\",\n\t\t\t});\n\n\t\t\twindow.scrollBy({ behavior: \"smooth\", top: -100 });\n\t\t}\n\t}, [errorField, formState.errors]);\n\n\tconst message = (\n\t\ttype === \"root\"\n\t\t\t? formState.errors.root?.[errorField as string]?.message\n\t\t\t: formState.errors[errorField]?.message\n\t) as string | string[];\n\n\tif (!message) {\n\t\treturn null;\n\t}\n\n\tconst errorMessageArray = toArray(message);\n\n\tconst [ErrorMessageList] = getElementList();\n\n\tconst onAnimationEnd: React.AnimationEventHandler<HTMLElement> | undefined = withAnimationOnInvalid\n\t\t? (event) => event.currentTarget.classList.remove(errorAnimationClass)\n\t\t: undefined;\n\n\tconst getRenderProps = ({ index }: { index: number }) =>\n\t\t({\n\t\t\tclassName: cnMerge(errorAnimationClass, className, classNames?.errorMessage),\n\t\t\t\"data-index\": index,\n\t\t\t\"data-part\": \"error-message\",\n\t\t\t\"data-scope\": \"form\",\n\t\t\tid: formMessageId,\n\t\t\tonAnimationEnd,\n\t\t}) satisfies ErrorMessageRenderProps;\n\n\tconst getRenderState = ({ errorMessage, index }: { errorMessage: string; index: number }) =>\n\t\t({\n\t\t\terrorMessage,\n\t\t\terrorMessageArray,\n\t\t\tindex,\n\t\t}) satisfies ErrorMessageRenderState;\n\n\tconst renderFn = typeof children === \"function\" ? children : render;\n\n\treturn (\n\t\t<ErrorMessageList\n\t\t\tref={wrapperRef}\n\t\t\teach={errorMessageArray}\n\t\t\tclassName={cnMerge(\"flex flex-col\", classNames?.container)}\n\t\t\trender={(errorMessage, index) => {\n\t\t\t\treturn renderFn({\n\t\t\t\t\tprops: getRenderProps({ index }),\n\t\t\t\t\tstate: getRenderState({ errorMessage, index }),\n\t\t\t\t});\n\t\t\t}}\n\t\t/>\n\t);\n};\n\ntype FormErrorMessageProps<TControl, TFieldValues extends FieldValues> =\n\t| (TControl extends Control<infer TValues>\n\t\t\t? {\n\t\t\t\t\tclassName?: string;\n\t\t\t\t\tcontrol?: never;\n\t\t\t\t\terrorField?: FieldPath<TValues>;\n\t\t\t\t\ttype?: \"regular\";\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tclassName?: string;\n\t\t\t\t\tcontrol?: Control<TFieldValues>; // == Here for type inference of errorField prop\n\t\t\t\t\terrorField?: FieldPath<TFieldValues>;\n\t\t\t\t\ttype?: \"regular\";\n\t\t\t\t})\n\t| {\n\t\t\tclassName?: string;\n\t\t\tcontrol?: never;\n\t\t\terrorField: string;\n\t\t\ttype: \"root\";\n\t };\n\nexport function FormErrorMessage<TControl, TFieldValues extends FieldValues = FieldValues>(\n\tprops: FormErrorMessageProps<TControl, TFieldValues>\n) {\n\tconst fieldContextValues = useLaxFormFieldContext();\n\n\tconst { className, errorField = fieldContextValues?.name, type = \"regular\" } = props;\n\n\tconst { control } = useFormRootContext();\n\n\treturn (\n\t\t<FormErrorMessagePrimitive\n\t\t\tcontrol={control}\n\t\t\terrorField={errorField as NonNullable<typeof errorField>}\n\t\t\ttype={type as \"root\"}\n\t\t\trender={({ props: renderProps, state: { errorMessage } }) => (\n\t\t\t\t<p\n\t\t\t\t\t{...renderProps}\n\t\t\t\t\tkey={errorMessage}\n\t\t\t\t\tclassName={cnMerge(\"text-[13px]\", \"data-[index=0]:mt-1\", renderProps.className, className)}\n\t\t\t\t>\n\t\t\t\t\t{errorMessage}\n\t\t\t\t</p>\n\t\t\t)}\n\t\t/>\n\t);\n}\n\ntype FormSubmitProps = InferProps<\"button\"> & { asChild?: boolean };\n\nexport function FormSubmit<TElement extends React.ElementType = \"button\">(\n\tprops: PolymorphicProps<TElement, FormSubmitProps>\n) {\n\tconst { as: Element = \"button\", asChild, children, type = \"submit\", ...restOfProps } = props;\n\n\tconst Component = asChild ? Slot : Element;\n\n\treturn (\n\t\t<Component type={type} {...restOfProps}>\n\t\t\t{children}\n\t\t</Component>\n\t);\n}\n\ntype GetFieldValue<TFieldPathOrPaths, TFieldValues extends FieldValues> =\n\tTFieldPathOrPaths extends Array<FieldPath<TFieldValues>>\n\t\t? FieldPathValues<TFieldValues, TFieldPathOrPaths>\n\t\t: TFieldPathOrPaths extends FieldPath<TFieldValues>\n\t\t\t? FieldPathValue<TFieldValues, TFieldPathOrPaths>\n\t\t\t: unknown;\n\ntype FieldSubscribeRenderFn<TFieldValues extends FieldValues, TFieldPathOrPaths> = (props: {\n\tvalue: GetFieldValue<TFieldPathOrPaths, TFieldValues>;\n}) => React.ReactNode;\n\ntype FormFieldSubscribeProps<\n\tTFieldValues extends FieldValues,\n\tTFieldPathOrPaths,\n> = DiscriminatedRenderProps<FieldSubscribeRenderFn<TFieldValues, TFieldPathOrPaths>> & {\n\tcontrol: Control<TFieldValues>;\n\tname?: TFieldPathOrPaths;\n};\n\nexport function FormFieldSubscribe<\n\tTFieldValues extends FieldValues,\n\tconst TFieldPathOrPaths extends Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues>,\n>(props: FormFieldSubscribeProps<TFieldValues, TFieldPathOrPaths>) {\n\tconst fieldContextValues = useLaxFormFieldContext();\n\n\tconst { children, name = fieldContextValues?.name, render } = props;\n\n\tconst { control } = useFormRootContext();\n\n\tconst formValue = useWatch({ control, name: name as string });\n\n\tconst fieldProps = { value: formValue };\n\n\tif (typeof children === \"function\") {\n\t\treturn children(fieldProps as never);\n\t}\n\n\treturn render(fieldProps as never);\n}\n\ntype FormStateSubscribeRenderFn<TFieldValues extends FieldValues> = (\n\tprops: UseFormStateReturn<TFieldValues>\n) => React.ReactNode;\n\ntype FormStateSubscribeProps<TFieldValues extends FieldValues> = DiscriminatedRenderProps<\n\tFormStateSubscribeRenderFn<TFieldValues>\n> & {\n\tcontrol?: Control<TFieldValues>;\n\tname?: Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues>;\n};\n\nexport function FormStateSubscribe<TFieldValues extends FieldValues = FieldValues>(\n\tprops: FormStateSubscribeProps<TFieldValues>\n) {\n\tconst fieldContextValues = useLaxFormFieldContext();\n\n\tconst { children, control, name = fieldContextValues?.name, render } = props;\n\n\tconst formState = useFormState({ control, name: name as FieldPath<TFieldValues> });\n\n\tif (typeof children === \"function\") {\n\t\treturn children(formState as never);\n\t}\n\n\treturn render(formState as never);\n}\n","export {\n\tFormFieldController as FieldController,\n\tFormControlledField as ControlledField,\n\tFormDescription as Description,\n\tFormErrorMessage as ErrorMessage,\n\tFormErrorMessagePrimitive as ErrorMessagePrimitive,\n\tFormInput as Input,\n\tFormInputGroup as InputGroup,\n\tFormInputLeftItem as InputLeftItem,\n\tFormInputPrimitive as InputPrimitive,\n\tFormInputRightItem as InputRightItem,\n\tFormField as Field,\n\tFormFieldContext as FieldContext,\n\tFormLabel as Label,\n\tFormRoot as Root,\n\tFormSubmit as Submit,\n\tFormStateSubscribe as StateSubscribe,\n\tFormFieldSubscribe as FieldSubscribe,\n\tFormTextAreaPrimitive as TextAreaPrimitive,\n} from \"./form\";\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, C
|
|
|
2
2
|
export { Carousel, CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselContent, CarouselContentProps, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselIndicatorProps, CarouselItem, CarouselItemGroup, CarouselProviderProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps } from './ui/carousel/index.js';
|
|
3
3
|
export { useDragScroll } from './ui/drag-scroll/index.js';
|
|
4
4
|
export { DropZone, InputProps, RootProps, UseDropZoneProps, useDropZone } from './ui/drop-zone/index.js';
|
|
5
|
-
export { FieldValues, Form,
|
|
5
|
+
export { FieldValues, Form, FormControlledField, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldController, FormFieldSubscribe, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormStateSubscribe, FormSubmit, FormTextAreaPrimitive, useFormFieldContext } from './ui/form/index.js';
|
|
6
6
|
export { ForBase, ForList, ForRenderProps, getElementList } from './common/for/index.js';
|
|
7
7
|
export { Show, ShowContent, ShowFallback, ShowRoot } from './common/show/index.js';
|
|
8
8
|
export { Slot, Slottable } from './common/slot/index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import './chunk-PNYEIX7F.js';
|
|
2
|
-
export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup } from './chunk-GVL6BLX5.js';
|
|
3
|
-
export { useDragScroll } from './chunk-Y7TF3SRM.js';
|
|
4
2
|
export { card_parts_exports as Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from './chunk-PXYYL2LL.js';
|
|
3
|
+
export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup } from './chunk-GVL6BLX5.js';
|
|
4
|
+
export { useDragScroll } from './chunk-E42DOTGX.js';
|
|
5
5
|
export { DropZone, useDropZone } from './chunk-2YCUMTC7.js';
|
|
6
|
-
export { form_parts_exports as Form,
|
|
6
|
+
export { form_parts_exports as Form, FormControlledField, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldController, FormFieldSubscribe, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormStateSubscribe, FormSubmit, FormTextAreaPrimitive, useStrictFormFieldContext as useFormFieldContext } from './chunk-FFJY632O.js';
|
|
7
7
|
import './chunk-OHG7GB7O.js';
|
|
8
8
|
import './chunk-HKPJTORQ.js';
|
|
9
9
|
export { ForBase, ForList, getElementList } from './chunk-DW3FXTFL.js';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { DiscriminatedRenderProps, InferProps, PolymorphicProps } from '@zayne-labs/toolkit-react/utils';
|
|
3
|
-
import {
|
|
4
|
-
import { ControllerProps, FieldPath, ControllerRenderProps, ControllerFieldState, UseFormStateReturn, Controller, Control, FormState, RegisterOptions, UseFormReturn, FieldPathValues, FieldPathValue } from 'react-hook-form';
|
|
3
|
+
import { ControllerProps, FieldPath, ControllerRenderProps, ControllerFieldState, UseFormStateReturn, Control, RegisterOptions, UseFormReturn, FieldPathValues, FieldPathValue } from 'react-hook-form';
|
|
5
4
|
|
|
6
|
-
type
|
|
5
|
+
type FieldContextValue = {
|
|
6
|
+
formDescriptionId: `${string}-(${string})-form-item-description`;
|
|
7
|
+
formItemId: `${string}-(${string})-form-item`;
|
|
8
|
+
formMessageId: `${string}-(${string})-form-item-message`;
|
|
7
9
|
name: string;
|
|
8
|
-
uniqueId: string;
|
|
9
10
|
};
|
|
10
|
-
type
|
|
11
|
-
declare const
|
|
11
|
+
type FormFieldContextProps = DiscriminatedRenderProps<(contextValue: FieldContextValue) => React.ReactNode>;
|
|
12
|
+
declare const useStrictFormFieldContext: () => FieldContextValue;
|
|
12
13
|
|
|
13
14
|
type FieldValues = Record<string, unknown>;
|
|
14
15
|
type FormRootProps<TFieldValues extends FieldValues> = react.ComponentPropsWithoutRef<"form"> & {
|
|
@@ -16,19 +17,33 @@ type FormRootProps<TFieldValues extends FieldValues> = react.ComponentPropsWitho
|
|
|
16
17
|
methods: UseFormReturn<TFieldValues>;
|
|
17
18
|
};
|
|
18
19
|
declare function FormRoot<TValues extends FieldValues>(props: FormRootProps<TValues>): react.JSX.Element;
|
|
19
|
-
type
|
|
20
|
+
type FormFieldProps<TControl, TFieldValues extends FieldValues> = (TControl extends Control<infer TValues> ? {
|
|
20
21
|
control?: never;
|
|
21
22
|
name: FieldPath<TValues>;
|
|
22
23
|
} : {
|
|
23
24
|
control?: Control<TFieldValues>;
|
|
24
25
|
name: FieldPath<TFieldValues>;
|
|
25
|
-
}) & {
|
|
26
|
+
}) & ((InferProps<"div"> & {
|
|
27
|
+
withWrapper?: true;
|
|
28
|
+
}) | {
|
|
26
29
|
children: react.ReactNode;
|
|
27
|
-
className?:
|
|
28
|
-
withWrapper
|
|
30
|
+
className?: never;
|
|
31
|
+
withWrapper: false;
|
|
32
|
+
});
|
|
33
|
+
declare function FormField<TControl, TFieldValues extends FieldValues = FieldValues>(props: FormFieldProps<TControl, TFieldValues>): react.JSX.Element;
|
|
34
|
+
declare function FormControlledField<TFieldValues extends FieldValues>(props: ControllerProps<TFieldValues>): react.JSX.Element;
|
|
35
|
+
type FormFieldControllerRenderFn = (props: {
|
|
36
|
+
field: Omit<ControllerRenderProps, "value"> & {
|
|
37
|
+
value: never;
|
|
38
|
+
};
|
|
39
|
+
fieldState: ControllerFieldState;
|
|
40
|
+
formState: UseFormStateReturn<never>;
|
|
41
|
+
}) => react.ReactElement;
|
|
42
|
+
type FormFieldControllerProps = Omit<ControllerProps<FieldValues, FieldPath<FieldValues>>, "control" | "name" | "render"> & {
|
|
43
|
+
render: FormFieldControllerRenderFn;
|
|
29
44
|
};
|
|
30
|
-
declare function
|
|
31
|
-
declare function
|
|
45
|
+
declare function FormFieldController(props: FormFieldControllerProps): react.JSX.Element;
|
|
46
|
+
declare function FormFieldContext(props: FormFieldContextProps): react.ReactNode;
|
|
32
47
|
declare function FormLabel(props: InferProps<"label">): react.JSX.Element;
|
|
33
48
|
declare function FormInputGroup(props: react.ComponentPropsWithRef<"div">): react.JSX.Element;
|
|
34
49
|
type FormSideItemProps = {
|
|
@@ -43,54 +58,39 @@ declare function FormInputRightItem<TElement extends react.ElementType = "span">
|
|
|
43
58
|
declare namespace FormInputRightItem {
|
|
44
59
|
var slot: symbol;
|
|
45
60
|
}
|
|
46
|
-
type FormInputPrimitiveProps<TFieldValues extends FieldValues = FieldValues> = Omit<react.ComponentPropsWithRef<"input">, "children"> &
|
|
47
|
-
control: Control<TFieldValues>;
|
|
48
|
-
}, {
|
|
49
|
-
formState?: FormState<TFieldValues>;
|
|
50
|
-
}]> & {
|
|
61
|
+
type FormInputPrimitiveProps<TFieldValues extends FieldValues = FieldValues> = Omit<react.ComponentPropsWithRef<"input">, "children"> & {
|
|
51
62
|
classNames?: {
|
|
52
63
|
error?: string;
|
|
53
64
|
eyeIcon?: string;
|
|
54
65
|
input?: string;
|
|
55
66
|
inputGroup?: string;
|
|
56
67
|
};
|
|
68
|
+
control?: Control<TFieldValues>;
|
|
57
69
|
name?: FieldPath<TFieldValues>;
|
|
58
70
|
withEyeIcon?: boolean;
|
|
59
71
|
};
|
|
60
|
-
declare function FormInputPrimitive<TFieldValues extends FieldValues>(props: FormInputPrimitiveProps<TFieldValues>): react.JSX.Element;
|
|
61
|
-
declare function FormInput(props: Omit<FormInputPrimitiveProps, "control" | "formState" | "name" | "ref"> & {
|
|
62
|
-
rules?: RegisterOptions;
|
|
63
|
-
}): react.JSX.Element;
|
|
64
72
|
type FormTextAreaPrimitiveProps<TFieldValues extends FieldValues = FieldValues> = react.ComponentPropsWithRef<"textarea"> & {
|
|
73
|
+
control?: Control<TFieldValues>;
|
|
65
74
|
errorClassName?: string;
|
|
66
75
|
name?: FieldPath<TFieldValues>;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
formState?: FormState<TFieldValues>;
|
|
71
|
-
}]>;
|
|
76
|
+
type: "textarea";
|
|
77
|
+
};
|
|
78
|
+
declare function FormInputPrimitive<TFieldValues extends FieldValues>(props: FormInputPrimitiveProps<TFieldValues>): react.JSX.Element;
|
|
72
79
|
declare function FormTextAreaPrimitive<TFieldValues extends FieldValues>(props: FormTextAreaPrimitiveProps<TFieldValues>): react.JSX.Element;
|
|
73
|
-
|
|
80
|
+
type PrimitivePropsToOmit = "control" | "formState" | "name" | "ref";
|
|
81
|
+
type FormInputProps = Omit<FormInputPrimitiveProps, PrimitivePropsToOmit> | Omit<FormTextAreaPrimitiveProps & {
|
|
82
|
+
type: "textarea";
|
|
83
|
+
}, PrimitivePropsToOmit>;
|
|
84
|
+
declare function FormInput(props: FormInputProps & {
|
|
74
85
|
rules?: RegisterOptions;
|
|
75
86
|
}): react.JSX.Element;
|
|
76
|
-
type FormControllerRenderFn = (props: {
|
|
77
|
-
field: Omit<ControllerRenderProps, "value"> & {
|
|
78
|
-
value: never;
|
|
79
|
-
};
|
|
80
|
-
fieldState: ControllerFieldState;
|
|
81
|
-
formState: UseFormStateReturn<never>;
|
|
82
|
-
}) => react.ReactElement;
|
|
83
|
-
type FormControllerProps = Omit<ControllerProps<FieldValues, FieldPath<FieldValues>>, "control" | "name" | "render"> & {
|
|
84
|
-
render: FormControllerRenderFn;
|
|
85
|
-
};
|
|
86
|
-
declare const FormControllerPrimitive: typeof Controller;
|
|
87
|
-
declare function FormController(props: FormControllerProps): react.JSX.Element;
|
|
88
87
|
declare function FormDescription(props: InferProps<"p">): react.JSX.Element;
|
|
89
88
|
type ErrorMessageRenderProps = {
|
|
90
89
|
className: string;
|
|
91
90
|
"data-index": number;
|
|
92
91
|
"data-part": string;
|
|
93
92
|
"data-scope": string;
|
|
93
|
+
id: string | undefined;
|
|
94
94
|
onAnimationEnd?: react.ReactEventHandler<HTMLElement>;
|
|
95
95
|
};
|
|
96
96
|
type ErrorMessageRenderState = {
|
|
@@ -144,13 +144,13 @@ type FormErrorMessageProps<TControl, TFieldValues extends FieldValues> = (TContr
|
|
|
144
144
|
type: "root";
|
|
145
145
|
};
|
|
146
146
|
declare function FormErrorMessage<TControl, TFieldValues extends FieldValues = FieldValues>(props: FormErrorMessageProps<TControl, TFieldValues>): react.JSX.Element;
|
|
147
|
-
type
|
|
147
|
+
type FormSubmitProps = InferProps<"button"> & {
|
|
148
148
|
asChild?: boolean;
|
|
149
|
-
unstyled?: boolean;
|
|
150
149
|
};
|
|
151
|
-
declare function
|
|
150
|
+
declare function FormSubmit<TElement extends react.ElementType = "button">(props: PolymorphicProps<TElement, FormSubmitProps>): react.JSX.Element;
|
|
151
|
+
type GetFieldValue<TFieldPathOrPaths, TFieldValues extends FieldValues> = TFieldPathOrPaths extends Array<FieldPath<TFieldValues>> ? FieldPathValues<TFieldValues, TFieldPathOrPaths> : TFieldPathOrPaths extends FieldPath<TFieldValues> ? FieldPathValue<TFieldValues, TFieldPathOrPaths> : unknown;
|
|
152
152
|
type FieldSubscribeRenderFn<TFieldValues extends FieldValues, TFieldPathOrPaths> = (props: {
|
|
153
|
-
value: TFieldPathOrPaths
|
|
153
|
+
value: GetFieldValue<TFieldPathOrPaths, TFieldValues>;
|
|
154
154
|
}) => react.ReactNode;
|
|
155
155
|
type FormFieldSubscribeProps<TFieldValues extends FieldValues, TFieldPathOrPaths> = DiscriminatedRenderProps<FieldSubscribeRenderFn<TFieldValues, TFieldPathOrPaths>> & {
|
|
156
156
|
control: Control<TFieldValues>;
|
|
@@ -165,7 +165,7 @@ type FormStateSubscribeProps<TFieldValues extends FieldValues> = DiscriminatedRe
|
|
|
165
165
|
declare function FormStateSubscribe<TFieldValues extends FieldValues = FieldValues>(props: FormStateSubscribeProps<TFieldValues>): react.ReactNode;
|
|
166
166
|
|
|
167
167
|
declare namespace formParts {
|
|
168
|
-
export {
|
|
168
|
+
export { FormControlledField as ControlledField, FormDescription as Description, FormErrorMessage as ErrorMessage, FormErrorMessagePrimitive as ErrorMessagePrimitive, FormField as Field, FormFieldContext as FieldContext, FormFieldController as FieldController, FormFieldSubscribe as FieldSubscribe, FormInput as Input, FormInputGroup as InputGroup, FormInputLeftItem as InputLeftItem, FormInputPrimitive as InputPrimitive, FormInputRightItem as InputRightItem, FormLabel as Label, FormRoot as Root, FormStateSubscribe as StateSubscribe, FormSubmit as Submit, FormTextAreaPrimitive as TextAreaPrimitive };
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export { type FieldValues, formParts as Form,
|
|
171
|
+
export { type FieldValues, formParts as Form, FormControlledField, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldController, FormFieldSubscribe, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormStateSubscribe, FormSubmit, FormTextAreaPrimitive, useStrictFormFieldContext as useFormFieldContext };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { form_parts_exports as Form,
|
|
1
|
+
export { form_parts_exports as Form, FormControlledField, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldController, FormFieldSubscribe, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormStateSubscribe, FormSubmit, FormTextAreaPrimitive, useStrictFormFieldContext as useFormFieldContext } from '../../chunk-FFJY632O.js';
|
|
2
2
|
import '../../chunk-OHG7GB7O.js';
|
|
3
3
|
import '../../chunk-HKPJTORQ.js';
|
|
4
4
|
import '../../chunk-DW3FXTFL.js';
|
package/dist/esm/ui/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, C
|
|
|
2
2
|
export { Carousel, CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselContent, CarouselContentProps, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselIndicatorProps, CarouselItem, CarouselItemGroup, CarouselProviderProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps } from './carousel/index.js';
|
|
3
3
|
export { useDragScroll } from './drag-scroll/index.js';
|
|
4
4
|
export { DropZone, InputProps, RootProps, UseDropZoneProps, useDropZone } from './drop-zone/index.js';
|
|
5
|
-
export { FieldValues, Form,
|
|
5
|
+
export { FieldValues, Form, FormControlledField, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldController, FormFieldSubscribe, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormStateSubscribe, FormSubmit, FormTextAreaPrimitive, useFormFieldContext } from './form/index.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '@zayne-labs/toolkit-react/utils';
|
|
8
8
|
import '@zayne-labs/toolkit-type-helpers';
|
package/dist/esm/ui/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../chunk-PNYEIX7F.js';
|
|
2
|
-
export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup } from '../chunk-GVL6BLX5.js';
|
|
3
|
-
export { useDragScroll } from '../chunk-Y7TF3SRM.js';
|
|
4
2
|
export { card_parts_exports as Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from '../chunk-PXYYL2LL.js';
|
|
3
|
+
export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup } from '../chunk-GVL6BLX5.js';
|
|
4
|
+
export { useDragScroll } from '../chunk-E42DOTGX.js';
|
|
5
5
|
export { DropZone, useDropZone } from '../chunk-2YCUMTC7.js';
|
|
6
|
-
export { form_parts_exports as Form,
|
|
6
|
+
export { form_parts_exports as Form, FormControlledField, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldController, FormFieldSubscribe, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormStateSubscribe, FormSubmit, FormTextAreaPrimitive, useStrictFormFieldContext as useFormFieldContext } from '../chunk-FFJY632O.js';
|
|
7
7
|
import '../chunk-OHG7GB7O.js';
|
|
8
8
|
import '../chunk-HKPJTORQ.js';
|
|
9
9
|
import '../chunk-DW3FXTFL.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/ui-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "A composable UI/UI-utilities components library. ",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@zayne-labs/toolkit-core": "^0.8.
|
|
52
|
-
"@zayne-labs/toolkit-react": "^0.8.
|
|
53
|
-
"@zayne-labs/toolkit-type-helpers": "^0.8.
|
|
51
|
+
"@zayne-labs/toolkit-core": "^0.8.55",
|
|
52
|
+
"@zayne-labs/toolkit-react": "^0.8.55",
|
|
53
|
+
"@zayne-labs/toolkit-type-helpers": "^0.8.55"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@arethetypeswrong/cli": "0.17.4",
|
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
"@total-typescript/ts-reset": "0.6.1",
|
|
60
60
|
"@types/react": "^19.0.10",
|
|
61
61
|
"@types/react-dom": "^19.0.4",
|
|
62
|
-
"@zayne-labs/
|
|
62
|
+
"@zayne-labs/prettier-config": "^0.7.8",
|
|
63
|
+
"@zayne-labs/tsconfig": "0.7.8",
|
|
63
64
|
"concurrently": "^9.0.1",
|
|
64
65
|
"cross-env": "^7.0.3",
|
|
65
66
|
"publint": "^0.3.9",
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
},
|
|
86
87
|
{
|
|
87
88
|
"path": "src/components/common/**/index.ts",
|
|
88
|
-
"limit": "
|
|
89
|
+
"limit": "600 b"
|
|
89
90
|
}
|
|
90
91
|
],
|
|
91
92
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/icons/EyeIcon.tsx","../../src/components/ui/form/form-context.ts","../../src/components/ui/form/form.tsx","../../src/components/ui/form/form-parts.ts"],"names":["React","HookFormProvider","ReactFragment"],"mappings":";;;;;;;;;;;AAEO,IAAM,gBAAmB,GAAA,CAAC,KAChC,qBAAAA,MAAA,CAAA,aAAA,CAAC,SAAI,KAAM,EAAA,4BAAA,EAA6B,KAAM,EAAA,KAAA,EAAM,MAAO,EAAA,KAAA,EAAM,OAAQ,EAAA,WAAA,EAAa,GAAG,KACxF,EAAA,kBAAAA,MAAA,CAAA,aAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACA,IAAK,EAAA,cAAA;AAAA,IACL,CAAE,EAAA;AAAA;AACH,CACD,CAAA;AAGM,IAAM,cAAiB,GAAA,CAAC,KAC9B,qBAAAA,MAAA,CAAA,aAAA,CAAC,SAAI,KAAM,EAAA,4BAAA,EAA6B,KAAM,EAAA,KAAA,EAAM,MAAO,EAAA,KAAA,EAAM,OAAQ,EAAA,WAAA,EAAa,GAAG,KACxF,EAAA,kBAAAA,MAAA,CAAA,aAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACA,IAAK,EAAA,cAAA;AAAA,IACL,CAAE,EAAA;AAAA;AACH,CACD,CAAA;ACTM,IAAM,qBAAqB,MAAM;AACvC,EAAA,MAAM,cAAc,cAAe,EAAA;AAEnC,EAAA,IAAI,CAAC,WAAa,EAAA;AACjB,IAAA,MAAM,IAAI,YAAA;AAAA,MACT,CAAA,oGAAA;AAAA,KACD;AAAA;AAGD,EAAO,OAAA,WAAA;AACR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ourcesContent":["import * as React from \"react\";\n\nexport const EyeIconInvisible = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<path\n\t\t\tfill=\"currentColor\"\n\t\t\td=\"M15.175 8.325q.725.725 1.063 1.65t.237 1.9q0 .375-.275.638t-.65.262t-.638-.262t-.262-.638q.125-.65-.075-1.25T13.95 9.6t-1.025-.65t-1.275-.1q-.375 0-.638-.275t-.262-.65t.263-.637t.637-.263q.95-.1 1.875.238t1.65 1.062M12 6q-.475 0-.925.037t-.9.138q-.425.075-.763-.125t-.462-.6t.088-.775t.612-.45q.575-.125 1.163-.175T12 4q3.425 0 6.263 1.8t4.337 4.85q.1.2.15.413t.05.437t-.038.438t-.137.412q-.45 1-1.112 1.875t-1.463 1.6q-.3.275-.7.225t-.65-.4t-.212-.763t.337-.687q.6-.575 1.1-1.25t.875-1.45q-1.25-2.525-3.613-4.012T12 6m0 13q-3.35 0-6.125-1.812T1.5 12.425q-.125-.2-.187-.437T1.25 11.5t.05-.475t.175-.45q.5-1 1.163-1.912T4.15 7L2.075 4.9q-.275-.3-.262-.712T2.1 3.5t.7-.275t.7.275l17 17q.275.275.288.688t-.288.712q-.275.275-.7.275t-.7-.275l-3.5-3.45q-.875.275-1.775.413T12 19M5.55 8.4q-.725.65-1.325 1.425T3.2 11.5q1.25 2.525 3.613 4.013T12 17q.5 0 .975-.062t.975-.138l-.9-.95q-.275.075-.525.113T12 16q-1.875 0-3.188-1.312T7.5 11.5q0-.275.038-.525t.112-.525zm4.2 4.2\"\n\t\t/>\n\t</svg>\n);\n\nexport const EyeIconVisible = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<path\n\t\t\tfill=\"currentColor\"\n\t\t\td=\"M12 16q1.875 0 3.188-1.312T16.5 11.5t-1.312-3.187T12 7T8.813 8.313T7.5 11.5t1.313 3.188T12 16m0-1.8q-1.125 0-1.912-.788T9.3 11.5t.788-1.912T12 8.8t1.913.788t.787 1.912t-.787 1.913T12 14.2m0 4.8q-3.35 0-6.113-1.8t-4.362-4.75q-.125-.225-.187-.462t-.063-.488t.063-.488t.187-.462q1.6-2.95 4.363-4.75T12 4t6.113 1.8t4.362 4.75q.125.225.188.463t.062.487t-.062.488t-.188.462q-1.6 2.95-4.362 4.75T12 19m0-2q2.825 0 5.188-1.487T20.8 11.5q-1.25-2.525-3.613-4.012T12 6T6.813 7.488T3.2 11.5q1.25 2.525 3.613 4.013T12 17\"\n\t\t/>\n\t</svg>\n);\n","import { ContextError, createCustomContext } from \"@zayne-labs/toolkit-react\";\nimport type { DiscriminatedRenderProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { type UseFormReturn, useFormContext } from \"react-hook-form\";\nimport type { FieldValues } from \"./form\";\n\nexport type FormRootContextValue<TFieldValues extends FieldValues = FieldValues> =\n\tUseFormReturn<TFieldValues>;\n\nexport const useFormRootContext = () => {\n\tconst formContext = useFormContext() as FormRootContextValue | null;\n\n\tif (!formContext) {\n\t\tthrow new ContextError(\n\t\t\t`useFormRootContext returned \"null\". Did you forget to wrap the necessary components within FormRoot?`\n\t\t);\n\t}\n\n\treturn formContext;\n};\n\nexport type ItemContextValue = {\n\tname: string;\n\tuniqueId: string;\n};\n\nexport type FormItemContextProps = DiscriminatedRenderProps<\n\t(contextValue: ItemContextValue) => React.ReactNode\n>;\n\nexport const [StrictFormItemProvider, useStrictFormItemContext] = createCustomContext<ItemContextValue>({\n\thookName: \"useFormItemContext\",\n\tproviderName: \"FormItem\",\n});\n\nexport const [LaxFormItemProvider, useLaxFormItemContext] = createCustomContext<ItemContextValue, false>({\n\thookName: \"useLaxFormItemContext\",\n\tproviderName: \"FormItem\",\n\tstrict: false,\n});\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { Slot } from \"@/components/common\";\nimport { getElementList } from \"@/components/common/for\";\nimport { EyeIconInvisible, EyeIconVisible } from \"@/components/icons\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport { toArray } from \"@zayne-labs/toolkit-core\";\nimport { useToggle } from \"@zayne-labs/toolkit-react\";\nimport {\n\ttype DiscriminatedRenderProps,\n\ttype InferProps,\n\ttype PolymorphicProps,\n\tgetOtherChildren,\n\tgetSlotElement,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport type { UnionDiscriminator } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Fragment as ReactFragment, useEffect, useId, useMemo, useRef } from \"react\";\nimport {\n\ttype Control,\n\tController,\n\ttype ControllerFieldState,\n\ttype ControllerProps,\n\ttype ControllerRenderProps,\n\ttype FieldPath,\n\ttype FieldPathValue,\n\ttype FieldPathValues,\n\ttype FormState,\n\tFormProvider as HookFormProvider,\n\ttype RegisterOptions,\n\ttype UseFormReturn,\n\ttype UseFormStateReturn,\n\tuseFormState,\n\tuseWatch,\n} from \"react-hook-form\";\nimport {\n\ttype FormItemContextProps,\n\tLaxFormItemProvider,\n\tStrictFormItemProvider,\n\tuseFormRootContext,\n\tuseLaxFormItemContext,\n\tuseStrictFormItemContext,\n} from \"./form-context\";\n\nexport type FieldValues = Record<string, unknown>;\n\ntype FormRootProps<TFieldValues extends FieldValues> = React.ComponentPropsWithoutRef<\"form\"> & {\n\tchildren: React.ReactNode;\n\tmethods: UseFormReturn<TFieldValues>;\n};\n\nexport function FormRoot<TValues extends FieldValues>(props: FormRootProps<TValues>) {\n\tconst { children, className, methods, ...restOfProps } = props;\n\n\treturn (\n\t\t<HookFormProvider {...methods}>\n\t\t\t<form\n\t\t\t\tclassName={cnMerge(\"flex flex-col\", className)}\n\t\t\t\t{...restOfProps}\n\t\t\t\tdata-scope=\"form\"\n\t\t\t\tdata-part=\"root\"\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</form>\n\t\t</HookFormProvider>\n\t);\n}\n\ntype FormItemProps<TControl, TFieldValues extends FieldValues> = (TControl extends Control<infer TValues>\n\t? {\n\t\t\tcontrol?: never;\n\t\t\tname: FieldPath<TValues>;\n\t\t}\n\t: {\n\t\t\tcontrol?: Control<TFieldValues>;\n\t\t\tname: FieldPath<TFieldValues>;\n\t\t}) & {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\twithWrapper?: boolean;\n};\n\nexport function FormItem<TControl, TFieldValues extends FieldValues = FieldValues>(\n\tprops: FormItemProps<TControl, TFieldValues>\n) {\n\tconst { children, className, name, withWrapper = true } = props;\n\n\tconst uniqueId = useId();\n\n\tconst value = useMemo(\n\t\t() => ({ name: String(name), uniqueId: `${String(name)}-(${uniqueId})` }),\n\t\t[name, uniqueId]\n\t);\n\n\tconst WrapperElement = withWrapper ? \"div\" : ReactFragment;\n\n\tconst wrapperElementProps = withWrapper && {\n\t\tclassName: cnMerge(\"flex flex-col\", className),\n\t\t\"data-part\": \"item\",\n\t\t\"data-scope\": \"form\",\n\t};\n\n\treturn (\n\t\t<StrictFormItemProvider value={value}>\n\t\t\t<LaxFormItemProvider value={value}>\n\t\t\t\t<WrapperElement {...wrapperElementProps}>{children}</WrapperElement>\n\t\t\t</LaxFormItemProvider>\n\t\t</StrictFormItemProvider>\n\t);\n}\n\nexport function FormItemContext(props: FormItemContextProps) {\n\tconst { children, render } = props;\n\tconst contextValues = useStrictFormItemContext();\n\n\tif (typeof children === \"function\") {\n\t\treturn children(contextValues);\n\t}\n\n\treturn render(contextValues);\n}\n\nexport function FormLabel(props: InferProps<\"label\">) {\n\tconst { uniqueId } = useStrictFormItemContext();\n\tconst { children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<label data-scope=\"form\" data-part=\"label\" htmlFor={uniqueId} className={className} {...restOfProps}>\n\t\t\t{children}\n\t\t</label>\n\t);\n}\n\nexport function FormInputGroup(props: React.ComponentPropsWithRef<\"div\">) {\n\tconst { children, className, ...restOfProps } = props;\n\tconst LeftItemSlot = getSlotElement(children, FormInputLeftItem);\n\tconst RightItemSlot = getSlotElement(children, FormInputRightItem);\n\n\tconst otherChildren = getOtherChildren(children, [FormInputLeftItem, FormInputRightItem]);\n\n\treturn (\n\t\t<div\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"input-group\"\n\t\t\tclassName={cnMerge(\"flex items-center justify-between gap-2\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{LeftItemSlot}\n\t\t\t{otherChildren}\n\t\t\t{RightItemSlot}\n\t\t</div>\n\t);\n}\n\ntype FormSideItemProps = {\n\tchildren?: React.ReactNode;\n\tclassName?: string;\n};\n\nexport function FormInputLeftItem<TElement extends React.ElementType = \"span\">(\n\tprops: PolymorphicProps<TElement, FormSideItemProps>\n) {\n\tconst { as: Element = \"span\", children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"left-item\"\n\t\t\tclassName={cnMerge(\"inline-flex items-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</Element>\n\t);\n}\nFormInputLeftItem.slot = Symbol.for(\"leftItem\");\n\nexport function FormInputRightItem<TElement extends React.ElementType = \"span\">(\n\tprops: PolymorphicProps<TElement, FormSideItemProps>\n) {\n\tconst { as: Element = \"span\", children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"right-item\"\n\t\t\tclassName={cnMerge(\"inline-flex items-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</Element>\n\t);\n}\nFormInputRightItem.slot = Symbol.for(\"rightItem\");\n\ntype FormInputPrimitiveProps<TFieldValues extends FieldValues = FieldValues> = Omit<\n\tReact.ComponentPropsWithRef<\"input\">,\n\t\"children\"\n>\n\t& UnionDiscriminator<[{ control: Control<TFieldValues> }, { formState?: FormState<TFieldValues> }]> & {\n\t\tclassNames?: { error?: string; eyeIcon?: string; input?: string; inputGroup?: string };\n\t\tname?: FieldPath<TFieldValues>;\n\t\twithEyeIcon?: boolean;\n\t};\n\nconst inputTypesWithoutFullWith = new Set<React.HTMLInputTypeAttribute>([\"checkbox\", \"radio\"]);\n\nexport function FormInputPrimitive<TFieldValues extends FieldValues>(\n\tprops: FormInputPrimitiveProps<TFieldValues>\n) {\n\tconst contextValues = useLaxFormItemContext();\n\n\tconst {\n\t\tclassName,\n\t\tclassNames,\n\t\tcontrol,\n\t\tformState,\n\t\tid = contextValues?.uniqueId,\n\t\tname = contextValues?.name,\n\t\ttype = \"text\",\n\t\twithEyeIcon = true,\n\t\t...restOfProps\n\t} = props;\n\n\tconst getFormState = (control ? useFormState : () => formState) as typeof useFormState;\n\n\tconst { errors } =\n\t\t(getFormState({ control, name: name as never }) as UseFormStateReturn<TFieldValues> | undefined)\n\t\t?? {};\n\n\tconst [isPasswordVisible, toggleVisibility] = useToggle(false);\n\n\tconst shouldHaveEyeIcon = withEyeIcon && type === \"password\";\n\n\tconst WrapperElement = shouldHaveEyeIcon ? FormInputGroup : ReactFragment;\n\n\tconst wrapperElementProps = shouldHaveEyeIcon && {\n\t\tclassName: cnMerge(\"w-full\", classNames?.inputGroup, name && errors?.[name] && classNames?.error),\n\t};\n\n\treturn (\n\t\t<WrapperElement {...wrapperElementProps}>\n\t\t\t<input\n\t\t\t\tdata-scope=\"form\"\n\t\t\t\tdata-part=\"input\"\n\t\t\t\tid={id}\n\t\t\t\tname={name}\n\t\t\t\ttype={type === \"password\" && isPasswordVisible ? \"text\" : type}\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t!inputTypesWithoutFullWith.has(type) && \"flex w-full\",\n\t\t\t\t\t`bg-transparent text-sm file:border-0 file:bg-transparent\n\t\t\t\t\tplaceholder:text-shadcn-muted-foreground focus-visible:outline-none\n\t\t\t\t\tdisabled:cursor-not-allowed disabled:opacity-50`,\n\t\t\t\t\tclassName,\n\t\t\t\t\tclassNames?.input,\n\t\t\t\t\ttype !== \"password\" && name && errors?.[name] && classNames?.error\n\t\t\t\t)}\n\t\t\t\t{...restOfProps}\n\t\t\t/>\n\n\t\t\t{shouldHaveEyeIcon && (\n\t\t\t\t<FormInputRightItem\n\t\t\t\t\tas=\"button\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={toggleVisibility}\n\t\t\t\t\tclassName=\"size-5 shrink-0 lg:size-6\"\n\t\t\t\t>\n\t\t\t\t\t{isPasswordVisible ? (\n\t\t\t\t\t\t<EyeIconInvisible className={cnMerge(\"size-full\", classNames?.eyeIcon)} />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EyeIconVisible className={cnMerge(\"size-full\", classNames?.eyeIcon)} />\n\t\t\t\t\t)}\n\t\t\t\t</FormInputRightItem>\n\t\t\t)}\n\t\t</WrapperElement>\n\t);\n}\n\nexport function FormInput(\n\tprops: Omit<FormInputPrimitiveProps, \"control\" | \"formState\" | \"name\" | \"ref\"> & {\n\t\trules?: RegisterOptions;\n\t}\n) {\n\tconst { rules, ...restOfProps } = props;\n\n\tconst { name } = useStrictFormItemContext();\n\tconst { control, register } = useFormRootContext();\n\n\tconst formState = useFormState({ control, name });\n\n\treturn (\n\t\t<FormInputPrimitive\n\t\t\tname={name}\n\t\t\tformState={formState}\n\t\t\t{...(Boolean(name) && register(name, rules))}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\ntype FormTextAreaPrimitiveProps<TFieldValues extends FieldValues = FieldValues> =\n\tReact.ComponentPropsWithRef<\"textarea\"> & {\n\t\terrorClassName?: string;\n\t\tname?: FieldPath<TFieldValues>;\n\t\t// eslint-disable-next-line perfectionist/sort-intersection-types -- Prefer the object to come first before the discriminator props\n\t} & UnionDiscriminator<[{ control: Control<TFieldValues> }, { formState?: FormState<TFieldValues> }]>;\n\nexport function FormTextAreaPrimitive<TFieldValues extends FieldValues>(\n\tprops: FormTextAreaPrimitiveProps<TFieldValues>\n) {\n\tconst contextValues = useLaxFormItemContext();\n\n\tconst {\n\t\tclassName,\n\t\tcontrol,\n\t\terrorClassName,\n\t\tformState,\n\t\tid = contextValues?.uniqueId,\n\t\tname = contextValues?.name,\n\t\t...restOfProps\n\t} = props;\n\n\tconst getFormState = (control ? useFormState : () => formState) as typeof useFormState;\n\n\tconst { errors } =\n\t\t(getFormState({ control, name: name as never }) as UseFormStateReturn<TFieldValues> | undefined)\n\t\t?? {};\n\n\treturn (\n\t\t<textarea\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"textarea\"\n\t\t\tid={id}\n\t\t\tname={name}\n\t\t\tclassName={cnMerge(\n\t\t\t\t`w-full bg-transparent text-sm placeholder:text-shadcn-muted-foreground\n\t\t\t\tfocus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,\n\t\t\t\tclassName,\n\t\t\t\tname && errors?.[name] && errorClassName\n\t\t\t)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function FormTextArea(\n\tprops: Omit<FormTextAreaPrimitiveProps, \"control\" | \"formState\" | \"id\" | \"name\" | \"ref\"> & {\n\t\trules?: RegisterOptions;\n\t}\n) {\n\tconst { rules, ...restOfProps } = props;\n\n\tconst { name } = useStrictFormItemContext();\n\tconst { control, register } = useFormRootContext();\n\tconst formState = useFormState({ control, name });\n\n\treturn (\n\t\t<FormTextAreaPrimitive\n\t\t\tname={name}\n\t\t\tformState={formState}\n\t\t\t{...(Boolean(name) && register(name, rules))}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\ntype FormControllerRenderFn = (props: {\n\tfield: Omit<ControllerRenderProps, \"value\"> & {\n\t\tvalue: never;\n\t};\n\tfieldState: ControllerFieldState;\n\tformState: UseFormStateReturn<never>;\n}) => React.ReactElement;\n\ntype FormControllerProps = Omit<\n\tControllerProps<FieldValues, FieldPath<FieldValues>>,\n\t\"control\" | \"name\" | \"render\"\n> & {\n\trender: FormControllerRenderFn;\n};\n\nexport const FormControllerPrimitive: typeof Controller = (props) => {\n\treturn <Controller {...props} />;\n};\n\nexport function FormController(props: FormControllerProps) {\n\tconst { control } = useFormRootContext();\n\tconst { name } = useStrictFormItemContext();\n\tconst { render, ...restOfProps } = props;\n\n\treturn (\n\t\t<FormControllerPrimitive name={name} control={control} render={render as never} {...restOfProps} />\n\t);\n}\n\nexport function FormDescription(props: InferProps<\"p\">) {\n\tconst { className, ...restOfProps } = props;\n\n\treturn <p className={cnMerge(\"text-[12px]\", className)} {...restOfProps} />;\n}\n\ntype ErrorMessageRenderProps = {\n\tclassName: string;\n\t\"data-index\": number;\n\t\"data-part\": string;\n\t\"data-scope\": string;\n\tonAnimationEnd?: React.ReactEventHandler<HTMLElement>;\n};\n\ntype ErrorMessageRenderState = { errorMessage: string; errorMessageArray: string[]; index: number };\n\ntype ErrorMessageRenderFn = (context: {\n\tprops: ErrorMessageRenderProps;\n\tstate: ErrorMessageRenderState;\n}) => React.ReactNode;\n\ntype FormErrorMessagePrimitiveProps<TFieldValues extends FieldValues> =\n\tDiscriminatedRenderProps<ErrorMessageRenderFn> & {\n\t\tclassName?: string;\n\t\tclassNames?: {\n\t\t\tcontainer?: string;\n\t\t\terrorMessage?: string;\n\t\t\terrorMessageAnimation?: string;\n\t\t};\n\t\tcontrol: Control<TFieldValues>; // == Here for type inference of errorField prop\n\t\twithAnimationOnInvalid?: boolean;\n\t} & (\n\t\t\t| {\n\t\t\t\t\terrorField: FieldPath<TFieldValues>;\n\t\t\t\t\ttype?: \"regular\";\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\terrorField: string;\n\t\t\t\t\ttype: \"root\";\n\t\t\t }\n\t\t);\n\ntype FormErrorMessagePrimitiveType = {\n\t<TFieldValues extends FieldValues>(\n\t\tprops: Extract<FormErrorMessagePrimitiveProps<TFieldValues>, { type?: \"regular\" }>\n\t): React.ReactNode;\n\t<TFieldValues extends FieldValues>(\n\t\t// eslint-disable-next-line ts-eslint/unified-signatures -- Using overloads are better because it gives better error messages\n\t\tprops: Extract<FormErrorMessagePrimitiveProps<TFieldValues>, { type: \"root\" }>\n\t): React.ReactNode;\n};\n\nexport const FormErrorMessagePrimitive: FormErrorMessagePrimitiveType = (props) => {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tclassNames,\n\t\tcontrol,\n\t\terrorField,\n\t\trender,\n\t\ttype = \"regular\",\n\t\twithAnimationOnInvalid = true,\n\t} = props;\n\n\tconst formState = useFormState({ control });\n\n\tconst wrapperRef = useRef<HTMLUListElement>(null);\n\n\tconst errorAnimationClass = classNames?.errorMessageAnimation ?? \"animate-shake\";\n\n\tuseEffect(() => {\n\t\tif (!withAnimationOnInvalid) return;\n\n\t\tconst errorMessageElements = wrapperRef.current?.children;\n\n\t\tif (!errorMessageElements) return;\n\n\t\tfor (const element of errorMessageElements) {\n\t\t\telement.classList.add(errorAnimationClass);\n\t\t}\n\t}, [errorAnimationClass, withAnimationOnInvalid]);\n\n\tuseEffect(() => {\n\t\tconst errorMessageElements = wrapperRef.current?.children;\n\n\t\tif (!errorMessageElements) return;\n\n\t\t// == Scroll to first error message\n\t\tif (Object.keys(formState.errors).indexOf(errorField as string) === 0) {\n\t\t\terrorMessageElements[0]?.scrollIntoView({\n\t\t\t\tbehavior: \"smooth\",\n\t\t\t\tblock: \"center\",\n\t\t\t});\n\n\t\t\twindow.scrollBy({ behavior: \"smooth\", top: -100 });\n\t\t}\n\t}, [errorField, formState.errors]);\n\n\tconst message = (\n\t\ttype === \"root\"\n\t\t\t? formState.errors.root?.[errorField as string]?.message\n\t\t\t: formState.errors[errorField]?.message\n\t) as string | string[];\n\n\tif (!message) {\n\t\treturn null;\n\t}\n\n\tconst errorMessageArray = toArray(message);\n\n\tconst [ErrorMessageList] = getElementList();\n\n\tconst onAnimationEnd: React.AnimationEventHandler<HTMLElement> | undefined = withAnimationOnInvalid\n\t\t? (event) => event.currentTarget.classList.remove(errorAnimationClass)\n\t\t: undefined;\n\n\tconst getRenderProps = ({ index }: { index: number }) =>\n\t\t({\n\t\t\tclassName: cnMerge(errorAnimationClass, className, classNames?.errorMessage),\n\t\t\t\"data-index\": index,\n\t\t\t\"data-part\": \"error-message\",\n\t\t\t\"data-scope\": \"form\",\n\t\t\tonAnimationEnd,\n\t\t}) satisfies ErrorMessageRenderProps;\n\n\tconst getRenderState = ({ errorMessage, index }: { errorMessage: string; index: number }) =>\n\t\t({\n\t\t\terrorMessage,\n\t\t\terrorMessageArray,\n\t\t\tindex,\n\t\t}) satisfies ErrorMessageRenderState;\n\n\tconst renderFn = typeof children === \"function\" ? children : render;\n\n\treturn (\n\t\t<ErrorMessageList\n\t\t\tref={wrapperRef}\n\t\t\teach={errorMessageArray}\n\t\t\tclassName={cnMerge(\"flex flex-col\", classNames?.container)}\n\t\t\trender={(errorMessage, index) => {\n\t\t\t\treturn renderFn({\n\t\t\t\t\tprops: getRenderProps({ index }),\n\t\t\t\t\tstate: getRenderState({ errorMessage, index }),\n\t\t\t\t});\n\t\t\t}}\n\t\t/>\n\t);\n};\n\ntype FormErrorMessageProps<TControl, TFieldValues extends FieldValues> =\n\t| (TControl extends Control<infer TValues>\n\t\t\t? {\n\t\t\t\t\tclassName?: string;\n\t\t\t\t\tcontrol?: never;\n\t\t\t\t\terrorField?: FieldPath<TValues>;\n\t\t\t\t\ttype?: \"regular\";\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tclassName?: string;\n\t\t\t\t\tcontrol?: Control<TFieldValues>; // == Here for type inference of errorField prop\n\t\t\t\t\terrorField?: FieldPath<TFieldValues>;\n\t\t\t\t\ttype?: \"regular\";\n\t\t\t\t})\n\t| {\n\t\t\tclassName?: string;\n\t\t\tcontrol?: never;\n\t\t\terrorField: string;\n\t\t\ttype: \"root\";\n\t };\n\nexport function FormErrorMessage<TControl, TFieldValues extends FieldValues = FieldValues>(\n\tprops: FormErrorMessageProps<TControl, TFieldValues>\n) {\n\tconst contextValues = useLaxFormItemContext();\n\n\tconst { className, errorField = contextValues?.name, type = \"regular\" } = props;\n\n\tconst { control } = useFormRootContext();\n\n\treturn (\n\t\t<FormErrorMessagePrimitive\n\t\t\tcontrol={control}\n\t\t\terrorField={errorField as NonNullable<typeof errorField>}\n\t\t\ttype={type as \"root\"}\n\t\t\trender={({ props: renderProps, state: { errorMessage } }) => (\n\t\t\t\t<p\n\t\t\t\t\t{...renderProps}\n\t\t\t\t\tkey={errorMessage}\n\t\t\t\t\tclassName={cnMerge(\"text-[13px]\", \"data-[index=0]:mt-1\", renderProps.className, className)}\n\t\t\t\t>\n\t\t\t\t\t{errorMessage}\n\t\t\t\t</p>\n\t\t\t)}\n\t\t/>\n\t);\n}\n\ntype FormSubmitButtonProps = InferProps<\"button\"> & {\n\tasChild?: boolean;\n\tunstyled?: boolean;\n};\n\nexport function FormSubmitButton<TElement extends React.ElementType = \"button\">(\n\tprops: PolymorphicProps<TElement, FormSubmitButtonProps>\n) {\n\tconst { as: Element = \"button\", asChild, children, type = \"submit\", ...restOfProps } = props;\n\n\tconst Component = asChild ? Slot : Element;\n\n\treturn (\n\t\t<Component type={type} {...restOfProps}>\n\t\t\t{children}\n\t\t</Component>\n\t);\n}\n\ntype FieldSubscribeRenderFn<TFieldValues extends FieldValues, TFieldPathOrPaths> = (props: {\n\tvalue: TFieldPathOrPaths extends Array<FieldPath<TFieldValues>>\n\t\t? FieldPathValues<TFieldValues, TFieldPathOrPaths>\n\t\t: TFieldPathOrPaths extends FieldPath<TFieldValues>\n\t\t\t? FieldPathValue<TFieldValues, TFieldPathOrPaths>\n\t\t\t: unknown;\n}) => React.ReactNode;\n\ntype FormFieldSubscribeProps<\n\tTFieldValues extends FieldValues,\n\tTFieldPathOrPaths,\n> = DiscriminatedRenderProps<FieldSubscribeRenderFn<TFieldValues, TFieldPathOrPaths>> & {\n\tcontrol: Control<TFieldValues>;\n\tname?: TFieldPathOrPaths;\n};\n\nexport function FormFieldSubscribe<\n\tTFieldValues extends FieldValues,\n\tconst TFieldPathOrPaths extends Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues>,\n>(props: FormFieldSubscribeProps<TFieldValues, TFieldPathOrPaths>) {\n\tconst contextValues = useLaxFormItemContext();\n\n\tconst { children, name = contextValues?.name, render } = props;\n\n\tconst { control } = useFormRootContext();\n\n\tconst formValue = useWatch({ control, name: name as string });\n\n\tconst fieldProps = { value: formValue };\n\n\tif (typeof children === \"function\") {\n\t\treturn children(fieldProps as never);\n\t}\n\n\treturn render(fieldProps as never);\n}\n\ntype FormStateSubscribeRenderFn<TFieldValues extends FieldValues> = (\n\tprops: UseFormStateReturn<TFieldValues>\n) => React.ReactNode;\n\ntype FormStateSubscribeProps<TFieldValues extends FieldValues> = DiscriminatedRenderProps<\n\tFormStateSubscribeRenderFn<TFieldValues>\n> & {\n\tcontrol?: Control<TFieldValues>;\n\tname?: Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues>;\n};\n\nexport function FormStateSubscribe<TFieldValues extends FieldValues = FieldValues>(\n\tprops: FormStateSubscribeProps<TFieldValues>\n) {\n\tconst contextValues = useLaxFormItemContext();\n\n\tconst { children, control, name = contextValues?.name, render } = props;\n\n\tconst formState = useFormState({ control, name: name as FieldPath<TFieldValues> });\n\n\tif (typeof children === \"function\") {\n\t\treturn children(formState as never);\n\t}\n\n\treturn render(formState as never);\n}\n","export {\n\tFormController as Controller,\n\tFormControllerPrimitive as ControllerPrimitive,\n\tFormDescription as Description,\n\tFormErrorMessage as ErrorMessage,\n\tFormErrorMessagePrimitive as ErrorMessagePrimitive,\n\tFormInput as Input,\n\tFormInputGroup as InputGroup,\n\tFormInputLeftItem as InputLeftItem,\n\tFormInputPrimitive as InputPrimitive,\n\tFormInputRightItem as InputRightItem,\n\tFormItem as Item,\n\tFormItemContext as ItemContext,\n\tFormLabel as Label,\n\tFormRoot as Root,\n\tFormSubmitButton as SubmitButton,\n\tFormStateSubscribe as StateSubscribe,\n\tFormFieldSubscribe as FieldSubscribe,\n\tFormTextArea as TextArea,\n\tFormTextAreaPrimitive as TextAreaPrimitive,\n} from \"./form\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"s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,EAAgB,SAAS,CAAA;AAE/D,IAAO,OAAA;AAAA,MACN,GAAG,eAAA;AAAA,MACH,SAAW,EAAA,OAAA;AAAA,QACV,CAAA,8JAAA,CAAA;AAAA,QACA,gBAAgB,YAAgB,IAAA,UAAA;AAAA,QAChC,gBAAgB,UAAc,IAAA,UAAA;AAAA,QAC9B,UAAU,qBAAyB,IAAA,+BAAA;AAAA,QACnC,UAAU,aAAiB,IAAA,uCAAA;AAAA,QAC3B,UAAY,EAAA,IAAA;AAAA,QACZ,eAAgB,CAAA;AAAA,OACjB;AAAA,MACA,WAAa,EAAA,MAAA;AAAA,MACb,YAAc,EAAA,aAAA;AAAA,MACd,KAAK,WAAY,CAAA;AAAA,QAChB,WAAA;AAAA,QACC,eAA+D,EAAA;AAAA,OAChE;AAAA,KACF;AAAA,GACD;AAEA,EAAM,MAAA,YAAA,GAAe,CACpB,SACI,KAAA;AACJ,IAAM,MAAA,eAAA,GAAkB,aAAc,CAAA,cAAA,EAAgB,SAAS,CAAA;AAE/D,IAAO,OAAA;AAAA,MACN,GAAG,eAAA;AAAA,MACH,WAAW,OAAQ,CAAA,yBAAA,EAA2B,UAAY,EAAA,IAAA,EAAM,gBAAgB,SAAS,CAAA;AAAA,MACzF,WAAa,EAAA,MAAA;AAAA,MACb,YAAc,EAAA;AAAA,KACf;AAAA,GACD;AAEA,EAAO,OAAA,EAAE,cAAc,YAAa,EAAA;AACrC","file":"chunk-Y7TF3SRM.js","sourcesContent":["import { checkIsDeviceMobileOrTablet } from \"@zayne-labs/toolkit-core\";\n\n/* eslint-disable no-param-reassign -- Mutation is needed here since it's an element */\nexport const updateCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"grabbing\";\n\telement.style.userSelect = \"none\";\n};\n\nexport const onScrollSnap = <TElement extends HTMLElement>(\n\taction: \"remove\" | \"reset\",\n\telement: TElement\n) => {\n\tif (action === \"remove\") {\n\t\telement.style.scrollSnapType = \"none\";\n\t\treturn;\n\t}\n\n\telement.style.scrollSnapType = \"\";\n};\n\nexport const resetCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"\";\n\telement.style.userSelect = \"\";\n};\n/* eslint-enable no-param-reassign -- Mutation is needed here since it's an element */\n\nexport const handleScrollSnap = (dragContainer: HTMLElement) => {\n\tconst isMobileOrTablet = checkIsDeviceMobileOrTablet();\n\n\tif (!isMobileOrTablet) {\n\t\tonScrollSnap(\"remove\", dragContainer);\n\t} else {\n\t\tonScrollSnap(\"reset\", dragContainer);\n\t}\n};\n","import { cnMerge } from \"@/lib/utils/cn\";\nimport { off, on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { type InferProps, composeRefs, mergeTwoProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { type RefCallback, useRef } from \"react\";\nimport { handleScrollSnap, resetCursor, updateCursor } from \"./utils\";\n\ntype DragScrollProps<TElement extends HTMLElement> = {\n\tclassNames?: { base?: string; item?: string };\n\textraItemProps?: InferProps<HTMLElement>;\n\textraRootProps?: Omit<InferProps<TElement>, \"children\">;\n\torientation?: \"both\" | \"horizontal\" | \"vertical\";\n\tusage?: \"allScreens\" | \"desktopOnly\" | \"mobileAndTabletOnly\";\n};\n\nconst useDragScroll = <TElement extends HTMLElement>(props: DragScrollProps<TElement> = {}) => {\n\tconst {\n\t\tclassNames,\n\t\textraItemProps,\n\t\textraRootProps,\n\t\torientation = \"horizontal\",\n\t\tusage = \"allScreens\",\n\t} = props;\n\n\tconst dragContainerRef = useRef<TElement>(null);\n\n\tconst positionRef = useRef({ left: 0, top: 0, x: 0, y: 0 });\n\n\tconst handleMouseMove = useCallbackRef((event: MouseEvent) => {\n\t\tif (!dragContainerRef.current) return;\n\n\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\t// == calculate the current change in the horizontal scroll position based on the difference between the previous mouse position and the new mouse position\n\t\t\tconst dx = event.clientX - positionRef.current.x;\n\n\t\t\t// == Assign the scrollLeft of the container to the difference between its previous horizontal scroll position and the change in the mouse position\n\t\t\tdragContainerRef.current.scrollLeft = positionRef.current.left - dx;\n\t\t}\n\n\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\t// == calculate the current change in the vertical scroll position based on the difference between the previous mouse position and the new mouse position\n\t\t\tconst dy = event.clientY - positionRef.current.y;\n\n\t\t\t// == Assign the scrollTop of the container to the difference between its previous vertical scroll position and the change in the mouse position\n\t\t\tdragContainerRef.current.scrollTop = positionRef.current.top - dy;\n\t\t}\n\t});\n\n\tconst handleMouseUpOrLeave = useCallbackRef(() => {\n\t\tif (!dragContainerRef.current) return;\n\n\t\toff(\"mousemove\", dragContainerRef.current, handleMouseMove);\n\t\toff(\"mouseup\", dragContainerRef.current, handleMouseUpOrLeave);\n\t\toff(\"mouseleave\", dragContainerRef.current, handleMouseUpOrLeave);\n\n\t\tresetCursor(dragContainerRef.current);\n\t});\n\n\tconst handleMouseDown = useCallbackRef((event: MouseEvent) => {\n\t\tif (usage === \"mobileAndTabletOnly\" && window.innerWidth >= 768) return;\n\t\tif (usage === \"desktopOnly\" && window.innerWidth < 768) return;\n\n\t\tif (!dragContainerRef.current) return;\n\n\t\t// == Update all initial position properties stored in the positionRef\n\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\tpositionRef.current.x = event.clientX;\n\t\t\tpositionRef.current.left = dragContainerRef.current.scrollLeft;\n\t\t}\n\n\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\tpositionRef.current.y = event.clientY;\n\t\t\tpositionRef.current.top = dragContainerRef.current.scrollTop;\n\t\t}\n\n\t\tupdateCursor(dragContainerRef.current);\n\n\t\ton(\"mousemove\", dragContainerRef.current, handleMouseMove);\n\t\ton(\"mouseup\", dragContainerRef.current, handleMouseUpOrLeave);\n\t\ton(\"mouseleave\", dragContainerRef.current, handleMouseUpOrLeave);\n\t});\n\n\tconst refCallBack: RefCallback<TElement> = useCallbackRef((node) => {\n\t\tdragContainerRef.current = node;\n\n\t\tnode && handleScrollSnap(node);\n\n\t\tconst cleanup = on(\"mousedown\", dragContainerRef.current, handleMouseDown);\n\n\t\treturn cleanup;\n\t});\n\n\tconst getRootProps = (rootProps?: DragScrollProps<TElement>[\"extraRootProps\"]) => {\n\t\tconst mergedRootProps = mergeTwoProps(extraRootProps, rootProps);\n\n\t\treturn {\n\t\t\t...mergedRootProps,\n\t\t\tclassName: cnMerge(\n\t\t\t\t`flex w-full cursor-grab snap-x snap-mandatory overflow-x-scroll overflow-y-clip [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,\n\t\t\t\torientation === \"horizontal\" && \"flex-row\",\n\t\t\t\torientation === \"vertical\" && \"flex-col\",\n\t\t\t\tusage === \"mobileAndTabletOnly\" && \"md:cursor-default md:flex-col\",\n\t\t\t\tusage === \"desktopOnly\" && \"max-md:cursor-default max-md:flex-col\",\n\t\t\t\tclassNames?.base,\n\t\t\t\tmergedRootProps.className\n\t\t\t),\n\t\t\t\"data-part\": \"root\",\n\t\t\t\"data-scope\": \"drag-scroll\",\n\t\t\tref: composeRefs([\n\t\t\t\trefCallBack,\n\t\t\t\t(mergedRootProps as { ref?: React.Ref<TElement> } | undefined)?.ref,\n\t\t\t]),\n\t\t};\n\t};\n\n\tconst getItemProps = <TItemElement extends HTMLElement>(\n\t\titemProps?: DragScrollProps<TItemElement>[\"extraItemProps\"]\n\t) => {\n\t\tconst mergedItemProps = mergeTwoProps(extraItemProps, itemProps);\n\n\t\treturn {\n\t\t\t...mergedItemProps,\n\t\t\tclassName: cnMerge(\"snap-center snap-always\", classNames?.item, mergedItemProps.className),\n\t\t\t\"data-part\": \"item\",\n\t\t\t\"data-scope\": \"drag-scroll\",\n\t\t};\n\t};\n\n\treturn { getItemProps, getRootProps };\n};\n\nexport { useDragScroll };\n"]}
|