@mongodb-js/compass-components 1.67.1 → 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.
- package/dist/components/accordion.js +0 -1
- package/dist/components/actions/action-glyph.js +0 -1
- package/dist/components/actions/constants.js +0 -1
- package/dist/components/actions/dropdown-menu-button.js +0 -1
- package/dist/components/actions/item-action-button.js +0 -1
- package/dist/components/actions/item-action-controls.js +0 -1
- package/dist/components/actions/item-action-group.js +0 -1
- package/dist/components/actions/item-action-menu.js +0 -1
- package/dist/components/actions/small-icon-button.js +0 -1
- package/dist/components/actions/types.js +0 -1
- package/dist/components/actions/utils.js +0 -1
- package/dist/components/breadcrumb.js +0 -1
- package/dist/components/bson-value.d.ts +23 -12
- package/dist/components/bson-value.d.ts.map +1 -1
- package/dist/components/bson-value.js +53 -65
- package/dist/components/chevron-collapse-icon.js +0 -1
- package/dist/components/collapsible-field-set.js +1 -4
- package/dist/components/combobox-with-custom-option.js +0 -1
- package/dist/components/compass-components-provider.d.ts +6 -8
- package/dist/components/compass-components-provider.d.ts.map +1 -1
- package/dist/components/compass-components-provider.js +5 -6
- package/dist/components/context-menu.d.ts +1 -2
- package/dist/components/context-menu.d.ts.map +1 -1
- package/dist/components/context-menu.js +5 -3
- package/dist/components/document-list/auto-focus-context.js +0 -1
- package/dist/components/document-list/bson-display-options-context.d.ts +13 -0
- package/dist/components/document-list/bson-display-options-context.d.ts.map +1 -0
- package/dist/components/document-list/bson-display-options-context.js +56 -0
- package/dist/components/document-list/bson-utils.d.ts +10 -0
- package/dist/components/document-list/bson-utils.d.ts.map +1 -0
- package/dist/components/document-list/bson-utils.js +63 -0
- package/dist/components/document-list/date-time-picker.d.ts +6 -0
- package/dist/components/document-list/date-time-picker.d.ts.map +1 -0
- package/dist/components/document-list/date-time-picker.js +112 -0
- package/dist/components/document-list/date-with-timezone-hint.d.ts +11 -0
- package/dist/components/document-list/date-with-timezone-hint.d.ts.map +1 -0
- package/dist/components/document-list/date-with-timezone-hint.js +95 -0
- package/dist/components/document-list/document-actions-group.js +0 -1
- package/dist/components/document-list/document-edit-actions-footer.d.ts +1 -0
- package/dist/components/document-list/document-edit-actions-footer.d.ts.map +1 -1
- package/dist/components/document-list/document-edit-actions-footer.js +2 -6
- package/dist/components/document-list/document.d.ts.map +1 -1
- package/dist/components/document-list/document.js +8 -1
- package/dist/components/document-list/editors/date-editor.d.ts +4 -0
- package/dist/components/document-list/editors/date-editor.d.ts.map +1 -0
- package/dist/components/document-list/editors/date-editor.js +135 -0
- package/dist/components/document-list/editors/default-editor.d.ts +4 -0
- package/dist/components/document-list/editors/default-editor.d.ts.map +1 -0
- package/dist/components/document-list/editors/default-editor.js +46 -0
- package/dist/components/document-list/editors/editor-with-label.d.ts +7 -0
- package/dist/components/document-list/editors/editor-with-label.d.ts.map +1 -0
- package/dist/components/document-list/editors/editor-with-label.js +28 -0
- package/dist/components/document-list/editors/input-editor.d.ts +4 -0
- package/dist/components/document-list/editors/input-editor.d.ts.map +1 -0
- package/dist/components/document-list/editors/input-editor.js +24 -0
- package/dist/components/document-list/editors/shared.d.ts +16 -0
- package/dist/components/document-list/editors/shared.d.ts.map +1 -0
- package/dist/components/document-list/editors/shared.js +34 -0
- package/dist/components/document-list/editors/text-editor.d.ts +4 -0
- package/dist/components/document-list/editors/text-editor.d.ts.map +1 -0
- package/dist/components/document-list/editors/text-editor.js +85 -0
- package/dist/components/document-list/editors/uuid-editor.d.ts +4 -0
- package/dist/components/document-list/editors/uuid-editor.d.ts.map +1 -0
- package/dist/components/document-list/editors/uuid-editor.js +54 -0
- package/dist/components/document-list/element-actions.d.ts.map +1 -1
- package/dist/components/document-list/element-actions.js +11 -11
- package/dist/components/document-list/element-editors.d.ts +1 -1
- package/dist/components/document-list/element-editors.d.ts.map +1 -1
- package/dist/components/document-list/element-editors.js +56 -141
- package/dist/components/document-list/element.d.ts.map +1 -1
- package/dist/components/document-list/element.js +104 -41
- package/dist/components/document-list/index.d.ts +1 -1
- package/dist/components/document-list/index.d.ts.map +1 -1
- package/dist/components/document-list/index.js +4 -4
- package/dist/components/document-list/typography.js +0 -1
- package/dist/components/document-list/use-force-update.js +0 -1
- package/dist/components/document-list/visible-field-toggle.d.ts.map +1 -1
- package/dist/components/document-list/visible-field-toggle.js +2 -1
- package/dist/components/drawer-portal.d.ts +4 -2
- package/dist/components/drawer-portal.d.ts.map +1 -1
- package/dist/components/drawer-portal.js +0 -1
- package/dist/components/empty-content.js +0 -1
- package/dist/components/error-boundary.d.ts +1 -0
- package/dist/components/error-boundary.d.ts.map +1 -1
- package/dist/components/error-boundary.js +0 -1
- package/dist/components/error-warning-summary.js +0 -1
- package/dist/components/feedback-popover.js +0 -1
- package/dist/components/file-picker-dialog.d.ts +1 -0
- package/dist/components/file-picker-dialog.d.ts.map +1 -1
- package/dist/components/file-picker-dialog.js +0 -1
- package/dist/components/file-selector.js +0 -1
- package/dist/components/form-field-container.js +0 -1
- package/dist/components/guide-cue/guide-cue-exceptions.js +0 -1
- package/dist/components/guide-cue/guide-cue-groups.js +0 -1
- package/dist/components/guide-cue/guide-cue-service.js +0 -1
- package/dist/components/guide-cue/guide-cue-storage.js +0 -1
- package/dist/components/guide-cue/guide-cue.d.ts +2 -1
- package/dist/components/guide-cue/guide-cue.d.ts.map +1 -1
- package/dist/components/guide-cue/guide-cue.js +10 -1
- package/dist/components/horizontal-rule.js +0 -1
- package/dist/components/icons/document-icon.js +0 -1
- package/dist/components/icons/favorite-icon.js +0 -1
- package/dist/components/icons/logo-icon.js +0 -1
- package/dist/components/icons/no-saved-items-icon.js +0 -1
- package/dist/components/icons/png-icon.js +0 -1
- package/dist/components/icons/server-icon.js +0 -1
- package/dist/components/index-icon.js +0 -1
- package/dist/components/index-keys-badge.js +0 -1
- package/dist/components/inline-definition.js +2 -3
- package/dist/components/inline-info-link.js +0 -1
- package/dist/components/insights-chip.js +0 -1
- package/dist/components/interactive-popover.js +0 -1
- package/dist/components/keyline-card.js +0 -1
- package/dist/components/leafygreen.d.ts +1 -35
- package/dist/components/leafygreen.d.ts.map +1 -1
- package/dist/components/leafygreen.js +0 -1
- package/dist/components/links/link.d.ts +1 -1
- package/dist/components/links/link.d.ts.map +1 -1
- package/dist/components/links/link.js +0 -1
- package/dist/components/list-editor.js +0 -1
- package/dist/components/loader.js +0 -1
- package/dist/components/modals/confirmation-modal.js +0 -1
- package/dist/components/modals/form-modal.d.ts +2 -1
- package/dist/components/modals/form-modal.d.ts.map +1 -1
- package/dist/components/modals/form-modal.js +2 -3
- package/dist/components/modals/info-modal.js +0 -1
- package/dist/components/modals/marketing-modal.js +0 -1
- package/dist/components/modals/modal-body.d.ts.map +1 -1
- package/dist/components/modals/modal-body.js +7 -1
- package/dist/components/modals/modal-header.js +0 -1
- package/dist/components/modals/modal.js +0 -1
- package/dist/components/options-toggle.js +0 -1
- package/dist/components/placeholder.js +0 -1
- package/dist/components/radio-box-group.js +0 -1
- package/dist/components/resize-handle.d.ts.map +1 -1
- package/dist/components/resize-handle.js +5 -9
- package/dist/components/resizeable-sidebar.js +0 -1
- package/dist/components/select-list.d.ts.map +1 -1
- package/dist/components/select-list.js +2 -3
- package/dist/components/signal-popover.d.ts +1 -1
- package/dist/components/signal-popover.d.ts.map +1 -1
- package/dist/components/signal-popover.js +2 -4
- package/dist/components/signals.js +0 -1
- package/dist/components/tab-nav-bar.js +0 -1
- package/dist/components/toast-body.js +0 -1
- package/dist/components/virtual-grid.js +0 -1
- package/dist/components/virtual-list.js +1 -7
- package/dist/components/workspace-container.d.ts +2 -2
- package/dist/components/workspace-container.d.ts.map +1 -1
- package/dist/components/workspace-container.js +0 -1
- package/dist/components/workspace-tabs/tab.js +0 -1
- package/dist/components/workspace-tabs/use-tab-theme.js +0 -1
- package/dist/components/workspace-tabs/workspace-tabs.d.ts.map +1 -1
- package/dist/components/workspace-tabs/workspace-tabs.js +1 -2
- package/dist/force-emotion-speedy.js +0 -1
- package/dist/hooks/use-confirmation.d.ts +3 -1
- package/dist/hooks/use-confirmation.d.ts.map +1 -1
- package/dist/hooks/use-confirmation.js +2 -3
- package/dist/hooks/use-copy-paste-context-menu.d.ts +1 -1
- package/dist/hooks/use-copy-paste-context-menu.d.ts.map +1 -1
- package/dist/hooks/use-copy-paste-context-menu.js +0 -1
- package/dist/hooks/use-current-value-ref.js +0 -1
- package/dist/hooks/use-default-action.js +0 -1
- package/dist/hooks/use-dom-rect.js +0 -1
- package/dist/hooks/use-effect-on-change.js +0 -1
- package/dist/hooks/use-error-details.js +0 -1
- package/dist/hooks/use-focus-hover.js +0 -1
- package/dist/hooks/use-focus-ring.js +0 -1
- package/dist/hooks/use-formatted-date.js +0 -1
- package/dist/hooks/use-hotkeys.js +0 -1
- package/dist/hooks/use-initial-value.js +0 -1
- package/dist/hooks/use-persisted-state.js +0 -1
- package/dist/hooks/use-scrollbars.js +0 -1
- package/dist/hooks/use-sort.js +0 -1
- package/dist/hooks/use-stacked-component.d.ts.map +1 -1
- package/dist/hooks/use-stacked-component.js +0 -1
- package/dist/hooks/use-sync-state-on-prop-change.js +0 -1
- package/dist/hooks/use-theme.d.ts.map +1 -1
- package/dist/hooks/use-theme.js +0 -1
- package/dist/hooks/use-throttled-props.js +0 -1
- package/dist/hooks/use-toast.d.ts +3 -1
- package/dist/hooks/use-toast.d.ts.map +1 -1
- package/dist/hooks/use-toast.js +0 -1
- package/dist/hooks/use-virtual-grid.js +0 -1
- package/dist/hooks/use-virtual-list-item-observer.js +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/utils/format-date.d.ts +17 -0
- package/dist/utils/format-date.d.ts.map +1 -1
- package/dist/utils/format-date.js +33 -3
- package/dist/utils/format.js +0 -1
- package/dist/utils/merge-props.js +0 -1
- package/dist/utils/rafraf.js +0 -1
- package/dist/utils/reset-global-css.js +0 -1
- package/package.json +19 -19
- package/dist/components/accordion.js.map +0 -1
- package/dist/components/actions/action-glyph.js.map +0 -1
- package/dist/components/actions/constants.js.map +0 -1
- package/dist/components/actions/dropdown-menu-button.js.map +0 -1
- package/dist/components/actions/item-action-button.js.map +0 -1
- package/dist/components/actions/item-action-controls.js.map +0 -1
- package/dist/components/actions/item-action-group.js.map +0 -1
- package/dist/components/actions/item-action-menu.js.map +0 -1
- package/dist/components/actions/small-icon-button.js.map +0 -1
- package/dist/components/actions/types.js.map +0 -1
- package/dist/components/actions/utils.js.map +0 -1
- package/dist/components/breadcrumb.js.map +0 -1
- package/dist/components/bson-value.js.map +0 -1
- package/dist/components/chevron-collapse-icon.js.map +0 -1
- package/dist/components/collapsible-field-set.js.map +0 -1
- package/dist/components/combobox-with-custom-option.js.map +0 -1
- package/dist/components/compass-components-provider.js.map +0 -1
- package/dist/components/context-menu.js.map +0 -1
- package/dist/components/document-list/auto-focus-context.js.map +0 -1
- package/dist/components/document-list/document-actions-group.js.map +0 -1
- package/dist/components/document-list/document-edit-actions-footer.js.map +0 -1
- package/dist/components/document-list/document.js.map +0 -1
- package/dist/components/document-list/element-actions.js.map +0 -1
- package/dist/components/document-list/element-editors.js.map +0 -1
- package/dist/components/document-list/element.js.map +0 -1
- package/dist/components/document-list/index.js.map +0 -1
- package/dist/components/document-list/legacy-uuid-format-context.d.ts +0 -4
- package/dist/components/document-list/legacy-uuid-format-context.d.ts.map +0 -1
- package/dist/components/document-list/legacy-uuid-format-context.js +0 -10
- package/dist/components/document-list/legacy-uuid-format-context.js.map +0 -1
- package/dist/components/document-list/typography.js.map +0 -1
- package/dist/components/document-list/use-force-update.js.map +0 -1
- package/dist/components/document-list/visible-field-toggle.js.map +0 -1
- package/dist/components/drawer-portal.js.map +0 -1
- package/dist/components/empty-content.js.map +0 -1
- package/dist/components/error-boundary.js.map +0 -1
- package/dist/components/error-warning-summary.js.map +0 -1
- package/dist/components/feedback-popover.js.map +0 -1
- package/dist/components/file-picker-dialog.js.map +0 -1
- package/dist/components/file-selector.js.map +0 -1
- package/dist/components/form-field-container.js.map +0 -1
- package/dist/components/guide-cue/guide-cue-exceptions.js.map +0 -1
- package/dist/components/guide-cue/guide-cue-groups.js.map +0 -1
- package/dist/components/guide-cue/guide-cue-service.js.map +0 -1
- package/dist/components/guide-cue/guide-cue-storage.js.map +0 -1
- package/dist/components/guide-cue/guide-cue.js.map +0 -1
- package/dist/components/horizontal-rule.js.map +0 -1
- package/dist/components/icons/document-icon.js.map +0 -1
- package/dist/components/icons/favorite-icon.js.map +0 -1
- package/dist/components/icons/logo-icon.js.map +0 -1
- package/dist/components/icons/no-saved-items-icon.js.map +0 -1
- package/dist/components/icons/png-icon.js.map +0 -1
- package/dist/components/icons/server-icon.js.map +0 -1
- package/dist/components/index-icon.js.map +0 -1
- package/dist/components/index-keys-badge.js.map +0 -1
- package/dist/components/inline-definition.js.map +0 -1
- package/dist/components/inline-info-link.js.map +0 -1
- package/dist/components/insights-chip.js.map +0 -1
- package/dist/components/interactive-popover.js.map +0 -1
- package/dist/components/keyline-card.js.map +0 -1
- package/dist/components/leafygreen.js.map +0 -1
- package/dist/components/links/link.js.map +0 -1
- package/dist/components/list-editor.js.map +0 -1
- package/dist/components/loader.js.map +0 -1
- package/dist/components/modals/confirmation-modal.js.map +0 -1
- package/dist/components/modals/form-modal.js.map +0 -1
- package/dist/components/modals/info-modal.js.map +0 -1
- package/dist/components/modals/marketing-modal.js.map +0 -1
- package/dist/components/modals/modal-body.js.map +0 -1
- package/dist/components/modals/modal-header.js.map +0 -1
- package/dist/components/modals/modal.js.map +0 -1
- package/dist/components/options-toggle.js.map +0 -1
- package/dist/components/placeholder.js.map +0 -1
- package/dist/components/radio-box-group.js.map +0 -1
- package/dist/components/resize-handle.js.map +0 -1
- package/dist/components/resizeable-sidebar.js.map +0 -1
- package/dist/components/select-list.js.map +0 -1
- package/dist/components/signal-popover.js.map +0 -1
- package/dist/components/signals.js.map +0 -1
- package/dist/components/tab-nav-bar.js.map +0 -1
- package/dist/components/toast-body.js.map +0 -1
- package/dist/components/virtual-grid.js.map +0 -1
- package/dist/components/virtual-list.js.map +0 -1
- package/dist/components/workspace-container.js.map +0 -1
- package/dist/components/workspace-tabs/tab.js.map +0 -1
- package/dist/components/workspace-tabs/use-tab-theme.js.map +0 -1
- package/dist/components/workspace-tabs/workspace-tabs.js.map +0 -1
- package/dist/force-emotion-speedy.js.map +0 -1
- package/dist/hooks/use-confirmation.js.map +0 -1
- package/dist/hooks/use-copy-paste-context-menu.js.map +0 -1
- package/dist/hooks/use-current-value-ref.js.map +0 -1
- package/dist/hooks/use-default-action.js.map +0 -1
- package/dist/hooks/use-dom-rect.js.map +0 -1
- package/dist/hooks/use-effect-on-change.js.map +0 -1
- package/dist/hooks/use-error-details.js.map +0 -1
- package/dist/hooks/use-focus-hover.js.map +0 -1
- package/dist/hooks/use-focus-ring.js.map +0 -1
- package/dist/hooks/use-formatted-date.js.map +0 -1
- package/dist/hooks/use-hotkeys.js.map +0 -1
- package/dist/hooks/use-initial-value.js.map +0 -1
- package/dist/hooks/use-persisted-state.js.map +0 -1
- package/dist/hooks/use-scrollbars.js.map +0 -1
- package/dist/hooks/use-sort.js.map +0 -1
- package/dist/hooks/use-stacked-component.js.map +0 -1
- package/dist/hooks/use-sync-state-on-prop-change.js.map +0 -1
- package/dist/hooks/use-theme.js.map +0 -1
- package/dist/hooks/use-throttled-props.js.map +0 -1
- package/dist/hooks/use-toast.js.map +0 -1
- package/dist/hooks/use-virtual-grid.js.map +0 -1
- package/dist/hooks/use-virtual-list-item-observer.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/utils/format-date.js.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/merge-props.js.map +0 -1
- package/dist/utils/rafraf.js.map +0 -1
- package/dist/utils/reset-global-css.js.map +0 -1
|
@@ -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 @@
|
|
|
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"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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.DateTimePicker = DateTimePicker;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const emotion_1 = require("@leafygreen-ui/emotion");
|
|
39
|
+
const leafygreen_1 = require("../leafygreen");
|
|
40
|
+
const use_theme_1 = require("../../hooks/use-theme");
|
|
41
|
+
const format_date_1 = require("../../utils/format-date");
|
|
42
|
+
const containerStyles = (0, emotion_1.css)({
|
|
43
|
+
display: 'flex',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
});
|
|
46
|
+
const buttonStyles = (0, emotion_1.css)({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
padding: 0,
|
|
50
|
+
margin: 0,
|
|
51
|
+
border: 'none',
|
|
52
|
+
background: 'none',
|
|
53
|
+
color: 'inherit',
|
|
54
|
+
cursor: 'pointer',
|
|
55
|
+
});
|
|
56
|
+
// We are not showing the native input at all. This is mainly due to how its
|
|
57
|
+
// rendered in Safari. For Chrome/Firefox, we can hide the input and only show
|
|
58
|
+
// the picker icon, but that's not possible in Safari. So we hide everything
|
|
59
|
+
// and use our custom button to open the picker.
|
|
60
|
+
const dateTimePickerInput = (0, emotion_1.css)({
|
|
61
|
+
colorScheme: 'light',
|
|
62
|
+
width: 0,
|
|
63
|
+
padding: 0,
|
|
64
|
+
border: 'none',
|
|
65
|
+
boxShadow: 'none',
|
|
66
|
+
outline: 'none',
|
|
67
|
+
'&::-webkit-calendar-picker-indicator': {
|
|
68
|
+
display: 'none',
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
const dateTimePickerInputDarkMode = (0, emotion_1.css)({
|
|
72
|
+
// This is the only bit we can customize in the native picker popup.
|
|
73
|
+
colorScheme: 'dark',
|
|
74
|
+
});
|
|
75
|
+
function DateTimePicker({ value, onChange, }) {
|
|
76
|
+
const pickerInputRef = (0, react_1.useRef)(null);
|
|
77
|
+
const darkMode = (0, use_theme_1.useDarkMode)();
|
|
78
|
+
const pickerDateTime = (0, format_date_1.convertToPickerDateTime)(value);
|
|
79
|
+
// On Firefox, when we clear the input value using `Clear` option from the
|
|
80
|
+
// picker, the input value is set to empty string. And then on following
|
|
81
|
+
// change in value, input.onChange is not called. So just before opening
|
|
82
|
+
// the picker, if the (datetime) value is empty, we set the this value to
|
|
83
|
+
// current date time so that the picker change is picked up.
|
|
84
|
+
const [seededDateTime, setSeededDateTime] = (0, react_1.useState)(null);
|
|
85
|
+
const openPicker = (0, react_1.useCallback)(() => {
|
|
86
|
+
const input = pickerInputRef.current;
|
|
87
|
+
if (!input) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!pickerDateTime) {
|
|
91
|
+
setSeededDateTime((0, format_date_1.convertToPickerDateTime)(new Date().toString()));
|
|
92
|
+
}
|
|
93
|
+
input.focus();
|
|
94
|
+
input.showPicker();
|
|
95
|
+
}, [pickerDateTime]);
|
|
96
|
+
return (react_1.default.createElement("span", { className: containerStyles },
|
|
97
|
+
react_1.default.createElement("button", { type: "button", "aria-label": "Select date and time", "data-testid": "hadron-document-date-picker-button",
|
|
98
|
+
// The picker is only reachable by clicking its button, so that tabbing
|
|
99
|
+
// keeps moving between the editors.
|
|
100
|
+
tabIndex: -1, className: buttonStyles, onClick: openPicker },
|
|
101
|
+
react_1.default.createElement(leafygreen_1.Icon, { glyph: "Calendar", size: "small" })),
|
|
102
|
+
react_1.default.createElement("input", { ref: pickerInputRef, type: "datetime-local",
|
|
103
|
+
// Milliseconds precision, matching BSON dates. On chromium, this is the
|
|
104
|
+
// way to show milliseconds in the picker panel. On Firefox and Safari,
|
|
105
|
+
// time picker UI is not available at all.
|
|
106
|
+
step: "0.001", "data-testid": "hadron-document-date-picker", value: pickerDateTime || seededDateTime || '', tabIndex: -1, onBlur: () => {
|
|
107
|
+
setSeededDateTime(null);
|
|
108
|
+
}, onChange: (evt) => {
|
|
109
|
+
setSeededDateTime(null);
|
|
110
|
+
onChange((0, format_date_1.convertFromPickerDateTime)(evt.currentTarget.value));
|
|
111
|
+
}, className: (0, emotion_1.cx)(dateTimePickerInput, darkMode && dateTimePickerInputDarkMode) })));
|
|
112
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Exported for tests only.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatDateWithTimezone(value: Date | number | string, timezone?: string, locale?: string): string;
|
|
7
|
+
export declare function DateWithTimezoneHint({ value, children, }: {
|
|
8
|
+
value: Date | number | string;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
//# sourceMappingURL=date-with-timezone-hint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-with-timezone-hint.d.ts","sourceRoot":"","sources":["../../../src/components/document-list/date-with-timezone-hint.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAgBvC;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,EAC7B,QAAQ,SAAQ,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAiBR;AAkBD,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAkBA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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.formatDateWithTimezone = formatDateWithTimezone;
|
|
37
|
+
exports.DateWithTimezoneHint = DateWithTimezoneHint;
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const emotion_1 = require("@leafygreen-ui/emotion");
|
|
40
|
+
const inline_definition_1 = require("../inline-definition");
|
|
41
|
+
const bson_display_options_context_1 = require("./bson-display-options-context");
|
|
42
|
+
const bson_utils_1 = require("./bson-utils");
|
|
43
|
+
function isValidTimezone(timezone) {
|
|
44
|
+
try {
|
|
45
|
+
new Intl.DateTimeFormat('en-US', { timeZone: timezone });
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Exported for tests only.
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
function formatDateWithTimezone(value, timezone = 'UTC', locale) {
|
|
57
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
58
|
+
if (isNaN(date.valueOf())) {
|
|
59
|
+
return 'Invalid Date';
|
|
60
|
+
}
|
|
61
|
+
const timeZone = isValidTimezone(timezone) ? timezone : 'UTC';
|
|
62
|
+
try {
|
|
63
|
+
return new Intl.DateTimeFormat(locale, {
|
|
64
|
+
timeZone,
|
|
65
|
+
dateStyle: 'long',
|
|
66
|
+
timeStyle: 'long',
|
|
67
|
+
}).format(date);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return 'Invalid Date';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Inline styles to make things more easily copy-pasteable.
|
|
74
|
+
const containerStyles = (0, emotion_1.css)({
|
|
75
|
+
display: 'inline',
|
|
76
|
+
whiteSpace: 'normal',
|
|
77
|
+
[bson_utils_1.bsonValueDisplayVar]: 'inline',
|
|
78
|
+
});
|
|
79
|
+
const valueStyles = (0, emotion_1.css)({
|
|
80
|
+
display: 'inline',
|
|
81
|
+
paddingRight: '8px',
|
|
82
|
+
});
|
|
83
|
+
const dateWithTimezoneHintStyles = (0, emotion_1.css)({
|
|
84
|
+
userSelect: 'none',
|
|
85
|
+
});
|
|
86
|
+
function DateWithTimezoneHint({ value, children, }) {
|
|
87
|
+
const { timezone } = (0, bson_display_options_context_1.useBSONDisplayOptions)();
|
|
88
|
+
const timezoneFormattedValue = (0, react_1.useMemo)(() => {
|
|
89
|
+
return formatDateWithTimezone(value, timezone);
|
|
90
|
+
}, [value, timezone]);
|
|
91
|
+
return (react_1.default.createElement("span", { className: containerStyles },
|
|
92
|
+
react_1.default.createElement("span", { className: valueStyles }, children),
|
|
93
|
+
react_1.default.createElement("wbr", null),
|
|
94
|
+
react_1.default.createElement(inline_definition_1.InlineDefinition, { className: dateWithTimezoneHintStyles, "data-testid": "date-with-timezone-hint", definition: "This personal timezone display preference may be configured in Compass Settings." }, timezoneFormattedValue)));
|
|
95
|
+
}
|
|
@@ -139,4 +139,3 @@ const DocumentActionsGroup = ({ onEdit, onCopy, onClone, onRemove, onExpand, exp
|
|
|
139
139
|
onRemove && (react_1.default.createElement(ActionButton, { size: "xsmall", tooltipEnabled: isActive, rightGlyph: react_1.default.createElement(leafygreen_1.Icon, { role: "presentation", glyph: "Trash" }), "aria-label": "Remove document", "data-testid": "remove-document-button", onClick: onRemove, className: actionsGroupItem, tooltipText: "Remove document" }))));
|
|
140
140
|
};
|
|
141
141
|
exports.default = DocumentActionsGroup;
|
|
142
|
-
//# sourceMappingURL=document-actions-group.js.map
|
|
@@ -7,6 +7,7 @@ declare const EditActionsFooter: React.FunctionComponent<{
|
|
|
7
7
|
modified?: boolean;
|
|
8
8
|
validationError?: Error | null;
|
|
9
9
|
alwaysForceUpdate?: boolean;
|
|
10
|
+
renderStatusMessage?(message: string): React.ReactNode;
|
|
10
11
|
onUpdate(force: boolean): void;
|
|
11
12
|
onDelete(): void;
|
|
12
13
|
onCancel?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-edit-actions-footer.d.ts","sourceRoot":"","sources":["../../../src/components/document-list/document-edit-actions-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"document-edit-actions-footer.d.ts","sourceRoot":"","sources":["../../../src/components/document-list/document-edit-actions-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAC;AAqSlD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAC/C,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACvD,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,QAAQ,IAAI,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAmGA,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -217,9 +217,6 @@ const container = (0, emotion_1.css)({
|
|
|
217
217
|
borderBottomLeftRadius: 'inherit',
|
|
218
218
|
borderBottomRightRadius: 'inherit',
|
|
219
219
|
});
|
|
220
|
-
const message = (0, emotion_1.css)({
|
|
221
|
-
overflow: 'scroll',
|
|
222
|
-
});
|
|
223
220
|
const buttonGroup = (0, emotion_1.css)({
|
|
224
221
|
display: 'flex',
|
|
225
222
|
marginLeft: 'auto',
|
|
@@ -263,7 +260,7 @@ function getColorStyles(status, darkMode) {
|
|
|
263
260
|
};
|
|
264
261
|
}
|
|
265
262
|
}
|
|
266
|
-
const EditActionsFooter = ({ doc, editing, deleting, modified = false, validationError: initialError = null, alwaysForceUpdate = false, onUpdate, onDelete, onCancel, }) => {
|
|
263
|
+
const EditActionsFooter = ({ doc, editing, deleting, modified = false, validationError: initialError = null, alwaysForceUpdate = false, renderStatusMessage = (message) => message, onUpdate, onDelete, onCancel, }) => {
|
|
267
264
|
const { status: _status, updateStatus, error, } = useHadronDocumentStatus(doc, editing, deleting, initialError);
|
|
268
265
|
const darkMode = (0, use_theme_1.useDarkMode)();
|
|
269
266
|
// Allow props to override event based status of the document (helpful for
|
|
@@ -279,7 +276,7 @@ const EditActionsFooter = ({ doc, editing, deleting, modified = false, validatio
|
|
|
279
276
|
return null;
|
|
280
277
|
}
|
|
281
278
|
return (react_1.default.createElement("div", { className: container, style: getColorStyles(status, darkMode), "data-testid": "document-footer", "data-status": status },
|
|
282
|
-
react_1.default.createElement("div", {
|
|
279
|
+
react_1.default.createElement("div", { "data-testid": "document-footer-message" }, renderStatusMessage(error?.message ?? statusMessage)),
|
|
283
280
|
!isSuccess(status) && (react_1.default.createElement("div", { className: buttonGroup },
|
|
284
281
|
error?.details && (react_1.default.createElement(leafygreen_1.Button, { className: button, size: "xsmall", onClick: () => (0, use_error_details_1.showErrorDetails)({
|
|
285
282
|
details: error.details,
|
|
@@ -304,4 +301,3 @@ const EditActionsFooter = ({ doc, editing, deleting, modified = false, validatio
|
|
|
304
301
|
: 'Update')))));
|
|
305
302
|
};
|
|
306
303
|
exports.default = EditActionsFooter;
|
|
307
|
-
//# sourceMappingURL=document-edit-actions-footer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/components/document-list/document.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EACV,OAAO,IAAI,kBAAkB,EAE9B,MAAM,iBAAiB,CAAC;AA0EzB,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAC5C,KAAK,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/components/document-list/document.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EACV,OAAO,IAAI,kBAAkB,EAE9B,MAAM,iBAAiB,CAAC;AA0EzB,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAC5C,KAAK,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAgHA,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -103,8 +103,16 @@ const HadronDocument = ({ value: document, editable = false, editing = false, on
|
|
|
103
103
|
alignWithNestedExpandIcon: false,
|
|
104
104
|
extraGutterWidth,
|
|
105
105
|
}), [editable, extraGutterWidth]);
|
|
106
|
+
const emptyDocumentOffset = (0, react_1.useMemo)(() => (0, element_1.calculateShowMoreToggleOffset)({
|
|
107
|
+
editable,
|
|
108
|
+
level: 0,
|
|
109
|
+
alignWithNestedExpandIcon: true,
|
|
110
|
+
extraGutterWidth,
|
|
111
|
+
}), [editable, extraGutterWidth]);
|
|
106
112
|
return (react_1.default.createElement("div", { className: className },
|
|
107
113
|
react_1.default.createElement("div", { className: hadronDocument, "data-testid": "hadron-document", "data-id": document.uuid },
|
|
114
|
+
!editable && elements.length === 0 && (react_1.default.createElement("div", { "data-testid": "readonly-document-empty", style: { paddingLeft: emptyDocumentOffset } },
|
|
115
|
+
react_1.default.createElement("em", null, "(empty document)"))),
|
|
108
116
|
react_1.default.createElement(auto_focus_context_1.AutoFocusContext.Provider, { value: editing ? autoFocus : null }, visibleElements.map((el, idx) => {
|
|
109
117
|
return (react_1.default.createElement(element_1.HadronElement, { key: idx, value: el, editable: editable, editingEnabled: editing, onEditStart: editable
|
|
110
118
|
? (id, type) => {
|
|
@@ -136,4 +144,3 @@ const HadronDocument = ({ value: document, editable = false, editing = false, on
|
|
|
136
144
|
} })));
|
|
137
145
|
};
|
|
138
146
|
exports.default = HadronDocument;
|
|
139
|
-
//# sourceMappingURL=document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-editor.d.ts","sourceRoot":"","sources":["../../../../src/components/document-list/editors/date-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAGtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AA+H5C,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,WAAW,qBA4Bb"}
|
|
@@ -0,0 +1,135 @@
|
|
|
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.DateEditor = DateEditor;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const emotion_1 = require("@leafygreen-ui/emotion");
|
|
39
|
+
const leafygreen_1 = require("../../leafygreen");
|
|
40
|
+
const input_editor_1 = require("./input-editor");
|
|
41
|
+
const use_theme_1 = require("../../../hooks/use-theme");
|
|
42
|
+
const format_date_1 = require("../../../utils/format-date");
|
|
43
|
+
const editor_with_label_1 = require("./editor-with-label");
|
|
44
|
+
const date_with_timezone_hint_1 = require("../date-with-timezone-hint");
|
|
45
|
+
// Inline so the timezone info is on the same line unless it overflows.
|
|
46
|
+
const dateContainerStyles = (0, emotion_1.css)({
|
|
47
|
+
display: 'inline-flex',
|
|
48
|
+
verticalAlign: 'bottom',
|
|
49
|
+
});
|
|
50
|
+
const dateTimePickerContainerStyles = (0, emotion_1.css)({
|
|
51
|
+
display: 'flex',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
});
|
|
54
|
+
const dateTimePickerButtonStyles = (0, emotion_1.css)({
|
|
55
|
+
display: 'flex',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
padding: 0,
|
|
58
|
+
margin: 0,
|
|
59
|
+
border: 'none',
|
|
60
|
+
background: 'none',
|
|
61
|
+
color: 'inherit',
|
|
62
|
+
cursor: 'pointer',
|
|
63
|
+
});
|
|
64
|
+
// We are not showing the native input at all. This is mainly due to how its
|
|
65
|
+
// rendered in Safari. For Chrome/Firefox, we can hide the input and only show
|
|
66
|
+
// the picker icon, but that's not possible in Safari. So we hide everything
|
|
67
|
+
// and use our custom button to open the picker.
|
|
68
|
+
const dateTimePickerInputStyles = (0, emotion_1.css)({
|
|
69
|
+
colorScheme: 'light',
|
|
70
|
+
width: 0,
|
|
71
|
+
height: 0,
|
|
72
|
+
padding: 0,
|
|
73
|
+
border: 'none',
|
|
74
|
+
boxShadow: 'none',
|
|
75
|
+
outline: 'none',
|
|
76
|
+
'&::-webkit-calendar-picker-indicator': {
|
|
77
|
+
display: 'none',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
const dateTimePickerInputDarkModeStyles = (0, emotion_1.css)({
|
|
81
|
+
// This is the only bit we can customize in the native picker popup.
|
|
82
|
+
colorScheme: 'dark',
|
|
83
|
+
});
|
|
84
|
+
function DateTimePicker({ value, onChange, }) {
|
|
85
|
+
const pickerInputRef = (0, react_1.useRef)(null);
|
|
86
|
+
const darkMode = (0, use_theme_1.useDarkMode)();
|
|
87
|
+
const pickerDateTime = (0, format_date_1.convertToPickerDateTime)(value);
|
|
88
|
+
// On Firefox, when we clear the input value using `Clear` option from the
|
|
89
|
+
// picker, the input value is set to empty string. And then on following
|
|
90
|
+
// change in value, input.onChange is not called. So just before opening
|
|
91
|
+
// the picker, if the (datetime) value is empty, we set the this value to
|
|
92
|
+
// current date time so that the picker change is picked up.
|
|
93
|
+
const [seededDateTime, setSeededDateTime] = (0, react_1.useState)(null);
|
|
94
|
+
const openPicker = (0, react_1.useCallback)(() => {
|
|
95
|
+
const input = pickerInputRef.current;
|
|
96
|
+
if (!input) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (!pickerDateTime) {
|
|
100
|
+
setSeededDateTime((0, format_date_1.convertToPickerDateTime)(new Date().toString()));
|
|
101
|
+
}
|
|
102
|
+
input.focus();
|
|
103
|
+
input.showPicker();
|
|
104
|
+
}, [pickerDateTime]);
|
|
105
|
+
return (react_1.default.createElement("span", { className: dateTimePickerContainerStyles },
|
|
106
|
+
react_1.default.createElement("button", { type: "button", "aria-label": "Select date and time", "data-testid": "hadron-document-date-picker-button",
|
|
107
|
+
// The picker is only reachable by clicking its button, so that tabbing
|
|
108
|
+
// keeps moving between the editors.
|
|
109
|
+
tabIndex: -1, className: dateTimePickerButtonStyles, onClick: openPicker },
|
|
110
|
+
react_1.default.createElement(leafygreen_1.Icon, { glyph: "Calendar", size: "small" })),
|
|
111
|
+
react_1.default.createElement("input", { ref: pickerInputRef, type: "datetime-local",
|
|
112
|
+
// Milliseconds precision, matching BSON dates. On chromium, this is the
|
|
113
|
+
// way to show milliseconds in the picker panel. On Firefox and Safari,
|
|
114
|
+
// time picker UI is not available at all.
|
|
115
|
+
step: "0.001", "data-testid": "hadron-document-date-picker", value: pickerDateTime || seededDateTime || '', tabIndex: -1, onBlur: () => {
|
|
116
|
+
setSeededDateTime(null);
|
|
117
|
+
}, onChange: (evt) => {
|
|
118
|
+
setSeededDateTime(null);
|
|
119
|
+
onChange((0, format_date_1.convertFromPickerDateTime)(evt.currentTarget.value));
|
|
120
|
+
}, className: (0, emotion_1.cx)(dateTimePickerInputStyles, darkMode && dateTimePickerInputDarkModeStyles) })));
|
|
121
|
+
}
|
|
122
|
+
function DateEditor({ value, onChange, onBlur, type, ...props }) {
|
|
123
|
+
const inputStyle = (0, react_1.useMemo)(() => {
|
|
124
|
+
// 29 because the ISODate format is 29 characters long
|
|
125
|
+
return { width: `${Math.max(value.length, 29)}ch` };
|
|
126
|
+
}, [value]);
|
|
127
|
+
return (react_1.default.createElement(date_with_timezone_hint_1.DateWithTimezoneHint, { value: value },
|
|
128
|
+
react_1.default.createElement("span", { className: dateContainerStyles },
|
|
129
|
+
react_1.default.createElement(editor_with_label_1.EditorWithLabel, { type: type },
|
|
130
|
+
react_1.default.createElement(input_editor_1.InputEditor, { value: value, onChange: onChange, onBlur: onBlur, ...props, style: inputStyle })),
|
|
131
|
+
react_1.default.createElement(DateTimePicker, { value: value, onChange: (newValue) => {
|
|
132
|
+
onChange(newValue);
|
|
133
|
+
onBlur();
|
|
134
|
+
} }))));
|
|
135
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-editor.d.ts","sourceRoot":"","sources":["../../../../src/components/document-list/editors/default-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,qBASnE"}
|