@fragment-build/ui 1.1.1 → 1.1.2

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/README.md CHANGED
@@ -120,8 +120,6 @@ export * from '@fragment-build/ui';
120
120
 
121
121
  Now just import all the components you need from this file.
122
122
 
123
- Additionally you need to pass the `useNextJS` prop to the `FragmentUIProvider`.
124
-
125
123
  ## 🤝 Contributing
126
124
 
127
125
  Feel free to fork and make a Pull Request to this project. All the input is warmly welcome!
@@ -3,7 +3,6 @@ import { NextUIProviderProps } from "@nextui-org/react";
3
3
  import { FragmentUIContext } from "./context";
4
4
  interface FragmentUIProviderProps {
5
5
  children: React.ReactNode;
6
- useNextJS?: boolean;
7
6
  locale?: NextUIProviderProps['locale'];
8
7
  navigate?: NextUIProviderProps['navigate'];
9
8
  defaults?: FragmentUIContext['defaults'];
package/dist/provider.js CHANGED
@@ -4,14 +4,11 @@ import { ThemeProvider } from "next-themes";
4
4
  import { useEffect, useState } from "react";
5
5
  import deepMerge from "deepmerge";
6
6
  import { FragmentUIContext, defaultContext } from "./context";
7
- export const FragmentUIProvider = ({ children, useNextJS = false, defaults = {}, ...rest }) => {
7
+ export const FragmentUIProvider = ({ children, defaults = {}, ...rest }) => {
8
8
  const [context, setContext] = useState(defaultContext);
9
9
  useEffect(() => {
10
10
  setContext((oldContext) => deepMerge(oldContext, { defaults }));
11
11
  }, [defaults]);
12
- const render = useNextJS
13
- ? _jsx(ThemeProvider, { attribute: "class", children: children })
14
- : children;
15
- return (_jsx(FragmentUIContext.Provider, { value: context, children: _jsx(NextUIProvider, { ...rest, children: render }) }));
12
+ return (_jsx(FragmentUIContext.Provider, { value: context, children: _jsx(NextUIProvider, { ...rest, children: _jsx(ThemeProvider, { attribute: "class", children: children }) }) }));
16
13
  };
17
14
  //# sourceMappingURL=provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":";AA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C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAS9D,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,QAAQ,EACR,QAAQ,GAAG,EAAE,EACb,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;IACjE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YACxC,KAAC,cAAc,OAAK,IAAI,YACtB,KAAC,aAAa,IAAC,SAAS,EAAC,OAAO,YAC7B,QAAQ,GACK,GACD,GACU,CAC9B,CAAC;AACJ,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { FragmentUIContext } from "./context";
3
- export declare function withFragment<P extends React.ComponentType<any>>(Component: P, configId: keyof FragmentUIContext['defaults']): P;
3
+ export declare function withFragment<C extends React.ComponentType<any>>(Component: C, configId: keyof FragmentUIContext['defaults']): C;
@@ -1,15 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useContext } from "react";
2
+ import { forwardRef, useContext } from "react";
3
3
  import deepMerge from "deepmerge";
4
4
  import { FragmentUIContext } from "./context";
5
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
6
  export function withFragment(Component, configId) {
7
- const ComponentWithContext = (props) => {
7
+ const ComponentWithContext = forwardRef((props, ref) => {
8
8
  const context = useContext(FragmentUIContext);
9
- return _jsx(Component, { ...deepMerge(context['defaults'][configId] || {}, props) });
10
- };
9
+ return _jsx(Component, { ...deepMerge(context['defaults'][configId] || {}, props), ref: ref });
10
+ });
11
11
  // fix react-aria collection
12
12
  if ('getCollectionNode' in Component) {
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
14
  ComponentWithContext.getCollectionNode = Component.getCollectionNode;
14
15
  }
15
16
  return ComponentWithContext;
@@ -1 +1 @@
1
- {"version":3,"file":"withFragment.js","sourceRoot":"","sources":["../src/withFragment.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAG,UAAU,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,8DAA8D;AAC9D,MAAM,UAAU,YAAY,CAAqC,SAAY,EAAE,QAA6C;IAC1H,MAAM,oBAAoB,GAAG,CAAC,KAA8B,EAAE,EAAE;QAC9D,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAC9C,OAAO,KAAC,SAAS,OAAK,SAAS,CAAI,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,CAA4B,IAAI,EAAE,EAAE,KAAK,CAA4B,GAAG,CAAA;IACzI,CAAC,CAAC;IAEF,4BAA4B;IAC5B,IAAI,mBAAmB,IAAI,SAAS,EAAE,CAAC;QACpC,oBAAyC,CAAC,iBAAiB,GAAG,SAAS,CAAC,iBAAiB,CAAC;IAC7F,CAAC;IAED,OAAO,oBAAyB,CAAC;AACnC,CAAC"}
1
+ {"version":3,"file":"withFragment.js","sourceRoot":"","sources":["../src/withFragment.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,8DAA8D;AAC9D,MAAM,UAAU,YAAY,CAAqC,SAAY,EAAE,QAA6C;IAC1H,MAAM,oBAAoB,GAAG,UAAU,CAAC,CAAC,KAA8B,EAAE,GAAG,EAAE,EAAE;QAC9E,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAC9C,OAAO,KAAC,SAAS,OAAK,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,CAA4B,IAAI,EAAE,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,GAAI,CAAA;IACtH,CAAC,CAAC,CAAC;IAEH,4BAA4B;IAC5B,IAAI,mBAAmB,IAAI,SAAS,EAAE,CAAC;QACrC,8DAA8D;QAC7D,oBAA4B,CAAC,iBAAiB,GAAG,SAAS,CAAC,iBAAiB,CAAC;IAChF,CAAC;IAED,OAAO,oBAAoC,CAAC;AAC9C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fragment-build/ui",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {