@bioturing/components 0.36.2 → 0.37.1

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.
Files changed (35) hide show
  1. package/dist/components/button/component.d.ts +1 -1
  2. package/dist/components/button/component.d.ts.map +1 -1
  3. package/dist/components/button/component.js +42 -35
  4. package/dist/components/button/component.js.map +1 -1
  5. package/dist/components/button/style.css +1 -1
  6. package/dist/components/data-table/component.d.ts.map +1 -1
  7. package/dist/components/data-table/component.js +76 -71
  8. package/dist/components/data-table/component.js.map +1 -1
  9. package/dist/components/data-table/components/TablePagination.d.ts +1 -1
  10. package/dist/components/data-table/components/TablePagination.d.ts.map +1 -1
  11. package/dist/components/data-table/components/TablePagination.js +26 -23
  12. package/dist/components/data-table/components/TablePagination.js.map +1 -1
  13. package/dist/components/data-table/hooks.d.ts.map +1 -1
  14. package/dist/components/data-table/hooks.js +82 -82
  15. package/dist/components/data-table/hooks.js.map +1 -1
  16. package/dist/components/data-table/style.css +1 -1
  17. package/dist/components/empty/component.d.ts +0 -2
  18. package/dist/components/empty/component.d.ts.map +1 -1
  19. package/dist/components/empty/component.js +14 -35
  20. package/dist/components/empty/component.js.map +1 -1
  21. package/dist/components/empty/style.css +1 -1
  22. package/dist/components/modal/Modal.d.ts.map +1 -1
  23. package/dist/components/modal/Modal.js +105 -102
  24. package/dist/components/modal/Modal.js.map +1 -1
  25. package/dist/components/truncate/component.d.ts +7 -0
  26. package/dist/components/truncate/component.d.ts.map +1 -1
  27. package/dist/components/truncate/component.js +57 -48
  28. package/dist/components/truncate/component.js.map +1 -1
  29. package/dist/components/truncate/helpers.d.ts +8 -2
  30. package/dist/components/truncate/helpers.d.ts.map +1 -1
  31. package/dist/components/truncate/helpers.js +82 -54
  32. package/dist/components/truncate/helpers.js.map +1 -1
  33. package/dist/index.js +126 -127
  34. package/dist/stats.html +1 -1
  35. package/package.json +1 -1
@@ -1,83 +1,111 @@
1
- const b = (t) => {
2
- const o = document.createElement("span");
3
- o.style.opacity = "0", o.style.position = "absolute", o.style.top = "-1000px", o.style.left = "-1000px", o.style.whiteSpace = "nowrap", o.style.pointerEvents = "none";
4
- const l = t.getBoundingClientRect(), e = t.cloneNode(!0);
5
- return e.style.maxWidth = `${l.width}px`, e.style.position = "absolute", e.style.pointerEvents = "none", e.style.top = "-99px", e.style.left = "-99px", e.style.zIndex = "-1", t.parentElement?.appendChild(e), e.appendChild(o), {
6
- measure: (r) => (o.innerText = r, o.clientWidth),
1
+ import v from "react";
2
+ import { renderToStaticMarkup as w } from "react-dom/server";
3
+ const d = /* @__PURE__ */ new Map(), W = (e, n) => {
4
+ const t = document.createElement("span");
5
+ t.style.opacity = "0", t.style.position = "absolute", t.style.top = "-1000px", t.style.left = "-1000px", t.style.whiteSpace = "nowrap", t.style.pointerEvents = "none";
6
+ const o = e.getBoundingClientRect(), s = e.cloneNode(!0);
7
+ return s.style.maxWidth = `${o.width}px`, s.style.position = "absolute", s.style.pointerEvents = "none", s.style.top = "-99px", s.style.left = "-99px", s.style.zIndex = "-1", e.parentElement?.appendChild(s), s.appendChild(t), {
8
+ measure: (l) => {
9
+ if (n) {
10
+ const r = `${l}-styled`;
11
+ if (d.has(r))
12
+ return d.get(r);
13
+ t.innerHTML = "";
14
+ const c = n(l);
15
+ if (typeof c == "string")
16
+ t.innerHTML = c;
17
+ else if (v.isValidElement(c))
18
+ try {
19
+ const i = w(c);
20
+ t.innerHTML = i;
21
+ } catch {
22
+ t.innerText = l;
23
+ }
24
+ else
25
+ t.innerText = l;
26
+ const h = t.clientWidth;
27
+ if (d.set(r, h), d.size > 100) {
28
+ const i = d.keys().next().value;
29
+ d.delete(i);
30
+ }
31
+ return h;
32
+ }
33
+ return t.innerText = l, t.clientWidth;
34
+ },
7
35
  destroy: () => {
8
- e.removeChild(o), t.parentElement?.removeChild(e);
36
+ s.removeChild(t), e.parentElement?.removeChild(s);
9
37
  }
10
38
  };
11
- }, H = (t, o, l) => {
12
- if (!t) return t;
13
- const { measure: e, destroy: r } = b(l), s = e(t), n = l.clientWidth, f = Math.floor(
14
- n / s * t.length
39
+ }, M = (e, n, t, o) => {
40
+ if (!e) return e;
41
+ const { measure: s, destroy: l } = W(t, o), r = s(e), c = t.clientWidth, h = Math.floor(
42
+ c / r * e.length
15
43
  );
16
- if (s <= n)
17
- return r(), t;
18
- let i = f;
19
- const c = {}, g = 20, m = 4;
20
- for (; Object.values(c).length <= g && !c[i]; ) {
44
+ if (r <= c)
45
+ return l(), e;
46
+ let i = h;
47
+ const a = {}, g = 20, b = 4;
48
+ for (; Object.values(a).length <= g && !a[i]; ) {
21
49
  if (i <= 1) {
22
- c[0] = [0, o];
50
+ a[0] = [0, n];
23
51
  break;
24
52
  }
25
- const d = t.slice(0, Math.ceil((i - o.length) / 2 - 1)).trimEnd(), y = t.slice(Math.floor((i - o.length) / 2) - i).trimStart(), p = d + o + y, a = e(p);
26
- if (c[i] = [a, p], a >= n)
53
+ const p = e.slice(0, Math.ceil((i - n.length) / 2 - 1)).trimEnd(), H = e.slice(Math.floor((i - n.length) / 2) - i).trimStart(), m = p + n + H, f = s(m);
54
+ if (a[i] = [f, m], f >= c)
27
55
  i = i - 2;
28
56
  else {
29
- if (n - a < m) break;
57
+ if (c - f < b) break;
30
58
  i = i + 2;
31
59
  }
32
60
  }
33
- return r(), Object.values(c).reverse().find(([d]) => d < n)?.[1] ?? Object.values(c)[0][1];
34
- }, v = (t, o) => {
35
- const l = window.getComputedStyle(o), e = document.createElement("span");
36
- return e.style.visibility = "hidden", e.style.position = "absolute", e.style.width = `${o.clientWidth}px`, e.style.fontSize = l.fontSize, e.style.fontFamily = l.fontFamily, e.style.lineHeight = l.lineHeight, e.textContent = t, document.body.appendChild(e), e;
37
- }, W = (t) => {
38
- const o = t.parentElement;
39
- if (!o) return 0;
40
- const l = window.getComputedStyle(o), e = parseFloat(l.paddingTop) || 0, r = parseFloat(l.paddingBottom) || 0, s = parseFloat(l.borderTopWidth) || 0, n = parseFloat(l.borderBottomWidth) || 0;
41
- return o.clientHeight - e - r - s - n;
42
- }, h = (t) => t.scrollWidth > t.clientWidth, u = (t, o) => {
43
- const l = o ?? (t.clientHeight || t.offsetHeight);
44
- return t.scrollHeight > l;
45
- }, w = (t, o = {}) => {
46
- const { type: l = "horizontal", availableHeight: e, text: r } = o;
47
- if (r) {
48
- const s = v(r, t);
49
- let n = !1;
50
- switch (l) {
61
+ return l(), Object.values(a).reverse().find(([p]) => p < c)?.[1] ?? Object.values(a)[0][1];
62
+ }, C = (e, n) => {
63
+ const t = window.getComputedStyle(n), o = document.createElement("span");
64
+ return o.style.visibility = "hidden", o.style.position = "absolute", o.style.width = `${n.clientWidth}px`, o.style.fontSize = t.fontSize, o.style.fontFamily = t.fontFamily, o.style.lineHeight = t.lineHeight, o.textContent = e, document.body.appendChild(o), o;
65
+ }, S = (e) => {
66
+ const n = e.parentElement;
67
+ if (!n) return 0;
68
+ const t = window.getComputedStyle(n), o = parseFloat(t.paddingTop) || 0, s = parseFloat(t.paddingBottom) || 0, l = parseFloat(t.borderTopWidth) || 0, r = parseFloat(t.borderBottomWidth) || 0;
69
+ return n.clientHeight - o - s - l - r;
70
+ }, u = (e) => e.scrollWidth > e.clientWidth, y = (e, n) => {
71
+ const t = n ?? (e.clientHeight || e.offsetHeight);
72
+ return e.scrollHeight > t;
73
+ }, E = (e, n = {}) => {
74
+ const { type: t = "horizontal", availableHeight: o, text: s } = n;
75
+ if (s) {
76
+ const l = C(s, e);
77
+ let r = !1;
78
+ switch (t) {
51
79
  case "horizontal":
52
- n = s.scrollWidth > t.clientWidth;
80
+ r = l.scrollWidth > e.clientWidth;
53
81
  break;
54
82
  case "vertical":
55
- n = e ? s.scrollHeight > e : s.scrollHeight > (t.clientHeight || t.offsetHeight);
83
+ r = o ? l.scrollHeight > o : l.scrollHeight > (e.clientHeight || e.offsetHeight);
56
84
  break;
57
85
  case "both":
58
- n = s.scrollWidth > t.clientWidth || (e ? s.scrollHeight > e : s.scrollHeight > (t.clientHeight || t.offsetHeight));
86
+ r = l.scrollWidth > e.clientWidth || (o ? l.scrollHeight > o : l.scrollHeight > (e.clientHeight || e.offsetHeight));
59
87
  break;
60
88
  }
61
- return document.body.removeChild(s), n;
89
+ return document.body.removeChild(l), r;
62
90
  }
63
- switch (l) {
91
+ switch (t) {
64
92
  case "horizontal":
65
- return h(t);
93
+ return u(e);
66
94
  case "vertical":
67
- return u(t, e);
95
+ return y(e, o);
68
96
  case "both":
69
- return h(t) || u(t, e);
97
+ return u(e) || y(e, o);
70
98
  default:
71
- return h(t);
99
+ return u(e);
72
100
  }
73
101
  };
74
102
  export {
75
- W as calculateAvailableHeight,
76
- h as checkHorizontalOverflow,
77
- w as checkOverflow,
78
- u as checkVerticalOverflow,
79
- v as createMeasurementClone,
80
- H as getMiddleTruncatedString,
81
- b as measureText
103
+ S as calculateAvailableHeight,
104
+ u as checkHorizontalOverflow,
105
+ E as checkOverflow,
106
+ y as checkVerticalOverflow,
107
+ C as createMeasurementClone,
108
+ M as getMiddleTruncatedString,
109
+ W as measureText
82
110
  };
83
111
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../src/components/truncate/helpers.ts"],"sourcesContent":["/**\n * Finds the closest parent element that has inline flex display\n * @param element - The starting HTMLElement\n * @returns The closest inline flex parent or null if not found\n */\nexport function findClosestInlineFlexParent(\n element: HTMLElement\n): HTMLElement | null {\n if (!element) return null;\n\n let currentElement = element.parentElement;\n let attempts = 0;\n const maxAttempts = 10;\n\n while (currentElement && attempts < maxAttempts) {\n const computedStyle = window.getComputedStyle(currentElement);\n\n // Check if display is inline-flex\n if (computedStyle.display === \"inline-flex\") {\n return currentElement;\n }\n\n // Move to the next parent\n currentElement = currentElement.parentElement;\n attempts++;\n }\n\n return null;\n}\n\nexport function getFlexRemainingSpace(\n flexContainer: HTMLElement,\n ignoreElement: HTMLElement | ((e: HTMLElement) => boolean) = null\n) {\n const style = window.getComputedStyle(flexContainer);\n const isRow =\n style.flexDirection === \"row\" || style.flexDirection === \"row-reverse\";\n const containerSize = isRow\n ? flexContainer.offsetWidth\n : flexContainer.offsetHeight;\n const gap = parseFloat(style.gap) || 0;\n const paddingStart =\n parseFloat(isRow ? style.paddingLeft : style.paddingTop) || 0;\n const paddingEnd =\n parseFloat(isRow ? style.paddingRight : style.paddingBottom) || 0;\n\n let totalItemSize = 0;\n const items: HTMLElement[] = (\n [...flexContainer.children] as HTMLElement[]\n ).filter(\n (child) =>\n child instanceof HTMLElement &&\n (typeof ignoreElement === \"function\"\n ? !ignoreElement(child)\n : child !== ignoreElement)\n );\n for (let i = 0; i < items.length; i++) {\n const itemStyle = window.getComputedStyle(items[i]);\n const marginStart =\n parseFloat(isRow ? itemStyle.marginLeft : itemStyle.marginTop) || 0;\n const marginEnd =\n parseFloat(isRow ? itemStyle.marginRight : itemStyle.marginBottom) || 0;\n totalItemSize +=\n (isRow ? items[i].offsetWidth : items[i].offsetHeight) +\n marginStart +\n marginEnd;\n }\n\n // Add gaps (n-1 gaps for n items)\n totalItemSize += gap * (items.length - 1);\n\n // Calculate remaining space\n const remainingSpace =\n containerSize - totalItemSize - paddingStart - paddingEnd;\n return Math.max(0, remainingSpace);\n}\n\nexport const measureText = (container: HTMLElement) => {\n const span = document.createElement(\"span\");\n span.style.opacity = \"0\";\n span.style.position = \"absolute\";\n span.style.top = \"-1000px\";\n span.style.left = \"-1000px\";\n span.style.whiteSpace = \"nowrap\";\n span.style.pointerEvents = \"none\";\n\n const nodeRect = container.getBoundingClientRect();\n\n const containerClone = container.cloneNode(true) as HTMLElement;\n containerClone.style.maxWidth = `${nodeRect.width}px`;\n containerClone.style.position = \"absolute\";\n containerClone.style.pointerEvents = \"none\";\n containerClone.style.top = \"-99px\";\n containerClone.style.left = \"-99px\";\n containerClone.style.zIndex = \"-1\";\n\n container.parentElement?.appendChild(containerClone);\n containerClone.appendChild(span);\n\n return {\n measure: (text: string) => {\n span.innerText = text;\n return span.clientWidth;\n },\n destroy: () => {\n containerClone.removeChild(span);\n container.parentElement?.removeChild(containerClone);\n },\n };\n};\n\nexport const getMiddleTruncatedString = (\n text: string,\n ellipsis: string,\n container: HTMLElement\n): string => {\n if (!text) return text;\n\n const { measure: getTextWidth, destroy: destroyMeasure } =\n measureText(container);\n\n const textWidth = getTextWidth(text);\n\n const containerWidthToCompare = container.clientWidth;\n\n const initialOffset = Math.floor(\n (containerWidthToCompare / textWidth) * text.length\n );\n\n if (textWidth <= containerWidthToCompare) {\n destroyMeasure();\n return text;\n }\n\n let offset = initialOffset;\n const attempts: Record<number, [number, string]> = {};\n const maxAttempts = 20;\n const buffer = 4;\n\n while (Object.values(attempts).length <= maxAttempts) {\n // If we have already tried this offset, stop\n if (attempts[offset]) break;\n\n // If we are at the beginning of the string, just return the ellipsis\n if (offset <= 1) {\n attempts[0] = [0, ellipsis];\n break;\n }\n\n const start = text\n .slice(0, Math.ceil((offset - ellipsis.length) / 2 - 1))\n .trimEnd();\n const end = text\n .slice(Math.floor((offset - ellipsis.length) / 2) - offset)\n .trimStart();\n const truncatedStr = start + ellipsis + end;\n const width = getTextWidth(truncatedStr);\n\n attempts[offset] = [width, truncatedStr];\n\n if (width >= containerWidthToCompare) {\n offset = offset - 2;\n } else {\n // If we are close to the container width, stop\n if (containerWidthToCompare - width < buffer) break;\n offset = offset + 2;\n }\n }\n\n // Remove the span element used for measuring text\n destroyMeasure();\n\n // Find the closest attempt that is smaller than the container width\n return (\n Object.values(attempts)\n .reverse()\n .find(([width]) => width < containerWidthToCompare)?.[1] ??\n Object.values(attempts)[0][1]\n );\n};\n\n// Utility functions for measurements\nexport const createMeasurementClone = (\n text: string,\n container: HTMLElement\n) => {\n const styles = window.getComputedStyle(container);\n const clone = document.createElement(\"span\");\n clone.style.visibility = \"hidden\";\n clone.style.position = \"absolute\";\n clone.style.width = `${container.clientWidth}px`;\n clone.style.fontSize = styles.fontSize;\n clone.style.fontFamily = styles.fontFamily;\n clone.style.lineHeight = styles.lineHeight;\n clone.textContent = text;\n document.body.appendChild(clone);\n return clone;\n};\n\nexport const checkIfTextTruncated = (\n text: string,\n container: HTMLElement,\n availableHeight?: number\n) => {\n // Use the new checkOverflow utility for consistency\n return checkOverflow(container, {\n type: \"vertical\",\n availableHeight,\n text,\n });\n};\n\nexport const calculateAvailableHeight = (container: HTMLElement) => {\n const parent = container.parentElement;\n if (!parent) return 0;\n\n const parentStyles = window.getComputedStyle(parent);\n const paddingTop = parseFloat(parentStyles.paddingTop) || 0;\n const paddingBottom = parseFloat(parentStyles.paddingBottom) || 0;\n const borderTopWidth = parseFloat(parentStyles.borderTopWidth) || 0;\n const borderBottomWidth = parseFloat(parentStyles.borderBottomWidth) || 0;\n\n return (\n parent.clientHeight -\n paddingTop -\n paddingBottom -\n borderTopWidth -\n borderBottomWidth\n );\n};\n\nexport const calculateAvailableWidth = (container: HTMLElement) => {\n const parent = container.parentElement;\n if (!parent) return 0;\n\n const parentStyles = window.getComputedStyle(parent);\n const paddingLeft = parseFloat(parentStyles.paddingLeft) || 0;\n const paddingRight = parseFloat(parentStyles.paddingRight) || 0;\n const borderLeftWidth = parseFloat(parentStyles.borderLeftWidth) || 0;\n const borderRightWidth = parseFloat(parentStyles.borderRightWidth) || 0;\n\n return (\n parent.clientWidth -\n paddingLeft -\n paddingRight -\n borderLeftWidth -\n borderRightWidth\n );\n};\n\n// Overflow detection utilities\nexport type OverflowType = \"horizontal\" | \"vertical\" | \"both\";\n\nexport interface OverflowCheckOptions {\n type?: OverflowType;\n availableHeight?: number;\n text?: string;\n}\n\nexport const checkHorizontalOverflow = (container: HTMLElement): boolean => {\n return container.scrollWidth > container.clientWidth;\n};\n\nexport const checkVerticalOverflow = (\n container: HTMLElement,\n availableHeight?: number\n): boolean => {\n const compareHeight = availableHeight ?? (container.clientHeight || container.offsetHeight);\n return container.scrollHeight > compareHeight;\n};\n\nexport const checkOverflow = (\n container: HTMLElement,\n options: OverflowCheckOptions = {}\n): boolean => {\n const { type = \"horizontal\", availableHeight, text } = options;\n\n // If text is provided, use measurement clone for more accurate detection\n if (text) {\n const clone = createMeasurementClone(text, container);\n let isOverflowing = false;\n\n switch (type) {\n case \"horizontal\":\n isOverflowing = clone.scrollWidth > container.clientWidth;\n break;\n case \"vertical\":\n isOverflowing = availableHeight\n ? clone.scrollHeight > availableHeight\n : clone.scrollHeight > (container.clientHeight || container.offsetHeight);\n break;\n case \"both\":\n isOverflowing =\n clone.scrollWidth > container.clientWidth ||\n (availableHeight\n ? clone.scrollHeight > availableHeight\n : clone.scrollHeight > (container.clientHeight || container.offsetHeight));\n break;\n }\n\n document.body.removeChild(clone);\n return isOverflowing;\n }\n\n // Use direct container measurements\n switch (type) {\n case \"horizontal\":\n return checkHorizontalOverflow(container);\n case \"vertical\":\n return checkVerticalOverflow(container, availableHeight);\n case \"both\":\n return checkHorizontalOverflow(container) || checkVerticalOverflow(container, availableHeight);\n default:\n return checkHorizontalOverflow(container);\n }\n};\n"],"names":["measureText","container","span","nodeRect","containerClone","text","getMiddleTruncatedString","ellipsis","getTextWidth","destroyMeasure","textWidth","containerWidthToCompare","initialOffset","offset","attempts","maxAttempts","buffer","start","end","truncatedStr","width","createMeasurementClone","styles","clone","calculateAvailableHeight","parent","parentStyles","paddingTop","paddingBottom","borderTopWidth","borderBottomWidth","checkHorizontalOverflow","checkVerticalOverflow","availableHeight","compareHeight","checkOverflow","options","type","isOverflowing"],"mappings":"AA6EO,MAAMA,IAAc,CAACC,MAA2B;AACrD,QAAMC,IAAO,SAAS,cAAc,MAAM;AAC1C,EAAAA,EAAK,MAAM,UAAU,KACrBA,EAAK,MAAM,WAAW,YACtBA,EAAK,MAAM,MAAM,WACjBA,EAAK,MAAM,OAAO,WAClBA,EAAK,MAAM,aAAa,UACxBA,EAAK,MAAM,gBAAgB;AAE3B,QAAMC,IAAWF,EAAU,sBAAA,GAErBG,IAAiBH,EAAU,UAAU,EAAI;AAC/C,SAAAG,EAAe,MAAM,WAAW,GAAGD,EAAS,KAAK,MACjDC,EAAe,MAAM,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AE,MAAAC,IAAO,cAAc,iBAAAJ,GAAiB,MAAA5B,MAAS+B;AAGvD,MAAI/B,GAAM;AACR,UAAMkB,IAAQF,EAAuBhB,GAAMJ,CAAS;AACpD,QAAIqC,IAAgB;AAEpB,YAAQD,GAAA;AAAA,MACN,KAAK;AACH,QAAAC,IAAgBf,EAAM,cAActB,EAAU;AAC9C;AAAA,MACF,KAAK;AACH,QAAAqC,IAAgBL,IACZV,EAAM,eAAeU,IACrBV,EAAM,gBAAgBtB,EAAU,gBAAgBA,EAAU;AAC9D;AAAA,MACF,KAAK;AACH,QAAAqC,IACEf,EAAM,cAActB,EAAU,gBAC7BgC,IACGV,EAAM,eAAeU,IACrBV,EAAM,gBAAgBtB,EAAU,gBAAgBA,EAAU;AAChE;AAAA,IAAA;AAGJ,oBAAS,KAAK,YAAYsB,CAAK,GACxBe;AAAA,EACT;AAGA,UAAQD,GAAA;AAAA,IACN,KAAK;AACH,aAAON,EAAwB9B,CAAS;AAAA,IAC1C,KAAK;AACH,aAAO+B,EAAsB/B,GAAWgC,CAAe;AAAA,IACzD,KAAK;AACH,aAAOF,EAAwB9B,CAAS,KAAK+B,EAAsB/B,GAAWgC,CAAe;AAAA,IAC/F;AACE,aAAOF,EAAwB9B,CAAS;AAAA,EAAA;AAE9C;"}
1
+ {"version":3,"file":"helpers.js","sources":["../../../src/components/truncate/helpers.ts"],"sourcesContent":["import React from \"react\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\n\n/**\n * Finds the closest parent element that has inline flex display\n * @param element - The starting HTMLElement\n * @returns The closest inline flex parent or null if not found\n */\nexport function findClosestInlineFlexParent(\n element: HTMLElement\n): HTMLElement | null {\n if (!element) return null;\n\n let currentElement = element.parentElement;\n let attempts = 0;\n const maxAttempts = 10;\n\n while (currentElement && attempts < maxAttempts) {\n const computedStyle = window.getComputedStyle(currentElement);\n\n // Check if display is inline-flex\n if (computedStyle.display === \"inline-flex\") {\n return currentElement;\n }\n\n // Move to the next parent\n currentElement = currentElement.parentElement;\n attempts++;\n }\n\n return null;\n}\n\nexport function getFlexRemainingSpace(\n flexContainer: HTMLElement,\n ignoreElement: HTMLElement | ((e: HTMLElement) => boolean) = null\n) {\n const style = window.getComputedStyle(flexContainer);\n const isRow =\n style.flexDirection === \"row\" || style.flexDirection === \"row-reverse\";\n const containerSize = isRow\n ? flexContainer.offsetWidth\n : flexContainer.offsetHeight;\n const gap = parseFloat(style.gap) || 0;\n const paddingStart =\n parseFloat(isRow ? style.paddingLeft : style.paddingTop) || 0;\n const paddingEnd =\n parseFloat(isRow ? style.paddingRight : style.paddingBottom) || 0;\n\n let totalItemSize = 0;\n const items: HTMLElement[] = (\n [...flexContainer.children] as HTMLElement[]\n ).filter(\n (child) =>\n child instanceof HTMLElement &&\n (typeof ignoreElement === \"function\"\n ? !ignoreElement(child)\n : child !== ignoreElement)\n );\n for (let i = 0; i < items.length; i++) {\n const itemStyle = window.getComputedStyle(items[i]);\n const marginStart =\n parseFloat(isRow ? itemStyle.marginLeft : itemStyle.marginTop) || 0;\n const marginEnd =\n parseFloat(isRow ? itemStyle.marginRight : itemStyle.marginBottom) || 0;\n totalItemSize +=\n (isRow ? items[i].offsetWidth : items[i].offsetHeight) +\n marginStart +\n marginEnd;\n }\n\n // Add gaps (n-1 gaps for n items)\n totalItemSize += gap * (items.length - 1);\n\n // Calculate remaining space\n const remainingSpace =\n containerSize - totalItemSize - paddingStart - paddingEnd;\n return Math.max(0, remainingSpace);\n}\n\n// Cache for measurement results to optimize performance (only used with renderText)\nconst measurementCache = new Map<string, number>();\n\n/**\n * Measures text width with optional render function for styled content\n * @param container - The container element to clone styles from\n * @param renderText - Optional render function to apply styling to text before measurement\n */\nexport const measureText = (\n container: HTMLElement,\n renderText?: ((text: string) => React.ReactNode) | null\n) => {\n const span = document.createElement(\"span\");\n span.style.opacity = \"0\";\n span.style.position = \"absolute\";\n span.style.top = \"-1000px\";\n span.style.left = \"-1000px\";\n span.style.whiteSpace = \"nowrap\";\n span.style.pointerEvents = \"none\";\n\n const nodeRect = container.getBoundingClientRect();\n\n const containerClone = container.cloneNode(true) as HTMLElement;\n containerClone.style.maxWidth = `${nodeRect.width}px`;\n containerClone.style.position = \"absolute\";\n containerClone.style.pointerEvents = \"none\";\n containerClone.style.top = \"-99px\";\n containerClone.style.left = \"-99px\";\n containerClone.style.zIndex = \"-1\";\n\n container.parentElement?.appendChild(containerClone);\n containerClone.appendChild(span);\n\n return {\n measure: (text: string) => {\n // Only use cache when measuring styled content (renderText case)\n // This preserves original behavior for default case\n if (renderText) {\n const cacheKey = `${text}-styled`;\n\n // Check cache first\n if (measurementCache.has(cacheKey)) {\n return measurementCache.get(cacheKey)!;\n }\n\n // Clear previous content\n span.innerHTML = \"\";\n\n // Render the content using renderText\n const rendered = renderText(text);\n\n // Handle different types of rendered content\n if (typeof rendered === \"string\") {\n // Simple string - just set innerHTML\n span.innerHTML = rendered;\n } else if (React.isValidElement(rendered)) {\n // React element - use renderToStaticMarkup for synchronous rendering\n try {\n const html = renderToStaticMarkup(rendered);\n span.innerHTML = html;\n } catch (_e) {\n // Fallback to plain text if renderToStaticMarkup fails\n span.innerText = text;\n }\n } else {\n // Fallback to plain text\n span.innerText = text;\n }\n\n const width = span.clientWidth;\n\n // Cache the result\n measurementCache.set(cacheKey, width);\n\n // Limit cache size to prevent memory leaks\n if (measurementCache.size > 100) {\n const firstKey = measurementCache.keys().next().value;\n measurementCache.delete(firstKey);\n }\n\n return width;\n }\n\n // Original behavior when renderText is not provided\n span.innerText = text;\n return span.clientWidth;\n },\n destroy: () => {\n containerClone.removeChild(span);\n container.parentElement?.removeChild(containerClone);\n },\n };\n};\n\nexport const getMiddleTruncatedString = (\n text: string,\n ellipsis: string,\n container: HTMLElement,\n renderText?: ((text: string) => React.ReactNode) | null\n): string => {\n if (!text) return text;\n\n const { measure: getTextWidth, destroy: destroyMeasure } =\n measureText(container, renderText);\n\n const textWidth = getTextWidth(text);\n\n const containerWidthToCompare = container.clientWidth;\n\n const initialOffset = Math.floor(\n (containerWidthToCompare / textWidth) * text.length\n );\n\n if (textWidth <= containerWidthToCompare) {\n destroyMeasure();\n return text;\n }\n\n let offset = initialOffset;\n const attempts: Record<number, [number, string]> = {};\n const maxAttempts = 20;\n const buffer = 4;\n\n while (Object.values(attempts).length <= maxAttempts) {\n // If we have already tried this offset, stop\n if (attempts[offset]) break;\n\n // If we are at the beginning of the string, just return the ellipsis\n if (offset <= 1) {\n attempts[0] = [0, ellipsis];\n break;\n }\n\n const start = text\n .slice(0, Math.ceil((offset - ellipsis.length) / 2 - 1))\n .trimEnd();\n const end = text\n .slice(Math.floor((offset - ellipsis.length) / 2) - offset)\n .trimStart();\n const truncatedStr = start + ellipsis + end;\n const width = getTextWidth(truncatedStr);\n\n attempts[offset] = [width, truncatedStr];\n\n if (width >= containerWidthToCompare) {\n offset = offset - 2;\n } else {\n // If we are close to the container width, stop\n if (containerWidthToCompare - width < buffer) break;\n offset = offset + 2;\n }\n }\n\n // Remove the span element used for measuring text\n destroyMeasure();\n\n // Find the closest attempt that is smaller than the container width\n return (\n Object.values(attempts)\n .reverse()\n .find(([width]) => width < containerWidthToCompare)?.[1] ??\n Object.values(attempts)[0][1]\n );\n};\n\n// Utility functions for measurements\nexport const createMeasurementClone = (\n text: string,\n container: HTMLElement\n) => {\n const styles = window.getComputedStyle(container);\n const clone = document.createElement(\"span\");\n clone.style.visibility = \"hidden\";\n clone.style.position = \"absolute\";\n clone.style.width = `${container.clientWidth}px`;\n clone.style.fontSize = styles.fontSize;\n clone.style.fontFamily = styles.fontFamily;\n clone.style.lineHeight = styles.lineHeight;\n clone.textContent = text;\n document.body.appendChild(clone);\n return clone;\n};\n\nexport const checkIfTextTruncated = (\n text: string,\n container: HTMLElement,\n availableHeight?: number\n) => {\n // Use the new checkOverflow utility for consistency\n return checkOverflow(container, {\n type: \"vertical\",\n availableHeight,\n text,\n });\n};\n\nexport const calculateAvailableHeight = (container: HTMLElement) => {\n const parent = container.parentElement;\n if (!parent) return 0;\n\n const parentStyles = window.getComputedStyle(parent);\n const paddingTop = parseFloat(parentStyles.paddingTop) || 0;\n const paddingBottom = parseFloat(parentStyles.paddingBottom) || 0;\n const borderTopWidth = parseFloat(parentStyles.borderTopWidth) || 0;\n const borderBottomWidth = parseFloat(parentStyles.borderBottomWidth) || 0;\n\n return (\n parent.clientHeight -\n paddingTop -\n paddingBottom -\n borderTopWidth -\n borderBottomWidth\n );\n};\n\nexport const calculateAvailableWidth = (container: HTMLElement) => {\n const parent = container.parentElement;\n if (!parent) return 0;\n\n const parentStyles = window.getComputedStyle(parent);\n const paddingLeft = parseFloat(parentStyles.paddingLeft) || 0;\n const paddingRight = parseFloat(parentStyles.paddingRight) || 0;\n const borderLeftWidth = parseFloat(parentStyles.borderLeftWidth) || 0;\n const borderRightWidth = parseFloat(parentStyles.borderRightWidth) || 0;\n\n return (\n parent.clientWidth -\n paddingLeft -\n paddingRight -\n borderLeftWidth -\n borderRightWidth\n );\n};\n\n// Overflow detection utilities\nexport type OverflowType = \"horizontal\" | \"vertical\" | \"both\";\n\nexport interface OverflowCheckOptions {\n type?: OverflowType;\n availableHeight?: number;\n text?: string;\n}\n\nexport const checkHorizontalOverflow = (container: HTMLElement): boolean => {\n return container.scrollWidth > container.clientWidth;\n};\n\nexport const checkVerticalOverflow = (\n container: HTMLElement,\n availableHeight?: number\n): boolean => {\n const compareHeight = availableHeight ?? (container.clientHeight || container.offsetHeight);\n return container.scrollHeight > compareHeight;\n};\n\nexport const checkOverflow = (\n container: HTMLElement,\n options: OverflowCheckOptions = {}\n): boolean => {\n const { type = \"horizontal\", availableHeight, text } = options;\n\n // If text is provided, use measurement clone for more accurate detection\n if (text) {\n const clone = createMeasurementClone(text, container);\n let isOverflowing = false;\n\n switch (type) {\n case \"horizontal\":\n isOverflowing = clone.scrollWidth > container.clientWidth;\n break;\n case \"vertical\":\n isOverflowing = availableHeight\n ? clone.scrollHeight > availableHeight\n : clone.scrollHeight > (container.clientHeight || container.offsetHeight);\n break;\n case \"both\":\n isOverflowing =\n clone.scrollWidth > container.clientWidth ||\n (availableHeight\n ? clone.scrollHeight > availableHeight\n : clone.scrollHeight > (container.clientHeight || container.offsetHeight));\n break;\n }\n\n document.body.removeChild(clone);\n return isOverflowing;\n }\n\n // Use direct container measurements\n switch (type) {\n case \"horizontal\":\n return checkHorizontalOverflow(container);\n case \"vertical\":\n return checkVerticalOverflow(container, availableHeight);\n case \"both\":\n return checkHorizontalOverflow(container) || checkVerticalOverflow(container, availableHeight);\n default:\n return checkHorizontalOverflow(container);\n }\n};\n"],"names":["measurementCache","measureText","container","renderText","span","nodeRect","containerClone","text","cacheKey","rendered","React","html","renderToStaticMarkup","width","firstKey","getMiddleTruncatedString","ellipsis","getTextWidth","destroyMeasure","textWidth","containerWidthToCompare","initialOffset","offset","attempts","maxAttempts","buffer","start","end","truncatedStr","createMeasurementClone","styles","clone","calculateAvailableHeight","parent","parentStyles","paddingTop","paddingBottom","borderTopWidth","borderBottomWidth","checkHorizontalOverflow","checkVerticalOverflow","availableHeight","compareHeight","checkOverflow","options","type","isOverflowing"],"mappings":";;AAiFA,MAAMA,wBAAuB,IAAA,GAOhBC,IAAc,CACzBC,GACAC,MACG;AACH,QAAMC,IAAO,SAAS,cAAc,MAAM;AAC1C,EAAAA,EAAK,MAAM,UAAU,KACrBA,EAAK,MAAM,WAAW,YACtBA,EAAK,MAAM,MAAM,WACjBA,EAAK,MAAM,OAAO,WAClBA,EAAK,MAAM,aAAa,UACxBA,EAAK,MAAM,gBAAgB;AAE3B,QAAMC,IAAWH,EAAU,sBAAA,GAErBI,IAAiBJ,EAAU,UAAU,EAAI;AAC/C,SAAAI,EAAe,MAAM,WAAW,GAAGD,EAAS,KAAK,MACjDC,EAAe,MAAM,WAAW,YAChCA,EAAe,MAAM,gBAAgB,QACrCA,EAAe,MAAM,MAAM,SAC3BA,EAAe,MAAM,OAAO,SAC5BA,EAAe,MAAM,SAAS,MAE9BJ,EAAU,eAAe,YAAYI,CAAc,GACnDA,EAAe,YA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C,CAAS,KAAKsC,EAAsBtC,GAAWuC,CAAe;AAAA,IAC/F;AACE,aAAOF,EAAwBrC,CAAS;AAAA,EAAA;AAE9C;"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { componentMetadata as r, getComponentsByCategory as t } from "./metadata.js";
2
2
  import { default as m } from "./components/utils/createSyntheticClickEvent.js";
3
- import { Affix as f, Alert as x, Anchor as s, App as l, AutoComplete as n, Avatar as i, BackTop as C, Calendar as c, Card as u, Carousel as T, Cascader as d, Col as g, ColorPicker as S, ConfigProvider as h, DatePicker as A, Descriptions as E, Divider as P, Drawer as b, Dropdown as R, Flex as k, FloatButton as D, Grid as I, InputNumber as L, Layout as O, List as y, Mentions as B, Menu as v, Pagination as N, Popconfirm as M, Progress as _, QRCode as w, Rate as U, Result as F, Row as W, Skeleton as V, Space as K, Statistic as q, Steps as z, Tabs as G, TimePicker as Q, Timeline as H, Transfer as j, TreeSelect as J, Typography as X, Watermark as Y, message as Z, notification as $, theme as ee, unstableSetRender as oe, version as re } from "antd";
3
+ import { Affix as f, Alert as x, Anchor as s, App as l, AutoComplete as n, Avatar as i, BackTop as C, Calendar as c, Card as u, Carousel as T, Cascader as d, Col as g, ColorPicker as S, ConfigProvider as h, DatePicker as A, Descriptions as E, Divider as P, Drawer as b, Dropdown as R, Flex as k, FloatButton as D, Grid as I, InputNumber as L, Layout as O, List as B, Mentions as v, Menu as y, Pagination as N, Popconfirm as M, Progress as _, QRCode as w, Rate as U, Result as F, Row as W, Skeleton as V, Space as K, Statistic as q, Steps as z, Tabs as G, TimePicker as Q, Timeline as H, Transfer as j, TreeSelect as J, Typography as X, Watermark as Y, message as Z, notification as $, theme as ee, unstableSetRender as oe, version as re } from "antd";
4
4
  import { DataTable as ae } from "./components/data-table/component.js";
5
5
  import { Select as pe } from "./components/select/component.js";
6
6
  import { Modal as xe } from "./components/modal/index.js";
@@ -14,7 +14,7 @@ import { TagList as Ee } from "./components/tag/list.js";
14
14
  import { ThemeProvider as be } from "./components/theme-provider/component.js";
15
15
  import { ThemeContext as ke, useTheme as De } from "./components/theme-provider/context/themeStore.js";
16
16
  import { ThemeContextProvider as Le } from "./components/theme-provider/context/provider.js";
17
- import { Split as ye, Splitter as Be } from "./components/splitter/component.js";
17
+ import { Split as Be, Splitter as ve } from "./components/splitter/component.js";
18
18
  import { Truncate as Ne } from "./components/truncate/component.js";
19
19
  import { DropdownMenu as _e } from "./components/dropdown-menu/component.js";
20
20
  import { DropdownMenuItem as Ue } from "./components/dropdown-menu/item.js";
@@ -37,7 +37,7 @@ import { DROPDOWN_COLLISION_AVOIDANCE as Eo, POPUP_COLLISION_AVOIDANCE as Po } f
37
37
  import { buildAntdPlacement as Ro, parseAntdPlacement as ko } from "./components/utils/placement.js";
38
38
  import { ScrollArea as Io } from "./components/scroll-area/component.js";
39
39
  import { Popover as Oo } from "./components/popover/component.js";
40
- import { Slider as Bo } from "./components/slider/component.js";
40
+ import { Slider as vo } from "./components/slider/component.js";
41
41
  import { Tooltip as No } from "./components/tooltip/component.js";
42
42
  import { Breadcrumb as _o } from "./components/breadcrumb/component.js";
43
43
  import { BreadcrumbItem as Uo } from "./components/breadcrumb/item.js";
@@ -45,51 +45,51 @@ import { useUniqueKeysTree as Wo } from "./components/tree/useUniqueKeysTree.js"
45
45
  import { getUniqueKeysFromOriginals as Ko, processTreeData as qo } from "./components/tree/helpers.js";
46
46
  import { Tree as Go } from "./components/tree/components.js";
47
47
  import { Spin as Ho } from "./components/spin/component.js";
48
- import { Empty as Jo, EmptyIcon as Xo } from "./components/empty/component.js";
49
- import { Form as Zo } from "./components/form/component.js";
50
- import { Field as er } from "./components/field/component.js";
51
- import { Tour as rr } from "./components/tour/component.js";
52
- import { Toast as ar } from "./components/toast/component.js";
53
- import { toast as pr, toastManager as fr } from "./components/toast/function.js";
54
- import { VerticalCollapsiblePanel as sr } from "./components/vertical-collapsible-panel/component.js";
55
- import { PopupPanel as nr } from "./components/popup-panel/component.js";
56
- import { CodeBlock as Cr } from "./components/code-block/component.js";
57
- import { StackChild as ur } from "./components/stack/StackChild.js";
58
- import { Stack as dr } from "./components/stack/index.js";
59
- import { Collapse as Sr } from "./components/collapse/component.js";
60
- import { Input as Ar } from "./components/input/component.js";
61
- import { Badge as Pr, InternalBadge as br } from "./components/badge/component.js";
62
- import { Radio as kr } from "./components/radio/component.js";
63
- import { Button as Ir } from "./components/button/component.js";
64
- import { DSRoot as Or } from "./components/ds-root/component.js";
48
+ import { Empty as Jo } from "./components/empty/component.js";
49
+ import { Form as Yo } from "./components/form/component.js";
50
+ import { Field as $o } from "./components/field/component.js";
51
+ import { Tour as or } from "./components/tour/component.js";
52
+ import { Toast as tr } from "./components/toast/component.js";
53
+ import { toast as mr, toastManager as pr } from "./components/toast/function.js";
54
+ import { VerticalCollapsiblePanel as xr } from "./components/vertical-collapsible-panel/component.js";
55
+ import { PopupPanel as lr } from "./components/popup-panel/component.js";
56
+ import { CodeBlock as ir } from "./components/code-block/component.js";
57
+ import { StackChild as cr } from "./components/stack/StackChild.js";
58
+ import { Stack as Tr } from "./components/stack/index.js";
59
+ import { Collapse as gr } from "./components/collapse/component.js";
60
+ import { Input as hr } from "./components/input/component.js";
61
+ import { Badge as Er, InternalBadge as Pr } from "./components/badge/component.js";
62
+ import { Radio as Rr } from "./components/radio/component.js";
63
+ import { Button as Dr } from "./components/button/component.js";
64
+ import { DSRoot as Lr } from "./components/ds-root/component.js";
65
65
  import { useDS as Br } from "./components/ds-root/hook.js";
66
- import { DragDrop as Nr, DragDropRoot as Mr } from "./components/drag-drop/index.js";
67
- import { ColorSelect as wr } from "./components/color-select/component.js";
68
- import { Nav as Fr } from "./components/nav/index.js";
69
- import { ChoiceList as Vr } from "./components/choice-list/component.js";
70
- import { StatusIcon as qr } from "./components/status-icon/component.js";
71
- import { Resizable as Gr } from "./components/resizable/component.js";
72
- import { Combobox as Hr } from "./components/combobox/component.js";
73
- import { SelectTrigger as Jr, SelectTriggerArrow as Xr, SelectTriggerClear as Yr, SelectTriggerContent as Zr, SelectTriggerRoot as $r } from "./components/select-trigger/component.js";
74
- import { Loader as ot } from "./components/loader/component.js";
75
- import { useForm as tt, useWatch as at } from "antd/es/form/Form";
76
- import { useMessage as pt, useModal as ft, useToken as xt } from "./components/hooks/antd.js";
77
- import { default as lt } from "antd/es/app/useApp";
78
- import { useAnimationsFinished as it, useEnhancedEffect as Ct, useEventCallback as ct, useLatestRef as ut } from "./components/hooks/base-ui.js";
79
- import { useControlledState as dt } from "./components/hooks/useControlledState.js";
80
- import { useCharts as St } from "./components/hooks/useCharts.js";
81
- import { useCSSVariables as At } from "./components/hooks/useCSSVariables.js";
82
- import { useHover as Pt } from "./components/hooks/useHover.js";
83
- import { useDraggable as Rt } from "./components/hooks/useDraggable.js";
84
- import { BREAKPOINTS as Dt, useBreakpoint as It } from "./components/hooks/useBreakpoint.js";
85
- import { useWindowSize as Ot } from "./components/hooks/useWindowSize.js";
66
+ import { DragDrop as yr, DragDropRoot as Nr } from "./components/drag-drop/index.js";
67
+ import { ColorSelect as _r } from "./components/color-select/component.js";
68
+ import { Nav as Ur } from "./components/nav/index.js";
69
+ import { ChoiceList as Wr } from "./components/choice-list/component.js";
70
+ import { StatusIcon as Kr } from "./components/status-icon/component.js";
71
+ import { Resizable as zr } from "./components/resizable/component.js";
72
+ import { Combobox as Qr } from "./components/combobox/component.js";
73
+ import { SelectTrigger as jr, SelectTriggerArrow as Jr, SelectTriggerClear as Xr, SelectTriggerContent as Yr, SelectTriggerRoot as Zr } from "./components/select-trigger/component.js";
74
+ import { Loader as et } from "./components/loader/component.js";
75
+ import { useForm as rt, useWatch as tt } from "antd/es/form/Form";
76
+ import { useMessage as mt, useModal as pt, useToken as ft } from "./components/hooks/antd.js";
77
+ import { default as st } from "antd/es/app/useApp";
78
+ import { useAnimationsFinished as nt, useEnhancedEffect as it, useEventCallback as Ct, useLatestRef as ct } from "./components/hooks/base-ui.js";
79
+ import { useControlledState as Tt } from "./components/hooks/useControlledState.js";
80
+ import { useCharts as gt } from "./components/hooks/useCharts.js";
81
+ import { useCSSVariables as ht } from "./components/hooks/useCSSVariables.js";
82
+ import { useHover as Et } from "./components/hooks/useHover.js";
83
+ import { useDraggable as bt } from "./components/hooks/useDraggable.js";
84
+ import { BREAKPOINTS as kt, useBreakpoint as Dt } from "./components/hooks/useBreakpoint.js";
85
+ import { useWindowSize as Lt } from "./components/hooks/useWindowSize.js";
86
86
  import { useElementSize as Bt, useResizeObserver as vt } from "./components/hooks/useResizeObserver.js";
87
- import { antdColorTokens as Mt, darkTheme as _t, lightTheme as wt } from "./tokens/and-theme/tokens.js";
88
- import { categoricalChartColorKeys as Ft, categoricalChartColorTokens as Wt, categoricalChartsColors as Vt, chartColorTokens as Kt, rawChartColorTokens as qt } from "./tokens/charts/palettes/cloudscape.js";
89
- import { COLORBREWER as Gt } from "./tokens/charts/palettes/colorbrewer.js";
90
- import { tab10 as Ht, tab20 as jt, tab20b as Jt, tab20c as Xt } from "./tokens/charts/palettes/tableau.js";
91
- import { CATEGORICAL_PALETTES as Zt, CATEGORICAL_PALETTE_NAMES as $t, SEQUENTIAL_PALETTES as ea, SEQUENTIAL_PALETTE_NAMES as oa, getAllCategoricalChartColors as ra, getAllSequentialChartColors as ta, getCategoricalChartColors as aa, getSequentialChartColors as ma } from "./tokens/charts/palettes/index.js";
92
- import { getColorsByTheme as fa, getTokensByTheme as xa, resolveColorTokens as sa } from "./tokens/utils.js";
87
+ import { antdColorTokens as Nt, darkTheme as Mt, lightTheme as _t } from "./tokens/and-theme/tokens.js";
88
+ import { categoricalChartColorKeys as Ut, categoricalChartColorTokens as Ft, categoricalChartsColors as Wt, chartColorTokens as Vt, rawChartColorTokens as Kt } from "./tokens/charts/palettes/cloudscape.js";
89
+ import { COLORBREWER as zt } from "./tokens/charts/palettes/colorbrewer.js";
90
+ import { tab10 as Qt, tab20 as Ht, tab20b as jt, tab20c as Jt } from "./tokens/charts/palettes/tableau.js";
91
+ import { CATEGORICAL_PALETTES as Yt, CATEGORICAL_PALETTE_NAMES as Zt, SEQUENTIAL_PALETTES as $t, SEQUENTIAL_PALETTE_NAMES as ea, getAllCategoricalChartColors as oa, getAllSequentialChartColors as ra, getCategoricalChartColors as ta, getSequentialChartColors as aa } from "./tokens/charts/palettes/index.js";
92
+ import { getColorsByTheme as pa, getTokensByTheme as fa, resolveColorTokens as xa } from "./tokens/utils.js";
93
93
  export {
94
94
  f as Affix,
95
95
  x as Alert,
@@ -97,93 +97,92 @@ export {
97
97
  l as App,
98
98
  n as AutoComplete,
99
99
  i as Avatar,
100
- Dt as BREAKPOINTS,
100
+ kt as BREAKPOINTS,
101
101
  C as BackTop,
102
- Pr as Badge,
102
+ Er as Badge,
103
103
  _o as Breadcrumb,
104
104
  Uo as BreadcrumbItem,
105
- Ir as Button,
106
- Zt as CATEGORICAL_PALETTES,
107
- $t as CATEGORICAL_PALETTE_NAMES,
108
- Gt as COLORBREWER,
105
+ Dr as Button,
106
+ Yt as CATEGORICAL_PALETTES,
107
+ Zt as CATEGORICAL_PALETTE_NAMES,
108
+ zt as COLORBREWER,
109
109
  c as Calendar,
110
110
  u as Card,
111
111
  T as Carousel,
112
112
  d as Cascader,
113
113
  ce as Checkbox,
114
- Vr as ChoiceList,
115
- Cr as CodeBlock,
114
+ Wr as ChoiceList,
115
+ ir as CodeBlock,
116
116
  g as Col,
117
- Sr as Collapse,
117
+ gr as Collapse,
118
118
  S as ColorPicker,
119
- wr as ColorSelect,
120
- Hr as Combobox,
119
+ _r as ColorSelect,
120
+ Qr as Combobox,
121
121
  We as CommandPalette,
122
122
  h as ConfigProvider,
123
123
  Eo as DROPDOWN_COLLISION_AVOIDANCE,
124
- Or as DSRoot,
124
+ Lr as DSRoot,
125
125
  ae as DataTable,
126
126
  A as DatePicker,
127
127
  Qe as DefaultUpload,
128
128
  E as Descriptions,
129
129
  P as Divider,
130
- Nr as DragDrop,
131
- Mr as DragDropRoot,
130
+ yr as DragDrop,
131
+ Nr as DragDropRoot,
132
132
  b as Drawer,
133
133
  R as Dropdown,
134
134
  _e as DropdownMenu,
135
135
  Ue as DropdownMenuItem,
136
136
  Jo as Empty,
137
- Xo as EmptyIcon,
138
- er as Field,
137
+ $o as Field,
139
138
  k as Flex,
140
139
  D as FloatButton,
141
- Zo as Form,
140
+ Yo as Form,
142
141
  I as Grid,
143
142
  le as IconButton,
144
- Ar as Input,
143
+ hr as Input,
145
144
  L as InputNumber,
146
- br as InternalBadge,
145
+ Pr as InternalBadge,
147
146
  Ke as KeyboardShortcut,
148
147
  O as Layout,
149
- y as List,
150
- ot as Loader,
151
- B as Mentions,
152
- v as Menu,
148
+ B as List,
149
+ et as Loader,
150
+ v as Mentions,
151
+ y as Menu,
153
152
  xe as Modal,
154
- Fr as Nav,
153
+ Ur as Nav,
155
154
  Po as POPUP_COLLISION_AVOIDANCE,
156
155
  N as Pagination,
157
156
  M as Popconfirm,
158
157
  Oo as Popover,
159
- nr as PopupPanel,
158
+ lr as PopupPanel,
160
159
  _ as Progress,
161
160
  w as QRCode,
162
- kr as Radio,
161
+ Rr as Radio,
163
162
  U as Rate,
164
- Gr as Resizable,
163
+ zr as Resizable,
165
164
  F as Result,
166
165
  W as Row,
167
- ea as SEQUENTIAL_PALETTES,
168
- oa as SEQUENTIAL_PALETTE_NAMES,
166
+ $t as SEQUENTIAL_PALETTES,
167
+ ea as SEQUENTIAL_PALETTE_NAMES,
169
168
  Io as ScrollArea,
170
169
  Te as Segmented,
171
170
  pe as Select,
172
- Jr as SelectTrigger,
173
- Xr as SelectTriggerArrow,
174
- Yr as SelectTriggerClear,
175
- Zr as SelectTriggerContent,
176
- $r as SelectTriggerRoot,
171
+ jr as SelectTrigger,
172
+ Jr as SelectTriggerArrow,
173
+ Xr as SelectTriggerClear,
174
+ Yr as SelectTriggerContent,
175
+ Zr as SelectTriggerRoot,
177
176
  V as Skeleton,
178
- Bo as Slider,
177
+ vo as Slider,
179
178
  K as Space,
180
179
  Ho as Spin,
181
- ye as Split,
182
- Be as Splitter,
183
- dr as Stack,
184
- ur as StackChild,
180
+ Be as Split,
181
+ ve as Splitter,
182
+ Tr as Stack,
183
+ cr as StackChild,
185
184
  q as Statistic,
186
- qr as StatusIcon,
185
+ Kr as StatusIcon,
187
186
  z as Steps,
188
187
  ie as Switch,
189
188
  ge as Table,
@@ -195,9 +194,9 @@ export {
195
194
  be as ThemeProvider,
196
195
  Q as TimePicker,
197
196
  H as Timeline,
198
- ar as Toast,
197
+ tr as Toast,
199
198
  No as Tooltip,
200
- rr as Tour,
199
+ or as Tour,
201
200
  j as Transfer,
202
201
  ze as Transition,
203
202
  Go as Tree,
@@ -205,77 +204,77 @@ export {
205
204
  Ne as Truncate,
206
205
  X as Typography,
207
206
  He as Upload,
208
- sr as VerticalCollapsiblePanel,
207
+ xr as VerticalCollapsiblePanel,
209
208
  Y as Watermark,
210
209
  fo as WithRenderProp,
211
- Mt as antdColorTokens,
210
+ Nt as antdColorTokens,
212
211
  Ro as buildAntdPlacement,
213
- Ft as categoricalChartColorKeys,
214
- Wt as categoricalChartColorTokens,
215
- Vt as categoricalChartsColors,
212
+ Ut as categoricalChartColorKeys,
213
+ Ft as categoricalChartColorTokens,
214
+ Wt as categoricalChartsColors,
216
215
  go as changeThemeWithoutTransition,
217
- Kt as chartColorTokens,
216
+ Vt as chartColorTokens,
218
217
  Ye as clsx,
219
218
  Ze as cn,
220
219
  r as componentMetadata,
221
220
  m as createSyntheticClickEvent,
222
221
  $e as cx,
223
- _t as darkTheme,
224
- ra as getAllCategoricalChartColors,
225
- ta as getAllSequentialChartColors,
226
- aa as getCategoricalChartColors,
227
- fa as getColorsByTheme,
222
+ Mt as darkTheme,
223
+ oa as getAllCategoricalChartColors,
224
+ ra as getAllSequentialChartColors,
225
+ ta as getCategoricalChartColors,
226
+ pa as getColorsByTheme,
228
227
  t as getComponentsByCategory,
229
228
  so as getReactElementProp,
230
- ma as getSequentialChartColors,
231
- xa as getTokensByTheme,
229
+ aa as getSequentialChartColors,
230
+ fa as getTokensByTheme,
232
231
  Ko as getUniqueKeysFromOriginals,
233
232
  to as isTracebackError,
234
233
  mo as isValidHexColor,
235
- wt as lightTheme,
234
+ _t as lightTheme,
236
235
  no as mergeRefs,
237
236
  Z as message,
238
237
  ho as moveTypingCursorToEnd,
239
238
  $ as notification,
240
239
  ko as parseAntdPlacement,
241
240
  qo as processTreeData,
242
- qt as rawChartColorTokens,
241
+ Kt as rawChartColorTokens,
243
242
  oo as reactNodeToString,
244
- sa as resolveColorTokens,
245
- Ht as tab10,
246
- jt as tab20,
247
- Jt as tab20b,
248
- Xt as tab20c,
243
+ xa as resolveColorTokens,
244
+ Qt as tab10,
245
+ Ht as tab20,
246
+ jt as tab20b,
247
+ Jt as tab20c,
249
248
  ee as theme,
250
- pr as toast,
251
- fr as toastManager,
249
+ mr as toast,
250
+ pr as toastManager,
252
251
  oe as unstableSetRender,
253
- it as useAnimationsFinished,
252
+ nt as useAnimationsFinished,
254
253
  Co as useAntdCssVarClassname,
255
- lt as useApp,
256
- It as useBreakpoint,
257
- At as useCSSVariables,
258
- St as useCharts,
254
+ st as useApp,
255
+ Dt as useBreakpoint,
256
+ ht as useCSSVariables,
257
+ gt as useCharts,
259
258
  co as useCls,
260
- dt as useControlledState,
259
+ Tt as useControlledState,
261
260
  Br as useDS,
262
- Rt as useDraggable,
261
+ bt as useDraggable,
263
262
  Bt as useElementSize,
264
- Ct as useEnhancedEffect,
265
- ct as useEventCallback,
266
- tt as useForm,
263
+ it as useEnhancedEffect,
264
+ Ct as useEventCallback,
265
+ rt as useForm,
267
266
  uo as useGetPrefixCls,
268
- Pt as useHover,
269
- ut as useLatestRef,
270
- pt as useMessage,
271
- ft as useModal,
267
+ Et as useHover,
268
+ ct as useLatestRef,
269
+ mt as useMessage,
270
+ pt as useModal,
272
271
  vt as useResizeObserver,
273
272
  De as useTheme,
274
- xt as useToken,
273
+ ft as useToken,
275
274
  Wo as useUniqueKeysTree,
276
275
  Je as useUploadItemRender,
277
- at as useWatch,
278
- Ot as useWindowSize,
276
+ tt as useWatch,
277
+ Lt as useWindowSize,
279
278
  re as version
280
279
  };
281
280
  //# sourceMappingURL=index.js.map