@middag-io/react 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +28 -8
  2. package/dist-lib/base/shell/AuthShell.js +39 -0
  3. package/dist-lib/base/shell/BasicShell.js +207 -0
  4. package/dist-lib/base/shell/ImmersiveShell.js +55 -0
  5. package/dist-lib/base/shell/partials/InspectorContext.js +60 -0
  6. package/dist-lib/base/shell/partials/InspectorPanel.js +22 -0
  7. package/dist-lib/base/shell/partials/NavErrorBoundary.js +66 -0
  8. package/dist-lib/base/shell/partials/OverlayScreen.js +36 -0
  9. package/dist-lib/base/shell/partials/PageActionButton.js +4 -0
  10. package/dist-lib/base/theme/appearance.js +39 -0
  11. package/dist-lib/base/theme/host-layout-detector.js +39 -0
  12. package/dist-lib/base/theme/host-theme-detector.js +131 -0
  13. package/dist-lib/base/theme/sidebar-safelist.txt +20 -0
  14. package/dist-lib/base/theme/tailwind-theme.css +136 -0
  15. package/dist-lib/base/theme/theme-bridge.css +164 -0
  16. package/dist-lib/base/theme/theme-context.js +103 -0
  17. package/dist-lib/base/theme/themes/classic.css +174 -0
  18. package/dist-lib/base/theme/tokens.css +290 -0
  19. package/dist-lib/base/theme/useHostTheme.js +34 -0
  20. package/dist-lib/base/utils/clipboard.js +16 -0
  21. package/dist-lib/base/utils/conditions.js +13 -0
  22. package/dist-lib/base/utils/icon-registry.js +16 -0
  23. package/dist-lib/base/utils/icons.js +11 -0
  24. package/dist-lib/base/utils/interpolate.js +6 -0
  25. package/dist-lib/base/utils/register-default-icons.js +9 -0
  26. package/dist-lib/base/utils/storage.js +30 -0
  27. package/dist-lib/base/utils/time.js +59 -0
  28. package/dist-lib/chunks/subpath-BD_PKGUX.js +146 -0
  29. package/dist-lib/chunks/subpath-DLFO_UGQ.js +604 -0
  30. package/dist-lib/components/reui/accordion.js +43 -0
  31. package/dist-lib/components/reui/alert-dialog.js +101 -0
  32. package/dist-lib/components/reui/alert.js +55 -0
  33. package/dist-lib/components/reui/aspect-ratio.js +11 -0
  34. package/dist-lib/components/reui/autocomplete.js +170 -0
  35. package/dist-lib/components/reui/avatar.js +51 -0
  36. package/dist-lib/components/reui/badge.js +64 -0
  37. package/dist-lib/components/reui/breadcrumb.js +69 -0
  38. package/dist-lib/components/reui/button-group.js +38 -0
  39. package/dist-lib/components/reui/button.js +47 -0
  40. package/dist-lib/components/reui/calendar.js +89 -0
  41. package/dist-lib/components/reui/card.js +55 -0
  42. package/dist-lib/components/reui/carousel.js +110 -0
  43. package/dist-lib/components/reui/chart.js +130 -0
  44. package/dist-lib/components/reui/checkbox.js +20 -0
  45. package/dist-lib/components/reui/collapsible.js +23 -0
  46. package/dist-lib/components/reui/combobox.js +166 -0
  47. package/dist-lib/components/reui/command.js +85 -0
  48. package/dist-lib/components/reui/context-menu.js +121 -0
  49. package/dist-lib/components/reui/data-grid/data-grid-column-filter.js +108 -0
  50. package/dist-lib/components/reui/data-grid/data-grid-column-header.js +217 -0
  51. package/dist-lib/components/reui/data-grid/data-grid-column-visibility.js +25 -0
  52. package/dist-lib/components/reui/data-grid/data-grid-pagination.js +132 -0
  53. package/dist-lib/components/reui/data-grid/data-grid-scroll-area.js +183 -0
  54. package/dist-lib/components/reui/data-grid/data-grid-table-dnd-rows.js +125 -0
  55. package/dist-lib/components/reui/data-grid/data-grid-table-dnd.js +130 -0
  56. package/dist-lib/components/reui/data-grid/data-grid-table-virtual.js +156 -0
  57. package/dist-lib/components/reui/data-grid/data-grid-table.js +546 -0
  58. package/dist-lib/components/reui/data-grid/data-grid.js +113 -0
  59. package/dist-lib/components/reui/data-grid-pagination.js +131 -0
  60. package/dist-lib/components/reui/date-selector.js +642 -0
  61. package/dist-lib/components/reui/dialog.js +94 -0
  62. package/dist-lib/components/reui/drawer.js +77 -0
  63. package/dist-lib/components/reui/dropdown-menu.js +123 -0
  64. package/dist-lib/components/reui/empty.js +59 -0
  65. package/dist-lib/components/reui/field.js +115 -0
  66. package/dist-lib/components/reui/filters.js +873 -0
  67. package/dist-lib/components/reui/frame.js +97 -0
  68. package/dist-lib/components/reui/hover-card.js +31 -0
  69. package/dist-lib/components/reui/icon-placeholder.js +14 -0
  70. package/dist-lib/components/reui/index.js +18 -0
  71. package/dist-lib/components/reui/input-group.js +78 -0
  72. package/dist-lib/components/reui/input-otp.js +44 -0
  73. package/dist-lib/components/reui/input.js +14 -0
  74. package/dist-lib/components/reui/item.js +116 -0
  75. package/dist-lib/components/reui/kanban.js +316 -0
  76. package/dist-lib/components/reui/kbd.js +19 -0
  77. package/dist-lib/components/reui/label.js +14 -0
  78. package/dist-lib/components/reui/menubar.js +132 -0
  79. package/dist-lib/components/reui/native-select.js +37 -0
  80. package/dist-lib/components/reui/navigation-menu.js +80 -0
  81. package/dist-lib/components/reui/number-field.js +126 -0
  82. package/dist-lib/components/reui/pagination.js +78 -0
  83. package/dist-lib/components/reui/phone-input.js +124 -0
  84. package/dist-lib/components/reui/popover.js +55 -0
  85. package/dist-lib/components/reui/progress.js +20 -0
  86. package/dist-lib/components/reui/radio-group.js +27 -0
  87. package/dist-lib/components/reui/rating.js +81 -0
  88. package/dist-lib/components/reui/resizable.js +31 -0
  89. package/dist-lib/components/reui/scroll-area.js +36 -0
  90. package/dist-lib/components/reui/scrollspy.js +104 -0
  91. package/dist-lib/components/reui/select.js +97 -0
  92. package/dist-lib/components/reui/separator.js +17 -0
  93. package/dist-lib/components/reui/sheet.js +81 -0
  94. package/dist-lib/components/reui/sidebar.js +350 -0
  95. package/dist-lib/components/reui/skeleton.js +12 -0
  96. package/dist-lib/components/reui/slider.js +35 -0
  97. package/dist-lib/components/reui/sonner.js +28 -0
  98. package/dist-lib/components/reui/sortable.js +172 -0
  99. package/dist-lib/components/reui/spinner.js +14 -0
  100. package/dist-lib/components/reui/stepper.js +193 -0
  101. package/dist-lib/components/reui/svgs/claudeAiIcon.js +13 -0
  102. package/dist-lib/components/reui/svgs/gemini.js +257 -0
  103. package/dist-lib/components/reui/svgs/openai.js +10 -0
  104. package/dist-lib/components/reui/svgs/openaiDark.js +13 -0
  105. package/dist-lib/components/reui/switch.js +19 -0
  106. package/dist-lib/components/reui/table.js +66 -0
  107. package/dist-lib/components/reui/tabs.js +47 -0
  108. package/dist-lib/components/reui/textarea.js +13 -0
  109. package/dist-lib/components/reui/timeline.js +84 -0
  110. package/dist-lib/components/reui/toggle-group.js +48 -0
  111. package/dist-lib/components/reui/toggle.js +36 -0
  112. package/dist-lib/components/reui/tooltip.js +35 -0
  113. package/dist-lib/components/reui/tree.js +102 -0
  114. package/dist-lib/i18n/I18nProvider.js +23 -0
  115. package/dist-lib/i18n/host-resolver.js +10 -0
  116. package/dist-lib/i18n/instance.js +2 -0
  117. package/dist-lib/i18n/locales/en/ui.json +266 -0
  118. package/dist-lib/i18n/locales/en/validators.json +13 -0
  119. package/dist-lib/i18n/locales/pt-BR/ui.json +266 -0
  120. package/dist-lib/i18n/locales/pt-BR/validators.json +13 -0
  121. package/dist-lib/i18n/register-strings.js +7 -0
  122. package/dist-lib/i18n/render-label.js +13 -0
  123. package/dist-lib/i18n/resolve-field-error.js +10 -0
  124. package/dist-lib/i18n/useHostString.js +31 -0
  125. package/dist-lib/i18n/useTranslation.js +48 -0
  126. package/dist-lib/lib/actions/resolve-action-target.js +48 -0
  127. package/dist-lib/lib/hooks/use-copy-to-clipboard.js +18 -0
  128. package/dist-lib/lib/hooks/use-file-upload.js +171 -0
  129. package/dist-lib/lib/hooks/use-mobile.js +18 -0
  130. package/dist-lib/lib/portal-container.js +7 -0
  131. package/dist-lib/lib/utils.js +8 -0
  132. package/dist-lib/middag-react.css +1 -1
  133. package/package.json +41 -8
@@ -0,0 +1,85 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import { Dialog as t, DialogContent as n, DialogDescription as r, DialogHeader as i, DialogTitle as a } from "./dialog.js";
3
+ import "react";
4
+ import { SearchIcon as o } from "lucide-react";
5
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ import { Command as l } from "cmdk";
7
+ //#region src/components/reui/command.tsx
8
+ function u({ className: t, ...n }) {
9
+ return /* @__PURE__ */ s(l, {
10
+ "data-slot": "command",
11
+ className: e("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", t),
12
+ ...n
13
+ });
14
+ }
15
+ function d({ title: o = "Command Palette", description: l = "Search for a command to run...", children: d, className: f, showCloseButton: p = !0, ...m }) {
16
+ return /* @__PURE__ */ c(t, {
17
+ ...m,
18
+ children: [/* @__PURE__ */ c(i, {
19
+ className: "sr-only",
20
+ children: [/* @__PURE__ */ s(a, { children: o }), /* @__PURE__ */ s(r, { children: l })]
21
+ }), /* @__PURE__ */ s(n, {
22
+ className: e("overflow-hidden p-0", f),
23
+ showCloseButton: p,
24
+ children: /* @__PURE__ */ s(u, {
25
+ className: "**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
26
+ children: d
27
+ })
28
+ })]
29
+ });
30
+ }
31
+ function f({ className: t, ...n }) {
32
+ return /* @__PURE__ */ c("div", {
33
+ "data-slot": "command-input-wrapper",
34
+ className: "flex h-9 items-center gap-2 border-b px-3",
35
+ children: [/* @__PURE__ */ s(o, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ s(l.Input, {
36
+ "data-slot": "command-input",
37
+ className: e("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", t),
38
+ ...n
39
+ })]
40
+ });
41
+ }
42
+ function p({ className: t, ...n }) {
43
+ return /* @__PURE__ */ s(l.List, {
44
+ "data-slot": "command-list",
45
+ className: e("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", t),
46
+ ...n
47
+ });
48
+ }
49
+ function m({ ...e }) {
50
+ return /* @__PURE__ */ s(l.Empty, {
51
+ "data-slot": "command-empty",
52
+ className: "py-6 text-center text-sm",
53
+ ...e
54
+ });
55
+ }
56
+ function h({ className: t, ...n }) {
57
+ return /* @__PURE__ */ s(l.Group, {
58
+ "data-slot": "command-group",
59
+ className: e("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", t),
60
+ ...n
61
+ });
62
+ }
63
+ function g({ className: t, ...n }) {
64
+ return /* @__PURE__ */ s(l.Separator, {
65
+ "data-slot": "command-separator",
66
+ className: e("-mx-1 h-px bg-border", t),
67
+ ...n
68
+ });
69
+ }
70
+ function _({ className: t, ...n }) {
71
+ return /* @__PURE__ */ s(l.Item, {
72
+ "data-slot": "command-item",
73
+ className: e("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", t),
74
+ ...n
75
+ });
76
+ }
77
+ function v({ className: t, ...n }) {
78
+ return /* @__PURE__ */ s("span", {
79
+ "data-slot": "command-shortcut",
80
+ className: e("ml-auto text-xs tracking-widest text-muted-foreground", t),
81
+ ...n
82
+ });
83
+ }
84
+ //#endregion
85
+ export { u as Command, d as CommandDialog, m as CommandEmpty, h as CommandGroup, f as CommandInput, _ as CommandItem, p as CommandList, g as CommandSeparator, v as CommandShortcut };
@@ -0,0 +1,121 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import "react";
3
+ import { CheckIcon as t, ChevronRightIcon as n, CircleIcon as r } from "lucide-react";
4
+ import { ContextMenu as i } from "radix-ui";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ //#region src/components/reui/context-menu.tsx
7
+ function s({ ...e }) {
8
+ return /* @__PURE__ */ a(i.Root, {
9
+ "data-slot": "context-menu",
10
+ ...e
11
+ });
12
+ }
13
+ function c({ ...e }) {
14
+ return /* @__PURE__ */ a(i.Trigger, {
15
+ "data-slot": "context-menu-trigger",
16
+ ...e
17
+ });
18
+ }
19
+ function l({ ...e }) {
20
+ return /* @__PURE__ */ a(i.Group, {
21
+ "data-slot": "context-menu-group",
22
+ ...e
23
+ });
24
+ }
25
+ function u({ ...e }) {
26
+ return /* @__PURE__ */ a(i.Portal, {
27
+ "data-slot": "context-menu-portal",
28
+ ...e
29
+ });
30
+ }
31
+ function d({ ...e }) {
32
+ return /* @__PURE__ */ a(i.Sub, {
33
+ "data-slot": "context-menu-sub",
34
+ ...e
35
+ });
36
+ }
37
+ function f({ ...e }) {
38
+ return /* @__PURE__ */ a(i.RadioGroup, {
39
+ "data-slot": "context-menu-radio-group",
40
+ ...e
41
+ });
42
+ }
43
+ function p({ className: t, inset: r, children: s, ...c }) {
44
+ return /* @__PURE__ */ o(i.SubTrigger, {
45
+ "data-slot": "context-menu-sub-trigger",
46
+ "data-inset": r,
47
+ className: e("flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", t),
48
+ ...c,
49
+ children: [s, /* @__PURE__ */ a(n, { className: "ml-auto" })]
50
+ });
51
+ }
52
+ function m({ className: t, ...n }) {
53
+ return /* @__PURE__ */ a(i.SubContent, {
54
+ "data-slot": "context-menu-sub-content",
55
+ className: e("z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", t),
56
+ ...n
57
+ });
58
+ }
59
+ function h({ className: t, ...n }) {
60
+ return /* @__PURE__ */ a(i.Portal, { children: /* @__PURE__ */ a(i.Content, {
61
+ "data-slot": "context-menu-content",
62
+ className: e("z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", t),
63
+ ...n
64
+ }) });
65
+ }
66
+ function g({ className: t, inset: n, variant: r = "default", ...o }) {
67
+ return /* @__PURE__ */ a(i.Item, {
68
+ "data-slot": "context-menu-item",
69
+ "data-inset": n,
70
+ "data-variant": r,
71
+ className: e("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!", t),
72
+ ...o
73
+ });
74
+ }
75
+ function _({ className: n, children: r, checked: s, ...c }) {
76
+ return /* @__PURE__ */ o(i.CheckboxItem, {
77
+ "data-slot": "context-menu-checkbox-item",
78
+ className: e("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", n),
79
+ checked: s,
80
+ ...c,
81
+ children: [/* @__PURE__ */ a("span", {
82
+ className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
83
+ children: /* @__PURE__ */ a(i.ItemIndicator, { children: /* @__PURE__ */ a(t, { className: "size-4" }) })
84
+ }), r]
85
+ });
86
+ }
87
+ function v({ className: t, children: n, ...s }) {
88
+ return /* @__PURE__ */ o(i.RadioItem, {
89
+ "data-slot": "context-menu-radio-item",
90
+ className: e("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", t),
91
+ ...s,
92
+ children: [/* @__PURE__ */ a("span", {
93
+ className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
94
+ children: /* @__PURE__ */ a(i.ItemIndicator, { children: /* @__PURE__ */ a(r, { className: "size-2 fill-current" }) })
95
+ }), n]
96
+ });
97
+ }
98
+ function y({ className: t, inset: n, ...r }) {
99
+ return /* @__PURE__ */ a(i.Label, {
100
+ "data-slot": "context-menu-label",
101
+ "data-inset": n,
102
+ className: e("px-2 py-1.5 text-sm font-medium text-foreground data-[inset]:pl-8", t),
103
+ ...r
104
+ });
105
+ }
106
+ function b({ className: t, ...n }) {
107
+ return /* @__PURE__ */ a(i.Separator, {
108
+ "data-slot": "context-menu-separator",
109
+ className: e("-mx-1 my-1 h-px bg-border", t),
110
+ ...n
111
+ });
112
+ }
113
+ function x({ className: t, ...n }) {
114
+ return /* @__PURE__ */ a("span", {
115
+ "data-slot": "context-menu-shortcut",
116
+ className: e("ml-auto text-xs tracking-widest text-muted-foreground", t),
117
+ ...n
118
+ });
119
+ }
120
+ //#endregion
121
+ export { s as ContextMenu, _ as ContextMenuCheckboxItem, h as ContextMenuContent, l as ContextMenuGroup, g as ContextMenuItem, y as ContextMenuLabel, u as ContextMenuPortal, f as ContextMenuRadioGroup, v as ContextMenuRadioItem, b as ContextMenuSeparator, x as ContextMenuShortcut, d as ContextMenuSub, m as ContextMenuSubContent, p as ContextMenuSubTrigger, c as ContextMenuTrigger };
@@ -0,0 +1,108 @@
1
+ import { cn as e } from "../../../lib/utils.js";
2
+ import { Button as t } from "../button.js";
3
+ import { Badge as n } from "../badge.js";
4
+ import { Separator as r } from "../separator.js";
5
+ import { Input as i } from "../input.js";
6
+ import { Popover as a, PopoverContent as o, PopoverTrigger as s } from "../popover.js";
7
+ import { useMemo as c, useState as l } from "react";
8
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ import { HugeiconsIcon as p } from "@hugeicons/react";
10
+ import { AddCircleIcon as m, Tick02Icon as h } from "@hugeicons/core-free-icons";
11
+ //#region src/components/reui/data-grid/data-grid-column-filter.tsx
12
+ function g({ column: g, title: _, options: v }) {
13
+ let y = g?.getFacetedUniqueValues(), b = new Set(g?.getFilterValue()), [x, S] = l(""), C = c(() => x ? v.filter((e) => e.label.toLowerCase().includes(x.toLowerCase())) : v, [v, x]);
14
+ return /* @__PURE__ */ f(a, { children: [/* @__PURE__ */ d(s, {
15
+ asChild: !0,
16
+ children: /* @__PURE__ */ f(t, {
17
+ variant: "outline",
18
+ size: "sm",
19
+ children: [
20
+ /* @__PURE__ */ d(p, {
21
+ icon: m,
22
+ strokeWidth: 2,
23
+ className: "size-4"
24
+ }),
25
+ _,
26
+ b?.size > 0 && /* @__PURE__ */ f(u, { children: [
27
+ /* @__PURE__ */ d(r, {
28
+ orientation: "vertical",
29
+ className: "mx-2 h-4"
30
+ }),
31
+ /* @__PURE__ */ d(n, {
32
+ variant: "secondary",
33
+ className: "rounded-sm px-1 font-normal lg:hidden",
34
+ children: b.size
35
+ }),
36
+ /* @__PURE__ */ d("div", {
37
+ className: "hidden space-x-1 lg:flex",
38
+ children: b.size > 2 ? /* @__PURE__ */ f(n, {
39
+ variant: "secondary",
40
+ className: "rounded-sm px-1 font-normal",
41
+ children: [b.size, " selected"]
42
+ }) : v.filter((e) => b.has(e.value)).map((e) => /* @__PURE__ */ d(n, {
43
+ variant: "secondary",
44
+ className: "rounded-sm px-1 font-normal",
45
+ children: e.label
46
+ }, e.value))
47
+ })
48
+ ] })
49
+ ]
50
+ })
51
+ }), /* @__PURE__ */ f(o, {
52
+ className: "w-[200px] p-0",
53
+ align: "start",
54
+ children: [/* @__PURE__ */ d("div", {
55
+ className: "p-2",
56
+ children: /* @__PURE__ */ d(i, {
57
+ placeholder: _,
58
+ value: x,
59
+ onChange: (e) => S(e.target.value),
60
+ className: "h-8"
61
+ })
62
+ }), /* @__PURE__ */ f("div", {
63
+ className: "max-h-[300px] overflow-y-auto",
64
+ children: [C.length === 0 ? /* @__PURE__ */ d("div", {
65
+ className: "text-muted-foreground py-6 text-center text-sm",
66
+ children: "No results found."
67
+ }) : /* @__PURE__ */ d("div", {
68
+ className: "p-1",
69
+ children: C.map((t) => {
70
+ let n = b.has(t.value);
71
+ return /* @__PURE__ */ f("div", {
72
+ onClick: () => {
73
+ n ? b.delete(t.value) : b.add(t.value);
74
+ let e = Array.from(b);
75
+ g?.setFilterValue(e.length ? e : void 0);
76
+ },
77
+ className: e("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none", "hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"),
78
+ children: [
79
+ /* @__PURE__ */ d("div", {
80
+ className: e("border-primary me-2 flex h-4 w-4 items-center justify-center rounded-sm border", n ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"),
81
+ children: /* @__PURE__ */ d(p, {
82
+ icon: h,
83
+ strokeWidth: 2,
84
+ className: "h-4 w-4"
85
+ })
86
+ }),
87
+ t.icon && /* @__PURE__ */ d(t.icon, { className: "text-muted-foreground mr-2 h-4 w-4" }),
88
+ /* @__PURE__ */ d("span", { children: t.label }),
89
+ y?.get(t.value) && /* @__PURE__ */ d("span", {
90
+ className: "ms-auto flex h-4 w-4 items-center justify-center font-mono text-xs",
91
+ children: y.get(t.value)
92
+ })
93
+ ]
94
+ }, t.value);
95
+ })
96
+ }), b.size > 0 && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", { className: "bg-border -mx-1 my-1 h-px" }), /* @__PURE__ */ d("div", {
97
+ className: "p-1",
98
+ children: /* @__PURE__ */ d("div", {
99
+ onClick: () => g?.setFilterValue(void 0),
100
+ className: "hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center justify-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none",
101
+ children: "Clear filters"
102
+ })
103
+ })] })]
104
+ })]
105
+ })] });
106
+ }
107
+ //#endregion
108
+ export { g as DataGridColumnFilter };
@@ -0,0 +1,217 @@
1
+ "use client";
2
+ import { cn as e } from "../../../lib/utils.js";
3
+ import { Button as t } from "../button.js";
4
+ import { getColumnHeaderLabel as n, useDataGrid as r } from "./data-grid.js";
5
+ import { DropdownMenu as i, DropdownMenuCheckboxItem as a, DropdownMenuContent as o, DropdownMenuGroup as s, DropdownMenuItem as c, DropdownMenuLabel as l, DropdownMenuSeparator as u, DropdownMenuSub as d, DropdownMenuSubContent as f, DropdownMenuSubTrigger as p, DropdownMenuTrigger as m } from "../dropdown-menu.js";
6
+ import { memo as h, useMemo as g } from "react";
7
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
8
+ import { HugeiconsIcon as y } from "@hugeicons/react";
9
+ import { ArrowDown02Icon as b, ArrowLeft02Icon as x, ArrowLeft03Icon as S, ArrowRight02Icon as C, ArrowRight03Icon as w, ArrowUp02Icon as T, PinOffIcon as E, SlidersHorizontalIcon as D, Tick02Icon as O, UnfoldMoreIcon as k } from "@hugeicons/core-free-icons";
10
+ //#region src/components/reui/data-grid/data-grid-column-header.tsx
11
+ function A({ column: h, title: A, icon: j, className: M, filter: N, visibility: P = !1 }) {
12
+ let { isLoading: F, table: I, props: L, recordCount: R } = r(), z = A ?? n(h), B = I.getState().columnOrder, V = JSON.stringify(I.getState().columnVisibility), H = h.getIsSorted(), U = h.getIsPinned(), W = h.getCanSort(), G = h.getCanPin(), K = h.getCanResize(), q = B.indexOf(h.id), J = q > 0, Y = q < B.length - 1, X = () => {
13
+ H === "asc" ? h.toggleSorting(!0) : H === "desc" ? h.clearSorting() : h.toggleSorting(!1);
14
+ }, Z = e("text-secondary-foreground/80 inline-flex h-full items-center gap-1.5 font-normal [&_svg]:opacity-60 text-[0.8125rem] leading-[calc(1.125/0.8125)] [&_svg]:size-3.5", M), Q = e("text-secondary-foreground/80 hover:bg-secondary data-[state=open]:bg-secondary hover:text-foreground data-[state=open]:text-foreground -ms-2 px-2 font-normal h-7 rounded-4xl", M), $ = W && (H === "desc" ? /* @__PURE__ */ _(y, {
15
+ icon: b,
16
+ strokeWidth: 2,
17
+ className: "size-3.25"
18
+ }) : H === "asc" ? /* @__PURE__ */ _(y, {
19
+ icon: T,
20
+ strokeWidth: 2,
21
+ className: "size-3.25"
22
+ }) : /* @__PURE__ */ _(y, {
23
+ icon: k,
24
+ strokeWidth: 2,
25
+ className: "mt-px size-3.25"
26
+ })), ee = L.tableLayout?.columnsMovable || L.tableLayout?.columnsVisibility && P || L.tableLayout?.columnsPinnable && G || N, te = g(() => {
27
+ let e = [], t = !1;
28
+ return N && (e.push(/* @__PURE__ */ _(s, { children: /* @__PURE__ */ _(l, { children: N }, "filter") }, "group-filter")), t = !0), W && (t && e.push(/* @__PURE__ */ _(u, {}, "sep-sort")), e.push(/* @__PURE__ */ v(c, {
29
+ onClick: () => {
30
+ H === "asc" ? h.clearSorting() : h.toggleSorting(!1);
31
+ },
32
+ disabled: !W,
33
+ children: [
34
+ /* @__PURE__ */ _(y, {
35
+ icon: T,
36
+ strokeWidth: 2,
37
+ className: "size-3.5!"
38
+ }),
39
+ /* @__PURE__ */ _("span", {
40
+ className: "grow",
41
+ children: "Asc"
42
+ }),
43
+ H === "asc" && /* @__PURE__ */ _(y, {
44
+ icon: O,
45
+ strokeWidth: 2,
46
+ className: "text-primary size-4 opacity-100!"
47
+ })
48
+ ]
49
+ }, "sort-asc"), /* @__PURE__ */ v(c, {
50
+ onClick: () => {
51
+ H === "desc" ? h.clearSorting() : h.toggleSorting(!0);
52
+ },
53
+ disabled: !W,
54
+ children: [
55
+ /* @__PURE__ */ _(y, {
56
+ icon: b,
57
+ strokeWidth: 2,
58
+ className: "size-3.5!"
59
+ }),
60
+ /* @__PURE__ */ _("span", {
61
+ className: "grow",
62
+ children: "Desc"
63
+ }),
64
+ H === "desc" && /* @__PURE__ */ _(y, {
65
+ icon: O,
66
+ strokeWidth: 2,
67
+ className: "text-primary size-4 opacity-100!"
68
+ })
69
+ ]
70
+ }, "sort-desc")), t = !0), L.tableLayout?.columnsPinnable && G && (t && e.push(/* @__PURE__ */ _(u, {}, "sep-pin")), e.push(/* @__PURE__ */ v(c, {
71
+ onClick: () => h.pin(U === "left" ? !1 : "left"),
72
+ children: [
73
+ /* @__PURE__ */ _(y, {
74
+ icon: S,
75
+ strokeWidth: 2,
76
+ className: "size-3.5!",
77
+ "aria-hidden": "true"
78
+ }),
79
+ /* @__PURE__ */ _("span", {
80
+ className: "grow",
81
+ children: "Pin to left"
82
+ }),
83
+ U === "left" && /* @__PURE__ */ _(y, {
84
+ icon: O,
85
+ strokeWidth: 2,
86
+ className: "text-primary size-4 opacity-100!"
87
+ })
88
+ ]
89
+ }, "pin-left"), /* @__PURE__ */ v(c, {
90
+ onClick: () => h.pin(U === "right" ? !1 : "right"),
91
+ children: [
92
+ /* @__PURE__ */ _(y, {
93
+ icon: w,
94
+ strokeWidth: 2,
95
+ className: "size-3.5!",
96
+ "aria-hidden": "true"
97
+ }),
98
+ /* @__PURE__ */ _("span", {
99
+ className: "grow",
100
+ children: "Pin to right"
101
+ }),
102
+ U === "right" && /* @__PURE__ */ _(y, {
103
+ icon: O,
104
+ strokeWidth: 2,
105
+ className: "text-primary size-4 opacity-100!"
106
+ })
107
+ ]
108
+ }, "pin-right")), t = !0), L.tableLayout?.columnsMovable && (t && e.push(/* @__PURE__ */ _(u, {}, "sep-move")), e.push(/* @__PURE__ */ v(c, {
109
+ onClick: () => {
110
+ if (q > 0) {
111
+ let e = [...B], [t] = e.splice(q, 1);
112
+ e.splice(q - 1, 0, t), I.setColumnOrder(e);
113
+ }
114
+ },
115
+ disabled: !J || U !== !1,
116
+ children: [/* @__PURE__ */ _(y, {
117
+ icon: x,
118
+ strokeWidth: 2,
119
+ className: "size-3.5!",
120
+ "aria-hidden": "true"
121
+ }), /* @__PURE__ */ _("span", { children: "Move to Left" })]
122
+ }, "move-left"), /* @__PURE__ */ v(c, {
123
+ onClick: () => {
124
+ if (q < B.length - 1) {
125
+ let e = [...B], [t] = e.splice(q, 1);
126
+ e.splice(q + 1, 0, t), I.setColumnOrder(e);
127
+ }
128
+ },
129
+ disabled: !Y || U !== !1,
130
+ children: [/* @__PURE__ */ _(y, {
131
+ icon: C,
132
+ strokeWidth: 2,
133
+ className: "size-3.5!",
134
+ "aria-hidden": "true"
135
+ }), /* @__PURE__ */ _("span", { children: "Move to Right" })]
136
+ }, "move-right")), t = !0), L.tableLayout?.columnsVisibility && P && (t && e.push(/* @__PURE__ */ _(u, {}, "sep-visibility")), e.push(/* @__PURE__ */ v(d, { children: [/* @__PURE__ */ v(p, { children: [/* @__PURE__ */ _(y, {
137
+ icon: D,
138
+ strokeWidth: 2,
139
+ className: "size-3.5!"
140
+ }), /* @__PURE__ */ _("span", { children: "Columns" })] }), /* @__PURE__ */ _(f, { children: I.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ _(a, {
141
+ checked: e.getIsVisible(),
142
+ onSelect: (e) => e.preventDefault(),
143
+ onCheckedChange: (t) => e.toggleVisibility(!!t),
144
+ className: "capitalize",
145
+ children: n(e)
146
+ }, e.id)) })] }, "visibility"))), e;
147
+ }, [
148
+ N,
149
+ W,
150
+ H,
151
+ h,
152
+ L.tableLayout?.columnsPinnable,
153
+ L.tableLayout?.columnsMovable,
154
+ L.tableLayout?.columnsVisibility,
155
+ G,
156
+ U,
157
+ J,
158
+ Y,
159
+ P,
160
+ I,
161
+ q,
162
+ B,
163
+ V
164
+ ]);
165
+ return ee ? /* @__PURE__ */ v("div", {
166
+ className: "flex h-full items-center justify-between gap-1.5",
167
+ children: [/* @__PURE__ */ v(i, { children: [/* @__PURE__ */ _(m, {
168
+ asChild: !0,
169
+ children: /* @__PURE__ */ v(t, {
170
+ variant: "ghost",
171
+ className: Q,
172
+ disabled: F || R === 0,
173
+ children: [
174
+ j && j,
175
+ z,
176
+ $
177
+ ]
178
+ })
179
+ }), /* @__PURE__ */ _(o, {
180
+ className: "w-40",
181
+ align: "start",
182
+ children: te
183
+ })] }), L.tableLayout?.columnsPinnable && G && U && /* @__PURE__ */ _(t, {
184
+ size: "icon-sm",
185
+ variant: "ghost",
186
+ className: "-me-1 size-7 rounded-md",
187
+ onClick: () => h.pin(!1),
188
+ "aria-label": `Unpin ${z} column`,
189
+ title: `Unpin ${z} column`,
190
+ children: /* @__PURE__ */ _(y, {
191
+ icon: E,
192
+ strokeWidth: 2,
193
+ className: "size-3.5! opacity-50!",
194
+ "aria-hidden": "true"
195
+ })
196
+ })]
197
+ }) : W || L.tableLayout?.columnsResizable && K ? /* @__PURE__ */ _("div", {
198
+ className: "flex h-full items-center",
199
+ children: /* @__PURE__ */ v(t, {
200
+ variant: "ghost",
201
+ className: Q,
202
+ disabled: F || R === 0,
203
+ onClick: X,
204
+ children: [
205
+ j && j,
206
+ z,
207
+ $
208
+ ]
209
+ })
210
+ }) : /* @__PURE__ */ v("div", {
211
+ className: Z,
212
+ children: [j && j, z]
213
+ });
214
+ }
215
+ var j = h(A);
216
+ //#endregion
217
+ export { j as DataGridColumnHeader };
@@ -0,0 +1,25 @@
1
+ import { getColumnHeaderLabel as e } from "./data-grid.js";
2
+ import { DropdownMenu as t, DropdownMenuCheckboxItem as n, DropdownMenuContent as r, DropdownMenuGroup as i, DropdownMenuLabel as a, DropdownMenuTrigger as o } from "../dropdown-menu.js";
3
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
4
+ //#region src/components/reui/data-grid/data-grid-column-visibility.tsx
5
+ function l({ table: l, trigger: u }) {
6
+ return /* @__PURE__ */ c(t, { children: [/* @__PURE__ */ s(o, {
7
+ asChild: !0,
8
+ children: u
9
+ }), /* @__PURE__ */ s(r, {
10
+ align: "end",
11
+ className: "min-w-[150px]",
12
+ children: /* @__PURE__ */ c(i, { children: [/* @__PURE__ */ s(a, {
13
+ className: "font-medium",
14
+ children: "Toggle Columns"
15
+ }), l.getAllColumns().filter((e) => e.getCanHide()).map((t) => /* @__PURE__ */ s(n, {
16
+ className: "capitalize",
17
+ checked: t.getIsVisible(),
18
+ onSelect: (e) => e.preventDefault(),
19
+ onCheckedChange: (e) => t.toggleVisibility(!!e),
20
+ children: e(t)
21
+ }, t.id))] })
22
+ })] });
23
+ }
24
+ //#endregion
25
+ export { l as DataGridColumnVisibility };