@opencxh/ui-kit 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.
Files changed (37) hide show
  1. package/README.md +261 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +3076 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.umd.cjs +2 -0
  6. package/dist/index.umd.cjs.map +1 -0
  7. package/dist/src/action/Button.d.ts +50 -0
  8. package/dist/src/action/ButtonGroup.d.ts +17 -0
  9. package/dist/src/action/Link.d.ts +21 -0
  10. package/dist/src/command-palette/CommandPalette.d.ts +22 -0
  11. package/dist/src/command-palette/index.d.ts +2 -0
  12. package/dist/src/content/Icon.d.ts +21 -0
  13. package/dist/src/content/Image.d.ts +29 -0
  14. package/dist/src/content/PageHeader.d.ts +43 -0
  15. package/dist/src/content/Table.d.ts +108 -0
  16. package/dist/src/feedback/Badge.d.ts +48 -0
  17. package/dist/src/feedback/ContentLoading.d.ts +21 -0
  18. package/dist/src/feedback/Spinner.d.ts +32 -0
  19. package/dist/src/forms/Form.d.ts +119 -0
  20. package/dist/src/index.d.ts +28 -0
  21. package/dist/src/input/Checkbox.d.ts +55 -0
  22. package/dist/src/input/DatePicker.d.ts +26 -0
  23. package/dist/src/input/Select.d.ts +89 -0
  24. package/dist/src/input/TextArea.d.ts +39 -0
  25. package/dist/src/input/TextField.d.ts +68 -0
  26. package/dist/src/navigation/Sidebar.d.ts +17 -0
  27. package/dist/src/navigation/Tabs.d.ts +59 -0
  28. package/dist/src/overlays/Dropdown.d.ts +41 -0
  29. package/dist/src/overlays/Modal.d.ts +82 -0
  30. package/dist/src/primitives/Box.d.ts +47 -0
  31. package/dist/src/primitives/Card.d.ts +6 -0
  32. package/dist/src/typography/Heading.d.ts +23 -0
  33. package/dist/src/typography/List.d.ts +31 -0
  34. package/dist/src/typography/Text.d.ts +31 -0
  35. package/dist/src/utils/cn.d.ts +14 -0
  36. package/dist/vite.config.d.ts +2 -0
  37. package/package.json +62 -0
@@ -0,0 +1,89 @@
1
+ import { default as React } from 'react';
2
+ export interface SelectOption {
3
+ value: string;
4
+ label: string;
5
+ disabled?: boolean;
6
+ }
7
+ export interface SelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
8
+ /**
9
+ * The value of the select field.
10
+ * For multi-select, this is an array of strings.
11
+ */
12
+ value?: string | string[];
13
+ /**
14
+ * Callback function when the value changes.
15
+ * For multi-select, this returns an array of strings.
16
+ */
17
+ onChange?: (value: string | string[]) => void;
18
+ /**
19
+ * The label for the select field
20
+ */
21
+ label?: string;
22
+ /**
23
+ * Helper text to display below the select
24
+ */
25
+ helperText?: string;
26
+ /**
27
+ * Error message to display when the select is invalid
28
+ */
29
+ error?: string;
30
+ /**
31
+ * The size of the select field
32
+ */
33
+ size?: "sm" | "md" | "lg" | "full";
34
+ /**
35
+ * Whether the select should take the full width of its container
36
+ */
37
+ fullWidth?: boolean;
38
+ /**
39
+ * The options for the select
40
+ */
41
+ options: SelectOption[];
42
+ /**
43
+ * Placeholder text when no option is selected
44
+ */
45
+ placeholder?: string;
46
+ /**
47
+ * Additional class name for the container
48
+ */
49
+ containerClassName?: string;
50
+ /**
51
+ * Additional class name for the label
52
+ */
53
+ labelClassName?: string;
54
+ /**
55
+ * Whether the select should be searchable
56
+ */
57
+ searchable?: boolean;
58
+ /**
59
+ * Multiple select
60
+ */
61
+ multiple?: boolean;
62
+ }
63
+ /**
64
+ * Select component with theme integration
65
+ *
66
+ * @example
67
+ * ```tsx
68
+ * <Select
69
+ * label="Country"
70
+ * placeholder="Select a country"
71
+ * options={[
72
+ * { value: 'us', label: 'United States' },
73
+ * { value: 'ca', label: 'Canada' },
74
+ * { value: 'uk', label: 'United Kingdom' }
75
+ * ]}
76
+ * />
77
+ *
78
+ * <Select
79
+ * label="Priority"
80
+ * error="Priority is required"
81
+ * options={[
82
+ * { value: 'low', label: 'Low' },
83
+ * { value: 'medium', label: 'Medium' },
84
+ * { value: 'high', label: 'High' }
85
+ * ]}
86
+ * />
87
+ * ```
88
+ */
89
+ export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,39 @@
1
+ import { default as React } from 'react';
2
+ export interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
3
+ /**
4
+ * The label for the textarea field
5
+ */
6
+ label?: string;
7
+ /**
8
+ * Helper text to display below the textarea
9
+ */
10
+ helperText?: string;
11
+ /**
12
+ * Error message to display when the textarea is invalid
13
+ */
14
+ error?: string;
15
+ /**
16
+ * The size of the textarea field
17
+ */
18
+ size?: 'sm' | 'md' | 'lg' | 'full';
19
+ /**
20
+ * Whether the textarea should take the full width of its container
21
+ */
22
+ fullWidth?: boolean;
23
+ /**
24
+ * Whether the textarea is in a loading state
25
+ */
26
+ loading?: boolean;
27
+ /**
28
+ * Additional class name for the container
29
+ */
30
+ containerClassName?: string;
31
+ /**
32
+ * Additional class name for the label
33
+ */
34
+ labelClassName?: string;
35
+ }
36
+ /**
37
+ * TextArea component with theme integration and validation states
38
+ */
39
+ export declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,68 @@
1
+ import { default as React } from 'react';
2
+ export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
3
+ /**
4
+ * The label for the input field
5
+ */
6
+ label?: string;
7
+ /**
8
+ * Helper text to display below the input
9
+ */
10
+ helperText?: string;
11
+ /**
12
+ * Error message to display when the input is invalid
13
+ */
14
+ error?: string;
15
+ /**
16
+ * The size of the input field
17
+ */
18
+ size?: 'sm' | 'md' | 'lg' | 'full';
19
+ /**
20
+ * Whether the input should take the full width of its container
21
+ */
22
+ fullWidth?: boolean;
23
+ /**
24
+ * Icon to display at the start of the input
25
+ */
26
+ startIcon?: React.ReactNode;
27
+ /**
28
+ * Icon to display at the end of the input
29
+ */
30
+ endIcon?: React.ReactNode;
31
+ /**
32
+ * Whether the input is in a loading state
33
+ */
34
+ loading?: boolean;
35
+ /**
36
+ * Additional class name for the container
37
+ */
38
+ containerClassName?: string;
39
+ /**
40
+ * Additional class name for the label
41
+ */
42
+ labelClassName?: string;
43
+ }
44
+ /**
45
+ * TextField component with theme integration and validation states
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * <TextField
50
+ * label="Email"
51
+ * placeholder="Enter your email"
52
+ * type="email"
53
+ * />
54
+ *
55
+ * <TextField
56
+ * label="Search"
57
+ * startIcon={<SearchIcon />}
58
+ * placeholder="Search..."
59
+ * />
60
+ *
61
+ * <TextField
62
+ * label="Password"
63
+ * type="password"
64
+ * error="Password is required"
65
+ * />
66
+ * ```
67
+ */
68
+ export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ export interface MenuItem {
3
+ icon?: React.ReactNode;
4
+ label: string;
5
+ count?: number;
6
+ children?: MenuItem[];
7
+ path?: string;
8
+ }
9
+ interface SidebarMenuProps {
10
+ title: string;
11
+ actionIcons?: React.ReactNode[];
12
+ items: MenuItem[];
13
+ isSelectedHandler: (path: string | undefined) => boolean;
14
+ onClick?: (path: string | undefined) => void;
15
+ }
16
+ export declare const SidebarMenu: React.FC<SidebarMenuProps>;
17
+ export default SidebarMenu;
@@ -0,0 +1,59 @@
1
+ import { default as React } from 'react';
2
+ export interface TabItem {
3
+ /** Tab identifier */
4
+ id: string;
5
+ /** Tab label */
6
+ label: string;
7
+ /** Tab content */
8
+ content?: React.ReactNode;
9
+ /** Whether tab is disabled */
10
+ disabled?: boolean;
11
+ /** Badge/count to show next to label */
12
+ badge?: string | number;
13
+ }
14
+ export interface TabsProps {
15
+ /** Tab items */
16
+ items: TabItem[];
17
+ /** Default active tab */
18
+ defaultTab?: string;
19
+ /** Active tab (controlled) */
20
+ activeTab?: string;
21
+ /** Tab change handler */
22
+ onTabChange?: (tabId: string) => void;
23
+ /** Tabs variant */
24
+ variant?: 'default' | 'pills' | 'underline';
25
+ /** Tabs size */
26
+ size?: 'sm' | 'md' | 'lg';
27
+ /** Additional CSS classes */
28
+ className?: string;
29
+ }
30
+ export interface TabBarProps {
31
+ /** Tab items (simplified for bar style) */
32
+ items: Array<{
33
+ id: string;
34
+ label: string;
35
+ badge?: string | number;
36
+ disabled?: boolean;
37
+ }>;
38
+ /** Active tab */
39
+ activeTab?: string;
40
+ /** Tab change handler */
41
+ onTabChange?: (tabId: string) => void;
42
+ /** Additional CSS classes */
43
+ className?: string;
44
+ }
45
+ /**
46
+ * TabBar component for simple tab navigation (like in the screenshot)
47
+ */
48
+ export declare const TabBar: React.FC<TabBarProps>;
49
+ /**
50
+ * Full Tabs component with content panels
51
+ */
52
+ export declare const Tabs: React.FC<TabsProps>;
53
+ /**
54
+ * Hook to access tab context
55
+ */
56
+ export declare const useTabsContext: () => {
57
+ activeTab: string;
58
+ setActiveTab: (tab: string) => void;
59
+ };
@@ -0,0 +1,41 @@
1
+ import { default as React } from 'react';
2
+ export interface DropdownOption {
3
+ /** Option value */
4
+ value: string;
5
+ /** Option label */
6
+ label: string;
7
+ /** Option icon */
8
+ icon?: React.ReactNode;
9
+ /** Whether option is disabled */
10
+ disabled?: boolean;
11
+ /** Whether option is a divider */
12
+ divider?: boolean;
13
+ /** Optional description for the option */
14
+ description?: string;
15
+ /** Nested sub-options */
16
+ children?: DropdownOption[];
17
+ }
18
+ export interface DropdownProps {
19
+ /** Dropdown trigger element */
20
+ trigger: React.ReactNode;
21
+ /** Dropdown options */
22
+ options: DropdownOption[];
23
+ /** Selected value */
24
+ value?: string | Record<string, string | string[]>;
25
+ /** Change handler */
26
+ onSelect?: (value: string, parentValue?: string) => void;
27
+ /** Dropdown placement */
28
+ placement?: "bottom-start" | "bottom-end" | "top-start" | "top-end";
29
+ /** Whether dropdown is disabled */
30
+ disabled?: boolean;
31
+ /** Additional CSS classes */
32
+ className?: string;
33
+ /** Show check mark for selected option */
34
+ showCheck?: boolean;
35
+ /** Header text for the dropdown */
36
+ header?: string;
37
+ }
38
+ /**
39
+ * Dropdown component for menus and select-like interfaces
40
+ */
41
+ export declare const Dropdown: React.FC<DropdownProps>;
@@ -0,0 +1,82 @@
1
+ import { default as React } from 'react';
2
+ export interface ModalProps {
3
+ /**
4
+ * Whether the modal is open
5
+ */
6
+ open: boolean;
7
+ /**
8
+ * Callback fired when the modal should be closed
9
+ */
10
+ onClose: () => void;
11
+ /**
12
+ * The title of the modal
13
+ */
14
+ title?: string;
15
+ /**
16
+ * The size of the modal
17
+ */
18
+ size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
19
+ /**
20
+ * Whether clicking the backdrop should close the modal
21
+ */
22
+ closeOnBackdropClick?: boolean;
23
+ /**
24
+ * Whether pressing escape should close the modal
25
+ */
26
+ closeOnEscape?: boolean;
27
+ /**
28
+ * Additional class name for the modal content
29
+ */
30
+ className?: string;
31
+ /**
32
+ * Additional class name for the modal backdrop
33
+ */
34
+ backdropClassName?: string;
35
+ /**
36
+ * The content of the modal
37
+ */
38
+ children: React.ReactNode;
39
+ /**
40
+ * Footer content for the modal
41
+ */
42
+ footer?: React.ReactNode;
43
+ /**
44
+ * Whether to show the close button
45
+ */
46
+ showCloseButton?: boolean;
47
+ }
48
+ /**
49
+ * Modal component with theme integration and accessibility features
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * <Modal
54
+ * open={isOpen}
55
+ * onClose={() => setIsOpen(false)}
56
+ * title="Confirm Action"
57
+ * size="md"
58
+ * >
59
+ * <p>Are you sure you want to delete this item?</p>
60
+ * </Modal>
61
+ *
62
+ * <Modal
63
+ * open={isOpen}
64
+ * onClose={() => setIsOpen(false)}
65
+ * title="Settings"
66
+ * size="lg"
67
+ * footer={
68
+ * <div className="flex justify-end space-x-2">
69
+ * <Button variant="outline" onClick={() => setIsOpen(false)}>
70
+ * Cancel
71
+ * </Button>
72
+ * <Button onClick={handleSave}>
73
+ * Save
74
+ * </Button>
75
+ * </div>
76
+ * }
77
+ * >
78
+ * <SettingsForm />
79
+ * </Modal>
80
+ * ```
81
+ */
82
+ export declare function Modal({ open, onClose, title, size, closeOnBackdropClick, closeOnEscape, className, backdropClassName, children, footer, showCloseButton, }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,47 @@
1
+ import { default as React } from 'react';
2
+ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /**
4
+ * Padding size
5
+ */
6
+ padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
7
+ /**
8
+ * Margin size
9
+ */
10
+ margin?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
11
+ /**
12
+ * Background color
13
+ */
14
+ background?: 'none' | 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'white' | 'module';
15
+ /**
16
+ * Border radius
17
+ */
18
+ radius?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
19
+ /**
20
+ * Shadow size
21
+ */
22
+ shadow?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
23
+ /**
24
+ * Border width
25
+ */
26
+ border?: 'none' | 'sm' | 'md' | 'lg';
27
+ /**
28
+ * Border color
29
+ */
30
+ borderColor?: 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'white';
31
+ }
32
+ /**
33
+ * Box primitive component for layout and styling
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * <Box padding="md" background="primary" radius="lg">
38
+ * Content
39
+ * </Box>
40
+ *
41
+ * <Box as="section" padding="lg" shadow="md">
42
+ * <h2>Section Title</h2>
43
+ * <p>Section content</p>
44
+ * </Box>
45
+ * ```
46
+ */
47
+ export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,6 @@
1
+ import { BoxProps } from './Box';
2
+ export interface CardProps extends BoxProps {
3
+ children: React.ReactNode;
4
+ title?: string;
5
+ }
6
+ export declare const Card: ({ children, title, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { default as React } from 'react';
2
+ export interface HeadingProps {
3
+ /** Heading level */
4
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
5
+ /** Visual size (can be different from semantic level) */
6
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
7
+ /** Font weight */
8
+ weight?: 'light' | 'normal' | 'medium' | 'semibold' | 'bold';
9
+ /** Text color */
10
+ color?: 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'current';
11
+ /** Text alignment */
12
+ align?: 'left' | 'center' | 'right';
13
+ /** Whether to truncate text with ellipsis */
14
+ truncate?: boolean;
15
+ /** Additional CSS classes */
16
+ className?: string;
17
+ /** Child content */
18
+ children: React.ReactNode;
19
+ }
20
+ /**
21
+ * Heading component with semantic HTML and theme integration
22
+ */
23
+ export declare const Heading: React.FC<HeadingProps>;
@@ -0,0 +1,31 @@
1
+ import { default as React } from 'react';
2
+ export interface ListItem {
3
+ /** Unique identifier */
4
+ id?: string;
5
+ /** List item content */
6
+ content: React.ReactNode;
7
+ /** Whether the item is disabled */
8
+ disabled?: boolean;
9
+ /** Click handler for interactive lists */
10
+ onClick?: () => void;
11
+ }
12
+ export interface ListProps {
13
+ /** List items */
14
+ items: ListItem[];
15
+ /** List type */
16
+ type?: 'unordered' | 'ordered' | 'description';
17
+ /** List variant */
18
+ variant?: 'default' | 'flush' | 'bordered' | 'divided';
19
+ /** List size */
20
+ size?: 'sm' | 'md' | 'lg';
21
+ /** Whether list items are interactive */
22
+ interactive?: boolean;
23
+ /** Additional CSS classes */
24
+ className?: string;
25
+ /** Additional CSS classes for list items */
26
+ itemClassName?: string;
27
+ }
28
+ /**
29
+ * List component with theme integration and multiple variants
30
+ */
31
+ export declare const List: React.FC<ListProps>;
@@ -0,0 +1,31 @@
1
+ import { default as React } from 'react';
2
+ export interface TextProps {
3
+ /** Text variant */
4
+ variant?: 'body' | 'caption' | 'label' | 'code';
5
+ /** Text size */
6
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
7
+ /** Font weight */
8
+ weight?: 'light' | 'normal' | 'medium' | 'semibold' | 'bold';
9
+ /** Text color */
10
+ color?: 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'current' | 'muted';
11
+ /** Text alignment */
12
+ align?: 'left' | 'center' | 'right' | 'justify';
13
+ /** Whether to truncate text with ellipsis */
14
+ truncate?: boolean;
15
+ /** Whether text should be italic */
16
+ italic?: boolean;
17
+ /** Whether text should be underlined */
18
+ underline?: boolean;
19
+ /** Line height */
20
+ lineHeight?: 'tight' | 'normal' | 'relaxed';
21
+ /** HTML element to render */
22
+ as?: 'p' | 'span' | 'div' | 'code' | 'pre';
23
+ /** Additional CSS classes */
24
+ className?: string;
25
+ /** Child content */
26
+ children: React.ReactNode;
27
+ }
28
+ /**
29
+ * Text component with theme integration and typography variants
30
+ */
31
+ export declare const Text: React.FC<TextProps>;
@@ -0,0 +1,14 @@
1
+ import { ClassValue } from 'clsx';
2
+ /**
3
+ * Utility function for combining class names
4
+ * Combines clsx for conditional classes with Tailwind merge for deduplication
5
+ */
6
+ export declare function cn(...inputs: ClassValue[]): string;
7
+ /**
8
+ * Utility for creating variant-based class combinations
9
+ */
10
+ export declare function createVariants<T extends Record<string, Record<string, string>>>(variants: T): (variant: keyof T, value: keyof T[keyof T]) => T[keyof T][keyof T[keyof T]] | "";
11
+ /**
12
+ * Utility for creating size-based class combinations
13
+ */
14
+ export declare function createSizes<T extends Record<string, string>>(sizes: T): (size: keyof T) => "" | T[keyof T];
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vite').UserConfig;
2
+ export default _default;
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@opencxh/ui-kit",
3
+ "version": "1.0.0",
4
+ "description": "Theme-aware UI component library for OpenCXH platform",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./dist/index.js",
9
+ "require": "./dist/index.cjs",
10
+ "types": "./dist/index.d.ts"
11
+ },
12
+ "./styles": "./dist/styles.css"
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "scripts": {
19
+ "clean": "rm -rf dist",
20
+ "build": "vite build",
21
+ "dev": "vite build --watch",
22
+ "typecheck": "tsc --noEmit",
23
+ "test": "vitest",
24
+ "test:run": "vitest run",
25
+ "test:watch": "vitest --watch",
26
+ "test:coverage": "vitest --coverage"
27
+ },
28
+ "dependencies": {
29
+ "clsx": "^2.1.0",
30
+ "lucide-react": "^0.460.0",
31
+ "react": "^19.1.0",
32
+ "react-dom": "^19.1.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/react": "^19.1.8",
36
+ "@types/react-dom": "^19.1.6",
37
+ "@typescript-eslint/eslint-plugin": "^8.15.0",
38
+ "@typescript-eslint/parser": "^8.15.0",
39
+ "@vitejs/plugin-react": "^4.3.4",
40
+ "eslint": "^9.15.0",
41
+ "eslint-plugin-react": "^7.37.2",
42
+ "eslint-plugin-react-hooks": "^5.0.0",
43
+ "typescript": "^5.6.3",
44
+ "vite": "^6.0.1",
45
+ "vite-plugin-dts": "^4.3.0",
46
+ "vitest": "^2.1.8"
47
+ },
48
+ "peerDependencies": {
49
+ "react": ">=19.1.0",
50
+ "react-dom": ">=19.1.0"
51
+ },
52
+ "keywords": [
53
+ "react",
54
+ "ui",
55
+ "components",
56
+ "design-system",
57
+ "theme",
58
+ "tailwind"
59
+ ],
60
+ "author": "OpenCXH Team",
61
+ "license": "MIT"
62
+ }