uibee 2.17.4 → 3.0.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 (183) hide show
  1. package/README.md +34 -0
  2. package/dist/icons-lZYQ6Vlr.js +125 -0
  3. package/dist/src/components/index.d.ts +706 -30
  4. package/dist/src/components/index.js +3243 -44
  5. package/dist/src/hooks/index.d.ts +15 -3
  6. package/dist/src/hooks/index.js +44 -3
  7. package/dist/src/icons/index.d.ts +420 -0
  8. package/dist/src/icons/index.js +3 -0
  9. package/dist/src/styles/index.d.ts +1 -1
  10. package/dist/src/styles/index.js +2 -1
  11. package/dist/src/utils/index.d.ts +38 -5
  12. package/dist/src/utils/index.js +125 -6
  13. package/dist/{src/globals.css → style.css} +1226 -607
  14. package/dist/useClickOutside-Cmp-RsP3.js +13 -0
  15. package/index.d.ts +0 -1
  16. package/package.json +22 -23
  17. package/src/components/alert/alert.tsx +20 -18
  18. package/src/components/buttons/button.tsx +28 -35
  19. package/src/components/confirm/confirmPopup.tsx +15 -17
  20. package/src/components/container/accordion.tsx +54 -0
  21. package/src/components/container/glassCard.tsx +14 -0
  22. package/src/components/container/iconBubble.tsx +30 -0
  23. package/src/components/container/leftBarPanel.tsx +15 -0
  24. package/src/components/container/pulseDot.tsx +31 -0
  25. package/src/components/container/statCard.tsx +24 -0
  26. package/src/components/container/tabs.tsx +64 -0
  27. package/src/components/footer/footer.tsx +124 -0
  28. package/src/components/footer/loginContent.tsx +70 -0
  29. package/src/components/index.ts +15 -0
  30. package/src/components/inputs/checkbox.tsx +4 -4
  31. package/src/components/inputs/input.tsx +11 -13
  32. package/src/components/inputs/multiSelect.tsx +144 -0
  33. package/src/components/inputs/radio.tsx +4 -4
  34. package/src/components/inputs/range.tsx +6 -5
  35. package/src/components/inputs/searchInput.tsx +1 -1
  36. package/src/components/inputs/select.tsx +19 -18
  37. package/src/components/inputs/shared/colorPickerPopup.tsx +5 -5
  38. package/src/components/inputs/shared/dateTimePickerPopup.tsx +9 -9
  39. package/src/components/inputs/shared/inputError.tsx +1 -1
  40. package/src/components/inputs/switch.tsx +7 -7
  41. package/src/components/inputs/tagInput.tsx +6 -7
  42. package/src/components/inputs/textarea.tsx +8 -10
  43. package/src/components/inputs/toggle.tsx +6 -6
  44. package/src/components/markdownrender/markdownRender.tsx +4 -2
  45. package/src/components/table/body.tsx +6 -6
  46. package/src/components/table/format.ts +1 -1
  47. package/src/components/table/header.tsx +1 -1
  48. package/src/components/table/pagination.tsx +17 -31
  49. package/src/components/table/table.tsx +2 -2
  50. package/src/components/version/version.tsx +1 -1
  51. package/src/components/vulnerability/constants.ts +6 -6
  52. package/src/components/vulnerability/severityPill.tsx +6 -7
  53. package/src/globals.css +12 -1
  54. package/src/hooks/index.ts +1 -0
  55. package/src/hooks/useClickOutside.ts +5 -22
  56. package/src/icons/icons.tsx +431 -0
  57. package/src/icons/index.ts +2 -0
  58. package/src/index.ts +0 -1
  59. package/src/types/hooks.d.ts +8 -2
  60. package/src/utils/index.ts +1 -1
  61. package/src/utils/logoConsoleOutput/logoConsoleOutput.ts +31 -0
  62. package/tsconfig.json +3 -2
  63. package/tsdown.config.ts +26 -0
  64. package/Readme.md +0 -29
  65. package/bun.lock +0 -662
  66. package/dist/src/components/alert/alert.d.ts +0 -8
  67. package/dist/src/components/alert/alert.js +0 -15
  68. package/dist/src/components/buttons/button.d.ts +0 -13
  69. package/dist/src/components/buttons/button.js +0 -30
  70. package/dist/src/components/confirm/confirmPopup.d.ts +0 -12
  71. package/dist/src/components/confirm/confirmPopup.js +0 -18
  72. package/dist/src/components/container/highlight.d.ts +0 -4
  73. package/dist/src/components/container/highlight.js +0 -4
  74. package/dist/src/components/container/page.d.ts +0 -8
  75. package/dist/src/components/container/page.js +0 -4
  76. package/dist/src/components/inputs/checkbox.d.ts +0 -17
  77. package/dist/src/components/inputs/checkbox.js +0 -37
  78. package/dist/src/components/inputs/input.d.ts +0 -12
  79. package/dist/src/components/inputs/input.js +0 -124
  80. package/dist/src/components/inputs/radio.d.ts +0 -17
  81. package/dist/src/components/inputs/radio.js +0 -27
  82. package/dist/src/components/inputs/range.d.ts +0 -11
  83. package/dist/src/components/inputs/range.js +0 -22
  84. package/dist/src/components/inputs/searchInput.d.ts +0 -6
  85. package/dist/src/components/inputs/searchInput.js +0 -42
  86. package/dist/src/components/inputs/select.d.ts +0 -23
  87. package/dist/src/components/inputs/select.js +0 -70
  88. package/dist/src/components/inputs/shared/colorPickerPopup.d.ts +0 -8
  89. package/dist/src/components/inputs/shared/colorPickerPopup.js +0 -191
  90. package/dist/src/components/inputs/shared/dateTimePickerPopup.d.ts +0 -9
  91. package/dist/src/components/inputs/shared/dateTimePickerPopup.js +0 -128
  92. package/dist/src/components/inputs/shared/fieldWrapper.d.ts +0 -14
  93. package/dist/src/components/inputs/shared/fieldWrapper.js +0 -8
  94. package/dist/src/components/inputs/shared/index.d.ts +0 -5
  95. package/dist/src/components/inputs/shared/index.js +0 -5
  96. package/dist/src/components/inputs/shared/inputError.d.ts +0 -6
  97. package/dist/src/components/inputs/shared/inputError.js +0 -6
  98. package/dist/src/components/inputs/shared/inputInfo.d.ts +0 -5
  99. package/dist/src/components/inputs/shared/inputInfo.js +0 -5
  100. package/dist/src/components/inputs/shared/inputLabel.d.ts +0 -9
  101. package/dist/src/components/inputs/shared/inputLabel.js +0 -4
  102. package/dist/src/components/inputs/switch.d.ts +0 -11
  103. package/dist/src/components/inputs/switch.js +0 -14
  104. package/dist/src/components/inputs/tagInput.d.ts +0 -15
  105. package/dist/src/components/inputs/tagInput.js +0 -40
  106. package/dist/src/components/inputs/textarea.d.ts +0 -11
  107. package/dist/src/components/inputs/textarea.js +0 -36
  108. package/dist/src/components/inputs/toggle.d.ts +0 -14
  109. package/dist/src/components/inputs/toggle.js +0 -12
  110. package/dist/src/components/login/loginPage.d.ts +0 -2
  111. package/dist/src/components/login/loginPage.js +0 -18
  112. package/dist/src/components/logo/logo.d.ts +0 -5
  113. package/dist/src/components/logo/logo.js +0 -6
  114. package/dist/src/components/logo/logoSmall.d.ts +0 -1
  115. package/dist/src/components/logo/logoSmall.js +0 -6
  116. package/dist/src/components/markdownrender/markdownRender.d.ts +0 -6
  117. package/dist/src/components/markdownrender/markdownRender.js +0 -25
  118. package/dist/src/components/navbar/bubble.d.ts +0 -14
  119. package/dist/src/components/navbar/bubble.js +0 -8
  120. package/dist/src/components/navbar/navbar.d.ts +0 -34
  121. package/dist/src/components/navbar/navbar.js +0 -36
  122. package/dist/src/components/navbar/navbarDropdown.d.ts +0 -7
  123. package/dist/src/components/navbar/navbarDropdown.js +0 -19
  124. package/dist/src/components/navbar/navbarItem.d.ts +0 -11
  125. package/dist/src/components/navbar/navbarItem.js +0 -12
  126. package/dist/src/components/table/body.d.ts +0 -15
  127. package/dist/src/components/table/body.js +0 -116
  128. package/dist/src/components/table/format.d.ts +0 -1
  129. package/dist/src/components/table/format.js +0 -27
  130. package/dist/src/components/table/header.d.ts +0 -8
  131. package/dist/src/components/table/header.js +0 -47
  132. package/dist/src/components/table/menu.d.ts +0 -17
  133. package/dist/src/components/table/menu.js +0 -30
  134. package/dist/src/components/table/pagination.d.ts +0 -6
  135. package/dist/src/components/table/pagination.js +0 -86
  136. package/dist/src/components/table/table.d.ts +0 -14
  137. package/dist/src/components/table/table.js +0 -14
  138. package/dist/src/components/toast/toastItem.d.ts +0 -2
  139. package/dist/src/components/toast/toastItem.js +0 -38
  140. package/dist/src/components/toast/toaster.d.ts +0 -9
  141. package/dist/src/components/toast/toaster.js +0 -86
  142. package/dist/src/components/toggle/language.d.ts +0 -4
  143. package/dist/src/components/toggle/language.js +0 -29
  144. package/dist/src/components/toggle/theme.d.ts +0 -3
  145. package/dist/src/components/toggle/theme.js +0 -30
  146. package/dist/src/components/version/version.d.ts +0 -7
  147. package/dist/src/components/version/version.js +0 -12
  148. package/dist/src/components/vulnerability/constants.d.ts +0 -4
  149. package/dist/src/components/vulnerability/constants.js +0 -14
  150. package/dist/src/components/vulnerability/severityPill.d.ts +0 -8
  151. package/dist/src/components/vulnerability/severityPill.js +0 -8
  152. package/dist/src/hooks/useClickOutside.d.ts +0 -2
  153. package/dist/src/hooks/useClickOutside.js +0 -27
  154. package/dist/src/hooks/useDarkMode.d.ts +0 -1
  155. package/dist/src/hooks/useDarkMode.js +0 -17
  156. package/dist/src/hooks/useVisibility.d.ts +0 -4
  157. package/dist/src/hooks/useVisibility.js +0 -23
  158. package/dist/src/index.d.ts +0 -5
  159. package/dist/src/index.js +0 -5
  160. package/dist/src/scripts/buildCss.d.ts +0 -1
  161. package/dist/src/scripts/buildCss.js +0 -22
  162. package/dist/src/scripts/index.d.ts +0 -1
  163. package/dist/src/scripts/index.js +0 -1
  164. package/dist/src/scripts/rewriteAlias.d.ts +0 -1
  165. package/dist/src/scripts/rewriteAlias.js +0 -31
  166. package/dist/src/utils/LogoConsoleOutput/LogoConsoleOutput.d.ts +0 -1
  167. package/dist/src/utils/LogoConsoleOutput/LogoConsoleOutput.js +0 -44
  168. package/dist/src/utils/auth/callback.d.ts +0 -2
  169. package/dist/src/utils/auth/callback.js +0 -63
  170. package/dist/src/utils/auth/getDomain.d.ts +0 -2
  171. package/dist/src/utils/auth/getDomain.js +0 -6
  172. package/dist/src/utils/auth/login.d.ts +0 -3
  173. package/dist/src/utils/auth/login.js +0 -14
  174. package/dist/src/utils/auth/logout.d.ts +0 -3
  175. package/dist/src/utils/auth/logout.js +0 -18
  176. package/dist/src/utils/auth/token.d.ts +0 -3
  177. package/dist/src/utils/auth/token.js +0 -33
  178. package/dist/tailwind.config.d.ts +0 -3
  179. package/dist/tailwind.config.js +0 -7
  180. package/src/scripts/buildCss.ts +0 -25
  181. package/src/scripts/index.ts +0 -1
  182. package/src/scripts/rewriteAlias.ts +0 -39
  183. package/src/utils/LogoConsoleOutput/LogoConsoleOutput.ts +0 -61
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- type AlertProps = {
3
- children: ReactNode;
4
- variant?: 'warning' | 'info';
5
- className?: string;
6
- };
7
- export default function Alert({ children, variant, className, }: AlertProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CircleAlert, TriangleAlert, Info } from 'lucide-react';
3
- export default function Alert({ children, variant = 'warning', className = '', }) {
4
- const color = variant === 'warning' ? 'bg-red-900'
5
- : variant === 'info' ? 'bg-blue-600' :
6
- 'bg-gray-900';
7
- const Icon = variant === 'warning' ? CircleAlert
8
- : variant === 'info' ? Info :
9
- TriangleAlert;
10
- return (_jsxs("div", { className: `
11
- grid grid-cols-[min-content_auto] rounded-lg
12
- p-[0.5em_1em_0.5em_0.8em] items-start w-fit text-white
13
- ${color} ${className}
14
- `, children: [_jsx(Icon, { className: 'w-8 h-8 mr-[0.3rem] stroke-login-50' }), _jsx("div", { className: 'self-center', children: children })] }));
15
- }
@@ -1,13 +0,0 @@
1
- import type { JSX } from 'react';
2
- type ButtonProps = {
3
- text: string;
4
- className?: string;
5
- icon: string | JSX.Element;
6
- path?: string;
7
- type?: 'button' | 'submit' | 'reset';
8
- variant?: 'primary' | 'secondary' | 'warning' | 'danger' | 'success' | 'info';
9
- onClick?: (_: object | string) => void;
10
- disabled?: boolean;
11
- };
12
- export default function Button({ text, className, icon, path, variant, type, onClick, disabled }: ButtonProps): import("react/jsx-runtime").JSX.Element;
13
- export {};
@@ -1,30 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import Link from 'next/link';
3
- const variants = {
4
- primary: 'bg-login/70 outline-login hover:bg-login/90',
5
- secondary: 'bg-login-500/70 outline-login-500 hover:bg-login-500/90',
6
- warning: 'bg-yellow-500/70 outline-yellow-500 hover:bg-yellow-500/90',
7
- danger: 'bg-red-600/70 outline-red-600 hover:bg-red-600/90',
8
- success: 'bg-green-600/70 outline-green-600 hover:bg-green-600/90',
9
- info: 'bg-blue-600/70 outline-blue-600 hover:bg-blue-600/90'
10
- };
11
- export default function Button({ text, className, icon, path, variant = 'primary', type, onClick, disabled }) {
12
- const bg = variants[variant];
13
- if (!path) {
14
- return (_jsxs("button", { type: type || 'button', disabled: disabled, onClick: onClick, "aria-label": text, className: `
15
- ${bg} cursor-pointer px-4 rounded-md min-h-8 h-8 flex
16
- justify-evenly items-center gap-2 select-none
17
- focus:outline-none border-0 outline w-fit ${className}
18
- `, children: [_jsx("h1", { className: 'font-bold', children: icon || '' }), _jsx("h1", { className: 'min-w-fit w-fit', children: text })] }));
19
- }
20
- if (disabled) {
21
- return (_jsxs("div", { className: `
22
- ${bg} cursor-not-allowed px-4 rounded-md h-8 flex w-fit
23
- justify-evenly items-center gap-2 select-none ${className}
24
- `, children: [_jsx("h1", { className: 'font-bold', children: icon || '' }), _jsx("h1", { className: 'min-w-fit w-fit', children: text })] }));
25
- }
26
- return (_jsxs(Link, { href: path, className: `
27
- ${bg} cursor-pointer px-4 rounded-md h-8 flex w-fit
28
- justify-evenly items-center gap-2 select-none ${className}
29
- `, children: [_jsx("h1", { className: 'font-bold', children: icon || '' }), _jsx("h1", { className: 'min-w-fit w-fit', children: text })] }));
30
- }
@@ -1,12 +0,0 @@
1
- type ConfirmPopupProps = {
2
- isOpen: boolean;
3
- header: string;
4
- description?: string;
5
- confirmText?: string;
6
- cancelText?: string;
7
- onConfirm: () => void;
8
- onCancel: () => void;
9
- variant?: 'danger' | 'warning' | 'default';
10
- };
11
- export default function ConfirmPopup({ isOpen, header, description, confirmText, cancelText, onConfirm, onCancel, variant, }: ConfirmPopupProps): import("react/jsx-runtime").JSX.Element | null;
12
- export {};
@@ -1,18 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { TriangleAlert } from 'lucide-react';
4
- export default function ConfirmPopup({ isOpen, header, description, confirmText = 'Confirm', cancelText = 'Cancel', onConfirm, onCancel, variant = 'default', }) {
5
- if (!isOpen)
6
- return null;
7
- const confirmBg = variant === 'danger'
8
- ? 'bg-red-700/80 outline-red-700 hover:bg-red-700'
9
- : variant === 'warning'
10
- ? 'bg-yellow-600/80 outline-yellow-600 hover:bg-yellow-600'
11
- : 'bg-login/70 outline-login hover:bg-login/90';
12
- return (_jsxs("div", { role: 'dialog', "aria-modal": 'true', "aria-labelledby": 'confirm-popup-header', className: 'fixed inset-0 z-50 flex items-center justify-center', onClick: onCancel, children: [_jsx("div", { className: 'absolute inset-0 bg-black/60 backdrop-blur-sm' }), _jsxs("div", { className: '\n relative z-10 w-full max-w-md mx-4\n bg-login-800 border border-login-500/50 rounded-xl\n shadow-2xl p-6 flex flex-col gap-4\n ', onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { className: 'flex items-center gap-3', children: [variant !== 'default' && (_jsx(TriangleAlert, { className: `w-6 h-6 shrink-0 ${variant === 'danger' ? 'stroke-red-400' : 'stroke-yellow-400'}` })), _jsx("h2", { id: 'confirm-popup-header', className: 'text-login-50 text-lg font-bold leading-snug', children: header })] }), description && (_jsx("p", { className: 'text-login-100 text-sm leading-relaxed', children: description })), _jsxs("div", { className: 'flex justify-end gap-3 mt-1', children: [_jsx("button", { type: 'button', onClick: onCancel, className: '\n cursor-pointer px-4 py-1.5 rounded-md text-sm font-medium\n bg-login-500/60 text-login-50 outline outline-login-500/60\n hover:bg-login-500/90 focus:outline-none select-none\n transition-colors duration-150\n ', children: cancelText }), _jsx("button", { type: 'button', onClick: onConfirm, className: `
13
- cursor-pointer px-4 py-1.5 rounded-md text-sm font-bold
14
- text-white outline focus:outline-none select-none
15
- transition-colors duration-150
16
- ${confirmBg}
17
- `, children: confirmText })] })] })] }));
18
- }
@@ -1,4 +0,0 @@
1
- export default function Highlight({ children, className }: {
2
- children: React.ReactNode;
3
- className?: string;
4
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- export default function Highlight({ children, className }) {
3
- return _jsx("div", { className: `highlighted-section ${className ?? ''}`, children: children });
4
- }
@@ -1,8 +0,0 @@
1
- type PageContainerProps = {
2
- title: string;
3
- children: React.ReactNode;
4
- className?: string;
5
- innerClassName?: string;
6
- };
7
- export default function PageContainer({ title, children, className, innerClassName }: PageContainerProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export default function PageContainer({ title, children, className, innerClassName }) {
3
- return (_jsx("div", { className: `w-full page-container ${className}`, children: _jsxs("div", { className: `flex flex-col col-start-3 ${innerClassName}`, children: [_jsx("h1", { className: 'heading', children: title }), children] }) }));
4
- }
@@ -1,17 +0,0 @@
1
- export type CheckboxOption = {
2
- label: string;
3
- value: string | number;
4
- };
5
- export type CheckboxProps = Omit<React.ComponentProps<'input'>, 'name' | 'onChange' | 'value'> & {
6
- name: string;
7
- label?: string;
8
- error?: string;
9
- info?: string;
10
- description?: string;
11
- className?: string;
12
- options: CheckboxOption[];
13
- value?: (string | number)[];
14
- onChange?: (value: (string | number)[]) => void;
15
- textSize?: 'sm' | 'md';
16
- };
17
- export default function Checkbox(props: CheckboxProps): import("react/jsx-runtime").JSX.Element;
@@ -1,37 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Check } from 'lucide-react';
3
- import { FieldWrapper, InputLabel } from './shared';
4
- export default function Checkbox(props) {
5
- const { options, onChange, value, label, description, error, info, name, className, textSize = 'sm', ...rest } = props;
6
- const selectedValues = Array.isArray(value) ? value : [];
7
- return (_jsx(FieldWrapper, { label: label, name: name, required: rest.required, info: info, description: description, error: error, textSize: textSize, className: className, children: _jsx("div", { className: 'flex flex-col gap-2', children: options.map((option) => (_jsx(CheckboxItem, { name: name, value: option.value, label: option.label, checked: selectedValues.includes(option.value), disabled: rest.disabled, onChange: (e) => {
8
- if (!onChange)
9
- return;
10
- const isChecked = e.target.checked;
11
- let newValues = [...selectedValues];
12
- if (isChecked) {
13
- newValues.push(option.value);
14
- }
15
- else {
16
- newValues = newValues.filter((v) => v !== option.value);
17
- }
18
- onChange(newValues);
19
- }, className: 'mb-0' }, option.value))) }) }));
20
- }
21
- function CheckboxItem(props) {
22
- const { name, label, error, ...inputProps } = props;
23
- const id = inputProps.value ? `${name}-${inputProps.value}` : name;
24
- return (_jsxs("div", { className: 'flex items-center gap-2', children: [_jsxs("div", { className: 'relative w-5 h-5 shrink-0', children: [_jsx("input", { ...inputProps, id: id, name: name, type: 'checkbox', className: `
25
- peer appearance-none rounded border border-login-500 bg-login-500/50
26
- checked:bg-login checked:border-login
27
- focus:outline-none focus:ring-2 focus:ring-login/50
28
- disabled:opacity-50 disabled:cursor-not-allowed
29
- cursor-pointer transition-all duration-200
30
- w-5 h-5 absolute inset-0
31
- ${error ? 'border-red-500' : ''}
32
- ` }), _jsx(Check, { className: `
33
- absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2
34
- w-3.5 h-3.5 pointer-events-none text-white opacity-0
35
- peer-checked:opacity-100 transition-opacity duration-200
36
- ` })] }), label && (_jsx(InputLabel, { label: label, name: name, disabled: inputProps.disabled, className: 'select-none cursor-pointer' }))] }));
37
- }
@@ -1,12 +0,0 @@
1
- import { type JSX } from 'react';
2
- export type InputProps = Omit<React.ComponentProps<'input'>, 'name'> & {
3
- name: string;
4
- label?: string;
5
- error?: string;
6
- className?: string;
7
- icon?: JSX.Element;
8
- info?: string;
9
- description?: string;
10
- textSize?: 'sm' | 'md';
11
- };
12
- export default function Input(props: InputProps): import("react/jsx-runtime").JSX.Element;
@@ -1,124 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRef, useState, useId } from 'react';
3
- import { Calendar, Clock } from 'lucide-react';
4
- import { FieldWrapper } from './shared';
5
- import DateTimePickerPopup from './shared/dateTimePickerPopup';
6
- import ColorPickerPopup from './shared/colorPickerPopup';
7
- import useClickOutside from '../../hooks/useClickOutside';
8
- export default function Input(props) {
9
- const { name, label, error, className, icon, info, description, textSize = 'sm', ...inputProps } = props;
10
- const { type = 'text', value } = inputProps;
11
- const localRef = useRef(null);
12
- const [isOpen, setIsOpen] = useState(false);
13
- const id = useId();
14
- const anchorName = `--input-${id.replace(/:/g, '')}`;
15
- const containerRef = useClickOutside(() => setIsOpen(false));
16
- const isDateType = ['date', 'datetime-local', 'time'].includes(type);
17
- const isColorType = type === 'color';
18
- const isClickableType = isDateType || isColorType;
19
- function handleIconClick() {
20
- if (isClickableType && !inputProps.disabled) {
21
- setIsOpen(!isOpen);
22
- }
23
- else if (localRef.current && !inputProps.disabled) {
24
- localRef.current.focus();
25
- }
26
- }
27
- function handleDateChange(date) {
28
- const onChange = inputProps.onChange;
29
- if (!onChange)
30
- return;
31
- const pad = (n) => n.toString().padStart(2, '0');
32
- const yyyy = date.getFullYear();
33
- const MM = pad(date.getMonth() + 1);
34
- const dd = pad(date.getDate());
35
- const hh = pad(date.getHours());
36
- const mm = pad(date.getMinutes());
37
- let newValue = '';
38
- if (type === 'date')
39
- newValue = `${yyyy}-${MM}-${dd}`;
40
- else if (type === 'time')
41
- newValue = `${hh}:${mm}`;
42
- else if (type === 'datetime-local')
43
- newValue = `${yyyy}-${MM}-${dd}T${hh}:${mm}`;
44
- const event = {
45
- target: {
46
- name,
47
- value: newValue,
48
- type,
49
- },
50
- };
51
- onChange(event);
52
- }
53
- function handleColorChange(color) {
54
- const onChange = inputProps.onChange;
55
- if (!onChange)
56
- return;
57
- const event = {
58
- target: {
59
- name,
60
- value: color,
61
- type,
62
- },
63
- };
64
- onChange(event);
65
- }
66
- let displayIcon = icon;
67
- if (!displayIcon && isDateType) {
68
- if (type === 'time') {
69
- displayIcon = _jsx(Clock, { className: 'w-4 h-4' });
70
- }
71
- else {
72
- displayIcon = _jsx(Calendar, { className: 'w-4 h-4' });
73
- }
74
- }
75
- else if (!displayIcon && isColorType) {
76
- displayIcon = (_jsx("div", { className: 'w-4 h-4 rounded border border-login-200', style: { backgroundColor: value || '#000000' } }));
77
- }
78
- function getDateValue() {
79
- if (!value)
80
- return null;
81
- if (type === 'time') {
82
- const date = new Date(`2000-01-01T${value}`);
83
- return isNaN(date.getTime()) ? null : date;
84
- }
85
- const date = new Date(value);
86
- return isNaN(date.getTime()) ? null : date;
87
- }
88
- function getDateDisplayValue() {
89
- if (!value || !isDateType)
90
- return value;
91
- const date = getDateValue();
92
- if (!date)
93
- return value;
94
- function pad(n) {
95
- return n.toString().padStart(2, '0');
96
- }
97
- const yyyy = date.getFullYear();
98
- const MM = pad(date.getMonth() + 1);
99
- const dd = pad(date.getDate());
100
- const hh = pad(date.getHours());
101
- const mm = pad(date.getMinutes());
102
- if (type === 'date')
103
- return `${dd}.${MM}.${yyyy}`;
104
- if (type === 'time')
105
- return `${hh}:${mm}`;
106
- if (type === 'datetime-local')
107
- return `${dd}.${MM}.${yyyy} ${hh}:${mm}`;
108
- return value;
109
- }
110
- return (_jsx(FieldWrapper, { label: label, name: name, required: inputProps.required, info: info, error: error, description: description, textSize: textSize, className: className, children: _jsxs("div", { className: 'relative flex items-center', ref: containerRef, children: [displayIcon && (_jsx("div", { className: `
111
- absolute left-3 text-login-200
112
- ${isClickableType && !inputProps.disabled ? 'cursor-pointer hover:text-login-text' : 'pointer-events-none'}
113
- `, onClick: handleIconClick, children: displayIcon })), _jsx("input", { ...inputProps, ref: localRef, id: name, name: isClickableType ? undefined : name, type: isClickableType ? 'text' : type, value: isDateType ? getDateDisplayValue() : value, readOnly: isClickableType, onClick: () => isClickableType && !inputProps.disabled && setIsOpen(true), "aria-describedby": error ? `${name}-error` : undefined, style: { anchorName }, className: `
114
- w-full rounded-md bg-login-500/50 border border-login-500
115
- text-login-text placeholder-login-200
116
- focus:outline-none focus:border-login focus:ring-1 focus:ring-login
117
- disabled:opacity-50 disabled:cursor-not-allowed
118
- h-10.5 py-2 ${displayIcon ? 'pl-10 pr-3' : 'px-3'}
119
- transition-all duration-200
120
- input-reset
121
- ${error ? 'border-red-500 focus:border-red-500 focus:ring-red-500' : ''}
122
- ${isClickableType && !inputProps.disabled ? 'cursor-pointer' : ''}
123
- ` }), isClickableType && (_jsx("input", { type: 'hidden', name: name, value: value })), isOpen && isDateType && !inputProps.disabled && (_jsx(DateTimePickerPopup, { value: getDateValue(), onChange: handleDateChange, type: type, onClose: () => setIsOpen(false), anchorName: anchorName })), isOpen && isColorType && !inputProps.disabled && (_jsx(ColorPickerPopup, { value: value || '', onChange: handleColorChange, onClose: () => setIsOpen(false), anchorName: anchorName }))] }) }));
124
- }
@@ -1,17 +0,0 @@
1
- export type RadioOption = {
2
- label: string;
3
- value: string | number;
4
- };
5
- export type RadioProps = Omit<React.ComponentProps<'input'>, 'name' | 'onChange' | 'value'> & {
6
- name: string;
7
- label?: string;
8
- error?: string;
9
- info?: string;
10
- description?: string;
11
- className?: string;
12
- options: RadioOption[];
13
- value?: string | number | null;
14
- onChange?: (value: string | number) => void;
15
- textSize?: 'sm' | 'md';
16
- };
17
- export default function Radio(props: RadioProps): import("react/jsx-runtime").JSX.Element;
@@ -1,27 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FieldWrapper, InputLabel } from './shared';
3
- export default function Radio(props) {
4
- const { options, onChange, value, label, description, error, info, name, className, textSize = 'sm', ...rest } = props;
5
- return (_jsx(FieldWrapper, { label: label, name: name, required: rest.required, info: info, description: description, error: error, textSize: textSize, className: className, children: _jsx("div", { className: 'flex flex-col gap-2', children: options.map((option) => (_jsx(RadioItem, { name: name, value: option.value, label: option.label, checked: value === option.value, disabled: rest.disabled, onChange: () => {
6
- if (onChange)
7
- onChange(option.value);
8
- }, className: 'mb-0' }, option.value))) }) }));
9
- }
10
- function RadioItem(props) {
11
- const { name, label, error, ...inputProps } = props;
12
- const { value } = inputProps;
13
- const id = `${name}-${value}`;
14
- return (_jsxs("div", { className: 'flex items-center gap-2', children: [_jsxs("div", { className: 'relative w-5 h-5 shrink-0', children: [_jsx("input", { ...inputProps, id: id, name: name, type: 'radio', className: `
15
- peer appearance-none rounded-full border border-login-500 bg-login-500/50
16
- checked:bg-login checked:border-login
17
- focus:outline-none focus:ring-2 focus:ring-login/50
18
- disabled:opacity-50 disabled:cursor-not-allowed
19
- cursor-pointer transition-all duration-200
20
- w-5 h-5 absolute inset-0
21
- ${error ? 'border-red-500' : ''}
22
- ` }), _jsx("div", { className: `
23
- absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2
24
- w-2 h-2 rounded-full bg-white pointer-events-none opacity-0
25
- peer-checked:opacity-100 transition-opacity duration-200
26
- ` })] }), label && (_jsx(InputLabel, { label: label, name: name, disabled: inputProps.disabled, className: 'select-none cursor-pointer' }))] }));
27
- }
@@ -1,11 +0,0 @@
1
- export type RangeProps = Omit<React.ComponentProps<'input'>, 'name'> & {
2
- name: string;
3
- label?: string;
4
- error?: string;
5
- className?: string;
6
- info?: string;
7
- description?: string;
8
- showValue?: boolean;
9
- textSize?: 'sm' | 'md';
10
- };
11
- export default function Range(props: RangeProps): import("react/jsx-runtime").JSX.Element;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FieldWrapper } from './shared';
3
- export default function Range(props) {
4
- const { name, label, error, className, info, description, showValue = true, textSize = 'sm', ...inputProps } = props;
5
- const { min = 0, max = 100, step = 1, value = 0 } = inputProps;
6
- return (_jsx(FieldWrapper, { label: label, name: name, required: inputProps.required, info: info, description: description, error: error, textSize: textSize, className: className, children: _jsxs("div", { className: 'flex items-center gap-4', children: [_jsx("input", { ...inputProps, id: name, name: name, type: 'range', min: min, max: max, step: step, value: value, title: label, "aria-invalid": !!error, "aria-describedby": error ? `${name}-error` : undefined, className: `
7
- flex-1 h-2 bg-login-500 rounded-lg appearance-none cursor-pointer
8
- accent-login
9
- [&::-webkit-slider-thumb]:appearance-none
10
- [&::-webkit-slider-thumb]:w-4
11
- [&::-webkit-slider-thumb]:h-4
12
- [&::-webkit-slider-thumb]:rounded-full
13
- [&::-webkit-slider-thumb]:bg-login
14
- [&::-moz-range-thumb]:w-4
15
- [&::-moz-range-thumb]:h-4
16
- [&::-moz-range-thumb]:rounded-full
17
- [&::-moz-range-thumb]:bg-login
18
- [&::-moz-range-thumb]:border-none
19
- disabled:opacity-50 disabled:cursor-not-allowed
20
- ${error ? 'accent-red-500' : ''}
21
- ` }), showValue && (_jsx("span", { className: 'text-login-text text-sm font-medium min-w-10 text-right', children: value }))] }) }));
22
- }
@@ -1,6 +0,0 @@
1
- interface SearchInputProps {
2
- placeholder?: string;
3
- variant?: 'default' | 'minimal';
4
- }
5
- export default function SearchInput({ placeholder, variant }: SearchInputProps): import("react/jsx-runtime").JSX.Element | undefined;
6
- export {};
@@ -1,42 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, useEffect } from 'react';
4
- import { useRouter, usePathname, useSearchParams } from 'next/navigation';
5
- import { Search } from 'lucide-react';
6
- import Input from './input';
7
- export default function SearchInput({ placeholder = 'Search...', variant = 'default' }) {
8
- const router = useRouter();
9
- const pathname = usePathname();
10
- const searchParams = useSearchParams();
11
- const [searchValue, setSearchValue] = useState(searchParams.get('q') || '');
12
- useEffect(() => {
13
- const currentQ = searchParams.get('q') || '';
14
- setSearchValue(currentQ);
15
- }, [searchParams]);
16
- function handleSearch(value) {
17
- setSearchValue(value);
18
- const params = new URLSearchParams(searchParams.toString());
19
- if (value.trim()) {
20
- params.set('q', value.trim());
21
- }
22
- else {
23
- params.delete('q');
24
- }
25
- params.delete('page');
26
- router.push(`${pathname}?${params.toString()}`);
27
- }
28
- function handleKeyDown(e) {
29
- if (e.key === 'Enter') {
30
- handleSearch(searchValue);
31
- }
32
- }
33
- function handleChange(e) {
34
- setSearchValue(e.target.value);
35
- }
36
- if (variant === 'minimal') {
37
- return (_jsxs("div", { className: 'relative', children: [_jsx(Search, { className: 'absolute left-3 top-1/2 transform -translate-y-1/2 h-5 w-5' }), _jsx("input", { type: 'text', value: searchValue, onChange: (e) => setSearchValue(e.target.value), onKeyDown: handleKeyDown, onBlur: () => handleSearch(searchValue), placeholder: placeholder, className: 'pl-10 pr-4 py-2 border-b outline-none w-64' })] }));
38
- }
39
- else {
40
- _jsx(Input, { name: 'search', icon: _jsx(Search, { className: 'w-5 h-5' }), value: searchValue, onChange: handleChange, onKeyDown: handleKeyDown, onBlur: () => handleSearch(searchValue), placeholder: placeholder });
41
- }
42
- }
@@ -1,23 +0,0 @@
1
- export type Option = {
2
- value: string | number;
3
- label: string;
4
- image?: string;
5
- };
6
- export type SelectProps = {
7
- label?: string;
8
- name: string;
9
- value?: string | number | null;
10
- onChange?: (value: string | number | null) => void;
11
- options: Option[];
12
- error?: string;
13
- className?: string;
14
- disabled?: boolean;
15
- required?: boolean;
16
- placeholder?: string;
17
- info?: string;
18
- description?: string;
19
- clearable?: boolean;
20
- searchable?: boolean;
21
- textSize?: 'sm' | 'md';
22
- };
23
- export default function Select({ label, name, value, onChange, options, error, className, disabled, required, placeholder, info, description, clearable, searchable, textSize, }: SelectProps): import("react/jsx-runtime").JSX.Element;
@@ -1,70 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, useEffect } from 'react';
4
- import Image from 'next/image';
5
- import { useClickOutside } from '../../hooks';
6
- import { ChevronDown, X, Search } from 'lucide-react';
7
- import { FieldWrapper } from './shared';
8
- export default function Select({ label, name, value, onChange, options, error, className, disabled, required, placeholder = 'Select an option', info, description, clearable = true, searchable = true, textSize = 'sm', }) {
9
- const [isOpen, setIsOpen] = useState(false);
10
- const [searchTerm, setSearchTerm] = useState('');
11
- const [selectedOption, setSelectedOption] = useState(options.find(opt => opt.value === value));
12
- useEffect(() => {
13
- if (!isOpen) {
14
- setSearchTerm('');
15
- }
16
- }, [isOpen]);
17
- useEffect(() => {
18
- setSelectedOption(options.find(opt => opt.value === value));
19
- }, [value, options]);
20
- const containerRef = useClickOutside(() => setIsOpen(false));
21
- function handleSelect(option) {
22
- if (disabled)
23
- return;
24
- setSelectedOption(option);
25
- setIsOpen(false);
26
- if (onChange) {
27
- onChange(option.value);
28
- }
29
- }
30
- function handleClear(e) {
31
- e.stopPropagation();
32
- if (disabled)
33
- return;
34
- setSelectedOption(undefined);
35
- if (onChange) {
36
- onChange(null);
37
- }
38
- }
39
- const filteredOptions = options.filter(option => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
40
- return (_jsxs(FieldWrapper, { label: label, name: name, required: required, info: info, description: description, error: error, textSize: textSize, className: className, children: [_jsxs("div", { className: 'relative', ref: containerRef, children: [_jsxs("button", { type: 'button', onClick: () => !disabled && setIsOpen(!isOpen), disabled: disabled, "aria-haspopup": 'listbox', "aria-expanded": isOpen, "aria-labelledby": label ? undefined : name, className: `
41
- w-full rounded-md bg-login-500/50 border border-login-500
42
- text-login-text text-left
43
- focus:outline-none focus:border-login focus:ring-1 focus:ring-login
44
- disabled:opacity-50 disabled:cursor-not-allowed
45
- h-10.5 py-2 pl-3 pr-10
46
- transition-all duration-200
47
- flex items-center justify-between
48
- ${error ? 'border-red-500 focus:border-red-500 focus:ring-red-500' : ''}
49
- ${!selectedOption ? 'text-login-200' : ''}
50
- `, title: label, children: [_jsxs("div", { className: 'flex items-center gap-2 truncate', children: [selectedOption?.image && (_jsx(Image, { src: selectedOption.image, alt: '', width: 30, height: 20, className: 'rounded-xs object-cover shrink-0' })), _jsx("span", { className: 'truncate', children: selectedOption ? selectedOption.label : placeholder })] }), _jsxs("div", { className: 'absolute inset-y-0 right-0 flex items-center px-2 gap-1', children: [clearable && selectedOption && !disabled && (_jsx("div", { role: 'button', onClick: handleClear, className: `
51
- p-1 hover:bg-login-500 rounded-full text-login-200
52
- hover:text-red-400 transition-colors cursor-pointer
53
- `, title: 'Clear selection', children: _jsx(X, { className: 'w-3 h-3' }) })), _jsx("div", { className: `
54
- text-login-200 pointer-events-none
55
- transition-transform duration-200
56
- ${isOpen ? 'rotate-180' : ''}
57
- `, children: _jsx(ChevronDown, { className: 'w-4 h-4' }) })] })] }), isOpen && (_jsxs("div", { className: `
58
- absolute z-50 w-full mt-1 bg-login-600 border border-login-500
59
- rounded-md shadow-lg max-h-60 overflow-hidden flex flex-col
60
- `, children: [searchable && (_jsx("div", { className: 'p-2 sticky top-0 bg-login-600 border-b border-login-500 z-10', children: _jsxs("div", { className: 'relative', children: [_jsx(Search, { className: 'absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-login-200' }), _jsx("input", { type: 'text', value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), placeholder: 'Search...', autoFocus: true, className: `
61
- w-full bg-login-500/50 border border-login-500 rounded-md
62
- py-1.5 pl-9 pr-3 text-sm text-login-text
63
- focus:outline-none focus:border-login focus:ring-1 focus:ring-login
64
- ` })] }) })), _jsx("div", { className: 'overflow-auto noscroll', children: filteredOptions.length > 0 ? (_jsx("ul", { className: 'py-1', role: 'listbox', children: filteredOptions.map((option) => (_jsx("li", { role: 'option', "aria-selected": selectedOption?.value === option.value, children: _jsxs("button", { type: 'button', onClick: () => handleSelect(option), className: `
65
- w-full text-left px-3 py-2 text-sm
66
- hover:bg-login-500 transition-colors duration-150
67
- flex items-center gap-2
68
- ${selectedOption?.value === option.value ? 'bg-login-500 text-login' : 'text-login-text'}
69
- `, children: [option.image && (_jsx(Image, { src: option.image, alt: '', width: 75, height: 25, className: 'rounded-md object-cover shrink-0' })), _jsx("span", { className: 'truncate', children: option.label })] }) }, option.value))) })) : (_jsx("div", { className: 'px-3 py-2 text-sm text-login-200', children: searchTerm ? 'No results found' : 'No options available' })) })] }))] }), _jsx("input", { type: 'hidden', name: name, value: selectedOption?.value || '', required: required })] }));
70
- }
@@ -1,8 +0,0 @@
1
- import { type JSX } from 'react';
2
- export type ColorPickerPopupProps = {
3
- value: string;
4
- onChange: (color: string) => void;
5
- onClose: () => void;
6
- anchorName?: string;
7
- };
8
- export default function ColorPickerPopup({ value, onChange, onClose, anchorName }: ColorPickerPopupProps): JSX.Element;