asterui 0.12.15 → 0.12.16

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 (149) hide show
  1. package/README.md +1 -1
  2. package/dist/components/HoverGallery.d.ts +10 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +156 -154
  5. package/dist/index.js.map +1 -1
  6. package/dist/index100.js +11 -43
  7. package/dist/index100.js.map +1 -1
  8. package/dist/index101.js +44 -11
  9. package/dist/index101.js.map +1 -1
  10. package/dist/index102.js +10 -12
  11. package/dist/index102.js.map +1 -1
  12. package/dist/index103.js +14 -7
  13. package/dist/index103.js.map +1 -1
  14. package/dist/index104.js +7 -12
  15. package/dist/index104.js.map +1 -1
  16. package/dist/index105.js +11 -29
  17. package/dist/index105.js.map +1 -1
  18. package/dist/index106.js +29 -16
  19. package/dist/index106.js.map +1 -1
  20. package/dist/index107.js +21 -0
  21. package/dist/index107.js.map +1 -0
  22. package/dist/index21.js +1 -1
  23. package/dist/index37.js +15 -120
  24. package/dist/index37.js.map +1 -1
  25. package/dist/index38.js +119 -37
  26. package/dist/index38.js.map +1 -1
  27. package/dist/index39.js +40 -398
  28. package/dist/index39.js.map +1 -1
  29. package/dist/index40.js +390 -89
  30. package/dist/index40.js.map +1 -1
  31. package/dist/index41.js +90 -215
  32. package/dist/index41.js.map +1 -1
  33. package/dist/index42.js +211 -144
  34. package/dist/index42.js.map +1 -1
  35. package/dist/index43.js +155 -15
  36. package/dist/index43.js.map +1 -1
  37. package/dist/index44.js +15 -17
  38. package/dist/index44.js.map +1 -1
  39. package/dist/index45.js +17 -21
  40. package/dist/index45.js.map +1 -1
  41. package/dist/index46.js +18 -134
  42. package/dist/index46.js.map +1 -1
  43. package/dist/index47.js +134 -10
  44. package/dist/index47.js.map +1 -1
  45. package/dist/index48.js +13 -35
  46. package/dist/index48.js.map +1 -1
  47. package/dist/index49.js +35 -34
  48. package/dist/index49.js.map +1 -1
  49. package/dist/index50.js +34 -81
  50. package/dist/index50.js.map +1 -1
  51. package/dist/index51.js +71 -166
  52. package/dist/index51.js.map +1 -1
  53. package/dist/index52.js +167 -144
  54. package/dist/index52.js.map +1 -1
  55. package/dist/index53.js +152 -11
  56. package/dist/index53.js.map +1 -1
  57. package/dist/index54.js +10 -20
  58. package/dist/index54.js.map +1 -1
  59. package/dist/index55.js +22 -14
  60. package/dist/index55.js.map +1 -1
  61. package/dist/index56.js +14 -7
  62. package/dist/index56.js.map +1 -1
  63. package/dist/index57.js +6 -333
  64. package/dist/index57.js.map +1 -1
  65. package/dist/index58.js +334 -47
  66. package/dist/index58.js.map +1 -1
  67. package/dist/index59.js +47 -122
  68. package/dist/index59.js.map +1 -1
  69. package/dist/index60.js +120 -108
  70. package/dist/index60.js.map +1 -1
  71. package/dist/index61.js +107 -167
  72. package/dist/index61.js.map +1 -1
  73. package/dist/index62.js +167 -29
  74. package/dist/index62.js.map +1 -1
  75. package/dist/index63.js +30 -120
  76. package/dist/index63.js.map +1 -1
  77. package/dist/index64.js +116 -80
  78. package/dist/index64.js.map +1 -1
  79. package/dist/index65.js +85 -19
  80. package/dist/index65.js.map +1 -1
  81. package/dist/index66.js +19 -73
  82. package/dist/index66.js.map +1 -1
  83. package/dist/index67.js +71 -54
  84. package/dist/index67.js.map +1 -1
  85. package/dist/index68.js +56 -44
  86. package/dist/index68.js.map +1 -1
  87. package/dist/index69.js +42 -49
  88. package/dist/index69.js.map +1 -1
  89. package/dist/index70.js +50 -121
  90. package/dist/index70.js.map +1 -1
  91. package/dist/index71.js +118 -102
  92. package/dist/index71.js.map +1 -1
  93. package/dist/index72.js +107 -41
  94. package/dist/index72.js.map +1 -1
  95. package/dist/index73.js +41 -68
  96. package/dist/index73.js.map +1 -1
  97. package/dist/index74.js +66 -19
  98. package/dist/index74.js.map +1 -1
  99. package/dist/index75.js +18 -55
  100. package/dist/index75.js.map +1 -1
  101. package/dist/index76.js +55 -251
  102. package/dist/index76.js.map +1 -1
  103. package/dist/index77.js +254 -22
  104. package/dist/index77.js.map +1 -1
  105. package/dist/index78.js +22 -31
  106. package/dist/index78.js.map +1 -1
  107. package/dist/index79.js +30 -93
  108. package/dist/index79.js.map +1 -1
  109. package/dist/index80.js +89 -324
  110. package/dist/index80.js.map +1 -1
  111. package/dist/index81.js +322 -73
  112. package/dist/index81.js.map +1 -1
  113. package/dist/index82.js +79 -39
  114. package/dist/index82.js.map +1 -1
  115. package/dist/index83.js +40 -23
  116. package/dist/index83.js.map +1 -1
  117. package/dist/index84.js +21 -93
  118. package/dist/index84.js.map +1 -1
  119. package/dist/index85.js +87 -148
  120. package/dist/index85.js.map +1 -1
  121. package/dist/index86.js +147 -152
  122. package/dist/index86.js.map +1 -1
  123. package/dist/index87.js +159 -63
  124. package/dist/index87.js.map +1 -1
  125. package/dist/index88.js +65 -35
  126. package/dist/index88.js.map +1 -1
  127. package/dist/index89.js +35 -234
  128. package/dist/index89.js.map +1 -1
  129. package/dist/index90.js +231 -31
  130. package/dist/index90.js.map +1 -1
  131. package/dist/index91.js +34 -210
  132. package/dist/index91.js.map +1 -1
  133. package/dist/index92.js +195 -198
  134. package/dist/index92.js.map +1 -1
  135. package/dist/index93.js +159 -241
  136. package/dist/index93.js.map +1 -1
  137. package/dist/index94.js +283 -166
  138. package/dist/index94.js.map +1 -1
  139. package/dist/index95.js +173 -253
  140. package/dist/index95.js.map +1 -1
  141. package/dist/index96.js +258 -14
  142. package/dist/index96.js.map +1 -1
  143. package/dist/index97.js +12 -31
  144. package/dist/index97.js.map +1 -1
  145. package/dist/index98.js +32 -5
  146. package/dist/index98.js.map +1 -1
  147. package/dist/index99.js +5 -13
  148. package/dist/index99.js.map +1 -1
  149. package/package.json +1 -1
package/dist/index103.js CHANGED
@@ -1,11 +1,18 @@
1
- import { useRef as t, useEffect as o } from "react";
2
- function f(r) {
3
- const e = t(void 0);
4
- return o(() => {
5
- e.current = r;
6
- }, [r]), e.current;
1
+ import { useRef as s, useEffect as c } from "react";
2
+ function m(t, n = !0) {
3
+ const r = s(null);
4
+ return c(() => {
5
+ if (!n) return;
6
+ const e = (o) => {
7
+ const u = r.current;
8
+ !u || u.contains(o.target) || t(o);
9
+ };
10
+ return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e), () => {
11
+ document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
12
+ };
13
+ }, [t, n]), r;
7
14
  }
8
15
  export {
9
- f as usePrevious
16
+ m as useClickOutside
10
17
  };
11
18
  //# sourceMappingURL=index103.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index103.js","sources":["../src/hooks/usePrevious.ts"],"sourcesContent":["import { useRef, useEffect } from 'react'\n\n/**\n * Hook that returns the previous value of a variable.\n * Useful for comparing current and previous values in effects.\n *\n * @param value - Current value\n * @returns Previous value (undefined on first render)\n *\n * @example\n * const [count, setCount] = useState(0)\n * const prevCount = usePrevious(count)\n *\n * // prevCount is the value from previous render\n * console.log(`Changed from ${prevCount} to ${count}`)\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>(undefined)\n\n useEffect(() => {\n ref.current = value\n }, [value])\n\n return ref.current\n}\n"],"names":["usePrevious","value","ref","useRef","useEffect"],"mappings":";AAgBO,SAASA,EAAeC,GAAyB;AACtD,QAAMC,IAAMC,EAAsB,MAAS;AAE3C,SAAAC,EAAU,MAAM;AACd,IAAAF,EAAI,UAAUD;AAAA,EAChB,GAAG,CAACA,CAAK,CAAC,GAEHC,EAAI;AACb;"}
1
+ {"version":3,"file":"index103.js","sources":["../src/hooks/useClickOutside.ts"],"sourcesContent":["import { useEffect, useRef, type RefObject } from 'react'\n\n/**\n * Hook that detects clicks outside of a referenced element.\n * Useful for closing dropdowns, modals, or menus.\n *\n * @param handler - Callback when click outside is detected\n * @param enabled - Whether the listener is active (default: true)\n * @returns Ref to attach to the element\n *\n * @example\n * const ref = useClickOutside(() => setIsOpen(false))\n *\n * <div ref={ref}>\n * <Dropdown>...</Dropdown>\n * </div>\n */\nexport function useClickOutside<T extends HTMLElement = HTMLElement>(\n handler: (event: MouseEvent | TouchEvent) => void,\n enabled = true\n): RefObject<T | null> {\n const ref = useRef<T>(null)\n\n useEffect(() => {\n if (!enabled) return\n\n const listener = (event: MouseEvent | TouchEvent) => {\n const el = ref.current\n if (!el || el.contains(event.target as Node)) {\n return\n }\n handler(event)\n }\n\n document.addEventListener('mousedown', listener)\n document.addEventListener('touchstart', listener)\n\n return () => {\n document.removeEventListener('mousedown', listener)\n document.removeEventListener('touchstart', listener)\n }\n }, [handler, enabled])\n\n return ref\n}\n"],"names":["useClickOutside","handler","enabled","ref","useRef","useEffect","listener","event","el"],"mappings":";AAiBO,SAASA,EACdC,GACAC,IAAU,IACW;AACrB,QAAMC,IAAMC,EAAU,IAAI;AAE1B,SAAAC,EAAU,MAAM;AACd,QAAI,CAACH,EAAS;AAEd,UAAMI,IAAW,CAACC,MAAmC;AACnD,YAAMC,IAAKL,EAAI;AACf,MAAI,CAACK,KAAMA,EAAG,SAASD,EAAM,MAAc,KAG3CN,EAAQM,CAAK;AAAA,IACf;AAEA,oBAAS,iBAAiB,aAAaD,CAAQ,GAC/C,SAAS,iBAAiB,cAAcA,CAAQ,GAEzC,MAAM;AACX,eAAS,oBAAoB,aAAaA,CAAQ,GAClD,SAAS,oBAAoB,cAAcA,CAAQ;AAAA,IACrD;AAAA,EACF,GAAG,CAACL,GAASC,CAAO,CAAC,GAEdC;AACT;"}
package/dist/index104.js CHANGED
@@ -1,16 +1,11 @@
1
- import { useState as u, useRef as v, useEffect as a } from "react";
2
- function f() {
3
- const [o, t] = u(!1), n = v(null);
4
- return a(() => {
5
- const e = n.current;
6
- if (!e) return;
7
- const r = () => t(!0), s = () => t(!1);
8
- return e.addEventListener("mouseenter", r), e.addEventListener("mouseleave", s), () => {
9
- e.removeEventListener("mouseenter", r), e.removeEventListener("mouseleave", s);
10
- };
11
- }, []), { ref: n, isHovered: o };
1
+ import { useRef as t, useEffect as o } from "react";
2
+ function f(r) {
3
+ const e = t(void 0);
4
+ return o(() => {
5
+ e.current = r;
6
+ }, [r]), e.current;
12
7
  }
13
8
  export {
14
- f as useHover
9
+ f as usePrevious
15
10
  };
16
11
  //# sourceMappingURL=index104.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index104.js","sources":["../src/hooks/useHover.ts"],"sourcesContent":["import { useState, useRef, useEffect, type RefObject } from 'react'\n\nexport interface UseHoverReturn<T extends HTMLElement> {\n ref: RefObject<T | null>\n isHovered: boolean\n}\n\n/**\n * Hook that tracks hover state of an element.\n *\n * @returns Object with ref and isHovered state\n *\n * @example\n * const { ref, isHovered } = useHover<HTMLDivElement>()\n *\n * <div ref={ref} className={isHovered ? 'bg-blue-500' : 'bg-gray-500'}>\n * Hover me!\n * </div>\n */\nexport function useHover<T extends HTMLElement = HTMLElement>(): UseHoverReturn<T> {\n const [isHovered, setIsHovered] = useState(false)\n const ref = useRef<T>(null)\n\n useEffect(() => {\n const node = ref.current\n if (!node) return\n\n const handleMouseEnter = () => setIsHovered(true)\n const handleMouseLeave = () => setIsHovered(false)\n\n node.addEventListener('mouseenter', handleMouseEnter)\n node.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n node.removeEventListener('mouseenter', handleMouseEnter)\n node.removeEventListener('mouseleave', handleMouseLeave)\n }\n }, [])\n\n return { ref, isHovered }\n}\n"],"names":["useHover","isHovered","setIsHovered","useState","ref","useRef","useEffect","node","handleMouseEnter","handleMouseLeave"],"mappings":";AAmBO,SAASA,IAAmE;AACjF,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,IAAMC,EAAU,IAAI;AAE1B,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAOH,EAAI;AACjB,QAAI,CAACG,EAAM;AAEX,UAAMC,IAAmB,MAAMN,EAAa,EAAI,GAC1CO,IAAmB,MAAMP,EAAa,EAAK;AAEjD,WAAAK,EAAK,iBAAiB,cAAcC,CAAgB,GACpDD,EAAK,iBAAiB,cAAcE,CAAgB,GAE7C,MAAM;AACX,MAAAF,EAAK,oBAAoB,cAAcC,CAAgB,GACvDD,EAAK,oBAAoB,cAAcE,CAAgB;AAAA,IACzD;AAAA,EACF,GAAG,CAAA,CAAE,GAEE,EAAE,KAAAL,GAAK,WAAAH,EAAA;AAChB;"}
1
+ {"version":3,"file":"index104.js","sources":["../src/hooks/usePrevious.ts"],"sourcesContent":["import { useRef, useEffect } from 'react'\n\n/**\n * Hook that returns the previous value of a variable.\n * Useful for comparing current and previous values in effects.\n *\n * @param value - Current value\n * @returns Previous value (undefined on first render)\n *\n * @example\n * const [count, setCount] = useState(0)\n * const prevCount = usePrevious(count)\n *\n * // prevCount is the value from previous render\n * console.log(`Changed from ${prevCount} to ${count}`)\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>(undefined)\n\n useEffect(() => {\n ref.current = value\n }, [value])\n\n return ref.current\n}\n"],"names":["usePrevious","value","ref","useRef","useEffect"],"mappings":";AAgBO,SAASA,EAAeC,GAAyB;AACtD,QAAMC,IAAMC,EAAsB,MAAS;AAE3C,SAAAC,EAAU,MAAM;AACd,IAAAF,EAAI,UAAUD;AAAA,EAChB,GAAG,CAACA,CAAK,CAAC,GAEHC,EAAI;AACb;"}
package/dist/index105.js CHANGED
@@ -1,34 +1,16 @@
1
- import { useState as v, useCallback as i, useEffect as l } from "react";
2
- function c(n, f = {}) {
3
- const { target: u, event: o = "keydown", preventDefault: r = !1 } = f, [a, d] = v(!1), t = i(
4
- (e) => {
5
- e.key === n && (r && e.preventDefault(), d(!0));
6
- },
7
- [n, r]
8
- ), s = i(
9
- (e) => {
10
- e.key === n && d(!1);
11
- },
12
- [n]
13
- );
14
- return l(() => {
15
- const e = u ?? window;
16
- return o === "keydown" ? (e.addEventListener("keydown", t), e.addEventListener("keyup", s)) : e.addEventListener("keyup", t), () => {
17
- e.removeEventListener("keydown", t), e.removeEventListener("keyup", s);
1
+ import { useState as u, useRef as v, useEffect as a } from "react";
2
+ function f() {
3
+ const [o, t] = u(!1), n = v(null);
4
+ return a(() => {
5
+ const e = n.current;
6
+ if (!e) return;
7
+ const r = () => t(!0), s = () => t(!1);
8
+ return e.addEventListener("mouseenter", r), e.addEventListener("mouseleave", s), () => {
9
+ e.removeEventListener("mouseenter", r), e.removeEventListener("mouseleave", s);
18
10
  };
19
- }, [u, o, t, s]), a;
20
- }
21
- function y(n, f, u = {}) {
22
- const { target: o, event: r = "keydown", preventDefault: a = !1 } = u;
23
- l(() => {
24
- const d = o ?? window, t = (s) => {
25
- s.key === n && (a && s.preventDefault(), f(s));
26
- };
27
- return d.addEventListener(r, t), () => d.removeEventListener(r, t);
28
- }, [o, n, f, r, a]);
11
+ }, []), { ref: n, isHovered: o };
29
12
  }
30
13
  export {
31
- c as useKeyPress,
32
- y as useKeyPressCallback
14
+ f as useHover
33
15
  };
34
16
  //# sourceMappingURL=index105.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index105.js","sources":["../src/hooks/useKeyPress.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\n\nexport interface UseKeyPressOptions {\n /** Target element (default: window) */\n target?: HTMLElement | Window | null\n /** Event type: 'keydown' | 'keyup' (default: 'keydown') */\n event?: 'keydown' | 'keyup'\n /** Prevent default browser behavior */\n preventDefault?: boolean\n}\n\n/**\n * Hook that detects when a specific key is pressed.\n *\n * @param targetKey - Key to detect (e.g., 'Enter', 'Escape', 'a')\n * @param options - Configuration options\n * @returns Whether the key is currently pressed\n *\n * @example\n * const enterPressed = useKeyPress('Enter')\n * const escapePressed = useKeyPress('Escape')\n *\n * useEffect(() => {\n * if (escapePressed) closeModal()\n * }, [escapePressed])\n *\n * @example\n * // With callback for immediate action\n * useKeyPress('Escape', { preventDefault: true })\n */\nexport function useKeyPress(\n targetKey: string,\n options: UseKeyPressOptions = {}\n): boolean {\n const { target, event = 'keydown', preventDefault = false } = options\n const [keyPressed, setKeyPressed] = useState(false)\n\n const downHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n setKeyPressed(true)\n }\n },\n [targetKey, preventDefault]\n )\n\n const upHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n setKeyPressed(false)\n }\n },\n [targetKey]\n )\n\n useEffect(() => {\n const targetElement = target ?? window\n\n if (event === 'keydown') {\n targetElement.addEventListener('keydown', downHandler as EventListener)\n targetElement.addEventListener('keyup', upHandler as EventListener)\n } else {\n targetElement.addEventListener('keyup', downHandler as EventListener)\n }\n\n return () => {\n targetElement.removeEventListener('keydown', downHandler as EventListener)\n targetElement.removeEventListener('keyup', upHandler as EventListener)\n }\n }, [target, event, downHandler, upHandler])\n\n return keyPressed\n}\n\n/**\n * Hook that calls a callback when a specific key is pressed.\n *\n * @param targetKey - Key to detect\n * @param callback - Function to call when key is pressed\n * @param options - Configuration options\n *\n * @example\n * useKeyPressCallback('Escape', () => closeModal())\n * useKeyPressCallback('Enter', () => submitForm(), { preventDefault: true })\n */\nexport function useKeyPressCallback(\n targetKey: string,\n callback: (event: KeyboardEvent) => void,\n options: UseKeyPressOptions = {}\n): void {\n const { target, event = 'keydown', preventDefault = false } = options\n\n useEffect(() => {\n const targetElement = target ?? window\n\n const handler = (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n callback(e)\n }\n }\n\n targetElement.addEventListener(event, handler as EventListener)\n return () => targetElement.removeEventListener(event, handler as EventListener)\n }, [target, targetKey, callback, event, preventDefault])\n}\n"],"names":["useKeyPress","targetKey","options","target","event","preventDefault","keyPressed","setKeyPressed","useState","downHandler","useCallback","upHandler","useEffect","targetElement","useKeyPressCallback","callback","handler","e"],"mappings":";AA8BO,SAASA,EACdC,GACAC,IAA8B,IACrB;AACT,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH,GACxD,CAACI,GAAYC,CAAa,IAAIC,EAAS,EAAK,GAE5CC,IAAcC;AAAA,IAClB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,MACRI,OAAkB,eAAA,GACtBE,EAAc,EAAI;AAAA,IAEtB;AAAA,IACA,CAACN,GAAWI,CAAc;AAAA,EAAA,GAGtBM,IAAYD;AAAA,IAChB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,KACZM,EAAc,EAAK;AAAA,IAEvB;AAAA,IACA,CAACN,CAAS;AAAA,EAAA;AAGZ,SAAAW,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU;AAEhC,WAAIC,MAAU,aACZS,EAAc,iBAAiB,WAAWJ,CAA4B,GACtEI,EAAc,iBAAiB,SAASF,CAA0B,KAElEE,EAAc,iBAAiB,SAASJ,CAA4B,GAG/D,MAAM;AACX,MAAAI,EAAc,oBAAoB,WAAWJ,CAA4B,GACzEI,EAAc,oBAAoB,SAASF,CAA0B;AAAA,IACvE;AAAA,EACF,GAAG,CAACR,GAAQC,GAAOK,GAAaE,CAAS,CAAC,GAEnCL;AACT;AAaO,SAASQ,EACdb,GACAc,GACAb,IAA8B,CAAA,GACxB;AACN,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH;AAE9D,EAAAU,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU,QAE1Ba,IAAU,CAACC,MAAqB;AACpC,MAAIA,EAAE,QAAQhB,MACRI,OAAkB,eAAA,GACtBU,EAASE,CAAC;AAAA,IAEd;AAEA,WAAAJ,EAAc,iBAAiBT,GAAOY,CAAwB,GACvD,MAAMH,EAAc,oBAAoBT,GAAOY,CAAwB;AAAA,EAChF,GAAG,CAACb,GAAQF,GAAWc,GAAUX,GAAOC,CAAc,CAAC;AACzD;"}
1
+ {"version":3,"file":"index105.js","sources":["../src/hooks/useHover.ts"],"sourcesContent":["import { useState, useRef, useEffect, type RefObject } from 'react'\n\nexport interface UseHoverReturn<T extends HTMLElement> {\n ref: RefObject<T | null>\n isHovered: boolean\n}\n\n/**\n * Hook that tracks hover state of an element.\n *\n * @returns Object with ref and isHovered state\n *\n * @example\n * const { ref, isHovered } = useHover<HTMLDivElement>()\n *\n * <div ref={ref} className={isHovered ? 'bg-blue-500' : 'bg-gray-500'}>\n * Hover me!\n * </div>\n */\nexport function useHover<T extends HTMLElement = HTMLElement>(): UseHoverReturn<T> {\n const [isHovered, setIsHovered] = useState(false)\n const ref = useRef<T>(null)\n\n useEffect(() => {\n const node = ref.current\n if (!node) return\n\n const handleMouseEnter = () => setIsHovered(true)\n const handleMouseLeave = () => setIsHovered(false)\n\n node.addEventListener('mouseenter', handleMouseEnter)\n node.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n node.removeEventListener('mouseenter', handleMouseEnter)\n node.removeEventListener('mouseleave', handleMouseLeave)\n }\n }, [])\n\n return { ref, isHovered }\n}\n"],"names":["useHover","isHovered","setIsHovered","useState","ref","useRef","useEffect","node","handleMouseEnter","handleMouseLeave"],"mappings":";AAmBO,SAASA,IAAmE;AACjF,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,IAAMC,EAAU,IAAI;AAE1B,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAOH,EAAI;AACjB,QAAI,CAACG,EAAM;AAEX,UAAMC,IAAmB,MAAMN,EAAa,EAAI,GAC1CO,IAAmB,MAAMP,EAAa,EAAK;AAEjD,WAAAK,EAAK,iBAAiB,cAAcC,CAAgB,GACpDD,EAAK,iBAAiB,cAAcE,CAAgB,GAE7C,MAAM;AACX,MAAAF,EAAK,oBAAoB,cAAcC,CAAgB,GACvDD,EAAK,oBAAoB,cAAcE,CAAgB;AAAA,IACzD;AAAA,EACF,GAAG,CAAA,CAAE,GAEE,EAAE,KAAAL,GAAK,WAAAH,EAAA;AAChB;"}
package/dist/index106.js CHANGED
@@ -1,21 +1,34 @@
1
- import { useState as t, useEffect as d } from "react";
2
- function r() {
3
- const [i, n] = t(() => typeof window > "u" ? { width: 0, height: 0 } : {
4
- width: window.innerWidth,
5
- height: window.innerHeight
6
- });
7
- return d(() => {
8
- if (typeof window > "u") return;
9
- const e = () => {
10
- n({
11
- width: window.innerWidth,
12
- height: window.innerHeight
13
- });
1
+ import { useState as v, useCallback as i, useEffect as l } from "react";
2
+ function c(n, f = {}) {
3
+ const { target: u, event: o = "keydown", preventDefault: r = !1 } = f, [a, d] = v(!1), t = i(
4
+ (e) => {
5
+ e.key === n && (r && e.preventDefault(), d(!0));
6
+ },
7
+ [n, r]
8
+ ), s = i(
9
+ (e) => {
10
+ e.key === n && d(!1);
11
+ },
12
+ [n]
13
+ );
14
+ return l(() => {
15
+ const e = u ?? window;
16
+ return o === "keydown" ? (e.addEventListener("keydown", t), e.addEventListener("keyup", s)) : e.addEventListener("keyup", t), () => {
17
+ e.removeEventListener("keydown", t), e.removeEventListener("keyup", s);
14
18
  };
15
- return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
16
- }, []), i;
19
+ }, [u, o, t, s]), a;
20
+ }
21
+ function y(n, f, u = {}) {
22
+ const { target: o, event: r = "keydown", preventDefault: a = !1 } = u;
23
+ l(() => {
24
+ const d = o ?? window, t = (s) => {
25
+ s.key === n && (a && s.preventDefault(), f(s));
26
+ };
27
+ return d.addEventListener(r, t), () => d.removeEventListener(r, t);
28
+ }, [o, n, f, r, a]);
17
29
  }
18
30
  export {
19
- r as useWindowSize
31
+ c as useKeyPress,
32
+ y as useKeyPressCallback
20
33
  };
21
34
  //# sourceMappingURL=index106.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index106.js","sources":["../src/hooks/useWindowSize.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nexport interface WindowSize {\n width: number\n height: number\n}\n\n/**\n * Hook that tracks window dimensions.\n * Updates on window resize.\n *\n * @returns Object with current width and height\n *\n * @example\n * const { width, height } = useWindowSize()\n *\n * return (\n * <div>\n * Window: {width} x {height}\n * {width < 768 && <MobileNav />}\n * </div>\n * )\n */\nexport function useWindowSize(): WindowSize {\n const [windowSize, setWindowSize] = useState<WindowSize>(() => {\n if (typeof window === 'undefined') {\n return { width: 0, height: 0 }\n }\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n })\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n const handleResize = () => {\n setWindowSize({\n width: window.innerWidth,\n height: window.innerHeight,\n })\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n return windowSize\n}\n"],"names":["useWindowSize","windowSize","setWindowSize","useState","useEffect","handleResize"],"mappings":";AAuBO,SAASA,IAA4B;AAC1C,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAqB,MACnD,OAAO,SAAW,MACb,EAAE,OAAO,GAAG,QAAQ,EAAA,IAEtB;AAAA,IACL,OAAO,OAAO;AAAA,IACd,QAAQ,OAAO;AAAA,EAAA,CAElB;AAED,SAAAC,EAAU,MAAM;AACd,QAAI,OAAO,SAAW,IAAa;AAEnC,UAAMC,IAAe,MAAM;AACzB,MAAAH,EAAc;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,QAAQ,OAAO;AAAA,MAAA,CAChB;AAAA,IACH;AAEA,kBAAO,iBAAiB,UAAUG,CAAY,GACvC,MAAM,OAAO,oBAAoB,UAAUA,CAAY;AAAA,EAChE,GAAG,CAAA,CAAE,GAEEJ;AACT;"}
1
+ {"version":3,"file":"index106.js","sources":["../src/hooks/useKeyPress.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\n\nexport interface UseKeyPressOptions {\n /** Target element (default: window) */\n target?: HTMLElement | Window | null\n /** Event type: 'keydown' | 'keyup' (default: 'keydown') */\n event?: 'keydown' | 'keyup'\n /** Prevent default browser behavior */\n preventDefault?: boolean\n}\n\n/**\n * Hook that detects when a specific key is pressed.\n *\n * @param targetKey - Key to detect (e.g., 'Enter', 'Escape', 'a')\n * @param options - Configuration options\n * @returns Whether the key is currently pressed\n *\n * @example\n * const enterPressed = useKeyPress('Enter')\n * const escapePressed = useKeyPress('Escape')\n *\n * useEffect(() => {\n * if (escapePressed) closeModal()\n * }, [escapePressed])\n *\n * @example\n * // With callback for immediate action\n * useKeyPress('Escape', { preventDefault: true })\n */\nexport function useKeyPress(\n targetKey: string,\n options: UseKeyPressOptions = {}\n): boolean {\n const { target, event = 'keydown', preventDefault = false } = options\n const [keyPressed, setKeyPressed] = useState(false)\n\n const downHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n setKeyPressed(true)\n }\n },\n [targetKey, preventDefault]\n )\n\n const upHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n setKeyPressed(false)\n }\n },\n [targetKey]\n )\n\n useEffect(() => {\n const targetElement = target ?? window\n\n if (event === 'keydown') {\n targetElement.addEventListener('keydown', downHandler as EventListener)\n targetElement.addEventListener('keyup', upHandler as EventListener)\n } else {\n targetElement.addEventListener('keyup', downHandler as EventListener)\n }\n\n return () => {\n targetElement.removeEventListener('keydown', downHandler as EventListener)\n targetElement.removeEventListener('keyup', upHandler as EventListener)\n }\n }, [target, event, downHandler, upHandler])\n\n return keyPressed\n}\n\n/**\n * Hook that calls a callback when a specific key is pressed.\n *\n * @param targetKey - Key to detect\n * @param callback - Function to call when key is pressed\n * @param options - Configuration options\n *\n * @example\n * useKeyPressCallback('Escape', () => closeModal())\n * useKeyPressCallback('Enter', () => submitForm(), { preventDefault: true })\n */\nexport function useKeyPressCallback(\n targetKey: string,\n callback: (event: KeyboardEvent) => void,\n options: UseKeyPressOptions = {}\n): void {\n const { target, event = 'keydown', preventDefault = false } = options\n\n useEffect(() => {\n const targetElement = target ?? window\n\n const handler = (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n callback(e)\n }\n }\n\n targetElement.addEventListener(event, handler as EventListener)\n return () => targetElement.removeEventListener(event, handler as EventListener)\n }, [target, targetKey, callback, event, preventDefault])\n}\n"],"names":["useKeyPress","targetKey","options","target","event","preventDefault","keyPressed","setKeyPressed","useState","downHandler","useCallback","upHandler","useEffect","targetElement","useKeyPressCallback","callback","handler","e"],"mappings":";AA8BO,SAASA,EACdC,GACAC,IAA8B,IACrB;AACT,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH,GACxD,CAACI,GAAYC,CAAa,IAAIC,EAAS,EAAK,GAE5CC,IAAcC;AAAA,IAClB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,MACRI,OAAkB,eAAA,GACtBE,EAAc,EAAI;AAAA,IAEtB;AAAA,IACA,CAACN,GAAWI,CAAc;AAAA,EAAA,GAGtBM,IAAYD;AAAA,IAChB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,KACZM,EAAc,EAAK;AAAA,IAEvB;AAAA,IACA,CAACN,CAAS;AAAA,EAAA;AAGZ,SAAAW,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU;AAEhC,WAAIC,MAAU,aACZS,EAAc,iBAAiB,WAAWJ,CAA4B,GACtEI,EAAc,iBAAiB,SAASF,CAA0B,KAElEE,EAAc,iBAAiB,SAASJ,CAA4B,GAG/D,MAAM;AACX,MAAAI,EAAc,oBAAoB,WAAWJ,CAA4B,GACzEI,EAAc,oBAAoB,SAASF,CAA0B;AAAA,IACvE;AAAA,EACF,GAAG,CAACR,GAAQC,GAAOK,GAAaE,CAAS,CAAC,GAEnCL;AACT;AAaO,SAASQ,EACdb,GACAc,GACAb,IAA8B,CAAA,GACxB;AACN,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH;AAE9D,EAAAU,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU,QAE1Ba,IAAU,CAACC,MAAqB;AACpC,MAAIA,EAAE,QAAQhB,MACRI,OAAkB,eAAA,GACtBU,EAASE,CAAC;AAAA,IAEd;AAEA,WAAAJ,EAAc,iBAAiBT,GAAOY,CAAwB,GACvD,MAAMH,EAAc,oBAAoBT,GAAOY,CAAwB;AAAA,EAChF,GAAG,CAACb,GAAQF,GAAWc,GAAUX,GAAOC,CAAc,CAAC;AACzD;"}
@@ -0,0 +1,21 @@
1
+ import { useState as t, useEffect as d } from "react";
2
+ function r() {
3
+ const [i, n] = t(() => typeof window > "u" ? { width: 0, height: 0 } : {
4
+ width: window.innerWidth,
5
+ height: window.innerHeight
6
+ });
7
+ return d(() => {
8
+ if (typeof window > "u") return;
9
+ const e = () => {
10
+ n({
11
+ width: window.innerWidth,
12
+ height: window.innerHeight
13
+ });
14
+ };
15
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
16
+ }, []), i;
17
+ }
18
+ export {
19
+ r as useWindowSize
20
+ };
21
+ //# sourceMappingURL=index107.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index107.js","sources":["../src/hooks/useWindowSize.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nexport interface WindowSize {\n width: number\n height: number\n}\n\n/**\n * Hook that tracks window dimensions.\n * Updates on window resize.\n *\n * @returns Object with current width and height\n *\n * @example\n * const { width, height } = useWindowSize()\n *\n * return (\n * <div>\n * Window: {width} x {height}\n * {width < 768 && <MobileNav />}\n * </div>\n * )\n */\nexport function useWindowSize(): WindowSize {\n const [windowSize, setWindowSize] = useState<WindowSize>(() => {\n if (typeof window === 'undefined') {\n return { width: 0, height: 0 }\n }\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n })\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n const handleResize = () => {\n setWindowSize({\n width: window.innerWidth,\n height: window.innerHeight,\n })\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n return windowSize\n}\n"],"names":["useWindowSize","windowSize","setWindowSize","useState","useEffect","handleResize"],"mappings":";AAuBO,SAASA,IAA4B;AAC1C,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAqB,MACnD,OAAO,SAAW,MACb,EAAE,OAAO,GAAG,QAAQ,EAAA,IAEtB;AAAA,IACL,OAAO,OAAO;AAAA,IACd,QAAQ,OAAO;AAAA,EAAA,CAElB;AAED,SAAAC,EAAU,MAAM;AACd,QAAI,OAAO,SAAW,IAAa;AAEnC,UAAMC,IAAe,MAAM;AACzB,MAAAH,EAAc;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,QAAQ,OAAO;AAAA,MAAA,CAChB;AAAA,IACH;AAEA,kBAAO,iBAAiB,UAAUG,CAAY,GACvC,MAAM,OAAO,oBAAoB,UAAUA,CAAY;AAAA,EAChE,GAAG,CAAA,CAAE,GAEEJ;AACT;"}
package/dist/index21.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
2
  import { useState as h, useRef as j, useEffect as y } from "react";
3
- import { Input as T } from "./index41.js";
3
+ import { Input as T } from "./index42.js";
4
4
  const $ = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], I = [
5
5
  "January",
6
6
  "February",
package/dist/index37.js CHANGED
@@ -1,125 +1,20 @@
1
- import { jsxs as u, Fragment as M, jsx as e } from "react/jsx-runtime";
2
- import { useState as a, useEffect as P } from "react";
3
- const I = ({
4
- src: s,
5
- alt: f = "",
6
- fallback: i,
7
- placeholder: h,
8
- preview: p = !0,
9
- width: n,
10
- height: o,
11
- className: g = "",
12
- onLoad: k,
13
- onError: y,
14
- ...C
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ const i = ({
3
+ images: l,
4
+ alts: m = [],
5
+ className: a = ""
15
6
  }) => {
16
- const [r, l] = a(!0), [c, m] = a(!1), [L, b] = a(!1), [N, v] = a(s);
17
- P(() => {
18
- l(!0), m(!1), v(s);
19
- }, [s]);
20
- const j = () => {
21
- l(!1), m(!1), k?.();
22
- }, w = () => {
23
- l(!1), m(!0), i && v(i), y?.();
24
- }, S = () => {
25
- p && !c && !r && b(!0);
26
- }, x = () => {
27
- b(!1);
28
- }, d = () => {
29
- const t = {};
30
- return n && (t.width = typeof n == "number" ? `${n}px` : n), o && (t.height = typeof o == "number" ? `${o}px` : o), t;
31
- }, E = [
32
- g,
33
- p && !c && !r ? "cursor-pointer hover:opacity-80 transition-opacity" : ""
34
- ].filter(Boolean).join(" ");
35
- return /* @__PURE__ */ u(M, { children: [
36
- /* @__PURE__ */ u("div", { className: "relative inline-block", style: d(), children: [
37
- r && h && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-base-200", children: h }),
38
- /* @__PURE__ */ e(
39
- "img",
40
- {
41
- ...C,
42
- src: N,
43
- alt: f,
44
- className: E,
45
- style: { ...d(), display: r ? "none" : "block" },
46
- onLoad: j,
47
- onError: w,
48
- onClick: S
49
- }
50
- ),
51
- c && !i && /* @__PURE__ */ e(
52
- "div",
53
- {
54
- className: "flex items-center justify-center bg-base-200 text-base-content/50",
55
- style: d(),
56
- children: /* @__PURE__ */ e(
57
- "svg",
58
- {
59
- className: "w-12 h-12",
60
- fill: "none",
61
- stroke: "currentColor",
62
- viewBox: "0 0 24 24",
63
- children: /* @__PURE__ */ e(
64
- "path",
65
- {
66
- strokeLinecap: "round",
67
- strokeLinejoin: "round",
68
- strokeWidth: 2,
69
- d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
70
- }
71
- )
72
- }
73
- )
74
- }
75
- )
76
- ] }),
77
- L && /* @__PURE__ */ e(
78
- "div",
79
- {
80
- className: "fixed inset-0 z-50 bg-black bg-opacity-80 flex items-center justify-center p-4",
81
- onClick: x,
82
- children: /* @__PURE__ */ u("div", { className: "relative max-w-full max-h-full", children: [
83
- /* @__PURE__ */ e(
84
- "button",
85
- {
86
- className: "absolute top-4 right-4 btn btn-circle btn-sm",
87
- onClick: x,
88
- children: /* @__PURE__ */ e(
89
- "svg",
90
- {
91
- className: "w-6 h-6",
92
- fill: "none",
93
- stroke: "currentColor",
94
- viewBox: "0 0 24 24",
95
- children: /* @__PURE__ */ e(
96
- "path",
97
- {
98
- strokeLinecap: "round",
99
- strokeLinejoin: "round",
100
- strokeWidth: 2,
101
- d: "M6 18L18 6M6 6l12 12"
102
- }
103
- )
104
- }
105
- )
106
- }
107
- ),
108
- /* @__PURE__ */ e(
109
- "img",
110
- {
111
- src: s,
112
- alt: f,
113
- className: "max-w-full max-h-[90vh] object-contain",
114
- onClick: (t) => t.stopPropagation()
115
- }
116
- )
117
- ] })
118
- }
119
- )
120
- ] });
7
+ const t = l.slice(0, 10);
8
+ return /* @__PURE__ */ e("figure", { className: `hover-gallery ${a}`.trim(), children: t.map((o, r) => /* @__PURE__ */ e(
9
+ "img",
10
+ {
11
+ src: o,
12
+ alt: m[r] || `Image ${r + 1}`
13
+ },
14
+ r
15
+ )) });
121
16
  };
122
17
  export {
123
- I as Image
18
+ i as HoverGallery
124
19
  };
125
20
  //# sourceMappingURL=index37.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index37.js","sources":["../src/components/Image.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react'\n\nexport interface ImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'placeholder'> {\n src: string\n alt?: string\n fallback?: string\n placeholder?: React.ReactNode\n preview?: boolean\n width?: string | number\n height?: string | number\n className?: string\n onLoad?: () => void\n onError?: () => void\n}\n\nexport const Image: React.FC<ImageProps> = ({\n src,\n alt = '',\n fallback,\n placeholder,\n preview = true,\n width,\n height,\n className = '',\n onLoad,\n onError,\n ...props\n}) => {\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState(false)\n const [showPreview, setShowPreview] = useState(false)\n const [currentSrc, setCurrentSrc] = useState(src)\n\n useEffect(() => {\n setLoading(true)\n setError(false)\n setCurrentSrc(src)\n }, [src])\n\n const handleLoad = () => {\n setLoading(false)\n setError(false)\n onLoad?.()\n }\n\n const handleError = () => {\n setLoading(false)\n setError(true)\n if (fallback) {\n setCurrentSrc(fallback)\n }\n onError?.()\n }\n\n const handleImageClick = () => {\n if (preview && !error && !loading) {\n setShowPreview(true)\n }\n }\n\n const handleClosePreview = () => {\n setShowPreview(false)\n }\n\n const getStyle = (): React.CSSProperties => {\n const style: React.CSSProperties = {}\n if (width) {\n style.width = typeof width === 'number' ? `${width}px` : width\n }\n if (height) {\n style.height = typeof height === 'number' ? `${height}px` : height\n }\n return style\n }\n\n const imageClasses = [\n className,\n preview && !error && !loading ? 'cursor-pointer hover:opacity-80 transition-opacity' : '',\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <>\n <div className=\"relative inline-block\" style={getStyle()}>\n {loading && placeholder && (\n <div className=\"absolute inset-0 flex items-center justify-center bg-base-200\">\n {placeholder}\n </div>\n )}\n <img\n {...props}\n src={currentSrc}\n alt={alt}\n className={imageClasses}\n style={{ ...getStyle(), display: loading ? 'none' : 'block' }}\n onLoad={handleLoad}\n onError={handleError}\n onClick={handleImageClick}\n />\n {error && !fallback && (\n <div\n className=\"flex items-center justify-center bg-base-200 text-base-content/50\"\n style={getStyle()}\n >\n <svg\n className=\"w-12 h-12\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z\"\n />\n </svg>\n </div>\n )}\n </div>\n\n {showPreview && (\n <div\n className=\"fixed inset-0 z-50 bg-black bg-opacity-80 flex items-center justify-center p-4\"\n onClick={handleClosePreview}\n >\n <div className=\"relative max-w-full max-h-full\">\n <button\n className=\"absolute top-4 right-4 btn btn-circle btn-sm\"\n onClick={handleClosePreview}\n >\n <svg\n className=\"w-6 h-6\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n <img\n src={src}\n alt={alt}\n className=\"max-w-full max-h-[90vh] object-contain\"\n onClick={(e) => e.stopPropagation()}\n />\n </div>\n </div>\n )}\n </>\n )\n}\n"],"names":["Image","src","alt","fallback","placeholder","preview","width","height","className","onLoad","onError","props","loading","setLoading","useState","error","setError","showPreview","setShowPreview","currentSrc","setCurrentSrc","useEffect","handleLoad","handleError","handleImageClick","handleClosePreview","getStyle","style","imageClasses","jsxs","Fragment","jsx","e"],"mappings":"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"}
1
+ {"version":3,"file":"index37.js","sources":["../src/components/HoverGallery.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface HoverGalleryProps {\n /** Image sources (2-10 images) */\n images: string[]\n /** Alt text for images (optional, uses index if not provided) */\n alts?: string[]\n /** Additional CSS classes */\n className?: string\n}\n\nexport const HoverGallery: React.FC<HoverGalleryProps> = ({\n images,\n alts = [],\n className = '',\n}) => {\n // DaisyUI supports up to 10 images\n const limitedImages = images.slice(0, 10)\n\n return (\n <figure className={`hover-gallery ${className}`.trim()}>\n {limitedImages.map((src, index) => (\n <img\n key={index}\n src={src}\n alt={alts[index] || `Image ${index + 1}`}\n />\n ))}\n </figure>\n )\n}\n"],"names":["HoverGallery","images","alts","className","limitedImages","jsx","src","index"],"mappings":";AAWO,MAAMA,IAA4C,CAAC;AAAA,EACxD,QAAAC;AAAA,EACA,MAAAC,IAAO,CAAA;AAAA,EACP,WAAAC,IAAY;AACd,MAAM;AAEJ,QAAMC,IAAgBH,EAAO,MAAM,GAAG,EAAE;AAExC,SACE,gBAAAI,EAAC,UAAA,EAAO,WAAW,iBAAiBF,CAAS,GAAG,KAAA,GAC7C,UAAAC,EAAc,IAAI,CAACE,GAAKC,MACvB,gBAAAF;AAAA,IAAC;AAAA,IAAA;AAAA,MAEC,KAAAC;AAAA,MACA,KAAKJ,EAAKK,CAAK,KAAK,SAASA,IAAQ,CAAC;AAAA,IAAA;AAAA,IAFjCA;AAAA,EAAA,CAIR,GACH;AAEJ;"}
package/dist/index38.js CHANGED
@@ -1,43 +1,125 @@
1
- import { jsxs as p, jsx as m } from "react/jsx-runtime";
2
- import b from "react";
3
- const j = ({
4
- position: r = "top-end",
5
- children: s,
6
- className: c = "",
7
- ...o
1
+ import { jsxs as u, Fragment as M, jsx as e } from "react/jsx-runtime";
2
+ import { useState as a, useEffect as P } from "react";
3
+ const I = ({
4
+ src: s,
5
+ alt: f = "",
6
+ fallback: i,
7
+ placeholder: h,
8
+ preview: p = !0,
9
+ width: n,
10
+ height: o,
11
+ className: g = "",
12
+ onLoad: k,
13
+ onError: y,
14
+ ...C
8
15
  }) => {
9
- const n = (d) => {
10
- const [l, h] = d.split("-"), t = [];
11
- switch (l) {
12
- case "top":
13
- t.push("indicator-top");
14
- break;
15
- case "middle":
16
- t.push("indicator-middle");
17
- break;
18
- case "bottom":
19
- t.push("indicator-bottom");
20
- break;
21
- }
22
- switch (h) {
23
- case "start":
24
- t.push("indicator-start");
25
- break;
26
- case "center":
27
- t.push("indicator-center");
28
- break;
29
- case "end":
30
- t.push("indicator-end");
31
- break;
32
- }
33
- return t.join(" ");
34
- }, e = b.Children.toArray(s), a = e[0], i = e[1];
35
- return /* @__PURE__ */ p("div", { className: `indicator inline-block ${c}`, ...o, children: [
36
- i && /* @__PURE__ */ m("div", { className: `indicator-item ${n(r)}`, children: i }),
37
- a
16
+ const [r, l] = a(!0), [c, m] = a(!1), [L, b] = a(!1), [N, v] = a(s);
17
+ P(() => {
18
+ l(!0), m(!1), v(s);
19
+ }, [s]);
20
+ const j = () => {
21
+ l(!1), m(!1), k?.();
22
+ }, w = () => {
23
+ l(!1), m(!0), i && v(i), y?.();
24
+ }, S = () => {
25
+ p && !c && !r && b(!0);
26
+ }, x = () => {
27
+ b(!1);
28
+ }, d = () => {
29
+ const t = {};
30
+ return n && (t.width = typeof n == "number" ? `${n}px` : n), o && (t.height = typeof o == "number" ? `${o}px` : o), t;
31
+ }, E = [
32
+ g,
33
+ p && !c && !r ? "cursor-pointer hover:opacity-80 transition-opacity" : ""
34
+ ].filter(Boolean).join(" ");
35
+ return /* @__PURE__ */ u(M, { children: [
36
+ /* @__PURE__ */ u("div", { className: "relative inline-block", style: d(), children: [
37
+ r && h && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-base-200", children: h }),
38
+ /* @__PURE__ */ e(
39
+ "img",
40
+ {
41
+ ...C,
42
+ src: N,
43
+ alt: f,
44
+ className: E,
45
+ style: { ...d(), display: r ? "none" : "block" },
46
+ onLoad: j,
47
+ onError: w,
48
+ onClick: S
49
+ }
50
+ ),
51
+ c && !i && /* @__PURE__ */ e(
52
+ "div",
53
+ {
54
+ className: "flex items-center justify-center bg-base-200 text-base-content/50",
55
+ style: d(),
56
+ children: /* @__PURE__ */ e(
57
+ "svg",
58
+ {
59
+ className: "w-12 h-12",
60
+ fill: "none",
61
+ stroke: "currentColor",
62
+ viewBox: "0 0 24 24",
63
+ children: /* @__PURE__ */ e(
64
+ "path",
65
+ {
66
+ strokeLinecap: "round",
67
+ strokeLinejoin: "round",
68
+ strokeWidth: 2,
69
+ d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
70
+ }
71
+ )
72
+ }
73
+ )
74
+ }
75
+ )
76
+ ] }),
77
+ L && /* @__PURE__ */ e(
78
+ "div",
79
+ {
80
+ className: "fixed inset-0 z-50 bg-black bg-opacity-80 flex items-center justify-center p-4",
81
+ onClick: x,
82
+ children: /* @__PURE__ */ u("div", { className: "relative max-w-full max-h-full", children: [
83
+ /* @__PURE__ */ e(
84
+ "button",
85
+ {
86
+ className: "absolute top-4 right-4 btn btn-circle btn-sm",
87
+ onClick: x,
88
+ children: /* @__PURE__ */ e(
89
+ "svg",
90
+ {
91
+ className: "w-6 h-6",
92
+ fill: "none",
93
+ stroke: "currentColor",
94
+ viewBox: "0 0 24 24",
95
+ children: /* @__PURE__ */ e(
96
+ "path",
97
+ {
98
+ strokeLinecap: "round",
99
+ strokeLinejoin: "round",
100
+ strokeWidth: 2,
101
+ d: "M6 18L18 6M6 6l12 12"
102
+ }
103
+ )
104
+ }
105
+ )
106
+ }
107
+ ),
108
+ /* @__PURE__ */ e(
109
+ "img",
110
+ {
111
+ src: s,
112
+ alt: f,
113
+ className: "max-w-full max-h-[90vh] object-contain",
114
+ onClick: (t) => t.stopPropagation()
115
+ }
116
+ )
117
+ ] })
118
+ }
119
+ )
38
120
  ] });
39
121
  };
40
122
  export {
41
- j as Indicator
123
+ I as Image
42
124
  };
43
125
  //# sourceMappingURL=index38.js.map