@dmsi/wedgekit-react 0.0.161 → 0.0.163

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,6 +1,6 @@
1
1
  import {
2
2
  Menu
3
- } from "./chunk-RLK4TBXR.js";
3
+ } from "./chunk-UBU6IJML.js";
4
4
  import {
5
5
  useSubMenuSystem
6
6
  } from "./chunk-5GUW4DUY.js";
@@ -323,7 +323,7 @@ function DataCellHeader(_a) {
323
323
  children: "Filter"
324
324
  })
325
325
  ),
326
- !predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ jsxs(
326
+ !predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ jsx(
327
327
  MenuOption,
328
328
  __spreadProps(__spreadValues({
329
329
  onClick: () => {
@@ -374,11 +374,7 @@ function DataCellHeader(_a) {
374
374
  })
375
375
  );
376
376
  },
377
- children: [
378
- "Freeze [",
379
- header.column.columnDef.header,
380
- "]"
381
- ]
377
+ children: `Freeze [${header.column.columnDef.header}]`
382
378
  })
383
379
  )
384
380
  ]
@@ -40,7 +40,8 @@ var Menu = (_a) => {
40
40
  mobileHide,
41
41
  useDefaultMinWidth,
42
42
  autoFocusOff,
43
- menuName
43
+ menuName,
44
+ calculateMinMaxHeight
44
45
  } = _b, props = __objRest(_b, [
45
46
  "id",
46
47
  "testid",
@@ -58,7 +59,8 @@ var Menu = (_a) => {
58
59
  "mobileHide",
59
60
  "useDefaultMinWidth",
60
61
  "autoFocusOff",
61
- "menuName"
62
+ "menuName",
63
+ "calculateMinMaxHeight"
62
64
  ]);
63
65
  const internalRef = useRef(null);
64
66
  const actualRef = ref || internalRef;
@@ -75,8 +77,11 @@ var Menu = (_a) => {
75
77
  }
76
78
  );
77
79
  useEffect(() => {
80
+ if (calculateMinMaxHeight) {
81
+ return;
82
+ }
78
83
  const raf = requestAnimationFrame(() => {
79
- if (!actualRef || !actualRef.current || customMaxHeight) {
84
+ if (!actualRef.current || customMaxHeight) {
80
85
  return;
81
86
  }
82
87
  if (actualRef.current.childElementCount > 4) {
@@ -94,7 +99,18 @@ var Menu = (_a) => {
94
99
  return () => {
95
100
  cancelAnimationFrame(raf);
96
101
  };
97
- }, [actualRef, customMaxHeight]);
102
+ }, [actualRef.current, customMaxHeight, calculateMinMaxHeight]);
103
+ useEffect(() => {
104
+ if (!calculateMinMaxHeight) {
105
+ return;
106
+ }
107
+ if ((positionTo == null ? void 0 : positionTo.current) && actualRef.current) {
108
+ const positionToRect = positionTo.current.getBoundingClientRect();
109
+ const offsetInPx = 16;
110
+ const calculatedMaxHeight = window.innerHeight - positionToRect.bottom - offsetInPx;
111
+ setMaxHeight(`${calculatedMaxHeight}px`);
112
+ }
113
+ }, [actualRef.current, positionTo == null ? void 0 : positionTo.current, calculateMinMaxHeight]);
98
114
  useEffect(() => {
99
115
  if (!show) {
100
116
  return;
@@ -1228,7 +1228,8 @@ var Menu = (_a) => {
1228
1228
  mobileHide,
1229
1229
  useDefaultMinWidth,
1230
1230
  autoFocusOff,
1231
- menuName
1231
+ menuName,
1232
+ calculateMinMaxHeight
1232
1233
  } = _b, props = __objRest(_b, [
1233
1234
  "id",
1234
1235
  "testid",
@@ -1246,7 +1247,8 @@ var Menu = (_a) => {
1246
1247
  "mobileHide",
1247
1248
  "useDefaultMinWidth",
1248
1249
  "autoFocusOff",
1249
- "menuName"
1250
+ "menuName",
1251
+ "calculateMinMaxHeight"
1250
1252
  ]);
1251
1253
  const internalRef = (0, import_react8.useRef)(null);
1252
1254
  const actualRef = ref || internalRef;
@@ -1263,8 +1265,11 @@ var Menu = (_a) => {
1263
1265
  }
1264
1266
  );
1265
1267
  (0, import_react8.useEffect)(() => {
1268
+ if (calculateMinMaxHeight) {
1269
+ return;
1270
+ }
1266
1271
  const raf = requestAnimationFrame(() => {
1267
- if (!actualRef || !actualRef.current || customMaxHeight) {
1272
+ if (!actualRef.current || customMaxHeight) {
1268
1273
  return;
1269
1274
  }
1270
1275
  if (actualRef.current.childElementCount > 4) {
@@ -1282,7 +1287,18 @@ var Menu = (_a) => {
1282
1287
  return () => {
1283
1288
  cancelAnimationFrame(raf);
1284
1289
  };
1285
- }, [actualRef, customMaxHeight]);
1290
+ }, [actualRef.current, customMaxHeight, calculateMinMaxHeight]);
1291
+ (0, import_react8.useEffect)(() => {
1292
+ if (!calculateMinMaxHeight) {
1293
+ return;
1294
+ }
1295
+ if ((positionTo == null ? void 0 : positionTo.current) && actualRef.current) {
1296
+ const positionToRect = positionTo.current.getBoundingClientRect();
1297
+ const offsetInPx = 16;
1298
+ const calculatedMaxHeight = window.innerHeight - positionToRect.bottom - offsetInPx;
1299
+ setMaxHeight(`${calculatedMaxHeight}px`);
1300
+ }
1301
+ }, [actualRef.current, positionTo == null ? void 0 : positionTo.current, calculateMinMaxHeight]);
1286
1302
  (0, import_react8.useEffect)(() => {
1287
1303
  if (!show) {
1288
1304
  return;
@@ -1961,7 +1977,7 @@ function DataCellHeader(_a) {
1961
1977
  children: "Filter"
1962
1978
  })
1963
1979
  ),
1964
- !predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1980
+ !predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1965
1981
  MenuOption,
1966
1982
  __spreadProps(__spreadValues({
1967
1983
  onClick: () => {
@@ -2012,11 +2028,7 @@ function DataCellHeader(_a) {
2012
2028
  })
2013
2029
  );
2014
2030
  },
2015
- children: [
2016
- "Freeze [",
2017
- header.column.columnDef.header,
2018
- "]"
2019
- ]
2031
+ children: `Freeze [${header.column.columnDef.header}]`
2020
2032
  })
2021
2033
  )
2022
2034
  ]
@@ -4,8 +4,8 @@ import {
4
4
  DataGridCell,
5
5
  DragAlongCell,
6
6
  DraggableCellHeader
7
- } from "../chunk-SBSHZ327.js";
8
- import "../chunk-RLK4TBXR.js";
7
+ } from "../chunk-O4JGGMFE.js";
8
+ import "../chunk-UBU6IJML.js";
9
9
  import "../chunk-5GUW4DUY.js";
10
10
  import "../chunk-FFU6FB3K.js";
11
11
  import "../chunk-WNQ53SVY.js";
@@ -1,7 +1,12 @@
1
- import {
2
- HorizontalDivider
3
- } from "../chunk-EPQLWHCL.js";
4
1
  import "../chunk-ORMEWXMH.js";
2
+
3
+ // src/components/HorizontalDivider.tsx
4
+ import clsx from "clsx";
5
+ import { jsx } from "react/jsx-runtime";
6
+ function HorizontalDivider({ id, testid, hideOnMobile }) {
7
+ const hideOnMobileStyle = clsx(hideOnMobile && "hidden desktop:block");
8
+ return /* @__PURE__ */ jsx("hr", { id, "data-testid": testid, className: clsx("w-full border-t border-border-primary-normal", hideOnMobileStyle) });
9
+ }
5
10
  export {
6
11
  HorizontalDivider
7
12
  };
@@ -221,7 +221,8 @@ var Menu = (_a) => {
221
221
  mobileHide,
222
222
  useDefaultMinWidth,
223
223
  autoFocusOff,
224
- menuName
224
+ menuName,
225
+ calculateMinMaxHeight
225
226
  } = _b, props = __objRest(_b, [
226
227
  "id",
227
228
  "testid",
@@ -239,7 +240,8 @@ var Menu = (_a) => {
239
240
  "mobileHide",
240
241
  "useDefaultMinWidth",
241
242
  "autoFocusOff",
242
- "menuName"
243
+ "menuName",
244
+ "calculateMinMaxHeight"
243
245
  ]);
244
246
  const internalRef = (0, import_react5.useRef)(null);
245
247
  const actualRef = ref || internalRef;
@@ -256,8 +258,11 @@ var Menu = (_a) => {
256
258
  }
257
259
  );
258
260
  (0, import_react5.useEffect)(() => {
261
+ if (calculateMinMaxHeight) {
262
+ return;
263
+ }
259
264
  const raf = requestAnimationFrame(() => {
260
- if (!actualRef || !actualRef.current || customMaxHeight) {
265
+ if (!actualRef.current || customMaxHeight) {
261
266
  return;
262
267
  }
263
268
  if (actualRef.current.childElementCount > 4) {
@@ -275,7 +280,18 @@ var Menu = (_a) => {
275
280
  return () => {
276
281
  cancelAnimationFrame(raf);
277
282
  };
278
- }, [actualRef, customMaxHeight]);
283
+ }, [actualRef.current, customMaxHeight, calculateMinMaxHeight]);
284
+ (0, import_react5.useEffect)(() => {
285
+ if (!calculateMinMaxHeight) {
286
+ return;
287
+ }
288
+ if ((positionTo == null ? void 0 : positionTo.current) && actualRef.current) {
289
+ const positionToRect = positionTo.current.getBoundingClientRect();
290
+ const offsetInPx = 16;
291
+ const calculatedMaxHeight = window.innerHeight - positionToRect.bottom - offsetInPx;
292
+ setMaxHeight(`${calculatedMaxHeight}px`);
293
+ }
294
+ }, [actualRef.current, positionTo == null ? void 0 : positionTo.current, calculateMinMaxHeight]);
279
295
  (0, import_react5.useEffect)(() => {
280
296
  if (!show) {
281
297
  return;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Menu
4
- } from "../chunk-RLK4TBXR.js";
4
+ } from "../chunk-UBU6IJML.js";
5
5
  import "../chunk-5GUW4DUY.js";
6
6
  import "../chunk-WNQ53SVY.js";
7
7
  import "../chunk-6LN6QT6M.js";
@@ -1,10 +1,138 @@
1
1
  "use client";
2
2
  import {
3
- Radio
4
- } from "../chunk-BATIOCXB.js";
5
- import "../chunk-HVI3CL7Y.js";
6
- import "../chunk-RDLEIAQU.js";
7
- import "../chunk-ORMEWXMH.js";
3
+ Paragraph
4
+ } from "../chunk-HVI3CL7Y.js";
5
+ import {
6
+ baseTransition,
7
+ componentGap
8
+ } from "../chunk-RDLEIAQU.js";
9
+ import {
10
+ __objRest,
11
+ __spreadValues
12
+ } from "../chunk-ORMEWXMH.js";
13
+
14
+ // src/components/Radio.tsx
15
+ import clsx from "clsx";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ var Radio = (_a) => {
18
+ var _b = _a, {
19
+ className,
20
+ label,
21
+ error,
22
+ disabled,
23
+ checked,
24
+ readOnly,
25
+ id,
26
+ testid
27
+ } = _b, props = __objRest(_b, [
28
+ "className",
29
+ "label",
30
+ "error",
31
+ "disabled",
32
+ "checked",
33
+ "readOnly",
34
+ "id",
35
+ "testid"
36
+ ]);
37
+ const radioId = id;
38
+ const paragraphColor = disabled ? "text-primary-disabled" : error ? "text-primary-error" : "text-primary-normal";
39
+ const defaultClassName = clsx(
40
+ !error && !disabled && "border-border-primary-normal peer-hover:border-border-action-hover peer-hover:bg-background-action-secondary-hover peer-focus:border-border-action-hover peer-focus:bg-background-action-secondary-hover peer-active:border-border-action-active peer-active:bg-background-action-secondary-active peer-checked:border-0 peer-checked:bg-background-action-secondary-hover"
41
+ );
42
+ const errorClassName = clsx(
43
+ error && !disabled && "border-border-action-critical-normal peer-hover:border-border-action-critical-hover peer-hover:bg-background-action-critical-secondary-hover peer-focus:border-border-action-critical-hover peer-focus:bg-background-action-critical-secondary-hover peer-active:border-border-action-critical-active peer-active:bg-background-action-secondary-active peer-checked:bg-background-action-critical-secondary-hover peer-checked:border-0 "
44
+ );
45
+ const disabledClassName = clsx(
46
+ disabled && "peer-disabled:bg-background-action-secondary-disabled peer-disabled:border-border-primary-normal peer-checked:border-0"
47
+ );
48
+ const readonlyClassName = clsx(
49
+ readOnly && "peer-read-only:bg-background-action-secondary-disabled peer-read-only:border-border-primary-normal peer-checked:border-0"
50
+ );
51
+ return /* @__PURE__ */ jsxs(
52
+ "label",
53
+ {
54
+ htmlFor: radioId,
55
+ className: clsx(
56
+ "flex items-center",
57
+ componentGap,
58
+ disabled ? "cursor-default" : "cursor-pointer",
59
+ className
60
+ ),
61
+ children: [
62
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
63
+ /* @__PURE__ */ jsx(
64
+ "input",
65
+ __spreadValues({
66
+ id: radioId,
67
+ "data-testid": testid,
68
+ type: "radio",
69
+ className: "sr-only peer",
70
+ disabled,
71
+ checked,
72
+ readOnly
73
+ }, props)
74
+ ),
75
+ /* @__PURE__ */ jsx(
76
+ "div",
77
+ {
78
+ className: clsx(
79
+ "size-6 rounded-full border flex items-center justify-center",
80
+ baseTransition,
81
+ defaultClassName,
82
+ errorClassName,
83
+ disabledClassName,
84
+ readonlyClassName
85
+ ),
86
+ children: checked && /* @__PURE__ */ jsx(
87
+ RadioIcon,
88
+ {
89
+ className: clsx(
90
+ "transition-colors",
91
+ !error && !disabled && "text-icon-on-action-secondary-normal hover:text-icon-on-action-secondary-hover active:text-icon-on-action-secondary-active peer-hover:text-icon-on-action-secondary-hover peer-focus:text-icon-on-action-secondary-hover peer-active:text-icon-on-action-secondary-active",
92
+ error && !disabled && "text-icon-action-critical-secondary-normal hover:text-icon-action-critical-secondary-hover active:text-icon-action-critical-secondary-active peer-hover:text-icon-action-critical-secondary-hover peer-focus:text-icon-action-critical-secondary-hover peer-active:text-icon-action-critical-secondary-active",
93
+ disabled && "text-icon-on-action-secondary-disabled",
94
+ readOnly && "text-icon-on-action-secondary-disabled"
95
+ )
96
+ }
97
+ )
98
+ }
99
+ )
100
+ ] }),
101
+ label && /* @__PURE__ */ jsx(Paragraph, { id: radioId ? `${radioId}-label` : void 0, testid: testid ? `${testid}-label` : void 0, padded: true, color: paragraphColor, children: label })
102
+ ]
103
+ }
104
+ );
105
+ };
106
+ Radio.displayName = "Radio";
107
+ var RadioIcon = ({ className }) => {
108
+ return /* @__PURE__ */ jsxs(
109
+ "svg",
110
+ {
111
+ className,
112
+ xmlns: "http://www.w3.org/2000/svg",
113
+ width: "24",
114
+ height: "24",
115
+ viewBox: "0 0 24 24",
116
+ fill: "none",
117
+ children: [
118
+ /* @__PURE__ */ jsx(
119
+ "rect",
120
+ {
121
+ x: "1",
122
+ y: "1",
123
+ width: "22",
124
+ height: "22",
125
+ rx: "11",
126
+ stroke: "currentColor",
127
+ strokeWidth: "2"
128
+ }
129
+ ),
130
+ /* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "16", height: "16", rx: "8", fill: "currentColor" })
131
+ ]
132
+ }
133
+ );
134
+ };
135
+ RadioIcon.displayName = "RadioIcon";
8
136
  export {
9
137
  Radio
10
138
  };
@@ -1,8 +1,11 @@
1
1
  "use client";
2
- import {
3
- WorldpayIframe
4
- } from "../chunk-WFGKIR5A.js";
5
2
  import "../chunk-ORMEWXMH.js";
3
+
4
+ // src/components/WorldpayIframe.tsx
5
+ import { jsx } from "react/jsx-runtime";
6
+ function WorldpayIframe({ url }) {
7
+ return /* @__PURE__ */ jsx("iframe", { src: url, style: { width: "100%", height: "100%", flex: 1 } });
8
+ }
6
9
  export {
7
10
  WorldpayIframe
8
11
  };