@krak-stack/registry 0.11.6 → 0.11.9

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 (123) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +39 -0
  3. package/dist/components/app-switcher/html.d.ts +2 -2
  4. package/dist/components/asset-input/html.d.ts +70 -0
  5. package/dist/components/asset-input/html.js +1549 -0
  6. package/dist/components/asset-input/index.d.ts +280 -0
  7. package/dist/components/asset-input/react.d.ts +32 -0
  8. package/dist/components/asset-input/react.js +2269 -0
  9. package/dist/components/asset-input/schema.d.ts +93 -0
  10. package/dist/components/asset-input/upload.d.ts +15 -0
  11. package/dist/components/asset-table/html.d.ts +110 -0
  12. package/dist/components/asset-table/html.js +4934 -0
  13. package/dist/components/asset-table/index.d.ts +225 -0
  14. package/dist/components/asset-table/react.d.ts +21 -0
  15. package/dist/components/asset-table/react.js +8241 -0
  16. package/dist/components/asset-table/schema.d.ts +73 -0
  17. package/dist/components/audit-log-table/classes.d.ts +1 -0
  18. package/dist/components/audit-log-table/html.d.ts +158 -0
  19. package/dist/components/audit-log-table/html.js +3294 -0
  20. package/dist/components/audit-log-table/index.d.ts +37 -0
  21. package/dist/components/audit-log-table/react.d.ts +3 -51
  22. package/dist/components/audit-log-table/react.js +130 -89
  23. package/dist/components/audit-log-table/schema.d.ts +122 -0
  24. package/dist/components/danger-confirmation/html.d.ts +2 -2
  25. package/dist/components/danger-confirmation/index.d.ts +2 -2
  26. package/dist/components/data-table/classes.d.ts +3 -0
  27. package/dist/components/data-table/html.d.ts +70 -12
  28. package/dist/components/data-table/html.js +56 -19
  29. package/dist/components/data-table/index.d.ts +51 -1
  30. package/dist/components/data-table/react.d.ts +1 -0
  31. package/dist/components/data-table/react.js +46 -16
  32. package/dist/components/data-table/schema.d.ts +93 -3
  33. package/dist/components/docs/html.js +22 -4
  34. package/dist/components/docs/react.js +33 -2
  35. package/dist/components/editable-text/html.d.ts +2 -2
  36. package/dist/components/editable-text/index.d.ts +4 -4
  37. package/dist/components/effect-form/react.js +343 -138
  38. package/dist/components/email-editor/legacy-editor.html.d.ts +6 -6
  39. package/dist/components/file-input/classes.d.ts +1 -1
  40. package/dist/components/file-input/file-type.d.ts +1 -0
  41. package/dist/components/file-input/html.d.ts +8 -1
  42. package/dist/components/file-input/html.js +170 -12
  43. package/dist/components/file-input/index.d.ts +1 -0
  44. package/dist/components/file-input/react.d.ts +9 -1
  45. package/dist/components/file-input/react.js +277 -127
  46. package/dist/components/file-input/schema.d.ts +1 -0
  47. package/dist/components/form/react.js +343 -138
  48. package/dist/components/icon-input/html.js +19 -5
  49. package/dist/components/icon-input/react.js +70 -13
  50. package/dist/components/map-menu/html.d.ts +6 -0
  51. package/dist/components/map-menu/html.js +13 -8
  52. package/dist/components/map-menu/index.d.ts +5 -4
  53. package/dist/components/map-menu/react.d.ts +28 -17
  54. package/dist/components/map-menu/react.js +84 -178
  55. package/dist/components/map-menu/schema.d.ts +6 -0
  56. package/dist/components/map-menu/shared.d.ts +4 -0
  57. package/dist/components/permissions-input/classes.d.ts +8 -0
  58. package/dist/components/permissions-input/html.d.ts +41 -0
  59. package/dist/components/permissions-input/html.js +130 -0
  60. package/dist/components/permissions-input/index.d.ts +80 -0
  61. package/dist/components/permissions-input/react.d.ts +7 -0
  62. package/dist/components/permissions-input/react.js +201 -0
  63. package/dist/components/permissions-input/schema.d.ts +33 -0
  64. package/dist/components/phone-number-input/html.js +48 -14
  65. package/dist/components/phone-number-input/react.js +67 -10
  66. package/dist/components/search-menu/html.d.ts +2 -2
  67. package/dist/components/select-with-custom-input/html.d.ts +2 -2
  68. package/dist/components/sidebar-layout/html.d.ts +3 -2
  69. package/dist/components/sidebar-layout/html.js +20 -2
  70. package/dist/components/sidebar-layout/index.d.ts +1 -0
  71. package/dist/components/sidebar-layout/react.js +33 -2
  72. package/dist/components/switch/react.d.ts +14 -0
  73. package/dist/components/switch/react.js +55 -0
  74. package/dist/components/theme-switcher/html.d.ts +2 -2
  75. package/dist/components/time-input/html.d.ts +2 -2
  76. package/dist/components/timezone-input/html.js +48 -14
  77. package/dist/components/timezone-input/react.js +67 -10
  78. package/dist/components/tracking-notice/classes.d.ts +6 -0
  79. package/dist/components/tracking-notice/html.d.ts +85 -0
  80. package/dist/components/tracking-notice/html.js +354 -0
  81. package/dist/components/tracking-notice/index.d.ts +95 -0
  82. package/dist/components/tracking-notice/react.d.ts +5 -27
  83. package/dist/components/tracking-notice/react.js +189 -59
  84. package/dist/components/tracking-notice/schema.d.ts +45 -0
  85. package/dist/components/upload-attachment/classes.d.ts +3 -2
  86. package/dist/components/upload-attachment/html.d.ts +5 -5
  87. package/dist/components/upload-attachment/html.js +7 -5
  88. package/dist/components/upload-attachment/react.d.ts +3 -1
  89. package/dist/components/upload-attachment/react.js +25 -17
  90. package/dist/components/virtualized-combobox/classes.d.ts +12 -0
  91. package/dist/components/virtualized-combobox/html.d.ts +42 -0
  92. package/dist/components/virtualized-combobox/html.js +48 -14
  93. package/dist/components/virtualized-combobox/index.d.ts +55 -4
  94. package/dist/components/virtualized-combobox/react.d.ts +6 -2
  95. package/dist/components/virtualized-combobox/react.js +67 -10
  96. package/dist/components/virtualized-combobox/schema.d.ts +60 -4
  97. package/dist/components/webhook-delivery-table/html.js +56 -19
  98. package/dist/components/webhook-delivery-table/react.js +46 -16
  99. package/dist/lib/access/index.d.ts +61 -0
  100. package/dist/lib/access/index.js +92 -0
  101. package/dist/lib/access/table/classes.d.ts +13 -0
  102. package/dist/lib/access/table/html.d.ts +39 -0
  103. package/dist/lib/access/table/html.js +157 -0
  104. package/dist/lib/access/table/index.d.ts +32 -0
  105. package/dist/lib/access/table/react.d.ts +3 -0
  106. package/dist/lib/access/table/react.js +195 -0
  107. package/dist/lib/access/table/schema.d.ts +43 -0
  108. package/dist/lib/docs.integrations.server.js +23 -1
  109. package/dist/lib/docs.js +33 -2
  110. package/dist/lib/docs.server.js +29 -2
  111. package/dist/lib/documentation-toolkit.js +23 -1
  112. package/dist/lib/effect-ui-adapter/use-model.d.ts +1 -1
  113. package/dist/lib/effect-ui-adapter/use-model.js +19 -11
  114. package/dist/lib/lucide-effect.d.ts +19 -19
  115. package/dist/lib/lucide-effect.js +38 -38
  116. package/dist/services/assets/library.d.ts +221 -0
  117. package/dist/services/assets/schema.d.ts +3 -0
  118. package/dist/services/assets/url.d.ts +12 -0
  119. package/dist/services/assets/use-library.d.ts +20 -0
  120. package/dist/services/events/browser.js +39 -26
  121. package/dist/services/events/index.js +23 -19
  122. package/dist/services/opentelemetry/web-vitals.js +27 -23
  123. package/package.json +21 -1
@@ -2,7 +2,12 @@ import { Html } from "effect/ui/html";
2
2
  export type { VirtualizedComboboxOption, VirtualizedComboboxProps, } from "./schema.js";
3
3
  export declare const VirtualizedCombobox: import("effect/ui/Component").Component<"VirtualizedCombobox", {
4
4
  readonly classes?: {
5
+ readonly groupLabel?: string | undefined;
6
+ readonly itemContent?: string | undefined;
7
+ readonly itemDescription?: string | undefined;
8
+ readonly itemImage?: string | undefined;
5
9
  readonly itemLabel?: string | undefined;
10
+ readonly itemMedia?: string | undefined;
6
11
  } | undefined;
7
12
  readonly ariaLabel: string;
8
13
  readonly ariaInvalid?: boolean | undefined;
@@ -11,6 +16,11 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
11
16
  readonly items: readonly {
12
17
  value: string;
13
18
  label: string;
19
+ readonly description?: string | undefined;
20
+ readonly imageSrc?: string | undefined;
21
+ readonly icon?: (<Msg>(h: Html.H<Msg>, options: {
22
+ size: number;
23
+ }) => import("effect/ui/View").Input<Msg, never>) | undefined;
14
24
  }[];
15
25
  readonly locale?: string | undefined;
16
26
  readonly open?: boolean | undefined;
@@ -19,6 +29,10 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
19
29
  readonly emptyLabel: string;
20
30
  readonly placeholder: string;
21
31
  readonly triggerLabel?: string | undefined;
32
+ readonly triggerIcon?: (<Msg>(h: Html.H<Msg>, options: {
33
+ size: number;
34
+ }) => import("effect/ui/View").Input<Msg, never>) | undefined;
35
+ readonly itemHeight?: number | undefined;
22
36
  readonly filter?: "contains" | "none" | undefined;
23
37
  readonly messages?: {
24
38
  readonly [x: string]: {
@@ -32,10 +46,20 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
32
46
  readonly value: {
33
47
  value: string;
34
48
  label: string;
49
+ readonly description?: string | undefined;
50
+ readonly imageSrc?: string | undefined;
51
+ readonly icon?: (<Msg>(h: Html.H<Msg>, options: {
52
+ size: number;
53
+ }) => import("effect/ui/View").Input<Msg, never>) | undefined;
35
54
  } | null;
36
55
  } | {
37
56
  readonly classes?: {
57
+ readonly groupLabel?: string | undefined;
58
+ readonly itemContent?: string | undefined;
59
+ readonly itemDescription?: string | undefined;
60
+ readonly itemImage?: string | undefined;
38
61
  readonly itemLabel?: string | undefined;
62
+ readonly itemMedia?: string | undefined;
39
63
  } | undefined;
40
64
  readonly ariaLabel: string;
41
65
  readonly ariaInvalid?: boolean | undefined;
@@ -44,6 +68,11 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
44
68
  readonly items: readonly {
45
69
  value: string;
46
70
  label: string;
71
+ readonly description?: string | undefined;
72
+ readonly imageSrc?: string | undefined;
73
+ readonly icon?: (<Msg>(h: Html.H<Msg>, options: {
74
+ size: number;
75
+ }) => import("effect/ui/View").Input<Msg, never>) | undefined;
47
76
  }[];
48
77
  readonly locale?: string | undefined;
49
78
  readonly open?: boolean | undefined;
@@ -52,6 +81,10 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
52
81
  readonly emptyLabel: string;
53
82
  readonly placeholder: string;
54
83
  readonly triggerLabel?: string | undefined;
84
+ readonly triggerIcon?: (<Msg>(h: Html.H<Msg>, options: {
85
+ size: number;
86
+ }) => import("effect/ui/View").Input<Msg, never>) | undefined;
87
+ readonly itemHeight?: number | undefined;
55
88
  readonly filter?: "contains" | "none" | undefined;
56
89
  readonly messages?: {
57
90
  readonly [x: string]: {
@@ -65,10 +98,16 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
65
98
  readonly value: readonly {
66
99
  value: string;
67
100
  label: string;
101
+ readonly description?: string | undefined;
102
+ readonly imageSrc?: string | undefined;
103
+ readonly icon?: (<Msg>(h: Html.H<Msg>, options: {
104
+ size: number;
105
+ }) => import("effect/ui/View").Input<Msg, never>) | undefined;
68
106
  }[];
69
107
  }, {
70
108
  readonly open: boolean;
71
109
  readonly searchValue: string;
110
+ readonly failedImages: readonly string[];
72
111
  readonly highlight: {
73
112
  readonly value: string;
74
113
  readonly id: number;
@@ -76,6 +115,9 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
76
115
  }, {
77
116
  readonly _tag: "Highlighted";
78
117
  readonly value: string;
118
+ } | {
119
+ readonly _tag: "ImageFailed";
120
+ readonly src: string;
79
121
  } | {
80
122
  readonly _tag: "OpenChanged";
81
123
  readonly open: boolean;
@@ -1,6 +1,7 @@
1
1
  // ../../src/components/virtualized-combobox/html.ts
2
2
  import { Html } from "effect/ui/html";
3
3
  import { Combobox, VirtualList } from "effect/ui/kit";
4
+ import { buttonVariants } from "@/components/effectcn/button";
4
5
  import {
5
6
  ComboboxButton,
6
7
  ComboboxClear,
@@ -15,8 +16,15 @@ import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/htm
15
16
 
16
17
  // ../../src/components/virtualized-combobox/classes.ts
17
18
  var virtualizedComboboxClasses = {
18
- itemLabel: "min-w-0 truncate"
19
+ itemLabel: "min-w-0 truncate",
20
+ groupLabel: "text-muted-foreground px-2 pt-3 pb-1 text-start text-xs",
21
+ itemContent: "flex min-w-0 flex-1 items-center gap-2 text-start",
22
+ itemMedia: "bg-muted grid size-8 shrink-0 place-items-center overflow-hidden rounded-md [&_svg]:size-4",
23
+ itemImage: "size-full object-cover",
24
+ itemDescription: "text-muted-foreground block truncate text-xs"
19
25
  };
26
+ var virtualizedComboboxGroupHeight = 36;
27
+ var virtualizedComboboxDetailHeight = 52;
20
28
  var resolveVirtualizedComboboxClasses = (overrides) => ({
21
29
  ...virtualizedComboboxClasses,
22
30
  ...overrides
@@ -27,10 +35,14 @@ import { Schema as Schema2 } from "effect";
27
35
  import { Component, UiSchema } from "effect/ui";
28
36
 
29
37
  // ../../src/components/virtualized-combobox/schema.ts
30
- import { Schema, Struct } from "effect";
38
+ import { Predicate, Schema, Struct } from "effect";
39
+ var Icon = Schema.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "VirtualizedComboboxIcon" });
31
40
  var VirtualizedComboboxOptionSchema = Schema.Struct({
32
41
  value: Schema.String.pipe(Schema.mutableKey),
33
- label: Schema.String.pipe(Schema.mutableKey)
42
+ label: Schema.String.pipe(Schema.mutableKey),
43
+ description: Schema.optionalKey(Schema.String),
44
+ imageSrc: Schema.optionalKey(Schema.String),
45
+ icon: Schema.optionalKey(Icon)
34
46
  }).annotate({ identifier: "VirtualizedComboboxOption" });
35
47
  var VirtualizedComboboxLabelsSchema = Schema.Struct({
36
48
  clear: Schema.optionalKey(Schema.String),
@@ -55,6 +67,8 @@ var htmlFields = {
55
67
  emptyLabel: Schema.String,
56
68
  placeholder: Schema.String,
57
69
  triggerLabel: Schema.optionalKey(Schema.String),
70
+ triggerIcon: Schema.optionalKey(Icon),
71
+ itemHeight: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
58
72
  filter: Schema.optionalKey(Schema.Literals(["contains", "none"])),
59
73
  messages: Schema.optionalKey(Schema.Record(Schema.String, Schema.Struct({
60
74
  ...VirtualizedComboboxLabelsSchema.fields,
@@ -146,7 +160,8 @@ var VirtualizedComboboxEvents = UiSchema.TaggedEnum(events).annotate({
146
160
  });
147
161
  var VirtualizedComboboxMessage = UiSchema.TaggedEnum({
148
162
  ...events,
149
- Highlighted: { value: Schema2.String }
163
+ Highlighted: { value: Schema2.String },
164
+ ImageFailed: { src: Schema2.String }
150
165
  }).annotate({ identifier: "VirtualizedComboboxMessage" });
151
166
  var virtualizedComboboxOptions = {
152
167
  name: "VirtualizedCombobox",
@@ -154,6 +169,7 @@ var virtualizedComboboxOptions = {
154
169
  model: Schema2.Struct({
155
170
  open: Schema2.Boolean,
156
171
  searchValue: Schema2.String,
172
+ failedImages: Schema2.Array(Schema2.String),
157
173
  highlight: Schema2.NullOr(Schema2.Struct({ value: Schema2.String, id: Schema2.Int }))
158
174
  }).annotate({ identifier: "VirtualizedComboboxModel" }),
159
175
  message: VirtualizedComboboxMessage,
@@ -173,15 +189,20 @@ var update = Component.define(virtualizedComboboxOptions).update({
173
189
  ValueChanged: ($, { value }) => $.set($.model).emit(VirtualizedComboboxEvents.ValueChanged({ value })),
174
190
  Highlighted: ($, { value }) => $.evolve({
175
191
  highlight: { value, id: ($.model.highlight?.id ?? 0) + 1 }
176
- })
192
+ }),
193
+ ImageFailed: ($, { src }) => $.model.failedImages.includes(src) ? $.model : $.evolve({ failedImages: [...$.model.failedImages, src] })
177
194
  });
178
195
  var virtualizedComboboxBehaviours = {
179
- init: () => ({ open: false, searchValue: "", highlight: null }),
196
+ init: () => ({
197
+ open: false,
198
+ searchValue: "",
199
+ highlight: null,
200
+ failedImages: []
201
+ }),
180
202
  update
181
203
  };
182
204
 
183
205
  // ../../src/components/virtualized-combobox/html.ts
184
- var rowHeight = 36;
185
206
  var visibleRows = 8;
186
207
  var itemKey = (value) => `item:${value}`;
187
208
  var VirtualizedCombobox = Html.component({
@@ -192,6 +213,8 @@ var VirtualizedCombobox = Html.component({
192
213
  view: (h, model) => {
193
214
  const virtualizedComboboxClasses = resolveVirtualizedComboboxClasses(h.props.classes);
194
215
  const props = h.props;
216
+ const optionsByValue = new Map(props.items.map((item) => [item.value, item]));
217
+ const rowHeight = props.itemHeight ?? (props.items.some(({ description, imageSrc, icon }) => description || imageSrc || icon) ? virtualizedComboboxDetailHeight : 36);
195
218
  const locale = props.locale ?? h.reads.localeConfig?.locale ?? "en";
196
219
  const labels = virtualizedComboboxMessages(locale, props.messages);
197
220
  const value = props.multiple ? props.value.map((item) => item.value) : props.value?.value ?? null;
@@ -200,7 +223,7 @@ var VirtualizedCombobox = Html.component({
200
223
  props: {
201
224
  open: props.open ?? model.open,
202
225
  inputValue: props.searchValue ?? model.searchValue,
203
- items: props.items,
226
+ items: props.items.map(({ value, label }) => ({ value, label })),
204
227
  value,
205
228
  locale,
206
229
  multiple: props.multiple,
@@ -227,14 +250,14 @@ var VirtualizedCombobox = Html.component({
227
250
  const entries = selectionEntries(combo.items, selected, props.multiple === true, labels);
228
251
  const keys = entries.map((entry) => entry.kind === "group" ? `group:${entry.key}` : itemKey(entry.item.value));
229
252
  const highlight = model.highlight && keys.includes(itemKey(model.highlight.value)) ? model.highlight : undefined;
230
- return h.div.class("relative min-w-0").children(ComboboxButton(h, combo, {
253
+ return h.div.class("relative min-w-0").children((props.triggerIcon ? combo.trigger(h.button.class(buttonVariants({ variant: "outline" }))).children(props.triggerIcon(h, { size: 16 }), props.triggerLabel ?? selectedLabel(props.value, props.placeholder)) : ComboboxButton(h, combo, {
231
254
  class: "w-full min-w-0 aria-invalid:border-destructive",
232
255
  value: props.triggerLabel ?? selectedLabel(props.value, props.placeholder),
233
256
  valueClass: selected.size > 0 ? "pr-7" : undefined
234
- }).attrs({
257
+ })).attrs({
235
258
  "aria-label": props.ariaLabel,
236
259
  "aria-invalid": props.ariaInvalid ? "true" : undefined
237
- }), selected.size > 0 && ComboboxClear(h, combo, {
260
+ }), !props.triggerIcon && selected.size > 0 && ComboboxClear(h, combo, {
238
261
  class: "absolute right-7 top-1/2 -translate-y-1/2"
239
262
  })?.attrs({ "aria-label": labels.clear, tabindex: "0" }), ComboboxPositioner(h, combo, {
240
263
  class: "overflow-visible border-0 bg-transparent p-0 text-inherit"
@@ -244,6 +267,7 @@ var VirtualizedCombobox = Html.component({
244
267
  props: {
245
268
  count: entries.length,
246
269
  itemSize: rowHeight,
270
+ sizes: entries.some(({ kind }) => kind === "group") ? entries.map(({ kind }) => kind === "group" ? virtualizedComboboxGroupHeight : rowHeight) : undefined,
247
271
  measure: false,
248
272
  keys,
249
273
  initialCount: visibleRows,
@@ -254,16 +278,18 @@ var VirtualizedCombobox = Html.component({
254
278
  align: "nearest"
255
279
  }
256
280
  },
257
- view: (list) => list.viewport(h.div.class("min-h-0 overflow-auto overscroll-contain")).attr("style", `max-height:${rowHeight * visibleRows}px`).attr("tabindex", "-1").children(list.list(combo.list(h.div)).children(...list.items.map((index) => {
281
+ view: (list) => list.viewport(h.div.class("min-h-0 overflow-auto overscroll-contain py-1")).attr("style", `max-height:${rowHeight * visibleRows}px`).attr("tabindex", "-1").children(list.list(combo.list(h.div)).children(...list.items.map((index) => {
258
282
  const entry = entries[index];
259
283
  const element = h.div.key(keys[index]);
260
284
  if (entry.kind === "group") {
261
285
  return list.item({
262
286
  element: element.attr("role", "presentation"),
263
287
  index
264
- }).class("text-muted-foreground px-2 pt-3 text-xs").children(entry.label);
288
+ }).class("px-1").children(h.div.class(virtualizedComboboxClasses.groupLabel).children(entry.label));
265
289
  }
266
290
  const { value, label } = entry.item;
291
+ const details = optionsByValue.get(value);
292
+ const image = details?.imageSrc && !model.failedImages.includes(details.imageSrc) ? details.imageSrc : undefined;
267
293
  return list.item({
268
294
  element: element.attr("role", "presentation"),
269
295
  index
@@ -273,7 +299,15 @@ var VirtualizedCombobox = Html.component({
273
299
  }).attrs({
274
300
  "aria-posinset": String(entry.index + 1),
275
301
  "aria-setsize": String(combo.items.length)
276
- }).children(h.span.class(virtualizedComboboxClasses.itemLabel).children(label), ComboboxItemIndicator(h, combo, { value })));
302
+ }).children(h.span.class(virtualizedComboboxClasses.itemContent).children((image || details?.icon) && h.span.attr("aria-hidden", "true").class(virtualizedComboboxClasses.itemMedia).children(image ? h.img.attrs({
303
+ src: image,
304
+ alt: "",
305
+ loading: "lazy"
306
+ }).class(virtualizedComboboxClasses.itemImage).on("error", VirtualizedComboboxMessage.ImageFailed({
307
+ src: image
308
+ })) : details?.icon?.(h, {
309
+ size: 16
310
+ })), h.span.class("min-w-0 flex-1").children(h.span.class(`block ${virtualizedComboboxClasses.itemLabel}`).children(label), details?.description && h.span.class(virtualizedComboboxClasses.itemDescription).children(details.description))), ComboboxItemIndicator(h, combo, { value })));
277
311
  })))
278
312
  }))));
279
313
  }
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { Component, UiSchema } from "effect/ui";
3
- import { VirtualizedComboboxPropsSchema, type VirtualizedComboboxLabelsSchema, type VirtualizedComboboxOption } from "./schema.js";
3
+ import { VirtualizedComboboxPropsSchema, type VirtualizedComboboxLabelsSchema } from "./schema.js";
4
4
  export type VirtualizedComboboxMessages = {
5
5
  -readonly [Key in keyof typeof VirtualizedComboboxLabelsSchema.Type]-?: string;
6
6
  } & {
@@ -25,7 +25,11 @@ export declare const defaultMessages: {
25
25
  export declare const virtualizedComboboxMessages: (locale: string, translations?: Partial<Record<string, Omit<VirtualizedComboboxMessageOverrides, "selected"> & {
26
26
  selected?: string | ((count: number) => string);
27
27
  }>>) => VirtualizedComboboxMessages;
28
- export declare const selectedLabel: <TData, TPlaceholder>(value: VirtualizedComboboxOption<TData> | readonly VirtualizedComboboxOption<TData>[] | null, placeholder: TPlaceholder) => string | TPlaceholder;
28
+ export declare const selectedLabel: <TPlaceholder>(value: {
29
+ label: string;
30
+ } | readonly {
31
+ label: string;
32
+ }[] | null, placeholder: TPlaceholder) => string | TPlaceholder;
29
33
  export declare const selectionEntries: <T extends {
30
34
  value: string;
31
35
  }>(items: readonly T[], selected: ReadonlySet<string>, groupSelections: boolean, labels: Pick<VirtualizedComboboxMessages, "selected" | "selectMore">) => ({
@@ -65,6 +69,9 @@ export declare const VirtualizedComboboxMessage: UiSchema.TaggedEnum<{
65
69
  readonly Highlighted: Schema.TaggedStruct<"Highlighted", {
66
70
  readonly value: Schema.String;
67
71
  }>;
72
+ readonly ImageFailed: Schema.TaggedStruct<"ImageFailed", {
73
+ readonly src: Schema.String;
74
+ }>;
68
75
  readonly OpenChanged: Schema.TaggedStruct<"OpenChanged", {
69
76
  open: Schema.Boolean;
70
77
  }>;
@@ -78,7 +85,7 @@ export declare const VirtualizedComboboxMessage: UiSchema.TaggedEnum<{
78
85
  export declare const virtualizedComboboxOptions: {
79
86
  readonly name: "VirtualizedCombobox";
80
87
  readonly props: Schema.Union<readonly [Schema.Struct<{
81
- readonly classes: Schema.optional<Schema.$Record<Schema.Literals<"itemLabel"[]>, Schema.optionalKey<Schema.String>>>;
88
+ readonly classes: Schema.optional<Schema.$Record<Schema.Literals<("groupLabel" | "itemContent" | "itemDescription" | "itemImage" | "itemLabel" | "itemMedia")[]>, Schema.optionalKey<Schema.String>>>;
82
89
  readonly ariaLabel: Schema.String;
83
90
  readonly ariaInvalid: Schema.optionalKey<Schema.Boolean>;
84
91
  readonly contentClassName: Schema.optionalKey<Schema.String>;
@@ -86,6 +93,13 @@ export declare const virtualizedComboboxOptions: {
86
93
  readonly items: Schema.$Array<Schema.Struct<{
87
94
  readonly value: Schema.mutableKey<Schema.String>;
88
95
  readonly label: Schema.mutableKey<Schema.String>;
96
+ readonly description: Schema.optionalKey<Schema.String>;
97
+ readonly imageSrc: Schema.optionalKey<Schema.String>;
98
+ readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
99
+ size: number;
100
+ }) => import("effect/ui/View").Input<Msg, never>, <Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
101
+ size: number;
102
+ }) => import("effect/ui/View").Input<Msg, never>>>;
89
103
  }>>;
90
104
  readonly locale: Schema.optionalKey<Schema.String>;
91
105
  readonly open: Schema.optionalKey<Schema.Boolean>;
@@ -94,6 +108,12 @@ export declare const virtualizedComboboxOptions: {
94
108
  readonly emptyLabel: Schema.String;
95
109
  readonly placeholder: Schema.String;
96
110
  readonly triggerLabel: Schema.optionalKey<Schema.String>;
111
+ readonly triggerIcon: Schema.optionalKey<Schema.declare<<Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
112
+ size: number;
113
+ }) => import("effect/ui/View").Input<Msg, never>, <Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
114
+ size: number;
115
+ }) => import("effect/ui/View").Input<Msg, never>>>;
116
+ readonly itemHeight: Schema.optionalKey<Schema.Int>;
97
117
  readonly filter: Schema.optionalKey<Schema.Literals<readonly ["contains", "none"]>>;
98
118
  readonly messages: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
99
119
  readonly clear: Schema.optionalKey<Schema.String>;
@@ -105,9 +125,16 @@ export declare const virtualizedComboboxOptions: {
105
125
  readonly value: Schema.NullOr<Schema.Struct<{
106
126
  readonly value: Schema.mutableKey<Schema.String>;
107
127
  readonly label: Schema.mutableKey<Schema.String>;
128
+ readonly description: Schema.optionalKey<Schema.String>;
129
+ readonly imageSrc: Schema.optionalKey<Schema.String>;
130
+ readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
131
+ size: number;
132
+ }) => import("effect/ui/View").Input<Msg, never>, <Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
133
+ size: number;
134
+ }) => import("effect/ui/View").Input<Msg, never>>>;
108
135
  }>>;
109
136
  }>, Schema.Struct<{
110
- readonly classes: Schema.optional<Schema.$Record<Schema.Literals<"itemLabel"[]>, Schema.optionalKey<Schema.String>>>;
137
+ readonly classes: Schema.optional<Schema.$Record<Schema.Literals<("groupLabel" | "itemContent" | "itemDescription" | "itemImage" | "itemLabel" | "itemMedia")[]>, Schema.optionalKey<Schema.String>>>;
111
138
  readonly ariaLabel: Schema.String;
112
139
  readonly ariaInvalid: Schema.optionalKey<Schema.Boolean>;
113
140
  readonly contentClassName: Schema.optionalKey<Schema.String>;
@@ -115,6 +142,13 @@ export declare const virtualizedComboboxOptions: {
115
142
  readonly items: Schema.$Array<Schema.Struct<{
116
143
  readonly value: Schema.mutableKey<Schema.String>;
117
144
  readonly label: Schema.mutableKey<Schema.String>;
145
+ readonly description: Schema.optionalKey<Schema.String>;
146
+ readonly imageSrc: Schema.optionalKey<Schema.String>;
147
+ readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
148
+ size: number;
149
+ }) => import("effect/ui/View").Input<Msg, never>, <Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
150
+ size: number;
151
+ }) => import("effect/ui/View").Input<Msg, never>>>;
118
152
  }>>;
119
153
  readonly locale: Schema.optionalKey<Schema.String>;
120
154
  readonly open: Schema.optionalKey<Schema.Boolean>;
@@ -123,6 +157,12 @@ export declare const virtualizedComboboxOptions: {
123
157
  readonly emptyLabel: Schema.String;
124
158
  readonly placeholder: Schema.String;
125
159
  readonly triggerLabel: Schema.optionalKey<Schema.String>;
160
+ readonly triggerIcon: Schema.optionalKey<Schema.declare<<Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
161
+ size: number;
162
+ }) => import("effect/ui/View").Input<Msg, never>, <Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
163
+ size: number;
164
+ }) => import("effect/ui/View").Input<Msg, never>>>;
165
+ readonly itemHeight: Schema.optionalKey<Schema.Int>;
126
166
  readonly filter: Schema.optionalKey<Schema.Literals<readonly ["contains", "none"]>>;
127
167
  readonly messages: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
128
168
  readonly clear: Schema.optionalKey<Schema.String>;
@@ -134,11 +174,19 @@ export declare const virtualizedComboboxOptions: {
134
174
  readonly value: Schema.$Array<Schema.Struct<{
135
175
  readonly value: Schema.mutableKey<Schema.String>;
136
176
  readonly label: Schema.mutableKey<Schema.String>;
177
+ readonly description: Schema.optionalKey<Schema.String>;
178
+ readonly imageSrc: Schema.optionalKey<Schema.String>;
179
+ readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
180
+ size: number;
181
+ }) => import("effect/ui/View").Input<Msg, never>, <Msg>(h: import("effect/ui/html/Html").H<Msg>, options: {
182
+ size: number;
183
+ }) => import("effect/ui/View").Input<Msg, never>>>;
137
184
  }>>;
138
185
  }>]>;
139
186
  readonly model: Schema.Struct<{
140
187
  readonly open: Schema.Boolean;
141
188
  readonly searchValue: Schema.String;
189
+ readonly failedImages: Schema.$Array<Schema.String>;
142
190
  readonly highlight: Schema.NullOr<Schema.Struct<{
143
191
  readonly value: Schema.String;
144
192
  readonly id: Schema.Int;
@@ -148,6 +196,9 @@ export declare const virtualizedComboboxOptions: {
148
196
  readonly Highlighted: Schema.TaggedStruct<"Highlighted", {
149
197
  readonly value: Schema.String;
150
198
  }>;
199
+ readonly ImageFailed: Schema.TaggedStruct<"ImageFailed", {
200
+ readonly src: Schema.String;
201
+ }>;
151
202
  readonly OpenChanged: Schema.TaggedStruct<"OpenChanged", {
152
203
  open: Schema.Boolean;
153
204
  }>;
@@ -1,14 +1,18 @@
1
1
  import { useVirtualizer } from "@tanstack/react-virtual";
2
2
  import { type ReactElement, type ReactNode, type RefObject } from "react";
3
3
  import { type VirtualizedComboboxMessageTranslations } from "./index.js";
4
- import type { VirtualizedComboboxSharedProps as SharedProps, VirtualizedComboboxOption } from "./schema.js";
4
+ import type { VirtualizedComboboxSharedProps as SharedProps, VirtualizedComboboxOption as HtmlOption } from "./schema.js";
5
5
  export { virtualizedComboboxMessages } from "./index.js";
6
6
  export type { VirtualizedComboboxMessages, VirtualizedComboboxMessageOverrides, VirtualizedComboboxMessageTranslations, } from "./index.js";
7
- export type { VirtualizedComboboxOption } from "./schema.js";
7
+ export type VirtualizedComboboxOption<TData = never> = Omit<HtmlOption<TData>, "icon"> & {
8
+ readonly icon?: ReactNode;
9
+ };
8
10
  export type VirtualizedComboboxVirtualizer = ReturnType<typeof useVirtualizer<HTMLDivElement, Element>>;
9
11
  interface VirtualizedComboboxSharedProps<TData> extends Omit<SharedProps, "items"> {
10
12
  emptyLabel: ReactNode;
11
13
  items: readonly VirtualizedComboboxOption<TData>[];
14
+ /** Virtualized option height in pixels, including row padding. */
15
+ itemHeight?: number;
12
16
  messages?: VirtualizedComboboxMessageTranslations;
13
17
  onOpenChange?: (open: boolean) => void;
14
18
  onSearchValueChange?: (value: string) => void;
@@ -6,7 +6,8 @@ import {
6
6
  useCallback,
7
7
  useEffect,
8
8
  useImperativeHandle,
9
- useRef
9
+ useRef,
10
+ useState
10
11
  } from "react";
11
12
  import { Button } from "@/components/ui/button";
12
13
  import { InputGroup, InputGroupInput } from "@/components/ui/input-group";
@@ -19,8 +20,15 @@ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/reac
19
20
 
20
21
  // ../../src/components/virtualized-combobox/classes.ts
21
22
  var virtualizedComboboxClasses = {
22
- itemLabel: "min-w-0 truncate"
23
+ itemLabel: "min-w-0 truncate",
24
+ groupLabel: "text-muted-foreground px-2 pt-3 pb-1 text-start text-xs",
25
+ itemContent: "flex min-w-0 flex-1 items-center gap-2 text-start",
26
+ itemMedia: "bg-muted grid size-8 shrink-0 place-items-center overflow-hidden rounded-md [&_svg]:size-4",
27
+ itemImage: "size-full object-cover",
28
+ itemDescription: "text-muted-foreground block truncate text-xs"
23
29
  };
30
+ var virtualizedComboboxGroupHeight = 36;
31
+ var virtualizedComboboxDetailHeight = 52;
24
32
  var resolveVirtualizedComboboxClasses = (overrides) => ({
25
33
  ...virtualizedComboboxClasses,
26
34
  ...overrides
@@ -31,10 +39,14 @@ import { Schema as Schema2 } from "effect";
31
39
  import { Component, UiSchema } from "effect/ui";
32
40
 
33
41
  // ../../src/components/virtualized-combobox/schema.ts
34
- import { Schema, Struct } from "effect";
42
+ import { Predicate, Schema, Struct } from "effect";
43
+ var Icon = Schema.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "VirtualizedComboboxIcon" });
35
44
  var VirtualizedComboboxOptionSchema = Schema.Struct({
36
45
  value: Schema.String.pipe(Schema.mutableKey),
37
- label: Schema.String.pipe(Schema.mutableKey)
46
+ label: Schema.String.pipe(Schema.mutableKey),
47
+ description: Schema.optionalKey(Schema.String),
48
+ imageSrc: Schema.optionalKey(Schema.String),
49
+ icon: Schema.optionalKey(Icon)
38
50
  }).annotate({ identifier: "VirtualizedComboboxOption" });
39
51
  var VirtualizedComboboxLabelsSchema = Schema.Struct({
40
52
  clear: Schema.optionalKey(Schema.String),
@@ -59,6 +71,8 @@ var htmlFields = {
59
71
  emptyLabel: Schema.String,
60
72
  placeholder: Schema.String,
61
73
  triggerLabel: Schema.optionalKey(Schema.String),
74
+ triggerIcon: Schema.optionalKey(Icon),
75
+ itemHeight: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
62
76
  filter: Schema.optionalKey(Schema.Literals(["contains", "none"])),
63
77
  messages: Schema.optionalKey(Schema.Record(Schema.String, Schema.Struct({
64
78
  ...VirtualizedComboboxLabelsSchema.fields,
@@ -148,7 +162,8 @@ var VirtualizedComboboxEvents = UiSchema.TaggedEnum(events).annotate({
148
162
  });
149
163
  var VirtualizedComboboxMessage = UiSchema.TaggedEnum({
150
164
  ...events,
151
- Highlighted: { value: Schema2.String }
165
+ Highlighted: { value: Schema2.String },
166
+ ImageFailed: { src: Schema2.String }
152
167
  }).annotate({ identifier: "VirtualizedComboboxMessage" });
153
168
  var virtualizedComboboxOptions = {
154
169
  name: "VirtualizedCombobox",
@@ -156,6 +171,7 @@ var virtualizedComboboxOptions = {
156
171
  model: Schema2.Struct({
157
172
  open: Schema2.Boolean,
158
173
  searchValue: Schema2.String,
174
+ failedImages: Schema2.Array(Schema2.String),
159
175
  highlight: Schema2.NullOr(Schema2.Struct({ value: Schema2.String, id: Schema2.Int }))
160
176
  }).annotate({ identifier: "VirtualizedComboboxModel" }),
161
177
  message: VirtualizedComboboxMessage,
@@ -175,17 +191,24 @@ var update = Component.define(virtualizedComboboxOptions).update({
175
191
  ValueChanged: ($, { value }) => $.set($.model).emit(VirtualizedComboboxEvents.ValueChanged({ value })),
176
192
  Highlighted: ($, { value }) => $.evolve({
177
193
  highlight: { value, id: ($.model.highlight?.id ?? 0) + 1 }
178
- })
194
+ }),
195
+ ImageFailed: ($, { src }) => $.model.failedImages.includes(src) ? $.model : $.evolve({ failedImages: [...$.model.failedImages, src] })
179
196
  });
180
197
 
181
198
  // ../../src/components/virtualized-combobox/react.tsx
182
199
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
183
200
  "use client";
184
201
  var optionEquals = (item, selected) => item.value === selected.value;
202
+ var hasOptionDetails = ({
203
+ description,
204
+ imageSrc,
205
+ icon
206
+ }) => Boolean(description || imageSrc || icon);
185
207
  var VirtualizedComboboxList = ({
186
208
  classes,
187
209
  emptyLabel,
188
210
  groupSelections,
211
+ itemHeight,
189
212
  itemIndexRef,
190
213
  locale = "en",
191
214
  messages: messageOverrides,
@@ -198,6 +221,8 @@ var VirtualizedComboboxList = ({
198
221
  const labels = virtualizedComboboxMessages(locale, messageOverrides);
199
222
  const entries = selectionEntries(filteredItems, selectedValues, groupSelections, labels);
200
223
  const scrollRef = useRef(null);
224
+ const [failedImages, setFailedImages] = useState(() => new Set);
225
+ const rowHeight = itemHeight ?? (filteredItems.some(hasOptionDetails) ? virtualizedComboboxDetailHeight : 36);
201
226
  const virtualizer = useVirtualizer({
202
227
  count: entries.length,
203
228
  getScrollElement: () => scrollRef.current,
@@ -205,7 +230,7 @@ var VirtualizedComboboxList = ({
205
230
  const entry = entries[index];
206
231
  return entry?.kind === "group" ? `group-${entry.key}` : entry?.item.value ?? index;
207
232
  },
208
- estimateSize: () => 36,
233
+ estimateSize: (index) => entries[index]?.kind === "group" ? virtualizedComboboxGroupHeight : rowHeight,
209
234
  overscan: 8
210
235
  });
211
236
  useEffect(() => {
@@ -247,7 +272,7 @@ var VirtualizedComboboxList = ({
247
272
  return /* @__PURE__ */ jsx(ComboboxPrimitive.Group, {
248
273
  className: "contents",
249
274
  children: /* @__PURE__ */ jsx(ComboboxPrimitive.GroupLabel, {
250
- className: "text-muted-foreground absolute top-0 left-0 w-full px-2 pt-3 pb-1 text-xs",
275
+ className: `absolute top-0 left-0 w-full ${virtualizedComboboxClasses.groupLabel}`,
251
276
  "data-index": virtualItem.index,
252
277
  ref: virtualizer.measureElement,
253
278
  style,
@@ -255,6 +280,8 @@ var VirtualizedComboboxList = ({
255
280
  })
256
281
  }, entry.key);
257
282
  }
283
+ const details = entry.item;
284
+ const image = details.imageSrc && !failedImages.has(details.imageSrc) ? details.imageSrc : undefined;
258
285
  return /* @__PURE__ */ jsxs(ComboboxPrimitive.Item, {
259
286
  "aria-posinset": entry.index + 1,
260
287
  "aria-setsize": filteredItems.length,
@@ -265,10 +292,38 @@ var VirtualizedComboboxList = ({
265
292
  style,
266
293
  value: entry.item,
267
294
  children: [
268
- renderItem?.(entry.item) ?? /* @__PURE__ */ jsx("span", {
295
+ renderItem?.(entry.item) ?? (hasOptionDetails(details) ? /* @__PURE__ */ jsxs("span", {
296
+ className: virtualizedComboboxClasses.itemContent,
297
+ children: [
298
+ (image || details.icon) && /* @__PURE__ */ jsx("span", {
299
+ "aria-hidden": "true",
300
+ className: virtualizedComboboxClasses.itemMedia,
301
+ children: image ? /* @__PURE__ */ jsx("img", {
302
+ src: image,
303
+ alt: "",
304
+ loading: "lazy",
305
+ onError: () => setFailedImages((failed) => new Set(failed).add(image)),
306
+ className: virtualizedComboboxClasses.itemImage
307
+ }) : details.icon
308
+ }),
309
+ /* @__PURE__ */ jsxs("span", {
310
+ className: "min-w-0 flex-1",
311
+ children: [
312
+ /* @__PURE__ */ jsx("span", {
313
+ className: cn("block", virtualizedComboboxClasses.itemLabel),
314
+ children: entry.item.label
315
+ }),
316
+ details.description && /* @__PURE__ */ jsx("span", {
317
+ className: virtualizedComboboxClasses.itemDescription,
318
+ children: details.description
319
+ })
320
+ ]
321
+ })
322
+ ]
323
+ }) : /* @__PURE__ */ jsx("span", {
269
324
  className: virtualizedComboboxClasses.itemLabel,
270
325
  children: entry.item.label
271
- }),
326
+ })),
272
327
  /* @__PURE__ */ jsx(ComboboxPrimitive.ItemIndicator, {
273
328
  className: "absolute right-2 flex size-4 items-center justify-center",
274
329
  children: /* @__PURE__ */ jsx(Check, {})
@@ -286,6 +341,7 @@ var VirtualizedComboboxContent = ({
286
341
  contentClassName,
287
342
  emptyLabel,
288
343
  groupSelections,
344
+ itemHeight,
289
345
  itemIndexRef,
290
346
  locale = "en",
291
347
  messages: messageOverrides,
@@ -317,6 +373,7 @@ var VirtualizedComboboxContent = ({
317
373
  classes,
318
374
  emptyLabel,
319
375
  groupSelections,
376
+ itemHeight,
320
377
  itemIndexRef,
321
378
  locale,
322
379
  messages: messageOverrides,