@zayne-labs/ui-react 0.1.3 → 0.1.4
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.
|
@@ -15,11 +15,8 @@ declare namespace ShowFallback {
|
|
|
15
15
|
var slot: symbol;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
declare
|
|
19
|
-
|
|
20
|
-
declare const show_ShowRoot: typeof ShowRoot;
|
|
21
|
-
declare namespace show {
|
|
22
|
-
export { show_ShowContent as ShowContent, show_ShowFallback as ShowFallback, show_ShowRoot as ShowRoot };
|
|
18
|
+
declare namespace showParts {
|
|
19
|
+
export { ShowContent as Content, ShowFallback as Fallback, ShowFallback as OtherWise, ShowRoot as Root };
|
|
23
20
|
}
|
|
24
21
|
|
|
25
|
-
export {
|
|
22
|
+
export { showParts as Show, ShowContent, ShowFallback, ShowRoot };
|
|
@@ -3,13 +3,6 @@ import 'react';
|
|
|
3
3
|
import { getSlotElement, getOtherChildren } from '@zayne-labs/toolkit-react/utils';
|
|
4
4
|
import { AssertionError } from '@zayne-labs/toolkit-type-helpers';
|
|
5
5
|
|
|
6
|
-
// src/components/common/show/show.tsx
|
|
7
|
-
var show_exports = {};
|
|
8
|
-
__export(show_exports, {
|
|
9
|
-
ShowContent: () => ShowContent,
|
|
10
|
-
ShowFallback: () => ShowFallback,
|
|
11
|
-
ShowRoot: () => ShowRoot
|
|
12
|
-
});
|
|
13
6
|
function ShowRoot({ children, fallback, when }) {
|
|
14
7
|
const fallBackSlot = getSlotElement(children, ShowFallback, {
|
|
15
8
|
errorMessage: "Only one <Show.Fallback> or <Show.OtherWise> component is allowed",
|
|
@@ -36,6 +29,15 @@ function ShowFallback({ children }) {
|
|
|
36
29
|
}
|
|
37
30
|
ShowFallback.slot = Symbol.for("show-fallback");
|
|
38
31
|
|
|
39
|
-
|
|
32
|
+
// src/components/common/show/show-parts.ts
|
|
33
|
+
var show_parts_exports = {};
|
|
34
|
+
__export(show_parts_exports, {
|
|
35
|
+
Content: () => ShowContent,
|
|
36
|
+
Fallback: () => ShowFallback,
|
|
37
|
+
OtherWise: () => ShowFallback,
|
|
38
|
+
Root: () => ShowRoot
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot };
|
|
40
42
|
//# sourceMappingURL=index.js.map
|
|
41
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/common/show/show.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/common/show/show.tsx","../../../../src/components/common/show/show-parts.ts"],"names":[],"mappings":";;;;;AAaO,SAAS,QAAS,CAAA,EAAE,QAAU,EAAA,QAAA,EAAU,MAAmB,EAAA;AACjE,EAAM,MAAA,YAAA,GAAe,cAAe,CAAA,QAAA,EAAU,YAAc,EAAA;AAAA,IAC3D,YAAc,EAAA,mEAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAM,MAAA,WAAA,GAAc,cAAe,CAAA,QAAA,EAAU,WAAa,EAAA;AAAA,IACzD,YAAc,EAAA,8CAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,gBAAgB,gBAAiB,CAAA,QAAA,EAAU,CAAC,YAAA,EAAc,WAAW,CAAC,CAAA;AAE5E,EAAA,IAAI,gBAAgB,QAAU,EAAA;AAC7B,IAAA,MAAM,IAAI,cAAe,CAAA;AAAA;AAAA,EAExB,CAAA,CAAA;AAAA;AAGF,EAAO,OAAA,IAAA,GAAQ,WAAe,IAAA,aAAA,GAAkB,YAAgB,IAAA,QAAA;AACjE;AAEO,SAAS,WAAA,CAAY,EAAE,QAAA,EAAyC,EAAA;AACtE,EAAO,OAAA,QAAA;AACR;AACA,WAAY,CAAA,IAAA,GAAO,MAAO,CAAA,GAAA,CAAI,SAAS,CAAA;AAEhC,SAAS,YAAA,CAAa,EAAE,QAAA,EAAyC,EAAA;AACvE,EAAO,OAAA,QAAA;AACR;AACA,YAAa,CAAA,IAAA,GAAO,MAAO,CAAA,GAAA,CAAI,eAAe,CAAA;;;AC3C9C,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":"index.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getOtherChildren, getSlotElement } from \"@zayne-labs/toolkit-react/utils\";\nimport { AssertionError } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ShowProps = {\n\tchildren: React.ReactNode;\n\tfallback?: React.ReactNode;\n\twhen: boolean;\n};\n\nexport function ShowRoot({ children, fallback, when }: ShowProps) {\n\tconst fallBackSlot = getSlotElement(children, ShowFallback, {\n\t\terrorMessage: \"Only one <Show.Fallback> or <Show.OtherWise> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst contentSlot = getSlotElement(children, ShowContent, {\n\t\terrorMessage: \"Only one <Show.Content> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst otherChildren = getOtherChildren(children, [ShowFallback, ShowContent]);\n\n\tif (fallBackSlot && fallback) {\n\t\tthrow new AssertionError(`\n\t\t\tThe fallback prop and <Show.Fallback>/<Show.OtherWise> cannot be used at the same time.\n\t\t`);\n\t}\n\n\treturn when ? (contentSlot ?? otherChildren) : (fallBackSlot ?? fallback);\n}\n\nexport function ShowContent({ children }: Pick<ShowProps, \"children\">) {\n\treturn children;\n}\nShowContent.slot = Symbol.for(\"content\");\n\nexport function ShowFallback({ children }: Pick<ShowProps, \"children\">) {\n\treturn children;\n}\nShowFallback.slot = Symbol.for(\"show-fallback\");\n","export {\n\tShowContent as Content,\n\tShowFallback as Fallback,\n\tShowFallback as OtherWise,\n\tShowRoot as Root,\n} from \"./show\";\n"]}
|