@schandlergarcia/sf-web-components 1.9.42 → 1.9.44
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/.a4drules/RULES.md +456 -0
- package/ARCHITECTURE.md +112 -0
- package/CHANGELOG.md +401 -0
- package/CONTRIBUTING.md +247 -0
- package/QUICK-REFERENCE.md +212 -0
- package/README.md +76 -14
- package/dist/components/library/cards/ActionList.js +1 -1
- package/dist/components/library/cards/ActionList.js.map +1 -1
- package/dist/components/library/cards/TableCard.js +2 -2
- package/dist/components/library/cards/TableCard.js.map +1 -1
- package/dist/components/library/index.js.map +1 -1
- package/dist/components/library/ui/UIButton.js +47 -0
- package/dist/components/library/ui/UIButton.js.map +1 -0
- package/dist/components/library/ui/UIInput.js +21 -0
- package/dist/components/library/ui/UIInput.js.map +1 -0
- package/dist/components/workspace/ComponentRegistry.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +8 -2
- package/scripts/pre-publish-check.sh +180 -0
- package/scripts/verify-consistency.sh +238 -0
- package/src/components/library/cards/ActionList.jsx +1 -1
- package/src/components/library/cards/TableCard.jsx +2 -2
- package/src/components/library/index.jsx +2 -2
- package/src/components/library/ui/{Button.jsx → UIButton.tsx} +17 -16
- package/src/components/library/ui/{Input.jsx → UIInput.tsx} +5 -5
package/dist/index.js
CHANGED
|
@@ -71,11 +71,11 @@ import { default as ho } from "./components/library/ui/Spinner.js";
|
|
|
71
71
|
import { default as Mo } from "./components/library/cards/StatusCard.js";
|
|
72
72
|
import { default as Ao } from "./components/library/cards/TableCard.js";
|
|
73
73
|
import { default as vo } from "./components/library/filters/ToggleFilter.js";
|
|
74
|
-
import { default as wo } from "./components/library/ui/
|
|
74
|
+
import { default as wo } from "./components/library/ui/UIButton.js";
|
|
75
75
|
import { Card as Ko, CardContent as Ro, CardDescription as Go, CardFooter as Vo, CardHeader as Wo, CardTitle as No, default as Oo } from "./components/library/ui/Card.js";
|
|
76
76
|
import { default as qo } from "./components/library/ui/Chip.js";
|
|
77
77
|
import { default as Jo } from "./components/library/ui/Container.js";
|
|
78
|
-
import { default as Xo } from "./components/library/ui/
|
|
78
|
+
import { default as Xo } from "./components/library/ui/UIInput.js";
|
|
79
79
|
import { default as Zo } from "./components/library/ui/Text.js";
|
|
80
80
|
import { default as $o } from "./components/library/ui/Toggle.js";
|
|
81
81
|
import { default as ra } from "./components/library/cards/WidgetCard.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schandlergarcia/sf-web-components",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.44",
|
|
4
4
|
"description": "Reusable Salesforce web components library with Tailwind CSS v4 and shadcn/ui",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,12 +34,18 @@
|
|
|
34
34
|
"src/types",
|
|
35
35
|
"README.md",
|
|
36
36
|
"INSTALL.md",
|
|
37
|
+
"CHANGELOG.md",
|
|
38
|
+
"CONTRIBUTING.md",
|
|
39
|
+
"ARCHITECTURE.md",
|
|
40
|
+
"QUICK-REFERENCE.md",
|
|
37
41
|
".a4drules"
|
|
38
42
|
],
|
|
39
43
|
"scripts": {
|
|
40
44
|
"build": "vite build && cp -r src/styles dist/",
|
|
41
45
|
"build:types": "tsc --emitDeclarationOnly",
|
|
42
|
-
"
|
|
46
|
+
"verify": "bash scripts/verify-consistency.sh",
|
|
47
|
+
"prepublish:check": "bash scripts/pre-publish-check.sh",
|
|
48
|
+
"prepublishOnly": "npm run prepublish:check && npm run build",
|
|
43
49
|
"postinstall": "node scripts/postinstall.mjs",
|
|
44
50
|
"reset:command-center": "bash scripts/reset-command-center.sh",
|
|
45
51
|
"validate:dashboard": "bash scripts/validate-dashboard.sh",
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Pre-publish verification script
|
|
4
|
+
# Enforces all rules from .a4drules/RULES.md before allowing publish
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
10
|
+
|
|
11
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
12
|
+
echo "🔒 Pre-Publish Verification"
|
|
13
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
14
|
+
echo ""
|
|
15
|
+
|
|
16
|
+
RED='\033[0;31m'
|
|
17
|
+
GREEN='\033[0;32m'
|
|
18
|
+
YELLOW='\033[1;33m'
|
|
19
|
+
NC='\033[0m' # No Color
|
|
20
|
+
|
|
21
|
+
ERRORS=0
|
|
22
|
+
|
|
23
|
+
# Rule 1: Consistency Check
|
|
24
|
+
echo "📋 Rule 1: Verifying consistency between code, docs, and templates..."
|
|
25
|
+
if bash "$ROOT/scripts/verify-consistency.sh"; then
|
|
26
|
+
echo -e "${GREEN}✓ Consistency check passed${NC}"
|
|
27
|
+
else
|
|
28
|
+
echo -e "${RED}✗ Consistency check failed${NC}"
|
|
29
|
+
ERRORS=$((ERRORS + 1))
|
|
30
|
+
fi
|
|
31
|
+
echo ""
|
|
32
|
+
|
|
33
|
+
# Rule 2: CHANGELOG Check
|
|
34
|
+
echo "📝 Rule 2: Verifying CHANGELOG.md is up to date..."
|
|
35
|
+
|
|
36
|
+
# Get current version from package.json
|
|
37
|
+
VERSION=$(node -p "require('$ROOT/package.json').version")
|
|
38
|
+
echo " Current version: $VERSION"
|
|
39
|
+
|
|
40
|
+
# Check if CHANGELOG has entry for current version
|
|
41
|
+
if grep -q "## \[$VERSION\]" "$ROOT/CHANGELOG.md"; then
|
|
42
|
+
echo -e " ${GREEN}✓ CHANGELOG has entry for version $VERSION${NC}"
|
|
43
|
+
else
|
|
44
|
+
echo -e " ${RED}✗ CHANGELOG missing entry for version $VERSION${NC}"
|
|
45
|
+
echo " Add a section to CHANGELOG.md:"
|
|
46
|
+
echo " ## [$VERSION] - $(date +%Y-%m-%d)"
|
|
47
|
+
ERRORS=$((ERRORS + 1))
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Check if any src/ files changed since last commit
|
|
51
|
+
if git diff --name-only HEAD src/ 2>/dev/null | grep -q .; then
|
|
52
|
+
echo -e " ${YELLOW}⚠ src/ files changed, ensure CHANGELOG is updated${NC}"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo ""
|
|
56
|
+
|
|
57
|
+
# Rule 3: Component Naming
|
|
58
|
+
echo "🏷️ Rule 3: Verifying component naming conventions..."
|
|
59
|
+
if [ -f "$ROOT/src/components/library/ui/UIButton.tsx" ]; then
|
|
60
|
+
echo -e " ${GREEN}✓ UIButton.tsx exists (correct)${NC}"
|
|
61
|
+
else
|
|
62
|
+
echo -e " ${RED}✗ UIButton.tsx missing${NC}"
|
|
63
|
+
ERRORS=$((ERRORS + 1))
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
if [ -f "$ROOT/src/components/library/ui/UIInput.tsx" ]; then
|
|
67
|
+
echo -e " ${GREEN}✓ UIInput.tsx exists (correct)${NC}"
|
|
68
|
+
else
|
|
69
|
+
echo -e " ${RED}✗ UIInput.tsx missing${NC}"
|
|
70
|
+
ERRORS=$((ERRORS + 1))
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
if [ -f "$ROOT/src/components/library/ui/Button.jsx" ] || [ -f "$ROOT/src/components/library/ui/Button.tsx" ]; then
|
|
74
|
+
echo -e " ${RED}✗ Button.jsx/tsx exists (should be UIButton.tsx)${NC}"
|
|
75
|
+
ERRORS=$((ERRORS + 1))
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
if [ -f "$ROOT/src/components/library/ui/Input.jsx" ] || [ -f "$ROOT/src/components/library/ui/Input.tsx" ]; then
|
|
79
|
+
echo -e " ${RED}✗ Input.jsx/tsx exists (should be UIInput.tsx)${NC}"
|
|
80
|
+
ERRORS=$((ERRORS + 1))
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
echo ""
|
|
84
|
+
|
|
85
|
+
# Rule 4: Build Check
|
|
86
|
+
echo "🔨 Rule 4: Verifying build succeeds..."
|
|
87
|
+
if npm run build --silent; then
|
|
88
|
+
echo -e "${GREEN}✓ Build succeeded${NC}"
|
|
89
|
+
else
|
|
90
|
+
echo -e "${RED}✗ Build failed${NC}"
|
|
91
|
+
ERRORS=$((ERRORS + 1))
|
|
92
|
+
fi
|
|
93
|
+
echo ""
|
|
94
|
+
|
|
95
|
+
# Rule 5: Documentation Check
|
|
96
|
+
echo "📚 Rule 5: Verifying documentation files exist..."
|
|
97
|
+
if [ -f "$ROOT/.a4drules/skills/component-library/ui-primitives.md" ]; then
|
|
98
|
+
echo -e " ${GREEN}✓ ui-primitives.md exists${NC}"
|
|
99
|
+
else
|
|
100
|
+
echo -e " ${RED}✗ ui-primitives.md missing${NC}"
|
|
101
|
+
ERRORS=$((ERRORS + 1))
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
if [ -f "$ROOT/CHANGELOG.md" ]; then
|
|
105
|
+
echo -e " ${GREEN}✓ CHANGELOG.md exists${NC}"
|
|
106
|
+
else
|
|
107
|
+
echo -e " ${RED}✗ CHANGELOG.md missing${NC}"
|
|
108
|
+
ERRORS=$((ERRORS + 1))
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
if [ -f "$ROOT/CONTRIBUTING.md" ]; then
|
|
112
|
+
echo -e " ${GREEN}✓ CONTRIBUTING.md exists${NC}"
|
|
113
|
+
else
|
|
114
|
+
echo -e " ${RED}✗ CONTRIBUTING.md missing${NC}"
|
|
115
|
+
ERRORS=$((ERRORS + 1))
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
if [ -f "$ROOT/ARCHITECTURE.md" ]; then
|
|
119
|
+
echo -e " ${GREEN}✓ ARCHITECTURE.md exists${NC}"
|
|
120
|
+
else
|
|
121
|
+
echo -e " ${RED}✗ ARCHITECTURE.md missing${NC}"
|
|
122
|
+
ERRORS=$((ERRORS + 1))
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
if [ -f "$ROOT/.a4drules/RULES.md" ]; then
|
|
126
|
+
echo -e " ${GREEN}✓ RULES.md exists${NC}"
|
|
127
|
+
else
|
|
128
|
+
echo -e " ${RED}✗ RULES.md missing${NC}"
|
|
129
|
+
ERRORS=$((ERRORS + 1))
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
echo ""
|
|
133
|
+
|
|
134
|
+
# Rule 6: Package.json files array check
|
|
135
|
+
echo "📦 Rule 6: Verifying package.json files array..."
|
|
136
|
+
REQUIRED_DIRS=("src/templates" "src/components" "src/lib" "src/types" ".a4drules" "scripts")
|
|
137
|
+
|
|
138
|
+
for dir in "${REQUIRED_DIRS[@]}"; do
|
|
139
|
+
if grep -q "\"$dir\"" "$ROOT/package.json"; then
|
|
140
|
+
echo -e " ${GREEN}✓ $dir included${NC}"
|
|
141
|
+
else
|
|
142
|
+
echo -e " ${RED}✗ $dir missing from files array${NC}"
|
|
143
|
+
ERRORS=$((ERRORS + 1))
|
|
144
|
+
fi
|
|
145
|
+
done
|
|
146
|
+
|
|
147
|
+
echo ""
|
|
148
|
+
|
|
149
|
+
# Rule 7: Git status check
|
|
150
|
+
echo "🔍 Rule 7: Checking git status..."
|
|
151
|
+
if git diff-index --quiet HEAD -- 2>/dev/null; then
|
|
152
|
+
echo -e "${GREEN}✓ No uncommitted changes${NC}"
|
|
153
|
+
else
|
|
154
|
+
echo -e "${YELLOW}⚠ You have uncommitted changes${NC}"
|
|
155
|
+
echo " Consider committing before publishing"
|
|
156
|
+
fi
|
|
157
|
+
echo ""
|
|
158
|
+
|
|
159
|
+
# Summary
|
|
160
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
161
|
+
|
|
162
|
+
if [ $ERRORS -eq 0 ]; then
|
|
163
|
+
echo -e "${GREEN}✅ All pre-publish checks passed!${NC}"
|
|
164
|
+
echo ""
|
|
165
|
+
echo "Safe to publish version $VERSION"
|
|
166
|
+
echo ""
|
|
167
|
+
echo "To publish, run:"
|
|
168
|
+
echo " npm publish"
|
|
169
|
+
echo ""
|
|
170
|
+
exit 0
|
|
171
|
+
else
|
|
172
|
+
echo -e "${RED}❌ Found $ERRORS error(s)${NC}"
|
|
173
|
+
echo ""
|
|
174
|
+
echo "Cannot publish until all errors are fixed."
|
|
175
|
+
echo ""
|
|
176
|
+
echo "See .a4drules/RULES.md for requirements"
|
|
177
|
+
echo "See CONTRIBUTING.md for guidance"
|
|
178
|
+
echo ""
|
|
179
|
+
exit 1
|
|
180
|
+
fi
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Verification script to ensure consistency between:
|
|
4
|
+
# 1. .a4drules documentation
|
|
5
|
+
# 2. Component implementations
|
|
6
|
+
# 3. Template imports
|
|
7
|
+
# 4. Barrel exports
|
|
8
|
+
|
|
9
|
+
set -e
|
|
10
|
+
|
|
11
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
+
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
13
|
+
|
|
14
|
+
echo "🔍 Verifying sf-web-components consistency..."
|
|
15
|
+
echo ""
|
|
16
|
+
|
|
17
|
+
ERRORS=0
|
|
18
|
+
|
|
19
|
+
# Color codes
|
|
20
|
+
RED='\033[0;31m'
|
|
21
|
+
GREEN='\033[0;32m'
|
|
22
|
+
YELLOW='\033[1;33m'
|
|
23
|
+
NC='\033[0m' # No Color
|
|
24
|
+
|
|
25
|
+
# Check 1: UIButton and UIInput must exist as .tsx files
|
|
26
|
+
echo "📦 Checking UI component files..."
|
|
27
|
+
if [ -f "$ROOT/src/components/library/ui/UIButton.tsx" ]; then
|
|
28
|
+
echo -e " ${GREEN}✓${NC} UIButton.tsx exists"
|
|
29
|
+
else
|
|
30
|
+
echo -e " ${RED}✗${NC} UIButton.tsx missing (required by documentation)"
|
|
31
|
+
ERRORS=$((ERRORS + 1))
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
if [ -f "$ROOT/src/components/library/ui/UIInput.tsx" ]; then
|
|
35
|
+
echo -e " ${GREEN}✓${NC} UIInput.tsx exists"
|
|
36
|
+
else
|
|
37
|
+
echo -e " ${RED}✗${NC} UIInput.tsx missing (required by documentation)"
|
|
38
|
+
ERRORS=$((ERRORS + 1))
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Check 2: Button.jsx and Input.jsx should NOT exist in ui/
|
|
42
|
+
if [ -f "$ROOT/src/components/library/ui/Button.jsx" ] || [ -f "$ROOT/src/components/library/ui/Button.tsx" ]; then
|
|
43
|
+
echo -e " ${RED}✗${NC} Button.jsx/tsx exists in ui/ (should be UIButton.tsx)"
|
|
44
|
+
ERRORS=$((ERRORS + 1))
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
if [ -f "$ROOT/src/components/library/ui/Input.jsx" ] || [ -f "$ROOT/src/components/library/ui/Input.tsx" ]; then
|
|
48
|
+
echo -e " ${RED}✗${NC} Input.jsx/tsx exists in ui/ (should be UIInput.tsx)"
|
|
49
|
+
ERRORS=$((ERRORS + 1))
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
echo ""
|
|
53
|
+
|
|
54
|
+
# Check 3: Barrel export consistency
|
|
55
|
+
echo "📚 Checking barrel export (index.jsx)..."
|
|
56
|
+
if grep -q 'from "./ui/UIButton"' "$ROOT/src/components/library/index.jsx"; then
|
|
57
|
+
echo -e " ${GREEN}✓${NC} UIButton exported correctly"
|
|
58
|
+
else
|
|
59
|
+
echo -e " ${RED}✗${NC} UIButton export incorrect or missing"
|
|
60
|
+
ERRORS=$((ERRORS + 1))
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
if grep -q 'from "./ui/UIInput"' "$ROOT/src/components/library/index.jsx"; then
|
|
64
|
+
echo -e " ${GREEN}✓${NC} UIInput exported correctly"
|
|
65
|
+
else
|
|
66
|
+
echo -e " ${RED}✗${NC} UIInput export incorrect or missing"
|
|
67
|
+
ERRORS=$((ERRORS + 1))
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
# Check for wrong paths
|
|
71
|
+
if grep -q 'from "./ui/Button"' "$ROOT/src/components/library/index.jsx"; then
|
|
72
|
+
echo -e " ${RED}✗${NC} Incorrect export path: ./ui/Button (should be ./ui/UIButton)"
|
|
73
|
+
ERRORS=$((ERRORS + 1))
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
if grep -q 'from "./ui/Input"' "$ROOT/src/components/library/index.jsx"; then
|
|
77
|
+
echo -e " ${RED}✗${NC} Incorrect export path: ./ui/Input (should be ./ui/UIInput)"
|
|
78
|
+
ERRORS=$((ERRORS + 1))
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
echo ""
|
|
82
|
+
|
|
83
|
+
# Check 4: Template imports
|
|
84
|
+
echo "📄 Checking template imports..."
|
|
85
|
+
TEMPLATE_ERRORS=0
|
|
86
|
+
|
|
87
|
+
# Check NotFound.tsx.template
|
|
88
|
+
if [ -f "$ROOT/src/templates/pages/NotFound.tsx.template" ]; then
|
|
89
|
+
if grep -q "from '@/components/library/ui/UIButton'" "$ROOT/src/templates/pages/NotFound.tsx.template"; then
|
|
90
|
+
echo -e " ${GREEN}✓${NC} NotFound.tsx.template imports UIButton correctly"
|
|
91
|
+
else
|
|
92
|
+
echo -e " ${RED}✗${NC} NotFound.tsx.template does not import UIButton correctly"
|
|
93
|
+
TEMPLATE_ERRORS=$((TEMPLATE_ERRORS + 1))
|
|
94
|
+
fi
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
# Check Home.tsx.template
|
|
98
|
+
if [ -f "$ROOT/src/templates/pages/Home.tsx.template" ]; then
|
|
99
|
+
if grep -q "from '@/components/library/ui/UIInput'" "$ROOT/src/templates/pages/Home.tsx.template"; then
|
|
100
|
+
echo -e " ${GREEN}✓${NC} Home.tsx.template imports UIInput correctly"
|
|
101
|
+
else
|
|
102
|
+
echo -e " ${RED}✗${NC} Home.tsx.template does not import UIInput correctly"
|
|
103
|
+
TEMPLATE_ERRORS=$((TEMPLATE_ERRORS + 1))
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
if grep -q "from '@/components/library/ui/UIButton'" "$ROOT/src/templates/pages/Home.tsx.template"; then
|
|
107
|
+
echo -e " ${GREEN}✓${NC} Home.tsx.template imports UIButton correctly"
|
|
108
|
+
else
|
|
109
|
+
echo -e " ${RED}✗${NC} Home.tsx.template does not import UIButton correctly"
|
|
110
|
+
TEMPLATE_ERRORS=$((TEMPLATE_ERRORS + 1))
|
|
111
|
+
fi
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
# Check Search.tsx.template
|
|
115
|
+
if [ -f "$ROOT/src/templates/pages/Search.tsx.template" ]; then
|
|
116
|
+
if grep -q "from '@/components/library/ui/UIInput'" "$ROOT/src/templates/pages/Search.tsx.template"; then
|
|
117
|
+
echo -e " ${GREEN}✓${NC} Search.tsx.template imports UIInput correctly"
|
|
118
|
+
else
|
|
119
|
+
echo -e " ${YELLOW}⚠${NC} Search.tsx.template does not import UIInput (may not need it)"
|
|
120
|
+
fi
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# Check for wrong imports in templates
|
|
124
|
+
WRONG_IMPORTS=$(grep -r "from '@/components/library/ui/Button'" "$ROOT/src/templates/" 2>/dev/null || true)
|
|
125
|
+
if [ -n "$WRONG_IMPORTS" ]; then
|
|
126
|
+
echo -e " ${RED}✗${NC} Templates importing Button instead of UIButton:"
|
|
127
|
+
echo "$WRONG_IMPORTS" | sed 's/^/ /'
|
|
128
|
+
TEMPLATE_ERRORS=$((TEMPLATE_ERRORS + 1))
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
WRONG_IMPORTS=$(grep -r "from '@/components/library/ui/Input'" "$ROOT/src/templates/" 2>/dev/null || true)
|
|
132
|
+
if [ -n "$WRONG_IMPORTS" ]; then
|
|
133
|
+
echo -e " ${RED}✗${NC} Templates importing Input instead of UIInput:"
|
|
134
|
+
echo "$WRONG_IMPORTS" | sed 's/^/ /'
|
|
135
|
+
TEMPLATE_ERRORS=$((TEMPLATE_ERRORS + 1))
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
ERRORS=$((ERRORS + TEMPLATE_ERRORS))
|
|
139
|
+
|
|
140
|
+
echo ""
|
|
141
|
+
|
|
142
|
+
# Check 5: Internal library imports
|
|
143
|
+
echo "🔗 Checking internal library imports..."
|
|
144
|
+
INTERNAL_ERRORS=0
|
|
145
|
+
|
|
146
|
+
# Check cards/ for wrong imports
|
|
147
|
+
WRONG_CARDS=$(grep -r 'from "../ui/Button"' "$ROOT/src/components/library/cards/" 2>/dev/null || true)
|
|
148
|
+
if [ -n "$WRONG_CARDS" ]; then
|
|
149
|
+
echo -e " ${RED}✗${NC} Card components importing Button instead of UIButton:"
|
|
150
|
+
echo "$WRONG_CARDS" | sed 's/^/ /'
|
|
151
|
+
INTERNAL_ERRORS=$((INTERNAL_ERRORS + 1))
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
WRONG_CARDS=$(grep -r 'from "../ui/Input"' "$ROOT/src/components/library/cards/" 2>/dev/null || true)
|
|
155
|
+
if [ -n "$WRONG_CARDS" ]; then
|
|
156
|
+
echo -e " ${RED}✗${NC} Card components importing Input instead of UIInput:"
|
|
157
|
+
echo "$WRONG_CARDS" | sed 's/^/ /'
|
|
158
|
+
INTERNAL_ERRORS=$((INTERNAL_ERRORS + 1))
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
# Check if UIButton/UIInput are imported correctly
|
|
162
|
+
CORRECT_IMPORTS=$(grep -r 'from "../ui/UIButton"' "$ROOT/src/components/library/cards/" 2>/dev/null | wc -l)
|
|
163
|
+
if [ "$CORRECT_IMPORTS" -gt 0 ]; then
|
|
164
|
+
echo -e " ${GREEN}✓${NC} Found $CORRECT_IMPORTS correct UIButton imports in cards/"
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
CORRECT_IMPORTS=$(grep -r 'from "../ui/UIInput"' "$ROOT/src/components/library/cards/" 2>/dev/null | wc -l)
|
|
168
|
+
if [ "$CORRECT_IMPORTS" -gt 0 ]; then
|
|
169
|
+
echo -e " ${GREEN}✓${NC} Found $CORRECT_IMPORTS correct UIInput imports in cards/"
|
|
170
|
+
fi
|
|
171
|
+
|
|
172
|
+
ERRORS=$((ERRORS + INTERNAL_ERRORS))
|
|
173
|
+
|
|
174
|
+
echo ""
|
|
175
|
+
|
|
176
|
+
# Check 6: Documentation exists
|
|
177
|
+
echo "📖 Checking documentation..."
|
|
178
|
+
if [ -f "$ROOT/.a4drules/skills/component-library/ui-primitives.md" ]; then
|
|
179
|
+
# Check if UIButton is documented
|
|
180
|
+
if grep -q "UIButton" "$ROOT/.a4drules/skills/component-library/ui-primitives.md"; then
|
|
181
|
+
echo -e " ${GREEN}✓${NC} UIButton documented in ui-primitives.md"
|
|
182
|
+
else
|
|
183
|
+
echo -e " ${RED}✗${NC} UIButton not found in ui-primitives.md"
|
|
184
|
+
ERRORS=$((ERRORS + 1))
|
|
185
|
+
fi
|
|
186
|
+
|
|
187
|
+
# Check if UIInput is documented
|
|
188
|
+
if grep -q "UIInput" "$ROOT/.a4drules/skills/component-library/ui-primitives.md"; then
|
|
189
|
+
echo -e " ${GREEN}✓${NC} UIInput documented in ui-primitives.md"
|
|
190
|
+
else
|
|
191
|
+
echo -e " ${RED}✗${NC} UIInput not found in ui-primitives.md"
|
|
192
|
+
ERRORS=$((ERRORS + 1))
|
|
193
|
+
fi
|
|
194
|
+
else
|
|
195
|
+
echo -e " ${RED}✗${NC} Documentation file missing: .a4drules/skills/component-library/ui-primitives.md"
|
|
196
|
+
ERRORS=$((ERRORS + 1))
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
echo ""
|
|
200
|
+
|
|
201
|
+
# Check 7: Package.json files array includes necessary directories
|
|
202
|
+
echo "📦 Checking package.json files array..."
|
|
203
|
+
if grep -q '"src/templates"' "$ROOT/package.json"; then
|
|
204
|
+
echo -e " ${GREEN}✓${NC} src/templates included in package.json files"
|
|
205
|
+
else
|
|
206
|
+
echo -e " ${RED}✗${NC} src/templates missing from package.json files array"
|
|
207
|
+
ERRORS=$((ERRORS + 1))
|
|
208
|
+
fi
|
|
209
|
+
|
|
210
|
+
if grep -q '"src/components"' "$ROOT/package.json"; then
|
|
211
|
+
echo -e " ${GREEN}✓${NC} src/components included in package.json files"
|
|
212
|
+
else
|
|
213
|
+
echo -e " ${RED}✗${NC} src/components missing from package.json files array"
|
|
214
|
+
ERRORS=$((ERRORS + 1))
|
|
215
|
+
fi
|
|
216
|
+
|
|
217
|
+
if grep -q '".a4drules"' "$ROOT/package.json"; then
|
|
218
|
+
echo -e " ${GREEN}✓${NC} .a4drules included in package.json files"
|
|
219
|
+
else
|
|
220
|
+
echo -e " ${RED}✗${NC} .a4drules missing from package.json files array"
|
|
221
|
+
ERRORS=$((ERRORS + 1))
|
|
222
|
+
fi
|
|
223
|
+
|
|
224
|
+
echo ""
|
|
225
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
226
|
+
|
|
227
|
+
if [ $ERRORS -eq 0 ]; then
|
|
228
|
+
echo -e "${GREEN}✅ All consistency checks passed!${NC}"
|
|
229
|
+
echo ""
|
|
230
|
+
echo "Safe to publish."
|
|
231
|
+
exit 0
|
|
232
|
+
else
|
|
233
|
+
echo -e "${RED}❌ Found $ERRORS error(s)${NC}"
|
|
234
|
+
echo ""
|
|
235
|
+
echo "Fix these errors before publishing."
|
|
236
|
+
echo "See CONTRIBUTING.md for guidance."
|
|
237
|
+
exit 1
|
|
238
|
+
fi
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import BaseCard from "./BaseCard";
|
|
3
|
-
import UIInput from "../ui/
|
|
4
|
-
import UIButton from "../ui/
|
|
3
|
+
import UIInput from "../ui/UIInput";
|
|
4
|
+
import UIButton from "../ui/UIButton";
|
|
5
5
|
import UIText from "../ui/Text";
|
|
6
6
|
|
|
7
7
|
function defaultTypeFormat(type, value) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { default as AppThemeProvider, useThemeMode } from "./theme/AppThemeProvider";
|
|
2
2
|
|
|
3
3
|
// UI primitives
|
|
4
|
-
export { default as UIButton } from "./ui/
|
|
5
|
-
export { default as UIInput } from "./ui/
|
|
4
|
+
export { default as UIButton } from "./ui/UIButton";
|
|
5
|
+
export { default as UIInput } from "./ui/UIInput";
|
|
6
6
|
export { default as UIToggle } from "./ui/Toggle";
|
|
7
7
|
export { default as UIText } from "./ui/Text";
|
|
8
8
|
export { default as UICard, Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "./ui/Card";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
3
|
const VARIANT_CLASSES = {
|
|
4
4
|
primary:
|
|
5
|
-
"bg-
|
|
5
|
+
"bg-blue-600 text-white hover:bg-blue-500 dark:bg-blue-500 dark:hover:bg-blue-400 border-transparent",
|
|
6
6
|
secondary:
|
|
7
7
|
"bg-slate-900 text-white hover:bg-slate-800 dark:bg-slate-100 dark:text-slate-900 dark:hover:bg-slate-200 border-transparent",
|
|
8
8
|
destructive:
|
|
@@ -10,39 +10,42 @@ const VARIANT_CLASSES = {
|
|
|
10
10
|
outline:
|
|
11
11
|
"bg-transparent text-slate-900 hover:bg-slate-50 dark:text-slate-50 dark:hover:bg-slate-900 border-slate-200 dark:border-slate-800",
|
|
12
12
|
ghost:
|
|
13
|
-
"bg-transparent text-slate-900 hover:bg-slate-100 dark:text-slate-50 dark:hover:bg-slate-900 border-transparent"
|
|
14
|
-
|
|
13
|
+
"bg-transparent text-slate-900 hover:bg-slate-100 dark:text-slate-50 dark:hover:bg-slate-900 border-transparent",
|
|
14
|
+
link: "text-blue-600 underline-offset-4 hover:underline dark:text-blue-400 border-transparent"
|
|
15
|
+
} as const;
|
|
15
16
|
|
|
16
17
|
const SIZE_CLASSES = {
|
|
17
18
|
sm: "h-8 px-3 text-sm",
|
|
18
19
|
md: "h-10 px-4 text-sm",
|
|
19
20
|
lg: "h-12 px-5 text-base",
|
|
20
21
|
icon: "h-10 w-10 p-0"
|
|
21
|
-
};
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
export interface UIButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
25
|
+
variant?: keyof typeof VARIANT_CLASSES;
|
|
26
|
+
size?: keyof typeof SIZE_CLASSES;
|
|
27
|
+
fullWidth?: boolean;
|
|
28
|
+
}
|
|
22
29
|
|
|
23
30
|
export default function UIButton({
|
|
24
31
|
variant = "primary",
|
|
25
32
|
size = "md",
|
|
26
33
|
fullWidth = false,
|
|
27
34
|
disabled = false,
|
|
28
|
-
onClick = () => {},
|
|
29
|
-
children,
|
|
30
|
-
style = undefined,
|
|
31
35
|
className = "",
|
|
36
|
+
children,
|
|
32
37
|
...rest
|
|
33
|
-
}) {
|
|
34
|
-
const variantClass = VARIANT_CLASSES[variant]
|
|
35
|
-
const sizeClass = SIZE_CLASSES[size]
|
|
38
|
+
}: UIButtonProps) {
|
|
39
|
+
const variantClass = VARIANT_CLASSES[variant];
|
|
40
|
+
const sizeClass = SIZE_CLASSES[size];
|
|
36
41
|
|
|
37
42
|
return (
|
|
38
43
|
<button
|
|
39
44
|
type="button"
|
|
40
|
-
onClick={onClick}
|
|
41
45
|
disabled={disabled}
|
|
42
|
-
style={style}
|
|
43
46
|
className={[
|
|
44
47
|
"inline-flex items-center justify-center gap-2 rounded-lg border font-medium shadow-sm transition",
|
|
45
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-
|
|
48
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-slate-950",
|
|
46
49
|
"disabled:cursor-not-allowed disabled:opacity-60",
|
|
47
50
|
variantClass,
|
|
48
51
|
sizeClass,
|
|
@@ -57,5 +60,3 @@ export default function UIButton({
|
|
|
57
60
|
</button>
|
|
58
61
|
);
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface UIInputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
4
|
+
|
|
5
|
+
export default function UIInput({ className = "", ...rest }: UIInputProps) {
|
|
4
6
|
return (
|
|
5
7
|
<input
|
|
6
|
-
style={style}
|
|
7
8
|
className={[
|
|
8
9
|
"h-10 w-full rounded-lg border border-slate-200 bg-white px-3 text-sm text-slate-900 shadow-sm",
|
|
9
10
|
"placeholder:text-slate-400",
|
|
10
11
|
"focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2 dark:focus:ring-offset-slate-950",
|
|
11
12
|
"dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50 dark:placeholder:text-slate-500",
|
|
13
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
12
14
|
className
|
|
13
15
|
]
|
|
14
16
|
.filter(Boolean)
|
|
@@ -17,5 +19,3 @@ export default function UIInput({ style = undefined, className = "", ...rest })
|
|
|
17
19
|
/>
|
|
18
20
|
);
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|