@nexload-sdk/payload-fields 2.0.0 → 3.1.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 (82) hide show
  1. package/README.md +15 -67
  2. package/dist/admin/jalali-date-cell.cjs +58 -0
  3. package/dist/admin/jalali-date-cell.cjs.map +7 -0
  4. package/dist/admin/jalali-date-cell.d.ts +6 -0
  5. package/dist/admin/jalali-date-cell.d.ts.map +1 -0
  6. package/dist/admin/jalali-date-cell.mjs +32 -0
  7. package/dist/admin/jalali-date-cell.mjs.map +7 -0
  8. package/dist/admin/jalali-date-field.cjs +159 -0
  9. package/dist/admin/jalali-date-field.cjs.map +7 -0
  10. package/dist/admin/jalali-date-field.d.ts +11 -0
  11. package/dist/admin/jalali-date-field.d.ts.map +1 -0
  12. package/dist/admin/jalali-date-field.mjs +135 -0
  13. package/dist/admin/jalali-date-field.mjs.map +7 -0
  14. package/dist/admin/jalali-picker-value.cjs +42 -0
  15. package/dist/admin/jalali-picker-value.cjs.map +7 -0
  16. package/dist/admin/jalali-picker-value.d.ts +3 -0
  17. package/dist/admin/jalali-picker-value.d.ts.map +1 -0
  18. package/dist/admin/jalali-picker-value.mjs +18 -0
  19. package/dist/admin/jalali-picker-value.mjs.map +7 -0
  20. package/dist/admin/money-field.cjs +146 -0
  21. package/dist/admin/money-field.cjs.map +7 -0
  22. package/dist/admin/money-field.d.ts +10 -0
  23. package/dist/admin/money-field.d.ts.map +1 -0
  24. package/dist/admin/money-field.mjs +122 -0
  25. package/dist/admin/money-field.mjs.map +7 -0
  26. package/dist/admin/slug-field.cjs +135 -0
  27. package/dist/admin/slug-field.cjs.map +7 -0
  28. package/dist/admin/slug-field.d.ts +9 -0
  29. package/dist/admin/slug-field.d.ts.map +1 -0
  30. package/dist/admin/slug-field.mjs +115 -0
  31. package/dist/admin/slug-field.mjs.map +7 -0
  32. package/dist/date/format-date.d.ts +8 -1
  33. package/dist/date/format-date.d.ts.map +1 -1
  34. package/dist/date/index.cjs +117 -0
  35. package/dist/date/index.cjs.map +7 -0
  36. package/dist/date/index.d.ts +23 -4
  37. package/dist/date/index.d.ts.map +1 -1
  38. package/dist/date/index.mjs +86 -0
  39. package/dist/date/index.mjs.map +7 -0
  40. package/dist/date/picker-types.d.ts +2 -0
  41. package/dist/date/picker-types.d.ts.map +1 -0
  42. package/dist/index.cjs +411 -113
  43. package/dist/index.cjs.map +4 -4
  44. package/dist/index.d.ts +4 -4
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.mjs +394 -119
  47. package/dist/index.mjs.map +4 -4
  48. package/dist/money/index.cjs +147 -0
  49. package/dist/money/index.cjs.map +7 -0
  50. package/dist/money/index.d.ts +29 -0
  51. package/dist/money/index.d.ts.map +1 -0
  52. package/dist/money/index.mjs +117 -0
  53. package/dist/money/index.mjs.map +7 -0
  54. package/dist/plugin.d.ts +16 -0
  55. package/dist/plugin.d.ts.map +1 -0
  56. package/dist/slug/format-slug.d.ts +8 -2
  57. package/dist/slug/format-slug.d.ts.map +1 -1
  58. package/dist/slug/index.cjs +183 -0
  59. package/dist/slug/index.cjs.map +7 -0
  60. package/dist/slug/index.d.ts +12 -5
  61. package/dist/slug/index.d.ts.map +1 -1
  62. package/dist/slug/index.mjs +154 -0
  63. package/dist/slug/index.mjs.map +7 -0
  64. package/package.json +45 -30
  65. package/dist/date/date-cell.cjs +0 -60
  66. package/dist/date/date-cell.cjs.map +0 -7
  67. package/dist/date/date-cell.d.ts +0 -7
  68. package/dist/date/date-cell.d.ts.map +0 -1
  69. package/dist/date/date-cell.mjs +0 -34
  70. package/dist/date/date-cell.mjs.map +0 -7
  71. package/dist/date/date-picker.cjs +0 -221
  72. package/dist/date/date-picker.cjs.map +0 -7
  73. package/dist/date/date-picker.d.ts +0 -5
  74. package/dist/date/date-picker.d.ts.map +0 -1
  75. package/dist/date/date-picker.mjs +0 -197
  76. package/dist/date/date-picker.mjs.map +0 -7
  77. package/dist/slug/slug-field.cjs +0 -246
  78. package/dist/slug/slug-field.cjs.map +0 -7
  79. package/dist/slug/slug-field.d.ts +0 -10
  80. package/dist/slug/slug-field.d.ts.map +0 -1
  81. package/dist/slug/slug-field.mjs +0 -228
  82. package/dist/slug/slug-field.mjs.map +0 -7
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @nexload-sdk/payload-fields
2
2
 
3
- Reusable Payload CMS field helpers and admin components (date + slug) plus a preconfigured Lexical editor.
3
+ Semantic Payload CMS factories for managed Unicode slugs, Jalali dates, and integer minor-unit money values.
4
4
 
5
5
  ## Install
6
6
 
@@ -8,80 +8,28 @@ Reusable Payload CMS field helpers and admin components (date + slug) plus a pre
8
8
  pnpm add @nexload-sdk/payload-fields
9
9
  ```
10
10
 
11
- ## Exports
12
-
13
- Root exports:
14
-
15
- - `editor` (Lexical editor preset)
16
- - `dateField`
17
- - `slugField`
18
- - slug/date helper exports (`formatDate`, `formatSlug`, `formatSlugHook`)
19
-
20
- Subpath exports (used by Payload admin component paths):
21
-
22
- - `@nexload-sdk/payload-fields/date`
23
- - `@nexload-sdk/payload-fields/date/date-picker`
24
- - `@nexload-sdk/payload-fields/date/date-cell`
25
- - `@nexload-sdk/payload-fields/slug`
26
- - `@nexload-sdk/payload-fields/slug/slug-field`
27
-
28
- ## `editor`
29
-
30
- Preconfigured `lexicalEditor(...)` instance with features including:
31
-
32
- - headings (`h1`-`h4`)
33
- - fixed toolbar
34
- - horizontal rule
35
- - upload
36
- - table (experimental)
37
- - relationship feature (`products`, `articles`)
38
-
39
- Usage:
11
+ ## Usage
40
12
 
41
13
  ```ts
42
- import { editor } from "@nexload-sdk/payload-fields";
43
-
44
- {
45
- name: "content",
46
- type: "richText",
47
- editor
48
- }
49
- ```
50
-
51
- ## `dateField(overrides?)`
52
-
53
- Returns `[DateField]` configured for Payload admin sidebar, with:
54
-
55
- - custom field component (`DatePicker`)
56
- - custom cell component (`DateCell`)
57
- - Persian/Jalali formatting helpers
58
-
59
- ```ts
60
- import { dateField } from "@nexload-sdk/payload-fields";
14
+ import { jalaliDateField, moneyField, slugField } from "@nexload-sdk/payload-fields";
61
15
 
62
16
  fields: [
63
- ...dateField()
17
+ { name: "title", type: "text", required: true },
18
+ ...slugField({ source: "title" }),
19
+ jalaliDateField({ name: "publishedAt" }),
20
+ moneyField({ name: "price", currency: "IRT" }),
64
21
  ];
65
22
  ```
66
23
 
67
- ## `slugField(fieldToUse?, overrides?)`
68
-
69
- Returns `[TextField, CheckboxField]` for a slug and lock toggle.
24
+ `payloadFieldsPlugin({ slugGenerators })` registers secure server-side slug generators, rejects malformed request bodies, and resolves only explicitly registered own keys. Locked slugs preserve their previous value when the source is cleared. REST, GraphQL, and Local API money values are always integer minor units; only the Admin UI accepts major-unit text.
70
25
 
71
- - auto-formats slug values
72
- - includes `beforeValidate` hook
73
- - uses custom admin UI component with lock/unlock + generate action
26
+ Jalali values remain native ISO dates. `dayOnly` uses canonical local noon, and `monthOnly` stores the first Jalali day of the selected month at canonical local noon.
74
27
 
75
- ```ts
76
- import { slugField } from "@nexload-sdk/payload-fields";
77
-
78
- fields: [
79
- { name: "title", type: "text", required: true },
80
- ...slugField("title")
81
- ];
82
- ```
28
+ ## Migration from 2.x
83
29
 
84
- ## Notes
30
+ - `editor` is removed. A future `payload-editor` package will replace it; it is not part of this release.
31
+ - Replace `slugField("title")` with `slugField({ source: "title" })`.
32
+ - Replace `...dateField()` with `jalaliDateField({ name: "date" })`.
33
+ - Replace decimal price storage with `moneyField`; API values are minor-unit integers.
85
34
 
86
- - Admin components are React client components and intended for Payload admin usage.
87
- - Styles are bundled from package submodules (`date/index.scss`, `slug/index.scss`).
35
+ See the SDK documentation for override, localization, timezone, and generator contracts.
@@ -0,0 +1,58 @@
1
+ // @nexload-sdk/payload-fields v3.0.0 (build 2026-07-20T16:56:57.614Z)
2
+ "use strict";
3
+ "use client";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/admin/jalali-date-cell.tsx
23
+ var jalali_date_cell_exports = {};
24
+ __export(jalali_date_cell_exports, {
25
+ JalaliDateCell: () => JalaliDateCell
26
+ });
27
+ module.exports = __toCommonJS(jalali_date_cell_exports);
28
+
29
+ // src/date/format-date.ts
30
+ function formatJalaliDate(value, options = {}) {
31
+ if (value === null || value === void 0) return null;
32
+ const date = value instanceof Date ? value : new Date(value);
33
+ if (Number.isNaN(date.getTime())) return null;
34
+ const locale = options.digits === "latin" ? "fa-IR-u-ca-persian-nu-latn" : "fa-IR-u-ca-persian";
35
+ return new Intl.DateTimeFormat(
36
+ locale,
37
+ {
38
+ dateStyle: options.dateStyle ?? "medium",
39
+ ...options.timeStyle ? { timeStyle: options.timeStyle } : {},
40
+ ...options.timeZone ? { timeZone: options.timeZone } : {}
41
+ }
42
+ ).format(date);
43
+ }
44
+
45
+ // src/admin/jalali-date-cell.tsx
46
+ var import_jsx_runtime = require("react/jsx-runtime");
47
+ var JalaliDateCell = ({
48
+ cellData,
49
+ display
50
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: formatJalaliDate(
51
+ cellData,
52
+ display
53
+ ) ?? "\u2014" });
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ JalaliDateCell
57
+ });
58
+ //# sourceMappingURL=jalali-date-cell.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/admin/jalali-date-cell.tsx", "../../src/date/format-date.ts"],
4
+ "sourcesContent": ["\"use client\";\n\nimport { formatJalaliDate, type JalaliDateDisplayOptions } from \"../date/format-date\";\n\nimport type { DefaultCellComponentProps } from \"payload\";\n\nexport const JalaliDateCell = ({\n cellData,\n display,\n}: DefaultCellComponentProps & { display?: JalaliDateDisplayOptions }) => (\n <>\n {formatJalaliDate(\n cellData as string | null, display\n ) ?? \"\u2014\"}\n </>\n);\n", "export type JalaliDateValue = Date | string | number | null | undefined;\nexport type JalaliDateDisplayOptions = {\n dateStyle?: \"short\" | \"medium\" | \"long\" | \"full\"\n timeStyle?: \"short\" | \"medium\"\n digits?: \"persian\" | \"latin\"\n timeZone?: string\n};\n\nexport function formatJalaliDate (\n value: JalaliDateValue, options: JalaliDateDisplayOptions = {}\n): string | null {\n if (value === null || value === undefined) return null;\n const date = value instanceof Date ? value : new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n const locale = options.digits === \"latin\" ? \"fa-IR-u-ca-persian-nu-latn\" : \"fa-IR-u-ca-persian\";\n return new Intl.DateTimeFormat(\n locale, {\n dateStyle: options.dateStyle ?? \"medium\",\n ...(options.timeStyle ? { timeStyle: options.timeStyle, } : {}),\n ...(options.timeZone ? { timeZone: options.timeZone, } : {}),\n }\n ).format(date);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQO,SAAS,iBACd,OAAwB,UAAoC,CAAC,GAC9C;AACf,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,QAAM,OAAO,iBAAiB,OAAO,QAAQ,IAAI,KAAK,KAAK;AAC3D,MAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,EAAG,QAAO;AACzC,QAAM,SAAS,QAAQ,WAAW,UAAU,+BAA+B;AAC3E,SAAO,IAAI,KAAK;AAAA,IACd;AAAA,IAAQ;AAAA,MACN,WAAW,QAAQ,aAAa;AAAA,MAChC,GAAI,QAAQ,YAAY,EAAE,WAAW,QAAQ,UAAW,IAAI,CAAC;AAAA,MAC7D,GAAI,QAAQ,WAAW,EAAE,UAAU,QAAQ,SAAU,IAAI,CAAC;AAAA,IAC5D;AAAA,EACF,EAAE,OAAO,IAAI;AACf;;;ADZE;AAJK,IAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AACF,MACE,2EACG;AAAA,EACC;AAAA,EAA2B;AAC7B,KAAK,UACP;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import { type JalaliDateDisplayOptions } from "../date/format-date";
2
+ import type { DefaultCellComponentProps } from "payload";
3
+ export declare const JalaliDateCell: ({ cellData, display, }: DefaultCellComponentProps & {
4
+ display?: JalaliDateDisplayOptions;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=jalali-date-cell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jalali-date-cell.d.ts","sourceRoot":"","sources":["../../src/admin/jalali-date-cell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEtF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD,eAAO,MAAM,cAAc,GAAI,wBAG5B,yBAAyB,GAAG;IAAE,OAAO,CAAC,EAAE,wBAAwB,CAAA;CAAE,4CAMpE,CAAC"}
@@ -0,0 +1,32 @@
1
+ // @nexload-sdk/payload-fields v3.0.0 (build 2026-07-20T16:56:56.848Z)
2
+ "use client";
3
+
4
+ // src/date/format-date.ts
5
+ function formatJalaliDate(value, options = {}) {
6
+ if (value === null || value === void 0) return null;
7
+ const date = value instanceof Date ? value : new Date(value);
8
+ if (Number.isNaN(date.getTime())) return null;
9
+ const locale = options.digits === "latin" ? "fa-IR-u-ca-persian-nu-latn" : "fa-IR-u-ca-persian";
10
+ return new Intl.DateTimeFormat(
11
+ locale,
12
+ {
13
+ dateStyle: options.dateStyle ?? "medium",
14
+ ...options.timeStyle ? { timeStyle: options.timeStyle } : {},
15
+ ...options.timeZone ? { timeZone: options.timeZone } : {}
16
+ }
17
+ ).format(date);
18
+ }
19
+
20
+ // src/admin/jalali-date-cell.tsx
21
+ import { Fragment, jsx } from "react/jsx-runtime";
22
+ var JalaliDateCell = ({
23
+ cellData,
24
+ display
25
+ }) => /* @__PURE__ */ jsx(Fragment, { children: formatJalaliDate(
26
+ cellData,
27
+ display
28
+ ) ?? "\u2014" });
29
+ export {
30
+ JalaliDateCell
31
+ };
32
+ //# sourceMappingURL=jalali-date-cell.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/date/format-date.ts", "../../src/admin/jalali-date-cell.tsx"],
4
+ "sourcesContent": ["export type JalaliDateValue = Date | string | number | null | undefined;\nexport type JalaliDateDisplayOptions = {\n dateStyle?: \"short\" | \"medium\" | \"long\" | \"full\"\n timeStyle?: \"short\" | \"medium\"\n digits?: \"persian\" | \"latin\"\n timeZone?: string\n};\n\nexport function formatJalaliDate (\n value: JalaliDateValue, options: JalaliDateDisplayOptions = {}\n): string | null {\n if (value === null || value === undefined) return null;\n const date = value instanceof Date ? value : new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n const locale = options.digits === \"latin\" ? \"fa-IR-u-ca-persian-nu-latn\" : \"fa-IR-u-ca-persian\";\n return new Intl.DateTimeFormat(\n locale, {\n dateStyle: options.dateStyle ?? \"medium\",\n ...(options.timeStyle ? { timeStyle: options.timeStyle, } : {}),\n ...(options.timeZone ? { timeZone: options.timeZone, } : {}),\n }\n ).format(date);\n}\n", "\"use client\";\n\nimport { formatJalaliDate, type JalaliDateDisplayOptions } from \"../date/format-date\";\n\nimport type { DefaultCellComponentProps } from \"payload\";\n\nexport const JalaliDateCell = ({\n cellData,\n display,\n}: DefaultCellComponentProps & { display?: JalaliDateDisplayOptions }) => (\n <>\n {formatJalaliDate(\n cellData as string | null, display\n ) ?? \"\u2014\"}\n </>\n);\n"],
5
+ "mappings": ";;;;AAQO,SAAS,iBACd,OAAwB,UAAoC,CAAC,GAC9C;AACf,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,QAAM,OAAO,iBAAiB,OAAO,QAAQ,IAAI,KAAK,KAAK;AAC3D,MAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,EAAG,QAAO;AACzC,QAAM,SAAS,QAAQ,WAAW,UAAU,+BAA+B;AAC3E,SAAO,IAAI,KAAK;AAAA,IACd;AAAA,IAAQ;AAAA,MACN,WAAW,QAAQ,aAAa;AAAA,MAChC,GAAI,QAAQ,YAAY,EAAE,WAAW,QAAQ,UAAW,IAAI,CAAC;AAAA,MAC7D,GAAI,QAAQ,WAAW,EAAE,UAAU,QAAQ,SAAU,IAAI,CAAC;AAAA,IAC5D;AAAA,EACF,EAAE,OAAO,IAAI;AACf;;;ACZE;AAJK,IAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AACF,MACE,gCACG;AAAA,EACC;AAAA,EAA2B;AAC7B,KAAK,UACP;",
6
+ "names": []
7
+ }
@@ -0,0 +1,159 @@
1
+ // @nexload-sdk/payload-fields v3.0.0 (build 2026-07-20T16:56:57.614Z)
2
+ "use strict";
3
+ "use client";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/admin/jalali-date-field.tsx
23
+ var jalali_date_field_exports = {};
24
+ __export(jalali_date_field_exports, {
25
+ JalaliDateFieldComponent: () => JalaliDateFieldComponent
26
+ });
27
+ module.exports = __toCommonJS(jalali_date_field_exports);
28
+ var import_ui = require("@payloadcms/ui");
29
+ var import_react = require("react");
30
+ var import_persian2 = require("react-day-picker/persian");
31
+ var import_style = require("react-day-picker/style.css");
32
+
33
+ // src/admin/jalali-picker-value.ts
34
+ var import_persian = require("react-day-picker/persian");
35
+ function canonicalizeJalaliPickerDate(date, appearance) {
36
+ const result = appearance === "monthOnly" ? (0, import_persian.getDateLib)().startOfMonth(date) : new Date(date);
37
+ if (appearance === "dayOnly" || appearance === "monthOnly") result.setHours(
38
+ 12,
39
+ 0,
40
+ 0,
41
+ 0
42
+ );
43
+ return result;
44
+ }
45
+
46
+ // src/date/format-date.ts
47
+ function formatJalaliDate(value, options = {}) {
48
+ if (value === null || value === void 0) return null;
49
+ const date = value instanceof Date ? value : new Date(value);
50
+ if (Number.isNaN(date.getTime())) return null;
51
+ const locale = options.digits === "latin" ? "fa-IR-u-ca-persian-nu-latn" : "fa-IR-u-ca-persian";
52
+ return new Intl.DateTimeFormat(
53
+ locale,
54
+ {
55
+ dateStyle: options.dateStyle ?? "medium",
56
+ ...options.timeStyle ? { timeStyle: options.timeStyle } : {},
57
+ ...options.timeZone ? { timeZone: options.timeZone } : {}
58
+ }
59
+ ).format(date);
60
+ }
61
+
62
+ // src/admin/jalali-date-field.tsx
63
+ var import_jsx_runtime = require("react/jsx-runtime");
64
+ var JalaliDateFieldComponent = ({
65
+ field,
66
+ path,
67
+ appearance,
68
+ display,
69
+ readOnly
70
+ }) => {
71
+ const { value, setValue } = (0, import_ui.useField)({ path });
72
+ const [
73
+ selected,
74
+ setSelected
75
+ ] = (0, import_react.useState)();
76
+ (0, import_react.useEffect)(
77
+ () => setSelected(value ? new Date(value) : void 0),
78
+ [value]
79
+ );
80
+ const save = (date) => {
81
+ setSelected(date);
82
+ setValue(date ? date.toISOString() : null);
83
+ };
84
+ const chooseDay = (date) => {
85
+ if (!date) return save(void 0);
86
+ save(canonicalizeJalaliPickerDate(
87
+ date,
88
+ appearance
89
+ ));
90
+ };
91
+ const updateTime = (part, raw) => {
92
+ const base = selected ? new Date(selected) : /* @__PURE__ */ new Date();
93
+ base[part === "hours" ? "setHours" : "setMinutes"](Number(raw));
94
+ save(base);
95
+ };
96
+ const showCalendar = appearance !== "timeOnly";
97
+ const showTime = appearance === "dayAndTime" || appearance === "timeOnly";
98
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "field-type jalali-date-field", children: [
99
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.FieldLabel, { htmlFor: `field-${path}`, label: field.label, required: field.required }),
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
+ "input",
102
+ {
103
+ readOnly: true,
104
+ value: formatJalaliDate(
105
+ value,
106
+ display
107
+ ) ?? ""
108
+ }
109
+ ),
110
+ showCalendar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
111
+ import_persian2.DayPicker,
112
+ {
113
+ captionLayout: "dropdown",
114
+ disabled: readOnly,
115
+ mode: "single",
116
+ onSelect: chooseDay,
117
+ selected,
118
+ showOutsideDays: true
119
+ }
120
+ ),
121
+ showTime && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
122
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
123
+ "input",
124
+ {
125
+ disabled: readOnly,
126
+ max: 23,
127
+ min: 0,
128
+ onChange: (event) => updateTime(
129
+ "hours",
130
+ event.target.value
131
+ ),
132
+ type: "number",
133
+ value: (selected == null ? void 0 : selected.getHours()) ?? 0
134
+ }
135
+ ),
136
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", children: ":" }),
137
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
+ "input",
139
+ {
140
+ disabled: readOnly,
141
+ max: 59,
142
+ min: 0,
143
+ onChange: (event) => updateTime(
144
+ "minutes",
145
+ event.target.value
146
+ ),
147
+ type: "number",
148
+ value: (selected == null ? void 0 : selected.getMinutes()) ?? 0
149
+ }
150
+ )
151
+ ] }),
152
+ !readOnly && value && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => save(void 0), type: "button", children: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646" })
153
+ ] });
154
+ };
155
+ // Annotate the CommonJS export names for ESM import in node:
156
+ 0 && (module.exports = {
157
+ JalaliDateFieldComponent
158
+ });
159
+ //# sourceMappingURL=jalali-date-field.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/admin/jalali-date-field.tsx", "../../src/admin/jalali-picker-value.ts", "../../src/date/format-date.ts"],
4
+ "sourcesContent": ["\"use client\";\n\nimport { FieldLabel, useField } from \"@payloadcms/ui\";\nimport { useEffect, useState } from \"react\";\nimport { DayPicker } from \"react-day-picker/persian\";\nimport \"react-day-picker/style.css\";\n\nimport { canonicalizeJalaliPickerDate } from \"./jalali-picker-value\";\nimport { formatJalaliDate, type JalaliDateDisplayOptions } from \"../date/format-date\";\n\nimport type { JalaliPickerAppearance } from \"../date/picker-types\";\nimport type { DateFieldClientProps } from \"payload\";\n\ntype Props = { appearance: JalaliPickerAppearance, display: JalaliDateDisplayOptions };\n\nexport const JalaliDateFieldComponent = ({\n field, path, appearance, display, readOnly,\n}: DateFieldClientProps & Props) => {\n const { value, setValue, } = useField<string | null>({ path, });\n const [\n selected,\n setSelected\n ] = useState<Date | undefined>();\n useEffect(\n () => setSelected(value ? new Date(value) : undefined), [value]\n );\n const save = (date: Date | undefined) => {\n setSelected(date);\n setValue(date ? date.toISOString() : null);\n };\n const chooseDay = (date: Date | undefined) => {\n if (!date) return save(undefined);\n save(canonicalizeJalaliPickerDate(\n date, appearance\n ));\n };\n const updateTime = (\n part: \"hours\" | \"minutes\", raw: string\n ) => {\n const base = selected ? new Date(selected) : new Date();\n base[part === \"hours\" ? \"setHours\" : \"setMinutes\"](Number(raw));\n save(base);\n };\n const showCalendar = appearance !== \"timeOnly\";\n const showTime = appearance === \"dayAndTime\" || appearance === \"timeOnly\";\n return (\n <div className=\"field-type jalali-date-field\">\n <FieldLabel htmlFor={`field-${path}`} label={field.label} required={field.required} />\n <input\n readOnly value={formatJalaliDate(\n value, display\n ) ?? \"\"}\n />\n {showCalendar && <DayPicker\n captionLayout=\"dropdown\" disabled={readOnly} mode=\"single\"\n onSelect={chooseDay} selected={selected} showOutsideDays\n />}\n {showTime && (\n <div>\n <input\n disabled={readOnly} max={23} min={0}\n onChange={(event) => updateTime(\n \"hours\", event.target.value\n )} type=\"number\" value={selected?.getHours() ?? 0}\n />\n <span aria-hidden=\"true\">:</span>\n <input\n disabled={readOnly} max={59} min={0}\n onChange={(event) => updateTime(\n \"minutes\", event.target.value\n )} type=\"number\" value={selected?.getMinutes() ?? 0}\n />\n </div>\n )}\n {!readOnly && value && <button onClick={() => save(undefined)} type=\"button\">\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646</button>}\n </div>\n );\n};\n", "import { getDateLib } from \"react-day-picker/persian\";\n\nimport type { JalaliPickerAppearance } from \"../date/picker-types\";\n\nexport function canonicalizeJalaliPickerDate (\n date: Date, appearance: JalaliPickerAppearance\n): Date {\n const result = appearance === \"monthOnly\"\n ? getDateLib().startOfMonth(date)\n : new Date(date);\n\n if (appearance === \"dayOnly\" || appearance === \"monthOnly\") result.setHours(\n 12, 0, 0, 0\n );\n\n return result;\n}\n", "export type JalaliDateValue = Date | string | number | null | undefined;\nexport type JalaliDateDisplayOptions = {\n dateStyle?: \"short\" | \"medium\" | \"long\" | \"full\"\n timeStyle?: \"short\" | \"medium\"\n digits?: \"persian\" | \"latin\"\n timeZone?: string\n};\n\nexport function formatJalaliDate (\n value: JalaliDateValue, options: JalaliDateDisplayOptions = {}\n): string | null {\n if (value === null || value === undefined) return null;\n const date = value instanceof Date ? value : new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n const locale = options.digits === \"latin\" ? \"fa-IR-u-ca-persian-nu-latn\" : \"fa-IR-u-ca-persian\";\n return new Intl.DateTimeFormat(\n locale, {\n dateStyle: options.dateStyle ?? \"medium\",\n ...(options.timeStyle ? { timeStyle: options.timeStyle, } : {}),\n ...(options.timeZone ? { timeZone: options.timeZone, } : {}),\n }\n ).format(date);\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["import_persian"]
7
+ }
@@ -0,0 +1,11 @@
1
+ import "react-day-picker/style.css";
2
+ import { type JalaliDateDisplayOptions } from "../date/format-date";
3
+ import type { JalaliPickerAppearance } from "../date/picker-types";
4
+ import type { DateFieldClientProps } from "payload";
5
+ type Props = {
6
+ appearance: JalaliPickerAppearance;
7
+ display: JalaliDateDisplayOptions;
8
+ };
9
+ export declare const JalaliDateFieldComponent: ({ field, path, appearance, display, readOnly, }: DateFieldClientProps & Props) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=jalali-date-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jalali-date-field.d.ts","sourceRoot":"","sources":["../../src/admin/jalali-date-field.tsx"],"names":[],"mappings":"AAKA,OAAO,4BAA4B,CAAC;AAGpC,OAAO,EAAoB,KAAK,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,KAAK,KAAK,GAAG;IAAE,UAAU,EAAE,sBAAsB,CAAC;IAAC,OAAO,EAAE,wBAAwB,CAAA;CAAE,CAAC;AAEvF,eAAO,MAAM,wBAAwB,GAAI,iDAEtC,oBAAoB,GAAG,KAAK,4CA4D9B,CAAC"}
@@ -0,0 +1,135 @@
1
+ // @nexload-sdk/payload-fields v3.0.0 (build 2026-07-20T16:56:56.848Z)
2
+ "use client";
3
+
4
+ // src/admin/jalali-date-field.tsx
5
+ import { FieldLabel, useField } from "@payloadcms/ui";
6
+ import { useEffect, useState } from "react";
7
+ import { DayPicker } from "react-day-picker/persian";
8
+ import "react-day-picker/style.css";
9
+
10
+ // src/admin/jalali-picker-value.ts
11
+ import { getDateLib } from "react-day-picker/persian";
12
+ function canonicalizeJalaliPickerDate(date, appearance) {
13
+ const result = appearance === "monthOnly" ? getDateLib().startOfMonth(date) : new Date(date);
14
+ if (appearance === "dayOnly" || appearance === "monthOnly") result.setHours(
15
+ 12,
16
+ 0,
17
+ 0,
18
+ 0
19
+ );
20
+ return result;
21
+ }
22
+
23
+ // src/date/format-date.ts
24
+ function formatJalaliDate(value, options = {}) {
25
+ if (value === null || value === void 0) return null;
26
+ const date = value instanceof Date ? value : new Date(value);
27
+ if (Number.isNaN(date.getTime())) return null;
28
+ const locale = options.digits === "latin" ? "fa-IR-u-ca-persian-nu-latn" : "fa-IR-u-ca-persian";
29
+ return new Intl.DateTimeFormat(
30
+ locale,
31
+ {
32
+ dateStyle: options.dateStyle ?? "medium",
33
+ ...options.timeStyle ? { timeStyle: options.timeStyle } : {},
34
+ ...options.timeZone ? { timeZone: options.timeZone } : {}
35
+ }
36
+ ).format(date);
37
+ }
38
+
39
+ // src/admin/jalali-date-field.tsx
40
+ import { jsx, jsxs } from "react/jsx-runtime";
41
+ var JalaliDateFieldComponent = ({
42
+ field,
43
+ path,
44
+ appearance,
45
+ display,
46
+ readOnly
47
+ }) => {
48
+ const { value, setValue } = useField({ path });
49
+ const [
50
+ selected,
51
+ setSelected
52
+ ] = useState();
53
+ useEffect(
54
+ () => setSelected(value ? new Date(value) : void 0),
55
+ [value]
56
+ );
57
+ const save = (date) => {
58
+ setSelected(date);
59
+ setValue(date ? date.toISOString() : null);
60
+ };
61
+ const chooseDay = (date) => {
62
+ if (!date) return save(void 0);
63
+ save(canonicalizeJalaliPickerDate(
64
+ date,
65
+ appearance
66
+ ));
67
+ };
68
+ const updateTime = (part, raw) => {
69
+ const base = selected ? new Date(selected) : /* @__PURE__ */ new Date();
70
+ base[part === "hours" ? "setHours" : "setMinutes"](Number(raw));
71
+ save(base);
72
+ };
73
+ const showCalendar = appearance !== "timeOnly";
74
+ const showTime = appearance === "dayAndTime" || appearance === "timeOnly";
75
+ return /* @__PURE__ */ jsxs("div", { className: "field-type jalali-date-field", children: [
76
+ /* @__PURE__ */ jsx(FieldLabel, { htmlFor: `field-${path}`, label: field.label, required: field.required }),
77
+ /* @__PURE__ */ jsx(
78
+ "input",
79
+ {
80
+ readOnly: true,
81
+ value: formatJalaliDate(
82
+ value,
83
+ display
84
+ ) ?? ""
85
+ }
86
+ ),
87
+ showCalendar && /* @__PURE__ */ jsx(
88
+ DayPicker,
89
+ {
90
+ captionLayout: "dropdown",
91
+ disabled: readOnly,
92
+ mode: "single",
93
+ onSelect: chooseDay,
94
+ selected,
95
+ showOutsideDays: true
96
+ }
97
+ ),
98
+ showTime && /* @__PURE__ */ jsxs("div", { children: [
99
+ /* @__PURE__ */ jsx(
100
+ "input",
101
+ {
102
+ disabled: readOnly,
103
+ max: 23,
104
+ min: 0,
105
+ onChange: (event) => updateTime(
106
+ "hours",
107
+ event.target.value
108
+ ),
109
+ type: "number",
110
+ value: selected?.getHours() ?? 0
111
+ }
112
+ ),
113
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: ":" }),
114
+ /* @__PURE__ */ jsx(
115
+ "input",
116
+ {
117
+ disabled: readOnly,
118
+ max: 59,
119
+ min: 0,
120
+ onChange: (event) => updateTime(
121
+ "minutes",
122
+ event.target.value
123
+ ),
124
+ type: "number",
125
+ value: selected?.getMinutes() ?? 0
126
+ }
127
+ )
128
+ ] }),
129
+ !readOnly && value && /* @__PURE__ */ jsx("button", { onClick: () => save(void 0), type: "button", children: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646" })
130
+ ] });
131
+ };
132
+ export {
133
+ JalaliDateFieldComponent
134
+ };
135
+ //# sourceMappingURL=jalali-date-field.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/admin/jalali-date-field.tsx", "../../src/admin/jalali-picker-value.ts", "../../src/date/format-date.ts"],
4
+ "sourcesContent": ["\"use client\";\n\nimport { FieldLabel, useField } from \"@payloadcms/ui\";\nimport { useEffect, useState } from \"react\";\nimport { DayPicker } from \"react-day-picker/persian\";\nimport \"react-day-picker/style.css\";\n\nimport { canonicalizeJalaliPickerDate } from \"./jalali-picker-value\";\nimport { formatJalaliDate, type JalaliDateDisplayOptions } from \"../date/format-date\";\n\nimport type { JalaliPickerAppearance } from \"../date/picker-types\";\nimport type { DateFieldClientProps } from \"payload\";\n\ntype Props = { appearance: JalaliPickerAppearance, display: JalaliDateDisplayOptions };\n\nexport const JalaliDateFieldComponent = ({\n field, path, appearance, display, readOnly,\n}: DateFieldClientProps & Props) => {\n const { value, setValue, } = useField<string | null>({ path, });\n const [\n selected,\n setSelected\n ] = useState<Date | undefined>();\n useEffect(\n () => setSelected(value ? new Date(value) : undefined), [value]\n );\n const save = (date: Date | undefined) => {\n setSelected(date);\n setValue(date ? date.toISOString() : null);\n };\n const chooseDay = (date: Date | undefined) => {\n if (!date) return save(undefined);\n save(canonicalizeJalaliPickerDate(\n date, appearance\n ));\n };\n const updateTime = (\n part: \"hours\" | \"minutes\", raw: string\n ) => {\n const base = selected ? new Date(selected) : new Date();\n base[part === \"hours\" ? \"setHours\" : \"setMinutes\"](Number(raw));\n save(base);\n };\n const showCalendar = appearance !== \"timeOnly\";\n const showTime = appearance === \"dayAndTime\" || appearance === \"timeOnly\";\n return (\n <div className=\"field-type jalali-date-field\">\n <FieldLabel htmlFor={`field-${path}`} label={field.label} required={field.required} />\n <input\n readOnly value={formatJalaliDate(\n value, display\n ) ?? \"\"}\n />\n {showCalendar && <DayPicker\n captionLayout=\"dropdown\" disabled={readOnly} mode=\"single\"\n onSelect={chooseDay} selected={selected} showOutsideDays\n />}\n {showTime && (\n <div>\n <input\n disabled={readOnly} max={23} min={0}\n onChange={(event) => updateTime(\n \"hours\", event.target.value\n )} type=\"number\" value={selected?.getHours() ?? 0}\n />\n <span aria-hidden=\"true\">:</span>\n <input\n disabled={readOnly} max={59} min={0}\n onChange={(event) => updateTime(\n \"minutes\", event.target.value\n )} type=\"number\" value={selected?.getMinutes() ?? 0}\n />\n </div>\n )}\n {!readOnly && value && <button onClick={() => save(undefined)} type=\"button\">\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646</button>}\n </div>\n );\n};\n", "import { getDateLib } from \"react-day-picker/persian\";\n\nimport type { JalaliPickerAppearance } from \"../date/picker-types\";\n\nexport function canonicalizeJalaliPickerDate (\n date: Date, appearance: JalaliPickerAppearance\n): Date {\n const result = appearance === \"monthOnly\"\n ? getDateLib().startOfMonth(date)\n : new Date(date);\n\n if (appearance === \"dayOnly\" || appearance === \"monthOnly\") result.setHours(\n 12, 0, 0, 0\n );\n\n return result;\n}\n", "export type JalaliDateValue = Date | string | number | null | undefined;\nexport type JalaliDateDisplayOptions = {\n dateStyle?: \"short\" | \"medium\" | \"long\" | \"full\"\n timeStyle?: \"short\" | \"medium\"\n digits?: \"persian\" | \"latin\"\n timeZone?: string\n};\n\nexport function formatJalaliDate (\n value: JalaliDateValue, options: JalaliDateDisplayOptions = {}\n): string | null {\n if (value === null || value === undefined) return null;\n const date = value instanceof Date ? value : new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n const locale = options.digits === \"latin\" ? \"fa-IR-u-ca-persian-nu-latn\" : \"fa-IR-u-ca-persian\";\n return new Intl.DateTimeFormat(\n locale, {\n dateStyle: options.dateStyle ?? \"medium\",\n ...(options.timeStyle ? { timeStyle: options.timeStyle, } : {}),\n ...(options.timeZone ? { timeZone: options.timeZone, } : {}),\n }\n ).format(date);\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,42 @@
1
+ // @nexload-sdk/payload-fields v3.0.0 (build 2026-07-20T16:56:57.614Z)
2
+ "use strict";
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/admin/jalali-picker-value.ts
22
+ var jalali_picker_value_exports = {};
23
+ __export(jalali_picker_value_exports, {
24
+ canonicalizeJalaliPickerDate: () => canonicalizeJalaliPickerDate
25
+ });
26
+ module.exports = __toCommonJS(jalali_picker_value_exports);
27
+ var import_persian = require("react-day-picker/persian");
28
+ function canonicalizeJalaliPickerDate(date, appearance) {
29
+ const result = appearance === "monthOnly" ? (0, import_persian.getDateLib)().startOfMonth(date) : new Date(date);
30
+ if (appearance === "dayOnly" || appearance === "monthOnly") result.setHours(
31
+ 12,
32
+ 0,
33
+ 0,
34
+ 0
35
+ );
36
+ return result;
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ canonicalizeJalaliPickerDate
41
+ });
42
+ //# sourceMappingURL=jalali-picker-value.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/admin/jalali-picker-value.ts"],
4
+ "sourcesContent": ["import { getDateLib } from \"react-day-picker/persian\";\n\nimport type { JalaliPickerAppearance } from \"../date/picker-types\";\n\nexport function canonicalizeJalaliPickerDate (\n date: Date, appearance: JalaliPickerAppearance\n): Date {\n const result = appearance === \"monthOnly\"\n ? getDateLib().startOfMonth(date)\n : new Date(date);\n\n if (appearance === \"dayOnly\" || appearance === \"monthOnly\") result.setHours(\n 12, 0, 0, 0\n );\n\n return result;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA2B;AAIpB,SAAS,6BACd,MAAY,YACN;AACN,QAAM,SAAS,eAAe,kBAC1B,2BAAW,EAAE,aAAa,IAAI,IAC9B,IAAI,KAAK,IAAI;AAEjB,MAAI,eAAe,aAAa,eAAe,YAAa,QAAO;AAAA,IACjE;AAAA,IAAI;AAAA,IAAG;AAAA,IAAG;AAAA,EACZ;AAEA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { JalaliPickerAppearance } from "../date/picker-types";
2
+ export declare function canonicalizeJalaliPickerDate(date: Date, appearance: JalaliPickerAppearance): Date;
3
+ //# sourceMappingURL=jalali-picker-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jalali-picker-value.d.ts","sourceRoot":"","sources":["../../src/admin/jalali-picker-value.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,sBAAsB,GAC7C,IAAI,CAUN"}