@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,38 @@
1
+ import { loader } from "@monaco-editor/react";
2
+ import * as monaco from "monaco-editor";
3
+ self.MonacoEnvironment = {
4
+ getWorker(_workerId, label) {
5
+ switch (label) {
6
+ case "json":
7
+ return new Worker(
8
+ new URL("monaco-editor/esm/vs/language/json/json.worker.js", import.meta.url),
9
+ { type: "module" }
10
+ );
11
+ case "css":
12
+ case "scss":
13
+ case "less":
14
+ return new Worker(
15
+ new URL("monaco-editor/esm/vs/language/css/css.worker.js", import.meta.url),
16
+ { type: "module" }
17
+ );
18
+ case "html":
19
+ case "handlebars":
20
+ case "razor":
21
+ return new Worker(
22
+ new URL("monaco-editor/esm/vs/language/html/html.worker.js", import.meta.url),
23
+ { type: "module" }
24
+ );
25
+ case "typescript":
26
+ case "javascript":
27
+ return new Worker(
28
+ new URL("monaco-editor/esm/vs/language/typescript/ts.worker.js", import.meta.url),
29
+ { type: "module" }
30
+ );
31
+ default:
32
+ return new Worker(new URL("monaco-editor/esm/vs/editor/editor.worker.js", import.meta.url), {
33
+ type: "module"
34
+ });
35
+ }
36
+ }
37
+ };
38
+ loader.config({ monaco });
@@ -0,0 +1,50 @@
1
+ let themesDefined = false;
2
+ const defineCustomThemes = (monaco) => {
3
+ if (themesDefined) {
4
+ return;
5
+ }
6
+ monaco.editor.defineTheme("light", {
7
+ base: "vs",
8
+ inherit: true,
9
+ rules: [],
10
+ colors: {
11
+ "editor.background": "#F9FAFB",
12
+ "editor.foreground": "#cfd0d3"
13
+ }
14
+ });
15
+ monaco.editor.defineTheme("dark", {
16
+ base: "vs-dark",
17
+ inherit: true,
18
+ rules: [],
19
+ colors: {
20
+ "editor.background": "#1F2232",
21
+ "editor.foreground": "#cfd0d3"
22
+ }
23
+ });
24
+ themesDefined = true;
25
+ };
26
+ const setTheme = (monaco, theme) => {
27
+ monaco.editor.setTheme(theme);
28
+ };
29
+ const editorOptionsFn = (readOnly, options) => ({
30
+ minimap: { enabled: false },
31
+ fontSize: 14,
32
+ fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',
33
+ lineNumbers: "on",
34
+ readOnly,
35
+ scrollBeyondLastLine: false,
36
+ wordWrap: "on",
37
+ automaticLayout: true,
38
+ tabSize: 2,
39
+ insertSpaces: true,
40
+ renderWhitespace: "selection",
41
+ matchBrackets: "always",
42
+ folding: true,
43
+ showFoldingControls: "always",
44
+ ...options
45
+ });
46
+ export {
47
+ defineCustomThemes,
48
+ editorOptionsFn,
49
+ setTheme
50
+ };
File without changes
@@ -0,0 +1,26 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button } from "../Button/Button.js";
3
+ import { cn } from "../../lib/cn.js";
4
+ const EmptyState = ({
5
+ Icon,
6
+ IconNode,
7
+ title,
8
+ description,
9
+ path,
10
+ action,
11
+ actions,
12
+ className,
13
+ classNameContent
14
+ }) => {
15
+ return /* @__PURE__ */ jsx("div", { className: cn("bg-background flex h-full w-full items-center justify-center", className), children: /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col items-center justify-center px-4 py-16", classNameContent), children: [
16
+ Icon && /* @__PURE__ */ jsx("div", { className: "bg-success/10 mb-6 flex h-24 w-24 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx(Icon, { size: 48, className: "text-success" }) }),
17
+ IconNode && IconNode,
18
+ title && /* @__PURE__ */ jsx("h3", { className: "text-default mb-3 text-2xl font-semibold", children: title }),
19
+ description && /* @__PURE__ */ jsx("p", { className: "text-gray-chateau mb-8 max-w-md text-center text-xs", children: description }),
20
+ path && /* @__PURE__ */ jsx(Button, { to: path, variant: "primary", size: "l", children: action }),
21
+ actions
22
+ ] }) });
23
+ };
24
+ export {
25
+ EmptyState
26
+ };
@@ -0,0 +1,4 @@
1
+ import { EmptyState } from "./EmptyState.js";
2
+ export {
3
+ EmptyState
4
+ };
@@ -0,0 +1,204 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { useMemo } from "react";
4
+ import { Label } from "../Label/Label.js";
5
+ import { Separator } from "../Separator/Separator.js";
6
+ import { cn } from "../../lib/cn.js";
7
+ function FieldSet({ className, ...props }) {
8
+ return /* @__PURE__ */ jsx(
9
+ "fieldset",
10
+ {
11
+ "data-slot": "field-set",
12
+ className: cn(
13
+ "flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
14
+ className
15
+ ),
16
+ ...props
17
+ }
18
+ );
19
+ }
20
+ function FieldLegend({
21
+ className,
22
+ variant = "legend",
23
+ ...props
24
+ }) {
25
+ return /* @__PURE__ */ jsx(
26
+ "legend",
27
+ {
28
+ "data-slot": "field-legend",
29
+ "data-variant": variant,
30
+ className: cn(
31
+ "mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",
32
+ className
33
+ ),
34
+ ...props
35
+ }
36
+ );
37
+ }
38
+ function FieldGroup({ className, ...props }) {
39
+ return /* @__PURE__ */ jsx(
40
+ "div",
41
+ {
42
+ "data-slot": "field-group",
43
+ className: cn(
44
+ "group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",
45
+ className
46
+ ),
47
+ ...props
48
+ }
49
+ );
50
+ }
51
+ const fieldVariants = cva("group/field flex w-full gap-2 data-[invalid=true]:text-destructive", {
52
+ variants: {
53
+ orientation: {
54
+ vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
55
+ horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
56
+ responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
57
+ }
58
+ },
59
+ defaultVariants: {
60
+ orientation: "vertical"
61
+ }
62
+ });
63
+ function Field({
64
+ className,
65
+ orientation = "vertical",
66
+ ...props
67
+ }) {
68
+ return /* @__PURE__ */ jsx(
69
+ "div",
70
+ {
71
+ role: "group",
72
+ "data-slot": "field",
73
+ "data-orientation": orientation,
74
+ className: cn(fieldVariants({ orientation }), className),
75
+ ...props
76
+ }
77
+ );
78
+ }
79
+ function FieldContent({ className, ...props }) {
80
+ return /* @__PURE__ */ jsx(
81
+ "div",
82
+ {
83
+ "data-slot": "field-content",
84
+ className: cn("group/field-content flex flex-1 flex-col gap-0.5 leading-snug", className),
85
+ ...props
86
+ }
87
+ );
88
+ }
89
+ function FieldLabel({ className, ...props }) {
90
+ return /* @__PURE__ */ jsx(
91
+ Label,
92
+ {
93
+ "data-slot": "field-label",
94
+ className: cn(
95
+ "group/field-label peer/field-label has-data-checked:border-primary/30 has-data-checked:bg-primary/5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10 flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5",
96
+ "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",
97
+ className
98
+ ),
99
+ ...props
100
+ }
101
+ );
102
+ }
103
+ function FieldTitle({ className, ...props }) {
104
+ return /* @__PURE__ */ jsx(
105
+ "div",
106
+ {
107
+ "data-slot": "field-label",
108
+ className: cn(
109
+ "flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",
110
+ className
111
+ ),
112
+ ...props
113
+ }
114
+ );
115
+ }
116
+ function FieldDescription({ className, ...props }) {
117
+ return /* @__PURE__ */ jsx(
118
+ "p",
119
+ {
120
+ "data-slot": "field-description",
121
+ className: cn(
122
+ "text-muted-foreground text-left text-sm leading-normal font-normal group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
123
+ "last:mt-0 nth-last-2:-mt-1",
124
+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
125
+ className
126
+ ),
127
+ ...props
128
+ }
129
+ );
130
+ }
131
+ function FieldSeparator({
132
+ children,
133
+ className,
134
+ ...props
135
+ }) {
136
+ return /* @__PURE__ */ jsxs(
137
+ "div",
138
+ {
139
+ "data-slot": "field-separator",
140
+ "data-content": !!children,
141
+ className: cn(
142
+ "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
143
+ className
144
+ ),
145
+ ...props,
146
+ children: [
147
+ /* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
148
+ children && /* @__PURE__ */ jsx(
149
+ "span",
150
+ {
151
+ className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
152
+ "data-slot": "field-separator-content",
153
+ children
154
+ }
155
+ )
156
+ ]
157
+ }
158
+ );
159
+ }
160
+ function FieldError({
161
+ className,
162
+ children,
163
+ errors,
164
+ ...props
165
+ }) {
166
+ const content = useMemo(() => {
167
+ if (children) {
168
+ return children;
169
+ }
170
+ if (!errors?.length) {
171
+ return null;
172
+ }
173
+ const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
174
+ if (uniqueErrors?.length === 1) {
175
+ return uniqueErrors[0]?.message;
176
+ }
177
+ return /* @__PURE__ */ jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)) });
178
+ }, [children, errors]);
179
+ if (!content) {
180
+ return null;
181
+ }
182
+ return /* @__PURE__ */ jsx(
183
+ "div",
184
+ {
185
+ role: "alert",
186
+ "data-slot": "field-error",
187
+ className: cn("text-destructive text-sm font-normal", className),
188
+ ...props,
189
+ children: content
190
+ }
191
+ );
192
+ }
193
+ export {
194
+ Field,
195
+ FieldContent,
196
+ FieldDescription,
197
+ FieldError,
198
+ FieldGroup,
199
+ FieldLabel,
200
+ FieldLegend,
201
+ FieldSeparator,
202
+ FieldSet,
203
+ FieldTitle
204
+ };
@@ -0,0 +1,24 @@
1
+ import {
2
+ Field as Field2,
3
+ FieldContent as FieldContent2,
4
+ FieldDescription as FieldDescription2,
5
+ FieldError as FieldError2,
6
+ FieldGroup as FieldGroup2,
7
+ FieldLabel as FieldLabel2,
8
+ FieldLegend as FieldLegend2,
9
+ FieldSeparator as FieldSeparator2,
10
+ FieldSet as FieldSet2,
11
+ FieldTitle as FieldTitle2
12
+ } from "./Field.js";
13
+ export {
14
+ Field2 as Field,
15
+ FieldContent2 as FieldContent,
16
+ FieldDescription2 as FieldDescription,
17
+ FieldError2 as FieldError,
18
+ FieldGroup2 as FieldGroup,
19
+ FieldLabel2 as FieldLabel,
20
+ FieldLegend2 as FieldLegend,
21
+ FieldSeparator2 as FieldSeparator,
22
+ FieldSet2 as FieldSet,
23
+ FieldTitle2 as FieldTitle
24
+ };
@@ -0,0 +1,7 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ const HelperText = ({ children, className }) => {
3
+ return /* @__PURE__ */ jsx("p", { className, children });
4
+ };
5
+ export {
6
+ HelperText
7
+ };
@@ -0,0 +1,4 @@
1
+ import { HelperText } from "./HelperText.js";
2
+ export {
3
+ HelperText
4
+ };
@@ -0,0 +1,40 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Tooltip } from "../Tooltip/Tooltip.js";
3
+ import { cn } from "../../lib/cn.js";
4
+ import { Loader2 } from "lucide-react";
5
+ const Input = ({
6
+ className,
7
+ type,
8
+ loading,
9
+ iconLeft,
10
+ iconRight,
11
+ tooltip,
12
+ parentClassName,
13
+ ...props
14
+ }) => {
15
+ const element = /* @__PURE__ */ jsxs("div", { className: cn("relative", parentClassName), children: [
16
+ iconLeft && /* @__PURE__ */ jsx("div", { className: "absolute top-1/2 left-3 -translate-y-1/2", children: iconLeft }),
17
+ /* @__PURE__ */ jsx(
18
+ "input",
19
+ {
20
+ type,
21
+ "data-slot": "input",
22
+ className: cn(
23
+ "text-default placeholder:text-gray-chateau border-border flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-xs transition-[color,box-shadow] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
24
+ "focus-visible:ring-success/40 focus-visible:border-success focus-visible:ring-[2px]",
25
+ iconLeft && "pl-9",
26
+ iconRight && "pr-9",
27
+ className
28
+ ),
29
+ autoComplete: "off",
30
+ ...props
31
+ }
32
+ ),
33
+ iconRight && /* @__PURE__ */ jsx("div", { className: "absolute top-1/2 right-3 -translate-y-1/2", children: iconRight }),
34
+ loading && /* @__PURE__ */ jsx("div", { className: "absolute top-1/2 right-3 -translate-y-1/2", children: /* @__PURE__ */ jsx(Loader2, { className: "text-gray-chateau size-4 animate-spin" }) })
35
+ ] });
36
+ return tooltip ? /* @__PURE__ */ jsx(Tooltip, { content: tooltip, children: element }) : element;
37
+ };
38
+ export {
39
+ Input
40
+ };
@@ -0,0 +1,4 @@
1
+ import { Input } from "./Input.js";
2
+ export {
3
+ Input
4
+ };
@@ -0,0 +1,90 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/cn.js";
3
+ import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
4
+ import { forwardRef, useCallback, useRef } from "react";
5
+ const InputNumber = forwardRef(
6
+ ({ className, parentClassName, min, max, step = 1, onChange, onValueChange, ...props }, ref) => {
7
+ const innerRef = useRef(null);
8
+ const stepNum = Number(step);
9
+ const minNum = min != null ? Number(min) : void 0;
10
+ const maxNum = max != null ? Number(max) : void 0;
11
+ const setRefs = useCallback(
12
+ (node) => {
13
+ innerRef.current = node;
14
+ if (typeof ref === "function") ref(node);
15
+ else if (ref) ref.current = node;
16
+ },
17
+ [ref]
18
+ );
19
+ const clamp = useCallback(
20
+ (val) => {
21
+ let v = val;
22
+ if (minNum != null) v = Math.max(minNum, v);
23
+ if (maxNum != null) v = Math.min(maxNum, v);
24
+ return v;
25
+ },
26
+ [minNum, maxNum]
27
+ );
28
+ const nudge = (direction) => {
29
+ const input = innerRef.current;
30
+ if (!input) return;
31
+ const current = parseInt(input.value, 10) || 0;
32
+ const next = clamp(current + direction * stepNum);
33
+ const nativeSet = Object.getOwnPropertyDescriptor(
34
+ window.HTMLInputElement.prototype,
35
+ "value"
36
+ ).set;
37
+ nativeSet.call(input, String(next));
38
+ input.dispatchEvent(new Event("input", { bubbles: true }));
39
+ onValueChange?.(next);
40
+ };
41
+ return /* @__PURE__ */ jsxs("div", { className: cn("group/number relative", parentClassName), children: [
42
+ /* @__PURE__ */ jsx(
43
+ "input",
44
+ {
45
+ ref: setRefs,
46
+ type: "number",
47
+ "data-slot": "input",
48
+ className: cn(
49
+ "text-default placeholder:text-gray-chateau border-border flex h-9 w-full min-w-0 [appearance:textfield] rounded-md border px-3 py-1 pr-10 text-xs transition-[color,box-shadow] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
50
+ "focus-visible:ring-success/40 focus-visible:border-success focus-visible:ring-[2px]",
51
+ className
52
+ ),
53
+ min,
54
+ max,
55
+ step,
56
+ onChange,
57
+ autoComplete: "off",
58
+ ...props
59
+ }
60
+ ),
61
+ /* @__PURE__ */ jsxs("div", { className: "border-border absolute top-[1px] right-[1px] bottom-[1px] flex flex-col border-l opacity-0 transition-opacity group-hover/number:opacity-100", children: [
62
+ /* @__PURE__ */ jsx(
63
+ "button",
64
+ {
65
+ type: "button",
66
+ tabIndex: -1,
67
+ className: "hover:bg-hover text-gray-chateau/50 flex flex-1 items-center justify-center px-1 transition-colors",
68
+ onClick: () => nudge(1),
69
+ children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-3" })
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsx("span", { className: "bg-border h-px" }),
73
+ /* @__PURE__ */ jsx(
74
+ "button",
75
+ {
76
+ type: "button",
77
+ tabIndex: -1,
78
+ className: "hover:bg-hover text-gray-chateau/50 flex flex-1 items-center justify-center px-1 transition-colors",
79
+ onClick: () => nudge(-1),
80
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3" })
81
+ }
82
+ )
83
+ ] })
84
+ ] });
85
+ }
86
+ );
87
+ InputNumber.displayName = "InputNumber";
88
+ export {
89
+ InputNumber
90
+ };
@@ -0,0 +1,4 @@
1
+ import { InputNumber } from "./InputNumber.js";
2
+ export {
3
+ InputNumber
4
+ };
@@ -0,0 +1,30 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { EyeIcon, EyeOffIcon } from "lucide-react";
3
+ import { useState } from "react";
4
+ import { Input } from "../Input/Input.js";
5
+ const InputPassword = ({ ...props }) => {
6
+ const [showPassword, setShowPassword] = useState(false);
7
+ return /* @__PURE__ */ jsx(
8
+ Input,
9
+ {
10
+ ...props,
11
+ type: showPassword ? "text" : "password",
12
+ iconRight: showPassword ? /* @__PURE__ */ jsx(
13
+ EyeOffIcon,
14
+ {
15
+ onClick: () => setShowPassword(!showPassword),
16
+ className: "text-gray-chateau size-4"
17
+ }
18
+ ) : /* @__PURE__ */ jsx(
19
+ EyeIcon,
20
+ {
21
+ onClick: () => setShowPassword(!showPassword),
22
+ className: "text-gray-chateau size-4"
23
+ }
24
+ )
25
+ }
26
+ );
27
+ };
28
+ export {
29
+ InputPassword
30
+ };
@@ -0,0 +1,4 @@
1
+ import { InputPassword } from "./InputPassword.js";
2
+ export {
3
+ InputPassword
4
+ };
@@ -0,0 +1,13 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ import { cn } from "../../lib/cn.js";
4
+ const Label = ({ className, component = "label", ...props }) => {
5
+ const clsasses = cn(
6
+ "flex items-center gap-2 text-xs leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
7
+ className
8
+ );
9
+ return component === "label" ? /* @__PURE__ */ jsx(LabelPrimitive.Root, { className: clsasses, ...props }) : /* @__PURE__ */ jsx("span", { className: clsasses, ...props });
10
+ };
11
+ export {
12
+ Label
13
+ };
@@ -0,0 +1,14 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Tooltip } from "../Tooltip/Tooltip.js";
3
+ import { cn } from "../../lib/cn.js";
4
+ import { InfoIcon } from "lucide-react";
5
+ import { Label } from "./Label.js";
6
+ const LabelInfo = ({ className, tooltipProps, ...props }) => {
7
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
8
+ /* @__PURE__ */ jsx(Label, { ...props }),
9
+ /* @__PURE__ */ jsx(Tooltip, { ...tooltipProps, children: /* @__PURE__ */ jsx(InfoIcon, { className: "text-gray-chateau size-4" }) })
10
+ ] });
11
+ };
12
+ export {
13
+ LabelInfo
14
+ };
@@ -0,0 +1,6 @@
1
+ import { Label } from "./Label.js";
2
+ import { LabelInfo } from "./LabelInfo.js";
3
+ export {
4
+ Label,
5
+ LabelInfo
6
+ };