@zayne-labs/ui-react 0.9.2 → 0.9.5

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.
@@ -8,7 +8,7 @@ type AwaitProps<TValue> = AwaitInnerProps<TValue> & Pick<SuspenseWithBoundaryPro
8
8
  withErrorBoundary?: boolean;
9
9
  };
10
10
  declare function Await<TValue>(props: AwaitProps<TValue>): React.JSX.Element;
11
- type AwaitInnerProps<TValue> = DiscriminatedRenderProps<RenderPropFn<TValue>> & {
11
+ type AwaitInnerProps<TValue> = DiscriminatedRenderProps<React.ReactNode | RenderPropFn<TValue>> & {
12
12
  asChild?: boolean;
13
13
  promise: Promise<TValue>;
14
14
  };
@@ -3,6 +3,7 @@ import { ErrorBoundary } from '../../../chunk-7LEVEBD2.js';
3
3
  import '../../../chunk-PZ5AY32C.js';
4
4
  import * as React from 'react';
5
5
  import { Fragment, Suspense, use } from 'react';
6
+ import { isFunction } from '@zayne-labs/toolkit-type-helpers';
6
7
 
7
8
  function Await(props) {
8
9
  const { errorFallback, fallback, withErrorBoundary = true, ...restOfProps } = props;
@@ -15,8 +16,8 @@ function AwaitInner(props) {
15
16
  const result = use(promise);
16
17
  const Component = asChild ? Slot : Fragment;
17
18
  const slotProps = asChild && { promise, result };
18
- const selectedChildren = typeof children === "function" ? children : render;
19
- const resolvedChildren = selectedChildren(result);
19
+ const selectedChildren = children ?? render;
20
+ const resolvedChildren = isFunction(selectedChildren) ? selectedChildren(result) : selectedChildren;
20
21
  return /* @__PURE__ */ React.createElement(Component, { ...slotProps }, resolvedChildren);
21
22
  }
22
23
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/common/await/await.tsx"],"names":["ReactFragment"],"mappings":";;;;;;AAkBO,SAAS,MAAc,KAA2B,EAAA;AACxD,EAAA,MAAM,EAAE,aAAe,EAAA,QAAA,EAAU,oBAAoB,IAAM,EAAA,GAAG,aAAgB,GAAA,KAAA;AAE9E,EAAM,MAAA,iBAAA,GAAoB,oBAAoB,aAAgB,GAAAA,QAAA;AAE9D,EAAA,MAAM,qBAAqB,OAAQ,CAAA,aAAa,CAAK,IAAA,EAAE,UAAU,aAAc,EAAA;AAE/E,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAmB,GAAG,kBAAA,EAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,QACT,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAY,EAAA,EAAA,GAAG,WAAa,EAAA,CAC9B,CACD,CAAA;AAEF;AAOA,SAAS,WAAmB,KAAgC,EAAA;AAC3D,EAAA,MAAM,EAAE,OAAA,EAAS,QAAU,EAAA,OAAA,EAAS,QAAW,GAAA,KAAA;AAE/C,EAAM,MAAA,MAAA,GAAS,IAAI,OAAO,CAAA;AAE1B,EAAM,MAAA,SAAA,GAAY,UAAU,IAAO,GAAAA,QAAA;AAEnC,EAAA,MAAM,SAAY,GAAA,OAAA,IAAW,EAAE,OAAA,EAAS,MAAO,EAAA;AAE/C,EAAA,MAAM,gBAAmB,GAAA,OAAO,QAAa,KAAA,UAAA,GAAa,QAAW,GAAA,MAAA;AAErE,EAAM,MAAA,gBAAA,GAAmB,iBAAiB,MAAM,CAAA;AAEhD,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAW,GAAG,SAAA,EAAA,EAAY,gBAAiB,CAAA;AACpD","file":"index.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport type { DiscriminatedRenderProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { Fragment as ReactFragment, Suspense, use } from \"react\";\nimport { ErrorBoundary } from \"../error-boundary\";\nimport { Slot } from \"../slot\";\nimport type { SuspenseWithBoundaryProps } from \"../suspense-with-boundary\";\n\ntype RenderPropFn<TValue> = (result: TValue) => React.ReactNode;\n\ntype AwaitProps<TValue> = AwaitInnerProps<TValue>\n\t& Pick<SuspenseWithBoundaryProps, \"errorFallback\" | \"fallback\"> & {\n\t\twithErrorBoundary?: boolean;\n\t};\n\n// TODO - Add Support for Slot components\nexport function Await<TValue>(props: AwaitProps<TValue>) {\n\tconst { errorFallback, fallback, withErrorBoundary = true, ...restOfProps } = props;\n\n\tconst WithErrorBoundary = withErrorBoundary ? ErrorBoundary : ReactFragment;\n\n\tconst errorBoundaryProps = Boolean(errorFallback) && { fallback: errorFallback };\n\n\treturn (\n\t\t<WithErrorBoundary {...errorBoundaryProps}>\n\t\t\t<Suspense fallback={fallback}>\n\t\t\t\t<AwaitInner {...restOfProps} />\n\t\t\t</Suspense>\n\t\t</WithErrorBoundary>\n\t);\n}\n\nexport type AwaitInnerProps<TValue> = DiscriminatedRenderProps<RenderPropFn<TValue>> & {\n\tasChild?: boolean;\n\tpromise: Promise<TValue>;\n};\n\nfunction AwaitInner<TValue>(props: AwaitInnerProps<TValue>) {\n\tconst { asChild, children, promise, render } = props;\n\n\tconst result = use(promise);\n\n\tconst Component = asChild ? Slot : ReactFragment;\n\n\tconst slotProps = asChild && { promise, result };\n\n\tconst selectedChildren = typeof children === \"function\" ? children : render;\n\n\tconst resolvedChildren = selectedChildren(result);\n\n\treturn <Component {...slotProps}>{resolvedChildren}</Component>;\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/components/common/await/await.tsx"],"names":["ReactFragment"],"mappings":";;;;;;;AAmBO,SAAS,MAAc,KAA2B,EAAA;AACxD,EAAA,MAAM,EAAE,aAAe,EAAA,QAAA,EAAU,oBAAoB,IAAM,EAAA,GAAG,aAAgB,GAAA,KAAA;AAE9E,EAAM,MAAA,iBAAA,GAAoB,oBAAoB,aAAgB,GAAAA,QAAA;AAE9D,EAAA,MAAM,qBAAqB,OAAQ,CAAA,aAAa,CAAK,IAAA,EAAE,UAAU,aAAc,EAAA;AAE/E,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAmB,GAAG,kBAAA,EAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,QACT,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAY,EAAA,EAAA,GAAG,WAAa,EAAA,CAC9B,CACD,CAAA;AAEF;AAOA,SAAS,WAAmB,KAAgC,EAAA;AAC3D,EAAA,MAAM,EAAE,OAAA,EAAS,QAAU,EAAA,OAAA,EAAS,QAAW,GAAA,KAAA;AAE/C,EAAM,MAAA,MAAA,GAAS,IAAI,OAAO,CAAA;AAE1B,EAAM,MAAA,SAAA,GAAY,UAAU,IAAO,GAAAA,QAAA;AAEnC,EAAA,MAAM,SAAY,GAAA,OAAA,IAAW,EAAE,OAAA,EAAS,MAAO,EAAA;AAE/C,EAAA,MAAM,mBAAmB,QAAY,IAAA,MAAA;AAErC,EAAA,MAAM,mBAAmB,UAAW,CAAA,gBAAgB,CAAI,GAAA,gBAAA,CAAiB,MAAM,CAAI,GAAA,gBAAA;AAEnF,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAW,GAAG,SAAA,EAAA,EAAY,gBAAiB,CAAA;AACpD","file":"index.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport type { DiscriminatedRenderProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Fragment as ReactFragment, Suspense, use } from \"react\";\nimport { ErrorBoundary } from \"../error-boundary\";\nimport { Slot } from \"../slot\";\nimport type { SuspenseWithBoundaryProps } from \"../suspense-with-boundary\";\n\ntype RenderPropFn<TValue> = (result: TValue) => React.ReactNode;\n\ntype AwaitProps<TValue> = AwaitInnerProps<TValue>\n\t& Pick<SuspenseWithBoundaryProps, \"errorFallback\" | \"fallback\"> & {\n\t\twithErrorBoundary?: boolean;\n\t};\n\n// TODO - Add Support for Slot components\nexport function Await<TValue>(props: AwaitProps<TValue>) {\n\tconst { errorFallback, fallback, withErrorBoundary = true, ...restOfProps } = props;\n\n\tconst WithErrorBoundary = withErrorBoundary ? ErrorBoundary : ReactFragment;\n\n\tconst errorBoundaryProps = Boolean(errorFallback) && { fallback: errorFallback };\n\n\treturn (\n\t\t<WithErrorBoundary {...errorBoundaryProps}>\n\t\t\t<Suspense fallback={fallback}>\n\t\t\t\t<AwaitInner {...restOfProps} />\n\t\t\t</Suspense>\n\t\t</WithErrorBoundary>\n\t);\n}\n\nexport type AwaitInnerProps<TValue> = DiscriminatedRenderProps<React.ReactNode | RenderPropFn<TValue>> & {\n\tasChild?: boolean;\n\tpromise: Promise<TValue>;\n};\n\nfunction AwaitInner<TValue>(props: AwaitInnerProps<TValue>) {\n\tconst { asChild, children, promise, render } = props;\n\n\tconst result = use(promise);\n\n\tconst Component = asChild ? Slot : ReactFragment;\n\n\tconst slotProps = asChild && { promise, result };\n\n\tconst selectedChildren = children ?? render;\n\n\tconst resolvedChildren = isFunction(selectedChildren) ? selectedChildren(result) : selectedChildren;\n\n\treturn <Component {...slotProps}>{resolvedChildren}</Component>;\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zayne-labs/ui-react",
3
3
  "type": "module",
4
- "version": "0.9.2",
4
+ "version": "0.9.5",
5
5
  "description": "A composable UI/UI-utilities components library. ",
6
6
  "author": "Ryan Zayne",
7
7
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  ".": null,
20
20
  "./style.css": "./dist/style.css",
21
21
  "./css/*": "./css/*",
22
- "./*": "./dist/esm/components/ui/*/index.js",
22
+ "./ui/*": "./dist/esm/components/ui/*/index.js",
23
23
  "./common/*": "./dist/esm/components/common/*/index.js",
24
24
  "./utils/*": "./dist/esm/lib/utils/*/index.js"
25
25
  },