The Shtukbase React component library
The same components as shtukbase-ui-html in React: the shadcn primitives with our classes and the Shtukbase composites; the code is placed in the project, as with shadcn, and draws with the CSS of the HTML library on the tokens of the chosen style.
О пакете
Этот текст ещё не переведён. Ниже английский оригинал.
The React side of the Shtukbase design: the same components as shtukbase-ui-html, with the same ids, levels, states and controls, the same markup and the same classes. The look is written once, in the CSS of the HTML library; the React components only draw its classes and data attributes, and add behaviour.
As with shadcn and keer-ui: sources are copied into the project, not installed as a dependency. The place action puts them in the folder from the
target: field of the page /design/shtukbase-ui-react.md (by default src/sb-ui) and runs by itself after install and update. Files the project edited are not touched by an update.
What it puts in the project:
/design/shtukbase-ui-react.md: what is inside, settings (target:,css:), what the project needs;- the library code in the
targetfolder:primitives/,composites/,blocks/,shell/,lib/,styles/index.css; every component has a header (/*--- … ---*/, the one format of the build contract) and a<id>.states.tsx; - norms SBR-R01 (the library is intact), SBR-R02 (a component has a states file), SBR-R03 (the same components as the HTML library).
Components (one per id of shtukbase-ui-html): primitives button, badge, input, select, switch, slider come from shadcn (new-york-v4) with our classes added; the rest of the shadcn set (avatar, checkbox, label, progress, radio-group, separator, skeleton, textarea, tooltip, accordion, alert, breadcrumb, command, dialog, dropdown-menu, popover, table, tabs) has the shadcn names and slots and draws the markup of the HTML library (native inputs, details and plain surfaces, so the HTML side needs no script); chip, icon-plate, kicker, swatches, status-dot, the composites card, package-card, field, record-card, property-row, details-card, empty-state, tree-item, toolbar, search-field, settings-group and the blocks area, package-grid, settings-bar and peek are ours.
The parts in shell/: Sidebar and its parts, Panel, PanelSection, Collapsible, ScrollArea,
Sheet and the layouts LayoutDocument, LayoutGrid, LayoutCatalog, LayoutCanvas (pan, zoom with the wheel and the keys, fit):
plain elements with the classes of shtukbase-ui-html. The lens layout arranges these parts.
The package does not install dependencies (react, radix-ui, class-variance-authority, cn, lucide-react, tailwindcss 4, tw-animate-css); they are requirements for the project, and the list is on the page. The tests carry their own bundled copies (test/vendor) and need no install.
Boundary: no screens and no domain components; the look of our own composites is not repeated in Tailwind classes — it is the CSS of the HTML library. A control of the HTML library is a prop here (preset="cover").
Нормы 3
| ID | Норма | Уровень | Режим | Enforcer |
|---|---|---|---|---|
| SBR-R01 | The React component library is placed in the project: every file of its manifest is in its place and every relative import (code and CSS) finds its file. |
MUST | не пускает | проверка |
| SBR-R02 | Next to every component <id>.tsx in primitives/, composites/ and blocks/ lies <id>.states.tsx, which exports meta and states. |
SHOULD | не пускает | проверка |
| SBR-R03 | Every React component has a valid header whose id is its file name and whose level is its folder; when the project has shtukbase-ui-html, both libraries have the same ids and the same level, controls, states, statuses, uses and parts. |
MUST | не пускает | проверка |
«Не пускает» — enforcer останавливает нарушение; «наблюдает» — только отмечает его. Уровень MUST — обязательно, SHOULD — по умолчанию да.
Действия 4
| Имя | Что делает | Файл | Когда |
|---|---|---|---|
| place | Place the library in the project folder (target: on /design/shtukbase-ui-react.md); --force replaces edited files too | actions/place.ts | после установки после обновления |
| library | The library is intact: files in place, imports find their files норма SBR-R01 | checks/library.ts | проверка |
| states | A component has a states file норма SBR-R02 | checks/states.ts | проверка |
| same | The same components as the HTML library: valid headers, the same ids, levels and controls норма SBR-R03 | checks/same.ts | проверка |
Проверки запускает shtuk check, любое действие — shtuk run shtukbase-ui-react <имя>. Действия «после установки» запускаются сами, только если пакет из доверенного источника.
Страницы 4
Ложатся в проект по этим путям.
- /design/
- The Shtukbase React component library страница
- /norms/rules/shtukbase-ui-react/
- The component library is intact SBR-R01
- A component has a states file SBR-R02
- The same components as the HTML library SBR-R03
Файлы пакета 146
Ложатся в .shtukbase/packages/shtukbase-ui-react/; отсюда запускаются действия.