@caspeco/casper-ui-library 8.0.3 → 8.2.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.
@@ -16,5 +16,5 @@ export declare const IconButton: import('react').ForwardRefExoticComponent<{
16
16
  type?: "submit" | "reset" | "button" | undefined | undefined;
17
17
  isDisabled?: boolean | undefined;
18
18
  isLoading?: boolean | undefined;
19
- } & import('../../index.js').CustomChakraBoxProps & import('../../index.js').MarginProps & import('../../index.js').PaddingProps & import('react').RefAttributes<HTMLButtonElement>>;
19
+ } & import('../../index.js').CustomChakraBoxProps & import('../../index.js').MarginProps & import('../../index.js').PaddingProps & import('../../index.js').ShadowProps & import('react').RefAttributes<HTMLButtonElement>>;
20
20
  //# sourceMappingURL=icon-button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../lib/components/icon-button/icon-button.tsx"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;yJAetB,CAAC"}
1
+ {"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../lib/components/icon-button/icon-button.tsx"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;uLAetB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { ButtonSize } from '../button/types.js';
2
2
  import { Icons } from '../icon/index.js';
3
- import { CustomChakraBoxProps, MarginProps, PaddingProps } from '../../theme/index.js';
3
+ import { CustomChakraBoxProps, MarginProps, PaddingProps, ShadowProps } from '../../theme/index.js';
4
4
  import { IconButtonProps as ChakraIconButtonProps, ResponsiveArray, ResponsiveValue } from '@chakra-ui/react';
5
5
  import { ButtonProps } from '../button/index.js';
6
- type CustomStyleProps = CustomChakraBoxProps & MarginProps & PaddingProps;
6
+ type CustomStyleProps = CustomChakraBoxProps & MarginProps & PaddingProps & ShadowProps;
7
7
  type CustomProperties = {
8
8
  /**
9
9
  * The icon to be displayed in the button. The Icons enum can be found in the Icon component.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/icon-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,EACX,eAAe,IAAI,qBAAqB,EACxC,eAAe,EACf,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,GAAG,YAAY,CAAC;AAE1E,KAAK,gBAAgB,GAAG;IACvB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAChB,WAAW,CAAC,SAAS,CAAC,EACtB,MAAM,GAAG,kBAAkB,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CACzF,CAAC;IACF;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;CACnC,CAAC;AAEF,KAAK,0BAA0B,GAAG,IAAI,CACrC,qBAAqB,EACrB,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,CAC5E,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,0BAA0B,GAAG,gBAAgB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/icon-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,KAAK,EACX,eAAe,IAAI,qBAAqB,EACxC,eAAe,EACf,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;AAExF,KAAK,gBAAgB,GAAG;IACvB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAChB,WAAW,CAAC,SAAS,CAAC,EACtB,MAAM,GAAG,kBAAkB,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CACzF,CAAC;IACF;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;CACnC,CAAC;AAEF,KAAK,0BAA0B,GAAG,IAAI,CACrC,qBAAqB,EACrB,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,CAC5E,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,0BAA0B,GAAG,gBAAgB,CAAC"}
@@ -1,21 +1,21 @@
1
- import { evaluate as Y, getSide as L, getSideAxis as E, getOppositePlacement as q, getExpandedPlacements as z, getOppositeAxisPlacements as G, getAlignmentSides as H, getAlignmentAxis as J, getAlignment as K, getPaddingObject as N, rectToClientRect as M, getAxisLength as Q } from "../../utils/dist/floating-ui.utils.js";
2
- function X(r, l, u) {
1
+ import { evaluate as Y, getSide as F, getSideAxis as S, getOppositePlacement as z, getExpandedPlacements as G, getOppositeAxisPlacements as H, getAlignmentSides as J, getAlignmentAxis as K, getAlignment as N, getPaddingObject as Q, rectToClientRect as M, getAxisLength as U } from "../../utils/dist/floating-ui.utils.js";
2
+ function X(c, l, u) {
3
3
  let {
4
4
  reference: e,
5
5
  floating: a
6
- } = r;
7
- const t = E(l), o = J(l), n = Q(o), p = L(l), d = t === "y", f = e.x + e.width / 2 - a.width / 2, s = e.y + e.height / 2 - a.height / 2, m = e[n] / 2 - a[n] / 2;
6
+ } = c;
7
+ const t = S(l), o = K(l), n = U(o), m = F(l), d = t === "y", r = e.x + e.width / 2 - a.width / 2, s = e.y + e.height / 2 - a.height / 2, f = e[n] / 2 - a[n] / 2;
8
8
  let i;
9
- switch (p) {
9
+ switch (m) {
10
10
  case "top":
11
11
  i = {
12
- x: f,
12
+ x: r,
13
13
  y: e.y - a.height
14
14
  };
15
15
  break;
16
16
  case "bottom":
17
17
  i = {
18
- x: f,
18
+ x: r,
19
19
  y: e.y + e.height
20
20
  };
21
21
  break;
@@ -37,126 +37,129 @@ function X(r, l, u) {
37
37
  y: e.y
38
38
  };
39
39
  }
40
- switch (K(l)) {
40
+ switch (N(l)) {
41
41
  case "start":
42
- i[o] -= m * (u && d ? -1 : 1);
42
+ i[o] -= f * (u && d ? -1 : 1);
43
43
  break;
44
44
  case "end":
45
- i[o] += m * (u && d ? -1 : 1);
45
+ i[o] += f * (u && d ? -1 : 1);
46
46
  break;
47
47
  }
48
48
  return i;
49
49
  }
50
- const Z = async (r, l, u) => {
50
+ async function W(c, l) {
51
+ var u;
52
+ l === void 0 && (l = {});
53
+ const {
54
+ x: e,
55
+ y: a,
56
+ platform: t,
57
+ rects: o,
58
+ elements: n,
59
+ strategy: m
60
+ } = c, {
61
+ boundary: d = "clippingAncestors",
62
+ rootBoundary: r = "viewport",
63
+ elementContext: s = "floating",
64
+ altBoundary: f = !1,
65
+ padding: i = 0
66
+ } = Y(l, c), w = Q(i), p = n[f ? s === "floating" ? "reference" : "floating" : s], h = M(await t.getClippingRect({
67
+ element: (u = await (t.isElement == null ? void 0 : t.isElement(p))) == null || u ? p : p.contextElement || await (t.getDocumentElement == null ? void 0 : t.getDocumentElement(n.floating)),
68
+ boundary: d,
69
+ rootBoundary: r,
70
+ strategy: m
71
+ })), b = s === "floating" ? {
72
+ x: e,
73
+ y: a,
74
+ width: o.floating.width,
75
+ height: o.floating.height
76
+ } : o.reference, A = await (t.getOffsetParent == null ? void 0 : t.getOffsetParent(n.floating)), x = await (t.isElement == null ? void 0 : t.isElement(A)) ? await (t.getScale == null ? void 0 : t.getScale(A)) || {
77
+ x: 1,
78
+ y: 1
79
+ } : {
80
+ x: 1,
81
+ y: 1
82
+ }, y = M(t.convertOffsetParentRelativeRectToViewportRelativeRect ? await t.convertOffsetParentRelativeRectToViewportRelativeRect({
83
+ elements: n,
84
+ rect: b,
85
+ offsetParent: A,
86
+ strategy: m
87
+ }) : b);
88
+ return {
89
+ top: (h.top - y.top + w.top) / x.y,
90
+ bottom: (y.bottom - h.bottom + w.bottom) / x.y,
91
+ left: (h.left - y.left + w.left) / x.x,
92
+ right: (y.right - h.right + w.right) / x.x
93
+ };
94
+ }
95
+ const $ = async (c, l, u) => {
51
96
  const {
52
97
  placement: e = "bottom",
53
98
  strategy: a = "absolute",
54
99
  middleware: t = [],
55
100
  platform: o
56
- } = u, n = t.filter(Boolean), p = await (o.isRTL == null ? void 0 : o.isRTL(l));
101
+ } = u, n = t.filter(Boolean), m = await (o.isRTL == null ? void 0 : o.isRTL(l));
57
102
  let d = await o.getElementRects({
58
- reference: r,
103
+ reference: c,
59
104
  floating: l,
60
105
  strategy: a
61
106
  }), {
62
- x: f,
107
+ x: r,
63
108
  y: s
64
- } = X(d, e, p), m = e, i = {}, w = 0;
65
- for (let h = 0; h < n.length; h++) {
109
+ } = X(d, e, m), f = e, i = {}, w = 0;
110
+ for (let p = 0; p < n.length; p++) {
111
+ var O;
66
112
  const {
67
- name: y,
113
+ name: h,
68
114
  fn: b
69
- } = n[h], {
70
- x,
71
- y: A,
72
- data: v,
73
- reset: c
115
+ } = n[p], {
116
+ x: A,
117
+ y: x,
118
+ data: y,
119
+ reset: v
74
120
  } = await b({
75
- x: f,
121
+ x: r,
76
122
  y: s,
77
123
  initialPlacement: e,
78
- placement: m,
124
+ placement: f,
79
125
  strategy: a,
80
126
  middlewareData: i,
81
127
  rects: d,
82
- platform: o,
128
+ platform: {
129
+ ...o,
130
+ detectOverflow: (O = o.detectOverflow) != null ? O : W
131
+ },
83
132
  elements: {
84
- reference: r,
133
+ reference: c,
85
134
  floating: l
86
135
  }
87
136
  });
88
- f = x ?? f, s = A ?? s, i = {
137
+ r = A ?? r, s = x ?? s, i = {
89
138
  ...i,
90
- [y]: {
91
- ...i[y],
92
- ...v
139
+ [h]: {
140
+ ...i[h],
141
+ ...y
93
142
  }
94
- }, c && w <= 50 && (w++, typeof c == "object" && (c.placement && (m = c.placement), c.rects && (d = c.rects === !0 ? await o.getElementRects({
95
- reference: r,
143
+ }, v && w <= 50 && (w++, typeof v == "object" && (v.placement && (f = v.placement), v.rects && (d = v.rects === !0 ? await o.getElementRects({
144
+ reference: c,
96
145
  floating: l,
97
146
  strategy: a
98
- }) : c.rects), {
99
- x: f,
147
+ }) : v.rects), {
148
+ x: r,
100
149
  y: s
101
- } = X(d, m, p)), h = -1);
150
+ } = X(d, f, m)), p = -1);
102
151
  }
103
152
  return {
104
- x: f,
153
+ x: r,
105
154
  y: s,
106
- placement: m,
155
+ placement: f,
107
156
  strategy: a,
108
157
  middlewareData: i
109
158
  };
110
- };
111
- async function U(r, l) {
112
- var u;
113
- l === void 0 && (l = {});
114
- const {
115
- x: e,
116
- y: a,
117
- platform: t,
118
- rects: o,
119
- elements: n,
120
- strategy: p
121
- } = r, {
122
- boundary: d = "clippingAncestors",
123
- rootBoundary: f = "viewport",
124
- elementContext: s = "floating",
125
- altBoundary: m = !1,
126
- padding: i = 0
127
- } = Y(l, r), w = N(i), y = n[m ? s === "floating" ? "reference" : "floating" : s], b = M(await t.getClippingRect({
128
- element: (u = await (t.isElement == null ? void 0 : t.isElement(y))) == null || u ? y : y.contextElement || await (t.getDocumentElement == null ? void 0 : t.getDocumentElement(n.floating)),
129
- boundary: d,
130
- rootBoundary: f,
131
- strategy: p
132
- })), x = s === "floating" ? {
133
- x: e,
134
- y: a,
135
- width: o.floating.width,
136
- height: o.floating.height
137
- } : o.reference, A = await (t.getOffsetParent == null ? void 0 : t.getOffsetParent(n.floating)), v = await (t.isElement == null ? void 0 : t.isElement(A)) ? await (t.getScale == null ? void 0 : t.getScale(A)) || {
138
- x: 1,
139
- y: 1
140
- } : {
141
- x: 1,
142
- y: 1
143
- }, c = M(t.convertOffsetParentRelativeRectToViewportRelativeRect ? await t.convertOffsetParentRelativeRectToViewportRelativeRect({
144
- elements: n,
145
- rect: x,
146
- offsetParent: A,
147
- strategy: p
148
- }) : x);
149
- return {
150
- top: (b.top - c.top + w.top) / v.y,
151
- bottom: (c.bottom - b.bottom + w.bottom) / v.y,
152
- left: (b.left - c.left + w.left) / v.x,
153
- right: (c.right - b.right + w.right) / v.x
154
- };
155
- }
156
- const _ = function(r) {
157
- return r === void 0 && (r = {}), {
159
+ }, _ = function(c) {
160
+ return c === void 0 && (c = {}), {
158
161
  name: "flip",
159
- options: r,
162
+ options: c,
160
163
  async fn(l) {
161
164
  var u, e;
162
165
  const {
@@ -164,70 +167,70 @@ const _ = function(r) {
164
167
  middlewareData: t,
165
168
  rects: o,
166
169
  initialPlacement: n,
167
- platform: p,
170
+ platform: m,
168
171
  elements: d
169
172
  } = l, {
170
- mainAxis: f = !0,
173
+ mainAxis: r = !0,
171
174
  crossAxis: s = !0,
172
- fallbackPlacements: m,
175
+ fallbackPlacements: f,
173
176
  fallbackStrategy: i = "bestFit",
174
177
  fallbackAxisSideDirection: w = "none",
175
- flipAlignment: h = !0,
176
- ...y
177
- } = Y(r, l);
178
+ flipAlignment: O = !0,
179
+ ...p
180
+ } = Y(c, l);
178
181
  if ((u = t.arrow) != null && u.alignmentOffset)
179
182
  return {};
180
- const b = L(a), x = E(n), A = L(n) === n, v = await (p.isRTL == null ? void 0 : p.isRTL(d.floating)), c = m || (A || !h ? [q(n)] : z(n)), F = w !== "none";
181
- !m && F && c.push(...G(n, h, w, v));
182
- const I = [n, ...c], T = await U(l, y), S = [];
183
- let O = ((e = t.flip) == null ? void 0 : e.overflows) || [];
184
- if (f && S.push(T[b]), s) {
185
- const R = H(a, o, v);
186
- S.push(T[R[0]], T[R[1]]);
183
+ const h = F(a), b = S(n), A = F(n) === n, x = await (m.isRTL == null ? void 0 : m.isRTL(d.floating)), y = f || (A || !O ? [z(n)] : G(n)), v = w !== "none";
184
+ !f && v && y.push(...H(n, O, w, x));
185
+ const I = [n, ...y], D = await m.detectOverflow(l, p), T = [];
186
+ let C = ((e = t.flip) == null ? void 0 : e.overflows) || [];
187
+ if (r && T.push(D[h]), s) {
188
+ const R = J(a, o, x);
189
+ T.push(D[R[0]], D[R[1]]);
187
190
  }
188
- if (O = [...O, {
191
+ if (C = [...C, {
189
192
  placement: a,
190
- overflows: S
191
- }], !S.every((R) => R <= 0)) {
193
+ overflows: T
194
+ }], !T.every((R) => R <= 0)) {
192
195
  var B, j;
193
- const R = (((B = t.flip) == null ? void 0 : B.index) || 0) + 1, D = I[R];
194
- if (D && (!(s === "alignment" ? x !== E(D) : !1) || // We leave the current main axis only if every placement on that axis
196
+ const R = (((B = t.flip) == null ? void 0 : B.index) || 0) + 1, L = I[R];
197
+ if (L && (!(s === "alignment" ? b !== S(L) : !1) || // We leave the current main axis only if every placement on that axis
195
198
  // overflows the main axis.
196
- O.every((g) => E(g.placement) === x ? g.overflows[0] > 0 : !0)))
199
+ C.every((g) => S(g.placement) === b ? g.overflows[0] > 0 : !0)))
197
200
  return {
198
201
  data: {
199
202
  index: R,
200
- overflows: O
203
+ overflows: C
201
204
  },
202
205
  reset: {
203
- placement: D
206
+ placement: L
204
207
  }
205
208
  };
206
- let C = (j = O.filter((k) => k.overflows[0] <= 0).sort((k, g) => k.overflows[1] - g.overflows[1])[0]) == null ? void 0 : j.placement;
207
- if (!C)
209
+ let E = (j = C.filter((k) => k.overflows[0] <= 0).sort((k, g) => k.overflows[1] - g.overflows[1])[0]) == null ? void 0 : j.placement;
210
+ if (!E)
208
211
  switch (i) {
209
212
  case "bestFit": {
210
213
  var V;
211
- const k = (V = O.filter((g) => {
212
- if (F) {
213
- const P = E(g.placement);
214
- return P === x || // Create a bias to the `y` side axis due to horizontal
214
+ const k = (V = C.filter((g) => {
215
+ if (v) {
216
+ const P = S(g.placement);
217
+ return P === b || // Create a bias to the `y` side axis due to horizontal
215
218
  // reading directions favoring greater width.
216
219
  P === "y";
217
220
  }
218
221
  return !0;
219
- }).map((g) => [g.placement, g.overflows.filter((P) => P > 0).reduce((P, $) => P + $, 0)]).sort((g, P) => g[1] - P[1])[0]) == null ? void 0 : V[0];
220
- k && (C = k);
222
+ }).map((g) => [g.placement, g.overflows.filter((P) => P > 0).reduce((P, q) => P + q, 0)]).sort((g, P) => g[1] - P[1])[0]) == null ? void 0 : V[0];
223
+ k && (E = k);
221
224
  break;
222
225
  }
223
226
  case "initialPlacement":
224
- C = n;
227
+ E = n;
225
228
  break;
226
229
  }
227
- if (a !== C)
230
+ if (a !== E)
228
231
  return {
229
232
  reset: {
230
- placement: C
233
+ placement: E
231
234
  }
232
235
  };
233
236
  }
@@ -236,8 +239,8 @@ const _ = function(r) {
236
239
  };
237
240
  };
238
241
  export {
239
- Z as computePosition,
240
- U as detectOverflow,
242
+ $ as computePosition,
243
+ W as detectOverflow,
241
244
  _ as flip,
242
245
  M as rectToClientRect
243
246
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caspeco/casper-ui-library",
3
- "version": "8.0.3",
3
+ "version": "8.2.0",
4
4
  "prettier": "@caspeco/prettier-config",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -40,24 +40,24 @@
40
40
  "@testing-library/react": "^16.3.2",
41
41
  "@testing-library/user-event": "^14.6.1",
42
42
  "@types/jest": "^30.0.0",
43
- "@types/node": "^24.10.9",
43
+ "@types/node": "^24.10.12",
44
44
  "@types/react": "^18.3.12",
45
45
  "@types/react-dom": "^18.3.1",
46
- "@vitejs/plugin-react-swc": "^4.2.2",
46
+ "@vitejs/plugin-react-swc": "^4.2.3",
47
47
  "@vitest/browser-playwright": "^4.0.18",
48
48
  "@vitest/ui": "^4.0.18",
49
49
  "eslint": "^9.39.2",
50
50
  "eslint-plugin-react-hooks": "^7.0.1",
51
- "eslint-plugin-react-refresh": "^0.4.26",
52
- "globals": "^17.1.0",
53
- "jsdom": "^27.4.0",
51
+ "eslint-plugin-react-refresh": "^0.5.0",
52
+ "globals": "^17.3.0",
53
+ "jsdom": "^28.0.0",
54
54
  "rimraf": "^6.1.2",
55
55
  "tsc-alias": "^1.8.16",
56
56
  "typescript": "~5.9.3",
57
- "typescript-eslint": "^8.53.0",
57
+ "typescript-eslint": "^8.54.0",
58
58
  "vite": "^7.3.1",
59
59
  "vite-plugin-dts": "^4.5.4",
60
- "vite-tsconfig-paths": "^6.0.4",
60
+ "vite-tsconfig-paths": "^6.1.0",
61
61
  "vitest": "^4.0.18"
62
62
  },
63
63
  "peerDependencies": {
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@chakra-ui/anatomy": "^2.3.4",
71
- "@floating-ui/dom": "^1.7.4",
71
+ "@floating-ui/dom": "^1.7.5",
72
72
  "@tanstack/react-table": "^8.21.3",
73
73
  "@tanstack/react-virtual": "^3.13.18",
74
74
  "csstype": "^3.2.3",