@dmsi/wedgekit-react 2.1.1 → 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":"MainBar.d.ts","sourceRoot":"","sources":["../../src/components/MainBar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASlD,KAAK,YAAY,GAAG;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAE/B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oQAAoQ;IACpQ,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAgB,OAAO,CAAC,EACtB,EAAE,EACF,MAAM,EACN,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,KAAK,EACnB,iBAAiB,EAAE,UAAU,EAC7B,kBAAkB,EAAE,WAAW,EAC/B,MAAc,EACd,aAAqB,EACrB,IAAI,GACL,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,YAAY,2CA6DtC"}
1
+ {"version":3,"file":"MainBar.d.ts","sourceRoot":"","sources":["../../src/components/MainBar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASlD,KAAK,YAAY,GAAG;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAE/B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oQAAoQ;IACpQ,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAgB,OAAO,CAAC,EACtB,EAAE,EACF,MAAM,EACN,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,KAAK,EACnB,iBAAiB,EAAE,UAAU,EAC7B,kBAAkB,EAAE,WAAW,EAC/B,MAAc,EACd,aAAqB,EACrB,IAAI,GACL,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,YAAY,2CAkEtC"}
@@ -1,45 +1,48 @@
1
- import { jsx as e, Fragment as f, jsxs as r } from "react/jsx-runtime";
1
+ import { jsx as e, Fragment as h, jsxs as c } from "react/jsx-runtime";
2
2
  import { clsx as n } from "../node_modules/clsx/dist/clsx.js";
3
- import { layoutGap as s, layoutGroupGap as x, containerPaddingX as g, containerPaddingY as u, componentPaddingTopUsingComponentGap2xMobile as b } from "../classNames.js";
4
- function w({
5
- id: c,
6
- testid: l,
7
- leftContent: a,
3
+ import { layoutGap as l, layoutGroupGap as k, containerPaddingX as u, containerPaddingY as g, componentPaddingTopUsingComponentGap2xMobile as b } from "../classNames.js";
4
+ function C({
5
+ id: r,
6
+ testid: m,
7
+ leftContent: s,
8
8
  rightContent: o,
9
9
  mobileLeftContent: i,
10
- mobileRightContent: d,
11
- footer: m = !1,
12
- centerContent: p = !1,
10
+ mobileRightContent: p,
11
+ footer: x = !1,
12
+ centerContent: f = !1,
13
13
  cart: t
14
14
  }) {
15
- return !a && !o ? /* @__PURE__ */ e(f, {}) : /* @__PURE__ */ r(
15
+ const a = !!(s || o || t), d = !!(i || p);
16
+ return !a && !d ? /* @__PURE__ */ e(h, {}) : /* @__PURE__ */ c(
16
17
  "div",
17
18
  {
18
- id: c,
19
- "data-testid": l,
19
+ id: r,
20
+ "data-testid": m,
20
21
  className: n(
21
22
  "min-h-mobile-container-padding",
22
23
  "bg-background-brand-normal items-center justify-between",
23
24
  "z-10 shadow-4",
24
- "flex",
25
- x,
26
- g,
27
- m ? u : p ? "py-[calc((var(--spacing-mobile-component-gap)_+_8px)_/_2)] desktop:py-desktop-component-gap compact:py-desktop-compact-component-gap" : b
25
+ a && d && "flex",
26
+ a && !d && "hidden desktop:flex",
27
+ !a && d && "flex desktop:hidden",
28
+ k,
29
+ u,
30
+ x ? g : f ? "py-[calc((var(--spacing-mobile-component-gap)_+_8px)_/_2)] desktop:py-desktop-component-gap compact:py-desktop-compact-component-gap" : b
28
31
  ),
29
32
  children: [
30
- a && /* @__PURE__ */ e(
33
+ s && /* @__PURE__ */ e(
31
34
  "div",
32
35
  {
33
- className: n("hidden desktop:flex items-center flex-1 min-w-0 overflow-x-auto no-scrollbar", s),
34
- children: a
36
+ className: n("hidden desktop:flex items-center flex-1 min-w-0 overflow-x-auto no-scrollbar", l),
37
+ children: s
35
38
  }
36
39
  ),
37
- (o || t) && /* @__PURE__ */ r(
40
+ (o || t) && /* @__PURE__ */ c(
38
41
  "div",
39
42
  {
40
43
  className: n(
41
44
  "hidden desktop:flex items-center ml-auto",
42
- s
45
+ l
43
46
  ),
44
47
  children: [
45
48
  o,
@@ -49,11 +52,11 @@ function w({
49
52
  }
50
53
  ),
51
54
  i && /* @__PURE__ */ e("div", { className: n("flex items-center desktop:hidden flex-1 min-w-0 overflow-x-auto no-scrollbar"), children: i }),
52
- d && /* @__PURE__ */ e("div", { className: n("flex items-center desktop:hidden"), children: d })
55
+ p && /* @__PURE__ */ e("div", { className: n("flex items-center desktop:hidden"), children: p })
53
56
  ]
54
57
  }
55
58
  );
56
59
  }
57
60
  export {
58
- w as MainBar
61
+ C as MainBar
59
62
  };
@@ -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.1",
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
- };