@mongodb-js/compass-components 1.54.1 → 1.55.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/lib/components/actions/item-action-group.d.ts.map +1 -1
- package/lib/components/actions/item-action-group.js +4 -1
- package/lib/components/actions/item-action-group.js.map +1 -1
- package/lib/components/atlas-skills-banner.d.ts +9 -0
- package/lib/components/atlas-skills-banner.d.ts.map +1 -0
- package/lib/components/atlas-skills-banner.js +83 -0
- package/lib/components/atlas-skills-banner.js.map +1 -0
- package/lib/components/bson-value.d.ts.map +1 -1
- package/lib/components/bson-value.js +5 -3
- package/lib/components/bson-value.js.map +1 -1
- package/lib/components/chevron-collapse-icon.d.ts +2 -1
- package/lib/components/chevron-collapse-icon.d.ts.map +1 -1
- package/lib/components/chevron-collapse-icon.js.map +1 -1
- package/lib/components/document-list/element.d.ts.map +1 -1
- package/lib/components/document-list/element.js +20 -14
- package/lib/components/document-list/element.js.map +1 -1
- package/lib/components/file-picker-dialog.d.ts.map +1 -1
- package/lib/components/file-picker-dialog.js +4 -1
- package/lib/components/file-picker-dialog.js.map +1 -1
- package/lib/components/file-selector.d.ts.map +1 -1
- package/lib/components/file-selector.js +5 -1
- package/lib/components/file-selector.js.map +1 -1
- package/lib/components/icons/logo-icon.js +1 -1
- package/lib/components/icons/logo-icon.js.map +1 -1
- package/lib/components/inline-definition.d.ts.map +1 -1
- package/lib/components/inline-definition.js +1 -4
- package/lib/components/inline-definition.js.map +1 -1
- package/lib/components/leafygreen.d.ts +34 -3
- package/lib/components/leafygreen.d.ts.map +1 -1
- package/lib/components/leafygreen.js +6 -3
- package/lib/components/leafygreen.js.map +1 -1
- package/lib/components/modals/confirmation-modal.d.ts +1 -1
- package/lib/components/modals/marketing-modal.d.ts +1 -1
- package/lib/components/modals/modal.d.ts +1 -1
- package/lib/components/select-list.d.ts.map +1 -1
- package/lib/components/select-list.js +2 -1
- package/lib/components/select-list.js.map +1 -1
- package/lib/components/workspace-tabs/tab.d.ts.map +1 -1
- package/lib/components/workspace-tabs/tab.js +1 -0
- package/lib/components/workspace-tabs/tab.js.map +1 -1
- package/lib/hooks/use-error-details.d.ts.map +1 -1
- package/lib/hooks/use-error-details.js +2 -0
- package/lib/hooks/use-error-details.js.map +1 -1
- package/lib/hooks/use-stacked-component.d.ts +1 -2
- package/lib/hooks/use-stacked-component.d.ts.map +1 -1
- package/lib/hooks/use-stacked-component.js.map +1 -1
- package/lib/hooks/use-throttled-props.d.ts +2 -0
- package/lib/hooks/use-throttled-props.d.ts.map +1 -0
- package/lib/hooks/use-throttled-props.js +41 -0
- package/lib/hooks/use-throttled-props.js.map +1 -0
- package/lib/index.d.ts +6 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/format.d.ts +17 -0
- package/lib/utils/format.d.ts.map +1 -0
- package/lib/utils/format.js +45 -0
- package/lib/utils/format.js.map +1 -0
- package/package.json +13 -12
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compactBytes = compactBytes;
|
|
4
|
+
exports.compactNumber = compactNumber;
|
|
5
|
+
/**
|
|
6
|
+
* Format bytes into a human-readable string with appropriate units.
|
|
7
|
+
*
|
|
8
|
+
* @param bytes - The number of bytes to format
|
|
9
|
+
* @param si - Use SI units (1000-based) if true, binary units (1024-based) if false
|
|
10
|
+
* @param decimals - Number of decimal places to show
|
|
11
|
+
* @returns Formatted string with units (e.g., "1.5 MB", "2.0 KiB", "-1.5 MB")
|
|
12
|
+
*/
|
|
13
|
+
function compactBytes(bytes, si = true, decimals = 2) {
|
|
14
|
+
const isNegative = bytes < 0;
|
|
15
|
+
const absBytes = Math.abs(bytes);
|
|
16
|
+
if (absBytes === 0) {
|
|
17
|
+
return '0 B';
|
|
18
|
+
}
|
|
19
|
+
const threshold = si ? 1000 : 1024;
|
|
20
|
+
const units = si
|
|
21
|
+
? ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
22
|
+
: ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
23
|
+
let i = Math.floor(Math.log(absBytes) / Math.log(threshold));
|
|
24
|
+
if (i >= units.length) {
|
|
25
|
+
i = units.length - 1;
|
|
26
|
+
}
|
|
27
|
+
const num = absBytes / Math.pow(threshold, i);
|
|
28
|
+
return `${isNegative ? '-' : ''}${num.toFixed(decimals)} ${units[i]}`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Format a number into a compact notation with appropriate suffix.
|
|
32
|
+
*
|
|
33
|
+
* @param number - The number to format
|
|
34
|
+
* @returns Formatted string with compact notation (e.g., "1.5K", "2M")
|
|
35
|
+
*/
|
|
36
|
+
function compactNumber(number) {
|
|
37
|
+
return new Intl.NumberFormat('en', {
|
|
38
|
+
notation: 'compact',
|
|
39
|
+
})
|
|
40
|
+
.formatToParts(number)
|
|
41
|
+
.reduce((acc, part) => {
|
|
42
|
+
return `${acc}${part.value}`;
|
|
43
|
+
}, '');
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":";;AAQA,oCAkBC;AAQD,sCAQC;AA1CD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAAC,KAAa,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,GAAG,CAAC;IACjE,MAAM,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAEjC,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,EAAE,CAAC,CAA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 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongodb-js/compass-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.55.0",
|
|
4
4
|
"description": "React Components used in Compass",
|
|
5
5
|
"license": "SSPL",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@leafygreen-ui/card": "^12.0.2",
|
|
44
44
|
"@leafygreen-ui/checkbox": "^14.0.2",
|
|
45
45
|
"@leafygreen-ui/chip": "^3.0.12",
|
|
46
|
-
"@leafygreen-ui/code": "^
|
|
46
|
+
"@leafygreen-ui/code": "^20.1.1",
|
|
47
47
|
"@leafygreen-ui/combobox": "^11.0.2",
|
|
48
48
|
"@leafygreen-ui/confirmation-modal": "^6.0.2",
|
|
49
49
|
"@leafygreen-ui/copyable": "^10.0.14",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@leafygreen-ui/emotion": "^4.0.9",
|
|
52
52
|
"@leafygreen-ui/guide-cue": "^7.0.2",
|
|
53
53
|
"@leafygreen-ui/hooks": "^8.3.4",
|
|
54
|
-
"@leafygreen-ui/icon": "^
|
|
54
|
+
"@leafygreen-ui/icon": "^14.6.0",
|
|
55
55
|
"@leafygreen-ui/icon-button": "^16.0.2",
|
|
56
56
|
"@leafygreen-ui/info-sprinkle": "^4.0.2",
|
|
57
57
|
"@leafygreen-ui/input-option": "^3.0.12",
|
|
@@ -97,18 +97,19 @@
|
|
|
97
97
|
"@lg-chat/rich-links": "^4.0.0",
|
|
98
98
|
"@lg-chat/suggestions": "^0.2.3",
|
|
99
99
|
"@lg-chat/title-bar": "^4.0.7",
|
|
100
|
-
"@mongodb-js/compass-context-menu": "^0.2.
|
|
100
|
+
"@mongodb-js/compass-context-menu": "^0.2.13",
|
|
101
|
+
"@mongodb-js/diagramming": "^2.2.0",
|
|
101
102
|
"@react-aria/interactions": "^3.9.1",
|
|
102
103
|
"@react-aria/utils": "^3.13.1",
|
|
103
104
|
"@react-aria/visually-hidden": "^3.3.1",
|
|
104
105
|
"@tanstack/table-core": "^8.14.0",
|
|
105
106
|
"bson": "^6.10.4",
|
|
106
107
|
"focus-trap-react": "^9.0.2",
|
|
107
|
-
"hadron-document": "^8.10.
|
|
108
|
-
"hadron-type-checker": "^7.4.
|
|
108
|
+
"hadron-document": "^8.10.5",
|
|
109
|
+
"hadron-type-checker": "^7.4.23",
|
|
109
110
|
"is-electron-renderer": "^2.0.1",
|
|
110
111
|
"lodash": "^4.17.21",
|
|
111
|
-
"mongodb-query-util": "^2.5.
|
|
112
|
+
"mongodb-query-util": "^2.5.12",
|
|
112
113
|
"polished": "^4.2.2",
|
|
113
114
|
"react": "^17.0.2",
|
|
114
115
|
"react-dom": "^17.0.2",
|
|
@@ -120,11 +121,11 @@
|
|
|
120
121
|
"devDependencies": {
|
|
121
122
|
"@emotion/css": "^11.11.2",
|
|
122
123
|
"@leafygreen-ui/lib": "^15.3.0",
|
|
123
|
-
"@mongodb-js/eslint-config-compass": "^1.4.
|
|
124
|
+
"@mongodb-js/eslint-config-compass": "^1.4.12",
|
|
124
125
|
"@mongodb-js/mocha-config-compass": "^1.7.2",
|
|
125
126
|
"@mongodb-js/prettier-config-compass": "^1.2.9",
|
|
126
|
-
"@mongodb-js/testing-library-compass": "^1.3.
|
|
127
|
-
"@mongodb-js/tsconfig-compass": "^1.2.
|
|
127
|
+
"@mongodb-js/testing-library-compass": "^1.3.17",
|
|
128
|
+
"@mongodb-js/tsconfig-compass": "^1.2.12",
|
|
128
129
|
"@types/chai": "^4.2.21",
|
|
129
130
|
"@types/chai-dom": "^0.0.10",
|
|
130
131
|
"@types/mocha": "^9.0.0",
|
|
@@ -133,7 +134,7 @@
|
|
|
133
134
|
"mocha": "^10.2.0",
|
|
134
135
|
"nyc": "^15.1.0",
|
|
135
136
|
"sinon": "^9.0.0",
|
|
136
|
-
"typescript": "^5.9.
|
|
137
|
+
"typescript": "^5.9.3"
|
|
137
138
|
},
|
|
138
139
|
"repository": {
|
|
139
140
|
"type": "git",
|
|
@@ -143,5 +144,5 @@
|
|
|
143
144
|
"publishConfig": {
|
|
144
145
|
"access": "public"
|
|
145
146
|
},
|
|
146
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "f7170fb726b4c18414e779d22bf80465c08b02f7"
|
|
147
148
|
}
|