@neo4j-ndl/react 4.15.2 → 4.15.4

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 (84) hide show
  1. package/lib/cjs/_generated/style-rules/color-utils.js +50 -0
  2. package/lib/cjs/_generated/style-rules/color-utils.js.map +1 -0
  3. package/lib/cjs/_generated/style-rules/date-utils.js +145 -0
  4. package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -0
  5. package/lib/cjs/_generated/style-rules/index.js +38 -0
  6. package/lib/cjs/_generated/style-rules/index.js.map +1 -0
  7. package/lib/cjs/_generated/style-rules/literal-schemas.js +64 -0
  8. package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -0
  9. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +286 -0
  10. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  11. package/lib/cjs/data-grid/stories/index.js +5 -1
  12. package/lib/cjs/data-grid/stories/index.js.map +1 -1
  13. package/lib/cjs/data-grid/style-rules/evaluate.js +13 -17
  14. package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
  15. package/lib/cjs/data-grid/style-rules/index.js +3 -1
  16. package/lib/cjs/data-grid/style-rules/index.js.map +1 -1
  17. package/lib/cjs/data-grid/style-rules/types.js +26 -2
  18. package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
  19. package/lib/cjs/time-picker/TimePicker.js +39 -22
  20. package/lib/cjs/time-picker/TimePicker.js.map +1 -1
  21. package/lib/cjs/time-picker/generate-time-options.js +6 -3
  22. package/lib/cjs/time-picker/generate-time-options.js.map +1 -1
  23. package/lib/cjs/time-picker/needle-time.js +23 -9
  24. package/lib/cjs/time-picker/needle-time.js.map +1 -1
  25. package/lib/cjs/time-picker/stories/index.js +5 -1
  26. package/lib/cjs/time-picker/stories/index.js.map +1 -1
  27. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js +32 -0
  28. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  29. package/lib/esm/_generated/style-rules/color-utils.js +46 -0
  30. package/lib/esm/_generated/style-rules/color-utils.js.map +1 -0
  31. package/lib/esm/_generated/style-rules/date-utils.js +141 -0
  32. package/lib/esm/_generated/style-rules/date-utils.js.map +1 -0
  33. package/lib/esm/_generated/style-rules/index.js +29 -0
  34. package/lib/esm/_generated/style-rules/index.js.map +1 -0
  35. package/lib/esm/_generated/style-rules/literal-schemas.js +61 -0
  36. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -0
  37. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +284 -0
  38. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  39. package/lib/esm/data-grid/stories/index.js +3 -0
  40. package/lib/esm/data-grid/stories/index.js.map +1 -1
  41. package/lib/esm/data-grid/style-rules/evaluate.js +7 -11
  42. package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
  43. package/lib/esm/data-grid/style-rules/index.js +1 -1
  44. package/lib/esm/data-grid/style-rules/index.js.map +1 -1
  45. package/lib/esm/data-grid/style-rules/types.js +25 -1
  46. package/lib/esm/data-grid/style-rules/types.js.map +1 -1
  47. package/lib/esm/time-picker/TimePicker.js +39 -22
  48. package/lib/esm/time-picker/TimePicker.js.map +1 -1
  49. package/lib/esm/time-picker/generate-time-options.js +6 -3
  50. package/lib/esm/time-picker/generate-time-options.js.map +1 -1
  51. package/lib/esm/time-picker/needle-time.js +23 -9
  52. package/lib/esm/time-picker/needle-time.js.map +1 -1
  53. package/lib/esm/time-picker/stories/index.js +3 -0
  54. package/lib/esm/time-picker/stories/index.js.map +1 -1
  55. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js +30 -0
  56. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  57. package/lib/types/_generated/style-rules/color-utils.d.ts +33 -0
  58. package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -0
  59. package/lib/types/_generated/style-rules/date-utils.d.ts +54 -0
  60. package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -0
  61. package/lib/types/_generated/style-rules/index.d.ts +25 -0
  62. package/lib/types/_generated/style-rules/index.d.ts.map +1 -0
  63. package/lib/types/_generated/style-rules/literal-schemas.d.ts +53 -0
  64. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -0
  65. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts +24 -0
  66. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts.map +1 -0
  67. package/lib/types/data-grid/stories/index.d.ts +2 -0
  68. package/lib/types/data-grid/stories/index.d.ts.map +1 -1
  69. package/lib/types/data-grid/style-rules/evaluate.d.ts.map +1 -1
  70. package/lib/types/data-grid/style-rules/index.d.ts +2 -2
  71. package/lib/types/data-grid/style-rules/index.d.ts.map +1 -1
  72. package/lib/types/data-grid/style-rules/types.d.ts +33 -2
  73. package/lib/types/data-grid/style-rules/types.d.ts.map +1 -1
  74. package/lib/types/time-picker/TimePicker.d.ts +1 -1
  75. package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
  76. package/lib/types/time-picker/generate-time-options.d.ts +1 -1
  77. package/lib/types/time-picker/generate-time-options.d.ts.map +1 -1
  78. package/lib/types/time-picker/needle-time.d.ts +4 -2
  79. package/lib/types/time-picker/needle-time.d.ts.map +1 -1
  80. package/lib/types/time-picker/stories/index.d.ts +2 -0
  81. package/lib/types/time-picker/stories/index.d.ts.map +1 -1
  82. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts +24 -0
  83. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts.map +1 -0
  84. package/package.json +6 -4
@@ -0,0 +1,50 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+
22
+ "use strict";
23
+ /*
24
+ * AUTO-GENERATED FILE — DO NOT EDIT.
25
+ * Source of truth: packages/style-rules/src/
26
+ * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
27
+ */
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.getWeight = getWeight;
30
+ exports.lerpColor = lerpColor;
31
+ /**
32
+ * Computes a linear interpolation weight in [0, 1] for `value` between
33
+ * `startValue` and `endValue`. Values outside the range produce weights
34
+ * outside [0, 1] — callers are responsible for clamping if needed.
35
+ */
36
+ function getWeight(startValue, endValue, value) {
37
+ return (value - startValue) / (endValue - startValue);
38
+ }
39
+ /**
40
+ * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).
41
+ * Each channel is rounded to the nearest integer.
42
+ */
43
+ function lerpColor(startColor, endColor, weight) {
44
+ return {
45
+ b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),
46
+ g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),
47
+ r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),
48
+ };
49
+ }
50
+ //# sourceMappingURL=color-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA8BH,8BAMC;AAMD,8BAUC;AA3BD;;;;GAIG;AACH,SAAgB,SAAS,CACvB,UAAkB,EAClB,QAAgB,EAChB,KAAa;IAEb,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,SAAgB,SAAS,CACvB,UAAoB,EACpB,QAAkB,EAClB,MAAc;IAEd,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;KACjE,CAAC;AACJ,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 type { RgbColor } from '@uiw/react-color';\n\n/**\n * Computes a linear interpolation weight in [0, 1] for `value` between\n * `startValue` and `endValue`. Values outside the range produce weights\n * outside [0, 1] — callers are responsible for clamping if needed.\n */\nexport function getWeight(\n startValue: number,\n endValue: number,\n value: number,\n): number {\n return (value - startValue) / (endValue - startValue);\n}\n\n/**\n * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).\n * Each channel is rounded to the nearest integer.\n */\nexport function lerpColor(\n startColor: RgbColor,\n endColor: RgbColor,\n weight: number,\n): RgbColor {\n return {\n b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),\n g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),\n r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),\n };\n}\n"]}
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ /*
3
+ * AUTO-GENERATED FILE — DO NOT EDIT.
4
+ * Source of truth: packages/style-rules/src/
5
+ * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.parseTimeString = parseTimeString;
9
+ exports.parseDateString = parseDateString;
10
+ /**
11
+ *
12
+ * Copyright (c) "Neo4j"
13
+ * Neo4j Sweden AB [http://neo4j.com]
14
+ *
15
+ * This file is part of Neo4j.
16
+ *
17
+ * Neo4j is free software: you can redistribute it and/or modify
18
+ * it under the terms of the GNU General Public License as published by
19
+ * the Free Software Foundation, either version 3 of the License, or
20
+ * (at your option) any later version.
21
+ *
22
+ * This program is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
29
+ */
30
+ const temporal_polyfill_1 = require("temporal-polyfill");
31
+ const MS_PER_DAY = 86400000;
32
+ function plainTimeToMs(pt) {
33
+ return (pt.hour * 3600000 +
34
+ pt.minute * 60000 +
35
+ pt.second * 1000 +
36
+ pt.millisecond);
37
+ }
38
+ function parseOffsetMs(offsetStr) {
39
+ const match = offsetStr.match(/^([+-])(\d{2}):(\d{2})$/);
40
+ if (!match) {
41
+ return null;
42
+ }
43
+ const sign = match[1] === '+' ? 1 : -1;
44
+ return (sign *
45
+ (parseInt(match[2], 10) * 3600000 + parseInt(match[3], 10) * 60000));
46
+ }
47
+ /**
48
+ * Parses an ISO 8601 time string to UTC milliseconds since midnight
49
+ * (0–86,399,999). Returns `null` if the string cannot be parsed.
50
+ *
51
+ * Three formats are accepted:
52
+ * 1. Local time (no offset): `"14:30:00"`, `"14:30:00.500"` — treated as UTC
53
+ * 2. UTC time with Z suffix: `"14:30:00Z"` — treated identically to the local form
54
+ * 3. Offset time: `"14:30:00+02:00"` — the offset is applied so the result
55
+ * is the equivalent UTC time of day. `"12:00:00+01:00"` resolves to
56
+ * 39,600,000 (11:00 UTC), which is less than `"12:00:00+00:00"` (43,200,000).
57
+ *
58
+ * Values wrap around midnight: `"00:00:00+01:00"` → 82,800,000 (23:00 UTC).
59
+ */
60
+ function parseTimeString(s) {
61
+ // Reject datetime strings and anything with an IANA timezone bracket.
62
+ // Temporal.PlainTime.from silently extracts the time portion from strings
63
+ // containing a 'T' separator. IANA brackets are meaningless for time-only
64
+ // values (there is no date to anchor DST to), so they are also rejected.
65
+ if (s.includes('T') || s.includes('[')) {
66
+ return null;
67
+ }
68
+ // Offset time: detect "+HH:MM" or "-HH:MM" suffix first. Temporal.PlainTime.from
69
+ // silently strips offsets and returns the clock-face time, so we must handle
70
+ // offset strings explicitly before falling through to the plain parse.
71
+ const offsetMatch = s.match(/([+-]\d{2}:\d{2})(\[.*\])?$/);
72
+ if (offsetMatch) {
73
+ const offsetStr = offsetMatch[1];
74
+ const timeStr = s.slice(0, s.indexOf(offsetStr));
75
+ const offsetMs = parseOffsetMs(offsetStr);
76
+ if (offsetMs !== null) {
77
+ try {
78
+ const localMs = plainTimeToMs(temporal_polyfill_1.Temporal.PlainTime.from(timeStr));
79
+ // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight
80
+ return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;
81
+ }
82
+ catch (_a) {
83
+ /* empty */
84
+ }
85
+ }
86
+ return null;
87
+ }
88
+ // UTC time with Z suffix (e.g. "14:30:00Z") — strip Z and treat as local (UTC) time.
89
+ // Only apply when there is no 'T' in the string; a datetime string like
90
+ // "2024-06-15T14:30:00Z" must not be accepted here.
91
+ const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;
92
+ // Local time (no offset) — treated as UTC
93
+ try {
94
+ return plainTimeToMs(temporal_polyfill_1.Temporal.PlainTime.from(normalized));
95
+ }
96
+ catch (_b) {
97
+ /* empty */
98
+ }
99
+ return null;
100
+ }
101
+ /**
102
+ * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond
103
+ * timestamp. Returns `null` if the string cannot be parsed.
104
+ *
105
+ * Three formats are tried in order:
106
+ * 1. RFC 9557 ZonedDateTime with IANA bracket notation
107
+ * e.g. `"2024-06-15T14:00:00[Europe/Stockholm]"` (offset inferred from the
108
+ * named timezone, including DST) or `"2024-06-15T14:00:00+02:00[Europe/Stockholm]"`
109
+ * (offset explicit; bracket must agree with the IANA zone)
110
+ * 2. UTC or fixed-offset Instant
111
+ * e.g. `"2024-01-01T00:00:00Z"`, `"2024-01-01T00:00:00+02:00"`
112
+ * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC
113
+ * e.g. `"2024-01-01"`, `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
114
+ *
115
+ * Strings with a time component that lack `Z`, an offset, or an IANA bracket are
116
+ * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).
117
+ */
118
+ function parseDateString(s) {
119
+ // RFC 9557 / ZonedDateTime with IANA bracket notation
120
+ try {
121
+ return temporal_polyfill_1.Temporal.ZonedDateTime.from(s).epochMilliseconds;
122
+ }
123
+ catch (_a) {
124
+ /* empty */
125
+ }
126
+ // UTC or fixed-offset datetime (no IANA name)
127
+ try {
128
+ return temporal_polyfill_1.Temporal.Instant.from(s).epochMilliseconds;
129
+ }
130
+ catch (_b) {
131
+ /* empty */
132
+ }
133
+ // Plain datetime — interpret as UTC.
134
+ // Also covers date-only strings like "2024-01-01" (PlainDateTime.from parses
135
+ // them as midnight), so a separate PlainDate path is not needed.
136
+ try {
137
+ return temporal_polyfill_1.Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')
138
+ .epochMilliseconds;
139
+ }
140
+ catch (_c) {
141
+ /* empty */
142
+ }
143
+ return null;
144
+ }
145
+ //# sourceMappingURL=date-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"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","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"]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /*
3
+ * AUTO-GENERATED FILE — DO NOT EDIT.
4
+ * Source of truth: packages/style-rules/src/
5
+ * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.TimeLiteralSchema = exports.DatetimeLiteralSchema = exports.parseTimeString = exports.parseDateString = exports.lerpColor = exports.getWeight = void 0;
9
+ /**
10
+ *
11
+ * Copyright (c) "Neo4j"
12
+ * Neo4j Sweden AB [http://neo4j.com]
13
+ *
14
+ * This file is part of Neo4j.
15
+ *
16
+ * Neo4j is free software: you can redistribute it and/or modify
17
+ * it under the terms of the GNU General Public License as published by
18
+ * the Free Software Foundation, either version 3 of the License, or
19
+ * (at your option) any later version.
20
+ *
21
+ * This program is distributed in the hope that it will be useful,
22
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ * GNU General Public License for more details.
25
+ *
26
+ * You should have received a copy of the GNU General Public License
27
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
28
+ */
29
+ var color_utils_1 = require("./color-utils");
30
+ Object.defineProperty(exports, "getWeight", { enumerable: true, get: function () { return color_utils_1.getWeight; } });
31
+ Object.defineProperty(exports, "lerpColor", { enumerable: true, get: function () { return color_utils_1.lerpColor; } });
32
+ var date_utils_1 = require("./date-utils");
33
+ Object.defineProperty(exports, "parseDateString", { enumerable: true, get: function () { return date_utils_1.parseDateString; } });
34
+ Object.defineProperty(exports, "parseTimeString", { enumerable: true, get: function () { return date_utils_1.parseTimeString; } });
35
+ var literal_schemas_1 = require("./literal-schemas");
36
+ Object.defineProperty(exports, "DatetimeLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.DatetimeLiteralSchema; } });
37
+ Object.defineProperty(exports, "TimeLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.TimeLiteralSchema; } });
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /*
3
+ * AUTO-GENERATED FILE — DO NOT EDIT.
4
+ * Source of truth: packages/style-rules/src/
5
+ * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.TimeLiteralSchema = exports.DatetimeLiteralSchema = void 0;
9
+ /**
10
+ *
11
+ * Copyright (c) "Neo4j"
12
+ * Neo4j Sweden AB [http://neo4j.com]
13
+ *
14
+ * This file is part of Neo4j.
15
+ *
16
+ * Neo4j is free software: you can redistribute it and/or modify
17
+ * it under the terms of the GNU General Public License as published by
18
+ * the Free Software Foundation, either version 3 of the License, or
19
+ * (at your option) any later version.
20
+ *
21
+ * This program is distributed in the hope that it will be useful,
22
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ * GNU General Public License for more details.
25
+ *
26
+ * You should have received a copy of the GNU General Public License
27
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
28
+ */
29
+ const zod_1 = require("zod");
30
+ const date_utils_1 = require("./date-utils");
31
+ /**
32
+ * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond
33
+ * timestamp at evaluation time. Supported formats:
34
+ * - RFC 9557 with IANA timezone: `"2024-06-15T14:00:00[Europe/Stockholm]"` (offset
35
+ * inferred from the named zone, DST-aware) or `"2024-06-15T14:00:00+02:00[Europe/Stockholm]"`
36
+ * (offset explicit)
37
+ * - UTC or offset datetime: `"2024-01-01T00:00:00Z"`, `"2024-01-01T00:00:00+02:00"`
38
+ * - Plain datetime (treated as UTC): `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
39
+ * - Date-only (treated as UTC midnight): `"2024-01-01"`
40
+ */
41
+ exports.DatetimeLiteralSchema = zod_1.z.object({
42
+ datetime: zod_1.z.string().refine((s) => (0, date_utils_1.parseDateString)(s) !== null, {
43
+ message: 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',
44
+ }),
45
+ });
46
+ /**
47
+ * An ISO 8601 time literal that resolves to milliseconds since UTC midnight
48
+ * at evaluation time. Supported formats:
49
+ * - Local time (treated as UTC): `"14:30:00"`, `"14:30:00.500"`
50
+ * - UTC time: `"14:30:00Z"` — identical to local form
51
+ * - Offset time (UTC-normalised): `"14:30:00+02:00"` → 45,000,000 ms (12:30 UTC)
52
+ *
53
+ * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a
54
+ * time-of-day value has no calendar date so DST cannot be resolved. Use
55
+ * `{ datetime }` literals for timezone-aware instants.
56
+ *
57
+ * Full datetime strings (containing `T`) are rejected.
58
+ */
59
+ exports.TimeLiteralSchema = zod_1.z.object({
60
+ time: zod_1.z.string().refine((s) => (0, date_utils_1.parseTimeString)(s) !== null, {
61
+ message: 'time must be a valid ISO 8601 time string (e.g. "14:30:00" or "14:30:00+02:00")',
62
+ }),
63
+ });
64
+ //# sourceMappingURL=literal-schemas.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const react_1 = require("@neo4j-ndl/react");
26
+ const react_table_1 = require("@tanstack/react-table");
27
+ const data = [
28
+ // ── Past events (before start of 2026-06-25 in Stockholm / CEST) ──────────
29
+ {
30
+ event: 'Quarterly review',
31
+ // 09:00 Stockholm CEST = 07:00 UTC
32
+ scheduledDate: new Date('2026-06-10T09:00:00+02:00'),
33
+ scheduledTimeMs: 7 * 3600000,
34
+ localTimeDisplay: '09:00 CEST (+02:00)',
35
+ status: 'confirmed',
36
+ },
37
+ {
38
+ event: 'Security audit',
39
+ // 07:30 London BST (+01:00) = 06:30 UTC — before Stockholm opens
40
+ scheduledDate: new Date('2026-06-18T07:30:00+01:00'),
41
+ scheduledTimeMs: 6 * 3600000 + 30 * 60000,
42
+ localTimeDisplay: '07:30 BST (+01:00)',
43
+ status: 'delayed',
44
+ },
45
+ // ── Today (2026-06-25 in Stockholm / CEST) ─────────────────────────────────
46
+ {
47
+ event: 'Customer demo',
48
+ // 09:00 New York EDT (-04:00) = 13:00 UTC
49
+ scheduledDate: new Date('2026-06-25T09:00:00-04:00'),
50
+ scheduledTimeMs: 13 * 3600000,
51
+ localTimeDisplay: '09:00 EDT (-04:00)',
52
+ status: 'confirmed',
53
+ },
54
+ {
55
+ event: 'Platform migration',
56
+ // 22:00 Stockholm CEST (+02:00) = 20:00 UTC — after Stockholm closes
57
+ scheduledDate: new Date('2026-06-25T22:00:00+02:00'),
58
+ scheduledTimeMs: 20 * 3600000,
59
+ localTimeDisplay: '22:00 CEST (+02:00)',
60
+ status: 'confirmed',
61
+ },
62
+ // ── Near future (up to and including 2026-07-14 in Stockholm) ─────────────
63
+ {
64
+ event: 'Board presentation',
65
+ // 10:00 Singapore SGT (+08:00) = 02:00 UTC — before Stockholm opens
66
+ scheduledDate: new Date('2026-07-02T10:00:00+08:00'),
67
+ scheduledTimeMs: 2 * 3600000,
68
+ localTimeDisplay: '10:00 SGT (+08:00)',
69
+ status: 'confirmed',
70
+ },
71
+ {
72
+ event: 'Partner onboarding',
73
+ // 13:15 Paris CEST (+02:00) = 11:15 UTC
74
+ scheduledDate: new Date('2026-07-08T13:15:00+02:00'),
75
+ scheduledTimeMs: 11 * 3600000 + 15 * 60000,
76
+ localTimeDisplay: '13:15 CEST (+02:00)',
77
+ status: 'cancelled',
78
+ },
79
+ // ── Far future (after 2026-07-15T00:00 Stockholm / CEST = 2026-07-14T22:00Z)
80
+ {
81
+ event: 'Architecture summit',
82
+ // 08:00 Amsterdam CEST (+02:00) = 06:00 UTC.
83
+ // Although the calendar date is "July 15", 08:00 CEST is still within the
84
+ // same UTC day as July 14 22:00Z, so it crosses the far-future boundary.
85
+ scheduledDate: new Date('2026-07-15T08:00:00+02:00'),
86
+ scheduledTimeMs: 6 * 3600000,
87
+ localTimeDisplay: '08:00 CEST (+02:00)',
88
+ status: 'confirmed',
89
+ },
90
+ {
91
+ event: 'Annual conference',
92
+ // 09:00 San Francisco PDT (-07:00) = 16:00 UTC — after Stockholm closes
93
+ scheduledDate: new Date('2026-08-03T09:00:00-07:00'),
94
+ scheduledTimeMs: 16 * 3600000,
95
+ localTimeDisplay: '09:00 PDT (-07:00)',
96
+ status: 'confirmed',
97
+ },
98
+ {
99
+ event: 'Year-end planning',
100
+ // 09:00 Tokyo JST (+09:00) = 00:00 UTC — midnight, well before Stockholm opens
101
+ scheduledDate: new Date('2026-11-20T09:00:00+09:00'),
102
+ scheduledTimeMs: 0,
103
+ localTimeDisplay: '09:00 JST (+09:00)',
104
+ status: 'confirmed',
105
+ },
106
+ ];
107
+ /**
108
+ * All date and time boundaries are anchored to Stockholm in June–July 2026.
109
+ * Date literals use RFC 9557 IANA bracket notation — the UTC offset is inferred
110
+ * from the named zone (CEST = +02:00 in this period); writing `+02:00` explicitly
111
+ * is optional. Time literals use UTC-offset notation.
112
+ *
113
+ * "Today" from a Stockholm perspective:
114
+ * 2026-06-25T00:00:00[Europe/Stockholm] = 2026-06-24T22:00:00Z
115
+ * 2026-06-26T00:00:00[Europe/Stockholm] = 2026-06-25T22:00:00Z
116
+ *
117
+ * "Far future" threshold:
118
+ * 2026-07-15T00:00:00[Europe/Stockholm] = 2026-07-14T22:00:00Z
119
+ *
120
+ * Business hours (Stockholm):
121
+ * { time: '09:00:00+02:00' } resolves to 07:00 UTC (25 200 000 ms)
122
+ * { time: '17:00:00+02:00' } resolves to 15:00 UTC (54 000 000 ms)
123
+ */
124
+ const styleRules = [
125
+ // Past events — entire row in muted red
126
+ {
127
+ apply: {
128
+ color: { value: '#fee2e2' },
129
+ textColor: { value: '#7f1d1d' },
130
+ },
131
+ column: null,
132
+ priority: 1,
133
+ where: {
134
+ lessThan: [
135
+ { column: 'scheduledDate' },
136
+ { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },
137
+ ],
138
+ },
139
+ },
140
+ // Today (in Stockholm timezone) — entire row in amber
141
+ {
142
+ apply: {
143
+ color: { value: '#fef9c3' },
144
+ textColor: { value: '#713f12' },
145
+ },
146
+ column: null,
147
+ priority: 1,
148
+ where: {
149
+ and: [
150
+ {
151
+ greaterThanOrEqual: [
152
+ { column: 'scheduledDate' },
153
+ { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },
154
+ ],
155
+ },
156
+ {
157
+ lessThan: [
158
+ { column: 'scheduledDate' },
159
+ { datetime: '2026-06-26T00:00:00[Europe/Stockholm]' },
160
+ ],
161
+ },
162
+ ],
163
+ },
164
+ },
165
+ // Far future (after 2026-07-15 midnight Stockholm time) — entire row in green
166
+ {
167
+ apply: {
168
+ color: { value: '#dcfce7' },
169
+ textColor: { value: '#14532d' },
170
+ },
171
+ column: null,
172
+ priority: 1,
173
+ where: {
174
+ greaterThanOrEqual: [
175
+ { column: 'scheduledDate' },
176
+ { datetime: '2026-07-15T00:00:00[Europe/Stockholm]' },
177
+ ],
178
+ },
179
+ },
180
+ // Outside Stockholm business hours (before 09:00 CEST or from 17:00 CEST) —
181
+ // time cell in orange. The { time: "..." } literals carry an offset so the
182
+ // engine normalises them to UTC before comparing against scheduledTimeMs.
183
+ {
184
+ apply: {
185
+ color: { value: '#ffedd5' },
186
+ textColor: { value: '#7c2d12' },
187
+ },
188
+ column: 'scheduledTimeMs',
189
+ priority: 2,
190
+ where: {
191
+ or: [
192
+ {
193
+ lessThan: [{ column: 'scheduledTimeMs' }, { time: '09:00:00+02:00' }],
194
+ },
195
+ {
196
+ greaterThanOrEqual: [
197
+ { column: 'scheduledTimeMs' },
198
+ { time: '17:00:00+02:00' },
199
+ ],
200
+ },
201
+ ],
202
+ },
203
+ },
204
+ // Cancelled events — all cells grayed out at highest priority
205
+ {
206
+ apply: {
207
+ color: { value: '#f3f4f6' },
208
+ textColor: { value: '#9ca3af' },
209
+ },
210
+ column: null,
211
+ priority: 5,
212
+ where: { equal: [{ column: 'status' }, 'cancelled'] },
213
+ },
214
+ ];
215
+ const Component = () => {
216
+ const columnHelper = (0, react_table_1.createColumnHelper)();
217
+ const columns = [
218
+ columnHelper.accessor('event', {
219
+ cell: (info) => info.getValue(),
220
+ header: () => 'Event',
221
+ minSize: 180,
222
+ size: 220,
223
+ }),
224
+ columnHelper.accessor('scheduledDate', {
225
+ cell: (info) => info.getValue().toLocaleDateString('en-GB', {
226
+ day: 'numeric',
227
+ month: 'short',
228
+ timeZone: 'Europe/Stockholm',
229
+ year: 'numeric',
230
+ }),
231
+ header: () => 'Date (Stockholm)',
232
+ minSize: 150,
233
+ size: 170,
234
+ }),
235
+ columnHelper.accessor('localTimeDisplay', {
236
+ cell: (info) => info.getValue(),
237
+ header: () => 'Local time',
238
+ minSize: 160,
239
+ size: 180,
240
+ }),
241
+ columnHelper.accessor('scheduledTimeMs', {
242
+ cell: (info) => {
243
+ const ms = info.getValue();
244
+ const h = Math.floor(ms / 3600000)
245
+ .toString()
246
+ .padStart(2, '0');
247
+ const m = Math.floor((ms % 3600000) / 60000)
248
+ .toString()
249
+ .padStart(2, '0');
250
+ return `${h}:${m} UTC`;
251
+ },
252
+ header: () => 'Time (UTC)',
253
+ minSize: 110,
254
+ size: 130,
255
+ }),
256
+ columnHelper.accessor('status', {
257
+ cell: (info) => info.getValue(),
258
+ header: () => 'Status',
259
+ minSize: 100,
260
+ size: 120,
261
+ }),
262
+ ];
263
+ const table = (0, react_table_1.useReactTable)({
264
+ columnResizeMode: 'onChange',
265
+ columns,
266
+ data,
267
+ defaultColumn: {
268
+ maxSize: 800,
269
+ minSize: 80,
270
+ },
271
+ enableSorting: true,
272
+ getCoreRowModel: (0, react_table_1.getCoreRowModel)(),
273
+ getPaginationRowModel: (0, react_table_1.getPaginationRowModel)(),
274
+ getSortedRowModel: (0, react_table_1.getSortedRowModel)(),
275
+ initialState: {
276
+ pagination: { pageSize: 10 },
277
+ },
278
+ });
279
+ return ((0, jsx_runtime_1.jsx)("div", { className: "n-w-full n-bg-light-neutral-text-weakest", children: (0, jsx_runtime_1.jsx)(react_1.DataGrid, { isResizable: false, isKeyboardNavigable: false, tableInstance: table, styleRules: styleRules, styling: {
280
+ borderStyle: 'all-sides',
281
+ hasHoverEffects: true,
282
+ hasZebraStriping: false,
283
+ } }) }));
284
+ };
285
+ exports.default = Component;
286
+ //# sourceMappingURL=datagrid-rule-based-styling-datetime.story.js.map