@neo4j-ndl/react 4.15.1 → 4.15.3

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 (117) 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/DataGrid.js +2 -1
  10. package/lib/cjs/data-grid/DataGrid.js.map +1 -1
  11. package/lib/cjs/data-grid/data-grid-context.js.map +1 -1
  12. package/lib/cjs/data-grid/index.js +2 -14
  13. package/lib/cjs/data-grid/index.js.map +1 -1
  14. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +286 -0
  15. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  16. package/lib/cjs/data-grid/stories/index.js +5 -1
  17. package/lib/cjs/data-grid/stories/index.js.map +1 -1
  18. package/lib/cjs/data-grid/style-rules/evaluate.js +78 -49
  19. package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
  20. package/lib/cjs/data-grid/style-rules/hooks.js +3 -3
  21. package/lib/cjs/data-grid/style-rules/hooks.js.map +1 -1
  22. package/lib/cjs/data-grid/style-rules/index.js +4 -1
  23. package/lib/cjs/data-grid/style-rules/index.js.map +1 -1
  24. package/lib/cjs/data-grid/style-rules/types.js +26 -2
  25. package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
  26. package/lib/cjs/time-picker/TimePicker.js +36 -20
  27. package/lib/cjs/time-picker/TimePicker.js.map +1 -1
  28. package/lib/cjs/time-picker/generate-time-options.js +6 -3
  29. package/lib/cjs/time-picker/generate-time-options.js.map +1 -1
  30. package/lib/cjs/time-picker/needle-time.js +23 -9
  31. package/lib/cjs/time-picker/needle-time.js.map +1 -1
  32. package/lib/cjs/time-picker/stories/index.js +5 -1
  33. package/lib/cjs/time-picker/stories/index.js.map +1 -1
  34. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js +32 -0
  35. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  36. package/lib/cjs/tooltip/Tooltip.js.map +1 -1
  37. package/lib/cjs/tooltip/use-tooltip.js +1 -1
  38. package/lib/cjs/tooltip/use-tooltip.js.map +1 -1
  39. package/lib/esm/_generated/style-rules/color-utils.js +46 -0
  40. package/lib/esm/_generated/style-rules/color-utils.js.map +1 -0
  41. package/lib/esm/_generated/style-rules/date-utils.js +141 -0
  42. package/lib/esm/_generated/style-rules/date-utils.js.map +1 -0
  43. package/lib/esm/_generated/style-rules/index.js +29 -0
  44. package/lib/esm/_generated/style-rules/index.js.map +1 -0
  45. package/lib/esm/_generated/style-rules/literal-schemas.js +61 -0
  46. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -0
  47. package/lib/esm/data-grid/DataGrid.js +2 -1
  48. package/lib/esm/data-grid/DataGrid.js.map +1 -1
  49. package/lib/esm/data-grid/data-grid-context.js.map +1 -1
  50. package/lib/esm/data-grid/index.js +1 -3
  51. package/lib/esm/data-grid/index.js.map +1 -1
  52. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +284 -0
  53. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  54. package/lib/esm/data-grid/stories/index.js +3 -0
  55. package/lib/esm/data-grid/stories/index.js.map +1 -1
  56. package/lib/esm/data-grid/style-rules/evaluate.js +72 -43
  57. package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
  58. package/lib/esm/data-grid/style-rules/hooks.js +3 -3
  59. package/lib/esm/data-grid/style-rules/hooks.js.map +1 -1
  60. package/lib/esm/data-grid/style-rules/index.js +2 -1
  61. package/lib/esm/data-grid/style-rules/index.js.map +1 -1
  62. package/lib/esm/data-grid/style-rules/types.js +25 -1
  63. package/lib/esm/data-grid/style-rules/types.js.map +1 -1
  64. package/lib/esm/time-picker/TimePicker.js +36 -20
  65. package/lib/esm/time-picker/TimePicker.js.map +1 -1
  66. package/lib/esm/time-picker/generate-time-options.js +6 -3
  67. package/lib/esm/time-picker/generate-time-options.js.map +1 -1
  68. package/lib/esm/time-picker/needle-time.js +23 -9
  69. package/lib/esm/time-picker/needle-time.js.map +1 -1
  70. package/lib/esm/time-picker/stories/index.js +3 -0
  71. package/lib/esm/time-picker/stories/index.js.map +1 -1
  72. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js +30 -0
  73. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  74. package/lib/esm/tooltip/Tooltip.js.map +1 -1
  75. package/lib/esm/tooltip/use-tooltip.js +1 -1
  76. package/lib/esm/tooltip/use-tooltip.js.map +1 -1
  77. package/lib/types/_generated/style-rules/color-utils.d.ts +33 -0
  78. package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -0
  79. package/lib/types/_generated/style-rules/date-utils.d.ts +54 -0
  80. package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -0
  81. package/lib/types/_generated/style-rules/index.d.ts +25 -0
  82. package/lib/types/_generated/style-rules/index.d.ts.map +1 -0
  83. package/lib/types/_generated/style-rules/literal-schemas.d.ts +53 -0
  84. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -0
  85. package/lib/types/data-grid/DataGrid.d.ts +4 -2
  86. package/lib/types/data-grid/DataGrid.d.ts.map +1 -1
  87. package/lib/types/data-grid/data-grid-context.d.ts +2 -1
  88. package/lib/types/data-grid/data-grid-context.d.ts.map +1 -1
  89. package/lib/types/data-grid/index.d.ts +1 -4
  90. package/lib/types/data-grid/index.d.ts.map +1 -1
  91. package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +1 -1
  92. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts +24 -0
  93. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts.map +1 -0
  94. package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +1 -1
  95. package/lib/types/data-grid/stories/index.d.ts +2 -0
  96. package/lib/types/data-grid/stories/index.d.ts.map +1 -1
  97. package/lib/types/data-grid/style-rules/evaluate.d.ts +4 -3
  98. package/lib/types/data-grid/style-rules/evaluate.d.ts.map +1 -1
  99. package/lib/types/data-grid/style-rules/hooks.d.ts.map +1 -1
  100. package/lib/types/data-grid/style-rules/index.d.ts +2 -2
  101. package/lib/types/data-grid/style-rules/index.d.ts.map +1 -1
  102. package/lib/types/data-grid/style-rules/types.d.ts +62 -2
  103. package/lib/types/data-grid/style-rules/types.d.ts.map +1 -1
  104. package/lib/types/time-picker/TimePicker.d.ts +1 -1
  105. package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
  106. package/lib/types/time-picker/generate-time-options.d.ts +1 -1
  107. package/lib/types/time-picker/generate-time-options.d.ts.map +1 -1
  108. package/lib/types/time-picker/needle-time.d.ts +4 -2
  109. package/lib/types/time-picker/needle-time.d.ts.map +1 -1
  110. package/lib/types/time-picker/stories/index.d.ts +2 -0
  111. package/lib/types/time-picker/stories/index.d.ts.map +1 -1
  112. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts +24 -0
  113. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts.map +1 -0
  114. package/lib/types/tooltip/Tooltip.d.ts +4 -1
  115. package/lib/types/tooltip/Tooltip.d.ts.map +1 -1
  116. package/lib/types/tooltip/use-tooltip.d.ts.map +1 -1
  117. package/package.json +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"generate-time-options.js","sourceRoot":"","sources":["../../../src/time-picker/generate-time-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAiB,EAAE,QAAgB,EAAE,EAAE;IACzE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,YAAY,GAAG,QAAQ,IAAI,EAAE,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,CAAC,IAAI,CACR,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CACxE,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YACxC,MAAM,aAAa,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CACR,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAC1F,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,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 */\nexport const generateTimeOptions = (is24Hour: boolean, interval: number) => {\n const times: string[] = [];\n const safeInterval = interval || 30;\n for (let i = 0; i < 1440; i += safeInterval) {\n const hours = Math.floor(i / 60);\n const minutes = i % 60;\n if (is24Hour) {\n times.push(\n `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`,\n );\n } else {\n const period = hours < 12 ? 'AM' : 'PM';\n const adjustedHours = hours % 12 || 12;\n times.push(\n `${String(adjustedHours).padStart(2, '0')}:${String(minutes).padStart(2, '0')} ${period}`,\n );\n }\n }\n return times;\n};\n"]}
1
+ {"version":3,"file":"generate-time-options.js","sourceRoot":"","sources":["../../../src/time-picker/generate-time-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,QAAiB,EACjB,QAAgB,EAChB,WAAqB,EACrB,EAAE;IACF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,YAAY,GAAG,QAAQ,IAAI,EAAE,CAAC;IACpC,8EAA8E;IAC9E,4EAA4E;IAC5E,MAAM,aAAa,GAAG,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACxD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,CAAC,IAAI,CACR,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,aAAa,EAAE,CACxF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YACxC,MAAM,aAAa,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CACR,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,aAAa,IAAI,MAAM,EAAE,CAC1G,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,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 */\nexport const generateTimeOptions = (\n is24Hour: boolean,\n interval: number,\n showSeconds?: boolean,\n) => {\n const times: string[] = [];\n const safeInterval = interval || 30;\n // The dropdown lists times at the minute interval; when seconds are shown the\n // options are anchored at `:00` and the user can type a more precise value.\n const secondsSuffix = showSeconds === true ? ':00' : '';\n for (let i = 0; i < 1440; i += safeInterval) {\n const hours = Math.floor(i / 60);\n const minutes = i % 60;\n if (is24Hour) {\n times.push(\n `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix}`,\n );\n } else {\n const period = hours < 12 ? 'AM' : 'PM';\n const adjustedHours = hours % 12 || 12;\n times.push(\n `${String(adjustedHours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix} ${period}`,\n );\n }\n }\n return times;\n};\n"]}
@@ -19,18 +19,22 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  export class NeedleTime {
22
- constructor(hour, minute) {
22
+ constructor(hour, minute, second) {
23
23
  this.hour = hour || 0;
24
24
  this.minute = minute || 0;
25
+ this.second = second || 0;
25
26
  }
26
- toString(is24Hour) {
27
+ toString(is24Hour, showSeconds) {
28
+ const seconds = showSeconds
29
+ ? `:${String(this.second).padStart(2, '0')}`
30
+ : '';
27
31
  if (is24Hour) {
28
- return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}`;
32
+ return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds}`;
29
33
  }
30
34
  else {
31
35
  const period = this.hour < 12 ? 'AM' : 'PM';
32
36
  const adjustedHours = this.hour % 12 || 12;
33
- return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')} ${period}`;
37
+ return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds} ${period}`;
34
38
  }
35
39
  }
36
40
  static fromString(timeString) {
@@ -40,21 +44,28 @@ export class NeedleTime {
40
44
  const isPM = cleanTime.includes('pm');
41
45
  const hasAMPM = cleanTime.includes('am') || isPM;
42
46
  const timeWithoutAmPm = cleanTime.replace(/[ap]m/g, '');
43
- // Extract hours and minutes
47
+ // Extract hours, minutes and (optionally) seconds
44
48
  let hours;
45
49
  let minutes;
50
+ let seconds;
46
51
  if (timeWithoutAmPm.includes(':')) {
47
- // Format: hh:mm
48
- const [hoursStr, minutesStr] = timeWithoutAmPm.split(':');
52
+ // Format: hh:mm or hh:mm:ss
53
+ const [hoursStr, minutesStr, secondsStr] = timeWithoutAmPm.split(':');
49
54
  hours = parseInt(hoursStr, 10);
50
55
  minutes = parseInt(minutesStr, 10);
56
+ seconds =
57
+ secondsStr !== undefined && secondsStr !== ''
58
+ ? parseInt(secondsStr, 10)
59
+ : 0;
51
60
  }
52
61
  else {
53
- // Format: hhmm
62
+ // Format: hhmm or hhmmss
54
63
  const hoursStr = timeWithoutAmPm.slice(0, 2);
55
64
  const minutesStr = timeWithoutAmPm.slice(2, 4);
65
+ const secondsStr = timeWithoutAmPm.slice(4, 6);
56
66
  hours = parseInt(hoursStr, 10);
57
67
  minutes = parseInt(minutesStr, 10);
68
+ seconds = secondsStr !== '' ? parseInt(secondsStr, 10) : 0;
58
69
  }
59
70
  // Adjust hours for PM
60
71
  if (isPM && hours < 12) {
@@ -64,7 +75,7 @@ export class NeedleTime {
64
75
  if (hasAMPM && !isPM && hours === 12) {
65
76
  hours = 0;
66
77
  }
67
- return new NeedleTime(hours, minutes);
78
+ return new NeedleTime(hours, minutes, seconds);
68
79
  }
69
80
  hourString(is24Hour) {
70
81
  if (is24Hour) {
@@ -77,6 +88,9 @@ export class NeedleTime {
77
88
  minuteString() {
78
89
  return String(this.minute).padStart(2, '0');
79
90
  }
91
+ secondString() {
92
+ return String(this.second).padStart(2, '0');
93
+ }
80
94
  periodString() {
81
95
  return this.hour < 12 ? 'AM' : 'PM';
82
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"needle-time.js","sourceRoot":"","sources":["../../../src/time-picker/needle-time.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,UAAU;IAIrB,YAAY,IAAa,EAAE,MAAe;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,G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AAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACtC,CAAC;CACF","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 */\nexport class NeedleTime {\n hour: number;\n minute: number;\n\n constructor(hour?: number, minute?: number) {\n this.hour = hour || 0;\n this.minute = minute || 0;\n }\n\n toString(is24Hour?: boolean): string {\n if (is24Hour) {\n return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}`;\n } else {\n const period = this.hour < 12 ? 'AM' : 'PM';\n const adjustedHours = this.hour % 12 || 12;\n return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')} ${period}`;\n }\n }\n\n static fromString(timeString: string): NeedleTime {\n // Remove any whitespace and convert to lowercase\n const cleanTime = timeString.toLowerCase().replace(/\\s/g, '');\n\n // Extract AM/PM if present\n const isPM = cleanTime.includes('pm');\n const hasAMPM = cleanTime.includes('am') || isPM;\n const timeWithoutAmPm = cleanTime.replace(/[ap]m/g, '');\n\n // Extract hours and minutes\n let hours: number;\n let minutes: number;\n\n if (timeWithoutAmPm.includes(':')) {\n // Format: hh:mm\n const [hoursStr, minutesStr] = timeWithoutAmPm.split(':');\n hours = parseInt(hoursStr, 10);\n minutes = parseInt(minutesStr, 10);\n } else {\n // Format: hhmm\n const hoursStr = timeWithoutAmPm.slice(0, 2);\n const minutesStr = timeWithoutAmPm.slice(2, 4);\n hours = parseInt(hoursStr, 10);\n minutes = parseInt(minutesStr, 10);\n }\n\n // Adjust hours for PM\n if (isPM && hours < 12) {\n hours += 12;\n }\n // Adjust hours for AM 12 only if we're dealing with AM/PM format\n if (hasAMPM && !isPM && hours === 12) {\n hours = 0;\n }\n\n return new NeedleTime(hours, minutes);\n }\n\n hourString(is24Hour?: boolean): string {\n if (is24Hour) {\n return String(this.hour).padStart(2, '0');\n } else {\n return String(this.hour % 12 || 12).padStart(2, '0');\n }\n }\n\n minuteString(): string {\n return String(this.minute).padStart(2, '0');\n }\n\n periodString(): string {\n return this.hour < 12 ? 'AM' : 'PM';\n }\n}\n"]}
1
+ {"version":3,"file":"needle-time.js","sourceRoot":"","sources":["../../../src/time-picker/needle-time.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,UAAU;IAKrB,YAAY,IAAa,EAAE,MAAe,EAAE,MAAe;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,QAAQ,CAAC,QAAkB,EAAE,WAAqB;QAChD,MAAM,OAAO,GAAG,WAAW;YACzB,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;YAC5C,CAAC,CAAC,EAAE,CAAC;QACP,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CA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C,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,YAAY;QACV,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED,YAAY;QACV,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACtC,CAAC;CACF","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 */\nexport class NeedleTime {\n hour: number;\n minute: number;\n second: number;\n\n constructor(hour?: number, minute?: number, second?: number) {\n this.hour = hour || 0;\n this.minute = minute || 0;\n this.second = second || 0;\n }\n\n toString(is24Hour?: boolean, showSeconds?: boolean): string {\n const seconds = showSeconds\n ? `:${String(this.second).padStart(2, '0')}`\n : '';\n if (is24Hour) {\n return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds}`;\n } else {\n const period = this.hour < 12 ? 'AM' : 'PM';\n const adjustedHours = this.hour % 12 || 12;\n return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds} ${period}`;\n }\n }\n\n static fromString(timeString: string): NeedleTime {\n // Remove any whitespace and convert to lowercase\n const cleanTime = timeString.toLowerCase().replace(/\\s/g, '');\n\n // Extract AM/PM if present\n const isPM = cleanTime.includes('pm');\n const hasAMPM = cleanTime.includes('am') || isPM;\n const timeWithoutAmPm = cleanTime.replace(/[ap]m/g, '');\n\n // Extract hours, minutes and (optionally) seconds\n let hours: number;\n let minutes: number;\n let seconds: number;\n\n if (timeWithoutAmPm.includes(':')) {\n // Format: hh:mm or hh:mm:ss\n const [hoursStr, minutesStr, secondsStr] = timeWithoutAmPm.split(':');\n hours = parseInt(hoursStr, 10);\n minutes = parseInt(minutesStr, 10);\n seconds =\n secondsStr !== undefined && secondsStr !== ''\n ? parseInt(secondsStr, 10)\n : 0;\n } else {\n // Format: hhmm or hhmmss\n const hoursStr = timeWithoutAmPm.slice(0, 2);\n const minutesStr = timeWithoutAmPm.slice(2, 4);\n const secondsStr = timeWithoutAmPm.slice(4, 6);\n hours = parseInt(hoursStr, 10);\n minutes = parseInt(minutesStr, 10);\n seconds = secondsStr !== '' ? parseInt(secondsStr, 10) : 0;\n }\n\n // Adjust hours for PM\n if (isPM && hours < 12) {\n hours += 12;\n }\n // Adjust hours for AM 12 only if we're dealing with AM/PM format\n if (hasAMPM && !isPM && hours === 12) {\n hours = 0;\n }\n\n return new NeedleTime(hours, minutes, seconds);\n }\n\n hourString(is24Hour?: boolean): string {\n if (is24Hour) {\n return String(this.hour).padStart(2, '0');\n } else {\n return String(this.hour % 12 || 12).padStart(2, '0');\n }\n }\n\n minuteString(): string {\n return String(this.minute).padStart(2, '0');\n }\n\n secondString(): string {\n return String(this.second).padStart(2, '0');\n }\n\n periodString(): string {\n return this.hour < 12 ? 'AM' : 'PM';\n }\n}\n"]}
@@ -21,11 +21,14 @@
21
21
  export { default as TimePickerDefault } from './time-picker-default.story';
22
22
  export { default as TimePickerError } from './time-picker-error.story';
23
23
  export { default as TimePickerInDialog } from './time-picker-in-dialog.story';
24
+ export { default as TimePickerWithSeconds } from './time-picker-with-seconds.story';
24
25
  import { removeLicenseHeader } from '../../_common/export-stories-utils';
25
26
  import TimePickerDefaultSrcRaw from './time-picker-default.story.tsx?raw';
26
27
  import TimePickerErrorSrcRaw from './time-picker-error.story.tsx?raw';
27
28
  import TimePickerInDialogSrcRaw from './time-picker-in-dialog.story.tsx?raw';
29
+ import TimePickerWithSecondsSrcRaw from './time-picker-with-seconds.story.tsx?raw';
28
30
  export const TimePickerDefaultSrc = removeLicenseHeader(TimePickerDefaultSrcRaw);
29
31
  export const TimePickerErrorSrc = removeLicenseHeader(TimePickerErrorSrcRaw);
30
32
  export const TimePickerInDialogSrc = removeLicenseHeader(TimePickerInDialogSrcRaw);
33
+ export const TimePickerWithSecondsSrc = removeLicenseHeader(TimePickerWithSecondsSrcRaw);
31
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/time-picker/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,uBAAuB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,qBAAqB,MAAM,mCAAmC,CAAC;AACtE,OAAO,wBAAwB,MAAM,uCAAuC,CAAC;AAE7E,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,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\nexport { default as TimePickerDefault } from './time-picker-default.story';\nexport { default as TimePickerError } from './time-picker-error.story';\nexport { default as TimePickerInDialog } from './time-picker-in-dialog.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport TimePickerDefaultSrcRaw from './time-picker-default.story.tsx?raw';\nimport TimePickerErrorSrcRaw from './time-picker-error.story.tsx?raw';\nimport TimePickerInDialogSrcRaw from './time-picker-in-dialog.story.tsx?raw';\n\nexport const TimePickerDefaultSrc = removeLicenseHeader(\n TimePickerDefaultSrcRaw,\n);\nexport const TimePickerErrorSrc = removeLicenseHeader(TimePickerErrorSrcRaw);\nexport const TimePickerInDialogSrc = removeLicenseHeader(\n TimePickerInDialogSrcRaw,\n);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/time-picker/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,uBAAuB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,qBAAqB,MAAM,mCAAmC,CAAC;AACtE,OAAO,wBAAwB,MAAM,uCAAuC,CAAC;AAC7E,OAAO,2BAA2B,MAAM,0CAA0C,CAAC;AAEnF,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,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\nexport { default as TimePickerDefault } from './time-picker-default.story';\nexport { default as TimePickerError } from './time-picker-error.story';\nexport { default as TimePickerInDialog } from './time-picker-in-dialog.story';\nexport { default as TimePickerWithSeconds } from './time-picker-with-seconds.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport TimePickerDefaultSrcRaw from './time-picker-default.story.tsx?raw';\nimport TimePickerErrorSrcRaw from './time-picker-error.story.tsx?raw';\nimport TimePickerInDialogSrcRaw from './time-picker-in-dialog.story.tsx?raw';\nimport TimePickerWithSecondsSrcRaw from './time-picker-with-seconds.story.tsx?raw';\n\nexport const TimePickerDefaultSrc = removeLicenseHeader(\n TimePickerDefaultSrcRaw,\n);\nexport const TimePickerErrorSrc = removeLicenseHeader(TimePickerErrorSrcRaw);\nexport const TimePickerInDialogSrc = removeLicenseHeader(\n TimePickerInDialogSrcRaw,\n);\nexport const TimePickerWithSecondsSrc = removeLicenseHeader(\n TimePickerWithSecondsSrcRaw,\n);\n"]}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { TimePicker } from '@neo4j-ndl/react';
24
+ import { useState } from 'react';
25
+ const Component = () => {
26
+ const [selectedTime, setSelectedTime] = useState();
27
+ return (_jsx("div", { style: { height: '600px', padding: '20px' }, children: _jsx(TimePicker, { label: "Select Time (with seconds)", format: "hh:mm:ss", value: selectedTime, onChange: (time) => setSelectedTime(time), htmlAttributes: { id: 'time-picker-input' } }) }));
28
+ };
29
+ export default Component;
30
+ //# sourceMappingURL=time-picker-with-seconds.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-picker-with-seconds.story.js","sourceRoot":"","sources":["../../../../src/time-picker/stories/time-picker-with-seconds.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAmB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,EAAc,CAAC;IAE/D,OAAO,CACL,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAC9C,KAAC,UAAU,IACT,KAAK,EAAC,4BAA4B,EAClC,MAAM,EAAC,UAAU,EACjB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EACzC,cAAc,EAAE,EAAE,EAAE,EAAE,mBAAmB,EAAE,GAC3C,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 { type NeedleTime, TimePicker } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [selectedTime, setSelectedTime] = useState<NeedleTime>();\n\n return (\n <div style={{ height: '600px', padding: '20px' }}>\n <TimePicker\n label=\"Select Time (with seconds)\"\n format=\"hh:mm:ss\"\n value={selectedTime}\n onChange={(time) => setSelectedTime(time)}\n htmlAttributes={{ id: 'time-picker-input' }}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/tooltip/Tooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAEL,oBAAoB,EACpB,cAAc,EAGd,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,UAAU,EAA2B,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAiC9E,MAAM,gBAAgB,GAAG,CAAC,EACxB,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,aAAa,EACb,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,YAAY,EAC9B,UAAU,EACV,2BAA2B,EAC3B,iBAAiB,EACjB,YAAY,GACC,EAAE,EAAE;IACjB,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IACvD,MAAM,UAAU,GAAG,CAAC,cAAc,CAAC;IAEnC,MAAM,OAAO,GAAG,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ACf,KAAK,EAAE,KAAK,IACR,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAExC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAC9C,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;CACxB,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,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 */\nimport {\n type AutoUpdateOptions,\n FloatingFocusManager,\n FloatingPortal,\n type Placement,\n type UseFloatingOptions,\n useMergeRefs,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport React, { useEffect } from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { useNeedleTheme } from '../theme';\nimport { Typography, type TypographyVariants } from '../typography';\nimport { TooltipContext, useTooltip, useTooltipContext } from './use-tooltip';\n\nexport type TooltipProps = {\n /** Content displayed inside the tooltip. Wraps `Tooltip.Trigger`, `Tooltip.Content`, and optional parts */\n children: React.ReactNode;\n /** Whether the tooltip is disabled */\n isDisabled?: boolean;\n /** Whether the tooltip should be open on first render */\n isInitialOpen?: boolean;\n /** Placement of the tooltip content relative to the trigger */\n placement?: Placement;\n /** Controls the open state . If omitted, the tooltip manages its own state */\n isOpen?: boolean;\n /** Visual style of the tooltip content. `simple` renders plain text, `rich` renders a composable panel */\n type: 'simple' | 'rich';\n /** Whether the content is rendered in a portal. */\n isPortaled?: boolean;\n /** Callback fired when the open state changes, if omitted, the tooltip manages its own state using internal hooks */\n onOpenChange?: UseFloatingOptions['onOpenChange'];\n /** Positioning strategy of the tooltip. Defaults to `fixed` when inside a dialog, otherwise `absolute` */\n floatingStrategy?: 'absolute' | 'fixed';\n /** Hover open/close delays in milliseconds */\n hoverDelay?: {\n open: number;\n close: number;\n };\n /** Whether the tooltip should close when the reference element is clicked. Useful when the trigger moves after click. */\n shouldCloseOnReferenceClick?: boolean;\n autoUpdateOptions?: AutoUpdateOptions;\n /** Whether the tooltip should follow the mouse cursor. Only applies to 'simple' tooltips with mouse hover. */\n followCursor?: boolean;\n};\n\nconst TooltipComponent = ({\n children,\n isDisabled = false,\n type,\n isInitialOpen,\n placement,\n isOpen,\n onOpenChange,\n isPortaled: isPortaledProp,\n floatingStrategy: strategyProp,\n hoverDelay,\n shouldCloseOnReferenceClick,\n autoUpdateOptions,\n followCursor,\n}: TooltipProps) => {\n const isInsideDialog = useIsInsideDialog();\n const strategy = isInsideDialog ? 'fixed' : 'absolute';\n const isPortaled = !isInsideDialog;\n\n const tooltip = useTooltip({\n autoUpdateOptions,\n followCursor,\n hoverDelay,\n isDisabled,\n isInitialOpen,\n // if isDisabled is true tooltip will not open otherwise either controlled or uncontrolled depending on if isOpen is passed\n isOpen: isDisabled === true ? false : isOpen,\n isPortaled: isPortaledProp ?? isPortaled,\n onOpenChange,\n placement,\n shouldCloseOnReferenceClick,\n strategy: strategyProp ?? strategy,\n type,\n });\n\n return (\n <TooltipContext.Provider value={tooltip}>\n {children}\n </TooltipContext.Provider>\n );\n};\n\nTooltipComponent.displayName = 'Tooltip';\n\ntype TooltipTriggerProps = {\n /** Content displayed inside the trigger element */\n children: React.ReactNode;\n /** Whether the trigger element can be any element without an extra button wrapper. The child element will be cloned with the necessary trigger props and merged refs */\n hasButtonWrapper?: boolean;\n};\n\nconst TooltipTrigger = ({\n children,\n hasButtonWrapper = false,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'button', TooltipTriggerProps>) => {\n const context = useTooltipContext();\n\n // Example from floating-ui\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const childrenProps = (children as any).props;\n const mergedRefs = useMergeRefs([\n context.refs.setReference,\n ref,\n childrenProps?.ref,\n ]);\n\n const triggerClasses = classNames(\n {\n 'ndl-closed': !context.isOpen,\n 'ndl-open': context.isOpen,\n },\n 'ndl-tooltip-trigger',\n className,\n );\n\n // `hasButtonWrapper=true` allows the user to pass any element as the anchor\n if (hasButtonWrapper && React.isValidElement(children)) {\n const props: Record<string, unknown> = {\n className: triggerClasses,\n ...htmlAttributes,\n ...childrenProps,\n ref: mergedRefs,\n };\n return React.cloneElement(children, context.getReferenceProps(props));\n }\n\n return (\n <button\n type=\"button\"\n className={triggerClasses}\n style={style}\n ref={mergedRefs}\n {...context.getReferenceProps(htmlAttributes)}\n {...restProps}\n >\n {children}\n </button>\n );\n};\n\ntype TooltipContentProps = {\n /** Content displayed inside the tooltip */\n children: React.ReactNode;\n};\n\nconst TooltipContent = ({\n children,\n style,\n htmlAttributes,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', TooltipContentProps>) => {\n const context = useTooltipContext();\n const mergedRef = useMergeRefs([context.refs.setFloating, ref]);\n const { themeClassName } = useNeedleTheme();\n\n const hasHeaderChild = React.useMemo(() => {\n if (context.type !== 'rich') {\n return false;\n }\n const childrenArray = React.Children.toArray(children);\n return childrenArray.some(\n (child) => React.isValidElement(child) && child.type === TooltipHeader,\n );\n }, [children, context.type]);\n\n if (!context.isOpen) {\n return null;\n }\n\n const classes = classNames('ndl-tooltip-content', themeClassName, className, {\n 'ndl-tooltip-content-rich': context.type === 'rich',\n 'ndl-tooltip-content-simple': context.type === 'simple',\n });\n\n if (context.type === 'simple') {\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => <FloatingPortal>{wrapChildren}</FloatingPortal>}\n >\n <div\n ref={mergedRef}\n className={classes}\n style={{\n ...context.floatingStyles,\n ...style,\n }}\n {...restProps}\n {...context.getFloatingProps(htmlAttributes)}\n >\n <Typography variant=\"body-medium\">{children}</Typography>\n </div>\n </ConditionalWrap>\n );\n }\n\n const ariaLabelledBy =\n htmlAttributes?.['aria-labelledby'] ??\n (hasHeaderChild ? context.headerId : undefined);\n\n if (htmlAttributes?.['aria-label'] === undefined && !ariaLabelledBy) {\n console.warn(\n 'The rich Tooltip is missing aria-label and Header. Please add one of them for accessibility.',\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => <FloatingPortal>{wrapChildren}</FloatingPortal>}\n >\n <FloatingFocusManager\n context={context.context}\n returnFocus={true}\n modal={false}\n initialFocus={0}\n closeOnFocusOut\n >\n <div\n ref={mergedRef}\n className={classes}\n style={{\n ...context.floatingStyles,\n ...style,\n }}\n {...restProps}\n {...context.getFloatingProps({\n ...htmlAttributes,\n 'aria-labelledby': ariaLabelledBy,\n })}\n >\n {children}\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n );\n};\n\ntype TooltipHeaderProps = {\n /** Content displayed inside the header */\n children: React.ReactNode;\n /** @deprecated Use `typographyVariant` instead */\n passThroughProps?: Partial<React.ComponentPropsWithoutRef<typeof Typography>>;\n typographyVariant?: TypographyVariants;\n};\n\nconst TooltipHeader = ({\n children,\n passThroughProps,\n typographyVariant = 'subheading-medium',\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', TooltipHeaderProps>) => {\n const context = useTooltipContext();\n\n const classes = classNames('ndl-tooltip-header', className);\n\n useEffect(() => {\n if (Boolean(htmlAttributes?.id) === true) {\n context.setHeaderId?.(htmlAttributes?.id);\n }\n }, [context, htmlAttributes?.id]);\n\n if (!context.isOpen) {\n return null;\n }\n\n return (\n <Typography\n ref={ref}\n variant={typographyVariant}\n className={classes}\n style={style}\n htmlAttributes={{ ...htmlAttributes, id: context.headerId }}\n {...passThroughProps}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nexport type TooltipBodyProps = {\n /** Content displayed inside the body */\n children: React.ReactNode;\n /** Additional props to pass to the Typography component */\n // TODO v5: Deprecate passThroughProps and use restProps instead\n passThroughProps?: Partial<React.ComponentPropsWithoutRef<typeof Typography>>;\n};\n\nconst TooltipBody = ({\n children,\n className,\n style,\n htmlAttributes,\n passThroughProps,\n ref,\n ...restProps\n}: CommonProps<'span', TooltipBodyProps>) => {\n const context = useTooltipContext();\n\n const classes = classNames('ndl-tooltip-body', className);\n if (!context.isOpen) {\n return null;\n }\n\n return (\n <Typography\n ref={ref}\n variant=\"body-medium\"\n className={classes}\n style={style}\n htmlAttributes={htmlAttributes}\n {...passThroughProps}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\ntype ToolTipActionsProps = {\n /** Content displayed inside the actions container */\n children: React.ReactNode;\n};\n\nconst Actions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ToolTipActionsProps>) => {\n const context = useTooltipContext();\n const mergedRefs = useMergeRefs([context.refs.setFloating, ref]);\n\n if (!context.isOpen) {\n return null;\n }\n\n const classes = classNames('ndl-tooltip-actions', className);\n\n return (\n <div\n className={classes}\n ref={mergedRefs}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\nActions.displayName = 'Tooltip.Actions';\n\nconst Tooltip = Object.assign(TooltipComponent, {\n Actions: Actions,\n Body: TooltipBody,\n Content: TooltipContent,\n Header: TooltipHeader,\n Trigger: TooltipTrigger,\n});\n\nexport { Tooltip };\n"]}
1
+ {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/tooltip/Tooltip.ts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cAAc;IACvB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;CACxB,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,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 */\nimport {\n type AutoUpdateOptions,\n FloatingFocusManager,\n FloatingPortal,\n type Placement,\n type UseFloatingOptions,\n useMergeRefs,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport React, { useEffect } from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { useNeedleTheme } from '../theme';\nimport { Typography, type TypographyVariants } from '../typography';\nimport { TooltipContext, useTooltip, useTooltipContext } from './use-tooltip';\n\nexport type TooltipProps = {\n /** Content displayed inside the tooltip. Wraps `Tooltip.Trigger`, `Tooltip.Content`, and optional parts */\n children: React.ReactNode;\n /** Whether the tooltip is disabled */\n isDisabled?: boolean;\n /** Whether the tooltip should be open on first render */\n isInitialOpen?: boolean;\n /** Placement of the tooltip content relative to the trigger */\n placement?: Placement;\n /** Controls the open state . If omitted, the tooltip manages its own state */\n isOpen?: boolean;\n // TODO v5: deprecate this prop\n /**\n * Visual style of the tooltip content. `simple` renders plain text, `rich` renders a composable panel\n * @deprecated rich type will be removed in v5, use simple type instead.\n */\n type: 'simple' | 'rich';\n /** Whether the content is rendered in a portal. */\n isPortaled?: boolean;\n /** Callback fired when the open state changes, if omitted, the tooltip manages its own state using internal hooks */\n onOpenChange?: UseFloatingOptions['onOpenChange'];\n /** Positioning strategy of the tooltip. Defaults to `fixed` when inside a dialog, otherwise `absolute` */\n floatingStrategy?: 'absolute' | 'fixed';\n /** Hover open/close delays in milliseconds */\n hoverDelay?: {\n open: number;\n close: number;\n };\n /** Whether the tooltip should close when the reference element is clicked. Useful when the trigger moves after click. */\n shouldCloseOnReferenceClick?: boolean;\n autoUpdateOptions?: AutoUpdateOptions;\n /** Whether the tooltip should follow the mouse cursor. Only applies to 'simple' tooltips with mouse hover. */\n followCursor?: boolean;\n};\n\nconst TooltipComponent = ({\n children,\n isDisabled = false,\n type,\n isInitialOpen,\n placement,\n isOpen,\n onOpenChange,\n isPortaled: isPortaledProp,\n floatingStrategy: strategyProp,\n hoverDelay,\n shouldCloseOnReferenceClick,\n autoUpdateOptions,\n followCursor,\n}: TooltipProps) => {\n const isInsideDialog = useIsInsideDialog();\n const strategy = isInsideDialog ? 'fixed' : 'absolute';\n const isPortaled = !isInsideDialog;\n\n const tooltip = useTooltip({\n autoUpdateOptions,\n followCursor,\n hoverDelay,\n isDisabled,\n isInitialOpen,\n // if isDisabled is true tooltip will not open otherwise either controlled or uncontrolled depending on if isOpen is passed\n isOpen: isDisabled === true ? false : isOpen,\n isPortaled: isPortaledProp ?? isPortaled,\n onOpenChange,\n placement,\n shouldCloseOnReferenceClick,\n strategy: strategyProp ?? strategy,\n type,\n });\n\n return (\n <TooltipContext.Provider value={tooltip}>\n {children}\n </TooltipContext.Provider>\n );\n};\n\nTooltipComponent.displayName = 'Tooltip';\n\ntype TooltipTriggerProps = {\n /** Content displayed inside the trigger element */\n children: React.ReactNode;\n /** Whether the trigger element can be any element without an extra button wrapper. The child element will be cloned with the necessary trigger props and merged refs */\n hasButtonWrapper?: boolean;\n};\n\nconst TooltipTrigger = ({\n children,\n hasButtonWrapper = false,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'button', TooltipTriggerProps>) => {\n const context = useTooltipContext();\n\n // Example from floating-ui\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const childrenProps = (children as any).props;\n const mergedRefs = useMergeRefs([\n context.refs.setReference,\n ref,\n childrenProps?.ref,\n ]);\n\n const triggerClasses = classNames(\n {\n 'ndl-closed': !context.isOpen,\n 'ndl-open': context.isOpen,\n },\n 'ndl-tooltip-trigger',\n className,\n );\n\n // `hasButtonWrapper=true` allows the user to pass any element as the anchor\n if (hasButtonWrapper && React.isValidElement(children)) {\n const props: Record<string, unknown> = {\n className: triggerClasses,\n ...htmlAttributes,\n ...childrenProps,\n ref: mergedRefs,\n };\n\n return React.cloneElement(children, context.getReferenceProps(props));\n }\n\n return (\n <button\n type=\"button\"\n className={triggerClasses}\n style={style}\n ref={mergedRefs}\n {...context.getReferenceProps(htmlAttributes)}\n {...restProps}\n >\n {children}\n </button>\n );\n};\n\ntype TooltipContentProps = {\n /** Content displayed inside the tooltip */\n children: React.ReactNode;\n};\n\nconst TooltipContent = ({\n children,\n style,\n htmlAttributes,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', TooltipContentProps>) => {\n const context = useTooltipContext();\n const mergedRef = useMergeRefs([context.refs.setFloating, ref]);\n const { themeClassName } = useNeedleTheme();\n\n const hasHeaderChild = React.useMemo(() => {\n if (context.type !== 'rich') {\n return false;\n }\n const childrenArray = React.Children.toArray(children);\n return childrenArray.some(\n (child) => React.isValidElement(child) && child.type === TooltipHeader,\n );\n }, [children, context.type]);\n\n if (!context.isOpen) {\n return null;\n }\n\n const classes = classNames('ndl-tooltip-content', themeClassName, className, {\n 'ndl-tooltip-content-rich': context.type === 'rich',\n 'ndl-tooltip-content-simple': context.type === 'simple',\n });\n\n if (context.type === 'simple') {\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => <FloatingPortal>{wrapChildren}</FloatingPortal>}\n >\n <div\n ref={mergedRef}\n className={classes}\n style={{\n ...context.floatingStyles,\n ...style,\n }}\n {...restProps}\n {...context.getFloatingProps(htmlAttributes)}\n >\n <Typography variant=\"body-medium\">{children}</Typography>\n </div>\n </ConditionalWrap>\n );\n }\n\n const ariaLabelledBy =\n htmlAttributes?.['aria-labelledby'] ??\n (hasHeaderChild ? context.headerId : undefined);\n\n if (htmlAttributes?.['aria-label'] === undefined && !ariaLabelledBy) {\n console.warn(\n 'The rich Tooltip is missing aria-label and Header. Please add one of them for accessibility.',\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => <FloatingPortal>{wrapChildren}</FloatingPortal>}\n >\n <FloatingFocusManager\n context={context.context}\n returnFocus={true}\n modal={false}\n initialFocus={0}\n closeOnFocusOut\n >\n <div\n ref={mergedRef}\n className={classes}\n style={{\n ...context.floatingStyles,\n ...style,\n }}\n {...restProps}\n {...context.getFloatingProps({\n ...htmlAttributes,\n 'aria-labelledby': ariaLabelledBy,\n })}\n >\n {children}\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n );\n};\n\ntype TooltipHeaderProps = {\n /** Content displayed inside the header */\n children: React.ReactNode;\n /** @deprecated Use `typographyVariant` instead */\n passThroughProps?: Partial<React.ComponentPropsWithoutRef<typeof Typography>>;\n typographyVariant?: TypographyVariants;\n};\n\nconst TooltipHeader = ({\n children,\n passThroughProps,\n typographyVariant = 'subheading-medium',\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', TooltipHeaderProps>) => {\n const context = useTooltipContext();\n\n const classes = classNames('ndl-tooltip-header', className);\n\n useEffect(() => {\n if (Boolean(htmlAttributes?.id) === true) {\n context.setHeaderId?.(htmlAttributes?.id);\n }\n }, [context, htmlAttributes?.id]);\n\n if (!context.isOpen) {\n return null;\n }\n\n return (\n <Typography\n ref={ref}\n variant={typographyVariant}\n className={classes}\n style={style}\n htmlAttributes={{ ...htmlAttributes, id: context.headerId }}\n {...passThroughProps}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nexport type TooltipBodyProps = {\n /** Content displayed inside the body */\n children: React.ReactNode;\n /** Additional props to pass to the Typography component */\n // TODO v5: Deprecate passThroughProps and use restProps instead\n passThroughProps?: Partial<React.ComponentPropsWithoutRef<typeof Typography>>;\n};\n\nconst TooltipBody = ({\n children,\n className,\n style,\n htmlAttributes,\n passThroughProps,\n ref,\n ...restProps\n}: CommonProps<'span', TooltipBodyProps>) => {\n const context = useTooltipContext();\n\n const classes = classNames('ndl-tooltip-body', className);\n if (!context.isOpen) {\n return null;\n }\n\n return (\n <Typography\n ref={ref}\n variant=\"body-medium\"\n className={classes}\n style={style}\n htmlAttributes={htmlAttributes}\n {...passThroughProps}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\ntype ToolTipActionsProps = {\n /** Content displayed inside the actions container */\n children: React.ReactNode;\n};\n\nconst Actions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ToolTipActionsProps>) => {\n const context = useTooltipContext();\n const mergedRefs = useMergeRefs([context.refs.setFloating, ref]);\n\n if (!context.isOpen) {\n return null;\n }\n\n const classes = classNames('ndl-tooltip-actions', className);\n\n return (\n <div\n className={classes}\n ref={mergedRefs}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\nActions.displayName = 'Tooltip.Actions';\n\nconst Tooltip = Object.assign(TooltipComponent, {\n Actions: Actions,\n Body: TooltipBody,\n Content: TooltipContent,\n Header: TooltipHeader,\n Trigger: TooltipTrigger,\n});\n\nexport { Tooltip };\n"]}
@@ -82,7 +82,7 @@ export function useTooltip({ isInitialOpen = false, placement = 'top', isOpen: c
82
82
  ]);
83
83
  return useMemo(() => (Object.assign(Object.assign({ headerId: type === 'rich' ? headerId : undefined, isOpen,
84
84
  isPortaled, setHeaderId: type === 'rich' ? setHeaderId : undefined, setOpen,
85
- type }, interactions), data)), [headerId, isOpen, setOpen, type, isPortaled, interactions, data]);
85
+ type }, interactions), data)), [headerId, isOpen, isPortaled, setOpen, type, interactions, data]);
86
86
  }
87
87
  export const TooltipContext = createContext(null);
88
88
  export const useTooltipContext = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"use-tooltip.js","sourceRoot":"","sources":["../../../src/tooltip/use-tooltip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EAEV,IAAI,EACJ,MAAM,EAGN,WAAW,EACX,KAAK,EACL,QAAQ,EACR,cAAc,EACd,UAAU,EACV,WAAW,EAGX,QAAQ,EACR,QAAQ,EACR,eAAe,EAEf,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAqB5E,MAAM,UAAU,UAAU,CAAC,EACzB,aAAa,GAAG,KAAK,EACrB,SAAS,GAAG,KAAK,EACjB,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,iBAAiB,EAC/B,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,UAAU,EACrB,UAAU,GAAG,SAAS,EACtB,2BAA2B,GAAG,KAAK,EACnC,iBAAiB,EACjB,UAAU,GAAG,KAAK,EAClB,YAAY,GAAG,KAAK,MACF,EAAE;IASpB,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAqB,EAAE,CAAC,CAAC;IACjE,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,kBAAkB,CAAC;IACpD,MAAM,OAAO,GAAG,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,qBAAqB,CAAC;IAE3D,MAAM,IAAI,GAAG,WAAW,CAAC;Q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C;AACjB,CAAC,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 */\nimport {\n autoUpdate,\n type AutoUpdateOptions,\n flip,\n offset,\n type Placement,\n type ReferenceType,\n safePolygon,\n shift,\n useClick,\n useClientPoint,\n useDismiss,\n useFloating,\n type UseFloatingOptions,\n type UseFloatingReturn,\n useFocus,\n useHover,\n useInteractions,\n type UseInteractionsReturn,\n useRole,\n} from '@floating-ui/react';\nimport { createContext, useContext, useId, useMemo, useState } from 'react';\n\nexport interface TooltipOptions {\n isInitialOpen?: boolean;\n placement?: Placement;\n isOpen?: boolean;\n onOpenChange?: UseFloatingOptions['onOpenChange'];\n type?: 'simple' | 'rich';\n isPortaled?: boolean;\n strategy?: 'fixed' | 'absolute';\n hoverDelay?: {\n open: number;\n close: number;\n };\n shouldCloseOnReferenceClick?: boolean;\n autoUpdateOptions?: AutoUpdateOptions;\n isDisabled?: boolean;\n /** Whether the tooltip should follow the mouse cursor. Only applies to 'simple' tooltips with mouse hover. */\n followCursor?: boolean;\n}\n\nexport function useTooltip({\n isInitialOpen = false,\n placement = 'top',\n isOpen: controlledOpen,\n onOpenChange: setControlledOpen,\n type = 'simple',\n isPortaled = true,\n strategy = 'absolute',\n hoverDelay = undefined,\n shouldCloseOnReferenceClick = false,\n autoUpdateOptions,\n isDisabled = false,\n followCursor = false,\n}: TooltipOptions = {}): {\n headerId?: string;\n setHeaderId?: (id: string | undefined) => void;\n isOpen: boolean;\n setOpen: (open: boolean) => void;\n type: 'simple' | 'rich';\n isPortaled: boolean;\n} & UseInteractionsReturn &\n UseFloatingReturn<ReferenceType> {\n const id = useId();\n const [headerId, setHeaderId] = useState<string | undefined>(id);\n const [isUncontrolledOpen, setIsUncontrolledOpen] = useState(isInitialOpen);\n const isOpen = controlledOpen ?? isUncontrolledOpen;\n const setOpen = setControlledOpen ?? setIsUncontrolledOpen;\n\n const data = useFloating({\n middleware: [\n offset(5),\n flip({\n crossAxis: placement.includes('-'),\n fallbackAxisSideDirection: 'start',\n padding: 5,\n }),\n shift({ padding: 5 }),\n ],\n onOpenChange: setOpen,\n open: isOpen,\n placement,\n strategy,\n whileElementsMounted(referenceEl, floatingEl, update) {\n const cleanup = autoUpdate(referenceEl, floatingEl, update, {\n ...autoUpdateOptions,\n });\n return cleanup;\n },\n });\n\n const context = data.context;\n\n const hover = useHover(context, {\n delay: hoverDelay,\n enabled: type === 'simple' && !isDisabled,\n handleClose: safePolygon(),\n move: false,\n });\n const click = useClick(context, {\n enabled: type === 'rich' && !isDisabled,\n });\n const focus = useFocus(context, {\n enabled: type === 'simple' && !isDisabled,\n visibleOnly: true,\n });\n const dismiss = useDismiss(context, {\n escapeKey: true,\n outsidePress: true,\n referencePress: shouldCloseOnReferenceClick,\n });\n const role = useRole(context, {\n role: type === 'simple' ? 'tooltip' : 'dialog',\n });\n const followAxis =\n placement.startsWith('left') || placement.startsWith('right') ? 'y' : 'x';\n const clientPoint = useClientPoint(context, {\n axis: followAxis,\n enabled: followCursor && type === 'simple' && !isDisabled,\n });\n\n const interactions = useInteractions([\n hover,\n focus,\n dismiss,\n role,\n click,\n clientPoint,\n ]);\n\n return useMemo(\n () => ({\n headerId: type === 'rich' ? headerId : undefined,\n isOpen,\n isPortaled,\n setHeaderId: type === 'rich' ? setHeaderId : undefined,\n setOpen,\n type,\n ...interactions,\n ...data,\n }),\n [headerId, isOpen, setOpen, type, isPortaled, interactions, data],\n );\n}\n\ntype ContextType = ReturnType<typeof useTooltip> | null;\nexport const TooltipContext = createContext<ContextType>(null);\n\nexport const useTooltipContext = (): ReturnType<typeof useTooltip> => {\n const context = useContext(TooltipContext);\n\n if (context === null) {\n throw new Error('Tooltip components must be wrapped in <Tooltip />');\n }\n\n return context;\n};\n"]}
1
+ {"version":3,"file":"use-tooltip.js","sourceRoot":"","sources":["../../../src/tooltip/use-tooltip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EAEV,IAAI,EACJ,MAAM,EAGN,WAAW,EACX,KAAK,EACL,QAAQ,EACR,cAAc,EACd,UAAU,EACV,WAAW,EAGX,QAAQ,EACR,QAAQ,EACR,eAAe,EAEf,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAqB5E,MAAM,UAAU,UAAU,CAAC,EACzB,aAAa,GAAG,KAAK,EACrB,SAAS,GAAG,KAAK,EACjB,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,iBAAiB,EAC/B,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,UAAU,EACrB,UAAU,GAAG,SAAS,EACtB,2BAA2B,GAAG,KAAK,EACnC,iBAAiB,EACjB,UAAU,GAAG,KAAK,EAClB,YAAY,GAAG,KAAK,MACF,EAAE;IASpB,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAqB,EAAE,CAAC,CAAC;IACjE,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,kBAAkB,CAAC;IACpD,MAAM,OAAO,GAAG,iBAAiB,aAA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C;QACrB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,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 */\nimport {\n autoUpdate,\n type AutoUpdateOptions,\n flip,\n offset,\n type Placement,\n type ReferenceType,\n safePolygon,\n shift,\n useClick,\n useClientPoint,\n useDismiss,\n useFloating,\n type UseFloatingOptions,\n type UseFloatingReturn,\n useFocus,\n useHover,\n useInteractions,\n type UseInteractionsReturn,\n useRole,\n} from '@floating-ui/react';\nimport { createContext, useContext, useId, useMemo, useState } from 'react';\n\nexport interface TooltipOptions {\n isInitialOpen?: boolean;\n placement?: Placement;\n isOpen?: boolean;\n onOpenChange?: UseFloatingOptions['onOpenChange'];\n type?: 'simple' | 'rich';\n isPortaled?: boolean;\n strategy?: 'fixed' | 'absolute';\n hoverDelay?: {\n open: number;\n close: number;\n };\n shouldCloseOnReferenceClick?: boolean;\n autoUpdateOptions?: AutoUpdateOptions;\n isDisabled?: boolean;\n /** Whether the tooltip should follow the mouse cursor. Only applies to 'simple' tooltips with mouse hover. */\n followCursor?: boolean;\n}\n\nexport function useTooltip({\n isInitialOpen = false,\n placement = 'top',\n isOpen: controlledOpen,\n onOpenChange: setControlledOpen,\n type = 'simple',\n isPortaled = true,\n strategy = 'absolute',\n hoverDelay = undefined,\n shouldCloseOnReferenceClick = false,\n autoUpdateOptions,\n isDisabled = false,\n followCursor = false,\n}: TooltipOptions = {}): {\n headerId?: string;\n setHeaderId?: (id: string | undefined) => void;\n isOpen: boolean;\n setOpen: (open: boolean) => void;\n type: 'simple' | 'rich';\n isPortaled: boolean;\n} & UseInteractionsReturn &\n UseFloatingReturn<ReferenceType> {\n const id = useId();\n const [headerId, setHeaderId] = useState<string | undefined>(id);\n const [isUncontrolledOpen, setIsUncontrolledOpen] = useState(isInitialOpen);\n const isOpen = controlledOpen ?? isUncontrolledOpen;\n const setOpen = setControlledOpen ?? setIsUncontrolledOpen;\n\n const data = useFloating({\n middleware: [\n offset(5),\n flip({\n crossAxis: placement.includes('-'),\n fallbackAxisSideDirection: 'start',\n padding: 5,\n }),\n shift({ padding: 5 }),\n ],\n onOpenChange: setOpen,\n open: isOpen,\n placement,\n strategy,\n whileElementsMounted(referenceEl, floatingEl, update) {\n const cleanup = autoUpdate(referenceEl, floatingEl, update, {\n ...autoUpdateOptions,\n });\n return cleanup;\n },\n });\n\n const context = data.context;\n\n const hover = useHover(context, {\n delay: hoverDelay,\n enabled: type === 'simple' && !isDisabled,\n handleClose: safePolygon(),\n move: false,\n });\n const click = useClick(context, {\n enabled: type === 'rich' && !isDisabled,\n });\n const focus = useFocus(context, {\n enabled: type === 'simple' && !isDisabled,\n visibleOnly: true,\n });\n const dismiss = useDismiss(context, {\n escapeKey: true,\n outsidePress: true,\n referencePress: shouldCloseOnReferenceClick,\n });\n const role = useRole(context, {\n role: type === 'simple' ? 'tooltip' : 'dialog',\n });\n const followAxis =\n placement.startsWith('left') || placement.startsWith('right') ? 'y' : 'x';\n const clientPoint = useClientPoint(context, {\n axis: followAxis,\n enabled: followCursor && type === 'simple' && !isDisabled,\n });\n\n const interactions = useInteractions([\n hover,\n focus,\n dismiss,\n role,\n click,\n clientPoint,\n ]);\n\n return useMemo(\n () => ({\n headerId: type === 'rich' ? headerId : undefined,\n isOpen,\n isPortaled,\n setHeaderId: type === 'rich' ? setHeaderId : undefined,\n setOpen,\n type,\n ...interactions,\n ...data,\n }),\n [headerId, isOpen, isPortaled, setOpen, type, interactions, data],\n );\n}\n\ntype ContextType = ReturnType<typeof useTooltip> | null;\n\nexport const TooltipContext = createContext<ContextType>(null);\n\nexport const useTooltipContext = (): ReturnType<typeof useTooltip> => {\n const context = useContext(TooltipContext);\n\n if (context === null) {\n throw new Error('Tooltip components must be wrapped in <Tooltip />');\n }\n\n return context;\n};\n"]}
@@ -0,0 +1,33 @@
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
+ import type { RgbColor } from '@uiw/react-color';
22
+ /**
23
+ * Computes a linear interpolation weight in [0, 1] for `value` between
24
+ * `startValue` and `endValue`. Values outside the range produce weights
25
+ * outside [0, 1] — callers are responsible for clamping if needed.
26
+ */
27
+ export declare function getWeight(startValue: number, endValue: number, value: number): number;
28
+ /**
29
+ * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).
30
+ * Each channel is rounded to the nearest integer.
31
+ */
32
+ export declare function lerpColor(startColor: RgbColor, endColor: RgbColor, weight: number): RgbColor;
33
+ //# sourceMappingURL=color-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,QAAQ,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GACb,QAAQ,CAMV"}
@@ -0,0 +1,54 @@
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
+ /**
23
+ * Parses an ISO 8601 time string to UTC milliseconds since midnight
24
+ * (0–86,399,999). Returns `null` if the string cannot be parsed.
25
+ *
26
+ * Three formats are accepted:
27
+ * 1. Local time (no offset): `"14:30:00"`, `"14:30:00.500"` — treated as UTC
28
+ * 2. UTC time with Z suffix: `"14:30:00Z"` — treated identically to the local form
29
+ * 3. Offset time: `"14:30:00+02:00"` — the offset is applied so the result
30
+ * is the equivalent UTC time of day. `"12:00:00+01:00"` resolves to
31
+ * 39,600,000 (11:00 UTC), which is less than `"12:00:00+00:00"` (43,200,000).
32
+ *
33
+ * Values wrap around midnight: `"00:00:00+01:00"` → 82,800,000 (23:00 UTC).
34
+ */
35
+ export declare function parseTimeString(s: string): number | null;
36
+ /**
37
+ * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond
38
+ * timestamp. Returns `null` if the string cannot be parsed.
39
+ *
40
+ * Three formats are tried in order:
41
+ * 1. RFC 9557 ZonedDateTime with IANA bracket notation
42
+ * e.g. `"2024-06-15T14:00:00[Europe/Stockholm]"` (offset inferred from the
43
+ * named timezone, including DST) or `"2024-06-15T14:00:00+02:00[Europe/Stockholm]"`
44
+ * (offset explicit; bracket must agree with the IANA zone)
45
+ * 2. UTC or fixed-offset Instant
46
+ * e.g. `"2024-01-01T00:00:00Z"`, `"2024-01-01T00:00:00+02:00"`
47
+ * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC
48
+ * e.g. `"2024-01-01"`, `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
49
+ *
50
+ * Strings with a time component that lack `Z`, an offset, or an IANA bracket are
51
+ * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).
52
+ */
53
+ export declare function parseDateString(s: string): number | null;
54
+ //# sourceMappingURL=date-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAoDA;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyCxD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0BxD"}
@@ -0,0 +1,25 @@
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
+ export { getWeight, lerpColor } from './color-utils';
22
+ export { parseDateString, parseTimeString } from './date-utils';
23
+ export { DatetimeLiteralSchema, TimeLiteralSchema } from './literal-schemas';
24
+ export type { DatetimeLiteral, TimeLiteral } from './literal-schemas';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,53 @@
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
+ import { z } from 'zod';
22
+ /**
23
+ * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond
24
+ * timestamp at evaluation time. Supported formats:
25
+ * - RFC 9557 with IANA timezone: `"2024-06-15T14:00:00[Europe/Stockholm]"` (offset
26
+ * inferred from the named zone, DST-aware) or `"2024-06-15T14:00:00+02:00[Europe/Stockholm]"`
27
+ * (offset explicit)
28
+ * - UTC or offset datetime: `"2024-01-01T00:00:00Z"`, `"2024-01-01T00:00:00+02:00"`
29
+ * - Plain datetime (treated as UTC): `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
30
+ * - Date-only (treated as UTC midnight): `"2024-01-01"`
31
+ */
32
+ export declare const DatetimeLiteralSchema: z.ZodObject<{
33
+ datetime: z.ZodString;
34
+ }, z.core.$strip>;
35
+ export type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;
36
+ /**
37
+ * An ISO 8601 time literal that resolves to milliseconds since UTC midnight
38
+ * at evaluation time. Supported formats:
39
+ * - Local time (treated as UTC): `"14:30:00"`, `"14:30:00.500"`
40
+ * - UTC time: `"14:30:00Z"` — identical to local form
41
+ * - Offset time (UTC-normalised): `"14:30:00+02:00"` → 45,000,000 ms (12:30 UTC)
42
+ *
43
+ * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a
44
+ * time-of-day value has no calendar date so DST cannot be resolved. Use
45
+ * `{ datetime }` literals for timezone-aware instants.
46
+ *
47
+ * Full datetime strings (containing `T`) are rejected.
48
+ */
49
+ export declare const TimeLiteralSchema: z.ZodObject<{
50
+ time: z.ZodString;
51
+ }, z.core.$strip>;
52
+ export type TimeLiteral = z.infer<typeof TimeLiteralSchema>;
53
+ //# sourceMappingURL=literal-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"literal-schemas.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;;iBAKhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;;iBAK5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -22,7 +22,7 @@ import { type RowData, type Table as DataGridType } from '@tanstack/react-table'
22
22
  import { type CommonProps, type HtmlAttributes } from '../_common/types';
23
23
  import { type Skeleton } from '../skeleton';
24
24
  import { type DataGridComponentsInterface } from './data-grid-context';
25
- import { type DataGridStyleRule } from './style-rules/types';
25
+ import { type DataGridStyleRule, type DataGridStyleRuleValueConverters } from './style-rules/types';
26
26
  declare enum BorderStyleEnum {
27
27
  AllSides = "all-sides",
28
28
  Horizontal = "horizontal",
@@ -85,9 +85,11 @@ export type DataGridProps<T extends RowData> = {
85
85
  portalTarget?: HTMLElement | null;
86
86
  /** Rule-based conditional styling for cells and rows. */
87
87
  styleRules?: DataGridStyleRule[];
88
+ /** Per-column converters that teach the style-rule engine how to interpret complex cell values. */
89
+ styleRuleValueConverters?: DataGridStyleRuleValueConverters;
88
90
  ref?: React.Ref<HTMLDivElement>;
89
91
  };
90
- declare const DataGrid: (<T extends RowData = unknown>({ isResizable, isLoading, isKeyboardNavigable, isAutoResizingColumns, tableInstance, components, rootProps, styling, tableNavRef, isSkeletonLoading, skeletonProps, ref, portalTarget, styleRules, htmlAttributes, className, style, ...restProps }: CommonProps<"div", DataGridProps<T>>) => import("react/jsx-runtime").JSX.Element) & {
92
+ declare const DataGrid: (<T extends RowData = unknown>({ isResizable, isLoading, isKeyboardNavigable, isAutoResizingColumns, tableInstance, components, rootProps, styling, tableNavRef, isSkeletonLoading, skeletonProps, ref, portalTarget, styleRules, styleRuleValueConverters, htmlAttributes, className, style, ...restProps }: CommonProps<"div", DataGridProps<T>>) => import("react/jsx-runtime").JSX.Element) & {
91
93
  ActionButton: <T extends React.ElementType = "button">({ action, onClose, as, className, style, htmlAttributes, ref, ...restProps }: import("../_common/types").PolymorphicCommonProps<T, {
92
94
  action: import("./datagrid-types").ColumnAction;
93
95
  onClose: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,IAAI,YAAY,EAC3B,MAAM,uBAAuB,CAAC;AAU/B,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AA2B5C,OAAO,EACL,KAAK,2BAA2B,EAGjC,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,aAAK,eAAe;IAClB,QAAQ,cAAc;IACtB,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED,MAAM,MAAM,WAAW,GAAG,GAAG,eAAe,EAAE,CAAC;AAE/C,aAAK,eAAe;IAClB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,GAAG,eAAe,EAAE,CAAC;AAE/C,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,OAAO,IAAI;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;QAChB,6CAA6C;QAC7C,gBAAgB,EAAE,OAAO,CAAC;QAC1B,uCAAuC;QACvC,WAAW,EAAE,WAAW,CAAC;QACzB,yDAAyD;QACzD,WAAW,EAAE,WAAW,CAAC;QACzB,6EAA6E;QAC7E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C,EAAE,OAAO,CAAC;IAChC;;;OAGG;IAEH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnC,4CAA4C;IAC5C,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAC/B,oCAAoC;IACpC,UAAU,CAAC,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC;IAC5C,sFAAsF;IACtF,SAAS,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAC;IACtD;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC,yDAAyD;IACzD,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACjC,mGAAmG;IACnG,wBAAwB,CAAC,EAAE,gCAAgC,CAAC;IAC5D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC,CAAC;AA8NF,QAAA,MAAM,QAAQ,IApN8B,CAAC,SAAS,OAAO,2RAoB1D,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgM8B,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -22,7 +22,7 @@ import { type RowData, type Table as DataGridType } from '@tanstack/react-table'
22
22
  import { type Skeleton } from '../skeleton';
23
23
  import { type ActionButton, type ActionCell, type Body, type BodyCell, type BodyRow, type ColumnControls, type Header, type HeaderCell, type HeaderTitle, type LoadingPlaceholder, type Navigation, type NoDataPlaceholder, type Pagination, type PaginationArrowButton, type PaginationNumericButton, type PaginationNumericButtons, type ResizingBar, type RowsPerPage, type Scrollable, type TableResults } from './Components';
24
24
  import { type DataGridNav } from './data-grid-nav/data-grid-nav';
25
- import { type DataGridStyleRule } from './style-rules/types';
25
+ import { type DataGridStyleRule, type DataGridStyleRuleValueConverters } from './style-rules/types';
26
26
  type Nullable<T> = T | null;
27
27
  export interface DataGridComponentsInterface<T extends RowData> {
28
28
  ResizingBar?: Nullable<typeof ResizingBar<T>>;
@@ -69,6 +69,7 @@ export interface DataGridContextType<T extends RowData> {
69
69
  isMediumNavigation: boolean;
70
70
  isSmallNavigation: boolean;
71
71
  styleRules?: DataGridStyleRule[];
72
+ styleRuleValueConverters?: DataGridStyleRuleValueConverters;
72
73
  }
73
74
  export declare const DataGridContext: import("react").Context<DataGridContextType<any>>;
74
75
  export declare function useDataGridContext<T extends RowData>(): DataGridContextType<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid-context.d.ts","sourceRoot":"","sources":["../../../src/data-grid/data-grid-context.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,IAAI,YAAY,EAC3B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,+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