@rebasepro/ui 0.14.1 → 0.14.2-canary.g27a129e

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.
@@ -31,6 +31,10 @@ declare const typographyVariants: {
31
31
  inherit: string;
32
32
  caption: string;
33
33
  button: string;
34
+ lead: string;
35
+ micro: string;
36
+ mono: string;
37
+ stat: string;
34
38
  };
35
39
  export declare function Typography<C extends React.ElementType = "span">({ align, color, children, className, component, gutterBottom, noWrap, paragraph, variant, variantMapping, style, onClick, ...other }: TypographyProps<C>): React.JSX.Element;
36
40
  export {};
package/dist/index.css CHANGED
@@ -36,26 +36,40 @@ html.dark {
36
36
  size goes up. Seven consecutive levels of semibold was a Rubik-era setting,
37
37
  and holding 600 all the way down to text-sm made every heading shout equally
38
38
  — a heading stops being a headline somewhere, and the scale should say where.
39
- 600 is display-scale only; the small end carries 500.
39
+
40
+ The ladder now spans three weights rather than two. 600 everywhere at the top
41
+ meant a page title and the section heading inside it were the same voice at
42
+ two sizes, so a screen had no clear first thing to read. 700 is the *display*
43
+ tier only — h1 and h2, page titles and stat numbers — and nothing in the UI
44
+ chrome (nav, labels, buttons, table headers) goes above 600.
45
+
46
+ This costs nothing on the wire: both faces are loaded as VARIABLE fonts
47
+ (@fontsource-variable/inter, @fontsource-variable/instrument-sans), so the
48
+ whole weight axis is already in the file that ships. The earlier "never above
49
+ 600" rule was written when static weights meant every step was another
50
+ download; that constraint no longer exists.
40
51
 
41
52
  With a single face carrying both headings and body, weight and tracking are
42
53
  the only things separating a heading from the copy around it — so the tiers
43
54
  have to actually differ, rather than all sitting at 600. */
44
55
 
45
56
  .typography-h1 {
46
- @apply text-4xl font-headers font-semibold tracking-display;
57
+ @apply text-4xl font-headers font-bold tracking-display;
47
58
  }
48
59
 
49
60
  .typography-h2 {
50
- @apply text-3xl font-headers font-semibold tracking-display;
61
+ @apply text-3xl font-headers font-bold tracking-display;
51
62
  }
52
63
 
53
64
  .typography-h3 {
54
65
  @apply text-2xl font-headers font-semibold tracking-title;
55
66
  }
56
67
 
68
+ /* Semibold, not medium: h4 is the section heading inside a page, and at 20px
69
+ medium sits close enough to body copy that a long page reads as one
70
+ undifferentiated column. */
57
71
  .typography-h4 {
58
- @apply text-xl font-headers font-medium tracking-title;
72
+ @apply text-xl font-headers font-semibold tracking-title;
59
73
  }
60
74
 
61
75
  .typography-h5 {
@@ -98,6 +112,44 @@ html.dark {
98
112
  @apply text-sm font-semibold tracking-wide;
99
113
  }
100
114
 
115
+ /* ---------------------------------------------------------------------------
116
+ * Three tiers the product kept improvising because the system had no name for
117
+ * them. Each existed as hand-written utilities in several places before it
118
+ * existed here, which is the definition of a missing token.
119
+ * ------------------------------------------------------------------------- */
120
+
121
+ /* The sentence under a page title. `body2` (12px) was standing in for it, which
122
+ made the one line explaining what a page is FOR smaller than the page's own
123
+ table rows. A lead is read once, deliberately, and it gets room to be read. */
124
+ .typography-lead {
125
+ @apply text-base leading-relaxed;
126
+ }
127
+
128
+ /* The micro-label above a value: SCANNED, KEPT, TOOK, WHEN. Uppercase and
129
+ tracked so it reads as a field name rather than as copy, and small enough
130
+ that it never competes with the value it names.
131
+
132
+ This is the one product tier below `text-xs`. It earns the exception by never
133
+ carrying a sentence — it is always one or two words naming the thing directly
134
+ underneath it, and at 11px uppercase with this tracking it stays legible
135
+ where 11px prose would not. */
136
+ .typography-micro {
137
+ @apply text-2xs font-medium uppercase tracking-[0.08em];
138
+ }
139
+
140
+ /* A measured value: a count, a duration, a timestamp, an id, a size.
141
+ `tabular-nums` is the point — proportional digits make a column of numbers
142
+ ragged and a live-updating counter jitter as its glyphs change width. */
143
+ .typography-mono {
144
+ @apply font-mono tabular-nums;
145
+ }
146
+
147
+ /* The headline number on a stat tile. Display weight, display tracking, and
148
+ tabular figures so a row of tiles shares a baseline grid. */
149
+ .typography-stat {
150
+ @apply text-3xl font-headers font-bold tracking-display tabular-nums;
151
+ }
152
+
101
153
  :focus-visible {
102
154
  @apply outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-0 focus-visible:ring-offset-transparent
103
155
  }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from "./views";
3
3
  export * from "./icons";
4
4
  export * from "./styles";
5
5
  export { cls } from "./util/cls";
6
+ export { lazyChunk, loadChunk, isChunkLoadError } from "./util/lazy_chunk";
6
7
  export { CHIP_COLORS, CHIP_HUES, CHIP_SEED_KEYS, getColorSchemeForKey, getColorSchemeForSeed } from "./util/chip_colors";
7
8
  export type { ChipHue, ChipTone } from "./util/chip_colors";
8
9
  export { useOutsideAlerter } from "./hooks/useOutsideAlerter";
package/dist/index.es.js CHANGED
@@ -68,7 +68,35 @@ var fieldBackgroundDisabledMixin = "bg-surface-accent-200/50 dark:bg-white/[0.03
68
68
  var fieldBackgroundHoverMixin = "hover:bg-surface-accent-200/70 hover:dark:bg-white/[0.09]";
69
69
  var defaultBorderMixin = "border-surface-200 dark:border-surface-700/60 ";
70
70
  var paperMixin = "bg-white rounded-lg dark:bg-surface-900 border border-surface-200 dark:border-surface-700";
71
- var cardMixin = "bg-white dark:bg-surface-900 rounded-lg border border-surface-200 dark:border-surface-700";
71
+ var cardMixin = "bg-white dark:bg-surface-900 rounded-xl border border-surface-200 dark:border-surface-700/60";
72
+ /**
73
+ * An inset well: code, a query, a log tail, a connection string.
74
+ *
75
+ * It must read as *recessed into* the surface holding it, which means darker
76
+ * than that surface in dark mode — `surface-950` under a `surface-900` card.
77
+ * The obvious-looking `surface-800` is a trap: `#111111` is LIGHTER than the
78
+ * `#0a0a0a` card around it, so the well appears to float above the thing it is
79
+ * set into. Pair with `font-mono`; this mixin carries the surface only.
80
+ */
81
+ var codeSurfaceMixin = "bg-surface-100 dark:bg-surface-950 rounded-md";
82
+ /**
83
+ * The accent, used as TEXT.
84
+ *
85
+ * `--color-primary` (#0070F4) is tuned to be a fill — white text on it, it on
86
+ * white. Read as text on our dark surfaces it lands at **4.36:1 on a
87
+ * `surface-900` card** (measured), which is below AA for body-sized text, and
88
+ * every accent link in the product sits on exactly that surface. On the page's
89
+ * `surface-950` it only reaches 4.62:1, so the margin was never real.
90
+ *
91
+ * `--color-primary-light` is the same hue lifted 0.15 in OKLCH lightness and
92
+ * measures **7.34:1** on the same card. It is indistinguishable as "the blue"
93
+ * and comfortably legible, so dark mode swaps to it for text.
94
+ *
95
+ * Use this for links, accent labels and any accent-coloured type. It is NOT for
96
+ * fills — a filled button keeps `bg-primary`, where the contrast question runs
97
+ * the other way and #0070F4 is already correct.
98
+ */
99
+ var accentTextMixin = "text-primary dark:text-primary-light";
72
100
  var cardClickableMixin = "hover:bg-primary/5 dark:hover:bg-primary/5 cursor-pointer transition-colors duration-150";
73
101
  var cardSelectedMixin = "bg-primary-bg/30 dark:bg-primary-bg/10 ring-1 ring-primary/75";
74
102
  //#endregion
@@ -110,6 +138,64 @@ function hashString(str) {
110
138
  }
111
139
  //#endregion
112
140
  //#region src/util/chip_colors.ts
141
+ /** WCAG floor, plus a little margin so rounding cannot drop a pair below 4.5. */
142
+ var CONTRAST_TARGET = 4.6;
143
+ /** Page backgrounds the outlined variant sits on: `bg-white` and `surface-950`. */
144
+ var PAGE_LIGHT = "#ffffff";
145
+ var PAGE_DARK = "#0a0a0a";
146
+ function toRgb(hex) {
147
+ let h = hex.replace("#", "");
148
+ if (h.length === 3) h = h.split("").map((c) => c + c).join("");
149
+ return [
150
+ 0,
151
+ 2,
152
+ 4
153
+ ].map((i) => parseInt(h.slice(i, i + 2), 16));
154
+ }
155
+ function toHex(rgb) {
156
+ return "#" + rgb.map((v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0")).join("");
157
+ }
158
+ function relativeLuminance(hex) {
159
+ const [r, g, b] = toRgb(hex).map((v) => {
160
+ const c = v / 255;
161
+ return c <= .03928 ? c / 12.92 : Math.pow((c + .055) / 1.055, 2.4);
162
+ });
163
+ return .2126 * r + .7152 * g + .0722 * b;
164
+ }
165
+ function contrastRatio(a, b) {
166
+ const x = relativeLuminance(a);
167
+ const y = relativeLuminance(b);
168
+ const [hi, lo] = x > y ? [x, y] : [y, x];
169
+ return (hi + .05) / (lo + .05);
170
+ }
171
+ function mixHex(from, to, t) {
172
+ const A = toRgb(from);
173
+ const B = toRgb(to);
174
+ return toHex([
175
+ 0,
176
+ 1,
177
+ 2
178
+ ].map((i) => A[i] + (B[i] - A[i]) * t));
179
+ }
180
+ /**
181
+ * Walk a tinted ink toward black or white until it clears the floor on `bg`.
182
+ *
183
+ * Stops at the first passing step rather than going all the way, so the ink
184
+ * keeps as much of its hue as legibility allows.
185
+ */
186
+ function push(base, toward, bg) {
187
+ for (let t = 0; t <= 1.0001; t += .02) {
188
+ const candidate = mixHex(base, toward, t);
189
+ if (contrastRatio(candidate, bg) >= CONTRAST_TARGET) return candidate;
190
+ }
191
+ return toward;
192
+ }
193
+ /** The ink for a chip filled with `bg`: whichever direction has more headroom. */
194
+ function inkOn(stops, bg) {
195
+ const dark = push(stops.text, "#000000", bg);
196
+ const light = push(stops.onDeep ?? stops.pale, "#ffffff", bg);
197
+ return contrastRatio(dark, bg) >= contrastRatio(light, bg) ? dark : light;
198
+ }
113
199
  var CHIP_HUES = [
114
200
  "blue",
115
201
  "cyan",
@@ -235,33 +321,30 @@ var HUE_STOPS = {
235
321
  text: "#064e3b"
236
322
  }
237
323
  };
324
+ /**
325
+ * One tone of one hue.
326
+ *
327
+ * Backgrounds are the palette's, unchanged — the stops were not the problem and
328
+ * moving them would have restyled every chip in the product. Only the ink moved,
329
+ * and it moved to wherever the measurement says it has to be.
330
+ */
238
331
  function tone(stops, chipTone) {
239
- const onDeep = stops.onDeep ?? stops.pale;
332
+ const outline = {
333
+ outlineText: push(stops.text, "#000000", PAGE_LIGHT),
334
+ darkOutlineText: push(stops.onDeep ?? stops.pale, "#ffffff", PAGE_DARK)
335
+ };
336
+ const filled = (light, dark) => ({
337
+ color: light,
338
+ text: inkOn(stops, light),
339
+ darkColor: dark,
340
+ darkText: inkOn(stops, dark),
341
+ ...outline
342
+ });
240
343
  switch (chipTone) {
241
- case "Light": return {
242
- color: stops.mid,
243
- text: stops.text,
244
- darkColor: stops.solid,
245
- darkText: "#fff"
246
- };
247
- case "Dark": return {
248
- color: stops.solid,
249
- text: "#fff",
250
- darkColor: stops.solid,
251
- darkText: "#fff"
252
- };
253
- case "Darker": return {
254
- color: stops.deep,
255
- text: onDeep,
256
- darkColor: stops.deep,
257
- darkText: onDeep
258
- };
259
- default: return {
260
- color: stops.pale,
261
- text: stops.text,
262
- darkColor: stops.deep,
263
- darkText: onDeep
264
- };
344
+ case "Light": return filled(stops.mid, stops.solid);
345
+ case "Dark": return filled(stops.solid, stops.solid);
346
+ case "Darker": return filled(stops.deep, stops.deep);
347
+ default: return filled(stops.pale, stops.deep);
265
348
  }
266
349
  }
267
350
  var CHIP_TONES = [
@@ -3051,7 +3134,11 @@ var typographyVariants = {
3051
3134
  body2: "p",
3052
3135
  inherit: "p",
3053
3136
  caption: "p",
3054
- button: "span"
3137
+ button: "span",
3138
+ lead: "p",
3139
+ micro: "span",
3140
+ mono: "span",
3141
+ stat: "span"
3055
3142
  };
3056
3143
  var colorToClasses = {
3057
3144
  inherit: "text-inherit",
@@ -3075,7 +3162,11 @@ var gutterBottomClasses = {
3075
3162
  inherit: "mb-3",
3076
3163
  caption: "mb-2",
3077
3164
  button: "mb-2",
3078
- label: "mb-2"
3165
+ label: "mb-2",
3166
+ lead: "mb-4",
3167
+ micro: "mb-1",
3168
+ mono: "mb-2",
3169
+ stat: "mb-1"
3079
3170
  };
3080
3171
  var variantToClasses = {
3081
3172
  h1: "typography-h1",
@@ -3091,7 +3182,11 @@ var variantToClasses = {
3091
3182
  label: "typography-label",
3092
3183
  inherit: "typography-inherit",
3093
3184
  caption: "typography-caption",
3094
- button: "typography-button"
3185
+ button: "typography-button",
3186
+ lead: "typography-lead",
3187
+ micro: "typography-micro",
3188
+ mono: "typography-mono",
3189
+ stat: "typography-stat"
3095
3190
  };
3096
3191
  function Typography({ align = "inherit", color = "primary", children, className, component, gutterBottom = false, noWrap = false, paragraph = false, variant = "body1", variantMapping = typographyVariants, style, onClick, ...other }) {
3097
3192
  return /* @__PURE__ */ jsx(component || (paragraph ? "p" : variantMapping[variant] || typographyVariants[variant]) || "span", {
@@ -3126,8 +3221,107 @@ function CircularProgressCenter({ text, ...props }) {
3126
3221
  });
3127
3222
  }
3128
3223
  //#endregion
3224
+ //#region src/util/lazy_chunk.ts
3225
+ /**
3226
+ * Dynamic imports that survive a redeploy.
3227
+ *
3228
+ * A built SPA names its chunks by content hash and a deploy replaces the whole
3229
+ * `assets/` directory, so a tab opened before the deploy still holds the *old*
3230
+ * entry chunk. The first lazy route that tab opens asks for a hash that no
3231
+ * longer exists on the server, the import rejects, and the view is dead until
3232
+ * the user thinks to reload — which nothing on screen tells them to do. The
3233
+ * browser's own wording ("Failed to fetch dynamically imported module: …") reads
3234
+ * like a build bug, so this is usually reported as one.
3235
+ *
3236
+ * `loadChunk` retries once — that covers a transient network failure — and then
3237
+ * gives up with an error tagged as a chunk load failure, so `ErrorBoundary` can
3238
+ * offer a reload instead of printing the browser's message.
3239
+ */
3240
+ /**
3241
+ * Marker property set on the error thrown after a failed retry. Read by
3242
+ * `isChunkLoadError`, which is what the UI matches on.
3243
+ */
3244
+ var CHUNK_LOAD_ERROR_FLAG = "rebaseChunkLoadError";
3245
+ /**
3246
+ * Each engine words this differently, and the message is the only signal — none
3247
+ * of them use a distinguishable error type. The MIME variants matter as much as
3248
+ * the fetch ones: a server whose SPA fallback answers a missing `/assets/x.js`
3249
+ * with `index.html` returns 200 HTML, and the browser rejects it as a module.
3250
+ */
3251
+ var CHUNK_ERROR_PATTERNS = [
3252
+ "failed to fetch dynamically imported module",
3253
+ "error loading dynamically imported module",
3254
+ "importing a module script failed",
3255
+ "failed to load module script",
3256
+ "expected a javascript",
3257
+ "unable to preload css"
3258
+ ];
3259
+ /**
3260
+ * Does this error mean a chunk could not be loaded — rather than the chunk's
3261
+ * own code throwing once it did load?
3262
+ *
3263
+ * Errors raised anywhere are matched, not just ones `loadChunk` produced: React
3264
+ * `lazy()` calls that still import directly, and Vite's own CSS preloads, fail
3265
+ * the same way and deserve the same recovery.
3266
+ */
3267
+ function isChunkLoadError(error) {
3268
+ if (!error || typeof error !== "object") return false;
3269
+ if (error[CHUNK_LOAD_ERROR_FLAG] === true) return true;
3270
+ const message = error.message;
3271
+ if (typeof message !== "string") return false;
3272
+ const lower = message.toLowerCase();
3273
+ return CHUNK_ERROR_PATTERNS.some((pattern) => lower.includes(pattern));
3274
+ }
3275
+ function chunkLoadError(cause) {
3276
+ const error = /* @__PURE__ */ new Error("This app was updated while the tab was open, so part of it could not be loaded. Reload to continue.");
3277
+ Object.assign(error, {
3278
+ [CHUNK_LOAD_ERROR_FLAG]: true,
3279
+ cause
3280
+ });
3281
+ return error;
3282
+ }
3283
+ /**
3284
+ * Run a dynamic import, retrying once before declaring the chunk unreachable.
3285
+ *
3286
+ * Errors that are not chunk load failures — the imported module throwing while
3287
+ * it evaluates, say — are re-thrown untouched and never retried: running a
3288
+ * module's side effects twice is worse than the original failure.
3289
+ */
3290
+ async function loadChunk(loader) {
3291
+ try {
3292
+ return await loader();
3293
+ } catch (error) {
3294
+ if (!isChunkLoadError(error)) throw error;
3295
+ await new Promise((resolve) => setTimeout(resolve, 250));
3296
+ try {
3297
+ return await loader();
3298
+ } catch (retryError) {
3299
+ throw chunkLoadError(retryError);
3300
+ }
3301
+ }
3302
+ }
3303
+ /**
3304
+ * `React.lazy` with the retry above. A drop-in replacement — use it for every
3305
+ * lazy route or dialog, since any one of them can be the first chunk a stale
3306
+ * tab reaches for.
3307
+ *
3308
+ * Note that React caches the rejection: once a lazy component has failed, later
3309
+ * renders re-throw without calling the loader again. Resetting an error boundary
3310
+ * therefore cannot recover it, which is why the boundary offers a reload.
3311
+ */
3312
+ function lazyChunk(loader) {
3313
+ return React.lazy(() => loadChunk(loader));
3314
+ }
3315
+ //#endregion
3129
3316
  //#region src/components/ErrorBoundary.tsx
3130
3317
  /**
3318
+ * The one error a user can fix themselves. A deploy replaces the hashed chunk
3319
+ * files, so a tab opened before it cannot load any lazy view it has not already
3320
+ * fetched — with the browser's raw message ("Failed to fetch dynamically
3321
+ * imported module: …") this reads as a broken build rather than a stale tab.
3322
+ */
3323
+ var CHUNK_ERROR_DESCRIPTION = "This app was updated while the tab was open, so part of it could not be loaded. Reload to continue.";
3324
+ /**
3131
3325
  * Checks whether the error message relates to missing permissions or
3132
3326
  * authorization failures. Used to show a friendlier message in fullPage mode.
3133
3327
  */
@@ -3172,39 +3366,55 @@ var ErrorBoundary = class extends React.Component {
3172
3366
  return this.props.children;
3173
3367
  }
3174
3368
  renderInline() {
3369
+ const isStaleChunk = isChunkLoadError(this.state.error);
3175
3370
  return /* @__PURE__ */ jsxs("div", {
3176
- className: "flex flex-col m-2",
3177
- children: [/* @__PURE__ */ jsxs("div", {
3178
- className: "flex items-center m-2",
3179
- children: [/* @__PURE__ */ jsx(AlertCircleIcon$1, {
3180
- className: "text-red-500 dark:text-red-400",
3181
- size: iconSize.small
3182
- }), /* @__PURE__ */ jsx("div", {
3183
- className: "ml-4",
3184
- children: "Error"
3185
- })]
3186
- }), /* @__PURE__ */ jsx(Typography, {
3187
- variant: "caption",
3188
- children: this.state.error?.message ?? "See the error in the console"
3189
- })]
3371
+ className: "flex flex-col m-2 items-start",
3372
+ children: [
3373
+ /* @__PURE__ */ jsxs("div", {
3374
+ className: "flex items-center m-2",
3375
+ children: [isStaleChunk ? /* @__PURE__ */ jsx(RefreshCwIcon$1, {
3376
+ className: "text-text-secondary dark:text-text-secondary-dark",
3377
+ size: iconSize.small
3378
+ }) : /* @__PURE__ */ jsx(AlertCircleIcon$1, {
3379
+ className: "text-red-500 dark:text-red-400",
3380
+ size: iconSize.small
3381
+ }), /* @__PURE__ */ jsx("div", {
3382
+ className: "ml-4",
3383
+ children: isStaleChunk ? "New version available" : "Error"
3384
+ })]
3385
+ }),
3386
+ /* @__PURE__ */ jsx(Typography, {
3387
+ variant: "caption",
3388
+ children: isStaleChunk ? CHUNK_ERROR_DESCRIPTION : this.state.error?.message ?? "See the error in the console"
3389
+ }),
3390
+ isStaleChunk && /* @__PURE__ */ jsxs(Button, {
3391
+ variant: "outlined",
3392
+ color: "neutral",
3393
+ size: "small",
3394
+ className: "mt-3 ml-2",
3395
+ onClick: this.handleReload,
3396
+ children: [/* @__PURE__ */ jsx(RefreshCwIcon$1, { size: 16 }), "Reload"]
3397
+ })
3398
+ ]
3190
3399
  });
3191
3400
  }
3192
3401
  renderFullPage() {
3193
3402
  const { error, showDetails } = this.state;
3194
3403
  const isPermission = isPermissionError(error);
3195
- const Icon = isPermission ? ShieldAlertIcon : AlertCircleIcon$1;
3196
- const title = isPermission ? "Access denied" : "Something went wrong";
3197
- const description = isPermission ? "You don't have permission to access this resource. Please check your account permissions or contact your administrator." : "An unexpected error occurred. You can try reloading the page or going back.";
3404
+ const isStaleChunk = !isPermission && isChunkLoadError(error);
3405
+ const Icon = isPermission ? ShieldAlertIcon : isStaleChunk ? RefreshCwIcon$1 : AlertCircleIcon$1;
3406
+ const title = isPermission ? "Access denied" : isStaleChunk ? "New version available" : "Something went wrong";
3407
+ const description = isPermission ? "You don't have permission to access this resource. Please check your account permissions or contact your administrator." : isStaleChunk ? CHUNK_ERROR_DESCRIPTION : "An unexpected error occurred. You can try reloading the page or going back.";
3198
3408
  return /* @__PURE__ */ jsx("div", {
3199
3409
  className: cls("flex items-center justify-center min-h-[400px] h-full w-full", "bg-surface-50 dark:bg-surface-950"),
3200
3410
  children: /* @__PURE__ */ jsxs("div", {
3201
3411
  className: "flex flex-col items-center max-w-md px-6 py-10 text-center",
3202
3412
  children: [
3203
3413
  /* @__PURE__ */ jsx("div", {
3204
- className: cls("flex items-center justify-center w-14 h-14 rounded-xl mb-6", isPermission ? "bg-amber-100 dark:bg-amber-900/30" : "bg-red-100 dark:bg-red-900/30"),
3414
+ className: cls("flex items-center justify-center w-14 h-14 rounded-xl mb-6", isPermission ? "bg-amber-100 dark:bg-amber-900/30" : isStaleChunk ? "bg-surface-100 dark:bg-surface-800" : "bg-red-100 dark:bg-red-900/30"),
3205
3415
  children: /* @__PURE__ */ jsx(Icon, {
3206
3416
  size: 28,
3207
- className: isPermission ? "text-amber-600 dark:text-amber-400" : "text-red-500 dark:text-red-400"
3417
+ className: isPermission ? "text-amber-600 dark:text-amber-400" : isStaleChunk ? "text-text-secondary dark:text-text-secondary-dark" : "text-red-500 dark:text-red-400"
3208
3418
  })
3209
3419
  }),
3210
3420
  /* @__PURE__ */ jsx(Typography, {
@@ -3219,7 +3429,7 @@ var ErrorBoundary = class extends React.Component {
3219
3429
  }),
3220
3430
  /* @__PURE__ */ jsxs("div", {
3221
3431
  className: "flex gap-3",
3222
- children: [/* @__PURE__ */ jsxs(Button, {
3432
+ children: [!isStaleChunk && /* @__PURE__ */ jsxs(Button, {
3223
3433
  variant: "outlined",
3224
3434
  color: "neutral",
3225
3435
  size: "medium",
@@ -3233,7 +3443,7 @@ var ErrorBoundary = class extends React.Component {
3233
3443
  children: [/* @__PURE__ */ jsx(RefreshCwIcon$1, { size: 16 }), "Reload page"]
3234
3444
  })]
3235
3445
  }),
3236
- error?.message && /* @__PURE__ */ jsxs("div", {
3446
+ !isStaleChunk && error?.message && /* @__PURE__ */ jsxs("div", {
3237
3447
  className: "mt-8 w-full",
3238
3448
  children: [/* @__PURE__ */ jsxs("button", {
3239
3449
  onClick: this.toggleDetails,
@@ -3341,6 +3551,10 @@ function Chip({ children, colorScheme, error, outlined, onClick, icon, size = "m
3341
3551
  else if (usedColorScheme) textColor = dark && usedColorScheme.darkText ? usedColorScheme.darkText : usedColorScheme.text;
3342
3552
  if (hasScheme) {
3343
3553
  if (outlined) {
3554
+ if (!error && usedColorScheme) {
3555
+ const outlineInk = dark ? usedColorScheme.darkOutlineText ?? usedColorScheme.darkText : usedColorScheme.outlineText;
3556
+ if (outlineInk) textColor = outlineInk;
3557
+ }
3344
3558
  bgColor = getRgba(textColor, dark ? .1 : .06);
3345
3559
  border = `1px solid ${getRgba(textColor, dark ? .2 : .14)}`;
3346
3560
  } else if (error) {
@@ -7566,13 +7780,16 @@ function CollectionViewToolbar({ viewMode, onViewModeChange, enabledViews = [
7566
7780
  "table",
7567
7781
  "cards",
7568
7782
  "kanban"
7569
- ], size = "m", onSizeChange, searchString, onSearchChange, loading, actionsStart, actionsEnd, compact, kanbanPropertyOptions, selectedKanbanProperty, onKanbanPropertyChange }) {
7783
+ ], customViews, size = "m", onSizeChange, searchString, onSearchChange, loading, actionsStart, actionsEnd, compact, kanbanPropertyOptions, selectedKanbanProperty, onKanbanPropertyChange }) {
7570
7784
  const [popoverOpen, setPopoverOpen] = useState(false);
7571
- const viewOptions = enabledViews.map((mode) => ({
7572
- value: mode,
7573
- label: VIEW_MODE_LABELS[mode],
7574
- icon: VIEW_MODE_ICONS[mode]
7575
- }));
7785
+ const viewOptions = enabledViews.map((mode) => {
7786
+ const custom = customViews?.find((entry) => entry.key === mode);
7787
+ return {
7788
+ value: mode,
7789
+ label: VIEW_MODE_LABELS[mode] ?? custom?.name ?? mode,
7790
+ icon: VIEW_MODE_ICONS[mode] ?? custom?.icon ?? /* @__PURE__ */ jsx(LayoutList, { size: iconSize.small })
7791
+ };
7792
+ });
7576
7793
  const handleViewModeChange = useCallback((mode) => {
7577
7794
  onViewModeChange?.(mode);
7578
7795
  }, [onViewModeChange]);
@@ -8651,7 +8868,7 @@ var DEFAULT_ENABLED_VIEWS = [
8651
8868
  *
8652
8869
  * @group Collection View
8653
8870
  */
8654
- function CollectionView({ dataController, properties, propertiesOrder, displayedColumnIds, idProperty = "id", titleProperty, title, viewMode: viewModeProp, defaultViewMode = "list", enabledViews = DEFAULT_ENABLED_VIEWS, onViewModeChange: onViewModeChangeProp, size: sizeProp, defaultSize = "m", onSizeChange: onSizeChangeProp, kanbanProperty: kanbanPropertyProp, kanbanPropertyOptions, onKanbanPropertyChange: onKanbanPropertyChangeProp, onRowClick, onRowCreate, canCreate = true, selectionEnabled, selectionController, highlightedItems, onMultipleDelete, cellRenderer, emptyComponent, toolbarActionsStart, toolbarActionsEnd, hideToolbar, hoverRow = true, onColumnResize, onColumnsOrderChange, className }) {
8871
+ function CollectionView({ dataController, properties, propertiesOrder, displayedColumnIds, idProperty = "id", titleProperty, title, viewMode: viewModeProp, defaultViewMode = "list", enabledViews = DEFAULT_ENABLED_VIEWS, onViewModeChange: onViewModeChangeProp, size: sizeProp, defaultSize = "m", onSizeChange: onSizeChangeProp, kanbanProperty: kanbanPropertyProp, kanbanPropertyOptions, onKanbanPropertyChange: onKanbanPropertyChangeProp, onRowClick, onRowCreate, canCreate = true, selectionEnabled, selectionController, highlightedItems, onMultipleDelete, cellRenderer, emptyComponent, customViews, toolbarActionsStart, toolbarActionsEnd, hideToolbar, hoverRow = true, onColumnResize, onColumnsOrderChange, className }) {
8655
8872
  const [internalViewMode, setInternalViewMode] = useState(defaultViewMode);
8656
8873
  const viewMode = viewModeProp ?? internalViewMode;
8657
8874
  const onViewModeChange = useCallback((mode) => {
@@ -8712,7 +8929,29 @@ function CollectionView({ dataController, properties, propertiesOrder, displayed
8712
8929
  highlightedItems,
8713
8930
  emptyComponent
8714
8931
  };
8932
+ const customViewEntries = useMemo(() => {
8933
+ if (!customViews) return [];
8934
+ return Object.entries(customViews).filter(([key]) => !DEFAULT_ENABLED_VIEWS.includes(key)).map(([key, entry]) => {
8935
+ const isBare = typeof entry === "function";
8936
+ return {
8937
+ key,
8938
+ name: isBare ? key : entry.name ?? key,
8939
+ icon: isBare ? void 0 : entry.icon,
8940
+ Component: isBare ? entry : entry.Component
8941
+ };
8942
+ });
8943
+ }, [customViews]);
8715
8944
  function renderView() {
8945
+ const custom = customViewEntries.find((entry) => entry.key === viewMode);
8946
+ if (custom) {
8947
+ const { Component } = custom;
8948
+ return /* @__PURE__ */ jsx(Component, {
8949
+ ...sharedProps,
8950
+ onRowCreate: canCreate ? onRowCreate : void 0,
8951
+ canCreate,
8952
+ size
8953
+ });
8954
+ }
8716
8955
  switch (viewMode) {
8717
8956
  case "table": return /* @__PURE__ */ jsx(CollectionTableView, {
8718
8957
  ...sharedProps,
@@ -8763,6 +9002,7 @@ function CollectionView({ dataController, properties, propertiesOrder, displayed
8763
9002
  viewMode,
8764
9003
  onViewModeChange: enabledViews.length > 1 ? onViewModeChange : void 0,
8765
9004
  enabledViews,
9005
+ customViews: customViewEntries,
8766
9006
  size,
8767
9007
  onSizeChange,
8768
9008
  searchString: dataController.searchString,
@@ -8782,6 +9022,6 @@ function CollectionView({ dataController, properties, propertiesOrder, displayed
8782
9022
  });
8783
9023
  }
8784
9024
  //#endregion
8785
- export { Alert, AlertCircleIcon, AlertTriangleIcon, AlignLeftIcon, AppWindow, ArrowDownIcon, ArrowDownToLineIcon, ArrowLeftIcon, ArrowRightFromLineIcon, ArrowRightIcon, ArrowRightLeftIcon, ArrowRightToLineIcon, ArrowUpDownIcon, ArrowUpIcon, ArrowUpToLineIcon, Autocomplete, AutocompleteItem, Avatar, Badge, BoldIcon, BookOpenIcon, BooleanSwitch, BooleanSwitchWithLabel, Button, CHIP_COLORS, CHIP_HUES, CHIP_SEED_KEYS, CONTROL_HEIGHT, CalendarIcon, Card, CardView, CenteredView, CheckCircle2Icon, CheckCircleIcon, CheckIcon, CheckSquareIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsUpDownIcon, Chip, CircleDotIcon, CircleIcon, CircleUserIcon, CircularProgress, CircularProgressCenter, CodeIcon, Collapse, CollectionView, ColorPicker, ColumnsIcon, Container, CopyIcon, DatabaseIcon, DateTimeField, DebouncedTextField, Dialog, DialogActions, DialogContent, DialogTitle, DollarSignIcon, DownloadIcon, ErrorBoundary, ExpandablePanel, ExternalLinkIcon, EyeIcon, EyeOffIcon, FileIcon, FileSearchIcon, FileTextIcon, FileUpload, FilterChip, FilterIcon, FilterXIcon, FlagIcon, FolderIcon, FolderKanbanIcon, FolderPlusIcon, FolderUpIcon, FunctionSquareIcon, GitBranchIcon, GitHubIcon, GlobeIcon, HandleIcon, HashIcon, Heading1Icon, Heading2Icon, Heading3Icon, HelpCircleIcon, HistoryIcon, HomeIcon, IconButton, ImageIcon, ImageOffIcon, InfoIcon, InfoLabel, InputLabel, ItalicIcon, KanbanIcon, KanbanView, KeyIcon, KeyRoundIcon, Label, LanguagesIcon, LayoutGridIcon, Link2Icon, LinkIcon, ListIcon, ListOrderedIcon, ListPlusIcon, ListTodoIcon, ListView, LoaderIcon, LoadingButton, LockIcon, LogOutIcon, LucideIconByName, MailIcon, Markdown, Maximize2Icon, Menu, MenuIcon, MenuItem, Menubar, MenubarCheckboxItem, MenubarContent, MenubarItem, MenubarItemIndicator, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarSubTriggerIndicator, MenubarTrigger, MessageCircleIcon, MinusCircleIcon, MinusIcon, MoonIcon, MoreVerticalIcon, MultiSelect, MultiSelectContext, MultiSelectItem, Music2Icon, PanelLeftCloseIcon, PanelLeftIcon, PanelLeftOpenIcon, Paper, PauseIcon, PenLineIcon, PencilIcon, PhoneIcon, PinIcon, PlayIcon, PlusIcon, Popover, PopoverPrimitive, Portal, PortalContainerProvider, QuoteIcon, RadioGroup, RadioGroupItem, RefreshCcwIcon, RefreshCwIcon, RepeatIcon, ResizablePanels, Rows3Icon, SaveIcon, SearchBar, SearchIcon, Select, SelectGroup, SelectItem, SendIcon, Separator, SettingsIcon, Sheet, ShieldIcon, ShoppingCartIcon, Skeleton, Slider, SlidersHorizontalIcon, Slot, SquareIcon, StarIcon, StickyNoteIcon, StrikethroughIcon, SunIcon, SunMoonIcon, Tab, Table, TableBody, TableCell, TableHeader, TableIcon, TableRow, Tabs, TagIcon, TerminalIcon, TextField, TextIcon, TextareaAutosize, ToggleButtonGroup, Tooltip, Trash2Icon, TrendingUpIcon, TypeIcon, Typography, UnderlineIcon, UndoIcon, Unlink2Icon, UploadCloudIcon, UploadIcon, UserCheckIcon, UserIcon, UserPlus, UsersIcon, VideoIcon, VirtualTable, VirtualTableDateField, VirtualTableInput, VirtualTableNumberInput, VirtualTableSelect, VirtualTableSelectionProvider, VirtualTableSwitch, VoteIcon, Wand2Icon, WrenchIcon, XCircleIcon, XIcon, cardClickableMixin, cardMixin, cardSelectedMixin, cls, colorClassesMapping, controlHeightMixin, controlPaddingMixin, coolIconKeys, createVirtualTableSelectionStore, debounce, defaultBorderMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundInvisibleMixin, fieldBackgroundMixin, focusedClasses, focusedDisabled, focusedInvisibleMixin, getColorSchemeForKey, getColorSchemeForSeed, getLoadedLucideIcons, iconKeys, iconSize, loadLucideIcons, lucideIcons, paperMixin, resolveLucideIcon, useAutoComplete, useDebounceCallback, useDebounceValue, useDebouncedCallback, useInjectStyles, useLucideIcons, useOutsideAlerter, usePortalContainer, useVirtualTableCellSelected, useVirtualTableSelection };
9025
+ export { Alert, AlertCircleIcon, AlertTriangleIcon, AlignLeftIcon, AppWindow, ArrowDownIcon, ArrowDownToLineIcon, ArrowLeftIcon, ArrowRightFromLineIcon, ArrowRightIcon, ArrowRightLeftIcon, ArrowRightToLineIcon, ArrowUpDownIcon, ArrowUpIcon, ArrowUpToLineIcon, Autocomplete, AutocompleteItem, Avatar, Badge, BoldIcon, BookOpenIcon, BooleanSwitch, BooleanSwitchWithLabel, Button, CHIP_COLORS, CHIP_HUES, CHIP_SEED_KEYS, CONTROL_HEIGHT, CalendarIcon, Card, CardView, CenteredView, CheckCircle2Icon, CheckCircleIcon, CheckIcon, CheckSquareIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsUpDownIcon, Chip, CircleDotIcon, CircleIcon, CircleUserIcon, CircularProgress, CircularProgressCenter, CodeIcon, Collapse, CollectionView, ColorPicker, ColumnsIcon, Container, CopyIcon, DatabaseIcon, DateTimeField, DebouncedTextField, Dialog, DialogActions, DialogContent, DialogTitle, DollarSignIcon, DownloadIcon, ErrorBoundary, ExpandablePanel, ExternalLinkIcon, EyeIcon, EyeOffIcon, FileIcon, FileSearchIcon, FileTextIcon, FileUpload, FilterChip, FilterIcon, FilterXIcon, FlagIcon, FolderIcon, FolderKanbanIcon, FolderPlusIcon, FolderUpIcon, FunctionSquareIcon, GitBranchIcon, GitHubIcon, GlobeIcon, HandleIcon, HashIcon, Heading1Icon, Heading2Icon, Heading3Icon, HelpCircleIcon, HistoryIcon, HomeIcon, IconButton, ImageIcon, ImageOffIcon, InfoIcon, InfoLabel, InputLabel, ItalicIcon, KanbanIcon, KanbanView, KeyIcon, KeyRoundIcon, Label, LanguagesIcon, LayoutGridIcon, Link2Icon, LinkIcon, ListIcon, ListOrderedIcon, ListPlusIcon, ListTodoIcon, ListView, LoaderIcon, LoadingButton, LockIcon, LogOutIcon, LucideIconByName, MailIcon, Markdown, Maximize2Icon, Menu, MenuIcon, MenuItem, Menubar, MenubarCheckboxItem, MenubarContent, MenubarItem, MenubarItemIndicator, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarSubTriggerIndicator, MenubarTrigger, MessageCircleIcon, MinusCircleIcon, MinusIcon, MoonIcon, MoreVerticalIcon, MultiSelect, MultiSelectContext, MultiSelectItem, Music2Icon, PanelLeftCloseIcon, PanelLeftIcon, PanelLeftOpenIcon, Paper, PauseIcon, PenLineIcon, PencilIcon, PhoneIcon, PinIcon, PlayIcon, PlusIcon, Popover, PopoverPrimitive, Portal, PortalContainerProvider, QuoteIcon, RadioGroup, RadioGroupItem, RefreshCcwIcon, RefreshCwIcon, RepeatIcon, ResizablePanels, Rows3Icon, SaveIcon, SearchBar, SearchIcon, Select, SelectGroup, SelectItem, SendIcon, Separator, SettingsIcon, Sheet, ShieldIcon, ShoppingCartIcon, Skeleton, Slider, SlidersHorizontalIcon, Slot, SquareIcon, StarIcon, StickyNoteIcon, StrikethroughIcon, SunIcon, SunMoonIcon, Tab, Table, TableBody, TableCell, TableHeader, TableIcon, TableRow, Tabs, TagIcon, TerminalIcon, TextField, TextIcon, TextareaAutosize, ToggleButtonGroup, Tooltip, Trash2Icon, TrendingUpIcon, TypeIcon, Typography, UnderlineIcon, UndoIcon, Unlink2Icon, UploadCloudIcon, UploadIcon, UserCheckIcon, UserIcon, UserPlus, UsersIcon, VideoIcon, VirtualTable, VirtualTableDateField, VirtualTableInput, VirtualTableNumberInput, VirtualTableSelect, VirtualTableSelectionProvider, VirtualTableSwitch, VoteIcon, Wand2Icon, WrenchIcon, XCircleIcon, XIcon, accentTextMixin, cardClickableMixin, cardMixin, cardSelectedMixin, cls, codeSurfaceMixin, colorClassesMapping, controlHeightMixin, controlPaddingMixin, coolIconKeys, createVirtualTableSelectionStore, debounce, defaultBorderMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundInvisibleMixin, fieldBackgroundMixin, focusedClasses, focusedDisabled, focusedInvisibleMixin, getColorSchemeForKey, getColorSchemeForSeed, getLoadedLucideIcons, iconKeys, iconSize, isChunkLoadError, lazyChunk, loadChunk, loadLucideIcons, lucideIcons, paperMixin, resolveLucideIcon, useAutoComplete, useDebounceCallback, useDebounceValue, useDebouncedCallback, useInjectStyles, useLucideIcons, useOutsideAlerter, usePortalContainer, useVirtualTableCellSelected, useVirtualTableSelection };
8786
9026
 
8787
9027
  //# sourceMappingURL=index.es.js.map