@krak-stack/registry 0.11.7 → 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 (109) hide show
  1. package/CHANGELOG.md +54 -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/html.js +47 -13
  18. package/dist/components/audit-log-table/react.js +36 -12
  19. package/dist/components/copy-button/html.d.ts +2 -2
  20. package/dist/components/danger-confirmation/html.d.ts +2 -2
  21. package/dist/components/data-table/classes.d.ts +2 -0
  22. package/dist/components/data-table/html.d.ts +58 -0
  23. package/dist/components/data-table/html.js +47 -13
  24. package/dist/components/data-table/index.d.ts +51 -1
  25. package/dist/components/data-table/react.d.ts +1 -0
  26. package/dist/components/data-table/react.js +36 -12
  27. package/dist/components/data-table/schema.d.ts +93 -3
  28. package/dist/components/date-input/html.d.ts +2 -2
  29. package/dist/components/docs/html.js +22 -4
  30. package/dist/components/docs/react.js +33 -2
  31. package/dist/components/editable-text/html.d.ts +2 -2
  32. package/dist/components/editing-locale-switcher/html.d.ts +2 -2
  33. package/dist/components/effect-form/react.js +343 -138
  34. package/dist/components/file-input/classes.d.ts +1 -1
  35. package/dist/components/file-input/file-type.d.ts +1 -0
  36. package/dist/components/file-input/html.d.ts +8 -1
  37. package/dist/components/file-input/html.js +170 -12
  38. package/dist/components/file-input/index.d.ts +1 -0
  39. package/dist/components/file-input/react.d.ts +9 -1
  40. package/dist/components/file-input/react.js +277 -127
  41. package/dist/components/file-input/schema.d.ts +1 -0
  42. package/dist/components/form/react.d.ts +5 -5
  43. package/dist/components/form/react.js +343 -138
  44. package/dist/components/icon-input/html.js +19 -5
  45. package/dist/components/icon-input/react.js +70 -13
  46. package/dist/components/locale-switcher/html.d.ts +2 -2
  47. package/dist/components/map-menu/html.d.ts +10 -4
  48. package/dist/components/map-menu/html.js +13 -8
  49. package/dist/components/map-menu/index.d.ts +5 -4
  50. package/dist/components/map-menu/react.d.ts +28 -17
  51. package/dist/components/map-menu/react.js +84 -178
  52. package/dist/components/map-menu/schema.d.ts +6 -0
  53. package/dist/components/map-menu/shared.d.ts +4 -0
  54. package/dist/components/permissions-input/classes.d.ts +8 -0
  55. package/dist/components/permissions-input/html.d.ts +41 -0
  56. package/dist/components/permissions-input/html.js +130 -0
  57. package/dist/components/permissions-input/index.d.ts +80 -0
  58. package/dist/components/permissions-input/react.d.ts +7 -0
  59. package/dist/components/permissions-input/react.js +201 -0
  60. package/dist/components/permissions-input/schema.d.ts +33 -0
  61. package/dist/components/phone-number-input/html.js +48 -14
  62. package/dist/components/phone-number-input/react.js +67 -10
  63. package/dist/components/presence-transition/index.d.ts +2 -2
  64. package/dist/components/search-menu/html.d.ts +2 -2
  65. package/dist/components/sidebar-layout/html.d.ts +3 -2
  66. package/dist/components/sidebar-layout/html.js +20 -2
  67. package/dist/components/sidebar-layout/index.d.ts +1 -0
  68. package/dist/components/sidebar-layout/react.js +33 -2
  69. package/dist/components/time-input/html.d.ts +2 -2
  70. package/dist/components/timezone-input/html.js +48 -14
  71. package/dist/components/timezone-input/react.js +67 -10
  72. package/dist/components/tracking-notice/html.d.ts +4 -4
  73. package/dist/components/tracking-notice/index.d.ts +2 -2
  74. package/dist/components/upload-attachment/classes.d.ts +3 -2
  75. package/dist/components/upload-attachment/html.d.ts +1 -1
  76. package/dist/components/upload-attachment/html.js +7 -5
  77. package/dist/components/upload-attachment/react.d.ts +3 -1
  78. package/dist/components/upload-attachment/react.js +25 -17
  79. package/dist/components/virtualized-combobox/classes.d.ts +12 -0
  80. package/dist/components/virtualized-combobox/html.d.ts +45 -3
  81. package/dist/components/virtualized-combobox/html.js +48 -14
  82. package/dist/components/virtualized-combobox/index.d.ts +55 -4
  83. package/dist/components/virtualized-combobox/react.d.ts +6 -2
  84. package/dist/components/virtualized-combobox/react.js +67 -10
  85. package/dist/components/virtualized-combobox/schema.d.ts +60 -4
  86. package/dist/components/webhook-delivery-table/html.js +47 -13
  87. package/dist/components/webhook-delivery-table/react.js +36 -12
  88. package/dist/lib/access/index.d.ts +61 -0
  89. package/dist/lib/access/index.js +92 -0
  90. package/dist/lib/access/table/classes.d.ts +13 -0
  91. package/dist/lib/access/table/html.d.ts +39 -0
  92. package/dist/lib/access/table/html.js +157 -0
  93. package/dist/lib/access/table/index.d.ts +32 -0
  94. package/dist/lib/access/table/react.d.ts +3 -0
  95. package/dist/lib/access/table/react.js +195 -0
  96. package/dist/lib/access/table/schema.d.ts +43 -0
  97. package/dist/lib/docs.integrations.server.js +23 -1
  98. package/dist/lib/docs.js +33 -2
  99. package/dist/lib/docs.server.js +29 -2
  100. package/dist/lib/documentation-toolkit.js +23 -1
  101. package/dist/lib/effect-ui-adapter/use-model.d.ts +1 -1
  102. package/dist/lib/effect-ui-adapter/use-model.js +19 -11
  103. package/dist/lib/lucide-effect.d.ts +19 -19
  104. package/dist/lib/lucide-effect.js +38 -38
  105. package/dist/services/assets/library.d.ts +221 -0
  106. package/dist/services/assets/schema.d.ts +3 -0
  107. package/dist/services/assets/url.d.ts +12 -0
  108. package/dist/services/assets/use-library.d.ts +20 -0
  109. package/package.json +13 -1
@@ -0,0 +1,201 @@
1
+ // ../../src/components/permissions-input/react.tsx
2
+ import { Component as Component2, View } from "effect/ui";
3
+ import { useId } from "react";
4
+ import { Badge } from "@/components/ui/badge";
5
+ import { Button } from "@/components/ui/button";
6
+ import { Checkbox } from "@/components/ui/checkbox";
7
+ import {
8
+ Collapsible,
9
+ CollapsibleContent,
10
+ CollapsibleTrigger
11
+ } from "@/components/ui/collapsible";
12
+ import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
13
+
14
+ // ../../src/components/permissions-input/classes.ts
15
+ var permissionsInputHeaderClass = "flex flex-wrap items-center justify-between gap-2";
16
+ var permissionsInputActionsClass = "ml-auto flex flex-wrap justify-end gap-2";
17
+ var permissionsInputClasses = (overrides) => ({
18
+ groups: "divide-y overflow-hidden rounded-lg border",
19
+ trigger: "hover:bg-muted/50 focus-visible:ring-ring flex w-full items-center justify-between gap-3 px-4 py-3 text-left text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset",
20
+ options: "grid gap-3 border-t px-4 py-3 sm:grid-cols-2",
21
+ ...overrides
22
+ });
23
+
24
+ // ../../src/components/permissions-input/index.ts
25
+ import { Schema as Schema2 } from "effect";
26
+ import { Component, UiSchema } from "effect/ui";
27
+
28
+ // ../../src/components/permissions-input/schema.ts
29
+ import { Schema } from "effect";
30
+ var text = Schema.optionalKey(Schema.String);
31
+ var PermissionsInputOption = Schema.Struct({
32
+ id: Schema.String,
33
+ label: Schema.String
34
+ }).annotate({ identifier: "PermissionsInputOption" });
35
+ var PermissionsInputGroup = Schema.Struct({
36
+ id: Schema.String,
37
+ label: Schema.String,
38
+ options: Schema.Array(PermissionsInputOption)
39
+ }).annotate({ identifier: "PermissionsInputGroup" });
40
+ var PermissionsInputProps = Schema.Struct({
41
+ title: Schema.String,
42
+ description: text,
43
+ selectAllLabel: Schema.String,
44
+ clearAllLabel: Schema.String,
45
+ groups: Schema.Array(PermissionsInputGroup),
46
+ selected: Schema.Record(Schema.String, Schema.Boolean),
47
+ disabled: Schema.optionalKey(Schema.Boolean),
48
+ classes: Schema.optionalKey(Schema.Struct({
49
+ groups: text,
50
+ trigger: text,
51
+ options: text
52
+ }))
53
+ }).annotate({ identifier: "PermissionsInputProps" });
54
+
55
+ // ../../src/components/permissions-input/index.ts
56
+ var PermissionsInputMessage = UiSchema.TaggedEnum({
57
+ Group: { id: Schema2.String, open: Schema2.Boolean },
58
+ Toggle: { id: Schema2.String, checked: Schema2.Boolean },
59
+ All: { checked: Schema2.Boolean }
60
+ }).annotate({ identifier: "PermissionsInputMessage" });
61
+ var PermissionsInputEvent = UiSchema.TaggedEnum({
62
+ Changed: { ids: Schema2.Array(Schema2.String), checked: Schema2.Boolean }
63
+ }).annotate({ identifier: "PermissionsInputEvent" });
64
+ var optionIds = ({ groups }) => [
65
+ ...new Set(groups.flatMap(({ options }) => options.map(({ id }) => id)))
66
+ ];
67
+ var selectedCount = (options, selected) => options.filter(({ id }) => selected[id] === true).length;
68
+ var hasSelection = (props) => optionIds(props).some((id) => props.selected[id] === true);
69
+ var permissionsInputOptions = {
70
+ name: "PermissionsInput",
71
+ props: PermissionsInputProps,
72
+ model: Schema2.Array(Schema2.String),
73
+ message: PermissionsInputMessage,
74
+ events: PermissionsInputEvent,
75
+ restore: false
76
+ };
77
+ var update = Component.define(permissionsInputOptions).update({
78
+ Group: ($, { id, open }) => {
79
+ const groups = new Set($.model);
80
+ if (open)
81
+ groups.add(id);
82
+ else
83
+ groups.delete(id);
84
+ return [...groups];
85
+ },
86
+ Toggle: ($, { id, checked }) => $.props.disabled || !optionIds($.props).includes(id) ? $.model : $.emit(PermissionsInputEvent.Changed({ ids: [id], checked })),
87
+ All: ($, { checked }) => {
88
+ const ids = optionIds($.props);
89
+ return $.props.disabled || !ids.length ? $.model : $.emit(PermissionsInputEvent.Changed({ ids, checked }));
90
+ }
91
+ });
92
+ var permissionsInputBehaviours = {
93
+ init: ({ props }) => props.groups.filter(({ options }) => selectedCount(options, props.selected) > 0).map(({ id }) => id),
94
+ update
95
+ };
96
+
97
+ // ../../src/components/permissions-input/react.tsx
98
+ import { jsx, jsxs } from "react/jsx-runtime";
99
+ "use client";
100
+ var component = Component2.define(permissionsInputOptions).make({
101
+ ...permissionsInputBehaviours,
102
+ view: () => View.text("")
103
+ });
104
+ var PermissionsInput = ({
105
+ onChange,
106
+ ...props
107
+ }) => {
108
+ const { model, send } = useModel(component, props, {
109
+ onEmit: ({ ids, checked }) => onChange({ ids, checked })
110
+ });
111
+ const { groups, selected, disabled } = props;
112
+ const titleId = useId();
113
+ const classes = permissionsInputClasses(props.classes);
114
+ if (!groups.length)
115
+ return null;
116
+ return /* @__PURE__ */ jsxs("fieldset", {
117
+ className: "grid min-w-0 gap-3",
118
+ "aria-labelledby": titleId,
119
+ children: [
120
+ /* @__PURE__ */ jsxs("div", {
121
+ className: permissionsInputHeaderClass,
122
+ children: [
123
+ /* @__PURE__ */ jsx("span", {
124
+ id: titleId,
125
+ className: "text-sm font-medium",
126
+ children: props.title
127
+ }),
128
+ /* @__PURE__ */ jsxs("div", {
129
+ className: permissionsInputActionsClass,
130
+ children: [
131
+ /* @__PURE__ */ jsx(Button, {
132
+ type: "button",
133
+ size: "sm",
134
+ variant: "outline",
135
+ disabled,
136
+ onClick: () => send(PermissionsInputMessage.All({ checked: true })),
137
+ children: props.selectAllLabel
138
+ }),
139
+ hasSelection(props) && /* @__PURE__ */ jsx(Button, {
140
+ type: "button",
141
+ size: "sm",
142
+ variant: "outline",
143
+ disabled,
144
+ onClick: () => send(PermissionsInputMessage.All({ checked: false })),
145
+ children: props.clearAllLabel
146
+ })
147
+ ]
148
+ })
149
+ ]
150
+ }),
151
+ props.description && /* @__PURE__ */ jsx("p", {
152
+ className: "text-muted-foreground text-sm",
153
+ children: props.description
154
+ }),
155
+ /* @__PURE__ */ jsx("div", {
156
+ className: classes.groups,
157
+ children: groups.map(({ id, label, options }) => /* @__PURE__ */ jsxs(Collapsible, {
158
+ open: model.includes(id),
159
+ onOpenChange: (open) => send(PermissionsInputMessage.Group({ id, open })),
160
+ children: [
161
+ /* @__PURE__ */ jsxs(CollapsibleTrigger, {
162
+ className: classes.trigger,
163
+ children: [
164
+ /* @__PURE__ */ jsx("span", {
165
+ children: label
166
+ }),
167
+ " ",
168
+ /* @__PURE__ */ jsxs(Badge, {
169
+ variant: "secondary",
170
+ className: "tabular-nums",
171
+ children: [
172
+ selectedCount(options, selected),
173
+ "/",
174
+ options.length
175
+ ]
176
+ })
177
+ ]
178
+ }),
179
+ /* @__PURE__ */ jsx(CollapsibleContent, {
180
+ className: classes.options,
181
+ children: options.map((option) => /* @__PURE__ */ jsxs("label", {
182
+ className: "flex items-center gap-2 text-sm",
183
+ children: [
184
+ /* @__PURE__ */ jsx(Checkbox, {
185
+ checked: selected[option.id] === true,
186
+ disabled,
187
+ onCheckedChange: (checked) => send(PermissionsInputMessage.Toggle({ id: option.id, checked }))
188
+ }),
189
+ option.label
190
+ ]
191
+ }, option.id))
192
+ })
193
+ ]
194
+ }, id))
195
+ })
196
+ ]
197
+ });
198
+ };
199
+ export {
200
+ PermissionsInput
201
+ };
@@ -0,0 +1,33 @@
1
+ import { Schema } from "effect";
2
+ declare const PermissionsInputGroup: Schema.Struct<{
3
+ readonly id: Schema.String;
4
+ readonly label: Schema.String;
5
+ readonly options: Schema.$Array<Schema.Struct<{
6
+ readonly id: Schema.String;
7
+ readonly label: Schema.String;
8
+ }>>;
9
+ }>;
10
+ export type PermissionsInputGroup = typeof PermissionsInputGroup.Type;
11
+ export declare const PermissionsInputProps: Schema.Struct<{
12
+ readonly title: Schema.String;
13
+ readonly description: Schema.optionalKey<Schema.String>;
14
+ readonly selectAllLabel: Schema.String;
15
+ readonly clearAllLabel: Schema.String;
16
+ readonly groups: Schema.$Array<Schema.Struct<{
17
+ readonly id: Schema.String;
18
+ readonly label: Schema.String;
19
+ readonly options: Schema.$Array<Schema.Struct<{
20
+ readonly id: Schema.String;
21
+ readonly label: Schema.String;
22
+ }>>;
23
+ }>>;
24
+ readonly selected: Schema.$Record<Schema.String, Schema.Boolean>;
25
+ readonly disabled: Schema.optionalKey<Schema.Boolean>;
26
+ readonly classes: Schema.optionalKey<Schema.Struct<{
27
+ readonly groups: Schema.optionalKey<Schema.String>;
28
+ readonly trigger: Schema.optionalKey<Schema.String>;
29
+ readonly options: Schema.optionalKey<Schema.String>;
30
+ }>>;
31
+ }>;
32
+ export type PermissionsInputProps = typeof PermissionsInputProps.Type;
33
+ export {};
@@ -9,6 +9,7 @@ import { krakstackLocaleRead as krakstackLocaleRead2 } from "@krak-stack/registr
9
9
  // ../../src/components/virtualized-combobox/html.ts
10
10
  import { Html } from "effect/ui/html";
11
11
  import { Combobox, VirtualList } from "effect/ui/kit";
12
+ import { buttonVariants } from "@/components/effectcn/button";
12
13
  import {
13
14
  ComboboxButton,
14
15
  ComboboxClear,
@@ -23,8 +24,15 @@ import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/htm
23
24
 
24
25
  // ../../src/components/virtualized-combobox/classes.ts
25
26
  var virtualizedComboboxClasses = {
26
- itemLabel: "min-w-0 truncate"
27
+ itemLabel: "min-w-0 truncate",
28
+ groupLabel: "text-muted-foreground px-2 pt-3 pb-1 text-start text-xs",
29
+ itemContent: "flex min-w-0 flex-1 items-center gap-2 text-start",
30
+ itemMedia: "bg-muted grid size-8 shrink-0 place-items-center overflow-hidden rounded-md [&_svg]:size-4",
31
+ itemImage: "size-full object-cover",
32
+ itemDescription: "text-muted-foreground block truncate text-xs"
27
33
  };
34
+ var virtualizedComboboxGroupHeight = 36;
35
+ var virtualizedComboboxDetailHeight = 52;
28
36
  var resolveVirtualizedComboboxClasses = (overrides) => ({
29
37
  ...virtualizedComboboxClasses,
30
38
  ...overrides
@@ -35,10 +43,14 @@ import { Schema as Schema2 } from "effect";
35
43
  import { Component, UiSchema } from "effect/ui";
36
44
 
37
45
  // ../../src/components/virtualized-combobox/schema.ts
38
- import { Schema, Struct } from "effect";
46
+ import { Predicate, Schema, Struct } from "effect";
47
+ var Icon = Schema.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "VirtualizedComboboxIcon" });
39
48
  var VirtualizedComboboxOptionSchema = Schema.Struct({
40
49
  value: Schema.String.pipe(Schema.mutableKey),
41
- label: Schema.String.pipe(Schema.mutableKey)
50
+ label: Schema.String.pipe(Schema.mutableKey),
51
+ description: Schema.optionalKey(Schema.String),
52
+ imageSrc: Schema.optionalKey(Schema.String),
53
+ icon: Schema.optionalKey(Icon)
42
54
  }).annotate({ identifier: "VirtualizedComboboxOption" });
43
55
  var VirtualizedComboboxLabelsSchema = Schema.Struct({
44
56
  clear: Schema.optionalKey(Schema.String),
@@ -63,6 +75,8 @@ var htmlFields = {
63
75
  emptyLabel: Schema.String,
64
76
  placeholder: Schema.String,
65
77
  triggerLabel: Schema.optionalKey(Schema.String),
78
+ triggerIcon: Schema.optionalKey(Icon),
79
+ itemHeight: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
66
80
  filter: Schema.optionalKey(Schema.Literals(["contains", "none"])),
67
81
  messages: Schema.optionalKey(Schema.Record(Schema.String, Schema.Struct({
68
82
  ...VirtualizedComboboxLabelsSchema.fields,
@@ -154,7 +168,8 @@ var VirtualizedComboboxEvents = UiSchema.TaggedEnum(events).annotate({
154
168
  });
155
169
  var VirtualizedComboboxMessage = UiSchema.TaggedEnum({
156
170
  ...events,
157
- Highlighted: { value: Schema2.String }
171
+ Highlighted: { value: Schema2.String },
172
+ ImageFailed: { src: Schema2.String }
158
173
  }).annotate({ identifier: "VirtualizedComboboxMessage" });
159
174
  var virtualizedComboboxOptions = {
160
175
  name: "VirtualizedCombobox",
@@ -162,6 +177,7 @@ var virtualizedComboboxOptions = {
162
177
  model: Schema2.Struct({
163
178
  open: Schema2.Boolean,
164
179
  searchValue: Schema2.String,
180
+ failedImages: Schema2.Array(Schema2.String),
165
181
  highlight: Schema2.NullOr(Schema2.Struct({ value: Schema2.String, id: Schema2.Int }))
166
182
  }).annotate({ identifier: "VirtualizedComboboxModel" }),
167
183
  message: VirtualizedComboboxMessage,
@@ -181,15 +197,20 @@ var update = Component.define(virtualizedComboboxOptions).update({
181
197
  ValueChanged: ($, { value }) => $.set($.model).emit(VirtualizedComboboxEvents.ValueChanged({ value })),
182
198
  Highlighted: ($, { value }) => $.evolve({
183
199
  highlight: { value, id: ($.model.highlight?.id ?? 0) + 1 }
184
- })
200
+ }),
201
+ ImageFailed: ($, { src }) => $.model.failedImages.includes(src) ? $.model : $.evolve({ failedImages: [...$.model.failedImages, src] })
185
202
  });
186
203
  var virtualizedComboboxBehaviours = {
187
- init: () => ({ open: false, searchValue: "", highlight: null }),
204
+ init: () => ({
205
+ open: false,
206
+ searchValue: "",
207
+ highlight: null,
208
+ failedImages: []
209
+ }),
188
210
  update
189
211
  };
190
212
 
191
213
  // ../../src/components/virtualized-combobox/html.ts
192
- var rowHeight = 36;
193
214
  var visibleRows = 8;
194
215
  var itemKey = (value) => `item:${value}`;
195
216
  var VirtualizedCombobox = Html.component({
@@ -200,6 +221,8 @@ var VirtualizedCombobox = Html.component({
200
221
  view: (h, model) => {
201
222
  const virtualizedComboboxClasses = resolveVirtualizedComboboxClasses(h.props.classes);
202
223
  const props = h.props;
224
+ const optionsByValue = new Map(props.items.map((item) => [item.value, item]));
225
+ const rowHeight = props.itemHeight ?? (props.items.some(({ description, imageSrc, icon }) => description || imageSrc || icon) ? virtualizedComboboxDetailHeight : 36);
203
226
  const locale = props.locale ?? h.reads.localeConfig?.locale ?? "en";
204
227
  const labels = virtualizedComboboxMessages(locale, props.messages);
205
228
  const value = props.multiple ? props.value.map((item) => item.value) : props.value?.value ?? null;
@@ -208,7 +231,7 @@ var VirtualizedCombobox = Html.component({
208
231
  props: {
209
232
  open: props.open ?? model.open,
210
233
  inputValue: props.searchValue ?? model.searchValue,
211
- items: props.items,
234
+ items: props.items.map(({ value, label }) => ({ value, label })),
212
235
  value,
213
236
  locale,
214
237
  multiple: props.multiple,
@@ -235,14 +258,14 @@ var VirtualizedCombobox = Html.component({
235
258
  const entries = selectionEntries(combo.items, selected, props.multiple === true, labels);
236
259
  const keys = entries.map((entry) => entry.kind === "group" ? `group:${entry.key}` : itemKey(entry.item.value));
237
260
  const highlight = model.highlight && keys.includes(itemKey(model.highlight.value)) ? model.highlight : undefined;
238
- return h.div.class("relative min-w-0").children(ComboboxButton(h, combo, {
261
+ 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, {
239
262
  class: "w-full min-w-0 aria-invalid:border-destructive",
240
263
  value: props.triggerLabel ?? selectedLabel(props.value, props.placeholder),
241
264
  valueClass: selected.size > 0 ? "pr-7" : undefined
242
- }).attrs({
265
+ })).attrs({
243
266
  "aria-label": props.ariaLabel,
244
267
  "aria-invalid": props.ariaInvalid ? "true" : undefined
245
- }), selected.size > 0 && ComboboxClear(h, combo, {
268
+ }), !props.triggerIcon && selected.size > 0 && ComboboxClear(h, combo, {
246
269
  class: "absolute right-7 top-1/2 -translate-y-1/2"
247
270
  })?.attrs({ "aria-label": labels.clear, tabindex: "0" }), ComboboxPositioner(h, combo, {
248
271
  class: "overflow-visible border-0 bg-transparent p-0 text-inherit"
@@ -252,6 +275,7 @@ var VirtualizedCombobox = Html.component({
252
275
  props: {
253
276
  count: entries.length,
254
277
  itemSize: rowHeight,
278
+ sizes: entries.some(({ kind }) => kind === "group") ? entries.map(({ kind }) => kind === "group" ? virtualizedComboboxGroupHeight : rowHeight) : undefined,
255
279
  measure: false,
256
280
  keys,
257
281
  initialCount: visibleRows,
@@ -262,16 +286,18 @@ var VirtualizedCombobox = Html.component({
262
286
  align: "nearest"
263
287
  }
264
288
  },
265
- 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) => {
289
+ 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) => {
266
290
  const entry = entries[index];
267
291
  const element = h.div.key(keys[index]);
268
292
  if (entry.kind === "group") {
269
293
  return list.item({
270
294
  element: element.attr("role", "presentation"),
271
295
  index
272
- }).class("text-muted-foreground px-2 pt-3 text-xs").children(entry.label);
296
+ }).class("px-1").children(h.div.class(virtualizedComboboxClasses.groupLabel).children(entry.label));
273
297
  }
274
298
  const { value, label } = entry.item;
299
+ const details = optionsByValue.get(value);
300
+ const image = details?.imageSrc && !model.failedImages.includes(details.imageSrc) ? details.imageSrc : undefined;
275
301
  return list.item({
276
302
  element: element.attr("role", "presentation"),
277
303
  index
@@ -281,7 +307,15 @@ var VirtualizedCombobox = Html.component({
281
307
  }).attrs({
282
308
  "aria-posinset": String(entry.index + 1),
283
309
  "aria-setsize": String(combo.items.length)
284
- }).children(h.span.class(virtualizedComboboxClasses.itemLabel).children(label), ComboboxItemIndicator(h, combo, { value })));
310
+ }).children(h.span.class(virtualizedComboboxClasses.itemContent).children((image || details?.icon) && h.span.attr("aria-hidden", "true").class(virtualizedComboboxClasses.itemMedia).children(image ? h.img.attrs({
311
+ src: image,
312
+ alt: "",
313
+ loading: "lazy"
314
+ }).class(virtualizedComboboxClasses.itemImage).on("error", VirtualizedComboboxMessage.ImageFailed({
315
+ src: image
316
+ })) : details?.icon?.(h, {
317
+ size: 16
318
+ })), 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 })));
285
319
  })))
286
320
  }))));
287
321
  }
@@ -16,7 +16,8 @@ import {
16
16
  useCallback,
17
17
  useEffect,
18
18
  useImperativeHandle,
19
- useRef
19
+ useRef,
20
+ useState
20
21
  } from "react";
21
22
  import { Button } from "@/components/ui/button";
22
23
  import { InputGroup, InputGroupInput } from "@/components/ui/input-group";
@@ -29,8 +30,15 @@ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/reac
29
30
 
30
31
  // ../../src/components/virtualized-combobox/classes.ts
31
32
  var virtualizedComboboxClasses = {
32
- itemLabel: "min-w-0 truncate"
33
+ itemLabel: "min-w-0 truncate",
34
+ groupLabel: "text-muted-foreground px-2 pt-3 pb-1 text-start text-xs",
35
+ itemContent: "flex min-w-0 flex-1 items-center gap-2 text-start",
36
+ itemMedia: "bg-muted grid size-8 shrink-0 place-items-center overflow-hidden rounded-md [&_svg]:size-4",
37
+ itemImage: "size-full object-cover",
38
+ itemDescription: "text-muted-foreground block truncate text-xs"
33
39
  };
40
+ var virtualizedComboboxGroupHeight = 36;
41
+ var virtualizedComboboxDetailHeight = 52;
34
42
  var resolveVirtualizedComboboxClasses = (overrides) => ({
35
43
  ...virtualizedComboboxClasses,
36
44
  ...overrides
@@ -41,10 +49,14 @@ import { Schema as Schema2 } from "effect";
41
49
  import { Component, UiSchema } from "effect/ui";
42
50
 
43
51
  // ../../src/components/virtualized-combobox/schema.ts
44
- import { Schema, Struct } from "effect";
52
+ import { Predicate, Schema, Struct } from "effect";
53
+ var Icon = Schema.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "VirtualizedComboboxIcon" });
45
54
  var VirtualizedComboboxOptionSchema = Schema.Struct({
46
55
  value: Schema.String.pipe(Schema.mutableKey),
47
- label: Schema.String.pipe(Schema.mutableKey)
56
+ label: Schema.String.pipe(Schema.mutableKey),
57
+ description: Schema.optionalKey(Schema.String),
58
+ imageSrc: Schema.optionalKey(Schema.String),
59
+ icon: Schema.optionalKey(Icon)
48
60
  }).annotate({ identifier: "VirtualizedComboboxOption" });
49
61
  var VirtualizedComboboxLabelsSchema = Schema.Struct({
50
62
  clear: Schema.optionalKey(Schema.String),
@@ -69,6 +81,8 @@ var htmlFields = {
69
81
  emptyLabel: Schema.String,
70
82
  placeholder: Schema.String,
71
83
  triggerLabel: Schema.optionalKey(Schema.String),
84
+ triggerIcon: Schema.optionalKey(Icon),
85
+ itemHeight: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
72
86
  filter: Schema.optionalKey(Schema.Literals(["contains", "none"])),
73
87
  messages: Schema.optionalKey(Schema.Record(Schema.String, Schema.Struct({
74
88
  ...VirtualizedComboboxLabelsSchema.fields,
@@ -158,7 +172,8 @@ var VirtualizedComboboxEvents = UiSchema.TaggedEnum(events).annotate({
158
172
  });
159
173
  var VirtualizedComboboxMessage = UiSchema.TaggedEnum({
160
174
  ...events,
161
- Highlighted: { value: Schema2.String }
175
+ Highlighted: { value: Schema2.String },
176
+ ImageFailed: { src: Schema2.String }
162
177
  }).annotate({ identifier: "VirtualizedComboboxMessage" });
163
178
  var virtualizedComboboxOptions = {
164
179
  name: "VirtualizedCombobox",
@@ -166,6 +181,7 @@ var virtualizedComboboxOptions = {
166
181
  model: Schema2.Struct({
167
182
  open: Schema2.Boolean,
168
183
  searchValue: Schema2.String,
184
+ failedImages: Schema2.Array(Schema2.String),
169
185
  highlight: Schema2.NullOr(Schema2.Struct({ value: Schema2.String, id: Schema2.Int }))
170
186
  }).annotate({ identifier: "VirtualizedComboboxModel" }),
171
187
  message: VirtualizedComboboxMessage,
@@ -185,17 +201,24 @@ var update = Component.define(virtualizedComboboxOptions).update({
185
201
  ValueChanged: ($, { value }) => $.set($.model).emit(VirtualizedComboboxEvents.ValueChanged({ value })),
186
202
  Highlighted: ($, { value }) => $.evolve({
187
203
  highlight: { value, id: ($.model.highlight?.id ?? 0) + 1 }
188
- })
204
+ }),
205
+ ImageFailed: ($, { src }) => $.model.failedImages.includes(src) ? $.model : $.evolve({ failedImages: [...$.model.failedImages, src] })
189
206
  });
190
207
 
191
208
  // ../../src/components/virtualized-combobox/react.tsx
192
209
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
193
210
  "use client";
194
211
  var optionEquals = (item, selected) => item.value === selected.value;
212
+ var hasOptionDetails = ({
213
+ description,
214
+ imageSrc,
215
+ icon
216
+ }) => Boolean(description || imageSrc || icon);
195
217
  var VirtualizedComboboxList = ({
196
218
  classes,
197
219
  emptyLabel,
198
220
  groupSelections,
221
+ itemHeight,
199
222
  itemIndexRef,
200
223
  locale = "en",
201
224
  messages: messageOverrides,
@@ -208,6 +231,8 @@ var VirtualizedComboboxList = ({
208
231
  const labels = virtualizedComboboxMessages(locale, messageOverrides);
209
232
  const entries = selectionEntries(filteredItems, selectedValues, groupSelections, labels);
210
233
  const scrollRef = useRef(null);
234
+ const [failedImages, setFailedImages] = useState(() => new Set);
235
+ const rowHeight = itemHeight ?? (filteredItems.some(hasOptionDetails) ? virtualizedComboboxDetailHeight : 36);
211
236
  const virtualizer = useVirtualizer({
212
237
  count: entries.length,
213
238
  getScrollElement: () => scrollRef.current,
@@ -215,7 +240,7 @@ var VirtualizedComboboxList = ({
215
240
  const entry = entries[index];
216
241
  return entry?.kind === "group" ? `group-${entry.key}` : entry?.item.value ?? index;
217
242
  },
218
- estimateSize: () => 36,
243
+ estimateSize: (index) => entries[index]?.kind === "group" ? virtualizedComboboxGroupHeight : rowHeight,
219
244
  overscan: 8
220
245
  });
221
246
  useEffect(() => {
@@ -257,7 +282,7 @@ var VirtualizedComboboxList = ({
257
282
  return /* @__PURE__ */ jsx(ComboboxPrimitive.Group, {
258
283
  className: "contents",
259
284
  children: /* @__PURE__ */ jsx(ComboboxPrimitive.GroupLabel, {
260
- className: "text-muted-foreground absolute top-0 left-0 w-full px-2 pt-3 pb-1 text-xs",
285
+ className: `absolute top-0 left-0 w-full ${virtualizedComboboxClasses.groupLabel}`,
261
286
  "data-index": virtualItem.index,
262
287
  ref: virtualizer.measureElement,
263
288
  style,
@@ -265,6 +290,8 @@ var VirtualizedComboboxList = ({
265
290
  })
266
291
  }, entry.key);
267
292
  }
293
+ const details = entry.item;
294
+ const image = details.imageSrc && !failedImages.has(details.imageSrc) ? details.imageSrc : undefined;
268
295
  return /* @__PURE__ */ jsxs(ComboboxPrimitive.Item, {
269
296
  "aria-posinset": entry.index + 1,
270
297
  "aria-setsize": filteredItems.length,
@@ -275,10 +302,38 @@ var VirtualizedComboboxList = ({
275
302
  style,
276
303
  value: entry.item,
277
304
  children: [
278
- renderItem?.(entry.item) ?? /* @__PURE__ */ jsx("span", {
305
+ renderItem?.(entry.item) ?? (hasOptionDetails(details) ? /* @__PURE__ */ jsxs("span", {
306
+ className: virtualizedComboboxClasses.itemContent,
307
+ children: [
308
+ (image || details.icon) && /* @__PURE__ */ jsx("span", {
309
+ "aria-hidden": "true",
310
+ className: virtualizedComboboxClasses.itemMedia,
311
+ children: image ? /* @__PURE__ */ jsx("img", {
312
+ src: image,
313
+ alt: "",
314
+ loading: "lazy",
315
+ onError: () => setFailedImages((failed) => new Set(failed).add(image)),
316
+ className: virtualizedComboboxClasses.itemImage
317
+ }) : details.icon
318
+ }),
319
+ /* @__PURE__ */ jsxs("span", {
320
+ className: "min-w-0 flex-1",
321
+ children: [
322
+ /* @__PURE__ */ jsx("span", {
323
+ className: cn("block", virtualizedComboboxClasses.itemLabel),
324
+ children: entry.item.label
325
+ }),
326
+ details.description && /* @__PURE__ */ jsx("span", {
327
+ className: virtualizedComboboxClasses.itemDescription,
328
+ children: details.description
329
+ })
330
+ ]
331
+ })
332
+ ]
333
+ }) : /* @__PURE__ */ jsx("span", {
279
334
  className: virtualizedComboboxClasses.itemLabel,
280
335
  children: entry.item.label
281
- }),
336
+ })),
282
337
  /* @__PURE__ */ jsx(ComboboxPrimitive.ItemIndicator, {
283
338
  className: "absolute right-2 flex size-4 items-center justify-center",
284
339
  children: /* @__PURE__ */ jsx(Check, {})
@@ -296,6 +351,7 @@ var VirtualizedComboboxContent = ({
296
351
  contentClassName,
297
352
  emptyLabel,
298
353
  groupSelections,
354
+ itemHeight,
299
355
  itemIndexRef,
300
356
  locale = "en",
301
357
  messages: messageOverrides,
@@ -327,6 +383,7 @@ var VirtualizedComboboxContent = ({
327
383
  classes,
328
384
  emptyLabel,
329
385
  groupSelections,
386
+ itemHeight,
330
387
  itemIndexRef,
331
388
  locale,
332
389
  messages: messageOverrides,
@@ -28,9 +28,9 @@ export declare const presenceTransitionBehaviours: {
28
28
  init: ($: Component.Init<{
29
29
  readonly retained: boolean;
30
30
  }, {
31
- readonly _tag: "Opened";
32
- } | {
33
31
  readonly _tag: "Exited";
32
+ } | {
33
+ readonly _tag: "Opened";
34
34
  }, never, {
35
35
  readonly open: boolean;
36
36
  readonly duration?: number | undefined;
@@ -107,10 +107,10 @@ export declare const SearchMenu: import("effect/ui/Component").Component<"Search
107
107
  readonly open: boolean;
108
108
  readonly query: string;
109
109
  }, {
110
- readonly _tag: "Reset";
111
- } | {
112
110
  readonly _tag: "Picked";
113
111
  readonly id: string;
112
+ } | {
113
+ readonly _tag: "Reset";
114
114
  } | {
115
115
  readonly _tag: "SetOpen";
116
116
  readonly open: boolean;
@@ -1,7 +1,8 @@
1
1
  import { Schema } from "effect";
2
+ import { Component } from "effect/ui";
2
3
  import { Html } from "effect/ui/html";
3
4
  export type { SidebarPageHeaderProps, SidebarCollapsible } from "./schema.js";
4
- export declare const SidebarPageHeader: import("effect/ui/Component").Component<"SidebarPageHeader", {
5
+ export declare const SidebarPageHeader: Component.Component<"SidebarPageHeader", {
5
6
  readonly classes?: {
6
7
  readonly description?: string | undefined;
7
8
  readonly header?: string | undefined;
@@ -60,7 +61,7 @@ export type SidebarLayoutProps = typeof props.Type;
60
61
  export type NavGroup = typeof Group.Type;
61
62
  export type NavItem = typeof SidebarHtmlNavItem.Type;
62
63
  export declare const desktopSidebarQuery = "(min-width: 48rem)";
63
- export declare const SidebarLayout: import("effect/ui/Component").Component<"SidebarLayout", {
64
+ export declare const SidebarLayout: Component.Component<"SidebarLayout", {
64
65
  readonly classes?: {
65
66
  readonly content?: string | undefined;
66
67
  readonly desktopViewport?: string | undefined;