@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,184 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
4
|
+
var React = require('react');
|
|
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/StepsItem.tsx
|
|
12
|
+
var StepsContext = React.createContext(null);
|
|
13
|
+
function useStepsContext() {
|
|
14
|
+
return React.useContext(StepsContext);
|
|
15
|
+
}
|
|
16
|
+
var Steps = ({
|
|
17
|
+
current = 0,
|
|
18
|
+
status = "process",
|
|
19
|
+
direction = "horizontal",
|
|
20
|
+
size = "default",
|
|
21
|
+
simple = false,
|
|
22
|
+
clickable = false,
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
onChange,
|
|
26
|
+
children,
|
|
27
|
+
...props
|
|
28
|
+
}) => {
|
|
29
|
+
const containerClasses = tigercatCore.classNames(tigercatCore.getStepsContainerClasses(direction), className);
|
|
30
|
+
const handleStepClick = (index) => {
|
|
31
|
+
if (!clickable) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
onChange?.(index);
|
|
35
|
+
};
|
|
36
|
+
const contextValue = {
|
|
37
|
+
current,
|
|
38
|
+
status,
|
|
39
|
+
direction,
|
|
40
|
+
size,
|
|
41
|
+
simple,
|
|
42
|
+
clickable,
|
|
43
|
+
handleStepClick: clickable ? handleStepClick : void 0
|
|
44
|
+
};
|
|
45
|
+
const totalCount = React__default.default.Children.count(children);
|
|
46
|
+
const stepsWithProps = React__default.default.Children.map(children, (child, index) => {
|
|
47
|
+
if (React__default.default.isValidElement(child) && child.type === StepsItem) {
|
|
48
|
+
return React__default.default.cloneElement(child, {
|
|
49
|
+
stepIndex: index,
|
|
50
|
+
isLast: index === totalCount - 1
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return child;
|
|
54
|
+
});
|
|
55
|
+
const mergedStyle = {
|
|
56
|
+
...style ?? {}
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StepsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: containerClasses, style: mergedStyle, children: stepsWithProps }) });
|
|
59
|
+
};
|
|
60
|
+
var StepsItem = ({
|
|
61
|
+
title,
|
|
62
|
+
description,
|
|
63
|
+
icon,
|
|
64
|
+
status: customStatus,
|
|
65
|
+
disabled = false,
|
|
66
|
+
stepIndex = 0,
|
|
67
|
+
isLast = false,
|
|
68
|
+
className,
|
|
69
|
+
style,
|
|
70
|
+
...props
|
|
71
|
+
}) => {
|
|
72
|
+
const stepsContext = useStepsContext() || {
|
|
73
|
+
current: 0,
|
|
74
|
+
status: "process",
|
|
75
|
+
direction: "horizontal",
|
|
76
|
+
size: "default",
|
|
77
|
+
simple: false,
|
|
78
|
+
clickable: false
|
|
79
|
+
};
|
|
80
|
+
const stepStatus = tigercatCore.calculateStepStatus(
|
|
81
|
+
stepIndex,
|
|
82
|
+
stepsContext.current,
|
|
83
|
+
stepsContext.status,
|
|
84
|
+
customStatus
|
|
85
|
+
);
|
|
86
|
+
const isClickable = !!stepsContext.handleStepClick && !disabled;
|
|
87
|
+
const itemClasses = tigercatCore.classNames(
|
|
88
|
+
tigercatCore.getStepItemClasses(stepsContext.direction, isLast, stepsContext.simple),
|
|
89
|
+
className
|
|
90
|
+
);
|
|
91
|
+
const iconClasses = tigercatCore.getStepIconClasses(stepStatus, stepsContext.size, stepsContext.simple, !!icon);
|
|
92
|
+
const tailClasses = tigercatCore.getStepTailClasses(stepsContext.direction, stepStatus, isLast);
|
|
93
|
+
const contentClasses = tigercatCore.getStepContentClasses(stepsContext.direction, stepsContext.simple);
|
|
94
|
+
const titleClasses = tigercatCore.getStepTitleClasses(stepStatus, stepsContext.size, isClickable);
|
|
95
|
+
const descriptionClasses = tigercatCore.getStepDescriptionClasses(stepStatus, stepsContext.size);
|
|
96
|
+
const handleClick = (event) => {
|
|
97
|
+
if (!isClickable) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
stepsContext.handleStepClick?.(stepIndex);
|
|
101
|
+
};
|
|
102
|
+
const renderIcon = () => {
|
|
103
|
+
if (icon) {
|
|
104
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: iconClasses, children: icon });
|
|
105
|
+
}
|
|
106
|
+
if (stepStatus === "finish") {
|
|
107
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: iconClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
+
"svg",
|
|
109
|
+
{
|
|
110
|
+
className: tigercatCore.stepFinishIconSvgClasses,
|
|
111
|
+
fill: "none",
|
|
112
|
+
stroke: "currentColor",
|
|
113
|
+
viewBox: tigercatCore.stepFinishIconViewBox,
|
|
114
|
+
"aria-hidden": "true",
|
|
115
|
+
focusable: "false",
|
|
116
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
117
|
+
"path",
|
|
118
|
+
{
|
|
119
|
+
strokeLinecap: tigercatCore.stepFinishIconPathStrokeLinecap,
|
|
120
|
+
strokeLinejoin: tigercatCore.stepFinishIconPathStrokeLinejoin,
|
|
121
|
+
strokeWidth: tigercatCore.stepFinishIconPathStrokeWidth,
|
|
122
|
+
d: tigercatCore.stepFinishIconPathD
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
) });
|
|
127
|
+
}
|
|
128
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: iconClasses, children: stepIndex + 1 });
|
|
129
|
+
};
|
|
130
|
+
const renderContent = () => {
|
|
131
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: contentClasses, children: [
|
|
132
|
+
stepsContext.clickable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
133
|
+
"button",
|
|
134
|
+
{
|
|
135
|
+
type: "button",
|
|
136
|
+
className: titleClasses,
|
|
137
|
+
onClick: handleClick,
|
|
138
|
+
disabled: !isClickable,
|
|
139
|
+
"aria-disabled": disabled || void 0,
|
|
140
|
+
children: title
|
|
141
|
+
}
|
|
142
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: titleClasses, children: title }),
|
|
143
|
+
!stepsContext.simple && description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: descriptionClasses, children: description })
|
|
144
|
+
] });
|
|
145
|
+
};
|
|
146
|
+
if (stepsContext.direction === "vertical") {
|
|
147
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
148
|
+
"li",
|
|
149
|
+
{
|
|
150
|
+
...props,
|
|
151
|
+
className: itemClasses,
|
|
152
|
+
style,
|
|
153
|
+
"aria-current": stepIndex === stepsContext.current ? "step" : void 0,
|
|
154
|
+
"aria-disabled": disabled || void 0,
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
157
|
+
renderIcon(),
|
|
158
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: tailClasses })
|
|
159
|
+
] }),
|
|
160
|
+
renderContent()
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
166
|
+
"li",
|
|
167
|
+
{
|
|
168
|
+
...props,
|
|
169
|
+
className: itemClasses,
|
|
170
|
+
style,
|
|
171
|
+
"aria-current": stepIndex === stepsContext.current ? "step" : void 0,
|
|
172
|
+
"aria-disabled": disabled || void 0,
|
|
173
|
+
children: [
|
|
174
|
+
renderIcon(),
|
|
175
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: tailClasses }),
|
|
176
|
+
renderContent()
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
exports.Steps = Steps;
|
|
183
|
+
exports.StepsItem = StepsItem;
|
|
184
|
+
exports.useStepsContext = useStepsContext;
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import React, { createContext, useContext, useId, useMemo, useState, useCallback } from 'react';
|
|
2
|
+
import { classNames, getTabsContainerClasses, getTabNavClasses, getTabNavListClasses, tabContentBaseClasses, isKeyActive, getTabItemClasses, getTabPaneClasses, tabCloseButtonClasses, closeIconViewBox, closeIconPathD, closeIconPathStrokeWidth, closeIconPathStrokeLinejoin, closeIconPathStrokeLinecap, tabAddButtonClasses } from '@expcat/tigercat-core';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/components/TabPane.tsx
|
|
6
|
+
var TabsContext = createContext(null);
|
|
7
|
+
function useTabsContext() {
|
|
8
|
+
return useContext(TabsContext);
|
|
9
|
+
}
|
|
10
|
+
var Tabs = ({
|
|
11
|
+
activeKey: controlledActiveKey,
|
|
12
|
+
defaultActiveKey,
|
|
13
|
+
type = "line",
|
|
14
|
+
tabPosition = "top",
|
|
15
|
+
size = "medium",
|
|
16
|
+
closable = false,
|
|
17
|
+
centered = false,
|
|
18
|
+
destroyInactiveTabPane = false,
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
onChange,
|
|
22
|
+
onTabClick,
|
|
23
|
+
onEdit,
|
|
24
|
+
children
|
|
25
|
+
}) => {
|
|
26
|
+
const reactId = useId();
|
|
27
|
+
const idBase = useMemo(() => `tiger-tabs-${reactId.replace(/[^a-zA-Z0-9_-]/g, "")}`, [reactId]);
|
|
28
|
+
const [internalActiveKey, setInternalActiveKey] = useState(
|
|
29
|
+
defaultActiveKey
|
|
30
|
+
);
|
|
31
|
+
const containerClasses = useMemo(() => {
|
|
32
|
+
return classNames(getTabsContainerClasses(tabPosition), className);
|
|
33
|
+
}, [tabPosition, className]);
|
|
34
|
+
const tabNavClasses = useMemo(() => {
|
|
35
|
+
return getTabNavClasses(tabPosition, type);
|
|
36
|
+
}, [tabPosition, type]);
|
|
37
|
+
const tabNavListClasses = useMemo(() => {
|
|
38
|
+
return getTabNavListClasses(tabPosition, centered);
|
|
39
|
+
}, [tabPosition, centered]);
|
|
40
|
+
const tabContentClasses = useMemo(() => {
|
|
41
|
+
return tabContentBaseClasses;
|
|
42
|
+
}, []);
|
|
43
|
+
const { tabItems, tabPanes, firstTabKey } = useMemo(() => {
|
|
44
|
+
const items = [];
|
|
45
|
+
const panes = [];
|
|
46
|
+
let firstKey;
|
|
47
|
+
const childrenArray = [];
|
|
48
|
+
React.Children.forEach(children, (child) => {
|
|
49
|
+
if (React.isValidElement(child) && child.type === TabPane) {
|
|
50
|
+
childrenArray.push(child);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const resolvedFirstKey = childrenArray[0]?.props.tabKey;
|
|
54
|
+
if (resolvedFirstKey !== void 0) {
|
|
55
|
+
firstKey = resolvedFirstKey;
|
|
56
|
+
}
|
|
57
|
+
const resolvedActiveKey = controlledActiveKey !== void 0 ? controlledActiveKey : defaultActiveKey !== void 0 ? defaultActiveKey : firstKey;
|
|
58
|
+
childrenArray.forEach((child) => {
|
|
59
|
+
if (React.isValidElement(child) && child.type === TabPane) {
|
|
60
|
+
const key = child.props.tabKey;
|
|
61
|
+
const tabId = `${idBase}-tab-${String(key)}`;
|
|
62
|
+
const panelId = `${idBase}-panel-${String(key)}`;
|
|
63
|
+
items.push(
|
|
64
|
+
React.cloneElement(child, {
|
|
65
|
+
renderMode: "tab",
|
|
66
|
+
tabId,
|
|
67
|
+
panelId,
|
|
68
|
+
tabIndex: key === resolvedActiveKey ? 0 : -1
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
panes.push(React.cloneElement(child, { renderMode: "pane", tabId, panelId }));
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return { tabItems: items, tabPanes: panes, firstTabKey: firstKey };
|
|
75
|
+
}, [children, controlledActiveKey, defaultActiveKey, idBase]);
|
|
76
|
+
const activeKey = controlledActiveKey !== void 0 ? controlledActiveKey : internalActiveKey !== void 0 ? internalActiveKey : firstTabKey;
|
|
77
|
+
const handleTabClick = useCallback(
|
|
78
|
+
(key) => {
|
|
79
|
+
onTabClick?.(key);
|
|
80
|
+
if (key === activeKey) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (controlledActiveKey === void 0) {
|
|
84
|
+
setInternalActiveKey(key);
|
|
85
|
+
}
|
|
86
|
+
onChange?.(key);
|
|
87
|
+
},
|
|
88
|
+
[activeKey, controlledActiveKey, onChange, onTabClick]
|
|
89
|
+
);
|
|
90
|
+
const handleTabClose = useCallback(
|
|
91
|
+
(key, event) => {
|
|
92
|
+
event.stopPropagation();
|
|
93
|
+
onEdit?.({ targetKey: key, action: "remove" });
|
|
94
|
+
},
|
|
95
|
+
[onEdit]
|
|
96
|
+
);
|
|
97
|
+
const handleTabAdd = useCallback(() => {
|
|
98
|
+
onEdit?.({ targetKey: void 0, action: "add" });
|
|
99
|
+
}, [onEdit]);
|
|
100
|
+
const contextValue = useMemo(
|
|
101
|
+
() => ({
|
|
102
|
+
activeKey,
|
|
103
|
+
type,
|
|
104
|
+
size,
|
|
105
|
+
tabPosition,
|
|
106
|
+
closable,
|
|
107
|
+
destroyInactiveTabPane,
|
|
108
|
+
idBase,
|
|
109
|
+
handleTabClick,
|
|
110
|
+
handleTabClose
|
|
111
|
+
}),
|
|
112
|
+
[
|
|
113
|
+
activeKey,
|
|
114
|
+
type,
|
|
115
|
+
size,
|
|
116
|
+
tabPosition,
|
|
117
|
+
closable,
|
|
118
|
+
destroyInactiveTabPane,
|
|
119
|
+
idBase,
|
|
120
|
+
handleTabClick,
|
|
121
|
+
handleTabClose
|
|
122
|
+
]
|
|
123
|
+
);
|
|
124
|
+
const tabNavContent = /* @__PURE__ */ jsx("div", { className: tabNavClasses, role: "tablist", children: /* @__PURE__ */ jsxs("div", { className: tabNavListClasses, children: [
|
|
125
|
+
tabItems,
|
|
126
|
+
type === "editable-card" && /* @__PURE__ */ jsx(
|
|
127
|
+
"button",
|
|
128
|
+
{
|
|
129
|
+
type: "button",
|
|
130
|
+
className: tabAddButtonClasses,
|
|
131
|
+
onClick: handleTabAdd,
|
|
132
|
+
"aria-label": "Add tab",
|
|
133
|
+
children: "+"
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] }) });
|
|
137
|
+
const tabContent = /* @__PURE__ */ jsx("div", { className: tabContentClasses, children: tabPanes });
|
|
138
|
+
let content;
|
|
139
|
+
if (tabPosition === "left" || tabPosition === "right") {
|
|
140
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
141
|
+
tabNavContent,
|
|
142
|
+
tabContent
|
|
143
|
+
] });
|
|
144
|
+
} else if (tabPosition === "bottom") {
|
|
145
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
146
|
+
tabContent,
|
|
147
|
+
tabNavContent
|
|
148
|
+
] });
|
|
149
|
+
} else {
|
|
150
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
151
|
+
tabNavContent,
|
|
152
|
+
tabContent
|
|
153
|
+
] });
|
|
154
|
+
}
|
|
155
|
+
return /* @__PURE__ */ jsx(TabsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { className: containerClasses, style, children: content }) });
|
|
156
|
+
};
|
|
157
|
+
var TabPane = ({
|
|
158
|
+
tabKey,
|
|
159
|
+
label,
|
|
160
|
+
disabled = false,
|
|
161
|
+
closable,
|
|
162
|
+
icon,
|
|
163
|
+
className,
|
|
164
|
+
style,
|
|
165
|
+
children,
|
|
166
|
+
renderMode = "pane",
|
|
167
|
+
tabId,
|
|
168
|
+
panelId,
|
|
169
|
+
tabIndex
|
|
170
|
+
}) => {
|
|
171
|
+
const tabsContext = useTabsContext();
|
|
172
|
+
if (!tabsContext) {
|
|
173
|
+
throw new Error("TabPane must be used within a Tabs component");
|
|
174
|
+
}
|
|
175
|
+
const isActive = useMemo(() => {
|
|
176
|
+
return isKeyActive(tabKey, tabsContext.activeKey);
|
|
177
|
+
}, [tabKey, tabsContext.activeKey]);
|
|
178
|
+
const isClosable = useMemo(() => {
|
|
179
|
+
return closable !== void 0 ? closable : tabsContext.closable && tabsContext.type === "editable-card";
|
|
180
|
+
}, [closable, tabsContext.closable, tabsContext.type]);
|
|
181
|
+
const tabItemClasses = useMemo(() => {
|
|
182
|
+
return classNames(getTabItemClasses(isActive, disabled, tabsContext.type, tabsContext.size));
|
|
183
|
+
}, [isActive, disabled, tabsContext.type, tabsContext.size]);
|
|
184
|
+
const tabPaneClasses = useMemo(() => {
|
|
185
|
+
return classNames(getTabPaneClasses(isActive), className);
|
|
186
|
+
}, [isActive, className]);
|
|
187
|
+
const handleClick = () => {
|
|
188
|
+
if (!disabled) {
|
|
189
|
+
tabsContext.handleTabClick(tabKey);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const handleKeyDown = (event) => {
|
|
193
|
+
if (disabled) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (isClosable && (event.key === "Backspace" || event.key === "Delete")) {
|
|
197
|
+
event.preventDefault();
|
|
198
|
+
tabsContext.handleTabClose(tabKey, event);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const isVertical = tabsContext.tabPosition === "left" || tabsContext.tabPosition === "right";
|
|
202
|
+
const nextKeys = isVertical ? ["ArrowDown"] : ["ArrowRight"];
|
|
203
|
+
const prevKeys = isVertical ? ["ArrowUp"] : ["ArrowLeft"];
|
|
204
|
+
const key = event.key;
|
|
205
|
+
if (nextKeys.includes(key) || prevKeys.includes(key) || key === "Home" || key === "End" || key === "Enter" || key === " ") {
|
|
206
|
+
event.preventDefault();
|
|
207
|
+
}
|
|
208
|
+
if (key === "Enter" || key === " ") {
|
|
209
|
+
tabsContext.handleTabClick(tabKey);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const tabList = event.currentTarget?.closest('[role="tablist"]');
|
|
213
|
+
const tabButtons = Array.from(
|
|
214
|
+
tabList?.querySelectorAll('[role="tab"]') ?? []
|
|
215
|
+
);
|
|
216
|
+
const enabled = tabButtons.filter((b) => !b.disabled);
|
|
217
|
+
const currentIndex = enabled.findIndex((b) => b.id === tabId);
|
|
218
|
+
if (currentIndex === -1) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const focusByIndex = (index) => {
|
|
222
|
+
const next = enabled[index];
|
|
223
|
+
if (!next) return;
|
|
224
|
+
next.focus();
|
|
225
|
+
const nextKey = next.getAttribute("data-tiger-tab-key");
|
|
226
|
+
if (nextKey != null) {
|
|
227
|
+
const parsed = nextKey.startsWith("n:") ? Number(nextKey.slice(2)) : nextKey.startsWith("s:") ? nextKey.slice(2) : nextKey;
|
|
228
|
+
tabsContext.handleTabClick(parsed);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
if (nextKeys.includes(key)) {
|
|
232
|
+
focusByIndex((currentIndex + 1) % enabled.length);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (prevKeys.includes(key)) {
|
|
236
|
+
focusByIndex((currentIndex - 1 + enabled.length) % enabled.length);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (key === "Home") {
|
|
240
|
+
focusByIndex(0);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (key === "End") {
|
|
244
|
+
focusByIndex(enabled.length - 1);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
const handleClose = (event) => {
|
|
248
|
+
if (!disabled) {
|
|
249
|
+
tabsContext.handleTabClose(tabKey, event);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
if (renderMode === "tab") {
|
|
253
|
+
return /* @__PURE__ */ jsxs(
|
|
254
|
+
"button",
|
|
255
|
+
{
|
|
256
|
+
type: "button",
|
|
257
|
+
className: tabItemClasses,
|
|
258
|
+
role: "tab",
|
|
259
|
+
id: tabId,
|
|
260
|
+
"aria-controls": panelId,
|
|
261
|
+
"aria-selected": isActive,
|
|
262
|
+
"aria-disabled": disabled,
|
|
263
|
+
disabled,
|
|
264
|
+
tabIndex: typeof tabIndex === "number" ? tabIndex : isActive ? 0 : -1,
|
|
265
|
+
"data-tiger-tabs-id": tabsContext.idBase,
|
|
266
|
+
"data-tiger-tab-key": typeof tabKey === "number" ? `n:${tabKey}` : `s:${tabKey}`,
|
|
267
|
+
onClick: handleClick,
|
|
268
|
+
onKeyDown: handleKeyDown,
|
|
269
|
+
children: [
|
|
270
|
+
icon && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: icon }),
|
|
271
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
272
|
+
isClosable && /* @__PURE__ */ jsx(
|
|
273
|
+
"button",
|
|
274
|
+
{
|
|
275
|
+
type: "button",
|
|
276
|
+
className: tabCloseButtonClasses,
|
|
277
|
+
"aria-label": `Close ${String(label)}`,
|
|
278
|
+
tabIndex: -1,
|
|
279
|
+
onClick: handleClose,
|
|
280
|
+
children: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: closeIconViewBox, children: /* @__PURE__ */ jsx(
|
|
281
|
+
"path",
|
|
282
|
+
{
|
|
283
|
+
strokeLinecap: closeIconPathStrokeLinecap,
|
|
284
|
+
strokeLinejoin: closeIconPathStrokeLinejoin,
|
|
285
|
+
strokeWidth: closeIconPathStrokeWidth,
|
|
286
|
+
d: closeIconPathD
|
|
287
|
+
}
|
|
288
|
+
) })
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
const shouldRender = isActive || !tabsContext.destroyInactiveTabPane;
|
|
296
|
+
if (!shouldRender) {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
return /* @__PURE__ */ jsx(
|
|
300
|
+
"div",
|
|
301
|
+
{
|
|
302
|
+
className: tabPaneClasses,
|
|
303
|
+
style,
|
|
304
|
+
role: "tabpanel",
|
|
305
|
+
id: panelId,
|
|
306
|
+
"aria-labelledby": tabId,
|
|
307
|
+
"aria-hidden": !isActive,
|
|
308
|
+
children
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
export { TabPane, Tabs, useTabsContext };
|