@cerberus-design/react 0.0.1-next-9bf4418 → 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.
- package/build/legacy/_tsup-dts-rollup.d.cts +17 -0
- package/build/legacy/_tsup-dts-rollup.d.ts +17 -0
- package/build/legacy/index.cjs +2 -0
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.d.cts +2 -0
- package/build/legacy/index.d.ts +2 -0
- package/build/legacy/index.js +1 -0
- package/build/legacy/index.js.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.cts +17 -0
- package/build/modern/_tsup-dts-rollup.d.ts +17 -0
- package/build/modern/index.cjs +2 -0
- package/build/modern/index.cjs.map +1 -1
- package/build/modern/index.d.cts +2 -0
- package/build/modern/index.d.ts +2 -0
- package/build/modern/index.js +1 -0
- package/build/modern/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Show.tsx +23 -0
- package/src/index.ts +4 -0
|
@@ -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 }
|
package/build/legacy/index.cjs
CHANGED
|
@@ -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,
|
|
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":[]}
|
package/build/legacy/index.d.cts
CHANGED
package/build/legacy/index.d.ts
CHANGED
package/build/legacy/index.js
CHANGED
|
@@ -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 }
|
package/build/modern/index.cjs
CHANGED
|
@@ -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,
|
|
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":[]}
|
package/build/modern/index.d.cts
CHANGED
package/build/modern/index.d.ts
CHANGED
package/build/modern/index.js
CHANGED
|
@@ -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
|
@@ -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
|
+
}
|