@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
|
@@ -1,142 +1,18 @@
|
|
|
1
1
|
// ../../src/components/select-with-custom-input/react.tsx
|
|
2
2
|
import { useId, useRef } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { Input } from "@/components/ui/input";
|
|
4
|
+
import {
|
|
5
|
+
Select,
|
|
6
|
+
SelectContent,
|
|
7
|
+
SelectItem,
|
|
8
|
+
SelectTrigger,
|
|
9
|
+
SelectValue
|
|
10
|
+
} from "@/components/ui/select";
|
|
11
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
6
12
|
|
|
7
13
|
// ../../src/lib/utils.ts
|
|
8
14
|
import { cn } from "cn";
|
|
9
15
|
|
|
10
|
-
// ../../src/components/ui/input.tsx
|
|
11
|
-
import { jsx } from "react/jsx-runtime";
|
|
12
|
-
function Input({ className, type, ...props }) {
|
|
13
|
-
return /* @__PURE__ */ jsx(InputPrimitive, {
|
|
14
|
-
type,
|
|
15
|
-
"data-slot": "input",
|
|
16
|
-
className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
17
|
-
...props
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// ../../src/components/ui/select.tsx
|
|
22
|
-
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
23
|
-
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react";
|
|
24
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
25
|
-
"use client";
|
|
26
|
-
var Select = SelectPrimitive.Root;
|
|
27
|
-
function SelectValue({ className, ...props }) {
|
|
28
|
-
return /* @__PURE__ */ jsx2(SelectPrimitive.Value, {
|
|
29
|
-
"data-slot": "select-value",
|
|
30
|
-
className: cn("flex flex-1 text-left", className),
|
|
31
|
-
...props
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function SelectTrigger({
|
|
35
|
-
className,
|
|
36
|
-
size = "default",
|
|
37
|
-
children,
|
|
38
|
-
...props
|
|
39
|
-
}) {
|
|
40
|
-
return /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
|
|
41
|
-
"data-slot": "select-trigger",
|
|
42
|
-
"data-size": size,
|
|
43
|
-
className: cn("border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex w-fit items-center justify-between gap-1.5 rounded-md border bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
44
|
-
...props,
|
|
45
|
-
children: [
|
|
46
|
-
children,
|
|
47
|
-
/* @__PURE__ */ jsx2(SelectPrimitive.Icon, {
|
|
48
|
-
render: /* @__PURE__ */ jsx2(ChevronDownIcon, {
|
|
49
|
-
className: "text-muted-foreground pointer-events-none size-4"
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
]
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function SelectContent({
|
|
56
|
-
className,
|
|
57
|
-
children,
|
|
58
|
-
side = "bottom",
|
|
59
|
-
sideOffset = 4,
|
|
60
|
-
align = "start",
|
|
61
|
-
alignOffset = 0,
|
|
62
|
-
alignItemWithTrigger = false,
|
|
63
|
-
...props
|
|
64
|
-
}) {
|
|
65
|
-
return /* @__PURE__ */ jsx2(SelectPrimitive.Portal, {
|
|
66
|
-
children: /* @__PURE__ */ jsx2(SelectPrimitive.Positioner, {
|
|
67
|
-
side,
|
|
68
|
-
sideOffset,
|
|
69
|
-
align,
|
|
70
|
-
alignOffset,
|
|
71
|
-
alignItemWithTrigger,
|
|
72
|
-
className: "isolate z-50",
|
|
73
|
-
children: /* @__PURE__ */ jsxs(SelectPrimitive.Popup, {
|
|
74
|
-
"data-slot": "select-content",
|
|
75
|
-
"data-align-trigger": alignItemWithTrigger,
|
|
76
|
-
className: cn("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-0 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md shadow-md ring-1 duration-100 data-[align-trigger=true]:animate-none", className),
|
|
77
|
-
...props,
|
|
78
|
-
children: [
|
|
79
|
-
/* @__PURE__ */ jsx2(SelectScrollUpButton, {}),
|
|
80
|
-
/* @__PURE__ */ jsx2(SelectPrimitive.List, {
|
|
81
|
-
children
|
|
82
|
-
}),
|
|
83
|
-
/* @__PURE__ */ jsx2(SelectScrollDownButton, {})
|
|
84
|
-
]
|
|
85
|
-
})
|
|
86
|
-
})
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function SelectItem({
|
|
90
|
-
className,
|
|
91
|
-
children,
|
|
92
|
-
...props
|
|
93
|
-
}) {
|
|
94
|
-
return /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
|
|
95
|
-
"data-slot": "select-item",
|
|
96
|
-
className: cn("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
97
|
-
...props,
|
|
98
|
-
children: [
|
|
99
|
-
/* @__PURE__ */ jsx2(SelectPrimitive.ItemText, {
|
|
100
|
-
className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
|
|
101
|
-
children
|
|
102
|
-
}),
|
|
103
|
-
/* @__PURE__ */ jsx2(SelectPrimitive.ItemIndicator, {
|
|
104
|
-
render: /* @__PURE__ */ jsx2("span", {
|
|
105
|
-
className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
|
|
106
|
-
}),
|
|
107
|
-
children: /* @__PURE__ */ jsx2(CheckIcon, {
|
|
108
|
-
className: "pointer-events-none"
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
]
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function SelectScrollUpButton({
|
|
115
|
-
className,
|
|
116
|
-
...props
|
|
117
|
-
}) {
|
|
118
|
-
return /* @__PURE__ */ jsx2(SelectPrimitive.ScrollUpArrow, {
|
|
119
|
-
"data-slot": "select-scroll-up-button",
|
|
120
|
-
className: cn("bg-popover top-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
121
|
-
...props,
|
|
122
|
-
children: /* @__PURE__ */ jsx2(ChevronUpIcon, {})
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
function SelectScrollDownButton({
|
|
126
|
-
className,
|
|
127
|
-
...props
|
|
128
|
-
}) {
|
|
129
|
-
return /* @__PURE__ */ jsx2(SelectPrimitive.ScrollDownArrow, {
|
|
130
|
-
"data-slot": "select-scroll-down-button",
|
|
131
|
-
className: cn("bg-popover bottom-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
132
|
-
...props,
|
|
133
|
-
children: /* @__PURE__ */ jsx2(ChevronDownIcon, {})
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// ../../src/components/select-with-custom-input/react.tsx
|
|
138
|
-
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
139
|
-
|
|
140
16
|
// ../../src/components/select-with-custom-input/classes.ts
|
|
141
17
|
var selectWithCustomInputClasses = {
|
|
142
18
|
root: "grid min-w-0 gap-2",
|
|
@@ -245,7 +121,7 @@ var update = Component.define(selectWithCustomInputOptions).update({
|
|
|
245
121
|
});
|
|
246
122
|
|
|
247
123
|
// ../../src/components/select-with-custom-input/react.tsx
|
|
248
|
-
import { jsx
|
|
124
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
249
125
|
"use client";
|
|
250
126
|
var SelectWithCustomInput = ({
|
|
251
127
|
classes: classOverrides,
|
|
@@ -274,18 +150,18 @@ var SelectWithCustomInput = ({
|
|
|
274
150
|
const input = useRef(null);
|
|
275
151
|
const focusInput = useRef(false);
|
|
276
152
|
const describedBy = [description && `${id}-description`, error && `${id}-error`].filter(Boolean).join(" ") || undefined;
|
|
277
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
278
154
|
"data-slot": "select-with-custom-input",
|
|
279
155
|
"data-state": selected?.input ? "custom" : "preset",
|
|
280
156
|
className: cn(selectWithCustomInputClasses.root, className),
|
|
281
157
|
children: [
|
|
282
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ jsx("label", {
|
|
283
159
|
htmlFor: id,
|
|
284
160
|
"data-slot": "select-with-custom-input-label",
|
|
285
161
|
className: selectWithCustomInputClasses.label,
|
|
286
162
|
children: label
|
|
287
163
|
}),
|
|
288
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ jsxs(Select, {
|
|
289
165
|
items: options,
|
|
290
166
|
value: value?.option ?? null,
|
|
291
167
|
name,
|
|
@@ -300,17 +176,17 @@ var SelectWithCustomInput = ({
|
|
|
300
176
|
onValueChange(result);
|
|
301
177
|
},
|
|
302
178
|
children: [
|
|
303
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ jsx(SelectTrigger, {
|
|
304
180
|
id,
|
|
305
181
|
"data-component": "select-with-custom-input-trigger",
|
|
306
182
|
"aria-invalid": Boolean(error),
|
|
307
183
|
"aria-describedby": describedBy,
|
|
308
184
|
className: cn(selectWithCustomInputClasses.select, triggerClassName),
|
|
309
|
-
children: /* @__PURE__ */
|
|
185
|
+
children: /* @__PURE__ */ jsx(SelectValue, {
|
|
310
186
|
placeholder: placeholder ?? selectWithCustomInputPlaceholder(language)
|
|
311
187
|
})
|
|
312
188
|
}),
|
|
313
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ jsx(SelectContent, {
|
|
314
190
|
"data-component": "select-with-custom-input-content",
|
|
315
191
|
className: contentClassName,
|
|
316
192
|
finalFocus: () => {
|
|
@@ -318,7 +194,7 @@ var SelectWithCustomInput = ({
|
|
|
318
194
|
focusInput.current = false;
|
|
319
195
|
return target ?? true;
|
|
320
196
|
},
|
|
321
|
-
children: options.map((option) => /* @__PURE__ */
|
|
197
|
+
children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
322
198
|
value: option.value,
|
|
323
199
|
disabled: option.disabled,
|
|
324
200
|
children: option.label
|
|
@@ -326,16 +202,16 @@ var SelectWithCustomInput = ({
|
|
|
326
202
|
})
|
|
327
203
|
]
|
|
328
204
|
}),
|
|
329
|
-
selected?.input ? /* @__PURE__ */
|
|
205
|
+
selected?.input ? /* @__PURE__ */ jsxs("div", {
|
|
330
206
|
"data-slot": "select-with-custom-input-field",
|
|
331
207
|
className: selectWithCustomInputClasses.customField,
|
|
332
208
|
children: [
|
|
333
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ jsx("label", {
|
|
334
210
|
htmlFor: `${id}-custom`,
|
|
335
211
|
className: selectWithCustomInputClasses.label,
|
|
336
212
|
children: selected.input.label
|
|
337
213
|
}),
|
|
338
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ jsx(Input, {
|
|
339
215
|
ref: input,
|
|
340
216
|
id: `${id}-custom`,
|
|
341
217
|
"data-component": "select-with-custom-input-text",
|
|
@@ -359,13 +235,13 @@ var SelectWithCustomInput = ({
|
|
|
359
235
|
})
|
|
360
236
|
]
|
|
361
237
|
}) : null,
|
|
362
|
-
description ? /* @__PURE__ */
|
|
238
|
+
description ? /* @__PURE__ */ jsx("p", {
|
|
363
239
|
id: `${id}-description`,
|
|
364
240
|
"data-slot": "select-with-custom-input-description",
|
|
365
241
|
className: selectWithCustomInputClasses.hint,
|
|
366
242
|
children: description
|
|
367
243
|
}) : null,
|
|
368
|
-
error ? /* @__PURE__ */
|
|
244
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
369
245
|
id: `${id}-error`,
|
|
370
246
|
"data-slot": "select-with-custom-input-error",
|
|
371
247
|
role: "alert",
|
|
@@ -16,13 +16,13 @@ export declare const SidebarPageHeader: import("effect/ui/Component").Component<
|
|
|
16
16
|
readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
|
|
17
17
|
} | undefined;
|
|
18
18
|
}, null, never, never, never, Html.Elements, {}, "actions">;
|
|
19
|
-
declare const
|
|
19
|
+
export declare const SidebarHtmlNavItem: Schema.Struct<{
|
|
20
20
|
readonly label: Schema.String;
|
|
21
21
|
readonly href: Schema.String;
|
|
22
22
|
readonly exact: Schema.optional<Schema.Boolean>;
|
|
23
23
|
readonly badge: Schema.optional<Schema.String>;
|
|
24
24
|
readonly external: Schema.optional<Schema.Boolean>;
|
|
25
|
-
readonly icon: Schema.optional<Schema.mutable<Schema.$Array<Schema.mutable<Schema.Tuple<readonly [Schema.String, Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Union<readonly [Schema.String, Schema.Number]>>>]
|
|
25
|
+
readonly icon: Schema.optional<Schema.Union<readonly [Schema.declare<<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">, <Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">>, Schema.mutable<Schema.$Array<Schema.mutable<Schema.Tuple<readonly [Schema.String, Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Union<readonly [Schema.String, Schema.Number]>>>]>>>>]>>;
|
|
26
26
|
}>;
|
|
27
27
|
declare const Group: Schema.Struct<{
|
|
28
28
|
readonly label: Schema.String;
|
|
@@ -32,7 +32,7 @@ declare const Group: Schema.Struct<{
|
|
|
32
32
|
readonly exact: Schema.optional<Schema.Boolean>;
|
|
33
33
|
readonly badge: Schema.optional<Schema.String>;
|
|
34
34
|
readonly external: Schema.optional<Schema.Boolean>;
|
|
35
|
-
readonly icon: Schema.optional<Schema.mutable<Schema.$Array<Schema.mutable<Schema.Tuple<readonly [Schema.String, Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Union<readonly [Schema.String, Schema.Number]>>>]
|
|
35
|
+
readonly icon: Schema.optional<Schema.Union<readonly [Schema.declare<<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">, <Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">>, Schema.mutable<Schema.$Array<Schema.mutable<Schema.Tuple<readonly [Schema.String, Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Union<readonly [Schema.String, Schema.Number]>>>]>>>>]>>;
|
|
36
36
|
}>>;
|
|
37
37
|
}>;
|
|
38
38
|
declare const props: Schema.Struct<{
|
|
@@ -49,7 +49,7 @@ declare const props: Schema.Struct<{
|
|
|
49
49
|
readonly exact: Schema.optional<Schema.Boolean>;
|
|
50
50
|
readonly badge: Schema.optional<Schema.String>;
|
|
51
51
|
readonly external: Schema.optional<Schema.Boolean>;
|
|
52
|
-
readonly icon: Schema.optional<Schema.mutable<Schema.$Array<Schema.mutable<Schema.Tuple<readonly [Schema.String, Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Union<readonly [Schema.String, Schema.Number]>>>]
|
|
52
|
+
readonly icon: Schema.optional<Schema.Union<readonly [Schema.declare<<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">, <Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">>, Schema.mutable<Schema.$Array<Schema.mutable<Schema.Tuple<readonly [Schema.String, Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Union<readonly [Schema.String, Schema.Number]>>>]>>>>]>>;
|
|
53
53
|
}>>;
|
|
54
54
|
}>>;
|
|
55
55
|
readonly locale: Schema.optional<Schema.String>;
|
|
@@ -58,7 +58,8 @@ declare const props: Schema.Struct<{
|
|
|
58
58
|
}>;
|
|
59
59
|
export type SidebarLayoutProps = typeof props.Type;
|
|
60
60
|
export type NavGroup = typeof Group.Type;
|
|
61
|
-
export type NavItem = typeof
|
|
61
|
+
export type NavItem = typeof SidebarHtmlNavItem.Type;
|
|
62
|
+
export declare const desktopSidebarQuery = "(min-width: 48rem)";
|
|
62
63
|
export declare const SidebarLayout: import("effect/ui/Component").Component<"SidebarLayout", {
|
|
63
64
|
readonly classes?: {
|
|
64
65
|
readonly content?: string | undefined;
|
|
@@ -79,7 +80,7 @@ export declare const SidebarLayout: import("effect/ui/Component").Component<"Sid
|
|
|
79
80
|
readonly external?: boolean | undefined;
|
|
80
81
|
readonly icon?: [string, {
|
|
81
82
|
readonly [x: string]: string | number | undefined;
|
|
82
|
-
}][] | undefined;
|
|
83
|
+
}][] | (<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">) | undefined;
|
|
83
84
|
}[];
|
|
84
85
|
}[];
|
|
85
86
|
readonly locale?: string | undefined;
|
|
@@ -88,9 +89,18 @@ export declare const SidebarLayout: import("effect/ui/Component").Component<"Sid
|
|
|
88
89
|
}, {
|
|
89
90
|
readonly open: boolean;
|
|
90
91
|
readonly mobileOpen: boolean;
|
|
92
|
+
readonly mobile: boolean;
|
|
93
|
+
readonly tooltipHref: string | null;
|
|
91
94
|
}, {
|
|
95
|
+
readonly _tag: "SetItemTooltip";
|
|
96
|
+
readonly href: string;
|
|
97
|
+
readonly open: boolean;
|
|
98
|
+
} | {
|
|
92
99
|
readonly _tag: "SetMobileOpen";
|
|
93
100
|
readonly open: boolean;
|
|
101
|
+
} | {
|
|
102
|
+
readonly _tag: "SetMobileViewport";
|
|
103
|
+
readonly mobile: boolean;
|
|
94
104
|
} | {
|
|
95
105
|
readonly _tag: "SetOpen";
|
|
96
106
|
readonly open: boolean;
|
|
@@ -1,45 +1,19 @@
|
|
|
1
1
|
// ../../src/components/sidebar-layout/html.ts
|
|
2
|
-
import { Schema as Schema3 } from "effect";
|
|
3
|
-
import { Html } from "effect/ui/html";
|
|
4
|
-
import { Dialog } from "effect/ui/kit";
|
|
5
|
-
|
|
6
|
-
// ../../src/components/effectcn/button.ts
|
|
2
|
+
import { Predicate, Schema as Schema3 } from "effect";
|
|
3
|
+
import { Html, HtmlSubscription } from "effect/ui/html";
|
|
4
|
+
import { Dialog, Tooltip } from "effect/ui/kit";
|
|
5
|
+
import { buttonVariants } from "@/components/effectcn/button";
|
|
7
6
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
DialogBackdrop,
|
|
8
|
+
DialogPopup,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
DialogViewport
|
|
11
|
+
} from "@/components/effectcn/dialog";
|
|
12
|
+
import { PanelLeft as PanelIcon, createLucideIcon } from "@krak-stack/registry/lucide-effect";
|
|
10
13
|
|
|
11
14
|
// ../../src/lib/utils.ts
|
|
12
15
|
import { cn } from "cn";
|
|
13
16
|
|
|
14
|
-
// ../../src/components/effectcn/button.ts
|
|
15
|
-
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";
|
|
16
|
-
var variants = {
|
|
17
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/85",
|
|
18
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-accent",
|
|
19
|
-
outline: "border-input bg-background text-foreground shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
20
|
-
ghost: "text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
21
|
-
brand: "bg-brand-soft text-brand-soft-foreground hover:bg-brand-soft/85",
|
|
22
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/85",
|
|
23
|
-
link: "h-auto px-0 text-foreground underline decoration-transparent underline-offset-4 hover:decoration-current"
|
|
24
|
-
};
|
|
25
|
-
var sizes = {
|
|
26
|
-
default: "",
|
|
27
|
-
sm: "h-7 rounded-sm px-2.5 text-xs",
|
|
28
|
-
lg: "h-10 px-5 text-sm",
|
|
29
|
-
icon: "w-8.5 px-0",
|
|
30
|
-
"icon-sm": "h-7 w-7 rounded-sm px-0"
|
|
31
|
-
};
|
|
32
|
-
var buttonVariants = (options = {}) => cn(base, variants[options.variant ?? "default"], sizes[options.size ?? "default"], options.class);
|
|
33
|
-
|
|
34
|
-
// ../../src/components/effectcn/dialog.ts
|
|
35
|
-
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)));
|
|
36
|
-
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)));
|
|
37
|
-
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)));
|
|
38
|
-
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)));
|
|
39
|
-
|
|
40
|
-
// ../../src/components/sidebar-layout/html.ts
|
|
41
|
-
import { PanelLeft as PanelIcon, createLucideIcon } from "@krak-stack/registry/lucide-effect";
|
|
42
|
-
|
|
43
17
|
// ../../src/components/sidebar-layout/classes.ts
|
|
44
18
|
var sidebarLayoutClasses = {
|
|
45
19
|
header: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
|
|
@@ -120,26 +94,34 @@ var isNavItemActive = (path, item) => {
|
|
|
120
94
|
};
|
|
121
95
|
var SidebarLayoutMessage = UiSchema.TaggedEnum({
|
|
122
96
|
SetOpen: { open: Schema2.Boolean },
|
|
123
|
-
SetMobileOpen: { open: Schema2.Boolean }
|
|
97
|
+
SetMobileOpen: { open: Schema2.Boolean },
|
|
98
|
+
SetMobileViewport: { mobile: Schema2.Boolean },
|
|
99
|
+
SetItemTooltip: { href: Schema2.String, open: Schema2.Boolean }
|
|
124
100
|
}).annotate({ identifier: "SidebarLayoutMessage" });
|
|
125
101
|
var sidebarLayoutOptions = {
|
|
126
102
|
name: "SidebarLayout",
|
|
127
103
|
props: SidebarLayoutPropsSchema,
|
|
128
104
|
model: Schema2.Struct({
|
|
129
105
|
open: Schema2.Boolean,
|
|
130
|
-
mobileOpen: Schema2.Boolean
|
|
106
|
+
mobileOpen: Schema2.Boolean,
|
|
107
|
+
mobile: Schema2.Boolean,
|
|
108
|
+
tooltipHref: Schema2.NullOr(Schema2.String)
|
|
131
109
|
}).annotate({ identifier: "SidebarLayoutModel" }),
|
|
132
110
|
message: SidebarLayoutMessage,
|
|
133
111
|
restore: false
|
|
134
112
|
};
|
|
135
113
|
var update = Component.define(sidebarLayoutOptions).update({
|
|
136
|
-
SetOpen: ($, { open }) => ({ ...$.model, open }),
|
|
137
|
-
SetMobileOpen: ($, { open }) => ({ ...$.model, mobileOpen: open })
|
|
114
|
+
SetOpen: ($, { open }) => ({ ...$.model, open, tooltipHref: null }),
|
|
115
|
+
SetMobileOpen: ($, { open }) => ({ ...$.model, mobileOpen: open }),
|
|
116
|
+
SetMobileViewport: ($, { mobile }) => $.model.mobile === mobile ? $.model : { ...$.model, mobile, mobileOpen: false, tooltipHref: null },
|
|
117
|
+
SetItemTooltip: ($, { href, open }) => open && !$.model.open && !$.model.mobile ? { ...$.model, tooltipHref: href } : $.model.tooltipHref === href ? { ...$.model, tooltipHref: null } : $.model
|
|
138
118
|
});
|
|
139
119
|
var sidebarLayoutBehaviours = {
|
|
140
120
|
init: ({ props }) => ({
|
|
141
121
|
open: getSidebarDefaultOpen(props.defaultOpen ?? true),
|
|
142
|
-
mobileOpen: false
|
|
122
|
+
mobileOpen: false,
|
|
123
|
+
mobile: false,
|
|
124
|
+
tooltipHref: null
|
|
143
125
|
}),
|
|
144
126
|
update
|
|
145
127
|
};
|
|
@@ -170,13 +152,14 @@ var IconNode = Schema3.mutable(Schema3.Array(Schema3.mutable(Schema3.Tuple([
|
|
|
170
152
|
Schema3.String,
|
|
171
153
|
Schema3.Record(Schema3.String, Schema3.UndefinedOr(Schema3.Union([Schema3.String, Schema3.Number])))
|
|
172
154
|
]))));
|
|
173
|
-
var
|
|
155
|
+
var IconRenderer = Schema3.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "SidebarIconRenderer" });
|
|
156
|
+
var SidebarHtmlNavItem = NavItemSchema.mapFields((fields) => ({
|
|
174
157
|
...fields,
|
|
175
|
-
icon: Schema3.optional(IconNode)
|
|
158
|
+
icon: Schema3.optional(Schema3.Union([IconRenderer, IconNode]))
|
|
176
159
|
}));
|
|
177
160
|
var Group = Schema3.Struct({
|
|
178
161
|
label: Schema3.String,
|
|
179
|
-
items: Schema3.Array(
|
|
162
|
+
items: Schema3.Array(SidebarHtmlNavItem)
|
|
180
163
|
});
|
|
181
164
|
var props = SidebarLayoutPropsSchema.mapFields((fields) => ({
|
|
182
165
|
...fields,
|
|
@@ -185,12 +168,16 @@ var props = SidebarLayoutPropsSchema.mapFields((fields) => ({
|
|
|
185
168
|
currentPath: Schema3.optional(Schema3.String),
|
|
186
169
|
toggleLabel: Schema3.optional(Schema3.String)
|
|
187
170
|
}));
|
|
171
|
+
var desktopSidebarQuery = "(min-width: 48rem)";
|
|
188
172
|
var SidebarLayout = Html.component({
|
|
189
173
|
...sidebarLayoutOptions,
|
|
190
174
|
props,
|
|
191
175
|
slots: ["content", "sidebarHeader", "sidebarFooter", "headerActions"]
|
|
192
176
|
}).make({
|
|
193
177
|
...sidebarLayoutBehaviours,
|
|
178
|
+
subscriptions: () => [
|
|
179
|
+
HtmlSubscription.onMediaQuery(desktopSidebarQuery, (desktop) => SidebarLayoutMessage.SetMobileViewport({ mobile: !desktop }))
|
|
180
|
+
],
|
|
194
181
|
view: (h, model) => {
|
|
195
182
|
const sidebarLayoutClasses = resolveSidebarLayoutClasses(h.props.classes);
|
|
196
183
|
const {
|
|
@@ -203,30 +190,55 @@ var SidebarLayout = Html.component({
|
|
|
203
190
|
toggleLabel = locale?.startsWith("fr") ? "Afficher ou masquer la barre latérale" : "Toggle sidebar"
|
|
204
191
|
} = h.props;
|
|
205
192
|
const fixed = sidebarCollapsible === "none";
|
|
193
|
+
const mobile = model.mobile && !fixed;
|
|
206
194
|
const compact = !model.open && sidebarCollapsible === "icon";
|
|
207
|
-
const
|
|
195
|
+
const offcanvasClosed = !model.open && sidebarCollapsible === "offcanvas";
|
|
196
|
+
const rail = (narrow, mobile) => h.nav.attr("aria-label", toggleLabel).attr("inert", !mobile && offcanvasClosed ? "" : undefined).class("flex min-h-0 min-w-0 flex-1 flex-col").children(h.div.attr("data-collapsible", narrow ? "icon" : undefined).class("group shrink-0 overflow-x-clip").children(h.div.class(cn("flex flex-col gap-2 p-2 empty:hidden", !mobile && "[&_[data-slot=app-brand]]:transition-[padding] [&_[data-slot=app-brand]]:duration-200 [&_[data-slot=app-brand]]:ease-in-out motion-reduce:[&_[data-slot=app-brand]]:transition-none", narrow && "[&_[data-slot=app-brand]]:px-0", !mobile && "w-64")).children(h.slots.sidebarHeader)), h.div.attr("data-collapsible", narrow ? "icon" : undefined).class("group no-scrollbar flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden").children(groups.map((group) => h.section.key(group.label).class("flex min-w-0 flex-col p-2").children(h.h2.class(cn("text-sidebar-foreground/70 flex h-8 shrink-0 items-center px-2 text-xs font-medium", narrow && "sr-only")).children(group.label), h.ul.class("grid gap-1").children(...group.items.map((item) => {
|
|
208
197
|
const active = isNavItemActive(currentPath, item);
|
|
198
|
+
const icon = Predicate.isFunction(item.icon) ? item.icon : item.icon && createLucideIcon(item.icon);
|
|
209
199
|
const link = h.a.attrs({
|
|
210
200
|
href: item.href,
|
|
211
201
|
target: item.external ? "_blank" : undefined,
|
|
212
202
|
rel: item.external ? "noreferrer" : undefined,
|
|
213
203
|
"aria-current": active ? "page" : undefined,
|
|
214
|
-
"
|
|
215
|
-
|
|
216
|
-
}).class("hover:bg-sidebar-accent data-[active]:bg-sidebar-accent flex
|
|
217
|
-
|
|
204
|
+
"aria-label": narrow ? item.label : undefined,
|
|
205
|
+
"data-active": active ? "" : undefined
|
|
206
|
+
}).class(cn("hover:bg-sidebar-accent data-[active]:bg-sidebar-accent flex items-center rounded-md text-sm data-[active]:font-medium", narrow ? "size-8 justify-center" : "min-h-8 gap-2 p-2"));
|
|
207
|
+
const renderLink = (element) => element.children(icon ? icon(h, {
|
|
218
208
|
size: 16,
|
|
219
209
|
className: "shrink-0"
|
|
220
|
-
}) : narrow && h.span.attr("aria-hidden", "true").children(item.label.slice(0, 1)), h.span.class(narrow ? "sr-only" : "truncate").children(item.label), item.badge && !narrow && h.span.class("bg-secondary text-secondary-foreground ml-auto rounded px-2 py-0.5 text-xs").children(item.badge))
|
|
221
|
-
|
|
210
|
+
}) : narrow && h.span.attr("aria-hidden", "true").children(item.label.slice(0, 1)), h.span.class(narrow ? "sr-only" : "truncate").children(item.label), item.badge && !narrow && h.span.class("bg-secondary text-secondary-foreground ml-auto rounded px-2 py-0.5 text-xs").children(item.badge));
|
|
211
|
+
return h.li.key(item.href).children(narrow ? Tooltip(h, {
|
|
212
|
+
key: JSON.stringify([group.label, item.href]),
|
|
213
|
+
props: {
|
|
214
|
+
open: model.tooltipHref === item.href,
|
|
215
|
+
side: "right",
|
|
216
|
+
sideOffset: 8,
|
|
217
|
+
describesTrigger: false
|
|
218
|
+
},
|
|
219
|
+
onEmit: {
|
|
220
|
+
RequestedOpen: () => SidebarLayoutMessage.SetItemTooltip({
|
|
221
|
+
href: item.href,
|
|
222
|
+
open: true
|
|
223
|
+
}),
|
|
224
|
+
RequestedClose: () => SidebarLayoutMessage.SetItemTooltip({
|
|
225
|
+
href: item.href,
|
|
226
|
+
open: false
|
|
227
|
+
})
|
|
228
|
+
},
|
|
229
|
+
view: (tooltip) => h.div.children(renderLink(tooltip.trigger(link)), tooltip.positioner(h.div.class("z-50 overflow-visible border-0 bg-transparent p-0")).children(tooltip.popup(h.div.class("bg-foreground text-background rounded-md px-2 py-1 text-xs")).children(item.label)))
|
|
230
|
+
}) : renderLink(mobile ? link.on("click", SidebarLayoutMessage.SetMobileOpen({ open: false })) : link));
|
|
231
|
+
}))))), h.div.attr("data-collapsible", narrow ? "icon" : undefined).class("group flex flex-col gap-2 p-2 empty:hidden").children(h.slots.sidebarFooter));
|
|
232
|
+
const toggleDesktop = () => {
|
|
233
|
+
persistSidebar(!model.open);
|
|
234
|
+
return SidebarLayoutMessage.SetOpen({ open: !model.open });
|
|
235
|
+
};
|
|
222
236
|
const toggle = h.button.class(buttonVariants({ variant: "ghost", size: "icon-sm" })).attrs({
|
|
223
237
|
type: "button",
|
|
224
|
-
"aria-label": toggleLabel
|
|
225
|
-
"aria-controls": h.id("sidebar"),
|
|
226
|
-
"aria-expanded": model.open ? "true" : "false"
|
|
238
|
+
"aria-label": toggleLabel
|
|
227
239
|
});
|
|
228
240
|
return Dialog(h, {
|
|
229
|
-
props: { open: model.mobileOpen
|
|
241
|
+
props: { open: mobile && model.mobileOpen },
|
|
230
242
|
onEmit: {
|
|
231
243
|
RequestedOpen: () => SidebarLayoutMessage.SetMobileOpen({ open: true }),
|
|
232
244
|
RequestedClose: () => SidebarLayoutMessage.SetMobileOpen({ open: false }),
|
|
@@ -234,28 +246,30 @@ var SidebarLayout = Html.component({
|
|
|
234
246
|
return;
|
|
235
247
|
}
|
|
236
248
|
},
|
|
237
|
-
view: (dialog) => h.div.class(cn("flex min-h-svh min-w-0", fullPage && sidebarLayoutClasses.desktopViewport)).children(h.aside.attr("id", h.id("sidebar")).class(cn("bg-sidebar text-sidebar-foreground sticky top-0 h-svh shrink-0 flex-col border-r", fixed ? "flex w-64" : model.open ? "hidden w-64 md:flex" : compact ? "hidden w-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
})
|
|
249
|
+
view: (dialog) => h.div.class(cn("flex min-h-svh min-w-0", fullPage && sidebarLayoutClasses.desktopViewport)).children(!mobile && h.aside.attr("id", h.id("sidebar")).class(cn("bg-sidebar text-sidebar-foreground sticky top-0 z-20 h-svh shrink-0 flex-col border-r transition-[width] duration-200 ease-in-out motion-reduce:transition-none", fixed ? "flex w-64" : model.open ? "hidden w-64 md:flex" : compact ? "hidden w-12 md:flex" : "hidden w-0 border-r-0 md:flex")).children(rail(compact, false), !fixed && h.button.attrs({
|
|
250
|
+
type: "button",
|
|
251
|
+
tabindex: "-1",
|
|
252
|
+
title: toggleLabel,
|
|
253
|
+
"aria-label": toggleLabel,
|
|
254
|
+
"aria-controls": h.id("sidebar"),
|
|
255
|
+
"aria-expanded": model.open ? "true" : "false",
|
|
256
|
+
"data-sidebar": "rail"
|
|
257
|
+
}).class(cn("hover:after:bg-sidebar-border absolute inset-y-0 -right-2 w-4 after:absolute after:inset-y-0 after:left-1/2 after:w-0.5", model.open ? "cursor-w-resize" : "cursor-e-resize")).on("click", toggleDesktop)), h.main.class("min-w-0 flex-1 overflow-x-clip").children(h.header.class("bg-background/95 sticky top-0 z-10 flex h-14 items-center gap-2 border-b px-4 backdrop-blur").children(!fixed && (mobile ? dialog.trigger(toggle) : toggle.attrs({
|
|
258
|
+
"aria-controls": h.id("sidebar"),
|
|
259
|
+
"aria-expanded": model.open ? "true" : "false"
|
|
260
|
+
}).on("click", toggleDesktop)).children(PanelIcon(h, { size: 16 })), h.div.class(sidebarLayoutClasses.toolbar).children(h.slots.headerActions)), h.div.class(cn(sidebarLayoutClasses.content, contentClassName ?? "flex flex-col gap-6 px-5 py-6 md:px-8")).children(h.slots.content)), mobile && dialog.portal(h.div)?.children(DialogBackdrop(h, dialog, {
|
|
249
261
|
class: "motion-reduce:transition-none"
|
|
250
262
|
}), DialogViewport(h, dialog, {
|
|
251
263
|
class: "place-items-stretch justify-items-start p-0"
|
|
252
264
|
}).children(DialogPopup(h, dialog, {
|
|
253
|
-
class: "bg-sidebar text-sidebar-foreground h-full w-
|
|
265
|
+
class: "bg-sidebar text-sidebar-foreground h-full w-72 max-w-full rounded-none p-0 transition-transform duration-200 ease-in-out data-[starting-style]:-translate-x-full data-[ending-style]:-translate-x-full data-[starting-style]:scale-100 data-[ending-style]:scale-100 data-[starting-style]:opacity-100 data-[ending-style]:opacity-100 motion-reduce:transition-none"
|
|
254
266
|
}).children(DialogTitle(h, dialog, { class: "sr-only" }).children(toggleLabel), rail(false, true)))))
|
|
255
267
|
});
|
|
256
268
|
}
|
|
257
269
|
});
|
|
258
270
|
export {
|
|
271
|
+
SidebarHtmlNavItem,
|
|
259
272
|
SidebarLayout,
|
|
260
|
-
SidebarPageHeader
|
|
273
|
+
SidebarPageHeader,
|
|
274
|
+
desktopSidebarQuery
|
|
261
275
|
};
|
|
@@ -5,9 +5,16 @@ export declare const getSidebarDefaultOpen: (defaultOpen: boolean) => boolean;
|
|
|
5
5
|
export declare const persistSidebar: (open: boolean) => void;
|
|
6
6
|
export declare const isNavItemActive: (path: string | undefined, item: NavItem) => boolean;
|
|
7
7
|
export declare const SidebarLayoutMessage: UiSchema.TaggedEnum<{
|
|
8
|
+
readonly SetItemTooltip: Schema.TaggedStruct<"SetItemTooltip", {
|
|
9
|
+
readonly href: Schema.String;
|
|
10
|
+
readonly open: Schema.Boolean;
|
|
11
|
+
}>;
|
|
8
12
|
readonly SetMobileOpen: Schema.TaggedStruct<"SetMobileOpen", {
|
|
9
13
|
readonly open: Schema.Boolean;
|
|
10
14
|
}>;
|
|
15
|
+
readonly SetMobileViewport: Schema.TaggedStruct<"SetMobileViewport", {
|
|
16
|
+
readonly mobile: Schema.Boolean;
|
|
17
|
+
}>;
|
|
11
18
|
readonly SetOpen: Schema.TaggedStruct<"SetOpen", {
|
|
12
19
|
readonly open: Schema.Boolean;
|
|
13
20
|
}>;
|
|
@@ -34,11 +41,20 @@ export declare const sidebarLayoutOptions: {
|
|
|
34
41
|
readonly model: Schema.Struct<{
|
|
35
42
|
readonly open: Schema.Boolean;
|
|
36
43
|
readonly mobileOpen: Schema.Boolean;
|
|
44
|
+
readonly mobile: Schema.Boolean;
|
|
45
|
+
readonly tooltipHref: Schema.NullOr<Schema.String>;
|
|
37
46
|
}>;
|
|
38
47
|
readonly message: UiSchema.TaggedEnum<{
|
|
48
|
+
readonly SetItemTooltip: Schema.TaggedStruct<"SetItemTooltip", {
|
|
49
|
+
readonly href: Schema.String;
|
|
50
|
+
readonly open: Schema.Boolean;
|
|
51
|
+
}>;
|
|
39
52
|
readonly SetMobileOpen: Schema.TaggedStruct<"SetMobileOpen", {
|
|
40
53
|
readonly open: Schema.Boolean;
|
|
41
54
|
}>;
|
|
55
|
+
readonly SetMobileViewport: Schema.TaggedStruct<"SetMobileViewport", {
|
|
56
|
+
readonly mobile: Schema.Boolean;
|
|
57
|
+
}>;
|
|
42
58
|
readonly SetOpen: Schema.TaggedStruct<"SetOpen", {
|
|
43
59
|
readonly open: Schema.Boolean;
|
|
44
60
|
}>;
|