@bioturing/components 0.29.1 → 0.30.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/components/choice-list/component.js +132 -105
- package/dist/components/choice-list/component.js.map +1 -1
- package/dist/components/code-block/component.js +8 -8
- package/dist/components/dropdown-menu/component.js +28 -26
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/item.js +52 -49
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/hooks/antd.js +9 -11
- package/dist/components/hooks/antd.js.map +1 -1
- package/dist/components/hooks/useBreakpoint.js +50 -0
- package/dist/components/hooks/useBreakpoint.js.map +1 -0
- package/dist/components/hooks/useResizeObserver.js +52 -0
- package/dist/components/hooks/useResizeObserver.js.map +1 -0
- package/dist/components/hooks/useWindowSize.js +23 -0
- package/dist/components/hooks/useWindowSize.js.map +1 -0
- package/dist/components/modal/index.js.map +1 -1
- package/dist/components/resizable/component.js +108 -90
- package/dist/components/resizable/component.js.map +1 -1
- package/dist/components/toast/component.js +13 -13
- package/dist/components/toast/component.js.map +1 -1
- package/dist/index.d.ts +90 -10
- package/dist/index.js +132 -125
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { Command as
|
|
5
|
-
import { Menu as
|
|
2
|
+
import { jsxs as I, Fragment as x, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as h } from "react";
|
|
4
|
+
import { Command as j } from "../cmdk/index.js";
|
|
5
|
+
import { Menu as E } from "@base-ui-components/react/menu";
|
|
6
6
|
import './item.css';/* empty css */
|
|
7
|
-
import { Checkbox as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
7
|
+
import { Checkbox as w } from "antd";
|
|
8
|
+
import { reactNodeToString as L } from "../utils/reactToString.js";
|
|
9
|
+
import { useCls as D } from "../utils/antdUtils.js";
|
|
10
|
+
import { clsx as t } from "../utils/cn.js";
|
|
11
|
+
const J = ({
|
|
11
12
|
item: o,
|
|
12
13
|
inCombobox: u = !1,
|
|
13
|
-
selected:
|
|
14
|
-
itemRender:
|
|
15
|
-
itemProps:
|
|
14
|
+
selected: f = !1,
|
|
15
|
+
itemRender: p,
|
|
16
|
+
itemProps: y = {},
|
|
16
17
|
classNames: n,
|
|
17
|
-
onSelect:
|
|
18
|
-
showCheckbox:
|
|
19
|
-
indeterminate:
|
|
20
|
-
renderAsNativeElement: O
|
|
18
|
+
onSelect: k,
|
|
19
|
+
showCheckbox: M,
|
|
20
|
+
indeterminate: e,
|
|
21
|
+
renderAsNativeElement: O,
|
|
22
|
+
getItemKeywords: g
|
|
21
23
|
}) => {
|
|
22
|
-
const d =
|
|
23
|
-
() => u ?
|
|
24
|
+
const d = D(), T = h(
|
|
25
|
+
() => u ? j.Item : E.Item,
|
|
24
26
|
[u]
|
|
25
|
-
),
|
|
26
|
-
className:
|
|
27
|
+
), i = h(() => ({
|
|
28
|
+
className: t(
|
|
27
29
|
d("dropdown-menu-item", u && "dropdown-menu-item-combobox"),
|
|
28
30
|
n == null ? void 0 : n.item,
|
|
29
31
|
o.className
|
|
30
32
|
),
|
|
31
33
|
disabled: o.disabled,
|
|
32
34
|
"data-danger": o.danger,
|
|
33
|
-
"data-actual-selected":
|
|
35
|
+
"data-actual-selected": f,
|
|
34
36
|
ref: o.ref,
|
|
35
37
|
onClick: o.onClick,
|
|
36
38
|
onMouseEnter: o.onMouseEnter,
|
|
@@ -38,20 +40,20 @@ const C = ({
|
|
|
38
40
|
onMouseOver: o.onMouseOver,
|
|
39
41
|
onMouseOut: o.onMouseOut,
|
|
40
42
|
"data-value": typeof o.label == "string" ? o.label : String(o.key),
|
|
41
|
-
render:
|
|
42
|
-
children: u ? /* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
render: p ? (b) => p(o, b) : void 0,
|
|
44
|
+
children: u ? /* @__PURE__ */ I(x, { children: [
|
|
45
|
+
M && /* @__PURE__ */ r(
|
|
46
|
+
w,
|
|
45
47
|
{
|
|
46
|
-
checked:
|
|
48
|
+
checked: f,
|
|
47
49
|
tabIndex: -1,
|
|
48
|
-
indeterminate:
|
|
50
|
+
indeterminate: e
|
|
49
51
|
}
|
|
50
52
|
),
|
|
51
53
|
o.icon && /* @__PURE__ */ r(
|
|
52
54
|
"span",
|
|
53
55
|
{
|
|
54
|
-
className:
|
|
56
|
+
className: t(
|
|
55
57
|
d("dropdown-menu-item-icon"),
|
|
56
58
|
n == null ? void 0 : n.itemIcon
|
|
57
59
|
),
|
|
@@ -61,26 +63,26 @@ const C = ({
|
|
|
61
63
|
/* @__PURE__ */ r(
|
|
62
64
|
"span",
|
|
63
65
|
{
|
|
64
|
-
className:
|
|
66
|
+
className: t(
|
|
65
67
|
d("dropdown-menu-item-text"),
|
|
66
68
|
n == null ? void 0 : n.itemText
|
|
67
69
|
),
|
|
68
70
|
children: o.label
|
|
69
71
|
}
|
|
70
72
|
)
|
|
71
|
-
] }) : /* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
] }) : /* @__PURE__ */ I(x, { children: [
|
|
74
|
+
M && /* @__PURE__ */ r(
|
|
75
|
+
w,
|
|
74
76
|
{
|
|
75
|
-
checked:
|
|
77
|
+
checked: f,
|
|
76
78
|
tabIndex: -1,
|
|
77
|
-
indeterminate:
|
|
79
|
+
indeterminate: e
|
|
78
80
|
}
|
|
79
81
|
),
|
|
80
82
|
o.icon && /* @__PURE__ */ r(
|
|
81
83
|
"span",
|
|
82
84
|
{
|
|
83
|
-
className:
|
|
85
|
+
className: t(
|
|
84
86
|
d("dropdown-menu-item-icon"),
|
|
85
87
|
n == null ? void 0 : n.itemIcon
|
|
86
88
|
),
|
|
@@ -90,7 +92,7 @@ const C = ({
|
|
|
90
92
|
/* @__PURE__ */ r(
|
|
91
93
|
"span",
|
|
92
94
|
{
|
|
93
|
-
className:
|
|
95
|
+
className: t(
|
|
94
96
|
d("dropdown-menu-item-text"),
|
|
95
97
|
n == null ? void 0 : n.itemText
|
|
96
98
|
),
|
|
@@ -104,28 +106,29 @@ const C = ({
|
|
|
104
106
|
n == null ? void 0 : n.itemText,
|
|
105
107
|
d,
|
|
106
108
|
u,
|
|
107
|
-
|
|
109
|
+
e,
|
|
108
110
|
o,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
p,
|
|
112
|
+
f,
|
|
113
|
+
M
|
|
112
114
|
]);
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
115
|
-
...
|
|
116
|
-
...
|
|
115
|
+
if (p)
|
|
116
|
+
return p(o, {
|
|
117
|
+
...i,
|
|
118
|
+
...y
|
|
117
119
|
});
|
|
118
|
-
const { render: v, ...
|
|
119
|
-
return O ? v ? v(
|
|
120
|
-
|
|
120
|
+
const { render: v, ...S } = i;
|
|
121
|
+
return O ? v ? v(i) : /* @__PURE__ */ r("div", { onClick: k, ...S }) : /* @__PURE__ */ r(
|
|
122
|
+
T,
|
|
121
123
|
{
|
|
122
124
|
value: String(o.key),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
keywords: g ? g(o) : [String(o.key), L(o.label)],
|
|
126
|
+
onSelect: k,
|
|
127
|
+
...i
|
|
125
128
|
}
|
|
126
129
|
);
|
|
127
130
|
};
|
|
128
131
|
export {
|
|
129
|
-
|
|
132
|
+
J as DropdownMenuItem
|
|
130
133
|
};
|
|
131
134
|
//# sourceMappingURL=item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sources":["../../../src/components/dropdown-menu/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { Ref, useMemo } from \"react\";\nimport { clsx, useCls } from \"../utils\";\nimport type { DropdownMenuItemType } from \"./component\";\nimport { Command } from \"../cmdk\";\nimport { Menu } from \"@base-ui-components/react/menu\";\n\nimport \"./item.css\";\nimport { Checkbox } from \"antd\";\n\nexport interface DropdownMenuItemProps {\n /** The menu item data */\n item: DropdownMenuItemType & { type: \"item\" };\n /** Custom render function for the item */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /** Additional props to pass to the item */\n itemProps?: React.HTMLAttributes<HTMLElement>;\n /** Class names from parent DropdownMenu */\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemText?: string;\n };\n onSelect?: () => void;\n /**\n * Whether the menu item is in a combobox\n */\n inCombobox?: boolean;\n /**\n * Whether the menu item is in a menu\n */\n renderAsNativeElement?: boolean;\n /**\n * Whether the menu item is selected (for combobox)\n * @default false\n */\n selected?: boolean;\n /**\n * Whether to show checkbox (only for decoration purpose)\n */\n showCheckbox?: boolean;\n /**\n * Whether the menu item checkbox is indeterminate (for combobox)\n * @default false\n */\n indeterminate?: boolean;\n}\n\nexport const DropdownMenuItem: React.FC<DropdownMenuItemProps> = ({\n item,\n inCombobox = false,\n selected = false,\n itemRender,\n itemProps = {},\n classNames,\n onSelect,\n showCheckbox,\n indeterminate,\n renderAsNativeElement,\n}) => {\n const cls = useCls();\n\n const MenuItem = useMemo(\n () => (inCombobox ? Command.Item : Menu.Item),\n [inCombobox]\n );\n\n const props = useMemo(() => {\n return {\n className: clsx(\n cls(\"dropdown-menu-item\", inCombobox && \"dropdown-menu-item-combobox\"),\n classNames?.item,\n item.className\n ),\n disabled: item.disabled,\n \"data-danger\": item.danger,\n \"data-actual-selected\": selected,\n ref: item.ref as Ref<HTMLDivElement>,\n onClick: item.onClick,\n onMouseEnter: item.onMouseEnter,\n onMouseLeave: item.onMouseLeave,\n onMouseOver: item.onMouseOver,\n onMouseOut: item.onMouseOut,\n \"data-value\":\n typeof item.label === \"string\" ? item.label : String(item.key),\n render: itemRender\n ? (itemProps: React.HTMLAttributes<HTMLElement>) =>\n itemRender(item, itemProps)\n : undefined,\n children: inCombobox ? (\n <>\n {showCheckbox && (\n <Checkbox\n checked={selected}\n tabIndex={-1}\n indeterminate={indeterminate}\n />\n )}\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n )}\n <span\n className={clsx(\n cls(\"dropdown-menu-item-text\"),\n classNames?.itemText\n )}\n >\n {item.label}\n </span>\n </>\n ) : (\n <>\n {showCheckbox && (\n <Checkbox\n checked={selected}\n tabIndex={-1}\n indeterminate={indeterminate}\n />\n )}\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n )}\n <span\n className={clsx(\n cls(\"dropdown-menu-item-text\"),\n classNames?.itemText\n )}\n >\n {item.label}\n </span>\n </>\n ),\n };\n }, [\n classNames?.item,\n classNames?.itemIcon,\n classNames?.itemText,\n cls,\n inCombobox,\n indeterminate,\n item,\n itemRender,\n selected,\n showCheckbox,\n ]);\n // If custom render function is provided, use it\n if (itemRender) {\n return itemRender(item, {\n ...props,\n ...itemProps,\n });\n }\n const { render, ...restProps } = props;\n // Default rendering\n return renderAsNativeElement ? (\n render ? (\n render(props)\n ) : (\n <div onClick={onSelect} {...restProps} />\n )\n ) : (\n <MenuItem\n value={String(item.key)}\n onSelect={onSelect}\n {...props}\n ></MenuItem>\n );\n};\n"],"names":["DropdownMenuItem","item","inCombobox","selected","itemRender","itemProps","classNames","onSelect","showCheckbox","indeterminate","renderAsNativeElement","cls","useCls","MenuItem","useMemo","Command","Menu","props","clsx","jsxs","Fragment","jsx","Checkbox","render","restProps"],"mappings":"
|
|
1
|
+
{"version":3,"file":"item.js","sources":["../../../src/components/dropdown-menu/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { Ref, useMemo } from \"react\";\nimport { clsx, reactNodeToString, useCls } from \"../utils\";\nimport type { DropdownMenuItemType } from \"./component\";\nimport { Command } from \"../cmdk\";\nimport { Menu } from \"@base-ui-components/react/menu\";\n\nimport \"./item.css\";\nimport { Checkbox } from \"antd\";\n\nexport interface DropdownMenuItemProps {\n /** The menu item data */\n item: DropdownMenuItemType & { type: \"item\" };\n /** Custom render function for the item */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /** Additional props to pass to the item */\n itemProps?: React.HTMLAttributes<HTMLElement>;\n /** Class names from parent DropdownMenu */\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemText?: string;\n };\n onSelect?: () => void;\n /**\n * Whether the menu item is in a combobox\n */\n inCombobox?: boolean;\n /**\n * Whether the menu item is in a menu\n */\n renderAsNativeElement?: boolean;\n /**\n * Whether the menu item is selected (for combobox)\n * @default false\n */\n selected?: boolean;\n /**\n * Whether to show checkbox (only for decoration purpose)\n */\n showCheckbox?: boolean;\n /**\n * Whether the menu item checkbox is indeterminate (for combobox)\n * @default false\n */\n indeterminate?: boolean;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [String(item.key), reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: DropdownMenuItemType & { type: \"item\" }) => string[];\n}\n\nexport const DropdownMenuItem: React.FC<DropdownMenuItemProps> = ({\n item,\n inCombobox = false,\n selected = false,\n itemRender,\n itemProps = {},\n classNames,\n onSelect,\n showCheckbox,\n indeterminate,\n renderAsNativeElement,\n getItemKeywords,\n}) => {\n const cls = useCls();\n\n const MenuItem = useMemo(\n () => (inCombobox ? Command.Item : Menu.Item),\n [inCombobox]\n );\n\n const props = useMemo(() => {\n return {\n className: clsx(\n cls(\"dropdown-menu-item\", inCombobox && \"dropdown-menu-item-combobox\"),\n classNames?.item,\n item.className\n ),\n disabled: item.disabled,\n \"data-danger\": item.danger,\n \"data-actual-selected\": selected,\n ref: item.ref as Ref<HTMLDivElement>,\n onClick: item.onClick,\n onMouseEnter: item.onMouseEnter,\n onMouseLeave: item.onMouseLeave,\n onMouseOver: item.onMouseOver,\n onMouseOut: item.onMouseOut,\n \"data-value\":\n typeof item.label === \"string\" ? item.label : String(item.key),\n render: itemRender\n ? (itemProps: React.HTMLAttributes<HTMLElement>) =>\n itemRender(item, itemProps)\n : undefined,\n children: inCombobox ? (\n <>\n {showCheckbox && (\n <Checkbox\n checked={selected}\n tabIndex={-1}\n indeterminate={indeterminate}\n />\n )}\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n )}\n <span\n className={clsx(\n cls(\"dropdown-menu-item-text\"),\n classNames?.itemText\n )}\n >\n {item.label}\n </span>\n </>\n ) : (\n <>\n {showCheckbox && (\n <Checkbox\n checked={selected}\n tabIndex={-1}\n indeterminate={indeterminate}\n />\n )}\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n )}\n <span\n className={clsx(\n cls(\"dropdown-menu-item-text\"),\n classNames?.itemText\n )}\n >\n {item.label}\n </span>\n </>\n ),\n };\n }, [\n classNames?.item,\n classNames?.itemIcon,\n classNames?.itemText,\n cls,\n inCombobox,\n indeterminate,\n item,\n itemRender,\n selected,\n showCheckbox,\n ]);\n // If custom render function is provided, use it\n if (itemRender) {\n return itemRender(item, {\n ...props,\n ...itemProps,\n });\n }\n const { render, ...restProps } = props;\n // Default rendering\n return renderAsNativeElement ? (\n render ? (\n render(props)\n ) : (\n <div onClick={onSelect} {...restProps} />\n )\n ) : (\n <MenuItem\n value={String(item.key)}\n keywords={getItemKeywords ? getItemKeywords(item) : [String(item.key), reactNodeToString(item.label)]}\n onSelect={onSelect}\n {...props}\n ></MenuItem>\n );\n};\n"],"names":["DropdownMenuItem","item","inCombobox","selected","itemRender","itemProps","classNames","onSelect","showCheckbox","indeterminate","renderAsNativeElement","getItemKeywords","cls","useCls","MenuItem","useMemo","Command","Menu","props","clsx","jsxs","Fragment","jsx","Checkbox","render","restProps","reactNodeToString"],"mappings":";;;;;;;;;;AAwDO,MAAMA,IAAoD,CAAC;AAAA,EAChE,MAA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AAGkB,EAAA,CAAW,IAGzC,gBAAAH;AAAA,IAACR;AAAA,IAAA;AAAA,MACC,OAAO,OAAOb,EAAK,GAAG;AAAA,MACtB,UAAUU,IAAkBA,EAAgBV,CAAI,IAAI,CAAC,OAAOA,EAAK,GAAG,GAAGyB,EAAkBzB,EAAK,KAAK,CAAC;AAAA,MACpG,UAAAM;AAAA,MACC,GAAGW;AAAA,IAAA;AAAA,EACL;AAEL;"}
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import s from "antd/es/theme";
|
|
3
|
-
import t from "antd/es/grid";
|
|
4
3
|
import o from "antd/es/app/useApp";
|
|
5
|
-
import { default as
|
|
6
|
-
import { useForm as l, useWatch as
|
|
7
|
-
const
|
|
4
|
+
import { default as c } from "antd/es/app/useApp";
|
|
5
|
+
import { useForm as l, useWatch as d } from "antd/es/form/Form";
|
|
6
|
+
const u = s.useToken, m = () => {
|
|
8
7
|
const { message: e } = o();
|
|
9
8
|
return e;
|
|
10
|
-
},
|
|
9
|
+
}, n = () => {
|
|
11
10
|
const { modal: e } = o();
|
|
12
11
|
return e;
|
|
13
12
|
};
|
|
14
13
|
export {
|
|
15
|
-
|
|
16
|
-
p as useBreakpoint,
|
|
14
|
+
c as useApp,
|
|
17
15
|
l as useForm,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
m as useMessage,
|
|
17
|
+
n as useModal,
|
|
18
|
+
u as useToken,
|
|
19
|
+
d as useWatch
|
|
22
20
|
};
|
|
23
21
|
//# sourceMappingURL=antd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"antd.js","sources":["../../../src/components/hooks/antd.ts"],"sourcesContent":["\"use client\";\nimport theme from \"antd/es/theme\";\
|
|
1
|
+
{"version":3,"file":"antd.js","sources":["../../../src/components/hooks/antd.ts"],"sourcesContent":["\"use client\";\nimport theme from \"antd/es/theme\";\n// import Grid from \"antd/es/grid\";\nimport useApp from \"antd/es/app/useApp\";\n\nexport const useToken = theme.useToken;\n// export const useBreakpoint = Grid.useBreakpoint;\n\nexport { useForm, useWatch } from \"antd/es/form/Form\";\n\nexport const useMessage = () => {\n const { message } = useApp();\n return message;\n};\n\nexport const useModal = () => {\n const { modal } = useApp();\n return modal;\n};\n\nexport { useApp };\n"],"names":["useToken","theme","useMessage","message","useApp","useModal","modal"],"mappings":";;;;;AAKO,MAAMA,IAAWC,EAAM,UAKjBC,IAAa,MAAM;AACxB,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAO;AACpB,SAAAD;AACT,GAEaE,IAAW,MAAM;AACtB,QAAA,EAAE,OAAAC,EAAM,IAAIF,EAAO;AAClB,SAAAE;AACT;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as r, useMemo as M, useEffect as x, useCallback as w } from "react";
|
|
3
|
+
const e = {
|
|
4
|
+
sm: 640,
|
|
5
|
+
md: 768,
|
|
6
|
+
lg: 1024,
|
|
7
|
+
xl: 1280,
|
|
8
|
+
"2xl": 1536
|
|
9
|
+
}, q = (h = "lg") => {
|
|
10
|
+
const [i, l] = r(h), [d, u] = r(!1), a = M(() => {
|
|
11
|
+
const t = {};
|
|
12
|
+
return typeof window < "u" && (t.sm = window.matchMedia(`(max-width: ${e.md - 1}px)`), t.md = window.matchMedia(`(min-width: ${e.md}px) and (max-width: ${e.lg - 1}px)`), t.lg = window.matchMedia(`(min-width: ${e.lg}px) and (max-width: ${e.xl - 1}px)`), t.xl = window.matchMedia(`(min-width: ${e.xl}px) and (max-width: ${e["2xl"] - 1}px)`), t["2xl"] = window.matchMedia(`(min-width: ${e["2xl"]}px)`)), t;
|
|
13
|
+
}, []);
|
|
14
|
+
x(() => {
|
|
15
|
+
u(!0);
|
|
16
|
+
}, []), x(() => {
|
|
17
|
+
if (typeof window > "u" || !d) return;
|
|
18
|
+
const t = () => {
|
|
19
|
+
var m, o, s, c;
|
|
20
|
+
let n = "sm";
|
|
21
|
+
(m = a["2xl"]) != null && m.matches ? n = "2xl" : (o = a.xl) != null && o.matches ? n = "xl" : (s = a.lg) != null && s.matches ? n = "lg" : (c = a.md) != null && c.matches ? n = "md" : n = "sm", l(n);
|
|
22
|
+
};
|
|
23
|
+
return t(), Object.values(a).forEach((n) => {
|
|
24
|
+
n && n.addEventListener("change", t);
|
|
25
|
+
}), () => {
|
|
26
|
+
Object.values(a).forEach((n) => {
|
|
27
|
+
n && n.removeEventListener("change", t);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}, [a, d]);
|
|
31
|
+
const f = w((t) => typeof window > "u" || !d ? e[i] >= e[t] : window.matchMedia(`(min-width: ${e[t]}px)`).matches, [d, i]), p = w((t) => typeof window > "u" || !d ? e[i] < e[t] : window.matchMedia(`(max-width: ${e[t] - 1}px)`).matches, [d, i]), $ = w((t, n) => typeof window > "u" || !d ? e[i] >= e[t] && e[i] < e[n] : window.matchMedia(`(min-width: ${e[t]}px) and (max-width: ${e[n] - 1}px)`).matches, [d, i]), y = w((t) => {
|
|
32
|
+
if (typeof window > "u" || !d)
|
|
33
|
+
return i === t;
|
|
34
|
+
const n = Object.keys(e), m = n.indexOf(t), o = n[m + 1];
|
|
35
|
+
let s;
|
|
36
|
+
return m === 0 ? s = `(max-width: ${e.md - 1}px)` : o ? s = `(min-width: ${e[t]}px) and (max-width: ${e[o] - 1}px)` : s = `(min-width: ${e[t]}px)`, window.matchMedia(s).matches;
|
|
37
|
+
}, [d, i]);
|
|
38
|
+
return {
|
|
39
|
+
breakpoint: i,
|
|
40
|
+
up: f,
|
|
41
|
+
down: p,
|
|
42
|
+
between: $,
|
|
43
|
+
only: y
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
e as BREAKPOINTS,
|
|
48
|
+
q as useBreakpoint
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=useBreakpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBreakpoint.js","sources":["../../../src/components/hooks/useBreakpoint.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState, useCallback, useMemo } from \"react\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\n\nexport const BREAKPOINTS = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n \"2xl\": 1536,\n};\n\n/**\n * A responsive breakpoint hook using window.matchMedia for optimal performance.\n *\n * @param ssrBreakpoint - The breakpoint to use during SSR and before hydration.\n * Defaults to \"lg\" for better SEO (search engines typically use desktop viewports).\n *\n * @example\n * ```tsx\n * // Default: uses \"lg\" for SSR\n * const bp = useBreakpoint();\n *\n * // Custom SSR breakpoint\n * const bp = useBreakpoint(\"md\");\n *\n * // Usage\n * bp.breakpoint // Current breakpoint: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\"\n * bp.up(\"md\") // true if screen >= 768px\n * bp.down(\"lg\") // true if screen < 1024px\n * bp.between(\"md\", \"xl\") // true if 768px <= screen < 1280px\n * bp.only(\"lg\") // true if screen is exactly in \"lg\" range\n * ```\n */\nexport const useBreakpoint = (ssrBreakpoint: Breakpoint = \"lg\") => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(ssrBreakpoint);\n const [isHydrated, setIsHydrated] = useState(false);\n\n // Generate media queries\n const mediaQueries = useMemo(() => {\n const queries: Record<Breakpoint, MediaQueryList> = {} as any;\n if (typeof window !== 'undefined') {\n queries.sm = window.matchMedia(`(max-width: ${BREAKPOINTS.md - 1}px)`);\n queries.md = window.matchMedia(`(min-width: ${BREAKPOINTS.md}px) and (max-width: ${BREAKPOINTS.lg - 1}px)`);\n queries.lg = window.matchMedia(`(min-width: ${BREAKPOINTS.lg}px) and (max-width: ${BREAKPOINTS.xl - 1}px)`);\n queries.xl = window.matchMedia(`(min-width: ${BREAKPOINTS.xl}px) and (max-width: ${BREAKPOINTS[\"2xl\"] - 1}px)`);\n queries[\"2xl\"] = window.matchMedia(`(min-width: ${BREAKPOINTS[\"2xl\"]}px)`);\n }\n return queries;\n }, []);\n\n useEffect(() => {\n setIsHydrated(true);\n }, []);\n\n useEffect(() => {\n if (typeof window === 'undefined' || !isHydrated) return;\n\n const updateBreakpoint = () => {\n let currentBp: Breakpoint = \"sm\";\n\n if (mediaQueries[\"2xl\"]?.matches) currentBp = \"2xl\";\n else if (mediaQueries.xl?.matches) currentBp = \"xl\";\n else if (mediaQueries.lg?.matches) currentBp = \"lg\";\n else if (mediaQueries.md?.matches) currentBp = \"md\";\n else currentBp = \"sm\";\n\n setBreakpoint(currentBp);\n };\n\n // Initial check\n updateBreakpoint();\n\n // Add listeners\n Object.values(mediaQueries).forEach(mq => {\n if (mq) mq.addEventListener('change', updateBreakpoint);\n });\n\n return () => {\n Object.values(mediaQueries).forEach(mq => {\n if (mq) mq.removeEventListener('change', updateBreakpoint);\n });\n };\n }, [mediaQueries, isHydrated]);\n\n // Min width check: is current width >= breakpoint\n const up = useCallback((bp: Breakpoint) => {\n if (typeof window === 'undefined' || !isHydrated) {\n // SSR fallback: check if ssrBreakpoint >= bp\n return BREAKPOINTS[breakpoint] >= BREAKPOINTS[bp];\n }\n const mq = window.matchMedia(`(min-width: ${BREAKPOINTS[bp]}px)`);\n return mq.matches;\n }, [isHydrated, breakpoint]);\n\n // Max width check: is current width < breakpoint\n const down = useCallback((bp: Breakpoint) => {\n if (typeof window === 'undefined' || !isHydrated) {\n // SSR fallback: check if ssrBreakpoint < bp\n return BREAKPOINTS[breakpoint] < BREAKPOINTS[bp];\n }\n const mq = window.matchMedia(`(max-width: ${BREAKPOINTS[bp] - 1}px)`);\n return mq.matches;\n }, [isHydrated, breakpoint]);\n\n // Range check: is current width between min and max breakpoints\n const between = useCallback((minBp: Breakpoint, maxBp: Breakpoint) => {\n if (typeof window === 'undefined' || !isHydrated) {\n // SSR fallback: check if minBp <= ssrBreakpoint < maxBp\n return BREAKPOINTS[breakpoint] >= BREAKPOINTS[minBp] && BREAKPOINTS[breakpoint] < BREAKPOINTS[maxBp];\n }\n const mq = window.matchMedia(`(min-width: ${BREAKPOINTS[minBp]}px) and (max-width: ${BREAKPOINTS[maxBp] - 1}px)`);\n return mq.matches;\n }, [isHydrated, breakpoint]);\n\n // Only check: is current width only within this breakpoint range\n const only = useCallback((bp: Breakpoint) => {\n if (typeof window === 'undefined' || !isHydrated) {\n // SSR fallback: check if ssrBreakpoint === bp\n return breakpoint === bp;\n }\n\n const breakpointKeys = Object.keys(BREAKPOINTS) as Breakpoint[];\n const currentIndex = breakpointKeys.indexOf(bp);\n const nextBp = breakpointKeys[currentIndex + 1];\n\n let query: string;\n if (currentIndex === 0) {\n // For 'sm', check if width < md\n query = `(max-width: ${BREAKPOINTS.md - 1}px)`;\n } else if (!nextBp) {\n // For highest breakpoint, check if width >= current\n query = `(min-width: ${BREAKPOINTS[bp]}px)`;\n } else {\n // For middle breakpoints, check range\n query = `(min-width: ${BREAKPOINTS[bp]}px) and (max-width: ${BREAKPOINTS[nextBp] - 1}px)`;\n }\n\n const mq = window.matchMedia(query);\n return mq.matches;\n }, [isHydrated, breakpoint]);\n\n return {\n breakpoint,\n up,\n down,\n between,\n only,\n };\n};\n"],"names":["BREAKPOINTS","useBreakpoint","ssrBreakpoint","breakpoint","setBreakpoint","useState","isHydrated","setIsHydrated","mediaQueries","useMemo","queries","useEffect","updateBreakpoint","currentBp","_a","_b","_c","_d","mq","up","useCallback","bp","down","between","minBp","maxBp","only","breakpointKeys","currentIndex","nextBp","query"],"mappings":";;AAKO,MAAMA,IAAc;AAAA,EACzB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT,GAwBaC,IAAgB,CAACC,IAA4B,SAAS;AACjE,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAqBH,CAAa,GAChE,CAACI,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAG5CG,IAAeC,EAAQ,MAAM;AACjC,UAA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,IACA,IAAAgB;AAAA,IACA,MAAAG;AAAA,IACA,SAAAC;AAAA,IACA,MAAAG;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as l, useState as R, useMemo as d, useEffect as z } from "react";
|
|
3
|
+
const S = {
|
|
4
|
+
x: 0,
|
|
5
|
+
y: 0,
|
|
6
|
+
width: 0,
|
|
7
|
+
height: 0,
|
|
8
|
+
top: 0,
|
|
9
|
+
left: 0,
|
|
10
|
+
bottom: 0,
|
|
11
|
+
right: 0
|
|
12
|
+
};
|
|
13
|
+
function x(o) {
|
|
14
|
+
const n = l(0), e = l(null), [r, u] = R(S), c = d(
|
|
15
|
+
() => typeof window < "u" ? new ResizeObserver((m) => {
|
|
16
|
+
const t = m[0];
|
|
17
|
+
t && (cancelAnimationFrame(n.current), n.current = requestAnimationFrame(() => {
|
|
18
|
+
var s, f;
|
|
19
|
+
if (e.current) {
|
|
20
|
+
const i = ((s = t.borderBoxSize) == null ? void 0 : s[0]) || ((f = t.contentBoxSize) == null ? void 0 : f[0]);
|
|
21
|
+
if (i) {
|
|
22
|
+
const a = i.inlineSize, h = i.blockSize;
|
|
23
|
+
u({
|
|
24
|
+
width: a,
|
|
25
|
+
height: h,
|
|
26
|
+
x: t.contentRect.x,
|
|
27
|
+
y: t.contentRect.y,
|
|
28
|
+
top: t.contentRect.top,
|
|
29
|
+
left: t.contentRect.left,
|
|
30
|
+
bottom: t.contentRect.bottom,
|
|
31
|
+
right: t.contentRect.right
|
|
32
|
+
});
|
|
33
|
+
} else
|
|
34
|
+
u(t.contentRect);
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
}) : null,
|
|
38
|
+
[]
|
|
39
|
+
);
|
|
40
|
+
return z(() => (e.current && (c == null || c.observe(e.current, o)), () => {
|
|
41
|
+
c == null || c.disconnect(), n.current && cancelAnimationFrame(n.current);
|
|
42
|
+
}), [e.current]), [e, r];
|
|
43
|
+
}
|
|
44
|
+
function g(o) {
|
|
45
|
+
const [n, { width: e, height: r }] = x(o);
|
|
46
|
+
return { ref: n, width: e, height: r };
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
g as useElementSize,
|
|
50
|
+
x as useResizeObserver
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=useResizeObserver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResizeObserver.js","sources":["../../../src/components/hooks/useResizeObserver.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useMemo, useRef, useState } from 'react';\n\ntype ObserverRect = Omit<DOMRectReadOnly, 'toJSON'>;\n\nconst defaultState: ObserverRect = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n};\n\nexport function useResizeObserver<T extends HTMLElement = any>(options?: ResizeObserverOptions) {\n const frameID = useRef(0);\n const ref = useRef<T>(null);\n\n const [rect, setRect] = useState<ObserverRect>(defaultState);\n\n const observer = useMemo(\n () =>\n typeof window !== 'undefined'\n ? new ResizeObserver((entries) => {\n const entry = entries[0];\n\n if (entry) {\n cancelAnimationFrame(frameID.current);\n\n frameID.current = requestAnimationFrame(() => {\n if (ref.current) {\n const boxSize = entry.borderBoxSize?.[0] || entry.contentBoxSize?.[0];\n if (boxSize) {\n const width = boxSize.inlineSize;\n const height = boxSize.blockSize;\n\n setRect({\n width,\n height,\n x: entry.contentRect.x,\n y: entry.contentRect.y,\n top: entry.contentRect.top,\n left: entry.contentRect.left,\n bottom: entry.contentRect.bottom,\n right: entry.contentRect.right,\n });\n } else {\n setRect(entry.contentRect);\n }\n }\n });\n }\n })\n : null,\n []\n );\n\n useEffect(() => {\n if (ref.current) {\n observer?.observe(ref.current, options);\n }\n\n return () => {\n observer?.disconnect();\n\n if (frameID.current) {\n cancelAnimationFrame(frameID.current);\n }\n };\n }, [ref.current]);\n\n return [ref, rect] as const;\n}\n\nexport function useElementSize<T extends HTMLElement = any>(options?: ResizeObserverOptions) {\n const [ref, { width, height }] = useResizeObserver<T>(options);\n return { ref, width, height };\n}\n"],"names":["defaultState","useResizeObserver","options","frameID","useRef","ref","rect","setRect","useState","observer","useMemo","entries","entry","boxSize","_a","_b","width","height","useEffect","useElementSize"],"mappings":";;AAKA,MAAMA,IAA6B;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,SAASC,EAA+CC,GAAiC;AACxF,QAAAC,IAAUC,EAAO,CAAC,GAClBC,IAAMD,EAAU,IAAI,GAEpB,CAACE,GAAMC,CAAO,IAAIC,EAAuBR,CAAY,GAErDS,IAAWC;AAAA,IACf,MACE,OAAO,SAAW,MACd,IAAI,eAAe,CAACC,MAAY;AACxB,YAAAC,IAAQD,EAAQ,CAAC;AAEvB,MAAIC,MACF,qBAAqBT,EAAQ,OAAO,GAE5BA,EAAA,UAAU,sBAAsB,MAAM;;AAC5C,YAAIE,EAAI,SAAS;AACf,gBAAMQ,MAAUC,IAAAF,EAAM,kBAAN,gBAAAE,EAAsB,SAAMC,IAAAH,EAAM,mBAAN,gBAAAG,EAAuB;AACnE,cAAIF,GAAS;AACX,kBAAMG,IAAQH,EAAQ,YAChBI,IAASJ,EAAQ;AAEf,YAAAN,EAAA;AAAA,cACN,OAAAS;AAAA,cACA,QAAAC;AAAA,cACA,GAAGL,EAAM,YAAY;AAAA,cACrB,GAAGA,EAAM,YAAY;AAAA,cACrB,KAAKA,EAAM,YAAY;AAAA,cACvB,MAAMA,EAAM,YAAY;AAAA,cACxB,QAAQA,EAAM,YAAY;AAAA,cAC1B,OAAOA,EAAM,YAAY;AAAA,YAAA,CAC1B;AAAA,UAAA;AAED,YAAAL,EAAQK,EAAM,WAAW;AAAA,QAC3B;AAAA,MACF,CACD;AAAA,IAEJ,CAAA,IACD;AAAA,IACN,CAAA;AAAA,EACF;AAEA,SAAAM,EAAU,OACJb,EAAI,YACII,KAAA,QAAAA,EAAA,QAAQJ,EAAI,SAASH,KAG1B,MAAM;AACX,IAAAO,KAAA,QAAAA,EAAU,cAENN,EAAQ,WACV,qBAAqBA,EAAQ,OAAO;AAAA,EAExC,IACC,CAACE,EAAI,OAAO,CAAC,GAET,CAACA,GAAKC,CAAI;AACnB;AAEO,SAASa,EAA4CjB,GAAiC;AACrF,QAAA,CAACG,GAAK,EAAE,OAAAW,GAAO,QAAAC,GAAQ,IAAIhB,EAAqBC,CAAO;AACtD,SAAA,EAAE,KAAAG,GAAK,OAAAW,GAAO,QAAAC,EAAO;AAC9B;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import t from "react";
|
|
3
|
+
function o() {
|
|
4
|
+
const [i, n] = t.useState({
|
|
5
|
+
width: null,
|
|
6
|
+
height: null
|
|
7
|
+
});
|
|
8
|
+
return t.useLayoutEffect(() => {
|
|
9
|
+
const e = () => {
|
|
10
|
+
n({
|
|
11
|
+
width: window.innerWidth,
|
|
12
|
+
height: window.innerHeight
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
return e(), window.addEventListener("resize", e), () => {
|
|
16
|
+
window.removeEventListener("resize", e);
|
|
17
|
+
};
|
|
18
|
+
}, []), i;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
o as useWindowSize
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useWindowSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWindowSize.js","sources":["../../../src/components/hooks/useWindowSize.ts"],"sourcesContent":["\"use client\";\nimport React from 'react';\n\nexport function useWindowSize() {\n const [size, setSize] = React.useState({\n width: null,\n height: null,\n });\n\n React.useLayoutEffect(() => {\n const handleResize = () => {\n setSize({\n width: window.innerWidth,\n height: window.innerHeight,\n });\n };\n\n handleResize();\n window.addEventListener(\"resize\", handleResize);\n\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n };\n }, []);\n\n return size;\n}\n"],"names":["useWindowSize","size","setSize","React","handleResize"],"mappings":";;AAGO,SAASA,IAAgB;AAC9B,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAM,SAAS;AAAA,IACrC,OAAO;AAAA,IACP,QAAQ;AAAA,EAAA,CACT;AAEDA,SAAAA,EAAM,gBAAgB,MAAM;AAC1B,UAAMC,IAAe,MAAM;AACjB,MAAAF,EAAA;AAAA,QACN,OAAO,OAAO;AAAA,QACd,QAAQ,OAAO;AAAA,MAAA,CAChB;AAAA,IACH;AAEa,WAAAE,EAAA,GACN,OAAA,iBAAiB,UAAUA,CAAY,GAEvC,MAAM;AACJ,aAAA,oBAAoB,UAAUA,CAAY;AAAA,IACnD;AAAA,EACF,GAAG,EAAE,GAEEH;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/modal/index.ts"],"sourcesContent":["\"use client\";\nimport useApp from \"antd/es/app/useApp\";\nimport { Modal as MainModal } from \"./Modal\";\nimport {\n confirm,\n info,\n success,\n error,\n warning,\n open,\n destroyAll,\n type ModalFuncProps,\n} from \"./functions\";\nimport { ModalProvider, type ModalProviderProps } from \"./ModalProvider\";\n\nimport \"./style.css\";\n\nconst useModal = () => {\n return useApp().modal;\n};\n\n// Export the Modal component with static methods\nexport const Modal = Object.assign(MainModal, {\n Provider: ModalProvider,\n open,\n info,\n success,\n error,\n warning,\n confirm,\n destroyAll,\n useModal,\n});\n\nexport { ModalFuncProps, ModalProviderProps };\n"],"names":["useModal","useApp","Modal","MainModal","ModalProvider","open","info","success","error","warning","confirm","destroyAll"],"mappings":";;;;;;AAiBA,MAAMA,IAAW,MACRC,EAAS,EAAA,OAILC,IAAQ,OAAO,OAAOC,GAAW;AAAA,EAC5C,UAAUC;AAAA,EACV,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAX;AACF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/modal/index.ts"],"sourcesContent":["\"use client\";\nimport useApp from \"antd/es/app/useApp\";\nimport { Modal as MainModal, type ModalProps } from \"./Modal\";\nimport {\n confirm,\n info,\n success,\n error,\n warning,\n open,\n destroyAll,\n type ModalFuncProps,\n} from \"./functions\";\nimport { ModalProvider, type ModalProviderProps } from \"./ModalProvider\";\n\nimport \"./style.css\";\n\nconst useModal = () => {\n return useApp().modal;\n};\n\n// Export the Modal component with static methods\nexport const Modal = Object.assign(MainModal, {\n Provider: ModalProvider,\n open,\n info,\n success,\n error,\n warning,\n confirm,\n destroyAll,\n useModal,\n});\n\nexport { ModalProps, ModalFuncProps, ModalProviderProps };\n"],"names":["useModal","useApp","Modal","MainModal","ModalProvider","open","info","success","error","warning","confirm","destroyAll"],"mappings":";;;;;;AAiBA,MAAMA,IAAW,MACRC,EAAS,EAAA,OAILC,IAAQ,OAAO,OAAOC,GAAW;AAAA,EAC5C,UAAUC;AAAA,EACV,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAX;AACF,CAAC;"}
|