@krak-stack/registry 0.10.19 → 0.10.20

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 (46) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +18 -0
  3. package/dist/components/ui/code-block.js +7 -7
  4. package/dist/components/ui/copy-button.js +7 -7
  5. package/dist/components/ui/copy-value.js +7 -7
  6. package/dist/components/ui/data-table.d.ts +3 -3
  7. package/dist/components/ui/data-table.js +23 -17
  8. package/dist/components/ui/editing-locale-switcher.js +7 -7
  9. package/dist/components/ui/effect-form.js +8 -8
  10. package/dist/components/ui/email-composer.js +871 -0
  11. package/dist/components/ui/email-editor.d.ts +3 -1
  12. package/dist/components/ui/email-editor.js +294 -471
  13. package/dist/components/ui/error-component.js +7 -7
  14. package/dist/components/ui/form.d.ts +7 -7
  15. package/dist/components/ui/form.js +18 -14
  16. package/dist/components/ui/icon-input.js +1 -1
  17. package/dist/components/ui/map-menu.d.ts +1 -1
  18. package/dist/components/ui/map-menu.js +183 -60
  19. package/dist/components/ui/pagination.js +7 -7
  20. package/dist/components/ui/phone-number-input.js +1 -1
  21. package/dist/components/ui/rich-text-editor.d.ts +15 -13
  22. package/dist/components/ui/rich-text-editor.js +280 -661
  23. package/dist/components/ui/select-with-custom-input.js +7 -7
  24. package/dist/components/ui/select.js +159 -0
  25. package/dist/components/ui/timezone-select.js +1 -1
  26. package/dist/components/ui/virtualized-combobox.js +1 -1
  27. package/dist/lib/docs.js +7 -7
  28. package/dist/lib/email-composer/index.js +110 -0
  29. package/dist/lib/email-composer/schema.js +13 -0
  30. package/dist/lib/email-document/legacy-rich-text/editor.d.ts +70 -0
  31. package/dist/lib/email-document/legacy-rich-text/schema.d.ts +65 -0
  32. package/dist/lib/email-document/legacy-rich-text/tiptap.d.ts +39 -0
  33. package/dist/lib/email-document/model.d.ts +1 -1
  34. package/dist/lib/email-document/model.js +2 -2
  35. package/dist/lib/email-document/render.js +2 -2
  36. package/dist/lib/email-document/schema.js +1 -1
  37. package/dist/lib/rich-text/model.js +79 -111
  38. package/dist/lib/rich-text/schema.d.ts +5 -55
  39. package/dist/lib/rich-text/schema.js +17 -36
  40. package/dist/lib/rich-text/tiptap.d.ts +12 -0
  41. package/dist/services/agent/client/index.js +7 -7
  42. package/dist/services/events/client/audit-log-table.js +23 -17
  43. package/dist/services/webhooks/client/delivery-table.js +30 -24
  44. package/package.json +24 -1
  45. package/dist/lib/rich-text/dom.d.ts +0 -40
  46. /package/dist/lib/{rich-text → email-document/legacy-rich-text}/model.d.ts +0 -0
@@ -1,5 +1,6 @@
1
1
  // ../../src/lib/rich-text/model.ts
2
- import { Schema as Schema2 } from "effect";
2
+ import { getSchema, getText } from "@tiptap/core";
3
+ import { Schema as Schema3 } from "effect";
3
4
 
4
5
  // ../../src/lib/rich-text/schema.ts
5
6
  import { Schema } from "effect";
@@ -9,133 +10,100 @@ var RichTextLink = Schema.String.check(Schema.isMaxLength(2000), Schema.makeFilt
9
10
  const url = URL.parse(value);
10
11
  return url !== null && ["https:", "mailto:"].includes(url.protocol) && !url.username && !url.password;
11
12
  })).annotate({ identifier: "RichTextLink" });
12
- var RichTextMarks = Schema.Struct({
13
- bold: Schema.optional(Schema.Boolean),
14
- italic: Schema.optional(Schema.Boolean),
15
- underline: Schema.optional(Schema.Boolean),
16
- href: Schema.optional(RichTextLink)
17
- }).annotate({ identifier: "RichTextMarks" });
18
- var RichTextInline = Schema.Union([
19
- Schema.Struct({
20
- type: Schema.Literal("text"),
21
- text: Schema.String.check(Schema.isMaxLength(20000)),
22
- marks: Schema.optional(RichTextMarks)
23
- }),
24
- Schema.Struct({
25
- type: Schema.Literal("variable"),
26
- key: Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/)),
27
- marks: Schema.optional(RichTextMarks)
28
- })
29
- ]).annotate({ identifier: "RichTextInline" });
30
- var RichTextBlockKind = Schema.Literals([
31
- "paragraph",
32
- "heading",
33
- "bullet",
34
- "numbered"
35
- ]).annotate({ identifier: "RichTextBlockKind" });
36
- var RichTextDocument = Schema.Struct({
37
- version: Schema.Literal(1),
38
- blocks: Schema.Array(Schema.Struct({
39
- type: RichTextBlockKind,
40
- content: Schema.Array(RichTextInline).check(Schema.isMaxLength(2000))
41
- })).check(Schema.isMinLength(1), Schema.isMaxLength(100))
42
- }).check(Schema.makeFilter((value) => value.blocks.reduce((size, block) => size + block.content.reduce((count, inline) => count + (inline.type === "text" ? inline.text.length : 1), 0), 0) <= 20000)).annotate({ identifier: "RichTextDocument" });
13
+ var attributes = Schema.Record(Schema.String, Schema.Json);
14
+ var variableKey = Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/));
15
+ var mark = Schema.Struct({
16
+ type: Schema.String,
17
+ attrs: Schema.optional(attributes)
18
+ }).check(Schema.makeFilter((value) => value.type !== "link" || Schema.is(RichTextLink)(value.attrs?.href)));
19
+ var TiptapNode = Schema.Struct({
20
+ type: Schema.String,
21
+ attrs: Schema.optional(attributes),
22
+ content: Schema.optional(Schema.mutable(Schema.Array(Schema.suspend(() => TiptapNode)))),
23
+ marks: Schema.optional(Schema.mutable(Schema.Array(mark))),
24
+ text: Schema.optional(Schema.String)
25
+ }).check(Schema.makeFilter((node) => node.type !== "mention" || Schema.is(variableKey)(node.attrs?.id))).annotate({ identifier: "TiptapNode" });
26
+ var RichTextDocument = TiptapNode.check(Schema.makeFilter((node) => node.type === "doc")).annotate({ identifier: "TiptapDocument" });
43
27
  var RichTextVariable = Schema.Struct({
44
- key: Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/)),
28
+ key: variableKey,
45
29
  label: Schema.String,
46
30
  type: Schema.Literals(["text", "url"]),
47
31
  sample: Schema.String
48
32
  }).annotate({ identifier: "RichTextVariable" });
49
33
 
34
+ // ../../src/lib/rich-text/tiptap.ts
35
+ import { Extension } from "@tiptap/core";
36
+ import Mention from "@tiptap/extension-mention";
37
+ import StarterKit from "@tiptap/starter-kit";
38
+ import { Plugin } from "@tiptap/pm/state";
39
+ import { Schema as Schema2 } from "effect";
40
+ var richTextMention = (variables = () => []) => Mention.configure({
41
+ deleteTriggerWithBackspace: true,
42
+ HTMLAttributes: {
43
+ class: "rounded bg-primary/10 px-1 font-mono text-primary",
44
+ contenteditable: "false"
45
+ },
46
+ renderText: ({ node }) => `{{${node.attrs.id}}}`,
47
+ renderHTML: ({ node }) => {
48
+ const id = Schema2.decodeUnknownSync(RichTextVariable.fields.key)(node.attrs.id);
49
+ const label = variables().find((variable) => variable.key === id)?.label ?? node.attrs.label ?? id;
50
+ return [
51
+ "span",
52
+ {
53
+ "data-type": "mention",
54
+ "data-id": id,
55
+ contenteditable: "false",
56
+ class: "rounded bg-primary/10 px-1 font-mono text-primary"
57
+ },
58
+ `{{${label}}}`
59
+ ];
60
+ },
61
+ suggestion: { items: () => [] }
62
+ });
63
+ var richTextExtensions = ({
64
+ variables = () => []
65
+ } = {}) => [
66
+ StarterKit.configure({
67
+ link: {
68
+ openOnClick: false,
69
+ autolink: false,
70
+ linkOnPaste: false,
71
+ isAllowedUri: (url) => Schema2.is(RichTextLink)(url)
72
+ },
73
+ undoRedo: { depth: 100 },
74
+ heading: { levels: [1, 2, 3] }
75
+ }),
76
+ richTextMention(variables)
77
+ ];
78
+
50
79
  // ../../src/lib/rich-text/model.ts
51
- var sameMarks = Schema2.toEquivalence(RichTextMarks);
52
80
  var emptyRichText = () => ({
53
- version: 1,
54
- blocks: [{ type: "paragraph", content: [] }]
81
+ type: "doc",
82
+ content: [{ type: "paragraph" }]
55
83
  });
56
84
  var richTextFromString = (text) => ({
57
- version: 1,
58
- blocks: text.split(/\r\n?|\n/).map((line) => ({
85
+ type: "doc",
86
+ content: text.split(/\r\n?|\n/).map((line) => ({
59
87
  type: "paragraph",
60
88
  content: line ? [{ type: "text", text: line }] : []
61
89
  }))
62
90
  });
63
- var richTextPlainText = (value, variables) => value.blocks.map((block) => block.content.map((inline) => inline.type === "text" ? inline.text : variables?.[inline.key] ?? `{{${inline.key}}}`).join("")).join(`
64
- `);
65
- var richTextFromTemplate = (text) => ({
66
- version: 1,
67
- blocks: [{
68
- type: "paragraph",
69
- content: text.split(/(\{\{[a-zA-Z][a-zA-Z0-9_.]*\}\})/g).filter(Boolean).map((part) => /^\{\{[a-zA-Z][a-zA-Z0-9_.]*\}\}$/.test(part) ? { type: "variable", key: part.slice(2, -2) } : { type: "text", text: part })
70
- }]
71
- });
72
- var units = (value) => value.blocks.flatMap((block, index) => [
73
- ...index ? [{ type: "break", next: block.type }] : [],
74
- ...block.content.flatMap((inline) => inline.type === "text" ? inline.text.split("").map((text) => ({ ...inline, text })) : [inline])
75
- ]);
76
- var fromUnits = (content, first) => {
77
- const blocks = [{ type: first, content: [] }];
78
- for (const unit of content) {
79
- if (unit.type === "break") {
80
- blocks.push({ type: unit.next, content: [] });
81
- continue;
91
+ var richTextPlainText = (value, values) => {
92
+ const decoded = Schema3.decodeSync(RichTextDocument)(value);
93
+ const schema = getSchema(richTextExtensions());
94
+ return getText(schema.nodeFromJSON(decoded), {
95
+ blockSeparator: `
96
+ `,
97
+ textSerializers: {
98
+ mention: ({ node }) => {
99
+ const key = Schema3.decodeUnknownSync(RichTextVariable.fields.key)(node.attrs.id);
100
+ return values?.[key] ?? `{{${key}}}`;
101
+ }
82
102
  }
83
- const target = blocks.at(-1);
84
- if (!target)
85
- continue;
86
- const previous = target.content.at(-1);
87
- if (unit.type === "text" && previous?.type === "text" && sameMarks(previous.marks ?? {}, unit.marks ?? {})) {
88
- target.content[target.content.length - 1] = {
89
- ...previous,
90
- text: previous.text + unit.text
91
- };
92
- } else
93
- target.content.push(unit);
94
- }
95
- return { version: 1, blocks };
96
- };
97
- var replaceRichText = (value, selection, inserted) => {
98
- const content = units(value);
99
- const from = Math.max(0, Math.min(selection.from, content.length));
100
- const to = Math.max(from, Math.min(selection.to, content.length));
101
- const additions = inserted.type === "text" ? inserted.text.replace(/\r\n?/g, `
102
- `).split("").map((text) => text === `
103
- ` ? { type: "break", next: "paragraph" } : { type: "text", text, marks: inserted.marks }) : [inserted];
104
- const next = fromUnits([...content.slice(0, from), ...additions, ...content.slice(to)], value.blocks[0]?.type ?? "paragraph");
105
- const position = from + additions.length;
106
- return { value: next, selection: { from: position, to: position } };
107
- };
108
- var formatRichText = (value, selection, mark, setting) => fromUnits(units(value).map((unit, index) => {
109
- if (unit.type === "break" || index < selection.from || index >= selection.to)
110
- return unit;
111
- const marks = { ...unit.marks, [mark]: setting };
112
- return { ...unit, marks };
113
- }), value.blocks[0]?.type ?? "paragraph");
114
- var setRichTextBlock = (value, selection, type) => {
115
- let offset = 0;
116
- return {
117
- ...value,
118
- blocks: value.blocks.map((block) => {
119
- const start = offset;
120
- offset += block.content.reduce((size, inline) => size + (inline.type === "text" ? inline.text.length : 1), 0) + 1;
121
- return selection.from < offset && selection.to >= start ? { ...block, type } : block;
122
- })
123
- };
124
- };
125
- var richTextLength = (value) => units(value).length;
126
- var richTextMarksAt = (value, position) => {
127
- const content = units(value);
128
- const unit = content[Math.max(0, position - 1)];
129
- return unit && unit.type !== "break" ? unit.marks ?? {} : {};
103
+ });
130
104
  };
131
105
  export {
132
106
  emptyRichText,
133
- formatRichText,
134
- replaceRichText,
135
107
  richTextFromString,
136
- richTextFromTemplate,
137
- richTextLength,
138
- richTextMarksAt,
139
- richTextPlainText,
140
- setRichTextBlock
108
+ richTextPlainText
141
109
  };
@@ -1,64 +1,14 @@
1
1
  import { Schema } from "effect";
2
+ import type { JSONContent } from "@tiptap/core";
2
3
  export declare const RichTextLink: Schema.String;
3
- export declare const RichTextMarks: Schema.Struct<{
4
- readonly bold: Schema.optional<Schema.Boolean>;
5
- readonly italic: Schema.optional<Schema.Boolean>;
6
- readonly underline: Schema.optional<Schema.Boolean>;
7
- readonly href: Schema.optional<Schema.String>;
8
- }>;
9
- export declare const RichTextInline: Schema.Union<readonly [Schema.Struct<{
10
- readonly type: Schema.Literal<"text">;
11
- readonly text: Schema.String;
12
- readonly marks: Schema.optional<Schema.Struct<{
13
- readonly bold: Schema.optional<Schema.Boolean>;
14
- readonly italic: Schema.optional<Schema.Boolean>;
15
- readonly underline: Schema.optional<Schema.Boolean>;
16
- readonly href: Schema.optional<Schema.String>;
17
- }>>;
18
- }>, Schema.Struct<{
19
- readonly type: Schema.Literal<"variable">;
20
- readonly key: Schema.String;
21
- readonly marks: Schema.optional<Schema.Struct<{
22
- readonly bold: Schema.optional<Schema.Boolean>;
23
- readonly italic: Schema.optional<Schema.Boolean>;
24
- readonly underline: Schema.optional<Schema.Boolean>;
25
- readonly href: Schema.optional<Schema.String>;
26
- }>>;
27
- }>]>;
28
- export declare const RichTextBlockKind: Schema.Literals<readonly ["paragraph", "heading", "bullet", "numbered"]>;
29
- export declare const RichTextDocument: Schema.Struct<{
30
- readonly version: Schema.Literal<1>;
31
- readonly blocks: Schema.$Array<Schema.Struct<{
32
- readonly type: Schema.Literals<readonly ["paragraph", "heading", "bullet", "numbered"]>;
33
- readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
34
- readonly type: Schema.Literal<"text">;
35
- readonly text: Schema.String;
36
- readonly marks: Schema.optional<Schema.Struct<{
37
- readonly bold: Schema.optional<Schema.Boolean>;
38
- readonly italic: Schema.optional<Schema.Boolean>;
39
- readonly underline: Schema.optional<Schema.Boolean>;
40
- readonly href: Schema.optional<Schema.String>;
41
- }>>;
42
- }>, Schema.Struct<{
43
- readonly type: Schema.Literal<"variable">;
44
- readonly key: Schema.String;
45
- readonly marks: Schema.optional<Schema.Struct<{
46
- readonly bold: Schema.optional<Schema.Boolean>;
47
- readonly italic: Schema.optional<Schema.Boolean>;
48
- readonly underline: Schema.optional<Schema.Boolean>;
49
- readonly href: Schema.optional<Schema.String>;
50
- }>>;
51
- }>]>>;
52
- }>>;
53
- }>;
4
+ /** Validates Tiptap's own JSON shape. No KrakStack envelope or version field. */
5
+ export declare const TiptapNode: Schema.Codec<JSONContent>;
6
+ export declare const RichTextDocument: Schema.Codec<JSONContent, JSONContent, never, never>;
7
+ export type RichTextDocument = JSONContent;
54
8
  export declare const RichTextVariable: Schema.Struct<{
55
9
  readonly key: Schema.String;
56
10
  readonly label: Schema.String;
57
11
  readonly type: Schema.Literals<readonly ["text", "url"]>;
58
12
  readonly sample: Schema.String;
59
13
  }>;
60
- export type RichTextDocument = typeof RichTextDocument.Type;
61
- export type RichTextInline = typeof RichTextInline.Type;
62
- export type RichTextMarks = typeof RichTextMarks.Type;
63
- export type RichTextBlockKind = typeof RichTextBlockKind.Type;
64
14
  export type RichTextVariable = typeof RichTextVariable.Type;
@@ -6,48 +6,29 @@ var RichTextLink = Schema.String.check(Schema.isMaxLength(2000), Schema.makeFilt
6
6
  const url = URL.parse(value);
7
7
  return url !== null && ["https:", "mailto:"].includes(url.protocol) && !url.username && !url.password;
8
8
  })).annotate({ identifier: "RichTextLink" });
9
- var RichTextMarks = Schema.Struct({
10
- bold: Schema.optional(Schema.Boolean),
11
- italic: Schema.optional(Schema.Boolean),
12
- underline: Schema.optional(Schema.Boolean),
13
- href: Schema.optional(RichTextLink)
14
- }).annotate({ identifier: "RichTextMarks" });
15
- var RichTextInline = Schema.Union([
16
- Schema.Struct({
17
- type: Schema.Literal("text"),
18
- text: Schema.String.check(Schema.isMaxLength(20000)),
19
- marks: Schema.optional(RichTextMarks)
20
- }),
21
- Schema.Struct({
22
- type: Schema.Literal("variable"),
23
- key: Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/)),
24
- marks: Schema.optional(RichTextMarks)
25
- })
26
- ]).annotate({ identifier: "RichTextInline" });
27
- var RichTextBlockKind = Schema.Literals([
28
- "paragraph",
29
- "heading",
30
- "bullet",
31
- "numbered"
32
- ]).annotate({ identifier: "RichTextBlockKind" });
33
- var RichTextDocument = Schema.Struct({
34
- version: Schema.Literal(1),
35
- blocks: Schema.Array(Schema.Struct({
36
- type: RichTextBlockKind,
37
- content: Schema.Array(RichTextInline).check(Schema.isMaxLength(2000))
38
- })).check(Schema.isMinLength(1), Schema.isMaxLength(100))
39
- }).check(Schema.makeFilter((value) => value.blocks.reduce((size, block) => size + block.content.reduce((count, inline) => count + (inline.type === "text" ? inline.text.length : 1), 0), 0) <= 20000)).annotate({ identifier: "RichTextDocument" });
9
+ var attributes = Schema.Record(Schema.String, Schema.Json);
10
+ var variableKey = Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/));
11
+ var mark = Schema.Struct({
12
+ type: Schema.String,
13
+ attrs: Schema.optional(attributes)
14
+ }).check(Schema.makeFilter((value) => value.type !== "link" || Schema.is(RichTextLink)(value.attrs?.href)));
15
+ var TiptapNode = Schema.Struct({
16
+ type: Schema.String,
17
+ attrs: Schema.optional(attributes),
18
+ content: Schema.optional(Schema.mutable(Schema.Array(Schema.suspend(() => TiptapNode)))),
19
+ marks: Schema.optional(Schema.mutable(Schema.Array(mark))),
20
+ text: Schema.optional(Schema.String)
21
+ }).check(Schema.makeFilter((node) => node.type !== "mention" || Schema.is(variableKey)(node.attrs?.id))).annotate({ identifier: "TiptapNode" });
22
+ var RichTextDocument = TiptapNode.check(Schema.makeFilter((node) => node.type === "doc")).annotate({ identifier: "TiptapDocument" });
40
23
  var RichTextVariable = Schema.Struct({
41
- key: Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/)),
24
+ key: variableKey,
42
25
  label: Schema.String,
43
26
  type: Schema.Literals(["text", "url"]),
44
27
  sample: Schema.String
45
28
  }).annotate({ identifier: "RichTextVariable" });
46
29
  export {
47
- RichTextBlockKind,
48
30
  RichTextDocument,
49
- RichTextInline,
50
31
  RichTextLink,
51
- RichTextMarks,
52
- RichTextVariable
32
+ RichTextVariable,
33
+ TiptapNode
53
34
  };
@@ -0,0 +1,12 @@
1
+ import { Extension, type Extensions } from "@tiptap/core";
2
+ import { RichTextVariable } from "./schema.js";
3
+ export declare const richTextMention: (variables?: () => readonly RichTextVariable[]) => import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
4
+ /** Standard Tiptap nodes and marks; no custom block grammar or JSON conversion. */
5
+ export declare const richTextExtensions: ({ variables, }?: {
6
+ variables?: () => readonly RichTextVariable[];
7
+ }) => Extensions;
8
+ /** Reject unsafe boundary values and optional text limits without changing JSON. */
9
+ export declare const richTextValidation: ({ maxLength, onInvalid, }: {
10
+ maxLength: () => number | undefined;
11
+ onInvalid: (invalid: boolean) => void;
12
+ }) => Extension<any, any>;
@@ -256,16 +256,16 @@ function CopyButton({
256
256
  clearTimeout(copyTimeout.current);
257
257
  copyTimeout.current = setTimeout(() => setCopyState("idle"), resetDelay);
258
258
  };
259
- const copy = async () => {
260
- try {
261
- await navigator.clipboard.writeText(value);
259
+ const copy = () => {
260
+ Promise.resolve().then(() => navigator.clipboard.writeText(value)).then(() => {
262
261
  setCopyState("copied");
263
262
  onCopied?.();
264
- } catch (error) {
263
+ resetCopyState();
264
+ }).catch((cause) => {
265
265
  setCopyState("failed");
266
- onCopyError?.(error instanceof Error ? error : new Error(labels.copyFailed, { cause: error }));
267
- }
268
- resetCopyState();
266
+ onCopyError?.(cause instanceof Error ? cause : new Error(labels.copyFailed, { cause }));
267
+ resetCopyState();
268
+ });
269
269
  };
270
270
  const status = copyState === "copied" ? valueDescription ? `${labels.copied}: ${valueDescription}` : labels.copied : copyState === "failed" ? valueDescription ? `${labels.copyFailed}: ${valueDescription}` : labels.copyFailed : "";
271
271
  return /* @__PURE__ */ jsxs(Button, {
@@ -410,7 +410,7 @@ function SelectTrigger({
410
410
  return /* @__PURE__ */ jsxs3(SelectPrimitive.Trigger, {
411
411
  "data-slot": "select-trigger",
412
412
  "data-size": size,
413
- className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
413
+ className: cn("border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex w-fit items-center justify-between gap-1.5 rounded-md border bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
414
414
  ...props,
415
415
  children: [
416
416
  children,
@@ -427,9 +427,9 @@ function SelectContent({
427
427
  children,
428
428
  side = "bottom",
429
429
  sideOffset = 4,
430
- align = "center",
430
+ align = "start",
431
431
  alignOffset = 0,
432
- alignItemWithTrigger = true,
432
+ alignItemWithTrigger = false,
433
433
  ...props
434
434
  }) {
435
435
  return /* @__PURE__ */ jsx8(SelectPrimitive.Portal, {
@@ -443,7 +443,7 @@ function SelectContent({
443
443
  children: /* @__PURE__ */ jsxs3(SelectPrimitive.Popup, {
444
444
  "data-slot": "select-content",
445
445
  "data-align-trigger": alignItemWithTrigger,
446
- className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
446
+ className: cn("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-0 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md shadow-md ring-1 duration-100 data-[align-trigger=true]:animate-none", className),
447
447
  ...props,
448
448
  children: [
449
449
  /* @__PURE__ */ jsx8(SelectScrollUpButton, {}),
@@ -463,7 +463,7 @@ function SelectItem({
463
463
  }) {
464
464
  return /* @__PURE__ */ jsxs3(SelectPrimitive.Item, {
465
465
  "data-slot": "select-item",
466
- className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
466
+ className: cn("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
467
467
  ...props,
468
468
  children: [
469
469
  /* @__PURE__ */ jsx8(SelectPrimitive.ItemText, {
@@ -487,7 +487,7 @@ function SelectScrollUpButton({
487
487
  }) {
488
488
  return /* @__PURE__ */ jsx8(SelectPrimitive.ScrollUpArrow, {
489
489
  "data-slot": "select-scroll-up-button",
490
- className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
490
+ className: cn("bg-popover top-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4", className),
491
491
  ...props,
492
492
  children: /* @__PURE__ */ jsx8(ChevronUpIcon, {})
493
493
  });
@@ -498,7 +498,7 @@ function SelectScrollDownButton({
498
498
  }) {
499
499
  return /* @__PURE__ */ jsx8(SelectPrimitive.ScrollDownArrow, {
500
500
  "data-slot": "select-scroll-down-button",
501
- className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
501
+ className: cn("bg-popover bottom-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4", className),
502
502
  ...props,
503
503
  children: /* @__PURE__ */ jsx8(ChevronDownIcon, {})
504
504
  });
@@ -2139,7 +2139,7 @@ var DataTableToolbar = ({
2139
2139
  }
2140
2140
  };
2141
2141
  return /* @__PURE__ */ jsxs9("div", {
2142
- className: cn("grid min-w-0 items-center gap-2 pb-4", features.search !== false && "md:grid-cols-[minmax(12rem,1fr)_minmax(0,auto)]"),
2142
+ className: cn("grid min-w-0 shrink-0 items-center gap-2 pb-4", features.search !== false && "md:grid-cols-[minmax(12rem,1fr)_minmax(0,auto)]"),
2143
2143
  children: [
2144
2144
  features.search !== false ? /* @__PURE__ */ jsxs9("div", {
2145
2145
  className: "relative min-w-0",
@@ -2801,9 +2801,13 @@ var ViewMenu = ({
2801
2801
  }),
2802
2802
  /* @__PURE__ */ jsx15(MenubarSeparator2, {}),
2803
2803
  /* @__PURE__ */ jsxs9(MenubarRadioGroup, {
2804
- onValueChange: (view) => {
2805
- if (view === "table" || view === "gallery") {
2806
- changeState(setStore, (state) => ({ ...state, view }));
2804
+ onValueChange: (input) => {
2805
+ const view = Schema2.decodeUnknownOption(DataTablePersistedUiStateSchema.fields.view)(input);
2806
+ if (Option2.isSome(view)) {
2807
+ changeState(setStore, (state) => ({
2808
+ ...state,
2809
+ view: view.value
2810
+ }));
2807
2811
  }
2808
2812
  },
2809
2813
  value: store.state.view,
@@ -3952,7 +3956,7 @@ var DataTablePagination = ({
3952
3956
  const setPagination = (next) => changeState(setStore, (state) => ({ ...state, ...next }));
3953
3957
  return /* @__PURE__ */ jsx15("div", {
3954
3958
  "data-table-slot": "pagination",
3955
- className: cn("pt-4", styles?.pagination),
3959
+ className: cn("shrink-0 pt-4", styles?.pagination),
3956
3960
  children: /* @__PURE__ */ jsx15(Pagination, {
3957
3961
  pageSizeContentClassName: styles?.popup?.select,
3958
3962
  locale: store.config.locale,
@@ -3968,6 +3972,7 @@ var DataTablePagination = ({
3968
3972
  })
3969
3973
  });
3970
3974
  };
3975
+ var getTableLayoutClass = (virtualization) => virtualization && virtualization !== true && virtualization.scroll === "internal" ? "flex min-h-0 flex-1 flex-col" : undefined;
3971
3976
  var HydratedDataTable = ({
3972
3977
  persistedUiState,
3973
3978
  setPersistedUiState,
@@ -4049,7 +4054,7 @@ var HydratedDataTable = ({
4049
4054
  uiState
4050
4055
  ]);
4051
4056
  return /* @__PURE__ */ jsxs9("div", {
4052
- className: cn("w-full max-w-full min-w-0 rounded-md", props.className),
4057
+ className: cn("w-full max-w-full min-w-0 rounded-md", getTableLayoutClass(props.features?.virtualization), props.className),
4053
4058
  "data-table-root": "",
4054
4059
  children: [
4055
4060
  /* @__PURE__ */ jsx15(DataTableToolbar, {
@@ -4094,7 +4099,7 @@ var DataTable = (props) => {
4094
4099
  if (!persistedUiState || AsyncResult.isWaiting(persistedUiResult)) {
4095
4100
  return /* @__PURE__ */ jsx15("div", {
4096
4101
  "aria-busy": "true",
4097
- className: cn("invisible w-full max-w-full min-w-0 rounded-md", props.className),
4102
+ className: cn("invisible w-full max-w-full min-w-0 rounded-md", getTableLayoutClass(props.features?.virtualization), props.className),
4098
4103
  "data-table-root": ""
4099
4104
  });
4100
4105
  }
@@ -4191,15 +4196,16 @@ var DataTableContent = ({
4191
4196
  })
4192
4197
  });
4193
4198
  }
4199
+ const fillHeight = options.scroll === "internal";
4194
4200
  return /* @__PURE__ */ jsxs9(ScrollAreaPrimitive2.Root, {
4195
- className: "relative isolate max-w-full min-w-0",
4201
+ className: cn("relative isolate max-w-full min-w-0", fillHeight && "flex min-h-0 flex-1 flex-col"),
4196
4202
  children: [
4197
4203
  /* @__PURE__ */ jsx15(ScrollAreaPrimitive2.Viewport, {
4198
4204
  ref: setScrollElement,
4199
4205
  "data-table-virtual-viewport": "",
4200
- className: "@container [overflow-anchor:none] data-has-overflow-y:me-2.5 [&_[data-slot=table-container]]:overflow-visible",
4206
+ className: cn("@container [overflow-anchor:none] data-has-overflow-y:me-2.5 [&_[data-slot=table-container]]:overflow-visible", fillHeight && "min-h-0 flex-1"),
4201
4207
  style: {
4202
- maxHeight: options.height ?? 480,
4208
+ maxHeight: fillHeight ? undefined : options.height ?? 480,
4203
4209
  scrollPaddingTop: headerHeight
4204
4210
  },
4205
4211
  children: /* @__PURE__ */ jsx15(ScrollAreaPrimitive2.Content, {