@common-origin/design-system 2.2.5 → 2.4.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 (33) hide show
  1. package/dist/components/atoms/Box/Box.d.ts +10 -0
  2. package/dist/components/atoms/CategoryBadge/CategoryBadge.d.ts +82 -0
  3. package/dist/components/atoms/CategoryBadge/index.d.ts +2 -0
  4. package/dist/components/atoms/Container/Container.d.ts +1 -1
  5. package/dist/components/atoms/StatusBadge/StatusBadge.d.ts +68 -0
  6. package/dist/components/atoms/StatusBadge/index.d.ts +2 -0
  7. package/dist/components/atoms/index.d.ts +2 -0
  8. package/dist/components/molecules/ActionSheet/ActionSheet.d.ts +110 -0
  9. package/dist/components/molecules/ActionSheet/index.d.ts +2 -0
  10. package/dist/components/molecules/Alert/Alert.d.ts +1 -1
  11. package/dist/components/molecules/CardLarge/CardLarge.d.ts +1 -1
  12. package/dist/components/molecules/List/List.d.ts +1 -1
  13. package/dist/components/molecules/List/ListItem.d.ts +22 -1
  14. package/dist/components/molecules/SearchField/SearchField.d.ts +108 -0
  15. package/dist/components/molecules/SearchField/index.d.ts +2 -0
  16. package/dist/components/molecules/Sheet/Sheet.d.ts +1 -1
  17. package/dist/components/molecules/Slider/Slider.d.ts +1 -1
  18. package/dist/components/molecules/TabBar/TabBar.d.ts +79 -0
  19. package/dist/components/molecules/TabBar/index.d.ts +2 -0
  20. package/dist/components/molecules/index.d.ts +3 -0
  21. package/dist/index.d.ts +85 -0
  22. package/dist/index.esm.js +2776 -1283
  23. package/dist/index.esm.js.map +1 -1
  24. package/dist/index.js +2779 -1281
  25. package/dist/index.js.map +1 -1
  26. package/dist/page-components/ErrorBoundary.d.ts +1 -1
  27. package/dist/styles/tokens.json +85 -0
  28. package/dist/tokens/index.esm.js +85 -0
  29. package/dist/tokens/index.esm.js.map +1 -1
  30. package/dist/tokens/index.js +85 -0
  31. package/dist/tokens/index.js.map +1 -1
  32. package/dist/tokens/tokens.d.ts +85 -0
  33. package/package.json +1 -1
@@ -40,6 +40,11 @@ export interface BoxProps {
40
40
  borderLeft?: keyof typeof tokens.semantic.color.border;
41
41
  bg?: keyof typeof tokens.semantic.color.background;
42
42
  color?: keyof typeof tokens.semantic.color.text;
43
+ shadow?: keyof typeof tokens.base.shadow;
44
+ cursor?: 'auto' | 'default' | 'pointer' | 'wait' | 'text' | 'move' | 'help' | 'not-allowed';
45
+ transition?: string;
46
+ hoverShadow?: keyof typeof tokens.base.shadow;
47
+ hoverTransform?: string;
43
48
  overflow?: 'visible' | 'hidden' | 'scroll' | 'auto';
44
49
  overflowX?: 'visible' | 'hidden' | 'scroll' | 'auto';
45
50
  overflowY?: 'visible' | 'hidden' | 'scroll' | 'auto';
@@ -47,6 +52,11 @@ export interface BoxProps {
47
52
  children?: React.ReactNode;
48
53
  id?: string;
49
54
  style?: React.CSSProperties;
55
+ onClick?: (event: React.MouseEvent) => void;
56
+ onKeyDown?: (event: React.KeyboardEvent) => void;
57
+ tabIndex?: number;
58
+ role?: string;
59
+ 'aria-label'?: string;
50
60
  'data-testid'?: string;
51
61
  }
52
62
  export declare const Box: React.FC<BoxProps>;
@@ -0,0 +1,82 @@
1
+ import { ReactNode } from 'react';
2
+ import type { IconName } from '../../../types/icons';
3
+ /**
4
+ * Category color options for CategoryBadge
5
+ */
6
+ export type CategoryColor = 'blue' | 'purple' | 'pink' | 'yellow' | 'green' | 'red' | 'orange' | 'gray';
7
+ /**
8
+ * Visual variant options for CategoryBadge
9
+ */
10
+ export type CategoryVariant = 'filled' | 'outlined' | 'minimal';
11
+ /**
12
+ * Size options for CategoryBadge
13
+ */
14
+ export type CategorySize = 'small' | 'medium';
15
+ /**
16
+ * Props for the CategoryBadge component
17
+ */
18
+ export interface CategoryBadgeProps {
19
+ /**
20
+ * The category text to display
21
+ */
22
+ children: ReactNode;
23
+ /**
24
+ * Color scheme for the badge
25
+ * @default 'blue'
26
+ */
27
+ color?: CategoryColor;
28
+ /**
29
+ * Visual variant of the badge
30
+ * @default 'filled'
31
+ */
32
+ variant?: CategoryVariant;
33
+ /**
34
+ * Size of the badge
35
+ * @default 'medium'
36
+ */
37
+ size?: CategorySize;
38
+ /**
39
+ * Optional icon name to display
40
+ */
41
+ icon?: IconName;
42
+ /**
43
+ * Optional click handler (makes badge interactive)
44
+ */
45
+ onClick?: () => void;
46
+ /**
47
+ * Whether the badge is disabled
48
+ * @default false
49
+ */
50
+ disabled?: boolean;
51
+ /**
52
+ * Test identifier for automated testing
53
+ */
54
+ 'data-testid'?: string;
55
+ /**
56
+ * Accessible label for the badge
57
+ */
58
+ 'aria-label'?: string;
59
+ }
60
+ /**
61
+ * CategoryBadge component for displaying transaction categories
62
+ *
63
+ * Supports 8 color options, 3 visual variants, optional icons, and interactive behavior.
64
+ * Perfect for categorizing financial transactions or content.
65
+ *
66
+ * @example
67
+ * ```tsx
68
+ * <CategoryBadge color="orange" icon="restaurant">
69
+ * Food & Dining
70
+ * </CategoryBadge>
71
+ *
72
+ * <CategoryBadge
73
+ * color="blue"
74
+ * variant="outlined"
75
+ * size="small"
76
+ * onClick={() => filterByCategory('travel')}
77
+ * >
78
+ * Travel
79
+ * </CategoryBadge>
80
+ * ```
81
+ */
82
+ export declare const CategoryBadge: React.FC<CategoryBadgeProps>;
@@ -0,0 +1,2 @@
1
+ export { CategoryBadge } from './CategoryBadge';
2
+ export type { CategoryBadgeProps, CategoryColor, CategoryVariant, CategorySize } from './CategoryBadge';
@@ -3,4 +3,4 @@ export type ContainerProps = {
3
3
  children?: React.ReactNode;
4
4
  'data-testid'?: string;
5
5
  } & React.HTMLAttributes<HTMLDivElement>;
6
- export declare const Container: ({ children, ...props }: ContainerProps) => React.JSX.Element;
6
+ export declare const Container: ({ children, ...props }: ContainerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Status type options for StatusBadge
3
+ */
4
+ export type StatusType = 'pending' | 'completed' | 'failed' | 'cancelled' | 'processing' | 'scheduled';
5
+ /**
6
+ * Size options for StatusBadge
7
+ */
8
+ export type StatusSize = 'small' | 'medium';
9
+ /**
10
+ * Props for the StatusBadge component
11
+ */
12
+ export interface StatusBadgeProps {
13
+ /**
14
+ * The status type to display
15
+ */
16
+ status: StatusType;
17
+ /**
18
+ * Optional custom label (defaults to status name)
19
+ */
20
+ label?: string;
21
+ /**
22
+ * Size of the badge
23
+ * @default 'medium'
24
+ */
25
+ size?: StatusSize;
26
+ /**
27
+ * Whether to show the icon
28
+ * @default true
29
+ */
30
+ showIcon?: boolean;
31
+ /**
32
+ * Whether status changes should be announced to screen readers
33
+ * @default true
34
+ */
35
+ liveRegion?: boolean;
36
+ /**
37
+ * Test identifier for automated testing
38
+ */
39
+ 'data-testid'?: string;
40
+ /**
41
+ * Accessible label override
42
+ */
43
+ 'aria-label'?: string;
44
+ }
45
+ /**
46
+ * StatusBadge component for displaying transaction or task status
47
+ *
48
+ * Displays status with appropriate color, icon, and supports live updates for screen readers.
49
+ * Maps to 6 common status types with semantic color tokens.
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * <StatusBadge status="completed" />
54
+ *
55
+ * <StatusBadge
56
+ * status="pending"
57
+ * label="Awaiting approval"
58
+ * size="small"
59
+ * />
60
+ *
61
+ * <StatusBadge
62
+ * status="failed"
63
+ * showIcon={false}
64
+ * liveRegion={true}
65
+ * />
66
+ * ```
67
+ */
68
+ export declare const StatusBadge: React.FC<StatusBadgeProps>;
@@ -0,0 +1,2 @@
1
+ export { StatusBadge } from './StatusBadge';
2
+ export type { StatusBadgeProps, StatusType, StatusSize } from './StatusBadge';
@@ -2,6 +2,7 @@ export * from './Avatar';
2
2
  export * from './Badge';
3
3
  export * from './Box';
4
4
  export * from './Button';
5
+ export * from './CategoryBadge';
5
6
  export * from './Chip';
6
7
  export * from './Container';
7
8
  export * from './Picture';
@@ -12,5 +13,6 @@ export * from './MoneyDisplay';
12
13
  export * from './ProgressBar';
13
14
  export * from './Divider';
14
15
  export * from './Stack';
16
+ export * from './StatusBadge';
15
17
  export * from './Tag';
16
18
  export * from './Typography';
@@ -0,0 +1,110 @@
1
+ import { type IconName } from '../../../types/icons';
2
+ /**
3
+ * Action item for the action sheet
4
+ */
5
+ export interface Action {
6
+ /**
7
+ * Unique identifier
8
+ */
9
+ id: string;
10
+ /**
11
+ * Display label
12
+ */
13
+ label: string;
14
+ /**
15
+ * Optional icon
16
+ */
17
+ icon?: IconName;
18
+ /**
19
+ * Whether this is a destructive action (shown in red)
20
+ * @default false
21
+ */
22
+ destructive?: boolean;
23
+ /**
24
+ * Whether this action is disabled
25
+ * @default false
26
+ */
27
+ disabled?: boolean;
28
+ /**
29
+ * Callback when action is selected
30
+ */
31
+ onSelect: () => void;
32
+ }
33
+ /**
34
+ * Props for the ActionSheet component
35
+ */
36
+ export interface ActionSheetProps {
37
+ /**
38
+ * Whether the action sheet is open
39
+ */
40
+ isOpen: boolean;
41
+ /**
42
+ * Callback when the action sheet should close
43
+ */
44
+ onClose: () => void;
45
+ /**
46
+ * Title of the action sheet
47
+ */
48
+ title?: string;
49
+ /**
50
+ * Optional description
51
+ */
52
+ description?: string;
53
+ /**
54
+ * Array of actions
55
+ */
56
+ actions: Action[];
57
+ /**
58
+ * Whether to close on overlay click
59
+ * @default true
60
+ */
61
+ closeOnOverlayClick?: boolean;
62
+ /**
63
+ * Whether to close on Escape key
64
+ * @default true
65
+ */
66
+ closeOnEscape?: boolean;
67
+ /**
68
+ * Show close button in header
69
+ * @default true
70
+ */
71
+ showCloseButton?: boolean;
72
+ /**
73
+ * Test identifier
74
+ */
75
+ 'data-testid'?: string;
76
+ }
77
+ /**
78
+ * ActionSheet component for bottom sheet modals
79
+ *
80
+ * Displays a modal action sheet that slides up from the bottom,
81
+ * providing a list of actions for the user to choose from.
82
+ * Includes focus trapping, keyboard navigation, and accessibility features.
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * const [isOpen, setIsOpen] = useState(false)
87
+ *
88
+ * <ActionSheet
89
+ * isOpen={isOpen}
90
+ * onClose={() => setIsOpen(false)}
91
+ * title="Choose an action"
92
+ * actions={[
93
+ * {
94
+ * id: 'edit',
95
+ * label: 'Edit',
96
+ * icon: 'edit',
97
+ * onSelect: () => console.log('Edit')
98
+ * },
99
+ * {
100
+ * id: 'delete',
101
+ * label: 'Delete',
102
+ * icon: 'trash',
103
+ * destructive: true,
104
+ * onSelect: () => console.log('Delete')
105
+ * }
106
+ * ]}
107
+ * />
108
+ * ```
109
+ */
110
+ export declare const ActionSheet: ({ isOpen, onClose, title, description, actions, closeOnOverlayClick, closeOnEscape, showCloseButton, "data-testid": dataTestId }: ActionSheetProps) => import("react").ReactPortal | null;
@@ -0,0 +1,2 @@
1
+ export { ActionSheet } from './ActionSheet';
2
+ export type { ActionSheetProps, Action } from './ActionSheet';
@@ -49,6 +49,6 @@ export interface AlertProps {
49
49
  'data-testid'?: string;
50
50
  }
51
51
  export declare const Alert: {
52
- ({ variant, children, title, dismissible, onDismiss, action, inline, ariaLive, "data-testid": dataTestId, ...props }: AlertProps): React.JSX.Element | null;
52
+ ({ variant, children, title, dismissible, onDismiss, action, inline, ariaLive, "data-testid": dataTestId, ...props }: AlertProps): import("react/jsx-runtime").JSX.Element | null;
53
53
  displayName: string;
54
54
  };
@@ -7,4 +7,4 @@ export type CardLargeProps = {
7
7
  onImageClick?: () => void;
8
8
  imageHref?: string;
9
9
  };
10
- export declare const CardLarge: ({ title, excerpt, subtitle, labels, picture, onImageClick, imageHref, }: CardLargeProps) => import("react").JSX.Element;
10
+ export declare const CardLarge: ({ title, excerpt, subtitle, labels, picture, onImageClick, imageHref, }: CardLargeProps) => import("react/jsx-runtime").JSX.Element;
@@ -24,6 +24,6 @@ export interface ListProps {
24
24
  'data-testid'?: string;
25
25
  }
26
26
  export declare const List: {
27
- ({ children, dividers, spacing, className, "data-testid": dataTestId, ...props }: ListProps): React.JSX.Element;
27
+ ({ children, dividers, spacing, className, "data-testid": dataTestId, ...props }: ListProps): import("react/jsx-runtime").JSX.Element;
28
28
  displayName: string;
29
29
  };
@@ -66,8 +66,29 @@ export interface ListItemProps {
66
66
  * Test identifier for automated testing
67
67
  */
68
68
  'data-testid'?: string;
69
+ /**
70
+ * Custom ARIA role (e.g., 'option' for combobox)
71
+ * @default 'listitem'
72
+ */
73
+ role?: string;
74
+ /**
75
+ * ARIA selected state (for role="option")
76
+ */
77
+ 'aria-selected'?: boolean;
78
+ /**
79
+ * Custom ID for ARIA references
80
+ */
81
+ id?: string;
82
+ /**
83
+ * Custom tabIndex for focus management
84
+ */
85
+ tabIndex?: number;
86
+ /**
87
+ * Keyboard event handler
88
+ */
89
+ onKeyDown?: (e: React.KeyboardEvent) => void;
69
90
  }
70
91
  export declare const ListItem: {
71
- ({ primary, secondary, badge, icon, expandable, expanded, onToggle, interactive, onClick, disabled, selected, spacing, children, className, "data-testid": dataTestId, ...props }: ListItemProps): React.JSX.Element;
92
+ ({ primary, secondary, badge, icon, expandable, expanded, onToggle, interactive, onClick, disabled, selected, spacing, children, className, "data-testid": dataTestId, role: customRole, "aria-selected": ariaSelected, id, tabIndex: customTabIndex, onKeyDown: customOnKeyDown, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
72
93
  displayName: string;
73
94
  };
@@ -0,0 +1,108 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ /**
3
+ * Suggestion item for autocomplete
4
+ */
5
+ export interface Suggestion {
6
+ /**
7
+ * Unique identifier
8
+ */
9
+ id: string;
10
+ /**
11
+ * Display text
12
+ */
13
+ label: string;
14
+ /**
15
+ * Optional secondary text
16
+ */
17
+ description?: string;
18
+ /**
19
+ * Optional category for grouping
20
+ */
21
+ category?: string;
22
+ }
23
+ /**
24
+ * Props for the SearchField component
25
+ */
26
+ export interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange'> {
27
+ /**
28
+ * Current search value
29
+ */
30
+ value: string;
31
+ /**
32
+ * Callback when value changes
33
+ */
34
+ onChange: (value: string) => void;
35
+ /**
36
+ * Suggestions to display
37
+ */
38
+ suggestions?: Suggestion[];
39
+ /**
40
+ * Whether to show recent searches
41
+ * @default true
42
+ */
43
+ showRecentSearches?: boolean;
44
+ /**
45
+ * Array of recent search terms
46
+ */
47
+ recentSearches?: string[];
48
+ /**
49
+ * Callback when a suggestion is selected
50
+ */
51
+ onSuggestionSelect?: (suggestion: Suggestion | string) => void;
52
+ /**
53
+ * Callback to clear recent searches
54
+ */
55
+ onClearRecentSearches?: () => void;
56
+ /**
57
+ * Debounce delay in milliseconds
58
+ * @default 300
59
+ */
60
+ debounceMs?: number;
61
+ /**
62
+ * Placeholder text
63
+ * @default 'Search...'
64
+ */
65
+ placeholder?: string;
66
+ /**
67
+ * Whether the field is disabled
68
+ * @default false
69
+ */
70
+ disabled?: boolean;
71
+ /**
72
+ * Whether to show loading state
73
+ * @default false
74
+ */
75
+ loading?: boolean;
76
+ /**
77
+ * Accessible label
78
+ */
79
+ 'aria-label'?: string;
80
+ /**
81
+ * Test identifier
82
+ */
83
+ 'data-testid'?: string;
84
+ }
85
+ /**
86
+ * SearchField component with autocomplete and recent searches
87
+ *
88
+ * Provides intelligent search with debouncing, keyboard navigation,
89
+ * suggestions, and recent search history. Fully accessible with ARIA.
90
+ *
91
+ * @example
92
+ * ```tsx
93
+ * const [search, setSearch] = useState('')
94
+ * const [suggestions] = useState([
95
+ * { id: '1', label: 'Apple', category: 'Fruit' },
96
+ * { id: '2', label: 'Banana', category: 'Fruit' }
97
+ * ])
98
+ *
99
+ * <SearchField
100
+ * value={search}
101
+ * onChange={setSearch}
102
+ * suggestions={suggestions}
103
+ * recentSearches={['coffee', 'tea']}
104
+ * onSuggestionSelect={(item) => console.log('Selected:', item)}
105
+ * />
106
+ * ```
107
+ */
108
+ export declare const SearchField: import("react").ForwardRefExoticComponent<SearchFieldProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,2 @@
1
+ export { SearchField } from './SearchField';
2
+ export type { SearchFieldProps, Suggestion } from './SearchField';
@@ -91,6 +91,6 @@ export interface SheetProps {
91
91
  * ```
92
92
  */
93
93
  export declare const Sheet: {
94
- ({ isOpen, onClose, position, variant, width, height, children, closeOnOverlayClick, closeOnEscape, title, "data-testid": dataTestId, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, }: SheetProps): import("react").JSX.Element | null;
94
+ ({ isOpen, onClose, position, variant, width, height, children, closeOnOverlayClick, closeOnEscape, title, "data-testid": dataTestId, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, }: SheetProps): import("react/jsx-runtime").JSX.Element | null;
95
95
  displayName: string;
96
96
  };
@@ -97,6 +97,6 @@ export interface SliderProps {
97
97
  * ```
98
98
  */
99
99
  export declare const Slider: {
100
- ({ min, max, step, value: controlledValue, defaultValue, rangeValue: controlledRangeValue, defaultRangeValue, onChange, onRangeChange, disabled, label, showValueLabel, formatValue, "data-testid": dataTestId, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, }: SliderProps): import("react").JSX.Element;
100
+ ({ min, max, step, value: controlledValue, defaultValue, rangeValue: controlledRangeValue, defaultRangeValue, onChange, onRangeChange, disabled, label, showValueLabel, formatValue, "data-testid": dataTestId, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, }: SliderProps): import("react/jsx-runtime").JSX.Element;
101
101
  displayName: string;
102
102
  };
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Tab variant options for TabBar
3
+ */
4
+ export type TabVariant = 'default' | 'pills' | 'underline';
5
+ /**
6
+ * Individual tab configuration
7
+ */
8
+ export interface Tab {
9
+ /**
10
+ * Unique identifier for the tab
11
+ */
12
+ id: string;
13
+ /**
14
+ * Tab label text
15
+ */
16
+ label: string;
17
+ /**
18
+ * Optional badge count to display
19
+ */
20
+ badge?: number;
21
+ /**
22
+ * Whether this tab is disabled
23
+ * @default false
24
+ */
25
+ disabled?: boolean;
26
+ }
27
+ /**
28
+ * Props for the TabBar component
29
+ */
30
+ export interface TabBarProps {
31
+ /**
32
+ * Array of tab configurations
33
+ */
34
+ tabs: Tab[];
35
+ /**
36
+ * Currently active tab ID
37
+ */
38
+ activeTab: string;
39
+ /**
40
+ * Callback when tab changes
41
+ */
42
+ onTabChange: (tabId: string) => void;
43
+ /**
44
+ * Visual variant of the tabs
45
+ * @default 'default'
46
+ */
47
+ variant?: TabVariant;
48
+ /**
49
+ * Accessible label for the tab list
50
+ */
51
+ 'aria-label'?: string;
52
+ /**
53
+ * Test identifier for automated testing
54
+ */
55
+ 'data-testid'?: string;
56
+ }
57
+ /**
58
+ * TabBar component for tabbed navigation
59
+ *
60
+ * Provides accessible tab navigation with 3 visual variants, keyboard support,
61
+ * and optional badge counts. Follows ARIA tablist pattern.
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * const [activeTab, setActiveTab] = useState('all')
66
+ *
67
+ * <TabBar
68
+ * tabs={[
69
+ * { id: 'all', label: 'All', badge: 42 },
70
+ * { id: 'pending', label: 'Pending', badge: 5 },
71
+ * { id: 'completed', label: 'Completed' }
72
+ * ]}
73
+ * activeTab={activeTab}
74
+ * onTabChange={setActiveTab}
75
+ * variant="pills"
76
+ * />
77
+ * ```
78
+ */
79
+ export declare const TabBar: React.FC<TabBarProps>;
@@ -0,0 +1,2 @@
1
+ export { TabBar } from './TabBar';
2
+ export type { TabBarProps, Tab, TabVariant } from './TabBar';
@@ -1,4 +1,5 @@
1
1
  export * from './AccountCard';
2
+ export * from './ActionSheet';
2
3
  export * from './Alert';
3
4
  export * from './Breadcrumbs';
4
5
  export * from './CardSmall';
@@ -14,7 +15,9 @@ export * from './List';
14
15
  export * from './NumberInput';
15
16
  export * from './PageTitle';
16
17
  export * from './PasswordField';
18
+ export * from './SearchField';
17
19
  export * from './Sheet';
18
20
  export * from './Slider';
21
+ export * from './TabBar';
19
22
  export * from './TextField';
20
23
  export * from './TransactionListItem';