@stackone/malachite 2.86.0 → 2.88.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.
Files changed (66) hide show
  1. package/COMPONENTS.md +5 -4
  2. package/dist/components/Accordion.js +206 -179
  3. package/dist/components/Accordion.js.map +1 -1
  4. package/dist/components/Button.js +118 -81
  5. package/dist/components/Button.js.map +1 -1
  6. package/dist/components/Card.js +128 -75
  7. package/dist/components/Card.js.map +1 -1
  8. package/dist/components/Chat/ChatModelPicker.js +70 -67
  9. package/dist/components/Chat/ChatModelPicker.js.map +1 -1
  10. package/dist/components/FilterSearch.js +237 -232
  11. package/dist/components/FilterSearch.js.map +1 -1
  12. package/dist/components/FrameHeader.js +36 -0
  13. package/dist/components/FrameHeader.js.map +1 -0
  14. package/dist/components/LoadingBar.js +5 -5
  15. package/dist/components/LoadingBar.js.map +1 -1
  16. package/dist/components/MultiSelect.js +438 -388
  17. package/dist/components/MultiSelect.js.map +1 -1
  18. package/dist/components/PinnedCornerCap.js +32 -19
  19. package/dist/components/PinnedCornerCap.js.map +1 -1
  20. package/dist/components/QueryInput.js +95 -92
  21. package/dist/components/QueryInput.js.map +1 -1
  22. package/dist/components/SplitButton.js +62 -61
  23. package/dist/components/SplitButton.js.map +1 -1
  24. package/dist/components/Surface.js +98 -94
  25. package/dist/components/Surface.js.map +1 -1
  26. package/dist/components/Table/Table.js +630 -606
  27. package/dist/components/Table/Table.js.map +1 -1
  28. package/dist/components/TimeBarChart/TimeBarChart.js +241 -0
  29. package/dist/components/TimeBarChart/TimeBarChart.js.map +1 -0
  30. package/dist/components/TimeBarChart/TimeBarChartAxes.js +49 -0
  31. package/dist/components/TimeBarChart/TimeBarChartAxes.js.map +1 -0
  32. package/dist/components/TimeBarChart/TimeBarChartBars.js +58 -0
  33. package/dist/components/TimeBarChart/TimeBarChartBars.js.map +1 -0
  34. package/dist/components/TimeBarChart/TimeBarChartLegend.js +29 -0
  35. package/dist/components/TimeBarChart/TimeBarChartLegend.js.map +1 -0
  36. package/dist/components/TimeBarChart/TimeBarChartTable.js +33 -0
  37. package/dist/components/TimeBarChart/TimeBarChartTable.js.map +1 -0
  38. package/dist/components/TimeBarChart/TimeBarChartTooltip.js +77 -0
  39. package/dist/components/TimeBarChart/TimeBarChartTooltip.js.map +1 -0
  40. package/dist/components/TimeBarChart/stackLayout.js +25 -0
  41. package/dist/components/TimeBarChart/stackLayout.js.map +1 -0
  42. package/dist/components/TimeBarChart/timeBuckets.js +133 -0
  43. package/dist/components/TimeBarChart/timeBuckets.js.map +1 -0
  44. package/dist/components/TimeBarChart/tones.js +10 -0
  45. package/dist/components/TimeBarChart/tones.js.map +1 -0
  46. package/dist/components/Tooltip.js +93 -90
  47. package/dist/components/Tooltip.js.map +1 -1
  48. package/dist/components/activeElement.js +5 -1
  49. package/dist/components/activeElement.js.map +1 -1
  50. package/dist/components/dateMath.js +1 -0
  51. package/dist/components/dateMath.js.map +1 -1
  52. package/dist/components/filterSearchModel.js +53 -45
  53. package/dist/components/filterSearchModel.js.map +1 -1
  54. package/dist/components/frameStyles.js +14 -0
  55. package/dist/components/frameStyles.js.map +1 -0
  56. package/dist/components/headerContent.js +10 -0
  57. package/dist/components/headerContent.js.map +1 -0
  58. package/dist/components/useFollowTrigger.js +28 -0
  59. package/dist/components/useFollowTrigger.js.map +1 -0
  60. package/dist/index.d.ts +131 -9
  61. package/dist/index.js +24 -22
  62. package/dist/index.js.map +1 -1
  63. package/dist/tailwind.css.js +1 -1
  64. package/dist/theme.js +340 -340
  65. package/dist/theme.js.map +1 -1
  66. package/package.json +1 -1
@@ -1,118 +1,171 @@
1
- import { jsxs as A, jsx as c } from "react/jsx-runtime";
2
- import { useRef as H, useState as P, useEffect as _ } from "react";
3
- import { GLASS_SURFACE_STYLE as g } from "./glassSurface.js";
4
- const D = /^\d*\.?\d+(px|rem|em)$/, G = (a) => {
5
- const o = a.trim().split(/\s+/);
6
- if (o.length > 4 || !o.every((p) => D.test(p)))
1
+ import { jsxs as _, jsx as n } from "react/jsx-runtime";
2
+ import { useRef as h, useState as j, useEffect as G } from "react";
3
+ import P, { HeaderRow as k } from "./FrameHeader.js";
4
+ import { FRAME_CLASS as F, FRAME_SECTION_STYLE as M } from "./frameStyles.js";
5
+ import { GLASS_SURFACE_STYLE as U } from "./glassSurface.js";
6
+ import { hasHeaderContent as A } from "./headerContent.js";
7
+ import { FOREGROUND_RESET as W } from "./selectedRow.js";
8
+ const Y = /^\d*\.?\d+(px|rem|em)$/, V = (m) => {
9
+ const t = m.trim().split(/\s+/);
10
+ if (t.length > 4 || !t.every((d) => Y.test(d)))
7
11
  return;
8
- const [r, n = r, , d = n] = o;
9
- return parseFloat(d) > 0 && parseFloat(n) > 0 ? { paddingLeft: d, paddingRight: n } : void 0;
10
- }, U = ({
11
- title: a,
12
- children: o,
13
- padding: r = "20px",
14
- size: n = "default",
15
- width: d,
16
- minWidth: p,
17
- dimmed: R = !1,
18
- direction: f,
19
- align: h,
20
- fullHeight: x = !1,
21
- border: m = "base",
12
+ const [l, s = l, , i = s] = t;
13
+ return parseFloat(i) > 0 && parseFloat(s) > 0 ? { paddingLeft: i, paddingRight: s } : void 0;
14
+ }, te = ({
15
+ variant: m = "default",
16
+ title: t,
17
+ subtitle: l,
18
+ extra: s,
19
+ children: i,
20
+ padding: d = "20px",
21
+ size: v = "default",
22
+ width: u,
23
+ minWidth: y,
24
+ dimmed: B = !1,
25
+ direction: c,
26
+ align: R,
27
+ fullHeight: f = !1,
28
+ border: x = "base",
22
29
  alignSelf: S,
23
- height: i,
24
- footer: t,
25
- glassFooter: e = !1,
26
- className: N = "",
27
- style: w = {},
28
- headerConfig: s = {}
30
+ height: o,
31
+ footer: e,
32
+ glassFooter: r = !1,
33
+ className: E = "",
34
+ style: N = {},
35
+ headerConfig: a = {}
29
36
  }) => {
30
- const l = H(null), [u, v] = P(0);
31
- _(() => {
32
- if (e && t && l.current) {
33
- const b = new ResizeObserver((E) => {
34
- for (const j of E)
35
- v(j.contentRect.height);
37
+ const p = h(null), [w, L] = j(0);
38
+ G(() => {
39
+ if (r && e && p.current) {
40
+ const I = new ResizeObserver((O) => {
41
+ for (const $ of O)
42
+ L($.contentRect.height);
36
43
  });
37
- return b.observe(l.current), v(l.current.offsetHeight), () => b.disconnect();
44
+ return I.observe(p.current), L(p.current.offsetHeight), () => I.disconnect();
38
45
  }
39
- }, [e, t]);
40
- const L = [
46
+ }, [r, e]);
47
+ const H = [
41
48
  "card-base",
42
- R ? "card-dimmed" : "",
43
- m === "rounded" ? "card-rounded" : "",
44
- x ? "h-full" : "",
45
- i ? "flex flex-col" : "",
46
- n === "small" ? "text-sm" : "",
47
- N
48
- ].filter(Boolean).join(" "), y = s != null && s.padding ? void 0 : G(r), B = parseInt(r) || 20, I = {
49
- padding: r,
49
+ B ? "card-dimmed" : "",
50
+ x === "rounded" ? "card-rounded" : "",
51
+ f ? "h-full" : "",
52
+ o ? "flex flex-col" : "",
53
+ v === "small" ? "text-sm" : "",
54
+ E
55
+ ].filter(Boolean).join(" "), b = a != null && a.padding ? void 0 : V(d), T = parseInt(d) || 20, z = {
56
+ padding: d,
50
57
  // The card clips overflow, so a long token in flowing text breaks rather than vanishing.
51
58
  // Flex and grid items keep their min-content width; those need their own wrapping.
52
59
  overflowWrap: "break-word",
53
- display: f ? "flex" : void 0,
54
- flexDirection: f,
55
- alignItems: h,
56
- ...i && { overflow: "auto", height: "100%" },
57
- ...e && t && u > 0 && {
58
- paddingBottom: `${B + u + 10}px`
60
+ display: c ? "flex" : void 0,
61
+ flexDirection: c,
62
+ alignItems: R,
63
+ ...o && { overflow: "auto", height: "100%" },
64
+ ...r && e && w > 0 && {
65
+ paddingBottom: `${T + w + 10}px`
59
66
  }
60
- }, z = {
61
- width: d,
62
- minWidth: p,
67
+ };
68
+ if (m === "framed")
69
+ return /* @__PURE__ */ _(
70
+ "div",
71
+ {
72
+ className: `${F} flex flex-col ${E}`,
73
+ style: {
74
+ // The frame drops `card-base`, which carried the text colour.
75
+ ...W,
76
+ width: u,
77
+ minWidth: y,
78
+ alignSelf: S,
79
+ ...f && { height: "100%" },
80
+ ...o && { height: o },
81
+ ...N
82
+ },
83
+ children: [
84
+ A({ title: t, subtitle: l, extra: s }) && /* @__PURE__ */ n(P, { title: t, subtitle: l, extra: s }),
85
+ /* @__PURE__ */ n(
86
+ "div",
87
+ {
88
+ className: "min-h-0 flex-1",
89
+ style: {
90
+ ...M,
91
+ padding: d,
92
+ overflowWrap: "break-word",
93
+ display: c ? "flex" : void 0,
94
+ flexDirection: c,
95
+ alignItems: R,
96
+ ...o && { overflow: "auto" }
97
+ },
98
+ children: i
99
+ }
100
+ ),
101
+ e && /* @__PURE__ */ n("div", { className: "px-4 py-3", children: e })
102
+ ]
103
+ }
104
+ );
105
+ const D = {
106
+ width: u,
107
+ minWidth: y,
63
108
  alignSelf: S,
64
- ...x && { height: "100%" },
65
- ...i && { height: i, display: "flex", flexDirection: "column" },
66
- ...e && t && { position: "relative" },
109
+ ...f && { height: "100%" },
110
+ ...o && { height: o, display: "flex", flexDirection: "column" },
111
+ ...r && e && { position: "relative" },
67
112
  overflow: "hidden",
68
- ...w
113
+ ...N
69
114
  };
70
- return /* @__PURE__ */ A("div", { className: L, style: z, children: [
71
- a && /* @__PURE__ */ c(
115
+ return /* @__PURE__ */ _("div", { className: H, style: D, children: [
116
+ A({ title: t, subtitle: l, extra: s }) && /* @__PURE__ */ n(
72
117
  "div",
73
118
  {
74
- className: y ? "card-header py-2" : "card-header px-3 py-2",
119
+ className: b ? "card-header py-2" : "card-header px-3 py-2",
75
120
  style: {
76
121
  marginBottom: "1px",
77
- fontSize: n === "small" ? "12px" : "13px",
122
+ fontSize: v === "small" ? "12px" : "13px",
78
123
  fontWeight: "normal",
79
- ...s != null && s.padding ? { padding: s.padding } : y
124
+ ...a != null && a.padding ? { padding: a.padding } : b
80
125
  },
81
- children: /* @__PURE__ */ c("div", { className: "font-normal overflow-visible", children: a })
126
+ children: /* @__PURE__ */ n(
127
+ k,
128
+ {
129
+ title: t,
130
+ subtitle: l,
131
+ extra: s,
132
+ titleClassName: "font-normal overflow-visible"
133
+ }
134
+ )
82
135
  }
83
136
  ),
84
- /* @__PURE__ */ c(
137
+ /* @__PURE__ */ n(
85
138
  "div",
86
139
  {
87
140
  className: "flex-1",
88
141
  style: {
89
- ...I,
90
- ...e && t && { position: "relative" }
142
+ ...z,
143
+ ...r && e && { position: "relative" }
91
144
  },
92
- children: o
145
+ children: i
93
146
  }
94
147
  ),
95
- t && /* @__PURE__ */ c(
148
+ e && /* @__PURE__ */ n(
96
149
  "div",
97
150
  {
98
- ref: e ? l : void 0,
151
+ ref: r ? p : void 0,
99
152
  className: "card-footer px-4 py-3",
100
- style: e ? {
101
- ...g,
153
+ style: r ? {
154
+ ...U,
102
155
  position: "absolute",
103
156
  bottom: 0,
104
157
  left: 0,
105
158
  right: 0,
106
- borderBottomLeftRadius: m === "rounded" ? "20px" : "12px",
107
- borderBottomRightRadius: m === "rounded" ? "20px" : "12px"
159
+ borderBottomLeftRadius: x === "rounded" ? "20px" : "12px",
160
+ borderBottomRightRadius: x === "rounded" ? "20px" : "12px"
108
161
  } : void 0,
109
- children: t
162
+ children: e
110
163
  }
111
164
  )
112
165
  ] });
113
166
  };
114
167
  export {
115
- U as Card,
116
- U as default
168
+ te as Card,
169
+ te as default
117
170
  };
118
171
  //# sourceMappingURL=Card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sources":["../../src/components/Card.tsx"],"sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\n\ninterface CardProps {\n title?: string | React.ReactNode;\n padding?: string;\n children?: React.ReactNode;\n size?: 'default' | 'small';\n width?: string;\n minWidth?: string;\n direction?: 'row' | 'column';\n align?: 'center';\n dimmed?: boolean;\n fullHeight?: boolean;\n border?: 'base' | 'rounded';\n alignSelf?: 'center';\n height?: string;\n footer?: React.ReactNode;\n glassFooter?: boolean;\n className?: string;\n style?: React.CSSProperties;\n headerConfig?: {\n padding?: string;\n };\n}\n\nconst PLAIN_LENGTH = /^\\d*\\.?\\d+(px|rem|em)$/;\n\n// Only plain positive lengths are copied: calc() and var() can't be split from a shorthand, and a\n// zero inset would put the title against the border, so those keep the header's own 12px.\nconst horizontalInset = (padding: string): React.CSSProperties | undefined => {\n const parts = padding.trim().split(/\\s+/);\n if (parts.length > 4 || !parts.every((part) => PLAIN_LENGTH.test(part))) {\n return undefined;\n }\n const [top, right = top, , left = right] = parts;\n return parseFloat(left) > 0 && parseFloat(right) > 0\n ? { paddingLeft: left, paddingRight: right }\n : undefined;\n};\n\nconst Card: React.FC<CardProps> = ({\n title,\n children,\n padding = '20px',\n size = 'default',\n width,\n minWidth,\n dimmed = false,\n direction,\n align,\n fullHeight = false,\n border = 'base',\n alignSelf,\n height,\n footer,\n glassFooter = false,\n className = '',\n style = {},\n headerConfig = {},\n}) => {\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n useEffect(() => {\n if (glassFooter && footer && footerRef.current) {\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setFooterHeight(entry.contentRect.height);\n }\n });\n\n observer.observe(footerRef.current);\n setFooterHeight(footerRef.current.offsetHeight);\n\n return () => observer.disconnect();\n }\n }, [glassFooter, footer]);\n\n // Size-specific padding\n const sizeClasses = size === 'small' ? 'text-sm' : '';\n\n // Dynamic classes based on props\n const cardClasses = [\n 'card-base',\n dimmed ? 'card-dimmed' : '',\n border === 'rounded' ? 'card-rounded' : '',\n fullHeight ? 'h-full' : '',\n height ? 'flex flex-col' : '',\n sizeClasses,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const headerInset = headerConfig?.padding ? undefined : horizontalInset(padding);\n\n // Content styles\n const paddingValue = parseInt(padding) || 20;\n const extraPadding = 10;\n const contentStyles: React.CSSProperties = {\n padding,\n // The card clips overflow, so a long token in flowing text breaks rather than vanishing.\n // Flex and grid items keep their min-content width; those need their own wrapping.\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto', height: '100%' }),\n ...(glassFooter &&\n footer &&\n footerHeight > 0 && {\n paddingBottom: `${paddingValue + footerHeight + extraPadding}px`,\n }),\n };\n\n // Card container styles\n const cardContainerStyles: React.CSSProperties = {\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height, display: 'flex', flexDirection: 'column' }),\n ...(glassFooter && footer && { position: 'relative' }),\n overflow: 'hidden',\n ...style,\n };\n\n return (\n <div className={cardClasses} style={cardContainerStyles}>\n {/* Header */}\n {title && (\n <div\n className={headerInset ? 'card-header py-2' : 'card-header px-3 py-2'}\n style={{\n marginBottom: '1px',\n fontSize: size === 'small' ? '12px' : '13px',\n fontWeight: 'normal',\n ...(headerConfig?.padding\n ? { padding: headerConfig.padding }\n : headerInset),\n }}\n >\n <div className=\"font-normal overflow-visible\">{title}</div>\n </div>\n )}\n\n {/* Body */}\n <div\n className=\"flex-1\"\n style={{\n ...contentStyles,\n ...(glassFooter && footer && { position: 'relative' }),\n }}\n >\n {children}\n </div>\n\n {/* Footer */}\n {footer && (\n <div\n ref={glassFooter ? footerRef : undefined}\n className=\"card-footer px-4 py-3\"\n style={\n glassFooter\n ? {\n ...GLASS_SURFACE_STYLE,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n borderBottomLeftRadius: border === 'rounded' ? '20px' : '12px',\n borderBottomRightRadius: border === 'rounded' ? '20px' : '12px',\n }\n : undefined\n }\n >\n {footer}\n </div>\n )}\n </div>\n );\n};\n\nexport default Card;\nexport { Card };\n"],"names":["PLAIN_LENGTH","horizontalInset","padding","parts","part","top","right","left","Card","title","children","size","width","minWidth","dimmed","direction","align","fullHeight","border","alignSelf","height","footer","glassFooter","className","style","headerConfig","footerRef","useRef","footerHeight","setFooterHeight","useState","useEffect","observer","entries","entry","cardClasses","headerInset","paddingValue","contentStyles","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AAA,EAAc,UACZ,EAAE,SAASA,EAAa,YACxBW;AAAA,QAAA;AAAA,QAGV,UAAA,gBAAAK,EAAC,OAAA,EAAI,WAAU,gCAAgC,UAAAhC,EAAA,CAAM;AAAA,MAAA;AAAA,IAAA;AAAA,IAK7D,gBAAAgC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAU;AAAA,QACV,OAAO;AAAA,UACH,GAAGH;AAAA,UACH,GAAIhB,KAAeD,KAAU,EAAE,UAAU,WAAA;AAAA,QAAW;AAAA,QAGvD,UAAAX;AAAA,MAAA;AAAA,IAAA;AAAA,IAIJW,KACG,gBAAAoB;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,KAAKnB,IAAcI,IAAY;AAAA,QAC/B,WAAU;AAAA,QACV,OACIJ,IACM;AAAA,UACI,GAAGoB;AAAA,UACH,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,MAAM;AAAA,UACN,OAAO;AAAA,UACP,wBAAwBxB,MAAW,YAAY,SAAS;AAAA,UACxD,yBAAyBA,MAAW,YAAY,SAAS;AAAA,QAAA,IAE7D;AAAA,QAGT,UAAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GAER;AAER;"}
1
+ {"version":3,"file":"Card.js","sources":["../../src/components/Card.tsx"],"sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport FrameHeader, { HeaderRow } from './FrameHeader';\nimport { FRAME_CLASS, FRAME_SECTION_STYLE } from './frameStyles';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\nimport { hasHeaderContent } from './headerContent';\nimport { FOREGROUND_RESET } from './selectedRow';\n\nexport type CardVariant = 'default' | 'framed';\n\ninterface CardProps {\n /**\n * `framed` draws the detached Table's frame: the title row sits on a grey frame and the\n * children in a bordered section inside it, so a card above a table reads as part of the\n * same set. `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to it.\n */\n variant?: CardVariant;\n title?: string | React.ReactNode;\n /** Dimmed text beside the title, such as a count or a unit. */\n subtitle?: React.ReactNode;\n /** Actions at the right of the title row. */\n extra?: React.ReactNode;\n padding?: string;\n children?: React.ReactNode;\n size?: 'default' | 'small';\n width?: string;\n minWidth?: string;\n direction?: 'row' | 'column';\n align?: 'center';\n dimmed?: boolean;\n fullHeight?: boolean;\n border?: 'base' | 'rounded';\n alignSelf?: 'center';\n height?: string;\n footer?: React.ReactNode;\n glassFooter?: boolean;\n className?: string;\n style?: React.CSSProperties;\n headerConfig?: {\n padding?: string;\n };\n}\n\nconst PLAIN_LENGTH = /^\\d*\\.?\\d+(px|rem|em)$/;\n\n// Only plain positive lengths are copied: calc() and var() can't be split from a shorthand, and a\n// zero inset would put the title against the border, so those keep the header's own 12px.\nconst horizontalInset = (padding: string): React.CSSProperties | undefined => {\n const parts = padding.trim().split(/\\s+/);\n if (parts.length > 4 || !parts.every((part) => PLAIN_LENGTH.test(part))) {\n return undefined;\n }\n const [top, right = top, , left = right] = parts;\n return parseFloat(left) > 0 && parseFloat(right) > 0\n ? { paddingLeft: left, paddingRight: right }\n : undefined;\n};\n\nconst Card: React.FC<CardProps> = ({\n variant = 'default',\n title,\n subtitle,\n extra,\n children,\n padding = '20px',\n size = 'default',\n width,\n minWidth,\n dimmed = false,\n direction,\n align,\n fullHeight = false,\n border = 'base',\n alignSelf,\n height,\n footer,\n glassFooter = false,\n className = '',\n style = {},\n headerConfig = {},\n}) => {\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n useEffect(() => {\n if (glassFooter && footer && footerRef.current) {\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setFooterHeight(entry.contentRect.height);\n }\n });\n\n observer.observe(footerRef.current);\n setFooterHeight(footerRef.current.offsetHeight);\n\n return () => observer.disconnect();\n }\n }, [glassFooter, footer]);\n\n // Size-specific padding\n const sizeClasses = size === 'small' ? 'text-sm' : '';\n\n // Dynamic classes based on props\n const cardClasses = [\n 'card-base',\n dimmed ? 'card-dimmed' : '',\n border === 'rounded' ? 'card-rounded' : '',\n fullHeight ? 'h-full' : '',\n height ? 'flex flex-col' : '',\n sizeClasses,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const headerInset = headerConfig?.padding ? undefined : horizontalInset(padding);\n\n // Content styles\n const paddingValue = parseInt(padding) || 20;\n const extraPadding = 10;\n const contentStyles: React.CSSProperties = {\n padding,\n // The card clips overflow, so a long token in flowing text breaks rather than vanishing.\n // Flex and grid items keep their min-content width; those need their own wrapping.\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto', height: '100%' }),\n ...(glassFooter &&\n footer &&\n footerHeight > 0 && {\n paddingBottom: `${paddingValue + footerHeight + extraPadding}px`,\n }),\n };\n\n if (variant === 'framed') {\n return (\n <div\n className={`${FRAME_CLASS} flex flex-col ${className}`}\n style={{\n // The frame drops `card-base`, which carried the text colour.\n ...FOREGROUND_RESET,\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height }),\n ...style,\n }}\n >\n {hasHeaderContent({ title, subtitle, extra }) && (\n <FrameHeader title={title} subtitle={subtitle} extra={extra} />\n )}\n <div\n className=\"min-h-0 flex-1\"\n style={{\n ...FRAME_SECTION_STYLE,\n padding,\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto' }),\n }}\n >\n {children}\n </div>\n {footer && <div className=\"px-4 py-3\">{footer}</div>}\n </div>\n );\n }\n\n // Card container styles\n const cardContainerStyles: React.CSSProperties = {\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height, display: 'flex', flexDirection: 'column' }),\n ...(glassFooter && footer && { position: 'relative' }),\n overflow: 'hidden',\n ...style,\n };\n\n return (\n <div className={cardClasses} style={cardContainerStyles}>\n {/* Header */}\n {hasHeaderContent({ title, subtitle, extra }) && (\n <div\n className={headerInset ? 'card-header py-2' : 'card-header px-3 py-2'}\n style={{\n marginBottom: '1px',\n fontSize: size === 'small' ? '12px' : '13px',\n fontWeight: 'normal',\n ...(headerConfig?.padding\n ? { padding: headerConfig.padding }\n : headerInset),\n }}\n >\n <HeaderRow\n title={title}\n subtitle={subtitle}\n extra={extra}\n titleClassName=\"font-normal overflow-visible\"\n />\n </div>\n )}\n\n {/* Body */}\n <div\n className=\"flex-1\"\n style={{\n ...contentStyles,\n ...(glassFooter && footer && { position: 'relative' }),\n }}\n >\n {children}\n </div>\n\n {/* Footer */}\n {footer && (\n <div\n ref={glassFooter ? footerRef : undefined}\n className=\"card-footer px-4 py-3\"\n style={\n glassFooter\n ? {\n ...GLASS_SURFACE_STYLE,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n borderBottomLeftRadius: border === 'rounded' ? '20px' : '12px',\n borderBottomRightRadius: border === 'rounded' ? '20px' : '12px',\n }\n : undefined\n }\n >\n {footer}\n </div>\n )}\n </div>\n );\n};\n\nexport default Card;\nexport { Card };\n"],"names":["PLAIN_LENGTH","horizontalInset","padding","parts","part","top","right","left","Card","variant","title","subtitle","extra","children","size","width","minWidth","dimmed","direction","align","fullHeight","border","alignSelf","height","footer","glassFooter","className","style","headerConfig","footerRef","useRef","footerHeight","setFooterHeight","useState","useEffect","observer","entries","entry","cardClasses","headerInset","paddingValue","contentStyles","jsxs","FRAME_CLASS","FOREGROUND_RESET","hasHeaderContent","jsx","FrameHeader","FRAME_SECTION_STYLE","cardContainerStyles","HeaderRow","GLASS_SURFACE_STYLE"],"mappings":";;;;;;;AA0CA,MAAMA,IAAe,0BAIfC,IAAkB,CAACC,MAAqD;AAC1E,QAAMC,IAAQD,EAAQ,KAAA,EAAO,MAAM,KAAK;AACxC,MAAIC,EAAM,SAAS,KAAK,CAACA,EAAM,MAAM,CAACC,MAASJ,EAAa,KAAKI,CAAI,CAAC;AAClE;AAEJ,QAAM,CAACC,GAAKC,IAAQD,KAAOE,IAAOD,CAAK,IAAIH;AAC3C,S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,QACG,KAAKrB,IAAcI,IAAY;AAAA,QAC/B,WAAU;AAAA,QACV,OACIJ,IACM;AAAA,UACI,GAAG0B;AAAA,UACH,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,MAAM;AAAA,UACN,OAAO;AAAA,UACP,wBAAwB9B,MAAW,YAAY,SAAS;AAAA,UACxD,yBAAyBA,MAAW,YAAY,SAAS;AAAA,QAAA,IAE7D;AAAA,QAGT,UAAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GAER;AAER;"}
@@ -1,18 +1,19 @@
1
- import { jsxs as g, Fragment as T, jsx as n } from "react/jsx-runtime";
2
- import { useState as y, useRef as C, useCallback as k, useEffect as X, useInsertionEffect as Z } from "react";
3
- import { createPortal as ee } from "react-dom";
1
+ import { jsxs as v, Fragment as k, jsx as n } from "react/jsx-runtime";
2
+ import { useState as L, useRef as R, useCallback as S, useEffect as ee, useInsertionEffect as te } from "react";
3
+ import { createPortal as ne } from "react-dom";
4
4
  import { Avatar as B } from "../Avatar.js";
5
- import te from "../CustomIcons/CaretDownIcon.js";
6
- import ne from "../CustomIcons/CaretRightIcon.js";
7
- import re from "../CustomIcons/CaretUpIcon.js";
5
+ import re from "../CustomIcons/CaretDownIcon.js";
6
+ import oe from "../CustomIcons/CaretRightIcon.js";
7
+ import ie from "../CustomIcons/CaretUpIcon.js";
8
8
  import D from "../CustomIcons/CheckIcon.js";
9
- import { PillButton as oe } from "../PillButton.js";
10
- import { pushEscapeLayer as ie } from "../escapeLayers.js";
9
+ import { PillButton as le } from "../PillButton.js";
10
+ import { pushEscapeLayer as se } from "../escapeLayers.js";
11
11
  import { usePopupLayer as M } from "../overlayLayers.js";
12
- import { useOwnedByPopover as le } from "../popoverTree.js";
13
- import { ensureOverlayStyles as se } from "../portalOverlay.js";
14
- import { useTopLayer as ae } from "../topLayer.js";
15
- const h = 8, _ = 220, z = 240, N = (r, c) => ({
12
+ import { useOwnedByPopover as ae } from "../popoverTree.js";
13
+ import { ensureOverlayStyles as ce } from "../portalOverlay.js";
14
+ import { useTopLayer as ue } from "../topLayer.js";
15
+ import { useFollowTrigger as fe } from "../useFollowTrigger.js";
16
+ const h = 8, _ = 220, P = 240, N = (r, c) => ({
16
17
  position: "fixed",
17
18
  top: (r == null ? void 0 : r.top) ?? 0,
18
19
  left: (r == null ? void 0 : r.left) ?? 0,
@@ -40,84 +41,86 @@ const h = 8, _ = 220, z = 240, N = (r, c) => ({
40
41
  cursor: "pointer",
41
42
  fontSize: "var(--malachite-font-size-small, 13px)",
42
43
  color: "var(--malachite-text-primary, rgb(10, 10, 10))"
43
- }, ce = {
44
+ }, me = {
44
45
  fontSize: "var(--malachite-font-size-xsmall, 11px)",
45
46
  color: "var(--malachite-text-dimmed, rgb(161, 161, 161))"
46
47
  }, A = {
47
48
  marginLeft: "auto",
48
49
  display: "inline-flex",
49
50
  color: "var(--malachite-text-success, rgb(2, 122, 66))"
50
- }, Se = ({
51
+ }, Pe = ({
51
52
  models: r,
52
53
  value: c,
53
- optionValue: H,
54
- onChange: F,
54
+ optionValue: F,
55
+ onChange: H,
55
56
  disabled: U = !1,
56
- openUp: w = !0,
57
+ openUp: E = !0,
57
58
  "aria-label": Y = "Model"
58
59
  }) => {
59
60
  var O;
60
- const [l, b] = y(!1), [j, G] = y(null), [K, L] = y(null), [V, R] = y(
61
+ const [l, g] = L(!1), [j, G] = L(null), [K, x] = L(null), [V, C] = L(
61
62
  null
62
- ), E = C(null), u = C(null), v = C(null), $ = M("actionmenu", l, u), q = M("actionmenu", l, v);
63
- ae(u, l), le(
64
- k(() => v.current, []),
63
+ ), y = R(null), u = R(null), w = R(null), $ = M("actionmenu", l, u), q = M("actionmenu", l, w);
64
+ ue(u, l), ae(
65
+ S(() => w.current, []),
65
66
  l
66
67
  );
67
- const s = r.find((e) => e.value === c), I = k(() => {
68
- const e = E.current, t = u.current;
68
+ const s = r.find((e) => e.value === c), b = S(() => {
69
+ const e = y.current, t = u.current;
69
70
  if (!e)
70
71
  return;
71
- const o = e.getBoundingClientRect(), i = (t == null ? void 0 : t.offsetWidth) || _, a = (t == null ? void 0 : t.offsetHeight) || 0, x = window.innerWidth - i - h, m = Math.max(h, Math.min(o.right - i, x)), d = o.top - a - 4, p = o.bottom + 4, J = d >= h, Q = a === 0 || p + a <= window.innerHeight - h;
72
- G({ top: w ? J ? d : p : Q ? p : d, left: m });
73
- }, [w]);
74
- X(() => {
72
+ const o = e.getBoundingClientRect(), i = (t == null ? void 0 : t.offsetWidth) || _, a = (t == null ? void 0 : t.offsetHeight) || 0, I = window.innerWidth - i - h, m = Math.max(h, Math.min(o.right - i, I)), p = o.top - a - 4, d = o.bottom + 4, X = p >= h, Z = a === 0 || d + a <= window.innerHeight - h;
73
+ G({ top: E ? X ? p : d : Z ? d : p, left: m });
74
+ }, [E]), J = S(() => {
75
+ x(null), C(null), b();
76
+ }, [b]), Q = S(() => g(!1), []);
77
+ fe(l, y, J, Q), ee(() => {
75
78
  if (!l) {
76
- L(null), R(null);
79
+ x(null), C(null);
77
80
  return;
78
81
  }
79
- I();
80
- const e = () => I(), t = (i) => {
82
+ b();
83
+ const e = () => b(), t = (i) => {
81
84
  const a = i.composedPath();
82
- [E.current, u.current, v.current].some(
85
+ [y.current, u.current, w.current].some(
83
86
  (m) => m !== null && a.includes(m)
84
- ) || b(!1);
85
- }, o = ie(() => b(!1));
86
- return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), document.addEventListener("mousedown", t, !0), () => {
87
- window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e), document.removeEventListener("mousedown", t, !0), o();
87
+ ) || g(!1);
88
+ }, o = se(() => g(!1));
89
+ return window.addEventListener("resize", e), document.addEventListener("mousedown", t, !0), () => {
90
+ window.removeEventListener("resize", e), document.removeEventListener("mousedown", t, !0), o();
88
91
  };
89
- }, [l, I]), Z(() => {
90
- l && se();
92
+ }, [l, b]), te(() => {
93
+ l && ce();
91
94
  }, [l]);
92
- const P = (e, t) => {
93
- var m, d, p;
95
+ const T = (e, t) => {
96
+ var m, p, d;
94
97
  if (!((m = e.options) != null && m.length)) {
95
- L(null);
98
+ x(null);
96
99
  return;
97
100
  }
98
- const o = t.getBoundingClientRect(), a = (((d = u.current) == null ? void 0 : d.getBoundingClientRect().left) ?? o.left) - z - 4, x = a >= h ? a : Math.min(
99
- (((p = u.current) == null ? void 0 : p.getBoundingClientRect().right) ?? o.right) + 4,
100
- window.innerWidth - z - h
101
+ const o = t.getBoundingClientRect(), a = (((p = u.current) == null ? void 0 : p.getBoundingClientRect().left) ?? o.left) - P - 4, I = a >= h ? a : Math.min(
102
+ (((d = u.current) == null ? void 0 : d.getBoundingClientRect().right) ?? o.right) + 4,
103
+ window.innerWidth - P - h
101
104
  );
102
- L(e.value), R({ top: o.top, left: x });
103
- }, S = (e, t) => {
104
- F(e.value, t == null ? void 0 : t.value), b(!1);
105
+ x(e.value), C({ top: o.top, left: I });
106
+ }, z = (e, t) => {
107
+ H(e.value, t == null ? void 0 : t.value), g(!1);
105
108
  }, f = r.find((e) => e.value === K);
106
- return /* @__PURE__ */ g(T, { children: [
107
- /* @__PURE__ */ n("div", { ref: E, className: "inline-flex", children: /* @__PURE__ */ n(
108
- oe,
109
+ return /* @__PURE__ */ v(k, { children: [
110
+ /* @__PURE__ */ n("div", { ref: y, className: "inline-flex", children: /* @__PURE__ */ n(
111
+ le,
109
112
  {
110
113
  label: (s == null ? void 0 : s.label) ?? c,
111
114
  icon: s != null && s.iconSrc ? /* @__PURE__ */ n(B, { src: s.iconSrc, name: s.label, size: 14 }) : void 0,
112
- trailingIcon: w ? /* @__PURE__ */ n(re, { size: 10 }) : /* @__PURE__ */ n(te, { size: 10 }),
115
+ trailingIcon: E ? /* @__PURE__ */ n(ie, { size: 10 }) : /* @__PURE__ */ n(re, { size: 10 }),
113
116
  shape: "tab",
114
117
  size: "small",
115
118
  disabled: U,
116
- onClick: () => b((e) => !e)
119
+ onClick: () => g((e) => !e)
117
120
  }
118
121
  ) }),
119
- l && ee(
120
- /* @__PURE__ */ g(T, { children: [
122
+ l && ne(
123
+ /* @__PURE__ */ v(k, { children: [
121
124
  /* @__PURE__ */ n(
122
125
  "div",
123
126
  {
@@ -128,18 +131,18 @@ const h = 8, _ = 220, z = 240, N = (r, c) => ({
128
131
  style: N(j, _),
129
132
  children: r.map((e) => {
130
133
  var t, o;
131
- return /* @__PURE__ */ g(
134
+ return /* @__PURE__ */ v(
132
135
  "button",
133
136
  {
134
137
  type: "button",
135
138
  role: "menuitem",
136
139
  "aria-haspopup": (t = e.options) != null && t.length ? "menu" : void 0,
137
140
  style: W,
138
- onMouseEnter: (i) => P(e, i.currentTarget),
139
- onFocus: (i) => P(e, i.currentTarget),
141
+ onMouseEnter: (i) => T(e, i.currentTarget),
142
+ onFocus: (i) => T(e, i.currentTarget),
140
143
  onClick: () => {
141
144
  var i;
142
- return (i = e.options) != null && i.length ? S(e, e.options[0]) : S(e);
145
+ return (i = e.options) != null && i.length ? z(e, e.options[0]) : z(e);
143
146
  },
144
147
  children: [
145
148
  e.iconSrc ? /* @__PURE__ */ n(B, { src: e.iconSrc, name: e.label, size: 14 }) : null,
@@ -153,7 +156,7 @@ const h = 8, _ = 220, z = 240, N = (r, c) => ({
153
156
  display: "inline-flex",
154
157
  color: "var(--malachite-text-dimmed, rgb(161, 161, 161))"
155
158
  },
156
- children: /* @__PURE__ */ n(ne, { size: 10 })
159
+ children: /* @__PURE__ */ n(oe, { size: 10 })
157
160
  }
158
161
  ) : null
159
162
  ]
@@ -166,20 +169,20 @@ const h = 8, _ = 220, z = 240, N = (r, c) => ({
166
169
  (O = f == null ? void 0 : f.options) != null && O.length ? /* @__PURE__ */ n(
167
170
  "div",
168
171
  {
169
- ref: v,
172
+ ref: w,
170
173
  role: "menu",
171
174
  "aria-label": `${f.label} options`,
172
175
  ...q,
173
- style: N(V, z),
174
- children: f.options.map((e) => /* @__PURE__ */ g(
176
+ style: N(V, P),
177
+ children: f.options.map((e) => /* @__PURE__ */ v(
175
178
  "button",
176
179
  {
177
180
  type: "button",
178
181
  role: "menuitem",
179
182
  style: { ...W, alignItems: "flex-start" },
180
- onClick: () => S(f, e),
183
+ onClick: () => z(f, e),
181
184
  children: [
182
- /* @__PURE__ */ g(
185
+ /* @__PURE__ */ v(
183
186
  "span",
184
187
  {
185
188
  style: {
@@ -189,11 +192,11 @@ const h = 8, _ = 220, z = 240, N = (r, c) => ({
189
192
  },
190
193
  children: [
191
194
  e.label,
192
- e.description ? /* @__PURE__ */ n("span", { style: ce, children: e.description }) : null
195
+ e.description ? /* @__PURE__ */ n("span", { style: me, children: e.description }) : null
193
196
  ]
194
197
  }
195
198
  ),
196
- f.value === c && e.value === H ? /* @__PURE__ */ n("span", { style: A, children: /* @__PURE__ */ n(D, { size: 11 }) }) : null
199
+ f.value === c && e.value === F ? /* @__PURE__ */ n("span", { style: A, children: /* @__PURE__ */ n(D, { size: 11 }) }) : null
197
200
  ]
198
201
  },
199
202
  e.value
@@ -206,7 +209,7 @@ const h = 8, _ = 220, z = 240, N = (r, c) => ({
206
209
  ] });
207
210
  };
208
211
  export {
209
- Se as ChatModelPicker,
210
- Se as default
212
+ Pe as ChatModelPicker,
213
+ Pe as default
211
214
  };
212
215
  //# sourceMappingURL=ChatModelPicker.js.map