@caspeco/casper-ui-library 9.10.0 → 9.11.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,5 +1,5 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { useEditorState as s } from "../../node_modules/@tiptap/react/dist/index.js";
2
+ import { useEditorState as s } from "../../packages/casper-ui-library/node_modules/@tiptap/react/dist/index.js";
3
3
  import { useRichTextEditorContext as d } from "./rich-text-editor-context.js";
4
4
  import { Tooltip as f } from "../tooltip/tooltip.js";
5
5
  import { ToggleButton as p } from "../toggle-button/toggle-button.js";
@@ -1,6 +1,6 @@
1
1
  import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
2
  import { Box as D } from "@chakra-ui/react";
3
- import { useEditorState as x } from "../../node_modules/@tiptap/react/dist/index.js";
3
+ import { useEditorState as x } from "../../packages/casper-ui-library/node_modules/@tiptap/react/dist/index.js";
4
4
  import { find as T } from "../../node_modules/linkifyjs/dist/linkify.js";
5
5
  import { useState as C, useEffect as A, useCallback as z } from "react";
6
6
  import { BooleanControl as c } from "./boolean-control.js";
@@ -1,6 +1,6 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { HStack as i, Box as n } from "@chakra-ui/react";
3
- import { EditorContent as s } from "../../node_modules/@tiptap/react/dist/index.js";
3
+ import { EditorContent as s } from "../../packages/casper-ui-library/node_modules/@tiptap/react/dist/index.js";
4
4
  import { useMemo as m } from "react";
5
5
  import { useRichTextEditorContext as p, RichTextEditorContext as u } from "./rich-text-editor-context.js";
6
6
  import { toolbarCss as f, proseMirrorContainerCss as d, proseMirrorContentCss as x } from "./rich-text-editor-recipe.js";
@@ -1,4 +1,4 @@
1
- import { useEditor as r } from "../../node_modules/@tiptap/react/dist/index.js";
1
+ import { useEditor as r } from "../../packages/casper-ui-library/node_modules/@tiptap/react/dist/index.js";
2
2
  import { richTextExtensions as n } from "./extensions.js";
3
3
  function f({
4
4
  initialContent: e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CACjC,CAAC;AAEF,QAAA,MAAM,4BAA4B,GAAI,KAAK,SAAS,SAAS,EAAE,kKAW5D,wBAAwB,CAAC,KAAK,CAAC,GAAG;IAAE,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAAE,4CAqJhG,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAyC,OAAO,4BAA4B,CAAC"}
@@ -1,133 +1,135 @@
1
- import { jsxs as s, Fragment as f, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as r, Fragment as u, jsx as o } from "react/jsx-runtime";
2
2
  import { Portal as j } from "@chakra-ui/react";
3
3
  import { flexRender as A } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { memo as L, useCallback as M, useMemo as a } from "react";
4
+ import { memo as L, useCallback as M, useMemo as p } from "react";
5
5
  import { useTableContext as U } from "./table-context.js";
6
6
  import { translations as X } from "./translations.js";
7
7
  import { SortDescIcon as k } from "../icon/icons/sort-desc-icon.js";
8
- import { SortAscIcon as w } from "../icon/icons/sort-asc-icon.js";
8
+ import { SortAscIcon as S } from "../icon/icons/sort-asc-icon.js";
9
9
  import { MenuItem as l } from "../menu/menu-item.js";
10
- import { Text as r } from "../text/text.js";
10
+ import { Text as c } from "../text/text.js";
11
11
  import { FilterIcon as R } from "../icon/icons/filter-icon.js";
12
- import { MenuDivider as D } from "../menu/menu-divider.js";
12
+ import { MenuDivider as w } from "../menu/menu-divider.js";
13
13
  import { HideIcon as W } from "../icon/icons/hide-icon.js";
14
14
  import { ThumbtackIcon as $ } from "../icon/icons/thumbtack-icon.js";
15
15
  import { Switch as q } from "../switch/switch.js";
16
16
  import { Menu as J } from "../menu/menu.js";
17
17
  import { MenuBoxButton as K } from "../menu/menu-box-button.js";
18
18
  import { MenuList as N } from "../menu/menu-list.js";
19
- import { ThemeIconSizeVariable as v, ThemeColorVariable as F, ThemeSpaceVariable as Q, ThemeFontSizeVariable as S } from "../../theme/theme-types.js";
19
+ import { ThemeIconSizeVariable as D, ThemeColorVariable as v, ThemeSpaceVariable as Q, ThemeFontSizeVariable as F } from "../../theme/theme-types.js";
20
20
  const Y = ({
21
- header: o,
22
- breakingContentState: c,
23
- onBreakingContentChange: p,
24
- setBreakingContentState: h,
25
- headerGroup: g,
21
+ header: n,
22
+ breakingContentState: m,
23
+ onBreakingContentChange: h,
24
+ setBreakingContentState: g,
25
+ headerGroup: C,
26
26
  sorting: d,
27
- setSorting: u,
27
+ setSorting: f,
28
28
  localeString: y,
29
29
  portalContainerRef: z,
30
30
  dragRef: V
31
31
  }) => {
32
- const i = X[y], H = U(), { getTableFilterMethods: m } = H, C = M(
32
+ const i = X[y], H = U(), { getTableFilterMethods: s } = H, b = M(
33
33
  ({ checked: e }) => {
34
34
  const t = {
35
- ...c,
36
- [o.column.id]: e
35
+ ...m,
36
+ [n.column.id]: e
37
37
  };
38
- h(t), p?.(t);
38
+ g(t), h?.(t);
39
39
  },
40
- [c, o.column.id, p, h]
41
- ), b = M(
40
+ [m, n.column.id, h, g]
41
+ ), x = M(
42
42
  (e) => {
43
43
  const t = e.getIndex();
44
- g.forEach((E) => {
44
+ C.forEach((E) => {
45
45
  E.headers.forEach((O, T) => {
46
46
  const { column: I } = O;
47
47
  e.getIsPinned() ? T >= t && I.pin(!1) : T <= t && I.pin("left");
48
48
  });
49
49
  });
50
50
  },
51
- [g]
52
- ), P = a(() => /* @__PURE__ */ s(f, { children: [
53
- d.find((e) => e.id === o.column.id) && (d.find((e) => e.desc) ? /* @__PURE__ */ n(k, { size: v.XSmall }) : /* @__PURE__ */ n(w, { size: v.XSmall })),
54
- o.column.columnDef.header
55
- ] }), [o.column.columnDef.header, o.column.id, d]), x = a(() => m()?.canFilterOnColumn(o.column.id) ?? !1, [o.column.id, m]), B = a(() => /* @__PURE__ */ s(f, { children: [
56
- /* @__PURE__ */ n(
57
- l,
58
- {
59
- onClick: () => u([{ desc: !1, id: o.column.id }]),
60
- leftIcon: w,
61
- value: "sort-asc",
62
- children: /* @__PURE__ */ n(r, { children: i.sortUp })
63
- }
64
- ),
65
- /* @__PURE__ */ n(
66
- l,
67
- {
68
- onClick: () => u([{ desc: !0, id: o.column.id }]),
69
- leftIcon: k,
70
- value: "sort-desc",
71
- children: /* @__PURE__ */ n(r, { children: i.sortDown })
72
- }
73
- ),
74
- x && /* @__PURE__ */ n(
51
+ [C]
52
+ ), P = p(() => /* @__PURE__ */ r(u, { children: [
53
+ d.find((e) => e.id === n.column.id) && (d.find((e) => e.desc) ? /* @__PURE__ */ o(k, { size: D.XSmall }) : /* @__PURE__ */ o(S, { size: D.XSmall })),
54
+ n.column.columnDef.header
55
+ ] }), [n.column.columnDef.header, n.column.id, d]), a = p(() => s()?.canFilterOnColumn(n.column.id) ?? !1, [n.column.id, s]), B = p(() => /* @__PURE__ */ r(u, { children: [
56
+ n.column.getCanSort() && /* @__PURE__ */ r(u, { children: [
57
+ /* @__PURE__ */ o(
58
+ l,
59
+ {
60
+ onClick: () => f([{ desc: !1, id: n.column.id }]),
61
+ leftIcon: S,
62
+ value: "sort-asc",
63
+ children: /* @__PURE__ */ o(c, { children: i.sortUp })
64
+ }
65
+ ),
66
+ /* @__PURE__ */ o(
67
+ l,
68
+ {
69
+ onClick: () => f([{ desc: !0, id: n.column.id }]),
70
+ leftIcon: k,
71
+ value: "sort-desc",
72
+ children: /* @__PURE__ */ o(c, { children: i.sortDown })
73
+ }
74
+ )
75
+ ] }),
76
+ a && /* @__PURE__ */ o(
75
77
  l,
76
78
  {
77
79
  onClick: () => {
78
- const e = m();
79
- e?.onToggleFilterVisibility && e.onToggleFilterVisibility(o.column.id);
80
+ const e = s();
81
+ e?.onToggleFilterVisibility && e.onToggleFilterVisibility(n.column.id);
80
82
  },
81
83
  leftIcon: R,
82
84
  value: "filter",
83
- children: /* @__PURE__ */ n(r, { children: i.filter })
85
+ children: /* @__PURE__ */ o(c, { children: i.filter })
84
86
  }
85
87
  ),
86
- /* @__PURE__ */ n(D, {}),
87
- o.column.getCanHide() && /* @__PURE__ */ n(l, { onClick: o.column.getToggleVisibilityHandler(), leftIcon: W, value: "hide", children: /* @__PURE__ */ n(r, { children: i.hideColumn }) }),
88
- /* @__PURE__ */ n(l, { onClick: () => b(o.column), leftIcon: $, value: "pin", children: /* @__PURE__ */ n(r, { children: o.column.getIsPinned() ? i.stopPinningColumn : i.pinUpToColumn }) }),
89
- /* @__PURE__ */ n(D, {}),
90
- /* @__PURE__ */ s(l, { itemType: "switch", value: "breaking-content", children: [
88
+ (n.column.getCanSort() || a) && /* @__PURE__ */ o(w, {}),
89
+ n.column.getCanHide() && /* @__PURE__ */ o(l, { onClick: n.column.getToggleVisibilityHandler(), leftIcon: W, value: "hide", children: /* @__PURE__ */ o(c, { children: i.hideColumn }) }),
90
+ /* @__PURE__ */ o(l, { onClick: () => x(n.column), leftIcon: $, value: "pin", children: /* @__PURE__ */ o(c, { children: n.column.getIsPinned() ? i.stopPinningColumn : i.pinUpToColumn }) }),
91
+ /* @__PURE__ */ o(w, {}),
92
+ /* @__PURE__ */ r(l, { itemType: "switch", value: "breaking-content", children: [
91
93
  i.breakingContent,
92
- /* @__PURE__ */ n(
94
+ /* @__PURE__ */ o(
93
95
  q,
94
96
  {
95
- onCheckedChange: C,
96
- isChecked: c[o.column.id]
97
+ onCheckedChange: b,
98
+ isChecked: m[n.column.id]
97
99
  }
98
100
  )
99
101
  ] })
100
102
  ] }), [
101
- c,
102
- x,
103
103
  m,
104
+ a,
105
+ s,
106
+ x,
107
+ n.column,
104
108
  b,
105
- o.column,
106
- C,
107
- u,
109
+ f,
108
110
  i
109
111
  ]);
110
- return /* @__PURE__ */ n(J, { isLazy: !0, children: ({ isOpen: e }) => /* @__PURE__ */ s(f, { children: [
111
- /* @__PURE__ */ n(
112
+ return /* @__PURE__ */ o(J, { isLazy: !0, children: ({ isOpen: e }) => /* @__PURE__ */ r(u, { children: [
113
+ /* @__PURE__ */ o(
112
114
  K,
113
115
  {
114
116
  ref: V,
115
- color: F.OnBackgroundSubdued,
117
+ color: v.OnBackgroundSubdued,
116
118
  textTransform: "none",
117
- fontSize: S.Small,
119
+ fontSize: F.Small,
118
120
  h: "40px",
119
121
  display: "flex",
120
122
  textAlign: "inherit",
121
123
  alignItems: "center",
122
124
  lineHeight: "1.2",
123
125
  padding: `0px 0px 0px ${Q.Small}`,
124
- backgroundColor: e ? F.BackgroundDisabled : "unset",
126
+ backgroundColor: e ? v.BackgroundDisabled : "unset",
125
127
  w: "100%",
126
128
  overflowWrap: "anywhere",
127
- children: A(P, o.getContext())
129
+ children: A(P, n.getContext())
128
130
  }
129
131
  ),
130
- /* @__PURE__ */ n(j, { container: z, children: /* @__PURE__ */ n(N, { fontSize: S.Medium, children: B }) })
132
+ /* @__PURE__ */ o(j, { container: z, children: /* @__PURE__ */ o(N, { fontSize: F.Medium, children: B }) })
131
133
  ] }) });
132
134
  }, bn = L(Y);
133
135
  export {
@@ -1,38 +1,90 @@
1
- import * as t from "react";
2
- import { flushSync as f } from "react-dom";
3
- import { Virtualizer as i, elementScroll as m, observeElementOffset as d, observeElementRect as p } from "../../../virtual-core/dist/esm/index.js";
4
- import { defaultKeyExtractor as g, defaultRangeExtractor as z, measureElement as O } from "../../../virtual-core/dist/esm/index.js";
5
- const l = typeof document < "u" ? t.useLayoutEffect : t.useEffect;
6
- function E({
7
- useFlushSync: r = !0,
8
- ...n
1
+ import * as f from "react";
2
+ import { flushSync as R } from "react-dom";
3
+ import { Virtualizer as I, elementScroll as b, observeElementOffset as E, observeElementRect as w } from "../../../virtual-core/dist/esm/index.js";
4
+ import { defaultKeyExtractor as P, defaultRangeExtractor as _, measureElement as k } from "../../../virtual-core/dist/esm/index.js";
5
+ const g = typeof document < "u" ? f.useLayoutEffect : f.useEffect;
6
+ function $({
7
+ useFlushSync: p = !0,
8
+ directDomUpdates: x = !1,
9
+ directDomUpdatesMode: h = "transform",
10
+ ...m
9
11
  }) {
10
- const o = t.useReducer(() => ({}), {})[1], u = {
11
- ...n,
12
- onChange: (c, s) => {
13
- var a;
14
- r && s ? f(o) : o(), (a = n.onChange) == null || a.call(n, c, s);
12
+ const z = f.useReducer((e) => e + 1, 0)[1], i = f.useRef({
13
+ enabled: x,
14
+ mode: h,
15
+ container: null,
16
+ lastSize: null,
17
+ // Keyed by the element itself so a remounted node (same key, new DOM
18
+ // node — e.g. when `enabled` is toggled off then on) is treated as fresh
19
+ // and gets its style written.
20
+ lastPositions: /* @__PURE__ */ new WeakMap(),
21
+ prevRange: null
22
+ });
23
+ i.current.enabled = x, i.current.mode = h;
24
+ const S = (e) => {
25
+ const t = i.current;
26
+ if (!t.enabled) return;
27
+ const n = e.getTotalSize();
28
+ if (t.container && n !== t.lastSize) {
29
+ t.lastSize = n;
30
+ const d = e.options.horizontal ? "width" : "height";
31
+ t.container.style[d] = `${n}px`;
32
+ }
33
+ const o = !!e.options.horizontal, s = t.mode === "transform", r = o ? "left" : "top", l = e.options.scrollMargin, y = e.getVirtualItems();
34
+ for (const d of y) {
35
+ const c = d.start - l, u = e.elementsCache.get(d.key);
36
+ u && t.lastPositions.get(u) !== c && (t.lastPositions.set(u, c), s ? u.style.transform = o ? `translate3d(${c}px, 0, 0)` : `translate3d(0, ${c}px, 0)` : u.style[r] = `${c}px`);
15
37
  }
16
- }, [e] = t.useState(
17
- () => new i(u)
18
- );
19
- return e.setOptions(u), l(() => e._didMount(), []), l(() => e._willUpdate()), e;
38
+ }, v = {
39
+ ...m,
40
+ onChange: (e, t) => {
41
+ var n;
42
+ const o = i.current;
43
+ let s = !0;
44
+ if (o.enabled) {
45
+ S(e);
46
+ const r = e.range, l = o.prevRange;
47
+ s = !l || l.isScrolling !== e.isScrolling || l.startIndex !== r?.startIndex || l.endIndex !== r?.endIndex, s && (o.prevRange = r ? {
48
+ startIndex: r.startIndex,
49
+ endIndex: r.endIndex,
50
+ isScrolling: e.isScrolling
51
+ } : null);
52
+ }
53
+ s && (p && t ? R(z) : z()), (n = m.onChange) == null || n.call(m, e, t);
54
+ }
55
+ }, [a] = f.useState(() => {
56
+ const e = new I(v);
57
+ return Object.assign(e, {
58
+ containerRef: (t) => {
59
+ const n = i.current;
60
+ if (n.container = t, n.lastSize = null, t && n.enabled) {
61
+ const o = e.getTotalSize();
62
+ n.lastSize = o;
63
+ const s = e.options.horizontal ? "width" : "height";
64
+ t.style[s] = `${o}px`;
65
+ }
66
+ }
67
+ });
68
+ });
69
+ return a.setOptions(v), g(() => a._didMount(), []), g(() => a._willUpdate()), g(() => {
70
+ S(a);
71
+ }), a;
20
72
  }
21
- function x(r) {
22
- return E({
23
- observeElementRect: p,
24
- observeElementOffset: d,
25
- scrollToFn: m,
26
- ...r
73
+ function V(p) {
74
+ return $({
75
+ observeElementRect: w,
76
+ observeElementOffset: E,
77
+ scrollToFn: b,
78
+ ...p
27
79
  });
28
80
  }
29
81
  export {
30
- i as Virtualizer,
31
- g as defaultKeyExtractor,
32
- z as defaultRangeExtractor,
33
- m as elementScroll,
34
- O as measureElement,
35
- d as observeElementOffset,
36
- p as observeElementRect,
37
- x as useVirtualizer
82
+ I as Virtualizer,
83
+ P as defaultKeyExtractor,
84
+ _ as defaultRangeExtractor,
85
+ b as elementScroll,
86
+ k as measureElement,
87
+ E as observeElementOffset,
88
+ w as observeElementRect,
89
+ V as useVirtualizer
38
90
  };