@jbpark/ui-kit 2.3.3 → 2.3.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.
- package/README.ko.md +0 -1
- package/README.md +0 -1
- package/dist/Menu.d.mts +62 -2
- package/dist/Menu.d.mts.map +1 -0
- package/dist/Menu.mjs +66 -5
- package/dist/Menu.mjs.map +1 -0
- package/dist/Reveals.d.mts +43 -2
- package/dist/Reveals.d.mts.map +1 -0
- package/dist/Reveals.mjs +28 -3
- package/dist/Reveals.mjs.map +1 -0
- package/dist/Typography.d.mts +40 -2
- package/dist/Typography.d.mts.map +1 -0
- package/dist/Typography.mjs +20 -3
- package/dist/Typography.mjs.map +1 -0
- package/dist/{chunk-BWyCjowX.mjs → _virtual/_rolldown/runtime.mjs} +4 -4
- package/dist/components/atoms/Button/index.d.mts +36 -0
- package/dist/components/atoms/Button/index.d.mts.map +1 -0
- package/dist/components/atoms/Button/index.mjs +56 -0
- package/dist/components/atoms/Button/index.mjs.map +1 -0
- package/dist/components/atoms/Checkbox/Group/index.d.mts +21 -0
- package/dist/components/atoms/Checkbox/Group/index.d.mts.map +1 -0
- package/dist/components/atoms/Checkbox/Group/index.mjs +41 -0
- package/dist/components/atoms/Checkbox/Group/index.mjs.map +1 -0
- package/dist/components/atoms/Checkbox/index.d.mts +45 -0
- package/dist/components/atoms/Checkbox/index.d.mts.map +1 -0
- package/dist/components/atoms/Checkbox/index.mjs +70 -0
- package/dist/components/atoms/Checkbox/index.mjs.map +1 -0
- package/dist/components/atoms/ColorPicker/index.d.mts +18 -0
- package/dist/components/atoms/ColorPicker/index.d.mts.map +1 -0
- package/dist/components/atoms/ColorPicker/index.mjs +39 -0
- package/dist/components/atoms/ColorPicker/index.mjs.map +1 -0
- package/dist/components/atoms/FloatButton/BackTop/index.d.mts +12 -0
- package/dist/components/atoms/FloatButton/BackTop/index.d.mts.map +1 -0
- package/dist/components/atoms/FloatButton/BackTop/index.mjs +27 -0
- package/dist/components/atoms/FloatButton/BackTop/index.mjs.map +1 -0
- package/dist/components/atoms/FloatButton/index.d.mts +22 -0
- package/dist/components/atoms/FloatButton/index.d.mts.map +1 -0
- package/dist/components/atoms/FloatButton/index.mjs +19 -0
- package/dist/components/atoms/FloatButton/index.mjs.map +1 -0
- package/dist/components/atoms/Input/Search/index.d.mts +15 -0
- package/dist/components/atoms/Input/Search/index.d.mts.map +1 -0
- package/dist/components/atoms/Input/Search/index.mjs +57 -0
- package/dist/components/atoms/Input/Search/index.mjs.map +1 -0
- package/dist/components/atoms/Input/TextArea/index.d.mts +1 -0
- package/dist/components/atoms/Input/TextArea/index.mjs +18 -0
- package/dist/components/atoms/Input/TextArea/index.mjs.map +1 -0
- package/dist/components/atoms/Input/index.d.mts +31 -0
- package/dist/components/atoms/Input/index.d.mts.map +1 -0
- package/dist/components/atoms/Input/index.mjs +17 -0
- package/dist/components/atoms/Input/index.mjs.map +1 -0
- package/dist/components/atoms/Popover/index.d.mts +19 -0
- package/dist/components/atoms/Popover/index.d.mts.map +1 -0
- package/dist/components/atoms/Popover/index.mjs +229 -0
- package/dist/components/atoms/Popover/index.mjs.map +1 -0
- package/dist/components/atoms/Progress/index.d.mts +20 -0
- package/dist/components/atoms/Progress/index.d.mts.map +1 -0
- package/dist/components/atoms/Progress/index.mjs +25 -0
- package/dist/components/atoms/Progress/index.mjs.map +1 -0
- package/dist/components/atoms/Radio/Group/index.d.mts +21 -0
- package/dist/components/atoms/Radio/Group/index.d.mts.map +1 -0
- package/dist/components/atoms/Radio/Group/index.mjs +41 -0
- package/dist/components/atoms/Radio/Group/index.mjs.map +1 -0
- package/dist/components/atoms/Radio/index.d.mts +47 -0
- package/dist/components/atoms/Radio/index.d.mts.map +1 -0
- package/dist/components/atoms/Radio/index.mjs +77 -0
- package/dist/components/atoms/Radio/index.mjs.map +1 -0
- package/dist/components/atoms/Select/index.d.mts +31 -0
- package/dist/components/atoms/Select/index.d.mts.map +1 -0
- package/dist/components/atoms/Select/index.mjs +31 -0
- package/dist/components/atoms/Select/index.mjs.map +1 -0
- package/dist/components/atoms/Skeleton/Button/index.d.mts +2 -0
- package/dist/components/atoms/Skeleton/Button/index.mjs +15 -0
- package/dist/components/atoms/Skeleton/Button/index.mjs.map +1 -0
- package/dist/components/atoms/Skeleton/Node/index.d.mts +2 -0
- package/dist/components/atoms/Skeleton/Node/index.mjs +16 -0
- package/dist/components/atoms/Skeleton/Node/index.mjs.map +1 -0
- package/dist/components/atoms/Skeleton/index.d.mts +51 -0
- package/dist/components/atoms/Skeleton/index.d.mts.map +1 -0
- package/dist/components/atoms/Skeleton/index.mjs +46 -0
- package/dist/components/atoms/Skeleton/index.mjs.map +1 -0
- package/dist/components/atoms/Spin/index.d.mts +14 -0
- package/dist/components/atoms/Spin/index.d.mts.map +1 -0
- package/dist/components/atoms/Spin/index.mjs +17 -0
- package/dist/components/atoms/Spin/index.mjs.map +1 -0
- package/dist/components/atoms/Switch/index.d.mts +24 -0
- package/dist/components/atoms/Switch/index.d.mts.map +1 -0
- package/dist/components/atoms/Switch/index.mjs +32 -0
- package/dist/components/atoms/Switch/index.mjs.map +1 -0
- package/dist/components/atoms/Typography/Link/index.d.mts +12 -0
- package/dist/components/atoms/Typography/Link/index.d.mts.map +1 -0
- package/dist/components/atoms/Typography/Link/index.mjs +15 -0
- package/dist/components/atoms/Typography/Link/index.mjs.map +1 -0
- package/dist/components/atoms/Typography/Paragraph/index.d.mts +12 -0
- package/dist/components/atoms/Typography/Paragraph/index.d.mts.map +1 -0
- package/dist/components/atoms/Typography/Paragraph/index.mjs +15 -0
- package/dist/components/atoms/Typography/Paragraph/index.mjs.map +1 -0
- package/dist/components/atoms/Typography/Text/index.d.mts +17 -0
- package/dist/components/atoms/Typography/Text/index.d.mts.map +1 -0
- package/dist/components/atoms/Typography/Text/index.mjs +15 -0
- package/dist/components/atoms/Typography/Text/index.mjs.map +1 -0
- package/dist/components/atoms/Typography/Title/index.d.mts +15 -0
- package/dist/components/atoms/Typography/Title/index.d.mts.map +1 -0
- package/dist/components/atoms/Typography/Title/index.mjs +24 -0
- package/dist/components/atoms/Typography/Title/index.mjs.map +1 -0
- package/dist/components/atoms/index.d.mts +13 -0
- package/dist/components/atoms/index.mjs +15 -0
- package/dist/components/molecules/Card/index.d.mts +22 -0
- package/dist/components/molecules/Card/index.d.mts.map +1 -0
- package/dist/components/molecules/Card/index.mjs +21 -0
- package/dist/components/molecules/Card/index.mjs.map +1 -0
- package/dist/components/molecules/Collapse/index.d.mts +36 -0
- package/dist/components/molecules/Collapse/index.d.mts.map +1 -0
- package/dist/components/molecules/Collapse/index.mjs +53 -0
- package/dist/components/molecules/Collapse/index.mjs.map +1 -0
- package/dist/components/molecules/Dropdown/index.d.mts +23 -0
- package/dist/components/molecules/Dropdown/index.d.mts.map +1 -0
- package/dist/components/molecules/Dropdown/index.mjs +66 -0
- package/dist/components/molecules/Dropdown/index.mjs.map +1 -0
- package/dist/components/molecules/Marquees/Item/index.d.mts +17 -0
- package/dist/components/molecules/Marquees/Item/index.d.mts.map +1 -0
- package/dist/components/molecules/Marquees/Item/index.mjs +103 -0
- package/dist/components/molecules/Marquees/Item/index.mjs.map +1 -0
- package/dist/components/molecules/Marquees/index.d.mts +31 -0
- package/dist/components/molecules/Marquees/index.d.mts.map +1 -0
- package/dist/components/molecules/Marquees/index.mjs +63 -0
- package/dist/components/molecules/Marquees/index.mjs.map +1 -0
- package/dist/components/molecules/Menu/Item/Label/index.mjs +18 -0
- package/dist/components/molecules/Menu/Item/Label/index.mjs.map +1 -0
- package/dist/components/molecules/Menu/Item/index.mjs +122 -0
- package/dist/components/molecules/Menu/Item/index.mjs.map +1 -0
- package/dist/{index-CsjsTuId.d.mts → components/molecules/Reveals/Item/index.d.mts} +4 -41
- package/dist/components/molecules/Reveals/Item/index.d.mts.map +1 -0
- package/dist/{Reveals-Cqo3i2hh.mjs → components/molecules/Reveals/Item/index.mjs} +5 -27
- package/dist/components/molecules/Reveals/Item/index.mjs.map +1 -0
- package/dist/components/molecules/Space/index.d.mts +34 -0
- package/dist/components/molecules/Space/index.d.mts.map +1 -0
- package/dist/components/molecules/Space/index.mjs +41 -0
- package/dist/components/molecules/Space/index.mjs.map +1 -0
- package/dist/components/molecules/index.d.mts +7 -0
- package/dist/components/molecules/index.mjs +9 -0
- package/dist/components/organisms/Drawer/index.d.mts +54 -0
- package/dist/components/organisms/Drawer/index.d.mts.map +1 -0
- package/dist/components/organisms/Drawer/index.mjs +72 -0
- package/dist/components/organisms/Drawer/index.mjs.map +1 -0
- package/dist/components/organisms/List/Item/index.mjs +15 -0
- package/dist/components/organisms/List/Item/index.mjs.map +1 -0
- package/dist/components/organisms/List/index.d.mts +52 -0
- package/dist/components/organisms/List/index.d.mts.map +1 -0
- package/dist/components/organisms/List/index.mjs +77 -0
- package/dist/components/organisms/List/index.mjs.map +1 -0
- package/dist/components/organisms/Modal/index.d.mts +66 -0
- package/dist/components/organisms/Modal/index.d.mts.map +1 -0
- package/dist/components/organisms/Modal/index.mjs +197 -0
- package/dist/components/organisms/Modal/index.mjs.map +1 -0
- package/dist/components/organisms/Swiper/Slide/index.mjs +17 -0
- package/dist/components/organisms/Swiper/Slide/index.mjs.map +1 -0
- package/dist/components/organisms/Swiper/index.d.mts +42 -0
- package/dist/components/organisms/Swiper/index.d.mts.map +1 -0
- package/dist/components/organisms/Swiper/index.mjs +58 -0
- package/dist/components/organisms/Swiper/index.mjs.map +1 -0
- package/dist/components/organisms/index.d.mts +4 -0
- package/dist/components/organisms/index.mjs +6 -0
- package/dist/components/templates/Layout/Content/index.d.mts +1 -0
- package/dist/components/templates/Layout/Content/index.mjs +15 -0
- package/dist/components/templates/Layout/Content/index.mjs.map +1 -0
- package/dist/components/templates/Layout/Footer/index.d.mts +1 -0
- package/dist/components/templates/Layout/Footer/index.mjs +15 -0
- package/dist/components/templates/Layout/Footer/index.mjs.map +1 -0
- package/dist/components/templates/Layout/Header/index.d.mts +7 -0
- package/dist/components/templates/Layout/Header/index.d.mts.map +1 -0
- package/dist/components/templates/Layout/Header/index.mjs +15 -0
- package/dist/components/templates/Layout/Header/index.mjs.map +1 -0
- package/dist/components/templates/Layout/Sider/index.d.mts +1 -0
- package/dist/components/templates/Layout/Sider/index.mjs +15 -0
- package/dist/components/templates/Layout/Sider/index.mjs.map +1 -0
- package/dist/components/templates/Layout/index.d.mts +38 -0
- package/dist/components/templates/Layout/index.d.mts.map +1 -0
- package/dist/components/templates/Layout/index.mjs +23 -0
- package/dist/components/templates/Layout/index.mjs.map +1 -0
- package/dist/components/templates/index.d.mts +1 -0
- package/dist/components/templates/index.mjs +3 -0
- package/dist/core/accordion.d.mts +32 -0
- package/dist/core/accordion.d.mts.map +1 -0
- package/dist/core/accordion.mjs +59 -0
- package/dist/core/accordion.mjs.map +1 -0
- package/dist/core/button.d.mts +26 -0
- package/dist/core/button.d.mts.map +1 -0
- package/dist/core/button.mjs +55 -0
- package/dist/core/button.mjs.map +1 -0
- package/dist/core/checkbox.d.mts +15 -0
- package/dist/core/checkbox.d.mts.map +1 -0
- package/dist/core/checkbox.mjs +34 -0
- package/dist/core/checkbox.mjs.map +1 -0
- package/dist/core/dialog.d.mts +68 -0
- package/dist/core/dialog.d.mts.map +1 -0
- package/dist/core/dialog.mjs +124 -0
- package/dist/core/dialog.mjs.map +1 -0
- package/dist/core/drawer.d.mts +60 -0
- package/dist/core/drawer.d.mts.map +1 -0
- package/dist/core/drawer.mjs +120 -0
- package/dist/core/drawer.mjs.map +1 -0
- package/dist/core/field.d.mts +68 -0
- package/dist/core/field.d.mts.map +1 -0
- package/dist/core/field.mjs +145 -0
- package/dist/core/field.mjs.map +1 -0
- package/dist/core/input.d.mts +15 -0
- package/dist/core/input.d.mts.map +1 -0
- package/dist/core/input.mjs +27 -0
- package/dist/core/input.mjs.map +1 -0
- package/dist/core/label.d.mts +15 -0
- package/dist/core/label.d.mts.map +1 -0
- package/dist/core/label.mjs +24 -0
- package/dist/core/label.mjs.map +1 -0
- package/dist/core/popover.d.mts +38 -0
- package/dist/core/popover.d.mts.map +1 -0
- package/dist/core/popover.mjs +78 -0
- package/dist/core/popover.mjs.map +1 -0
- package/dist/core/progress.d.mts +22 -0
- package/dist/core/progress.d.mts.map +1 -0
- package/dist/core/progress.mjs +29 -0
- package/dist/core/progress.mjs.map +1 -0
- package/dist/core/radio-group.d.mts +19 -0
- package/dist/core/radio-group.d.mts.map +1 -0
- package/dist/core/radio-group.mjs +43 -0
- package/dist/core/radio-group.mjs.map +1 -0
- package/dist/core/select.d.mts +56 -0
- package/dist/core/select.d.mts.map +1 -0
- package/dist/core/select.mjs +144 -0
- package/dist/core/select.mjs.map +1 -0
- package/dist/core/separator.d.mts +17 -0
- package/dist/core/separator.d.mts.map +1 -0
- package/dist/core/separator.mjs +25 -0
- package/dist/core/separator.mjs.map +1 -0
- package/dist/core/skeleton.d.mts +13 -0
- package/dist/core/skeleton.d.mts.map +1 -0
- package/dist/core/skeleton.mjs +17 -0
- package/dist/core/skeleton.mjs.map +1 -0
- package/dist/core/switch.d.mts +22 -0
- package/dist/core/switch.d.mts.map +1 -0
- package/dist/core/switch.mjs +39 -0
- package/dist/core/switch.mjs.map +1 -0
- package/dist/core/textarea.d.mts +14 -0
- package/dist/core/textarea.d.mts.map +1 -0
- package/dist/core/textarea.mjs +25 -0
- package/dist/core/textarea.mjs.map +1 -0
- package/dist/core.d.mts +16 -1
- package/dist/core.mjs +16 -4
- package/dist/enums.d.mts +2 -1
- package/dist/enums.d.mts.map +1 -0
- package/dist/enums.mjs +2 -1
- package/dist/enums.mjs.map +1 -0
- package/dist/index.d.mts +29 -714
- package/dist/index.mjs +31 -5
- package/dist/node_modules/gsap/CSSPlugin.mjs +920 -0
- package/dist/node_modules/gsap/CSSPlugin.mjs.map +1 -0
- package/dist/node_modules/gsap/gsap-core.mjs +2723 -0
- package/dist/node_modules/gsap/gsap-core.mjs.map +1 -0
- package/dist/node_modules/gsap/index.mjs +9 -0
- package/dist/node_modules/gsap/index.mjs.map +1 -0
- package/dist/{output.css → style.css} +3 -196
- package/dist/style.css.map +1 -0
- package/dist/style.mjs +1 -0
- package/dist/utils.d.mts +2 -1
- package/dist/utils.d.mts.map +1 -0
- package/dist/utils.mjs +16 -2
- package/dist/utils.mjs.map +1 -0
- package/package.json +10 -11
- package/dist/Typography-Dznhj8uL.mjs +0 -71
- package/dist/index-BNAJ1QtH.d.mts +0 -75
- package/dist/index-tclrN3ts.d.mts +0 -61
- package/dist/index-y5n1p7t3.d.mts +0 -390
- package/dist/src-B6Kaolt3.mjs +0 -6158
- package/dist/src-BzCZ9O6j.css +0 -211
- package/dist/utils-1s_37TSX.mjs +0 -16
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { cn } from "../../../utils.mjs";
|
|
2
|
+
import Skeleton from "../../atoms/Skeleton/index.mjs";
|
|
3
|
+
import { Children } from "react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/molecules/Space/index.tsx
|
|
7
|
+
const sizes = {
|
|
8
|
+
small: [4, 4],
|
|
9
|
+
middle: [8, 8],
|
|
10
|
+
large: [16, 16]
|
|
11
|
+
};
|
|
12
|
+
const aligns = {
|
|
13
|
+
start: "items-start text-start",
|
|
14
|
+
end: "items-end text-end",
|
|
15
|
+
center: "items-center text-center",
|
|
16
|
+
baseline: "items-baseline text-baseline"
|
|
17
|
+
};
|
|
18
|
+
const Space = ({ loading, loader, children, size = "middle", orientation = "horizontal", align = "center", wrap = false, split, className, grid, hidden, style, ...props }) => {
|
|
19
|
+
const [x, y] = typeof size === "string" ? sizes[size] || [0, 0] : Array.isArray(size) ? size : [size, size];
|
|
20
|
+
const count = Children.count(children);
|
|
21
|
+
if (loading) return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: cn(className),
|
|
23
|
+
children: loader || /* @__PURE__ */ jsx(Skeleton, {})
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ jsx("div", {
|
|
26
|
+
className: cn("flex flex-nowrap", orientation === "horizontal" ? "flex-row" : "flex-col", wrap && "flex-wrap", aligns[align], grid && "grid", hidden && "hidden", className),
|
|
27
|
+
style: {
|
|
28
|
+
columnGap: x,
|
|
29
|
+
rowGap: y,
|
|
30
|
+
gridTemplateRows: grid?.rows ? `repeat(${grid.rows}, minmax(0, 1fr))` : void 0,
|
|
31
|
+
gridTemplateColumns: grid?.cols ? `repeat(${grid.cols}, minmax(0, 1fr))` : void 0,
|
|
32
|
+
...style
|
|
33
|
+
},
|
|
34
|
+
...props,
|
|
35
|
+
children: Children.map(children, (child, i) => /* @__PURE__ */ jsxs(Fragment, { children: [child, split && i < count - 1 && split] }))
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Space as default };
|
|
41
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/molecules/Space/index.tsx"],"sourcesContent":["import { Children } from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport Skeleton from '../../atoms/Skeleton';\n\ninterface Props extends React.ComponentPropsWithRef<'div'> {\n loading?: boolean;\n loader?: React.ReactNode;\n orientation?: 'horizontal' | 'vertical';\n size?: 'small' | 'middle' | 'large' | number | number[];\n align?: 'start' | 'end' | 'center' | 'baseline';\n wrap?: boolean;\n split?: React.ReactNode;\n grid?: {\n rows?: number;\n cols?: number;\n };\n}\n\nconst sizes: Record<string, number[]> = {\n small: [4, 4],\n middle: [8, 8],\n large: [16, 16],\n};\n\nconst aligns: Record<string, string> = {\n start: 'items-start text-start',\n end: 'items-end text-end',\n center: 'items-center text-center',\n baseline: 'items-baseline text-baseline',\n};\n\nconst Space = ({\n loading,\n loader,\n children,\n size = 'middle',\n orientation = 'horizontal',\n align = 'center',\n wrap = false,\n split,\n className,\n grid,\n hidden,\n style,\n ...props\n}: Props) => {\n const [x, y] =\n typeof size === 'string'\n ? sizes[size] || [0, 0]\n : Array.isArray(size)\n ? size\n : [size, size];\n const count = Children.count(children);\n\n if (loading) {\n return <div className={cn(className)}>{loader || <Skeleton />}</div>;\n }\n\n return (\n <div\n className={cn(\n 'flex flex-nowrap',\n orientation === 'horizontal' ? 'flex-row' : 'flex-col',\n wrap && 'flex-wrap',\n aligns[align],\n grid && 'grid',\n hidden && 'hidden',\n className,\n )}\n style={{\n columnGap: x,\n rowGap: y,\n gridTemplateRows: grid?.rows\n ? `repeat(${grid.rows}, minmax(0, 1fr))`\n : undefined,\n gridTemplateColumns: grid?.cols\n ? `repeat(${grid.cols}, minmax(0, 1fr))`\n : undefined,\n ...style,\n }}\n {...props}\n >\n {Children.map(children, (child, i) => (\n <>\n {child}\n {split && i < count - 1 && split}\n </>\n ))}\n </div>\n );\n};\n\nexport default Space;\n"],"mappings":";;;;;;AAoBA,MAAM,QAAkC;CACtC,OAAO,CAAC,GAAG,EAAE;CACb,QAAQ,CAAC,GAAG,EAAE;CACd,OAAO,CAAC,IAAI,GAAG;CAChB;AAED,MAAM,SAAiC;CACrC,OAAO;CACP,KAAK;CACL,QAAQ;CACR,UAAU;CACX;AAED,MAAM,SAAS,EACb,SACA,QACA,UACA,OAAO,UACP,cAAc,cACd,QAAQ,UACR,OAAO,OACP,OACA,WACA,MACA,QACA,OACA,GAAG,YACQ;CACX,MAAM,CAAC,GAAG,KACR,OAAO,SAAS,WACZ,MAAM,SAAS,CAAC,GAAG,EAAE,GACrB,MAAM,QAAQ,KAAK,GACjB,OACA,CAAC,MAAM,KAAK;CACpB,MAAM,QAAQ,SAAS,MAAM,SAAS;AAEtC,KAAI,QACF,QAAO,oBAAC;EAAI,WAAW,GAAG,UAAU;YAAG,UAAU,oBAAC,aAAW;GAAO;AAGtE,QACE,oBAAC;EACC,WAAW,GACT,oBACA,gBAAgB,eAAe,aAAa,YAC5C,QAAQ,aACR,OAAO,QACP,QAAQ,QACR,UAAU,UACV,UACD;EACD,OAAO;GACL,WAAW;GACX,QAAQ;GACR,kBAAkB,MAAM,OACpB,UAAU,KAAK,KAAK,qBACpB;GACJ,qBAAqB,MAAM,OACvB,UAAU,KAAK,KAAK,qBACpB;GACJ,GAAG;GACJ;EACD,GAAI;YAEH,SAAS,IAAI,WAAW,OAAO,MAC9B,4CACG,OACA,SAAS,IAAI,QAAQ,KAAK,SAC1B,CACH;GACE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Menu from "../../Menu.mjs";
|
|
2
|
+
import Reveals from "../../Reveals.mjs";
|
|
3
|
+
import { Card } from "./Card/index.mjs";
|
|
4
|
+
import { Collapse } from "./Collapse/index.mjs";
|
|
5
|
+
import { Dropdown } from "./Dropdown/index.mjs";
|
|
6
|
+
import { Marquees } from "./Marquees/index.mjs";
|
|
7
|
+
import { Space } from "./Space/index.mjs";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Card from "./Card/index.mjs";
|
|
2
|
+
import Collapse from "./Collapse/index.mjs";
|
|
3
|
+
import Menu from "../../Menu.mjs";
|
|
4
|
+
import Dropdown from "./Dropdown/index.mjs";
|
|
5
|
+
import Marquees from "./Marquees/index.mjs";
|
|
6
|
+
import Reveals from "../../Reveals.mjs";
|
|
7
|
+
import Space from "./Space/index.mjs";
|
|
8
|
+
|
|
9
|
+
export { };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/components/organisms/Drawer/index.d.ts
|
|
4
|
+
interface Props {
|
|
5
|
+
open: boolean;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
footer?: React.ReactNode;
|
|
9
|
+
closable?: boolean;
|
|
10
|
+
closeIcon?: React.ReactNode;
|
|
11
|
+
direction?: 'top' | 'bottom' | 'left' | 'right';
|
|
12
|
+
maskClosable?: boolean;
|
|
13
|
+
handlebar?: boolean;
|
|
14
|
+
draggable?: boolean;
|
|
15
|
+
rounded?: boolean;
|
|
16
|
+
mask?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
classNames?: {
|
|
20
|
+
mask?: string;
|
|
21
|
+
content?: string;
|
|
22
|
+
handlebar?: string;
|
|
23
|
+
header?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
close?: string;
|
|
26
|
+
body?: string;
|
|
27
|
+
footer?: string;
|
|
28
|
+
};
|
|
29
|
+
container?: HTMLElement;
|
|
30
|
+
onClose: () => void;
|
|
31
|
+
}
|
|
32
|
+
declare const Drawer: ({
|
|
33
|
+
open,
|
|
34
|
+
title,
|
|
35
|
+
footer,
|
|
36
|
+
closable,
|
|
37
|
+
closeIcon,
|
|
38
|
+
direction,
|
|
39
|
+
maskClosable,
|
|
40
|
+
handlebar,
|
|
41
|
+
draggable,
|
|
42
|
+
rounded,
|
|
43
|
+
mask,
|
|
44
|
+
className,
|
|
45
|
+
classNames,
|
|
46
|
+
style,
|
|
47
|
+
children,
|
|
48
|
+
container,
|
|
49
|
+
onClose,
|
|
50
|
+
...props
|
|
51
|
+
}: Props) => react_jsx_runtime0.JSX.Element | null;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { Drawer };
|
|
54
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/components/organisms/Drawer/index.tsx"],"mappings":";;;UAkBU,KAAA;EACR,IAAA;EACA,QAAA,GAAW,KAAA,CAAM,SAAA;EACjB,KAAA,GAAQ,KAAA,CAAM,SAAA;EACd,MAAA,GAAS,KAAA,CAAM,SAAA;EACf,QAAA;EACA,SAAA,GAAY,KAAA,CAAM,SAAA;EAClB,SAAA;EACA,YAAA;EACA,SAAA;EACA,SAAA;EACA,OAAA;EACA,IAAA;EACA,SAAA;EACA,KAAA,GAAQ,KAAA,CAAM,aAAA;EACd,UAAA;IACE,IAAA;IACA,OAAA;IACA,SAAA;IACA,MAAA;IACA,KAAA;IACA,KAAA;IACA,IAAA;IACA,MAAA;EAAA;EAEF,SAAA,GAAY,WAAA;EACZ,OAAA;AAAA;AAAA,cAGI,MAAA;EAAU,IAAA;EAAA,KAAA;EAAA,MAAA;EAAA,QAAA;EAAA,SAAA;EAAA,SAAA;EAAA,YAAA;EAAA,SAAA;EAAA,SAAA;EAAA,OAAA;EAAA,IAAA;EAAA,SAAA;EAAA,UAAA;EAAA,KAAA;EAAA,QAAA;EAAA,SAAA;EAAA,OAAA;EAAA,GAAA;AAAA,GAmBb,KAAA,KAAK,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn, renderConditional } from "../../../utils.mjs";
|
|
4
|
+
import { drawer_exports } from "../../../core/drawer.mjs";
|
|
5
|
+
import "../../../core.mjs";
|
|
6
|
+
import { X } from "lucide-react";
|
|
7
|
+
import { useEffect } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/components/organisms/Drawer/index.tsx
|
|
11
|
+
const { DrawerContent, Drawer: DrawerCore, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle } = drawer_exports;
|
|
12
|
+
const Drawer = ({ open, title, footer, closable = true, closeIcon, direction = "bottom", maskClosable = true, handlebar = true, draggable = false, rounded = false, mask = true, className, classNames, style, children, container, onClose, ...props }) => {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!open) return;
|
|
15
|
+
if (!mask) {
|
|
16
|
+
const originalPointerEvents = document.body.style.pointerEvents;
|
|
17
|
+
const raf = window.requestAnimationFrame(() => {
|
|
18
|
+
document.body.style.pointerEvents = "auto";
|
|
19
|
+
});
|
|
20
|
+
return () => {
|
|
21
|
+
window.cancelAnimationFrame(raf);
|
|
22
|
+
document.body.style.pointerEvents = originalPointerEvents;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}, [open, mask]);
|
|
26
|
+
if (typeof window === "undefined") return null;
|
|
27
|
+
return /* @__PURE__ */ jsx(DrawerCore, {
|
|
28
|
+
open,
|
|
29
|
+
direction,
|
|
30
|
+
handleOnly: !draggable,
|
|
31
|
+
container,
|
|
32
|
+
onOpenChange: (open) => {
|
|
33
|
+
if (!open && maskClosable) onClose();
|
|
34
|
+
},
|
|
35
|
+
...props,
|
|
36
|
+
children: /* @__PURE__ */ jsxs(DrawerContent, {
|
|
37
|
+
className: cn("border-none outline-none", rounded ? "rounded-t-[30px]!" : "rounded-none!", classNames?.content, className),
|
|
38
|
+
handlebar,
|
|
39
|
+
mask,
|
|
40
|
+
classNames: {
|
|
41
|
+
mask: cn(classNames?.mask || ""),
|
|
42
|
+
handlebar: cn(classNames?.handlebar || "")
|
|
43
|
+
},
|
|
44
|
+
style,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsxs(DrawerHeader, {
|
|
47
|
+
className: cn(classNames?.header, !title && "p-0"),
|
|
48
|
+
children: [/* @__PURE__ */ jsxs(DrawerTitle, {
|
|
49
|
+
className: cn("flex justify-between", classNames?.title),
|
|
50
|
+
children: [/* @__PURE__ */ jsx("span", { children: title }), renderConditional(closable ? closeIcon || /* @__PURE__ */ jsx(X, {}) : null, (v) => /* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: cn("absolute top-3 right-5 cursor-pointer", classNames?.close),
|
|
52
|
+
onClick: onClose,
|
|
53
|
+
children: v
|
|
54
|
+
}))]
|
|
55
|
+
}), /* @__PURE__ */ jsx(DrawerDescription, { className: "hidden" })]
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx("div", {
|
|
58
|
+
className: cn("overflow-auto p-5", classNames?.body),
|
|
59
|
+
children
|
|
60
|
+
}),
|
|
61
|
+
renderConditional(footer, (v) => /* @__PURE__ */ jsx(DrawerFooter, {
|
|
62
|
+
className: cn(classNames?.footer),
|
|
63
|
+
children: v
|
|
64
|
+
}))
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { Drawer as default };
|
|
72
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["drawer"],"sources":["../../../../src/components/organisms/Drawer/index.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\nimport { X } from 'lucide-react';\n\nimport { drawer } from '@repo/ui/core';\nimport { cn, renderConditional } from '@repo/ui/utils';\n\nconst {\n DrawerContent,\n Drawer: DrawerCore,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n} = drawer;\n\ninterface Props {\n open: boolean;\n children?: React.ReactNode;\n title?: React.ReactNode;\n footer?: React.ReactNode;\n closable?: boolean;\n closeIcon?: React.ReactNode;\n direction?: 'top' | 'bottom' | 'left' | 'right';\n maskClosable?: boolean;\n handlebar?: boolean;\n draggable?: boolean;\n rounded?: boolean;\n mask?: boolean;\n className?: string;\n style?: React.CSSProperties;\n classNames?: {\n mask?: string;\n content?: string;\n handlebar?: string;\n header?: string;\n title?: string;\n close?: string;\n body?: string;\n footer?: string;\n };\n container?: HTMLElement;\n onClose: () => void;\n}\n\nconst Drawer = ({\n open,\n title,\n footer,\n closable = true,\n closeIcon,\n direction = 'bottom',\n maskClosable = true,\n handlebar = true,\n draggable = false,\n rounded = false,\n mask = true,\n className,\n classNames,\n style,\n children,\n container,\n onClose,\n ...props\n}: Props) => {\n useEffect(() => {\n if (!open) {\n return;\n }\n\n if (!mask) {\n const originalPointerEvents = document.body.style.pointerEvents;\n\n const raf = window.requestAnimationFrame(() => {\n document.body.style.pointerEvents = 'auto';\n });\n\n return () => {\n window.cancelAnimationFrame(raf);\n document.body.style.pointerEvents = originalPointerEvents;\n };\n }\n }, [open, mask]);\n\n if (typeof window === 'undefined') {\n return null;\n }\n\n return (\n <DrawerCore\n open={open}\n direction={direction}\n handleOnly={!draggable}\n container={container}\n onOpenChange={(open: boolean) => {\n if (!open && maskClosable) {\n onClose();\n }\n }}\n {...props}\n >\n <DrawerContent\n className={cn(\n 'border-none outline-none',\n rounded ? 'rounded-t-[30px]!' : 'rounded-none!',\n classNames?.content,\n className,\n //\n )}\n handlebar={handlebar}\n mask={mask}\n classNames={{\n mask: cn(\n classNames?.mask || '',\n //\n ),\n handlebar: cn(\n classNames?.handlebar || '',\n //\n ),\n }}\n style={style}\n >\n <DrawerHeader\n className={cn(\n classNames?.header,\n !title && 'p-0',\n //\n )}\n >\n <DrawerTitle\n className={cn(\n 'flex justify-between',\n classNames?.title,\n //\n )}\n >\n <span>{title}</span>\n {renderConditional(closable ? closeIcon || <X /> : null, v => (\n <span\n className={cn(\n 'absolute top-3 right-5 cursor-pointer',\n classNames?.close,\n //\n )}\n onClick={onClose}\n >\n {v}\n </span>\n ))}\n </DrawerTitle>\n <DrawerDescription className=\"hidden\" />\n </DrawerHeader>\n <div\n className={cn(\n 'overflow-auto p-5',\n classNames?.body,\n //\n )}\n >\n {children}\n </div>\n {renderConditional(footer, v => (\n <DrawerFooter className={cn(classNames?.footer)}>{v}</DrawerFooter>\n ))}\n </DrawerContent>\n </DrawerCore>\n );\n};\n\nexport default Drawer;\n"],"mappings":";;;;;;;;;;AASA,MAAM,EACJ,eACA,QAAQ,YACR,mBACA,cACA,cACA,gBACEA;AA+BJ,MAAM,UAAU,EACd,MACA,OACA,QACA,WAAW,MACX,WACA,YAAY,UACZ,eAAe,MACf,YAAY,MACZ,YAAY,OACZ,UAAU,OACV,OAAO,MACP,WACA,YACA,OACA,UACA,WACA,SACA,GAAG,YACQ;AACX,iBAAgB;AACd,MAAI,CAAC,KACH;AAGF,MAAI,CAAC,MAAM;GACT,MAAM,wBAAwB,SAAS,KAAK,MAAM;GAElD,MAAM,MAAM,OAAO,4BAA4B;AAC7C,aAAS,KAAK,MAAM,gBAAgB;KACpC;AAEF,gBAAa;AACX,WAAO,qBAAqB,IAAI;AAChC,aAAS,KAAK,MAAM,gBAAgB;;;IAGvC,CAAC,MAAM,KAAK,CAAC;AAEhB,KAAI,OAAO,WAAW,YACpB,QAAO;AAGT,QACE,oBAAC;EACO;EACK;EACX,YAAY,CAAC;EACF;EACX,eAAe,SAAkB;AAC/B,OAAI,CAAC,QAAQ,aACX,UAAS;;EAGb,GAAI;YAEJ,qBAAC;GACC,WAAW,GACT,4BACA,UAAU,sBAAsB,iBAChC,YAAY,SACZ,UAED;GACU;GACL;GACN,YAAY;IACV,MAAM,GACJ,YAAY,QAAQ,GAErB;IACD,WAAW,GACT,YAAY,aAAa,GAE1B;IACF;GACM;;IAEP,qBAAC;KACC,WAAW,GACT,YAAY,QACZ,CAAC,SAAS,MAEX;gBAED,qBAAC;MACC,WAAW,GACT,wBACA,YAAY,MAEb;iBAED,oBAAC,oBAAM,QAAa,EACnB,kBAAkB,WAAW,aAAa,oBAAC,MAAI,GAAG,OAAM,MACvD,oBAAC;OACC,WAAW,GACT,yCACA,YAAY,MAEb;OACD,SAAS;iBAER;QACI,CACP;OACU,EACd,oBAAC,qBAAkB,WAAU,WAAW;MAC3B;IACf,oBAAC;KACC,WAAW,GACT,qBACA,YAAY,KAEb;KAEA;MACG;IACL,kBAAkB,SAAQ,MACzB,oBAAC;KAAa,WAAW,GAAG,YAAY,OAAO;eAAG;MAAiB,CACnE;;IACY;GACL"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "../../../../utils.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/components/organisms/List/Item/index.tsx
|
|
5
|
+
const Item = ({ children, className, ...props }) => {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
className: cn(className),
|
|
8
|
+
...props,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Item as default };
|
|
15
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/organisms/List/Item/index.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nconst Item = ({\n children,\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'div'>) => {\n return (\n <div className={cn(className)} {...props}>\n {children}\n </div>\n );\n};\n\nexport default Item;\n"],"mappings":";;;;AAEA,MAAM,QAAQ,EACZ,UACA,WACA,GAAG,YACwC;AAC3C,QACE,oBAAC;EAAI,WAAW,GAAG,UAAU;EAAE,GAAI;EAChC;GACG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Skeleton } from "../../atoms/Skeleton/index.mjs";
|
|
2
|
+
import "../../../index.mjs";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/organisms/List/index.d.ts
|
|
7
|
+
interface Props<T> extends Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
loaderProps?: React.ComponentProps<typeof Skeleton>;
|
|
10
|
+
loader?: React.ReactNode;
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
header?: React.ReactNode;
|
|
13
|
+
empty?: React.ReactNode;
|
|
14
|
+
classNames?: {
|
|
15
|
+
title?: string;
|
|
16
|
+
header?: string;
|
|
17
|
+
body?: string;
|
|
18
|
+
};
|
|
19
|
+
scroll?: {
|
|
20
|
+
hasMore: boolean;
|
|
21
|
+
loading: boolean;
|
|
22
|
+
loader?: React.ReactNode;
|
|
23
|
+
options?: IntersectionObserverInit;
|
|
24
|
+
next: () => void;
|
|
25
|
+
};
|
|
26
|
+
data?: T[];
|
|
27
|
+
renderItem?: (item: T, index: number) => React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
declare const List: {
|
|
30
|
+
<T>({
|
|
31
|
+
loading,
|
|
32
|
+
loaderProps,
|
|
33
|
+
loader,
|
|
34
|
+
header,
|
|
35
|
+
title,
|
|
36
|
+
empty,
|
|
37
|
+
scroll,
|
|
38
|
+
data,
|
|
39
|
+
className,
|
|
40
|
+
classNames,
|
|
41
|
+
renderItem,
|
|
42
|
+
...props
|
|
43
|
+
}: Props<T>): string | number | bigint | true | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element;
|
|
44
|
+
Item: ({
|
|
45
|
+
children,
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
}: React.ComponentPropsWithoutRef<"div">) => react_jsx_runtime0.JSX.Element;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { List };
|
|
52
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/components/organisms/List/index.tsx"],"mappings":";;;;;;UAWU,KAAA,YAAiB,IAAA,CACzB,KAAA,CAAM,wBAAA;EAGN,OAAA;EACA,WAAA,GAAc,KAAA,CAAM,cAAA,QAAsB,QAAA;EAC1C,MAAA,GAAS,KAAA,CAAM,SAAA;EACf,KAAA,GAAQ,KAAA,CAAM,SAAA;EACd,MAAA,GAAS,KAAA,CAAM,SAAA;EACf,KAAA,GAAQ,KAAA,CAAM,SAAA;EACd,UAAA;IACE,KAAA;IACA,MAAA;IACA,IAAA;EAAA;EAEF,MAAA;IACE,OAAA;IACA,OAAA;IACA,MAAA,GAAS,KAAA,CAAM,SAAA;IACf,OAAA,GAAU,wBAAA;IACV,IAAA;EAAA;EAEF,IAAA,GAAO,CAAA;EACP,UAAA,IAAc,IAAA,EAAM,CAAA,EAAG,KAAA,aAAkB,KAAA,CAAM,SAAA;AAAA;AAAA,cAG3C,IAAA;EAAA;IAAS,OAAA;IAAA,WAAA;IAAA,MAAA;IAAA,MAAA;IAAA,KAAA;IAAA,KAAA;IAAA,MAAA;IAAA,IAAA;IAAA,SAAA;IAAA,UAAA;IAAA,UAAA;IAAA,GAAA;EAAA,GAaZ,KAAA,CAAM,CAAA,sCAAE,QAAA,CAAA,KAAA,CAAA,SAAA,IAAA,OAAA,sCAAA,KAAA,CAAA,WAAA,GAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,KAAA,CAAA,SAAA,wBAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn, renderConditional } from "../../../utils.mjs";
|
|
4
|
+
import Skeleton from "../../atoms/Skeleton/index.mjs";
|
|
5
|
+
import Item from "./Item/index.mjs";
|
|
6
|
+
import "../../../index.mjs";
|
|
7
|
+
import React, { useEffect } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useIntersectionObserver } from "@uidotdev/usehooks";
|
|
10
|
+
|
|
11
|
+
//#region src/components/organisms/List/index.tsx
|
|
12
|
+
const List = ({ loading, loaderProps, loader, header, title, empty, scroll, data, className, classNames, renderItem = () => null, ...props }) => {
|
|
13
|
+
const [loaderRef, entry] = useIntersectionObserver({
|
|
14
|
+
threshold: 0,
|
|
15
|
+
root: null,
|
|
16
|
+
rootMargin: "0px",
|
|
17
|
+
...scroll?.options
|
|
18
|
+
});
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!scroll) return;
|
|
21
|
+
if (entry?.isIntersecting && scroll.hasMore && !scroll.loading) scroll.next();
|
|
22
|
+
}, [entry, scroll]);
|
|
23
|
+
if (loading) return loader || /* @__PURE__ */ jsxs("div", {
|
|
24
|
+
className: cn(className),
|
|
25
|
+
...props,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: cn(classNames?.title),
|
|
29
|
+
children: title && /* @__PURE__ */ jsx(Skeleton, {})
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: cn(classNames?.header),
|
|
33
|
+
children: header && /* @__PURE__ */ jsx(Skeleton, { size: "small" })
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx("div", {
|
|
36
|
+
className: cn("space-y-2", classNames?.body),
|
|
37
|
+
children: /* @__PURE__ */ jsx(Skeleton.Node, {
|
|
38
|
+
count: 10,
|
|
39
|
+
gap: 10,
|
|
40
|
+
...loaderProps
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
});
|
|
45
|
+
if (!data?.length && empty) return empty;
|
|
46
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: cn(className),
|
|
48
|
+
...props,
|
|
49
|
+
children: [
|
|
50
|
+
renderConditional(title, (v) => /* @__PURE__ */ jsx("h2", {
|
|
51
|
+
className: cn("px-1.5 py-4", "text-black-90 text-lg leading-5.75 font-bold"),
|
|
52
|
+
children: v
|
|
53
|
+
})),
|
|
54
|
+
/* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: cn(classNames?.header),
|
|
56
|
+
children: header
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: cn("space-y-2", classNames?.body),
|
|
60
|
+
children: [
|
|
61
|
+
data?.map((item, i) => renderItem(item, i)),
|
|
62
|
+
scroll?.loading && (scroll?.loader ?? /* @__PURE__ */ jsx(Skeleton.Node, {
|
|
63
|
+
count: 10,
|
|
64
|
+
gap: 10,
|
|
65
|
+
...loaderProps
|
|
66
|
+
})),
|
|
67
|
+
/* @__PURE__ */ jsx("div", { ref: loaderRef })
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
List.Item = Item;
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { List as default };
|
|
77
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/organisms/List/index.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect } from 'react';\n\nimport { useIntersectionObserver } from '@uidotdev/usehooks';\n\nimport { Skeleton } from '@repo/ui';\nimport { cn, renderConditional } from '@repo/ui/utils';\n\nimport Item from './Item';\n\ninterface Props<T> extends Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'title'\n> {\n loading?: boolean;\n loaderProps?: React.ComponentProps<typeof Skeleton>;\n loader?: React.ReactNode;\n title?: React.ReactNode;\n header?: React.ReactNode;\n empty?: React.ReactNode;\n classNames?: {\n title?: string;\n header?: string;\n body?: string;\n };\n scroll?: {\n hasMore: boolean;\n loading: boolean;\n loader?: React.ReactNode;\n options?: IntersectionObserverInit;\n next: () => void;\n };\n data?: T[];\n renderItem?: (item: T, index: number) => React.ReactNode;\n}\n\nconst List = <T,>({\n loading,\n loaderProps,\n loader,\n header,\n title,\n empty,\n scroll,\n data,\n className,\n classNames,\n renderItem = () => null,\n ...props\n}: Props<T>) => {\n const [loaderRef, entry] = useIntersectionObserver({\n threshold: 0,\n root: null,\n rootMargin: '0px',\n ...scroll?.options,\n });\n\n useEffect(() => {\n if (!scroll) {\n return;\n }\n\n if (entry?.isIntersecting && scroll.hasMore && !scroll.loading) {\n scroll.next();\n }\n }, [entry, scroll]);\n\n if (loading) {\n return (\n loader || (\n <div className={cn(className)} {...props}>\n <div className={cn(classNames?.title)}>{title && <Skeleton />}</div>\n <div className={cn(classNames?.header)}>\n {header && <Skeleton size=\"small\" />}\n </div>\n <div className={cn('space-y-2', classNames?.body)}>\n <Skeleton.Node count={10} gap={10} {...loaderProps} />\n </div>\n </div>\n )\n );\n }\n\n if (!data?.length && empty) {\n return empty;\n }\n\n return (\n <div\n className={cn(\n className,\n //\n )}\n {...props}\n >\n {renderConditional(title, v => (\n <h2\n className={cn(\n 'px-1.5 py-4',\n 'text-black-90 text-lg leading-5.75 font-bold',\n //\n )}\n >\n {v}\n </h2>\n ))}\n <div className={cn(classNames?.header)}>{header}</div>\n <div className={cn('space-y-2', classNames?.body)}>\n {data?.map((item, i) => renderItem(item, i))}\n {scroll?.loading &&\n (scroll?.loader ?? (\n <Skeleton.Node count={10} gap={10} {...loaderProps} />\n ))}\n <div ref={loaderRef} />\n </div>\n </div>\n );\n};\n\nList.Item = Item;\n\nexport default List;\n"],"mappings":";;;;;;;;;;;AAqCA,MAAM,QAAY,EAChB,SACA,aACA,QACA,QACA,OACA,OACA,QACA,MACA,WACA,YACA,mBAAmB,MACnB,GAAG,YACW;CACd,MAAM,CAAC,WAAW,SAAS,wBAAwB;EACjD,WAAW;EACX,MAAM;EACN,YAAY;EACZ,GAAG,QAAQ;EACZ,CAAC;AAEF,iBAAgB;AACd,MAAI,CAAC,OACH;AAGF,MAAI,OAAO,kBAAkB,OAAO,WAAW,CAAC,OAAO,QACrD,QAAO,MAAM;IAEd,CAAC,OAAO,OAAO,CAAC;AAEnB,KAAI,QACF,QACE,UACE,qBAAC;EAAI,WAAW,GAAG,UAAU;EAAE,GAAI;;GACjC,oBAAC;IAAI,WAAW,GAAG,YAAY,MAAM;cAAG,SAAS,oBAAC,aAAW;KAAO;GACpE,oBAAC;IAAI,WAAW,GAAG,YAAY,OAAO;cACnC,UAAU,oBAAC,YAAS,MAAK,UAAU;KAChC;GACN,oBAAC;IAAI,WAAW,GAAG,aAAa,YAAY,KAAK;cAC/C,oBAAC,SAAS;KAAK,OAAO;KAAI,KAAK;KAAI,GAAI;MAAe;KAClD;;GACF;AAKZ,KAAI,CAAC,MAAM,UAAU,MACnB,QAAO;AAGT,QACE,qBAAC;EACC,WAAW,GACT,UAED;EACD,GAAI;;GAEH,kBAAkB,QAAO,MACxB,oBAAC;IACC,WAAW,GACT,eACA,+CAED;cAEA;KACE,CACL;GACF,oBAAC;IAAI,WAAW,GAAG,YAAY,OAAO;cAAG;KAAa;GACtD,qBAAC;IAAI,WAAW,GAAG,aAAa,YAAY,KAAK;;KAC9C,MAAM,KAAK,MAAM,MAAM,WAAW,MAAM,EAAE,CAAC;KAC3C,QAAQ,YACN,QAAQ,UACP,oBAAC,SAAS;MAAK,OAAO;MAAI,KAAK;MAAI,GAAI;OAAe;KAE1D,oBAAC,SAAI,KAAK,YAAa;;KACnB;;GACF;;AAIV,KAAK,OAAO"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/components/organisms/Modal/index.d.ts
|
|
5
|
+
interface Props {
|
|
6
|
+
open?: boolean;
|
|
7
|
+
maskClosable?: boolean;
|
|
8
|
+
closable?: boolean | {
|
|
9
|
+
closeIcon?: React.ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
closeIcon?: React.ReactNode;
|
|
13
|
+
title?: React.ReactNode;
|
|
14
|
+
content?: React.ReactNode;
|
|
15
|
+
footer?: React.ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
classNames?: {
|
|
18
|
+
mask?: string;
|
|
19
|
+
header?: string;
|
|
20
|
+
body?: string;
|
|
21
|
+
footer?: string;
|
|
22
|
+
};
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
okText?: string;
|
|
25
|
+
cancelText?: string;
|
|
26
|
+
container?: HTMLElement;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
onOk?: () => void;
|
|
29
|
+
onCancel?: () => void;
|
|
30
|
+
}
|
|
31
|
+
interface StaticProps extends Props {
|
|
32
|
+
type?: 'info' | 'success' | 'error' | 'warning' | 'confirm';
|
|
33
|
+
id?: string;
|
|
34
|
+
icon?: React.ReactNode;
|
|
35
|
+
container?: HTMLElement;
|
|
36
|
+
}
|
|
37
|
+
declare const Modal: {
|
|
38
|
+
({
|
|
39
|
+
open,
|
|
40
|
+
maskClosable,
|
|
41
|
+
closable,
|
|
42
|
+
closeIcon,
|
|
43
|
+
className,
|
|
44
|
+
classNames,
|
|
45
|
+
style,
|
|
46
|
+
title,
|
|
47
|
+
footer,
|
|
48
|
+
container,
|
|
49
|
+
children,
|
|
50
|
+
okText,
|
|
51
|
+
cancelText,
|
|
52
|
+
onOk,
|
|
53
|
+
onCancel,
|
|
54
|
+
...props
|
|
55
|
+
}: Props): react_jsx_runtime0.JSX.Element | null;
|
|
56
|
+
destroy(id?: string): void;
|
|
57
|
+
destroyAll(): void;
|
|
58
|
+
info(props: StaticProps): string | undefined;
|
|
59
|
+
success(props: StaticProps): string | undefined;
|
|
60
|
+
error(props: StaticProps): string | undefined;
|
|
61
|
+
warning(props: StaticProps): string | undefined;
|
|
62
|
+
confirm(props: StaticProps): string | undefined;
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Modal };
|
|
66
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/components/organisms/Modal/index.tsx"],"mappings":";;;;UA4BU,KAAA;EACR,IAAA;EACA,YAAA;EACA,QAAA;IAGM,SAAA,GAAY,KAAA,CAAM,SAAA;IAClB,QAAA;EAAA;EAEN,SAAA,GAAY,KAAA,CAAM,SAAA;EAClB,KAAA,GAAQ,KAAA,CAAM,SAAA;EACd,OAAA,GAAU,KAAA,CAAM,SAAA;EAChB,MAAA,GAAS,KAAA,CAAM,SAAA;EACf,SAAA;EACA,UAAA;IACE,IAAA;IACA,MAAA;IACA,IAAA;IACA,MAAA;EAAA;EAEF,KAAA,GAAQ,KAAA,CAAM,aAAA;EACd,MAAA;EACA,UAAA;EACA,SAAA,GAAY,WAAA;EACZ,QAAA,GAAW,KAAA,CAAM,SAAA;EACjB,IAAA;EACA,QAAA;AAAA;AAAA,UAGQ,WAAA,SAAoB,KAAA;EAC5B,IAAA;EACA,EAAA;EACA,IAAA,GAAO,KAAA,CAAM,SAAA;EACb,SAAA,GAAY,WAAA;AAAA;AAAA,cAiCR,KAAA;EAAA;;;;;;;;;;;;;;;;;KAiBH,KAAA,GAAK,kBAAA,CAAA,GAAA,CAAA,OAAA;;;cA+Na,WAAA;iBACG,WAAA;eAEF,WAAA;iBACE,WAAA;iBAEA,WAAA;AAAA"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../../utils.mjs";
|
|
4
|
+
import { dialog_exports } from "../../../core/dialog.mjs";
|
|
5
|
+
import "../../../core.mjs";
|
|
6
|
+
import Button from "../../atoms/Button/index.mjs";
|
|
7
|
+
import "../../../index.mjs";
|
|
8
|
+
import { Check, CircleQuestionMark, Info, OctagonAlert, OctagonX } from "lucide-react";
|
|
9
|
+
import React, { useEffect, useState } from "react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { createPortal } from "react-dom";
|
|
12
|
+
import { createRoot } from "react-dom/client";
|
|
13
|
+
import { v4 } from "uuid";
|
|
14
|
+
|
|
15
|
+
//#region src/components/organisms/Modal/index.tsx
|
|
16
|
+
const { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } = dialog_exports;
|
|
17
|
+
const isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
18
|
+
let modalRoot = null;
|
|
19
|
+
let modalStack = [];
|
|
20
|
+
let updateStack = null;
|
|
21
|
+
const createModalRoot = (container) => {
|
|
22
|
+
if (!isBrowser) return null;
|
|
23
|
+
const targetContainer = container || document.body;
|
|
24
|
+
let rootEl = targetContainer.querySelector("#modal-root");
|
|
25
|
+
if (!rootEl) {
|
|
26
|
+
rootEl = document.createElement("div");
|
|
27
|
+
rootEl.setAttribute("id", "modal-root");
|
|
28
|
+
rootEl.setAttribute("role", "dialog");
|
|
29
|
+
rootEl.setAttribute("aria-modal", "true");
|
|
30
|
+
rootEl.style.zIndex = "10000";
|
|
31
|
+
rootEl.style.position = "absolute";
|
|
32
|
+
targetContainer.appendChild(rootEl);
|
|
33
|
+
}
|
|
34
|
+
return rootEl;
|
|
35
|
+
};
|
|
36
|
+
const Modal = ({ open = false, maskClosable = false, closable = false, closeIcon, className, classNames, style, title, footer, container, children, okText = "OK", cancelText = "Cancel", onOk, onCancel, ...props }) => {
|
|
37
|
+
if (typeof window === "undefined") return null;
|
|
38
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
39
|
+
open,
|
|
40
|
+
onOpenChange: (open) => {
|
|
41
|
+
if (!open && maskClosable) onCancel?.();
|
|
42
|
+
},
|
|
43
|
+
...props,
|
|
44
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
45
|
+
className: cn("rounded-lg p-4 max-sm:max-w-[80%]", "border-none outline-none", className),
|
|
46
|
+
classNames: {
|
|
47
|
+
...classNames,
|
|
48
|
+
mask: cn("bg-black/60", classNames?.mask)
|
|
49
|
+
},
|
|
50
|
+
style,
|
|
51
|
+
showCloseButton: !!closable,
|
|
52
|
+
closeIcon,
|
|
53
|
+
container,
|
|
54
|
+
onCancel,
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsxs(DialogHeader, {
|
|
57
|
+
className: cn(classNames?.header, !title && "hidden"),
|
|
58
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { className: "hidden" })]
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ jsx("div", {
|
|
61
|
+
className: cn("break-all", classNames?.body),
|
|
62
|
+
children
|
|
63
|
+
}),
|
|
64
|
+
footer !== null && /* @__PURE__ */ jsx(DialogFooter, {
|
|
65
|
+
className: cn("flex-row justify-end gap-x-2", classNames?.footer),
|
|
66
|
+
children: footer || /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
|
|
67
|
+
onClick: onOk,
|
|
68
|
+
children: okText
|
|
69
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
70
|
+
variant: "outlined",
|
|
71
|
+
onClick: onCancel,
|
|
72
|
+
children: cancelText
|
|
73
|
+
})] })
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const STATIC_ICONS = {
|
|
80
|
+
info: /* @__PURE__ */ jsx(Info, { className: "text-blue-400" }),
|
|
81
|
+
success: /* @__PURE__ */ jsx(Check, { className: "text-green-400" }),
|
|
82
|
+
error: /* @__PURE__ */ jsx(OctagonX, { className: "text-red-400" }),
|
|
83
|
+
warning: /* @__PURE__ */ jsx(OctagonAlert, { className: "text-yellow-400" }),
|
|
84
|
+
confirm: /* @__PURE__ */ jsx(CircleQuestionMark, {})
|
|
85
|
+
};
|
|
86
|
+
const StaticModal = ({ type, title, content, okText = "OK", cancelText = "Cancel", id, container, icon, onOk, onCancel, ...props }) => {
|
|
87
|
+
const [open, setOpen] = useState(true);
|
|
88
|
+
const closeModal = (callback) => {
|
|
89
|
+
callback?.();
|
|
90
|
+
setOpen(false);
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
Modal.destroy(id);
|
|
93
|
+
}, 200);
|
|
94
|
+
};
|
|
95
|
+
const footer = type === "confirm" ? /* @__PURE__ */ jsxs("div", {
|
|
96
|
+
className: "grid w-full grid-cols-5 gap-x-2",
|
|
97
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
98
|
+
variant: "outlined",
|
|
99
|
+
className: "col-span-2",
|
|
100
|
+
onClick: () => closeModal(onCancel),
|
|
101
|
+
children: cancelText
|
|
102
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
103
|
+
className: "col-span-3",
|
|
104
|
+
onClick: () => closeModal(onOk),
|
|
105
|
+
children: okText
|
|
106
|
+
})]
|
|
107
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
108
|
+
className: cn("grow"),
|
|
109
|
+
onClick: () => closeModal(onOk),
|
|
110
|
+
children: okText
|
|
111
|
+
});
|
|
112
|
+
if (!isBrowser) return null;
|
|
113
|
+
return createPortal(/* @__PURE__ */ jsx(Modal, {
|
|
114
|
+
open,
|
|
115
|
+
footer,
|
|
116
|
+
className: cn("z-10000", "box-content w-100", "rounded-3xl p-4", "gap-y-0"),
|
|
117
|
+
classNames: {
|
|
118
|
+
mask: "z-10000 bg-black/[.6]",
|
|
119
|
+
body: cn("text-black-70 whitespace-pre-wrap text-center", content && "mt-3"),
|
|
120
|
+
footer: "mt-9"
|
|
121
|
+
},
|
|
122
|
+
title: /* @__PURE__ */ jsxs("p", {
|
|
123
|
+
className: cn("text-center text-lg leading-normal whitespace-pre-wrap", "flex items-center justify-center gap-x-2"),
|
|
124
|
+
children: [icon || type && STATIC_ICONS[type], title]
|
|
125
|
+
}),
|
|
126
|
+
container,
|
|
127
|
+
onCancel: () => closeModal(onOk),
|
|
128
|
+
...props,
|
|
129
|
+
children: content
|
|
130
|
+
}), createModalRoot(container));
|
|
131
|
+
};
|
|
132
|
+
const ModalStackRenderer = () => {
|
|
133
|
+
const [, forceUpdate] = useState({});
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
updateStack = () => forceUpdate({});
|
|
136
|
+
return () => {
|
|
137
|
+
updateStack = null;
|
|
138
|
+
};
|
|
139
|
+
}, []);
|
|
140
|
+
return /* @__PURE__ */ jsx(Fragment, { children: modalStack.map(({ id, ...props }) => /* @__PURE__ */ jsx(StaticModal, {
|
|
141
|
+
id,
|
|
142
|
+
...props
|
|
143
|
+
}, id)) });
|
|
144
|
+
};
|
|
145
|
+
const modalRoots = /* @__PURE__ */ new Map();
|
|
146
|
+
const renderModal = (props) => {
|
|
147
|
+
if (!isBrowser) return;
|
|
148
|
+
const targetContainer = props.container || document.body;
|
|
149
|
+
const rootElement = createModalRoot(targetContainer);
|
|
150
|
+
if (!modalRoots.has(targetContainer)) {
|
|
151
|
+
const root = createRoot(rootElement);
|
|
152
|
+
modalRoots.set(targetContainer, root);
|
|
153
|
+
root.render(/* @__PURE__ */ jsx(ModalStackRenderer, {}));
|
|
154
|
+
}
|
|
155
|
+
const id = props.id || v4();
|
|
156
|
+
modalStack.push({
|
|
157
|
+
...props,
|
|
158
|
+
id
|
|
159
|
+
});
|
|
160
|
+
updateStack?.();
|
|
161
|
+
return id;
|
|
162
|
+
};
|
|
163
|
+
Modal.destroy = (id) => {
|
|
164
|
+
modalStack = id ? modalStack.filter((modal) => modal.id !== id) : [];
|
|
165
|
+
updateStack?.();
|
|
166
|
+
if (!modalStack.length && modalRoot) {
|
|
167
|
+
modalRoot.unmount();
|
|
168
|
+
modalRoot = null;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
Modal.destroyAll = () => {
|
|
172
|
+
Modal.destroy();
|
|
173
|
+
};
|
|
174
|
+
Modal.info = (props) => renderModal({
|
|
175
|
+
type: "info",
|
|
176
|
+
...props
|
|
177
|
+
});
|
|
178
|
+
Modal.success = (props) => renderModal({
|
|
179
|
+
type: "success",
|
|
180
|
+
...props
|
|
181
|
+
});
|
|
182
|
+
Modal.error = (props) => renderModal({
|
|
183
|
+
type: "error",
|
|
184
|
+
...props
|
|
185
|
+
});
|
|
186
|
+
Modal.warning = (props) => renderModal({
|
|
187
|
+
type: "warning",
|
|
188
|
+
...props
|
|
189
|
+
});
|
|
190
|
+
Modal.confirm = (props) => renderModal({
|
|
191
|
+
type: "confirm",
|
|
192
|
+
...props
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
//#endregion
|
|
196
|
+
export { Modal as default };
|
|
197
|
+
//# sourceMappingURL=index.mjs.map
|