@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 CHANGED
@@ -8,7 +8,6 @@ import ReactDOM__default from 'react-dom';
8
8
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
9
  import n, { css, ThemeProvider } from 'styled-components';
10
10
  import ReactSelect, { components as components$1 } from 'react-select';
11
- import { webcrypto } from 'node:crypto';
12
11
 
13
12
  const indicons = {
14
13
  'indico-o-white': (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 100 100", children: jsx("path", { d: "M100 50c0 27.6-22.4 50-50 50S0 77.6 0 50 22.4 0 50 0s50 22.4 50 50zM50 19.4c-16.9 0-30.6 13.7-30.6 30.6S33.1 80.6 50 80.6 80.6 66.9 80.6 50 66.9 19.4 50 19.4zm0 21.7c-4.9 0-8.9 4-8.9 8.9s4 8.9 8.9 8.9 8.9-4 8.9-8.9-4-8.9-8.9-8.9z" }) })),
@@ -42875,35 +42874,65 @@ function BarSpinner(_a) {
42875
42874
  return (jsx("div", Object.assign({ className: `bar-spinner ${className}`, id: id, style: style }, rest, { children: jsx("span", {}) })));
42876
42875
  }
42877
42876
 
42878
- const urlAlphabet =
42879
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
42877
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
42878
+ // require the crypto API and do not support built-in fallback to lower quality random number
42879
+ // generators (like Math.random()).
42880
+ let getRandomValues;
42881
+ const rnds8 = new Uint8Array(16);
42882
+ function rng() {
42883
+ // lazy load so that environments that need to polyfill have a chance to do so
42884
+ if (!getRandomValues) {
42885
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
42886
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
42880
42887
 
42881
- const POOL_SIZE_MULTIPLIER = 128;
42882
- let pool, poolOffset;
42883
- function fillPool(bytes) {
42884
- if (!pool || pool.length < bytes) {
42885
- pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
42886
- webcrypto.getRandomValues(pool);
42887
- poolOffset = 0;
42888
- } else if (poolOffset + bytes > pool.length) {
42889
- webcrypto.getRandomValues(pool);
42890
- poolOffset = 0;
42888
+ if (!getRandomValues) {
42889
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
42890
+ }
42891
42891
  }
42892
- poolOffset += bytes;
42892
+
42893
+ return getRandomValues(rnds8);
42893
42894
  }
42894
- function nanoid(size = 21) {
42895
- fillPool((size |= 0));
42896
- let id = '';
42897
- for (let i = poolOffset - size; i < poolOffset; i++) {
42898
- id += urlAlphabet[pool[i] & 63];
42895
+
42896
+ /**
42897
+ * Convert array of 16 byte values to UUID string format of the form:
42898
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
42899
+ */
42900
+
42901
+ const byteToHex = [];
42902
+
42903
+ for (let i = 0; i < 256; ++i) {
42904
+ byteToHex.push((i + 0x100).toString(16).slice(1));
42905
+ }
42906
+
42907
+ function unsafeStringify(arr, offset = 0) {
42908
+ // Note: Be careful editing this code! It's been tuned for performance
42909
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
42910
+ 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]];
42911
+ }
42912
+
42913
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
42914
+ var native = {
42915
+ randomUUID
42916
+ };
42917
+
42918
+ function v4(options, buf, offset) {
42919
+ if (native.randomUUID && !buf && !options) {
42920
+ return native.randomUUID();
42899
42921
  }
42900
- return id
42922
+
42923
+ options = options || {};
42924
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
42925
+
42926
+ rnds[6] = rnds[6] & 0x0f | 0x40;
42927
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
42928
+
42929
+ return unsafeStringify(rnds);
42901
42930
  }
42902
42931
 
42903
42932
  const Truncate = (_a) => {
42904
42933
  var { lineClamp = 0, truncateString, hasTooltip = true, tooltipId } = _a, rest = __rest(_a, ["lineClamp", "truncateString", "hasTooltip", "tooltipId"]);
42905
42934
  const [isTruncated, setIsTruncated] = useState(false);
42906
- const id = (tooltipId !== null && tooltipId !== void 0 ? tooltipId : nanoid()).replace(/[^a-zA-Z0-9-_]/g, '_');
42935
+ const id = (tooltipId !== null && tooltipId !== void 0 ? tooltipId : v4()).replace(/[^a-zA-Z0-9-_]/g, '_');
42907
42936
  useEffect(() => {
42908
42937
  const checkTruncation = () => {
42909
42938
  const element = document.querySelector(`[data-tooltip-id="${id}"]`);