@apptimate/ui 1.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.
package/src/Select.tsx ADDED
@@ -0,0 +1,49 @@
1
+ "use client";
2
+
3
+ import React from 'react';
4
+ import { cn } from '@apptimate/core-lib';
5
+ import { ChevronDown } from 'lucide-react';
6
+
7
+ export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
8
+ label?: string;
9
+ error?: string;
10
+ isRequired?: boolean;
11
+ options: { label: string; value: string | number }[];
12
+ }
13
+
14
+ export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
15
+ ({ label, error, isRequired, options, className, ...props }, ref) => {
16
+ return (
17
+ <div className={cn("flex flex-col gap-1.5 w-full", className)}>
18
+ {label && (
19
+ <label className="text-[12px] font-semibold text-foreground-subtle tracking-[0.3px] uppercase">
20
+ {label} {isRequired && <span className="text-danger-alt ml-0.5">*</span>}
21
+ </label>
22
+ )}
23
+ <div className="relative group">
24
+ <select
25
+ ref={ref}
26
+ className={cn(
27
+ "w-full bg-surface-0 border-1.5 border-border-subtle rounded-[10px] px-3.5 py-2.5 text-[13.5px] text-foreground-1 outline-none transition-all focus:border-primary focus:bg-surface-1 appearance-none cursor-pointer",
28
+ error && "border-danger-alt focus:border-danger-alt"
29
+ )}
30
+ {...props}
31
+ >
32
+ <option value="" disabled>Select an option</option>
33
+ {options.map((opt) => (
34
+ <option key={opt.value} value={opt.value}>
35
+ {opt.label}
36
+ </option>
37
+ ))}
38
+ </select>
39
+ <div className="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-foreground-disabled group-focus-within:text-primary transition-colors">
40
+ <ChevronDown size={16} />
41
+ </div>
42
+ </div>
43
+ {error && <span className="text-[11px] text-danger-alt font-medium">{error}</span>}
44
+ </div>
45
+ );
46
+ }
47
+ );
48
+
49
+ Select.displayName = 'Select';
package/src/Table.tsx ADDED
@@ -0,0 +1,78 @@
1
+ "use client";
2
+
3
+ import React from 'react';
4
+ import { cn } from '@apptimate/core-lib';
5
+
6
+ export interface TableProps {
7
+ children?: React.ReactNode;
8
+ className?: string;
9
+ }
10
+
11
+ export const Table = ({ children, className }: TableProps) => {
12
+ return (
13
+ <div className={cn("w-full overflow-x-auto", className)}>
14
+ <table className="w-full border-separate border-spacing-0 text-left min-w-[600px]">
15
+ {children}
16
+ </table>
17
+ </div>
18
+ );
19
+ };
20
+
21
+ export const THeader = ({ children, className }: TableProps) => (
22
+ <thead className={cn(className)}>
23
+ {children}
24
+ </thead>
25
+ );
26
+
27
+ export const TBody = ({ children, className }: TableProps) => (
28
+ <tbody className={cn(className)}>
29
+ {children}
30
+ </tbody>
31
+ );
32
+
33
+ export const TRow = ({ children, className, onClick }: TableProps & { onClick?: () => void }) => (
34
+ <tr
35
+ className={cn(
36
+ "group transition-colors",
37
+ onClick && "cursor-pointer hover:bg-surface-hover-table",
38
+ className
39
+ )}
40
+ onClick={onClick}
41
+ >
42
+ {children}
43
+ </tr>
44
+ );
45
+
46
+ export const TCell = ({ children, className, isHeader = false, colSpan, rowSpan }: TableProps & { isHeader?: boolean; colSpan?: number; rowSpan?: number }) => {
47
+ const Tag = isHeader ? 'th' : 'td';
48
+ return (
49
+ <Tag
50
+ colSpan={colSpan}
51
+ rowSpan={rowSpan}
52
+ className={cn(
53
+ "transition-all",
54
+ isHeader
55
+ ? "bg-surface-0 py-[10px] px-[14px] text-[11px] font-semibold text-foreground-subtle uppercase tracking-wider first:rounded-l-[8px] last:rounded-r-[8px]"
56
+ : "py-3 px-2 text-[13px] font-medium text-foreground-1 border-b border-surface-0",
57
+ className
58
+ )}>
59
+ {children}
60
+ </Tag>
61
+ );
62
+ };
63
+
64
+ export const TLoader = ({ rows = 8, cols = 4 }: { rows?: number; cols?: number }) => {
65
+ return (
66
+ <>
67
+ {Array.from({ length: rows }).map((_, i) => (
68
+ <TRow key={i}>
69
+ {Array.from({ length: cols }).map((_, j) => (
70
+ <TCell key={j}>
71
+ <div className="h-4 bg-surface-0 animate-pulse rounded w-full" />
72
+ </TCell>
73
+ ))}
74
+ </TRow>
75
+ ))}
76
+ </>
77
+ );
78
+ };
package/src/index.tsx ADDED
@@ -0,0 +1,20 @@
1
+ "use client";
2
+
3
+ export * from './Accordion';
4
+ export * from './Badge';
5
+ export * from './Button';
6
+ export * from './ButtonGroup';
7
+ export * from './Card';
8
+ export * from './Checkbox';
9
+ export * from './ChipInput';
10
+ export * from './Divider';
11
+ export * from './Dropdown';
12
+ export * from './EmptyState';
13
+ export * from './HintIcon';
14
+ export * from './Input';
15
+ export * from './Modal';
16
+ export * from './Pagination';
17
+ export * from './PopConfirm';
18
+ export * from './SearchableSelect';
19
+ export * from './Select';
20
+ export * from './Table';