@parto-system-design/ui 1.1.5 → 1.1.8
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/AGENTS.md +233 -0
- package/LICENSE +21 -0
- package/README.md +96 -43
- package/dist/chunk-2ACKKPWA.cjs +112 -0
- package/dist/chunk-2ACKKPWA.cjs.map +1 -0
- package/dist/chunk-2UD3LGVX.cjs +316 -0
- package/dist/chunk-2UD3LGVX.cjs.map +1 -0
- package/dist/chunk-3QYYPPFJ.js +269 -0
- package/dist/chunk-3QYYPPFJ.js.map +1 -0
- package/dist/chunk-4SVQNEVH.js +173 -0
- package/dist/chunk-4SVQNEVH.js.map +1 -0
- package/dist/chunk-4WONHORR.cjs +152 -0
- package/dist/chunk-4WONHORR.cjs.map +1 -0
- package/dist/chunk-5HCXH6GS.js +409 -0
- package/dist/chunk-5HCXH6GS.js.map +1 -0
- package/dist/chunk-5JJSRGJD.js +31 -0
- package/dist/chunk-5JJSRGJD.js.map +1 -0
- package/dist/chunk-5K6E4ZSW.cjs +77 -0
- package/dist/chunk-5K6E4ZSW.cjs.map +1 -0
- package/dist/chunk-5NY26ULO.js +89 -0
- package/dist/chunk-5NY26ULO.js.map +1 -0
- package/dist/chunk-7RVPG3LE.cjs +231 -0
- package/dist/chunk-7RVPG3LE.cjs.map +1 -0
- package/dist/chunk-AYEK3WOM.js +207 -0
- package/dist/chunk-AYEK3WOM.js.map +1 -0
- package/dist/chunk-BRMBLIQG.js +53 -0
- package/dist/chunk-BRMBLIQG.js.map +1 -0
- package/dist/chunk-CAJKSTXX.cjs +54 -0
- package/dist/chunk-CAJKSTXX.cjs.map +1 -0
- package/dist/chunk-CKFWMHQU.js +401 -0
- package/dist/chunk-CKFWMHQU.js.map +1 -0
- package/dist/chunk-CV3N3HVK.js +672 -0
- package/dist/chunk-CV3N3HVK.js.map +1 -0
- package/dist/chunk-D2EBLE2B.cjs +220 -0
- package/dist/chunk-D2EBLE2B.cjs.map +1 -0
- package/dist/chunk-GCZ6YATL.js +940 -0
- package/dist/chunk-GCZ6YATL.js.map +1 -0
- package/dist/chunk-GKRAZGDI.cjs +84 -0
- package/dist/chunk-GKRAZGDI.cjs.map +1 -0
- package/dist/chunk-GPYJ66CG.js +45 -0
- package/dist/chunk-GPYJ66CG.js.map +1 -0
- package/dist/chunk-HF6XU5NI.js +84 -0
- package/dist/chunk-HF6XU5NI.js.map +1 -0
- package/dist/chunk-HJPDZOMJ.cjs +87 -0
- package/dist/chunk-HJPDZOMJ.cjs.map +1 -0
- package/dist/chunk-HS3XI3CC.cjs +69 -0
- package/dist/chunk-HS3XI3CC.cjs.map +1 -0
- package/dist/chunk-HUCC3QH5.cjs +53 -0
- package/dist/chunk-HUCC3QH5.cjs.map +1 -0
- package/dist/chunk-HYZ6BQPS.cjs +425 -0
- package/dist/chunk-HYZ6BQPS.cjs.map +1 -0
- package/dist/chunk-ISCSZMYW.cjs +106 -0
- package/dist/chunk-ISCSZMYW.cjs.map +1 -0
- package/dist/chunk-IXFEFIDO.js +82 -0
- package/dist/chunk-IXFEFIDO.js.map +1 -0
- package/dist/chunk-JCJLN437.js +108 -0
- package/dist/chunk-JCJLN437.js.map +1 -0
- package/dist/chunk-JMKNNH63.cjs +982 -0
- package/dist/chunk-JMKNNH63.cjs.map +1 -0
- package/dist/chunk-JUBHQAA2.js +53 -0
- package/dist/chunk-JUBHQAA2.js.map +1 -0
- package/dist/chunk-K6G63EED.cjs +41 -0
- package/dist/chunk-K6G63EED.cjs.map +1 -0
- package/dist/chunk-KCWRCSI7.js +62 -0
- package/dist/chunk-KCWRCSI7.js.map +1 -0
- package/dist/chunk-KYM7NIJO.cjs +433 -0
- package/dist/chunk-KYM7NIJO.cjs.map +1 -0
- package/dist/chunk-L2L5CKC2.js +291 -0
- package/dist/chunk-L2L5CKC2.js.map +1 -0
- package/dist/chunk-M5CHZ5BA.js +124 -0
- package/dist/chunk-M5CHZ5BA.js.map +1 -0
- package/dist/chunk-MEK4RSGC.js +65 -0
- package/dist/chunk-MEK4RSGC.js.map +1 -0
- package/dist/chunk-MEKWH3GS.js +89 -0
- package/dist/chunk-MEKWH3GS.js.map +1 -0
- package/dist/chunk-MFTX2DDQ.js +27 -0
- package/dist/chunk-MFTX2DDQ.js.map +1 -0
- package/dist/chunk-MMC6M35Q.cjs +272 -0
- package/dist/chunk-MMC6M35Q.cjs.map +1 -0
- package/dist/chunk-NMH43BDC.js +130 -0
- package/dist/chunk-NMH43BDC.js.map +1 -0
- package/dist/chunk-NORDUD2T.cjs +135 -0
- package/dist/chunk-NORDUD2T.cjs.map +1 -0
- package/dist/chunk-NV4JOKWL.cjs +197 -0
- package/dist/chunk-NV4JOKWL.cjs.map +1 -0
- package/dist/chunk-O2JG7WY5.cjs +121 -0
- package/dist/chunk-O2JG7WY5.cjs.map +1 -0
- package/dist/chunk-ONO2FTV4.cjs +68 -0
- package/dist/chunk-ONO2FTV4.cjs.map +1 -0
- package/dist/chunk-OQB6HIUL.cjs +108 -0
- package/dist/chunk-OQB6HIUL.cjs.map +1 -0
- package/dist/chunk-OS6CMYAS.cjs +79 -0
- package/dist/chunk-OS6CMYAS.cjs.map +1 -0
- package/dist/chunk-PYURPUTV.js +402 -0
- package/dist/chunk-PYURPUTV.js.map +1 -0
- package/dist/chunk-RJ3HYZ7S.js +44 -0
- package/dist/chunk-RJ3HYZ7S.js.map +1 -0
- package/dist/chunk-RZNRIOLT.js +128 -0
- package/dist/chunk-RZNRIOLT.js.map +1 -0
- package/dist/chunk-S3T2L6NA.js +38 -0
- package/dist/chunk-S3T2L6NA.js.map +1 -0
- package/dist/chunk-S5IPJQZ3.cjs +161 -0
- package/dist/chunk-S5IPJQZ3.cjs.map +1 -0
- package/dist/chunk-SB5DSYR5.js +211 -0
- package/dist/chunk-SB5DSYR5.js.map +1 -0
- package/dist/chunk-SFXV2DUH.js +106 -0
- package/dist/chunk-SFXV2DUH.js.map +1 -0
- package/dist/chunk-SXEPGD4Z.cjs +152 -0
- package/dist/chunk-SXEPGD4Z.cjs.map +1 -0
- package/dist/chunk-SXWSOU3Y.js +89 -0
- package/dist/chunk-SXWSOU3Y.js.map +1 -0
- package/dist/chunk-SZMVOHT7.cjs +107 -0
- package/dist/chunk-SZMVOHT7.cjs.map +1 -0
- package/dist/chunk-TWJXOV4C.js +145 -0
- package/dist/chunk-TWJXOV4C.js.map +1 -0
- package/dist/chunk-U3ADRIVO.cjs +434 -0
- package/dist/chunk-U3ADRIVO.cjs.map +1 -0
- package/dist/chunk-U5FLLCGC.cjs +151 -0
- package/dist/chunk-U5FLLCGC.cjs.map +1 -0
- package/dist/chunk-UOZN45G4.cjs +130 -0
- package/dist/chunk-UOZN45G4.cjs.map +1 -0
- package/dist/chunk-VHLDOG74.cjs +167 -0
- package/dist/chunk-VHLDOG74.cjs.map +1 -0
- package/dist/chunk-YC5KLN6I.js +139 -0
- package/dist/chunk-YC5KLN6I.js.map +1 -0
- package/dist/chunk-YENXXYUV.cjs +111 -0
- package/dist/chunk-YENXXYUV.cjs.map +1 -0
- package/dist/chunk-YFQWC2PW.js +113 -0
- package/dist/chunk-YFQWC2PW.js.map +1 -0
- package/dist/chunk-Z2TY4A75.cjs +700 -0
- package/dist/chunk-Z2TY4A75.cjs.map +1 -0
- package/dist/chunk-Z56O7UEU.cjs +136 -0
- package/dist/chunk-Z56O7UEU.cjs.map +1 -0
- package/dist/chunk-ZBZDR4ZC.js +106 -0
- package/dist/chunk-ZBZDR4ZC.js.map +1 -0
- package/dist/components/charts/PartoAreaChart.cjs +15 -0
- package/dist/components/charts/PartoAreaChart.cjs.map +1 -0
- package/dist/components/charts/PartoAreaChart.d.cts +53 -0
- package/dist/components/charts/PartoAreaChart.d.ts +53 -0
- package/dist/components/charts/PartoAreaChart.js +6 -0
- package/dist/components/charts/PartoAreaChart.js.map +1 -0
- package/dist/components/charts/PartoBarChart.cjs +15 -0
- package/dist/components/charts/PartoBarChart.cjs.map +1 -0
- package/dist/components/charts/PartoBarChart.d.cts +61 -0
- package/dist/components/charts/PartoBarChart.d.ts +61 -0
- package/dist/components/charts/PartoBarChart.js +6 -0
- package/dist/components/charts/PartoBarChart.js.map +1 -0
- package/dist/components/charts/PartoLineChart.cjs +15 -0
- package/dist/components/charts/PartoLineChart.cjs.map +1 -0
- package/dist/components/charts/PartoLineChart.d.cts +57 -0
- package/dist/components/charts/PartoLineChart.d.ts +57 -0
- package/dist/components/charts/PartoLineChart.js +6 -0
- package/dist/components/charts/PartoLineChart.js.map +1 -0
- package/dist/components/charts/PartoPieChart.cjs +15 -0
- package/dist/components/charts/PartoPieChart.cjs.map +1 -0
- package/dist/components/charts/PartoPieChart.d.cts +52 -0
- package/dist/components/charts/PartoPieChart.d.ts +52 -0
- package/dist/components/charts/PartoPieChart.js +6 -0
- package/dist/components/charts/PartoPieChart.js.map +1 -0
- package/dist/components/ui/alert-rule-card.cjs +15 -0
- package/dist/components/ui/alert-rule-card.cjs.map +1 -0
- package/dist/components/ui/alert-rule-card.d.cts +38 -0
- package/dist/components/ui/alert-rule-card.d.ts +38 -0
- package/dist/components/ui/alert-rule-card.js +6 -0
- package/dist/components/ui/alert-rule-card.js.map +1 -0
- package/dist/components/ui/avatar.cjs +21 -0
- package/dist/components/ui/avatar.cjs.map +1 -0
- package/dist/components/ui/avatar.d.cts +18 -0
- package/dist/components/ui/avatar.d.ts +18 -0
- package/dist/components/ui/avatar.js +4 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.cjs +17 -0
- package/dist/components/ui/badge.cjs.map +1 -0
- package/dist/components/ui/badge.d.cts +16 -0
- package/dist/components/ui/badge.d.ts +16 -0
- package/dist/components/ui/badge.js +4 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.cjs +18 -0
- package/dist/components/ui/button.cjs.map +1 -0
- package/dist/components/ui/button.d.cts +37 -0
- package/dist/components/ui/button.d.ts +37 -0
- package/dist/components/ui/button.js +5 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.cjs +15 -0
- package/dist/components/ui/calendar.cjs.map +1 -0
- package/dist/components/ui/calendar.d.cts +17 -0
- package/dist/components/ui/calendar.d.ts +17 -0
- package/dist/components/ui/calendar.js +6 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.cjs +37 -0
- package/dist/components/ui/card.cjs.map +1 -0
- package/dist/components/ui/card.d.cts +18 -0
- package/dist/components/ui/card.d.ts +18 -0
- package/dist/components/ui/card.js +4 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/concept-card.cjs +18 -0
- package/dist/components/ui/concept-card.cjs.map +1 -0
- package/dist/components/ui/concept-card.d.cts +5 -0
- package/dist/components/ui/concept-card.d.ts +5 -0
- package/dist/components/ui/concept-card.js +9 -0
- package/dist/components/ui/concept-card.js.map +1 -0
- package/dist/components/ui/data-table.cjs +18 -0
- package/dist/components/ui/data-table.cjs.map +1 -0
- package/dist/components/ui/data-table.d.cts +181 -0
- package/dist/components/ui/data-table.d.ts +181 -0
- package/dist/components/ui/data-table.js +9 -0
- package/dist/components/ui/data-table.js.map +1 -0
- package/dist/components/ui/dialog.cjs +49 -0
- package/dist/components/ui/dialog.cjs.map +1 -0
- package/dist/components/ui/dialog.d.cts +22 -0
- package/dist/components/ui/dialog.d.ts +22 -0
- package/dist/components/ui/dialog.js +4 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/filter-provider.cjs +20 -0
- package/dist/components/ui/filter-provider.cjs.map +1 -0
- package/dist/components/ui/filter-provider.d.cts +49 -0
- package/dist/components/ui/filter-provider.d.ts +49 -0
- package/dist/components/ui/filter-provider.js +3 -0
- package/dist/components/ui/filter-provider.js.map +1 -0
- package/dist/components/ui/input.cjs +22 -0
- package/dist/components/ui/input.cjs.map +1 -0
- package/dist/components/ui/input.d.cts +16 -0
- package/dist/components/ui/input.d.ts +16 -0
- package/dist/components/ui/input.js +5 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/iran-province-heat.cjs +13 -0
- package/dist/components/ui/iran-province-heat.cjs.map +1 -0
- package/dist/components/ui/iran-province-heat.d.cts +64 -0
- package/dist/components/ui/iran-province-heat.d.ts +64 -0
- package/dist/components/ui/iran-province-heat.js +4 -0
- package/dist/components/ui/iran-province-heat.js.map +1 -0
- package/dist/components/ui/page-card.cjs +16 -0
- package/dist/components/ui/page-card.cjs.map +1 -0
- package/dist/components/ui/page-card.d.cts +6 -0
- package/dist/components/ui/page-card.d.ts +6 -0
- package/dist/components/ui/page-card.js +7 -0
- package/dist/components/ui/page-card.js.map +1 -0
- package/dist/components/ui/popover.cjs +25 -0
- package/dist/components/ui/popover.cjs.map +1 -0
- package/dist/components/ui/popover.d.cts +9 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +4 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/saved-query-card.cjs +15 -0
- package/dist/components/ui/saved-query-card.cjs.map +1 -0
- package/dist/components/ui/saved-query-card.d.cts +41 -0
- package/dist/components/ui/saved-query-card.d.ts +41 -0
- package/dist/components/ui/saved-query-card.js +6 -0
- package/dist/components/ui/saved-query-card.js.map +1 -0
- package/dist/components/ui/separator.cjs +13 -0
- package/dist/components/ui/separator.cjs.map +1 -0
- package/dist/components/ui/separator.d.cts +9 -0
- package/dist/components/ui/separator.d.ts +9 -0
- package/dist/components/ui/separator.js +4 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.cjs +45 -0
- package/dist/components/ui/sheet.cjs.map +1 -0
- package/dist/components/ui/sheet.d.cts +44 -0
- package/dist/components/ui/sheet.d.ts +44 -0
- package/dist/components/ui/sheet.js +4 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sparkline.cjs +13 -0
- package/dist/components/ui/sparkline.cjs.map +1 -0
- package/dist/components/ui/sparkline.d.cts +36 -0
- package/dist/components/ui/sparkline.d.ts +36 -0
- package/dist/components/ui/sparkline.js +4 -0
- package/dist/components/ui/sparkline.js.map +1 -0
- package/dist/components/ui/tooltip.cjs +25 -0
- package/dist/components/ui/tooltip.cjs.map +1 -0
- package/dist/components/ui/tooltip.d.cts +17 -0
- package/dist/components/ui/tooltip.d.ts +17 -0
- package/dist/components/ui/tooltip.js +4 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/concept-card-CcOBb2Nz.d.ts +83 -0
- package/dist/concept-card-RwPbqJ06.d.cts +83 -0
- package/dist/hooks/use-hotkey-registry.cjs +21 -0
- package/dist/hooks/use-hotkey-registry.cjs.map +1 -0
- package/dist/hooks/use-hotkey-registry.d.cts +65 -0
- package/dist/hooks/use-hotkey-registry.d.ts +65 -0
- package/dist/hooks/use-hotkey-registry.js +4 -0
- package/dist/hooks/use-hotkey-registry.js.map +1 -0
- package/dist/hooks/use-hotkeys.cjs +16 -0
- package/dist/hooks/use-hotkeys.cjs.map +1 -0
- package/dist/hooks/use-hotkeys.d.cts +66 -0
- package/dist/hooks/use-hotkeys.d.ts +66 -0
- package/dist/hooks/use-hotkeys.js +3 -0
- package/dist/hooks/use-hotkeys.js.map +1 -0
- package/dist/i18n-ArS3mqj0.d.ts +344 -0
- package/dist/i18n-CAd9wGOr.d.cts +344 -0
- package/dist/index.cjs +12195 -13224
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +490 -34
- package/dist/index.d.cts +1635 -1263
- package/dist/index.d.ts +1635 -1263
- package/dist/index.js +10693 -12364
- package/dist/index.js.map +1 -1
- package/dist/page-card-CmShVqG-.d.cts +100 -0
- package/dist/page-card-HBn-cy4J.d.ts +100 -0
- package/dist/utils-DlXWmDZ-.d.cts +35 -0
- package/dist/utils-DlXWmDZ-.d.ts +35 -0
- package/package.json +160 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
|
|
4
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
5
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
6
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
interface TooltipContentProps extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {
|
|
8
|
+
/** Visual variant */
|
|
9
|
+
variant?: 'default' | 'light' | 'error';
|
|
10
|
+
/** Size */
|
|
11
|
+
size?: 'sm' | 'md';
|
|
12
|
+
/** Show arrow/caret pointing to trigger */
|
|
13
|
+
showArrow?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
|
|
17
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
|
|
4
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
5
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
6
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
interface TooltipContentProps extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {
|
|
8
|
+
/** Visual variant */
|
|
9
|
+
variant?: 'default' | 'light' | 'error';
|
|
10
|
+
/** Size */
|
|
11
|
+
size?: 'sm' | 'md';
|
|
12
|
+
/** Show arrow/caret pointing to trigger */
|
|
13
|
+
showArrow?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
|
|
17
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"tooltip.js"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { S as SupportedLocale } from './utils-DlXWmDZ-.js';
|
|
3
|
+
import { F as FlowKey, c as StatusKey, d as SeverityKey } from './i18n-ArS3mqj0.js';
|
|
4
|
+
|
|
5
|
+
type FlowData = Partial<Record<FlowKey, number>>;
|
|
6
|
+
interface FlowDistributionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/** Flow counts (auto-normalized). Missing keys treated as 0. */
|
|
8
|
+
data: FlowData;
|
|
9
|
+
/** Display mode */
|
|
10
|
+
variant?: 'bars' | 'stacked' | 'compact';
|
|
11
|
+
/** Show numeric counts alongside percent */
|
|
12
|
+
showCounts?: boolean;
|
|
13
|
+
/** Show percentages */
|
|
14
|
+
showPercent?: boolean;
|
|
15
|
+
/** Locale */
|
|
16
|
+
locale?: SupportedLocale;
|
|
17
|
+
/** Loading skeleton */
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare const FlowDistribution: React.ForwardRefExoticComponent<FlowDistributionProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
|
|
22
|
+
interface SentimentData {
|
|
23
|
+
positive: number;
|
|
24
|
+
negative: number;
|
|
25
|
+
neutral: number;
|
|
26
|
+
mixed?: number;
|
|
27
|
+
}
|
|
28
|
+
interface SentimentDistributionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
29
|
+
/** Sentiment counts (will be auto-normalized to 100%) */
|
|
30
|
+
data: SentimentData;
|
|
31
|
+
/** Display mode */
|
|
32
|
+
variant?: 'bars' | 'stacked' | 'compact';
|
|
33
|
+
/** Show numeric count labels */
|
|
34
|
+
showCounts?: boolean;
|
|
35
|
+
/** Show percentage labels */
|
|
36
|
+
showPercent?: boolean;
|
|
37
|
+
/** Locale for number/label formatting */
|
|
38
|
+
locale?: SupportedLocale;
|
|
39
|
+
/** Show loading skeleton */
|
|
40
|
+
isLoading?: boolean;
|
|
41
|
+
}
|
|
42
|
+
declare const SentimentDistribution: React.ForwardRefExoticComponent<SentimentDistributionProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* ConceptCard — افکارسنجی-flavored headline tile for clustering dashboards.
|
|
46
|
+
* Composes: status badge, severity badge, flow composition bar, sentiment
|
|
47
|
+
* distribution, sparkline trend, AI summary snippet, optional comparison
|
|
48
|
+
* checkbox. Built for government dashboards where each "concept" needs
|
|
49
|
+
* to fit in a card grid with rich, comparable signals.
|
|
50
|
+
*/
|
|
51
|
+
interface ConceptCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
52
|
+
/** Concept name (e.g., "افزایش قیمت بنزین") */
|
|
53
|
+
title: React.ReactNode;
|
|
54
|
+
/** Short subtitle (e.g., "خوشه ۴ — ۱۲۰ پست") */
|
|
55
|
+
subtitle?: React.ReactNode;
|
|
56
|
+
/** Operational status */
|
|
57
|
+
status?: StatusKey;
|
|
58
|
+
/** Criticality of the concept (urgent/high/medium/low) */
|
|
59
|
+
severity?: SeverityKey;
|
|
60
|
+
/** Flow composition breakdown (5-class political) */
|
|
61
|
+
flow?: FlowData;
|
|
62
|
+
/** Sentiment composition (3-class) */
|
|
63
|
+
sentiment?: SentimentData;
|
|
64
|
+
/** Trend sparkline values (e.g., last 14 days mention volume) */
|
|
65
|
+
trend?: number[];
|
|
66
|
+
/** AI-generated short summary (1-2 sentences) */
|
|
67
|
+
aiSummary?: React.ReactNode;
|
|
68
|
+
/** Total mentions / size — shown as a stat */
|
|
69
|
+
totalCount?: number;
|
|
70
|
+
/** Comparison checkbox state. When provided, renders the checkbox in the header */
|
|
71
|
+
comparison?: {
|
|
72
|
+
selected: boolean;
|
|
73
|
+
onSelectionChange: (next: boolean) => void;
|
|
74
|
+
label?: React.ReactNode;
|
|
75
|
+
};
|
|
76
|
+
/** Make the entire card clickable (cursor + hover/focus ring) */
|
|
77
|
+
interactive?: boolean;
|
|
78
|
+
/** Locale @default 'fa' */
|
|
79
|
+
locale?: SupportedLocale;
|
|
80
|
+
}
|
|
81
|
+
declare const ConceptCard: React.ForwardRefExoticComponent<ConceptCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
82
|
+
|
|
83
|
+
export { ConceptCard as C, type FlowData as F, type SentimentData as S, type ConceptCardProps as a, FlowDistribution as b, type FlowDistributionProps as c, SentimentDistribution as d, type SentimentDistributionProps as e };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { S as SupportedLocale } from './utils-DlXWmDZ-.cjs';
|
|
3
|
+
import { F as FlowKey, c as StatusKey, d as SeverityKey } from './i18n-CAd9wGOr.cjs';
|
|
4
|
+
|
|
5
|
+
type FlowData = Partial<Record<FlowKey, number>>;
|
|
6
|
+
interface FlowDistributionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/** Flow counts (auto-normalized). Missing keys treated as 0. */
|
|
8
|
+
data: FlowData;
|
|
9
|
+
/** Display mode */
|
|
10
|
+
variant?: 'bars' | 'stacked' | 'compact';
|
|
11
|
+
/** Show numeric counts alongside percent */
|
|
12
|
+
showCounts?: boolean;
|
|
13
|
+
/** Show percentages */
|
|
14
|
+
showPercent?: boolean;
|
|
15
|
+
/** Locale */
|
|
16
|
+
locale?: SupportedLocale;
|
|
17
|
+
/** Loading skeleton */
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare const FlowDistribution: React.ForwardRefExoticComponent<FlowDistributionProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
|
|
22
|
+
interface SentimentData {
|
|
23
|
+
positive: number;
|
|
24
|
+
negative: number;
|
|
25
|
+
neutral: number;
|
|
26
|
+
mixed?: number;
|
|
27
|
+
}
|
|
28
|
+
interface SentimentDistributionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
29
|
+
/** Sentiment counts (will be auto-normalized to 100%) */
|
|
30
|
+
data: SentimentData;
|
|
31
|
+
/** Display mode */
|
|
32
|
+
variant?: 'bars' | 'stacked' | 'compact';
|
|
33
|
+
/** Show numeric count labels */
|
|
34
|
+
showCounts?: boolean;
|
|
35
|
+
/** Show percentage labels */
|
|
36
|
+
showPercent?: boolean;
|
|
37
|
+
/** Locale for number/label formatting */
|
|
38
|
+
locale?: SupportedLocale;
|
|
39
|
+
/** Show loading skeleton */
|
|
40
|
+
isLoading?: boolean;
|
|
41
|
+
}
|
|
42
|
+
declare const SentimentDistribution: React.ForwardRefExoticComponent<SentimentDistributionProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* ConceptCard — افکارسنجی-flavored headline tile for clustering dashboards.
|
|
46
|
+
* Composes: status badge, severity badge, flow composition bar, sentiment
|
|
47
|
+
* distribution, sparkline trend, AI summary snippet, optional comparison
|
|
48
|
+
* checkbox. Built for government dashboards where each "concept" needs
|
|
49
|
+
* to fit in a card grid with rich, comparable signals.
|
|
50
|
+
*/
|
|
51
|
+
interface ConceptCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
52
|
+
/** Concept name (e.g., "افزایش قیمت بنزین") */
|
|
53
|
+
title: React.ReactNode;
|
|
54
|
+
/** Short subtitle (e.g., "خوشه ۴ — ۱۲۰ پست") */
|
|
55
|
+
subtitle?: React.ReactNode;
|
|
56
|
+
/** Operational status */
|
|
57
|
+
status?: StatusKey;
|
|
58
|
+
/** Criticality of the concept (urgent/high/medium/low) */
|
|
59
|
+
severity?: SeverityKey;
|
|
60
|
+
/** Flow composition breakdown (5-class political) */
|
|
61
|
+
flow?: FlowData;
|
|
62
|
+
/** Sentiment composition (3-class) */
|
|
63
|
+
sentiment?: SentimentData;
|
|
64
|
+
/** Trend sparkline values (e.g., last 14 days mention volume) */
|
|
65
|
+
trend?: number[];
|
|
66
|
+
/** AI-generated short summary (1-2 sentences) */
|
|
67
|
+
aiSummary?: React.ReactNode;
|
|
68
|
+
/** Total mentions / size — shown as a stat */
|
|
69
|
+
totalCount?: number;
|
|
70
|
+
/** Comparison checkbox state. When provided, renders the checkbox in the header */
|
|
71
|
+
comparison?: {
|
|
72
|
+
selected: boolean;
|
|
73
|
+
onSelectionChange: (next: boolean) => void;
|
|
74
|
+
label?: React.ReactNode;
|
|
75
|
+
};
|
|
76
|
+
/** Make the entire card clickable (cursor + hover/focus ring) */
|
|
77
|
+
interactive?: boolean;
|
|
78
|
+
/** Locale @default 'fa' */
|
|
79
|
+
locale?: SupportedLocale;
|
|
80
|
+
}
|
|
81
|
+
declare const ConceptCard: React.ForwardRefExoticComponent<ConceptCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
82
|
+
|
|
83
|
+
export { ConceptCard as C, type FlowData as F, type SentimentData as S, type ConceptCardProps as a, FlowDistribution as b, type FlowDistributionProps as c, SentimentDistribution as d, type SentimentDistributionProps as e };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkISCSZMYW_cjs = require('../chunk-ISCSZMYW.cjs');
|
|
4
|
+
require('../chunk-U5FLLCGC.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "HotkeyProvider", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkISCSZMYW_cjs.HotkeyProvider; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "useHotkey", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkISCSZMYW_cjs.useHotkey; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "useHotkeyRegistry", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkISCSZMYW_cjs.useHotkeyRegistry; }
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=use-hotkey-registry.cjs.map
|
|
21
|
+
//# sourceMappingURL=use-hotkey-registry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-hotkey-registry.cjs"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { HotkeyCombo } from './use-hotkeys.cjs';
|
|
4
|
+
|
|
5
|
+
interface RegisteredHotkey {
|
|
6
|
+
/** Stable id — used for de-registration + dedupe. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** The combo string(s) — `'mod+k'`, `['escape', 'mod+w']`, etc. */
|
|
9
|
+
combo: HotkeyCombo;
|
|
10
|
+
/** Short human-readable description (e.g. "باز کردن پالت دستور"). */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** Optional grouping label for cheatsheet rendering ("سراسری", "ناوبری"…). */
|
|
13
|
+
group?: string;
|
|
14
|
+
/** When false, the entry is listed but the listener doesn't fire. */
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface HotkeyProviderProps {
|
|
18
|
+
/** Globally disable all registered hotkeys (e.g. while a modal owns the page). */
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Centralised hotkey registry. Wrap your app once; descendants register
|
|
24
|
+
* combos via `useHotkey()` and any UI (CommandPalette, help cheatsheet)
|
|
25
|
+
* can read the full list via `useHotkeyRegistry()`.
|
|
26
|
+
*
|
|
27
|
+
* Compared to scattering `useHotkeys` calls across the tree:
|
|
28
|
+
* - Per-entry mounting is centralized (one place that handles
|
|
29
|
+
* `enabled`, key parsing, ignore-when-typing semantics)
|
|
30
|
+
* - Discoverable: cheatsheets / palettes can list every active combo
|
|
31
|
+
* - De-duplicated: registering the same id twice replaces the entry
|
|
32
|
+
*
|
|
33
|
+
* Optional. `useHotkeys` (the bare hook) continues to work outside a provider.
|
|
34
|
+
*/
|
|
35
|
+
declare function HotkeyProvider({ enabled, children }: HotkeyProviderProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* Register a hotkey under the active provider. The combo is added to the
|
|
38
|
+
* cheatsheet-readable registry; the handler fires when the combo matches
|
|
39
|
+
* (subject to `useHotkeys` rules around editable targets + modifiers).
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* useHotkey('palette', 'mod+k', () => setOpen(true), {
|
|
43
|
+
* description: 'باز کردن پالت دستور',
|
|
44
|
+
* group: 'سراسری',
|
|
45
|
+
* })
|
|
46
|
+
*
|
|
47
|
+
* The first argument is a stable id — use a unique slug per call site so
|
|
48
|
+
* registry updates can dedupe. When called outside a `<HotkeyProvider>`,
|
|
49
|
+
* silently no-ops (so consumers can layer the provider in later without
|
|
50
|
+
* a refactor sweep).
|
|
51
|
+
*/
|
|
52
|
+
declare function useHotkey(id: string, combo: HotkeyCombo, handler: (event: KeyboardEvent) => void, options?: {
|
|
53
|
+
description?: string;
|
|
54
|
+
group?: string;
|
|
55
|
+
enabled?: boolean;
|
|
56
|
+
}): void;
|
|
57
|
+
/**
|
|
58
|
+
* Read the active registry. Returns an empty array outside a provider.
|
|
59
|
+
* Useful for CommandPalette items, "?" cheatsheet overlays, settings pages.
|
|
60
|
+
*/
|
|
61
|
+
declare function useHotkeyRegistry(): {
|
|
62
|
+
hotkeys: RegisteredHotkey[];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { HotkeyProvider, type HotkeyProviderProps, type RegisteredHotkey, useHotkey, useHotkeyRegistry };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { HotkeyCombo } from './use-hotkeys.js';
|
|
4
|
+
|
|
5
|
+
interface RegisteredHotkey {
|
|
6
|
+
/** Stable id — used for de-registration + dedupe. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** The combo string(s) — `'mod+k'`, `['escape', 'mod+w']`, etc. */
|
|
9
|
+
combo: HotkeyCombo;
|
|
10
|
+
/** Short human-readable description (e.g. "باز کردن پالت دستور"). */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** Optional grouping label for cheatsheet rendering ("سراسری", "ناوبری"…). */
|
|
13
|
+
group?: string;
|
|
14
|
+
/** When false, the entry is listed but the listener doesn't fire. */
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface HotkeyProviderProps {
|
|
18
|
+
/** Globally disable all registered hotkeys (e.g. while a modal owns the page). */
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Centralised hotkey registry. Wrap your app once; descendants register
|
|
24
|
+
* combos via `useHotkey()` and any UI (CommandPalette, help cheatsheet)
|
|
25
|
+
* can read the full list via `useHotkeyRegistry()`.
|
|
26
|
+
*
|
|
27
|
+
* Compared to scattering `useHotkeys` calls across the tree:
|
|
28
|
+
* - Per-entry mounting is centralized (one place that handles
|
|
29
|
+
* `enabled`, key parsing, ignore-when-typing semantics)
|
|
30
|
+
* - Discoverable: cheatsheets / palettes can list every active combo
|
|
31
|
+
* - De-duplicated: registering the same id twice replaces the entry
|
|
32
|
+
*
|
|
33
|
+
* Optional. `useHotkeys` (the bare hook) continues to work outside a provider.
|
|
34
|
+
*/
|
|
35
|
+
declare function HotkeyProvider({ enabled, children }: HotkeyProviderProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* Register a hotkey under the active provider. The combo is added to the
|
|
38
|
+
* cheatsheet-readable registry; the handler fires when the combo matches
|
|
39
|
+
* (subject to `useHotkeys` rules around editable targets + modifiers).
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* useHotkey('palette', 'mod+k', () => setOpen(true), {
|
|
43
|
+
* description: 'باز کردن پالت دستور',
|
|
44
|
+
* group: 'سراسری',
|
|
45
|
+
* })
|
|
46
|
+
*
|
|
47
|
+
* The first argument is a stable id — use a unique slug per call site so
|
|
48
|
+
* registry updates can dedupe. When called outside a `<HotkeyProvider>`,
|
|
49
|
+
* silently no-ops (so consumers can layer the provider in later without
|
|
50
|
+
* a refactor sweep).
|
|
51
|
+
*/
|
|
52
|
+
declare function useHotkey(id: string, combo: HotkeyCombo, handler: (event: KeyboardEvent) => void, options?: {
|
|
53
|
+
description?: string;
|
|
54
|
+
group?: string;
|
|
55
|
+
enabled?: boolean;
|
|
56
|
+
}): void;
|
|
57
|
+
/**
|
|
58
|
+
* Read the active registry. Returns an empty array outside a provider.
|
|
59
|
+
* Useful for CommandPalette items, "?" cheatsheet overlays, settings pages.
|
|
60
|
+
*/
|
|
61
|
+
declare function useHotkeyRegistry(): {
|
|
62
|
+
hotkeys: RegisteredHotkey[];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { HotkeyProvider, type HotkeyProviderProps, type RegisteredHotkey, useHotkey, useHotkeyRegistry };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-hotkey-registry.js"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkU5FLLCGC_cjs = require('../chunk-U5FLLCGC.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "formatHotkey", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkU5FLLCGC_cjs.formatHotkey; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "useHotkeys", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkU5FLLCGC_cjs.useHotkeys; }
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=use-hotkeys.cjs.map
|
|
16
|
+
//# sourceMappingURL=use-hotkeys.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-hotkeys.cjs"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hotkey string grammar:
|
|
5
|
+
*
|
|
6
|
+
* <part>[+<part>]*
|
|
7
|
+
*
|
|
8
|
+
* where each <part> is one of:
|
|
9
|
+
* mod — Cmd on macOS, Ctrl on everything else (recommended)
|
|
10
|
+
* ctrl / cmd — explicit, cross-platform tokens
|
|
11
|
+
* shift | alt | meta
|
|
12
|
+
* <single key> — lowercase character, 'space', 'enter', 'escape', 'tab',
|
|
13
|
+
* arrow{up,down,left,right}, 'slash', 'backspace', etc.
|
|
14
|
+
*
|
|
15
|
+
* Examples:
|
|
16
|
+
* 'mod+k' — ⌘K on macOS, CtrlK elsewhere
|
|
17
|
+
* 'mod+shift+p'
|
|
18
|
+
* 'escape'
|
|
19
|
+
* 'ctrl+k' — explicit Ctrl (no Cmd fallback on macOS)
|
|
20
|
+
*
|
|
21
|
+
* Passing an array of strings is treated as an OR — any combo fires the handler.
|
|
22
|
+
*/
|
|
23
|
+
type HotkeyCombo = string | readonly string[];
|
|
24
|
+
interface UseHotkeysOptions {
|
|
25
|
+
/**
|
|
26
|
+
* When true, `event.preventDefault()` is called on matched combos.
|
|
27
|
+
* Default: true. Useful to allow the browser's native 'mod+k' (address bar)
|
|
28
|
+
* to keep working — set to false if the handler only does something conditionally.
|
|
29
|
+
*/
|
|
30
|
+
preventDefault?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Skip the handler when focus is inside an editable control (input, textarea,
|
|
33
|
+
* contenteditable). The exception: combos that include a modifier (mod/ctrl/
|
|
34
|
+
* cmd/alt) still fire — they are unambiguous shortcuts, not typing.
|
|
35
|
+
* Default: true.
|
|
36
|
+
*/
|
|
37
|
+
ignoreWhenTyping?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* When false, the hook unregisters its listener. Useful for conditionally
|
|
40
|
+
* enabling shortcuts (e.g., only while a panel is open).
|
|
41
|
+
* Default: true.
|
|
42
|
+
*/
|
|
43
|
+
enabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* DOM target. Defaults to `document`. Pass a ref for scoped shortcuts (e.g.,
|
|
46
|
+
* only when a specific panel has focus within).
|
|
47
|
+
*/
|
|
48
|
+
target?: React.RefObject<HTMLElement | null> | HTMLElement | Document | null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Register a keyboard shortcut. Handler fires when the combo matches, respecting
|
|
52
|
+
* `ignoreWhenTyping` (default true) — except when a modifier is part of the combo,
|
|
53
|
+
* which always wins. Returns nothing; cleanup is automatic.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* useHotkeys('mod+k', () => setOpen((v) => !v))
|
|
57
|
+
* useHotkeys(['escape', 'mod+w'], close, { enabled: open })
|
|
58
|
+
*/
|
|
59
|
+
declare function useHotkeys(combo: HotkeyCombo, handler: (event: KeyboardEvent) => void, options?: UseHotkeysOptions): void;
|
|
60
|
+
/**
|
|
61
|
+
* Render-helper: returns a platform-appropriate display string for a combo.
|
|
62
|
+
* 'mod+k' → '⌘K' on macOS, 'Ctrl+K' elsewhere. Useful for `<CommandShortcut>`.
|
|
63
|
+
*/
|
|
64
|
+
declare function formatHotkey(combo: string): string;
|
|
65
|
+
|
|
66
|
+
export { type HotkeyCombo, type UseHotkeysOptions, formatHotkey, useHotkeys };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hotkey string grammar:
|
|
5
|
+
*
|
|
6
|
+
* <part>[+<part>]*
|
|
7
|
+
*
|
|
8
|
+
* where each <part> is one of:
|
|
9
|
+
* mod — Cmd on macOS, Ctrl on everything else (recommended)
|
|
10
|
+
* ctrl / cmd — explicit, cross-platform tokens
|
|
11
|
+
* shift | alt | meta
|
|
12
|
+
* <single key> — lowercase character, 'space', 'enter', 'escape', 'tab',
|
|
13
|
+
* arrow{up,down,left,right}, 'slash', 'backspace', etc.
|
|
14
|
+
*
|
|
15
|
+
* Examples:
|
|
16
|
+
* 'mod+k' — ⌘K on macOS, CtrlK elsewhere
|
|
17
|
+
* 'mod+shift+p'
|
|
18
|
+
* 'escape'
|
|
19
|
+
* 'ctrl+k' — explicit Ctrl (no Cmd fallback on macOS)
|
|
20
|
+
*
|
|
21
|
+
* Passing an array of strings is treated as an OR — any combo fires the handler.
|
|
22
|
+
*/
|
|
23
|
+
type HotkeyCombo = string | readonly string[];
|
|
24
|
+
interface UseHotkeysOptions {
|
|
25
|
+
/**
|
|
26
|
+
* When true, `event.preventDefault()` is called on matched combos.
|
|
27
|
+
* Default: true. Useful to allow the browser's native 'mod+k' (address bar)
|
|
28
|
+
* to keep working — set to false if the handler only does something conditionally.
|
|
29
|
+
*/
|
|
30
|
+
preventDefault?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Skip the handler when focus is inside an editable control (input, textarea,
|
|
33
|
+
* contenteditable). The exception: combos that include a modifier (mod/ctrl/
|
|
34
|
+
* cmd/alt) still fire — they are unambiguous shortcuts, not typing.
|
|
35
|
+
* Default: true.
|
|
36
|
+
*/
|
|
37
|
+
ignoreWhenTyping?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* When false, the hook unregisters its listener. Useful for conditionally
|
|
40
|
+
* enabling shortcuts (e.g., only while a panel is open).
|
|
41
|
+
* Default: true.
|
|
42
|
+
*/
|
|
43
|
+
enabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* DOM target. Defaults to `document`. Pass a ref for scoped shortcuts (e.g.,
|
|
46
|
+
* only when a specific panel has focus within).
|
|
47
|
+
*/
|
|
48
|
+
target?: React.RefObject<HTMLElement | null> | HTMLElement | Document | null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Register a keyboard shortcut. Handler fires when the combo matches, respecting
|
|
52
|
+
* `ignoreWhenTyping` (default true) — except when a modifier is part of the combo,
|
|
53
|
+
* which always wins. Returns nothing; cleanup is automatic.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* useHotkeys('mod+k', () => setOpen((v) => !v))
|
|
57
|
+
* useHotkeys(['escape', 'mod+w'], close, { enabled: open })
|
|
58
|
+
*/
|
|
59
|
+
declare function useHotkeys(combo: HotkeyCombo, handler: (event: KeyboardEvent) => void, options?: UseHotkeysOptions): void;
|
|
60
|
+
/**
|
|
61
|
+
* Render-helper: returns a platform-appropriate display string for a combo.
|
|
62
|
+
* 'mod+k' → '⌘K' on macOS, 'Ctrl+K' elsewhere. Useful for `<CommandShortcut>`.
|
|
63
|
+
*/
|
|
64
|
+
declare function formatHotkey(combo: string): string;
|
|
65
|
+
|
|
66
|
+
export { type HotkeyCombo, type UseHotkeysOptions, formatHotkey, useHotkeys };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-hotkeys.js"}
|