@zayne-labs/ui-react 0.9.8 → 0.9.12
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/await-parts-BJ6C-y1f.d.ts +36 -0
- package/dist/esm/chunk-CLGH26AQ.js +337 -0
- package/dist/esm/chunk-CLGH26AQ.js.map +1 -0
- package/dist/esm/chunk-CWUEUCR5.js +3 -0
- package/dist/esm/chunk-CWUEUCR5.js.map +1 -0
- package/dist/esm/chunk-EYWTW54R.js +42 -0
- package/dist/esm/chunk-EYWTW54R.js.map +1 -0
- package/dist/esm/chunk-G5BNZM66.js +32 -0
- package/dist/esm/chunk-G5BNZM66.js.map +1 -0
- package/dist/esm/{chunk-IREUBYDK.js → chunk-JC52CA2O.js} +26 -23
- package/dist/esm/chunk-JC52CA2O.js.map +1 -0
- package/dist/esm/chunk-KLEJZWKY.js +45 -0
- package/dist/esm/chunk-KLEJZWKY.js.map +1 -0
- package/dist/esm/{chunk-V5DSTESN.js → chunk-M7YXNGT6.js} +3 -3
- package/dist/esm/{chunk-V5DSTESN.js.map → chunk-M7YXNGT6.js.map} +1 -1
- package/dist/esm/chunk-MT2MQDK2.js +13 -0
- package/dist/esm/chunk-MT2MQDK2.js.map +1 -0
- package/dist/esm/chunk-MY5NL5PB.js +627 -0
- package/dist/esm/chunk-MY5NL5PB.js.map +1 -0
- package/dist/esm/{chunk-XZRSR3EM.js → chunk-N4274N5K.js} +6 -2
- package/dist/esm/chunk-N4274N5K.js.map +1 -0
- package/dist/esm/chunk-V5ZPMMIH.js +121 -0
- package/dist/esm/chunk-V5ZPMMIH.js.map +1 -0
- package/dist/esm/{chunk-2P3P5AXH.js → chunk-Y5VBSXZS.js} +14 -7
- package/dist/esm/chunk-Y5VBSXZS.js.map +1 -0
- package/dist/esm/{chunk-IUEPHHGO.js → chunk-YO5LJ7ZJ.js} +2 -2
- package/dist/esm/{chunk-IUEPHHGO.js.map → chunk-YO5LJ7ZJ.js.map} +1 -1
- package/dist/esm/chunk-Z6JJE4G6.js +68 -0
- package/dist/esm/chunk-Z6JJE4G6.js.map +1 -0
- package/dist/esm/chunk-ZSDYJOYB.js +274 -0
- package/dist/esm/chunk-ZSDYJOYB.js.map +1 -0
- package/dist/esm/components/common/await/index.d.ts +10 -12
- package/dist/esm/components/common/await/index.js +5 -24
- package/dist/esm/components/common/await/index.js.map +1 -1
- package/dist/esm/components/common/error-boundary/index.d.ts +6 -30
- package/dist/esm/components/common/error-boundary/index.js +1 -2
- package/dist/esm/components/common/for/index.d.ts +6 -20
- package/dist/esm/components/common/index.d.ts +13 -0
- package/dist/esm/components/common/index.js +14 -0
- package/dist/esm/components/common/show/index.js +2 -2
- package/dist/esm/components/common/slot/index.d.ts +7 -3
- package/dist/esm/components/common/slot/index.js +1 -1
- package/dist/esm/components/common/suspense-with-boundary/index.d.ts +3 -3
- package/dist/esm/components/common/suspense-with-boundary/index.js +2 -12
- package/dist/esm/components/common/suspense-with-boundary/index.js.map +1 -1
- package/dist/esm/components/common/switch/index.js +3 -40
- package/dist/esm/components/common/switch/index.js.map +1 -1
- package/dist/esm/components/common/teleport/index.js +1 -29
- package/dist/esm/components/common/teleport/index.js.map +1 -1
- package/dist/esm/components/ui/card/index.js +4 -43
- package/dist/esm/components/ui/card/index.js.map +1 -1
- package/dist/esm/components/ui/carousel/index.js +14 -273
- package/dist/esm/components/ui/carousel/index.js.map +1 -1
- package/dist/esm/components/ui/drag-scroll/index.js +2 -119
- package/dist/esm/components/ui/drag-scroll/index.js.map +1 -1
- package/dist/esm/components/ui/drop-zone/index.d.ts +8 -181
- package/dist/esm/components/ui/drop-zone/index.js +15 -327
- package/dist/esm/components/ui/drop-zone/index.js.map +1 -1
- package/dist/esm/components/ui/form/index.js +7 -625
- package/dist/esm/components/ui/form/index.js.map +1 -1
- package/dist/esm/components/ui/index.d.ts +11 -0
- package/dist/esm/components/ui/index.js +21 -0
- package/dist/esm/drop-zone-parts-CvseSoXA.d.ts +186 -0
- package/dist/esm/error-boundary-BD0X61Sg.d.ts +28 -0
- package/dist/esm/for-8C6fFbN6.d.ts +21 -0
- package/dist/esm/{lib/utils/getSlotMap/index.d.ts → getSlotMap-DTkxtGhd.d.ts} +10 -8
- package/dist/esm/lib/utils/{getSlot/index.d.ts → index.d.ts} +1 -0
- package/dist/esm/lib/utils/index.js +5 -0
- package/dist/esm/lib/utils/index.js.map +1 -0
- package/dist/esm/{types-CeWumkhm.d.ts → types-mdfDDNrr.d.ts} +9 -6
- package/dist/style.css +1 -1
- package/package.json +17 -16
- package/dist/esm/chunk-2P3P5AXH.js.map +0 -1
- package/dist/esm/chunk-IREUBYDK.js.map +0 -1
- package/dist/esm/chunk-XZRSR3EM.js.map +0 -1
- package/dist/esm/lib/utils/getSlot/index.js +0 -4
- package/dist/esm/lib/utils/getSlotMap/index.js +0 -4
- /package/dist/esm/{lib/utils/getSlot → components/common}/index.js.map +0 -0
- /package/dist/esm/{lib/utils/getSlotMap → components/ui}/index.js.map +0 -0
|
@@ -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"],"names":[],"mappings":";;;;;;AAQO,IAAM,CAAC,oBAAA,EAAsB,uBAAuB,CAAA,GAC1D,mBAA8C,CAAA;AAAA,EAC7C,QAAU,EAAA,yBAAA;AAAA,EACV,IAAM,EAAA,sBAAA;AAAA,EACN,YAAc,EAAA;AACf,CAAC;ACCK,IAAM,mBAAmB,MAA4B;AAC3D,EAAM,MAAA,EAAE,kBAAmB,EAAA,GAAI,uBAAwB,EAAA;AAEvD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,QAAwC,CAAA;AAAA,IACjE,KAAO,EAAA,IAAA;AAAA,IACP,QAAU,EAAA;AAAA,GACV,CAAA;AAED,EAAA,IAAI,MAAM,QAAU,EAAA;AACnB,IAAA,MAAM,KAAM,CA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A,EAAqB,KAAO,EAAA,YAAA,EAAA,EAAe,aAAc,CAAA;AAAA;AAClE,EAEA,mBAAA,GAAsB,IAAI,UAA0B,KAAA;AACnD,IAAM,MAAA,EAAE,KAAM,EAAA,GAAI,IAAK,CAAA,KAAA;AAEvB,IAAA,IAAI,UAAU,IAAM,EAAA;AACnB,MAAA,IAAA,CAAK,MAAM,OAAU,GAAA;AAAA,QACpB,IAAM,EAAA,UAAA;AAAA,QACN,MAAQ,EAAA;AAAA,OACR,CAAA;AAED,MAAA,IAAA,CAAK,SAAS,YAAY,CAAA;AAAA;AAC3B,GACD;AACD","file":"chunk-JC52CA2O.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 [ErrorBoundaryContext, 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 { ErrorBoundaryContext, type ErrorBoundaryContextType } 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 = (arrayOne: unknown[] = [], arrayTwo: unknown[] = []) => {\n\treturn (\n\t\tarrayOne.length !== arrayTwo.length\n\t\t|| arrayOne.some((item, index) => !Object.is(item, arrayTwo[index]))\n\t);\n};\n\n/**\n * Copied from react-error-boundary package\n * @see https://github.com/bvaughn/react-error-boundary\n */\n\nexport class 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?.({\n\t\t\terror,\n\t\t\tinfo,\n\t\t});\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?.({\n\t\t\t\tnext: resetKeys,\n\t\t\t\tprev: prevProps.resetKeys,\n\t\t\t\treason: \"keys\",\n\t\t\t});\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 fallbackRenderProps = {\n\t\t\t\t\t\terror,\n\t\t\t\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t\t\t\t} satisfies FallbackProps;\n\n\t\t\t\t\tchildToRender = fallback(fallbackRenderProps);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase Boolean(fallback): {\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.warn(\"No fallback provided to error boundary\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst contextValue = {\n\t\t\terror,\n\t\t\thasError,\n\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t} satisfies ErrorBoundaryContextType;\n\n\t\treturn <ErrorBoundaryContext value={contextValue}>{childToRender}</ErrorBoundaryContext>;\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?.({\n\t\t\t\targs: parameters,\n\t\t\t\treason: \"imperative-api\",\n\t\t\t});\n\n\t\t\tthis.setState(initialState);\n\t\t}\n\t};\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cnMerge } from './chunk-OHG7GB7O.js';
|
|
2
|
+
import { slot_parts_exports } from './chunk-Y5VBSXZS.js';
|
|
3
|
+
import { __export } from './chunk-PZ5AY32C.js';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
function CardRoot(props) {
|
|
7
|
+
const { as: Element = "article", ...restOfProps } = props;
|
|
8
|
+
return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
|
|
9
|
+
}
|
|
10
|
+
function CardHeader(props) {
|
|
11
|
+
const { as: Element = "header", ...restOfProps } = props;
|
|
12
|
+
return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
|
|
13
|
+
}
|
|
14
|
+
function CardTitle(props) {
|
|
15
|
+
const { as: Element = "h3", className, ...restOfProps } = props;
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Element, { className: cnMerge("font-semibold", className), ...restOfProps });
|
|
17
|
+
}
|
|
18
|
+
function CardDescription(props) {
|
|
19
|
+
const { as: Element = "p", className, ...restOfProps } = props;
|
|
20
|
+
return /* @__PURE__ */ React.createElement(Element, { className: cnMerge("text-shadcn-muted-foreground text-sm", className), ...restOfProps });
|
|
21
|
+
}
|
|
22
|
+
function CardContent(props) {
|
|
23
|
+
const { as: Element = "div", ...restOfProps } = props;
|
|
24
|
+
return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
|
|
25
|
+
}
|
|
26
|
+
function CardFooter(props) {
|
|
27
|
+
const { as: Element = "footer", asChild, ...restOfProps } = props;
|
|
28
|
+
const Component = asChild ? slot_parts_exports.Root : Element;
|
|
29
|
+
return /* @__PURE__ */ React.createElement(Component, { ...restOfProps });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/components/ui/card/card-parts.ts
|
|
33
|
+
var card_parts_exports = {};
|
|
34
|
+
__export(card_parts_exports, {
|
|
35
|
+
Content: () => CardContent,
|
|
36
|
+
Description: () => CardDescription,
|
|
37
|
+
Footer: () => CardFooter,
|
|
38
|
+
Header: () => CardHeader,
|
|
39
|
+
Root: () => CardRoot,
|
|
40
|
+
Title: () => CardTitle
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_exports };
|
|
44
|
+
//# sourceMappingURL=chunk-KLEJZWKY.js.map
|
|
45
|
+
//# sourceMappingURL=chunk-KLEJZWKY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ui/card/card.tsx","../../src/components/ui/card/card-parts.ts"],"names":[],"mappings":";;;;;AAMO,SAAS,SACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,SAAW,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEpD,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AAClC;AAEO,SAAS,WACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,QAAU,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEnD,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AAClC;AAEO,SAAS,UAAqD,KAAmC,EAAA;AACvG,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,MAAM,SAAW,EAAA,GAAG,aAAgB,GAAA,KAAA;AAE1D,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,SAAW,EAAA,OAAA,CAAQ,iBAAiB,SAAS,CAAA,EAAI,GAAG,WAAa,EAAA,CAAA;AAClF;AAEO,SAAS,gBACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,KAAK,SAAW,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEzD,EACC,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,SAAW,EAAA,OAAA,CAAQ,wCAAwC,SAAS,CAAA,EAAI,GAAG,WAAa,EAAA,CAAA;AAEnG;AAEO,SAAS,YACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,KAAO,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEhD,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AAClC;AAEO,SAAS,WACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,UAAU,OAAS,EAAA,GAAG,aAAgB,GAAA,KAAA;AAE5D,EAAM,MAAA,SAAA,GAAY,OAAU,GAAA,kBAAA,CAAK,IAAO,GAAA,OAAA;AAExC,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAW,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AACpC;;;ACtDA,IAAA,kBAAA,GAAA;AAAA,QAAA,CAAA,kBAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,WAAA;AAAA,EAAA,WAAA,EAAA,MAAA,eAAA;AAAA,EAAA,MAAA,EAAA,MAAA,UAAA;AAAA,EAAA,MAAA,EAAA,MAAA,UAAA;AAAA,EAAA,IAAA,EAAA,MAAA,QAAA;AAAA,EAAA,KAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-KLEJZWKY.js","sourcesContent":["import * as React from \"react\";\n\nimport { Slot } from \"@/components/common/slot\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\n\nexport function CardRoot<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"article\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardHeader<TElement extends React.ElementType = \"header\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"header\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardTitle<TElement extends React.ElementType = \"h3\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"h3\", className, ...restOfProps } = props;\n\n\treturn <Element className={cnMerge(\"font-semibold\", className)} {...restOfProps} />;\n}\n\nexport function CardDescription<TElement extends React.ElementType = \"p\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"p\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element className={cnMerge(\"text-shadcn-muted-foreground text-sm\", className)} {...restOfProps} />\n\t);\n}\n\nexport function CardContent<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"div\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardFooter<TElement extends React.ElementType = \"footer\">(\n\tprops: PolymorphicProps<TElement, { asChild?: boolean }>\n) {\n\tconst { as: Element = \"footer\", asChild, ...restOfProps } = props;\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn <Component {...restOfProps} />;\n}\n","export {\n\tCardContent as Content,\n\tCardDescription as Description,\n\tCardFooter as Footer,\n\tCardHeader as Header,\n\tCardRoot as Root,\n\tCardTitle as Title,\n} from \"./card\";\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getMultipleSlots } from './chunk-
|
|
1
|
+
import { getMultipleSlots } from './chunk-YO5LJ7ZJ.js';
|
|
2
2
|
import { __export } from './chunk-PZ5AY32C.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import { isFunction, assert } from '@zayne-labs/toolkit-type-helpers';
|
|
@@ -44,5 +44,5 @@ __export(show_parts_exports, {
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
export { ShowContent, ShowFallback, ShowRoot, show_parts_exports };
|
|
47
|
-
//# sourceMappingURL=chunk-
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
47
|
+
//# sourceMappingURL=chunk-M7YXNGT6.js.map
|
|
48
|
+
//# sourceMappingURL=chunk-M7YXNGT6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"names":[],"mappings":";;;;;AAaO,SAAS,SAAgB,KAAyB,EAAA;AACxD,EAAA,MAAM,EAAE,QAAA,EAAU,QAAU,EAAA,IAAA,EAAS,GAAA,KAAA;AAErC,EAAA,MAAM,mBAAmB,UAAW,CAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,IAAa,CAAI,GAAA,QAAA;AAE1E,EAAM,MAAA;AAAA,IACL,eAAA;AAAA,IACA,KAAA,EAAO,CAAC,WAAA,EAAa,YAAY;AAAA,MAC9B,gBAAiB,CAAA,gBAAA,EAAkB,CAAC,WAAA,EAAa,YAAY,CAAG,EAAA;AAAA,IACnE,YAAc,EAAA;AAAA,MACb,8CAAA;AAAA,MACA;AAAA,KACD;AAAA,IACA,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAA,IAAI,CAAC,IAAM,EAAA;AACV,IAAA,MAAA;AAAA,MACC,EAAE,YAAgB,IAAA,QAAA,CAAA;AAAA,MAClB;AAAA,KACD;AAEA,IAAA,OAAO,YAAgB,IAAA,QAAA;AAAA;AAGxB,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,cAAc,CAAA;AAEvC,SAAS,YAAA,CAAa,EAAE,QAAA,EAA2C,EAAA;AACzE,EAAO,OAAA,QAAA;AACR;AACA,YAAa,CAAA,UAAA,GAAa,OAAO,eAAe,CAAA;;;ACjDhD,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-
|
|
1
|
+
{"version":3,"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"names":[],"mappings":";;;;;AAaO,SAAS,SAAgB,KAAyB,EAAA;AACxD,EAAA,MAAM,EAAE,QAAA,EAAU,QAAU,EAAA,IAAA,EAAS,GAAA,KAAA;AAErC,EAAA,MAAM,mBAAmB,UAAW,CAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,IAAa,CAAI,GAAA,QAAA;AAE1E,EAAM,MAAA;AAAA,IACL,eAAA;AAAA,IACA,KAAA,EAAO,CAAC,WAAA,EAAa,YAAY;AAAA,MAC9B,gBAAiB,CAAA,gBAAA,EAAkB,CAAC,WAAA,EAAa,YAAY,CAAG,EAAA;AAAA,IACnE,YAAc,EAAA;AAAA,MACb,8CAAA;AAAA,MACA;AAAA,KACD;AAAA,IACA,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAA,IAAI,CAAC,IAAM,EAAA;AACV,IAAA,MAAA;AAAA,MACC,EAAE,YAAgB,IAAA,QAAA,CAAA;AAAA,MAClB;AAAA,KACD;AAEA,IAAA,OAAO,YAAgB,IAAA,QAAA;AAAA;AAGxB,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,cAAc,CAAA;AAEvC,SAAS,YAAA,CAAa,EAAE,QAAA,EAA2C,EAAA;AACzE,EAAO,OAAA,QAAA;AACR;AACA,YAAa,CAAA,UAAA,GAAa,OAAO,eAAe,CAAA;;;ACjDhD,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-M7YXNGT6.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getMultipleSlots } from \"@/lib/utils/getSlot\";\nimport { assert, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ShowProps<TWhen> = {\n\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\tfallback?: React.ReactNode;\n\twhen: false | TWhen | null | undefined;\n};\n\nexport function ShowRoot<TWhen>(props: ShowProps<TWhen>) {\n\tconst { children, fallback, when } = props;\n\n\tconst resolvedChildren = isFunction(children) ? children(when as TWhen) : children;\n\n\tconst {\n\t\tregularChildren,\n\t\tslots: [contentSlot, fallBackSlot],\n\t} = getMultipleSlots(resolvedChildren, [ShowContent, ShowFallback], {\n\t\terrorMessage: [\n\t\t\t\"Only one <Show.Content> component is allowed\",\n\t\t\t\"Only one <Show.Fallback> or <Show.OtherWise> component is allowed\",\n\t\t],\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tif (!when) {\n\t\tassert(\n\t\t\t!(fallBackSlot && fallback),\n\t\t\t\"The fallback prop and <Show.Fallback> cannot be used at the same time.\"\n\t\t);\n\n\t\treturn fallBackSlot ?? fallback;\n\t}\n\n\treturn contentSlot ?? regularChildren;\n}\n\nexport function ShowContent({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nShowContent.slotSymbol = Symbol(\"show-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,13 @@
|
|
|
1
|
+
import { ErrorBoundary } from './chunk-JC52CA2O.js';
|
|
2
|
+
import { Suspense } from 'react';
|
|
3
|
+
|
|
4
|
+
function SuspenseWithBoundary(props) {
|
|
5
|
+
const { children, errorFallback, fallback } = props;
|
|
6
|
+
const errorBoundaryProps = Boolean(errorFallback) && { fallback: errorFallback };
|
|
7
|
+
const suspenseProps = Boolean(fallback) && { fallback };
|
|
8
|
+
return /* @__PURE__ */ React.createElement(ErrorBoundary, { ...errorBoundaryProps }, /* @__PURE__ */ React.createElement(Suspense, { ...suspenseProps }, children));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { SuspenseWithBoundary };
|
|
12
|
+
//# sourceMappingURL=chunk-MT2MQDK2.js.map
|
|
13
|
+
//# sourceMappingURL=chunk-MT2MQDK2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/common/suspense-with-boundary/suspense-with-boundary.tsx"],"names":[],"mappings":";;;AASO,SAAS,qBAAqB,KAAkC,EAAA;AACtE,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,QAAA,EAAa,GAAA,KAAA;AAE9C,EAAA,MAAM,qBAAqB,OAAQ,CAAA,aAAa,CAAK,IAAA,EAAE,UAAU,aAAc,EAAA;AAC/E,EAAA,MAAM,aAAgB,GAAA,OAAA,CAAQ,QAAQ,CAAA,IAAK,EAAE,QAAS,EAAA;AAEtD,EACC,uBAAA,KAAA,CAAA,aAAA,CAAC,iBAAe,GAAG,kBAAA,EAAA,sCACjB,QAAU,EAAA,EAAA,GAAG,aAAgB,EAAA,EAAA,QAAS,CACxC,CAAA;AAEF","file":"chunk-MT2MQDK2.js","sourcesContent":["import { Suspense } from \"react\";\nimport { ErrorBoundary, type ErrorBoundaryProps } from \"../error-boundary\";\n\nexport type SuspenseWithBoundaryProps = {\n\tchildren: React.ReactNode;\n\terrorFallback?: ErrorBoundaryProps[\"fallback\"];\n\tfallback?: React.ReactNode;\n};\n\nexport function SuspenseWithBoundary(props: SuspenseWithBoundaryProps) {\n\tconst { children, errorFallback, fallback } = props;\n\n\tconst errorBoundaryProps = Boolean(errorFallback) && { fallback: errorFallback };\n\tconst suspenseProps = Boolean(fallback) && { fallback };\n\n\treturn (\n\t\t<ErrorBoundary {...errorBoundaryProps}>\n\t\t\t<Suspense {...suspenseProps}>{children}</Suspense>\n\t\t</ErrorBoundary>\n\t);\n}\n"]}
|