@krak-stack/registry 0.11.4 → 0.11.6
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 +23 -1
- package/README.md +23 -9
- package/dist/components/agent/react.js +226 -1072
- package/dist/components/app-switcher/html.js +10 -53
- package/dist/components/app-switcher/react.js +29 -139
- package/dist/components/async-action-button/html.js +3 -34
- package/dist/components/async-action-button/react.d.ts +1 -1
- package/dist/components/async-action-button/react.js +8 -54
- package/dist/components/audit-log-table/react.js +706 -1279
- package/dist/components/bulk-list-input/html.js +3 -40
- package/dist/components/bulk-list-input/react.d.ts +1 -1
- package/dist/components/bulk-list-input/react.js +6 -59
- package/dist/components/code-block/html.js +1 -35
- package/dist/components/code-block/react.js +12 -59
- package/dist/components/color-input/html.js +2 -19
- package/dist/components/color-input/react.js +6 -97
- package/dist/components/copy-button/html.js +1 -35
- package/dist/components/copy-button/react.d.ts +1 -1
- package/dist/components/copy-button/react.js +7 -54
- package/dist/components/copy-value/html.js +11 -52
- package/dist/components/copy-value/react.js +25 -165
- package/dist/components/cron-input/html.js +2 -18
- package/dist/components/cron-input/react.js +15 -30
- package/dist/components/danger-confirmation/html.js +11 -57
- package/dist/components/danger-confirmation/react.js +26 -187
- package/dist/components/data-table/classes.d.ts +9 -3
- package/dist/components/data-table/html.d.ts +93 -21
- package/dist/components/data-table/html.js +309 -196
- package/dist/components/data-table/index.d.ts +97 -9
- package/dist/components/data-table/react.d.ts +14 -3
- package/dist/components/data-table/react.js +700 -1273
- package/dist/components/data-table/schema.d.ts +175 -16
- package/dist/components/date-input/html.js +19 -74
- package/dist/components/date-input/react.d.ts +1 -1
- package/dist/components/date-input/react.js +28 -313
- package/dist/components/docs/classes.d.ts +15 -0
- package/dist/components/docs/html.d.ts +55 -0
- package/dist/components/docs/html.js +837 -0
- package/dist/components/docs/index.d.ts +49 -0
- package/dist/components/docs/react.d.ts +10 -0
- package/dist/components/docs/react.js +949 -0
- package/dist/components/docs/schema.d.ts +49 -0
- package/dist/components/editable-text/html.js +6 -52
- package/dist/components/editable-text/react.js +13 -83
- package/dist/components/editing-locale-switcher/html.d.ts +2 -2
- package/dist/components/editing-locale-switcher/html.js +13 -43
- package/dist/components/editing-locale-switcher/react.js +17 -141
- package/dist/components/effect-form/react.js +249 -812
- package/dist/components/email-composer/react.js +62 -279
- package/dist/components/email-editor/html.js +13 -58
- package/dist/components/email-editor/react.js +187 -483
- package/dist/components/error-component/html.js +2 -47
- package/dist/components/error-component/react.js +33 -137
- package/dist/components/file-input/html.js +9 -40
- package/dist/components/file-input/react.js +39 -208
- package/dist/components/form/react.js +212 -777
- package/dist/components/icon-input/html.js +9 -56
- package/dist/components/icon-input/react.js +43 -143
- package/dist/components/image-crop-editor/html.js +1 -35
- package/dist/components/image-crop-editor/react.js +21 -66
- package/dist/components/locale-switcher/html.js +8 -55
- package/dist/components/locale-switcher/react.js +21 -146
- package/dist/components/map-menu/html.d.ts +8 -8
- package/dist/components/map-menu/html.js +13 -72
- package/dist/components/map-menu/react.js +92 -309
- package/dist/components/markdown/html.js +1 -35
- package/dist/components/markdown/react.js +20 -64
- package/dist/components/notification-menu/html.js +14 -50
- package/dist/components/notification-menu/react.js +73 -343
- package/dist/components/pagination/html.js +17 -73
- package/dist/components/pagination/react.js +37 -200
- package/dist/components/phone-number-input/html.js +19 -57
- package/dist/components/phone-number-input/react.d.ts +1 -1
- package/dist/components/phone-number-input/react.js +43 -142
- package/dist/components/presence-transition/index.d.ts +2 -2
- package/dist/components/registry-previews/component-example.js +26 -126
- package/dist/components/rich-text-editor/html.d.ts +12 -12
- package/dist/components/rich-text-editor/html.js +12 -85
- package/dist/components/rich-text-editor/react.js +55 -272
- package/dist/components/search-menu/classes.d.ts +2 -0
- package/dist/components/search-menu/html.d.ts +2 -0
- package/dist/components/search-menu/html.js +40 -73
- package/dist/components/search-menu/index.d.ts +27 -2
- package/dist/components/search-menu/react.d.ts +1 -1
- package/dist/components/search-menu/react.js +59 -280
- package/dist/components/search-menu/schema.d.ts +1 -0
- package/dist/components/select-with-custom-input/html.d.ts +2 -2
- package/dist/components/select-with-custom-input/html.js +13 -48
- package/dist/components/select-with-custom-input/react.js +22 -146
- package/dist/components/sidebar-layout/html.d.ts +16 -6
- package/dist/components/sidebar-layout/html.js +83 -69
- package/dist/components/sidebar-layout/index.d.ts +16 -0
- package/dist/components/sidebar-layout/react.js +105 -698
- package/dist/components/stats-card/react.js +13 -58
- package/dist/components/support/html.js +14 -69
- package/dist/components/support/react.js +74 -320
- package/dist/components/theme-switcher/html.js +11 -55
- package/dist/components/theme-switcher/react.js +28 -152
- package/dist/components/time-input/html.d.ts +2 -2
- package/dist/components/time-input/html.js +8 -53
- package/dist/components/time-input/react.js +34 -188
- package/dist/components/timezone-input/html.js +11 -67
- package/dist/components/timezone-input/react.js +41 -143
- package/dist/components/toast/html.d.ts +6 -6
- package/dist/components/toast/html.js +13 -46
- package/dist/components/tracking-notice/react.js +39 -188
- package/dist/components/unsaved-changes-guard/html.js +9 -43
- package/dist/components/unsaved-changes-guard/react.js +19 -169
- package/dist/components/upload-attachment/html.d.ts +4 -4
- package/dist/components/upload-attachment/html.js +4 -35
- package/dist/components/upload-attachment/react.js +25 -164
- package/dist/components/virtualized-combobox/html.js +10 -35
- package/dist/components/virtualized-combobox/react.js +28 -129
- package/dist/components/webhook-delivery-table/html.js +320 -206
- package/dist/components/webhook-delivery-table/react.js +736 -1376
- package/dist/lib/docs.integrations.server.js +150 -202
- package/dist/lib/docs.js +305 -1085
- package/dist/lib/docs.server.js +134 -186
- package/dist/lib/documentation-toolkit.js +144 -196
- package/dist/services/agent/client/index.js +226 -1072
- package/dist/services/notification/client/index.js +73 -343
- package/dist/services/notification/public.js +73 -343
- package/package.json +5 -13
- package/dist/components/effectcn/alert-dialog.d.ts +0 -13
- package/dist/components/effectcn/button.d.ts +0 -31
- package/dist/components/effectcn/calendar.d.ts +0 -12
- package/dist/components/effectcn/checkbox.d.ts +0 -10
- package/dist/components/effectcn/combobox.d.ts +0 -25
- package/dist/components/effectcn/dialog.d.ts +0 -19
- package/dist/components/effectcn/field.d.ts +0 -11
- package/dist/components/effectcn/file-drop.d.ts +0 -8
- package/dist/components/effectcn/input.d.ts +0 -26
- package/dist/components/effectcn/menu.d.ts +0 -85
- package/dist/components/effectcn/menubar.d.ts +0 -8
- package/dist/components/effectcn/popover.d.ts +0 -18
- package/dist/components/effectcn/scroll-area.d.ts +0 -12
- package/dist/components/effectcn/select.d.ts +0 -68
- package/dist/components/effectcn/toast.d.ts +0 -29
- package/dist/components/ui/alert-dialog.d.ts +0 -18
- package/dist/components/ui/alert.d.ts +0 -10
- package/dist/components/ui/attachment.d.ts +0 -23
- package/dist/components/ui/badge.d.ts +0 -7
- package/dist/components/ui/bubble.d.ts +0 -16
- package/dist/components/ui/button.d.ts +0 -8
- package/dist/components/ui/calendar.d.ts +0 -10
- package/dist/components/ui/card.d.ts +0 -11
- package/dist/components/ui/checkbox.d.ts +0 -3
- package/dist/components/ui/collapsible.d.ts +0 -5
- package/dist/components/ui/command.d.ts +0 -18
- package/dist/components/ui/dialog.d.ts +0 -17
- package/dist/components/ui/dropdown-menu.d.ts +0 -29
- package/dist/components/ui/empty.d.ts +0 -11
- package/dist/components/ui/field.d.ts +0 -24
- package/dist/components/ui/input-group.d.ts +0 -17
- package/dist/components/ui/input.d.ts +0 -3
- package/dist/components/ui/item.d.ts +0 -22
- package/dist/components/ui/label.d.ts +0 -3
- package/dist/components/ui/menubar.d.ts +0 -29
- package/dist/components/ui/message-scroller.d.ts +0 -10
- package/dist/components/ui/message.d.ts +0 -10
- package/dist/components/ui/popover.d.ts +0 -9
- package/dist/components/ui/scroll-area.d.ts +0 -4
- package/dist/components/ui/select.d.ts +0 -15
- package/dist/components/ui/select.js +0 -159
- package/dist/components/ui/separator.d.ts +0 -3
- package/dist/components/ui/sheet.d.ts +0 -14
- package/dist/components/ui/sidebar.d.ts +0 -63
- package/dist/components/ui/skeleton.d.ts +0 -2
- package/dist/components/ui/table.d.ts +0 -10
- package/dist/components/ui/tabs.d.ts +0 -10
- package/dist/components/ui/textarea.d.ts +0 -3
- package/dist/components/ui/tooltip.d.ts +0 -6
- package/dist/components/ui/trace.d.ts +0 -18
- package/dist/lib/effectcn-form.d.ts +0 -3
- package/dist/lib/effectcn-form.js +0 -54
|
@@ -3,143 +3,60 @@ import { Html as Html3 } from "effect/ui/html";
|
|
|
3
3
|
import { Dialog } from "effect/ui/kit";
|
|
4
4
|
|
|
5
5
|
// ../../src/components/data-table/html.ts
|
|
6
|
-
import { Schema as Schema6, Stream as Stream2 } from "effect";
|
|
7
|
-
import { Mount } from "effect/ui";
|
|
6
|
+
import { Array as Arr, Schema as Schema6, Stream as Stream2 } from "effect";
|
|
7
|
+
import { Mount, UiSchema as UiSchema3 } from "effect/ui";
|
|
8
8
|
import { Html as Html2 } from "effect/ui/html";
|
|
9
|
-
import { Checkbox, Menu, Menubar, VirtualList } from "effect/ui/kit";
|
|
10
|
-
|
|
11
|
-
// ../../src/components/effectcn/button.ts
|
|
9
|
+
import { Checkbox, Menu, Menubar, Select as Select2, VirtualList } from "effect/ui/kit";
|
|
10
|
+
import { Button as Button2, buttonVariants } from "@/components/effectcn/button";
|
|
12
11
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { cn } from "cn";
|
|
18
|
-
|
|
19
|
-
// ../../src/components/effectcn/button.ts
|
|
20
|
-
var base = "inline-flex h-8.5 shrink-0 items-center justify-center gap-1.5 rounded-md border border-transparent px-3.5 text-[13px] leading-none font-medium whitespace-nowrap no-underline select-none transition-[background-color,border-color,color,opacity] duration-150 active:translate-y-px data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&_svg]:size-[15px] [&_svg]:shrink-0 data-[loading]:before:size-3 data-[loading]:before:animate-spin data-[loading]:before:rounded-full data-[loading]:before:border-2 data-[loading]:before:border-current data-[loading]:before:border-r-transparent";
|
|
21
|
-
var variants = {
|
|
22
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/85",
|
|
23
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-accent",
|
|
24
|
-
outline: "border-input bg-background text-foreground shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
25
|
-
ghost: "text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
26
|
-
brand: "bg-brand-soft text-brand-soft-foreground hover:bg-brand-soft/85",
|
|
27
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/85",
|
|
28
|
-
link: "h-auto px-0 text-foreground underline decoration-transparent underline-offset-4 hover:decoration-current"
|
|
29
|
-
};
|
|
30
|
-
var sizes = {
|
|
31
|
-
default: "",
|
|
32
|
-
sm: "h-7 rounded-sm px-2.5 text-xs",
|
|
33
|
-
lg: "h-10 px-5 text-sm",
|
|
34
|
-
icon: "w-8.5 px-0",
|
|
35
|
-
"icon-sm": "h-7 w-7 rounded-sm px-0"
|
|
36
|
-
};
|
|
37
|
-
var buttonVariants = (options = {}) => cn(base, variants[options.variant ?? "default"], sizes[options.size ?? "default"], options.class);
|
|
38
|
-
var Button = (h, options = {}) => KitButton(h, {
|
|
39
|
-
element: options.element,
|
|
40
|
-
onPress: options.onPress,
|
|
41
|
-
props: options.loading ? { ...options.props, disabled: true, focusableWhenDisabled: true } : options.props
|
|
42
|
-
}).class(buttonVariants(options)).attr("data-loading", options.loading ? "" : undefined);
|
|
43
|
-
|
|
44
|
-
// ../../src/components/effectcn/checkbox.ts
|
|
45
|
-
var CheckboxRoot = (h, checkbox, options = {}) => checkbox.root(h.button.class(cn("border-input bg-background inline-grid size-4 shrink-0 place-items-center rounded-xs border p-0 " + "text-brand-foreground hover:border-muted-foreground shadow-sm transition-colors duration-150 " + "data-[checked]:border-brand data-[checked]:bg-brand " + "data-[indeterminate]:border-brand data-[indeterminate]:bg-brand " + "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[readonly]:cursor-default", options.class)));
|
|
46
|
-
var CheckboxIndicator = (h, checkbox, options = {}) => checkbox.indicator(h.span.class(cn("-mt-0.5 h-[5px] w-[9px] -rotate-45 border-b-[1.5px] border-l-[1.5px] border-current " + "data-[unchecked]:hidden " + "data-[indeterminate]:mt-0 data-[indeterminate]:h-0 data-[indeterminate]:w-2 " + "data-[indeterminate]:rotate-0 data-[indeterminate]:border-l-0", options.class)));
|
|
47
|
-
|
|
48
|
-
// ../../src/components/effectcn/input.ts
|
|
12
|
+
CheckboxIndicator,
|
|
13
|
+
CheckboxRoot
|
|
14
|
+
} from "@/components/effectcn/checkbox";
|
|
15
|
+
import { Input } from "@/components/effectcn/input";
|
|
49
16
|
import {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var MenuPopup = (h, menu, options = {}) => menu.popup(h.div.class(cn(popup, options.class)));
|
|
74
|
-
var MenuItem = (h, menu, options) => menu.item({
|
|
75
|
-
element: h.div.class(cn(item, itemVariants[options.variant ?? "default"], options.inset === true && inset, options.class)),
|
|
76
|
-
value: options.value,
|
|
77
|
-
closeOnClick: options.closeOnClick
|
|
78
|
-
});
|
|
79
|
-
var MenuSubTrigger = (h, menu, submenu, options) => menu.item({
|
|
80
|
-
element: submenu.submenuTrigger(h.div.class(cn(item, submenuArrow, options.inset === true && inset, options.class))),
|
|
81
|
-
value: options.value
|
|
82
|
-
});
|
|
83
|
-
var MenuSeparator = (h, menu, options = {}) => menu.separator(h.div.class(cn("bg-border -mx-1 my-1 h-px", options.class)));
|
|
84
|
-
var MenuInput = (h, menu, options = {}) => menu.input(h.input.class(cn("-mx-1 -mt-1 mb-1 block h-[34px] w-[calc(100%+0.5rem)] border-b bg-transparent px-3 outline-none", "placeholder:text-muted-foreground", options.class)).attrs({
|
|
85
|
-
placeholder: options.placeholder,
|
|
86
|
-
"aria-label": options.label ?? options.placeholder
|
|
87
|
-
}));
|
|
88
|
-
var MenuEmpty = (h, menu, options = {}) => menu.empty(h.div.class(cn("text-muted-foreground px-2 py-3.5 text-center", options.class)));
|
|
89
|
-
|
|
90
|
-
// ../../src/components/effectcn/menubar.ts
|
|
91
|
-
var MenubarRoot = (h, menubar, className) => menubar.root(h.div.class(cn("group/menubar bg-background inline-flex items-center gap-0.5 rounded-md border p-[3px] shadow-sm", "data-[orientation=vertical]:min-w-40 data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch", className)));
|
|
92
|
-
var MenubarTrigger = (h, menu, label, className) => menu.trigger({
|
|
93
|
-
element: h.button.class(cn("text-foreground hover:bg-accent hover:text-accent-foreground data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground flex h-7 cursor-default items-center gap-2 rounded-sm px-2.5 text-[13px] font-medium transition-colors duration-150 select-none focus-visible:outline-offset-0 data-[disabled]:pointer-events-none data-[disabled]:opacity-45", className)).attr("aria-label", label)
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// ../../src/components/data-table/html.ts
|
|
17
|
+
MenuCheckboxItem,
|
|
18
|
+
MenuEmpty,
|
|
19
|
+
MenuInput,
|
|
20
|
+
MenuItem,
|
|
21
|
+
MenuPopup,
|
|
22
|
+
MenuPositioner,
|
|
23
|
+
MenuRadioItem,
|
|
24
|
+
MenuSeparator,
|
|
25
|
+
MenuSubTrigger
|
|
26
|
+
} from "@/components/effectcn/menu";
|
|
27
|
+
import { MenubarRoot, MenubarTrigger } from "@/components/effectcn/menubar";
|
|
28
|
+
import {
|
|
29
|
+
SelectIcon as SelectIcon2,
|
|
30
|
+
SelectItem as SelectItem2,
|
|
31
|
+
SelectItemIndicator as SelectItemIndicator2,
|
|
32
|
+
SelectItemText as SelectItemText2,
|
|
33
|
+
SelectLabel as SelectLabel2,
|
|
34
|
+
SelectList as SelectList2,
|
|
35
|
+
SelectPopup as SelectPopup2,
|
|
36
|
+
SelectPositioner as SelectPositioner2,
|
|
37
|
+
SelectTrigger as SelectTrigger2,
|
|
38
|
+
SelectValue as SelectValue2
|
|
39
|
+
} from "@/components/effectcn/select";
|
|
97
40
|
import { krakstackLocaleRead as krakstackLocaleRead2 } from "@krak-stack/registry/krakstack-provider/html";
|
|
98
41
|
|
|
99
42
|
// ../../src/components/pagination/html.ts
|
|
100
43
|
import { Html } from "effect/ui/html";
|
|
101
44
|
import { Select } from "effect/ui/kit";
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}, { preventDefault: "always" }).class(cn("border-input bg-background inline-flex items-center justify-between gap-2 rounded-md border text-start", "text-foreground leading-none whitespace-nowrap shadow-sm select-none", "hover:bg-accent data-[popup-open]:bg-accent transition-colors duration-150", "data-[disabled]:hover:bg-background data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", "data-[readonly]:bg-muted data-[readonly]:cursor-default", triggerSizes[options.size ?? "default"], options.class)));
|
|
118
|
-
var SelectValue = (h, select, options = {}) => select.value(h.span.class(cn("data-[placeholder]:text-muted-foreground min-w-0 truncate leading-snug", options.class)));
|
|
119
|
-
var SelectIcon = (h, select, options = {}) => select.icon(h.span.class(cn("border-muted-foreground mx-1 mb-[3px] size-[7px] shrink-0 rotate-45 border-r-[1.5px] border-b-[1.5px]", options.class)));
|
|
120
|
-
var SelectPositioner = (h, select, options = {}) => select.positioner(h.div.class(cn("outline-none data-[side=none]:my-2.5", options.class)));
|
|
121
|
-
var SelectPopup = (h, select, options = {}) => select.popup(h.div.class(cn("relative box-border max-w-[var(--available-width)] min-w-[max(var(--anchor-width),10rem)] overflow-y-auto", "bg-popover text-foreground shadow-float rounded-lg border p-1 outline-none", "max-h-[min(var(--available-height),20rem)] data-[side=none]:max-h-none", "origin-[var(--transform-origin)] transition-[opacity,scale] duration-150", "data-[ending-style]:opacity-0 data-[starting-style]:opacity-0", "not-data-[side=none]:data-[ending-style]:scale-95 not-data-[side=none]:data-[starting-style]:scale-95", "data-[side=none]:[scrollbar-width:none]", "has-[>[data-slot=select-list]]:flex has-[>[data-slot=select-list]]:flex-col", "has-[>[data-slot=select-list]]:overflow-hidden has-[>[data-slot=select-list]]:p-0", popupSizes[options.size ?? "default"], options.class)));
|
|
122
|
-
var SelectList = (h, select, options = {}) => select.list(h.div.attr("data-slot", "select-list").class(cn("min-h-0 flex-1 [scrollbar-width:none] overflow-y-auto p-1 outline-none", options.class)));
|
|
123
|
-
var SelectItem = (h, select, options) => select.item({
|
|
124
|
-
element: h.div.class(cn("flex min-h-7.5 cursor-default scroll-my-1 items-center gap-2 rounded-sm px-2 py-1 leading-snug outline-none", "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground select-none", "data-[disabled]:text-muted-foreground data-[disabled]:opacity-60 data-[selected]:font-medium", "[&_svg]:text-muted-foreground [&_svg]:size-[15px] [&_svg]:shrink-0", options.class)),
|
|
125
|
-
value: options.value
|
|
126
|
-
});
|
|
127
|
-
var SelectItemText = (h, select, options = {}) => select.itemText(h.div.class(cn("min-w-0 flex-1 whitespace-nowrap", options.class)));
|
|
128
|
-
var SelectItemIndicator = (h, select, options) => select.itemIndicator({
|
|
129
|
-
element: h.span.class(cn("border-brand mr-1.5 mb-0.5 ml-2.5 h-[9px] w-[5px] shrink-0 rotate-45 border-r-[1.5px] border-b-[1.5px]", options.class)),
|
|
130
|
-
value: options.value
|
|
131
|
-
});
|
|
132
|
-
var scrollArrow = "inset-x-0 z-10 hidden h-6 cursor-default place-items-center rounded-lg bg-popover data-[visible]:grid " + "before:size-1.5 before:rotate-45 before:border-muted-foreground";
|
|
133
|
-
var SelectScrollUpArrow = (h, select, options = {}) => select.scrollUpArrow({
|
|
134
|
-
keepMounted: true,
|
|
135
|
-
element: h.div.class(cn(scrollArrow, "top-0 before:translate-y-0.5 before:border-t-[1.5px] before:border-l-[1.5px]", options.class))
|
|
136
|
-
});
|
|
137
|
-
var SelectScrollDownArrow = (h, select, options = {}) => select.scrollDownArrow({
|
|
138
|
-
keepMounted: true,
|
|
139
|
-
element: h.div.class(cn(scrollArrow, "bottom-0 before:-translate-y-0.5 before:border-r-[1.5px] before:border-b-[1.5px]", options.class))
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// ../../src/components/pagination/html.ts
|
|
45
|
+
import { Button } from "@/components/effectcn/button";
|
|
46
|
+
import {
|
|
47
|
+
SelectIcon,
|
|
48
|
+
SelectItem,
|
|
49
|
+
SelectItemIndicator,
|
|
50
|
+
SelectItemText,
|
|
51
|
+
SelectLabel,
|
|
52
|
+
SelectList,
|
|
53
|
+
SelectPopup,
|
|
54
|
+
SelectPositioner,
|
|
55
|
+
SelectScrollDownArrow,
|
|
56
|
+
SelectScrollUpArrow,
|
|
57
|
+
SelectTrigger,
|
|
58
|
+
SelectValue
|
|
59
|
+
} from "@/components/effectcn/select";
|
|
143
60
|
import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
|
|
144
61
|
import {
|
|
145
62
|
ChevronLeft,
|
|
@@ -148,6 +65,9 @@ import {
|
|
|
148
65
|
ChevronsRight
|
|
149
66
|
} from "@krak-stack/registry/lucide-effect";
|
|
150
67
|
|
|
68
|
+
// ../../src/lib/utils.ts
|
|
69
|
+
import { cn } from "cn";
|
|
70
|
+
|
|
151
71
|
// ../../src/components/pagination/classes.ts
|
|
152
72
|
var paginationClasses = {
|
|
153
73
|
root: "flex flex-col gap-3 px-2 sm:flex-row sm:items-center sm:justify-between",
|
|
@@ -549,9 +469,16 @@ import { Csv } from "effect/encoding";
|
|
|
549
469
|
import { Command, Component as Component2, Subscription, UiSchema as UiSchema2 } from "effect/ui";
|
|
550
470
|
|
|
551
471
|
// ../../src/components/data-table/schema.ts
|
|
552
|
-
import { DateTime as DateTime2, Option as Option2, Schema as Schema4, Struct as Struct2, Tuple } from "effect";
|
|
472
|
+
import { DateTime as DateTime2, Option as Option2, Predicate, Schema as Schema4, Struct as Struct2, Tuple } from "effect";
|
|
553
473
|
|
|
554
474
|
// ../../src/components/data-table/classes.ts
|
|
475
|
+
var booleanCellControl = "flex min-h-16 w-full items-center justify-start px-2 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0 has-[:focus-visible]:outline-2 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-ring";
|
|
476
|
+
var cellTriggerFocus = "focus-visible:ring-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring";
|
|
477
|
+
var tableBadgeTones = {
|
|
478
|
+
success: "border-emerald-200 bg-emerald-100 text-emerald-900 dark:border-emerald-900/50 dark:bg-emerald-950/50 dark:text-emerald-200",
|
|
479
|
+
info: "border-blue-200 bg-blue-100 text-blue-900 dark:border-blue-900/50 dark:bg-blue-950/50 dark:text-blue-200",
|
|
480
|
+
muted: "border-muted bg-muted text-muted-foreground dark:bg-muted/50"
|
|
481
|
+
};
|
|
555
482
|
var tableClasses = {
|
|
556
483
|
selectionCell: "w-10 p-0 align-middle",
|
|
557
484
|
selectionCenter: "grid place-items-center",
|
|
@@ -563,16 +490,16 @@ var tableClasses = {
|
|
|
563
490
|
menubar: "h-auto w-full flex-wrap justify-start border border-input bg-transparent",
|
|
564
491
|
cell: "overflow-hidden",
|
|
565
492
|
cellContent: "min-w-0 wrap-anywhere",
|
|
566
|
-
actionTrigger:
|
|
493
|
+
actionTrigger: `size-8 ${cellTriggerFocus}`,
|
|
567
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))]",
|
|
568
495
|
actionsAlign: "flex min-h-12 items-center justify-end pe-1",
|
|
569
496
|
header: "relative h-12 p-0",
|
|
570
497
|
stickyHeader: "sticky top-0 z-30 bg-background",
|
|
571
498
|
stickyHeaderRule: "after:border-border after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:border-b",
|
|
572
|
-
headerTrigger:
|
|
499
|
+
headerTrigger: `absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pe-4 ${cellTriggerFocus}`,
|
|
573
500
|
resizeHandle: "absolute inset-y-0 right-0 z-10 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-3 after:right-0 after:w-px after:bg-border hover:after:w-0.5 hover:after:bg-primary/60 focus-visible:after:w-0.5 focus-visible:after:bg-ring",
|
|
574
501
|
relationshipCell: "grid min-h-16 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0",
|
|
575
|
-
relationshipTrigger:
|
|
502
|
+
relationshipTrigger: `h-full w-full min-w-0 justify-between rounded-none px-2 text-start ${cellTriggerFocus}`,
|
|
576
503
|
reference: "flex min-w-0 items-center gap-2",
|
|
577
504
|
referenceAvatar: "relative grid size-8 shrink-0 place-items-center overflow-hidden bg-muted text-xs font-medium",
|
|
578
505
|
referenceText: "flex min-w-0 flex-col leading-tight",
|
|
@@ -696,8 +623,33 @@ var column = {
|
|
|
696
623
|
emptyLabel: Schema4.optionalKey(Schema4.String),
|
|
697
624
|
nulls: Schema4.optionalKey(Schema4.Literals(["first", "last"]))
|
|
698
625
|
};
|
|
626
|
+
var DataTableBadgeOptionSchema = Schema4.Struct({
|
|
627
|
+
value: Schema4.NonEmptyString,
|
|
628
|
+
label: Schema4.optionalKey(Schema4.String),
|
|
629
|
+
variant: Schema4.optionalKey(Schema4.Literals([
|
|
630
|
+
"default",
|
|
631
|
+
"secondary",
|
|
632
|
+
"outline",
|
|
633
|
+
"destructive",
|
|
634
|
+
"success",
|
|
635
|
+
"info",
|
|
636
|
+
"muted"
|
|
637
|
+
]))
|
|
638
|
+
}).annotate({ identifier: "DataTableBadgeOption" });
|
|
639
|
+
var BadgeIcon = Schema4.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "DataTableBadgeIcon" });
|
|
640
|
+
var DataTableBadgeOptionsSchema = Schema4.Struct({
|
|
641
|
+
options: Schema4.optionalKey(Schema4.Array(DataTableBadgeOptionSchema.mapFields((fields) => ({
|
|
642
|
+
...fields,
|
|
643
|
+
icon: Schema4.optionalKey(BadgeIcon)
|
|
644
|
+
}))))
|
|
645
|
+
}).annotate({ identifier: "DataTableBadgeOptions" });
|
|
699
646
|
var DataTableFieldSchema = Schema4.Union([
|
|
700
|
-
Schema4.Struct({
|
|
647
|
+
Schema4.Struct({
|
|
648
|
+
...column,
|
|
649
|
+
type: Schema4.Literal("text"),
|
|
650
|
+
display: Schema4.optionalKey(Schema4.Literal("badge")),
|
|
651
|
+
typeOptions: Schema4.optionalKey(DataTableBadgeOptionsSchema)
|
|
652
|
+
}),
|
|
701
653
|
Schema4.Struct({
|
|
702
654
|
...column,
|
|
703
655
|
type: Schema4.Literal("number"),
|
|
@@ -740,7 +692,7 @@ var DataTableFieldSchema = Schema4.Union([
|
|
|
740
692
|
options: Schema4.optionalKey(Schema4.Array(DataTableItemSchema)),
|
|
741
693
|
allowRemove: Schema4.optionalKey(Schema4.Boolean),
|
|
742
694
|
itemActions: Schema4.optionalKey(Schema4.Array(DataTableActionSchema)),
|
|
743
|
-
display: Schema4.optionalKey(Schema4.Literals(["list", "icon"])),
|
|
695
|
+
display: Schema4.optionalKey(Schema4.Literals(["list", "icon", "badge"])),
|
|
744
696
|
visibleCount: Schema4.optionalKey(Schema4.Int.check(Schema4.isGreaterThanOrEqualTo(0))),
|
|
745
697
|
actionsLabel: Schema4.optionalKey(Schema4.String),
|
|
746
698
|
manageLabel: Schema4.optionalKey(Schema4.String)
|
|
@@ -1042,7 +994,33 @@ var matchesFilterText = (value, filter) => {
|
|
|
1042
994
|
return text.endsWith(query);
|
|
1043
995
|
}
|
|
1044
996
|
};
|
|
1045
|
-
var tableFilterKind = (column, hasOptions = false) => hasOptions || column.type === "list" ? "values" : column.type === "reference" ? "text" : column.type === "dateTime" ? "date" : column.type ?? "text";
|
|
997
|
+
var tableFilterKind = (column, hasOptions = false) => hasOptions || column.type === "list" || column.display === "badge" ? "values" : column.type === "reference" ? "text" : column.type === "dateTime" ? "date" : column.type ?? "text";
|
|
998
|
+
var tableBadgeValue = (value) => isTableText(value) && value !== "" ? value : null;
|
|
999
|
+
var tableBadge = (input, config) => {
|
|
1000
|
+
const value = tableBadgeValue(input);
|
|
1001
|
+
if (value === null)
|
|
1002
|
+
return null;
|
|
1003
|
+
const option = config?.options?.find((option) => option.value === value);
|
|
1004
|
+
return {
|
|
1005
|
+
value,
|
|
1006
|
+
label: option?.label ?? value,
|
|
1007
|
+
variant: option?.variant ?? "secondary",
|
|
1008
|
+
option
|
|
1009
|
+
};
|
|
1010
|
+
};
|
|
1011
|
+
var tableBadgeFilterOptions = (values, config) => {
|
|
1012
|
+
const options = new Map(config?.options?.map(({ value, label }) => [value, label ?? value]));
|
|
1013
|
+
for (const input of values) {
|
|
1014
|
+
const value = tableBadgeValue(input);
|
|
1015
|
+
if (value !== null && !options.has(value))
|
|
1016
|
+
options.set(value, value);
|
|
1017
|
+
}
|
|
1018
|
+
return [...options].map(([value, label]) => ({ value, label }));
|
|
1019
|
+
};
|
|
1020
|
+
var tableBadgeSearchText = (value, config) => {
|
|
1021
|
+
const badge = tableBadge(value, config);
|
|
1022
|
+
return badge ? `${badge.label} ${badge.value}` : "";
|
|
1023
|
+
};
|
|
1046
1024
|
var matchesTableFilter = (filter, value, type, text, values) => {
|
|
1047
1025
|
switch (filter.kind) {
|
|
1048
1026
|
case "text":
|
|
@@ -1087,13 +1065,20 @@ var filterTableColumns = (rows, columns, filters) => {
|
|
|
1087
1065
|
return rows;
|
|
1088
1066
|
return rows.filter((row) => active.every((filter) => {
|
|
1089
1067
|
const value = row.cells[filter.id];
|
|
1090
|
-
|
|
1068
|
+
const column = byId.get(filter.id);
|
|
1069
|
+
return matchesTableFilter(filter, value, column?.type, () => isTableText(value) ? value : isTableReference(value) ? `${value.label} ${value.description ?? ""}`.trim() : "", () => {
|
|
1070
|
+
if (column?.type === "text" && column.display === "badge") {
|
|
1071
|
+
const key = tableBadgeValue(value);
|
|
1072
|
+
return key === null ? [] : [key];
|
|
1073
|
+
}
|
|
1074
|
+
return isTableList(value) ? value.map(({ value }) => value) : [];
|
|
1075
|
+
});
|
|
1091
1076
|
}));
|
|
1092
1077
|
};
|
|
1093
1078
|
var columnValue = (column, value) => {
|
|
1094
1079
|
switch (column.type) {
|
|
1095
1080
|
case "text":
|
|
1096
|
-
return isTableText(value) ? value : null;
|
|
1081
|
+
return column.display === "badge" ? tableBadgeValue(value) : isTableText(value) ? value : null;
|
|
1097
1082
|
case "number":
|
|
1098
1083
|
case "boolean":
|
|
1099
1084
|
case "date":
|
|
@@ -1147,6 +1132,8 @@ var filterTableRows = (rows, columns, search, locale) => {
|
|
|
1147
1132
|
const searchable = columns.filter(({ searchable }) => searchable !== false);
|
|
1148
1133
|
return rows.filter((row) => searchable.some((column) => {
|
|
1149
1134
|
const value = row.cells[column.id];
|
|
1135
|
+
if (column.type === "text" && column.display === "badge")
|
|
1136
|
+
return tableBadgeSearchText(value, column.typeOptions).toLocaleLowerCase(locale).includes(query);
|
|
1150
1137
|
if (column.type === "date" || column.type === "dateTime") {
|
|
1151
1138
|
const date = resolveDate(value, column.type);
|
|
1152
1139
|
return !!date && `${formatDateValue(date, column, locale)} ${dateIsoValue(date)}`.toLocaleLowerCase(locale).includes(query);
|
|
@@ -1902,6 +1889,14 @@ var dataTableBehaviours = {
|
|
|
1902
1889
|
// ../../src/components/data-table/html.ts
|
|
1903
1890
|
var keyOf = (...parts) => JSON.stringify(parts);
|
|
1904
1891
|
var cellClass = "px-3 py-2 align-middle";
|
|
1892
|
+
var badgeVariants = {
|
|
1893
|
+
...tableBadgeTones,
|
|
1894
|
+
default: "bg-primary text-primary-foreground",
|
|
1895
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
1896
|
+
outline: "border-border text-foreground",
|
|
1897
|
+
destructive: "bg-destructive/10 text-destructive dark:bg-destructive/20"
|
|
1898
|
+
};
|
|
1899
|
+
var badgeClass = "inline-flex items-center gap-1 rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap";
|
|
1905
1900
|
var isTextFilterOperator = Schema6.is(TextFilterOperator);
|
|
1906
1901
|
var RowDrag = "application/x-krakstack-table-row";
|
|
1907
1902
|
var PersistPreferences = Mount.makeStream("DataTable/PersistPreferences", {
|
|
@@ -1921,6 +1916,55 @@ var PersistPreferences = Mount.makeStream("DataTable/PersistPreferences", {
|
|
|
1921
1916
|
preferences: readTablePreferences(storageKey, host)
|
|
1922
1917
|
});
|
|
1923
1918
|
}), Stream2.filter((message) => message !== undefined)));
|
|
1919
|
+
var FilterSelectMessage = UiSchema3.TaggedEnum({
|
|
1920
|
+
OpenChanged: { open: Schema6.Boolean },
|
|
1921
|
+
Picked: { value: Schema6.String }
|
|
1922
|
+
});
|
|
1923
|
+
var FilterSelectEvent = UiSchema3.TaggedEnum({
|
|
1924
|
+
Changed: { value: Schema6.String }
|
|
1925
|
+
});
|
|
1926
|
+
var FilterSelect = Html2.component({
|
|
1927
|
+
name: "DataTableFilterSelect",
|
|
1928
|
+
props: Schema6.Struct({
|
|
1929
|
+
label: Schema6.String,
|
|
1930
|
+
value: Schema6.String,
|
|
1931
|
+
items: Schema6.Array(Schema6.Struct({ value: Schema6.String, label: Schema6.String }))
|
|
1932
|
+
}),
|
|
1933
|
+
model: Schema6.Boolean,
|
|
1934
|
+
message: FilterSelectMessage,
|
|
1935
|
+
events: FilterSelectEvent,
|
|
1936
|
+
restore: false
|
|
1937
|
+
}).make({
|
|
1938
|
+
init: () => false,
|
|
1939
|
+
update: {
|
|
1940
|
+
OpenChanged: ($, { open }) => $.set(open),
|
|
1941
|
+
Picked: ($, { value }) => $.set(false).emit(FilterSelectEvent.Changed({ value }))
|
|
1942
|
+
},
|
|
1943
|
+
view: (h, open) => Select2(h, {
|
|
1944
|
+
props: {
|
|
1945
|
+
open,
|
|
1946
|
+
items: h.props.items,
|
|
1947
|
+
value: h.props.value || null,
|
|
1948
|
+
placeholder: "—",
|
|
1949
|
+
alignItemWithTrigger: false
|
|
1950
|
+
},
|
|
1951
|
+
onEmit: {
|
|
1952
|
+
RequestedOpen: () => FilterSelectMessage.OpenChanged({ open: true }),
|
|
1953
|
+
RequestedClose: () => FilterSelectMessage.OpenChanged({ open: false }),
|
|
1954
|
+
Picked: ({ value }) => {
|
|
1955
|
+
const item = h.props.items.find((item) => item.value === value);
|
|
1956
|
+
return item && FilterSelectMessage.Picked({ value: item.value });
|
|
1957
|
+
},
|
|
1958
|
+
Settled: () => {
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
},
|
|
1962
|
+
view: (select) => h.div.class("grid gap-1").children(SelectLabel2(h, select, { class: "mb-0" }).children(h.props.label), SelectTrigger2(h, select, {
|
|
1963
|
+
size: "sm",
|
|
1964
|
+
class: "w-full min-w-0"
|
|
1965
|
+
}).children(SelectValue2(h, select), SelectIcon2(h, select)), SelectPositioner2(h, select).children(SelectPopup2(h, select, { size: "sm" }).children(SelectList2(h, select).children(h.props.items.map(({ value, label }) => SelectItem2(h, select, { value }).children(SelectItemText2(h, select).children(label), SelectItemIndicator2(h, select, { value })))))))
|
|
1966
|
+
})
|
|
1967
|
+
});
|
|
1924
1968
|
var DataTable = Html2.component({
|
|
1925
1969
|
...dataTableOptions,
|
|
1926
1970
|
reads: { localeConfig: krakstackLocaleRead2 }
|
|
@@ -2017,18 +2061,19 @@ var DataTable = Html2.component({
|
|
|
2017
2061
|
element: h.button.class(cn(buttonVariants({
|
|
2018
2062
|
variant: "ghost",
|
|
2019
2063
|
size: presentation === "actions" ? "icon" : "sm"
|
|
2020
|
-
}), presentation === "actions" && tableClasses.actionTrigger, presentation && presentation !== "actions" && "filtered" in presentation && tableClasses.headerTrigger, presentation && presentation !== "actions" && "relationship" in presentation && tableClasses.relationshipTrigger)).
|
|
2021
|
-
|
|
2022
|
-
"aria-description": presentation && presentation !== "actions" && "filtered" in presentation && presentation.filtered ? `${copy.filters}: ${presentation.filtered}` : undefined
|
|
2023
|
-
})
|
|
2024
|
-
})).attr("aria-busy", pending ? "true" : undefined).children(presentation === "actions" ? Ellipsis(h, { size: 16 }) : presentation && ("selectedCount" in presentation) ? [
|
|
2064
|
+
}), presentation === "actions" && tableClasses.actionTrigger, presentation && presentation !== "actions" && "filtered" in presentation && tableClasses.headerTrigger, presentation && presentation !== "actions" && "relationship" in presentation && tableClasses.relationshipTrigger)).attr("aria-label", accessibleLabel)
|
|
2065
|
+
})).attr("aria-busy", pending ? "true" : undefined).attr("aria-description", presentation && presentation !== "actions" && "toolbarIcon" in presentation && presentation.filterCount ? `${copy.filters}: ${presentation.filterCount}` : presentation && presentation !== "actions" && ("filtered" in presentation) && presentation.filtered ? `${copy.filters}: ${presentation.filtered}` : undefined).children(presentation === "actions" ? Ellipsis(h, { size: 16 }) : presentation && ("selectedCount" in presentation) ? [
|
|
2025
2066
|
copy.selected,
|
|
2026
2067
|
h.span.class(tableClasses.count).children(String(presentation.selectedCount)),
|
|
2027
2068
|
ChevronDown(h, { size: 16 })
|
|
2028
2069
|
] : presentation && ("relationship" in presentation) ? [
|
|
2029
2070
|
presentation.relationship,
|
|
2030
2071
|
ChevronDown(h, { size: 16, className: "shrink-0" })
|
|
2031
|
-
] : presentation && ("toolbarIcon" in presentation) ? [
|
|
2072
|
+
] : presentation && ("toolbarIcon" in presentation) ? [
|
|
2073
|
+
indicator(presentation.toolbarIcon),
|
|
2074
|
+
label,
|
|
2075
|
+
!!presentation.filterCount && h.span.attr("data-slot", "badge").class(tableClasses.count).children(String(presentation.filterCount))
|
|
2076
|
+
] : presentation ? [
|
|
2032
2077
|
h.span.class("truncate").children(label),
|
|
2033
2078
|
presentation.filtered > 0 && indicator("filter"),
|
|
2034
2079
|
indicator(presentation.sort)
|
|
@@ -2057,10 +2102,11 @@ var DataTable = Html2.component({
|
|
|
2057
2102
|
query: childSearch ? model.menuQuery : undefined,
|
|
2058
2103
|
filter: childSearch ? "contains" : undefined,
|
|
2059
2104
|
open: model.menu === key && model.submenu === subkey,
|
|
2060
|
-
items: subitems.map(({ id, name, disabled }) => ({
|
|
2105
|
+
items: subitems.map(({ id, name, disabled, checked }) => ({
|
|
2061
2106
|
value: id,
|
|
2062
2107
|
label: name,
|
|
2063
|
-
disabled
|
|
2108
|
+
disabled,
|
|
2109
|
+
checked
|
|
2064
2110
|
})),
|
|
2065
2111
|
locale
|
|
2066
2112
|
},
|
|
@@ -2088,12 +2134,22 @@ var DataTable = Html2.component({
|
|
|
2088
2134
|
name,
|
|
2089
2135
|
variant,
|
|
2090
2136
|
keepOpen,
|
|
2091
|
-
icon
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2137
|
+
icon,
|
|
2138
|
+
checked,
|
|
2139
|
+
radio,
|
|
2140
|
+
separatorBefore
|
|
2141
|
+
}) => {
|
|
2142
|
+
const options = {
|
|
2143
|
+
value: id,
|
|
2144
|
+
closeOnClick: keepOpen ? false : undefined
|
|
2145
|
+
};
|
|
2146
|
+
const part = radio ? MenuRadioItem(h, submenu, options) : checked !== undefined ? MenuCheckboxItem(h, submenu, options) : MenuItem(h, submenu, {
|
|
2147
|
+
...options,
|
|
2148
|
+
variant
|
|
2149
|
+
});
|
|
2150
|
+
const content = part.children(indicator(icon), name);
|
|
2151
|
+
return separatorBefore ? h.div.children(MenuSeparator(h, submenu), content) : content;
|
|
2152
|
+
})))))
|
|
2097
2153
|
});
|
|
2098
2154
|
}
|
|
2099
2155
|
const element = h.div.class(cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex min-h-[30px] cursor-default items-center gap-2 rounded-sm px-2 whitespace-nowrap outline-none select-none data-[disabled]:opacity-45", variant === "destructive" && "text-destructive data-[highlighted]:bg-destructive/10 data-[highlighted]:text-destructive"));
|
|
@@ -2111,11 +2167,13 @@ var DataTable = Html2.component({
|
|
|
2111
2167
|
})))));
|
|
2112
2168
|
}
|
|
2113
2169
|
});
|
|
2114
|
-
const check = (key, label, checked, onToggle, options) => Checkbox(h, {
|
|
2170
|
+
const check = (key, label, checked, onToggle, options, inCell = false) => Checkbox(h, {
|
|
2115
2171
|
key,
|
|
2116
2172
|
props: { checked, ...options },
|
|
2117
2173
|
onEmit: { Toggled: ({ checked }) => onToggle(checked) },
|
|
2118
|
-
view: (checkbox) => h.span.class("grid size-4 shrink-0 place-items-center").children(CheckboxRoot(h, checkbox
|
|
2174
|
+
view: (checkbox) => h.span.class("grid size-4 shrink-0 place-items-center").children(CheckboxRoot(h, checkbox, {
|
|
2175
|
+
class: inCell ? "focus-visible:outline-none" : undefined
|
|
2176
|
+
}).attr("aria-label", label).children(CheckboxIndicator(h, checkbox, {
|
|
2119
2177
|
class: "pointer-events-none"
|
|
2120
2178
|
})))
|
|
2121
2179
|
});
|
|
@@ -2124,7 +2182,10 @@ var DataTable = Html2.component({
|
|
|
2124
2182
|
const filterColumn = draft && filterColumns.find(({ id }) => id === draft.id);
|
|
2125
2183
|
const filterKind = filterColumn && tableFilterKind(filterColumn);
|
|
2126
2184
|
const activeFilters = (query.filters ?? []).filter((filter) => filterColumns.some((column) => column.id === filter.id && tableFilterKind(column) === filter.kind));
|
|
2127
|
-
const selectFilter = (label, value, options, change) =>
|
|
2185
|
+
const selectFilter = (label, value, options, change) => FilterSelect(h, {
|
|
2186
|
+
props: { label, value, items: options },
|
|
2187
|
+
onEmit: { Changed: ({ value }) => change(value) }
|
|
2188
|
+
});
|
|
2128
2189
|
const filterInput = (label, field, value, type = "text") => h.label.class("grid gap-1 text-sm").children(label, Input(h, {
|
|
2129
2190
|
element: type === "number" ? h.input.attrs({ type: "number", step: "any" }) : h.input.attr("type", type),
|
|
2130
2191
|
props: { value },
|
|
@@ -2144,28 +2205,71 @@ var DataTable = Html2.component({
|
|
|
2144
2205
|
], filterKind === "date" && [
|
|
2145
2206
|
filterInput(copy.filterFrom, "primary", draft.primary, "date"),
|
|
2146
2207
|
filterInput(copy.filterTo, "secondary", draft.secondary, "date")
|
|
2147
|
-
],
|
|
2148
|
-
{ value: "", label: "—" },
|
|
2149
|
-
{ value: "true", label: copy.filterTrue },
|
|
2150
|
-
{ value: "false", label: copy.filterFalse }
|
|
2151
|
-
], (value) => DataTableMessage.FilterInputChanged({ field: "primary", value })), filterKind === "values" && h.fieldset.class("grid gap-1").children(h.legend.class("text-sm").children(copy.filterValue), (filterColumn.type === "list" && filterColumn.filterOptions ? filterColumn.filterOptions : tableFilterOptions(props.rowData, filterColumn.id, locale)).map(({ value, label }) => h.label.key(value).class("flex items-center gap-2 text-sm").children(h.input.attr("type", "checkbox").checked(draft.values.includes(value)).on("change", ({ checked }) => DataTableMessage.FilterValueToggled({ value, checked })), label))), model.invalidFilter && h.p.attr("role", "alert").class("text-destructive text-sm").children(copy.filterInvalid), h.div.class("flex flex-wrap gap-2").children(Button(h, {
|
|
2208
|
+
], model.invalidFilter && h.p.attr("role", "alert").class("text-destructive text-sm").children(copy.filterInvalid), h.div.class("flex flex-wrap gap-2").children(Button2(h, {
|
|
2152
2209
|
size: "sm",
|
|
2153
2210
|
onPress: DataTableMessage.FilterApplied()
|
|
2154
|
-
}).children(copy.filterApply),
|
|
2211
|
+
}).children(copy.filterApply), Button2(h, {
|
|
2155
2212
|
size: "sm",
|
|
2156
2213
|
variant: "outline",
|
|
2157
2214
|
onPress: DataTableMessage.FilterCleared()
|
|
2158
|
-
}).children(copy.filterClear)))
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2215
|
+
}).children(copy.filterClear))));
|
|
2216
|
+
const filterSubmenu = (column) => {
|
|
2217
|
+
const { id } = column;
|
|
2218
|
+
const current = activeFilters.find((filter) => filter.id === id);
|
|
2219
|
+
let children;
|
|
2220
|
+
if (column.type === "boolean") {
|
|
2221
|
+
children = [true, false].map((value) => ({
|
|
2222
|
+
id: String(value),
|
|
2223
|
+
name: value ? column.typeOptions?.trueLabel ?? copy.filterTrue : column.typeOptions?.falseLabel ?? copy.filterFalse,
|
|
2224
|
+
radio: true,
|
|
2225
|
+
checked: current?.kind === "boolean" && current.value === value,
|
|
2226
|
+
keepOpen: true,
|
|
2227
|
+
message: DataTableMessage.ColumnFilterChanged({
|
|
2228
|
+
id,
|
|
2229
|
+
filter: { id, kind: "boolean", value }
|
|
2230
|
+
})
|
|
2231
|
+
}));
|
|
2232
|
+
} else if (column.type === "list" || column.type === "text" && column.display === "badge") {
|
|
2233
|
+
const selected = current?.kind === "values" ? current.values : [];
|
|
2234
|
+
const options = column.type === "text" ? tableBadgeFilterOptions(props.rowData.map((row) => row.cells[id]), column.typeOptions) : column.filterOptions ?? tableFilterOptions(props.rowData, id, locale);
|
|
2235
|
+
children = options.map(({ value, label }) => {
|
|
2236
|
+
const checked = selected.includes(value);
|
|
2237
|
+
const values = updateSelectedRows(selected, [value], !checked);
|
|
2238
|
+
return {
|
|
2239
|
+
id: keyOf("option", value),
|
|
2240
|
+
name: label,
|
|
2241
|
+
checked,
|
|
2242
|
+
keepOpen: true,
|
|
2243
|
+
message: DataTableMessage.ColumnFilterChanged({
|
|
2244
|
+
id,
|
|
2245
|
+
filter: Arr.isArrayNonEmpty(values) ? { id, kind: "values", values } : null
|
|
2246
|
+
})
|
|
2247
|
+
};
|
|
2248
|
+
});
|
|
2249
|
+
} else {
|
|
2250
|
+
return { filterColumnId: id, filterEditor: filterPanel };
|
|
2251
|
+
}
|
|
2252
|
+
children.push({
|
|
2253
|
+
id: "clear",
|
|
2254
|
+
name: copy.filterClear,
|
|
2255
|
+
keepOpen: true,
|
|
2256
|
+
separatorBefore: children.length > 0,
|
|
2257
|
+
message: DataTableMessage.ColumnFilterChanged({ id, filter: null })
|
|
2258
|
+
});
|
|
2259
|
+
return { children };
|
|
2260
|
+
};
|
|
2163
2261
|
const cell = (column, row) => {
|
|
2164
2262
|
const value = row.cells[column.id];
|
|
2165
2263
|
const empty = column.emptyLabel ?? "—";
|
|
2166
2264
|
const disabled = row.disabledColumnIds?.includes(column.id);
|
|
2167
2265
|
const edit = (edit) => DataTableMessage.CellEditRequested({ rowId: row.id, columnId: column.id, edit });
|
|
2168
2266
|
switch (column.type) {
|
|
2267
|
+
case "text": {
|
|
2268
|
+
if (column.display !== "badge")
|
|
2269
|
+
return isTableText(value) ? value : empty;
|
|
2270
|
+
const badge = tableBadge(value, column.typeOptions);
|
|
2271
|
+
return badge ? h.span.class(cn(badgeClass, badgeVariants[badge.variant])).children(badge.option?.icon && h.span.attr("aria-hidden", "true").class("inline-flex shrink-0").children(badge.option.icon(h, { size: 12 })), badge.label) : empty;
|
|
2272
|
+
}
|
|
2169
2273
|
case "number":
|
|
2170
2274
|
return isTableNumber(value) ? formatNumberValue(value, column.typeOptions, locale) : empty;
|
|
2171
2275
|
case "date":
|
|
@@ -2174,7 +2278,7 @@ var DataTable = Html2.component({
|
|
|
2174
2278
|
return date ? h.time.attr("datetime", dateIsoValue(date)).children(formatDateValue(date, column, locale)) : empty;
|
|
2175
2279
|
}
|
|
2176
2280
|
case "boolean":
|
|
2177
|
-
return isTableBoolean(value) ? check(keyOf("edit", row.id, column.id), `${column.headerName}: ${row.label}`, value, (value) => edit(DataTableEdit.SetBoolean({ value })), { readOnly: !column.editable || disabled }) : empty;
|
|
2281
|
+
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;
|
|
2178
2282
|
case "reference":
|
|
2179
2283
|
return isTableReference(value) ? h.div.class(tableClasses.reference).children(h.span.class(cn(tableClasses.referenceAvatar, "rounded-full")).children(h.span.attr("aria-hidden", "true").children(tableInitials(value.label)), value.imageSrc && !model.failedImages.includes(value.imageSrc) && h.img.attrs({
|
|
2180
2284
|
src: value.imageSrc,
|
|
@@ -2183,6 +2287,9 @@ var DataTable = Html2.component({
|
|
|
2183
2287
|
}).class("absolute inset-0 size-full object-cover").on("error", DataTableMessage.ReferenceImageFailed({ src: value.imageSrc }))), h.div.class(tableClasses.referenceText).children(h.span.class(tableClasses.referenceName).children(value.label), value.description && h.span.class(tableClasses.referenceDescription).children(value.description))) : empty;
|
|
2184
2288
|
case "list": {
|
|
2185
2289
|
const current = isTableList(value) ? value : [];
|
|
2290
|
+
const visible = current.slice(0, column.visibleCount ?? 3);
|
|
2291
|
+
const overflow = current.length - visible.length;
|
|
2292
|
+
const badgeSummary = () => h.span.class("inline-flex min-w-0 flex-wrap items-center gap-1").children(visible.map(({ value, label }) => h.span.key(value).class(cn(badgeClass, badgeVariants.secondary)).children(label)), overflow > 0 && h.span.class(cn(badgeClass, badgeVariants.secondary)).children(`+${overflow}`));
|
|
2186
2293
|
if (column.manageLabel && !disabled && (column.options || column.allowRemove)) {
|
|
2187
2294
|
const used = new Set(current.map(({ value }) => value));
|
|
2188
2295
|
const available = (column.options ?? []).filter(({ value }) => !used.has(value));
|
|
@@ -2218,15 +2325,13 @@ var DataTable = Html2.component({
|
|
|
2218
2325
|
}
|
|
2219
2326
|
] : []
|
|
2220
2327
|
], false, undefined, false, {
|
|
2221
|
-
relationship: h.span.class("min-w-0 truncate").children(current.length ? `${current.slice(0, column.visibleCount ?? 3).map(({ label }) => label).join(", ")}${current.length > (column.visibleCount ?? 3) ? ` +${current.length - (column.visibleCount ?? 3)}` : ""}` : empty)
|
|
2328
|
+
relationship: column.display === "badge" && current.length ? badgeSummary() : h.span.class("min-w-0 truncate").children(current.length ? `${current.slice(0, column.visibleCount ?? 3).map(({ label }) => label).join(", ")}${current.length > (column.visibleCount ?? 3) ? ` +${current.length - (column.visibleCount ?? 3)}` : ""}` : empty)
|
|
2222
2329
|
}));
|
|
2223
2330
|
}
|
|
2224
2331
|
if (column.display && !column.options && !column.allowRemove) {
|
|
2225
|
-
const visible = current.slice(0, column.visibleCount ?? 3);
|
|
2226
|
-
const overflow = current.length - visible.length;
|
|
2227
2332
|
const label = column.actionsLabel ?? (column.itemActions?.length ? copy.actions : copy.listDetails);
|
|
2228
|
-
const summary = column.display === "icon" ? h.span.class("flex min-w-0 items-center gap-1 overflow-hidden").children(visible.map(({ value, label }) => h.span.key(value).attr("title", label).class("inline-grid size-7 place-items-center rounded-full bg-muted text-xs").children(tableInitials(label))), overflow > 0 && `+${overflow}`) : h.span.class("min-w-0 truncate").children(`${visible.map(({ label }) => label).join(", ")}${overflow > 0 ? ` +${overflow}` : ""}`);
|
|
2229
|
-
return !current.length ? empty :
|
|
2333
|
+
const summary = column.display === "icon" ? h.span.class("flex min-w-0 items-center gap-1 overflow-hidden").children(visible.map(({ value, label }) => h.span.key(value).attr("title", label).class("inline-grid size-7 place-items-center rounded-full bg-muted text-xs").children(tableInitials(label))), overflow > 0 && `+${overflow}`) : column.display === "badge" ? badgeSummary() : h.span.class("min-w-0 truncate").children(`${visible.map(({ label }) => label).join(", ")}${overflow > 0 ? ` +${overflow}` : ""}`);
|
|
2334
|
+
return !current.length ? empty : h.div.class("min-w-0").children(menu(keyOf("items", row.id, column.id), label, `${label}: ${row.label}`, current.map(({ value, label }) => ({
|
|
2230
2335
|
id: value,
|
|
2231
2336
|
name: label,
|
|
2232
2337
|
...column.itemActions?.length ? {
|
|
@@ -2240,11 +2345,11 @@ var DataTable = Html2.component({
|
|
|
2240
2345
|
})
|
|
2241
2346
|
}))
|
|
2242
2347
|
} : { disabled: true }
|
|
2243
|
-
})), false, undefined, false, { relationship: summary }))
|
|
2348
|
+
})), false, undefined, false, { relationship: summary }));
|
|
2244
2349
|
}
|
|
2245
2350
|
const used = new Set(current.map(({ value }) => value));
|
|
2246
2351
|
const add = (column.options ?? []).filter(({ value }) => !used.has(value));
|
|
2247
|
-
return h.div.class("grid gap-1").children(current.length > 0 ? h.ul.class("flex flex-wrap gap-1").children(current.map(({ value, label }) => h.li.key(value).class("bg-muted rounded-sm ps-2 inline-flex items-center gap-1").children(label, !!column.itemActions?.length && menu(keyOf("item", row.id, column.id, value), copy.actions, `${copy.actions}: ${label} — ${row.label}`, column.itemActions.map((action) => ({
|
|
2352
|
+
return h.div.class("grid gap-1").children(current.length > 0 ? h.ul.class("flex flex-wrap gap-1").children(current.map(({ value, label }) => h.li.key(value).class(column.display === "badge" ? cn(badgeClass, badgeVariants.secondary) : "bg-muted rounded-sm ps-2 inline-flex items-center gap-1").children(label, !!column.itemActions?.length && menu(keyOf("item", row.id, column.id, value), copy.actions, `${copy.actions}: ${label} — ${row.label}`, column.itemActions.map((action) => ({
|
|
2248
2353
|
...action,
|
|
2249
2354
|
message: DataTableMessage.ItemActionRequested({
|
|
2250
2355
|
rowId: row.id,
|
|
@@ -2252,7 +2357,7 @@ var DataTable = Html2.component({
|
|
|
2252
2357
|
itemId: value,
|
|
2253
2358
|
actionId: action.id
|
|
2254
2359
|
})
|
|
2255
|
-
}))), column.allowRemove && !disabled &&
|
|
2360
|
+
}))), column.allowRemove && !disabled && Button2(h, {
|
|
2256
2361
|
variant: "ghost",
|
|
2257
2362
|
size: "sm",
|
|
2258
2363
|
onPress: edit(DataTableEdit.RemoveItem({ itemId: value }))
|
|
@@ -2262,8 +2367,6 @@ var DataTable = Html2.component({
|
|
|
2262
2367
|
message: edit(DataTableEdit.AddItem({ itemId: value }))
|
|
2263
2368
|
})), false, copy.addItem));
|
|
2264
2369
|
}
|
|
2265
|
-
case "text":
|
|
2266
|
-
return isTableText(value) ? value : empty;
|
|
2267
2370
|
}
|
|
2268
2371
|
};
|
|
2269
2372
|
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 }));
|
|
@@ -2274,17 +2377,20 @@ var DataTable = Html2.component({
|
|
|
2274
2377
|
const renderRow = (row, siblings, key, group) => {
|
|
2275
2378
|
const primary = row.actions?.find(({ id, disabled }) => id === row.primaryActionId && !disabled);
|
|
2276
2379
|
const activate = props.rowActivation ? DataTableMessage.RowActivated({ rowId: row.id }) : primary && DataTableMessage.RowActionRequested({ rowId: row.id, actionId: primary.id });
|
|
2277
|
-
const
|
|
2278
|
-
const
|
|
2380
|
+
const tr = h.tr.key(keyOf(key, row.id)).class(cn("group/row hover:bg-muted/50 data-[selected]:bg-muted/40 border-b last:border-0", props.rowActivation && "cursor-pointer")).attr("data-selected", selected.has(row.id) ? "" : undefined);
|
|
2381
|
+
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
|
+
const ignoreActivation = () => {
|
|
2383
|
+
return;
|
|
2384
|
+
};
|
|
2279
2385
|
const drop = dropOnRow(row.id, group);
|
|
2280
|
-
return (drop ?
|
|
2281
|
-
const td = h.td.key(column.id).attr("data-slot", "table-cell").class(cn(cellClass, tableClasses.cell, column.truncate ? "whitespace-nowrap" : "whitespace-normal", column.type === "list" && "p-0", "has-[[data-slot=data-table-list-cell]]:relative has-[[data-slot=data-table-list-cell]]:h-16"));
|
|
2386
|
+
return (drop ? rowElement.dropTarget({ accepts: [RowDrag], dropEffect: "move" }).on("drop", drop) : rowElement).children(selection && h.td.class(tableClasses.selectionCell).on("click", ignoreActivation).on("keydown", ignoreActivation).children(h.div.class(tableClasses.selectionCenter).children(check(keyOf("select", key, row.id), `${copy.selectRow}: ${row.label}`, selected.has(row.id), (checked) => DataTableMessage.SelectionRequested({ rowIds: [row.id], checked }), { disabled: row.selectable === false }))), draggable && h.td.class("w-10 ps-1").on("click", ignoreActivation).on("keydown", ignoreActivation).children(dragHandle(row)), columns.map((column) => {
|
|
2387
|
+
const td = h.td.key(column.id).attr("data-slot", "table-cell").attr("data-column-id", column.id).class(cn(cellClass, tableClasses.cell, column.truncate ? "whitespace-nowrap" : "whitespace-normal", column.type === "list" && "p-0", column.type === "boolean" && "min-w-24 has-[[data-slot=data-table-boolean-cell]]:relative has-[[data-slot=data-table-boolean-cell]]:p-0", "has-[[data-slot=data-table-list-cell]]:relative has-[[data-slot=data-table-list-cell]]:h-16"));
|
|
2282
2388
|
const content = () => h.div.class(cn(tableClasses.cellContent, column.truncate && "truncate")).children(cell(column, row));
|
|
2283
|
-
if (
|
|
2284
|
-
return td.
|
|
2389
|
+
if (column.type === "list" || column.type === "boolean" && isTableBoolean(row.cells[column.id])) {
|
|
2390
|
+
return td.on("click", ignoreActivation).on("keydown", ignoreActivation).children(content());
|
|
2285
2391
|
}
|
|
2286
|
-
return (
|
|
2287
|
-
}), rowActions && h.td.class(cn(tableClasses.actionsCell, "group-data-[selected]/row:bg-muted")).children(h.div.class(tableClasses.actionsAlign).children(primary && activate &&
|
|
2392
|
+
return (!props.rowActivation && activate && column.type !== "boolean" ? td.class("cursor-pointer").on("click", activate) : td).children(content());
|
|
2393
|
+
}), rowActions && h.td.on("click", ignoreActivation).on("keydown", ignoreActivation).class(cn(tableClasses.actionsCell, "group-data-[selected]/row:bg-muted")).children(h.div.class(tableClasses.actionsAlign).children(primary && activate && Button2(h, {
|
|
2288
2394
|
variant: primary.variant === "destructive" ? "destructive" : "ghost",
|
|
2289
2395
|
size: "sm",
|
|
2290
2396
|
onPress: activate
|
|
@@ -2303,10 +2409,15 @@ var DataTable = Html2.component({
|
|
|
2303
2409
|
const activate = props.rowActivation ? DataTableMessage.RowActivated({ rowId: row.id }) : primary && DataTableMessage.RowActionRequested({ rowId: row.id, actionId: primary.id });
|
|
2304
2410
|
const card = h.article.key(keyOf(key, row.id)).class("grid content-start gap-2 rounded-lg border p-3");
|
|
2305
2411
|
const drop = dropOnRow(row.id, group);
|
|
2306
|
-
return (drop ? card.dropTarget({ accepts: [RowDrag], dropEffect: "move" }).on("drop", drop) : card).children(isTableText(image) && h.img.attrs({ src: image, alt: "", loading: "lazy" }).class("aspect-video w-full rounded object-cover"), h.h3.class("font-medium").children(activate ?
|
|
2412
|
+
return (drop ? card.dropTarget({ accepts: [RowDrag], dropEffect: "move" }).on("drop", drop) : card).children(isTableText(image) && h.img.attrs({ src: image, alt: "", loading: "lazy" }).class("aspect-video w-full rounded object-cover"), h.h3.class("font-medium").children(activate ? Button2(h, {
|
|
2307
2413
|
variant: "ghost",
|
|
2308
2414
|
onPress: activate
|
|
2309
|
-
}).children(name) : name), gallery.description && h.div.class("text-muted-foreground text-sm").children(galleryValue(gallery.description, row)), h.div.class("flex flex-wrap gap-2").children(gallery.tags?.map((id) =>
|
|
2415
|
+
}).children(name) : name), gallery.description && h.div.class("text-muted-foreground text-sm").children(galleryValue(gallery.description, row)), h.div.class("flex flex-wrap gap-2").children(gallery.tags?.map((id) => {
|
|
2416
|
+
const column = props.columnDefs.find((column) => column.id === id);
|
|
2417
|
+
if ((column?.type === "text" || column?.type === "list") && column.display === "badge")
|
|
2418
|
+
return h.div.key(id).children(cell(column, row));
|
|
2419
|
+
return h.span.key(id).class("bg-muted rounded px-2 py-1 text-xs").children(galleryValue(id, row));
|
|
2420
|
+
})), selection && check(keyOf("select", key, row.id), `${copy.selectRow}: ${row.label}`, selected.has(row.id), (checked) => DataTableMessage.SelectionRequested({ rowIds: [row.id], checked }), { disabled: row.selectable === false }), h.div.class("flex items-center justify-end gap-1").children(dragHandle(row), rowControls(row, siblings, key)));
|
|
2310
2421
|
};
|
|
2311
2422
|
const renderGroups = (members, depth, parent, parentTarget) => {
|
|
2312
2423
|
const field = grouping[depth];
|
|
@@ -2356,7 +2467,7 @@ var DataTable = Html2.component({
|
|
|
2356
2467
|
}),
|
|
2357
2468
|
props: { value: query.globalFilter ?? "" },
|
|
2358
2469
|
onUpdate: ({ value }) => DataTableMessage.SearchChanged({ value })
|
|
2359
|
-
}).attr("aria-label", copy.search), !!query.globalFilter &&
|
|
2470
|
+
}).attr("aria-label", copy.search), !!query.globalFilter && Button2(h, {
|
|
2360
2471
|
class: "absolute end-1 top-1/2 -translate-y-1/2",
|
|
2361
2472
|
size: "icon-sm",
|
|
2362
2473
|
variant: "ghost",
|
|
@@ -2368,11 +2479,11 @@ var DataTable = Html2.component({
|
|
|
2368
2479
|
message: DataTableMessage.BulkActionRequested({
|
|
2369
2480
|
actionId: action.id
|
|
2370
2481
|
})
|
|
2371
|
-
})), true, undefined, false, { selectedCount }), features.filtering && filterColumns.length > 0 && menu(keyOf("filters"),
|
|
2372
|
-
...filterColumns.map((
|
|
2373
|
-
id,
|
|
2374
|
-
name: headerName,
|
|
2375
|
-
|
|
2482
|
+
})), true, undefined, false, { selectedCount }), features.filtering && filterColumns.length > 0 && menu(keyOf("filters"), copy.filters, copy.filters, [
|
|
2483
|
+
...filterColumns.map((column) => ({
|
|
2484
|
+
id: column.id,
|
|
2485
|
+
name: column.headerName,
|
|
2486
|
+
...filterSubmenu(column)
|
|
2376
2487
|
})),
|
|
2377
2488
|
...activeFilters.length > 0 ? [
|
|
2378
2489
|
{
|
|
@@ -2382,7 +2493,10 @@ var DataTable = Html2.component({
|
|
|
2382
2493
|
message: DataTableMessage.FiltersCleared()
|
|
2383
2494
|
}
|
|
2384
2495
|
] : []
|
|
2385
|
-
], true, undefined, false, {
|
|
2496
|
+
], true, undefined, false, {
|
|
2497
|
+
toolbarIcon: "filter",
|
|
2498
|
+
filterCount: activeFilters.length
|
|
2499
|
+
}), features.sorting && sortableColumns.length > 0 && menu(keyOf("sort-toolbar"), copy.sortBy, copy.sortBy, sortableColumns.map((column) => ({
|
|
2386
2500
|
id: column.id,
|
|
2387
2501
|
name: column.headerName,
|
|
2388
2502
|
children: ["asc", "desc", null].filter((direction) => direction !== null || sort.some(({ id }) => id === column.id)).map((direction) => ({
|
|
@@ -2520,8 +2634,7 @@ var DataTable = Html2.component({
|
|
|
2520
2634
|
...filtering ? tableDataColumns([column]).filter(({ filterable }) => filterable !== false).map((field, index) => ({
|
|
2521
2635
|
id: keyOf("filter", field.id),
|
|
2522
2636
|
name: column.fields?.length ? `${copy.filters}: ${field.headerName}` : copy.filters,
|
|
2523
|
-
|
|
2524
|
-
filterEditor: filterPanel,
|
|
2637
|
+
...filterSubmenu(field),
|
|
2525
2638
|
icon: "filter",
|
|
2526
2639
|
separatorBefore: sorting && index === 0
|
|
2527
2640
|
})) : [],
|
|
@@ -2607,18 +2720,19 @@ var DataTable = Html2.component({
|
|
|
2607
2720
|
}
|
|
2608
2721
|
});
|
|
2609
2722
|
|
|
2610
|
-
// ../../src/components/effectcn/dialog.ts
|
|
2611
|
-
var DialogBackdrop = (h, dialog, options = {}) => dialog.backdrop(h.div.class(cn("fixed inset-0 bg-[color-mix(in_oklab,var(--shadow-color,#000)_45%,transparent)] transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0", options.class)));
|
|
2612
|
-
var DialogViewport = (h, dialog, options = {}) => dialog.viewport(h.div.class(cn("pointer-events-none fixed inset-0 grid place-items-center p-4", options.class)));
|
|
2613
|
-
var DialogPopup = (h, dialog, options = {}) => dialog.popup(h.div.class(cn("bg-popover text-popover-foreground pointer-events-auto relative flex max-h-full w-full max-w-[440px] flex-col gap-4 rounded-lg border p-6 text-sm shadow-lg outline-none", "transition-[opacity,scale,translate,filter] duration-200 ease-out data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0", "data-[nested-dialog-open]:-translate-y-[calc(14px*var(--nested-dialogs))] data-[nested-dialog-open]:scale-[calc(1-0.05*var(--nested-dialogs))] data-[nested-dialog-open]:brightness-95", options.class)));
|
|
2614
|
-
var DialogTitle = (h, dialog, options = {}) => dialog.title(h.h2.class(cn("m-0 border-0 p-0 text-[16px] leading-snug font-semibold tracking-tight", options.class)));
|
|
2615
|
-
|
|
2616
2723
|
// ../../src/components/webhook-delivery-table/html.ts
|
|
2724
|
+
import { buttonVariants as buttonVariants2 } from "@/components/effectcn/button";
|
|
2725
|
+
import {
|
|
2726
|
+
DialogBackdrop,
|
|
2727
|
+
DialogPopup,
|
|
2728
|
+
DialogTitle,
|
|
2729
|
+
DialogViewport
|
|
2730
|
+
} from "@/components/effectcn/dialog";
|
|
2617
2731
|
import { krakstackLocaleRead as krakstackLocaleRead3 } from "@krak-stack/registry/krakstack-provider/html";
|
|
2618
2732
|
|
|
2619
2733
|
// ../../src/components/webhook-delivery-table/index.ts
|
|
2620
2734
|
import { Schema as Schema8 } from "effect";
|
|
2621
|
-
import { Component as Component3, UiSchema as
|
|
2735
|
+
import { Component as Component3, UiSchema as UiSchema4 } from "effect/ui";
|
|
2622
2736
|
|
|
2623
2737
|
// ../../src/components/webhook-delivery-table/schema.ts
|
|
2624
2738
|
import { Schema as Schema7 } from "effect";
|
|
@@ -2746,13 +2860,13 @@ var webhookDeliveryStatusDetails = (delivery, labels, dates) => webhookDeliveryS
|
|
|
2746
2860
|
`${labels.retries}: ${delivery.retries}`,
|
|
2747
2861
|
...delivery.status === "pending" ? [`${labels.retryAt}: ${dates.format(delivery.retryAt)}`] : []
|
|
2748
2862
|
].join(" · ") : undefined;
|
|
2749
|
-
var WebhookDeliveryTableMessage =
|
|
2863
|
+
var WebhookDeliveryTableMessage = UiSchema4.TaggedEnum({
|
|
2750
2864
|
OpenPayload: { id: Schema8.String },
|
|
2751
2865
|
ClosePayload: {},
|
|
2752
2866
|
QueryChanged: { query: WebhookDeliveryQuerySchema },
|
|
2753
2867
|
ExportRequested: {}
|
|
2754
2868
|
});
|
|
2755
|
-
var Events =
|
|
2869
|
+
var Events = UiSchema4.TaggedEnum({
|
|
2756
2870
|
QueryChanged: { query: WebhookDeliveryQuerySchema },
|
|
2757
2871
|
ExportRequested: { query: WebhookDeliveryQuerySchema }
|
|
2758
2872
|
});
|
|
@@ -2925,7 +3039,7 @@ var WebhookDeliveryTable = Html3.component({
|
|
|
2925
3039
|
},
|
|
2926
3040
|
view: (dialog) => h.div(dialog.portal(h.div)?.children(DialogBackdrop(h, dialog), DialogViewport(h, dialog).children(DialogPopup(h, dialog, {
|
|
2927
3041
|
class: "max-h-[calc(100svh-2rem)] sm:max-w-4xl"
|
|
2928
|
-
}).children(DialogTitle(h, dialog).children(labels.payload), selected && links?.[selected.id]?.map(({ href, label }) => h.a.key(href).class("underline underline-offset-4").attr("href", href).children(label)), h.pre.class("min-h-0 overflow-auto rounded-md bg-muted p-4 text-sm").children(h.code.children(JSON.stringify(selected?.data ?? null, null, 2))), dialog.initialFocus(dialog.close(h.button.class(
|
|
3042
|
+
}).children(DialogTitle(h, dialog).children(labels.payload), selected && links?.[selected.id]?.map(({ href, label }) => h.a.key(href).class("underline underline-offset-4").attr("href", href).children(label)), h.pre.class("min-h-0 overflow-auto rounded-md bg-muted p-4 text-sm").children(h.code.children(JSON.stringify(selected?.data ?? null, null, 2))), dialog.initialFocus(dialog.close(h.button.class(buttonVariants2({ variant: "outline" })))).children(labels.close)))))
|
|
2929
3043
|
}));
|
|
2930
3044
|
}
|
|
2931
3045
|
});
|