@zayne-labs/ui-react 0.0.8 → 0.1.0
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/dist/esm/chunk-ENDWJXPF.js +47 -0
- package/dist/esm/chunk-ENDWJXPF.js.map +1 -0
- package/dist/esm/chunk-GBLTOENX.js +42 -0
- package/dist/esm/chunk-GBLTOENX.js.map +1 -0
- package/dist/esm/chunk-OHG7GB7O.js +8 -0
- package/dist/esm/chunk-OHG7GB7O.js.map +1 -0
- package/dist/esm/chunk-PZ5AY32C.js +9 -0
- package/dist/esm/chunk-PZ5AY32C.js.map +1 -0
- package/dist/esm/common/for/index.js +2 -40
- package/dist/esm/common/for/index.js.map +1 -1
- package/dist/esm/common/show/index.d.ts +10 -6
- package/dist/esm/common/show/index.js +10 -6
- package/dist/esm/common/show/index.js.map +1 -1
- package/dist/esm/common/slot/index.js +2 -45
- package/dist/esm/common/slot/index.js.map +1 -1
- package/dist/esm/common/switch/index.d.ts +2 -5
- package/dist/esm/common/switch/index.js +4 -7
- package/dist/esm/common/switch/index.js.map +1 -1
- package/dist/esm/common/teleport/index.js +1 -1
- package/dist/esm/ui/card/index.d.ts +5 -7
- package/dist/esm/ui/card/index.js +22 -59
- package/dist/esm/ui/card/index.js.map +1 -1
- package/dist/esm/ui/carousel/index.d.ts +6 -11
- package/dist/esm/ui/carousel/index.js +33 -59
- package/dist/esm/ui/carousel/index.js.map +1 -1
- package/dist/esm/ui/drag-scroll/index.d.ts +285 -4
- package/dist/esm/ui/drag-scroll/index.js +42 -24
- package/dist/esm/ui/drag-scroll/index.js.map +1 -1
- package/dist/esm/ui/drop-zone/index.d.ts +24 -14
- package/dist/esm/ui/drop-zone/index.js +46 -47
- package/dist/esm/ui/drop-zone/index.js.map +1 -1
- package/dist/esm/ui/form/index.d.ts +41 -32
- package/dist/esm/ui/form/index.js +84 -96
- package/dist/esm/ui/form/index.js.map +1 -1
- package/package.json +10 -10
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Children, isValidElement, cloneElement } from 'react';
|
|
3
|
+
import { mergeProps, composeRefs } from '@zayne-labs/toolkit-react/utils';
|
|
4
|
+
import { isArray } from '@zayne-labs/toolkit-type-helpers';
|
|
5
|
+
|
|
6
|
+
// src/components/common/slot/slot.tsx
|
|
7
|
+
function Slottable({ children }) {
|
|
8
|
+
return children;
|
|
9
|
+
}
|
|
10
|
+
var isSlottable = (child) => {
|
|
11
|
+
return isValidElement(child) && child.type === Slottable;
|
|
12
|
+
};
|
|
13
|
+
function Slot(props) {
|
|
14
|
+
const { children, ...restOfSlotProps } = props;
|
|
15
|
+
const childrenArray = isArray(children) ? children : [children];
|
|
16
|
+
const slottable = childrenArray.find((element) => isSlottable(element));
|
|
17
|
+
if (slottable) {
|
|
18
|
+
const newElement = slottable.props.children;
|
|
19
|
+
if (Children.count(newElement) > 1) {
|
|
20
|
+
return Children.only(null);
|
|
21
|
+
}
|
|
22
|
+
const newElementChildren = childrenArray.map((child) => {
|
|
23
|
+
if (child === slottable) {
|
|
24
|
+
return isValidElement(newElement) && newElement.props.children;
|
|
25
|
+
}
|
|
26
|
+
return child;
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */ React.createElement(SlotClone, { ...restOfSlotProps }, isValidElement(newElement) && cloneElement(newElement, undefined, newElementChildren));
|
|
29
|
+
}
|
|
30
|
+
return /* @__PURE__ */ React.createElement(SlotClone, { ...restOfSlotProps }, children);
|
|
31
|
+
}
|
|
32
|
+
function SlotClone(props) {
|
|
33
|
+
const { children, ref: forwardedRef, ...restOfSlotProps } = props;
|
|
34
|
+
if (!isValidElement(children)) {
|
|
35
|
+
return Children.count(children) > 1 ? Children.only(null) : null;
|
|
36
|
+
}
|
|
37
|
+
const childRef = children.props.ref ?? children.ref;
|
|
38
|
+
const clonedProps = {
|
|
39
|
+
...mergeProps(restOfSlotProps, children.props),
|
|
40
|
+
ref: forwardedRef ? composeRefs([forwardedRef, childRef]) : childRef
|
|
41
|
+
};
|
|
42
|
+
return cloneElement(children, clonedProps);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { Slot, Slottable };
|
|
46
|
+
//# sourceMappingURL=chunk-ENDWJXPF.js.map
|
|
47
|
+
//# sourceMappingURL=chunk-ENDWJXPF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/common/slot/slot.tsx"],"names":[],"mappings":";;;;;;AAYO,SAAS,SAAA,CAAU,EAAE,QAAA,EAAyC,EAAA;AACpE,EAAO,OAAA,QAAA;AACR;AAEA,IAAM,WAAA,GAAc,CAAC,KAAwD,KAAA;AAC5E,EAAA,OAAO,cAAe,CAAA,KAAK,CAAK,IAAA,KAAA,CAAM,IAAS,KAAA,SAAA;AAChD,CAAA;AAMO,SAAS,KAAK,KAAkB,EAAA;AACtC,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,eAAA,EAAoB,GAAA,KAAA;AAEzC,EAAA,MAAM,gBAAgB,OAAyB,CAAA,QAAQ,CAAI,GAAA,QAAA,GAAW,CAAC,QAAQ,CAAA;AAC/E,EAAA,MAAM,YAAY,aAAc,CAAA,IAAA,CAAK,CAAC,OAAY,KAAA,WAAA,CAAY,OAAO,CAAC,CAAA;AAEtE,EAAA,IAAI,SAAW,EAAA;AAEd,IAAM,MAAA,UAAA,GAAc,UAAU,KAAoB,CAAA,QAAA;AAElD,IAAA,IAAI,QAAS,CAAA,KAAA,CAAM,UAAU,CAAA,GAAI,CAAG,EAAA;AACnC,MAAO,OAAA,QAAA,CAAS,KAAK,IAAI,CAAA;AAAA;AAG1B,IAAA,MAAM,kBAAqB,GAAA,aAAA,CAAc,GAAI,CAAA,CAAC,KAAU,KAAA;AACvD,MAAA,IAAI,UAAU,SAAW,EAAA;AAExB,QAAA,OAAO,cAA0B,CAAA,UAAU,CAAK,IAAA,UAAA,CAAW,KAAM,CAAA,QAAA;AAAA;AAGlE,MAAO,OAAA,KAAA;AAAA,KACP,CAAA;AAED,IACC,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAW,EAAA,EAAA,GAAG,eACb,EAAA,EAAA,cAAA,CAAe,UAAU,CAAA,IAAK,YAAa,CAAA,UAAA,EAAY,SAAW,EAAA,kBAAkB,CACtF,CAAA;AAAA;AAIF,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAW,GAAG,eAAA,EAAA,EAAkB,QAAS,CAAA;AAClD;AASA,SAAS,UAAU,KAAuB,EAAA;AACzC,EAAA,MAAM,EAAE,QAAU,EAAA,GAAA,EAAK,YAAc,EAAA,GAAG,iBAAoB,GAAA,KAAA;AAE5D,EAAI,IAAA,CAAC,cAA6B,CAAA,QAAQ,CAAG,EAAA;AAC5C,IAAO,OAAA,QAAA,CAAS,MAAM,QAAQ,CAAA,GAAI,IAAI,QAAS,CAAA,IAAA,CAAK,IAAI,CAAI,GAAA,IAAA;AAAA;AAG7D,EAAA,MAAM,QAAW,GAAA,QAAA,CAAS,KAAM,CAAA,GAAA,IAAQ,QAAqC,CAAA,GAAA;AAE7E,EAAA,MAAM,WAAc,GAAA;AAAA,IACnB,GAAG,UAAA,CAAW,eAAiB,EAAA,QAAA,CAAS,KAAK,CAAA;AAAA,IAC7C,KAAK,YAAe,GAAA,WAAA,CAAY,CAAC,YAAc,EAAA,QAA8B,CAAC,CAAI,GAAA;AAAA,GACnF;AAEA,EAAO,OAAA,YAAA,CAAa,UAAU,WAAW,CAAA;AAC1C","file":"chunk-ENDWJXPF.js","sourcesContent":["import * as React from \"react\";\n\nimport { type InferProps, composeRefs, mergeProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Children, cloneElement, isValidElement } from \"react\";\n\ntype SlotProps = InferProps<HTMLElement>;\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * ----------------------------------------------------------------------------------------------- */\n\nexport function Slottable({ children }: Pick<SlotProps, \"children\">) {\n\treturn children;\n}\n\nconst isSlottable = (child: React.ReactNode): child is React.ReactElement => {\n\treturn isValidElement(child) && child.type === Slottable;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * ----------------------------------------------------------------------------------------------- */\n\nexport function Slot(props: SlotProps) {\n\tconst { children, ...restOfSlotProps } = props;\n\n\tconst childrenArray = isArray<React.ReactNode>(children) ? children : [children];\n\tconst slottable = childrenArray.find((element) => isSlottable(element));\n\n\tif (slottable) {\n\t\t// == The new element to render is the one passed as a child of `Slottable`\n\t\tconst newElement = (slottable.props as SlotProps).children;\n\n\t\tif (Children.count(newElement) > 1) {\n\t\t\treturn Children.only(null);\n\t\t}\n\n\t\tconst newElementChildren = childrenArray.map((child) => {\n\t\t\tif (child === slottable) {\n\t\t\t\t// == Because the new element will be the one rendered, we are only interested in grabbing its children (`newElement.props.children`)\n\t\t\t\treturn isValidElement<SlotProps>(newElement) && newElement.props.children;\n\t\t\t}\n\n\t\t\treturn child;\n\t\t});\n\n\t\treturn (\n\t\t\t<SlotClone {...restOfSlotProps}>\n\t\t\t\t{isValidElement(newElement) && cloneElement(newElement, undefined, newElementChildren)}\n\t\t\t</SlotClone>\n\t\t);\n\t}\n\n\treturn <SlotClone {...restOfSlotProps}>{children}</SlotClone>;\n}\n\ntype SlotCloneProps = {\n\tchildren: React.ReactNode;\n\tref?: React.RefObject<HTMLElement>;\n};\n\ntype UnknownProps = Record<string, unknown>;\n\nfunction SlotClone(props: SlotCloneProps) {\n\tconst { children, ref: forwardedRef, ...restOfSlotProps } = props;\n\n\tif (!isValidElement<UnknownProps>(children)) {\n\t\treturn Children.count(children) > 1 ? Children.only(null) : null;\n\t}\n\n\tconst childRef = children.props.ref ?? (children as unknown as UnknownProps).ref;\n\n\tconst clonedProps = {\n\t\t...mergeProps(restOfSlotProps, children.props),\n\t\tref: forwardedRef ? composeRefs([forwardedRef, childRef as React.Ref<unknown>]) : childRef,\n\t};\n\n\treturn cloneElement(children, clonedProps);\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { isArray } from '@zayne-labs/toolkit-type-helpers';
|
|
3
|
+
|
|
4
|
+
// src/components/common/for/for.tsx
|
|
5
|
+
function ForBase(props) {
|
|
6
|
+
const { children, each, render } = props;
|
|
7
|
+
if (!isArray(each)) {
|
|
8
|
+
return each;
|
|
9
|
+
}
|
|
10
|
+
const JSXElementList = each.map((...params) => {
|
|
11
|
+
if (typeof children === "function") {
|
|
12
|
+
return children(...params);
|
|
13
|
+
}
|
|
14
|
+
return render(...params);
|
|
15
|
+
});
|
|
16
|
+
return JSXElementList;
|
|
17
|
+
}
|
|
18
|
+
function ForList(props) {
|
|
19
|
+
const { as: ListContainer = "ul", children, className, each, ref, render, ...restOfListProps } = props;
|
|
20
|
+
return /* @__PURE__ */ React.createElement(ListContainer, { ref, className, ...restOfListProps }, /* @__PURE__ */ React.createElement(ForBase, { ...{ children, each, render } }));
|
|
21
|
+
}
|
|
22
|
+
var Base = ForBase;
|
|
23
|
+
var List = ForList;
|
|
24
|
+
|
|
25
|
+
// src/components/common/for/getElementList.ts
|
|
26
|
+
var getElementList = (variant) => {
|
|
27
|
+
switch (variant) {
|
|
28
|
+
case "base": {
|
|
29
|
+
return [Base];
|
|
30
|
+
}
|
|
31
|
+
case "withWrapper": {
|
|
32
|
+
return [List];
|
|
33
|
+
}
|
|
34
|
+
default: {
|
|
35
|
+
return [List];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { Base, ForBase, ForList, List, getElementList };
|
|
41
|
+
//# sourceMappingURL=chunk-GBLTOENX.js.map
|
|
42
|
+
//# sourceMappingURL=chunk-GBLTOENX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/common/for/for.tsx","../../src/components/common/for/getElementList.ts"],"names":[],"mappings":";;;;AAkBO,SAAS,QAAoB,KAA6B,EAAA;AAChE,EAAA,MAAM,EAAE,QAAA,EAAU,IAAM,EAAA,MAAA,EAAW,GAAA,KAAA;AAEnC,EAAI,IAAA,CAAC,OAAQ,CAAA,IAAI,CAAG,EAAA;AACnB,IAAO,OAAA,IAAA;AAAA;AAGR,EAAA,MAAM,cAAiB,GAAA,IAAA,CAAK,GAAI,CAAA,CAAA,GAAI,MAAiD,KAAA;AACpF,IAAI,IAAA,OAAO,aAAa,UAAY,EAAA;AACnC,MAAO,OAAA,QAAA,CAAS,GAAG,MAAM,CAAA;AAAA;AAG1B,IAAO,OAAA,MAAA,CAAO,GAAG,MAAM,CAAA;AAAA,GACvB,CAAA;AAED,EAAO,OAAA,cAAA;AACR;AAEO,SAAS,QACf,KACC,EAAA;AACD,EAAM,MAAA,EAAE,EAAI,EAAA,aAAA,GAAgB,IAAM,EAAA,QAAA,EAAU,SAAW,EAAA,IAAA,EAAM,GAAK,EAAA,MAAA,EAAQ,GAAG,eAAA,EAAoB,GAAA,KAAA;AAEjG,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,GAAU,EAAA,SAAA,EAAuB,GAAG,eAClD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAI,EAAE,QAAA,EAAU,IAAM,EAAA,MAAA,IAAmC,CACpE,CAAA;AAEF;AAEO,IAAM,IAAO,GAAA;AAEb,IAAM,IAAO,GAAA;;;AC5Cd,IAAA,cAAA,GAAiB,CACtB,OACoC,KAAA;AACpC,EAAA,QAAQ,OAAS;AAAA,IAChB,KAAK,MAAQ,EAAA;AACZ,MAAA,OAAO,CAAK,IAAI,CAAA;AAAA;AACjB,IACA,KAAK,aAAe,EAAA;AACnB,MAAA,OAAO,CAAK,IAAI,CAAA;AAAA;AACjB,IACA,SAAS;AACR,MAAA,OAAO,CAAK,IAAI,CAAA;AAAA;AACjB;AAEF","file":"chunk-GBLTOENX.js","sourcesContent":["import * as React from \"react\";\n\nimport type { DiscriminatedRenderProps, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray } from \"@zayne-labs/toolkit-type-helpers\";\n\n// prettier-ignore\ntype RenderPropFn<TArrayItem> = (\n\titem: TArrayItem,\n\tindex: number,\n\tarray: TArrayItem[]\n) => React.ReactNode;\n\nexport type EachProp<TArrayItem> = { each: TArrayItem[] };\n\nexport type ForRenderProps<TArrayItem> = DiscriminatedRenderProps<RenderPropFn<TArrayItem>>;\n\ntype ForProps<TArrayItem> = EachProp<TArrayItem> & ForRenderProps<TArrayItem>;\n\nexport function ForBase<TArrayItem>(props: ForProps<TArrayItem>) {\n\tconst { children, each, render } = props;\n\n\tif (!isArray(each)) {\n\t\treturn each;\n\t}\n\n\tconst JSXElementList = each.map((...params: Parameters<RenderPropFn<TArrayItem>>) => {\n\t\tif (typeof children === \"function\") {\n\t\t\treturn children(...params);\n\t\t}\n\n\t\treturn render(...params);\n\t});\n\n\treturn JSXElementList;\n}\n\nexport function ForList<TArrayItem, TElement extends React.ElementType = \"ul\">(\n\tprops: PolymorphicProps<TElement, ForProps<TArrayItem> & { className?: string }>\n) {\n\tconst { as: ListContainer = \"ul\", children, className, each, ref, render, ...restOfListProps } = props;\n\n\treturn (\n\t\t<ListContainer ref={ref} className={className} {...restOfListProps}>\n\t\t\t<ForBase {...({ children, each, render } as ForProps<TArrayItem>)} />\n\t\t</ListContainer>\n\t);\n}\n\nexport const Base = ForBase;\n\nexport const List = ForList;\n","import * as For from \"./for\";\n\ntype GetElementListResult<TVariant extends \"base\" | \"withWrapper\"> = TVariant extends \"base\"\n\t? [typeof For.Base]\n\t: [typeof For.List];\n\nconst getElementList = <TVariant extends \"base\" | \"withWrapper\" = \"withWrapper\">(\n\tvariant?: TVariant\n): GetElementListResult<TVariant> => {\n\tswitch (variant) {\n\t\tcase \"base\": {\n\t\t\treturn [For.Base] as never;\n\t\t}\n\t\tcase \"withWrapper\": {\n\t\t\treturn [For.List] as never;\n\t\t}\n\t\tdefault: {\n\t\t\treturn [For.List] as never;\n\t\t}\n\t}\n};\n\nexport { getElementList };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils/cn.ts"],"names":[],"mappings":";;;AAEO,IAAM,OAAU,GAAA,CAAA,GAAI,UAAiC,KAAA,OAAA,CAAQ,UAAU","file":"chunk-OHG7GB7O.js","sourcesContent":["import { type ClassNameValue, twMerge } from \"tailwind-merge\";\n\nexport const cnMerge = (...classNames: ClassNameValue[]) => twMerge(classNames);\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export { __export };
|
|
8
|
+
//# sourceMappingURL=chunk-PZ5AY32C.js.map
|
|
9
|
+
//# sourceMappingURL=chunk-PZ5AY32C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-PZ5AY32C.js"}
|
|
@@ -1,42 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
// src/components/common/for/for.tsx
|
|
5
|
-
function ForBase(props) {
|
|
6
|
-
const { children, each, render } = props;
|
|
7
|
-
if (!isArray(each)) {
|
|
8
|
-
return each;
|
|
9
|
-
}
|
|
10
|
-
const JSXElementList = each.map((...params) => {
|
|
11
|
-
if (typeof children === "function") {
|
|
12
|
-
return children(...params);
|
|
13
|
-
}
|
|
14
|
-
return render(...params);
|
|
15
|
-
});
|
|
16
|
-
return JSXElementList;
|
|
17
|
-
}
|
|
18
|
-
function ForList(props) {
|
|
19
|
-
const { as: ListContainer = "ul", children, className, each, ref, render, ...restOfListProps } = props;
|
|
20
|
-
return /* @__PURE__ */ React.createElement(ListContainer, { ref, className, ...restOfListProps }, /* @__PURE__ */ React.createElement(ForBase, { ...{ children, each, render } }));
|
|
21
|
-
}
|
|
22
|
-
var Base = ForBase;
|
|
23
|
-
var List = ForList;
|
|
24
|
-
|
|
25
|
-
// src/components/common/for/getElementList.ts
|
|
26
|
-
var getElementList = (variant) => {
|
|
27
|
-
switch (variant) {
|
|
28
|
-
case "base": {
|
|
29
|
-
return [Base];
|
|
30
|
-
}
|
|
31
|
-
case "withWrapper": {
|
|
32
|
-
return [List];
|
|
33
|
-
}
|
|
34
|
-
default: {
|
|
35
|
-
return [List];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { Base, ForBase, ForList, List, getElementList };
|
|
1
|
+
export { Base, ForBase, ForList, List, getElementList } from '../../chunk-GBLTOENX.js';
|
|
2
|
+
import '../../chunk-PZ5AY32C.js';
|
|
41
3
|
//# sourceMappingURL=index.js.map
|
|
42
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -6,6 +6,7 @@ type ShowProps = {
|
|
|
6
6
|
when: boolean;
|
|
7
7
|
};
|
|
8
8
|
declare function ShowRoot({ children, fallback, when }: ShowProps): react.ReactNode;
|
|
9
|
+
declare const Show: typeof ShowRoot;
|
|
9
10
|
declare function ShowContent({ children }: Pick<ShowProps, "children">): react.ReactNode;
|
|
10
11
|
declare namespace ShowContent {
|
|
11
12
|
var slot: symbol;
|
|
@@ -14,10 +15,13 @@ declare function ShowFallback({ children }: Pick<ShowProps, "children">): react.
|
|
|
14
15
|
declare namespace ShowFallback {
|
|
15
16
|
var slot: symbol;
|
|
16
17
|
}
|
|
17
|
-
declare const Show: typeof ShowRoot;
|
|
18
|
-
declare const Root: typeof ShowRoot;
|
|
19
|
-
declare const Fallback: typeof ShowFallback;
|
|
20
|
-
declare const Content: typeof ShowContent;
|
|
21
|
-
declare const OtherWise: typeof ShowFallback;
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
declare const show_Show: typeof Show;
|
|
20
|
+
declare const show_ShowContent: typeof ShowContent;
|
|
21
|
+
declare const show_ShowFallback: typeof ShowFallback;
|
|
22
|
+
declare const show_ShowRoot: typeof ShowRoot;
|
|
23
|
+
declare namespace show {
|
|
24
|
+
export { show_Show as Show, show_ShowContent as ShowContent, show_ShowFallback as ShowFallback, show_ShowRoot as ShowRoot };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { show as Show, ShowContent, ShowFallback, ShowRoot };
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import { __export } from '../../chunk-PZ5AY32C.js';
|
|
1
2
|
import 'react';
|
|
2
3
|
import { getSlotElement, getOtherChildren } from '@zayne-labs/toolkit-react/utils';
|
|
3
4
|
import { AssertionError } from '@zayne-labs/toolkit-type-helpers';
|
|
4
5
|
|
|
5
6
|
// src/components/common/show/show.tsx
|
|
7
|
+
var show_exports = {};
|
|
8
|
+
__export(show_exports, {
|
|
9
|
+
Show: () => Show,
|
|
10
|
+
ShowContent: () => ShowContent,
|
|
11
|
+
ShowFallback: () => ShowFallback,
|
|
12
|
+
ShowRoot: () => ShowRoot
|
|
13
|
+
});
|
|
6
14
|
function ShowRoot({ children, fallback, when }) {
|
|
7
15
|
const fallBackSlot = getSlotElement(children, ShowFallback, {
|
|
8
16
|
errorMessage: "Only one <Show.Fallback> or <Show.OtherWise> component is allowed",
|
|
@@ -20,6 +28,7 @@ function ShowRoot({ children, fallback, when }) {
|
|
|
20
28
|
}
|
|
21
29
|
return when ? contentSlot ?? otherChildren : fallBackSlot ?? fallback;
|
|
22
30
|
}
|
|
31
|
+
var Show = ShowRoot;
|
|
23
32
|
function ShowContent({ children }) {
|
|
24
33
|
return children;
|
|
25
34
|
}
|
|
@@ -28,12 +37,7 @@ function ShowFallback({ children }) {
|
|
|
28
37
|
return children;
|
|
29
38
|
}
|
|
30
39
|
ShowFallback.slot = Symbol.for("show-fallback");
|
|
31
|
-
var Show = ShowRoot;
|
|
32
|
-
var Root = ShowRoot;
|
|
33
|
-
var Fallback = ShowFallback;
|
|
34
|
-
var Content = ShowContent;
|
|
35
|
-
var OtherWise = ShowFallback;
|
|
36
40
|
|
|
37
|
-
export {
|
|
41
|
+
export { show_exports as Show, ShowContent, ShowFallback, ShowRoot };
|
|
38
42
|
//# sourceMappingURL=index.js.map
|
|
39
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"],"names":[],"mappings":";;;;;;AAAA,IAAA,YAAA,GAAA;AAAA,QAAA,CAAA,YAAA,EAAA;AAAA,EAAA,IAAA,EAAA,MAAA,IAAA;AAAA,EAAA,WAAA,EAAA,MAAA,WAAA;AAAA,EAAA,YAAA,EAAA,MAAA,YAAA;AAAA,EAAA,QAAA,EAAA,MAAA;AAAA,CAAA,CAAA;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,IAAM,IAAO,GAAA,QAAA;AAEb,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","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 const Show = ShowRoot;\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"]}
|
|
@@ -1,47 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { mergeProps, composeRefs } from '@zayne-labs/toolkit-react/utils';
|
|
4
|
-
import { isArray } from '@zayne-labs/toolkit-type-helpers';
|
|
5
|
-
|
|
6
|
-
// src/components/common/slot/slot.tsx
|
|
7
|
-
function Slottable({ children }) {
|
|
8
|
-
return children;
|
|
9
|
-
}
|
|
10
|
-
var isSlottable = (child) => {
|
|
11
|
-
return isValidElement(child) && child.type === Slottable;
|
|
12
|
-
};
|
|
13
|
-
function Slot(props) {
|
|
14
|
-
const { children, ...restOfSlotProps } = props;
|
|
15
|
-
const childrenArray = isArray(children) ? children : [children];
|
|
16
|
-
const slottable = childrenArray.find((element) => isSlottable(element));
|
|
17
|
-
if (slottable) {
|
|
18
|
-
const newElement = slottable.props.children;
|
|
19
|
-
if (Children.count(newElement) > 1) {
|
|
20
|
-
return Children.only(null);
|
|
21
|
-
}
|
|
22
|
-
const newElementChildren = childrenArray.map((child) => {
|
|
23
|
-
if (child === slottable) {
|
|
24
|
-
return isValidElement(newElement) && newElement.props.children;
|
|
25
|
-
}
|
|
26
|
-
return child;
|
|
27
|
-
});
|
|
28
|
-
return /* @__PURE__ */ React.createElement(SlotClone, { ...restOfSlotProps }, isValidElement(newElement) && cloneElement(newElement, void 0, newElementChildren));
|
|
29
|
-
}
|
|
30
|
-
return /* @__PURE__ */ React.createElement(SlotClone, { ...restOfSlotProps }, children);
|
|
31
|
-
}
|
|
32
|
-
function SlotClone(props) {
|
|
33
|
-
const { children, ref: forwardedRef, ...restOfSlotProps } = props;
|
|
34
|
-
if (!isValidElement(children)) {
|
|
35
|
-
return Children.count(children) > 1 ? Children.only(null) : null;
|
|
36
|
-
}
|
|
37
|
-
const childRef = children.props.ref ?? children.ref;
|
|
38
|
-
const clonedProps = {
|
|
39
|
-
...mergeProps(restOfSlotProps, children.props),
|
|
40
|
-
ref: forwardedRef ? composeRefs([forwardedRef, childRef]) : childRef
|
|
41
|
-
};
|
|
42
|
-
return cloneElement(children, clonedProps);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { Slot, Slottable };
|
|
1
|
+
export { Slot, Slottable } from '../../chunk-ENDWJXPF.js';
|
|
2
|
+
import '../../chunk-PZ5AY32C.js';
|
|
46
3
|
//# sourceMappingURL=index.js.map
|
|
47
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -10,14 +10,11 @@ type SwitchMatchProps<TWhen = boolean> = {
|
|
|
10
10
|
when: TWhen;
|
|
11
11
|
};
|
|
12
12
|
declare function SwitchRoot<TCondition = true>(props: SwitchProps<TCondition>): react.ReactElement<Pick<SwitchMatchProps<boolean>, "children">, string | react.JSXElementConstructor<any>> | undefined;
|
|
13
|
+
declare const Switch: typeof SwitchRoot;
|
|
13
14
|
declare function SwitchMatch<TWhen>({ children }: SwitchMatchProps<TWhen>): react.ReactNode;
|
|
14
15
|
declare function SwitchDefault({ children }: Pick<SwitchMatchProps, "children">): react.ReactNode;
|
|
15
16
|
declare namespace SwitchDefault {
|
|
16
17
|
var slot: symbol;
|
|
17
18
|
}
|
|
18
|
-
declare const Switch: typeof SwitchRoot;
|
|
19
|
-
declare const Root: typeof SwitchRoot;
|
|
20
|
-
declare const Match: typeof SwitchMatch;
|
|
21
|
-
declare const Default: typeof SwitchDefault;
|
|
22
19
|
|
|
23
|
-
export { Default, Match, Root, Switch, SwitchDefault, SwitchMatch, SwitchRoot };
|
|
20
|
+
export { SwitchDefault as Default, SwitchMatch as Match, SwitchRoot as Root, Switch, SwitchDefault, SwitchMatch, SwitchRoot };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import '../../chunk-PZ5AY32C.js';
|
|
1
2
|
import 'react';
|
|
2
3
|
import { getSlotElement, getOtherChildren } from '@zayne-labs/toolkit-react/utils';
|
|
3
4
|
|
|
4
|
-
// src/components/common/switch/switch.tsx
|
|
5
5
|
function SwitchRoot(props) {
|
|
6
6
|
const { children, condition = true } = props;
|
|
7
7
|
const defaultCase = getSlotElement(children, SwitchDefault, {
|
|
8
8
|
errorMessage: "Only one <Switch.Default> component is allowed",
|
|
9
9
|
throwOnMultipleSlotMatch: true
|
|
10
10
|
});
|
|
11
|
-
const childrenCasesArray = getOtherChildren(children,
|
|
11
|
+
const childrenCasesArray = getOtherChildren(children, SwitchDefault);
|
|
12
12
|
const matchedCase = childrenCasesArray.find((child) => child.props.when === condition);
|
|
13
13
|
return matchedCase ?? defaultCase;
|
|
14
14
|
}
|
|
15
|
+
var Switch = SwitchRoot;
|
|
15
16
|
function SwitchMatch({ children }) {
|
|
16
17
|
return children;
|
|
17
18
|
}
|
|
@@ -19,11 +20,7 @@ function SwitchDefault({ children }) {
|
|
|
19
20
|
return children;
|
|
20
21
|
}
|
|
21
22
|
SwitchDefault.slot = Symbol.for("switch-default");
|
|
22
|
-
var Switch = SwitchRoot;
|
|
23
|
-
var Root = SwitchRoot;
|
|
24
|
-
var Match = SwitchMatch;
|
|
25
|
-
var Default = SwitchDefault;
|
|
26
23
|
|
|
27
|
-
export { Default, Match, Root, Switch, SwitchDefault, SwitchMatch, SwitchRoot };
|
|
24
|
+
export { SwitchDefault as Default, SwitchMatch as Match, SwitchRoot as Root, Switch, SwitchDefault, SwitchMatch, SwitchRoot };
|
|
28
25
|
//# sourceMappingURL=index.js.map
|
|
29
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/common/switch/switch.tsx"],"names":[],"mappings":";;;;AAkBO,SAAS,WAA8B,KAAgC,EAAA;AAC7E,EAAA,MAAM,EAAE,QAAA,EAAU,SAAY,GAAA,IAAA,EAAS,GAAA,KAAA;AAEvC,EAAM,MAAA,WAAA,GAAc,cAAe,CAAA,QAAA,EAAU,aAAe,EAAA;AAAA,IAC3D,YAAc,EAAA,gDAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAM,MAAA,kBAAA,GAAqB,gBAAiB,CAAA,QAAA,EAAU,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/common/switch/switch.tsx"],"names":[],"mappings":";;;;AAkBO,SAAS,WAA8B,KAAgC,EAAA;AAC7E,EAAA,MAAM,EAAE,QAAA,EAAU,SAAY,GAAA,IAAA,EAAS,GAAA,KAAA;AAEvC,EAAM,MAAA,WAAA,GAAc,cAAe,CAAA,QAAA,EAAU,aAAe,EAAA;AAAA,IAC3D,YAAc,EAAA,gDAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAM,MAAA,kBAAA,GAAqB,gBAAiB,CAAA,QAAA,EAAU,aAAa,CAAA;AAEnE,EAAM,MAAA,WAAA,GAAc,mBAAmB,IAAK,CAAA,CAAC,UAAU,KAAM,CAAA,KAAA,CAAM,SAAS,SAAS,CAAA;AAErF,EAAA,OAAO,WAAe,IAAA,WAAA;AACvB;AAEO,IAAM,MAAS,GAAA;AAEf,SAAS,WAAA,CAAmB,EAAE,QAAA,EAAqC,EAAA;AACzE,EAAO,OAAA,QAAA;AACR;AAEO,SAAS,aAAA,CAAc,EAAE,QAAA,EAAgD,EAAA;AAC/E,EAAO,OAAA,QAAA;AACR;AACA,aAAc,CAAA,IAAA,GAAO,MAAO,CAAA,GAAA,CAAI,gBAAgB,CAAA","file":"index.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getOtherChildren, getSlotElement } from \"@zayne-labs/toolkit-react/utils\";\n\ntype ValidSwitchComponentType = React.ReactElement<SwitchMatchProps>;\n\ntype SwitchProps<TCondition> = {\n\tchildren: ValidSwitchComponentType | ValidSwitchComponentType[];\n\tcondition?: TCondition;\n};\n\ntype SwitchMatchProps<TWhen = boolean> = {\n\tchildren: React.ReactNode;\n\twhen: TWhen;\n};\n\nexport function SwitchRoot<TCondition = true>(props: SwitchProps<TCondition>) {\n\tconst { children, condition = true } = props;\n\n\tconst defaultCase = getSlotElement(children, SwitchDefault, {\n\t\terrorMessage: \"Only one <Switch.Default> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst childrenCasesArray = getOtherChildren(children, SwitchDefault);\n\n\tconst matchedCase = childrenCasesArray.find((child) => child.props.when === condition);\n\n\treturn matchedCase ?? defaultCase;\n}\n\nexport const Switch = SwitchRoot;\n\nexport function SwitchMatch<TWhen>({ children }: SwitchMatchProps<TWhen>) {\n\treturn children;\n}\n\nexport function SwitchDefault({ children }: Pick<SwitchMatchProps, \"children\">) {\n\treturn children;\n}\nSwitchDefault.slot = Symbol.for(\"switch-default\");\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import '../../chunk-PZ5AY32C.js';
|
|
1
2
|
import { useState } from 'react';
|
|
2
3
|
import { useEffectOnce, useMountEffect } from '@zayne-labs/toolkit-react';
|
|
3
4
|
import { isString } from '@zayne-labs/toolkit-type-helpers';
|
|
4
5
|
import { createPortal } from 'react-dom';
|
|
5
6
|
|
|
6
|
-
// src/components/common/teleport/teleport.tsx
|
|
7
7
|
function Teleport(props) {
|
|
8
8
|
const { children, insertPosition, to } = props;
|
|
9
9
|
const [reactPortal, setReactPortal] = useState(null);
|
|
@@ -9,11 +9,9 @@ declare function CardContent<TElement extends react.ElementType = "div">(props:
|
|
|
9
9
|
declare function CardFooter<TElement extends react.ElementType = "footer">(props: PolymorphicProps<TElement, {
|
|
10
10
|
asChild?: boolean;
|
|
11
11
|
}>): react.JSX.Element;
|
|
12
|
-
declare const Root: typeof CardRoot;
|
|
13
|
-
declare const Header: typeof CardHeader;
|
|
14
|
-
declare const Title: typeof CardTitle;
|
|
15
|
-
declare const Description: typeof CardDescription;
|
|
16
|
-
declare const Content: typeof CardContent;
|
|
17
|
-
declare const Footer: typeof CardFooter;
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
declare namespace cardParts {
|
|
14
|
+
export { CardContent as Content, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { cardParts as Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
|
|
@@ -1,82 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
1
|
+
import { Slot } from '../../chunk-ENDWJXPF.js';
|
|
2
|
+
import { cnMerge } from '../../chunk-OHG7GB7O.js';
|
|
3
|
+
import { __export } from '../../chunk-PZ5AY32C.js';
|
|
4
|
+
import * as React from 'react';
|
|
6
5
|
|
|
7
|
-
// src/components/ui/card/card.tsx
|
|
8
|
-
function Slottable({ children }) {
|
|
9
|
-
return children;
|
|
10
|
-
}
|
|
11
|
-
var isSlottable = (child) => {
|
|
12
|
-
return isValidElement(child) && child.type === Slottable;
|
|
13
|
-
};
|
|
14
|
-
function Slot(props) {
|
|
15
|
-
const { children, ...restOfSlotProps } = props;
|
|
16
|
-
const childrenArray = isArray(children) ? children : [children];
|
|
17
|
-
const slottable = childrenArray.find((element) => isSlottable(element));
|
|
18
|
-
if (slottable) {
|
|
19
|
-
const newElement = slottable.props.children;
|
|
20
|
-
if (Children.count(newElement) > 1) {
|
|
21
|
-
return Children.only(null);
|
|
22
|
-
}
|
|
23
|
-
const newElementChildren = childrenArray.map((child) => {
|
|
24
|
-
if (child === slottable) {
|
|
25
|
-
return isValidElement(newElement) && newElement.props.children;
|
|
26
|
-
}
|
|
27
|
-
return child;
|
|
28
|
-
});
|
|
29
|
-
return /* @__PURE__ */ React2.createElement(SlotClone, { ...restOfSlotProps }, isValidElement(newElement) && cloneElement(newElement, void 0, newElementChildren));
|
|
30
|
-
}
|
|
31
|
-
return /* @__PURE__ */ React2.createElement(SlotClone, { ...restOfSlotProps }, children);
|
|
32
|
-
}
|
|
33
|
-
function SlotClone(props) {
|
|
34
|
-
const { children, ref: forwardedRef, ...restOfSlotProps } = props;
|
|
35
|
-
if (!isValidElement(children)) {
|
|
36
|
-
return Children.count(children) > 1 ? Children.only(null) : null;
|
|
37
|
-
}
|
|
38
|
-
const childRef = children.props.ref ?? children.ref;
|
|
39
|
-
const clonedProps = {
|
|
40
|
-
...mergeProps(restOfSlotProps, children.props),
|
|
41
|
-
ref: forwardedRef ? composeRefs([forwardedRef, childRef]) : childRef
|
|
42
|
-
};
|
|
43
|
-
return cloneElement(children, clonedProps);
|
|
44
|
-
}
|
|
45
|
-
var cnMerge = (...classNames) => twMerge(classNames);
|
|
46
|
-
|
|
47
|
-
// src/components/ui/card/card.tsx
|
|
48
6
|
function CardRoot(props) {
|
|
49
7
|
const { as: Element = "article", ...restOfProps } = props;
|
|
50
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
|
|
51
9
|
}
|
|
52
10
|
function CardHeader(props) {
|
|
53
11
|
const { as: Element = "header", ...restOfProps } = props;
|
|
54
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
|
|
55
13
|
}
|
|
56
14
|
function CardTitle(props) {
|
|
57
15
|
const { as: Element = "h3", className, ...restOfProps } = props;
|
|
58
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Element, { className: cnMerge("font-semibold", className), ...restOfProps });
|
|
59
17
|
}
|
|
60
18
|
function CardDescription(props) {
|
|
61
19
|
const { as: Element = "p", className, ...restOfProps } = props;
|
|
62
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ React.createElement(Element, { className: cnMerge("text-sm text-shadcn-muted-foreground", className), ...restOfProps });
|
|
63
21
|
}
|
|
64
22
|
function CardContent(props) {
|
|
65
23
|
const { as: Element = "div", ...restOfProps } = props;
|
|
66
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
|
|
67
25
|
}
|
|
68
26
|
function CardFooter(props) {
|
|
69
27
|
const { as: Element = "footer", asChild, ...restOfProps } = props;
|
|
70
28
|
const Component = asChild ? Slot : Element;
|
|
71
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ React.createElement(Component, { ...restOfProps });
|
|
72
30
|
}
|
|
73
|
-
var Root = CardRoot;
|
|
74
|
-
var Header = CardHeader;
|
|
75
|
-
var Title = CardTitle;
|
|
76
|
-
var Description = CardDescription;
|
|
77
|
-
var Content = CardContent;
|
|
78
|
-
var Footer = CardFooter;
|
|
79
31
|
|
|
80
|
-
|
|
32
|
+
// src/components/ui/card/card-parts.ts
|
|
33
|
+
var card_parts_exports = {};
|
|
34
|
+
__export(card_parts_exports, {
|
|
35
|
+
Content: () => CardContent,
|
|
36
|
+
Description: () => CardDescription,
|
|
37
|
+
Footer: () => CardFooter,
|
|
38
|
+
Header: () => CardHeader,
|
|
39
|
+
Root: () => CardRoot,
|
|
40
|
+
Title: () => CardTitle
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { card_parts_exports as Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
|
|
81
44
|
//# sourceMappingURL=index.js.map
|
|
82
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/card/card.tsx","../../../../src/components/ui/card/card-parts.ts"],"names":[],"mappings":";;;;;AAMO,SAAS,SACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,SAAW,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEpD,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AAClC;AAEO,SAAS,WACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,QAAU,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEnD,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AAClC;AAEO,SAAS,UAAqD,KAAmC,EAAA;AACvG,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,MAAM,SAAW,EAAA,GAAG,aAAgB,GAAA,KAAA;AAE1D,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,SAAW,EAAA,OAAA,CAAQ,iBAAiB,SAAS,CAAA,EAAI,GAAG,WAAa,EAAA,CAAA;AAClF;AAEO,SAAS,gBACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,KAAK,SAAW,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEzD,EACC,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,SAAW,EAAA,OAAA,CAAQ,wCAAwC,SAAS,CAAA,EAAI,GAAG,WAAa,EAAA,CAAA;AAEnG;AAEO,SAAS,YACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,KAAO,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEhD,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AAClC;AAEO,SAAS,WACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,UAAU,OAAS,EAAA,GAAG,aAAgB,GAAA,KAAA;AAE5D,EAAM,MAAA,SAAA,GAAY,UAAU,IAAO,GAAA,OAAA;AAEnC,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAW,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AACpC;;;ACtDA,IAAA,kBAAA,GAAA;AAAA,QAAA,CAAA,kBAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,WAAA;AAAA,EAAA,WAAA,EAAA,MAAA,eAAA;AAAA,EAAA,MAAA,EAAA,MAAA,UAAA;AAAA,EAAA,MAAA,EAAA,MAAA,UAAA;AAAA,EAAA,IAAA,EAAA,MAAA,QAAA;AAAA,EAAA,KAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\n\nimport { Slot } from \"@/components/common/slot\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\n\nexport function CardRoot<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"article\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardHeader<TElement extends React.ElementType = \"header\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"header\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardTitle<TElement extends React.ElementType = \"h3\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"h3\", className, ...restOfProps } = props;\n\n\treturn <Element className={cnMerge(\"font-semibold\", className)} {...restOfProps} />;\n}\n\nexport function CardDescription<TElement extends React.ElementType = \"p\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"p\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element className={cnMerge(\"text-sm text-shadcn-muted-foreground\", className)} {...restOfProps} />\n\t);\n}\n\nexport function CardContent<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"div\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardFooter<TElement extends React.ElementType = \"footer\">(\n\tprops: PolymorphicProps<TElement, { asChild?: boolean }>\n) {\n\tconst { as: Element = \"footer\", asChild, ...restOfProps } = props;\n\n\tconst Component = asChild ? Slot : Element;\n\n\treturn <Component {...restOfProps} />;\n}\n","export {\n\tCardContent as Content,\n\tCardDescription as Description,\n\tCardFooter as Footer,\n\tCardHeader as Header,\n\tCardRoot as Root,\n\tCardTitle as Title,\n} from \"./card\";\n"]}
|
|
@@ -73,8 +73,6 @@ type OtherCarouselProps = {
|
|
|
73
73
|
style?: React.CSSProperties;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
declare function CarouselContextProvider<TImages extends ImagesType>(props: CarouselProviderProps<TImages>): react.JSX.Element;
|
|
77
|
-
|
|
78
76
|
declare function CarouselContent<TElement extends react.ElementType = "article">(props: PolymorphicProps<TElement, CarouselContentProps>): react.JSX.Element;
|
|
79
77
|
declare function CarouselButton(props: CarouselButtonsProps): react.JSX.Element;
|
|
80
78
|
declare function CarouselControls(props: CarouselControlProps): react.JSX.Element;
|
|
@@ -84,13 +82,10 @@ declare function CarouselCaption<TElement extends react.ElementType = "div">(pro
|
|
|
84
82
|
declare function CarouselIndicatorWrapper<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): react.JSX.Element;
|
|
85
83
|
declare function CarouselIndicator(props: CarouselIndicatorProps): react.JSX.Element;
|
|
86
84
|
|
|
87
|
-
declare
|
|
88
|
-
|
|
89
|
-
declare
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
declare const Caption: typeof CarouselCaption;
|
|
93
|
-
declare const Indicator: typeof CarouselIndicator;
|
|
94
|
-
declare const IndicatorWrapper: typeof CarouselIndicatorWrapper;
|
|
85
|
+
declare function CarouselContextProvider<TImages extends ImagesType>(props: CarouselProviderProps<TImages>): react.JSX.Element;
|
|
86
|
+
|
|
87
|
+
declare namespace carouselParts {
|
|
88
|
+
export { CarouselButton as Button, CarouselCaption as Caption, CarouselContent as Content, CarouselControls as Controls, CarouselIndicator as Indicator, CarouselIndicatorWrapper as IndicatorWrapper, CarouselItem as Item, CarouselItemWrapper as ItemWrapper, CarouselContextProvider as Root };
|
|
89
|
+
}
|
|
95
90
|
|
|
96
|
-
export {
|
|
91
|
+
export { carouselParts as Carousel, CarouselButton, type CarouselButtonsProps, CarouselCaption, CarouselContent, type CarouselContentProps, type CarouselControlProps, CarouselControls, CarouselIndicator, type CarouselIndicatorProps, CarouselIndicatorWrapper, CarouselItem, CarouselItemWrapper, type CarouselProviderProps, type CarouselStore, type CarouselStoreApi, type CarouselWrapperProps, type ImagesType, type OtherCarouselProps };
|