@cerberus-design/react 0.0.1-next-895830d → 0.0.1-next-34efe9a

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.
@@ -1,5 +1,6 @@
1
1
  import { JSX as JSX_2 } from 'react/jsx-runtime';
2
2
  import { PropsWithChildren } from 'react';
3
+ import { ReactNode } from 'react';
3
4
 
4
5
  declare type ColorModes = 'light' | 'dark';
5
6
  export { ColorModes }
@@ -17,6 +18,22 @@ declare const MODE_KEY = "cerberus-mode";
17
18
  export { MODE_KEY }
18
19
  export { MODE_KEY as MODE_KEY_alias_1 }
19
20
 
21
+ /**
22
+ * Conditionally render its children or an optional fallback component
23
+ * based on the SolidJS component.
24
+ * @description https://docs.solidjs.com/reference/components/show
25
+ */
26
+ declare function Show(props: PropsWithChildren<ShowProps>): ReactNode;
27
+ export { Show }
28
+ export { Show as Show_alias_1 }
29
+
30
+ declare interface ShowProps {
31
+ when: boolean | null | undefined;
32
+ fallback?: ReactNode;
33
+ }
34
+ export { ShowProps }
35
+ export { ShowProps as ShowProps_alias_1 }
36
+
20
37
  declare const THEME_KEY = "cerberus-theme";
21
38
  export { THEME_KEY }
22
39
  export { THEME_KEY as THEME_KEY_alias_1 }
@@ -1,5 +1,6 @@
1
1
  import { JSX as JSX_2 } from 'react/jsx-runtime';
2
2
  import { PropsWithChildren } from 'react';
3
+ import { ReactNode } from 'react';
3
4
 
4
5
  declare type ColorModes = 'light' | 'dark';
5
6
  export { ColorModes }
@@ -17,6 +18,22 @@ declare const MODE_KEY = "cerberus-mode";
17
18
  export { MODE_KEY }
18
19
  export { MODE_KEY as MODE_KEY_alias_1 }
19
20
 
21
+ /**
22
+ * Conditionally render its children or an optional fallback component
23
+ * based on the SolidJS component.
24
+ * @description https://docs.solidjs.com/reference/components/show
25
+ */
26
+ declare function Show(props: PropsWithChildren<ShowProps>): ReactNode;
27
+ export { Show }
28
+ export { Show as Show_alias_1 }
29
+
30
+ declare interface ShowProps {
31
+ when: boolean | null | undefined;
32
+ fallback?: ReactNode;
33
+ }
34
+ export { ShowProps }
35
+ export { ShowProps as ShowProps_alias_1 }
36
+
20
37
  declare const THEME_KEY = "cerberus-theme";
21
38
  export { THEME_KEY }
22
39
  export { THEME_KEY as THEME_KEY_alias_1 }
@@ -17,10 +17,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
17
17
  // src/index.ts
18
18
  var src_exports = {};
19
19
  module.exports = __toCommonJS(src_exports);
20
+ __reExport(src_exports, require("./components/Show.cjs"), module.exports);
20
21
  __reExport(src_exports, require("./context/theme.cjs"), module.exports);
21
22
  __reExport(src_exports, require("./hooks/useTheme.cjs"), module.exports);
22
23
  // Annotate the CommonJS export names for ESM import in node:
23
24
  0 && (module.exports = {
25
+ ...require("./components/Show.cjs"),
24
26
  ...require("./context/theme.cjs"),
25
27
  ...require("./hooks/useTheme.cjs")
26
28
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// context\n\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useTheme'\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAEA,wBAAc,gCAFd;AAMA,wBAAc,iCANd;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// components\n\nexport * from './components/Show'\n\n// context\n\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useTheme'\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAEA,wBAAc,kCAFd;AAMA,wBAAc,gCANd;AAUA,wBAAc,iCAVd;","names":[]}
@@ -1,3 +1,5 @@
1
+ export { Show } from './_tsup-dts-rollup';
2
+ export { ShowProps } from './_tsup-dts-rollup';
1
3
  export { ThemeProvider } from './_tsup-dts-rollup';
2
4
  export { useThemeContext } from './_tsup-dts-rollup';
3
5
  export { DefaultThemes } from './_tsup-dts-rollup';
@@ -1,3 +1,5 @@
1
+ export { Show } from './_tsup-dts-rollup';
2
+ export { ShowProps } from './_tsup-dts-rollup';
1
3
  export { ThemeProvider } from './_tsup-dts-rollup';
2
4
  export { useThemeContext } from './_tsup-dts-rollup';
3
5
  export { DefaultThemes } from './_tsup-dts-rollup';
@@ -1,4 +1,5 @@
1
1
  // src/index.ts
2
+ export * from "./components/Show.js";
2
3
  export * from "./context/theme.js";
3
4
  export * from "./hooks/useTheme.js";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// context\n\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useTheme'\n"],"mappings":";AAEA,cAAc;AAId,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// components\n\nexport * from './components/Show'\n\n// context\n\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useTheme'\n"],"mappings":";AAEA,cAAc;AAId,cAAc;AAId,cAAc;","names":[]}
@@ -1,5 +1,6 @@
1
1
  import { JSX as JSX_2 } from 'react/jsx-runtime';
2
2
  import { PropsWithChildren } from 'react';
3
+ import { ReactNode } from 'react';
3
4
 
4
5
  declare type ColorModes = 'light' | 'dark';
5
6
  export { ColorModes }
@@ -17,6 +18,22 @@ declare const MODE_KEY = "cerberus-mode";
17
18
  export { MODE_KEY }
18
19
  export { MODE_KEY as MODE_KEY_alias_1 }
19
20
 
21
+ /**
22
+ * Conditionally render its children or an optional fallback component
23
+ * based on the SolidJS component.
24
+ * @description https://docs.solidjs.com/reference/components/show
25
+ */
26
+ declare function Show(props: PropsWithChildren<ShowProps>): ReactNode;
27
+ export { Show }
28
+ export { Show as Show_alias_1 }
29
+
30
+ declare interface ShowProps {
31
+ when: boolean | null | undefined;
32
+ fallback?: ReactNode;
33
+ }
34
+ export { ShowProps }
35
+ export { ShowProps as ShowProps_alias_1 }
36
+
20
37
  declare const THEME_KEY = "cerberus-theme";
21
38
  export { THEME_KEY }
22
39
  export { THEME_KEY as THEME_KEY_alias_1 }
@@ -1,5 +1,6 @@
1
1
  import { JSX as JSX_2 } from 'react/jsx-runtime';
2
2
  import { PropsWithChildren } from 'react';
3
+ import { ReactNode } from 'react';
3
4
 
4
5
  declare type ColorModes = 'light' | 'dark';
5
6
  export { ColorModes }
@@ -17,6 +18,22 @@ declare const MODE_KEY = "cerberus-mode";
17
18
  export { MODE_KEY }
18
19
  export { MODE_KEY as MODE_KEY_alias_1 }
19
20
 
21
+ /**
22
+ * Conditionally render its children or an optional fallback component
23
+ * based on the SolidJS component.
24
+ * @description https://docs.solidjs.com/reference/components/show
25
+ */
26
+ declare function Show(props: PropsWithChildren<ShowProps>): ReactNode;
27
+ export { Show }
28
+ export { Show as Show_alias_1 }
29
+
30
+ declare interface ShowProps {
31
+ when: boolean | null | undefined;
32
+ fallback?: ReactNode;
33
+ }
34
+ export { ShowProps }
35
+ export { ShowProps as ShowProps_alias_1 }
36
+
20
37
  declare const THEME_KEY = "cerberus-theme";
21
38
  export { THEME_KEY }
22
39
  export { THEME_KEY as THEME_KEY_alias_1 }
@@ -17,10 +17,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
17
17
  // src/index.ts
18
18
  var src_exports = {};
19
19
  module.exports = __toCommonJS(src_exports);
20
+ __reExport(src_exports, require("./components/Show.cjs"), module.exports);
20
21
  __reExport(src_exports, require("./context/theme.cjs"), module.exports);
21
22
  __reExport(src_exports, require("./hooks/useTheme.cjs"), module.exports);
22
23
  // Annotate the CommonJS export names for ESM import in node:
23
24
  0 && (module.exports = {
25
+ ...require("./components/Show.cjs"),
24
26
  ...require("./context/theme.cjs"),
25
27
  ...require("./hooks/useTheme.cjs")
26
28
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// context\n\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useTheme'\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAEA,wBAAc,gCAFd;AAMA,wBAAc,iCANd;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// components\n\nexport * from './components/Show'\n\n// context\n\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useTheme'\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAEA,wBAAc,kCAFd;AAMA,wBAAc,gCANd;AAUA,wBAAc,iCAVd;","names":[]}
@@ -1,3 +1,5 @@
1
+ export { Show } from './_tsup-dts-rollup';
2
+ export { ShowProps } from './_tsup-dts-rollup';
1
3
  export { ThemeProvider } from './_tsup-dts-rollup';
2
4
  export { useThemeContext } from './_tsup-dts-rollup';
3
5
  export { DefaultThemes } from './_tsup-dts-rollup';
@@ -1,3 +1,5 @@
1
+ export { Show } from './_tsup-dts-rollup';
2
+ export { ShowProps } from './_tsup-dts-rollup';
1
3
  export { ThemeProvider } from './_tsup-dts-rollup';
2
4
  export { useThemeContext } from './_tsup-dts-rollup';
3
5
  export { DefaultThemes } from './_tsup-dts-rollup';
@@ -1,4 +1,5 @@
1
1
  // src/index.ts
2
+ export * from "./components/Show.js";
2
3
  export * from "./context/theme.js";
3
4
  export * from "./hooks/useTheme.js";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// context\n\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useTheme'\n"],"mappings":";AAEA,cAAc;AAId,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// components\n\nexport * from './components/Show'\n\n// context\n\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useTheme'\n"],"mappings":";AAEA,cAAc;AAId,cAAc;AAId,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.0.1-next-895830d",
3
+ "version": "0.0.1-next-34efe9a",
4
4
  "description": "The Cerberus Design React component library",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -0,0 +1,23 @@
1
+ 'use client'
2
+
3
+ import { useMemo, type PropsWithChildren, type ReactNode } from 'react'
4
+
5
+ export interface ShowProps {
6
+ when: boolean | null | undefined
7
+ fallback?: ReactNode
8
+ }
9
+
10
+ /**
11
+ * Conditionally render its children or an optional fallback component
12
+ * based on the SolidJS component.
13
+ * @description https://docs.solidjs.com/reference/components/show
14
+ */
15
+ export function Show(props: PropsWithChildren<ShowProps>) {
16
+ const { when, children, fallback } = props
17
+ const condition = useMemo(() => when ?? false, [when])
18
+
19
+ return useMemo(() => {
20
+ if (condition) return children
21
+ return fallback ?? null
22
+ }, [condition, children, fallback])
23
+ }
package/src/index.ts CHANGED
@@ -1,3 +1,7 @@
1
+ // components
2
+
3
+ export * from './components/Show'
4
+
1
5
  // context
2
6
 
3
7
  export * from './context/theme'