@mongodb-js/compass-components 1.68.0 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/components/bson-value.d.ts +23 -12
  2. package/dist/components/bson-value.d.ts.map +1 -1
  3. package/dist/components/bson-value.js +43 -63
  4. package/dist/components/compass-components-provider.d.ts +6 -8
  5. package/dist/components/compass-components-provider.d.ts.map +1 -1
  6. package/dist/components/compass-components-provider.js +5 -5
  7. package/dist/components/context-menu.d.ts +1 -2
  8. package/dist/components/context-menu.d.ts.map +1 -1
  9. package/dist/components/context-menu.js +5 -2
  10. package/dist/components/document-list/bson-display-options-context.d.ts +13 -0
  11. package/dist/components/document-list/bson-display-options-context.d.ts.map +1 -0
  12. package/dist/components/document-list/bson-display-options-context.js +56 -0
  13. package/dist/components/document-list/bson-utils.d.ts +10 -0
  14. package/dist/components/document-list/bson-utils.d.ts.map +1 -0
  15. package/dist/components/document-list/bson-utils.js +63 -0
  16. package/dist/components/document-list/date-time-picker.d.ts +6 -0
  17. package/dist/components/document-list/date-time-picker.d.ts.map +1 -0
  18. package/dist/components/document-list/date-time-picker.js +112 -0
  19. package/dist/components/document-list/date-with-timezone-hint.d.ts +11 -0
  20. package/dist/components/document-list/date-with-timezone-hint.d.ts.map +1 -0
  21. package/dist/components/document-list/date-with-timezone-hint.js +95 -0
  22. package/dist/components/document-list/document-edit-actions-footer.d.ts +1 -0
  23. package/dist/components/document-list/document-edit-actions-footer.d.ts.map +1 -1
  24. package/dist/components/document-list/document-edit-actions-footer.js +2 -5
  25. package/dist/components/document-list/document.d.ts.map +1 -1
  26. package/dist/components/document-list/document.js +8 -0
  27. package/dist/components/document-list/editors/date-editor.d.ts +4 -0
  28. package/dist/components/document-list/editors/date-editor.d.ts.map +1 -0
  29. package/dist/components/document-list/editors/date-editor.js +135 -0
  30. package/dist/components/document-list/editors/default-editor.d.ts +4 -0
  31. package/dist/components/document-list/editors/default-editor.d.ts.map +1 -0
  32. package/dist/components/document-list/editors/default-editor.js +46 -0
  33. package/dist/components/document-list/editors/editor-with-label.d.ts +7 -0
  34. package/dist/components/document-list/editors/editor-with-label.d.ts.map +1 -0
  35. package/dist/components/document-list/editors/editor-with-label.js +28 -0
  36. package/dist/components/document-list/editors/input-editor.d.ts +4 -0
  37. package/dist/components/document-list/editors/input-editor.d.ts.map +1 -0
  38. package/dist/components/document-list/editors/input-editor.js +24 -0
  39. package/dist/components/document-list/editors/shared.d.ts +16 -0
  40. package/dist/components/document-list/editors/shared.d.ts.map +1 -0
  41. package/dist/components/document-list/editors/shared.js +34 -0
  42. package/dist/components/document-list/editors/text-editor.d.ts +4 -0
  43. package/dist/components/document-list/editors/text-editor.d.ts.map +1 -0
  44. package/dist/components/document-list/editors/text-editor.js +85 -0
  45. package/dist/components/document-list/editors/uuid-editor.d.ts +4 -0
  46. package/dist/components/document-list/editors/uuid-editor.d.ts.map +1 -0
  47. package/dist/components/document-list/editors/uuid-editor.js +54 -0
  48. package/dist/components/document-list/element-editors.d.ts +1 -1
  49. package/dist/components/document-list/element-editors.d.ts.map +1 -1
  50. package/dist/components/document-list/element-editors.js +56 -135
  51. package/dist/components/document-list/element.d.ts.map +1 -1
  52. package/dist/components/document-list/element.js +86 -39
  53. package/dist/components/document-list/index.d.ts +1 -1
  54. package/dist/components/document-list/index.d.ts.map +1 -1
  55. package/dist/components/document-list/index.js +4 -3
  56. package/dist/components/document-list/visible-field-toggle.d.ts.map +1 -1
  57. package/dist/components/document-list/visible-field-toggle.js +2 -0
  58. package/dist/components/drawer-portal.d.ts +4 -2
  59. package/dist/components/drawer-portal.d.ts.map +1 -1
  60. package/dist/components/error-boundary.d.ts +1 -0
  61. package/dist/components/error-boundary.d.ts.map +1 -1
  62. package/dist/components/file-picker-dialog.d.ts +1 -0
  63. package/dist/components/file-picker-dialog.d.ts.map +1 -1
  64. package/dist/components/guide-cue/guide-cue.d.ts +2 -1
  65. package/dist/components/guide-cue/guide-cue.d.ts.map +1 -1
  66. package/dist/components/guide-cue/guide-cue.js +10 -0
  67. package/dist/components/inline-definition.js +2 -2
  68. package/dist/components/leafygreen.d.ts +1 -35
  69. package/dist/components/leafygreen.d.ts.map +1 -1
  70. package/dist/components/links/link.d.ts +1 -1
  71. package/dist/components/links/link.d.ts.map +1 -1
  72. package/dist/components/modals/form-modal.d.ts +2 -1
  73. package/dist/components/modals/form-modal.d.ts.map +1 -1
  74. package/dist/components/modals/form-modal.js +2 -2
  75. package/dist/components/modals/modal-body.d.ts.map +1 -1
  76. package/dist/components/modals/modal-body.js +7 -0
  77. package/dist/components/resize-handle.d.ts.map +1 -1
  78. package/dist/components/resize-handle.js +5 -8
  79. package/dist/components/select-list.d.ts.map +1 -1
  80. package/dist/components/select-list.js +2 -2
  81. package/dist/components/signal-popover.d.ts +1 -1
  82. package/dist/components/signal-popover.d.ts.map +1 -1
  83. package/dist/components/signal-popover.js +2 -1
  84. package/dist/components/workspace-container.d.ts +2 -2
  85. package/dist/components/workspace-container.d.ts.map +1 -1
  86. package/dist/components/workspace-tabs/workspace-tabs.d.ts.map +1 -1
  87. package/dist/components/workspace-tabs/workspace-tabs.js +1 -1
  88. package/dist/hooks/use-confirmation.d.ts +3 -1
  89. package/dist/hooks/use-confirmation.d.ts.map +1 -1
  90. package/dist/hooks/use-confirmation.js +2 -2
  91. package/dist/hooks/use-copy-paste-context-menu.d.ts +1 -1
  92. package/dist/hooks/use-copy-paste-context-menu.d.ts.map +1 -1
  93. package/dist/hooks/use-stacked-component.d.ts.map +1 -1
  94. package/dist/hooks/use-theme.d.ts.map +1 -1
  95. package/dist/hooks/use-toast.d.ts +3 -1
  96. package/dist/hooks/use-toast.d.ts.map +1 -1
  97. package/dist/index.d.ts +1 -0
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +6 -4
  100. package/dist/utils/format-date.d.ts +17 -0
  101. package/dist/utils/format-date.d.ts.map +1 -1
  102. package/dist/utils/format-date.js +33 -2
  103. package/package.json +17 -17
  104. package/dist/components/document-list/legacy-uuid-format-context.d.ts +0 -4
  105. package/dist/components/document-list/legacy-uuid-format-context.d.ts.map +0 -1
  106. package/dist/components/document-list/legacy-uuid-format-context.js +0 -9
@@ -1,20 +1,31 @@
1
1
  import React from 'react';
2
2
  import type { TypeCastMap } from 'hadron-type-checker';
3
3
  import type { DBRef } from 'bson';
4
- type ValueProps = {
5
- [type in keyof TypeCastMap]: {
6
- type: type;
7
- value: TypeCastMap[type];
8
- };
9
- }[keyof TypeCastMap] | {
10
- type: 'DBRef';
11
- value: DBRef;
4
+ type ValueTypeMap = TypeCastMap & {
5
+ DBRef: DBRef;
12
6
  };
13
- type ValueTypes = ValueProps['type'];
14
- export declare const BSONValueContainer: React.FunctionComponent<React.HTMLProps<HTMLDivElement> & {
7
+ type ValueTypes = keyof ValueTypeMap;
8
+ /**
9
+ * ValueProps external interface is meant to provide a correlation between type
10
+ * and the type of value.
11
+ *
12
+ * So `T` is used to capture the type name and pick the corresponding type
13
+ * out of ValueTypeMap.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * function x<T extends ValueTypes>(props: ValueProps<T>) {}
18
+ * x({ type: 'String', value: 'example' });
19
+ * x({ type: 'Decimal128', value: 'test' }); // Error
20
+ * ```
21
+ */
22
+ type ValueProps<T extends ValueTypes = ValueTypes> = {
23
+ type: T;
24
+ value: ValueTypeMap[T];
25
+ };
26
+ export declare const BSONValueContainer: React.FunctionComponent<React.HTMLProps<HTMLSpanElement> & {
15
27
  type?: ValueTypes;
16
- chidren?: React.ReactChildren;
17
28
  }>;
18
- declare const BSONValue: React.FunctionComponent<ValueProps>;
29
+ declare function BSONValue<T extends ValueTypes>(genericProps: ValueProps<T>): React.JSX.Element;
19
30
  export default BSONValue;
20
31
  //# sourceMappingURL=bson-value.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bson-value.d.ts","sourceRoot":"","sources":["../../src/components/bson-value.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,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AC,CAAC,CAAC,CAAC;CACxB,CAAC;AAgDF,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CACtD,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG;IACjC,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAoBF,CAAC;AAqbF,iBAAS,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,qBAqDnE;AAED,eAAe,SAAS,CAAC"}
@@ -38,60 +38,42 @@ const react_1 = __importStar(require("react"));
38
38
  const hadron_type_checker_1 = require("hadron-type-checker");
39
39
  const bson_1 = require("bson");
40
40
  const mongodb_query_parser_1 = require("mongodb-query-parser");
41
- const code_1 = require("@leafygreen-ui/code");
42
41
  const leafygreen_1 = require("./leafygreen");
43
42
  const tokens_1 = require("@leafygreen-ui/tokens");
44
43
  const emotion_1 = require("@leafygreen-ui/emotion");
45
- const use_theme_1 = require("../hooks/use-theme");
46
- const legacy_uuid_format_context_1 = require("./document-list/legacy-uuid-format-context");
44
+ const bson_utils_1 = require("./document-list/bson-utils");
45
+ const bson_display_options_context_1 = require("./document-list/bson-display-options-context");
46
+ const date_with_timezone_hint_1 = require("./document-list/date-with-timezone-hint");
47
47
  function truncate(str, length = 70) {
48
48
  const truncated = str.slice(0, length);
49
49
  return length < str.length ? `${truncated}…` : str;
50
50
  }
51
- const VALUE_COLOR_BY_THEME_AND_TYPE = {
52
- [use_theme_1.Themes.Dark]: {
53
- Int32: code_1.variantColors.dark[9],
54
- Double: code_1.variantColors.dark[9],
55
- Decimal128: code_1.variantColors.dark[9],
56
- Date: code_1.variantColors.dark[9],
57
- Boolean: code_1.variantColors.dark[10],
58
- String: code_1.variantColors.dark[7],
59
- ObjectId: code_1.variantColors.dark[5],
60
- },
61
- [use_theme_1.Themes.Light]: {
62
- Int32: code_1.variantColors.light[9],
63
- Double: code_1.variantColors.light[9],
64
- Decimal128: code_1.variantColors.light[9],
65
- Date: code_1.variantColors.light[9],
66
- Boolean: code_1.variantColors.light[10],
67
- String: code_1.variantColors.light[7],
68
- ObjectId: code_1.variantColors.light[5],
69
- },
70
- };
51
+ function truncateLines(str, lines = 3) {
52
+ let index = -1;
53
+ for (let i = 0; i < lines; i++) {
54
+ const next = str.indexOf('\n', index + 1);
55
+ if (next === -1)
56
+ return str;
57
+ index = next;
58
+ }
59
+ return `${str.slice(0, index)}…`;
60
+ }
71
61
  const bsonValue = (0, emotion_1.css)({
62
+ display: `var(${bson_utils_1.bsonValueDisplayVar}, block)`,
72
63
  whiteSpace: 'nowrap',
73
64
  overflow: 'hidden',
74
65
  textOverflow: 'ellipsis',
75
66
  });
76
67
  const bsonValuePrewrap = (0, emotion_1.css)({
77
- whiteSpace: 'pre-wrap',
68
+ whiteSpace: 'pre',
78
69
  });
70
+ // A span so that it stays valid markup whatever `bsonValueDisplayVar` resolves
71
+ // the display to, including inside the inline document list layout.
79
72
  const BSONValueContainer = ({ type, children, className, ...props }) => {
80
- const darkMode = (0, use_theme_1.useDarkMode)();
81
- const colorStyle = (0, react_1.useMemo)(() => {
82
- if (!type) {
83
- return;
84
- }
85
- return {
86
- color: VALUE_COLOR_BY_THEME_AND_TYPE[darkMode ? use_theme_1.Themes.Dark : use_theme_1.Themes.Light][type],
87
- };
88
- }, [type, darkMode]);
89
- return (react_1.default.createElement("div", { ...props, className: (0, emotion_1.cx)(className, bsonValue, type === 'String' && bsonValuePrewrap, `element-value element-value-is-${type ? type.toLowerCase() : 'unknown'}`), style: colorStyle }, children));
73
+ const bsonStyles = (0, bson_utils_1.useBsonThemeStyles)(type);
74
+ return (react_1.default.createElement("span", { ...props, className: (0, emotion_1.cx)(className, bsonValue, type === 'String' && bsonValuePrewrap, `element-value element-value-is-${type ? type.toLowerCase() : 'unknown'}`), style: bsonStyles }, children));
90
75
  };
91
76
  exports.BSONValueContainer = BSONValueContainer;
92
- const nonSelectable = (0, emotion_1.css)({
93
- userSelect: 'none',
94
- });
95
77
  const encryptedHelpLinkStyle = (0, emotion_1.css)({
96
78
  color: 'inherit',
97
79
  marginLeft: tokens_1.spacing[100],
@@ -100,28 +82,25 @@ const ObjectIdValue = ({ value, }) => {
100
82
  const stringifiedValue = (0, react_1.useMemo)(() => {
101
83
  return String(value);
102
84
  }, [value]);
103
- return (react_1.default.createElement(exports.BSONValueContainer, { type: "ObjectId", title: stringifiedValue },
104
- react_1.default.createElement("span", { className: nonSelectable }, "ObjectId('"),
105
- stringifiedValue,
106
- react_1.default.createElement("span", { className: nonSelectable }, "')")));
85
+ return (react_1.default.createElement(exports.BSONValueContainer, { type: "ObjectId", title: stringifiedValue }, (0, bson_utils_1.wrapValueWithBsonLabel)('ObjectId', stringifiedValue)));
107
86
  };
108
87
  const toLegacyJavaUUID = ({ value }) => {
109
88
  const hex = value.toString('hex');
110
89
  const reversedHex = (0, hadron_type_checker_1.reverseJavaUUIDBytes)(hex);
111
- return "LegacyJavaUUID('" + (0, hadron_type_checker_1.uuidHexToString)(reversedHex) + "')";
90
+ return (0, bson_utils_1.wrapValueWithBsonLabel)('LegacyJavaUUID', (0, hadron_type_checker_1.uuidHexToString)(reversedHex));
112
91
  };
113
92
  const toLegacyCSharpUUID = ({ value }) => {
114
93
  const hex = value.toString('hex');
115
94
  const reversedHex = (0, hadron_type_checker_1.reverseCSharpUUIDBytes)(hex);
116
- return "LegacyCSharpUUID('" + (0, hadron_type_checker_1.uuidHexToString)(reversedHex) + "')";
95
+ return (0, bson_utils_1.wrapValueWithBsonLabel)('LegacyCSharpUUID', (0, hadron_type_checker_1.uuidHexToString)(reversedHex));
117
96
  };
118
97
  const toLegacyPythonUUID = ({ value }) => {
119
98
  const hex = value.toString('hex');
120
- return "LegacyPythonUUID('" + (0, hadron_type_checker_1.uuidHexToString)(hex) + "')";
99
+ return (0, bson_utils_1.wrapValueWithBsonLabel)('LegacyPythonUUID', (0, hadron_type_checker_1.uuidHexToString)(hex));
121
100
  };
122
101
  // Binary sub_type 3.
123
102
  const LegacyUUIDValue = (bsonValue) => {
124
- const legacyUUIDDisplayEncoding = (0, legacy_uuid_format_context_1.useLegacyUUIDDisplayContext)();
103
+ const { legacyUUIDDisplayEncoding } = (0, bson_display_options_context_1.useBSONDisplayOptions)();
125
104
  const stringifiedValue = (0, react_1.useMemo)(() => {
126
105
  // UUID must be exactly 16 bytes.
127
106
  if (bsonValue.value.buffer.length === 16) {
@@ -167,17 +146,14 @@ const UUIDValue = ({ value, }) => {
167
146
  return value.toString('hex');
168
147
  }
169
148
  }, [value]);
170
- return (react_1.default.createElement(exports.BSONValueContainer, { type: "Binary", title: stringifiedValue },
171
- react_1.default.createElement("span", { className: nonSelectable }, "UUID('"),
172
- stringifiedValue,
173
- react_1.default.createElement("span", { className: nonSelectable }, "')")));
149
+ return (react_1.default.createElement(exports.BSONValueContainer, { type: "Binary", title: stringifiedValue }, (0, bson_utils_1.wrapValueWithBsonLabel)('UUID', stringifiedValue)));
174
150
  };
175
151
  // Legacy Java UUID value component
176
152
  const LegacyJavaUUIDValue = ({ value }) => {
177
153
  const stringifiedValue = (0, react_1.useMemo)(() => {
178
154
  // During editing, value might be a string
179
155
  if (typeof value === 'string') {
180
- return `LegacyJavaUUID('${value}')`;
156
+ return (0, bson_utils_1.wrapValueWithBsonLabel)('LegacyJavaUUID', value);
181
157
  }
182
158
  if (!value || !value.buffer) {
183
159
  return String(value);
@@ -191,7 +167,7 @@ const LegacyCSharpUUIDValue = ({ value }) => {
191
167
  const stringifiedValue = (0, react_1.useMemo)(() => {
192
168
  // During editing, value might be a string
193
169
  if (typeof value === 'string') {
194
- return `LegacyCSharpUUID('${value}')`;
170
+ return (0, bson_utils_1.wrapValueWithBsonLabel)('LegacyCSharpUUID', value);
195
171
  }
196
172
  if (!value || !value.buffer) {
197
173
  return String(value);
@@ -205,7 +181,7 @@ const LegacyPythonUUIDValue = ({ value }) => {
205
181
  const stringifiedValue = (0, react_1.useMemo)(() => {
206
182
  // During editing, value might be a string
207
183
  if (typeof value === 'string') {
208
- return `LegacyPythonUUID('${value}')`;
184
+ return (0, bson_utils_1.wrapValueWithBsonLabel)('LegacyPythonUUID', value);
209
185
  }
210
186
  if (!value || !value.buffer) {
211
187
  return String(value);
@@ -285,19 +261,20 @@ const DateValue = ({ value, }) => {
285
261
  return String(value);
286
262
  }
287
263
  }, [value]);
288
- return (react_1.default.createElement(exports.BSONValueContainer, { type: "Date", title: stringifiedValue }, stringifiedValue));
264
+ return (react_1.default.createElement(date_with_timezone_hint_1.DateWithTimezoneHint, { value: value },
265
+ react_1.default.createElement(exports.BSONValueContainer, { type: "Date", title: stringifiedValue }, (0, bson_utils_1.wrapValueWithBsonLabel)('Date', stringifiedValue))));
289
266
  };
290
267
  const NumberValue = ({ type, value }) => {
291
268
  const stringifiedValue = (0, react_1.useMemo)(() => {
292
- return String(value.valueOf());
293
- }, [value]);
269
+ return (0, bson_utils_1.wrapValueWithBsonLabel)(type, String(value));
270
+ }, [value, type]);
294
271
  return (react_1.default.createElement(exports.BSONValueContainer, { type: type, title: stringifiedValue }, stringifiedValue));
295
272
  };
296
273
  const StringValue = ({ value, }) => {
297
274
  const truncatedValue = (0, react_1.useMemo)(() => {
298
- return truncate(value, 70);
275
+ return truncateLines(truncate(value, 1000));
299
276
  }, [value]);
300
- return (react_1.default.createElement(exports.BSONValueContainer, { type: "String", title: value },
277
+ return (react_1.default.createElement(exports.BSONValueContainer, { type: "String", title: truncatedValue },
301
278
  "\"",
302
279
  truncatedValue,
303
280
  "\""));
@@ -322,8 +299,8 @@ const KeyValue = ({ type }) => {
322
299
  };
323
300
  const DBRefValue = ({ value, }) => {
324
301
  const stringifiedValue = (0, react_1.useMemo)(() => {
325
- return `DBRef('${value.collection}', ${(0, mongodb_query_parser_1.stringify)(value.oid)}${value?.db ? `, '${value.db}'` : ''})`;
326
- }, [value.collection, value.oid, value.db]);
302
+ return (0, mongodb_query_parser_1.toJSString)(value, 0);
303
+ }, [value]);
327
304
  return (react_1.default.createElement(exports.BSONValueContainer, { type: "DBRef", title: stringifiedValue }, stringifiedValue));
328
305
  };
329
306
  const SymbolValue = ({ value, }) => {
@@ -332,11 +309,11 @@ const SymbolValue = ({ value, }) => {
332
309
  }, [value]);
333
310
  return (react_1.default.createElement(exports.BSONValueContainer, { type: "BSONSymbol", title: stringifiedValue }, stringifiedValue));
334
311
  };
335
- const UnknownValue = ({ value }) => {
312
+ const UnknownValue = ({ value, type }) => {
336
313
  const stringifiedValue = (0, react_1.useMemo)(() => {
337
314
  return String(value);
338
315
  }, [value]);
339
- return (react_1.default.createElement(exports.BSONValueContainer, { title: stringifiedValue }, stringifiedValue));
316
+ return (react_1.default.createElement(exports.BSONValueContainer, { type: type, title: stringifiedValue }, stringifiedValue));
340
317
  };
341
318
  const ArrayValue = ({ value, }) => {
342
319
  const lengthString = (0, react_1.useMemo)(() => {
@@ -355,7 +332,8 @@ const ObjectValue = ({ value, }) => {
355
332
  "Object ",
356
333
  lengthString));
357
334
  };
358
- const BSONValue = (props) => {
335
+ function BSONValue(genericProps) {
336
+ const props = genericProps;
359
337
  switch (props.type) {
360
338
  case 'ObjectId':
361
339
  return react_1.default.createElement(ObjectIdValue, { value: props.value });
@@ -376,6 +354,8 @@ const BSONValue = (props) => {
376
354
  return (react_1.default.createElement(LegacyPythonUUIDValue, { value: props.value }));
377
355
  case 'Int32':
378
356
  case 'Double':
357
+ case 'Int64':
358
+ case 'Decimal128':
379
359
  return react_1.default.createElement(NumberValue, { type: props.type, value: props.value });
380
360
  case 'String':
381
361
  return react_1.default.createElement(StringValue, { value: props.value });
@@ -399,5 +379,5 @@ const BSONValue = (props) => {
399
379
  default:
400
380
  return (react_1.default.createElement(UnknownValue, { type: props.type, value: props.value }));
401
381
  }
402
- };
382
+ }
403
383
  exports.default = BSONValue;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { GuideCueProvider } from './guide-cue/guide-cue';
3
3
  import { SignalHooksProvider } from './signal-popover';
4
4
  import { type ContextMenuItem, type ContextMenuItemGroup } from './context-menu';
5
- import { type LegacyUUIDDisplay } from './document-list/legacy-uuid-format-context';
5
+ import { type BSONDisplayOptions } from './document-list/bson-display-options-context';
6
6
  type GuideCueProviderProps = React.ComponentProps<typeof GuideCueProvider>;
7
7
  type CompassComponentsProviderProps = {
8
8
  /**
@@ -10,7 +10,8 @@ type CompassComponentsProviderProps = {
10
10
  * value will be derived from the system settings
11
11
  */
12
12
  darkMode?: boolean;
13
- legacyUUIDDisplayEncoding?: LegacyUUIDDisplay;
13
+ legacyUUIDDisplayEncoding?: BSONDisplayOptions['legacyUUIDDisplayEncoding'];
14
+ timezone?: BSONDisplayOptions['timezone'];
14
15
  popoverPortalContainer?: HTMLElement;
15
16
  /**
16
17
  * Either React children or a render callback that will get the darkMode
@@ -25,15 +26,12 @@ type CompassComponentsProviderProps = {
25
26
  * zIndex for the stacked elements (modal, toast, popover)
26
27
  */
27
28
  stackedElementsZIndex?: number;
28
- /**
29
- * Set to disable context menus in the application.
30
- */
31
- disableContextMenus?: boolean;
32
29
  /**
33
30
  * Set to disable guide cues in the application
34
31
  */
35
32
  disableGuideCues?: boolean;
36
33
  } & {
34
+ onGuideCueShown?: GuideCueProviderProps['onShow'];
37
35
  onNextGuideGue?: GuideCueProviderProps['onNext'];
38
36
  onNextGuideCueGroup?: GuideCueProviderProps['onNextGroup'];
39
37
  } & {
@@ -50,7 +48,7 @@ type CompassComponentsProviderProps = {
50
48
  } & {
51
49
  onDrawerSectionOpen?: (drawerSectionId: string) => void;
52
50
  onDrawerSectionHide?: (drawerSectionId: string) => void;
53
- } & React.ComponentProps<typeof SignalHooksProvider>;
51
+ } & Omit<React.ComponentProps<typeof SignalHooksProvider>, 'children'>;
54
52
  /**
55
53
  * This component combines most of the existing compass-component providers into
56
54
  * one for the purposes of being reused between compass-main (electron) and
@@ -63,6 +61,6 @@ type CompassComponentsProviderProps = {
63
61
  * whether or not it can be used completely interchangeably between electron and
64
62
  * browser environment.
65
63
  */
66
- export declare const CompassComponentsProvider: ({ darkMode: _darkMode, children, legacyUUIDDisplayEncoding, onNextGuideGue, onNextGuideCueGroup, onContextMenuOpen, onContextMenuItemClick, onDrawerSectionOpen, onDrawerSectionHide, utmSource, utmMedium, stackedElementsZIndex, popoverPortalContainer: _popoverPortalContainer, disableContextMenus, disableGuideCues, ...signalHooksProviderProps }: CompassComponentsProviderProps) => React.JSX.Element;
64
+ export declare const CompassComponentsProvider: ({ darkMode: _darkMode, children, legacyUUIDDisplayEncoding, timezone, onGuideCueShown, onNextGuideGue, onNextGuideCueGroup, onContextMenuOpen, onContextMenuItemClick, onDrawerSectionOpen, onDrawerSectionHide, utmSource, utmMedium, stackedElementsZIndex, popoverPortalContainer: _popoverPortalContainer, disableGuideCues, ...signalHooksProviderProps }: CompassComponentsProviderProps) => React.JSX.Element;
67
65
  export {};
68
66
  //# sourceMappingURL=compass-components-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compass-components-provider.d.ts","sourceRoot":"","sources":["../../src/components/compass-components-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAI5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAE1B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,4CAA4C,CAAC;AAEpD,KAAK,qBAAqB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E,KAAK,8BAA8B,GAAG;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB,CAAC,EAAE,iBAAiB,CAAC;IAC9C,sBAAsB,CAAC,EAAE,WAAW,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,EACL,KAAK,CAAC,SAAS,GACf,CAAC,CAAC,EACA,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,OAAO,CAAC;QAClB,kBAAkB,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC3C,kBAAkB,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;KAC5C,KAAK,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACrC;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GAAG;IACF,cAAc,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACjD,mBAAmB,CAAC,EAAE,qBAAqB,CAAC,aAAa,CAAC,CAAC;CAC5D,GAAG;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,IAAI,CAAC;IACjE;;OAEG;IACH,sBAAsB,CAAC,EAAE,CACvB,SAAS,EAAE,oBAAoB,EAC/B,IAAI,EAAE,eAAe,KAClB,IAAI,CAAC;CACX,GAAG;IACF,mBAAmB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,mBAAmB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAuCrD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,GAAI,0VAiBvC,8BAA8B,sBAqEhC,CAAC"}
1
+ {"version":3,"file":"compass-components-provider.d.ts","sourceRoot":"","sources":["../../src/components/compass-components-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAI5D,OAAO,EAAE,gBAAgB,EAAE,MA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AAC,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,IAAI,CAAC;IACjE;;OAEG;IACH,sBAAsB,CAAC,EAAE,CACvB,SAAS,EAAE,oBAAoB,EAC/B,IAAI,EAAE,eAAe,KAClB,IAAI,CAAC;CACX,GAAG;IACF,mBAAmB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,mBAAmB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,EAAE,UAAU,CAAC,CAAC;AAuCvE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,GAAI,gWAkBvC,8BAA8B,sBAsEhC,CAAC"}
@@ -48,7 +48,7 @@ const use_stacked_component_1 = require("../hooks/use-stacked-component");
48
48
  const context_menu_1 = require("./context-menu");
49
49
  const drawer_portal_1 = require("./drawer-portal");
50
50
  const use_copy_paste_context_menu_1 = require("../hooks/use-copy-paste-context-menu");
51
- const legacy_uuid_format_context_1 = require("./document-list/legacy-uuid-format-context");
51
+ const bson_display_options_context_1 = require("./document-list/bson-display-options-context");
52
52
  const darkModeMediaQuery = (() => {
53
53
  return typeof window !== 'undefined' && window.matchMedia
54
54
  ? window.matchMedia('(prefers-color-scheme: dark)')
@@ -91,7 +91,7 @@ function useDarkMode(_darkMode) {
91
91
  * whether or not it can be used completely interchangeably between electron and
92
92
  * browser environment.
93
93
  */
94
- const CompassComponentsProvider = ({ darkMode: _darkMode, children, legacyUUIDDisplayEncoding, onNextGuideGue, onNextGuideCueGroup, onContextMenuOpen, onContextMenuItemClick, onDrawerSectionOpen, onDrawerSectionHide, utmSource, utmMedium, stackedElementsZIndex, popoverPortalContainer: _popoverPortalContainer, disableContextMenus, disableGuideCues, ...signalHooksProviderProps }) => {
94
+ const CompassComponentsProvider = ({ darkMode: _darkMode, children, legacyUUIDDisplayEncoding, timezone, onGuideCueShown, onNextGuideGue, onNextGuideCueGroup, onContextMenuOpen, onContextMenuItemClick, onDrawerSectionOpen, onDrawerSectionHide, utmSource, utmMedium, stackedElementsZIndex, popoverPortalContainer: _popoverPortalContainer, disableGuideCues, ...signalHooksProviderProps }) => {
95
95
  const darkMode = useDarkMode(_darkMode);
96
96
  // Leafygreen doesn't accept refs for dom elements so we are required to
97
97
  // trigger a state update when the popover ref is resolved. This is very
@@ -104,14 +104,14 @@ const CompassComponentsProvider = ({ darkMode: _darkMode, children, legacyUUIDDi
104
104
  return { portalContainer, scrollContainer };
105
105
  }, [portalContainer, scrollContainer]);
106
106
  return (react_1.default.createElement(leafygreen_provider_1.default, { darkMode: darkMode, popoverPortalContainer: popoverPortalContainer },
107
- react_1.default.createElement(legacy_uuid_format_context_1.LegacyUUIDDisplayContext.Provider, { value: legacyUUIDDisplayEncoding ?? '' },
107
+ react_1.default.createElement(bson_display_options_context_1.BSONDisplayOptionsProvider, { legacyUUIDDisplayEncoding: legacyUUIDDisplayEncoding, timezone: timezone },
108
108
  react_1.default.createElement(drawer_portal_1.DrawerContentProvider, { onDrawerSectionOpen: onDrawerSectionOpen, onDrawerSectionHide: onDrawerSectionHide },
109
109
  react_1.default.createElement(use_stacked_component_1.StackedComponentProvider, { zIndex: stackedElementsZIndex },
110
110
  react_1.default.createElement(link_1.RequiredURLSearchParamsProvider, { utmSource: utmSource, utmMedium: utmMedium },
111
- react_1.default.createElement(guide_cue_1.GuideCueProvider, { onNext: onNextGuideGue, onNextGroup: onNextGuideCueGroup, disabled: disableGuideCues },
111
+ react_1.default.createElement(guide_cue_1.GuideCueProvider, { onShow: onGuideCueShown, onNext: onNextGuideGue, onNextGroup: onNextGuideCueGroup, disabled: disableGuideCues },
112
112
  react_1.default.createElement(signal_popover_1.SignalHooksProvider, { ...signalHooksProviderProps },
113
113
  react_1.default.createElement(use_confirmation_1.ConfirmationModalArea, null,
114
- react_1.default.createElement(context_menu_1.ContextMenuProvider, { disabled: disableContextMenus, onContextMenuOpen: onContextMenuOpen, onContextMenuItemClick: onContextMenuItemClick },
114
+ react_1.default.createElement(context_menu_1.ContextMenuProvider, { onContextMenuOpen: onContextMenuOpen, onContextMenuItemClick: onContextMenuItemClick },
115
115
  react_1.default.createElement(use_copy_paste_context_menu_1.CopyPasteContextMenu, null,
116
116
  react_1.default.createElement(use_toast_1.ToastArea, null, typeof children === 'function'
117
117
  ? children({
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
2
  import { type ContextMenuItem, type ContextMenuItemGroup, type ContextMenuWrapperProps } from '@mongodb-js/compass-context-menu';
3
3
  export type { ContextMenuItem, ContextMenuItemGroup, } from '@mongodb-js/compass-context-menu';
4
- export declare function ContextMenuProvider({ children, disabled, onContextMenuItemClick, onContextMenuOpen, }: {
4
+ export declare function ContextMenuProvider({ children, onContextMenuItemClick, onContextMenuOpen, }: {
5
5
  children: React.ReactNode;
6
- disabled?: boolean;
7
6
  onContextMenuOpen?: (itemGroups: ContextMenuItemGroup[]) => void;
8
7
  onContextMenuItemClick?: (itemGroup: ContextMenuItemGroup, item: ContextMenuItem) => void;
9
8
  }): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../src/components/context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAKhE,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAE7B,MAAM,kCAAkC,CAAC;AAG1C,YAAY,EACV,eAAe,EACf,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAe1C,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,QAAQ,EACR,sBAAsB,EACtB,iBAAiB,GAClB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,oBAAoB,E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AAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,sBAAsB,GACvB,EAAE,uBAAuB,GAAG;IAC3B,sBAAsB,CAAC,EAAE,CACvB,SAAS,EAAE,oBAAoB,EAC/B,IAAI,EAAE,eAAe,KAClB,IAAI,CAAC;CACX,qBAoFA;AAED,+FAA+F;AAC/F,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,CACb,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG;IACrC,KAAK,EAAE,SAAS,GAAG,CAAC,eAAe,GAAG,SAAS,CAAC,EAAE,CAAC;CACpD,CAAC,GACF,SAAS,CACZ,EAAE,EACH,YAAY,GAAE,KAAK,CAAC,cAAmB,GACtC,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CA2BhC"}
@@ -46,14 +46,17 @@ const use_current_value_ref_1 = require("../hooks/use-current-value-ref");
46
46
  const menuStyles = (0, emotion_1.css)({
47
47
  paddingTop: tokens_1.spacing[150],
48
48
  paddingBottom: tokens_1.spacing[150],
49
+ width: 'max-content',
50
+ // LG default width for menu
51
+ minWidth: 210,
49
52
  });
50
53
  const itemStyles = (0, emotion_1.css)({
51
54
  paddingTop: 0,
52
55
  paddingBottom: 0,
53
56
  fontSize: '.8em',
54
57
  });
55
- function ContextMenuProvider({ children, disabled, onContextMenuItemClick, onContextMenuOpen, }) {
56
- return (react_1.default.createElement(compass_context_menu_1.ContextMenuProvider, { disabled: disabled, menuWrapper: (props) => (react_1.default.createElement(ContextMenu, { ...props, onContextMenuItemClick: onContextMenuItemClick })), onContextMenuOpen: onContextMenuOpen }, children));
58
+ function ContextMenuProvider({ children, onContextMenuItemClick, onContextMenuOpen, }) {
59
+ return (react_1.default.createElement(compass_context_menu_1.ContextMenuProvider, { menuWrapper: (props) => (react_1.default.createElement(ContextMenu, { ...props, onContextMenuItemClick: onContextMenuItemClick })), onContextMenuOpen: onContextMenuOpen }, children));
57
60
  }
58
61
  function ContextMenu({ menu, onContextMenuItemClick, }) {
59
62
  const menuRef = (0, react_1.useRef)(null);
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export type LegacyUUIDDisplay = '' | 'LegacyJavaUUID' | 'LegacyCSharpUUID' | 'LegacyPythonUUID';
3
+ export type BSONDisplayOptions = {
4
+ legacyUUIDDisplayEncoding: LegacyUUIDDisplay;
5
+ timezone: string;
6
+ };
7
+ export declare const DEFAULT_BSON_DISPLAY_OPTIONS: BSONDisplayOptions;
8
+ export declare const BSONDisplayOptionsContext: React.Context<BSONDisplayOptions>;
9
+ export declare function useBSONDisplayOptions(): BSONDisplayOptions;
10
+ export declare const BSONDisplayOptionsProvider: React.FunctionComponent<Partial<BSONDisplayOptions> & {
11
+ children?: React.ReactNode;
12
+ }>;
13
+ //# sourceMappingURL=bson-display-options-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bson-display-options-context.d.ts","sourceRoot":"","sources":["../../../src/components/document-list/bson-display-options-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,MAAM,MAAM,iBAAiB,GACzB,EAAE,GACF,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,CAAC;AAEvB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yBAAyB,EAAE,iBAAiB,CAAC;IAC7C,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,kBAG1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,mCAErC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,kBAAkB,CAE1D;AAED,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,iBAAiB,CAC9D,OAAO,CAAC,kBAAkB,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAkB7D,CAAC"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BSONDisplayOptionsProvider = exports.BSONDisplayOptionsContext = exports.DEFAULT_BSON_DISPLAY_OPTIONS = void 0;
37
+ exports.useBSONDisplayOptions = useBSONDisplayOptions;
38
+ const react_1 = __importStar(require("react"));
39
+ exports.DEFAULT_BSON_DISPLAY_OPTIONS = {
40
+ legacyUUIDDisplayEncoding: '',
41
+ timezone: 'UTC',
42
+ };
43
+ exports.BSONDisplayOptionsContext = (0, react_1.createContext)(exports.DEFAULT_BSON_DISPLAY_OPTIONS);
44
+ function useBSONDisplayOptions() {
45
+ return (0, react_1.useContext)(exports.BSONDisplayOptionsContext);
46
+ }
47
+ const BSONDisplayOptionsProvider = ({ legacyUUIDDisplayEncoding = exports.DEFAULT_BSON_DISPLAY_OPTIONS.legacyUUIDDisplayEncoding, timezone = exports.DEFAULT_BSON_DISPLAY_OPTIONS.timezone, children, }) => {
48
+ const value = (0, react_1.useMemo)(() => {
49
+ return {
50
+ legacyUUIDDisplayEncoding,
51
+ timezone,
52
+ };
53
+ }, [legacyUUIDDisplayEncoding, timezone]);
54
+ return (react_1.default.createElement(exports.BSONDisplayOptionsContext.Provider, { value: value }, children));
55
+ };
56
+ exports.BSONDisplayOptionsProvider = BSONDisplayOptionsProvider;
@@ -0,0 +1,10 @@
1
+ import type { TypeCastMap } from 'hadron-type-checker';
2
+ type BSONValueType = keyof TypeCastMap | 'DBRef';
3
+ export declare const bsonValueDisplayVar = "--bson-value-display";
4
+ export declare const BSON_TYPE_LABEL: Partial<Record<keyof TypeCastMap, string>>;
5
+ export declare function wrapValueWithBsonLabel(type: keyof TypeCastMap, value: string): string;
6
+ export declare function useBsonThemeStyles(type?: BSONValueType): {
7
+ color: string | undefined;
8
+ } | undefined;
9
+ export {};
10
+ //# sourceMappingURL=bson-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bson-utils.d.ts","sourceRoot":"","sources":["../../../src/components/document-list/bson-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,KAAK,aAAa,GAAG,MAAM,WAAW,GAAG,OAAO,CAAC;AAGjD,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AA+B1D,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,WAAW,EAAE,MAAM,CAAC,CAS7D,CAAC;AAEX,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,WAAW,EACvB,KAAK,EAAE,MAAM,GACZ,MAAM,CAMR;AAED,wBAAgB,kBAAkB,CAAC,IAAI,CAAC,EAAE,aAAa;;cAatD"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BSON_TYPE_LABEL = exports.bsonValueDisplayVar = void 0;
4
+ exports.wrapValueWithBsonLabel = wrapValueWithBsonLabel;
5
+ exports.useBsonThemeStyles = useBsonThemeStyles;
6
+ const react_1 = require("react");
7
+ const code_1 = require("@leafygreen-ui/code");
8
+ const use_theme_1 = require("../../hooks/use-theme");
9
+ // Set by containers laying values out inline, see `elementContentInline`.
10
+ exports.bsonValueDisplayVar = '--bson-value-display';
11
+ // Colors used to render bson values both in the read-only and the editing
12
+ // state of a document.
13
+ const VALUE_COLOR_BY_THEME_AND_TYPE = {
14
+ [use_theme_1.Themes.Dark]: {
15
+ Int32: code_1.variantColors.dark[9],
16
+ Int64: code_1.variantColors.dark[9],
17
+ Double: code_1.variantColors.dark[9],
18
+ Decimal128: code_1.variantColors.dark[9],
19
+ Date: code_1.variantColors.dark[9],
20
+ Boolean: code_1.variantColors.dark[10],
21
+ String: code_1.variantColors.dark[7],
22
+ ObjectId: code_1.variantColors.dark[5],
23
+ },
24
+ [use_theme_1.Themes.Light]: {
25
+ Int32: code_1.variantColors.light[9],
26
+ Int64: code_1.variantColors.light[9],
27
+ Double: code_1.variantColors.light[9],
28
+ Decimal128: code_1.variantColors.light[9],
29
+ Date: code_1.variantColors.light[9],
30
+ Boolean: code_1.variantColors.light[10],
31
+ String: code_1.variantColors.light[7],
32
+ ObjectId: code_1.variantColors.light[5],
33
+ },
34
+ };
35
+ // This is the list of bson types to map to their corresponding label on the UI.
36
+ exports.BSON_TYPE_LABEL = {
37
+ Int64: 'Long',
38
+ Decimal128: 'Decimal128',
39
+ ObjectId: 'ObjectId',
40
+ Date: 'ISODate',
41
+ UUID: 'UUID',
42
+ LegacyJavaUUID: 'LegacyJavaUUID',
43
+ LegacyCSharpUUID: 'LegacyCSharpUUID',
44
+ LegacyPythonUUID: 'LegacyPythonUUID',
45
+ };
46
+ function wrapValueWithBsonLabel(type, value) {
47
+ const label = exports.BSON_TYPE_LABEL[type];
48
+ if (!label) {
49
+ return value;
50
+ }
51
+ return `${label}('${value}')`;
52
+ }
53
+ function useBsonThemeStyles(type) {
54
+ const darkMode = (0, use_theme_1.useDarkMode)();
55
+ return (0, react_1.useMemo)(() => {
56
+ if (!type) {
57
+ return;
58
+ }
59
+ return {
60
+ color: VALUE_COLOR_BY_THEME_AND_TYPE[darkMode ? use_theme_1.Themes.Dark : use_theme_1.Themes.Light][type],
61
+ };
62
+ }, [type, darkMode]);
63
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare function DateTimePicker({ value, onChange, }: {
3
+ value: string;
4
+ onChange(newValue: string): void;
5
+ }): React.JSX.Element;
6
+ //# sourceMappingURL=date-time-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-time-picker.d.ts","sourceRoot":"","sources":["../../../src/components/document-list/date-time-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AA8C7D,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,qBAiEA"}