@dmsi/wedgekit-react 2.1.2 → 3.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ModalButtons.d.ts","sourceRoot":"","sources":["../../src/components/ModalButtons.tsx"],"names":[],"mappings":"AAKA,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,UAAU,EACV,aAAa,EACb,EAAE,EACF,MAAM,EACN,iBAAyB,GAC1B,EAAE,iBAAiB,2CAwCnB"}
1
+ {"version":3,"file":"ModalButtons.d.ts","sourceRoot":"","sources":["../../src/components/ModalButtons.tsx"],"names":[],"mappings":"AAKA,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,UAAU,EACV,aAAa,EACb,EAAE,EACF,MAAM,EACN,iBAAyB,GAC1B,EAAE,iBAAiB,2CAyCnB"}
@@ -1,50 +1,51 @@
1
- import { jsx as e, jsxs as m, Fragment as s } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as m, Fragment as s } from "react/jsx-runtime";
2
2
  import { clsx as u } from "../node_modules/clsx/dist/clsx.js";
3
- import { Button as r } from "./Button.js";
4
- import { Icon as l } from "./Icon.js";
3
+ import { Button as e } from "./Button.js";
4
+ import { Icon as r } from "./Icon.js";
5
5
  import { layoutPaddding as d, layoutGroupGap as f } from "../classNames.js";
6
6
  function y({
7
- onClose: a,
8
- onContinue: i,
9
- customActions: t,
7
+ onClose: l,
8
+ onContinue: a,
9
+ customActions: i,
10
10
  id: o,
11
11
  testid: n,
12
12
  mobileButtonStack: c = !1
13
13
  }) {
14
- return /* @__PURE__ */ e(
14
+ return /* @__PURE__ */ t(
15
15
  "div",
16
16
  {
17
17
  id: o,
18
18
  "data-testid": n,
19
19
  className: u(
20
- "border-t border-neutral-300 flex",
21
- !t && "justify-end",
20
+ "border-t border-neutral-300 flex justify-end",
21
+ // Don't make this conditional on customActions — a w-full custom
22
+ // footer (see CustomFooterContent story) fills the row regardless.
22
23
  c && "flex-col",
23
24
  d,
24
25
  f
25
26
  ),
26
- children: t ?? /* @__PURE__ */ m(s, { children: [
27
- /* @__PURE__ */ e(
28
- r,
27
+ children: i ?? /* @__PURE__ */ m(s, { children: [
28
+ /* @__PURE__ */ t(
29
+ e,
29
30
  {
30
31
  id: o ? `${o}-close-button` : void 0,
31
32
  testid: n ? `${n}-close-button` : void 0,
32
33
  variant: "secondary",
33
- leftIcon: /* @__PURE__ */ e(l, { name: "close", size: 24 }),
34
- onClick: a,
34
+ leftIcon: /* @__PURE__ */ t(r, { name: "close", size: 24 }),
35
+ onClick: l,
35
36
  className: "max-sm:w-full",
36
37
  children: "Close"
37
38
  }
38
39
  ),
39
- /* @__PURE__ */ e(
40
- r,
40
+ /* @__PURE__ */ t(
41
+ e,
41
42
  {
42
43
  id: o ? `${o}-continue-button` : void 0,
43
44
  testid: n ? `${n}-continue-button` : void 0,
44
45
  variant: "primary",
45
- leftIcon: /* @__PURE__ */ e(l, { name: "check", size: 24 }),
46
+ leftIcon: /* @__PURE__ */ t(r, { name: "check", size: 24 }),
46
47
  className: "max-sm:w-full",
47
- onClick: i,
48
+ onClick: a,
48
49
  children: "Continue"
49
50
  }
50
51
  )
@@ -1,5 +1,5 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { usePdf as p } from "../../node_modules/@mikecousins/react-pdf/dist/index.js";
2
+ import { usePdf as p } from "@mikecousins/react-pdf";
3
3
  import { useRef as c } from "react";
4
4
  import { Spinner as s } from "../Spinner.js";
5
5
  import { Stack as f } from "../Stack.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import { usePdf as a } from "../../node_modules/@mikecousins/react-pdf/dist/index.js";
2
+ import { usePdf as a } from "@mikecousins/react-pdf";
3
3
  import { useRef as i } from "react";
4
4
  function p({
5
5
  file: t,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
- "version": "2.1.2",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -21,7 +21,17 @@
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=18.0.0",
24
- "react-dom": ">=18.0.0"
24
+ "react-dom": ">=18.0.0",
25
+ "@mikecousins/react-pdf": "^8.1.0",
26
+ "pdfjs-dist": "^5"
27
+ },
28
+ "peerDependenciesMeta": {
29
+ "@mikecousins/react-pdf": {
30
+ "optional": true
31
+ },
32
+ "pdfjs-dist": {
33
+ "optional": true
34
+ }
25
35
  },
26
36
  "publishConfig": {
27
37
  "access": "public"
@@ -1,83 +0,0 @@
1
- import { useState as I, useRef as n, useEffect as e } from "react";
2
- function i(f) {
3
- return typeof f == "function";
4
- }
5
- const W = ({ canvasRef: f, file: j, onDocumentLoadSuccess: R, onDocumentLoadFail: d, onPageLoadSuccess: w, onPageLoadFail: h, onPageRenderSuccess: v, onPageRenderFail: x, scale: z = 1, rotate: m = 0, page: A = 1, cMapUrl: p, cMapPacked: B, workerSrc: D, withCredentials: G = !1 }) => {
6
- const [o, J] = I(), [K, N] = I(), c = n(null), y = n(null), E = n(R), q = n(d), C = n(w), P = n(h), k = n(v), T = n(x);
7
- return e(() => {
8
- E.current = R;
9
- }, [R]), e(() => {
10
- q.current = d;
11
- }, [d]), e(() => {
12
- C.current = w;
13
- }, [w]), e(() => {
14
- P.current = h;
15
- }, [h]), e(() => {
16
- k.current = v;
17
- }, [v]), e(() => {
18
- T.current = x;
19
- }, [x]), e(() => {
20
- if (typeof window > "u") return;
21
- const u = {
22
- url: j,
23
- withCredentials: G
24
- };
25
- p && (u.cMapUrl = p, u.cMapPacked = B), import("../../../pdfjs-dist/build/pdf.js").then(({ GlobalWorkerOptions: t, getDocument: V, version: s }) => {
26
- t.workerSrc = D, V(u).promise.then((r) => {
27
- J(r), i(E.current) && E.current(r);
28
- }, () => {
29
- i(q.current) && q.current();
30
- });
31
- });
32
- }, [
33
- j,
34
- G,
35
- p,
36
- B,
37
- D
38
- ]), e(() => {
39
- const u = (t) => {
40
- const V = m === 0 ? t.rotate : t.rotate + m, s = t.getViewport({
41
- scale: z,
42
- rotation: V
43
- }), r = f.current;
44
- if (!r) return;
45
- const b = r.getContext("2d");
46
- if (!b) return;
47
- const l = typeof window < "u" ? window.devicePixelRatio : 1;
48
- if (r.height = s.height * l, r.width = s.width * l, b.scale(l, l), c.current) {
49
- y.current = t, c.current.cancel();
50
- return;
51
- }
52
- return c.current = t.render({
53
- canvasContext: b,
54
- canvas: r,
55
- viewport: s
56
- }), c.current.promise.then(() => {
57
- c.current = null, i(k.current) && k.current(t);
58
- }, (H) => {
59
- if (c.current = null, H && H.name === "RenderingCancelledException") {
60
- const O = y.current ?? t;
61
- y.current = null, u(O);
62
- } else i(T.current) && T.current();
63
- });
64
- };
65
- o && o.getPage(A).then((t) => {
66
- N(t), i(C.current) && C.current(t), u(t);
67
- }, () => {
68
- i(P.current) && P.current();
69
- });
70
- }, [
71
- f,
72
- A,
73
- o,
74
- m,
75
- z
76
- ]), {
77
- pdfDocument: o,
78
- pdfPage: K
79
- };
80
- };
81
- export {
82
- W as usePdf
83
- };