@expcat/tigercat-react 0.0.1
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/LICENSE +21 -0
- package/dist/chunk-2DOPHSZP.js +32 -0
- package/dist/chunk-2TS6X5RA.js +73 -0
- package/dist/chunk-2Y327ZU4.js +493 -0
- package/dist/chunk-3GD3LOII.mjs +23 -0
- package/dist/chunk-3OF7XPIQ.js +90 -0
- package/dist/chunk-3WPKVV4N.js +140 -0
- package/dist/chunk-3XXXM4OB.mjs +203 -0
- package/dist/chunk-427CM2U6.mjs +76 -0
- package/dist/chunk-472D2S4R.mjs +23 -0
- package/dist/chunk-5FRENLDC.js +194 -0
- package/dist/chunk-5HUYCSA4.mjs +77 -0
- package/dist/chunk-5QKMQRCW.js +89 -0
- package/dist/chunk-5ZVSFIZD.js +50 -0
- package/dist/chunk-6575DOCV.mjs +117 -0
- package/dist/chunk-672SCJWZ.mjs +88 -0
- package/dist/chunk-6MGEGOYJ.js +108 -0
- package/dist/chunk-6PUSRC6S.js +68 -0
- package/dist/chunk-6YDIBMCM.mjs +33 -0
- package/dist/chunk-72ZRDBXN.js +25 -0
- package/dist/chunk-77D7VQMG.js +43 -0
- package/dist/chunk-7CAJK2ZK.mjs +54 -0
- package/dist/chunk-7JQ7LURS.mjs +25 -0
- package/dist/chunk-7KRBDT2Z.mjs +269 -0
- package/dist/chunk-7O2OQKVY.mjs +10 -0
- package/dist/chunk-7OLWGHUR.mjs +169 -0
- package/dist/chunk-7P6PHSFM.js +548 -0
- package/dist/chunk-ADOPAXPG.mjs +301 -0
- package/dist/chunk-AG6GVQ5O.js +271 -0
- package/dist/chunk-ALP3KYYY.mjs +47 -0
- package/dist/chunk-AQ6DHCP6.js +53 -0
- package/dist/chunk-AQQRWISY.js +184 -0
- package/dist/chunk-C52ZCGYG.mjs +313 -0
- package/dist/chunk-C5EFBJBR.js +540 -0
- package/dist/chunk-CES6LGQ7.mjs +546 -0
- package/dist/chunk-CKUSQR2H.mjs +41 -0
- package/dist/chunk-CR4QK2AB.mjs +88 -0
- package/dist/chunk-CTAMMQBC.mjs +297 -0
- package/dist/chunk-D3I2SY7X.js +301 -0
- package/dist/chunk-DCRVIDMY.mjs +41 -0
- package/dist/chunk-DIZNY6N4.mjs +71 -0
- package/dist/chunk-DZJUFU55.js +300 -0
- package/dist/chunk-EB6EDLJZ.mjs +50 -0
- package/dist/chunk-EI2GHMQS.js +37 -0
- package/dist/chunk-ENR3RIMM.js +205 -0
- package/dist/chunk-EQWQXURG.js +18 -0
- package/dist/chunk-EUHWE7MN.js +267 -0
- package/dist/chunk-FAKTU64M.js +67 -0
- package/dist/chunk-FQ6UHRAO.js +499 -0
- package/dist/chunk-G6FSHN2I.mjs +111 -0
- package/dist/chunk-GIYBVWR4.mjs +213 -0
- package/dist/chunk-HDDBBZQH.js +321 -0
- package/dist/chunk-HQLZL3XQ.mjs +48 -0
- package/dist/chunk-HQXZVTP4.mjs +199 -0
- package/dist/chunk-HUMGEP7S.mjs +17 -0
- package/dist/chunk-IFY46RWU.js +25 -0
- package/dist/chunk-IQINYCU6.js +99 -0
- package/dist/chunk-IWENGARY.mjs +32 -0
- package/dist/chunk-IY4LEJYF.js +78 -0
- package/dist/chunk-JW64IJP2.js +210 -0
- package/dist/chunk-K7ZMB2TH.mjs +696 -0
- package/dist/chunk-KAEHFMTQ.mjs +537 -0
- package/dist/chunk-KMQOLVWP.mjs +65 -0
- package/dist/chunk-KUCFT2OA.js +43 -0
- package/dist/chunk-LADCWARG.mjs +97 -0
- package/dist/chunk-LAZGEMA2.mjs +176 -0
- package/dist/chunk-LNKI6HQ3.js +152 -0
- package/dist/chunk-LXA2YBAO.js +38 -0
- package/dist/chunk-MKWXJZ3T.js +74 -0
- package/dist/chunk-MQXBU5YX.mjs +87 -0
- package/dist/chunk-NEULKOYJ.js +48 -0
- package/dist/chunk-NI2WNZRT.js +38 -0
- package/dist/chunk-NOOPXNR4.mjs +36 -0
- package/dist/chunk-NSGDRTSQ.mjs +138 -0
- package/dist/chunk-O3EUFIOS.mjs +142 -0
- package/dist/chunk-OCVQ3LOT.mjs +45 -0
- package/dist/chunk-OFCKGWTS.js +12 -0
- package/dist/chunk-OQTPXPAP.mjs +10 -0
- package/dist/chunk-OTRGVENC.js +305 -0
- package/dist/chunk-P273E6XE.js +219 -0
- package/dist/chunk-PAD2DX5M.mjs +331 -0
- package/dist/chunk-PUDU34R4.mjs +106 -0
- package/dist/chunk-Q3DPJHNM.js +407 -0
- package/dist/chunk-QEAC4MIG.mjs +295 -0
- package/dist/chunk-QFVE7GKD.js +109 -0
- package/dist/chunk-QL6OBKEN.js +84 -0
- package/dist/chunk-QL6UEG3U.js +27 -0
- package/dist/chunk-QN7NIX7D.mjs +82 -0
- package/dist/chunk-QORSSZX4.js +144 -0
- package/dist/chunk-R4JSBXGG.js +12 -0
- package/dist/chunk-R5BQHZWB.js +698 -0
- package/dist/chunk-R7MS42PL.js +90 -0
- package/dist/chunk-RTQNWZN4.mjs +405 -0
- package/dist/chunk-SIVJX7VU.mjs +16 -0
- package/dist/chunk-SJ5RFU2O.mjs +17 -0
- package/dist/chunk-T4TJJMLM.mjs +34 -0
- package/dist/chunk-TB2UHDOZ.js +19 -0
- package/dist/chunk-TBIEWDY5.js +175 -0
- package/dist/chunk-TJFS44SH.js +48 -0
- package/dist/chunk-TR246HQP.mjs +69 -0
- package/dist/chunk-TZ26HQAW.js +85 -0
- package/dist/chunk-U4ZVEPYD.js +71 -0
- package/dist/chunk-UFAXJVMD.js +120 -0
- package/dist/chunk-V2HVHLBY.mjs +83 -0
- package/dist/chunk-VD3IK5XT.mjs +35 -0
- package/dist/chunk-VEGBO77D.mjs +20 -0
- package/dist/chunk-VJJ76I7U.js +19 -0
- package/dist/chunk-VO4WDK4K.js +37 -0
- package/dist/chunk-VSF4DF7N.js +84 -0
- package/dist/chunk-VVO4V4IK.js +56 -0
- package/dist/chunk-W7HUFFPJ.mjs +263 -0
- package/dist/chunk-WDAMDVLU.mjs +106 -0
- package/dist/chunk-WEGU7O4J.mjs +66 -0
- package/dist/chunk-WK5HN4OH.js +113 -0
- package/dist/chunk-WSCSDSV7.mjs +145 -0
- package/dist/chunk-WSJO2PIE.mjs +72 -0
- package/dist/chunk-XDKXL2BP.mjs +188 -0
- package/dist/chunk-XS5JP2KO.mjs +491 -0
- package/dist/chunk-XZDJ5FRB.js +333 -0
- package/dist/chunk-YE2M2HNM.js +168 -0
- package/dist/chunk-YYGTJKP5.js +39 -0
- package/dist/chunk-YYKJ63LD.mjs +497 -0
- package/dist/chunk-Z4Z3I74Q.mjs +166 -0
- package/dist/chunk-ZO4XVOHU.mjs +45 -0
- package/dist/chunk-ZREFCRX3.js +52 -0
- package/dist/components/Alert.d.mts +24 -0
- package/dist/components/Alert.d.ts +24 -0
- package/dist/components/Alert.js +10 -0
- package/dist/components/Alert.mjs +1 -0
- package/dist/components/Avatar.d.mts +12 -0
- package/dist/components/Avatar.d.ts +12 -0
- package/dist/components/Avatar.js +10 -0
- package/dist/components/Avatar.mjs +1 -0
- package/dist/components/Badge.d.mts +12 -0
- package/dist/components/Badge.d.ts +12 -0
- package/dist/components/Badge.js +10 -0
- package/dist/components/Badge.mjs +1 -0
- package/dist/components/Breadcrumb.d.mts +13 -0
- package/dist/components/Breadcrumb.d.ts +13 -0
- package/dist/components/Breadcrumb.js +14 -0
- package/dist/components/Breadcrumb.mjs +1 -0
- package/dist/components/BreadcrumbItem.d.mts +21 -0
- package/dist/components/BreadcrumbItem.d.ts +21 -0
- package/dist/components/BreadcrumbItem.js +11 -0
- package/dist/components/BreadcrumbItem.mjs +2 -0
- package/dist/components/Button.d.mts +8 -0
- package/dist/components/Button.d.ts +8 -0
- package/dist/components/Button.js +10 -0
- package/dist/components/Button.mjs +1 -0
- package/dist/components/Card.d.mts +33 -0
- package/dist/components/Card.d.ts +33 -0
- package/dist/components/Card.js +10 -0
- package/dist/components/Card.mjs +1 -0
- package/dist/components/Checkbox.d.mts +48 -0
- package/dist/components/Checkbox.d.ts +48 -0
- package/dist/components/Checkbox.js +11 -0
- package/dist/components/Checkbox.mjs +2 -0
- package/dist/components/CheckboxGroup.d.mts +39 -0
- package/dist/components/CheckboxGroup.d.ts +39 -0
- package/dist/components/CheckboxGroup.js +14 -0
- package/dist/components/CheckboxGroup.mjs +1 -0
- package/dist/components/Col.d.mts +7 -0
- package/dist/components/Col.d.ts +7 -0
- package/dist/components/Col.js +11 -0
- package/dist/components/Col.mjs +2 -0
- package/dist/components/ConfigProvider.d.mts +14 -0
- package/dist/components/ConfigProvider.d.ts +14 -0
- package/dist/components/ConfigProvider.js +14 -0
- package/dist/components/ConfigProvider.mjs +1 -0
- package/dist/components/Container.d.mts +13 -0
- package/dist/components/Container.d.ts +13 -0
- package/dist/components/Container.js +10 -0
- package/dist/components/Container.mjs +1 -0
- package/dist/components/Content.d.mts +9 -0
- package/dist/components/Content.d.ts +9 -0
- package/dist/components/Content.js +10 -0
- package/dist/components/Content.mjs +1 -0
- package/dist/components/DatePicker.d.mts +24 -0
- package/dist/components/DatePicker.d.ts +24 -0
- package/dist/components/DatePicker.js +10 -0
- package/dist/components/DatePicker.mjs +1 -0
- package/dist/components/Descriptions.d.mts +53 -0
- package/dist/components/Descriptions.d.ts +53 -0
- package/dist/components/Descriptions.js +16 -0
- package/dist/components/Descriptions.mjs +1 -0
- package/dist/components/Divider.d.mts +12 -0
- package/dist/components/Divider.d.ts +12 -0
- package/dist/components/Divider.js +10 -0
- package/dist/components/Divider.mjs +1 -0
- package/dist/components/Drawer.d.mts +19 -0
- package/dist/components/Drawer.d.ts +19 -0
- package/dist/components/Drawer.js +11 -0
- package/dist/components/Drawer.mjs +2 -0
- package/dist/components/Dropdown.d.mts +22 -0
- package/dist/components/Dropdown.d.ts +22 -0
- package/dist/components/Dropdown.js +16 -0
- package/dist/components/Dropdown.mjs +3 -0
- package/dist/components/DropdownItem.d.mts +17 -0
- package/dist/components/DropdownItem.d.ts +17 -0
- package/dist/components/DropdownItem.js +13 -0
- package/dist/components/DropdownItem.mjs +4 -0
- package/dist/components/DropdownMenu.d.mts +13 -0
- package/dist/components/DropdownMenu.d.ts +13 -0
- package/dist/components/DropdownMenu.js +10 -0
- package/dist/components/DropdownMenu.mjs +1 -0
- package/dist/components/Footer.d.mts +9 -0
- package/dist/components/Footer.d.ts +9 -0
- package/dist/components/Footer.js +10 -0
- package/dist/components/Footer.mjs +1 -0
- package/dist/components/Form.d.mts +56 -0
- package/dist/components/Form.d.ts +56 -0
- package/dist/components/Form.js +14 -0
- package/dist/components/Form.mjs +1 -0
- package/dist/components/FormItem.d.mts +16 -0
- package/dist/components/FormItem.d.ts +16 -0
- package/dist/components/FormItem.js +11 -0
- package/dist/components/FormItem.mjs +2 -0
- package/dist/components/Header.d.mts +9 -0
- package/dist/components/Header.d.ts +9 -0
- package/dist/components/Header.js +10 -0
- package/dist/components/Header.mjs +1 -0
- package/dist/components/Icon.d.mts +9 -0
- package/dist/components/Icon.d.ts +9 -0
- package/dist/components/Icon.js +10 -0
- package/dist/components/Icon.mjs +1 -0
- package/dist/components/Input.d.mts +28 -0
- package/dist/components/Input.d.ts +28 -0
- package/dist/components/Input.js +10 -0
- package/dist/components/Input.mjs +1 -0
- package/dist/components/Layout.d.mts +9 -0
- package/dist/components/Layout.d.ts +9 -0
- package/dist/components/Layout.js +10 -0
- package/dist/components/Layout.mjs +1 -0
- package/dist/components/Link.d.mts +10 -0
- package/dist/components/Link.d.ts +10 -0
- package/dist/components/Link.js +10 -0
- package/dist/components/Link.mjs +1 -0
- package/dist/components/List.d.mts +94 -0
- package/dist/components/List.d.ts +94 -0
- package/dist/components/List.js +12 -0
- package/dist/components/List.mjs +3 -0
- package/dist/components/Loading.d.mts +8 -0
- package/dist/components/Loading.d.ts +8 -0
- package/dist/components/Loading.js +10 -0
- package/dist/components/Loading.mjs +1 -0
- package/dist/components/Menu.d.mts +35 -0
- package/dist/components/Menu.d.ts +35 -0
- package/dist/components/Menu.js +14 -0
- package/dist/components/Menu.mjs +1 -0
- package/dist/components/MenuItem.d.mts +20 -0
- package/dist/components/MenuItem.d.ts +20 -0
- package/dist/components/MenuItem.js +11 -0
- package/dist/components/MenuItem.mjs +2 -0
- package/dist/components/MenuItemGroup.d.mts +16 -0
- package/dist/components/MenuItemGroup.d.ts +16 -0
- package/dist/components/MenuItemGroup.js +12 -0
- package/dist/components/MenuItemGroup.mjs +3 -0
- package/dist/components/Message.d.mts +44 -0
- package/dist/components/Message.d.ts +44 -0
- package/dist/components/Message.js +20 -0
- package/dist/components/Message.mjs +1 -0
- package/dist/components/Modal.d.mts +41 -0
- package/dist/components/Modal.d.ts +41 -0
- package/dist/components/Modal.js +11 -0
- package/dist/components/Modal.mjs +2 -0
- package/dist/components/Notification.d.mts +40 -0
- package/dist/components/Notification.d.ts +40 -0
- package/dist/components/Notification.js +20 -0
- package/dist/components/Notification.mjs +1 -0
- package/dist/components/Pagination.d.mts +11 -0
- package/dist/components/Pagination.d.ts +11 -0
- package/dist/components/Pagination.js +16 -0
- package/dist/components/Pagination.mjs +1 -0
- package/dist/components/Popconfirm.d.mts +34 -0
- package/dist/components/Popconfirm.d.ts +34 -0
- package/dist/components/Popconfirm.js +10 -0
- package/dist/components/Popconfirm.mjs +1 -0
- package/dist/components/Popover.d.mts +14 -0
- package/dist/components/Popover.d.ts +14 -0
- package/dist/components/Popover.js +10 -0
- package/dist/components/Popover.mjs +1 -0
- package/dist/components/Progress.d.mts +8 -0
- package/dist/components/Progress.d.ts +8 -0
- package/dist/components/Progress.js +10 -0
- package/dist/components/Progress.mjs +1 -0
- package/dist/components/Radio.d.mts +20 -0
- package/dist/components/Radio.d.ts +20 -0
- package/dist/components/Radio.js +11 -0
- package/dist/components/Radio.mjs +2 -0
- package/dist/components/RadioGroup.d.mts +28 -0
- package/dist/components/RadioGroup.d.ts +28 -0
- package/dist/components/RadioGroup.js +14 -0
- package/dist/components/RadioGroup.mjs +1 -0
- package/dist/components/Row.d.mts +11 -0
- package/dist/components/Row.d.ts +11 -0
- package/dist/components/Row.js +14 -0
- package/dist/components/Row.mjs +1 -0
- package/dist/components/Select.d.mts +23 -0
- package/dist/components/Select.d.ts +23 -0
- package/dist/components/Select.js +10 -0
- package/dist/components/Select.mjs +1 -0
- package/dist/components/Sidebar.d.mts +9 -0
- package/dist/components/Sidebar.d.ts +9 -0
- package/dist/components/Sidebar.js +10 -0
- package/dist/components/Sidebar.mjs +1 -0
- package/dist/components/Skeleton.d.mts +7 -0
- package/dist/components/Skeleton.d.ts +7 -0
- package/dist/components/Skeleton.js +10 -0
- package/dist/components/Skeleton.mjs +1 -0
- package/dist/components/Slider.d.mts +12 -0
- package/dist/components/Slider.d.ts +12 -0
- package/dist/components/Slider.js +10 -0
- package/dist/components/Slider.mjs +1 -0
- package/dist/components/Space.d.mts +11 -0
- package/dist/components/Space.d.ts +11 -0
- package/dist/components/Space.js +10 -0
- package/dist/components/Space.mjs +1 -0
- package/dist/components/Steps.d.mts +31 -0
- package/dist/components/Steps.d.ts +31 -0
- package/dist/components/Steps.js +14 -0
- package/dist/components/Steps.mjs +1 -0
- package/dist/components/StepsItem.d.mts +36 -0
- package/dist/components/StepsItem.d.ts +36 -0
- package/dist/components/StepsItem.js +10 -0
- package/dist/components/StepsItem.mjs +1 -0
- package/dist/components/SubMenu.d.mts +20 -0
- package/dist/components/SubMenu.d.ts +20 -0
- package/dist/components/SubMenu.js +13 -0
- package/dist/components/SubMenu.mjs +4 -0
- package/dist/components/Switch.d.mts +12 -0
- package/dist/components/Switch.d.ts +12 -0
- package/dist/components/Switch.js +10 -0
- package/dist/components/Switch.mjs +1 -0
- package/dist/components/TabPane.d.mts +42 -0
- package/dist/components/TabPane.d.ts +42 -0
- package/dist/components/TabPane.js +10 -0
- package/dist/components/TabPane.mjs +1 -0
- package/dist/components/Table.d.mts +46 -0
- package/dist/components/Table.d.ts +46 -0
- package/dist/components/Table.js +10 -0
- package/dist/components/Table.mjs +1 -0
- package/dist/components/Tabs.d.mts +43 -0
- package/dist/components/Tabs.d.ts +43 -0
- package/dist/components/Tabs.js +14 -0
- package/dist/components/Tabs.mjs +1 -0
- package/dist/components/Tag.d.mts +16 -0
- package/dist/components/Tag.d.ts +16 -0
- package/dist/components/Tag.js +10 -0
- package/dist/components/Tag.mjs +1 -0
- package/dist/components/Text.d.mts +9 -0
- package/dist/components/Text.d.ts +9 -0
- package/dist/components/Text.js +10 -0
- package/dist/components/Text.mjs +1 -0
- package/dist/components/Textarea.d.mts +13 -0
- package/dist/components/Textarea.d.ts +13 -0
- package/dist/components/Textarea.js +10 -0
- package/dist/components/Textarea.mjs +1 -0
- package/dist/components/TimePicker.d.mts +28 -0
- package/dist/components/TimePicker.d.ts +28 -0
- package/dist/components/TimePicker.js +10 -0
- package/dist/components/TimePicker.mjs +1 -0
- package/dist/components/Timeline.d.mts +47 -0
- package/dist/components/Timeline.d.ts +47 -0
- package/dist/components/Timeline.js +10 -0
- package/dist/components/Timeline.mjs +1 -0
- package/dist/components/Tooltip.d.mts +15 -0
- package/dist/components/Tooltip.d.ts +15 -0
- package/dist/components/Tooltip.js +10 -0
- package/dist/components/Tooltip.mjs +1 -0
- package/dist/components/Tree.d.mts +154 -0
- package/dist/components/Tree.d.ts +154 -0
- package/dist/components/Tree.js +16 -0
- package/dist/components/Tree.mjs +1 -0
- package/dist/components/Upload.d.mts +16 -0
- package/dist/components/Upload.d.ts +16 -0
- package/dist/components/Upload.js +11 -0
- package/dist/components/Upload.mjs +2 -0
- package/dist/index.d.mts +76 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +359 -0
- package/dist/index.mjs +67 -0
- package/package.json +60 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { classNames, tagBaseClasses, getTagVariantClasses, tagSizeClasses, defaultTagThemeColors, tagCloseButtonBaseClasses, icon24StrokeWidth, icon24ViewBox, tagCloseIconPath, icon24PathStrokeLinejoin, icon24PathStrokeLinecap } from '@expcat/tigercat-core';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/components/Tag.tsx
|
|
6
|
+
var CloseIcon = () => /* @__PURE__ */ jsx(
|
|
7
|
+
"svg",
|
|
8
|
+
{
|
|
9
|
+
className: "h-3 w-3",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
fill: "none",
|
|
12
|
+
viewBox: icon24ViewBox,
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
strokeWidth: icon24StrokeWidth,
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
focusable: "false",
|
|
17
|
+
children: /* @__PURE__ */ jsx(
|
|
18
|
+
"path",
|
|
19
|
+
{
|
|
20
|
+
strokeLinecap: icon24PathStrokeLinecap,
|
|
21
|
+
strokeLinejoin: icon24PathStrokeLinejoin,
|
|
22
|
+
d: tagCloseIconPath
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
var Tag = ({
|
|
28
|
+
variant = "default",
|
|
29
|
+
size = "md",
|
|
30
|
+
closable = false,
|
|
31
|
+
closeAriaLabel = "Close tag",
|
|
32
|
+
onClose,
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) => {
|
|
37
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
38
|
+
const tagClasses = classNames(
|
|
39
|
+
tagBaseClasses,
|
|
40
|
+
getTagVariantClasses(variant),
|
|
41
|
+
tagSizeClasses[size],
|
|
42
|
+
className
|
|
43
|
+
);
|
|
44
|
+
const scheme = defaultTagThemeColors[variant];
|
|
45
|
+
const closeButtonClasses = classNames(tagCloseButtonBaseClasses, scheme.closeBgHover, scheme.text);
|
|
46
|
+
const handleClose = (event) => {
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
onClose?.(event);
|
|
49
|
+
if (!event.defaultPrevented) {
|
|
50
|
+
setIsVisible(false);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
if (!isVisible) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return /* @__PURE__ */ jsxs("span", { className: tagClasses, role: "status", ...props, children: [
|
|
57
|
+
children != null && /* @__PURE__ */ jsx("span", { children }),
|
|
58
|
+
closable && /* @__PURE__ */ jsx(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
className: closeButtonClasses,
|
|
62
|
+
onClick: handleClose,
|
|
63
|
+
"aria-label": closeAriaLabel,
|
|
64
|
+
type: "button",
|
|
65
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] });
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { Tag };
|
|
@@ -0,0 +1,300 @@
|
|
|
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;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { classNames, getDividerOrientationClasses, getDividerLineStyleClasses, getDividerSpacingClasses } from '@expcat/tigercat-core';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/components/Divider.tsx
|
|
6
|
+
var Divider = ({
|
|
7
|
+
orientation = "horizontal",
|
|
8
|
+
lineStyle = "solid",
|
|
9
|
+
spacing = "md",
|
|
10
|
+
color,
|
|
11
|
+
thickness,
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const dividerClasses = useMemo(
|
|
16
|
+
() => classNames(
|
|
17
|
+
getDividerOrientationClasses(orientation),
|
|
18
|
+
getDividerLineStyleClasses(lineStyle),
|
|
19
|
+
getDividerSpacingClasses(spacing, orientation),
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
[orientation, lineStyle, spacing, className]
|
|
23
|
+
);
|
|
24
|
+
const dividerStyle = useMemo(() => {
|
|
25
|
+
const style = {};
|
|
26
|
+
if (color) {
|
|
27
|
+
style.borderColor = color;
|
|
28
|
+
}
|
|
29
|
+
if (thickness) {
|
|
30
|
+
if (orientation === "horizontal") {
|
|
31
|
+
style.borderTopWidth = thickness;
|
|
32
|
+
} else {
|
|
33
|
+
style.borderLeftWidth = thickness;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return style;
|
|
37
|
+
}, [color, thickness, orientation]);
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
...props,
|
|
42
|
+
className: dividerClasses,
|
|
43
|
+
style: dividerStyle,
|
|
44
|
+
role: "separator",
|
|
45
|
+
"aria-orientation": orientation
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { Divider };
|
|
@@ -0,0 +1,37 @@
|
|
|
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;
|
|
@@ -0,0 +1,205 @@
|
|
|
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
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
10
|
+
|
|
11
|
+
// src/components/Popconfirm.tsx
|
|
12
|
+
var popconfirmIdCounter = 0;
|
|
13
|
+
var createPopconfirmId = () => `tiger-popconfirm-${++popconfirmIdCounter}`;
|
|
14
|
+
var PopconfirmIcon = ({ type }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
+
"svg",
|
|
16
|
+
{
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
fill: "none",
|
|
19
|
+
viewBox: tigercatCore.popconfirmIconViewBox,
|
|
20
|
+
strokeWidth: tigercatCore.popconfirmIconStrokeWidth,
|
|
21
|
+
stroke: "currentColor",
|
|
22
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23
|
+
"path",
|
|
24
|
+
{
|
|
25
|
+
strokeLinecap: tigercatCore.popconfirmIconPathStrokeLinecap,
|
|
26
|
+
strokeLinejoin: tigercatCore.popconfirmIconPathStrokeLinejoin,
|
|
27
|
+
d: tigercatCore.getPopconfirmIconPath(type)
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
var Popconfirm = ({
|
|
33
|
+
visible,
|
|
34
|
+
defaultVisible = false,
|
|
35
|
+
title = "\u786E\u5B9A\u8981\u6267\u884C\u6B64\u64CD\u4F5C\u5417\uFF1F",
|
|
36
|
+
description,
|
|
37
|
+
icon = "warning",
|
|
38
|
+
showIcon = true,
|
|
39
|
+
okText = "\u786E\u5B9A",
|
|
40
|
+
cancelText = "\u53D6\u6D88",
|
|
41
|
+
okType = "primary",
|
|
42
|
+
placement = "top",
|
|
43
|
+
disabled = false,
|
|
44
|
+
className,
|
|
45
|
+
style,
|
|
46
|
+
children,
|
|
47
|
+
titleContent,
|
|
48
|
+
descriptionContent,
|
|
49
|
+
onVisibleChange,
|
|
50
|
+
onConfirm,
|
|
51
|
+
onCancel,
|
|
52
|
+
...divProps
|
|
53
|
+
}) => {
|
|
54
|
+
const isControlled = visible !== void 0;
|
|
55
|
+
const [internalVisible, setInternalVisible] = React.useState(defaultVisible);
|
|
56
|
+
const currentVisible = isControlled ? visible : internalVisible;
|
|
57
|
+
const containerRef = React.useRef(null);
|
|
58
|
+
const popconfirmIdRef = React.useRef(null);
|
|
59
|
+
if (!popconfirmIdRef.current) {
|
|
60
|
+
popconfirmIdRef.current = createPopconfirmId();
|
|
61
|
+
}
|
|
62
|
+
const popconfirmId = popconfirmIdRef.current;
|
|
63
|
+
const titleId = `${popconfirmId}-title`;
|
|
64
|
+
const descriptionId = `${popconfirmId}-description`;
|
|
65
|
+
const describedBy = description || descriptionContent ? descriptionId : void 0;
|
|
66
|
+
const setVisible = (newVisible) => {
|
|
67
|
+
if (disabled && newVisible) return;
|
|
68
|
+
if (!isControlled) {
|
|
69
|
+
setInternalVisible(newVisible);
|
|
70
|
+
}
|
|
71
|
+
onVisibleChange?.(newVisible);
|
|
72
|
+
};
|
|
73
|
+
const handleConfirm = () => {
|
|
74
|
+
onConfirm?.();
|
|
75
|
+
setVisible(false);
|
|
76
|
+
};
|
|
77
|
+
const handleCancel = () => {
|
|
78
|
+
onCancel?.();
|
|
79
|
+
setVisible(false);
|
|
80
|
+
};
|
|
81
|
+
const handleTriggerClick = () => {
|
|
82
|
+
if (disabled) return;
|
|
83
|
+
setVisible(!currentVisible);
|
|
84
|
+
};
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
if (!currentVisible) return;
|
|
87
|
+
const handleClickOutside = (event) => {
|
|
88
|
+
const target = event.target;
|
|
89
|
+
if (!target) return;
|
|
90
|
+
if (containerRef.current?.contains(target)) return;
|
|
91
|
+
setVisible(false);
|
|
92
|
+
};
|
|
93
|
+
const timeoutId = window.setTimeout(() => {
|
|
94
|
+
document.addEventListener("click", handleClickOutside);
|
|
95
|
+
}, 0);
|
|
96
|
+
return () => {
|
|
97
|
+
clearTimeout(timeoutId);
|
|
98
|
+
document.removeEventListener("click", handleClickOutside);
|
|
99
|
+
};
|
|
100
|
+
}, [currentVisible]);
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
if (!currentVisible) return;
|
|
103
|
+
const handleKeyDown = (event) => {
|
|
104
|
+
if (event.key !== "Escape") return;
|
|
105
|
+
setVisible(false);
|
|
106
|
+
};
|
|
107
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
108
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
109
|
+
}, [currentVisible]);
|
|
110
|
+
const containerClasses = React.useMemo(
|
|
111
|
+
() => tigercatCore.classNames(tigercatCore.getPopconfirmContainerClasses(), className),
|
|
112
|
+
[className]
|
|
113
|
+
);
|
|
114
|
+
const triggerClasses = React.useMemo(() => tigercatCore.getPopconfirmTriggerClasses(disabled), [disabled]);
|
|
115
|
+
const contentWrapperClasses = React.useMemo(
|
|
116
|
+
() => tigercatCore.getDropdownMenuWrapperClasses(Boolean(currentVisible), placement),
|
|
117
|
+
[currentVisible, placement]
|
|
118
|
+
);
|
|
119
|
+
const arrowClasses = React.useMemo(() => tigercatCore.getPopconfirmArrowClasses(placement), [placement]);
|
|
120
|
+
const contentClasses = React.useMemo(() => tigercatCore.getPopconfirmContentClasses(), []);
|
|
121
|
+
const titleClasses = React.useMemo(() => tigercatCore.getPopconfirmTitleClasses(), []);
|
|
122
|
+
const descriptionClasses = React.useMemo(() => tigercatCore.getPopconfirmDescriptionClasses(), []);
|
|
123
|
+
const iconClasses = React.useMemo(() => tigercatCore.getPopconfirmIconClasses(icon), [icon]);
|
|
124
|
+
const buttonsClasses = React.useMemo(() => tigercatCore.getPopconfirmButtonsClasses(), []);
|
|
125
|
+
const cancelButtonClasses = React.useMemo(() => tigercatCore.getPopconfirmCancelButtonClasses(), []);
|
|
126
|
+
const okButtonClasses = React.useMemo(() => tigercatCore.getPopconfirmOkButtonClasses(okType), [okType]);
|
|
127
|
+
if (!children) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const mergedStyle = tigercatCore.mergeStyleValues(style);
|
|
131
|
+
const triggerProps = {
|
|
132
|
+
className: triggerClasses,
|
|
133
|
+
onClick: (event) => {
|
|
134
|
+
const target = children;
|
|
135
|
+
if (React__default.default.isValidElement(target)) {
|
|
136
|
+
const onChildClick = target.props.onClick;
|
|
137
|
+
if (typeof onChildClick === "function") {
|
|
138
|
+
onChildClick(event);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (event.defaultPrevented) return;
|
|
142
|
+
handleTriggerClick();
|
|
143
|
+
},
|
|
144
|
+
"aria-haspopup": "dialog",
|
|
145
|
+
"aria-expanded": Boolean(currentVisible),
|
|
146
|
+
"aria-controls": currentVisible ? popconfirmId : void 0
|
|
147
|
+
};
|
|
148
|
+
const triggerNode = (() => {
|
|
149
|
+
if (React__default.default.isValidElement(children)) {
|
|
150
|
+
return React__default.default.cloneElement(children, {
|
|
151
|
+
...triggerProps,
|
|
152
|
+
className: tigercatCore.classNames(children.props.className, triggerProps.className)
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
...triggerProps,
|
|
159
|
+
role: "button",
|
|
160
|
+
tabIndex: disabled ? -1 : 0,
|
|
161
|
+
"aria-disabled": disabled,
|
|
162
|
+
onKeyDown: (event) => {
|
|
163
|
+
if (disabled) return;
|
|
164
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
handleTriggerClick();
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
children
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
})();
|
|
173
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: containerClasses, style: mergedStyle, ...divProps, children: [
|
|
174
|
+
triggerNode,
|
|
175
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: contentWrapperClasses, hidden: !currentVisible, "aria-hidden": !currentVisible, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
176
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: arrowClasses, "aria-hidden": "true" }),
|
|
177
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
id: popconfirmId,
|
|
181
|
+
role: "dialog",
|
|
182
|
+
"aria-modal": "false",
|
|
183
|
+
"aria-labelledby": titleId,
|
|
184
|
+
"aria-describedby": describedBy,
|
|
185
|
+
className: contentClasses,
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start", children: [
|
|
188
|
+
showIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: iconClasses, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(PopconfirmIcon, { type: icon }) }),
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { id: titleId, className: titleClasses, children: titleContent || title }),
|
|
191
|
+
(description || descriptionContent) && /* @__PURE__ */ jsxRuntime.jsx("div", { id: descriptionId, className: descriptionClasses, children: descriptionContent || description })
|
|
192
|
+
] })
|
|
193
|
+
] }),
|
|
194
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: buttonsClasses, children: [
|
|
195
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: cancelButtonClasses, onClick: handleCancel, children: cancelText }),
|
|
196
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: okButtonClasses, onClick: handleConfirm, children: okText })
|
|
197
|
+
] })
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
] }) })
|
|
202
|
+
] });
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
exports.Popconfirm = Popconfirm;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
// src/components/DropdownMenu.tsx
|
|
7
|
+
var DropdownMenu = ({
|
|
8
|
+
className,
|
|
9
|
+
style,
|
|
10
|
+
children,
|
|
11
|
+
role,
|
|
12
|
+
...divProps
|
|
13
|
+
}) => {
|
|
14
|
+
const menuClasses = tigercatCore.classNames(tigercatCore.getDropdownMenuClasses(), className);
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: menuClasses, style, role: role ?? "menu", ...divProps, children });
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.DropdownMenu = DropdownMenu;
|