tmo-ui-components 0.1.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/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # @tmo/components
2
+
3
+ T-Mobile Internal UI Component Library - A React component library for internal applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # From npm (when published to private registry)
9
+ npm install @tmo/components
10
+
11
+ # From local tarball (for POC/testing)
12
+ npm install ./path/to/tmo-components-0.1.0.tgz
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```tsx
18
+ import { Button, Card, CardHeader, CardBody, Input } from '@tmo/components';
19
+
20
+ function App() {
21
+ return (
22
+ <div>
23
+ {/* Button Examples */}
24
+ <Button variant="primary" size="md">
25
+ Primary Button
26
+ </Button>
27
+
28
+ <Button variant="outline" size="lg">
29
+ Outline Button
30
+ </Button>
31
+
32
+ <Button variant="secondary" isLoading>
33
+ Loading...
34
+ </Button>
35
+
36
+ {/* Card Example */}
37
+ <Card variant="elevated" padding="lg">
38
+ <CardHeader>Card Title</CardHeader>
39
+ <CardBody>
40
+ This is the card content. You can put anything here.
41
+ </CardBody>
42
+ </Card>
43
+
44
+ {/* Input Example */}
45
+ <Input
46
+ label="Email Address"
47
+ placeholder="Enter your email"
48
+ helperText="We'll never share your email"
49
+ />
50
+
51
+ <Input
52
+ label="Password"
53
+ type="password"
54
+ error="Password is required"
55
+ />
56
+ </div>
57
+ );
58
+ }
59
+ ```
60
+
61
+ ## Components
62
+
63
+ ### Button
64
+
65
+ | Prop | Type | Default | Description |
66
+ |------|------|---------|-------------|
67
+ | variant | `'primary' \| 'secondary' \| 'outline' \| 'ghost'` | `'primary'` | Button style variant |
68
+ | size | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
69
+ | isLoading | `boolean` | `false` | Shows loading spinner |
70
+ | fullWidth | `boolean` | `false` | Makes button full width |
71
+
72
+ ### Card
73
+
74
+ | Prop | Type | Default | Description |
75
+ |------|------|---------|-------------|
76
+ | variant | `'elevated' \| 'outlined' \| 'filled'` | `'elevated'` | Card style variant |
77
+ | padding | `'none' \| 'sm' \| 'md' \| 'lg'` | `'md'` | Internal padding |
78
+ | hoverable | `boolean` | `false` | Adds hover effect |
79
+
80
+ Sub-components: `CardHeader`, `CardBody`, `CardFooter`
81
+
82
+ ### Input
83
+
84
+ | Prop | Type | Default | Description |
85
+ |------|------|---------|-------------|
86
+ | label | `string` | - | Input label |
87
+ | error | `string` | - | Error message (shows red styling) |
88
+ | helperText | `string` | - | Helper text below input |
89
+ | size | `'sm' \| 'md' \| 'lg'` | `'md'` | Input size |
90
+ | fullWidth | `boolean` | `false` | Makes input full width |
91
+
92
+ ## Development
93
+
94
+ ```bash
95
+ # Install dependencies
96
+ npm install
97
+
98
+ # Build the library
99
+ npm run build
100
+
101
+ # Create tarball for local testing
102
+ npm pack
103
+ ```
104
+
105
+ ## Publishing
106
+
107
+ ```bash
108
+ # To private npm registry (requires npm Teams/Enterprise)
109
+ npm publish --access restricted
110
+
111
+ # To local Verdaccio registry (for testing)
112
+ npm publish --registry http://localhost:4873
113
+ ```
114
+
115
+ ## License
116
+
117
+ UNLICENSED - Internal use only
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from './Button.types';
3
+ export declare const Button: React.FC<ButtonProps>;
4
+ export default Button;
@@ -0,0 +1,10 @@
1
+ import { ButtonHTMLAttributes, ReactNode } from 'react';
2
+ export type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost';
3
+ export type ButtonSize = 'sm' | 'md' | 'lg';
4
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
5
+ children: ReactNode;
6
+ variant?: ButtonVariant;
7
+ size?: ButtonSize;
8
+ isLoading?: boolean;
9
+ fullWidth?: boolean;
10
+ }
@@ -0,0 +1,2 @@
1
+ export { Button, default } from './Button';
2
+ export type { ButtonProps, ButtonVariant, ButtonSize } from './Button.types';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { CardProps, CardHeaderProps, CardBodyProps, CardFooterProps } from './Card.types';
3
+ export declare const Card: React.FC<CardProps>;
4
+ export declare const CardHeader: React.FC<CardHeaderProps>;
5
+ export declare const CardBody: React.FC<CardBodyProps>;
6
+ export declare const CardFooter: React.FC<CardFooterProps>;
7
+ export default Card;
@@ -0,0 +1,17 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export type CardVariant = 'elevated' | 'outlined' | 'filled';
3
+ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
4
+ children: ReactNode;
5
+ variant?: CardVariant;
6
+ padding?: 'none' | 'sm' | 'md' | 'lg';
7
+ hoverable?: boolean;
8
+ }
9
+ export interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
10
+ children: ReactNode;
11
+ }
12
+ export interface CardBodyProps extends HTMLAttributes<HTMLDivElement> {
13
+ children: ReactNode;
14
+ }
15
+ export interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {
16
+ children: ReactNode;
17
+ }
@@ -0,0 +1,2 @@
1
+ export { Card, CardHeader, CardBody, CardFooter, default } from './Card';
2
+ export type { CardProps, CardHeaderProps, CardBodyProps, CardFooterProps, CardVariant } from './Card.types';
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import type { CSSProperties, ReactNode } from 'react';
3
+ import { ColumnDef } from '@tanstack/react-table';
4
+ interface CustomCheckboxProps {
5
+ checked: boolean;
6
+ indeterminate?: boolean;
7
+ onClick: (e: React.MouseEvent) => void;
8
+ }
9
+ export declare const CustomCheckbox: ({ checked, indeterminate, onClick }: CustomCheckboxProps) => import("react/jsx-runtime").JSX.Element;
10
+ export interface ColumnFilterState {
11
+ selectedValues: Set<string>;
12
+ }
13
+ export interface TableFilterState {
14
+ [columnKey: string]: ColumnFilterState;
15
+ }
16
+ export type TableColumn = ColumnDef<any, any> & {
17
+ accessorKey?: string;
18
+ style?: CSSProperties | ((ctx: unknown) => CSSProperties);
19
+ cellStyle?: CSSProperties | ((ctx: unknown) => CSSProperties);
20
+ headerStyle?: CSSProperties | ((ctx: unknown) => CSSProperties);
21
+ enableSorting?: boolean;
22
+ isPrimary?: boolean;
23
+ enableCheckbox?: boolean;
24
+ enableFilter?: boolean;
25
+ filterFn?: (rowValue: unknown, filterValues: Set<string>) => boolean;
26
+ disableDrag?: boolean;
27
+ filterOptions?: string[];
28
+ filterLabel?: (value: unknown) => string;
29
+ truncate?: boolean;
30
+ };
31
+ export interface CheckboxSelectionState {
32
+ selectedRows: Set<string>;
33
+ onRowSelect: (rowId: string, event: React.MouseEvent) => void;
34
+ onSelectAll: () => void;
35
+ isAllSelected: boolean;
36
+ isPartiallySelected: boolean;
37
+ getRowId: (row: unknown) => string;
38
+ }
39
+ export interface PageInfo {
40
+ page: number;
41
+ pageSize: number;
42
+ totalRecords: number;
43
+ totalPages: number;
44
+ hasNextPage: boolean;
45
+ hasPreviousPage: boolean;
46
+ }
47
+ interface DataTableProps {
48
+ data: any[] | undefined;
49
+ columns: TableColumn[];
50
+ loading?: boolean;
51
+ onSort?: (key: string, order: 'ASC' | 'DESC') => void;
52
+ config?: {
53
+ height?: number;
54
+ rowHeight?: number;
55
+ };
56
+ onRowClick?: (row: any) => void;
57
+ pagination?: PageInfo;
58
+ onPageChange?: (page: number) => void;
59
+ onPageSizeChange?: (pageSize: number) => void;
60
+ headerStyle?: CSSProperties;
61
+ checkboxSelection?: CheckboxSelectionState;
62
+ filterState?: TableFilterState;
63
+ onFilterChange?: (columnKey: string, selectedValues: Set<string>) => void;
64
+ enableColumnReorder?: boolean;
65
+ columnOrder?: string[];
66
+ onColumnOrderChange?: (newOrder: string[]) => void;
67
+ sortingState?: Record<string, 'ASC' | 'DESC'>;
68
+ customHeaderComponent?: ReactNode;
69
+ }
70
+ export declare const DataTable: ({ data, columns, loading, onSort, config, onRowClick, pagination, onPageChange, onPageSizeChange, headerStyle, checkboxSelection, filterState, onFilterChange, enableColumnReorder, columnOrder, onColumnOrderChange, sortingState: controlledSortingState, customHeaderComponent, }: DataTableProps) => import("react/jsx-runtime").JSX.Element;
71
+ export default DataTable;
@@ -0,0 +1,2 @@
1
+ export { DataTable, CustomCheckbox, default } from './DataTable';
2
+ export type { TableColumn, TableFilterState, ColumnFilterState, CheckboxSelectionState, PageInfo, } from './DataTable';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { InputProps } from './Input.types';
3
+ export declare const Input: React.FC<InputProps>;
4
+ export default Input;
@@ -0,0 +1,9 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ export type InputSize = 'sm' | 'md' | 'lg';
3
+ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
4
+ label?: string;
5
+ error?: string;
6
+ helperText?: string;
7
+ size?: InputSize;
8
+ fullWidth?: boolean;
9
+ }
@@ -0,0 +1,2 @@
1
+ export { Input, default } from './Input';
2
+ export type { InputProps, InputSize } from './Input.types';
@@ -0,0 +1,4 @@
1
+ export * from './Button';
2
+ export * from './Card';
3
+ export * from './Input';
4
+ export * from './DataTable';
@@ -0,0 +1,119 @@
1
+ import React, { ButtonHTMLAttributes, ReactNode, HTMLAttributes, InputHTMLAttributes, CSSProperties } from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { ColumnDef } from '@tanstack/react-table';
4
+
5
+ type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost';
6
+ type ButtonSize = 'sm' | 'md' | 'lg';
7
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
8
+ children: ReactNode;
9
+ variant?: ButtonVariant;
10
+ size?: ButtonSize;
11
+ isLoading?: boolean;
12
+ fullWidth?: boolean;
13
+ }
14
+
15
+ declare const Button: React.FC<ButtonProps>;
16
+
17
+ type CardVariant = 'elevated' | 'outlined' | 'filled';
18
+ interface CardProps extends HTMLAttributes<HTMLDivElement> {
19
+ children: ReactNode;
20
+ variant?: CardVariant;
21
+ padding?: 'none' | 'sm' | 'md' | 'lg';
22
+ hoverable?: boolean;
23
+ }
24
+ interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
25
+ children: ReactNode;
26
+ }
27
+ interface CardBodyProps extends HTMLAttributes<HTMLDivElement> {
28
+ children: ReactNode;
29
+ }
30
+ interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {
31
+ children: ReactNode;
32
+ }
33
+
34
+ declare const Card: React.FC<CardProps>;
35
+ declare const CardHeader: React.FC<CardHeaderProps>;
36
+ declare const CardBody: React.FC<CardBodyProps>;
37
+ declare const CardFooter: React.FC<CardFooterProps>;
38
+
39
+ type InputSize = 'sm' | 'md' | 'lg';
40
+ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
41
+ label?: string;
42
+ error?: string;
43
+ helperText?: string;
44
+ size?: InputSize;
45
+ fullWidth?: boolean;
46
+ }
47
+
48
+ declare const Input: React.FC<InputProps>;
49
+
50
+ interface CustomCheckboxProps {
51
+ checked: boolean;
52
+ indeterminate?: boolean;
53
+ onClick: (e: React.MouseEvent) => void;
54
+ }
55
+ declare const CustomCheckbox: ({ checked, indeterminate, onClick }: CustomCheckboxProps) => react_jsx_runtime.JSX.Element;
56
+ interface ColumnFilterState {
57
+ selectedValues: Set<string>;
58
+ }
59
+ interface TableFilterState {
60
+ [columnKey: string]: ColumnFilterState;
61
+ }
62
+ type TableColumn = ColumnDef<any, any> & {
63
+ accessorKey?: string;
64
+ style?: CSSProperties | ((ctx: unknown) => CSSProperties);
65
+ cellStyle?: CSSProperties | ((ctx: unknown) => CSSProperties);
66
+ headerStyle?: CSSProperties | ((ctx: unknown) => CSSProperties);
67
+ enableSorting?: boolean;
68
+ isPrimary?: boolean;
69
+ enableCheckbox?: boolean;
70
+ enableFilter?: boolean;
71
+ filterFn?: (rowValue: unknown, filterValues: Set<string>) => boolean;
72
+ disableDrag?: boolean;
73
+ filterOptions?: string[];
74
+ filterLabel?: (value: unknown) => string;
75
+ truncate?: boolean;
76
+ };
77
+ interface CheckboxSelectionState {
78
+ selectedRows: Set<string>;
79
+ onRowSelect: (rowId: string, event: React.MouseEvent) => void;
80
+ onSelectAll: () => void;
81
+ isAllSelected: boolean;
82
+ isPartiallySelected: boolean;
83
+ getRowId: (row: unknown) => string;
84
+ }
85
+ interface PageInfo {
86
+ page: number;
87
+ pageSize: number;
88
+ totalRecords: number;
89
+ totalPages: number;
90
+ hasNextPage: boolean;
91
+ hasPreviousPage: boolean;
92
+ }
93
+ interface DataTableProps {
94
+ data: any[] | undefined;
95
+ columns: TableColumn[];
96
+ loading?: boolean;
97
+ onSort?: (key: string, order: 'ASC' | 'DESC') => void;
98
+ config?: {
99
+ height?: number;
100
+ rowHeight?: number;
101
+ };
102
+ onRowClick?: (row: any) => void;
103
+ pagination?: PageInfo;
104
+ onPageChange?: (page: number) => void;
105
+ onPageSizeChange?: (pageSize: number) => void;
106
+ headerStyle?: CSSProperties;
107
+ checkboxSelection?: CheckboxSelectionState;
108
+ filterState?: TableFilterState;
109
+ onFilterChange?: (columnKey: string, selectedValues: Set<string>) => void;
110
+ enableColumnReorder?: boolean;
111
+ columnOrder?: string[];
112
+ onColumnOrderChange?: (newOrder: string[]) => void;
113
+ sortingState?: Record<string, 'ASC' | 'DESC'>;
114
+ customHeaderComponent?: ReactNode;
115
+ }
116
+ declare const DataTable: ({ data, columns, loading, onSort, config, onRowClick, pagination, onPageChange, onPageSizeChange, headerStyle, checkboxSelection, filterState, onFilterChange, enableColumnReorder, columnOrder, onColumnOrderChange, sortingState: controlledSortingState, customHeaderComponent, }: DataTableProps) => react_jsx_runtime.JSX.Element;
117
+
118
+ export { Button, Card, CardBody, CardFooter, CardHeader, CustomCheckbox, DataTable, Input };
119
+ export type { ButtonProps, ButtonSize, ButtonVariant, CardBodyProps, CardFooterProps, CardHeaderProps, CardProps, CardVariant, CheckboxSelectionState, ColumnFilterState, InputProps, InputSize, PageInfo, TableColumn, TableFilterState };