diff --git a/bestax-mcp/data/catalog.json b/bestax-mcp/data/catalog.json index e63cf4e28..565d17104 100644 --- a/bestax-mcp/data/catalog.json +++ b/bestax-mcp/data/catalog.json @@ -2,7 +2,7 @@ "schemaVersion": 1, "generatedFrom": { "package": "@allxsmith/bestax-bulma", - "version": "5.26.6" + "version": "5.27.0" }, "docsBase": "https://bestax.io/docs", "categories": [ diff --git a/bestax-mcp/data/components/Autocomplete.json b/bestax-mcp/data/components/Autocomplete.json index 55b57b8f1..5d7044800 100644 --- a/bestax-mcp/data/components/Autocomplete.json +++ b/bestax-mcp/data/components/Autocomplete.json @@ -7,15 +7,15 @@ "examples": [ { "title": "Basic Autocomplete", - "code": "function example() {\n const [selected, setSelected] = useState(null);\n const fruits = [\n 'Apple',\n 'Banana',\n 'Cherry',\n 'Date',\n 'Elderberry',\n 'Fig',\n 'Grape',\n ];\n\n return (\n \n \n {selected && Selected: {selected}}\n \n );\n}" + "code": "function example() {\n const [selected, setSelected] = useState(null);\n const fruits = [\n 'Apple',\n 'Banana',\n 'Cherry',\n 'Date',\n 'Elderberry',\n 'Fig',\n 'Grape',\n ];\n\n return (\n \n setSelected(typeof item === 'string' ? item : null)}\n />\n {selected && Selected: {selected}}\n \n );\n}" }, { "title": "Open on Focus", - "code": "function example() {\n const [selected, setSelected] = useState(null);\n const countries = [\n 'United States',\n 'United Kingdom',\n 'Canada',\n 'Australia',\n 'Germany',\n 'France',\n ];\n\n return (\n \n );\n}" + "code": "function example() {\n const countries = [\n 'United States',\n 'United Kingdom',\n 'Canada',\n 'Australia',\n 'Germany',\n 'France',\n ];\n\n return (\n \n );\n}" }, { "title": "With Clear Button", - "code": "function example() {\n const [selected, setSelected] = useState(null);\n const options = ['Option 1', 'Option 2', 'Option 3', 'Option 4'];\n\n return (\n \n );\n}" + "code": "function example() {\n const options = ['Option 1', 'Option 2', 'Option 3', 'Option 4'];\n\n return (\n \n );\n}" }, { "title": "Color and Size Variants", @@ -23,11 +23,11 @@ }, { "title": "With Object Data", - "code": "function example() {\n const [selected, setSelected] = useState(null);\n const users = [\n { value: '1', label: 'John Doe', email: 'john@example.com' },\n { value: '2', label: 'Jane Smith', email: 'jane@example.com' },\n { value: '3', label: 'Bob Johnson', email: 'bob@example.com' },\n ];\n\n return (\n \n \n {selected && (\n \n Selected: {selected.label} ({selected.email})\n \n )}\n \n );\n}" + "code": "function example() {\n const users = [\n { value: '1', label: 'John Doe', email: 'john@example.com' },\n { value: '2', label: 'Jane Smith', email: 'jane@example.com' },\n { value: '3', label: 'Bob Johnson', email: 'bob@example.com' },\n ];\n const [selected, setSelected] = useState<(typeof users)[number] | null>(null);\n\n return (\n \n \n setSelected(\n users.find(\n u => u.value === (typeof item === 'string' ? item : item?.value)\n ) ?? null\n )\n }\n />\n {selected && (\n \n Selected: {selected.label} ({selected.email})\n \n )}\n \n );\n}" }, { "title": "Custom Item Template", - "code": "function example() {\n const [selected, setSelected] = useState(null);\n const users = [\n { value: '1', label: 'John Doe', role: 'Admin' },\n { value: '2', label: 'Jane Smith', role: 'Editor' },\n { value: '3', label: 'Bob Johnson', role: 'Viewer' },\n ];\n\n return (\n (\n \n {item.label}\n \n {item.role}\n \n \n )}\n />\n );\n}" + "code": "function example() {\n const users = [\n { value: '1', label: 'John Doe', role: 'Admin' },\n { value: '2', label: 'Jane Smith', role: 'Editor' },\n { value: '3', label: 'Bob Johnson', role: 'Viewer' },\n ];\n\n return (\n {\n const user = users.find(\n u => u.value === (typeof item === 'string' ? item : item.value)\n );\n return (\n \n {user?.label}\n \n {user?.role}\n \n \n );\n }}\n />\n );\n}" }, { "title": "With Empty State", diff --git a/bestax-mcp/data/components/Avatar.json b/bestax-mcp/data/components/Avatar.json index 6ee7bd8de..8e098eaaa 100644 --- a/bestax-mcp/data/components/Avatar.json +++ b/bestax-mcp/data/components/Avatar.json @@ -35,7 +35,7 @@ }, { "title": "Forwarded ref", - "code": "function example() {\n const avatarRef = React.useRef(null);\n const [tag, setTag] = React.useState(null);\n\n return (\n <>\n \n \n

Rendered element: {tag ?? '—'}

\n \n );\n}" + "code": "function example() {\n const avatarRef = React.useRef(null);\n const [tag, setTag] = React.useState();\n\n return (\n <>\n \n \n

Rendered element: {tag ?? '—'}

\n \n );\n}" } ], "accessibility": "- Image avatars use `alt` (falling back to `name`) for their accessible name.\n- Initials/icon avatars expose `role=\"img\"` and `aria-label` (from `alt`/`name`) — unless\n rendered as a link or button, where the native link/button role and `aria-label` are used\n instead. A custom component passed to `as` counts as interactive, since a router link takes\n `to` rather than this component's `href`. If yours renders something that really is just a\n picture, say so with `role=\"img\"` and it's treated as one — `alt=\"\"` included. A truthy\n `aria-hidden` says it too, and so do `role=\"presentation\"` and `role=\"none\"`, though ARIA's\n own conflict resolution drops those two whenever the avatar still carries a name — prefer\n `role=\"img\"`. A role claiming the opposite, such as `\"button\"`, doesn't, and neither does an\n `href`.\n- **Decorative avatars:** pass an explicit `alt=\"\"` when the avatar repeats information\n already visible next to it (e.g. beside the author's name in a comment row). The image\n stays decorative and an initials/icon avatar is skipped entirely (`aria-hidden`), avoiding\n double-speak. The opt-out never applies to a link/button avatar — an interactive element\n always keeps an accessible name (from `name`, or a generic `\"Avatar\"` fallback) — and a\n custom component passed to `as` counts as one until it says otherwise, so `alt=\"\"` on a\n custom wrapper needs that signal next to it.\n- A link/button avatar with no `alt`/`name` (e.g. an API that returns only a photo URL) still\n gets an `aria-label` fallback rather than rendering a nameless control.\n- `as=\"button\"` defaults to `type=\"button\"`, so a clickable avatar inside a form doesn't\n submit it.\n- The default fallback icon is `aria-hidden`.", diff --git a/bestax-mcp/data/components/Button.json b/bestax-mcp/data/components/Button.json index 6a2c24bab..42d5bff6a 100644 --- a/bestax-mcp/data/components/Button.json +++ b/bestax-mcp/data/components/Button.json @@ -8,11 +8,11 @@ { "title": "Default Button", "code": "" }, { "title": "All Colors", - "code": "\n {['primary', 'link', 'info', 'success', 'warning', 'danger'].map(color => (\n \n ))}\n" + "code": "\n {(['primary', 'link', 'info', 'success', 'warning', 'danger'] as const).map(\n color => (\n \n )\n )}\n" }, { "title": "All Sizes", - "code": "\n {['small', 'normal', 'medium', 'large'].map(size => (\n \n ))}\n" + "code": "\n {(['small', 'normal', 'medium', 'large'] as const).map(size => (\n \n ))}\n" }, { "title": "Light Variant", @@ -94,7 +94,7 @@ }, { "title": "Forwarded ref", - "code": "function example() {\n const buttonRef = React.useRef(null);\n const [tag, setTag] = React.useState(null);\n\n return (\n <>\n \n \n

Rendered element: {tag ?? '—'}

\n \n );\n}" + "code": "function example() {\n const buttonRef = React.useRef(null);\n const [tag, setTag] = React.useState();\n\n return (\n <>\n \n \n

Rendered element: {tag ?? '—'}

\n \n );\n}" } ], "accessibility": "- **Labeling:** Always provide descriptive content for buttons for screen readers.\n- **States:** The `isDisabled` and `disabled` props ensure correct `aria-disabled` and `disabled` attributes.\n- **Keyboard:** When rendered as ``, disabled buttons are not focusable.\n- **Focus:** Use `isFocused` and `isActive` for visual feedback, but rely on browser focus for actual accessibility.\n\n:::note\nIf your button has only an icon, use `aria-label` to provide accessible text.\n:::", diff --git a/bestax-mcp/data/components/Buttons.json b/bestax-mcp/data/components/Buttons.json index d8d9952ed..b15f59365 100644 --- a/bestax-mcp/data/components/Buttons.json +++ b/bestax-mcp/data/components/Buttons.json @@ -11,11 +11,11 @@ }, { "title": "All Colors Group", - "code": "\n {['primary', 'link', 'info', 'success', 'warning', 'danger'].map(color => (\n \n ))}\n" + "code": "\n {(['primary', 'link', 'info', 'success', 'warning', 'danger'] as const).map(\n color => (\n \n )\n )}\n" }, { "title": "All Sizes Group", - "code": "\n {['small', 'normal', 'medium', 'large'].map(size => (\n \n ))}\n" + "code": "\n {(['small', 'normal', 'medium', 'large'] as const).map(size => (\n \n ))}\n" }, { "title": "Group Size", diff --git a/bestax-mcp/data/components/Carousel.json b/bestax-mcp/data/components/Carousel.json index 6d55b63f0..5fd0c4093 100644 --- a/bestax-mcp/data/components/Carousel.json +++ b/bestax-mcp/data/components/Carousel.json @@ -15,7 +15,7 @@ }, { "title": "Indicator Styles", - "code": "function IndicatorExample() {\n const [style, setStyle] = useState('dots');\n return (\n \n \n setStyle('dots')}\n color={style === 'dots' ? 'primary' : undefined}\n >\n Dots\n \n setStyle('circles')}\n color={style === 'circles' ? 'primary' : undefined}\n >\n Circles\n \n setStyle('lines')}\n color={style === 'lines' ? 'primary' : undefined}\n >\n Lines\n \n setStyle('bars')}\n color={style === 'bars' ? 'primary' : undefined}\n >\n Bars\n \n \n \n \n \n \n Slide 1\n \n \n \n \n \n \n Slide 2\n \n \n \n \n \n \n Slide 3\n \n \n \n \n \n );\n}" + "code": "function IndicatorExample() {\n const [style, setStyle] = useState<'dots' | 'circles' | 'lines' | 'bars'>(\n 'dots'\n );\n return (\n \n \n setStyle('dots')}\n color={style === 'dots' ? 'primary' : undefined}\n >\n Dots\n \n setStyle('circles')}\n color={style === 'circles' ? 'primary' : undefined}\n >\n Circles\n \n setStyle('lines')}\n color={style === 'lines' ? 'primary' : undefined}\n >\n Lines\n \n setStyle('bars')}\n color={style === 'bars' ? 'primary' : undefined}\n >\n Bars\n \n \n \n \n \n \n Slide 1\n \n \n \n \n \n \n Slide 2\n \n \n \n \n \n \n Slide 3\n \n \n \n \n \n );\n}" }, { "title": "Without Arrows", diff --git a/bestax-mcp/data/components/Collapse.json b/bestax-mcp/data/components/Collapse.json index a804ab5e1..4196daa5d 100644 --- a/bestax-mcp/data/components/Collapse.json +++ b/bestax-mcp/data/components/Collapse.json @@ -7,19 +7,19 @@ "examples": [ { "title": "Basic Collapse", - "code": "function example() {\n return (\n \n Click to expand\n \n }\n >\n \n \n This is the collapsible content. It can contain any React elements.\n \n Click the header again to collapse.\n \n \n );\n}" + "code": "function example() {\n return (\n \n Click to expand\n \n }\n >\n \n \n This is the collapsible content. It can contain any React elements.\n \n Click the header again to collapse.\n \n \n );\n}" }, { "title": "Default Open", - "code": "function example() {\n return (\n \n This starts open\n \n }\n >\n \n This content is visible by default.\n \n \n );\n}" + "code": "function example() {\n return (\n \n This starts open\n \n }\n >\n \n This content is visible by default.\n \n \n );\n}" }, { "title": "Without Animation", - "code": "function example() {\n return (\n \n No animation\n \n }\n >\n \n This collapse has animation disabled.\n \n \n );\n}" + "code": "function example() {\n return (\n \n No animation\n \n }\n >\n \n This collapse has animation disabled.\n \n \n );\n}" }, { "title": "Controlled Mode", - "code": "function example() {\n const [isOpen, setIsOpen] = useState(false);\n\n return (\n \n \n \n State: {isOpen ? 'Open' : 'Closed'}\n \n \n Controlled collapse (click here or the button above)\n \n }\n >\n \n This collapse is controlled by external state.\n \n \n \n );\n}" + "code": "function example() {\n const [isOpen, setIsOpen] = useState(false);\n\n return (\n \n \n \n State: {isOpen ? 'Open' : 'Closed'}\n \n \n Controlled collapse (click here or the button above)\n \n }\n >\n \n This collapse is controlled by external state.\n \n \n \n );\n}" }, { "title": "Accordion", diff --git a/bestax-mcp/data/components/DateInput.json b/bestax-mcp/data/components/DateInput.json index b1eb0989e..0a2f2e1b1 100644 --- a/bestax-mcp/data/components/DateInput.json +++ b/bestax-mcp/data/components/DateInput.json @@ -15,11 +15,11 @@ }, { "title": "Controlled", - "code": "function example() {\n const [value, setValue] = useState(new Date());\n return (\n \n \n \n Selected: {value ? value.toDateString() : '—'}\n \n \n );\n}" + "code": "function example() {\n const [value, setValue] = useState(new Date());\n return (\n \n \n \n Selected: {value ? value.toDateString() : '—'}\n \n \n );\n}" }, { "title": "Controlled", - "code": "function example() {\n const [value, setValue] = useState(new Date());\n return (\n \n \n \n Selected: {value ? value.toDateString() : '—'}\n \n \n );\n}" + "code": "function example() {\n const [value, setValue] = useState(new Date());\n return (\n \n \n \n Selected: {value ? value.toDateString() : '—'}\n \n \n );\n}" }, { "title": "Inline", @@ -67,11 +67,11 @@ }, { "title": "Formats", - "code": "function example() {\n const parse = s => {\n const t = Date.parse(s);\n return isNaN(t) ? null : new Date(t);\n };\n return (\n \n );\n}" + "code": "function example() {\n const parse = (s: string) => {\n const t = Date.parse(s);\n return isNaN(t) ? null : new Date(t);\n };\n return (\n \n );\n}" }, { "title": "Formats", - "code": "function example() {\n const parse = s => {\n const t = Date.parse(s);\n return isNaN(t) ? null : new Date(t);\n };\n return (\n \n );\n}" + "code": "function example() {\n const parse = (s: string) => {\n const t = Date.parse(s);\n return isNaN(t) ? null : new Date(t);\n };\n return (\n \n );\n}" }, { "title": "Launcher Icon", @@ -95,7 +95,7 @@ }, { "title": "Manual Keyboard Entry", - "code": "function example() {\n const [v, setV] = useState(() => new Date(2024, 5, 7));\n return (\n \n \n Selected: {v ? v.toDateString() : '—'}\n \n );\n}" + "code": "function example() {\n const [v, setV] = useState(() => new Date(2024, 5, 7));\n return (\n \n \n Selected: {v ? v.toDateString() : '—'}\n \n );\n}" }, { "title": "Manual Keyboard Entry", diff --git a/bestax-mcp/data/components/DateRangeInput.json b/bestax-mcp/data/components/DateRangeInput.json index 4213ccdf2..f04d49b4a 100644 --- a/bestax-mcp/data/components/DateRangeInput.json +++ b/bestax-mcp/data/components/DateRangeInput.json @@ -11,7 +11,7 @@ }, { "title": "Controlled", - "code": "function ControlledRange() {\n const [range, setRange] = React.useState([null, null]);\n const [start, end] = range;\n return (\n \n \n \n {start ? start.toDateString() : 'No start'} to{' '}\n {end ? end.toDateString() : 'no end'}\n \n \n \n );\n}" + "code": "import type { DateRangeValue } from '@allxsmith/bestax-bulma';\n\nfunction ControlledRange() {\n const [range, setRange] = React.useState([null, null]);\n const [start, end] = range;\n return (\n \n \n \n {start ? start.toDateString() : 'No start'} to{' '}\n {end ? end.toDateString() : 'no end'}\n \n \n \n );\n}" }, { "title": "Inline", @@ -23,7 +23,7 @@ }, { "title": "Disabled Dates", - "code": "function Weekdays() {\n const weekend = d => d.getDay() === 0 || d.getDay() === 6;\n return (\n \n \n \n \n );\n}" + "code": "function Weekdays() {\n const weekend = (d: Date) => d.getDay() === 0 || d.getDay() === 6;\n return (\n \n \n \n \n );\n}" }, { "title": "Typing the Dates", diff --git a/bestax-mcp/data/components/DateTimeInput.json b/bestax-mcp/data/components/DateTimeInput.json index 2a5b6f3e2..e5e6c9d3d 100644 --- a/bestax-mcp/data/components/DateTimeInput.json +++ b/bestax-mcp/data/components/DateTimeInput.json @@ -15,11 +15,11 @@ }, { "title": "Controlled", - "code": "function example() {\n const [v, setV] = useState(new Date());\n return (\n \n \n Selected: {v ? v.toString() : '—'}\n \n );\n}" + "code": "function example() {\n const [v, setV] = useState(new Date());\n return (\n \n \n Selected: {v ? v.toString() : '—'}\n \n );\n}" }, { "title": "Controlled", - "code": "function example() {\n const [v, setV] = useState(new Date());\n return (\n \n \n Selected: {v ? v.toString() : '—'}\n \n );\n}" + "code": "function example() {\n const [v, setV] = useState(new Date());\n return (\n \n \n Selected: {v ? v.toString() : '—'}\n \n );\n}" }, { "title": "12-hour Format", @@ -155,7 +155,7 @@ }, { "title": "Manual Keyboard Entry", - "code": "function example() {\n const [v, setV] = useState(() => new Date(2024, 5, 7, 13, 45));\n return (\n \n \n Selected: {v ? v.toString() : '—'}\n \n );\n}" + "code": "function example() {\n const [v, setV] = useState(() => new Date(2024, 5, 7, 13, 45));\n return (\n \n \n Selected: {v ? v.toString() : '—'}\n \n );\n}" }, { "title": "Manual Keyboard Entry", diff --git a/bestax-mcp/data/components/Dialog.json b/bestax-mcp/data/components/Dialog.json index 7ad6af06c..fb20daf8e 100644 --- a/bestax-mcp/data/components/Dialog.json +++ b/bestax-mcp/data/components/Dialog.json @@ -15,7 +15,7 @@ }, { "title": "Dialog Types", - "code": "function example() {\n const [dialogType, setDialogType] = useState(null);\n return (\n \n \n \n \n \n \n \n {dialogType && (\n setDialogType(null)}\n onCancel={() => setDialogType(null)}\n />\n )}\n \n );\n}" + "code": "function example() {\n const [dialogType, setDialogType] = useState<\n 'success' | 'danger' | 'warning' | 'info' | null\n >(null);\n return (\n \n \n \n \n \n \n \n {dialogType && (\n setDialogType(null)}\n onCancel={() => setDialogType(null)}\n />\n )}\n \n );\n}" }, { "title": "With Rich Content", diff --git a/bestax-mcp/data/components/Dropdown.json b/bestax-mcp/data/components/Dropdown.json index 35a44c7c4..191402f6a 100644 --- a/bestax-mcp/data/components/Dropdown.json +++ b/bestax-mcp/data/components/Dropdown.json @@ -31,7 +31,7 @@ }, { "title": "Forwarded ref", - "code": "function example() {\n const dropdownRef = React.useRef(null);\n const [tag, setTag] = React.useState(null);\n\n return (\n <>\n \n First\n Second\n \n \n

Root class: {tag ?? '—'}

\n \n );\n}" + "code": "function example() {\n const dropdownRef = React.useRef(null);\n const [tag, setTag] = React.useState();\n\n return (\n <>\n \n First\n Second\n \n \n

Root class: {tag ?? '—'}

\n \n );\n}" }, { "title": "Split Button", diff --git a/bestax-mcp/data/components/Field.json b/bestax-mcp/data/components/Field.json index 385dcf9ed..1638a400d 100644 --- a/bestax-mcp/data/components/Field.json +++ b/bestax-mcp/data/components/Field.json @@ -43,7 +43,7 @@ }, { "title": "With Input (Static, Horizontal)", - "code": "<>\n \n \n \n \n \n \n \n \n \n \n" + "code": "<>\n \n \n \n \n \n \n \n \n \n \n" }, { "title": "With Input (Icons)", diff --git a/bestax-mcp/data/components/Link.json b/bestax-mcp/data/components/Link.json index f40c513f0..7986e67f2 100644 --- a/bestax-mcp/data/components/Link.json +++ b/bestax-mcp/data/components/Link.json @@ -48,7 +48,7 @@ }, { "title": "Forwarded ref", - "code": "function example() {\n const linkRef = React.useRef(null);\n const [tag, setTag] = React.useState(null);\n\n return (\n <>\n \n Target\n \n \n

Rendered element: {tag ?? '—'}

\n \n );\n}" + "code": "function example() {\n const linkRef = React.useRef(null);\n const [tag, setTag] = React.useState();\n\n return (\n <>\n \n Target\n \n \n

Rendered element: {tag ?? '—'}

\n \n );\n}" } ], "accessibility": "- **Descriptive Text:** Use meaningful link text that describes the destination, not generic text like \"click here\".\n- **External Links:** When opening links in new tabs, consider informing users (e.g., with an icon or text like \"opens in new tab\").\n- **Focus States:** Links inherit browser focus styles. Customize with CSS if needed.\n- **Keyboard Navigation:** Links are naturally keyboard accessible via Tab and Enter keys.\n\n:::info\nFor navigation menus, consider using the `isActive` prop to indicate the current page.\n:::\n\n:::warning Links Are for Navigation, Buttons Are for Actions\nPer [Section 508](https://www.section508.gov/) and [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) best practices, links (`
`) should navigate to a URL — not trigger an action via `onClick` alone. If your element performs an action (opening a modal, submitting data, toggling state, etc.) without navigating, use a [`Button`](./button.md) or [`LinkButton`](./linkbutton.md) instead. A `` is an anti-pattern that confuses screen readers and fails accessibility audits.\n:::", diff --git a/bestax-mcp/data/components/LinkButton.json b/bestax-mcp/data/components/LinkButton.json index 40fd2e37c..0538ce6b7 100644 --- a/bestax-mcp/data/components/LinkButton.json +++ b/bestax-mcp/data/components/LinkButton.json @@ -27,7 +27,7 @@ }, { "title": "All Colors", - "code": "\n {['primary', 'link', 'info', 'success', 'warning', 'danger'].map(color => (\n \n {color.charAt(0).toUpperCase() + color.slice(1)}\n \n ))}\n" + "code": "\n {(['primary', 'link', 'info', 'success', 'warning', 'danger'] as const).map(\n color => (\n \n {color.charAt(0).toUpperCase() + color.slice(1)}\n \n )\n )}\n" }, { "title": "Disabled", @@ -35,7 +35,7 @@ }, { "title": "All Sizes", - "code": "\n {['small', 'normal', 'medium', 'large'].map(size => (\n \n {size.charAt(0).toUpperCase() + size.slice(1)}\n \n ))}\n" + "code": "\n {(['small', 'normal', 'medium', 'large'] as const).map(size => (\n \n {size.charAt(0).toUpperCase() + size.slice(1)}\n \n ))}\n" }, { "title": "Polymorphic `as` (Router Links)", @@ -43,7 +43,7 @@ }, { "title": "Forwarded ref", - "code": "function example() {\n const defaultRef = React.useRef(null);\n const anchorRef = React.useRef(null);\n const [tags, setTags] = React.useState(null);\n\n return (\n <>\n Default\n \n As an anchor\n \n \n setTags(\n `${defaultRef.current?.tagName} / ${anchorRef.current?.tagName}`\n )\n }\n >\n Read both from their refs\n \n

Rendered elements: {tags ?? '—'}

\n \n );\n}" + "code": "function example() {\n const defaultRef = React.useRef(null);\n const anchorRef = React.useRef(null);\n const [tags, setTags] = React.useState();\n\n return (\n <>\n Default\n \n As an anchor\n \n \n setTags(\n `${defaultRef.current?.tagName} / ${anchorRef.current?.tagName}`\n )\n }\n >\n Read both from their refs\n \n

Rendered elements: {tags ?? '—'}

\n \n );\n}" } ], "accessibility": "- **Semantic HTML:** Renders a native `
\n \n General\n \n Dashboard\n \n Customers\n \n \n \n \n );\n}" + "code": "function example() {\n const itemRef = React.useRef(null);\n\n return (\n <>\n \n \n General\n \n Dashboard\n \n Customers\n \n \n \n \n );\n}" }, { "title": "Compound (dot-notation) usage", diff --git a/bestax-mcp/data/components/Modal.json b/bestax-mcp/data/components/Modal.json index 6b5db4916..39e6e47c6 100644 --- a/bestax-mcp/data/components/Modal.json +++ b/bestax-mcp/data/components/Modal.json @@ -35,7 +35,7 @@ }, { "title": "Forwarded ref", - "code": "function example() {\n const [open, setOpen] = React.useState(false);\n const [width, setWidth] = React.useState(null);\n const modalRef = React.useRef(null);\n\n return (\n <>\n \n setOpen(false)}\n ref={modalRef}\n modalCardTitle=\"Measured through the ref\"\n >\n \n setWidth(modalRef.current?.getBoundingClientRect().width ?? null)\n }\n >\n Measure\n \n

Width: {width === null ? '—' : `${Math.round(width)}px`}

\n \n \n );\n}" + "code": "function example() {\n const [open, setOpen] = React.useState(false);\n const [width, setWidth] = React.useState(null);\n const modalRef = React.useRef(null);\n\n return (\n <>\n \n setOpen(false)}\n ref={modalRef}\n modalCardTitle=\"Measured through the ref\"\n >\n \n setWidth(modalRef.current?.getBoundingClientRect().width ?? null)\n }\n >\n Measure\n \n

Width: {width === null ? '—' : `${Math.round(width)}px`}

\n \n \n );\n}" }, { "title": "Compound (dot-notation) usage", diff --git a/bestax-mcp/data/components/Navbar.json b/bestax-mcp/data/components/Navbar.json index f3ef2ca02..8bdb85dd3 100644 --- a/bestax-mcp/data/components/Navbar.json +++ b/bestax-mcp/data/components/Navbar.json @@ -31,7 +31,7 @@ }, { "title": "Custom Link Component", - "code": "// import { Link } from 'react-router-dom';\nfunction example() {\n const Link = props => {props.children};\n return (\n \n \n \n \n Home\n \n \n Pricing\n \n \n \n \n );\n}" + "code": "// import { Link } from 'react-router-dom';\nfunction example() {\n const Link = (props: { to: string; children?: React.ReactNode }) => (\n {props.children}\n );\n return (\n \n \n \n \n Home\n \n \n Pricing\n \n \n \n \n );\n}" }, { "title": "Transparent Navbar", @@ -63,11 +63,11 @@ }, { "title": "Color Modifiers", - "code": "function example() {\n const colors = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n ];\n return (\n <>\n {colors.map(color => (\n \n \n \n \"Logo\"\n \n \n \n \n Home\n Docs\n Components\n \n \n \n ))}\n \n );\n}" + "code": "function example() {\n const colors = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n ] as const;\n return (\n <>\n {colors.map(color => (\n \n \n \n \"Logo\"\n \n \n \n \n Home\n Docs\n Components\n \n \n \n ))}\n \n );\n}" }, { "title": "Forwarded ref", - "code": "function example() {\n const navRef = React.useRef(null);\n const [height, setHeight] = React.useState(null);\n\n return (\n <>\n \n \n Home\n \n \n \n

Height: {height == null ? '—' : `${height}px`}

\n \n );\n}" + "code": "function example() {\n const navRef = React.useRef(null);\n const [height, setHeight] = React.useState();\n\n return (\n <>\n \n \n Home\n \n \n \n

Height: {height == null ? '—' : `${height}px`}

\n \n );\n}" }, { "title": "Compound (dot-notation) usage", diff --git a/bestax-mcp/data/components/Panel.json b/bestax-mcp/data/components/Panel.json index 3bb78e471..3a7e74226 100644 --- a/bestax-mcp/data/components/Panel.json +++ b/bestax-mcp/data/components/Panel.json @@ -11,7 +11,7 @@ }, { "title": "Color Variants", - "code": "<>\n {[\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n ].map(color => (\n \n \n {color.charAt(0).toUpperCase() + color.slice(1)} Panel\n \n \n \n \n George Washington\n \n \n \n Marquis de Lafayette\n \n \n \n Nathanael Greene\n \n \n \n Battle of Trenton\n \n \n \n Yorktown\n \n Reset all filters\n \n ))}\n" + "code": "<>\n {(\n [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n ] as const\n ).map(color => (\n \n \n {color.charAt(0).toUpperCase() + color.slice(1)} Panel\n \n \n \n \n George Washington\n \n \n \n Marquis de Lafayette\n \n \n \n Nathanael Greene\n \n \n \n Battle of Trenton\n \n \n \n Yorktown\n \n Reset all filters\n \n ))}\n" }, { "title": "Compound (dot-notation) usage", diff --git a/bestax-mcp/data/components/Rate.json b/bestax-mcp/data/components/Rate.json index b04a3a55b..e59223227 100644 --- a/bestax-mcp/data/components/Rate.json +++ b/bestax-mcp/data/components/Rate.json @@ -36,7 +36,7 @@ }, { "title": "Custom Icons", - "code": "function example() {\n const [rating, setRating] = useState(3);\n\n const HeartIcon = ({ isActive }) => (\n \n \n \n );\n\n return (\n }\n showScore\n />\n );\n}" + "code": "function example() {\n const [rating, setRating] = useState(3);\n\n const HeartIcon = ({ isActive }: { isActive: boolean }) => (\n \n \n \n );\n\n return (\n }\n showScore\n />\n );\n}" }, { "title": "Context-Aware Rendering", @@ -48,7 +48,7 @@ }, { "title": "Context-Aware Rendering", - "code": "function example() {\n return (\n \n \n \n \n \n \n \n \n \n );\n}" + "code": "function example() {\n return (\n \n \n \n \n \n \n \n \n \n );\n}" } ], "accessibility": "- Uses `role=\"radiogroup\"` for the container\n- The `label` prop names the group via `aria-labelledby` (the rendered `