@zayne-labs/ui-react 0.4.2 → 0.5.1
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-NCS3WKFW.js → chunk-FPCKBOJN.js} +9 -9
- package/dist/esm/chunk-FPCKBOJN.js.map +1 -0
- package/dist/esm/chunk-P6HRTILR.js +120 -0
- package/dist/esm/chunk-P6HRTILR.js.map +1 -0
- package/dist/esm/{chunk-JKLRBPJZ.js → chunk-SVQ4WBSO.js} +6 -6
- package/dist/esm/chunk-SVQ4WBSO.js.map +1 -0
- package/dist/esm/{chunk-3OWAXCPZ.js → chunk-V4YLNLT5.js} +12 -11
- package/dist/esm/chunk-V4YLNLT5.js.map +1 -0
- package/dist/esm/common/index.d.ts +71 -2
- package/dist/esm/common/index.js +3 -3
- package/dist/esm/common/show/index.d.ts +2 -2
- package/dist/esm/common/show/index.js +1 -1
- package/dist/esm/common/switch/index.d.ts +2 -4
- package/dist/esm/common/switch/index.js +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +4 -4
- package/dist/esm/ui/drag-scroll/index.d.ts +4 -0
- package/dist/esm/ui/drop-zone/index.d.ts +8 -0
- package/dist/esm/ui/form/index.d.ts +3 -3
- package/dist/esm/ui/form/index.js +4 -4
- package/dist/esm/ui/index.js +4 -4
- package/package.json +12 -12
- package/dist/esm/chunk-3OWAXCPZ.js.map +0 -1
- package/dist/esm/chunk-HKPJTORQ.js +0 -3
- package/dist/esm/chunk-HKPJTORQ.js.map +0 -1
- package/dist/esm/chunk-JKLRBPJZ.js.map +0 -1
- package/dist/esm/chunk-NCS3WKFW.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __export } from './chunk-PZ5AY32C.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { getSingleSlot, getRegularChildren } from '@zayne-labs/toolkit-react/utils';
|
|
4
4
|
import { isFunction, AssertionError } from '@zayne-labs/toolkit-type-helpers';
|
|
5
5
|
|
|
6
6
|
function ShowRoot({ children, fallback, when }) {
|
|
7
7
|
if ((when == null || when === false) && !isFunction(children)) {
|
|
8
|
-
const fallBackSlot =
|
|
8
|
+
const fallBackSlot = getSingleSlot(children, ShowFallback, {
|
|
9
9
|
errorMessage: "Only one <Show.Fallback> or <Show.OtherWise> component is allowed",
|
|
10
10
|
throwOnMultipleSlotMatch: true
|
|
11
11
|
});
|
|
@@ -20,21 +20,21 @@ function ShowRoot({ children, fallback, when }) {
|
|
|
20
20
|
return fallback;
|
|
21
21
|
}
|
|
22
22
|
const resolvedChildren = isFunction(children) ? children(when) : children;
|
|
23
|
-
const contentSlot =
|
|
23
|
+
const contentSlot = getSingleSlot(resolvedChildren, ShowContent, {
|
|
24
24
|
errorMessage: "Only one <Show.Content> component is allowed",
|
|
25
25
|
throwOnMultipleSlotMatch: true
|
|
26
26
|
});
|
|
27
|
-
const
|
|
28
|
-
return contentSlot ??
|
|
27
|
+
const regularChildren = getRegularChildren(resolvedChildren, [ShowFallback, ShowContent]);
|
|
28
|
+
return contentSlot ?? regularChildren;
|
|
29
29
|
}
|
|
30
30
|
function ShowContent({ children }) {
|
|
31
31
|
return children;
|
|
32
32
|
}
|
|
33
|
-
ShowContent.
|
|
33
|
+
ShowContent.slotSymbol = Symbol("content");
|
|
34
34
|
function ShowFallback({ children }) {
|
|
35
35
|
return children;
|
|
36
36
|
}
|
|
37
|
-
ShowFallback.
|
|
37
|
+
ShowFallback.slotSymbol = Symbol("show-fallback");
|
|
38
38
|
|
|
39
39
|
// src/components/common/show/show-parts.ts
|
|
40
40
|
var show_parts_exports = {};
|
|
@@ -46,5 +46,5 @@ __export(show_parts_exports, {
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
export { ShowContent, ShowFallback, ShowRoot, show_parts_exports };
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-FPCKBOJN.js.map
|
|
50
|
+
//# sourceMappingURL=chunk-FPCKBOJN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"names":[],"mappings":";;;;;AAaO,SAAS,QAAgB,CAAA,EAAE,QAAU,EAAA,QAAA,EAAU,MAA0B,EAAA;AAC/E,EAAA,IAAA,CAAK,QAAQ,IAAQ,IAAA,IAAA,KAAS,UAAU,CAAC,UAAA,CAAW,QAAQ,CAAG,EAAA;AAC9D,IAAM,MAAA,YAAA,GAAe,aAAc,CAAA,QAAA,EAAU,YAAc,EAAA;AAAA,MAC1D,YAAc,EAAA,mEAAA;AAAA,MACd,wBAA0B,EAAA;AAAA,KAC1B,CAAA;AAED,IAAA,IAAI,gBAAgB,QAAU,EAAA;AAC7B,MAAA,MAAM,IAAI,cAAe,CAAA;AAAA;AAAA,EAEzB,CAAA,CAAA;AAAA;AAGD,IAAA,OAAO,YAAgB,IAAA,QAAA;AAAA;AAGxB,EAAI,IAAA,IAAA,IAAQ,IAAQ,IAAA,IAAA,KAAS,KAAO,EAAA;AACnC,IAAO,OAAA,QAAA;AAAA;AAGR,EAAA,MAAM,mBAAmB,UAAW,CAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,IAAI,CAAI,GAAA,QAAA;AAEjE,EAAM,MAAA,WAAA,GAAc,aAAc,CAAA,gBAAA,EAAkB,WAAa,EAAA;AAAA,IAChE,YAAc,EAAA,8CAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,kBAAkB,kBAAmB,CAAA,gBAAA,EAAkB,CAAC,YAAA,EAAc,WAAW,CAAC,CAAA;AAExF,EAAA,OAAO,WAAe,IAAA,eAAA;AACvB;AAEO,SAAS,WAAA,CAAY,EAAE,QAAA,EAA2C,EAAA;AACxE,EAAO,OAAA,QAAA;AACR;AACA,WAAY,CAAA,UAAA,GAAa,OAAO,SAAS,CAAA;AAElC,SAAS,YAAA,CAAa,EAAE,QAAA,EAA2C,EAAA;AACzE,EAAO,OAAA,QAAA;AACR;AACA,YAAa,CAAA,UAAA,GAAa,OAAO,eAAe,CAAA;;;ACrDhD,IAAA,kBAAA,GAAA;AAAA,QAAA,CAAA,kBAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,WAAA;AAAA,EAAA,QAAA,EAAA,MAAA,YAAA;AAAA,EAAA,SAAA,EAAA,MAAA,YAAA;AAAA,EAAA,IAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-FPCKBOJN.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getRegularChildren, getSingleSlot } from \"@zayne-labs/toolkit-react/utils\";\nimport { AssertionError, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ShowProps<TWhen> = {\n\tchildren: React.ReactNode | ((whenValue: TWhen) => React.ReactNode);\n\tfallback?: React.ReactNode;\n\twhen: false | TWhen | null | undefined;\n};\n\nexport function ShowRoot<TWhen>({ children, fallback, when }: ShowProps<TWhen>) {\n\tif ((when == null || when === false) && !isFunction(children)) {\n\t\tconst fallBackSlot = getSingleSlot(children, ShowFallback, {\n\t\t\terrorMessage: \"Only one <Show.Fallback> or <Show.OtherWise> component is allowed\",\n\t\t\tthrowOnMultipleSlotMatch: true,\n\t\t});\n\n\t\tif (fallBackSlot && fallback) {\n\t\t\tthrow new AssertionError(`\n\t\t\tThe fallback prop and <Show.Fallback>/<Show.OtherWise> cannot be used at the same time.\n\t\t`);\n\t\t}\n\n\t\treturn fallBackSlot ?? fallback;\n\t}\n\n\tif (when == null || when === false) {\n\t\treturn fallback;\n\t}\n\n\tconst resolvedChildren = isFunction(children) ? children(when) : children;\n\n\tconst contentSlot = getSingleSlot(resolvedChildren, ShowContent, {\n\t\terrorMessage: \"Only one <Show.Content> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst regularChildren = getRegularChildren(resolvedChildren, [ShowFallback, ShowContent]);\n\n\treturn contentSlot ?? regularChildren;\n}\n\nexport function ShowContent({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nShowContent.slotSymbol = Symbol(\"content\");\n\nexport function ShowFallback({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nShowFallback.slotSymbol = Symbol(\"show-fallback\");\n","export {\n\tShowContent as Content,\n\tShowFallback as Fallback,\n\tShowFallback as OtherWise,\n\tShowRoot as Root,\n} from \"./show\";\n"]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as React2 from 'react';
|
|
2
|
+
import { useState, Component, Fragment, Suspense, use } from 'react';
|
|
3
|
+
import { createCustomContext, useCallbackRef } from '@zayne-labs/toolkit-react';
|
|
4
|
+
import { isFunction } from '@zayne-labs/toolkit-type-helpers';
|
|
5
|
+
|
|
6
|
+
// src/components/common/await/await.tsx
|
|
7
|
+
var [ErrorBoundaryContextProvider, useErrorBoundaryContext] = createCustomContext({
|
|
8
|
+
hookName: "useErrorBoundaryContext",
|
|
9
|
+
name: "ErrorBoundaryContext",
|
|
10
|
+
providerName: "ErrorBoundaryContextProvider"
|
|
11
|
+
});
|
|
12
|
+
var useErrorBoundary = () => {
|
|
13
|
+
const { resetErrorBoundary } = useErrorBoundaryContext();
|
|
14
|
+
const [state, setState] = useState({
|
|
15
|
+
error: null,
|
|
16
|
+
hasError: false
|
|
17
|
+
});
|
|
18
|
+
if (state.hasError) {
|
|
19
|
+
throw state.error;
|
|
20
|
+
}
|
|
21
|
+
const resetBoundary = useCallbackRef(() => {
|
|
22
|
+
resetErrorBoundary();
|
|
23
|
+
setState({
|
|
24
|
+
error: null,
|
|
25
|
+
hasError: false
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
const showBoundary = useCallbackRef((error) => {
|
|
29
|
+
setState({
|
|
30
|
+
error,
|
|
31
|
+
hasError: true
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
return { resetBoundary, showBoundary };
|
|
35
|
+
};
|
|
36
|
+
var initialState = {
|
|
37
|
+
error: null,
|
|
38
|
+
hasError: false
|
|
39
|
+
};
|
|
40
|
+
var hasArrayChanged = (a = [], b = []) => {
|
|
41
|
+
return a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));
|
|
42
|
+
};
|
|
43
|
+
var ErrorBoundary = class extends Component {
|
|
44
|
+
constructor(props) {
|
|
45
|
+
super(props);
|
|
46
|
+
this.state = initialState;
|
|
47
|
+
}
|
|
48
|
+
static getDerivedStateFromError(error) {
|
|
49
|
+
return { error, hasError: true };
|
|
50
|
+
}
|
|
51
|
+
componentDidCatch(error, info) {
|
|
52
|
+
this.props.onError?.(error, info);
|
|
53
|
+
}
|
|
54
|
+
componentDidUpdate(prevProps, prevState) {
|
|
55
|
+
const { hasError } = this.state;
|
|
56
|
+
const { resetKeys } = this.props;
|
|
57
|
+
if (hasError && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {
|
|
58
|
+
this.props.onReset?.({ next: resetKeys, prev: prevProps.resetKeys, reason: "keys" });
|
|
59
|
+
this.setState(initialState);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
const { children, fallback } = this.props;
|
|
64
|
+
const { error, hasError } = this.state;
|
|
65
|
+
let childToRender = children;
|
|
66
|
+
if (hasError) {
|
|
67
|
+
switch (true) {
|
|
68
|
+
case isFunction(fallback): {
|
|
69
|
+
const props = { error, resetErrorBoundary: this.#resetErrorBoundary };
|
|
70
|
+
childToRender = fallback(props);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case fallback !== void 0: {
|
|
74
|
+
childToRender = fallback;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
default: {
|
|
78
|
+
console.error("error-boundary requires a fallback prop");
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ React2.createElement(
|
|
84
|
+
ErrorBoundaryContextProvider,
|
|
85
|
+
{
|
|
86
|
+
value: { error, hasError, resetErrorBoundary: this.#resetErrorBoundary }
|
|
87
|
+
},
|
|
88
|
+
childToRender
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
#resetErrorBoundary = (...parameters) => {
|
|
92
|
+
const { error } = this.state;
|
|
93
|
+
if (error !== null) {
|
|
94
|
+
this.props.onReset?.({ parameters, reason: "imperative-api" });
|
|
95
|
+
this.setState(initialState);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// src/components/common/await/await.tsx
|
|
101
|
+
function Await(props) {
|
|
102
|
+
const { errorFallback, fallback, ...restOfProps } = props;
|
|
103
|
+
const WithErrorBoundary = errorFallback ? ErrorBoundary : Fragment;
|
|
104
|
+
const WithSuspense = fallback ? Suspense : Fragment;
|
|
105
|
+
const errorBoundaryProps = { fallback: errorFallback };
|
|
106
|
+
const suspenseProps = { fallback };
|
|
107
|
+
return /* @__PURE__ */ React2.createElement(WithErrorBoundary, { ...errorBoundaryProps }, /* @__PURE__ */ React2.createElement(WithSuspense, { ...suspenseProps }, /* @__PURE__ */ React2.createElement(AwaitInner, { ...restOfProps })));
|
|
108
|
+
}
|
|
109
|
+
function AwaitInner(props) {
|
|
110
|
+
const { children, promise, render } = props;
|
|
111
|
+
const result = use(promise);
|
|
112
|
+
if (typeof children === "function") {
|
|
113
|
+
return children(result);
|
|
114
|
+
}
|
|
115
|
+
return render(result);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { Await, ErrorBoundary, useErrorBoundary, useErrorBoundaryContext };
|
|
119
|
+
//# sourceMappingURL=chunk-P6HRTILR.js.map
|
|
120
|
+
//# sourceMappingURL=chunk-P6HRTILR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/common/error-boundary/error-boundary-context.ts","../../src/components/common/error-boundary/useErrorBoundary.ts","../../src/components/common/error-boundary/error-boundary.tsx","../../src/components/common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AA,CAAA,YAAA,EAAA,EAAc,GAAG,aAAA,EAAA,kBAChB,MAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAY,GAAG,WAAA,EAAa,CAC9B,CACD,CAAA;AAEF;AAEA,SAAS,WAAmB,KAAgC,EAAA;AAC3D,EAAA,MAAM,EAAE,QAAA,EAAU,OAAS,EAAA,MAAA,EAAW,GAAA,KAAA;AAEtC,EAAM,MAAA,MAAA,GAAS,IAAI,OAAO,CAAA;AAE1B,EAAI,IAAA,OAAO,aAAa,UAAY,EAAA;AACnC,IAAA,OAAO,SAAS,MAAM,CAAA;AAAA;AAGvB,EAAA,OAAO,OAAO,MAAM,CAAA;AACrB","file":"chunk-P6HRTILR.js","sourcesContent":["import { createCustomContext } from \"@zayne-labs/toolkit-react\";\n\nexport type ErrorBoundaryContextType = {\n\terror: unknown;\n\thasError: boolean;\n\tresetErrorBoundary: (...args: unknown[]) => void;\n};\n\nexport const [ErrorBoundaryContextProvider, useErrorBoundaryContext] =\n\tcreateCustomContext<ErrorBoundaryContextType>({\n\t\thookName: \"useErrorBoundaryContext\",\n\t\tname: \"ErrorBoundaryContext\",\n\t\tproviderName: \"ErrorBoundaryContextProvider\",\n\t});\n","import { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport { useErrorBoundaryContext } from \"./error-boundary-context\";\n\ntype UseErrorBoundaryState<TError extends Error> =\n\t| {\n\t\t\terror: null;\n\t\t\thasError: false;\n\t }\n\t| {\n\t\t\terror: TError;\n\t\t\thasError: true;\n\t };\n\nexport const useErrorBoundary = <TError extends Error>() => {\n\tconst { resetErrorBoundary } = useErrorBoundaryContext();\n\n\tconst [state, setState] = useState<UseErrorBoundaryState<TError>>({\n\t\terror: null,\n\t\thasError: false,\n\t});\n\n\tif (state.hasError) {\n\t\tthrow state.error;\n\t}\n\n\tconst resetBoundary = useCallbackRef(() => {\n\t\tresetErrorBoundary();\n\n\t\tsetState({\n\t\t\terror: null,\n\t\t\thasError: false,\n\t\t});\n\t});\n\n\tconst showBoundary = useCallbackRef((error: TError) => {\n\t\tsetState({\n\t\t\terror,\n\t\t\thasError: true,\n\t\t});\n\t});\n\n\treturn { resetBoundary, showBoundary };\n};\n","import { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { Component } from \"react\";\nimport { ErrorBoundaryContextProvider } from \"./error-boundary-context\";\nimport type { ErrorBoundaryProps, FallbackProps } from \"./types\";\n\ntype ErrorBoundaryState =\n\t| {\n\t\t\terror: Error;\n\t\t\thasError: true;\n\t }\n\t| {\n\t\t\terror: null;\n\t\t\thasError: false;\n\t };\n\nconst initialState: ErrorBoundaryState = {\n\terror: null,\n\thasError: false,\n};\n\nconst hasArrayChanged = (a: unknown[] = [], b: unknown[] = []) => {\n\treturn a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));\n};\n\n/**\n * Copied from react-error-boundary package\n * @see https://github.com/bvaughn/react-error-boundary\n */\n\nclass ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n\tconstructor(props: ErrorBoundaryProps) {\n\t\tsuper(props);\n\n\t\tthis.state = initialState;\n\t}\n\n\tstatic getDerivedStateFromError(error: Error) {\n\t\treturn { error, hasError: true };\n\t}\n\n\toverride componentDidCatch(error: Error, info: React.ErrorInfo) {\n\t\tthis.props.onError?.(error, info);\n\t}\n\n\toverride componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState) {\n\t\tconst { hasError } = this.state;\n\t\tconst { resetKeys } = this.props;\n\n\t\t// There's an edge case where if the thing that triggered the error happens to *also* be in the resetKeys array, we'd end up resetting the error boundary immediately.\n\t\t// This would likely trigger a second error to be thrown.\n\t\t// So we make sure that we don't check the resetKeys on the first call of cDU after the error is set.\n\n\t\tif (hasError && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {\n\t\t\tthis.props.onReset?.({ next: resetKeys, prev: prevProps.resetKeys, reason: \"keys\" });\n\n\t\t\tthis.setState(initialState);\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst { children, fallback } = this.props;\n\t\tconst { error, hasError } = this.state;\n\n\t\tlet childToRender = children;\n\n\t\tif (hasError) {\n\t\t\tswitch (true) {\n\t\t\t\tcase isFunction(fallback): {\n\t\t\t\t\tconst props: FallbackProps = { error, resetErrorBoundary: this.#resetErrorBoundary };\n\n\t\t\t\t\tchildToRender = fallback(props);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase fallback !== undefined: {\n\t\t\t\t\tchildToRender = fallback;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tconsole.error(\"error-boundary requires a fallback prop\");\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryContextProvider\n\t\t\t\tvalue={{ error, hasError, resetErrorBoundary: this.#resetErrorBoundary }}\n\t\t\t>\n\t\t\t\t{childToRender}\n\t\t\t</ErrorBoundaryContextProvider>\n\t\t);\n\t}\n\n\t#resetErrorBoundary = (...parameters: unknown[]) => {\n\t\tconst { error } = this.state;\n\n\t\tif (error !== null) {\n\t\t\tthis.props.onReset?.({ parameters, reason: \"imperative-api\" });\n\n\t\t\tthis.setState(initialState);\n\t\t}\n\t};\n}\n\nexport { ErrorBoundary };\n","import * as React from \"react\";\n\nimport type { DiscriminatedRenderProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { Fragment as ReactFragment, Suspense, use } from \"react\";\nimport { ErrorBoundary, type ErrorBoundaryProps } from \"../error-boundary\";\n\ntype RenderPropFn<Tvalue> = (result: Tvalue) => React.ReactNode;\n\nexport type AwaitInnerProps<Tvalue> = DiscriminatedRenderProps<RenderPropFn<Tvalue>> & {\n\tpromise: Promise<Tvalue>;\n};\n\ntype AwaitProps<Tvalue> = AwaitInnerProps<Tvalue> & {\n\terrorFallback?: ErrorBoundaryProps[\"fallback\"];\n\tfallback?: React.ReactNode;\n};\n\nexport function Await<Tvalue>(props: AwaitProps<Tvalue>) {\n\tconst { errorFallback, fallback, ...restOfProps } = props;\n\n\tconst WithErrorBoundary = errorFallback ? ErrorBoundary : ReactFragment;\n\tconst WithSuspense = fallback ? Suspense : ReactFragment;\n\n\tconst errorBoundaryProps = { fallback: errorFallback };\n\tconst suspenseProps = { fallback };\n\n\treturn (\n\t\t<WithErrorBoundary {...errorBoundaryProps}>\n\t\t\t<WithSuspense {...suspenseProps}>\n\t\t\t\t<AwaitInner {...restOfProps} />\n\t\t\t</WithSuspense>\n\t\t</WithErrorBoundary>\n\t);\n}\n\nfunction AwaitInner<TValue>(props: AwaitInnerProps<TValue>) {\n\tconst { children, promise, render } = props;\n\n\tconst result = use(promise);\n\n\tif (typeof children === \"function\") {\n\t\treturn children(result);\n\t}\n\n\treturn render(result);\n}\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { __export } from './chunk-PZ5AY32C.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { getSingleSlot, getRegularChildren } from '@zayne-labs/toolkit-react/utils';
|
|
4
4
|
import { isFunction } from '@zayne-labs/toolkit-type-helpers';
|
|
5
5
|
|
|
6
6
|
var defaultConditionSymbol = Symbol("condition-default");
|
|
7
7
|
function SwitchRoot(props) {
|
|
8
8
|
const { children, condition = defaultConditionSymbol } = props;
|
|
9
|
-
const defaultCase =
|
|
9
|
+
const defaultCase = getSingleSlot(children, SwitchDefault, {
|
|
10
10
|
errorMessage: "Only one <Switch.Default> component is allowed",
|
|
11
11
|
throwOnMultipleSlotMatch: true
|
|
12
12
|
});
|
|
13
|
-
const childrenCasesArray =
|
|
13
|
+
const childrenCasesArray = getRegularChildren(children, SwitchDefault);
|
|
14
14
|
const matchedCase = childrenCasesArray.find(
|
|
15
15
|
(child) => condition === defaultConditionSymbol ? child.props.when : child.props.when === condition
|
|
16
16
|
);
|
|
@@ -25,7 +25,7 @@ function SwitchMatch({ children, when }) {
|
|
|
25
25
|
function SwitchDefault({ children }) {
|
|
26
26
|
return children;
|
|
27
27
|
}
|
|
28
|
-
SwitchDefault.
|
|
28
|
+
SwitchDefault.slotSymbol = Symbol("switch-default");
|
|
29
29
|
|
|
30
30
|
// src/components/common/switch/switch-parts.ts
|
|
31
31
|
var switch_parts_exports = {};
|
|
@@ -36,5 +36,5 @@ __export(switch_parts_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
export { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_exports };
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-SVQ4WBSO.js.map
|
|
40
|
+
//# sourceMappingURL=chunk-SVQ4WBSO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/common/switch/switch.tsx","../../src/components/common/switch/switch-parts.ts"],"names":[],"mappings":";;;;;AAmBA,IAAM,sBAAA,GAAyB,OAAO,mBAAmB,CAAA;AAElD,SAAS,WAA8B,KAAgC,EAAA;AAC7E,EAAA,MAAM,EAAE,QAAA,EAAU,SAAY,GAAA,sBAAA,EAA2B,GAAA,KAAA;AAEzD,EAAM,MAAA,WAAA,GAAc,aAAc,CAAA,QAAA,EAAU,aAAe,EAAA;AAAA,IAC1D,YAAc,EAAA,gDAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAM,MAAA,kBAAA,GAAqB,kBAAmB,CAAA,QAAA,EAAU,aAAa,CAAA;AAErE,EAAA,MAAM,cAAc,kBAAmB,CAAA,IAAA;AAAA,IAAK,CAAC,UAC5C,SAAc,KAAA,sBAAA,GAAyB,MAAM,KAAM,CAAA,IAAA,GAAO,KAAM,CAAA,KAAA,CAAM,IAAS,KAAA;AAAA,GAChF;AAEA,EAAA,OAAO,WAAe,IAAA,WAAA;AACvB;AAEO,SAAS,WAAmB,CAAA,EAAE,QAAU,EAAA,IAAA,EAAiC,EAAA;AAC/E,EAAI,IAAA,IAAA,IAAQ,IAAQ,IAAA,IAAA,KAAS,KAAO,EAAA;AACnC,IAAO,OAAA,IAAA;AAAA;AAGR,EAAA,OAAO,UAAW,CAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,IAAI,CAAI,GAAA,QAAA;AAChD;AAEO,SAAS,aAAA,CAAc,EAAE,QAAA,EAA2C,EAAA;AAC1E,EAAO,OAAA,QAAA;AACR;AACA,aAAc,CAAA,UAAA,GAAa,OAAO,gBAAgB,CAAA;;;ACjDlD,IAAA,oBAAA,GAAA;AAAA,QAAA,CAAA,oBAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,aAAA;AAAA,EAAA,KAAA,EAAA,MAAA,WAAA;AAAA,EAAA,IAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-SVQ4WBSO.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getRegularChildren, getSingleSlot } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ValidSwitchComponentType = React.ReactElement<SwitchMatchProps>;\n\ntype SwitchProps<TCondition> = {\n\tchildren: ValidSwitchComponentType | ValidSwitchComponentType[];\n\tcondition?: TCondition;\n};\n\ntype SwitchMatchProps<TWhen = unknown> = {\n\tchildren: React.ReactNode | ((whenValue: TWhen) => React.ReactNode);\n\twhen: false | TWhen | null | undefined;\n};\n\nconst defaultConditionSymbol = Symbol(\"condition-default\");\n\nexport function SwitchRoot<TCondition = true>(props: SwitchProps<TCondition>) {\n\tconst { children, condition = defaultConditionSymbol } = props;\n\n\tconst defaultCase = getSingleSlot(children, SwitchDefault, {\n\t\terrorMessage: \"Only one <Switch.Default> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst childrenCasesArray = getRegularChildren(children, SwitchDefault);\n\n\tconst matchedCase = childrenCasesArray.find((child) =>\n\t\tcondition === defaultConditionSymbol ? child.props.when : child.props.when === condition\n\t);\n\n\treturn matchedCase ?? defaultCase;\n}\n\nexport function SwitchMatch<TWhen>({ children, when }: SwitchMatchProps<TWhen>) {\n\tif (when == null || when === false) {\n\t\treturn null;\n\t}\n\n\treturn isFunction(children) ? children(when) : children;\n}\n\nexport function SwitchDefault({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nSwitchDefault.slotSymbol = Symbol(\"switch-default\");\n","export { SwitchDefault as Default, SwitchMatch as Match, SwitchRoot as Root } from \"./switch\";\n"]}
|
|
@@ -6,7 +6,7 @@ import * as React2 from 'react';
|
|
|
6
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
|
-
import {
|
|
9
|
+
import { getMultipleSlots } from '@zayne-labs/toolkit-react/utils';
|
|
10
10
|
import { useFormState, FormProvider, useWatch, Controller, useFormContext } from 'react-hook-form';
|
|
11
11
|
export { useFormContext } from 'react-hook-form';
|
|
12
12
|
|
|
@@ -132,9 +132,10 @@ function FormLabel(props) {
|
|
|
132
132
|
}
|
|
133
133
|
function FormInputGroup(props) {
|
|
134
134
|
const { children, className, ...restOfProps } = props;
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
const {
|
|
136
|
+
regularChildren,
|
|
137
|
+
slots: [leftItemSlot, rightItemSlot]
|
|
138
|
+
} = getMultipleSlots(children, [FormInputLeftItem, FormInputRightItem]);
|
|
138
139
|
return /* @__PURE__ */ React2.createElement(
|
|
139
140
|
"div",
|
|
140
141
|
{
|
|
@@ -143,9 +144,9 @@ function FormInputGroup(props) {
|
|
|
143
144
|
className: cnMerge("flex items-center justify-between gap-2", className),
|
|
144
145
|
...restOfProps
|
|
145
146
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
leftItemSlot,
|
|
148
|
+
regularChildren,
|
|
149
|
+
rightItemSlot
|
|
149
150
|
);
|
|
150
151
|
}
|
|
151
152
|
function FormInputLeftItem(props) {
|
|
@@ -161,7 +162,7 @@ function FormInputLeftItem(props) {
|
|
|
161
162
|
children
|
|
162
163
|
);
|
|
163
164
|
}
|
|
164
|
-
FormInputLeftItem.
|
|
165
|
+
FormInputLeftItem.slotSymbol = Symbol("leftItem");
|
|
165
166
|
function FormInputRightItem(props) {
|
|
166
167
|
const { as: Element = "span", children, className, ...restOfProps } = props;
|
|
167
168
|
return /* @__PURE__ */ React2.createElement(
|
|
@@ -175,7 +176,7 @@ function FormInputRightItem(props) {
|
|
|
175
176
|
children
|
|
176
177
|
);
|
|
177
178
|
}
|
|
178
|
-
FormInputRightItem.
|
|
179
|
+
FormInputRightItem.slotSymbol = Symbol("rightItem");
|
|
179
180
|
var inputTypesWithoutFullWith = /* @__PURE__ */ new Set(["checkbox", "radio"]);
|
|
180
181
|
function FormInputPrimitive(props) {
|
|
181
182
|
const fieldContextValues = useLaxFormFieldContext();
|
|
@@ -422,5 +423,5 @@ __export(form_parts_exports, {
|
|
|
422
423
|
});
|
|
423
424
|
|
|
424
425
|
export { FormControlledField, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldController, FormFieldSubscribe, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormStateSubscribe, FormSubmit, FormTextAreaPrimitive, form_parts_exports, useStrictFormFieldContext };
|
|
425
|
-
//# sourceMappingURL=chunk-
|
|
426
|
-
//# sourceMappingURL=chunk-
|
|
426
|
+
//# sourceMappingURL=chunk-V4YLNLT5.js.map
|
|
427
|
+
//# sourceMappingURL=chunk-V4YLNLT5.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","HookForm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,EAAA,KAAA,EAAA,MAAA,SAAA;AAAA,EAAA,UAAA,EAAA,MAAA,cAAA;AAAA,EAAA,aAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,cAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,cAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,KAAA,EAAA,MAAA,SAAA;AAAA,EAAA,IAAA,EAAA,MAAA,QAAA;AAAA,EAAA,cAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,MAAA,EAAA,MAAA,UAAA;AAAA,EAAA,iBAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-V4YLNLT5.js","sourcesContent":["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 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 [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\tgetMultipleSlots,\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\tuseStrictFormFieldContext,\n\tuseStrictGetFieldState,\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: InferProps<\"div\">) {\n\tconst { children, className, ...restOfProps } = props;\n\tconst {\n\t\tregularChildren,\n\t\tslots: [leftItemSlot, rightItemSlot],\n\t} = getMultipleSlots(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{regularChildren}\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.slotSymbol = Symbol(\"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.slotSymbol = Symbol(\"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\tfieldState?: Partial<ControllerFieldState>;\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\tfieldState?: Partial<ControllerFieldState>;\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\tfieldState,\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 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\tfieldState,\n\t\tid = fieldContextValues?.formItemId,\n\t\tname = fieldContextValues?.name,\n\t\t...restOfProps\n\t} = props;\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 fieldState = useStrictGetFieldState();\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\tfieldState={fieldState}\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"]}
|
|
@@ -1,8 +1,77 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
import { DiscriminatedRenderProps } from '@zayne-labs/toolkit-react/utils';
|
|
1
4
|
export { ForBase, ForList, ForRenderProps, getElementList } from './for/index.js';
|
|
2
5
|
export { Show, ShowContent, ShowFallback, ShowRoot } from './show/index.js';
|
|
3
6
|
export { Slot, Slottable } from './slot/index.js';
|
|
4
7
|
export { Switch, SwitchDefault, SwitchMatch, SwitchRoot } from './switch/index.js';
|
|
5
8
|
export { Teleport } from './teleport/index.js';
|
|
6
|
-
import 'react';
|
|
7
|
-
import '@zayne-labs/toolkit-react/utils';
|
|
8
9
|
import '@zayne-labs/toolkit-type-helpers';
|
|
10
|
+
|
|
11
|
+
type ErrorBoundaryContextType = {
|
|
12
|
+
error: unknown;
|
|
13
|
+
hasError: boolean;
|
|
14
|
+
resetErrorBoundary: (...args: unknown[]) => void;
|
|
15
|
+
};
|
|
16
|
+
declare const useErrorBoundaryContext: () => ErrorBoundaryContextType;
|
|
17
|
+
|
|
18
|
+
declare const useErrorBoundary: <TError extends Error>() => {
|
|
19
|
+
resetBoundary: () => void;
|
|
20
|
+
showBoundary: (error: TError) => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type FallbackProps = {
|
|
24
|
+
error: unknown;
|
|
25
|
+
resetErrorBoundary: (...args: unknown[]) => void;
|
|
26
|
+
};
|
|
27
|
+
type ErrorBoundaryProps = {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
fallback: React.ReactNode | ((props: FallbackProps) => React.ReactNode);
|
|
30
|
+
onError?: (error: Error, info: React.ErrorInfo & {
|
|
31
|
+
ownerStack?: string;
|
|
32
|
+
}) => void;
|
|
33
|
+
onReset?: (details: {
|
|
34
|
+
next: unknown[] | undefined;
|
|
35
|
+
prev: unknown[] | undefined;
|
|
36
|
+
reason: "keys";
|
|
37
|
+
} | {
|
|
38
|
+
parameters: unknown[];
|
|
39
|
+
reason: "imperative-api";
|
|
40
|
+
}) => void;
|
|
41
|
+
resetKeys?: unknown[];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type ErrorBoundaryState = {
|
|
45
|
+
error: Error;
|
|
46
|
+
hasError: true;
|
|
47
|
+
} | {
|
|
48
|
+
error: null;
|
|
49
|
+
hasError: false;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Copied from react-error-boundary package
|
|
53
|
+
* @see https://github.com/bvaughn/react-error-boundary
|
|
54
|
+
*/
|
|
55
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
56
|
+
#private;
|
|
57
|
+
constructor(props: ErrorBoundaryProps);
|
|
58
|
+
static getDerivedStateFromError(error: Error): {
|
|
59
|
+
error: Error;
|
|
60
|
+
hasError: boolean;
|
|
61
|
+
};
|
|
62
|
+
componentDidCatch(error: Error, info: react.ErrorInfo): void;
|
|
63
|
+
componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
|
|
64
|
+
render(): react.JSX.Element;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
type RenderPropFn<Tvalue> = (result: Tvalue) => react.ReactNode;
|
|
68
|
+
type AwaitInnerProps<Tvalue> = DiscriminatedRenderProps<RenderPropFn<Tvalue>> & {
|
|
69
|
+
promise: Promise<Tvalue>;
|
|
70
|
+
};
|
|
71
|
+
type AwaitProps<Tvalue> = AwaitInnerProps<Tvalue> & {
|
|
72
|
+
errorFallback?: ErrorBoundaryProps["fallback"];
|
|
73
|
+
fallback?: react.ReactNode;
|
|
74
|
+
};
|
|
75
|
+
declare function Await<Tvalue>(props: AwaitProps<Tvalue>): react.JSX.Element;
|
|
76
|
+
|
|
77
|
+
export { Await, type AwaitInnerProps, ErrorBoundary, type ErrorBoundaryContextType, type ErrorBoundaryProps, type FallbackProps, useErrorBoundary, useErrorBoundaryContext };
|
package/dist/esm/common/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
export { Await, ErrorBoundary, useErrorBoundary, useErrorBoundaryContext } from '../chunk-P6HRTILR.js';
|
|
2
2
|
export { ForBase, ForList, getElementList } from '../chunk-DW3FXTFL.js';
|
|
3
|
-
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from '../chunk-
|
|
3
|
+
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from '../chunk-FPCKBOJN.js';
|
|
4
4
|
export { Slot, Slottable } from '../chunk-ENDWJXPF.js';
|
|
5
|
-
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from '../chunk-JKLRBPJZ.js';
|
|
6
5
|
export { Teleport } from '../chunk-CB2EZJYW.js';
|
|
6
|
+
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from '../chunk-SVQ4WBSO.js';
|
|
7
7
|
import '../chunk-PZ5AY32C.js';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -10,13 +10,13 @@ declare function ShowContent({ children }: {
|
|
|
10
10
|
children: react.ReactNode;
|
|
11
11
|
}): react.ReactNode;
|
|
12
12
|
declare namespace ShowContent {
|
|
13
|
-
var
|
|
13
|
+
var slotSymbol: symbol;
|
|
14
14
|
}
|
|
15
15
|
declare function ShowFallback({ children }: {
|
|
16
16
|
children: react.ReactNode;
|
|
17
17
|
}): react.ReactNode;
|
|
18
18
|
declare namespace ShowFallback {
|
|
19
|
-
var
|
|
19
|
+
var slotSymbol: symbol;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
declare namespace showParts {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from '../../chunk-
|
|
1
|
+
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from '../../chunk-FPCKBOJN.js';
|
|
2
2
|
import '../../chunk-PZ5AY32C.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -9,15 +9,13 @@ type SwitchMatchProps<TWhen = unknown> = {
|
|
|
9
9
|
children: react.ReactNode | ((whenValue: TWhen) => react.ReactNode);
|
|
10
10
|
when: false | TWhen | null | undefined;
|
|
11
11
|
};
|
|
12
|
-
declare function SwitchRoot<TCondition = true>(props: SwitchProps<TCondition>):
|
|
13
|
-
children: react.ReactNode;
|
|
14
|
-
}, string | react.JSXElementConstructor<any>> | undefined;
|
|
12
|
+
declare function SwitchRoot<TCondition = true>(props: SwitchProps<TCondition>): react.ReactNode;
|
|
15
13
|
declare function SwitchMatch<TWhen>({ children, when }: SwitchMatchProps<TWhen>): react.ReactNode;
|
|
16
14
|
declare function SwitchDefault({ children }: {
|
|
17
15
|
children: react.ReactNode;
|
|
18
16
|
}): react.ReactNode;
|
|
19
17
|
declare namespace SwitchDefault {
|
|
20
|
-
var
|
|
18
|
+
var slotSymbol: symbol;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
declare namespace switchParts {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from '../../chunk-
|
|
1
|
+
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from '../../chunk-SVQ4WBSO.js';
|
|
2
2
|
import '../../chunk-PZ5AY32C.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { useDragScroll } from './ui/drag-scroll/index.js';
|
|
|
4
4
|
export { DropZone, InputProps, RootProps, UseDropZoneProps, useDropZone } from './ui/drop-zone/index.js';
|
|
5
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 { useFormContext as useFormRootContext } from 'react-hook-form';
|
|
7
|
+
export { Await, AwaitInnerProps, ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext } from './common/index.js';
|
|
7
8
|
export { ForBase, ForList, ForRenderProps, getElementList } from './common/for/index.js';
|
|
8
9
|
export { Show, ShowContent, ShowFallback, ShowRoot } from './common/show/index.js';
|
|
9
10
|
export { Slot, Slottable } from './common/slot/index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -3,14 +3,14 @@ export { card_parts_exports as Card, CardContent, CardDescription, CardFooter, C
|
|
|
3
3
|
export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup } from './chunk-GVL6BLX5.js';
|
|
4
4
|
export { useDragScroll } from './chunk-E42DOTGX.js';
|
|
5
5
|
export { DropZone, useDropZone } from './chunk-2YCUMTC7.js';
|
|
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, useFormContext as useFormRootContext } from './chunk-
|
|
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, useFormContext as useFormRootContext } from './chunk-V4YLNLT5.js';
|
|
7
7
|
import './chunk-OHG7GB7O.js';
|
|
8
|
-
|
|
8
|
+
export { Await, ErrorBoundary, useErrorBoundary, useErrorBoundaryContext } from './chunk-P6HRTILR.js';
|
|
9
9
|
export { ForBase, ForList, getElementList } from './chunk-DW3FXTFL.js';
|
|
10
|
-
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from './chunk-
|
|
10
|
+
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from './chunk-FPCKBOJN.js';
|
|
11
11
|
export { Slot, Slottable } from './chunk-ENDWJXPF.js';
|
|
12
|
-
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from './chunk-JKLRBPJZ.js';
|
|
13
12
|
export { Teleport } from './chunk-CB2EZJYW.js';
|
|
13
|
+
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from './chunk-SVQ4WBSO.js';
|
|
14
14
|
import './chunk-PZ5AY32C.js';
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -69,6 +69,8 @@ declare const useDragScroll: <TElement extends HTMLElement>(props?: DragScrollPr
|
|
|
69
69
|
inert?: boolean | undefined;
|
|
70
70
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
71
71
|
is?: string | undefined;
|
|
72
|
+
exportparts?: string | undefined;
|
|
73
|
+
part?: string | undefined;
|
|
72
74
|
"aria-activedescendant"?: string | undefined;
|
|
73
75
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
74
76
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -276,6 +278,8 @@ declare const useDragScroll: <TElement extends HTMLElement>(props?: DragScrollPr
|
|
|
276
278
|
onLostPointerCaptureCapture?: react.PointerEventHandler<HTMLElement> | undefined;
|
|
277
279
|
onScroll?: react.UIEventHandler<HTMLElement> | undefined;
|
|
278
280
|
onScrollCapture?: react.UIEventHandler<HTMLElement> | undefined;
|
|
281
|
+
onScrollEnd?: react.UIEventHandler<HTMLElement> | undefined;
|
|
282
|
+
onScrollEndCapture?: react.UIEventHandler<HTMLElement> | undefined;
|
|
279
283
|
onWheel?: react.WheelEventHandler<HTMLElement> | undefined;
|
|
280
284
|
onWheelCapture?: react.WheelEventHandler<HTMLElement> | undefined;
|
|
281
285
|
onAnimationStart?: react.AnimationEventHandler<HTMLElement> | undefined;
|
|
@@ -135,6 +135,8 @@ declare const useDropZone: (props: UseDropZoneProps) => {
|
|
|
135
135
|
inert?: boolean | undefined;
|
|
136
136
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
137
137
|
is?: string | undefined;
|
|
138
|
+
exportparts?: string | undefined;
|
|
139
|
+
part?: string | undefined;
|
|
138
140
|
"aria-activedescendant"?: string | undefined;
|
|
139
141
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
140
142
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -341,6 +343,8 @@ declare const useDropZone: (props: UseDropZoneProps) => {
|
|
|
341
343
|
onLostPointerCaptureCapture?: react.PointerEventHandler<HTMLInputElement> | undefined;
|
|
342
344
|
onScroll?: react.UIEventHandler<HTMLInputElement> | undefined;
|
|
343
345
|
onScrollCapture?: react.UIEventHandler<HTMLInputElement> | undefined;
|
|
346
|
+
onScrollEnd?: react.UIEventHandler<HTMLInputElement> | undefined;
|
|
347
|
+
onScrollEndCapture?: react.UIEventHandler<HTMLInputElement> | undefined;
|
|
344
348
|
onWheel?: react.WheelEventHandler<HTMLInputElement> | undefined;
|
|
345
349
|
onWheelCapture?: react.WheelEventHandler<HTMLInputElement> | undefined;
|
|
346
350
|
onAnimationStart?: react.AnimationEventHandler<HTMLInputElement> | undefined;
|
|
@@ -428,6 +432,8 @@ declare const useDropZone: (props: UseDropZoneProps) => {
|
|
|
428
432
|
inert?: boolean | undefined;
|
|
429
433
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
430
434
|
is?: string | undefined;
|
|
435
|
+
exportparts?: string | undefined;
|
|
436
|
+
part?: string | undefined;
|
|
431
437
|
"aria-activedescendant"?: string | undefined;
|
|
432
438
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
433
439
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -631,6 +637,8 @@ declare const useDropZone: (props: UseDropZoneProps) => {
|
|
|
631
637
|
onLostPointerCaptureCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
632
638
|
onScroll?: react.UIEventHandler<HTMLDivElement> | undefined;
|
|
633
639
|
onScrollCapture?: react.UIEventHandler<HTMLDivElement> | undefined;
|
|
640
|
+
onScrollEnd?: react.UIEventHandler<HTMLDivElement> | undefined;
|
|
641
|
+
onScrollEndCapture?: react.UIEventHandler<HTMLDivElement> | undefined;
|
|
634
642
|
onWheel?: react.WheelEventHandler<HTMLDivElement> | undefined;
|
|
635
643
|
onWheelCapture?: react.WheelEventHandler<HTMLDivElement> | undefined;
|
|
636
644
|
onAnimationStart?: react.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
@@ -46,18 +46,18 @@ type FormFieldControllerProps = Omit<ControllerProps<FieldValues, FieldPath<Fiel
|
|
|
46
46
|
declare function FormFieldController(props: FormFieldControllerProps): react.JSX.Element;
|
|
47
47
|
declare function FormFieldContext(props: FormFieldContextProps): react.ReactNode;
|
|
48
48
|
declare function FormLabel(props: InferProps<"label">): react.JSX.Element;
|
|
49
|
-
declare function FormInputGroup(props:
|
|
49
|
+
declare function FormInputGroup(props: InferProps<"div">): react.JSX.Element;
|
|
50
50
|
type FormSideItemProps = {
|
|
51
51
|
children?: react.ReactNode;
|
|
52
52
|
className?: string;
|
|
53
53
|
};
|
|
54
54
|
declare function FormInputLeftItem<TElement extends react.ElementType = "span">(props: PolymorphicProps<TElement, FormSideItemProps>): react.JSX.Element;
|
|
55
55
|
declare namespace FormInputLeftItem {
|
|
56
|
-
var
|
|
56
|
+
var slotSymbol: symbol;
|
|
57
57
|
}
|
|
58
58
|
declare function FormInputRightItem<TElement extends react.ElementType = "span">(props: PolymorphicProps<TElement, FormSideItemProps>): react.JSX.Element;
|
|
59
59
|
declare namespace FormInputRightItem {
|
|
60
|
-
var
|
|
60
|
+
var slotSymbol: symbol;
|
|
61
61
|
}
|
|
62
62
|
type FormInputPrimitiveProps<TFieldValues extends FieldValues = FieldValues> = Omit<react.ComponentPropsWithRef<"input">, "children"> & {
|
|
63
63
|
classNames?: {
|
|
@@ -1,11 +1,11 @@
|
|
|
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, useFormContext as useFormRootContext } from '../../chunk-
|
|
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, useFormContext as useFormRootContext } from '../../chunk-V4YLNLT5.js';
|
|
2
2
|
import '../../chunk-OHG7GB7O.js';
|
|
3
|
-
import '../../chunk-
|
|
3
|
+
import '../../chunk-P6HRTILR.js';
|
|
4
4
|
import '../../chunk-DW3FXTFL.js';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-FPCKBOJN.js';
|
|
6
6
|
import '../../chunk-ENDWJXPF.js';
|
|
7
|
-
import '../../chunk-JKLRBPJZ.js';
|
|
8
7
|
import '../../chunk-CB2EZJYW.js';
|
|
8
|
+
import '../../chunk-SVQ4WBSO.js';
|
|
9
9
|
import '../../chunk-PZ5AY32C.js';
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/ui/index.js
CHANGED
|
@@ -3,14 +3,14 @@ export { card_parts_exports as Card, CardContent, CardDescription, CardFooter, C
|
|
|
3
3
|
export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup } from '../chunk-GVL6BLX5.js';
|
|
4
4
|
export { useDragScroll } from '../chunk-E42DOTGX.js';
|
|
5
5
|
export { DropZone, useDropZone } from '../chunk-2YCUMTC7.js';
|
|
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, useFormContext as useFormRootContext } from '../chunk-
|
|
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, useFormContext as useFormRootContext } from '../chunk-V4YLNLT5.js';
|
|
7
7
|
import '../chunk-OHG7GB7O.js';
|
|
8
|
-
import '../chunk-
|
|
8
|
+
import '../chunk-P6HRTILR.js';
|
|
9
9
|
import '../chunk-DW3FXTFL.js';
|
|
10
|
-
import '../chunk-
|
|
10
|
+
import '../chunk-FPCKBOJN.js';
|
|
11
11
|
import '../chunk-ENDWJXPF.js';
|
|
12
|
-
import '../chunk-JKLRBPJZ.js';
|
|
13
12
|
import '../chunk-CB2EZJYW.js';
|
|
13
|
+
import '../chunk-SVQ4WBSO.js';
|
|
14
14
|
import '../chunk-PZ5AY32C.js';
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
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.5.1",
|
|
5
5
|
"description": "A composable UI/UI-utilities components library. ",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -48,28 +48,26 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@zayne-labs/toolkit-core": "^0.
|
|
52
|
-
"@zayne-labs/toolkit-react": "^0.
|
|
53
|
-
"@zayne-labs/toolkit-type-helpers": "^0.
|
|
51
|
+
"@zayne-labs/toolkit-core": "^0.9.2",
|
|
52
|
+
"@zayne-labs/toolkit-react": "^0.9.2",
|
|
53
|
+
"@zayne-labs/toolkit-type-helpers": "^0.9.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@arethetypeswrong/cli": "0.17.4",
|
|
57
57
|
"@size-limit/esbuild-why": "11.2.0",
|
|
58
58
|
"@size-limit/preset-small-lib": "11.2.0",
|
|
59
59
|
"@total-typescript/ts-reset": "0.6.1",
|
|
60
|
-
"@types/react": "^19.0.
|
|
60
|
+
"@types/react": "^19.0.12",
|
|
61
61
|
"@types/react-dom": "^19.0.4",
|
|
62
|
-
"@zayne-labs/
|
|
63
|
-
"
|
|
64
|
-
"concurrently": "^9.0.1",
|
|
62
|
+
"@zayne-labs/tsconfig": "0.7.9",
|
|
63
|
+
"concurrently": "^9.1.2",
|
|
65
64
|
"cross-env": "^7.0.3",
|
|
66
65
|
"publint": "^0.3.9",
|
|
67
|
-
"react": "^19.
|
|
68
|
-
"react-dom": "^19.
|
|
69
|
-
"react-hook-form": "^7.
|
|
66
|
+
"react": "^19.1.0",
|
|
67
|
+
"react-dom": "^19.1.0",
|
|
68
|
+
"react-hook-form": "^7.55.0",
|
|
70
69
|
"size-limit": "11.2.0",
|
|
71
70
|
"tailwind-merge": "^3.0.2",
|
|
72
|
-
"terser": "5.39.0",
|
|
73
71
|
"tsup": "8.4.0",
|
|
74
72
|
"typescript": "^5.8.2",
|
|
75
73
|
"zustand": "^5.0.3"
|
|
@@ -96,6 +94,8 @@
|
|
|
96
94
|
"dev": "pnpm build:dev --watch",
|
|
97
95
|
"lint:attw": "attw --pack . --profile esm-only --format table-flipped --ignore-rules=cjs-resolves-to-esm --ignore-rules=named-exports",
|
|
98
96
|
"lint:check-types": "tsc --pretty -p tsconfig.json",
|
|
97
|
+
"lint:eslint": "eslint . --max-warnings 0",
|
|
98
|
+
"lint:eslint:interactive": "pnpx eslint-interactive@latest . --max-warnings 0 --fix",
|
|
99
99
|
"lint:publint": "publint --strict .",
|
|
100
100
|
"lint:size": "size-limit",
|
|
101
101
|
"release:test": "pnpx pkg-pr-new publish"
|
|
@@ -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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A,aAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,cAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,cAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,KAAA,EAAA,MAAA,SAAA;AAAA,EAAA,IAAA,EAAA,MAAA,QAAA;AAAA,EAAA,cAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,MAAA,EAAA,MAAA,UAAA;AAAA,EAAA,iBAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-3OWAXCPZ.js","sourcesContent":["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 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 [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\tuseStrictFormFieldContext,\n\tuseStrictGetFieldState,\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\tfieldState?: Partial<ControllerFieldState>;\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\tfieldState?: Partial<ControllerFieldState>;\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\tfieldState,\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 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\tfieldState,\n\t\tid = fieldContextValues?.formItemId,\n\t\tname = fieldContextValues?.name,\n\t\t...restOfProps\n\t} = props;\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 fieldState = useStrictGetFieldState();\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\tfieldState={fieldState}\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-HKPJTORQ.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/common/switch/switch.tsx","../../src/components/common/switch/switch-parts.ts"],"names":[],"mappings":";;;;;AAmBA,IAAM,sBAAA,GAAyB,OAAO,mBAAmB,CAAA;AAElD,SAAS,WAA8B,KAAgC,EAAA;AAC7E,EAAA,MAAM,EAAE,QAAA,EAAU,SAAY,GAAA,sBAAA,EAA2B,GAAA,KAAA;AAEzD,EAAM,MAAA,WAAA,GAAc,cAAe,CAAA,QAAA,EAAU,aAAe,EAAA;AAAA,IAC3D,YAAc,EAAA,gDAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAM,MAAA,kBAAA,GAAqB,gBAAiB,CAAA,QAAA,EAAU,aAAa,CAAA;AAEnE,EAAA,MAAM,cAAc,kBAAmB,CAAA,IAAA;AAAA,IAAK,CAAC,UAC5C,SAAc,KAAA,sBAAA,GAAyB,MAAM,KAAM,CAAA,IAAA,GAAO,KAAM,CAAA,KAAA,CAAM,IAAS,KAAA;AAAA,GAChF;AAEA,EAAA,OAAO,WAAe,IAAA,WAAA;AACvB;AAEO,SAAS,WAAmB,CAAA,EAAE,QAAU,EAAA,IAAA,EAAiC,EAAA;AAC/E,EAAI,IAAA,IAAA,IAAQ,IAAQ,IAAA,IAAA,KAAS,KAAO,EAAA;AACnC,IAAO,OAAA,IAAA;AAAA;AAGR,EAAA,OAAO,UAAW,CAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,IAAI,CAAI,GAAA,QAAA;AAChD;AAEO,SAAS,aAAA,CAAc,EAAE,QAAA,EAA2C,EAAA;AAC1E,EAAO,OAAA,QAAA;AACR;AACA,aAAc,CAAA,IAAA,GAAO,MAAO,CAAA,GAAA,CAAI,gBAAgB,CAAA;;;ACjDhD,IAAA,oBAAA,GAAA;AAAA,QAAA,CAAA,oBAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,aAAA;AAAA,EAAA,KAAA,EAAA,MAAA,WAAA;AAAA,EAAA,IAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-JKLRBPJZ.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getOtherChildren, getSlotElement } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ValidSwitchComponentType = React.ReactElement<SwitchMatchProps>;\n\ntype SwitchProps<TCondition> = {\n\tchildren: ValidSwitchComponentType | ValidSwitchComponentType[];\n\tcondition?: TCondition;\n};\n\ntype SwitchMatchProps<TWhen = unknown> = {\n\tchildren: React.ReactNode | ((whenValue: TWhen) => React.ReactNode);\n\twhen: false | TWhen | null | undefined;\n};\n\nconst defaultConditionSymbol = Symbol(\"condition-default\");\n\nexport function SwitchRoot<TCondition = true>(props: SwitchProps<TCondition>) {\n\tconst { children, condition = defaultConditionSymbol } = props;\n\n\tconst defaultCase = getSlotElement(children, SwitchDefault, {\n\t\terrorMessage: \"Only one <Switch.Default> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst childrenCasesArray = getOtherChildren(children, SwitchDefault);\n\n\tconst matchedCase = childrenCasesArray.find((child) =>\n\t\tcondition === defaultConditionSymbol ? child.props.when : child.props.when === condition\n\t);\n\n\treturn matchedCase ?? defaultCase;\n}\n\nexport function SwitchMatch<TWhen>({ children, when }: SwitchMatchProps<TWhen>) {\n\tif (when == null || when === false) {\n\t\treturn null;\n\t}\n\n\treturn isFunction(children) ? children(when) : children;\n}\n\nexport function SwitchDefault({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nSwitchDefault.slot = Symbol.for(\"switch-default\");\n","export { SwitchDefault as Default, SwitchMatch as Match, SwitchRoot as Root } from \"./switch\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"names":[],"mappings":";;;;;AAaO,SAAS,QAAgB,CAAA,EAAE,QAAU,EAAA,QAAA,EAAU,MAA0B,EAAA;AAC/E,EAAA,IAAA,CAAK,QAAQ,IAAQ,IAAA,IAAA,KAAS,UAAU,CAAC,UAAA,CAAW,QAAQ,CAAG,EAAA;AAC9D,IAAM,MAAA,YAAA,GAAe,cAAe,CAAA,QAAA,EAAU,YAAc,EAAA;AAAA,MAC3D,YAAc,EAAA,mEAAA;AAAA,MACd,wBAA0B,EAAA;AAAA,KAC1B,CAAA;AAED,IAAA,IAAI,gBAAgB,QAAU,EAAA;AAC7B,MAAA,MAAM,IAAI,cAAe,CAAA;AAAA;AAAA,EAEzB,CAAA,CAAA;AAAA;AAGD,IAAA,OAAO,YAAgB,IAAA,QAAA;AAAA;AAGxB,EAAI,IAAA,IAAA,IAAQ,IAAQ,IAAA,IAAA,KAAS,KAAO,EAAA;AACnC,IAAO,OAAA,QAAA;AAAA;AAGR,EAAA,MAAM,mBAAmB,UAAW,CAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,IAAI,CAAI,GAAA,QAAA;AAEjE,EAAM,MAAA,WAAA,GAAc,cAAe,CAAA,gBAAA,EAAkB,WAAa,EAAA;AAAA,IACjE,YAAc,EAAA,8CAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,gBAAgB,gBAAiB,CAAA,gBAAA,EAAkB,CAAC,YAAA,EAAc,WAAW,CAAC,CAAA;AAEpF,EAAA,OAAO,WAAe,IAAA,aAAA;AACvB;AAEO,SAAS,WAAA,CAAY,EAAE,QAAA,EAA2C,EAAA;AACxE,EAAO,OAAA,QAAA;AACR;AACA,WAAY,CAAA,IAAA,GAAO,MAAO,CAAA,GAAA,CAAI,SAAS,CAAA;AAEhC,SAAS,YAAA,CAAa,EAAE,QAAA,EAA2C,EAAA;AACzE,EAAO,OAAA,QAAA;AACR;AACA,YAAa,CAAA,IAAA,GAAO,MAAO,CAAA,GAAA,CAAI,eAAe,CAAA;;;ACrD9C,IAAA,kBAAA,GAAA;AAAA,QAAA,CAAA,kBAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,WAAA;AAAA,EAAA,QAAA,EAAA,MAAA,YAAA;AAAA,EAAA,SAAA,EAAA,MAAA,YAAA;AAAA,EAAA,IAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-NCS3WKFW.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getOtherChildren, getSlotElement } from \"@zayne-labs/toolkit-react/utils\";\nimport { AssertionError, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ShowProps<TWhen> = {\n\tchildren: React.ReactNode | ((whenValue: TWhen) => React.ReactNode);\n\tfallback?: React.ReactNode;\n\twhen: false | TWhen | null | undefined;\n};\n\nexport function ShowRoot<TWhen>({ children, fallback, when }: ShowProps<TWhen>) {\n\tif ((when == null || when === false) && !isFunction(children)) {\n\t\tconst fallBackSlot = getSlotElement(children, ShowFallback, {\n\t\t\terrorMessage: \"Only one <Show.Fallback> or <Show.OtherWise> component is allowed\",\n\t\t\tthrowOnMultipleSlotMatch: true,\n\t\t});\n\n\t\tif (fallBackSlot && fallback) {\n\t\t\tthrow new AssertionError(`\n\t\t\tThe fallback prop and <Show.Fallback>/<Show.OtherWise> cannot be used at the same time.\n\t\t`);\n\t\t}\n\n\t\treturn fallBackSlot ?? fallback;\n\t}\n\n\tif (when == null || when === false) {\n\t\treturn fallback;\n\t}\n\n\tconst resolvedChildren = isFunction(children) ? children(when) : children;\n\n\tconst contentSlot = getSlotElement(resolvedChildren, ShowContent, {\n\t\terrorMessage: \"Only one <Show.Content> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst otherChildren = getOtherChildren(resolvedChildren, [ShowFallback, ShowContent]);\n\n\treturn contentSlot ?? otherChildren;\n}\n\nexport function ShowContent({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nShowContent.slot = Symbol.for(\"content\");\n\nexport function ShowFallback({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nShowFallback.slot = Symbol.for(\"show-fallback\");\n","export {\n\tShowContent as Content,\n\tShowFallback as Fallback,\n\tShowFallback as OtherWise,\n\tShowRoot as Root,\n} from \"./show\";\n"]}
|