@foundrykit/payload-fields 0.0.0-stage → 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 (119) hide show
  1. package/README.md +208 -2
  2. package/dist/exports/client.d.ts +8 -0
  3. package/dist/exports/client.js +10 -0
  4. package/dist/exports/client.js.map +1 -0
  5. package/dist/exports/rsc.d.ts +1 -0
  6. package/dist/exports/rsc.js +3 -0
  7. package/dist/exports/rsc.js.map +1 -0
  8. package/dist/fields/address/AddressInput.d.ts +7 -0
  9. package/dist/fields/address/AddressInput.js +203 -0
  10. package/dist/fields/address/AddressInput.js.map +1 -0
  11. package/dist/fields/address/index.d.ts +8 -0
  12. package/dist/fields/address/index.js +77 -0
  13. package/dist/fields/address/index.js.map +1 -0
  14. package/dist/fields/bestTimeToVisit/MonthRatingField.d.ts +3 -0
  15. package/dist/fields/bestTimeToVisit/MonthRatingField.js +206 -0
  16. package/dist/fields/bestTimeToVisit/MonthRatingField.js.map +1 -0
  17. package/dist/fields/bestTimeToVisit/index.d.ts +6 -0
  18. package/dist/fields/bestTimeToVisit/index.js +82 -0
  19. package/dist/fields/bestTimeToVisit/index.js.map +1 -0
  20. package/dist/fields/budget/PriceInput.d.ts +3 -0
  21. package/dist/fields/budget/PriceInput.js +65 -0
  22. package/dist/fields/budget/PriceInput.js.map +1 -0
  23. package/dist/fields/budget/RowLabel.d.ts +3 -0
  24. package/dist/fields/budget/RowLabel.js +22 -0
  25. package/dist/fields/budget/RowLabel.js.map +1 -0
  26. package/dist/fields/budget/index.d.ts +8 -0
  27. package/dist/fields/budget/index.js +111 -0
  28. package/dist/fields/budget/index.js.map +1 -0
  29. package/dist/fields/changedBy/index.d.ts +11 -0
  30. package/dist/fields/changedBy/index.js +30 -0
  31. package/dist/fields/changedBy/index.js.map +1 -0
  32. package/dist/fields/changedBy/populateChangedBy.d.ts +3 -0
  33. package/dist/fields/changedBy/populateChangedBy.js +12 -0
  34. package/dist/fields/changedBy/populateChangedBy.js.map +1 -0
  35. package/dist/fields/countryCode/index.d.ts +11 -0
  36. package/dist/fields/countryCode/index.js +880 -0
  37. package/dist/fields/countryCode/index.js.map +1 -0
  38. package/dist/fields/dateRange/DateRangeComponent.d.ts +3 -0
  39. package/dist/fields/dateRange/DateRangeComponent.js +77 -0
  40. package/dist/fields/dateRange/DateRangeComponent.js.map +1 -0
  41. package/dist/fields/dateRange/index.d.ts +11 -0
  42. package/dist/fields/dateRange/index.js +26 -0
  43. package/dist/fields/dateRange/index.js.map +1 -0
  44. package/dist/fields/gallery/RowLabel.d.ts +1 -0
  45. package/dist/fields/gallery/RowLabel.js +7 -0
  46. package/dist/fields/gallery/RowLabel.js.map +1 -0
  47. package/dist/fields/gallery/index.d.ts +10 -0
  48. package/dist/fields/gallery/index.js +23 -0
  49. package/dist/fields/gallery/index.js.map +1 -0
  50. package/dist/fields/icon/index.d.ts +8 -0
  51. package/dist/fields/icon/index.js +30 -0
  52. package/dist/fields/icon/index.js.map +1 -0
  53. package/dist/fields/imageMap/ImageMapField.d.ts +13 -0
  54. package/dist/fields/imageMap/ImageMapField.js +67 -0
  55. package/dist/fields/imageMap/ImageMapField.js.map +1 -0
  56. package/dist/fields/imageMap/MapEditor/MapEditor.d.ts +13 -0
  57. package/dist/fields/imageMap/MapEditor/MapEditor.js +225 -0
  58. package/dist/fields/imageMap/MapEditor/MapEditor.js.map +1 -0
  59. package/dist/fields/imageMap/MapEditor/PinContextMenu.d.ts +12 -0
  60. package/dist/fields/imageMap/MapEditor/PinContextMenu.js +61 -0
  61. package/dist/fields/imageMap/MapEditor/PinContextMenu.js.map +1 -0
  62. package/dist/fields/imageMap/MapEditor/WaypointPopover.d.ts +14 -0
  63. package/dist/fields/imageMap/MapEditor/WaypointPopover.js +103 -0
  64. package/dist/fields/imageMap/MapEditor/WaypointPopover.js.map +1 -0
  65. package/dist/fields/imageMap/MapEditor/WaypointSheet.d.ts +9 -0
  66. package/dist/fields/imageMap/MapEditor/WaypointSheet.js +190 -0
  67. package/dist/fields/imageMap/MapEditor/WaypointSheet.js.map +1 -0
  68. package/dist/fields/imageMap/MapEditor/WaypointSheet.scss +128 -0
  69. package/dist/fields/imageMap/MapEditor/map-editor.scss +556 -0
  70. package/dist/fields/imageMap/MapEditor/types.d.ts +20 -0
  71. package/dist/fields/imageMap/MapEditor/types.js +3 -0
  72. package/dist/fields/imageMap/MapEditor/types.js.map +1 -0
  73. package/dist/fields/imageMap/index.d.ts +16 -0
  74. package/dist/fields/imageMap/index.js +35 -0
  75. package/dist/fields/imageMap/index.js.map +1 -0
  76. package/dist/fields/link/index.d.ts +21 -0
  77. package/dist/fields/link/index.js +134 -0
  78. package/dist/fields/link/index.js.map +1 -0
  79. package/dist/fields/link/resolveLink.d.ts +28 -0
  80. package/dist/fields/link/resolveLink.js +26 -0
  81. package/dist/fields/link/resolveLink.js.map +1 -0
  82. package/dist/fields/openingTimes/RowLabel.d.ts +2 -0
  83. package/dist/fields/openingTimes/RowLabel.js +12 -0
  84. package/dist/fields/openingTimes/RowLabel.js.map +1 -0
  85. package/dist/fields/openingTimes/index.d.ts +8 -0
  86. package/dist/fields/openingTimes/index.js +22 -0
  87. package/dist/fields/openingTimes/index.js.map +1 -0
  88. package/dist/fields/openingTimes/opening-time.d.ts +6 -0
  89. package/dist/fields/openingTimes/opening-time.js +37 -0
  90. package/dist/fields/openingTimes/opening-time.js.map +1 -0
  91. package/dist/fields/slug/SlugComponent.d.ts +9 -0
  92. package/dist/fields/slug/SlugComponent.js +72 -0
  93. package/dist/fields/slug/SlugComponent.js.map +1 -0
  94. package/dist/fields/slug/formatSlug.d.ts +3 -0
  95. package/dist/fields/slug/formatSlug.js +17 -0
  96. package/dist/fields/slug/formatSlug.js.map +1 -0
  97. package/dist/fields/slug/index.css +11 -0
  98. package/dist/fields/slug/index.d.ts +12 -0
  99. package/dist/fields/slug/index.js +49 -0
  100. package/dist/fields/slug/index.js.map +1 -0
  101. package/dist/fields/socials/index.d.ts +7 -0
  102. package/dist/fields/socials/index.js +70 -0
  103. package/dist/fields/socials/index.js.map +1 -0
  104. package/dist/fields/tags/RowLabel.d.ts +2 -0
  105. package/dist/fields/tags/RowLabel.js +12 -0
  106. package/dist/fields/tags/RowLabel.js.map +1 -0
  107. package/dist/fields/tags/index.d.ts +10 -0
  108. package/dist/fields/tags/index.js +22 -0
  109. package/dist/fields/tags/index.js.map +1 -0
  110. package/dist/fields/tags/tag.d.ts +6 -0
  111. package/dist/fields/tags/tag.js +18 -0
  112. package/dist/fields/tags/tag.js.map +1 -0
  113. package/dist/index.d.ts +18 -0
  114. package/dist/index.js +21 -0
  115. package/dist/index.js.map +1 -0
  116. package/dist/utilities/deepMerge.d.ts +4 -0
  117. package/dist/utilities/deepMerge.js +30 -0
  118. package/dist/utilities/deepMerge.js.map +1 -0
  119. package/package.json +120 -4
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/fields/countryCode/index.ts"],"sourcesContent":["import type { SelectField } from 'payload';\n\nexport const ISO_COUNTRY_OPTIONS: { label: string; value: string }[] = [\n { label: 'Afghanistan', value: 'AF' },\n { label: 'Albania', value: 'AL' },\n { label: 'Algeria', value: 'DZ' },\n { label: 'American Samoa', value: 'AS' },\n { label: 'Andorra', value: 'AD' },\n { label: 'Angola', value: 'AO' },\n { label: 'Anguilla', value: 'AI' },\n { label: 'Antarctica', value: 'AQ' },\n { label: 'Antigua and Barbuda', value: 'AG' },\n { label: 'Argentina', value: 'AR' },\n { label: 'Armenia', value: 'AM' },\n { label: 'Aruba', value: 'AW' },\n { label: 'Australia', value: 'AU' },\n { label: 'Austria', value: 'AT' },\n { label: 'Azerbaijan', value: 'AZ' },\n { label: 'Bahamas', value: 'BS' },\n { label: 'Bahrain', value: 'BH' },\n { label: 'Bangladesh', value: 'BD' },\n { label: 'Barbados', value: 'BB' },\n { label: 'Belarus', value: 'BY' },\n { label: 'Belgium', value: 'BE' },\n { label: 'Belize', value: 'BZ' },\n { label: 'Benin', value: 'BJ' },\n { label: 'Bermuda', value: 'BM' },\n { label: 'Bhutan', value: 'BT' },\n { label: 'Bolivia', value: 'BO' },\n { label: 'Bosnia and Herzegovina', value: 'BA' },\n { label: 'Botswana', value: 'BW' },\n { label: 'Brazil', value: 'BR' },\n { label: 'British Virgin Islands', value: 'VG' },\n { label: 'Brunei', value: 'BN' },\n { label: 'Bulgaria', value: 'BG' },\n { label: 'Burkina Faso', value: 'BF' },\n { label: 'Burundi', value: 'BI' },\n { label: 'Cabo Verde', value: 'CV' },\n { label: 'Cambodia', value: 'KH' },\n { label: 'Cameroon', value: 'CM' },\n { label: 'Canada', value: 'CA' },\n { label: 'Cayman Islands', value: 'KY' },\n { label: 'Central African Republic', value: 'CF' },\n { label: 'Chad', value: 'TD' },\n { label: 'Chile', value: 'CL' },\n { label: 'China', value: 'CN' },\n { label: 'Colombia', value: 'CO' },\n { label: 'Comoros', value: 'KM' },\n { label: 'Congo (DRC)', value: 'CD' },\n { label: 'Congo', value: 'CG' },\n { label: 'Cook Islands', value: 'CK' },\n { label: 'Costa Rica', value: 'CR' },\n { label: \"Côte d'Ivoire\", value: 'CI' },\n { label: 'Croatia', value: 'HR' },\n { label: 'Cuba', value: 'CU' },\n { label: 'Curaçao', value: 'CW' },\n { label: 'Cyprus', value: 'CY' },\n { label: 'Czech Republic', value: 'CZ' },\n { label: 'Denmark', value: 'DK' },\n { label: 'Djibouti', value: 'DJ' },\n { label: 'Dominica', value: 'DM' },\n { label: 'Dominican Republic', value: 'DO' },\n { label: 'Ecuador', value: 'EC' },\n { label: 'Egypt', value: 'EG' },\n { label: 'El Salvador', value: 'SV' },\n { label: 'Equatorial Guinea', value: 'GQ' },\n { label: 'Eritrea', value: 'ER' },\n { label: 'Estonia', value: 'EE' },\n { label: 'Eswatini', value: 'SZ' },\n { label: 'Ethiopia', value: 'ET' },\n { label: 'Falkland Islands', value: 'FK' },\n { label: 'Faroe Islands', value: 'FO' },\n { label: 'Fiji', value: 'FJ' },\n { label: 'Finland', value: 'FI' },\n { label: 'France', value: 'FR' },\n { label: 'French Polynesia', value: 'PF' },\n { label: 'Gabon', value: 'GA' },\n { label: 'Gambia', value: 'GM' },\n { label: 'Georgia', value: 'GE' },\n { label: 'Germany', value: 'DE' },\n { label: 'Ghana', value: 'GH' },\n { label: 'Gibraltar', value: 'GI' },\n { label: 'Greece', value: 'GR' },\n { label: 'Greenland', value: 'GL' },\n { label: 'Grenada', value: 'GD' },\n { label: 'Guatemala', value: 'GT' },\n { label: 'Guinea', value: 'GN' },\n { label: 'Guinea-Bissau', value: 'GW' },\n { label: 'Guyana', value: 'GY' },\n { label: 'Haiti', value: 'HT' },\n { label: 'Honduras', value: 'HN' },\n { label: 'Hong Kong', value: 'HK' },\n { label: 'Hungary', value: 'HU' },\n { label: 'Iceland', value: 'IS' },\n { label: 'India', value: 'IN' },\n { label: 'Indonesia', value: 'ID' },\n { label: 'Iran', value: 'IR' },\n { label: 'Iraq', value: 'IQ' },\n { label: 'Ireland', value: 'IE' },\n { label: 'Israel', value: 'IL' },\n { label: 'Italy', value: 'IT' },\n { label: 'Jamaica', value: 'JM' },\n { label: 'Japan', value: 'JP' },\n { label: 'Jordan', value: 'JO' },\n { label: 'Kazakhstan', value: 'KZ' },\n { label: 'Kenya', value: 'KE' },\n { label: 'Kiribati', value: 'KI' },\n { label: 'Kuwait', value: 'KW' },\n { label: 'Kyrgyzstan', value: 'KG' },\n { label: 'Laos', value: 'LA' },\n { label: 'Latvia', value: 'LV' },\n { label: 'Lebanon', value: 'LB' },\n { label: 'Lesotho', value: 'LS' },\n { label: 'Liberia', value: 'LR' },\n { label: 'Libya', value: 'LY' },\n { label: 'Liechtenstein', value: 'LI' },\n { label: 'Lithuania', value: 'LT' },\n { label: 'Luxembourg', value: 'LU' },\n { label: 'Macao', value: 'MO' },\n { label: 'Madagascar', value: 'MG' },\n { label: 'Malawi', value: 'MW' },\n { label: 'Malaysia', value: 'MY' },\n { label: 'Maldives', value: 'MV' },\n { label: 'Mali', value: 'ML' },\n { label: 'Malta', value: 'MT' },\n { label: 'Marshall Islands', value: 'MH' },\n { label: 'Mauritania', value: 'MR' },\n { label: 'Mauritius', value: 'MU' },\n { label: 'Mexico', value: 'MX' },\n { label: 'Micronesia', value: 'FM' },\n { label: 'Moldova', value: 'MD' },\n { label: 'Monaco', value: 'MC' },\n { label: 'Mongolia', value: 'MN' },\n { label: 'Montenegro', value: 'ME' },\n { label: 'Montserrat', value: 'MS' },\n { label: 'Morocco', value: 'MA' },\n { label: 'Mozambique', value: 'MZ' },\n { label: 'Myanmar', value: 'MM' },\n { label: 'Namibia', value: 'NA' },\n { label: 'Nauru', value: 'NR' },\n { label: 'Nepal', value: 'NP' },\n { label: 'Netherlands', value: 'NL' },\n { label: 'New Caledonia', value: 'NC' },\n { label: 'New Zealand', value: 'NZ' },\n { label: 'Nicaragua', value: 'NI' },\n { label: 'Niger', value: 'NE' },\n { label: 'Nigeria', value: 'NG' },\n { label: 'North Korea', value: 'KP' },\n { label: 'North Macedonia', value: 'MK' },\n { label: 'Norway', value: 'NO' },\n { label: 'Oman', value: 'OM' },\n { label: 'Pakistan', value: 'PK' },\n { label: 'Palau', value: 'PW' },\n { label: 'Palestine', value: 'PS' },\n { label: 'Panama', value: 'PA' },\n { label: 'Papua New Guinea', value: 'PG' },\n { label: 'Paraguay', value: 'PY' },\n { label: 'Peru', value: 'PE' },\n { label: 'Philippines', value: 'PH' },\n { label: 'Poland', value: 'PL' },\n { label: 'Portugal', value: 'PT' },\n { label: 'Qatar', value: 'QA' },\n { label: 'Réunion Island', value: 'RE' },\n { label: 'Romania', value: 'RO' },\n { label: 'Russia', value: 'RU' },\n { label: 'Rwanda', value: 'RW' },\n { label: 'Saint Barthélemy', value: 'BL' },\n { label: 'Saint Kitts and Nevis', value: 'KN' },\n { label: 'Saint Lucia', value: 'LC' },\n { label: 'Saint Vincent and the Grenadines', value: 'VC' },\n { label: 'Samoa', value: 'WS' },\n { label: 'San Marino', value: 'SM' },\n { label: 'São Tomé and Príncipe', value: 'ST' },\n { label: 'Saudi Arabia', value: 'SA' },\n { label: 'Scotland', value: 'GB-SCT' },\n { label: 'Senegal', value: 'SN' },\n { label: 'Serbia', value: 'RS' },\n { label: 'Seychelles', value: 'SC' },\n { label: 'Sierra Leone', value: 'SL' },\n { label: 'Singapore', value: 'SG' },\n { label: 'Slovakia', value: 'SK' },\n { label: 'Slovenia', value: 'SI' },\n { label: 'Solomon Islands', value: 'SB' },\n { label: 'Somalia', value: 'SO' },\n { label: 'South Africa', value: 'ZA' },\n { label: 'South Korea', value: 'KR' },\n { label: 'South Sudan', value: 'SS' },\n { label: 'Spain', value: 'ES' },\n { label: 'Sri Lanka', value: 'LK' },\n { label: 'Sudan', value: 'SD' },\n { label: 'Suriname', value: 'SR' },\n { label: 'Sweden', value: 'SE' },\n { label: 'Switzerland', value: 'CH' },\n { label: 'Syria', value: 'SY' },\n { label: 'Taiwan', value: 'TW' },\n { label: 'Tajikistan', value: 'TJ' },\n { label: 'Tanzania & Zanzibar', value: 'TZ' },\n { label: 'Thailand', value: 'TH' },\n { label: 'Timor-Leste', value: 'TL' },\n { label: 'Togo', value: 'TG' },\n { label: 'Tonga', value: 'TO' },\n { label: 'Trinidad and Tobago', value: 'TT' },\n { label: 'Tunisia', value: 'TN' },\n { label: 'Turkey', value: 'TR' },\n { label: 'Turkmenistan', value: 'TM' },\n { label: 'Turks and Caicos Islands', value: 'TC' },\n { label: 'Uganda', value: 'UG' },\n { label: 'Ukraine', value: 'UA' },\n { label: 'United Arab Emirates', value: 'AE' },\n { label: 'United Kingdom', value: 'GB' },\n { label: 'United States', value: 'US' },\n { label: 'Uruguay', value: 'UY' },\n { label: 'Uzbekistan', value: 'UZ' },\n { label: 'Vanuatu', value: 'VU' },\n { label: 'Venezuela', value: 'VE' },\n { label: 'Vietnam', value: 'VN' },\n { label: 'Yemen', value: 'YE' },\n { label: 'Zambia', value: 'ZM' },\n { label: 'Zimbabwe', value: 'ZW' },\n];\n\ntype CountryCodeFieldOptions = {\n required?: boolean;\n admin?: Partial<SelectField['admin']>;\n};\n\nexport const countryCodeField = ({\n required = false,\n admin = {},\n}: CountryCodeFieldOptions = {}): SelectField => ({\n name: 'countryCode',\n type: 'select',\n required,\n label: 'Country Code',\n options: ISO_COUNTRY_OPTIONS,\n admin: {\n description:\n 'ISO 3166-1 alpha-2 code — required for the interactive destinations map. Type to search.',\n isClearable: true,\n ...admin,\n },\n});\n"],"names":["ISO_COUNTRY_OPTIONS","label","value","countryCodeField","required","admin","name","type","options","description","isClearable"],"mappings":"AAEA,OAAO,MAAMA,sBAA0D;IACrE;QAAEC,OAAO;QAAeC,OAAO;IAAK;IACpC;QAAED,OAAO;QAAWC,OAAO;IAAK;IAChC;QAAED,OAAO;QAAWC,OAAO;IAAK;IAChC;QAAED,OAAO;QAAkBC,OAAO;IAAK;IACvC;QAAED,OAAO;QAAWC,OAAO;IAAK;IAChC;QAAED,OAAO;QAAUC,OAAO;IAAK;IAC/B;QAAED,OAAO;QAAYC,OAAO;IAAK;IACjC;QAAED,OAAO;QAAcC,OAAO;IAAK;IACnC;QAAED,OAAO;QAAuBC,OAAO;IAAK;IAC5C;QAAED,OAAO;QAAaC,OAAO;IAAK;IAClC;QAAED,OAAO;QAAWC,OAAO;IAAK;IAChC;QAAED,OAAO;QAASC,OAAO;IAAK;IAC9B;QAAED,OAAO;QAAaC,OAAO;IAAK;IAClC;QAAED,OAAO;QAAWC,OAAO;IAAK;IAChC;QAAED,OAAO;QAAcC,OAAO;IAAK;IACnC;QAAED,OAAO;QAAWC,OAAO;IAAK;IAChC;QAAED,OAAO;QAAWC,OAAO;IAAK;IAChC;QAAED,OAAO;QAAcC,OAAO;IAAK;IACnC;QAAED,OAAO;QAAYC,OAAO;IAAK;IACjC;QAAED,OAAO;QAAWC,OAAO;IAAK;IAChC;QAAED,OAAO;QAAWC,OAAO;IAAK;IAChC;QAAED,OAAO;QAAUC,OAAO;IAAK;IAC/B;QAAED,OAAO;QAASC,OAAO;IAAK;IAC9B;QAAED,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C,CAAC,GAAmB,CAAA;QAChDC,MAAM;QACNC,MAAM;QACNH;QACAH,OAAO;QACPO,SAASR;QACTK,OAAO;YACLI,aACE;YACFC,aAAa;YACb,GAAGL,KAAK;QACV;IACF,CAAA,EAAG"}
@@ -0,0 +1,3 @@
1
+ import type { GroupFieldClientProps } from 'payload';
2
+ import type React from 'react';
3
+ export declare const DateRangeComponent: React.FC<GroupFieldClientProps>;
@@ -0,0 +1,77 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { DatePicker, FieldDescription, FieldError, FieldLabel, useField } from '@payloadcms/ui';
4
+ export const DateRangeComponent = ({ field, path, readOnly })=>{
5
+ const { label, admin: { description } = {} } = field;
6
+ const fromPath = `${path}.from`;
7
+ const toPath = `${path}.to`;
8
+ const { value: fromValue, setValue: setFromValue, showError: showFromError } = useField({
9
+ path: fromPath
10
+ });
11
+ const { value: toValue, setValue: setToValue, showError: showToError } = useField({
12
+ path: toPath
13
+ });
14
+ return /*#__PURE__*/ _jsxs("div", {
15
+ className: "field-type group date-range-field",
16
+ children: [
17
+ /*#__PURE__*/ _jsx(FieldLabel, {
18
+ label: label
19
+ }),
20
+ /*#__PURE__*/ _jsxs("div", {
21
+ className: "date-range-field__inputs",
22
+ style: {
23
+ display: 'flex',
24
+ gap: '1rem'
25
+ },
26
+ children: [
27
+ /*#__PURE__*/ _jsxs("div", {
28
+ className: "date-range-field__input",
29
+ style: {
30
+ width: '100%'
31
+ },
32
+ children: [
33
+ /*#__PURE__*/ _jsx(FieldLabel, {
34
+ label: "From"
35
+ }),
36
+ showFromError && /*#__PURE__*/ _jsx(FieldError, {
37
+ path: fromPath
38
+ }),
39
+ /*#__PURE__*/ _jsx(DatePicker, {
40
+ pickerAppearance: "monthOnly",
41
+ onChange: (date)=>setFromValue(date ? date.toISOString() : null),
42
+ value: fromValue ? new Date(fromValue) : undefined,
43
+ readOnly: readOnly
44
+ })
45
+ ]
46
+ }),
47
+ /*#__PURE__*/ _jsxs("div", {
48
+ className: "date-range-field__input",
49
+ style: {
50
+ width: '100%'
51
+ },
52
+ children: [
53
+ /*#__PURE__*/ _jsx(FieldLabel, {
54
+ label: "To"
55
+ }),
56
+ showToError && /*#__PURE__*/ _jsx(FieldError, {
57
+ path: toPath
58
+ }),
59
+ /*#__PURE__*/ _jsx(DatePicker, {
60
+ pickerAppearance: "monthOnly",
61
+ onChange: (date)=>setToValue(date ? date.toISOString() : null),
62
+ value: toValue ? new Date(toValue) : undefined,
63
+ readOnly: readOnly
64
+ })
65
+ ]
66
+ })
67
+ ]
68
+ }),
69
+ description && /*#__PURE__*/ _jsx(FieldDescription, {
70
+ description: description,
71
+ path: path
72
+ })
73
+ ]
74
+ });
75
+ };
76
+
77
+ //# sourceMappingURL=DateRangeComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/fields/dateRange/DateRangeComponent.tsx"],"sourcesContent":["'use client';\nimport {\n DatePicker,\n FieldDescription,\n FieldError,\n FieldLabel,\n useField,\n} from '@payloadcms/ui';\nimport type { GroupFieldClientProps } from 'payload';\nimport type React from 'react';\n\nexport const DateRangeComponent: React.FC<GroupFieldClientProps> = ({\n field,\n path,\n readOnly,\n}) => {\n const { label, admin: { description } = {} } = field;\n const fromPath = `${path}.from`;\n const toPath = `${path}.to`;\n\n const {\n value: fromValue,\n setValue: setFromValue,\n showError: showFromError,\n } = useField<string>({ path: fromPath });\n const {\n value: toValue,\n setValue: setToValue,\n showError: showToError,\n } = useField<string>({ path: toPath });\n\n return (\n <div className='field-type group date-range-field'>\n <FieldLabel label={label} />\n <div\n className='date-range-field__inputs'\n style={{ display: 'flex', gap: '1rem' }}\n >\n <div className='date-range-field__input' style={{ width: '100%' }}>\n <FieldLabel label='From' />\n {showFromError && <FieldError path={fromPath} />}\n <DatePicker\n pickerAppearance='monthOnly'\n onChange={(date: Date) =>\n setFromValue(date ? date.toISOString() : null)\n }\n value={fromValue ? new Date(fromValue) : undefined}\n readOnly={readOnly}\n />\n </div>\n <div className='date-range-field__input' style={{ width: '100%' }}>\n <FieldLabel label='To' />\n {showToError && <FieldError path={toPath} />}\n <DatePicker\n pickerAppearance='monthOnly'\n onChange={(date: Date) =>\n setToValue(date ? date.toISOString() : null)\n }\n value={toValue ? new Date(toValue) : undefined}\n readOnly={readOnly}\n />\n </div>\n </div>\n {description && (\n <FieldDescription description={description as string} path={path} />\n )}\n </div>\n );\n};\n"],"names":["DatePicker","FieldDescription","FieldError","FieldLabel","useField","DateRangeComponent","field","path","readOnly","label","admin","description","fromPath","toPath","value","fromValue","setValue","setFromValue","showError","showFromError","toValue","setToValue","showToError","div","className","style","display","gap","width","pickerAppearance","onChange","date","toISOString","Date","undefined"],"mappings":"AAAA;;AACA,SACEA,UAAU,EACVC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,QAAQ,QACH,iBAAiB;AAIxB,OAAO,MAAMC,qBAAsD,CAAC,EAClEC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACT;IACC,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAG,CAAC,CAAC,EAAE,GAAGL;IAC/C,MAAMM,WAAW,GAAGL,KAAK,KAAK,CAAC;IAC/B,MAAMM,SAAS,GAAGN,KAAK,GAAG,CAAC;IAE3B,MAAM,EACJO,OAAOC,SAAS,EAChBC,UAAUC,YAAY,EACtBC,WAAWC,aAAa,EACzB,GAAGf,SAAiB;QAAEG,MAAMK;IAAS;IACtC,MAAM,EACJE,OAAOM,OAAO,EACdJ,UAAUK,UAAU,EACpBH,WAAWI,WAAW,EACvB,GAAGlB,SAAiB;QAAEG,MAAMM;IAAO;IAEpC,qBACE,MAACU;QAAIC,WAAU;;0BACb,KAACrB;gBAAWM,OAAOA;;0BACnB,MAACc;gBACCC,WAAU;gBACVC,OAAO;oBAAEC,SAAS;oBAAQC,KAAK;gBAAO;;kCAEtC,MAACJ;wBAAIC,WAAU;wBAA0BC,OAAO;4BAAEG,OAAO;wBAAO;;0CAC9D,KAACzB;gCAAWM,OAAM;;4BACjBU,+BAAiB,KAACjB;gCAAWK,MAAMK;;0CACpC,KAACZ;gCACC6B,kBAAiB;gCACjBC,UAAU,CAACC,OACTd,aAAac,OAAOA,KAAKC,WAAW,KAAK;gCAE3ClB,OAAOC,YAAY,IAAIkB,KAAKlB,aAAamB;gCACzC1B,UAAUA;;;;kCAGd,MAACe;wBAAIC,WAAU;wBAA0BC,OAAO;4BAAEG,OAAO;wBAAO;;0CAC9D,KAACzB;gCAAWM,OAAM;;4BACjBa,6BAAe,KAACpB;gCAAWK,MAAMM;;0CAClC,KAACb;gCACC6B,kBAAiB;gCACjBC,UAAU,CAACC,OACTV,WAAWU,OAAOA,KAAKC,WAAW,KAAK;gCAEzClB,OAAOM,UAAU,IAAIa,KAAKb,WAAWc;gCACrC1B,UAAUA;;;;;;YAIfG,6BACC,KAACV;gBAAiBU,aAAaA;gBAAuBJ,MAAMA;;;;AAIpE,EAAE"}
@@ -0,0 +1,11 @@
1
+ import type { GroupField } from 'payload';
2
+ type DateRangeFieldOptions = {
3
+ name: string;
4
+ label?: string;
5
+ description?: string;
6
+ required?: boolean;
7
+ admin?: Partial<GroupField['admin']>;
8
+ };
9
+ /** A from/to date pair rendered as two month pickers side by side. */
10
+ export declare const dateRangeField: ({ name, label, description, required, admin, }: DateRangeFieldOptions) => GroupField;
11
+ export {};
@@ -0,0 +1,26 @@
1
+ /** A from/to date pair rendered as two month pickers side by side. */ export const dateRangeField = ({ name, label, description, required = false, admin = {} })=>({
2
+ name,
3
+ type: 'group',
4
+ label: label ?? false,
5
+ admin: {
6
+ ...admin,
7
+ description,
8
+ components: {
9
+ Field: '@foundrykit/payload-fields/client#DateRangeComponent'
10
+ }
11
+ },
12
+ fields: [
13
+ {
14
+ name: 'from',
15
+ type: 'date',
16
+ required
17
+ },
18
+ {
19
+ name: 'to',
20
+ type: 'date',
21
+ required
22
+ }
23
+ ]
24
+ });
25
+
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/fields/dateRange/index.ts"],"sourcesContent":["import type { GroupField } from 'payload';\n\ntype DateRangeFieldOptions = {\n name: string;\n label?: string;\n description?: string;\n required?: boolean;\n admin?: Partial<GroupField['admin']>;\n};\n\n/** A from/to date pair rendered as two month pickers side by side. */\nexport const dateRangeField = ({\n name,\n label,\n description,\n required = false,\n admin = {},\n}: DateRangeFieldOptions): GroupField => ({\n name,\n type: 'group',\n label: label ?? false,\n admin: {\n ...admin,\n description,\n components: {\n Field: '@foundrykit/payload-fields/client#DateRangeComponent',\n },\n },\n fields: [\n { name: 'from', type: 'date', required },\n { name: 'to', type: 'date', required },\n ],\n});\n"],"names":["dateRangeField","name","label","description","required","admin","type","components","Field","fields"],"mappings":"AAUA,oEAAoE,GACpE,OAAO,MAAMA,iBAAiB,CAAC,EAC7BC,IAAI,EACJC,KAAK,EACLC,WAAW,EACXC,WAAW,KAAK,EAChBC,QAAQ,CAAC,CAAC,EACY,GAAkB,CAAA;QACxCJ;QACAK,MAAM;QACNJ,OAAOA,SAAS;QAChBG,OAAO;YACL,GAAGA,KAAK;YACRF;YACAI,YAAY;gBACVC,OAAO;YACT;QACF;QACAC,QAAQ;YACN;gBAAER,MAAM;gBAAQK,MAAM;gBAAQF;YAAS;YACvC;gBAAEH,MAAM;gBAAMK,MAAM;gBAAQF;YAAS;SACtC;IACH,CAAA,EAAG"}
@@ -0,0 +1 @@
1
+ export declare const GalleryLabel: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export const GalleryLabel = ()=>/*#__PURE__*/ _jsx("div", {
4
+ children: "Gallery"
5
+ });
6
+
7
+ //# sourceMappingURL=RowLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/fields/gallery/RowLabel.tsx"],"sourcesContent":["'use client';\nexport const GalleryLabel = () => <div>Gallery</div>;\n"],"names":["GalleryLabel","div"],"mappings":"AAAA;;AACA,OAAO,MAAMA,eAAe,kBAAM,KAACC;kBAAI;OAAc"}
@@ -0,0 +1,10 @@
1
+ import type { ArrayField, CollectionSlug, Field } from 'payload';
2
+ type GalleryOptions = {
3
+ sidebar?: boolean;
4
+ /** Upload collection for the images. Default `media`. */
5
+ relationTo?: CollectionSlug;
6
+ overrides?: Partial<ArrayField>;
7
+ };
8
+ /** An array of `{ image, caption }` rows, named `gallery`. */
9
+ export declare const gallery: ({ sidebar, relationTo, overrides, }?: GalleryOptions) => Field;
10
+ export {};
@@ -0,0 +1,23 @@
1
+ import deepMerge from '../../utilities/deepMerge.js';
2
+ /** An array of `{ image, caption }` rows, named `gallery`. */ export const gallery = ({ sidebar = false, relationTo = 'media', overrides = {} } = {})=>deepMerge({
3
+ name: 'gallery',
4
+ label: 'Gallery',
5
+ type: 'array',
6
+ admin: {
7
+ position: sidebar ? 'sidebar' : undefined
8
+ },
9
+ fields: [
10
+ {
11
+ name: 'image',
12
+ type: 'upload',
13
+ relationTo,
14
+ required: true
15
+ },
16
+ {
17
+ name: 'caption',
18
+ type: 'text'
19
+ }
20
+ ]
21
+ }, overrides);
22
+
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/fields/gallery/index.ts"],"sourcesContent":["import type { ArrayField, CollectionSlug, Field } from 'payload';\nimport deepMerge from '../../utilities/deepMerge.js';\n\ntype GalleryOptions = {\n sidebar?: boolean;\n /** Upload collection for the images. Default `media`. */\n relationTo?: CollectionSlug;\n overrides?: Partial<ArrayField>;\n};\n\n/** An array of `{ image, caption }` rows, named `gallery`. */\nexport const gallery = ({\n sidebar = false,\n relationTo = 'media' as CollectionSlug,\n overrides = {},\n}: GalleryOptions = {}): Field =>\n deepMerge(\n {\n name: 'gallery',\n label: 'Gallery',\n type: 'array',\n admin: { position: sidebar ? 'sidebar' : undefined },\n fields: [\n { name: 'image', type: 'upload', relationTo, required: true },\n { name: 'caption', type: 'text' },\n ],\n } satisfies ArrayField,\n overrides\n );\n"],"names":["deepMerge","gallery","sidebar","relationTo","overrides","name","label","type","admin","position","undefined","fields","required"],"mappings":"AACA,OAAOA,eAAe,+BAA+B;AASrD,4DAA4D,GAC5D,OAAO,MAAMC,UAAU,CAAC,EACtBC,UAAU,KAAK,EACfC,aAAa,OAAyB,EACtCC,YAAY,CAAC,CAAC,EACC,GAAG,CAAC,CAAC,GACpBJ,UACE;QACEK,MAAM;QACNC,OAAO;QACPC,MAAM;QACNC,OAAO;YAAEC,UAAUP,UAAU,YAAYQ;QAAU;QACnDC,QAAQ;YACN;gBAAEN,MAAM;gBAASE,MAAM;gBAAUJ;gBAAYS,UAAU;YAAK;YAC5D;gBAAEP,MAAM;gBAAWE,MAAM;YAAO;SACjC;IACH,GACAH,WACA"}
@@ -0,0 +1,8 @@
1
+ import type { Field, Option, SelectField } from 'payload';
2
+ /** The icon names the client sites share. Pass your own `options` to match your icon component. */
3
+ export declare const ICONS: Option[];
4
+ /** A select of icon names, named `icon`. Stores the name; your frontend maps it to an SVG. */
5
+ export declare const icon: ({ options, overrides, }?: {
6
+ options?: Option[];
7
+ overrides?: Partial<SelectField>;
8
+ }) => Field;
@@ -0,0 +1,30 @@
1
+ import deepMerge from '../../utilities/deepMerge.js';
2
+ /** The icon names the client sites share. Pass your own `options` to match your icon component. */ export const ICONS = [
3
+ 'check',
4
+ 'cross',
5
+ 'star',
6
+ 'wifi',
7
+ 'parking',
8
+ 'wheelchair',
9
+ 'kitchen',
10
+ 'bed',
11
+ 'bath',
12
+ 'coffee',
13
+ 'tea',
14
+ 'pool',
15
+ 'golf',
16
+ 'facebook',
17
+ 'instagram',
18
+ 'x',
19
+ 'linkedin',
20
+ 'youtube',
21
+ 'tiktok',
22
+ 'whatsapp'
23
+ ];
24
+ /** A select of icon names, named `icon`. Stores the name; your frontend maps it to an SVG. */ export const icon = ({ options = ICONS, overrides = {} } = {})=>deepMerge({
25
+ name: 'icon',
26
+ type: 'select',
27
+ options
28
+ }, overrides);
29
+
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/fields/icon/index.ts"],"sourcesContent":["import type { Field, Option, SelectField } from 'payload';\nimport deepMerge from '../../utilities/deepMerge.js';\n\n/** The icon names the client sites share. Pass your own `options` to match your icon component. */\nexport const ICONS: Option[] = [\n 'check',\n 'cross',\n 'star',\n 'wifi',\n 'parking',\n 'wheelchair',\n 'kitchen',\n 'bed',\n 'bath',\n 'coffee',\n 'tea',\n 'pool',\n 'golf',\n 'facebook',\n 'instagram',\n 'x',\n 'linkedin',\n 'youtube',\n 'tiktok',\n 'whatsapp',\n];\n\n/** A select of icon names, named `icon`. Stores the name; your frontend maps it to an SVG. */\nexport const icon = ({\n options = ICONS,\n overrides = {},\n}: {\n options?: Option[];\n overrides?: Partial<SelectField>;\n} = {}): Field =>\n deepMerge(\n { name: 'icon', type: 'select', options } satisfies SelectField,\n overrides\n );\n"],"names":["deepMerge","ICONS","icon","options","overrides","name","type"],"mappings":"AACA,OAAOA,eAAe,+BAA+B;AAErD,iGAAiG,GACjG,OAAO,MAAMC,QAAkB;IAC7B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAC;AAEF,4FAA4F,GAC5F,OAAO,MAAMC,OAAO,CAAC,EACnBC,UAAUF,KAAK,EACfG,YAAY,CAAC,CAAC,EAIf,GAAG,CAAC,CAAC,GACJJ,UACE;QAAEK,MAAM;QAAQC,MAAM;QAAUH;IAAQ,GACxCC,WACA"}
@@ -0,0 +1,13 @@
1
+ import type { JSONFieldClientProps } from 'payload';
2
+ type ImageMapFieldProps = JSONFieldClientProps & {
3
+ /** Upload collection slug for the base image, injected via clientProps. */
4
+ mediaSlug?: string;
5
+ };
6
+ /**
7
+ * Client Field for the `map` JSON value. Reads the sibling `image` upload id,
8
+ * fetches that media doc for its URL/dimensions, and renders the editor. All
9
+ * pin edits are written straight back to the field via `useField` — Payload
10
+ * persists them on save, so there's no bespoke endpoint.
11
+ */
12
+ export declare const ImageMapField: ({ field, path, mediaSlug, }: ImageMapFieldProps) => import("react/jsx-runtime").JSX.Element;
13
+ export default ImageMapField;
@@ -0,0 +1,67 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { FieldLabel, useField, useFormFields } from '@payloadcms/ui';
4
+ import { useEffect, useState } from 'react';
5
+ import MapEditor from './MapEditor/MapEditor.js';
6
+ /**
7
+ * Client Field for the `map` JSON value. Reads the sibling `image` upload id,
8
+ * fetches that media doc for its URL/dimensions, and renders the editor. All
9
+ * pin edits are written straight back to the field via `useField` — Payload
10
+ * persists them on save, so there's no bespoke endpoint.
11
+ */ export const ImageMapField = ({ field, path, mediaSlug = 'media' })=>{
12
+ const { value, setValue } = useField({
13
+ path: path || field.name
14
+ });
15
+ // Sibling `image` upload id lives one level up (…imageMap.image).
16
+ const basePath = (path || field.name).split('.').slice(0, -1).join('.');
17
+ const imagePath = basePath ? `${basePath}.image` : 'image';
18
+ const imageId = useFormFields(([fields])=>fields[imagePath]?.value);
19
+ const [image, setImage] = useState(null);
20
+ useEffect(()=>{
21
+ let cancelled = false;
22
+ if (!imageId) {
23
+ setImage(null);
24
+ return;
25
+ }
26
+ fetch(`/api/${mediaSlug}/${imageId}?depth=0`).then((r)=>r.ok ? r.json() : null).then((doc)=>{
27
+ if (!cancelled && doc) {
28
+ setImage({
29
+ url: doc.url,
30
+ alt: doc.alt,
31
+ width: doc.width,
32
+ height: doc.height
33
+ });
34
+ }
35
+ }).catch(()=>{});
36
+ return ()=>{
37
+ cancelled = true;
38
+ };
39
+ }, [
40
+ imageId,
41
+ mediaSlug
42
+ ]);
43
+ return /*#__PURE__*/ _jsxs("div", {
44
+ className: "field-type",
45
+ children: [
46
+ /*#__PURE__*/ _jsx(FieldLabel, {
47
+ htmlFor: `field-${path}`,
48
+ label: field?.label
49
+ }),
50
+ !imageId && /*#__PURE__*/ _jsx("p", {
51
+ style: {
52
+ color: 'var(--theme-elevation-500)',
53
+ fontSize: '0.85rem'
54
+ },
55
+ children: "Select an image above, then save — the map editor appears once an image is set."
56
+ }),
57
+ imageId && image?.url && /*#__PURE__*/ _jsx(MapEditor, {
58
+ value: value || {},
59
+ image: image,
60
+ onChange: (next)=>setValue(next)
61
+ })
62
+ ]
63
+ });
64
+ };
65
+ export default ImageMapField;
66
+
67
+ //# sourceMappingURL=ImageMapField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/fields/imageMap/ImageMapField.tsx"],"sourcesContent":["'use client';\n\nimport { FieldLabel, useField, useFormFields } from '@payloadcms/ui';\nimport type { JSONFieldClientProps } from 'payload';\nimport { useEffect, useState } from 'react';\nimport MapEditor from './MapEditor/MapEditor.js';\nimport type { ImageMapValue, MapImage } from './MapEditor/types.js';\n\ntype ImageMapFieldProps = JSONFieldClientProps & {\n /** Upload collection slug for the base image, injected via clientProps. */\n mediaSlug?: string;\n};\n\n/**\n * Client Field for the `map` JSON value. Reads the sibling `image` upload id,\n * fetches that media doc for its URL/dimensions, and renders the editor. All\n * pin edits are written straight back to the field via `useField` — Payload\n * persists them on save, so there's no bespoke endpoint.\n */\nexport const ImageMapField = ({\n field,\n path,\n mediaSlug = 'media',\n}: ImageMapFieldProps) => {\n const { value, setValue } = useField<ImageMapValue>({\n path: path || field.name,\n });\n\n // Sibling `image` upload id lives one level up (…imageMap.image).\n const basePath = (path || field.name).split('.').slice(0, -1).join('.');\n const imagePath = basePath ? `${basePath}.image` : 'image';\n const imageId = useFormFields(\n ([fields]) => fields[imagePath]?.value as string | number | undefined\n );\n\n const [image, setImage] = useState<MapImage | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n if (!imageId) {\n setImage(null);\n return;\n }\n fetch(`/api/${mediaSlug}/${imageId}?depth=0`)\n .then(r => (r.ok ? r.json() : null))\n .then(doc => {\n if (!cancelled && doc) {\n setImage({\n url: doc.url,\n alt: doc.alt,\n width: doc.width,\n height: doc.height,\n });\n }\n })\n .catch(() => {});\n return () => {\n cancelled = true;\n };\n }, [imageId, mediaSlug]);\n\n return (\n <div className='field-type'>\n <FieldLabel htmlFor={`field-${path}`} label={field?.label} />\n {!imageId && (\n <p style={{ color: 'var(--theme-elevation-500)', fontSize: '0.85rem' }}>\n Select an image above, then save — the map editor appears once an\n image is set.\n </p>\n )}\n {imageId && image?.url && (\n <MapEditor\n value={value || {}}\n image={image}\n onChange={next => setValue(next)}\n />\n )}\n </div>\n );\n};\n\nexport default ImageMapField;\n"],"names":["FieldLabel","useField","useFormFields","useEffect","useState","MapEditor","ImageMapField","field","path","mediaSlug","value","setValue","name","basePath","split","slice","join","imagePath","imageId","fields","image","setImage","cancelled","fetch","then","r","ok","json","doc","url","alt","width","height","catch","div","className","htmlFor","label","p","style","color","fontSize","onChange","next"],"mappings":"AAAA;;AAEA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,iBAAiB;AAErE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,OAAOC,eAAe,2BAA2B;AAQjD;;;;;CAKC,GACD,OAAO,MAAMC,gBAAgB,CAAC,EAC5BC,KAAK,EACLC,IAAI,EACJC,YAAY,OAAO,EACA;IACnB,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGV,SAAwB;QAClDO,MAAMA,QAAQD,MAAMK,IAAI;IAC1B;IAEA,kEAAkE;IAClE,MAAMC,WAAW,AAACL,CAAAA,QAAQD,MAAMK,IAAI,AAAD,EAAGE,KAAK,CAAC,KAAKC,KAAK,CAAC,GAAG,CAAC,GAAGC,IAAI,CAAC;IACnE,MAAMC,YAAYJ,WAAW,GAAGA,SAAS,MAAM,CAAC,GAAG;IACnD,MAAMK,UAAUhB,cACd,CAAC,CAACiB,OAAO,GAAKA,MAAM,CAACF,UAAU,EAAEP;IAGnC,MAAM,CAACU,OAAOC,SAAS,GAAGjB,SAA0B;IAEpDD,UAAU;QACR,IAAImB,YAAY;QAChB,IAAI,CAACJ,SAAS;YACZG,SAAS;YACT;QACF;QACAE,MAAM,CAAC,KAAK,EAAEd,UAAU,CAAC,EAAES,QAAQ,QAAQ,CAAC,EACzCM,IAAI,CAACC,CAAAA,IAAMA,EAAEC,EAAE,GAAGD,EAAEE,IAAI,KAAK,MAC7BH,IAAI,CAACI,CAAAA;YACJ,IAAI,CAACN,aAAaM,KAAK;gBACrBP,SAAS;oBACPQ,KAAKD,IAAIC,GAAG;oBACZC,KAAKF,IAAIE,GAAG;oBACZC,OAAOH,IAAIG,KAAK;oBAChBC,QAAQJ,IAAII,MAAM;gBACpB;YACF;QACF,GACCC,KAAK,CAAC,KAAO;QAChB,OAAO;YACLX,YAAY;QACd;IACF,GAAG;QAACJ;QAAST;KAAU;IAEvB,qBACE,MAACyB;QAAIC,WAAU;;0BACb,KAACnC;gBAAWoC,SAAS,CAAC,MAAM,EAAE5B,MAAM;gBAAE6B,OAAO9B,OAAO8B;;YACnD,CAACnB,yBACA,KAACoB;gBAAEC,OAAO;oBAAEC,OAAO;oBAA8BC,UAAU;gBAAU;0BAAG;;YAKzEvB,WAAWE,OAAOS,qBACjB,KAACxB;gBACCK,OAAOA,SAAS,CAAC;gBACjBU,OAAOA;gBACPsB,UAAUC,CAAAA,OAAQhC,SAASgC;;;;AAKrC,EAAE;AAEF,eAAerC,cAAc"}
@@ -0,0 +1,13 @@
1
+ import './map-editor.scss';
2
+ import './WaypointSheet.scss';
3
+ import type { ImageMapValue, MapImage } from './types.js';
4
+ /**
5
+ * The interactive editor. Purely controlled: it renders `value.waypoints` over
6
+ * `image` and calls `onChange` with the next value on every add/edit/delete.
7
+ * Persistence is the parent field's concern (Payload saves the field).
8
+ */
9
+ export default function MapEditor({ value, image, onChange, }: {
10
+ value?: ImageMapValue;
11
+ image: MapImage;
12
+ onChange: (next: ImageMapValue) => void;
13
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,225 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as Tooltip from '@radix-ui/react-tooltip';
4
+ import { MapPin } from 'lucide-react';
5
+ import { useEffect, useRef, useState } from 'react';
6
+ import './map-editor.scss';
7
+ import './WaypointSheet.scss';
8
+ import { PinContextMenu } from './PinContextMenu.js';
9
+ import { WaypointPopover } from './WaypointPopover.js';
10
+ import { WaypointSheet } from './WaypointSheet.js';
11
+ /**
12
+ * The interactive editor. Purely controlled: it renders `value.waypoints` over
13
+ * `image` and calls `onChange` with the next value on every add/edit/delete.
14
+ * Persistence is the parent field's concern (Payload saves the field).
15
+ */ export default function MapEditor({ value = {}, image, onChange }) {
16
+ const mapRef = useRef(null);
17
+ const cursor = useMousePositionWithinDiv({
18
+ divRef: mapRef
19
+ });
20
+ const [waypoints, setWaypoints] = useState(value.waypoints || []);
21
+ const [popoverState, setPopoverState] = useState(null);
22
+ const [newWaypointName, setNewWaypointName] = useState('');
23
+ const [editDialogOpen, setEditDialogOpen] = useState(false);
24
+ const [editingWaypoint, setEditingWaypoint] = useState(null);
25
+ useEffect(()=>{
26
+ setWaypoints(value.waypoints || []);
27
+ }, [
28
+ value.waypoints
29
+ ]);
30
+ const commit = (next)=>{
31
+ setWaypoints(next);
32
+ onChange({
33
+ ...value,
34
+ waypoints: next
35
+ });
36
+ };
37
+ const handleClick = ()=>{
38
+ if (cursor.x >= 0 && cursor.y >= 0 && mapRef.current) {
39
+ const rect = mapRef.current.getBoundingClientRect();
40
+ setPopoverState({
41
+ mode: 'add',
42
+ x: cursor.x / rect.width * 100,
43
+ y: cursor.y / rect.height * 100
44
+ });
45
+ setNewWaypointName('');
46
+ }
47
+ };
48
+ const handleNameSubmit = (name)=>{
49
+ if (name.trim() && popoverState) {
50
+ const newWaypoint = {
51
+ id: `${popoverState.x.toFixed(2)}-${popoverState.y.toFixed(2)}-${waypoints.length}`,
52
+ x: popoverState.x,
53
+ y: popoverState.y,
54
+ name
55
+ };
56
+ commit([
57
+ ...waypoints,
58
+ newWaypoint
59
+ ]);
60
+ setPopoverState(null);
61
+ setNewWaypointName('');
62
+ }
63
+ };
64
+ const handleEditWaypoint = (wp)=>commit(waypoints.map((w)=>w.id === wp.id ? wp : w));
65
+ const handleRemoveWaypoint = (id)=>commit(waypoints.filter((w)=>w.id !== id));
66
+ const cursorPercent = (axis)=>{
67
+ if (!mapRef.current) return 0;
68
+ const rect = mapRef.current.getBoundingClientRect();
69
+ const size = axis === 'x' ? rect.width : rect.height;
70
+ return cursor[axis] >= 0 ? Math.round(cursor[axis] / size * 100) : 0;
71
+ };
72
+ return /*#__PURE__*/ _jsx(Tooltip.Provider, {
73
+ children: /*#__PURE__*/ _jsxs("div", {
74
+ className: "map-editor",
75
+ children: [
76
+ /*#__PURE__*/ _jsxs("div", {
77
+ className: "map-editor__header",
78
+ children: [
79
+ /*#__PURE__*/ _jsx("div", {
80
+ className: "map-editor__header-title",
81
+ children: /*#__PURE__*/ _jsx("h2", {
82
+ children: "Map Editor"
83
+ })
84
+ }),
85
+ /*#__PURE__*/ _jsx("div", {
86
+ className: "map-editor__header-actions",
87
+ children: /*#__PURE__*/ _jsx("div", {
88
+ className: "map-editor__waypoints",
89
+ children: waypoints.map((waypoint)=>/*#__PURE__*/ _jsxs("div", {
90
+ className: "map-editor__waypoint",
91
+ children: [
92
+ /*#__PURE__*/ _jsxs("span", {
93
+ children: [
94
+ waypoint.name,
95
+ ": [",
96
+ Math.round(waypoint.x),
97
+ "%,",
98
+ ' ',
99
+ Math.round(waypoint.y),
100
+ "%]"
101
+ ]
102
+ }),
103
+ /*#__PURE__*/ _jsx("button", {
104
+ type: "button",
105
+ className: "map-editor__remove",
106
+ onClick: ()=>handleRemoveWaypoint(waypoint.id),
107
+ children: "×"
108
+ })
109
+ ]
110
+ }, waypoint.id))
111
+ })
112
+ })
113
+ ]
114
+ }),
115
+ /*#__PURE__*/ _jsxs("div", {
116
+ className: "map-editor__image-container",
117
+ children: [
118
+ /*#__PURE__*/ _jsx("img", {
119
+ src: image.url || '',
120
+ alt: image.alt || '',
121
+ width: image.width || undefined,
122
+ height: image.height || undefined,
123
+ ref: mapRef,
124
+ onClick: handleClick
125
+ }),
126
+ waypoints.map((waypoint)=>/*#__PURE__*/ _jsx(PinContextMenu, {
127
+ waypoint: waypoint,
128
+ onEdit: ()=>{
129
+ setEditingWaypoint(waypoint);
130
+ setEditDialogOpen(true);
131
+ },
132
+ onDelete: ()=>handleRemoveWaypoint(waypoint.id),
133
+ children: /*#__PURE__*/ _jsx("button", {
134
+ type: "button",
135
+ className: "map-editor__waypoint-dot",
136
+ style: {
137
+ left: `${waypoint.x}%`,
138
+ top: `${waypoint.y}%`
139
+ },
140
+ "aria-label": `Pin: ${waypoint.name}`,
141
+ children: /*#__PURE__*/ _jsx(MapPin, {})
142
+ })
143
+ }, waypoint.id)),
144
+ popoverState?.mode === 'add' && /*#__PURE__*/ _jsx(WaypointPopover, {
145
+ open: popoverState?.mode === 'add',
146
+ mode: "add",
147
+ onOpenChange: (open)=>{
148
+ if (!open) setPopoverState(null);
149
+ },
150
+ nameValue: newWaypointName,
151
+ setNameValue: setNewWaypointName,
152
+ onSaveName: handleNameSubmit,
153
+ onCancel: ()=>setPopoverState(null),
154
+ trigger: /*#__PURE__*/ _jsx("div", {
155
+ style: {
156
+ position: 'absolute',
157
+ left: `${popoverState.x}%`,
158
+ top: `${popoverState.y}%`,
159
+ width: 1,
160
+ height: 1,
161
+ pointerEvents: 'none'
162
+ }
163
+ })
164
+ }),
165
+ editingWaypoint && /*#__PURE__*/ _jsx(WaypointSheet, {
166
+ open: editDialogOpen,
167
+ onOpenChange: setEditDialogOpen,
168
+ waypoint: editingWaypoint,
169
+ onSave: (wp)=>{
170
+ handleEditWaypoint(wp);
171
+ setEditDialogOpen(false);
172
+ },
173
+ onCancel: ()=>setEditDialogOpen(false)
174
+ }),
175
+ /*#__PURE__*/ _jsxs("p", {
176
+ className: "map-editor__coordinates",
177
+ children: [
178
+ "[x: ",
179
+ cursorPercent('x'),
180
+ "%, y: ",
181
+ cursorPercent('y'),
182
+ "%]"
183
+ ]
184
+ })
185
+ ]
186
+ })
187
+ ]
188
+ })
189
+ });
190
+ }
191
+ function useMousePositionWithinDiv({ divRef }) {
192
+ const [mousePosition, setMousePosition] = useState({
193
+ x: 0,
194
+ y: 0
195
+ });
196
+ useEffect(()=>{
197
+ const updateMousePosition = (ev)=>{
198
+ if (divRef.current) {
199
+ const rect = divRef.current.getBoundingClientRect();
200
+ const x = ev.clientX - rect.left;
201
+ const y = ev.clientY - rect.top;
202
+ if (x >= 0 && y >= 0) setMousePosition({
203
+ x,
204
+ y
205
+ });
206
+ }
207
+ };
208
+ const div = divRef.current;
209
+ if (div) {
210
+ div.addEventListener('mousemove', updateMousePosition);
211
+ div.addEventListener('click', updateMousePosition);
212
+ }
213
+ return ()=>{
214
+ if (div) {
215
+ div.removeEventListener('mousemove', updateMousePosition);
216
+ div.removeEventListener('click', updateMousePosition);
217
+ }
218
+ };
219
+ }, [
220
+ divRef
221
+ ]);
222
+ return mousePosition;
223
+ }
224
+
225
+ //# sourceMappingURL=MapEditor.js.map