@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
@@ -1,192 +0,0 @@
1
- // src/components/ui/Input.tsx
2
- import { cva } from "cva";
3
- import { icons, X } from "lucide-react";
4
- import { forwardRef as forwardRef2 } from "react";
5
-
6
- // src/lib/utils.ts
7
- import { clsx } from "clsx";
8
- import { twMerge } from "tailwind-merge";
9
- function cn(...inputs) {
10
- return twMerge(clsx(inputs));
11
- }
12
-
13
- // src/components/ui/ErrorMessage.tsx
14
- import { jsx } from "react/jsx-runtime";
15
- function ErrorMessage({ message, className, ...props }) {
16
- if (!message) return null;
17
- return /* @__PURE__ */ jsx("p", { className: cn("px-1 text-xs text-red-600", className), ...props, children: message });
18
- }
19
- var ErrorMessage_default = ErrorMessage;
20
-
21
- // src/components/primitives/tooltip.tsx
22
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
23
- import * as React from "react";
24
- import { jsx as jsx2 } from "react/jsx-runtime";
25
- var TooltipProvider = TooltipPrimitive.Provider;
26
- var Tooltip = TooltipPrimitive.Root;
27
- var TooltipTrigger = TooltipPrimitive.Trigger;
28
- var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx2(
29
- TooltipPrimitive.Content,
30
- {
31
- ref,
32
- sideOffset,
33
- className: cn(
34
- "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",
35
- className
36
- ),
37
- ...props
38
- }
39
- ));
40
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
41
-
42
- // src/components/ui/Label.tsx
43
- import { InfoIcon } from "lucide-react";
44
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
45
- function Label({ text, required, description, className, ...props }) {
46
- if (!text) return null;
47
- return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-row gap-1", children: [
48
- /* @__PURE__ */ jsxs(
49
- "label",
50
- {
51
- className: cn(
52
- "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
53
- className
54
- ),
55
- ...props,
56
- children: [
57
- text,
58
- required && /* @__PURE__ */ jsx3("span", { className: "text-red-600", children: "\xA0*" })
59
- ]
60
- }
61
- ),
62
- !!description && /* @__PURE__ */ jsx3(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
63
- /* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx3(InfoIcon, { className: "h-4 w-4" }) }),
64
- /* @__PURE__ */ jsx3(TooltipContent, { className: "max-w-48", children: description })
65
- ] }) })
66
- ] });
67
- }
68
- var Label_default = Label;
69
-
70
- // src/components/ui/Input.tsx
71
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
72
- var Input = forwardRef2(
73
- ({ label, error, description, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
74
- const handleClear = () => {
75
- onChange?.({ target: { value: "" } });
76
- onClear?.();
77
- };
78
- const IconComponent = icon && icons[icon];
79
- const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
80
- const hasIcon = !!icon;
81
- const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
82
- return /* @__PURE__ */ jsxs2("div", { className: "group flex w-full flex-col gap-1", "data-testid": `input-wrapper-${props.id}`, children: [
83
- label && /* @__PURE__ */ jsx4(
84
- Label_default,
85
- {
86
- text: label,
87
- htmlFor: props.name,
88
- required: props.required,
89
- description,
90
- className: classNames?.label
91
- }
92
- ),
93
- /* @__PURE__ */ jsxs2("div", { className: "relative flex flex-row items-center", children: [
94
- IconComponent && /* @__PURE__ */ jsx4(
95
- IconComponent,
96
- {
97
- className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
98
- }
99
- ),
100
- /* @__PURE__ */ jsx4(
101
- "input",
102
- {
103
- className: cn(inputVariants({ theme, hasIcon })),
104
- ref,
105
- placeholder,
106
- value,
107
- onChange,
108
- "data-testid": `input-element-${props.id}`,
109
- ...props
110
- }
111
- ),
112
- hasIcon && value && /* @__PURE__ */ jsx4(
113
- X,
114
- {
115
- className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
116
- onClick: handleClear,
117
- "data-testid": "clear-button"
118
- }
119
- )
120
- ] }),
121
- /* @__PURE__ */ jsx4(ErrorMessage_default, { message: error })
122
- ] });
123
- }
124
- );
125
- Input.displayName = "Input";
126
- var inputVariants = cva(
127
- [
128
- "border-input",
129
- "placeholder:text-muted-foreground",
130
- "focus-visible:ring-ring",
131
- "inline-flex",
132
- "w-full",
133
- "h-11",
134
- "items-center",
135
- "justify-start",
136
- "gap-3",
137
- "rounded-lg",
138
- "bg-transparent",
139
- "px-3",
140
- "pt-0.5",
141
- "text-sm",
142
- "shadow-sm",
143
- "ring-grey-50",
144
- "transition-colors",
145
- "focus-visible:outline-none",
146
- "focus-visible:ring-1",
147
- "disabled:cursor-not-allowed",
148
- "disabled:opacity-50",
149
- "appearance-none",
150
- "[&::-webkit-search-cancel-button]:appearance-none",
151
- "[&::-webkit-search-decoration]:appearance-none",
152
- "[&::-webkit-search-results-button]:appearance-none",
153
- "[&::-webkit-search-results-decoration]:appearance-none",
154
- "[&::-ms-clear]:display-none",
155
- "[&::-ms-reveal]:display-none"
156
- ],
157
- {
158
- variants: {
159
- theme: {
160
- light: "text-grey-80 border",
161
- dark: "text-white"
162
- },
163
- hasIcon: {
164
- false: "pl-3",
165
- true: "pl-8"
166
- }
167
- },
168
- defaultVariants: {
169
- theme: "light",
170
- hasIcon: false
171
- }
172
- }
173
- );
174
- var Input_default = Input;
175
-
176
- // src/components/demos/InputDemo.tsx
177
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
178
- function InputDemo() {
179
- return /* @__PURE__ */ jsxs3("div", { className: "m-4", children: [
180
- /* @__PURE__ */ jsx5("h3", { children: "Input" }),
181
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2 md:flex-row", children: [
182
- /* @__PURE__ */ jsx5("div", { className: "bg-green-80 p-2", children: /* @__PURE__ */ jsx5(Input_default, { theme: "dark", icon: "Search" }) }),
183
- /* @__PURE__ */ jsx5("div", { className: "p-2", children: /* @__PURE__ */ jsx5(Input_default, { label: "Required input", required: true, description: "This is a tooltip" }) }),
184
- /* @__PURE__ */ jsx5("div", { className: "p-2", children: /* @__PURE__ */ jsx5(Input_default, { icon: "MapPin" }) })
185
- ] })
186
- ] });
187
- }
188
- var InputDemo_default = InputDemo;
189
- export {
190
- InputDemo_default as default
191
- };
192
- //# sourceMappingURL=InputDemo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/ui/Input.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/primitives/tooltip.tsx","../../../src/components/ui/Label.tsx","../../../src/components/demos/InputDemo.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'cva'\nimport { icons, X } from 'lucide-react'\nimport { type ChangeEvent, forwardRef, type InputHTMLAttributes } from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ninterface Props extends InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {\n label?: string\n error?: string\n icon?: keyof typeof icons\n description?: string\n classNames?: { label?: string }\n onClear?: () => void\n}\n\nconst Input = forwardRef<HTMLInputElement, Props>(\n (\n { label, error, description, theme, icon, onClear, value, onChange, classNames, ...props },\n ref\n ) => {\n const handleClear = () => {\n onChange?.({ target: { value: '' } } as ChangeEvent<HTMLInputElement>)\n onClear?.()\n }\n\n const IconComponent = icon && icons[icon]\n\n const placeholder = props.placeholder ?? (icon === 'Search' ? 'Search...' : '')\n const hasIcon = !!icon\n\n const iconColor = theme === 'dark' ? 'text-white' : 'text-grey-80'\n\n return (\n <div className=\"group flex w-full flex-col gap-1\" data-testid={`input-wrapper-${props.id}`}>\n {label && (\n <Label\n text={label}\n htmlFor={props.name}\n required={props.required}\n description={description}\n className={classNames?.label}\n />\n )}\n <div className=\"relative flex flex-row items-center\">\n {IconComponent && (\n <IconComponent\n className={`absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`}\n />\n )}\n <input\n className={cn(inputVariants({ theme, hasIcon }))}\n ref={ref}\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n data-testid={`input-element-${props.id}`}\n {...props}\n />\n {hasIcon && value && (\n <X\n className={`absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`}\n onClick={handleClear}\n data-testid=\"clear-button\"\n />\n )}\n </div>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\nInput.displayName = 'Input'\n\nconst inputVariants = cva(\n [\n 'border-input',\n 'placeholder:text-muted-foreground',\n 'focus-visible:ring-ring',\n 'inline-flex',\n 'w-full',\n 'h-11',\n 'items-center',\n 'justify-start',\n 'gap-3',\n 'rounded-lg',\n 'bg-transparent',\n 'px-3',\n 'pt-0.5',\n 'text-sm',\n 'shadow-sm',\n 'ring-grey-50',\n 'transition-colors',\n 'focus-visible:outline-none',\n 'focus-visible:ring-1',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'appearance-none',\n '[&::-webkit-search-cancel-button]:appearance-none',\n '[&::-webkit-search-decoration]:appearance-none',\n '[&::-webkit-search-results-button]:appearance-none',\n '[&::-webkit-search-results-decoration]:appearance-none',\n '[&::-ms-clear]:display-none',\n '[&::-ms-reveal]:display-none',\n ],\n {\n variants: {\n theme: {\n light: 'text-grey-80 border',\n dark: 'text-white',\n },\n hasIcon: {\n false: 'pl-3',\n true: 'pl-8',\n },\n },\n defaultVariants: {\n theme: 'light',\n hasIcon: false,\n },\n }\n)\n\nexport default Input\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","'use client'\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n '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',\n className\n )}\n {...props}\n />\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { InfoIcon } from 'lucide-react'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n required?: boolean\n description?: string\n}\n\nfunction Label({ text, required, description, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <div className=\"flex w-full flex-row gap-1\">\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n {required && <span className=\"text-red-600\">&nbsp;*</span>}\n </label>\n\n {!!description && (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <InfoIcon className=\"h-4 w-4\" />\n </TooltipTrigger>\n <TooltipContent className=\"max-w-48\">{description}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n )\n}\n\nexport default Label\n","import Input from '@/components/ui/Input'\n\nfunction InputDemo() {\n return (\n <div className=\"m-4\">\n <h3>Input</h3>\n <div className=\"flex flex-col gap-2 md:flex-row\">\n <div className=\"bg-green-80 p-2\">\n <Input theme=\"dark\" icon=\"Search\" />\n </div>\n <div className=\"p-2\">\n <Input label=\"Required input\" required description=\"This is a tooltip\" />\n </div>\n <div className=\"p-2\">\n <Input icon=\"MapPin\" />\n </div>\n </div>\n </div>\n )\n}\n\nexport default InputDemo\n"],"mappings":";AAAA,SAAS,WAA8B;AACvC,SAAS,OAAO,SAAS;AACzB,SAA2B,cAAAA,mBAA4C;;;ACFvE,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACOI;AAJJ,SAAS,aAAa,EAAE,SAAS,WAAW,GAAG,MAAM,GAAoB;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,SACE,oBAAC,OAAE,WAAW,GAAG,6BAA6B,SAAS,GAAI,GAAG,OAC3D,mBACH;AAEJ;AAEA,IAAO,uBAAQ;;;AChBf,YAAY,sBAAsB;AAClC,YAAY,WAAW;AAcrB,gBAAAC,YAAA;AAVF,IAAM,kBAAmC;AAEzC,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAExC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,GAAG,MAAM,GAAG,QAC1C,gBAAAA;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,eAAe,cAA+B,yBAAQ;;;AClBtD,SAAS,gB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G,MACA,QAAAC,aADA;AAHN,SAAS,YAAY;AACnB,SACE,gBAAAA,MAAC,SAAI,WAAU,OACb;AAAA,oBAAAD,KAAC,QAAG,mBAAK;AAAA,IACT,gBAAAC,MAAC,SAAI,WAAU,mCACb;AAAA,sBAAAD,KAAC,SAAI,WAAU,mBACb,0BAAAA,KAAC,iBAAM,OAAM,QAAO,MAAK,UAAS,GACpC;AAAA,MACA,gBAAAA,KAAC,SAAI,WAAU,OACb,0BAAAA,KAAC,iBAAM,OAAM,kBAAiB,UAAQ,MAAC,aAAY,qBAAoB,GACzE;AAAA,MACA,gBAAAA,KAAC,SAAI,WAAU,OACb,0BAAAA,KAAC,iBAAM,MAAK,UAAS,GACvB;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,IAAO,oBAAQ;","names":["forwardRef","jsx","jsx","jsx","jsxs","forwardRef","jsx","jsxs"]}
@@ -1,129 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/components/demos/MapComponentDemo.tsx
22
- var MapComponentDemo_exports = {};
23
- __export(MapComponentDemo_exports, {
24
- default: () => MapComponentDemo_default
25
- });
26
- module.exports = __toCommonJS(MapComponentDemo_exports);
27
-
28
- // src/components/ui/MapComponent.tsx
29
- var import_react_google_maps = require("@vis.gl/react-google-maps");
30
-
31
- // src/lib/utils.ts
32
- var import_clsx = require("clsx");
33
- var import_tailwind_merge = require("tailwind-merge");
34
- function cn(...inputs) {
35
- return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
36
- }
37
-
38
- // src/components/ui/MapComponent.tsx
39
- var import_jsx_runtime = require("react/jsx-runtime");
40
- function MapComponent({ apiKey, mapId, position, className, zoom = 15 }) {
41
- const defaultPosition = { lat: 40.715021, lng: -74.00459 };
42
- const defaultZoom = 11;
43
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_google_maps.APIProvider, { apiKey, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("h-screen max-w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
44
- import_react_google_maps.Map,
45
- {
46
- zoom: position ? zoom : defaultZoom,
47
- center: position || defaultPosition,
48
- mapId,
49
- keyboardShortcuts: false,
50
- disableDefaultUI: true,
51
- children: position && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_google_maps.AdvancedMarker, { position, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_google_maps.Pin, { background: "#0B5441", borderColor: "#EBFDF1", glyphColor: "#D4F500" }) })
52
- }
53
- ) }) });
54
- }
55
- var MapComponent_default = MapComponent;
56
-
57
- // src/lib/google.ts
58
- var import_google_maps_services_js = require("@googlemaps/google-maps-services-js");
59
- var client = new import_google_maps_services_js.Client();
60
- var fetchLocation = async (place, key) => {
61
- try {
62
- if (place.place_id) {
63
- const placeDetails = await getPlaceDetails(place.place_id, key);
64
- if (placeDetails) return placeDetails;
65
- }
66
- if (place.address) {
67
- const result = await geocode(place.address, key);
68
- const firstAddress = result?.[0];
69
- return firstAddress;
70
- }
71
- return void 0;
72
- } catch (error) {
73
- console.error("Error fetching location:", error);
74
- }
75
- };
76
- var getPlaceDetails = async (place_id, key) => {
77
- try {
78
- const response = await client.placeDetails({
79
- params: { place_id, key }
80
- });
81
- return response.data.result;
82
- } catch (error) {
83
- console.error(error);
84
- }
85
- };
86
- var geocode = async (address, key) => {
87
- try {
88
- const response = await client.geocode({
89
- params: { address, key }
90
- });
91
- return response.data.results;
92
- } catch (error) {
93
- console.error(error);
94
- }
95
- };
96
-
97
- // src/components/demos/MapComponentDemo.tsx
98
- var import_react = require("react");
99
- var import_jsx_runtime2 = require("react/jsx-runtime");
100
- var API_KEY = process.env.NEXT_PUBLIC_GOOGLE_API_KEY ?? "";
101
- var MAP_ID = process.env.NEXT_PUBLIC_GOOGLE_MAP_ID ?? "";
102
- function MapComponentDemo() {
103
- const [position, setPosition] = (0, import_react.useState)();
104
- const place = {
105
- place_id: "ChIJaXQRs6lZwokRY6EFpJnhNNE",
106
- // Empire State Building Place ID
107
- address: "Empire State Building, New York, NY, USA"
108
- };
109
- (0, import_react.useEffect)(() => {
110
- fetchLocation(place, API_KEY).then((location) => {
111
- if (location) {
112
- const { lat, lng } = location.geometry?.location ?? {};
113
- if (!lat || !lng) return;
114
- setPosition({ lat, lng });
115
- }
116
- });
117
- }, []);
118
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
119
- MapComponent_default,
120
- {
121
- apiKey: API_KEY,
122
- mapId: MAP_ID,
123
- className: "h-[36rem] w-[36rem] p-4",
124
- position
125
- }
126
- );
127
- }
128
- var MapComponentDemo_default = MapComponentDemo;
129
- //# sourceMappingURL=MapComponentDemo.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/demos/MapComponentDemo.tsx","../../../src/components/ui/MapComponent.tsx","../../../src/lib/utils.ts","../../../src/lib/google.ts"],"sourcesContent":["'use client'\n\nimport MapComponent from '@/components/ui/MapComponent'\nimport { fetchLocation } from '@/lib/google'\nimport { useEffect, useState } from 'react'\n\nconst API_KEY = process.env.NEXT_PUBLIC_GOOGLE_API_KEY ?? ''\nconst MAP_ID = process.env.NEXT_PUBLIC_GOOGLE_MAP_ID ?? ''\n\nfunction MapComponentDemo() {\n const [position, setPosition] = useState<{ lat: number; lng: number } | undefined>()\n\n const place = {\n place_id: 'ChIJaXQRs6lZwokRY6EFpJnhNNE', // Empire State Building Place ID\n address: 'Empire State Building, New York, NY, USA',\n }\n\n useEffect(() => {\n fetchLocation(place, API_KEY).then((location) => {\n if (location) {\n const { lat, lng } = location.geometry?.location ?? {}\n if (!lat || !lng) return\n\n setPosition({ lat, lng })\n }\n })\n }, [])\n\n return (\n <MapComponent\n apiKey={API_KEY}\n mapId={MAP_ID}\n className=\"h-[36rem] w-[36rem] p-4\"\n position={position}\n />\n )\n}\n\nexport default MapComponentDemo\n","'use client'\n\nimport { APIProvider, Map, AdvancedMarker, Pin } from '@vis.gl/react-google-maps'\nimport { cn } from '@/lib/utils'\n\ninterface MapComponentProps {\n apiKey: string\n mapId: string // Check your map ID at https://console.cloud.google.com/google/maps-apis/studio/maps\n position?: { lat: number; lng: number }\n className?: string\n zoom?: number\n}\n\nfunction MapComponent({ apiKey, mapId, position, className, zoom = 15 }: Readonly<MapComponentProps>) {\n const defaultPosition = { lat: 40.715021, lng: -74.004590 }\n const defaultZoom = 11\n\n return (\n <APIProvider apiKey={apiKey}>\n <div className={cn('h-screen max-w-full', className)}>\n <Map\n zoom={position ? zoom : defaultZoom}\n center={position || defaultPosition}\n mapId={mapId}\n keyboardShortcuts={false}\n disableDefaultUI\n >\n {position && (\n <AdvancedMarker position={position}>\n <Pin background=\"#0B5441\" borderColor=\"#EBFDF1\" glyphColor=\"#D4F500\" />\n </AdvancedMarker>\n )}\n </Map>\n </div>\n </APIProvider>\n )\n}\n\nexport default MapComponent\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","'use server'\n\nimport { Client, PlaceAutocompleteType, PlaceData } from '@googlemaps/google-maps-services-js'\n\nconst client = new Client()\n\nexport const autocomplete = async (input: string, key: string) => {\n try {\n const response = await client.placeAutocomplete({\n params: { input, key, types: PlaceAutocompleteType.address },\n })\n\n return response.data.predictions\n } catch (error) {\n console.error(error)\n }\n}\n\ntype Place = {\n place_id?: string\n address?: string\n}\n/**\n * This is the exported function that calls the Google api to fetch the location based on the place_id or address.\n */\nexport const fetchLocation = async (\n place: Place,\n key: string\n): Promise<Partial<PlaceData> | undefined> => {\n try {\n if (place.place_id) {\n const placeDetails = await getPlaceDetails(place.place_id, key)\n if (placeDetails) return placeDetails\n }\n if (place.address) {\n const result = await geocode(place.address, key)\n const firstAddress = result?.[0]\n return firstAddress\n }\n\n return undefined\n } catch (error) {\n console.error('Error fetching location:', error)\n }\n}\n\n/**\n * If you have a place ID, you can use the placeDetails method to get more information about a place.\n * The advantage over an address is that there will be no ambiguity about the location.\n * @param place_id\n * @param key\n * @returns\n */\nexport const getPlaceDetails = async (place_id: string, key: string) => {\n try {\n const response = await client.placeDetails({\n params: { place_id, key },\n })\n\n return response.data.result\n } catch (error) {\n console.error(error)\n }\n}\n\n/**\n * The geocode method is used to convert an address into actual location(s) with lat/long.\n */\nexport const geocode = async (address: string, key: string) => {\n try {\n const response = await client.geocode({\n params: { address, key },\n })\n\n return response.data.results\n } catch (error) {\n console.error(error)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,+BAAsD;;;ACFtD,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADwBc;AAhBd,SAAS,aAAa,EAAE,QAAQ,OAAO,UAAU,WAAW,OAAO,GAAG,GAAgC;AACpG,QAAM,kBAAkB,EAAE,KAAK,WAAW,KAAK,UAAW;AAC1D,QAAM,cAAc;AAEpB,SACE,4CAAC,wCAAY,QACX,sDAAC,SAAI,WAAW,GAAG,uBAAuB,SAAS,GACjD;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,WAAW,OAAO;AAAA,MACxB,QAAQ,YA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,mBAAmB;AAC1B,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAmD;AAEnF,QAAM,QAAQ;AAAA,IACZ,UAAU;AAAA;AAAA,IACV,SAAS;AAAA,EACX;AAEA,8BAAU,MAAM;AACd,kBAAc,OAAO,OAAO,EAAE,KAAK,CAAC,aAAa;AAC/C,UAAI,UAAU;AACZ,cAAM,EAAE,KAAK,IAAI,IAAI,SAAS,UAAU,YAAY,CAAC;AACrD,YAAI,CAAC,OAAO,CAAC,IAAK;AAElB,oBAAY,EAAE,KAAK,IAAI,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,WAAU;AAAA,MACV;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,2BAAQ;","names":["import_jsx_runtime"]}
@@ -1,5 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- declare function MapComponentDemo(): react_jsx_runtime.JSX.Element;
4
-
5
- export { MapComponentDemo as default };
@@ -1,5 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- declare function MapComponentDemo(): react_jsx_runtime.JSX.Element;
4
-
5
- export { MapComponentDemo as default };
@@ -1,107 +0,0 @@
1
- "use client";
2
-
3
- // src/components/ui/MapComponent.tsx
4
- import { APIProvider, Map, AdvancedMarker, Pin } from "@vis.gl/react-google-maps";
5
-
6
- // src/lib/utils.ts
7
- import { clsx } from "clsx";
8
- import { twMerge } from "tailwind-merge";
9
- function cn(...inputs) {
10
- return twMerge(clsx(inputs));
11
- }
12
-
13
- // src/components/ui/MapComponent.tsx
14
- import { jsx } from "react/jsx-runtime";
15
- function MapComponent({ apiKey, mapId, position, className, zoom = 15 }) {
16
- const defaultPosition = { lat: 40.715021, lng: -74.00459 };
17
- const defaultZoom = 11;
18
- return /* @__PURE__ */ jsx(APIProvider, { apiKey, children: /* @__PURE__ */ jsx("div", { className: cn("h-screen max-w-full", className), children: /* @__PURE__ */ jsx(
19
- Map,
20
- {
21
- zoom: position ? zoom : defaultZoom,
22
- center: position || defaultPosition,
23
- mapId,
24
- keyboardShortcuts: false,
25
- disableDefaultUI: true,
26
- children: position && /* @__PURE__ */ jsx(AdvancedMarker, { position, children: /* @__PURE__ */ jsx(Pin, { background: "#0B5441", borderColor: "#EBFDF1", glyphColor: "#D4F500" }) })
27
- }
28
- ) }) });
29
- }
30
- var MapComponent_default = MapComponent;
31
-
32
- // src/lib/google.ts
33
- import { Client, PlaceAutocompleteType } from "@googlemaps/google-maps-services-js";
34
- var client = new Client();
35
- var fetchLocation = async (place, key) => {
36
- try {
37
- if (place.place_id) {
38
- const placeDetails = await getPlaceDetails(place.place_id, key);
39
- if (placeDetails) return placeDetails;
40
- }
41
- if (place.address) {
42
- const result = await geocode(place.address, key);
43
- const firstAddress = result?.[0];
44
- return firstAddress;
45
- }
46
- return void 0;
47
- } catch (error) {
48
- console.error("Error fetching location:", error);
49
- }
50
- };
51
- var getPlaceDetails = async (place_id, key) => {
52
- try {
53
- const response = await client.placeDetails({
54
- params: { place_id, key }
55
- });
56
- return response.data.result;
57
- } catch (error) {
58
- console.error(error);
59
- }
60
- };
61
- var geocode = async (address, key) => {
62
- try {
63
- const response = await client.geocode({
64
- params: { address, key }
65
- });
66
- return response.data.results;
67
- } catch (error) {
68
- console.error(error);
69
- }
70
- };
71
-
72
- // src/components/demos/MapComponentDemo.tsx
73
- import { useEffect, useState } from "react";
74
- import { jsx as jsx2 } from "react/jsx-runtime";
75
- var API_KEY = process.env.NEXT_PUBLIC_GOOGLE_API_KEY ?? "";
76
- var MAP_ID = process.env.NEXT_PUBLIC_GOOGLE_MAP_ID ?? "";
77
- function MapComponentDemo() {
78
- const [position, setPosition] = useState();
79
- const place = {
80
- place_id: "ChIJaXQRs6lZwokRY6EFpJnhNNE",
81
- // Empire State Building Place ID
82
- address: "Empire State Building, New York, NY, USA"
83
- };
84
- useEffect(() => {
85
- fetchLocation(place, API_KEY).then((location) => {
86
- if (location) {
87
- const { lat, lng } = location.geometry?.location ?? {};
88
- if (!lat || !lng) return;
89
- setPosition({ lat, lng });
90
- }
91
- });
92
- }, []);
93
- return /* @__PURE__ */ jsx2(
94
- MapComponent_default,
95
- {
96
- apiKey: API_KEY,
97
- mapId: MAP_ID,
98
- className: "h-[36rem] w-[36rem] p-4",
99
- position
100
- }
101
- );
102
- }
103
- var MapComponentDemo_default = MapComponentDemo;
104
- export {
105
- MapComponentDemo_default as default
106
- };
107
- //# sourceMappingURL=MapComponentDemo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/ui/MapComponent.tsx","../../../src/lib/utils.ts","../../../src/lib/google.ts","../../../src/components/demos/MapComponentDemo.tsx"],"sourcesContent":["'use client'\n\nimport { APIProvider, Map, AdvancedMarker, Pin } from '@vis.gl/react-google-maps'\nimport { cn } from '@/lib/utils'\n\ninterface MapComponentProps {\n apiKey: string\n mapId: string // Check your map ID at https://console.cloud.google.com/google/maps-apis/studio/maps\n position?: { lat: number; lng: number }\n className?: string\n zoom?: number\n}\n\nfunction MapComponent({ apiKey, mapId, position, className, zoom = 15 }: Readonly<MapComponentProps>) {\n const defaultPosition = { lat: 40.715021, lng: -74.004590 }\n const defaultZoom = 11\n\n return (\n <APIProvider apiKey={apiKey}>\n <div className={cn('h-screen max-w-full', className)}>\n <Map\n zoom={position ? zoom : defaultZoom}\n center={position || defaultPosition}\n mapId={mapId}\n keyboardShortcuts={false}\n disableDefaultUI\n >\n {position && (\n <AdvancedMarker position={position}>\n <Pin background=\"#0B5441\" borderColor=\"#EBFDF1\" glyphColor=\"#D4F500\" />\n </AdvancedMarker>\n )}\n </Map>\n </div>\n </APIProvider>\n )\n}\n\nexport default MapComponent\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","'use server'\n\nimport { Client, PlaceAutocompleteType, PlaceData } from '@googlemaps/google-maps-services-js'\n\nconst client = new Client()\n\nexport const autocomplete = async (input: string, key: string) => {\n try {\n const response = await client.placeAutocomplete({\n params: { input, key, types: PlaceAutocompleteType.address },\n })\n\n return response.data.predictions\n } catch (error) {\n console.error(error)\n }\n}\n\ntype Place = {\n place_id?: string\n address?: string\n}\n/**\n * This is the exported function that calls the Google api to fetch the location based on the place_id or address.\n */\nexport const fetchLocation = async (\n place: Place,\n key: string\n): Promise<Partial<PlaceData> | undefined> => {\n try {\n if (place.place_id) {\n const placeDetails = await getPlaceDetails(place.place_id, key)\n if (placeDetails) return placeDetails\n }\n if (place.address) {\n const result = await geocode(place.address, key)\n const firstAddress = result?.[0]\n return firstAddress\n }\n\n return undefined\n } catch (error) {\n console.error('Error fetching location:', error)\n }\n}\n\n/**\n * If you have a place ID, you can use the placeDetails method to get more information about a place.\n * The advantage over an address is that there will be no ambiguity about the location.\n * @param place_id\n * @param key\n * @returns\n */\nexport const getPlaceDetails = async (place_id: string, key: string) => {\n try {\n const response = await client.placeDetails({\n params: { place_id, key },\n })\n\n return response.data.result\n } catch (error) {\n console.error(error)\n }\n}\n\n/**\n * The geocode method is used to convert an address into actual location(s) with lat/long.\n */\nexport const geocode = async (address: string, key: string) => {\n try {\n const response = await client.geocode({\n params: { address, key },\n })\n\n return response.data.results\n } catch (error) {\n console.error(error)\n }\n}\n","'use client'\n\nimport MapComponent from '@/components/ui/MapComponent'\nimport { fetchLocation } from '@/lib/google'\nimport { useEffect, useState } from 'react'\n\nconst API_KEY = process.env.NEXT_PUBLIC_GOOGLE_API_KEY ?? ''\nconst MAP_ID = process.env.NEXT_PUBLIC_GOOGLE_MAP_ID ?? ''\n\nfunction MapComponentDemo() {\n const [position, setPosition] = useState<{ lat: number; lng: number } | undefined>()\n\n const place = {\n place_id: 'ChIJaXQRs6lZwokRY6EFpJnhNNE', // Empire State Building Place ID\n address: 'Empire State Building, New York, NY, USA',\n }\n\n useEffect(() => {\n fetchLocation(place, API_KEY).then((location) => {\n if (location) {\n const { lat, lng } = location.geometry?.location ?? {}\n if (!lat || !lng) return\n\n setPosition({ lat, lng })\n }\n })\n }, [])\n\n return (\n <MapComponent\n apiKey={API_KEY}\n mapId={MAP_ID}\n className=\"h-[36rem] w-[36rem] p-4\"\n position={position}\n />\n )\n}\n\nexport default MapComponentDemo\n"],"mappings":";;;AAEA,SAAS,aAAa,KAAK,gBAAgB,WAAW;;;ACFtD,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADwBc;AAhBd,SAAS,aAAa,EAAE,QAAQ,OAAO,UAAU,WAAW,OAAO,GAAG,GAAgC;AACpG,QAAM,kBAAkB,EAAE,KAAK,WAAW,KAAK,UAAW;AAC1D,QAAM,cAAc;AAEpB,SACE,oBAAC,eAAY,QACX,8BAAC,SAAI,WAAW,GAAG,uBAAuB,SAAS,GACjD;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,WAAW,OAAO;AAAA,MACxB,QAAQ,YAAY;AAAA,MACpB;AAAA,MACA,mBAAmB;AAAA,MACnB,kBAAgB;AAAA,MAEf,sBACC,oBAAC,kBAAe,UACd,8BAAC,OAAI,YAAW,WAAU,aAAY,WAAU,YAAW,WAAU,GACvE;AAAA;AAAA,EAEJ,GACF,GACF;AAEJ;AAEA,IAAO,uBAAQ;;;AEpCf,SAAS,QAAQ,6BAAwC;AAEzD,IAAM,SAAS,IAAI,OAAO;AAqBnB,IAAM,gBAAgB,OAC3B,OACA,QAC4C;AAC5C,MAAI;AACF,QAAI,MAAM,UAAU;AAClB,YAAM,eAAe,MAAM,gBAAgB,MAAM,UAAU,GAAG;AAC9D,UAAI,aAAc,QAAO;AAAA,IAC3B;AACA,QAAI,MAAM,SAAS;AACjB,YAAM,SAAS,MAAM,QAAQ,MAAM,SAAS,GAAG;AAC/C,YAAM,eAAe,SAAS,CA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