@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,20 @@
|
|
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
|
2
|
+
import { mergeTigerLocale } from '@expcat/tigercat-core';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/components/ConfigProvider.tsx
|
|
6
|
+
var TigerConfigContext = React.createContext({});
|
|
7
|
+
var ConfigProvider = ({ locale, children }) => {
|
|
8
|
+
const parent = useContext(TigerConfigContext);
|
|
9
|
+
const value = useMemo(() => {
|
|
10
|
+
return {
|
|
11
|
+
locale: mergeTigerLocale(parent.locale, locale)
|
|
12
|
+
};
|
|
13
|
+
}, [parent.locale, locale]);
|
|
14
|
+
return /* @__PURE__ */ jsx(TigerConfigContext.Provider, { value, children });
|
|
15
|
+
};
|
|
16
|
+
function useTigerConfig() {
|
|
17
|
+
return useContext(TigerConfigContext);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { ConfigProvider, useTigerConfig };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
// src/components/Header.tsx
|
|
7
|
+
var Header = ({
|
|
8
|
+
className,
|
|
9
|
+
height = "64px",
|
|
10
|
+
style,
|
|
11
|
+
children,
|
|
12
|
+
...props
|
|
13
|
+
}) => {
|
|
14
|
+
const headerClasses = tigercatCore.classNames(tigercatCore.layoutHeaderClasses, className);
|
|
15
|
+
const headerStyle = { ...style, height };
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx("header", { className: headerClasses, style: headerStyle, ...props, children });
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.Header = Header;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
// src/components/Card.tsx
|
|
7
|
+
var Card = ({
|
|
8
|
+
variant = "default",
|
|
9
|
+
size = "md",
|
|
10
|
+
hoverable = false,
|
|
11
|
+
cover,
|
|
12
|
+
coverAlt = "Card cover image",
|
|
13
|
+
header,
|
|
14
|
+
footer,
|
|
15
|
+
actions,
|
|
16
|
+
className,
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
const sectionSizeClass = cover ? tigercatCore.cardSizeClasses[size] : void 0;
|
|
21
|
+
const cardClasses = tigercatCore.classNames(
|
|
22
|
+
tigercatCore.getCardClasses(variant, hoverable),
|
|
23
|
+
!cover && tigercatCore.cardSizeClasses[size],
|
|
24
|
+
className
|
|
25
|
+
);
|
|
26
|
+
const bodyClasses = tigercatCore.classNames(tigercatCore.cardBodyClasses, sectionSizeClass);
|
|
27
|
+
const getSectionClasses = (baseClasses) => tigercatCore.classNames(baseClasses, sectionSizeClass);
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cardClasses, ...props, children: [
|
|
29
|
+
cover && /* @__PURE__ */ jsxRuntime.jsx("div", { className: tigercatCore.cardCoverWrapperClasses, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: cover, alt: coverAlt, className: tigercatCore.cardCoverClasses }) }),
|
|
30
|
+
header != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: getSectionClasses(tigercatCore.cardHeaderClasses), children: header }),
|
|
31
|
+
children != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: bodyClasses, children }),
|
|
32
|
+
footer != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: getSectionClasses(tigercatCore.cardFooterClasses), children: footer }),
|
|
33
|
+
actions != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: getSectionClasses(tigercatCore.classNames(tigercatCore.cardActionsClasses, tigercatCore.cardFooterClasses)), children: actions })
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.Card = Card;
|
|
@@ -0,0 +1,84 @@
|
|
|
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/RadioGroup.tsx
|
|
12
|
+
var RadioGroupContext = React__default.default.createContext(null);
|
|
13
|
+
var RadioGroup = ({
|
|
14
|
+
value,
|
|
15
|
+
defaultValue,
|
|
16
|
+
name,
|
|
17
|
+
disabled = false,
|
|
18
|
+
size = "md",
|
|
19
|
+
onChange,
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}) => {
|
|
24
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
25
|
+
const isControlled = value !== void 0;
|
|
26
|
+
const currentValue = isControlled ? value : internalValue;
|
|
27
|
+
const generatedNameRef = React.useRef(
|
|
28
|
+
`tiger-radio-group-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`
|
|
29
|
+
);
|
|
30
|
+
const groupName = name || generatedNameRef.current;
|
|
31
|
+
const handleChange = (newValue) => {
|
|
32
|
+
if (disabled) return;
|
|
33
|
+
if (!isControlled) {
|
|
34
|
+
setInternalValue(newValue);
|
|
35
|
+
}
|
|
36
|
+
onChange?.(newValue);
|
|
37
|
+
};
|
|
38
|
+
const handleKeyDown = (event) => {
|
|
39
|
+
if (disabled) return;
|
|
40
|
+
if (event.key !== "ArrowDown" && event.key !== "ArrowRight" && event.key !== "ArrowUp" && event.key !== "ArrowLeft") {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const target = event.target;
|
|
44
|
+
const currentInput = target.closest('input[type="radio"]');
|
|
45
|
+
if (!currentInput) return;
|
|
46
|
+
const container = event.currentTarget;
|
|
47
|
+
const inputs = Array.from(
|
|
48
|
+
container.querySelectorAll('input[type="radio"]')
|
|
49
|
+
);
|
|
50
|
+
const enabledInputs = inputs.filter((input) => !input.disabled);
|
|
51
|
+
if (enabledInputs.length === 0) return;
|
|
52
|
+
const currentIndex = enabledInputs.indexOf(currentInput);
|
|
53
|
+
if (currentIndex === -1) return;
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
const direction = event.key === "ArrowDown" || event.key === "ArrowRight" ? 1 : -1;
|
|
56
|
+
const nextIndex = (currentIndex + direction + enabledInputs.length) % enabledInputs.length;
|
|
57
|
+
const nextInput = enabledInputs[nextIndex];
|
|
58
|
+
nextInput.focus();
|
|
59
|
+
nextInput.click();
|
|
60
|
+
};
|
|
61
|
+
const contextValue = {
|
|
62
|
+
value: currentValue,
|
|
63
|
+
name: groupName,
|
|
64
|
+
disabled,
|
|
65
|
+
size,
|
|
66
|
+
onChange: handleChange
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadioGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: tigercatCore.getRadioGroupClasses({
|
|
72
|
+
className,
|
|
73
|
+
hasCustomClass: !!className
|
|
74
|
+
}),
|
|
75
|
+
role: "radiogroup",
|
|
76
|
+
onKeyDown: handleKeyDown,
|
|
77
|
+
...props,
|
|
78
|
+
children
|
|
79
|
+
}
|
|
80
|
+
) });
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.RadioGroup = RadioGroup;
|
|
84
|
+
exports.RadioGroupContext = RadioGroupContext;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
// src/components/Switch.tsx
|
|
7
|
+
var Switch = ({
|
|
8
|
+
checked = false,
|
|
9
|
+
disabled = false,
|
|
10
|
+
size = "md",
|
|
11
|
+
onChange,
|
|
12
|
+
className,
|
|
13
|
+
onClick,
|
|
14
|
+
onKeyDown,
|
|
15
|
+
tabIndex,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const switchClasses = tigercatCore.classNames(tigercatCore.getSwitchClasses(size, checked, disabled), className);
|
|
19
|
+
const thumbClasses = tigercatCore.getSwitchThumbClasses(size, checked);
|
|
20
|
+
const toggle = () => {
|
|
21
|
+
if (disabled) return;
|
|
22
|
+
onChange?.(!checked);
|
|
23
|
+
};
|
|
24
|
+
const handleClick = (event) => {
|
|
25
|
+
onClick?.(event);
|
|
26
|
+
if (event.defaultPrevented) return;
|
|
27
|
+
toggle();
|
|
28
|
+
};
|
|
29
|
+
const handleKeyDown = (event) => {
|
|
30
|
+
onKeyDown?.(event);
|
|
31
|
+
if (event.defaultPrevented) return;
|
|
32
|
+
if (disabled) return;
|
|
33
|
+
if (event.key === " " || event.key === "Enter") {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
toggle();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
...props,
|
|
42
|
+
type: "button",
|
|
43
|
+
role: "switch",
|
|
44
|
+
"aria-checked": checked,
|
|
45
|
+
className: switchClasses,
|
|
46
|
+
disabled,
|
|
47
|
+
onClick: handleClick,
|
|
48
|
+
onKeyDown: handleKeyDown,
|
|
49
|
+
"aria-disabled": disabled || void 0,
|
|
50
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
51
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: thumbClasses, "aria-hidden": "true" })
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.Switch = Switch;
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { flushSync } from 'react-dom';
|
|
4
|
+
import { classNames, messageContainerBaseClasses, messagePositionClasses, getMessageTypeClasses, defaultMessageThemeColors, messageBaseClasses, getMessageIconPath, messageIconClasses, messageContentClasses, messageCloseButtonClasses, messageCloseIconPath, isBrowser, messageLoadingSpinnerClasses, icon24StrokeWidth, icon24ViewBox, icon24PathStrokeLinejoin, icon24PathStrokeLinecap } from '@expcat/tigercat-core';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
// src/components/Message.tsx
|
|
8
|
+
var MESSAGE_CONTAINER_ID = "tiger-message-container";
|
|
9
|
+
var MESSAGE_CLOSE_ARIA_LABEL = "Close message";
|
|
10
|
+
var messageInstances = [];
|
|
11
|
+
var instanceIdCounter = 0;
|
|
12
|
+
var containerRoot = null;
|
|
13
|
+
var updateCallback = null;
|
|
14
|
+
function getNextInstanceId() {
|
|
15
|
+
return ++instanceIdCounter;
|
|
16
|
+
}
|
|
17
|
+
var Icon = ({ path, className, isLoading = false }) => {
|
|
18
|
+
const iconClass = classNames(className, isLoading ? messageLoadingSpinnerClasses : "");
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"svg",
|
|
21
|
+
{
|
|
22
|
+
className: iconClass,
|
|
23
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
+
fill: "none",
|
|
25
|
+
viewBox: icon24ViewBox,
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: icon24StrokeWidth,
|
|
28
|
+
children: /* @__PURE__ */ jsx(
|
|
29
|
+
"path",
|
|
30
|
+
{
|
|
31
|
+
strokeLinecap: icon24PathStrokeLinecap,
|
|
32
|
+
strokeLinejoin: icon24PathStrokeLinejoin,
|
|
33
|
+
d: path
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
var MessageItem = ({ message: message2, onClose }) => {
|
|
40
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
setTimeout(() => setIsVisible(true), 10);
|
|
43
|
+
}, []);
|
|
44
|
+
const colorScheme = getMessageTypeClasses(message2.type, defaultMessageThemeColors);
|
|
45
|
+
const messageClasses = classNames(
|
|
46
|
+
messageBaseClasses,
|
|
47
|
+
colorScheme.bg,
|
|
48
|
+
colorScheme.border,
|
|
49
|
+
colorScheme.text,
|
|
50
|
+
message2.className,
|
|
51
|
+
isVisible ? "opacity-100 translate-y-0" : "opacity-0 -translate-y-2"
|
|
52
|
+
);
|
|
53
|
+
const iconPath = message2.icon || getMessageIconPath(message2.type);
|
|
54
|
+
const iconClass = classNames(messageIconClasses, colorScheme.icon);
|
|
55
|
+
const handleClose = useCallback(() => {
|
|
56
|
+
setIsVisible(false);
|
|
57
|
+
setTimeout(() => onClose(message2.id), 300);
|
|
58
|
+
}, [message2.id, onClose]);
|
|
59
|
+
const a11yRole = message2.type === "error" ? "alert" : "status";
|
|
60
|
+
const ariaLive = message2.type === "error" ? "assertive" : "polite";
|
|
61
|
+
return /* @__PURE__ */ jsxs(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className: messageClasses,
|
|
65
|
+
role: a11yRole,
|
|
66
|
+
"aria-live": ariaLive,
|
|
67
|
+
"aria-atomic": "true",
|
|
68
|
+
"aria-busy": message2.type === "loading" || void 0,
|
|
69
|
+
"data-tiger-message": true,
|
|
70
|
+
"data-tiger-message-type": message2.type,
|
|
71
|
+
"data-tiger-message-id": String(message2.id),
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx(Icon, { path: iconPath, className: iconClass, isLoading: message2.type === "loading" }),
|
|
74
|
+
/* @__PURE__ */ jsx("div", { className: messageContentClasses, children: message2.content }),
|
|
75
|
+
message2.closable && /* @__PURE__ */ jsx(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
className: messageCloseButtonClasses,
|
|
79
|
+
onClick: handleClose,
|
|
80
|
+
"aria-label": MESSAGE_CLOSE_ARIA_LABEL,
|
|
81
|
+
type: "button",
|
|
82
|
+
children: /* @__PURE__ */ jsx(Icon, { path: messageCloseIconPath, className: "w-4 h-4" })
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
var MessageContainer = ({ position = "top" }) => {
|
|
90
|
+
const [messages, setMessages] = useState(() => [...messageInstances]);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
updateCallback = () => {
|
|
93
|
+
flushSync(() => {
|
|
94
|
+
setMessages([...messageInstances]);
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
updateCallback();
|
|
98
|
+
return () => {
|
|
99
|
+
updateCallback = null;
|
|
100
|
+
};
|
|
101
|
+
}, []);
|
|
102
|
+
const containerClasses = classNames(messageContainerBaseClasses, messagePositionClasses[position]);
|
|
103
|
+
const handleRemove = useCallback((id) => {
|
|
104
|
+
const index = messageInstances.findIndex((msg) => msg.id === id);
|
|
105
|
+
if (index !== -1) {
|
|
106
|
+
const instance = messageInstances[index];
|
|
107
|
+
messageInstances.splice(index, 1);
|
|
108
|
+
if (instance.onClose) {
|
|
109
|
+
instance.onClose();
|
|
110
|
+
}
|
|
111
|
+
if (updateCallback) {
|
|
112
|
+
updateCallback();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, []);
|
|
116
|
+
return /* @__PURE__ */ jsx(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
className: containerClasses,
|
|
120
|
+
id: MESSAGE_CONTAINER_ID,
|
|
121
|
+
"aria-live": "polite",
|
|
122
|
+
"aria-relevant": "additions",
|
|
123
|
+
"data-tiger-message-container": true,
|
|
124
|
+
children: messages.map((message2) => /* @__PURE__ */ jsx(MessageItem, { message: message2, onClose: handleRemove }, message2.id))
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
function ensureContainer() {
|
|
129
|
+
if (!isBrowser()) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const rootId = `${MESSAGE_CONTAINER_ID}-root`;
|
|
133
|
+
const existingRootEl = document.getElementById(rootId);
|
|
134
|
+
if (containerRoot && !existingRootEl) {
|
|
135
|
+
containerRoot = null;
|
|
136
|
+
updateCallback = null;
|
|
137
|
+
}
|
|
138
|
+
if (containerRoot) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
let rootEl = existingRootEl;
|
|
142
|
+
if (!rootEl) {
|
|
143
|
+
rootEl = document.createElement("div");
|
|
144
|
+
rootEl.id = rootId;
|
|
145
|
+
document.body.appendChild(rootEl);
|
|
146
|
+
}
|
|
147
|
+
containerRoot = createRoot(rootEl);
|
|
148
|
+
flushSync(() => {
|
|
149
|
+
containerRoot?.render(/* @__PURE__ */ jsx(MessageContainer, {}));
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function addMessage(config) {
|
|
153
|
+
const id = getNextInstanceId();
|
|
154
|
+
const instance = {
|
|
155
|
+
id,
|
|
156
|
+
type: config.type || "info",
|
|
157
|
+
content: config.content,
|
|
158
|
+
duration: config.duration !== void 0 ? config.duration : 3e3,
|
|
159
|
+
closable: config.closable || false,
|
|
160
|
+
onClose: config.onClose,
|
|
161
|
+
icon: config.icon,
|
|
162
|
+
className: config.className
|
|
163
|
+
};
|
|
164
|
+
messageInstances.push(instance);
|
|
165
|
+
ensureContainer();
|
|
166
|
+
if (updateCallback) {
|
|
167
|
+
updateCallback();
|
|
168
|
+
}
|
|
169
|
+
if (instance.duration > 0) {
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
removeMessage(id);
|
|
172
|
+
}, instance.duration);
|
|
173
|
+
}
|
|
174
|
+
return () => removeMessage(id);
|
|
175
|
+
}
|
|
176
|
+
function removeMessage(id) {
|
|
177
|
+
const index = messageInstances.findIndex((msg) => msg.id === id);
|
|
178
|
+
if (index !== -1) {
|
|
179
|
+
const instance = messageInstances[index];
|
|
180
|
+
messageInstances.splice(index, 1);
|
|
181
|
+
if (instance.onClose) {
|
|
182
|
+
instance.onClose();
|
|
183
|
+
}
|
|
184
|
+
if (updateCallback) {
|
|
185
|
+
updateCallback();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function clearAll() {
|
|
190
|
+
messageInstances.forEach((instance) => {
|
|
191
|
+
if (instance.onClose) {
|
|
192
|
+
instance.onClose();
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
messageInstances = [];
|
|
196
|
+
if (updateCallback) {
|
|
197
|
+
updateCallback();
|
|
198
|
+
}
|
|
199
|
+
if (containerRoot) {
|
|
200
|
+
containerRoot.unmount();
|
|
201
|
+
containerRoot = null;
|
|
202
|
+
}
|
|
203
|
+
updateCallback = null;
|
|
204
|
+
const rootId = `${MESSAGE_CONTAINER_ID}-root`;
|
|
205
|
+
if (isBrowser()) {
|
|
206
|
+
const rootEl = document.getElementById(rootId);
|
|
207
|
+
if (rootEl?.parentNode) {
|
|
208
|
+
rootEl.parentNode.removeChild(rootEl);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function normalizeOptions(options) {
|
|
213
|
+
if (typeof options === "string") {
|
|
214
|
+
return { content: options };
|
|
215
|
+
}
|
|
216
|
+
return options;
|
|
217
|
+
}
|
|
218
|
+
var message = {
|
|
219
|
+
/**
|
|
220
|
+
* Show an info message
|
|
221
|
+
*/
|
|
222
|
+
info(options) {
|
|
223
|
+
const config = normalizeOptions(options);
|
|
224
|
+
return addMessage({ ...config, type: "info" });
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* Show a success message
|
|
228
|
+
*/
|
|
229
|
+
success(options) {
|
|
230
|
+
const config = normalizeOptions(options);
|
|
231
|
+
return addMessage({ ...config, type: "success" });
|
|
232
|
+
},
|
|
233
|
+
/**
|
|
234
|
+
* Show a warning message
|
|
235
|
+
*/
|
|
236
|
+
warning(options) {
|
|
237
|
+
const config = normalizeOptions(options);
|
|
238
|
+
return addMessage({ ...config, type: "warning" });
|
|
239
|
+
},
|
|
240
|
+
/**
|
|
241
|
+
* Show an error message
|
|
242
|
+
*/
|
|
243
|
+
error(options) {
|
|
244
|
+
const config = normalizeOptions(options);
|
|
245
|
+
return addMessage({ ...config, type: "error" });
|
|
246
|
+
},
|
|
247
|
+
/**
|
|
248
|
+
* Show a loading message
|
|
249
|
+
*/
|
|
250
|
+
loading(options) {
|
|
251
|
+
const config = normalizeOptions(options);
|
|
252
|
+
return addMessage({ ...config, type: "loading", duration: 0 });
|
|
253
|
+
},
|
|
254
|
+
/**
|
|
255
|
+
* Clear all messages
|
|
256
|
+
*/
|
|
257
|
+
clear() {
|
|
258
|
+
clearAll();
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var Message_default = message;
|
|
262
|
+
|
|
263
|
+
export { MessageContainer, Message_default, message };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { createContext, useContext, useRef, useState, useCallback, useMemo, useEffect } from 'react';
|
|
2
|
+
import { classNames, getMenuClasses } from '@expcat/tigercat-core';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/components/Menu.tsx
|
|
6
|
+
var MenuContext = createContext(null);
|
|
7
|
+
function useMenuContext() {
|
|
8
|
+
return useContext(MenuContext);
|
|
9
|
+
}
|
|
10
|
+
var Menu = ({
|
|
11
|
+
mode = "vertical",
|
|
12
|
+
theme = "light",
|
|
13
|
+
selectedKeys: controlledSelectedKeys,
|
|
14
|
+
defaultSelectedKeys = [],
|
|
15
|
+
openKeys: controlledOpenKeys,
|
|
16
|
+
defaultOpenKeys = [],
|
|
17
|
+
collapsed = false,
|
|
18
|
+
multiple = true,
|
|
19
|
+
inlineIndent = 24,
|
|
20
|
+
className,
|
|
21
|
+
style,
|
|
22
|
+
onSelect,
|
|
23
|
+
onOpenChange,
|
|
24
|
+
children
|
|
25
|
+
}) => {
|
|
26
|
+
const menuRef = useRef(null);
|
|
27
|
+
const [internalSelectedKeys, setInternalSelectedKeys] = useState(defaultSelectedKeys);
|
|
28
|
+
const [internalOpenKeys, setInternalOpenKeys] = useState(defaultOpenKeys);
|
|
29
|
+
const selectedKeys = controlledSelectedKeys !== void 0 ? controlledSelectedKeys : internalSelectedKeys;
|
|
30
|
+
const openKeys = controlledOpenKeys !== void 0 ? controlledOpenKeys : internalOpenKeys;
|
|
31
|
+
const handleSelect = useCallback(
|
|
32
|
+
(key) => {
|
|
33
|
+
const newSelectedKeys = [key];
|
|
34
|
+
if (controlledSelectedKeys === void 0) {
|
|
35
|
+
setInternalSelectedKeys(newSelectedKeys);
|
|
36
|
+
}
|
|
37
|
+
onSelect?.(key, { selectedKeys: newSelectedKeys });
|
|
38
|
+
},
|
|
39
|
+
[controlledSelectedKeys, onSelect]
|
|
40
|
+
);
|
|
41
|
+
const handleOpenChange = useCallback(
|
|
42
|
+
(key) => {
|
|
43
|
+
const isOpen = openKeys.includes(key);
|
|
44
|
+
let newOpenKeys;
|
|
45
|
+
if (isOpen) {
|
|
46
|
+
newOpenKeys = openKeys.filter((k) => k !== key);
|
|
47
|
+
} else {
|
|
48
|
+
if (multiple) {
|
|
49
|
+
newOpenKeys = [...openKeys, key];
|
|
50
|
+
} else {
|
|
51
|
+
newOpenKeys = [key];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (controlledOpenKeys === void 0) {
|
|
55
|
+
setInternalOpenKeys(newOpenKeys);
|
|
56
|
+
}
|
|
57
|
+
onOpenChange?.(key, { openKeys: newOpenKeys });
|
|
58
|
+
},
|
|
59
|
+
[openKeys, multiple, controlledOpenKeys, onOpenChange]
|
|
60
|
+
);
|
|
61
|
+
const menuClasses = useMemo(() => {
|
|
62
|
+
return classNames(getMenuClasses(mode, theme, collapsed), className);
|
|
63
|
+
}, [mode, theme, collapsed, className]);
|
|
64
|
+
const contextValue = useMemo(
|
|
65
|
+
() => ({
|
|
66
|
+
mode,
|
|
67
|
+
theme,
|
|
68
|
+
collapsed,
|
|
69
|
+
inlineIndent,
|
|
70
|
+
selectedKeys,
|
|
71
|
+
openKeys,
|
|
72
|
+
handleSelect,
|
|
73
|
+
handleOpenChange
|
|
74
|
+
}),
|
|
75
|
+
[mode, theme, collapsed, inlineIndent, selectedKeys, openKeys, handleSelect, handleOpenChange]
|
|
76
|
+
);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const root = menuRef.current;
|
|
79
|
+
if (!root) return;
|
|
80
|
+
const items = Array.from(
|
|
81
|
+
root.querySelectorAll('button[data-tiger-menuitem="true"]')
|
|
82
|
+
).filter((el) => !el.disabled && !el.closest('[data-tiger-menu-hidden="true"]'));
|
|
83
|
+
if (items.length === 0) return;
|
|
84
|
+
const hasActive = items.some((el) => el.tabIndex === 0);
|
|
85
|
+
if (hasActive) return;
|
|
86
|
+
const selected = items.find((el) => el.dataset.tigerSelected === "true");
|
|
87
|
+
const active = selected ?? items[0];
|
|
88
|
+
items.forEach((el) => {
|
|
89
|
+
el.tabIndex = el === active ? 0 : -1;
|
|
90
|
+
});
|
|
91
|
+
}, [mode, collapsed, selectedKeys, openKeys]);
|
|
92
|
+
return /* @__PURE__ */ jsx(MenuContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
93
|
+
"ul",
|
|
94
|
+
{
|
|
95
|
+
ref: menuRef,
|
|
96
|
+
className: menuClasses,
|
|
97
|
+
style,
|
|
98
|
+
role: "menu",
|
|
99
|
+
"data-tiger-menu-root": "true",
|
|
100
|
+
"data-tiger-menu-mode": mode,
|
|
101
|
+
children
|
|
102
|
+
}
|
|
103
|
+
) });
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { Menu, useMenuContext };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useBreadcrumbContext } from './chunk-7JQ7LURS.mjs';
|
|
2
|
+
import { useMemo, useCallback } from 'react';
|
|
3
|
+
import { getBreadcrumbItemClasses, getBreadcrumbLinkClasses, getBreadcrumbSeparatorClasses, getSeparatorContent } from '@expcat/tigercat-core';
|
|
4
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var BreadcrumbItem = ({
|
|
7
|
+
href,
|
|
8
|
+
target,
|
|
9
|
+
current = false,
|
|
10
|
+
separator: customSeparator,
|
|
11
|
+
className,
|
|
12
|
+
style,
|
|
13
|
+
onClick,
|
|
14
|
+
children,
|
|
15
|
+
icon,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const breadcrumbContext = useBreadcrumbContext();
|
|
19
|
+
const itemClasses = useMemo(
|
|
20
|
+
() => getBreadcrumbItemClasses(current, className),
|
|
21
|
+
[current, className]
|
|
22
|
+
);
|
|
23
|
+
const linkClasses = useMemo(() => getBreadcrumbLinkClasses(current), [current]);
|
|
24
|
+
const separatorClasses = useMemo(() => getBreadcrumbSeparatorClasses(), []);
|
|
25
|
+
const separatorContent = useMemo(() => {
|
|
26
|
+
const sep = customSeparator !== void 0 ? customSeparator : breadcrumbContext?.separator || "/";
|
|
27
|
+
return getSeparatorContent(sep);
|
|
28
|
+
}, [customSeparator, breadcrumbContext]);
|
|
29
|
+
const handleClick = useCallback(
|
|
30
|
+
(event) => {
|
|
31
|
+
if (!current) {
|
|
32
|
+
onClick?.(event);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
[current, onClick]
|
|
36
|
+
);
|
|
37
|
+
const computedRel = useMemo(() => {
|
|
38
|
+
if (target === "_blank") {
|
|
39
|
+
return "noopener noreferrer";
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
}, [target]);
|
|
43
|
+
const contentElements = icon ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", { className: "inline-flex", children: icon }),
|
|
45
|
+
children
|
|
46
|
+
] }) : children;
|
|
47
|
+
const linkElement = href && !current ? /* @__PURE__ */ jsx(
|
|
48
|
+
"a",
|
|
49
|
+
{
|
|
50
|
+
className: linkClasses,
|
|
51
|
+
href,
|
|
52
|
+
target,
|
|
53
|
+
rel: computedRel,
|
|
54
|
+
"aria-current": current ? "page" : void 0,
|
|
55
|
+
onClick: handleClick,
|
|
56
|
+
children: contentElements
|
|
57
|
+
}
|
|
58
|
+
) : /* @__PURE__ */ jsx("span", { className: linkClasses, "aria-current": current ? "page" : void 0, children: contentElements });
|
|
59
|
+
const separatorElement = !current ? /* @__PURE__ */ jsx("span", { className: separatorClasses, "aria-hidden": "true", children: separatorContent }) : null;
|
|
60
|
+
return /* @__PURE__ */ jsxs("li", { className: itemClasses, style, ...props, children: [
|
|
61
|
+
linkElement,
|
|
62
|
+
separatorElement
|
|
63
|
+
] });
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export { BreadcrumbItem };
|