@socprime/react-ui 0.0.5

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 (153) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/LICENSE +21 -0
  3. package/README.md +537 -0
  4. package/attack-flow.d.ts +16 -0
  5. package/charts.d.ts +32 -0
  6. package/decorators/index.js +8 -0
  7. package/decorators/withRouter.js +10 -0
  8. package/decorators/withTheme.js +10 -0
  9. package/decorators.d.ts +10 -0
  10. package/domain.d.ts +23 -0
  11. package/editor.d.ts +25 -0
  12. package/index.d.ts +702 -0
  13. package/lib/cn.js +8 -0
  14. package/lib/theme.js +26 -0
  15. package/lib/useFullscreen.js +52 -0
  16. package/lib/useListenOnResizeDebounce.js +22 -0
  17. package/lib/useThemeColors.js +39 -0
  18. package/package.json +113 -0
  19. package/preset/createConfig.js +98 -0
  20. package/preset/createPreview.js +53 -0
  21. package/preset/index.js +6 -0
  22. package/preset/restoreNativeFocus.js +33 -0
  23. package/preset/types.js +0 -0
  24. package/preset.d.ts +27 -0
  25. package/theme-9m7j1UoI.d.ts +5 -0
  26. package/ui/Accordion/Accordion.js +82 -0
  27. package/ui/Accordion/AccordionSection.js +41 -0
  28. package/ui/Accordion/FolderTreeExpandTrigger.js +29 -0
  29. package/ui/Accordion/chevronVariants.js +31 -0
  30. package/ui/Accordion/index.js +16 -0
  31. package/ui/AnimatedDots/AnimatedDots.js +10 -0
  32. package/ui/AnimatedDots/index.js +4 -0
  33. package/ui/Aside/Aside.js +34 -0
  34. package/ui/Aside/index.js +4 -0
  35. package/ui/AttackFlow/AttackFlow.js +9 -0
  36. package/ui/AttackFlow/AttackFlowLayout.js +63 -0
  37. package/ui/AttackFlow/Controls.js +42 -0
  38. package/ui/AttackFlow/Node.js +47 -0
  39. package/ui/AttackFlow/OtherNode.js +44 -0
  40. package/ui/AttackFlow/index.js +4 -0
  41. package/ui/AttackFlow/prependData.js +153 -0
  42. package/ui/AttackFlow/types.js +0 -0
  43. package/ui/AttackFlow/useAttackFlow.js +193 -0
  44. package/ui/Badge/Badge.js +57 -0
  45. package/ui/Badge/index.js +5 -0
  46. package/ui/Button/Button.css +1 -0
  47. package/ui/Button/Button.js +109 -0
  48. package/ui/Button/index.js +5 -0
  49. package/ui/Charts/AreaChartWithGradient.js +79 -0
  50. package/ui/Charts/index.js +4 -0
  51. package/ui/Checkbox/Checkbox.js +31 -0
  52. package/ui/Checkbox/index.js +4 -0
  53. package/ui/ConditionalContent/ConditionalContent.js +10 -0
  54. package/ui/ConditionalContent/index.js +4 -0
  55. package/ui/CorrelationTimer/CorrelationTimer.js +62 -0
  56. package/ui/CorrelationTimer/index.js +4 -0
  57. package/ui/DeleteButtonConfirm/DeleteButtonConfirm.js +65 -0
  58. package/ui/DeleteButtonConfirm/index.js +4 -0
  59. package/ui/Dialog/ConfirmDialog.js +54 -0
  60. package/ui/Dialog/DefaultDialog.js +82 -0
  61. package/ui/Dialog/Dialog.js +120 -0
  62. package/ui/Dialog/index.js +32 -0
  63. package/ui/Dropdown/Dropdown.js +204 -0
  64. package/ui/Dropdown/DropdownsCheckbox.js +102 -0
  65. package/ui/Dropdown/DropdownsSelect.js +97 -0
  66. package/ui/Dropdown/index.js +38 -0
  67. package/ui/Editor/Editor.js +97 -0
  68. package/ui/Editor/index.js +4 -0
  69. package/ui/Editor/monacoSetup.js +38 -0
  70. package/ui/Editor/theme.js +50 -0
  71. package/ui/Editor/types.js +0 -0
  72. package/ui/EmptyState/EmptyState.js +26 -0
  73. package/ui/EmptyState/index.js +4 -0
  74. package/ui/Field/Field.js +204 -0
  75. package/ui/Field/index.js +24 -0
  76. package/ui/HelperText/HelperText.js +7 -0
  77. package/ui/HelperText/index.js +4 -0
  78. package/ui/Input/Input.js +40 -0
  79. package/ui/Input/index.js +4 -0
  80. package/ui/InputNumber/InputNumber.js +90 -0
  81. package/ui/InputNumber/index.js +4 -0
  82. package/ui/InputPassword/InputPassword.js +30 -0
  83. package/ui/InputPassword/index.js +4 -0
  84. package/ui/Label/Label.js +13 -0
  85. package/ui/Label/LabelInfo.js +14 -0
  86. package/ui/Label/index.js +6 -0
  87. package/ui/MultiSelect/MultiSelect.js +163 -0
  88. package/ui/MultiSelect/index.js +4 -0
  89. package/ui/PageHeader/PageHeader.js +51 -0
  90. package/ui/PageHeader/index.js +4 -0
  91. package/ui/Pagination/Pagination.js +97 -0
  92. package/ui/Pagination/PaginationWrap.js +149 -0
  93. package/ui/Pagination/index.js +20 -0
  94. package/ui/RadioGroup/RadioGroup.js +45 -0
  95. package/ui/RadioGroup/index.js +5 -0
  96. package/ui/ScrollArea/ScrollArea.js +57 -0
  97. package/ui/ScrollArea/index.js +5 -0
  98. package/ui/SearchInput/SearchInput.js +38 -0
  99. package/ui/SearchInput/index.js +4 -0
  100. package/ui/SearchInputFields/SearchInputFields.js +53 -0
  101. package/ui/SearchInputFields/index.js +4 -0
  102. package/ui/Select/Select.js +155 -0
  103. package/ui/Select/SelectDefault.js +43 -0
  104. package/ui/Select/index.js +26 -0
  105. package/ui/Separator/Separator.js +26 -0
  106. package/ui/Separator/index.js +4 -0
  107. package/ui/Severity/Severity.js +11 -0
  108. package/ui/Severity/index.js +4 -0
  109. package/ui/Severity/utils.js +53 -0
  110. package/ui/Skeleton/Skeleton.js +25 -0
  111. package/ui/Skeleton/index.js +5 -0
  112. package/ui/Slider/Slider.js +50 -0
  113. package/ui/Slider/index.js +4 -0
  114. package/ui/Spinner/Spinner.js +21 -0
  115. package/ui/Spinner/index.js +5 -0
  116. package/ui/SpinnerSquare/SpinnerSquare.css +1 -0
  117. package/ui/SpinnerSquare/SpinnerSquare.js +22 -0
  118. package/ui/SpinnerSquare/index.js +4 -0
  119. package/ui/StatisticCard/StatisticCard.js +27 -0
  120. package/ui/StatisticCard/index.js +4 -0
  121. package/ui/StatisticCard/types.js +0 -0
  122. package/ui/Suggestions/Suggestions.js +244 -0
  123. package/ui/Suggestions/index.js +4 -0
  124. package/ui/Switch/Switch.js +64 -0
  125. package/ui/Switch/index.js +4 -0
  126. package/ui/SyncProcessBar/SyncProcessBar.js +14 -0
  127. package/ui/SyncProcessBar/index.js +4 -0
  128. package/ui/Table/GroupHeaderRow.js +36 -0
  129. package/ui/Table/RowGrouped.js +19 -0
  130. package/ui/Table/ServerGroupedTableBody.js +89 -0
  131. package/ui/Table/SortableHeader.js +46 -0
  132. package/ui/Table/Table.js +110 -0
  133. package/ui/Table/TableWrap.js +124 -0
  134. package/ui/Table/columnStyle.js +14 -0
  135. package/ui/Table/index.js +28 -0
  136. package/ui/Tabs/Tabs.js +76 -0
  137. package/ui/Tabs/index.js +4 -0
  138. package/ui/TextTruncate/TextTruncate.js +107 -0
  139. package/ui/TextTruncate/index.js +4 -0
  140. package/ui/Textarea/Textarea.js +20 -0
  141. package/ui/Textarea/index.js +4 -0
  142. package/ui/ThemeToggle/ThemeToggle.js +23 -0
  143. package/ui/ThemeToggle/index.js +4 -0
  144. package/ui/Toast/Toast.js +23 -0
  145. package/ui/Toast/index.js +4 -0
  146. package/ui/Tooltip/Tooltip.js +17 -0
  147. package/ui/Tooltip/TooltipLayout.js +60 -0
  148. package/ui/Tooltip/index.js +14 -0
  149. package/ui/TreeGuide/TreeGuide.js +23 -0
  150. package/ui/TreeGuide/index.js +5 -0
  151. package/ui/entries/charts.js +2 -0
  152. package/ui/entries/domain.js +3 -0
  153. package/ui/index.js +45 -0
@@ -0,0 +1,120 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
3
+ import { XIcon } from "lucide-react";
4
+ import { motion } from "motion/react";
5
+ import { cn } from "../../lib/cn.js";
6
+ const Dialog = ({ ...props }) => {
7
+ return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
8
+ };
9
+ const DialogTrigger = ({ ...props }) => {
10
+ return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
11
+ };
12
+ const DialogPortal = ({ ...props }) => {
13
+ return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
14
+ };
15
+ const DialogClose = ({ ...props }) => {
16
+ return /* @__PURE__ */ jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
17
+ };
18
+ const DialogOverlay = ({ className, ...props }) => {
19
+ return /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", asChild: true, ...props, children: /* @__PURE__ */ jsx(
20
+ motion.div,
21
+ {
22
+ className: cn("fixed inset-0 z-50 bg-black/50", className),
23
+ initial: { opacity: 0 },
24
+ animate: { opacity: 1 },
25
+ exit: { opacity: 0 },
26
+ transition: { duration: 0.2 }
27
+ }
28
+ ) });
29
+ };
30
+ const DialogContent = ({
31
+ className,
32
+ children,
33
+ hideCloseButton = false,
34
+ ...props
35
+ }) => {
36
+ return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
37
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
38
+ /* @__PURE__ */ jsx(DialogPrimitive.Content, { "data-slot": "dialog-content", asChild: true, ...props, children: /* @__PURE__ */ jsxs(
39
+ motion.div,
40
+ {
41
+ className: cn(
42
+ "bg-background fixed top-[50%] left-[50%] z-50 grid w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] rounded-lg border shadow-lg sm:max-w-lg",
43
+ className
44
+ ),
45
+ initial: { opacity: 0, scale: 0.95, y: -20 },
46
+ animate: { opacity: 1, scale: 1, y: 0 },
47
+ exit: { opacity: 0, scale: 0.95, y: -20 },
48
+ transition: {
49
+ duration: 0.2,
50
+ ease: [0.16, 1, 0.3, 1]
51
+ },
52
+ children: [
53
+ children,
54
+ !hideCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "data-[state=open]:bg-accent data-[state=open]:text-muted-foreground btn btn--icon dark:text-subdued light:text-dark hover:bg-hover dark:hover:text-success absolute top-6 right-4 h-6 w-6 rounded-xs border-transparent px-1 opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
55
+ /* @__PURE__ */ jsx(XIcon, {}),
56
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
57
+ ] })
58
+ ]
59
+ }
60
+ ) })
61
+ ] });
62
+ };
63
+ const DialogHeader = ({ className, ...props }) => {
64
+ return /* @__PURE__ */ jsx(
65
+ "div",
66
+ {
67
+ "data-slot": "dialog-header",
68
+ className: cn(
69
+ "border-border mb-6 flex flex-col gap-2 border-b p-6 text-center sm:text-left",
70
+ className
71
+ ),
72
+ ...props
73
+ }
74
+ );
75
+ };
76
+ const DialogFooter = ({ className, ...props }) => {
77
+ return /* @__PURE__ */ jsx(
78
+ "div",
79
+ {
80
+ "data-slot": "dialog-footer",
81
+ className: cn(
82
+ "border-border mt-6 flex flex-col-reverse gap-2 border-t p-6 sm:flex-row sm:justify-end",
83
+ className
84
+ ),
85
+ ...props
86
+ }
87
+ );
88
+ };
89
+ const DialogTitle = ({ className, ...props }) => {
90
+ return /* @__PURE__ */ jsx(
91
+ DialogPrimitive.Title,
92
+ {
93
+ "data-slot": "dialog-title",
94
+ className: cn("text-lg leading-none font-semibold", className),
95
+ ...props
96
+ }
97
+ );
98
+ };
99
+ const DialogDescription = ({ className, ...props }) => {
100
+ return /* @__PURE__ */ jsx(
101
+ DialogPrimitive.Description,
102
+ {
103
+ "data-slot": "dialog-description",
104
+ className: cn("text-muted-foreground text-sm", className),
105
+ ...props
106
+ }
107
+ );
108
+ };
109
+ export {
110
+ Dialog,
111
+ DialogClose,
112
+ DialogContent,
113
+ DialogDescription,
114
+ DialogFooter,
115
+ DialogHeader,
116
+ DialogOverlay,
117
+ DialogPortal,
118
+ DialogTitle,
119
+ DialogTrigger
120
+ };
@@ -0,0 +1,32 @@
1
+ import {
2
+ ConfirmDialog,
3
+ ConfirmDeleteDialog
4
+ } from "./ConfirmDialog.js";
5
+ import { DefaultDialog } from "./DefaultDialog.js";
6
+ import {
7
+ Dialog,
8
+ DialogClose,
9
+ DialogContent,
10
+ DialogDescription,
11
+ DialogFooter,
12
+ DialogHeader,
13
+ DialogOverlay,
14
+ DialogPortal,
15
+ DialogTitle,
16
+ DialogTrigger
17
+ } from "./Dialog.js";
18
+ export {
19
+ ConfirmDeleteDialog,
20
+ ConfirmDialog,
21
+ DefaultDialog,
22
+ Dialog,
23
+ DialogClose,
24
+ DialogContent,
25
+ DialogDescription,
26
+ DialogFooter,
27
+ DialogHeader,
28
+ DialogOverlay,
29
+ DialogPortal,
30
+ DialogTitle,
31
+ DialogTrigger
32
+ };
@@ -0,0 +1,204 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
3
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
4
+ import { cn } from "../../lib/cn.js";
5
+ function DropdownMenu({ ...props }) {
6
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
7
+ }
8
+ function DropdownMenuPortal({
9
+ ...props
10
+ }) {
11
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { "data-slot": "dropdown-menu-portal", ...props });
12
+ }
13
+ function DropdownMenuTrigger({
14
+ ...props
15
+ }) {
16
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
17
+ }
18
+ function DropdownMenuContent({
19
+ className,
20
+ sideOffset = 4,
21
+ ...props
22
+ }) {
23
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
24
+ DropdownMenuPrimitive.Content,
25
+ {
26
+ "data-slot": "dropdown-menu-content",
27
+ sideOffset,
28
+ className: cn(
29
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
30
+ className
31
+ ),
32
+ ...props
33
+ }
34
+ ) });
35
+ }
36
+ function DropdownMenuGroup({ ...props }) {
37
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
38
+ }
39
+ function DropdownMenuItem({
40
+ className,
41
+ inset,
42
+ variant = "default",
43
+ ...props
44
+ }) {
45
+ return /* @__PURE__ */ jsx(
46
+ DropdownMenuPrimitive.Item,
47
+ {
48
+ "data-slot": "dropdown-menu-item",
49
+ "data-inset": inset,
50
+ "data-variant": variant,
51
+ className: cn(
52
+ "hover:bg-hover relative flex items-center gap-2 rounded px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg:not([class*='size-'])]:size-4 [&.is-disabled]:pointer-events-none [&.is-disabled]:opacity-50 [&:not(.is-disabled)]:cursor-pointer",
53
+ className
54
+ ),
55
+ ...props
56
+ }
57
+ );
58
+ }
59
+ function DropdownMenuCheckboxItem({
60
+ className,
61
+ children,
62
+ checked,
63
+ ...props
64
+ }) {
65
+ return /* @__PURE__ */ jsxs(
66
+ DropdownMenuPrimitive.CheckboxItem,
67
+ {
68
+ "data-slot": "dropdown-menu-checkbox-item",
69
+ className: cn(
70
+ "focus:bg-accent focus:text-accent-foreground hover:bg-hover relative flex cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",
71
+ className
72
+ ),
73
+ checked,
74
+ ...props,
75
+ children: [
76
+ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
77
+ children
78
+ ]
79
+ }
80
+ );
81
+ }
82
+ function DropdownMenuRadioGroup({
83
+ ...props
84
+ }) {
85
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
86
+ }
87
+ function DropdownMenuRadioItem({
88
+ className,
89
+ children,
90
+ ...props
91
+ }) {
92
+ return /* @__PURE__ */ jsxs(
93
+ DropdownMenuPrimitive.RadioItem,
94
+ {
95
+ "data-slot": "dropdown-menu-radio-item",
96
+ className: cn(
97
+ "focus:bg-accent focus:text-accent-foreground relative flex items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",
98
+ className
99
+ ),
100
+ ...props,
101
+ children: [
102
+ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) }) }),
103
+ children
104
+ ]
105
+ }
106
+ );
107
+ }
108
+ function DropdownMenuLabel({
109
+ className,
110
+ inset,
111
+ ...props
112
+ }) {
113
+ return /* @__PURE__ */ jsx(
114
+ DropdownMenuPrimitive.Label,
115
+ {
116
+ "data-slot": "dropdown-menu-label",
117
+ "data-inset": inset,
118
+ className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
119
+ ...props
120
+ }
121
+ );
122
+ }
123
+ function DropdownMenuSeparator({
124
+ className,
125
+ ...props
126
+ }) {
127
+ return /* @__PURE__ */ jsx(
128
+ DropdownMenuPrimitive.Separator,
129
+ {
130
+ "data-slot": "dropdown-menu-separator",
131
+ className: cn("bg-border -mx-1 my-1 h-px", className),
132
+ ...props
133
+ }
134
+ );
135
+ }
136
+ function DropdownMenuShortcut({ className, ...props }) {
137
+ return /* @__PURE__ */ jsx(
138
+ "span",
139
+ {
140
+ "data-slot": "dropdown-menu-shortcut",
141
+ className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
142
+ ...props
143
+ }
144
+ );
145
+ }
146
+ function DropdownMenuSub({ ...props }) {
147
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
148
+ }
149
+ function DropdownMenuSubTrigger({
150
+ className,
151
+ inset,
152
+ children,
153
+ ...props
154
+ }) {
155
+ return /* @__PURE__ */ jsxs(
156
+ DropdownMenuPrimitive.SubTrigger,
157
+ {
158
+ "data-slot": "dropdown-menu-sub-trigger",
159
+ "data-inset": inset,
160
+ className: cn(
161
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
162
+ className
163
+ ),
164
+ ...props,
165
+ children: [
166
+ children,
167
+ /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" })
168
+ ]
169
+ }
170
+ );
171
+ }
172
+ function DropdownMenuSubContent({
173
+ className,
174
+ ...props
175
+ }) {
176
+ return /* @__PURE__ */ jsx(
177
+ DropdownMenuPrimitive.SubContent,
178
+ {
179
+ "data-slot": "dropdown-menu-sub-content",
180
+ className: cn(
181
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
182
+ className
183
+ ),
184
+ ...props
185
+ }
186
+ );
187
+ }
188
+ export {
189
+ DropdownMenu,
190
+ DropdownMenuCheckboxItem,
191
+ DropdownMenuContent,
192
+ DropdownMenuGroup,
193
+ DropdownMenuItem,
194
+ DropdownMenuLabel,
195
+ DropdownMenuPortal,
196
+ DropdownMenuRadioGroup,
197
+ DropdownMenuRadioItem,
198
+ DropdownMenuSeparator,
199
+ DropdownMenuShortcut,
200
+ DropdownMenuSub,
201
+ DropdownMenuSubContent,
202
+ DropdownMenuSubTrigger,
203
+ DropdownMenuTrigger
204
+ };
@@ -0,0 +1,102 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/cn.js";
3
+ import { ChevronDownIcon, Loader2 } from "lucide-react";
4
+ import { useMemo, useState } from "react";
5
+ import { Button } from "../Button/Button.js";
6
+ import {
7
+ DropdownMenu,
8
+ DropdownMenuCheckboxItem,
9
+ DropdownMenuContent,
10
+ DropdownMenuGroup,
11
+ DropdownMenuLabel,
12
+ DropdownMenuSeparator,
13
+ DropdownMenuTrigger
14
+ } from "./Dropdown.js";
15
+ const DropdownsCheckbox = ({
16
+ options,
17
+ value = [],
18
+ onChange,
19
+ placeholder = "Select...",
20
+ className,
21
+ disabled = false,
22
+ loading = false,
23
+ label,
24
+ showSelectAll = true,
25
+ selectAllLabel = "Select All"
26
+ }) => {
27
+ const [open, setOpen] = useState(false);
28
+ const selectedCount = value.length;
29
+ const allSelected = showSelectAll && value.length === 0;
30
+ const handleToggle = (optionValue) => {
31
+ if (value.includes(optionValue)) {
32
+ const newValue = value.filter((v) => v !== optionValue);
33
+ onChange(newValue);
34
+ } else {
35
+ onChange([...value, optionValue]);
36
+ }
37
+ };
38
+ const handleSelectAll = (checked) => {
39
+ if (checked) {
40
+ onChange([]);
41
+ }
42
+ };
43
+ const buttonText = useMemo(() => {
44
+ if (allSelected) {
45
+ return selectAllLabel;
46
+ }
47
+ if (selectedCount === 0) {
48
+ return placeholder;
49
+ }
50
+ if (selectedCount === 1) {
51
+ const selectedOption = options.find((opt) => value.includes(opt.value));
52
+ return selectedOption?.label || `${selectedCount} selected`;
53
+ }
54
+ return `${selectedCount} selected`;
55
+ }, [selectedCount, options, value, placeholder, selectAllLabel, allSelected]);
56
+ return /* @__PURE__ */ jsxs(DropdownMenu, { open, onOpenChange: setOpen, children: [
57
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
58
+ Button,
59
+ {
60
+ variant: "secondary",
61
+ className: cn("text-xs", className),
62
+ disabled: disabled || loading,
63
+ children: [
64
+ /* @__PURE__ */ jsx("span", { className: cn("flex-1 text-left", selectedCount === 0 && "text-gray-chateau"), children: buttonText }),
65
+ loading ? /* @__PURE__ */ jsx(Loader2, { className: "text-gray-chateau size-4 animate-spin" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 shrink-0 opacity-50" })
66
+ ]
67
+ }
68
+ ) }),
69
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "border-border bg-secondary min-w-[12rem]", align: "start", children: [
70
+ label && /* @__PURE__ */ jsxs(Fragment, { children: [
71
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: label }),
72
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
73
+ ] }),
74
+ /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
75
+ showSelectAll && /* @__PURE__ */ jsx(
76
+ DropdownMenuCheckboxItem,
77
+ {
78
+ checked: allSelected,
79
+ onCheckedChange: handleSelectAll,
80
+ className: "font-regular text-xs",
81
+ children: selectAllLabel
82
+ }
83
+ ),
84
+ showSelectAll && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
85
+ options.map((option) => /* @__PURE__ */ jsx(
86
+ DropdownMenuCheckboxItem,
87
+ {
88
+ className: "font-regular text-xs",
89
+ checked: value.includes(option.value),
90
+ onCheckedChange: () => handleToggle(option.value),
91
+ disabled: option.disabled,
92
+ children: option.label
93
+ },
94
+ option.value
95
+ ))
96
+ ] })
97
+ ] })
98
+ ] });
99
+ };
100
+ export {
101
+ DropdownsCheckbox
102
+ };
@@ -0,0 +1,97 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/cn.js";
3
+ import { ChevronDownIcon, Loader2 } from "lucide-react";
4
+ import { useMemo, useState } from "react";
5
+ import { Button } from "../Button/Button.js";
6
+ import {
7
+ DropdownMenu,
8
+ DropdownMenuContent,
9
+ DropdownMenuGroup,
10
+ DropdownMenuItem,
11
+ DropdownMenuLabel,
12
+ DropdownMenuSeparator,
13
+ DropdownMenuTrigger
14
+ } from "./Dropdown.js";
15
+ const DropdownsSelect = ({
16
+ options,
17
+ value,
18
+ onChange,
19
+ placeholder = "Select...",
20
+ className,
21
+ disabled = false,
22
+ loading = false,
23
+ label,
24
+ triggerIcon,
25
+ triggerClassName
26
+ }) => {
27
+ const [open, setOpen] = useState(false);
28
+ const handleSelect = (optionValue) => {
29
+ onChange(optionValue);
30
+ setOpen(false);
31
+ };
32
+ const buttonText = useMemo(() => {
33
+ if (!value) {
34
+ return placeholder;
35
+ }
36
+ const selectedOption = options.find((opt) => opt.value === value);
37
+ return selectedOption?.label || placeholder;
38
+ }, [value, options, placeholder]);
39
+ return /* @__PURE__ */ jsxs(DropdownMenu, { open, onOpenChange: setOpen, children: [
40
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, disabled: disabled || loading, children: triggerIcon ? /* @__PURE__ */ jsx(
41
+ Button,
42
+ {
43
+ variant: "secondaryOutline",
44
+ size: "l",
45
+ className: triggerClassName,
46
+ disabled: disabled || loading,
47
+ children: loading ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : triggerIcon
48
+ }
49
+ ) : /* @__PURE__ */ jsxs(
50
+ Button,
51
+ {
52
+ variant: "secondary",
53
+ size: "l",
54
+ className: cn("text-xs", className),
55
+ disabled: disabled || loading,
56
+ children: [
57
+ /* @__PURE__ */ jsx("span", { className: cn("flex-1 text-left", !value && "text-gray-chateau"), children: buttonText }),
58
+ loading ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 shrink-0 opacity-50" })
59
+ ]
60
+ }
61
+ ) }),
62
+ /* @__PURE__ */ jsxs(
63
+ DropdownMenuContent,
64
+ {
65
+ className: "border-border bg-secondary min-w-[12rem]",
66
+ align: triggerIcon ? "end" : "start",
67
+ children: [
68
+ label && /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: label }),
70
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
71
+ ] }),
72
+ /* @__PURE__ */ jsx(DropdownMenuGroup, { className: "flex flex-col gap-[1px]", children: options.map((option) => /* @__PURE__ */ jsxs(
73
+ DropdownMenuItem,
74
+ {
75
+ className: cn(
76
+ "font-regular text-xs",
77
+ value === option.value && "bg-hover",
78
+ option.disabled && "is-disabled",
79
+ option.className
80
+ ),
81
+ onClick: () => handleSelect(option.value),
82
+ disabled: option.disabled,
83
+ children: [
84
+ option.icon,
85
+ option.label
86
+ ]
87
+ },
88
+ option.value
89
+ )) })
90
+ ]
91
+ }
92
+ )
93
+ ] });
94
+ };
95
+ export {
96
+ DropdownsSelect
97
+ };
@@ -0,0 +1,38 @@
1
+ import {
2
+ DropdownMenu as DropdownMenu2,
3
+ DropdownMenuCheckboxItem as DropdownMenuCheckboxItem2,
4
+ DropdownMenuContent as DropdownMenuContent2,
5
+ DropdownMenuGroup as DropdownMenuGroup2,
6
+ DropdownMenuItem as DropdownMenuItem2,
7
+ DropdownMenuLabel as DropdownMenuLabel2,
8
+ DropdownMenuPortal as DropdownMenuPortal2,
9
+ DropdownMenuRadioGroup as DropdownMenuRadioGroup2,
10
+ DropdownMenuRadioItem as DropdownMenuRadioItem2,
11
+ DropdownMenuSeparator as DropdownMenuSeparator2,
12
+ DropdownMenuShortcut as DropdownMenuShortcut2,
13
+ DropdownMenuSub as DropdownMenuSub2,
14
+ DropdownMenuSubContent as DropdownMenuSubContent2,
15
+ DropdownMenuSubTrigger as DropdownMenuSubTrigger2,
16
+ DropdownMenuTrigger as DropdownMenuTrigger2
17
+ } from "./Dropdown.js";
18
+ import { DropdownsCheckbox } from "./DropdownsCheckbox.js";
19
+ import { DropdownsSelect } from "./DropdownsSelect.js";
20
+ export {
21
+ DropdownMenu2 as DropdownMenu,
22
+ DropdownMenuCheckboxItem2 as DropdownMenuCheckboxItem,
23
+ DropdownMenuContent2 as DropdownMenuContent,
24
+ DropdownMenuGroup2 as DropdownMenuGroup,
25
+ DropdownMenuItem2 as DropdownMenuItem,
26
+ DropdownMenuLabel2 as DropdownMenuLabel,
27
+ DropdownMenuPortal2 as DropdownMenuPortal,
28
+ DropdownMenuRadioGroup2 as DropdownMenuRadioGroup,
29
+ DropdownMenuRadioItem2 as DropdownMenuRadioItem,
30
+ DropdownMenuSeparator2 as DropdownMenuSeparator,
31
+ DropdownMenuShortcut2 as DropdownMenuShortcut,
32
+ DropdownMenuSub2 as DropdownMenuSub,
33
+ DropdownMenuSubContent2 as DropdownMenuSubContent,
34
+ DropdownMenuSubTrigger2 as DropdownMenuSubTrigger,
35
+ DropdownMenuTrigger2 as DropdownMenuTrigger,
36
+ DropdownsCheckbox,
37
+ DropdownsSelect
38
+ };
@@ -0,0 +1,97 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useDocumentTheme } from "../../lib/theme.js";
3
+ import { cn } from "../../lib/cn.js";
4
+ import { Skeleton } from "../Skeleton/Skeleton.js";
5
+ import MonacoEditor, { loader } from "@monaco-editor/react";
6
+ import { useEffect, useMemo, useRef, useState } from "react";
7
+ import "./monacoSetup.js";
8
+ import { defineCustomThemes, editorOptionsFn, setTheme } from "./theme.js";
9
+ const Editor = ({
10
+ value,
11
+ header,
12
+ language = "yaml",
13
+ theme: themeProp,
14
+ className,
15
+ options,
16
+ readOnly = false,
17
+ id,
18
+ name,
19
+ autoHeight = false,
20
+ onChange,
21
+ ...props
22
+ }) => {
23
+ const editorRef = useRef(null);
24
+ const themeFromDocument = useDocumentTheme();
25
+ const theme = themeProp ?? themeFromDocument;
26
+ const themeRef = useRef(theme);
27
+ themeRef.current = theme;
28
+ const [monacoInstance, setMonacoInstance] = useState(null);
29
+ useEffect(() => {
30
+ loader.init().then((monaco) => {
31
+ defineCustomThemes(monaco);
32
+ setMonacoInstance(monaco);
33
+ setTheme(monaco, themeRef.current);
34
+ });
35
+ }, []);
36
+ useEffect(() => {
37
+ if (monacoInstance) {
38
+ setTheme(monacoInstance, theme);
39
+ }
40
+ }, [theme, monacoInstance]);
41
+ const editorOptions = useMemo(() => editorOptionsFn(readOnly, options), [readOnly, options]);
42
+ const updateEditorHeight = () => {
43
+ const editorInstance = editorRef.current;
44
+ if (!editorInstance) return;
45
+ const contentHeight = editorInstance.getContentHeight();
46
+ const container = editorInstance.getDomNode();
47
+ if (container) {
48
+ container.style.height = `${contentHeight}px`;
49
+ editorInstance.layout();
50
+ }
51
+ };
52
+ const handleEditorDidMount = (editorInstance) => {
53
+ editorRef.current = editorInstance;
54
+ if (autoHeight) {
55
+ updateEditorHeight();
56
+ editorInstance.onDidContentSizeChange(() => {
57
+ updateEditorHeight();
58
+ });
59
+ }
60
+ };
61
+ const handleFocus = () => {
62
+ editorRef.current?.focus();
63
+ };
64
+ return /* @__PURE__ */ jsxs(
65
+ "div",
66
+ {
67
+ id,
68
+ "data-name": name,
69
+ className: cn(
70
+ "border-border bg-secondary min-h-[300px] overflow-hidden rounded-md border transition-shadow h-full",
71
+ className
72
+ ),
73
+ onFocus: handleFocus,
74
+ onClick: handleFocus,
75
+ children: [
76
+ header,
77
+ /* @__PURE__ */ jsx(
78
+ MonacoEditor,
79
+ {
80
+ onMount: handleEditorDidMount,
81
+ height: "100%",
82
+ language,
83
+ value,
84
+ theme,
85
+ onChange: (val) => onChange?.(val || ""),
86
+ options: editorOptions,
87
+ loading: /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-full w-full rounded-md" }) }),
88
+ ...props
89
+ }
90
+ )
91
+ ]
92
+ }
93
+ );
94
+ };
95
+ export {
96
+ Editor
97
+ };
@@ -0,0 +1,4 @@
1
+ import { Editor } from "./Editor.js";
2
+ export {
3
+ Editor
4
+ };