@storepecker/storefront-core 1.0.0

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 (80) hide show
  1. package/dist/address-DQEZzyUG.d.cts +19 -0
  2. package/dist/address-DQEZzyUG.d.ts +19 -0
  3. package/dist/api/index.cjs +367 -0
  4. package/dist/api/index.d.cts +127 -0
  5. package/dist/api/index.d.ts +127 -0
  6. package/dist/api/index.js +131 -0
  7. package/dist/booking-ClX-dhX7.d.ts +131 -0
  8. package/dist/booking-Drl7-IL7.d.cts +131 -0
  9. package/dist/cart-DVrn8hD0.d.cts +367 -0
  10. package/dist/cart-DVrn8hD0.d.ts +367 -0
  11. package/dist/checkout/index.cjs +228 -0
  12. package/dist/checkout/index.d.cts +251 -0
  13. package/dist/checkout/index.d.ts +251 -0
  14. package/dist/checkout/index.js +122 -0
  15. package/dist/chunk-4CVKE6CC.cjs +312 -0
  16. package/dist/chunk-4MJMNIAB.js +123 -0
  17. package/dist/chunk-57ZBPAXU.js +114 -0
  18. package/dist/chunk-7MQOVWLW.js +40 -0
  19. package/dist/chunk-7UH6REGV.js +12 -0
  20. package/dist/chunk-A6IO3HIN.cjs +151 -0
  21. package/dist/chunk-CFF632IQ.cjs +100 -0
  22. package/dist/chunk-CSISWBZZ.js +121 -0
  23. package/dist/chunk-E7WPE3PV.js +98 -0
  24. package/dist/chunk-FLBJKM6G.js +83 -0
  25. package/dist/chunk-GB3HW6DM.js +61 -0
  26. package/dist/chunk-GH75WUO2.cjs +42 -0
  27. package/dist/chunk-GQTO5ZE2.cjs +96 -0
  28. package/dist/chunk-JHGXIIBZ.cjs +37 -0
  29. package/dist/chunk-JQMLHRWL.js +21 -0
  30. package/dist/chunk-K44JZ5NL.cjs +212 -0
  31. package/dist/chunk-K5B62JZO.cjs +154 -0
  32. package/dist/chunk-KWKHHRRJ.cjs +15 -0
  33. package/dist/chunk-LBGIUNM6.js +30 -0
  34. package/dist/chunk-LC5ZAUKL.cjs +220 -0
  35. package/dist/chunk-N3CTXRFT.cjs +30 -0
  36. package/dist/chunk-QCQCFYYR.js +206 -0
  37. package/dist/chunk-QM73PI5L.cjs +218 -0
  38. package/dist/chunk-RCXQJ6XC.cjs +131 -0
  39. package/dist/chunk-UM24VDYB.js +216 -0
  40. package/dist/chunk-UXLUE3HW.cjs +69 -0
  41. package/dist/chunk-WFDKKOO7.js +210 -0
  42. package/dist/chunk-YUPBTD4M.js +289 -0
  43. package/dist/components/index.cjs +576 -0
  44. package/dist/components/index.css +329 -0
  45. package/dist/components/index.d.cts +58 -0
  46. package/dist/components/index.d.ts +58 -0
  47. package/dist/components/index.js +569 -0
  48. package/dist/coupons-C7iJ-1cy.d.cts +37 -0
  49. package/dist/coupons-CnfTKL1i.d.ts +37 -0
  50. package/dist/hooks/index.cjs +381 -0
  51. package/dist/hooks/index.d.cts +123 -0
  52. package/dist/hooks/index.d.ts +123 -0
  53. package/dist/hooks/index.js +364 -0
  54. package/dist/index-DTyIuLuI.d.cts +18 -0
  55. package/dist/index-DTyIuLuI.d.ts +18 -0
  56. package/dist/index.cjs +14 -0
  57. package/dist/index.d.cts +1 -0
  58. package/dist/index.d.ts +1 -0
  59. package/dist/index.js +1 -0
  60. package/dist/models/index.cjs +2 -0
  61. package/dist/models/index.d.cts +53 -0
  62. package/dist/models/index.d.ts +53 -0
  63. package/dist/models/index.js +1 -0
  64. package/dist/orders-CkUzv5Xh.d.ts +159 -0
  65. package/dist/orders-D0oC9ugD.d.cts +159 -0
  66. package/dist/phonepe-D7vn-9SR.d.cts +27 -0
  67. package/dist/phonepe-D7vn-9SR.d.ts +27 -0
  68. package/dist/store/index.cjs +149 -0
  69. package/dist/store/index.d.cts +46 -0
  70. package/dist/store/index.d.ts +46 -0
  71. package/dist/store/index.js +141 -0
  72. package/dist/useAddressForm-C-Uzug4d.d.ts +42 -0
  73. package/dist/useAddressForm-DgkCP1nG.d.cts +42 -0
  74. package/dist/utils/index.cjs +535 -0
  75. package/dist/utils/index.d.cts +507 -0
  76. package/dist/utils/index.d.ts +507 -0
  77. package/dist/utils/index.js +342 -0
  78. package/dist/wishlist-BzhnCAQD.d.ts +41 -0
  79. package/dist/wishlist-CBCZD66Y.d.cts +41 -0
  80. package/package.json +134 -0
@@ -0,0 +1,576 @@
1
+ 'use strict';
2
+
3
+ var chunkQM73PI5L_cjs = require('../chunk-QM73PI5L.cjs');
4
+ require('../chunk-JHGXIIBZ.cjs');
5
+ require('../chunk-4CVKE6CC.cjs');
6
+ require('../chunk-K5B62JZO.cjs');
7
+ require('../chunk-UXLUE3HW.cjs');
8
+ require('../chunk-GQTO5ZE2.cjs');
9
+ require('../chunk-N3CTXRFT.cjs');
10
+ var react = require('react');
11
+ var clsx = require('clsx');
12
+ var jsxRuntime = require('react/jsx-runtime');
13
+
14
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
+
16
+ var clsx__default = /*#__PURE__*/_interopDefault(clsx);
17
+
18
+ // src/components/search-dropdown/search-dropdown.module.css
19
+ var search_dropdown_default = {};
20
+ function DownChevron({
21
+ width = 24,
22
+ height = 24,
23
+ className
24
+ }) {
25
+ return /* @__PURE__ */ jsxRuntime.jsx(
26
+ "svg",
27
+ {
28
+ fill: "currentColor",
29
+ height,
30
+ width,
31
+ xmlns: "http://www.w3.org/2000/svg",
32
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
33
+ viewBox: "0 0 407.437 407.437",
34
+ xmlSpace: "preserve",
35
+ className,
36
+ children: /* @__PURE__ */ jsxRuntime.jsx(
37
+ "polygon",
38
+ {
39
+ points: "386.258,91.567 203.718,273.512 21.179,91.567 0,112.815 203.718,315.87 407.437,112.815 ",
40
+ strokeWidth: "2"
41
+ }
42
+ )
43
+ }
44
+ );
45
+ }
46
+ function SearchIcon({
47
+ width = 24,
48
+ height = 24,
49
+ className
50
+ }) {
51
+ return /* @__PURE__ */ jsxRuntime.jsxs(
52
+ "svg",
53
+ {
54
+ width,
55
+ height,
56
+ viewBox: "0 0 24 24",
57
+ fill: "none",
58
+ xmlns: "http://www.w3.org/2000/svg",
59
+ className,
60
+ children: [
61
+ /* @__PURE__ */ jsxRuntime.jsx(
62
+ "path",
63
+ {
64
+ d: "M17.5 17.5L22 22",
65
+ stroke: "currentColor",
66
+ strokeWidth: "1.5",
67
+ strokeLinecap: "round",
68
+ strokeLinejoin: "round"
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsxRuntime.jsx(
72
+ "path",
73
+ {
74
+ d: "M20 11C20 6.02944 15.9706 2 11 2C6.02944 2 2 6.02944 2 11C2 15.9706 6.02944 20 11 20C15.9706 20 20 15.9706 20 11Z",
75
+ stroke: "currentColor",
76
+ strokeWidth: "1.5",
77
+ strokeLinejoin: "round"
78
+ }
79
+ )
80
+ ]
81
+ }
82
+ );
83
+ }
84
+ var SearchDropdown = ({
85
+ options,
86
+ value,
87
+ onChange,
88
+ placeholder = "Select an option",
89
+ searchPlaceholder = "Search...",
90
+ className,
91
+ disabled = false,
92
+ error,
93
+ label,
94
+ name,
95
+ renderOption,
96
+ renderSelected,
97
+ filterFunction,
98
+ emptyMessage = "No options found",
99
+ maxHeight = "300px"
100
+ }) => {
101
+ const [isOpen, setIsOpen] = react.useState(false);
102
+ const [searchTerm, setSearchTerm] = react.useState("");
103
+ const [focusedIndex, setFocusedIndex] = react.useState(-1);
104
+ const dropdownRef = react.useRef(null);
105
+ const searchInputRef = react.useRef(null);
106
+ const optionsListRef = react.useRef(null);
107
+ const selectedOption = react.useMemo(
108
+ () => options.find((opt) => opt.value === value) || null,
109
+ [options, value]
110
+ );
111
+ const defaultFilter = react.useCallback(
112
+ (option, term) => {
113
+ return option.label.toLowerCase().includes(term.toLowerCase());
114
+ },
115
+ []
116
+ );
117
+ const filter = filterFunction || defaultFilter;
118
+ const filteredOptions = react.useMemo(() => {
119
+ if (!searchTerm.trim()) return options;
120
+ return options.filter((option) => filter(option, searchTerm));
121
+ }, [options, searchTerm, filter]);
122
+ react.useEffect(() => {
123
+ function handleClickOutside(event) {
124
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
125
+ setIsOpen(false);
126
+ setSearchTerm("");
127
+ setFocusedIndex(-1);
128
+ }
129
+ }
130
+ if (isOpen) {
131
+ document.addEventListener("mousedown", handleClickOutside);
132
+ setTimeout(() => {
133
+ searchInputRef.current?.focus();
134
+ }, 0);
135
+ }
136
+ return () => {
137
+ document.removeEventListener("mousedown", handleClickOutside);
138
+ };
139
+ }, [isOpen]);
140
+ const handleSelect = react.useCallback(
141
+ (option) => {
142
+ if (option.disabled) return;
143
+ onChange?.(option.value, option);
144
+ setIsOpen(false);
145
+ setSearchTerm("");
146
+ setFocusedIndex(-1);
147
+ },
148
+ [onChange]
149
+ );
150
+ react.useEffect(() => {
151
+ function handleKeyDown(event) {
152
+ if (!isOpen) return;
153
+ switch (event.key) {
154
+ case "ArrowDown":
155
+ event.preventDefault();
156
+ setFocusedIndex(
157
+ (prev) => prev < filteredOptions.length - 1 ? prev + 1 : prev
158
+ );
159
+ break;
160
+ case "ArrowUp":
161
+ event.preventDefault();
162
+ setFocusedIndex((prev) => prev > 0 ? prev - 1 : -1);
163
+ break;
164
+ case "Enter":
165
+ event.preventDefault();
166
+ if (focusedIndex >= 0 && focusedIndex < filteredOptions.length) {
167
+ handleSelect(filteredOptions[focusedIndex]);
168
+ }
169
+ break;
170
+ case "Escape":
171
+ event.preventDefault();
172
+ setIsOpen(false);
173
+ setSearchTerm("");
174
+ setFocusedIndex(-1);
175
+ break;
176
+ }
177
+ }
178
+ if (isOpen) {
179
+ document.addEventListener("keydown", handleKeyDown);
180
+ }
181
+ return () => {
182
+ document.removeEventListener("keydown", handleKeyDown);
183
+ };
184
+ }, [isOpen, filteredOptions, focusedIndex, handleSelect]);
185
+ react.useEffect(() => {
186
+ if (focusedIndex >= 0 && optionsListRef.current) {
187
+ const focusedElement = optionsListRef.current.children[focusedIndex];
188
+ if (focusedElement) {
189
+ focusedElement.scrollIntoView({
190
+ behavior: "smooth",
191
+ block: "nearest"
192
+ });
193
+ }
194
+ }
195
+ }, [focusedIndex]);
196
+ const handleToggle = () => {
197
+ if (disabled) return;
198
+ setIsOpen((prev) => !prev);
199
+ if (!isOpen) {
200
+ setSearchTerm("");
201
+ setFocusedIndex(-1);
202
+ }
203
+ };
204
+ const handleSearchChange = (e) => {
205
+ setSearchTerm(e.target.value);
206
+ setFocusedIndex(-1);
207
+ };
208
+ const handleOptionMouseEnter = (index) => {
209
+ setFocusedIndex(index);
210
+ };
211
+ return /* @__PURE__ */ jsxRuntime.jsxs(
212
+ "div",
213
+ {
214
+ ref: dropdownRef,
215
+ className: clsx__default.default(search_dropdown_default.searchDropdown, className, {
216
+ [search_dropdown_default.disabled]: disabled,
217
+ [search_dropdown_default.error]: error,
218
+ [search_dropdown_default.open]: isOpen
219
+ }),
220
+ children: [
221
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: search_dropdown_default.label, htmlFor: name, children: label }),
222
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: search_dropdown_default.dropdownContainer, children: [
223
+ /* @__PURE__ */ jsxRuntime.jsxs(
224
+ "button",
225
+ {
226
+ type: "button",
227
+ className: search_dropdown_default.dropdownButton,
228
+ onClick: handleToggle,
229
+ disabled,
230
+ "aria-expanded": isOpen,
231
+ "aria-haspopup": "listbox",
232
+ "aria-label": label || placeholder,
233
+ id: name,
234
+ children: [
235
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: search_dropdown_default.selectedValue, children: selectedOption ? renderSelected ? renderSelected(selectedOption) : selectedOption.label : placeholder }),
236
+ /* @__PURE__ */ jsxRuntime.jsx(
237
+ DownChevron,
238
+ {
239
+ width: 16,
240
+ height: 16,
241
+ className: clsx__default.default(search_dropdown_default.chevron, {
242
+ [search_dropdown_default.chevronOpen]: isOpen
243
+ })
244
+ }
245
+ )
246
+ ]
247
+ }
248
+ ),
249
+ isOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: search_dropdown_default.dropdownMenu, style: { maxHeight }, children: [
250
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: search_dropdown_default.searchContainer, children: [
251
+ /* @__PURE__ */ jsxRuntime.jsx(
252
+ SearchIcon,
253
+ {
254
+ width: 16,
255
+ height: 16,
256
+ className: search_dropdown_default.searchIcon
257
+ }
258
+ ),
259
+ /* @__PURE__ */ jsxRuntime.jsx(
260
+ "input",
261
+ {
262
+ ref: searchInputRef,
263
+ type: "text",
264
+ className: search_dropdown_default.searchInput,
265
+ placeholder: searchPlaceholder,
266
+ value: searchTerm,
267
+ onChange: handleSearchChange,
268
+ onClick: (e) => e.stopPropagation(),
269
+ onKeyDown: (e) => {
270
+ if (e.key === "Enter" && filteredOptions.length === 1) {
271
+ e.preventDefault();
272
+ handleSelect(filteredOptions[0]);
273
+ }
274
+ },
275
+ autoComplete: "off"
276
+ }
277
+ )
278
+ ] }),
279
+ /* @__PURE__ */ jsxRuntime.jsx(
280
+ "ul",
281
+ {
282
+ ref: optionsListRef,
283
+ className: search_dropdown_default.optionsList,
284
+ role: "listbox",
285
+ children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
286
+ "li",
287
+ {
288
+ className: clsx__default.default(search_dropdown_default.option, {
289
+ [search_dropdown_default.optionSelected]: option.value === value,
290
+ [search_dropdown_default.optionFocused]: index === focusedIndex,
291
+ [search_dropdown_default.optionDisabled]: option.disabled
292
+ }),
293
+ onClick: () => handleSelect(option),
294
+ onMouseEnter: () => handleOptionMouseEnter(index),
295
+ role: "option",
296
+ "aria-selected": option.value === value,
297
+ children: renderOption ? renderOption(option) : option.label
298
+ },
299
+ option.value
300
+ )) : /* @__PURE__ */ jsxRuntime.jsx("li", { className: search_dropdown_default.emptyMessage, children: emptyMessage })
301
+ }
302
+ )
303
+ ] })
304
+ ] }),
305
+ error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: search_dropdown_default.errorMessage, children: error })
306
+ ]
307
+ }
308
+ );
309
+ };
310
+ var search_dropdown_default2 = SearchDropdown;
311
+
312
+ // src/components/address-form/address-form.module.css
313
+ var address_form_default = {};
314
+ var AddressForm = react.forwardRef(
315
+ ({
316
+ address,
317
+ onSuccess,
318
+ onError,
319
+ locationCacheKey,
320
+ defaultCountryId,
321
+ renderButton,
322
+ onFormikReady,
323
+ onCancel,
324
+ showCancel = true,
325
+ showDefaultCheckbox = true,
326
+ className,
327
+ submitLabel = "Save"
328
+ }, ref) => {
329
+ const {
330
+ formik,
331
+ states,
332
+ supportedCountries,
333
+ selectedCountry,
334
+ countryCodeOptions,
335
+ addressMeta,
336
+ handlePhoneCountryChange,
337
+ handleCountryCodeChange,
338
+ handlePhoneChange,
339
+ isSubmitting,
340
+ isEditing
341
+ } = chunkQM73PI5L_cjs.useAddressForm({
342
+ address,
343
+ onSuccess,
344
+ onError,
345
+ locationCacheKey,
346
+ defaultCountryId
347
+ });
348
+ react.useImperativeHandle(
349
+ ref,
350
+ () => ({
351
+ formik,
352
+ resetForm: () => formik.resetForm()
353
+ }),
354
+ [formik]
355
+ );
356
+ react.useEffect(() => {
357
+ onFormikReady?.(formik);
358
+ }, [formik, onFormikReady]);
359
+ return /* @__PURE__ */ jsxRuntime.jsxs(
360
+ "form",
361
+ {
362
+ name: "address-form",
363
+ className: `${address_form_default.addressForm} ${className || ""}`,
364
+ onSubmit: formik.handleSubmit,
365
+ children: [
366
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formBody, children: [
367
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
368
+ /* @__PURE__ */ jsxRuntime.jsx("label", { children: "Name *" }),
369
+ /* @__PURE__ */ jsxRuntime.jsx(
370
+ "input",
371
+ {
372
+ className: address_form_default.formControl,
373
+ type: "text",
374
+ placeholder: "Name",
375
+ "aria-label": "name",
376
+ autoFocus: true,
377
+ ...formik.getFieldProps("customer_name")
378
+ }
379
+ ),
380
+ formik.touched.customer_name && formik.errors.customer_name && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.customer_name })
381
+ ] }),
382
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
383
+ /* @__PURE__ */ jsxRuntime.jsx("label", { children: "Email *" }),
384
+ /* @__PURE__ */ jsxRuntime.jsx(
385
+ "input",
386
+ {
387
+ className: address_form_default.formControl,
388
+ type: "email",
389
+ placeholder: "Email",
390
+ "aria-label": "email",
391
+ ...formik.getFieldProps("customer_email")
392
+ }
393
+ ),
394
+ formik.touched.customer_email && formik.errors.customer_email && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.customer_email })
395
+ ] }),
396
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
397
+ /* @__PURE__ */ jsxRuntime.jsx("label", { children: "Phone *" }),
398
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.phoneRow, children: [
399
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.phoneCodeCol, children: /* @__PURE__ */ jsxRuntime.jsx(
400
+ search_dropdown_default2,
401
+ {
402
+ options: countryCodeOptions,
403
+ value: formik.values.customer_country_code,
404
+ onChange: handlePhoneCountryChange,
405
+ placeholder: "Country",
406
+ searchPlaceholder: "Search country...",
407
+ maxHeight: "250px"
408
+ }
409
+ ) }),
410
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.phoneInputCol, children: /* @__PURE__ */ jsxRuntime.jsx(
411
+ "input",
412
+ {
413
+ className: address_form_default.formControl,
414
+ type: "tel",
415
+ placeholder: "Phone",
416
+ "aria-label": "phone",
417
+ name: "customer_phone",
418
+ value: formik.values.customer_phone,
419
+ onBlur: formik.handleBlur,
420
+ onChange: handlePhoneChange
421
+ }
422
+ ) })
423
+ ] }),
424
+ formik.touched.customer_phone && formik.errors.customer_phone && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.customer_phone })
425
+ ] }),
426
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: address_form_default.divider }),
427
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
428
+ /* @__PURE__ */ jsxRuntime.jsx("label", { children: "Address (House No, Building, Street, Area) *" }),
429
+ /* @__PURE__ */ jsxRuntime.jsx(
430
+ "input",
431
+ {
432
+ className: address_form_default.formControl,
433
+ type: "text",
434
+ placeholder: "E.g. 1st Cross, 2nd Main, 3rd Stage",
435
+ "aria-label": "address",
436
+ ...formik.getFieldProps("address")
437
+ }
438
+ ),
439
+ formik.touched.address && formik.errors.address && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.address })
440
+ ] }),
441
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.row, children: [
442
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
443
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-capitalize", children: "Country *" }),
444
+ /* @__PURE__ */ jsxRuntime.jsx(
445
+ search_dropdown_default2,
446
+ {
447
+ options: countryCodeOptions,
448
+ value: selectedCountry?.tld_code,
449
+ onChange: handleCountryCodeChange,
450
+ placeholder: "Select country",
451
+ searchPlaceholder: "Search country...",
452
+ maxHeight: "250px",
453
+ name: "country_obj"
454
+ }
455
+ )
456
+ ] }) }),
457
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
458
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { textTransform: "capitalize" }, children: [
459
+ addressMeta?.regionLabel || "State",
460
+ " *"
461
+ ] }),
462
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.selectWrapper, children: [
463
+ /* @__PURE__ */ jsxRuntime.jsxs(
464
+ "select",
465
+ {
466
+ className: address_form_default.formControl,
467
+ "aria-label": "state",
468
+ "data-select": "",
469
+ ...formik.getFieldProps("state_obj"),
470
+ children: [
471
+ /* @__PURE__ */ jsxRuntime.jsxs("option", { value: "", children: [
472
+ "Select ",
473
+ addressMeta?.regionLabel || "State"
474
+ ] }),
475
+ states.map((state) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: state.id, children: state.name }, state.id))
476
+ ]
477
+ }
478
+ ),
479
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.selectArrow, children: /* @__PURE__ */ jsxRuntime.jsx(DownChevron, { width: 12, height: 12 }) })
480
+ ] }),
481
+ formik.touched.state_obj && formik.errors.state_obj && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.state_obj })
482
+ ] }) })
483
+ ] }),
484
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.row, children: [
485
+ addressMeta?.hasPostal && /* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
486
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
487
+ addressMeta?.postalLabel || "Postal Code",
488
+ " *"
489
+ ] }),
490
+ /* @__PURE__ */ jsxRuntime.jsx(
491
+ "input",
492
+ {
493
+ className: address_form_default.formControl,
494
+ type: "tel",
495
+ placeholder: addressMeta?.postalLabel || "Postal Code",
496
+ "aria-label": "pincode",
497
+ ...formik.getFieldProps("pincode")
498
+ }
499
+ ),
500
+ formik.touched.pincode && formik.errors.pincode && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.pincode })
501
+ ] }) }),
502
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
503
+ /* @__PURE__ */ jsxRuntime.jsx("label", { children: "City/District *" }),
504
+ /* @__PURE__ */ jsxRuntime.jsx(
505
+ "input",
506
+ {
507
+ className: address_form_default.formControl,
508
+ type: "text",
509
+ placeholder: "E.g. Kochi, Bangalore",
510
+ "aria-label": "city",
511
+ ...formik.getFieldProps("city")
512
+ }
513
+ ),
514
+ formik.touched.city && formik.errors.city && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.city })
515
+ ] }) })
516
+ ] }),
517
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: address_form_default.divider }),
518
+ showDefaultCheckbox && /* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.formGroup, children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: address_form_default.checkboxLabel, children: [
519
+ /* @__PURE__ */ jsxRuntime.jsx(
520
+ "input",
521
+ {
522
+ type: "checkbox",
523
+ className: address_form_default.checkboxInput,
524
+ checked: formik.values.is_default || false,
525
+ onChange: (e) => {
526
+ formik.setFieldValue("is_default", e.target.checked);
527
+ }
528
+ }
529
+ ),
530
+ "Make this your default address"
531
+ ] }) })
532
+ ] }),
533
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formFooter, children: [
534
+ showCancel && onCancel && /* @__PURE__ */ jsxRuntime.jsx(
535
+ "button",
536
+ {
537
+ type: "button",
538
+ className: address_form_default.cancelBtn,
539
+ onClick: onCancel,
540
+ children: "Cancel"
541
+ }
542
+ ),
543
+ renderButton ? renderButton({
544
+ type: "submit",
545
+ disabled: !formik.isValid || isSubmitting,
546
+ loading: isSubmitting,
547
+ children: isEditing ? submitLabel : submitLabel
548
+ }) : /* @__PURE__ */ jsxRuntime.jsx(
549
+ "button",
550
+ {
551
+ type: "submit",
552
+ disabled: !formik.isValid || isSubmitting,
553
+ className: address_form_default.formControl,
554
+ style: {
555
+ width: "auto",
556
+ cursor: !formik.isValid || isSubmitting ? "not-allowed" : "pointer",
557
+ backgroundColor: "var(--primary, #003d29)",
558
+ color: "var(--btn-text, #fff)",
559
+ border: "none",
560
+ padding: "0.5rem 1.5rem",
561
+ opacity: !formik.isValid || isSubmitting ? 0.6 : 1
562
+ },
563
+ children: isSubmitting ? "Saving..." : submitLabel
564
+ }
565
+ )
566
+ ] })
567
+ ]
568
+ }
569
+ );
570
+ }
571
+ );
572
+ AddressForm.displayName = "AddressForm";
573
+ var address_form_default2 = AddressForm;
574
+
575
+ exports.AddressForm = address_form_default2;
576
+ exports.SearchDropdown = search_dropdown_default2;