60 lines
2.0 KiB
JSON
60 lines
2.0 KiB
JSON
{
|
|
"name": "ProductCart",
|
|
"description": "Slide-in cart drawer with backdrop overlay, item list, total, and action buttons.",
|
|
"details": "Fixed-position cart panel that slides in from the right with a width transition. Controlled via isOpen/onClose props. Closes on backdrop click or Escape key. Locks body scroll when open. Items are scrollable with fade mask. Removal triggers a fade animation via AnimationContainer. Renders up to 2 themed action buttons. Use alongside ProductDetailCard for a complete e-commerce flow.",
|
|
"constraints": {
|
|
"textRules": {
|
|
"title": {
|
|
"required": false,
|
|
"example": "Cart",
|
|
"minChars": 2,
|
|
"maxChars": 20
|
|
},
|
|
"totalLabel": {
|
|
"required": false,
|
|
"example": "Total",
|
|
"minChars": 2,
|
|
"maxChars": 20
|
|
},
|
|
"total": {
|
|
"required": true,
|
|
"example": "$150.00",
|
|
"minChars": 1,
|
|
"maxChars": 20
|
|
},
|
|
"emptyMessage": {
|
|
"required": false,
|
|
"example": "Your cart is empty",
|
|
"minChars": 5,
|
|
"maxChars": 60
|
|
}
|
|
}
|
|
},
|
|
"propsSchema": {
|
|
"isOpen": "boolean",
|
|
"onClose": "() => void",
|
|
"items": "CartItem[]",
|
|
"onQuantityChange?": "(id: string, quantity: number) => void",
|
|
"onRemove?": "(id: string) => void",
|
|
"total": "string",
|
|
"buttons": "ButtonConfig[]",
|
|
"title?": "string (default: 'Cart')",
|
|
"totalLabel?": "string (default: 'Total')",
|
|
"emptyMessage?": "string (default: 'Your cart is empty')",
|
|
"className?": "string",
|
|
"panelClassName?": "string",
|
|
"itemClassName?": "string",
|
|
"buttonClassName?": "string"
|
|
},
|
|
"usageExample": "<ProductCart isOpen={cartOpen} onClose={() => setCartOpen(false)} items={cartItems} onQuantityChange={handleQuantityChange} onRemove={handleRemove} total={`$${cartTotal}`} buttons={[{ text: 'Check Out', onClick: () => console.log('checkout') }]} />",
|
|
"do": [
|
|
"Use for general use"
|
|
],
|
|
"dont": [],
|
|
"editRules": {
|
|
"textOnly": true,
|
|
"layoutLocked": true,
|
|
"styleLocked": true
|
|
}
|
|
}
|