@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.
- package/CHANGELOG.md +54 -0
- package/README.md +39 -0
- package/dist/components/app-switcher/html.d.ts +2 -2
- package/dist/components/asset-input/html.d.ts +70 -0
- package/dist/components/asset-input/html.js +1549 -0
- package/dist/components/asset-input/index.d.ts +280 -0
- package/dist/components/asset-input/react.d.ts +32 -0
- package/dist/components/asset-input/react.js +2269 -0
- package/dist/components/asset-input/schema.d.ts +93 -0
- package/dist/components/asset-input/upload.d.ts +15 -0
- package/dist/components/asset-table/html.d.ts +110 -0
- package/dist/components/asset-table/html.js +4934 -0
- package/dist/components/asset-table/index.d.ts +225 -0
- package/dist/components/asset-table/react.d.ts +21 -0
- package/dist/components/asset-table/react.js +8241 -0
- package/dist/components/asset-table/schema.d.ts +73 -0
- package/dist/components/audit-log-table/html.js +47 -13
- package/dist/components/audit-log-table/react.js +36 -12
- package/dist/components/copy-button/html.d.ts +2 -2
- package/dist/components/danger-confirmation/html.d.ts +2 -2
- package/dist/components/data-table/classes.d.ts +2 -0
- package/dist/components/data-table/html.d.ts +58 -0
- package/dist/components/data-table/html.js +47 -13
- package/dist/components/data-table/index.d.ts +51 -1
- package/dist/components/data-table/react.d.ts +1 -0
- package/dist/components/data-table/react.js +36 -12
- package/dist/components/data-table/schema.d.ts +93 -3
- package/dist/components/date-input/html.d.ts +2 -2
- package/dist/components/docs/html.js +22 -4
- package/dist/components/docs/react.js +33 -2
- package/dist/components/editable-text/html.d.ts +2 -2
- package/dist/components/editing-locale-switcher/html.d.ts +2 -2
- package/dist/components/effect-form/react.js +343 -138
- package/dist/components/file-input/classes.d.ts +1 -1
- package/dist/components/file-input/file-type.d.ts +1 -0
- package/dist/components/file-input/html.d.ts +8 -1
- package/dist/components/file-input/html.js +170 -12
- package/dist/components/file-input/index.d.ts +1 -0
- package/dist/components/file-input/react.d.ts +9 -1
- package/dist/components/file-input/react.js +277 -127
- package/dist/components/file-input/schema.d.ts +1 -0
- package/dist/components/form/react.d.ts +5 -5
- package/dist/components/form/react.js +343 -138
- package/dist/components/icon-input/html.js +19 -5
- package/dist/components/icon-input/react.js +70 -13
- package/dist/components/locale-switcher/html.d.ts +2 -2
- package/dist/components/map-menu/html.d.ts +10 -4
- package/dist/components/map-menu/html.js +13 -8
- package/dist/components/map-menu/index.d.ts +5 -4
- package/dist/components/map-menu/react.d.ts +28 -17
- package/dist/components/map-menu/react.js +84 -178
- package/dist/components/map-menu/schema.d.ts +6 -0
- package/dist/components/map-menu/shared.d.ts +4 -0
- package/dist/components/permissions-input/classes.d.ts +8 -0
- package/dist/components/permissions-input/html.d.ts +41 -0
- package/dist/components/permissions-input/html.js +130 -0
- package/dist/components/permissions-input/index.d.ts +80 -0
- package/dist/components/permissions-input/react.d.ts +7 -0
- package/dist/components/permissions-input/react.js +201 -0
- package/dist/components/permissions-input/schema.d.ts +33 -0
- package/dist/components/phone-number-input/html.js +48 -14
- package/dist/components/phone-number-input/react.js +67 -10
- package/dist/components/presence-transition/index.d.ts +2 -2
- package/dist/components/search-menu/html.d.ts +2 -2
- package/dist/components/sidebar-layout/html.d.ts +3 -2
- package/dist/components/sidebar-layout/html.js +20 -2
- package/dist/components/sidebar-layout/index.d.ts +1 -0
- package/dist/components/sidebar-layout/react.js +33 -2
- package/dist/components/time-input/html.d.ts +2 -2
- package/dist/components/timezone-input/html.js +48 -14
- package/dist/components/timezone-input/react.js +67 -10
- package/dist/components/tracking-notice/html.d.ts +4 -4
- package/dist/components/tracking-notice/index.d.ts +2 -2
- package/dist/components/upload-attachment/classes.d.ts +3 -2
- package/dist/components/upload-attachment/html.d.ts +1 -1
- package/dist/components/upload-attachment/html.js +7 -5
- package/dist/components/upload-attachment/react.d.ts +3 -1
- package/dist/components/upload-attachment/react.js +25 -17
- package/dist/components/virtualized-combobox/classes.d.ts +12 -0
- package/dist/components/virtualized-combobox/html.d.ts +45 -3
- package/dist/components/virtualized-combobox/html.js +48 -14
- package/dist/components/virtualized-combobox/index.d.ts +55 -4
- package/dist/components/virtualized-combobox/react.d.ts +6 -2
- package/dist/components/virtualized-combobox/react.js +67 -10
- package/dist/components/virtualized-combobox/schema.d.ts +60 -4
- package/dist/components/webhook-delivery-table/html.js +47 -13
- package/dist/components/webhook-delivery-table/react.js +36 -12
- package/dist/lib/access/index.d.ts +61 -0
- package/dist/lib/access/index.js +92 -0
- package/dist/lib/access/table/classes.d.ts +13 -0
- package/dist/lib/access/table/html.d.ts +39 -0
- package/dist/lib/access/table/html.js +157 -0
- package/dist/lib/access/table/index.d.ts +32 -0
- package/dist/lib/access/table/react.d.ts +3 -0
- package/dist/lib/access/table/react.js +195 -0
- package/dist/lib/access/table/schema.d.ts +43 -0
- package/dist/lib/docs.integrations.server.js +23 -1
- package/dist/lib/docs.js +33 -2
- package/dist/lib/docs.server.js +29 -2
- package/dist/lib/documentation-toolkit.js +23 -1
- package/dist/lib/effect-ui-adapter/use-model.d.ts +1 -1
- package/dist/lib/effect-ui-adapter/use-model.js +19 -11
- package/dist/lib/lucide-effect.d.ts +19 -19
- package/dist/lib/lucide-effect.js +38 -38
- package/dist/services/assets/library.d.ts +221 -0
- package/dist/services/assets/schema.d.ts +3 -0
- package/dist/services/assets/url.d.ts +12 -0
- package/dist/services/assets/use-library.d.ts +20 -0
- package/package.json +13 -1
|
@@ -20,10 +20,11 @@ import { Button } from "@/components/ui/button";
|
|
|
20
20
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
21
21
|
|
|
22
22
|
// ../../src/components/upload-attachment/classes.ts
|
|
23
|
+
var uploadAttachmentStatusRowClass = "mt-1 flex items-center gap-2";
|
|
23
24
|
var uploadAttachmentClasses = {
|
|
24
25
|
pendingIcon: "motion-safe:animate-spin",
|
|
25
|
-
status: "text-muted-foreground
|
|
26
|
-
progress: "accent-primary
|
|
26
|
+
status: "text-muted-foreground text-xs",
|
|
27
|
+
progress: "accent-primary h-1.5 min-w-0 flex-1 overflow-hidden rounded-full [&:not(:indeterminate)]:appearance-none [&:not(:indeterminate)]:bg-muted [&::-webkit-progress-bar]:bg-muted [&::-webkit-progress-value]:rounded-full [&::-webkit-progress-value]:bg-primary [&::-moz-progress-bar]:rounded-full [&::-moz-progress-bar]:bg-primary"
|
|
27
28
|
};
|
|
28
29
|
var resolveUploadAttachmentClasses = (overrides) => ({
|
|
29
30
|
...uploadAttachmentClasses,
|
|
@@ -147,6 +148,7 @@ var UploadAttachment = ({
|
|
|
147
148
|
classes: classOverrides,
|
|
148
149
|
name,
|
|
149
150
|
description,
|
|
151
|
+
fileIcon,
|
|
150
152
|
state,
|
|
151
153
|
disabled,
|
|
152
154
|
onCancel,
|
|
@@ -167,7 +169,7 @@ var UploadAttachment = ({
|
|
|
167
169
|
"aria-labelledby": `${id}-name`,
|
|
168
170
|
children: [
|
|
169
171
|
/* @__PURE__ */ jsx(AttachmentMedia, {
|
|
170
|
-
children: state.status === "done" ? /* @__PURE__ */ jsx(Check, {
|
|
172
|
+
children: fileIcon ?? (state.status === "done" ? /* @__PURE__ */ jsx(Check, {
|
|
171
173
|
"aria-hidden": "true"
|
|
172
174
|
}) : state.status === "error" ? /* @__PURE__ */ jsx(TriangleAlert, {
|
|
173
175
|
"aria-hidden": "true"
|
|
@@ -176,30 +178,36 @@ var UploadAttachment = ({
|
|
|
176
178
|
className: uploadAttachmentClasses.pendingIcon
|
|
177
179
|
}) : /* @__PURE__ */ jsx(File, {
|
|
178
180
|
"aria-hidden": "true"
|
|
179
|
-
})
|
|
181
|
+
}))
|
|
180
182
|
}),
|
|
181
183
|
/* @__PURE__ */ jsxs(AttachmentContent, {
|
|
182
184
|
children: [
|
|
183
185
|
/* @__PURE__ */ jsx(AttachmentTitle, {
|
|
184
186
|
id: `${id}-name`,
|
|
187
|
+
title: name,
|
|
185
188
|
children: name
|
|
186
189
|
}),
|
|
187
190
|
description ? /* @__PURE__ */ jsx(AttachmentDescription, {
|
|
188
191
|
children: description
|
|
189
192
|
}) : null,
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
193
|
+
/* @__PURE__ */ jsxs("div", {
|
|
194
|
+
className: uploadAttachmentStatusRowClass,
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ jsx("p", {
|
|
197
|
+
"data-slot": "upload-attachment-status",
|
|
198
|
+
role: state.status === "error" ? "alert" : "status",
|
|
199
|
+
className: uploadAttachmentClasses.status,
|
|
200
|
+
children: status
|
|
201
|
+
}),
|
|
202
|
+
state.status === "uploading" ? /* @__PURE__ */ jsx("progress", {
|
|
203
|
+
"data-slot": "upload-attachment-progress",
|
|
204
|
+
className: uploadAttachmentClasses.progress,
|
|
205
|
+
"aria-label": `${copy.uploading}: ${name}`,
|
|
206
|
+
max: 100,
|
|
207
|
+
value: progress
|
|
208
|
+
}) : null
|
|
209
|
+
]
|
|
210
|
+
})
|
|
203
211
|
]
|
|
204
212
|
}),
|
|
205
213
|
/* @__PURE__ */ jsxs(AttachmentActions, {
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import type { VirtualizedComboboxClassesOverrides } from "./schema.js";
|
|
2
2
|
export declare const virtualizedComboboxClasses: {
|
|
3
3
|
readonly itemLabel: "min-w-0 truncate";
|
|
4
|
+
readonly groupLabel: "text-muted-foreground px-2 pt-3 pb-1 text-start text-xs";
|
|
5
|
+
readonly itemContent: "flex min-w-0 flex-1 items-center gap-2 text-start";
|
|
6
|
+
readonly itemMedia: "bg-muted grid size-8 shrink-0 place-items-center overflow-hidden rounded-md [&_svg]:size-4";
|
|
7
|
+
readonly itemImage: "size-full object-cover";
|
|
8
|
+
readonly itemDescription: "text-muted-foreground block truncate text-xs";
|
|
4
9
|
};
|
|
10
|
+
export declare const virtualizedComboboxGroupHeight = 36;
|
|
11
|
+
export declare const virtualizedComboboxDetailHeight = 52;
|
|
5
12
|
export declare const resolveVirtualizedComboboxClasses: (overrides?: VirtualizedComboboxClassesOverrides) => {
|
|
6
13
|
itemLabel: string;
|
|
14
|
+
groupLabel: string;
|
|
15
|
+
itemContent: string;
|
|
16
|
+
itemMedia: string;
|
|
17
|
+
itemImage: string;
|
|
18
|
+
itemDescription: string;
|
|
7
19
|
};
|
|
@@ -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,15 +98,27 @@ 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;
|
|
75
114
|
} | null;
|
|
76
115
|
}, {
|
|
116
|
+
readonly _tag: "Highlighted";
|
|
117
|
+
readonly value: string;
|
|
118
|
+
} | {
|
|
119
|
+
readonly _tag: "ImageFailed";
|
|
120
|
+
readonly src: string;
|
|
121
|
+
} | {
|
|
77
122
|
readonly _tag: "OpenChanged";
|
|
78
123
|
readonly open: boolean;
|
|
79
124
|
} | {
|
|
@@ -82,9 +127,6 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
|
|
|
82
127
|
} | {
|
|
83
128
|
readonly _tag: "ValueChanged";
|
|
84
129
|
readonly value: string | readonly string[] | null;
|
|
85
|
-
} | {
|
|
86
|
-
readonly _tag: "Highlighted";
|
|
87
|
-
readonly value: string;
|
|
88
130
|
}, {
|
|
89
131
|
readonly _tag: "OpenChanged";
|
|
90
132
|
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: () => ({
|
|
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("
|
|
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.
|
|
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
|
|
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: <
|
|
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
|
|
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;
|