asterui 0.12.25 → 0.12.27

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 (167) hide show
  1. package/dist/components/Cascader.d.ts +2 -0
  2. package/dist/components/Descriptions.d.ts +35 -3
  3. package/dist/components/Empty.d.ts +10 -1
  4. package/dist/components/Image.d.ts +13 -1
  5. package/dist/components/List.d.ts +74 -8
  6. package/dist/components/Table.d.ts +64 -10
  7. package/dist/components/Tag.d.ts +16 -4
  8. package/dist/components/Timeline.d.ts +62 -7
  9. package/dist/components/Tree.d.ts +2 -0
  10. package/dist/index.d.ts +6 -8
  11. package/dist/index.js +151 -152
  12. package/dist/index.js.map +1 -1
  13. package/dist/index10.js +1 -1
  14. package/dist/index100.js +5 -32
  15. package/dist/index100.js.map +1 -1
  16. package/dist/index101.js +13 -5
  17. package/dist/index101.js.map +1 -1
  18. package/dist/index102.js +43 -11
  19. package/dist/index102.js.map +1 -1
  20. package/dist/index103.js +11 -44
  21. package/dist/index103.js.map +1 -1
  22. package/dist/index104.js +12 -10
  23. package/dist/index104.js.map +1 -1
  24. package/dist/index105.js +7 -14
  25. package/dist/index105.js.map +1 -1
  26. package/dist/index106.js +12 -7
  27. package/dist/index106.js.map +1 -1
  28. package/dist/index107.js +29 -11
  29. package/dist/index107.js.map +1 -1
  30. package/dist/index108.js +16 -29
  31. package/dist/index108.js.map +1 -1
  32. package/dist/index109.js +31 -16
  33. package/dist/index109.js.map +1 -1
  34. package/dist/index110.js +517 -30
  35. package/dist/index110.js.map +1 -1
  36. package/dist/index111.js +45 -515
  37. package/dist/index111.js.map +1 -1
  38. package/dist/index15.js.map +1 -1
  39. package/dist/index22.js +1 -1
  40. package/dist/index23.js +127 -93
  41. package/dist/index23.js.map +1 -1
  42. package/dist/index39.js +162 -115
  43. package/dist/index39.js.map +1 -1
  44. package/dist/index40.js +398 -40
  45. package/dist/index40.js.map +1 -1
  46. package/dist/index41.js +132 -389
  47. package/dist/index41.js.map +1 -1
  48. package/dist/index42.js +252 -91
  49. package/dist/index42.js.map +1 -1
  50. package/dist/index43.js +143 -247
  51. package/dist/index43.js.map +1 -1
  52. package/dist/index44.js +15 -154
  53. package/dist/index44.js.map +1 -1
  54. package/dist/index45.js +17 -15
  55. package/dist/index45.js.map +1 -1
  56. package/dist/index46.js +136 -16
  57. package/dist/index46.js.map +1 -1
  58. package/dist/index47.js +118 -133
  59. package/dist/index47.js.map +1 -1
  60. package/dist/index48.js +35 -13
  61. package/dist/index48.js.map +1 -1
  62. package/dist/index49.js +34 -35
  63. package/dist/index49.js.map +1 -1
  64. package/dist/index50.js +81 -34
  65. package/dist/index50.js.map +1 -1
  66. package/dist/index51.js +166 -71
  67. package/dist/index51.js.map +1 -1
  68. package/dist/index52.js +144 -167
  69. package/dist/index52.js.map +1 -1
  70. package/dist/index53.js +11 -152
  71. package/dist/index53.js.map +1 -1
  72. package/dist/index54.js +55 -10
  73. package/dist/index54.js.map +1 -1
  74. package/dist/index55.js +12 -55
  75. package/dist/index55.js.map +1 -1
  76. package/dist/index56.js +7 -14
  77. package/dist/index56.js.map +1 -1
  78. package/dist/index57.js +333 -6
  79. package/dist/index57.js.map +1 -1
  80. package/dist/index58.js +47 -334
  81. package/dist/index58.js.map +1 -1
  82. package/dist/index59.js +122 -47
  83. package/dist/index59.js.map +1 -1
  84. package/dist/index60.js +108 -120
  85. package/dist/index60.js.map +1 -1
  86. package/dist/index61.js +167 -107
  87. package/dist/index61.js.map +1 -1
  88. package/dist/index62.js +29 -167
  89. package/dist/index62.js.map +1 -1
  90. package/dist/index63.js +120 -30
  91. package/dist/index63.js.map +1 -1
  92. package/dist/index64.js +80 -116
  93. package/dist/index64.js.map +1 -1
  94. package/dist/index65.js +19 -85
  95. package/dist/index65.js.map +1 -1
  96. package/dist/index66.js +73 -19
  97. package/dist/index66.js.map +1 -1
  98. package/dist/index67.js +54 -71
  99. package/dist/index67.js.map +1 -1
  100. package/dist/index68.js +44 -56
  101. package/dist/index68.js.map +1 -1
  102. package/dist/index69.js +49 -42
  103. package/dist/index69.js.map +1 -1
  104. package/dist/index70.js +121 -50
  105. package/dist/index70.js.map +1 -1
  106. package/dist/index71.js +102 -118
  107. package/dist/index71.js.map +1 -1
  108. package/dist/index72.js +72 -105
  109. package/dist/index72.js.map +1 -1
  110. package/dist/index73.js +67 -73
  111. package/dist/index73.js.map +1 -1
  112. package/dist/index74.js +19 -66
  113. package/dist/index74.js.map +1 -1
  114. package/dist/index75.js +55 -18
  115. package/dist/index75.js.map +1 -1
  116. package/dist/index76.js +251 -55
  117. package/dist/index76.js.map +1 -1
  118. package/dist/index77.js +22 -254
  119. package/dist/index77.js.map +1 -1
  120. package/dist/index78.js +31 -22
  121. package/dist/index78.js.map +1 -1
  122. package/dist/index79.js +93 -30
  123. package/dist/index79.js.map +1 -1
  124. package/dist/index80.js +626 -86
  125. package/dist/index80.js.map +1 -1
  126. package/dist/index81.js +73 -322
  127. package/dist/index81.js.map +1 -1
  128. package/dist/index82.js +39 -79
  129. package/dist/index82.js.map +1 -1
  130. package/dist/index83.js +23 -40
  131. package/dist/index83.js.map +1 -1
  132. package/dist/index84.js +207 -23
  133. package/dist/index84.js.map +1 -1
  134. package/dist/index85.js +149 -122
  135. package/dist/index85.js.map +1 -1
  136. package/dist/index86.js +152 -147
  137. package/dist/index86.js.map +1 -1
  138. package/dist/index87.js +143 -156
  139. package/dist/index87.js.map +1 -1
  140. package/dist/index88.js +35 -65
  141. package/dist/index88.js.map +1 -1
  142. package/dist/index89.js +234 -35
  143. package/dist/index89.js.map +1 -1
  144. package/dist/index90.js +31 -231
  145. package/dist/index90.js.map +1 -1
  146. package/dist/index91.js +210 -34
  147. package/dist/index91.js.map +1 -1
  148. package/dist/index92.js +418 -187
  149. package/dist/index92.js.map +1 -1
  150. package/dist/index93.js +686 -376
  151. package/dist/index93.js.map +1 -1
  152. package/dist/index94.js +165 -738
  153. package/dist/index94.js.map +1 -1
  154. package/dist/index95.js +253 -173
  155. package/dist/index95.js.map +1 -1
  156. package/dist/index96.js +64 -256
  157. package/dist/index96.js.map +1 -1
  158. package/dist/index97.js +121 -61
  159. package/dist/index97.js.map +1 -1
  160. package/dist/index98.js +14 -126
  161. package/dist/index98.js.map +1 -1
  162. package/dist/index99.js +31 -12
  163. package/dist/index99.js.map +1 -1
  164. package/package.json +1 -1
  165. package/dist/components/Indicator.d.ts +0 -7
  166. package/dist/index112.js +0 -53
  167. package/dist/index112.js.map +0 -1
package/dist/index.js CHANGED
@@ -10,10 +10,10 @@ import { CopyButton as S } from "./index10.js";
10
10
  import { Checkbox as b } from "./index11.js";
11
11
  import { Chat as y } from "./index12.js";
12
12
  import { ColorPicker as h } from "./index13.js";
13
- import { Card as v } from "./index14.js";
14
- import { Cascader as R } from "./index15.js";
15
- import { Chart as I } from "./index16.js";
16
- import { Carousel as L } from "./index17.js";
13
+ import { Card as w } from "./index14.js";
14
+ import { Cascader as F } from "./index15.js";
15
+ import { Chart as L } from "./index16.js";
16
+ import { Carousel as I } from "./index17.js";
17
17
  import { Collapse as H } from "./index18.js";
18
18
  import { Container as K } from "./index19.js";
19
19
  import { ContextMenu as N } from "./index20.js";
@@ -35,77 +35,76 @@ import { Form as Co, useFormInstance as To } from "./index35.js";
35
35
  import { Col as So, Grid as Po, Row as bo } from "./index36.js";
36
36
  import { Hero as yo } from "./index37.js";
37
37
  import { HoverGallery as ho } from "./index38.js";
38
- import { Image as vo } from "./index39.js";
39
- import { Indicator as Ro } from "./index40.js";
40
- import { Dropdown as Io } from "./index41.js";
41
- import { Empty as Lo } from "./index42.js";
42
- import { Input as Ho } from "./index43.js";
43
- import { InputNumber as Ko } from "./index44.js";
44
- import { Join as No } from "./index45.js";
45
- import { Kbd as zo } from "./index46.js";
46
- import { Layout as Jo, useSiderContext as Qo } from "./index47.js";
47
- import { List as Vo } from "./index48.js";
48
- import { Loading as qo } from "./index49.js";
49
- import { Mask as Yo } from "./index50.js";
50
- import { Masonry as _o } from "./index51.js";
51
- import { Mention as or } from "./index52.js";
52
- import { Menu as er } from "./index53.js";
53
- import { Browser as pr } from "./index54.js";
54
- import { Code as fr } from "./index55.js";
55
- import { Phone as ar } from "./index56.js";
56
- import { Window as nr } from "./index57.js";
57
- import { Modal as ur } from "./index58.js";
58
- import { Navbar as dr } from "./index59.js";
59
- import { notification as Cr } from "./index60.js";
60
- import { OTPInput as gr } from "./index61.js";
61
- import { Pagination as Pr } from "./index62.js";
62
- import { PageLayout as kr } from "./index63.js";
63
- import { Popconfirm as Dr } from "./index64.js";
64
- import { Popover as wr } from "./index65.js";
65
- import { Progress as Fr } from "./index66.js";
66
- import { QRCode as Br } from "./index67.js";
67
- import { Radio as Ar } from "./index68.js";
68
- import { RadialProgress as Mr } from "./index69.js";
69
- import { Range as Gr } from "./index70.js";
70
- import { Rating as Wr } from "./index71.js";
71
- import { Result as Or } from "./index72.js";
72
- import { Select as Er } from "./index73.js";
73
- import { Segmented as Qr } from "./index74.js";
74
- import { Skeleton as Vr } from "./index75.js";
75
- import { Space as qr } from "./index76.js";
76
- import { Splitter as Yr } from "./index77.js";
77
- import { Stats as _r } from "./index78.js";
78
- import { Status as oe } from "./index79.js";
79
- import { Steps as ee } from "./index80.js";
80
- import { Table as pe } from "./index81.js";
81
- import { Tabs as fe } from "./index82.js";
82
- import { Textarea as ae } from "./index83.js";
83
- import { TextRotate as ne } from "./index84.js";
84
- import { CheckableTag as ue, Tag as le } from "./index85.js";
85
- import { ThemeController as ce } from "./index86.js";
86
- import { TimePicker as Te } from "./index87.js";
87
- import { Timeline as Se } from "./index88.js";
88
- import { Toggle as be } from "./index89.js";
89
- import { Tour as ye } from "./index90.js";
90
- import { Tooltip as he } from "./index91.js";
91
- import { Transfer as ve } from "./index92.js";
92
- import { Tree as Re } from "./index93.js";
93
- import { TreeSelect as Ie, TreeSelectComponent as Ae } from "./index94.js";
94
- import { Typography as Me } from "./index95.js";
95
- import { Upload as Ge } from "./index96.js";
96
- import { VirtualList as We } from "./index97.js";
97
- import { Watermark as Oe } from "./index98.js";
98
- import { Hide as Ee, Show as Je } from "./index99.js";
99
- import { useBreakpoint as Ue } from "./index100.js";
100
- import { useDisclosure as je } from "./index101.js";
101
- import { useClipboard as Xe } from "./index102.js";
102
- import { useLocalStorage as Ze } from "./index103.js";
103
- import { useDebounce as $e } from "./index104.js";
104
- import { useClickOutside as rt } from "./index105.js";
105
- import { usePrevious as tt } from "./index106.js";
106
- import { useHover as mt } from "./index107.js";
107
- import { useKeyPress as xt, useKeyPressCallback as at } from "./index108.js";
108
- import { useWindowSize as nt } from "./index109.js";
38
+ import { Image as wo } from "./index39.js";
39
+ import { Dropdown as Fo } from "./index40.js";
40
+ import { Empty as Lo } from "./index41.js";
41
+ import { Input as Io } from "./index42.js";
42
+ import { InputNumber as Ho } from "./index43.js";
43
+ import { Join as Ko } from "./index44.js";
44
+ import { Kbd as No } from "./index45.js";
45
+ import { Layout as zo, useSiderContext as Eo } from "./index46.js";
46
+ import { List as Qo } from "./index47.js";
47
+ import { Loading as Vo } from "./index48.js";
48
+ import { Mask as qo } from "./index49.js";
49
+ import { Masonry as Yo } from "./index50.js";
50
+ import { Mention as _o } from "./index51.js";
51
+ import { Menu as or } from "./index52.js";
52
+ import { Browser as er } from "./index53.js";
53
+ import { Code as pr } from "./index54.js";
54
+ import { Phone as fr } from "./index55.js";
55
+ import { Window as ar } from "./index56.js";
56
+ import { Modal as nr } from "./index57.js";
57
+ import { Navbar as ur } from "./index58.js";
58
+ import { notification as dr } from "./index59.js";
59
+ import { OTPInput as Cr } from "./index60.js";
60
+ import { Pagination as gr } from "./index61.js";
61
+ import { PageLayout as Pr } from "./index62.js";
62
+ import { Popconfirm as kr } from "./index63.js";
63
+ import { Popover as Dr } from "./index64.js";
64
+ import { Progress as vr } from "./index65.js";
65
+ import { QRCode as Rr } from "./index66.js";
66
+ import { Radio as Br } from "./index67.js";
67
+ import { RadialProgress as Ar } from "./index68.js";
68
+ import { Range as Mr } from "./index69.js";
69
+ import { Rating as Gr } from "./index70.js";
70
+ import { Result as Wr } from "./index71.js";
71
+ import { Select as Or } from "./index72.js";
72
+ import { Segmented as Er } from "./index73.js";
73
+ import { Skeleton as Qr } from "./index74.js";
74
+ import { Space as Vr } from "./index75.js";
75
+ import { Splitter as qr } from "./index76.js";
76
+ import { Stats as Yr } from "./index77.js";
77
+ import { Status as _r } from "./index78.js";
78
+ import { Steps as oe } from "./index79.js";
79
+ import { Table as ee } from "./index80.js";
80
+ import { Tabs as pe } from "./index81.js";
81
+ import { Textarea as fe } from "./index82.js";
82
+ import { TextRotate as ae } from "./index83.js";
83
+ import { CheckableTag as ne, Tag as se, TagLiveRegion as ue } from "./index84.js";
84
+ import { ThemeController as de } from "./index85.js";
85
+ import { TimePicker as Ce } from "./index86.js";
86
+ import { Timeline as ge } from "./index87.js";
87
+ import { Toggle as Pe } from "./index88.js";
88
+ import { Tour as ke } from "./index89.js";
89
+ import { Tooltip as De } from "./index90.js";
90
+ import { Transfer as ve } from "./index91.js";
91
+ import { Tree as Re } from "./index92.js";
92
+ import { TreeSelect as Be, TreeSelectComponent as Le } from "./index93.js";
93
+ import { Typography as Ie } from "./index94.js";
94
+ import { Upload as He } from "./index95.js";
95
+ import { VirtualList as Ke } from "./index96.js";
96
+ import { Watermark as Ne } from "./index97.js";
97
+ import { Hide as ze, Show as Ee } from "./index98.js";
98
+ import { useBreakpoint as Qe } from "./index99.js";
99
+ import { useDisclosure as Ve } from "./index100.js";
100
+ import { useClipboard as qe } from "./index101.js";
101
+ import { useLocalStorage as Ye } from "./index102.js";
102
+ import { useDebounce as _e } from "./index103.js";
103
+ import { useClickOutside as ot } from "./index104.js";
104
+ import { usePrevious as et } from "./index105.js";
105
+ import { useHover as pt } from "./index106.js";
106
+ import { useKeyPress as ft, useKeyPressCallback as xt } from "./index107.js";
107
+ import { useWindowSize as it } from "./index108.js";
109
108
  export {
110
109
  e as Affix,
111
110
  f as Alert,
@@ -115,16 +114,16 @@ export {
115
114
  s as AvatarGroup,
116
115
  l as Badge,
117
116
  c as Breadcrumb,
118
- pr as Browser,
117
+ er as Browser,
119
118
  T as Button,
120
- v as Card,
121
- L as Carousel,
122
- R as Cascader,
123
- I as Chart,
119
+ w as Card,
120
+ I as Carousel,
121
+ F as Cascader,
122
+ L as Chart,
124
123
  y as Chat,
125
- ue as CheckableTag,
124
+ ne as CheckableTag,
126
125
  b as Checkbox,
127
- fr as Code,
126
+ pr as Code,
128
127
  So as Col,
129
128
  H as Collapse,
130
129
  h as ColorPicker,
@@ -138,7 +137,7 @@ export {
138
137
  Z as Divider,
139
138
  X as Dock,
140
139
  $ as Drawer,
141
- Io as Dropdown,
140
+ Fo as Dropdown,
142
141
  Lo as Empty,
143
142
  to as Fieldset,
144
143
  mo as FileInput,
@@ -149,80 +148,80 @@ export {
149
148
  Co as Form,
150
149
  Po as Grid,
151
150
  yo as Hero,
152
- Ee as Hide,
151
+ ze as Hide,
153
152
  ho as HoverGallery,
154
- vo as Image,
155
- Ro as Indicator,
156
- Ho as Input,
157
- Ko as InputNumber,
158
- No as Join,
159
- zo as Kbd,
160
- Jo as Layout,
161
- Vo as List,
162
- qo as Loading,
163
- Yo as Mask,
164
- _o as Masonry,
165
- or as Mention,
166
- er as Menu,
167
- ur as Modal,
168
- dr as Navbar,
169
- gr as OTPInput,
170
- kr as PageLayout,
171
- Pr as Pagination,
172
- ar as Phone,
173
- Dr as Popconfirm,
174
- wr as Popover,
175
- Fr as Progress,
176
- Br as QRCode,
177
- Mr as RadialProgress,
178
- Ar as Radio,
179
- Gr as Range,
180
- Wr as Rating,
181
- Or as Result,
153
+ wo as Image,
154
+ Io as Input,
155
+ Ho as InputNumber,
156
+ Ko as Join,
157
+ No as Kbd,
158
+ zo as Layout,
159
+ Qo as List,
160
+ Vo as Loading,
161
+ qo as Mask,
162
+ Yo as Masonry,
163
+ _o as Mention,
164
+ or as Menu,
165
+ nr as Modal,
166
+ ur as Navbar,
167
+ Cr as OTPInput,
168
+ Pr as PageLayout,
169
+ gr as Pagination,
170
+ fr as Phone,
171
+ kr as Popconfirm,
172
+ Dr as Popover,
173
+ vr as Progress,
174
+ Rr as QRCode,
175
+ Ar as RadialProgress,
176
+ Br as Radio,
177
+ Mr as Range,
178
+ Gr as Rating,
179
+ Wr as Result,
182
180
  bo as Row,
183
- Qr as Segmented,
184
- Er as Select,
185
- Je as Show,
181
+ Er as Segmented,
182
+ Or as Select,
183
+ Ee as Show,
186
184
  ro as SidebarDrawer,
187
- Vr as Skeleton,
188
- qr as Space,
189
- Yr as Splitter,
190
- _r as Stats,
191
- oe as Status,
192
- ee as Steps,
193
- pe as Table,
194
- fe as Tabs,
195
- le as Tag,
196
- ne as TextRotate,
197
- ae as Textarea,
198
- ce as ThemeController,
199
- Te as TimePicker,
200
- Se as Timeline,
201
- be as Toggle,
202
- he as Tooltip,
203
- ye as Tour,
185
+ Qr as Skeleton,
186
+ Vr as Space,
187
+ qr as Splitter,
188
+ Yr as Stats,
189
+ _r as Status,
190
+ oe as Steps,
191
+ ee as Table,
192
+ pe as Tabs,
193
+ se as Tag,
194
+ ue as TagLiveRegion,
195
+ ae as TextRotate,
196
+ fe as Textarea,
197
+ de as ThemeController,
198
+ Ce as TimePicker,
199
+ ge as Timeline,
200
+ Pe as Toggle,
201
+ De as Tooltip,
202
+ ke as Tour,
204
203
  ve as Transfer,
205
204
  Re as Tree,
206
- Ie as TreeSelect,
207
- Ae as TreeSelectComponent,
208
- Me as Typography,
209
- Ge as Upload,
210
- We as VirtualList,
211
- Oe as Watermark,
212
- nr as Window,
213
- Cr as notification,
214
- Ue as useBreakpoint,
215
- rt as useClickOutside,
216
- Xe as useClipboard,
217
- $e as useDebounce,
218
- je as useDisclosure,
205
+ Be as TreeSelect,
206
+ Le as TreeSelectComponent,
207
+ Ie as Typography,
208
+ He as Upload,
209
+ Ke as VirtualList,
210
+ Ne as Watermark,
211
+ ar as Window,
212
+ dr as notification,
213
+ Qe as useBreakpoint,
214
+ ot as useClickOutside,
215
+ qe as useClipboard,
216
+ _e as useDebounce,
217
+ Ve as useDisclosure,
219
218
  To as useFormInstance,
220
- mt as useHover,
221
- xt as useKeyPress,
222
- at as useKeyPressCallback,
223
- Ze as useLocalStorage,
224
- tt as usePrevious,
225
- Qo as useSiderContext,
226
- nt as useWindowSize
219
+ pt as useHover,
220
+ ft as useKeyPress,
221
+ xt as useKeyPressCallback,
222
+ Ye as useLocalStorage,
223
+ et as usePrevious,
224
+ Eo as useSiderContext,
225
+ it as useWindowSize
227
226
  };
228
227
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index10.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import { useClipboard as z } from "./index102.js";
2
+ import { useClipboard as z } from "./index101.js";
3
3
  const W = () => /* @__PURE__ */ n(
4
4
  "svg",
5
5
  {
package/dist/index100.js CHANGED
@@ -1,36 +1,9 @@
1
- import { useState as u, useEffect as f } from "react";
2
- const t = {
3
- sm: 640,
4
- md: 768,
5
- lg: 1024,
6
- xl: 1280,
7
- "2xl": 1536
8
- }, s = ["xs", "sm", "md", "lg", "xl", "2xl"];
9
- function l(e) {
10
- return e >= t["2xl"] ? "2xl" : e >= t.xl ? "xl" : e >= t.lg ? "lg" : e >= t.md ? "md" : e >= t.sm ? "sm" : "xs";
11
- }
12
- function i(e, o) {
13
- return s.indexOf(e) - s.indexOf(o);
14
- }
15
- function m() {
16
- const [e, o] = u(
17
- () => typeof window < "u" ? window.innerWidth : 1024
18
- );
19
- f(() => {
20
- const n = () => o(window.innerWidth);
21
- return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
22
- }, []);
23
- const r = l(e);
24
- return {
25
- breakpoint: r,
26
- width: e,
27
- isAbove: (n) => i(r, n) >= 0,
28
- isBelow: (n) => i(r, n) < 0,
29
- isAt: (n) => r === n,
30
- isBetween: (n, d) => i(r, n) >= 0 && i(r, d) <= 0
31
- };
1
+ import { useState as u, useCallback as s } from "react";
2
+ function p(o = !1) {
3
+ const [n, e] = u(o), t = s(() => e(!0), []), c = s(() => e(!1), []), l = s(() => e((r) => !r), []);
4
+ return { isOpen: n, onOpen: t, onClose: c, onToggle: l, setIsOpen: e };
32
5
  }
33
6
  export {
34
- m as useBreakpoint
7
+ p as useDisclosure
35
8
  };
36
9
  //# sourceMappingURL=index100.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index100.js","sources":["../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nexport type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nconst breakpoints: Record<Breakpoint, number> = {\n xs: 0,\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n}\n\nconst breakpointOrder: Breakpoint[] = ['xs', 'sm', 'md', 'lg', 'xl', '2xl']\n\nfunction getBreakpoint(width: number): Breakpoint {\n if (width >= breakpoints['2xl']) return '2xl'\n if (width >= breakpoints.xl) return 'xl'\n if (width >= breakpoints.lg) return 'lg'\n if (width >= breakpoints.md) return 'md'\n if (width >= breakpoints.sm) return 'sm'\n return 'xs'\n}\n\nfunction compareBreakpoints(a: Breakpoint, b: Breakpoint): number {\n return breakpointOrder.indexOf(a) - breakpointOrder.indexOf(b)\n}\n\nexport interface UseBreakpointReturn {\n breakpoint: Breakpoint\n width: number\n isAbove: (bp: Breakpoint) => boolean\n isBelow: (bp: Breakpoint) => boolean\n isAt: (bp: Breakpoint) => boolean\n isBetween: (min: Breakpoint, max: Breakpoint) => boolean\n}\n\nexport function useBreakpoint(): UseBreakpointReturn {\n const [width, setWidth] = useState(() =>\n typeof window !== 'undefined' ? window.innerWidth : 1024\n )\n\n useEffect(() => {\n const handleResize = () => setWidth(window.innerWidth)\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n const breakpoint = getBreakpoint(width)\n\n return {\n breakpoint,\n width,\n isAbove: (bp: Breakpoint) => compareBreakpoints(breakpoint, bp) >= 0,\n isBelow: (bp: Breakpoint) => compareBreakpoints(breakpoint, bp) < 0,\n isAt: (bp: Breakpoint) => breakpoint === bp,\n isBetween: (min: Breakpoint, max: Breakpoint) =>\n compareBreakpoints(breakpoint, min) >= 0 && compareBreakpoints(breakpoint, max) <= 0,\n }\n}\n"],"names":["breakpoints","breakpointOrder","getBreakpoint","width","compareBreakpoints","a","b","useBreakpoint","setWidth","useState","useEffect","handleResize","breakpoint","bp","min","max"],"mappings":";AAIA,MAAMA,IAA0C;AAAA,EAE9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT,GAEMC,IAAgC,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK;AAE1E,SAASC,EAAcC,GAA2B;AAChD,SAAIA,KAASH,EAAY,KAAK,IAAU,QACpCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAC7B;AACT;AAEA,SAASI,EAAmBC,GAAeC,GAAuB;AAChE,SAAOL,EAAgB,QAAQI,CAAC,IAAIJ,EAAgB,QAAQK,CAAC;AAC/D;AAWO,SAASC,IAAqC;AACnD,QAAM,CAACJ,GAAOK,CAAQ,IAAIC;AAAA,IAAS,MACjC,OAAO,SAAW,MAAc,OAAO,aAAa;AAAA,EAAA;AAGtD,EAAAC,EAAU,MAAM;AACd,UAAMC,IAAe,MAAMH,EAAS,OAAO,UAAU;AAErD,kBAAO,iBAAiB,UAAUG,CAAY,GACvC,MAAM,OAAO,oBAAoB,UAAUA,CAAY;AAAA,EAChE,GAAG,CAAA,CAAE;AAEL,QAAMC,IAAaV,EAAcC,CAAK;AAEtC,SAAO;AAAA,IACL,YAAAS;AAAA,IACA,OAAAT;AAAA,IACA,SAAS,CAACU,MAAmBT,EAAmBQ,GAAYC,CAAE,KAAK;AAAA,IACnE,SAAS,CAACA,MAAmBT,EAAmBQ,GAAYC,CAAE,IAAI;AAAA,IAClE,MAAM,CAACA,MAAmBD,MAAeC;AAAA,IACzC,WAAW,CAACC,GAAiBC,MAC3BX,EAAmBQ,GAAYE,CAAG,KAAK,KAAKV,EAAmBQ,GAAYG,CAAG,KAAK;AAAA,EAAA;AAEzF;"}
1
+ {"version":3,"file":"index100.js","sources":["../src/hooks/useDisclosure.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport interface UseDisclosureReturn {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onToggle: () => void\n setIsOpen: (value: boolean) => void\n}\n\n/**\n * Hook for managing open/close state of modals, drawers, dropdowns, etc.\n *\n * @param defaultIsOpen - Initial open state (default: false)\n * @returns Object with isOpen state and control functions\n *\n * @example\n * const { isOpen, onOpen, onClose } = useDisclosure()\n *\n * <Button onClick={onOpen}>Open Modal</Button>\n * <Modal open={isOpen} onClose={onClose}>Content</Modal>\n */\nexport function useDisclosure(defaultIsOpen = false): UseDisclosureReturn {\n const [isOpen, setIsOpen] = useState(defaultIsOpen)\n\n const onOpen = useCallback(() => setIsOpen(true), [])\n const onClose = useCallback(() => setIsOpen(false), [])\n const onToggle = useCallback(() => setIsOpen(prev => !prev), [])\n\n return { isOpen, onOpen, onClose, onToggle, setIsOpen }\n}\n"],"names":["useDisclosure","defaultIsOpen","isOpen","setIsOpen","useState","onOpen","useCallback","onClose","onToggle","prev"],"mappings":";AAsBO,SAASA,EAAcC,IAAgB,IAA4B;AACxE,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAASH,CAAa,GAE5CI,IAASC,EAAY,MAAMH,EAAU,EAAI,GAAG,CAAA,CAAE,GAC9CI,IAAUD,EAAY,MAAMH,EAAU,EAAK,GAAG,CAAA,CAAE,GAChDK,IAAWF,EAAY,MAAMH,EAAU,OAAQ,CAACM,CAAI,GAAG,EAAE;AAE/D,SAAO,EAAE,QAAAP,GAAQ,QAAAG,GAAQ,SAAAE,GAAS,UAAAC,GAAU,WAAAL,EAAA;AAC9C;"}
package/dist/index101.js CHANGED
@@ -1,9 +1,17 @@
1
- import { useState as u, useCallback as s } from "react";
2
- function p(o = !1) {
3
- const [n, e] = u(o), t = s(() => e(!0), []), c = s(() => e(!1), []), l = s(() => e((r) => !r), []);
4
- return { isOpen: n, onOpen: t, onClose: c, onToggle: l, setIsOpen: e };
1
+ import { useState as a, useCallback as s } from "react";
2
+ function p(t = 2e3) {
3
+ const [n, r] = a(!1), [l, e] = a(null), c = s(async (i) => {
4
+ try {
5
+ return await navigator.clipboard.writeText(i), r(!0), e(null), setTimeout(() => r(!1), t), !0;
6
+ } catch (o) {
7
+ return e(o instanceof Error ? o : new Error("Failed to copy")), r(!1), !1;
8
+ }
9
+ }, [t]), u = s(() => {
10
+ r(!1), e(null);
11
+ }, []);
12
+ return { copy: c, copied: n, error: l, reset: u };
5
13
  }
6
14
  export {
7
- p as useDisclosure
15
+ p as useClipboard
8
16
  };
9
17
  //# sourceMappingURL=index101.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index101.js","sources":["../src/hooks/useDisclosure.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport interface UseDisclosureReturn {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onToggle: () => void\n setIsOpen: (value: boolean) => void\n}\n\n/**\n * Hook for managing open/close state of modals, drawers, dropdowns, etc.\n *\n * @param defaultIsOpen - Initial open state (default: false)\n * @returns Object with isOpen state and control functions\n *\n * @example\n * const { isOpen, onOpen, onClose } = useDisclosure()\n *\n * <Button onClick={onOpen}>Open Modal</Button>\n * <Modal open={isOpen} onClose={onClose}>Content</Modal>\n */\nexport function useDisclosure(defaultIsOpen = false): UseDisclosureReturn {\n const [isOpen, setIsOpen] = useState(defaultIsOpen)\n\n const onOpen = useCallback(() => setIsOpen(true), [])\n const onClose = useCallback(() => setIsOpen(false), [])\n const onToggle = useCallback(() => setIsOpen(prev => !prev), [])\n\n return { isOpen, onOpen, onClose, onToggle, setIsOpen }\n}\n"],"names":["useDisclosure","defaultIsOpen","isOpen","setIsOpen","useState","onOpen","useCallback","onClose","onToggle","prev"],"mappings":";AAsBO,SAASA,EAAcC,IAAgB,IAA4B;AACxE,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAASH,CAAa,GAE5CI,IAASC,EAAY,MAAMH,EAAU,EAAI,GAAG,CAAA,CAAE,GAC9CI,IAAUD,EAAY,MAAMH,EAAU,EAAK,GAAG,CAAA,CAAE,GAChDK,IAAWF,EAAY,MAAMH,EAAU,OAAQ,CAACM,CAAI,GAAG,EAAE;AAE/D,SAAO,EAAE,QAAAP,GAAQ,QAAAG,GAAQ,SAAAE,GAAS,UAAAC,GAAU,WAAAL,EAAA;AAC9C;"}
1
+ {"version":3,"file":"index101.js","sources":["../src/hooks/useClipboard.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport interface UseClipboardReturn {\n copy: (text: string) => Promise<boolean>\n copied: boolean\n error: Error | null\n reset: () => void\n}\n\n/**\n * Hook for copying text to clipboard with success/error state.\n *\n * @param timeout - Duration in ms to show copied state (default: 2000)\n * @returns Object with copy function and state\n *\n * @example\n * const { copy, copied } = useClipboard()\n *\n * <Button onClick={() => copy('Hello!')}>\n * {copied ? 'Copied!' : 'Copy'}\n * </Button>\n */\nexport function useClipboard(timeout = 2000): UseClipboardReturn {\n const [copied, setCopied] = useState(false)\n const [error, setError] = useState<Error | null>(null)\n\n const copy = useCallback(async (text: string): Promise<boolean> => {\n try {\n await navigator.clipboard.writeText(text)\n setCopied(true)\n setError(null)\n\n setTimeout(() => setCopied(false), timeout)\n return true\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to copy'))\n setCopied(false)\n return false\n }\n }, [timeout])\n\n const reset = useCallback(() => {\n setCopied(false)\n setError(null)\n }, [])\n\n return { copy, copied, error, reset }\n}\n"],"names":["useClipboard","timeout","copied","setCopied","useState","error","setError","copy","useCallback","text","err","reset"],"mappings":";AAsBO,SAASA,EAAaC,IAAU,KAA0B;AAC/D,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAOC,CAAQ,IAAIF,EAAuB,IAAI,GAE/CG,IAAOC,EAAY,OAAOC,MAAmC;AACjE,QAAI;AACF,mBAAM,UAAU,UAAU,UAAUA,CAAI,GACxCN,EAAU,EAAI,GACdG,EAAS,IAAI,GAEb,WAAW,MAAMH,EAAU,EAAK,GAAGF,CAAO,GACnC;AAAA,IACT,SAASS,GAAK;AACZ,aAAAJ,EAASI,aAAe,QAAQA,IAAM,IAAI,MAAM,gBAAgB,CAAC,GACjEP,EAAU,EAAK,GACR;AAAA,IACT;AAAA,EACF,GAAG,CAACF,CAAO,CAAC,GAENU,IAAQH,EAAY,MAAM;AAC9B,IAAAL,EAAU,EAAK,GACfG,EAAS,IAAI;AAAA,EACf,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,MAAAC,GAAM,QAAAL,GAAQ,OAAAG,GAAO,OAAAM,EAAA;AAChC;"}
package/dist/index102.js CHANGED
@@ -1,17 +1,49 @@
1
- import { useState as a, useCallback as s } from "react";
2
- function p(t = 2e3) {
3
- const [n, r] = a(!1), [l, e] = a(null), c = s(async (i) => {
1
+ import { useState as u, useCallback as c, useEffect as f } from "react";
2
+ function S(o, t) {
3
+ const [s, n] = u(() => {
4
+ if (typeof window > "u")
5
+ return t;
4
6
  try {
5
- return await navigator.clipboard.writeText(i), r(!0), e(null), setTimeout(() => r(!1), t), !0;
6
- } catch (o) {
7
- return e(o instanceof Error ? o : new Error("Failed to copy")), r(!1), !1;
7
+ const e = window.localStorage.getItem(o);
8
+ return e ? JSON.parse(e) : t;
9
+ } catch {
10
+ return t;
8
11
  }
9
- }, [t]), u = s(() => {
10
- r(!1), e(null);
11
- }, []);
12
- return { copy: c, copied: n, error: l, reset: u };
12
+ }), d = c(
13
+ (e) => {
14
+ n((r) => {
15
+ const a = e instanceof Function ? e(r) : e;
16
+ if (typeof window < "u")
17
+ try {
18
+ window.localStorage.setItem(o, JSON.stringify(a));
19
+ } catch (l) {
20
+ console.warn(`Failed to save to localStorage key "${o}":`, l);
21
+ }
22
+ return a;
23
+ });
24
+ },
25
+ [o]
26
+ ), w = c(() => {
27
+ if (typeof window < "u")
28
+ try {
29
+ window.localStorage.removeItem(o);
30
+ } catch (e) {
31
+ console.warn(`Failed to remove localStorage key "${o}":`, e);
32
+ }
33
+ n(t);
34
+ }, [o, t]);
35
+ return f(() => {
36
+ const e = (r) => {
37
+ if (r.key === o && r.newValue !== null)
38
+ try {
39
+ n(JSON.parse(r.newValue));
40
+ } catch {
41
+ }
42
+ };
43
+ return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
44
+ }, [o]), [s, d, w];
13
45
  }
14
46
  export {
15
- p as useClipboard
47
+ S as useLocalStorage
16
48
  };
17
49
  //# sourceMappingURL=index102.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index102.js","sources":["../src/hooks/useClipboard.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport interface UseClipboardReturn {\n copy: (text: string) => Promise<boolean>\n copied: boolean\n error: Error | null\n reset: () => void\n}\n\n/**\n * Hook for copying text to clipboard with success/error state.\n *\n * @param timeout - Duration in ms to show copied state (default: 2000)\n * @returns Object with copy function and state\n *\n * @example\n * const { copy, copied } = useClipboard()\n *\n * <Button onClick={() => copy('Hello!')}>\n * {copied ? 'Copied!' : 'Copy'}\n * </Button>\n */\nexport function useClipboard(timeout = 2000): UseClipboardReturn {\n const [copied, setCopied] = useState(false)\n const [error, setError] = useState<Error | null>(null)\n\n const copy = useCallback(async (text: string): Promise<boolean> => {\n try {\n await navigator.clipboard.writeText(text)\n setCopied(true)\n setError(null)\n\n setTimeout(() => setCopied(false), timeout)\n return true\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to copy'))\n setCopied(false)\n return false\n }\n }, [timeout])\n\n const reset = useCallback(() => {\n setCopied(false)\n setError(null)\n }, [])\n\n return { copy, copied, error, reset }\n}\n"],"names":["useClipboard","timeout","copied","setCopied","useState","error","setError","copy","useCallback","text","err","reset"],"mappings":";AAsBO,SAASA,EAAaC,IAAU,KAA0B;AAC/D,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAOC,CAAQ,IAAIF,EAAuB,IAAI,GAE/CG,IAAOC,EAAY,OAAOC,MAAmC;AACjE,QAAI;AACF,mBAAM,UAAU,UAAU,UAAUA,CAAI,GACxCN,EAAU,EAAI,GACdG,EAAS,IAAI,GAEb,WAAW,MAAMH,EAAU,EAAK,GAAGF,CAAO,GACnC;AAAA,IACT,SAASS,GAAK;AACZ,aAAAJ,EAASI,aAAe,QAAQA,IAAM,IAAI,MAAM,gBAAgB,CAAC,GACjEP,EAAU,EAAK,GACR;AAAA,IACT;AAAA,EACF,GAAG,CAACF,CAAO,CAAC,GAENU,IAAQH,EAAY,MAAM;AAC9B,IAAAL,EAAU,EAAK,GACfG,EAAS,IAAI;AAAA,EACf,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,MAAAC,GAAM,QAAAL,GAAQ,OAAAG,GAAO,OAAAM,EAAA;AAChC;"}
1
+ {"version":3,"file":"index102.js","sources":["../src/hooks/useLocalStorage.ts"],"sourcesContent":["import { useState, useCallback, useEffect } from 'react'\n\n/**\n * Hook for persisting state to localStorage.\n *\n * @param key - localStorage key\n * @param initialValue - Initial value if key doesn't exist\n * @returns [value, setValue, removeValue] tuple\n *\n * @example\n * const [theme, setTheme] = useLocalStorage('theme', 'light')\n * const [user, setUser, removeUser] = useLocalStorage('user', null)\n */\nexport function useLocalStorage<T>(\n key: string,\n initialValue: T\n): [T, (value: T | ((prev: T) => T)) => void, () => void] {\n // Get initial value from localStorage or use default\n const [storedValue, setStoredValue] = useState<T>(() => {\n if (typeof window === 'undefined') {\n return initialValue\n }\n\n try {\n const item = window.localStorage.getItem(key)\n return item ? (JSON.parse(item) as T) : initialValue\n } catch {\n return initialValue\n }\n })\n\n // Update localStorage when value changes\n const setValue = useCallback(\n (value: T | ((prev: T) => T)) => {\n setStoredValue(prev => {\n const valueToStore = value instanceof Function ? value(prev) : value\n\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.setItem(key, JSON.stringify(valueToStore))\n } catch (error) {\n console.warn(`Failed to save to localStorage key \"${key}\":`, error)\n }\n }\n\n return valueToStore\n })\n },\n [key]\n )\n\n // Remove from localStorage\n const removeValue = useCallback(() => {\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.removeItem(key)\n } catch (error) {\n console.warn(`Failed to remove localStorage key \"${key}\":`, error)\n }\n }\n setStoredValue(initialValue)\n }, [key, initialValue])\n\n // Sync with other tabs/windows\n useEffect(() => {\n const handleStorageChange = (e: StorageEvent) => {\n if (e.key === key && e.newValue !== null) {\n try {\n setStoredValue(JSON.parse(e.newValue) as T)\n } catch {\n // Ignore parse errors\n }\n }\n }\n\n window.addEventListener('storage', handleStorageChange)\n return () => window.removeEventListener('storage', handleStorageChange)\n }, [key])\n\n return [storedValue, setValue, removeValue]\n}\n"],"names":["useLocalStorage","key","initialValue","storedValue","setStoredValue","useState","item","setValue","useCallback","value","prev","valueToStore","error","removeValue","useEffect","handleStorageChange","e"],"mappings":";AAaO,SAASA,EACdC,GACAC,GACwD;AAExD,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAY,MAAM;AACtD,QAAI,OAAO,SAAW;AACpB,aAAOH;AAGT,QAAI;AACF,YAAMI,IAAO,OAAO,aAAa,QAAQL,CAAG;AAC5C,aAAOK,IAAQ,KAAK,MAAMA,CAAI,IAAUJ;AAAA,IAC1C,QAAQ;AACN,aAAOA;AAAA,IACT;AAAA,EACF,CAAC,GAGKK,IAAWC;AAAA,IACf,CAACC,MAAgC;AAC/B,MAAAL,EAAe,CAAAM,MAAQ;AACrB,cAAMC,IAAeF,aAAiB,WAAWA,EAAMC,CAAI,IAAID;AAE/D,YAAI,OAAO,SAAW;AACpB,cAAI;AACF,mBAAO,aAAa,QAAQR,GAAK,KAAK,UAAUU,CAAY,CAAC;AAAA,UAC/D,SAASC,GAAO;AACd,oBAAQ,KAAK,uCAAuCX,CAAG,MAAMW,CAAK;AAAA,UACpE;AAGF,eAAOD;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAACV,CAAG;AAAA,EAAA,GAIAY,IAAcL,EAAY,MAAM;AACpC,QAAI,OAAO,SAAW;AACpB,UAAI;AACF,eAAO,aAAa,WAAWP,CAAG;AAAA,MACpC,SAASW,GAAO;AACd,gBAAQ,KAAK,sCAAsCX,CAAG,MAAMW,CAAK;AAAA,MACnE;AAEF,IAAAR,EAAeF,CAAY;AAAA,EAC7B,GAAG,CAACD,GAAKC,CAAY,CAAC;AAGtB,SAAAY,EAAU,MAAM;AACd,UAAMC,IAAsB,CAACC,MAAoB;AAC/C,UAAIA,EAAE,QAAQf,KAAOe,EAAE,aAAa;AAClC,YAAI;AACF,UAAAZ,EAAe,KAAK,MAAMY,EAAE,QAAQ,CAAM;AAAA,QAC5C,QAAQ;AAAA,QAER;AAAA,IAEJ;AAEA,kBAAO,iBAAiB,WAAWD,CAAmB,GAC/C,MAAM,OAAO,oBAAoB,WAAWA,CAAmB;AAAA,EACxE,GAAG,CAACd,CAAG,CAAC,GAED,CAACE,GAAaI,GAAUM,CAAW;AAC5C;"}
package/dist/index103.js CHANGED
@@ -1,49 +1,16 @@
1
- import { useState as u, useCallback as c, useEffect as f } from "react";
2
- function S(o, t) {
3
- const [s, n] = u(() => {
4
- if (typeof window > "u")
5
- return t;
6
- try {
7
- const e = window.localStorage.getItem(o);
8
- return e ? JSON.parse(e) : t;
9
- } catch {
10
- return t;
11
- }
12
- }), d = c(
13
- (e) => {
14
- n((r) => {
15
- const a = e instanceof Function ? e(r) : e;
16
- if (typeof window < "u")
17
- try {
18
- window.localStorage.setItem(o, JSON.stringify(a));
19
- } catch (l) {
20
- console.warn(`Failed to save to localStorage key "${o}":`, l);
21
- }
22
- return a;
23
- });
24
- },
25
- [o]
26
- ), w = c(() => {
27
- if (typeof window < "u")
28
- try {
29
- window.localStorage.removeItem(o);
30
- } catch (e) {
31
- console.warn(`Failed to remove localStorage key "${o}":`, e);
32
- }
33
- n(t);
34
- }, [o, t]);
35
- return f(() => {
36
- const e = (r) => {
37
- if (r.key === o && r.newValue !== null)
38
- try {
39
- n(JSON.parse(r.newValue));
40
- } catch {
41
- }
1
+ import { useState as r, useEffect as c } from "react";
2
+ function i(e, t = 300) {
3
+ const [o, u] = r(e);
4
+ return c(() => {
5
+ const n = setTimeout(() => {
6
+ u(e);
7
+ }, t);
8
+ return () => {
9
+ clearTimeout(n);
42
10
  };
43
- return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
44
- }, [o]), [s, d, w];
11
+ }, [e, t]), o;
45
12
  }
46
13
  export {
47
- S as useLocalStorage
14
+ i as useDebounce
48
15
  };
49
16
  //# sourceMappingURL=index103.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index103.js","sources":["../src/hooks/useLocalStorage.ts"],"sourcesContent":["import { useState, useCallback, useEffect } from 'react'\n\n/**\n * Hook for persisting state to localStorage.\n *\n * @param key - localStorage key\n * @param initialValue - Initial value if key doesn't exist\n * @returns [value, setValue, removeValue] tuple\n *\n * @example\n * const [theme, setTheme] = useLocalStorage('theme', 'light')\n * const [user, setUser, removeUser] = useLocalStorage('user', null)\n */\nexport function useLocalStorage<T>(\n key: string,\n initialValue: T\n): [T, (value: T | ((prev: T) => T)) => void, () => void] {\n // Get initial value from localStorage or use default\n const [storedValue, setStoredValue] = useState<T>(() => {\n if (typeof window === 'undefined') {\n return initialValue\n }\n\n try {\n const item = window.localStorage.getItem(key)\n return item ? (JSON.parse(item) as T) : initialValue\n } catch {\n return initialValue\n }\n })\n\n // Update localStorage when value changes\n const setValue = useCallback(\n (value: T | ((prev: T) => T)) => {\n setStoredValue(prev => {\n const valueToStore = value instanceof Function ? value(prev) : value\n\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.setItem(key, JSON.stringify(valueToStore))\n } catch (error) {\n console.warn(`Failed to save to localStorage key \"${key}\":`, error)\n }\n }\n\n return valueToStore\n })\n },\n [key]\n )\n\n // Remove from localStorage\n const removeValue = useCallback(() => {\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.removeItem(key)\n } catch (error) {\n console.warn(`Failed to remove localStorage key \"${key}\":`, error)\n }\n }\n setStoredValue(initialValue)\n }, [key, initialValue])\n\n // Sync with other tabs/windows\n useEffect(() => {\n const handleStorageChange = (e: StorageEvent) => {\n if (e.key === key && e.newValue !== null) {\n try {\n setStoredValue(JSON.parse(e.newValue) as T)\n } catch {\n // Ignore parse errors\n }\n }\n }\n\n window.addEventListener('storage', handleStorageChange)\n return () => window.removeEventListener('storage', handleStorageChange)\n }, [key])\n\n return [storedValue, setValue, removeValue]\n}\n"],"names":["useLocalStorage","key","initialValue","storedValue","setStoredValue","useState","item","setValue","useCallback","value","prev","valueToStore","error","removeValue","useEffect","handleStorageChange","e"],"mappings":";AAaO,SAASA,EACdC,GACAC,GACwD;AAExD,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAY,MAAM;AACtD,QAAI,OAAO,SAAW;AACpB,aAAOH;AAGT,QAAI;AACF,YAAMI,IAAO,OAAO,aAAa,QAAQL,CAAG;AAC5C,aAAOK,IAAQ,KAAK,MAAMA,CAAI,IAAUJ;AAAA,IAC1C,QAAQ;AACN,aAAOA;AAAA,IACT;AAAA,EACF,CAAC,GAGKK,IAAWC;AAAA,IACf,CAACC,MAAgC;AAC/B,MAAAL,EAAe,CAAAM,MAAQ;AACrB,cAAMC,IAAeF,aAAiB,WAAWA,EAAMC,CAAI,IAAID;AAE/D,YAAI,OAAO,SAAW;AACpB,cAAI;AACF,mBAAO,aAAa,QAAQR,GAAK,KAAK,UAAUU,CAAY,CAAC;AAAA,UAC/D,SAASC,GAAO;AACd,oBAAQ,KAAK,uCAAuCX,CAAG,MAAMW,CAAK;AAAA,UACpE;AAGF,eAAOD;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAACV,CAAG;AAAA,EAAA,GAIAY,IAAcL,EAAY,MAAM;AACpC,QAAI,OAAO,SAAW;AACpB,UAAI;AACF,eAAO,aAAa,WAAWP,CAAG;AAAA,MACpC,SAASW,GAAO;AACd,gBAAQ,KAAK,sCAAsCX,CAAG,MAAMW,CAAK;AAAA,MACnE;AAEF,IAAAR,EAAeF,CAAY;AAAA,EAC7B,GAAG,CAACD,GAAKC,CAAY,CAAC;AAGtB,SAAAY,EAAU,MAAM;AACd,UAAMC,IAAsB,CAACC,MAAoB;AAC/C,UAAIA,EAAE,QAAQf,KAAOe,EAAE,aAAa;AAClC,YAAI;AACF,UAAAZ,EAAe,KAAK,MAAMY,EAAE,QAAQ,CAAM;AAAA,QAC5C,QAAQ;AAAA,QAER;AAAA,IAEJ;AAEA,kBAAO,iBAAiB,WAAWD,CAAmB,GAC/C,MAAM,OAAO,oBAAoB,WAAWA,CAAmB;AAAA,EACxE,GAAG,CAACd,CAAG,CAAC,GAED,CAACE,GAAaI,GAAUM,CAAW;AAC5C;"}
1
+ {"version":3,"file":"index103.js","sources":["../src/hooks/useDebounce.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\n/**\n * Hook that delays updating a value until after a specified delay.\n * Useful for search inputs to avoid excessive API calls.\n *\n * @param value - Value to debounce\n * @param delay - Delay in milliseconds (default: 300)\n * @returns Debounced value\n *\n * @example\n * const [search, setSearch] = useState('')\n * const debouncedSearch = useDebounce(search, 500)\n *\n * useEffect(() => {\n * // This runs 500ms after user stops typing\n * fetchResults(debouncedSearch)\n * }, [debouncedSearch])\n */\nexport function useDebounce<T>(value: T, delay = 300): T {\n const [debouncedValue, setDebouncedValue] = useState<T>(value)\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value)\n }, delay)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n"],"names":["useDebounce","value","delay","debouncedValue","setDebouncedValue","useState","useEffect","timer"],"mappings":";AAmBO,SAASA,EAAeC,GAAUC,IAAQ,KAAQ;AACvD,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAYJ,CAAK;AAE7D,SAAAK,EAAU,MAAM;AACd,UAAMC,IAAQ,WAAW,MAAM;AAC7B,MAAAH,EAAkBH,CAAK;AAAA,IACzB,GAAGC,CAAK;AAER,WAAO,MAAM;AACX,mBAAaK,CAAK;AAAA,IACpB;AAAA,EACF,GAAG,CAACN,GAAOC,CAAK,CAAC,GAEVC;AACT;"}