@scbt-ecom/ui 0.82.0 → 0.82.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.
@@ -0,0 +1 @@
1
+ export declare const assertUnreachable: (x: never, msg?: string) => never;
@@ -7,3 +7,4 @@ export { mergeRefs } from './mergeRefs';
7
7
  export { TypeGuards } from './typeGuards';
8
8
  export { getUuid } from './uuid';
9
9
  export { localStorageActions } from './localStorageActions';
10
+ export { assertUnreachable } from './assertUnreachable';
package/dist/utils.js CHANGED
@@ -1,44 +1,47 @@
1
- import { a as U, c as x, l as b, s as h } from "./localStorageActions-DRn18qhh.js";
2
- import { T as R, c as D } from "./typeGuards-CSiImkUY.js";
3
- import { i as S } from "./isClient-C9aZtt2Q.js";
4
- import { m as V } from "./mergeRefs-qDToYXtM.js";
1
+ import { a as x, c as h, l as b, s as w } from "./localStorageActions-DRn18qhh.js";
2
+ import { T as D, c as I } from "./typeGuards-CSiImkUY.js";
3
+ import { i as T } from "./isClient-C9aZtt2Q.js";
4
+ import { m as v } from "./mergeRefs-qDToYXtM.js";
5
5
  const t = [];
6
- for (let n = 0; n < 256; ++n)
7
- t.push((n + 256).toString(16).slice(1));
8
- function d(n, e = 0) {
9
- return (t[n[e + 0]] + t[n[e + 1]] + t[n[e + 2]] + t[n[e + 3]] + "-" + t[n[e + 4]] + t[n[e + 5]] + "-" + t[n[e + 6]] + t[n[e + 7]] + "-" + t[n[e + 8]] + t[n[e + 9]] + "-" + t[n[e + 10]] + t[n[e + 11]] + t[n[e + 12]] + t[n[e + 13]] + t[n[e + 14]] + t[n[e + 15]]).toLowerCase();
6
+ for (let e = 0; e < 256; ++e)
7
+ t.push((e + 256).toString(16).slice(1));
8
+ function a(e, n = 0) {
9
+ return (t[e[n + 0]] + t[e[n + 1]] + t[e[n + 2]] + t[e[n + 3]] + "-" + t[e[n + 4]] + t[e[n + 5]] + "-" + t[e[n + 6]] + t[e[n + 7]] + "-" + t[e[n + 8]] + t[e[n + 9]] + "-" + t[e[n + 10]] + t[e[n + 11]] + t[e[n + 12]] + t[e[n + 13]] + t[e[n + 14]] + t[e[n + 15]]).toLowerCase();
10
10
  }
11
11
  let r;
12
- const m = new Uint8Array(16);
13
- function a() {
12
+ const d = new Uint8Array(16);
13
+ function s() {
14
14
  if (!r) {
15
15
  if (typeof crypto > "u" || !crypto.getRandomValues)
16
16
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
17
17
  r = crypto.getRandomValues.bind(crypto);
18
18
  }
19
- return r(m);
19
+ return r(d);
20
20
  }
21
- const i = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), c = { randomUUID: i };
22
- function l(n, e, p) {
23
- var u;
24
- if (c.randomUUID && !n)
25
- return c.randomUUID();
26
- n = n || {};
27
- const o = n.random ?? ((u = n.rng) == null ? void 0 : u.call(n)) ?? a();
21
+ const l = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), u = { randomUUID: l };
22
+ function m(e, n, i) {
23
+ var c;
24
+ if (u.randomUUID && !e)
25
+ return u.randomUUID();
26
+ e = e || {};
27
+ const o = e.random ?? ((c = e.rng) == null ? void 0 : c.call(e)) ?? s();
28
28
  if (o.length < 16)
29
29
  throw new Error("Random bytes length must be >= 16");
30
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, d(o);
30
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, a(o);
31
31
  }
32
- const y = () => l();
32
+ const p = () => m(), y = (e, n) => {
33
+ console.error(n ?? "process all the cases");
34
+ };
33
35
  export {
34
- R as TypeGuards,
35
- U as capitalize,
36
- D as cn,
37
- x as createPhoneNumber,
38
- y as getUuid,
39
- S as isClient,
36
+ D as TypeGuards,
37
+ y as assertUnreachable,
38
+ x as capitalize,
39
+ I as cn,
40
+ h as createPhoneNumber,
41
+ p as getUuid,
42
+ T as isClient,
40
43
  b as localStorageActions,
41
- V as mergeRefs,
42
- h as scrollToElement
44
+ v as mergeRefs,
45
+ w as scrollToElement
43
46
  };
44
47
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../node_modules/uuid/dist/esm-browser/stringify.js","../node_modules/uuid/dist/esm-browser/rng.js","../node_modules/uuid/dist/esm-browser/native.js","../node_modules/uuid/dist/esm-browser/v4.js","../lib/shared/utils/uuid.ts"],"sourcesContent":["import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n","let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n getRandomValues = crypto.getRandomValues.bind(crypto);\n }\n return getRandomValues(rnds8);\n}\n","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random ?? options.rng?.() ?? rng();\n if (rnds.length < 16) {\n throw new Error('Random bytes length must be >= 16');\n }\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n if (offset < 0 || offset + 16 > buf.length) {\n throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n }\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n","import { v4 as uuid } from 'uuid'\n\nexport const getUuid = () => uuid()\n"],"names":["byteToHex","i","unsafeStringify","arr","offset","getRandomValues","rnds8","rng","randomUUID","native","v4","options","buf","rnds","_a","getUuid","uuid"],"mappings":";;;;AACA,MAAMA,IAAY,CAAE;AACpB,SAASC,IAAI,GAAGA,IAAI,KAAK,EAAEA;AACvB,EAAAD,EAAU,MAAMC,IAAI,KAAO,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAE7C,SAASC,EAAgBC,GAAKC,IAAS,GAAG;AAC7C,UAAQJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAC7BJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAA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../node_modules/uuid/dist/esm-browser/native.js","../node_modules/uuid/dist/esm-browser/v4.js","../lib/shared/utils/uuid.ts","../lib/shared/utils/assertUnreachable.ts"],"sourcesContent":["import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n","let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n getRandomValues = crypto.getRandomValues.bind(crypto);\n }\n return getRandomValues(rnds8);\n}\n","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random ?? options.rng?.() ?? rng();\n if (rnds.length < 16) {\n throw new Error('Random bytes length must be >= 16');\n }\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n if (offset < 0 || offset + 16 > buf.length) {\n throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n }\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n","import { v4 as uuid } from 'uuid'\n\nexport const getUuid = () => uuid()\n","// @ts-expect-error - x\nexport const assertUnreachable = (x: never, msg?: string): never => {\n console.error(msg ?? 'process all the cases')\n}\n"],"names":["byteToHex","i","unsafeStringify","arr","offset","getRandomValues","rnds8","rng","randomUUID","native","v4","options","buf","rnds","_a","getUuid","uuid","assertUnreachable","x","msg"],"mappings":";;;;AACA,MAAMA,IAAY,CAAE;AACpB,SAASC,IAAI,GAAGA,IAAI,KAAK,EAAEA;AACvB,EAAAD,EAAU,MAAMC,IAAI,KAAO,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAE7C,SAASC,EAAgBC,GAAKC,IAAS,GAAG;AAC7C,UAAQJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAC7BJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAA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4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -61,7 +61,6 @@
61
61
  "cypress:open": "cypress open --component --browser chrome",
62
62
  "cypress-ci": "cypress run --component --browser chrome",
63
63
  "pre-commit": "npm run lint",
64
- "prepare": "lefthook install",
65
64
  "chromatic": "npx chromatic --project-token=chpt_9468dafcf1bf3e3 --only-changed --files='src/stories/**/*.stories.@(tsx)'",
66
65
  "pre-deploy": "npm run lint ",
67
66
  "ts-check": "pnpm exec tsc"