@neo4j-ndl/react 4.16.5 → 4.16.6

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 (34) hide show
  1. package/lib/cjs/_generated/style-rules/date-utils.js +55 -0
  2. package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -1
  3. package/lib/cjs/_generated/style-rules/index.js +3 -1
  4. package/lib/cjs/_generated/style-rules/index.js.map +1 -1
  5. package/lib/cjs/_generated/style-rules/literal-schemas.js +19 -1
  6. package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
  7. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +9 -9
  8. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
  9. package/lib/cjs/data-grid/style-rules/evaluate.js +3 -0
  10. package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
  11. package/lib/cjs/data-grid/style-rules/types.js +16 -2
  12. package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
  13. package/lib/esm/_generated/style-rules/date-utils.js +54 -0
  14. package/lib/esm/_generated/style-rules/date-utils.js.map +1 -1
  15. package/lib/esm/_generated/style-rules/index.js +2 -2
  16. package/lib/esm/_generated/style-rules/index.js.map +1 -1
  17. package/lib/esm/_generated/style-rules/literal-schemas.js +19 -1
  18. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
  19. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +9 -9
  20. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
  21. package/lib/esm/data-grid/style-rules/evaluate.js +4 -1
  22. package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
  23. package/lib/esm/data-grid/style-rules/types.js +16 -2
  24. package/lib/esm/data-grid/style-rules/types.js.map +1 -1
  25. package/lib/types/_generated/style-rules/date-utils.d.ts +20 -0
  26. package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -1
  27. package/lib/types/_generated/style-rules/index.d.ts +3 -3
  28. package/lib/types/_generated/style-rules/index.d.ts.map +1 -1
  29. package/lib/types/_generated/style-rules/literal-schemas.d.ts +17 -0
  30. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
  31. package/lib/types/data-grid/style-rules/evaluate.d.ts.map +1 -1
  32. package/lib/types/data-grid/style-rules/types.d.ts +20 -2
  33. package/lib/types/data-grid/style-rules/types.d.ts.map +1 -1
  34. package/package.json +1 -1
@@ -7,6 +7,7 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.parseTimeString = parseTimeString;
9
9
  exports.parseDateString = parseDateString;
10
+ exports.parseLocalDateString = parseLocalDateString;
10
11
  /**
11
12
  *
12
13
  * Copyright (c) "Neo4j"
@@ -142,4 +143,58 @@ function parseDateString(s) {
142
143
  }
143
144
  return null;
144
145
  }
146
+ /**
147
+ * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix
148
+ * millisecond timestamp, interpreting the wall-clock time in the given
149
+ * `timeZone` (defaults to the browser's local timezone via
150
+ * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be
151
+ * parsed or contains any timezone qualifier.
152
+ *
153
+ * Only plain date/datetime strings are accepted — strings with `Z`, a
154
+ * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)
155
+ * are **rejected** and return `null`. This mirrors the semantics of
156
+ * Neo4j `LocalDateTime`, which has no associated timezone.
157
+ *
158
+ * Accepted formats:
159
+ * - Plain datetime: `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
160
+ * - Date-only (treated as local midnight): `"2024-01-01"`
161
+ *
162
+ * The optional `timeZone` parameter overrides the browser's local timezone,
163
+ * which is useful for deterministic testing.
164
+ */
165
+ function parseLocalDateString(s, timeZone) {
166
+ // Reject strings that carry explicit timezone information. This mirrors the
167
+ // cascade in parseDateString but uses successful parsing as a rejection
168
+ // signal rather than an acceptance signal:
169
+ //
170
+ // - ZonedDateTime.from succeeds → string has an IANA bracket → reject
171
+ // - Instant.from succeeds → string has Z or a fixed offset → reject
172
+ // - PlainDateTime.from succeeds → truly plain string → accept
173
+ //
174
+ // The polyfill's PlainDateTime.from() silently strips offsets/brackets
175
+ // instead of throwing, so these two pre-checks are necessary to enforce
176
+ // the plain-only constraint.
177
+ try {
178
+ temporal_polyfill_1.Temporal.ZonedDateTime.from(s);
179
+ return null;
180
+ }
181
+ catch (_a) {
182
+ /* not a zoned datetime — continue */
183
+ }
184
+ try {
185
+ temporal_polyfill_1.Temporal.Instant.from(s);
186
+ return null;
187
+ }
188
+ catch (_b) {
189
+ /* not a UTC/offset instant — continue */
190
+ }
191
+ const tz = timeZone !== null && timeZone !== void 0 ? timeZone : temporal_polyfill_1.Temporal.Now.timeZoneId();
192
+ try {
193
+ return temporal_polyfill_1.Temporal.PlainDateTime.from(s).toZonedDateTime(tz).epochMilliseconds;
194
+ }
195
+ catch (_c) {
196
+ /* empty */
197
+ }
198
+ return null;
199
+ }
145
200
  //# sourceMappingURL=date-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA6DH,0CAyCC;AAmBD,0CA0BC;AAjJD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yDAA6C;AAE7C,MAAM,UAAU,GAAG,QAAU,CAAC;AAE9B,SAAS,aAAa,CAAC,EAAsB;IAC3C,OAAO,CACL,EAAE,CAAC,IAAI,GAAG,OAAS;QACnB,EAAE,CAAC,MAAM,GAAG,KAAM;QAClB,EAAE,CAAC,MAAM,GAAG,IAAK;QACjB,EAAE,CAAC,WAAW,CACf,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,SAAiB;IACtC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,I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esContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(s: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (s.includes('T') || s.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = s.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = s.slice(0, s.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).\n */\nexport function parseDateString(s: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA6DH,0CAyCC;AAmBD,0CA0BC;AAqBD,oDAqCC;AA3MD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yDAA6C;AAE7C,MAAM,UAAU,GAAG,QAAU,CAAC;AAE9B,SAAS,aAAa,CAAC,EAAsB;IAC3C,OAAO,CACL,EAAE,CAAC,IAAI,GAAG,OAAS;QACnB,EAAE,CAAC,MAAM,GAAG,KAAM;QAClB,EAAE,CAAC,MAAM,GAAG,IAAK;QACjB,EAAE,CAAC,WAAW,CACf,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,SAAiB;IACtC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,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ED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,oBAAoB,CAClC,CAAS,EACT,QAAiB;IAEjB,4EAA4E;IAC5E,wEAAwE;IACxE,2CAA2C;IAC3C,EAAE;IACF,uEAAuE;IACvE,2EAA2E;IAC3E,+DAA+D;IAC/D,EAAE;IACF,uEAAuE;IACvE,wEAAwE;IACxE,6BAA6B;IAC7B,IAAI,CAAC;QACH,4BAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,qCAAqC;IACvC,CAAC;IAED,IAAI,CAAC;QACH,4BAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,yCAAyC;IAC3C,CAAC;IAED,MAAM,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,4BAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACjD,IAAI,CAAC;QACH,OAAO,4BAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC;IAC9E,CAAC;IAAC,WAAM,CAAC;QACP,WAAW;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(s: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (s.includes('T') || s.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = s.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = s.slice(0, s.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).\n */\nexport function parseDateString(s: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix\n * millisecond timestamp, interpreting the wall-clock time in the given\n * `timeZone` (defaults to the browser's local timezone via\n * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be\n * parsed or contains any timezone qualifier.\n *\n * Only plain date/datetime strings are accepted — strings with `Z`, a\n * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)\n * are **rejected** and return `null`. This mirrors the semantics of\n * Neo4j `LocalDateTime`, which has no associated timezone.\n *\n * Accepted formats:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * The optional `timeZone` parameter overrides the browser's local timezone,\n * which is useful for deterministic testing.\n */\nexport function parseLocalDateString(\n s: string,\n timeZone?: string,\n): number | null {\n // Reject strings that carry explicit timezone information. This mirrors the\n // cascade in parseDateString but uses successful parsing as a rejection\n // signal rather than an acceptance signal:\n //\n // - ZonedDateTime.from succeeds → string has an IANA bracket → reject\n // - Instant.from succeeds → string has Z or a fixed offset → reject\n // - PlainDateTime.from succeeds → truly plain string → accept\n //\n // The polyfill's PlainDateTime.from() silently strips offsets/brackets\n // instead of throwing, so these two pre-checks are necessary to enforce\n // the plain-only constraint.\n try {\n Temporal.ZonedDateTime.from(s);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(s);\n return null;\n } catch {\n /* not a UTC/offset instant — continue */\n }\n\n const tz = timeZone ?? Temporal.Now.timeZoneId();\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime(tz).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.TimeLiteralSchema = exports.DatetimeLiteralSchema = exports.parseTimeString = exports.parseDateString = exports.lerpColor = exports.getWeight = void 0;
8
+ exports.TimeLiteralSchema = exports.LocalDatetimeLiteralSchema = exports.DatetimeLiteralSchema = exports.parseTimeString = exports.parseLocalDateString = exports.parseDateString = exports.lerpColor = exports.getWeight = void 0;
9
9
  /**
10
10
  *
11
11
  * Copyright (c) "Neo4j"
@@ -31,8 +31,10 @@ Object.defineProperty(exports, "getWeight", { enumerable: true, get: function ()
31
31
  Object.defineProperty(exports, "lerpColor", { enumerable: true, get: function () { return color_utils_1.lerpColor; } });
32
32
  var date_utils_1 = require("./date-utils");
33
33
  Object.defineProperty(exports, "parseDateString", { enumerable: true, get: function () { return date_utils_1.parseDateString; } });
34
+ Object.defineProperty(exports, "parseLocalDateString", { enumerable: true, get: function () { return date_utils_1.parseLocalDateString; } });
34
35
  Object.defineProperty(exports, "parseTimeString", { enumerable: true, get: function () { return date_utils_1.parseTimeString; } });
35
36
  var literal_schemas_1 = require("./literal-schemas");
36
37
  Object.defineProperty(exports, "DatetimeLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.DatetimeLiteralSchema; } });
38
+ Object.defineProperty(exports, "LocalDatetimeLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.LocalDatetimeLiteralSchema; } });
37
39
  Object.defineProperty(exports, "TimeLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.TimeLiteralSchema; } });
38
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6CAAqD;AAA5C,wGAAA,SAAS,OAAA;AAAE,wGAAA,SAAS,OAAA;AAC7B,2CAAgE;AAAvD,6GAAA,eAAe,OAAA;AAAE,6GAAA,eAAe,OAAA;AACzC,qDAA6E;AAApE,wHAAA,qBAAqB,OAAA;AAAE,oHAAA,iBAAiB,OAAA","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { getWeight, lerpColor } from './color-utils';\nexport { parseDateString, parseTimeString } from './date-utils';\nexport { DatetimeLiteralSchema, TimeLiteralSchema } from './literal-schemas';\nexport type { DatetimeLiteral, TimeLiteral } from './literal-schemas';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6CAAqD;AAA5C,wGAAA,SAAS,OAAA;AAAE,wGAAA,SAAS,OAAA;AAC7B,2CAIsB;AAHpB,6GAAA,eAAe,OAAA;AACf,kHAAA,oBAAoB,OAAA;AACpB,6GAAA,eAAe,OAAA;AAEjB,qDAI2B;AAHzB,wHAAA,qBAAqB,OAAA;AACrB,6HAAA,0BAA0B,OAAA;AAC1B,oHAAA,iBAAiB,OAAA","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { getWeight, lerpColor } from './color-utils';\nexport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\nexport {\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n} from './literal-schemas';\nexport type {\n DatetimeLiteral,\n LocalDatetimeLiteral,\n TimeLiteral,\n} from './literal-schemas';\n"]}
@@ -5,7 +5,7 @@
5
5
  * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.TimeLiteralSchema = exports.DatetimeLiteralSchema = void 0;
8
+ exports.TimeLiteralSchema = exports.LocalDatetimeLiteralSchema = exports.DatetimeLiteralSchema = void 0;
9
9
  /**
10
10
  *
11
11
  * Copyright (c) "Neo4j"
@@ -43,6 +43,24 @@ exports.DatetimeLiteralSchema = zod_1.z.object({
43
43
  message: 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',
44
44
  }),
45
45
  });
46
+ /**
47
+ * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix
48
+ * millisecond timestamp at evaluation time, interpreting the wall-clock time
49
+ * in the browser's local timezone.
50
+ *
51
+ * Only plain date/datetime strings without timezone qualifiers are accepted:
52
+ * - Plain datetime: `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
53
+ * - Date-only (treated as local midnight): `"2024-01-01"`
54
+ *
55
+ * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket
56
+ * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for
57
+ * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.
58
+ */
59
+ exports.LocalDatetimeLiteralSchema = zod_1.z.object({
60
+ localdatetime: zod_1.z.string().refine((s) => (0, date_utils_1.parseLocalDateString)(s) !== null, {
61
+ message: 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',
62
+ }),
63
+ });
46
64
  /**
47
65
  * An ISO 8601 time literal that resolves to milliseconds since UTC midnight
48
66
  * at evaluation time. Supported formats:
@@ -1 +1 @@
1
- {"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6BAAwB;AAExB,6CAAgE;AAEhE;;;;;;;;;GASG;AACU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC9D,OAAO,EACL,sEAAsE;KACzE,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC1D,OAAO,EACL,iFAAiF;KACpF,CAAC;CACH,CAAC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport { parseDateString, parseTimeString } from './date-utils';\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((s) => parseDateString(s) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((s) => parseTimeString(s) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n"]}
1
+ {"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6BAAwB;AAExB,6CAIsB;AAEtB;;;;;;;;;GASG;AACU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC9D,OAAO,EACL,sEAAsE;KACzE,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACU,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,iCAAoB,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QACxE,OAAO,EACL,kGAAkG;KACrG,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC1D,OAAO,EACL,iFAAiF;KACpF,CAAC;CACH,CAAC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((s) => parseDateString(s) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n localdatetime: z.string().refine((s) => parseLocalDateString(s) !== null, {\n message:\n 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n }),\n});\nexport type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((s) => parseTimeString(s) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n"]}
@@ -28,79 +28,79 @@ const data = [
28
28
  // ── Past events (before start of 2026-06-25 in Stockholm / CEST) ──────────
29
29
  {
30
30
  event: 'Quarterly review',
31
+ localTimeDisplay: '09:00 CEST (+02:00)',
31
32
  // 09:00 Stockholm CEST = 07:00 UTC
32
33
  scheduledDate: new Date('2026-06-10T09:00:00+02:00'),
33
34
  scheduledTimeMs: 7 * 3600000,
34
- localTimeDisplay: '09:00 CEST (+02:00)',
35
35
  status: 'confirmed',
36
36
  },
37
37
  {
38
38
  event: 'Security audit',
39
+ localTimeDisplay: '07:30 BST (+01:00)',
39
40
  // 07:30 London BST (+01:00) = 06:30 UTC — before Stockholm opens
40
41
  scheduledDate: new Date('2026-06-18T07:30:00+01:00'),
41
42
  scheduledTimeMs: 6 * 3600000 + 30 * 60000,
42
- localTimeDisplay: '07:30 BST (+01:00)',
43
43
  status: 'delayed',
44
44
  },
45
45
  // ── Today (2026-06-25 in Stockholm / CEST) ─────────────────────────────────
46
46
  {
47
47
  event: 'Customer demo',
48
+ localTimeDisplay: '09:00 EDT (-04:00)',
48
49
  // 09:00 New York EDT (-04:00) = 13:00 UTC
49
50
  scheduledDate: new Date('2026-06-25T09:00:00-04:00'),
50
51
  scheduledTimeMs: 13 * 3600000,
51
- localTimeDisplay: '09:00 EDT (-04:00)',
52
52
  status: 'confirmed',
53
53
  },
54
54
  {
55
55
  event: 'Platform migration',
56
+ localTimeDisplay: '22:00 CEST (+02:00)',
56
57
  // 22:00 Stockholm CEST (+02:00) = 20:00 UTC — after Stockholm closes
57
58
  scheduledDate: new Date('2026-06-25T22:00:00+02:00'),
58
59
  scheduledTimeMs: 20 * 3600000,
59
- localTimeDisplay: '22:00 CEST (+02:00)',
60
60
  status: 'confirmed',
61
61
  },
62
62
  // ── Near future (up to and including 2026-07-14 in Stockholm) ─────────────
63
63
  {
64
64
  event: 'Board presentation',
65
+ localTimeDisplay: '10:00 SGT (+08:00)',
65
66
  // 10:00 Singapore SGT (+08:00) = 02:00 UTC — before Stockholm opens
66
67
  scheduledDate: new Date('2026-07-02T10:00:00+08:00'),
67
68
  scheduledTimeMs: 2 * 3600000,
68
- localTimeDisplay: '10:00 SGT (+08:00)',
69
69
  status: 'confirmed',
70
70
  },
71
71
  {
72
72
  event: 'Partner onboarding',
73
+ localTimeDisplay: '13:15 CEST (+02:00)',
73
74
  // 13:15 Paris CEST (+02:00) = 11:15 UTC
74
75
  scheduledDate: new Date('2026-07-08T13:15:00+02:00'),
75
76
  scheduledTimeMs: 11 * 3600000 + 15 * 60000,
76
- localTimeDisplay: '13:15 CEST (+02:00)',
77
77
  status: 'cancelled',
78
78
  },
79
79
  // ── Far future (after 2026-07-15T00:00 Stockholm / CEST = 2026-07-14T22:00Z)
80
80
  {
81
81
  event: 'Architecture summit',
82
+ localTimeDisplay: '08:00 CEST (+02:00)',
82
83
  // 08:00 Amsterdam CEST (+02:00) = 06:00 UTC.
83
84
  // Although the calendar date is "July 15", 08:00 CEST is still within the
84
85
  // same UTC day as July 14 22:00Z, so it crosses the far-future boundary.
85
86
  scheduledDate: new Date('2026-07-15T08:00:00+02:00'),
86
87
  scheduledTimeMs: 6 * 3600000,
87
- localTimeDisplay: '08:00 CEST (+02:00)',
88
88
  status: 'confirmed',
89
89
  },
90
90
  {
91
91
  event: 'Annual conference',
92
+ localTimeDisplay: '09:00 PDT (-07:00)',
92
93
  // 09:00 San Francisco PDT (-07:00) = 16:00 UTC — after Stockholm closes
93
94
  scheduledDate: new Date('2026-08-03T09:00:00-07:00'),
94
95
  scheduledTimeMs: 16 * 3600000,
95
- localTimeDisplay: '09:00 PDT (-07:00)',
96
96
  status: 'confirmed',
97
97
  },
98
98
  {
99
99
  event: 'Year-end planning',
100
+ localTimeDisplay: '09:00 JST (+09:00)',
100
101
  // 09:00 Tokyo JST (+09:00) = 00:00 UTC — midnight, well before Stockholm opens
101
102
  scheduledDate: new Date('2026-11-20T09:00:00+09:00'),
102
103
  scheduledTimeMs: 0,
103
- localTimeDisplay: '09:00 JST (+09:00)',
104
104
  status: 'confirmed',
105
105
  },
106
106
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"datagrid-rule-based-styling-datetime.story.js","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-rule-based-styling-datetime.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA4C;AAC5C,uDAM+B;AAsB/B,MAAM,IAAI,GAAe;IACvB,6EAA6E;IAC7E;QACE,KAAK,EAAE,kBAAkB;QACzB,mCAAmC;QACnC,aAAa,EAAE,IAAI,IAAI,CAAC,2BAA2B,CAAC;QACpD,eAAe,EAAE,CAAC,GAAG,OAAS;QAC9B,gBAAgB,EAAE,qBAAqB;QACvC,MAAM,EAAE,WAAW;KACpB;IACD;QACE,KAAK,EAAE,gBAAgB;QACvB,iEAAiE;QACjE,aAAa,EAAE,IAAI,IAAI,CAAC,2BAA2B,CAAC;QACpD,eAAe,EAAE,CAAC,GAAG,OAAS,GAAG,EAAE,GAAG,KAAM;QAC5C,gBAAgB,EAAE,oBAAoB;QACtC,MAAM,EAAE,SAAS;KAClB;IACD,8EAA8E;IAC9E;QACE,KAAK,EAAE,eAAe;QACtB,0CAA0C;QAC1C,aAAa,EAAE,IAAI,IAAI,CAAC,2BAA2B,CAAC;QACpD,eAAe,EAAE,EAAE,GAAG,OAAS;QAC/B,gBAAgB,EAAE,oBAAoB;QACtC,MAAM,EAAE,WAAW;KACpB;IACD;QACE,KAAK,EAAE,oBAAoB;QAC3B,qEAAqE;QACrE,aAAa,EAAE,IAAI,IAAI,CAAC,2BAA2B,CAAC;QACpD,eAAe,EAAE,EAAE,GAAG,OAAS;QAC/B,gBAAgB,EAAE,qBAAqB;QACvC,MAAM,EAAE,WAAW;KACpB;IACD,6EAA6E;IAC7E;QACE,KAAK,EAAE,oBAAoB;QAC3B,oEAAoE;QACpE,aAAa,EAAE,IAAI,IAAI,CAAC,2BAA2B,CAAC;QACpD,eAAe,EAAE,CAAC,GAAG,OAAS;QAC9B,gBAAgB,EAAE,oBAAoB;QACtC,MAAM,EAAE,WAAW;KACpB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,QAAQ,EAAE,EAAE,EAAE;SAC7B;KACF,CAAC,CAAC;IAEH,OAAO,CACL,gCAAK,SAAS,EAAC,0CAA0C,YACvD,uBAAC,gBAAQ,IACP,WAAW,EAAE,KAAK,EAClB,mBAAmB,EAAE,KAAK,EAC1B,aAAa,EAAE,KAAK,EACpB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE;gBACP,WAAW,EAAE,WAAW;gBACxB,eAAe,EAAE,IAAI;gBACrB,gBAAgB,EAAE,KAAK;aACxB,GACD,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { DataGrid } from '@neo4j-ndl/react';\nimport {\n createColumnHelper,\n getCoreRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n} from '@tanstack/react-table';\n\nimport { type DataGridStyleRule } from '../style-rules/types';\n\ntype EventRow = {\n event: string;\n /**\n * JS Date coerced from the event's local ISO string. Natively converted to\n * Unix ms by the engine and compared against { datetime: \"...\" } literals.\n */\n scheduledDate: Date;\n /**\n * UTC milliseconds since midnight. Compared against { time: \"...\" } literals\n * that are defined in Stockholm / CEST (+02:00) time — the engine normalises\n * both sides to UTC before comparing.\n */\n scheduledTimeMs: number;\n /** Human-readable local time shown in the cell, e.g. \"09:00 CEST (+02:00)\". */\n localTimeDisplay: string;\n status: 'confirmed' | 'delayed' | 'cancelled';\n};\n\nconst data: EventRow[] = [\n // ── Past events (before start of 2026-06-25 in Stockholm / CEST) ──────────\n {\n event: 'Quarterly review',\n // 09:00 Stockholm CEST = 07:00 UTC\n scheduledDate: new Date('2026-06-10T09:00:00+02:00'),\n scheduledTimeMs: 7 * 3_600_000,\n localTimeDisplay: '09:00 CEST (+02:00)',\n status: 'confirmed',\n },\n {\n event: 'Security audit',\n // 07:30 London BST (+01:00) = 06:30 UTC — before Stockholm opens\n scheduledDate: new Date('2026-06-18T07:30:00+01:00'),\n scheduledTimeMs: 6 * 3_600_000 + 30 * 60_000,\n localTimeDisplay: '07:30 BST (+01:00)',\n status: 'delayed',\n },\n // ── Today (2026-06-25 in Stockholm / CEST) ─────────────────────────────────\n {\n event: 'Customer demo',\n // 09:00 New York EDT (-04:00) = 13:00 UTC\n scheduledDate: new Date('2026-06-25T09:00:00-04:00'),\n scheduledTimeMs: 13 * 3_600_000,\n localTimeDisplay: '09:00 EDT (-04:00)',\n status: 'confirmed',\n },\n {\n event: 'Platform migration',\n // 22:00 Stockholm CEST (+02:00) = 20:00 UTC — after Stockholm closes\n scheduledDate: new Date('2026-06-25T22:00:00+02:00'),\n scheduledTimeMs: 20 * 3_600_000,\n localTimeDisplay: '22:00 CEST (+02:00)',\n status: 'confirmed',\n },\n // ── Near future (up to and including 2026-07-14 in Stockholm) ─────────────\n {\n event: 'Board presentation',\n // 10:00 Singapore SGT (+08:00) = 02:00 UTC — before Stockholm opens\n scheduledDate: new Date('2026-07-02T10:00:00+08:00'),\n scheduledTimeMs: 2 * 3_600_000,\n localTimeDisplay: '10:00 SGT (+08:00)',\n status: 'confirmed',\n },\n {\n event: 'Partner onboarding',\n // 13:15 Paris CEST (+02:00) = 11:15 UTC\n scheduledDate: new Date('2026-07-08T13:15:00+02:00'),\n scheduledTimeMs: 11 * 3_600_000 + 15 * 60_000,\n localTimeDisplay: '13:15 CEST (+02:00)',\n status: 'cancelled',\n },\n // ── Far future (after 2026-07-15T00:00 Stockholm / CEST = 2026-07-14T22:00Z)\n {\n event: 'Architecture summit',\n // 08:00 Amsterdam CEST (+02:00) = 06:00 UTC.\n // Although the calendar date is \"July 15\", 08:00 CEST is still within the\n // same UTC day as July 14 22:00Z, so it crosses the far-future boundary.\n scheduledDate: new Date('2026-07-15T08:00:00+02:00'),\n scheduledTimeMs: 6 * 3_600_000,\n localTimeDisplay: '08:00 CEST (+02:00)',\n status: 'confirmed',\n },\n {\n event: 'Annual conference',\n // 09:00 San Francisco PDT (-07:00) = 16:00 UTC — after Stockholm closes\n scheduledDate: new Date('2026-08-03T09:00:00-07:00'),\n scheduledTimeMs: 16 * 3_600_000,\n localTimeDisplay: '09:00 PDT (-07:00)',\n status: 'confirmed',\n },\n {\n event: 'Year-end planning',\n // 09:00 Tokyo JST (+09:00) = 00:00 UTC — midnight, well before Stockholm opens\n scheduledDate: new Date('2026-11-20T09:00:00+09:00'),\n scheduledTimeMs: 0,\n localTimeDisplay: '09:00 JST (+09:00)',\n status: 'confirmed',\n },\n];\n\n/**\n * All date and time boundaries are anchored to Stockholm in June–July 2026.\n * Date literals use RFC 9557 IANA bracket notation — the UTC offset is inferred\n * from the named zone (CEST = +02:00 in this period); writing `+02:00` explicitly\n * is optional. Time literals use UTC-offset notation.\n *\n * \"Today\" from a Stockholm perspective:\n * 2026-06-25T00:00:00[Europe/Stockholm] = 2026-06-24T22:00:00Z\n * 2026-06-26T00:00:00[Europe/Stockholm] = 2026-06-25T22:00:00Z\n *\n * \"Far future\" threshold:\n * 2026-07-15T00:00:00[Europe/Stockholm] = 2026-07-14T22:00:00Z\n *\n * Business hours (Stockholm):\n * { time: '09:00:00+02:00' } resolves to 07:00 UTC (25 200 000 ms)\n * { time: '17:00:00+02:00' } resolves to 15:00 UTC (54 000 000 ms)\n */\nconst styleRules: DataGridStyleRule[] = [\n // Past events — entire row in muted red\n {\n apply: {\n color: { value: '#fee2e2' },\n textColor: { value: '#7f1d1d' },\n },\n column: null,\n priority: 1,\n where: {\n lessThan: [\n { column: 'scheduledDate' },\n { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },\n ],\n },\n },\n // Today (in Stockholm timezone) — entire row in amber\n {\n apply: {\n color: { value: '#fef9c3' },\n textColor: { value: '#713f12' },\n },\n column: null,\n priority: 1,\n where: {\n and: [\n {\n greaterThanOrEqual: [\n { column: 'scheduledDate' },\n { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },\n ],\n },\n {\n lessThan: [\n { column: 'scheduledDate' },\n { datetime: '2026-06-26T00:00:00[Europe/Stockholm]' },\n ],\n },\n ],\n },\n },\n // Far future (after 2026-07-15 midnight Stockholm time) — entire row in green\n {\n apply: {\n color: { value: '#dcfce7' },\n textColor: { value: '#14532d' },\n },\n column: null,\n priority: 1,\n where: {\n greaterThanOrEqual: [\n { column: 'scheduledDate' },\n { datetime: '2026-07-15T00:00:00[Europe/Stockholm]' },\n ],\n },\n },\n // Outside Stockholm business hours (before 09:00 CEST or from 17:00 CEST) —\n // time cell in orange. The { time: \"...\" } literals carry an offset so the\n // engine normalises them to UTC before comparing against scheduledTimeMs.\n {\n apply: {\n color: { value: '#ffedd5' },\n textColor: { value: '#7c2d12' },\n },\n column: 'scheduledTimeMs',\n priority: 2,\n where: {\n or: [\n {\n lessThan: [{ column: 'scheduledTimeMs' }, { time: '09:00:00+02:00' }],\n },\n {\n greaterThanOrEqual: [\n { column: 'scheduledTimeMs' },\n { time: '17:00:00+02:00' },\n ],\n },\n ],\n },\n },\n // Cancelled events — all cells grayed out at highest priority\n {\n apply: {\n color: { value: '#f3f4f6' },\n textColor: { value: '#9ca3af' },\n },\n column: null,\n priority: 5,\n where: { equal: [{ column: 'status' }, 'cancelled'] },\n },\n];\n\nconst Component = () => {\n const columnHelper = createColumnHelper<EventRow>();\n\n const columns = [\n columnHelper.accessor('event', {\n cell: (info) => info.getValue(),\n header: () => 'Event',\n minSize: 180,\n size: 220,\n }),\n columnHelper.accessor('scheduledDate', {\n cell: (info) =>\n info.getValue().toLocaleDateString('en-GB', {\n day: 'numeric',\n month: 'short',\n timeZone: 'Europe/Stockholm',\n year: 'numeric',\n }),\n header: () => 'Date (Stockholm)',\n minSize: 150,\n size: 170,\n }),\n columnHelper.accessor('localTimeDisplay', {\n cell: (info) => info.getValue(),\n header: () => 'Local time',\n minSize: 160,\n size: 180,\n }),\n columnHelper.accessor('scheduledTimeMs', {\n cell: (info) => {\n const ms = info.getValue();\n const h = Math.floor(ms / 3_600_000)\n .toString()\n .padStart(2, '0');\n const m = Math.floor((ms % 3_600_000) / 60_000)\n .toString()\n .padStart(2, '0');\n return `${h}:${m} UTC`;\n },\n header: () => 'Time (UTC)',\n minSize: 110,\n size: 130,\n }),\n columnHelper.accessor('status', {\n cell: (info) => info.getValue(),\n header: () => 'Status',\n minSize: 100,\n size: 120,\n }),\n ];\n\n const table = useReactTable({\n columnResizeMode: 'onChange',\n columns,\n data,\n defaultColumn: {\n maxSize: 800,\n minSize: 80,\n },\n enableSorting: true,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getSortedRowModel: getSortedRowModel(),\n initialState: {\n pagination: { pageSize: 10 },\n },\n });\n\n return (\n <div className=\"n-w-full n-bg-light-neutral-text-weakest\">\n <DataGrid\n isResizable={false}\n isKeyboardNavigable={false}\n tableInstance={table}\n styleRules={styleRules}\n styling={{\n borderStyle: 'all-sides',\n hasHoverEffects: true,\n hasZebraStriping: false,\n }}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"datagrid-rule-based-styling-datetime.story.js","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-rule-based-styling-datetime.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA4C;AAC5C,uDAM+B;AAsB/B,MAAM,IAAI,GAAe;IACvB,6EAA6E;IAC7E;QACE,KAAK,EAAE,kBAAkB;QAC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AAW;gBACxB,eAAe,EAAE,IAAI;gBACrB,gBAAgB,EAAE,KAAK;aACxB,GACD,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { DataGrid } from '@neo4j-ndl/react';\nimport {\n createColumnHelper,\n getCoreRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n} from '@tanstack/react-table';\n\nimport { type DataGridStyleRule } from '../style-rules/types';\n\ntype EventRow = {\n event: string;\n /**\n * JS Date coerced from the event's local ISO string. Natively converted to\n * Unix ms by the engine and compared against { datetime: \"...\" } literals.\n */\n scheduledDate: Date;\n /**\n * UTC milliseconds since midnight. Compared against { time: \"...\" } literals\n * that are defined in Stockholm / CEST (+02:00) time — the engine normalises\n * both sides to UTC before comparing.\n */\n scheduledTimeMs: number;\n /** Human-readable local time shown in the cell, e.g. \"09:00 CEST (+02:00)\". */\n localTimeDisplay: string;\n status: 'confirmed' | 'delayed' | 'cancelled';\n};\n\nconst data: EventRow[] = [\n // ── Past events (before start of 2026-06-25 in Stockholm / CEST) ──────────\n {\n event: 'Quarterly review',\n localTimeDisplay: '09:00 CEST (+02:00)',\n // 09:00 Stockholm CEST = 07:00 UTC\n scheduledDate: new Date('2026-06-10T09:00:00+02:00'),\n scheduledTimeMs: 7 * 3_600_000,\n status: 'confirmed',\n },\n {\n event: 'Security audit',\n localTimeDisplay: '07:30 BST (+01:00)',\n // 07:30 London BST (+01:00) = 06:30 UTC — before Stockholm opens\n scheduledDate: new Date('2026-06-18T07:30:00+01:00'),\n scheduledTimeMs: 6 * 3_600_000 + 30 * 60_000,\n status: 'delayed',\n },\n // ── Today (2026-06-25 in Stockholm / CEST) ─────────────────────────────────\n {\n event: 'Customer demo',\n localTimeDisplay: '09:00 EDT (-04:00)',\n // 09:00 New York EDT (-04:00) = 13:00 UTC\n scheduledDate: new Date('2026-06-25T09:00:00-04:00'),\n scheduledTimeMs: 13 * 3_600_000,\n status: 'confirmed',\n },\n {\n event: 'Platform migration',\n localTimeDisplay: '22:00 CEST (+02:00)',\n // 22:00 Stockholm CEST (+02:00) = 20:00 UTC — after Stockholm closes\n scheduledDate: new Date('2026-06-25T22:00:00+02:00'),\n scheduledTimeMs: 20 * 3_600_000,\n status: 'confirmed',\n },\n // ── Near future (up to and including 2026-07-14 in Stockholm) ─────────────\n {\n event: 'Board presentation',\n localTimeDisplay: '10:00 SGT (+08:00)',\n // 10:00 Singapore SGT (+08:00) = 02:00 UTC — before Stockholm opens\n scheduledDate: new Date('2026-07-02T10:00:00+08:00'),\n scheduledTimeMs: 2 * 3_600_000,\n status: 'confirmed',\n },\n {\n event: 'Partner onboarding',\n localTimeDisplay: '13:15 CEST (+02:00)',\n // 13:15 Paris CEST (+02:00) = 11:15 UTC\n scheduledDate: new Date('2026-07-08T13:15:00+02:00'),\n scheduledTimeMs: 11 * 3_600_000 + 15 * 60_000,\n status: 'cancelled',\n },\n // ── Far future (after 2026-07-15T00:00 Stockholm / CEST = 2026-07-14T22:00Z)\n {\n event: 'Architecture summit',\n localTimeDisplay: '08:00 CEST (+02:00)',\n // 08:00 Amsterdam CEST (+02:00) = 06:00 UTC.\n // Although the calendar date is \"July 15\", 08:00 CEST is still within the\n // same UTC day as July 14 22:00Z, so it crosses the far-future boundary.\n scheduledDate: new Date('2026-07-15T08:00:00+02:00'),\n scheduledTimeMs: 6 * 3_600_000,\n status: 'confirmed',\n },\n {\n event: 'Annual conference',\n localTimeDisplay: '09:00 PDT (-07:00)',\n // 09:00 San Francisco PDT (-07:00) = 16:00 UTC — after Stockholm closes\n scheduledDate: new Date('2026-08-03T09:00:00-07:00'),\n scheduledTimeMs: 16 * 3_600_000,\n status: 'confirmed',\n },\n {\n event: 'Year-end planning',\n localTimeDisplay: '09:00 JST (+09:00)',\n // 09:00 Tokyo JST (+09:00) = 00:00 UTC — midnight, well before Stockholm opens\n scheduledDate: new Date('2026-11-20T09:00:00+09:00'),\n scheduledTimeMs: 0,\n status: 'confirmed',\n },\n];\n\n/**\n * All date and time boundaries are anchored to Stockholm in June–July 2026.\n * Date literals use RFC 9557 IANA bracket notation — the UTC offset is inferred\n * from the named zone (CEST = +02:00 in this period); writing `+02:00` explicitly\n * is optional. Time literals use UTC-offset notation.\n *\n * \"Today\" from a Stockholm perspective:\n * 2026-06-25T00:00:00[Europe/Stockholm] = 2026-06-24T22:00:00Z\n * 2026-06-26T00:00:00[Europe/Stockholm] = 2026-06-25T22:00:00Z\n *\n * \"Far future\" threshold:\n * 2026-07-15T00:00:00[Europe/Stockholm] = 2026-07-14T22:00:00Z\n *\n * Business hours (Stockholm):\n * { time: '09:00:00+02:00' } resolves to 07:00 UTC (25 200 000 ms)\n * { time: '17:00:00+02:00' } resolves to 15:00 UTC (54 000 000 ms)\n */\nconst styleRules: DataGridStyleRule[] = [\n // Past events — entire row in muted red\n {\n apply: {\n color: { value: '#fee2e2' },\n textColor: { value: '#7f1d1d' },\n },\n column: null,\n priority: 1,\n where: {\n lessThan: [\n { column: 'scheduledDate' },\n { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },\n ],\n },\n },\n // Today (in Stockholm timezone) — entire row in amber\n {\n apply: {\n color: { value: '#fef9c3' },\n textColor: { value: '#713f12' },\n },\n column: null,\n priority: 1,\n where: {\n and: [\n {\n greaterThanOrEqual: [\n { column: 'scheduledDate' },\n { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },\n ],\n },\n {\n lessThan: [\n { column: 'scheduledDate' },\n { datetime: '2026-06-26T00:00:00[Europe/Stockholm]' },\n ],\n },\n ],\n },\n },\n // Far future (after 2026-07-15 midnight Stockholm time) — entire row in green\n {\n apply: {\n color: { value: '#dcfce7' },\n textColor: { value: '#14532d' },\n },\n column: null,\n priority: 1,\n where: {\n greaterThanOrEqual: [\n { column: 'scheduledDate' },\n { datetime: '2026-07-15T00:00:00[Europe/Stockholm]' },\n ],\n },\n },\n // Outside Stockholm business hours (before 09:00 CEST or from 17:00 CEST) —\n // time cell in orange. The { time: \"...\" } literals carry an offset so the\n // engine normalises them to UTC before comparing against scheduledTimeMs.\n {\n apply: {\n color: { value: '#ffedd5' },\n textColor: { value: '#7c2d12' },\n },\n column: 'scheduledTimeMs',\n priority: 2,\n where: {\n or: [\n {\n lessThan: [{ column: 'scheduledTimeMs' }, { time: '09:00:00+02:00' }],\n },\n {\n greaterThanOrEqual: [\n { column: 'scheduledTimeMs' },\n { time: '17:00:00+02:00' },\n ],\n },\n ],\n },\n },\n // Cancelled events — all cells grayed out at highest priority\n {\n apply: {\n color: { value: '#f3f4f6' },\n textColor: { value: '#9ca3af' },\n },\n column: null,\n priority: 5,\n where: { equal: [{ column: 'status' }, 'cancelled'] },\n },\n];\n\nconst Component = () => {\n const columnHelper = createColumnHelper<EventRow>();\n\n const columns = [\n columnHelper.accessor('event', {\n cell: (info) => info.getValue(),\n header: () => 'Event',\n minSize: 180,\n size: 220,\n }),\n columnHelper.accessor('scheduledDate', {\n cell: (info) =>\n info.getValue().toLocaleDateString('en-GB', {\n day: 'numeric',\n month: 'short',\n timeZone: 'Europe/Stockholm',\n year: 'numeric',\n }),\n header: () => 'Date (Stockholm)',\n minSize: 150,\n size: 170,\n }),\n columnHelper.accessor('localTimeDisplay', {\n cell: (info) => info.getValue(),\n header: () => 'Local time',\n minSize: 160,\n size: 180,\n }),\n columnHelper.accessor('scheduledTimeMs', {\n cell: (info) => {\n const ms = info.getValue();\n const h = Math.floor(ms / 3_600_000)\n .toString()\n .padStart(2, '0');\n const m = Math.floor((ms % 3_600_000) / 60_000)\n .toString()\n .padStart(2, '0');\n return `${h}:${m} UTC`;\n },\n header: () => 'Time (UTC)',\n minSize: 110,\n size: 130,\n }),\n columnHelper.accessor('status', {\n cell: (info) => info.getValue(),\n header: () => 'Status',\n minSize: 100,\n size: 120,\n }),\n ];\n\n const table = useReactTable({\n columnResizeMode: 'onChange',\n columns,\n data,\n defaultColumn: {\n maxSize: 800,\n minSize: 80,\n },\n enableSorting: true,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getSortedRowModel: getSortedRowModel(),\n initialState: {\n pagination: { pageSize: 10 },\n },\n });\n\n return (\n <div className=\"n-w-full n-bg-light-neutral-text-weakest\">\n <DataGrid\n isResizable={false}\n isKeyboardNavigable={false}\n tableInstance={table}\n styleRules={styleRules}\n styling={{\n borderStyle: 'all-sides',\n hasHoverEffects: true,\n hasZebraStriping: false,\n }}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -112,6 +112,9 @@ function resolveValue(value, rowData, converters) {
112
112
  if (typeof value === 'object' && value !== null && 'datetime' in value) {
113
113
  return (0, style_rules_1.parseDateString)(value.datetime);
114
114
  }
115
+ if (typeof value === 'object' && value !== null && 'localdatetime' in value) {
116
+ return (0, style_rules_1.parseLocalDateString)(value.localdatetime);
117
+ }
115
118
  if (typeof value === 'object' && value !== null && 'time' in value) {
116
119
  return (0, style_rules_1.parseTimeString)(value.time);
117
120
  }
@@ -1 +1 @@
1
- {"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/evaluate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAsXH,4DA0EC;AAWD,gEAQC;AAjdD,kDAA4E;AAE5E,8DAKsC;AAatC,SAAS,oBAAoB,CAC3B,UAA8B,EAC9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BAAiB,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;oBACxD,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG;wBAC3B,QAAQ,EAAE,iBAAiB;wBAC3B,KAAK,EAAE,KAAe;qBACvB,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAoD,EAAE,CAAC;IACvE,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7D,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACnD,KAAgC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACtD,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QACD,UAAU,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAChD,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,0BAA0B,CACxC,KAA0B,EAC1B,OAAgC,EAChC,QAAgB,EAChB,UAA6C;IAE7C,MAAM,EAAE,UAAU,EAAE,GAAG,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC5E,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n getWeight,\n lerpColor,\n parseDateString,\n parseTimeString,\n} from '../../_generated/style-rules';\nimport {\n type DataGridCellStyle,\n type DataGridColorRange,\n type DataGridDatetimeLiteral,\n type DataGridStyleRule,\n type DataGridStyleRuleLiteral,\n type DataGridStyleRuleOperand,\n type DataGridStyleRuleValueConverters,\n type DataGridStyleRuleWhere,\n type DataGridTimeLiteral,\n} from './types';\n\nfunction getInterpolatedColor(\n colorRange: DataGridColorRange,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): string | null {\n const {\n onColumn,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n const actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n\n let midRgb: RgbColor | undefined = undefined;\n if (midValue !== undefined && midColor !== undefined) {\n const isMidInRange =\n actualMinValue <= midValue && midValue <= actualMaxValue;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const rawValue = rowData[onColumn];\n let numericValue: number | null = null;\n if (typeof rawValue === 'number') {\n numericValue = Number.isFinite(rawValue) ? rawValue : null;\n } else if (typeof rawValue === 'bigint') {\n const n = Number(rawValue);\n numericValue = Number.isFinite(n) ? n : null;\n } else if (rawValue instanceof Date) {\n const ts = rawValue.getTime();\n numericValue = Number.isFinite(ts) ? ts : null;\n } else {\n const converter = converters?.[onColumn];\n if (converter !== undefined) {\n const converted = converter(rawValue);\n if (typeof converted === 'number') {\n numericValue = Number.isFinite(converted) ? converted : null;\n }\n }\n }\n if (numericValue === null) {\n return null;\n }\n\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, numericValue),\n );\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && midValue !== undefined) {\n const t = getWeight(minValue, midValue, clampedValue);\n const isBetweenMinAndMid = t <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, t);\n } else {\n const t2 = getWeight(midValue, maxValue, clampedValue);\n rgb = lerpColor(midRgb, maxRgb, t2);\n }\n } else {\n const t = getWeight(minValue, maxValue, clampedValue);\n rgb = lerpColor(minRgb, maxRgb, t);\n }\n\n return rgbToHex(rgb);\n}\n\n// --- Where clause evaluation ---\n\ntype Ternary = boolean | null;\n\nfunction resolveValue(\n value: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): DataGridStyleRuleLiteral {\n if (typeof value === 'object' && value !== null && 'column' in value) {\n const cellVal = rowData[value.column];\n if (cellVal === undefined) {\n return null;\n }\n if (\n typeof cellVal === 'string' ||\n typeof cellVal === 'number' ||\n typeof cellVal === 'boolean'\n ) {\n return cellVal;\n }\n if (typeof cellVal === 'bigint') {\n return Number(cellVal);\n }\n if (cellVal instanceof Date) {\n const ts = cellVal.getTime();\n return isNaN(ts) ? null : ts;\n }\n const converter = converters?.[value.column];\n if (converter !== undefined) {\n return converter(cellVal);\n }\n return null;\n }\n if (typeof value === 'object' && value !== null && 'datetime' in value) {\n return parseDateString((value as DataGridDatetimeLiteral).datetime);\n }\n if (typeof value === 'object' && value !== null && 'time' in value) {\n return parseTimeString((value as DataGridTimeLiteral).time);\n }\n return value as DataGridStyleRuleLiteral;\n}\n\nfunction safeCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (\n a: NonNullable<DataGridStyleRuleLiteral>,\n b: NonNullable<DataGridStyleRuleLiteral>,\n ) => boolean,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction safeStringCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (a: string, b: string) => boolean,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (\n leftVal === null ||\n rightVal === null ||\n typeof leftVal !== 'string' ||\n typeof rightVal !== 'string'\n ) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction evaluateWhere(\n rowData: Record<string, unknown>,\n where?: DataGridStyleRuleWhere,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n if (!where) {\n return true;\n }\n\n if ('equal' in where) {\n const [left, right] = where.equal;\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return leftVal === rightVal;\n }\n\n if ('not' in where) {\n const isMatch = evaluateWhere(rowData, where.not, converters);\n return isMatch === null ? null : !isMatch;\n }\n\n if ('lessThan' in where) {\n return safeCompare(\n where.lessThan[0],\n where.lessThan[1],\n rowData,\n (a, b) => a < b,\n converters,\n );\n }\n\n if ('lessThanOrEqual' in where) {\n return safeCompare(\n where.lessThanOrEqual[0],\n where.lessThanOrEqual[1],\n rowData,\n (a, b) => a <= b,\n converters,\n );\n }\n\n if ('greaterThan' in where) {\n return safeCompare(\n where.greaterThan[0],\n where.greaterThan[1],\n rowData,\n (a, b) => a > b,\n converters,\n );\n }\n\n if ('greaterThanOrEqual' in where) {\n return safeCompare(\n where.greaterThanOrEqual[0],\n where.greaterThanOrEqual[1],\n rowData,\n (a, b) => a >= b,\n converters,\n );\n }\n\n if ('contains' in where) {\n return safeStringCompare(\n where.contains[0],\n where.contains[1],\n rowData,\n (a, b) => a.includes(b),\n converters,\n );\n }\n\n if ('startsWith' in where) {\n return safeStringCompare(\n where.startsWith[0],\n where.startsWith[1],\n rowData,\n (a, b) => a.startsWith(b),\n converters,\n );\n }\n\n if ('endsWith' in where) {\n return safeStringCompare(\n where.endsWith[0],\n where.endsWith[1],\n rowData,\n (a, b) => a.endsWith(b),\n converters,\n );\n }\n\n if ('isNull' in where) {\n const value = resolveValue(where.isNull, rowData, converters);\n return value === null;\n }\n\n if ('and' in where) {\n let hasNull = false;\n for (const clause of where.and) {\n const isMatch = evaluateWhere(rowData, clause, converters);\n if (isMatch === false) {\n return false;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : true;\n }\n\n if ('or' in where) {\n let hasNull = false;\n for (const clause of where.or) {\n const isMatch = evaluateWhere(rowData, clause, converters);\n if (isMatch === true) {\n return true;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : false;\n }\n\n return false;\n}\n\n// --- Style resolution ---\n\nfunction resolveAppliedStyle(\n apply: DataGridCellStyle,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): React.CSSProperties | undefined {\n const result: React.CSSProperties = {};\n let hasStyle = false;\n\n if (apply.color && !apply.color.isDisabled) {\n result.backgroundColor = apply.color.value;\n hasStyle = true;\n }\n\n if (apply.textColor && !apply.textColor.isDisabled) {\n result.color = apply.textColor.value;\n hasStyle = true;\n }\n\n if (apply.colorRange && !apply.colorRange.isDisabled) {\n const interpolated = getInterpolatedColor(\n apply.colorRange,\n rowData,\n converters,\n );\n if (interpolated !== null) {\n result.backgroundColor = interpolated;\n hasStyle = true;\n }\n }\n\n if (apply.textColorRange && !apply.textColorRange.isDisabled) {\n const interpolated = getInterpolatedColor(\n apply.textColorRange,\n rowData,\n converters,\n );\n if (interpolated !== null) {\n result.color = interpolated;\n hasStyle = true;\n }\n }\n\n return hasStyle ? result : undefined;\n}\n\nexport type ComputedDataGridStyles = {\n cellStyles: Record<string, React.CSSProperties | undefined>;\n};\n\ntype PriorityEntry = { value: string; priority: number };\ntype PropPriorityMap = Record<string, PriorityEntry>;\n\n/**\n * Computes styles for all cells in a row based on the given style rules.\n * When a rule's `column` is `null`, its style is applied to every cell.\n *\n * Used internally by hooks, but exported for context-free usage.\n */\nexport function computeDataGridRowStyles(\n rules: DataGridStyleRule[],\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): ComputedDataGridStyles {\n const enabledRules = rules.filter((r) => !r.isDisabled);\n const totalRules = enabledRules.length;\n\n const sortedRules = enabledRules\n .map((rule, index) => {\n if (rule.priority !== undefined && rule.priority < 0) {\n throw new Error(\n `DataGridStyleRule priority must be >= 0, got ${rule.priority}. Negative values are reserved for internal use.`,\n );\n }\n\n return {\n ...rule,\n _order: index,\n _priority: rule.priority ?? index - totalRules,\n };\n })\n .sort((a, b) => {\n if (a._priority !== b._priority) {\n return a._priority - b._priority;\n }\n return a._order - b._order;\n });\n\n const cellPriorityMap: Record<string, PropPriorityMap> = {};\n\n for (const rule of sortedRules) {\n const isMatching = evaluateWhere(rowData, rule.where, converters) === true;\n if (!isMatching) {\n continue;\n }\n\n const style = resolveAppliedStyle(rule.apply, rowData, converters);\n if (!style) {\n continue;\n }\n\n const effectivePriority = rule._priority;\n const affectedColumns =\n rule.column === null ? Object.keys(rowData) : [rule.column];\n\n for (const col of affectedColumns) {\n if (!cellPriorityMap[col]) {\n cellPriorityMap[col] = {};\n }\n for (const [prop, value] of Object.entries(style)) {\n const existing = cellPriorityMap[col][prop];\n if (!existing || effectivePriority >= existing.priority) {\n cellPriorityMap[col][prop] = {\n priority: effectivePriority,\n value: value as string,\n };\n }\n }\n }\n }\n\n const cellStyles: Record<string, React.CSSProperties | undefined> = {};\n for (const [col, propMap] of Object.entries(cellPriorityMap)) {\n const style: React.CSSProperties = {};\n let hasProp = false;\n for (const [prop, entry] of Object.entries(propMap)) {\n (style as Record<string, string>)[prop] = entry.value;\n hasProp = true;\n }\n cellStyles[col] = hasProp ? style : undefined;\n }\n\n return { cellStyles };\n}\n\n/**\n * Evaluate style rules for a single cell.\n * Pure function -- no React context needed.\n *\n * @param rules - Array of style rules to evaluate\n * @param rowData - The row's data as a record (column id -> value)\n * @param columnId - Returns the computed style for this specific cell.\n * @param converters - Optional per-column value converters for complex cell types.\n */\nexport function evaluateDataGridStyleRules(\n rules: DataGridStyleRule[],\n rowData: Record<string, unknown>,\n columnId: string,\n converters?: DataGridStyleRuleValueConverters,\n): React.CSSProperties | undefined {\n const { cellStyles } = computeDataGridRowStyles(rules, rowData, converters);\n return cellStyles[columnId];\n}\n"]}
1
+ {"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/evaluate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AA6XH,4DA0EC;AAWD,gEAQC;AAxdD,kDAA4E;AAE5E,8DAMsC;AActC,SAAS,oBAAoB,CAC3B,UAA8B,EAC9B,OAAgC,EAChC,UAA6C;IAE7C,MAAM,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,GAAG,UAAU,CAAC;IAEf,IAAI,CAAC,IAAA,sBAAQ,EAAC,QAAQ,CAAC,IAAI,CAAC,IAAA,sBAAQ,EAAC,QAAQ,CAAC,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,mBAAK,EAAC,QAAQ,CAAC,CAAC,GAAG,CAAC;IACnC,MAAM,MAAM,GAAG,IAAA,mBAAK,EAAC,QAAQ,CAAC,CAAC,GAAG,CAAC;IACnC,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAA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C;QACtC,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACnD,KAAgC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACtD,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QACD,UAAU,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAChD,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,0BAA0B,CACxC,KAA0B,EAC1B,OAAgC,EAChC,QAAgB,EAChB,UAA6C;IAE7C,MAAM,EAAE,UAAU,EAAE,GAAG,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC5E,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n getWeight,\n lerpColor,\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from '../../_generated/style-rules';\nimport {\n type DataGridCellStyle,\n type DataGridColorRange,\n type DataGridDatetimeLiteral,\n type DataGridLocalDatetimeLiteral,\n type DataGridStyleRule,\n type DataGridStyleRuleLiteral,\n type DataGridStyleRuleOperand,\n type DataGridStyleRuleValueConverters,\n type DataGridStyleRuleWhere,\n type DataGridTimeLiteral,\n} from './types';\n\nfunction getInterpolatedColor(\n colorRange: DataGridColorRange,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): string | null {\n const {\n onColumn,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n const actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n\n let midRgb: RgbColor | undefined = undefined;\n if (midValue !== undefined && midColor !== undefined) {\n const isMidInRange =\n actualMinValue <= midValue && midValue <= actualMaxValue;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const rawValue = rowData[onColumn];\n let numericValue: number | null = null;\n if (typeof rawValue === 'number') {\n numericValue = Number.isFinite(rawValue) ? rawValue : null;\n } else if (typeof rawValue === 'bigint') {\n const n = Number(rawValue);\n numericValue = Number.isFinite(n) ? n : null;\n } else if (rawValue instanceof Date) {\n const ts = rawValue.getTime();\n numericValue = Number.isFinite(ts) ? ts : null;\n } else {\n const converter = converters?.[onColumn];\n if (converter !== undefined) {\n const converted = converter(rawValue);\n if (typeof converted === 'number') {\n numericValue = Number.isFinite(converted) ? converted : null;\n }\n }\n }\n if (numericValue === null) {\n return null;\n }\n\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, numericValue),\n );\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && midValue !== undefined) {\n const t = getWeight(minValue, midValue, clampedValue);\n const isBetweenMinAndMid = t <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, t);\n } else {\n const t2 = getWeight(midValue, maxValue, clampedValue);\n rgb = lerpColor(midRgb, maxRgb, t2);\n }\n } else {\n const t = getWeight(minValue, maxValue, clampedValue);\n rgb = lerpColor(minRgb, maxRgb, t);\n }\n\n return rgbToHex(rgb);\n}\n\n// --- Where clause evaluation ---\n\ntype Ternary = boolean | null;\n\nfunction resolveValue(\n value: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): DataGridStyleRuleLiteral {\n if (typeof value === 'object' && value !== null && 'column' in value) {\n const cellVal = rowData[value.column];\n if (cellVal === undefined) {\n return null;\n }\n if (\n typeof cellVal === 'string' ||\n typeof cellVal === 'number' ||\n typeof cellVal === 'boolean'\n ) {\n return cellVal;\n }\n if (typeof cellVal === 'bigint') {\n return Number(cellVal);\n }\n if (cellVal instanceof Date) {\n const ts = cellVal.getTime();\n return isNaN(ts) ? null : ts;\n }\n const converter = converters?.[value.column];\n if (converter !== undefined) {\n return converter(cellVal);\n }\n return null;\n }\n if (typeof value === 'object' && value !== null && 'datetime' in value) {\n return parseDateString((value as DataGridDatetimeLiteral).datetime);\n }\n if (typeof value === 'object' && value !== null && 'localdatetime' in value) {\n return parseLocalDateString(\n (value as DataGridLocalDatetimeLiteral).localdatetime,\n );\n }\n if (typeof value === 'object' && value !== null && 'time' in value) {\n return parseTimeString((value as DataGridTimeLiteral).time);\n }\n return value as DataGridStyleRuleLiteral;\n}\n\nfunction safeCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (\n a: NonNullable<DataGridStyleRuleLiteral>,\n b: NonNullable<DataGridStyleRuleLiteral>,\n ) => boolean,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction safeStringCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (a: string, b: string) => boolean,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (\n leftVal === null ||\n rightVal === null ||\n typeof leftVal !== 'string' ||\n typeof rightVal !== 'string'\n ) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction evaluateWhere(\n rowData: Record<string, unknown>,\n where?: DataGridStyleRuleWhere,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n if (!where) {\n return true;\n }\n\n if ('equal' in where) {\n const [left, right] = where.equal;\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return leftVal === rightVal;\n }\n\n if ('not' in where) {\n const isMatch = evaluateWhere(rowData, where.not, converters);\n return isMatch === null ? null : !isMatch;\n }\n\n if ('lessThan' in where) {\n return safeCompare(\n where.lessThan[0],\n where.lessThan[1],\n rowData,\n (a, b) => a < b,\n converters,\n );\n }\n\n if ('lessThanOrEqual' in where) {\n return safeCompare(\n where.lessThanOrEqual[0],\n where.lessThanOrEqual[1],\n rowData,\n (a, b) => a <= b,\n converters,\n );\n }\n\n if ('greaterThan' in where) {\n return safeCompare(\n where.greaterThan[0],\n where.greaterThan[1],\n rowData,\n (a, b) => a > b,\n converters,\n );\n }\n\n if ('greaterThanOrEqual' in where) {\n return safeCompare(\n where.greaterThanOrEqual[0],\n where.greaterThanOrEqual[1],\n rowData,\n (a, b) => a >= b,\n converters,\n );\n }\n\n if ('contains' in where) {\n return safeStringCompare(\n where.contains[0],\n where.contains[1],\n rowData,\n (a, b) => a.includes(b),\n converters,\n );\n }\n\n if ('startsWith' in where) {\n return safeStringCompare(\n where.startsWith[0],\n where.startsWith[1],\n rowData,\n (a, b) => a.startsWith(b),\n converters,\n );\n }\n\n if ('endsWith' in where) {\n return safeStringCompare(\n where.endsWith[0],\n where.endsWith[1],\n rowData,\n (a, b) => a.endsWith(b),\n converters,\n );\n }\n\n if ('isNull' in where) {\n const value = resolveValue(where.isNull, rowData, converters);\n return value === null;\n }\n\n if ('and' in where) {\n let hasNull = false;\n for (const clause of where.and) {\n const isMatch = evaluateWhere(rowData, clause, converters);\n if (isMatch === false) {\n return false;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : true;\n }\n\n if ('or' in where) {\n let hasNull = false;\n for (const clause of where.or) {\n const isMatch = evaluateWhere(rowData, clause, converters);\n if (isMatch === true) {\n return true;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : false;\n }\n\n return false;\n}\n\n// --- Style resolution ---\n\nfunction resolveAppliedStyle(\n apply: DataGridCellStyle,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): React.CSSProperties | undefined {\n const result: React.CSSProperties = {};\n let hasStyle = false;\n\n if (apply.color && !apply.color.isDisabled) {\n result.backgroundColor = apply.color.value;\n hasStyle = true;\n }\n\n if (apply.textColor && !apply.textColor.isDisabled) {\n result.color = apply.textColor.value;\n hasStyle = true;\n }\n\n if (apply.colorRange && !apply.colorRange.isDisabled) {\n const interpolated = getInterpolatedColor(\n apply.colorRange,\n rowData,\n converters,\n );\n if (interpolated !== null) {\n result.backgroundColor = interpolated;\n hasStyle = true;\n }\n }\n\n if (apply.textColorRange && !apply.textColorRange.isDisabled) {\n const interpolated = getInterpolatedColor(\n apply.textColorRange,\n rowData,\n converters,\n );\n if (interpolated !== null) {\n result.color = interpolated;\n hasStyle = true;\n }\n }\n\n return hasStyle ? result : undefined;\n}\n\nexport type ComputedDataGridStyles = {\n cellStyles: Record<string, React.CSSProperties | undefined>;\n};\n\ntype PriorityEntry = { value: string; priority: number };\ntype PropPriorityMap = Record<string, PriorityEntry>;\n\n/**\n * Computes styles for all cells in a row based on the given style rules.\n * When a rule's `column` is `null`, its style is applied to every cell.\n *\n * Used internally by hooks, but exported for context-free usage.\n */\nexport function computeDataGridRowStyles(\n rules: DataGridStyleRule[],\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): ComputedDataGridStyles {\n const enabledRules = rules.filter((r) => !r.isDisabled);\n const totalRules = enabledRules.length;\n\n const sortedRules = enabledRules\n .map((rule, index) => {\n if (rule.priority !== undefined && rule.priority < 0) {\n throw new Error(\n `DataGridStyleRule priority must be >= 0, got ${rule.priority}. Negative values are reserved for internal use.`,\n );\n }\n\n return {\n ...rule,\n _order: index,\n _priority: rule.priority ?? index - totalRules,\n };\n })\n .sort((a, b) => {\n if (a._priority !== b._priority) {\n return a._priority - b._priority;\n }\n return a._order - b._order;\n });\n\n const cellPriorityMap: Record<string, PropPriorityMap> = {};\n\n for (const rule of sortedRules) {\n const isMatching = evaluateWhere(rowData, rule.where, converters) === true;\n if (!isMatching) {\n continue;\n }\n\n const style = resolveAppliedStyle(rule.apply, rowData, converters);\n if (!style) {\n continue;\n }\n\n const effectivePriority = rule._priority;\n const affectedColumns =\n rule.column === null ? Object.keys(rowData) : [rule.column];\n\n for (const col of affectedColumns) {\n if (!cellPriorityMap[col]) {\n cellPriorityMap[col] = {};\n }\n for (const [prop, value] of Object.entries(style)) {\n const existing = cellPriorityMap[col][prop];\n if (!existing || effectivePriority >= existing.priority) {\n cellPriorityMap[col][prop] = {\n priority: effectivePriority,\n value: value as string,\n };\n }\n }\n }\n }\n\n const cellStyles: Record<string, React.CSSProperties | undefined> = {};\n for (const [col, propMap] of Object.entries(cellPriorityMap)) {\n const style: React.CSSProperties = {};\n let hasProp = false;\n for (const [prop, entry] of Object.entries(propMap)) {\n (style as Record<string, string>)[prop] = entry.value;\n hasProp = true;\n }\n cellStyles[col] = hasProp ? style : undefined;\n }\n\n return { cellStyles };\n}\n\n/**\n * Evaluate style rules for a single cell.\n * Pure function -- no React context needed.\n *\n * @param rules - Array of style rules to evaluate\n * @param rowData - The row's data as a record (column id -> value)\n * @param columnId - Returns the computed style for this specific cell.\n * @param converters - Optional per-column value converters for complex cell types.\n */\nexport function evaluateDataGridStyleRules(\n rules: DataGridStyleRule[],\n rowData: Record<string, unknown>,\n columnId: string,\n converters?: DataGridStyleRuleValueConverters,\n): React.CSSProperties | undefined {\n const { cellStyles } = computeDataGridRowStyles(rules, rowData, converters);\n return cellStyles[columnId];\n}\n"]}
@@ -20,7 +20,7 @@
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.isDataGridStyleRule = exports.DataGridStyleRuleSchema = exports.DataGridCellStyleSchema = exports.DataGridDisableableColorSchema = exports.DataGridColorRangeSchema = exports.DataGridStyleRuleWhereSchema = exports.DataGridStyleRuleOperandSchema = exports.DataGridTimeLiteralSchema = exports.DataGridDatetimeLiteralSchema = exports.DataGridColumnRefSchema = exports.DataGridStyleRuleLiteralSchema = void 0;
23
+ exports.isDataGridStyleRule = exports.DataGridStyleRuleSchema = exports.DataGridCellStyleSchema = exports.DataGridDisableableColorSchema = exports.DataGridColorRangeSchema = exports.DataGridStyleRuleWhereSchema = exports.DataGridStyleRuleOperandSchema = exports.DataGridTimeLiteralSchema = exports.DataGridLocalDatetimeLiteralSchema = exports.DataGridDatetimeLiteralSchema = exports.DataGridColumnRefSchema = exports.DataGridStyleRuleLiteralSchema = void 0;
24
24
  const zod_1 = require("zod");
25
25
  const style_rules_1 = require("../../_generated/style-rules");
26
26
  /*
@@ -49,6 +49,19 @@ exports.DataGridColumnRefSchema = zod_1.z.object({ column: zod_1.z.string() });
49
49
  * Unzoned datetimes without `Z` or an offset are treated as UTC wall-clock time.
50
50
  */
51
51
  exports.DataGridDatetimeLiteralSchema = style_rules_1.DatetimeLiteralSchema;
52
+ /**
53
+ * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix
54
+ * millisecond timestamp in the browser's local timezone at evaluation time.
55
+ * Wraps the shared `LocalDatetimeLiteralSchema` with a DataGrid-specific name.
56
+ *
57
+ * Only plain date/datetime strings without timezone qualifiers are accepted:
58
+ * - Plain datetime: `"2024-01-01T14:30:00"`
59
+ * - Date-only (treated as local midnight): `"2024-01-01"`
60
+ *
61
+ * Strings with `Z`, a UTC offset, or an IANA bracket are rejected — use
62
+ * `{ datetime }` for timezone-aware instants.
63
+ */
64
+ exports.DataGridLocalDatetimeLiteralSchema = style_rules_1.LocalDatetimeLiteralSchema;
52
65
  /**
53
66
  * An ISO 8601 time literal that resolves to milliseconds since UTC midnight at
54
67
  * evaluation time. Wraps the shared `TimeLiteralSchema` with a DataGrid-specific
@@ -57,10 +70,11 @@ exports.DataGridDatetimeLiteralSchema = style_rules_1.DatetimeLiteralSchema;
57
70
  * - Offset time (UTC-normalised): `"14:30:00+02:00"`
58
71
  */
59
72
  exports.DataGridTimeLiteralSchema = style_rules_1.TimeLiteralSchema;
60
- /** An operand in a style-rule where clause -- either a literal value, a datetime literal, a time literal, or a column reference. */
73
+ /** An operand in a style-rule where clause -- either a literal value, a datetime literal, a localdatetime literal, a time literal, or a column reference. */
61
74
  exports.DataGridStyleRuleOperandSchema = zod_1.z.union([
62
75
  exports.DataGridColumnRefSchema,
63
76
  exports.DataGridDatetimeLiteralSchema,
77
+ exports.DataGridLocalDatetimeLiteralSchema,
64
78
  exports.DataGridTimeLiteralSchema,
65
79
  exports.DataGridStyleRuleLiteralSchema,
66
80
  ]);