@expcat/tigercat-react 0.0.65 → 0.0.67
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/styles/index.css +4 -0
- package/dist/styles/index.d.mts +2 -0
- package/package.json +12 -9
- package/dist/chunk-2DOPHSZP.js +0 -32
- package/dist/chunk-2TS6X5RA.js +0 -73
- package/dist/chunk-2Y327ZU4.js +0 -493
- package/dist/chunk-3OF7XPIQ.js +0 -90
- package/dist/chunk-3WPKVV4N.js +0 -140
- package/dist/chunk-5FRENLDC.js +0 -194
- package/dist/chunk-5QKMQRCW.js +0 -89
- package/dist/chunk-5ZVSFIZD.js +0 -50
- package/dist/chunk-6MGEGOYJ.js +0 -108
- package/dist/chunk-6PUSRC6S.js +0 -68
- package/dist/chunk-72ZRDBXN.js +0 -25
- package/dist/chunk-77D7VQMG.js +0 -43
- package/dist/chunk-7P6PHSFM.js +0 -548
- package/dist/chunk-AG6GVQ5O.js +0 -271
- package/dist/chunk-AQ6DHCP6.js +0 -53
- package/dist/chunk-AQQRWISY.js +0 -184
- package/dist/chunk-C5EFBJBR.js +0 -540
- package/dist/chunk-D3I2SY7X.js +0 -301
- package/dist/chunk-DZJUFU55.js +0 -300
- package/dist/chunk-EI2GHMQS.js +0 -37
- package/dist/chunk-ENR3RIMM.js +0 -205
- package/dist/chunk-EQWQXURG.js +0 -18
- package/dist/chunk-EUHWE7MN.js +0 -267
- package/dist/chunk-FAKTU64M.js +0 -67
- package/dist/chunk-FQ6UHRAO.js +0 -499
- package/dist/chunk-GX74TC62.js +0 -54
- package/dist/chunk-HDDBBZQH.js +0 -321
- package/dist/chunk-IFY46RWU.js +0 -25
- package/dist/chunk-IQINYCU6.js +0 -99
- package/dist/chunk-IY4LEJYF.js +0 -78
- package/dist/chunk-JW64IJP2.js +0 -210
- package/dist/chunk-KUCFT2OA.js +0 -43
- package/dist/chunk-LNKI6HQ3.js +0 -152
- package/dist/chunk-LXA2YBAO.js +0 -38
- package/dist/chunk-MKWXJZ3T.js +0 -74
- package/dist/chunk-NEULKOYJ.js +0 -48
- package/dist/chunk-NI2WNZRT.js +0 -38
- package/dist/chunk-OFCKGWTS.js +0 -12
- package/dist/chunk-OTRGVENC.js +0 -305
- package/dist/chunk-P273E6XE.js +0 -219
- package/dist/chunk-Q3DPJHNM.js +0 -407
- package/dist/chunk-QFVE7GKD.js +0 -109
- package/dist/chunk-QL6OBKEN.js +0 -84
- package/dist/chunk-QL6UEG3U.js +0 -27
- package/dist/chunk-QORSSZX4.js +0 -144
- package/dist/chunk-R4JSBXGG.js +0 -12
- package/dist/chunk-R5BQHZWB.js +0 -698
- package/dist/chunk-R7MS42PL.js +0 -90
- package/dist/chunk-TB2UHDOZ.js +0 -19
- package/dist/chunk-TBIEWDY5.js +0 -175
- package/dist/chunk-TJFS44SH.js +0 -48
- package/dist/chunk-TZ26HQAW.js +0 -85
- package/dist/chunk-U4ZVEPYD.js +0 -71
- package/dist/chunk-UFAXJVMD.js +0 -120
- package/dist/chunk-VJJ76I7U.js +0 -19
- package/dist/chunk-VO4WDK4K.js +0 -37
- package/dist/chunk-VSF4DF7N.js +0 -84
- package/dist/chunk-VVO4V4IK.js +0 -56
- package/dist/chunk-WK5HN4OH.js +0 -113
- package/dist/chunk-XZDJ5FRB.js +0 -333
- package/dist/chunk-YE2M2HNM.js +0 -168
- package/dist/chunk-YYGTJKP5.js +0 -39
- package/dist/chunk-ZREFCRX3.js +0 -52
- package/dist/components/Alert.d.ts +0 -24
- package/dist/components/Alert.js +0 -10
- package/dist/components/Avatar.d.ts +0 -12
- package/dist/components/Avatar.js +0 -10
- package/dist/components/Badge.d.ts +0 -12
- package/dist/components/Badge.js +0 -10
- package/dist/components/Breadcrumb.d.ts +0 -13
- package/dist/components/Breadcrumb.js +0 -14
- package/dist/components/BreadcrumbItem.d.ts +0 -21
- package/dist/components/BreadcrumbItem.js +0 -11
- package/dist/components/Button.d.ts +0 -8
- package/dist/components/Button.js +0 -10
- package/dist/components/Card.d.ts +0 -33
- package/dist/components/Card.js +0 -10
- package/dist/components/Checkbox.d.ts +0 -48
- package/dist/components/Checkbox.js +0 -11
- package/dist/components/CheckboxGroup.d.ts +0 -39
- package/dist/components/CheckboxGroup.js +0 -14
- package/dist/components/Code.d.ts +0 -9
- package/dist/components/Code.js +0 -16
- package/dist/components/Col.d.ts +0 -7
- package/dist/components/Col.js +0 -11
- package/dist/components/ConfigProvider.d.ts +0 -14
- package/dist/components/ConfigProvider.js +0 -14
- package/dist/components/Container.d.ts +0 -13
- package/dist/components/Container.js +0 -10
- package/dist/components/Content.d.ts +0 -9
- package/dist/components/Content.js +0 -10
- package/dist/components/DatePicker.d.ts +0 -24
- package/dist/components/DatePicker.js +0 -10
- package/dist/components/Descriptions.d.ts +0 -53
- package/dist/components/Descriptions.js +0 -16
- package/dist/components/Divider.d.ts +0 -12
- package/dist/components/Divider.js +0 -10
- package/dist/components/Drawer.d.ts +0 -19
- package/dist/components/Drawer.js +0 -11
- package/dist/components/Dropdown.d.ts +0 -22
- package/dist/components/Dropdown.js +0 -16
- package/dist/components/DropdownItem.d.ts +0 -17
- package/dist/components/DropdownItem.js +0 -13
- package/dist/components/DropdownMenu.d.ts +0 -13
- package/dist/components/DropdownMenu.js +0 -10
- package/dist/components/Footer.d.ts +0 -9
- package/dist/components/Footer.js +0 -10
- package/dist/components/Form.d.ts +0 -56
- package/dist/components/Form.js +0 -14
- package/dist/components/FormItem.d.ts +0 -16
- package/dist/components/FormItem.js +0 -11
- package/dist/components/Header.d.ts +0 -9
- package/dist/components/Header.js +0 -10
- package/dist/components/Icon.d.ts +0 -9
- package/dist/components/Icon.js +0 -10
- package/dist/components/Input.d.ts +0 -28
- package/dist/components/Input.js +0 -10
- package/dist/components/Layout.d.ts +0 -9
- package/dist/components/Layout.js +0 -10
- package/dist/components/Link.d.ts +0 -10
- package/dist/components/Link.js +0 -10
- package/dist/components/List.d.ts +0 -94
- package/dist/components/List.js +0 -12
- package/dist/components/Loading.d.ts +0 -8
- package/dist/components/Loading.js +0 -10
- package/dist/components/Menu.d.ts +0 -35
- package/dist/components/Menu.js +0 -14
- package/dist/components/MenuItem.d.ts +0 -20
- package/dist/components/MenuItem.js +0 -11
- package/dist/components/MenuItemGroup.d.ts +0 -16
- package/dist/components/MenuItemGroup.js +0 -12
- package/dist/components/Message.d.ts +0 -44
- package/dist/components/Message.js +0 -20
- package/dist/components/Modal.d.ts +0 -41
- package/dist/components/Modal.js +0 -11
- package/dist/components/Notification.d.ts +0 -40
- package/dist/components/Notification.js +0 -20
- package/dist/components/Pagination.d.ts +0 -11
- package/dist/components/Pagination.js +0 -16
- package/dist/components/Popconfirm.d.ts +0 -34
- package/dist/components/Popconfirm.js +0 -10
- package/dist/components/Popover.d.ts +0 -14
- package/dist/components/Popover.js +0 -10
- package/dist/components/Progress.d.ts +0 -8
- package/dist/components/Progress.js +0 -10
- package/dist/components/Radio.d.ts +0 -20
- package/dist/components/Radio.js +0 -11
- package/dist/components/RadioGroup.d.ts +0 -28
- package/dist/components/RadioGroup.js +0 -14
- package/dist/components/Row.d.ts +0 -11
- package/dist/components/Row.js +0 -14
- package/dist/components/Select.d.ts +0 -23
- package/dist/components/Select.js +0 -10
- package/dist/components/Sidebar.d.ts +0 -9
- package/dist/components/Sidebar.js +0 -10
- package/dist/components/Skeleton.d.ts +0 -7
- package/dist/components/Skeleton.js +0 -10
- package/dist/components/Slider.d.ts +0 -12
- package/dist/components/Slider.js +0 -10
- package/dist/components/Space.d.ts +0 -11
- package/dist/components/Space.js +0 -10
- package/dist/components/Steps.d.ts +0 -31
- package/dist/components/Steps.js +0 -14
- package/dist/components/StepsItem.d.ts +0 -36
- package/dist/components/StepsItem.js +0 -10
- package/dist/components/SubMenu.d.ts +0 -20
- package/dist/components/SubMenu.js +0 -13
- package/dist/components/Switch.d.ts +0 -12
- package/dist/components/Switch.js +0 -10
- package/dist/components/TabPane.d.ts +0 -42
- package/dist/components/TabPane.js +0 -10
- package/dist/components/Table.d.ts +0 -46
- package/dist/components/Table.js +0 -10
- package/dist/components/Tabs.d.ts +0 -43
- package/dist/components/Tabs.js +0 -14
- package/dist/components/Tag.d.ts +0 -16
- package/dist/components/Tag.js +0 -10
- package/dist/components/Text.d.ts +0 -9
- package/dist/components/Text.js +0 -10
- package/dist/components/Textarea.d.ts +0 -13
- package/dist/components/Textarea.js +0 -10
- package/dist/components/TimePicker.d.ts +0 -28
- package/dist/components/TimePicker.js +0 -10
- package/dist/components/Timeline.d.ts +0 -47
- package/dist/components/Timeline.js +0 -10
- package/dist/components/Tooltip.d.ts +0 -15
- package/dist/components/Tooltip.js +0 -10
- package/dist/components/Tree.d.ts +0 -154
- package/dist/components/Tree.js +0 -16
- package/dist/components/Upload.d.ts +0 -16
- package/dist/components/Upload.js +0 -11
- package/dist/index.d.ts +0 -77
- package/dist/index.js +0 -364
package/dist/chunk-D3I2SY7X.js
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkLXA2YBAO_js = require('./chunk-LXA2YBAO.js');
|
|
4
|
-
var chunk3WPKVV4N_js = require('./chunk-3WPKVV4N.js');
|
|
5
|
-
var chunkQFVE7GKD_js = require('./chunk-QFVE7GKD.js');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var tigercatCore = require('@expcat/tigercat-core');
|
|
8
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
-
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
|
-
|
|
14
|
-
var ExpandIcon = ({ expanded }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
-
"svg",
|
|
16
|
-
{
|
|
17
|
-
className: tigercatCore.getSubMenuExpandIconClasses(expanded),
|
|
18
|
-
width: "12",
|
|
19
|
-
height: "12",
|
|
20
|
-
viewBox: "0 0 12 12",
|
|
21
|
-
fill: "currentColor",
|
|
22
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 9L1.5 4.5L2.205 3.795L6 7.59L9.795 3.795L10.5 4.5L6 9Z" })
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
function getMenuButtonsWithin(menuEl) {
|
|
26
|
-
return Array.from(
|
|
27
|
-
menuEl.querySelectorAll('button[data-tiger-menuitem="true"]')
|
|
28
|
-
).filter((el) => !el.disabled && !el.closest('[data-tiger-menu-hidden="true"]'));
|
|
29
|
-
}
|
|
30
|
-
function roveFocus(current, next) {
|
|
31
|
-
const menuEl = current.closest('ul[role="menu"]');
|
|
32
|
-
if (!menuEl) {
|
|
33
|
-
next.focus();
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const items = getMenuButtonsWithin(menuEl);
|
|
37
|
-
items.forEach((el) => {
|
|
38
|
-
el.tabIndex = el === next ? 0 : -1;
|
|
39
|
-
});
|
|
40
|
-
next.focus();
|
|
41
|
-
}
|
|
42
|
-
function moveFocus(current, delta) {
|
|
43
|
-
const menuEl = current.closest('ul[role="menu"]');
|
|
44
|
-
if (!menuEl) return;
|
|
45
|
-
const items = getMenuButtonsWithin(menuEl);
|
|
46
|
-
const currentIndex = items.indexOf(current);
|
|
47
|
-
if (currentIndex < 0) return;
|
|
48
|
-
const nextIndex = (currentIndex + delta + items.length) % items.length;
|
|
49
|
-
roveFocus(current, items[nextIndex]);
|
|
50
|
-
}
|
|
51
|
-
function focusEdge(current, edge) {
|
|
52
|
-
const menuEl = current.closest('ul[role="menu"]');
|
|
53
|
-
if (!menuEl) return;
|
|
54
|
-
const items = getMenuButtonsWithin(menuEl);
|
|
55
|
-
if (items.length === 0) return;
|
|
56
|
-
roveFocus(current, edge === "start" ? items[0] : items[items.length - 1]);
|
|
57
|
-
}
|
|
58
|
-
function focusFirstChildItemFromTitle(titleEl) {
|
|
59
|
-
const li = titleEl.closest("li");
|
|
60
|
-
const submenu = li?.querySelector('ul[role="menu"]');
|
|
61
|
-
if (!submenu) return;
|
|
62
|
-
const items = getMenuButtonsWithin(submenu);
|
|
63
|
-
if (items.length === 0) return;
|
|
64
|
-
items.forEach((el, idx) => {
|
|
65
|
-
el.tabIndex = idx === 0 ? 0 : -1;
|
|
66
|
-
});
|
|
67
|
-
items[0].focus();
|
|
68
|
-
}
|
|
69
|
-
var SubMenu = ({
|
|
70
|
-
itemKey,
|
|
71
|
-
title = "",
|
|
72
|
-
icon,
|
|
73
|
-
disabled = false,
|
|
74
|
-
className,
|
|
75
|
-
level = 0,
|
|
76
|
-
children,
|
|
77
|
-
collapsed: collapsedOverride
|
|
78
|
-
}) => {
|
|
79
|
-
const menuContext = chunkQFVE7GKD_js.useMenuContext();
|
|
80
|
-
if (!menuContext) {
|
|
81
|
-
console.warn("SubMenu must be used within Menu component");
|
|
82
|
-
}
|
|
83
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
84
|
-
const [isOpenByKeyboard, setIsOpenByKeyboard] = React.useState(false);
|
|
85
|
-
const effectiveCollapsed = collapsedOverride ?? (menuContext ? menuContext.collapsed : false);
|
|
86
|
-
const isPopup = !!menuContext && menuContext.mode === "vertical" && effectiveCollapsed;
|
|
87
|
-
const isOpen = !!menuContext && tigercatCore.isKeyOpen(itemKey, menuContext.openKeys);
|
|
88
|
-
const isExpanded = menuContext?.mode === "horizontal" || isPopup ? isHovered || isOpenByKeyboard : isOpen;
|
|
89
|
-
const isInlineOrVertical = menuContext?.mode !== "horizontal" && !isPopup;
|
|
90
|
-
const [hasRenderedInline, setHasRenderedInline] = React.useState(
|
|
91
|
-
() => isInlineOrVertical ? isExpanded : false
|
|
92
|
-
);
|
|
93
|
-
React.useEffect(() => {
|
|
94
|
-
if (!isInlineOrVertical || !isExpanded || hasRenderedInline) return;
|
|
95
|
-
setHasRenderedInline(true);
|
|
96
|
-
}, [hasRenderedInline, isExpanded, isInlineOrVertical]);
|
|
97
|
-
const titleClasses = React.useMemo(() => {
|
|
98
|
-
if (!menuContext) return "";
|
|
99
|
-
return tigercatCore.getSubMenuTitleClasses(menuContext.theme, disabled);
|
|
100
|
-
}, [menuContext, disabled]);
|
|
101
|
-
const contentClasses = React.useMemo(() => {
|
|
102
|
-
if (!menuContext) return "";
|
|
103
|
-
if (menuContext.mode === "horizontal") return tigercatCore.submenuContentHorizontalClasses;
|
|
104
|
-
if (isPopup) return tigercatCore.submenuContentPopupClasses;
|
|
105
|
-
if (menuContext.mode === "inline") return tigercatCore.submenuContentInlineClasses;
|
|
106
|
-
return tigercatCore.submenuContentVerticalClasses;
|
|
107
|
-
}, [menuContext, isPopup]);
|
|
108
|
-
const handleTitleClick = React.useCallback(() => {
|
|
109
|
-
if (!menuContext || disabled) return;
|
|
110
|
-
if (menuContext.mode === "horizontal") return;
|
|
111
|
-
if (isPopup) {
|
|
112
|
-
setIsOpenByKeyboard((prev) => !prev);
|
|
113
|
-
setIsHovered(true);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
setHasRenderedInline(true);
|
|
117
|
-
menuContext.handleOpenChange(itemKey);
|
|
118
|
-
}, [disabled, menuContext, itemKey, isPopup]);
|
|
119
|
-
const handleMouseEnter = React.useCallback(() => {
|
|
120
|
-
if (menuContext?.mode === "horizontal" || isPopup) setIsHovered(true);
|
|
121
|
-
}, [menuContext, isPopup]);
|
|
122
|
-
const handleMouseLeave = React.useCallback(() => {
|
|
123
|
-
if (menuContext?.mode === "horizontal" || isPopup) {
|
|
124
|
-
setIsHovered(false);
|
|
125
|
-
setIsOpenByKeyboard(false);
|
|
126
|
-
}
|
|
127
|
-
}, [menuContext, isPopup]);
|
|
128
|
-
const openInline = React.useCallback(
|
|
129
|
-
(titleEl) => {
|
|
130
|
-
if (!menuContext) return;
|
|
131
|
-
setHasRenderedInline(true);
|
|
132
|
-
menuContext.handleOpenChange(itemKey);
|
|
133
|
-
setTimeout(() => focusFirstChildItemFromTitle(titleEl), 0);
|
|
134
|
-
},
|
|
135
|
-
[menuContext, itemKey]
|
|
136
|
-
);
|
|
137
|
-
const handleTitleKeyDown = React.useCallback(
|
|
138
|
-
(event) => {
|
|
139
|
-
if (!menuContext || disabled) return;
|
|
140
|
-
const current = event.currentTarget;
|
|
141
|
-
const rootMenu = current.closest('ul[role="menu"]');
|
|
142
|
-
const isRoot = rootMenu?.dataset.tigerMenuRoot === "true";
|
|
143
|
-
const isHorizontalRoot = isRoot && menuContext.mode === "horizontal";
|
|
144
|
-
const nextKey = isHorizontalRoot ? "ArrowRight" : "ArrowDown";
|
|
145
|
-
const prevKey = isHorizontalRoot ? "ArrowLeft" : "ArrowUp";
|
|
146
|
-
if (event.key === nextKey) {
|
|
147
|
-
event.preventDefault();
|
|
148
|
-
moveFocus(current, 1);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
if (event.key === prevKey) {
|
|
152
|
-
event.preventDefault();
|
|
153
|
-
moveFocus(current, -1);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (event.key === "Home") {
|
|
157
|
-
event.preventDefault();
|
|
158
|
-
focusEdge(current, "start");
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
if (event.key === "End") {
|
|
162
|
-
event.preventDefault();
|
|
163
|
-
focusEdge(current, "end");
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
if (event.key === "Escape" || event.key === "ArrowLeft") {
|
|
167
|
-
if (menuContext.mode === "horizontal" || isPopup) {
|
|
168
|
-
event.preventDefault();
|
|
169
|
-
setIsOpenByKeyboard(false);
|
|
170
|
-
setIsHovered(false);
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (isOpen) {
|
|
174
|
-
event.preventDefault();
|
|
175
|
-
menuContext.handleOpenChange(itemKey);
|
|
176
|
-
}
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
180
|
-
event.preventDefault();
|
|
181
|
-
if (menuContext.mode === "horizontal" || isPopup) {
|
|
182
|
-
setIsOpenByKeyboard(true);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
openInline(current);
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
189
|
-
if (menuContext.mode === "horizontal" || isPopup) {
|
|
190
|
-
event.preventDefault();
|
|
191
|
-
setIsOpenByKeyboard(true);
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
if (!isOpen) {
|
|
195
|
-
event.preventDefault();
|
|
196
|
-
openInline(current);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
[menuContext, disabled, isOpen, isPopup, openInline]
|
|
201
|
-
);
|
|
202
|
-
const indentStyle = !menuContext || menuContext.mode === "horizontal" || level === 0 ? {} : tigercatCore.getMenuItemIndent(level, menuContext.inlineIndent);
|
|
203
|
-
if (!menuContext) return null;
|
|
204
|
-
const renderIcon = () => {
|
|
205
|
-
if (!icon) return null;
|
|
206
|
-
if (typeof icon === "string") {
|
|
207
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: tigercatCore.menuItemIconClasses, dangerouslySetInnerHTML: { __html: icon } });
|
|
208
|
-
}
|
|
209
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: tigercatCore.menuItemIconClasses, children: icon });
|
|
210
|
-
};
|
|
211
|
-
const renderTitle = () => {
|
|
212
|
-
if (!effectiveCollapsed) {
|
|
213
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
214
|
-
renderIcon(),
|
|
215
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: title }),
|
|
216
|
-
menuContext.mode !== "horizontal" && !isPopup && /* @__PURE__ */ jsxRuntime.jsx(ExpandIcon, { expanded: isExpanded })
|
|
217
|
-
] });
|
|
218
|
-
} else if (!icon) {
|
|
219
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-center", children: title.charAt(0).toUpperCase() });
|
|
220
|
-
} else {
|
|
221
|
-
return renderIcon();
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
const renderContent = () => {
|
|
225
|
-
const nextLevel = level + 1;
|
|
226
|
-
const enhancedChildren = React__default.default.Children.map(children, (child) => {
|
|
227
|
-
if (!React__default.default.isValidElement(child)) return child;
|
|
228
|
-
if (child.type === chunk3WPKVV4N_js.MenuItem || child.type === SubMenu || child.type === chunkLXA2YBAO_js.MenuItemGroup) {
|
|
229
|
-
return React__default.default.cloneElement(
|
|
230
|
-
child,
|
|
231
|
-
{
|
|
232
|
-
level: nextLevel,
|
|
233
|
-
collapsed: isPopup ? false : void 0
|
|
234
|
-
}
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
return child;
|
|
238
|
-
});
|
|
239
|
-
if (menuContext.mode === "horizontal" || isPopup) {
|
|
240
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
241
|
-
"ul",
|
|
242
|
-
{
|
|
243
|
-
className: contentClasses,
|
|
244
|
-
style: { display: isExpanded ? "block" : "none" },
|
|
245
|
-
role: "menu",
|
|
246
|
-
"aria-hidden": isExpanded ? void 0 : "true",
|
|
247
|
-
children: enhancedChildren
|
|
248
|
-
}
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
if (!hasRenderedInline) return null;
|
|
252
|
-
const isHidden = !isExpanded;
|
|
253
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
254
|
-
"div",
|
|
255
|
-
{
|
|
256
|
-
className: tigercatCore.classNames(
|
|
257
|
-
"grid overflow-hidden transition-[grid-template-rows,opacity] duration-200 ease-in-out",
|
|
258
|
-
isHidden ? "grid-rows-[0fr] opacity-0" : "grid-rows-[1fr] opacity-100"
|
|
259
|
-
),
|
|
260
|
-
"aria-hidden": isHidden ? "true" : void 0,
|
|
261
|
-
"data-tiger-menu-hidden": isHidden ? "true" : void 0,
|
|
262
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: tigercatCore.classNames(contentClasses, "min-h-0"), role: "menu", children: enhancedChildren })
|
|
263
|
-
}
|
|
264
|
-
);
|
|
265
|
-
};
|
|
266
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
267
|
-
"li",
|
|
268
|
-
{
|
|
269
|
-
className: tigercatCore.classNames(
|
|
270
|
-
menuContext.mode === "horizontal" || isPopup ? "relative" : "",
|
|
271
|
-
className
|
|
272
|
-
),
|
|
273
|
-
onMouseEnter: handleMouseEnter,
|
|
274
|
-
onMouseLeave: handleMouseLeave,
|
|
275
|
-
role: "none",
|
|
276
|
-
children: [
|
|
277
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
278
|
-
"button",
|
|
279
|
-
{
|
|
280
|
-
type: "button",
|
|
281
|
-
className: titleClasses,
|
|
282
|
-
style: indentStyle,
|
|
283
|
-
onClick: handleTitleClick,
|
|
284
|
-
onKeyDown: handleTitleKeyDown,
|
|
285
|
-
role: "menuitem",
|
|
286
|
-
"data-tiger-menuitem": "true",
|
|
287
|
-
"aria-expanded": isExpanded ? "true" : "false",
|
|
288
|
-
"aria-haspopup": "true",
|
|
289
|
-
"aria-disabled": disabled ? "true" : void 0,
|
|
290
|
-
disabled,
|
|
291
|
-
tabIndex: -1,
|
|
292
|
-
children: renderTitle()
|
|
293
|
-
}
|
|
294
|
-
),
|
|
295
|
-
renderContent()
|
|
296
|
-
]
|
|
297
|
-
}
|
|
298
|
-
);
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
exports.SubMenu = SubMenu;
|
package/dist/chunk-DZJUFU55.js
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
var tigercatCore = require('@expcat/tigercat-core');
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
|
|
7
|
-
// src/components/Pagination.tsx
|
|
8
|
-
var Pagination = ({
|
|
9
|
-
current: controlledCurrent,
|
|
10
|
-
defaultCurrent = 1,
|
|
11
|
-
total = 0,
|
|
12
|
-
pageSize: controlledPageSize,
|
|
13
|
-
defaultPageSize = 10,
|
|
14
|
-
pageSizeOptions = [10, 20, 50, 100],
|
|
15
|
-
showQuickJumper = false,
|
|
16
|
-
showSizeChanger = false,
|
|
17
|
-
showTotal = true,
|
|
18
|
-
totalText,
|
|
19
|
-
simple = false,
|
|
20
|
-
size = "medium",
|
|
21
|
-
align = "center",
|
|
22
|
-
disabled = false,
|
|
23
|
-
hideOnSinglePage = false,
|
|
24
|
-
showLessItems = false,
|
|
25
|
-
className,
|
|
26
|
-
style,
|
|
27
|
-
onChange,
|
|
28
|
-
onPageSizeChange,
|
|
29
|
-
...props
|
|
30
|
-
}) => {
|
|
31
|
-
const { "aria-label": ariaLabelProp, ...navProps } = props;
|
|
32
|
-
const [internalCurrent, setInternalCurrent] = react.useState(defaultCurrent);
|
|
33
|
-
const [internalPageSize, setInternalPageSize] = react.useState(defaultPageSize);
|
|
34
|
-
const [quickJumperValue, setQuickJumperValue] = react.useState("");
|
|
35
|
-
const currentPage = controlledCurrent !== void 0 ? controlledCurrent : internalCurrent;
|
|
36
|
-
const currentPageSize = controlledPageSize !== void 0 ? controlledPageSize : internalPageSize;
|
|
37
|
-
const totalPages = tigercatCore.getTotalPages(total, currentPageSize);
|
|
38
|
-
const validatedCurrentPage = tigercatCore.validateCurrentPage(currentPage, totalPages);
|
|
39
|
-
const pageRange = tigercatCore.getPageRange(validatedCurrentPage, currentPageSize, total);
|
|
40
|
-
if (hideOnSinglePage && totalPages <= 1) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
const handlePageChange = react.useCallback(
|
|
44
|
-
(page) => {
|
|
45
|
-
if (disabled) return;
|
|
46
|
-
if (page === validatedCurrentPage) return;
|
|
47
|
-
if (page < 1 || page > totalPages) return;
|
|
48
|
-
if (controlledCurrent === void 0) {
|
|
49
|
-
setInternalCurrent(page);
|
|
50
|
-
}
|
|
51
|
-
onChange?.(page, currentPageSize);
|
|
52
|
-
},
|
|
53
|
-
[disabled, validatedCurrentPage, totalPages, controlledCurrent, onChange, currentPageSize]
|
|
54
|
-
);
|
|
55
|
-
const handlePageSizeChange = react.useCallback(
|
|
56
|
-
(newPageSize) => {
|
|
57
|
-
if (disabled) return;
|
|
58
|
-
const newTotalPages = tigercatCore.getTotalPages(total, newPageSize);
|
|
59
|
-
let newPage = validatedCurrentPage;
|
|
60
|
-
if (newPage > newTotalPages) {
|
|
61
|
-
newPage = Math.max(1, newTotalPages);
|
|
62
|
-
}
|
|
63
|
-
if (controlledPageSize === void 0) {
|
|
64
|
-
setInternalPageSize(newPageSize);
|
|
65
|
-
}
|
|
66
|
-
if (controlledCurrent === void 0 && newPage !== validatedCurrentPage) {
|
|
67
|
-
setInternalCurrent(newPage);
|
|
68
|
-
}
|
|
69
|
-
onPageSizeChange?.(newPage, newPageSize);
|
|
70
|
-
if (newPage !== validatedCurrentPage) {
|
|
71
|
-
onChange?.(newPage, newPageSize);
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
[
|
|
75
|
-
disabled,
|
|
76
|
-
total,
|
|
77
|
-
validatedCurrentPage,
|
|
78
|
-
controlledPageSize,
|
|
79
|
-
controlledCurrent,
|
|
80
|
-
onPageSizeChange,
|
|
81
|
-
onChange
|
|
82
|
-
]
|
|
83
|
-
);
|
|
84
|
-
const handleQuickJumperSubmit = react.useCallback(() => {
|
|
85
|
-
const page = parseInt(quickJumperValue, 10);
|
|
86
|
-
if (!isNaN(page)) {
|
|
87
|
-
handlePageChange(page);
|
|
88
|
-
}
|
|
89
|
-
setQuickJumperValue("");
|
|
90
|
-
}, [quickJumperValue, handlePageChange]);
|
|
91
|
-
const handleQuickJumperKeyPress = react.useCallback(
|
|
92
|
-
(event) => {
|
|
93
|
-
if (event.key === "Enter") {
|
|
94
|
-
handleQuickJumperSubmit();
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
[handleQuickJumperSubmit]
|
|
98
|
-
);
|
|
99
|
-
const containerClasses = tigercatCore.getPaginationContainerClasses(align, className);
|
|
100
|
-
const elements = [];
|
|
101
|
-
if (showTotal) {
|
|
102
|
-
const totalTextFn = totalText || tigercatCore.defaultTotalText;
|
|
103
|
-
const totalTextContent = totalTextFn(total, pageRange);
|
|
104
|
-
elements.push(
|
|
105
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: tigercatCore.getTotalTextClasses(size), children: totalTextContent }, "total")
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
if (simple) {
|
|
109
|
-
const prevDisabled = validatedCurrentPage <= 1 || disabled;
|
|
110
|
-
const nextDisabled = validatedCurrentPage >= totalPages || disabled;
|
|
111
|
-
elements.push(
|
|
112
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
113
|
-
"button",
|
|
114
|
-
{
|
|
115
|
-
type: "button",
|
|
116
|
-
className: tigercatCore.getPaginationButtonBaseClasses(size),
|
|
117
|
-
disabled: prevDisabled,
|
|
118
|
-
onClick: () => handlePageChange(validatedCurrentPage - 1),
|
|
119
|
-
"aria-label": "\u4E0A\u4E00\u9875",
|
|
120
|
-
children: "\u2039"
|
|
121
|
-
},
|
|
122
|
-
"prev"
|
|
123
|
-
)
|
|
124
|
-
);
|
|
125
|
-
elements.push(
|
|
126
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
127
|
-
"span",
|
|
128
|
-
{
|
|
129
|
-
className: tigercatCore.classNames(
|
|
130
|
-
"mx-2",
|
|
131
|
-
size === "small" ? "text-sm" : size === "large" ? "text-lg" : "text-base"
|
|
132
|
-
),
|
|
133
|
-
children: [
|
|
134
|
-
validatedCurrentPage,
|
|
135
|
-
" / ",
|
|
136
|
-
totalPages
|
|
137
|
-
]
|
|
138
|
-
},
|
|
139
|
-
"current"
|
|
140
|
-
)
|
|
141
|
-
);
|
|
142
|
-
elements.push(
|
|
143
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
144
|
-
"button",
|
|
145
|
-
{
|
|
146
|
-
type: "button",
|
|
147
|
-
className: tigercatCore.getPaginationButtonBaseClasses(size),
|
|
148
|
-
disabled: nextDisabled,
|
|
149
|
-
onClick: () => handlePageChange(validatedCurrentPage + 1),
|
|
150
|
-
"aria-label": "\u4E0B\u4E00\u9875",
|
|
151
|
-
children: "\u203A"
|
|
152
|
-
},
|
|
153
|
-
"next"
|
|
154
|
-
)
|
|
155
|
-
);
|
|
156
|
-
} else {
|
|
157
|
-
const prevDisabled = validatedCurrentPage <= 1 || disabled;
|
|
158
|
-
const nextDisabled = validatedCurrentPage >= totalPages || disabled;
|
|
159
|
-
elements.push(
|
|
160
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
161
|
-
"button",
|
|
162
|
-
{
|
|
163
|
-
type: "button",
|
|
164
|
-
className: tigercatCore.getPaginationButtonBaseClasses(size),
|
|
165
|
-
disabled: prevDisabled,
|
|
166
|
-
onClick: () => handlePageChange(validatedCurrentPage - 1),
|
|
167
|
-
"aria-label": "\u4E0A\u4E00\u9875",
|
|
168
|
-
children: "\u2039"
|
|
169
|
-
},
|
|
170
|
-
"prev"
|
|
171
|
-
)
|
|
172
|
-
);
|
|
173
|
-
const pageNumbers = tigercatCore.getPageNumbers(validatedCurrentPage, totalPages, showLessItems);
|
|
174
|
-
pageNumbers.forEach((pageNum, index) => {
|
|
175
|
-
if (pageNum === "...") {
|
|
176
|
-
elements.push(
|
|
177
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
178
|
-
"span",
|
|
179
|
-
{
|
|
180
|
-
className: tigercatCore.getPaginationEllipsisClasses(size),
|
|
181
|
-
"aria-hidden": "true",
|
|
182
|
-
children: "..."
|
|
183
|
-
},
|
|
184
|
-
`ellipsis-${index}`
|
|
185
|
-
)
|
|
186
|
-
);
|
|
187
|
-
} else {
|
|
188
|
-
const isActive = pageNum === validatedCurrentPage;
|
|
189
|
-
elements.push(
|
|
190
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
191
|
-
"button",
|
|
192
|
-
{
|
|
193
|
-
type: "button",
|
|
194
|
-
className: tigercatCore.classNames(
|
|
195
|
-
tigercatCore.getPaginationButtonBaseClasses(size),
|
|
196
|
-
isActive && tigercatCore.getPaginationButtonActiveClasses()
|
|
197
|
-
),
|
|
198
|
-
disabled,
|
|
199
|
-
onClick: () => handlePageChange(pageNum),
|
|
200
|
-
"aria-label": `\u7B2C ${pageNum} \u9875`,
|
|
201
|
-
"aria-current": isActive ? "page" : void 0,
|
|
202
|
-
children: String(pageNum)
|
|
203
|
-
},
|
|
204
|
-
`page-${pageNum}`
|
|
205
|
-
)
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
elements.push(
|
|
210
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
211
|
-
"button",
|
|
212
|
-
{
|
|
213
|
-
type: "button",
|
|
214
|
-
className: tigercatCore.getPaginationButtonBaseClasses(size),
|
|
215
|
-
disabled: nextDisabled,
|
|
216
|
-
onClick: () => handlePageChange(validatedCurrentPage + 1),
|
|
217
|
-
"aria-label": "\u4E0B\u4E00\u9875",
|
|
218
|
-
children: "\u203A"
|
|
219
|
-
},
|
|
220
|
-
"next"
|
|
221
|
-
)
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
if (showSizeChanger) {
|
|
225
|
-
elements.push(
|
|
226
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
227
|
-
"select",
|
|
228
|
-
{
|
|
229
|
-
className: tigercatCore.getPageSizeSelectorClasses(size),
|
|
230
|
-
disabled,
|
|
231
|
-
value: currentPageSize,
|
|
232
|
-
onChange: (e) => handlePageSizeChange(parseInt(e.target.value, 10)),
|
|
233
|
-
"aria-label": "\u6BCF\u9875\u6761\u6570",
|
|
234
|
-
children: pageSizeOptions.map((sizeOption) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: sizeOption, children: [
|
|
235
|
-
sizeOption,
|
|
236
|
-
" \u6761/\u9875"
|
|
237
|
-
] }, sizeOption))
|
|
238
|
-
},
|
|
239
|
-
"size-changer"
|
|
240
|
-
)
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
if (showQuickJumper) {
|
|
244
|
-
elements.push(
|
|
245
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
246
|
-
"span",
|
|
247
|
-
{
|
|
248
|
-
className: tigercatCore.classNames(
|
|
249
|
-
"ml-2",
|
|
250
|
-
size === "small" ? "text-sm" : size === "large" ? "text-lg" : "text-base"
|
|
251
|
-
),
|
|
252
|
-
children: "\u8DF3\u81F3"
|
|
253
|
-
},
|
|
254
|
-
"jumper-label-start"
|
|
255
|
-
)
|
|
256
|
-
);
|
|
257
|
-
elements.push(
|
|
258
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
259
|
-
"input",
|
|
260
|
-
{
|
|
261
|
-
type: "number",
|
|
262
|
-
className: tigercatCore.classNames(tigercatCore.getQuickJumperInputClasses(size), "mx-2"),
|
|
263
|
-
disabled,
|
|
264
|
-
value: quickJumperValue,
|
|
265
|
-
onChange: (e) => setQuickJumperValue(e.target.value),
|
|
266
|
-
onKeyDown: handleQuickJumperKeyPress,
|
|
267
|
-
min: 1,
|
|
268
|
-
max: totalPages,
|
|
269
|
-
"aria-label": "\u8DF3\u8F6C\u9875\u7801"
|
|
270
|
-
},
|
|
271
|
-
"jumper-input"
|
|
272
|
-
)
|
|
273
|
-
);
|
|
274
|
-
elements.push(
|
|
275
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
276
|
-
"span",
|
|
277
|
-
{
|
|
278
|
-
className: size === "small" ? "text-sm" : size === "large" ? "text-lg" : "text-base",
|
|
279
|
-
children: "\u9875"
|
|
280
|
-
},
|
|
281
|
-
"jumper-label-end"
|
|
282
|
-
)
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
286
|
-
"nav",
|
|
287
|
-
{
|
|
288
|
-
className: containerClasses,
|
|
289
|
-
...navProps,
|
|
290
|
-
role: "navigation",
|
|
291
|
-
"aria-label": ariaLabelProp ?? "\u5206\u9875\u5BFC\u822A",
|
|
292
|
-
style,
|
|
293
|
-
children: elements
|
|
294
|
-
}
|
|
295
|
-
);
|
|
296
|
-
};
|
|
297
|
-
var Pagination_default = Pagination;
|
|
298
|
-
|
|
299
|
-
exports.Pagination = Pagination;
|
|
300
|
-
exports.Pagination_default = Pagination_default;
|
package/dist/chunk-EI2GHMQS.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
var tigercatCore = require('@expcat/tigercat-core');
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
|
|
7
|
-
// src/components/Row.tsx
|
|
8
|
-
var RowContext = react.createContext({});
|
|
9
|
-
var Row = ({
|
|
10
|
-
gutter = 0,
|
|
11
|
-
align = "top",
|
|
12
|
-
justify = "start",
|
|
13
|
-
wrap = true,
|
|
14
|
-
children,
|
|
15
|
-
className,
|
|
16
|
-
style,
|
|
17
|
-
...divProps
|
|
18
|
-
}) => {
|
|
19
|
-
const { rowStyle } = tigercatCore.getGutterStyles(gutter);
|
|
20
|
-
const rowClasses = tigercatCore.classNames(
|
|
21
|
-
"flex",
|
|
22
|
-
"w-full",
|
|
23
|
-
wrap && "flex-wrap",
|
|
24
|
-
tigercatCore.getAlignClasses(align),
|
|
25
|
-
tigercatCore.getJustifyClasses(justify),
|
|
26
|
-
className
|
|
27
|
-
);
|
|
28
|
-
const mergedStyle = {
|
|
29
|
-
...rowStyle,
|
|
30
|
-
...style
|
|
31
|
-
};
|
|
32
|
-
const contextValue = { gutter };
|
|
33
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: rowClasses, style: mergedStyle, ...divProps, children }) });
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
exports.Row = Row;
|
|
37
|
-
exports.RowContext = RowContext;
|