@krak-stack/registry 0.11.6 → 0.11.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -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/classes.d.ts +1 -0
- package/dist/components/audit-log-table/html.d.ts +158 -0
- package/dist/components/audit-log-table/html.js +3294 -0
- package/dist/components/audit-log-table/index.d.ts +37 -0
- package/dist/components/audit-log-table/react.d.ts +3 -51
- package/dist/components/audit-log-table/react.js +130 -89
- package/dist/components/audit-log-table/schema.d.ts +122 -0
- package/dist/components/danger-confirmation/html.d.ts +2 -2
- package/dist/components/danger-confirmation/index.d.ts +2 -2
- package/dist/components/data-table/classes.d.ts +3 -0
- package/dist/components/data-table/html.d.ts +70 -12
- package/dist/components/data-table/html.js +56 -19
- 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 +46 -16
- package/dist/components/data-table/schema.d.ts +93 -3
- 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/editable-text/index.d.ts +4 -4
- package/dist/components/effect-form/react.js +343 -138
- package/dist/components/email-editor/legacy-editor.html.d.ts +6 -6
- 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.js +343 -138
- package/dist/components/icon-input/html.js +19 -5
- package/dist/components/icon-input/react.js +70 -13
- package/dist/components/map-menu/html.d.ts +6 -0
- 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/search-menu/html.d.ts +2 -2
- package/dist/components/select-with-custom-input/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/switch/react.d.ts +14 -0
- package/dist/components/switch/react.js +55 -0
- package/dist/components/theme-switcher/html.d.ts +2 -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/classes.d.ts +6 -0
- package/dist/components/tracking-notice/html.d.ts +85 -0
- package/dist/components/tracking-notice/html.js +354 -0
- package/dist/components/tracking-notice/index.d.ts +95 -0
- package/dist/components/tracking-notice/react.d.ts +5 -27
- package/dist/components/tracking-notice/react.js +189 -59
- package/dist/components/tracking-notice/schema.d.ts +45 -0
- package/dist/components/upload-attachment/classes.d.ts +3 -2
- package/dist/components/upload-attachment/html.d.ts +5 -5
- 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 +42 -0
- 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 +56 -19
- package/dist/components/webhook-delivery-table/react.js +46 -16
- 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/dist/services/events/browser.js +39 -26
- package/dist/services/events/index.js +23 -19
- package/dist/services/opentelemetry/web-vitals.js +27 -23
- package/package.json +21 -1
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
import type { View } from "effect/ui";
|
|
3
|
+
import type { Html } from "effect/ui/html";
|
|
2
4
|
export declare const VirtualizedComboboxOptionSchema: Schema.Struct<{
|
|
3
5
|
readonly value: Schema.mutableKey<Schema.String>;
|
|
4
6
|
readonly label: Schema.mutableKey<Schema.String>;
|
|
7
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
8
|
+
readonly imageSrc: Schema.optionalKey<Schema.String>;
|
|
9
|
+
readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: Html.H<Msg>, options: {
|
|
10
|
+
size: number;
|
|
11
|
+
}) => View.Input<Msg, never>, <Msg>(h: Html.H<Msg>, options: {
|
|
12
|
+
size: number;
|
|
13
|
+
}) => View.Input<Msg, never>>>;
|
|
5
14
|
}>;
|
|
6
15
|
export type VirtualizedComboboxOption<TData = never> = typeof VirtualizedComboboxOptionSchema.Type & {
|
|
7
16
|
data?: TData;
|
|
@@ -11,10 +20,10 @@ export declare const VirtualizedComboboxLabelsSchema: Schema.Struct<{
|
|
|
11
20
|
readonly search: Schema.optionalKey<Schema.String>;
|
|
12
21
|
readonly selectMore: Schema.optionalKey<Schema.String>;
|
|
13
22
|
}>;
|
|
14
|
-
declare const VirtualizedComboboxClassesOverridesSchema: Schema.$Record<Schema.Literals<"itemLabel"[]>, Schema.optionalKey<Schema.String>>;
|
|
23
|
+
declare const VirtualizedComboboxClassesOverridesSchema: Schema.$Record<Schema.Literals<("groupLabel" | "itemContent" | "itemDescription" | "itemImage" | "itemLabel" | "itemMedia")[]>, Schema.optionalKey<Schema.String>>;
|
|
15
24
|
export type VirtualizedComboboxClassesOverrides = typeof VirtualizedComboboxClassesOverridesSchema.Type;
|
|
16
25
|
export declare const VirtualizedComboboxSharedPropsSchema: Schema.Struct<{
|
|
17
|
-
readonly classes: Schema.optional<Schema.$Record<Schema.Literals<"itemLabel"[]>, Schema.optionalKey<Schema.String>>>;
|
|
26
|
+
readonly classes: Schema.optional<Schema.$Record<Schema.Literals<("groupLabel" | "itemContent" | "itemDescription" | "itemImage" | "itemLabel" | "itemMedia")[]>, Schema.optionalKey<Schema.String>>>;
|
|
18
27
|
readonly ariaLabel: Schema.String;
|
|
19
28
|
readonly ariaInvalid: Schema.optionalKey<Schema.Boolean>;
|
|
20
29
|
readonly contentClassName: Schema.optionalKey<Schema.String>;
|
|
@@ -22,6 +31,13 @@ export declare const VirtualizedComboboxSharedPropsSchema: Schema.Struct<{
|
|
|
22
31
|
readonly items: Schema.$Array<Schema.Struct<{
|
|
23
32
|
readonly value: Schema.mutableKey<Schema.String>;
|
|
24
33
|
readonly label: Schema.mutableKey<Schema.String>;
|
|
34
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
35
|
+
readonly imageSrc: Schema.optionalKey<Schema.String>;
|
|
36
|
+
readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: Html.H<Msg>, options: {
|
|
37
|
+
size: number;
|
|
38
|
+
}) => View.Input<Msg, never>, <Msg>(h: Html.H<Msg>, options: {
|
|
39
|
+
size: number;
|
|
40
|
+
}) => View.Input<Msg, never>>>;
|
|
25
41
|
}>>;
|
|
26
42
|
readonly locale: Schema.optionalKey<Schema.String>;
|
|
27
43
|
readonly open: Schema.optionalKey<Schema.Boolean>;
|
|
@@ -30,7 +46,7 @@ export declare const VirtualizedComboboxSharedPropsSchema: Schema.Struct<{
|
|
|
30
46
|
}>;
|
|
31
47
|
export type VirtualizedComboboxSharedProps = typeof VirtualizedComboboxSharedPropsSchema.Type;
|
|
32
48
|
export declare const VirtualizedComboboxPropsSchema: Schema.Union<readonly [Schema.Struct<{
|
|
33
|
-
readonly classes: Schema.optional<Schema.$Record<Schema.Literals<"itemLabel"[]>, Schema.optionalKey<Schema.String>>>;
|
|
49
|
+
readonly classes: Schema.optional<Schema.$Record<Schema.Literals<("groupLabel" | "itemContent" | "itemDescription" | "itemImage" | "itemLabel" | "itemMedia")[]>, Schema.optionalKey<Schema.String>>>;
|
|
34
50
|
readonly ariaLabel: Schema.String;
|
|
35
51
|
readonly ariaInvalid: Schema.optionalKey<Schema.Boolean>;
|
|
36
52
|
readonly contentClassName: Schema.optionalKey<Schema.String>;
|
|
@@ -38,6 +54,13 @@ export declare const VirtualizedComboboxPropsSchema: Schema.Union<readonly [Sche
|
|
|
38
54
|
readonly items: Schema.$Array<Schema.Struct<{
|
|
39
55
|
readonly value: Schema.mutableKey<Schema.String>;
|
|
40
56
|
readonly label: Schema.mutableKey<Schema.String>;
|
|
57
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
58
|
+
readonly imageSrc: Schema.optionalKey<Schema.String>;
|
|
59
|
+
readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: Html.H<Msg>, options: {
|
|
60
|
+
size: number;
|
|
61
|
+
}) => View.Input<Msg, never>, <Msg>(h: Html.H<Msg>, options: {
|
|
62
|
+
size: number;
|
|
63
|
+
}) => View.Input<Msg, never>>>;
|
|
41
64
|
}>>;
|
|
42
65
|
readonly locale: Schema.optionalKey<Schema.String>;
|
|
43
66
|
readonly open: Schema.optionalKey<Schema.Boolean>;
|
|
@@ -46,6 +69,12 @@ export declare const VirtualizedComboboxPropsSchema: Schema.Union<readonly [Sche
|
|
|
46
69
|
readonly emptyLabel: Schema.String;
|
|
47
70
|
readonly placeholder: Schema.String;
|
|
48
71
|
readonly triggerLabel: Schema.optionalKey<Schema.String>;
|
|
72
|
+
readonly triggerIcon: Schema.optionalKey<Schema.declare<<Msg>(h: Html.H<Msg>, options: {
|
|
73
|
+
size: number;
|
|
74
|
+
}) => View.Input<Msg, never>, <Msg>(h: Html.H<Msg>, options: {
|
|
75
|
+
size: number;
|
|
76
|
+
}) => View.Input<Msg, never>>>;
|
|
77
|
+
readonly itemHeight: Schema.optionalKey<Schema.Int>;
|
|
49
78
|
readonly filter: Schema.optionalKey<Schema.Literals<readonly ["contains", "none"]>>;
|
|
50
79
|
readonly messages: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
|
|
51
80
|
readonly clear: Schema.optionalKey<Schema.String>;
|
|
@@ -57,9 +86,16 @@ export declare const VirtualizedComboboxPropsSchema: Schema.Union<readonly [Sche
|
|
|
57
86
|
readonly value: Schema.NullOr<Schema.Struct<{
|
|
58
87
|
readonly value: Schema.mutableKey<Schema.String>;
|
|
59
88
|
readonly label: Schema.mutableKey<Schema.String>;
|
|
89
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
90
|
+
readonly imageSrc: Schema.optionalKey<Schema.String>;
|
|
91
|
+
readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: Html.H<Msg>, options: {
|
|
92
|
+
size: number;
|
|
93
|
+
}) => View.Input<Msg, never>, <Msg>(h: Html.H<Msg>, options: {
|
|
94
|
+
size: number;
|
|
95
|
+
}) => View.Input<Msg, never>>>;
|
|
60
96
|
}>>;
|
|
61
97
|
}>, Schema.Struct<{
|
|
62
|
-
readonly classes: Schema.optional<Schema.$Record<Schema.Literals<"itemLabel"[]>, Schema.optionalKey<Schema.String>>>;
|
|
98
|
+
readonly classes: Schema.optional<Schema.$Record<Schema.Literals<("groupLabel" | "itemContent" | "itemDescription" | "itemImage" | "itemLabel" | "itemMedia")[]>, Schema.optionalKey<Schema.String>>>;
|
|
63
99
|
readonly ariaLabel: Schema.String;
|
|
64
100
|
readonly ariaInvalid: Schema.optionalKey<Schema.Boolean>;
|
|
65
101
|
readonly contentClassName: Schema.optionalKey<Schema.String>;
|
|
@@ -67,6 +103,13 @@ export declare const VirtualizedComboboxPropsSchema: Schema.Union<readonly [Sche
|
|
|
67
103
|
readonly items: Schema.$Array<Schema.Struct<{
|
|
68
104
|
readonly value: Schema.mutableKey<Schema.String>;
|
|
69
105
|
readonly label: Schema.mutableKey<Schema.String>;
|
|
106
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
107
|
+
readonly imageSrc: Schema.optionalKey<Schema.String>;
|
|
108
|
+
readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: Html.H<Msg>, options: {
|
|
109
|
+
size: number;
|
|
110
|
+
}) => View.Input<Msg, never>, <Msg>(h: Html.H<Msg>, options: {
|
|
111
|
+
size: number;
|
|
112
|
+
}) => View.Input<Msg, never>>>;
|
|
70
113
|
}>>;
|
|
71
114
|
readonly locale: Schema.optionalKey<Schema.String>;
|
|
72
115
|
readonly open: Schema.optionalKey<Schema.Boolean>;
|
|
@@ -75,6 +118,12 @@ export declare const VirtualizedComboboxPropsSchema: Schema.Union<readonly [Sche
|
|
|
75
118
|
readonly emptyLabel: Schema.String;
|
|
76
119
|
readonly placeholder: Schema.String;
|
|
77
120
|
readonly triggerLabel: Schema.optionalKey<Schema.String>;
|
|
121
|
+
readonly triggerIcon: Schema.optionalKey<Schema.declare<<Msg>(h: Html.H<Msg>, options: {
|
|
122
|
+
size: number;
|
|
123
|
+
}) => View.Input<Msg, never>, <Msg>(h: Html.H<Msg>, options: {
|
|
124
|
+
size: number;
|
|
125
|
+
}) => View.Input<Msg, never>>>;
|
|
126
|
+
readonly itemHeight: Schema.optionalKey<Schema.Int>;
|
|
78
127
|
readonly filter: Schema.optionalKey<Schema.Literals<readonly ["contains", "none"]>>;
|
|
79
128
|
readonly messages: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
|
|
80
129
|
readonly clear: Schema.optionalKey<Schema.String>;
|
|
@@ -86,6 +135,13 @@ export declare const VirtualizedComboboxPropsSchema: Schema.Union<readonly [Sche
|
|
|
86
135
|
readonly value: Schema.$Array<Schema.Struct<{
|
|
87
136
|
readonly value: Schema.mutableKey<Schema.String>;
|
|
88
137
|
readonly label: Schema.mutableKey<Schema.String>;
|
|
138
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
139
|
+
readonly imageSrc: Schema.optionalKey<Schema.String>;
|
|
140
|
+
readonly icon: Schema.optionalKey<Schema.declare<<Msg>(h: Html.H<Msg>, options: {
|
|
141
|
+
size: number;
|
|
142
|
+
}) => View.Input<Msg, never>, <Msg>(h: Html.H<Msg>, options: {
|
|
143
|
+
size: number;
|
|
144
|
+
}) => View.Input<Msg, never>>>;
|
|
89
145
|
}>>;
|
|
90
146
|
}>]>;
|
|
91
147
|
export type VirtualizedComboboxProps = typeof VirtualizedComboboxPropsSchema.Type;
|
|
@@ -493,6 +493,7 @@ var tableClasses = {
|
|
|
493
493
|
actionTrigger: `size-8 ${cellTriggerFocus}`,
|
|
494
494
|
actionsCell: "sticky right-0 z-20 w-10 min-w-10 cursor-default bg-background p-0 transition-colors group-hover/row:bg-[color-mix(in_oklab,var(--muted)_50%,var(--background))]",
|
|
495
495
|
actionsAlign: "flex min-h-12 items-center justify-end pe-1",
|
|
496
|
+
row: "h-16 [&:where(:not(:last-child))>td]:border-b",
|
|
496
497
|
header: "relative h-12 p-0",
|
|
497
498
|
stickyHeader: "sticky top-0 z-30 bg-background",
|
|
498
499
|
stickyHeaderRule: "after:border-border after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:border-b",
|
|
@@ -510,6 +511,7 @@ var tableClasses = {
|
|
|
510
511
|
referenceName: "truncate font-medium",
|
|
511
512
|
referenceDescription: "text-muted-foreground truncate text-xs"
|
|
512
513
|
};
|
|
514
|
+
var tableResultsFooterClass = "bg-background text-muted-foreground sticky bottom-0 z-30 shrink-0 border-t px-2 py-2 text-sm";
|
|
513
515
|
var resolveTableClasses = (overrides) => ({
|
|
514
516
|
...tableClasses,
|
|
515
517
|
...overrides
|
|
@@ -558,6 +560,7 @@ var DataTableItemSchema = Schema4.Struct({
|
|
|
558
560
|
value: Schema4.NonEmptyString,
|
|
559
561
|
label: Schema4.String
|
|
560
562
|
}).annotate({ identifier: "DataTableItem" });
|
|
563
|
+
var TableIconSchema = Schema4.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "DataTableIcon" });
|
|
561
564
|
var DataTableReferenceSchema = Schema4.Struct({
|
|
562
565
|
label: Schema4.String,
|
|
563
566
|
description: Schema4.optionalKey(Schema4.String),
|
|
@@ -597,11 +600,15 @@ var DataTableActionSchema = Schema4.Struct({
|
|
|
597
600
|
variant: Schema4.optionalKey(Schema4.Literals(["default", "destructive"])),
|
|
598
601
|
disabled: Schema4.optionalKey(Schema4.Boolean)
|
|
599
602
|
}).annotate({ identifier: "DataTableAction" });
|
|
603
|
+
var DataTableRowActionSchema = Schema4.Struct({
|
|
604
|
+
...DataTableActionSchema.fields,
|
|
605
|
+
icon: Schema4.optionalKey(TableIconSchema)
|
|
606
|
+
}).annotate({ identifier: "DataTableRowAction" });
|
|
600
607
|
var DataTableRowSchema = Schema4.Struct({
|
|
601
608
|
id: Schema4.NonEmptyString,
|
|
602
609
|
label: Schema4.String,
|
|
603
610
|
cells: Schema4.Record(Schema4.String, DataTableCellValueSchema),
|
|
604
|
-
actions: Schema4.optionalKey(Schema4.Array(
|
|
611
|
+
actions: Schema4.optionalKey(Schema4.Array(DataTableRowActionSchema)),
|
|
605
612
|
primaryActionId: Schema4.optionalKey(Schema4.String),
|
|
606
613
|
groups: Schema4.optionalKey(Schema4.Record(Schema4.String, Schema4.Array(Schema4.String))),
|
|
607
614
|
selectable: Schema4.optionalKey(Schema4.Boolean),
|
|
@@ -636,11 +643,10 @@ var DataTableBadgeOptionSchema = Schema4.Struct({
|
|
|
636
643
|
"muted"
|
|
637
644
|
]))
|
|
638
645
|
}).annotate({ identifier: "DataTableBadgeOption" });
|
|
639
|
-
var BadgeIcon = Schema4.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "DataTableBadgeIcon" });
|
|
640
646
|
var DataTableBadgeOptionsSchema = Schema4.Struct({
|
|
641
647
|
options: Schema4.optionalKey(Schema4.Array(DataTableBadgeOptionSchema.mapFields((fields) => ({
|
|
642
648
|
...fields,
|
|
643
|
-
icon: Schema4.optionalKey(
|
|
649
|
+
icon: Schema4.optionalKey(TableIconSchema)
|
|
644
650
|
}))))
|
|
645
651
|
}).annotate({ identifier: "DataTableBadgeOptions" });
|
|
646
652
|
var DataTableFieldSchema = Schema4.Union([
|
|
@@ -655,6 +661,7 @@ var DataTableFieldSchema = Schema4.Union([
|
|
|
655
661
|
type: Schema4.Literal("number"),
|
|
656
662
|
typeOptions: Schema4.optionalKey(Schema4.Struct({
|
|
657
663
|
locale: Schema4.optionalKey(Schema4.String),
|
|
664
|
+
format: Schema4.optionalKey(Schema4.Literal("bytes")),
|
|
658
665
|
style: Schema4.optionalKey(Schema4.Literals(["decimal", "percent", "currency", "unit"])),
|
|
659
666
|
currency: Schema4.optionalKey(Schema4.String),
|
|
660
667
|
unit: Schema4.optionalKey(Schema4.String),
|
|
@@ -664,7 +671,14 @@ var DataTableFieldSchema = Schema4.Union([
|
|
|
664
671
|
exportFormat: Schema4.optionalKey(Schema4.Literals(["raw", "formatted"]))
|
|
665
672
|
}).annotate({ identifier: "DataTableNumberFormat" }))
|
|
666
673
|
}),
|
|
667
|
-
Schema4.Struct({
|
|
674
|
+
Schema4.Struct({
|
|
675
|
+
...column,
|
|
676
|
+
type: Schema4.Literal("reference"),
|
|
677
|
+
typeOptions: Schema4.optionalKey(Schema4.Struct({
|
|
678
|
+
imageVariant: Schema4.optionalKey(Schema4.Literals(["circle", "square"])),
|
|
679
|
+
fallbackIcons: Schema4.optionalKey(Schema4.Record(Schema4.String, TableIconSchema))
|
|
680
|
+
}).annotate({ identifier: "DataTableReferenceOptions" }))
|
|
681
|
+
}),
|
|
668
682
|
Schema4.Struct({
|
|
669
683
|
...column,
|
|
670
684
|
type: Schema4.Literal("date"),
|
|
@@ -951,9 +965,17 @@ var isTableBoolean = Schema5.is(Schema5.Boolean);
|
|
|
951
965
|
var isTableReference = Schema5.is(DataTableReferenceSchema);
|
|
952
966
|
var isTableList = Schema5.is(Schema5.Array(DataTableItemSchema));
|
|
953
967
|
var tableInitials = (label) => label.trim().split(/\s+/).slice(0, 2).map((word) => word.slice(0, 1)).join("").toLocaleUpperCase();
|
|
968
|
+
var formatBytes = (bytes, locale) => {
|
|
969
|
+
const [unit, scale] = bytes >= 1024 ** 2 ? ["megabyte", 1024 ** 2] : bytes >= 1024 ? ["kilobyte", 1024] : ["byte", 1];
|
|
970
|
+
return new Intl.NumberFormat(locale, {
|
|
971
|
+
style: "unit",
|
|
972
|
+
unit,
|
|
973
|
+
maximumFractionDigits: 1
|
|
974
|
+
}).format(bytes / scale);
|
|
975
|
+
};
|
|
954
976
|
var formatNumberValue = (value, options, defaultLocale = "en") => {
|
|
955
|
-
const { locale,
|
|
956
|
-
return new Intl.NumberFormat(locale ?? defaultLocale,
|
|
977
|
+
const { locale, format, ...intlOptions } = options ?? {};
|
|
978
|
+
return format === "bytes" ? formatBytes(value, locale ?? defaultLocale) : new Intl.NumberFormat(locale ?? defaultLocale, intlOptions).format(value);
|
|
957
979
|
};
|
|
958
980
|
var tableBooleanLabel = (value, options) => (value ? options?.trueLabel : options?.falseLabel) ?? String(value);
|
|
959
981
|
var decodeDateInput = Schema5.decodeUnknownOption(DataTableDateInputSchema);
|
|
@@ -2001,7 +2023,9 @@ var DataTable = Html2.component({
|
|
|
2001
2023
|
const dropOnRow = (rowId, group) => group ? DataTableMessage.GroupDropped(group) : reorder ? DataTableMessage.DragDropped({ targetId: rowId }) : undefined;
|
|
2002
2024
|
const rowActions = reorder || props.rowData.some(({ actions }) => actions?.length);
|
|
2003
2025
|
const span = Math.max(1, columns.length + Number(!!selection) + Number(rowActions) + Number(draggable));
|
|
2004
|
-
const
|
|
2026
|
+
const virtualization = features.virtualization;
|
|
2027
|
+
const fillHeight = virtualization && virtualization !== true && virtualization.scroll === "internal";
|
|
2028
|
+
const virtual = tableVirtualization(rows.length, virtualization, !grouping.length && !gallery && !features.reordering && props.status?.error === undefined && rows.length > 0);
|
|
2005
2029
|
const ids = rows.filter(({ selectable }) => selectable !== false).map(({ id }) => id);
|
|
2006
2030
|
const selectedHere = ids.filter((id) => selected.has(id)).length;
|
|
2007
2031
|
const status = props.status;
|
|
@@ -2090,6 +2114,7 @@ var DataTable = Html2.component({
|
|
|
2090
2114
|
filterColumnId,
|
|
2091
2115
|
childSearch,
|
|
2092
2116
|
icon,
|
|
2117
|
+
rowIcon,
|
|
2093
2118
|
separatorBefore
|
|
2094
2119
|
}) => {
|
|
2095
2120
|
if (children || filterEditor) {
|
|
@@ -2162,7 +2187,7 @@ var DataTable = Html2.component({
|
|
|
2162
2187
|
value: id,
|
|
2163
2188
|
closeOnClick: !searchLabel
|
|
2164
2189
|
});
|
|
2165
|
-
const content = part.children(checked !== undefined && h.span.attr("aria-hidden", "true").class("w-3").children(checked ? "✓" : ""), indicator(icon), name);
|
|
2190
|
+
const content = part.children(rowIcon?.(h, { size: 16, className: "shrink-0" }), checked !== undefined && h.span.attr("aria-hidden", "true").class("w-3").children(checked ? "✓" : ""), indicator(icon), name);
|
|
2166
2191
|
return separatorBefore ? h.div.children(MenuSeparator(h, menu), content) : content;
|
|
2167
2192
|
})))));
|
|
2168
2193
|
}
|
|
@@ -2279,12 +2304,18 @@ var DataTable = Html2.component({
|
|
|
2279
2304
|
}
|
|
2280
2305
|
case "boolean":
|
|
2281
2306
|
return isTableBoolean(value) ? h.label.attr("data-slot", "data-table-boolean-cell").class(cn(booleanCellControl, column.editable && !disabled && "hover:bg-muted/50 cursor-pointer")).children(check(keyOf("edit", row.id, column.id), `${column.headerName}: ${row.label}`, value, (value) => edit(DataTableEdit.SetBoolean({ value })), { readOnly: !column.editable || disabled }, true)) : empty;
|
|
2282
|
-
case "reference":
|
|
2283
|
-
|
|
2284
|
-
|
|
2307
|
+
case "reference": {
|
|
2308
|
+
if (!isTableReference(value))
|
|
2309
|
+
return empty;
|
|
2310
|
+
const image = value.imageSrc && !model.failedImages.includes(value.imageSrc) ? value.imageSrc : undefined;
|
|
2311
|
+
const fallbackIcons = column.typeOptions?.fallbackIcons;
|
|
2312
|
+
const fallbackIcon = fallbackIcons && Object.hasOwn(fallbackIcons, row.id) ? fallbackIcons[row.id] : undefined;
|
|
2313
|
+
return h.div.class(tableClasses.reference).children(h.span.class(cn(tableClasses.referenceAvatar, column.typeOptions?.imageVariant === "square" ? "rounded-md" : "rounded-full")).children((!image || !fallbackIcon) && h.span.attr("aria-hidden", "true").children(fallbackIcon?.(h, { size: 16 }) ?? tableInitials(value.label)), image && h.img.attrs({
|
|
2314
|
+
src: image,
|
|
2285
2315
|
alt: "",
|
|
2286
2316
|
loading: "lazy"
|
|
2287
|
-
}).class("absolute inset-0 size-full object-cover").on("error", DataTableMessage.ReferenceImageFailed({ src:
|
|
2317
|
+
}).class("absolute inset-0 size-full object-cover").on("error", DataTableMessage.ReferenceImageFailed({ src: image }))), h.div.class(tableClasses.referenceText).children(h.span.class(tableClasses.referenceName).attr("title", value.label).children(value.label), value.description && h.span.class(tableClasses.referenceDescription).children(value.description)));
|
|
2318
|
+
}
|
|
2288
2319
|
case "list": {
|
|
2289
2320
|
const current = isTableList(value) ? value : [];
|
|
2290
2321
|
const visible = current.slice(0, column.visibleCount ?? 3);
|
|
@@ -2371,13 +2402,19 @@ var DataTable = Html2.component({
|
|
|
2371
2402
|
};
|
|
2372
2403
|
const dragHandle = (row) => draggable && h.span.attr("aria-hidden", "true").class("inline-flex size-8 cursor-grab items-center justify-center text-muted-foreground").draggable({ [RowDrag]: row.id }, { effectAllowed: "move" }).on("dragstart", DataTableMessage.DragStarted({ rowId: row.id })).on("dragend", DataTableMessage.DragEnded()).children(GripVertical(h, { size: 16 }));
|
|
2373
2404
|
const rowControls = (row, siblings, key) => {
|
|
2374
|
-
const items = tableRowActions(row, siblings, reorder, copy)
|
|
2405
|
+
const items = tableRowActions(row, siblings, reorder, copy).map((item) => {
|
|
2406
|
+
if ("icon" in item) {
|
|
2407
|
+
const { icon, ...action } = item;
|
|
2408
|
+
return { ...action, rowIcon: icon };
|
|
2409
|
+
}
|
|
2410
|
+
return { ...item, icon: undefined };
|
|
2411
|
+
});
|
|
2375
2412
|
return items.length > 0 && menu(keyOf("row", key, row.id), copy.actions, `${copy.actions}: ${row.label}`, items, false, undefined, false, "actions");
|
|
2376
2413
|
};
|
|
2377
2414
|
const renderRow = (row, siblings, key, group) => {
|
|
2378
2415
|
const primary = row.actions?.find(({ id, disabled }) => id === row.primaryActionId && !disabled);
|
|
2379
2416
|
const activate = props.rowActivation ? DataTableMessage.RowActivated({ rowId: row.id }) : primary && DataTableMessage.RowActionRequested({ rowId: row.id, actionId: primary.id });
|
|
2380
|
-
const tr = h.tr.key(keyOf(key, row.id)).class(cn("group/row hover:bg-muted/50 data-[selected]:bg-muted/40
|
|
2417
|
+
const tr = h.tr.key(keyOf(key, row.id)).class(cn("group/row hover:bg-muted/50 data-[selected]:bg-muted/40", tableClasses.row, props.rowActivation && "cursor-pointer")).attr("data-selected", selected.has(row.id) ? "" : undefined);
|
|
2381
2418
|
const rowElement = props.rowActivation && activate ? tr.attr("tabindex", "0").on("click", activate).on("keydown", (event) => !event.repeat && !event.composing && (event.key === "Enter" || event.key === " ") ? activate : undefined, { preventDefault: true }) : tr;
|
|
2382
2419
|
const ignoreActivation = () => {
|
|
2383
2420
|
return;
|
|
@@ -2452,7 +2489,7 @@ var DataTable = Html2.component({
|
|
|
2452
2489
|
];
|
|
2453
2490
|
});
|
|
2454
2491
|
};
|
|
2455
|
-
return h.section.class(cn("
|
|
2492
|
+
return h.section.class(cn("min-w-0 gap-2", fillHeight ? "flex min-h-0 flex-1 flex-col" : "grid", props.className)).onMount(PersistPreferences({
|
|
2456
2493
|
columns: props.columnDefs.map(({ id }) => id),
|
|
2457
2494
|
gallery: !!features.gallery,
|
|
2458
2495
|
preferences: tablePreferences(model)
|
|
@@ -2686,7 +2723,7 @@ var DataTable = Html2.component({
|
|
|
2686
2723
|
] : [];
|
|
2687
2724
|
}) : renderGroups(rows, 0, "")));
|
|
2688
2725
|
};
|
|
2689
|
-
const viewport = () => h.div.class("@container overflow-auto");
|
|
2726
|
+
const viewport = () => h.div.class(cn("@container overflow-auto", fillHeight && "min-h-0 flex-1"));
|
|
2690
2727
|
if (!virtual)
|
|
2691
2728
|
return viewport().children(renderTable());
|
|
2692
2729
|
return VirtualList(h, {
|
|
@@ -2698,11 +2735,11 @@ var DataTable = Html2.component({
|
|
|
2698
2735
|
overscan: virtual.overscan,
|
|
2699
2736
|
initialCount: virtual.initialCount
|
|
2700
2737
|
},
|
|
2701
|
-
view: (list) => virtual.scroll === "page" ? h.div.children(renderTable(list)) : list.viewport(viewport().style({
|
|
2738
|
+
view: (list) => virtual.scroll === "page" ? h.div.children(renderTable(list)) : list.viewport(fillHeight ? viewport() : viewport().style({
|
|
2702
2739
|
maxHeight: `${virtual.height}px`
|
|
2703
2740
|
})).children(renderTable(list))
|
|
2704
2741
|
});
|
|
2705
|
-
})(), paginationVisible
|
|
2742
|
+
})(), paginationVisible ? Pagination(h, {
|
|
2706
2743
|
props: {
|
|
2707
2744
|
locale,
|
|
2708
2745
|
page,
|
|
@@ -2716,7 +2753,7 @@ var DataTable = Html2.component({
|
|
|
2716
2753
|
PageChanged: ({ page }) => DataTableMessage.PageRequested({ page }),
|
|
2717
2754
|
PageSizeChanged: ({ pageSize }) => DataTableMessage.PageSizeRequested({ pageSize })
|
|
2718
2755
|
}
|
|
2719
|
-
}));
|
|
2756
|
+
}) : h.div.attr("role", "status").class(tableResultsFooterClass).children(paginationMessages(locale).results(totalRows)));
|
|
2720
2757
|
}
|
|
2721
2758
|
});
|
|
2722
2759
|
|
|
@@ -639,6 +639,7 @@ var tableClasses = {
|
|
|
639
639
|
actionTrigger: `size-8 ${cellTriggerFocus}`,
|
|
640
640
|
actionsCell: "sticky right-0 z-20 w-10 min-w-10 cursor-default bg-background p-0 transition-colors group-hover/row:bg-[color-mix(in_oklab,var(--muted)_50%,var(--background))]",
|
|
641
641
|
actionsAlign: "flex min-h-12 items-center justify-end pe-1",
|
|
642
|
+
row: "h-16 [&:where(:not(:last-child))>td]:border-b",
|
|
642
643
|
header: "relative h-12 p-0",
|
|
643
644
|
stickyHeader: "sticky top-0 z-30 bg-background",
|
|
644
645
|
stickyHeaderRule: "after:border-border after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:border-b",
|
|
@@ -656,6 +657,7 @@ var tableClasses = {
|
|
|
656
657
|
referenceName: "truncate font-medium",
|
|
657
658
|
referenceDescription: "text-muted-foreground truncate text-xs"
|
|
658
659
|
};
|
|
660
|
+
var tableResultsFooterClass = "bg-background text-muted-foreground sticky bottom-0 z-30 shrink-0 border-t px-2 py-2 text-sm";
|
|
659
661
|
var resolveTableClasses = (overrides) => ({
|
|
660
662
|
...tableClasses,
|
|
661
663
|
...overrides
|
|
@@ -710,6 +712,7 @@ var DataTableItemSchema = Schema4.Struct({
|
|
|
710
712
|
value: Schema4.NonEmptyString,
|
|
711
713
|
label: Schema4.String
|
|
712
714
|
}).annotate({ identifier: "DataTableItem" });
|
|
715
|
+
var TableIconSchema = Schema4.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "DataTableIcon" });
|
|
713
716
|
var DataTableReferenceSchema = Schema4.Struct({
|
|
714
717
|
label: Schema4.String,
|
|
715
718
|
description: Schema4.optionalKey(Schema4.String),
|
|
@@ -749,11 +752,15 @@ var DataTableActionSchema = Schema4.Struct({
|
|
|
749
752
|
variant: Schema4.optionalKey(Schema4.Literals(["default", "destructive"])),
|
|
750
753
|
disabled: Schema4.optionalKey(Schema4.Boolean)
|
|
751
754
|
}).annotate({ identifier: "DataTableAction" });
|
|
755
|
+
var DataTableRowActionSchema = Schema4.Struct({
|
|
756
|
+
...DataTableActionSchema.fields,
|
|
757
|
+
icon: Schema4.optionalKey(TableIconSchema)
|
|
758
|
+
}).annotate({ identifier: "DataTableRowAction" });
|
|
752
759
|
var DataTableRowSchema = Schema4.Struct({
|
|
753
760
|
id: Schema4.NonEmptyString,
|
|
754
761
|
label: Schema4.String,
|
|
755
762
|
cells: Schema4.Record(Schema4.String, DataTableCellValueSchema),
|
|
756
|
-
actions: Schema4.optionalKey(Schema4.Array(
|
|
763
|
+
actions: Schema4.optionalKey(Schema4.Array(DataTableRowActionSchema)),
|
|
757
764
|
primaryActionId: Schema4.optionalKey(Schema4.String),
|
|
758
765
|
groups: Schema4.optionalKey(Schema4.Record(Schema4.String, Schema4.Array(Schema4.String))),
|
|
759
766
|
selectable: Schema4.optionalKey(Schema4.Boolean),
|
|
@@ -788,11 +795,10 @@ var DataTableBadgeOptionSchema = Schema4.Struct({
|
|
|
788
795
|
"muted"
|
|
789
796
|
]))
|
|
790
797
|
}).annotate({ identifier: "DataTableBadgeOption" });
|
|
791
|
-
var BadgeIcon = Schema4.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "DataTableBadgeIcon" });
|
|
792
798
|
var DataTableBadgeOptionsSchema = Schema4.Struct({
|
|
793
799
|
options: Schema4.optionalKey(Schema4.Array(DataTableBadgeOptionSchema.mapFields((fields) => ({
|
|
794
800
|
...fields,
|
|
795
|
-
icon: Schema4.optionalKey(
|
|
801
|
+
icon: Schema4.optionalKey(TableIconSchema)
|
|
796
802
|
}))))
|
|
797
803
|
}).annotate({ identifier: "DataTableBadgeOptions" });
|
|
798
804
|
var DataTableFieldSchema = Schema4.Union([
|
|
@@ -807,6 +813,7 @@ var DataTableFieldSchema = Schema4.Union([
|
|
|
807
813
|
type: Schema4.Literal("number"),
|
|
808
814
|
typeOptions: Schema4.optionalKey(Schema4.Struct({
|
|
809
815
|
locale: Schema4.optionalKey(Schema4.String),
|
|
816
|
+
format: Schema4.optionalKey(Schema4.Literal("bytes")),
|
|
810
817
|
style: Schema4.optionalKey(Schema4.Literals(["decimal", "percent", "currency", "unit"])),
|
|
811
818
|
currency: Schema4.optionalKey(Schema4.String),
|
|
812
819
|
unit: Schema4.optionalKey(Schema4.String),
|
|
@@ -816,7 +823,14 @@ var DataTableFieldSchema = Schema4.Union([
|
|
|
816
823
|
exportFormat: Schema4.optionalKey(Schema4.Literals(["raw", "formatted"]))
|
|
817
824
|
}).annotate({ identifier: "DataTableNumberFormat" }))
|
|
818
825
|
}),
|
|
819
|
-
Schema4.Struct({
|
|
826
|
+
Schema4.Struct({
|
|
827
|
+
...column,
|
|
828
|
+
type: Schema4.Literal("reference"),
|
|
829
|
+
typeOptions: Schema4.optionalKey(Schema4.Struct({
|
|
830
|
+
imageVariant: Schema4.optionalKey(Schema4.Literals(["circle", "square"])),
|
|
831
|
+
fallbackIcons: Schema4.optionalKey(Schema4.Record(Schema4.String, TableIconSchema))
|
|
832
|
+
}).annotate({ identifier: "DataTableReferenceOptions" }))
|
|
833
|
+
}),
|
|
820
834
|
Schema4.Struct({
|
|
821
835
|
...column,
|
|
822
836
|
type: Schema4.Literal("date"),
|
|
@@ -1095,9 +1109,17 @@ var isTableBoolean = Schema5.is(Schema5.Boolean);
|
|
|
1095
1109
|
var isTableReference = Schema5.is(DataTableReferenceSchema);
|
|
1096
1110
|
var isTableList = Schema5.is(Schema5.Array(DataTableItemSchema));
|
|
1097
1111
|
var tableInitials = (label) => label.trim().split(/\s+/).slice(0, 2).map((word) => word.slice(0, 1)).join("").toLocaleUpperCase();
|
|
1112
|
+
var formatBytes = (bytes, locale) => {
|
|
1113
|
+
const [unit, scale] = bytes >= 1024 ** 2 ? ["megabyte", 1024 ** 2] : bytes >= 1024 ? ["kilobyte", 1024] : ["byte", 1];
|
|
1114
|
+
return new Intl.NumberFormat(locale, {
|
|
1115
|
+
style: "unit",
|
|
1116
|
+
unit,
|
|
1117
|
+
maximumFractionDigits: 1
|
|
1118
|
+
}).format(bytes / scale);
|
|
1119
|
+
};
|
|
1098
1120
|
var formatNumberValue = (value, options, defaultLocale = "en") => {
|
|
1099
|
-
const { locale,
|
|
1100
|
-
return new Intl.NumberFormat(locale ?? defaultLocale,
|
|
1121
|
+
const { locale, format, ...intlOptions } = options ?? {};
|
|
1122
|
+
return format === "bytes" ? formatBytes(value, locale ?? defaultLocale) : new Intl.NumberFormat(locale ?? defaultLocale, intlOptions).format(value);
|
|
1101
1123
|
};
|
|
1102
1124
|
var tableBooleanLabel = (value, options) => (value ? options?.trueLabel : options?.falseLabel) ?? String(value);
|
|
1103
1125
|
var decodeDateInput = Schema5.decodeUnknownOption(DataTableDateInputSchema);
|
|
@@ -2030,6 +2052,7 @@ var DataTableReferenceCell = ({
|
|
|
2030
2052
|
if (!item)
|
|
2031
2053
|
return emptyLabel;
|
|
2032
2054
|
const initials = tableInitials(item.label);
|
|
2055
|
+
const image = item.imageSrc && item.imageSrc !== failedImage ? item.imageSrc : undefined;
|
|
2033
2056
|
return /* @__PURE__ */ jsxs3("div", {
|
|
2034
2057
|
className: tableClasses.reference,
|
|
2035
2058
|
children: [
|
|
@@ -2039,14 +2062,16 @@ var DataTableReferenceCell = ({
|
|
|
2039
2062
|
"aria-hidden": "true",
|
|
2040
2063
|
className: "[&_svg]:size-4",
|
|
2041
2064
|
children: item.icon
|
|
2042
|
-
}) :
|
|
2043
|
-
src:
|
|
2044
|
-
alt: item.label,
|
|
2065
|
+
}) : image ? /* @__PURE__ */ jsx3("img", {
|
|
2066
|
+
src: image,
|
|
2067
|
+
alt: item.fallbackIcon ? "" : item.label,
|
|
2068
|
+
loading: "lazy",
|
|
2045
2069
|
className: "size-full object-cover",
|
|
2046
|
-
onError: () => setFailedImage(
|
|
2070
|
+
onError: () => setFailedImage(image)
|
|
2047
2071
|
}) : /* @__PURE__ */ jsx3("span", {
|
|
2048
2072
|
"aria-hidden": "true",
|
|
2049
|
-
|
|
2073
|
+
className: "[&_svg]:size-4",
|
|
2074
|
+
children: item.fallbackIcon ?? initials
|
|
2050
2075
|
})
|
|
2051
2076
|
}),
|
|
2052
2077
|
/* @__PURE__ */ jsxs3("div", {
|
|
@@ -3583,7 +3608,7 @@ var TableDataRow = ({
|
|
|
3583
3608
|
ref: measureRef,
|
|
3584
3609
|
"data-index": virtualIndex,
|
|
3585
3610
|
"aria-rowindex": virtualIndex === undefined ? undefined : virtualIndex + 2,
|
|
3586
|
-
className: cn("group/row data-[drop-position=before]:[&>td]:border-primary data-[drop-position=after]:[&>td]:border-primary
|
|
3611
|
+
className: cn("group/row data-[drop-position=before]:[&>td]:border-primary data-[drop-position=after]:[&>td]:border-primary data-[drag-source=true]:opacity-40 data-[drop-position=after]:[&>td]:border-b-2 data-[drop-position=before]:[&>td]:border-t-2", tableClasses.row, store.config.onRowClicked && "cursor-pointer"),
|
|
3587
3612
|
"data-state": store.state.rowSelection[row.id] && "selected",
|
|
3588
3613
|
"data-table-row": row.id,
|
|
3589
3614
|
onClick: () => store.config.onRowClicked?.(row.data),
|
|
@@ -4388,7 +4413,7 @@ var DataTableGallery = ({
|
|
|
4388
4413
|
children: renderSections(sections)
|
|
4389
4414
|
});
|
|
4390
4415
|
};
|
|
4391
|
-
var
|
|
4416
|
+
var DataTableFooter = ({
|
|
4392
4417
|
table
|
|
4393
4418
|
}) => {
|
|
4394
4419
|
const styles = useContext(DataTableStylesContext);
|
|
@@ -4402,8 +4427,13 @@ var DataTablePagination = ({
|
|
|
4402
4427
|
send(DataTableMessage.PageRequested({ page }));
|
|
4403
4428
|
}
|
|
4404
4429
|
}, [page, pageIndex, pagination, paginationVisible, send]);
|
|
4405
|
-
if (!paginationVisible || !pagination)
|
|
4406
|
-
return
|
|
4430
|
+
if (!paginationVisible || !pagination) {
|
|
4431
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
4432
|
+
className: tableResultsFooterClass,
|
|
4433
|
+
role: "status",
|
|
4434
|
+
children: store.config.labels.results(model.totalRows)
|
|
4435
|
+
});
|
|
4436
|
+
}
|
|
4407
4437
|
const selected = model.rows.filter((row) => store.state.rowSelection[row.id]).length;
|
|
4408
4438
|
return /* @__PURE__ */ jsx3("div", {
|
|
4409
4439
|
"data-table-slot": "pagination",
|
|
@@ -4600,7 +4630,7 @@ var HydratedDataTable = (props) => {
|
|
|
4600
4630
|
/* @__PURE__ */ jsx3(DataTableContent, {
|
|
4601
4631
|
table
|
|
4602
4632
|
}),
|
|
4603
|
-
/* @__PURE__ */ jsx3(
|
|
4633
|
+
/* @__PURE__ */ jsx3(DataTableFooter, {
|
|
4604
4634
|
table
|
|
4605
4635
|
})
|
|
4606
4636
|
]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Context, Effect, Schema } from "effect";
|
|
2
|
+
export type UserActor = {
|
|
3
|
+
readonly type: "user";
|
|
4
|
+
readonly userId: string;
|
|
5
|
+
readonly organizationId: string | null;
|
|
6
|
+
readonly roles: ReadonlyArray<string>;
|
|
7
|
+
};
|
|
8
|
+
export type ApiKeyOwner = (Omit<UserActor, "type"> & {
|
|
9
|
+
readonly type: "user";
|
|
10
|
+
}) | {
|
|
11
|
+
readonly type: "organization";
|
|
12
|
+
readonly organizationId: string;
|
|
13
|
+
};
|
|
14
|
+
export type ApiKeyActor = {
|
|
15
|
+
readonly type: "apiKey";
|
|
16
|
+
readonly apiKeyId: string;
|
|
17
|
+
readonly owner: ApiKeyOwner;
|
|
18
|
+
};
|
|
19
|
+
export type Actor = UserActor | ApiKeyActor;
|
|
20
|
+
export type CurrentActor = {
|
|
21
|
+
readonly actor: Actor;
|
|
22
|
+
readonly organizationId: string | null;
|
|
23
|
+
readonly permissions: ReadonlySet<string>;
|
|
24
|
+
};
|
|
25
|
+
export declare const CurrentActor: Context.Service<CurrentActor, CurrentActor>;
|
|
26
|
+
export declare const principalId: (actor: Actor) => string;
|
|
27
|
+
declare const Forbidden_base: Schema.Class<Forbidden, Schema.TaggedStruct<"Forbidden", {}>, import("effect/Cause").YieldableError & {
|
|
28
|
+
readonly brand: unique symbol;
|
|
29
|
+
}>;
|
|
30
|
+
export declare class Forbidden extends Forbidden_base {
|
|
31
|
+
}
|
|
32
|
+
export type Policy<E = never, R = never> = Effect.Effect<void, Forbidden | E, CurrentActor | R>;
|
|
33
|
+
export declare const policy: <E, R>(predicate: (actor: CurrentActor) => Effect.Effect<boolean, E, R>) => Policy<E, R>;
|
|
34
|
+
export declare const permission: (required: string) => Policy;
|
|
35
|
+
export declare const hasPermission: (grants: readonly string[] | ReadonlySet<string>, required: string) => boolean;
|
|
36
|
+
export declare const all: <E, R>(...policies: readonly [Policy<E, R>, ...Array<Policy<E, R>>]) => Policy<E, R>;
|
|
37
|
+
export declare const any: <E, R>(...policies: readonly [Policy<E, R>, ...Array<Policy<E, R>>]) => Policy<E, R>;
|
|
38
|
+
export declare const withPolicy: <E, R>(check: Effect.Effect<void, E, R>) => <A, E2, R2>(effect: Effect.Effect<A, E2, R2>) => Effect.Effect<A, E | E2, R | R2>;
|
|
39
|
+
type RoleGrants<Role extends string, Grant extends string> = {
|
|
40
|
+
readonly roleNames: readonly Role[];
|
|
41
|
+
readonly permissionsForRoles: (verifiedRoles: Iterable<string>) => ReadonlySet<Grant>;
|
|
42
|
+
};
|
|
43
|
+
type RoleMapping<Role extends string, OtherRole extends string> = {
|
|
44
|
+
readonly roles: Readonly<Partial<Record<Role, NoInfer<OtherRole> | null>>>;
|
|
45
|
+
};
|
|
46
|
+
export interface ProjectAccess<Project extends string, Action extends string, Role extends string, Grant extends string> extends RoleGrants<Role, Grant> {
|
|
47
|
+
readonly project: Project;
|
|
48
|
+
readonly actions: readonly Action[];
|
|
49
|
+
/** Local role declarations. Merged grants are available via permissionsForRoles. */
|
|
50
|
+
readonly roles: Readonly<Record<string, readonly Action[] | undefined>>;
|
|
51
|
+
readonly qualify: (action: Action) => `${Project}:${Action}`;
|
|
52
|
+
readonly permission: (action: Action) => Policy;
|
|
53
|
+
readonly merge: <OtherRole extends string, OtherGrant extends string>(other: RoleGrants<OtherRole, OtherGrant>, options?: RoleMapping<Role, OtherRole>) => ProjectAccess<Project, Action, Role, Grant | OtherGrant>;
|
|
54
|
+
}
|
|
55
|
+
/** Define application-owned roles. Role membership must come from the host. */
|
|
56
|
+
export declare const defineProjectAccess: <const Project extends string, const Actions extends readonly string[], const Role extends string>(config: {
|
|
57
|
+
readonly project: Project;
|
|
58
|
+
readonly permissions: Actions;
|
|
59
|
+
readonly roles: Readonly<Record<Role, readonly NoInfer<Actions[number]>[] | undefined>>;
|
|
60
|
+
}) => ProjectAccess<Project, Actions[number], Role, `${Project}:${Actions[number]}`>;
|
|
61
|
+
export {};
|