@next-degree/pickle-shared-js 0.5.31 → 0.6.43

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 (239) hide show
  1. package/dist/company_service_latest-Dwf4Fkjr.d.cts +2641 -0
  2. package/dist/company_service_latest-Dwf4Fkjr.d.ts +2641 -0
  3. package/dist/components/buttons/BackButton.cjs +161 -0
  4. package/dist/components/buttons/BackButton.cjs.map +1 -0
  5. package/dist/components/buttons/BackButton.d.cts +9 -0
  6. package/dist/components/buttons/BackButton.d.ts +9 -0
  7. package/dist/components/buttons/BackButton.js +137 -0
  8. package/dist/components/buttons/BackButton.js.map +1 -0
  9. package/dist/components/company/CompanyBenefits.cjs +38 -0
  10. package/dist/components/company/CompanyBenefits.cjs.map +1 -0
  11. package/dist/components/company/CompanyBenefits.d.cts +8 -0
  12. package/dist/components/company/CompanyBenefits.d.ts +8 -0
  13. package/dist/components/company/CompanyBenefits.js +13 -0
  14. package/dist/components/company/CompanyBenefits.js.map +1 -0
  15. package/dist/components/company/CompanyInformation.cjs +112 -0
  16. package/dist/components/company/CompanyInformation.cjs.map +1 -0
  17. package/dist/components/company/CompanyInformation.d.cts +12 -0
  18. package/dist/components/company/CompanyInformation.d.ts +12 -0
  19. package/dist/components/company/CompanyInformation.js +75 -0
  20. package/dist/components/company/CompanyInformation.js.map +1 -0
  21. package/dist/components/company/CompanyTake.cjs +140 -0
  22. package/dist/components/company/CompanyTake.cjs.map +1 -0
  23. package/dist/components/company/CompanyTake.d.cts +9 -0
  24. package/dist/components/company/CompanyTake.d.ts +9 -0
  25. package/dist/components/company/CompanyTake.js +104 -0
  26. package/dist/components/company/CompanyTake.js.map +1 -0
  27. package/dist/components/jobPost/JobDescription.cjs +205 -0
  28. package/dist/components/jobPost/JobDescription.cjs.map +1 -0
  29. package/dist/components/jobPost/JobDescription.d.cts +8 -0
  30. package/dist/components/jobPost/JobDescription.d.ts +8 -0
  31. package/dist/components/jobPost/JobDescription.js +168 -0
  32. package/dist/components/jobPost/JobDescription.js.map +1 -0
  33. package/dist/components/jobPost/JobHeader.cjs +436 -0
  34. package/dist/components/jobPost/JobHeader.cjs.map +1 -0
  35. package/dist/components/jobPost/JobHeader.d.cts +26 -0
  36. package/dist/components/jobPost/JobHeader.d.ts +26 -0
  37. package/dist/components/jobPost/JobHeader.js +423 -0
  38. package/dist/components/jobPost/JobHeader.js.map +1 -0
  39. package/dist/components/jobPost/JobPost.cjs +1349 -0
  40. package/dist/components/jobPost/JobPost.cjs.map +1 -0
  41. package/dist/components/jobPost/JobPost.d.cts +16 -0
  42. package/dist/components/jobPost/JobPost.d.ts +16 -0
  43. package/dist/components/jobPost/JobPost.js +1336 -0
  44. package/dist/components/jobPost/JobPost.js.map +1 -0
  45. package/dist/components/primitives/avatar.cjs +88 -0
  46. package/dist/components/primitives/avatar.cjs.map +1 -0
  47. package/dist/components/primitives/avatar.d.cts +13 -0
  48. package/dist/components/primitives/avatar.d.ts +13 -0
  49. package/dist/components/primitives/avatar.js +52 -0
  50. package/dist/components/primitives/avatar.js.map +1 -0
  51. package/dist/components/primitives/command.d.cts +3 -3
  52. package/dist/components/primitives/command.d.ts +3 -3
  53. package/dist/components/ui/Avatar.cjs +117 -0
  54. package/dist/components/ui/Avatar.cjs.map +1 -0
  55. package/dist/components/ui/Avatar.d.cts +16 -0
  56. package/dist/components/ui/Avatar.d.ts +16 -0
  57. package/dist/components/ui/Avatar.js +79 -0
  58. package/dist/components/ui/Avatar.js.map +1 -0
  59. package/dist/components/ui/Icon.cjs +114 -0
  60. package/dist/components/ui/Icon.cjs.map +1 -0
  61. package/dist/components/ui/Icon.d.cts +15 -0
  62. package/dist/components/ui/Icon.d.ts +15 -0
  63. package/dist/components/ui/Icon.js +89 -0
  64. package/dist/components/ui/Icon.js.map +1 -0
  65. package/dist/{app/layout.cjs → components/ui/LinkButton.cjs} +25 -35
  66. package/dist/components/ui/LinkButton.cjs.map +1 -0
  67. package/dist/components/ui/LinkButton.d.cts +29 -0
  68. package/dist/components/ui/LinkButton.d.ts +29 -0
  69. package/dist/components/ui/LinkButton.js +26 -0
  70. package/dist/components/ui/LinkButton.js.map +1 -0
  71. package/dist/components/ui/ReadMore.cjs +194 -0
  72. package/dist/components/ui/ReadMore.cjs.map +1 -0
  73. package/dist/components/ui/ReadMore.d.cts +9 -0
  74. package/dist/components/ui/ReadMore.d.ts +9 -0
  75. package/dist/components/ui/ReadMore.js +160 -0
  76. package/dist/components/ui/ReadMore.js.map +1 -0
  77. package/dist/contexts/WindowHistoryProvider.cjs +48 -0
  78. package/dist/contexts/WindowHistoryProvider.cjs.map +1 -0
  79. package/dist/contexts/WindowHistoryProvider.d.cts +11 -0
  80. package/dist/contexts/WindowHistoryProvider.d.ts +11 -0
  81. package/dist/contexts/WindowHistoryProvider.js +23 -0
  82. package/dist/contexts/WindowHistoryProvider.js.map +1 -0
  83. package/dist/displayText-C1qKqRYc.d.cts +48 -0
  84. package/dist/displayText-D-OzRlJf.d.ts +48 -0
  85. package/dist/hooks/useDisplayText.cjs +502 -0
  86. package/dist/hooks/useDisplayText.cjs.map +1 -0
  87. package/dist/hooks/useDisplayText.d.cts +8 -0
  88. package/dist/hooks/useDisplayText.d.ts +8 -0
  89. package/dist/hooks/useDisplayText.js +477 -0
  90. package/dist/hooks/useDisplayText.js.map +1 -0
  91. package/dist/hooks/useWindowHistory.cjs +46 -0
  92. package/dist/hooks/useWindowHistory.cjs.map +1 -0
  93. package/dist/hooks/useWindowHistory.d.cts +7 -0
  94. package/dist/hooks/useWindowHistory.d.ts +7 -0
  95. package/dist/hooks/useWindowHistory.js +21 -0
  96. package/dist/hooks/useWindowHistory.js.map +1 -0
  97. package/dist/index.cjs +1434 -2
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.d.cts +21 -0
  100. package/dist/index.d.ts +21 -0
  101. package/dist/index.js +1443 -1
  102. package/dist/index.js.map +1 -1
  103. package/dist/job_posting_service_latest-D0AsiA4a.d.cts +2789 -0
  104. package/dist/job_posting_service_latest-D0AsiA4a.d.ts +2789 -0
  105. package/dist/lib/icons.cjs +53 -0
  106. package/dist/lib/icons.cjs.map +1 -0
  107. package/dist/lib/icons.d.cts +27 -0
  108. package/dist/lib/icons.d.ts +27 -0
  109. package/dist/lib/icons.js +49 -0
  110. package/dist/lib/icons.js.map +1 -0
  111. package/dist/lib/locations.cjs +45 -0
  112. package/dist/lib/locations.cjs.map +1 -0
  113. package/dist/lib/locations.d.cts +8 -0
  114. package/dist/lib/locations.d.ts +8 -0
  115. package/dist/lib/locations.js +19 -0
  116. package/dist/lib/locations.js.map +1 -0
  117. package/dist/lib/mappings.cjs +443 -0
  118. package/dist/lib/mappings.cjs.map +1 -0
  119. package/dist/lib/mappings.d.cts +4 -0
  120. package/dist/lib/mappings.d.ts +4 -0
  121. package/dist/lib/mappings.js +409 -0
  122. package/dist/lib/mappings.js.map +1 -0
  123. package/dist/lib/salaryRange.cjs +90 -0
  124. package/dist/lib/salaryRange.cjs.map +1 -0
  125. package/dist/lib/salaryRange.d.cts +6 -0
  126. package/dist/lib/salaryRange.d.ts +6 -0
  127. package/dist/lib/salaryRange.js +63 -0
  128. package/dist/lib/salaryRange.js.map +1 -0
  129. package/dist/services/displayText.cjs +470 -0
  130. package/dist/services/displayText.cjs.map +1 -0
  131. package/dist/services/displayText.d.cts +4 -0
  132. package/dist/services/displayText.d.ts +4 -0
  133. package/dist/services/displayText.js +443 -0
  134. package/dist/services/displayText.js.map +1 -0
  135. package/dist/shared_pickle_output_latest-DX6GQoVn.d.cts +194 -0
  136. package/dist/shared_pickle_output_latest-DX6GQoVn.d.ts +194 -0
  137. package/dist/styles/globals.css +817 -0
  138. package/dist/styles/globals.css.map +1 -1
  139. package/dist/types/data/company_service_latest.cjs +228 -0
  140. package/dist/types/data/company_service_latest.cjs.map +1 -0
  141. package/dist/types/data/company_service_latest.d.cts +2 -0
  142. package/dist/types/data/company_service_latest.d.ts +2 -0
  143. package/dist/types/data/company_service_latest.js +186 -0
  144. package/dist/types/data/company_service_latest.js.map +1 -0
  145. package/dist/types/data/job_posting_service_latest.cjs +266 -0
  146. package/dist/types/data/job_posting_service_latest.cjs.map +1 -0
  147. package/dist/types/data/job_posting_service_latest.d.cts +2 -0
  148. package/dist/types/data/job_posting_service_latest.d.ts +2 -0
  149. package/dist/types/data/job_posting_service_latest.js +230 -0
  150. package/dist/types/data/job_posting_service_latest.js.map +1 -0
  151. package/dist/types/data/shared_pickle_output_latest.cjs +82 -0
  152. package/dist/types/data/shared_pickle_output_latest.cjs.map +1 -0
  153. package/dist/types/data/shared_pickle_output_latest.d.cts +2 -0
  154. package/dist/types/data/shared_pickle_output_latest.d.ts +2 -0
  155. package/dist/types/data/shared_pickle_output_latest.js +50 -0
  156. package/dist/types/data/shared_pickle_output_latest.js.map +1 -0
  157. package/dist/types/displayText.errors.cjs +44 -0
  158. package/dist/types/displayText.errors.cjs.map +1 -0
  159. package/dist/types/displayText.errors.d.cts +8 -0
  160. package/dist/types/displayText.errors.d.ts +8 -0
  161. package/dist/types/displayText.errors.js +18 -0
  162. package/dist/types/displayText.errors.js.map +1 -0
  163. package/package.json +19 -7
  164. package/dist/AmbitBold-3SZZPYLH.otf +0 -0
  165. package/dist/AmbitBoldItalic-JSHFTN4A.otf +0 -0
  166. package/dist/AmbitRegular-MB5U7O3L.otf +0 -0
  167. package/dist/app/layout.cjs.map +0 -1
  168. package/dist/app/layout.css +0 -1423
  169. package/dist/app/layout.css.map +0 -1
  170. package/dist/app/layout.d.cts +0 -11
  171. package/dist/app/layout.d.ts +0 -11
  172. package/dist/app/layout.js +0 -36
  173. package/dist/app/layout.js.map +0 -1
  174. package/dist/app/page.cjs +0 -1607
  175. package/dist/app/page.cjs.map +0 -1
  176. package/dist/app/page.d.cts +0 -5
  177. package/dist/app/page.d.ts +0 -5
  178. package/dist/app/page.js +0 -1581
  179. package/dist/app/page.js.map +0 -1
  180. package/dist/assets/fonts/AmbitBold.cjs +0 -3
  181. package/dist/assets/fonts/AmbitBold.cjs.map +0 -1
  182. package/dist/assets/fonts/AmbitBold.d.cts +0 -2
  183. package/dist/assets/fonts/AmbitBold.d.ts +0 -2
  184. package/dist/assets/fonts/AmbitBold.js +0 -6
  185. package/dist/assets/fonts/AmbitBold.js.map +0 -1
  186. package/dist/assets/fonts/AmbitBoldItalic.cjs +0 -3
  187. package/dist/assets/fonts/AmbitBoldItalic.cjs.map +0 -1
  188. package/dist/assets/fonts/AmbitBoldItalic.d.cts +0 -2
  189. package/dist/assets/fonts/AmbitBoldItalic.d.ts +0 -2
  190. package/dist/assets/fonts/AmbitBoldItalic.js +0 -6
  191. package/dist/assets/fonts/AmbitBoldItalic.js.map +0 -1
  192. package/dist/assets/fonts/AmbitRegular.cjs +0 -3
  193. package/dist/assets/fonts/AmbitRegular.cjs.map +0 -1
  194. package/dist/assets/fonts/AmbitRegular.d.cts +0 -2
  195. package/dist/assets/fonts/AmbitRegular.d.ts +0 -2
  196. package/dist/assets/fonts/AmbitRegular.js +0 -6
  197. package/dist/assets/fonts/AmbitRegular.js.map +0 -1
  198. package/dist/components/demos/ComboboxDemo.cjs +0 -814
  199. package/dist/components/demos/ComboboxDemo.cjs.map +0 -1
  200. package/dist/components/demos/ComboboxDemo.d.cts +0 -5
  201. package/dist/components/demos/ComboboxDemo.d.ts +0 -5
  202. package/dist/components/demos/ComboboxDemo.js +0 -786
  203. package/dist/components/demos/ComboboxDemo.js.map +0 -1
  204. package/dist/components/demos/CounterDemo.cjs +0 -270
  205. package/dist/components/demos/CounterDemo.cjs.map +0 -1
  206. package/dist/components/demos/CounterDemo.d.cts +0 -5
  207. package/dist/components/demos/CounterDemo.d.ts +0 -5
  208. package/dist/components/demos/CounterDemo.js +0 -238
  209. package/dist/components/demos/CounterDemo.js.map +0 -1
  210. package/dist/components/demos/InputDemo.cjs +0 -225
  211. package/dist/components/demos/InputDemo.cjs.map +0 -1
  212. package/dist/components/demos/InputDemo.d.cts +0 -5
  213. package/dist/components/demos/InputDemo.d.ts +0 -5
  214. package/dist/components/demos/InputDemo.js +0 -192
  215. package/dist/components/demos/InputDemo.js.map +0 -1
  216. package/dist/components/demos/MapComponentDemo.cjs +0 -129
  217. package/dist/components/demos/MapComponentDemo.cjs.map +0 -1
  218. package/dist/components/demos/MapComponentDemo.d.cts +0 -5
  219. package/dist/components/demos/MapComponentDemo.d.ts +0 -5
  220. package/dist/components/demos/MapComponentDemo.js +0 -107
  221. package/dist/components/demos/MapComponentDemo.js.map +0 -1
  222. package/dist/components/demos/PlacesQueryInputDemo.cjs +0 -341
  223. package/dist/components/demos/PlacesQueryInputDemo.cjs.map +0 -1
  224. package/dist/components/demos/PlacesQueryInputDemo.d.cts +0 -5
  225. package/dist/components/demos/PlacesQueryInputDemo.d.ts +0 -5
  226. package/dist/components/demos/PlacesQueryInputDemo.js +0 -309
  227. package/dist/components/demos/PlacesQueryInputDemo.js.map +0 -1
  228. package/dist/components/demos/SelectDemo.cjs +0 -365
  229. package/dist/components/demos/SelectDemo.cjs.map +0 -1
  230. package/dist/components/demos/SelectDemo.d.cts +0 -5
  231. package/dist/components/demos/SelectDemo.d.ts +0 -5
  232. package/dist/components/demos/SelectDemo.js +0 -337
  233. package/dist/components/demos/SelectDemo.js.map +0 -1
  234. package/dist/components/demos/index.cjs +0 -1600
  235. package/dist/components/demos/index.cjs.map +0 -1
  236. package/dist/components/demos/index.d.cts +0 -5
  237. package/dist/components/demos/index.d.ts +0 -5
  238. package/dist/components/demos/index.js +0 -1574
  239. package/dist/components/demos/index.js.map +0 -1
package/dist/app/page.js DELETED
@@ -1,1581 +0,0 @@
1
- // src/components/demos/ComboboxDemo.tsx
2
- import { useState as useState2 } from "react";
3
-
4
- // src/components/ui/Combobox.tsx
5
- import { forwardRef as forwardRef7, useEffect, useState } from "react";
6
- import { ChevronDownIcon, CircleX, icons as icons2 } from "lucide-react";
7
- import { cva as cva2 } from "cva";
8
-
9
- // src/lib/utils.ts
10
- import { clsx } from "clsx";
11
- import { twMerge } from "tailwind-merge";
12
- function cn(...inputs) {
13
- return twMerge(clsx(inputs));
14
- }
15
-
16
- // src/components/primitives/command.tsx
17
- import { Command as CommandPrimitive } from "cmdk";
18
- import { Search } from "lucide-react";
19
- import * as React2 from "react";
20
-
21
- // src/components/primitives/dialog.tsx
22
- import * as DialogPrimitive from "@radix-ui/react-dialog";
23
- import { X } from "lucide-react";
24
- import * as React from "react";
25
- import { jsx, jsxs } from "react/jsx-runtime";
26
- var DialogPortal = DialogPrimitive.Portal;
27
- var DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
28
- DialogPrimitive.Overlay,
29
- {
30
- ref,
31
- className: cn(
32
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
33
- className
34
- ),
35
- ...props
36
- }
37
- ));
38
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
39
- var DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
40
- /* @__PURE__ */ jsx(DialogOverlay, {}),
41
- /* @__PURE__ */ jsxs(
42
- DialogPrimitive.Content,
43
- {
44
- ref,
45
- className: cn(
46
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-neutral-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-neutral-800 dark:bg-neutral-950",
47
- className
48
- ),
49
- ...props,
50
- children: [
51
- children,
52
- /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-500 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-400", children: [
53
- /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
54
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
55
- ] })
56
- ]
57
- }
58
- )
59
- ] }));
60
- DialogContent.displayName = DialogPrimitive.Content.displayName;
61
- var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
62
- DialogHeader.displayName = "DialogHeader";
63
- var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx(
64
- "div",
65
- {
66
- className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
67
- ...props
68
- }
69
- );
70
- DialogFooter.displayName = "DialogFooter";
71
- var DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
72
- DialogPrimitive.Title,
73
- {
74
- ref,
75
- className: cn("text-lg font-semibold leading-none tracking-tight", className),
76
- ...props
77
- }
78
- ));
79
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
80
- var DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
81
- DialogPrimitive.Description,
82
- {
83
- ref,
84
- className: cn("text-sm text-neutral-500 dark:text-neutral-400", className),
85
- ...props
86
- }
87
- ));
88
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
89
-
90
- // src/components/primitives/command.tsx
91
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
92
- var Command = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
93
- CommandPrimitive,
94
- {
95
- ref,
96
- className: cn(
97
- "flex h-full w-full flex-col overflow-hidden rounded-xl bg-white text-neutral-950",
98
- className
99
- ),
100
- ...props
101
- }
102
- ));
103
- Command.displayName = CommandPrimitive.displayName;
104
- var CommandInput = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs2("div", { className: "m-1 flex items-center rounded-xl border px-3", "cmdk-input-wrapper": "", children: [
105
- /* @__PURE__ */ jsx2(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
106
- /* @__PURE__ */ jsx2(
107
- CommandPrimitive.Input,
108
- {
109
- ref,
110
- className: cn(
111
- "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-neutral-500 disabled:cursor-not-allowed disabled:opacity-50",
112
- className
113
- ),
114
- ...props
115
- }
116
- )
117
- ] }));
118
- CommandInput.displayName = CommandPrimitive.Input.displayName;
119
- var CommandList = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
120
- CommandPrimitive.List,
121
- {
122
- ref,
123
- className: cn("overflow-y-auto overflow-x-hidden", className),
124
- ...props
125
- }
126
- ));
127
- CommandList.displayName = CommandPrimitive.List.displayName;
128
- var CommandEmpty = React2.forwardRef((props, ref) => /* @__PURE__ */ jsx2(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
129
- CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
130
- var CommandGroup = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
131
- CommandPrimitive.Group,
132
- {
133
- ref,
134
- className: cn(
135
- "overflow-hidden p-1 text-neutral-950 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-neutral-500",
136
- className
137
- ),
138
- ...props
139
- }
140
- ));
141
- CommandGroup.displayName = CommandPrimitive.Group.displayName;
142
- var CommandSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
143
- CommandPrimitive.Separator,
144
- {
145
- ref,
146
- className: cn("-mx-1 h-px bg-neutral-200", className),
147
- ...props
148
- }
149
- ));
150
- CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
151
- var CommandItem = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
152
- CommandPrimitive.Item,
153
- {
154
- ref,
155
- className: cn(
156
- "relative flex cursor-pointer select-none items-center rounded-xl px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-neutral-100 data-[selected=true]:text-neutral-900 data-[disabled=true]:opacity-50",
157
- className
158
- ),
159
- ...props
160
- }
161
- ));
162
- CommandItem.displayName = CommandPrimitive.Item.displayName;
163
- var CommandShortcut = ({ className, ...props }) => {
164
- return /* @__PURE__ */ jsx2(
165
- "span",
166
- {
167
- className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
168
- ...props
169
- }
170
- );
171
- };
172
- CommandShortcut.displayName = "CommandShortcut";
173
-
174
- // src/components/primitives/popover.tsx
175
- import * as React3 from "react";
176
- import * as PopoverPrimitive from "@radix-ui/react-popover";
177
- import { jsx as jsx3 } from "react/jsx-runtime";
178
- var Popover = PopoverPrimitive.Root;
179
- var PopoverTrigger = PopoverPrimitive.Trigger;
180
- var PopoverContent = React3.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx3(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx3(
181
- PopoverPrimitive.Content,
182
- {
183
- ref,
184
- align,
185
- sideOffset,
186
- className: cn(
187
- "z-50 rounded-2xl border bg-white p-4 text-black shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
188
- className
189
- ),
190
- ...props
191
- }
192
- ) }));
193
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
194
-
195
- // src/components/primitives/separator.tsx
196
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
197
- import * as React4 from "react";
198
- import { jsx as jsx4 } from "react/jsx-runtime";
199
- var Separator = React4.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx4(
200
- SeparatorPrimitive.Root,
201
- {
202
- ref,
203
- decorative,
204
- orientation,
205
- className: cn(
206
- "shrink-0 bg-grey-10",
207
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
208
- className
209
- ),
210
- ...props
211
- }
212
- ));
213
- Separator.displayName = SeparatorPrimitive.Root.displayName;
214
-
215
- // src/components/ui/ListItem.tsx
216
- import { CheckIcon } from "lucide-react";
217
-
218
- // src/components/ui/Checkbox.tsx
219
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
220
- import { Check, Minus } from "lucide-react";
221
- import {
222
- forwardRef as forwardRef5
223
- } from "react";
224
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
225
- var CheckboxToggle = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
226
- CheckboxPrimitive.Root,
227
- {
228
- ref,
229
- className: cn(
230
- "group",
231
- "peer",
232
- "h-5",
233
- "w-5",
234
- "shrink-0",
235
- "rounded-md",
236
- "border",
237
- "border-grey-10",
238
- "outline",
239
- "outline-1",
240
- "outline-offset-2",
241
- "outline-transparent",
242
- "hover:border-grey-20",
243
- "focus:outline-purple-100",
244
- "active:border-green-80",
245
- "disabled:cursor-not-allowed",
246
- "disabled:opacity-50",
247
- "data-[state=checked]:bg-green-80",
248
- "data-[state=indeterminate]:bg-green-80",
249
- "data-[state=checked]:text-white",
250
- "data-[state=indeterminate]:text-primary-foreground",
251
- props.disabled && "data-[state=checked]:text-foreground bg-grey-20 data-[state=checked]:bg-grey-20",
252
- className
253
- ),
254
- ...props,
255
- children: /* @__PURE__ */ jsxs3(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: [
256
- /* @__PURE__ */ jsx5(Check, { className: "hidden h-4 w-4 group-data-[state=checked]:block" }),
257
- /* @__PURE__ */ jsx5(Minus, { className: "hidden h-4 w-4 group-data-[state=indeterminate]:block" })
258
- ] })
259
- }
260
- ));
261
- CheckboxToggle.displayName = CheckboxPrimitive.Root.displayName;
262
- var Checkbox = forwardRef5(
263
- ({ classNames, children, ...props }, ref) => {
264
- const { disabled } = props;
265
- const id = props.id ?? `${props.name ?? props.value?.toString()}-checkbox`;
266
- const labelClassName = disabled ? "text-grey-40 pointer-events-none" : "";
267
- return /* @__PURE__ */ jsxs3("div", { className: cn("flex space-x-2", classNames?.wrapper), children: [
268
- /* @__PURE__ */ jsx5(CheckboxToggle, { id, disabled, ref, ...props }),
269
- /* @__PURE__ */ jsx5("label", { htmlFor: id, className: cn(labelClassName, classNames?.label), children })
270
- ] });
271
- }
272
- );
273
- Checkbox.displayName = "Checkbox";
274
- var Checkbox_default = Checkbox;
275
-
276
- // src/components/ui/ListItem.tsx
277
- import { icons } from "lucide-react";
278
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
279
- function ListItem({
280
- icon,
281
- hasCheckbox,
282
- isSelected,
283
- className,
284
- title,
285
- value,
286
- description,
287
- ...props
288
- }) {
289
- const getIconIfValid = (icon2) => {
290
- if (icon2 in icons) {
291
- const IconComponent = icons[icon2];
292
- return /* @__PURE__ */ jsx6(IconComponent, { size: 14 });
293
- }
294
- return null;
295
- };
296
- const optionIcon = icon ? getIconIfValid(icon) : void 0;
297
- return /* @__PURE__ */ jsxs4(
298
- "li",
299
- {
300
- className: cn(
301
- "group relative flex w-72 cursor-pointer flex-row items-center text-left text-sm",
302
- className
303
- ),
304
- ...props,
305
- "data-state": isSelected ? "checked" : "unchecked",
306
- children: [
307
- optionIcon && /* @__PURE__ */ jsx6("span", { className: "mr-2", children: optionIcon }),
308
- hasCheckbox && /* @__PURE__ */ jsx6(Checkbox_default, { id: value, checked: isSelected, onClick: (e) => e.preventDefault() }),
309
- /* @__PURE__ */ jsxs4("div", { children: [
310
- /* @__PURE__ */ jsx6("p", { children: title }),
311
- /* @__PURE__ */ jsx6("p", { className: "text-xs text-grey-80", children: description })
312
- ] }),
313
- /* @__PURE__ */ jsx6(
314
- CheckIcon,
315
- {
316
- className: "absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",
317
- size: 16
318
- }
319
- )
320
- ]
321
- }
322
- );
323
- }
324
- var ListItem_default = ListItem;
325
-
326
- // src/components/ui/Badge.tsx
327
- import { cva } from "cva";
328
- import { jsx as jsx7 } from "react/jsx-runtime";
329
- var badgeVariants = cva("rounded-full px-2 py-0.5 text-xs font-semibold", {
330
- variants: {
331
- variant: {
332
- green: "bg-green-90 text-white",
333
- pickle: "bg-pickle-100 text-black",
334
- purple: "bg-purple-100 text-white"
335
- }
336
- },
337
- defaultVariants: {
338
- variant: "green"
339
- }
340
- });
341
- function Badge({ className, variant, ...props }) {
342
- return /* @__PURE__ */ jsx7("div", { className: cn(badgeVariants({ variant }), className), ...props });
343
- }
344
-
345
- // src/components/primitives/tooltip.tsx
346
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
347
- import * as React5 from "react";
348
- import { jsx as jsx8 } from "react/jsx-runtime";
349
- var TooltipProvider = TooltipPrimitive.Provider;
350
- var Tooltip = TooltipPrimitive.Root;
351
- var TooltipTrigger = TooltipPrimitive.Trigger;
352
- var TooltipContent = React5.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx8(
353
- TooltipPrimitive.Content,
354
- {
355
- ref,
356
- sideOffset,
357
- className: cn(
358
- "z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
359
- className
360
- ),
361
- ...props
362
- }
363
- ));
364
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
365
-
366
- // src/components/ui/Label.tsx
367
- import { InfoIcon } from "lucide-react";
368
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
369
- function Label({ text, required, description, className, ...props }) {
370
- if (!text) return null;
371
- return /* @__PURE__ */ jsxs5("div", { className: "flex w-full flex-row gap-1", children: [
372
- /* @__PURE__ */ jsxs5(
373
- "label",
374
- {
375
- className: cn(
376
- "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
377
- className
378
- ),
379
- ...props,
380
- children: [
381
- text,
382
- required && /* @__PURE__ */ jsx9("span", { className: "text-red-600", children: "\xA0*" })
383
- ]
384
- }
385
- ),
386
- !!description && /* @__PURE__ */ jsx9(TooltipProvider, { children: /* @__PURE__ */ jsxs5(Tooltip, { children: [
387
- /* @__PURE__ */ jsx9(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx9(InfoIcon, { className: "h-4 w-4" }) }),
388
- /* @__PURE__ */ jsx9(TooltipContent, { className: "max-w-48", children: description })
389
- ] }) })
390
- ] });
391
- }
392
- var Label_default = Label;
393
-
394
- // src/components/ui/Combobox.tsx
395
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
396
- var Combobox = forwardRef7((props, ref) => {
397
- const {
398
- id,
399
- name,
400
- value,
401
- label,
402
- options,
403
- required,
404
- description,
405
- classNames,
406
- multiselect,
407
- placeholder,
408
- variant = "default",
409
- size,
410
- icon,
411
- className,
412
- onChange: handleChange,
413
- children: footer
414
- } = props;
415
- const [selected, setSelected] = useState([]);
416
- const [open, setOpen] = useState(false);
417
- const IconComponent = icon && icons2[icon];
418
- const hideSearchBox = options?.length <= 5;
419
- const isDefault = variant === "default";
420
- const isChip = variant === "chip";
421
- const isEmpty = selected.length == 0;
422
- const showChevron = isDefault ? isEmpty : true;
423
- const close = () => setOpen(false);
424
- useEffect(() => {
425
- const valueArray = multiselect ? value ?? [] : value ? [value] : [];
426
- setSelected(
427
- valueArray.map((v) => options.find((o) => o.value === v)).filter((v) => v !== void 0)
428
- );
429
- }, [value]);
430
- const handleSelect = (value2) => {
431
- const option = options.find((o) => o.value === value2);
432
- if (!option) return;
433
- if (multiselect) {
434
- return setSelected((prev) => {
435
- const newSelected = prev.some((o) => o.value === value2) ? prev.filter((v) => v !== option) : [...prev, option];
436
- handleChange?.(newSelected.map((o) => o.value));
437
- return newSelected;
438
- });
439
- }
440
- setSelected([option]);
441
- handleChange?.(option.value);
442
- close();
443
- };
444
- const handleClear = () => {
445
- setSelected([]);
446
- multiselect ? handleChange?.([]) : handleChange?.("");
447
- };
448
- const handleDisplayValue = () => {
449
- const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
450
- return isDefault ? defaultLabel : label;
451
- };
452
- return /* @__PURE__ */ jsxs6("div", { className: cn("flex flex-col gap-1", className), children: [
453
- isDefault && /* @__PURE__ */ jsx10(
454
- Label_default,
455
- {
456
- text: label,
457
- htmlFor: name,
458
- required,
459
- description,
460
- className: classNames?.label
461
- }
462
- ),
463
- /* @__PURE__ */ jsxs6("div", { className: "relative flex", children: [
464
- /* @__PURE__ */ jsxs6(Popover, { open, onOpenChange: setOpen, children: [
465
- /* @__PURE__ */ jsx10(
466
- PopoverTrigger,
467
- {
468
- asChild: true,
469
- disabled: options.length === 0,
470
- "data-testid": `${id ?? name}-combobox-trigger`,
471
- children: /* @__PURE__ */ jsxs6(
472
- "div",
473
- {
474
- ref,
475
- className: cn(
476
- triggerVariants({ variant, size }),
477
- isDefault && !isEmpty && "pr-10",
478
- classNames?.trigger
479
- ),
480
- "aria-expanded": open,
481
- children: [
482
- isDefault && IconComponent && /* @__PURE__ */ jsx10(IconComponent, { className: "h-4 w-4 shrink-0" }),
483
- isChip && !isEmpty && /* @__PURE__ */ jsx10(Badge, { variant: "purple", children: selected.length }),
484
- /* @__PURE__ */ jsx10(
485
- "span",
486
- {
487
- className: cn(
488
- "w-full truncate leading-normal",
489
- isDefault && isEmpty && "text-grey-40"
490
- ),
491
- children: handleDisplayValue()
492
- }
493
- ),
494
- showChevron && /* @__PURE__ */ jsx10(
495
- ChevronDownIcon,
496
- {
497
- className: "shrink-0 transform group-data-[state=open]:rotate-180",
498
- size: "16"
499
- }
500
- )
501
- ]
502
- }
503
- )
504
- }
505
- ),
506
- /* @__PURE__ */ jsx10(
507
- PopoverContent,
508
- {
509
- className: cn(
510
- "flex w-full max-w-xs flex-col overflow-hidden p-0",
511
- "max-h-[--radix-popover-content-available-height]",
512
- classNames?.content
513
- ),
514
- collisionPadding: 8,
515
- sideOffset: 4,
516
- align: "start",
517
- children: /* @__PURE__ */ jsxs6(Command, { children: [
518
- !hideSearchBox && /* @__PURE__ */ jsx10(CommandInput, { placeholder: "Search..." }),
519
- /* @__PURE__ */ jsxs6(CommandList, { children: [
520
- /* @__PURE__ */ jsx10(CommandEmpty, { children: "No results" }),
521
- /* @__PURE__ */ jsx10(CommandGroup, { children: options.map(({ id: id2, ...option }) => /* @__PURE__ */ jsx10(
522
- CommandItem,
523
- {
524
- value: option.title,
525
- onSelect: () => handleSelect(option.value),
526
- children: /* @__PURE__ */ jsx10(
527
- ListItem_default,
528
- {
529
- className: cn(classNames?.items, "truncate py-1"),
530
- isSelected: selected.some((s) => s.value === option.value),
531
- hasCheckbox: multiselect,
532
- ...option
533
- }
534
- )
535
- },
536
- id2
537
- )) })
538
- ] }),
539
- !!footer && /* @__PURE__ */ jsx10(Separator, {}),
540
- footer && footer({ close })
541
- ] })
542
- }
543
- )
544
- ] }),
545
- isDefault && !isEmpty && /* @__PURE__ */ jsx10(
546
- "button",
547
- {
548
- type: "button",
549
- className: "absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
550
- onClick: handleClear,
551
- children: /* @__PURE__ */ jsx10(CircleX, { className: "h-4 w-4 text-green-100" })
552
- }
553
- )
554
- ] })
555
- ] });
556
- });
557
- Combobox.displayName = "Combobox";
558
- var triggerVariants = cva2(
559
- "group relative cursor-pointer text-green-100 flex flex-row items-center justify-between gap-2 border border-grey-20 focus:outline-green-80 disabled:bg-grey-5",
560
- {
561
- variants: {
562
- variant: {
563
- default: ["w-full", "rounded-lg"],
564
- chip: [
565
- "font-bold",
566
- "rounded-3xl",
567
- "data-[state=open]:bg-black",
568
- "data-[state=open]:text-white"
569
- ]
570
- },
571
- size: {
572
- small: ["h-8", "py-1", "px-2", "text-xs"],
573
- normal: ["h-9", "py-2", "px-3", "text-sm"],
574
- large: ["h-10", "py-3", "px-4", "text-base"]
575
- }
576
- },
577
- defaultVariants: {
578
- variant: "default",
579
- size: "normal"
580
- }
581
- }
582
- );
583
-
584
- // src/components/ui/Button.tsx
585
- import { Slot } from "@radix-ui/react-slot";
586
- import { cva as cva3 } from "cva";
587
- import { forwardRef as forwardRef8 } from "react";
588
- import { jsx as jsx11 } from "react/jsx-runtime";
589
- var Button = forwardRef8(
590
- ({ className, variant, size, asChild = false, ...props }, ref) => {
591
- const Component = asChild ? Slot : "button";
592
- return /* @__PURE__ */ jsx11(
593
- Component,
594
- {
595
- className: cn(buttonVariants({ variant, size, className })),
596
- ref,
597
- ...props
598
- }
599
- );
600
- }
601
- );
602
- Button.displayName = "Button";
603
- var buttonVariants = cva3(
604
- [
605
- "flex",
606
- "items-center",
607
- "justify-center",
608
- "gap-2",
609
- "rounded-full",
610
- "font-bold",
611
- "outline-2",
612
- "outline-offset-2",
613
- "outline-dashed",
614
- "outline-transparent"
615
- ],
616
- {
617
- variants: {
618
- variant: {
619
- neutral: [
620
- "bg-black",
621
- "text-white",
622
- "hover:bg-grey-90",
623
- "active:bg-grey-80",
624
- "focus:outline-purple-100",
625
- "disabled:text-grey-40",
626
- "disabled:bg-grey-10"
627
- ],
628
- primary: [
629
- "bg-pickle-100",
630
- "text-black",
631
- "hover:bg-pickle-80",
632
- "active:bg-pickle-60",
633
- "focus:outline-purple-100",
634
- "disabled:text-grey-40",
635
- "disabled:bg-grey-10"
636
- ],
637
- secondary: [
638
- "bg-green-80",
639
- "text-white",
640
- "hover:bg-green-90",
641
- "active:bg-green-100",
642
- "focus:outline-pickle-100",
643
- "disabled:text-grey-40",
644
- "disabled:bg-grey-10"
645
- ],
646
- transparent: [
647
- "text-white",
648
- "hover:bg-green-80",
649
- "active:bg-green-100",
650
- "focus:outline-pickle-100",
651
- "disabled:text-grey-40"
652
- ],
653
- link: [
654
- "leading-tight",
655
- "text-black",
656
- "underline",
657
- "hover:text-purple-100",
658
- "focus:text-black",
659
- "focus:outline-purple-100",
660
- "active:text-purple-80"
661
- ]
662
- },
663
- size: {
664
- small: ["h-10", "text-sm", "px-4", "py-2"],
665
- medium: ["h-12", "text-base", "px-6", "py-3"],
666
- large: ["h-14", "text-lg", "px-8", "py-4"]
667
- }
668
- },
669
- defaultVariants: {
670
- variant: "neutral",
671
- size: "medium"
672
- },
673
- compoundVariants: [
674
- {
675
- variant: "link",
676
- size: "small",
677
- class: ["h-3", "text-xs", "p-0"]
678
- },
679
- {
680
- variant: "link",
681
- size: "medium",
682
- class: ["h-4", "text-sm", "p-0"]
683
- },
684
- {
685
- variant: "link",
686
- size: "large",
687
- class: ["h-6", "text-base", "p-0"]
688
- }
689
- ]
690
- }
691
- );
692
-
693
- // src/components/demos/ComboboxDemo.tsx
694
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
695
- function ComboboxDemo() {
696
- const [selectedBands, setSelectedBands] = useState2([]);
697
- const [selectedFruit, setSelectedFruit] = useState2("");
698
- const bands = [
699
- {
700
- title: "Nirvana",
701
- value: "Nirvana",
702
- description: "Come As You Are",
703
- id: "1"
704
- },
705
- { title: "Pearl Jam", value: "Pearl Jam", description: "Jeremy", id: "2" },
706
- {
707
- title: "Soundgarden",
708
- value: "Soundgarden",
709
- description: "Rusty Cage",
710
- id: "3"
711
- },
712
- {
713
- title: "Alice in Chains",
714
- value: "Alice in Chains",
715
- description: "Would?",
716
- id: "4"
717
- },
718
- { title: "Stone Temple Pilots", value: "Stone Temple Pilots", id: "5" },
719
- { title: "Hole", value: "Hole", id: "6" },
720
- { title: "Mudhoney", value: "Mudhoney", id: "7" },
721
- { title: "Screaming Trees", value: "Screaming Trees", id: "8" },
722
- { title: "L7", value: "L7", id: "9" },
723
- { title: "Sonic Youth", value: "Sonic Youth", id: "10" },
724
- {
725
- title: "And You Will Know Us by the Trail of Dead",
726
- value: "And You Will Know Us by the Trail of Dead",
727
- id: "11"
728
- }
729
- ];
730
- const fruits = [
731
- { title: "Cherry", value: "Cherry", id: "1", icon: "Cherry" },
732
- { title: "Grape", value: "Grape", id: "2", icon: "Grape" }
733
- ];
734
- return /* @__PURE__ */ jsxs7("div", { className: "flex max-w-sm flex-col flex-wrap gap-4 p-4", children: [
735
- /* @__PURE__ */ jsx12(
736
- Combobox,
737
- {
738
- required: true,
739
- label: "US bands from the 90's",
740
- placeholder: "Select a band",
741
- icon: "Music",
742
- options: bands,
743
- id: "bands",
744
- multiselect: true,
745
- description: "This is a tooltip",
746
- onChange: setSelectedBands,
747
- value: selectedBands
748
- }
749
- ),
750
- /* @__PURE__ */ jsx12(
751
- Combobox,
752
- {
753
- label: "US bands from the 90's",
754
- options: bands,
755
- variant: "chip",
756
- multiselect: true,
757
- name: "bands 2",
758
- onChange: setSelectedBands,
759
- value: selectedBands
760
- }
761
- ),
762
- /* @__PURE__ */ jsx12(
763
- Combobox,
764
- {
765
- label: "Fruit label",
766
- variant: "chip",
767
- options: fruits,
768
- value: selectedFruit,
769
- onChange: setSelectedFruit,
770
- children: ({ close }) => /* @__PURE__ */ jsxs7("div", { className: "flex flex-row items-center justify-between bg-white p-2 pl-4", children: [
771
- /* @__PURE__ */ jsx12(Button, { variant: "link", tabIndex: -1, onClick: close, children: "Clear" }),
772
- /* @__PURE__ */ jsx12(Button, { variant: "primary", size: "small", tabIndex: -1, children: "Apply" })
773
- ] })
774
- }
775
- ),
776
- selectedBands.map((band) => /* @__PURE__ */ jsx12("span", { className: "text-green-80", children: band }, band)),
777
- /* @__PURE__ */ jsx12("span", { className: "text-purple-100", children: selectedFruit })
778
- ] });
779
- }
780
- var ComboboxDemo_default = ComboboxDemo;
781
-
782
- // src/components/ui/Select.tsx
783
- import * as SelectPrimitive from "@radix-ui/react-select";
784
- import { CheckIcon as CheckIcon2, ChevronDownIcon as ChevronDownIcon2, X as X2 } from "lucide-react";
785
- import {
786
- forwardRef as forwardRef9,
787
- useEffect as useEffect2,
788
- useRef,
789
- useState as useState3
790
- } from "react";
791
-
792
- // src/components/ui/ErrorMessage.tsx
793
- import { jsx as jsx13 } from "react/jsx-runtime";
794
- function ErrorMessage({ message, className, ...props }) {
795
- if (!message) return null;
796
- return /* @__PURE__ */ jsx13("p", { className: cn("px-1 text-xs text-red-600", className), ...props, children: message });
797
- }
798
- var ErrorMessage_default = ErrorMessage;
799
-
800
- // src/components/ui/Chip.tsx
801
- import { cva as cva4 } from "cva";
802
- import { twMerge as twMerge2 } from "tailwind-merge";
803
- import { jsx as jsx14 } from "react/jsx-runtime";
804
- var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ jsx14("div", { className: twMerge2(chipVariants({ variant, size, className })), ...props });
805
- var chipVariants = cva4(["flex", "items-center", "rounded-3xl", "border", "w-fit"], {
806
- variants: {
807
- variant: {
808
- neutral: ["text-grey-80", "border-grey-10"],
809
- primary: ["text-purple-100", "border-purple-20"],
810
- danger: ["text-pumpkin-100", "border-pumpkin-20"],
811
- onboarding: ["text-green-100", "bg-green-10", "cursor-pointer"],
812
- onboardingSelected: ["text-white", "bg-green-90", "cursor-pointer"]
813
- },
814
- size: {
815
- small: ["text-sm", "leading-5", "px-2", "py-1", "gap-1.5"],
816
- medium: ["text-base", "leading-6", "px-3", "py-2", "gap-2"]
817
- }
818
- },
819
- defaultVariants: {
820
- variant: "neutral",
821
- size: "medium"
822
- }
823
- });
824
- var Chip_default = Chip;
825
-
826
- // src/components/ui/Select.tsx
827
- import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
828
- var Select = forwardRef9(
829
- ({ label, options, placeholder, multiselect, description, classNames, error, id, ...props }, ref) => {
830
- const { value, defaultValue, dir, className, onChange, ...rest } = props;
831
- const [selected, setSelected] = useState3([]);
832
- const [open, setOpen] = useState3(false);
833
- const containerRef = useRef(null);
834
- useEffect2(() => {
835
- if (!value) return setSelected([]);
836
- setSelected(Array.isArray(value) ? value : [value]);
837
- }, [value]);
838
- const toggleOpen = () => setOpen((prev) => !prev);
839
- const closeOnEscape = (event) => event.key === "Escape" && setOpen(false);
840
- const setValueOnEnter = (event, value2) => event.key === "Enter" && handleChange(value2);
841
- const chipLabels = selected?.map((s) => options?.find(({ value: value2 }) => value2 === s)).filter(Boolean);
842
- function handleLabels() {
843
- if (multiselect) {
844
- return selected.map((o) => options?.find((option) => option.value === o)?.title).join(", ");
845
- }
846
- return options?.find((option) => option.value === selected.join())?.title;
847
- }
848
- function handleOnOpenChange(isOpen) {
849
- if (!multiselect || isOpen) setOpen(isOpen);
850
- }
851
- function handleChange(newValue) {
852
- let newSelected = [];
853
- setSelected((prev) => {
854
- newSelected = prev.includes(newValue) ? prev.filter((item) => item !== newValue) : [...prev, newValue];
855
- return multiselect ? newSelected : [newValue];
856
- });
857
- onChange?.(multiselect ? newSelected : newValue);
858
- }
859
- return /* @__PURE__ */ jsxs8(
860
- "div",
861
- {
862
- className: cn("flex w-full flex-col gap-1", className),
863
- ref: containerRef,
864
- "data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
865
- children: [
866
- /* @__PURE__ */ jsx15(
867
- Label_default,
868
- {
869
- text: label,
870
- htmlFor: props.name,
871
- required: props.required,
872
- description,
873
- className: classNames?.label
874
- }
875
- ),
876
- /* @__PURE__ */ jsxs8(
877
- SelectPrimitive.Root,
878
- {
879
- open,
880
- value: selected.join(","),
881
- onOpenChange: handleOnOpenChange,
882
- onValueChange: multiselect ? void 0 : handleChange,
883
- defaultValue: typeof defaultValue === "string" ? defaultValue : void 0,
884
- dir: dir === "rtl" ? "rtl" : "ltr",
885
- ...rest,
886
- children: [
887
- /* @__PURE__ */ jsxs8(
888
- SelectPrimitive.Trigger,
889
- {
890
- ref,
891
- className: cn(
892
- "group flex h-11 w-full flex-row items-center justify-between gap-3 rounded-lg border px-4 py-3 text-sm font-normal focus:outline-purple-100 disabled:bg-grey-5 data-[placeholder]:text-grey-50 data-[placeholder]:disabled:text-grey-40",
893
- classNames?.trigger
894
- ),
895
- children: [
896
- /* @__PURE__ */ jsx15("span", { className: "truncate", children: /* @__PURE__ */ jsx15(
897
- SelectPrimitive.Value,
898
- {
899
- placeholder: placeholder ?? "Select an option",
900
- "aria-label": handleLabels(),
901
- children: handleLabels()
902
- }
903
- ) }),
904
- /* @__PURE__ */ jsx15(
905
- ChevronDownIcon2,
906
- {
907
- className: "transform text-black group-data-[state=open]:rotate-180",
908
- size: "16"
909
- }
910
- )
911
- ]
912
- }
913
- ),
914
- /* @__PURE__ */ jsx15(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ jsx15(
915
- SelectPrimitive.Content,
916
- {
917
- hideWhenDetached: true,
918
- className: "z-10 max-h-[var(--radix-select-content-available-height)] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-md bg-white py-2 shadow-lg",
919
- position: "popper",
920
- sideOffset: 4,
921
- onPointerDownOutside: toggleOpen,
922
- onKeyDown: closeOnEscape,
923
- children: /* @__PURE__ */ jsxs8(SelectPrimitive.Viewport, { children: [
924
- multiselect && !!chipLabels?.length && /* @__PURE__ */ jsx15(
925
- SelectPrimitive.Group,
926
- {
927
- className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
928
- "data-testid": "selected-labels",
929
- children: chipLabels?.map(
930
- (chip) => chip && /* @__PURE__ */ jsxs8(Chip_default, { size: "small", variant: "primary", children: [
931
- /* @__PURE__ */ jsx15("span", { children: chip.title }),
932
- /* @__PURE__ */ jsx15(
933
- X2,
934
- {
935
- size: 18,
936
- "data-testid": `chip-remove-${chip.value}`,
937
- className: "cursor-pointer",
938
- onClick: () => handleChange(chip.value)
939
- }
940
- )
941
- ] }, chip.title)
942
- )
943
- }
944
- ),
945
- /* @__PURE__ */ jsx15(Separator, {}),
946
- options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs8(
947
- SelectPrimitive.Item,
948
- {
949
- value: value2,
950
- className: "group relative cursor-pointer px-4 py-2 text-left text-sm hover:bg-purple-50 focus:bg-purple-50 focus:outline-none data-[state=checked]:bg-purple-50 data-[state=checked]:pr-10 data-[state=checked]:text-purple-100",
951
- "data-state": selected.includes(value2) ? "checked" : "unchecked",
952
- onKeyDown: (e) => setValueOnEnter(e, value2),
953
- onClick: () => handleChange(value2),
954
- children: [
955
- /* @__PURE__ */ jsx15(SelectPrimitive.ItemText, { children: title }),
956
- /* @__PURE__ */ jsx15(
957
- CheckIcon2,
958
- {
959
- className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
960
- size: 16
961
- }
962
- )
963
- ]
964
- },
965
- id2
966
- ))
967
- ] })
968
- }
969
- ) })
970
- ]
971
- }
972
- ),
973
- /* @__PURE__ */ jsx15(ErrorMessage_default, { message: error })
974
- ]
975
- }
976
- );
977
- }
978
- );
979
- Select.displayName = "Select";
980
- var Select_default = Select;
981
-
982
- // src/components/demos/SelectDemo.tsx
983
- import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
984
- function SelectDemo() {
985
- return /* @__PURE__ */ jsxs9("div", { className: "m-4", children: [
986
- /* @__PURE__ */ jsx16("h3", { children: "Select" }),
987
- /* @__PURE__ */ jsxs9("div", { className: "mt-2 flex max-w-sm flex-col gap-4", children: [
988
- /* @__PURE__ */ jsx16(
989
- Select_default,
990
- {
991
- required: true,
992
- label: "Label - Singleselect",
993
- placeholder: "Select an option",
994
- options: [
995
- { id: "1", value: "1", title: "Option 1" },
996
- { id: "2", value: "2", title: "Option 2" },
997
- { id: "3", value: "3", title: "Option 3" }
998
- ]
999
- }
1000
- ),
1001
- /* @__PURE__ */ jsx16(
1002
- Select_default,
1003
- {
1004
- multiselect: true,
1005
- label: "Label - Multiselect",
1006
- placeholder: "Select an option",
1007
- description: "This is a tooltip",
1008
- options: [
1009
- { id: "1", value: "1", title: "Option 1" },
1010
- { id: "2", value: "2", title: "Option 2" },
1011
- { id: "3", value: "3", title: "Option 3" },
1012
- { id: "4", value: "4", title: "Option 4" },
1013
- { id: "5", value: "5", title: "Option 5" },
1014
- { id: "6", value: "6", title: "Option 6" },
1015
- { id: "7", value: "7", title: "Option 7" },
1016
- { id: "8", value: "8", title: "Option 8" },
1017
- { id: "9", value: "9", title: "Option 9" },
1018
- { id: "10", value: "10", title: "Option 10" }
1019
- ]
1020
- }
1021
- ),
1022
- /* @__PURE__ */ jsx16(
1023
- Select_default,
1024
- {
1025
- disabled: true,
1026
- label: "Label - Disabled",
1027
- placeholder: "Select an option",
1028
- options: [
1029
- { id: "1", value: "1", title: "Option 1" },
1030
- { id: "2", value: "2", title: "Option 2" },
1031
- { id: "3", value: "3", title: "Option 3" }
1032
- ]
1033
- }
1034
- )
1035
- ] })
1036
- ] });
1037
- }
1038
- var SelectDemo_default = SelectDemo;
1039
-
1040
- // src/components/ui/Input.tsx
1041
- import { cva as cva5 } from "cva";
1042
- import { icons as icons3, X as X3 } from "lucide-react";
1043
- import { forwardRef as forwardRef10 } from "react";
1044
- import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
1045
- var Input = forwardRef10(
1046
- ({ label, error, description, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
1047
- const handleClear = () => {
1048
- onChange?.({ target: { value: "" } });
1049
- onClear?.();
1050
- };
1051
- const IconComponent = icon && icons3[icon];
1052
- const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
1053
- const hasIcon = !!icon;
1054
- const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
1055
- return /* @__PURE__ */ jsxs10("div", { className: "group flex w-full flex-col gap-1", "data-testid": `input-wrapper-${props.id}`, children: [
1056
- label && /* @__PURE__ */ jsx17(
1057
- Label_default,
1058
- {
1059
- text: label,
1060
- htmlFor: props.name,
1061
- required: props.required,
1062
- description,
1063
- className: classNames?.label
1064
- }
1065
- ),
1066
- /* @__PURE__ */ jsxs10("div", { className: "relative flex flex-row items-center", children: [
1067
- IconComponent && /* @__PURE__ */ jsx17(
1068
- IconComponent,
1069
- {
1070
- className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
1071
- }
1072
- ),
1073
- /* @__PURE__ */ jsx17(
1074
- "input",
1075
- {
1076
- className: cn(inputVariants({ theme, hasIcon })),
1077
- ref,
1078
- placeholder,
1079
- value,
1080
- onChange,
1081
- "data-testid": `input-element-${props.id}`,
1082
- ...props
1083
- }
1084
- ),
1085
- hasIcon && value && /* @__PURE__ */ jsx17(
1086
- X3,
1087
- {
1088
- className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
1089
- onClick: handleClear,
1090
- "data-testid": "clear-button"
1091
- }
1092
- )
1093
- ] }),
1094
- /* @__PURE__ */ jsx17(ErrorMessage_default, { message: error })
1095
- ] });
1096
- }
1097
- );
1098
- Input.displayName = "Input";
1099
- var inputVariants = cva5(
1100
- [
1101
- "border-input",
1102
- "placeholder:text-muted-foreground",
1103
- "focus-visible:ring-ring",
1104
- "inline-flex",
1105
- "w-full",
1106
- "h-11",
1107
- "items-center",
1108
- "justify-start",
1109
- "gap-3",
1110
- "rounded-lg",
1111
- "bg-transparent",
1112
- "px-3",
1113
- "pt-0.5",
1114
- "text-sm",
1115
- "shadow-sm",
1116
- "ring-grey-50",
1117
- "transition-colors",
1118
- "focus-visible:outline-none",
1119
- "focus-visible:ring-1",
1120
- "disabled:cursor-not-allowed",
1121
- "disabled:opacity-50",
1122
- "appearance-none",
1123
- "[&::-webkit-search-cancel-button]:appearance-none",
1124
- "[&::-webkit-search-decoration]:appearance-none",
1125
- "[&::-webkit-search-results-button]:appearance-none",
1126
- "[&::-webkit-search-results-decoration]:appearance-none",
1127
- "[&::-ms-clear]:display-none",
1128
- "[&::-ms-reveal]:display-none"
1129
- ],
1130
- {
1131
- variants: {
1132
- theme: {
1133
- light: "text-grey-80 border",
1134
- dark: "text-white"
1135
- },
1136
- hasIcon: {
1137
- false: "pl-3",
1138
- true: "pl-8"
1139
- }
1140
- },
1141
- defaultVariants: {
1142
- theme: "light",
1143
- hasIcon: false
1144
- }
1145
- }
1146
- );
1147
- var Input_default = Input;
1148
-
1149
- // src/components/demos/InputDemo.tsx
1150
- import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
1151
- function InputDemo() {
1152
- return /* @__PURE__ */ jsxs11("div", { className: "m-4", children: [
1153
- /* @__PURE__ */ jsx18("h3", { children: "Input" }),
1154
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 md:flex-row", children: [
1155
- /* @__PURE__ */ jsx18("div", { className: "bg-green-80 p-2", children: /* @__PURE__ */ jsx18(Input_default, { theme: "dark", icon: "Search" }) }),
1156
- /* @__PURE__ */ jsx18("div", { className: "p-2", children: /* @__PURE__ */ jsx18(Input_default, { label: "Required input", required: true, description: "This is a tooltip" }) }),
1157
- /* @__PURE__ */ jsx18("div", { className: "p-2", children: /* @__PURE__ */ jsx18(Input_default, { icon: "MapPin" }) })
1158
- ] })
1159
- ] });
1160
- }
1161
- var InputDemo_default = InputDemo;
1162
-
1163
- // src/components/ui/Counter.tsx
1164
- import { cva as cva6 } from "cva";
1165
- import { Minus as Minus2, Plus } from "lucide-react";
1166
- import { forwardRef as forwardRef11, useEffect as useEffect3, useState as useState4 } from "react";
1167
- import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
1168
- var Counter = forwardRef11(
1169
- ({ label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props }, ref) => {
1170
- const [count, setCount] = useState4(0);
1171
- useEffect3(() => {
1172
- setCount(value ?? 0);
1173
- }, [value]);
1174
- const handleChange = (e) => {
1175
- const newValue = parseInt(e.target.value.replace(/\D/g, ""), 10);
1176
- if (isNaN(newValue)) return;
1177
- if (min && newValue < min) {
1178
- onChange?.(min);
1179
- setCount(min);
1180
- return;
1181
- }
1182
- if (max && newValue > max) {
1183
- onChange?.(max);
1184
- setCount(max);
1185
- return;
1186
- }
1187
- onChange?.(newValue);
1188
- setCount(newValue);
1189
- };
1190
- const decrement = () => {
1191
- const proposedValue = count - step;
1192
- const newValue = Math.max(min ?? -Infinity, proposedValue);
1193
- onChange?.(newValue);
1194
- setCount(newValue);
1195
- };
1196
- const increment = () => {
1197
- const proposedValue = count + step;
1198
- const newValue = Math.min(max ?? Infinity, proposedValue);
1199
- onChange?.(newValue);
1200
- setCount(newValue);
1201
- };
1202
- return /* @__PURE__ */ jsxs12(
1203
- "div",
1204
- {
1205
- className: cn("flex w-auto flex-col gap-1", classNames?.root),
1206
- "data-testid": `counter-wrapper-${props.id}`,
1207
- children: [
1208
- label && /* @__PURE__ */ jsx19(
1209
- Label_default,
1210
- {
1211
- text: label,
1212
- htmlFor: props.name,
1213
- required: props.required,
1214
- description,
1215
- className: classNames?.label
1216
- }
1217
- ),
1218
- /* @__PURE__ */ jsxs12("div", { className: "relative flex w-[122px] flex-row items-center", children: [
1219
- /* @__PURE__ */ jsx19(
1220
- "button",
1221
- {
1222
- type: "button",
1223
- className: "absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
1224
- onClick: decrement,
1225
- children: /* @__PURE__ */ jsx19(Minus2, { className: "h-4 w-4 text-green-100" })
1226
- }
1227
- ),
1228
- /* @__PURE__ */ jsx19(
1229
- "input",
1230
- {
1231
- className: cn(counterVariants({ theme }), classNames?.input),
1232
- ref,
1233
- value: count,
1234
- onChange: handleChange,
1235
- "data-testid": `counter-element-${props.id}`,
1236
- ...props
1237
- }
1238
- ),
1239
- /* @__PURE__ */ jsx19(
1240
- "button",
1241
- {
1242
- type: "button",
1243
- className: "absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
1244
- onClick: increment,
1245
- children: /* @__PURE__ */ jsx19(Plus, { className: "h-4 w-4 text-green-100" })
1246
- }
1247
- )
1248
- ] }),
1249
- /* @__PURE__ */ jsx19(ErrorMessage_default, { message: error })
1250
- ]
1251
- }
1252
- );
1253
- }
1254
- );
1255
- Counter.displayName = "Counter";
1256
- var counterVariants = cva6(
1257
- [
1258
- "border-input",
1259
- "placeholder:text-muted-foreground",
1260
- "focus-visible:ring-ring",
1261
- "inline-flex",
1262
- "w-[122px]",
1263
- "h-11",
1264
- "items-center",
1265
- "justify-start",
1266
- "gap-3",
1267
- "rounded-lg",
1268
- "bg-transparent",
1269
- "px-3",
1270
- "pt-0.5",
1271
- "text-sm",
1272
- "text-center",
1273
- "shadow-sm",
1274
- "ring-grey-50",
1275
- "transition-colors",
1276
- "focus-visible:outline-none",
1277
- "focus-visible:ring-1",
1278
- "disabled:cursor-not-allowed",
1279
- "disabled:opacity-50",
1280
- "appearance-none",
1281
- "[&::-webkit-search-cancel-button]:appearance-none",
1282
- "[&::-webkit-search-decoration]:appearance-none",
1283
- "[&::-webkit-search-results-button]:appearance-none",
1284
- "[&::-webkit-search-results-decoration]:appearance-none",
1285
- "[&::-ms-clear]:display-none",
1286
- "[&::-ms-reveal]:display-none"
1287
- ],
1288
- {
1289
- variants: {
1290
- theme: {
1291
- light: "text-grey-80 border",
1292
- dark: "text-white"
1293
- },
1294
- hasIcon: {
1295
- false: "pl-3",
1296
- true: "pl-8"
1297
- }
1298
- },
1299
- defaultVariants: {
1300
- theme: "light",
1301
- hasIcon: false
1302
- }
1303
- }
1304
- );
1305
-
1306
- // src/components/demos/CounterDemo.tsx
1307
- import { useState as useState5 } from "react";
1308
- import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
1309
- function CounterDemo() {
1310
- const [count, setCount] = useState5(0);
1311
- return /* @__PURE__ */ jsxs13("div", { className: "m-4", children: [
1312
- /* @__PURE__ */ jsx20("h3", { children: "Counter" }),
1313
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2 md:flex-row", children: [
1314
- /* @__PURE__ */ jsx20("div", { className: "p-2", children: /* @__PURE__ */ jsx20(
1315
- Counter,
1316
- {
1317
- label: "Required Counter",
1318
- required: true,
1319
- value: count,
1320
- onChange: setCount,
1321
- description: "This is a tooltip"
1322
- }
1323
- ) }),
1324
- /* @__PURE__ */ jsx20("div", { className: "p-2", children: /* @__PURE__ */ jsx20(Counter, { min: 0, max: 10, step: 2 }) })
1325
- ] })
1326
- ] });
1327
- }
1328
- var CounterDemo_default = CounterDemo;
1329
-
1330
- // src/lib/google.ts
1331
- import { Client, PlaceAutocompleteType } from "@googlemaps/google-maps-services-js";
1332
- var client = new Client();
1333
- var autocomplete = async (input, key) => {
1334
- try {
1335
- const response = await client.placeAutocomplete({
1336
- params: { input, key, types: PlaceAutocompleteType.address }
1337
- });
1338
- return response.data.predictions;
1339
- } catch (error) {
1340
- console.error(error);
1341
- }
1342
- };
1343
- var fetchLocation = async (place, key) => {
1344
- try {
1345
- if (place.place_id) {
1346
- const placeDetails = await getPlaceDetails(place.place_id, key);
1347
- if (placeDetails) return placeDetails;
1348
- }
1349
- if (place.address) {
1350
- const result = await geocode(place.address, key);
1351
- const firstAddress = result?.[0];
1352
- return firstAddress;
1353
- }
1354
- return void 0;
1355
- } catch (error) {
1356
- console.error("Error fetching location:", error);
1357
- }
1358
- };
1359
- var getPlaceDetails = async (place_id, key) => {
1360
- try {
1361
- const response = await client.placeDetails({
1362
- params: { place_id, key }
1363
- });
1364
- return response.data.result;
1365
- } catch (error) {
1366
- console.error(error);
1367
- }
1368
- };
1369
- var geocode = async (address, key) => {
1370
- try {
1371
- const response = await client.geocode({
1372
- params: { address, key }
1373
- });
1374
- return response.data.results;
1375
- } catch (error) {
1376
- console.error(error);
1377
- }
1378
- };
1379
-
1380
- // src/components/ui/PlacesQueryInput.tsx
1381
- import { CircleX as CircleX2, LoaderCircle } from "lucide-react";
1382
- import { useState as useState6, useCallback, useRef as useRef2, useEffect as useEffect4 } from "react";
1383
- import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
1384
- function PlacesQueryInput({
1385
- apiKey,
1386
- selected,
1387
- onSelect,
1388
- className
1389
- }) {
1390
- const [predictions, setPredictions] = useState6(null);
1391
- const [input, setInput] = useState6(selected?.description ?? "");
1392
- const [isLoadingPredictions, setIsLoadingPredictions] = useState6(false);
1393
- const [shouldOpenUpward, setShouldOpenUpward] = useState6(false);
1394
- const timeoutRef = useRef2(null);
1395
- const inputRef = useRef2(null);
1396
- const debouncedAutocomplete = useCallback((value) => {
1397
- if (timeoutRef.current) {
1398
- clearTimeout(timeoutRef.current);
1399
- }
1400
- timeoutRef.current = setTimeout(async () => {
1401
- if (value.length > 2) {
1402
- setIsLoadingPredictions(true);
1403
- const fetchedPredictions = await autocomplete(value, apiKey);
1404
- fetchedPredictions && setIsLoadingPredictions(false);
1405
- setPredictions(fetchedPredictions ?? []);
1406
- } else {
1407
- setPredictions(null);
1408
- }
1409
- }, 300);
1410
- }, []);
1411
- const handleInputChange = (value) => {
1412
- setInput(value);
1413
- debouncedAutocomplete(value);
1414
- };
1415
- const handleSelect = (prediction) => {
1416
- onSelect(prediction);
1417
- setPredictions(null);
1418
- setInput(prediction.description);
1419
- };
1420
- const handleClear = () => {
1421
- onSelect();
1422
- setPredictions(null);
1423
- setInput("");
1424
- };
1425
- const handleBlur = () => setTimeout(() => setPredictions(null), 200);
1426
- useEffect4(() => {
1427
- const checkDropdownPosition = () => {
1428
- if (inputRef.current) {
1429
- const rect = inputRef.current.getBoundingClientRect();
1430
- const windowHeight = window.innerHeight;
1431
- setShouldOpenUpward(rect.bottom + 200 > windowHeight);
1432
- }
1433
- };
1434
- checkDropdownPosition();
1435
- window.addEventListener("resize", checkDropdownPosition);
1436
- return () => window.removeEventListener("resize", checkDropdownPosition);
1437
- }, []);
1438
- return /* @__PURE__ */ jsx21("div", { className: cn("relative w-full", className), ref: inputRef, onBlur: handleBlur, children: /* @__PURE__ */ jsxs14(Command, { children: [
1439
- /* @__PURE__ */ jsxs14("div", { className: "relative w-full", children: [
1440
- /* @__PURE__ */ jsx21(
1441
- CommandInput,
1442
- {
1443
- placeholder: "Type an address to search...",
1444
- value: input,
1445
- onValueChange: handleInputChange,
1446
- className: "truncate pr-8"
1447
- }
1448
- ),
1449
- isLoadingPredictions && /* @__PURE__ */ jsx21(LoaderCircle, { className: "absolute inset-y-0 right-2 my-auto flex h-8 w-8 animate-spin items-center justify-center rounded-full text-green-100" }),
1450
- input && /* @__PURE__ */ jsx21(
1451
- "button",
1452
- {
1453
- type: "button",
1454
- className: "absolute inset-y-0 right-2 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
1455
- onClick: handleClear,
1456
- children: /* @__PURE__ */ jsx21(CircleX2, { className: "h-4 w-4 text-green-100" })
1457
- }
1458
- )
1459
- ] }),
1460
- predictions && /* @__PURE__ */ jsxs14(
1461
- CommandList,
1462
- {
1463
- className: cn(
1464
- "absolute z-50 w-full rounded-md border bg-white shadow-lg",
1465
- shouldOpenUpward ? "bottom-full" : "top-full"
1466
- ),
1467
- children: [
1468
- /* @__PURE__ */ jsx21(CommandEmpty, { children: "No results" }),
1469
- /* @__PURE__ */ jsx21(CommandGroup, { children: predictions.map((prediction) => /* @__PURE__ */ jsx21(
1470
- CommandItem,
1471
- {
1472
- onSelect: () => handleSelect(prediction),
1473
- className: "truncate",
1474
- children: prediction.description
1475
- },
1476
- prediction.place_id
1477
- )) })
1478
- ]
1479
- }
1480
- )
1481
- ] }) });
1482
- }
1483
- var PlacesQueryInput_default = PlacesQueryInput;
1484
-
1485
- // src/components/demos/PlacesQueryInputDemo.tsx
1486
- import { useState as useState7 } from "react";
1487
- import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
1488
- function PlacesQueryInputDemo() {
1489
- const [selected, setSelected] = useState7();
1490
- return /* @__PURE__ */ jsxs15("div", { className: "flex h-24 flex-col p-4", children: [
1491
- /* @__PURE__ */ jsx22(
1492
- PlacesQueryInput_default,
1493
- {
1494
- className: "max-w-96",
1495
- apiKey: process.env.NEXT_PUBLIC_GOOGLE_API_KEY ?? "",
1496
- selected,
1497
- onSelect: setSelected
1498
- }
1499
- ),
1500
- /* @__PURE__ */ jsx22("h3", { className: "px-3", children: selected?.description })
1501
- ] });
1502
- }
1503
- var PlacesQueryInputDemo_default = PlacesQueryInputDemo;
1504
-
1505
- // src/components/ui/MapComponent.tsx
1506
- import { APIProvider, Map, AdvancedMarker, Pin } from "@vis.gl/react-google-maps";
1507
- import { jsx as jsx23 } from "react/jsx-runtime";
1508
- function MapComponent({ apiKey, mapId, position, className, zoom = 15 }) {
1509
- const defaultPosition = { lat: 40.715021, lng: -74.00459 };
1510
- const defaultZoom = 11;
1511
- return /* @__PURE__ */ jsx23(APIProvider, { apiKey, children: /* @__PURE__ */ jsx23("div", { className: cn("h-screen max-w-full", className), children: /* @__PURE__ */ jsx23(
1512
- Map,
1513
- {
1514
- zoom: position ? zoom : defaultZoom,
1515
- center: position || defaultPosition,
1516
- mapId,
1517
- keyboardShortcuts: false,
1518
- disableDefaultUI: true,
1519
- children: position && /* @__PURE__ */ jsx23(AdvancedMarker, { position, children: /* @__PURE__ */ jsx23(Pin, { background: "#0B5441", borderColor: "#EBFDF1", glyphColor: "#D4F500" }) })
1520
- }
1521
- ) }) });
1522
- }
1523
- var MapComponent_default = MapComponent;
1524
-
1525
- // src/components/demos/MapComponentDemo.tsx
1526
- import { useEffect as useEffect5, useState as useState8 } from "react";
1527
- import { jsx as jsx24 } from "react/jsx-runtime";
1528
- var API_KEY = process.env.NEXT_PUBLIC_GOOGLE_API_KEY ?? "";
1529
- var MAP_ID = process.env.NEXT_PUBLIC_GOOGLE_MAP_ID ?? "";
1530
- function MapComponentDemo() {
1531
- const [position, setPosition] = useState8();
1532
- const place = {
1533
- place_id: "ChIJaXQRs6lZwokRY6EFpJnhNNE",
1534
- // Empire State Building Place ID
1535
- address: "Empire State Building, New York, NY, USA"
1536
- };
1537
- useEffect5(() => {
1538
- fetchLocation(place, API_KEY).then((location) => {
1539
- if (location) {
1540
- const { lat, lng } = location.geometry?.location ?? {};
1541
- if (!lat || !lng) return;
1542
- setPosition({ lat, lng });
1543
- }
1544
- });
1545
- }, []);
1546
- return /* @__PURE__ */ jsx24(
1547
- MapComponent_default,
1548
- {
1549
- apiKey: API_KEY,
1550
- mapId: MAP_ID,
1551
- className: "h-[36rem] w-[36rem] p-4",
1552
- position
1553
- }
1554
- );
1555
- }
1556
- var MapComponentDemo_default = MapComponentDemo;
1557
-
1558
- // src/components/demos/index.tsx
1559
- import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
1560
- function Demos() {
1561
- return /* @__PURE__ */ jsxs16("div", { children: [
1562
- /* @__PURE__ */ jsx25(ComboboxDemo_default, {}),
1563
- /* @__PURE__ */ jsx25(SelectDemo_default, {}),
1564
- /* @__PURE__ */ jsx25(InputDemo_default, {}),
1565
- /* @__PURE__ */ jsx25(CounterDemo_default, {}),
1566
- /* @__PURE__ */ jsx25(PlacesQueryInputDemo_default, {}),
1567
- /* @__PURE__ */ jsx25(MapComponentDemo_default, {})
1568
- ] });
1569
- }
1570
- var demos_default = Demos;
1571
-
1572
- // src/app/page.tsx
1573
- import { jsx as jsx26 } from "react/jsx-runtime";
1574
- async function Page() {
1575
- return /* @__PURE__ */ jsx26(demos_default, {});
1576
- }
1577
- var page_default = Page;
1578
- export {
1579
- page_default as default
1580
- };
1581
- //# sourceMappingURL=page.js.map