crew-recommendation-ui 0.0.4 → 0.1.2

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 (38) hide show
  1. package/BUILD_AND_PUBLISH.md +191 -0
  2. package/package.json +46 -38
  3. package/project.json +38 -0
  4. package/src/dls/components/Card.tsx +44 -0
  5. package/src/dls/components/index.ts +6 -0
  6. package/src/dls/index.ts +6 -0
  7. package/src/dls/tokens/colors.ts +104 -0
  8. package/src/dls/tokens/index.ts +4 -0
  9. package/src/dls/tokens/spacing.ts +54 -0
  10. package/src/dls/tokens/typography.ts +104 -0
  11. package/src/index.ts +15 -0
  12. package/src/recommendation-listing/components/BadgeGroup.tsx +49 -0
  13. package/src/recommendation-listing/components/PriceDisplay.tsx +52 -0
  14. package/src/recommendation-listing/components/RecommendationCard.tsx +177 -0
  15. package/src/recommendation-listing/components/RecommendationHeader.tsx +98 -0
  16. package/src/recommendation-listing/components/RecommendationList.tsx +67 -0
  17. package/src/recommendation-listing/components/index.ts +10 -0
  18. package/src/recommendation-listing/index.ts +9 -0
  19. package/src/recommendation-listing/types.ts +58 -0
  20. package/tsconfig.json +19 -0
  21. package/vite.config.ts +30 -0
  22. package/dist/dls/components/Card.d.ts +0 -6
  23. package/dist/dls/components/Card.d.ts.map +0 -1
  24. package/dist/dls/components/index.d.ts +0 -2
  25. package/dist/dls/components/index.d.ts.map +0 -1
  26. package/dist/dls/index.d.ts +0 -8
  27. package/dist/dls/index.d.ts.map +0 -1
  28. package/dist/dls/tokens/colors.d.ts +0 -77
  29. package/dist/dls/tokens/colors.d.ts.map +0 -1
  30. package/dist/dls/tokens/index.d.ts +0 -215
  31. package/dist/dls/tokens/index.d.ts.map +0 -1
  32. package/dist/dls/tokens/spacing.d.ts +0 -46
  33. package/dist/dls/tokens/spacing.d.ts.map +0 -1
  34. package/dist/dls/tokens/typography.d.ts +0 -102
  35. package/dist/dls/tokens/typography.d.ts.map +0 -1
  36. package/dist/index.d.ts +0 -7
  37. package/dist/index.d.ts.map +0 -1
  38. package/dist/index.js +0 -265
@@ -0,0 +1,191 @@
1
+ # Build & Publish Guide
2
+
3
+ ## 🎯 Option 1: Use as Local Workspace Package (RECOMMENDED)
4
+
5
+ This is the **best approach for monorepo projects**. No npm publishing needed!
6
+
7
+ ### ✅ Advantages:
8
+ - No npm account or tokens needed
9
+ - Instant changes without publishing
10
+ - Better for development workflow
11
+ - Automatic linking via Yarn workspaces
12
+
13
+ ### 📦 Setup (Already Done!):
14
+
15
+ 1. **Library is already in the monorepo:**
16
+ ```
17
+ crew-dashboards/libs/recommendation-ui/
18
+ ```
19
+
20
+ 2. **crew-website already configured:**
21
+ ```json
22
+ "dependencies": {
23
+ "crew-recommendation-ui": "*"
24
+ }
25
+ ```
26
+
27
+ 3. **Build the library:**
28
+ ```bash
29
+ cd /Users/gurkawalbir.singh/Downloads/Workspace/crew-dashboards/libs/recommendation-ui
30
+ yarn build
31
+ ```
32
+
33
+ 4. **Use in crew-website:**
34
+ ```tsx
35
+ // Instead of:
36
+ import { colors } from 'crew-recommendation-ui/dls';
37
+
38
+ // Use:
39
+ import { colors } from '@crew-dashboards/recommendation-ui/dls';
40
+ ```
41
+
42
+ ### 🔄 Development Workflow:
43
+
44
+ 1. **Make changes to the library:**
45
+ ```bash
46
+ cd libs/recommendation-ui
47
+ # Edit files in src/
48
+ ```
49
+
50
+ 2. **Rebuild the library:**
51
+ ```bash
52
+ yarn build
53
+ # Or use watch mode for auto-rebuild:
54
+ yarn dev
55
+ ```
56
+
57
+ 3. **Changes are immediately available in crew-website** (restart dev server if needed)
58
+
59
+ ### 🚀 For Production:
60
+
61
+ Build the library before deploying crew-website:
62
+ ```bash
63
+ # From project root
64
+ cd libs/recommendation-ui && yarn build
65
+ cd ../../apps/crew-website && yarn build
66
+ ```
67
+
68
+ ---
69
+
70
+ ## 📤 Option 2: Publish to npm (If Needed)
71
+
72
+ Only use this if you need to share the library **outside** the monorepo (e.g., with crew-frontend-monorepo).
73
+
74
+ ### Prerequisites:
75
+ - npm account
76
+ - Logged in: `npm login`
77
+ - Automation token (to bypass 2FA)
78
+
79
+ ### Steps:
80
+
81
+ 1. **Build the library:**
82
+ ```bash
83
+ cd /Users/gurkawalbir.singh/Downloads/Workspace/crew-dashboards/libs/recommendation-ui
84
+ yarn build
85
+ ```
86
+
87
+ 2. **Update version in package.json:**
88
+ ```json
89
+ {
90
+ "version": "0.2.0" // Increment version
91
+ }
92
+ ```
93
+
94
+ 3. **Publish to npm:**
95
+ ```bash
96
+ npm publish
97
+ ```
98
+
99
+ 4. **Consume from npm:**
100
+ ```json
101
+ // In any package.json
102
+ {
103
+ "dependencies": {
104
+ "@crew-dashboards/recommendation-ui": "^0.2.0"
105
+ }
106
+ }
107
+ ```
108
+
109
+ ### Publishing Script (Optional):
110
+
111
+ Add to `libs/recommendation-ui/package.json`:
112
+ ```json
113
+ {
114
+ "scripts": {
115
+ "prepublishOnly": "yarn build",
116
+ "publish:patch": "npm version patch && npm publish",
117
+ "publish:minor": "npm version minor && npm publish",
118
+ "publish:major": "npm version major && npm publish"
119
+ }
120
+ }
121
+ ```
122
+
123
+ Then use:
124
+ ```bash
125
+ yarn publish:patch # 0.1.0 -> 0.1.1
126
+ yarn publish:minor # 0.1.0 -> 0.2.0
127
+ yarn publish:major # 0.1.0 -> 1.0.0
128
+ ```
129
+
130
+ ---
131
+
132
+ ## 🔍 Verify the Setup
133
+
134
+ ### Check if library is linked:
135
+ ```bash
136
+ cd /Users/gurkawalbir.singh/Downloads/Workspace/crew-dashboards/apps/crew-website
137
+ ls -la node_modules/@crew-dashboards/recommendation-ui
138
+ ```
139
+
140
+ Should show a symlink to `../../libs/recommendation-ui`
141
+
142
+ ### Test import:
143
+ ```tsx
144
+ // In crew-website/src/test.tsx
145
+ import { colors, spacing } from '@crew-dashboards/recommendation-ui/dls';
146
+ import { RecommendationCard } from '@crew-dashboards/recommendation-ui/recommendation-listing';
147
+
148
+ console.log(colors.primary[500]); // Should work!
149
+ ```
150
+
151
+ ---
152
+
153
+ ## 📝 Common Commands
154
+
155
+ ```bash
156
+ # Build library
157
+ cd libs/recommendation-ui && yarn build
158
+
159
+ # Watch mode (auto-rebuild on changes)
160
+ cd libs/recommendation-ui && yarn dev
161
+
162
+ # Clean build artifacts
163
+ cd libs/recommendation-ui && yarn clean
164
+
165
+ # Reinstall dependencies (if needed)
166
+ cd crew-dashboards && yarn install
167
+
168
+ # Start crew-website with the library
169
+ cd apps/crew-website && yarn dev
170
+ ```
171
+
172
+ ---
173
+
174
+ ## 🎯 Recommended Approach for Your Project
175
+
176
+ Since you have everything in the **crew-dashboards monorepo**, use **Option 1 (Local Workspace Package)**:
177
+
178
+ 1. ✅ Library is already set up in `libs/recommendation-ui/`
179
+ 2. ✅ crew-website is already configured to use it
180
+ 3. ✅ Just build and import!
181
+
182
+ ```bash
183
+ # Build once
184
+ cd libs/recommendation-ui && yarn build
185
+
186
+ # Use in crew-website
187
+ # Update imports from 'crew-recommendation-ui' to '@crew-dashboards/recommendation-ui'
188
+ ```
189
+
190
+ This gives you the **best developer experience** without the overhead of npm publishing! 🚀
191
+
package/package.json CHANGED
@@ -1,41 +1,49 @@
1
1
  {
2
- "name": "crew-recommendation-ui",
3
- "version": "0.0.4",
4
- "description": "Simple DLS library with tokens and Card component",
5
- "private": false,
6
- "publishConfig": {
7
- "access": "public",
8
- "registry": "https://registry.npmjs.org/"
9
- },
10
- "type": "module",
11
- "main": "./dist/index.js",
12
- "module": "./dist/index.js",
13
- "types": "./dist/index.d.ts",
14
- "exports": {
15
- ".": {
16
- "types": "./dist/index.d.ts",
17
- "import": "./dist/index.js",
18
- "default": "./dist/index.js"
2
+ "name": "crew-recommendation-ui",
3
+ "version": "0.1.2",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "development": "./src/index.ts",
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./dls": {
17
+ "development": "./src/dls/index.ts",
18
+ "types": "./dist/dls/index.d.ts",
19
+ "import": "./dist/dls/index.js",
20
+ "default": "./dist/dls/index.js"
21
+ },
22
+ "./recommendation-listing": {
23
+ "development": "./src/recommendation-listing/index.ts",
24
+ "types": "./dist/recommendation-listing/index.d.ts",
25
+ "import": "./dist/recommendation-listing/index.js",
26
+ "default": "./dist/recommendation-listing/index.js"
27
+ }
28
+ },
29
+ "peerDependencies": {
30
+ "react": ">=17.0.0",
31
+ "react-native": ">=0.70.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/react": "^19.0.0",
35
+ "@types/react-native": "^0.73.0",
36
+ "@vitejs/plugin-react": "^4.3.4",
37
+ "typescript": "~5.7.2",
38
+ "vite": "^6.3.1",
39
+ "vite-plugin-dts": "^4.5.0"
40
+ },
41
+ "dependencies": {
42
+ "clsx": "^2.1.1"
43
+ },
44
+ "scripts": {
45
+ "build": "npm run clean && vite build",
46
+ "dev": "vite build --watch",
47
+ "clean": "rm -rf dist"
19
48
  }
20
- },
21
- "files": [
22
- "dist"
23
- ],
24
- "scripts": {
25
- "build": "vite build",
26
- "clean": "rm -rf dist"
27
- },
28
- "peerDependencies": {
29
- "react": ">=17.0.0",
30
- "react-native": ">=0.70.0"
31
- },
32
- "devDependencies": {
33
- "@types/react": "^18.2.55",
34
- "@types/react-native": "^0.72.0",
35
- "@vitejs/plugin-react": "^4.3.4",
36
- "react-native": "^0.74.0",
37
- "typescript": "~5.7.2",
38
- "vite": "^6.3.1",
39
- "vite-plugin-dts": "^4.5.0"
40
- }
41
49
  }
package/project.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "recommendation-ui",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "libs/recommendation-ui/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build": {
8
+ "executor": "@nx/vite:build",
9
+ "outputs": ["{options.outputPath}"],
10
+ "options": {
11
+ "outputPath": "libs/recommendation-ui/dist",
12
+ "configFile": "libs/recommendation-ui/vite.config.ts"
13
+ }
14
+ },
15
+ "lint": {
16
+ "executor": "@nx/eslint:lint",
17
+ "outputs": ["{options.outputFile}"],
18
+ "options": {
19
+ "lintFilePatterns": ["libs/recommendation-ui/**/*.{ts,tsx}"]
20
+ }
21
+ },
22
+ "version": {
23
+ "executor": "@jscutlery/semver:version",
24
+ "options": {
25
+ "preset": "conventional",
26
+ "tagPrefix": "crew-recommendation-ui@"
27
+ }
28
+ },
29
+ "publish": {
30
+ "executor": "ngx-deploy-npm:deploy",
31
+ "options": {
32
+ "access": "public"
33
+ },
34
+ "dependsOn": ["build"]
35
+ }
36
+ },
37
+ "tags": ["type:lib", "scope:shared"]
38
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Card Component
3
+ *
4
+ * Basic card component following React Native best practices
5
+ */
6
+
7
+ import React from 'react';
8
+ import { View, StyleSheet, ViewStyle } from 'react-native';
9
+ import { colors, spacing, borderRadius } from '../tokens';
10
+
11
+ export interface CardProps {
12
+ children: React.ReactNode;
13
+ style?: ViewStyle;
14
+ elevated?: boolean;
15
+ }
16
+
17
+ export function Card({ children, style, elevated = false }: CardProps) {
18
+ return (
19
+ <View style={[styles.container, elevated && styles.elevated, style]}>
20
+ {children}
21
+ </View>
22
+ );
23
+ }
24
+
25
+ const styles = StyleSheet.create({
26
+ container: {
27
+ backgroundColor: colors.neutral[900],
28
+ borderRadius: borderRadius.lg,
29
+ padding: spacing[4],
30
+ borderWidth: 1,
31
+ borderColor: colors.neutral[800],
32
+ },
33
+ elevated: {
34
+ shadowColor: colors.black,
35
+ shadowOffset: {
36
+ width: 0,
37
+ height: 2,
38
+ },
39
+ shadowOpacity: 0.25,
40
+ shadowRadius: 3.84,
41
+ elevation: 5,
42
+ },
43
+ });
44
+
@@ -0,0 +1,6 @@
1
+ /**
2
+ * DLS Components
3
+ */
4
+
5
+ export * from './Card';
6
+
@@ -0,0 +1,6 @@
1
+ // Tokens
2
+ export * from './tokens';
3
+
4
+ // Components
5
+ export * from './components';
6
+
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Color System - Simplified version based on crew-app DLS
3
+ *
4
+ * Provides a consistent color palette for recommendation UI components
5
+ */
6
+
7
+ // Helper to create HSL color strings
8
+ export const createHsl = (
9
+ hue: number,
10
+ saturation: number,
11
+ lightness: number,
12
+ ): string => {
13
+ return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
14
+ };
15
+
16
+ // Helper to create HSLA color strings with alpha
17
+ export const createHsla = (
18
+ hue: number,
19
+ saturation: number,
20
+ lightness: number,
21
+ alpha: number = 1,
22
+ ): string => {
23
+ return `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha})`;
24
+ };
25
+
26
+ /**
27
+ * Static color palette
28
+ * Used for consistent theming across components
29
+ */
30
+ export const colors = {
31
+ // Primary colors
32
+ primary: {
33
+ 50: '#f0f9ff',
34
+ 100: '#e0f2fe',
35
+ 200: '#bae6fd',
36
+ 300: '#7dd3fc',
37
+ 400: '#38bdf8',
38
+ 500: '#0ea5e9',
39
+ 600: '#0284c7',
40
+ 700: '#0369a1',
41
+ 800: '#075985',
42
+ 900: '#0c4a6e',
43
+ },
44
+
45
+ // Neutral/Gray scale
46
+ neutral: {
47
+ 50: '#fafafa',
48
+ 100: '#f5f5f5',
49
+ 200: '#e5e5e5',
50
+ 300: '#d4d4d4',
51
+ 400: '#a3a3a3',
52
+ 500: '#737373',
53
+ 600: '#525252',
54
+ 700: '#404040',
55
+ 800: '#262626',
56
+ 900: '#171717',
57
+ 950: '#0a0a0a',
58
+ },
59
+
60
+ // Success colors
61
+ success: {
62
+ 300: '#86efac',
63
+ 400: '#4ade80',
64
+ 500: '#22c55e',
65
+ 600: '#16a34a',
66
+ },
67
+
68
+ // Error colors
69
+ error: {
70
+ 300: '#fca5a5',
71
+ 400: '#f87171',
72
+ 500: '#ef4444',
73
+ 600: '#dc2626',
74
+ },
75
+
76
+ // Warning colors
77
+ warning: {
78
+ 300: '#fcd34d',
79
+ 400: '#fbbf24',
80
+ 500: '#f59e0b',
81
+ 600: '#d97706',
82
+ },
83
+
84
+ // Static colors
85
+ white: '#ffffff',
86
+ black: '#000000',
87
+ transparent: 'transparent',
88
+ } as const;
89
+
90
+ /**
91
+ * Dynamic color creators
92
+ * Use these for hue-based theming (optional, for future enhancement)
93
+ */
94
+ export const createColor = {
95
+ primary: (hue: number = 200) => createHsl(hue, 90, 56),
96
+ primaryLight: (hue: number = 200) => createHsl(hue, 90, 80),
97
+ primaryDark: (hue: number = 200) => createHsl(hue, 90, 32),
98
+
99
+ background: (hue: number = 0) => createHsl(hue, 16, 4),
100
+ backgroundElevated: (hue: number = 0) => createHsl(hue, 16, 8),
101
+
102
+ border: (hue: number = 0, opacity: number = 0.2) => createHsla(hue, 16, 80, opacity),
103
+ };
104
+
@@ -0,0 +1,4 @@
1
+ export * from './colors';
2
+ export * from './spacing';
3
+ export * from './typography';
4
+
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Spacing System - Based on crew-app DLS sizes
3
+ *
4
+ * Provides consistent spacing values following a 4px base unit
5
+ */
6
+
7
+ const BASE_UNIT = 4;
8
+
9
+ /**
10
+ * Spacing scale following the 4px base unit system
11
+ * Use these for consistent padding, margins, and gaps
12
+ */
13
+ export const spacing = {
14
+ 0: 0,
15
+ 1: BASE_UNIT * 1, // 4px
16
+ 2: BASE_UNIT * 2, // 8px
17
+ 3: BASE_UNIT * 3, // 12px
18
+ 4: BASE_UNIT * 4, // 16px
19
+ 5: BASE_UNIT * 5, // 20px
20
+ 6: BASE_UNIT * 6, // 24px
21
+ 8: BASE_UNIT * 8, // 32px
22
+ 10: BASE_UNIT * 10, // 40px
23
+ 12: BASE_UNIT * 12, // 48px
24
+ 16: BASE_UNIT * 16, // 64px
25
+ 20: BASE_UNIT * 20, // 80px
26
+ 24: BASE_UNIT * 24, // 96px
27
+ } as const;
28
+
29
+ /**
30
+ * Named spacing values for semantic usage
31
+ * Preferred for specific use cases
32
+ */
33
+ export const SPACING = {
34
+ XS: spacing[1], // 4px
35
+ SM: spacing[2], // 8px
36
+ MD: spacing[4], // 16px
37
+ LG: spacing[6], // 24px
38
+ XL: spacing[8], // 32px
39
+ XXL: spacing[12], // 48px
40
+ } as const;
41
+
42
+ /**
43
+ * Border radius values
44
+ */
45
+ export const borderRadius = {
46
+ none: 0,
47
+ sm: 4,
48
+ md: 8,
49
+ lg: 12,
50
+ xl: 16,
51
+ '2xl': 24,
52
+ full: 9999,
53
+ } as const;
54
+
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Font sizes following a consistent scale
3
+ */
4
+ export const fontSizes = {
5
+ '3xs': 12,
6
+ '2xs': 14,
7
+ 'xs': 16,
8
+ 'sm': 18,
9
+ 'md': 20,
10
+ 'lg': 24,
11
+ 'xl': 28,
12
+ '2xl': 32,
13
+ '3xl': 36,
14
+ '4xl': 40,
15
+ } as const;
16
+
17
+ /**
18
+ * Line heights corresponding to font sizes
19
+ */
20
+ export const lineHeights = {
21
+ '3xs': 16,
22
+ '2xs': 20,
23
+ 'xs': 22,
24
+ 'sm': 24,
25
+ 'md': 28,
26
+ 'lg': 32,
27
+ 'xl': 36,
28
+ '2xl': 40,
29
+ '3xl': 44,
30
+ '4xl': 48,
31
+ } as const;
32
+
33
+ /**
34
+ * Font weights
35
+ */
36
+ export const fontWeights = {
37
+ regular: '400',
38
+ medium: '500',
39
+ semibold: '600',
40
+ bold: '700',
41
+ } as const;
42
+
43
+ /**
44
+ * Predefined text styles for common use cases
45
+ * These follow React Native StyleSheet patterns
46
+ */
47
+ export const textStyles = {
48
+ // Headings
49
+ h1: {
50
+ fontSize: fontSizes['3xl'],
51
+ lineHeight: lineHeights['3xl'],
52
+ fontWeight: fontWeights.bold,
53
+ },
54
+ h2: {
55
+ fontSize: fontSizes['2xl'],
56
+ lineHeight: lineHeights['2xl'],
57
+ fontWeight: fontWeights.bold,
58
+ },
59
+ h3: {
60
+ fontSize: fontSizes.xl,
61
+ lineHeight: lineHeights.xl,
62
+ fontWeight: fontWeights.semibold,
63
+ },
64
+ h4: {
65
+ fontSize: fontSizes.lg,
66
+ lineHeight: lineHeights.lg,
67
+ fontWeight: fontWeights.semibold,
68
+ },
69
+
70
+ // Body text
71
+ body: {
72
+ fontSize: fontSizes.xs,
73
+ lineHeight: lineHeights.xs,
74
+ fontWeight: fontWeights.regular,
75
+ },
76
+ bodyLarge: {
77
+ fontSize: fontSizes.sm,
78
+ lineHeight: lineHeights.sm,
79
+ fontWeight: fontWeights.regular,
80
+ },
81
+ bodySmall: {
82
+ fontSize: fontSizes['2xs'],
83
+ lineHeight: lineHeights['2xs'],
84
+ fontWeight: fontWeights.regular,
85
+ },
86
+
87
+ // Labels and captions
88
+ label: {
89
+ fontSize: fontSizes['2xs'],
90
+ lineHeight: lineHeights['2xs'],
91
+ fontWeight: fontWeights.medium,
92
+ },
93
+ caption: {
94
+ fontSize: fontSizes['3xs'],
95
+ lineHeight: lineHeights['3xs'],
96
+ fontWeight: fontWeights.regular,
97
+ },
98
+ small: {
99
+ fontSize: fontSizes['3xs'],
100
+ lineHeight: lineHeights['3xs'],
101
+ fontWeight: fontWeights.regular,
102
+ },
103
+ } as const;
104
+
package/src/index.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Crew Recommendation UI Library
3
+ *
4
+ * Shared UI library for recommendation listing components
5
+ * Includes Design Language System (DLS) and recommendation components
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+
10
+ // Export everything from DLS
11
+ export * from './dls';
12
+
13
+ // Export everything from recommendation listing
14
+ export * from './recommendation-listing';
15
+