@profitflex/core 1.0.0-beta.1

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,74 @@
1
+ # @profitflex/core
2
+
3
+ Shared TypeScript types and interfaces for ProfitFlex component library.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @profitflex/core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import type { ButtonProps, Size, ColorVariant } from '@profitflex/core';
15
+
16
+ // Use in your custom components
17
+ const MyButton: React.FC<ButtonProps> = (props) => {
18
+ // Implementation
19
+ };
20
+
21
+ // Use types
22
+ const buttonSize: Size = 'md';
23
+ const buttonColor: ColorVariant = 'primary';
24
+ ```
25
+
26
+ ## Available Types
27
+
28
+ ### Common Types
29
+
30
+ - `Size`: 'sm' | 'md' | 'lg' | 'xl'
31
+ - `ColorVariant`: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'
32
+ - `Variant`: 'solid' | 'outline' | 'ghost' | 'link'
33
+ - `Radius`: 'none' | 'sm' | 'md' | 'lg' | 'full'
34
+
35
+ ### Component Types
36
+
37
+ - `ButtonProps`: Base button props for all platforms
38
+ - `WebButtonProps`: Web-specific button props
39
+ - `NativeButtonProps`: React Native button props
40
+ - `IOSButtonProps`: iOS button props (TypeScript documentation)
41
+ - `AndroidButtonProps`: Android button props (TypeScript documentation)
42
+
43
+ ### Interfaces
44
+
45
+ - `AccessibilityProps`: Common accessibility properties
46
+ - `LoadingProps`: Loading state properties
47
+ - `DisabledProps`: Disabled state properties
48
+ - `InteractiveProps`: Combined props for interactive elements
49
+
50
+ ## Platform-Specific Extensions
51
+
52
+ Each platform extends the base `ButtonProps` interface with platform-specific properties:
53
+
54
+ **Web:**
55
+ ```typescript
56
+ interface WebButtonProps extends ButtonProps {
57
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
58
+ type?: 'button' | 'submit' | 'reset';
59
+ className?: string;
60
+ }
61
+ ```
62
+
63
+ **React Native:**
64
+ ```typescript
65
+ interface NativeButtonProps extends ButtonProps {
66
+ onPress?: () => void;
67
+ style?: StyleProp<ViewStyle>;
68
+ textStyle?: StyleProp<TextStyle>;
69
+ }
70
+ ```
71
+
72
+ ## License
73
+
74
+ UNLICENSED - ProfitFlex proprietary
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Common types shared across all platforms
3
+ */
4
+ /** Size variants for components */
5
+ type Size = 'sm' | 'md' | 'lg' | 'xl';
6
+ /** Color variants based on semantic tokens */
7
+ type ColorVariant = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info';
8
+ /** Visual variants for components */
9
+ type Variant = 'solid' | 'outline' | 'ghost' | 'link';
10
+ /** Radius variants for components */
11
+ type Radius = 'none' | 'sm' | 'md' | 'lg' | 'full';
12
+ /** Common accessibility props */
13
+ interface AccessibilityProps {
14
+ /** Accessible label for screen readers */
15
+ accessibilityLabel?: string;
16
+ /** Hint text for screen readers */
17
+ accessibilityHint?: string;
18
+ /** Role of the element */
19
+ accessibilityRole?: string;
20
+ }
21
+ /** Common loading state */
22
+ interface LoadingProps {
23
+ /** Whether the component is in a loading state */
24
+ isLoading?: boolean;
25
+ /** Custom loading text */
26
+ loadingText?: string;
27
+ }
28
+ /** Common disabled state */
29
+ interface DisabledProps {
30
+ /** Whether the component is disabled */
31
+ disabled?: boolean;
32
+ }
33
+ /** Common props for interactive components */
34
+ interface InteractiveProps extends AccessibilityProps, LoadingProps, DisabledProps {
35
+ /** Test ID for testing frameworks */
36
+ testID?: string;
37
+ }
38
+
39
+ /**
40
+ * Unified Button props interface used across all platforms
41
+ * Each platform implementation should map these props to their native equivalents
42
+ */
43
+ interface ButtonProps extends InteractiveProps {
44
+ /** Button visual variant */
45
+ variant?: Variant;
46
+ /** Button size */
47
+ size?: Size;
48
+ /** Button color scheme */
49
+ color?: ColorVariant;
50
+ /** Border radius */
51
+ radius?: Radius;
52
+ /** Whether the button should take full width of its container */
53
+ fullWidth?: boolean;
54
+ /** Icon to display before the button text */
55
+ leftIcon?: any;
56
+ /** Icon to display after the button text */
57
+ rightIcon?: any;
58
+ /** Button content/children */
59
+ children?: any;
60
+ }
61
+ /**
62
+ * Platform-specific button implementations
63
+ */
64
+ /** Web (React) specific props */
65
+ interface WebButtonProps extends ButtonProps {
66
+ /** Click handler */
67
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
68
+ /** HTML button type */
69
+ type?: 'button' | 'submit' | 'reset';
70
+ /** Form attribute */
71
+ form?: string;
72
+ /** Additional CSS classes */
73
+ className?: string;
74
+ /** Children elements */
75
+ children?: React.ReactNode;
76
+ /** Icon components */
77
+ leftIcon?: React.ReactNode;
78
+ rightIcon?: React.ReactNode;
79
+ }
80
+ /** React Native specific props */
81
+ interface NativeButtonProps extends ButtonProps {
82
+ /** Press handler */
83
+ onPress?: () => void;
84
+ /** Long press handler */
85
+ onLongPress?: () => void;
86
+ /** Additional style object */
87
+ style?: any;
88
+ /** Text style object */
89
+ textStyle?: any;
90
+ /** Children elements */
91
+ children?: React.ReactNode;
92
+ }
93
+ /** iOS (Swift) specific interface - documented for Swift implementation */
94
+ interface IOSButtonProps {
95
+ /** Button text */
96
+ title: string;
97
+ /** Button action closure */
98
+ action: () => void;
99
+ /** Visual variant */
100
+ variant?: Variant;
101
+ /** Size variant */
102
+ size?: Size;
103
+ /** Color scheme */
104
+ color?: ColorVariant;
105
+ /** Border radius */
106
+ radius?: Radius;
107
+ /** Full width */
108
+ fullWidth?: boolean;
109
+ /** System image name for left icon */
110
+ leftIcon?: string;
111
+ /** System image name for right icon */
112
+ rightIcon?: string;
113
+ /** Disabled state */
114
+ disabled?: boolean;
115
+ /** Loading state */
116
+ isLoading?: boolean;
117
+ }
118
+ /** Android (Compose) specific interface - documented for Kotlin implementation */
119
+ interface AndroidButtonProps {
120
+ /** Button text */
121
+ text: string;
122
+ /** Click handler */
123
+ onClick: () => void;
124
+ /** Visual variant */
125
+ variant?: Variant;
126
+ /** Size variant */
127
+ size?: Size;
128
+ /** Color scheme */
129
+ color?: ColorVariant;
130
+ /** Border radius */
131
+ radius?: Radius;
132
+ /** Full width modifier */
133
+ fullWidth?: boolean;
134
+ /** Vector drawable resource ID for left icon */
135
+ leftIcon?: number;
136
+ /** Vector drawable resource ID for right icon */
137
+ rightIcon?: number;
138
+ /** Disabled state */
139
+ enabled?: boolean;
140
+ /** Loading state */
141
+ isLoading?: boolean;
142
+ /** Content description for accessibility */
143
+ contentDescription?: string;
144
+ }
145
+
146
+ export type { AccessibilityProps, AndroidButtonProps, ButtonProps, ColorVariant, DisabledProps, IOSButtonProps, InteractiveProps, LoadingProps, NativeButtonProps, Radius, Size, Variant, WebButtonProps };
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Common types shared across all platforms
3
+ */
4
+ /** Size variants for components */
5
+ type Size = 'sm' | 'md' | 'lg' | 'xl';
6
+ /** Color variants based on semantic tokens */
7
+ type ColorVariant = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info';
8
+ /** Visual variants for components */
9
+ type Variant = 'solid' | 'outline' | 'ghost' | 'link';
10
+ /** Radius variants for components */
11
+ type Radius = 'none' | 'sm' | 'md' | 'lg' | 'full';
12
+ /** Common accessibility props */
13
+ interface AccessibilityProps {
14
+ /** Accessible label for screen readers */
15
+ accessibilityLabel?: string;
16
+ /** Hint text for screen readers */
17
+ accessibilityHint?: string;
18
+ /** Role of the element */
19
+ accessibilityRole?: string;
20
+ }
21
+ /** Common loading state */
22
+ interface LoadingProps {
23
+ /** Whether the component is in a loading state */
24
+ isLoading?: boolean;
25
+ /** Custom loading text */
26
+ loadingText?: string;
27
+ }
28
+ /** Common disabled state */
29
+ interface DisabledProps {
30
+ /** Whether the component is disabled */
31
+ disabled?: boolean;
32
+ }
33
+ /** Common props for interactive components */
34
+ interface InteractiveProps extends AccessibilityProps, LoadingProps, DisabledProps {
35
+ /** Test ID for testing frameworks */
36
+ testID?: string;
37
+ }
38
+
39
+ /**
40
+ * Unified Button props interface used across all platforms
41
+ * Each platform implementation should map these props to their native equivalents
42
+ */
43
+ interface ButtonProps extends InteractiveProps {
44
+ /** Button visual variant */
45
+ variant?: Variant;
46
+ /** Button size */
47
+ size?: Size;
48
+ /** Button color scheme */
49
+ color?: ColorVariant;
50
+ /** Border radius */
51
+ radius?: Radius;
52
+ /** Whether the button should take full width of its container */
53
+ fullWidth?: boolean;
54
+ /** Icon to display before the button text */
55
+ leftIcon?: any;
56
+ /** Icon to display after the button text */
57
+ rightIcon?: any;
58
+ /** Button content/children */
59
+ children?: any;
60
+ }
61
+ /**
62
+ * Platform-specific button implementations
63
+ */
64
+ /** Web (React) specific props */
65
+ interface WebButtonProps extends ButtonProps {
66
+ /** Click handler */
67
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
68
+ /** HTML button type */
69
+ type?: 'button' | 'submit' | 'reset';
70
+ /** Form attribute */
71
+ form?: string;
72
+ /** Additional CSS classes */
73
+ className?: string;
74
+ /** Children elements */
75
+ children?: React.ReactNode;
76
+ /** Icon components */
77
+ leftIcon?: React.ReactNode;
78
+ rightIcon?: React.ReactNode;
79
+ }
80
+ /** React Native specific props */
81
+ interface NativeButtonProps extends ButtonProps {
82
+ /** Press handler */
83
+ onPress?: () => void;
84
+ /** Long press handler */
85
+ onLongPress?: () => void;
86
+ /** Additional style object */
87
+ style?: any;
88
+ /** Text style object */
89
+ textStyle?: any;
90
+ /** Children elements */
91
+ children?: React.ReactNode;
92
+ }
93
+ /** iOS (Swift) specific interface - documented for Swift implementation */
94
+ interface IOSButtonProps {
95
+ /** Button text */
96
+ title: string;
97
+ /** Button action closure */
98
+ action: () => void;
99
+ /** Visual variant */
100
+ variant?: Variant;
101
+ /** Size variant */
102
+ size?: Size;
103
+ /** Color scheme */
104
+ color?: ColorVariant;
105
+ /** Border radius */
106
+ radius?: Radius;
107
+ /** Full width */
108
+ fullWidth?: boolean;
109
+ /** System image name for left icon */
110
+ leftIcon?: string;
111
+ /** System image name for right icon */
112
+ rightIcon?: string;
113
+ /** Disabled state */
114
+ disabled?: boolean;
115
+ /** Loading state */
116
+ isLoading?: boolean;
117
+ }
118
+ /** Android (Compose) specific interface - documented for Kotlin implementation */
119
+ interface AndroidButtonProps {
120
+ /** Button text */
121
+ text: string;
122
+ /** Click handler */
123
+ onClick: () => void;
124
+ /** Visual variant */
125
+ variant?: Variant;
126
+ /** Size variant */
127
+ size?: Size;
128
+ /** Color scheme */
129
+ color?: ColorVariant;
130
+ /** Border radius */
131
+ radius?: Radius;
132
+ /** Full width modifier */
133
+ fullWidth?: boolean;
134
+ /** Vector drawable resource ID for left icon */
135
+ leftIcon?: number;
136
+ /** Vector drawable resource ID for right icon */
137
+ rightIcon?: number;
138
+ /** Disabled state */
139
+ enabled?: boolean;
140
+ /** Loading state */
141
+ isLoading?: boolean;
142
+ /** Content description for accessibility */
143
+ contentDescription?: string;
144
+ }
145
+
146
+ export type { AccessibilityProps, AndroidButtonProps, ButtonProps, ColorVariant, DisabledProps, IOSButtonProps, InteractiveProps, LoadingProps, NativeButtonProps, Radius, Size, Variant, WebButtonProps };
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/index.ts
17
+ var index_exports = {};
18
+ module.exports = __toCommonJS(index_exports);
package/dist/index.mjs ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@profitflex/core",
3
+ "version": "1.0.0-beta.1",
4
+ "description": "Shared types and interfaces for ProfitFlex component library",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "build": "tsup src/index.ts --format cjs,esm --dts",
17
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
18
+ "clean": "rm -rf dist"
19
+ },
20
+ "keywords": ["design-system", "types", "profitflex"],
21
+ "author": "ProfitFlex",
22
+ "license": "UNLICENSED",
23
+ "files": ["dist"],
24
+ "devDependencies": {
25
+ "tsup": "^8.0.0",
26
+ "typescript": "^5.3.0"
27
+ }
28
+ }