@indico-data/design-system 2.58.1 → 2.58.2
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/index.esm.js +50 -21
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +50 -21
- package/lib/index.js.map +1 -1
- package/package.json +1 -2
- package/src/components/truncate/Truncate.stories.tsx +1 -1
- package/src/components/truncate/Truncate.tsx +2 -3
- package/src/components/truncate/__tests__/Truncate.test.tsx +3 -3
package/lib/index.js
CHANGED
|
@@ -8,7 +8,6 @@ var ReactDOM = require('react-dom');
|
|
|
8
8
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
9
9
|
var n = require('styled-components');
|
|
10
10
|
var ReactSelect = require('react-select');
|
|
11
|
-
var node_crypto = require('node:crypto');
|
|
12
11
|
|
|
13
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
13
|
|
|
@@ -42900,35 +42899,65 @@ function BarSpinner(_a) {
|
|
|
42900
42899
|
return (jsxRuntime.jsx("div", Object.assign({ className: `bar-spinner ${className}`, id: id, style: style }, rest, { children: jsxRuntime.jsx("span", {}) })));
|
|
42901
42900
|
}
|
|
42902
42901
|
|
|
42903
|
-
|
|
42904
|
-
|
|
42902
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
42903
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
42904
|
+
// generators (like Math.random()).
|
|
42905
|
+
let getRandomValues;
|
|
42906
|
+
const rnds8 = new Uint8Array(16);
|
|
42907
|
+
function rng() {
|
|
42908
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
42909
|
+
if (!getRandomValues) {
|
|
42910
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
42911
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
42905
42912
|
|
|
42906
|
-
|
|
42907
|
-
|
|
42908
|
-
|
|
42909
|
-
if (!pool || pool.length < bytes) {
|
|
42910
|
-
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
42911
|
-
node_crypto.webcrypto.getRandomValues(pool);
|
|
42912
|
-
poolOffset = 0;
|
|
42913
|
-
} else if (poolOffset + bytes > pool.length) {
|
|
42914
|
-
node_crypto.webcrypto.getRandomValues(pool);
|
|
42915
|
-
poolOffset = 0;
|
|
42913
|
+
if (!getRandomValues) {
|
|
42914
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
42915
|
+
}
|
|
42916
42916
|
}
|
|
42917
|
-
|
|
42917
|
+
|
|
42918
|
+
return getRandomValues(rnds8);
|
|
42918
42919
|
}
|
|
42919
|
-
|
|
42920
|
-
|
|
42921
|
-
|
|
42922
|
-
|
|
42923
|
-
|
|
42920
|
+
|
|
42921
|
+
/**
|
|
42922
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
42923
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
42924
|
+
*/
|
|
42925
|
+
|
|
42926
|
+
const byteToHex = [];
|
|
42927
|
+
|
|
42928
|
+
for (let i = 0; i < 256; ++i) {
|
|
42929
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
42930
|
+
}
|
|
42931
|
+
|
|
42932
|
+
function unsafeStringify(arr, offset = 0) {
|
|
42933
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
42934
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
42935
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
42936
|
+
}
|
|
42937
|
+
|
|
42938
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
42939
|
+
var native = {
|
|
42940
|
+
randomUUID
|
|
42941
|
+
};
|
|
42942
|
+
|
|
42943
|
+
function v4(options, buf, offset) {
|
|
42944
|
+
if (native.randomUUID && !buf && !options) {
|
|
42945
|
+
return native.randomUUID();
|
|
42924
42946
|
}
|
|
42925
|
-
|
|
42947
|
+
|
|
42948
|
+
options = options || {};
|
|
42949
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
42950
|
+
|
|
42951
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
42952
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
42953
|
+
|
|
42954
|
+
return unsafeStringify(rnds);
|
|
42926
42955
|
}
|
|
42927
42956
|
|
|
42928
42957
|
const Truncate = (_a) => {
|
|
42929
42958
|
var { lineClamp = 0, truncateString, hasTooltip = true, tooltipId } = _a, rest = __rest(_a, ["lineClamp", "truncateString", "hasTooltip", "tooltipId"]);
|
|
42930
42959
|
const [isTruncated, setIsTruncated] = React.useState(false);
|
|
42931
|
-
const id = (tooltipId !== null && tooltipId !== void 0 ? tooltipId :
|
|
42960
|
+
const id = (tooltipId !== null && tooltipId !== void 0 ? tooltipId : v4()).replace(/[^a-zA-Z0-9-_]/g, '_');
|
|
42932
42961
|
React.useEffect(() => {
|
|
42933
42962
|
const checkTruncation = () => {
|
|
42934
42963
|
const element = document.querySelector(`[data-tooltip-id="${id}"]`);
|