@sikka/hawa 0.36.2-next → 0.37.1-next

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.
Files changed (87) hide show
  1. package/dist/appLayout/index.js +1 -1
  2. package/dist/appLayout/index.js.map +1 -1
  3. package/dist/appLayout/index.mjs +1 -1
  4. package/dist/appLayout/index.mjs.map +1 -1
  5. package/dist/blocks/auth/index.js +24 -25
  6. package/dist/blocks/auth/index.mjs +4 -4
  7. package/dist/blocks/feedback/index.js +24 -25
  8. package/dist/blocks/feedback/index.mjs +5 -5
  9. package/dist/blocks/index.js +308 -192
  10. package/dist/blocks/index.mjs +3 -3
  11. package/dist/blocks/misc/index.js +270 -154
  12. package/dist/blocks/misc/index.mjs +53 -19
  13. package/dist/blocks/pricing/index.js +107 -22
  14. package/dist/blocks/pricing/index.mjs +4 -4
  15. package/dist/card/index.d.mts +3 -1
  16. package/dist/card/index.d.ts +3 -1
  17. package/dist/card/index.js +13 -11
  18. package/dist/card/index.js.map +1 -1
  19. package/dist/card/index.mjs +13 -11
  20. package/dist/card/index.mjs.map +1 -1
  21. package/dist/{chunk-WABHQMUI.mjs → chunk-BPHQFAWM.mjs} +1 -1
  22. package/dist/{chunk-MVKP55SZ.mjs → chunk-BTDR3VAG.mjs} +1 -1
  23. package/dist/{chunk-7L2JUNG2.mjs → chunk-DS3AACQJ.mjs} +1 -1
  24. package/dist/{chunk-BXBSZD5X.mjs → chunk-MDHDHEPZ.mjs} +1 -1
  25. package/dist/{chunk-6QIOEUE2.mjs → chunk-ODOCZAWC.mjs} +1 -1
  26. package/dist/{chunk-YP2CCKZG.mjs → chunk-PXGL7ZXQ.mjs} +13 -11
  27. package/dist/{chunk-HLYAX77R.mjs → chunk-QXH7ZDMN.mjs} +12 -15
  28. package/dist/{chunk-T33FXOHA.mjs → chunk-QYWOI3DO.mjs} +152 -41
  29. package/dist/{chunk-NNPNQK6F.mjs → chunk-RNFJAEEU.mjs} +13 -11
  30. package/dist/{chunk-OPYDG34F.mjs → chunk-ZBUBNKF6.mjs} +93 -1
  31. package/dist/{chunk-CJ57JBYA.mjs → chunk-ZTUWU652.mjs} +95 -12
  32. package/dist/combobox/index.d.mts +1 -4
  33. package/dist/combobox/index.d.ts +1 -4
  34. package/dist/combobox/index.js +2 -1
  35. package/dist/combobox/index.js.map +1 -1
  36. package/dist/combobox/index.mjs +2 -1
  37. package/dist/combobox/index.mjs.map +1 -1
  38. package/dist/command/index.d.mts +4 -36
  39. package/dist/command/index.d.ts +4 -36
  40. package/dist/command/index.js +43 -5
  41. package/dist/command/index.js.map +1 -1
  42. package/dist/command/index.mjs +39 -3
  43. package/dist/command/index.mjs.map +1 -1
  44. package/dist/destroyableCard/index.js +13 -11
  45. package/dist/destroyableCard/index.js.map +1 -1
  46. package/dist/destroyableCard/index.mjs +13 -11
  47. package/dist/destroyableCard/index.mjs.map +1 -1
  48. package/dist/elements/index.d.mts +31 -3
  49. package/dist/elements/index.d.ts +31 -3
  50. package/dist/elements/index.js +450 -295
  51. package/dist/elements/index.mjs +43 -6
  52. package/dist/hooks/index.d.mts +25 -1
  53. package/dist/hooks/index.d.ts +25 -1
  54. package/dist/hooks/index.js +96 -0
  55. package/dist/hooks/index.mjs +9 -1
  56. package/dist/index-e_Ob_SnB.d.mts +63 -0
  57. package/dist/index-e_Ob_SnB.d.ts +63 -0
  58. package/dist/index.css +20 -3
  59. package/dist/index.d.mts +55 -3
  60. package/dist/index.d.ts +55 -3
  61. package/dist/index.js +966 -718
  62. package/dist/index.mjs +494 -252
  63. package/dist/layout/index.js +14 -12
  64. package/dist/layout/index.mjs +3 -3
  65. package/dist/phoneInput/index.js +11 -14
  66. package/dist/phoneInput/index.js.map +1 -1
  67. package/dist/phoneInput/index.mjs +11 -14
  68. package/dist/phoneInput/index.mjs.map +1 -1
  69. package/dist/scrollArea/index.js +94 -11
  70. package/dist/scrollArea/index.js.map +1 -1
  71. package/dist/scrollArea/index.mjs +94 -11
  72. package/dist/scrollArea/index.mjs.map +1 -1
  73. package/dist/select/index.js +11 -14
  74. package/dist/select/index.js.map +1 -1
  75. package/dist/select/index.mjs +11 -14
  76. package/dist/select/index.mjs.map +1 -1
  77. package/dist/stats/index.js +13 -11
  78. package/dist/stats/index.js.map +1 -1
  79. package/dist/stats/index.mjs +13 -11
  80. package/dist/stats/index.mjs.map +1 -1
  81. package/dist/tabs/index.d.mts +3 -1
  82. package/dist/tabs/index.d.ts +3 -1
  83. package/dist/tabs/index.js +189 -32
  84. package/dist/tabs/index.js.map +1 -1
  85. package/dist/tabs/index.mjs +184 -27
  86. package/dist/tabs/index.mjs.map +1 -1
  87. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import {
3
3
  useMeasureDirty
4
- } from "./chunk-OPYDG34F.mjs";
4
+ } from "./chunk-ZBUBNKF6.mjs";
5
5
  import {
6
6
  Button,
7
7
  Chip,
8
8
  Label,
9
9
  Skeleton,
10
10
  cn
11
- } from "./chunk-NNPNQK6F.mjs";
11
+ } from "./chunk-RNFJAEEU.mjs";
12
12
 
13
13
  // elements/alert/Alert.tsx
14
14
  import React, { useRef, useState, useEffect } from "react";
@@ -389,6 +389,10 @@ var Select = ({
389
389
  children
390
390
  );
391
391
  };
392
+ let phoneCodeStyles = "hawa-min-w-[65px] hawa-text-right hawa-w-[100px] hawa-p-0 hawa-rounded-r-none hawa-h-[40px]";
393
+ let selectContainerStyles = "hawa-rounded hawa-block hawa-w-full hawa-border hawa-transition-all hawa-bg-background hawa-p-0 hawa-px-1 hawa-text-sm";
394
+ let selectPlaceholderStyles = "hawa-text-muted-foreground hawa-cursor-pointer hawa-px-1";
395
+ let selectIndicatorContainerStyles = "hawa-cursor-pointer hawa-text-muted-foreground hawa-absolute hawa-end-0 hawa-top-[50%] hawa-bottom-[50%] ";
392
396
  return /* @__PURE__ */ React3.createElement(
393
397
  "div",
394
398
  {
@@ -410,26 +414,22 @@ var Select = ({
410
414
  props.controlClassNames
411
415
  ),
412
416
  container: () => cn(
413
- "hawa-rounded ",
414
- props.phoneCode && "hawa-min-w-[65px] hawa-text-right hawa-w-[100px] hawa-p-0 hawa-rounded-r-none hawa-h-[40px] ",
415
- "hawa-block hawa-w-full hawa-rounded hawa-border hawa-transition-all hawa-bg-background hawa-p-0 hawa-px-1 hawa-text-sm",
417
+ selectContainerStyles,
418
+ props.phoneCode && phoneCodeStyles,
416
419
  props.disabled ? "hawa-cursor-not-allowed" : "hawa-cursor-pointer",
417
420
  props.isMulti && "hawa-ps-0 "
418
421
  ),
419
- placeholder: () => "hawa-text-muted-foreground hawa-cursor-pointer hawa-px-1",
422
+ placeholder: () => selectPlaceholderStyles,
420
423
  valueContainer: () => "hawa-text-foreground hawa-px-1 ",
421
424
  singleValue: () => "hawa-text-foreground",
422
425
  indicatorsContainer: () => cn(
423
- "hawa-cursor-pointer hawa-text-muted-foreground hawa-absolute hawa-end-0 hawa-top-[50%] hawa-bottom-[50%] ",
426
+ selectIndicatorContainerStyles,
424
427
  props.hideIndicator ? "hawa-invisible" : "hawa-px-1"
425
428
  )
426
429
  },
427
430
  unstyled: true,
428
- components: props.hideIndicator ? {
429
- Option,
430
- Menu,
431
- IndicatorsContainer: () => null
432
- } : {
431
+ autoFocus: false,
432
+ components: props.hideIndicator ? { Option, Menu, IndicatorsContainer: () => null } : {
433
433
  Option,
434
434
  Menu,
435
435
  // Control: (e) => (
@@ -451,10 +451,7 @@ var Select = ({
451
451
  MultiValueContainer: (e) => /* @__PURE__ */ React3.createElement(
452
452
  "div",
453
453
  {
454
- className: cn(
455
- // e.className,
456
- "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row"
457
- ),
454
+ className: "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row",
458
455
  ...e
459
456
  }
460
457
  )
@@ -2874,17 +2871,100 @@ Textarea.displayName = "Textarea";
2874
2871
  // elements/scrollArea/ScrollArea.tsx
2875
2872
  import * as React11 from "react";
2876
2873
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
2877
- var ScrollArea = React11.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ React11.createElement(
2878
- ScrollAreaPrimitive.Root,
2879
- {
2880
- ref,
2881
- className: cn("hawa-relative hawa-overflow-hidden", className),
2882
- ...props
2883
- },
2884
- /* @__PURE__ */ React11.createElement(ScrollAreaPrimitive.Viewport, { className: "hawa-h-full hawa-w-full hawa-rounded-[inherit]" }, children),
2885
- /* @__PURE__ */ React11.createElement(ScrollBar, { orientation }),
2886
- /* @__PURE__ */ React11.createElement(ScrollAreaPrimitive.Corner, null)
2887
- ));
2874
+ var ScrollArea = React11.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => {
2875
+ const scrollAreaRef = React11.useRef(null);
2876
+ const isDragging = React11.useRef(false);
2877
+ const startPos = React11.useRef({ x: 0, y: 0 });
2878
+ const scrollPos = React11.useRef({ top: 0, left: 0 });
2879
+ const [showLeftFade, setShowLeftFade] = React11.useState(false);
2880
+ const [showRightFade, setShowRightFade] = React11.useState(false);
2881
+ const checkOverflow = () => {
2882
+ if (scrollAreaRef.current) {
2883
+ const { scrollLeft, scrollWidth, clientWidth } = scrollAreaRef.current;
2884
+ setShowLeftFade(scrollLeft > 0);
2885
+ setShowRightFade(scrollLeft + clientWidth < scrollWidth);
2886
+ }
2887
+ };
2888
+ const onMouseDown = (e) => {
2889
+ isDragging.current = true;
2890
+ startPos.current = { x: e.clientX, y: e.clientY };
2891
+ if (scrollAreaRef.current) {
2892
+ scrollPos.current = {
2893
+ top: scrollAreaRef.current.scrollTop,
2894
+ left: scrollAreaRef.current.scrollLeft
2895
+ };
2896
+ }
2897
+ document.addEventListener("mousemove", onMouseMove);
2898
+ document.addEventListener("mouseup", onMouseUp);
2899
+ };
2900
+ const onMouseMove = (e) => {
2901
+ if (!isDragging.current || !scrollAreaRef.current)
2902
+ return;
2903
+ const dx = e.clientX - startPos.current.x;
2904
+ const dy = e.clientY - startPos.current.y;
2905
+ if (orientation === "vertical") {
2906
+ scrollAreaRef.current.scrollTop = scrollPos.current.top - dy;
2907
+ } else {
2908
+ scrollAreaRef.current.scrollLeft = scrollPos.current.left - dx;
2909
+ checkOverflow();
2910
+ }
2911
+ };
2912
+ const onMouseUp = () => {
2913
+ isDragging.current = false;
2914
+ document.removeEventListener("mousemove", onMouseMove);
2915
+ document.removeEventListener("mouseup", onMouseUp);
2916
+ };
2917
+ React11.useEffect(() => {
2918
+ checkOverflow();
2919
+ if (scrollAreaRef.current) {
2920
+ scrollAreaRef.current.addEventListener("scroll", checkOverflow);
2921
+ window.addEventListener("resize", checkOverflow);
2922
+ }
2923
+ return () => {
2924
+ if (scrollAreaRef.current) {
2925
+ scrollAreaRef.current.removeEventListener("scroll", checkOverflow);
2926
+ }
2927
+ window.removeEventListener("resize", checkOverflow);
2928
+ };
2929
+ }, []);
2930
+ return /* @__PURE__ */ React11.createElement(
2931
+ ScrollAreaPrimitive.Root,
2932
+ {
2933
+ ref,
2934
+ className: cn("hawa-relative hawa-overflow-hidden", className),
2935
+ ...props
2936
+ },
2937
+ /* @__PURE__ */ React11.createElement(
2938
+ "div",
2939
+ {
2940
+ className: cn(
2941
+ "hawa-pointer-events-none hawa-absolute hawa-bg-background/ hawa-h-full hawa-w-[50px] hawa-z-10 hawa-start-0 hawa-mask-fade-right",
2942
+ showLeftFade ? "hawa-block" : "hawa-hidden"
2943
+ )
2944
+ }
2945
+ ),
2946
+ /* @__PURE__ */ React11.createElement(
2947
+ "div",
2948
+ {
2949
+ className: cn(
2950
+ "hawa-pointer-events-none hawa-absolute hawa-bg-background/ hawa-mask-fade-left hawa-end-0 hawa-h-full hawa-w-[50px] hawa-z-10 ",
2951
+ showRightFade ? "hawa-block" : "hawa-hidden"
2952
+ )
2953
+ }
2954
+ ),
2955
+ /* @__PURE__ */ React11.createElement(
2956
+ ScrollAreaPrimitive.Viewport,
2957
+ {
2958
+ ref: scrollAreaRef,
2959
+ className: "hawa-h-full hawa-w-full hawa-rounded-[inherit]",
2960
+ onMouseDown
2961
+ },
2962
+ children
2963
+ ),
2964
+ /* @__PURE__ */ React11.createElement(ScrollBar, { orientation }),
2965
+ /* @__PURE__ */ React11.createElement(ScrollAreaPrimitive.Corner, null)
2966
+ );
2967
+ });
2888
2968
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
2889
2969
  var ScrollBar = React11.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ React11.createElement(
2890
2970
  ScrollAreaPrimitive.ScrollAreaScrollbar,
@@ -2976,9 +3056,9 @@ var tabsListVariant = tv({
2976
3056
  base: "",
2977
3057
  variants: {
2978
3058
  variant: {
2979
- default: "hawa-flex hawa-w-fit hawa-flex-wrap hawa-items-center hawa-justify-start hawa-gap-1 hawa-rounded hawa-border hawa-bg-muted hawa-p-1 hawa-text-muted-foreground dark:hawa-border-primary/10",
2980
- underlined: "hawa-flex hawa-w-fit hawa-flex-wrap hawa-items-center hawa-justify-start hawa-gap-1 hawa-rounded hawa-p-1 hawa-text-muted-foreground dark:hawa-border-primary/10",
2981
- underlined_tabs: "hawa-flex hawa-w-fit hawa-flex-wrap hawa-items-center hawa-justify-start hawa-gap-1 hawa-text-muted-foreground"
3059
+ default: "hawa-flex hawa-w-fit hawa-items-center hawa-justify-start hawa-gap-1 hawa-rounded hawa-border hawa-bg-muted hawa-p-1 hawa-text-muted-foreground dark:hawa-border-primary/10",
3060
+ underlined: "hawa-flex hawa-w-fit hawa-items-center hawa-justify-start hawa-gap-1 hawa-rounded hawa-p-1 hawa-text-muted-foreground dark:hawa-border-primary/10",
3061
+ underlined_tabs: "hawa-flex hawa-w-fit hawa-items-center hawa-justify-start hawa-gap-1 hawa-text-muted-foreground"
2982
3062
  },
2983
3063
  orientation: { horizontal: "", vertical: "" }
2984
3064
  },
@@ -3046,18 +3126,49 @@ var Tabs = React13.forwardRef(({ className, orientation, variant = "default", ..
3046
3126
  ));
3047
3127
  var TabsList = React13.forwardRef(({ className, ...props }, ref) => {
3048
3128
  const { orientation, variant } = React13.useContext(TabsContext);
3049
- return /* @__PURE__ */ React13.createElement(
3050
- TabsPrimitive.List,
3051
- {
3052
- ref,
3053
- className: cn(
3054
- tabsListVariant({ variant, orientation }),
3055
- orientation === "vertical" ? "hawa-flex-col" : "hawa-flex-row",
3056
- className
3057
- ),
3058
- ...props
3059
- }
3129
+ const [size, setSize] = React13.useState(
3130
+ typeof window !== "undefined" && window.innerWidth || 1200
3060
3131
  );
3132
+ React13.useEffect(() => {
3133
+ if (typeof window !== "undefined") {
3134
+ const resize = () => {
3135
+ setSize(window.innerWidth);
3136
+ };
3137
+ resize();
3138
+ window.addEventListener("resize", resize);
3139
+ return () => {
3140
+ window.removeEventListener("resize", resize);
3141
+ };
3142
+ }
3143
+ }, []);
3144
+ if ((props.scrollable || size < 768) && orientation === "horizontal") {
3145
+ return /* @__PURE__ */ React13.createElement(ScrollArea, { orientation: "horizontal" }, /* @__PURE__ */ React13.createElement(
3146
+ TabsPrimitive.List,
3147
+ {
3148
+ ref,
3149
+ className: cn(
3150
+ tabsListVariant({ variant, orientation }),
3151
+ "hawa-flex-row hawa-flex-nowrap",
3152
+ className
3153
+ ),
3154
+ ...props
3155
+ }
3156
+ ));
3157
+ } else {
3158
+ return /* @__PURE__ */ React13.createElement(
3159
+ TabsPrimitive.List,
3160
+ {
3161
+ ref,
3162
+ className: cn(
3163
+ tabsListVariant({ variant, orientation }),
3164
+ orientation === "vertical" ? "hawa-flex-col" : "hawa-flex-row",
3165
+ "hawa-flex-wrap",
3166
+ className
3167
+ ),
3168
+ ...props
3169
+ }
3170
+ );
3171
+ }
3061
3172
  });
3062
3173
  var TabsTrigger = React13.forwardRef(({ className, chipProps, ...props }, ref) => {
3063
3174
  const { orientation, variant } = React13.useContext(TabsContext);
@@ -832,17 +832,19 @@ var Card = React7.forwardRef(
832
832
  );
833
833
  }
834
834
  );
835
- var CardHeader = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React7.createElement(
836
- "div",
837
- {
838
- ref,
839
- className: cn(
840
- "hawa-flex hawa-flex-col hawa-space-y-1.5 hawa-p-6",
841
- className
842
- ),
843
- ...props
844
- }
845
- ));
835
+ var CardHeader = React7.forwardRef(
836
+ ({ className, ...props }, ref) => /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between" }, /* @__PURE__ */ React7.createElement(
837
+ "div",
838
+ {
839
+ ref,
840
+ className: cn(
841
+ "hawa-flex hawa-flex-col hawa-space-y-1.5 hawa-p-6",
842
+ className
843
+ ),
844
+ ...props
845
+ }
846
+ ), props.actions && /* @__PURE__ */ React7.createElement("div", { className: "hawa-p-6" }, props.actions))
847
+ );
846
848
  var CardTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React7.createElement(
847
849
  "h3",
848
850
  {
@@ -395,6 +395,94 @@ var useMeasureDirty = (ref) => {
395
395
  return rect;
396
396
  };
397
397
 
398
+ // hooks/useShortcuts.ts
399
+ import { useEffect as useEffect13 } from "react";
400
+ function parseHotkey(hotkey) {
401
+ const keys = hotkey.toLowerCase().split("+").map((part) => part.trim());
402
+ const modifiers = {
403
+ alt: keys.includes("alt"),
404
+ ctrl: keys.includes("ctrl"),
405
+ meta: keys.includes("meta"),
406
+ mod: keys.includes("mod"),
407
+ shift: keys.includes("shift")
408
+ };
409
+ const reservedKeys = ["alt", "ctrl", "meta", "shift", "mod"];
410
+ const freeKey = keys.find((key) => !reservedKeys.includes(key));
411
+ return {
412
+ ...modifiers,
413
+ key: freeKey
414
+ };
415
+ }
416
+ function isExactHotkey(hotkey, event) {
417
+ const { alt, ctrl, meta, mod, shift, key } = hotkey;
418
+ const { altKey, ctrlKey, metaKey, shiftKey, key: pressedKey } = event;
419
+ if (alt !== altKey) {
420
+ return false;
421
+ }
422
+ if (mod) {
423
+ if (!ctrlKey && !metaKey) {
424
+ return false;
425
+ }
426
+ } else {
427
+ if (ctrl !== ctrlKey) {
428
+ return false;
429
+ }
430
+ if (meta !== metaKey) {
431
+ return false;
432
+ }
433
+ }
434
+ if (shift !== shiftKey) {
435
+ return false;
436
+ }
437
+ if (key && (pressedKey.toLowerCase() === key.toLowerCase() || event.code.replace("Key", "").toLowerCase() === key.toLowerCase())) {
438
+ return true;
439
+ }
440
+ return false;
441
+ }
442
+ function getHotkeyMatcher(hotkey) {
443
+ return (event) => isExactHotkey(parseHotkey(hotkey), event);
444
+ }
445
+ function getHotkeyHandler(hotkeys) {
446
+ return (event) => {
447
+ const _event = "nativeEvent" in event ? event.nativeEvent : event;
448
+ hotkeys.forEach(([hotkey, handler, options = { preventDefault: true }]) => {
449
+ if (getHotkeyMatcher(hotkey)(_event)) {
450
+ if (options.preventDefault) {
451
+ event.preventDefault();
452
+ }
453
+ handler(_event);
454
+ }
455
+ });
456
+ };
457
+ }
458
+ function shouldFireEvent(event, tagsToIgnore, triggerOnContentEditable = false) {
459
+ if (event.target instanceof HTMLElement) {
460
+ if (triggerOnContentEditable) {
461
+ return !tagsToIgnore.includes(event.target.tagName);
462
+ }
463
+ return !event.target.isContentEditable && !tagsToIgnore.includes(event.target.tagName);
464
+ }
465
+ return true;
466
+ }
467
+ function useShortcuts(hotkeys, tagsToIgnore = ["INPUT", "TEXTAREA", "SELECT"], triggerOnContentEditable = false) {
468
+ useEffect13(() => {
469
+ const keydownListener = (event) => {
470
+ hotkeys.forEach(
471
+ ([hotkey, handler, options = { preventDefault: true }]) => {
472
+ if (getHotkeyMatcher(hotkey)(event) && shouldFireEvent(event, tagsToIgnore, triggerOnContentEditable)) {
473
+ if (options.preventDefault) {
474
+ event.preventDefault();
475
+ }
476
+ handler(event);
477
+ }
478
+ }
479
+ );
480
+ };
481
+ document.documentElement.addEventListener("keydown", keydownListener);
482
+ return () => document.documentElement.removeEventListener("keydown", keydownListener);
483
+ }, [hotkeys]);
484
+ }
485
+
398
486
  export {
399
487
  useIsomorphicEffect,
400
488
  reducer,
@@ -407,5 +495,9 @@ export {
407
495
  useFocusWithin,
408
496
  useMediaQuery,
409
497
  useTabs,
410
- useMeasureDirty
498
+ useMeasureDirty,
499
+ parseHotkey,
500
+ getHotkeyMatcher,
501
+ getHotkeyHandler,
502
+ useShortcuts
411
503
  };
@@ -1,22 +1,105 @@
1
1
  "use client";
2
2
  import {
3
3
  cn
4
- } from "./chunk-YP2CCKZG.mjs";
4
+ } from "./chunk-PXGL7ZXQ.mjs";
5
5
 
6
6
  // elements/scrollArea/ScrollArea.tsx
7
7
  import * as React from "react";
8
8
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
9
- var ScrollArea = React.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ React.createElement(
10
- ScrollAreaPrimitive.Root,
11
- {
12
- ref,
13
- className: cn("hawa-relative hawa-overflow-hidden", className),
14
- ...props
15
- },
16
- /* @__PURE__ */ React.createElement(ScrollAreaPrimitive.Viewport, { className: "hawa-h-full hawa-w-full hawa-rounded-[inherit]" }, children),
17
- /* @__PURE__ */ React.createElement(ScrollBar, { orientation }),
18
- /* @__PURE__ */ React.createElement(ScrollAreaPrimitive.Corner, null)
19
- ));
9
+ var ScrollArea = React.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => {
10
+ const scrollAreaRef = React.useRef(null);
11
+ const isDragging = React.useRef(false);
12
+ const startPos = React.useRef({ x: 0, y: 0 });
13
+ const scrollPos = React.useRef({ top: 0, left: 0 });
14
+ const [showLeftFade, setShowLeftFade] = React.useState(false);
15
+ const [showRightFade, setShowRightFade] = React.useState(false);
16
+ const checkOverflow = () => {
17
+ if (scrollAreaRef.current) {
18
+ const { scrollLeft, scrollWidth, clientWidth } = scrollAreaRef.current;
19
+ setShowLeftFade(scrollLeft > 0);
20
+ setShowRightFade(scrollLeft + clientWidth < scrollWidth);
21
+ }
22
+ };
23
+ const onMouseDown = (e) => {
24
+ isDragging.current = true;
25
+ startPos.current = { x: e.clientX, y: e.clientY };
26
+ if (scrollAreaRef.current) {
27
+ scrollPos.current = {
28
+ top: scrollAreaRef.current.scrollTop,
29
+ left: scrollAreaRef.current.scrollLeft
30
+ };
31
+ }
32
+ document.addEventListener("mousemove", onMouseMove);
33
+ document.addEventListener("mouseup", onMouseUp);
34
+ };
35
+ const onMouseMove = (e) => {
36
+ if (!isDragging.current || !scrollAreaRef.current)
37
+ return;
38
+ const dx = e.clientX - startPos.current.x;
39
+ const dy = e.clientY - startPos.current.y;
40
+ if (orientation === "vertical") {
41
+ scrollAreaRef.current.scrollTop = scrollPos.current.top - dy;
42
+ } else {
43
+ scrollAreaRef.current.scrollLeft = scrollPos.current.left - dx;
44
+ checkOverflow();
45
+ }
46
+ };
47
+ const onMouseUp = () => {
48
+ isDragging.current = false;
49
+ document.removeEventListener("mousemove", onMouseMove);
50
+ document.removeEventListener("mouseup", onMouseUp);
51
+ };
52
+ React.useEffect(() => {
53
+ checkOverflow();
54
+ if (scrollAreaRef.current) {
55
+ scrollAreaRef.current.addEventListener("scroll", checkOverflow);
56
+ window.addEventListener("resize", checkOverflow);
57
+ }
58
+ return () => {
59
+ if (scrollAreaRef.current) {
60
+ scrollAreaRef.current.removeEventListener("scroll", checkOverflow);
61
+ }
62
+ window.removeEventListener("resize", checkOverflow);
63
+ };
64
+ }, []);
65
+ return /* @__PURE__ */ React.createElement(
66
+ ScrollAreaPrimitive.Root,
67
+ {
68
+ ref,
69
+ className: cn("hawa-relative hawa-overflow-hidden", className),
70
+ ...props
71
+ },
72
+ /* @__PURE__ */ React.createElement(
73
+ "div",
74
+ {
75
+ className: cn(
76
+ "hawa-pointer-events-none hawa-absolute hawa-bg-background/ hawa-h-full hawa-w-[50px] hawa-z-10 hawa-start-0 hawa-mask-fade-right",
77
+ showLeftFade ? "hawa-block" : "hawa-hidden"
78
+ )
79
+ }
80
+ ),
81
+ /* @__PURE__ */ React.createElement(
82
+ "div",
83
+ {
84
+ className: cn(
85
+ "hawa-pointer-events-none hawa-absolute hawa-bg-background/ hawa-mask-fade-left hawa-end-0 hawa-h-full hawa-w-[50px] hawa-z-10 ",
86
+ showRightFade ? "hawa-block" : "hawa-hidden"
87
+ )
88
+ }
89
+ ),
90
+ /* @__PURE__ */ React.createElement(
91
+ ScrollAreaPrimitive.Viewport,
92
+ {
93
+ ref: scrollAreaRef,
94
+ className: "hawa-h-full hawa-w-full hawa-rounded-[inherit]",
95
+ onMouseDown
96
+ },
97
+ children
98
+ ),
99
+ /* @__PURE__ */ React.createElement(ScrollBar, { orientation }),
100
+ /* @__PURE__ */ React.createElement(ScrollAreaPrimitive.Corner, null)
101
+ );
102
+ });
20
103
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
21
104
  var ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ React.createElement(
22
105
  ScrollAreaPrimitive.ScrollAreaScrollbar,
@@ -1,11 +1,8 @@
1
1
  import * as React from 'react';
2
- import { CommandInputProps } from '../command/index.mjs';
2
+ import { P as PositionType, D as DirectionType, C as CommandInputProps } from '../index-e_Ob_SnB.mjs';
3
3
  import '@radix-ui/react-dialog';
4
4
  import 'cmdk';
5
5
 
6
- type DirectionType = "rtl" | "ltr";
7
- type PositionType = "top" | "bottom" | "right" | "left";
8
-
9
6
  type LabelProps = {
10
7
  hint?: React.ReactNode;
11
8
  hintSide?: PositionType;
@@ -1,11 +1,8 @@
1
1
  import * as React from 'react';
2
- import { CommandInputProps } from '../command/index.js';
2
+ import { P as PositionType, D as DirectionType, C as CommandInputProps } from '../index-e_Ob_SnB.js';
3
3
  import '@radix-ui/react-dialog';
4
4
  import 'cmdk';
5
5
 
6
- type DirectionType = "rtl" | "ltr";
7
- type PositionType = "top" | "bottom" | "right" | "left";
8
-
9
6
  type LabelProps = {
10
7
  hint?: React.ReactNode;
11
8
  hintSide?: PositionType;
@@ -48,6 +48,7 @@ function cn(...inputs) {
48
48
 
49
49
  // elements/command/Command.tsx
50
50
  var React2 = __toESM(require("react"));
51
+ var import_react_dialog = require("@radix-ui/react-dialog");
51
52
  var import_cmdk = require("cmdk");
52
53
 
53
54
  // elements/dialog/Dialog.tsx
@@ -449,7 +450,7 @@ var CommandShortcut = ({
449
450
  "span",
450
451
  {
451
452
  className: cn(
452
- "hawa-ml-auto hawa-text-xs hawa-tracking-widest hawa-text-muted-foreground",
453
+ "hawa-ms-auto hawa-text-xs hawa-tracking-widest hawa-text-muted-foreground",
453
454
  className
454
455
  ),
455
456
  ...props